From 8f99277d94510acfabd28020308b2b1f8fc301d7 Mon Sep 17 00:00:00 2001 From: mjacob Date: Wed, 24 Jun 1998 18:36:25 +0000 Subject: [PATCH] When printing an error, print more than just the opcode. Print the entire CDB, whose length is actually deterministic. This makes a *big* difference when actually trying to bind errors to commands. --- sys/dev/scsipi/scsi_verbose.c | 40 +++++++++++++++++++++++++++++++-- sys/dev/scsipi/scsipi_verbose.c | 40 +++++++++++++++++++++++++++++++-- 2 files changed, 76 insertions(+), 4 deletions(-) diff --git a/sys/dev/scsipi/scsi_verbose.c b/sys/dev/scsipi/scsi_verbose.c index 78e550f8f738..f1bafee95e89 100644 --- a/sys/dev/scsipi/scsi_verbose.c +++ b/sys/dev/scsipi/scsi_verbose.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsi_verbose.c,v 1.2 1998/04/15 16:52:37 mjacob Exp $ */ +/* $NetBSD: scsi_verbose.c,v 1.3 1998/06/24 18:36:25 mjacob Exp $ */ /* * Copyright (c) 1994, 1995, 1997 Charles M. Hannum. All rights reserved. @@ -476,7 +476,43 @@ scsi_print_sense(xs, verbosity) struct scsipi_xfer *xs; int verbosity; { + int i, j; + xs->sc_link->sc_print_addr(xs->sc_link); - printf(" Check Condition on opcode 0x%x\n", xs->cmd->opcode); + printf(" Check Condition on CDB: 0x%02x", xs->cmd->opcode); + + switch (CDB_GROUPID(xs->cmd->opcode)) { + case CDB_GROUPID_0: + j = CDB_GROUP0; + break; + case CDB_GROUPID_1: + j = CDB_GROUP1; + break; + case CDB_GROUPID_2: + j = CDB_GROUP2; + break; + case CDB_GROUPID_3: + j = CDB_GROUP3; + break; + case CDB_GROUPID_4: + j = CDB_GROUP4; + break; + case CDB_GROUPID_5: + j = CDB_GROUP5; + break; + case CDB_GROUPID_6: + j = CDB_GROUP6; + break; + case CDB_GROUPID_7: + j = CDB_GROUP7; + break; + default: + j = 0; + } + if (j == 0) + j = sizeof (xs->cmd->bytes); + for (i = 0; i < j-1; i++) /* already done the opcode */ + printf(" %02x", xs->cmd->bytes[i]); + printf("\n"); scsi_print_sense_data(&xs->sense.scsi_sense, verbosity); } diff --git a/sys/dev/scsipi/scsipi_verbose.c b/sys/dev/scsipi/scsipi_verbose.c index 9095bfe82787..94428ccef65a 100644 --- a/sys/dev/scsipi/scsipi_verbose.c +++ b/sys/dev/scsipi/scsipi_verbose.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsipi_verbose.c,v 1.2 1998/04/15 16:52:37 mjacob Exp $ */ +/* $NetBSD: scsipi_verbose.c,v 1.3 1998/06/24 18:36:25 mjacob Exp $ */ /* * Copyright (c) 1994, 1995, 1997 Charles M. Hannum. All rights reserved. @@ -476,7 +476,43 @@ scsi_print_sense(xs, verbosity) struct scsipi_xfer *xs; int verbosity; { + int i, j; + xs->sc_link->sc_print_addr(xs->sc_link); - printf(" Check Condition on opcode 0x%x\n", xs->cmd->opcode); + printf(" Check Condition on CDB: 0x%02x", xs->cmd->opcode); + + switch (CDB_GROUPID(xs->cmd->opcode)) { + case CDB_GROUPID_0: + j = CDB_GROUP0; + break; + case CDB_GROUPID_1: + j = CDB_GROUP1; + break; + case CDB_GROUPID_2: + j = CDB_GROUP2; + break; + case CDB_GROUPID_3: + j = CDB_GROUP3; + break; + case CDB_GROUPID_4: + j = CDB_GROUP4; + break; + case CDB_GROUPID_5: + j = CDB_GROUP5; + break; + case CDB_GROUPID_6: + j = CDB_GROUP6; + break; + case CDB_GROUPID_7: + j = CDB_GROUP7; + break; + default: + j = 0; + } + if (j == 0) + j = sizeof (xs->cmd->bytes); + for (i = 0; i < j-1; i++) /* already done the opcode */ + printf(" %02x", xs->cmd->bytes[i]); + printf("\n"); scsi_print_sense_data(&xs->sense.scsi_sense, verbosity); }