summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-07-21 09:08:50 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-07-21 09:08:50 +0000
commit940f91c9a647b6a5107db7e7135d75e3fba47891 (patch)
treed416cc9222a88c40cf9e5ce8e70b31762afb003e
parentbab02a638559e042fe918fc373cd627bf5347c07 (diff)
Undo last fix to ata_wdc.c. Don't deregister timeout in generic code
-rw-r--r--sys/dev/ata/ata_wdc.c33
-rw-r--r--sys/dev/atapiscsi/atapiscsi.c4
-rw-r--r--sys/dev/ic/wdc.c3
3 files changed, 27 insertions, 13 deletions
diff --git a/sys/dev/ata/ata_wdc.c b/sys/dev/ata/ata_wdc.c
index c98c9b9f22b..31a93134f43 100644
--- a/sys/dev/ata/ata_wdc.c
+++ b/sys/dev/ata/ata_wdc.c
@@ -114,6 +114,7 @@ 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 *));
@@ -160,6 +161,22 @@ 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;
@@ -167,7 +184,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. */
@@ -179,10 +196,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));
@@ -192,7 +209,6 @@ 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);
@@ -336,7 +352,6 @@ 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);
@@ -344,7 +359,6 @@ 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",
@@ -487,9 +501,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 */
@@ -674,13 +688,12 @@ 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;
}
diff --git a/sys/dev/atapiscsi/atapiscsi.c b/sys/dev/atapiscsi/atapiscsi.c
index c9a5f126236..27581c27e23 100644
--- a/sys/dev/atapiscsi/atapiscsi.c
+++ b/sys/dev/atapiscsi/atapiscsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atapiscsi.c,v 1.48 2001/07/10 01:08:02 csapuntz Exp $ */
+/* $OpenBSD: atapiscsi.c,v 1.49 2001/07/21 09:08:49 csapuntz Exp $ */
/*
* This code is derived from code with the copyright below.
@@ -544,6 +544,8 @@ wdc_atapi_intr(chp, xfer, irq)
struct wdc_xfer *xfer;
int irq;
{
+ timeout_del(&chp->ch_timo);
+
/* XXX we should consider an alternate signaling regime here */
if (xfer->c_flags & C_TIMEOU) {
xfer->c_flags &= ~C_TIMEOU;
diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c
index fb8fe248d1f..63d1e3b762c 100644
--- a/sys/dev/ic/wdc.c
+++ b/sys/dev/ic/wdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdc.c,v 1.38 2001/07/19 19:45:01 csapuntz Exp $ */
+/* $OpenBSD: wdc.c,v 1.39 2001/07/21 09:08:48 csapuntz Exp $ */
/* $NetBSD: wdc.c,v 1.68 1999/06/23 19:00:17 bouyer Exp $ */
@@ -843,7 +843,6 @@ wdcintr(arg)
WDCDEBUG_PRINT(("wdcintr\n"), DEBUG_INTR);
xfer = chp->ch_queue->sc_xfer.tqh_first;
chp->ch_flags &= ~WDCF_IRQ_WAIT;
- timeout_del(&chp->ch_timo);
ret = xfer->c_intr(chp, xfer, 1);
if (ret == 0) /* irq was not for us, still waiting for irq */
chp->ch_flags |= WDCF_IRQ_WAIT;