diff options
author | Sarang Radke <sarang.radke@qlogic.com> | 2010-03-19 20:03:59 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-11 10:45:50 -0400 |
commit | 09ff701a177b116c6c15b6e501e58fbfb306b424 (patch) | |
tree | fd99933ea29dbc36fc6636f5278d237dbee89b96 /drivers/scsi/qla2xxx/qla_sup.c | |
parent | 6e98016ca077c5c751167bfdb1a3a2a3bee581cf (diff) |
[SCSI] qla2xxx: Add APEX support.
Allows priority setting for FCP_CMNDs.
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.c | 69 |
1 files changed, 66 insertions, 3 deletions
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c index 8b3de4e54c28..f32a4b032967 100644 --- a/drivers/scsi/qla2xxx/qla_sup.c +++ b/drivers/scsi/qla2xxx/qla_sup.c | |||
@@ -648,6 +648,12 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr) | |||
648 | const uint32_t def_npiv_conf1[] = | 648 | const uint32_t def_npiv_conf1[] = |
649 | { FA_NPIV_CONF1_ADDR_24, FA_NPIV_CONF1_ADDR, | 649 | { FA_NPIV_CONF1_ADDR_24, FA_NPIV_CONF1_ADDR, |
650 | FA_NPIV_CONF1_ADDR_81 }; | 650 | FA_NPIV_CONF1_ADDR_81 }; |
651 | const uint32_t fcp_prio_cfg0[] = | ||
652 | { FA_FCP_PRIO0_ADDR, FA_FCP_PRIO0_ADDR_25, | ||
653 | 0 }; | ||
654 | const uint32_t fcp_prio_cfg1[] = | ||
655 | { FA_FCP_PRIO1_ADDR, FA_FCP_PRIO1_ADDR_25, | ||
656 | 0 }; | ||
651 | uint32_t def; | 657 | uint32_t def; |
652 | uint16_t *wptr; | 658 | uint16_t *wptr; |
653 | uint16_t cnt, chksum; | 659 | uint16_t cnt, chksum; |
@@ -732,6 +738,14 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr) | |||
732 | case FLT_REG_GOLD_FW: | 738 | case FLT_REG_GOLD_FW: |
733 | ha->flt_region_gold_fw = start; | 739 | ha->flt_region_gold_fw = start; |
734 | break; | 740 | break; |
741 | case FLT_REG_FCP_PRIO_0: | ||
742 | if (!(PCI_FUNC(ha->pdev->devfn) & 1)) | ||
743 | ha->flt_region_fcp_prio = start; | ||
744 | break; | ||
745 | case FLT_REG_FCP_PRIO_1: | ||
746 | if (PCI_FUNC(ha->pdev->devfn) & 1) | ||
747 | ha->flt_region_fcp_prio = start; | ||
748 | break; | ||
735 | } | 749 | } |
736 | } | 750 | } |
737 | goto done; | 751 | goto done; |
@@ -750,12 +764,14 @@ no_flash_data: | |||
750 | ha->flt_region_boot = def_boot[def]; | 764 | ha->flt_region_boot = def_boot[def]; |
751 | ha->flt_region_vpd_nvram = def_vpd_nvram[def]; | 765 | ha->flt_region_vpd_nvram = def_vpd_nvram[def]; |
752 | ha->flt_region_vpd = ha->flags.port0 ? | 766 | ha->flt_region_vpd = ha->flags.port0 ? |
753 | def_vpd0[def]: def_vpd1[def]; | 767 | def_vpd0[def] : def_vpd1[def]; |
754 | ha->flt_region_nvram = ha->flags.port0 ? | 768 | ha->flt_region_nvram = ha->flags.port0 ? |
755 | def_nvram0[def]: def_nvram1[def]; | 769 | def_nvram0[def] : def_nvram1[def]; |
756 | ha->flt_region_fdt = def_fdt[def]; | 770 | ha->flt_region_fdt = def_fdt[def]; |
757 | ha->flt_region_npiv_conf = ha->flags.port0 ? | 771 | ha->flt_region_npiv_conf = ha->flags.port0 ? |
758 | def_npiv_conf0[def]: def_npiv_conf1[def]; | 772 | def_npiv_conf0[def] : def_npiv_conf1[def]; |
773 | ha->flt_region_fcp_prio = ha->flags.port0 ? | ||
774 | fcp_prio_cfg0[def] : fcp_prio_cfg1[def]; | ||
759 | done: | 775 | done: |
760 | DEBUG2(qla_printk(KERN_DEBUG, ha, "FLT[%s]: boot=0x%x fw=0x%x " | 776 | DEBUG2(qla_printk(KERN_DEBUG, ha, "FLT[%s]: boot=0x%x fw=0x%x " |
761 | "vpd_nvram=0x%x vpd=0x%x nvram=0x%x fdt=0x%x flt=0x%x " | 777 | "vpd_nvram=0x%x vpd=0x%x nvram=0x%x fdt=0x%x flt=0x%x " |
@@ -2722,3 +2738,50 @@ qla2xxx_get_vpd_field(scsi_qla_host_t *vha, char *key, char *str, size_t size) | |||
2722 | 2738 | ||
2723 | return 0; | 2739 | return 0; |
2724 | } | 2740 | } |
2741 | |||
2742 | int | ||
2743 | qla24xx_read_fcp_prio_cfg(scsi_qla_host_t *vha) | ||
2744 | { | ||
2745 | int len, max_len; | ||
2746 | uint32_t fcp_prio_addr; | ||
2747 | struct qla_hw_data *ha = vha->hw; | ||
2748 | |||
2749 | if (!ha->fcp_prio_cfg) { | ||
2750 | ha->fcp_prio_cfg = vmalloc(FCP_PRIO_CFG_SIZE); | ||
2751 | if (!ha->fcp_prio_cfg) { | ||
2752 | qla_printk(KERN_WARNING, ha, | ||
2753 | "Unable to allocate memory for fcp priority data " | ||
2754 | "(%x).\n", FCP_PRIO_CFG_SIZE); | ||
2755 | return QLA_FUNCTION_FAILED; | ||
2756 | } | ||
2757 | } | ||
2758 | memset(ha->fcp_prio_cfg, 0, FCP_PRIO_CFG_SIZE); | ||
2759 | |||
2760 | fcp_prio_addr = ha->flt_region_fcp_prio; | ||
2761 | |||
2762 | /* first read the fcp priority data header from flash */ | ||
2763 | ha->isp_ops->read_optrom(vha, (uint8_t *)ha->fcp_prio_cfg, | ||
2764 | fcp_prio_addr << 2, FCP_PRIO_CFG_HDR_SIZE); | ||
2765 | |||
2766 | if (!qla24xx_fcp_prio_cfg_valid(ha->fcp_prio_cfg, 0)) | ||
2767 | goto fail; | ||
2768 | |||
2769 | /* read remaining FCP CMD config data from flash */ | ||
2770 | fcp_prio_addr += (FCP_PRIO_CFG_HDR_SIZE >> 2); | ||
2771 | len = ha->fcp_prio_cfg->num_entries * FCP_PRIO_CFG_ENTRY_SIZE; | ||
2772 | max_len = FCP_PRIO_CFG_SIZE - FCP_PRIO_CFG_HDR_SIZE; | ||
2773 | |||
2774 | ha->isp_ops->read_optrom(vha, (uint8_t *)&ha->fcp_prio_cfg->entry[0], | ||
2775 | fcp_prio_addr << 2, (len < max_len ? len : max_len)); | ||
2776 | |||
2777 | /* revalidate the entire FCP priority config data, including entries */ | ||
2778 | if (!qla24xx_fcp_prio_cfg_valid(ha->fcp_prio_cfg, 1)) | ||
2779 | goto fail; | ||
2780 | |||
2781 | ha->flags.fcp_prio_enabled = 1; | ||
2782 | return QLA_SUCCESS; | ||
2783 | fail: | ||
2784 | vfree(ha->fcp_prio_cfg); | ||
2785 | ha->fcp_prio_cfg = NULL; | ||
2786 | return QLA_FUNCTION_FAILED; | ||
2787 | } | ||