diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2008-06-08 06:18:08 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2008-06-08 06:18:08 +0000 |
commit | 62738fdf9c6aeb6181d7ddc4f564f1b06484150c (patch) | |
tree | b0af33bd603e8bf2d003180158eef33709e19d20 /sys/dev/pci | |
parent | 03fb57c1730ae53892a0df046b1a053e8be1b7ee (diff) |
Unmapping memory from pci_mapreg_map() on detach lets us
do multiple inserts/detaches as well.
ok jsing@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_et.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/if_etreg.h | 3 |
2 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/pci/if_et.c b/sys/dev/pci/if_et.c index 158f8713c67..6346c78c0c7 100644 --- a/sys/dev/pci/if_et.c +++ b/sys/dev/pci/if_et.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_et.c,v 1.10 2008/06/08 05:53:30 jsg Exp $ */ +/* $OpenBSD: if_et.c,v 1.11 2008/06/08 06:18:07 jsg Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. * @@ -193,7 +193,6 @@ et_attach(struct device *parent, struct device *self, void *aux) pci_intr_handle_t ih; const char *intrstr; struct ifnet *ifp = &sc->sc_arpcom.ac_if; - bus_size_t memsize; pcireg_t memtype; int error; @@ -207,7 +206,7 @@ et_attach(struct device *parent, struct device *self, void *aux) memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, ET_PCIR_BAR); if (pci_mapreg_map(pa, ET_PCIR_BAR, memtype, 0, &sc->sc_mem_bt, - &sc->sc_mem_bh, NULL, &memsize, 0)) { + &sc->sc_mem_bh, NULL, &sc->sc_mem_size, 0)) { printf(": could not map mem space\n"); return; } @@ -310,7 +309,12 @@ et_detach(struct device *self, int flags) if_detach(ifp); et_dma_free(sc); - pci_intr_disestablish(sc->sc_pct, sc->sc_irq_handle); + if (sc->sc_irq_handle != NULL) { + pci_intr_disestablish(sc->sc_pct, sc->sc_irq_handle); + sc->sc_irq_handle = NULL; + } + + bus_space_unmap(sc->sc_mem_bt, sc->sc_mem_bh, sc->sc_mem_size); return 0; } diff --git a/sys/dev/pci/if_etreg.h b/sys/dev/pci/if_etreg.h index af396ff29cd..473cda10234 100644 --- a/sys/dev/pci/if_etreg.h +++ b/sys/dev/pci/if_etreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_etreg.h,v 1.2 2007/11/26 10:39:55 claudio Exp $ */ +/* $OpenBSD: if_etreg.h,v 1.3 2008/06/08 06:18:07 jsg Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -490,6 +490,7 @@ struct et_softc { struct resource *sc_mem_res; bus_space_tag_t sc_mem_bt; bus_space_handle_t sc_mem_bh; + bus_size_t sc_mem_size; bus_dma_tag_t sc_dmat; pci_chipset_tag_t sc_pct; pcitag_t sc_pcitag; |