aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptbase.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message/fusion/mptbase.c')
-rw-r--r--drivers/message/fusion/mptbase.c90
1 files changed, 58 insertions, 32 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index bb7ad4d0678a..164375eea896 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1189,7 +1189,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1189 ioc->diagPending = 0; 1189 ioc->diagPending = 0;
1190 spin_lock_init(&ioc->diagLock); 1190 spin_lock_init(&ioc->diagLock);
1191 spin_lock_init(&ioc->fc_rescan_work_lock); 1191 spin_lock_init(&ioc->fc_rescan_work_lock);
1192 spin_lock_init(&ioc->fc_rport_lock);
1193 spin_lock_init(&ioc->initializing_hba_lock); 1192 spin_lock_init(&ioc->initializing_hba_lock);
1194 1193
1195 /* Initialize the event logging. 1194 /* Initialize the event logging.
@@ -1569,6 +1568,21 @@ mpt_resume(struct pci_dev *pdev)
1569} 1568}
1570#endif 1569#endif
1571 1570
1571static int
1572mpt_signal_reset(int index, MPT_ADAPTER *ioc, int reset_phase)
1573{
1574 if ((MptDriverClass[index] == MPTSPI_DRIVER &&
1575 ioc->bus_type != SPI) ||
1576 (MptDriverClass[index] == MPTFC_DRIVER &&
1577 ioc->bus_type != FC) ||
1578 (MptDriverClass[index] == MPTSAS_DRIVER &&
1579 ioc->bus_type != SAS))
1580 /* make sure we only call the relevant reset handler
1581 * for the bus */
1582 return 0;
1583 return (MptResetHandlers[index])(ioc, reset_phase);
1584}
1585
1572/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1586/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1573/* 1587/*
1574 * mpt_do_ioc_recovery - Initialize or recover MPT adapter. 1588 * mpt_do_ioc_recovery - Initialize or recover MPT adapter.
@@ -1892,14 +1906,14 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1892 if ((ret == 0) && MptResetHandlers[ii]) { 1906 if ((ret == 0) && MptResetHandlers[ii]) {
1893 dprintk((MYIOC_s_INFO_FMT "Calling IOC post_reset handler #%d\n", 1907 dprintk((MYIOC_s_INFO_FMT "Calling IOC post_reset handler #%d\n",
1894 ioc->name, ii)); 1908 ioc->name, ii));
1895 rc += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_POST_RESET); 1909 rc += mpt_signal_reset(ii, ioc, MPT_IOC_POST_RESET);
1896 handlers++; 1910 handlers++;
1897 } 1911 }
1898 1912
1899 if (alt_ioc_ready && MptResetHandlers[ii]) { 1913 if (alt_ioc_ready && MptResetHandlers[ii]) {
1900 drsprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n", 1914 drsprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n",
1901 ioc->name, ioc->alt_ioc->name, ii)); 1915 ioc->name, ioc->alt_ioc->name, ii));
1902 rc += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_POST_RESET); 1916 rc += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_POST_RESET);
1903 handlers++; 1917 handlers++;
1904 } 1918 }
1905 } 1919 }
@@ -3280,11 +3294,11 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3280 if (MptResetHandlers[ii]) { 3294 if (MptResetHandlers[ii]) {
3281 dprintk((MYIOC_s_INFO_FMT "Calling IOC pre_reset handler #%d\n", 3295 dprintk((MYIOC_s_INFO_FMT "Calling IOC pre_reset handler #%d\n",
3282 ioc->name, ii)); 3296 ioc->name, ii));
3283 r += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_PRE_RESET); 3297 r += mpt_signal_reset(ii, ioc, MPT_IOC_PRE_RESET);
3284 if (ioc->alt_ioc) { 3298 if (ioc->alt_ioc) {
3285 dprintk((MYIOC_s_INFO_FMT "Calling alt-%s pre_reset handler #%d\n", 3299 dprintk((MYIOC_s_INFO_FMT "Calling alt-%s pre_reset handler #%d\n",
3286 ioc->name, ioc->alt_ioc->name, ii)); 3300 ioc->name, ioc->alt_ioc->name, ii));
3287 r += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_PRE_RESET); 3301 r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_PRE_RESET);
3288 } 3302 }
3289 } 3303 }
3290 } 3304 }
@@ -5719,11 +5733,11 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
5719 if (MptResetHandlers[ii]) { 5733 if (MptResetHandlers[ii]) {
5720 dtmprintk((MYIOC_s_INFO_FMT "Calling IOC reset_setup handler #%d\n", 5734 dtmprintk((MYIOC_s_INFO_FMT "Calling IOC reset_setup handler #%d\n",
5721 ioc->name, ii)); 5735 ioc->name, ii));
5722 r += (*(MptResetHandlers[ii]))(ioc, MPT_IOC_SETUP_RESET); 5736 r += mpt_signal_reset(ii, ioc, MPT_IOC_SETUP_RESET);
5723 if (ioc->alt_ioc) { 5737 if (ioc->alt_ioc) {
5724 dtmprintk((MYIOC_s_INFO_FMT "Calling alt-%s setup reset handler #%d\n", 5738 dtmprintk((MYIOC_s_INFO_FMT "Calling alt-%s setup reset handler #%d\n",
5725 ioc->name, ioc->alt_ioc->name, ii)); 5739 ioc->name, ioc->alt_ioc->name, ii));
5726 r += (*(MptResetHandlers[ii]))(ioc->alt_ioc, MPT_IOC_SETUP_RESET); 5740 r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_SETUP_RESET);
5727 } 5741 }
5728 } 5742 }
5729 } 5743 }
@@ -5748,11 +5762,13 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
5748 return rc; 5762 return rc;
5749} 5763}
5750 5764
5765# define EVENT_DESCR_STR_SZ 100
5766
5751/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5767/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5752static void 5768static void
5753EventDescriptionStr(u8 event, u32 evData0, char *evStr) 5769EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5754{ 5770{
5755 char *ds; 5771 char *ds = NULL;
5756 5772
5757 switch(event) { 5773 switch(event) {
5758 case MPI_EVENT_NONE: 5774 case MPI_EVENT_NONE:
@@ -5789,9 +5805,9 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5789 if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LIP) 5805 if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LIP)
5790 ds = "Loop State(LIP) Change"; 5806 ds = "Loop State(LIP) Change";
5791 else if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LPE) 5807 else if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LPE)
5792 ds = "Loop State(LPE) Change"; /* ??? */ 5808 ds = "Loop State(LPE) Change"; /* ??? */
5793 else 5809 else
5794 ds = "Loop State(LPB) Change"; /* ??? */ 5810 ds = "Loop State(LPB) Change"; /* ??? */
5795 break; 5811 break;
5796 case MPI_EVENT_LOGOUT: 5812 case MPI_EVENT_LOGOUT:
5797 ds = "Logout"; 5813 ds = "Logout";
@@ -5853,27 +5869,32 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5853 break; 5869 break;
5854 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: 5870 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE:
5855 { 5871 {
5856 char buf[50];
5857 u8 id = (u8)(evData0); 5872 u8 id = (u8)(evData0);
5858 u8 ReasonCode = (u8)(evData0 >> 16); 5873 u8 ReasonCode = (u8)(evData0 >> 16);
5859 switch (ReasonCode) { 5874 switch (ReasonCode) {
5860 case MPI_EVENT_SAS_DEV_STAT_RC_ADDED: 5875 case MPI_EVENT_SAS_DEV_STAT_RC_ADDED:
5861 sprintf(buf,"SAS Device Status Change: Added: id=%d", id); 5876 snprintf(evStr, EVENT_DESCR_STR_SZ,
5877 "SAS Device Status Change: Added: id=%d", id);
5862 break; 5878 break;
5863 case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING: 5879 case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING:
5864 sprintf(buf,"SAS Device Status Change: Deleted: id=%d", id); 5880 snprintf(evStr, EVENT_DESCR_STR_SZ,
5881 "SAS Device Status Change: Deleted: id=%d", id);
5865 break; 5882 break;
5866 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA: 5883 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA:
5867 sprintf(buf,"SAS Device Status Change: SMART Data: id=%d", id); 5884 snprintf(evStr, EVENT_DESCR_STR_SZ,
5885 "SAS Device Status Change: SMART Data: id=%d",
5886 id);
5868 break; 5887 break;
5869 case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED: 5888 case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED:
5870 sprintf(buf,"SAS Device Status Change: No Persistancy Added: id=%d", id); 5889 snprintf(evStr, EVENT_DESCR_STR_SZ,
5890 "SAS Device Status Change: No Persistancy "
5891 "Added: id=%d", id);
5871 break; 5892 break;
5872 default: 5893 default:
5873 sprintf(buf,"SAS Device Status Change: Unknown: id=%d", id); 5894 snprintf(evStr, EVENT_DESCR_STR_SZ,
5874 break; 5895 "SAS Device Status Change: Unknown: id=%d", id);
5896 break;
5875 } 5897 }
5876 ds = buf;
5877 break; 5898 break;
5878 } 5899 }
5879 case MPI_EVENT_ON_BUS_TIMER_EXPIRED: 5900 case MPI_EVENT_ON_BUS_TIMER_EXPIRED:
@@ -5890,41 +5911,46 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5890 break; 5911 break;
5891 case MPI_EVENT_SAS_PHY_LINK_STATUS: 5912 case MPI_EVENT_SAS_PHY_LINK_STATUS:
5892 { 5913 {
5893 char buf[50];
5894 u8 LinkRates = (u8)(evData0 >> 8); 5914 u8 LinkRates = (u8)(evData0 >> 8);
5895 u8 PhyNumber = (u8)(evData0); 5915 u8 PhyNumber = (u8)(evData0);
5896 LinkRates = (LinkRates & MPI_EVENT_SAS_PLS_LR_CURRENT_MASK) >> 5916 LinkRates = (LinkRates & MPI_EVENT_SAS_PLS_LR_CURRENT_MASK) >>
5897 MPI_EVENT_SAS_PLS_LR_CURRENT_SHIFT; 5917 MPI_EVENT_SAS_PLS_LR_CURRENT_SHIFT;
5898 switch (LinkRates) { 5918 switch (LinkRates) {
5899 case MPI_EVENT_SAS_PLS_LR_RATE_UNKNOWN: 5919 case MPI_EVENT_SAS_PLS_LR_RATE_UNKNOWN:
5900 sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5920 snprintf(evStr, EVENT_DESCR_STR_SZ,
5921 "SAS PHY Link Status: Phy=%d:"
5901 " Rate Unknown",PhyNumber); 5922 " Rate Unknown",PhyNumber);
5902 break; 5923 break;
5903 case MPI_EVENT_SAS_PLS_LR_RATE_PHY_DISABLED: 5924 case MPI_EVENT_SAS_PLS_LR_RATE_PHY_DISABLED:
5904 sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5925 snprintf(evStr, EVENT_DESCR_STR_SZ,
5926 "SAS PHY Link Status: Phy=%d:"
5905 " Phy Disabled",PhyNumber); 5927 " Phy Disabled",PhyNumber);
5906 break; 5928 break;
5907 case MPI_EVENT_SAS_PLS_LR_RATE_FAILED_SPEED_NEGOTIATION: 5929 case MPI_EVENT_SAS_PLS_LR_RATE_FAILED_SPEED_NEGOTIATION:
5908 sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5930 snprintf(evStr, EVENT_DESCR_STR_SZ,
5931 "SAS PHY Link Status: Phy=%d:"
5909 " Failed Speed Nego",PhyNumber); 5932 " Failed Speed Nego",PhyNumber);
5910 break; 5933 break;
5911 case MPI_EVENT_SAS_PLS_LR_RATE_SATA_OOB_COMPLETE: 5934 case MPI_EVENT_SAS_PLS_LR_RATE_SATA_OOB_COMPLETE:
5912 sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5935 snprintf(evStr, EVENT_DESCR_STR_SZ,
5936 "SAS PHY Link Status: Phy=%d:"
5913 " Sata OOB Completed",PhyNumber); 5937 " Sata OOB Completed",PhyNumber);
5914 break; 5938 break;
5915 case MPI_EVENT_SAS_PLS_LR_RATE_1_5: 5939 case MPI_EVENT_SAS_PLS_LR_RATE_1_5:
5916 sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5940 snprintf(evStr, EVENT_DESCR_STR_SZ,
5941 "SAS PHY Link Status: Phy=%d:"
5917 " Rate 1.5 Gbps",PhyNumber); 5942 " Rate 1.5 Gbps",PhyNumber);
5918 break; 5943 break;
5919 case MPI_EVENT_SAS_PLS_LR_RATE_3_0: 5944 case MPI_EVENT_SAS_PLS_LR_RATE_3_0:
5920 sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5945 snprintf(evStr, EVENT_DESCR_STR_SZ,
5946 "SAS PHY Link Status: Phy=%d:"
5921 " Rate 3.0 Gpbs",PhyNumber); 5947 " Rate 3.0 Gpbs",PhyNumber);
5922 break; 5948 break;
5923 default: 5949 default:
5924 sprintf(buf,"SAS PHY Link Status: Phy=%d", PhyNumber); 5950 snprintf(evStr, EVENT_DESCR_STR_SZ,
5951 "SAS PHY Link Status: Phy=%d", PhyNumber);
5925 break; 5952 break;
5926 } 5953 }
5927 ds = buf;
5928 break; 5954 break;
5929 } 5955 }
5930 case MPI_EVENT_SAS_DISCOVERY_ERROR: 5956 case MPI_EVENT_SAS_DISCOVERY_ERROR:
@@ -5933,9 +5959,8 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5933 case MPI_EVENT_IR_RESYNC_UPDATE: 5959 case MPI_EVENT_IR_RESYNC_UPDATE:
5934 { 5960 {
5935 u8 resync_complete = (u8)(evData0 >> 16); 5961 u8 resync_complete = (u8)(evData0 >> 16);
5936 char buf[40]; 5962 snprintf(evStr, EVENT_DESCR_STR_SZ,
5937 sprintf(buf,"IR Resync Update: Complete = %d:",resync_complete); 5963 "IR Resync Update: Complete = %d:",resync_complete);
5938 ds = buf;
5939 break; 5964 break;
5940 } 5965 }
5941 case MPI_EVENT_IR2: 5966 case MPI_EVENT_IR2:
@@ -5988,7 +6013,8 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5988 ds = "Unknown"; 6013 ds = "Unknown";
5989 break; 6014 break;
5990 } 6015 }
5991 strcpy(evStr,ds); 6016 if (ds)
6017 strncpy(evStr, ds, EVENT_DESCR_STR_SZ);
5992} 6018}
5993 6019
5994/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6020/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -6010,7 +6036,7 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
6010 int ii; 6036 int ii;
6011 int r = 0; 6037 int r = 0;
6012 int handlers = 0; 6038 int handlers = 0;
6013 char evStr[100]; 6039 char evStr[EVENT_DESCR_STR_SZ];
6014 u8 event; 6040 u8 event;
6015 6041
6016 /* 6042 /*