diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-12-06 21:03:06 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-12-06 21:03:06 +0000 |
commit | dde7b00df07d5064317db5ff355091c989d5d684 (patch) | |
tree | 7ea38e550451394317b7581ff5f8914bd269ec95 /sys/arch | |
parent | 236f5968eef75c8e14b0b020bb15cc2f53b5041e (diff) |
Add a DVACT_WAKEUP op to the *_activate() API. This is called after the
kernel resumes normal (non-cold, able to run processes, etc) operation.
Previously we were relying on specific DVACT_RESUME op's in drivers
creating callback/threads themselves, but that has become too common,
indicating the need for a built-in mechanism.
ok dlg kettenis, tested by a sufficient amount of people
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/pci/pchb.c | 14 | ||||
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_apm.c | 5 | ||||
-rw-r--r-- | sys/arch/i386/i386/apm.c | 5 | ||||
-rw-r--r-- | sys/arch/i386/pci/pchb.c | 14 | ||||
-rw-r--r-- | sys/arch/loongson/dev/apm.c | 5 | ||||
-rw-r--r-- | sys/arch/macppc/dev/esp.c | 13 | ||||
-rw-r--r-- | sys/arch/macppc/dev/mesh.c | 13 | ||||
-rw-r--r-- | sys/arch/zaurus/dev/zaurus_apm.c | 5 | ||||
-rw-r--r-- | sys/arch/zaurus/zaurus/zaurus_lcd.c | 4 |
9 files changed, 40 insertions, 38 deletions
diff --git a/sys/arch/amd64/pci/pchb.c b/sys/arch/amd64/pci/pchb.c index d51c6ddb9a5..e1967a4e681 100644 --- a/sys/arch/amd64/pci/pchb.c +++ b/sys/arch/amd64/pci/pchb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pchb.c,v 1.39 2012/10/08 21:47:47 deraadt Exp $ */ +/* $OpenBSD: pchb.c,v 1.40 2013/12/06 21:03:05 deraadt Exp $ */ /* $NetBSD: pchb.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $ */ /* * Copyright (c) 2000 Michael Shalayeff @@ -280,15 +280,6 @@ pchbactivate(struct device *self, int act) int rv = 0; switch (act) { - case DVACT_QUIESCE: - rv = config_activate_children(self, act); - break; - case DVACT_SUSPEND: - rv = config_activate_children(self, act); - break; - case DVACT_POWERDOWN: - rv = config_activate_children(self, act); - break; case DVACT_RESUME: /* re-enable RNG, if we have it */ if (sc->sc_rng_active) @@ -298,6 +289,9 @@ pchbactivate(struct device *self, int act) I82802_RNG_HWST) | I82802_RNG_HWST_ENABLE); rv = config_activate_children(self, act); break; + default: + rv = config_activate_children(self, act); + break; } return (rv); } diff --git a/sys/arch/arm/xscale/pxa2x0_apm.c b/sys/arch/arm/xscale/pxa2x0_apm.c index f2df85177b4..8f55ff95b54 100644 --- a/sys/arch/arm/xscale/pxa2x0_apm.c +++ b/sys/arch/arm/xscale/pxa2x0_apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pxa2x0_apm.c,v 1.40 2013/11/18 20:21:51 deraadt Exp $ */ +/* $OpenBSD: pxa2x0_apm.c,v 1.41 2013/12/06 21:03:05 deraadt Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -354,6 +354,9 @@ apm_resume(struct pxa2x0_apm_softc *sc) bus_space_write_4(sc->sc_iot, sc->sc_pm_ioh, POWMAN_PSSR, PSSR_OTGPH); bufq_restart(); + + config_suspend(TAILQ_FIRST(&alldevs), DVACT_WAKEUP); + #if NWSDISPLAY > 0 wsdisplay_resume(); #endif /* NWSDISPLAY > 0 */ diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c index e8a6b0cba39..99767ce2cf7 100644 --- a/sys/arch/i386/i386/apm.c +++ b/sys/arch/i386/i386/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.101 2013/11/18 20:21:51 deraadt Exp $ */ +/* $OpenBSD: apm.c,v 1.102 2013/12/06 21:03:05 deraadt Exp $ */ /*- * Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved. @@ -281,6 +281,9 @@ apm_suspend(int state) if (cpu_setperf != NULL) cpu_setperf(perflevel); bufq_restart(); + + config_suspend(TAILQ_FIRST(&alldevs), DVACT_WAKEUP); + #if NWSDISPLAY > 0 wsdisplay_resume(); #endif /* NWSDISPLAY > 0 */ diff --git a/sys/arch/i386/pci/pchb.c b/sys/arch/i386/pci/pchb.c index 03ba73d9e5a..525a6e3ca58 100644 --- a/sys/arch/i386/pci/pchb.c +++ b/sys/arch/i386/pci/pchb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pchb.c,v 1.87 2012/10/08 21:47:48 deraadt Exp $ */ +/* $OpenBSD: pchb.c,v 1.88 2013/12/06 21:03:05 deraadt Exp $ */ /* $NetBSD: pchb.c,v 1.65 2007/08/15 02:26:13 markd Exp $ */ /* @@ -423,15 +423,6 @@ pchbactivate(struct device *self, int act) int rv = 0; switch (act) { - case DVACT_QUIESCE: - rv = config_activate_children(self, act); - break; - case DVACT_SUSPEND: - rv = config_activate_children(self, act); - break; - case DVACT_POWERDOWN: - rv = config_activate_children(self, act); - break; case DVACT_RESUME: /* re-enable RNG, if we have it */ if (sc->sc_rng_active) @@ -441,6 +432,9 @@ pchbactivate(struct device *self, int act) I82802_RNG_HWST) | I82802_RNG_HWST_ENABLE); rv = config_activate_children(self, act); break; + default: + rv = config_activate_children(self, act); + break; } return (rv); } diff --git a/sys/arch/loongson/dev/apm.c b/sys/arch/loongson/dev/apm.c index da106eb3187..d85c32cd520 100644 --- a/sys/arch/loongson/dev/apm.c +++ b/sys/arch/loongson/dev/apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apm.c,v 1.16 2013/06/05 00:44:24 pirofti Exp $ */ +/* $OpenBSD: apm.c,v 1.17 2013/12/06 21:03:05 deraadt Exp $ */ /*- * Copyright (c) 2001 Alexander Guy. All rights reserved. @@ -411,6 +411,9 @@ apm_suspend(int state) splx(s); bufq_restart(); + + config_suspend(TAILQ_FIRST(&alldevs), DVACT_WAKEUP); + #if NWSDISPLAY > 0 wsdisplay_resume(); #endif diff --git a/sys/arch/macppc/dev/esp.c b/sys/arch/macppc/dev/esp.c index 1b9acd707d7..f96262666e8 100644 --- a/sys/arch/macppc/dev/esp.c +++ b/sys/arch/macppc/dev/esp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: esp.c,v 1.9 2013/05/30 16:15:01 deraadt Exp $ */ +/* $OpenBSD: esp.c,v 1.10 2013/12/06 21:03:05 deraadt Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -269,17 +269,18 @@ int esp_activate(struct device *self, int act) { struct ncr53c9x_softc *sc = self; - int ret = 0; - - ret = config_activate_children(self, act); + int rv = 0; switch (act) { case DVACT_POWERDOWN: + rv = config_activate_children(self, act); NCRCMD(sc, NCRCMD_RSTSCSI); break; + default: + rv = config_activate_children(self, act); + break; } - - return (ret); + return (rv); } /* diff --git a/sys/arch/macppc/dev/mesh.c b/sys/arch/macppc/dev/mesh.c index a8c42b3034d..b08c2287bfe 100644 --- a/sys/arch/macppc/dev/mesh.c +++ b/sys/arch/macppc/dev/mesh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mesh.c,v 1.31 2013/05/31 14:30:51 mpi Exp $ */ +/* $OpenBSD: mesh.c,v 1.32 2013/12/06 21:03:05 deraadt Exp $ */ /* $NetBSD: mesh.c,v 1.1 1999/02/19 13:06:03 tsubai Exp $ */ /*- @@ -381,19 +381,20 @@ int mesh_activate(struct device *self, int act) { struct mesh_softc *sc = (struct mesh_softc *)self; - int ret = 0; - - ret = config_activate_children(self, act); + int rv = 0; switch (act) { case DVACT_POWERDOWN: + rv = config_activate_children(self, act); /* Set to async mode. */ mesh_set_reg(sc, MESH_SYNC_PARAM, 2); mesh_bus_reset(sc); break; + default: + rv = config_activate_children(self, act); + break; } - - return (ret); + return (rv); } #define MESH_SET_XFER(sc, count) do { \ diff --git a/sys/arch/zaurus/dev/zaurus_apm.c b/sys/arch/zaurus/dev/zaurus_apm.c index 8a694a55cc5..b01ffd2a5dc 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.23 2013/05/30 16:15:01 deraadt Exp $ */ +/* $OpenBSD: zaurus_apm.c,v 1.24 2013/12/06 21:03:05 deraadt Exp $ */ /* * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> @@ -686,6 +686,9 @@ zapm_poweroff(void) splx(s); bufq_restart(); + + config_suspend(TAILQ_FIRST(&alldevs), DVACT_WAKEUP); + #if NWSDISPLAY > 0 wsdisplay_resume(); #endif /* NWSDISPLAY > 0 */ diff --git a/sys/arch/zaurus/zaurus/zaurus_lcd.c b/sys/arch/zaurus/zaurus/zaurus_lcd.c index 06ad3e2f605..18220260ca1 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.27 2013/10/21 10:36:22 miod Exp $ */ +/* $OpenBSD: zaurus_lcd.c,v 1.28 2013/12/06 21:03:05 deraadt Exp $ */ /* $NetBSD: lubbock_lcd.c,v 1.1 2003/08/09 19:38:53 bsh Exp $ */ /* @@ -408,7 +408,7 @@ lcd_activate(struct device *self, int act) pxa2x0_lcd_resume(sc); lcd_set_brightness(lcd_get_brightness()); break; - case DVACT_POWERDOWN: + default: ret = config_activate_children(self, act); break; } |