Restore interrupt state after executing AcpiEnterSleepState().

This commit is contained in:
Jung-uk Kim 2012-03-27 23:26:58 +00:00
parent 88c7c4348b
commit 71804adc62

View File

@ -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));