Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/sys/dev/mii Pull up following revision(s) (requested by m...
details: https://anonhg.NetBSD.org/src/rev/bebb6f195304
branches: netbsd-6
changeset: 776771:bebb6f195304
user: martin <martin%NetBSD.org@localhost>
date: Tue Nov 04 09:23:20 2014 +0000
description:
Pull up following revision(s) (requested by msaitoh in ticket #1146):
sys/dev/mii/mii_physubr.c: revision 1.79
sys/dev/mii/rgephy.c: revision 1.33
sys/dev/mii/brgphy.c: revision 1.66
sys/dev/mii/atphy.c: revision 1.15
sys/dev/mii/mii.h: revision 1.17
The bit location of link ability is different between 1000Base-X and others
(See annex 28B.2 and 28D). The old mii.h defined ANAR_X_PAUSE_* macros. Those
macros were named for 1000Base-X, but the bit definitions were not for
1000Base-X but for others (e.g. 1000BaseT). So there was bug in auto
negotiation for 1000Base-X, but there was no bug for other media. Define new
macro named ANAR_PAUSE_* and ANLPAR_PAUSE_* for other than 1000Base-X and fix
the bit definitions of ANAR_X_PAUSE_* and ANLPPAR_X_*. Change some PHY drivers
to use true macro. Same as other *BSDs.
diffstat:
sys/dev/mii/atphy.c | 6 +++---
sys/dev/mii/brgphy.c | 6 +++---
sys/dev/mii/mii.h | 31 +++++++++++++++++++++----------
sys/dev/mii/mii_physubr.c | 37 +++++++++++++++++++++----------------
sys/dev/mii/rgephy.c | 6 +++---
5 files changed, 51 insertions(+), 35 deletions(-)
diffs (232 lines):
diff -r 2f4a4a315b59 -r bebb6f195304 sys/dev/mii/atphy.c
--- a/sys/dev/mii/atphy.c Tue Nov 04 01:56:17 2014 +0000
+++ b/sys/dev/mii/atphy.c Tue Nov 04 09:23:20 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atphy.c,v 1.11 2011/10/02 21:42:19 jmcneill Exp $ */
+/* $NetBSD: atphy.c,v 1.11.8.1 2014/11/04 09:23:20 martin Exp $ */
/* $OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $ */
/*-
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.11 2011/10/02 21:42:19 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.11.8.1 2014/11/04 09:23:20 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -231,7 +231,7 @@
bmcr |= BMCR_FDX;
/* Enable pause. */
if (sc->mii_flags & MIIF_DOPAUSE)
- anar |= ANAR_X_PAUSE_TOWARDS;
+ anar |= ANAR_PAUSE_TOWARDS;
}
if ((sc->mii_extcapabilities & (EXTSR_1000TFDX |
diff -r 2f4a4a315b59 -r bebb6f195304 sys/dev/mii/brgphy.c
--- a/sys/dev/mii/brgphy.c Tue Nov 04 01:56:17 2014 +0000
+++ b/sys/dev/mii/brgphy.c Tue Nov 04 09:23:20 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: brgphy.c,v 1.59.8.4 2013/11/18 02:38:15 msaitoh Exp $ */
+/* $NetBSD: brgphy.c,v 1.59.8.5 2014/11/04 09:23:20 martin Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.59.8.4 2013/11/18 02:38:15 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.59.8.5 2014/11/04 09:23:20 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -638,7 +638,7 @@
} else {
anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA;
if (sc->mii_flags & MIIF_DOPAUSE)
- anar |= ANAR_FC | ANAR_X_PAUSE_ASYM;
+ anar |= ANAR_FC | ANAR_PAUSE_ASYM;
}
PHY_WRITE(sc, MII_ANAR, anar);
DELAY(1000);
diff -r 2f4a4a315b59 -r bebb6f195304 sys/dev/mii/mii.h
--- a/sys/dev/mii/mii.h Tue Nov 04 01:56:17 2014 +0000
+++ b/sys/dev/mii/mii.h Tue Nov 04 09:23:20 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mii.h,v 1.14 2009/10/19 18:41:14 bouyer Exp $ */
+/* $NetBSD: mii.h,v 1.14.18.1 2014/11/04 09:23:20 martin Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer. All rights reserved.
@@ -107,6 +107,7 @@
#define ANAR_NP 0x8000 /* Next page (ro) */
#define ANAR_ACK 0x4000 /* link partner abilities acknowledged (ro) */
#define ANAR_RF 0x2000 /* remote fault (ro) */
+ /* Annex 28B.2 */
#define ANAR_FC 0x0400 /* local device supports PAUSE */
#define ANAR_T4 0x0200 /* local device supports 100bT4 */
#define ANAR_TX_FD 0x0100 /* local device supports 100bTx FD */
@@ -114,13 +115,18 @@
#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)
+ /* Annex 28D */
#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 */
@@ -134,14 +140,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 -r 2f4a4a315b59 -r bebb6f195304 sys/dev/mii/mii_physubr.c
--- a/sys/dev/mii/mii_physubr.c Tue Nov 04 01:56:17 2014 +0000
+++ b/sys/dev/mii/mii_physubr.c Tue Nov 04 09:23:20 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mii_physubr.c,v 1.73 2011/12/10 02:46:07 buhrow Exp $ */
+/* $NetBSD: mii_physubr.c,v 1.73.2.1 2014/11/04 09:23:20 martin Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.73 2011/12/10 02:46:07 buhrow Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.73.2.1 2014/11/04 09:23:20 martin Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -177,8 +177,8 @@
/* XXX Only 1000BASE-T has PAUSE_ASYM? */
if ((sc->mii_flags & MIIF_HAVE_GTCR) &&
(sc->mii_extcapabilities &
- (EXTSR_1000THDX|EXTSR_1000TFDX)))
- anar |= ANAR_X_PAUSE_ASYM;
+ (EXTSR_1000THDX | EXTSR_1000TFDX)))
+ anar |= ANAR_PAUSE_ASYM;
}
}
@@ -231,8 +231,8 @@
/* XXX Only 1000BASE-T has PAUSE_ASYM? */
if ((sc->mii_flags & MIIF_HAVE_GTCR) &&
(sc->mii_extcapabilities &
- (EXTSR_1000THDX|EXTSR_1000TFDX)))
- anar |= ANAR_X_PAUSE_ASYM;
+ (EXTSR_1000THDX | EXTSR_1000TFDX)))
+ anar |= ANAR_PAUSE_ASYM;
}
/*
@@ -630,30 +630,35 @@
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:
diff -r 2f4a4a315b59 -r bebb6f195304 sys/dev/mii/rgephy.c
--- a/sys/dev/mii/rgephy.c Tue Nov 04 01:56:17 2014 +0000
+++ b/sys/dev/mii/rgephy.c Tue Nov 04 09:23:20 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rgephy.c,v 1.29 2010/07/18 03:00:39 jakllsch Exp $ */
+/* $NetBSD: rgephy.c,v 1.29.14.1 2014/11/04 09:23:20 martin Exp $ */
/*
* Copyright (c) 2003
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.29 2010/07/18 03:00:39 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.29.14.1 2014/11/04 09:23:20 martin Exp $");
/*
@@ -433,7 +433,7 @@
anar = BMSR_MEDIA_TO_ANAR(mii->mii_capabilities) | ANAR_CSMA;
if (mii->mii_flags & MIIF_DOPAUSE)
- anar |= ANAR_FC | ANAR_X_PAUSE_ASYM;
+ anar |= ANAR_FC | ANAR_PAUSE_ASYM;
PHY_WRITE(mii, MII_ANAR, anar);
DELAY(1000);
Home |
Main Index |
Thread Index |
Old Index