Add PERIPH and XPT debug options to camcontrol. This makes all CAM debug

options tunable from userland.

Approved by:	ken
MFC after:	3 days
This commit is contained in:
Nate Lawson 2002-12-17 06:05:21 +00:00
parent e38cfb14fe
commit a7e5261e30
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107966
2 changed files with 22 additions and 4 deletions

View File

@ -107,8 +107,10 @@
.Nm
.Ic debug
.Op Fl I
.Op Fl P
.Op Fl T
.Op Fl S
.Op Fl X
.Op Fl c
.Aq all|off|bus Ns Op :target Ns Op :lun
.Nm
@ -406,10 +408,14 @@ function takes a number of arguments:
.Bl -tag -width 18n
.It Fl I
Enable CAM_DEBUG_INFO printfs.
.It Fl P
Enable CAM_DEBUG_PERIPH printfs.
.It Fl T
Enable CAM_DEBUG_TRACE printfs.
.It Fl S
Enable CAM_DEBUG_SUBTRACE printfs.
.It Fl X
Enable CAM_DEBUG_XPT 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).

View File

@ -99,6 +99,8 @@ typedef enum {
CAM_ARG_DEBUG_TRACE = 0x02000000,
CAM_ARG_DEBUG_SUBTRACE = 0x04000000,
CAM_ARG_DEBUG_CDB = 0x08000000,
CAM_ARG_DEBUG_XPT = 0x10000000,
CAM_ARG_DEBUG_PERIPH = 0x20000000,
} cam_argmask;
struct camcontrol_opts {
@ -138,7 +140,7 @@ struct camcontrol_opts option_table[] = {
{"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"},
{"negotiate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts},
{"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts},
{"debug", CAM_CMD_DEBUG, CAM_ARG_NONE, "ITSc"},
{"debug", CAM_CMD_DEBUG, CAM_ARG_NONE, "IPTSXc"},
{"format", CAM_CMD_FORMAT, CAM_ARG_NONE, "qwy"},
#endif /* MINIMALISTIC */
{"help", CAM_CMD_USAGE, CAM_ARG_NONE, NULL},
@ -2009,6 +2011,10 @@ camdebug(int argc, char **argv, char *combinedopt)
arglist |= CAM_ARG_DEBUG_INFO;
ccb.cdbg.flags |= CAM_DEBUG_INFO;
break;
case 'P':
arglist |= CAM_ARG_DEBUG_PERIPH;
ccb.cdbg.flags |= CAM_DEBUG_PERIPH;
break;
case 'S':
arglist |= CAM_ARG_DEBUG_SUBTRACE;
ccb.cdbg.flags |= CAM_DEBUG_SUBTRACE;
@ -2017,6 +2023,10 @@ camdebug(int argc, char **argv, char *combinedopt)
arglist |= CAM_ARG_DEBUG_TRACE;
ccb.cdbg.flags |= CAM_DEBUG_TRACE;
break;
case 'X':
arglist |= CAM_ARG_DEBUG_XPT;
ccb.cdbg.flags |= CAM_DEBUG_XPT;
break;
case 'c':
arglist |= CAM_ARG_DEBUG_CDB;
ccb.cdbg.flags |= CAM_DEBUG_CDB;
@ -2048,8 +2058,9 @@ camdebug(int argc, char **argv, char *combinedopt)
if (strncmp(tstr, "off", 3) == 0) {
ccb.cdbg.flags = CAM_DEBUG_NONE;
arglist &= ~(CAM_ARG_DEBUG_INFO|CAM_ARG_DEBUG_TRACE|
CAM_ARG_DEBUG_SUBTRACE);
arglist &= ~(CAM_ARG_DEBUG_INFO|CAM_ARG_DEBUG_PERIPH|
CAM_ARG_DEBUG_TRACE|CAM_ARG_DEBUG_SUBTRACE|
CAM_ARG_DEBUG_XPT);
} else if (strncmp(tstr, "all", 3) != 0) {
tmpstr = (char *)strtok(tstr, ":");
if ((tmpstr != NULL) && (*tmpstr != '\0')){
@ -3148,7 +3159,8 @@ usage(int verbose)
" [-P pagectl][-e | -b][-d]\n"
" camcontrol cmd [dev_id][generic args] <-c cmd [args]>\n"
" [-i len fmt|-o len fmt [args]]\n"
" camcontrol debug [-I][-T][-S][-c] <all|bus[:target[:lun]]|off>\n"
" camcontrol debug [-I][-P][-T][-S][-X][-c]\n"
" <all|bus[:target[:lun]]|off>\n"
" camcontrol tags [dev_id][generic args] [-N tags] [-q] [-v]\n"
" camcontrol negotiate [dev_id][generic args] [-a][-c]\n"
" [-D <enable|disable>][-O offset][-q]\n"