summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrad <brad@openbsd.org>2008-09-03 19:29:48 +0000
committerbrad <brad@openbsd.org>2008-09-03 19:29:48 +0000
commitf11a01cc09a2ce8ed133f85a98ca7ebea1eba586 (patch)
treef37af064b20d93a5ee467a6d1ab3b55a182fb241
parentremove now obsolete calloc implementation; prompted by miod (diff)
downloadwireguard-openbsd-f11a01cc09a2ce8ed133f85a98ca7ebea1eba586.tar.xz
wireguard-openbsd-f11a01cc09a2ce8ed133f85a98ca7ebea1eba586.zip
In dc_setcfg() suppress printing a warning when forcing the receiver
and transmitter to idle state times out for chips where the status bits in question never change (observed in detail with DM9102A) and therefore the warning would highly likely be a false positive. From FreeBSD
-rw-r--r--sys/dev/ic/dc.c15
-rw-r--r--sys/dev/ic/dcreg.h6
2 files changed, 16 insertions, 5 deletions
diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c
index 7686db16fce..366fb99ce4c 100644
--- a/sys/dev/ic/dc.c
+++ b/sys/dev/ic/dc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dc.c,v 1.99 2007/11/26 17:45:14 brad Exp $ */
+/* $OpenBSD: dc.c,v 1.100 2008/09/03 19:29:48 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -1264,9 +1264,16 @@ dc_setcfg(sc, media)
DELAY(10);
}
- if (i == DC_TIMEOUT)
- printf("%s: failed to force tx and "
- "rx to idle state\n", sc->sc_dev.dv_xname);
+ if (i == DC_TIMEOUT) {
+ if (!(isr & DC_ISR_TX_IDLE) && !DC_IS_ASIX(sc))
+ printf("%s: failed to force tx to idle state\n",
+ sc->sc_dev.dv_xname);
+ if (!((isr & DC_ISR_RX_STATE) == DC_RXSTATE_STOPPED ||
+ (isr & DC_ISR_RX_STATE) == DC_RXSTATE_WAIT) &&
+ !DC_HAS_BROKEN_RXSTATE(sc))
+ printf("%s: failed to force rx to idle state\n",
+ sc->sc_dev.dv_xname);
+ }
}
if (IFM_SUBTYPE(media) == IFM_100_TX) {
diff --git a/sys/dev/ic/dcreg.h b/sys/dev/ic/dcreg.h
index 94938182f44..d86887ea2f7 100644
--- a/sys/dev/ic/dcreg.h
+++ b/sys/dev/ic/dcreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dcreg.h,v 1.43 2008/07/21 04:12:21 kevlo Exp $ */
+/* $OpenBSD: dcreg.h,v 1.44 2008/09/03 19:29:48 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -195,6 +195,10 @@
#define DC_RXSTATE_FLUSH 0x000C0000 /* 110 - flush from FIFO */
#define DC_RXSTATE_DEQUEUE 0x000E0000 /* 111 - dequeue from FIFO */
+#define DC_HAS_BROKEN_RXSTATE(x) \
+ (DC_IS_CENTAUR(x) || DC_IS_CONEXANT(x) || (DC_IS_DAVICOM(x) && \
+ sc->dc_revision >= DC_REVISION_DM9102A))
+
#define DC_TXSTATE_RESET 0x00000000 /* 000 - reset */
#define DC_TXSTATE_FETCH 0x00100000 /* 001 - fetching descriptor */
#define DC_TXSTATE_WAITEND 0x00200000 /* 010 - wait for tx end */