diff options
author | ken <ken@FreeBSD.org> | 1998-10-02 21:00:58 +0000 |
---|---|---|
committer | ken <ken@FreeBSD.org> | 1998-10-02 21:00:58 +0000 |
commit | 1ad65369755d2b6446c378c73f956c9a73ac5281 (patch) | |
tree | a06ca2b59d1188c2dcf0139dae03f582c82a0fe3 /sys/cam | |
parent | 6d472197ec99beea28652e8ef0c17a6f72b25fea (diff) | |
download | FreeBSD-src-1ad65369755d2b6446c378c73f956c9a73ac5281.zip FreeBSD-src-1ad65369755d2b6446c378c73f956c9a73ac5281.tar.gz |
Add a new CAM debugging mode, CAM_DEBUG_CDB. This causes the kernel to
print out a one line description/dump of every SCSI CDB sent to a
particular debugging target or targets.
This is a good bit more useful than the other debugging modes, I think.
Change some things in LINT to note the availability of this new option.
Fix an erroneous argument to scsi_cdb_string() in scsi_all.c
Reviewed by: gibbs
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/cam_debug.h | 3 | ||||
-rw-r--r-- | sys/cam/cam_xpt.c | 16 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_all.c | 4 |
3 files changed, 19 insertions, 4 deletions
diff --git a/sys/cam/cam_debug.h b/sys/cam/cam_debug.h index f1b95f2..198650e 100644 --- a/sys/cam/cam_debug.h +++ b/sys/cam/cam_debug.h @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: cam_debug.h,v 1.1 1998/09/15 06:33:23 gibbs Exp $ */ #ifndef _CAM_CAM_DEBUG_H #define _CAM_CAM_DEBUG_H 1 @@ -42,6 +42,7 @@ typedef enum { CAM_DEBUG_INFO = 0x01, /* scsi commands, errors, data */ CAM_DEBUG_TRACE = 0x02, /* routine flow tracking */ CAM_DEBUG_SUBTRACE = 0x04, /* internal to routine flows */ + CAM_DEBUG_CDB = 0x08 /* print out SCSI CDBs only */ } cam_debug_flags; #if defined(CAMDEBUG) && defined(KERNEL) diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index c5e6837..be54a7b 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cam_xpt.c,v 1.13 1998/09/24 22:43:54 gibbs Exp $ + * $Id: cam_xpt.c,v 1.14 1998/09/25 22:35:56 gibbs Exp $ */ #include <sys/param.h> #include <sys/systm.h> @@ -2517,6 +2517,14 @@ xpt_action(union ccb *start_ccb) switch (start_ccb->ccb_h.func_code) { case XPT_SCSI_IO: + { +#ifdef CAMDEBUG + char cdb_str[(SCSI_MAX_CDBLEN * 3) + 1]; + struct cam_path *path; + + path = start_ccb->ccb_h.path; +#endif + /* * For the sake of compatibility with SCSI-1 * devices that may not understand the identify @@ -2543,7 +2551,13 @@ xpt_action(union ccb *start_ccb) start_ccb->csio.scsi_status = SCSI_STATUS_OK; start_ccb->csio.sense_resid = 0; start_ccb->csio.resid = 0; + CAM_DEBUG(path, CAM_DEBUG_CDB,("%s. CDB: %s\n", + scsi_op_desc(start_ccb->csio.cdb_io.cdb_bytes[0], + &path->device->inq_data), + scsi_cdb_string(start_ccb->csio.cdb_io.cdb_bytes, + cdb_str))); /* FALLTRHOUGH */ + } case XPT_TARGET_IO: case XPT_CONT_TARGET_IO: case XPT_ENG_EXEC: diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index 493f745..08ad98b 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scsi_all.c,v 1.3 1998/09/19 01:23:04 ken Exp $ + * $Id: scsi_all.c,v 1.4 1998/09/29 22:11:30 ken Exp $ */ #include <sys/param.h> @@ -1677,7 +1677,7 @@ scsi_sense_print(struct ccb_scsiio *csio) printf("%s. CDB: %s\n", scsi_op_desc(csio->cdb_io.cdb_bytes[0], &cgd.inq_data), scsi_cdb_string( - (u_int8_t *)&csio->cdb_io.cdb_bytes, cdb_str)); + csio->cdb_io.cdb_bytes, cdb_str)); } } |