Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Don't check SWSM_SMBI bit if WM_F_LOCK_SWSM isn'...



details:   https://anonhg.NetBSD.org/src/rev/650f07c02d7a
branches:  trunk
changeset: 331225:650f07c02d7a
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Aug 06 02:55:50 2014 +0000

description:
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.

diffstat:

 sys/dev/pci/if_wm.c |  37 ++++++++++++++++++++-----------------
 1 files changed, 20 insertions(+), 17 deletions(-)

diffs (58 lines):

diff -r aa880c6afeed -r 650f07c02d7a sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Tue Aug 05 21:54:39 2014 +0000
+++ b/sys/dev/pci/if_wm.c       Wed Aug 06 02:55:50 2014 +0000
@@ -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 @@
        int32_t timeout;
        uint32_t swsm;
 
-       /* Get the SW semaphore. */
-       timeout = 1000 + 1; /* XXX */
-       while (timeout) {
-               swsm = CSR_READ(sc, WMREG_SWSM);
-
-               if ((swsm & SWSM_SMBI) == 0)
-                       break;
-
-               delay(50);
-               timeout--;
-       }
-
-       if (timeout == 0) {
-               aprint_error_dev(sc->sc_dev, "could not acquire SWSM SMBI\n");
-               return 1;
+       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;
+
+                       delay(50);
+                       timeout--;
+               }
+
+               if (timeout == 0) {
+                       aprint_error_dev(sc->sc_dev,
+                           "could not acquire SWSM SMBI\n");
+                       return 1;
+               }
        }
 
        /* Get the FW semaphore. */



Home | Main Index | Thread Index | Old Index