From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 7 01:19:41 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 006951065693; Sun, 7 Nov 2010 01:19:41 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1E738FC08; Sun, 7 Nov 2010 01:19:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA71JeoO005370; Sun, 7 Nov 2010 01:19:40 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA71JeVl005368; Sun, 7 Nov 2010 01:19:40 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201011070119.oA71JeVl005368@svn.freebsd.org> From: Lawrence Stewart Date: Sun, 7 Nov 2010 01:19:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214900 - stable/7/share/man/man4 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 01:19:41 -0000 Author: lstewart Date: Sun Nov 7 01:19:40 2010 New Revision: 214900 URL: http://svn.freebsd.org/changeset/base/214900 Log: Remove siis.4 from the man4/Makefile. It was incorrectly included in r214875 as part of the SIFTR MFC and breaks buildworld as siis.4 doesn't exist in stable/7. This is an intentional direct commit to the 7-STABLE branch. Pointy hat to: lstewart Noticed by: Michael Butler Modified: stable/7/share/man/man4/Makefile Modified: stable/7/share/man/man4/Makefile ============================================================================== --- stable/7/share/man/man4/Makefile Sat Nov 6 22:07:22 2010 (r214899) +++ stable/7/share/man/man4/Makefile Sun Nov 7 01:19:40 2010 (r214900) @@ -315,7 +315,6 @@ MAN= aac.4 \ sge.4 \ si.4 \ siftr.4 \ - siis.4 \ sio.4 \ sis.4 \ sk.4 \ From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 7 11:12:31 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24CBA106566C; Sun, 7 Nov 2010 11:12:31 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E0038FC15; Sun, 7 Nov 2010 11:12:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7BCVnA040135; Sun, 7 Nov 2010 11:12:31 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7BCUYl040102; Sun, 7 Nov 2010 11:12:30 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071112.oA7BCUYl040102@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 11:12:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214910 - in stable/7/sys: arm/xscale/ixp425 dev/ae dev/age dev/alc dev/ale dev/bfe dev/bge dev/bm dev/cas dev/dc dev/fxp dev/gem dev/hme dev/jme dev/mii dev/msk dev/pcn dev/re dev/sk d... X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 11:12:31 -0000 Author: marius Date: Sun Nov 7 11:12:30 2010 New Revision: 214910 URL: http://svn.freebsd.org/changeset/base/214910 Log: MFC: r213893, r213908, r214566, r214605, r214846 Convert the PHY drivers to honor the mii_flags passed down and convert the NIC drivers as well as the PHY drivers to take advantage of the mii_attach() introduced in r213878 (MFC'ed to stable/8 in r214685) to get rid of certain hacks. For the most part these were: - Artificially limiting miibus_{read,write}reg methods to certain PHY addresses; we now let mii_attach() only probe the PHY at the desired address(es) instead. - PHY drivers setting MIIF_* flags based on the NIC driver they hang off from, partly even based on grabbing and using the softc of the parent; we now pass these flags down from the NIC to the PHY drivers via mii_attach(). This got us rid of all such hacks except those of brgphy() in combination with bce(4) and bge(4), which is way beyond what can be expressed with simple flags. While at it, I took the opportunity to change the NIC drivers to pass up the error returned by mii_attach() (previously by mii_phy_probe()) and unify the error message used in this case where and as appropriate as mii_attach() actually can fail for a number of reasons, not just because of no PHY(s) being present at the expected address(es). Reviewed by: jhb, yongari Modified: stable/7/sys/arm/xscale/ixp425/if_npe.c stable/7/sys/dev/ae/if_ae.c stable/7/sys/dev/ae/if_aevar.h stable/7/sys/dev/age/if_age.c stable/7/sys/dev/alc/if_alc.c stable/7/sys/dev/ale/if_ale.c stable/7/sys/dev/bfe/if_bfe.c stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h stable/7/sys/dev/bm/if_bm.c stable/7/sys/dev/cas/if_cas.c stable/7/sys/dev/cas/if_casvar.h stable/7/sys/dev/dc/if_dc.c stable/7/sys/dev/dc/pnphy.c stable/7/sys/dev/fxp/if_fxp.c stable/7/sys/dev/gem/if_gem.c stable/7/sys/dev/gem/if_gemvar.h stable/7/sys/dev/hme/if_hme.c stable/7/sys/dev/jme/if_jme.c stable/7/sys/dev/mii/acphy.c stable/7/sys/dev/mii/amphy.c stable/7/sys/dev/mii/atphy.c stable/7/sys/dev/mii/bmtphy.c stable/7/sys/dev/mii/brgphy.c stable/7/sys/dev/mii/ciphy.c stable/7/sys/dev/mii/e1000phy.c stable/7/sys/dev/mii/exphy.c stable/7/sys/dev/mii/gentbi.c stable/7/sys/dev/mii/icsphy.c stable/7/sys/dev/mii/inphy.c stable/7/sys/dev/mii/ip1000phy.c stable/7/sys/dev/mii/jmphy.c stable/7/sys/dev/mii/lxtphy.c stable/7/sys/dev/mii/mlphy.c stable/7/sys/dev/mii/nsgphy.c stable/7/sys/dev/mii/nsphy.c stable/7/sys/dev/mii/nsphyter.c stable/7/sys/dev/mii/pnaphy.c stable/7/sys/dev/mii/qsphy.c stable/7/sys/dev/mii/rgephy.c stable/7/sys/dev/mii/rlphy.c stable/7/sys/dev/mii/rlswitch.c stable/7/sys/dev/mii/ruephy.c stable/7/sys/dev/mii/tdkphy.c stable/7/sys/dev/mii/tlphy.c stable/7/sys/dev/mii/truephy.c stable/7/sys/dev/mii/ukphy.c stable/7/sys/dev/mii/xmphy.c stable/7/sys/dev/msk/if_msk.c stable/7/sys/dev/pcn/if_pcn.c stable/7/sys/dev/re/if_re.c stable/7/sys/dev/sk/if_sk.c stable/7/sys/dev/ste/if_ste.c stable/7/sys/dev/stge/if_stge.c stable/7/sys/dev/vge/if_vge.c stable/7/sys/dev/vr/if_vr.c stable/7/sys/dev/vr/if_vrreg.h stable/7/sys/pci/if_rl.c stable/7/sys/pci/if_xl.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/arm/xscale/ixp425/if_npe.c ============================================================================== --- stable/7/sys/arm/xscale/ixp425/if_npe.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/arm/xscale/ixp425/if_npe.c Sun Nov 7 11:12:30 2010 (r214910) @@ -318,11 +318,13 @@ npe_attach(device_t dev) npe_getmac(sc, eaddr); - /* NB: must be setup prior to invoking mii code */ sc->sc_ifp = ifp = if_alloc(IFT_ETHER); - if (mii_phy_probe(dev, &sc->sc_mii, npe_ifmedia_update, npe_ifmedia_status)) { - device_printf(dev, "Cannot find my PHY.\n"); - error = ENXIO; + error = mii_attach(dev, &sc->sc_mii, ifp, npe_ifmedia_update, + npe_ifmedia_status, BMSR_DEFCAPMASK, sc->sc_phy, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); + return error; goto out; } @@ -1596,8 +1598,6 @@ npe_miibus_readreg(device_t dev, int phy struct npe_softc *sc = device_get_softc(dev); uint32_t v; - if (phy != sc->sc_phy) /* XXX no auto-detect */ - return 0xffff; v = (phy << NPE_MII_ADDR_SHL) | (reg << NPE_MII_REG_SHL) | NPE_MII_GO; npe_mii_mdio_write(sc, NPE_MAC_MDIO_CMD, v); @@ -1615,8 +1615,6 @@ npe_miibus_writereg(device_t dev, int ph struct npe_softc *sc = device_get_softc(dev); uint32_t v; - if (phy != sc->sc_phy) /* XXX */ - return; v = (phy << NPE_MII_ADDR_SHL) | (reg << NPE_MII_REG_SHL) | data | NPE_MII_WRITE | NPE_MII_GO; Modified: stable/7/sys/dev/ae/if_ae.c ============================================================================== --- stable/7/sys/dev/ae/if_ae.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/ae/if_ae.c Sun Nov 7 11:12:30 2010 (r214910) @@ -360,9 +360,6 @@ ae_attach(device_t dev) if (error != 0) goto fail; - /* Set default PHY address. */ - sc->phyaddr = AE_PHYADDR_DEFAULT; - ifp = sc->ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { device_printf(dev, "could not allocate ifnet structure.\n"); @@ -390,10 +387,11 @@ ae_attach(device_t dev) /* * Configure and attach MII bus. */ - error = mii_phy_probe(dev, &sc->miibus, ae_mediachange, - ae_mediastatus); + error = mii_attach(dev, &sc->miibus, ifp, ae_mediachange, + ae_mediastatus, BMSR_DEFCAPMASK, AE_PHYADDR_DEFAULT, + MII_OFFSET_ANY, 0); if (error != 0) { - device_printf(dev, "no PHY found.\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } @@ -813,9 +811,6 @@ ae_miibus_readreg(device_t dev, int phy, * Locking is done in upper layers. */ - if (phy != sc->phyaddr) - return (0); - val = ((reg << AE_MDIO_REGADDR_SHIFT) & AE_MDIO_REGADDR_MASK) | AE_MDIO_START | AE_MDIO_READ | AE_MDIO_SUP_PREAMBLE | ((AE_MDIO_CLK_25_4 << AE_MDIO_CLK_SHIFT) & AE_MDIO_CLK_MASK); @@ -851,9 +846,6 @@ ae_miibus_writereg(device_t dev, int phy * Locking is done in upper layers. */ - if (phy != sc->phyaddr) - return (0); - aereg = ((reg << AE_MDIO_REGADDR_SHIFT) & AE_MDIO_REGADDR_MASK) | AE_MDIO_START | AE_MDIO_SUP_PREAMBLE | ((AE_MDIO_CLK_25_4 << AE_MDIO_CLK_SHIFT) & AE_MDIO_CLK_MASK) | Modified: stable/7/sys/dev/ae/if_aevar.h ============================================================================== --- stable/7/sys/dev/ae/if_aevar.h Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/ae/if_aevar.h Sun Nov 7 11:12:30 2010 (r214910) @@ -111,7 +111,6 @@ typedef struct ae_softc { struct mtx mtx; - int phyaddr; uint8_t eaddr[ETHER_ADDR_LEN]; uint8_t flags; int if_flags; Modified: stable/7/sys/dev/age/if_age.c ============================================================================== --- stable/7/sys/dev/age/if_age.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/age/if_age.c Sun Nov 7 11:12:30 2010 (r214910) @@ -210,8 +210,6 @@ age_miibus_readreg(device_t dev, int phy int i; sc = device_get_softc(dev); - if (phy != sc->age_phyaddr) - return (0); CSR_WRITE_4(sc, AGE_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | MDIO_SUP_PREAMBLE | MDIO_CLK_25_4 | MDIO_REG_ADDR(reg)); @@ -241,8 +239,6 @@ age_miibus_writereg(device_t dev, int ph int i; sc = device_get_softc(dev); - if (phy != sc->age_phyaddr) - return (0); CSR_WRITE_4(sc, AGE_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | @@ -621,9 +617,11 @@ age_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->age_miibus, age_mediachange, - age_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->age_miibus, ifp, age_mediachange, + age_mediastatus, BMSR_DEFCAPMASK, sc->age_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/alc/if_alc.c ============================================================================== --- stable/7/sys/dev/alc/if_alc.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/alc/if_alc.c Sun Nov 7 11:12:30 2010 (r214910) @@ -235,9 +235,6 @@ alc_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); - if (phy != sc->alc_phyaddr) - return (0); - /* * For AR8132 fast ethernet controller, do not report 1000baseT * capability to mii(4). Even though AR8132 uses the same @@ -274,9 +271,6 @@ alc_miibus_writereg(device_t dev, int ph sc = device_get_softc(dev); - if (phy != sc->alc_phyaddr) - return (0); - CSR_WRITE_4(sc, ALC_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | MDIO_SUP_PREAMBLE | MDIO_CLK_25_4 | MDIO_REG_ADDR(reg)); @@ -978,9 +972,11 @@ alc_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->alc_miibus, alc_mediachange, - alc_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->alc_miibus, ifp, alc_mediachange, + alc_mediastatus, BMSR_DEFCAPMASK, sc->alc_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/ale/if_ale.c ============================================================================== --- stable/7/sys/dev/ale/if_ale.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/ale/if_ale.c Sun Nov 7 11:12:30 2010 (r214910) @@ -208,9 +208,6 @@ ale_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); - if (phy != sc->ale_phyaddr) - return (0); - CSR_WRITE_4(sc, ALE_MDIO, MDIO_OP_EXECUTE | MDIO_OP_READ | MDIO_SUP_PREAMBLE | MDIO_CLK_25_4 | MDIO_REG_ADDR(reg)); for (i = ALE_PHY_TIMEOUT; i > 0; i--) { @@ -237,9 +234,6 @@ ale_miibus_writereg(device_t dev, int ph sc = device_get_softc(dev); - if (phy != sc->ale_phyaddr) - return (0); - CSR_WRITE_4(sc, ALE_MDIO, MDIO_OP_EXECUTE | MDIO_OP_WRITE | (val & MDIO_DATA_MASK) << MDIO_DATA_SHIFT | MDIO_SUP_PREAMBLE | MDIO_CLK_25_4 | MDIO_REG_ADDR(reg)); @@ -605,9 +599,11 @@ ale_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->ale_miibus, ale_mediachange, - ale_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->ale_miibus, ifp, ale_mediachange, + ale_mediastatus, BMSR_DEFCAPMASK, sc->ale_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/bfe/if_bfe.c ============================================================================== --- stable/7/sys/dev/bfe/if_bfe.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/bfe/if_bfe.c Sun Nov 7 11:12:30 2010 (r214910) @@ -498,10 +498,11 @@ bfe_attach(device_t dev) bfe_chip_reset(sc); BFE_UNLOCK(sc); - if (mii_phy_probe(dev, &sc->bfe_miibus, - bfe_ifmedia_upd, bfe_ifmedia_sts)) { - device_printf(dev, "MII without any PHY!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->bfe_miibus, ifp, bfe_ifmedia_upd, + bfe_ifmedia_sts, BMSR_DEFCAPMASK, sc->bfe_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } @@ -624,8 +625,6 @@ bfe_miibus_readreg(device_t dev, int phy u_int32_t ret; sc = device_get_softc(dev); - if (phy != sc->bfe_phyaddr) - return (0); bfe_readphy(sc, reg, &ret); return (ret); @@ -637,8 +636,6 @@ bfe_miibus_writereg(device_t dev, int ph struct bfe_softc *sc; sc = device_get_softc(dev); - if (phy != sc->bfe_phyaddr) - return (0); bfe_writephy(sc, reg, val); return (0); Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/bge/if_bge.c Sun Nov 7 11:12:30 2010 (r214910) @@ -782,10 +782,6 @@ bge_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); - /* Prevent the probe from finding incorrect devices. */ - if (phy != sc->bge_phy_addr) - return (0); - /* Clear the autopoll bit if set, otherwise may trigger PCI errors. */ if ((sc->bge_mi_mode & BGE_MIMODE_AUTOPOLL) != 0) { CSR_WRITE_4(sc, BGE_MI_MODE, @@ -2572,7 +2568,7 @@ bge_attach(device_t dev) struct bge_softc *sc; uint32_t hwcfg = 0, misccfg; u_char eaddr[ETHER_ADDR_LEN]; - int error, msicount, reg, rid, trys; + int error, msicount, phy_addr, reg, rid, trys; sc = device_get_softc(dev); sc->bge_dev = dev; @@ -2605,7 +2601,7 @@ bge_attach(device_t dev) sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); /* Set default PHY address. */ - sc->bge_phy_addr = 1; + phy_addr = 1; /* * Don't enable Ethernet@WireSpeed for the 5700, 5906, or the @@ -2972,17 +2968,17 @@ bge_attach(device_t dev) again: bge_asf_driver_up(sc); - if (mii_phy_probe(dev, &sc->bge_miibus, - bge_ifmedia_upd, bge_ifmedia_sts)) { + error = (mii_attach(dev, &sc->bge_miibus, ifp, + bge_ifmedia_upd, bge_ifmedia_sts, BMSR_DEFCAPMASK, + phy_addr, MII_OFFSET_ANY, 0)); + if (error != 0) { if (trys++ < 4) { device_printf(sc->bge_dev, "Try again\n"); bge_miibus_writereg(sc->bge_dev, 1, MII_BMCR, BMCR_RESET); goto again; } - - device_printf(sc->bge_dev, "MII without any PHY!\n"); - error = ENXIO; + device_printf(sc->bge_dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/bge/if_bgereg.h Sun Nov 7 11:12:30 2010 (r214910) @@ -2762,7 +2762,6 @@ struct bge_softc { uint32_t bge_tx_buf_ratio; uint32_t bge_mi_mode; int bge_if_flags; - int bge_phy_addr; int bge_txcnt; int bge_link; /* link state */ int bge_link_evt; /* pending link event */ Modified: stable/7/sys/dev/bm/if_bm.c ============================================================================== --- stable/7/sys/dev/bm/if_bm.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/bm/if_bm.c Sun Nov 7 11:12:30 2010 (r214910) @@ -594,11 +594,19 @@ bm_attach(device_t dev) /* reset the adapter */ bm_chip_setup(sc); - /* setup MII */ - error = mii_phy_probe(dev, &sc->sc_miibus, bm_ifmedia_upd, - bm_ifmedia_sts); - if (error != 0) - device_printf(dev,"PHY probe failed: %d\n", error); + /* + * Setup MII + * On Apple BMAC controllers, we end up in a weird state of + * partially-completed autonegotiation on boot. So we force + * autonegotation to try again. + */ + error = mii_attach(dev, &sc->sc_miibus, ifp, bm_ifmedia_upd, + bm_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + MIIF_FORCEANEG); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); + return (error); + } sc->sc_mii = device_get_softc(sc->sc_miibus); Modified: stable/7/sys/dev/cas/if_cas.c ============================================================================== --- stable/7/sys/dev/cas/if_cas.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/cas/if_cas.c Sun Nov 7 11:12:30 2010 (r214910) @@ -344,13 +344,9 @@ cas_attach(struct cas_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } - switch (sc->sc_variant) { - default: - sc->sc_phyad = -1; - break; - } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - cas_mediachange, cas_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, + MII_PHY_ANY, MII_OFFSET_ANY, 0); } /* * Fall back on an internal PHY if no external PHY was found. @@ -368,13 +364,9 @@ cas_attach(struct cas_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); } - switch (sc->sc_variant) { - default: - sc->sc_phyad = -1; - break; - } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - cas_mediachange, cas_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, + MII_PHY_ANY, MII_OFFSET_ANY, 0); } } else { /* @@ -394,12 +386,12 @@ cas_attach(struct cas_softc *sc) CAS_WRITE_4(sc, CAS_PCS_CONF, CAS_PCS_CONF_EN); CAS_BARRIER(sc, CAS_PCS_CONF, 4, BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); - sc->sc_phyad = CAS_PHYAD_EXTERNAL; - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - cas_mediachange, cas_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, + CAS_PHYAD_EXTERNAL, MII_OFFSET_ANY, 0); } if (error != 0) { - device_printf(sc->sc_dev, "PHY probe failed: %d\n", error); + device_printf(sc->sc_dev, "attaching PHYs failed\n"); goto fail_rxmap; } sc->sc_mii = device_get_softc(sc->sc_miibus); @@ -2172,9 +2164,6 @@ cas_mii_readreg(device_t dev, int phy, i #endif sc = device_get_softc(dev); - if (sc->sc_phyad != -1 && phy != sc->sc_phyad) - return (0); - if ((sc->sc_flags & CAS_SERDES) != 0) { switch (reg) { case MII_BMCR: @@ -2233,9 +2222,6 @@ cas_mii_writereg(device_t dev, int phy, #endif sc = device_get_softc(dev); - if (sc->sc_phyad != -1 && phy != sc->sc_phyad) - return (0); - if ((sc->sc_flags & CAS_SERDES) != 0) { switch (reg) { case MII_BMSR: @@ -2318,8 +2304,7 @@ cas_mii_statchg(device_t dev) #ifdef CAS_DEBUG if ((ifp->if_flags & IFF_DEBUG) != 0) - device_printf(sc->sc_dev, "%s: status change: PHY = %d\n", - __func__, sc->sc_phyad); + device_printf(sc->sc_dev, "%s: status changen", __func__); #endif if ((sc->sc_mii->mii_media_status & IFM_ACTIVE) != 0 && Modified: stable/7/sys/dev/cas/if_casvar.h ============================================================================== --- stable/7/sys/dev/cas/if_casvar.h Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/cas/if_casvar.h Sun Nov 7 11:12:30 2010 (r214910) @@ -154,8 +154,6 @@ struct cas_softc { bus_dma_tag_t sc_cdmatag; /* control data bus DMA tag */ bus_dmamap_t sc_dmamap; /* bus DMA handle */ - u_int sc_phyad; /* PHY to use or -1 for any */ - u_int sc_variant; #define CAS_UNKNOWN 0 /* don't know */ #define CAS_CAS 1 /* Sun Cassini */ Modified: stable/7/sys/dev/dc/if_dc.c ============================================================================== --- stable/7/sys/dev/dc/if_dc.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/dc/if_dc.c Sun Nov 7 11:12:30 2010 (r214910) @@ -779,26 +779,6 @@ dc_miibus_readreg(device_t dev, int phy, sc = device_get_softc(dev); bzero(&frame, sizeof(frame)); - /* - * Note: both the AL981 and AN983 have internal PHYs, - * however the AL981 provides direct access to the PHY - * registers while the AN983 uses a serial MII interface. - * The AN983's MII interface is also buggy in that you - * can read from any MII address (0 to 31), but only address 1 - * behaves normally. To deal with both cases, we pretend - * that the PHY is at MII address 1. - */ - if (DC_IS_ADMTEK(sc) && phy != DC_ADMTEK_PHYADDR) - return (0); - - /* - * Note: the ukphy probes of the RS7112 report a PHY at - * MII address 0 (possibly HomePNA?) and 1 (ethernet) - * so we only respond to correct one. - */ - if (DC_IS_CONEXANT(sc) && phy != DC_CONEXANT_PHYADDR) - return (0); - if (sc->dc_pmode != DC_PMODE_MII) { if (phy == (MII_NPHY - 1)) { switch (reg) { @@ -901,12 +881,6 @@ dc_miibus_writereg(device_t dev, int phy sc = device_get_softc(dev); bzero(&frame, sizeof(frame)); - if (DC_IS_ADMTEK(sc) && phy != DC_ADMTEK_PHYADDR) - return (0); - - if (DC_IS_CONEXANT(sc) && phy != DC_CONEXANT_PHYADDR) - return (0); - if (DC_IS_PNIC(sc)) { CSR_WRITE_4(sc, DC_PN_MII, DC_PN_MIIOPCODE_WRITE | (phy << 23) | (reg << 10) | data); @@ -1815,14 +1789,12 @@ dc_dma_map_addr(void *arg, bus_dma_segme static int dc_attach(device_t dev) { - int tmp = 0; uint32_t eaddr[(ETHER_ADDR_LEN+3)/4]; u_int32_t command; struct dc_softc *sc; struct ifnet *ifp; u_int32_t reg, revision; - int error = 0, rid, mac_offset; - int i; + int error, i, mac_offset, phy, rid, tmp; u_int8_t *mac; sc = device_get_softc(dev); @@ -2203,6 +2175,7 @@ dc_attach(device_t dev) * old selection (SIA only or SIA/SYM) and attach the dcphy * driver instead. */ + tmp = 0; if (DC_IS_INTEL(sc)) { dc_apply_fixup(sc, IFM_AUTO); tmp = sc->dc_pmode; @@ -2211,7 +2184,7 @@ dc_attach(device_t dev) /* * Setup General Purpose port mode and data so the tulip can talk - * to the MII. This needs to be done before mii_phy_probe so that + * to the MII. This needs to be done before mii_attach so that * we can actually see them. */ if (DC_IS_XIRCOM(sc)) { @@ -2223,16 +2196,37 @@ dc_attach(device_t dev) DELAY(10); } - error = mii_phy_probe(dev, &sc->dc_miibus, - dc_ifmedia_upd, dc_ifmedia_sts); + phy = MII_PHY_ANY; + /* + * Note: both the AL981 and AN983 have internal PHYs, however the + * AL981 provides direct access to the PHY registers while the AN983 + * uses a serial MII interface. The AN983's MII interface is also + * buggy in that you can read from any MII address (0 to 31), but + * only address 1 behaves normally. To deal with both cases, we + * pretend that the PHY is at MII address 1. + */ + if (DC_IS_ADMTEK(sc)) + phy = DC_ADMTEK_PHYADDR; + + /* + * Note: the ukphy probes of the RS7112 report a PHY at MII address + * 0 (possibly HomePNA?) and 1 (ethernet) so we only respond to the + * correct one. + */ + if (DC_IS_CONEXANT(sc)) + phy = DC_CONEXANT_PHYADDR; + + error = mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd, + dc_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); if (error && DC_IS_INTEL(sc)) { sc->dc_pmode = tmp; if (sc->dc_pmode != DC_PMODE_SIA) sc->dc_pmode = DC_PMODE_SYM; sc->dc_flags |= DC_21143_NWAY; - mii_phy_probe(dev, &sc->dc_miibus, - dc_ifmedia_upd, dc_ifmedia_sts); + mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd, + dc_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); /* * For non-MII cards, we need to have the 21143 * drive the LEDs. Except there are some systems @@ -2247,7 +2241,7 @@ dc_attach(device_t dev) } if (error) { - device_printf(dev, "MII without any PHY!\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/dc/pnphy.c ============================================================================== --- stable/7/sys/dev/dc/pnphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/dc/pnphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -132,6 +132,7 @@ pnphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = pnphy_service; @@ -169,8 +170,6 @@ pnphy_service(struct mii_softc *sc, stru if ((mii->mii_ifp->if_flags & IFF_UP) == 0) break; - sc->mii_flags = 0; - switch (IFM_SUBTYPE(ife->ifm_media)) { case IFM_AUTO: /* NWAY is busted on this chip */ Modified: stable/7/sys/dev/fxp/if_fxp.c ============================================================================== --- stable/7/sys/dev/fxp/if_fxp.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/fxp/if_fxp.c Sun Nov 7 11:12:30 2010 (r214910) @@ -805,10 +805,14 @@ fxp_attach(device_t dev) ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL); ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_MANUAL); } else { - if (mii_phy_probe(dev, &sc->miibus, fxp_ifmedia_upd, - fxp_ifmedia_sts)) { - device_printf(dev, "MII without any PHY!\n"); - error = ENXIO; + /* + * i82557 wedge when isolating all of their PHYs. + */ + error = mii_attach(dev, &sc->miibus, ifp, fxp_ifmedia_upd, + fxp_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, MIIF_NOISOLATE); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } } Modified: stable/7/sys/dev/gem/if_gem.c ============================================================================== --- stable/7/sys/dev/gem/if_gem.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/gem/if_gem.c Sun Nov 7 11:12:30 2010 (r214910) @@ -149,7 +149,7 @@ gem_attach(struct gem_softc *sc) { struct gem_txsoft *txs; struct ifnet *ifp; - int error, i; + int error, i, phy; uint32_t v; if (bootverbose) @@ -294,14 +294,15 @@ gem_attach(struct gem_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); switch (sc->sc_variant) { case GEM_SUN_ERI: - sc->sc_phyad = GEM_PHYAD_EXTERNAL; + phy = GEM_PHYAD_EXTERNAL; break; default: - sc->sc_phyad = -1; + phy = MII_PHY_ANY; break; } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - gem_mediachange, gem_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, phy, + MII_OFFSET_ANY, 0); } /* @@ -318,17 +319,18 @@ gem_attach(struct gem_softc *sc) switch (sc->sc_variant) { case GEM_SUN_ERI: case GEM_APPLE_K2_GMAC: - sc->sc_phyad = GEM_PHYAD_INTERNAL; + phy = GEM_PHYAD_INTERNAL; break; case GEM_APPLE_GMAC: - sc->sc_phyad = GEM_PHYAD_EXTERNAL; + phy = GEM_PHYAD_EXTERNAL; break; default: - sc->sc_phyad = -1; + phy = MII_PHY_ANY; break; } - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - gem_mediachange, gem_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, phy, + MII_OFFSET_ANY, 0); } /* @@ -348,12 +350,12 @@ gem_attach(struct gem_softc *sc) GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); sc->sc_flags |= GEM_SERDES; - sc->sc_phyad = GEM_PHYAD_EXTERNAL; - error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, - gem_mediachange, gem_mediastatus); + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, + gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, + GEM_PHYAD_EXTERNAL, MII_OFFSET_ANY, 0); } if (error != 0) { - device_printf(sc->sc_dev, "PHY probe failed: %d\n", error); + device_printf(sc->sc_dev, "attaching PHYs failed\n"); goto fail_rxd; } sc->sc_mii = device_get_softc(sc->sc_miibus); @@ -1848,9 +1850,6 @@ gem_mii_readreg(device_t dev, int phy, i #endif sc = device_get_softc(dev); - if (sc->sc_phyad != -1 && phy != sc->sc_phyad) - return (0); - if ((sc->sc_flags & GEM_SERDES) != 0) { switch (reg) { case MII_BMCR: @@ -1909,9 +1908,6 @@ gem_mii_writereg(device_t dev, int phy, #endif sc = device_get_softc(dev); - if (sc->sc_phyad != -1 && phy != sc->sc_phyad) - return (0); - if ((sc->sc_flags & GEM_SERDES) != 0) { switch (reg) { case MII_BMSR: @@ -1992,8 +1988,7 @@ gem_mii_statchg(device_t dev) #ifdef GEM_DEBUG if ((sc->sc_ifp->if_flags & IFF_DEBUG) != 0) - device_printf(sc->sc_dev, "%s: status change: PHY = %d\n", - __func__, sc->sc_phyad); + device_printf(sc->sc_dev, "%s: status change\n", __func__); #endif if ((sc->sc_mii->mii_media_status & IFM_ACTIVE) != 0 && Modified: stable/7/sys/dev/gem/if_gemvar.h ============================================================================== --- stable/7/sys/dev/gem/if_gemvar.h Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/gem/if_gemvar.h Sun Nov 7 11:12:30 2010 (r214910) @@ -126,8 +126,6 @@ struct gem_softc { bus_dma_tag_t sc_cdmatag; /* control data bus DMA tag */ bus_dmamap_t sc_dmamap; /* bus DMA handle */ - int sc_phyad; /* PHY to use or -1 for any */ - u_int sc_variant; #define GEM_UNKNOWN 0 /* don't know */ #define GEM_SUN_GEM 1 /* Sun GEM */ Modified: stable/7/sys/dev/hme/if_hme.c ============================================================================== --- stable/7/sys/dev/hme/if_hme.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/hme/if_hme.c Sun Nov 7 11:12:30 2010 (r214910) @@ -315,9 +315,20 @@ hme_config(struct hme_softc *sc) hme_mifinit(sc); - if ((error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, hme_mediachange, - hme_mediastatus)) != 0) { - device_printf(sc->sc_dev, "phy probe failed: %d\n", error); + /* + * DP83840A used with HME chips don't advertise their media + * capabilities themselves properly so force writing the ANAR + * according to the BMSR in mii_phy_setmedia(). + */ + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, hme_mediachange, + hme_mediastatus, BMSR_DEFCAPMASK, HME_PHYAD_EXTERNAL, + MII_OFFSET_ANY, MIIF_FORCEANEG); + i = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, hme_mediachange, + hme_mediastatus, BMSR_DEFCAPMASK, HME_PHYAD_INTERNAL, + MII_OFFSET_ANY, MIIF_FORCEANEG); + if (error != 0 && i != 0) { + error = ENXIO; + device_printf(sc->sc_dev, "attaching PHYs failed\n"); goto fail_rxdesc; } sc->sc_mii = device_get_softc(sc->sc_miibus); @@ -1404,10 +1415,6 @@ hme_mii_readreg(device_t dev, int phy, i int n; u_int32_t v; - /* We can at most have two PHYs. */ - if (phy != HME_PHYAD_EXTERNAL && phy != HME_PHYAD_INTERNAL) - return (0); - sc = device_get_softc(dev); /* Select the desired PHY in the MIF configuration register */ v = HME_MIF_READ_4(sc, HME_MIFI_CFG); @@ -1445,10 +1452,6 @@ hme_mii_writereg(device_t dev, int phy, int n; u_int32_t v; - /* We can at most have two PHYs. */ - if (phy != HME_PHYAD_EXTERNAL && phy != HME_PHYAD_INTERNAL) - return (0); - sc = device_get_softc(dev); /* Select the desired PHY in the MIF configuration register */ v = HME_MIF_READ_4(sc, HME_MIFI_CFG); Modified: stable/7/sys/dev/jme/if_jme.c ============================================================================== --- stable/7/sys/dev/jme/if_jme.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/jme/if_jme.c Sun Nov 7 11:12:30 2010 (r214910) @@ -224,13 +224,8 @@ jme_miibus_readreg(device_t dev, int phy sc = device_get_softc(dev); /* For FPGA version, PHY address 0 should be ignored. */ - if ((sc->jme_flags & JME_FLAG_FPGA) != 0) { - if (phy == 0) - return (0); - } else { - if (sc->jme_phyaddr != phy) - return (0); - } + if ((sc->jme_flags & JME_FLAG_FPGA) != 0 && phy == 0) + return (0); CSR_WRITE_4(sc, JME_SMI, SMI_OP_READ | SMI_OP_EXECUTE | SMI_PHY_ADDR(phy) | SMI_REG_ADDR(reg)); @@ -260,13 +255,8 @@ jme_miibus_writereg(device_t dev, int ph sc = device_get_softc(dev); /* For FPGA version, PHY address 0 should be ignored. */ - if ((sc->jme_flags & JME_FLAG_FPGA) != 0) { - if (phy == 0) - return (0); - } else { - if (sc->jme_phyaddr != phy) - return (0); - } + if ((sc->jme_flags & JME_FLAG_FPGA) != 0 && phy == 0) + return (0); CSR_WRITE_4(sc, JME_SMI, SMI_OP_WRITE | SMI_OP_EXECUTE | ((val << SMI_DATA_SHIFT) & SMI_DATA_MASK) | @@ -751,9 +741,11 @@ jme_attach(device_t dev) ifp->if_capenable = ifp->if_capabilities; /* Set up MII bus. */ - if ((error = mii_phy_probe(dev, &sc->jme_miibus, jme_mediachange, - jme_mediastatus)) != 0) { - device_printf(dev, "no PHY found!\n"); + error = mii_attach(dev, &sc->jme_miibus, ifp, jme_mediachange, + jme_mediastatus, BMSR_DEFCAPMASK, sc->jme_phyaddr, MII_OFFSET_ANY, + 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/mii/acphy.c ============================================================================== --- stable/7/sys/dev/mii/acphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/acphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -132,6 +132,7 @@ acphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = acphy_service; Modified: stable/7/sys/dev/mii/amphy.c ============================================================================== --- stable/7/sys/dev/mii/amphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/amphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -109,6 +109,7 @@ amphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = amphy_service; Modified: stable/7/sys/dev/mii/atphy.c ============================================================================== --- stable/7/sys/dev/mii/atphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/atphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -113,6 +113,7 @@ atphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = atphy_service; Modified: stable/7/sys/dev/mii/bmtphy.c ============================================================================== --- stable/7/sys/dev/mii/bmtphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/bmtphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -147,6 +147,7 @@ bmtphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = bmtphy_service; Modified: stable/7/sys/dev/mii/brgphy.c ============================================================================== --- stable/7/sys/dev/mii/brgphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/brgphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -191,6 +191,7 @@ brgphy_attach(device_t dev) LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); /* Initialize mii_softc structure */ + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = brgphy_service; Modified: stable/7/sys/dev/mii/ciphy.c ============================================================================== --- stable/7/sys/dev/mii/ciphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/ciphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -57,9 +57,7 @@ __FBSDID("$FreeBSD$"); #include "miibus_if.h" #include -/* -#include -*/ + static int ciphy_probe(device_t); static int ciphy_attach(device_t); @@ -118,6 +116,7 @@ ciphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = ciphy_service; Modified: stable/7/sys/dev/mii/e1000phy.c ============================================================================== --- stable/7/sys/dev/mii/e1000phy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/e1000phy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -59,9 +59,6 @@ __FBSDID("$FreeBSD$"); #include "miidevs.h" #include -/* XXX */ -#include -#include #include "miibus_if.h" @@ -71,7 +68,6 @@ static int e1000phy_attach(device_t); struct e1000phy_softc { struct mii_softc mii_sc; int mii_model; - struct msk_mii_data *mmd; }; static device_method_t e1000phy_methods[] = { @@ -144,6 +140,7 @@ e1000phy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = e1000phy_service; @@ -151,14 +148,9 @@ e1000phy_attach(device_t dev) esc->mii_model = MII_MODEL(ma->mii_id2); ifp = sc->mii_pdata->mii_ifp; - if (strcmp(ifp->if_dname, "msk") == 0) { - /* XXX */ - esc->mmd = device_get_ivars( - device_get_parent(device_get_parent(dev))); - if (esc->mmd != NULL && - (esc->mmd->mii_flags & MIIF_HAVEFIBER) != 0) - sc->mii_flags |= MIIF_HAVEFIBER; - } + if (strcmp(ifp->if_dname, "msk") == 0 && + (sc->mii_flags & MIIF_MACPRIV0) != 0) + sc->mii_flags |= MIIF_PHYPRIV0; switch (esc->mii_model) { case MII_MODEL_MARVELL_E1011: @@ -214,7 +206,7 @@ e1000phy_reset(struct mii_softc *sc) reg &= ~E1000_SCR_MODE_MASK; reg |= E1000_SCR_MODE_1000BX; PHY_WRITE(sc, E1000_SCR, reg); - if (esc->mmd != NULL && esc->mmd->pmd == 'P') { + if ((sc->mii_flags & MIIF_MACPRIV0) != 0) { /* Set SIGDET polarity low for SFP module. */ PHY_WRITE(sc, E1000_EADR, 1); reg = PHY_READ(sc, E1000_SCR); Modified: stable/7/sys/dev/mii/exphy.c ============================================================================== --- stable/7/sys/dev/mii/exphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/exphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -138,6 +138,7 @@ exphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = exphy_service; Modified: stable/7/sys/dev/mii/gentbi.c ============================================================================== --- stable/7/sys/dev/mii/gentbi.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/gentbi.c Sun Nov 7 11:12:30 2010 (r214910) @@ -166,6 +166,7 @@ gentbi_attach(device_t dev) MII_OUI(ma->mii_id1, ma->mii_id2), MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2)); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = gentbi_service; Modified: stable/7/sys/dev/mii/icsphy.c ============================================================================== --- stable/7/sys/dev/mii/icsphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/icsphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -141,6 +141,7 @@ icsphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = icsphy_service; Modified: stable/7/sys/dev/mii/inphy.c ============================================================================== --- stable/7/sys/dev/mii/inphy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/inphy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -107,6 +107,7 @@ inphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = inphy_service; Modified: stable/7/sys/dev/mii/ip1000phy.c ============================================================================== --- stable/7/sys/dev/mii/ip1000phy.c Sun Nov 7 11:12:29 2010 (r214909) +++ stable/7/sys/dev/mii/ip1000phy.c Sun Nov 7 11:12:30 2010 (r214910) @@ -114,6 +114,7 @@ ip1000phy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = ip1000phy_service; @@ -123,6 +124,10 @@ ip1000phy_attach(device_t dev) isc->model = MII_MODEL(ma->mii_id2); isc->revision = MII_REV(ma->mii_id2); + if (isc->model == MII_MODEL_ICPLUS_IP1000A && + strcmp(mii->mii_ifp->if_dname, "stge") == 0 && + (sc->mii_flags & MIIF_MACPRIV0) != 0) + sc->mii_flags |= MIIF_PHYPRIV0; sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; if (sc->mii_capabilities & BMSR_EXTSTAT) @@ -412,12 +417,8 @@ ip1000phy_load_dspcode(struct mii_softc static void ip1000phy_reset(struct mii_softc *sc) { - struct ip1000phy_softc *isc; - struct stge_softc *stge_sc; - struct mii_data *mii; uint32_t reg; - isc = (struct ip1000phy_softc *)sc; mii_phy_reset(sc); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 7 17:38:54 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7C901065670; Sun, 7 Nov 2010 17:38:54 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A272E8FC17; Sun, 7 Nov 2010 17:38:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Hcsfr065600; Sun, 7 Nov 2010 17:38:54 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Hcsw3065580; Sun, 7 Nov 2010 17:38:54 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071738.oA7Hcsw3065580@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:38:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214925 - in stable/7/sys: arm/at91 dev/bce dev/ed dev/et dev/lge dev/nfe dev/nge dev/nve dev/sf dev/sge dev/sis dev/tx dev/usb pci X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:38:54 -0000 Author: marius Date: Sun Nov 7 17:38:54 2010 New Revision: 214925 URL: http://svn.freebsd.org/changeset/base/214925 Log: MFC: r213894, r213896, r214913 Converted the remainder of the NIC drivers to use the mii_attach() introduced in r213878 (MFC'ed to stable/7 in r214685) instead of mii_phy_probe(). Unlike r213893 (MFC'ed to stable/7 in r214910) these are mostly straight forward conversions though. Modified: stable/7/sys/arm/at91/if_ate.c stable/7/sys/dev/bce/if_bce.c stable/7/sys/dev/ed/if_ed_pccard.c stable/7/sys/dev/et/if_et.c stable/7/sys/dev/lge/if_lge.c stable/7/sys/dev/nfe/if_nfe.c stable/7/sys/dev/nge/if_nge.c stable/7/sys/dev/nve/if_nve.c stable/7/sys/dev/sf/if_sf.c stable/7/sys/dev/sge/if_sge.c stable/7/sys/dev/sis/if_sis.c stable/7/sys/dev/tx/if_tx.c stable/7/sys/dev/usb/if_aue.c stable/7/sys/dev/usb/if_axe.c stable/7/sys/dev/usb/if_rue.c stable/7/sys/dev/usb/if_udav.c stable/7/sys/pci/if_tl.c stable/7/sys/pci/if_wb.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/arm/at91/if_ate.c ============================================================================== --- stable/7/sys/arm/at91/if_ate.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/arm/at91/if_ate.c Sun Nov 7 17:38:54 2010 (r214925) @@ -215,9 +215,10 @@ ate_attach(device_t dev) ate_set_mac(sc, eaddr); sc->ifp = ifp = if_alloc(IFT_ETHER); - if (mii_phy_probe(dev, &sc->miibus, ate_ifmedia_upd, ate_ifmedia_sts)) { - device_printf(dev, "Cannot find my PHY.\n"); - err = ENXIO; + err = mii_attach(dev, &sc->miibus, ifp, ate_ifmedia_upd, + ate_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (err != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto out; } Modified: stable/7/sys/dev/bce/if_bce.c ============================================================================== --- stable/7/sys/dev/bce/if_bce.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/bce/if_bce.c Sun Nov 7 17:38:54 2010 (r214925) @@ -1134,12 +1134,13 @@ bce_attach(device_t dev) /* Handle any special PHY initialization for SerDes PHYs. */ bce_init_media(sc); - /* MII child bus by probing the PHY. */ - if (mii_phy_probe(dev, &sc->bce_miibus, bce_ifmedia_upd, - bce_ifmedia_sts)) { - BCE_PRINTF("%s(%d): No PHY found on child MII bus!\n", - __FILE__, __LINE__); - rc = ENXIO; + /* MII child bus by attaching the PHY. */ + rc = mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_upd, + bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr, + MII_OFFSET_ANY, 0); + if (rc != 0) { + BCE_PRINTF("%s(%d): attaching PHYs failed\n", __FILE__, + __LINE__); goto bce_attach_fail; } Modified: stable/7/sys/dev/ed/if_ed_pccard.c ============================================================================== --- stable/7/sys/dev/ed/if_ed_pccard.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/ed/if_ed_pccard.c Sun Nov 7 17:38:54 2010 (r214925) @@ -540,23 +540,27 @@ ed_pccard_attach(device_t dev) goto bad; if (sc->chip_type == ED_CHIP_TYPE_DL10019 || sc->chip_type == ED_CHIP_TYPE_DL10022) { - /* Probe for an MII bus, but ignore errors. */ + /* Try to attach an MII bus, but ignore errors. */ ed_pccard_dl100xx_mii_reset(sc); - (void)mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd, - ed_ifmedia_sts); + (void)mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd, + ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); } else if (sc->chip_type == ED_CHIP_TYPE_AX88190) { ed_pccard_ax88x90_mii_reset(sc); - if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd, - ed_ifmedia_sts)) != 0) { - device_printf(dev, "Missing mii!\n"); + error = mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd, + ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto bad; } - } else if (sc->chip_type == ED_CHIP_TYPE_TC5299J) { ed_pccard_tc5299j_mii_reset(sc); - if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd, - ed_ifmedia_sts)) != 0) { - device_printf(dev, "Missing mii!\n"); + error = mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd, + ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, + MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto bad; } Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/et/if_et.c Sun Nov 7 17:38:54 2010 (r214925) @@ -63,8 +63,8 @@ __FBSDID("$FreeBSD$"); #include +#include #include -#include #include #include @@ -343,10 +343,10 @@ et_attach(device_t dev) et_chip_attach(sc); - error = mii_phy_probe(dev, &sc->sc_miibus, - et_ifmedia_upd, et_ifmedia_sts); + error = mii_attach(dev, &sc->sc_miibus, ifp, et_ifmedia_upd, + et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); if (error) { - device_printf(dev, "can't probe any PHY\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/lge/if_lge.c ============================================================================== --- stable/7/sys/dev/lge/if_lge.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/lge/if_lge.c Sun Nov 7 17:38:54 2010 (r214925) @@ -558,10 +558,10 @@ lge_attach(dev) /* * Do MII setup. */ - if (mii_phy_probe(dev, &sc->lge_miibus, - lge_ifmedia_upd, lge_ifmedia_sts)) { - device_printf(dev, "MII without any PHY!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->lge_miibus, ifp, lge_ifmedia_upd, + lge_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/nfe/if_nfe.c ============================================================================== --- stable/7/sys/dev/nfe/if_nfe.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/nfe/if_nfe.c Sun Nov 7 17:38:54 2010 (r214925) @@ -601,10 +601,10 @@ nfe_attach(device_t dev) #endif /* Do MII setup */ - if (mii_phy_probe(dev, &sc->nfe_miibus, nfe_ifmedia_upd, - nfe_ifmedia_sts)) { - device_printf(dev, "MII without any phy!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->nfe_miibus, ifp, nfe_ifmedia_upd, + nfe_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } ether_ifattach(ifp, sc->eaddr); Modified: stable/7/sys/dev/nge/if_nge.c ============================================================================== --- stable/7/sys/dev/nge/if_nge.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/nge/if_nge.c Sun Nov 7 17:38:54 2010 (r214925) @@ -1079,10 +1079,10 @@ nge_attach(device_t dev) /* * Do MII setup. */ - error = mii_phy_probe(dev, &sc->nge_miibus, nge_mediachange, - nge_mediastatus); + error = mii_attach(dev, &sc->nge_miibus, ifp, nge_mediachange, + nge_mediastatus, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); if (error != 0) { - device_printf(dev, "no PHY found!\n"); + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/nve/if_nve.c ============================================================================== --- stable/7/sys/dev/nve/if_nve.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/nve/if_nve.c Sun Nov 7 17:38:54 2010 (r214925) @@ -544,11 +544,12 @@ nve_attach(device_t dev) ifp->if_capabilities |= IFCAP_VLAN_MTU; ifp->if_capenable |= IFCAP_VLAN_MTU; - /* Probe device for MII interface to PHY */ - DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_phy_probe\n"); - if (mii_phy_probe(dev, &sc->miibus, nve_ifmedia_upd, nve_ifmedia_sts)) { - device_printf(dev, "MII without any phy!\n"); - error = ENXIO; + /* Attach device for MII interface to PHY */ + DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_attach\n"); + error = mii_attach(dev, &sc->miibus, ifp, nve_ifmedia_upd, + nve_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } @@ -556,10 +557,10 @@ nve_attach(device_t dev) ether_ifattach(ifp, eaddr); /* Activate our interrupt handler. - attach last to avoid lock */ - error = bus_setup_intr(sc->dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, + error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, NULL, nve_intr, sc, &sc->sc_ih); if (error) { - device_printf(sc->dev, "couldn't set up interrupt handler\n"); + device_printf(dev, "couldn't set up interrupt handler\n"); goto fail; } DEBUGOUT(NVE_DEBUG_INIT, "nve: nve_attach - exit\n"); Modified: stable/7/sys/dev/sf/if_sf.c ============================================================================== --- stable/7/sys/dev/sf/if_sf.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/sf/if_sf.c Sun Nov 7 17:38:54 2010 (r214925) @@ -866,10 +866,10 @@ sf_attach(device_t dev) } /* Do MII setup. */ - if (mii_phy_probe(dev, &sc->sf_miibus, sf_ifmedia_upd, - sf_ifmedia_sts)) { - device_printf(dev, "MII without any phy!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->sf_miibus, ifp, sf_ifmedia_upd, + sf_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/sge/if_sge.c ============================================================================== --- stable/7/sys/dev/sge/if_sge.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/sge/if_sge.c Sun Nov 7 17:38:54 2010 (r214925) @@ -627,10 +627,10 @@ sge_attach(device_t dev) /* * Do MII setup. */ - if (mii_phy_probe(dev, &sc->sge_miibus, sge_ifmedia_upd, - sge_ifmedia_sts)) { - device_printf(dev, "no PHY found!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->sge_miibus, ifp, sge_ifmedia_upd, + sge_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/sis/if_sis.c ============================================================================== --- stable/7/sys/dev/sis/if_sis.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/sis/if_sis.c Sun Nov 7 17:38:54 2010 (r214925) @@ -1164,10 +1164,10 @@ sis_attach(device_t dev) /* * Do MII setup. */ - if (mii_phy_probe(dev, &sc->sis_miibus, - sis_ifmedia_upd, sis_ifmedia_sts)) { - device_printf(dev, "MII without any PHY!\n"); - error = ENXIO; + error = mii_attach(dev, &sc->sis_miibus, ifp, sis_ifmedia_upd, + sis_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/tx/if_tx.c ============================================================================== --- stable/7/sys/dev/tx/if_tx.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/tx/if_tx.c Sun Nov 7 17:38:54 2010 (r214925) @@ -383,10 +383,10 @@ epic_attach(device_t dev) device_printf(dev, "unknown card vendor %04xh\n", sc->cardvend); /* Do ifmedia setup. */ - if (mii_phy_probe(dev, &sc->miibus, - epic_ifmedia_upd, epic_ifmedia_sts)) { - device_printf(dev, "ERROR! MII without any PHY!?\n"); - error = ENXIO; + error = mii_attach(dev, &sc->miibus, ifp, epic_ifmedia_upd, + epic_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } Modified: stable/7/sys/dev/usb/if_aue.c ============================================================================== --- stable/7/sys/dev/usb/if_aue.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/usb/if_aue.c Sun Nov 7 17:38:54 2010 (r214925) @@ -649,7 +649,7 @@ aue_attach(device_t self) usbd_status err; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - int i; + int error, i; sc->aue_dev = self; sc->aue_udev = uaa->device; @@ -741,15 +741,16 @@ aue_attach(device_t self) * end up getting the children deleted twice, which will crash * the system. */ - if (mii_phy_probe(self, &sc->aue_miibus, - aue_ifmedia_upd, aue_ifmedia_sts)) { - device_printf(self, "MII without any PHY!\n"); + error = mii_attach(self, &sc->aue_miibus, ifp, aue_ifmedia_upd, + aue_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(self, "attaching PHYs failed\n"); if_free(ifp); AUE_SXUNLOCK(sc); mtx_destroy(&sc->aue_mtx); sx_destroy(&sc->aue_sx); usb_ether_task_destroy(&sc->aue_taskqueue); - return ENXIO; + return error; } sc->aue_qdat.ifp = ifp; Modified: stable/7/sys/dev/usb/if_axe.c ============================================================================== --- stable/7/sys/dev/usb/if_axe.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/usb/if_axe.c Sun Nov 7 17:38:54 2010 (r214925) @@ -544,7 +544,7 @@ axe_attach(device_t self) struct ifnet *ifp; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - int i; + int error, i; sc->axe_udev = uaa->device; sc->axe_dev = self; @@ -657,15 +657,16 @@ device_printf(sc->axe_dev, "%s, bufsz %d ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN; IFQ_SET_READY(&ifp->if_snd); - if (mii_phy_probe(self, &sc->axe_miibus, - axe_ifmedia_upd, axe_ifmedia_sts)) { - device_printf(sc->axe_dev, "MII without any PHY!\n"); + error = mii_attach(self, &sc->axe_miibus, ifp, axe_ifmedia_upd, + axe_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(sc->axe_dev, "attaching PHYs failed\n"); if_free(ifp); AXE_UNLOCK(sc); AXE_SLEEPUNLOCK(sc); sx_destroy(&sc->axe_sleeplock); mtx_destroy(&sc->axe_mtx); - return ENXIO; + return error; } /* Modified: stable/7/sys/dev/usb/if_rue.c ============================================================================== --- stable/7/sys/dev/usb/if_rue.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/usb/if_rue.c Sun Nov 7 17:38:54 2010 (r214925) @@ -349,9 +349,6 @@ rue_miibus_readreg(device_t dev, int phy int rval; int ruereg; - if (phy != 0) /* RTL8150 supports PHY == 0, only */ - return (0); - switch (reg) { case MII_BMCR: ruereg = RUE_BMCR; @@ -392,9 +389,6 @@ rue_miibus_writereg(device_t dev, int ph struct rue_softc *sc = device_get_softc(dev); int ruereg; - if (phy != 0) /* RTL8150 supports PHY == 0, only */ - return (0); - switch (reg) { case MII_BMCR: ruereg = RUE_BMCR; @@ -584,13 +578,14 @@ rue_attach(device_t self) usbd_status err; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - int i; + int error, i; struct rue_type *t; sc->rue_dev = self; sc->rue_udev = uaa->device; if (usbd_set_config_no(sc->rue_udev, RUE_CONFIG_NO, 0)) { + error = ENXIO; device_printf(sc->rue_dev, "getting interface handle failed\n"); goto error; } @@ -599,6 +594,7 @@ rue_attach(device_t self) err = usbd_device2interface_handle(uaa->device, RUE_IFACE_IDX, &iface); if (err) { + error = ENXIO; device_printf(sc->rue_dev, "getting interface handle failed\n"); goto error; } @@ -621,6 +617,7 @@ rue_attach(device_t self) for (i = 0; i < id->bNumEndpoints; i++) { ed = usbd_interface2endpoint_descriptor(iface, i); if (ed == NULL) { + error = ENXIO; device_printf(sc->rue_dev, "couldn't get ep %d\n", i); goto error; } @@ -647,12 +644,14 @@ rue_attach(device_t self) err = rue_read_mem(sc, RUE_EEPROM_IDR0, (caddr_t)&eaddr, ETHER_ADDR_LEN); if (err) { + error = ENXIO; device_printf(sc->rue_dev, "couldn't get station address\n"); goto error1; } ifp = sc->rue_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { + error = ENXIO; device_printf(sc->rue_dev, "can not if_alloc()\n"); goto error1; } @@ -667,10 +666,14 @@ rue_attach(device_t self) ifp->if_init = rue_init; ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; - /* MII setup */ - if (mii_phy_probe(self, &sc->rue_miibus, - rue_ifmedia_upd, rue_ifmedia_sts)) { - device_printf(sc->rue_dev, "MII without any PHY!\n"); + /* + * MII setup + * RTL8150 supports PHY == 0 only + */ + error = mii_attach(self, &sc->rue_miibus, ifp, rue_ifmedia_upd, + rue_ifmedia_sts, BMSR_DEFCAPMASK, 0, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(sc->rue_dev, "attaching PHYs failed\n"); goto error2; } @@ -692,7 +695,7 @@ rue_attach(device_t self) RUE_UNLOCK(sc); mtx_destroy(&sc->rue_mtx); error: - return ENXIO; + return error; } static int Modified: stable/7/sys/dev/usb/if_udav.c ============================================================================== --- stable/7/sys/dev/usb/if_udav.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/dev/usb/if_udav.c Sun Nov 7 17:38:54 2010 (r214925) @@ -298,6 +298,9 @@ udav_attach(device_t self) struct mii_data *mii; #endif u_char eaddr[ETHER_ADDR_LEN]; +#if defined(__FreeBSD__) + int error; +#endif int i; #if defined(__NetBSD__) int s; @@ -444,13 +447,16 @@ udav_attach(device_t self) if_attach(ifp); Ether_ifattach(ifp, eaddr); #elif defined(__FreeBSD__) - if (mii_phy_probe(self, &sc->sc_miibus, - udav_ifmedia_change, udav_ifmedia_status)) { - printf("%s: MII without any PHY!\n", device_get_nameunit(sc->sc_dev)); + /* one internal PHY only */ + error = mii_attach(self, &sc->sc_miibus, ifp, udav_ifmedia_change, + udav_ifmedia_status, BMSR_DEFCAPMASK, 0, MII_OFFSET_ANY, 0); + if (error != 0) { + printf("%s: attaching PHYs failed\\n", + device_get_nameunit(sc->sc_dev)); if_free(ifp); UDAV_UNLOCK(sc); mtx_destroy(&sc->sc_mtx); - return ENXIO; + return error; } sc->sc_qdat.ifp = ifp; @@ -1822,13 +1828,6 @@ udav_miibus_readreg(device_t dev, int ph return (0); } - /* XXX: one PHY only for the internal PHY */ - if (phy != 0) { - DPRINTFN(0xff, ("%s: %s: phy=%d is not supported\n", - device_get_nameunit(sc->sc_dev), __func__, phy)); - return (0); - } - udav_lock_mii(sc); /* select internal PHY and set PHY register address */ @@ -1878,13 +1877,6 @@ udav_miibus_writereg(device_t dev, int p return (0); /* XXX real error? */ } - /* XXX: one PHY only for the internal PHY */ - if (phy != 0) { - DPRINTFN(0xff, ("%s: %s: phy=%d is not supported\n", - device_get_nameunit(sc->sc_dev), __func__, phy)); - return (0); /* XXX real error? */ - } - udav_lock_mii(sc); /* select internal PHY and set PHY register address */ Modified: stable/7/sys/pci/if_tl.c ============================================================================== --- stable/7/sys/pci/if_tl.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/pci/if_tl.c Sun Nov 7 17:38:54 2010 (r214925) @@ -1280,9 +1280,11 @@ tl_attach(dev) * Do MII setup. If no PHYs are found, then this is a * bitrate ThunderLAN chip that only supports 10baseT * and AUI/BNC. + * XXX mii_attach() can fail for reason different than + * no PHYs found! */ - if (mii_phy_probe(dev, &sc->tl_miibus, - tl_ifmedia_upd, tl_ifmedia_sts)) { + if (mii_attach(dev, &sc->tl_miibus, ifp, tl_ifmedia_upd, + tl_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)) { struct ifmedia *ifm; sc->tl_bitrate = 1; ifmedia_init(&sc->ifmedia, 0, tl_ifmedia_upd, tl_ifmedia_sts); Modified: stable/7/sys/pci/if_wb.c ============================================================================== --- stable/7/sys/pci/if_wb.c Sun Nov 7 17:35:42 2010 (r214924) +++ stable/7/sys/pci/if_wb.c Sun Nov 7 17:38:54 2010 (r214925) @@ -859,9 +859,10 @@ wb_attach(dev) /* * Do MII setup. */ - if (mii_phy_probe(dev, &sc->wb_miibus, - wb_ifmedia_upd, wb_ifmedia_sts)) { - error = ENXIO; + error = mii_attach(dev, &sc->wb_miibus, ifp, wb_ifmedia_upd, + wb_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + if (error != 0) { + device_printf(dev, "attaching PHYs failed\n"); goto fail; } From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 7 17:41:10 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29139106566B; Sun, 7 Nov 2010 17:41:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F0D8D8FC08; Sun, 7 Nov 2010 17:41:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Hf9Fc065874; Sun, 7 Nov 2010 17:41:09 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Hf93E065872; Sun, 7 Nov 2010 17:41:09 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071741.oA7Hf93E065872@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:41:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214927 - stable/7/sys/dev/mii X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:41:10 -0000 Author: marius Date: Sun Nov 7 17:41:09 2010 New Revision: 214927 URL: http://svn.freebsd.org/changeset/base/214927 Log: MFC: r214263 Take advantage of mii_phy_add_media()/mii_phy_setmedia(). Modified: stable/7/sys/dev/mii/pnaphy.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/mii/pnaphy.c ============================================================================== --- stable/7/sys/dev/mii/pnaphy.c Sun Nov 7 17:40:58 2010 (r214926) +++ stable/7/sys/dev/mii/pnaphy.c Sun Nov 7 17:41:09 2010 (r214927) @@ -102,7 +102,6 @@ pnaphy_attach(device_t dev) struct mii_softc *sc; struct mii_attach_args *ma; struct mii_data *mii; - const char *sep = ""; sc = device_get_softc(dev); ma = device_get_ivars(dev); @@ -116,29 +115,16 @@ pnaphy_attach(device_t dev) sc->mii_service = pnaphy_service; sc->mii_pdata = mii; - sc->mii_flags |= MIIF_NOISOLATE; - -#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) -#define PRINT(s) printf("%s%s", sep, s); sep = ", " + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_IS_HPNA; mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) - printf("no media present"); - else { - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_HPNA_1, 0, sc->mii_inst), 0); - PRINT("HomePNA"); - } - + mii_phy_add_media(sc); printf("\n"); -#undef ADD -#undef PRINT - MIIBUS_MEDIAINIT(sc->mii_dev); - return (0); } @@ -159,17 +145,11 @@ pnaphy_service(struct mii_softc *sc, str break; switch (IFM_SUBTYPE(ife->ifm_media)) { - case IFM_AUTO: - case IFM_10_T: - case IFM_100_TX: - case IFM_100_T4: - return (EINVAL); + case IFM_HPNA_1: + mii_phy_setmedia(sc); + break; default: - /* - * BMCR data is stored in the ifmedia entry. - */ - PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); + return (EINVAL); } break; @@ -182,7 +162,7 @@ pnaphy_service(struct mii_softc *sc, str /* Update the media status. */ ukphy_status(sc); if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T) - mii->mii_media_active = IFM_ETHER|IFM_HPNA_1; + mii->mii_media_active = IFM_ETHER | IFM_HPNA_1; /* Callback if something changed. */ mii_phy_update(sc, cmd); From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 7 17:48:13 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F9DB10656A4; Sun, 7 Nov 2010 17:48:13 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B8BA8FC19; Sun, 7 Nov 2010 17:48:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7HmBWG066625; Sun, 7 Nov 2010 17:48:11 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7HmBBX066620; Sun, 7 Nov 2010 17:48:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071748.oA7HmBBX066620@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:48:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214930 - in stable/7/sys: dev/mii pci X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:48:13 -0000 Author: marius Date: Sun Nov 7 17:48:11 2010 New Revision: 214930 URL: http://svn.freebsd.org/changeset/base/214930 Log: MFC: r214264 - Add IFM_10_2 and IFM_10_5 media via tlphy(4) only in case the respective interface also has such connectors. - In tl_attach() unify three different ways of obtaining the device and vendor IDs and remove the now obsolete tl_dinfo from tl_softc. - Given that tlphy(4) only handles the integrated PHYs of NICs driven by tl(4) make it only probe on the latter. - Switch mlphy(4) and tlphy(4) to use mii_phy_add_media()/mii_phy_setmedia(). - Simplify looking for the respective companion PHY in mlphy(4) and tlphy(4) by ignoring the native one by just comparing the device_t's directly rather than the device name. Modified: stable/7/sys/dev/mii/mlphy.c stable/7/sys/dev/mii/tlphy.c stable/7/sys/pci/if_tl.c stable/7/sys/pci/if_tlreg.h 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/mii/mlphy.c ============================================================================== --- stable/7/sys/dev/mii/mlphy.c Sun Nov 7 17:48:07 2010 (r214929) +++ stable/7/sys/dev/mii/mlphy.c Sun Nov 7 17:48:11 2010 (r214930) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); struct mlphy_softc { struct mii_softc ml_mii; + device_t ml_dev; int ml_state; int ml_linked; }; @@ -96,6 +97,7 @@ static driver_t mlphy_driver = { DRIVER_MODULE(mlphy, miibus, mlphy_driver, mlphy_devclass, 0, 0); +static struct mii_softc *mlphy_find_other(struct mlphy_softc *); static int mlphy_service(struct mii_softc *, struct mii_data *, int); static void mlphy_reset(struct mii_softc *); static void mlphy_status(struct mii_softc *); @@ -105,10 +107,8 @@ mlphy_probe(dev) device_t dev; { struct mii_attach_args *ma; - device_t parent; ma = device_get_ivars(dev); - parent = device_get_parent(device_get_parent(dev)); /* * Micro Linear PHY reports oui == 0 model == 0 @@ -122,7 +122,8 @@ mlphy_probe(dev) * encountered the 6692 on an Olicom card with a ThunderLAN * controller chip. */ - if (strcmp(device_get_name(parent), "tl") != 0) + if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))), + "tl") != 0) return (ENXIO); device_set_desc(dev, "Micro Linear 6692 media interface"); @@ -141,6 +142,7 @@ mlphy_attach(dev) msc = device_get_softc(dev); sc = &msc->ml_mii; + msc->ml_dev = dev; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); mii = ma->mii_data; @@ -155,14 +157,15 @@ mlphy_attach(dev) #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), - BMCR_LOOP|BMCR_S100); + MII_MEDIA_100_TX); mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + /* Let the companion PHY (if any) only handle the media we don't. */ ma->mii_capmask = ~sc->mii_capabilities; device_printf(dev, " "); - mii_add_media(sc); + mii_phy_add_media(sc); printf("\n"); #undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); @@ -170,20 +173,21 @@ mlphy_attach(dev) } static struct mii_softc * -mlphy_find_other(device_t mii) +mlphy_find_other(struct mlphy_softc *msc) { device_t *devlist; struct mii_softc *retval; int i, devs; retval = NULL; - if (device_get_children(mii, &devlist, &devs)) + if (device_get_children(msc->ml_mii.mii_dev, &devlist, &devs) != 0) return (NULL); - for (i = 0; i < devs; i++) - if (strcmp(device_get_name(devlist[i]), "mlphy")) { + for (i = 0; i < devs; i++) { + if (devlist[i] != msc->ml_dev) { retval = device_get_softc(devlist[i]); break; } + } free(devlist, M_TEMP); return (retval); } @@ -204,7 +208,7 @@ mlphy_service(xsc, mii, cmd) * See if there's another PHY on this bus with us. * If so, we may need it for 10Mbps modes. */ - other = mlphy_find_other(msc->ml_mii.mii_dev); + other = mlphy_find_other(msc); switch (cmd) { case MII_POLLSTAT: @@ -229,7 +233,7 @@ mlphy_service(xsc, mii, cmd) mii_phy_reset(other); PHY_WRITE(other, MII_BMCR, BMCR_ISO); } - (void) mii_phy_auto(sc); + (void)mii_phy_auto(sc); msc->ml_linked = 0; return (0); case IFM_10_T: @@ -246,8 +250,7 @@ mlphy_service(xsc, mii, cmd) mii_phy_reset(other); PHY_WRITE(other, MII_BMCR, ife->ifm_data); } - PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); + mii_phy_setmedia(sc); msc->ml_state = 0; break; case IFM_100_TX: @@ -262,17 +265,11 @@ mlphy_service(xsc, mii, cmd) mii_phy_reset(other); PHY_WRITE(other, MII_BMCR, BMCR_ISO); } - PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media)); - PHY_WRITE(sc, MII_BMCR, ife->ifm_data); + mii_phy_setmedia(sc); msc->ml_state = 0; break; - case IFM_100_T4: - /* - * XXX Not supported as a manual setting right now. - */ - return (EINVAL); default: - break; + return (EINVAL); } break; @@ -381,7 +378,7 @@ mlphy_status(sc) struct mii_softc *other = NULL; /* See if there's another PHY on the bus with us. */ - other = mlphy_find_other(msc->ml_mii.mii_dev); + other = mlphy_find_other(msc); if (other == NULL) return; Modified: stable/7/sys/dev/mii/tlphy.c ============================================================================== --- stable/7/sys/dev/mii/tlphy.c Sun Nov 7 17:48:07 2010 (r214929) +++ stable/7/sys/dev/mii/tlphy.c Sun Nov 7 17:48:11 2010 (r214930) @@ -124,6 +124,9 @@ static int tlphy_probe(device_t dev) { + if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))), + "tl") != 0) + return (ENXIO); return (mii_phy_dev_probe(dev, tlphys, BUS_PROBE_DEFAULT)); } @@ -150,11 +153,17 @@ tlphy_attach(device_t dev) sc->sc_mii.mii_service = tlphy_service; sc->sc_mii.mii_pdata = mii; + /* + * Note that if we're on a device that also supports 100baseTX, + * we are not going to want to use the built-in 10baseT port, + * since there will be another PHY on the MII wired up to the + * UTP connector. + */ capmask = BMSR_DEFCAPMASK; if (mii->mii_instance && device_get_children(sc->sc_mii.mii_dev, &devlist, &devs) == 0) { for (i = 0; i < devs; i++) { - if (strcmp(device_get_name(devlist[i]), "tlphy")) { + if (devlist[i] != dev) { other = device_get_softc(devlist[i]); capmask &= ~other->mii_capabilities; break; @@ -167,38 +176,36 @@ tlphy_attach(device_t dev) mii_phy_reset(&sc->sc_mii); - /* - * Note that if we're on a device that also supports 100baseTX, - * we are not going to want to use the built-in 10baseT port, - * since there will be another PHY on the MII wired up to the - * UTP connector. The parent indicates this to us by specifying - * the TLPHY_MEDIA_NO_10_T bit. - */ sc->sc_mii.mii_capabilities = PHY_READ(&sc->sc_mii, MII_BMSR) & capmask; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->sc_mii.mii_inst), - BMCR_ISO); - - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_LOOP, - sc->sc_mii.mii_inst), BMCR_LOOP); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_LOOP, sc->sc_mii.mii_inst), + MII_MEDIA_100_TX); #define PRINT(s) printf("%s%s", sep, s); sep = ", " - device_printf(dev, " "); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_2, 0, sc->sc_mii.mii_inst), 0); - PRINT("10base2/BNC"); - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, sc->sc_mii.mii_inst), 0); - PRINT("10base5/AUI"); - - if (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) { + if ((sc->sc_mii.mii_flags & (MIIF_MACPRIV0 | MIIF_MACPRIV1)) != 0 && + (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) != 0) + device_printf(dev, " "); + if ((sc->sc_mii.mii_flags & MIIF_MACPRIV0) != 0) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_2, 0, sc->sc_mii.mii_inst), + 0); + PRINT("10base2/BNC"); + } + if ((sc->sc_mii.mii_flags & MIIF_MACPRIV1) != 0) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, sc->sc_mii.mii_inst), + 0); + PRINT("10base5/AUI"); + } + if ((sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) != 0) { printf("%s", sep); - mii_add_media(&sc->sc_mii); + mii_phy_add_media(&sc->sc_mii); } - - printf("\n"); + if ((sc->sc_mii.mii_flags & (MIIF_MACPRIV0 | MIIF_MACPRIV1)) != 0 && + (sc->sc_mii.mii_capabilities & BMSR_MEDIAMASK) != 0) + printf("\n"); #undef ADD #undef PRINT MIIBUS_MEDIAINIT(sc->sc_mii.mii_dev); @@ -233,7 +240,7 @@ tlphy_service(struct mii_softc *self, st * an autonegotiation cycle, so there's no such * thing as "already in auto mode". */ - (void) tlphy_auto(sc); + (void)tlphy_auto(sc); break; case IFM_10_2: case IFM_10_5: @@ -244,9 +251,7 @@ tlphy_service(struct mii_softc *self, st default: PHY_WRITE(&sc->sc_mii, MII_TLPHY_CTRL, 0); DELAY(100000); - PHY_WRITE(&sc->sc_mii, MII_ANAR, - mii_anar(ife->ifm_media)); - PHY_WRITE(&sc->sc_mii, MII_BMCR, ife->ifm_data); + mii_phy_setmedia(&sc->sc_mii); } break; @@ -283,7 +288,7 @@ tlphy_service(struct mii_softc *self, st sc->sc_mii.mii_ticks = 0; mii_phy_reset(&sc->sc_mii); - tlphy_auto(sc); + (void)tlphy_auto(sc); return (0); } Modified: stable/7/sys/pci/if_tl.c ============================================================================== --- stable/7/sys/pci/if_tl.c Sun Nov 7 17:48:07 2010 (r214929) +++ stable/7/sys/pci/if_tl.c Sun Nov 7 17:48:11 2010 (r214930) @@ -1104,12 +1104,11 @@ static int tl_attach(dev) device_t dev; { - int i; u_int16_t did, vid; struct tl_type *t; struct ifnet *ifp; struct tl_softc *sc; - int unit, error = 0, rid; + int error, flags, i, rid, unit; u_char eaddr[6]; vid = pci_get_vendor(dev); @@ -1210,10 +1209,9 @@ tl_attach(dev) bzero(sc->tl_ldata, sizeof(struct tl_list_data)); - sc->tl_dinfo = t; - if (t->tl_vid == COMPAQ_VENDORID || t->tl_vid == TI_VENDORID) + if (vid == COMPAQ_VENDORID || vid == TI_VENDORID) sc->tl_eeaddr = TL_EEPROM_EADDR; - if (t->tl_vid == OLICOM_VENDORID) + if (vid == OLICOM_VENDORID) sc->tl_eeaddr = TL_EEPROM_EADDR_OC; /* Reset the adapter. */ @@ -1244,7 +1242,7 @@ tl_attach(dev) * word. To make things even more confusing, neither 00:00:28 * nor 00:00:24 appear in the IEEE OUI database. */ - if (sc->tl_dinfo->tl_vid == OLICOM_VENDORID) { + if (vid == OLICOM_VENDORID) { for (i = 0; i < ETHER_ADDR_LEN; i += 2) { u_int16_t *p; p = (u_int16_t *)&eaddr[i]; @@ -1283,6 +1281,20 @@ tl_attach(dev) * XXX mii_attach() can fail for reason different than * no PHYs found! */ + flags = 0; + if (vid == COMPAQ_VENDORID) { + if (did == COMPAQ_DEVICEID_NETEL_10_100_PROLIANT || + did == COMPAQ_DEVICEID_NETFLEX_3P_INTEGRATED || + did == COMPAQ_DEVICEID_NETFLEX_3P_BNC || + did == COMPAQ_DEVICEID_NETEL_10_T2_UTP_COAX) + flags |= MIIF_MACPRIV0; + if (did == COMPAQ_DEVICEID_NETEL_10 || + did == COMPAQ_DEVICEID_NETEL_10_100_DUAL || + did == COMPAQ_DEVICEID_NETFLEX_3P || + did == COMPAQ_DEVICEID_NETEL_10_100_EMBEDDED) + flags |= MIIF_MACPRIV1; + } else if (vid == OLICOM_VENDORID && did == OLICOM_DEVICEID_OC2183) + flags |= MIIF_MACPRIV0 | MIIF_MACPRIV1; if (mii_attach(dev, &sc->tl_miibus, ifp, tl_ifmedia_upd, tl_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)) { struct ifmedia *ifm; Modified: stable/7/sys/pci/if_tlreg.h ============================================================================== --- stable/7/sys/pci/if_tlreg.h Sun Nov 7 17:48:07 2010 (r214929) +++ stable/7/sys/pci/if_tlreg.h Sun Nov 7 17:48:11 2010 (r214930) @@ -118,7 +118,6 @@ struct tl_softc { struct resource *tl_irq; struct resource *tl_res; device_t tl_miibus; - struct tl_type *tl_dinfo; /* ThunderLAN adapter info */ u_int8_t tl_eeaddr; struct tl_list_data *tl_ldata; /* TX/RX lists and mbufs */ struct tl_chain_data tl_cdata; From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 7 17:50:56 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47A49106577F; Sun, 7 Nov 2010 17:50:56 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 340D98FC1C; Sun, 7 Nov 2010 17:50:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7HouSo066977; Sun, 7 Nov 2010 17:50:56 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7Houk6066975; Sun, 7 Nov 2010 17:50:56 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071750.oA7Houk6066975@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:50:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214932 - stable/7/sys/sparc64/sparc64 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:50:56 -0000 Author: marius Date: Sun Nov 7 17:50:55 2010 New Revision: 214932 URL: http://svn.freebsd.org/changeset/base/214932 Log: MFC: r214528 - When resetting pm_active and pm_context of a pmap in pmap_pinit() we need locking as otherwise we may race against the other parts of the MD code which expects a consistent state of these. While at it move the resetting of the pmap before entering it in the TSB. - Spell a 0 as TLB_CTX_KERNEL. Modified: stable/7/sys/sparc64/sparc64/pmap.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/sparc64/sparc64/pmap.c ============================================================================== --- stable/7/sys/sparc64/sparc64/pmap.c Sun Nov 7 17:50:54 2010 (r214931) +++ stable/7/sys/sparc64/sparc64/pmap.c Sun Nov 7 17:50:55 2010 (r214932) @@ -1056,7 +1056,7 @@ pmap_pinit0(pmap_t pm) PMAP_LOCK_INIT(pm); for (i = 0; i < MAXCPU; i++) - pm->pm_context[i] = 0; + pm->pm_context[i] = TLB_CTX_KERNEL; pm->pm_active = 0; pm->pm_tsb = NULL; pm->pm_tsb_obj = NULL; @@ -1094,6 +1094,12 @@ pmap_pinit(pmap_t pm) if (pm->pm_tsb_obj == NULL) pm->pm_tsb_obj = vm_object_allocate(OBJT_DEFAULT, TSB_PAGES); + mtx_lock_spin(&sched_lock); + for (i = 0; i < MAXCPU; i++) + pm->pm_context[i] = -1; + pm->pm_active = 0; + mtx_unlock_spin(&sched_lock); + VM_OBJECT_LOCK(pm->pm_tsb_obj); for (i = 0; i < TSB_PAGES; i++) { m = vm_page_grab(pm->pm_tsb_obj, i, VM_ALLOC_NOBUSY | @@ -1105,9 +1111,6 @@ pmap_pinit(pmap_t pm) VM_OBJECT_UNLOCK(pm->pm_tsb_obj); pmap_qenter((vm_offset_t)pm->pm_tsb, ma, TSB_PAGES); - for (i = 0; i < MAXCPU; i++) - pm->pm_context[i] = -1; - pm->pm_active = 0; bzero(&pm->pm_stats, sizeof(pm->pm_stats)); return (1); } From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 7 17:54:46 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED714106574B; Sun, 7 Nov 2010 17:54:44 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B16D8FC14; Sun, 7 Nov 2010 17:54:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7Hsipo067432; Sun, 7 Nov 2010 17:54:44 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7HsiJO067430; Sun, 7 Nov 2010 17:54:44 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011071754.oA7HsiJO067430@svn.freebsd.org> From: Marius Strobl Date: Sun, 7 Nov 2010 17:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214935 - stable/7/sys/dev/mii X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 17:54:46 -0000 Author: marius Date: Sun Nov 7 17:54:43 2010 New Revision: 214935 URL: http://svn.freebsd.org/changeset/base/214935 Log: MFC: r214606 Try to make the style consistent (including regarding NetBSD bits not yet merged) and adhere style(9). Modified: stable/7/sys/dev/mii/mii_physubr.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/mii/mii_physubr.c ============================================================================== --- stable/7/sys/dev/mii/mii_physubr.c Sun Nov 7 17:54:41 2010 (r214934) +++ stable/7/sys/dev/mii/mii_physubr.c Sun Nov 7 17:54:43 2010 (r214935) @@ -107,8 +107,8 @@ mii_phy_setmedia(struct mii_softc *sc) if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) { if ((PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) == 0 || - (sc->mii_flags & MIIF_FORCEANEG)) - (void) mii_phy_auto(sc); + (sc->mii_flags & MIIF_FORCEANEG) != 0) + (void)mii_phy_auto(sc); return; } @@ -124,10 +124,10 @@ mii_phy_setmedia(struct mii_softc *sc) bmcr = mii_media_table[ife->ifm_data].mm_bmcr; gtcr = mii_media_table[ife->ifm_data].mm_gtcr; - if (mii->mii_media.ifm_media & IFM_ETH_MASTER) { + if ((mii->mii_media.ifm_media & IFM_ETH_MASTER) != 0) { switch (IFM_SUBTYPE(ife->ifm_media)) { case IFM_1000_T: - gtcr |= GTCR_MAN_MS|GTCR_ADV_MS; + gtcr |= GTCR_MAN_MS | GTCR_ADV_MS; break; default: @@ -135,53 +135,48 @@ mii_phy_setmedia(struct mii_softc *sc) } } - if (ife->ifm_media & IFM_LOOP) + if ((ife->ifm_media & IFM_LOOP) != 0) bmcr |= BMCR_LOOP; PHY_WRITE(sc, MII_ANAR, anar); PHY_WRITE(sc, MII_BMCR, bmcr); - if (sc->mii_flags & MIIF_HAVE_GTCR) + if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) PHY_WRITE(sc, MII_100T2CR, gtcr); } int mii_phy_auto(struct mii_softc *sc) { + int anar, gtcr; /* * Check for 1000BASE-X. Autonegotiation is a bit * different on such devices. */ - if (sc->mii_flags & MIIF_IS_1000X) { - uint16_t anar = 0; - - if (sc->mii_extcapabilities & EXTSR_1000XFDX) + if ((sc->mii_flags & MIIF_IS_1000X) != 0) { + anar = 0; + if ((sc->mii_extcapabilities & EXTSR_1000XFDX) != 0) anar |= ANAR_X_FD; - if (sc->mii_extcapabilities & EXTSR_1000XHDX) + if ((sc->mii_extcapabilities & EXTSR_1000XHDX) != 0) anar |= ANAR_X_HD; - if (sc->mii_flags & MIIF_DOPAUSE) { + if ((sc->mii_flags & MIIF_DOPAUSE) != 0) { /* XXX Asymmetric vs. symmetric? */ anar |= ANLPAR_X_PAUSE_TOWARDS; } - PHY_WRITE(sc, MII_ANAR, anar); } else { - uint16_t anar; - anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA; - if (sc->mii_flags & MIIF_DOPAUSE) + if ((sc->mii_flags & MIIF_DOPAUSE) != 0) anar |= ANAR_FC; PHY_WRITE(sc, MII_ANAR, anar); - if (sc->mii_flags & MIIF_HAVE_GTCR) { - uint16_t gtcr = 0; - - if (sc->mii_extcapabilities & EXTSR_1000TFDX) + if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) { + gtcr = 0; + if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) gtcr |= GTCR_ADV_1000TFDX; - if (sc->mii_extcapabilities & EXTSR_1000THDX) + if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) gtcr |= GTCR_ADV_1000THDX; - PHY_WRITE(sc, MII_100T2CR, gtcr); } } @@ -213,7 +208,7 @@ mii_phy_tick(struct mii_softc *sc) /* Read the status register twice; BMSR_LINK is latch-low. */ reg = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR); - if (reg & BMSR_LINK) { + if ((reg & BMSR_LINK) != 0) { sc->mii_ticks = 0; /* reset autonegotiation timer. */ /* See above. */ return (0); @@ -243,7 +238,7 @@ mii_phy_reset(struct mii_softc *sc) struct ifmedia_entry *ife = sc->mii_pdata->mii_media.ifm_cur; int reg, i; - if (sc->mii_flags & MIIF_NOISOLATE) + if ((sc->mii_flags & MIIF_NOISOLATE) != 0) reg = BMCR_RESET; else reg = BMCR_RESET | BMCR_ISO; @@ -396,7 +391,10 @@ mii_phy_add_media(struct mii_softc *sc) return; } - /* Set aneg timer for 10/100 media. Gigabit media handled below. */ + /* + * Set the autonegotiation timer for 10/100 media. Gigabit media is + * handled below. + */ sc->mii_anegticks = MII_ANEGTICKS; #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) @@ -411,55 +409,54 @@ mii_phy_add_media(struct mii_softc *sc) * HomePNA PHYs. And there is really only one media type * that is supported. */ - if (sc->mii_flags & MIIF_IS_HPNA) { - if (sc->mii_capabilities & BMSR_10THDX) { + if ((sc->mii_flags & MIIF_IS_HPNA) != 0) { + if ((sc->mii_capabilities & BMSR_10THDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_HPNA_1, 0, - sc->mii_inst), - MII_MEDIA_10_T); + sc->mii_inst), MII_MEDIA_10_T); PRINT("HomePNA1"); } return; } - if (sc->mii_capabilities & BMSR_10THDX) { + if ((sc->mii_capabilities & BMSR_10THDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), MII_MEDIA_10_T); PRINT("10baseT"); } - if (sc->mii_capabilities & BMSR_10TFDX) { + if ((sc->mii_capabilities & BMSR_10TFDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst), MII_MEDIA_10_T_FDX); PRINT("10baseT-FDX"); } - if (sc->mii_capabilities & BMSR_100TXHDX) { + if ((sc->mii_capabilities & BMSR_100TXHDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst), MII_MEDIA_100_TX); PRINT("100baseTX"); } - if (sc->mii_capabilities & BMSR_100TXFDX) { + if ((sc->mii_capabilities & BMSR_100TXFDX) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst), MII_MEDIA_100_TX_FDX); PRINT("100baseTX-FDX"); } - if (sc->mii_capabilities & BMSR_100T4) { + if ((sc->mii_capabilities & BMSR_100T4) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_T4, 0, sc->mii_inst), MII_MEDIA_100_T4); PRINT("100baseT4"); } - if (sc->mii_extcapabilities & EXTSR_MEDIAMASK) { + if ((sc->mii_extcapabilities & EXTSR_MEDIAMASK) != 0) { /* * XXX Right now only handle 1000SX and 1000TX. Need - * XXX to handle 1000LX and 1000CX some how. + * XXX to handle 1000LX and 1000CX somehow. */ - if (sc->mii_extcapabilities & EXTSR_1000XHDX) { + if ((sc->mii_extcapabilities & EXTSR_1000XHDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_IS_1000X; ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0, sc->mii_inst), MII_MEDIA_1000_X); PRINT("1000baseSX"); } - if (sc->mii_extcapabilities & EXTSR_1000XFDX) { + if ((sc->mii_extcapabilities & EXTSR_1000XFDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_IS_1000X; ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, @@ -475,7 +472,7 @@ mii_phy_add_media(struct mii_softc *sc) * * All 1000baseT PHYs have a 1000baseT control register. */ - if (sc->mii_extcapabilities & EXTSR_1000THDX) { + if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_HAVE_GTCR; mii->mii_media.ifm_mask |= IFM_ETH_MASTER; @@ -483,7 +480,7 @@ mii_phy_add_media(struct mii_softc *sc) sc->mii_inst), MII_MEDIA_1000_T); PRINT("1000baseT"); } - if (sc->mii_extcapabilities & EXTSR_1000TFDX) { + if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) { sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_flags |= MIIF_HAVE_GTCR; mii->mii_media.ifm_mask |= IFM_ETH_MASTER; @@ -493,7 +490,7 @@ mii_phy_add_media(struct mii_softc *sc) } } - if (sc->mii_capabilities & BMSR_ANEG) { + if ((sc->mii_capabilities & BMSR_ANEG) != 0) { ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), MII_NMEDIA); /* intentionally invalid index */ PRINT("auto"); @@ -511,8 +508,7 @@ mii_phy_detach(device_t dev) mii_phy_down(sc); sc->mii_dev = NULL; LIST_REMOVE(sc, mii_list); - - return(0); + return (0); } const struct mii_phydesc * @@ -545,6 +541,5 @@ mii_phy_dev_probe(device_t dev, const st device_set_desc(dev, mpd->mpd_name); return (mrv); } - return (ENXIO); } From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 7 20:20:20 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C003106577E; Sun, 7 Nov 2010 20:20:20 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49DE08FC12; Sun, 7 Nov 2010 20:20:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7KKK0S075400; Sun, 7 Nov 2010 20:20:20 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7KKK1L075397; Sun, 7 Nov 2010 20:20:20 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201011072020.oA7KKK1L075397@svn.freebsd.org> From: Alan Cox Date: Sun, 7 Nov 2010 20:20:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214943 - stable/7/sys/vm X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:20:20 -0000 Author: alc Date: Sun Nov 7 20:20:19 2010 New Revision: 214943 URL: http://svn.freebsd.org/changeset/base/214943 Log: MFC r214564 Correct some format strings used by sysctls. Modified: stable/7/sys/vm/vm_phys.c stable/7/sys/vm/vm_reserv.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/vm/vm_phys.c ============================================================================== --- stable/7/sys/vm/vm_phys.c Sun Nov 7 19:51:51 2010 (r214942) +++ stable/7/sys/vm/vm_phys.c Sun Nov 7 20:20:19 2010 (r214943) @@ -120,11 +120,11 @@ sysctl_vm_phys_free(SYSCTL_HANDLER_ARGS) sbuf_printf(&sbuf, "-- -- "); sbuf_printf(&sbuf, "--\n"); for (oind = VM_NFREEORDER - 1; oind >= 0; oind--) { - sbuf_printf(&sbuf, " %2.2d (%6.6dK)", oind, + sbuf_printf(&sbuf, " %2d (%6dK)", oind, 1 << (PAGE_SHIFT - 10 + oind)); for (pind = 0; pind < VM_NFREEPOOL; pind++) { fl = vm_phys_free_queues[flind][pind]; - sbuf_printf(&sbuf, " | %6.6d", fl[oind].lcnt); + sbuf_printf(&sbuf, " | %6d", fl[oind].lcnt); } sbuf_printf(&sbuf, "\n"); } Modified: stable/7/sys/vm/vm_reserv.c ============================================================================== --- stable/7/sys/vm/vm_reserv.c Sun Nov 7 19:51:51 2010 (r214942) +++ stable/7/sys/vm/vm_reserv.c Sun Nov 7 20:20:19 2010 (r214943) @@ -196,7 +196,7 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } mtx_unlock(&vm_page_queue_free_mtx); - sbuf_printf(&sbuf, "%5.5d: %6.6dK, %6.6d\n", level, + sbuf_printf(&sbuf, "%5d: %6dK, %6d\n", level, unused_pages * (PAGE_SIZE / 1024), counter); } sbuf_finish(&sbuf); From owner-svn-src-stable-7@FreeBSD.ORG Sun Nov 7 20:33:37 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56EA51065696; Sun, 7 Nov 2010 20:33:37 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 06B528FC0A; Sun, 7 Nov 2010 20:33:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA7KXalh077809; Sun, 7 Nov 2010 20:33:36 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA7KXa5C077807; Sun, 7 Nov 2010 20:33:36 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201011072033.oA7KXa5C077807@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 7 Nov 2010 20:33:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214945 - stable/7/bin/sh X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Nov 2010 20:33:37 -0000 Author: jilles Date: Sun Nov 7 20:33:36 2010 New Revision: 214945 URL: http://svn.freebsd.org/changeset/base/214945 Log: MFC r214609: sh(1): Correct synopsis and make precise how $0 is set. In particular, the extra argument to set $0 with -c was not documented. Modified: stable/7/bin/sh/sh.1 Directory Properties: stable/7/bin/sh/ (props changed) Modified: stable/7/bin/sh/sh.1 ============================================================================== --- stable/7/bin/sh/sh.1 Sun Nov 7 20:29:39 2010 (r214944) +++ stable/7/bin/sh/sh.1 Sun Nov 7 20:33:36 2010 (r214945) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd October 16, 2010 +.Dd October 31, 2010 .Dt SH 1 .Os .Sh NAME @@ -40,9 +40,24 @@ .Nd command interpreter (shell) .Sh SYNOPSIS .Nm -.Op Fl /+abCEefIimnPpsTuVvx +.Op Fl /+abCEefIimnPpTuVvx .Op Fl /+o Ar longname -.Op Fl c Ar string +.Oo +.Ar script +.Op Ar arg ... +.Oc +.Nm +.Op Fl /+abCEefIimnPpTuVvx +.Op Fl /+o Ar longname +.Fl c Ar string +.Oo +.Ar name +.Op Ar arg ... +.Oc +.Nm +.Op Fl /+abCEefIimnPpTuVvx +.Op Fl /+o Ar longname +.Fl s .Op Ar arg ... .Sh DESCRIPTION The @@ -1099,7 +1114,12 @@ For a pipeline, the process ID is that of the last command in the pipeline. .It Li $0 -(zero) Expands to the name of the shell or shell script. +(zero) Expands to the name of the shell script if passed on the command line, +the +.Ar name +operand if given (with +.Fl c ) +or otherwise argument 0 passed to the shell. .El .Ss Word Expansions This clause describes the various expansions that are From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 8 15:22:21 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 008181065788; Mon, 8 Nov 2010 15:22:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8DB88FC27; Mon, 8 Nov 2010 15:22:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8FMKhd037634; Mon, 8 Nov 2010 15:22:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8FMKSd037627; Mon, 8 Nov 2010 15:22:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201011081522.oA8FMKSd037627@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 8 Nov 2010 15:22:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214986 - stable/7/sys/nfsclient X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 15:22:21 -0000 Author: kib Date: Mon Nov 8 15:22:20 2010 New Revision: 214986 URL: http://svn.freebsd.org/changeset/base/214986 Log: MFC r203072 (by rmacklem, to be reverted by MFC of r214026): Fix a race that can occur when nfs nfsiod threads are being created. MFC r212506: Do not fork nfsiod directly from the vop methods. MFC r214026: Do not synchronously start the nfsiod threads at all. Tested by: jhb Modified: stable/7/sys/nfsclient/nfs.h stable/7/sys/nfsclient/nfs_bio.c stable/7/sys/nfsclient/nfs_nfsiod.c stable/7/sys/nfsclient/nfs_subs.c stable/7/sys/nfsclient/nfs_vnops.c stable/7/sys/nfsclient/nfsnode.h 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/nfsclient/nfs.h ============================================================================== --- stable/7/sys/nfsclient/nfs.h Mon Nov 8 15:14:14 2010 (r214985) +++ stable/7/sys/nfsclient/nfs.h Mon Nov 8 15:22:20 2010 (r214986) @@ -135,6 +135,7 @@ extern struct uma_zone *nfsmount_zone; extern struct callout nfs_callout; extern struct nfsstats nfsstats; extern struct mtx nfs_iod_mtx; +extern struct task nfs_nfsiodnew_task; extern int nfs_numasync; extern unsigned int nfs_iodmax; @@ -305,7 +306,8 @@ int nfs_writerpc(struct vnode *, struct int nfs_commit(struct vnode *vp, u_quad_t offset, int cnt, struct ucred *cred, struct thread *td); int nfs_readdirrpc(struct vnode *, struct uio *, struct ucred *); -int nfs_nfsiodnew(void); +void nfs_nfsiodnew(void); +void nfs_nfsiodnew_tq(__unused void *, int); int nfs_asyncio(struct nfsmount *, struct buf *, struct ucred *, struct thread *); int nfs_doio(struct vnode *, struct buf *, struct ucred *, struct thread *); void nfs_doio_directwrite (struct buf *); Modified: stable/7/sys/nfsclient/nfs_bio.c ============================================================================== --- stable/7/sys/nfsclient/nfs_bio.c Mon Nov 8 15:14:14 2010 (r214985) +++ stable/7/sys/nfsclient/nfs_bio.c Mon Nov 8 15:22:20 2010 (r214986) @@ -1375,7 +1375,7 @@ again: * Find a free iod to process this request. */ for (iod = 0; iod < nfs_numasync; iod++) - if (nfs_iodwant[iod]) { + if (nfs_iodwant[iod] == NFSIOD_AVAILABLE) { gotiod = TRUE; break; } @@ -1383,20 +1383,16 @@ again: /* * Try to create one if none are free. */ - if (!gotiod) { - iod = nfs_nfsiodnew(); - if (iod != -1) - gotiod = TRUE; - } - - if (gotiod) { + if (!gotiod) + nfs_nfsiodnew(); + else { /* * Found one, so wake it up and tell it which * mount to process. */ NFS_DPF(ASYNCIO, ("nfs_asyncio: waking iod %d for mount %p\n", iod, nmp)); - nfs_iodwant[iod] = NULL; + nfs_iodwant[iod] = NFSIOD_NOT_AVAILABLE; nfs_iodmount[iod] = nmp; nmp->nm_bufqiods++; wakeup(&nfs_iodwant[iod]); @@ -1409,7 +1405,7 @@ again: if (!gotiod) { if (nmp->nm_bufqiods > 0) { NFS_DPF(ASYNCIO, - ("nfs_asyncio: %d iods are already processing mount %p\n", + ("nfs_asyncio: %d iods are already processing mount %p\n", nmp->nm_bufqiods, nmp)); gotiod = TRUE; } @@ -1424,9 +1420,9 @@ again: * Ensure that the queue never grows too large. We still want * to asynchronize so we block rather then return EIO. */ - while (nmp->nm_bufqlen >= 2*nfs_numasync) { + while (nmp->nm_bufqlen >= 2 * nfs_numasync) { NFS_DPF(ASYNCIO, - ("nfs_asyncio: waiting for mount %p queue to drain\n", nmp)); + ("nfs_asyncio: waiting for mount %p queue to drain\n", nmp)); nmp->nm_bufqwant = TRUE; error = nfs_msleep(td, &nmp->nm_bufq, &nfs_iod_mtx, slpflag | PRIBIO, @@ -1434,7 +1430,7 @@ again: if (error) { error2 = nfs_sigintr(nmp, NULL, td); if (error2) { - mtx_unlock(&nfs_iod_mtx); + mtx_unlock(&nfs_iod_mtx); return (error2); } if (slpflag == PCATCH) { @@ -1446,17 +1442,13 @@ again: * We might have lost our iod while sleeping, * so check and loop if nescessary. */ - if (nmp->nm_bufqiods == 0) { - NFS_DPF(ASYNCIO, - ("nfs_asyncio: no iods after mount %p queue was drained, looping\n", nmp)); - goto again; - } + goto again; } /* We might have lost our nfsiod */ if (nmp->nm_bufqiods == 0) { NFS_DPF(ASYNCIO, - ("nfs_asyncio: no iods after mount %p queue was drained, looping\n", nmp)); +("nfs_asyncio: no iods after mount %p queue was drained, looping\n", nmp)); goto again; } Modified: stable/7/sys/nfsclient/nfs_nfsiod.c ============================================================================== --- stable/7/sys/nfsclient/nfs_nfsiod.c Mon Nov 8 15:14:14 2010 (r214985) +++ stable/7/sys/nfsclient/nfs_nfsiod.c Mon Nov 8 15:22:20 2010 (r214986) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -92,6 +93,8 @@ unsigned int nfs_iodmax = 20; /* Minimum number of nfsiod kthreads to keep as spares */ static unsigned int nfs_iodmin = 0; +static int nfs_nfsiodnew_sync(void); + static int sysctl_iodmin(SYSCTL_HANDLER_ARGS) { @@ -115,7 +118,7 @@ sysctl_iodmin(SYSCTL_HANDLER_ARGS) * than the new minimum, create some more. */ for (i = nfs_iodmin - nfs_numasync; i > 0; i--) - nfs_nfsiodnew(); + nfs_nfsiodnew_sync(); out: mtx_unlock(&nfs_iod_mtx); return (0); @@ -148,7 +151,7 @@ sysctl_iodmax(SYSCTL_HANDLER_ARGS) */ iod = nfs_numasync - 1; for (i = 0; i < nfs_numasync - nfs_iodmax; i++) { - if (nfs_iodwant[iod]) + if (nfs_iodwant[iod] == NFSIOD_AVAILABLE) wakeup(&nfs_iodwant[iod]); iod--; } @@ -159,37 +162,55 @@ out: SYSCTL_PROC(_vfs_nfs, OID_AUTO, iodmax, CTLTYPE_UINT | CTLFLAG_RW, 0, sizeof (nfs_iodmax), sysctl_iodmax, "IU", ""); -int -nfs_nfsiodnew(void) +static int +nfs_nfsiodnew_sync(void) { int error, i; - int newiod; - if (nfs_numasync >= nfs_iodmax) - return (-1); - newiod = -1; - for (i = 0; i < nfs_iodmax; i++) + mtx_assert(&nfs_iod_mtx, MA_OWNED); + for (i = 0; i < nfs_iodmax; i++) { if (nfs_asyncdaemon[i] == 0) { - nfs_asyncdaemon[i]++; - newiod = i; + nfs_asyncdaemon[i] = 1; break; } - if (newiod == -1) - return (-1); + } + if (i == nfs_iodmax) + return (0); mtx_unlock(&nfs_iod_mtx); - error = kthread_create(nfssvc_iod, nfs_asyncdaemon + i, NULL, RFHIGHPID, - 0, "nfsiod %d", newiod); + error = kthread_create(nfssvc_iod, nfs_asyncdaemon + i, NULL, + RFHIGHPID, 0, "nfsiod %d", i); + mtx_lock(&nfs_iod_mtx); + if (error == 0) { + nfs_numasync++; + nfs_iodwant[i] = NFSIOD_AVAILABLE; + } else + nfs_asyncdaemon[i] = 0; + return (error); +} + +void +nfs_nfsiodnew_tq(__unused void *arg, int pending) +{ + mtx_lock(&nfs_iod_mtx); - if (error) - return (-1); - nfs_numasync++; - return (newiod); + while (pending > 0) { + pending--; + nfs_nfsiodnew_sync(); + } + mtx_unlock(&nfs_iod_mtx); +} + +void +nfs_nfsiodnew(void) +{ + + mtx_assert(&nfs_iod_mtx, MA_OWNED); + taskqueue_enqueue(taskqueue_thread, &nfs_nfsiodnew_task); } static void nfsiod_setup(void *dummy) { - int i; int error; TUNABLE_INT_FETCH("vfs.nfs.iodmin", &nfs_iodmin); @@ -198,8 +219,8 @@ nfsiod_setup(void *dummy) if (nfs_iodmin > NFS_MAXASYNCDAEMON) nfs_iodmin = NFS_MAXASYNCDAEMON; - for (i = 0; i < nfs_iodmin; i++) { - error = nfs_nfsiodnew(); + while (nfs_numasync < nfs_iodmin) { + error = nfs_nfsiodnew_sync(); if (error == -1) panic("nfsiod_setup: nfs_nfsiodnew failed"); } @@ -235,7 +256,8 @@ nfssvc_iod(void *instance) goto finish; if (nmp) nmp->nm_bufqiods--; - nfs_iodwant[myiod] = curthread->td_proc; + if (nfs_iodwant[myiod] == NFSIOD_NOT_AVAILABLE) + nfs_iodwant[myiod] = NFSIOD_AVAILABLE; nfs_iodmount[myiod] = NULL; /* * Always keep at least nfs_iodmin kthreads. @@ -302,7 +324,7 @@ finish: nfs_asyncdaemon[myiod] = 0; if (nmp) nmp->nm_bufqiods--; - nfs_iodwant[myiod] = NULL; + nfs_iodwant[myiod] = NFSIOD_NOT_AVAILABLE; nfs_iodmount[myiod] = NULL; /* Someone may be waiting for the last nfsiod to terminate. */ if (--nfs_numasync == 0) Modified: stable/7/sys/nfsclient/nfs_subs.c ============================================================================== --- stable/7/sys/nfsclient/nfs_subs.c Mon Nov 8 15:14:14 2010 (r214985) +++ stable/7/sys/nfsclient/nfs_subs.c Mon Nov 8 15:22:20 2010 (r214986) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -103,6 +104,7 @@ struct nfs_reqq nfs_reqq; struct mtx nfs_reqq_mtx; struct nfs_bufq nfs_bufq; static struct mtx nfs_xid_mtx; +struct task nfs_nfsiodnew_task; /* * and the reverse mapping from generic to Version 2 procedure numbers @@ -422,7 +424,7 @@ nfs_init(struct vfsconf *vfsp) nfs_ticks = 1; /* Ensure async daemons disabled */ for (i = 0; i < NFS_MAXASYNCDAEMON; i++) { - nfs_iodwant[i] = NULL; + nfs_iodwant[i] = NFSIOD_NOT_AVAILABLE; nfs_iodmount[i] = NULL; } nfs_nhinit(); /* Init the nfsnode table */ @@ -435,6 +437,7 @@ nfs_init(struct vfsconf *vfsp) mtx_init(&nfs_reqq_mtx, "NFS reqq lock", NULL, MTX_DEF); mtx_init(&nfs_iod_mtx, "NFS iod lock", NULL, MTX_DEF); mtx_init(&nfs_xid_mtx, "NFS xid lock", NULL, MTX_DEF); + TASK_INIT(&nfs_nfsiodnew_task, 0, nfs_nfsiodnew_tq, NULL); nfs_pbuf_freecnt = nswbuf / 2 + 1; @@ -454,11 +457,15 @@ nfs_uninit(struct vfsconf *vfsp) /* * Tell all nfsiod processes to exit. Clear nfs_iodmax, and wakeup * any sleeping nfsiods so they check nfs_iodmax and exit. + * Drain nfsiodnew task before we wait for them to finish. */ mtx_lock(&nfs_iod_mtx); nfs_iodmax = 0; + mtx_unlock(&nfs_iod_mtx); + taskqueue_drain(taskqueue_thread, &nfs_nfsiodnew_task); + mtx_lock(&nfs_iod_mtx); for (i = 0; i < nfs_numasync; i++) - if (nfs_iodwant[i]) + if (nfs_iodwant[i] == NFSIOD_AVAILABLE) wakeup(&nfs_iodwant[i]); /* The last nfsiod to exit will wake us up when nfs_numasync hits 0 */ while (nfs_numasync) Modified: stable/7/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/7/sys/nfsclient/nfs_vnops.c Mon Nov 8 15:14:14 2010 (r214985) +++ stable/7/sys/nfsclient/nfs_vnops.c Mon Nov 8 15:22:20 2010 (r214986) @@ -195,7 +195,7 @@ static int nfs_renameit(struct vnode *sd * Global variables */ struct mtx nfs_iod_mtx; -struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON]; +enum nfsiod_state nfs_iodwant[NFS_MAXASYNCDAEMON]; struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON]; int nfs_numasync = 0; vop_advlock_t *nfs_advlock_p = nfs_dolock; Modified: stable/7/sys/nfsclient/nfsnode.h ============================================================================== --- stable/7/sys/nfsclient/nfsnode.h Mon Nov 8 15:14:14 2010 (r214985) +++ stable/7/sys/nfsclient/nfsnode.h Mon Nov 8 15:22:20 2010 (r214986) @@ -173,10 +173,20 @@ struct nfsnode { #define NFS_TIMESPEC_COMPARE(T1, T2) (((T1)->tv_sec != (T2)->tv_sec) || ((T1)->tv_nsec != (T2)->tv_nsec)) /* + * NFS iod threads can be in one of these two states once spawned. + * NFSIOD_NOT_AVAILABLE - Cannot be assigned an I/O operation at this time. + * NFSIOD_AVAILABLE - Available to be assigned an I/O operation. + */ +enum nfsiod_state { + NFSIOD_NOT_AVAILABLE = 0, + NFSIOD_AVAILABLE = 1, +}; + +/* * Queue head for nfsiod's */ extern TAILQ_HEAD(nfs_bufq, buf) nfs_bufq; -extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON]; +extern enum nfsiod_state nfs_iodwant[NFS_MAXASYNCDAEMON]; extern struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON]; #if defined(_KERNEL) From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 8 19:25:47 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFFEC1065670; Mon, 8 Nov 2010 19:25:47 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B38B08FC14; Mon, 8 Nov 2010 19:25:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8JPlq2048103; Mon, 8 Nov 2010 19:25:47 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8JPluj048100; Mon, 8 Nov 2010 19:25:47 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011081925.oA8JPluj048100@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 19:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214994 - stable/7/sys/dev/mii X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:25:48 -0000 Author: yongari Date: Mon Nov 8 19:25:47 2010 New Revision: 214994 URL: http://svn.freebsd.org/changeset/base/214994 Log: MFC r214427: Add BCM5717C 10/100/1000TX PHY id. Modified: stable/7/sys/dev/mii/brgphy.c stable/7/sys/dev/mii/miidevs 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/mii/brgphy.c ============================================================================== --- stable/7/sys/dev/mii/brgphy.c Mon Nov 8 19:22:36 2010 (r214993) +++ stable/7/sys/dev/mii/brgphy.c Mon Nov 8 19:25:47 2010 (r214994) @@ -141,6 +141,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709C), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5761), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S), + MII_PHY_DESC(xxBROADCOM_ALT2, BCM5717C), MII_PHY_DESC(BROADCOM2, BCM5906), MII_PHY_END }; @@ -253,6 +254,9 @@ brgphy_attach(device_t dev) break; } break; + case MII_OUI_xxBROADCOM_ALT2: + /* No special handling yet. */ + break; default: device_printf(dev, "Unrecognized OUI for PHY!\n"); } @@ -999,6 +1003,7 @@ brgphy_reset(struct mii_softc *sc) } break; case MII_OUI_xxBROADCOM_ALT1: + case MII_OUI_xxBROADCOM_ALT2: break; } Modified: stable/7/sys/dev/mii/miidevs ============================================================================== --- stable/7/sys/dev/mii/miidevs Mon Nov 8 19:22:36 2010 (r214993) +++ stable/7/sys/dev/mii/miidevs Mon Nov 8 19:25:47 2010 (r214994) @@ -79,6 +79,7 @@ oui xxINTEL 0x00f800 Intel oui xxALTIMA 0x000895 Altima Communications oui xxBROADCOM 0x000818 Broadcom Corporation oui xxBROADCOM_ALT1 0x0050ef Broadcom Corporation +oui xxBROADCOM_ALT2 0x00d897 Broadcom Corporation oui xxICS 0x00057d Integrated Circuit Systems oui xxSEEQ 0x0005be Seeq oui xxSIS 0x000760 Silicon Integrated Systems @@ -148,6 +149,7 @@ model xxBROADCOM_ALT1 BCM5784 0x003a BCM model xxBROADCOM_ALT1 BCM5709C 0x003c BCM5709C 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5761 0x003d BCM5761 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5709S 0x003f BCM5709S 1000/2500baseSX PHY +model xxBROADCOM_ALT2 BCM5717C 0x0020 BCM5717C 10/100/1000baseTX PHY model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX PHY /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 8 19:33:13 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F24FA1065670; Mon, 8 Nov 2010 19:33:13 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFC468FC16; Mon, 8 Nov 2010 19:33:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8JXDDU048538; Mon, 8 Nov 2010 19:33:13 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8JXDQT048536; Mon, 8 Nov 2010 19:33:13 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011081933.oA8JXDQT048536@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 19:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214996 - stable/7/sys/dev/bge X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:33:14 -0000 Author: yongari Date: Mon Nov 8 19:33:13 2010 New Revision: 214996 URL: http://svn.freebsd.org/changeset/base/214996 Log: MFC r213486: Remove bge_tx_buf_ratio, unused member of softc. Modified: stable/7/sys/dev/bge/if_bgereg.h 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_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Mon Nov 8 19:31:41 2010 (r214995) +++ stable/7/sys/dev/bge/if_bgereg.h Mon Nov 8 19:33:13 2010 (r214996) @@ -2759,7 +2759,6 @@ struct bge_softc { uint32_t bge_tx_prodidx; uint32_t bge_rx_max_coal_bds; uint32_t bge_tx_max_coal_bds; - uint32_t bge_tx_buf_ratio; uint32_t bge_mi_mode; int bge_if_flags; int bge_txcnt; From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 8 19:54:45 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 461AD1065673; Mon, 8 Nov 2010 19:54:45 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3234A8FC23; Mon, 8 Nov 2010 19:54:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8JsjrV049637; Mon, 8 Nov 2010 19:54:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8JsjHu049634; Mon, 8 Nov 2010 19:54:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011081954.oA8JsjHu049634@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 19:54:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215000 - stable/7/sys/dev/bge X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 19:54:45 -0000 Author: yongari Date: Mon Nov 8 19:54:44 2010 New Revision: 215000 URL: http://svn.freebsd.org/changeset/base/215000 Log: MFC r214428: Add initial BCM5718 family support. The BCM5718 family includes the dual port BCM5717 and BCM5718 devices which are intended for mainstream workstation and entry-level server designs and represents the twelfth generation of NetXtreme Ethernet controllers. This family is the successor to the BCM5714/BCM5715 family and supports IPv4/IPv6 checksum offloading, TSO, VLAN hardware tagging, jumbo frames, MSI/MSIX, IOV, RSS and TSS. This change set supports all hardware features except IOV and RSS/TSS. Unlike its predecessors, only extended RX buffer descriptors can be posted to the jumbo producer ring. Single RX buffer descriptors for jumbo frame are not supported. RSS requires a more substantial set of changes and will apply to a larger set of NetXtreme devices so RSS/TSS multi-queue support will be implemented in a future releases. Special thanks to Broadcom who kindly sent a sample board to me and to davidch who gave provided the initial support code. Submitted by: davidch (initial version) HW donated by: Broadcom Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h 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 Mon Nov 8 19:53:16 2010 (r214999) +++ stable/7/sys/dev/bge/if_bge.c Mon Nov 8 19:54:44 2010 (r215000) @@ -169,6 +169,8 @@ static const struct bge_type { { BCOM_VENDORID, BCOM_DEVICEID_BCM5714S }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5715 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5715S }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5717 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5718 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5720 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5721 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5722 }, @@ -289,6 +291,8 @@ static const struct bge_revision { { BGE_CHIPID_BCM5715_A0, "BCM5715 A0" }, { BGE_CHIPID_BCM5715_A1, "BCM5715 A1" }, { BGE_CHIPID_BCM5715_A3, "BCM5715 A3" }, + { BGE_CHIPID_BCM5717_A0, "BCM5717 A0" }, + { BGE_CHIPID_BCM5717_B0, "BCM5717 B0" }, { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" }, { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, @@ -332,6 +336,7 @@ static const struct bge_revision bge_maj { BGE_ASICREV_BCM5787, "unknown BCM5754/5787" }, { BGE_ASICREV_BCM5906, "unknown BCM5906" }, { BGE_ASICREV_BCM57780, "unknown BCM57780" }, + { BGE_ASICREV_BCM5717, "unknown BCM5717" }, { 0, NULL } }; @@ -342,6 +347,7 @@ static const struct bge_revision bge_maj #define BGE_IS_5714_FAMILY(sc) ((sc)->bge_flags & BGE_FLAG_5714_FAMILY) #define BGE_IS_575X_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_575X_PLUS) #define BGE_IS_5755_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5755_PLUS) +#define BGE_IS_5717_PLUS(sc) ((sc)->bge_flags & BGE_FLAG_5717_PLUS) const struct bge_revision * bge_lookup_rev(uint32_t); const struct bge_vendor * bge_lookup_vendor(uint16_t); @@ -367,6 +373,7 @@ static int bge_get_eaddr_eeprom(struct b static int bge_get_eaddr(struct bge_softc *, uint8_t[]); static void bge_txeof(struct bge_softc *, uint16_t); +static void bge_rxcsum(struct bge_softc *, struct bge_rx_bd *, struct mbuf *); static void bge_rxeof(struct bge_softc *, uint16_t, int); static void bge_asf_driver_up (struct bge_softc *); @@ -376,7 +383,7 @@ static void bge_stats_update(struct bge_ static void bge_stats_update_regs(struct bge_softc *); static struct mbuf *bge_check_short_dma(struct mbuf *); static struct mbuf *bge_setup_tso(struct bge_softc *, struct mbuf *, - uint16_t *); + uint16_t *, uint16_t *); static int bge_encap(struct bge_softc *, struct mbuf **, uint32_t *); static void bge_intr(void *); @@ -1349,12 +1356,15 @@ bge_stop_fw(struct bge_softc *sc) static int bge_chipinit(struct bge_softc *sc) { - uint32_t dma_rw_ctl; + uint32_t dma_rw_ctl, misc_ctl; uint16_t val; int i; /* Set endianness before we access any non-PCI registers. */ - pci_write_config(sc->bge_dev, BGE_PCI_MISC_CTL, BGE_INIT, 4); + misc_ctl = BGE_INIT; + if (sc->bge_flags & BGE_FLAG_TAGGED_STATUS) + misc_ctl |= BGE_PCIMISCCTL_TAGGED_STATUS; + pci_write_config(sc->bge_dev, BGE_PCI_MISC_CTL, misc_ctl, 4); /* Clear the MAC control register */ CSR_WRITE_4(sc, BGE_MAC_MODE, 0); @@ -1446,6 +1456,8 @@ bge_chipinit(struct bge_softc *sc) if (sc->bge_asicrev == BGE_ASICREV_BCM5703 || sc->bge_asicrev == BGE_ASICREV_BCM5704) dma_rw_ctl &= ~BGE_PCIDMARWCTL_MINDMA; + if (BGE_IS_5717_PLUS(sc)) + dma_rw_ctl &= ~BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT; pci_write_config(sc->bge_dev, BGE_PCI_DMA_RW_CTL, dma_rw_ctl, 4); /* @@ -1529,7 +1541,16 @@ bge_blockinit(struct bge_softc *sc) } /* Configure mbuf pool watermarks */ - if (!BGE_IS_5705_PLUS(sc)) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); + if (sc->bge_ifp->if_mtu > ETHERMTU) { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0xea); + } else { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x2a); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0xa0); + } + } else if (!BGE_IS_5705_PLUS(sc)) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50); CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20); CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60); @@ -1621,7 +1642,16 @@ bge_blockinit(struct bge_softc *sc) BGE_ADDR_HI(sc->bge_ldata.bge_rx_std_ring_paddr); bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag, sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREREAD); - if (BGE_IS_5705_PLUS(sc)) { + if (BGE_IS_5717_PLUS(sc)) { + /* + * Bits 31-16: Programmable ring size (2048, 1024, 512, .., 32) + * Bits 15-2 : Maximum RX frame size + * Bit 1 : 1 = Ring Disabled, 0 = Ring ENabled + * Bit 0 : Reserved + */ + rcb->bge_maxlen_flags = + BGE_RCB_MAXLEN_FLAGS(512, BGE_MAX_FRAMELEN << 2); + } else if (BGE_IS_5705_PLUS(sc)) { /* * Bits 31-16: Programmable ring size (512, 256, 128, 64, 32) * Bits 15-2 : Reserved (should be 0) @@ -1640,7 +1670,10 @@ bge_blockinit(struct bge_softc *sc) rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0); } - rcb->bge_nicaddr = BGE_STD_RX_RINGS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717; + else + rcb->bge_nicaddr = BGE_STD_RX_RINGS; /* Write the standard receive producer ring control block. */ CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_HI, rcb->bge_hostaddr.bge_addr_hi); CSR_WRITE_4(sc, BGE_RX_STD_RCB_HADDR_LO, rcb->bge_hostaddr.bge_addr_lo); @@ -1669,7 +1702,10 @@ bge_blockinit(struct bge_softc *sc) BUS_DMASYNC_PREREAD); rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED); - rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS_5717; + else + rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_HI, rcb->bge_hostaddr.bge_addr_hi); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_HADDR_LO, @@ -1726,6 +1762,10 @@ bge_blockinit(struct bge_softc *sc) if (BGE_IS_JUMBO_CAPABLE(sc)) CSR_WRITE_4(sc, BGE_RBDI_JUMBO_REPL_THRESH, BGE_JUMBO_RX_RING_CNT/8); + if (BGE_IS_5717_PLUS(sc)) { + CSR_WRITE_4(sc, BGE_STD_REPLENISH_LWM, 32); + CSR_WRITE_4(sc, BGE_JMB_REPLENISH_LWM, 16); + } /* * Disable all send rings by setting the 'ring disabled' bit @@ -1750,8 +1790,11 @@ bge_blockinit(struct bge_softc *sc) BGE_HOSTADDR(taddr, sc->bge_ldata.bge_tx_ring_paddr); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); - RCB_WRITE_4(sc, vrcb, bge_nicaddr, - BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT)); + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + RCB_WRITE_4(sc, vrcb, bge_nicaddr, BGE_SEND_RING_5717); + else + RCB_WRITE_4(sc, vrcb, bge_nicaddr, + BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT)); RCB_WRITE_4(sc, vrcb, bge_maxlen_flags, BGE_RCB_MAXLEN_FLAGS(BGE_TX_RING_CNT, 0)); @@ -1760,7 +1803,10 @@ bge_blockinit(struct bge_softc *sc) * 'ring diabled' bit in the flags field of all the receive * return ring control blocks, located in NIC memory. */ - if (!BGE_IS_5705_PLUS(sc)) + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) { + /* Should be 17, use 16 until we get an SRAM map. */ + limit = 16; + } else if (!BGE_IS_5705_PLUS(sc)) limit = BGE_RX_RINGS_MAX; else if (sc->bge_asicrev == BGE_ASICREV_BCM5755) limit = 4; @@ -1936,6 +1982,10 @@ bge_blockinit(struct bge_softc *sc) /* Turn on read DMA state machine */ val = BGE_RDMAMODE_ENABLE | BGE_RDMAMODE_ALL_ATTNS; + + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) + val |= BGE_RDMAMODE_MULT_DMA_RD_DIS; + if (sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || sc->bge_asicrev == BGE_ASICREV_BCM57780) @@ -1944,16 +1994,18 @@ bge_blockinit(struct bge_softc *sc) BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN; if (sc->bge_flags & BGE_FLAG_PCIE) val |= BGE_RDMAMODE_FIFO_LONG_BURST; - if (sc->bge_flags & BGE_FLAG_TSO) { + if (sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) { val |= BGE_RDMAMODE_TSO4_ENABLE; - if (sc->bge_asicrev == BGE_ASICREV_BCM5785 || + if (sc->bge_flags & BGE_FLAG_TSO3 || + sc->bge_asicrev == BGE_ASICREV_BCM5785 || sc->bge_asicrev == BGE_ASICREV_BCM57780) val |= BGE_RDMAMODE_TSO6_ENABLE; } if (sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || - sc->bge_asicrev == BGE_ASICREV_BCM57780) { + sc->bge_asicrev == BGE_ASICREV_BCM57780 || + BGE_IS_5717_PLUS(sc)) { /* * Enable fix for read DMA FIFO overruns. * The fix is to limit the number of RX BDs @@ -1989,8 +2041,9 @@ bge_blockinit(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_SDC_MODE, val); /* Turn on send data initiator state machine */ - if (sc->bge_flags & BGE_FLAG_TSO) - CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE | 0x08); + if (sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) + CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE | + BGE_SDIMODE_HW_LSO_PRE_DMA); else CSR_WRITE_4(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE); @@ -2104,9 +2157,22 @@ bge_probe(device_t dev) id = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> BGE_PCIMISCCTL_ASICREV_SHIFT; - if (BGE_ASICREV(id) == BGE_ASICREV_USE_PRODID_REG) - id = pci_read_config(dev, - BGE_PCI_PRODID_ASICREV, 4); + if (BGE_ASICREV(id) == BGE_ASICREV_USE_PRODID_REG) { + /* + * Find the ASCI revision. Different chips + * use different registers. + */ + switch (pci_get_device(dev)) { + case BCOM_DEVICEID_BCM5717: + case BCOM_DEVICEID_BCM5718: + id = pci_read_config(dev, + BGE_PCI_GEN2_PRODID_ASICREV, 4); + break; + default: + id = pci_read_config(dev, + BGE_PCI_PRODID_ASICREV, 4); + } + } br = bge_lookup_rev(id); v = bge_lookup_vendor(vid); { @@ -2423,7 +2489,7 @@ bge_dma_alloc(struct bge_softc *sc) return (ENOMEM); } /* Create tag for Tx mbufs. */ - if (sc->bge_flags & BGE_FLAG_TSO) { + if (sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) { txsegsz = BGE_TSOSEG_SZ; txmaxsegsz = 65535 + sizeof(struct ether_vlan_header); } else { @@ -2539,6 +2605,10 @@ bge_can_use_msi(struct bge_softc *sc) { int can_use_msi = 0; + /* Disable MSI for polling(4). */ +#ifdef DEVICE_POLLING + return (0); +#endif switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5714_A0: case BGE_ASICREV_BCM5714: @@ -2568,7 +2638,7 @@ bge_attach(device_t dev) struct bge_softc *sc; uint32_t hwcfg = 0, misccfg; u_char eaddr[ETHER_ADDR_LEN]; - int error, msicount, phy_addr, reg, rid, trys; + int error, f, msicount, phy_addr, reg, rid, trys; sc = device_get_softc(dev); sc->bge_dev = dev; @@ -2594,14 +2664,55 @@ bge_attach(device_t dev) sc->bge_chipid = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) >> BGE_PCIMISCCTL_ASICREV_SHIFT; - if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_USE_PRODID_REG) - sc->bge_chipid = pci_read_config(dev, BGE_PCI_PRODID_ASICREV, - 4); + if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_USE_PRODID_REG) { + /* + * Find the ASCI revision. Different chips use different + * registers. + */ + switch (pci_get_device(dev)) { + case BCOM_DEVICEID_BCM5717: + case BCOM_DEVICEID_BCM5718: + sc->bge_chipid = pci_read_config(dev, + BGE_PCI_GEN2_PRODID_ASICREV, 4); + break; + default: + sc->bge_chipid = pci_read_config(dev, + BGE_PCI_PRODID_ASICREV, 4); + } + } sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid); sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); /* Set default PHY address. */ phy_addr = 1; + /* + * PHY address mapping for various devices. + * + * | F0 Cu | F0 Sr | F1 Cu | F1 Sr | + * ---------+-------+-------+-------+-------+ + * BCM57XX | 1 | X | X | X | + * BCM5704 | 1 | X | 1 | X | + * BCM5717 | 1 | 8 | 2 | 9 | + * + * Other addresses may respond but they are not + * IEEE compliant PHYs and should be ignored. + */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5717) { + f = pci_get_function(dev); + if (sc->bge_chipid == BGE_CHIPID_BCM5717_A0) { + if (CSR_READ_4(sc, BGE_SGDIG_STS) & + BGE_SGDIGSTS_IS_SERDES) + phy_addr = f + 8; + else + phy_addr = f + 1; + } else if (sc->bge_chipid == BGE_CHIPID_BCM5717_B0) { + if (CSR_READ_4(sc, BGE_CPMU_PHY_STRAP) & + BGE_CPMU_PHY_STRAP_IS_SERDES) + phy_addr = f + 8; + else + phy_addr = f + 1; + } + } /* * Don't enable Ethernet@WireSpeed for the 5700, 5906, or the @@ -2610,7 +2721,8 @@ bge_attach(device_t dev) if (sc->bge_asicrev != BGE_ASICREV_BCM5700 && sc->bge_asicrev != BGE_ASICREV_BCM5906 && sc->bge_chipid != BGE_CHIPID_BCM5705_A0 && - sc->bge_chipid != BGE_CHIPID_BCM5705_A1) + sc->bge_chipid != BGE_CHIPID_BCM5705_A1 && + !BGE_IS_5717_PLUS(sc)) sc->bge_phy_flags |= BGE_PHY_WIRESPEED; if (bge_has_eaddr(sc)) @@ -2618,6 +2730,11 @@ bge_attach(device_t dev) /* Save chipset family. */ switch (sc->bge_asicrev) { + case BGE_ASICREV_BCM5717: + sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | + BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | + BGE_FLAG_SHORT_DMA_BUG | BGE_FLAG_JUMBO_FRAME; + break; case BGE_ASICREV_BCM5755: case BGE_ASICREV_BCM5761: case BGE_ASICREV_BCM5784: @@ -2663,6 +2780,7 @@ bge_attach(device_t dev) sc->bge_phy_flags |= BGE_PHY_NO_3LED; if ((BGE_IS_5705_PLUS(sc)) && sc->bge_asicrev != BGE_ASICREV_BCM5906 && + sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_asicrev != BGE_ASICREV_BCM5785 && sc->bge_asicrev != BGE_ASICREV_BCM57780) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || @@ -2679,7 +2797,8 @@ bge_attach(device_t dev) } /* Identify the chips that use an CPMU. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5784 || + if (BGE_IS_5717_PLUS(sc) || + sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || sc->bge_asicrev == BGE_ASICREV_BCM57780) @@ -2722,7 +2841,10 @@ bge_attach(device_t dev) * the TSO to the controllers that are not affected TSO issues * (e.g. 5755 or higher). */ - if (BGE_IS_5755_PLUS(sc)) { + if (BGE_IS_5717_PLUS(sc)) { + /* BCM5717 requires different TSO configuration. */ + sc->bge_flags |= BGE_FLAG_TSO3; + } else if (BGE_IS_5755_PLUS(sc)) { /* * BCM5754 and BCM5787 shares the same ASIC id so * explicit device id check is required. @@ -2785,6 +2907,16 @@ bge_attach(device_t dev) } } + /* + * All controllers except BCM5700 supports tagged status but + * we use tagged status only for MSI case on BCM5717. Otherwise + * MSI on BCM5717 does not work. + */ +#ifndef DEVICE_POLLING + if (sc->bge_flags & BGE_FLAG_MSI && BGE_IS_5717_PLUS(sc)) + sc->bge_flags |= BGE_FLAG_TAGGED_STATUS; +#endif + sc->bge_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); @@ -2848,7 +2980,9 @@ bge_attach(device_t dev) } /* 5705 limits RX return ring to 512 entries. */ - if (BGE_IS_5705_PLUS(sc)) + if (BGE_IS_5717_PLUS(sc)) + sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT; + else if (BGE_IS_5705_PLUS(sc)) sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT_5705; else sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT; @@ -2893,7 +3027,7 @@ bge_attach(device_t dev) ifp->if_hwassist = sc->bge_csum_features; ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; - if ((sc->bge_flags & BGE_FLAG_TSO) != 0) { + if ((sc->bge_flags & (BGE_FLAG_TSO | BGE_FLAG_TSO3)) != 0) { ifp->if_hwassist |= CSUM_TSO; ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO; } @@ -3340,6 +3474,7 @@ bge_reset(struct bge_softc *sc) /* XXX: Broadcom Linux driver. */ if (sc->bge_flags & BGE_FLAG_PCIE && + sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_chipid != BGE_CHIPID_BCM5750_A0 && sc->bge_asicrev != BGE_ASICREV_BCM5785) { /* Enable Data FIFO protection. */ @@ -3480,20 +3615,8 @@ bge_rxeof(struct bge_softc *sc, uint16_t m->m_pkthdr.len = m->m_len = cur_rx->bge_len - ETHER_CRC_LEN; m->m_pkthdr.rcvif = ifp; - if (ifp->if_capenable & IFCAP_RXCSUM) { - if (cur_rx->bge_flags & BGE_RXBDFLAG_IP_CSUM) { - m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; - if ((cur_rx->bge_ip_csum ^ 0xFFFF) == 0) - m->m_pkthdr.csum_flags |= CSUM_IP_VALID; - } - if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM && - m->m_pkthdr.len >= ETHER_MIN_NOPAD) { - m->m_pkthdr.csum_data = - cur_rx->bge_tcp_udp_csum; - m->m_pkthdr.csum_flags |= - CSUM_DATA_VALID | CSUM_PSEUDO_HDR; - } - } + if (ifp->if_capenable & IFCAP_RXCSUM) + bge_rxcsum(sc, cur_rx, m); /* * If we received a packet with a vlan tag, @@ -3550,6 +3673,41 @@ bge_rxeof(struct bge_softc *sc, uint16_t } static void +bge_rxcsum(struct bge_softc *sc, struct bge_rx_bd *cur_rx, struct mbuf *m) +{ + + if (BGE_IS_5717_PLUS(sc)) { + if ((cur_rx->bge_flags & BGE_RXBDFLAG_IPV6) == 0) { + if (cur_rx->bge_flags & BGE_RXBDFLAG_IP_CSUM) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if ((cur_rx->bge_error_flag & + BGE_RXERRFLAG_IP_CSUM_NOK) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM) { + m->m_pkthdr.csum_data = + cur_rx->bge_tcp_udp_csum; + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | + CSUM_PSEUDO_HDR; + } + } + } else { + if (cur_rx->bge_flags & BGE_RXBDFLAG_IP_CSUM) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if ((cur_rx->bge_ip_csum ^ 0xFFFF) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (cur_rx->bge_flags & BGE_RXBDFLAG_TCP_UDP_CSUM && + m->m_pkthdr.len >= ETHER_MIN_NOPAD) { + m->m_pkthdr.csum_data = + cur_rx->bge_tcp_udp_csum; + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | + CSUM_PSEUDO_HDR; + } + } +} + +static void bge_txeof(struct bge_softc *sc, uint16_t tx_cons) { struct bge_tx_bd *cur_tx; @@ -3664,7 +3822,7 @@ bge_intr_task(void *arg, int pending) { struct bge_softc *sc; struct ifnet *ifp; - uint32_t status; + uint32_t status, status_tag; uint16_t rx_prod, tx_cons; sc = (struct bge_softc *)arg; @@ -3685,16 +3843,19 @@ bge_intr_task(void *arg, int pending) rx_prod = sc->bge_ldata.bge_status_block->bge_idx[0].bge_rx_prod_idx; tx_cons = sc->bge_ldata.bge_status_block->bge_idx[0].bge_tx_cons_idx; status = sc->bge_ldata.bge_status_block->bge_status; + status_tag = sc->bge_ldata.bge_status_block->bge_status_tag << 24; sc->bge_ldata.bge_status_block->bge_status = 0; bus_dmamap_sync(sc->bge_cdata.bge_status_tag, sc->bge_cdata.bge_status_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + if ((sc->bge_flags & BGE_FLAG_TAGGED_STATUS) == 0) + status_tag = 0; if ((status & BGE_STATFLAG_LINKSTATE_CHANGED) != 0) bge_link_upd(sc); /* Let controller work. */ - bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); + bge_writembx(sc, BGE_MBX_IRQ0_LO, status_tag); if (ifp->if_drv_flags & IFF_DRV_RUNNING && sc->bge_rx_saved_considx != rx_prod) { @@ -4100,7 +4261,8 @@ bge_check_short_dma(struct mbuf *m) } static struct mbuf * -bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss) +bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss, + uint16_t *flags) { struct ip *ip; struct tcphdr *tcp; @@ -4143,14 +4305,30 @@ bge_setup_tso(struct bge_softc *sc, stru * Broadcom controllers uses different descriptor format for * TSO depending on ASIC revision. Due to TSO-capable firmware * license issue and lower performance of firmware based TSO - * we only support hardware based TSO which is applicable for - * BCM5755 or newer controllers. Hardware based TSO uses 11 - * bits to store MSS and upper 5 bits are used to store IP/TCP - * header length(including IP/TCP options). The header length - * is expressed as 32 bits unit. + * we only support hardware based TSO. */ + /* Calculate header length, incl. TCP/IP options, in 32 bit units. */ hlen = ((ip->ip_hl << 2) + (tcp->th_off << 2)) >> 2; - *mss |= (hlen << 11); + if (sc->bge_flags & BGE_FLAG_TSO3) { + /* + * For BCM5717 and newer controllers, hardware based TSO + * uses the 14 lower bits of the bge_mss field to store the + * MSS and the upper 2 bits to store the lowest 2 bits of + * the IP/TCP header length. The upper 6 bits of the header + * length are stored in the bge_flags[14:10,4] field. Jumbo + * frames are supported. + */ + *mss |= ((hlen & 0x3) << 14); + *flags |= ((hlen & 0xF8) << 7) | ((hlen & 0x4) << 2); + } else { + /* + * For BCM5755 and newer controllers, hardware based TSO uses + * the lower 11 bits to store the MSS and the upper 5 bits to + * store the IP/TCP header length. Jumbo frames are not + * supported. + */ + *mss |= (hlen << 11); + } return (m); } @@ -4180,7 +4358,7 @@ bge_encap(struct bge_softc *sc, struct m m = *m_head; } if ((m->m_pkthdr.csum_flags & CSUM_TSO) != 0) { - *m_head = m = bge_setup_tso(sc, m, &mss); + *m_head = m = bge_setup_tso(sc, m, &mss, &csum_flags); if (*m_head == NULL) return (ENOBUFS); csum_flags |= BGE_TXBDFLAG_CPU_PRE_DMA | @@ -4203,21 +4381,26 @@ bge_encap(struct bge_softc *sc, struct m csum_flags |= BGE_TXBDFLAG_IP_FRAG; } - if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0 && - sc->bge_forced_collapse > 0 && - (sc->bge_flags & BGE_FLAG_PCIE) != 0 && m->m_next != NULL) { - /* - * Forcedly collapse mbuf chains to overcome hardware - * limitation which only support a single outstanding - * DMA read operation. - */ - if (sc->bge_forced_collapse == 1) - m = m_defrag(m, M_DONTWAIT); - else - m = m_collapse(m, M_DONTWAIT, sc->bge_forced_collapse); - if (m == NULL) - m = *m_head; - *m_head = m; + if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0) { + if (sc->bge_flags & BGE_FLAG_JUMBO_FRAME && + m->m_pkthdr.len > ETHER_MAX_LEN) + csum_flags |= BGE_TXBDFLAG_JUMBO_FRAME; + if (sc->bge_forced_collapse > 0 && + (sc->bge_flags & BGE_FLAG_PCIE) != 0 && m->m_next != NULL) { + /* + * Forcedly collapse mbuf chains to overcome hardware + * limitation which only support a single outstanding + * DMA read operation. + */ + if (sc->bge_forced_collapse == 1) + m = m_defrag(m, M_DONTWAIT); + else + m = m_collapse(m, M_DONTWAIT, + sc->bge_forced_collapse); + if (m == NULL) + m = *m_head; + *m_head = m; + } } map = sc->bge_cdata.bge_tx_dmamap[idx]; Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Mon Nov 8 19:53:16 2010 (r214999) +++ stable/7/sys/dev/bge/if_bgereg.h Mon Nov 8 19:54:44 2010 (r215000) @@ -82,6 +82,7 @@ #define BGE_UNMAPPED_END 0x00001FFF #define BGE_DMA_DESCRIPTORS 0x00002000 #define BGE_DMA_DESCRIPTORS_END 0x00003FFF +#define BGE_SEND_RING_5717 0x00004000 #define BGE_SEND_RING_1_TO_4 0x00004000 #define BGE_SEND_RING_1_TO_4_END 0x00005FFF @@ -100,6 +101,8 @@ #define BGE_BUFFPOOL_2_END 0x00017FFF #define BGE_BUFFPOOL_3 0x00018000 /* or expansion ROM */ #define BGE_BUFFPOOL_3_END 0x0001FFFF +#define BGE_STD_RX_RINGS_5717 0x00040000 +#define BGE_JUMBO_RX_RINGS_5717 0x00044400 /* Mappings for external SSRAM configurations */ #define BGE_SEND_RING_5_TO_6 0x00006000 @@ -219,6 +222,7 @@ #define BGE_PCI_ISR_MBX_HI 0xB0 #define BGE_PCI_ISR_MBX_LO 0xB4 #define BGE_PCI_PRODID_ASICREV 0xBC +#define BGE_PCI_GEN2_PRODID_ASICREV 0xF4 /* PCI Misc. Host control register */ #define BGE_PCIMISCCTL_CLEAR_INTA 0x00000001 @@ -229,6 +233,7 @@ #define BGE_PCIMISCCTL_CLOCKCTL_RW 0x00000020 #define BGE_PCIMISCCTL_REG_WORDSWAP 0x00000040 #define BGE_PCIMISCCTL_INDIRECT_ACCESS 0x00000080 +#define BGE_PCIMISCCTL_TAGGED_STATUS 0x00000200 #define BGE_PCIMISCCTL_ASICREV 0xFFFF0000 #define BGE_PCIMISCCTL_ASICREV_SHIFT 16 @@ -311,6 +316,8 @@ #define BGE_CHIPID_BCM5906_A2 0xc002 #define BGE_CHIPID_BCM57780_A0 0x57780000 #define BGE_CHIPID_BCM57780_A1 0x57780001 +#define BGE_CHIPID_BCM5717_A0 0x05717000 +#define BGE_CHIPID_BCM5717_B0 0x05717100 /* shorthand one */ #define BGE_ASICREV(x) ((x) >> 12) @@ -331,6 +338,7 @@ /* Should consult BGE_PCI_PRODID_ASICREV for ChipID */ #define BGE_ASICREV_USE_PRODID_REG 0x0f /* BGE_PCI_PRODID_ASICREV ASIC rev. identifiers. */ +#define BGE_ASICREV_BCM5717 0x5717 #define BGE_ASICREV_BCM5761 0x5761 #define BGE_ASICREV_BCM5784 0x5784 #define BGE_ASICREV_BCM5785 0x5785 @@ -348,11 +356,14 @@ #define BGE_CHIPREV_5750_AX 0x40 #define BGE_CHIPREV_5750_BX 0x41 /* BGE_PCI_PRODID_ASICREV chip rev. identifiers. */ +#define BGE_CHIPREV_5717_AX 0x57170 +#define BGE_CHIPREV_5717_BX 0x57171 #define BGE_CHIPREV_5761_AX 0x57611 #define BGE_CHIPREV_5784_AX 0x57841 /* PCI DMA Read/Write Control register */ #define BGE_PCIDMARWCTL_MINDMA 0x000000FF +#define BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT 0x00000001 #define BGE_PCIDMARWCTL_RDADRR_BNDRY 0x00000700 #define BGE_PCIDMARWCTL_WRADDR_BNDRY 0x00003800 #define BGE_PCIDMARWCTL_ONEDMA_ATONCE 0x0000C000 @@ -566,6 +577,7 @@ #define BGE_TX_RINGS_MAX 4 #define BGE_TX_RINGS_EXTSSRAM_MAX 16 #define BGE_RX_RINGS_MAX 16 +#define BGE_RX_RINGS_MAX_5717 17 /* Ethernet MAC control registers */ #define BGE_MAC_MODE 0x0400 @@ -843,9 +855,10 @@ #define BGE_SGDIGCFG_AUTO 0x80000000 /* SGDIG status (not documented) */ +#define BGE_SGDIGSTS_DONE 0x00000002 +#define BGE_SGDIGSTS_IS_SERDES 0x00000100 #define BGE_SGDIGSTS_PAUSE_CAP 0x00080000 #define BGE_SGDIGSTS_ASYM_PAUSE 0x00100000 -#define BGE_SGDIGSTS_DONE 0x00000002 /* MI communication register */ @@ -911,6 +924,7 @@ #define BGE_SDIMODE_RESET 0x00000001 #define BGE_SDIMODE_ENABLE 0x00000002 #define BGE_SDIMODE_STATS_OFLOW_ATTN 0x00000004 +#define BGE_SDIMODE_HW_LSO_PRE_DMA 0x00000008 /* Send Data Initiator stats register */ #define BGE_SDISTAT_STATS_OFLOW_ATTN 0x00000004 @@ -1188,6 +1202,9 @@ #define BGE_RBDI_STD_REPL_THRESH 0x2C18 #define BGE_RBDI_JUMBO_REPL_THRESH 0x2C1C +#define BGE_STD_REPLENISH_LWM 0x2D00 +#define BGE_JMB_REPLENISH_LWM 0x2D04 + /* Receive BD Initiator Mode register */ #define BGE_RBDIMODE_RESET 0x00000001 #define BGE_RBDIMODE_ENABLE 0x00000002 @@ -1501,6 +1518,7 @@ #define BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN 0x00002000 #define BGE_RDMAMODE_FIFO_SIZE_128 0x00020000 #define BGE_RDMAMODE_FIFO_LONG_BURST 0x00030000 +#define BGE_RDMAMODE_MULT_DMA_RD_DIS 0x01000000 #define BGE_RDMAMODE_TSO4_ENABLE 0x08000000 #define BGE_RDMAMODE_TSO6_ENABLE 0x10000000 @@ -2068,15 +2086,27 @@ struct bge_tx_bd { #define BGE_TXBDFLAG_IP_CSUM 0x0002 #define BGE_TXBDFLAG_END 0x0004 #define BGE_TXBDFLAG_IP_FRAG 0x0008 +#define BGE_TXBDFLAG_JUMBO_FRAME 0x0008 /* 5717 */ #define BGE_TXBDFLAG_IP_FRAG_END 0x0010 +#define BGE_TXBDFLAG_HDRLEN_BIT2 0x0010 /* 5717 */ +#define BGE_TXBDFLAG_SNAP 0x0020 /* 5717 */ #define BGE_TXBDFLAG_VLAN_TAG 0x0040 #define BGE_TXBDFLAG_COAL_NOW 0x0080 #define BGE_TXBDFLAG_CPU_PRE_DMA 0x0100 #define BGE_TXBDFLAG_CPU_POST_DMA 0x0200 +#define BGE_TXBDFLAG_HDRLEN_BIT3 0x0400 /* 5717 */ +#define BGE_TXBDFLAG_HDRLEN_BIT4 0x0800 /* 5717 */ #define BGE_TXBDFLAG_INSERT_SRC_ADDR 0x1000 +#define BGE_TXBDFLAG_HDRLEN_BIT5 0x1000 /* 5717 */ +#define BGE_TXBDFLAG_HDRLEN_BIT6 0x2000 /* 5717 */ +#define BGE_TXBDFLAG_HDRLEN_BIT7 0x4000 /* 5717 */ #define BGE_TXBDFLAG_CHOOSE_SRC_ADDR 0x6000 #define BGE_TXBDFLAG_NO_CRC 0x8000 +#define BGE_TXBDFLAG_MSS_SIZE_MASK 0x3FFF /* 5717 */ +/* Bits [1:0] of the MSS header length. */ +#define BGE_TXBDFLAG_MSS_HDRLEN_MASK 0xC000 /* 5717 */ + #define BGE_NIC_TXRING_ADDR(ringno, size) \ BGE_SEND_RING_1_TO_4 + \ ((ringno * sizeof(struct bge_tx_bd) * size) / 4) @@ -2153,6 +2183,7 @@ struct bge_extrx_bd { #define BGE_RXBDFLAG_IP_CSUM 0x1000 #define BGE_RXBDFLAG_TCP_UDP_CSUM 0x2000 #define BGE_RXBDFLAG_TCP_UDP_IS_TCP 0x4000 +#define BGE_RXBDFLAG_IPV6 0x8000 #define BGE_RXERRFLAG_BAD_CRC 0x0001 #define BGE_RXERRFLAG_COLL_DETECT 0x0002 @@ -2162,6 +2193,7 @@ struct bge_extrx_bd { #define BGE_RXERRFLAG_RUNT 0x0020 #define BGE_RXERRFLAG_TRUNC_NO_RSRCS 0x0040 #define BGE_RXERRFLAG_GIANT 0x0080 +#define BGE_RXERRFLAG_IP_CSUM_NOK 0x1000 /* 5717 */ struct bge_sts_idx { #if BYTE_ORDER == LITTLE_ENDIAN @@ -2175,7 +2207,7 @@ struct bge_sts_idx { struct bge_status_block { uint32_t bge_status; - uint32_t bge_rsvd0; + uint32_t bge_status_tag; #if BYTE_ORDER == LITTLE_ENDIAN uint16_t bge_rx_jumbo_cons_idx; uint16_t bge_rx_std_cons_idx; @@ -2221,6 +2253,8 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5714S 0x1669 #define BCOM_DEVICEID_BCM5715 0x1678 #define BCOM_DEVICEID_BCM5715S 0x1679 +#define BCOM_DEVICEID_BCM5717 0x1655 +#define BCOM_DEVICEID_BCM5718 0x1656 #define BCOM_DEVICEID_BCM5720 0x1658 #define BCOM_DEVICEID_BCM5721 0x1659 #define BCOM_DEVICEID_BCM5722 0x165A @@ -2717,16 +2751,20 @@ struct bge_softc { #define BGE_FLAG_EADDR 0x00000008 #define BGE_FLAG_MII_SERDES 0x00000010 #define BGE_FLAG_CPMU_PRESENT 0x00000020 +#define BGE_FLAG_TAGGED_STATUS 0x00000040 #define BGE_FLAG_MSI 0x00000100 #define BGE_FLAG_PCIX 0x00000200 #define BGE_FLAG_PCIE 0x00000400 #define BGE_FLAG_TSO 0x00000800 +#define BGE_FLAG_TSO3 0x00001000 +#define BGE_FLAG_JUMBO_FRAME 0x00002000 #define BGE_FLAG_5700_FAMILY 0x00010000 #define BGE_FLAG_5705_PLUS 0x00020000 #define BGE_FLAG_5714_FAMILY 0x00040000 #define BGE_FLAG_575X_PLUS 0x00080000 #define BGE_FLAG_5755_PLUS 0x00100000 #define BGE_FLAG_5788 0x00200000 +#define BGE_FLAG_5717_PLUS 0x00400000 #define BGE_FLAG_40BIT_BUG 0x01000000 #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 8 20:16:42 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDA18106566C; Mon, 8 Nov 2010 20:16:42 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB6A78FC22; Mon, 8 Nov 2010 20:16:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8KGgsI051027; Mon, 8 Nov 2010 20:16:42 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8KGgGG051025; Mon, 8 Nov 2010 20:16:42 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011082016.oA8KGgGG051025@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 8 Nov 2010 20:16:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215004 - stable/7/sys/dev/alc X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:16:43 -0000 Author: yongari Date: Mon Nov 8 20:16:42 2010 New Revision: 215004 URL: http://svn.freebsd.org/changeset/base/215004 Log: MFC r214542: Don't bother to enable ASPM L1 to save more power. Even though I am not able to trigger the issue with sample boards, some users seems to suffer from freeze/lockup when system is booted without UTP cable plugged in. I'm not sure whether this is BIOS issue or controller bug. This change fixes AR8132 lockup issue seen on EEE PC. Reported by: kmoore Tested by: kmoore Modified: stable/7/sys/dev/alc/if_alc.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/alc/if_alc.c ============================================================================== --- stable/7/sys/dev/alc/if_alc.c Mon Nov 8 20:14:38 2010 (r215003) +++ stable/7/sys/dev/alc/if_alc.c Mon Nov 8 20:16:42 2010 (r215004) @@ -331,8 +331,8 @@ alc_miibus_statchg(device_t dev) reg = CSR_READ_4(sc, ALC_MAC_CFG); reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB; CSR_WRITE_4(sc, ALC_MAC_CFG, reg); + alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); } - alc_aspm(sc, IFM_SUBTYPE(mii->mii_media_active)); } static void From owner-svn-src-stable-7@FreeBSD.ORG Mon Nov 8 20:21:25 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E1141065670; Mon, 8 Nov 2010 20:21:25 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5AD1C8FC3D; Mon, 8 Nov 2010 20:21:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA8KLPsI051370; Mon, 8 Nov 2010 20:21:25 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA8KLPZv051368; Mon, 8 Nov 2010 20:21:25 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201011082021.oA8KLPZv051368@svn.freebsd.org> From: Ulrich Spoerlein Date: Mon, 8 Nov 2010 20:21:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215005 - in stable: 7/share/misc 8/share/misc X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2010 20:21:25 -0000 Author: uqs Date: Mon Nov 8 20:21:24 2010 New Revision: 215005 URL: http://svn.freebsd.org/changeset/base/215005 Log: MFC r173289,174783,175454,191681,191698,191834,195044,197304,198210,199858-199859,201348,205578,208327,208336,210871,214628: Sync bsd-family-tree with head. Modified: stable/7/share/misc/bsd-family-tree Directory Properties: stable/7/share/misc/ (props changed) Changes in other areas also in this revision: Modified: stable/8/share/misc/bsd-family-tree Directory Properties: stable/8/share/misc/ (props changed) Modified: stable/7/share/misc/bsd-family-tree ============================================================================== --- stable/7/share/misc/bsd-family-tree Mon Nov 8 20:16:42 2010 (r215004) +++ stable/7/share/misc/bsd-family-tree Mon Nov 8 20:21:24 2010 (r215005) @@ -25,7 +25,7 @@ Seventh Edition (V7) | \/ | 3BSD | | | - 4.0BSD 2.7.9BSD + 4.0BSD 2.79BSD | | 4.1BSD --------------> 2.8BSD | | @@ -151,7 +151,7 @@ FreeBSD 4.0 | | | | | NetBSD 1. | FreeBSD 4.5 | | | | | | | | \ | | | | BSD/OS 4.3 | FreeBSD 4.6 \ | | | OpenBSD 3.1 | - | | \ | | NetBSD 1.5.3 | | + | | \ | | NetBSD 1.5.3 | | | FreeBSD 4.6.2 Mac OS X | | | | | 10.2 | | | | FreeBSD 4.7 | | | | @@ -228,10 +228,22 @@ FreeBSD 5.2 | | | FreeBSD 7.1 | | | | | | | | | DragonFly 2.2.0 | FreeBSD 7.2 | NetBSD 5.0 OpenBSD 4.5 | - | | | | | | + | \ | | | | + | | | | | DragonFly 2.4.0 + | | | | OpenBSD 4.6 | + | | | | | | + *--FreeBSD | | | | | + | 8.0 | | | | | + | | FreeBSD | | | | + | | 7.3 | | | DragonFly 2.6.0 + | | | | OpenBSD 4.7 | + | FreeBSD | | | | + | 8.1 | | | | + | | | | | DragonFly 2.8.0 + | | | | OpenBSD 4.8 | | V | | | | | | | | | -FreeBSD 8 -current | NetBSD -current OpenBSD -current | +FreeBSD 9 -current | NetBSD -current OpenBSD -current | | | | | | v v v v v @@ -260,6 +272,7 @@ was the announcement in Usenet or if it [OBD] OpenBSD Project, The. [QCU] Salus, Peter H. A quarter century of UNIX. [SMS] Steven M. Schultz. 2.11BSD, UNIX for the PDP-11. +[TUHS] The Unix Historical Society. http://minnie.tuhs.org/Unix_History/. [USE] Usenet announcement. [WRS] Wind River Systems, Inc. [dmr] Dennis Ritchie, via E-Mail @@ -297,15 +310,15 @@ Tenth Edition 1989-10-xx [QCU] PDP-11, Pascal, ex(1) 30 free copies of 1BSD sent out 35 tapes sold for 50 USD [QCU] -2BSD mid 1978 [QCU] +2BSD mid 1978 [QCU] 1979-05-10 [TUHS] 75 2BSD tapes shipped -2.7.9BSD ?? [SMS] +2.79BSD 1980-04-xx [TUHS] 2.8BSD 1981-07-xx [KSJ] 2.8.1BSD 1982-01-xx [QCU] set of performance improvements 2.9BSD 1983-07-xx [KSJ] -2.9.1BSD 1983-11-xx +2.9.1BSD 1983-11-xx [TUHS] 2.9BSD-Seismo 1985-08-xx [SMS] 2.10BSD 1987-04-xx [KKK] 2.10.1BSD 1989-01-xx [SMS] @@ -313,7 +326,7 @@ Tenth Edition 1989-10-xx [QCU] 2.11BSD rev #430 1999-12-13 [SMS] 32V 1978-1[01]-xx [QCU] -3BSD late 1979 [QCU] +3BSD late 1979 [QCU] March 1980 [TUHS] virtual memory, page replacement, demand paging 4.0BSD 1980-10-xx @@ -501,6 +514,15 @@ DragonFly 2.2.0 2009-02-17 [DFB] NetBSD 5.0 2009-04-29 [NBD] OpenBSD 4.5 2009-05-01 [OBD] FreeBSD 7.2 2009-05-04 [FBD] +DragonFly 2.4.0 2009-09-16 [DFB] +OpenBSD 4.6 2009-10-18 [OBD] +FreeBSD 8.0 2009-11-26 [FBD] +FreeBSD 7.3 2010-03-23 [FBD] +DragonFly 2.6.0 2010-03-28 [DFB] +OpenBSD 4.7 2010-05-19 [OBD] +FreeBSD 8.1 2010-07-24 [FBD] +DragonFly 2.8.0 2010-10-30 [DFB] +OpenBSD 4.8 2010-11-01 [OBD] Bibliography ------------------------ @@ -533,7 +555,7 @@ Andreas Klemm, Lars Köller. If you're go Die freien BSD-Varianten von Unix. c't April 1997, page 368ff. BSD Release Announcements collection. -URL: http://www.de.FreeBSD.org/de/ftp/releases/ +URL: http://www.FreeBSD.org/releases/ BSD Hypertext Man Pages URL: http://www.FreeBSD.org/cgi/man.cgi From owner-svn-src-stable-7@FreeBSD.ORG Tue Nov 9 20:56:56 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EEE61065674; Tue, 9 Nov 2010 20:56:56 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BBFA8FC0A; Tue, 9 Nov 2010 20:56:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA9Kutsq044438; Tue, 9 Nov 2010 20:56:55 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA9KutqY044436; Tue, 9 Nov 2010 20:56:55 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201011092056.oA9KutqY044436@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Tue, 9 Nov 2010 20:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215055 - stable/7/usr.bin/fold X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2010 20:56:56 -0000 Author: dumbbell Date: Tue Nov 9 20:56:55 2010 New Revision: 215055 URL: http://svn.freebsd.org/changeset/base/215055 Log: MFC r214893: Fix a segmentation fault in argument processing. The crash was caused by a command line such as this one: # fold -b1 PR: bin/151592 Reported by: Marcus Reid Tested by: Marcus Reid Modified: stable/7/usr.bin/fold/fold.c Directory Properties: stable/7/usr.bin/fold/ (props changed) Modified: stable/7/usr.bin/fold/fold.c ============================================================================== --- stable/7/usr.bin/fold/fold.c Tue Nov 9 20:46:41 2010 (r215054) +++ stable/7/usr.bin/fold/fold.c Tue Nov 9 20:56:55 2010 (r215055) @@ -71,14 +71,14 @@ int sflag; /* Split on word boundaries int main(int argc, char **argv) { - int ch; + int ch, previous_ch; int rval, width; - char *p; (void) setlocale(LC_CTYPE, ""); width = -1; - while ((ch = getopt(argc, argv, "0123456789bsw:")) != -1) + previous_ch = 0; + while ((ch = getopt(argc, argv, "0123456789bsw:")) != -1) { switch (ch) { case 'b': bflag = 1; @@ -93,17 +93,33 @@ main(int argc, char **argv) break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - if (width == -1) { - p = argv[optind - 1]; - if (p[0] == '-' && p[1] == ch && !p[2]) - width = atoi(++p); - else - width = atoi(argv[optind] + 1); + /* Accept a width as eg. -30. Note that a width + * specified using the -w option is always used prior + * to this undocumented option. */ + switch (previous_ch) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + /* The width is a number with multiple digits: + * add the last one. */ + width = width * 10 + (ch - '0'); + break; + default: + /* Set the width, unless it was previously + * set. For instance, the following options + * would all give a width of 5 and not 10: + * -10 -w5 + * -5b10 + * -5 -10b */ + if (width == -1) + width = ch - '0'; + break; } break; default: usage(); } + previous_ch = ch; + } argv += optind; argc -= optind; From owner-svn-src-stable-7@FreeBSD.ORG Tue Nov 9 21:00:52 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBBC3106564A; Tue, 9 Nov 2010 21:00:51 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D79758FC0A; Tue, 9 Nov 2010 21:00:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA9L0p1b044960; Tue, 9 Nov 2010 21:00:51 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA9L0pOl044958; Tue, 9 Nov 2010 21:00:51 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011092100.oA9L0pOl044958@svn.freebsd.org> From: Marius Strobl Date: Tue, 9 Nov 2010 21:00:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215057 - stable/7/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2010 21:00:52 -0000 Author: marius Date: Tue Nov 9 21:00:51 2010 New Revision: 215057 URL: http://svn.freebsd.org/changeset/base/215057 Log: MFC: r208459, r208511, r214873 - Move Sun Fire V240 to the list of known working machines. - For the parallel stable/7 and stable/8 branches mention both releases that first supported a particular sparc64 machine and update the sparc64 hardware list regarding machines that were supported beginning with 8.1-RELEASE and will be supported beginning with 8.1-RELEASE. Modified: stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml Directory Properties: stable/7/release/doc/en_US.ISO8859-1/hardware/ (props changed) Modified: stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml Tue Nov 9 21:00:24 2010 (r215056) +++ stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml Tue Nov 9 21:00:51 2010 (r215057) @@ -37,6 +37,7 @@ &tm-attrib.freebsd; &tm-attrib.amd; + &tm-attrib.fujitsu; &tm-attrib.ibm; &tm-attrib.intel; &tm-attrib.sparc; @@ -321,15 +322,15 @@ sparc64 This section describes the systems currently known to be supported - by &os; on the &ultrasparc; platform. For background information on the + by &os; on the Fujitsu &sparc64; and Sun &ultrasparc; platforms. For background information on the various hardware designs see the Sun System Handbook. SMP is supported on all systems with more than 1 processor. When using the GENERIC kernel, &os;/&arch.sparc64; systems not equipped with a framebuffer - supported by the &man.creator.4; (&sun; Creator, &sun; Creator3D - and &sun; Elite3D) or &man.machfb.4; (&sun; PGX and &sun; PGX64 + supported by the &man.creator.4; (Sun Creator, Sun Creator3D + and Sun Elite3D) or &man.machfb.4; (Sun PGX and Sun PGX64 as well as the ATI Mach64 chips found onboard in for example &sun.blade; 100, &sun.blade; 150, &sun.ultra; 5 and &sun.ultra; 10) driver must use the serial console. @@ -343,13 +344,16 @@ + Naturetech GENIALstation 777S + + &sun.blade; 100 &sun.blade; 150 - &sun.enterprise; 100 + &sun.enterprise; 150 &sun.enterprise; 220R @@ -364,46 +368,53 @@ &sun.enterprise; 450 + &sun.fire; B100s (support for the on-board NICs first + appeared in 7.2-RELEASE and 8.1-RELEASE) + + &sun.fire; V100 &sun.fire; V120 - &netra; t1 105 + Sun &netra; t1 100/105 - &netra; T1 AC200/DC200 + Sun &netra; T1 AC200/DC200 - &netra; t 1100 + Sun &netra; t 1100 - &netra; t 1120 + Sun &netra; t 1120 - &netra; t 1125 + Sun &netra; t 1125 - &netra; t 1400/1405 + Sun &netra; t 1400/1405 - &netra; 120 + Sun &netra; 120 - &netra; X1 + Sun &netra; X1 - &sparcengine; Ultra AX1105 + Sun &sparcengine; Ultra AX1105 - &sparcengine; Ultra AXe + Sun &sparcengine; Ultra AXe - &sparcengine; Ultra AXi + Sun &sparcengine; Ultra AXi - &sparcengine; Ultra AXmp + Sun &sparcengine; Ultra AXmp + + + Sun &sparcengine; CP1500 &sun.ultra; 1 @@ -437,8 +448,8 @@ The following systems are partially supported by &os;. In particular the fibre channel controllers in SBus-based systems are not supported. However, it is possible to use these with a SCSI controller - supported by the &man.esp.4 driver (&sun; ESP SCSI, &sun; FAS Fast-SCSI - and &sun; FAS366 Fast-Wide SCSI controllers). + supported by the &man.esp.4 driver (Sun ESP SCSI, Sun FAS Fast-SCSI + and Sun FAS366 Fast-Wide SCSI controllers). @@ -449,7 +460,7 @@ - Starting with 7.2-RELEASE, &arch.sparc64; systems based on + Starting with 7.2-RELEASE, &arch.sparc64; systems based on Sun &ultrasparc; III and beyond are also supported by &os;, which includes the following known working systems: @@ -473,8 +484,12 @@ &sun.fire; V210 - &sun.fire; V215 (support first appeared in 7.3-RELEASE) + &sun.fire; V215 (support first appeared in 7.3-RELEASE and 8.1-RELEASE) + + + &sun.fire; V240 + &sun.fire; V250 @@ -484,17 +499,21 @@ &sun.fire; V480 (501-6780 and 501-6790 centerplanes only, for - which support first appeared in 7.3-RELEASE) + which support first appeared in 7.3-RELEASE and 8.1-RELEASE) &sun.fire; V880 + &sun.fire; V890 (support first appeared in 7.4-RELEASE and 8.1-RELEASE, + non-mixed &ultrasparc; IV/IV+ CPU-configurations only) + + &netra; 20/&netra; T4 - The following &ultrasparc; IIIi systems are not tested but + The following Sun &ultrasparc; systems are not tested but believed to be also supported by &os;: @@ -502,12 +521,39 @@ &sun.fire; V125 - &sun.fire; V240 + &sun.fire; V245 (support first appeared in 7.3-RELEASE and 8.1-RELEASE) - &sun.fire; V245 (support first appeared in 7.3-RELEASE) + &sun.fire; V490 (support first appeared in 7.4-RELEASE and 8.1-RELEASE, + non-mixed &ultrasparc; IV/IV+ CPU-configurations only) + + Starting with 7.4-RELEASE and 8.1-RELEASE, &arch.sparc64; systems based on + Fujitsu &sparc64; V are also supported by &os;, which + includes the following known working systems: + + + + Fujitsu &primepower; 250 + + + + The following Fujitsu &primepower; systems are not tested but + believed to be also supported by &os;: + + + + Fujitsu &primepower; 450 + + + Fujitsu &primepower; 650 + + + Fujitsu &primepower; 850 + + + From owner-svn-src-stable-7@FreeBSD.ORG Fri Nov 12 01:45:30 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B1C1106566B; Fri, 12 Nov 2010 01:45:30 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1FA58FC12; Fri, 12 Nov 2010 01:45:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAC1jTvv091660; Fri, 12 Nov 2010 01:45:29 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAC1jTSp091658; Fri, 12 Nov 2010 01:45:29 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201011120145.oAC1jTSp091658@svn.freebsd.org> From: Xin LI Date: Fri, 12 Nov 2010 01:45:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215155 - in stable: 7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Nov 2010 01:45:30 -0000 Author: delphij Date: Fri Nov 12 01:45:29 2010 New Revision: 215155 URL: http://svn.freebsd.org/changeset/base/215155 Log: MFC r214854: Validate whether the zfs_cmd_t submitted from userland is not smaller than what we have. Without the check the kernel could accessing memory that does not belong to the request struct. Note that we do not test if the struct equals in size at this time, which may faciliate forward compatibility with newer binaries. Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.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) Changes in other areas also in this revision: Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.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) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Nov 12 01:40:29 2010 (r215154) +++ stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Nov 12 01:45:29 2010 (r215155) @@ -2989,6 +2989,14 @@ zfsdev_ioctl(struct cdev *dev, u_long cm uint_t vec; int error; + /* + * Check if we have sufficient kernel memory allocated + * for the zfs_cmd_t request. Bail out if not so we + * will not access undefined memory region. + */ + if (IOCPARM_LEN(cmd) < sizeof(zfs_cmd_t)) + return (EINVAL); + vec = ZFS_IOC(cmd); if (vec >= sizeof (zfs_ioc_vec) / sizeof (zfs_ioc_vec[0])) From owner-svn-src-stable-7@FreeBSD.ORG Fri Nov 12 18:10:27 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 602831065693; Fri, 12 Nov 2010 18:10:27 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4CE208FC1C; Fri, 12 Nov 2010 18:10:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oACIARW7018654; Fri, 12 Nov 2010 18:10:27 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oACIAR1x018652; Fri, 12 Nov 2010 18:10:27 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201011121810.oACIAR1x018652@svn.freebsd.org> From: Matthew D Fleming Date: Fri, 12 Nov 2010 18:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215191 - stable/7/sys/kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Nov 2010 18:10:27 -0000 Author: mdf Date: Fri Nov 12 18:10:27 2010 New Revision: 215191 URL: http://svn.freebsd.org/changeset/base/215191 Log: MFC r213813. This is a direct commit because the diff is against several non-MFC'd changes. Use a safer mechanism for determining if a task is currently running, that does not rely on the lifetime of pointers being the same. This also restores the task KBI. Modified: stable/7/sys/kern/subr_taskqueue.c Modified: stable/7/sys/kern/subr_taskqueue.c ============================================================================== --- stable/7/sys/kern/subr_taskqueue.c Fri Nov 12 18:09:06 2010 (r215190) +++ stable/7/sys/kern/subr_taskqueue.c Fri Nov 12 18:10:27 2010 (r215191) @@ -48,13 +48,18 @@ static void *taskqueue_ih; static STAILQ_HEAD(taskqueue_list, taskqueue) taskqueue_queues; static struct mtx taskqueue_queues_mutex; +struct taskqueue_busy { + struct task *tb_running; + TAILQ_ENTRY(taskqueue_busy) tb_link; +}; + struct taskqueue { STAILQ_ENTRY(taskqueue) tq_link; STAILQ_HEAD(, task) tq_queue; const char *tq_name; taskqueue_enqueue_fn tq_enqueue; void *tq_context; - struct task *tq_running; + TAILQ_HEAD(, taskqueue_busy) tq_active; struct mtx tq_mutex; struct proc **tq_pproc; int tq_pcount; @@ -66,6 +71,8 @@ struct taskqueue { #define TQ_FLAGS_BLOCKED (1 << 1) #define TQ_FLAGS_PENDING (1 << 2) +static void taskqueue_run_locked(struct taskqueue *); + static __inline void TQ_LOCK(struct taskqueue *tq) { @@ -117,6 +124,7 @@ _taskqueue_create(const char *name, int return 0; STAILQ_INIT(&queue->tq_queue); + TAILQ_INIT(&queue->tq_active); queue->tq_name = name; queue->tq_enqueue = enqueue; queue->tq_context = context; @@ -162,8 +170,9 @@ taskqueue_free(struct taskqueue *queue) TQ_LOCK(queue); queue->tq_flags &= ~TQ_FLAGS_ACTIVE; - taskqueue_run(queue); + taskqueue_run_locked(queue); taskqueue_terminate(queue->tq_pproc, queue); + KASSERT(TAILQ_EMPTY(&queue->tq_active), ("Tasks still running?")); mtx_destroy(&queue->tq_mutex); free(queue->tq_pproc, M_TASKQUEUE); free(queue, M_TASKQUEUE); @@ -258,15 +267,17 @@ taskqueue_unblock(struct taskqueue *queu TQ_UNLOCK(queue); } -void -taskqueue_run(struct taskqueue *queue) +static void +taskqueue_run_locked(struct taskqueue *queue) { + struct taskqueue_busy tb; struct task *task; - int owned, pending; + int pending; + + mtx_assert(&queue->tq_mutex, MA_OWNED); + tb.tb_running = NULL; + TAILQ_INSERT_TAIL(&queue->tq_active, &tb, tb_link); - owned = mtx_owned(&queue->tq_mutex); - if (!owned) - TQ_LOCK(queue); while (STAILQ_FIRST(&queue->tq_queue)) { /* * Carefully remove the first task from the queue and @@ -276,22 +287,38 @@ taskqueue_run(struct taskqueue *queue) STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); pending = task->ta_pending; task->ta_pending = 0; - queue->tq_running = task; + tb.tb_running = task; TQ_UNLOCK(queue); task->ta_func(task->ta_context, pending); TQ_LOCK(queue); - queue->tq_running = NULL; + tb.tb_running = NULL; wakeup(task); } + TAILQ_REMOVE(&queue->tq_active, &tb, tb_link); +} - /* - * For compatibility, unlock on return if the queue was not locked - * on entry, although this opens a race window. - */ - if (!owned) - TQ_UNLOCK(queue); +void +taskqueue_run(struct taskqueue *queue) +{ + + TQ_LOCK(queue); + taskqueue_run_locked(queue); + TQ_UNLOCK(queue); +} + +static int +task_is_running(struct taskqueue *queue, struct task *task) +{ + struct taskqueue_busy *tb; + + mtx_assert(&queue->tq_mutex, MA_OWNED); + TAILQ_FOREACH(tb, &queue->tq_active, tb_link) { + if (tb->tb_running == task) + return (1); + } + return (0); } void @@ -299,14 +326,14 @@ taskqueue_drain(struct taskqueue *queue, { if (queue->tq_spin) { /* XXX */ mtx_lock_spin(&queue->tq_mutex); - while (task->ta_pending != 0 || task == queue->tq_running) + while (task->ta_pending != 0 || task_is_running(queue, task)) msleep_spin(task, &queue->tq_mutex, "-", 0); mtx_unlock_spin(&queue->tq_mutex); } else { WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); mtx_lock(&queue->tq_mutex); - while (task->ta_pending != 0 || task == queue->tq_running) + while (task->ta_pending != 0 || task_is_running(queue, task)) msleep(task, &queue->tq_mutex, PWAIT, "-", 0); mtx_unlock(&queue->tq_mutex); } @@ -398,7 +425,7 @@ taskqueue_thread_loop(void *arg) tq = *tqp; TQ_LOCK(tq); while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) { - taskqueue_run(tq); + taskqueue_run_locked(tq); TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0); } From owner-svn-src-stable-7@FreeBSD.ORG Sat Nov 13 00:55:17 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 010DE1065672; Sat, 13 Nov 2010 00:55:17 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1D1A8FC16; Sat, 13 Nov 2010 00:55:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAD0tGQ6029488; Sat, 13 Nov 2010 00:55:16 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAD0tGLR029486; Sat, 13 Nov 2010 00:55:16 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011130055.oAD0tGLR029486@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 13 Nov 2010 00:55:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215215 - stable/7/sys/dev/sk X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Nov 2010 00:55:17 -0000 Author: yongari Date: Sat Nov 13 00:55:16 2010 New Revision: 215215 URL: http://svn.freebsd.org/changeset/base/215215 Log: MFC r214898: If we got an invalid station address, generate random address. This might be caused by broken BIOS. Reported by: "Mikhail T." aldan.algebra.com> Modified: stable/7/sys/dev/sk/if_sk.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/sk/if_sk.c ============================================================================== --- stable/7/sys/dev/sk/if_sk.c Sat Nov 13 00:46:07 2010 (r215214) +++ stable/7/sys/dev/sk/if_sk.c Sat Nov 13 00:55:16 2010 (r215215) @@ -1319,8 +1319,10 @@ sk_attach(dev) struct sk_softc *sc; struct sk_if_softc *sc_if; struct ifnet *ifp; + u_int32_t r; int error, i, phy, port; u_char eaddr[6]; + u_char inv_mac[] = {0, 0, 0, 0, 0, 0}; if (dev == NULL) return(EINVAL); @@ -1402,6 +1404,23 @@ sk_attach(dev) eaddr[i] = sk_win_read_1(sc, SK_MAC0_0 + (port * 8) + i); + /* Verify whether the station address is invalid or not. */ + if (bcmp(eaddr, inv_mac, sizeof(inv_mac)) == 0) { + device_printf(sc_if->sk_if_dev, + "Generating random ethernet address\n"); + r = arc4random(); + /* + * Set OUI to convenient locally assigned address. 'b' + * is 0x62, which has the locally assigned bit set, and + * the broadcast/multicast bit clear. + */ + eaddr[0] = 'b'; + eaddr[1] = 's'; + eaddr[2] = 'd'; + eaddr[3] = (r >> 16) & 0xff; + eaddr[4] = (r >> 8) & 0xff; + eaddr[5] = (r >> 0) & 0xff; + } /* * Set up RAM buffer addresses. The NIC will have a certain * amount of SRAM on it, somewhere between 512K and 2MB. We From owner-svn-src-stable-7@FreeBSD.ORG Sat Nov 13 01:00:01 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22EFB1065670; Sat, 13 Nov 2010 01:00:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D9E6B8FC0A; Sat, 13 Nov 2010 01:00:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAD100QS029687; Sat, 13 Nov 2010 01:00:00 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAD100q2029685; Sat, 13 Nov 2010 01:00:00 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011130100.oAD100q2029685@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 13 Nov 2010 01:00:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215217 - stable/7/sys/dev/sk X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Nov 2010 01:00:01 -0000 Author: yongari Date: Sat Nov 13 01:00:00 2010 New Revision: 215217 URL: http://svn.freebsd.org/changeset/base/215217 Log: MFC r214899: Fix a long standing bug in programming station address for Yukon controllers. sk(4) never reprogrammed station address for Yukon controllers so overriding station address with ifconfig(8) was not possible. Fix the bug by reprogramming all registers that control station address, flow-control and virtual station address. Virtual station address has no use at this moment since driver does not make use of fail over feature. Tested by: "Mikhail T." aldan.algebra.com> Modified: stable/7/sys/dev/sk/if_sk.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/sk/if_sk.c ============================================================================== --- stable/7/sys/dev/sk/if_sk.c Sat Nov 13 00:58:34 2010 (r215216) +++ stable/7/sys/dev/sk/if_sk.c Sat Nov 13 01:00:00 2010 (r215217) @@ -3358,6 +3358,7 @@ sk_init_yukon(sc_if) u_int16_t reg; struct sk_softc *sc; struct ifnet *ifp; + u_int8_t *eaddr; int i; SK_IF_LOCK_ASSERT(sc_if); @@ -3433,19 +3434,19 @@ sk_init_yukon(sc_if) reg |= YU_SMR_MFL_JUMBO; SK_YU_WRITE_2(sc_if, YUKON_SMR, reg); - /* Setup Yukon's address */ - for (i = 0; i < 3; i++) { - /* Write Source Address 1 (unicast filter) */ + /* Setup Yukon's station address */ + eaddr = IF_LLADDR(sc_if->sk_ifp); + for (i = 0; i < 3; i++) + SK_YU_WRITE_2(sc_if, SK_MAC0_0 + i * 4, + eaddr[i * 2] | eaddr[i * 2 + 1] << 8); + /* Set GMAC source address of flow control. */ + for (i = 0; i < 3; i++) SK_YU_WRITE_2(sc_if, YUKON_SAL1 + i * 4, - IF_LLADDR(sc_if->sk_ifp)[i * 2] | - IF_LLADDR(sc_if->sk_ifp)[i * 2 + 1] << 8); - } - - for (i = 0; i < 3; i++) { - reg = sk_win_read_2(sc_if->sk_softc, - SK_MAC1_0 + i * 2 + sc_if->sk_port * 8); - SK_YU_WRITE_2(sc_if, YUKON_SAL2 + i * 4, reg); - } + eaddr[i * 2] | eaddr[i * 2 + 1] << 8); + /* Set GMAC virtual address. */ + for (i = 0; i < 3; i++) + SK_YU_WRITE_2(sc_if, YUKON_SAL2 + i * 4, + eaddr[i * 2] | eaddr[i * 2 + 1] << 8); /* Set Rx filter */ sk_rxfilter_yukon(sc_if); From owner-svn-src-stable-7@FreeBSD.ORG Sat Nov 13 01:03:34 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AB69106566C; Sat, 13 Nov 2010 01:03:34 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2777F8FC1B; Sat, 13 Nov 2010 01:03:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAD13Yxu029889; Sat, 13 Nov 2010 01:03:34 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAD13YUZ029887; Sat, 13 Nov 2010 01:03:34 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011130103.oAD13YUZ029887@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 13 Nov 2010 01:03:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215219 - stable/7/sys/dev/re X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Nov 2010 01:03:34 -0000 Author: yongari Date: Sat Nov 13 01:03:33 2010 New Revision: 215219 URL: http://svn.freebsd.org/changeset/base/215219 Log: MFC r214840: Enable 64bit DMA addressing for RTL810xE/RTL8168/RTL8111 PCIe controllers. Some old PCI controllers may work with DAC but it was known to be buggy so 64bit DMA addressing is used only on PCIe controllers. Modified: stable/7/sys/dev/re/if_re.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/re/if_re.c ============================================================================== --- stable/7/sys/dev/re/if_re.c Sat Nov 13 01:02:09 2010 (r215218) +++ stable/7/sys/dev/re/if_re.c Sat Nov 13 01:03:33 2010 (r215219) @@ -935,6 +935,7 @@ re_dma_map_addr(void *arg, bus_dma_segme static int re_allocmem(device_t dev, struct rl_softc *sc) { + bus_addr_t lowaddr; bus_size_t rx_list_size, tx_list_size; int error; int i; @@ -948,10 +949,13 @@ re_allocmem(device_t dev, struct rl_soft * register should be set. However some RealTek chips are known * to be buggy on DAC handling, therefore disable DAC by limiting * DMA address space to 32bit. PCIe variants of RealTek chips - * may not have the limitation but I took safer path. + * may not have the limitation. */ + lowaddr = BUS_SPACE_MAXADDR; + if ((sc->rl_flags & RL_FLAG_PCIE) == 0) + lowaddr = BUS_SPACE_MAXADDR_32BIT; error = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, - BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + lowaddr, BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &sc->rl_parent_tag); if (error) { From owner-svn-src-stable-7@FreeBSD.ORG Sat Nov 13 01:07:46 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46CA8106564A; Sat, 13 Nov 2010 01:07:46 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 193F78FC08; Sat, 13 Nov 2010 01:07:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAD17jm3030097; Sat, 13 Nov 2010 01:07:46 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAD17jRB030095; Sat, 13 Nov 2010 01:07:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011130107.oAD17jRB030095@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 13 Nov 2010 01:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215221 - stable/7/sys/dev/re X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Nov 2010 01:07:46 -0000 Author: yongari Date: Sat Nov 13 01:07:45 2010 New Revision: 215221 URL: http://svn.freebsd.org/changeset/base/215221 Log: MFC r214841-214842: r214841: Remove extra white spaces. r214842: style(9). Modified: stable/7/sys/dev/re/if_re.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/re/if_re.c ============================================================================== --- stable/7/sys/dev/re/if_re.c Sat Nov 13 01:05:47 2010 (r215220) +++ stable/7/sys/dev/re/if_re.c Sat Nov 13 01:07:45 2010 (r215221) @@ -881,7 +881,7 @@ re_probe(device_t dev) uint16_t devid, vendor; uint16_t revid, sdevid; int i; - + vendor = pci_get_vendor(dev); devid = pci_get_device(dev); revid = pci_get_revid(dev); @@ -1122,7 +1122,7 @@ re_attach(device_t dev) /* * Prefer memory space register mapping over IO space. * Because RTL8169SC does not seem to work when memory mapping - * is used always activate io mapping. + * is used always activate io mapping. */ if (devid == RT_DEVICEID_8169SC) prefer_iomap = 1; @@ -2018,9 +2018,9 @@ re_rxeof(struct rl_softc *sc) sc->rl_ldata.rl_rx_prodidx = i; if (maxpkt) - return(EAGAIN); + return (EAGAIN); - return(0); + return (0); } static void @@ -2109,7 +2109,7 @@ re_tick(void *xsc) * Reclaim transmitted frames here. Technically it is not * necessary to do here but it ensures periodic reclamation * regardless of Tx completion interrupt which seems to be - * lost on PCIe based controllers under certain situations. + * lost on PCIe based controllers under certain situations. */ re_txeof(sc); re_watchdog(sc); @@ -2833,7 +2833,7 @@ re_ioctl(struct ifnet *ifp, u_long comma if (ifr->ifr_reqcap & IFCAP_POLLING) { error = ether_poll_register(re_poll, ifp); if (error) - return(error); + return (error); RL_LOCK(sc); /* Disable interrupts */ CSR_WRITE_2(sc, RL_IMR, 0x0000); From owner-svn-src-stable-7@FreeBSD.ORG Sat Nov 13 01:11:14 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31D0B106566B; Sat, 13 Nov 2010 01:11:14 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DB068FC12; Sat, 13 Nov 2010 01:11:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAD1BE4t030280; Sat, 13 Nov 2010 01:11:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAD1BDVk030277; Sat, 13 Nov 2010 01:11:13 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201011130111.oAD1BDVk030277@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 13 Nov 2010 01:11:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215223 - in stable/7/sys: dev/re pci X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Nov 2010 01:11:14 -0000 Author: yongari Date: Sat Nov 13 01:11:13 2010 New Revision: 215223 URL: http://svn.freebsd.org/changeset/base/215223 Log: MFC r214844: Add simple MAC statistics counter reading support. Unfortunately useful counters like rl_missed_pkts is 16 bits quantity which is too small to hold meaningful information happened in a second. This means driver should frequently read these counters in order not to lose accuracy and that approach is too inefficient in driver's view. Moreover it seems there is no way to trigger an interrupt to detect counter near-full or wraparound event as well as lacking clearing the MAC counters. Another limitation of reading the counters from RealTek controllers is lack of interrupt firing at the end of DMA cycle of MAC counter read request such that driver have to poll the end of the DMA which is a time consuming process as well as inefficient. The more severe issue of the MAC counter read request is it takes too long to complete the DMA. All these limitation made maintaining MAC counters in driver impractical. For now, just provide simple sysctl interface to trigger reading the MAC counters. These counters could be used to track down driver issues. Users can read MAC counters maintained in controller with the following command. #sysctl dev.re.0.stats=1 While I'm here add check for validity of dma map and allocated memory before unloading/freeing them. Tested by: rmacklem Modified: stable/7/sys/dev/re/if_re.c stable/7/sys/pci/if_rlreg.h 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/re/if_re.c ============================================================================== --- stable/7/sys/dev/re/if_re.c Sat Nov 13 01:09:44 2010 (r215222) +++ stable/7/sys/dev/re/if_re.c Sat Nov 13 01:11:13 2010 (r215223) @@ -123,6 +123,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -281,6 +282,9 @@ static void re_clrwol (struct rl_softc static int re_diag (struct rl_softc *); #endif +static void re_add_sysctls (struct rl_softc *); +static int re_sysctl_stats (SYSCTL_HANDLER_ARGS); + static device_method_t re_methods[] = { /* Device interface */ DEVMETHOD(device_probe, re_probe), @@ -1085,6 +1089,35 @@ re_allocmem(device_t dev, struct rl_soft } } + /* Create DMA map for statistics. */ + error = bus_dma_tag_create(sc->rl_parent_tag, RL_DUMP_ALIGN, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + sizeof(struct rl_stats), 1, sizeof(struct rl_stats), 0, NULL, NULL, + &sc->rl_ldata.rl_stag); + if (error) { + device_printf(dev, "could not create statistics DMA tag\n"); + return (error); + } + /* Allocate DMA'able memory for statistics. */ + error = bus_dmamem_alloc(sc->rl_ldata.rl_stag, + (void **)&sc->rl_ldata.rl_stats, + BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_ZERO, + &sc->rl_ldata.rl_smap); + if (error) { + device_printf(dev, + "could not allocate statistics DMA memory\n"); + return (error); + } + /* Load the map for statistics. */ + sc->rl_ldata.rl_stats_addr = 0; + error = bus_dmamap_load(sc->rl_ldata.rl_stag, sc->rl_ldata.rl_smap, + sc->rl_ldata.rl_stats, sizeof(struct rl_stats), re_dma_map_addr, + &sc->rl_ldata.rl_stats_addr, BUS_DMA_NOWAIT); + if (error != 0 || sc->rl_ldata.rl_stats_addr == 0) { + device_printf(dev, "could not load statistics DMA memory\n"); + return (ENOMEM); + } + return (0); } @@ -1375,6 +1408,7 @@ re_attach(device_t dev) error = re_allocmem(dev, sc); if (error) goto fail; + re_add_sysctls(sc); ifp = sc->rl_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { @@ -1604,22 +1638,26 @@ re_detach(device_t dev) /* Unload and free the RX DMA ring memory and map */ if (sc->rl_ldata.rl_rx_list_tag) { - bus_dmamap_unload(sc->rl_ldata.rl_rx_list_tag, - sc->rl_ldata.rl_rx_list_map); - bus_dmamem_free(sc->rl_ldata.rl_rx_list_tag, - sc->rl_ldata.rl_rx_list, - sc->rl_ldata.rl_rx_list_map); + if (sc->rl_ldata.rl_rx_list_map) + bus_dmamap_unload(sc->rl_ldata.rl_rx_list_tag, + sc->rl_ldata.rl_rx_list_map); + if (sc->rl_ldata.rl_rx_list_map && sc->rl_ldata.rl_rx_list) + bus_dmamem_free(sc->rl_ldata.rl_rx_list_tag, + sc->rl_ldata.rl_rx_list, + sc->rl_ldata.rl_rx_list_map); bus_dma_tag_destroy(sc->rl_ldata.rl_rx_list_tag); } /* Unload and free the TX DMA ring memory and map */ if (sc->rl_ldata.rl_tx_list_tag) { - bus_dmamap_unload(sc->rl_ldata.rl_tx_list_tag, - sc->rl_ldata.rl_tx_list_map); - bus_dmamem_free(sc->rl_ldata.rl_tx_list_tag, - sc->rl_ldata.rl_tx_list, - sc->rl_ldata.rl_tx_list_map); + if (sc->rl_ldata.rl_tx_list_map) + bus_dmamap_unload(sc->rl_ldata.rl_tx_list_tag, + sc->rl_ldata.rl_tx_list_map); + if (sc->rl_ldata.rl_tx_list_map && sc->rl_ldata.rl_tx_list) + bus_dmamem_free(sc->rl_ldata.rl_tx_list_tag, + sc->rl_ldata.rl_tx_list, + sc->rl_ldata.rl_tx_list_map); bus_dma_tag_destroy(sc->rl_ldata.rl_tx_list_tag); } @@ -1644,11 +1682,12 @@ re_detach(device_t dev) /* Unload and free the stats buffer and map */ if (sc->rl_ldata.rl_stag) { - bus_dmamap_unload(sc->rl_ldata.rl_stag, - sc->rl_ldata.rl_rx_list_map); - bus_dmamem_free(sc->rl_ldata.rl_stag, - sc->rl_ldata.rl_stats, - sc->rl_ldata.rl_smap); + if (sc->rl_ldata.rl_smap) + bus_dmamap_unload(sc->rl_ldata.rl_stag, + sc->rl_ldata.rl_smap); + if (sc->rl_ldata.rl_smap && sc->rl_ldata.rl_stats) + bus_dmamem_free(sc->rl_ldata.rl_stag, + sc->rl_ldata.rl_stats, sc->rl_ldata.rl_smap); bus_dma_tag_destroy(sc->rl_ldata.rl_stag); } @@ -3179,3 +3218,88 @@ re_clrwol(struct rl_softc *sc) v &= ~RL_CFG5_WOL_LANWAKE; CSR_WRITE_1(sc, RL_CFG5, v); } + +static void +re_add_sysctls(struct rl_softc *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *children; + + ctx = device_get_sysctl_ctx(sc->rl_dev); + children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->rl_dev)); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "stats", + CTLTYPE_INT | CTLFLAG_RW, sc, 0, re_sysctl_stats, "I", + "Statistics Information"); +} + +static int +re_sysctl_stats(SYSCTL_HANDLER_ARGS) +{ + struct rl_softc *sc; + struct rl_stats *stats; + int error, i, result; + + result = -1; + error = sysctl_handle_int(oidp, &result, 0, req); + if (error || req->newptr == NULL) + return (error); + + if (result == 1) { + sc = (struct rl_softc *)arg1; + RL_LOCK(sc); + bus_dmamap_sync(sc->rl_ldata.rl_stag, + sc->rl_ldata.rl_smap, BUS_DMASYNC_PREREAD); + CSR_WRITE_4(sc, RL_DUMPSTATS_HI, + RL_ADDR_HI(sc->rl_ldata.rl_stats_addr)); + CSR_WRITE_4(sc, RL_DUMPSTATS_LO, + RL_ADDR_LO(sc->rl_ldata.rl_stats_addr)); + CSR_WRITE_4(sc, RL_DUMPSTATS_LO, + RL_ADDR_LO(sc->rl_ldata.rl_stats_addr | + RL_DUMPSTATS_START)); + for (i = RL_TIMEOUT; i > 0; i--) { + if ((CSR_READ_4(sc, RL_DUMPSTATS_LO) & + RL_DUMPSTATS_START) == 0) + break; + DELAY(1000); + } + bus_dmamap_sync(sc->rl_ldata.rl_stag, + sc->rl_ldata.rl_smap, BUS_DMASYNC_POSTREAD); + RL_UNLOCK(sc); + if (i == 0) { + device_printf(sc->rl_dev, + "DUMP statistics request timedout\n"); + return (ETIMEDOUT); + } + stats = sc->rl_ldata.rl_stats; + printf("%s statistics:\n", device_get_nameunit(sc->rl_dev)); + printf("Tx frames : %ju\n", + (uintmax_t)le64toh(stats->rl_tx_pkts)); + printf("Rx frames : %ju\n", + (uintmax_t)le64toh(stats->rl_rx_pkts)); + printf("Tx errors : %ju\n", + (uintmax_t)le64toh(stats->rl_tx_errs)); + printf("Rx errors : %u\n", + le32toh(stats->rl_rx_errs)); + printf("Rx missed frames : %u\n", + (uint32_t)le16toh(stats->rl_missed_pkts)); + printf("Rx frame alignment errs : %u\n", + (uint32_t)le16toh(stats->rl_rx_framealign_errs)); + printf("Tx single collisions : %u\n", + le32toh(stats->rl_tx_onecoll)); + printf("Tx multiple collisions : %u\n", + le32toh(stats->rl_tx_multicolls)); + printf("Rx unicast frames : %ju\n", + (uintmax_t)le64toh(stats->rl_rx_ucasts)); + printf("Rx broadcast frames : %ju\n", + (uintmax_t)le64toh(stats->rl_rx_bcasts)); + printf("Rx multicast frames : %u\n", + le32toh(stats->rl_rx_mcasts)); + printf("Tx aborts : %u\n", + (uint32_t)le16toh(stats->rl_tx_aborts)); + printf("Tx underruns : %u\n", + (uint32_t)le16toh(stats->rl_rx_underruns)); + } + + return (error); +} Modified: stable/7/sys/pci/if_rlreg.h ============================================================================== --- stable/7/sys/pci/if_rlreg.h Sat Nov 13 01:09:44 2010 (r215222) +++ stable/7/sys/pci/if_rlreg.h Sat Nov 13 01:11:13 2010 (r215223) @@ -723,19 +723,16 @@ struct rl_desc { * Statistics counter structure (8139C+ and 8169 only) */ struct rl_stats { - uint32_t rl_tx_pkts_lo; - uint32_t rl_tx_pkts_hi; - uint32_t rl_tx_errs_lo; - uint32_t rl_tx_errs_hi; - uint32_t rl_tx_errs; + uint64_t rl_tx_pkts; + uint64_t rl_rx_pkts; + uint64_t rl_tx_errs; + uint32_t rl_rx_errs; uint16_t rl_missed_pkts; uint16_t rl_rx_framealign_errs; uint32_t rl_tx_onecoll; uint32_t rl_tx_multicolls; - uint32_t rl_rx_ucasts_hi; - uint32_t rl_rx_ucasts_lo; - uint32_t rl_rx_bcasts_lo; - uint32_t rl_rx_bcasts_hi; + uint64_t rl_rx_ucasts; + uint64_t rl_rx_bcasts; uint32_t rl_rx_mcasts; uint16_t rl_tx_aborts; uint16_t rl_rx_underruns; @@ -769,6 +766,7 @@ struct rl_stats { #define RL_NTXSEGS 32 #define RL_RING_ALIGN 256 +#define RL_DUMP_ALIGN 64 #define RL_IFQ_MAXLEN 512 #define RL_TX_DESC_NXT(sc,x) ((x + 1) & ((sc)->rl_ldata.rl_tx_desc_cnt - 1)) #define RL_TX_DESC_PRV(sc,x) ((x - 1) & ((sc)->rl_ldata.rl_tx_desc_cnt - 1)) From owner-svn-src-stable-7@FreeBSD.ORG Sat Nov 13 13:46:35 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E204A10656CC; Sat, 13 Nov 2010 13:46:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 041398FC1E; Sat, 13 Nov 2010 13:46:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oADDkXlK049478; Sat, 13 Nov 2010 13:46:33 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oADDkXcc049476; Sat, 13 Nov 2010 13:46:33 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011131346.oADDkXcc049476@svn.freebsd.org> From: Marius Strobl Date: Sat, 13 Nov 2010 13:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215243 - stable/7/release/sparc64 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Nov 2010 13:46:35 -0000 Author: marius Date: Sat Nov 13 13:46:33 2010 New Revision: 215243 URL: http://svn.freebsd.org/changeset/base/215243 Log: MFC: r214940 Add gpart and glabel to the release CD mfsroot. Modified: stable/7/release/sparc64/boot_crunch.conf Directory Properties: stable/7/release/ (props changed) stable/7/release/doc/ (props changed) stable/7/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/7/release/picobsd/tinyware/login/ (props changed) Modified: stable/7/release/sparc64/boot_crunch.conf ============================================================================== --- stable/7/release/sparc64/boot_crunch.conf Sat Nov 13 13:46:31 2010 (r215242) +++ stable/7/release/sparc64/boot_crunch.conf Sat Nov 13 13:46:33 2010 (r215243) @@ -18,6 +18,7 @@ srcdirs /usr/src/sbin progs camcontrol progs dhclient progs fsck_ffs +progs geom progs ifconfig progs mount_nfs progs newfs @@ -27,6 +28,8 @@ progs slattach progs tunefs ln fsck_ffs fsck_4.2bsd ln fsck_ffs fsck_ufs +ln geom glabel +ln geom gpart srcdirs /usr/src/usr.bin progs find @@ -43,4 +46,4 @@ progs sysinstall progs usbdevs libs -ll -ledit -lutil -lmd -lcrypt -lftpio -lz -lnetgraph -libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs +libs -ldialog -lncurses -ldisk -lcam -lsbuf -lufs -lgeom -lbsdxml