svn commit: r215884 - in stable/8/sys/dev: bge mii

Marius Strobl marius at FreeBSD.org
Fri Nov 26 20:55:59 UTC 2010


Author: marius
Date: Fri Nov 26 20:55:58 2010
New Revision: 215884
URL: http://svn.freebsd.org/changeset/base/215884

Log:
  MFC: r215302
  
  Move the limiting of the PHY to 10/100 modes of operation due to limitations
  of certain MAC models from brgphy(4) to bge(4) where it belongs. While at it,
  update the list of models having that restriction to what OpenBSD uses, which
  in turn seems to have obtained that information from the Linux tg3 driver.

Modified:
  stable/8/sys/dev/bge/if_bge.c
  stable/8/sys/dev/mii/brgphy.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==============================================================================
--- stable/8/sys/dev/bge/if_bge.c	Fri Nov 26 20:45:52 2010	(r215883)
+++ stable/8/sys/dev/bge/if_bge.c	Fri Nov 26 20:55:58 2010	(r215884)
@@ -2640,7 +2640,7 @@ bge_attach(device_t dev)
 	struct bge_softc *sc;
 	uint32_t hwcfg = 0, misccfg;
 	u_char eaddr[ETHER_ADDR_LEN];
-	int error, f, msicount, phy_addr, reg, rid, trys;
+	int capmask, error, f, msicount, phy_addr, reg, rid, trys;
 
 	sc = device_get_softc(dev);
 	sc->bge_dev = dev;
@@ -2824,13 +2824,31 @@ bge_attach(device_t dev)
 	if (BGE_IS_5755_PLUS(sc) == 0)
 		sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG;
 
+	misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID;
 	if (sc->bge_asicrev == BGE_ASICREV_BCM5705) {
-		misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID;
 		if (misccfg == BGE_MISCCFG_BOARD_ID_5788 ||
 		    misccfg == BGE_MISCCFG_BOARD_ID_5788M)
 			sc->bge_flags |= BGE_FLAG_5788;
 	}
 
+	capmask = BMSR_DEFCAPMASK;
+	if ((sc->bge_asicrev == BGE_ASICREV_BCM5703 &&
+	    (misccfg == 0x4000 || misccfg == 0x8000)) ||
+	    (sc->bge_asicrev == BGE_ASICREV_BCM5705 &&
+	    pci_get_vendor(dev) == BCOM_VENDORID &&
+	    (pci_get_device(dev) == BCOM_DEVICEID_BCM5901 ||
+	    pci_get_device(dev) == BCOM_DEVICEID_BCM5901A2 ||
+	    pci_get_device(dev) == BCOM_DEVICEID_BCM5705F)) ||
+	    (pci_get_vendor(dev) == BCOM_VENDORID &&
+	    (pci_get_device(dev) == BCOM_DEVICEID_BCM5751F ||
+	    pci_get_device(dev) == BCOM_DEVICEID_BCM5753F ||
+	    pci_get_device(dev) == BCOM_DEVICEID_BCM5787F)) ||
+	    pci_get_device(dev) == BCOM_DEVICEID_BCM57790 ||
+	    sc->bge_asicrev == BGE_ASICREV_BCM5906) {
+		/* These chips are 10/100 only. */
+		capmask &= ~BMSR_EXTSTAT;
+	}
+
 	/*
 	 * Some controllers seem to require a special firmware to use
 	 * TSO. But the firmware is not available to FreeBSD and Linux
@@ -3104,9 +3122,9 @@ bge_attach(device_t dev)
 again:
 		bge_asf_driver_up(sc);
 
-		error = mii_attach(dev, &sc->bge_miibus, ifp,
-		    bge_ifmedia_upd, bge_ifmedia_sts, BMSR_DEFCAPMASK,
-		    phy_addr, MII_OFFSET_ANY, MIIF_DOPAUSE | MIIF_FORCEPAUSE);
+		error = mii_attach(dev, &sc->bge_miibus, ifp, bge_ifmedia_upd,
+		    bge_ifmedia_sts, capmask, phy_addr, MII_OFFSET_ANY,
+		    MIIF_DOPAUSE | MIIF_FORCEPAUSE);
 		if (error != 0) {
 			if (trys++ < 4) {
 				device_printf(sc->bge_dev, "Try again\n");

Modified: stable/8/sys/dev/mii/brgphy.c
==============================================================================
--- stable/8/sys/dev/mii/brgphy.c	Fri Nov 26 20:45:52 2010	(r215883)
+++ stable/8/sys/dev/mii/brgphy.c	Fri Nov 26 20:55:58 2010	(r215884)
@@ -271,17 +271,6 @@ brgphy_attach(device_t dev)
 		bce_sc = ifp->if_softc;
 	}
 
-	/* Todo: Need to add additional controllers such as 5906 & 5787F */
-	/* The 590x chips are 10/100 only. */
-	if (bge_sc &&
-	    pci_get_vendor(bge_sc->bge_dev) == BCOM_VENDORID &&
-	    (pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5901 ||
-	    pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5901A2 ||
-	    pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5906 ||
-	    pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5906M)) {
-		ma->mii_capmask &= ~BMSR_EXTSTAT;
-	}
-
 	brgphy_reset(sc);
 
 	/* Read the PHY's capabilities. */


More information about the svn-src-stable mailing list