Module Name:    src
Committed By:   snj
Date:           Fri May  1 01:29:21 UTC 2009

Modified Files:
        src/sys/dev/mii [netbsd-5]: inphy.c iophy.c nsphy.c rlphy.c
            ukphy_subr.c
        src/sys/dev/pci [netbsd-5]: if_txp.c

Log Message:
Pull up following revision(s) (requested by cegger in ticket #474):
        sys/dev/mii/inphy.c: revision 1.51
        sys/dev/mii/iophy.c: revision 1.35
        sys/dev/mii/nsphy.c: revision 1.56
        sys/dev/mii/rlphy.c: revision 1.25
        sys/dev/mii/ukphy_subr.c: revision 1.11
        sys/dev/pci/if_txp.c: revision 1.28
fix media priorities:
IEEE 802.3 Annex 28B.3 specifies the following relative
priorities of the technologies supported by
802.3 Selector Field value:
1000BASE-T full duplex
1000BASE-T
100BASE-T2 full duplex
100BASE-TX full duplex
100BASE-T2
100BASE-T4
100BASE-TX
10BASE-T full duplex
10BAST-T
Our drivers give 100BASE-T4 a higher priority than
100BASE-TX full duplex.
Fix this. This patch is based on changes in FreeBSD and OpenBSD.
Patch presented on tech-kern and tech-net:
http://mail-index.netbsd.org/tech-kern/2009/02/15/msg004397.html
http://mail-index.netbsd.org/tech-net/2009/02/15/msg001064.html
got no comments, no objections.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.48.10.1 src/sys/dev/mii/inphy.c
cvs rdiff -u -r1.33 -r1.33.10.1 src/sys/dev/mii/iophy.c
cvs rdiff -u -r1.54 -r1.54.10.1 src/sys/dev/mii/nsphy.c
cvs rdiff -u -r1.22 -r1.22.10.1 src/sys/dev/mii/rlphy.c
cvs rdiff -u -r1.10 -r1.10.10.1 src/sys/dev/mii/ukphy_subr.c
cvs rdiff -u -r1.26 -r1.26.14.1 src/sys/dev/pci/if_txp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/inphy.c
diff -u src/sys/dev/mii/inphy.c:1.48 src/sys/dev/mii/inphy.c:1.48.10.1
--- src/sys/dev/mii/inphy.c:1.48	Sun May  4 17:06:09 2008
+++ src/sys/dev/mii/inphy.c	Fri May  1 01:29:20 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: inphy.c,v 1.48 2008/05/04 17:06:09 xtraeme Exp $	*/
+/*	$NetBSD: inphy.c,v 1.48.10.1 2009/05/01 01:29:20 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: inphy.c,v 1.48 2008/05/04 17:06:09 xtraeme Exp $");
+__KERNEL_RCSID(0, "$NetBSD: inphy.c,v 1.48.10.1 2009/05/01 01:29:20 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -253,10 +253,10 @@
 			return;
 		}
 		scr = PHY_READ(sc, MII_INPHY_SCR);
-		if ((bmsr & BMSR_100T4) && (scr & SCR_T4))
-			mii->mii_media_active |= IFM_100_T4;
-		else if (scr & SCR_S100)
+		if (scr & SCR_S100)
 			mii->mii_media_active |= IFM_100_TX;
+		else if ((bmsr & BMSR_100T4) && (scr & SCR_T4))
+			mii->mii_media_active |= IFM_100_T4;
 		else
 			mii->mii_media_active |= IFM_10_T;
 		if (scr & SCR_FDX)

Index: src/sys/dev/mii/iophy.c
diff -u src/sys/dev/mii/iophy.c:1.33 src/sys/dev/mii/iophy.c:1.33.10.1
--- src/sys/dev/mii/iophy.c:1.33	Sun May  4 17:06:09 2008
+++ src/sys/dev/mii/iophy.c	Fri May  1 01:29:20 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: iophy.c,v 1.33 2008/05/04 17:06:09 xtraeme Exp $	*/
+/*	$NetBSD: iophy.c,v 1.33.10.1 2009/05/01 01:29:20 snj Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iophy.c,v 1.33 2008/05/04 17:06:09 xtraeme Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iophy.c,v 1.33.10.1 2009/05/01 01:29:20 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -243,14 +243,13 @@
 		}
 		ext0 = PHY_READ(sc, MII_IOPHY_EXT0);
 
-		if (ext0 & EXT0_SPEED)
-			if (bmsr & BMSR_100T4) {
-				mii->mii_media_active |= IFM_100_T4;
-				return;
-			} else {
+		if (ext0 & EXT0_SPEED) {
+			if ((bmsr & BMSR_100TXFDX) || (bmsr & BMSR_100TXHDX)) {
 				mii->mii_media_active |= IFM_100_TX;
+			} else if (bmsr & BMSR_100T4) {
+				mii->mii_media_active |= IFM_100_T4;
 			}
-		else
+		} else
 			mii->mii_media_active |= IFM_10_T;
 
 		if (ext0 & EXT0_DUPLEX)

Index: src/sys/dev/mii/nsphy.c
diff -u src/sys/dev/mii/nsphy.c:1.54 src/sys/dev/mii/nsphy.c:1.54.10.1
--- src/sys/dev/mii/nsphy.c:1.54	Sun May  4 17:06:10 2008
+++ src/sys/dev/mii/nsphy.c	Fri May  1 01:29:20 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: nsphy.c,v 1.54 2008/05/04 17:06:10 xtraeme Exp $	*/
+/*	$NetBSD: nsphy.c,v 1.54.10.1 2009/05/01 01:29:20 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nsphy.c,v 1.54 2008/05/04 17:06:10 xtraeme Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nsphy.c,v 1.54.10.1 2009/05/01 01:29:20 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -289,10 +289,10 @@
 		if (PHY_READ(sc, MII_ANER) & ANER_LPAN) {
 			anlpar = PHY_READ(sc, MII_ANAR) &
 			    PHY_READ(sc, MII_ANLPAR);
-			if (anlpar & ANLPAR_T4)
-				mii->mii_media_active |= IFM_100_T4;
-			else if (anlpar & ANLPAR_TX_FD)
+			if (anlpar & ANLPAR_TX_FD)
 				mii->mii_media_active |= IFM_100_TX|IFM_FDX;
+			else if (anlpar & ANLPAR_T4)
+				mii->mii_media_active |= IFM_100_T4;
 			else if (anlpar & ANLPAR_TX)
 				mii->mii_media_active |= IFM_100_TX;
 			else if (anlpar & ANLPAR_10_FD)

Index: src/sys/dev/mii/rlphy.c
diff -u src/sys/dev/mii/rlphy.c:1.22 src/sys/dev/mii/rlphy.c:1.22.10.1
--- src/sys/dev/mii/rlphy.c:1.22	Sun May  4 17:06:10 2008
+++ src/sys/dev/mii/rlphy.c	Fri May  1 01:29:20 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rlphy.c,v 1.22 2008/05/04 17:06:10 xtraeme Exp $	*/
+/*	$NetBSD: rlphy.c,v 1.22.10.1 2009/05/01 01:29:20 snj Exp $	*/
 /*	$OpenBSD: rlphy.c,v 1.20 2005/07/31 05:27:30 pvalchev Exp $	*/
 
 /*
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.22 2008/05/04 17:06:10 xtraeme Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.22.10.1 2009/05/01 01:29:20 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -286,10 +286,10 @@
 
 		if ((anlpar = PHY_READ(sc, MII_ANAR) &
 		    PHY_READ(sc, MII_ANLPAR))) {
-			if (anlpar & ANLPAR_T4)
-				mii->mii_media_active |= IFM_100_T4;
-			else if (anlpar & ANLPAR_TX_FD)
+			if (anlpar & ANLPAR_TX_FD)
 				mii->mii_media_active |= IFM_100_TX|IFM_FDX;
+			else if (anlpar & ANLPAR_T4)
+				mii->mii_media_active |= IFM_100_T4;
 			else if (anlpar & ANLPAR_TX)
 				mii->mii_media_active |= IFM_100_TX;
 			else if (anlpar & ANLPAR_10_FD)

Index: src/sys/dev/mii/ukphy_subr.c
diff -u src/sys/dev/mii/ukphy_subr.c:1.10 src/sys/dev/mii/ukphy_subr.c:1.10.10.1
--- src/sys/dev/mii/ukphy_subr.c:1.10	Mon Apr 28 20:23:53 2008
+++ src/sys/dev/mii/ukphy_subr.c	Fri May  1 01:29:21 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ukphy_subr.c,v 1.10 2008/04/28 20:23:53 martin Exp $	*/
+/*	$NetBSD: ukphy_subr.c,v 1.10.10.1 2009/05/01 01:29:21 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ukphy_subr.c,v 1.10 2008/04/28 20:23:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukphy_subr.c,v 1.10.10.1 2009/05/01 01:29:21 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -103,10 +103,10 @@
 		else if ((gtcr & GTCR_ADV_1000THDX) &&
 			 (gtsr & GTSR_LP_1000THDX))
 			mii->mii_media_active |= IFM_1000_T;
-		else if (anlpar & ANLPAR_T4)
-			mii->mii_media_active |= IFM_100_T4;
 		else if (anlpar & ANLPAR_TX_FD)
 			mii->mii_media_active |= IFM_100_TX|IFM_FDX;
+		else if (anlpar & ANLPAR_T4)
+			mii->mii_media_active |= IFM_100_T4;
 		else if (anlpar & ANLPAR_TX)
 			mii->mii_media_active |= IFM_100_TX;
 		else if (anlpar & ANLPAR_10_FD)

Index: src/sys/dev/pci/if_txp.c
diff -u src/sys/dev/pci/if_txp.c:1.26 src/sys/dev/pci/if_txp.c:1.26.14.1
--- src/sys/dev/pci/if_txp.c:1.26	Thu Apr 10 19:13:37 2008
+++ src/sys/dev/pci/if_txp.c	Fri May  1 01:29:21 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.26 2008/04/10 19:13:37 cegger Exp $ */
+/* $NetBSD: if_txp.c,v 1.26.14.1 2009/05/01 01:29:21 snj Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.26 2008/04/10 19:13:37 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.26.14.1 2009/05/01 01:29:21 snj Exp $");
 
 #include "bpfilter.h"
 #include "opt_inet.h"
@@ -1888,10 +1888,10 @@
 			return;
 		}
 
-		if (anlpar & ANLPAR_T4)
-			ifmr->ifm_active |= IFM_100_T4;
-		else if (anlpar & ANLPAR_TX_FD)
+		if (anlpar & ANLPAR_TX_FD)
 			ifmr->ifm_active |= IFM_100_TX|IFM_FDX;
+		else if (anlpar & ANLPAR_T4)
+			ifmr->ifm_active |= IFM_100_T4;
 		else if (anlpar & ANLPAR_TX)
 			ifmr->ifm_active |= IFM_100_TX;
 		else if (anlpar & ANLPAR_10_FD)

Reply via email to