2 * QLogic Fibre Channel HBA Driver
3 * Copyright (c) 2003-2008 QLogic Corporation
5 * See LICENSE.qla2xxx for copyright and licensing details.
9 #include <linux/moduleparam.h>
10 #include <linux/vmalloc.h>
11 #include <linux/delay.h>
12 #include <linux/kthread.h>
13 #include <linux/mutex.h>
15 #include <scsi/scsi_tcq.h>
16 #include <scsi/scsicam.h>
17 #include <scsi/scsi_transport.h>
18 #include <scsi/scsi_transport_fc.h>
23 char qla2x00_version_str
[40];
26 * SRB allocation cache
28 static struct kmem_cache
*srb_cachep
;
30 int ql2xlogintimeout
= 20;
31 module_param(ql2xlogintimeout
, int, S_IRUGO
|S_IRUSR
);
32 MODULE_PARM_DESC(ql2xlogintimeout
,
33 "Login timeout value in seconds.");
35 int qlport_down_retry
;
36 module_param(qlport_down_retry
, int, S_IRUGO
|S_IRUSR
);
37 MODULE_PARM_DESC(qlport_down_retry
,
38 "Maximum number of command retries to a port that returns "
39 "a PORT-DOWN status.");
41 int ql2xplogiabsentdevice
;
42 module_param(ql2xplogiabsentdevice
, int, S_IRUGO
|S_IWUSR
);
43 MODULE_PARM_DESC(ql2xplogiabsentdevice
,
44 "Option to enable PLOGI to devices that are not present after "
45 "a Fabric scan. This is needed for several broken switches. "
46 "Default is 0 - no PLOGI. 1 - perfom PLOGI.");
48 int ql2xloginretrycount
= 0;
49 module_param(ql2xloginretrycount
, int, S_IRUGO
|S_IRUSR
);
50 MODULE_PARM_DESC(ql2xloginretrycount
,
51 "Specify an alternate value for the NVRAM login retry count.");
53 int ql2xallocfwdump
= 1;
54 module_param(ql2xallocfwdump
, int, S_IRUGO
|S_IRUSR
);
55 MODULE_PARM_DESC(ql2xallocfwdump
,
56 "Option to enable allocation of memory for a firmware dump "
57 "during HBA initialization. Memory allocation requirements "
58 "vary by ISP type. Default is 1 - allocate memory.");
60 int ql2xextended_error_logging
;
61 module_param(ql2xextended_error_logging
, int, S_IRUGO
|S_IWUSR
);
62 MODULE_PARM_DESC(ql2xextended_error_logging
,
63 "Option to enable extended error logging, "
64 "Default is 0 - no logging. 1 - log errors.");
66 static void qla2x00_free_device(scsi_qla_host_t
*);
69 module_param(ql2xfdmienable
, int, S_IRUGO
|S_IRUSR
);
70 MODULE_PARM_DESC(ql2xfdmienable
,
71 "Enables FDMI registratons "
72 "Default is 0 - no FDMI. 1 - perfom FDMI.");
74 #define MAX_Q_DEPTH 32
75 static int ql2xmaxqdepth
= MAX_Q_DEPTH
;
76 module_param(ql2xmaxqdepth
, int, S_IRUGO
|S_IWUSR
);
77 MODULE_PARM_DESC(ql2xmaxqdepth
,
78 "Maximum queue depth to report for target devices.");
80 int ql2xqfulltracking
= 1;
81 module_param(ql2xqfulltracking
, int, S_IRUGO
|S_IWUSR
);
82 MODULE_PARM_DESC(ql2xqfulltracking
,
83 "Controls whether the driver tracks queue full status "
84 "returns and dynamically adjusts a scsi device's queue "
85 "depth. Default is 1, perform tracking. Set to 0 to "
86 "disable dynamic tracking and adjustment of queue depth.");
88 int ql2xqfullrampup
= 120;
89 module_param(ql2xqfullrampup
, int, S_IRUGO
|S_IWUSR
);
90 MODULE_PARM_DESC(ql2xqfullrampup
,
91 "Number of seconds to wait to begin to ramp-up the queue "
92 "depth for a device after a queue-full condition has been "
93 "detected. Default is 120 seconds.");
95 int ql2xiidmaenable
=1;
96 module_param(ql2xiidmaenable
, int, S_IRUGO
|S_IRUSR
);
97 MODULE_PARM_DESC(ql2xiidmaenable
,
98 "Enables iIDMA settings "
99 "Default is 1 - perform iIDMA. 0 - no iIDMA.");
101 int ql2xmaxqueues
= 1;
102 module_param(ql2xmaxqueues
, int, S_IRUGO
|S_IRUSR
);
103 MODULE_PARM_DESC(ql2xmaxqueues
,
104 "Enables MQ settings "
105 "Default is 1 for single queue. Set it to number \
106 of queues in MQ mode.");
108 int ql2xmultique_tag
;
109 module_param(ql2xmultique_tag
, int, S_IRUGO
|S_IRUSR
);
110 MODULE_PARM_DESC(ql2xmultique_tag
,
111 "Enables CPU affinity settings for the driver "
112 "Default is 0 for no affinity of request and response IO. "
113 "Set it to 1 to turn on the cpu affinity.");
116 module_param(ql2xfwloadbin
, int, S_IRUGO
|S_IRUSR
);
117 MODULE_PARM_DESC(ql2xfwloadbin
,
118 "Option to specify location from which to load ISP firmware:\n"
119 " 2 -- load firmware via the request_firmware() (hotplug)\n"
121 " 1 -- load firmware from flash.\n"
122 " 0 -- use default semantics.\n");
125 * SCSI host template entry points
127 static int qla2xxx_slave_configure(struct scsi_device
* device
);
128 static int qla2xxx_slave_alloc(struct scsi_device
*);
129 static int qla2xxx_scan_finished(struct Scsi_Host
*, unsigned long time
);
130 static void qla2xxx_scan_start(struct Scsi_Host
*);
131 static void qla2xxx_slave_destroy(struct scsi_device
*);
132 static int qla2xxx_queuecommand(struct scsi_cmnd
*cmd
,
133 void (*fn
)(struct scsi_cmnd
*));
134 static int qla2xxx_eh_abort(struct scsi_cmnd
*);
135 static int qla2xxx_eh_device_reset(struct scsi_cmnd
*);
136 static int qla2xxx_eh_target_reset(struct scsi_cmnd
*);
137 static int qla2xxx_eh_bus_reset(struct scsi_cmnd
*);
138 static int qla2xxx_eh_host_reset(struct scsi_cmnd
*);
140 static int qla2x00_change_queue_depth(struct scsi_device
*, int);
141 static int qla2x00_change_queue_type(struct scsi_device
*, int);
143 struct scsi_host_template qla2xxx_driver_template
= {
144 .module
= THIS_MODULE
,
145 .name
= QLA2XXX_DRIVER_NAME
,
146 .queuecommand
= qla2xxx_queuecommand
,
148 .eh_abort_handler
= qla2xxx_eh_abort
,
149 .eh_device_reset_handler
= qla2xxx_eh_device_reset
,
150 .eh_target_reset_handler
= qla2xxx_eh_target_reset
,
151 .eh_bus_reset_handler
= qla2xxx_eh_bus_reset
,
152 .eh_host_reset_handler
= qla2xxx_eh_host_reset
,
154 .slave_configure
= qla2xxx_slave_configure
,
156 .slave_alloc
= qla2xxx_slave_alloc
,
157 .slave_destroy
= qla2xxx_slave_destroy
,
158 .scan_finished
= qla2xxx_scan_finished
,
159 .scan_start
= qla2xxx_scan_start
,
160 .change_queue_depth
= qla2x00_change_queue_depth
,
161 .change_queue_type
= qla2x00_change_queue_type
,
164 .use_clustering
= ENABLE_CLUSTERING
,
165 .sg_tablesize
= SG_ALL
,
167 .max_sectors
= 0xFFFF,
168 .shost_attrs
= qla2x00_host_attrs
,
171 static struct scsi_transport_template
*qla2xxx_transport_template
= NULL
;
172 struct scsi_transport_template
*qla2xxx_transport_vport_template
= NULL
;
174 /* TODO Convert to inlines
180 qla2x00_start_timer(scsi_qla_host_t
*vha
, void *func
, unsigned long interval
)
182 init_timer(&vha
->timer
);
183 vha
->timer
.expires
= jiffies
+ interval
* HZ
;
184 vha
->timer
.data
= (unsigned long)vha
;
185 vha
->timer
.function
= (void (*)(unsigned long))func
;
186 add_timer(&vha
->timer
);
187 vha
->timer_active
= 1;
191 qla2x00_restart_timer(scsi_qla_host_t
*vha
, unsigned long interval
)
193 mod_timer(&vha
->timer
, jiffies
+ interval
* HZ
);
196 static __inline__
void
197 qla2x00_stop_timer(scsi_qla_host_t
*vha
)
199 del_timer_sync(&vha
->timer
);
200 vha
->timer_active
= 0;
203 static int qla2x00_do_dpc(void *data
);
205 static void qla2x00_rst_aen(scsi_qla_host_t
*);
207 static int qla2x00_mem_alloc(struct qla_hw_data
*, uint16_t, uint16_t,
208 struct req_que
**, struct rsp_que
**);
209 static void qla2x00_mem_free(struct qla_hw_data
*);
210 static void qla2x00_sp_free_dma(srb_t
*);
212 /* -------------------------------------------------------------------------- */
213 static int qla2x00_alloc_queues(struct qla_hw_data
*ha
)
215 ha
->req_q_map
= kzalloc(sizeof(struct req_que
*) * ha
->max_req_queues
,
217 if (!ha
->req_q_map
) {
218 qla_printk(KERN_WARNING
, ha
,
219 "Unable to allocate memory for request queue ptrs\n");
223 ha
->rsp_q_map
= kzalloc(sizeof(struct rsp_que
*) * ha
->max_rsp_queues
,
225 if (!ha
->rsp_q_map
) {
226 qla_printk(KERN_WARNING
, ha
,
227 "Unable to allocate memory for response queue ptrs\n");
230 set_bit(0, ha
->rsp_qid_map
);
231 set_bit(0, ha
->req_qid_map
);
235 kfree(ha
->req_q_map
);
236 ha
->req_q_map
= NULL
;
241 static void qla2x00_free_req_que(struct qla_hw_data
*ha
, struct req_que
*req
)
243 if (req
&& req
->ring
)
244 dma_free_coherent(&ha
->pdev
->dev
,
245 (req
->length
+ 1) * sizeof(request_t
),
246 req
->ring
, req
->dma
);
252 static void qla2x00_free_rsp_que(struct qla_hw_data
*ha
, struct rsp_que
*rsp
)
254 if (rsp
&& rsp
->ring
)
255 dma_free_coherent(&ha
->pdev
->dev
,
256 (rsp
->length
+ 1) * sizeof(response_t
),
257 rsp
->ring
, rsp
->dma
);
263 static void qla2x00_free_queues(struct qla_hw_data
*ha
)
269 for (cnt
= 0; cnt
< ha
->max_req_queues
; cnt
++) {
270 req
= ha
->req_q_map
[cnt
];
271 qla2x00_free_req_que(ha
, req
);
273 kfree(ha
->req_q_map
);
274 ha
->req_q_map
= NULL
;
276 for (cnt
= 0; cnt
< ha
->max_rsp_queues
; cnt
++) {
277 rsp
= ha
->rsp_q_map
[cnt
];
278 qla2x00_free_rsp_que(ha
, rsp
);
280 kfree(ha
->rsp_q_map
);
281 ha
->rsp_q_map
= NULL
;
284 static int qla25xx_setup_mode(struct scsi_qla_host
*vha
)
286 uint16_t options
= 0;
288 struct qla_hw_data
*ha
= vha
->hw
;
290 if (ql2xmultique_tag
) {
291 /* CPU affinity mode */
292 ha
->wq
= create_workqueue("qla2xxx_wq");
293 /* create a request queue for IO */
295 req
= qla25xx_create_req_que(ha
, options
, 0, 0, -1,
296 QLA_DEFAULT_QUE_QOS
);
298 qla_printk(KERN_WARNING
, ha
,
299 "Can't create request queue\n");
302 vha
->req
= ha
->req_q_map
[req
];
304 for (ques
= 1; ques
< ha
->max_rsp_queues
; ques
++) {
305 ret
= qla25xx_create_rsp_que(ha
, options
, 0, 0, req
);
307 qla_printk(KERN_WARNING
, ha
,
308 "Response Queue create failed\n");
312 DEBUG2(qla_printk(KERN_INFO
, ha
,
313 "CPU affinity mode enabled, no. of response"
314 " queues:%d, no. of request queues:%d\n",
315 ha
->max_rsp_queues
, ha
->max_req_queues
));
319 qla25xx_delete_queues(vha
);
326 qla2x00_pci_info_str(struct scsi_qla_host
*vha
, char *str
)
328 struct qla_hw_data
*ha
= vha
->hw
;
329 static char *pci_bus_modes
[] = {
330 "33", "66", "100", "133",
335 pci_bus
= (ha
->pci_attr
& (BIT_9
| BIT_10
)) >> 9;
338 strcat(str
, pci_bus_modes
[pci_bus
]);
340 pci_bus
= (ha
->pci_attr
& BIT_8
) >> 8;
342 strcat(str
, pci_bus_modes
[pci_bus
]);
344 strcat(str
, " MHz)");
350 qla24xx_pci_info_str(struct scsi_qla_host
*vha
, char *str
)
352 static char *pci_bus_modes
[] = { "33", "66", "100", "133", };
353 struct qla_hw_data
*ha
= vha
->hw
;
357 pcie_reg
= pci_find_capability(ha
->pdev
, PCI_CAP_ID_EXP
);
360 uint16_t pcie_lstat
, lspeed
, lwidth
;
363 pci_read_config_word(ha
->pdev
, pcie_reg
, &pcie_lstat
);
364 lspeed
= pcie_lstat
& (BIT_0
| BIT_1
| BIT_2
| BIT_3
);
365 lwidth
= (pcie_lstat
&
366 (BIT_4
| BIT_5
| BIT_6
| BIT_7
| BIT_8
| BIT_9
)) >> 4;
368 strcpy(str
, "PCIe (");
370 strcat(str
, "2.5GT/s ");
371 else if (lspeed
== 2)
372 strcat(str
, "5.0GT/s ");
374 strcat(str
, "<unknown> ");
375 snprintf(lwstr
, sizeof(lwstr
), "x%d)", lwidth
);
382 pci_bus
= (ha
->pci_attr
& CSRX_PCIX_BUS_MODE_MASK
) >> 8;
383 if (pci_bus
== 0 || pci_bus
== 8) {
385 strcat(str
, pci_bus_modes
[pci_bus
>> 3]);
389 strcat(str
, "Mode 2");
391 strcat(str
, "Mode 1");
393 strcat(str
, pci_bus_modes
[pci_bus
& ~BIT_2
]);
395 strcat(str
, " MHz)");
401 qla2x00_fw_version_str(struct scsi_qla_host
*vha
, char *str
)
404 struct qla_hw_data
*ha
= vha
->hw
;
406 sprintf(str
, "%d.%02d.%02d ", ha
->fw_major_version
,
407 ha
->fw_minor_version
,
408 ha
->fw_subminor_version
);
410 if (ha
->fw_attributes
& BIT_9
) {
415 switch (ha
->fw_attributes
& 0xFF) {
429 sprintf(un_str
, "(%x)", ha
->fw_attributes
);
433 if (ha
->fw_attributes
& 0x100)
440 qla24xx_fw_version_str(struct scsi_qla_host
*vha
, char *str
)
442 struct qla_hw_data
*ha
= vha
->hw
;
444 sprintf(str
, "%d.%02d.%02d (%x)", ha
->fw_major_version
,
445 ha
->fw_minor_version
, ha
->fw_subminor_version
, ha
->fw_attributes
);
449 static inline srb_t
*
450 qla2x00_get_new_sp(scsi_qla_host_t
*vha
, fc_port_t
*fcport
,
451 struct scsi_cmnd
*cmd
, void (*done
)(struct scsi_cmnd
*))
454 struct qla_hw_data
*ha
= vha
->hw
;
456 sp
= mempool_alloc(ha
->srb_mempool
, GFP_ATOMIC
);
463 CMD_SP(cmd
) = (void *)sp
;
464 cmd
->scsi_done
= done
;
470 qla2xxx_queuecommand(struct scsi_cmnd
*cmd
, void (*done
)(struct scsi_cmnd
*))
472 scsi_qla_host_t
*vha
= shost_priv(cmd
->device
->host
);
473 fc_port_t
*fcport
= (struct fc_port
*) cmd
->device
->hostdata
;
474 struct fc_rport
*rport
= starget_to_rport(scsi_target(cmd
->device
));
475 struct qla_hw_data
*ha
= vha
->hw
;
476 struct scsi_qla_host
*base_vha
= pci_get_drvdata(ha
->pdev
);
480 if (unlikely(pci_channel_offline(ha
->pdev
))) {
481 if (ha
->pdev
->error_state
== pci_channel_io_frozen
)
482 cmd
->result
= DID_REQUEUE
<< 16;
484 cmd
->result
= DID_NO_CONNECT
<< 16;
485 goto qc24_fail_command
;
488 rval
= fc_remote_port_chkready(rport
);
491 goto qc24_fail_command
;
494 /* Close window on fcport/rport state-transitioning. */
496 goto qc24_target_busy
;
498 if (atomic_read(&fcport
->state
) != FCS_ONLINE
) {
499 if (atomic_read(&fcport
->state
) == FCS_DEVICE_DEAD
||
500 atomic_read(&base_vha
->loop_state
) == LOOP_DEAD
) {
501 cmd
->result
= DID_NO_CONNECT
<< 16;
502 goto qc24_fail_command
;
504 goto qc24_target_busy
;
507 spin_unlock_irq(vha
->host
->host_lock
);
509 sp
= qla2x00_get_new_sp(base_vha
, fcport
, cmd
, done
);
511 goto qc24_host_busy_lock
;
513 rval
= ha
->isp_ops
->start_scsi(sp
);
514 if (rval
!= QLA_SUCCESS
)
515 goto qc24_host_busy_free_sp
;
517 spin_lock_irq(vha
->host
->host_lock
);
521 qc24_host_busy_free_sp
:
522 qla2x00_sp_free_dma(sp
);
523 mempool_free(sp
, ha
->srb_mempool
);
526 spin_lock_irq(vha
->host
->host_lock
);
527 return SCSI_MLQUEUE_HOST_BUSY
;
530 return SCSI_MLQUEUE_TARGET_BUSY
;
540 * qla2x00_eh_wait_on_command
541 * Waits for the command to be returned by the Firmware for some
545 * cmd = Scsi Command to wait on.
552 qla2x00_eh_wait_on_command(struct scsi_cmnd
*cmd
)
554 #define ABORT_POLLING_PERIOD 1000
555 #define ABORT_WAIT_ITER ((10 * 1000) / (ABORT_POLLING_PERIOD))
556 unsigned long wait_iter
= ABORT_WAIT_ITER
;
557 int ret
= QLA_SUCCESS
;
559 while (CMD_SP(cmd
)) {
560 msleep(ABORT_POLLING_PERIOD
);
566 ret
= QLA_FUNCTION_FAILED
;
572 * qla2x00_wait_for_hba_online
573 * Wait till the HBA is online after going through
574 * <= MAX_RETRIES_OF_ISP_ABORT or
575 * finally HBA is disabled ie marked offline
578 * ha - pointer to host adapter structure
581 * Does context switching-Release SPIN_LOCK
582 * (if any) before calling this routine.
585 * Success (Adapter is online) : 0
586 * Failed (Adapter is offline/disabled) : 1
589 qla2x00_wait_for_hba_online(scsi_qla_host_t
*vha
)
592 unsigned long wait_online
;
593 struct qla_hw_data
*ha
= vha
->hw
;
594 scsi_qla_host_t
*base_vha
= pci_get_drvdata(ha
->pdev
);
596 wait_online
= jiffies
+ (MAX_LOOP_TIMEOUT
* HZ
);
597 while (((test_bit(ISP_ABORT_NEEDED
, &base_vha
->dpc_flags
)) ||
598 test_bit(ABORT_ISP_ACTIVE
, &base_vha
->dpc_flags
) ||
599 test_bit(ISP_ABORT_RETRY
, &base_vha
->dpc_flags
) ||
600 ha
->dpc_active
) && time_before(jiffies
, wait_online
)) {
604 if (base_vha
->flags
.online
)
605 return_status
= QLA_SUCCESS
;
607 return_status
= QLA_FUNCTION_FAILED
;
609 return (return_status
);
613 qla2x00_wait_for_chip_reset(scsi_qla_host_t
*vha
)
616 unsigned long wait_reset
;
617 struct qla_hw_data
*ha
= vha
->hw
;
618 scsi_qla_host_t
*base_vha
= pci_get_drvdata(ha
->pdev
);
620 wait_reset
= jiffies
+ (MAX_LOOP_TIMEOUT
* HZ
);
621 while (((test_bit(ISP_ABORT_NEEDED
, &base_vha
->dpc_flags
)) ||
622 test_bit(ABORT_ISP_ACTIVE
, &base_vha
->dpc_flags
) ||
623 test_bit(ISP_ABORT_RETRY
, &base_vha
->dpc_flags
) ||
624 ha
->dpc_active
) && time_before(jiffies
, wait_reset
)) {
628 if (!test_bit(ISP_ABORT_NEEDED
, &base_vha
->dpc_flags
) &&
629 ha
->flags
.chip_reset_done
)
632 if (ha
->flags
.chip_reset_done
)
633 return_status
= QLA_SUCCESS
;
635 return_status
= QLA_FUNCTION_FAILED
;
637 return return_status
;
641 * qla2x00_wait_for_loop_ready
642 * Wait for MAX_LOOP_TIMEOUT(5 min) value for loop
643 * to be in LOOP_READY state.
645 * ha - pointer to host adapter structure
648 * Does context switching-Release SPIN_LOCK
649 * (if any) before calling this routine.
653 * Success (LOOP_READY) : 0
654 * Failed (LOOP_NOT_READY) : 1
657 qla2x00_wait_for_loop_ready(scsi_qla_host_t
*vha
)
659 int return_status
= QLA_SUCCESS
;
660 unsigned long loop_timeout
;
661 struct qla_hw_data
*ha
= vha
->hw
;
662 scsi_qla_host_t
*base_vha
= pci_get_drvdata(ha
->pdev
);
664 /* wait for 5 min at the max for loop to be ready */
665 loop_timeout
= jiffies
+ (MAX_LOOP_TIMEOUT
* HZ
);
667 while ((!atomic_read(&base_vha
->loop_down_timer
) &&
668 atomic_read(&base_vha
->loop_state
) == LOOP_DOWN
) ||
669 atomic_read(&base_vha
->loop_state
) != LOOP_READY
) {
670 if (atomic_read(&base_vha
->loop_state
) == LOOP_DEAD
) {
671 return_status
= QLA_FUNCTION_FAILED
;
675 if (time_after_eq(jiffies
, loop_timeout
)) {
676 return_status
= QLA_FUNCTION_FAILED
;
680 return (return_status
);
684 qla2x00_abort_fcport_cmds(fc_port_t
*fcport
)
689 scsi_qla_host_t
*vha
= fcport
->vha
;
690 struct qla_hw_data
*ha
= vha
->hw
;
693 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
695 for (cnt
= 1; cnt
< MAX_OUTSTANDING_COMMANDS
; cnt
++) {
696 sp
= req
->outstanding_cmds
[cnt
];
699 if (sp
->fcport
!= fcport
)
702 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
703 if (ha
->isp_ops
->abort_command(sp
)) {
704 DEBUG2(qla_printk(KERN_WARNING
, ha
,
705 "Abort failed -- %lx\n",
706 sp
->cmd
->serial_number
));
708 if (qla2x00_eh_wait_on_command(sp
->cmd
) !=
710 DEBUG2(qla_printk(KERN_WARNING
, ha
,
711 "Abort failed while waiting -- %lx\n",
712 sp
->cmd
->serial_number
));
714 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
716 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
720 qla2x00_block_error_handler(struct scsi_cmnd
*cmnd
)
722 struct Scsi_Host
*shost
= cmnd
->device
->host
;
723 struct fc_rport
*rport
= starget_to_rport(scsi_target(cmnd
->device
));
726 spin_lock_irqsave(shost
->host_lock
, flags
);
727 while (rport
->port_state
== FC_PORTSTATE_BLOCKED
) {
728 spin_unlock_irqrestore(shost
->host_lock
, flags
);
730 spin_lock_irqsave(shost
->host_lock
, flags
);
732 spin_unlock_irqrestore(shost
->host_lock
, flags
);
736 /**************************************************************************
740 * The abort function will abort the specified command.
743 * cmd = Linux SCSI command packet to be aborted.
746 * Either SUCCESS or FAILED.
749 * Only return FAILED if command not returned by firmware.
750 **************************************************************************/
752 qla2xxx_eh_abort(struct scsi_cmnd
*cmd
)
754 scsi_qla_host_t
*vha
= shost_priv(cmd
->device
->host
);
757 unsigned int id
, lun
;
758 unsigned long serial
;
761 struct qla_hw_data
*ha
= vha
->hw
;
762 struct req_que
*req
= vha
->req
;
765 qla2x00_block_error_handler(cmd
);
772 id
= cmd
->device
->id
;
773 lun
= cmd
->device
->lun
;
774 serial
= cmd
->serial_number
;
775 spt
= (srb_t
*) CMD_SP(cmd
);
779 /* Check active list for command command. */
780 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
781 for (i
= 1; i
< MAX_OUTSTANDING_COMMANDS
; i
++) {
782 sp
= req
->outstanding_cmds
[i
];
790 DEBUG2(printk("%s(%ld): aborting sp %p from RISC."
791 " pid=%ld.\n", __func__
, vha
->host_no
, sp
, serial
));
793 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
794 if (ha
->isp_ops
->abort_command(sp
)) {
795 DEBUG2(printk("%s(%ld): abort_command "
796 "mbx failed.\n", __func__
, vha
->host_no
));
799 DEBUG3(printk("%s(%ld): abort_command "
800 "mbx success.\n", __func__
, vha
->host_no
));
803 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
806 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
808 /* Wait for the command to be returned. */
810 if (qla2x00_eh_wait_on_command(cmd
) != QLA_SUCCESS
) {
811 qla_printk(KERN_ERR
, ha
,
812 "scsi(%ld:%d:%d): Abort handler timed out -- %lx "
813 "%x.\n", vha
->host_no
, id
, lun
, serial
, ret
);
818 qla_printk(KERN_INFO
, ha
,
819 "scsi(%ld:%d:%d): Abort command issued -- %d %lx %x.\n",
820 vha
->host_no
, id
, lun
, wait
, serial
, ret
);
825 enum nexus_wait_type
{
832 qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t
*vha
, unsigned int t
,
833 unsigned int l
, srb_t
*sp
, enum nexus_wait_type type
)
835 int cnt
, match
, status
;
837 struct qla_hw_data
*ha
= vha
->hw
;
840 status
= QLA_SUCCESS
;
844 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
846 for (cnt
= 1; status
== QLA_SUCCESS
&&
847 cnt
< MAX_OUTSTANDING_COMMANDS
; cnt
++) {
848 sp
= req
->outstanding_cmds
[cnt
];
852 if (vha
->vp_idx
!= sp
->fcport
->vha
->vp_idx
)
860 match
= sp
->cmd
->device
->id
== t
;
863 match
= (sp
->cmd
->device
->id
== t
&&
864 sp
->cmd
->device
->lun
== l
);
870 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
871 status
= qla2x00_eh_wait_on_command(sp
->cmd
);
872 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
874 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
879 static char *reset_errors
[] = {
882 "Task management failed",
883 "Waiting for command completions",
887 __qla2xxx_eh_generic_reset(char *name
, enum nexus_wait_type type
,
888 struct scsi_cmnd
*cmd
, int (*do_reset
)(struct fc_port
*, unsigned int, int))
890 scsi_qla_host_t
*vha
= shost_priv(cmd
->device
->host
);
891 fc_port_t
*fcport
= (struct fc_port
*) cmd
->device
->hostdata
;
894 qla2x00_block_error_handler(cmd
);
899 qla_printk(KERN_INFO
, vha
->hw
, "scsi(%ld:%d:%d): %s RESET ISSUED.\n",
900 vha
->host_no
, cmd
->device
->id
, cmd
->device
->lun
, name
);
903 if (qla2x00_wait_for_hba_online(vha
) != QLA_SUCCESS
)
904 goto eh_reset_failed
;
906 if (qla2x00_wait_for_loop_ready(vha
) != QLA_SUCCESS
)
907 goto eh_reset_failed
;
909 if (do_reset(fcport
, cmd
->device
->lun
, cmd
->request
->cpu
+ 1)
911 goto eh_reset_failed
;
913 if (qla2x00_eh_wait_for_pending_commands(vha
, cmd
->device
->id
,
914 cmd
->device
->lun
, (srb_t
*) CMD_SP(cmd
), type
) != QLA_SUCCESS
)
915 goto eh_reset_failed
;
917 qla_printk(KERN_INFO
, vha
->hw
, "scsi(%ld:%d:%d): %s RESET SUCCEEDED.\n",
918 vha
->host_no
, cmd
->device
->id
, cmd
->device
->lun
, name
);
923 qla_printk(KERN_INFO
, vha
->hw
, "scsi(%ld:%d:%d): %s RESET FAILED: %s.\n"
924 , vha
->host_no
, cmd
->device
->id
, cmd
->device
->lun
, name
,
930 qla2xxx_eh_device_reset(struct scsi_cmnd
*cmd
)
932 scsi_qla_host_t
*vha
= shost_priv(cmd
->device
->host
);
933 struct qla_hw_data
*ha
= vha
->hw
;
935 return __qla2xxx_eh_generic_reset("DEVICE", WAIT_LUN
, cmd
,
936 ha
->isp_ops
->lun_reset
);
940 qla2xxx_eh_target_reset(struct scsi_cmnd
*cmd
)
942 scsi_qla_host_t
*vha
= shost_priv(cmd
->device
->host
);
943 struct qla_hw_data
*ha
= vha
->hw
;
945 return __qla2xxx_eh_generic_reset("TARGET", WAIT_TARGET
, cmd
,
946 ha
->isp_ops
->target_reset
);
949 /**************************************************************************
950 * qla2xxx_eh_bus_reset
953 * The bus reset function will reset the bus and abort any executing
957 * cmd = Linux SCSI command packet of the command that cause the
961 * SUCCESS/FAILURE (defined as macro in scsi.h).
963 **************************************************************************/
965 qla2xxx_eh_bus_reset(struct scsi_cmnd
*cmd
)
967 scsi_qla_host_t
*vha
= shost_priv(cmd
->device
->host
);
968 fc_port_t
*fcport
= (struct fc_port
*) cmd
->device
->hostdata
;
970 unsigned int id
, lun
;
971 unsigned long serial
;
972 srb_t
*sp
= (srb_t
*) CMD_SP(cmd
);
974 qla2x00_block_error_handler(cmd
);
976 id
= cmd
->device
->id
;
977 lun
= cmd
->device
->lun
;
978 serial
= cmd
->serial_number
;
983 qla_printk(KERN_INFO
, vha
->hw
,
984 "scsi(%ld:%d:%d): BUS RESET ISSUED.\n", vha
->host_no
, id
, lun
);
986 if (qla2x00_wait_for_hba_online(vha
) != QLA_SUCCESS
) {
987 DEBUG2(printk("%s failed:board disabled\n",__func__
));
988 goto eh_bus_reset_done
;
991 if (qla2x00_wait_for_loop_ready(vha
) == QLA_SUCCESS
) {
992 if (qla2x00_loop_reset(vha
) == QLA_SUCCESS
)
996 goto eh_bus_reset_done
;
998 /* Flush outstanding commands. */
999 if (qla2x00_eh_wait_for_pending_commands(vha
, 0, 0, sp
, WAIT_HOST
) !=
1004 qla_printk(KERN_INFO
, vha
->hw
, "%s: reset %s\n", __func__
,
1005 (ret
== FAILED
) ? "failed" : "succeded");
1010 /**************************************************************************
1011 * qla2xxx_eh_host_reset
1014 * The reset function will reset the Adapter.
1017 * cmd = Linux SCSI command packet of the command that cause the
1021 * Either SUCCESS or FAILED.
1024 **************************************************************************/
1026 qla2xxx_eh_host_reset(struct scsi_cmnd
*cmd
)
1028 scsi_qla_host_t
*vha
= shost_priv(cmd
->device
->host
);
1029 fc_port_t
*fcport
= (struct fc_port
*) cmd
->device
->hostdata
;
1030 struct qla_hw_data
*ha
= vha
->hw
;
1032 unsigned int id
, lun
;
1033 unsigned long serial
;
1034 srb_t
*sp
= (srb_t
*) CMD_SP(cmd
);
1035 scsi_qla_host_t
*base_vha
= pci_get_drvdata(ha
->pdev
);
1037 qla2x00_block_error_handler(cmd
);
1039 id
= cmd
->device
->id
;
1040 lun
= cmd
->device
->lun
;
1041 serial
= cmd
->serial_number
;
1046 qla_printk(KERN_INFO
, ha
,
1047 "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", vha
->host_no
, id
, lun
);
1049 if (qla2x00_wait_for_hba_online(vha
) != QLA_SUCCESS
)
1050 goto eh_host_reset_lock
;
1053 * Fixme-may be dpc thread is active and processing
1054 * loop_resync,so wait a while for it to
1055 * be completed and then issue big hammer.Otherwise
1056 * it may cause I/O failure as big hammer marks the
1057 * devices as lost kicking of the port_down_timer
1058 * while dpc is stuck for the mailbox to complete.
1060 qla2x00_wait_for_loop_ready(vha
);
1061 if (vha
!= base_vha
) {
1062 if (qla2x00_vp_abort_isp(vha
))
1063 goto eh_host_reset_lock
;
1066 flush_workqueue(ha
->wq
);
1068 set_bit(ABORT_ISP_ACTIVE
, &base_vha
->dpc_flags
);
1069 if (qla2x00_abort_isp(base_vha
)) {
1070 clear_bit(ABORT_ISP_ACTIVE
, &base_vha
->dpc_flags
);
1071 /* failed. schedule dpc to try */
1072 set_bit(ISP_ABORT_NEEDED
, &base_vha
->dpc_flags
);
1074 if (qla2x00_wait_for_hba_online(vha
) != QLA_SUCCESS
)
1075 goto eh_host_reset_lock
;
1077 clear_bit(ABORT_ISP_ACTIVE
, &base_vha
->dpc_flags
);
1080 /* Waiting for command to be returned to OS.*/
1081 if (qla2x00_eh_wait_for_pending_commands(vha
, 0, 0, sp
, WAIT_HOST
) ==
1086 qla_printk(KERN_INFO
, ha
, "%s: reset %s\n", __func__
,
1087 (ret
== FAILED
) ? "failed" : "succeded");
1093 * qla2x00_loop_reset
1097 * ha = adapter block pointer.
1103 qla2x00_loop_reset(scsi_qla_host_t
*vha
)
1106 struct fc_port
*fcport
;
1107 struct qla_hw_data
*ha
= vha
->hw
;
1109 if (ha
->flags
.enable_lip_full_login
&& !vha
->vp_idx
&&
1111 ret
= qla2x00_full_login_lip(vha
);
1112 if (ret
!= QLA_SUCCESS
) {
1113 DEBUG2_3(printk("%s(%ld): failed: "
1114 "full_login_lip=%d.\n", __func__
, vha
->host_no
,
1117 atomic_set(&vha
->loop_state
, LOOP_DOWN
);
1118 atomic_set(&vha
->loop_down_timer
, LOOP_DOWN_TIME
);
1119 qla2x00_mark_all_devices_lost(vha
, 0);
1120 qla2x00_wait_for_loop_ready(vha
);
1123 if (ha
->flags
.enable_lip_reset
&& !vha
->vp_idx
) {
1124 ret
= qla2x00_lip_reset(vha
);
1125 if (ret
!= QLA_SUCCESS
) {
1126 DEBUG2_3(printk("%s(%ld): failed: "
1127 "lip_reset=%d.\n", __func__
, vha
->host_no
, ret
));
1129 qla2x00_wait_for_loop_ready(vha
);
1132 if (ha
->flags
.enable_target_reset
) {
1133 list_for_each_entry(fcport
, &vha
->vp_fcports
, list
) {
1134 if (fcport
->port_type
!= FCT_TARGET
)
1137 ret
= ha
->isp_ops
->target_reset(fcport
, 0, 0);
1138 if (ret
!= QLA_SUCCESS
) {
1139 DEBUG2_3(printk("%s(%ld): bus_reset failed: "
1140 "target_reset=%d d_id=%x.\n", __func__
,
1141 vha
->host_no
, ret
, fcport
->d_id
.b24
));
1145 /* Issue marker command only when we are going to start the I/O */
1146 vha
->marker_needed
= 1;
1152 qla2x00_abort_all_cmds(scsi_qla_host_t
*vha
, int res
)
1155 unsigned long flags
;
1157 struct qla_hw_data
*ha
= vha
->hw
;
1158 struct req_que
*req
;
1160 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
1161 for (que
= 0; que
< ha
->max_req_queues
; que
++) {
1162 req
= ha
->req_q_map
[que
];
1165 for (cnt
= 1; cnt
< MAX_OUTSTANDING_COMMANDS
; cnt
++) {
1166 sp
= req
->outstanding_cmds
[cnt
];
1168 req
->outstanding_cmds
[cnt
] = NULL
;
1169 sp
->cmd
->result
= res
;
1170 qla2x00_sp_compl(ha
, sp
);
1174 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
1178 qla2xxx_slave_alloc(struct scsi_device
*sdev
)
1180 struct fc_rport
*rport
= starget_to_rport(scsi_target(sdev
));
1182 if (!rport
|| fc_remote_port_chkready(rport
))
1185 sdev
->hostdata
= *(fc_port_t
**)rport
->dd_data
;
1191 qla2xxx_slave_configure(struct scsi_device
*sdev
)
1193 scsi_qla_host_t
*vha
= shost_priv(sdev
->host
);
1194 struct qla_hw_data
*ha
= vha
->hw
;
1195 struct fc_rport
*rport
= starget_to_rport(sdev
->sdev_target
);
1196 struct req_que
*req
= vha
->req
;
1198 if (sdev
->tagged_supported
)
1199 scsi_activate_tcq(sdev
, req
->max_q_depth
);
1201 scsi_deactivate_tcq(sdev
, req
->max_q_depth
);
1203 rport
->dev_loss_tmo
= ha
->port_down_retry_count
;
1209 qla2xxx_slave_destroy(struct scsi_device
*sdev
)
1211 sdev
->hostdata
= NULL
;
1215 qla2x00_change_queue_depth(struct scsi_device
*sdev
, int qdepth
)
1217 scsi_adjust_queue_depth(sdev
, scsi_get_tag_type(sdev
), qdepth
);
1218 return sdev
->queue_depth
;
1222 qla2x00_change_queue_type(struct scsi_device
*sdev
, int tag_type
)
1224 if (sdev
->tagged_supported
) {
1225 scsi_set_tag_type(sdev
, tag_type
);
1227 scsi_activate_tcq(sdev
, sdev
->queue_depth
);
1229 scsi_deactivate_tcq(sdev
, sdev
->queue_depth
);
1237 * qla2x00_config_dma_addressing() - Configure OS DMA addressing method.
1240 * At exit, the @ha's flags.enable_64bit_addressing set to indicated
1241 * supported addressing method.
1244 qla2x00_config_dma_addressing(struct qla_hw_data
*ha
)
1246 /* Assume a 32bit DMA mask. */
1247 ha
->flags
.enable_64bit_addressing
= 0;
1249 if (!dma_set_mask(&ha
->pdev
->dev
, DMA_BIT_MASK(64))) {
1250 /* Any upper-dword bits set? */
1251 if (MSD(dma_get_required_mask(&ha
->pdev
->dev
)) &&
1252 !pci_set_consistent_dma_mask(ha
->pdev
, DMA_BIT_MASK(64))) {
1253 /* Ok, a 64bit DMA mask is applicable. */
1254 ha
->flags
.enable_64bit_addressing
= 1;
1255 ha
->isp_ops
->calc_req_entries
= qla2x00_calc_iocbs_64
;
1256 ha
->isp_ops
->build_iocbs
= qla2x00_build_scsi_iocbs_64
;
1261 dma_set_mask(&ha
->pdev
->dev
, DMA_BIT_MASK(32));
1262 pci_set_consistent_dma_mask(ha
->pdev
, DMA_BIT_MASK(32));
1266 qla2x00_enable_intrs(struct qla_hw_data
*ha
)
1268 unsigned long flags
= 0;
1269 struct device_reg_2xxx __iomem
*reg
= &ha
->iobase
->isp
;
1271 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
1272 ha
->interrupts_on
= 1;
1273 /* enable risc and host interrupts */
1274 WRT_REG_WORD(®
->ictrl
, ICR_EN_INT
| ICR_EN_RISC
);
1275 RD_REG_WORD(®
->ictrl
);
1276 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
1281 qla2x00_disable_intrs(struct qla_hw_data
*ha
)
1283 unsigned long flags
= 0;
1284 struct device_reg_2xxx __iomem
*reg
= &ha
->iobase
->isp
;
1286 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
1287 ha
->interrupts_on
= 0;
1288 /* disable risc and host interrupts */
1289 WRT_REG_WORD(®
->ictrl
, 0);
1290 RD_REG_WORD(®
->ictrl
);
1291 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
1295 qla24xx_enable_intrs(struct qla_hw_data
*ha
)
1297 unsigned long flags
= 0;
1298 struct device_reg_24xx __iomem
*reg
= &ha
->iobase
->isp24
;
1300 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
1301 ha
->interrupts_on
= 1;
1302 WRT_REG_DWORD(®
->ictrl
, ICRX_EN_RISC_INT
);
1303 RD_REG_DWORD(®
->ictrl
);
1304 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
1308 qla24xx_disable_intrs(struct qla_hw_data
*ha
)
1310 unsigned long flags
= 0;
1311 struct device_reg_24xx __iomem
*reg
= &ha
->iobase
->isp24
;
1313 if (IS_NOPOLLING_TYPE(ha
))
1315 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
1316 ha
->interrupts_on
= 0;
1317 WRT_REG_DWORD(®
->ictrl
, 0);
1318 RD_REG_DWORD(®
->ictrl
);
1319 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
1322 static struct isp_operations qla2100_isp_ops
= {
1323 .pci_config
= qla2100_pci_config
,
1324 .reset_chip
= qla2x00_reset_chip
,
1325 .chip_diag
= qla2x00_chip_diag
,
1326 .config_rings
= qla2x00_config_rings
,
1327 .reset_adapter
= qla2x00_reset_adapter
,
1328 .nvram_config
= qla2x00_nvram_config
,
1329 .update_fw_options
= qla2x00_update_fw_options
,
1330 .load_risc
= qla2x00_load_risc
,
1331 .pci_info_str
= qla2x00_pci_info_str
,
1332 .fw_version_str
= qla2x00_fw_version_str
,
1333 .intr_handler
= qla2100_intr_handler
,
1334 .enable_intrs
= qla2x00_enable_intrs
,
1335 .disable_intrs
= qla2x00_disable_intrs
,
1336 .abort_command
= qla2x00_abort_command
,
1337 .target_reset
= qla2x00_abort_target
,
1338 .lun_reset
= qla2x00_lun_reset
,
1339 .fabric_login
= qla2x00_login_fabric
,
1340 .fabric_logout
= qla2x00_fabric_logout
,
1341 .calc_req_entries
= qla2x00_calc_iocbs_32
,
1342 .build_iocbs
= qla2x00_build_scsi_iocbs_32
,
1343 .prep_ms_iocb
= qla2x00_prep_ms_iocb
,
1344 .prep_ms_fdmi_iocb
= qla2x00_prep_ms_fdmi_iocb
,
1345 .read_nvram
= qla2x00_read_nvram_data
,
1346 .write_nvram
= qla2x00_write_nvram_data
,
1347 .fw_dump
= qla2100_fw_dump
,
1350 .beacon_blink
= NULL
,
1351 .read_optrom
= qla2x00_read_optrom_data
,
1352 .write_optrom
= qla2x00_write_optrom_data
,
1353 .get_flash_version
= qla2x00_get_flash_version
,
1354 .start_scsi
= qla2x00_start_scsi
,
1357 static struct isp_operations qla2300_isp_ops
= {
1358 .pci_config
= qla2300_pci_config
,
1359 .reset_chip
= qla2x00_reset_chip
,
1360 .chip_diag
= qla2x00_chip_diag
,
1361 .config_rings
= qla2x00_config_rings
,
1362 .reset_adapter
= qla2x00_reset_adapter
,
1363 .nvram_config
= qla2x00_nvram_config
,
1364 .update_fw_options
= qla2x00_update_fw_options
,
1365 .load_risc
= qla2x00_load_risc
,
1366 .pci_info_str
= qla2x00_pci_info_str
,
1367 .fw_version_str
= qla2x00_fw_version_str
,
1368 .intr_handler
= qla2300_intr_handler
,
1369 .enable_intrs
= qla2x00_enable_intrs
,
1370 .disable_intrs
= qla2x00_disable_intrs
,
1371 .abort_command
= qla2x00_abort_command
,
1372 .target_reset
= qla2x00_abort_target
,
1373 .lun_reset
= qla2x00_lun_reset
,
1374 .fabric_login
= qla2x00_login_fabric
,
1375 .fabric_logout
= qla2x00_fabric_logout
,
1376 .calc_req_entries
= qla2x00_calc_iocbs_32
,
1377 .build_iocbs
= qla2x00_build_scsi_iocbs_32
,
1378 .prep_ms_iocb
= qla2x00_prep_ms_iocb
,
1379 .prep_ms_fdmi_iocb
= qla2x00_prep_ms_fdmi_iocb
,
1380 .read_nvram
= qla2x00_read_nvram_data
,
1381 .write_nvram
= qla2x00_write_nvram_data
,
1382 .fw_dump
= qla2300_fw_dump
,
1383 .beacon_on
= qla2x00_beacon_on
,
1384 .beacon_off
= qla2x00_beacon_off
,
1385 .beacon_blink
= qla2x00_beacon_blink
,
1386 .read_optrom
= qla2x00_read_optrom_data
,
1387 .write_optrom
= qla2x00_write_optrom_data
,
1388 .get_flash_version
= qla2x00_get_flash_version
,
1389 .start_scsi
= qla2x00_start_scsi
,
1392 static struct isp_operations qla24xx_isp_ops
= {
1393 .pci_config
= qla24xx_pci_config
,
1394 .reset_chip
= qla24xx_reset_chip
,
1395 .chip_diag
= qla24xx_chip_diag
,
1396 .config_rings
= qla24xx_config_rings
,
1397 .reset_adapter
= qla24xx_reset_adapter
,
1398 .nvram_config
= qla24xx_nvram_config
,
1399 .update_fw_options
= qla24xx_update_fw_options
,
1400 .load_risc
= qla24xx_load_risc
,
1401 .pci_info_str
= qla24xx_pci_info_str
,
1402 .fw_version_str
= qla24xx_fw_version_str
,
1403 .intr_handler
= qla24xx_intr_handler
,
1404 .enable_intrs
= qla24xx_enable_intrs
,
1405 .disable_intrs
= qla24xx_disable_intrs
,
1406 .abort_command
= qla24xx_abort_command
,
1407 .target_reset
= qla24xx_abort_target
,
1408 .lun_reset
= qla24xx_lun_reset
,
1409 .fabric_login
= qla24xx_login_fabric
,
1410 .fabric_logout
= qla24xx_fabric_logout
,
1411 .calc_req_entries
= NULL
,
1412 .build_iocbs
= NULL
,
1413 .prep_ms_iocb
= qla24xx_prep_ms_iocb
,
1414 .prep_ms_fdmi_iocb
= qla24xx_prep_ms_fdmi_iocb
,
1415 .read_nvram
= qla24xx_read_nvram_data
,
1416 .write_nvram
= qla24xx_write_nvram_data
,
1417 .fw_dump
= qla24xx_fw_dump
,
1418 .beacon_on
= qla24xx_beacon_on
,
1419 .beacon_off
= qla24xx_beacon_off
,
1420 .beacon_blink
= qla24xx_beacon_blink
,
1421 .read_optrom
= qla24xx_read_optrom_data
,
1422 .write_optrom
= qla24xx_write_optrom_data
,
1423 .get_flash_version
= qla24xx_get_flash_version
,
1424 .start_scsi
= qla24xx_start_scsi
,
1427 static struct isp_operations qla25xx_isp_ops
= {
1428 .pci_config
= qla25xx_pci_config
,
1429 .reset_chip
= qla24xx_reset_chip
,
1430 .chip_diag
= qla24xx_chip_diag
,
1431 .config_rings
= qla24xx_config_rings
,
1432 .reset_adapter
= qla24xx_reset_adapter
,
1433 .nvram_config
= qla24xx_nvram_config
,
1434 .update_fw_options
= qla24xx_update_fw_options
,
1435 .load_risc
= qla24xx_load_risc
,
1436 .pci_info_str
= qla24xx_pci_info_str
,
1437 .fw_version_str
= qla24xx_fw_version_str
,
1438 .intr_handler
= qla24xx_intr_handler
,
1439 .enable_intrs
= qla24xx_enable_intrs
,
1440 .disable_intrs
= qla24xx_disable_intrs
,
1441 .abort_command
= qla24xx_abort_command
,
1442 .target_reset
= qla24xx_abort_target
,
1443 .lun_reset
= qla24xx_lun_reset
,
1444 .fabric_login
= qla24xx_login_fabric
,
1445 .fabric_logout
= qla24xx_fabric_logout
,
1446 .calc_req_entries
= NULL
,
1447 .build_iocbs
= NULL
,
1448 .prep_ms_iocb
= qla24xx_prep_ms_iocb
,
1449 .prep_ms_fdmi_iocb
= qla24xx_prep_ms_fdmi_iocb
,
1450 .read_nvram
= qla25xx_read_nvram_data
,
1451 .write_nvram
= qla25xx_write_nvram_data
,
1452 .fw_dump
= qla25xx_fw_dump
,
1453 .beacon_on
= qla24xx_beacon_on
,
1454 .beacon_off
= qla24xx_beacon_off
,
1455 .beacon_blink
= qla24xx_beacon_blink
,
1456 .read_optrom
= qla25xx_read_optrom_data
,
1457 .write_optrom
= qla24xx_write_optrom_data
,
1458 .get_flash_version
= qla24xx_get_flash_version
,
1459 .start_scsi
= qla24xx_start_scsi
,
1462 static struct isp_operations qla81xx_isp_ops
= {
1463 .pci_config
= qla25xx_pci_config
,
1464 .reset_chip
= qla24xx_reset_chip
,
1465 .chip_diag
= qla24xx_chip_diag
,
1466 .config_rings
= qla24xx_config_rings
,
1467 .reset_adapter
= qla24xx_reset_adapter
,
1468 .nvram_config
= qla81xx_nvram_config
,
1469 .update_fw_options
= qla81xx_update_fw_options
,
1470 .load_risc
= qla81xx_load_risc
,
1471 .pci_info_str
= qla24xx_pci_info_str
,
1472 .fw_version_str
= qla24xx_fw_version_str
,
1473 .intr_handler
= qla24xx_intr_handler
,
1474 .enable_intrs
= qla24xx_enable_intrs
,
1475 .disable_intrs
= qla24xx_disable_intrs
,
1476 .abort_command
= qla24xx_abort_command
,
1477 .target_reset
= qla24xx_abort_target
,
1478 .lun_reset
= qla24xx_lun_reset
,
1479 .fabric_login
= qla24xx_login_fabric
,
1480 .fabric_logout
= qla24xx_fabric_logout
,
1481 .calc_req_entries
= NULL
,
1482 .build_iocbs
= NULL
,
1483 .prep_ms_iocb
= qla24xx_prep_ms_iocb
,
1484 .prep_ms_fdmi_iocb
= qla24xx_prep_ms_fdmi_iocb
,
1486 .write_nvram
= NULL
,
1487 .fw_dump
= qla81xx_fw_dump
,
1488 .beacon_on
= qla24xx_beacon_on
,
1489 .beacon_off
= qla24xx_beacon_off
,
1490 .beacon_blink
= qla24xx_beacon_blink
,
1491 .read_optrom
= qla25xx_read_optrom_data
,
1492 .write_optrom
= qla24xx_write_optrom_data
,
1493 .get_flash_version
= qla24xx_get_flash_version
,
1494 .start_scsi
= qla24xx_start_scsi
,
1498 qla2x00_set_isp_flags(struct qla_hw_data
*ha
)
1500 ha
->device_type
= DT_EXTENDED_IDS
;
1501 switch (ha
->pdev
->device
) {
1502 case PCI_DEVICE_ID_QLOGIC_ISP2100
:
1503 ha
->device_type
|= DT_ISP2100
;
1504 ha
->device_type
&= ~DT_EXTENDED_IDS
;
1505 ha
->fw_srisc_address
= RISC_START_ADDRESS_2100
;
1507 case PCI_DEVICE_ID_QLOGIC_ISP2200
:
1508 ha
->device_type
|= DT_ISP2200
;
1509 ha
->device_type
&= ~DT_EXTENDED_IDS
;
1510 ha
->fw_srisc_address
= RISC_START_ADDRESS_2100
;
1512 case PCI_DEVICE_ID_QLOGIC_ISP2300
:
1513 ha
->device_type
|= DT_ISP2300
;
1514 ha
->device_type
|= DT_ZIO_SUPPORTED
;
1515 ha
->fw_srisc_address
= RISC_START_ADDRESS_2300
;
1517 case PCI_DEVICE_ID_QLOGIC_ISP2312
:
1518 ha
->device_type
|= DT_ISP2312
;
1519 ha
->device_type
|= DT_ZIO_SUPPORTED
;
1520 ha
->fw_srisc_address
= RISC_START_ADDRESS_2300
;
1522 case PCI_DEVICE_ID_QLOGIC_ISP2322
:
1523 ha
->device_type
|= DT_ISP2322
;
1524 ha
->device_type
|= DT_ZIO_SUPPORTED
;
1525 if (ha
->pdev
->subsystem_vendor
== 0x1028 &&
1526 ha
->pdev
->subsystem_device
== 0x0170)
1527 ha
->device_type
|= DT_OEM_001
;
1528 ha
->fw_srisc_address
= RISC_START_ADDRESS_2300
;
1530 case PCI_DEVICE_ID_QLOGIC_ISP6312
:
1531 ha
->device_type
|= DT_ISP6312
;
1532 ha
->fw_srisc_address
= RISC_START_ADDRESS_2300
;
1534 case PCI_DEVICE_ID_QLOGIC_ISP6322
:
1535 ha
->device_type
|= DT_ISP6322
;
1536 ha
->fw_srisc_address
= RISC_START_ADDRESS_2300
;
1538 case PCI_DEVICE_ID_QLOGIC_ISP2422
:
1539 ha
->device_type
|= DT_ISP2422
;
1540 ha
->device_type
|= DT_ZIO_SUPPORTED
;
1541 ha
->device_type
|= DT_FWI2
;
1542 ha
->device_type
|= DT_IIDMA
;
1543 ha
->fw_srisc_address
= RISC_START_ADDRESS_2400
;
1545 case PCI_DEVICE_ID_QLOGIC_ISP2432
:
1546 ha
->device_type
|= DT_ISP2432
;
1547 ha
->device_type
|= DT_ZIO_SUPPORTED
;
1548 ha
->device_type
|= DT_FWI2
;
1549 ha
->device_type
|= DT_IIDMA
;
1550 ha
->fw_srisc_address
= RISC_START_ADDRESS_2400
;
1552 case PCI_DEVICE_ID_QLOGIC_ISP8432
:
1553 ha
->device_type
|= DT_ISP8432
;
1554 ha
->device_type
|= DT_ZIO_SUPPORTED
;
1555 ha
->device_type
|= DT_FWI2
;
1556 ha
->device_type
|= DT_IIDMA
;
1557 ha
->fw_srisc_address
= RISC_START_ADDRESS_2400
;
1559 case PCI_DEVICE_ID_QLOGIC_ISP5422
:
1560 ha
->device_type
|= DT_ISP5422
;
1561 ha
->device_type
|= DT_FWI2
;
1562 ha
->fw_srisc_address
= RISC_START_ADDRESS_2400
;
1564 case PCI_DEVICE_ID_QLOGIC_ISP5432
:
1565 ha
->device_type
|= DT_ISP5432
;
1566 ha
->device_type
|= DT_FWI2
;
1567 ha
->fw_srisc_address
= RISC_START_ADDRESS_2400
;
1569 case PCI_DEVICE_ID_QLOGIC_ISP2532
:
1570 ha
->device_type
|= DT_ISP2532
;
1571 ha
->device_type
|= DT_ZIO_SUPPORTED
;
1572 ha
->device_type
|= DT_FWI2
;
1573 ha
->device_type
|= DT_IIDMA
;
1574 ha
->fw_srisc_address
= RISC_START_ADDRESS_2400
;
1576 case PCI_DEVICE_ID_QLOGIC_ISP8001
:
1577 ha
->device_type
|= DT_ISP8001
;
1578 ha
->device_type
|= DT_ZIO_SUPPORTED
;
1579 ha
->device_type
|= DT_FWI2
;
1580 ha
->device_type
|= DT_IIDMA
;
1581 ha
->fw_srisc_address
= RISC_START_ADDRESS_2400
;
1587 qla2x00_iospace_config(struct qla_hw_data
*ha
)
1589 resource_size_t pio
;
1593 if (pci_request_selected_regions(ha
->pdev
, ha
->bars
,
1594 QLA2XXX_DRIVER_NAME
)) {
1595 qla_printk(KERN_WARNING
, ha
,
1596 "Failed to reserve PIO/MMIO regions (%s)\n",
1597 pci_name(ha
->pdev
));
1599 goto iospace_error_exit
;
1601 if (!(ha
->bars
& 1))
1604 /* We only need PIO for Flash operations on ISP2312 v2 chips. */
1605 pio
= pci_resource_start(ha
->pdev
, 0);
1606 if (pci_resource_flags(ha
->pdev
, 0) & IORESOURCE_IO
) {
1607 if (pci_resource_len(ha
->pdev
, 0) < MIN_IOBASE_LEN
) {
1608 qla_printk(KERN_WARNING
, ha
,
1609 "Invalid PCI I/O region size (%s)...\n",
1610 pci_name(ha
->pdev
));
1614 qla_printk(KERN_WARNING
, ha
,
1615 "region #0 not a PIO resource (%s)...\n",
1616 pci_name(ha
->pdev
));
1619 ha
->pio_address
= pio
;
1622 /* Use MMIO operations for all accesses. */
1623 if (!(pci_resource_flags(ha
->pdev
, 1) & IORESOURCE_MEM
)) {
1624 qla_printk(KERN_ERR
, ha
,
1625 "region #1 not an MMIO resource (%s), aborting\n",
1626 pci_name(ha
->pdev
));
1627 goto iospace_error_exit
;
1629 if (pci_resource_len(ha
->pdev
, 1) < MIN_IOBASE_LEN
) {
1630 qla_printk(KERN_ERR
, ha
,
1631 "Invalid PCI mem region size (%s), aborting\n",
1632 pci_name(ha
->pdev
));
1633 goto iospace_error_exit
;
1636 ha
->iobase
= ioremap(pci_resource_start(ha
->pdev
, 1), MIN_IOBASE_LEN
);
1638 qla_printk(KERN_ERR
, ha
,
1639 "cannot remap MMIO (%s), aborting\n", pci_name(ha
->pdev
));
1641 goto iospace_error_exit
;
1644 /* Determine queue resources */
1645 ha
->max_req_queues
= ha
->max_rsp_queues
= 1;
1646 if ((ql2xmaxqueues
<= 1 || ql2xmultique_tag
< 1) &&
1647 (!IS_QLA25XX(ha
) && !IS_QLA81XX(ha
)))
1649 ha
->mqiobase
= ioremap(pci_resource_start(ha
->pdev
, 3),
1650 pci_resource_len(ha
->pdev
, 3));
1652 /* Read MSIX vector size of the board */
1653 pci_read_config_word(ha
->pdev
, QLA_PCI_MSIX_CONTROL
, &msix
);
1654 ha
->msix_count
= msix
;
1655 /* Max queues are bounded by available msix vectors */
1656 /* queue 0 uses two msix vectors */
1657 if (ql2xmultique_tag
) {
1658 cpus
= num_online_cpus();
1659 ha
->max_rsp_queues
= (ha
->msix_count
- 1 - cpus
) ?
1660 (cpus
+ 1) : (ha
->msix_count
- 1);
1661 ha
->max_req_queues
= 2;
1662 } else if (ql2xmaxqueues
> 1) {
1663 ha
->max_req_queues
= ql2xmaxqueues
> QLA_MQ_SIZE
?
1664 QLA_MQ_SIZE
: ql2xmaxqueues
;
1665 DEBUG2(qla_printk(KERN_INFO
, ha
, "QoS mode set, max no"
1666 " of request queues:%d\n", ha
->max_req_queues
));
1668 qla_printk(KERN_INFO
, ha
,
1669 "MSI-X vector count: %d\n", msix
);
1671 qla_printk(KERN_INFO
, ha
, "BAR 3 not enabled\n");
1674 ha
->msix_count
= ha
->max_rsp_queues
+ 1;
1682 qla2xxx_scan_start(struct Scsi_Host
*shost
)
1684 scsi_qla_host_t
*vha
= shost_priv(shost
);
1686 set_bit(LOOP_RESYNC_NEEDED
, &vha
->dpc_flags
);
1687 set_bit(LOCAL_LOOP_UPDATE
, &vha
->dpc_flags
);
1688 set_bit(RSCN_UPDATE
, &vha
->dpc_flags
);
1689 set_bit(NPIV_CONFIG_NEEDED
, &vha
->dpc_flags
);
1693 qla2xxx_scan_finished(struct Scsi_Host
*shost
, unsigned long time
)
1695 scsi_qla_host_t
*vha
= shost_priv(shost
);
1699 if (time
> vha
->hw
->loop_reset_delay
* HZ
)
1702 return atomic_read(&vha
->loop_state
) == LOOP_READY
;
1706 * PCI driver interface
1708 static int __devinit
1709 qla2x00_probe_one(struct pci_dev
*pdev
, const struct pci_device_id
*id
)
1712 struct Scsi_Host
*host
;
1713 scsi_qla_host_t
*base_vha
= NULL
;
1714 struct qla_hw_data
*ha
;
1717 struct scsi_host_template
*sht
;
1718 int bars
, max_id
, mem_only
= 0;
1719 uint16_t req_length
= 0, rsp_length
= 0;
1720 struct req_que
*req
= NULL
;
1721 struct rsp_que
*rsp
= NULL
;
1723 bars
= pci_select_bars(pdev
, IORESOURCE_MEM
| IORESOURCE_IO
);
1724 sht
= &qla2xxx_driver_template
;
1725 if (pdev
->device
== PCI_DEVICE_ID_QLOGIC_ISP2422
||
1726 pdev
->device
== PCI_DEVICE_ID_QLOGIC_ISP2432
||
1727 pdev
->device
== PCI_DEVICE_ID_QLOGIC_ISP8432
||
1728 pdev
->device
== PCI_DEVICE_ID_QLOGIC_ISP5422
||
1729 pdev
->device
== PCI_DEVICE_ID_QLOGIC_ISP5432
||
1730 pdev
->device
== PCI_DEVICE_ID_QLOGIC_ISP2532
||
1731 pdev
->device
== PCI_DEVICE_ID_QLOGIC_ISP8001
) {
1732 bars
= pci_select_bars(pdev
, IORESOURCE_MEM
);
1737 if (pci_enable_device_mem(pdev
))
1740 if (pci_enable_device(pdev
))
1744 /* This may fail but that's ok */
1745 pci_enable_pcie_error_reporting(pdev
);
1747 ha
= kzalloc(sizeof(struct qla_hw_data
), GFP_KERNEL
);
1749 DEBUG(printk("Unable to allocate memory for ha\n"));
1754 /* Clear our data area */
1756 ha
->mem_only
= mem_only
;
1757 spin_lock_init(&ha
->hardware_lock
);
1759 /* Set ISP-type information. */
1760 qla2x00_set_isp_flags(ha
);
1761 /* Configure PCI I/O space */
1762 ret
= qla2x00_iospace_config(ha
);
1764 goto probe_hw_failed
;
1766 qla_printk(KERN_INFO
, ha
,
1767 "Found an ISP%04X, irq %d, iobase 0x%p\n", pdev
->device
, pdev
->irq
,
1770 ha
->prev_topology
= 0;
1771 ha
->init_cb_size
= sizeof(init_cb_t
);
1772 ha
->link_data_rate
= PORT_SPEED_UNKNOWN
;
1773 ha
->optrom_size
= OPTROM_SIZE_2300
;
1775 /* Assign ISP specific operations. */
1776 max_id
= MAX_TARGETS_2200
;
1777 if (IS_QLA2100(ha
)) {
1778 max_id
= MAX_TARGETS_2100
;
1779 ha
->mbx_count
= MAILBOX_REGISTER_COUNT_2100
;
1780 req_length
= REQUEST_ENTRY_CNT_2100
;
1781 rsp_length
= RESPONSE_ENTRY_CNT_2100
;
1782 ha
->max_loop_id
= SNS_LAST_LOOP_ID_2100
;
1783 ha
->gid_list_info_size
= 4;
1784 ha
->flash_conf_off
= ~0;
1785 ha
->flash_data_off
= ~0;
1786 ha
->nvram_conf_off
= ~0;
1787 ha
->nvram_data_off
= ~0;
1788 ha
->isp_ops
= &qla2100_isp_ops
;
1789 } else if (IS_QLA2200(ha
)) {
1790 ha
->mbx_count
= MAILBOX_REGISTER_COUNT
;
1791 req_length
= REQUEST_ENTRY_CNT_2200
;
1792 rsp_length
= RESPONSE_ENTRY_CNT_2100
;
1793 ha
->max_loop_id
= SNS_LAST_LOOP_ID_2100
;
1794 ha
->gid_list_info_size
= 4;
1795 ha
->flash_conf_off
= ~0;
1796 ha
->flash_data_off
= ~0;
1797 ha
->nvram_conf_off
= ~0;
1798 ha
->nvram_data_off
= ~0;
1799 ha
->isp_ops
= &qla2100_isp_ops
;
1800 } else if (IS_QLA23XX(ha
)) {
1801 ha
->mbx_count
= MAILBOX_REGISTER_COUNT
;
1802 req_length
= REQUEST_ENTRY_CNT_2200
;
1803 rsp_length
= RESPONSE_ENTRY_CNT_2300
;
1804 ha
->max_loop_id
= SNS_LAST_LOOP_ID_2300
;
1805 ha
->gid_list_info_size
= 6;
1806 if (IS_QLA2322(ha
) || IS_QLA6322(ha
))
1807 ha
->optrom_size
= OPTROM_SIZE_2322
;
1808 ha
->flash_conf_off
= ~0;
1809 ha
->flash_data_off
= ~0;
1810 ha
->nvram_conf_off
= ~0;
1811 ha
->nvram_data_off
= ~0;
1812 ha
->isp_ops
= &qla2300_isp_ops
;
1813 } else if (IS_QLA24XX_TYPE(ha
)) {
1814 ha
->mbx_count
= MAILBOX_REGISTER_COUNT
;
1815 req_length
= REQUEST_ENTRY_CNT_24XX
;
1816 rsp_length
= RESPONSE_ENTRY_CNT_2300
;
1817 ha
->max_loop_id
= SNS_LAST_LOOP_ID_2300
;
1818 ha
->init_cb_size
= sizeof(struct mid_init_cb_24xx
);
1819 ha
->gid_list_info_size
= 8;
1820 ha
->optrom_size
= OPTROM_SIZE_24XX
;
1821 ha
->nvram_npiv_size
= QLA_MAX_VPORTS_QLA24XX
;
1822 ha
->isp_ops
= &qla24xx_isp_ops
;
1823 ha
->flash_conf_off
= FARX_ACCESS_FLASH_CONF
;
1824 ha
->flash_data_off
= FARX_ACCESS_FLASH_DATA
;
1825 ha
->nvram_conf_off
= FARX_ACCESS_NVRAM_CONF
;
1826 ha
->nvram_data_off
= FARX_ACCESS_NVRAM_DATA
;
1827 } else if (IS_QLA25XX(ha
)) {
1828 ha
->mbx_count
= MAILBOX_REGISTER_COUNT
;
1829 req_length
= REQUEST_ENTRY_CNT_24XX
;
1830 rsp_length
= RESPONSE_ENTRY_CNT_2300
;
1831 ha
->max_loop_id
= SNS_LAST_LOOP_ID_2300
;
1832 ha
->init_cb_size
= sizeof(struct mid_init_cb_24xx
);
1833 ha
->gid_list_info_size
= 8;
1834 ha
->optrom_size
= OPTROM_SIZE_25XX
;
1835 ha
->nvram_npiv_size
= QLA_MAX_VPORTS_QLA25XX
;
1836 ha
->isp_ops
= &qla25xx_isp_ops
;
1837 ha
->flash_conf_off
= FARX_ACCESS_FLASH_CONF
;
1838 ha
->flash_data_off
= FARX_ACCESS_FLASH_DATA
;
1839 ha
->nvram_conf_off
= FARX_ACCESS_NVRAM_CONF
;
1840 ha
->nvram_data_off
= FARX_ACCESS_NVRAM_DATA
;
1841 } else if (IS_QLA81XX(ha
)) {
1842 ha
->mbx_count
= MAILBOX_REGISTER_COUNT
;
1843 req_length
= REQUEST_ENTRY_CNT_24XX
;
1844 rsp_length
= RESPONSE_ENTRY_CNT_2300
;
1845 ha
->max_loop_id
= SNS_LAST_LOOP_ID_2300
;
1846 ha
->init_cb_size
= sizeof(struct mid_init_cb_81xx
);
1847 ha
->gid_list_info_size
= 8;
1848 ha
->optrom_size
= OPTROM_SIZE_81XX
;
1849 ha
->isp_ops
= &qla81xx_isp_ops
;
1850 ha
->flash_conf_off
= FARX_ACCESS_FLASH_CONF_81XX
;
1851 ha
->flash_data_off
= FARX_ACCESS_FLASH_DATA_81XX
;
1852 ha
->nvram_conf_off
= ~0;
1853 ha
->nvram_data_off
= ~0;
1856 mutex_init(&ha
->vport_lock
);
1857 init_completion(&ha
->mbx_cmd_comp
);
1858 complete(&ha
->mbx_cmd_comp
);
1859 init_completion(&ha
->mbx_intr_comp
);
1861 set_bit(0, (unsigned long *) ha
->vp_idx_map
);
1863 qla2x00_config_dma_addressing(ha
);
1864 ret
= qla2x00_mem_alloc(ha
, req_length
, rsp_length
, &req
, &rsp
);
1866 qla_printk(KERN_WARNING
, ha
,
1867 "[ERROR] Failed to allocate memory for adapter\n");
1869 goto probe_hw_failed
;
1872 req
->max_q_depth
= MAX_Q_DEPTH
;
1873 if (ql2xmaxqdepth
!= 0 && ql2xmaxqdepth
<= 0xffffU
)
1874 req
->max_q_depth
= ql2xmaxqdepth
;
1877 base_vha
= qla2x00_create_host(sht
, ha
);
1879 qla_printk(KERN_WARNING
, ha
,
1880 "[ERROR] Failed to allocate memory for scsi_host\n");
1883 qla2x00_mem_free(ha
);
1884 qla2x00_free_req_que(ha
, req
);
1885 qla2x00_free_rsp_que(ha
, rsp
);
1886 goto probe_hw_failed
;
1889 pci_set_drvdata(pdev
, base_vha
);
1891 host
= base_vha
->host
;
1892 base_vha
->req
= req
;
1893 host
->can_queue
= req
->length
+ 128;
1894 if (IS_QLA2XXX_MIDTYPE(ha
))
1895 base_vha
->mgmt_svr_loop_id
= 10 + base_vha
->vp_idx
;
1897 base_vha
->mgmt_svr_loop_id
= MANAGEMENT_SERVER
+
1900 host
->sg_tablesize
= 32;
1901 host
->max_id
= max_id
;
1902 host
->this_id
= 255;
1903 host
->cmd_per_lun
= 3;
1904 host
->unique_id
= host
->host_no
;
1905 host
->max_cmd_len
= MAX_CMDSZ
;
1906 host
->max_channel
= MAX_BUSES
- 1;
1907 host
->max_lun
= MAX_LUNS
;
1908 host
->transportt
= qla2xxx_transport_template
;
1910 /* Set up the irqs */
1911 ret
= qla2x00_request_irqs(ha
, rsp
);
1913 goto probe_init_failed
;
1914 /* Alloc arrays of request and response ring ptrs */
1915 if (!qla2x00_alloc_queues(ha
)) {
1916 qla_printk(KERN_WARNING
, ha
,
1917 "[ERROR] Failed to allocate memory for queue"
1919 goto probe_init_failed
;
1921 ha
->rsp_q_map
[0] = rsp
;
1922 ha
->req_q_map
[0] = req
;
1925 set_bit(0, ha
->req_qid_map
);
1926 set_bit(0, ha
->rsp_qid_map
);
1927 /* FWI2-capable only. */
1928 req
->req_q_in
= &ha
->iobase
->isp24
.req_q_in
;
1929 req
->req_q_out
= &ha
->iobase
->isp24
.req_q_out
;
1930 rsp
->rsp_q_in
= &ha
->iobase
->isp24
.rsp_q_in
;
1931 rsp
->rsp_q_out
= &ha
->iobase
->isp24
.rsp_q_out
;
1933 req
->req_q_in
= &ha
->mqiobase
->isp25mq
.req_q_in
;
1934 req
->req_q_out
= &ha
->mqiobase
->isp25mq
.req_q_out
;
1935 rsp
->rsp_q_in
= &ha
->mqiobase
->isp25mq
.rsp_q_in
;
1936 rsp
->rsp_q_out
= &ha
->mqiobase
->isp25mq
.rsp_q_out
;
1939 if (qla2x00_initialize_adapter(base_vha
)) {
1940 qla_printk(KERN_WARNING
, ha
,
1941 "Failed to initialize adapter\n");
1943 DEBUG2(printk("scsi(%ld): Failed to initialize adapter - "
1944 "Adapter flags %x.\n",
1945 base_vha
->host_no
, base_vha
->device_flags
));
1952 if (qla25xx_setup_mode(base_vha
))
1953 qla_printk(KERN_WARNING
, ha
,
1954 "Can't create queues, falling back to single"
1958 * Startup the kernel thread for this host adapter
1960 ha
->dpc_thread
= kthread_create(qla2x00_do_dpc
, ha
,
1961 "%s_dpc", base_vha
->host_str
);
1962 if (IS_ERR(ha
->dpc_thread
)) {
1963 qla_printk(KERN_WARNING
, ha
,
1964 "Unable to start DPC thread!\n");
1965 ret
= PTR_ERR(ha
->dpc_thread
);
1969 list_add_tail(&base_vha
->list
, &ha
->vp_list
);
1970 base_vha
->host
->irq
= ha
->pdev
->irq
;
1972 /* Initialized the timer */
1973 qla2x00_start_timer(base_vha
, qla2x00_timer
, WATCH_INTERVAL
);
1975 DEBUG2(printk("DEBUG: detect hba %ld at address = %p\n",
1976 base_vha
->host_no
, ha
));
1978 base_vha
->flags
.init_done
= 1;
1979 base_vha
->flags
.online
= 1;
1981 ret
= scsi_add_host(host
, &pdev
->dev
);
1985 ha
->isp_ops
->enable_intrs(ha
);
1987 scsi_scan_host(host
);
1989 qla2x00_alloc_sysfs_attr(base_vha
);
1991 qla2x00_init_host_attr(base_vha
);
1993 qla2x00_dfs_setup(base_vha
);
1995 qla_printk(KERN_INFO
, ha
, "\n"
1996 " QLogic Fibre Channel HBA Driver: %s\n"
1998 " ISP%04X: %s @ %s hdma%c, host#=%ld, fw=%s\n",
1999 qla2x00_version_str
, ha
->model_number
,
2000 ha
->model_desc
? ha
->model_desc
: "", pdev
->device
,
2001 ha
->isp_ops
->pci_info_str(base_vha
, pci_info
), pci_name(pdev
),
2002 ha
->flags
.enable_64bit_addressing
? '+' : '-', base_vha
->host_no
,
2003 ha
->isp_ops
->fw_version_str(base_vha
, fw_str
));
2008 qla2x00_free_req_que(ha
, req
);
2009 qla2x00_free_rsp_que(ha
, rsp
);
2010 ha
->max_req_queues
= ha
->max_rsp_queues
= 0;
2013 if (base_vha
->timer_active
)
2014 qla2x00_stop_timer(base_vha
);
2015 base_vha
->flags
.online
= 0;
2016 if (ha
->dpc_thread
) {
2017 struct task_struct
*t
= ha
->dpc_thread
;
2019 ha
->dpc_thread
= NULL
;
2023 qla2x00_free_device(base_vha
);
2025 scsi_host_put(base_vha
->host
);
2029 iounmap(ha
->iobase
);
2031 pci_release_selected_regions(ha
->pdev
, ha
->bars
);
2036 pci_disable_device(pdev
);
2041 qla2x00_remove_one(struct pci_dev
*pdev
)
2043 scsi_qla_host_t
*base_vha
, *vha
, *temp
;
2044 struct qla_hw_data
*ha
;
2046 base_vha
= pci_get_drvdata(pdev
);
2049 list_for_each_entry_safe(vha
, temp
, &ha
->vp_list
, list
) {
2050 if (vha
&& vha
->fc_vport
)
2051 fc_vport_terminate(vha
->fc_vport
);
2054 set_bit(UNLOADING
, &base_vha
->dpc_flags
);
2056 qla2x00_abort_all_cmds(base_vha
, DID_NO_CONNECT
<< 16);
2058 qla2x00_dfs_remove(base_vha
);
2060 qla84xx_put_chip(base_vha
);
2063 if (base_vha
->timer_active
)
2064 qla2x00_stop_timer(base_vha
);
2066 base_vha
->flags
.online
= 0;
2068 /* Flush the work queue and remove it */
2070 flush_workqueue(ha
->wq
);
2071 destroy_workqueue(ha
->wq
);
2075 /* Kill the kernel thread for this host */
2076 if (ha
->dpc_thread
) {
2077 struct task_struct
*t
= ha
->dpc_thread
;
2080 * qla2xxx_wake_dpc checks for ->dpc_thread
2081 * so we need to zero it out.
2083 ha
->dpc_thread
= NULL
;
2087 qla2x00_free_sysfs_attr(base_vha
);
2089 fc_remove_host(base_vha
->host
);
2091 scsi_remove_host(base_vha
->host
);
2093 qla2x00_free_device(base_vha
);
2095 scsi_host_put(base_vha
->host
);
2098 iounmap(ha
->iobase
);
2101 iounmap(ha
->mqiobase
);
2103 pci_release_selected_regions(ha
->pdev
, ha
->bars
);
2107 pci_disable_device(pdev
);
2108 pci_set_drvdata(pdev
, NULL
);
2112 qla2x00_free_device(scsi_qla_host_t
*vha
)
2114 struct qla_hw_data
*ha
= vha
->hw
;
2116 qla25xx_delete_queues(vha
);
2118 if (ha
->flags
.fce_enabled
)
2119 qla2x00_disable_fce_trace(vha
, NULL
, NULL
);
2122 qla2x00_disable_eft_trace(vha
);
2124 /* Stop currently executing firmware. */
2125 qla2x00_try_to_stop_firmware(vha
);
2127 /* turn-off interrupts on the card */
2128 if (ha
->interrupts_on
)
2129 ha
->isp_ops
->disable_intrs(ha
);
2131 qla2x00_free_irqs(vha
);
2133 qla2x00_mem_free(ha
);
2135 qla2x00_free_queues(ha
);
2139 qla2x00_schedule_rport_del(struct scsi_qla_host
*vha
, fc_port_t
*fcport
,
2142 struct fc_rport
*rport
;
2147 rport
= fcport
->rport
;
2149 spin_lock_irq(vha
->host
->host_lock
);
2150 fcport
->drport
= rport
;
2151 spin_unlock_irq(vha
->host
->host_lock
);
2152 set_bit(FCPORT_UPDATE_NEEDED
, &vha
->dpc_flags
);
2153 qla2xxx_wake_dpc(vha
);
2155 fc_remote_port_delete(rport
);
2159 * qla2x00_mark_device_lost Updates fcport state when device goes offline.
2161 * Input: ha = adapter block pointer. fcport = port structure pointer.
2167 void qla2x00_mark_device_lost(scsi_qla_host_t
*vha
, fc_port_t
*fcport
,
2168 int do_login
, int defer
)
2170 if (atomic_read(&fcport
->state
) == FCS_ONLINE
&&
2171 vha
->vp_idx
== fcport
->vp_idx
) {
2172 atomic_set(&fcport
->state
, FCS_DEVICE_LOST
);
2173 qla2x00_schedule_rport_del(vha
, fcport
, defer
);
2176 * We may need to retry the login, so don't change the state of the
2177 * port but do the retries.
2179 if (atomic_read(&fcport
->state
) != FCS_DEVICE_DEAD
)
2180 atomic_set(&fcport
->state
, FCS_DEVICE_LOST
);
2185 if (fcport
->login_retry
== 0) {
2186 fcport
->login_retry
= vha
->hw
->login_retry_count
;
2187 set_bit(RELOGIN_NEEDED
, &vha
->dpc_flags
);
2189 DEBUG(printk("scsi(%ld): Port login retry: "
2190 "%02x%02x%02x%02x%02x%02x%02x%02x, "
2191 "id = 0x%04x retry cnt=%d\n",
2193 fcport
->port_name
[0],
2194 fcport
->port_name
[1],
2195 fcport
->port_name
[2],
2196 fcport
->port_name
[3],
2197 fcport
->port_name
[4],
2198 fcport
->port_name
[5],
2199 fcport
->port_name
[6],
2200 fcport
->port_name
[7],
2202 fcport
->login_retry
));
2207 * qla2x00_mark_all_devices_lost
2208 * Updates fcport state when device goes offline.
2211 * ha = adapter block pointer.
2212 * fcport = port structure pointer.
2220 qla2x00_mark_all_devices_lost(scsi_qla_host_t
*vha
, int defer
)
2224 list_for_each_entry(fcport
, &vha
->vp_fcports
, list
) {
2225 if (vha
->vp_idx
!= fcport
->vp_idx
)
2228 * No point in marking the device as lost, if the device is
2231 if (atomic_read(&fcport
->state
) == FCS_DEVICE_DEAD
)
2233 if (atomic_read(&fcport
->state
) == FCS_ONLINE
) {
2234 atomic_set(&fcport
->state
, FCS_DEVICE_LOST
);
2235 qla2x00_schedule_rport_del(vha
, fcport
, defer
);
2237 atomic_set(&fcport
->state
, FCS_DEVICE_LOST
);
2243 * Allocates adapter memory.
2250 qla2x00_mem_alloc(struct qla_hw_data
*ha
, uint16_t req_len
, uint16_t rsp_len
,
2251 struct req_que
**req
, struct rsp_que
**rsp
)
2255 ha
->init_cb
= dma_alloc_coherent(&ha
->pdev
->dev
, ha
->init_cb_size
,
2256 &ha
->init_cb_dma
, GFP_KERNEL
);
2260 ha
->gid_list
= dma_alloc_coherent(&ha
->pdev
->dev
, GID_LIST_SIZE
,
2261 &ha
->gid_list_dma
, GFP_KERNEL
);
2263 goto fail_free_init_cb
;
2265 ha
->srb_mempool
= mempool_create_slab_pool(SRB_MIN_REQ
, srb_cachep
);
2266 if (!ha
->srb_mempool
)
2267 goto fail_free_gid_list
;
2269 /* Get memory for cached NVRAM */
2270 ha
->nvram
= kzalloc(MAX_NVRAM_SIZE
, GFP_KERNEL
);
2272 goto fail_free_srb_mempool
;
2274 snprintf(name
, sizeof(name
), "%s_%d", QLA2XXX_DRIVER_NAME
,
2276 ha
->s_dma_pool
= dma_pool_create(name
, &ha
->pdev
->dev
,
2277 DMA_POOL_SIZE
, 8, 0);
2278 if (!ha
->s_dma_pool
)
2279 goto fail_free_nvram
;
2281 /* Allocate memory for SNS commands */
2282 if (IS_QLA2100(ha
) || IS_QLA2200(ha
)) {
2283 /* Get consistent memory allocated for SNS commands */
2284 ha
->sns_cmd
= dma_alloc_coherent(&ha
->pdev
->dev
,
2285 sizeof(struct sns_cmd_pkt
), &ha
->sns_cmd_dma
, GFP_KERNEL
);
2289 /* Get consistent memory allocated for MS IOCB */
2290 ha
->ms_iocb
= dma_pool_alloc(ha
->s_dma_pool
, GFP_KERNEL
,
2294 /* Get consistent memory allocated for CT SNS commands */
2295 ha
->ct_sns
= dma_alloc_coherent(&ha
->pdev
->dev
,
2296 sizeof(struct ct_sns_pkt
), &ha
->ct_sns_dma
, GFP_KERNEL
);
2298 goto fail_free_ms_iocb
;
2301 /* Allocate memory for request ring */
2302 *req
= kzalloc(sizeof(struct req_que
), GFP_KERNEL
);
2304 DEBUG(printk("Unable to allocate memory for req\n"));
2307 (*req
)->length
= req_len
;
2308 (*req
)->ring
= dma_alloc_coherent(&ha
->pdev
->dev
,
2309 ((*req
)->length
+ 1) * sizeof(request_t
),
2310 &(*req
)->dma
, GFP_KERNEL
);
2311 if (!(*req
)->ring
) {
2312 DEBUG(printk("Unable to allocate memory for req_ring\n"));
2315 /* Allocate memory for response ring */
2316 *rsp
= kzalloc(sizeof(struct rsp_que
), GFP_KERNEL
);
2318 qla_printk(KERN_WARNING
, ha
,
2319 "Unable to allocate memory for rsp\n");
2323 (*rsp
)->length
= rsp_len
;
2324 (*rsp
)->ring
= dma_alloc_coherent(&ha
->pdev
->dev
,
2325 ((*rsp
)->length
+ 1) * sizeof(response_t
),
2326 &(*rsp
)->dma
, GFP_KERNEL
);
2327 if (!(*rsp
)->ring
) {
2328 qla_printk(KERN_WARNING
, ha
,
2329 "Unable to allocate memory for rsp_ring\n");
2334 /* Allocate memory for NVRAM data for vports */
2335 if (ha
->nvram_npiv_size
) {
2336 ha
->npiv_info
= kzalloc(sizeof(struct qla_npiv_entry
) *
2337 ha
->nvram_npiv_size
, GFP_KERNEL
);
2338 if (!ha
->npiv_info
) {
2339 qla_printk(KERN_WARNING
, ha
,
2340 "Unable to allocate memory for npiv info\n");
2341 goto fail_npiv_info
;
2344 ha
->npiv_info
= NULL
;
2346 /* Get consistent memory allocated for EX-INIT-CB. */
2347 if (IS_QLA81XX(ha
)) {
2348 ha
->ex_init_cb
= dma_pool_alloc(ha
->s_dma_pool
, GFP_KERNEL
,
2349 &ha
->ex_init_cb_dma
);
2350 if (!ha
->ex_init_cb
)
2351 goto fail_ex_init_cb
;
2354 INIT_LIST_HEAD(&ha
->vp_list
);
2358 kfree(ha
->npiv_info
);
2360 dma_free_coherent(&ha
->pdev
->dev
, ((*rsp
)->length
+ 1) *
2361 sizeof(response_t
), (*rsp
)->ring
, (*rsp
)->dma
);
2362 (*rsp
)->ring
= NULL
;
2367 dma_free_coherent(&ha
->pdev
->dev
, ((*req
)->length
+ 1) *
2368 sizeof(request_t
), (*req
)->ring
, (*req
)->dma
);
2369 (*req
)->ring
= NULL
;
2374 dma_free_coherent(&ha
->pdev
->dev
, sizeof(struct ct_sns_pkt
),
2375 ha
->ct_sns
, ha
->ct_sns_dma
);
2379 dma_pool_free(ha
->s_dma_pool
, ha
->ms_iocb
, ha
->ms_iocb_dma
);
2381 ha
->ms_iocb_dma
= 0;
2383 dma_pool_destroy(ha
->s_dma_pool
);
2384 ha
->s_dma_pool
= NULL
;
2388 fail_free_srb_mempool
:
2389 mempool_destroy(ha
->srb_mempool
);
2390 ha
->srb_mempool
= NULL
;
2392 dma_free_coherent(&ha
->pdev
->dev
, GID_LIST_SIZE
, ha
->gid_list
,
2394 ha
->gid_list
= NULL
;
2395 ha
->gid_list_dma
= 0;
2397 dma_free_coherent(&ha
->pdev
->dev
, ha
->init_cb_size
, ha
->init_cb
,
2400 ha
->init_cb_dma
= 0;
2402 DEBUG(printk("%s: Memory allocation failure\n", __func__
));
2408 * Frees all adapter allocated memory.
2411 * ha = adapter block pointer.
2414 qla2x00_mem_free(struct qla_hw_data
*ha
)
2416 if (ha
->srb_mempool
)
2417 mempool_destroy(ha
->srb_mempool
);
2420 dma_free_coherent(&ha
->pdev
->dev
, FCE_SIZE
, ha
->fce
,
2425 dma_free_coherent(&ha
->pdev
->dev
,
2426 ntohl(ha
->fw_dump
->eft_size
), ha
->eft
, ha
->eft_dma
);
2431 dma_free_coherent(&ha
->pdev
->dev
, sizeof(struct sns_cmd_pkt
),
2432 ha
->sns_cmd
, ha
->sns_cmd_dma
);
2435 dma_free_coherent(&ha
->pdev
->dev
, sizeof(struct ct_sns_pkt
),
2436 ha
->ct_sns
, ha
->ct_sns_dma
);
2439 dma_pool_free(ha
->s_dma_pool
, ha
->sfp_data
, ha
->sfp_data_dma
);
2442 dma_pool_free(ha
->s_dma_pool
, ha
->edc_data
, ha
->edc_data_dma
);
2445 dma_pool_free(ha
->s_dma_pool
, ha
->ms_iocb
, ha
->ms_iocb_dma
);
2448 dma_pool_free(ha
->s_dma_pool
, ha
->ex_init_cb
, ha
->ex_init_cb_dma
);
2451 dma_pool_destroy(ha
->s_dma_pool
);
2454 dma_free_coherent(&ha
->pdev
->dev
, GID_LIST_SIZE
, ha
->gid_list
,
2458 dma_free_coherent(&ha
->pdev
->dev
, ha
->init_cb_size
,
2459 ha
->init_cb
, ha
->init_cb_dma
);
2460 vfree(ha
->optrom_buffer
);
2462 kfree(ha
->npiv_info
);
2464 ha
->srb_mempool
= NULL
;
2468 ha
->sns_cmd_dma
= 0;
2472 ha
->ms_iocb_dma
= 0;
2474 ha
->init_cb_dma
= 0;
2475 ha
->ex_init_cb
= NULL
;
2476 ha
->ex_init_cb_dma
= 0;
2478 ha
->s_dma_pool
= NULL
;
2480 ha
->gid_list
= NULL
;
2481 ha
->gid_list_dma
= 0;
2485 ha
->fw_dump_reading
= 0;
2488 struct scsi_qla_host
*qla2x00_create_host(struct scsi_host_template
*sht
,
2489 struct qla_hw_data
*ha
)
2491 struct Scsi_Host
*host
;
2492 struct scsi_qla_host
*vha
= NULL
;
2494 host
= scsi_host_alloc(sht
, sizeof(scsi_qla_host_t
));
2497 "qla2xxx: Couldn't allocate host from scsi layer!\n");
2501 /* Clear our data area */
2502 vha
= shost_priv(host
);
2503 memset(vha
, 0, sizeof(scsi_qla_host_t
));
2506 vha
->host_no
= host
->host_no
;
2509 INIT_LIST_HEAD(&vha
->vp_fcports
);
2510 INIT_LIST_HEAD(&vha
->work_list
);
2511 INIT_LIST_HEAD(&vha
->list
);
2513 sprintf(vha
->host_str
, "%s_%ld", QLA2XXX_DRIVER_NAME
, vha
->host_no
);
2520 static struct qla_work_evt
*
2521 qla2x00_alloc_work(struct scsi_qla_host
*vha
, enum qla_work_type type
,
2524 struct qla_work_evt
*e
;
2526 e
= kzalloc(sizeof(struct qla_work_evt
), locked
? GFP_ATOMIC
:
2531 INIT_LIST_HEAD(&e
->list
);
2533 e
->flags
= QLA_EVT_FLAG_FREE
;
2538 qla2x00_post_work(struct scsi_qla_host
*vha
, struct qla_work_evt
*e
, int locked
)
2540 unsigned long uninitialized_var(flags
);
2541 struct qla_hw_data
*ha
= vha
->hw
;
2544 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
2545 list_add_tail(&e
->list
, &vha
->work_list
);
2546 qla2xxx_wake_dpc(vha
);
2548 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
2553 qla2x00_post_aen_work(struct scsi_qla_host
*vha
, enum fc_host_event_code code
,
2556 struct qla_work_evt
*e
;
2558 e
= qla2x00_alloc_work(vha
, QLA_EVT_AEN
, 1);
2560 return QLA_FUNCTION_FAILED
;
2562 e
->u
.aen
.code
= code
;
2563 e
->u
.aen
.data
= data
;
2564 return qla2x00_post_work(vha
, e
, 1);
2568 qla2x00_post_idc_ack_work(struct scsi_qla_host
*vha
, uint16_t *mb
)
2570 struct qla_work_evt
*e
;
2572 e
= qla2x00_alloc_work(vha
, QLA_EVT_IDC_ACK
, 1);
2574 return QLA_FUNCTION_FAILED
;
2576 memcpy(e
->u
.idc_ack
.mb
, mb
, QLA_IDC_ACK_REGS
* sizeof(uint16_t));
2577 return qla2x00_post_work(vha
, e
, 1);
2581 qla2x00_do_work(struct scsi_qla_host
*vha
)
2583 struct qla_work_evt
*e
;
2584 struct qla_hw_data
*ha
= vha
->hw
;
2586 spin_lock_irq(&ha
->hardware_lock
);
2587 while (!list_empty(&vha
->work_list
)) {
2588 e
= list_entry(vha
->work_list
.next
, struct qla_work_evt
, list
);
2589 list_del_init(&e
->list
);
2590 spin_unlock_irq(&ha
->hardware_lock
);
2594 fc_host_post_event(vha
->host
, fc_get_event_number(),
2595 e
->u
.aen
.code
, e
->u
.aen
.data
);
2597 case QLA_EVT_IDC_ACK
:
2598 qla81xx_idc_ack(vha
, e
->u
.idc_ack
.mb
);
2601 if (e
->flags
& QLA_EVT_FLAG_FREE
)
2603 spin_lock_irq(&ha
->hardware_lock
);
2605 spin_unlock_irq(&ha
->hardware_lock
);
2607 /* Relogins all the fcports of a vport
2608 * Context: dpc thread
2610 void qla2x00_relogin(struct scsi_qla_host
*vha
)
2614 uint16_t next_loopid
= 0;
2615 struct qla_hw_data
*ha
= vha
->hw
;
2617 list_for_each_entry(fcport
, &vha
->vp_fcports
, list
) {
2619 * If the port is not ONLINE then try to login
2620 * to it if we haven't run out of retries.
2622 if (atomic_read(&fcport
->state
) !=
2623 FCS_ONLINE
&& fcport
->login_retry
) {
2625 if (fcport
->flags
& FCF_FABRIC_DEVICE
) {
2626 if (fcport
->flags
& FCF_TAPE_PRESENT
)
2627 ha
->isp_ops
->fabric_logout(vha
,
2629 fcport
->d_id
.b
.domain
,
2630 fcport
->d_id
.b
.area
,
2631 fcport
->d_id
.b
.al_pa
);
2633 status
= qla2x00_fabric_login(vha
, fcport
,
2636 status
= qla2x00_local_device_login(vha
,
2639 fcport
->login_retry
--;
2640 if (status
== QLA_SUCCESS
) {
2641 fcport
->old_loop_id
= fcport
->loop_id
;
2643 DEBUG(printk("scsi(%ld): port login OK: logged "
2644 "in ID 0x%x\n", vha
->host_no
, fcport
->loop_id
));
2646 qla2x00_update_fcport(vha
, fcport
);
2648 } else if (status
== 1) {
2649 set_bit(RELOGIN_NEEDED
, &vha
->dpc_flags
);
2650 /* retry the login again */
2651 DEBUG(printk("scsi(%ld): Retrying"
2652 " %d login again loop_id 0x%x\n",
2653 vha
->host_no
, fcport
->login_retry
,
2656 fcport
->login_retry
= 0;
2659 if (fcport
->login_retry
== 0 && status
!= QLA_SUCCESS
)
2660 fcport
->loop_id
= FC_NO_LOOP_ID
;
2662 if (test_bit(LOOP_RESYNC_NEEDED
, &vha
->dpc_flags
))
2667 /**************************************************************************
2669 * This kernel thread is a task that is schedule by the interrupt handler
2670 * to perform the background processing for interrupts.
2673 * This task always run in the context of a kernel thread. It
2674 * is kick-off by the driver's detect code and starts up
2675 * up one per adapter. It immediately goes to sleep and waits for
2676 * some fibre event. When either the interrupt handler or
2677 * the timer routine detects a event it will one of the task
2678 * bits then wake us up.
2679 **************************************************************************/
2681 qla2x00_do_dpc(void *data
)
2684 scsi_qla_host_t
*base_vha
;
2685 struct qla_hw_data
*ha
;
2687 ha
= (struct qla_hw_data
*)data
;
2688 base_vha
= pci_get_drvdata(ha
->pdev
);
2690 set_user_nice(current
, -20);
2692 while (!kthread_should_stop()) {
2693 DEBUG3(printk("qla2x00: DPC handler sleeping\n"));
2695 set_current_state(TASK_INTERRUPTIBLE
);
2697 __set_current_state(TASK_RUNNING
);
2699 DEBUG3(printk("qla2x00: DPC handler waking up\n"));
2701 /* Initialization not yet finished. Don't do anything yet. */
2702 if (!base_vha
->flags
.init_done
)
2705 DEBUG3(printk("scsi(%ld): DPC handler\n", base_vha
->host_no
));
2709 if (ha
->flags
.mbox_busy
) {
2714 qla2x00_do_work(base_vha
);
2716 if (test_and_clear_bit(ISP_ABORT_NEEDED
,
2717 &base_vha
->dpc_flags
)) {
2719 DEBUG(printk("scsi(%ld): dpc: sched "
2720 "qla2x00_abort_isp ha = %p\n",
2721 base_vha
->host_no
, ha
));
2722 if (!(test_and_set_bit(ABORT_ISP_ACTIVE
,
2723 &base_vha
->dpc_flags
))) {
2725 if (qla2x00_abort_isp(base_vha
)) {
2726 /* failed. retry later */
2727 set_bit(ISP_ABORT_NEEDED
,
2728 &base_vha
->dpc_flags
);
2730 clear_bit(ABORT_ISP_ACTIVE
,
2731 &base_vha
->dpc_flags
);
2734 DEBUG(printk("scsi(%ld): dpc: qla2x00_abort_isp end\n",
2735 base_vha
->host_no
));
2738 if (test_bit(FCPORT_UPDATE_NEEDED
, &base_vha
->dpc_flags
)) {
2739 qla2x00_update_fcports(base_vha
);
2740 clear_bit(FCPORT_UPDATE_NEEDED
, &base_vha
->dpc_flags
);
2743 if (test_and_clear_bit(RESET_MARKER_NEEDED
,
2744 &base_vha
->dpc_flags
) &&
2745 (!(test_and_set_bit(RESET_ACTIVE
, &base_vha
->dpc_flags
)))) {
2747 DEBUG(printk("scsi(%ld): qla2x00_reset_marker()\n",
2748 base_vha
->host_no
));
2750 qla2x00_rst_aen(base_vha
);
2751 clear_bit(RESET_ACTIVE
, &base_vha
->dpc_flags
);
2754 /* Retry each device up to login retry count */
2755 if ((test_and_clear_bit(RELOGIN_NEEDED
,
2756 &base_vha
->dpc_flags
)) &&
2757 !test_bit(LOOP_RESYNC_NEEDED
, &base_vha
->dpc_flags
) &&
2758 atomic_read(&base_vha
->loop_state
) != LOOP_DOWN
) {
2760 DEBUG(printk("scsi(%ld): qla2x00_port_login()\n",
2761 base_vha
->host_no
));
2762 qla2x00_relogin(base_vha
);
2764 DEBUG(printk("scsi(%ld): qla2x00_port_login - end\n",
2765 base_vha
->host_no
));
2768 if (test_and_clear_bit(LOOP_RESYNC_NEEDED
,
2769 &base_vha
->dpc_flags
)) {
2771 DEBUG(printk("scsi(%ld): qla2x00_loop_resync()\n",
2772 base_vha
->host_no
));
2774 if (!(test_and_set_bit(LOOP_RESYNC_ACTIVE
,
2775 &base_vha
->dpc_flags
))) {
2777 rval
= qla2x00_loop_resync(base_vha
);
2779 clear_bit(LOOP_RESYNC_ACTIVE
,
2780 &base_vha
->dpc_flags
);
2783 DEBUG(printk("scsi(%ld): qla2x00_loop_resync - end\n",
2784 base_vha
->host_no
));
2787 if (test_bit(NPIV_CONFIG_NEEDED
, &base_vha
->dpc_flags
) &&
2788 atomic_read(&base_vha
->loop_state
) == LOOP_READY
) {
2789 clear_bit(NPIV_CONFIG_NEEDED
, &base_vha
->dpc_flags
);
2790 qla2xxx_flash_npiv_conf(base_vha
);
2793 if (!ha
->interrupts_on
)
2794 ha
->isp_ops
->enable_intrs(ha
);
2796 if (test_and_clear_bit(BEACON_BLINK_NEEDED
,
2797 &base_vha
->dpc_flags
))
2798 ha
->isp_ops
->beacon_blink(base_vha
);
2800 qla2x00_do_dpc_all_vps(base_vha
);
2803 } /* End of while(1) */
2805 DEBUG(printk("scsi(%ld): DPC handler exiting\n", base_vha
->host_no
));
2808 * Make sure that nobody tries to wake us up again.
2816 qla2xxx_wake_dpc(struct scsi_qla_host
*vha
)
2818 struct qla_hw_data
*ha
= vha
->hw
;
2819 struct task_struct
*t
= ha
->dpc_thread
;
2821 if (!test_bit(UNLOADING
, &vha
->dpc_flags
) && t
)
2827 * Processes asynchronous reset.
2830 * ha = adapter block pointer.
2833 qla2x00_rst_aen(scsi_qla_host_t
*vha
)
2835 if (vha
->flags
.online
&& !vha
->flags
.reset_active
&&
2836 !atomic_read(&vha
->loop_down_timer
) &&
2837 !(test_bit(ABORT_ISP_ACTIVE
, &vha
->dpc_flags
))) {
2839 clear_bit(RESET_MARKER_NEEDED
, &vha
->dpc_flags
);
2842 * Issue marker command only when we are going to start
2845 vha
->marker_needed
= 1;
2846 } while (!atomic_read(&vha
->loop_down_timer
) &&
2847 (test_bit(RESET_MARKER_NEEDED
, &vha
->dpc_flags
)));
2852 qla2x00_sp_free_dma(srb_t
*sp
)
2854 struct scsi_cmnd
*cmd
= sp
->cmd
;
2856 if (sp
->flags
& SRB_DMA_VALID
) {
2857 scsi_dma_unmap(cmd
);
2858 sp
->flags
&= ~SRB_DMA_VALID
;
2864 qla2x00_sp_compl(struct qla_hw_data
*ha
, srb_t
*sp
)
2866 struct scsi_cmnd
*cmd
= sp
->cmd
;
2868 qla2x00_sp_free_dma(sp
);
2870 mempool_free(sp
, ha
->srb_mempool
);
2872 cmd
->scsi_done(cmd
);
2875 /**************************************************************************
2881 * Context: Interrupt
2882 ***************************************************************************/
2884 qla2x00_timer(scsi_qla_host_t
*vha
)
2886 unsigned long cpu_flags
= 0;
2892 struct qla_hw_data
*ha
= vha
->hw
;
2893 struct req_que
*req
;
2895 * Ports - Port down timer.
2897 * Whenever, a port is in the LOST state we start decrementing its port
2898 * down timer every second until it reaches zero. Once it reaches zero
2899 * the port it marked DEAD.
2902 list_for_each_entry(fcport
, &vha
->vp_fcports
, list
) {
2903 if (fcport
->port_type
!= FCT_TARGET
)
2906 if (atomic_read(&fcport
->state
) == FCS_DEVICE_LOST
) {
2908 if (atomic_read(&fcport
->port_down_timer
) == 0)
2911 if (atomic_dec_and_test(&fcport
->port_down_timer
) != 0)
2912 atomic_set(&fcport
->state
, FCS_DEVICE_DEAD
);
2914 DEBUG(printk("scsi(%ld): fcport-%d - port retry count: "
2917 t
, atomic_read(&fcport
->port_down_timer
)));
2920 } /* End of for fcport */
2923 /* Loop down handler. */
2924 if (atomic_read(&vha
->loop_down_timer
) > 0 &&
2925 !(test_bit(ABORT_ISP_ACTIVE
, &vha
->dpc_flags
))
2926 && vha
->flags
.online
) {
2928 if (atomic_read(&vha
->loop_down_timer
) ==
2929 vha
->loop_down_abort_time
) {
2931 DEBUG(printk("scsi(%ld): Loop Down - aborting the "
2932 "queues before time expire\n",
2935 if (!IS_QLA2100(ha
) && vha
->link_down_timeout
)
2936 atomic_set(&vha
->loop_state
, LOOP_DEAD
);
2938 /* Schedule an ISP abort to return any tape commands. */
2939 /* NPIV - scan physical port only */
2941 spin_lock_irqsave(&ha
->hardware_lock
,
2943 req
= ha
->req_q_map
[0];
2945 index
< MAX_OUTSTANDING_COMMANDS
;
2949 sp
= req
->outstanding_cmds
[index
];
2953 if (!(sfcp
->flags
& FCF_TAPE_PRESENT
))
2956 set_bit(ISP_ABORT_NEEDED
,
2960 spin_unlock_irqrestore(&ha
->hardware_lock
,
2966 /* if the loop has been down for 4 minutes, reinit adapter */
2967 if (atomic_dec_and_test(&vha
->loop_down_timer
) != 0) {
2968 if (!(vha
->device_flags
& DFLG_NO_CABLE
) &&
2970 DEBUG(printk("scsi(%ld): Loop down - "
2973 qla_printk(KERN_WARNING
, ha
,
2974 "Loop down - aborting ISP.\n");
2976 set_bit(ISP_ABORT_NEEDED
, &vha
->dpc_flags
);
2979 DEBUG3(printk("scsi(%ld): Loop Down - seconds remaining %d\n",
2981 atomic_read(&vha
->loop_down_timer
)));
2984 /* Check if beacon LED needs to be blinked */
2985 if (ha
->beacon_blink_led
== 1) {
2986 set_bit(BEACON_BLINK_NEEDED
, &vha
->dpc_flags
);
2990 /* Process any deferred work. */
2991 if (!list_empty(&vha
->work_list
))
2994 /* Schedule the DPC routine if needed */
2995 if ((test_bit(ISP_ABORT_NEEDED
, &vha
->dpc_flags
) ||
2996 test_bit(LOOP_RESYNC_NEEDED
, &vha
->dpc_flags
) ||
2997 test_bit(FCPORT_UPDATE_NEEDED
, &vha
->dpc_flags
) ||
2999 test_bit(RESET_MARKER_NEEDED
, &vha
->dpc_flags
) ||
3000 test_bit(BEACON_BLINK_NEEDED
, &vha
->dpc_flags
) ||
3001 test_bit(VP_DPC_NEEDED
, &vha
->dpc_flags
) ||
3002 test_bit(RELOGIN_NEEDED
, &vha
->dpc_flags
)))
3003 qla2xxx_wake_dpc(vha
);
3005 qla2x00_restart_timer(vha
, WATCH_INTERVAL
);
3008 /* Firmware interface routines. */
3011 #define FW_ISP21XX 0
3012 #define FW_ISP22XX 1
3013 #define FW_ISP2300 2
3014 #define FW_ISP2322 3
3015 #define FW_ISP24XX 4
3016 #define FW_ISP25XX 5
3017 #define FW_ISP81XX 6
3019 #define FW_FILE_ISP21XX "ql2100_fw.bin"
3020 #define FW_FILE_ISP22XX "ql2200_fw.bin"
3021 #define FW_FILE_ISP2300 "ql2300_fw.bin"
3022 #define FW_FILE_ISP2322 "ql2322_fw.bin"
3023 #define FW_FILE_ISP24XX "ql2400_fw.bin"
3024 #define FW_FILE_ISP25XX "ql2500_fw.bin"
3025 #define FW_FILE_ISP81XX "ql8100_fw.bin"
3027 static DEFINE_MUTEX(qla_fw_lock
);
3029 static struct fw_blob qla_fw_blobs
[FW_BLOBS
] = {
3030 { .name
= FW_FILE_ISP21XX
, .segs
= { 0x1000, 0 }, },
3031 { .name
= FW_FILE_ISP22XX
, .segs
= { 0x1000, 0 }, },
3032 { .name
= FW_FILE_ISP2300
, .segs
= { 0x800, 0 }, },
3033 { .name
= FW_FILE_ISP2322
, .segs
= { 0x800, 0x1c000, 0x1e000, 0 }, },
3034 { .name
= FW_FILE_ISP24XX
, },
3035 { .name
= FW_FILE_ISP25XX
, },
3036 { .name
= FW_FILE_ISP81XX
, },
3040 qla2x00_request_firmware(scsi_qla_host_t
*vha
)
3042 struct qla_hw_data
*ha
= vha
->hw
;
3043 struct fw_blob
*blob
;
3046 if (IS_QLA2100(ha
)) {
3047 blob
= &qla_fw_blobs
[FW_ISP21XX
];
3048 } else if (IS_QLA2200(ha
)) {
3049 blob
= &qla_fw_blobs
[FW_ISP22XX
];
3050 } else if (IS_QLA2300(ha
) || IS_QLA2312(ha
) || IS_QLA6312(ha
)) {
3051 blob
= &qla_fw_blobs
[FW_ISP2300
];
3052 } else if (IS_QLA2322(ha
) || IS_QLA6322(ha
)) {
3053 blob
= &qla_fw_blobs
[FW_ISP2322
];
3054 } else if (IS_QLA24XX_TYPE(ha
)) {
3055 blob
= &qla_fw_blobs
[FW_ISP24XX
];
3056 } else if (IS_QLA25XX(ha
)) {
3057 blob
= &qla_fw_blobs
[FW_ISP25XX
];
3058 } else if (IS_QLA81XX(ha
)) {
3059 blob
= &qla_fw_blobs
[FW_ISP81XX
];
3062 mutex_lock(&qla_fw_lock
);
3066 if (request_firmware(&blob
->fw
, blob
->name
, &ha
->pdev
->dev
)) {
3067 DEBUG2(printk("scsi(%ld): Failed to load firmware image "
3068 "(%s).\n", vha
->host_no
, blob
->name
));
3075 mutex_unlock(&qla_fw_lock
);
3080 qla2x00_release_firmware(void)
3084 mutex_lock(&qla_fw_lock
);
3085 for (idx
= 0; idx
< FW_BLOBS
; idx
++)
3086 if (qla_fw_blobs
[idx
].fw
)
3087 release_firmware(qla_fw_blobs
[idx
].fw
);
3088 mutex_unlock(&qla_fw_lock
);
3091 static pci_ers_result_t
3092 qla2xxx_pci_error_detected(struct pci_dev
*pdev
, pci_channel_state_t state
)
3094 scsi_qla_host_t
*base_vha
= pci_get_drvdata(pdev
);
3097 case pci_channel_io_normal
:
3098 return PCI_ERS_RESULT_CAN_RECOVER
;
3099 case pci_channel_io_frozen
:
3100 pci_disable_device(pdev
);
3101 return PCI_ERS_RESULT_NEED_RESET
;
3102 case pci_channel_io_perm_failure
:
3103 qla2x00_abort_all_cmds(base_vha
, DID_NO_CONNECT
<< 16);
3104 return PCI_ERS_RESULT_DISCONNECT
;
3106 return PCI_ERS_RESULT_NEED_RESET
;
3109 static pci_ers_result_t
3110 qla2xxx_pci_mmio_enabled(struct pci_dev
*pdev
)
3112 int risc_paused
= 0;
3114 unsigned long flags
;
3115 scsi_qla_host_t
*base_vha
= pci_get_drvdata(pdev
);
3116 struct qla_hw_data
*ha
= base_vha
->hw
;
3117 struct device_reg_2xxx __iomem
*reg
= &ha
->iobase
->isp
;
3118 struct device_reg_24xx __iomem
*reg24
= &ha
->iobase
->isp24
;
3120 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
3121 if (IS_QLA2100(ha
) || IS_QLA2200(ha
)){
3122 stat
= RD_REG_DWORD(®
->hccr
);
3123 if (stat
& HCCR_RISC_PAUSE
)
3125 } else if (IS_QLA23XX(ha
)) {
3126 stat
= RD_REG_DWORD(®
->u
.isp2300
.host_status
);
3127 if (stat
& HSR_RISC_PAUSED
)
3129 } else if (IS_FWI2_CAPABLE(ha
)) {
3130 stat
= RD_REG_DWORD(®24
->host_status
);
3131 if (stat
& HSRX_RISC_PAUSED
)
3134 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
3137 qla_printk(KERN_INFO
, ha
, "RISC paused -- mmio_enabled, "
3138 "Dumping firmware!\n");
3139 ha
->isp_ops
->fw_dump(base_vha
, 0);
3141 return PCI_ERS_RESULT_NEED_RESET
;
3143 return PCI_ERS_RESULT_RECOVERED
;
3146 static pci_ers_result_t
3147 qla2xxx_pci_slot_reset(struct pci_dev
*pdev
)
3149 pci_ers_result_t ret
= PCI_ERS_RESULT_DISCONNECT
;
3150 scsi_qla_host_t
*base_vha
= pci_get_drvdata(pdev
);
3151 struct qla_hw_data
*ha
= base_vha
->hw
;
3155 rc
= pci_enable_device_mem(pdev
);
3157 rc
= pci_enable_device(pdev
);
3160 qla_printk(KERN_WARNING
, ha
,
3161 "Can't re-enable PCI device after reset.\n");
3165 pci_set_master(pdev
);
3167 if (ha
->isp_ops
->pci_config(base_vha
))
3170 set_bit(ABORT_ISP_ACTIVE
, &base_vha
->dpc_flags
);
3171 if (qla2x00_abort_isp(base_vha
) == QLA_SUCCESS
)
3172 ret
= PCI_ERS_RESULT_RECOVERED
;
3173 clear_bit(ABORT_ISP_ACTIVE
, &base_vha
->dpc_flags
);
3179 qla2xxx_pci_resume(struct pci_dev
*pdev
)
3181 scsi_qla_host_t
*base_vha
= pci_get_drvdata(pdev
);
3182 struct qla_hw_data
*ha
= base_vha
->hw
;
3185 ret
= qla2x00_wait_for_hba_online(base_vha
);
3186 if (ret
!= QLA_SUCCESS
) {
3187 qla_printk(KERN_ERR
, ha
,
3188 "the device failed to resume I/O "
3189 "from slot/link_reset");
3191 pci_cleanup_aer_uncorrect_error_status(pdev
);
3194 static struct pci_error_handlers qla2xxx_err_handler
= {
3195 .error_detected
= qla2xxx_pci_error_detected
,
3196 .mmio_enabled
= qla2xxx_pci_mmio_enabled
,
3197 .slot_reset
= qla2xxx_pci_slot_reset
,
3198 .resume
= qla2xxx_pci_resume
,
3201 static struct pci_device_id qla2xxx_pci_tbl
[] = {
3202 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP2100
) },
3203 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP2200
) },
3204 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP2300
) },
3205 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP2312
) },
3206 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP2322
) },
3207 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP6312
) },
3208 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP6322
) },
3209 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP2422
) },
3210 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP2432
) },
3211 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP8432
) },
3212 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP5422
) },
3213 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP5432
) },
3214 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP2532
) },
3215 { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC
, PCI_DEVICE_ID_QLOGIC_ISP8001
) },
3218 MODULE_DEVICE_TABLE(pci
, qla2xxx_pci_tbl
);
3220 static struct pci_driver qla2xxx_pci_driver
= {
3221 .name
= QLA2XXX_DRIVER_NAME
,
3223 .owner
= THIS_MODULE
,
3225 .id_table
= qla2xxx_pci_tbl
,
3226 .probe
= qla2x00_probe_one
,
3227 .remove
= qla2x00_remove_one
,
3228 .err_handler
= &qla2xxx_err_handler
,
3232 * qla2x00_module_init - Module initialization.
3235 qla2x00_module_init(void)
3239 /* Allocate cache for SRBs. */
3240 srb_cachep
= kmem_cache_create("qla2xxx_srbs", sizeof(srb_t
), 0,
3241 SLAB_HWCACHE_ALIGN
, NULL
);
3242 if (srb_cachep
== NULL
) {
3244 "qla2xxx: Unable to allocate SRB cache...Failing load!\n");
3248 /* Derive version string. */
3249 strcpy(qla2x00_version_str
, QLA2XXX_VERSION
);
3250 if (ql2xextended_error_logging
)
3251 strcat(qla2x00_version_str
, "-debug");
3253 qla2xxx_transport_template
=
3254 fc_attach_transport(&qla2xxx_transport_functions
);
3255 if (!qla2xxx_transport_template
) {
3256 kmem_cache_destroy(srb_cachep
);
3259 qla2xxx_transport_vport_template
=
3260 fc_attach_transport(&qla2xxx_transport_vport_functions
);
3261 if (!qla2xxx_transport_vport_template
) {
3262 kmem_cache_destroy(srb_cachep
);
3263 fc_release_transport(qla2xxx_transport_template
);
3267 printk(KERN_INFO
"QLogic Fibre Channel HBA Driver: %s\n",
3268 qla2x00_version_str
);
3269 ret
= pci_register_driver(&qla2xxx_pci_driver
);
3271 kmem_cache_destroy(srb_cachep
);
3272 fc_release_transport(qla2xxx_transport_template
);
3273 fc_release_transport(qla2xxx_transport_vport_template
);
3279 * qla2x00_module_exit - Module cleanup.
3282 qla2x00_module_exit(void)
3284 pci_unregister_driver(&qla2xxx_pci_driver
);
3285 qla2x00_release_firmware();
3286 kmem_cache_destroy(srb_cachep
);
3287 fc_release_transport(qla2xxx_transport_template
);
3288 fc_release_transport(qla2xxx_transport_vport_template
);
3291 module_init(qla2x00_module_init
);
3292 module_exit(qla2x00_module_exit
);
3294 MODULE_AUTHOR("QLogic Corporation");
3295 MODULE_DESCRIPTION("QLogic Fibre Channel HBA Driver");
3296 MODULE_LICENSE("GPL");
3297 MODULE_VERSION(QLA2XXX_VERSION
);
3298 MODULE_FIRMWARE(FW_FILE_ISP21XX
);
3299 MODULE_FIRMWARE(FW_FILE_ISP22XX
);
3300 MODULE_FIRMWARE(FW_FILE_ISP2300
);
3301 MODULE_FIRMWARE(FW_FILE_ISP2322
);
3302 MODULE_FIRMWARE(FW_FILE_ISP24XX
);
3303 MODULE_FIRMWARE(FW_FILE_ISP25XX
);
3304 MODULE_FIRMWARE(FW_FILE_ISP81XX
);