summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2022-02-17 17:17:12 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2022-02-17 17:17:12 +0000
commite7341693bb5de06b9afa82002cff8a1fa05e6653 (patch)
treebf263f54af0e9cfb34c8763aed776f247e11a853
parentc3e4dda09bac671b687ab2472e2b9f61b31f1fb6 (diff)
If S4 is not available, use S5 for the ACPI-transitions in hibernate support.
A bunch of servers work now. Really close to a 3-line diff... ok kettenis
-rw-r--r--sys/arch/amd64/amd64/acpi_machdep.c4
-rw-r--r--sys/arch/i386/i386/acpi_machdep.c4
-rw-r--r--sys/dev/acpi/acpi_x86.c7
3 files changed, 9 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c
index e119de143f1..9630237171b 100644
--- a/sys/arch/amd64/amd64/acpi_machdep.c
+++ b/sys/arch/amd64/amd64/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.100 2022/02/13 15:56:55 deraadt Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.101 2022/02/17 17:17:11 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -414,7 +414,7 @@ acpi_sleep_cpu(struct acpi_softc *sc, int state)
wbinvd();
#ifdef HIBERNATE
- if (state == ACPI_STATE_S4) {
+ if (state == ACPI_STATE_S4 || state == ACPI_STATE_S5) {
if (hibernate_suspend()) {
printf("%s: hibernate_suspend failed\n",
DEVNAME(sc));
diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c
index 436a0d0321c..1bb162608f1 100644
--- a/sys/arch/i386/i386/acpi_machdep.c
+++ b/sys/arch/i386/i386/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.82 2022/02/13 15:56:55 deraadt Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.83 2022/02/17 17:17:11 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -376,7 +376,7 @@ acpi_sleep_cpu(struct acpi_softc *sc, int state)
wbinvd();
#ifdef HIBERNATE
- if (state == ACPI_STATE_S4) {
+ if (state == ACPI_STATE_S4 || state == ACPI_STATE_S5) {
if (hibernate_suspend()) {
printf("%s: hibernate_suspend failed\n",
DEVNAME(sc));
diff --git a/sys/dev/acpi/acpi_x86.c b/sys/dev/acpi/acpi_x86.c
index efde7ef28e4..25e09a49504 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.12 2022/02/17 00:47:47 jsg Exp $ */
+/* $OpenBSD: acpi_x86.c,v 1.13 2022/02/17 17:17:09 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -47,7 +47,10 @@ sleep_showstate(void *v, int sleepmode)
sc->sc_sleeptype[sc->sc_state].slp_typb == -1) {
printf("%s: state S%d unavailable\n",
sc->sc_dev.dv_xname, sc->sc_state);
- return (EOPNOTSUPP);
+ if (sc->sc_state == ACPI_STATE_S4)
+ sc->sc_state = ACPI_STATE_S5; /* No S4, use S5 */
+ else
+ return (EOPNOTSUPP);
}
/* 1st suspend AML step: _TTS(tostate) */