summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/osl.c
diff options
context:
space:
mode:
authorChen Yu <yu.c.chen@intel.com>2016-05-03 16:48:39 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-05-05 00:13:52 +0200
commite10cfdc33a0f23dc8449be7267f0a642e96a2a24 (patch)
tree8eb360b24f377a9c3ec5428b3fb8a1467e419621 /drivers/acpi/osl.c
parenta707edebadf1230f202000f29b28b7586ada4aa3 (diff)
downloadlinux-stable-e10cfdc33a0f23dc8449be7267f0a642e96a2a24.tar.gz
linux-stable-e10cfdc33a0f23dc8449be7267f0a642e96a2a24.tar.bz2
linux-stable-e10cfdc33a0f23dc8449be7267f0a642e96a2a24.zip
ACPI / osi: Fix default _OSI(Darwin) support
The following commit always reports positive value when Apple hardware queries _OSI("Darwin"): Commit: 7bc5a2bad0b8d9d1ac9f7b8b33150e4ddf197334 Subject: ACPI: Support _OSI("Darwin") correctly However since this implementation places the judgement in runtime, it breaks acpi_osi=!Darwin and cannot return unsupported for _OSI("WinXXX") invoked before invoking _OSI("Darwin"). This patch fixes the issues by reverting the wrong support and implementing the default behavior of _OSI("Darwin")/_OSI("WinXXX") on Apple hardware via DMI matching. Fixes: 7bc5a2bad0b8 (ACPI: Support _OSI("Darwin") correctly) Link: https://bugzilla.kernel.org/show_bug.cgi?id=92111 Reported-and-tested-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Chen Yu <yu.c.chen@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/osl.c')
-rw-r--r--drivers/acpi/osl.c58
1 files changed, 51 insertions, 7 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index f801b59f2a94..1b84e4635ae0 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -135,6 +135,9 @@ static struct acpi_osi_config {
unsigned int linux_enable:1;
unsigned int linux_dmi:1;
unsigned int linux_cmdline:1;
+ unsigned int darwin_enable:1;
+ unsigned int darwin_dmi:1;
+ unsigned int darwin_cmdline:1;
u8 default_disabling;
} osi_config = {0, 0, 0, 0};
@@ -150,13 +153,12 @@ static u32 acpi_osi_handler(acpi_string interface, u32 supported)
}
if (!strcmp("Darwin", interface)) {
- /*
- * Apple firmware will behave poorly if it receives positive
- * answers to "Darwin" and any other OS. Respond positively
- * to Darwin and then disable all other vendor strings.
- */
- acpi_update_interfaces(ACPI_DISABLE_ALL_VENDOR_STRINGS);
- supported = ACPI_UINT32_MAX;
+
+ printk_once(KERN_NOTICE PREFIX
+ "BIOS _OSI(Darwin) query %s%s\n",
+ osi_config.darwin_enable ? "honored" : "ignored",
+ osi_config.darwin_cmdline ? " via cmdline" :
+ osi_config.darwin_dmi ? " via DMI" : "");
}
return supported;
@@ -1783,6 +1785,44 @@ void __init acpi_osi_setup(char *str)
}
}
+static void __init set_osi_darwin(unsigned int enable)
+{
+ if (osi_config.darwin_enable != enable)
+ osi_config.darwin_enable = enable;
+
+ if (enable) {
+ acpi_osi_setup("!");
+ acpi_osi_setup("Darwin");
+ } else {
+ acpi_osi_setup("!!");
+ acpi_osi_setup("!Darwin");
+ }
+}
+
+static void __init acpi_cmdline_osi_darwin(unsigned int enable)
+{
+ /* cmdline set the default and override DMI */
+ osi_config.darwin_cmdline = 1;
+ osi_config.darwin_dmi = 0;
+ set_osi_darwin(enable);
+
+ return;
+}
+
+void __init acpi_dmi_osi_darwin(int enable, const struct dmi_system_id *d)
+{
+ printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
+
+ if (enable == -1)
+ return;
+
+ /* DMI knows that this box asks OSI(Darwin) */
+ osi_config.darwin_dmi = 1;
+ set_osi_darwin(enable);
+
+ return;
+}
+
static void __init set_osi_linux(unsigned int enable)
{
if (osi_config.linux_enable != enable)
@@ -1870,6 +1910,10 @@ static int __init osi_setup(char *str)
acpi_cmdline_osi_linux(1);
else if (str && !strcmp("!Linux", str))
acpi_cmdline_osi_linux(0);
+ else if (str && !strcmp("Darwin", str))
+ acpi_cmdline_osi_darwin(1);
+ else if (str && !strcmp("!Darwin", str))
+ acpi_cmdline_osi_darwin(0);
else
acpi_osi_setup(str);