Module Name: src
Committed By: msaitoh
Date: Wed Aug 6 02:55:50 UTC 2014
Modified Files:
src/sys/dev/pci: if_wm.c
Log Message:
Don't check SWSM_SMBI bit if WM_F_LOCK_SWSM isn't set. Fix a problem when
using vmware with e1000"e". With e1000e which is regarded as 82574L,
wm_gmii_init() fails with "could not acquire SWSM SMBI" message without
this change. This problem doesn't occur with real 82574L card.
TODO:
- Change the function name. It's difficult to understand. The name was
from old Intel original e1000 driver.
- Read Intel original driver again and check ALL location where semaphore is
used.
To generate a diff of this commit:
cvs rdiff -u -r1.286 -r1.287 src/sys/dev/pci/if_wm.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.286 src/sys/dev/pci/if_wm.c:1.287
--- src/sys/dev/pci/if_wm.c:1.286 Tue Aug 5 18:13:46 2014
+++ src/sys/dev/pci/if_wm.c Wed Aug 6 02:55:50 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.286 2014/08/05 18:13:46 msaitoh Exp $ */
+/* $NetBSD: if_wm.c,v 1.287 2014/08/06 02:55:50 msaitoh Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.286 2014/08/05 18:13:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.287 2014/08/06 02:55:50 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -8325,21 +8325,24 @@ wm_get_swsm_semaphore(struct wm_softc *s
int32_t timeout;
uint32_t swsm;
- /* Get the SW semaphore. */
- timeout = 1000 + 1; /* XXX */
- while (timeout) {
- swsm = CSR_READ(sc, WMREG_SWSM);
+ if (sc->sc_flags & WM_F_LOCK_SWSM) {
+ /* Get the SW semaphore. */
+ timeout = 1000 + 1; /* XXX */
+ while (timeout) {
+ swsm = CSR_READ(sc, WMREG_SWSM);
- if ((swsm & SWSM_SMBI) == 0)
- break;
+ if ((swsm & SWSM_SMBI) == 0)
+ break;
- delay(50);
- timeout--;
- }
+ delay(50);
+ timeout--;
+ }
- if (timeout == 0) {
- aprint_error_dev(sc->sc_dev, "could not acquire SWSM SMBI\n");
- return 1;
+ if (timeout == 0) {
+ aprint_error_dev(sc->sc_dev,
+ "could not acquire SWSM SMBI\n");
+ return 1;
+ }
}
/* Get the FW semaphore. */