aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_init.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/scsi/qla2xxx/qla_init.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_init.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c91
1 files changed, 78 insertions, 13 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 9e3eaac25596..4229bb483c5e 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -8,6 +8,7 @@
8#include "qla_gbl.h" 8#include "qla_gbl.h"
9 9
10#include <linux/delay.h> 10#include <linux/delay.h>
11#include <linux/slab.h>
11#include <linux/vmalloc.h> 12#include <linux/vmalloc.h>
12 13
13#include "qla_devtbl.h" 14#include "qla_devtbl.h"
@@ -62,7 +63,7 @@ qla2x00_ctx_sp_timeout(unsigned long __data)
62 ctx->free(sp); 63 ctx->free(sp);
63} 64}
64 65
65static void 66void
66qla2x00_ctx_sp_free(srb_t *sp) 67qla2x00_ctx_sp_free(srb_t *sp)
67{ 68{
68 struct srb_ctx *ctx = sp->ctx; 69 struct srb_ctx *ctx = sp->ctx;
@@ -205,7 +206,7 @@ qla2x00_async_login_done(struct scsi_qla_host *vha, fc_port_t *fcport,
205 206
206 switch (data[0]) { 207 switch (data[0]) {
207 case MBS_COMMAND_COMPLETE: 208 case MBS_COMMAND_COMPLETE:
208 if (fcport->flags & FCF_TAPE_PRESENT) 209 if (fcport->flags & FCF_FCP2_DEVICE)
209 opts |= BIT_1; 210 opts |= BIT_1;
210 rval = qla2x00_get_port_database(vha, fcport, opts); 211 rval = qla2x00_get_port_database(vha, fcport, opts);
211 if (rval != QLA_SUCCESS) 212 if (rval != QLA_SUCCESS)
@@ -269,6 +270,8 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
269 vha->flags.online = 0; 270 vha->flags.online = 0;
270 ha->flags.chip_reset_done = 0; 271 ha->flags.chip_reset_done = 0;
271 vha->flags.reset_active = 0; 272 vha->flags.reset_active = 0;
273 ha->flags.pci_channel_io_perm_failure = 0;
274 ha->flags.eeh_busy = 0;
272 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); 275 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
273 atomic_set(&vha->loop_state, LOOP_DOWN); 276 atomic_set(&vha->loop_state, LOOP_DOWN);
274 vha->device_flags = DFLG_NO_CABLE; 277 vha->device_flags = DFLG_NO_CABLE;
@@ -277,7 +280,6 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
277 vha->marker_needed = 0; 280 vha->marker_needed = 0;
278 ha->isp_abort_cnt = 0; 281 ha->isp_abort_cnt = 0;
279 ha->beacon_blink_led = 0; 282 ha->beacon_blink_led = 0;
280 set_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags);
281 283
282 set_bit(0, ha->req_qid_map); 284 set_bit(0, ha->req_qid_map);
283 set_bit(0, ha->rsp_qid_map); 285 set_bit(0, ha->rsp_qid_map);
@@ -337,6 +339,16 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
337 rval = qla2x00_init_rings(vha); 339 rval = qla2x00_init_rings(vha);
338 ha->flags.chip_reset_done = 1; 340 ha->flags.chip_reset_done = 1;
339 341
342 if (rval == QLA_SUCCESS && IS_QLA84XX(ha)) {
343 /* Issue verify 84xx FW IOCB to complete 84xx initialization */
344 rval = qla84xx_init_chip(vha);
345 if (rval != QLA_SUCCESS) {
346 qla_printk(KERN_ERR, ha,
347 "Unable to initialize ISP84XX.\n");
348 qla84xx_put_chip(vha);
349 }
350 }
351
340 return (rval); 352 return (rval);
341} 353}
342 354
@@ -582,6 +594,9 @@ qla2x00_reset_chip(scsi_qla_host_t *vha)
582 uint32_t cnt; 594 uint32_t cnt;
583 uint16_t cmd; 595 uint16_t cmd;
584 596
597 if (unlikely(pci_channel_offline(ha->pdev)))
598 return;
599
585 ha->isp_ops->disable_intrs(ha); 600 ha->isp_ops->disable_intrs(ha);
586 601
587 spin_lock_irqsave(&ha->hardware_lock, flags); 602 spin_lock_irqsave(&ha->hardware_lock, flags);
@@ -787,6 +802,12 @@ void
787qla24xx_reset_chip(scsi_qla_host_t *vha) 802qla24xx_reset_chip(scsi_qla_host_t *vha)
788{ 803{
789 struct qla_hw_data *ha = vha->hw; 804 struct qla_hw_data *ha = vha->hw;
805
806 if (pci_channel_offline(ha->pdev) &&
807 ha->flags.pci_channel_io_perm_failure) {
808 return;
809 }
810
790 ha->isp_ops->disable_intrs(ha); 811 ha->isp_ops->disable_intrs(ha);
791 812
792 /* Perform RISC reset. */ 813 /* Perform RISC reset. */
@@ -1203,7 +1224,7 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
1203 } 1224 }
1204 qla2x00_get_resource_cnts(vha, NULL, 1225 qla2x00_get_resource_cnts(vha, NULL,
1205 &ha->fw_xcb_count, NULL, NULL, 1226 &ha->fw_xcb_count, NULL, NULL,
1206 &ha->max_npiv_vports); 1227 &ha->max_npiv_vports, NULL);
1207 1228
1208 if (!fw_major_version && ql2xallocfwdump) 1229 if (!fw_major_version && ql2xallocfwdump)
1209 qla2x00_alloc_fw_dump(vha); 1230 qla2x00_alloc_fw_dump(vha);
@@ -1443,7 +1464,17 @@ qla24xx_config_rings(struct scsi_qla_host *vha)
1443 icb->firmware_options_2 |= 1464 icb->firmware_options_2 |=
1444 __constant_cpu_to_le32(BIT_18); 1465 __constant_cpu_to_le32(BIT_18);
1445 1466
1446 icb->firmware_options_2 &= __constant_cpu_to_le32(~BIT_22); 1467 /* Use Disable MSIX Handshake mode for capable adapters */
1468 if (IS_MSIX_NACK_CAPABLE(ha)) {
1469 icb->firmware_options_2 &=
1470 __constant_cpu_to_le32(~BIT_22);
1471 ha->flags.disable_msix_handshake = 1;
1472 qla_printk(KERN_INFO, ha,
1473 "MSIX Handshake Disable Mode turned on\n");
1474 } else {
1475 icb->firmware_options_2 |=
1476 __constant_cpu_to_le32(BIT_22);
1477 }
1447 icb->firmware_options_2 |= __constant_cpu_to_le32(BIT_23); 1478 icb->firmware_options_2 |= __constant_cpu_to_le32(BIT_23);
1448 1479
1449 WRT_REG_DWORD(&reg->isp25mq.req_q_in, 0); 1480 WRT_REG_DWORD(&reg->isp25mq.req_q_in, 0);
@@ -2196,7 +2227,7 @@ qla2x00_rport_del(void *data)
2196 * 2227 *
2197 * Returns a pointer to the allocated fcport, or NULL, if none available. 2228 * Returns a pointer to the allocated fcport, or NULL, if none available.
2198 */ 2229 */
2199static fc_port_t * 2230fc_port_t *
2200qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags) 2231qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)
2201{ 2232{
2202 fc_port_t *fcport; 2233 fc_port_t *fcport;
@@ -2257,6 +2288,8 @@ qla2x00_configure_loop(scsi_qla_host_t *vha)
2257 clear_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); 2288 clear_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
2258 clear_bit(RSCN_UPDATE, &vha->dpc_flags); 2289 clear_bit(RSCN_UPDATE, &vha->dpc_flags);
2259 2290
2291 qla2x00_get_data_rate(vha);
2292
2260 /* Determine what we need to do */ 2293 /* Determine what we need to do */
2261 if (ha->current_topology == ISP_CFG_FL && 2294 if (ha->current_topology == ISP_CFG_FL &&
2262 (test_bit(LOCAL_LOOP_UPDATE, &flags))) { 2295 (test_bit(LOCAL_LOOP_UPDATE, &flags))) {
@@ -2704,7 +2737,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
2704 2737
2705 /* 2738 /*
2706 * Logout all previous fabric devices marked lost, except 2739 * Logout all previous fabric devices marked lost, except
2707 * tape devices. 2740 * FCP2 devices.
2708 */ 2741 */
2709 list_for_each_entry(fcport, &vha->vp_fcports, list) { 2742 list_for_each_entry(fcport, &vha->vp_fcports, list) {
2710 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags)) 2743 if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
@@ -2717,7 +2750,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
2717 qla2x00_mark_device_lost(vha, fcport, 2750 qla2x00_mark_device_lost(vha, fcport,
2718 ql2xplogiabsentdevice, 0); 2751 ql2xplogiabsentdevice, 0);
2719 if (fcport->loop_id != FC_NO_LOOP_ID && 2752 if (fcport->loop_id != FC_NO_LOOP_ID &&
2720 (fcport->flags & FCF_TAPE_PRESENT) == 0 && 2753 (fcport->flags & FCF_FCP2_DEVICE) == 0 &&
2721 fcport->port_type != FCT_INITIATOR && 2754 fcport->port_type != FCT_INITIATOR &&
2722 fcport->port_type != FCT_BROADCAST) { 2755 fcport->port_type != FCT_BROADCAST) {
2723 ha->isp_ops->fabric_logout(vha, 2756 ha->isp_ops->fabric_logout(vha,
@@ -2878,8 +2911,13 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
2878 if (qla2x00_is_reserved_id(vha, loop_id)) 2911 if (qla2x00_is_reserved_id(vha, loop_id))
2879 continue; 2912 continue;
2880 2913
2881 if (atomic_read(&vha->loop_down_timer) || LOOP_TRANSITION(vha)) 2914 if (atomic_read(&vha->loop_down_timer) ||
2915 LOOP_TRANSITION(vha)) {
2916 atomic_set(&vha->loop_down_timer, 0);
2917 set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
2918 set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
2882 break; 2919 break;
2920 }
2883 2921
2884 if (swl != NULL) { 2922 if (swl != NULL) {
2885 if (last_dev) { 2923 if (last_dev) {
@@ -2996,7 +3034,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
2996 fcport->d_id.b24 = new_fcport->d_id.b24; 3034 fcport->d_id.b24 = new_fcport->d_id.b24;
2997 fcport->flags |= FCF_LOGIN_NEEDED; 3035 fcport->flags |= FCF_LOGIN_NEEDED;
2998 if (fcport->loop_id != FC_NO_LOOP_ID && 3036 if (fcport->loop_id != FC_NO_LOOP_ID &&
2999 (fcport->flags & FCF_TAPE_PRESENT) == 0 && 3037 (fcport->flags & FCF_FCP2_DEVICE) == 0 &&
3000 fcport->port_type != FCT_INITIATOR && 3038 fcport->port_type != FCT_INITIATOR &&
3001 fcport->port_type != FCT_BROADCAST) { 3039 fcport->port_type != FCT_BROADCAST) {
3002 ha->isp_ops->fabric_logout(vha, fcport->loop_id, 3040 ha->isp_ops->fabric_logout(vha, fcport->loop_id,
@@ -3250,9 +3288,9 @@ qla2x00_fabric_dev_login(scsi_qla_host_t *vha, fc_port_t *fcport,
3250 3288
3251 rval = qla2x00_fabric_login(vha, fcport, next_loopid); 3289 rval = qla2x00_fabric_login(vha, fcport, next_loopid);
3252 if (rval == QLA_SUCCESS) { 3290 if (rval == QLA_SUCCESS) {
3253 /* Send an ADISC to tape devices.*/ 3291 /* Send an ADISC to FCP2 devices.*/
3254 opts = 0; 3292 opts = 0;
3255 if (fcport->flags & FCF_TAPE_PRESENT) 3293 if (fcport->flags & FCF_FCP2_DEVICE)
3256 opts |= BIT_1; 3294 opts |= BIT_1;
3257 rval = qla2x00_get_port_database(vha, fcport, opts); 3295 rval = qla2x00_get_port_database(vha, fcport, opts);
3258 if (rval != QLA_SUCCESS) { 3296 if (rval != QLA_SUCCESS) {
@@ -3551,6 +3589,13 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
3551 /* Requeue all commands in outstanding command list. */ 3589 /* Requeue all commands in outstanding command list. */
3552 qla2x00_abort_all_cmds(vha, DID_RESET << 16); 3590 qla2x00_abort_all_cmds(vha, DID_RESET << 16);
3553 3591
3592 if (unlikely(pci_channel_offline(ha->pdev) &&
3593 ha->flags.pci_channel_io_perm_failure)) {
3594 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
3595 status = 0;
3596 return status;
3597 }
3598
3554 ha->isp_ops->get_flash_version(vha, req->ring); 3599 ha->isp_ops->get_flash_version(vha, req->ring);
3555 3600
3556 ha->isp_ops->nvram_config(vha); 3601 ha->isp_ops->nvram_config(vha);
@@ -3573,6 +3618,15 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
3573 ha->isp_abort_cnt = 0; 3618 ha->isp_abort_cnt = 0;
3574 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags); 3619 clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
3575 3620
3621 if (IS_QLA81XX(ha))
3622 qla2x00_get_fw_version(vha,
3623 &ha->fw_major_version,
3624 &ha->fw_minor_version,
3625 &ha->fw_subminor_version,
3626 &ha->fw_attributes, &ha->fw_memory_size,
3627 ha->mpi_version, &ha->mpi_capabilities,
3628 ha->phy_version);
3629
3576 if (ha->fce) { 3630 if (ha->fce) {
3577 ha->flags.fce_enabled = 1; 3631 ha->flags.fce_enabled = 1;
3578 memset(ha->fce, 0, 3632 memset(ha->fce, 0,
@@ -4440,6 +4494,8 @@ qla2x00_try_to_stop_firmware(scsi_qla_host_t *vha)
4440 int ret, retries; 4494 int ret, retries;
4441 struct qla_hw_data *ha = vha->hw; 4495 struct qla_hw_data *ha = vha->hw;
4442 4496
4497 if (ha->flags.pci_channel_io_perm_failure)
4498 return;
4443 if (!IS_FWI2_CAPABLE(ha)) 4499 if (!IS_FWI2_CAPABLE(ha))
4444 return; 4500 return;
4445 if (!ha->fw_major_version) 4501 if (!ha->fw_major_version)
@@ -4837,6 +4893,15 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
4837} 4893}
4838 4894
4839void 4895void
4840qla81xx_update_fw_options(scsi_qla_host_t *ha) 4896qla81xx_update_fw_options(scsi_qla_host_t *vha)
4841{ 4897{
4898 struct qla_hw_data *ha = vha->hw;
4899
4900 if (!ql2xetsenable)
4901 return;
4902
4903 /* Enable ETS Burst. */
4904 memset(ha->fw_options, 0, sizeof(ha->fw_options));
4905 ha->fw_options[2] |= BIT_9;
4906 qla2x00_set_fw_options(vha, ha->fw_options);
4842} 4907}