Please test the following diff for brgphy(4), especially for bge(4). Also for bnx(4) and gem(4), any other NICs if I've forgotten any.
Please send a full dmesg. Index: brgphy.c =================================================================== RCS file: /cvs/src/sys/dev/mii/brgphy.c,v retrieving revision 1.86 diff -u -p -r1.86 brgphy.c --- brgphy.c 4 Jun 2009 00:59:21 -0000 1.86 +++ brgphy.c 11 Jun 2009 01:19:50 -0000 @@ -77,6 +77,7 @@ struct cfdriver brgphy_cd = { NULL, "brgphy", DV_DULL }; +void brgphy_getvariants(struct mii_softc *, struct mii_attach_args *); int brgphy_service(struct mii_softc *, struct mii_data *, int); void brgphy_copper_status(struct mii_softc *); void brgphy_fiber_status(struct mii_softc *); @@ -172,13 +173,9 @@ void brgphy_attach(struct device *parent, struct device *self, void *aux) { struct mii_softc *sc = (struct mii_softc *)self; - struct bnx_softc *bnx_sc = NULL; struct mii_attach_args *ma = aux; struct mii_data *mii = ma->mii_data; const struct mii_phydesc *mpd; - char *devname; - - devname = sc->mii_dev.dv_parent->dv_cfdata->cf_driver->cd_name; mpd = mii_phy_match(ma, brgphys); printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2)); @@ -189,40 +186,87 @@ brgphy_attach(struct device *parent, str sc->mii_rev = MII_REV(ma->mii_id2); sc->mii_pdata = mii; sc->mii_flags = ma->mii_flags; + + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; + + brgphy_getvariants(sc, ma); + + PHY_RESET(sc); + + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + if (sc->mii_capabilities & BMSR_EXTSTAT) + sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); +} + +void +brgphy_getvariants(struct mii_softc *sc, struct mii_attach_args *ma) +{ + struct mii_data *mii = ma->mii_data; + struct bge_softc *bge_sc = NULL; + struct bnx_softc *bnx_sc = NULL; + char *devname; + int fast_ether = 0; + + devname = sc->mii_dev.dv_parent->dv_cfdata->cf_driver->cd_name; + + if (strcmp(devname, "bge") == 0) + bge_sc = sc->mii_pdata->mii_ifp->if_softc; + else if (strcmp(devname, "bnx") == 0) + bnx_sc = sc->mii_pdata->mii_ifp->if_softc; + if (sc->mii_flags & MIIF_HAVEFIBER) { if (MII_OUI(ma->mii_id1, ma->mii_id2) == - MII_OUI_xxBROADCOM && - (sc->mii_model == MII_MODEL_xxBROADCOM_BCM5706 || - sc->mii_model == MII_MODEL_xxBROADCOM_BCM5714 || - sc->mii_model == MII_MODEL_xxBROADCOM_BCM5780)) - sc->mii_funcs = &brgphy_fiber_funcs; - else if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM2 && sc->mii_model == MII_MODEL_xxBROADCOM2_BCM5708S) sc->mii_funcs = &brgphy_5708s_funcs; + else + sc->mii_funcs = &brgphy_fiber_funcs; } else sc->mii_funcs = &brgphy_copper_funcs; - sc->mii_anegticks = MII_ANEGTICKS; - sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; + if (bge_sc && (bge_sc->bge_flags & BGE_10_100_ONLY)) + fast_ether = 1; - if (strcmp(devname, "bnx") == 0) - bnx_sc = sc->mii_pdata->mii_ifp->if_softc; +#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) - PHY_RESET(sc); + /* Create an instance of Ethernet media. */ + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), BMCR_ISO); - sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; - if (sc->mii_capabilities & BMSR_EXTSTAT) - sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); + /* Add the supported media types */ + if (sc->mii_flags & MIIF_HAVEFIBER) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, sc->mii_inst), + BRGPHY_S1000 | BRGPHY_BMCR_FDX); + /* 2.5G support is a software enabled feature on the 5708S and 5709S. */ + if (bnx_sc && (bnx_sc->bnx_phy_flags & BNX_PHY_2_5G_CAPABLE_FLAG)) + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_2500_SX, IFM_FDX, sc->mii_inst), 0); + } else { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), + BRGPHY_S10); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst), + BRGPHY_S10 | BRGPHY_BMCR_FDX); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst), + BRGPHY_S100); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst), + BRGPHY_S100 | BRGPHY_BMCR_FDX); + if (fast_ether == 0) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0, sc->mii_inst), + BRGPHY_S1000); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, IFM_FDX, sc->mii_inst), + BRGPHY_S1000 | BRGPHY_BMCR_FDX); + } + } + + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0); - mii_phy_add_media(sc); +#undef ADD - if (sc->mii_flags & MIIF_HAVEFIBER && bnx_sc && - (bnx_sc->bnx_phy_flags & BNX_PHY_2_5G_CAPABLE_FLAG)) { + if (sc->mii_flags & MIIF_HAVEFIBER) sc->mii_anegticks = MII_ANEGTICKS_GIGE; - ifmedia_add(&mii->mii_media, - IFM_MAKEWORD(IFM_ETHER, IFM_2500_SX, IFM_FDX, - sc->mii_inst), 0, NULL); + else { + if (fast_ether == 1) + sc->mii_anegticks = MII_ANEGTICKS; + else + sc->mii_anegticks = MII_ANEGTICKS_GIGE; } } -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.