summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-07-21 08:30:20 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-07-21 08:30:20 +0000
commitbab02a638559e042fe918fc373cd627bf5347c07 (patch)
tree3290a8a603935d4fce0139388ea8353c1d433428 /sys/dev
parent8b29a79da8cb11512f5c9d51523e0b1dff9d7cc3 (diff)
Don't hang on missing interrupts
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ata/ata_wdc.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/sys/dev/ata/ata_wdc.c b/sys/dev/ata/ata_wdc.c
index 31a93134f43..c98c9b9f22b 100644
--- a/sys/dev/ata/ata_wdc.c
+++ b/sys/dev/ata/ata_wdc.c
@@ -114,7 +114,6 @@ struct cfdriver wdc_cd = {
#endif
void wdc_ata_bio_start __P((struct channel_softc *,struct wdc_xfer *));
-void _wdc_ata_bio_start __P((struct channel_softc *,struct wdc_xfer *));
int wdc_ata_bio_intr __P((struct channel_softc *, struct wdc_xfer *, int));
void wdc_ata_bio_kill_xfer __P((struct channel_softc *,struct wdc_xfer *));
void wdc_ata_bio_done __P((struct channel_softc *, struct wdc_xfer *));
@@ -161,22 +160,6 @@ wdc_ata_bio_start(chp, xfer)
struct wdc_xfer *xfer;
{
struct ata_bio *ata_bio = xfer->cmd;
- WDCDEBUG_PRINT(("wdc_ata_bio_start %s:%d:%d\n",
- chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive),
- DEBUG_XFERS);
-
- /* start timeout machinery */
- if ((ata_bio->flags & ATA_POLL) == 0)
- timeout_add(&chp->ch_timo, ATA_DELAY / 1000 * hz);
- _wdc_ata_bio_start(chp, xfer);
-}
-
-void
-_wdc_ata_bio_start(chp, xfer)
- struct channel_softc *chp;
- struct wdc_xfer *xfer;
-{
- struct ata_bio *ata_bio = xfer->cmd;
struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive];
u_int16_t cyl;
u_int8_t head, sect, cmd = 0;
@@ -184,7 +167,7 @@ _wdc_ata_bio_start(chp, xfer)
int ata_delay;
int dma_flags = 0;
- WDCDEBUG_PRINT(("_wdc_ata_bio_start %s:%d:%d\n",
+ WDCDEBUG_PRINT(("wdc_ata_bio_start %s:%d:%d\n",
chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive),
DEBUG_INTR | DEBUG_XFERS);
/* Do control operations specially. */
@@ -196,10 +179,10 @@ _wdc_ata_bio_start(chp, xfer)
*/
/* at this point, we should only be in RECAL state */
if (drvp->state != RECAL) {
- printf("%s:%d:%d: bad state %d in _wdc_ata_bio_start\n",
+ printf("%s:%d:%d: bad state %d in wdc_ata_bio_start\n",
chp->wdc->sc_dev.dv_xname, chp->channel,
xfer->drive, drvp->state);
- panic("_wdc_ata_bio_start: bad state");
+ panic("wdc_ata_bio_start: bad state");
}
xfer->c_intr = wdc_ata_ctrl_intr;
CHP_WRITE_REG(chp, wdr_sdh, WDSD_IBM | (xfer->drive << 4));
@@ -209,6 +192,7 @@ _wdc_ata_bio_start(chp, xfer)
drvp->state = RECAL_WAIT;
if ((ata_bio->flags & ATA_POLL) == 0) {
chp->ch_flags |= WDCF_IRQ_WAIT;
+ timeout_add(&chp->ch_timo, ATA_DELAY / 1000 * hz);
} else {
/* Wait for at last 400ns for status bit to be valid */
DELAY(1);
@@ -352,6 +336,7 @@ again:
intr: /* Wait for IRQ (either real or polled) */
if ((ata_bio->flags & ATA_POLL) == 0) {
chp->ch_flags |= WDCF_IRQ_WAIT;
+ timeout_add(&chp->ch_timo, ATA_DELAY / 1000 * hz);
} else {
/* Wait for at last 400ns for status bit to be valid */
delay(1);
@@ -359,6 +344,7 @@ intr: /* Wait for IRQ (either real or polled) */
if ((ata_bio->flags & ATA_ITSDONE) == 0)
goto again;
}
+
return;
timeout:
printf("%s:%d:%d: not ready, st=0x%02x, err=0x%02x\n",
@@ -501,9 +487,9 @@ end:
if (xfer->c_bcount > 0) {
if ((ata_bio->flags & ATA_POLL) == 0) {
/* Start the next operation */
- _wdc_ata_bio_start(chp, xfer);
+ wdc_ata_bio_start(chp, xfer);
} else {
- /* Let _wdc_ata_bio_start do the loop */
+ /* Let wdc_ata_bio_start do the loop */
return 1;
}
} else { /* Done with this transfer */
@@ -688,12 +674,13 @@ again:
* The drive is usable now
*/
xfer->c_intr = wdc_ata_bio_intr;
- _wdc_ata_bio_start(chp, xfer);
+ wdc_ata_bio_start(chp, xfer);
return 1;
}
if ((ata_bio->flags & ATA_POLL) == 0) {
chp->ch_flags |= WDCF_IRQ_WAIT;
+ timeout_add(&chp->ch_timo, ATA_DELAY / 1000 * hz);
} else {
goto again;
}