summaryrefslogtreecommitdiffstats
path: root/sys/dev/mii
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2000-12-12 19:31:14 +0000
committerwpaul <wpaul@FreeBSD.org>2000-12-12 19:31:14 +0000
commit0ee7429451f32b5027bdb6dac8f4378f73910e3d (patch)
treee048ef73a889553c164b8fbd498e85d22f67e003 /sys/dev/mii
parent126b557e53a07a423a0c14168d2c4a9e1983c9b9 (diff)
downloadFreeBSD-src-0ee7429451f32b5027bdb6dac8f4378f73910e3d.zip
FreeBSD-src-0ee7429451f32b5027bdb6dac8f4378f73910e3d.tar.gz
Grrrrr. That last commit was supposed to be to the head, not to -stable
(even though I want the fixes in -stable anyway). I'm sure I'm going to get flamed now for committing to -stable and -current too quickly. *sigh*
Diffstat (limited to 'sys/dev/mii')
-rw-r--r--sys/dev/mii/amphy.c1
-rw-r--r--sys/dev/mii/brgphy.c4
-rw-r--r--sys/dev/mii/exphy.c1
-rw-r--r--sys/dev/mii/mii_physubr.c12
-rw-r--r--sys/dev/mii/miivar.h2
-rw-r--r--sys/dev/mii/mlphy.c1
-rw-r--r--sys/dev/mii/nsphy.c1
-rw-r--r--sys/dev/mii/pnaphy.c1
-rw-r--r--sys/dev/mii/rlphy.c1
-rw-r--r--sys/dev/mii/tdkphy.c1
-rw-r--r--sys/dev/mii/ukphy.c1
-rw-r--r--sys/dev/mii/xmphy.c4
12 files changed, 27 insertions, 3 deletions
diff --git a/sys/dev/mii/amphy.c b/sys/dev/mii/amphy.c
index 82dbb36..e873c85 100644
--- a/sys/dev/mii/amphy.c
+++ b/sys/dev/mii/amphy.c
@@ -161,6 +161,7 @@ static int amphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c
index a0118d5..38febae 100644
--- a/sys/dev/mii/brgphy.c
+++ b/sys/dev/mii/brgphy.c
@@ -165,6 +165,8 @@ static int brgphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ if (sc->mii_flags & MIIF_DOINGAUTO)
+ untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
@@ -399,7 +401,7 @@ brgphy_mii_phy_auto(mii, waitfor)
*/
if ((mii->mii_flags & MIIF_DOINGAUTO) == 0) {
mii->mii_flags |= MIIF_DOINGAUTO;
- timeout(mii_phy_auto_timeout, mii, hz >> 1);
+ mii->mii_auto_ch = timeout(mii_phy_auto_timeout, mii, hz >> 1);
}
return (EJUSTRETURN);
}
diff --git a/sys/dev/mii/exphy.c b/sys/dev/mii/exphy.c
index f34f92a..bbe1cc0 100644
--- a/sys/dev/mii/exphy.c
+++ b/sys/dev/mii/exphy.c
@@ -214,6 +214,7 @@ static int exphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c
index 7e1c8b5..9139296 100644
--- a/sys/dev/mii/mii_physubr.c
+++ b/sys/dev/mii/mii_physubr.c
@@ -106,12 +106,22 @@ mii_phy_auto(mii, waitfor)
*/
if ((mii->mii_flags & MIIF_DOINGAUTO) == 0) {
mii->mii_flags |= MIIF_DOINGAUTO;
- timeout(mii_phy_auto_timeout, mii, hz >> 1);
+ mii->mii_auto_ch = timeout(mii_phy_auto_timeout, mii, hz >> 1);
}
return (EJUSTRETURN);
}
void
+mii_phy_auto_stop(sc)
+ struct mii_softc *sc;
+{
+ if (sc->mii_flags & MIIF_DOINGAUTO) {
+ sc->mii_flags &= ~MIIF_DOINGAUTO;
+ untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
+ }
+}
+
+void
mii_phy_auto_timeout(arg)
void *arg;
{
diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h
index 4a68b9c..062686c 100644
--- a/sys/dev/mii/miivar.h
+++ b/sys/dev/mii/miivar.h
@@ -120,6 +120,7 @@ struct mii_softc {
mii_downcall_t mii_service; /* our downcall */
struct mii_data *mii_pdata; /* pointer to parent's mii_data */
+ struct callout_handle mii_auto_ch; /* callout handle for phy autoneg */
int mii_flags; /* misc. flags; see below */
int mii_capabilities; /* capabilities from BMSR */
@@ -170,6 +171,7 @@ void mii_add_media __P((struct mii_data *, int, int));
int mii_media_from_bmcr __P((int));
int mii_phy_auto __P((struct mii_softc *, int));
+void mii_phy_auto_stop __P((struct mii_softc *));
void mii_phy_reset __P((struct mii_softc *));
void ukphy_status __P((struct mii_softc *));
diff --git a/sys/dev/mii/mlphy.c b/sys/dev/mii/mlphy.c
index d83afd3..b38cfc3 100644
--- a/sys/dev/mii/mlphy.c
+++ b/sys/dev/mii/mlphy.c
@@ -186,6 +186,7 @@ static int mlphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(&sc->ml_mii);
sc->ml_mii.mii_dev = NULL;
LIST_REMOVE(&sc->ml_mii, mii_list);
diff --git a/sys/dev/mii/nsphy.c b/sys/dev/mii/nsphy.c
index aee90da..d6ee562 100644
--- a/sys/dev/mii/nsphy.c
+++ b/sys/dev/mii/nsphy.c
@@ -207,6 +207,7 @@ static int nsphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/pnaphy.c b/sys/dev/mii/pnaphy.c
index 9a661b3..5f8580a 100644
--- a/sys/dev/mii/pnaphy.c
+++ b/sys/dev/mii/pnaphy.c
@@ -168,6 +168,7 @@ static int pnaphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/rlphy.c b/sys/dev/mii/rlphy.c
index 15e7ee1..0a0e375 100644
--- a/sys/dev/mii/rlphy.c
+++ b/sys/dev/mii/rlphy.c
@@ -174,6 +174,7 @@ static int rlphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_softc(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/tdkphy.c b/sys/dev/mii/tdkphy.c
index e0cc5d8..4c3d6f8 100644
--- a/sys/dev/mii/tdkphy.c
+++ b/sys/dev/mii/tdkphy.c
@@ -168,6 +168,7 @@ static int tdkphy_detach(device_t dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/ukphy.c b/sys/dev/mii/ukphy.c
index df00420..bdc47b4 100644
--- a/sys/dev/mii/ukphy.c
+++ b/sys/dev/mii/ukphy.c
@@ -192,6 +192,7 @@ static int ukphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
diff --git a/sys/dev/mii/xmphy.c b/sys/dev/mii/xmphy.c
index 8e46061..d312ac2 100644
--- a/sys/dev/mii/xmphy.c
+++ b/sys/dev/mii/xmphy.c
@@ -166,6 +166,8 @@ static int xmphy_detach(dev)
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
+ if (sc->mii_flags & MIIF_DOINGAUTO)
+ untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
@@ -385,7 +387,7 @@ xmphy_mii_phy_auto(mii, waitfor)
*/
if ((mii->mii_flags & MIIF_DOINGAUTO) == 0) {
mii->mii_flags |= MIIF_DOINGAUTO;
- timeout(mii_phy_auto_timeout, mii, hz >> 1);
+ mii->mii_auto_ch = timeout(mii_phy_auto_timeout, mii, hz >> 1);
}
return (EJUSTRETURN);
}
OpenPOWER on IntegriCloud