diff options
author | 2010-04-07 06:33:06 +0000 | |
---|---|---|
committer | 2010-04-07 06:33:06 +0000 | |
commit | 057f7ac6cfdea807c71f34bfe0572513021d0e1e (patch) | |
tree | 5787e6ca48cdb169c7b46f6eef752c4a8c5f7387 /sys/dev | |
parent | update a random sampling of drivers after the proc.h -> systm.h move (diff) | |
download | wireguard-openbsd-057f7ac6cfdea807c71f34bfe0572513021d0e1e.tar.xz wireguard-openbsd-057f7ac6cfdea807c71f34bfe0572513021d0e1e.zip |
Make suspend/resume work on MP machines (running an MP kernel). Joint work
from mlarkin@ and me, with some amd64 fixes thrown in by deraadt@
ok marco@, deraadt@, pirofti@, mlarkin@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/acpi/acpi.c | 22 | ||||
-rw-r--r-- | sys/dev/acpi/acpivar.h | 3 |
2 files changed, 19 insertions, 6 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 15c83596401..b66e45732b3 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.155 2010/03/31 19:21:19 kettenis Exp $ */ +/* $OpenBSD: acpi.c,v 1.156 2010/04/07 06:33:06 kettenis Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -27,6 +27,7 @@ #include <sys/proc.h> #include <sys/kthread.h> #include <sys/workq.h> +#include <sys/sched.h> #include <machine/conf.h> #include <machine/cpufunc.h> @@ -1837,10 +1838,6 @@ acpi_sleep_state(struct acpi_softc *sc, int state) { int ret; -#ifdef MULTIPROCESSOR - if (ncpus > 1) /* cannot suspend MP yet */ - return (0); -#endif switch (state) { case ACPI_STATE_S0: return (0); @@ -1956,6 +1953,8 @@ acpi_resume(struct acpi_softc *sc, int state) enable_intr(); splx(acpi_saved_spl); + acpi_resume_machdep(); + sc->sc_state = ACPI_STATE_S0; if (sc->sc_tts) { env.v_integer = sc->sc_state; @@ -1971,6 +1970,10 @@ acpi_resume(struct acpi_softc *sc, int state) aml_evalnode(sc, sc->sc_sst, 1, &env, NULL); } +#ifdef MULTIPROCESSOR + sched_start_secondary_cpus(); +#endif + acpi_record_event(sc, APM_NORMAL_RESUME); #if NWSDISPLAY > 0 @@ -2018,6 +2021,10 @@ acpi_handle_suspend_failure(struct acpi_softc *sc) env.v_integer = ACPI_SST_WORKING; aml_evalnode(sc, sc->sc_sst, 1, &env, NULL); } + +#ifdef MULTIPROCESSOR + sched_start_secondary_cpus(); +#endif } int @@ -2035,6 +2042,11 @@ acpi_prepare_sleep_state(struct acpi_softc *sc, int state) return (ENXIO); } +#ifdef MULTIPROCESSOR + sched_stop_secondary_cpus(); + KASSERT(CPU_IS_PRIMARY(curcpu())); +#endif + memset(&env, 0, sizeof(env)); env.type = AML_OBJTYPE_INTEGER; env.v_integer = state; diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index 32dca939a39..af31e3240cc 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivar.h,v 1.56 2010/03/31 19:21:19 kettenis Exp $ */ +/* $OpenBSD: acpivar.h,v 1.57 2010/04/07 06:33:06 kettenis Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -294,6 +294,7 @@ int acpi_sleep_state(struct acpi_softc *, int); int acpi_prepare_sleep_state(struct acpi_softc *, int); int acpi_enter_sleep_state(struct acpi_softc *, int); int acpi_sleep_machdep(struct acpi_softc *, int); +void acpi_resume_machdep(void); void acpi_sleep_walk(struct acpi_softc *, int); |