From 085f44145ca78845bee003f9ba5e142b33064def Mon Sep 17 00:00:00 2001 From: bouyer Date: Mon, 14 Feb 2000 12:37:35 +0000 Subject: [PATCH] - Be more strict in status check before sending a command (make sure DRQ is not asserted). Closes kern/9346. - Change the "fake identify before the real one" by a delay(). The real cause of the problem is that the drive is unresponsive just after a reset. The real problem (and the solution) showed up after the first change. --- sys/dev/ic/wdc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index 5cfef94ee014..08040d3c400a 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc.c,v 1.78 2000/01/17 00:01:01 bouyer Exp $ */ +/* $NetBSD: wdc.c,v 1.79 2000/02/14 12:37:35 bouyer Exp $ */ /* @@ -317,8 +317,11 @@ wdcattach(chp) if ((chp->ch_drive[i].drive_flags & DRIVE) == 0) continue; - /* Issue a IDENTIFY command, to try to detect slave ghost */ - ata_get_params(&chp->ch_drive[i], AT_POLL, ¶ms); + /* + * Wait a bit, some devices are weird just after a reset. + * Then issue a IDENTIFY command, to try to detect slave ghost + */ + delay(100); error = ata_get_params(&chp->ch_drive[i], AT_POLL, ¶ms); if (error == CMD_OK) { /* If IDENTIFY succeded, this is not an OLD ctrl */ @@ -1226,7 +1229,7 @@ __wdccommand_start(chp, xfer) bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_sdh, WDSD_IBM | (drive << 4)); - if (wdcwait(chp, wdc_c->r_st_bmask, wdc_c->r_st_bmask, + if (wdcwait(chp, wdc_c->r_st_bmask | WDCS_DRQ, wdc_c->r_st_bmask, wdc_c->timeout) != 0) { wdc_c->flags |= AT_TIMEOU; __wdccommand_done(chp, xfer);