From ba9cd7416732439e82cc6ccb71d1e7f1cf35b1c8 Mon Sep 17 00:00:00 2001 From: iwasaki Date: Sun, 25 Aug 2002 06:13:53 +0000 Subject: [PATCH] Add new sysctl MIB (hw.acpi.sleep_delay) to specify the delay (in seconds) before ACPI sleep. Some machines might need this to sleep by Hot-key. --- sys/dev/acpica/acpi.c | 8 ++++++++ sys/dev/acpica/acpivar.h | 1 + 2 files changed, 9 insertions(+) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 0b0e1572d124..d8657d84b95c 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -416,12 +416,16 @@ acpi_attach(device_t dev) SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO, "suspend_state", CTLTYPE_STRING | CTLFLAG_RW, &sc->acpi_suspend_sx, 0, acpi_sleep_state_sysctl, "A", ""); + SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), + OID_AUTO, "sleep_delay", CTLFLAG_RD | CTLFLAG_RW, + &sc->acpi_sleep_delay, 0, "sleep delay"); SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO, "s4bios", CTLFLAG_RD | CTLFLAG_RW, &sc->acpi_s4bios, 0, "S4BIOS mode"); SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO, "verbose", CTLFLAG_RD | CTLFLAG_RW, &sc->acpi_verbose, 0, "verbose mode"); + sc->acpi_sleep_delay = 1; sc->acpi_s4bios = 1; if (bootverbose) sc->acpi_verbose = 1; @@ -1357,6 +1361,10 @@ acpi_SetSleepState(struct acpi_softc *sc, int state) break; } + if (sc->acpi_sleep_delay > 0) { + DELAY(sc->acpi_sleep_delay * 1000000); + } + if (state != ACPI_STATE_S1) { acpi_sleep_machdep(sc, state); diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 88c462e7b6b1..ae94b0514559 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -59,6 +59,7 @@ struct acpi_softc { int acpi_standby_sx; int acpi_suspend_sx; + int acpi_sleep_delay; int acpi_s4bios; int acpi_verbose;