Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Detach MII if there is.



details:   https://anonhg.NetBSD.org/src/rev/299627f2e570
branches:  trunk
changeset: 481648:299627f2e570
user:      enami <enami%NetBSD.org@localhost>
date:      Thu Feb 03 06:03:39 2000 +0000

description:
Detach MII if there is.

diffstat:

 sys/dev/ic/elink3.c |  24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diffs (66 lines):

diff -r 7549252da72a -r 299627f2e570 sys/dev/ic/elink3.c
--- a/sys/dev/ic/elink3.c       Thu Feb 03 05:38:57 2000 +0000
+++ b/sys/dev/ic/elink3.c       Thu Feb 03 06:03:39 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elink3.c,v 1.73 2000/02/02 17:09:46 thorpej Exp $      */
+/*     $NetBSD: elink3.c,v 1.74 2000/02/03 06:03:39 enami Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -728,6 +728,9 @@
                panic("ep_tick");
 #endif
 
+       if ((sc->sc_dev.dv_flags & DVF_ACTIVE) == 0)
+               return;
+
        s = splnet();
        mii_tick(&sc->sc_mii);
        splx(s);
@@ -2105,6 +2108,11 @@
        }
 }
 
+/*
+ * ep_activate:
+ *
+ *     Handle device activation/deactivation requests.
+ */
 int
 ep_activate(self, act)
        struct device *self;
@@ -2121,6 +2129,9 @@
                break;
 
        case DVACT_DEACTIVATE:
+               if (sc->ep_flags & ELINK_FLAGS_MII)
+                       mii_activate(&sc->sc_mii, act, MII_PHY_ANY,
+                           MII_OFFSET_ANY);
                if_deactivate(ifp);
                break;
        }
@@ -2128,6 +2139,11 @@
        return (error);
 }
 
+/*
+ * ep_detach:
+ *
+ *     Detach a elink3 interface.
+ */
 int
 ep_detach(self, flags)
        struct device *self;
@@ -2141,6 +2157,12 @@
        untimeout(ep_tick, sc);
        untimeout(epmbuffill, sc);
 
+       if (sc->ep_flags & ELINK_FLAGS_MII) {
+               /* Detach all PHYs */
+               mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
+       }
+
+       /* Delete all remaining media. */
        ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
 
 #if NRND > 0



Home | Main Index | Thread Index | Old Index