Module Name:    src
Committed By:   martin
Date:           Thu Nov 21 14:06:16 UTC 2019

Modified Files:
        src/sys/dev/mii [netbsd-8]: atphy.c mii_physubr.c miivar.h

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1454:

        sys/dev/mii/atphy.c                     1.22-1.23, 1.25 via patch
        sys/dev/mii/mii_physubr.c               1.88 via patch
        sys/dev/mii/miivar.h                    1.69 via patch

- Fix a bug that atphy(4) can't negotiate correctly when the media
  setting is neither auto nor 1000baseT.
- Code cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.8.1 src/sys/dev/mii/atphy.c
cvs rdiff -u -r1.80.26.1 -r1.80.26.2 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.62 -r1.62.20.1 src/sys/dev/mii/miivar.h

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/atphy.c
diff -u src/sys/dev/mii/atphy.c:1.18 src/sys/dev/mii/atphy.c:1.18.8.1
--- src/sys/dev/mii/atphy.c:1.18	Wed Nov  2 10:11:32 2016
+++ src/sys/dev/mii/atphy.c	Thu Nov 21 14:06:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: atphy.c,v 1.18 2016/11/02 10:11:32 msaitoh Exp $ */
+/*	$NetBSD: atphy.c,v 1.18.8.1 2019/11/21 14:06:16 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.18 2016/11/02 10:11:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.18.8.1 2019/11/21 14:06:16 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -90,7 +90,7 @@ const struct mii_phy_funcs atphy_funcs =
         atphy_service, atphy_status, atphy_reset,
 };
 
-static const struct mii_phydesc etphys[] = {
+static const struct mii_phydesc atphys[] = {
 	{ MII_OUI_ATHEROS,	MII_MODEL_ATHEROS_F1,
 	  MII_STR_ATHEROS_F1 },
 	{ MII_OUI_ATTANSIC,	MII_MODEL_ATTANSIC_L1,
@@ -124,7 +124,7 @@ atphy_match(device_t parent, cfdata_t ma
 {
 	struct mii_attach_args *ma = aux;
 
-	if (mii_phy_match(ma, etphys) != NULL)
+	if (mii_phy_match(ma, atphys) != NULL)
 		return 10;
 
 	return 0;
@@ -139,7 +139,7 @@ atphy_attach(device_t parent, device_t s
 	const struct mii_phydesc *mpd;
 	uint16_t bmsr;
 
-	mpd = mii_phy_match(ma, etphys);
+	mpd = mii_phy_match(ma, atphys);
 	aprint_naive(": Media interface\n");
 	aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
 
@@ -231,8 +231,8 @@ atphy_service(struct mii_softc *sc, stru
 			return EINVAL;
 		}
 
-		anar = mii_anar(IFM_SUBTYPE(ife->ifm_media));
-		if (((ife->ifm_media & IFM_GMASK) & IFM_FDX) != 0) {
+		anar = mii_anar(ife);
+		if ((ife->ifm_media & IFM_FDX) != 0) {
 			bmcr |= BMCR_FDX;
 			/* Enable pause. */
 			if (sc->mii_flags & MIIF_DOPAUSE)

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.80.26.1 src/sys/dev/mii/mii_physubr.c:1.80.26.2
--- src/sys/dev/mii/mii_physubr.c:1.80.26.1	Sun Dec 30 12:16:16 2018
+++ src/sys/dev/mii/mii_physubr.c	Thu Nov 21 14:06:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.80.26.1 2018/12/30 12:16:16 martin Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.80.26.2 2019/11/21 14:06:16 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.80.26.1 2018/12/30 12:16:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.80.26.2 2019/11/21 14:06:16 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -692,19 +692,16 @@ mii_phy_resume(device_t dv, const pmf_qu
 
 
 /*
- * Given an ifmedia word, return the corresponding ANAR value.
+ * Given an ifmedia_entry, return the corresponding ANAR value.
  */
 int
-mii_anar(int media)
+mii_anar(struct ifmedia_entry *ife)
 {
-	int rv;
 
 #ifdef DIAGNOSTIC
-	if (/* media < 0 || */ media >= MII_NMEDIA)
+	if (ife->ifm_data >= MII_NMEDIA)
 		panic("mii_anar");
 #endif
 
-	rv = mii_media_table[media].mm_anar;
-
-	return rv;
+	return mii_media_table[ife->ifm_data].mm_anar;
 }

Index: src/sys/dev/mii/miivar.h
diff -u src/sys/dev/mii/miivar.h:1.62 src/sys/dev/mii/miivar.h:1.62.20.1
--- src/sys/dev/mii/miivar.h:1.62	Wed May 28 09:49:55 2014
+++ src/sys/dev/mii/miivar.h	Thu Nov 21 14:06:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: miivar.h,v 1.62 2014/05/28 09:49:55 msaitoh Exp $	*/
+/*	$NetBSD: miivar.h,v 1.62.20.1 2019/11/21 14:06:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -235,7 +235,7 @@ int	mii_mediachg(struct mii_data *);
 void	mii_tick(struct mii_data *);
 void	mii_pollstat(struct mii_data *);
 void	mii_down(struct mii_data *);
-int	mii_anar(int);
+int	mii_anar(struct ifmedia_entry *);
 
 int mii_ifmedia_change(struct mii_data *);
 

Reply via email to