Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Improve error check:
details: https://anonhg.NetBSD.org/src/rev/a18509992220
branches: trunk
changeset: 970118:a18509992220
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Fri Mar 13 05:10:39 2020 +0000
description:
Improve error check:
- We check PHY register read error correctly (timeout and NFE_PHY_ERROR), so
don't check NFE_PHY_DATA register's value with 0xffffffff or 0. At least,
some registers may have 0.
- Check NFE_PHY_ERROR bit in nfe_miibus_writereg().
- Improve debug printf
diffstat:
sys/dev/pci/if_nfe.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diffs (62 lines):
diff -r bd1aa7abcd2d -r a18509992220 sys/dev/pci/if_nfe.c
--- a/sys/dev/pci/if_nfe.c Fri Mar 13 04:44:58 2020 +0000
+++ b/sys/dev/pci/if_nfe.c Fri Mar 13 05:10:39 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_nfe.c,v 1.77 2020/03/08 14:10:24 msaitoh Exp $ */
+/* $NetBSD: if_nfe.c,v 1.78 2020/03/13 05:10:39 msaitoh Exp $ */
/* $OpenBSD: if_nfe.c,v 1.77 2008/02/05 16:52:50 brad Exp $ */
/*-
@@ -21,7 +21,7 @@
/* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.77 2020/03/08 14:10:24 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.78 2020/03/13 05:10:39 msaitoh Exp $");
#include "opt_inet.h"
#include "vlan.h"
@@ -555,20 +555,19 @@
break;
}
if (ntries == 1000) {
- DPRINTFN(2, ("%s: timeout waiting for PHY\n",
- device_xname(sc->sc_dev)));
+ DPRINTFN(2, ("%s: timeout waiting for PHY read (%d, %d)\n",
+ device_xname(sc->sc_dev), phy, reg));
return ETIMEDOUT;
}
if (NFE_READ(sc, NFE_PHY_STATUS) & NFE_PHY_ERROR) {
- DPRINTFN(2, ("%s: could not read PHY\n",
- device_xname(sc->sc_dev)));
+ DPRINTFN(2, ("%s: could not read PHY (%d, %d)\n",
+ device_xname(sc->sc_dev), phy, reg));
return -1;
}
data = NFE_READ(sc, NFE_PHY_DATA);
- if (data != 0xffffffff && data != 0)
- sc->mii_phyaddr = phy;
+ sc->mii_phyaddr = phy;
DPRINTFN(2, ("%s: mii read phy %d reg 0x%x data 0x%x\n",
device_xname(sc->sc_dev), phy, reg, data));
@@ -603,10 +602,16 @@
if (ntries == 1000) {
#ifdef NFE_DEBUG
if (nfedebug >= 2)
- printf("could not write to PHY\n");
+ printf("timeout waiting for PHY write (%d, %d)\n",
+ phy, reg);
#endif
return ETIMEDOUT;
}
+ if (NFE_READ(sc, NFE_PHY_STATUS) & NFE_PHY_ERROR) {
+ DPRINTFN(2, ("%s: could not write PHY (%d, %d)\n",
+ device_xname(sc->sc_dev), phy, reg));
+ return -1;
+ }
return 0;
}
Home |
Main Index |
Thread Index |
Old Index