diff options
author | Michal Meloun <mmel@FreeBSD.org> | 2020-12-16 14:39:24 +0000 |
---|---|---|
committer | Michal Meloun <mmel@FreeBSD.org> | 2020-12-16 14:39:24 +0000 |
commit | 63d973c3e94cb253d61fb82679a8497dbb955230 (patch) | |
tree | 96504db14de4d0fbc8de9e3a12c517624499e7cf | |
parent | c0ffd35cbb30b4a6ff2948168ea320c7779c1b11 (diff) | |
download | src-test2-63d973c3e94cb253d61fb82679a8497dbb955230.tar.gz src-test2-63d973c3e94cb253d61fb82679a8497dbb955230.zip |
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
Notes
Notes:
svn path=/head/; revision=368698
-rw-r--r-- | sys/dev/e1000/if_em.c | 6 | ||||
-rw-r--r-- | sys/dev/e1000/if_em.h | 1 |
2 files changed, 2 insertions, 5 deletions
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 25eea74631de..185dbc84e87c 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 edcab1678162..d685b4aedc26 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 |