summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2024-07-29 18:43:12 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2024-07-29 18:43:12 +0000
commit7aae674a2d7a76d45b44db7463ff372a7d5587ad (patch)
tree04221f72515de8abede4c990986978f87ccf06ff /sys
parent2fc3f525a558a776b164e80cf7a7b133a0f8262f (diff)
Set the target ACPI to S5 when we're powering down the machine. Prevents
us from trying to put devices into the D3 power state which some hardware doesn't appreciate. ok ratchov@, deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/machdep.c8
-rw-r--r--sys/arch/i386/i386/machdep.c8
2 files changed, 14 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 66cdafb5e54..0569461b97b 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.295 2024/06/26 01:40:49 jsg Exp $ */
+/* $OpenBSD: machdep.c,v 1.296 2024/07/29 18:43:11 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -116,6 +116,7 @@ extern int db_console;
#include "acpi.h"
#if NACPI > 0
+#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
#endif
@@ -881,6 +882,11 @@ struct pcb dumppcb;
__dead void
boot(int howto)
{
+#if NACPI > 0
+ if ((howto & RB_POWERDOWN) != 0 && acpi_softc)
+ acpi_softc->sc_state = ACPI_STATE_S5;
+#endif
+
if ((howto & RB_POWERDOWN) != 0)
lid_action = 0;
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index a15b37a78af..cc766289fad 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.673 2024/07/09 07:28:12 mlarkin Exp $ */
+/* $OpenBSD: machdep.c,v 1.674 2024/07/29 18:43:11 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -115,6 +115,7 @@
#include "acpi.h"
#if NACPI > 0
+#include <dev/acpi/acpireg.h>
#include <dev/acpi/acpivar.h>
#endif
@@ -2598,6 +2599,11 @@ struct pcb dumppcb;
__dead void
boot(int howto)
{
+#if NACPI > 0
+ if ((howto & RB_POWERDOWN) != 0 && acpi_softc)
+ acpi_softc->sc_state = ACPI_STATE_S5;
+#endif
+
if ((howto & RB_POWERDOWN) != 0)
lid_action = 0;