mptbase.c (97009a29e8c999def2d1e9ef253c226daf9541af) | mptbase.c (213aaca3e5727f3eb56002b04a1405db34a54ed8) |
---|---|
1/* 2 * linux/drivers/message/fusion/mptbase.c 3 * This is the Fusion MPT base driver which supports multiple 4 * (SCSI + LAN) specialized protocol drivers. 5 * For use with LSI PCI chip/adapter(s) 6 * running LSI Fusion MPT (Message Passing Technology) firmware. 7 * 8 * Copyright (c) 1999-2008 LSI Corporation --- 101 unchanged lines hidden (view full) --- 110int mpt_fwfault_debug; 111EXPORT_SYMBOL(mpt_fwfault_debug); 112module_param_call(mpt_fwfault_debug, param_set_int, param_get_int, 113 &mpt_fwfault_debug, 0600); 114MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault" 115 " and halt Firmware on fault - (default=0)"); 116 117 | 1/* 2 * linux/drivers/message/fusion/mptbase.c 3 * This is the Fusion MPT base driver which supports multiple 4 * (SCSI + LAN) specialized protocol drivers. 5 * For use with LSI PCI chip/adapter(s) 6 * running LSI Fusion MPT (Message Passing Technology) firmware. 7 * 8 * Copyright (c) 1999-2008 LSI Corporation --- 101 unchanged lines hidden (view full) --- 110int mpt_fwfault_debug; 111EXPORT_SYMBOL(mpt_fwfault_debug); 112module_param_call(mpt_fwfault_debug, param_set_int, param_get_int, 113 &mpt_fwfault_debug, 0600); 114MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault" 115 " and halt Firmware on fault - (default=0)"); 116 117 |
118static char MptCallbacksName[MPT_MAX_PROTOCOL_DRIVERS][50]; |
|
118 119#ifdef MFCNT 120static int mfcounter = 0; 121#define PRINT_MF_COUNT 20000 122#endif 123 124/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 125/* --- 82 unchanged lines hidden (view full) --- 208#endif 209static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); 210 211static int ProcessEventNotification(MPT_ADAPTER *ioc, 212 EventNotificationReply_t *evReply, int *evHandlers); 213static void mpt_iocstatus_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf); 214static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info); 215static void mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info); | 119 120#ifdef MFCNT 121static int mfcounter = 0; 122#define PRINT_MF_COUNT 20000 123#endif 124 125/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 126/* --- 82 unchanged lines hidden (view full) --- 209#endif 210static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); 211 212static int ProcessEventNotification(MPT_ADAPTER *ioc, 213 EventNotificationReply_t *evReply, int *evHandlers); 214static void mpt_iocstatus_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf); 215static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info); 216static void mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info); |
216static void mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info); | 217static void mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info , u8 cb_idx); |
217static int mpt_read_ioc_pg_3(MPT_ADAPTER *ioc); 218static void mpt_inactive_raid_list_free(MPT_ADAPTER *ioc); 219 220/* module entry point */ 221static int __init fusion_init (void); 222static void __exit fusion_exit (void); 223 224#define CHIPREG_READ32(addr) readl_relaxed(addr) --- 260 unchanged lines hidden (view full) --- 485 ioc_stat = le16_to_cpu(mr->u.reply.IOCStatus); 486 if (ioc_stat & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) { 487 u32 log_info = le32_to_cpu(mr->u.reply.IOCLogInfo); 488 if (ioc->bus_type == FC) 489 mpt_fc_log_info(ioc, log_info); 490 else if (ioc->bus_type == SPI) 491 mpt_spi_log_info(ioc, log_info); 492 else if (ioc->bus_type == SAS) | 218static int mpt_read_ioc_pg_3(MPT_ADAPTER *ioc); 219static void mpt_inactive_raid_list_free(MPT_ADAPTER *ioc); 220 221/* module entry point */ 222static int __init fusion_init (void); 223static void __exit fusion_exit (void); 224 225#define CHIPREG_READ32(addr) readl_relaxed(addr) --- 260 unchanged lines hidden (view full) --- 486 ioc_stat = le16_to_cpu(mr->u.reply.IOCStatus); 487 if (ioc_stat & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE) { 488 u32 log_info = le32_to_cpu(mr->u.reply.IOCLogInfo); 489 if (ioc->bus_type == FC) 490 mpt_fc_log_info(ioc, log_info); 491 else if (ioc->bus_type == SPI) 492 mpt_spi_log_info(ioc, log_info); 493 else if (ioc->bus_type == SAS) |
493 mpt_sas_log_info(ioc, log_info); | 494 mpt_sas_log_info(ioc, log_info, cb_idx); |
494 } 495 496 if (ioc_stat & MPI_IOCSTATUS_MASK) 497 mpt_iocstatus_info(ioc, (u32)ioc_stat, mf); 498 499 /* Check for (valid) IO callback! */ 500 if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS || 501 MptCallbacks[cb_idx] == NULL) { --- 137 unchanged lines hidden (view full) --- 639 * one for MptScsiTaskMgmt requests; one for Scan/DV requests. 640 * 641 * Returns u8 valued "handle" in the range (and S.O.D. order) 642 * {N,...,7,6,5,...,1} if successful. 643 * A return value of MPT_MAX_PROTOCOL_DRIVERS (including zero!) should be 644 * considered an error by the caller. 645 */ 646u8 | 495 } 496 497 if (ioc_stat & MPI_IOCSTATUS_MASK) 498 mpt_iocstatus_info(ioc, (u32)ioc_stat, mf); 499 500 /* Check for (valid) IO callback! */ 501 if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS || 502 MptCallbacks[cb_idx] == NULL) { --- 137 unchanged lines hidden (view full) --- 640 * one for MptScsiTaskMgmt requests; one for Scan/DV requests. 641 * 642 * Returns u8 valued "handle" in the range (and S.O.D. order) 643 * {N,...,7,6,5,...,1} if successful. 644 * A return value of MPT_MAX_PROTOCOL_DRIVERS (including zero!) should be 645 * considered an error by the caller. 646 */ 647u8 |
647mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass) | 648mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass, char *func_name) |
648{ 649 u8 cb_idx; 650 last_drv_idx = MPT_MAX_PROTOCOL_DRIVERS; 651 652 /* 653 * Search for empty callback slot in this order: {N,...,7,6,5,...,1} 654 * (slot/handle 0 is reserved!) 655 */ 656 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) { 657 if (MptCallbacks[cb_idx] == NULL) { 658 MptCallbacks[cb_idx] = cbfunc; 659 MptDriverClass[cb_idx] = dclass; 660 MptEvHandlers[cb_idx] = NULL; 661 last_drv_idx = cb_idx; | 649{ 650 u8 cb_idx; 651 last_drv_idx = MPT_MAX_PROTOCOL_DRIVERS; 652 653 /* 654 * Search for empty callback slot in this order: {N,...,7,6,5,...,1} 655 * (slot/handle 0 is reserved!) 656 */ 657 for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) { 658 if (MptCallbacks[cb_idx] == NULL) { 659 MptCallbacks[cb_idx] = cbfunc; 660 MptDriverClass[cb_idx] = dclass; 661 MptEvHandlers[cb_idx] = NULL; 662 last_drv_idx = cb_idx; |
663 memcpy(MptCallbacksName[cb_idx], func_name, 664 strlen(func_name) > 50 ? 50 : strlen(func_name)); |
|
662 break; 663 } 664 } 665 666 return last_drv_idx; 667} 668 669/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ --- 7327 unchanged lines hidden (view full) --- 7997/** 7998 * mpt_sas_log_info - Log information returned from SAS IOC. 7999 * @ioc: Pointer to MPT_ADAPTER structure 8000 * @log_info: U32 LogInfo reply word from the IOC 8001 * 8002 * Refer to lsi/mpi_log_sas.h. 8003 **/ 8004static void | 665 break; 666 } 667 } 668 669 return last_drv_idx; 670} 671 672/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ --- 7327 unchanged lines hidden (view full) --- 8000/** 8001 * mpt_sas_log_info - Log information returned from SAS IOC. 8002 * @ioc: Pointer to MPT_ADAPTER structure 8003 * @log_info: U32 LogInfo reply word from the IOC 8004 * 8005 * Refer to lsi/mpi_log_sas.h. 8006 **/ 8007static void |
8005mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info) | 8008mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info, u8 cb_idx) |
8006{ 8007union loginfo_type { 8008 u32 loginfo; 8009 struct { 8010 u32 subcode:16; 8011 u32 code:8; 8012 u32 originator:4; 8013 u32 bus_type:4; --- 37 unchanged lines hidden (view full) --- 8051 break; 8052 default: 8053 return; 8054 } 8055 8056 if (sub_code_desc != NULL) 8057 printk(MYIOC_s_INFO_FMT 8058 "LogInfo(0x%08x): Originator={%s}, Code={%s}," | 8009{ 8010union loginfo_type { 8011 u32 loginfo; 8012 struct { 8013 u32 subcode:16; 8014 u32 code:8; 8015 u32 originator:4; 8016 u32 bus_type:4; --- 37 unchanged lines hidden (view full) --- 8054 break; 8055 default: 8056 return; 8057 } 8058 8059 if (sub_code_desc != NULL) 8060 printk(MYIOC_s_INFO_FMT 8061 "LogInfo(0x%08x): Originator={%s}, Code={%s}," |
8059 " SubCode={%s}\n", | 8062 " SubCode={%s} cb_idx %s\n", |
8060 ioc->name, log_info, originator_desc, code_desc, | 8063 ioc->name, log_info, originator_desc, code_desc, |
8061 sub_code_desc); | 8064 sub_code_desc, MptCallbacksName[cb_idx]); |
8062 else if (code_desc != NULL) 8063 printk(MYIOC_s_INFO_FMT 8064 "LogInfo(0x%08x): Originator={%s}, Code={%s}," | 8065 else if (code_desc != NULL) 8066 printk(MYIOC_s_INFO_FMT 8067 "LogInfo(0x%08x): Originator={%s}, Code={%s}," |
8065 " SubCode(0x%04x)\n", | 8068 " SubCode(0x%04x) cb_idx %s\n", |
8066 ioc->name, log_info, originator_desc, code_desc, | 8069 ioc->name, log_info, originator_desc, code_desc, |
8067 sas_loginfo.dw.subcode); | 8070 sas_loginfo.dw.subcode, MptCallbacksName[cb_idx]); |
8068 else 8069 printk(MYIOC_s_INFO_FMT 8070 "LogInfo(0x%08x): Originator={%s}, Code=(0x%02x)," | 8071 else 8072 printk(MYIOC_s_INFO_FMT 8073 "LogInfo(0x%08x): Originator={%s}, Code=(0x%02x)," |
8071 " SubCode(0x%04x)\n", | 8074 " SubCode(0x%04x) cb_idx %s\n", |
8072 ioc->name, log_info, originator_desc, | 8075 ioc->name, log_info, originator_desc, |
8073 sas_loginfo.dw.code, sas_loginfo.dw.subcode); | 8076 sas_loginfo.dw.code, sas_loginfo.dw.subcode, 8077 MptCallbacksName[cb_idx]); |
8074} 8075 8076/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 8077/** 8078 * mpt_iocstatus_info_config - IOCSTATUS information for config pages 8079 * @ioc: Pointer to MPT_ADAPTER structure 8080 * @ioc_status: U32 IOCStatus word from IOC 8081 * @mf: Pointer to MPT request frame --- 348 unchanged lines hidden (view full) --- 8430 MptDriverClass[cb_idx] = MPTUNKNOWN_DRIVER; 8431 MptEvHandlers[cb_idx] = NULL; 8432 MptResetHandlers[cb_idx] = NULL; 8433 } 8434 8435 /* Register ourselves (mptbase) in order to facilitate 8436 * EventNotification handling. 8437 */ | 8078} 8079 8080/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 8081/** 8082 * mpt_iocstatus_info_config - IOCSTATUS information for config pages 8083 * @ioc: Pointer to MPT_ADAPTER structure 8084 * @ioc_status: U32 IOCStatus word from IOC 8085 * @mf: Pointer to MPT request frame --- 348 unchanged lines hidden (view full) --- 8434 MptDriverClass[cb_idx] = MPTUNKNOWN_DRIVER; 8435 MptEvHandlers[cb_idx] = NULL; 8436 MptResetHandlers[cb_idx] = NULL; 8437 } 8438 8439 /* Register ourselves (mptbase) in order to facilitate 8440 * EventNotification handling. 8441 */ |
8438 mpt_base_index = mpt_register(mptbase_reply, MPTBASE_DRIVER); | 8442 mpt_base_index = mpt_register(mptbase_reply, MPTBASE_DRIVER, 8443 "mptbase_reply"); |
8439 8440 /* Register for hard reset handling callbacks. 8441 */ 8442 mpt_reset_register(mpt_base_index, mpt_ioc_reset); 8443 8444#ifdef CONFIG_PROC_FS 8445 (void) procmpt_create(); 8446#endif --- 23 unchanged lines hidden --- | 8444 8445 /* Register for hard reset handling callbacks. 8446 */ 8447 mpt_reset_register(mpt_base_index, mpt_ioc_reset); 8448 8449#ifdef CONFIG_PROC_FS 8450 (void) procmpt_create(); 8451#endif --- 23 unchanged lines hidden --- |