Fixed a couple of missing drive selects in wdreset(). This mainly

affects cases where there is a slave but no master.  These bugs
were usually recovered from provided ATAPI was configured, but only
after lengthy delays.  Configuring ATAPI still fixes some bugs for
non-atapi drives.

Don't wait for seek complete in wdreset().  If necessary for pre-ata
drives, it can be waited for later (we got it wrong by only looking
at it for drive 0 anyway).  It is set as part of a historical
signature for ata drives but doesn't say anything useful about the
reset state.  It is cleared as part of a non-historical signature
for atapi drives so that drivers which don't understand atapi drives
seem to see no drive.  Waiting for it caused lengthy delays and
broke the status returned by wdreset() in cases where the master
was not an ata drive.  Then the whole wdprobe() failed in some
cases where the recovery code didn't work.

Don't wait for drive ready in wdreset().  The considerations are
the same as for seek complete, except drive ready does say something
useful about the reset state of ata drives, and waiting for it
later is required anyway for such drives.

Lengthy delays can now be avoided by not configuring nonexistent
(ata) drives.  Unfortunately, this breaks detection of atapi drives
in some configurations.
This commit is contained in:
bde 1999-03-23 10:22:19 +00:00
parent 05d4fd74bd
commit cdce50b4d4

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
* $Id: wd.c,v 1.188 1999/02/10 00:03:36 ken Exp $
* $Id: wd.c,v 1.189 1999/02/20 22:16:13 dt Exp $
*/
/* TODO:
@ -328,6 +328,7 @@ wdprobe(struct isa_device *dvp)
if (inb(du->dk_port + wd_cyl_lo) == 0xff) { /* XXX too weak */
#ifdef ATAPI
/* There is no master, try the ATAPI slave. */
du->dk_unit = 1;
outb(du->dk_port + wd_sdh, WDSD_IBM | 0x10);
outb(du->dk_port + wd_cyl_lo, 0xa5);
if (inb(du->dk_port + wd_cyl_lo) == 0xff)
@ -2299,8 +2300,9 @@ wdreset(struct disk *du)
outb(du->dk_altport, WDCTL_IDS | WDCTL_RST);
DELAY(10 * 1000);
outb(du->dk_altport, WDCTL_IDS);
outb(du->dk_port + wd_sdh, WDSD_IBM | (du->dk_unit << 4));
#ifdef ATAPI
if (wdwait(du, WDCS_READY | WDCS_SEEKCMPLT, TIMEOUT) != 0)
if (wdwait(du, 0, TIMEOUT) != 0)
err = 1; /* no IDE drive found */
du->dk_error = inb(du->dk_port + wd_error);
if (du->dk_error != 0x01)