summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjcs <jcs@openbsd.org>2017-02-16 18:02:22 +0000
committerjcs <jcs@openbsd.org>2017-02-16 18:02:22 +0000
commit75125fcc0f364234d10d138e4225f90ccee2130b (patch)
treeca26acb4dcb49cdb376d36196e1e9d57c2329f67
parentSurprisingly, groff does not support scaling units in .Bl -column (diff)
downloadwireguard-openbsd-75125fcc0f364234d10d138e4225f90ccee2130b.tar.xz
wireguard-openbsd-75125fcc0f364234d10d138e4225f90ccee2130b.zip
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
-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]);