From: deraadt Date: Sat, 21 Sep 2024 19:06:06 +0000 (+0000) Subject: We aren't ready to choose S0-over-S3 based upon the S0ix bit in FADT. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=20bdc91c785fb949f0d36715e4f9c8ac93a86082;p=openbsd We aren't ready to choose S0-over-S3 based upon the S0ix bit in FADT. Some machines which work great in S3, don't work great in S0. Some people want to be able to force S0, mostly for testing purposes (or to notice improvements as changes are made in the tree). Provide a TEMPORARY method via machdep.lidaction=-1 which will be S0-suspend while =1 remains S3 suspend. This button will not remain long-term, but for now, and during 7.6, it will be better than nothing. ok ratchov kettenis --- diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 0569461b97b..7f85f92cb88 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.296 2024/07/29 18:43:11 kettenis Exp $ */ +/* $OpenBSD: machdep.c,v 1.297 2024/09/21 19:06:07 deraadt Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -488,7 +488,7 @@ extern int amd64_has_xcrypt; extern int need_retpoline; const struct sysctl_bounded_args cpuctl_vars[] = { - { CPU_LIDACTION, &lid_action, 0, 2 }, + { CPU_LIDACTION, &lid_action, -1, 2 }, { CPU_PWRACTION, &pwr_action, 0, 2 }, { CPU_CPUID, &cpu_id, SYSCTL_INT_READONLY }, { CPU_CPUFEATURE, &cpu_feature, SYSCTL_INT_READONLY }, diff --git a/sys/dev/acpi/acpi_x86.c b/sys/dev/acpi/acpi_x86.c index 78b2f6af0cf..c3d5742c7ca 100644 --- a/sys/dev/acpi/acpi_x86.c +++ b/sys/dev/acpi/acpi_x86.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_x86.c,v 1.31 2024/08/31 15:53:44 deraadt Exp $ */ +/* $OpenBSD: acpi_x86.c,v 1.32 2024/09/21 19:06:06 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -32,12 +32,13 @@ sleep_showstate(void *v, int sleepmode) { struct acpi_softc *sc = v; int fallback_state = -1; + extern int lid_action; switch (sleepmode) { case SLEEP_SUSPEND: sc->sc_state = ACPI_STATE_S3; #ifdef __amd64__ - if (sc->sc_fadt->flags & FADT_POWER_S0_IDLE_CAPABLE) + if (lid_action == -1) sc->sc_state = ACPI_STATE_S0; fallback_state = ACPI_STATE_S0; /* No S3, use S0 */ #endif diff --git a/sys/dev/acpi/acpibtn.c b/sys/dev/acpi/acpibtn.c index ad1b8d1c856..8eca9772ac3 100644 --- a/sys/dev/acpi/acpibtn.c +++ b/sys/dev/acpi/acpibtn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpibtn.c,v 1.53 2024/08/06 17:38:56 kettenis Exp $ */ +/* $OpenBSD: acpibtn.c,v 1.54 2024/09/21 19:06:06 deraadt Exp $ */ /* * Copyright (c) 2005 Marco Peereboom * @@ -254,6 +254,7 @@ acpibtn_notify(struct aml_node *node, int notify_type, void *arg) switch (lid_action) { case 1: + case -1: goto sleep; #ifdef HIBERNATE case 2: