Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci/ixgbe Print PHY ID.



details:   https://anonhg.NetBSD.org/src/rev/89121d2c0f0c
branches:  trunk
changeset: 354898:89121d2c0f0c
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Jul 03 08:29:58 2017 +0000

description:
Print PHY ID.

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diffs (48 lines):

diff -r bf58d8ecff5f -r 89121d2c0f0c sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Mon Jul 03 08:29:22 2017 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Mon Jul 03 08:29:58 2017 +0000
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 302384 2016-07-07 03:39:18Z sbruno $*/
-/*$NetBSD: ixgbe.c,v 1.94 2017/06/27 10:33:09 msaitoh Exp $*/
+/*$NetBSD: ixgbe.c,v 1.95 2017/07/03 08:29:58 msaitoh Exp $*/
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -71,6 +71,8 @@
 #include "vlan.h"
 
 #include <sys/cprng.h>
+#include <dev/mii/mii.h>
+#include <dev/mii/miivar.h>
 
 /*********************************************************************
  *  Driver version
@@ -722,6 +724,26 @@
                break;
        }
 
+       if (hw->phy.id != 0) {
+               uint16_t id1, id2;
+               int oui, model, rev;
+               const char *descr;
+
+               id1 = hw->phy.id >> 16;
+               id2 = hw->phy.id & 0xffff;
+               oui = MII_OUI(id1, id2);
+               model = MII_MODEL(id2);
+               rev = MII_REV(id2);
+               if ((descr = mii_get_descr(oui, model)) != NULL)
+                       aprint_normal_dev(dev,
+                           "PHY: %s (OUI 0x%06x, model 0x%04x), rev. %d\n",
+                           descr, oui, model, rev);
+               else
+                       aprint_normal_dev(dev,
+                           "PHY OUI 0x%06x, model 0x%04x, rev. %d\n",
+                           oui, model, rev);
+       }
+
        /* hw.ix defaults init */
        ixgbe_set_advertise(adapter, ixgbe_advertise_speed);
        ixgbe_set_flowcntl(adapter, ixgbe_flow_control);



Home | Main Index | Thread Index | Old Index