From 159a3e96ea19197fc57448ff64e3d913d4c0ac71 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sun, 18 Aug 2024 02:53:08 +0000 Subject: [PATCH] If FADT indicates FADT_POWER_S0_IDLE_CAPABLE, print "S0ix" instead of "S0" on the acpi: sleep states line. (In my view, this flag-bit announces that the hardware vendor + bios vendor + microsoft have agreed this machine has enough "features" that S0 suspend is about as good or better than S3, for various criteria). ok kettenis mlarkin --- sys/dev/acpi/acpi.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index de66b0a45b7..5da2524cb75 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.437 2024/08/10 23:28:17 deraadt Exp $ */ +/* $OpenBSD: acpi.c,v 1.438 2024/08/18 02:53:08 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -2502,16 +2502,19 @@ acpi_init_states(struct acpi_softc *sc) snprintf(name, sizeof(name), "_S%d_", i); sc->sc_sleeptype[i].slp_typa = -1; sc->sc_sleeptype[i].slp_typb = -1; - if (aml_evalname(sc, sc->sc_root, name, 0, NULL, &res) == 0) { - if (res.type == AML_OBJTYPE_PACKAGE) { - sc->sc_sleeptype[i].slp_typa = - aml_val2int(res.v_package[0]); - sc->sc_sleeptype[i].slp_typb = - aml_val2int(res.v_package[1]); - printf(" S%d", i); - } + if (aml_evalname(sc, sc->sc_root, name, 0, NULL, &res) != 0) + continue; + if (res.type != AML_OBJTYPE_PACKAGE) { aml_freevalue(&res); + continue; } + sc->sc_sleeptype[i].slp_typa = aml_val2int(res.v_package[0]); + sc->sc_sleeptype[i].slp_typb = aml_val2int(res.v_package[1]); + aml_freevalue(&res); + + printf(" S%d", i); + if (i == 0 && (sc->sc_fadt->flags & FADT_POWER_S0_IDLE_CAPABLE)) + printf("ix"); } } -- 2.20.1