Bug FreeBSD 4.8 ATA driver

Dan Lukes dan at obluda.cz
Thu Aug 28 17:00:39 PDT 2003


Mikulas Patocka wrote:

>>>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)) {

>>	Hm, it should be (IMHO)
>>if (!((pci_read_config(parent,0x40,4)>>(ch->unit<<5))&0x4000))
> 
> 
> That is incorrect too --- if ch->unit is 1, ch->unit<<5 is 32 and you
> can't shift 32-bit integer by 32 bits.

	My mistake. Configuration double-word at offset 64 (decimal) contain 
two word - one per unit. So, correct access to each word is
if (!((pci_read_config(parent,0x40,4)>>(ch->unit<<4))&0x4000))

	My theory about source of error ('8' key just above '5') is void, of 
course.

>>	A smel bych, uz asi mimo konferenci, vedet, proc si pises vlastni ATA
>>ovladac ?

> No, zatim to neni moc verejny projekt.

	OK. Ja jen, ze se pred nekolika malo lety na MFF obhajoval projekt OS 
kde take meli vlastni ATA ovladace (a psal jsem je do znacne miry ja) - 
tak me jen tak napadlo, ze uz se zase pise nejaky podobny projekt nebo 
diplomka.


					Sincerely

							Dan




More information about the freebsd-hackers mailing list