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.c70
1 files changed, 66 insertions, 4 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 74022316fc63..4262a22adc22 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -91,9 +91,9 @@ static int mfcounter = 0;
91 * Public data... 91 * Public data...
92 */ 92 */
93int mpt_lan_index = -1; 93int mpt_lan_index = -1;
94static int mpt_stm_index = -1; 94int mpt_stm_index = -1;
95 95
96static struct proc_dir_entry *mpt_proc_root_dir; 96struct proc_dir_entry *mpt_proc_root_dir;
97 97
98#define WHOINIT_UNKNOWN 0xAA 98#define WHOINIT_UNKNOWN 0xAA
99 99
@@ -1118,6 +1118,65 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
1118 return -1; 1118 return -1;
1119} 1119}
1120 1120
1121int
1122mpt_alt_ioc_wait(MPT_ADAPTER *ioc)
1123{
1124 int loop_count = 30 * 4; /* Wait 30 seconds */
1125 int status = -1; /* -1 means failed to get board READY */
1126
1127 do {
1128 spin_lock(&ioc->initializing_hba_lock);
1129 if (ioc->initializing_hba_lock_flag == 0) {
1130 ioc->initializing_hba_lock_flag=1;
1131 spin_unlock(&ioc->initializing_hba_lock);
1132 status = 0;
1133 break;
1134 }
1135 spin_unlock(&ioc->initializing_hba_lock);
1136 set_current_state(TASK_INTERRUPTIBLE);
1137 schedule_timeout(HZ/4);
1138 } while (--loop_count);
1139
1140 return status;
1141}
1142
1143/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1144/*
1145 * mpt_bringup_adapter - This is a wrapper function for mpt_do_ioc_recovery
1146 * @ioc: Pointer to MPT adapter structure
1147 * @sleepFlag: Use schedule if CAN_SLEEP else use udelay.
1148 *
1149 * This routine performs all the steps necessary to bring the IOC
1150 * to a OPERATIONAL state.
1151 *
1152 * Special Note: This function was added with spin lock's so as to allow
1153 * the dv(domain validation) work thread to succeed on the other channel
1154 * that maybe occuring at the same time when this function is called.
1155 * Without this lock, the dv would fail when message frames were
1156 * requested during hba bringup on the alternate ioc.
1157 */
1158static int
1159mpt_bringup_adapter(MPT_ADAPTER *ioc, int sleepFlag)
1160{
1161 int r;
1162
1163 if(ioc->alt_ioc) {
1164 if((r=mpt_alt_ioc_wait(ioc->alt_ioc)!=0))
1165 return r;
1166 }
1167
1168 r = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP,
1169 CAN_SLEEP);
1170
1171 if(ioc->alt_ioc) {
1172 spin_lock(&ioc->alt_ioc->initializing_hba_lock);
1173 ioc->alt_ioc->initializing_hba_lock_flag=0;
1174 spin_unlock(&ioc->alt_ioc->initializing_hba_lock);
1175 }
1176
1177return r;
1178}
1179
1121/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1180/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
1122/* 1181/*
1123 * mpt_attach - Install a PCI intelligent MPT adapter. 1182 * mpt_attach - Install a PCI intelligent MPT adapter.
@@ -1186,6 +1245,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1186 ioc->pcidev = pdev; 1245 ioc->pcidev = pdev;
1187 ioc->diagPending = 0; 1246 ioc->diagPending = 0;
1188 spin_lock_init(&ioc->diagLock); 1247 spin_lock_init(&ioc->diagLock);
1248 spin_lock_init(&ioc->initializing_hba_lock);
1189 1249
1190 /* Initialize the event logging. 1250 /* Initialize the event logging.
1191 */ 1251 */
@@ -1408,8 +1468,7 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1408 */ 1468 */
1409 mpt_detect_bound_ports(ioc, pdev); 1469 mpt_detect_bound_ports(ioc, pdev);
1410 1470
1411 if ((r = mpt_do_ioc_recovery(ioc, 1471 if ((r = mpt_bringup_adapter(ioc, CAN_SLEEP)) != 0){
1412 MPT_HOSTEVENT_IOC_BRINGUP, CAN_SLEEP)) != 0) {
1413 printk(KERN_WARNING MYNAM 1472 printk(KERN_WARNING MYNAM
1414 ": WARNING - %s did not initialize properly! (%d)\n", 1473 ": WARNING - %s did not initialize properly! (%d)\n",
1415 ioc->name, r); 1474 ioc->name, r);
@@ -6271,6 +6330,7 @@ EXPORT_SYMBOL(mpt_resume);
6271EXPORT_SYMBOL(mpt_suspend); 6330EXPORT_SYMBOL(mpt_suspend);
6272#endif 6331#endif
6273EXPORT_SYMBOL(ioc_list); 6332EXPORT_SYMBOL(ioc_list);
6333EXPORT_SYMBOL(mpt_proc_root_dir);
6274EXPORT_SYMBOL(mpt_register); 6334EXPORT_SYMBOL(mpt_register);
6275EXPORT_SYMBOL(mpt_deregister); 6335EXPORT_SYMBOL(mpt_deregister);
6276EXPORT_SYMBOL(mpt_event_register); 6336EXPORT_SYMBOL(mpt_event_register);
@@ -6288,6 +6348,7 @@ EXPORT_SYMBOL(mpt_verify_adapter);
6288EXPORT_SYMBOL(mpt_GetIocState); 6348EXPORT_SYMBOL(mpt_GetIocState);
6289EXPORT_SYMBOL(mpt_print_ioc_summary); 6349EXPORT_SYMBOL(mpt_print_ioc_summary);
6290EXPORT_SYMBOL(mpt_lan_index); 6350EXPORT_SYMBOL(mpt_lan_index);
6351EXPORT_SYMBOL(mpt_stm_index);
6291EXPORT_SYMBOL(mpt_HardResetHandler); 6352EXPORT_SYMBOL(mpt_HardResetHandler);
6292EXPORT_SYMBOL(mpt_config); 6353EXPORT_SYMBOL(mpt_config);
6293EXPORT_SYMBOL(mpt_toolbox); 6354EXPORT_SYMBOL(mpt_toolbox);
@@ -6296,6 +6357,7 @@ EXPORT_SYMBOL(mpt_read_ioc_pg_3);
6296EXPORT_SYMBOL(mpt_alloc_fw_memory); 6357EXPORT_SYMBOL(mpt_alloc_fw_memory);
6297EXPORT_SYMBOL(mpt_free_fw_memory); 6358EXPORT_SYMBOL(mpt_free_fw_memory);
6298EXPORT_SYMBOL(mptbase_sas_persist_operation); 6359EXPORT_SYMBOL(mptbase_sas_persist_operation);
6360EXPORT_SYMBOL(mpt_alt_ioc_wait);
6299 6361
6300 6362
6301/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6363/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/