aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_root.c
diff options
context:
space:
mode:
authorMatthew Garrett <matthew.garrett@nebula.com>2014-09-20 07:19:47 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-09-24 17:31:12 -0400
commit7bc5a2bad0b8d9d1ac9f7b8b33150e4ddf197334 (patch)
treea0dd3037aa6494c53edf89abb5e790f37a938d11 /drivers/acpi/pci_root.c
parent9faf6136ff4647452580b019f4b16f8c5082e589 (diff)
ACPI: Support _OSI("Darwin") correctly
Apple hardware queries _OSI("Darwin") in order to determine whether the system is running OS X, and changes firmware behaviour based on the answer. The most obvious difference in behaviour is that Thunderbolt hardware is forcibly powered down unless the system is running OS X. The obvious solution would be to simply add Darwin to the list of supported _OSI strings, but this causes problems. Recent Apple hardware includes two separate methods for checking _OSI strings. The first will check whether Darwin is supported, and if so will exit. The second will check whether Darwin is supported, but will then continue to check for further operating systems. If a further operating system is found then later firmware code will assume that the OS is not OS X. This results in the unfortunate situation where the Thunderbolt controller is available at boot time but remains powered down after suspend. The easiest way to handle this is to special-case it in the Linux-specific OSI handling code. If we see Darwin, we should answer true and then disable all other _OSI vendor strings. The next problem is that the Apple PCI _OSC method has the following code: if (LEqual (0x01, OSDW ())) if (LAnd (LEqual (Arg0, GUID), NEXP) (do stuff) else (fail) NEXP is a value in high memory and is presumably under the control of the firmware. No methods sets it. The methods that are called in the "do stuff" path are dummies. Unless there's some additional firmware call in early boot, there's no way for this call to succeed - and even if it does, it doesn't do anything. The easiest way to handle this is simply to ignore it. We know which flags would be set, so just set them by hand if the platform is running in Darwin mode. Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com> [andreas.noever@gmail.com: merged two patches, do not touch ACPICA] Signed-off-by: Andreas Noever <andreas.noever@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/pci_root.c')
-rw-r--r--drivers/acpi/pci_root.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index e6ae603ed1a1..cd4de7e038ea 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -35,6 +35,7 @@
35#include <linux/pci-aspm.h> 35#include <linux/pci-aspm.h>
36#include <linux/acpi.h> 36#include <linux/acpi.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/dmi.h>
38#include <acpi/apei.h> /* for acpi_hest_init() */ 39#include <acpi/apei.h> /* for acpi_hest_init() */
39 40
40#include "internal.h" 41#include "internal.h"
@@ -430,6 +431,19 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
430 acpi_handle handle = device->handle; 431 acpi_handle handle = device->handle;
431 432
432 /* 433 /*
434 * Apple always return failure on _OSC calls when _OSI("Darwin") has
435 * been called successfully. We know the feature set supported by the
436 * platform, so avoid calling _OSC at all
437 */
438
439 if (dmi_match(DMI_SYS_VENDOR, "Apple Inc.")) {
440 root->osc_control_set = ~OSC_PCI_EXPRESS_PME_CONTROL;
441 decode_osc_control(root, "OS assumes control of",
442 root->osc_control_set);
443 return;
444 }
445
446 /*
433 * All supported architectures that use ACPI have support for 447 * All supported architectures that use ACPI have support for
434 * PCI domains, so we indicate this in _OSC support capabilities. 448 * PCI domains, so we indicate this in _OSC support capabilities.
435 */ 449 */