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
This commit is contained in:
parent
bf72f68088
commit
d05caa00c5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39903
@ -25,7 +25,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Id: camcontrol.8,v 1.3 1998/09/17 16:12:30 ken Exp $
|
||||
.\" $Id: camcontrol.8,v 1.4 1998/09/21 20:44:39 ken Exp $
|
||||
.\"
|
||||
.Dd September 14, 1998
|
||||
.Dt CAMCONTROL 8
|
||||
@ -292,6 +292,9 @@ Enable CAM_DEBUG_INFO printfs.
|
||||
Enable CAM_DEBUG_TRACE printfs.
|
||||
.It Fl S
|
||||
Enable CAM_DEBUG_SUBTRACE printfs.
|
||||
.It Fl c
|
||||
Enable CAM_DEBUG_CDB printfs. This will cause the kernel to print out the
|
||||
SCSI CDBs sent to the specified device(s).
|
||||
.It all
|
||||
Enable debugging for all devices.
|
||||
.It off
|
||||
|
@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: camcontrol.c,v 1.1 1998/09/15 06:43:02 gibbs Exp $
|
||||
*/
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
@ -93,6 +93,7 @@ typedef enum {
|
||||
CAM_ARG_DEBUG_INFO = 0x10000000,
|
||||
CAM_ARG_DEBUG_TRACE = 0x20000000,
|
||||
CAM_ARG_DEBUG_SUBTRACE = 0x40000000,
|
||||
CAM_ARG_DEBUG_CDB = 0x80000000,
|
||||
CAM_ARG_FLAG_MASK = 0xfffffff0
|
||||
} cam_argmask;
|
||||
|
||||
@ -121,7 +122,7 @@ struct camcontrol_opts option_table[] = {
|
||||
{"devlist", CAM_ARG_DEVTREE, NULL},
|
||||
{"periphlist", CAM_ARG_DEVLIST, NULL},
|
||||
{"modepage", CAM_ARG_MODE_PAGE, "dem:P:"},
|
||||
{"debug", CAM_ARG_DEBUG, "ITS"},
|
||||
{"debug", CAM_ARG_DEBUG, "ITSc"},
|
||||
{"help", CAM_ARG_USAGE, NULL},
|
||||
{"-?", CAM_ARG_USAGE, NULL},
|
||||
{"-h", CAM_ARG_USAGE, NULL},
|
||||
@ -1676,6 +1677,10 @@ camdebug(int argc, char **argv, char *combinedopt)
|
||||
arglist |= CAM_ARG_DEBUG_SUBTRACE;
|
||||
ccb.cdbg.flags |= CAM_DEBUG_SUBTRACE;
|
||||
break;
|
||||
case 'c':
|
||||
arglist |= CAM_ARG_DEBUG_CDB;
|
||||
ccb.cdbg.flags |= CAM_DEBUG_CDB;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1763,7 +1768,7 @@ camdebug(int argc, char **argv, char *combinedopt)
|
||||
}
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
return(error);
|
||||
@ -1826,7 +1831,8 @@ usage(void)
|
||||
"debug arguments:\n"
|
||||
"-I CAM_DEBUG_INFO -- scsi commands, errors, data\n"
|
||||
"-T CAM_DEBUG_TRACE -- routine flow tracking\n"
|
||||
"-S CAM_DEBUG_SUBTRACE -- internal routine command flow\n",
|
||||
"-S CAM_DEBUG_SUBTRACE -- internal routine command flow\n"
|
||||
"-c CAM_DEBUG_CDB -- print out SCSI CDBs only\n",
|
||||
DEFAULT_DEVICE, DEFAULT_UNIT);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.479 1998/10/01 11:48:38 yokota Exp $
|
||||
# $Id: LINT,v 1.480 1998/10/02 05:15:51 ken Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -667,8 +667,8 @@ device sctarg0 at scbus? # SCSI target
|
||||
# CAM_DEBUG_BUS: Debug the given bus. Use -1 to debug all busses.
|
||||
# CAM_DEBUG_TARGET: Debug the given target. Use -1 to debug all targets.
|
||||
# CAM_DEBUG_LUN: Debug the given lun. Use -1 to debug all luns.
|
||||
# CAM_DEBUG_FLAGS: OR together CAM_DEBUG_INFO, CAM_DEBUG_TRACE and
|
||||
# CAM_DEBUG_SUBTRACE
|
||||
# CAM_DEBUG_FLAGS: OR together CAM_DEBUG_INFO, CAM_DEBUG_TRACE,
|
||||
# CAM_DEBUG_SUBTRACE, and CAM_DEBUG_CDB
|
||||
#
|
||||
# CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds
|
||||
# SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions
|
||||
@ -682,7 +682,7 @@ options CAMDEBUG
|
||||
options "CAM_DEBUG_BUS=-1"
|
||||
options "CAM_DEBUG_TARGET=-1"
|
||||
options "CAM_DEBUG_LUN=-1"
|
||||
options "CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_SUBTRACE"
|
||||
options "CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_CDB"
|
||||
options "CAM_MAX_HIGHPOWER=4"
|
||||
options SCSI_NO_SENSE_STRINGS
|
||||
options SCSI_NO_OP_STRINGS
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.479 1998/10/01 11:48:38 yokota Exp $
|
||||
# $Id: LINT,v 1.480 1998/10/02 05:15:51 ken Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -667,8 +667,8 @@ device sctarg0 at scbus? # SCSI target
|
||||
# CAM_DEBUG_BUS: Debug the given bus. Use -1 to debug all busses.
|
||||
# CAM_DEBUG_TARGET: Debug the given target. Use -1 to debug all targets.
|
||||
# CAM_DEBUG_LUN: Debug the given lun. Use -1 to debug all luns.
|
||||
# CAM_DEBUG_FLAGS: OR together CAM_DEBUG_INFO, CAM_DEBUG_TRACE and
|
||||
# CAM_DEBUG_SUBTRACE
|
||||
# CAM_DEBUG_FLAGS: OR together CAM_DEBUG_INFO, CAM_DEBUG_TRACE,
|
||||
# CAM_DEBUG_SUBTRACE, and CAM_DEBUG_CDB
|
||||
#
|
||||
# CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds
|
||||
# SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions
|
||||
@ -682,7 +682,7 @@ options CAMDEBUG
|
||||
options "CAM_DEBUG_BUS=-1"
|
||||
options "CAM_DEBUG_TARGET=-1"
|
||||
options "CAM_DEBUG_LUN=-1"
|
||||
options "CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_SUBTRACE"
|
||||
options "CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_CDB"
|
||||
options "CAM_MAX_HIGHPOWER=4"
|
||||
options SCSI_NO_SENSE_STRINGS
|
||||
options SCSI_NO_OP_STRINGS
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.479 1998/10/01 11:48:38 yokota Exp $
|
||||
# $Id: LINT,v 1.480 1998/10/02 05:15:51 ken Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -667,8 +667,8 @@ device sctarg0 at scbus? # SCSI target
|
||||
# CAM_DEBUG_BUS: Debug the given bus. Use -1 to debug all busses.
|
||||
# CAM_DEBUG_TARGET: Debug the given target. Use -1 to debug all targets.
|
||||
# CAM_DEBUG_LUN: Debug the given lun. Use -1 to debug all luns.
|
||||
# CAM_DEBUG_FLAGS: OR together CAM_DEBUG_INFO, CAM_DEBUG_TRACE and
|
||||
# CAM_DEBUG_SUBTRACE
|
||||
# CAM_DEBUG_FLAGS: OR together CAM_DEBUG_INFO, CAM_DEBUG_TRACE,
|
||||
# CAM_DEBUG_SUBTRACE, and CAM_DEBUG_CDB
|
||||
#
|
||||
# CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds
|
||||
# SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions
|
||||
@ -682,7 +682,7 @@ options CAMDEBUG
|
||||
options "CAM_DEBUG_BUS=-1"
|
||||
options "CAM_DEBUG_TARGET=-1"
|
||||
options "CAM_DEBUG_LUN=-1"
|
||||
options "CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_SUBTRACE"
|
||||
options "CAM_DEBUG_FLAGS=CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_CDB"
|
||||
options "CAM_MAX_HIGHPOWER=4"
|
||||
options SCSI_NO_SENSE_STRINGS
|
||||
options SCSI_NO_OP_STRINGS
|
||||
|
Loading…
Reference in New Issue
Block a user