summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>1999-11-12 18:12:59 +0000
committerthorpej <thorpej@NetBSD.org>1999-11-12 18:12:59 +0000
commitbca88a28c852cae9bc1f3799a886924bc498bbee (patch)
treef43ec165500ed237ea98107ca8a290e8afc2e72f /sys/dev
parentfc5ecbb5a84c5d3738fa06dd3cdd40eb309ee2eb (diff)
Add mii_down(), which is used by MAC drivers to inform PHYs that the
interface is now down. PHYs use this to cancel pending asynchronous operations.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/mii/exphy.c6
-rw-r--r--sys/dev/mii/icsphy.c6
-rw-r--r--sys/dev/mii/inphy.c6
-rw-r--r--sys/dev/mii/iophy.c6
-rw-r--r--sys/dev/mii/lxtphy.c6
-rw-r--r--sys/dev/mii/mii.c16
-rw-r--r--sys/dev/mii/mii_physubr.c13
-rw-r--r--sys/dev/mii/miivar.h5
-rw-r--r--sys/dev/mii/nsphy.c6
-rw-r--r--sys/dev/mii/qsphy.c6
-rw-r--r--sys/dev/mii/sqphy.c6
-rw-r--r--sys/dev/mii/tlphy.c6
-rw-r--r--sys/dev/mii/tqphy.c6
-rw-r--r--sys/dev/mii/ukphy.c6
14 files changed, 86 insertions, 14 deletions
diff --git a/sys/dev/mii/exphy.c b/sys/dev/mii/exphy.c
index c2ada152e4d..3393c147c94 100644
--- a/sys/dev/mii/exphy.c
+++ b/sys/dev/mii/exphy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: exphy.c,v 1.17 1999/11/03 22:30:32 thorpej Exp $ */
+/* $NetBSD: exphy.c,v 1.18 1999/11/12 18:12:59 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -214,6 +214,10 @@ exphy_service(sc, mii, cmd)
* kicked; it continues in the background.
*/
break;
+
+ case MII_DOWN:
+ mii_phy_down(sc);
+ return (0);
}
/* Update the media status. */
diff --git a/sys/dev/mii/icsphy.c b/sys/dev/mii/icsphy.c
index 30dcdaab0f5..68b5cf9389c 100644
--- a/sys/dev/mii/icsphy.c
+++ b/sys/dev/mii/icsphy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: icsphy.c,v 1.11 1999/11/03 22:30:32 thorpej Exp $ */
+/* $NetBSD: icsphy.c,v 1.12 1999/11/12 18:13:00 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -215,6 +215,10 @@ icsphy_service(sc, mii, cmd)
* kicked; it continues in the background.
*/
break;
+
+ case MII_DOWN:
+ mii_phy_down(sc);
+ return (0);
}
/* Update the media status. */
diff --git a/sys/dev/mii/inphy.c b/sys/dev/mii/inphy.c
index 8292468d2fc..48f0945b3a3 100644
--- a/sys/dev/mii/inphy.c
+++ b/sys/dev/mii/inphy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: inphy.c,v 1.12 1999/11/03 22:30:32 thorpej Exp $ */
+/* $NetBSD: inphy.c,v 1.13 1999/11/12 18:13:00 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -238,6 +238,10 @@ inphy_service(sc, mii, cmd)
if (mii_phy_auto(sc, 0) == EJUSTRETURN)
return (0);
break;
+
+ case MII_DOWN:
+ mii_phy_down(sc);
+ return (0);
}
/* Update the media status. */
diff --git a/sys/dev/mii/iophy.c b/sys/dev/mii/iophy.c
index f6f1e04b354..2797fcfbb3b 100644
--- a/sys/dev/mii/iophy.c
+++ b/sys/dev/mii/iophy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: iophy.c,v 1.2 1999/11/03 22:30:32 thorpej Exp $ */
+/* $NetBSD: iophy.c,v 1.3 1999/11/12 18:13:00 thorpej Exp $ */
/*
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -240,6 +240,10 @@ iophy_service(sc, mii, cmd)
if (mii_phy_auto(sc, 0) == EJUSTRETURN)
return (0);
break;
+
+ case MII_DOWN:
+ mii_phy_down(sc);
+ return (0);
}
/* Update the media status. */
diff --git a/sys/dev/mii/lxtphy.c b/sys/dev/mii/lxtphy.c
index c3278815b39..e64c2f86967 100644
--- a/sys/dev/mii/lxtphy.c
+++ b/sys/dev/mii/lxtphy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lxtphy.c,v 1.12 1999/11/03 22:30:32 thorpej Exp $ */
+/* $NetBSD: lxtphy.c,v 1.13 1999/11/12 18:13:00 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -232,6 +232,10 @@ lxtphy_service(sc, mii, cmd)
if (mii_phy_auto(sc, 0) == EJUSTRETURN)
return (0);
break;
+
+ case MII_DOWN:
+ mii_phy_down(sc);
+ return (0);
}
/* Update the media status. */
diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c
index 41c3a6906c6..de489d2233e 100644
--- a/sys/dev/mii/mii.c
+++ b/sys/dev/mii/mii.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mii.c,v 1.15 1999/11/04 00:22:07 thorpej Exp $ */
+/* $NetBSD: mii.c,v 1.16 1999/11/12 18:13:00 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -234,3 +234,17 @@ mii_pollstat(mii)
child = LIST_NEXT(child, mii_list))
(void) (*child->mii_service)(child, mii, MII_POLLSTAT);
}
+
+/*
+ * Inform the PHYs that the interface is down.
+ */
+void
+mii_down(mii)
+ struct mii_data *mii;
+{
+ struct mii_softc *child;
+
+ for (child = LIST_FIRST(&mii->mii_phys); child != NULL;
+ child = LIST_NEXT(child, mii_list))
+ (void) (*child->mii_service)(child, mii, MII_DOWN);
+}
diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c
index 2a458696597..b58dcc17b5a 100644
--- a/sys/dev/mii/mii_physubr.c
+++ b/sys/dev/mii/mii_physubr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mii_physubr.c,v 1.7 1999/11/03 22:32:45 thorpej Exp $ */
+/* $NetBSD: mii_physubr.c,v 1.8 1999/11/12 18:13:00 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -176,6 +176,17 @@ mii_phy_reset(sc)
PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO);
}
+void
+mii_phy_down(sc)
+ struct mii_softc *sc;
+{
+
+ if (sc->mii_flags & MIIF_DOINGAUTO) {
+ sc->mii_flags &= ~MIIF_DOINGAUTO;
+ untimeout(mii_phy_auto_timeout, sc);
+ }
+}
+
/*
* Initialize generic PHY media based on BMSR, called when a PHY is
* attached. We expect to be set up to print a comma-separated list
diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h
index 0b010601695..e2cde9433f7 100644
--- a/sys/dev/mii/miivar.h
+++ b/sys/dev/mii/miivar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: miivar.h,v 1.11 1999/11/04 00:22:08 thorpej Exp $ */
+/* $NetBSD: miivar.h,v 1.12 1999/11/12 18:13:00 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -104,6 +104,7 @@ typedef int (*mii_downcall_t) __P((struct mii_softc *, struct mii_data *, int));
#define MII_TICK 1 /* once-per-second tick */
#define MII_MEDIACHG 2 /* user changed media; perform the switch */
#define MII_POLLSTAT 3 /* user requested media status; fill it in */
+#define MII_DOWN 4 /* interface is down */
/*
* Each PHY driver's softc has one of these as the first member.
@@ -187,12 +188,14 @@ struct mii_media {
int mii_mediachg __P((struct mii_data *));
void mii_tick __P((struct mii_data *));
void mii_pollstat __P((struct mii_data *));
+void mii_down __P((struct mii_data *));
void mii_phy_probe __P((struct device *, struct mii_data *, int, int, int));
void mii_add_media __P((struct mii_softc *));
void mii_phy_setmedia __P((struct mii_softc *));
int mii_phy_auto __P((struct mii_softc *, int));
void mii_phy_reset __P((struct mii_softc *));
+void mii_phy_down __P((struct mii_softc *));
void ukphy_status __P((struct mii_softc *));
#endif /* _KERNEL */
diff --git a/sys/dev/mii/nsphy.c b/sys/dev/mii/nsphy.c
index 338c7981aa7..bc4dc8e4e5c 100644
--- a/sys/dev/mii/nsphy.c
+++ b/sys/dev/mii/nsphy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nsphy.c,v 1.19 1999/11/03 22:30:32 thorpej Exp $ */
+/* $NetBSD: nsphy.c,v 1.20 1999/11/12 18:13:01 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -270,6 +270,10 @@ nsphy_service(sc, mii, cmd)
if (mii_phy_auto(sc, 0) == EJUSTRETURN)
return (0);
break;
+
+ case MII_DOWN:
+ mii_phy_down(sc);
+ return (0);
}
/* Update the media status. */
diff --git a/sys/dev/mii/qsphy.c b/sys/dev/mii/qsphy.c
index 508b915561c..acbb0c7e833 100644
--- a/sys/dev/mii/qsphy.c
+++ b/sys/dev/mii/qsphy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: qsphy.c,v 1.13 1999/11/03 22:30:32 thorpej Exp $ */
+/* $NetBSD: qsphy.c,v 1.14 1999/11/12 18:13:01 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -215,6 +215,10 @@ qsphy_service(sc, mii, cmd)
* kicked; it continues in the background.
*/
break;
+
+ case MII_DOWN:
+ mii_phy_down(sc);
+ return (0);
}
/* Update the media status. */
diff --git a/sys/dev/mii/sqphy.c b/sys/dev/mii/sqphy.c
index 71b547c11b9..788f9358ff6 100644
--- a/sys/dev/mii/sqphy.c
+++ b/sys/dev/mii/sqphy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sqphy.c,v 1.11 1999/11/03 22:30:32 thorpej Exp $ */
+/* $NetBSD: sqphy.c,v 1.12 1999/11/12 18:13:01 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -231,6 +231,10 @@ sqphy_service(sc, mii, cmd)
if (mii_phy_auto(sc, 0) == EJUSTRETURN)
return (0);
break;
+
+ case MII_DOWN:
+ mii_phy_down(sc);
+ return (0);
}
/* Update the media status. */
diff --git a/sys/dev/mii/tlphy.c b/sys/dev/mii/tlphy.c
index ee4bb2ac4df..7b3b622d7bd 100644
--- a/sys/dev/mii/tlphy.c
+++ b/sys/dev/mii/tlphy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tlphy.c,v 1.19 1999/11/03 22:30:32 thorpej Exp $ */
+/* $NetBSD: tlphy.c,v 1.20 1999/11/12 18:13:01 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -294,6 +294,10 @@ tlphy_service(self, mii, cmd)
if (tlphy_auto(sc, 0) == EJUSTRETURN)
return (0);
break;
+
+ case MII_DOWN:
+ mii_phy_down(&sc->sc_mii);
+ return (0);
}
/* Update the media status. */
diff --git a/sys/dev/mii/tqphy.c b/sys/dev/mii/tqphy.c
index f938f4dd894..8d5217011fc 100644
--- a/sys/dev/mii/tqphy.c
+++ b/sys/dev/mii/tqphy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tqphy.c,v 1.3 1999/11/03 22:30:32 thorpej Exp $ */
+/* $NetBSD: tqphy.c,v 1.4 1999/11/12 18:13:01 thorpej Exp $ */
/*
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -239,6 +239,10 @@ tqphy_service(sc, mii, cmd)
if (mii_phy_auto(sc, 0) == EJUSTRETURN)
return (0);
break;
+
+ case MII_DOWN:
+ mii_phy_down(sc);
+ return (0);
}
/* Update the media status. */
diff --git a/sys/dev/mii/ukphy.c b/sys/dev/mii/ukphy.c
index bee15770181..70c2bf280de 100644
--- a/sys/dev/mii/ukphy.c
+++ b/sys/dev/mii/ukphy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ukphy.c,v 1.3 1999/11/03 22:30:32 thorpej Exp $ */
+/* $NetBSD: ukphy.c,v 1.4 1999/11/12 18:13:01 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -231,6 +231,10 @@ ukphy_service(sc, mii, cmd)
if (mii_phy_auto(sc, 0) == EJUSTRETURN)
return (0);
break;
+
+ case MII_DOWN:
+ mii_phy_down(sc);
+ return (0);
}
/* Update the media status. */