summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2010-08-07 16:16:19 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2010-08-07 16:16:19 +0000
commit370e29c897a756c10a92e223bb26a5e2bcbf2fa3 (patch)
treed1cc0186a692da6b0300b7bfc69000397a791115 /sys/dev
parentba94c85bc6f4bc5def1ea7851c41cb407afd2fbc (diff)
Unmap registers upon detach. Avoid panics when detaching a partially attached
device. Found out the hard way by hotplugging an unsupported "Soft-Mac" device. ok deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/pgt.c3
-rw-r--r--sys/dev/pci/if_pgt_pci.c11
2 files changed, 10 insertions, 4 deletions
diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c
index 67740f4eefb..99c0a35f4c2 100644
--- a/sys/dev/ic/pgt.c
+++ b/sys/dev/ic/pgt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pgt.c,v 1.60 2010/08/07 03:50:01 krw Exp $ */
+/* $OpenBSD: pgt.c,v 1.61 2010/08/07 16:16:18 kettenis Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -603,6 +603,7 @@ pgt_attach(void *xsc)
tsleep(&sc->sc_flags, 0, "pgtres", hz);
if (sc->sc_flags & SC_UNINITIALIZED) {
printf("%s: not responding\n", sc->sc_dev.dv_xname);
+ sc->sc_flags |= SC_NEEDS_FIRMWARE;
return;
} else {
/* await all interrupts */
diff --git a/sys/dev/pci/if_pgt_pci.c b/sys/dev/pci/if_pgt_pci.c
index f6ceaa59f3b..7fb29bdc460 100644
--- a/sys/dev/pci/if_pgt_pci.c
+++ b/sys/dev/pci/if_pgt_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pgt_pci.c,v 1.11 2009/06/02 04:03:39 jsg Exp $ */
+/* $OpenBSD: if_pgt_pci.c,v 1.12 2010/08/07 16:16:18 kettenis Exp $ */
/*
* Copyright (c) 2006 Marcus Glocker <mglocker@openbsd.org>
@@ -147,8 +147,13 @@ pgt_pci_detach(struct device *self, int flags)
struct pgt_pci_softc *psc = (struct pgt_pci_softc *)self;
struct pgt_softc *sc = &psc->sc_pgt;
- pgt_detach(sc);
- pci_intr_disestablish(psc->sc_pc, psc->sc_ih);
+ if (psc->sc_ih != NULL) {
+ pgt_detach(sc);
+ pci_intr_disestablish(psc->sc_pc, psc->sc_ih);
+ }
+ if (psc->sc_mapsize > 0)
+ bus_space_unmap(sc->sc_iotag, sc->sc_iohandle,
+ psc->sc_mapsize);
return (0);
}