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.c205
1 files changed, 113 insertions, 92 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 642a61b6d0a4..266414ca2814 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -180,6 +180,7 @@ static void mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf)
180static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info); 180static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info);
181static void mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info); 181static void mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info);
182static void mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info); 182static void mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info);
183static int mpt_read_ioc_pg_3(MPT_ADAPTER *ioc);
183 184
184/* module entry point */ 185/* module entry point */
185static int __init fusion_init (void); 186static int __init fusion_init (void);
@@ -428,7 +429,7 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
428 results = ProcessEventNotification(ioc, pEvReply, &evHandlers); 429 results = ProcessEventNotification(ioc, pEvReply, &evHandlers);
429 if (results != evHandlers) { 430 if (results != evHandlers) {
430 /* CHECKME! Any special handling needed here? */ 431 /* CHECKME! Any special handling needed here? */
431 devtprintk((MYIOC_s_WARN_FMT "Called %d event handlers, sum results = %d\n", 432 devtverboseprintk((MYIOC_s_WARN_FMT "Called %d event handlers, sum results = %d\n",
432 ioc->name, evHandlers, results)); 433 ioc->name, evHandlers, results));
433 } 434 }
434 435
@@ -438,10 +439,10 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
438 */ 439 */
439 if (pEvReply->MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY) { 440 if (pEvReply->MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY) {
440 freereq = 0; 441 freereq = 0;
441 devtprintk((MYIOC_s_WARN_FMT "EVENT_NOTIFICATION reply %p does not return Request frame\n", 442 devtverboseprintk((MYIOC_s_WARN_FMT "EVENT_NOTIFICATION reply %p does not return Request frame\n",
442 ioc->name, pEvReply)); 443 ioc->name, pEvReply));
443 } else { 444 } else {
444 devtprintk((MYIOC_s_WARN_FMT "EVENT_NOTIFICATION reply %p returns Request frame\n", 445 devtverboseprintk((MYIOC_s_WARN_FMT "EVENT_NOTIFICATION reply %p returns Request frame\n",
445 ioc->name, pEvReply)); 446 ioc->name, pEvReply));
446 } 447 }
447 448
@@ -1120,65 +1121,6 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
1120 return -1; 1121 return -1;
1121} 1122}
1122 1123
1123int
1124mpt_alt_ioc_wait(MPT_ADAPTER *ioc)
1125{
1126 int loop_count = 30 * 4; /* Wait 30 seconds */
1127 int status = -1; /* -1 means failed to get board READY */
1128
1129 do {
1130 spin_lock(&ioc->initializing_hba_lock);
1131 if (ioc->initializing_hba_lock_flag == 0) {
1132 ioc->initializing_hba_lock_flag=1;
1133 spin_unlock(&ioc->initializing_hba_lock);
1134 status = 0;
1135 break;
1136 }
1137 spin_unlock(&ioc->initializing_hba_lock);
1138 set_current_state(TASK_INTERRUPTIBLE);
1139 schedule_timeout(HZ/4);
1140 } while (--loop_count);
1141
1142 return status;
1143}
1144
1145/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1146/*
1147 * mpt_bringup_adapter - This is a wrapper function for mpt_do_ioc_recovery
1148 * @ioc: Pointer to MPT adapter structure
1149 * @sleepFlag: Use schedule if CAN_SLEEP else use udelay.
1150 *
1151 * This routine performs all the steps necessary to bring the IOC
1152 * to a OPERATIONAL state.
1153 *
1154 * Special Note: This function was added with spin lock's so as to allow
1155 * the dv(domain validation) work thread to succeed on the other channel
1156 * that maybe occuring at the same time when this function is called.
1157 * Without this lock, the dv would fail when message frames were
1158 * requested during hba bringup on the alternate ioc.
1159 */
1160static int
1161mpt_bringup_adapter(MPT_ADAPTER *ioc, int sleepFlag)
1162{
1163 int r;
1164
1165 if(ioc->alt_ioc) {
1166 if((r=mpt_alt_ioc_wait(ioc->alt_ioc)!=0))
1167 return r;
1168 }
1169
1170 r = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP,
1171 CAN_SLEEP);
1172
1173 if(ioc->alt_ioc) {
1174 spin_lock(&ioc->alt_ioc->initializing_hba_lock);
1175 ioc->alt_ioc->initializing_hba_lock_flag=0;
1176 spin_unlock(&ioc->alt_ioc->initializing_hba_lock);
1177 }
1178
1179return r;
1180}
1181
1182/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1124/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1183/* 1125/*
1184 * mpt_attach - Install a PCI intelligent MPT adapter. 1126 * mpt_attach - Install a PCI intelligent MPT adapter.
@@ -1482,7 +1424,8 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1482 */ 1424 */
1483 mpt_detect_bound_ports(ioc, pdev); 1425 mpt_detect_bound_ports(ioc, pdev);
1484 1426
1485 if ((r = mpt_bringup_adapter(ioc, CAN_SLEEP)) != 0){ 1427 if ((r = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP,
1428 CAN_SLEEP)) != 0){
1486 printk(KERN_WARNING MYNAM 1429 printk(KERN_WARNING MYNAM
1487 ": WARNING - %s did not initialize properly! (%d)\n", 1430 ": WARNING - %s did not initialize properly! (%d)\n",
1488 ioc->name, r); 1431 ioc->name, r);
@@ -1629,7 +1572,6 @@ mpt_resume(struct pci_dev *pdev)
1629 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 1572 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
1630 u32 device_state = pdev->current_state; 1573 u32 device_state = pdev->current_state;
1631 int recovery_state; 1574 int recovery_state;
1632 int ii;
1633 1575
1634 printk(MYIOC_s_INFO_FMT 1576 printk(MYIOC_s_INFO_FMT
1635 "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n", 1577 "pci-resume: pdev=0x%p, slot=%s, Previous operating state [D%d]\n",
@@ -1643,14 +1585,6 @@ mpt_resume(struct pci_dev *pdev)
1643 CHIPREG_WRITE32(&ioc->chip->IntMask, MPI_HIM_DIM); 1585 CHIPREG_WRITE32(&ioc->chip->IntMask, MPI_HIM_DIM);
1644 ioc->active = 1; 1586 ioc->active = 1;
1645 1587
1646 /* F/W not running */
1647 if(!CHIPREG_READ32(&ioc->chip->Doorbell)) {
1648 /* enable domain validation flags */
1649 for (ii=0; ii < MPT_MAX_SCSI_DEVICES; ii++) {
1650 ioc->spi_data.dvStatus[ii] |= MPT_SCSICFG_NEED_DV;
1651 }
1652 }
1653
1654 printk(MYIOC_s_INFO_FMT 1588 printk(MYIOC_s_INFO_FMT
1655 "pci-resume: ioc-state=0x%x,doorbell=0x%x\n", 1589 "pci-resume: ioc-state=0x%x,doorbell=0x%x\n",
1656 ioc->name, 1590 ioc->name,
@@ -4938,7 +4872,7 @@ done_and_free:
4938 return rc; 4872 return rc;
4939} 4873}
4940 4874
4941int 4875static int
4942mpt_read_ioc_pg_3(MPT_ADAPTER *ioc) 4876mpt_read_ioc_pg_3(MPT_ADAPTER *ioc)
4943{ 4877{
4944 IOCPage3_t *pIoc3; 4878 IOCPage3_t *pIoc3;
@@ -5146,13 +5080,13 @@ SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch)
5146 5080
5147 evnp = (EventNotification_t *) mpt_get_msg_frame(mpt_base_index, ioc); 5081 evnp = (EventNotification_t *) mpt_get_msg_frame(mpt_base_index, ioc);
5148 if (evnp == NULL) { 5082 if (evnp == NULL) {
5149 devtprintk((MYIOC_s_WARN_FMT "Unable to allocate event request frame!\n", 5083 devtverboseprintk((MYIOC_s_WARN_FMT "Unable to allocate event request frame!\n",
5150 ioc->name)); 5084 ioc->name));
5151 return 0; 5085 return 0;
5152 } 5086 }
5153 memset(evnp, 0, sizeof(*evnp)); 5087 memset(evnp, 0, sizeof(*evnp));
5154 5088
5155 devtprintk((MYIOC_s_INFO_FMT "Sending EventNotification (%d) request %p\n", ioc->name, EvSwitch, evnp)); 5089 devtverboseprintk((MYIOC_s_INFO_FMT "Sending EventNotification (%d) request %p\n", ioc->name, EvSwitch, evnp));
5156 5090
5157 evnp->Function = MPI_FUNCTION_EVENT_NOTIFICATION; 5091 evnp->Function = MPI_FUNCTION_EVENT_NOTIFICATION;
5158 evnp->ChainOffset = 0; 5092 evnp->ChainOffset = 0;
@@ -5907,24 +5841,27 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5907 break; 5841 break;
5908 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: 5842 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE:
5909 { 5843 {
5844 char buf[50];
5845 u8 id = (u8)(evData0);
5910 u8 ReasonCode = (u8)(evData0 >> 16); 5846 u8 ReasonCode = (u8)(evData0 >> 16);
5911 switch (ReasonCode) { 5847 switch (ReasonCode) {
5912 case MPI_EVENT_SAS_DEV_STAT_RC_ADDED: 5848 case MPI_EVENT_SAS_DEV_STAT_RC_ADDED:
5913 ds = "SAS Device Status Change: Added"; 5849 sprintf(buf,"SAS Device Status Change: Added: id=%d", id);
5914 break; 5850 break;
5915 case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING: 5851 case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING:
5916 ds = "SAS Device Status Change: Deleted"; 5852 sprintf(buf,"SAS Device Status Change: Deleted: id=%d", id);
5917 break; 5853 break;
5918 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA: 5854 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA:
5919 ds = "SAS Device Status Change: SMART Data"; 5855 sprintf(buf,"SAS Device Status Change: SMART Data: id=%d", id);
5920 break; 5856 break;
5921 case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED: 5857 case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED:
5922 ds = "SAS Device Status Change: No Persistancy Added"; 5858 sprintf(buf,"SAS Device Status Change: No Persistancy Added: id=%d", id);
5923 break; 5859 break;
5924 default: 5860 default:
5925 ds = "SAS Device Status Change: Unknown"; 5861 sprintf(buf,"SAS Device Status Change: Unknown: id=%d", id);
5926 break; 5862 break;
5927 } 5863 }
5864 ds = buf;
5928 break; 5865 break;
5929 } 5866 }
5930 case MPI_EVENT_ON_BUS_TIMER_EXPIRED: 5867 case MPI_EVENT_ON_BUS_TIMER_EXPIRED:
@@ -5940,11 +5877,97 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5940 ds = "Persistent Table Full"; 5877 ds = "Persistent Table Full";
5941 break; 5878 break;
5942 case MPI_EVENT_SAS_PHY_LINK_STATUS: 5879 case MPI_EVENT_SAS_PHY_LINK_STATUS:
5943 ds = "SAS PHY Link Status"; 5880 {
5881 char buf[50];
5882 u8 LinkRates = (u8)(evData0 >> 8);
5883 u8 PhyNumber = (u8)(evData0);
5884 LinkRates = (LinkRates & MPI_EVENT_SAS_PLS_LR_CURRENT_MASK) >>
5885 MPI_EVENT_SAS_PLS_LR_CURRENT_SHIFT;
5886 switch (LinkRates) {
5887 case MPI_EVENT_SAS_PLS_LR_RATE_UNKNOWN:
5888 sprintf(buf,"SAS PHY Link Status: Phy=%d:"
5889 " Rate Unknown",PhyNumber);
5890 break;
5891 case MPI_EVENT_SAS_PLS_LR_RATE_PHY_DISABLED:
5892 sprintf(buf,"SAS PHY Link Status: Phy=%d:"
5893 " Phy Disabled",PhyNumber);
5894 break;
5895 case MPI_EVENT_SAS_PLS_LR_RATE_FAILED_SPEED_NEGOTIATION:
5896 sprintf(buf,"SAS PHY Link Status: Phy=%d:"
5897 " Failed Speed Nego",PhyNumber);
5898 break;
5899 case MPI_EVENT_SAS_PLS_LR_RATE_SATA_OOB_COMPLETE:
5900 sprintf(buf,"SAS PHY Link Status: Phy=%d:"
5901 " Sata OOB Completed",PhyNumber);
5902 break;
5903 case MPI_EVENT_SAS_PLS_LR_RATE_1_5:
5904 sprintf(buf,"SAS PHY Link Status: Phy=%d:"
5905 " Rate 1.5 Gbps",PhyNumber);
5906 break;
5907 case MPI_EVENT_SAS_PLS_LR_RATE_3_0:
5908 sprintf(buf,"SAS PHY Link Status: Phy=%d:"
5909 " Rate 3.0 Gpbs",PhyNumber);
5910 break;
5911 default:
5912 sprintf(buf,"SAS PHY Link Status: Phy=%d", PhyNumber);
5913 break;
5914 }
5915 ds = buf;
5944 break; 5916 break;
5917 }
5945 case MPI_EVENT_SAS_DISCOVERY_ERROR: 5918 case MPI_EVENT_SAS_DISCOVERY_ERROR:
5946 ds = "SAS Discovery Error"; 5919 ds = "SAS Discovery Error";
5947 break; 5920 break;
5921 case MPI_EVENT_IR_RESYNC_UPDATE:
5922 {
5923 u8 resync_complete = (u8)(evData0 >> 16);
5924 char buf[40];
5925 sprintf(buf,"IR Resync Update: Complete = %d:",resync_complete);
5926 ds = buf;
5927 break;
5928 }
5929 case MPI_EVENT_IR2:
5930 {
5931 u8 ReasonCode = (u8)(evData0 >> 16);
5932 switch (ReasonCode) {
5933 case MPI_EVENT_IR2_RC_LD_STATE_CHANGED:
5934 ds = "IR2: LD State Changed";
5935 break;
5936 case MPI_EVENT_IR2_RC_PD_STATE_CHANGED:
5937 ds = "IR2: PD State Changed";
5938 break;
5939 case MPI_EVENT_IR2_RC_BAD_BLOCK_TABLE_FULL:
5940 ds = "IR2: Bad Block Table Full";
5941 break;
5942 case MPI_EVENT_IR2_RC_PD_INSERTED:
5943 ds = "IR2: PD Inserted";
5944 break;
5945 case MPI_EVENT_IR2_RC_PD_REMOVED:
5946 ds = "IR2: PD Removed";
5947 break;
5948 case MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED:
5949 ds = "IR2: Foreign CFG Detected";
5950 break;
5951 case MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR:
5952 ds = "IR2: Rebuild Medium Error";
5953 break;
5954 default:
5955 ds = "IR2";
5956 break;
5957 }
5958 break;
5959 }
5960 case MPI_EVENT_SAS_DISCOVERY:
5961 {
5962 if (evData0)
5963 ds = "SAS Discovery: Start";
5964 else
5965 ds = "SAS Discovery: Stop";
5966 break;
5967 }
5968 case MPI_EVENT_LOG_ENTRY_ADDED:
5969 ds = "SAS Log Entry Added";
5970 break;
5948 5971
5949 /* 5972 /*
5950 * MPT base "custom" events may be added here... 5973 * MPT base "custom" events may be added here...
@@ -5989,12 +6012,12 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
5989 } 6012 }
5990 6013
5991 EventDescriptionStr(event, evData0, evStr); 6014 EventDescriptionStr(event, evData0, evStr);
5992 devtprintk((MYIOC_s_INFO_FMT "MPT event (%s=%02Xh) detected!\n", 6015 devtprintk((MYIOC_s_INFO_FMT "MPT event:(%02Xh) : %s\n",
5993 ioc->name, 6016 ioc->name,
5994 evStr, 6017 event,
5995 event)); 6018 evStr));
5996 6019
5997#if defined(MPT_DEBUG) || defined(MPT_DEBUG_EVENTS) 6020#if defined(MPT_DEBUG) || defined(MPT_DEBUG_VERBOSE_EVENTS)
5998 printk(KERN_INFO MYNAM ": Event data:\n" KERN_INFO); 6021 printk(KERN_INFO MYNAM ": Event data:\n" KERN_INFO);
5999 for (ii = 0; ii < evDataLen; ii++) 6022 for (ii = 0; ii < evDataLen; ii++)
6000 printk(" %08x", le32_to_cpu(pEventReply->Data[ii])); 6023 printk(" %08x", le32_to_cpu(pEventReply->Data[ii]));
@@ -6053,7 +6076,7 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
6053 */ 6076 */
6054 for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) { 6077 for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) {
6055 if (MptEvHandlers[ii]) { 6078 if (MptEvHandlers[ii]) {
6056 devtprintk((MYIOC_s_INFO_FMT "Routing Event to event handler #%d\n", 6079 devtverboseprintk((MYIOC_s_INFO_FMT "Routing Event to event handler #%d\n",
6057 ioc->name, ii)); 6080 ioc->name, ii));
6058 r += (*(MptEvHandlers[ii]))(ioc, pEventReply); 6081 r += (*(MptEvHandlers[ii]))(ioc, pEventReply);
6059 handlers++; 6082 handlers++;
@@ -6065,10 +6088,10 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
6065 * If needed, send (a single) EventAck. 6088 * If needed, send (a single) EventAck.
6066 */ 6089 */
6067 if (pEventReply->AckRequired == MPI_EVENT_NOTIFICATION_ACK_REQUIRED) { 6090 if (pEventReply->AckRequired == MPI_EVENT_NOTIFICATION_ACK_REQUIRED) {
6068 devtprintk((MYIOC_s_WARN_FMT 6091 devtverboseprintk((MYIOC_s_WARN_FMT
6069 "EventAck required\n",ioc->name)); 6092 "EventAck required\n",ioc->name));
6070 if ((ii = SendEventAck(ioc, pEventReply)) != 0) { 6093 if ((ii = SendEventAck(ioc, pEventReply)) != 0) {
6071 devtprintk((MYIOC_s_WARN_FMT "SendEventAck returned %d\n", 6094 devtverboseprintk((MYIOC_s_WARN_FMT "SendEventAck returned %d\n",
6072 ioc->name, ii)); 6095 ioc->name, ii));
6073 } 6096 }
6074 } 6097 }
@@ -6205,8 +6228,8 @@ mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info)
6205 "Abort", /* 12h */ 6228 "Abort", /* 12h */
6206 "IO Not Yet Executed", /* 13h */ 6229 "IO Not Yet Executed", /* 13h */
6207 "IO Executed", /* 14h */ 6230 "IO Executed", /* 14h */
6208 NULL, /* 15h */ 6231 "Persistant Reservation Out Not Affiliation Owner", /* 15h */
6209 NULL, /* 16h */ 6232 "Open Transmit DMA Abort", /* 16h */
6210 NULL, /* 17h */ 6233 NULL, /* 17h */
6211 NULL, /* 18h */ 6234 NULL, /* 18h */
6212 NULL, /* 19h */ 6235 NULL, /* 19h */
@@ -6431,11 +6454,9 @@ EXPORT_SYMBOL(mpt_stm_index);
6431EXPORT_SYMBOL(mpt_HardResetHandler); 6454EXPORT_SYMBOL(mpt_HardResetHandler);
6432EXPORT_SYMBOL(mpt_config); 6455EXPORT_SYMBOL(mpt_config);
6433EXPORT_SYMBOL(mpt_findImVolumes); 6456EXPORT_SYMBOL(mpt_findImVolumes);
6434EXPORT_SYMBOL(mpt_read_ioc_pg_3);
6435EXPORT_SYMBOL(mpt_alloc_fw_memory); 6457EXPORT_SYMBOL(mpt_alloc_fw_memory);
6436EXPORT_SYMBOL(mpt_free_fw_memory); 6458EXPORT_SYMBOL(mpt_free_fw_memory);
6437EXPORT_SYMBOL(mptbase_sas_persist_operation); 6459EXPORT_SYMBOL(mptbase_sas_persist_operation);
6438EXPORT_SYMBOL(mpt_alt_ioc_wait);
6439EXPORT_SYMBOL(mptbase_GetFcPortPage0); 6460EXPORT_SYMBOL(mptbase_GetFcPortPage0);
6440 6461
6441 6462