summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2015-05-11 08:16:33 +0000
committeravg <avg@FreeBSD.org>2015-05-11 08:16:33 +0000
commitd8a44286a15bd6cf67f494058b4be94e75552d87 (patch)
tree77c90234655a5ab610894c35e9327585f79233db
parent2413b4098a64ace50881a79cec7e37858e575bbc (diff)
downloadFreeBSD-src-d8a44286a15bd6cf67f494058b4be94e75552d87.zip
FreeBSD-src-d8a44286a15bd6cf67f494058b4be94e75552d87.tar.gz
MFC r277796: hook userland threads suspend + resume into acpi suspend code
-rw-r--r--sys/dev/acpica/acpi.c4
-rw-r--r--sys/dev/syscons/syscons.c2
-rw-r--r--sys/dev/vt/vt_core.c4
-rw-r--r--sys/sys/eventhandler.h1
4 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 00d2252..107f12d 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -2749,6 +2749,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
return_ACPI_STATUS (AE_OK);
}
+ EVENTHANDLER_INVOKE(power_suspend_early);
+ stop_all_proc();
EVENTHANDLER_INVOKE(power_suspend);
if (smp_started) {
@@ -2892,6 +2894,8 @@ backout:
thread_unlock(curthread);
}
+ resume_all_proc();
+
EVENTHANDLER_INVOKE(power_resume);
/* Allow another sleep request after a while. */
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 35b3ca8..dd3aece 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -550,7 +550,7 @@ sc_attach_unit(int unit, int flags)
/* Register suspend/resume/shutdown callbacks for the kernel console. */
if (sc_console_unit == unit) {
- EVENTHANDLER_REGISTER(power_suspend, scsuspend, NULL,
+ EVENTHANDLER_REGISTER(power_suspend_early, scsuspend, NULL,
EVENTHANDLER_PRI_ANY);
EVENTHANDLER_REGISTER(power_resume, scresume, NULL,
EVENTHANDLER_PRI_ANY);
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index b2e27fb..f655273 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -2560,8 +2560,8 @@ vt_upgrade(struct vt_device *vd)
if (register_handlers) {
/* Register suspend/resume handlers. */
- EVENTHANDLER_REGISTER(power_suspend, vt_suspend_handler, vd,
- EVENTHANDLER_PRI_ANY);
+ EVENTHANDLER_REGISTER(power_suspend_early, vt_suspend_handler,
+ vd, EVENTHANDLER_PRI_ANY);
EVENTHANDLER_REGISTER(power_resume, vt_resume_handler, vd,
EVENTHANDLER_PRI_ANY);
}
diff --git a/sys/sys/eventhandler.h b/sys/sys/eventhandler.h
index 7e5c173..cae08c0 100644
--- a/sys/sys/eventhandler.h
+++ b/sys/sys/eventhandler.h
@@ -182,6 +182,7 @@ EVENTHANDLER_DECLARE(shutdown_final, shutdown_fn);
typedef void (*power_change_fn)(void *);
EVENTHANDLER_DECLARE(power_resume, power_change_fn);
EVENTHANDLER_DECLARE(power_suspend, power_change_fn);
+EVENTHANDLER_DECLARE(power_suspend_early, power_change_fn);
/* Low memory event */
typedef void (*vm_lowmem_handler_t)(void *, int);
OpenPOWER on IntegriCloud