From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 26 20:47:11 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 397F016A4BF for ; Tue, 26 Aug 2003 20:47:11 -0700 (PDT) Received: from smtp3.vol.cz (smtp3.vol.cz [195.250.128.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1C5C143FE9 for ; Tue, 26 Aug 2003 20:47:10 -0700 (PDT) (envelope-from dan@obluda.cz) Received: from obluda.cz (xkulesh.vol.cz [195.250.154.106]) by smtp3.vol.cz (8.12.8p1/8.12.8) with ESMTP id h7R3l8xv049827 for ; Wed, 27 Aug 2003 05:47:08 +0200 (CEST) (envelope-from dan@obluda.cz) Message-ID: <3F4C29BB.4070005@obluda.cz> Date: Wed, 27 Aug 2003 05:47:07 +0200 From: Dan Lukes User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20030715 X-Accept-Language: cs, en MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Bug FreeBSD 4.8 ATA driver X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Aug 2003 03:47:11 -0000 Mikulas Patocka napsal/wrote, On 08/20/03 01:39: > I am reading FreeBSD ATA drivers because I want to use them as base for my > ATA driver and I found a total nonsence: in ata-dma.c in FreeBSD 4.8, > there is line > > if (!((pci_read_config(parent,0x40,4)>>(ch->unit<<8))&0x4000)) { > > if ch->unit is 1, config word is shifted by 256 bytes, which gives > undefined result in C. How was this meant? What should it do? Hm, it should be (IMHO) if (!((pci_read_config(parent,0x40,4)>>(ch->unit<<5))&0x4000)) but I can't verify it as have no access to documentation for PIIX3 nor acces to the PIIX3 hardware now. Note the position of '8' just above the '5' key on numeric keypad also ... FYI, the gcc compile the code as equivalent of if (!((pci_read_config(parent,0x40,4)>>(0))&0x4000)) effectively ignoring the ch->unit number. If you want wrote your own ATA driver, it may be better to look into current FreeBSD 5 ATA code - it's substantially rewrited. A smel bych, uz asi mimo konferenci, vedet, proc si pises vlastni ATA ovladac ? Dan -- Dan Lukes tel: +420 2 21914205, fax: +420 2 21914206 root of FIONet, KolejNET, webmaster of www.freebsd.cz AKA: dan@obluda.cz, dan@freebsd.cz,dan@kolej.mff.cuni.cz