diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 309709befd9..d7149d6523a 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -431,7 +431,6 @@ acpi_attach(device_t dev) */ sc->acpi_sleep_delay = 5; sc->acpi_disable_on_poweroff = 1; - sc->acpi_s4bios = 1; if (bootverbose) sc->acpi_verbose = 1; if ((env = getenv("hw.acpi.verbose")) && strcmp(env, "0")) { @@ -439,6 +438,10 @@ acpi_attach(device_t dev) freeenv(env); } + /* Only enable S4BIOS by default if the FACS says it is available. */ + if (AcpiGbl_FACS->S4Bios_f != 0) + sc->acpi_s4bios = 1; + /* * Dispatch the default sleep state to devices. * TBD: should be configured from userland policy manager. @@ -1980,10 +1983,12 @@ acpiioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td) break; } state = *(int *)addr; - if (state >= ACPI_STATE_S0 && state <= ACPI_S_STATES_MAX) - acpi_SetSleepState(sc, state); - else + if (state >= ACPI_STATE_S0 && state <= ACPI_S_STATES_MAX) { + if (ACPI_FAILURE(acpi_SetSleepState(sc, state))) + error = EINVAL; + } else { error = EINVAL; + } break; default: if (error == 0)