summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/bios.c5
-rw-r--r--sys/arch/amd64/amd64/mainbus.c5
-rw-r--r--sys/arch/amd64/pci/pcib.c5
-rw-r--r--sys/arch/arm/mainbus/mainbus.c5
-rw-r--r--sys/arch/arm/xscale/pxa2x0.c5
-rw-r--r--sys/arch/i386/pci/ichpcib.c8
-rw-r--r--sys/arch/i386/pci/pcib.c5
-rw-r--r--sys/arch/i386/pci/piixpcib.c6
-rw-r--r--sys/arch/loongson/dev/bonito.c5
-rw-r--r--sys/arch/loongson/dev/mainbus.c5
-rw-r--r--sys/arch/macppc/dev/esp.c34
-rw-r--r--sys/arch/macppc/dev/mesh.c40
-rw-r--r--sys/arch/macppc/dev/wdc_obio.c4
-rw-r--r--sys/arch/sgi/dev/gbe.c25
-rw-r--r--sys/arch/sparc/dev/fd.c25
-rw-r--r--sys/arch/sparc64/dev/fd.c24
-rw-r--r--sys/arch/sparc64/dev/lom.c20
-rw-r--r--sys/arch/sparc64/dev/sab.c32
-rw-r--r--sys/arch/zaurus/dev/zaurus_apm.c30
-rw-r--r--sys/arch/zaurus/zaurus/zaurus_lcd.c8
-rw-r--r--sys/dev/acpi/acpi.c5
-rw-r--r--sys/dev/cardbus/cardbus.c5
-rw-r--r--sys/dev/cardbus/cardslot.c5
-rw-r--r--sys/dev/flash.c9
-rw-r--r--sys/dev/flashvar.h3
-rw-r--r--sys/dev/i2o/iop.c41
-rw-r--r--sys/dev/i2o/iopvar.h3
-rw-r--r--sys/dev/ic/aac.c7
-rw-r--r--sys/dev/ic/aic79xx.c5
-rw-r--r--sys/dev/ic/aic79xx_openbsd.c5
-rw-r--r--sys/dev/ic/cac.c27
-rw-r--r--sys/dev/ic/cacvar.h3
-rw-r--r--sys/dev/ic/ciss.c9
-rw-r--r--sys/dev/ic/cissvar.h4
-rw-r--r--sys/dev/ic/dpt.c15
-rw-r--r--sys/dev/ic/dptvar.h3
-rw-r--r--sys/dev/isa/fd.c24
-rw-r--r--sys/dev/isa/isa.c5
-rw-r--r--sys/dev/pci/ahd_pci.c22
-rw-r--r--sys/dev/pci/amdpm.c19
-rw-r--r--sys/dev/pci/arc.c50
-rw-r--r--sys/dev/pci/azalia.c7
-rw-r--r--sys/dev/pci/cac_pci.c21
-rw-r--r--sys/dev/pci/ciss_pci.c22
-rw-r--r--sys/dev/pci/dpt_pci.c30
-rw-r--r--sys/dev/pci/iop_pci.c30
-rw-r--r--sys/dev/pci/puc.c4
-rw-r--r--sys/dev/pci/tcpcib.c12
-rw-r--r--sys/dev/pcmcia/cfxga.c7
-rw-r--r--sys/dev/usb/ehci.c4
-rw-r--r--sys/dev/usb/ohci.c25
-rw-r--r--sys/dev/usb/ohcivar.h4
-rw-r--r--sys/dev/usb/udl.c6
-rw-r--r--sys/dev/usb/uhci.c25
-rw-r--r--sys/dev/usb/uhcivar.h4
-rw-r--r--sys/dev/usb/umass.c5
-rw-r--r--sys/dev/usb/usb.c9
-rw-r--r--sys/dev/wscons/wsdisplay.c35
-rw-r--r--sys/kern/subr_autoconf.c11
59 files changed, 476 insertions, 350 deletions
diff --git a/sys/arch/amd64/amd64/bios.c b/sys/arch/amd64/amd64/bios.c
index a4cb791b6be..5b16838effa 100644
--- a/sys/arch/amd64/amd64/bios.c
+++ b/sys/arch/amd64/amd64/bios.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bios.c,v 1.24 2013/04/24 08:23:44 blambert Exp $ */
+/* $OpenBSD: bios.c,v 1.25 2013/05/30 16:15:01 deraadt Exp $ */
/*
* Copyright (c) 2006 Gordon Willem Klok <gklok@cogeco.ca>
*
@@ -55,8 +55,7 @@ int bios_print(void *, const char *);
char *fixstring(char *);
struct cfattach bios_ca = {
- sizeof(struct bios_softc), bios_match, bios_attach, NULL,
- config_activate_children
+ sizeof(struct bios_softc), bios_match, bios_attach
};
struct cfdriver bios_cd = {
diff --git a/sys/arch/amd64/amd64/mainbus.c b/sys/arch/amd64/amd64/mainbus.c
index 19e58621307..2742ca00bc2 100644
--- a/sys/arch/amd64/amd64/mainbus.c
+++ b/sys/arch/amd64/amd64/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.26 2012/10/04 08:32:20 ehrhardt Exp $ */
+/* $OpenBSD: mainbus.c,v 1.27 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: mainbus.c,v 1.1 2003/04/26 18:39:29 fvdl Exp $ */
/*
@@ -72,8 +72,7 @@ int mainbus_match(struct device *, void *, void *);
void mainbus_attach(struct device *, struct device *, void *);
struct cfattach mainbus_ca = {
- sizeof(struct device), mainbus_match, mainbus_attach, NULL,
- config_activate_children
+ sizeof(struct device), mainbus_match, mainbus_attach
};
struct cfdriver mainbus_cd = {
diff --git a/sys/arch/amd64/pci/pcib.c b/sys/arch/amd64/pci/pcib.c
index 86cbe212d06..556ba549c71 100644
--- a/sys/arch/amd64/pci/pcib.c
+++ b/sys/arch/amd64/pci/pcib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcib.c,v 1.5 2010/07/08 20:17:54 deraadt Exp $ */
+/* $OpenBSD: pcib.c,v 1.6 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: pcib.c,v 1.6 1997/06/06 23:29:16 thorpej Exp $ */
/*-
@@ -50,8 +50,7 @@ void pcib_callback(struct device *);
int pcib_print(void *, const char *);
struct cfattach pcib_ca = {
- sizeof(struct device), pcibmatch, pcibattach,
- NULL, config_activate_children
+ sizeof(struct device), pcibmatch, pcibattach
};
struct cfdriver pcib_cd = {
diff --git a/sys/arch/arm/mainbus/mainbus.c b/sys/arch/arm/mainbus/mainbus.c
index d50219f78b1..6ad3e8ff755 100644
--- a/sys/arch/arm/mainbus/mainbus.c
+++ b/sys/arch/arm/mainbus/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.6 2011/09/22 17:45:59 miod Exp $ */
+/* $OpenBSD: mainbus.c,v 1.7 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: mainbus.c,v 1.3 2001/06/13 17:52:43 nathanw Exp $ */
/*
@@ -59,8 +59,7 @@ int mainbussearch(struct device *, void *, void *);
/* attach and device structures for the device */
struct cfattach mainbus_ca = {
- sizeof(struct device), mainbusmatch, mainbusattach, NULL,
- config_activate_children
+ sizeof(struct device), mainbusmatch, mainbusattach
};
struct cfdriver mainbus_cd = {
diff --git a/sys/arch/arm/xscale/pxa2x0.c b/sys/arch/arm/xscale/pxa2x0.c
index ce543461ba2..9b9528c66c2 100644
--- a/sys/arch/arm/xscale/pxa2x0.c
+++ b/sys/arch/arm/xscale/pxa2x0.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0.c,v 1.16 2010/08/30 21:35:55 deraadt Exp $ */
+/* $OpenBSD: pxa2x0.c,v 1.17 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: pxa2x0.c,v 1.5 2003/12/12 16:42:44 thorpej Exp $ */
/*
@@ -129,8 +129,7 @@ CFATTACH_DECL(pxaip, sizeof(struct pxaip_softc),
pxaip_match, pxaip_attach, NULL, NULL);
#else
struct cfattach pxaip_ca = {
- sizeof(struct pxaip_softc), pxaip_match, pxaip_attach, NULL,
- config_activate_children
+ sizeof(struct pxaip_softc), pxaip_match, pxaip_attach
};
struct cfdriver pxaip_cd = {
diff --git a/sys/arch/i386/pci/ichpcib.c b/sys/arch/i386/pci/ichpcib.c
index c35e2259130..eb1afd62779 100644
--- a/sys/arch/i386/pci/ichpcib.c
+++ b/sys/arch/i386/pci/ichpcib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ichpcib.c,v 1.26 2012/08/16 18:42:04 tedu Exp $ */
+/* $OpenBSD: ichpcib.c,v 1.27 2013/05/30 16:15:01 deraadt Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
*
@@ -68,11 +68,7 @@ struct timecounter ichpcib_timecounter = {
};
struct cfattach ichpcib_ca = {
- sizeof(struct ichpcib_softc),
- ichpcib_match,
- ichpcib_attach,
- NULL,
- config_activate_children
+ sizeof(struct ichpcib_softc), ichpcib_match, ichpcib_attach
};
struct cfdriver ichpcib_cd = {
diff --git a/sys/arch/i386/pci/pcib.c b/sys/arch/i386/pci/pcib.c
index 75bffbe51e4..aa620748d31 100644
--- a/sys/arch/i386/pci/pcib.c
+++ b/sys/arch/i386/pci/pcib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcib.c,v 1.23 2010/07/08 20:17:54 deraadt Exp $ */
+/* $OpenBSD: pcib.c,v 1.24 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: pcib.c,v 1.6 1997/06/06 23:29:16 thorpej Exp $ */
/*-
@@ -54,8 +54,7 @@ void pcib_callback(struct device *);
int pcib_print(void *, const char *);
struct cfattach pcib_ca = {
- sizeof(struct device), pcibmatch, pcibattach, NULL,
- config_activate_children
+ sizeof(struct device), pcibmatch, pcibattach
};
struct cfdriver pcib_cd = {
diff --git a/sys/arch/i386/pci/piixpcib.c b/sys/arch/i386/pci/piixpcib.c
index cc0370ea5e1..b94d5fc6f0d 100644
--- a/sys/arch/i386/pci/piixpcib.c
+++ b/sys/arch/i386/pci/piixpcib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: piixpcib.c,v 1.7 2010/07/08 20:17:54 deraadt Exp $ */
+/* $OpenBSD: piixpcib.c,v 1.8 2013/05/30 16:15:01 deraadt Exp $ */
/*
* Copyright (c) 2007 Stefan Sperling <stsp@stsp.in-berlin.de>
@@ -117,9 +117,7 @@ extern void p3_update_cpuspeed(void);
struct cfattach piixpcib_ca = {
sizeof(struct piixpcib_softc),
piixpcib_match,
- piixpcib_attach,
- NULL,
- config_activate_children
+ piixpcib_attach
};
struct cfdriver piixpcib_cd = {
diff --git a/sys/arch/loongson/dev/bonito.c b/sys/arch/loongson/dev/bonito.c
index c6eee9e18b6..e1892465428 100644
--- a/sys/arch/loongson/dev/bonito.c
+++ b/sys/arch/loongson/dev/bonito.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bonito.c,v 1.22 2012/10/03 11:18:20 miod Exp $ */
+/* $OpenBSD: bonito.c,v 1.23 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: bonito_mainbus.c,v 1.11 2008/04/28 20:23:10 martin Exp $ */
/* $NetBSD: bonito_pci.c,v 1.5 2008/04/28 20:23:28 martin Exp $ */
@@ -82,8 +82,7 @@ int bonito_match(struct device *, void *, void *);
void bonito_attach(struct device *, struct device *, void *);
const struct cfattach bonito_ca = {
- sizeof(struct bonito_softc), bonito_match, bonito_attach,
- NULL, config_activate_children
+ sizeof(struct bonito_softc), bonito_match, bonito_attach
};
struct cfdriver bonito_cd = {
diff --git a/sys/arch/loongson/dev/mainbus.c b/sys/arch/loongson/dev/mainbus.c
index b423aef7051..ee8c6b6eff3 100644
--- a/sys/arch/loongson/dev/mainbus.c
+++ b/sys/arch/loongson/dev/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.7 2013/01/14 21:18:47 pirofti Exp $ */
+/* $OpenBSD: mainbus.c,v 1.8 2013/05/30 16:15:01 deraadt Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -37,8 +37,7 @@ void mainbus_attach(struct device *, struct device *, void *);
int mainbus_print(void *, const char *);
const struct cfattach mainbus_ca = {
- sizeof(struct device), mainbus_match, mainbus_attach,
- NULL, config_activate_children
+ sizeof(struct device), mainbus_match, mainbus_attach
};
struct cfdriver mainbus_cd = {
diff --git a/sys/arch/macppc/dev/esp.c b/sys/arch/macppc/dev/esp.c
index 7ce1699c3b2..1b9acd707d7 100644
--- a/sys/arch/macppc/dev/esp.c
+++ b/sys/arch/macppc/dev/esp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: esp.c,v 1.8 2012/12/05 23:20:13 deraadt Exp $ */
+/* $OpenBSD: esp.c,v 1.9 2013/05/30 16:15:01 deraadt Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -129,7 +129,8 @@ int espmatch(struct device *, void *, void *);
/* Linkup to the rest of the kernel */
struct cfattach esp_ca = {
- sizeof(struct esp_softc), espmatch, espattach
+ sizeof(struct esp_softc), espmatch, espattach,
+ NULL, espactivate
};
struct scsi_adapter esp_switch = {
@@ -165,7 +166,6 @@ struct ncr53c9x_glue esp_glue = {
};
static int espdmaintr(struct esp_softc *);
-static void esp_shutdownhook(void *);
int
espmatch(struct device *parent, void *cf, void *aux)
@@ -258,9 +258,6 @@ espattach(struct device *parent, struct device *self, void *aux)
mac_intr_establish(parent, esc->sc_intr, IST_LEVEL, IPL_BIO,
ncr53c9x_intr, sc, sc->sc_dev.dv_xname);
- /* Reset SCSI bus when halt. */
- shutdownhook_establish(esp_shutdownhook, sc);
-
/* Turn on target selection using the `DMA' method */
sc->sc_features |= NCR_F_DMASELECT;
@@ -268,6 +265,23 @@ espattach(struct device *parent, struct device *self, void *aux)
}
+int
+esp_activate(struct device *self, int act)
+{
+ struct ncr53c9x_softc *sc = self;
+ int ret = 0;
+
+ ret = config_activate_children(self, act);
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ NCRCMD(sc, NCRCMD_RSTSCSI);
+ break;
+ }
+
+ return (ret);
+}
+
/*
* Glue functions.
*/
@@ -452,11 +466,3 @@ espdmaintr(struct esp_softc *sc)
return 0;
}
-
-void
-esp_shutdownhook(void *arg)
-{
- struct ncr53c9x_softc *sc = arg;
-
- NCRCMD(sc, NCRCMD_RSTSCSI);
-}
diff --git a/sys/arch/macppc/dev/mesh.c b/sys/arch/macppc/dev/mesh.c
index f512c68367c..61975fd2ee3 100644
--- a/sys/arch/macppc/dev/mesh.c
+++ b/sys/arch/macppc/dev/mesh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mesh.c,v 1.29 2011/04/03 12:42:36 krw Exp $ */
+/* $OpenBSD: mesh.c,v 1.30 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: mesh.c,v 1.1 1999/02/19 13:06:03 tsubai Exp $ */
/*-
@@ -220,7 +220,8 @@ static inline void mesh_set_reg(struct mesh_softc *, int, int);
int mesh_match(struct device *, void *, void *);
void mesh_attach(struct device *, struct device *, void *);
-void mesh_shutdownhook(void *);
+int mesh_activate(struct device *, int);
+
int mesh_intr(void *);
void mesh_error(struct mesh_softc *, struct mesh_scb *, int, int);
void mesh_select(struct mesh_softc *, struct mesh_scb *);
@@ -246,7 +247,8 @@ void mesh_timeout(void *);
void mesh_minphys(struct buf *, struct scsi_link *);
struct cfattach mesh_ca = {
- sizeof(struct mesh_softc), mesh_match, mesh_attach
+ sizeof(struct mesh_softc), mesh_match, mesh_attach,
+ NULL, mesh_activate
};
struct cfdriver mesh_cd = {
@@ -366,9 +368,6 @@ mesh_attach(struct device *parent, struct device *self, void *aux)
mac_intr_establish(parent, sc->sc_irq, IST_LEVEL, IPL_BIO, mesh_intr,
sc, sc->sc_dev.dv_xname);
- /* Reset SCSI bus when halt. */
- shutdownhook_establish(mesh_shutdownhook, sc);
-
return;
nodbdma:
bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmamap);
@@ -378,6 +377,25 @@ noreg:
unmapiodev(sc->sc_reg, reg[1]);
}
+int
+mesh_activate(struct device *self, int act)
+{
+ struct mesh_softc *sc = (struct mesh_softc *)self;
+ int ret = 0;
+
+ reg = config_activate_children(self, act);
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ /* Set to async mode. */
+ mesh_set_reg(sc, MESH_SYNC_PARAM, 2);
+ mesh_bus_reset(sc);
+ break;
+ }
+
+ return (ret);
+}
+
#define MESH_SET_XFER(sc, count) do { \
mesh_set_reg(sc, MESH_XFER_COUNT0, count); \
mesh_set_reg(sc, MESH_XFER_COUNT1, count >> 8); \
@@ -398,16 +416,6 @@ mesh_set_reg(struct mesh_softc *sc, int reg, int val)
out8(sc->sc_reg + reg, val);
}
-void
-mesh_shutdownhook(void *arg)
-{
- struct mesh_softc *sc = arg;
-
- /* Set to async mode. */
- mesh_set_reg(sc, MESH_SYNC_PARAM, 2);
- mesh_bus_reset(sc);
-}
-
#ifdef MESH_DEBUG
static char scsi_phase[][8] = {
"DATAOUT",
diff --git a/sys/arch/macppc/dev/wdc_obio.c b/sys/arch/macppc/dev/wdc_obio.c
index f289f35fbe6..f95e17344c0 100644
--- a/sys/arch/macppc/dev/wdc_obio.c
+++ b/sys/arch/macppc/dev/wdc_obio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdc_obio.c,v 1.29 2011/05/09 22:33:53 matthew Exp $ */
+/* $OpenBSD: wdc_obio.c,v 1.30 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: wdc_obio.c,v 1.15 2001/07/25 20:26:33 bouyer Exp $ */
/*-
@@ -92,7 +92,7 @@ int wdc_obio_detach(struct device *, int);
struct cfattach wdc_obio_ca = {
sizeof(struct wdc_obio_softc), wdc_obio_probe, wdc_obio_attach,
- wdc_obio_detach, config_activate_children
+ wdc_obio_detach
};
int wdc_obio_dma_init(void *, int, int, void *, size_t, int);
diff --git a/sys/arch/sgi/dev/gbe.c b/sys/arch/sgi/dev/gbe.c
index 8efeeba9fd3..fec3fc5ed20 100644
--- a/sys/arch/sgi/dev/gbe.c
+++ b/sys/arch/sgi/dev/gbe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gbe.c,v 1.18 2013/05/27 19:37:45 miod Exp $ */
+/* $OpenBSD: gbe.c,v 1.19 2013/05/30 16:15:01 deraadt Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Joel Sing <jsing@openbsd.org>
@@ -173,9 +173,11 @@ struct wsscreen_list gbe_screenlist = {
int gbe_match(struct device *, void *, void *);
void gbe_attach(struct device *, struct device *, void *);
+int gbe_activate(struct device *, int);
struct cfattach gbe_ca = {
- sizeof (struct gbe_softc), gbe_match, gbe_attach
+ sizeof (struct gbe_softc), gbe_match, gbe_attach,
+ NULL, gbe_activate
};
struct cfdriver gbe_cd = {
@@ -238,8 +240,6 @@ gbe_attach(struct device *parent, struct device *self, void *aux)
gbe_consdata.fb_size >> 20, gbe_consdata.width,
gbe_consdata.height, gbe_consdata.depth);
- shutdownhook_establish((void(*)(void *))gbe_disable, self);
-
waa.console = gsc->console;
waa.scrdata = &gbe_screenlist;
waa.accessops = &gbe_accessops;
@@ -381,8 +381,6 @@ gbe_attach(struct device *parent, struct device *self, void *aux)
screen->fb_phys = fb_dmamap->dm_segs[0].ds_addr;
screen->ro_phys = ro_dmamap->dm_segs[0].ds_addr;
- shutdownhook_establish((void(*)(void *))gbe_disable, self);
-
gbe_init_screen(screen);
gbe_disable(gsc);
gbe_setup(gsc);
@@ -447,6 +445,21 @@ fail0:
bus_space_unmap(gsc->iot, gsc->ioh, GBE_REG_SIZE);
}
+int
+gbe_activate(struct device *self, int act)
+{
+ struct gbe_softc *gsc = (struct gbe_softc *)self;
+ int ret = 0;
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ gbe_disable(gsc);
+ break;
+ }
+
+ return (ret);
+}
+
/*
* GBE hardware specific functions.
*/
diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c
index d9e4d7b70e9..717631268a7 100644
--- a/sys/arch/sparc/dev/fd.c
+++ b/sys/arch/sparc/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.82 2013/01/01 01:00:14 miod Exp $ */
+/* $OpenBSD: fd.c,v 1.83 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: fd.c,v 1.51 1997/05/24 20:16:19 pk Exp $ */
/*-
@@ -215,8 +215,6 @@ struct fd_softc {
int sc_cylin; /* where we think the head is */
int sc_opts; /* user-set options */
- void *sc_sdhook; /* shutdownhook cookie */
-
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
struct buf sc_q; /* head of buf chain */
@@ -228,9 +226,11 @@ struct fd_softc {
/* floppy driver configuration */
int fdmatch(struct device *, void *, void *);
void fdattach(struct device *, struct device *, void *);
+int fdactivate(struct device *, int);
struct cfattach fd_ca = {
- sizeof(struct fd_softc), fdmatch, fdattach
+ sizeof(struct fd_softc), fdmatch, fdattach,
+ NULL, fdactivate
};
struct cfdriver fd_cd = {
@@ -649,9 +649,22 @@ fdattach(parent, self, aux)
*/
if (fa->fa_bootpath)
fa->fa_bootpath->dev = &fd->sc_dv;
+}
+
+int
+fdactivate(struct device *self, int act)
+{
+ struct fd_softc *sc = (struct fd_softc *)self;
+ int ret = 0;
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ /* Make sure the drive motor gets turned off at shutdown time. */
+ fd_motor_off(sc);
+ break;
+ }
- /* Make sure the drive motor gets turned off at shutdown time. */
- fd->sc_sdhook = shutdownhook_establish(fd_motor_off, fd);
+ return (ret);
}
__inline struct fd_type *
diff --git a/sys/arch/sparc64/dev/fd.c b/sys/arch/sparc64/dev/fd.c
index 529cbb64ed7..d35aaa680cc 100644
--- a/sys/arch/sparc64/dev/fd.c
+++ b/sys/arch/sparc64/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.37 2013/01/01 01:00:14 miod Exp $ */
+/* $OpenBSD: fd.c,v 1.38 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: fd.c,v 1.112 2003/08/07 16:29:35 agc Exp $ */
/*-
@@ -265,8 +265,6 @@ struct fd_softc {
int sc_cylin; /* where we think the head is */
int sc_opts; /* user-set options */
- void *sc_sdhook; /* shutdownhook cookie */
-
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
struct buf sc_q; /* pending I/O requests */
@@ -275,9 +273,11 @@ struct fd_softc {
/* floppy driver configuration */
int fdmatch(struct device *, void *, void *);
void fdattach(struct device *, struct device *, void *);
+int fdactivate(struct device *, int);
struct cfattach fd_ca = {
- sizeof(struct fd_softc), fdmatch, fdattach
+ sizeof(struct fd_softc), fdmatch, fdattach,
+ NULL, fdactivate
};
struct cfdriver fd_cd = {
@@ -670,9 +670,21 @@ fdattach(parent, self, aux)
fd->sc_dk.dk_flags = DKF_NOLABELREAD;
fd->sc_dk.dk_name = fd->sc_dv.dv_xname;
disk_attach(&fd->sc_dv, &fd->sc_dk);
+}
+
+int
+fdactivate(struct device *self, int act)
+{
+ int ret = 0;
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ /* Make sure the drive motor gets turned off at shutdown time. */
+ fd_motor_off(self);
+ break;
+ }
- /* Make sure the drive motor gets turned off at shutdown time. */
- fd->sc_sdhook = shutdownhook_establish(fd_motor_off, fd);
+ return (ret);
}
__inline struct fd_type *
diff --git a/sys/arch/sparc64/dev/lom.c b/sys/arch/sparc64/dev/lom.c
index a4ce57ba5e8..883b90df077 100644
--- a/sys/arch/sparc64/dev/lom.c
+++ b/sys/arch/sparc64/dev/lom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lom.c,v 1.23 2012/10/17 22:32:01 deraadt Exp $ */
+/* $OpenBSD: lom.c,v 1.24 2013/05/30 16:15:01 deraadt Exp $ */
/*
* Copyright (c) 2009 Mark Kettenis
*
@@ -179,9 +179,11 @@ struct lom_softc {
int lom_match(struct device *, void *, void *);
void lom_attach(struct device *, struct device *, void *);
+int lom_activate(struct device *, int);
struct cfattach lom_ca = {
- sizeof(struct lom_softc), lom_match, lom_attach
+ sizeof(struct lom_softc), lom_match, lom_attach,
+ NULL, lom_activate
};
struct cfdriver lom_cd = {
@@ -357,8 +359,20 @@ lom_attach(struct device *parent, struct device *self, void *aux)
printf(": %s rev %d.%d\n",
sc->sc_type < LOM_LOMLITE2 ? "LOMlite" : "LOMlite2",
fw_rev >> 4, fw_rev & 0x0f);
+}
+
+int
+lom_activate(struct device *self, int act)
+{
+ int ret = 0;
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ lom_shutdown(self);
+ break;
+ }
- shutdownhook_establish(lom_shutdown, sc);
+ return (ret);
}
int
diff --git a/sys/arch/sparc64/dev/sab.c b/sys/arch/sparc64/dev/sab.c
index abbcbd8b334..000003495ec 100644
--- a/sys/arch/sparc64/dev/sab.c
+++ b/sys/arch/sparc64/dev/sab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sab.c,v 1.30 2010/07/02 17:27:01 nicm Exp $ */
+/* $OpenBSD: sab.c,v 1.31 2013/05/30 16:15:01 deraadt Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -121,6 +121,7 @@ struct sabtty_softc *sabtty_cons_output;
int sab_match(struct device *, void *, void *);
void sab_attach(struct device *, struct device *, void *);
+
int sab_print(void *, const char *);
int sab_intr(void *);
void sab_softintr(void *);
@@ -130,6 +131,8 @@ void sab_cnpollc(dev_t, int);
int sabtty_match(struct device *, void *, void *);
void sabtty_attach(struct device *, struct device *, void *);
+int sabtty_activate(struct device *, int);
+
void sabtty_start(struct tty *);
int sabtty_param(struct tty *, struct termios *);
int sabtty_intr(struct sabtty_softc *, int *);
@@ -143,7 +146,7 @@ int sabtty_speed(int);
void sabtty_console_flags(struct sabtty_softc *);
void sabtty_console_speed(struct sabtty_softc *);
void sabtty_cnpollc(struct sabtty_softc *, int);
-void sabtty_shutdown(void *);
+void sabtty_shutdown(struct sabtty_softc *);
int sabttyparam(struct sabtty_softc *, struct tty *, struct termios *);
int sabttyopen(dev_t, int, int, struct proc *);
@@ -166,7 +169,8 @@ struct cfdriver sab_cd = {
};
struct cfattach sabtty_ca = {
- sizeof(struct sabtty_softc), sabtty_match, sabtty_attach
+ sizeof(struct sabtty_softc), sabtty_match, sabtty_attach,
+ NULL, sabtty_activate
};
struct cfdriver sabtty_cd = {
@@ -305,6 +309,22 @@ sab_attach(parent, self, aux)
}
int
+sabtty_activate(struct device *self, int act)
+{
+ struct sabtty_softc *sc = (struct sabtty_softc *)self;
+ int ret = 0;
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ if (sc->sc_flags & SABTTYF_CONS_IN)
+ sabtty_shutdown(sc);
+ break;
+ }
+
+ return (ret);
+}
+
+int
sab_print(args, name)
void *args;
const char *name;
@@ -444,7 +464,6 @@ sabtty_attach(parent, self, aux)
cn_tab->cn_pollc = sab_cnpollc;
cn_tab->cn_getc = sab_cngetc;
cn_tab->cn_dev = makedev(77/*XXX*/, self->dv_unit);
- shutdownhook_establish(sabtty_shutdown, sc);
}
if (sc->sc_flags & SABTTYF_CONS_OUT) {
@@ -1389,11 +1408,8 @@ sabtty_abort(sc)
}
void
-sabtty_shutdown(vsc)
- void *vsc;
+sabtty_shutdown(struct sabtty_softc *sc)
{
- struct sabtty_softc *sc = vsc;
-
/* Have to put the chip back into single char mode */
sc->sc_flags |= SABTTYF_DONTDDB;
SAB_WRITE(sc, SAB_RFC, SAB_READ(sc, SAB_RFC) & ~SAB_RFC_RFDF);
diff --git a/sys/arch/zaurus/dev/zaurus_apm.c b/sys/arch/zaurus/dev/zaurus_apm.c
index 431aa28a1b2..8a694a55cc5 100644
--- a/sys/arch/zaurus/dev/zaurus_apm.c
+++ b/sys/arch/zaurus/dev/zaurus_apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zaurus_apm.c,v 1.22 2012/10/17 22:49:27 deraadt Exp $ */
+/* $OpenBSD: zaurus_apm.c,v 1.23 2013/05/30 16:15:01 deraadt Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
@@ -62,9 +62,11 @@ struct zapm_softc {
int apm_match(struct device *, void *, void *);
void apm_attach(struct device *, struct device *, void *);
+int apm_activate(struct device *, int);
struct cfattach apm_pxaip_ca = {
- sizeof (struct zapm_softc), apm_match, apm_attach
+ sizeof (struct zapm_softc), apm_match, apm_attach,
+ NULL, apm_activate
};
extern struct cfdriver apm_cd;
@@ -131,9 +133,6 @@ const struct timeval zapm_battchkrate = { 60, 0 };
/* Prototypes */
-#if 0
-void zapm_shutdown(void *);
-#endif
int zapm_acintr(void *);
int zapm_bcintr(void *);
int zapm_ac_on(void);
@@ -198,23 +197,24 @@ apm_attach(struct device *parent, struct device *self, void *aux)
pxa2x0_apm_attach_sub(&sc->sc);
-#if 0
- (void)shutdownhook_establish(zapm_shutdown, NULL);
-#endif
-
cpu_setperf = pxa2x0_setperf;
cpu_cpuspeed = pxa2x0_cpuspeed;
}
-#if 0
-void
-zapm_shutdown(void *v)
+int
+apm_activate(struct device *self, int act)
{
- struct zapm_softc *sc = v;
+ struct zapm_softc *sc = (struct zapm_softc *)self;
+ int ret = 0;
- zapm_enable_charging(sc, 0);
+ switch (act) {
+ case DVACT_POWERDOWN:
+ zapm_enable_charging(sc, 0);
+ break;
+ }
+
+ return (ret);
}
-#endif
int
zapm_acintr(void *v)
diff --git a/sys/arch/zaurus/zaurus/zaurus_lcd.c b/sys/arch/zaurus/zaurus/zaurus_lcd.c
index e9f3d9694f9..89fb852c5cc 100644
--- a/sys/arch/zaurus/zaurus/zaurus_lcd.c
+++ b/sys/arch/zaurus/zaurus/zaurus_lcd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zaurus_lcd.c,v 1.24 2010/09/07 16:21:41 deraadt Exp $ */
+/* $OpenBSD: zaurus_lcd.c,v 1.25 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: lubbock_lcd.c,v 1.1 2003/08/09 19:38:53 bsh Exp $ */
/*
@@ -399,6 +399,7 @@ int
lcd_activate(struct device *self, int act)
{
struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *)self;
+ int ret = 0;
switch (act) {
case DVACT_SUSPEND:
@@ -409,6 +410,9 @@ lcd_activate(struct device *self, int act)
pxa2x0_lcd_resume(sc);
lcd_set_brightness(lcd_get_brightness());
break;
+ case DVACT_POWERDOWN:
+ ret = config_activate_children(self, act);
+ break;
}
- return 0;
+ return (ret);
}
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 603122a5f7e..8a43fb85352 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.243 2013/04/18 18:30:41 deraadt Exp $ */
+/* $OpenBSD: acpi.c,v 1.244 2013/05/30 16:15:01 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -154,8 +154,7 @@ void acpi_disable_allgpes(struct acpi_softc *);
extern struct aml_node aml_root;
struct cfattach acpi_ca = {
- sizeof(struct acpi_softc), acpi_match, acpi_attach, NULL,
- config_activate_children
+ sizeof(struct acpi_softc), acpi_match, acpi_attach
};
struct cfdriver acpi_cd = {
diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c
index 6786f0fb293..4e8d4d814e8 100644
--- a/sys/dev/cardbus/cardbus.c
+++ b/sys/dev/cardbus/cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cardbus.c,v 1.45 2010/08/25 21:37:59 kettenis Exp $ */
+/* $OpenBSD: cardbus.c,v 1.46 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: cardbus.c,v 1.24 2000/04/02 19:11:37 mycroft Exp $ */
/*
@@ -83,8 +83,7 @@ STATIC void disable_function(struct cardbus_softc *, int);
struct cfattach cardbus_ca = {
- sizeof(struct cardbus_softc), cardbusmatch, cardbusattach,
- NULL, config_activate_children
+ sizeof(struct cardbus_softc), cardbusmatch, cardbusattach
};
struct cfdriver cardbus_cd = {
diff --git a/sys/dev/cardbus/cardslot.c b/sys/dev/cardbus/cardslot.c
index 0061e48ec32..d4fb6b41f85 100644
--- a/sys/dev/cardbus/cardslot.c
+++ b/sys/dev/cardbus/cardslot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cardslot.c,v 1.14 2010/08/25 21:37:59 kettenis Exp $ */
+/* $OpenBSD: cardslot.c,v 1.15 2013/05/30 16:15:01 deraadt Exp $ */
/* $NetBSD: cardslot.c,v 1.9 2000/03/22 09:35:06 haya Exp $ */
/*
@@ -68,8 +68,7 @@ STATIC int cardslot_16_print(void *, const char *);
STATIC int cardslot_16_submatch(struct device *, void *,void *);
struct cfattach cardslot_ca = {
- sizeof(struct cardslot_softc), cardslotmatch, cardslotattach,
- NULL, config_activate_children
+ sizeof(struct cardslot_softc), cardslotmatch, cardslotattach
};
struct cfdriver cardslot_cd = {
diff --git a/sys/dev/flash.c b/sys/dev/flash.c
index 8f5dd8dd48f..5cc8c817417 100644
--- a/sys/dev/flash.c
+++ b/sys/dev/flash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: flash.c,v 1.24 2011/07/06 04:49:36 matthew Exp $ */
+/* $OpenBSD: flash.c,v 1.25 2013/05/30 16:15:01 deraadt Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org>
@@ -172,13 +172,6 @@ flashdetach(struct device *self, int flags)
return 0;
}
-int
-flashactivate(struct device *self, int act)
-{
- /* XXX anything to be done here? */
- return 0;
-}
-
/*
* Flash controller and chip functions
*/
diff --git a/sys/dev/flashvar.h b/sys/dev/flashvar.h
index 1985a6b01ef..0541cbefb03 100644
--- a/sys/dev/flashvar.h
+++ b/sys/dev/flashvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: flashvar.h,v 1.5 2009/10/13 19:33:16 pirofti Exp $ */
+/* $OpenBSD: flashvar.h,v 1.6 2013/05/30 16:15:01 deraadt Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org>
@@ -116,7 +116,6 @@ struct flash_softc {
void flashattach(struct flash_softc *, struct flash_ctl_tag *, void *);
int flashdetach(struct device *, int);
-int flashactivate(struct device *, int);
u_int8_t flash_reg8_read(struct flash_softc *, int);
void flash_reg8_read_page(struct flash_softc *, caddr_t, caddr_t);
diff --git a/sys/dev/i2o/iop.c b/sys/dev/i2o/iop.c
index 91f8da3d670..1b00a6720a7 100644
--- a/sys/dev/i2o/iop.c
+++ b/sys/dev/i2o/iop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iop.c,v 1.37 2010/01/13 00:31:04 chl Exp $ */
+/* $OpenBSD: iop.c,v 1.38 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: iop.c,v 1.12 2001/03/21 14:27:05 ad Exp $ */
/*-
@@ -204,7 +204,6 @@ void iop_configure_devices(struct iop_softc *, int, int);
void iop_devinfo(int, char *, size_t);
int iop_print(void *, const char *);
int iop_reconfigure(struct iop_softc *, u_int);
-void iop_shutdown(void *);
int iop_submatch(struct device *, void *, void *);
#ifdef notyet
int iop_vendor_print(void *, const char *);
@@ -376,10 +375,6 @@ iop_init(struct iop_softc *sc, const char *intrstr)
goto bail_out;
}
- /* Configure shutdown hook before we start any device activity. */
- if (iop_sdh == NULL)
- iop_sdh = shutdownhook_establish(iop_shutdown, NULL);
-
/* Ensure interrupts are enabled at the IOP. */
mask = iop_inl(sc, IOP_REG_INTR_MASK);
iop_outl(sc, IOP_REG_INTR_MASK, mask & ~IOP_INTR_OFIFO);
@@ -858,35 +853,27 @@ iop_submatch(struct device *parent, void *vcf, void *aux)
* Shut down all configured IOPs.
*/
void
-iop_shutdown(void *junk)
+iop_shutdown(void *v)
{
- struct iop_softc *sc;
- int i;
+ struct iop_softc *sc = v;
- printf("shutting down iop devices...");
-
- for (i = 0; i < iop_cd.cd_ndevs; i++) {
- if (!(sc = (struct iop_softc *)device_lookup(&iop_cd, i)))
- continue;
- if ((sc->sc_flags & IOP_ONLINE) == 0)
- continue;
+ if ((sc->sc_flags & IOP_ONLINE) == 0)
+ return;
- iop_simple_cmd(sc, I2O_TID_IOP, I2O_EXEC_SYS_QUIESCE, IOP_ICTX,
- 0, 5000);
+ iop_simple_cmd(sc, I2O_TID_IOP, I2O_EXEC_SYS_QUIESCE, IOP_ICTX,
+ 0, 5000);
- if (letoh16(sc->sc_status.orgid) != I2O_ORG_AMI) {
- /*
- * Some AMI firmware revisions will go to sleep and
- * never come back after this.
- */
- iop_simple_cmd(sc, I2O_TID_IOP, I2O_EXEC_IOP_CLEAR,
- IOP_ICTX, 0, 1000);
- }
+ if (letoh16(sc->sc_status.orgid) != I2O_ORG_AMI) {
+ /*
+ * Some AMI firmware revisions will go to sleep and
+ * never come back after this.
+ */
+ iop_simple_cmd(sc, I2O_TID_IOP, I2O_EXEC_IOP_CLEAR,
+ IOP_ICTX, 0, 1000);
}
/* Wait. Some boards could still be flushing, stupidly enough. */
delay(5000*1000);
- printf(" done.\n");
}
/*
diff --git a/sys/dev/i2o/iopvar.h b/sys/dev/i2o/iopvar.h
index 60a19493101..13ebdc51320 100644
--- a/sys/dev/i2o/iopvar.h
+++ b/sys/dev/i2o/iopvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iopvar.h,v 1.10 2009/04/02 18:44:49 oga Exp $ */
+/* $OpenBSD: iopvar.h,v 1.11 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: iopvar.h,v 1.5 2001/03/20 13:01:49 ad Exp $ */
/*-
@@ -167,6 +167,7 @@ int iop_param_op(struct iop_softc *, int, struct iop_initiator *, int,
int iop_print_ident(struct iop_softc *, int);
int iop_simple_cmd(struct iop_softc *, int, int, int, int, int);
void iop_strvis(struct iop_softc *, const char *, int, char *, int);
+void iop_shutdown(void *);
void iop_initiator_register(struct iop_softc *, struct iop_initiator *);
void iop_initiator_unregister(struct iop_softc *, struct iop_initiator *);
diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c
index 61d936b7bca..bf1938d1b4f 100644
--- a/sys/dev/ic/aac.c
+++ b/sys/dev/ic/aac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aac.c,v 1.54 2011/07/17 22:46:48 matthew Exp $ */
+/* $OpenBSD: aac.c,v 1.55 2013/05/30 16:15:02 deraadt Exp $ */
/*-
* Copyright (c) 2000 Michael Smith
@@ -276,11 +276,6 @@ aac_attach(struct aac_softc *sc)
sc->aifflags = 0;
kthread_create_deferred(aac_create_thread, sc);
-#if 0
- /* Register the shutdown method to only be called post-dump */
- sc->aac_sdh = shutdownhook_establish(aac_shutdown, (void *)sc);
-#endif
-
return (0);
}
diff --git a/sys/dev/ic/aic79xx.c b/sys/dev/ic/aic79xx.c
index 6fed99b0324..0e954fc502e 100644
--- a/sys/dev/ic/aic79xx.c
+++ b/sys/dev/ic/aic79xx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic79xx.c,v 1.50 2012/12/05 23:20:16 deraadt Exp $ */
+/* $OpenBSD: aic79xx.c,v 1.51 2013/05/30 16:15:02 deraadt Exp $ */
/*
* Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom
@@ -6343,9 +6343,6 @@ init_done:
ahd_restart(ahd);
aic_timer_reset(&ahd->stat_timer, AHD_STAT_UPDATE_MS,
ahd_stat_timer, ahd);
-
- /* We have to wait until after any system dumps... */
- ahd->shutdown_hook = shutdownhook_establish(ahd_shutdown, ahd);
return (0);
}
diff --git a/sys/dev/ic/aic79xx_openbsd.c b/sys/dev/ic/aic79xx_openbsd.c
index a2184e4c593..760fae2a9a5 100644
--- a/sys/dev/ic/aic79xx_openbsd.c
+++ b/sys/dev/ic/aic79xx_openbsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic79xx_openbsd.c,v 1.39 2012/12/05 23:20:16 deraadt Exp $ */
+/* $OpenBSD: aic79xx_openbsd.c,v 1.40 2013/05/30 16:15:02 deraadt Exp $ */
/*
* Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom
@@ -612,9 +612,6 @@ ahd_detach(struct device *self, int flags)
if (ahd->sc_child != NULL)
rv = config_detach((void *)ahd->sc_child, flags);
- if (ahd->shutdown_hook != NULL)
- shutdownhook_disestablish(ahd->shutdown_hook);
-
ahd_free(ahd);
return rv;
diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c
index 4c299cdd8dd..d19899b87bc 100644
--- a/sys/dev/ic/cac.c
+++ b/sys/dev/ic/cac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cac.c,v 1.49 2011/10/27 00:18:23 krw Exp $ */
+/* $OpenBSD: cac.c,v 1.50 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: cac.c,v 1.15 2000/11/08 19:20:35 ad Exp $ */
/*
@@ -111,8 +111,6 @@ int cac_ccb_start(struct cac_softc *, struct cac_ccb *);
int cac_cmd(struct cac_softc *sc, int command, void *data, int datasize,
int drive, int blkno, int flags, struct scsi_xfer *xs);
int cac_get_dinfo(struct cac_softc *sc, int target);
-int cac_flush(struct cac_softc *sc);
-void cac_shutdown(void *);
void cac_copy_internal_data(struct scsi_xfer *xs, void *v, size_t size);
struct cac_ccb *cac_l0_completed(struct cac_softc *);
@@ -131,8 +129,6 @@ void cac_sensor_refresh(void *);
#endif
#endif /* NBIO > 0 */
-void *cac_sdh; /* shutdown hook */
-
const
struct cac_linkage cac_l0 = {
cac_l0_completed,
@@ -256,10 +252,6 @@ cac_init(struct cac_softc *sc, int startfw)
config_found(&sc->sc_dv, &saa, scsiprint);
- /* Set our `shutdownhook' before we start any device activity. */
- if (cac_sdh == NULL)
- cac_sdh = shutdownhook_establish(cac_shutdown, NULL);
-
(*sc->sc_cl->cl_intr_enable)(sc, 1);
#if NBIO > 0
@@ -292,23 +284,6 @@ cac_flush(sc)
}
/*
- * Shut down all `cac' controllers.
- */
-void
-cac_shutdown(void *cookie)
-{
- extern struct cfdriver cac_cd;
- struct cac_softc *sc;
- int i;
-
- for (i = 0; i < cac_cd.cd_ndevs; i++) {
- if ((sc = (struct cac_softc *)device_lookup(&cac_cd, i)) == NULL)
- continue;
- cac_flush(sc);
- }
-}
-
-/*
* Handle an interrupt from the controller: process finished CCBs and
* dequeue any waiting CCBs.
*/
diff --git a/sys/dev/ic/cacvar.h b/sys/dev/ic/cacvar.h
index 4026323d578..0138d43e284 100644
--- a/sys/dev/ic/cacvar.h
+++ b/sys/dev/ic/cacvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cacvar.h,v 1.6 2011/04/21 23:10:08 krw Exp $ */
+/* $OpenBSD: cacvar.h,v 1.7 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: cacvar.h,v 1.7 2000/10/19 14:28:47 ad Exp $ */
/*-
@@ -122,6 +122,7 @@ typedef int cac_lock_t;
int cac_init(struct cac_softc *, int);
int cac_intr(void *);
+int cac_flush(struct cac_softc *);
extern const struct cac_linkage cac_l0;
diff --git a/sys/dev/ic/ciss.c b/sys/dev/ic/ciss.c
index 7a0e6ce660a..c9a4fa1a1f4 100644
--- a/sys/dev/ic/ciss.c
+++ b/sys/dev/ic/ciss.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ciss.c,v 1.67 2011/11/10 12:05:11 krw Exp $ */
+/* $OpenBSD: ciss.c,v 1.68 2013/05/30 16:15:02 deraadt Exp $ */
/*
* Copyright (c) 2005,2006 Michael Shalayeff
@@ -81,7 +81,6 @@ int ciss_ioctl(struct device *, u_long, caddr_t);
#endif
int ciss_sync(struct ciss_softc *sc);
void ciss_heartbeat(void *v);
-void ciss_shutdown(void *v);
#ifndef SMALL_KERNEL
void ciss_sensors(void *);
#endif
@@ -356,12 +355,6 @@ ciss_attach(struct ciss_softc *sc)
}
sc->sc_flush = CISS_FLUSH_ENABLE;
- if (!(sc->sc_sh = shutdownhook_establish(ciss_shutdown, sc))) {
- printf(": unable to establish shutdown hook\n");
- bus_dmamem_free(sc->dmat, sc->cmdseg, 1);
- bus_dmamap_destroy(sc->dmat, sc->cmdmap);
- return -1;
- }
sc->sc_link.adapter_softc = sc;
sc->sc_link.openings = sc->maxcmd;
diff --git a/sys/dev/ic/cissvar.h b/sys/dev/ic/cissvar.h
index c6fba9d86aa..95fb6f19668 100644
--- a/sys/dev/ic/cissvar.h
+++ b/sys/dev/ic/cissvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cissvar.h,v 1.14 2010/06/03 01:03:55 dlg Exp $ */
+/* $OpenBSD: cissvar.h,v 1.15 2013/05/30 16:15:02 deraadt Exp $ */
/*
* Copyright (c) 2005,2006 Michael Shalayeff
@@ -31,7 +31,6 @@ struct ciss_softc {
struct scsi_link sc_link;
struct timeout sc_hb;
void *sc_ih;
- void *sc_sh;
int sc_flush;
struct ksensor *sensors;
struct ksensordev sensordev;
@@ -68,3 +67,4 @@ typedef int ciss_lock_t;
int ciss_attach(struct ciss_softc *sc);
int ciss_intr(void *v);
+void ciss_shutdown(void *v);
diff --git a/sys/dev/ic/dpt.c b/sys/dev/ic/dpt.c
index 5f212a4dad6..feaddcf2494 100644
--- a/sys/dev/ic/dpt.c
+++ b/sys/dev/ic/dpt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dpt.c,v 1.33 2011/06/21 20:23:49 matthew Exp $ */
+/* $OpenBSD: dpt.c,v 1.34 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: dpt.c,v 1.12 1999/10/23 16:26:33 ad Exp $ */
/*-
@@ -316,9 +316,6 @@ dpt_init(sc, intrstr)
sc->sc_nccbs = i;
}
- /* Set shutdownhook before we start any device activity */
- sc->sc_sdh = shutdownhook_establish(dpt_shutdown, sc);
-
/* Get the page 0 inquiry data from the HBA */
dpt_hba_inquire(sc, &ei);
@@ -384,20 +381,16 @@ dpt_init(sc, intrstr)
}
/*
- * Our 'shutdownhook' to cleanly shut down the HBA. The HBA must flush
+ * Cleanly shut down the HBA. The HBA must flush
* all data from its cache and mark array groups as clean.
*/
void
-dpt_shutdown(xxx_sc)
- void *xxx_sc;
+dpt_shutdown(void *v)
{
- struct dpt_softc *sc;
+ struct dpt_softc *sc = v;
- sc = xxx_sc;
- printf("shutting down %s...", sc->sc_dv.dv_xname);
dpt_cmd(sc, NULL, 0, CP_IMMEDIATE, CPI_POWEROFF_WARN);
DELAY(5000*1000);
- printf(" done\n");
}
/*
diff --git a/sys/dev/ic/dptvar.h b/sys/dev/ic/dptvar.h
index 6731633e6f6..75cc60a94be 100644
--- a/sys/dev/ic/dptvar.h
+++ b/sys/dev/ic/dptvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dptvar.h,v 1.10 2011/06/21 20:23:49 matthew Exp $ */
+/* $OpenBSD: dptvar.h,v 1.11 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: dptvar.h,v 1.5 1999/10/23 16:26:32 ad Exp $ */
/*
@@ -69,7 +69,6 @@ struct dpt_softc {
bus_dma_tag_t sc_dmat; /* bus DMA tag */
bus_dmamap_t sc_dmamap_ccb; /* maps the CCBs */
void *sc_ih; /* interrupt handler cookie */
- void *sc_sdh; /* shutdown hook */
struct dpt_ccb *sc_ccbs; /* all our CCBs */
struct eata_sp *sc_statpack; /* EATA status packet */
int sc_spoff; /* status packet offset in dmamap */
diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c
index 0d02c79a1f4..f7e8830537c 100644
--- a/sys/dev/isa/fd.c
+++ b/sys/dev/isa/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.92 2011/07/04 05:41:48 matthew Exp $ */
+/* $OpenBSD: fd.c,v 1.93 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */
/*-
@@ -117,8 +117,6 @@ struct fd_softc {
#define FD_MOTOR_WAIT 0x04 /* motor coming up */
int sc_cylin; /* where we think the head is */
- void *sc_sdhook; /* saved shutdown hook for drive. */
-
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
struct buf sc_q; /* head of buf chain */
@@ -130,9 +128,10 @@ struct fd_softc {
/* floppy driver configuration */
int fdprobe(struct device *, void *, void *);
void fdattach(struct device *, struct device *, void *);
+int fdactivate(struct device *, int);
struct cfattach fd_ca = {
- sizeof(struct fd_softc), fdprobe, fdattach
+ sizeof(struct fd_softc), fdprobe, fdattach, NULL, fdactivate
};
struct cfdriver fd_cd = {
@@ -302,15 +301,26 @@ fdattach(struct device *parent, struct device *self, void *aux)
fd->sc_dk.dk_name = fd->sc_dev.dv_xname;
disk_attach(&fd->sc_dev, &fd->sc_dk);
- /* Needed to power off if the motor is on when we halt. */
- fd->sc_sdhook = shutdownhook_establish(fd_motor_off, fd);
-
/* Setup timeout structures */
timeout_set(&fd->fd_motor_on_to, fd_motor_on, fd);
timeout_set(&fd->fd_motor_off_to, fd_motor_off, fd);
timeout_set(&fd->fdtimeout_to, fdtimeout, fd);
}
+int
+fdactivate(struct device *self, int act)
+{
+ int rv = 0;
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ fd_motor_off(self);
+ break;
+ }
+
+ return (rv);
+}
+
/*
* Translate nvram type into internal data structure. Return NULL for
* none/unknown/unusable.
diff --git a/sys/dev/isa/isa.c b/sys/dev/isa/isa.c
index 408e9f179dd..f817620e328 100644
--- a/sys/dev/isa/isa.c
+++ b/sys/dev/isa/isa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isa.c,v 1.40 2010/07/08 20:18:32 deraadt Exp $ */
+/* $OpenBSD: isa.c,v 1.41 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: isa.c,v 1.85 1996/05/14 00:31:04 thorpej Exp $ */
/*
@@ -75,8 +75,7 @@ void isaattach(struct device *, struct device *, void *);
extern int autoconf_verbose;
struct cfattach isa_ca = {
- sizeof(struct isa_softc), isamatch, isaattach, NULL,
- config_activate_children
+ sizeof(struct isa_softc), isamatch, isaattach
};
struct cfdriver isa_cd = {
diff --git a/sys/dev/pci/ahd_pci.c b/sys/dev/pci/ahd_pci.c
index 6c89c339181..89dba9301bc 100644
--- a/sys/dev/pci/ahd_pci.c
+++ b/sys/dev/pci/ahd_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahd_pci.c,v 1.21 2012/12/05 23:20:19 deraadt Exp $ */
+/* $OpenBSD: ahd_pci.c,v 1.22 2013/05/30 16:15:02 deraadt Exp $ */
/*
* Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom
@@ -283,9 +283,11 @@ static const char *pci_bus_modes[] =
int ahd_pci_probe(struct device *, void *, void *);
void ahd_pci_attach(struct device *, struct device *, void *);
+int ahd_activate(struct device *, int);
struct cfattach ahd_pci_ca = {
- sizeof(struct ahd_softc), ahd_pci_probe, ahd_pci_attach
+ sizeof(struct ahd_softc), ahd_pci_probe, ahd_pci_attach,
+ NULL, ahd_activate
};
int ahd_check_extport(struct ahd_softc *ahd);
@@ -540,6 +542,22 @@ ahd_pci_attach(struct device *parent, struct device *self, void *aux)
ahd_attach(ahd);
}
+int
+ahd_activate(struct device *self, int act)
+{
+ int ret = 0;
+
+ ret = config_activate_children(self, act);
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ ahd_shutdown(self);
+ break;
+ }
+
+ return (ret);
+}
+
/*
* Perform some simple tests that should catch situations where
* our registers are invalidly mapped.
diff --git a/sys/dev/pci/amdpm.c b/sys/dev/pci/amdpm.c
index 81063f43fc0..6fea65c5247 100644
--- a/sys/dev/pci/amdpm.c
+++ b/sys/dev/pci/amdpm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: amdpm.c,v 1.28 2012/10/05 10:51:28 haesbaert Exp $ */
+/* $OpenBSD: amdpm.c,v 1.29 2013/05/30 16:15:02 deraadt Exp $ */
/*
* Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -185,8 +185,8 @@ int amdpm_i2c_exec(void *, i2c_op_t, i2c_addr_t, const void *, size_t,
int amdpm_intr(void *);
struct cfattach amdpm_ca = {
- sizeof(struct amdpm_softc), amdpm_match, amdpm_attach, NULL,
- amdpm_activate
+ sizeof(struct amdpm_softc), amdpm_match, amdpm_attach,
+ NULL, amdpm_activate
};
struct cfdriver amdpm_cd = {
@@ -312,8 +312,15 @@ int
amdpm_activate(struct device *self, int act)
{
struct amdpm_softc *sc = (struct amdpm_softc *)self;
+ int ret = 0;
switch (act) {
+ case DVACT_QUIESCE:
+ ret = config_activate_children(self, act);
+ break;
+ case DVACT_SUSPEND:
+ ret = config_activate_children(self, act);
+ break;
case DVACT_RESUME:
if (timeout_initialized(&sc->sc_rnd_ch)) {
pcireg_t cfg_reg;
@@ -325,9 +332,13 @@ amdpm_activate(struct device *self, int act)
AMDPM_CONFREG, cfg_reg | AMDPM_RNGEN);
}
+ ret = config_activate_children(self, act);
+ break;
+ case DVACT_POWERDOWN:
+ ret = config_activate_children(self, act);
break;
}
- return (0);
+ return (ret);
}
void
diff --git a/sys/dev/pci/arc.c b/sys/dev/pci/arc.c
index 67f55c1c8f7..639c6a425cb 100644
--- a/sys/dev/pci/arc.c
+++ b/sys/dev/pci/arc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc.c,v 1.95 2011/07/17 22:46:48 matthew Exp $ */
+/* $OpenBSD: arc.c,v 1.96 2013/05/30 16:15:02 deraadt Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -347,7 +347,7 @@ struct arc_fw_sysinfo {
int arc_match(struct device *, void *, void *);
void arc_attach(struct device *, struct device *, void *);
int arc_detach(struct device *, int);
-void arc_shutdown(void *);
+int arc_activate(struct device *, int);
int arc_intr(void *);
struct arc_iop;
@@ -369,8 +369,6 @@ struct arc_softc {
void *sc_ih;
- void *sc_shutdownhook;
-
int sc_req_count;
struct arc_dmamem *sc_requests;
@@ -393,7 +391,8 @@ struct arc_softc {
#define DEVNAME(_s) ((_s)->sc_dev.dv_xname)
struct cfattach arc_ca = {
- sizeof(struct arc_softc), arc_match, arc_attach, arc_detach
+ sizeof(struct arc_softc), arc_match, arc_attach, arc_detach,
+ arc_activate
};
struct cfdriver arc_cd = {
@@ -590,10 +589,6 @@ arc_attach(struct device *parent, struct device *self, void *aux)
goto unmap_pci;
}
- sc->sc_shutdownhook = shutdownhook_establish(arc_shutdown, sc);
- if (sc->sc_shutdownhook == NULL)
- panic("unable to establish arc shutdownhook");
-
sc->sc_link.adapter = &arc_switch;
sc->sc_link.adapter_softc = sc;
sc->sc_link.adapter_target = ARC_MAX_TARGET;
@@ -633,31 +628,40 @@ unmap_pci:
}
int
-arc_detach(struct device *self, int flags)
+arc_activate(struct device *self, int act)
{
- struct arc_softc *sc = (struct arc_softc *)self;
-
- shutdownhook_disestablish(sc->sc_shutdownhook);
-
- if (arc_msg0(sc, ARC_RA_INB_MSG0_STOP_BGRB) != 0)
- printf("%s: timeout waiting to stop bg rebuild\n", DEVNAME(sc));
-
- if (arc_msg0(sc, ARC_RA_INB_MSG0_FLUSH_CACHE) != 0)
- printf("%s: timeout waiting to flush cache\n", DEVNAME(sc));
+ int ret = 0;
- return (0);
+ switch (act) {
+ case DVACT_QUIESCE:
+ ret = config_activate_children(self, act);
+ break;
+ case DVACT_SUSPEND:
+ ret = config_activate_children(self, act);
+ break;
+ case DVACT_POWERDOWN:
+ ret = config_activate_children(self, act);
+ arc_detach(self, 0);
+ break;
+ case DVACT_RESUME:
+ ret = config_activate_children(self, act);
+ break;
+ }
+ return (ret);
}
-void
-arc_shutdown(void *xsc)
+int
+arc_detach(struct device *self, int flags)
{
- struct arc_softc *sc = xsc;
+ struct arc_softc *sc = (struct arc_softc *)self;
if (arc_msg0(sc, ARC_RA_INB_MSG0_STOP_BGRB) != 0)
printf("%s: timeout waiting to stop bg rebuild\n", DEVNAME(sc));
if (arc_msg0(sc, ARC_RA_INB_MSG0_FLUSH_CACHE) != 0)
printf("%s: timeout waiting to flush cache\n", DEVNAME(sc));
+
+ return (0);
}
int
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c
index a9668679380..5cfc8eb80a1 100644
--- a/sys/dev/pci/azalia.c
+++ b/sys/dev/pci/azalia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia.c,v 1.205 2013/05/24 07:58:46 ratchov Exp $ */
+/* $OpenBSD: azalia.c,v 1.206 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
/*-
@@ -550,8 +550,6 @@ azalia_pci_attach(struct device *parent, struct device *self, void *aux)
sc->audiodev = audio_attach_mi(&azalia_hw_if, sc, &sc->dev);
- shutdownhook_establish(azalia_shutdown, sc);
-
return;
err_exit:
@@ -572,6 +570,9 @@ azalia_pci_activate(struct device *self, int act)
case DVACT_SUSPEND:
azalia_suspend(sc);
break;
+ case DVACT_POWERDOWN:
+ azalia_shutdown(sc);
+ break;
case DVACT_RESUME:
azalia_resume(sc);
rv = config_activate_children(self, act);
diff --git a/sys/dev/pci/cac_pci.c b/sys/dev/pci/cac_pci.c
index 4304deabca2..144cfe5a888 100644
--- a/sys/dev/pci/cac_pci.c
+++ b/sys/dev/pci/cac_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cac_pci.c,v 1.13 2009/04/06 15:18:45 kettenis Exp $ */
+/* $OpenBSD: cac_pci.c,v 1.14 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: cac_pci.c,v 1.10 2001/01/10 16:48:04 ad Exp $ */
/*-
@@ -56,6 +56,7 @@
void cac_pci_attach(struct device *, struct device *, void *);
const struct cac_pci_type *cac_pci_findtype(struct pci_attach_args *);
int cac_pci_match(struct device *, void *, void *);
+int cac_activate(struct device *, int);
struct cac_ccb *cac_pci_l0_completed(struct cac_softc *);
int cac_pci_l0_fifo_full(struct cac_softc *);
@@ -233,6 +234,24 @@ cac_pci_attach(parent, self, aux)
cac_init(sc, (ct->ct_flags & CT_STARTFW) != 0);
}
+int
+cac_activate(struct device *self, int act)
+{
+ struct cac_softc *sc = (struct cac_softc *)self;
+ int ret = 0;
+
+ ret = config_activate_children(self, act);
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ cac_flush(sc);
+ break;
+ }
+
+ return (ret);
+}
+
+
void
cac_pci_l0_submit(struct cac_softc *sc, struct cac_ccb *ccb)
{
diff --git a/sys/dev/pci/ciss_pci.c b/sys/dev/pci/ciss_pci.c
index cd452b77d8e..3c6d58c0324 100644
--- a/sys/dev/pci/ciss_pci.c
+++ b/sys/dev/pci/ciss_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ciss_pci.c,v 1.16 2012/03/11 13:33:06 jsg Exp $ */
+/* $OpenBSD: ciss_pci.c,v 1.17 2013/05/30 16:15:02 deraadt Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
@@ -39,9 +39,11 @@
int ciss_pci_match(struct device *, void *, void *);
void ciss_pci_attach(struct device *, struct device *, void *);
+int ciss_activate(struct device *, int);
struct cfattach ciss_pci_ca = {
- sizeof(struct ciss_softc), ciss_pci_match, ciss_pci_attach
+ sizeof(struct ciss_softc), ciss_pci_match, ciss_pci_attach,
+ NULL, ciss_activate
};
const struct pci_matchid ciss_pci_devices[] = {
@@ -192,3 +194,19 @@ ciss_pci_attach(struct device *parent, struct device *self, void *aux)
bus_space_write_4(sc->iot, sc->ioh, CISS_IMR,
bus_space_read_4(sc->iot, sc->ioh, CISS_IMR) & ~sc->iem);
}
+
+int
+ciss_activate(struct device *self, int act)
+{
+ int ret = 0;
+
+ ret = config_activate_children(self, act);
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ ciss_shutdown(self);
+ break;
+ }
+
+ return (ret);
+}
diff --git a/sys/dev/pci/dpt_pci.c b/sys/dev/pci/dpt_pci.c
index b1bb1666f89..6434a29a9f7 100644
--- a/sys/dev/pci/dpt_pci.c
+++ b/sys/dev/pci/dpt_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dpt_pci.c,v 1.6 2008/05/13 02:24:08 brad Exp $ */
+/* $OpenBSD: dpt_pci.c,v 1.7 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: dpt_pci.c,v 1.2 1999/09/29 17:33:02 ad Exp $ */
/*
@@ -68,9 +68,11 @@ int dpt_pci_match(struct device *, struct cfdata *, void *);
int dpt_pci_match(struct device *, void *, void *);
#endif /* __OpenBSD__ */
void dpt_pci_attach(struct device *, struct device *, void *);
+int dpt_activate(struct device *, int);
struct cfattach dpt_pci_ca = {
- sizeof(struct dpt_softc), dpt_pci_match, dpt_pci_attach
+ sizeof(struct dpt_softc), dpt_pci_match, dpt_pci_attach, NULL,
+ dpt_activate
};
int
@@ -149,3 +151,27 @@ dpt_pci_attach(parent, self, aux)
/* Now attach to the bus-independant code */
dpt_init(sc, intrstr);
}
+
+int
+dpt_activate(struct device *self, int act)
+{
+ int ret = 0;
+
+ switch (act) {
+ case DVACT_QUIESCE:
+ ret = config_activate_children(self, act);
+ break;
+ case DVACT_SUSPEND:
+ ret = config_activate_children(self, act);
+ break;
+ case DVACT_POWERDOWN:
+ ret = config_activate_children(self, act);
+ dpt_shutdown(self);
+ break;
+ case DVACT_RESUME:
+ ret = config_activate_children(self, act);
+ break;
+ }
+
+ return (ret);
+}
diff --git a/sys/dev/pci/iop_pci.c b/sys/dev/pci/iop_pci.c
index f0b70f06fbf..a92ca464b87 100644
--- a/sys/dev/pci/iop_pci.c
+++ b/sys/dev/pci/iop_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iop_pci.c,v 1.8 2010/07/13 13:07:35 kettenis Exp $ */
+/* $OpenBSD: iop_pci.c,v 1.9 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: iop_pci.c,v 1.4 2001/03/20 13:21:00 ad Exp $ */
/*-
@@ -56,9 +56,11 @@
void iop_pci_attach(struct device *, struct device *, void *);
int iop_pci_match(struct device *, void *, void *);
+int iop_activate(struct device *, int);
struct cfattach iop_pci_ca = {
- sizeof(struct iop_softc), iop_pci_match, iop_pci_attach
+ sizeof(struct iop_softc), iop_pci_match, iop_pci_attach,
+ NULL, iop_activate
};
int
@@ -143,3 +145,27 @@ iop_pci_attach(struct device *parent, struct device *self, void *aux)
/* Attach to the bus-independent code. */
iop_init(sc, intrstr);
}
+
+int
+iop_activate(struct device *self, int act)
+{
+ int ret = 0;
+
+ switch (act) {
+ case DVACT_QUIESCE:
+ ret = config_activate_children(self, act);
+ break;
+ case DVACT_SUSPEND:
+ ret = config_activate_children(self, act);
+ break;
+ case DVACT_POWERDOWN:
+ ret = config_activate_children(self, act);
+ iop_shutdown(self);
+ break;
+ case DVACT_RESUME:
+ ret = config_activate_children(self, act);
+ break;
+ }
+
+ return (ret);
+}
diff --git a/sys/dev/pci/puc.c b/sys/dev/pci/puc.c
index f52c0dabe31..ab845fb8562 100644
--- a/sys/dev/pci/puc.c
+++ b/sys/dev/pci/puc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: puc.c,v 1.22 2012/06/12 18:43:26 kettenis Exp $ */
+/* $OpenBSD: puc.c,v 1.23 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: puc.c,v 1.3 1999/02/06 06:29:54 cgd Exp $ */
/*
@@ -83,7 +83,7 @@ void *puc_pci_intr_establish(struct puc_attach_args *, int,
struct cfattach puc_pci_ca = {
sizeof(struct puc_pci_softc), puc_pci_match,
- puc_pci_attach, puc_pci_detach, config_activate_children
+ puc_pci_attach, puc_pci_detach
};
struct cfdriver puc_cd = {
diff --git a/sys/dev/pci/tcpcib.c b/sys/dev/pci/tcpcib.c
index 3f8386c78db..0b6f93d56a3 100644
--- a/sys/dev/pci/tcpcib.c
+++ b/sys/dev/pci/tcpcib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcpcib.c,v 1.4 2012/10/17 22:32:01 deraadt Exp $ */
+/* $OpenBSD: tcpcib.c,v 1.5 2013/05/30 16:15:02 deraadt Exp $ */
/*
* Copyright (c) 2012 Matt Dainty <matt@bodgit-n-scarper.com>
@@ -269,9 +269,11 @@ int
tcpcib_activate(struct device *self, int act)
{
struct tcpcib_softc *sc = (struct tcpcib_softc *)self;
-
+ int ret = 0;
+
switch (act) {
case DVACT_SUSPEND:
+ ret = config_activate_children(self, act);
/* Watchdog is running, disable it */
if (sc->sc_active & E600_WDT_ACTIVE && sc->sc_wdt_period != 0)
tcpcib_wdt_stop(sc);
@@ -291,9 +293,13 @@ tcpcib_activate(struct device *self, int act)
if (sc->sc_active & E600_HPET_ACTIVE)
bus_space_write_4(sc->sc_hpet_iot, sc->sc_hpet_ioh,
E600_HPET_GC, E600_HPET_GC_ENABLE);
+ ret = config_activate_children(self, act);
+ break;
+ default:
+ ret = config_activate_children(self, act);
break;
}
- return (0);
+ return (ret);
}
int
diff --git a/sys/dev/pcmcia/cfxga.c b/sys/dev/pcmcia/cfxga.c
index acf73b5bc95..952ae0fec38 100644
--- a/sys/dev/pcmcia/cfxga.c
+++ b/sys/dev/pcmcia/cfxga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfxga.c,v 1.21 2011/07/03 15:47:17 matthew Exp $ */
+/* $OpenBSD: cfxga.c,v 1.22 2013/05/30 16:15:02 deraadt Exp $ */
/*
* Copyright (c) 2005, 2006, Matthieu Herrb and Miodrag Vallat
@@ -316,13 +316,16 @@ int
cfxga_activate(struct device *dev, int act)
{
struct cfxga_softc *sc = (void *)dev;
+ int ret = 0;
switch (act) {
case DVACT_DEACTIVATE:
pcmcia_function_disable(sc->sc_pf);
break;
+ case DVACT_POWERDOWN:
+ ret = config_activate_children(self, act);
}
- return (0);
+ return (ret);
}
void
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c
index 57f30ca7506..948be507f4a 100644
--- a/sys/dev/usb/ehci.c
+++ b/sys/dev/usb/ehci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ehci.c,v 1.132 2013/05/20 08:19:47 yasuoka Exp $ */
+/* $OpenBSD: ehci.c,v 1.133 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */
/*
@@ -1053,6 +1053,7 @@ ehci_activate(struct device *self, int act)
rv = config_activate_children(self, act);
break;
case DVACT_SUSPEND:
+ rv = config_activate_children(self, act);
sc->sc_bus.use_polling++;
for (i = 1; i <= sc->sc_noport; i++) {
@@ -1095,6 +1096,7 @@ ehci_activate(struct device *self, int act)
sc->sc_bus.use_polling--;
break;
case DVACT_POWERDOWN:
+ rv = config_activate_children(self, act);
ehci_shutdown(sc);
break;
case DVACT_RESUME:
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index 87770263d74..4b2074cf7a2 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci.c,v 1.112 2013/05/20 08:19:47 yasuoka Exp $ */
+/* $OpenBSD: ohci.c,v 1.113 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
@@ -99,7 +99,6 @@ usbd_status ohci_alloc_std_chain(struct ohci_pipe *,
struct ohci_softc *, u_int, int, struct usbd_xfer *,
struct ohci_soft_td *, struct ohci_soft_td **);
-void ohci_shutdown(void *v);
usbd_status ohci_open(struct usbd_pipe *);
void ohci_poll(struct usbd_bus *);
void ohci_softintr(void *);
@@ -325,6 +324,7 @@ ohci_activate(struct device *self, int act)
switch (act) {
case DVACT_SUSPEND:
+ rv = config_activate_children(self, act);
sc->sc_bus.use_polling++;
reg = OREAD4(sc, OHCI_CONTROL) & ~OHCI_HCFS_MASK;
if (sc->sc_control == 0) {
@@ -342,6 +342,10 @@ ohci_activate(struct device *self, int act)
usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT);
sc->sc_bus.use_polling--;
break;
+ case DVACT_POWERDOWN:
+ rv = config_activate_children(self, act);
+ OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
+ break;
case DVACT_RESUME:
sc->sc_bus.use_polling++;
@@ -377,6 +381,7 @@ ohci_activate(struct device *self, int act)
usb_delay_ms(&sc->sc_bus, USB_RESUME_RECOVERY);
sc->sc_control = sc->sc_intre = sc->sc_ival = 0;
sc->sc_bus.use_polling--;
+ rv = config_activate_children(self, act);
break;
case DVACT_DEACTIVATE:
if (sc->sc_child != NULL)
@@ -400,9 +405,6 @@ ohci_detach(struct ohci_softc *sc, int flags)
timeout_del(&sc->sc_tmo_rhsc);
- if (sc->sc_shutdownhook != NULL)
- shutdownhook_disestablish(sc->sc_shutdownhook);
-
usb_delay_ms(&sc->sc_bus, 300); /* XXX let stray task complete */
/* free data structures XXX */
@@ -919,7 +921,6 @@ ohci_init(struct ohci_softc *sc)
sc->sc_bus.pipe_size = sizeof(struct ohci_pipe);
sc->sc_control = sc->sc_intre = 0;
- sc->sc_shutdownhook = shutdownhook_establish(ohci_shutdown, sc);
timeout_set(&sc->sc_tmo_rhsc, ohci_rhsc_enable, sc);
@@ -986,18 +987,6 @@ ohci_freex(struct usbd_bus *bus, struct usbd_xfer *xfer)
SIMPLEQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
}
-/*
- * Shut down the controller when the system is going down.
- */
-void
-ohci_shutdown(void *v)
-{
- struct ohci_softc *sc = v;
-
- DPRINTF(("ohci_shutdown: stopping the HC\n"));
- OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);
-}
-
#ifdef OHCI_DEBUG
void
ohci_dumpregs(struct ohci_softc *sc)
diff --git a/sys/dev/usb/ohcivar.h b/sys/dev/usb/ohcivar.h
index e1b6123f106..75eed0dc095 100644
--- a/sys/dev/usb/ohcivar.h
+++ b/sys/dev/usb/ohcivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohcivar.h,v 1.32 2013/04/15 09:23:01 mglocker Exp $ */
+/* $OpenBSD: ohcivar.h,v 1.33 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: ohcivar.h,v 1.32 2003/02/22 05:24:17 tsutsui Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohcivar.h,v 1.13 1999/11/17 22:33:41 n_hibma Exp $ */
@@ -116,8 +116,6 @@ struct ohci_softc {
char sc_vendor[16];
int sc_id_vendor;
- void *sc_shutdownhook; /* cookie from shutdown hook */
-
u_int32_t sc_control; /* Preserved during suspend/standby */
u_int32_t sc_intre;
u_int32_t sc_ival;
diff --git a/sys/dev/usb/udl.c b/sys/dev/usb/udl.c
index 8423850539b..b392b804804 100644
--- a/sys/dev/usb/udl.c
+++ b/sys/dev/usb/udl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udl.c,v 1.75 2013/04/26 14:28:39 mpi Exp $ */
+/* $OpenBSD: udl.c,v 1.76 2013/05/30 16:15:02 deraadt Exp $ */
/*
* Copyright (c) 2009 Marcus Glocker <mglocker@openbsd.org>
@@ -486,14 +486,16 @@ int
udl_activate(struct device *self, int act)
{
struct udl_softc *sc = (struct udl_softc *)self;
+ int ret = 0;
switch (act) {
case DVACT_DEACTIVATE:
usbd_deactivate(sc->sc_udev);
break;
}
+ ret = config_activate_children(self, act);
- return (0);
+ return (ret);
}
/* ---------- */
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 487fda3922d..d2168f094ce 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhci.c,v 1.97 2013/05/20 08:19:47 yasuoka Exp $ */
+/* $OpenBSD: uhci.c,v 1.98 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
@@ -127,7 +127,6 @@ struct uhci_pipe {
void uhci_globalreset(struct uhci_softc *);
usbd_status uhci_portreset(struct uhci_softc *, int);
void uhci_reset(struct uhci_softc *);
-void uhci_shutdown(void *v);
usbd_status uhci_run(struct uhci_softc *, int run);
struct uhci_soft_td *uhci_alloc_std(struct uhci_softc *);
void uhci_free_std(struct uhci_softc *, struct uhci_soft_td *);
@@ -502,7 +501,6 @@ uhci_init(struct uhci_softc *sc)
sc->sc_bus.pipe_size = sizeof(struct uhci_pipe);
sc->sc_suspend = DVACT_RESUME;
- sc->sc_shutdownhook = shutdownhook_establish(uhci_shutdown, sc);
UHCICMD(sc, UHCI_CMD_MAXP); /* Assume 64 byte packets at frame end */
@@ -525,6 +523,7 @@ uhci_activate(struct device *self, int act)
if (uhcidebug > 2)
uhci_dumpregs(sc);
#endif
+ rv = config_activate_children(self, act);
if (sc->sc_intr_xfer != NULL)
timeout_del(&sc->sc_poll_handle);
sc->sc_bus.use_polling++;
@@ -542,6 +541,10 @@ uhci_activate(struct device *self, int act)
sc->sc_bus.use_polling--;
DPRINTF(("uhci_activate: cmd=0x%x\n", UREAD2(sc, UHCI_CMD)));
break;
+ case DVACT_POWERDOWN:
+ rv = config_activate_children(self, act);
+ uhci_run(sc, 0); /* stop the controller */
+ break;
case DVACT_RESUME:
#ifdef DIAGNOSTIC
if (sc->sc_suspend == DVACT_RESUME)
@@ -577,6 +580,7 @@ uhci_activate(struct device *self, int act)
if (uhcidebug > 2)
uhci_dumpregs(sc);
#endif
+ rv = config_activate_children(self, act);
break;
case DVACT_DEACTIVATE:
if (sc->sc_child != NULL)
@@ -598,9 +602,6 @@ uhci_detach(struct uhci_softc *sc, int flags)
if (rv != 0)
return (rv);
- if (sc->sc_shutdownhook != NULL)
- shutdownhook_disestablish(sc->sc_shutdownhook);
-
if (sc->sc_intr_xfer != NULL) {
timeout_del(&sc->sc_poll_handle);
sc->sc_intr_xfer = NULL;
@@ -669,18 +670,6 @@ uhci_freex(struct usbd_bus *bus, struct usbd_xfer *xfer)
SIMPLEQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
}
-/*
- * Shut down the controller when the system is going down.
- */
-void
-uhci_shutdown(void *v)
-{
- struct uhci_softc *sc = v;
-
- DPRINTF(("uhci_shutdown: stopping the HC\n"));
- uhci_run(sc, 0); /* stop the controller */
-}
-
#ifdef UHCI_DEBUG
void
uhci_dumpregs(struct uhci_softc *sc)
diff --git a/sys/dev/usb/uhcivar.h b/sys/dev/usb/uhcivar.h
index 09e71b715c5..9205b58d639 100644
--- a/sys/dev/usb/uhcivar.h
+++ b/sys/dev/usb/uhcivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhcivar.h,v 1.25 2013/04/15 09:23:02 mglocker Exp $ */
+/* $OpenBSD: uhcivar.h,v 1.26 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: uhcivar.h,v 1.36 2002/12/31 00:39:11 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhcivar.h,v 1.14 1999/11/17 22:33:42 n_hibma Exp $ */
@@ -170,8 +170,6 @@ struct uhci_softc {
char sc_vendor[32]; /* vendor string for root hub */
int sc_id_vendor; /* vendor ID for root hub */
- void *sc_shutdownhook; /* cookie from shutdown hook */
-
struct device *sc_child; /* /dev/usb# device */
};
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c
index a25fc2aa44a..1502bb2cbb7 100644
--- a/sys/dev/usb/umass.c
+++ b/sys/dev/usb/umass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: umass.c,v 1.63 2013/04/15 09:23:02 mglocker Exp $ */
+/* $OpenBSD: umass.c,v 1.64 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: umass.c,v 1.116 2004/06/30 05:53:46 mycroft Exp $ */
/*
@@ -687,6 +687,9 @@ umass_activate(struct device *dev, int act)
DPRINTF(UDMASS_USB, ("%s: umass_activate: child "
"returned %d\n", sc->sc_dev.dv_xname, rv));
break;
+ default:
+ rv = config_activate_children(dev, act);
+ break;
}
return (rv);
}
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index 2054f207820..affda3e7c36 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb.c,v 1.91 2013/05/17 09:09:11 mpi Exp $ */
+/* $OpenBSD: usb.c,v 1.92 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */
/*
@@ -881,6 +881,13 @@ usb_activate(struct device *self, int act)
}
}
break;
+ case DVACT_QUIESCE:
+ rv = config_activate_children(self, act);
+ break;
+ case DVACT_SUSPEND:
+ break;
+ case DVACT_POWERDOWN:
+ break;
case DVACT_RESUME:
usb_needs_explore(sc->sc_bus->root_hub, 0);
break;
diff --git a/sys/dev/wscons/wsdisplay.c b/sys/dev/wscons/wsdisplay.c
index 49e91859a9e..00b1475fe2e 100644
--- a/sys/dev/wscons/wsdisplay.c
+++ b/sys/dev/wscons/wsdisplay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsdisplay.c,v 1.108 2013/05/12 20:41:45 kettenis Exp $ */
+/* $OpenBSD: wsdisplay.c,v 1.109 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: wsdisplay.c,v 1.82 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -156,7 +156,6 @@ int wsdisplay_getscreen(struct wsdisplay_softc *,
struct wsdisplay_addscreendata *);
void wsdisplay_resume_device(struct device *);
void wsdisplay_suspend_device(struct device *);
-void wsdisplay_shutdownhook(void *);
void wsdisplay_addscreen_print(struct wsdisplay_softc *, int, int);
void wsdisplay_closescreen(struct wsdisplay_softc *, struct wsscreen *);
int wsdisplay_delscreen(struct wsdisplay_softc *, int, int);
@@ -216,13 +215,15 @@ int wsdisplay_emul_match(struct device *, void *, void *);
void wsdisplay_emul_attach(struct device *, struct device *, void *);
int wsdisplay_emul_detach(struct device *, int);
+int wsdisplay_activate(struct device *, int);
+
struct cfdriver wsdisplay_cd = {
NULL, "wsdisplay", DV_TTY
};
struct cfattach wsdisplay_emul_ca = {
sizeof(struct wsdisplay_softc), wsdisplay_emul_match,
- wsdisplay_emul_attach, wsdisplay_emul_detach
+ wsdisplay_emul_attach, wsdisplay_emul_detach, wsdisplay_activate
};
void wsdisplaystart(struct tty *);
@@ -585,6 +586,20 @@ wsdisplay_emul_detach(struct device *self, int flags)
}
int
+wsdisplay_activate(struct device *self, int act)
+{
+ int ret = 0;
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ wsdisplay_switchtoconsole();
+ break;
+ }
+
+ return (ret);
+}
+
+int
wsdisplay_common_detach(struct wsdisplay_softc *sc, int flags)
{
int i;
@@ -659,7 +674,6 @@ wsdisplay_common_attach(struct wsdisplay_softc *sc, int console, int kbdmux,
const struct wsdisplay_accessops *accessops, void *accesscookie,
u_int defaultscreens)
{
- static int hookset = 0;
int i, start = 0;
#if NWSKBD > 0
struct wsevsrc *kme;
@@ -754,10 +768,6 @@ wsdisplay_common_attach(struct wsdisplay_softc *sc, int console, int kbdmux,
wsdisplay_burn(sc, sc->sc_burnflags);
#endif
- if (hookset == 0)
- shutdownhook_establish(wsdisplay_shutdownhook, NULL);
- hookset = 1;
-
#if NWSKBD > 0 && NWSMUX == 0
if (console == 0) {
/*
@@ -2353,15 +2363,6 @@ wsdisplay_burner(void *v)
}
#endif
-/*
- * Switch the console at shutdown.
- */
-void
-wsdisplay_shutdownhook(void *arg)
-{
- wsdisplay_switchtoconsole();
-}
-
#ifdef WSMOUSED_SUPPORT
/*
* wsmoused(8) support functions
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c
index ff5c4313db9..36eab78eb60 100644
--- a/sys/kern/subr_autoconf.c
+++ b/sys/kern/subr_autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_autoconf.c,v 1.67 2012/10/08 21:47:50 deraadt Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.68 2013/05/30 16:15:02 deraadt Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
@@ -774,13 +774,10 @@ config_suspend(struct device *dev, int act)
{
struct cfattach *ca = dev->dv_cfdata->cf_attach;
- if (ca->ca_activate) {
-#if 0
- printf("activate: %s %d\n", dev->dv_xname, act);
-#endif
+ if (ca->ca_activate)
return (*ca->ca_activate)(dev, act);
- }
- return (0);
+ else
+ return config_activate_children(dev, act);
}
/*