summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2010-01-14 04:56:09 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2010-01-14 04:56:09 +0000
commit4e62147eb84f6157eb23f0038558320e07b24cb8 (patch)
treee90a34af130b731eb46a13bc957e94964114fc47 /sys/scsi
parenta69730b7f117ca9bba72d2d7d47dbf849fd43222 (diff)
Print sense data during SCSIDEBUG again. Always print the decoded
data when SCSIDEBUG is set, irrespective of SCSI_SILENT. Tweak output a bit. Noticed in output generated by todd@.
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/scsi_base.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 60e980e7bef..ec175621dc5 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.163 2010/01/14 00:32:46 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.164 2010/01/14 04:56:08 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -763,8 +763,6 @@ scsi_done(struct scsi_xfer *xs)
if (xs->sc_link->flags & SDEV_DB1) {
if (xs->datalen && (xs->flags & SCSI_DATA_IN))
scsi_show_mem(xs->data, min(64, xs->datalen));
- if (xs->status == XS_SENSE || xs->status == XS_SHORTSENSE)
- scsi_show_mem((u_char *)&xs->sense, sizeof(xs->sense));
}
#endif /* SCSIDEBUG */
@@ -992,6 +990,23 @@ scsi_interpret_sense(struct scsi_xfer *xs)
sense->flags & SSD_FILEMARK ? 1 : 0,
sense->extra_len));
+#ifdef SCSIDEBUG
+ if (xs->sc_link->flags & SDEV_DB1)
+ scsi_show_mem((u_char *)&xs->sense, sizeof(xs->sense));
+#endif /* SCSIDEBUG */
+
+ serr = sense->error_code & SSD_ERRCODE;
+ if (serr != SSD_ERRCODE_CURRENT && serr != SSD_ERRCODE_DEFERRED)
+ skey = 0xff; /* Invalid value, since key is 4 bit value. */
+ else
+ skey = sense->flags & SSD_KEY;
+
+#ifndef SCSIDEBUG
+ /* If not SCSIDEBUG, only print sense in some cases. */
+ if (skey && (xs->flags & SCSI_SILENT) == 0)
+#endif /* SCSIDEBUG */
+ scsi_print_sense(xs);
+
/*
* If the device has its own error handler, call it first.
* If it returns a legit error value, return that, otherwise
@@ -1005,14 +1020,9 @@ scsi_interpret_sense(struct scsi_xfer *xs)
return (error); /* error >= 0 better ? */
}
- /* Default sense interpretation. */
- serr = sense->error_code & SSD_ERRCODE;
- if (serr != SSD_ERRCODE_CURRENT && serr != SSD_ERRCODE_DEFERRED)
- skey = 0xff; /* Invalid value, since key is 4 bit value. */
- else
- skey = sense->flags & SSD_KEY;
-
/*
+ * Default sense interpretation.
+ *
* Interpret the key/asc/ascq information where appropriate.
*/
error = 0;
@@ -1129,9 +1139,6 @@ scsi_interpret_sense(struct scsi_xfer *xs)
break;
}
- if (skey && (xs->flags & SCSI_SILENT) == 0)
- scsi_print_sense(xs);
-
return (error);
}
@@ -1895,22 +1902,19 @@ scsi_xs_show(struct scsi_xfer *xs)
int i = 0;
sc_print_addr(xs->sc_link);
-
- printf("xs(%p): ", xs);
+ printf("xs (%p): ", xs);
printf("flg(0x%x)", xs->flags);
printf("sc_link(%p)", xs->sc_link);
printf("retr(0x%x)", xs->retries);
printf("timo(0x%x)", xs->timeout);
- printf("cmd(%p)", xs->cmd);
- printf("len(0x%x)", xs->cmdlen);
printf("data(%p)", xs->data);
- printf("len(0x%x)", xs->datalen);
printf("res(0x%x)", xs->resid);
printf("err(0x%x)", xs->error);
printf("bp(%p)\n", xs->bp);
- printf("command: ");
+ sc_print_addr(xs->sc_link);
+ printf("cmd (%p): ", xs->cmd);
if ((xs->flags & SCSI_RESET) == 0) {
while (i < xs->cmdlen) {