summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica
diff options
context:
space:
mode:
authoriwasaki <iwasaki@FreeBSD.org>2012-06-01 15:26:32 +0000
committeriwasaki <iwasaki@FreeBSD.org>2012-06-01 15:26:32 +0000
commit9cbcc3c49217bb72870e849e6d29f60a7f7523f4 (patch)
tree67744bb6bd77bbf3e84cf3f6921faa49fe802486 /sys/dev/acpica
parentd642fa7a2f76eb02a58d652c2601150ccd82da42 (diff)
downloadFreeBSD-src-9cbcc3c49217bb72870e849e6d29f60a7f7523f4.zip
FreeBSD-src-9cbcc3c49217bb72870e849e6d29f60a7f7523f4.tar.gz
Call AcpiLeaveSleepStatePrep() in interrupt disabled context
(described in ACPICA source code). - Move intr_disable() and intr_restore() from acpi_wakeup.c to acpi.c and call AcpiLeaveSleepStatePrep() in interrupt disabled context. - Add acpi_wakeup_machdep() to execute wakeup MD procedures and call it twice in interrupt disabled/enabled context (ia64 version is just dummy). - Rename wakeup_cpus variable in acpi_sleep_machdep() to suspcpus in order to be shared by acpi_sleep_machdep() and acpi_wakeup_machdep(). - Move identity mapping related code to acpi_install_wakeup_handler() (i386 version) for preparation of x86/acpica/acpi_wakeup.c (MFC candidate). Reviewed by: jkim@ MFC after: 2 days
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r--sys/dev/acpica/acpi.c16
-rw-r--r--sys/dev/acpica/acpivar.h2
2 files changed, 14 insertions, 4 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 41cd9f1..730a954 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -2666,6 +2666,7 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
register_t intr;
ACPI_STATUS status;
enum acpi_sleep_state slp_state;
+ int sleep_result;
ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state);
@@ -2746,7 +2747,16 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
DELAY(sc->acpi_sleep_delay * 1000000);
if (state != ACPI_STATE_S1) {
- if (acpi_sleep_machdep(sc, state))
+ intr = intr_disable();
+ sleep_result = acpi_sleep_machdep(sc, state);
+ acpi_wakeup_machdep(sc, state, sleep_result, 0);
+ AcpiLeaveSleepStatePrep(state, acpi_sleep_flags);
+ intr_restore(intr);
+
+ /* call acpi_wakeup_machdep() again with interrupt enabled */
+ acpi_wakeup_machdep(sc, state, sleep_result, 1);
+
+ if (sleep_result == -1)
goto backout;
/* Re-enable ACPI hardware on wakeup from sleep state 4. */
@@ -2775,10 +2785,8 @@ backout:
}
if (slp_state >= ACPI_SS_DEV_SUSPEND)
DEVICE_RESUME(root_bus);
- if (slp_state >= ACPI_SS_SLP_PREP) {
- AcpiLeaveSleepStatePrep(state, acpi_sleep_flags);
+ if (slp_state >= ACPI_SS_SLP_PREP)
AcpiLeaveSleepState(state);
- }
if (slp_state >= ACPI_SS_SLEPT) {
acpi_resync_clock(sc);
acpi_enable_fixed_events(sc);
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index a1892ea..a469588 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -439,6 +439,8 @@ int acpi_disabled(char *subsys);
int acpi_machdep_init(device_t dev);
void acpi_install_wakeup_handler(struct acpi_softc *sc);
int acpi_sleep_machdep(struct acpi_softc *sc, int state);
+int acpi_wakeup_machdep(struct acpi_softc *sc, int state,
+ int sleep_result, int intr_enabled);
int acpi_table_quirks(int *quirks);
int acpi_machdep_quirks(int *quirks);
OpenPOWER on IntegriCloud