summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormmel <mmel@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>2020-12-16 14:39:24 +0000
committermmel <mmel@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>2020-12-16 14:39:24 +0000
commita38c691aa4b4e5da93b11e15ecabe078b1ecbfb6 (patch)
tree96504db14de4d0fbc8de9e3a12c517624499e7cf
parenta15a18ace6078f6947df4f57dd1a0df629a50fcb (diff)
downloadfreebsd-a38c691aa4b4e5da93b11e15ecabe078b1ecbfb6.tar.gz
freebsd-a38c691aa4b4e5da93b11e15ecabe078b1ecbfb6.tar.bz2
Use the standard method for localizing of MSI-X table bar.
Current way, hardcoded value plus heuristic is not conform to the PCI(e) specification and it fails on systems where MSI-X bar is not initialized by BIOS/ACPI (many arm or arm64 systems for example). Instead, use the standard PCI(e) capability for determining of MSIX table bar address. MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D27265 git-svn-id: http://svn.freebsd.org/base/head@368698 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
-rw-r--r--sys/dev/e1000/if_em.c6
-rw-r--r--sys/dev/e1000/if_em.h1
2 files changed, 2 insertions, 5 deletions
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index 25eea74631d..185dbc84e87 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -847,9 +847,7 @@ em_if_attach_pre(if_ctx_t ctx)
** use a different BAR, so we need to keep
** track of which is used.
*/
- scctx->isc_msix_bar = PCIR_BAR(EM_MSIX_BAR);
- if (pci_read_config(dev, scctx->isc_msix_bar, 4) == 0)
- scctx->isc_msix_bar += 4;
+ scctx->isc_msix_bar = pci_msix_table_bar(dev);
} else if (adapter->hw.mac.type >= em_mac_min) {
scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0]* sizeof(struct e1000_tx_desc), EM_DBA_ALIGN);
scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union e1000_rx_desc_extended), EM_DBA_ALIGN);
@@ -883,7 +881,7 @@ em_if_attach_pre(if_ctx_t ctx)
* that it shall give MSI at least a try with other devices.
*/
if (adapter->hw.mac.type == e1000_82574) {
- scctx->isc_msix_bar = PCIR_BAR(EM_MSIX_BAR);
+ scctx->isc_msix_bar = pci_msix_table_bar(dev);;
} else {
scctx->isc_msix_bar = -1;
scctx->isc_disable_msix = 1;
diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h
index edcab167816..d685b4aedc2 100644
--- a/sys/dev/e1000/if_em.h
+++ b/sys/dev/e1000/if_em.h
@@ -316,7 +316,6 @@
#define EM_BAR_MEM_TYPE_MASK 0x00000006
#define EM_BAR_MEM_TYPE_32BIT 0x00000000
#define EM_BAR_MEM_TYPE_64BIT 0x00000004
-#define EM_MSIX_BAR 3 /* On 82575 */
/* More backward compatibility */
#if __FreeBSD_version < 900000