Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jan 2011 11:43:18 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r216992 - stable/7/sys/dev/bge
Message-ID:  <201101051143.p05BhIBk076568@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Wed Jan  5 11:43:17 2011
New Revision: 216992
URL: http://svn.freebsd.org/changeset/base/216992

Log:
  MFC: r216085
  
  - Remove the remaining support for older (in this case pre-7.0-RELEASE)
    versions of FreeBSD. In fact we are already missing a lot of conditional
    code necessary to support older versions of FreeBSD, including alternatives
    for vital functionality not yet provided by the respective subsystem back
    then (see for example r199663). So this change shouldn't actually break
    this driver on versions of FreeBSD that were supported before. Besides,
    this driver also isn't maintained as an multi-release version outside of
    the main repository, so removing the conditional code shouldn't be a
    problem in that regard either.
  - Sprinkle some more const on tables.

Modified:
  stable/7/sys/dev/bge/if_bge.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/bge/if_bge.c
==============================================================================
--- stable/7/sys/dev/bge/if_bge.c	Wed Jan  5 11:43:17 2011	(r216991)
+++ stable/7/sys/dev/bge/if_bge.c	Wed Jan  5 11:43:17 2011	(r216992)
@@ -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 @@ again:
 	/*
 	 * 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 @@ again:
 		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
 		 * 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) {
@@ -4452,21 +4435,10 @@ bge_encap(struct bge_softc *sc, struct m
 
 	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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101051143.p05BhIBk076568>