aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_os.c
diff options
context:
space:
mode:
authorAndrew Vasquez <andrew.vasquez@qlogic.com>2008-01-31 15:33:46 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-02-07 19:02:38 -0500
commitdf4bf0bb5b077545031e8ad5ef3cc0dd8a5fbe05 (patch)
treeda275b2c498c7e85fbfb634aa7a95032e8583828 /drivers/scsi/qla2xxx/qla_os.c
parent61623fc34f9db7f01b672d2fa443d3d492049bbe (diff)
[SCSI] qla2xxx: Cleanup any outstanding SRB resources during shutdown.
Refactor SRB-failure completion codes in the process. Also, signal the DPC routine to complete sooner as backend processing at shutdown-time is superflous. [jejb: resolve conflicts with pci_enable_device_bars removal] Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 5942712799fe..3869e4d174c6 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1117,6 +1117,27 @@ qla2x00_device_reset(scsi_qla_host_t *ha, fc_port_t *reset_fcport)
1117 return ha->isp_ops->abort_target(reset_fcport); 1117 return ha->isp_ops->abort_target(reset_fcport);
1118} 1118}
1119 1119
1120void
1121qla2x00_abort_all_cmds(scsi_qla_host_t *ha, int res)
1122{
1123 int cnt;
1124 unsigned long flags;
1125 srb_t *sp;
1126
1127 spin_lock_irqsave(&ha->hardware_lock, flags);
1128 for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
1129 sp = ha->outstanding_cmds[cnt];
1130 if (sp) {
1131 ha->outstanding_cmds[cnt] = NULL;
1132 sp->flags = 0;
1133 sp->cmd->result = res;
1134 sp->cmd->host_scribble = (unsigned char *)NULL;
1135 qla2x00_sp_compl(ha, sp);
1136 }
1137 }
1138 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1139}
1140
1120static int 1141static int
1121qla2xxx_slave_alloc(struct scsi_device *sdev) 1142qla2xxx_slave_alloc(struct scsi_device *sdev)
1122{ 1143{
@@ -1608,6 +1629,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1608 ha->parent = NULL; 1629 ha->parent = NULL;
1609 ha->bars = bars; 1630 ha->bars = bars;
1610 ha->mem_only = mem_only; 1631 ha->mem_only = mem_only;
1632 spin_lock_init(&ha->hardware_lock);
1611 1633
1612 /* Set ISP-type information. */ 1634 /* Set ISP-type information. */
1613 qla2x00_set_isp_flags(ha); 1635 qla2x00_set_isp_flags(ha);
@@ -1621,8 +1643,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1621 "Found an ISP%04X, irq %d, iobase 0x%p\n", pdev->device, pdev->irq, 1643 "Found an ISP%04X, irq %d, iobase 0x%p\n", pdev->device, pdev->irq,
1622 ha->iobase); 1644 ha->iobase);
1623 1645
1624 spin_lock_init(&ha->hardware_lock);
1625
1626 ha->prev_topology = 0; 1646 ha->prev_topology = 0;
1627 ha->init_cb_size = sizeof(init_cb_t); 1647 ha->init_cb_size = sizeof(init_cb_t);
1628 ha->mgmt_svr_loop_id = MANAGEMENT_SERVER + ha->vp_idx; 1648 ha->mgmt_svr_loop_id = MANAGEMENT_SERVER + ha->vp_idx;
@@ -1848,10 +1868,14 @@ qla2x00_remove_one(struct pci_dev *pdev)
1848static void 1868static void
1849qla2x00_free_device(scsi_qla_host_t *ha) 1869qla2x00_free_device(scsi_qla_host_t *ha)
1850{ 1870{
1871 qla2x00_abort_all_cmds(ha, DID_NO_CONNECT << 16);
1872
1851 /* Disable timer */ 1873 /* Disable timer */
1852 if (ha->timer_active) 1874 if (ha->timer_active)
1853 qla2x00_stop_timer(ha); 1875 qla2x00_stop_timer(ha);
1854 1876
1877 ha->flags.online = 0;
1878
1855 /* Kill the kernel thread for this host */ 1879 /* Kill the kernel thread for this host */
1856 if (ha->dpc_thread) { 1880 if (ha->dpc_thread) {
1857 struct task_struct *t = ha->dpc_thread; 1881 struct task_struct *t = ha->dpc_thread;
@@ -1870,8 +1894,6 @@ qla2x00_free_device(scsi_qla_host_t *ha)
1870 if (ha->eft) 1894 if (ha->eft)
1871 qla2x00_disable_eft_trace(ha); 1895 qla2x00_disable_eft_trace(ha);
1872 1896
1873 ha->flags.online = 0;
1874
1875 /* Stop currently executing firmware. */ 1897 /* Stop currently executing firmware. */
1876 qla2x00_try_to_stop_firmware(ha); 1898 qla2x00_try_to_stop_firmware(ha);
1877 1899