summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJoshua Stein <jcs@cvs.openbsd.org>2017-02-16 18:02:23 +0000
committerJoshua Stein <jcs@cvs.openbsd.org>2017-02-16 18:02:23 +0000
commit6b768fa10e2b179065ecbdc755499e8962b6de81 (patch)
tree7b2dc04ad178781aefc01245e6750594f1c17cd4 /sys/dev
parentf3b70a9db51540f34842fd49d39d899b7147f3b0 (diff)
On Apple hardware, claim an OSI of Darwin and no other OSes
The DSDT on at MacBooks takes many different and beneficial code paths when the OS reports to be Darwin, but due to the way it checks OSI, we can't just add Darwin to the aml_valid_osi array since later checks for Windows variants will supersede the Darwin check. Fixes suspend and keeps Thunderbolt ports powered up after resume. One regression is that the acpibat driver no longer attaches and will require an ACPI Smart Battery driver, which is in the works. Adapted from a similar change in the Linux kernel from 2014. ok deraadt
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/dsdt.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index 16102230779..02a3e15ceac 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.230 2017/01/14 11:32:00 kettenis Exp $ */
+/* $OpenBSD: dsdt.c,v 1.231 2017/02/16 18:02:22 jcs Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -106,6 +106,8 @@ void _aml_die(const char *fn, int line, const char *fmt, ...);
void aml_notify_task(void *, int);
void acpi_poll_notify_task(void *, int);
+extern char *hw_vendor;
+
/*
* @@@: Global variables
*/
@@ -1505,6 +1507,21 @@ aml_callosi(struct aml_scope *scope, struct aml_value *val)
struct aml_value *fa;
fa = aml_getstack(scope, AMLOP_ARG0);
+
+ if (hw_vendor != NULL &&
+ (strcmp(hw_vendor, "Apple Inc.") == 0 ||
+ strcmp(hw_vendor, "Apple Computer, Inc.") == 0)) {
+ if (strcmp(fa->v_string, "Darwin") == 0) {
+ dnprintf(10,"osi: returning 1 for %s on %s hardware\n",
+ fa->v_string, hw_vendor);
+ result = 1;
+ } else
+ dnprintf(10,"osi: on %s hardware, but ignoring %s\n",
+ hw_vendor, fa->v_string);
+
+ return aml_allocvalue(AML_OBJTYPE_INTEGER, result, NULL);
+ }
+
for (idx=0; !result && aml_valid_osi[idx] != NULL; idx++) {
dnprintf(10,"osi: %s,%s\n", fa->v_string, aml_valid_osi[idx]);
result = !strcmp(fa->v_string, aml_valid_osi[idx]);