Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Add WM_F_WA_I210_CLSEM flag for a workaround. Fr...
details: https://anonhg.NetBSD.org/src/rev/218eff34cacb
branches: trunk
changeset: 355353:218eff34cacb
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Thu Jul 27 03:21:42 2017 +0000
description:
Add WM_F_WA_I210_CLSEM flag for a workaround. FreeBSD/Linux drivers say
"In rare circumstances, the SW semaphore may already be held unintentionally."
on I21[01]. PXE boot is one of the case.
XXX pullup-[678].
diffstat:
sys/dev/pci/if_wm.c | 17 +++++++++++++++--
sys/dev/pci/if_wmvar.h | 3 ++-
2 files changed, 17 insertions(+), 3 deletions(-)
diffs (69 lines):
diff -r a07d325bb795 -r 218eff34cacb sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c Thu Jul 27 02:11:24 2017 +0000
+++ b/sys/dev/pci/if_wm.c Thu Jul 27 03:21:42 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.532 2017/07/26 08:09:59 msaitoh Exp $ */
+/* $NetBSD: if_wm.c,v 1.533 2017/07/27 03:21:42 msaitoh Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.532 2017/07/26 08:09:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.533 2017/07/27 03:21:42 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -2215,6 +2215,8 @@
break;
case WM_T_I210:
case WM_T_I211:
+ /* Allow a single clear of the SW semaphore on I210 and newer*/
+ sc->sc_flags |= WM_F_WA_I210_CLSEM;
if (wm_nvm_get_flash_presence_i210(sc)) {
sc->nvm.read = wm_nvm_read_eerd;
/* Don't use WM_F_LOCK_EECD because we use EERD */
@@ -12704,6 +12706,7 @@
device_xname(sc->sc_dev), __func__));
KASSERT(sc->sc_nvm_wordsize > 0);
+retry:
/* Get the SW semaphore. */
timeout = sc->sc_nvm_wordsize + 1;
while (timeout) {
@@ -12717,6 +12720,16 @@
}
if (timeout == 0) {
+ if ((sc->sc_flags & WM_F_WA_I210_CLSEM) != 0) {
+ /*
+ * In rare circumstances, the SW semaphore may already
+ * be held unintentionally. Clear the semaphore once
+ * before giving up.
+ */
+ sc->sc_flags &= ~WM_F_WA_I210_CLSEM;
+ wm_put_swsm_semaphore(sc);
+ goto retry;
+ }
aprint_error_dev(sc->sc_dev,
"could not acquire SWSM SMBI\n");
return 1;
diff -r a07d325bb795 -r 218eff34cacb sys/dev/pci/if_wmvar.h
--- a/sys/dev/pci/if_wmvar.h Thu Jul 27 02:11:24 2017 +0000
+++ b/sys/dev/pci/if_wmvar.h Thu Jul 27 03:21:42 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wmvar.h,v 1.36 2017/07/26 06:48:49 msaitoh Exp $ */
+/* $NetBSD: if_wmvar.h,v 1.37 2017/07/27 03:21:42 msaitoh Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -96,6 +96,7 @@
#define WM_F_80003_MDIC_WA 0x01000000 /* 80003 MDIC workaround */
#define WM_F_PCS_DIS_AUTONEGO 0x02000000 /* PCS Disable Autonego */
#define WM_F_PLL_WA_I210 0x04000000 /* I21[01] PLL workaround */
+#define WM_F_WA_I210_CLSEM 0x08000000 /* I21[01] Semaphore workaround */
#define WM_FLAGS "\20" \
"\1" "HAS_MII" "\2" "LOCK_EECD" "\3" "_B02" "\4" "_B03" \
Home |
Main Index |
Thread Index |
Old Index