treewide: Consolidate Apple DMI checks
authorLukas Wunner <lukas@wunner.de>
Tue, 1 Aug 2017 12:10:41 +0000 (14:10 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 3 Aug 2017 21:26:22 +0000 (23:26 +0200)
commit630b3aff8a51c90ef15b59c9560ac35e40e7ec09
treebeaf70e4289cdc2a931d5c6d6e54e94dadb5b127
parent16f73eb02d7e1765ccab3d2018e0bd98eb93d973
treewide: Consolidate Apple DMI checks

We're about to amend ACPI bus scan with DMI checks whether we're running
on a Mac to support Apple device properties in AML.  The DMI checks are
performed for every single device, adding overhead for everything x86
that isn't Apple, which is the majority.  Rafael and Andy therefore
request to perform the DMI match only once and cache the result.

Outside of ACPI various other Apple DMI checks exist and it seems
reasonable to use the cached value there as well.  Rafael, Andy and
Darren suggest performing the DMI check in arch code and making it
available with a header in include/linux/platform_data/x86/.

To this end, add early_platform_quirks() to arch/x86/kernel/quirks.c
to perform the DMI check and invoke it from setup_arch().  Switch over
all existing Apple DMI checks, thereby fixing two deficiencies:

* They are now #defined to false on non-x86 arches and can thus be
  optimized away if they're located in cross-arch code.

* Some of them only match "Apple Inc." but not "Apple Computer, Inc.",
  which is used by BIOSes released between January 2006 (when the first
  x86 Macs started shipping) and January 2007 (when the company name
  changed upon introduction of the iPhone).

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Suggested-by: Darren Hart <dvhart@infradead.org>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
12 files changed:
arch/x86/include/asm/setup.h
arch/x86/kernel/early-quirks.c
arch/x86/kernel/quirks.c
arch/x86/kernel/setup.c
drivers/acpi/osi.c
drivers/acpi/pci_root.c
drivers/acpi/sbs.c
drivers/firmware/efi/apple-properties.c
drivers/pci/quirks.c
drivers/thunderbolt/icm.c
drivers/thunderbolt/tb.c
include/linux/platform_data/x86/apple.h [new file with mode: 0644]