diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-12-29 21:40:48 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2006-12-29 21:40:48 +0000 |
commit | 16293ad0b0ccd66d3ebb92a83ccb7dd4b3faa57a (patch) | |
tree | fca1f9807a729502ab2e0e7ecd6d305eaa007a06 /sys | |
parent | d6895cc6b7ee147b4d16ae4977a649ccc6121524 (diff) |
Use mii_phy_flowstatus() to replace the code that sets flag0/flag1 to
report flow control status.
From brad@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/mii/ipgphy.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/sys/dev/mii/ipgphy.c b/sys/dev/mii/ipgphy.c index a5343d57987..6b964113523 100644 --- a/sys/dev/mii/ipgphy.c +++ b/sys/dev/mii/ipgphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipgphy.c,v 1.3 2006/12/23 13:16:32 kettenis Exp $ */ +/* $OpenBSD: ipgphy.c,v 1.4 2006/12/29 21:40:47 kettenis Exp $ */ /*- * Copyright (c) 2006, Pyun YongHyeon <yongari@FreeBSD.org> @@ -295,7 +295,6 @@ ipgphy_status(struct mii_softc *sc) { struct mii_data *mii = sc->mii_pdata; uint32_t bmsr, bmcr, stat; - uint32_t ar, lpar; mii->mii_media_status = IFM_AVALID; mii->mii_media_active = IFM_ETHER; @@ -332,8 +331,9 @@ ipgphy_status(struct mii_softc *sc) mii->mii_media_active |= IFM_1000_T; break; } + if ((stat & PC_PhyDuplexStatus) != 0) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= mii_phy_flowstatus(sc) | IFM_FDX; else mii->mii_media_active |= IFM_HDX; @@ -341,24 +341,6 @@ ipgphy_status(struct mii_softc *sc) 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); - - /* - * FLAG0 : Rx flow-control - * FLAG1 : Tx flow-control - */ - if ((ar & IPGPHY_ANAR_PAUSE) && (lpar & IPGPHY_ANLPAR_PAUSE)) - mii->mii_media_active |= IFM_FLAG0 | IFM_FLAG1; - else if (!(ar & IPGPHY_ANAR_PAUSE) && (ar & IPGPHY_ANAR_APAUSE) && - (lpar & IPGPHY_ANLPAR_PAUSE) && (lpar & IPGPHY_ANLPAR_APAUSE)) - mii->mii_media_active |= IFM_FLAG1; - else if ((ar & IPGPHY_ANAR_PAUSE) && (ar & IPGPHY_ANAR_APAUSE) && - !(lpar & IPGPHY_ANLPAR_PAUSE) && - (lpar & IPGPHY_ANLPAR_APAUSE)) { - mii->mii_media_active |= IFM_FLAG0; - } } int |