summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/acpi_machdep.c20
-rw-r--r--sys/arch/i386/i386/acpi_machdep.c18
-rw-r--r--sys/kern/subr_suspend.c14
3 files changed, 32 insertions, 20 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c
index 75c0b5d0482..c0cd38c7558 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.96 2022/02/09 23:54:32 deraadt Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.97 2022/02/10 16:41:51 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -429,18 +429,18 @@ acpi_sleep_cpu(struct acpi_softc *sc, int state)
DEVNAME(sc));
return (ECANCELED);
}
+
+ /*
+ * XXX
+ * Flag to disk drivers that they should "power down" the disk
+ * when we get to DVACT_POWERDOWN.
+ */
+ boothowto |= RB_POWERDOWN;
+ config_suspend_all(DVACT_POWERDOWN);
+ boothowto &= ~RB_POWERDOWN;
}
#endif
- /*
- * XXX
- * Flag to disk drivers that they should "power down" the disk
- * when we get to DVACT_POWERDOWN.
- */
- boothowto |= RB_POWERDOWN;
- config_suspend_all(DVACT_POWERDOWN);
- boothowto &= ~RB_POWERDOWN;
-
acpi_sleep_pm(sc, state);
printf("%s: acpi_sleep_pm failed", DEVNAME(sc));
return (ECANCELED);
diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c
index 75c5b9f875d..bf415cd46bc 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.78 2022/02/09 23:54:34 deraadt Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.79 2022/02/10 16:41:53 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -390,17 +390,17 @@ acpi_sleep_cpu(struct acpi_softc *sc, int state)
DEVNAME(sc));
return (ECANCELED);
}
+
+ /* XXX
+ * Flag to disk drivers that they should "power down" the disk
+ * when we get to DVACT_POWERDOWN.
+ */
+ boothowto |= RB_POWERDOWN;
+ config_suspend_all(DVACT_POWERDOWN);
+ boothowto &= ~RB_POWERDOWN;
}
#endif
- /* XXX
- * Flag to disk drivers that they should "power down" the disk
- * when we get to DVACT_POWERDOWN.
- */
- boothowto |= RB_POWERDOWN;
- config_suspend_all(DVACT_POWERDOWN);
- boothowto &= ~RB_POWERDOWN;
-
acpi_sleep_pm(sc, state);
printf("%s: acpi_sleep_pm failed", DEVNAME(sc));
return (ECANCELED);
diff --git a/sys/kern/subr_suspend.c b/sys/kern/subr_suspend.c
index f92ee7d399c..84ea1b7412c 100644
--- a/sys/kern/subr_suspend.c
+++ b/sys/kern/subr_suspend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_suspend.c,v 1.1 2022/02/08 17:25:12 deraadt Exp $ */
+/* $OpenBSD: subr_suspend.c,v 1.2 2022/02/10 16:41:53 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -21,6 +21,7 @@
#include <sys/buf.h>
#include <sys/malloc.h>
#include <sys/pool.h>
+#include <sys/reboot.h>
#include <sys/proc.h>
#include <sys/sensors.h>
#include <sys/sysctl.h>
@@ -109,6 +110,17 @@ sleep_state(void *v, int sleepmode)
if (sleep_setstate(v))
goto fail_pts;
+ if (sleepmode == SLEEP_SUSPEND) {
+ /*
+ * XXX
+ * Flag to disk drivers that they should "power down" the disk
+ * when we get to DVACT_POWERDOWN.
+ */
+ boothowto |= RB_POWERDOWN;
+ config_suspend_all(DVACT_POWERDOWN);
+ boothowto &= ~RB_POWERDOWN;
+ }
+
gosleep(v);
#ifdef HIBERNATE