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].
This commit is contained in:
msaitoh 2017-07-27 03:21:42 +00:00
parent 8b6a780bee
commit fd411f94be
2 changed files with 17 additions and 3 deletions

View File

@ -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 @@ alloc_retry:
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 @@ wm_get_swsm_semaphore(struct wm_softc *sc)
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 @@ wm_get_swsm_semaphore(struct wm_softc *sc)
}
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;

View File

@ -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" \