summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/sfc/efx_common.c
diff options
context:
space:
mode:
authorMartin Habets2018-06-18 12:41:38 +0200
committerMichael Brown2018-08-26 23:02:23 +0200
commitaf1860711a3823202a4ddee0ddfb9814591f506c (patch)
tree351d83eef644c3f987bbf53ea0ab27e1fba7974f /src/drivers/net/sfc/efx_common.c
parent[intelxl] Add driver for Intel 40 Gigabit Ethernet NICs (diff)
downloadipxe-af1860711a3823202a4ddee0ddfb9814591f506c.tar.gz
ipxe-af1860711a3823202a4ddee0ddfb9814591f506c.tar.xz
ipxe-af1860711a3823202a4ddee0ddfb9814591f506c.zip
[sfc] Add support for X25xx adapters
The first adapters in this family are X2522-10, X2522-25, X2541 and X2542. These no longer use PCI BAR 0 for I/O, but use that for memory. In other words, BAR 2 on SFN8xxx adapters now becomes BAR 0. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net/sfc/efx_common.c')
-rw-r--r--src/drivers/net/sfc/efx_common.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/drivers/net/sfc/efx_common.c b/src/drivers/net/sfc/efx_common.c
index 79a99435..40388770 100644
--- a/src/drivers/net/sfc/efx_common.c
+++ b/src/drivers/net/sfc/efx_common.c
@@ -72,13 +72,19 @@ void efx_probe(struct net_device *netdev, enum efx_revision revision)
struct efx_nic *efx = netdev_priv(netdev);
struct pci_device *pci = container_of(netdev->dev,
struct pci_device, dev);
+ unsigned int reg = PCI_BASE_ADDRESS_0;
+ uint32_t bar_low;
efx->netdev = netdev;
efx->revision = revision;
- /* MMIO bar */
- efx->mmio_start = pci_bar_start(pci, PCI_BASE_ADDRESS_2);
- efx->mmio_len = pci_bar_size(pci, PCI_BASE_ADDRESS_2);
+ /* Find the memory bar to use */
+ pci_read_config_dword(pci, reg, &bar_low);
+ if ((bar_low & PCI_BASE_ADDRESS_IO_MASK) == PCI_BASE_ADDRESS_SPACE_IO)
+ reg = PCI_BASE_ADDRESS_2;
+
+ efx->mmio_start = pci_bar_start(pci, reg);
+ efx->mmio_len = pci_bar_size(pci, reg);
efx->membase = ioremap(efx->mmio_start, efx->mmio_len);
DBGCP(efx, "BAR of %lx bytes at phys %lx mapped at %p\n",