aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorVikas Chaudhary <vikas.chaudhary@qlogic.com>2012-08-22 07:55:06 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-09-24 04:11:07 -0400
commit83dbdf6f5205832fd5b98d9324fad51927832879 (patch)
tree9a74b33840ac77bb9c6a9b37ae58cba0e7699e8a /drivers/scsi
parentee996a691752ae55d26c1dd6de7421c1eb64cffb (diff)
[SCSI] qla4xxx: Set IDC version in correct way
Issue: Device can go to READY state from COLD and skip INITIALIZATION, In this case driver will never set IDC version from function qla4_8xxx_device_bootstrap(). Fix: 1. Set IDC version at start of function qla4_82xx_need_reset_handler(). 2. Set IDC version only if we are 1st driver to load. 3. Added new function qla4_8xxx_update_idc_reg() to set all idc reg at one place. Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qla4xxx/ql4_nx.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index 13d8e4895f5..70793bf9cbc 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -2337,10 +2337,6 @@ dev_initialize:
2337 qla4_8xxx_wr_direct(ha, QLA8XXX_CRB_DEV_STATE, 2337 qla4_8xxx_wr_direct(ha, QLA8XXX_CRB_DEV_STATE,
2338 QLA8XXX_DEV_INITIALIZING); 2338 QLA8XXX_DEV_INITIALIZING);
2339 2339
2340 /* Driver that sets device state to initializating sets IDC version */
2341 qla4_8xxx_wr_direct(ha, QLA8XXX_CRB_DRV_IDC_VERSION,
2342 QLA82XX_IDC_VERSION);
2343
2344 ha->isp_ops->idc_unlock(ha); 2340 ha->isp_ops->idc_unlock(ha);
2345 if (ql4xenablemd && test_bit(AF_FW_RECOVERY, &ha->flags) && 2341 if (ql4xenablemd && test_bit(AF_FW_RECOVERY, &ha->flags) &&
2346 !test_and_set_bit(AF_82XX_FW_DUMPED, &ha->flags)) { 2342 !test_and_set_bit(AF_82XX_FW_DUMPED, &ha->flags)) {
@@ -2463,6 +2459,38 @@ qla4_8xxx_need_qsnt_handler(struct scsi_qla_host *ha)
2463 ha->isp_ops->idc_unlock(ha); 2459 ha->isp_ops->idc_unlock(ha);
2464} 2460}
2465 2461
2462static void qla4_82xx_set_idc_ver(struct scsi_qla_host *ha)
2463{
2464 int idc_ver;
2465 uint32_t drv_active;
2466
2467 drv_active = qla4_8xxx_rd_direct(ha, QLA8XXX_CRB_DRV_ACTIVE);
2468 if (drv_active == (1 << (ha->func_num * 4))) {
2469 qla4_8xxx_wr_direct(ha, QLA8XXX_CRB_DRV_IDC_VERSION,
2470 QLA82XX_IDC_VERSION);
2471 ql4_printk(KERN_INFO, ha,
2472 "%s: IDC version updated to %d\n", __func__,
2473 QLA82XX_IDC_VERSION);
2474 } else {
2475 idc_ver = qla4_8xxx_rd_direct(ha, QLA8XXX_CRB_DRV_IDC_VERSION);
2476 if (QLA82XX_IDC_VERSION != idc_ver) {
2477 ql4_printk(KERN_INFO, ha,
2478 "%s: qla4xxx driver IDC version %d is not compatible with IDC version %d of other drivers!\n",
2479 __func__, QLA82XX_IDC_VERSION, idc_ver);
2480 }
2481 }
2482}
2483
2484static void qla4_8xxx_update_idc_reg(struct scsi_qla_host *ha)
2485{
2486 if (!test_bit(AF_INIT_DONE, &ha->flags)) {
2487 ha->isp_ops->idc_lock(ha);
2488 qla4_8xxx_set_drv_active(ha);
2489 qla4_82xx_set_idc_ver(ha);
2490 ha->isp_ops->idc_unlock(ha);
2491 }
2492}
2493
2466/** 2494/**
2467 * qla4_8xxx_device_state_handler - Adapter state machine 2495 * qla4_8xxx_device_state_handler - Adapter state machine
2468 * @ha: pointer to host adapter structure. 2496 * @ha: pointer to host adapter structure.
@@ -2475,11 +2503,7 @@ int qla4_8xxx_device_state_handler(struct scsi_qla_host *ha)
2475 int rval = QLA_SUCCESS; 2503 int rval = QLA_SUCCESS;
2476 unsigned long dev_init_timeout; 2504 unsigned long dev_init_timeout;
2477 2505
2478 if (!test_bit(AF_INIT_DONE, &ha->flags)) { 2506 qla4_8xxx_update_idc_reg(ha);
2479 ha->isp_ops->idc_lock(ha);
2480 qla4_8xxx_set_drv_active(ha);
2481 ha->isp_ops->idc_unlock(ha);
2482 }
2483 2507
2484 dev_state = qla4_8xxx_rd_direct(ha, QLA8XXX_CRB_DEV_STATE); 2508 dev_state = qla4_8xxx_rd_direct(ha, QLA8XXX_CRB_DEV_STATE);
2485 DEBUG2(ql4_printk(KERN_INFO, ha, "Device state is 0x%x = %s\n", 2509 DEBUG2(ql4_printk(KERN_INFO, ha, "Device state is 0x%x = %s\n",