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 register...
details: https://anonhg.NetBSD.org/src/rev/d94792998c90
branches: trunk
changeset: 1029232:d94792998c90
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Tue Dec 28 06:35:37 2021 +0000
description:
QEMU e1000's PHY code doesn't implement register 16. Do workaround.
- Marvell 88E1[01]11 (and many other Marvell PHYs) have the Fiber/Copper
auto selection feature. Our makphy(4) implement it but QEMU doesn't.
If it fails, a garbage data is used in the attach function and unexpected
media may be used. Fix this behavior by checking the return value of
PHY_READ(MAKPHY_ESSR). If the access failed, the media is regarded
as copper only. It's just a cosmetic change. It's not affected to the
packet processing.
diffstat:
sys/dev/mii/makphy.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diffs (39 lines):
diff -r e264f8f41818 -r d94792998c90 sys/dev/mii/makphy.c
--- a/sys/dev/mii/makphy.c Tue Dec 28 06:34:40 2021 +0000
+++ b/sys/dev/mii/makphy.c Tue Dec 28 06:35:37 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: makphy.c,v 1.69 2021/12/28 06:34:40 msaitoh Exp $ */
+/* $NetBSD: makphy.c,v 1.70 2021/12/28 06:35:37 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.69 2021/12/28 06:34:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.70 2021/12/28 06:35:37 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -230,8 +230,18 @@
case MII_MODEL_xxMARVELL_E1011:
case MII_MODEL_xxMARVELL_E1111:
/* These devices have ESSR register */
- PHY_READ(sc, MAKPHY_ESSR, ®);
- if ((reg & ESSR_AUTOSEL_DISABLE) != 0) {
+ rv = PHY_READ(sc, MAKPHY_ESSR, ®);
+ if (rv != 0) {
+ /*
+ * XXX Emulator (e.g qemu) may not implement
+ * the ESSR register. If so, regard as copper
+ * media.
+ */
+ copperonly = true;
+ aprint_verbose_dev(self, "Failed to access "
+ "ESSR. Are you an emulator? Regard as "
+ "copper only media.\n");
+ } else if ((reg & ESSR_AUTOSEL_DISABLE) != 0) {
switch (reg & ESSR_HWCFG_MODE) {
case ESSR_RTBI_FIBER:
case ESSR_RGMII_FIBER:
Home |
Main Index |
Thread Index |
Old Index