Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Aug 2003 14:32:52 +0200
From:      Dan Lukes <dan@obluda.cz>
To:        freebsd-hackers@freebsd.org, mikulas@artax.karlin.mff.cuni.cz
Subject:   Re: Bug FreeBSD 4.8 ATA driver
Message-ID:  <3F4B5374.1080306@obluda.cz>
In-Reply-To: <Pine.LNX.4.44.0308200130120.12189-100000@artax.karlin.mff.cuni.cz>
References:  <Pine.LNX.4.44.0308200130120.12189-100000@artax.karlin.mff.cuni.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F4B5374.1080306>