Module Name:    src
Committed By:   msaitoh
Date:           Wed Jun 11 22:34:26 UTC 2014

Modified Files:
        src/sys/dev/mii: gentbi.c

Log Message:
Print vendor and model like ukphy(4).


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/mii/gentbi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/gentbi.c
diff -u src/sys/dev/mii/gentbi.c:1.24 src/sys/dev/mii/gentbi.c:1.25
--- src/sys/dev/mii/gentbi.c:1.24	Mon Oct 19 18:41:13 2009
+++ src/sys/dev/mii/gentbi.c	Wed Jun 11 22:34:26 2014
@@ -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 @@ gentbiattach(device_t parent, device_t s
 	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;
+
+	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(": Media interface\n");
-	aprint_normal(": Generic ten-bit interface, rev. %d\n",
-	    MII_REV(ma->mii_id2));
+	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;

Reply via email to