From owner-svn-src-head@FreeBSD.ORG Sun Nov 14 15:15:23 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A4001065695; Sun, 14 Nov 2010 15:15:23 +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 07AD88FC08; Sun, 14 Nov 2010 15:15:23 +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 oAEFFMol085601; Sun, 14 Nov 2010 15:15:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAEFFMfa085598; Sun, 14 Nov 2010 15:15:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201011141515.oAEFFMfa085598@svn.freebsd.org> From: Marius Strobl Date: Sun, 14 Nov 2010 15:15:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215302 - in head/sys/dev: bge mii X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Nov 2010 15:15:23 -0000 Author: marius Date: Sun Nov 14 15:15:22 2010 New Revision: 215302 URL: http://svn.freebsd.org/changeset/base/215302 Log: Move the limiting of the PHY to 10/100 modes of operation due to limitations of certain MAC models from brgphy(4) to bge(4) where it belongs. While at it, update the list of models having that restriction to what OpenBSD uses, which in turn seems to have obtained that information from the Linux tg3 driver. Modified: head/sys/dev/bge/if_bge.c head/sys/dev/mii/brgphy.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Sun Nov 14 14:37:20 2010 (r215301) +++ head/sys/dev/bge/if_bge.c Sun Nov 14 15:15:22 2010 (r215302) @@ -2640,7 +2640,7 @@ bge_attach(device_t dev) struct bge_softc *sc; uint32_t hwcfg = 0, misccfg; u_char eaddr[ETHER_ADDR_LEN]; - int error, f, msicount, phy_addr, reg, rid, trys; + int capmask, error, f, msicount, phy_addr, reg, rid, trys; sc = device_get_softc(dev); sc->bge_dev = dev; @@ -2824,13 +2824,31 @@ bge_attach(device_t dev) if (BGE_IS_5755_PLUS(sc) == 0) sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; + misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; if (sc->bge_asicrev == BGE_ASICREV_BCM5705) { - misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; if (misccfg == BGE_MISCCFG_BOARD_ID_5788 || misccfg == BGE_MISCCFG_BOARD_ID_5788M) sc->bge_flags |= BGE_FLAG_5788; } + capmask = BMSR_DEFCAPMASK; + if ((sc->bge_asicrev == BGE_ASICREV_BCM5703 && + (misccfg == 0x4000 || misccfg == 0x8000)) || + (sc->bge_asicrev == BGE_ASICREV_BCM5705 && + pci_get_vendor(dev) == BCOM_VENDORID && + (pci_get_device(dev) == BCOM_DEVICEID_BCM5901 || + pci_get_device(dev) == BCOM_DEVICEID_BCM5901A2 || + pci_get_device(dev) == BCOM_DEVICEID_BCM5705F)) || + (pci_get_vendor(dev) == BCOM_VENDORID && + (pci_get_device(dev) == BCOM_DEVICEID_BCM5751F || + pci_get_device(dev) == BCOM_DEVICEID_BCM5753F || + pci_get_device(dev) == BCOM_DEVICEID_BCM5787F)) || + pci_get_device(dev) == BCOM_DEVICEID_BCM57790 || + sc->bge_asicrev == BGE_ASICREV_BCM5906) { + /* These chips are 10/100 only. */ + capmask &= ~BMSR_EXTSTAT; + } + /* * Some controllers seem to require a special firmware to use * TSO. But the firmware is not available to FreeBSD and Linux @@ -3104,9 +3122,9 @@ bge_attach(device_t dev) again: bge_asf_driver_up(sc); - error = mii_attach(dev, &sc->bge_miibus, ifp, - bge_ifmedia_upd, bge_ifmedia_sts, BMSR_DEFCAPMASK, - phy_addr, MII_OFFSET_ANY, MIIF_DOPAUSE); + error = mii_attach(dev, &sc->bge_miibus, ifp, bge_ifmedia_upd, + bge_ifmedia_sts, capmask, phy_addr, MII_OFFSET_ANY, + MIIF_DOPAUSE); if (error != 0) { if (trys++ < 4) { device_printf(sc->bge_dev, "Try again\n"); Modified: head/sys/dev/mii/brgphy.c ============================================================================== --- head/sys/dev/mii/brgphy.c Sun Nov 14 14:37:20 2010 (r215301) +++ head/sys/dev/mii/brgphy.c Sun Nov 14 15:15:22 2010 (r215302) @@ -268,17 +268,6 @@ brgphy_attach(device_t dev) bce_sc = ifp->if_softc; } - /* Todo: Need to add additional controllers such as 5906 & 5787F */ - /* The 590x chips are 10/100 only. */ - if (bge_sc && - pci_get_vendor(bge_sc->bge_dev) == BCOM_VENDORID && - (pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5901 || - pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5901A2 || - pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5906 || - pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5906M)) { - ma->mii_capmask &= ~BMSR_EXTSTAT; - } - brgphy_reset(sc); /* Read the PHY's capabilities. */