Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Make sure the media / mii members in struct ether...



details:   https://anonhg.NetBSD.org/src/rev/fa1d79ac1d7c
branches:  trunk
changeset: 1022058:fa1d79ac1d7c
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Jul 01 20:39:15 2021 +0000

description:
Make sure the media / mii members in struct ethercom are initialized
so that the media-related ioctls work.  Problem reported by Björn Johannesson
on current-users@.

XXX pullup-9

diffstat:

 sys/dev/ic/ax88190.c |   6 ++++--
 sys/dev/ic/dl10019.c |   6 ++++--
 sys/dev/ic/dp8390.c  |  13 +++++++++----
 3 files changed, 17 insertions(+), 8 deletions(-)

diffs (95 lines):

diff -r 217bbb76664e -r fa1d79ac1d7c sys/dev/ic/ax88190.c
--- a/sys/dev/ic/ax88190.c      Thu Jul 01 18:05:45 2021 +0000
+++ b/sys/dev/ic/ax88190.c      Thu Jul 01 20:39:15 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ax88190.c,v 1.17 2021/06/30 20:00:18 thorpej Exp $     */
+/*     $NetBSD: ax88190.c,v 1.18 2021/07/01 20:39:15 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ax88190.c,v 1.17 2021/06/30 20:00:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ax88190.c,v 1.18 2021/07/01 20:39:15 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -101,6 +101,8 @@
 
        callout_setfunc(&sc->sc_tick_ch, ax88190_tick, sc);
 
+       sc->sc_ec.ec_mii = mii;
+
        mii->mii_ifp = ifp;
        mii->mii_readreg = ax88190_mii_readreg;
        mii->mii_writereg = ax88190_mii_writereg;
diff -r 217bbb76664e -r fa1d79ac1d7c sys/dev/ic/dl10019.c
--- a/sys/dev/ic/dl10019.c      Thu Jul 01 18:05:45 2021 +0000
+++ b/sys/dev/ic/dl10019.c      Thu Jul 01 20:39:15 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dl10019.c,v 1.16 2021/06/30 20:00:18 thorpej Exp $     */
+/*     $NetBSD: dl10019.c,v 1.17 2021/07/01 20:39:15 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dl10019.c,v 1.16 2021/06/30 20:00:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dl10019.c,v 1.17 2021/07/01 20:39:15 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -134,6 +134,8 @@
 
        callout_setfunc(&sc->sc_tick_ch, dl10019_tick, sc);
 
+       sc->sc_ec.ec_mii = mii;
+
        mii->mii_ifp = ifp;
        mii->mii_readreg = dl10019_mii_readreg;
        mii->mii_writereg = dl10019_mii_writereg;
diff -r 217bbb76664e -r fa1d79ac1d7c sys/dev/ic/dp8390.c
--- a/sys/dev/ic/dp8390.c       Thu Jul 01 18:05:45 2021 +0000
+++ b/sys/dev/ic/dp8390.c       Thu Jul 01 20:39:15 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dp8390.c,v 1.98 2021/06/30 20:00:18 thorpej Exp $      */
+/*     $NetBSD: dp8390.c,v 1.99 2021/07/01 20:39:15 thorpej Exp $      */
 
 /*
  * Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -14,7 +14,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.98 2021/06/30 20:00:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.99 2021/07/01 20:39:15 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -68,7 +68,6 @@
 dp8390_media_init(struct dp8390_softc *sc)
 {
 
-       sc->sc_ec.ec_ifmedia = &sc->sc_media;
        ifmedia_init(&sc->sc_media, 0, dp8390_mediachange, dp8390_mediastatus);
        ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
        ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_MANUAL);
@@ -135,7 +134,13 @@
        aprint_normal_dev(sc->sc_dev, "Ethernet address %s\n",
            ether_sprintf(sc->sc_enaddr));
 
-       /* Initialize media goo. */
+       /*
+        * Initialize media structures.  We'll default to pointing ec_ifmedia
+        * at our embedded media structure.  A card front-end can initialize
+        * ec_mii if it has an MII interface.  (Note that sc_media is an
+        * alias of sc_mii.mii_media in dp8390_softc.)
+        */
+       sc->sc_ec.ec_ifmedia = &sc->sc_media;
        (*sc->sc_media_init)(sc);
 
        /* We can support 802.1Q VLAN-sized frames. */



Home | Main Index | Thread Index | Old Index