aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_sup.c
diff options
context:
space:
mode:
authorGiridhar Malavali <giridhar.malavali@qlogic.com>2010-04-12 20:59:55 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-05-01 15:11:17 -0400
commita9083016a5314b3aeba6e0d2e814872e72168c08 (patch)
tree5b8dbdfe6abfe1c452dc6684ed81eea65edc1a28 /drivers/scsi/qla2xxx/qla_sup.c
parentc446c1f9907e84d014edb0bf3501f30cb512e06a (diff)
[SCSI] qla2xxx: Add ISP82XX support.
Enhanced the driver to support new FCoE host bus adapter. Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_sup.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_sup.c80
1 files changed, 74 insertions, 6 deletions
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index e74552c8c5e1..de92504d7585 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -423,9 +423,6 @@ qla2x00_set_nvram_protection(struct qla_hw_data *ha, int stat)
423/* Flash Manipulation Routines */ 423/* Flash Manipulation Routines */
424/*****************************************************************************/ 424/*****************************************************************************/
425 425
426#define OPTROM_BURST_SIZE 0x1000
427#define OPTROM_BURST_DWORDS (OPTROM_BURST_SIZE / 4)
428
429static inline uint32_t 426static inline uint32_t
430flash_conf_addr(struct qla_hw_data *ha, uint32_t faddr) 427flash_conf_addr(struct qla_hw_data *ha, uint32_t faddr)
431{ 428{
@@ -565,6 +562,10 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start)
565 *start = FA_FLASH_LAYOUT_ADDR; 562 *start = FA_FLASH_LAYOUT_ADDR;
566 else if (IS_QLA81XX(ha)) 563 else if (IS_QLA81XX(ha))
567 *start = FA_FLASH_LAYOUT_ADDR_81; 564 *start = FA_FLASH_LAYOUT_ADDR_81;
565 else if (IS_QLA82XX(ha)) {
566 *start = FA_FLASH_LAYOUT_ADDR_82;
567 goto end;
568 }
568 /* Begin with first PCI expansion ROM header. */ 569 /* Begin with first PCI expansion ROM header. */
569 buf = (uint8_t *)req->ring; 570 buf = (uint8_t *)req->ring;
570 dcode = (uint32_t *)req->ring; 571 dcode = (uint32_t *)req->ring;
@@ -709,10 +710,14 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
709 break; 710 break;
710 case FLT_REG_VPD_0: 711 case FLT_REG_VPD_0:
711 ha->flt_region_vpd_nvram = start; 712 ha->flt_region_vpd_nvram = start;
713 if (IS_QLA82XX(ha))
714 break;
712 if (ha->flags.port0) 715 if (ha->flags.port0)
713 ha->flt_region_vpd = start; 716 ha->flt_region_vpd = start;
714 break; 717 break;
715 case FLT_REG_VPD_1: 718 case FLT_REG_VPD_1:
719 if (IS_QLA82XX(ha))
720 break;
716 if (!ha->flags.port0) 721 if (!ha->flags.port0)
717 ha->flt_region_vpd = start; 722 ha->flt_region_vpd = start;
718 break; 723 break;
@@ -746,6 +751,21 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
746 if (!ha->flags.port0) 751 if (!ha->flags.port0)
747 ha->flt_region_fcp_prio = start; 752 ha->flt_region_fcp_prio = start;
748 break; 753 break;
754 case FLT_REG_BOOT_CODE_82XX:
755 ha->flt_region_boot = start;
756 break;
757 case FLT_REG_FW_82XX:
758 ha->flt_region_fw = start;
759 break;
760 case FLT_REG_GOLD_FW_82XX:
761 ha->flt_region_gold_fw = start;
762 break;
763 case FLT_REG_BOOTLOAD_82XX:
764 ha->flt_region_bootload = start;
765 break;
766 case FLT_REG_VPD_82XX:
767 ha->flt_region_vpd = start;
768 break;
749 } 769 }
750 } 770 }
751 goto done; 771 goto done;
@@ -791,7 +811,7 @@ qla2xxx_get_fdt_info(scsi_qla_host_t *vha)
791 uint16_t *wptr; 811 uint16_t *wptr;
792 struct qla_fdt_layout *fdt; 812 struct qla_fdt_layout *fdt;
793 uint8_t man_id, flash_id; 813 uint8_t man_id, flash_id;
794 uint16_t mid, fid; 814 uint16_t mid = 0, fid = 0;
795 struct qla_hw_data *ha = vha->hw; 815 struct qla_hw_data *ha = vha->hw;
796 struct req_que *req = ha->req_q_map[0]; 816 struct req_que *req = ha->req_q_map[0];
797 817
@@ -832,6 +852,10 @@ qla2xxx_get_fdt_info(scsi_qla_host_t *vha)
832 goto done; 852 goto done;
833no_flash_data: 853no_flash_data:
834 loc = locations[0]; 854 loc = locations[0];
855 if (IS_QLA82XX(ha)) {
856 ha->fdt_block_size = FLASH_BLK_SIZE_64K;
857 goto done;
858 }
835 qla24xx_get_flash_manufacturer(ha, &man_id, &flash_id); 859 qla24xx_get_flash_manufacturer(ha, &man_id, &flash_id);
836 mid = man_id; 860 mid = man_id;
837 fid = flash_id; 861 fid = flash_id;
@@ -869,6 +893,31 @@ done:
869 ha->fdt_block_size)); 893 ha->fdt_block_size));
870} 894}
871 895
896static void
897qla2xxx_get_idc_param(scsi_qla_host_t *vha)
898{
899#define QLA82XX_IDC_PARAM_ADDR 0x003e885c
900 uint32_t *wptr;
901 struct qla_hw_data *ha = vha->hw;
902 struct req_que *req = ha->req_q_map[0];
903
904 if (!IS_QLA82XX(ha))
905 return;
906
907 wptr = (uint32_t *)req->ring;
908 ha->isp_ops->read_optrom(vha, (uint8_t *)req->ring,
909 QLA82XX_IDC_PARAM_ADDR , 8);
910
911 if (*wptr == __constant_cpu_to_le32(0xffffffff)) {
912 ha->nx_dev_init_timeout = QLA82XX_ROM_DEV_INIT_TIMEOUT;
913 ha->nx_reset_timeout = QLA82XX_ROM_DRV_RESET_ACK_TIMEOUT;
914 } else {
915 ha->nx_dev_init_timeout = le32_to_cpu(*wptr++);
916 ha->nx_reset_timeout = le32_to_cpu(*wptr);
917 }
918 return;
919}
920
872int 921int
873qla2xxx_get_flash_info(scsi_qla_host_t *vha) 922qla2xxx_get_flash_info(scsi_qla_host_t *vha)
874{ 923{
@@ -876,7 +925,7 @@ qla2xxx_get_flash_info(scsi_qla_host_t *vha)
876 uint32_t flt_addr; 925 uint32_t flt_addr;
877 struct qla_hw_data *ha = vha->hw; 926 struct qla_hw_data *ha = vha->hw;
878 927
879 if (!IS_QLA24XX_TYPE(ha) && !IS_QLA25XX(ha) && !IS_QLA81XX(ha)) 928 if (!IS_QLA24XX_TYPE(ha) && !IS_QLA25XX(ha) && !IS_QLA8XXX_TYPE(ha))
880 return QLA_SUCCESS; 929 return QLA_SUCCESS;
881 930
882 ret = qla2xxx_find_flt_start(vha, &flt_addr); 931 ret = qla2xxx_find_flt_start(vha, &flt_addr);
@@ -885,6 +934,7 @@ qla2xxx_get_flash_info(scsi_qla_host_t *vha)
885 934
886 qla2xxx_get_flt_info(vha, flt_addr); 935 qla2xxx_get_flt_info(vha, flt_addr);
887 qla2xxx_get_fdt_info(vha); 936 qla2xxx_get_fdt_info(vha);
937 qla2xxx_get_idc_param(vha);
888 938
889 return QLA_SUCCESS; 939 return QLA_SUCCESS;
890} 940}
@@ -901,7 +951,7 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha)
901 struct qla_npiv_entry *entry; 951 struct qla_npiv_entry *entry;
902 struct qla_hw_data *ha = vha->hw; 952 struct qla_hw_data *ha = vha->hw;
903 953
904 if (!IS_QLA24XX_TYPE(ha) && !IS_QLA25XX(ha) && !IS_QLA81XX(ha)) 954 if (!IS_QLA24XX_TYPE(ha) && !IS_QLA25XX(ha) && !IS_QLA8XXX_TYPE(ha))
905 return; 955 return;
906 956
907 ha->isp_ops->read_optrom(vha, (uint8_t *)&hdr, 957 ha->isp_ops->read_optrom(vha, (uint8_t *)&hdr,
@@ -1194,6 +1244,9 @@ qla24xx_read_nvram_data(scsi_qla_host_t *vha, uint8_t *buf, uint32_t naddr,
1194 uint32_t *dwptr; 1244 uint32_t *dwptr;
1195 struct qla_hw_data *ha = vha->hw; 1245 struct qla_hw_data *ha = vha->hw;
1196 1246
1247 if (IS_QLA82XX(ha))
1248 return buf;
1249
1197 /* Dword reads to flash. */ 1250 /* Dword reads to flash. */
1198 dwptr = (uint32_t *)buf; 1251 dwptr = (uint32_t *)buf;
1199 for (i = 0; i < bytes >> 2; i++, naddr++) 1252 for (i = 0; i < bytes >> 2; i++, naddr++)
@@ -1249,6 +1302,9 @@ qla24xx_write_nvram_data(scsi_qla_host_t *vha, uint8_t *buf, uint32_t naddr,
1249 1302
1250 ret = QLA_SUCCESS; 1303 ret = QLA_SUCCESS;
1251 1304
1305 if (IS_QLA82XX(ha))
1306 return ret;
1307
1252 /* Enable flash write. */ 1308 /* Enable flash write. */
1253 WRT_REG_DWORD(&reg->ctrl_status, 1309 WRT_REG_DWORD(&reg->ctrl_status,
1254 RD_REG_DWORD(&reg->ctrl_status) | CSRX_FLASH_ENABLE); 1310 RD_REG_DWORD(&reg->ctrl_status) | CSRX_FLASH_ENABLE);
@@ -1360,6 +1416,9 @@ qla2x00_beacon_blink(struct scsi_qla_host *vha)
1360 struct qla_hw_data *ha = vha->hw; 1416 struct qla_hw_data *ha = vha->hw;
1361 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; 1417 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
1362 1418
1419 if (IS_QLA82XX(ha))
1420 return;
1421
1363 spin_lock_irqsave(&ha->hardware_lock, flags); 1422 spin_lock_irqsave(&ha->hardware_lock, flags);
1364 1423
1365 /* Save the Original GPIOE. */ 1424 /* Save the Original GPIOE. */
@@ -1541,6 +1600,9 @@ qla24xx_beacon_on(struct scsi_qla_host *vha)
1541 struct qla_hw_data *ha = vha->hw; 1600 struct qla_hw_data *ha = vha->hw;
1542 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; 1601 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
1543 1602
1603 if (IS_QLA82XX(ha))
1604 return QLA_SUCCESS;
1605
1544 if (ha->beacon_blink_led == 0) { 1606 if (ha->beacon_blink_led == 0) {
1545 /* Enable firmware for update */ 1607 /* Enable firmware for update */
1546 ha->fw_options[1] |= ADD_FO1_DISABLE_GPIO_LED_CTRL; 1608 ha->fw_options[1] |= ADD_FO1_DISABLE_GPIO_LED_CTRL;
@@ -1583,6 +1645,9 @@ qla24xx_beacon_off(struct scsi_qla_host *vha)
1583 struct qla_hw_data *ha = vha->hw; 1645 struct qla_hw_data *ha = vha->hw;
1584 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; 1646 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
1585 1647
1648 if (IS_QLA82XX(ha))
1649 return QLA_SUCCESS;
1650
1586 ha->beacon_blink_led = 0; 1651 ha->beacon_blink_led = 0;
1587 ha->beacon_color_state = QLA_LED_ALL_ON; 1652 ha->beacon_color_state = QLA_LED_ALL_ON;
1588 1653
@@ -2592,6 +2657,9 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
2592 int i; 2657 int i;
2593 struct qla_hw_data *ha = vha->hw; 2658 struct qla_hw_data *ha = vha->hw;
2594 2659
2660 if (IS_QLA82XX(ha))
2661 return ret;
2662
2595 if (!mbuf) 2663 if (!mbuf)
2596 return QLA_FUNCTION_FAILED; 2664 return QLA_FUNCTION_FAILED;
2597 2665