Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/mii Make PHY drivers provide a pointer to their stat...



details:   https://anonhg.NetBSD.org/src/rev/4bc1aeca9f91
branches:  trunk
changeset: 481615:4bc1aeca9f91
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Feb 02 17:50:43 2000 +0000

description:
Make PHY drivers provide a pointer to their status routine, and add
a generic mii_phy_status() that calls back into the PHY.  It doesn't
do anything interesting yet, but it will soon.

diffstat:

 sys/dev/mii/dmphy.c       |   5 +++--
 sys/dev/mii/exphy.c       |   5 +++--
 sys/dev/mii/icsphy.c      |   5 +++--
 sys/dev/mii/inphy.c       |   5 +++--
 sys/dev/mii/iophy.c       |   5 +++--
 sys/dev/mii/lxtphy.c      |   5 +++--
 sys/dev/mii/mii_physubr.c |  10 +++++++++-
 sys/dev/mii/miivar.h      |  14 +++++++++++---
 sys/dev/mii/nsphy.c       |   5 +++--
 sys/dev/mii/nsphyter.c    |   5 +++--
 sys/dev/mii/qsphy.c       |   5 +++--
 sys/dev/mii/sqphy.c       |   5 +++--
 sys/dev/mii/tlphy.c       |  12 +++++++-----
 sys/dev/mii/tqphy.c       |   5 +++--
 sys/dev/mii/ukphy.c       |   5 +++--
 15 files changed, 63 insertions(+), 33 deletions(-)

diffs (truncated from 435 to 300 lines):

diff -r b83d67d0358c -r 4bc1aeca9f91 sys/dev/mii/dmphy.c
--- a/sys/dev/mii/dmphy.c       Wed Feb 02 17:46:42 2000 +0000
+++ b/sys/dev/mii/dmphy.c       Wed Feb 02 17:50:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dmphy.c,v 1.3 2000/02/02 17:09:43 thorpej Exp $        */
+/*     $NetBSD: dmphy.c,v 1.4 2000/02/02 17:50:43 thorpej Exp $        */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -129,6 +129,7 @@
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
        sc->mii_service = dmphy_service;
+       sc->mii_status = dmphy_status;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
@@ -243,7 +244,7 @@
        }
 
        /* Update the media status. */
