From owner-p4-projects@FreeBSD.ORG Wed Feb 21 18:35:21 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2D3C11703B2; Wed, 21 Feb 2007 18:35:21 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0B17E170300 for ; Wed, 21 Feb 2007 18:35:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id F0E3E13C49D for ; Wed, 21 Feb 2007 18:35:20 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l1LIZKx5024652 for ; Wed, 21 Feb 2007 18:35:20 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l1LIZK3S024649 for perforce@freebsd.org; Wed, 21 Feb 2007 18:35:20 GMT (envelope-from jhb@freebsd.org) Date: Wed, 21 Feb 2007 18:35:20 GMT Message-Id: <200702211835.l1LIZK3S024649@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 114813 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2007 18:35:21 -0000 http://perforce.freebsd.org/chv.cgi?CH=114813 Change 114813 by jhb@jhb_mutex on 2007/02/21 18:34:58 IFC @114811. Affected files ... .. //depot/projects/smpng/sys/dev/mii/brgphy.c#39 integrate .. //depot/projects/smpng/sys/dev/mii/miidevs#24 integrate .. //depot/projects/smpng/sys/dev/mxge/if_mxge.c#11 integrate .. //depot/projects/smpng/sys/dev/mxge/if_mxge_var.h#6 integrate Differences ... ==== //depot/projects/smpng/sys/dev/mii/brgphy.c#39 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/mii/brgphy.c,v 1.64 2007/02/14 18:21:32 jkim Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mii/brgphy.c,v 1.65 2007/02/21 18:17:44 jhb Exp $"); /* * Driver for the Broadcom BCM54xx/57xx 1000baseTX PHY. @@ -97,6 +97,7 @@ static int brgphy_mii_phy_auto(struct mii_softc *); static void brgphy_reset(struct mii_softc *); static void brgphy_loop(struct mii_softc *); +static int bcm5706_is_tbi(device_t); static void bcm5401_load_dspcode(struct mii_softc *); static void bcm5411_load_dspcode(struct mii_softc *); static void brgphy_fixup_5704_a0_bug(struct mii_softc *); @@ -122,6 +123,7 @@ MII_PHY_DESC(xxBROADCOM, BCM5752), MII_PHY_DESC(xxBROADCOM, BCM5754), MII_PHY_DESC(xxBROADCOM, BCM5780), + MII_PHY_DESC(xxBROADCOM, BCM5708C), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5787), MII_PHY_END }; @@ -129,8 +131,29 @@ static int brgphy_probe(device_t dev) { + struct mii_attach_args *ma; + int error; - return (mii_phy_dev_probe(dev, brgphys, BUS_PROBE_DEFAULT)); + error = mii_phy_dev_probe(dev, brgphys, BUS_PROBE_DEFAULT); + if (error != BUS_PROBE_DEFAULT) + return (error); + + ma = device_get_ivars(dev); + if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM && + MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5706C) { + /* + * Broadcom uses the same MII model ID on two + * different types of phys. The first is found on the + * BCM 5706 and is supported by this driver. The + * other is found on the BCM 5706S and 5708S and is + * supported by the gentbi(4) driver, so we check to + * see if this phy is supported by gentbi(4) and fail + * the probe if so. + */ + if (bcm5706_is_tbi(dev)) + return (ENXIO); + } + return (error); } static int @@ -488,6 +511,34 @@ } } +/* + * Check to see if a 5706 phy is really a SerDes phy. Copied from + * gentbi_probe(). + */ +static int +bcm5706_is_tbi(device_t dev) +{ + device_t parent; + struct mii_attach_args *ma; + int bmsr, extsr; + + parent = device_get_parent(dev); + ma = device_get_ivars(dev); + + bmsr = MIIBUS_READREG(parent, ma->mii_phyno, MII_BMSR); + if ((bmsr & BMSR_EXTSTAT) == 0 || (bmsr & BMSR_MEDIAMASK) != 0) + return (0); + + extsr = MIIBUS_READREG(parent, ma->mii_phyno, MII_EXTSR); + if (extsr & (EXTSR_1000TFDX|EXTSR_1000THDX)) + return (0); + + if (extsr & (EXTSR_1000XFDX|EXTSR_1000XHDX)) + return (1); + + return (0); +} + /* Turn off tap power management on 5401. */ static void bcm5401_load_dspcode(struct mii_softc *sc) ==== //depot/projects/smpng/sys/dev/mii/miidevs#24 (text+ko) ==== @@ -1,4 +1,4 @@ -$FreeBSD: src/sys/dev/mii/miidevs,v 1.40 2007/01/26 17:05:24 dwhite Exp $ +$FreeBSD: src/sys/dev/mii/miidevs,v 1.41 2007/02/21 18:17:44 jhb Exp $ /*$NetBSD: miidevs,v 1.6 1999/05/14 11:37:30 drochner Exp $*/ /*- @@ -123,13 +123,14 @@ model xxBROADCOM BCM5754 0x000e BCM5754 10/100/1000baseTX PHY model xxBROADCOM BCM5752 0x0010 BCM5752 10/100/1000baseTX PHY model xxBROADCOM BCM5701 0x0011 BCM5701 10/100/1000baseTX PHY +model xxBROADCOM BCM5706C 0x0015 BCM5706C 10/100/1000baseTX PHY model xxBROADCOM BCM5703 0x0016 BCM5703 10/100/1000baseTX PHY model xxBROADCOM BCM5704 0x0019 BCM5704 10/100/1000baseTX PHY model xxBROADCOM BCM5705 0x001a BCM5705 10/100/1000baseTX PHY model xxBROADCOM BCM5750 0x0018 BCM5750 10/100/1000baseTX PHY model xxBROADCOM BCM5714 0x0034 BCM5714 10/100/1000baseTX PHY model xxBROADCOM BCM5780 0x0035 BCM5780 10/100/1000baseTX PHY -model xxBROADCOM BCM5706C 0x0036 BCM5706C/5708C 10/100/1000baseTX PHY +model xxBROADCOM BCM5708C 0x0036 BCM5708C 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5787 0x000e BCM5787 10/100/1000baseTX PHY /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ ==== //depot/projects/smpng/sys/dev/mxge/if_mxge.c#11 (text+ko) ==== @@ -32,7 +32,7 @@ ***************************************************************************/ #include -__FBSDID("$FreeBSD: src/sys/dev/mxge/if_mxge.c,v 1.21 2007/02/15 17:21:31 luigi Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mxge/if_mxge.c,v 1.22 2007/02/21 17:34:05 gallatin Exp $"); #include #include @@ -482,7 +482,7 @@ static int mxge_validate_firmware(mxge_softc_t *sc, const mcp_gen_header_t *hdr) { - int major, minor; + if (be32toh(hdr->mcp_type) != MCP_TYPE_ETH) { device_printf(sc->dev, "Bad firmware type: 0x%x\n", @@ -495,10 +495,11 @@ if (mxge_verbose) device_printf(sc->dev, "firmware id: %s\n", hdr->version); - sscanf(sc->fw_version, "%d.%d", &major, &minor); + sscanf(sc->fw_version, "%d.%d.%d", &sc->fw_ver_major, + &sc->fw_ver_minor, &sc->fw_ver_tiny); - if (!(major == MXGEFW_VERSION_MAJOR - && minor == MXGEFW_VERSION_MINOR)) { + if (!(sc->fw_ver_major == MXGEFW_VERSION_MAJOR + && sc->fw_ver_minor == MXGEFW_VERSION_MINOR)) { device_printf(sc->dev, "Found firmware version %s\n", sc->fw_version); device_printf(sc->dev, "Driver needs %d.%d\n", @@ -713,6 +714,21 @@ hdr_offset, (char *)hdr, bytes); status = mxge_validate_firmware(sc, hdr); free(hdr, M_DEVBUF); + + /* + * check to see if adopted firmware has bug where adopting + * it will cause broadcasts to be filtered unless the NIC + * is kept in ALLMULTI mode + */ + if (sc->fw_ver_major == 1 && sc->fw_ver_minor == 4 && + sc->fw_ver_tiny >= 4 && sc->fw_ver_tiny <= 11) { + sc->adopted_rx_filter_bug = 1; + device_printf(sc->dev, "Adopting fw %d.%d.%d: " + "working around rx filter bug\n", + sc->fw_ver_major, sc->fw_ver_minor, + sc->fw_ver_tiny); + } + return status; } @@ -875,7 +891,9 @@ " error status: %d\n", err); return; } - + + if (sc->adopted_rx_filter_bug) + return; if (ifp->if_flags & IFF_ALLMULTI) /* request to disable multicast filtering, so quit here */ ==== //depot/projects/smpng/sys/dev/mxge/if_mxge_var.h#6 (text+ko) ==== @@ -29,7 +29,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -$FreeBSD: src/sys/dev/mxge/if_mxge_var.h,v 1.9 2007/01/31 19:53:36 gallatin Exp $ +$FreeBSD: src/sys/dev/mxge/if_mxge_var.h,v 1.10 2007/02/21 17:34:05 gallatin Exp $ ***************************************************************************/ @@ -153,6 +153,10 @@ char *fw_name; char eeprom_strings[MXGE_EEPROM_STRINGS_SIZE]; char fw_version[128]; + int fw_ver_major; + int fw_ver_minor; + int fw_ver_tiny; + int adopted_rx_filter_bug; device_t dev; struct ifmedia media; int read_dma;