From 71804adc62f557c8bccc7a50fec970e85f0992c4 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Tue, 27 Mar 2012 23:26:58 +0000 Subject: [PATCH] Restore interrupt state after executing AcpiEnterSleepState(). --- sys/dev/acpica/acpi.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index ba10ea8bc7a6..d1db7c938b76 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1968,6 +1968,7 @@ static void acpi_shutdown_final(void *arg, int howto) { struct acpi_softc *sc = (struct acpi_softc *)arg; + register_t intr; ACPI_STATUS status; /* @@ -1983,13 +1984,15 @@ acpi_shutdown_final(void *arg, int howto) return; } device_printf(sc->acpi_dev, "Powering system off\n"); - ACPI_DISABLE_IRQS(); + intr = intr_disable(); status = AcpiEnterSleepState(ACPI_STATE_S5, acpi_sleep_flags); - if (ACPI_FAILURE(status)) + if (ACPI_FAILURE(status)) { + intr_restore(intr); device_printf(sc->acpi_dev, "power-off failed - %s\n", AcpiFormatException(status)); - else { + } else { DELAY(1000000); + intr_restore(intr); device_printf(sc->acpi_dev, "power-off failed - timeout\n"); } } else if ((howto & RB_HALT) == 0 && sc->acpi_handle_reboot) { @@ -2641,7 +2644,8 @@ enum acpi_sleep_state { static ACPI_STATUS acpi_EnterSleepState(struct acpi_softc *sc, int state) { - ACPI_STATUS status; + register_t intr; + ACPI_STATUS status; enum acpi_sleep_state slp_state; ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, state); @@ -2730,8 +2734,9 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state) if (state == ACPI_STATE_S4) AcpiEnable(); } else { - ACPI_DISABLE_IRQS(); + intr = intr_disable(); status = AcpiEnterSleepState(state, acpi_sleep_flags); + intr_restore(intr); if (ACPI_FAILURE(status)) { device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", AcpiFormatException(status));