Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci On 8254[17] with SPI ROM, wm_nvm_set_addrbits_si...



details:   https://anonhg.NetBSD.org/src/rev/e1c48f6452a2
branches:  trunk
changeset: 355340:e1c48f6452a2
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Jul 26 08:09:59 2017 +0000

description:
On 8254[17] with SPI ROM, wm_nvm_set_addrbits_size_eecd() calls wm_nvm_read(),
so it's required to set flags and functions before calling it. It was broken
again in if_wm.c rev. 1.530 (see also 1.313). Tested with Dell Power Edge 1850.

diffstat:

 sys/dev/pci/if_wm.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r fc06fbabdf02 -r e1c48f6452a2 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Wed Jul 26 07:45:05 2017 +0000
+++ b/sys/dev/pci/if_wm.c       Wed Jul 26 08:09:59 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.531 2017/07/26 06:48:49 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.532 2017/07/26 08:09:59 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.531 2017/07/26 06:48:49 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.532 2017/07/26 08:09:59 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2078,6 +2078,13 @@
        case WM_T_82547:
        case WM_T_82547_2:
                reg = CSR_READ(sc, WMREG_EECD);
+               /*
+                * wm_nvm_set_addrbits_size_eecd() accesses SPI in it only
+                * on 8254[17], so set flags and functios before calling it.
+                */
+               sc->sc_flags |= WM_F_LOCK_EECD;
+               sc->nvm.acquire = wm_get_eecd;
+               sc->nvm.release = wm_put_eecd;
                if (reg & EECD_EE_TYPE) {
                        /* SPI */
                        sc->nvm.read = wm_nvm_read_spi;
@@ -2094,9 +2101,6 @@
                                sc->sc_nvm_addrbits = 6;
                        }
                }
-               sc->sc_flags |= WM_F_LOCK_EECD;
-               sc->nvm.acquire = wm_get_eecd;
-               sc->nvm.release = wm_put_eecd;
                break;
        case WM_T_82571:
        case WM_T_82572:



Home | Main Index | Thread Index | Old Index