-       dmphy_status(sc);
+       mii_phy_status(sc);
 
        /* Callback if something changed. */
        if (sc->mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
diff -r b83d67d0358c -r 4bc1aeca9f91 sys/dev/mii/exphy.c
--- a/sys/dev/mii/exphy.c       Wed Feb 02 17:46:42 2000 +0000
+++ b/sys/dev/mii/exphy.c       Wed Feb 02 17:50:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exphy.c,v 1.21 2000/02/02 17:09:43 thorpej Exp $       */
+/*     $NetBSD: exphy.c,v 1.22 2000/02/02 17:50:43 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -133,6 +133,7 @@
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
        sc->mii_service = exphy_service;
+       sc->mii_status = ukphy_status;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
@@ -226,7 +227,7 @@
        }
 
        /* Update the media status. */
-       ukphy_status(sc);
+       mii_phy_status(sc);
 
        /* Callback if something changed. */
        if (sc->mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
diff -r b83d67d0358c -r 4bc1aeca9f91 sys/dev/mii/icsphy.c
--- a/sys/dev/mii/icsphy.c      Wed Feb 02 17:46:42 2000 +0000
+++ b/sys/dev/mii/icsphy.c      Wed Feb 02 17:50:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icsphy.c,v 1.15 2000/02/02 17:09:43 thorpej Exp $      */
+/*     $NetBSD: icsphy.c,v 1.16 2000/02/02 17:50:43 thorpej Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -129,6 +129,7 @@
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
        sc->mii_service = icsphy_service;
+       sc->mii_status = icsphy_status;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
@@ -227,7 +228,7 @@
        }
 
        /* Update the media status. */
-       icsphy_status(sc);
+       mii_phy_status(sc);
 
        /* Callback if something changed. */
        if (sc->mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
diff -r b83d67d0358c -r 4bc1aeca9f91 sys/dev/mii/inphy.c
--- a/sys/dev/mii/inphy.c       Wed Feb 02 17:46:42 2000 +0000
+++ b/sys/dev/mii/inphy.c       Wed Feb 02 17:50:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: inphy.c,v 1.16 2000/02/02 17:09:43 thorpej Exp $       */
+/*     $NetBSD: inphy.c,v 1.17 2000/02/02 17:50:44 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -129,6 +129,7 @@
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
        sc->mii_service = inphy_service;
+       sc->mii_status = inphy_status;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
@@ -243,7 +244,7 @@
        }
 
        /* Update the media status. */
-       inphy_status(sc);
+       mii_phy_status(sc);
 
        /* Callback if something changed. */
        if (sc->mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
diff -r b83d67d0358c -r 4bc1aeca9f91 sys/dev/mii/iophy.c
--- a/sys/dev/mii/iophy.c       Wed Feb 02 17:46:42 2000 +0000
+++ b/sys/dev/mii/iophy.c       Wed Feb 02 17:50:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iophy.c,v 1.6 2000/02/02 17:09:44 thorpej Exp $        */
+/*     $NetBSD: iophy.c,v 1.7 2000/02/02 17:50:44 thorpej Exp $        */
 
 /*
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -131,6 +131,7 @@
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
        sc->mii_service = iophy_service;
+       sc->mii_status = iophy_status;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
@@ -245,7 +246,7 @@
        }
 
        /* Update the media status. */
-       iophy_status(sc);
+       mii_phy_status(sc);
 
        /* Callback if something changed. */
        if (sc->mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
diff -r b83d67d0358c -r 4bc1aeca9f91 sys/dev/mii/lxtphy.c
--- a/sys/dev/mii/lxtphy.c      Wed Feb 02 17:46:42 2000 +0000
+++ b/sys/dev/mii/lxtphy.c      Wed Feb 02 17:50:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lxtphy.c,v 1.17 2000/02/02 17:09:44 thorpej Exp $      */
+/*     $NetBSD: lxtphy.c,v 1.18 2000/02/02 17:50:44 thorpej Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -129,6 +129,7 @@
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
        sc->mii_service = lxtphy_service;
+       sc->mii_status = lxtphy_status;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
@@ -244,7 +245,7 @@
        }
 
        /* Update the media status. */
-       lxtphy_status(sc);
+       mii_phy_status(sc);
 
        /* Callback if something changed. */
        if (sc->mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
diff -r b83d67d0358c -r 4bc1aeca9f91 sys/dev/mii/mii_physubr.c
--- a/sys/dev/mii/mii_physubr.c Wed Feb 02 17:46:42 2000 +0000
+++ b/sys/dev/mii/mii_physubr.c Wed Feb 02 17:50:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mii_physubr.c,v 1.10 2000/02/02 08:05:33 thorpej Exp $ */
+/*     $NetBSD: mii_physubr.c,v 1.11 2000/02/02 17:50:45 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -190,6 +190,14 @@
        }
 }
 
+void
+mii_phy_status(sc)
+       struct mii_softc *sc;
+{
+
+       (*sc->mii_status)(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 -r b83d67d0358c -r 4bc1aeca9f91 sys/dev/mii/miivar.h
--- a/sys/dev/mii/miivar.h      Wed Feb 02 17:46:42 2000 +0000
+++ b/sys/dev/mii/miivar.h      Wed Feb 02 17:50:43 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: miivar.h,v 1.15 2000/02/02 17:09:44 thorpej Exp $      */
+/*     $NetBSD: miivar.h,v 1.16 2000/02/02 17:50:45 thorpej Exp $      */
 
 /*-
- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -43,7 +43,7 @@
 #include <sys/queue.h>
 
 /*
- * Media Independent Interface autoconfiguration defintions.
+ * Media Independent Interface datat structure defintions.
  */
 
 struct mii_softc;
@@ -96,6 +96,11 @@
 typedef        int (*mii_downcall_t) __P((struct mii_softc *, struct mii_data *, int));
 
 /*
+ * This is a call back into the PHY driver made by a `status request'.
+ */
+typedef void (*mii_statusreq_t) __P((struct mii_softc *));
+
+/*
  * Requests that can be made to the downcall.
  */
 #define        MII_TICK        1       /* once-per-second tick */
@@ -118,6 +123,7 @@
        int mii_inst;                   /* instance for ifmedia */
 
        mii_downcall_t mii_service;     /* our downcall */
+       mii_statusreq_t mii_status;     /* our status request fn */
        struct mii_data *mii_pdata;     /* pointer to parent's mii_data */
 
        int mii_flags;                  /* misc. flags; see below */
@@ -204,6 +210,8 @@
 void   mii_phy_reset __P((struct mii_softc *));
 void   mii_phy_down __P((struct mii_softc *));
 
+void   mii_phy_status __P((struct mii_softc *));
+
 void   ukphy_status __P((struct mii_softc *));
 #endif /* _KERNEL */
 
diff -r b83d67d0358c -r 4bc1aeca9f91 sys/dev/mii/nsphy.c
--- a/sys/dev/mii/nsphy.c       Wed Feb 02 17:46:42 2000 +0000
+++ b/sys/dev/mii/nsphy.c       Wed Feb 02 17:50:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nsphy.c,v 1.23 2000/02/02 17:09:44 thorpej Exp $       */
+/*     $NetBSD: nsphy.c,v 1.24 2000/02/02 17:50:45 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -129,6 +129,7 @@
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
        sc->mii_service = nsphy_service;
+       sc->mii_status = nsphy_status;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
@@ -275,7 +276,7 @@
        }
 
        /* Update the media status. */
-       nsphy_status(sc);
+       mii_phy_status(sc);
 
        /* Callback if something changed. */
        if (sc->mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
diff -r b83d67d0358c -r 4bc1aeca9f91 sys/dev/mii/nsphyter.c
--- a/sys/dev/mii/nsphyter.c    Wed Feb 02 17:46:42 2000 +0000
+++ b/sys/dev/mii/nsphyter.c    Wed Feb 02 17:50:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nsphyter.c,v 1.3 2000/02/02 17:09:45 thorpej Exp $     */
+/*     $NetBSD: nsphyter.c,v 1.4 2000/02/02 17:50:46 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -129,6 +129,7 @@
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
        sc->mii_service = nsphyter_service;
+       sc->mii_status = nsphyter_status;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 
@@ -240,7 +241,7 @@
        }
 
        /* Update the media status. */
-       nsphyter_status(sc);
+       mii_phy_status(sc);
 
        /* Callback if something changed. */
        if (sc->mii_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
diff -r b83d67d0358c -r 4bc1aeca9f91 sys/dev/mii/qsphy.c
--- a/sys/dev/mii/qsphy.c       Wed Feb 02 17:46:42 2000 +0000
+++ b/sys/dev/mii/qsphy.c       Wed Feb 02 17:50:43 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: qsphy.c,v 1.17 2000/02/02 17:09:45 thorpej Exp $       */
+/*     $NetBSD: qsphy.c,v 1.18 2000/02/02 17:50:46 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -129,6 +129,7 @@
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
        sc->mii_service = qsphy_service;
+       sc->mii_status = qsphy_status;
        sc->mii_pdata = mii;
        sc->mii_flags = mii->mii_flags;
 



Home | Main Index | Thread Index | Old Index