aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_sup.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 15:55:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 15:55:29 -0400
commit424a6f6ef990b7e9f56f6627bfc6c46b493faeb4 (patch)
tree0028356ed8003495fbbe1f716f359e3c8ebc35b6 /drivers/scsi/qla2xxx/qla_sup.c
parent1ab142d499294b844ecc81e8004db4ce029b0b61 (diff)
parentcd8df932d894f3128c884e3ae1b2b484540513db (diff)
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
SCSI updates from James Bottomley: "The update includes the usual assortment of driver updates (lpfc, qla2xxx, qla4xxx, bfa, bnx2fc, bnx2i, isci, fcoe, hpsa) plus a huge amount of infrastructure work in the SAS library and transport class as well as an iSCSI update. There's also a new SCSI based virtio driver." * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (177 commits) [SCSI] qla4xxx: Update driver version to 5.02.00-k15 [SCSI] qla4xxx: trivial cleanup [SCSI] qla4xxx: Fix sparse warning [SCSI] qla4xxx: Add support for multiple session per host. [SCSI] qla4xxx: Export CHAP index as sysfs attribute [SCSI] scsi_transport: Export CHAP index as sysfs attribute [SCSI] qla4xxx: Add support to display CHAP list and delete CHAP entry [SCSI] iscsi_transport: Add support to display CHAP list and delete CHAP entry [SCSI] pm8001: fix endian issue with code optimization. [SCSI] pm8001: Fix possible racing condition. [SCSI] pm8001: Fix bogus interrupt state flag issue. [SCSI] ipr: update PCI ID definitions for new adapters [SCSI] qla2xxx: handle default case in qla2x00_request_firmware() [SCSI] isci: improvements in driver unloading routine [SCSI] isci: improve phy event warnings [SCSI] isci: debug, provide state-enum-to-string conversions [SCSI] scsi_transport_sas: 'enable' phys on reset [SCSI] libsas: don't recover end devices attached to disabled phys [SCSI] libsas: fixup target_port_protocols for expanders that don't report sata [SCSI] libsas: set attached device type and target protocols for local phys ...
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_sup.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_sup.c148
1 files changed, 134 insertions, 14 deletions
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index 16bc72844a97..3c13c0a6be63 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -568,6 +568,9 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start)
568 else if (IS_QLA82XX(ha)) { 568 else if (IS_QLA82XX(ha)) {
569 *start = FA_FLASH_LAYOUT_ADDR_82; 569 *start = FA_FLASH_LAYOUT_ADDR_82;
570 goto end; 570 goto end;
571 } else if (IS_QLA83XX(ha)) {
572 *start = FA_FLASH_LAYOUT_ADDR_83;
573 goto end;
571 } 574 }
572 /* Begin with first PCI expansion ROM header. */ 575 /* Begin with first PCI expansion ROM header. */
573 buf = (uint8_t *)req->ring; 576 buf = (uint8_t *)req->ring;
@@ -721,13 +724,22 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
721 le32_to_cpu(region->size)); 724 le32_to_cpu(region->size));
722 725
723 switch (le32_to_cpu(region->code) & 0xff) { 726 switch (le32_to_cpu(region->code) & 0xff) {
727 case FLT_REG_FCOE_FW:
728 if (!IS_QLA8031(ha))
729 break;
730 ha->flt_region_fw = start;
731 break;
724 case FLT_REG_FW: 732 case FLT_REG_FW:
733 if (IS_QLA8031(ha))
734 break;
725 ha->flt_region_fw = start; 735 ha->flt_region_fw = start;
726 break; 736 break;
727 case FLT_REG_BOOT_CODE: 737 case FLT_REG_BOOT_CODE:
728 ha->flt_region_boot = start; 738 ha->flt_region_boot = start;
729 break; 739 break;
730 case FLT_REG_VPD_0: 740 case FLT_REG_VPD_0:
741 if (IS_QLA8031(ha))
742 break;
731 ha->flt_region_vpd_nvram = start; 743 ha->flt_region_vpd_nvram = start;
732 if (IS_QLA82XX(ha)) 744 if (IS_QLA82XX(ha))
733 break; 745 break;
@@ -735,16 +747,20 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
735 ha->flt_region_vpd = start; 747 ha->flt_region_vpd = start;
736 break; 748 break;
737 case FLT_REG_VPD_1: 749 case FLT_REG_VPD_1:
738 if (IS_QLA82XX(ha)) 750 if (IS_QLA82XX(ha) || IS_QLA8031(ha))
739 break; 751 break;
740 if (!ha->flags.port0) 752 if (!ha->flags.port0)
741 ha->flt_region_vpd = start; 753 ha->flt_region_vpd = start;
742 break; 754 break;
743 case FLT_REG_NVRAM_0: 755 case FLT_REG_NVRAM_0:
756 if (IS_QLA8031(ha))
757 break;
744 if (ha->flags.port0) 758 if (ha->flags.port0)
745 ha->flt_region_nvram = start; 759 ha->flt_region_nvram = start;
746 break; 760 break;
747 case FLT_REG_NVRAM_1: 761 case FLT_REG_NVRAM_1:
762 if (IS_QLA8031(ha))
763 break;
748 if (!ha->flags.port0) 764 if (!ha->flags.port0)
749 ha->flt_region_nvram = start; 765 ha->flt_region_nvram = start;
750 break; 766 break;
@@ -785,6 +801,31 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
785 case FLT_REG_VPD_82XX: 801 case FLT_REG_VPD_82XX:
786 ha->flt_region_vpd = start; 802 ha->flt_region_vpd = start;
787 break; 803 break;
804 case FLT_REG_FCOE_VPD_0:
805 if (!IS_QLA8031(ha))
806 break;
807 ha->flt_region_vpd_nvram = start;
808 if (ha->flags.port0)
809 ha->flt_region_vpd = start;
810 break;
811 case FLT_REG_FCOE_VPD_1:
812 if (!IS_QLA8031(ha))
813 break;
814 if (!ha->flags.port0)
815 ha->flt_region_vpd = start;
816 break;
817 case FLT_REG_FCOE_NVRAM_0:
818 if (!IS_QLA8031(ha))
819 break;
820 if (ha->flags.port0)
821 ha->flt_region_nvram = start;
822 break;
823 case FLT_REG_FCOE_NVRAM_1:
824 if (!IS_QLA8031(ha))
825 break;
826 if (!ha->flags.port0)
827 ha->flt_region_nvram = start;
828 break;
788 } 829 }
789 } 830 }
790 goto done; 831 goto done;
@@ -804,15 +845,12 @@ no_flash_data:
804 def_npiv_conf0[def] : def_npiv_conf1[def]; 845 def_npiv_conf0[def] : def_npiv_conf1[def];
805done: 846done:
806 ql_dbg(ql_dbg_init, vha, 0x004a, 847 ql_dbg(ql_dbg_init, vha, 0x004a,
807 "FLT[%s]: boot=0x%x fw=0x%x vpd_nvram=0x%x vpd=0x%x.\n", 848 "FLT[%s]: boot=0x%x fw=0x%x vpd_nvram=0x%x vpd=0x%x nvram=0x%x "
808 loc, ha->flt_region_boot, 849 "fdt=0x%x flt=0x%x npiv=0x%x fcp_prif_cfg=0x%x.\n",
809 ha->flt_region_fw, ha->flt_region_vpd_nvram, 850 loc, ha->flt_region_boot, ha->flt_region_fw,
810 ha->flt_region_vpd); 851 ha->flt_region_vpd_nvram, ha->flt_region_vpd, ha->flt_region_nvram,
811 ql_dbg(ql_dbg_init, vha, 0x004b, 852 ha->flt_region_fdt, ha->flt_region_flt, ha->flt_region_npiv_conf,
812 "nvram=0x%x fdt=0x%x flt=0x%x npiv=0x%x fcp_prif_cfg=0x%x.\n", 853 ha->flt_region_fcp_prio);
813 ha->flt_region_nvram,
814 ha->flt_region_fdt, ha->flt_region_flt,
815 ha->flt_region_npiv_conf, ha->flt_region_fcp_prio);
816} 854}
817 855
818static void 856static void
@@ -948,7 +986,8 @@ qla2xxx_get_flash_info(scsi_qla_host_t *vha)
948 uint32_t flt_addr; 986 uint32_t flt_addr;
949 struct qla_hw_data *ha = vha->hw; 987 struct qla_hw_data *ha = vha->hw;
950 988
951 if (!IS_QLA24XX_TYPE(ha) && !IS_QLA25XX(ha) && !IS_QLA8XXX_TYPE(ha)) 989 if (!IS_QLA24XX_TYPE(ha) && !IS_QLA25XX(ha) &&
990 !IS_CNA_CAPABLE(ha) && !IS_QLA2031(ha))
952 return QLA_SUCCESS; 991 return QLA_SUCCESS;
953 992
954 ret = qla2xxx_find_flt_start(vha, &flt_addr); 993 ret = qla2xxx_find_flt_start(vha, &flt_addr);
@@ -974,7 +1013,8 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha)
974 struct qla_npiv_entry *entry; 1013 struct qla_npiv_entry *entry;
975 struct qla_hw_data *ha = vha->hw; 1014 struct qla_hw_data *ha = vha->hw;
976 1015
977 if (!IS_QLA24XX_TYPE(ha) && !IS_QLA25XX(ha) && !IS_QLA8XXX_TYPE(ha)) 1016 if (!IS_QLA24XX_TYPE(ha) && !IS_QLA25XX(ha) &&
1017 !IS_CNA_CAPABLE(ha) && !IS_QLA2031(ha))
978 return; 1018 return;
979 1019
980 ha->isp_ops->read_optrom(vha, (uint8_t *)&hdr, 1020 ha->isp_ops->read_optrom(vha, (uint8_t *)&hdr,
@@ -1144,8 +1184,8 @@ qla24xx_write_flash_data(scsi_qla_host_t *vha, uint32_t *dwptr, uint32_t faddr,
1144 struct qla_hw_data *ha = vha->hw; 1184 struct qla_hw_data *ha = vha->hw;
1145 1185
1146 /* Prepare burst-capable write on supported ISPs. */ 1186 /* Prepare burst-capable write on supported ISPs. */
1147 if ((IS_QLA25XX(ha) || IS_QLA81XX(ha)) && !(faddr & 0xfff) && 1187 if ((IS_QLA25XX(ha) || IS_QLA81XX(ha) || IS_QLA83XX(ha)) &&
1148 dwords > OPTROM_BURST_DWORDS) { 1188 !(faddr & 0xfff) && dwords > OPTROM_BURST_DWORDS) {
1149 optrom = dma_alloc_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE, 1189 optrom = dma_alloc_coherent(&ha->pdev->dev, OPTROM_BURST_SIZE,
1150 &optrom_dma, GFP_KERNEL); 1190 &optrom_dma, GFP_KERNEL);
1151 if (!optrom) { 1191 if (!optrom) {
@@ -1619,6 +1659,71 @@ qla24xx_beacon_blink(struct scsi_qla_host *vha)
1619 spin_unlock_irqrestore(&ha->hardware_lock, flags); 1659 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1620} 1660}
1621 1661
1662void
1663qla83xx_beacon_blink(struct scsi_qla_host *vha)
1664{
1665 uint32_t led_select_value;
1666 struct qla_hw_data *ha = vha->hw;
1667 uint16_t led_cfg[6];
1668 uint16_t orig_led_cfg[6];
1669
1670 if (!IS_QLA83XX(ha) && !IS_QLA81XX(ha))
1671 return;
1672
1673 if (IS_QLA2031(ha) && ha->beacon_blink_led) {
1674 if (ha->flags.port0)
1675 led_select_value = 0x00201320;
1676 else
1677 led_select_value = 0x00201328;
1678
1679 qla83xx_write_remote_reg(vha, led_select_value, 0x40002000);
1680 qla83xx_write_remote_reg(vha, led_select_value + 4, 0x40002000);
1681 msleep(1000);
1682 qla83xx_write_remote_reg(vha, led_select_value, 0x40004000);
1683 qla83xx_write_remote_reg(vha, led_select_value + 4, 0x40004000);
1684 } else if ((IS_QLA8031(ha) || IS_QLA81XX(ha)) && ha->beacon_blink_led) {
1685 int rval;
1686
1687 /* Save Current */
1688 rval = qla81xx_get_led_config(vha, orig_led_cfg);
1689 /* Do the blink */
1690 if (rval == QLA_SUCCESS) {
1691 if (IS_QLA81XX(ha)) {
1692 led_cfg[0] = 0x4000;
1693 led_cfg[1] = 0x2000;
1694 led_cfg[2] = 0;
1695 led_cfg[3] = 0;
1696 led_cfg[4] = 0;
1697 led_cfg[5] = 0;
1698 } else {
1699 led_cfg[0] = 0x4000;
1700 led_cfg[1] = 0x4000;
1701 led_cfg[2] = 0x4000;
1702 led_cfg[3] = 0x2000;
1703 led_cfg[4] = 0;
1704 led_cfg[5] = 0x2000;
1705 }
1706 rval = qla81xx_set_led_config(vha, led_cfg);
1707 msleep(1000);
1708 if (IS_QLA81XX(ha)) {
1709 led_cfg[0] = 0x4000;
1710 led_cfg[1] = 0x2000;
1711 led_cfg[2] = 0;
1712 } else {
1713 led_cfg[0] = 0x4000;
1714 led_cfg[1] = 0x2000;
1715 led_cfg[2] = 0x4000;
1716 led_cfg[3] = 0x4000;
1717 led_cfg[4] = 0;
1718 led_cfg[5] = 0x2000;
1719 }
1720 rval = qla81xx_set_led_config(vha, led_cfg);
1721 }
1722 /* On exit, restore original (presumes no status change) */
1723 qla81xx_set_led_config(vha, orig_led_cfg);
1724 }
1725}
1726
1622int 1727int
1623qla24xx_beacon_on(struct scsi_qla_host *vha) 1728qla24xx_beacon_on(struct scsi_qla_host *vha)
1624{ 1729{
@@ -1630,6 +1735,9 @@ qla24xx_beacon_on(struct scsi_qla_host *vha)
1630 if (IS_QLA82XX(ha)) 1735 if (IS_QLA82XX(ha))
1631 return QLA_SUCCESS; 1736 return QLA_SUCCESS;
1632 1737
1738 if (IS_QLA8031(ha) || IS_QLA81XX(ha))
1739 goto skip_gpio; /* let blink handle it */
1740
1633 if (ha->beacon_blink_led == 0) { 1741 if (ha->beacon_blink_led == 0) {
1634 /* Enable firmware for update */ 1742 /* Enable firmware for update */
1635 ha->fw_options[1] |= ADD_FO1_DISABLE_GPIO_LED_CTRL; 1743 ha->fw_options[1] |= ADD_FO1_DISABLE_GPIO_LED_CTRL;
@@ -1644,6 +1752,9 @@ qla24xx_beacon_on(struct scsi_qla_host *vha)
1644 return QLA_FUNCTION_FAILED; 1752 return QLA_FUNCTION_FAILED;
1645 } 1753 }
1646 1754
1755 if (IS_QLA2031(ha))
1756 goto skip_gpio;
1757
1647 spin_lock_irqsave(&ha->hardware_lock, flags); 1758 spin_lock_irqsave(&ha->hardware_lock, flags);
1648 gpio_data = RD_REG_DWORD(&reg->gpiod); 1759 gpio_data = RD_REG_DWORD(&reg->gpiod);
1649 1760
@@ -1658,6 +1769,7 @@ qla24xx_beacon_on(struct scsi_qla_host *vha)
1658 /* So all colors blink together. */ 1769 /* So all colors blink together. */
1659 ha->beacon_color_state = 0; 1770 ha->beacon_color_state = 0;
1660 1771
1772skip_gpio:
1661 /* Let the per HBA timer kick off the blinking process. */ 1773 /* Let the per HBA timer kick off the blinking process. */
1662 ha->beacon_blink_led = 1; 1774 ha->beacon_blink_led = 1;
1663 1775
@@ -1676,6 +1788,13 @@ qla24xx_beacon_off(struct scsi_qla_host *vha)
1676 return QLA_SUCCESS; 1788 return QLA_SUCCESS;
1677 1789
1678 ha->beacon_blink_led = 0; 1790 ha->beacon_blink_led = 0;
1791
1792 if (IS_QLA2031(ha))
1793 goto set_fw_options;
1794
1795 if (IS_QLA8031(ha) || IS_QLA81XX(ha))
1796 return QLA_SUCCESS;
1797
1679 ha->beacon_color_state = QLA_LED_ALL_ON; 1798 ha->beacon_color_state = QLA_LED_ALL_ON;
1680 1799
1681 ha->isp_ops->beacon_blink(vha); /* Will flip to all off. */ 1800 ha->isp_ops->beacon_blink(vha); /* Will flip to all off. */
@@ -1690,6 +1809,7 @@ qla24xx_beacon_off(struct scsi_qla_host *vha)
1690 RD_REG_DWORD(&reg->gpiod); 1809 RD_REG_DWORD(&reg->gpiod);
1691 spin_unlock_irqrestore(&ha->hardware_lock, flags); 1810 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1692 1811
1812set_fw_options:
1693 ha->fw_options[1] &= ~ADD_FO1_DISABLE_GPIO_LED_CTRL; 1813 ha->fw_options[1] &= ~ADD_FO1_DISABLE_GPIO_LED_CTRL;
1694 1814
1695 if (qla2x00_set_fw_options(vha, ha->fw_options) != QLA_SUCCESS) { 1815 if (qla2x00_set_fw_options(vha, ha->fw_options) != QLA_SUCCESS) {