summaryrefslogtreecommitdiff
path: root/sys/dev/atapiscsi/atapiscsi.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>2001-01-29 02:18:34 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>2001-01-29 02:18:34 +0000
commita6d01f6abe202c6abf0245b6fcdd0e55e5860c24 (patch)
treeccb9c2e4622105acc82a49b01c7d60210620b455 /sys/dev/atapiscsi/atapiscsi.c
parent166a0c8d78b7c646482fd211a02b35ec031b5ad8 (diff)
Fix bug where timeouts triggered too early, caused panic on ATAPI tapes.
Removed hardcoded WDCDEBUG definitions.
Diffstat (limited to 'sys/dev/atapiscsi/atapiscsi.c')
-rw-r--r--sys/dev/atapiscsi/atapiscsi.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/dev/atapiscsi/atapiscsi.c b/sys/dev/atapiscsi/atapiscsi.c
index 348a6413df0..802cfa3fbc3 100644
--- a/sys/dev/atapiscsi/atapiscsi.c
+++ b/sys/dev/atapiscsi/atapiscsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atapiscsi.c,v 1.34 2000/12/19 05:10:06 csapuntz Exp $ */
+/* $OpenBSD: atapiscsi.c,v 1.35 2001/01/29 02:18:33 niklas Exp $ */
/*
* This code is derived from code with the copyright below.
@@ -78,8 +78,6 @@
#define READY 6
-#define WDCDEBUG
-
#define DEBUG_INTR 0x01
#define DEBUG_XFERS 0x02
#define DEBUG_STATUS 0x04
@@ -607,6 +605,7 @@ wdc_atapi_timer_handler(arg)
/* There is a race here between us and the interrupt */
s = splbio();
+ chp->ch_flags &= ~WDCF_IRQ_WAIT;
wdc_atapi_the_machine(chp, xfer, ctxt_timer);
splx(s);
}
@@ -706,7 +705,12 @@ wdc_atapi_the_machine(chp, xfer, ctxt)
xfer->endticks && (ticks - xfer->endticks >= 0));
if (xfer->timeout != -1)
- xfer->endticks = max((xfer->timeout * hz) / 1000, 1) + ticks;
+ /*
+ * Add 1 tick to compensate for the fact that we can be just
+ * microseconds before the tick changes.
+ */
+ xfer->endticks =
+ max((xfer->timeout * hz) / 1000, 1) + 1 + ticks;
if (xfer->claim_irq) claim_irq = xfer->claim_irq;