aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion
diff options
context:
space:
mode:
authorEric Moore <eric.moore@lsi.com>2007-01-29 11:44:54 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-02-02 21:53:14 -0500
commitc6c727a1a0ff90c80425b7226557b2354e00cf7b (patch)
tree832e5b9505f8a4cc7e29c4f800b8f25fb14b1527 /drivers/message/fusion
parent873c82ed165a345fa381415b9734d26e9af4ec96 (diff)
[SCSI] fusion - iocstatus, loginfo, and event debug updates
various string updates for iocstatus, logingo, and fw asyn events. Signed-off-by: Eric Moore <Eric.Moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r--drivers/message/fusion/Makefile2
-rw-r--r--drivers/message/fusion/mptbase.c552
-rw-r--r--drivers/message/fusion/mptbase.h3
-rw-r--r--drivers/message/fusion/mptscsih.c129
4 files changed, 587 insertions, 99 deletions
diff --git a/drivers/message/fusion/Makefile b/drivers/message/fusion/Makefile
index 6171783f0007..6003b46c8438 100644
--- a/drivers/message/fusion/Makefile
+++ b/drivers/message/fusion/Makefile
@@ -10,6 +10,7 @@
10#EXTRA_CFLAGS += -DMPT_DEBUG_FAIL 10#EXTRA_CFLAGS += -DMPT_DEBUG_FAIL
11#EXTRA_CFLAGS += -DMPT_DEBUG_DV 11#EXTRA_CFLAGS += -DMPT_DEBUG_DV
12#EXTRA_CFLAGS += -DMPT_DEBUG_TM 12#EXTRA_CFLAGS += -DMPT_DEBUG_TM
13#EXTRA_CFLAGS += -DMPT_DEBUG_REPLY
13 14
14# 15#
15# driver/module specifics... 16# driver/module specifics...
@@ -23,7 +24,6 @@
23# 24#
24# For mptscsih: 25# For mptscsih:
25#CFLAGS_mptscsih.o += -DMPT_DEBUG_SCSI 26#CFLAGS_mptscsih.o += -DMPT_DEBUG_SCSI
26#CFLAGS_mptscsih.o += -DMPT_DEBUG_REPLY
27# 27#
28# For mptctl: 28# For mptctl:
29#CFLAGS_mptctl.o += -DMPT_DEBUG_IOCTL 29#CFLAGS_mptctl.o += -DMPT_DEBUG_IOCTL
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index a07f0f81f96b..5d4faa4dd4ea 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -177,7 +177,9 @@ static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc);
177 177
178//int mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag); 178//int mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag);
179static int ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *evReply, int *evHandlers); 179static int ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *evReply, int *evHandlers);
180static void mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf); 180#ifdef MPT_DEBUG_REPLY
181static void mpt_iocstatus_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf);
182#endif
181static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info); 183static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info);
182static void mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info); 184static void mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info);
183static void mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info); 185static void mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info);
@@ -323,13 +325,11 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
323 else if (ioc->bus_type == SAS) 325 else if (ioc->bus_type == SAS)
324 mpt_sas_log_info(ioc, log_info); 326 mpt_sas_log_info(ioc, log_info);
325 } 327 }
326 if (ioc_stat & MPI_IOCSTATUS_MASK) {
327 if (ioc->bus_type == SPI &&
328 cb_idx != mpt_stm_index &&
329 cb_idx != mpt_lan_index)
330 mpt_sp_ioc_info(ioc, (u32)ioc_stat, mf);
331 }
332 328
329#ifdef MPT_DEBUG_REPLY
330 if (ioc_stat & MPI_IOCSTATUS_MASK)
331 mpt_iocstatus_info(ioc, (u32)ioc_stat, mf);
332#endif
333 333
334 /* Check for (valid) IO callback! */ 334 /* Check for (valid) IO callback! */
335 if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS || 335 if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS ||
@@ -5694,8 +5694,6 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
5694 return rc; 5694 return rc;
5695} 5695}
5696 5696
5697# define EVENT_DESCR_STR_SZ 100
5698
5699/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5697/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5700static void 5698static void
5701EventDescriptionStr(u8 event, u32 evData0, char *evStr) 5699EventDescriptionStr(u8 event, u32 evData0, char *evStr)
@@ -5723,9 +5721,6 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5723 break; 5721 break;
5724 case MPI_EVENT_RESCAN: 5722 case MPI_EVENT_RESCAN:
5725 ds = "Bus Rescan Event"; 5723 ds = "Bus Rescan Event";
5726 /* Ok, do we need to do anything here? As far as
5727 I can tell, this is when a new device gets added
5728 to the loop. */
5729 break; 5724 break;
5730 case MPI_EVENT_LINK_STATUS_CHANGE: 5725 case MPI_EVENT_LINK_STATUS_CHANGE:
5731 if (evData0 == MPI_EVENT_LINK_STATUS_FAILURE) 5726 if (evData0 == MPI_EVENT_LINK_STATUS_FAILURE)
@@ -5802,48 +5797,63 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5802 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: 5797 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE:
5803 { 5798 {
5804 u8 id = (u8)(evData0); 5799 u8 id = (u8)(evData0);
5800 u8 channel = (u8)(evData0 >> 8);
5805 u8 ReasonCode = (u8)(evData0 >> 16); 5801 u8 ReasonCode = (u8)(evData0 >> 16);
5806 switch (ReasonCode) { 5802 switch (ReasonCode) {
5807 case MPI_EVENT_SAS_DEV_STAT_RC_ADDED: 5803 case MPI_EVENT_SAS_DEV_STAT_RC_ADDED:
5808 snprintf(evStr, EVENT_DESCR_STR_SZ, 5804 snprintf(evStr, EVENT_DESCR_STR_SZ,
5809 "SAS Device Status Change: Added: id=%d", id); 5805 "SAS Device Status Change: Added: "
5806 "id=%d channel=%d", id, channel);
5810 break; 5807 break;
5811 case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING: 5808 case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING:
5812 snprintf(evStr, EVENT_DESCR_STR_SZ, 5809 snprintf(evStr, EVENT_DESCR_STR_SZ,
5813 "SAS Device Status Change: Deleted: id=%d", id); 5810 "SAS Device Status Change: Deleted: "
5811 "id=%d channel=%d", id, channel);
5814 break; 5812 break;
5815 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA: 5813 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA:
5816 snprintf(evStr, EVENT_DESCR_STR_SZ, 5814 snprintf(evStr, EVENT_DESCR_STR_SZ,
5817 "SAS Device Status Change: SMART Data: id=%d", 5815 "SAS Device Status Change: SMART Data: "
5818 id); 5816 "id=%d channel=%d", id, channel);
5819 break; 5817 break;
5820 case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED: 5818 case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED:
5821 snprintf(evStr, EVENT_DESCR_STR_SZ, 5819 snprintf(evStr, EVENT_DESCR_STR_SZ,
5822 "SAS Device Status Change: No Persistancy: id=%d", id); 5820 "SAS Device Status Change: No Persistancy: "
5821 "id=%d channel=%d", id, channel);
5822 break;
5823 case MPI_EVENT_SAS_DEV_STAT_RC_UNSUPPORTED:
5824 snprintf(evStr, EVENT_DESCR_STR_SZ,
5825 "SAS Device Status Change: Unsupported Device "
5826 "Discovered : id=%d channel=%d", id, channel);
5823 break; 5827 break;
5824 case MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET: 5828 case MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET:
5825 snprintf(evStr, EVENT_DESCR_STR_SZ, 5829 snprintf(evStr, EVENT_DESCR_STR_SZ,
5826 "SAS Device Status Change: Internal Device Reset : id=%d", id); 5830 "SAS Device Status Change: Internal Device "
5831 "Reset : id=%d channel=%d", id, channel);
5827 break; 5832 break;
5828 case MPI_EVENT_SAS_DEV_STAT_RC_TASK_ABORT_INTERNAL: 5833 case MPI_EVENT_SAS_DEV_STAT_RC_TASK_ABORT_INTERNAL:
5829 snprintf(evStr, EVENT_DESCR_STR_SZ, 5834 snprintf(evStr, EVENT_DESCR_STR_SZ,
5830 "SAS Device Status Change: Internal Task Abort : id=%d", id); 5835 "SAS Device Status Change: Internal Task "
5836 "Abort : id=%d channel=%d", id, channel);
5831 break; 5837 break;
5832 case MPI_EVENT_SAS_DEV_STAT_RC_ABORT_TASK_SET_INTERNAL: 5838 case MPI_EVENT_SAS_DEV_STAT_RC_ABORT_TASK_SET_INTERNAL:
5833 snprintf(evStr, EVENT_DESCR_STR_SZ, 5839 snprintf(evStr, EVENT_DESCR_STR_SZ,
5834 "SAS Device Status Change: Internal Abort Task Set : id=%d", id); 5840 "SAS Device Status Change: Internal Abort "
5841 "Task Set : id=%d channel=%d", id, channel);
5835 break; 5842 break;
5836 case MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL: 5843 case MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL:
5837 snprintf(evStr, EVENT_DESCR_STR_SZ, 5844 snprintf(evStr, EVENT_DESCR_STR_SZ,
5838 "SAS Device Status Change: Internal Clear Task Set : id=%d", id); 5845 "SAS Device Status Change: Internal Clear "
5846 "Task Set : id=%d channel=%d", id, channel);
5839 break; 5847 break;
5840 case MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL: 5848 case MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL:
5841 snprintf(evStr, EVENT_DESCR_STR_SZ, 5849 snprintf(evStr, EVENT_DESCR_STR_SZ,
5842 "SAS Device Status Change: Internal Query Task : id=%d", id); 5850 "SAS Device Status Change: Internal Query "
5851 "Task : id=%d channel=%d", id, channel);
5843 break; 5852 break;
5844 default: 5853 default:
5845 snprintf(evStr, EVENT_DESCR_STR_SZ, 5854 snprintf(evStr, EVENT_DESCR_STR_SZ,
5846 "SAS Device Status Change: Unknown: id=%d", id); 5855 "SAS Device Status Change: Unknown: "
5856 "id=%d channel=%d", id, channel);
5847 break; 5857 break;
5848 } 5858 }
5849 break; 5859 break;
@@ -5852,8 +5862,16 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5852 ds = "Bus Timer Expired"; 5862 ds = "Bus Timer Expired";
5853 break; 5863 break;
5854 case MPI_EVENT_QUEUE_FULL: 5864 case MPI_EVENT_QUEUE_FULL:
5855 ds = "Queue Full"; 5865 {
5866 u16 curr_depth = (u16)(evData0 >> 16);
5867 u8 channel = (u8)(evData0 >> 8);
5868 u8 id = (u8)(evData0);
5869
5870 snprintf(evStr, EVENT_DESCR_STR_SZ,
5871 "Queue Full: channel=%d id=%d depth=%d",
5872 channel, id, curr_depth);
5856 break; 5873 break;
5874 }
5857 case MPI_EVENT_SAS_SES: 5875 case MPI_EVENT_SAS_SES:
5858 ds = "SAS SES Event"; 5876 ds = "SAS SES Event";
5859 break; 5877 break;
@@ -5957,6 +5975,76 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5957 ds = "SAS Log Entry Added"; 5975 ds = "SAS Log Entry Added";
5958 break; 5976 break;
5959 5977
5978 case MPI_EVENT_SAS_BROADCAST_PRIMITIVE:
5979 {
5980 u8 phy_num = (u8)(evData0);
5981 u8 port_num = (u8)(evData0 >> 8);
5982 u8 port_width = (u8)(evData0 >> 16);
5983 u8 primative = (u8)(evData0 >> 24);
5984 snprintf(evStr, EVENT_DESCR_STR_SZ,
5985 "SAS Broadcase Primative: phy=%d port=%d "
5986 "width=%d primative=0x%02x",
5987 phy_num, port_num, port_width, primative);
5988 break;
5989 }
5990
5991 case MPI_EVENT_SAS_INIT_DEVICE_STATUS_CHANGE:
5992 {
5993 u8 reason = (u8)(evData0);
5994 u8 port_num = (u8)(evData0 >> 8);
5995 u16 handle = le16_to_cpu(evData0 >> 16);
5996
5997 snprintf(evStr, EVENT_DESCR_STR_SZ,
5998 "SAS Initiator Device Status Change: reason=0x%02x "
5999 "port=%d handle=0x%04x",
6000 reason, port_num, handle);
6001 break;
6002 }
6003
6004 case MPI_EVENT_SAS_INIT_TABLE_OVERFLOW:
6005 {
6006 u8 max_init = (u8)(evData0);
6007 u8 current_init = (u8)(evData0 >> 8);
6008
6009 snprintf(evStr, EVENT_DESCR_STR_SZ,
6010 "SAS Initiator Device Table Overflow: max initiators=%02d "
6011 "current initators=%02d",
6012 max_init, current_init);
6013 break;
6014 }
6015 case MPI_EVENT_SAS_SMP_ERROR:
6016 {
6017 u8 status = (u8)(evData0);
6018 u8 port_num = (u8)(evData0 >> 8);
6019 u8 result = (u8)(evData0 >> 16);
6020
6021 if (status == MPI_EVENT_SAS_SMP_FUNCTION_RESULT_VALID)
6022 snprintf(evStr, EVENT_DESCR_STR_SZ,
6023 "SAS SMP Error: port=%d result=0x%02x",
6024 port_num, result);
6025 else if (status == MPI_EVENT_SAS_SMP_CRC_ERROR)
6026 snprintf(evStr, EVENT_DESCR_STR_SZ,
6027 "SAS SMP Error: port=%d : CRC Error",
6028 port_num);
6029 else if (status == MPI_EVENT_SAS_SMP_TIMEOUT)
6030 snprintf(evStr, EVENT_DESCR_STR_SZ,
6031 "SAS SMP Error: port=%d : Timeout",
6032 port_num);
6033 else if (status == MPI_EVENT_SAS_SMP_NO_DESTINATION)
6034 snprintf(evStr, EVENT_DESCR_STR_SZ,
6035 "SAS SMP Error: port=%d : No Destination",
6036 port_num);
6037 else if (status == MPI_EVENT_SAS_SMP_BAD_DESTINATION)
6038 snprintf(evStr, EVENT_DESCR_STR_SZ,
6039 "SAS SMP Error: port=%d : Bad Destination",
6040 port_num);
6041 else
6042 snprintf(evStr, EVENT_DESCR_STR_SZ,
6043 "SAS SMP Error: port=%d : status=0x%02x",
6044 port_num, status);
6045 break;
6046 }
6047
5960 /* 6048 /*
5961 * MPT base "custom" events may be added here... 6049 * MPT base "custom" events may be added here...
5962 */ 6050 */
@@ -6220,10 +6308,11 @@ mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info)
6220 "Abort", /* 12h */ 6308 "Abort", /* 12h */
6221 "IO Not Yet Executed", /* 13h */ 6309 "IO Not Yet Executed", /* 13h */
6222 "IO Executed", /* 14h */ 6310 "IO Executed", /* 14h */
6223 "Persistent Reservation Out Not Affiliation Owner", /* 15h */ 6311 "Persistent Reservation Out Not Affiliation "
6312 "Owner", /* 15h */
6224 "Open Transmit DMA Abort", /* 16h */ 6313 "Open Transmit DMA Abort", /* 16h */
6225 "IO Device Missing Delay Retry", /* 17h */ 6314 "IO Device Missing Delay Retry", /* 17h */
6226 NULL, /* 18h */ 6315 "IO Cancelled Due to Recieve Error", /* 18h */
6227 NULL, /* 19h */ 6316 NULL, /* 19h */
6228 NULL, /* 1Ah */ 6317 NULL, /* 1Ah */
6229 NULL, /* 1Bh */ 6318 NULL, /* 1Bh */
@@ -6233,6 +6322,96 @@ mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info)
6233 NULL, /* 1Fh */ 6322 NULL, /* 1Fh */
6234 "Enclosure Management" /* 20h */ 6323 "Enclosure Management" /* 20h */
6235 }; 6324 };
6325 static char *ir_code_str[] = {
6326 "Raid Action Error", /* 00h */
6327 NULL, /* 00h */
6328 NULL, /* 01h */
6329 NULL, /* 02h */
6330 NULL, /* 03h */
6331 NULL, /* 04h */
6332 NULL, /* 05h */
6333 NULL, /* 06h */
6334 NULL /* 07h */
6335 };
6336 static char *raid_sub_code_str[] = {
6337 NULL, /* 00h */
6338 "Volume Creation Failed: Data Passed too "
6339 "Large", /* 01h */
6340 "Volume Creation Failed: Duplicate Volumes "
6341 "Attempted", /* 02h */
6342 "Volume Creation Failed: Max Number "
6343 "Supported Volumes Exceeded", /* 03h */
6344 "Volume Creation Failed: DMA Error", /* 04h */
6345 "Volume Creation Failed: Invalid Volume Type", /* 05h */
6346 "Volume Creation Failed: Error Reading "
6347 "MFG Page 4", /* 06h */
6348 "Volume Creation Failed: Creating Internal "
6349 "Structures", /* 07h */
6350 NULL, /* 08h */
6351 NULL, /* 09h */
6352 NULL, /* 0Ah */
6353 NULL, /* 0Bh */
6354 NULL, /* 0Ch */
6355 NULL, /* 0Dh */
6356 NULL, /* 0Eh */
6357 NULL, /* 0Fh */
6358 "Activation failed: Already Active Volume", /* 10h */
6359 "Activation failed: Unsupported Volume Type", /* 11h */
6360 "Activation failed: Too Many Active Volumes", /* 12h */
6361 "Activation failed: Volume ID in Use", /* 13h */
6362 "Activation failed: Reported Failure", /* 14h */
6363 "Activation failed: Importing a Volume", /* 15h */
6364 NULL, /* 16h */
6365 NULL, /* 17h */
6366 NULL, /* 18h */
6367 NULL, /* 19h */
6368 NULL, /* 1Ah */
6369 NULL, /* 1Bh */
6370 NULL, /* 1Ch */
6371 NULL, /* 1Dh */
6372 NULL, /* 1Eh */
6373 NULL, /* 1Fh */
6374 "Phys Disk failed: Too Many Phys Disks", /* 20h */
6375 "Phys Disk failed: Data Passed too Large", /* 21h */
6376 "Phys Disk failed: DMA Error", /* 22h */
6377 "Phys Disk failed: Invalid <channel:id>", /* 23h */
6378 "Phys Disk failed: Creating Phys Disk Config "
6379 "Page", /* 24h */
6380 NULL, /* 25h */
6381 NULL, /* 26h */
6382 NULL, /* 27h */
6383 NULL, /* 28h */
6384 NULL, /* 29h */
6385 NULL, /* 2Ah */
6386 NULL, /* 2Bh */
6387 NULL, /* 2Ch */
6388 NULL, /* 2Dh */
6389 NULL, /* 2Eh */
6390 NULL, /* 2Fh */
6391 "Compatibility Error: IR Disabled", /* 30h */
6392 "Compatibility Error: Inquiry Comand Failed", /* 31h */
6393 "Compatibility Error: Device not Direct Access "
6394 "Device ", /* 32h */
6395 "Compatibility Error: Removable Device Found", /* 33h */
6396 "Compatibility Error: Device SCSI Version not "
6397 "2 or Higher", /* 34h */
6398 "Compatibility Error: SATA Device, 48 BIT LBA "
6399 "not Supported", /* 35h */
6400 "Compatibility Error: Device doesn't have "
6401 "512 Byte Block Sizes", /* 36h */
6402 "Compatibility Error: Volume Type Check Failed", /* 37h */
6403 "Compatibility Error: Volume Type is "
6404 "Unsupported by FW", /* 38h */
6405 "Compatibility Error: Disk Drive too Small for "
6406 "use in Volume", /* 39h */
6407 "Compatibility Error: Phys Disk for Create "
6408 "Volume not Found", /* 3Ah */
6409 "Compatibility Error: Too Many or too Few "
6410 "Disks for Volume Type", /* 3Bh */
6411 "Compatibility Error: Disk stripe Sizes "
6412 "Must be 64KB", /* 3Ch */
6413 "Compatibility Error: IME Size Limited to < 2TB", /* 3Dh */
6414 };
6236 6415
6237/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6416/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6238/** 6417/**
@@ -6241,7 +6420,7 @@ mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info)
6241 * @log_info: U32 LogInfo reply word from the IOC 6420 * @log_info: U32 LogInfo reply word from the IOC
6242 * 6421 *
6243 * Refer to lsi/mpi_log_sas.h. 6422 * Refer to lsi/mpi_log_sas.h.
6244 */ 6423 **/
6245static void 6424static void
6246mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info) 6425mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info)
6247{ 6426{
@@ -6255,56 +6434,165 @@ union loginfo_type {
6255 }dw; 6434 }dw;
6256}; 6435};
6257 union loginfo_type sas_loginfo; 6436 union loginfo_type sas_loginfo;
6437 char *originator_desc = NULL;
6258 char *code_desc = NULL; 6438 char *code_desc = NULL;
6439 char *sub_code_desc = NULL;
6259 6440
6260 sas_loginfo.loginfo = log_info; 6441 sas_loginfo.loginfo = log_info;
6261 if ((sas_loginfo.dw.bus_type != 3 /*SAS*/) && 6442 if ((sas_loginfo.dw.bus_type != 3 /*SAS*/) &&
6262 (sas_loginfo.dw.originator < sizeof(originator_str)/sizeof(char*))) 6443 (sas_loginfo.dw.originator < sizeof(originator_str)/sizeof(char*)))
6263 return; 6444 return;
6264 if ((sas_loginfo.dw.originator == 0 /*IOP*/) && 6445
6265 (sas_loginfo.dw.code < sizeof(iop_code_str)/sizeof(char*))) { 6446 originator_desc = originator_str[sas_loginfo.dw.originator];
6266 code_desc = iop_code_str[sas_loginfo.dw.code]; 6447
6267 }else if ((sas_loginfo.dw.originator == 1 /*PL*/) && 6448 switch (sas_loginfo.dw.originator) {
6268 (sas_loginfo.dw.code < sizeof(pl_code_str)/sizeof(char*) )) { 6449
6269 code_desc = pl_code_str[sas_loginfo.dw.code]; 6450 case 0: /* IOP */
6451 if (sas_loginfo.dw.code <
6452 sizeof(iop_code_str)/sizeof(char*))
6453 code_desc = iop_code_str[sas_loginfo.dw.code];
6454 break;
6455 case 1: /* PL */
6456 if (sas_loginfo.dw.code <
6457 sizeof(pl_code_str)/sizeof(char*))
6458 code_desc = pl_code_str[sas_loginfo.dw.code];
6459 break;
6460 case 2: /* IR */
6461 if (sas_loginfo.dw.code >=
6462 sizeof(ir_code_str)/sizeof(char*))
6463 break;
6464 code_desc = ir_code_str[sas_loginfo.dw.code];
6465 if (sas_loginfo.dw.subcode >=
6466 sizeof(raid_sub_code_str)/sizeof(char*))
6467 break;
6468 if (sas_loginfo.dw.code == 0)
6469 sub_code_desc =
6470 raid_sub_code_str[sas_loginfo.dw.subcode];
6471 break;
6472 default:
6473 return;
6270 } 6474 }
6271 6475
6272 if (code_desc != NULL) 6476 if (sub_code_desc != NULL)
6477 printk(MYIOC_s_INFO_FMT
6478 "LogInfo(0x%08x): Originator={%s}, Code={%s},"
6479 " SubCode={%s}\n",
6480 ioc->name, log_info, originator_desc, code_desc,
6481 sub_code_desc);
6482 else if (code_desc != NULL)
6273 printk(MYIOC_s_INFO_FMT 6483 printk(MYIOC_s_INFO_FMT
6274 "LogInfo(0x%08x): Originator={%s}, Code={%s}," 6484 "LogInfo(0x%08x): Originator={%s}, Code={%s},"
6275 " SubCode(0x%04x)\n", 6485 " SubCode(0x%04x)\n",
6276 ioc->name, 6486 ioc->name, log_info, originator_desc, code_desc,
6277 log_info,
6278 originator_str[sas_loginfo.dw.originator],
6279 code_desc,
6280 sas_loginfo.dw.subcode); 6487 sas_loginfo.dw.subcode);
6281 else 6488 else
6282 printk(MYIOC_s_INFO_FMT 6489 printk(MYIOC_s_INFO_FMT
6283 "LogInfo(0x%08x): Originator={%s}, Code=(0x%02x)," 6490 "LogInfo(0x%08x): Originator={%s}, Code=(0x%02x),"
6284 " SubCode(0x%04x)\n", 6491 " SubCode(0x%04x)\n",
6285 ioc->name, 6492 ioc->name, log_info, originator_desc,
6286 log_info, 6493 sas_loginfo.dw.code, sas_loginfo.dw.subcode);
6287 originator_str[sas_loginfo.dw.originator],
6288 sas_loginfo.dw.code,
6289 sas_loginfo.dw.subcode);
6290} 6494}
6291 6495
6496#ifdef MPT_DEBUG_REPLY
6292/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6497/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6293/** 6498/**
6294 * mpt_sp_ioc_info - IOC information returned from SCSI Parallel IOC. 6499 * mpt_iocstatus_info_config - IOCSTATUS information for config pages
6500 * @ioc: Pointer to MPT_ADAPTER structure
6501 * ioc_status: U32 IOCStatus word from IOC
6502 * @mf: Pointer to MPT request frame
6503 *
6504 * Refer to lsi/mpi.h.
6505 **/
6506static void
6507mpt_iocstatus_info_config(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf)
6508{
6509 Config_t *pReq = (Config_t *)mf;
6510 char extend_desc[EVENT_DESCR_STR_SZ];
6511 char *desc = NULL;
6512 u32 form;
6513 u8 page_type;
6514
6515 if (pReq->Header.PageType == MPI_CONFIG_PAGETYPE_EXTENDED)
6516 page_type = pReq->ExtPageType;
6517 else
6518 page_type = pReq->Header.PageType;
6519
6520 /*
6521 * ignore invalid page messages for GET_NEXT_HANDLE
6522 */
6523 form = le32_to_cpu(pReq->PageAddress);
6524 if (ioc_status == MPI_IOCSTATUS_CONFIG_INVALID_PAGE) {
6525 if (page_type == MPI_CONFIG_EXTPAGETYPE_SAS_DEVICE ||
6526 page_type == MPI_CONFIG_EXTPAGETYPE_SAS_EXPANDER ||
6527 page_type == MPI_CONFIG_EXTPAGETYPE_ENCLOSURE) {
6528 if ((form >> MPI_SAS_DEVICE_PGAD_FORM_SHIFT) ==
6529 MPI_SAS_DEVICE_PGAD_FORM_GET_NEXT_HANDLE)
6530 return;
6531 }
6532 if (page_type == MPI_CONFIG_PAGETYPE_FC_DEVICE)
6533 if ((form & MPI_FC_DEVICE_PGAD_FORM_MASK) ==
6534 MPI_FC_DEVICE_PGAD_FORM_NEXT_DID)
6535 return;
6536 }
6537
6538 snprintf(extend_desc, EVENT_DESCR_STR_SZ,
6539 "type=%02Xh, page=%02Xh, action=%02Xh, form=%08Xh",
6540 page_type, pReq->Header.PageNumber, pReq->Action, form);
6541
6542 switch (ioc_status) {
6543
6544 case MPI_IOCSTATUS_CONFIG_INVALID_ACTION: /* 0x0020 */
6545 desc = "Config Page Invalid Action";
6546 break;
6547
6548 case MPI_IOCSTATUS_CONFIG_INVALID_TYPE: /* 0x0021 */
6549 desc = "Config Page Invalid Type";
6550 break;
6551
6552 case MPI_IOCSTATUS_CONFIG_INVALID_PAGE: /* 0x0022 */
6553 desc = "Config Page Invalid Page";
6554 break;
6555
6556 case MPI_IOCSTATUS_CONFIG_INVALID_DATA: /* 0x0023 */
6557 desc = "Config Page Invalid Data";
6558 break;
6559
6560 case MPI_IOCSTATUS_CONFIG_NO_DEFAULTS: /* 0x0024 */
6561 desc = "Config Page No Defaults";
6562 break;
6563
6564 case MPI_IOCSTATUS_CONFIG_CANT_COMMIT: /* 0x0025 */
6565 desc = "Config Page Can't Commit";
6566 break;
6567 }
6568
6569 if (!desc)
6570 return;
6571
6572 printk(MYIOC_s_INFO_FMT "IOCStatus(0x%04X): %s: %s\n",
6573 ioc->name, ioc_status, desc, extend_desc);
6574}
6575
6576/**
6577 * mpt_iocstatus_info - IOCSTATUS information returned from IOC.
6295 * @ioc: Pointer to MPT_ADAPTER structure 6578 * @ioc: Pointer to MPT_ADAPTER structure
6296 * @ioc_status: U32 IOCStatus word from IOC 6579 * @ioc_status: U32 IOCStatus word from IOC
6297 * @mf: Pointer to MPT request frame 6580 * @mf: Pointer to MPT request frame
6298 * 6581 *
6299 * Refer to lsi/mpi.h. 6582 * Refer to lsi/mpi.h.
6300 */ 6583 **/
6301static void 6584static void
6302mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf) 6585mpt_iocstatus_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf)
6303{ 6586{
6304 u32 status = ioc_status & MPI_IOCSTATUS_MASK; 6587 u32 status = ioc_status & MPI_IOCSTATUS_MASK;
6305 char *desc = NULL; 6588 char *desc = NULL;
6306 6589
6307 switch (status) { 6590 switch (status) {
6591
6592/****************************************************************************/
6593/* Common IOCStatus values for all replies */
6594/****************************************************************************/
6595
6308 case MPI_IOCSTATUS_INVALID_FUNCTION: /* 0x0001 */ 6596 case MPI_IOCSTATUS_INVALID_FUNCTION: /* 0x0001 */
6309 desc = "Invalid Function"; 6597 desc = "Invalid Function";
6310 break; 6598 break;
@@ -6337,84 +6625,180 @@ mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf)
6337 desc = "Invalid State"; 6625 desc = "Invalid State";
6338 break; 6626 break;
6339 6627
6628/****************************************************************************/
6629/* Config IOCStatus values */
6630/****************************************************************************/
6631
6340 case MPI_IOCSTATUS_CONFIG_INVALID_ACTION: /* 0x0020 */ 6632 case MPI_IOCSTATUS_CONFIG_INVALID_ACTION: /* 0x0020 */
6341 case MPI_IOCSTATUS_CONFIG_INVALID_TYPE: /* 0x0021 */ 6633 case MPI_IOCSTATUS_CONFIG_INVALID_TYPE: /* 0x0021 */
6342 case MPI_IOCSTATUS_CONFIG_INVALID_PAGE: /* 0x0022 */ 6634 case MPI_IOCSTATUS_CONFIG_INVALID_PAGE: /* 0x0022 */
6343 case MPI_IOCSTATUS_CONFIG_INVALID_DATA: /* 0x0023 */ 6635 case MPI_IOCSTATUS_CONFIG_INVALID_DATA: /* 0x0023 */
6344 case MPI_IOCSTATUS_CONFIG_NO_DEFAULTS: /* 0x0024 */ 6636 case MPI_IOCSTATUS_CONFIG_NO_DEFAULTS: /* 0x0024 */
6345 case MPI_IOCSTATUS_CONFIG_CANT_COMMIT: /* 0x0025 */ 6637 case MPI_IOCSTATUS_CONFIG_CANT_COMMIT: /* 0x0025 */
6346 /* No message for Config IOCStatus values */ 6638 mpt_iocstatus_info_config(ioc, status, mf);
6347 break; 6639 break;
6348 6640
6641/****************************************************************************/
6642/* SCSIIO Reply (SPI, FCP, SAS) initiator values */
6643/* */
6644/* Look at mptscsih_iocstatus_info_scsiio in mptscsih.c */
6645/* */
6646/****************************************************************************/
6647
6349 case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */ 6648 case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */
6350 /* No message for recovered error 6649 case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN: /* 0x0045 */
6351 desc = "SCSI Recovered Error"; 6650 case MPI_IOCSTATUS_SCSI_INVALID_BUS: /* 0x0041 */
6352 */ 6651 case MPI_IOCSTATUS_SCSI_INVALID_TARGETID: /* 0x0042 */
6652 case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */
6653 case MPI_IOCSTATUS_SCSI_DATA_OVERRUN: /* 0x0044 */
6654 case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR: /* 0x0046 */
6655 case MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR: /* 0x0047 */
6656 case MPI_IOCSTATUS_SCSI_TASK_TERMINATED: /* 0x0048 */
6657 case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */
6658 case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED: /* 0x004A */
6659 case MPI_IOCSTATUS_SCSI_IOC_TERMINATED: /* 0x004B */
6660 case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */
6353 break; 6661 break;
6354 6662
6355 case MPI_IOCSTATUS_SCSI_INVALID_BUS: /* 0x0041 */ 6663/****************************************************************************/
6356 desc = "SCSI Invalid Bus"; 6664/* SCSI Target values */
6665/****************************************************************************/
6666
6667 case MPI_IOCSTATUS_TARGET_PRIORITY_IO: /* 0x0060 */
6668 desc = "Target: Priority IO";
6357 break; 6669 break;
6358 6670
6359 case MPI_IOCSTATUS_SCSI_INVALID_TARGETID: /* 0x0042 */ 6671 case MPI_IOCSTATUS_TARGET_INVALID_PORT: /* 0x0061 */
6360 desc = "SCSI Invalid TargetID"; 6672 desc = "Target: Invalid Port";
6361 break; 6673 break;
6362 6674
6363 case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */ 6675 case MPI_IOCSTATUS_TARGET_INVALID_IO_INDEX: /* 0x0062 */
6364 { 6676 desc = "Target Invalid IO Index:";
6365 SCSIIORequest_t *pScsiReq = (SCSIIORequest_t *) mf;
6366 U8 cdb = pScsiReq->CDB[0];
6367 if (cdb != 0x12) { /* Inquiry is issued for device scanning */
6368 desc = "SCSI Device Not There";
6369 }
6370 break; 6677 break;
6371 }
6372 6678
6373 case MPI_IOCSTATUS_SCSI_DATA_OVERRUN: /* 0x0044 */ 6679 case MPI_IOCSTATUS_TARGET_ABORTED: /* 0x0063 */
6374 desc = "SCSI Data Overrun"; 6680 desc = "Target: Aborted";
6375 break; 6681 break;
6376 6682
6377 case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN: /* 0x0045 */ 6683 case MPI_IOCSTATUS_TARGET_NO_CONN_RETRYABLE: /* 0x0064 */
6378 /* This error is checked in scsi_io_done(). Skip. 6684 desc = "Target: No Conn Retryable";
6379 desc = "SCSI Data Underrun";
6380 */
6381 break; 6685 break;
6382 6686
6383 case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR: /* 0x0046 */ 6687 case MPI_IOCSTATUS_TARGET_NO_CONNECTION: /* 0x0065 */
6384 desc = "SCSI I/O Data Error"; 6688 desc = "Target: No Connection";
6385 break; 6689 break;
6386 6690
6387 case MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR: /* 0x0047 */ 6691 case MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH: /* 0x006A */
6388 desc = "SCSI Protocol Error"; 6692 desc = "Target: Transfer Count Mismatch";
6389 break; 6693 break;
6390 6694
6391 case MPI_IOCSTATUS_SCSI_TASK_TERMINATED: /* 0x0048 */ 6695 case MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT: /* 0x006B */
6392 desc = "SCSI Task Terminated"; 6696 desc = "Target: STS Data not Sent";
6393 break; 6697 break;
6394 6698
6395 case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */ 6699 case MPI_IOCSTATUS_TARGET_DATA_OFFSET_ERROR: /* 0x006D */
6396 desc = "SCSI Residual Mismatch"; 6700 desc = "Target: Data Offset Error";
6397 break; 6701 break;
6398 6702
6399 case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED: /* 0x004A */ 6703 case MPI_IOCSTATUS_TARGET_TOO_MUCH_WRITE_DATA: /* 0x006E */
6400 desc = "SCSI Task Management Failed"; 6704 desc = "Target: Too Much Write Data";
6401 break; 6705 break;
6402 6706
6403 case MPI_IOCSTATUS_SCSI_IOC_TERMINATED: /* 0x004B */ 6707 case MPI_IOCSTATUS_TARGET_IU_TOO_SHORT: /* 0x006F */
6404 desc = "SCSI IOC Terminated"; 6708 desc = "Target: IU Too Short";
6405 break; 6709 break;
6406 6710
6407 case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */ 6711 case MPI_IOCSTATUS_TARGET_ACK_NAK_TIMEOUT: /* 0x0070 */
6408 desc = "SCSI Ext Terminated"; 6712 desc = "Target: ACK NAK Timeout";
6713 break;
6714
6715 case MPI_IOCSTATUS_TARGET_NAK_RECEIVED: /* 0x0071 */
6716 desc = "Target: Nak Received";
6717 break;
6718
6719/****************************************************************************/
6720/* Fibre Channel Direct Access values */
6721/****************************************************************************/
6722
6723 case MPI_IOCSTATUS_FC_ABORTED: /* 0x0066 */
6724 desc = "FC: Aborted";
6725 break;
6726
6727 case MPI_IOCSTATUS_FC_RX_ID_INVALID: /* 0x0067 */
6728 desc = "FC: RX ID Invalid";
6729 break;
6730
6731 case MPI_IOCSTATUS_FC_DID_INVALID: /* 0x0068 */
6732 desc = "FC: DID Invalid";
6733 break;
6734
6735 case MPI_IOCSTATUS_FC_NODE_LOGGED_OUT: /* 0x0069 */
6736 desc = "FC: Node Logged Out";
6737 break;
6738
6739 case MPI_IOCSTATUS_FC_EXCHANGE_CANCELED: /* 0x006C */
6740 desc = "FC: Exchange Canceled";
6741 break;
6742
6743/****************************************************************************/
6744/* LAN values */
6745/****************************************************************************/
6746
6747 case MPI_IOCSTATUS_LAN_DEVICE_NOT_FOUND: /* 0x0080 */
6748 desc = "LAN: Device not Found";
6749 break;
6750
6751 case MPI_IOCSTATUS_LAN_DEVICE_FAILURE: /* 0x0081 */
6752 desc = "LAN: Device Failure";
6753 break;
6754
6755 case MPI_IOCSTATUS_LAN_TRANSMIT_ERROR: /* 0x0082 */
6756 desc = "LAN: Transmit Error";
6757 break;
6758
6759 case MPI_IOCSTATUS_LAN_TRANSMIT_ABORTED: /* 0x0083 */
6760 desc = "LAN: Transmit Aborted";
6761 break;
6762
6763 case MPI_IOCSTATUS_LAN_RECEIVE_ERROR: /* 0x0084 */
6764 desc = "LAN: Receive Error";
6765 break;
6766
6767 case MPI_IOCSTATUS_LAN_RECEIVE_ABORTED: /* 0x0085 */
6768 desc = "LAN: Receive Aborted";
6769 break;
6770
6771 case MPI_IOCSTATUS_LAN_PARTIAL_PACKET: /* 0x0086 */
6772 desc = "LAN: Partial Packet";
6773 break;
6774
6775 case MPI_IOCSTATUS_LAN_CANCELED: /* 0x0087 */
6776 desc = "LAN: Canceled";
6777 break;
6778
6779/****************************************************************************/
6780/* Serial Attached SCSI values */
6781/****************************************************************************/
6782
6783 case MPI_IOCSTATUS_SAS_SMP_REQUEST_FAILED: /* 0x0090 */
6784 desc = "SAS: SMP Request Failed";
6785 break;
6786
6787 case MPI_IOCSTATUS_SAS_SMP_DATA_OVERRUN: /* 0x0090 */
6788 desc = "SAS: SMP Data Overrun";
6409 break; 6789 break;
6410 6790
6411 default: 6791 default:
6412 desc = "Others"; 6792 desc = "Others";
6413 break; 6793 break;
6414 } 6794 }
6415 if (desc != NULL) 6795
6416 printk(MYIOC_s_INFO_FMT "IOCStatus(0x%04x): %s\n", ioc->name, status, desc); 6796 if (!desc)
6797 return;
6798
6799 printk(MYIOC_s_INFO_FMT "IOCStatus(0x%04X): %s\n", ioc->name, status, desc);
6417} 6800}
6801#endif
6418 6802
6419/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6803/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6420EXPORT_SYMBOL(mpt_attach); 6804EXPORT_SYMBOL(mpt_attach);
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index a0ce2f4e33f9..3d613c4f93d9 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -172,6 +172,9 @@
172#define MPT_SCSI_SG_DEPTH 40 172#define MPT_SCSI_SG_DEPTH 40
173#endif 173#endif
174 174
175/* debug print string length used for events and iocstatus */
176# define EVENT_DESCR_STR_SZ 100
177
175#ifdef __KERNEL__ /* { */ 178#ifdef __KERNEL__ /* { */
176/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 179/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
177 180
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index d5877316cbea..507aa08611d5 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -487,6 +487,90 @@ mptscsih_issue_sep_command(MPT_ADAPTER *ioc, VirtTarget *vtarget,
487 mpt_put_msg_frame(ioc->DoneCtx, ioc, mf); 487 mpt_put_msg_frame(ioc->DoneCtx, ioc, mf);
488} 488}
489 489
490#ifdef MPT_DEBUG_REPLY
491/**
492 * mptscsih_iocstatus_info_scsiio - IOCSTATUS information for SCSIIO
493 * @ioc: Pointer to MPT_ADAPTER structure
494 * @ioc_status: U32 IOCStatus word from IOC
495 * @scsi_status: U8 sam status from target
496 * @scsi_state: U8 scsi state
497 * @sc: original scsi cmnd pointer
498 * @mf: Pointer to MPT request frame
499 *
500 * Refer to lsi/mpi.h.
501 **/
502static void
503mptscsih_iocstatus_info_scsiio(MPT_ADAPTER *ioc, u32 ioc_status,
504 u8 scsi_status, u8 scsi_state, struct scsi_cmnd *sc)
505{
506 char extend_desc[EVENT_DESCR_STR_SZ];
507 char *desc = NULL;
508
509 switch (ioc_status) {
510
511 case MPI_IOCSTATUS_SCSI_INVALID_BUS: /* 0x0041 */
512 desc = "SCSI Invalid Bus";
513 break;
514
515 case MPI_IOCSTATUS_SCSI_INVALID_TARGETID: /* 0x0042 */
516 desc = "SCSI Invalid TargetID";
517 break;
518
519 case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */
520 /*
521 * Inquiry is issued for device scanning
522 */
523 if (sc->cmnd[0] != 0x12)
524 desc = "SCSI Device Not There";
525 break;
526
527 case MPI_IOCSTATUS_SCSI_DATA_OVERRUN: /* 0x0044 */
528 desc = "SCSI Data Overrun";
529 break;
530
531 case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR: /* 0x0046 */
532 desc = "SCSI I/O Data Error";
533 break;
534
535 case MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR: /* 0x0047 */
536 desc = "SCSI Protocol Error";
537 break;
538
539 case MPI_IOCSTATUS_SCSI_TASK_TERMINATED: /* 0x0048 */
540 desc = "SCSI Task Terminated";
541 break;
542
543 case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */
544 desc = "SCSI Residual Mismatch";
545 break;
546
547 case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED: /* 0x004A */
548 desc = "SCSI Task Management Failed";
549 break;
550
551 case MPI_IOCSTATUS_SCSI_IOC_TERMINATED: /* 0x004B */
552 desc = "SCSI IOC Terminated";
553 break;
554
555 case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */
556 desc = "SCSI Ext Terminated";
557 break;
558 }
559
560 if (!desc)
561 return;
562
563 snprintf(extend_desc, EVENT_DESCR_STR_SZ,
564 "[%d:%d:%d:%d] cmd=%02Xh, sam_status=%02Xh state=%02Xh",
565 sc->device->host->host_no,
566 sc->device->channel, sc->device->id, sc->device->lun,
567 sc->cmnd[0], scsi_status, scsi_state);
568
569 printk(MYIOC_s_INFO_FMT "IOCStatus(0x%04X): %s: %s\n",
570 ioc->name, ioc_status, desc, extend_desc);
571}
572#endif
573
490/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 574/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
491/* 575/*
492 * mptscsih_io_done - Main SCSI IO callback routine registered to 576 * mptscsih_io_done - Main SCSI IO callback routine registered to
@@ -573,12 +657,14 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
573 u32 xfer_cnt; 657 u32 xfer_cnt;
574 u16 status; 658 u16 status;
575 u8 scsi_state, scsi_status; 659 u8 scsi_state, scsi_status;
660 u32 log_info;
576 661
577 status = le16_to_cpu(pScsiReply->IOCStatus) & MPI_IOCSTATUS_MASK; 662 status = le16_to_cpu(pScsiReply->IOCStatus) & MPI_IOCSTATUS_MASK;
578 scsi_state = pScsiReply->SCSIState; 663 scsi_state = pScsiReply->SCSIState;
579 scsi_status = pScsiReply->SCSIStatus; 664 scsi_status = pScsiReply->SCSIStatus;
580 xfer_cnt = le32_to_cpu(pScsiReply->TransferCount); 665 xfer_cnt = le32_to_cpu(pScsiReply->TransferCount);
581 sc->resid = sc->request_bufflen - xfer_cnt; 666 sc->resid = sc->request_bufflen - xfer_cnt;
667 log_info = le32_to_cpu(pScsiReply->IOCLogInfo);
582 668
583 /* 669 /*
584 * if we get a data underrun indication, yet no data was 670 * if we get a data underrun indication, yet no data was
@@ -593,13 +679,6 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
593 status = MPI_IOCSTATUS_SUCCESS; 679 status = MPI_IOCSTATUS_SUCCESS;
594 } 680 }
595 681
596 dreplyprintk((KERN_NOTICE "Reply ha=%d id=%d lun=%d:\n"
597 "IOCStatus=%04xh SCSIState=%02xh SCSIStatus=%02xh\n"
598 "resid=%d bufflen=%d xfer_cnt=%d\n",
599 ioc->id, sc->device->id, sc->device->lun,
600 status, scsi_state, scsi_status, sc->resid,
601 sc->request_bufflen, xfer_cnt));
602
603 if (scsi_state & MPI_SCSI_STATE_AUTOSENSE_VALID) 682 if (scsi_state & MPI_SCSI_STATE_AUTOSENSE_VALID)
604 mptscsih_copy_sense_data(sc, hd, mf, pScsiReply); 683 mptscsih_copy_sense_data(sc, hd, mf, pScsiReply);
605 684
@@ -608,9 +687,10 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
608 */ 687 */
609 if (scsi_state & MPI_SCSI_STATE_RESPONSE_INFO_VALID && 688 if (scsi_state & MPI_SCSI_STATE_RESPONSE_INFO_VALID &&
610 pScsiReply->ResponseInfo) { 689 pScsiReply->ResponseInfo) {
611 printk(KERN_NOTICE "ha=%d id=%d lun=%d: " 690 printk(KERN_NOTICE "[%d:%d:%d:%d] "
612 "FCP_ResponseInfo=%08xh\n", 691 "FCP_ResponseInfo=%08xh\n",
613 ioc->id, sc->device->id, sc->device->lun, 692 sc->device->host->host_no, sc->device->channel,
693 sc->device->id, sc->device->lun,
614 le32_to_cpu(pScsiReply->ResponseInfo)); 694 le32_to_cpu(pScsiReply->ResponseInfo));
615 } 695 }
616 696
@@ -655,9 +735,8 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
655 if ( ioc->bus_type == SAS ) { 735 if ( ioc->bus_type == SAS ) {
656 u16 ioc_status = le16_to_cpu(pScsiReply->IOCStatus); 736 u16 ioc_status = le16_to_cpu(pScsiReply->IOCStatus);
657 if (ioc_status & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) { 737 if (ioc_status & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) {
658 u32 log_info = le32_to_cpu(mr->u.reply.IOCLogInfo); 738 if ((log_info & SAS_LOGINFO_MASK)
659 log_info &=SAS_LOGINFO_MASK; 739 == SAS_LOGINFO_NEXUS_LOSS) {
660 if (log_info == SAS_LOGINFO_NEXUS_LOSS) {
661 sc->result = (DID_BUS_BUSY << 16); 740 sc->result = (DID_BUS_BUSY << 16);
662 break; 741 break;
663 } 742 }
@@ -695,7 +774,8 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
695 else /* Sufficient data transfer occurred */ 774 else /* Sufficient data transfer occurred */
696 sc->result = (DID_OK << 16) | scsi_status; 775 sc->result = (DID_OK << 16) | scsi_status;
697 dreplyprintk((KERN_NOTICE 776 dreplyprintk((KERN_NOTICE
698 "RESIDUAL_MISMATCH: result=%x on id=%d\n", sc->result, sc->device->id)); 777 "RESIDUAL_MISMATCH: result=%x on channel=%d id=%d\n",
778 sc->result, sc->device->channel, sc->device->id));
699 break; 779 break;
700 780
701 case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN: /* 0x0045 */ 781 case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN: /* 0x0045 */
@@ -808,7 +888,28 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
808 888
809 } /* switch(status) */ 889 } /* switch(status) */
810 890
811 dreplyprintk((KERN_NOTICE " sc->result is %08xh\n", sc->result)); 891#ifdef MPT_DEBUG_REPLY
892 if (sc->result) {
893
894 mptscsih_iocstatus_info_scsiio(ioc, status,
895 scsi_status, scsi_state, sc);
896
897 dreplyprintk(("%s: [%d:%d:%d:%d] cmd=0x%02x "
898 "result=0x%08x\n\tiocstatus=0x%04X "
899 "scsi_state=0x%02X scsi_status=0x%02X "
900 "loginfo=0x%08X\n", __FUNCTION__,
901 sc->device->host->host_no, sc->device->channel, sc->device->id,
902 sc->device->lun, sc->cmnd[0], sc->result, status,
903 scsi_state, scsi_status, log_info));
904
905 dreplyprintk(("%s: [%d:%d:%d:%d] resid=%d "
906 "bufflen=%d xfer_cnt=%d\n", __FUNCTION__,
907 sc->device->host->host_no, sc->device->channel, sc->device->id,
908 sc->device->lun, sc->resid, sc->request_bufflen,
909 xfer_cnt));
910 }
911#endif
912
812 } /* end of address reply case */ 913 } /* end of address reply case */
813 914
814 /* Unmap the DMA buffers, if any. */ 915 /* Unmap the DMA buffers, if any. */