Subject: Re: kern/22869: Slave IDE drive not detected
To: None <tech-kern@netbsd.org>
From: None <cube@cubidou.net>
List: tech-kern
Date: 09/22/2003 14:15:46
On Mon, Sep 22, 2003 at 02:03:08PM +0200, cube@cubidou.net wrote:
> On Mon, Sep 22, 2003 at 01:24:45PM +0200, Manuel Bouyer wrote:
[...]
> 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?

Note that before that, it does a reset, and wait for 100ms between each
of the 310 potential loops of the checks. Thus probe time is up to 30
seconds...

Quentin Garnier.