aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLalit Chandivade <lalit.chandivade@qlogic.com>2011-10-07 19:55:43 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-10-16 12:09:14 -0400
commit8de5b9582420acac5129ec7921711aded75406c0 (patch)
treed262e065f01e29ae26b7001c771fe36da8e595fc
parent4549415af6915017f5d3fbdbfd5edd1dfbe63fa9 (diff)
[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>
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c37
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[])
2812 val = rd_nvram_byte(ha, pri_addr); 2812 val = rd_nvram_byte(ha, pri_addr);
2813 if (val & BIT_7) 2813 if (val & BIT_7)
2814 ddb_index[0] = (val & 0x7f); 2814 ddb_index[0] = (val & 0x7f);
2815 else
2816 ddb_index[0] = 0;
2817 2815
2818 /* get secondary valid target index */ 2816 /* get secondary valid target index */
2819 val = rd_nvram_byte(ha, sec_addr); 2817 val = rd_nvram_byte(ha, sec_addr);
2820 if (val & BIT_7) 2818 if (val & BIT_7)
2821 ddb_index[1] = (val & 0x7f); 2819 ddb_index[1] = (val & 0x7f);
2822 else
2823 ddb_index[1] = 1;
2824 2820
2825 } else if (is_qla8022(ha)) { 2821 } else if (is_qla8022(ha)) {
2826 buf = dma_alloc_coherent(&ha->pdev->dev, size, 2822 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[])
2862 /* get primary valid target index */ 2858 /* get primary valid target index */
2863 if (buf[2] & BIT_7) 2859 if (buf[2] & BIT_7)
2864 ddb_index[0] = buf[2] & 0x7f; 2860 ddb_index[0] = buf[2] & 0x7f;
2865 else
2866 ddb_index[0] = 0;
2867 2861
2868 /* get secondary valid target index */ 2862 /* get secondary valid target index */
2869 if (buf[11] & BIT_7) 2863 if (buf[11] & BIT_7)
2870 ddb_index[1] = buf[11] & 0x7f; 2864 ddb_index[1] = buf[11] & 0x7f;
2871 else
2872 ddb_index[1] = 1;
2873
2874 } else { 2865 } else {
2875 ret = QLA_ERROR; 2866 ret = QLA_ERROR;
2876 goto exit_boot_info; 2867 goto exit_boot_info;
@@ -2980,9 +2971,12 @@ exit_boot_target:
2980static int qla4xxx_get_boot_info(struct scsi_qla_host *ha) 2971static int qla4xxx_get_boot_info(struct scsi_qla_host *ha)
2981{ 2972{
2982 uint16_t ddb_index[2]; 2973 uint16_t ddb_index[2];
2983 int ret = QLA_SUCCESS; 2974 int ret = QLA_ERROR;
2975 int rval;
2984 2976
2985 memset(ddb_index, 0, sizeof(ddb_index)); 2977 memset(ddb_index, 0, sizeof(ddb_index));
2978 ddb_index[0] = 0xffff;
2979 ddb_index[1] = 0xffff;
2986 ret = get_fw_boot_info(ha, ddb_index); 2980 ret = get_fw_boot_info(ha, ddb_index);
2987 if (ret != QLA_SUCCESS) { 2981 if (ret != QLA_SUCCESS) {
2988 DEBUG2(ql4_printk(KERN_ERR, ha, 2982 DEBUG2(ql4_printk(KERN_ERR, ha,
@@ -2990,19 +2984,30 @@ static int qla4xxx_get_boot_info(struct scsi_qla_host *ha)
2990 return ret; 2984 return ret;
2991 } 2985 }
2992 2986
2993 ret = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_pri_sess), 2987 if (ddb_index[0] == 0xffff)
2988 goto sec_target;
2989
2990 rval = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_pri_sess),
2994 ddb_index[0]); 2991 ddb_index[0]);
2995 if (ret != QLA_SUCCESS) { 2992 if (rval != QLA_SUCCESS) {
2996 DEBUG2(ql4_printk(KERN_ERR, ha, "%s: Failed to get " 2993 DEBUG2(ql4_printk(KERN_ERR, ha, "%s: Failed to get "
2997 "primary target\n", __func__)); 2994 "primary target\n", __func__));
2998 } 2995 } else
2996 ret = QLA_SUCCESS;
2999 2997
3000 ret = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_sec_sess), 2998sec_target:
2999 if (ddb_index[1] == 0xffff)
3000 goto exit_get_boot_info;
3001
3002 rval = qla4xxx_get_boot_target(ha, &(ha->boot_tgt.boot_sec_sess),
3001 ddb_index[1]); 3003 ddb_index[1]);
3002 if (ret != QLA_SUCCESS) { 3004 if (rval != QLA_SUCCESS) {
3003 DEBUG2(ql4_printk(KERN_ERR, ha, "%s: Failed to get " 3005 DEBUG2(ql4_printk(KERN_ERR, ha, "%s: Failed to get "
3004 "secondary target\n", __func__)); 3006 "secondary target\n", __func__));
3005 } 3007 } else
3008 ret = QLA_SUCCESS;
3009
3010exit_get_boot_info:
3006 return ret; 3011 return ret;
3007} 3012}
3008 3013