summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpi/acpi.c
diff options
context:
space:
mode:
authormlarkin <mlarkin@openbsd.org>2012-03-29 06:57:02 +0000
committermlarkin <mlarkin@openbsd.org>2012-03-29 06:57:02 +0000
commit2a50cb0402fed5fe4d2374ca385f5fc4e91c6bb2 (patch)
treef2a65117d9120a5eb0ee60a97fb504d2672128c2 /sys/dev/acpi/acpi.c
parentAdd ecoff as possible targets for the mips ports, to be able to muild (diff)
downloadwireguard-openbsd-2a50cb0402fed5fe4d2374ca385f5fc4e91c6bb2.tar.xz
wireguard-openbsd-2a50cb0402fed5fe4d2374ca385f5fc4e91c6bb2.zip
Prevent hibernation attempts on machines with unsupported disk controllers.
The same check is also performed later in the hibernate sequence, but by then it's too late to cleanly unwind (presently). ok deraadt
Diffstat (limited to 'sys/dev/acpi/acpi.c')
-rw-r--r--sys/dev/acpi/acpi.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index f4f7424e525..d471cf387f6 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.230 2012/03/26 20:32:50 deraadt Exp $ */
+/* $OpenBSD: acpi.c,v 1.231 2012/03/29 06:57:02 mlarkin Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -30,6 +30,7 @@
#include <sys/workq.h>
#include <sys/sched.h>
#include <sys/reboot.h>
+#include <sys/hibernate.h>
#include <machine/conf.h>
#include <machine/cpufunc.h>
@@ -2518,8 +2519,13 @@ acpiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
if ((flag & FWRITE) == 0) {
error = EBADF;
} else {
- acpi_addtask(sc, acpi_sleep_task, sc, ACPI_STATE_S4);
- acpi_wakeup(sc);
+ if (get_hibernate_io_function() == NULL) {
+ error = EOPNOTSUPP;
+ } else {
+ acpi_addtask(sc, acpi_sleep_task, sc,
+ ACPI_STATE_S4);
+ acpi_wakeup(sc);
+ }
}
break;
#endif