From a0984d64f62d0d383dcf1c157747a20853512958 Mon Sep 17 00:00:00 2001 From: imp Date: Sun, 1 Mar 2020 17:46:28 +0000 Subject: [PATCH] Remove FreeBSD 7-10 support from bxe driver. Use new PCIER and PCIEM names in the driver rather than relying on old, compat shims. --- sys/dev/bxe/bxe.c | 20 ++++++++++---------- sys/dev/bxe/bxe.h | 38 -------------------------------------- 2 files changed, 10 insertions(+), 48 deletions(-) diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c index c8f37ba459f4..8eafedbf6977 100644 --- a/sys/dev/bxe/bxe.c +++ b/sys/dev/bxe/bxe.c @@ -13261,8 +13261,8 @@ bxe_pcie_capability_read(struct bxe_softc *sc, static uint8_t bxe_is_pcie_pending(struct bxe_softc *sc) { - return (bxe_pcie_capability_read(sc, PCIR_EXPRESS_DEVICE_STA, 2) & - PCIM_EXP_STA_TRANSACTION_PND); + return (bxe_pcie_capability_read(sc, PCIER_DEVICE_STA, 2) & + PCIEM_STA_TRANSACTION_PND); } /* @@ -13286,7 +13286,7 @@ bxe_probe_pci_caps(struct bxe_softc *sc) } } - link_status = bxe_pcie_capability_read(sc, PCIR_EXPRESS_LINK_STA, 2); + link_status = bxe_pcie_capability_read(sc, PCIER_LINK_STA, 2); /* handle PCIe 2.0 workarounds for 57710 */ if (CHIP_IS_E1(sc)) { @@ -13296,16 +13296,16 @@ bxe_probe_pci_caps(struct bxe_softc *sc) /* workaround for 57710 errata E4_57710_27488 */ sc->devinfo.pcie_link_width = - ((link_status & PCIM_LINK_STA_WIDTH) >> 4); + ((link_status & PCIEM_LINK_STA_WIDTH) >> 4); if (sc->devinfo.pcie_link_speed > 1) { sc->devinfo.pcie_link_width = - ((link_status & PCIM_LINK_STA_WIDTH) >> 4) >> 1; + ((link_status & PCIEM_LINK_STA_WIDTH) >> 4) >> 1; } } else { sc->devinfo.pcie_link_speed = - (link_status & PCIM_LINK_STA_SPEED); + (link_status & PCIEM_LINK_STA_SPEED); sc->devinfo.pcie_link_width = - ((link_status & PCIM_LINK_STA_WIDTH) >> 4); + ((link_status & PCIEM_LINK_STA_WIDTH) >> 4); } BLOGD(sc, DBG_LOAD, "PCIe link speed=%d width=%d\n", @@ -16746,14 +16746,14 @@ bxe_init_pxp(struct bxe_softc *sc) uint16_t devctl; int r_order, w_order; - devctl = bxe_pcie_capability_read(sc, PCIR_EXPRESS_DEVICE_CTL, 2); + devctl = bxe_pcie_capability_read(sc, PCIER_DEVICE_CTL, 2); BLOGD(sc, DBG_LOAD, "read 0x%08x from devctl\n", devctl); - w_order = ((devctl & PCIM_EXP_CTL_MAX_PAYLOAD) >> 5); + w_order = ((devctl & PCIEM_CTL_MAX_PAYLOAD) >> 5); if (sc->mrrs == -1) { - r_order = ((devctl & PCIM_EXP_CTL_MAX_READ_REQUEST) >> 12); + r_order = ((devctl & PCIEM_CTL_MAX_READ_REQUEST) >> 12); } else { BLOGD(sc, DBG_LOAD, "forcing read order to %d\n", sc->mrrs); r_order = sc->mrrs; diff --git a/sys/dev/bxe/bxe.h b/sys/dev/bxe/bxe.h index 4df1c0826a42..b39fbdcd4d11 100644 --- a/sys/dev/bxe/bxe.h +++ b/sys/dev/bxe/bxe.h @@ -117,34 +117,6 @@ __FBSDID("$FreeBSD$"); #define VF_MAC_CREDIT_CNT 0 #define VF_VLAN_CREDIT_CNT (0) -#if __FreeBSD_version < 800054 -#if defined(__i386__) || defined(__amd64__) -#define mb() __asm volatile("mfence;" : : : "memory") -#define wmb() __asm volatile("sfence;" : : : "memory") -#define rmb() __asm volatile("lfence;" : : : "memory") -static __inline void prefetch(void *x) -{ - __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); -} -#else -#define mb() -#define rmb() -#define wmb() -#define prefetch(x) -#endif -#endif - -#if __FreeBSD_version >= 1000000 -#define PCIR_EXPRESS_DEVICE_STA PCIER_DEVICE_STA -#define PCIM_EXP_STA_TRANSACTION_PND PCIEM_STA_TRANSACTION_PND -#define PCIR_EXPRESS_LINK_STA PCIER_LINK_STA -#define PCIM_LINK_STA_WIDTH PCIEM_LINK_STA_WIDTH -#define PCIM_LINK_STA_SPEED PCIEM_LINK_STA_SPEED -#define PCIR_EXPRESS_DEVICE_CTL PCIER_DEVICE_CTL -#define PCIM_EXP_CTL_MAX_PAYLOAD PCIEM_CTL_MAX_PAYLOAD -#define PCIM_EXP_CTL_MAX_READ_REQUEST PCIEM_CTL_MAX_READ_REQUEST -#endif - #ifndef ARRAY_SIZE #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #endif @@ -708,10 +680,8 @@ struct bxe_fastpath { //uint8_t segs; -#if __FreeBSD_version >= 800000 #define BXE_BR_SIZE 4096 struct buf_ring *tx_br; -#endif }; /* struct bxe_fastpath */ /* sriov XXX */ @@ -2300,16 +2270,8 @@ void bxe_dump_mem(struct bxe_softc *sc, char *tag, void bxe_dump_mbuf_data(struct bxe_softc *sc, char *pTag, struct mbuf *m, uint8_t contents); -#if __FreeBSD_version >= 800000 -#if (__FreeBSD_version >= 1001513 && __FreeBSD_version < 1100000) ||\ - __FreeBSD_version >= 1100048 #define BXE_SET_FLOWID(m) M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE) #define BXE_VALID_FLOWID(m) (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) -#else -#define BXE_VALID_FLOWID(m) ((m->m_flags & M_FLOWID) != 0) -#define BXE_SET_FLOWID(m) m->m_flags |= M_FLOWID -#endif -#endif /* #if __FreeBSD_version >= 800000 */ /***********/ /* INLINES */