diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index c3bdcaf06fe3..3f9d6d25b094 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -139,7 +139,7 @@ MODULE_DEPEND(bge, miibus, 1, 1, 1); static const struct bge_type { uint16_t bge_vid; uint16_t bge_did; -} bge_devs[] = { +} const bge_devs[] = { { ALTEON_VENDORID, ALTEON_DEVICEID_BCM5700 }, { ALTEON_VENDORID, ALTEON_DEVICEID_BCM5701 }, @@ -232,7 +232,7 @@ static const struct bge_type { static const struct bge_vendor { uint16_t v_id; const char *v_name; -} bge_vendors[] = { +} const bge_vendors[] = { { ALTEON_VENDORID, "Alteon" }, { ALTIMA_VENDORID, "Altima" }, { APPLE_VENDORID, "Apple" }, @@ -247,7 +247,7 @@ static const struct bge_vendor { static const struct bge_revision { uint32_t br_chipid; const char *br_name; -} bge_revisions[] = { +} const bge_revisions[] = { { BGE_CHIPID_BCM5700_A0, "BCM5700 A0" }, { BGE_CHIPID_BCM5700_A1, "BCM5700 A1" }, { BGE_CHIPID_BCM5700_B0, "BCM5700 B0" }, @@ -317,7 +317,7 @@ static const struct bge_revision { * Some defaults for major revisions, so that newer steppings * that we don't know about have a shot at working. */ -static const struct bge_revision bge_majorrevs[] = { +static const struct bge_revision const bge_majorrevs[] = { { BGE_ASICREV_BCM5700, "unknown BCM5700" }, { BGE_ASICREV_BCM5701, "unknown BCM5701" }, { BGE_ASICREV_BCM5703, "unknown BCM5703" }, @@ -2143,20 +2143,21 @@ bge_lookup_vendor(uint16_t vid) static int bge_probe(device_t dev) { - const struct bge_type *t = bge_devs; + char buf[96]; + char model[64]; + const struct bge_revision *br; + const char *pname; struct bge_softc *sc = device_get_softc(dev); - uint16_t vid, did; + const struct bge_type *t = bge_devs; + const struct bge_vendor *v; + uint32_t id; + uint16_t did, vid; sc->bge_dev = dev; vid = pci_get_vendor(dev); did = pci_get_device(dev); while(t->bge_vid != 0) { if ((vid == t->bge_vid) && (did == t->bge_did)) { - char model[64], buf[96]; - const struct bge_revision *br; - const struct bge_vendor *v; - uint32_t id; - id = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> BGE_PCIMISCCTL_ASICREV_SHIFT; if (BGE_ASICREV(id) == BGE_ASICREV_USE_PRODID_REG) { @@ -2177,20 +2178,13 @@ bge_probe(device_t dev) } br = bge_lookup_rev(id); v = bge_lookup_vendor(vid); - { -#if __FreeBSD_version > 700024 - const char *pname; - - if (bge_has_eaddr(sc) && - pci_get_vpd_ident(dev, &pname) == 0) - snprintf(model, 64, "%s", pname); - else -#endif - snprintf(model, 64, "%s %s", - v->v_name, - br != NULL ? br->br_name : - "NetXtreme Ethernet Controller"); - } + if (bge_has_eaddr(sc) && + pci_get_vpd_ident(dev, &pname) == 0) + snprintf(model, 64, "%s", pname); + else + snprintf(model, 64, "%s %s", v->v_name, + br != NULL ? br->br_name : + "NetXtreme Ethernet Controller"); snprintf(buf, 96, "%s, %sASIC rev. %#08x", model, br != NULL ? "" : "unknown ", id); device_set_desc_copy(dev, buf); @@ -3167,7 +3161,6 @@ bge_attach(device_t dev) /* * Hookup IRQ last. */ -#if __FreeBSD_version > 700030 if (BGE_IS_5755_PLUS(sc) && sc->bge_flags & BGE_FLAG_MSI) { /* Take advantage of single-shot MSI. */ CSR_WRITE_4(sc, BGE_MSI_MODE, CSR_READ_4(sc, BGE_MSI_MODE) & @@ -3191,10 +3184,6 @@ bge_attach(device_t dev) error = bus_setup_intr(dev, sc->bge_irq, INTR_TYPE_NET | INTR_MPSAFE, NULL, bge_intr, sc, &sc->bge_intrhand); -#else - error = bus_setup_intr(dev, sc->bge_irq, INTR_TYPE_NET | INTR_MPSAFE, - bge_intr, sc, &sc->bge_intrhand); -#endif if (error) { bge_detach(dev); @@ -3643,14 +3632,8 @@ bge_rxeof(struct bge_softc *sc, uint16_t rx_prod, int holdlck) * attach that information to the packet. */ if (have_tag) { -#if __FreeBSD_version > 700022 m->m_pkthdr.ether_vtag = vlan_tag; m->m_flags |= M_VLANTAG; -#else - VLAN_INPUT_TAG_NEW(ifp, m, vlan_tag); - if (m == NULL) - continue; -#endif } if (holdlck != 0) { @@ -4456,21 +4439,10 @@ bge_encap(struct bge_softc *sc, struct mbuf **m_head, uint32_t *txidx) bus_dmamap_sync(sc->bge_cdata.bge_tx_mtag, map, BUS_DMASYNC_PREWRITE); -#if __FreeBSD_version > 700022 if (m->m_flags & M_VLANTAG) { csum_flags |= BGE_TXBDFLAG_VLAN_TAG; vlan_tag = m->m_pkthdr.ether_vtag; } -#else - { - struct m_tag *mtag; - - if ((mtag = VLAN_OUTPUT_TAG(sc->bge_ifp, m)) != NULL) { - csum_flags |= BGE_TXBDFLAG_VLAN_TAG; - vlan_tag = VLAN_TAG_VALUE(mtag); - } - } -#endif for (i = 0; ; i++) { d = &sc->bge_ldata.bge_tx_ring[idx]; d->bge_addr.bge_addr_lo = BGE_ADDR_LO(segs[i].ds_addr);