Module Name: src
Committed By: msaitoh
Date: Tue Dec 28 06:34:40 UTC 2021
Modified Files:
src/sys/dev/mii: makphy.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/mii/makphy.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/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.68 src/sys/dev/mii/makphy.c:1.69
--- src/sys/dev/mii/makphy.c:1.68 Wed Nov 4 09:15:10 2020
+++ src/sys/dev/mii/makphy.c Tue Dec 28 06:34:40 2021
@@ -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 @@ makphyattach(device_t parent, device_t s
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 @@ page0:
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)