From 0bc72b577322b16a4f357ac9886ae320f2f0098a Mon Sep 17 00:00:00 2001 From: glebius Date: Tue, 21 Apr 2015 06:46:11 +0000 Subject: [PATCH] Since brgphy doesn't call mii_phy_setmedia(), there is no reason to set any value to ifm_data. If brgphy ever to call mii_phy_setmedia(), then the value of BRGPHY_S1000 | BRGPHY_BMCR_FDX will trigger KASSERT. While here, remove the obfuscating macro and wrap long lines. Sponsored by: Nginx, Inc. --- sys/dev/mii/brgphy.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c index 54beed471133..0d22430720fe 100644 --- a/sys/dev/mii/brgphy.c +++ b/sys/dev/mii/brgphy.c @@ -266,20 +266,25 @@ brgphy_attach(device_t dev) sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); device_printf(dev, " "); -#define ADD(m, c) ifmedia_add(&sc->mii_pdata->mii_media, (m), (c), NULL) - /* Add the supported media types */ if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { mii_phy_add_media(sc); printf("\n"); } else { sc->mii_anegticks = MII_ANEGTICKS_GIGE; - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, sc->mii_inst), - BRGPHY_S1000 | BRGPHY_BMCR_FDX); + ifmedia_add(&sc->mii_pdata->mii_media, + IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, sc->mii_inst), + 0, NULL); printf("1000baseSX-FDX, "); - /* 2.5G support is a software enabled feature on the 5708S and 5709S. */ - if (bce_sc && (bce_sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG)) { - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_2500_SX, IFM_FDX, sc->mii_inst), 0); + /* + * 2.5G support is a software enabled feature + * on the 5708S and 5709S. + */ + if (bce_sc && (bce_sc->bce_phy_flags & + BCE_PHY_2_5G_CAPABLE_FLAG)) { + ifmedia_add(&sc->mii_pdata->mii_media, + IFM_MAKEWORD(IFM_ETHER, IFM_2500_SX, IFM_FDX, + sc->mii_inst), 0, NULL); printf("2500baseSX-FDX, "); } else if ((bsc->serdes_flags & BRGPHY_5708S) && bce_sc && (detect_hs21(bce_sc) != 0)) { @@ -295,11 +300,11 @@ brgphy_attach(device_t dev) printf("auto-neg workaround, "); bsc->serdes_flags |= BRGPHY_NOANWAIT; } - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0); + ifmedia_add(&sc->mii_pdata->mii_media, IFM_MAKEWORD(IFM_ETHER, + IFM_AUTO, 0, sc->mii_inst), 0, NULL); printf("auto\n"); } -#undef ADD MIIBUS_MEDIAINIT(sc->mii_dev); return (0); }