Subject: Re: kern/22869: Slave IDE drive not detected
To: Charles M. Hannum <abuse@spamalicious.com>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 09/22/2003 13:24:45
[redirected to tech-kern]

On Mon, Sep 22, 2003 at 04:56:47AM +0000, Charles M. Hannum wrote:
> 
> > I wouldn't call it generic, but I suspect it's happening with most pciide
> > controllers. My theory is that these controllers have shadows registers of
> > the drives registers, and don't always bother reading the real value.
> 
> That might be what you'd think if you only read the ATA-5 spec, and
> not ATA-2 and earlier.  The reality is much dumber.

I was completely wrong on this, and was corrected by Quentin

> 
> Traditionally, if the master does not detect a slave device (by
> probing DIAGP during reset), it fakes the slave register access by
> exposing its own register file -- so it smells a bit like there is
> another device there -- but any attempt to actually execute a command
> fails.

Yes. I fond this in ata-2 up to ata-7.
This also mean we can't detect ghosts using registers read/writes.

> 
> Why it's done this way, WTF knows?  It comes up every year or two on
> the ATA mailing list, and nobody who's around any more seems to know
> why.  It's a historical oddity.
> 
> At any rate, proper detection of drives without 15- or 30-second
> stalls is very important, and it *will* be fixed.  It's not even
> vaguely correct to say that detecting the ghosting "won't speed up the
> probe" -- it has a huge and extremely obvious impact on many machines.

I do have a fix for it. With a kernel thread to handle the probes, we can
do it in parallel. So at last we don't wait n*timeout (n being the number of
channels) but only one time.
If a drive needs 10s to handle an inquiry after a reset, there's no
much way to work around it.

Also the registers write tests you added before the reset helps.

--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
     NetBSD: 24 ans d'experience feront toujours la difference
--