summaryrefslogtreecommitdiff
path: root/sys/dev/mii
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2007-02-10 22:36:19 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2007-02-10 22:36:19 +0000
commitc7979e8b63d214966dc75ff4c1563e30950fb323 (patch)
tree46e2d77a5eb95bd35a69ebb1b735f73075c24829 /sys/dev/mii
parent42462f3a4b95f56870005e9f46c22a32a9278d5b (diff)
Use right flow control autonegotiation bits for 1000baseX.
Diffstat (limited to 'sys/dev/mii')
-rw-r--r--sys/dev/mii/mii.h29
-rw-r--r--sys/dev/mii/mii_physubr.c29
2 files changed, 36 insertions, 22 deletions
diff --git a/sys/dev/mii/mii.h b/sys/dev/mii/mii.h
index ef41d561592..c41273ef153 100644
--- a/sys/dev/mii/mii.h
+++ b/sys/dev/mii/mii.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mii.h,v 1.10 2005/11/06 09:27:19 brad Exp $ */
+/* $OpenBSD: mii.h,v 1.11 2007/02/10 22:36:18 kettenis Exp $ */
/* $NetBSD: mii.h,v 1.8 2001/05/31 03:06:46 thorpej Exp $ */
/*
@@ -120,13 +120,17 @@
#define ANAR_10_FD 0x0040 /* local device supports 10bT FD */
#define ANAR_10 0x0020 /* local device supports 10bT */
#define ANAR_CSMA 0x0001 /* protocol selector CSMA/CD */
+#define ANAR_PAUSE_NONE (0 << 10)
+#define ANAR_PAUSE_SYM (1 << 10)
+#define ANAR_PAUSE_ASYM (2 << 10)
+#define ANAR_PAUSE_TOWARDS (3 << 10)
#define ANAR_X_FD 0x0020 /* local device supports 1000BASE-X FD */
#define ANAR_X_HD 0x0040 /* local device supports 1000BASE-X HD */
-#define ANAR_X_PAUSE_NONE (0 << 10)
-#define ANAR_X_PAUSE_SYM (1 << 10)
-#define ANAR_X_PAUSE_ASYM (2 << 10)
-#define ANAR_X_PAUSE_TOWARDS (3 << 10)
+#define ANAR_X_PAUSE_NONE (0 << 7)
+#define ANAR_X_PAUSE_SYM (1 << 7)
+#define ANAR_X_PAUSE_ASYM (2 << 7)
+#define ANAR_X_PAUSE_TOWARDS (3 << 7)
#define MII_ANLPAR 0x05 /* Autonegotiation lnk partner abilities (rw) */
/* section 28.2.4.1 and 37.2.6.1 */
@@ -140,14 +144,19 @@
#define ANLPAR_10_FD 0x0040 /* link partner supports 10bT FD */
#define ANLPAR_10 0x0020 /* link partner supports 10bT */
#define ANLPAR_CSMA 0x0001 /* protocol selector CSMA/CD */
+#define ANLPAR_PAUSE_MASK (3 << 10)
+#define ANLPAR_PAUSE_NONE (0 << 10)
+#define ANLPAR_PAUSE_SYM (1 << 10)
+#define ANLPAR_PAUSE_ASYM (2 << 10)
+#define ANLPAR_PAUSE_TOWARDS (3 << 10)
#define ANLPAR_X_FD 0x0020 /* local device supports 1000BASE-X FD */
#define ANLPAR_X_HD 0x0040 /* local device supports 1000BASE-X HD */
-#define ANLPAR_X_PAUSE_MASK (3 << 10)
-#define ANLPAR_X_PAUSE_NONE (0 << 10)
-#define ANLPAR_X_PAUSE_SYM (1 << 10)
-#define ANLPAR_X_PAUSE_ASYM (2 << 10)
-#define ANLPAR_X_PAUSE_TOWARDS (3 << 10)
+#define ANLPAR_X_PAUSE_MASK (3 << 7)
+#define ANLPAR_X_PAUSE_NONE (0 << 7)
+#define ANLPAR_X_PAUSE_SYM (1 << 7)
+#define ANLPAR_X_PAUSE_ASYM (2 << 7)
+#define ANLPAR_X_PAUSE_TOWARDS (3 << 7)
#define MII_ANER 0x06 /* Autonegotiation expansion (ro) */
/* section 28.2.4.1 and 37.2.6.1 */
diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c
index 6e2858e5045..1d41aec4c65 100644
--- a/sys/dev/mii/mii_physubr.c
+++ b/sys/dev/mii/mii_physubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mii_physubr.c,v 1.31 2006/12/30 09:36:21 kettenis Exp $ */
+/* $OpenBSD: mii_physubr.c,v 1.32 2007/02/10 22:36:18 kettenis Exp $ */
/* $NetBSD: mii_physubr.c,v 1.20 2001/04/13 23:30:09 thorpej Exp $ */
/*-
@@ -166,7 +166,7 @@ mii_phy_auto(struct mii_softc *sc, int waitfor)
if (sc->mii_capabilities & BMSR_100TXFDX)
anar |= ANAR_FC;
if (sc->mii_extcapabilities & EXTSR_1000TFDX)
- anar |= ANAR_X_PAUSE_TOWARDS;
+ anar |= ANAR_PAUSE_TOWARDS;
}
PHY_WRITE(sc, MII_ANAR, anar);
if (sc->mii_flags & MIIF_HAVE_GTCR) {
@@ -547,30 +547,35 @@ mii_phy_flowstatus(struct mii_softc *sc)
anar = PHY_READ(sc, MII_ANAR);
anlpar = PHY_READ(sc, MII_ANLPAR);
- if ((anar & ANAR_X_PAUSE_SYM) & (anlpar & ANLPAR_X_PAUSE_SYM))
+ /* For 1000baseX, the bits are in a different location. */
+ if (sc->mii_flags & MIIF_IS_1000X) {
+ anar <<= 3;
+ anlpar <<= 3;
+ }
+
+ if ((anar & ANAR_PAUSE_SYM) & (anlpar & ANLPAR_PAUSE_SYM))
return (IFM_FLOW|IFM_ETH_TXPAUSE|IFM_ETH_RXPAUSE);
- if ((anar & ANAR_X_PAUSE_SYM) == 0) {
- if ((anar & ANAR_X_PAUSE_ASYM) &&
- ((anlpar &
- ANLPAR_X_PAUSE_TOWARDS) == ANLPAR_X_PAUSE_TOWARDS))
+ if ((anar & ANAR_PAUSE_SYM) == 0) {
+ if ((anar & ANAR_PAUSE_ASYM) &&
+ ((anlpar & ANLPAR_PAUSE_TOWARDS) == ANLPAR_PAUSE_TOWARDS))
return (IFM_FLOW|IFM_ETH_TXPAUSE);
else
return (0);
}
- if ((anar & ANAR_X_PAUSE_ASYM) == 0) {
- if (anlpar & ANLPAR_X_PAUSE_SYM)
+ if ((anar & ANAR_PAUSE_ASYM) == 0) {
+ if (anlpar & ANLPAR_PAUSE_SYM)
return (IFM_FLOW|IFM_ETH_TXPAUSE|IFM_ETH_RXPAUSE);
else
return (0);
}
- switch ((anlpar & ANLPAR_X_PAUSE_TOWARDS)) {
- case ANLPAR_X_PAUSE_NONE:
+ switch ((anlpar & ANLPAR_PAUSE_TOWARDS)) {
+ case ANLPAR_PAUSE_NONE:
return (0);
- case ANLPAR_X_PAUSE_ASYM:
+ case ANLPAR_PAUSE_ASYM:
return (IFM_FLOW|IFM_ETH_RXPAUSE);
default: