summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi.c
diff options
context:
space:
mode:
authoriwasaki <iwasaki@FreeBSD.org>2003-04-11 16:53:56 +0000
committeriwasaki <iwasaki@FreeBSD.org>2003-04-11 16:53:56 +0000
commita9636d4e105d68b788ec609018ea707072a32761 (patch)
tree4701f45a1635c6b5caf1f4e6fdeaaa9bb113a2e0 /sys/dev/acpica/acpi.c
parent0e8a48a3191761fc02f26d87ced5f0ac1c0c4085 (diff)
downloadFreeBSD-src-a9636d4e105d68b788ec609018ea707072a32761.zip
FreeBSD-src-a9636d4e105d68b788ec609018ea707072a32761.tar.gz
Add new sysctl MIB (hw.acpi.supported_sleep_state) to indicate
the list of supported sleep state. This should help people understand what following message means. acpi0: AcpiGetSleepTypeData failed - AE_NOT_FOUND MFC after: 3 days
Diffstat (limited to 'sys/dev/acpica/acpi.c')
-rw-r--r--sys/dev/acpica/acpi.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 71a90ec..75b9f73 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -120,6 +120,7 @@ static void acpi_enable_fixed_events(struct acpi_softc *sc);
static void acpi_system_eventhandler_sleep(void *arg, int state);
static void acpi_system_eventhandler_wakeup(void *arg, int state);
+static int acpi_supported_sleep_state_sysctl(SYSCTL_HANDLER_ARGS);
static int acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS);
static int acpi_pm_func(u_long cmd, void *arg, ...);
@@ -398,6 +399,9 @@ acpi_attach(device_t dev)
SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
device_get_name(dev), CTLFLAG_RD, 0, "");
SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
+ OID_AUTO, "supported_sleep_state", CTLTYPE_STRING | CTLFLAG_RD,
+ 0, 0, acpi_supported_sleep_state_sysctl, "A", "");
+ SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
OID_AUTO, "power_button_state", CTLTYPE_STRING | CTLFLAG_RW,
&sc->acpi_power_button_sx, 0, acpi_sleep_state_sysctl, "A", "");
SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
@@ -1914,6 +1918,25 @@ out:
}
static int
+acpi_supported_sleep_state_sysctl(SYSCTL_HANDLER_ARGS)
+{
+ char sleep_state[4];
+ char buf[16];
+ int error;
+ UINT8 state, TypeA, TypeB;
+
+ buf[0] = '\0';
+ for (state = ACPI_STATE_S1; state < ACPI_S_STATES_MAX+1; state++) {
+ if (ACPI_SUCCESS(AcpiGetSleepTypeData(state, &TypeA, &TypeB))) {
+ sprintf(sleep_state, "S%d ", state);
+ strcat(buf, sleep_state);
+ }
+ }
+ error = sysctl_handle_string(oidp, buf, sizeof(buf), req);
+ return(error);
+}
+
+static int
acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS)
{
char sleep_state[10];
OpenPOWER on IntegriCloud