aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c8
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c44
-rw-r--r--drivers/scsi/qla2xxx/qla_mid.c5
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c22
6 files changed, 16 insertions, 69 deletions
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index d0b78af60f7b..144f6d04f3d1 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2413,9 +2413,9 @@ typedef struct scsi_qla_host {
2413#define MBX_INTR_WAIT 2 2413#define MBX_INTR_WAIT 2
2414#define MBX_UPDATE_FLASH_ACTIVE 3 2414#define MBX_UPDATE_FLASH_ACTIVE 3
2415 2415
2416 struct semaphore mbx_cmd_sem; /* Serialialize mbx access */
2417 struct semaphore vport_sem; /* Virtual port synchronization */ 2416 struct semaphore vport_sem; /* Virtual port synchronization */
2418 struct semaphore mbx_intr_sem; /* Used for completion notification */ 2417 struct completion mbx_cmd_comp; /* Serialize mbx access */
2418 struct completion mbx_intr_comp; /* Used for completion notification */
2419 2419
2420 uint32_t mbx_flags; 2420 uint32_t mbx_flags;
2421#define MBX_IN_PROGRESS BIT_0 2421#define MBX_IN_PROGRESS BIT_0
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index f6917b94701e..fa4455f48f1d 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -105,8 +105,6 @@ extern char *qla2x00_get_fw_version_str(struct scsi_qla_host *, char *);
105extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int); 105extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int);
106extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *, int); 106extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *, int);
107 107
108extern int qla2x00_down_timeout(struct semaphore *, unsigned long);
109
110extern struct fw_blob *qla2x00_request_firmware(scsi_qla_host_t *); 108extern struct fw_blob *qla2x00_request_firmware(scsi_qla_host_t *);
111 109
112extern int qla2x00_wait_for_hba_online(scsi_qla_host_t *); 110extern int qla2x00_wait_for_hba_online(scsi_qla_host_t *);
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 22216fe76059..642a0c3f09c6 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -104,7 +104,7 @@ qla2100_intr_handler(int irq, void *dev_id)
104 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && 104 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
105 (status & MBX_INTERRUPT) && ha->flags.mbox_int) { 105 (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
106 set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); 106 set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
107 up(&ha->mbx_intr_sem); 107 complete(&ha->mbx_intr_comp);
108 } 108 }
109 109
110 return (IRQ_HANDLED); 110 return (IRQ_HANDLED);
@@ -216,7 +216,7 @@ qla2300_intr_handler(int irq, void *dev_id)
216 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && 216 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
217 (status & MBX_INTERRUPT) && ha->flags.mbox_int) { 217 (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
218 set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); 218 set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
219 up(&ha->mbx_intr_sem); 219 complete(&ha->mbx_intr_comp);
220 } 220 }
221 221
222 return (IRQ_HANDLED); 222 return (IRQ_HANDLED);
@@ -1597,7 +1597,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
1597 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && 1597 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
1598 (status & MBX_INTERRUPT) && ha->flags.mbox_int) { 1598 (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
1599 set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); 1599 set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
1600 up(&ha->mbx_intr_sem); 1600 complete(&ha->mbx_intr_comp);
1601 } 1601 }
1602 1602
1603 return IRQ_HANDLED; 1603 return IRQ_HANDLED;
@@ -1734,7 +1734,7 @@ qla24xx_msix_default(int irq, void *dev_id)
1734 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) && 1734 if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
1735 (status & MBX_INTERRUPT) && ha->flags.mbox_int) { 1735 (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
1736 set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags); 1736 set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
1737 up(&ha->mbx_intr_sem); 1737 complete(&ha->mbx_intr_comp);
1738 } 1738 }
1739 1739
1740 return IRQ_HANDLED; 1740 return IRQ_HANDLED;
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 0fc165288f88..d23d6fcfb225 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -8,19 +8,6 @@
8 8
9#include <linux/delay.h> 9#include <linux/delay.h>
10 10
11static void
12qla2x00_mbx_sem_timeout(unsigned long data)
13{
14 struct semaphore *sem_ptr = (struct semaphore *)data;
15
16 DEBUG11(printk("qla2x00_sem_timeout: entered.\n"));
17
18 if (sem_ptr != NULL) {
19 up(sem_ptr);
20 }
21
22 DEBUG11(printk("qla2x00_mbx_sem_timeout: exiting.\n"));
23}
24 11
25/* 12/*
26 * qla2x00_mailbox_command 13 * qla2x00_mailbox_command
@@ -47,7 +34,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
47 int rval; 34 int rval;
48 unsigned long flags = 0; 35 unsigned long flags = 0;
49 device_reg_t __iomem *reg; 36 device_reg_t __iomem *reg;
50 struct timer_list tmp_intr_timer;
51 uint8_t abort_active; 37 uint8_t abort_active;
52 uint8_t io_lock_on; 38 uint8_t io_lock_on;
53 uint16_t command; 39 uint16_t command;
@@ -72,7 +58,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
72 * non ISP abort time. 58 * non ISP abort time.
73 */ 59 */
74 if (!abort_active) { 60 if (!abort_active) {
75 if (qla2x00_down_timeout(&ha->mbx_cmd_sem, mcp->tov * HZ)) { 61 if (!wait_for_completion_timeout(&ha->mbx_cmd_comp,
62 mcp->tov * HZ)) {
76 /* Timeout occurred. Return error. */ 63 /* Timeout occurred. Return error. */
77 DEBUG2_3_11(printk("%s(%ld): cmd access timeout. " 64 DEBUG2_3_11(printk("%s(%ld): cmd access timeout. "
78 "Exiting.\n", __func__, ha->host_no)); 65 "Exiting.\n", __func__, ha->host_no));
@@ -135,22 +122,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
135 /* Wait for mbx cmd completion until timeout */ 122 /* Wait for mbx cmd completion until timeout */
136 123
137 if (!abort_active && io_lock_on) { 124 if (!abort_active && io_lock_on) {
138 /* sleep on completion semaphore */
139 DEBUG11(printk("%s(%ld): INTERRUPT MODE. Initializing timer.\n",
140 __func__, ha->host_no));
141
142 init_timer(&tmp_intr_timer);
143 tmp_intr_timer.data = (unsigned long)&ha->mbx_intr_sem;
144 tmp_intr_timer.expires = jiffies + mcp->tov * HZ;
145 tmp_intr_timer.function =
146 (void (*)(unsigned long))qla2x00_mbx_sem_timeout;
147
148 DEBUG11(printk("%s(%ld): Adding timer.\n", __func__,
149 ha->host_no));
150 add_timer(&tmp_intr_timer);
151
152 DEBUG11(printk("%s(%ld): going to unlock & sleep. "
153 "time=0x%lx.\n", __func__, ha->host_no, jiffies));
154 125
155 set_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); 126 set_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
156 127
@@ -160,17 +131,10 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
160 WRT_REG_WORD(&reg->isp.hccr, HCCR_SET_HOST_INT); 131 WRT_REG_WORD(&reg->isp.hccr, HCCR_SET_HOST_INT);
161 spin_unlock_irqrestore(&ha->hardware_lock, flags); 132 spin_unlock_irqrestore(&ha->hardware_lock, flags);
162 133
163 /* Wait for either the timer to expire 134 wait_for_completion_timeout(&ha->mbx_intr_comp, mcp->tov * HZ);
164 * or the mbox completion interrupt
165 */
166 down(&ha->mbx_intr_sem);
167 135
168 DEBUG11(printk("%s(%ld): waking up. time=0x%lx\n", __func__,
169 ha->host_no, jiffies));
170 clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); 136 clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
171 137
172 /* delete the timer */
173 del_timer(&tmp_intr_timer);
174 } else { 138 } else {
175 DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__, 139 DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__,
176 ha->host_no, command)); 140 ha->host_no, command));
@@ -299,7 +263,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
299 263
300 /* Allow next mbx cmd to come in. */ 264 /* Allow next mbx cmd to come in. */
301 if (!abort_active) 265 if (!abort_active)
302 up(&ha->mbx_cmd_sem); 266 complete(&ha->mbx_cmd_comp);
303 267
304 if (rval) { 268 if (rval) {
305 DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, " 269 DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, "
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index 74096aaa693c..325bdab11903 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -403,8 +403,9 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
403 } 403 }
404 vha->mgmt_svr_loop_id = 10 + vha->vp_idx; 404 vha->mgmt_svr_loop_id = 10 + vha->vp_idx;
405 405
406 init_MUTEX(&vha->mbx_cmd_sem); 406 init_completion(&vha->mbx_cmd_comp);
407 init_MUTEX_LOCKED(&vha->mbx_intr_sem); 407 complete(&vha->mbx_cmd_comp);
408 init_completion(&vha->mbx_intr_comp);
408 409
409 INIT_LIST_HEAD(&vha->list); 410 INIT_LIST_HEAD(&vha->list);
410 INIT_LIST_HEAD(&vha->fcports); 411 INIT_LIST_HEAD(&vha->fcports);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 0a414c0dd580..b9ee56567940 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1692,9 +1692,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1692 /* load the F/W, read paramaters, and init the H/W */ 1692 /* load the F/W, read paramaters, and init the H/W */
1693 ha->instance = num_hosts; 1693 ha->instance = num_hosts;
1694 1694
1695 init_MUTEX(&ha->mbx_cmd_sem);
1696 init_MUTEX(&ha->vport_sem); 1695 init_MUTEX(&ha->vport_sem);
1697 init_MUTEX_LOCKED(&ha->mbx_intr_sem); 1696 init_completion(&ha->mbx_cmd_comp);
1697 complete(&ha->mbx_cmd_comp);
1698 init_completion(&ha->mbx_intr_comp);
1698 1699
1699 INIT_LIST_HEAD(&ha->list); 1700 INIT_LIST_HEAD(&ha->list);
1700 INIT_LIST_HEAD(&ha->fcports); 1701 INIT_LIST_HEAD(&ha->fcports);
@@ -2739,23 +2740,6 @@ qla2x00_timer(scsi_qla_host_t *ha)
2739 qla2x00_restart_timer(ha, WATCH_INTERVAL); 2740 qla2x00_restart_timer(ha, WATCH_INTERVAL);
2740} 2741}
2741 2742
2742/* XXX(hch): crude hack to emulate a down_timeout() */
2743int
2744qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
2745{
2746 const unsigned int step = 100; /* msecs */
2747 unsigned int iterations = jiffies_to_msecs(timeout)/100;
2748
2749 do {
2750 if (!down_trylock(sema))
2751 return 0;
2752 if (msleep_interruptible(step))
2753 break;
2754 } while (--iterations > 0);
2755
2756 return -ETIMEDOUT;
2757}
2758
2759/* Firmware interface routines. */ 2743/* Firmware interface routines. */
2760 2744
2761#define FW_BLOBS 6 2745#define FW_BLOBS 6