Subject: Re: kern/22869: Slave IDE drive not detected
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: None <cube@cubidou.net>
List: tech-kern
Date: 09/22/2003 14:03:08
On Mon, Sep 22, 2003 at 01:24:45PM +0200, Manuel Bouyer wrote:
> [redirected to tech-kern]
> 
> On Mon, Sep 22, 2003 at 04:56:47AM +0000, Charles M. Hannum wrote:
[...]
> > 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.

Correct me if I'm wrong, but my reading of the ATAng code in FreeBSD is
that it only performs registers IO.

(src/sys/dev/ata/ata-lowlevel.c)

Here's what the core loop does:

For each drive:
  select drive
  read wd_error, wd_cyl_{lo,hi}, wd_status
  if !(wd_status & WDCS_BSY)
    if wd_error == WDCE_AMNF
      /* drive found, additional test of wd_cyl_{lo,hi} with
       * magic values to detect an ATAPI device */
    else if (wd_status & (WDCS_DRDY | WDCS_CORR | WDCS_IDX | WDCS_ERR))
            && wd_cyl_lo == wd_error && wd_cyl_hi == wd_error
      /* continue looping for that drive */
    else
      /* stop looping, no device here */

Apparently, status register might be different whether a device is here
or not.

Is it worth trying something like that?

Quentin Garnier.