summaryrefslogtreecommitdiff
path: root/sys/scsi/scsi_base.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2008-07-05 16:07:02 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2008-07-05 16:07:02 +0000
commite243eab42f02720058419419fdff7bde4aabca6b (patch)
tree33f9ed6a1741cfc7b863fa7dc51c942fe46b6b12 /sys/scsi/scsi_base.c
parent770455b7c55c272a513fd3a2f17b560528e19365 (diff)
When SCSIDEBUG'ing, print data about to be written (for commands
flagged SCSI_DATA_OUT) and data that has been returned (for commands flagged SCSI_DATA_IN). This is better than just printing the data buffer before the command is issued since that does not include any data that has been read. e.g. INQUIRY data, as thib@ and I discovered. ok marco@
Diffstat (limited to 'sys/scsi/scsi_base.c')
-rw-r--r--sys/scsi/scsi_base.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index f3ee37c4777..efba28543c9 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.129 2008/06/22 16:32:05 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.130 2008/07/05 16:07:01 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -877,7 +877,21 @@ scsi_scsi_cmd(struct scsi_link *sc_link, struct scsi_generic *scsi_cmd,
retries, timeout, bp, flags)) == NULL)
return (ENOMEM);
- if ((error = scsi_execute_xs(xs)) == EJUSTRETURN)
+#ifdef SCSIDEBUG
+ if ((sc_link->flags & SDEV_DB1) != 0)
+ if (xs->datalen && (xs->flags & SCSI_DATA_OUT))
+ show_mem(xs->data, min(64, xs->datalen));
+#endif /* SCSIDEBUG */
+
+ error = scsi_execute_xs(xs);
+
+#ifdef SCSIDEBUG
+ if ((sc_link->flags & SDEV_DB1) != 0)
+ if (xs->datalen && (xs->flags & SCSI_DATA_IN))
+ show_mem(xs->data, min(64, xs->datalen));
+#endif /* SCSIDEBUG */
+
+ if (error == EJUSTRETURN)
return (0);
s = splbio();
@@ -1943,8 +1957,6 @@ show_scsi_xs(struct scsi_xfer *xs)
printf("%x", b[i++]);
}
printf("-[%d bytes]\n", xs->datalen);
- if (xs->datalen)
- show_mem(xs->data, min(64, xs->datalen));
} else
printf("-RESET-\n");
}