2 * Debug routines for LSI '909 FC adapters.
5 * Copyright (c) 2000, 2001 by Greg Ansley
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice immediately at the beginning of the file, without modification,
12 * this list of conditions, and the following disclaimer.
13 * 2. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * Additional Copyright (c) 2002 by Matthew Jacob under same license.
32 #include <sys/cdefs.h>
33 __FBSDID("$FreeBSD$");
35 #include <dev/mpt/mpt_freebsd.h>
36 #include <machine/stdarg.h> /* for use by mpt_prt below */
43 static const struct Error_Map IOC_Status[] = {
44 { MPI_IOCSTATUS_SUCCESS, "Success" },
45 { MPI_IOCSTATUS_INVALID_FUNCTION, "IOC: Invalid Function" },
46 { MPI_IOCSTATUS_BUSY, "IOC: Busy" },
47 { MPI_IOCSTATUS_INVALID_SGL, "IOC: Invalid SGL" },
48 { MPI_IOCSTATUS_INTERNAL_ERROR, "IOC: Internal Error" },
49 { MPI_IOCSTATUS_RESERVED, "IOC: Reserved" },
50 { MPI_IOCSTATUS_INSUFFICIENT_RESOURCES, "IOC: Insufficient Resources" },
51 { MPI_IOCSTATUS_INVALID_FIELD, "IOC: Invalid Field" },
52 { MPI_IOCSTATUS_INVALID_STATE, "IOC: Invalid State" },
53 { MPI_IOCSTATUS_CONFIG_INVALID_ACTION, "Invalid Action" },
54 { MPI_IOCSTATUS_CONFIG_INVALID_TYPE, "Invalid Type" },
55 { MPI_IOCSTATUS_CONFIG_INVALID_PAGE, "Invalid Page" },
56 { MPI_IOCSTATUS_CONFIG_INVALID_DATA, "Invalid Data" },
57 { MPI_IOCSTATUS_CONFIG_NO_DEFAULTS, "No Defaults" },
58 { MPI_IOCSTATUS_CONFIG_CANT_COMMIT, "Can't Commit" },
59 { MPI_IOCSTATUS_SCSI_RECOVERED_ERROR, "SCSI: Recoverd Error" },
60 { MPI_IOCSTATUS_SCSI_INVALID_BUS, "SCSI: Invalid Bus" },
61 { MPI_IOCSTATUS_SCSI_INVALID_TARGETID, "SCSI: Invalid Target ID" },
62 { MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE, "SCSI: Device Not There" },
63 { MPI_IOCSTATUS_SCSI_DATA_OVERRUN, "SCSI: Data Overrun" },
64 { MPI_IOCSTATUS_SCSI_DATA_UNDERRUN, "SCSI: Data Underrun" },
65 { MPI_IOCSTATUS_SCSI_IO_DATA_ERROR, "SCSI: Data Error" },
66 { MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR, "SCSI: Protocol Error" },
67 { MPI_IOCSTATUS_SCSI_TASK_TERMINATED, "SCSI: Task Terminated" },
68 { MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH, "SCSI: Residual Mismatch" },
69 { MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED, "SCSI: Task Management Failed" },
70 { MPI_IOCSTATUS_SCSI_IOC_TERMINATED, "SCSI: IOC Bus Reset" },
71 { MPI_IOCSTATUS_SCSI_EXT_TERMINATED, "SCSI: External Bus Reset" },
72 { MPI_IOCSTATUS_TARGET_PRIORITY_IO, "SCSI Target: Priority I/O" },
73 { MPI_IOCSTATUS_TARGET_INVALID_PORT, "SCSI Target: Invalid Port" },
74 { MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX, "SCSI Target: Invalid IOC Index" },
75 { MPI_IOCSTATUS_TARGET_ABORTED, "SCSI Target: Aborted" },
76 { MPI_IOCSTATUS_TARGET_NO_CONN_RETRYABLE, "SCSI Target: No Connection (Retryable)" },
77 { MPI_IOCSTATUS_TARGET_NO_CONNECTION, "SCSI Target: No Connection" },
78 { MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH,"SCSI Target: Transfer Count Mismatch" },
79 { MPI_IOCSTATUS_TARGET_FC_ABORTED, "FC: Aborted" },
80 { MPI_IOCSTATUS_TARGET_FC_RX_ID_INVALID, "FC: Recieve ID Invalid" },
81 { MPI_IOCSTATUS_TARGET_FC_DID_INVALID, "FC: Recieve DID Invalid" },
82 { MPI_IOCSTATUS_TARGET_FC_NODE_LOGGED_OUT,"FC: Node Logged Out" },
83 { MPI_IOCSTATUS_LAN_DEVICE_NOT_FOUND, "LAN: Device Not Found" },
84 { MPI_IOCSTATUS_LAN_DEVICE_FAILURE, "LAN: Device Not Failure" },
85 { MPI_IOCSTATUS_LAN_TRANSMIT_ERROR, "LAN: Transmit Error" },
86 { MPI_IOCSTATUS_LAN_TRANSMIT_ABORTED, "LAN: Transmit Aborted" },
87 { MPI_IOCSTATUS_LAN_RECEIVE_ERROR, "LAN: Recieve Error" },
88 { MPI_IOCSTATUS_LAN_RECEIVE_ABORTED, "LAN: Recieve Aborted" },
89 { MPI_IOCSTATUS_LAN_PARTIAL_PACKET, "LAN: Partial Packet" },
90 { MPI_IOCSTATUS_LAN_CANCELED, "LAN: Canceled" },
94 static const struct Error_Map IOC_Func[] = {
95 { MPI_FUNCTION_SCSI_IO_REQUEST, "SCSI IO Request" },
96 { MPI_FUNCTION_SCSI_TASK_MGMT, "SCSI Task Management" },
97 { MPI_FUNCTION_IOC_INIT, "IOC Init" },
98 { MPI_FUNCTION_IOC_FACTS, "IOC Facts" },
99 { MPI_FUNCTION_CONFIG, "Config" },
100 { MPI_FUNCTION_PORT_FACTS, "Port Facts" },
101 { MPI_FUNCTION_PORT_ENABLE, "Port Enable" },
102 { MPI_FUNCTION_EVENT_NOTIFICATION, "Event Notification" },
103 { MPI_FUNCTION_FW_DOWNLOAD, "FW Download" },
104 { MPI_FUNCTION_TARGET_CMD_BUFFER_POST, "SCSI Target Command Buffer" },
105 { MPI_FUNCTION_TARGET_ASSIST, "Target Assist" },
106 { MPI_FUNCTION_TARGET_STATUS_SEND, "Target Status Send" },
107 { MPI_FUNCTION_TARGET_MODE_ABORT, "Target Mode Abort" },
108 { MPI_FUNCTION_TARGET_FC_BUF_POST_LINK_SRVC, "FC: Link Service Buffers" },
109 { MPI_FUNCTION_TARGET_FC_RSP_LINK_SRVC, "FC: Link Service Response" },
110 { MPI_FUNCTION_TARGET_FC_EX_SEND_LINK_SRVC, "FC: Send Extended Link Service" },
111 { MPI_FUNCTION_TARGET_FC_ABORT, "FC: Abort" },
112 { MPI_FUNCTION_LAN_SEND, "LAN Send" },
113 { MPI_FUNCTION_LAN_RECEIVE, "LAN Recieve" },
114 { MPI_FUNCTION_LAN_RESET, "LAN Reset" },
118 static const struct Error_Map IOC_Event[] = {
119 { MPI_EVENT_NONE, "None" },
120 { MPI_EVENT_LOG_DATA, "LogData" },
121 { MPI_EVENT_STATE_CHANGE, "State Change" },
122 { MPI_EVENT_UNIT_ATTENTION, "Unit Attention" },
123 { MPI_EVENT_IOC_BUS_RESET, "IOC Bus Reset" },
124 { MPI_EVENT_EXT_BUS_RESET, "External Bus Reset" },
125 { MPI_EVENT_RESCAN, "Rescan" },
126 { MPI_EVENT_LINK_STATUS_CHANGE, "Link Status Change" },
127 { MPI_EVENT_LOOP_STATE_CHANGE, "Loop State Change" },
128 { MPI_EVENT_LOGOUT, "Logout" },
129 { MPI_EVENT_EVENT_CHANGE, "EventChange" },
133 static const struct Error_Map IOC_SCSIState[] = {
134 { MPI_SCSI_STATE_AUTOSENSE_VALID, "AutoSense_Valid" },
135 { MPI_SCSI_STATE_AUTOSENSE_FAILED, "AutoSense_Failed" },
136 { MPI_SCSI_STATE_NO_SCSI_STATUS, "No_SCSI_Status" },
137 { MPI_SCSI_STATE_TERMINATED, "State_Terminated" },
138 { MPI_SCSI_STATE_RESPONSE_INFO_VALID, "Repsonse_Info_Valid" },
139 { MPI_SCSI_STATE_QUEUE_TAG_REJECTED, "Queue Tag Rejected" },
143 static const struct Error_Map IOC_SCSIStatus[] = {
144 { SCSI_STATUS_OK, "OK" },
145 { SCSI_STATUS_CHECK_COND, "Check Condition" },
146 { SCSI_STATUS_COND_MET, "Check Condition Met" },
147 { SCSI_STATUS_BUSY, "Busy" },
148 { SCSI_STATUS_INTERMED, "Intermidiate Condition" },
149 { SCSI_STATUS_INTERMED_COND_MET, "Intermidiate Condition Met" },
150 { SCSI_STATUS_RESERV_CONFLICT, "Reservation Conflict" },
151 { SCSI_STATUS_CMD_TERMINATED, "Command Terminated" },
152 { SCSI_STATUS_QUEUE_FULL, "Queue Full" },
156 static const struct Error_Map IOC_Diag[] = {
157 { MPT_DIAG_ENABLED, "DWE" },
158 { MPT_DIAG_FLASHBAD, "FLASH_Bad" },
159 { MPT_DIAG_TTLI, "TTLI" },
160 { MPT_DIAG_RESET_IOC, "Reset" },
161 { MPT_DIAG_ARM_DISABLE, "DisARM" },
162 { MPT_DIAG_DME, "DME" },
167 static void mpt_dump_sgl(SGE_IO_UNION *sgl);
170 mpt_ioc_status(int code)
172 const struct Error_Map *status = IOC_Status;
174 while (status->Error_Code >= 0) {
175 if (status->Error_Code == (code & MPI_IOCSTATUS_MASK))
176 return status->Error_String;
179 snprintf(buf, sizeof buf, "Unknown (0x%08x)", code);
184 mpt_ioc_diag(u_int32_t code)
186 const struct Error_Map *status = IOC_Diag;
187 static char buf[128];
189 char *end = &buf[128];
191 ptr += snprintf(buf, sizeof buf, "(0x%08x)", code);
192 while (status->Error_Code >= 0) {
193 if ((status->Error_Code & code) != 0)
194 ptr += snprintf(ptr, (size_t)(end-ptr), "%s ",
195 status->Error_String);
202 mpt_ioc_function(int code)
204 const struct Error_Map *status = IOC_Func;
206 while (status->Error_Code >= 0) {
207 if (status->Error_Code == code)
208 return status->Error_String;
211 snprintf(buf, sizeof buf, "Unknown (0x%08x)", code);
215 mpt_ioc_event(int code)
217 const struct Error_Map *status = IOC_Event;
219 while (status->Error_Code >= 0) {
220 if (status->Error_Code == code)
221 return status->Error_String;
224 snprintf(buf, sizeof buf, "Unknown (0x%08x)", code);
228 mpt_scsi_state(int code)
230 const struct Error_Map *status = IOC_SCSIState;
231 static char buf[128];
233 char *end = &buf[128];
235 ptr += snprintf(buf, sizeof buf, "(0x%08x)", code);
236 while (status->Error_Code >= 0) {
237 if ((status->Error_Code & code) != 0)
238 ptr += snprintf(ptr, (size_t)(end-ptr), "%s ",
239 status->Error_String);
245 mpt_scsi_status(int code)
247 const struct Error_Map *status = IOC_SCSIStatus;
249 while (status->Error_Code >= 0) {
250 if (status->Error_Code == code)
251 return status->Error_String;
254 snprintf(buf, sizeof buf, "Unknown (0x%08x)", code);
258 mpt_who(int who_init)
263 case MPT_DB_INIT_NOONE: who = "No One"; break;
264 case MPT_DB_INIT_BIOS: who = "BIOS"; break;
265 case MPT_DB_INIT_ROMBIOS: who = "ROM BIOS"; break;
266 case MPT_DB_INIT_PCIPEER: who = "PCI Peer"; break;
267 case MPT_DB_INIT_HOST: who = "Host Driver"; break;
268 case MPT_DB_INIT_MANUFACTURE: who = "Manufacturing"; break;
269 default: who = "Unknown"; break;
275 mpt_state(u_int32_t mb)
279 switch (MPT_STATE(mb)) {
280 case MPT_DB_STATE_RESET: text = "Reset"; break;
281 case MPT_DB_STATE_READY: text = "Ready"; break;
282 case MPT_DB_STATE_RUNNING:text = "Running"; break;
283 case MPT_DB_STATE_FAULT: text = "Fault"; break;
284 default: text = "Unknown"; break;
290 mpt_print_db(u_int32_t mb)
292 printf("mpt mailbox: (0x%x) State %s WhoInit %s\n",
293 mb, mpt_state(mb), mpt_who(MPT_WHO(mb)));
296 /*****************************************************************************/
297 /* Reply functions */
298 /*****************************************************************************/
300 mpt_print_reply_hdr(MSG_DEFAULT_REPLY *msg)
302 printf("%s Reply @ %p\n", mpt_ioc_function(msg->Function), msg);
303 printf("\tIOC Status %s\n", mpt_ioc_status(msg->IOCStatus));
304 printf("\tIOCLogInfo 0x%08x\n", msg->IOCLogInfo);
305 printf("\tMsgLength 0x%02x\n", msg->MsgLength);
306 printf("\tMsgFlags 0x%02x\n", msg->MsgFlags);
307 printf("\tMsgContext 0x%08x\n", msg->MsgContext);
311 mpt_print_init_reply(MSG_IOC_INIT_REPLY *msg)
313 mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg);
314 printf("\tWhoInit %s\n", mpt_who(msg->WhoInit));
315 printf("\tMaxDevices 0x%02x\n", msg->MaxDevices);
316 printf("\tMaxBuses 0x%02x\n", msg->MaxBuses);
320 mpt_print_ioc_facts(MSG_IOC_FACTS_REPLY *msg)
322 mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg);
323 printf("\tIOCNumber %d\n", msg->IOCNumber);
324 printf("\tMaxChainDepth %d\n", msg->MaxChainDepth);
325 printf("\tWhoInit %s\n", mpt_who(msg->WhoInit));
326 printf("\tBlockSize %d\n", msg->BlockSize);
327 printf("\tFlags %d\n", msg->Flags);
328 printf("\tReplyQueueDepth %d\n", msg->ReplyQueueDepth);
329 printf("\tReqFrameSize 0x%04x\n", msg->RequestFrameSize);
330 printf("\tFW Version 0x%08x\n", msg->FWVersion.Word);
331 printf("\tProduct ID 0x%04x\n", msg->ProductID);
332 printf("\tCredits 0x%04x\n", msg->GlobalCredits);
333 printf("\tPorts %d\n", msg->NumberOfPorts);
334 printf("\tEventState 0x%02x\n", msg->EventState);
335 printf("\tHostMFA_HA 0x%08x\n", msg->CurrentHostMfaHighAddr);
336 printf("\tSenseBuf_HA 0x%08x\n",
337 msg->CurrentSenseBufferHighAddr);
338 printf("\tRepFrameSize 0x%04x\n", msg->CurReplyFrameSize);
339 printf("\tMaxDevices 0x%02x\n", msg->MaxDevices);
340 printf("\tMaxBuses 0x%02x\n", msg->MaxBuses);
341 printf("\tFWImageSize 0x%04x\n", msg->FWImageSize);
345 mpt_print_enable_reply(MSG_PORT_ENABLE_REPLY *msg)
347 mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg);
348 printf("\tPort: %d\n", msg->PortNumber);
352 mpt_print_scsi_io_reply(MSG_SCSI_IO_REPLY *msg)
354 mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg);
355 printf("\tBus: %d\n", msg->Bus);
356 printf("\tTargetID %d\n", msg->TargetID);
357 printf("\tCDBLength %d\n", msg->CDBLength);
358 printf("\tSCSI Status: %s\n", mpt_scsi_status(msg->SCSIStatus));
359 printf("\tSCSI State: %s\n", mpt_scsi_state(msg->SCSIState));
360 printf("\tTransferCnt 0x%04x\n", msg->TransferCount);
361 printf("\tSenseCnt 0x%04x\n", msg->SenseCount);
362 printf("\tResponseInfo 0x%08x\n", msg->ResponseInfo);
368 mpt_print_event_notice(MSG_EVENT_NOTIFY_REPLY *msg)
370 mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg);
371 printf("\tEvent: %s\n", mpt_ioc_event(msg->Event));
372 printf("\tEventContext 0x%04x\n", msg->EventContext);
373 printf("\tAckRequired %d\n", msg->AckRequired);
374 printf("\tEventDataLength %d\n", msg->EventDataLength);
375 printf("\tContinuation %d\n", msg->MsgFlags & 0x80);
377 case MPI_EVENT_LOG_DATA:
378 printf("\tEvtLogData: 0x%04x\n", msg->Data[0]);
381 case MPI_EVENT_UNIT_ATTENTION:
382 printf("\tTargetID: 0x%04x\n",
383 msg->Data[0] & 0xff);
384 printf("\tBus: 0x%04x\n",
385 (msg->Data[0] >> 8) & 0xff);
388 case MPI_EVENT_IOC_BUS_RESET:
389 case MPI_EVENT_EXT_BUS_RESET:
390 case MPI_EVENT_RESCAN:
391 printf("\tPort: %d\n",
392 (msg->Data[0] >> 8) & 0xff);
395 case MPI_EVENT_LINK_STATUS_CHANGE:
396 printf("\tLinkState: %d\n",
397 msg->Data[0] & 0xff);
398 printf("\tPort: %d\n",
399 (msg->Data[1] >> 8) & 0xff);
402 case MPI_EVENT_LOOP_STATE_CHANGE:
403 printf("\tType: %d\n",
404 (msg->Data[0] >> 16) & 0xff);
405 printf("\tChar3: 0x%02x\n",
406 (msg->Data[0] >> 8) & 0xff);
407 printf("\tChar4: 0x%02x\n",
408 (msg->Data[0] ) & 0xff);
409 printf("\tPort: %d\n",
410 (msg->Data[1] >> 8) & 0xff);
413 case MPI_EVENT_LOGOUT:
414 printf("\tN_PortId: 0x%04x\n", msg->Data[0]);
415 printf("\tPort: %d\n",
416 (msg->Data[1] >> 8) & 0xff);
423 mpt_print_reply(void *vmsg)
425 MSG_DEFAULT_REPLY *msg = vmsg;
427 switch (msg->Function) {
428 case MPI_FUNCTION_EVENT_NOTIFICATION:
429 mpt_print_event_notice((MSG_EVENT_NOTIFY_REPLY *)msg);
431 case MPI_FUNCTION_PORT_ENABLE:
432 mpt_print_enable_reply((MSG_PORT_ENABLE_REPLY *)msg);
434 case MPI_FUNCTION_IOC_FACTS:
435 mpt_print_ioc_facts((MSG_IOC_FACTS_REPLY *)msg);
437 case MPI_FUNCTION_IOC_INIT:
438 mpt_print_init_reply((MSG_IOC_INIT_REPLY *)msg);
440 case MPI_FUNCTION_SCSI_IO_REQUEST:
441 mpt_print_scsi_io_reply((MSG_SCSI_IO_REPLY *)msg);
444 mpt_print_reply_hdr((MSG_DEFAULT_REPLY *)msg);
449 /*****************************************************************************/
450 /* Request functions */
451 /*****************************************************************************/
453 mpt_print_request_hdr(MSG_REQUEST_HEADER *req)
455 printf("%s @ %p\n", mpt_ioc_function(req->Function), req);
456 printf("\tChain Offset 0x%02x\n", req->ChainOffset);
457 printf("\tMsgFlags 0x%02x\n", req->MsgFlags);
458 printf("\tMsgContext 0x%08x\n", req->MsgContext);
462 mpt_print_scsi_io_request(MSG_SCSI_IO_REQUEST *orig_msg)
464 MSG_SCSI_IO_REQUEST local, *msg = &local;
467 bcopy(orig_msg, msg, sizeof (MSG_SCSI_IO_REQUEST));
468 mpt_print_request_hdr((MSG_REQUEST_HEADER *)msg);
469 printf("\tBus: %d\n", msg->Bus);
470 printf("\tTargetID %d\n", msg->TargetID);
471 printf("\tSenseBufferLength %d\n", msg->SenseBufferLength);
472 printf("\tLUN: 0x%0x\n", msg->LUN[1]);
473 printf("\tControl 0x%08x ", msg->Control);
474 #define MPI_PRINT_FIELD(x) \
475 case MPI_SCSIIO_CONTROL_ ## x : \
476 printf(" " #x " "); \
479 switch (msg->Control & MPI_SCSIIO_CONTROL_DATADIRECTION_MASK) {
480 MPI_PRINT_FIELD(NODATATRANSFER);
481 MPI_PRINT_FIELD(WRITE);
482 MPI_PRINT_FIELD(READ);
484 printf(" Invalid DIR! ");
487 switch (msg->Control & MPI_SCSIIO_CONTROL_TASKATTRIBUTE_MASK) {
488 MPI_PRINT_FIELD(SIMPLEQ);
489 MPI_PRINT_FIELD(HEADOFQ);
490 MPI_PRINT_FIELD(ORDEREDQ);
491 MPI_PRINT_FIELD(ACAQ);
492 MPI_PRINT_FIELD(UNTAGGED);
493 MPI_PRINT_FIELD(NO_DISCONNECT);
495 printf(" Unknown attribute! ");
500 #undef MPI_PRINT_FIELD
502 printf("\tDataLength\t0x%08x\n", msg->DataLength);
503 printf("\tSenseBufAddr\t0x%08x\n", msg->SenseBufferLowAddr);
504 printf("\tCDB[0:%d]\t", msg->CDBLength);
505 for (i = 0; i < msg->CDBLength; i++)
506 printf("%02x ", msg->CDB[i]);
508 mpt_dump_sgl(&orig_msg->SGL);
512 mpt_print_request(void *vreq)
514 MSG_REQUEST_HEADER *req = vreq;
516 switch (req->Function) {
517 case MPI_FUNCTION_SCSI_IO_REQUEST:
518 mpt_print_scsi_io_request((MSG_SCSI_IO_REQUEST *)req);
521 mpt_print_request_hdr(req);
527 mpt_req_state(enum mpt_req_state state)
532 case REQ_FREE: text = "Free"; break;
533 case REQ_IN_PROGRESS: text = "In Progress"; break;
534 case REQ_ON_CHIP: text = "On Chip"; break;
535 case REQ_TIMEOUT: text = "Timeout"; break;
536 default: text = "Unknown"; break;
542 mpt_dump_sgl(SGE_IO_UNION *su)
544 SGE_SIMPLE32 *se = (SGE_SIMPLE32 *) su;
547 iCount = MPT_SGL_MAX;
552 flags = MPI_SGE_GET_FLAGS(se->FlagsLength);
553 switch (flags & MPI_SGE_FLAGS_ELEMENT_MASK) {
554 case MPI_SGE_FLAGS_SIMPLE_ELEMENT:
556 printf("SE32 %p: Addr=0x%0x FlagsLength=0x%0x\n",
557 se, se->Address, se->FlagsLength);
561 case MPI_SGE_FLAGS_CHAIN_ELEMENT:
563 SGE_CHAIN32 *ce = (SGE_CHAIN32 *) se;
564 printf("CE32 %p: Addr=0x%0x NxtChnO=0x%x Flgs=0x%x "
565 "Len=0x%0x\n", ce, ce->Address, ce->NextChainOffset,
566 ce->Flags, ce->Length);
570 case MPI_SGE_FLAGS_TRANSACTION_ELEMENT:
571 printf("TE32 @ %p\n", se);
576 #define MPT_PRINT_FLAG(x) \
577 if (flags & MPI_SGE_FLAGS_ ## x ) { \
585 MPT_PRINT_FLAG(LOCAL_ADDRESS);
586 MPT_PRINT_FLAG(HOST_TO_IOC);
587 MPT_PRINT_FLAG(64_BIT_ADDRESSING);
588 MPT_PRINT_FLAG(LAST_ELEMENT);
589 MPT_PRINT_FLAG(END_OF_BUFFER);
590 MPT_PRINT_FLAG(END_OF_LIST);
591 #undef MPT_PRINT_FLAG
596 } while ((flags & MPI_SGE_FLAGS_END_OF_LIST) == 0 && iCount != 0);
600 mpt_prt(mpt_softc_t *mpt, const char *fmt, ...)
603 printf("%s: ", device_get_nameunit(mpt->dev));