aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptsas.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message/fusion/mptsas.c')
-rw-r--r--drivers/message/fusion/mptsas.c55
1 files changed, 38 insertions, 17 deletions
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 76687126b573..ac000e83db0e 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1894,7 +1894,7 @@ static struct scsi_host_template mptsas_driver_template = {
1894 .module = THIS_MODULE, 1894 .module = THIS_MODULE,
1895 .proc_name = "mptsas", 1895 .proc_name = "mptsas",
1896 .proc_info = mptscsih_proc_info, 1896 .proc_info = mptscsih_proc_info,
1897 .name = "MPT SPI Host", 1897 .name = "MPT SAS Host",
1898 .info = mptscsih_info, 1898 .info = mptscsih_info,
1899 .queuecommand = mptsas_qcmd, 1899 .queuecommand = mptsas_qcmd,
1900 .target_alloc = mptsas_target_alloc, 1900 .target_alloc = mptsas_target_alloc,
@@ -2038,11 +2038,13 @@ static int mptsas_phy_reset(struct sas_phy *phy, int hard_reset)
2038 2038
2039 timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 2039 timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done,
2040 10 * HZ); 2040 10 * HZ);
2041 if (!timeleft) { 2041 if (!(ioc->sas_mgmt.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
2042 /* On timeout reset the board */ 2042 error = -ETIME;
2043 mpt_free_msg_frame(ioc, mf); 2043 mpt_free_msg_frame(ioc, mf);
2044 mpt_HardResetHandler(ioc, CAN_SLEEP); 2044 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET)
2045 error = -ETIMEDOUT; 2045 goto out_unlock;
2046 if (!timeleft)
2047 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP);
2046 goto out_unlock; 2048 goto out_unlock;
2047 } 2049 }
2048 2050
@@ -2223,11 +2225,14 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
2223 mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf); 2225 mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf);
2224 2226
2225 timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 10 * HZ); 2227 timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 10 * HZ);
2226 if (!timeleft) { 2228 if (!(ioc->sas_mgmt.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
2227 printk(MYIOC_s_ERR_FMT "%s: smp timeout!\n", ioc->name, __func__); 2229 ret = -ETIME;
2228 /* On timeout reset the board */ 2230 mpt_free_msg_frame(ioc, mf);
2229 mpt_HardResetHandler(ioc, CAN_SLEEP); 2231 mf = NULL;
2230 ret = -ETIMEDOUT; 2232 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET)
2233 goto unmap;
2234 if (!timeleft)
2235 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP);
2231 goto unmap; 2236 goto unmap;
2232 } 2237 }
2233 mf = NULL; 2238 mf = NULL;
@@ -2518,6 +2523,12 @@ mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info,
2518 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; 2523 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
2519 2524
2520 error = mpt_config(ioc, &cfg); 2525 error = mpt_config(ioc, &cfg);
2526
2527 if (error == MPI_IOCSTATUS_CONFIG_INVALID_PAGE) {
2528 error = -ENODEV;
2529 goto out_free_consistent;
2530 }
2531
2521 if (error) 2532 if (error)
2522 goto out_free_consistent; 2533 goto out_free_consistent;
2523 2534
@@ -2594,14 +2605,14 @@ mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
2594 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; 2605 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
2595 2606
2596 error = mpt_config(ioc, &cfg); 2607 error = mpt_config(ioc, &cfg);
2597 if (error) 2608 if (error == MPI_IOCSTATUS_CONFIG_INVALID_PAGE) {
2598 goto out_free_consistent;
2599
2600 if (!buffer->NumPhys) {
2601 error = -ENODEV; 2609 error = -ENODEV;
2602 goto out_free_consistent; 2610 goto out_free_consistent;
2603 } 2611 }
2604 2612
2613 if (error)
2614 goto out_free_consistent;
2615
2605 /* save config data */ 2616 /* save config data */
2606 port_info->num_phys = (buffer->NumPhys) ? buffer->NumPhys : 1; 2617 port_info->num_phys = (buffer->NumPhys) ? buffer->NumPhys : 1;
2607 port_info->phy_info = kcalloc(port_info->num_phys, 2618 port_info->phy_info = kcalloc(port_info->num_phys,
@@ -2677,7 +2688,7 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
2677 2688
2678 if (error == MPI_IOCSTATUS_CONFIG_INVALID_PAGE) { 2689 if (error == MPI_IOCSTATUS_CONFIG_INVALID_PAGE) {
2679 error = -ENODEV; 2690 error = -ENODEV;
2680 goto out; 2691 goto out_free_consistent;
2681 } 2692 }
2682 2693
2683 if (error) 2694 if (error)
@@ -2833,7 +2844,7 @@ mptsas_exp_repmanufacture_info(MPT_ADAPTER *ioc,
2833 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET) 2844 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET)
2834 goto out_free; 2845 goto out_free;
2835 if (!timeleft) 2846 if (!timeleft)
2836 mpt_HardResetHandler(ioc, CAN_SLEEP); 2847 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP);
2837 goto out_free; 2848 goto out_free;
2838 } 2849 }
2839 2850
@@ -4098,6 +4109,7 @@ mptsas_adding_inactive_raid_components(MPT_ADAPTER *ioc, u8 channel, u8 id)
4098 cfg.pageAddr = (channel << 8) + id; 4109 cfg.pageAddr = (channel << 8) + id;
4099 cfg.cfghdr.hdr = &hdr; 4110 cfg.cfghdr.hdr = &hdr;
4100 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER; 4111 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
4112 cfg.timeout = SAS_CONFIG_PAGE_TIMEOUT;
4101 4113
4102 if (mpt_config(ioc, &cfg) != 0) 4114 if (mpt_config(ioc, &cfg) != 0)
4103 goto out; 4115 goto out;
@@ -4717,7 +4729,7 @@ mptsas_broadcast_primative_work(struct fw_event_work *fw_event)
4717 if (issue_reset) { 4729 if (issue_reset) {
4718 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n", 4730 printk(MYIOC_s_WARN_FMT "Issuing Reset from %s!!\n",
4719 ioc->name, __func__); 4731 ioc->name, __func__);
4720 mpt_HardResetHandler(ioc, CAN_SLEEP); 4732 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP);
4721 } 4733 }
4722 mptsas_free_fw_event(ioc, fw_event); 4734 mptsas_free_fw_event(ioc, fw_event);
4723} 4735}
@@ -4779,6 +4791,9 @@ mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply)
4779 struct fw_event_work *fw_event; 4791 struct fw_event_work *fw_event;
4780 unsigned long delay; 4792 unsigned long delay;
4781 4793
4794 if (ioc->bus_type != SAS)
4795 return 0;
4796
4782 /* events turned off due to host reset or driver unloading */ 4797 /* events turned off due to host reset or driver unloading */
4783 if (ioc->fw_events_off) 4798 if (ioc->fw_events_off)
4784 return 0; 4799 return 0;
@@ -5073,6 +5088,12 @@ static void __devexit mptsas_remove(struct pci_dev *pdev)
5073 struct mptsas_portinfo *p, *n; 5088 struct mptsas_portinfo *p, *n;
5074 int i; 5089 int i;
5075 5090
5091 if (!ioc->sh) {
5092 printk(MYIOC_s_INFO_FMT "IOC is in Target mode\n", ioc->name);
5093 mpt_detach(pdev);
5094 return;
5095 }
5096
5076 mptsas_shutdown(pdev); 5097 mptsas_shutdown(pdev);
5077 5098
5078 mptsas_del_device_components(ioc); 5099 mptsas_del_device_components(ioc);