[45/60] common/sfc_efx/base: add efsys API to find a memory BAR

Message ID 1600764594-14752-46-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series common/sfc_efx: support Riverhead NIC family |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Sept. 22, 2020, 8:49 a.m. UTC
  From: Igor Romanov <igor.romanov@oktetlabs.ru>

Function control window lookup needs memory BARs handles to
search Xilinx capabilities tables.

Define an API to get a memory BAR handle by a PCIe device handle and
BAR index.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
---
 drivers/common/sfc_efx/base/rhead_pci.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/common/sfc_efx/base/rhead_pci.c b/drivers/common/sfc_efx/base/rhead_pci.c
index f8e372b79c..47e89cf8a2 100644
--- a/drivers/common/sfc_efx/base/rhead_pci.c
+++ b/drivers/common/sfc_efx/base/rhead_pci.c
@@ -20,6 +20,7 @@  rhead_pci_nic_membar_lookup(
 	size_t pci_capa_offset = 0;
 	boolean_t bar_found = B_FALSE;
 	efx_rc_t rc = ENOENT;
+	efsys_bar_t xil_eb;
 
 	/*
 	 * SF-119689-TC Riverhead Host Interface section 4.2.2. describes
@@ -50,13 +51,19 @@  rhead_pci_nic_membar_lookup(
 		}
 
 		xilinx_tbl_found = B_TRUE;
+
+		EFSYS_PCI_FIND_MEM_BAR(espcp, xilinx_tbl_bar, &xil_eb, &rc);
+		if (rc != 0)
+			goto fail2;
 	}
 
 	if (bar_found == B_FALSE)
-		goto fail2;
+		goto fail3;
 
 	return (0);
 
+fail3:
+	EFSYS_PROBE(fail3);
 fail2:
 	EFSYS_PROBE(fail2);
 fail1: