Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/mii Add a PHY `offset' (e.g. "first PHY on bus, seco...



details:   https://anonhg.NetBSD.org/src/rev/1a957ed8114e
branches:  trunk
changeset: 476685:1a957ed8114e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Sep 25 00:10:13 1999 +0000

description:
Add a PHY `offset' (e.g. "first PHY on bus, second PHY on bus, ...") to
the PHY's softc.

diffstat:

 sys/dev/mii/mii.c    |  25 +++++++++++++++++++++++--
 sys/dev/mii/miivar.h |   3 ++-
 2 files changed, 25 insertions(+), 3 deletions(-)

diffs (69 lines):

diff -r e225b1c9fb54 -r 1a957ed8114e sys/dev/mii/mii.c
--- a/sys/dev/mii/mii.c Sat Sep 25 00:03:22 1999 +0000
+++ b/sys/dev/mii/mii.c Sat Sep 25 00:10:13 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mii.c,v 1.12 1999/08/03 19:41:49 drochner Exp $        */
+/*     $NetBSD: mii.c,v 1.13 1999/09/25 00:10:13 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -69,11 +69,30 @@
 {
        struct mii_attach_args ma;
        struct mii_softc *child;
-       int bmsr;
+       int bmsr, offset = 0;
 
        LIST_INIT(&mii->mii_phys);
 
        for (ma.mii_phyno = 0; ma.mii_phyno < MII_NPHY; ma.mii_phyno++) {
+#if 0 /* XXX not yet --thorpej */
+               /*
+                * Make sure we haven't already configured a PHY at this
+                * address.  This allows mii_phy_probe() to be called
+                * multiple times.
+                */
+               for (child = LIST_FIRST(&mii->mii_phys); child != NULL;
+                    child = LIST_NEXT(child, mii_list)) {
+                       if (child->mii_phy == ma.mii_phyno) {
+                               /*
+                                * Yes, there is already something
+                                * configured at this address.
+                                */
+                               continue;
+                               offset++;
+                       }
+               }
+#endif
+
                /*
                 * Check to see if there is a PHY at this address.  Note,
                 * many braindead PHYs report 0/0 in their ID registers,
@@ -105,8 +124,10 @@
                         * Link it up in the parent's MII data.
                         */
                        LIST_INSERT_HEAD(&mii->mii_phys, child, mii_list);
+                       child->mii_offset = offset;
                        mii->mii_instance++;
                }
+               offset++;
        }
 }
 
diff -r e225b1c9fb54 -r 1a957ed8114e sys/dev/mii/miivar.h
--- a/sys/dev/mii/miivar.h      Sat Sep 25 00:03:22 1999 +0000
+++ b/sys/dev/mii/miivar.h      Sat Sep 25 00:10:13 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: miivar.h,v 1.8 1999/04/23 04:24:32 thorpej Exp $       */
+/*     $NetBSD: miivar.h,v 1.9 1999/09/25 00:10:13 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -114,6 +114,7 @@
        LIST_ENTRY(mii_softc) mii_list; /* entry on parent's PHY list */
 
        int mii_phy;                    /* our MII address */
+       int mii_offset;                 /* first PHY, second PHY, etc. */
        int mii_inst;                   /* instance for ifmedia */
 
        mii_downcall_t mii_service;     /* our downcall */



Home | Main Index | Thread Index | Old Index