Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Fix a bug that wm_detach() didn't unmap the FLAS...



details:   https://anonhg.NetBSD.org/src/rev/6ad13799a7c5
branches:  trunk
changeset: 339080:6ad13799a7c5
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Jun 26 06:57:17 2015 +0000

description:
Fix a bug that wm_detach() didn't unmap the FLASH's area.
Now "drvctl -d wm0" -> "drvctl -r pci0" works on ICH* and PCH*.

diffstat:

 sys/dev/pci/if_wm.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (51 lines):

diff -r 9aa2fb970db5 -r 6ad13799a7c5 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Fri Jun 26 02:43:26 2015 +0000
+++ b/sys/dev/pci/if_wm.c       Fri Jun 26 06:57:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.335 2015/06/13 15:47:58 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.336 2015/06/26 06:57:17 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.335 2015/06/13 15:47:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.336 2015/06/26 06:57:17 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -295,6 +295,7 @@
        bus_size_t sc_ios;              /* I/O space size */
        bus_space_tag_t sc_flasht;      /* flash registers space tag */
        bus_space_handle_t sc_flashh;   /* flash registers space handle */
+       bus_size_t sc_flashs;           /* flash registers space size */
        bus_dma_tag_t sc_dmat;          /* bus DMA tag */
 
        struct ethercom sc_ethercom;    /* ethernet common data */
@@ -2061,7 +2062,7 @@
                sc->sc_nvm_wordsize = 2048;
                memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, WM_ICH8_FLASH);
                if (pci_mapreg_map(pa, WM_ICH8_FLASH, memtype, 0,
-                   &sc->sc_flasht, &sc->sc_flashh, NULL, NULL)) {
+                   &sc->sc_flasht, &sc->sc_flashh, NULL, &sc->sc_flashs)) {
                        aprint_error_dev(sc->sc_dev,
                            "can't map FLASH registers\n");
                        goto fail_5;
@@ -2807,11 +2808,14 @@
                bus_space_unmap(sc->sc_st, sc->sc_sh, sc->sc_ss);
                sc->sc_ss = 0;
        }
-
        if (sc->sc_ios) {
                bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_ios);
                sc->sc_ios = 0;
        }
+       if (sc->sc_flashs) {
+               bus_space_unmap(sc->sc_flasht, sc->sc_flashh, sc->sc_flashs);
+               sc->sc_flashs = 0;
+       }
 
        if (sc->sc_tx_lock)
                mutex_obj_free(sc->sc_tx_lock);



Home | Main Index | Thread Index | Old Index