diff options
author | Lalit Chandivade <lalit.chandivade@qlogic.com> | 2011-10-08 01:55:43 +0200 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-10-16 18:09:14 +0200 |
commit | 8de5b9582420acac5129ec7921711aded75406c0 (patch) | |
tree | d262e065f01e29ae26b7001c771fe36da8e595fc /drivers/scsi/qla4xxx | |
parent | [SCSI] qla4xxx: Do not add duplicate CHAP entry in FLASH (diff) | |
download | linux-8de5b9582420acac5129ec7921711aded75406c0.tar.xz linux-8de5b9582420acac5129ec7921711aded75406c0.zip |
[SCSI] qla4xxx: Fix exporting boot targets to sysfs
The driver failed to export primary boot target if secondary target did not
exist in the FLASH. If boot targets are not valid then driver assumed 0 and
1 as default boot targets. Since these target did not exist in flash, the
driver failed exporting all the targets.
JIRA Key: UPSISCSI-148
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com>
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/qla4xxx')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_os.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 874621db4a98..0bcb6fdcc9a7 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -2812,15 +2812,11 @@ static int get_fw_boot_info(struct scsi_qla_host *ha, uint16_t ddb_index[]) val = rd_nvram_byte(ha, pri_addr); if (val & BIT_7) ddb_index[0] = (val & 0x7f); - else - ddb_index[0] = 0; /* get secondary valid target index */ val = rd_nvram_byte(ha, sec_addr); if (val & BIT_7) ddb_index[1] = (val & 0x7f); - else - ddb_index[1] = 1; } else if (is_qla8022(ha)) { buf = dma_alloc_coherent(&ha->pdev->dev, size, @@ -2862,15 +2858,10 @@ static int get_fw_boot_info(struct scsi_qla_host *ha, uint16_t ddb_index[]) /* get primary valid target index */ if (buf[2] & BIT_7) ddb_index[0] = buf[2] & 0x7f; - else - ddb_index[0] = 0; /* get secondary valid target index */ if (buf[11] & BIT_7) ddb_index[1] = buf[11] & 0x7f; - else - ddb_index[1] = 1; - } else { ret = QLA_ERROR; goto exit_boot_info; @@ -2980,9 +2971,12 @@ exit_boot_target: static int qla4xxx_get_boot_info(struct scsi_qla_host *ha) { uint16_t ddb_index[2]; - int ret = QLA_SUCCESS; + int ret = QLA_ERROR; + int rval; memset(ddb_index, 0, sizeof(ddb_index)); + ddb_index[0] = 0xffff; + ddb_index[1] = 0xffff; ret = get_fw_boot_info(ha, ddb_index); if (ret != QLA_SUCCESS) { DEBUG2(ql4_printk(KERN_ERR, ha, @@ -2990,19 +2984,30 @@ static int qla4xxx_get_boot_info(struct scsi_qla_host *ha) return ret; } - ret = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_pri_sess), + if (ddb_index[0] == 0xffff) + goto sec_target; + + rval = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_pri_sess), ddb_index[0]); - if (ret != QLA_SUCCESS) { + if (rval != QLA_SUCCESS) { DEBUG2(ql4_printk(KERN_ERR, ha, "%s: Failed to get " "primary target\n", __func__)); - } + } else + ret = QLA_SUCCESS; - ret = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_sec_sess), +sec_target: + if (ddb_index[1] == 0xffff) + goto exit_get_boot_info; + + rval = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_sec_sess), ddb_index[1]); - if (ret != QLA_SUCCESS) { + if (rval != QLA_SUCCESS) { DEBUG2(ql4_printk(KERN_ERR, ha, "%s: Failed to get " "secondary target\n", __func__)); - } + } else + ret = QLA_SUCCESS; + +exit_get_boot_info: return ret; } |