Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/mii QEMU e1000's PHY code doesn't implement page 0 r...



details:   https://anonhg.NetBSD.org/src/rev/e264f8f41818
branches:  trunk
changeset: 1029231:e264f8f41818
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Dec 28 06:34:40 2021 +0000

description:
QEMU e1000's PHY code doesn't implement page 0 register 15. Do workaround.

 - The BMSR register bit 8 (BMSR_EXTSTAT) denote the existence of page 0
   register 15. qemu's e1000 sets BMSR_EXTSTAT but the access to register 15
   fails. It doesn't conforms to the IEEE standard. Our makphy automatically
   check the existence of 1000BASE-T or 1000BASE-SX by accessing the register
   15. If the access failed, neither 1000BASE-T nor 1000BASE-SX is set to
   the ability(mii_extcapabilities). Set EXTSR_1000TFDX and EXTSR_1000THDX
   if the access failed in the attach function. It's just a cosmetic change.
   It's not affected to the packet processing.

diffstat:

 sys/dev/mii/makphy.c |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r 31e458bf8651 -r e264f8f41818 sys/dev/mii/makphy.c
--- a/sys/dev/mii/makphy.c      Tue Dec 28 01:27:37 2021 +0000
+++ b/sys/dev/mii/makphy.c      Tue Dec 28 06:34:40 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: makphy.c,v 1.68 2020/11/04 09:15:10 msaitoh Exp $      */
+/*     $NetBSD: makphy.c,v 1.69 2021/12/28 06:34:40 msaitoh Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.68 2020/11/04 09:15:10 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.69 2021/12/28 06:34:40 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -160,6 +160,7 @@
        struct makphy_softc *maksc = (struct makphy_softc *)sc;
        const char *name;
        uint16_t reg, model;
+       int rv;
 
        mpd = mii_phy_match(ma, makphys);
        aprint_naive(": Media interface\n");
@@ -207,8 +208,16 @@
 
        PHY_READ(sc, MII_BMSR, &sc->mii_capabilities);
        sc->mii_capabilities &= ma->mii_capmask;
-       if (sc->mii_capabilities & BMSR_EXTSTAT)
-               PHY_READ(sc, MII_EXTSR, &sc->mii_extcapabilities);
+       if (sc->mii_capabilities & BMSR_EXTSTAT) {
+               rv = PHY_READ(sc, MII_EXTSR, &sc->mii_extcapabilities);
+               if (rv != 0) {
+                       aprint_verbose_dev(self, "Failed to read EXTSR. "
+                           "Are you an emulator?. "
+                           "Regard as 1000BASE-T.\n");
+                       sc->mii_extcapabilities
+                           |= EXTSR_1000TFDX | EXTSR_1000THDX;
+               }
+       }
 
        if (((sc->mii_extcapabilities & (EXTSR_1000TFDX | EXTSR_1000THDX))
                != 0)



Home | Main Index | Thread Index | Old Index