aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla4xxx
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla4xxx')
-rw-r--r--drivers/scsi/qla4xxx/ql4_dbg.c101
-rw-r--r--drivers/scsi/qla4xxx/ql4_def.h20
-rw-r--r--drivers/scsi/qla4xxx/ql4_fw.h3
-rw-r--r--drivers/scsi/qla4xxx/ql4_glbl.h1
-rw-r--r--drivers/scsi/qla4xxx/ql4_init.c10
-rw-r--r--drivers/scsi/qla4xxx/ql4_iocb.c10
-rw-r--r--drivers/scsi/qla4xxx/ql4_isr.c16
-rw-r--r--drivers/scsi/qla4xxx/ql4_mbx.c11
-rw-r--r--drivers/scsi/qla4xxx/ql4_nx.c89
-rw-r--r--drivers/scsi/qla4xxx/ql4_nx.h5
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c109
-rw-r--r--drivers/scsi/qla4xxx/ql4_version.h2
12 files changed, 251 insertions, 126 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_dbg.c b/drivers/scsi/qla4xxx/ql4_dbg.c
index cbceb0ebabf7..edcf048215dd 100644
--- a/drivers/scsi/qla4xxx/ql4_dbg.c
+++ b/drivers/scsi/qla4xxx/ql4_dbg.c
@@ -30,3 +30,104 @@ void qla4xxx_dump_buffer(void *b, uint32_t size)
30 printk(KERN_INFO "\n"); 30 printk(KERN_INFO "\n");
31} 31}
32 32
33void qla4xxx_dump_registers(struct scsi_qla_host *ha)
34{
35 uint8_t i;
36
37 if (is_qla8022(ha)) {
38 for (i = 1; i < MBOX_REG_COUNT; i++)
39 printk(KERN_INFO "mailbox[%d] = 0x%08X\n",
40 i, readl(&ha->qla4_8xxx_reg->mailbox_in[i]));
41 return;
42 }
43
44 for (i = 0; i < MBOX_REG_COUNT; i++) {
45 printk(KERN_INFO "0x%02X mailbox[%d] = 0x%08X\n",
46 (uint8_t) offsetof(struct isp_reg, mailbox[i]), i,
47 readw(&ha->reg->mailbox[i]));
48 }
49
50 printk(KERN_INFO "0x%02X flash_address = 0x%08X\n",
51 (uint8_t) offsetof(struct isp_reg, flash_address),
52 readw(&ha->reg->flash_address));
53 printk(KERN_INFO "0x%02X flash_data = 0x%08X\n",
54 (uint8_t) offsetof(struct isp_reg, flash_data),
55 readw(&ha->reg->flash_data));
56 printk(KERN_INFO "0x%02X ctrl_status = 0x%08X\n",
57 (uint8_t) offsetof(struct isp_reg, ctrl_status),
58 readw(&ha->reg->ctrl_status));
59
60 if (is_qla4010(ha)) {
61 printk(KERN_INFO "0x%02X nvram = 0x%08X\n",
62 (uint8_t) offsetof(struct isp_reg, u1.isp4010.nvram),
63 readw(&ha->reg->u1.isp4010.nvram));
64 } else if (is_qla4022(ha) | is_qla4032(ha)) {
65 printk(KERN_INFO "0x%02X intr_mask = 0x%08X\n",
66 (uint8_t) offsetof(struct isp_reg, u1.isp4022.intr_mask),
67 readw(&ha->reg->u1.isp4022.intr_mask));
68 printk(KERN_INFO "0x%02X nvram = 0x%08X\n",
69 (uint8_t) offsetof(struct isp_reg, u1.isp4022.nvram),
70 readw(&ha->reg->u1.isp4022.nvram));
71 printk(KERN_INFO "0x%02X semaphore = 0x%08X\n",
72 (uint8_t) offsetof(struct isp_reg, u1.isp4022.semaphore),
73 readw(&ha->reg->u1.isp4022.semaphore));
74 }
75 printk(KERN_INFO "0x%02X req_q_in = 0x%08X\n",
76 (uint8_t) offsetof(struct isp_reg, req_q_in),
77 readw(&ha->reg->req_q_in));
78 printk(KERN_INFO "0x%02X rsp_q_out = 0x%08X\n",
79 (uint8_t) offsetof(struct isp_reg, rsp_q_out),
80 readw(&ha->reg->rsp_q_out));
81
82 if (is_qla4010(ha)) {
83 printk(KERN_INFO "0x%02X ext_hw_conf = 0x%08X\n",
84 (uint8_t) offsetof(struct isp_reg, u2.isp4010.ext_hw_conf),
85 readw(&ha->reg->u2.isp4010.ext_hw_conf));
86 printk(KERN_INFO "0x%02X port_ctrl = 0x%08X\n",
87 (uint8_t) offsetof(struct isp_reg, u2.isp4010.port_ctrl),
88 readw(&ha->reg->u2.isp4010.port_ctrl));
89 printk(KERN_INFO "0x%02X port_status = 0x%08X\n",
90 (uint8_t) offsetof(struct isp_reg, u2.isp4010.port_status),
91 readw(&ha->reg->u2.isp4010.port_status));
92 printk(KERN_INFO "0x%02X req_q_out = 0x%08X\n",
93 (uint8_t) offsetof(struct isp_reg, u2.isp4010.req_q_out),
94 readw(&ha->reg->u2.isp4010.req_q_out));
95 printk(KERN_INFO "0x%02X gp_out = 0x%08X\n",
96 (uint8_t) offsetof(struct isp_reg, u2.isp4010.gp_out),
97 readw(&ha->reg->u2.isp4010.gp_out));
98 printk(KERN_INFO "0x%02X gp_in = 0x%08X\n",
99 (uint8_t) offsetof(struct isp_reg, u2.isp4010.gp_in),
100 readw(&ha->reg->u2.isp4010.gp_in));
101 printk(KERN_INFO "0x%02X port_err_status = 0x%08X\n", (uint8_t)
102 offsetof(struct isp_reg, u2.isp4010.port_err_status),
103 readw(&ha->reg->u2.isp4010.port_err_status));
104 } else if (is_qla4022(ha) | is_qla4032(ha)) {
105 printk(KERN_INFO "Page 0 Registers:\n");
106 printk(KERN_INFO "0x%02X ext_hw_conf = 0x%08X\n", (uint8_t)
107 offsetof(struct isp_reg, u2.isp4022.p0.ext_hw_conf),
108 readw(&ha->reg->u2.isp4022.p0.ext_hw_conf));
109 printk(KERN_INFO "0x%02X port_ctrl = 0x%08X\n", (uint8_t)
110 offsetof(struct isp_reg, u2.isp4022.p0.port_ctrl),
111 readw(&ha->reg->u2.isp4022.p0.port_ctrl));
112 printk(KERN_INFO "0x%02X port_status = 0x%08X\n", (uint8_t)
113 offsetof(struct isp_reg, u2.isp4022.p0.port_status),
114 readw(&ha->reg->u2.isp4022.p0.port_status));
115 printk(KERN_INFO "0x%02X gp_out = 0x%08X\n",
116 (uint8_t) offsetof(struct isp_reg, u2.isp4022.p0.gp_out),
117 readw(&ha->reg->u2.isp4022.p0.gp_out));
118 printk(KERN_INFO "0x%02X gp_in = 0x%08X\n",
119 (uint8_t) offsetof(struct isp_reg, u2.isp4022.p0.gp_in),
120 readw(&ha->reg->u2.isp4022.p0.gp_in));
121 printk(KERN_INFO "0x%02X port_err_status = 0x%08X\n", (uint8_t)
122 offsetof(struct isp_reg, u2.isp4022.p0.port_err_status),
123 readw(&ha->reg->u2.isp4022.p0.port_err_status));
124 printk(KERN_INFO "Page 1 Registers:\n");
125 writel(HOST_MEM_CFG_PAGE & set_rmask(CSR_SCSI_PAGE_SELECT),
126 &ha->reg->ctrl_status);
127 printk(KERN_INFO "0x%02X req_q_out = 0x%08X\n",
128 (uint8_t) offsetof(struct isp_reg, u2.isp4022.p1.req_q_out),
129 readw(&ha->reg->u2.isp4022.p1.req_q_out));
130 writel(PORT_CTRL_STAT_PAGE & set_rmask(CSR_SCSI_PAGE_SELECT),
131 &ha->reg->ctrl_status);
132 }
133}
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 9dc0a6616edd..0f3bfc3da5cf 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -24,6 +24,7 @@
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/mutex.h> 26#include <linux/mutex.h>
27#include <linux/aer.h>
27 28
28#include <net/tcp.h> 29#include <net/tcp.h>
29#include <scsi/scsi.h> 30#include <scsi/scsi.h>
@@ -36,24 +37,6 @@
36#include "ql4_dbg.h" 37#include "ql4_dbg.h"
37#include "ql4_nx.h" 38#include "ql4_nx.h"
38 39
39#if defined(CONFIG_PCIEAER)
40#include <linux/aer.h>
41#else
42/* AER releated */
43static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev)
44{
45 return -EINVAL;
46}
47static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev)
48{
49 return -EINVAL;
50}
51static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
52{
53 return -EINVAL;
54}
55#endif
56
57#ifndef PCI_DEVICE_ID_QLOGIC_ISP4010 40#ifndef PCI_DEVICE_ID_QLOGIC_ISP4010
58#define PCI_DEVICE_ID_QLOGIC_ISP4010 0x4010 41#define PCI_DEVICE_ID_QLOGIC_ISP4010 0x4010
59#endif 42#endif
@@ -179,6 +162,7 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
179#define IOCB_TOV_MARGIN 10 162#define IOCB_TOV_MARGIN 10
180#define RELOGIN_TOV 18 163#define RELOGIN_TOV 18
181#define ISNS_DEREG_TOV 5 164#define ISNS_DEREG_TOV 5
165#define HBA_ONLINE_TOV 30
182 166
183#define MAX_RESET_HA_RETRIES 2 167#define MAX_RESET_HA_RETRIES 2
184 168
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h
index 0336c6db8cb3..5e757d7fff7d 100644
--- a/drivers/scsi/qla4xxx/ql4_fw.h
+++ b/drivers/scsi/qla4xxx/ql4_fw.h
@@ -416,6 +416,8 @@ struct qla_flt_region {
416#define MBOX_ASTS_IPV6_ND_PREFIX_IGNORED 0x802C 416#define MBOX_ASTS_IPV6_ND_PREFIX_IGNORED 0x802C
417#define MBOX_ASTS_IPV6_LCL_PREFIX_IGNORED 0x802D 417#define MBOX_ASTS_IPV6_LCL_PREFIX_IGNORED 0x802D
418#define MBOX_ASTS_ICMPV6_ERROR_MSG_RCVD 0x802E 418#define MBOX_ASTS_ICMPV6_ERROR_MSG_RCVD 0x802E
419#define MBOX_ASTS_TXSCVR_INSERTED 0x8130
420#define MBOX_ASTS_TXSCVR_REMOVED 0x8131
419 421
420#define ISNS_EVENT_DATA_RECEIVED 0x0000 422#define ISNS_EVENT_DATA_RECEIVED 0x0000
421#define ISNS_EVENT_CONNECTION_OPENED 0x0001 423#define ISNS_EVENT_CONNECTION_OPENED 0x0001
@@ -446,6 +448,7 @@ struct addr_ctrl_blk {
446#define FWOPT_SESSION_MODE 0x0040 448#define FWOPT_SESSION_MODE 0x0040
447#define FWOPT_INITIATOR_MODE 0x0020 449#define FWOPT_INITIATOR_MODE 0x0020
448#define FWOPT_TARGET_MODE 0x0010 450#define FWOPT_TARGET_MODE 0x0010
451#define FWOPT_ENABLE_CRBDB 0x8000
449 452
450 uint16_t exec_throttle; /* 04-05 */ 453 uint16_t exec_throttle; /* 04-05 */
451 uint8_t zio_count; /* 06 */ 454 uint8_t zio_count; /* 06 */
diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h
index 95a26fb1626c..6575a47501e5 100644
--- a/drivers/scsi/qla4xxx/ql4_glbl.h
+++ b/drivers/scsi/qla4xxx/ql4_glbl.h
@@ -94,6 +94,7 @@ void qla4xxx_process_response_queue(struct scsi_qla_host *ha);
94void qla4xxx_wake_dpc(struct scsi_qla_host *ha); 94void qla4xxx_wake_dpc(struct scsi_qla_host *ha);
95void qla4xxx_get_conn_event_log(struct scsi_qla_host *ha); 95void qla4xxx_get_conn_event_log(struct scsi_qla_host *ha);
96void qla4xxx_mailbox_premature_completion(struct scsi_qla_host *ha); 96void qla4xxx_mailbox_premature_completion(struct scsi_qla_host *ha);
97void qla4xxx_dump_registers(struct scsi_qla_host *ha);
97 98
98void qla4_8xxx_pci_config(struct scsi_qla_host *); 99void qla4_8xxx_pci_config(struct scsi_qla_host *);
99int qla4_8xxx_iospace_config(struct scsi_qla_host *ha); 100int qla4_8xxx_iospace_config(struct scsi_qla_host *ha);
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 4c9be77ee70b..dc01fa3da5d1 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -1207,8 +1207,8 @@ static int qla4xxx_start_firmware_from_flash(struct scsi_qla_host *ha)
1207 break; 1207 break;
1208 1208
1209 DEBUG2(printk(KERN_INFO "scsi%ld: %s: Waiting for boot " 1209 DEBUG2(printk(KERN_INFO "scsi%ld: %s: Waiting for boot "
1210 "firmware to complete... ctrl_sts=0x%x\n", 1210 "firmware to complete... ctrl_sts=0x%x, remaining=%ld\n",
1211 ha->host_no, __func__, ctrl_status)); 1211 ha->host_no, __func__, ctrl_status, max_wait_time));
1212 1212
1213 msleep_interruptible(250); 1213 msleep_interruptible(250);
1214 } while (!time_after_eq(jiffies, max_wait_time)); 1214 } while (!time_after_eq(jiffies, max_wait_time));
@@ -1459,6 +1459,12 @@ int qla4xxx_initialize_adapter(struct scsi_qla_host *ha,
1459exit_init_online: 1459exit_init_online:
1460 set_bit(AF_ONLINE, &ha->flags); 1460 set_bit(AF_ONLINE, &ha->flags);
1461exit_init_hba: 1461exit_init_hba:
1462 if (is_qla8022(ha) && (status == QLA_ERROR)) {
1463 /* Since interrupts are registered in start_firmware for
1464 * 82xx, release them here if initialize_adapter fails */
1465 qla4xxx_free_irqs(ha);
1466 }
1467
1462 DEBUG2(printk("scsi%ld: initialize adapter: %s\n", ha->host_no, 1468 DEBUG2(printk("scsi%ld: initialize adapter: %s\n", ha->host_no,
1463 status == QLA_ERROR ? "FAILED" : "SUCCEDED")); 1469 status == QLA_ERROR ? "FAILED" : "SUCCEDED"));
1464 return status; 1470 return status;
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index 4ef9ba112ee8..5ae49fd87846 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -202,19 +202,11 @@ static void qla4xxx_build_scsi_iocbs(struct srb *srb,
202void qla4_8xxx_queue_iocb(struct scsi_qla_host *ha) 202void qla4_8xxx_queue_iocb(struct scsi_qla_host *ha)
203{ 203{
204 uint32_t dbval = 0; 204 uint32_t dbval = 0;
205 unsigned long wtime;
206 205
207 dbval = 0x14 | (ha->func_num << 5); 206 dbval = 0x14 | (ha->func_num << 5);
208 dbval = dbval | (0 << 8) | (ha->request_in << 16); 207 dbval = dbval | (0 << 8) | (ha->request_in << 16);
209 writel(dbval, (unsigned long __iomem *)ha->nx_db_wr_ptr);
210 wmb();
211 208
212 wtime = jiffies + (2 * HZ); 209 qla4_8xxx_wr_32(ha, ha->nx_db_wr_ptr, ha->request_in);
213 while (readl((void __iomem *)ha->nx_db_rd_ptr) != dbval &&
214 !time_after_eq(jiffies, wtime)) {
215 writel(dbval, (unsigned long __iomem *)ha->nx_db_wr_ptr);
216 wmb();
217 }
218} 210}
219 211
220/** 212/**
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 2a1ab63f3eb0..7c33fd5943d5 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -72,7 +72,7 @@ qla4xxx_status_cont_entry(struct scsi_qla_host *ha,
72{ 72{
73 struct srb *srb = ha->status_srb; 73 struct srb *srb = ha->status_srb;
74 struct scsi_cmnd *cmd; 74 struct scsi_cmnd *cmd;
75 uint8_t sense_len; 75 uint16_t sense_len;
76 76
77 if (srb == NULL) 77 if (srb == NULL)
78 return; 78 return;
@@ -487,6 +487,8 @@ static void qla4xxx_isr_decode_mailbox(struct scsi_qla_host * ha,
487 case MBOX_ASTS_SYSTEM_ERROR: 487 case MBOX_ASTS_SYSTEM_ERROR:
488 /* Log Mailbox registers */ 488 /* Log Mailbox registers */
489 ql4_printk(KERN_INFO, ha, "%s: System Err\n", __func__); 489 ql4_printk(KERN_INFO, ha, "%s: System Err\n", __func__);
490 qla4xxx_dump_registers(ha);
491
490 if (ql4xdontresethba) { 492 if (ql4xdontresethba) {
491 DEBUG2(printk("scsi%ld: %s:Don't Reset HBA\n", 493 DEBUG2(printk("scsi%ld: %s:Don't Reset HBA\n",
492 ha->host_no, __func__)); 494 ha->host_no, __func__));
@@ -621,6 +623,18 @@ static void qla4xxx_isr_decode_mailbox(struct scsi_qla_host * ha,
621 } 623 }
622 break; 624 break;
623 625
626 case MBOX_ASTS_TXSCVR_INSERTED:
627 DEBUG2(printk(KERN_WARNING
628 "scsi%ld: AEN %04x Transceiver"
629 " inserted\n", ha->host_no, mbox_sts[0]));
630 break;
631
632 case MBOX_ASTS_TXSCVR_REMOVED:
633 DEBUG2(printk(KERN_WARNING
634 "scsi%ld: AEN %04x Transceiver"
635 " removed\n", ha->host_no, mbox_sts[0]));
636 break;
637
624 default: 638 default:
625 DEBUG2(printk(KERN_WARNING 639 DEBUG2(printk(KERN_WARNING
626 "scsi%ld: AEN %04x UNKNOWN\n", 640 "scsi%ld: AEN %04x UNKNOWN\n",
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 90021704d8ca..2d2f9c879bfd 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -299,6 +299,10 @@ qla4xxx_set_ifcb(struct scsi_qla_host *ha, uint32_t *mbox_cmd,
299{ 299{
300 memset(mbox_cmd, 0, sizeof(mbox_cmd[0]) * MBOX_REG_COUNT); 300 memset(mbox_cmd, 0, sizeof(mbox_cmd[0]) * MBOX_REG_COUNT);
301 memset(mbox_sts, 0, sizeof(mbox_sts[0]) * MBOX_REG_COUNT); 301 memset(mbox_sts, 0, sizeof(mbox_sts[0]) * MBOX_REG_COUNT);
302
303 if (is_qla8022(ha))
304 qla4_8xxx_wr_32(ha, ha->nx_db_wr_ptr, 0);
305
302 mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE; 306 mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE;
303 mbox_cmd[1] = 0; 307 mbox_cmd[1] = 0;
304 mbox_cmd[2] = LSDW(init_fw_cb_dma); 308 mbox_cmd[2] = LSDW(init_fw_cb_dma);
@@ -472,6 +476,11 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
472 init_fw_cb->fw_options |= 476 init_fw_cb->fw_options |=
473 __constant_cpu_to_le16(FWOPT_SESSION_MODE | 477 __constant_cpu_to_le16(FWOPT_SESSION_MODE |
474 FWOPT_INITIATOR_MODE); 478 FWOPT_INITIATOR_MODE);
479
480 if (is_qla8022(ha))
481 init_fw_cb->fw_options |=
482 __constant_cpu_to_le16(FWOPT_ENABLE_CRBDB);
483
475 init_fw_cb->fw_options &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE); 484 init_fw_cb->fw_options &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE);
476 485
477 if (qla4xxx_set_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) 486 if (qla4xxx_set_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma)
@@ -592,7 +601,7 @@ int qla4xxx_get_firmware_status(struct scsi_qla_host * ha)
592 } 601 }
593 602
594 ql4_printk(KERN_INFO, ha, "%ld firmare IOCBs available (%d).\n", 603 ql4_printk(KERN_INFO, ha, "%ld firmare IOCBs available (%d).\n",
595 ha->host_no, mbox_cmd[2]); 604 ha->host_no, mbox_sts[2]);
596 605
597 return QLA_SUCCESS; 606 return QLA_SUCCESS;
598} 607}
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index 449256f2c5f8..474b10d71364 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -839,8 +839,11 @@ qla4_8xxx_rom_lock(struct scsi_qla_host *ha)
839 done = qla4_8xxx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_LOCK)); 839 done = qla4_8xxx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_LOCK));
840 if (done == 1) 840 if (done == 1)
841 break; 841 break;
842 if (timeout >= qla4_8xxx_rom_lock_timeout) 842 if (timeout >= qla4_8xxx_rom_lock_timeout) {
843 ql4_printk(KERN_WARNING, ha,
844 "%s: Failed to acquire rom lock", __func__);
843 return -1; 845 return -1;
846 }
844 847
845 timeout++; 848 timeout++;
846 849
@@ -1078,21 +1081,6 @@ qla4_8xxx_pinit_from_rom(struct scsi_qla_host *ha, int verbose)
1078 return 0; 1081 return 0;
1079} 1082}
1080 1083
1081static int qla4_8xxx_check_for_bad_spd(struct scsi_qla_host *ha)
1082{
1083 u32 val = 0;
1084 val = qla4_8xxx_rd_32(ha, BOOT_LOADER_DIMM_STATUS) ;
1085 val &= QLA82XX_BOOT_LOADER_MN_ISSUE;
1086 if (val & QLA82XX_PEG_TUNE_MN_SPD_ZEROED) {
1087 printk("Memory DIMM SPD not programmed. Assumed valid.\n");
1088 return 1;
1089 } else if (val) {
1090 printk("Memory DIMM type incorrect. Info:%08X.\n", val);
1091 return 2;
1092 }
1093 return 0;
1094}
1095
1096static int 1084static int
1097qla4_8xxx_load_from_flash(struct scsi_qla_host *ha, uint32_t image_start) 1085qla4_8xxx_load_from_flash(struct scsi_qla_host *ha, uint32_t image_start)
1098{ 1086{
@@ -1377,8 +1365,6 @@ static int qla4_8xxx_cmdpeg_ready(struct scsi_qla_host *ha, int pegtune_val)
1377 1365
1378 } while (--retries); 1366 } while (--retries);
1379 1367
1380 qla4_8xxx_check_for_bad_spd(ha);
1381
1382 if (!retries) { 1368 if (!retries) {
1383 pegtune_val = qla4_8xxx_rd_32(ha, 1369 pegtune_val = qla4_8xxx_rd_32(ha,
1384 QLA82XX_ROMUSB_GLB_PEGTUNE_DONE); 1370 QLA82XX_ROMUSB_GLB_PEGTUNE_DONE);
@@ -1540,14 +1526,31 @@ qla4_8xxx_try_start_fw(struct scsi_qla_host *ha)
1540 ql4_printk(KERN_INFO, ha, 1526 ql4_printk(KERN_INFO, ha,
1541 "FW: Attempting to load firmware from flash...\n"); 1527 "FW: Attempting to load firmware from flash...\n");
1542 rval = qla4_8xxx_start_firmware(ha, ha->hw.flt_region_fw); 1528 rval = qla4_8xxx_start_firmware(ha, ha->hw.flt_region_fw);
1543 if (rval == QLA_SUCCESS)
1544 return rval;
1545 1529
1546 ql4_printk(KERN_ERR, ha, "FW: Load firmware from flash FAILED...\n"); 1530 if (rval != QLA_SUCCESS) {
1531 ql4_printk(KERN_ERR, ha, "FW: Load firmware from flash"
1532 " FAILED...\n");
1533 return rval;
1534 }
1547 1535
1548 return rval; 1536 return rval;
1549} 1537}
1550 1538
1539static void qla4_8xxx_rom_lock_recovery(struct scsi_qla_host *ha)
1540{
1541 if (qla4_8xxx_rom_lock(ha)) {
1542 /* Someone else is holding the lock. */
1543 dev_info(&ha->pdev->dev, "Resetting rom_lock\n");
1544 }
1545
1546 /*
1547 * Either we got the lock, or someone
1548 * else died while holding it.
1549 * In either case, unlock.
1550 */
1551 qla4_8xxx_rom_unlock(ha);
1552}
1553
1551/** 1554/**
1552 * qla4_8xxx_device_bootstrap - Initialize device, set DEV_READY, start fw 1555 * qla4_8xxx_device_bootstrap - Initialize device, set DEV_READY, start fw
1553 * @ha: pointer to adapter structure 1556 * @ha: pointer to adapter structure
@@ -1557,11 +1560,12 @@ qla4_8xxx_try_start_fw(struct scsi_qla_host *ha)
1557static int 1560static int
1558qla4_8xxx_device_bootstrap(struct scsi_qla_host *ha) 1561qla4_8xxx_device_bootstrap(struct scsi_qla_host *ha)
1559{ 1562{
1560 int rval, i, timeout; 1563 int rval = QLA_ERROR;
1564 int i, timeout;
1561 uint32_t old_count, count; 1565 uint32_t old_count, count;
1566 int need_reset = 0, peg_stuck = 1;
1562 1567
1563 if (qla4_8xxx_need_reset(ha)) 1568 need_reset = qla4_8xxx_need_reset(ha);
1564 goto dev_initialize;
1565 1569
1566 old_count = qla4_8xxx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER); 1570 old_count = qla4_8xxx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER);
1567 1571
@@ -1570,12 +1574,30 @@ qla4_8xxx_device_bootstrap(struct scsi_qla_host *ha)
1570 if (timeout) { 1574 if (timeout) {
1571 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, 1575 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE,
1572 QLA82XX_DEV_FAILED); 1576 QLA82XX_DEV_FAILED);
1573 return QLA_ERROR; 1577 return rval;
1574 } 1578 }
1575 1579
1576 count = qla4_8xxx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER); 1580 count = qla4_8xxx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER);
1577 if (count != old_count) 1581 if (count != old_count)
1582 peg_stuck = 0;
1583 }
1584
1585 if (need_reset) {
1586 /* We are trying to perform a recovery here. */
1587 if (peg_stuck)
1588 qla4_8xxx_rom_lock_recovery(ha);
1589 goto dev_initialize;
1590 } else {
1591 /* Start of day for this ha context. */
1592 if (peg_stuck) {
1593 /* Either we are the first or recovery in progress. */
1594 qla4_8xxx_rom_lock_recovery(ha);
1595 goto dev_initialize;
1596 } else {
1597 /* Firmware already running. */
1598 rval = QLA_SUCCESS;
1578 goto dev_ready; 1599 goto dev_ready;
1600 }
1579 } 1601 }
1580 1602
1581dev_initialize: 1603dev_initialize:
@@ -1601,7 +1623,7 @@ dev_ready:
1601 ql4_printk(KERN_INFO, ha, "HW State: READY\n"); 1623 ql4_printk(KERN_INFO, ha, "HW State: READY\n");
1602 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_READY); 1624 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_READY);
1603 1625
1604 return QLA_SUCCESS; 1626 return rval;
1605} 1627}
1606 1628
1607/** 1629/**
@@ -1764,20 +1786,9 @@ int qla4_8xxx_load_risc(struct scsi_qla_host *ha)
1764 int retval; 1786 int retval;
1765 retval = qla4_8xxx_device_state_handler(ha); 1787 retval = qla4_8xxx_device_state_handler(ha);
1766 1788
1767 if (retval == QLA_SUCCESS && 1789 if (retval == QLA_SUCCESS && !test_bit(AF_INIT_DONE, &ha->flags))
1768 !test_bit(AF_INIT_DONE, &ha->flags)) {
1769 retval = qla4xxx_request_irqs(ha); 1790 retval = qla4xxx_request_irqs(ha);
1770 if (retval != QLA_SUCCESS) { 1791
1771 ql4_printk(KERN_WARNING, ha,
1772 "Failed to reserve interrupt %d already in use.\n",
1773 ha->pdev->irq);
1774 } else {
1775 set_bit(AF_IRQ_ATTACHED, &ha->flags);
1776 ha->host->irq = ha->pdev->irq;
1777 ql4_printk(KERN_INFO, ha, "%s: irq %d attached\n",
1778 __func__, ha->pdev->irq);
1779 }
1780 }
1781 return retval; 1792 return retval;
1782} 1793}
1783 1794
diff --git a/drivers/scsi/qla4xxx/ql4_nx.h b/drivers/scsi/qla4xxx/ql4_nx.h
index 931ad3f1e918..ff689bf53007 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.h
+++ b/drivers/scsi/qla4xxx/ql4_nx.h
@@ -24,7 +24,6 @@
24 24
25#define CRB_CMDPEG_STATE QLA82XX_REG(0x50) 25#define CRB_CMDPEG_STATE QLA82XX_REG(0x50)
26#define CRB_RCVPEG_STATE QLA82XX_REG(0x13c) 26#define CRB_RCVPEG_STATE QLA82XX_REG(0x13c)
27#define BOOT_LOADER_DIMM_STATUS QLA82XX_REG(0x54)
28#define CRB_DMA_SHIFT QLA82XX_REG(0xcc) 27#define CRB_DMA_SHIFT QLA82XX_REG(0xcc)
29 28
30#define QLA82XX_HW_H0_CH_HUB_ADR 0x05 29#define QLA82XX_HW_H0_CH_HUB_ADR 0x05
@@ -529,12 +528,12 @@
529# define QLA82XX_CAM_RAM_BASE (QLA82XX_CRB_CAM + 0x02000) 528# define QLA82XX_CAM_RAM_BASE (QLA82XX_CRB_CAM + 0x02000)
530# define QLA82XX_CAM_RAM(reg) (QLA82XX_CAM_RAM_BASE + (reg)) 529# define QLA82XX_CAM_RAM(reg) (QLA82XX_CAM_RAM_BASE + (reg))
531 530
532#define QLA82XX_PEG_TUNE_MN_SPD_ZEROED 0x80000000
533#define QLA82XX_BOOT_LOADER_MN_ISSUE 0xff00ffff
534#define QLA82XX_PORT_MODE_ADDR (QLA82XX_CAM_RAM(0x24)) 531#define QLA82XX_PORT_MODE_ADDR (QLA82XX_CAM_RAM(0x24))
535#define QLA82XX_PEG_HALT_STATUS1 (QLA82XX_CAM_RAM(0xa8)) 532#define QLA82XX_PEG_HALT_STATUS1 (QLA82XX_CAM_RAM(0xa8))
536#define QLA82XX_PEG_HALT_STATUS2 (QLA82XX_CAM_RAM(0xac)) 533#define QLA82XX_PEG_HALT_STATUS2 (QLA82XX_CAM_RAM(0xac))
537#define QLA82XX_PEG_ALIVE_COUNTER (QLA82XX_CAM_RAM(0xb0)) 534#define QLA82XX_PEG_ALIVE_COUNTER (QLA82XX_CAM_RAM(0xb0))
535#define QLA82XX_CAM_RAM_DB1 (QLA82XX_CAM_RAM(0x1b0))
536#define QLA82XX_CAM_RAM_DB2 (QLA82XX_CAM_RAM(0x1b4))
538 537
539#define HALT_STATUS_UNRECOVERABLE 0x80000000 538#define HALT_STATUS_UNRECOVERABLE 0x80000000
540#define HALT_STATUS_RECOVERABLE 0x40000000 539#define HALT_STATUS_RECOVERABLE 0x40000000
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 370d40ff1529..f4cd846abf6d 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -167,8 +167,6 @@ static void qla4xxx_recovery_timedout(struct iscsi_cls_session *session)
167 "of (%d) secs exhausted, marking device DEAD.\n", 167 "of (%d) secs exhausted, marking device DEAD.\n",
168 ha->host_no, __func__, ddb_entry->fw_ddb_index, 168 ha->host_no, __func__, ddb_entry->fw_ddb_index,
169 QL4_SESS_RECOVERY_TMO)); 169 QL4_SESS_RECOVERY_TMO));
170
171 qla4xxx_wake_dpc(ha);
172 } 170 }
173} 171}
174 172
@@ -573,10 +571,6 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha)
573 if (ha->nx_pcibase) 571 if (ha->nx_pcibase)
574 iounmap( 572 iounmap(
575 (struct device_reg_82xx __iomem *)ha->nx_pcibase); 573 (struct device_reg_82xx __iomem *)ha->nx_pcibase);
576
577 if (ha->nx_db_wr_ptr)
578 iounmap(
579 (struct device_reg_82xx __iomem *)ha->nx_db_wr_ptr);
580 } else if (ha->reg) 574 } else if (ha->reg)
581 iounmap(ha->reg); 575 iounmap(ha->reg);
582 pci_release_regions(ha->pdev); 576 pci_release_regions(ha->pdev);
@@ -692,7 +686,9 @@ static void qla4_8xxx_check_fw_alive(struct scsi_qla_host *ha)
692 qla4xxx_wake_dpc(ha); 686 qla4xxx_wake_dpc(ha);
693 qla4xxx_mailbox_premature_completion(ha); 687 qla4xxx_mailbox_premature_completion(ha);
694 } 688 }
695 } 689 } else
690 ha->seconds_since_last_heartbeat = 0;
691
696 ha->fw_heartbeat_counter = fw_heartbeat_counter; 692 ha->fw_heartbeat_counter = fw_heartbeat_counter;
697} 693}
698 694
@@ -885,7 +881,13 @@ static int qla4xxx_cmd_wait(struct scsi_qla_host *ha)
885 /* Find a command that hasn't completed. */ 881 /* Find a command that hasn't completed. */
886 for (index = 0; index < ha->host->can_queue; index++) { 882 for (index = 0; index < ha->host->can_queue; index++) {
887 cmd = scsi_host_find_tag(ha->host, index); 883 cmd = scsi_host_find_tag(ha->host, index);
888 if (cmd != NULL) 884 /*
885 * We cannot just check if the index is valid,
886 * becase if we are run from the scsi eh, then
887 * the scsi/block layer is going to prevent
888 * the tag from being released.
889 */
890 if (cmd != NULL && CMD_SP(cmd))
889 break; 891 break;
890 } 892 }
891 spin_unlock_irqrestore(&ha->hardware_lock, flags); 893 spin_unlock_irqrestore(&ha->hardware_lock, flags);
@@ -937,11 +939,14 @@ int qla4xxx_soft_reset(struct scsi_qla_host *ha)
937{ 939{
938 uint32_t max_wait_time; 940 uint32_t max_wait_time;
939 unsigned long flags = 0; 941 unsigned long flags = 0;
940 int status = QLA_ERROR; 942 int status;
941 uint32_t ctrl_status; 943 uint32_t ctrl_status;
942 944
943 qla4xxx_hw_reset(ha); 945 status = qla4xxx_hw_reset(ha);
946 if (status != QLA_SUCCESS)
947 return status;
944 948
949 status = QLA_ERROR;
945 /* Wait until the Network Reset Intr bit is cleared */ 950 /* Wait until the Network Reset Intr bit is cleared */
946 max_wait_time = RESET_INTR_TOV; 951 max_wait_time = RESET_INTR_TOV;
947 do { 952 do {
@@ -1101,7 +1106,8 @@ static int qla4xxx_recover_adapter(struct scsi_qla_host *ha)
1101 ha->host_no, __func__)); 1106 ha->host_no, __func__));
1102 status = ha->isp_ops->reset_firmware(ha); 1107 status = ha->isp_ops->reset_firmware(ha);
1103 if (status == QLA_SUCCESS) { 1108 if (status == QLA_SUCCESS) {
1104 qla4xxx_cmd_wait(ha); 1109 if (!test_bit(AF_FW_RECOVERY, &ha->flags))
1110 qla4xxx_cmd_wait(ha);
1105 ha->isp_ops->disable_intrs(ha); 1111 ha->isp_ops->disable_intrs(ha);
1106 qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS); 1112 qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS);
1107 qla4xxx_abort_active_cmds(ha, DID_RESET << 16); 1113 qla4xxx_abort_active_cmds(ha, DID_RESET << 16);
@@ -1118,7 +1124,8 @@ static int qla4xxx_recover_adapter(struct scsi_qla_host *ha)
1118 * or if stop_firmware fails for ISP-82xx. 1124 * or if stop_firmware fails for ISP-82xx.
1119 * This is the default case for ISP-4xxx */ 1125 * This is the default case for ISP-4xxx */
1120 if (!is_qla8022(ha) || reset_chip) { 1126 if (!is_qla8022(ha) || reset_chip) {
1121 qla4xxx_cmd_wait(ha); 1127 if (!test_bit(AF_FW_RECOVERY, &ha->flags))
1128 qla4xxx_cmd_wait(ha);
1122 qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS); 1129 qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS);
1123 qla4xxx_abort_active_cmds(ha, DID_RESET << 16); 1130 qla4xxx_abort_active_cmds(ha, DID_RESET << 16);
1124 DEBUG2(ql4_printk(KERN_INFO, ha, 1131 DEBUG2(ql4_printk(KERN_INFO, ha,
@@ -1471,24 +1478,10 @@ int qla4_8xxx_iospace_config(struct scsi_qla_host *ha)
1471 db_base = pci_resource_start(pdev, 4); /* doorbell is on bar 4 */ 1478 db_base = pci_resource_start(pdev, 4); /* doorbell is on bar 4 */
1472 db_len = pci_resource_len(pdev, 4); 1479 db_len = pci_resource_len(pdev, 4);
1473 1480
1474 /* mapping of doorbell write pointer */ 1481 ha->nx_db_wr_ptr = (ha->pdev->devfn == 4 ? QLA82XX_CAM_RAM_DB1 :
1475 ha->nx_db_wr_ptr = (unsigned long)ioremap(db_base + 1482 QLA82XX_CAM_RAM_DB2);
1476 (ha->pdev->devfn << 12), 4);
1477 if (!ha->nx_db_wr_ptr) {
1478 printk(KERN_ERR
1479 "cannot remap MMIO doorbell-write (%s), aborting\n",
1480 pci_name(pdev));
1481 goto iospace_error_exit;
1482 }
1483 /* mapping of doorbell read pointer */
1484 ha->nx_db_rd_ptr = (uint8_t *) ha->nx_pcibase + (512 * 1024) +
1485 (ha->pdev->devfn * 8);
1486 if (!ha->nx_db_rd_ptr)
1487 printk(KERN_ERR
1488 "cannot remap MMIO doorbell-read (%s), aborting\n",
1489 pci_name(pdev));
1490 return 0;
1491 1483
1484 return 0;
1492iospace_error_exit: 1485iospace_error_exit:
1493 return -ENOMEM; 1486 return -ENOMEM;
1494} 1487}
@@ -1960,13 +1953,11 @@ static int qla4xxx_wait_for_hba_online(struct scsi_qla_host *ha)
1960{ 1953{
1961 unsigned long wait_online; 1954 unsigned long wait_online;
1962 1955
1963 wait_online = jiffies + (30 * HZ); 1956 wait_online = jiffies + (HBA_ONLINE_TOV * HZ);
1964 while (time_before(jiffies, wait_online)) { 1957 while (time_before(jiffies, wait_online)) {
1965 1958
1966 if (adapter_up(ha)) 1959 if (adapter_up(ha))
1967 return QLA_SUCCESS; 1960 return QLA_SUCCESS;
1968 else if (ha->retry_reset_ha_cnt == 0)
1969 return QLA_ERROR;
1970 1961
1971 msleep(2000); 1962 msleep(2000);
1972 } 1963 }
@@ -2021,6 +2012,7 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd)
2021 unsigned int id = cmd->device->id; 2012 unsigned int id = cmd->device->id;
2022 unsigned int lun = cmd->device->lun; 2013 unsigned int lun = cmd->device->lun;
2023 unsigned long serial = cmd->serial_number; 2014 unsigned long serial = cmd->serial_number;
2015 unsigned long flags;
2024 struct srb *srb = NULL; 2016 struct srb *srb = NULL;
2025 int ret = SUCCESS; 2017 int ret = SUCCESS;
2026 int wait = 0; 2018 int wait = 0;
@@ -2029,12 +2021,14 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd)
2029 "scsi%ld:%d:%d: Abort command issued cmd=%p, pid=%ld\n", 2021 "scsi%ld:%d:%d: Abort command issued cmd=%p, pid=%ld\n",
2030 ha->host_no, id, lun, cmd, serial); 2022 ha->host_no, id, lun, cmd, serial);
2031 2023
2024 spin_lock_irqsave(&ha->hardware_lock, flags);
2032 srb = (struct srb *) CMD_SP(cmd); 2025 srb = (struct srb *) CMD_SP(cmd);
2033 2026 if (!srb) {
2034 if (!srb) 2027 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2035 return SUCCESS; 2028 return SUCCESS;
2036 2029 }
2037 kref_get(&srb->srb_ref); 2030 kref_get(&srb->srb_ref);
2031 spin_unlock_irqrestore(&ha->hardware_lock, flags);
2038 2032
2039 if (qla4xxx_abort_task(ha, srb) != QLA_SUCCESS) { 2033 if (qla4xxx_abort_task(ha, srb) != QLA_SUCCESS) {
2040 DEBUG3(printk("scsi%ld:%d:%d: Abort_task mbx failed.\n", 2034 DEBUG3(printk("scsi%ld:%d:%d: Abort_task mbx failed.\n",
@@ -2267,6 +2261,8 @@ qla4xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
2267 qla4xxx_mailbox_premature_completion(ha); 2261 qla4xxx_mailbox_premature_completion(ha);
2268 qla4xxx_free_irqs(ha); 2262 qla4xxx_free_irqs(ha);
2269 pci_disable_device(pdev); 2263 pci_disable_device(pdev);
2264 /* Return back all IOs */
2265 qla4xxx_abort_active_cmds(ha, DID_RESET << 16);
2270 return PCI_ERS_RESULT_NEED_RESET; 2266 return PCI_ERS_RESULT_NEED_RESET;
2271 case pci_channel_io_perm_failure: 2267 case pci_channel_io_perm_failure:
2272 set_bit(AF_EEH_BUSY, &ha->flags); 2268 set_bit(AF_EEH_BUSY, &ha->flags);
@@ -2290,17 +2286,13 @@ qla4xxx_pci_mmio_enabled(struct pci_dev *pdev)
2290 if (!is_aer_supported(ha)) 2286 if (!is_aer_supported(ha))
2291 return PCI_ERS_RESULT_NONE; 2287 return PCI_ERS_RESULT_NONE;
2292 2288
2293 if (test_bit(AF_FW_RECOVERY, &ha->flags)) { 2289 return PCI_ERS_RESULT_RECOVERED;
2294 ql4_printk(KERN_WARNING, ha, "scsi%ld: %s: firmware hang -- "
2295 "mmio_enabled\n", ha->host_no, __func__);
2296 return PCI_ERS_RESULT_NEED_RESET;
2297 } else
2298 return PCI_ERS_RESULT_RECOVERED;
2299} 2290}
2300 2291
2301uint32_t qla4_8xxx_error_recovery(struct scsi_qla_host *ha) 2292static uint32_t qla4_8xxx_error_recovery(struct scsi_qla_host *ha)
2302{ 2293{
2303 uint32_t rval = QLA_ERROR; 2294 uint32_t rval = QLA_ERROR;
2295 uint32_t ret = 0;
2304 int fn; 2296 int fn;
2305 struct pci_dev *other_pdev = NULL; 2297 struct pci_dev *other_pdev = NULL;
2306 2298
@@ -2312,7 +2304,6 @@ uint32_t qla4_8xxx_error_recovery(struct scsi_qla_host *ha)
2312 clear_bit(AF_ONLINE, &ha->flags); 2304 clear_bit(AF_ONLINE, &ha->flags);
2313 qla4xxx_mark_all_devices_missing(ha); 2305 qla4xxx_mark_all_devices_missing(ha);
2314 qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS); 2306 qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS);
2315 qla4xxx_abort_active_cmds(ha, DID_RESET << 16);
2316 } 2307 }
2317 2308
2318 fn = PCI_FUNC(ha->pdev->devfn); 2309 fn = PCI_FUNC(ha->pdev->devfn);
@@ -2375,7 +2366,16 @@ uint32_t qla4_8xxx_error_recovery(struct scsi_qla_host *ha)
2375 /* Clear driver state register */ 2366 /* Clear driver state register */
2376 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DRV_STATE, 0); 2367 qla4_8xxx_wr_32(ha, QLA82XX_CRB_DRV_STATE, 0);
2377 qla4_8xxx_set_drv_active(ha); 2368 qla4_8xxx_set_drv_active(ha);
2378 ha->isp_ops->enable_intrs(ha); 2369 ret = qla4xxx_request_irqs(ha);
2370 if (ret) {
2371 ql4_printk(KERN_WARNING, ha, "Failed to "
2372 "reserve interrupt %d already in use.\n",
2373 ha->pdev->irq);
2374 rval = QLA_ERROR;
2375 } else {
2376 ha->isp_ops->enable_intrs(ha);
2377 rval = QLA_SUCCESS;
2378 }
2379 } 2379 }
2380 qla4_8xxx_idc_unlock(ha); 2380 qla4_8xxx_idc_unlock(ha);
2381 } else { 2381 } else {
@@ -2387,8 +2387,18 @@ uint32_t qla4_8xxx_error_recovery(struct scsi_qla_host *ha)
2387 clear_bit(AF_FW_RECOVERY, &ha->flags); 2387 clear_bit(AF_FW_RECOVERY, &ha->flags);
2388 rval = qla4xxx_initialize_adapter(ha, 2388 rval = qla4xxx_initialize_adapter(ha,
2389 PRESERVE_DDB_LIST); 2389 PRESERVE_DDB_LIST);
2390 if (rval == QLA_SUCCESS) 2390 if (rval == QLA_SUCCESS) {
2391 ha->isp_ops->enable_intrs(ha); 2391 ret = qla4xxx_request_irqs(ha);
2392 if (ret) {
2393 ql4_printk(KERN_WARNING, ha, "Failed to"
2394 " reserve interrupt %d already in"
2395 " use.\n", ha->pdev->irq);
2396 rval = QLA_ERROR;
2397 } else {
2398 ha->isp_ops->enable_intrs(ha);
2399 rval = QLA_SUCCESS;
2400 }
2401 }
2392 qla4_8xxx_idc_lock(ha); 2402 qla4_8xxx_idc_lock(ha);
2393 qla4_8xxx_set_drv_active(ha); 2403 qla4_8xxx_set_drv_active(ha);
2394 qla4_8xxx_idc_unlock(ha); 2404 qla4_8xxx_idc_unlock(ha);
@@ -2430,12 +2440,7 @@ qla4xxx_pci_slot_reset(struct pci_dev *pdev)
2430 goto exit_slot_reset; 2440 goto exit_slot_reset;
2431 } 2441 }
2432 2442
2433 ret = qla4xxx_request_irqs(ha); 2443 ha->isp_ops->disable_intrs(ha);
2434 if (ret) {
2435 ql4_printk(KERN_WARNING, ha, "Failed to reserve interrupt %d"
2436 " already in use.\n", pdev->irq);
2437 goto exit_slot_reset;
2438 }
2439 2444
2440 if (is_qla8022(ha)) { 2445 if (is_qla8022(ha)) {
2441 if (qla4_8xxx_error_recovery(ha) == QLA_SUCCESS) { 2446 if (qla4_8xxx_error_recovery(ha) == QLA_SUCCESS) {
diff --git a/drivers/scsi/qla4xxx/ql4_version.h b/drivers/scsi/qla4xxx/ql4_version.h
index a77b973f2cbc..9bfacf4ed137 100644
--- a/drivers/scsi/qla4xxx/ql4_version.h
+++ b/drivers/scsi/qla4xxx/ql4_version.h
@@ -5,4 +5,4 @@
5 * See LICENSE.qla4xxx for copyright and licensing details. 5 * See LICENSE.qla4xxx for copyright and licensing details.
6 */ 6 */
7 7
8#define QLA4XXX_DRIVER_VERSION "5.02.00-k3" 8#define QLA4XXX_DRIVER_VERSION "5.02.00-k4"