common/sfc_efx/base: separate target EvQ and IRQ config
[dpdk.git] / drivers / common / sfc_efx / base / rhead_pci.c
index 0a6e72f..54522fe 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- * Copyright(c) 2019-2020 Xilinx, Inc.
+ * Copyright(c) 2019-2021 Xilinx, Inc.
  * Copyright(c) 2019 Solarflare Communications Inc.
  */
 
@@ -47,6 +47,7 @@ fail1:
        __checkReturn                   efx_rc_t
 rhead_pci_nic_membar_lookup(
        __in                            efsys_pci_config_t *espcp,
+       __in                            const efx_pci_ops_t *epop,
        __out                           efx_bar_region_t *ebrp)
 {
        boolean_t xilinx_tbl_found = B_FALSE;
@@ -56,13 +57,17 @@ rhead_pci_nic_membar_lookup(
        boolean_t bar_found = B_FALSE;
        efx_rc_t rc = ENOENT;
        efsys_bar_t xil_eb;
+       efsys_bar_t nic_eb;
+       efx_dword_t magic_ed;
+       uint32_t magic;
 
        /*
         * SF-119689-TC Riverhead Host Interface section 4.2.2. describes
         * the following discovery steps.
         */
        while (1) {
-               rc = efx_pci_find_next_xilinx_cap_table(espcp, &pci_capa_offset,
+               rc = efx_pci_find_next_xilinx_cap_table(espcp, epop,
+                                                       &pci_capa_offset,
                                                        &xilinx_tbl_bar,
                                                        &xilinx_tbl_offset);
                if (rc != 0) {
@@ -87,7 +92,7 @@ rhead_pci_nic_membar_lookup(
 
                xilinx_tbl_found = B_TRUE;
 
-               EFSYS_PCI_FIND_MEM_BAR(espcp, xilinx_tbl_bar, &xil_eb, &rc);
+               rc = epop->epo_find_mem_bar(espcp, xilinx_tbl_bar, &xil_eb);
                if (rc != 0)
                        goto fail2;
 
@@ -107,8 +112,25 @@ rhead_pci_nic_membar_lookup(
        if (bar_found == B_FALSE)
                goto fail4;
 
+       rc = epop->epo_find_mem_bar(espcp, ebrp->ebr_index, &nic_eb);
+       if (rc != 0)
+               goto fail5;
+
+       EFSYS_BAR_READD(&nic_eb, ebrp->ebr_offset + ER_GZ_NIC_MAGIC_OFST,
+                       &magic_ed, B_FALSE);
+
+       magic = EFX_DWORD_FIELD(magic_ed, ERF_GZ_NIC_MAGIC);
+       if (magic != EFE_GZ_NIC_MAGIC_EXPECTED) {
+               rc = EINVAL;
+               goto fail6;
+       }
+
        return (0);
 
+fail6:
+       EFSYS_PROBE(fail6);
+fail5:
+       EFSYS_PROBE(fail5);
 fail4:
        EFSYS_PROBE(fail4);
 fail3: