diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_mbox.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_mbox.c | 70 |
1 files changed, 65 insertions, 5 deletions
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index a9afd8b94b6a..c2cc29f70a4b 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -1747,6 +1747,65 @@ lpfc_sli4_mbox_opcode_get(struct lpfc_hba *phba, struct lpfcMboxq *mbox) | |||
1747 | } | 1747 | } |
1748 | 1748 | ||
1749 | /** | 1749 | /** |
1750 | * lpfc_sli4_mbx_read_fcf_record - Allocate and construct read fcf mbox cmd | ||
1751 | * @phba: pointer to lpfc hba data structure. | ||
1752 | * @fcf_index: index to fcf table. | ||
1753 | * | ||
1754 | * This routine routine allocates and constructs non-embedded mailbox command | ||
1755 | * for reading a FCF table entry refered by @fcf_index. | ||
1756 | * | ||
1757 | * Return: pointer to the mailbox command constructed if successful, otherwise | ||
1758 | * NULL. | ||
1759 | **/ | ||
1760 | int | ||
1761 | lpfc_sli4_mbx_read_fcf_record(struct lpfc_hba *phba, | ||
1762 | struct lpfcMboxq *mboxq, | ||
1763 | uint16_t fcf_index) | ||
1764 | { | ||
1765 | void *virt_addr; | ||
1766 | dma_addr_t phys_addr; | ||
1767 | uint8_t *bytep; | ||
1768 | struct lpfc_mbx_sge sge; | ||
1769 | uint32_t alloc_len, req_len; | ||
1770 | struct lpfc_mbx_read_fcf_tbl *read_fcf; | ||
1771 | |||
1772 | if (!mboxq) | ||
1773 | return -ENOMEM; | ||
1774 | |||
1775 | req_len = sizeof(struct fcf_record) + | ||
1776 | sizeof(union lpfc_sli4_cfg_shdr) + 2 * sizeof(uint32_t); | ||
1777 | |||
1778 | /* Set up READ_FCF SLI4_CONFIG mailbox-ioctl command */ | ||
1779 | alloc_len = lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_FCOE, | ||
1780 | LPFC_MBOX_OPCODE_FCOE_READ_FCF_TABLE, req_len, | ||
1781 | LPFC_SLI4_MBX_NEMBED); | ||
1782 | |||
1783 | if (alloc_len < req_len) { | ||
1784 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX, | ||
1785 | "0291 Allocated DMA memory size (x%x) is " | ||
1786 | "less than the requested DMA memory " | ||
1787 | "size (x%x)\n", alloc_len, req_len); | ||
1788 | return -ENOMEM; | ||
1789 | } | ||
1790 | |||
1791 | /* Get the first SGE entry from the non-embedded DMA memory. This | ||
1792 | * routine only uses a single SGE. | ||
1793 | */ | ||
1794 | lpfc_sli4_mbx_sge_get(mboxq, 0, &sge); | ||
1795 | phys_addr = getPaddr(sge.pa_hi, sge.pa_lo); | ||
1796 | virt_addr = mboxq->sge_array->addr[0]; | ||
1797 | read_fcf = (struct lpfc_mbx_read_fcf_tbl *)virt_addr; | ||
1798 | |||
1799 | /* Set up command fields */ | ||
1800 | bf_set(lpfc_mbx_read_fcf_tbl_indx, &read_fcf->u.request, fcf_index); | ||
1801 | /* Perform necessary endian conversion */ | ||
1802 | bytep = virt_addr + sizeof(union lpfc_sli4_cfg_shdr); | ||
1803 | lpfc_sli_pcimem_bcopy(bytep, bytep, sizeof(uint32_t)); | ||
1804 | |||
1805 | return 0; | ||
1806 | } | ||
1807 | |||
1808 | /** | ||
1750 | * lpfc_request_features: Configure SLI4 REQUEST_FEATURES mailbox | 1809 | * lpfc_request_features: Configure SLI4 REQUEST_FEATURES mailbox |
1751 | * @mboxq: pointer to lpfc mbox command. | 1810 | * @mboxq: pointer to lpfc mbox command. |
1752 | * | 1811 | * |
@@ -1946,13 +2005,14 @@ lpfc_reg_fcfi(struct lpfc_hba *phba, struct lpfcMboxq *mbox) | |||
1946 | bf_set(lpfc_reg_fcfi_rq_id1, reg_fcfi, REG_FCF_INVALID_QID); | 2005 | bf_set(lpfc_reg_fcfi_rq_id1, reg_fcfi, REG_FCF_INVALID_QID); |
1947 | bf_set(lpfc_reg_fcfi_rq_id2, reg_fcfi, REG_FCF_INVALID_QID); | 2006 | bf_set(lpfc_reg_fcfi_rq_id2, reg_fcfi, REG_FCF_INVALID_QID); |
1948 | bf_set(lpfc_reg_fcfi_rq_id3, reg_fcfi, REG_FCF_INVALID_QID); | 2007 | bf_set(lpfc_reg_fcfi_rq_id3, reg_fcfi, REG_FCF_INVALID_QID); |
1949 | bf_set(lpfc_reg_fcfi_info_index, reg_fcfi, phba->fcf.fcf_indx); | 2008 | bf_set(lpfc_reg_fcfi_info_index, reg_fcfi, |
2009 | phba->fcf.current_rec.fcf_indx); | ||
1950 | /* reg_fcf addr mode is bit wise inverted value of fcf addr_mode */ | 2010 | /* reg_fcf addr mode is bit wise inverted value of fcf addr_mode */ |
1951 | bf_set(lpfc_reg_fcfi_mam, reg_fcfi, | 2011 | bf_set(lpfc_reg_fcfi_mam, reg_fcfi, (~phba->fcf.addr_mode) & 0x3); |
1952 | (~phba->fcf.addr_mode) & 0x3); | 2012 | if (phba->fcf.current_rec.vlan_id != 0xFFFF) { |
1953 | if (phba->fcf.fcf_flag & FCF_VALID_VLAN) { | ||
1954 | bf_set(lpfc_reg_fcfi_vv, reg_fcfi, 1); | 2013 | bf_set(lpfc_reg_fcfi_vv, reg_fcfi, 1); |
1955 | bf_set(lpfc_reg_fcfi_vlan_tag, reg_fcfi, phba->fcf.vlan_id); | 2014 | bf_set(lpfc_reg_fcfi_vlan_tag, reg_fcfi, |
2015 | phba->fcf.current_rec.vlan_id); | ||
1956 | } | 2016 | } |
1957 | } | 2017 | } |
1958 | 2018 | ||