summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2004-02-21 09:34:57 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2004-02-21 09:34:57 +0000
commita35f09e980ef39bbe536c2b268bad52f2790bd21 (patch)
tree1c82d9d93d2911fbff1ba15468648c422b82d3a9
parent0abd808663db59e4c1bbf75fa0f6948cccce36d2 (diff)
SCSI_DATA_OUT doesn't mean transfer from host in all cases, when
requesting sense we reuse the same scsi xfer so flags lie and we should check for C_SENSE too. Eliminates pciide timeouts at the end of every burning with cdrecord. Bug introduced, found and then fixed by costa@. ok costa@ krw@
-rw-r--r--sys/dev/atapiscsi/atapiscsi.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/atapiscsi/atapiscsi.c b/sys/dev/atapiscsi/atapiscsi.c
index c1b06d02e3a..1bfe29f3ecd 100644
--- a/sys/dev/atapiscsi/atapiscsi.c
+++ b/sys/dev/atapiscsi/atapiscsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atapiscsi.c,v 1.71 2004/02/13 23:47:29 grange Exp $ */
+/* $OpenBSD: atapiscsi.c,v 1.72 2004/02/21 09:34:56 grange Exp $ */
/*
* This code is derived from code with the copyright below.
@@ -1010,6 +1010,7 @@ wdc_atapi_intr_data(chp, xfer, timeout, ret)
struct ata_drive_datas *drvp = &chp->ch_drive[xfer->drive];
int len, ire;
char *message;
+ int tohost;
len = (CHP_READ_REG(chp, wdr_cyl_hi) << 8) |
CHP_READ_REG(chp, wdr_cyl_lo);
@@ -1034,6 +1035,8 @@ wdc_atapi_intr_data(chp, xfer, timeout, ret)
}
}
+ tohost = ((sc_xfer->flags & SCSI_DATA_IN) != 0 ||
+ (xfer->c_flags & C_SENSE) != 0);
if (xfer->c_bcount >= len) {
WDCDEBUG_PRINT(("wdc_atapi_intr: c_bcount %d len %d "
@@ -1043,7 +1046,7 @@ wdc_atapi_intr_data(chp, xfer, timeout, ret)
DEBUG_INTR);
/* Common case */
- if (sc_xfer->flags & SCSI_DATA_OUT)
+ if (!tohost)
wdc_output_bytes(drvp, (u_int8_t *)xfer->databuf +
xfer->c_skip, len);
else
@@ -1055,7 +1058,7 @@ wdc_atapi_intr_data(chp, xfer, timeout, ret)
} else {
/* Exceptional case - drive want to transfer more
data than we have buffer for */
- if (sc_xfer->flags & SCSI_DATA_OUT) {
+ if (!tohost) {
/* Wouldn't it be better to just abort here rather
than to write random stuff to drive? */
printf("wdc_atapi_intr: warning: device requesting "