aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c27
-rw-r--r--drivers/scsi/qla2xxx/qla_bsg.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h8
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c89
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c67
-rw-r--r--drivers/scsi/qla2xxx/qla_nx.c217
-rw-r--r--drivers/scsi/qla2xxx/qla_nx.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c63
-rw-r--r--drivers/scsi/qla2xxx/qla_sup.c11
11 files changed, 408 insertions, 88 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index bc8194f74625..44578b56ad0a 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1309,6 +1309,31 @@ qla2x00_fabric_param_show(struct device *dev, struct device_attribute *attr,
1309} 1309}
1310 1310
1311static ssize_t 1311static ssize_t
1312qla2x00_thermal_temp_show(struct device *dev,
1313 struct device_attribute *attr, char *buf)
1314{
1315 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1316 int rval = QLA_FUNCTION_FAILED;
1317 uint16_t temp, frac;
1318
1319 if (!vha->hw->flags.thermal_supported)
1320 return snprintf(buf, PAGE_SIZE, "\n");
1321
1322 temp = frac = 0;
1323 if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
1324 test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags))
1325 DEBUG2_3_11(printk(KERN_WARNING
1326 "%s(%ld): isp reset in progress.\n",
1327 __func__, vha->host_no));
1328 else if (!vha->hw->flags.eeh_busy)
1329 rval = qla2x00_get_thermal_temp(vha, &temp, &frac);
1330 if (rval != QLA_SUCCESS)
1331 temp = frac = 0;
1332
1333 return snprintf(buf, PAGE_SIZE, "%d.%02d\n", temp, frac);
1334}
1335
1336static ssize_t
1312qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr, 1337qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr,
1313 char *buf) 1338 char *buf)
1314{ 1339{
@@ -1366,6 +1391,7 @@ static DEVICE_ATTR(vn_port_mac_address, S_IRUGO,
1366 qla2x00_vn_port_mac_address_show, NULL); 1391 qla2x00_vn_port_mac_address_show, NULL);
1367static DEVICE_ATTR(fabric_param, S_IRUGO, qla2x00_fabric_param_show, NULL); 1392static DEVICE_ATTR(fabric_param, S_IRUGO, qla2x00_fabric_param_show, NULL);
1368static DEVICE_ATTR(fw_state, S_IRUGO, qla2x00_fw_state_show, NULL); 1393static DEVICE_ATTR(fw_state, S_IRUGO, qla2x00_fw_state_show, NULL);
1394static DEVICE_ATTR(thermal_temp, S_IRUGO, qla2x00_thermal_temp_show, NULL);
1369 1395
1370struct device_attribute *qla2x00_host_attrs[] = { 1396struct device_attribute *qla2x00_host_attrs[] = {
1371 &dev_attr_driver_version, 1397 &dev_attr_driver_version,
@@ -1394,6 +1420,7 @@ struct device_attribute *qla2x00_host_attrs[] = {
1394 &dev_attr_fabric_param, 1420 &dev_attr_fabric_param,
1395 &dev_attr_fw_state, 1421 &dev_attr_fw_state,
1396 &dev_attr_optrom_gold_fw_version, 1422 &dev_attr_optrom_gold_fw_version,
1423 &dev_attr_thermal_temp,
1397 NULL, 1424 NULL,
1398}; 1425};
1399 1426
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 31a4121a2be1..903b0586ded3 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -103,7 +103,7 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job)
103 103
104 bsg_job->reply->reply_payload_rcv_len = 0; 104 bsg_job->reply->reply_payload_rcv_len = 0;
105 105
106 if (!IS_QLA24XX_TYPE(ha) || !IS_QLA25XX(ha)) { 106 if (!(IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha))) {
107 ret = -EINVAL; 107 ret = -EINVAL;
108 goto exit_fcp_prio_cfg; 108 goto exit_fcp_prio_cfg;
109 } 109 }
@@ -753,7 +753,7 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job)
753 command_sent = INT_DEF_LB_LOOPBACK_CMD; 753 command_sent = INT_DEF_LB_LOOPBACK_CMD;
754 rval = qla2x00_loopback_test(vha, &elreq, response); 754 rval = qla2x00_loopback_test(vha, &elreq, response);
755 755
756 if (new_config[1]) { 756 if (new_config[0]) {
757 /* Revert back to original port config 757 /* Revert back to original port config
758 * Also clear internal loopback 758 * Also clear internal loopback
759 */ 759 */
@@ -1512,6 +1512,7 @@ qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job)
1512 if (((sp_bsg->type == SRB_CT_CMD) || 1512 if (((sp_bsg->type == SRB_CT_CMD) ||
1513 (sp_bsg->type == SRB_ELS_CMD_HST)) 1513 (sp_bsg->type == SRB_ELS_CMD_HST))
1514 && (sp_bsg->u.bsg_job == bsg_job)) { 1514 && (sp_bsg->u.bsg_job == bsg_job)) {
1515 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1515 if (ha->isp_ops->abort_command(sp)) { 1516 if (ha->isp_ops->abort_command(sp)) {
1516 DEBUG2(qla_printk(KERN_INFO, ha, 1517 DEBUG2(qla_printk(KERN_INFO, ha,
1517 "scsi(%ld): mbx " 1518 "scsi(%ld): mbx "
@@ -1527,6 +1528,7 @@ qla24xx_bsg_timeout(struct fc_bsg_job *bsg_job)
1527 bsg_job->req->errors = 1528 bsg_job->req->errors =
1528 bsg_job->reply->result = 0; 1529 bsg_job->reply->result = 0;
1529 } 1530 }
1531 spin_lock_irqsave(&ha->hardware_lock, flags);
1530 goto done; 1532 goto done;
1531 } 1533 }
1532 } 1534 }
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 9ce539d4557e..ccfc8e78be21 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2425,6 +2425,9 @@ struct qla_hw_data {
2425 uint32_t disable_msix_handshake :1; 2425 uint32_t disable_msix_handshake :1;
2426 uint32_t fcp_prio_enabled :1; 2426 uint32_t fcp_prio_enabled :1;
2427 uint32_t fw_hung :1; 2427 uint32_t fw_hung :1;
2428 uint32_t quiesce_owner:1;
2429 uint32_t thermal_supported:1;
2430 /* 26 bits */
2428 } flags; 2431 } flags;
2429 2432
2430 /* This spinlock is used to protect "io transactions", you must 2433 /* This spinlock is used to protect "io transactions", you must
@@ -2863,6 +2866,7 @@ typedef struct scsi_qla_host {
2863#define ISP_UNRECOVERABLE 17 2866#define ISP_UNRECOVERABLE 17
2864#define FCOE_CTX_RESET_NEEDED 18 /* Initiate FCoE context reset */ 2867#define FCOE_CTX_RESET_NEEDED 18 /* Initiate FCoE context reset */
2865#define MPI_RESET_NEEDED 19 /* Initiate MPI FW reset */ 2868#define MPI_RESET_NEEDED 19 /* Initiate MPI FW reset */
2869#define ISP_QUIESCE_NEEDED 20 /* Driver need some quiescence */
2866 2870
2867 uint32_t device_flags; 2871 uint32_t device_flags;
2868#define SWITCH_FOUND BIT_0 2872#define SWITCH_FOUND BIT_0
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 9382a816c133..89e900adb679 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -36,6 +36,7 @@ extern int qla2x00_load_risc(struct scsi_qla_host *, uint32_t *);
36extern int qla24xx_load_risc(scsi_qla_host_t *, uint32_t *); 36extern int qla24xx_load_risc(scsi_qla_host_t *, uint32_t *);
37extern int qla81xx_load_risc(scsi_qla_host_t *, uint32_t *); 37extern int qla81xx_load_risc(scsi_qla_host_t *, uint32_t *);
38 38
39extern int qla2x00_perform_loop_resync(scsi_qla_host_t *);
39extern int qla2x00_loop_resync(scsi_qla_host_t *); 40extern int qla2x00_loop_resync(scsi_qla_host_t *);
40 41
41extern int qla2x00_fabric_login(scsi_qla_host_t *, fc_port_t *, uint16_t *); 42extern int qla2x00_fabric_login(scsi_qla_host_t *, fc_port_t *, uint16_t *);
@@ -45,12 +46,15 @@ extern void qla2x00_update_fcports(scsi_qla_host_t *);
45 46
46extern int qla2x00_abort_isp(scsi_qla_host_t *); 47extern int qla2x00_abort_isp(scsi_qla_host_t *);
47extern void qla2x00_abort_isp_cleanup(scsi_qla_host_t *); 48extern void qla2x00_abort_isp_cleanup(scsi_qla_host_t *);
49extern void qla82xx_quiescent_state_cleanup(scsi_qla_host_t *);
48 50
49extern void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *); 51extern void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *);
50 52
51extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *); 53extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *);
52extern void qla2x00_try_to_stop_firmware(scsi_qla_host_t *); 54extern void qla2x00_try_to_stop_firmware(scsi_qla_host_t *);
53 55
56extern int qla2x00_get_thermal_temp(scsi_qla_host_t *, uint16_t *, uint16_t *);
57
54extern void qla84xx_put_chip(struct scsi_qla_host *); 58extern void qla84xx_put_chip(struct scsi_qla_host *);
55 59
56extern int qla2x00_async_login(struct scsi_qla_host *, fc_port_t *, 60extern int qla2x00_async_login(struct scsi_qla_host *, fc_port_t *,
@@ -68,6 +72,7 @@ extern void qla2x00_async_adisc_done(struct scsi_qla_host *, fc_port_t *,
68extern void qla2x00_async_tm_cmd_done(struct scsi_qla_host *, fc_port_t *, 72extern void qla2x00_async_tm_cmd_done(struct scsi_qla_host *, fc_port_t *,
69 struct srb_iocb *); 73 struct srb_iocb *);
70extern void *qla2x00_alloc_iocbs(struct scsi_qla_host *, srb_t *); 74extern void *qla2x00_alloc_iocbs(struct scsi_qla_host *, srb_t *);
75extern int qla24xx_update_fcport_fcp_prio(scsi_qla_host_t *, fc_port_t *);
71 76
72extern fc_port_t * 77extern fc_port_t *
73qla2x00_alloc_fcport(scsi_qla_host_t *, gfp_t ); 78qla2x00_alloc_fcport(scsi_qla_host_t *, gfp_t );
@@ -90,7 +95,6 @@ extern int ql2xfwloadbin;
90extern int ql2xetsenable; 95extern int ql2xetsenable;
91extern int ql2xshiftctondsd; 96extern int ql2xshiftctondsd;
92extern int ql2xdbwr; 97extern int ql2xdbwr;
93extern int ql2xdontresethba;
94extern int ql2xasynctmfenable; 98extern int ql2xasynctmfenable;
95extern int ql2xgffidenable; 99extern int ql2xgffidenable;
96extern int ql2xenabledif; 100extern int ql2xenabledif;
@@ -549,9 +553,11 @@ extern void qla82xx_rom_unlock(struct qla_hw_data *);
549 553
550/* ISP 8021 IDC */ 554/* ISP 8021 IDC */
551extern void qla82xx_clear_drv_active(struct qla_hw_data *); 555extern void qla82xx_clear_drv_active(struct qla_hw_data *);
556extern uint32_t qla82xx_wait_for_state_change(scsi_qla_host_t *, uint32_t);
552extern int qla82xx_idc_lock(struct qla_hw_data *); 557extern int qla82xx_idc_lock(struct qla_hw_data *);
553extern void qla82xx_idc_unlock(struct qla_hw_data *); 558extern void qla82xx_idc_unlock(struct qla_hw_data *);
554extern int qla82xx_device_state_handler(scsi_qla_host_t *); 559extern int qla82xx_device_state_handler(scsi_qla_host_t *);
560extern void qla82xx_clear_qsnt_ready(scsi_qla_host_t *);
555 561
556extern void qla2x00_set_model_info(scsi_qla_host_t *, uint8_t *, 562extern void qla2x00_set_model_info(scsi_qla_host_t *, uint8_t *,
557 size_t, char *); 563 size_t, char *);
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 259f51137493..f948e1a73aec 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -498,6 +498,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
498 vha->flags.reset_active = 0; 498 vha->flags.reset_active = 0;
499 ha->flags.pci_channel_io_perm_failure = 0; 499 ha->flags.pci_channel_io_perm_failure = 0;
500 ha->flags.eeh_busy = 0; 500 ha->flags.eeh_busy = 0;
501 ha->flags.thermal_supported = 1;
501 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); 502 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
502 atomic_set(&vha->loop_state, LOOP_DOWN); 503 atomic_set(&vha->loop_state, LOOP_DOWN);
503 vha->device_flags = DFLG_NO_CABLE; 504 vha->device_flags = DFLG_NO_CABLE;
@@ -2023,6 +2024,7 @@ qla2x00_configure_hba(scsi_qla_host_t *vha)
2023 &loop_id, &al_pa, &area, &domain, &topo, &sw_cap); 2024 &loop_id, &al_pa, &area, &domain, &topo, &sw_cap);
2024 if (rval != QLA_SUCCESS) { 2025 if (rval != QLA_SUCCESS) {
2025 if (LOOP_TRANSITION(vha) || atomic_read(&ha->loop_down_timer) || 2026 if (LOOP_TRANSITION(vha) || atomic_read(&ha->loop_down_timer) ||
2027 IS_QLA8XXX_TYPE(ha) ||
2026 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) { 2028 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) {
2027 DEBUG2(printk("%s(%ld) Loop is in a transition state\n", 2029 DEBUG2(printk("%s(%ld) Loop is in a transition state\n",
2028 __func__, vha->host_no)); 2030 __func__, vha->host_no));
@@ -2928,6 +2930,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
2928 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); 2930 fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT);
2929 2931
2930 qla2x00_iidma_fcport(vha, fcport); 2932 qla2x00_iidma_fcport(vha, fcport);
2933 qla24xx_update_fcport_fcp_prio(vha, fcport);
2931 qla2x00_reg_remote_port(vha, fcport); 2934 qla2x00_reg_remote_port(vha, fcport);
2932 atomic_set(&fcport->state, FCS_ONLINE); 2935 atomic_set(&fcport->state, FCS_ONLINE);
2933} 2936}
@@ -3844,6 +3847,37 @@ qla2x00_loop_resync(scsi_qla_host_t *vha)
3844 return (rval); 3847 return (rval);
3845} 3848}
3846 3849
3850/*
3851* qla2x00_perform_loop_resync
3852* Description: This function will set the appropriate flags and call
3853* qla2x00_loop_resync. If successful loop will be resynced
3854* Arguments : scsi_qla_host_t pointer
3855* returm : Success or Failure
3856*/
3857
3858int qla2x00_perform_loop_resync(scsi_qla_host_t *ha)
3859{
3860 int32_t rval = 0;
3861
3862 if (!test_and_set_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) {
3863 /*Configure the flags so that resync happens properly*/
3864 atomic_set(&ha->loop_down_timer, 0);
3865 if (!(ha->device_flags & DFLG_NO_CABLE)) {
3866 atomic_set(&ha->loop_state, LOOP_UP);
3867 set_bit(LOCAL_LOOP_UPDATE, &ha->dpc_flags);
3868 set_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags);
3869 set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags);
3870
3871 rval = qla2x00_loop_resync(ha);
3872 } else
3873 atomic_set(&ha->loop_state, LOOP_DEAD);
3874
3875 clear_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags);
3876 }
3877
3878 return rval;
3879}
3880
3847void 3881void
3848qla2x00_update_fcports(scsi_qla_host_t *base_vha) 3882qla2x00_update_fcports(scsi_qla_host_t *base_vha)
3849{ 3883{
@@ -3857,7 +3891,7 @@ qla2x00_update_fcports(scsi_qla_host_t *base_vha)
3857 list_for_each_entry(vha, &base_vha->hw->vp_list, list) { 3891 list_for_each_entry(vha, &base_vha->hw->vp_list, list) {
3858 atomic_inc(&vha->vref_count); 3892 atomic_inc(&vha->vref_count);
3859 list_for_each_entry(fcport, &vha->vp_fcports, list) { 3893 list_for_each_entry(fcport, &vha->vp_fcports, list) {
3860 if (fcport && fcport->drport && 3894 if (fcport->drport &&
3861 atomic_read(&fcport->state) != FCS_UNCONFIGURED) { 3895 atomic_read(&fcport->state) != FCS_UNCONFIGURED) {
3862 spin_unlock_irqrestore(&ha->vport_slock, flags); 3896 spin_unlock_irqrestore(&ha->vport_slock, flags);
3863 3897
@@ -3871,11 +3905,43 @@ qla2x00_update_fcports(scsi_qla_host_t *base_vha)
3871 spin_unlock_irqrestore(&ha->vport_slock, flags); 3905 spin_unlock_irqrestore(&ha->vport_slock, flags);
3872} 3906}
3873 3907
3908/*
3909* qla82xx_quiescent_state_cleanup
3910* Description: This function will block the new I/Os
3911* Its not aborting any I/Os as context
3912* is not destroyed during quiescence
3913* Arguments: scsi_qla_host_t
3914* return : void
3915*/
3916void
3917qla82xx_quiescent_state_cleanup(scsi_qla_host_t *vha)
3918{
3919 struct qla_hw_data *ha = vha->hw;
3920 struct scsi_qla_host *vp;
3921
3922 qla_printk(KERN_INFO, ha,
3923 "Performing ISP error recovery - ha= %p.\n", ha);
3924
3925 atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME);
3926 if (atomic_read(&vha->loop_state) != LOOP_DOWN) {
3927 atomic_set(&vha->loop_state, LOOP_DOWN);
3928 qla2x00_mark_all_devices_lost(vha, 0);
3929 list_for_each_entry(vp, &ha->vp_list, list)
3930 qla2x00_mark_all_devices_lost(vha, 0);
3931 } else {
3932 if (!atomic_read(&vha->loop_down_timer))
3933 atomic_set(&vha->loop_down_timer,
3934 LOOP_DOWN_TIME);
3935 }
3936 /* Wait for pending cmds to complete */
3937 qla2x00_eh_wait_for_pending_commands(vha, 0, 0, WAIT_HOST);
3938}
3939
3874void 3940void
3875qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha) 3941qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha)
3876{ 3942{
3877 struct qla_hw_data *ha = vha->hw; 3943 struct qla_hw_data *ha = vha->hw;
3878 struct scsi_qla_host *vp, *base_vha = pci_get_drvdata(ha->pdev); 3944 struct scsi_qla_host *vp;
3879 unsigned long flags; 3945 unsigned long flags;
3880 3946
3881 vha->flags.online = 0; 3947 vha->flags.online = 0;
@@ -3896,7 +3962,7 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha)
3896 qla2x00_mark_all_devices_lost(vha, 0); 3962 qla2x00_mark_all_devices_lost(vha, 0);
3897 3963
3898 spin_lock_irqsave(&ha->vport_slock, flags); 3964 spin_lock_irqsave(&ha->vport_slock, flags);
3899 list_for_each_entry(vp, &base_vha->hw->vp_list, list) { 3965 list_for_each_entry(vp, &ha->vp_list, list) {
3900 atomic_inc(&vp->vref_count); 3966 atomic_inc(&vp->vref_count);
3901 spin_unlock_irqrestore(&ha->vport_slock, flags); 3967 spin_unlock_irqrestore(&ha->vport_slock, flags);
3902 3968
@@ -5410,7 +5476,7 @@ qla81xx_update_fw_options(scsi_qla_host_t *vha)
5410 * the tag (priority) value is returned. 5476 * the tag (priority) value is returned.
5411 * 5477 *
5412 * Input: 5478 * Input:
5413 * ha = adapter block po 5479 * vha = scsi host structure pointer.
5414 * fcport = port structure pointer. 5480 * fcport = port structure pointer.
5415 * 5481 *
5416 * Return: 5482 * Return:
@@ -5504,7 +5570,7 @@ qla24xx_get_fcp_prio(scsi_qla_host_t *vha, fc_port_t *fcport)
5504 * Activates fcp priority for the logged in fc port 5570 * Activates fcp priority for the logged in fc port
5505 * 5571 *
5506 * Input: 5572 * Input:
5507 * ha = adapter block pointer. 5573 * vha = scsi host structure pointer.
5508 * fcp = port structure pointer. 5574 * fcp = port structure pointer.
5509 * 5575 *
5510 * Return: 5576 * Return:
@@ -5514,25 +5580,24 @@ qla24xx_get_fcp_prio(scsi_qla_host_t *vha, fc_port_t *fcport)
5514 * Kernel context. 5580 * Kernel context.
5515 */ 5581 */
5516int 5582int
5517qla24xx_update_fcport_fcp_prio(scsi_qla_host_t *ha, fc_port_t *fcport) 5583qla24xx_update_fcport_fcp_prio(scsi_qla_host_t *vha, fc_port_t *fcport)
5518{ 5584{
5519 int ret; 5585 int ret;
5520 uint8_t priority; 5586 uint8_t priority;
5521 uint16_t mb[5]; 5587 uint16_t mb[5];
5522 5588
5523 if (atomic_read(&fcport->state) == FCS_UNCONFIGURED || 5589 if (fcport->port_type != FCT_TARGET ||
5524 fcport->port_type != FCT_TARGET || 5590 fcport->loop_id == FC_NO_LOOP_ID)
5525 fcport->loop_id == FC_NO_LOOP_ID)
5526 return QLA_FUNCTION_FAILED; 5591 return QLA_FUNCTION_FAILED;
5527 5592
5528 priority = qla24xx_get_fcp_prio(ha, fcport); 5593 priority = qla24xx_get_fcp_prio(vha, fcport);
5529 ret = qla24xx_set_fcp_prio(ha, fcport->loop_id, priority, mb); 5594 ret = qla24xx_set_fcp_prio(vha, fcport->loop_id, priority, mb);
5530 if (ret == QLA_SUCCESS) 5595 if (ret == QLA_SUCCESS)
5531 fcport->fcp_prio = priority; 5596 fcport->fcp_prio = priority;
5532 else 5597 else
5533 DEBUG2(printk(KERN_WARNING 5598 DEBUG2(printk(KERN_WARNING
5534 "scsi(%ld): Unable to activate fcp priority, " 5599 "scsi(%ld): Unable to activate fcp priority, "
5535 " ret=0x%x\n", ha->host_no, ret)); 5600 " ret=0x%x\n", vha->host_no, ret));
5536 5601
5537 return ret; 5602 return ret;
5538} 5603}
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 7f77898486a9..d17ed9a94a0c 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -321,6 +321,7 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)
321 struct qla_hw_data *ha = vha->hw; 321 struct qla_hw_data *ha = vha->hw;
322 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; 322 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
323 struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; 323 struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24;
324 struct device_reg_82xx __iomem *reg82 = &ha->iobase->isp82;
324 uint32_t rscn_entry, host_pid; 325 uint32_t rscn_entry, host_pid;
325 uint8_t rscn_queue_index; 326 uint8_t rscn_queue_index;
326 unsigned long flags; 327 unsigned long flags;
@@ -498,6 +499,7 @@ skip_rio:
498 499
499 case MBA_LOOP_DOWN: /* Loop Down Event */ 500 case MBA_LOOP_DOWN: /* Loop Down Event */
500 mbx = IS_QLA81XX(ha) ? RD_REG_WORD(&reg24->mailbox4) : 0; 501 mbx = IS_QLA81XX(ha) ? RD_REG_WORD(&reg24->mailbox4) : 0;
502 mbx = IS_QLA82XX(ha) ? RD_REG_WORD(&reg82->mailbox_out[4]) : mbx;
501 DEBUG2(printk("scsi(%ld): Asynchronous LOOP DOWN " 503 DEBUG2(printk("scsi(%ld): Asynchronous LOOP DOWN "
502 "(%x %x %x %x).\n", vha->host_no, mb[1], mb[2], mb[3], 504 "(%x %x %x %x).\n", vha->host_no, mb[1], mb[2], mb[3],
503 mbx)); 505 mbx));
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index effd8a1403d9..e473e9fb363c 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -4125,7 +4125,7 @@ qla24xx_set_fcp_prio(scsi_qla_host_t *vha, uint16_t loop_id, uint16_t priority,
4125 return QLA_FUNCTION_FAILED; 4125 return QLA_FUNCTION_FAILED;
4126 4126
4127 DEBUG11(printk(KERN_INFO 4127 DEBUG11(printk(KERN_INFO
4128 "%s(%ld): entered.\n", __func__, ha->host_no)); 4128 "%s(%ld): entered.\n", __func__, vha->host_no));
4129 4129
4130 mcp->mb[0] = MBC_PORT_PARAMS; 4130 mcp->mb[0] = MBC_PORT_PARAMS;
4131 mcp->mb[1] = loop_id; 4131 mcp->mb[1] = loop_id;
@@ -4160,6 +4160,71 @@ qla24xx_set_fcp_prio(scsi_qla_host_t *vha, uint16_t loop_id, uint16_t priority,
4160} 4160}
4161 4161
4162int 4162int
4163qla2x00_get_thermal_temp(scsi_qla_host_t *vha, uint16_t *temp, uint16_t *frac)
4164{
4165 int rval;
4166 mbx_cmd_t mc;
4167 mbx_cmd_t *mcp = &mc;
4168 struct qla_hw_data *ha = vha->hw;
4169
4170 DEBUG11(printk(KERN_INFO "%s(%ld): entered.\n", __func__, ha->host_no));
4171
4172 /* High bits. */
4173 mcp->mb[0] = MBC_READ_SFP;
4174 mcp->mb[1] = 0x98;
4175 mcp->mb[2] = 0;
4176 mcp->mb[3] = 0;
4177 mcp->mb[6] = 0;
4178 mcp->mb[7] = 0;
4179 mcp->mb[8] = 1;
4180 mcp->mb[9] = 0x01;
4181 mcp->mb[10] = BIT_13|BIT_0;
4182 mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
4183 mcp->in_mb = MBX_1|MBX_0;
4184 mcp->tov = MBX_TOV_SECONDS;
4185 mcp->flags = 0;
4186 rval = qla2x00_mailbox_command(vha, mcp);
4187 if (rval != QLA_SUCCESS) {
4188 DEBUG2_3_11(printk(KERN_WARNING
4189 "%s(%ld): failed=%x (%x).\n", __func__,
4190 vha->host_no, rval, mcp->mb[0]));
4191 ha->flags.thermal_supported = 0;
4192 goto fail;
4193 }
4194 *temp = mcp->mb[1] & 0xFF;
4195
4196 /* Low bits. */
4197 mcp->mb[0] = MBC_READ_SFP;
4198 mcp->mb[1] = 0x98;
4199 mcp->mb[2] = 0;
4200 mcp->mb[3] = 0;
4201 mcp->mb[6] = 0;
4202 mcp->mb[7] = 0;
4203 mcp->mb[8] = 1;
4204 mcp->mb[9] = 0x10;
4205 mcp->mb[10] = BIT_13|BIT_0;
4206 mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
4207 mcp->in_mb = MBX_1|MBX_0;
4208 mcp->tov = MBX_TOV_SECONDS;
4209 mcp->flags = 0;
4210 rval = qla2x00_mailbox_command(vha, mcp);
4211 if (rval != QLA_SUCCESS) {
4212 DEBUG2_3_11(printk(KERN_WARNING
4213 "%s(%ld): failed=%x (%x).\n", __func__,
4214 vha->host_no, rval, mcp->mb[0]));
4215 ha->flags.thermal_supported = 0;
4216 goto fail;
4217 }
4218 *frac = ((mcp->mb[1] & 0xFF) >> 6) * 25;
4219
4220 if (rval == QLA_SUCCESS)
4221 DEBUG11(printk(KERN_INFO
4222 "%s(%ld): done.\n", __func__, ha->host_no));
4223fail:
4224 return rval;
4225}
4226
4227int
4163qla82xx_mbx_intr_enable(scsi_qla_host_t *vha) 4228qla82xx_mbx_intr_enable(scsi_qla_host_t *vha)
4164{ 4229{
4165 int rval; 4230 int rval;
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index ae2acacc0003..fdb96a3584a5 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -1079,11 +1079,55 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha)
1079 1079
1080 /* Halt all the indiviual PEGs and other blocks of the ISP */ 1080 /* Halt all the indiviual PEGs and other blocks of the ISP */
1081 qla82xx_rom_lock(ha); 1081 qla82xx_rom_lock(ha);
1082
1083 /* mask all niu interrupts */
1084 qla82xx_wr_32(ha, QLA82XX_CRB_NIU + 0x40, 0xff);
1085 /* disable xge rx/tx */
1086 qla82xx_wr_32(ha, QLA82XX_CRB_NIU + 0x70000, 0x00);
1087 /* disable xg1 rx/tx */
1088 qla82xx_wr_32(ha, QLA82XX_CRB_NIU + 0x80000, 0x00);
1089
1090 /* halt sre */
1091 val = qla82xx_rd_32(ha, QLA82XX_CRB_SRE + 0x1000);
1092 qla82xx_wr_32(ha, QLA82XX_CRB_SRE + 0x1000, val & (~(0x1)));
1093
1094 /* halt epg */
1095 qla82xx_wr_32(ha, QLA82XX_CRB_EPG + 0x1300, 0x1);
1096
1097 /* halt timers */
1098 qla82xx_wr_32(ha, QLA82XX_CRB_TIMER + 0x0, 0x0);
1099 qla82xx_wr_32(ha, QLA82XX_CRB_TIMER + 0x8, 0x0);
1100 qla82xx_wr_32(ha, QLA82XX_CRB_TIMER + 0x10, 0x0);
1101 qla82xx_wr_32(ha, QLA82XX_CRB_TIMER + 0x18, 0x0);
1102 qla82xx_wr_32(ha, QLA82XX_CRB_TIMER + 0x100, 0x0);
1103
1104 /* halt pegs */
1105 qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_0 + 0x3c, 1);
1106 qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_1 + 0x3c, 1);
1107 qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_2 + 0x3c, 1);
1108 qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_3 + 0x3c, 1);
1109 qla82xx_wr_32(ha, QLA82XX_CRB_PEG_NET_4 + 0x3c, 1);
1110
1111 /* big hammer */
1112 msleep(1000);
1082 if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) 1113 if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))
1083 /* don't reset CAM block on reset */ 1114 /* don't reset CAM block on reset */
1084 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xfeffffff); 1115 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xfeffffff);
1085 else 1116 else
1086 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xffffffff); 1117 qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xffffffff);
1118
1119 /* reset ms */
1120 val = qla82xx_rd_32(ha, QLA82XX_CRB_QDR_NET + 0xe4);
1121 val |= (1 << 1);
1122 qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val);
1123 msleep(20);
1124
1125 /* unreset ms */
1126 val = qla82xx_rd_32(ha, QLA82XX_CRB_QDR_NET + 0xe4);
1127 val &= ~(1 << 1);
1128 qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val);
1129 msleep(20);
1130
1087 qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); 1131 qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK));
1088 1132
1089 /* Read the signature value from the flash. 1133 /* Read the signature value from the flash.
@@ -1210,25 +1254,6 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha)
1210} 1254}
1211 1255
1212static int 1256static int
1213qla82xx_check_for_bad_spd(struct qla_hw_data *ha)
1214{
1215 u32 val = 0;
1216 val = qla82xx_rd_32(ha, BOOT_LOADER_DIMM_STATUS);
1217 val &= QLA82XX_BOOT_LOADER_MN_ISSUE;
1218 if (val & QLA82XX_PEG_TUNE_MN_SPD_ZEROED) {
1219 qla_printk(KERN_INFO, ha,
1220 "Memory DIMM SPD not programmed. "
1221 " Assumed valid.\n");
1222 return 1;
1223 } else if (val) {
1224 qla_printk(KERN_INFO, ha,
1225 "Memory DIMM type incorrect.Info:%08X.\n", val);
1226 return 2;
1227 }
1228 return 0;
1229}
1230
1231static int
1232qla82xx_pci_mem_write_2M(struct qla_hw_data *ha, 1257qla82xx_pci_mem_write_2M(struct qla_hw_data *ha,
1233 u64 off, void *data, int size) 1258 u64 off, void *data, int size)
1234{ 1259{
@@ -1293,11 +1318,6 @@ qla82xx_pci_mem_write_2M(struct qla_hw_data *ha,
1293 word[startword+1] |= tmpw >> (sz[0] * 8); 1318 word[startword+1] |= tmpw >> (sz[0] * 8);
1294 } 1319 }
1295 1320
1296 /*
1297 * don't lock here - write_wx gets the lock if each time
1298 * write_lock_irqsave(&adapter->adapter_lock, flags);
1299 * netxen_nic_pci_change_crbwindow_128M(adapter, 0);
1300 */
1301 for (i = 0; i < loop; i++) { 1321 for (i = 0; i < loop; i++) {
1302 temp = off8 + (i << shift_amount); 1322 temp = off8 + (i << shift_amount);
1303 qla82xx_wr_32(ha, mem_crb+MIU_TEST_AGT_ADDR_LO, temp); 1323 qla82xx_wr_32(ha, mem_crb+MIU_TEST_AGT_ADDR_LO, temp);
@@ -1399,12 +1419,6 @@ qla82xx_pci_mem_read_2M(struct qla_hw_data *ha,
1399 off0[1] = 0; 1419 off0[1] = 0;
1400 sz[1] = size - sz[0]; 1420 sz[1] = size - sz[0];
1401 1421
1402 /*
1403 * don't lock here - write_wx gets the lock if each time
1404 * write_lock_irqsave(&adapter->adapter_lock, flags);
1405 * netxen_nic_pci_change_crbwindow_128M(adapter, 0);
1406 */
1407
1408 for (i = 0; i < loop; i++) { 1422 for (i = 0; i < loop; i++) {
1409 temp = off8 + (i << shift_amount); 1423 temp = off8 + (i << shift_amount);
1410 qla82xx_wr_32(ha, mem_crb + MIU_TEST_AGT_ADDR_LO, temp); 1424 qla82xx_wr_32(ha, mem_crb + MIU_TEST_AGT_ADDR_LO, temp);
@@ -1437,11 +1451,6 @@ qla82xx_pci_mem_read_2M(struct qla_hw_data *ha,
1437 } 1451 }
1438 } 1452 }
1439 1453
1440 /*
1441 * netxen_nic_pci_change_crbwindow_128M(adapter, 1);
1442 * write_unlock_irqrestore(&adapter->adapter_lock, flags);
1443 */
1444
1445 if (j >= MAX_CTL_CHECK) 1454 if (j >= MAX_CTL_CHECK)
1446 return -1; 1455 return -1;
1447 1456
@@ -1872,7 +1881,6 @@ qla82xx_check_cmdpeg_state(struct qla_hw_data *ha)
1872 qla_printk(KERN_INFO, ha, 1881 qla_printk(KERN_INFO, ha,
1873 "Cmd Peg initialization failed: 0x%x.\n", val); 1882 "Cmd Peg initialization failed: 0x%x.\n", val);
1874 1883
1875 qla82xx_check_for_bad_spd(ha);
1876 val = qla82xx_rd_32(ha, QLA82XX_ROMUSB_GLB_PEGTUNE_DONE); 1884 val = qla82xx_rd_32(ha, QLA82XX_ROMUSB_GLB_PEGTUNE_DONE);
1877 read_lock(&ha->hw_lock); 1885 read_lock(&ha->hw_lock);
1878 qla82xx_wr_32(ha, CRB_CMDPEG_STATE, PHAN_INITIALIZE_FAILED); 1886 qla82xx_wr_32(ha, CRB_CMDPEG_STATE, PHAN_INITIALIZE_FAILED);
@@ -2343,6 +2351,17 @@ qla82xx_set_qsnt_ready(struct qla_hw_data *ha)
2343 qla82xx_wr_32(ha, QLA82XX_CRB_DRV_STATE, qsnt_state); 2351 qla82xx_wr_32(ha, QLA82XX_CRB_DRV_STATE, qsnt_state);
2344} 2352}
2345 2353
2354void
2355qla82xx_clear_qsnt_ready(scsi_qla_host_t *vha)
2356{
2357 struct qla_hw_data *ha = vha->hw;
2358 uint32_t qsnt_state;
2359
2360 qsnt_state = qla82xx_rd_32(ha, QLA82XX_CRB_DRV_STATE);
2361 qsnt_state &= ~(QLA82XX_DRVST_QSNT_RDY << (ha->portnum * 4));
2362 qla82xx_wr_32(ha, QLA82XX_CRB_DRV_STATE, qsnt_state);
2363}
2364
2346static int 2365static int
2347qla82xx_load_fw(scsi_qla_host_t *vha) 2366qla82xx_load_fw(scsi_qla_host_t *vha)
2348{ 2367{
@@ -2542,7 +2561,7 @@ qla2xx_build_scsi_type_6_iocbs(srb_t *sp, struct cmd_type_6 *cmd_pkt,
2542 *cur_dsd++ = cpu_to_le32(LSD(sle_dma)); 2561 *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
2543 *cur_dsd++ = cpu_to_le32(MSD(sle_dma)); 2562 *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
2544 *cur_dsd++ = cpu_to_le32(sg_dma_len(cur_seg)); 2563 *cur_dsd++ = cpu_to_le32(sg_dma_len(cur_seg));
2545 cur_seg++; 2564 cur_seg = sg_next(cur_seg);
2546 avail_dsds--; 2565 avail_dsds--;
2547 } 2566 }
2548 } 2567 }
@@ -3261,6 +3280,104 @@ dev_ready:
3261 return QLA_SUCCESS; 3280 return QLA_SUCCESS;
3262} 3281}
3263 3282
3283/*
3284* qla82xx_need_qsnt_handler
3285* Code to start quiescence sequence
3286*
3287* Note:
3288* IDC lock must be held upon entry
3289*
3290* Return: void
3291*/
3292
3293static void
3294qla82xx_need_qsnt_handler(scsi_qla_host_t *vha)
3295{
3296 struct qla_hw_data *ha = vha->hw;
3297 uint32_t dev_state, drv_state, drv_active;
3298 unsigned long reset_timeout;
3299
3300 if (vha->flags.online) {
3301 /*Block any further I/O and wait for pending cmnds to complete*/
3302 qla82xx_quiescent_state_cleanup(vha);
3303 }
3304
3305 /* Set the quiescence ready bit */
3306 qla82xx_set_qsnt_ready(ha);
3307
3308 /*wait for 30 secs for other functions to ack */
3309 reset_timeout = jiffies + (30 * HZ);
3310
3311 drv_state = qla82xx_rd_32(ha, QLA82XX_CRB_DRV_STATE);
3312 drv_active = qla82xx_rd_32(ha, QLA82XX_CRB_DRV_ACTIVE);
3313 /* Its 2 that is written when qsnt is acked, moving one bit */
3314 drv_active = drv_active << 0x01;
3315
3316 while (drv_state != drv_active) {
3317
3318 if (time_after_eq(jiffies, reset_timeout)) {
3319 /* quiescence timeout, other functions didn't ack
3320 * changing the state to DEV_READY
3321 */
3322 qla_printk(KERN_INFO, ha,
3323 "%s: QUIESCENT TIMEOUT\n", QLA2XXX_DRIVER_NAME);
3324 qla_printk(KERN_INFO, ha,
3325 "DRV_ACTIVE:%d DRV_STATE:%d\n", drv_active,
3326 drv_state);
3327 qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE,
3328 QLA82XX_DEV_READY);
3329 qla_printk(KERN_INFO, ha,
3330 "HW State: DEV_READY\n");
3331 qla82xx_idc_unlock(ha);
3332 qla2x00_perform_loop_resync(vha);
3333 qla82xx_idc_lock(ha);
3334
3335 qla82xx_clear_qsnt_ready(vha);
3336 return;
3337 }
3338
3339 qla82xx_idc_unlock(ha);
3340 msleep(1000);
3341 qla82xx_idc_lock(ha);
3342
3343 drv_state = qla82xx_rd_32(ha, QLA82XX_CRB_DRV_STATE);
3344 drv_active = qla82xx_rd_32(ha, QLA82XX_CRB_DRV_ACTIVE);
3345 drv_active = drv_active << 0x01;
3346 }
3347 dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
3348 /* everyone acked so set the state to DEV_QUIESCENCE */
3349 if (dev_state == QLA82XX_DEV_NEED_QUIESCENT) {
3350 qla_printk(KERN_INFO, ha, "HW State: DEV_QUIESCENT\n");
3351 qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_QUIESCENT);
3352 }
3353}
3354
3355/*
3356* qla82xx_wait_for_state_change
3357* Wait for device state to change from given current state
3358*
3359* Note:
3360* IDC lock must not be held upon entry
3361*
3362* Return:
3363* Changed device state.
3364*/
3365uint32_t
3366qla82xx_wait_for_state_change(scsi_qla_host_t *vha, uint32_t curr_state)
3367{
3368 struct qla_hw_data *ha = vha->hw;
3369 uint32_t dev_state;
3370
3371 do {
3372 msleep(1000);
3373 qla82xx_idc_lock(ha);
3374 dev_state = qla82xx_rd_32(ha, QLA82XX_CRB_DEV_STATE);
3375 qla82xx_idc_unlock(ha);
3376 } while (dev_state == curr_state);
3377
3378 return dev_state;
3379}
3380
3264static void 3381static void
3265qla82xx_dev_failed_handler(scsi_qla_host_t *vha) 3382qla82xx_dev_failed_handler(scsi_qla_host_t *vha)
3266{ 3383{
@@ -3439,15 +3556,28 @@ qla82xx_device_state_handler(scsi_qla_host_t *vha)
3439 qla82xx_idc_lock(ha); 3556 qla82xx_idc_lock(ha);
3440 break; 3557 break;
3441 case QLA82XX_DEV_NEED_RESET: 3558 case QLA82XX_DEV_NEED_RESET:
3442 if (!ql2xdontresethba) 3559 qla82xx_need_reset_handler(vha);
3443 qla82xx_need_reset_handler(vha);
3444 break; 3560 break;
3445 case QLA82XX_DEV_NEED_QUIESCENT: 3561 case QLA82XX_DEV_NEED_QUIESCENT:
3446 qla82xx_set_qsnt_ready(ha); 3562 qla82xx_need_qsnt_handler(vha);
3563 /* Reset timeout value after quiescence handler */
3564 dev_init_timeout = jiffies + (ha->nx_dev_init_timeout\
3565 * HZ);
3566 break;
3447 case QLA82XX_DEV_QUIESCENT: 3567 case QLA82XX_DEV_QUIESCENT:
3568 /* Owner will exit and other will wait for the state
3569 * to get changed
3570 */
3571 if (ha->flags.quiesce_owner)
3572 goto exit;
3573
3448 qla82xx_idc_unlock(ha); 3574 qla82xx_idc_unlock(ha);
3449 msleep(1000); 3575 msleep(1000);
3450 qla82xx_idc_lock(ha); 3576 qla82xx_idc_lock(ha);
3577
3578 /* Reset timeout value after quiescence handler */
3579 dev_init_timeout = jiffies + (ha->nx_dev_init_timeout\
3580 * HZ);
3451 break; 3581 break;
3452 case QLA82XX_DEV_FAILED: 3582 case QLA82XX_DEV_FAILED:
3453 qla82xx_dev_failed_handler(vha); 3583 qla82xx_dev_failed_handler(vha);
@@ -3490,6 +3620,13 @@ void qla82xx_watchdog(scsi_qla_host_t *vha)
3490 &ha->mbx_cmd_flags)) 3620 &ha->mbx_cmd_flags))
3491 complete(&ha->mbx_intr_comp); 3621 complete(&ha->mbx_intr_comp);
3492 } 3622 }
3623 } else if (dev_state == QLA82XX_DEV_NEED_QUIESCENT &&
3624 !test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags)) {
3625 DEBUG(qla_printk(KERN_INFO, ha,
3626 "scsi(%ld) %s - detected quiescence needed\n",
3627 vha->host_no, __func__));
3628 set_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags);
3629 qla2xxx_wake_dpc(vha);
3493 } else { 3630 } else {
3494 qla82xx_check_fw_alive(vha); 3631 qla82xx_check_fw_alive(vha);
3495 } 3632 }
diff --git a/drivers/scsi/qla2xxx/qla_nx.h b/drivers/scsi/qla2xxx/qla_nx.h
index 51ec0c5380e8..ed5883f1778a 100644
--- a/drivers/scsi/qla2xxx/qla_nx.h
+++ b/drivers/scsi/qla2xxx/qla_nx.h
@@ -523,8 +523,6 @@
523# define QLA82XX_CAM_RAM_BASE (QLA82XX_CRB_CAM + 0x02000) 523# define QLA82XX_CAM_RAM_BASE (QLA82XX_CRB_CAM + 0x02000)
524# define QLA82XX_CAM_RAM(reg) (QLA82XX_CAM_RAM_BASE + (reg)) 524# define QLA82XX_CAM_RAM(reg) (QLA82XX_CAM_RAM_BASE + (reg))
525 525
526#define QLA82XX_PEG_TUNE_MN_SPD_ZEROED 0x80000000
527#define QLA82XX_BOOT_LOADER_MN_ISSUE 0xff00ffff
528#define QLA82XX_PORT_MODE_ADDR (QLA82XX_CAM_RAM(0x24)) 526#define QLA82XX_PORT_MODE_ADDR (QLA82XX_CAM_RAM(0x24))
529#define QLA82XX_PEG_HALT_STATUS1 (QLA82XX_CAM_RAM(0xa8)) 527#define QLA82XX_PEG_HALT_STATUS1 (QLA82XX_CAM_RAM(0xa8))
530#define QLA82XX_PEG_HALT_STATUS2 (QLA82XX_CAM_RAM(0xac)) 528#define QLA82XX_PEG_HALT_STATUS2 (QLA82XX_CAM_RAM(0xac))
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 2c0876c81a3f..c194c23ca1fb 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -37,12 +37,12 @@ static struct kmem_cache *srb_cachep;
37static struct kmem_cache *ctx_cachep; 37static struct kmem_cache *ctx_cachep;
38 38
39int ql2xlogintimeout = 20; 39int ql2xlogintimeout = 20;
40module_param(ql2xlogintimeout, int, S_IRUGO|S_IRUSR); 40module_param(ql2xlogintimeout, int, S_IRUGO);
41MODULE_PARM_DESC(ql2xlogintimeout, 41MODULE_PARM_DESC(ql2xlogintimeout,
42 "Login timeout value in seconds."); 42 "Login timeout value in seconds.");
43 43
44int qlport_down_retry; 44int qlport_down_retry;
45module_param(qlport_down_retry, int, S_IRUGO|S_IRUSR); 45module_param(qlport_down_retry, int, S_IRUGO);
46MODULE_PARM_DESC(qlport_down_retry, 46MODULE_PARM_DESC(qlport_down_retry,
47 "Maximum number of command retries to a port that returns " 47 "Maximum number of command retries to a port that returns "
48 "a PORT-DOWN status."); 48 "a PORT-DOWN status.");
@@ -55,12 +55,12 @@ MODULE_PARM_DESC(ql2xplogiabsentdevice,
55 "Default is 0 - no PLOGI. 1 - perfom PLOGI."); 55 "Default is 0 - no PLOGI. 1 - perfom PLOGI.");
56 56
57int ql2xloginretrycount = 0; 57int ql2xloginretrycount = 0;
58module_param(ql2xloginretrycount, int, S_IRUGO|S_IRUSR); 58module_param(ql2xloginretrycount, int, S_IRUGO);
59MODULE_PARM_DESC(ql2xloginretrycount, 59MODULE_PARM_DESC(ql2xloginretrycount,
60 "Specify an alternate value for the NVRAM login retry count."); 60 "Specify an alternate value for the NVRAM login retry count.");
61 61
62int ql2xallocfwdump = 1; 62int ql2xallocfwdump = 1;
63module_param(ql2xallocfwdump, int, S_IRUGO|S_IRUSR); 63module_param(ql2xallocfwdump, int, S_IRUGO);
64MODULE_PARM_DESC(ql2xallocfwdump, 64MODULE_PARM_DESC(ql2xallocfwdump,
65 "Option to enable allocation of memory for a firmware dump " 65 "Option to enable allocation of memory for a firmware dump "
66 "during HBA initialization. Memory allocation requirements " 66 "during HBA initialization. Memory allocation requirements "
@@ -73,7 +73,7 @@ MODULE_PARM_DESC(ql2xextended_error_logging,
73 "Default is 0 - no logging. 1 - log errors."); 73 "Default is 0 - no logging. 1 - log errors.");
74 74
75int ql2xshiftctondsd = 6; 75int ql2xshiftctondsd = 6;
76module_param(ql2xshiftctondsd, int, S_IRUGO|S_IRUSR); 76module_param(ql2xshiftctondsd, int, S_IRUGO);
77MODULE_PARM_DESC(ql2xshiftctondsd, 77MODULE_PARM_DESC(ql2xshiftctondsd,
78 "Set to control shifting of command type processing " 78 "Set to control shifting of command type processing "
79 "based on total number of SG elements."); 79 "based on total number of SG elements.");
@@ -81,7 +81,7 @@ MODULE_PARM_DESC(ql2xshiftctondsd,
81static void qla2x00_free_device(scsi_qla_host_t *); 81static void qla2x00_free_device(scsi_qla_host_t *);
82 82
83int ql2xfdmienable=1; 83int ql2xfdmienable=1;
84module_param(ql2xfdmienable, int, S_IRUGO|S_IRUSR); 84module_param(ql2xfdmienable, int, S_IRUGO);
85MODULE_PARM_DESC(ql2xfdmienable, 85MODULE_PARM_DESC(ql2xfdmienable,
86 "Enables FDMI registrations. " 86 "Enables FDMI registrations. "
87 "0 - no FDMI. Default is 1 - perform FDMI."); 87 "0 - no FDMI. Default is 1 - perform FDMI.");
@@ -106,27 +106,27 @@ MODULE_PARM_DESC(ql2xenablehba_err_chk,
106 " Default is 0 - Error isolation disabled, 1 - Enable it"); 106 " Default is 0 - Error isolation disabled, 1 - Enable it");
107 107
108int ql2xiidmaenable=1; 108int ql2xiidmaenable=1;
109module_param(ql2xiidmaenable, int, S_IRUGO|S_IRUSR); 109module_param(ql2xiidmaenable, int, S_IRUGO);
110MODULE_PARM_DESC(ql2xiidmaenable, 110MODULE_PARM_DESC(ql2xiidmaenable,
111 "Enables iIDMA settings " 111 "Enables iIDMA settings "
112 "Default is 1 - perform iIDMA. 0 - no iIDMA."); 112 "Default is 1 - perform iIDMA. 0 - no iIDMA.");
113 113
114int ql2xmaxqueues = 1; 114int ql2xmaxqueues = 1;
115module_param(ql2xmaxqueues, int, S_IRUGO|S_IRUSR); 115module_param(ql2xmaxqueues, int, S_IRUGO);
116MODULE_PARM_DESC(ql2xmaxqueues, 116MODULE_PARM_DESC(ql2xmaxqueues,
117 "Enables MQ settings " 117 "Enables MQ settings "
118 "Default is 1 for single queue. Set it to number " 118 "Default is 1 for single queue. Set it to number "
119 "of queues in MQ mode."); 119 "of queues in MQ mode.");
120 120
121int ql2xmultique_tag; 121int ql2xmultique_tag;
122module_param(ql2xmultique_tag, int, S_IRUGO|S_IRUSR); 122module_param(ql2xmultique_tag, int, S_IRUGO);
123MODULE_PARM_DESC(ql2xmultique_tag, 123MODULE_PARM_DESC(ql2xmultique_tag,
124 "Enables CPU affinity settings for the driver " 124 "Enables CPU affinity settings for the driver "
125 "Default is 0 for no affinity of request and response IO. " 125 "Default is 0 for no affinity of request and response IO. "
126 "Set it to 1 to turn on the cpu affinity."); 126 "Set it to 1 to turn on the cpu affinity.");
127 127
128int ql2xfwloadbin; 128int ql2xfwloadbin;
129module_param(ql2xfwloadbin, int, S_IRUGO|S_IRUSR); 129module_param(ql2xfwloadbin, int, S_IRUGO);
130MODULE_PARM_DESC(ql2xfwloadbin, 130MODULE_PARM_DESC(ql2xfwloadbin,
131 "Option to specify location from which to load ISP firmware:\n" 131 "Option to specify location from which to load ISP firmware:\n"
132 " 2 -- load firmware via the request_firmware() (hotplug)\n" 132 " 2 -- load firmware via the request_firmware() (hotplug)\n"
@@ -135,39 +135,32 @@ MODULE_PARM_DESC(ql2xfwloadbin,
135 " 0 -- use default semantics.\n"); 135 " 0 -- use default semantics.\n");
136 136
137int ql2xetsenable; 137int ql2xetsenable;
138module_param(ql2xetsenable, int, S_IRUGO|S_IRUSR); 138module_param(ql2xetsenable, int, S_IRUGO);
139MODULE_PARM_DESC(ql2xetsenable, 139MODULE_PARM_DESC(ql2xetsenable,
140 "Enables firmware ETS burst." 140 "Enables firmware ETS burst."
141 "Default is 0 - skip ETS enablement."); 141 "Default is 0 - skip ETS enablement.");
142 142
143int ql2xdbwr = 1; 143int ql2xdbwr = 1;
144module_param(ql2xdbwr, int, S_IRUGO|S_IRUSR); 144module_param(ql2xdbwr, int, S_IRUGO);
145MODULE_PARM_DESC(ql2xdbwr, 145MODULE_PARM_DESC(ql2xdbwr,
146 "Option to specify scheme for request queue posting\n" 146 "Option to specify scheme for request queue posting\n"
147 " 0 -- Regular doorbell.\n" 147 " 0 -- Regular doorbell.\n"
148 " 1 -- CAMRAM doorbell (faster).\n"); 148 " 1 -- CAMRAM doorbell (faster).\n");
149 149
150int ql2xdontresethba;
151module_param(ql2xdontresethba, int, S_IRUGO|S_IRUSR);
152MODULE_PARM_DESC(ql2xdontresethba,
153 "Option to specify reset behaviour\n"
154 " 0 (Default) -- Reset on failure.\n"
155 " 1 -- Do not reset on failure.\n");
156
157int ql2xtargetreset = 1; 150int ql2xtargetreset = 1;
158module_param(ql2xtargetreset, int, S_IRUGO|S_IRUSR); 151module_param(ql2xtargetreset, int, S_IRUGO);
159MODULE_PARM_DESC(ql2xtargetreset, 152MODULE_PARM_DESC(ql2xtargetreset,
160 "Enable target reset." 153 "Enable target reset."
161 "Default is 1 - use hw defaults."); 154 "Default is 1 - use hw defaults.");
162 155
163int ql2xgffidenable; 156int ql2xgffidenable;
164module_param(ql2xgffidenable, int, S_IRUGO|S_IRUSR); 157module_param(ql2xgffidenable, int, S_IRUGO);
165MODULE_PARM_DESC(ql2xgffidenable, 158MODULE_PARM_DESC(ql2xgffidenable,
166 "Enables GFF_ID checks of port type. " 159 "Enables GFF_ID checks of port type. "
167 "Default is 0 - Do not use GFF_ID information."); 160 "Default is 0 - Do not use GFF_ID information.");
168 161
169int ql2xasynctmfenable; 162int ql2xasynctmfenable;
170module_param(ql2xasynctmfenable, int, S_IRUGO|S_IRUSR); 163module_param(ql2xasynctmfenable, int, S_IRUGO);
171MODULE_PARM_DESC(ql2xasynctmfenable, 164MODULE_PARM_DESC(ql2xasynctmfenable,
172 "Enables issue of TM IOCBs asynchronously via IOCB mechanism" 165 "Enables issue of TM IOCBs asynchronously via IOCB mechanism"
173 "Default is 0 - Issue TM IOCBs via mailbox mechanism."); 166 "Default is 0 - Issue TM IOCBs via mailbox mechanism.");
@@ -2371,7 +2364,7 @@ qla2x00_remove_one(struct pci_dev *pdev)
2371 list_for_each_entry(vha, &ha->vp_list, list) { 2364 list_for_each_entry(vha, &ha->vp_list, list) {
2372 atomic_inc(&vha->vref_count); 2365 atomic_inc(&vha->vref_count);
2373 2366
2374 if (vha && vha->fc_vport) { 2367 if (vha->fc_vport) {
2375 spin_unlock_irqrestore(&ha->vport_slock, flags); 2368 spin_unlock_irqrestore(&ha->vport_slock, flags);
2376 2369
2377 fc_vport_terminate(vha->fc_vport); 2370 fc_vport_terminate(vha->fc_vport);
@@ -3386,6 +3379,21 @@ qla2x00_do_dpc(void *data)
3386 clear_bit(FCPORT_UPDATE_NEEDED, &base_vha->dpc_flags); 3379 clear_bit(FCPORT_UPDATE_NEEDED, &base_vha->dpc_flags);
3387 } 3380 }
3388 3381
3382 if (test_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags)) {
3383 DEBUG(printk(KERN_INFO "scsi(%ld): dpc: sched "
3384 "qla2x00_quiesce_needed ha = %p\n",
3385 base_vha->host_no, ha));
3386 qla82xx_device_state_handler(base_vha);
3387 clear_bit(ISP_QUIESCE_NEEDED, &base_vha->dpc_flags);
3388 if (!ha->flags.quiesce_owner) {
3389 qla2x00_perform_loop_resync(base_vha);
3390
3391 qla82xx_idc_lock(ha);
3392 qla82xx_clear_qsnt_ready(base_vha);
3393 qla82xx_idc_unlock(ha);
3394 }
3395 }
3396
3389 if (test_and_clear_bit(RESET_MARKER_NEEDED, 3397 if (test_and_clear_bit(RESET_MARKER_NEEDED,
3390 &base_vha->dpc_flags) && 3398 &base_vha->dpc_flags) &&
3391 (!(test_and_set_bit(RESET_ACTIVE, &base_vha->dpc_flags)))) { 3399 (!(test_and_set_bit(RESET_ACTIVE, &base_vha->dpc_flags)))) {
@@ -3589,13 +3597,16 @@ qla2x00_timer(scsi_qla_host_t *vha)
3589 return; 3597 return;
3590 } 3598 }
3591 3599
3592 if (IS_QLA82XX(ha))
3593 qla82xx_watchdog(vha);
3594
3595 /* Hardware read to raise pending EEH errors during mailbox waits. */ 3600 /* Hardware read to raise pending EEH errors during mailbox waits. */
3596 if (!pci_channel_offline(ha->pdev)) 3601 if (!pci_channel_offline(ha->pdev))
3597 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w); 3602 pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w);
3598 3603
3604 if (IS_QLA82XX(ha)) {
3605 if (test_bit(ISP_QUIESCE_NEEDED, &vha->dpc_flags))
3606 start_dpc++;
3607 qla82xx_watchdog(vha);
3608 }
3609
3599 /* Loop down handler. */ 3610 /* Loop down handler. */
3600 if (atomic_read(&vha->loop_down_timer) > 0 && 3611 if (atomic_read(&vha->loop_down_timer) > 0 &&
3601 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) 3612 !(test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index 76de9574b385..22070621206c 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -669,6 +669,13 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
669 def = 1; 669 def = 1;
670 else if (IS_QLA81XX(ha)) 670 else if (IS_QLA81XX(ha))
671 def = 2; 671 def = 2;
672
673 /* Assign FCP prio region since older adapters may not have FLT, or
674 FCP prio region in it's FLT.
675 */
676 ha->flt_region_fcp_prio = ha->flags.port0 ?
677 fcp_prio_cfg0[def] : fcp_prio_cfg1[def];
678
672 ha->flt_region_flt = flt_addr; 679 ha->flt_region_flt = flt_addr;
673 wptr = (uint16_t *)req->ring; 680 wptr = (uint16_t *)req->ring;
674 flt = (struct qla_flt_header *)req->ring; 681 flt = (struct qla_flt_header *)req->ring;
@@ -696,10 +703,6 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
696 goto no_flash_data; 703 goto no_flash_data;
697 } 704 }
698 705
699 /* Assign FCP prio region since older FLT's may not have it */
700 ha->flt_region_fcp_prio = ha->flags.port0 ?
701 fcp_prio_cfg0[def] : fcp_prio_cfg1[def];
702
703 loc = locations[1]; 706 loc = locations[1];
704 cnt = le16_to_cpu(flt->length) / sizeof(struct qla_flt_region); 707 cnt = le16_to_cpu(flt->length) / sizeof(struct qla_flt_region);
705 for ( ; cnt; cnt--, region++) { 708 for ( ; cnt; cnt--, region++) {