Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/dev/mii Pull up following revision(s) (requested by m...
details: https://anonhg.NetBSD.org/src/rev/ab2abdf4feb7
branches: netbsd-9
changeset: 843547:ab2abdf4feb7
user: martin <martin%NetBSD.org@localhost>
date: Thu Nov 21 14:00:49 2019 +0000
description:
Pull up following revision(s) (requested by msaitoh in ticket #459):
sys/dev/mii/atphy.c: revision 1.23
sys/dev/mii/atphy.c: revision 1.25
sys/dev/mii/miivar.h: revision 1.69
sys/dev/mii/mii_physubr.c: revision 1.88
s/etphy/atphy/. No functional change.
Fix a bug that atphy(4) can't negotiate correctly when the media setting is
neither auto nor 1000baseT. Use correct index for mii_media_table[].
History: mii_anar() is first added in OpenBSD and ported to NetBSD. On NetBSD,
only atphy(4) use this function. mii_physubr.c rev. 1.75 changed mii_anar()
for simplify. It changed the argument from the ifmedia word to ifm_data used
in our MII API, but the caller have not been changed. And then, PR kern/50206
was reported and the caller was modified by me to prevent panic but it was not
correct fix.
diffstat:
sys/dev/mii/atphy.c | 12 ++++++------
sys/dev/mii/mii_physubr.c | 15 ++++++---------
sys/dev/mii/miivar.h | 4 ++--
3 files changed, 14 insertions(+), 17 deletions(-)
diffs (114 lines):
diff -r 3247c3c7ea00 -r ab2abdf4feb7 sys/dev/mii/atphy.c
--- a/sys/dev/mii/atphy.c Wed Nov 20 16:50:50 2019 +0000
+++ b/sys/dev/mii/atphy.c Thu Nov 21 14:00:49 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atphy.c,v 1.22 2019/04/11 09:00:34 msaitoh Exp $ */
+/* $NetBSD: atphy.c,v 1.22.4.1 2019/11/21 14:00:49 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.22 2019/04/11 09:00:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.22.4.1 2019/11/21 14:00:49 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -90,7 +90,7 @@
atphy_service, atphy_status, atphy_reset,
};
-static const struct mii_phydesc etphys[] = {
+static const struct mii_phydesc atphys[] = {
MII_PHY_DESC(ATHEROS, F1),
MII_PHY_DESC(ATTANSIC, L1),
MII_PHY_DESC(ATTANSIC, L2),
@@ -118,7 +118,7 @@
{
struct mii_attach_args *ma = aux;
- if (mii_phy_match(ma, etphys) != NULL)
+ if (mii_phy_match(ma, atphys) != NULL)
return 10;
return 0;
@@ -133,7 +133,7 @@
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));
@@ -222,7 +222,7 @@
return EINVAL;
}
- anar = mii_anar(IFM_SUBTYPE(ife->ifm_media));
+ anar = mii_anar(ife);
if ((ife->ifm_media & IFM_FDX) != 0) {
bmcr |= BMCR_FDX;
/* Enable pause. */
diff -r 3247c3c7ea00 -r ab2abdf4feb7 sys/dev/mii/mii_physubr.c
--- a/sys/dev/mii/mii_physubr.c Wed Nov 20 16:50:50 2019 +0000
+++ b/sys/dev/mii/mii_physubr.c Thu Nov 21 14:00:49 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mii_physubr.c,v 1.87 2019/04/09 11:28:45 msaitoh Exp $ */
+/* $NetBSD: mii_physubr.c,v 1.87.4.1 2019/11/21 14:00:49 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.87 2019/04/09 11:28:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.87.4.1 2019/11/21 14:00:49 martin Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -697,19 +697,16 @@
/*
- * Given an ifmedia word, return the corresponding ANAR value.
+ * Given an ifmedia_entry, return the corresponding ANAR value.
*/
uint16_t
-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;
}
diff -r 3247c3c7ea00 -r ab2abdf4feb7 sys/dev/mii/miivar.h
--- a/sys/dev/mii/miivar.h Wed Nov 20 16:50:50 2019 +0000
+++ b/sys/dev/mii/miivar.h Thu Nov 21 14:00:49 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: miivar.h,v 1.68 2019/04/11 09:14:07 msaitoh Exp $ */
+/* $NetBSD: miivar.h,v 1.68.4.1 2019/11/21 14:00:49 martin Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -287,7 +287,7 @@
void mii_tick(struct mii_data *);
void mii_pollstat(struct mii_data *);
void mii_down(struct mii_data *);
-uint16_t mii_anar(int);
+uint16_t mii_anar(struct ifmedia_entry *);
int mii_ifmedia_change(struct mii_data *);
Home |
Main Index |
Thread Index |
Old Index