diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2009-03-24 12:08:14 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-04-03 10:22:51 -0400 |
commit | 3d79038f92841052aced9aec43c9d9aa864d28ab (patch) | |
tree | 8d8d1323ac0ba111add5e0b5bd1c14a36e9a211a /drivers | |
parent | d1b1bef4c9e67aa550e602a6a7f93bbb47dff0b8 (diff) |
[SCSI] qla2xxx: Always use an FLT's NVRAM/VPD region information.
Rather than assuming a particular layout of the data. Applies to
recent ISPs only.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 6 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_def.h | 2 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_fw.h | 4 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 14 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 4 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_sup.c | 31 |
6 files changed, 45 insertions, 16 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 877990115f53..79bf7514a385 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -111,7 +111,8 @@ qla2x00_sysfs_write_nvram(struct kobject *kobj, | |||
111 | struct qla_hw_data *ha = vha->hw; | 111 | struct qla_hw_data *ha = vha->hw; |
112 | uint16_t cnt; | 112 | uint16_t cnt; |
113 | 113 | ||
114 | if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size) | 114 | if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size || |
115 | !ha->isp_ops->write_nvram) | ||
115 | return 0; | 116 | return 0; |
116 | 117 | ||
117 | /* Checksum NVRAM. */ | 118 | /* Checksum NVRAM. */ |
@@ -393,7 +394,8 @@ qla2x00_sysfs_write_vpd(struct kobject *kobj, | |||
393 | struct qla_hw_data *ha = vha->hw; | 394 | struct qla_hw_data *ha = vha->hw; |
394 | uint8_t *tmp_data; | 395 | uint8_t *tmp_data; |
395 | 396 | ||
396 | if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->vpd_size) | 397 | if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->vpd_size || |
398 | !ha->isp_ops->write_nvram) | ||
397 | return 0; | 399 | return 0; |
398 | 400 | ||
399 | if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) { | 401 | if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) { |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 5a55a20207ec..01b7fc6f000b 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -2506,6 +2506,8 @@ struct qla_hw_data { | |||
2506 | uint32_t flt_region_boot; | 2506 | uint32_t flt_region_boot; |
2507 | uint32_t flt_region_fw; | 2507 | uint32_t flt_region_fw; |
2508 | uint32_t flt_region_vpd_nvram; | 2508 | uint32_t flt_region_vpd_nvram; |
2509 | uint32_t flt_region_vpd; | ||
2510 | uint32_t flt_region_nvram; | ||
2509 | uint32_t flt_region_npiv_conf; | 2511 | uint32_t flt_region_npiv_conf; |
2510 | 2512 | ||
2511 | /* Needed for BEACON */ | 2513 | /* Needed for BEACON */ |
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index e47c4c3602de..96ccb9642ba0 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h | |||
@@ -1708,6 +1708,10 @@ struct ex_init_cb_81xx { | |||
1708 | #define FA_RISC_CODE_ADDR_81 0xA0000 | 1708 | #define FA_RISC_CODE_ADDR_81 0xA0000 |
1709 | #define FA_FW_AREA_ADDR_81 0xC0000 | 1709 | #define FA_FW_AREA_ADDR_81 0xC0000 |
1710 | #define FA_VPD_NVRAM_ADDR_81 0xD0000 | 1710 | #define FA_VPD_NVRAM_ADDR_81 0xD0000 |
1711 | #define FA_VPD0_ADDR_81 0xD0000 | ||
1712 | #define FA_VPD1_ADDR_81 0xD0400 | ||
1713 | #define FA_NVRAM0_ADDR_81 0xD0080 | ||
1714 | #define FA_NVRAM1_ADDR_81 0xD0480 | ||
1711 | #define FA_FEATURE_ADDR_81 0xD4000 | 1715 | #define FA_FEATURE_ADDR_81 0xD4000 |
1712 | #define FA_FLASH_DESCR_ADDR_81 0xD8000 | 1716 | #define FA_FLASH_DESCR_ADDR_81 0xD8000 |
1713 | #define FA_FLASH_LAYOUT_ADDR_81 0xD8400 | 1717 | #define FA_FLASH_LAYOUT_ADDR_81 0xD8400 |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index d525808afc4e..997c83b07e8a 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -4344,23 +4344,17 @@ qla81xx_nvram_config(scsi_qla_host_t *vha) | |||
4344 | 4344 | ||
4345 | /* Determine NVRAM starting address. */ | 4345 | /* Determine NVRAM starting address. */ |
4346 | ha->nvram_size = sizeof(struct nvram_81xx); | 4346 | ha->nvram_size = sizeof(struct nvram_81xx); |
4347 | ha->nvram_base = FA_NVRAM_FUNC0_ADDR; | ||
4348 | ha->vpd_size = FA_NVRAM_VPD_SIZE; | 4347 | ha->vpd_size = FA_NVRAM_VPD_SIZE; |
4349 | ha->vpd_base = FA_NVRAM_VPD0_ADDR; | ||
4350 | if (PCI_FUNC(ha->pdev->devfn) & 1) { | ||
4351 | ha->nvram_base = FA_NVRAM_FUNC1_ADDR; | ||
4352 | ha->vpd_base = FA_NVRAM_VPD1_ADDR; | ||
4353 | } | ||
4354 | 4348 | ||
4355 | /* Get VPD data into cache */ | 4349 | /* Get VPD data into cache */ |
4356 | ha->vpd = ha->nvram + VPD_OFFSET; | 4350 | ha->vpd = ha->nvram + VPD_OFFSET; |
4357 | ha->isp_ops->read_nvram(vha, (uint8_t *)ha->vpd, | 4351 | ha->isp_ops->read_optrom(vha, ha->vpd, ha->flt_region_vpd << 2, |
4358 | ha->nvram_base - FA_NVRAM_FUNC0_ADDR, FA_NVRAM_VPD_SIZE * 4); | 4352 | ha->vpd_size); |
4359 | 4353 | ||
4360 | /* Get NVRAM data into cache and calculate checksum. */ | 4354 | /* Get NVRAM data into cache and calculate checksum. */ |
4361 | dptr = (uint32_t *)nv; | 4355 | ha->isp_ops->read_optrom(vha, ha->nvram, ha->flt_region_nvram << 2, |
4362 | ha->isp_ops->read_nvram(vha, (uint8_t *)dptr, ha->nvram_base, | ||
4363 | ha->nvram_size); | 4356 | ha->nvram_size); |
4357 | dptr = (uint32_t *)nv; | ||
4364 | for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++) | 4358 | for (cnt = 0, chksum = 0; cnt < ha->nvram_size >> 2; cnt++) |
4365 | chksum += le32_to_cpu(*dptr++); | 4359 | chksum += le32_to_cpu(*dptr++); |
4366 | 4360 | ||
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 9bb4b2ed6608..7e038e4107a5 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -1409,8 +1409,8 @@ static struct isp_operations qla81xx_isp_ops = { | |||
1409 | .build_iocbs = NULL, | 1409 | .build_iocbs = NULL, |
1410 | .prep_ms_iocb = qla24xx_prep_ms_iocb, | 1410 | .prep_ms_iocb = qla24xx_prep_ms_iocb, |
1411 | .prep_ms_fdmi_iocb = qla24xx_prep_ms_fdmi_iocb, | 1411 | .prep_ms_fdmi_iocb = qla24xx_prep_ms_fdmi_iocb, |
1412 | .read_nvram = qla25xx_read_nvram_data, | 1412 | .read_nvram = NULL, |
1413 | .write_nvram = qla25xx_write_nvram_data, | 1413 | .write_nvram = NULL, |
1414 | .fw_dump = qla81xx_fw_dump, | 1414 | .fw_dump = qla81xx_fw_dump, |
1415 | .beacon_on = qla24xx_beacon_on, | 1415 | .beacon_on = qla24xx_beacon_on, |
1416 | .beacon_off = qla24xx_beacon_off, | 1416 | .beacon_off = qla24xx_beacon_off, |
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c index 468c114e937e..0664667c2e9d 100644 --- a/drivers/scsi/qla2xxx/qla_sup.c +++ b/drivers/scsi/qla2xxx/qla_sup.c | |||
@@ -629,6 +629,14 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr) | |||
629 | { FA_BOOT_CODE_ADDR, FA_BOOT_CODE_ADDR, FA_BOOT_CODE_ADDR_81 }; | 629 | { FA_BOOT_CODE_ADDR, FA_BOOT_CODE_ADDR, FA_BOOT_CODE_ADDR_81 }; |
630 | const uint32_t def_vpd_nvram[] = | 630 | const uint32_t def_vpd_nvram[] = |
631 | { FA_VPD_NVRAM_ADDR, FA_VPD_NVRAM_ADDR, FA_VPD_NVRAM_ADDR_81 }; | 631 | { FA_VPD_NVRAM_ADDR, FA_VPD_NVRAM_ADDR, FA_VPD_NVRAM_ADDR_81 }; |
632 | const uint32_t def_vpd0[] = | ||
633 | { 0, 0, FA_VPD0_ADDR_81 }; | ||
634 | const uint32_t def_vpd1[] = | ||
635 | { 0, 0, FA_VPD1_ADDR_81 }; | ||
636 | const uint32_t def_nvram0[] = | ||
637 | { 0, 0, FA_NVRAM0_ADDR_81 }; | ||
638 | const uint32_t def_nvram1[] = | ||
639 | { 0, 0, FA_NVRAM1_ADDR_81 }; | ||
632 | const uint32_t def_fdt[] = | 640 | const uint32_t def_fdt[] = |
633 | { FA_FLASH_DESCR_ADDR_24, FA_FLASH_DESCR_ADDR, | 641 | { FA_FLASH_DESCR_ADDR_24, FA_FLASH_DESCR_ADDR, |
634 | FA_FLASH_DESCR_ADDR_81 }; | 642 | FA_FLASH_DESCR_ADDR_81 }; |
@@ -693,6 +701,20 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr) | |||
693 | break; | 701 | break; |
694 | case FLT_REG_VPD_0: | 702 | case FLT_REG_VPD_0: |
695 | ha->flt_region_vpd_nvram = start; | 703 | ha->flt_region_vpd_nvram = start; |
704 | if (!(PCI_FUNC(ha->pdev->devfn) & 1)) | ||
705 | ha->flt_region_vpd = start; | ||
706 | break; | ||
707 | case FLT_REG_VPD_1: | ||
708 | if (PCI_FUNC(ha->pdev->devfn) & 1) | ||
709 | ha->flt_region_vpd = start; | ||
710 | break; | ||
711 | case FLT_REG_NVRAM_0: | ||
712 | if (!(PCI_FUNC(ha->pdev->devfn) & 1)) | ||
713 | ha->flt_region_nvram = start; | ||
714 | break; | ||
715 | case FLT_REG_NVRAM_1: | ||
716 | if (PCI_FUNC(ha->pdev->devfn) & 1) | ||
717 | ha->flt_region_nvram = start; | ||
696 | break; | 718 | break; |
697 | case FLT_REG_FDT: | 719 | case FLT_REG_FDT: |
698 | ha->flt_region_fdt = start; | 720 | ha->flt_region_fdt = start; |
@@ -722,13 +744,18 @@ no_flash_data: | |||
722 | ha->flt_region_fw = def_fw[def]; | 744 | ha->flt_region_fw = def_fw[def]; |
723 | ha->flt_region_boot = def_boot[def]; | 745 | ha->flt_region_boot = def_boot[def]; |
724 | ha->flt_region_vpd_nvram = def_vpd_nvram[def]; | 746 | ha->flt_region_vpd_nvram = def_vpd_nvram[def]; |
747 | ha->flt_region_vpd = !(PCI_FUNC(ha->pdev->devfn) & 1) ? | ||
748 | def_vpd0[def]: def_vpd1[def]; | ||
749 | ha->flt_region_nvram = !(PCI_FUNC(ha->pdev->devfn) & 1) ? | ||
750 | def_nvram0[def]: def_nvram1[def]; | ||
725 | ha->flt_region_fdt = def_fdt[def]; | 751 | ha->flt_region_fdt = def_fdt[def]; |
726 | ha->flt_region_npiv_conf = !(PCI_FUNC(ha->pdev->devfn) & 1) ? | 752 | ha->flt_region_npiv_conf = !(PCI_FUNC(ha->pdev->devfn) & 1) ? |
727 | def_npiv_conf0[def]: def_npiv_conf1[def]; | 753 | def_npiv_conf0[def]: def_npiv_conf1[def]; |
728 | done: | 754 | done: |
729 | DEBUG2(qla_printk(KERN_DEBUG, ha, "FLT[%s]: boot=0x%x fw=0x%x " | 755 | DEBUG2(qla_printk(KERN_DEBUG, ha, "FLT[%s]: boot=0x%x fw=0x%x " |
730 | "vpd_nvram=0x%x fdt=0x%x flt=0x%x npiv=0x%x.\n", loc, | 756 | "vpd_nvram=0x%x vpd=0x%x nvram=0x%x fdt=0x%x flt=0x%x " |
731 | ha->flt_region_boot, ha->flt_region_fw, ha->flt_region_vpd_nvram, | 757 | "npiv=0x%x.\n", loc, ha->flt_region_boot, ha->flt_region_fw, |
758 | ha->flt_region_vpd_nvram, ha->flt_region_vpd, ha->flt_region_nvram, | ||
732 | ha->flt_region_fdt, ha->flt_region_flt, ha->flt_region_npiv_conf)); | 759 | ha->flt_region_fdt, ha->flt_region_flt, ha->flt_region_npiv_conf)); |
733 | } | 760 | } |
734 | 761 | ||