Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/mii Print vendor and model like ukphy(4).



details:   https://anonhg.NetBSD.org/src/rev/f3b3a21f3c06
branches:  trunk
changeset: 329845:f3b3a21f3c06
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Jun 11 22:34:26 2014 +0000

description:
Print vendor and model like ukphy(4).

diffstat:

 sys/dev/mii/gentbi.c |  22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diffs (48 lines):

diff -r 2f653ada9c19 -r f3b3a21f3c06 sys/dev/mii/gentbi.c
--- a/sys/dev/mii/gentbi.c      Wed Jun 11 20:09:17 2014 +0000
+++ b/sys/dev/mii/gentbi.c      Wed Jun 11 22:34:26 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gentbi.c,v 1.24 2009/10/19 18:41:13 bouyer Exp $       */
+/*     $NetBSD: gentbi.c,v 1.25 2014/06/11 22:34:26 msaitoh Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gentbi.c,v 1.24 2009/10/19 18:41:13 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gentbi.c,v 1.25 2014/06/11 22:34:26 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -130,14 +130,26 @@
        struct mii_softc *sc = device_private(self);
        struct mii_attach_args *ma = aux;
        struct mii_data *mii = ma->mii_data;
+       int oui = MII_OUI(ma->mii_id1, ma->mii_id2);
+       int model = MII_MODEL(ma->mii_id2);
+       int rev = MII_REV(ma->mii_id2);
+       const char *descr;
 
-       aprint_naive(": Media interface\n");
-       aprint_normal(": Generic ten-bit interface, rev. %d\n",
-           MII_REV(ma->mii_id2));
+       if ((descr = mii_get_descr(oui, model)) != NULL)
+               aprint_normal(": %s (OUI 0x%06x, model 0x%04x), rev. %d\n",
+                   descr, oui, model, rev);
+       else
+               aprint_normal(": OUI 0x%06x, model 0x%04x, rev. %d\n",
+                   oui, model, rev);
+
+       aprint_naive(": Generic ten-bit interface\n");
 
        sc->mii_dev = self;
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
+       sc->mii_mpd_oui = oui;
+       sc->mii_mpd_model = model;
+       sc->mii_mpd_rev = rev;
        sc->mii_funcs = &gentbi_funcs;
        sc->mii_pdata = mii;
        sc->mii_flags = ma->mii_flags;



Home | Main Index | Thread Index | Old Index