aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mpt/mpt_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/mpt/mpt_debug.c')
-rw-r--r--sys/dev/mpt/mpt_debug.c43
1 files changed, 33 insertions, 10 deletions
diff --git a/sys/dev/mpt/mpt_debug.c b/sys/dev/mpt/mpt_debug.c
index e7f75faa5b45..dd70dc9d8160 100644
--- a/sys/dev/mpt/mpt_debug.c
+++ b/sys/dev/mpt/mpt_debug.c
@@ -285,6 +285,7 @@ mpt_scsi_state(int code)
}
return buf;
}
+
static char *
mpt_scsi_status(int code)
{
@@ -298,10 +299,11 @@ mpt_scsi_status(int code)
snprintf(buf, sizeof buf, "Unknown (0x%08x)", code);
return buf;
}
-static char *
+
+static const char *
mpt_who(int who_init)
{
- char *who;
+ const char *who;
switch (who_init) {
case MPT_DB_INIT_NOONE: who = "No One"; break;
@@ -315,10 +317,10 @@ mpt_who(int who_init)
return who;
}
-static char *
+static const char *
mpt_state(u_int32_t mb)
{
- char *text;
+ const char *text;
switch (MPT_STATE(mb)) {
case MPT_DB_STATE_RESET: text = "Reset"; break;
@@ -347,6 +349,7 @@ mpt_scsi_tm_type(int code)
void
mpt_print_db(u_int32_t mb)
{
+
printf("mpt mailbox: (0x%x) State %s WhoInit %s\n",
mb, mpt_state(mb), mpt_who(MPT_WHO(mb)));
}
@@ -357,6 +360,7 @@ mpt_print_db(u_int32_t mb)
static void
mpt_print_reply_hdr(MSG_DEFAULT_REPLY *msg)
{
+
printf("%s Reply @ %p\n", mpt_ioc_function(msg->Function), msg);
printf("\tIOC Status %s\n", mpt_ioc_status(msg->IOCStatus));
printf("\tIOCLogInfo 0x%08x\n", msg->IOCLogInfo);
@@ -368,6 +372,7 @@ mpt_print_reply_hdr(MSG_DEFAULT_REPLY *msg)
static void
mpt_print_init_reply(MSG_IOC_INIT_REPLY *msg)
{
+
mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg);
printf("\tWhoInit %s\n", mpt_who(msg->WhoInit));
printf("\tMaxDevices 0x%02x\n", msg->MaxDevices);
@@ -377,6 +382,7 @@ mpt_print_init_reply(MSG_IOC_INIT_REPLY *msg)
static void
mpt_print_ioc_facts(MSG_IOC_FACTS_REPLY *msg)
{
+
mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg);
printf("\tIOCNumber %d\n", msg->IOCNumber);
printf("\tMaxChainDepth %d\n", msg->MaxChainDepth);
@@ -402,6 +408,7 @@ mpt_print_ioc_facts(MSG_IOC_FACTS_REPLY *msg)
static void
mpt_print_enable_reply(MSG_PORT_ENABLE_REPLY *msg)
{
+
mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg);
printf("\tPort: %d\n", msg->PortNumber);
}
@@ -409,6 +416,7 @@ mpt_print_enable_reply(MSG_PORT_ENABLE_REPLY *msg)
static void
mpt_print_scsi_io_reply(MSG_SCSI_IO_REPLY *msg)
{
+
mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg);
printf("\tBus: %d\n", msg->Bus);
printf("\tTargetID %d\n", msg->TargetID);
@@ -420,11 +428,10 @@ mpt_print_scsi_io_reply(MSG_SCSI_IO_REPLY *msg)
printf("\tResponseInfo 0x%08x\n", msg->ResponseInfo);
}
-
-
static void
mpt_print_event_notice(MSG_EVENT_NOTIFY_REPLY *msg)
{
+
mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg);
printf("\tEvent: %s\n", mpt_ioc_event(msg->Event));
printf("\tEventContext 0x%04x\n", msg->EventContext);
@@ -517,7 +524,7 @@ mpt_print_request_hdr(MSG_REQUEST_HEADER *req)
printf("\tMsgContext 0x%08x\n", req->MsgContext);
}
-void
+static void
mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *orig_msg)
{
MSG_SCSI_IO_REQUEST local, *msg = &local;
@@ -575,6 +582,7 @@ mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *orig_msg)
static void
mpt_print_scsi_tmf_request(MSG_SCSI_TASK_MGMT *msg)
{
+
mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg);
printf("\tLun 0x%02x\n", msg->LUN[1]);
printf("\tTaskType %s\n", mpt_scsi_tm_type(msg->TaskType));
@@ -585,6 +593,7 @@ mpt_print_scsi_tmf_request(MSG_SCSI_TASK_MGMT *msg)
static void
mpt_print_scsi_target_assist_request(PTR_MSG_TARGET_ASSIST_REQUEST msg)
{
+
mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg);
printf("\tStatusCode 0x%02x\n", msg->StatusCode);
printf("\tTargetAssist 0x%02x\n", msg->TargetAssistFlags);
@@ -600,6 +609,7 @@ static void
mpt_print_scsi_target_status_send_request(MSG_TARGET_STATUS_SEND_REQUEST *msg)
{
SGE_IO_UNION x;
+
mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg);
printf("\tStatusCode 0x%02x\n", msg->StatusCode);
printf("\tStatusFlags 0x%02x\n", msg->StatusFlags);
@@ -637,7 +647,14 @@ mpt_print_request(void *vreq)
}
}
-int
+#if 0
+typedef struct mpt_decode_entry {
+ char *name;
+ u_int value;
+ u_int mask;
+} mpt_decode_entry_t;
+
+static int
mpt_decode_value(mpt_decode_entry_t *table, u_int num_entries,
const char *name, u_int value, u_int *cur_column,
u_int wrap_point)
@@ -689,7 +706,7 @@ mpt_decode_value(mpt_decode_entry_t *table, u_int num_entries,
return (printed);
}
-static mpt_decode_entry_t req_state_parse_table[] = {
+static const mpt_decode_entry_t req_state_parse_table[] = {
{ "REQ_FREE", 0x00, 0xff },
{ "REQ_ALLOCATED", 0x01, 0x01 },
{ "REQ_QUEUED", 0x02, 0x02 },
@@ -698,13 +715,15 @@ static mpt_decode_entry_t req_state_parse_table[] = {
{ "REQ_NEED_WAKEUP", 0x10, 0x10 }
};
-void
+static void
mpt_req_state(mpt_req_state_t state)
{
+
mpt_decode_value(req_state_parse_table,
NUM_ELEMENTS(req_state_parse_table),
"REQ_STATE", state, NULL, 80);
}
+#endif
#define LAST_SGE ( \
MPI_SGE_FLAGS_END_OF_LIST | \
@@ -805,6 +824,7 @@ mpt_dump_data(struct mpt_softc *mpt, const char *msg, void *addr, int len)
{
int offset;
uint8_t *cp = addr;
+
mpt_prt(mpt, "%s:", msg);
for (offset = 0; offset < len; offset++) {
if ((offset & 0xf) == 0) {
@@ -820,6 +840,7 @@ mpt_dump_request(struct mpt_softc *mpt, request_t *req)
{
uint32_t *pReq = req->req_vbuf;
int o;
+
#if __FreeBSD_version >= 500000
mpt_prt(mpt, "Send Request %d (%jx):",
req->index, (uintmax_t) req->req_pbuf);
@@ -850,6 +871,7 @@ mpt_lprt(struct mpt_softc *mpt, int level, const char *fmt, ...)
}
}
+#if 0
void
mpt_lprtc(struct mpt_softc *mpt, int level, const char *fmt, ...)
{
@@ -861,6 +883,7 @@ mpt_lprtc(struct mpt_softc *mpt, int level, const char *fmt, ...)
}
}
#endif
+#endif
void
mpt_prt(struct mpt_softc *mpt, const char *fmt, ...)