Subject: Re: ATA/ATAPI kernel redesign
To: Lloyd Parkes <>
From: Manuel Bouyer <>
List: tech-kern
Date: 02/24/2002 19:51:28
On Sun, Feb 24, 2002 at 02:33:38PM +1300, Lloyd Parkes wrote:
> > I've been thinking about this for some time yet, and there is no need to
> > separate the drivers.
> I disagree. We currently have code in wdc.c that does things to ATA devices 
> that vary from merely not recommended to strictly forbidden. I want NetBSD to 
> have the best quality ATA/ATAPI driver that it can, and I believe that we need 
> to shed much of the old WDC code to do this.

Can you be more precise about this ? The code for pre-ATA should be run only
for devices that really can be pre-ata devices (flag passed from the
bus-dependant front end; WDC_OLD or something like that (don't have a source
tree handy), this flag should only be set by the ISA front end).
There are other code here which diverge from the spec, but this is to
work around broken *ATA* devices. I don't remember the details but the cvs
logs should have them.

> > ..., or
> > brokeness of the ATA specs (like the 30s delay after a reset).
> This raises another point. We don't wait for 30s after a reset, and we 

If I remeber properly we do, unless the port read returns a very likely broken
value (like 0xff).

> shouldn't be doing resets (according to the bit if the spec that I recall). I 

I don't recall the specs saying that. Doing a reset is the only way to have the
device in a known working state, we can't avoid that. The BIOS or previous OS
may have done all sort of weirdness to the device, from setting up power
management to restricting access to parts of the device.

> don't mind waiting 30s for a disk to spin up, it's certainly better than some 

The problem is that, with some controller, you also have to wait 30s before
you can decide that there is no device here. With 2 channels this makes a
1mn delay.

> systems that have had to publish workarounds because they try and boot from 
> disks that haven't spun up yet.
> > Ripping out this code would probably break some ATA hardware.
> I do not want to remove any code that is needed to support any device that 
> identifies itself as either ATA or ATAPI. I expect that some older ATA devices 
> don't identify themselves as ATA, but they can still be driven by the old WDC 
> code.

Wich is the same as the ATA code, exept a few lines. Code duplication at this
level isn't the way to go.

I agree that a few things here can probably be improved, but splitting
the pre-ata support in a different driver is not the way to go. Way too much
code duplication.

Manuel Bouyer, LIP6, Universite Paris VI.