diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-12-23 13:16:33 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-12-23 13:16:33 +0000 |
commit | 2aa3fc49bf3fa7021cecebd48b0c41a192494318 (patch) | |
tree | 8a81afd0e2872cf8f728480dc4c9d02c6b007045 /sys/dev | |
parent | b4086d0100821de929722968a9c0dc128460ee5d (diff) |
Set IFM_ETH_MASTER if local PHY configuration resolved to MASTER.
Based on a diff by brad@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/mii/ciphy.c | 9 | ||||
-rw-r--r-- | sys/dev/mii/ipgphy.c | 16 |
2 files changed, 13 insertions, 12 deletions
diff --git a/sys/dev/mii/ciphy.c b/sys/dev/mii/ciphy.c index 62c42be29ea..917cf000354 100644 --- a/sys/dev/mii/ciphy.c +++ b/sys/dev/mii/ciphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ciphy.c,v 1.14 2006/10/07 23:44:51 brad Exp $ */ +/* $OpenBSD: ciphy.c,v 1.15 2006/12/23 13:16:32 kettenis Exp $ */ /* $FreeBSD: ciphy.c,v 1.1 2004/09/10 20:57:45 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -264,7 +264,7 @@ void ciphy_status(struct mii_softc *sc) { struct mii_data *mii = sc->mii_pdata; - int bmsr, bmcr; + int bmsr, bmcr, gsr; mii->mii_media_status = IFM_AVALID; mii->mii_media_active = IFM_ETHER; @@ -306,6 +306,11 @@ ciphy_status(struct mii_softc *sc) if (bmsr & CIPHY_AUXCSR_FDX) mii->mii_media_active |= IFM_FDX; + + gsr = PHY_READ(sc, CIPHY_MII_1000STS); + if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) && + gsr & CIPHY_1000STS_MSR) + mii->mii_media_active |= IFM_ETH_MASTER; } void diff --git a/sys/dev/mii/ipgphy.c b/sys/dev/mii/ipgphy.c index c986d18523a..a5343d57987 100644 --- a/sys/dev/mii/ipgphy.c +++ b/sys/dev/mii/ipgphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipgphy.c,v 1.2 2006/08/11 19:50:48 brad Exp $ */ +/* $OpenBSD: ipgphy.c,v 1.3 2006/12/23 13:16:32 kettenis Exp $ */ /*- * Copyright (c) 2006, Pyun YongHyeon <yongari@FreeBSD.org> @@ -337,6 +337,11 @@ ipgphy_status(struct mii_softc *sc) else mii->mii_media_active |= IFM_HDX; + stat = PHY_READ(sc, IPGPHY_MII_1000SR); + if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) && + stat & IPGPHY_1000SR_MASTER) + mii->mii_media_active |= IFM_ETH_MASTER; + ar = PHY_READ(sc, IPGPHY_MII_ANAR); lpar = PHY_READ(sc, IPGPHY_MII_ANLPAR); @@ -354,15 +359,6 @@ ipgphy_status(struct mii_softc *sc) (lpar & IPGPHY_ANLPAR_APAUSE)) { mii->mii_media_active |= IFM_FLAG0; } - - /* - * FLAG2 : local PHY resolved to MASTER - */ - if ((mii->mii_media_active & IFM_1000_T) != 0) { - stat = PHY_READ(sc, IPGPHY_MII_1000SR); - if ((stat & IPGPHY_1000SR_MASTER) != 0) - mii->mii_media_active |= IFM_FLAG2; - } } int |