summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2006-12-27 14:33:05 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2006-12-27 14:33:05 +0000
commit41f0c1c851fb06df70df4b1bccc0b29ce4c378cc (patch)
tree63454cd1c86bae2b7b4d59a7346d202f21b4e960 /sys/dev
parent4d2ba7fac6a528ccce532c963c4c0e9479f3afe5 (diff)
Set IFM_ETH_MASTER if local PHY configuration resolved to MASTER.
From brad@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_em.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c
index 13709d601d5..12fbf2dd94a 100644
--- a/sys/dev/pci/if_em.c
+++ b/sys/dev/pci/if_em.c
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
-/* $OpenBSD: if_em.c,v 1.162 2006/12/06 23:25:58 reyk Exp $ */
+/* $OpenBSD: if_em.c,v 1.163 2006/12/27 14:33:04 kettenis Exp $ */
/* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */
#include <dev/pci/if_em.h>
@@ -795,6 +795,7 @@ em_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
{
struct em_softc *sc = ifp->if_softc;
u_char fiber_type = IFM_1000_SX;
+ u_int16_t gsr;
INIT_DEBUGOUT("em_media_status: begin");
@@ -828,10 +829,17 @@ em_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
ifmr->ifm_active |= IFM_1000_T;
break;
}
+
if (sc->link_duplex == FULL_DUPLEX)
ifmr->ifm_active |= IFM_FDX;
else
ifmr->ifm_active |= IFM_HDX;
+
+ if (IFM_SUBTYPE(ifmr->ifm_active) == IFM_1000_T) {
+ em_read_phy_reg(&sc->hw, PHY_1000T_STATUS, &gsr);
+ if (gsr & SR_1000T_MS_CONFIG_RES)
+ ifmr->ifm_active |= IFM_ETH_MASTER;
+ }
}
}