Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1322664 > unrolled thread

[PATCH] ACPI: Do not report _OSI("Darwin") when acpi_osi=!Darwin provided

Started byChen Yu <yu.c.chen@intel.com>
First post2016-01-31 15:50 +0100
Last post2016-01-31 17:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ACPI: Do not report _OSI("Darwin") when acpi_osi=!Darwin provided Chen Yu <yu.c.chen@intel.com> - 2016-01-31 15:50 +0100
    Re: [PATCH] ACPI: Do not report _OSI("Darwin") when acpi_osi=!Darwin  provided kbuild test robot <lkp@intel.com> - 2016-01-31 17:00 +0100

#1322664 — [PATCH] ACPI: Do not report _OSI("Darwin") when acpi_osi=!Darwin provided

FromChen Yu <yu.c.chen@intel.com>
Date2016-01-31 15:50 +0100
Subject[PATCH] ACPI: Do not report _OSI("Darwin") when acpi_osi=!Darwin provided
Message-ID<qX1u9-4Gz-3@gated-at.bofh.it>
Commit 7bc5a2bad0b8 ("ACPI: Support _OSI("Darwin") correctly") always
reports positive value when Apple hardware queries _OSI("Darwin").
But sometimes the users might want to tell the hardware they don't
need the Darwin feature, for example, users may leverage the hardware
to power off the Thunderbolt, by appending acpi_osi=!Darwin in command
line, thus Apple hardware regards it as an incompatible OS X system,
hence turns off the Thunderbolt.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=92111
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
 drivers/acpi/osl.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 67da6fb..f945d54 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -97,6 +97,7 @@ static LIST_HEAD(acpi_ioremaps);
 static DEFINE_MUTEX(acpi_ioremap_lock);
 
 static void __init acpi_osi_setup_late(void);
+static bool acpi_osi_setup_disabled(char *str);
 
 /*
  * The story of _OSI(Linux)
@@ -149,11 +150,13 @@ static u32 acpi_osi_handler(acpi_string interface, u32 supported)
 			osi_linux.dmi ? " via DMI" : "");
 	}
 
-	if (!strcmp("Darwin", interface)) {
+	if (!strcmp("Darwin", interface) &&
+	    !acpi_osi_setup_disabled(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.
+		 * to Darwin and then disable all other vendor strings if
+		 * acpi_osi="!Darwin" is not appended in cmdline.
 		 */
 		acpi_update_interfaces(ACPI_DISABLE_ALL_VENDOR_STRINGS);
 		supported = ACPI_UINT32_MAX;
@@ -1695,6 +1698,27 @@ static struct osi_setup_entry
 	{"Processor Aggregator Device", true},
 };
 
+static bool acpi_osi_setup_disabled(char *str)
+{
+	int i;
+	struct osi_setup_entry *osi;
+
+	if (!str)
+		return false;
+
+	for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
+		osi = &osi_setup_entries[i];
+		if (!strcmp(osi->string, str)) {
+			if (!osi->enable)
+				return true;
+			else
+				return false;
+		}
+	}
+
+	return false;
+}
+
 void __init acpi_osi_setup(char *str)
 {
 	struct osi_setup_entry *osi;
-- 
1.8.4.2

[toc] | [next] | [standalone]


#1322672 — Re: [PATCH] ACPI: Do not report _OSI("Darwin") when acpi_osi=!Darwin provided

Fromkbuild test robot <lkp@intel.com>
Date2016-01-31 17:00 +0100
SubjectRe: [PATCH] ACPI: Do not report _OSI("Darwin") when acpi_osi=!Darwin provided
Message-ID<qX2zV-5ra-27@gated-at.bofh.it>
In reply to#1322664

[Multipart message — attachments visible in raw view] — view raw

Hi Chen,

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v4.5-rc1 next-20160129]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Chen-Yu/ACPI-Do-not-report-_OSI-Darwin-when-acpi_osi-Darwin-provided/20160131-224855
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: i386-randconfig-s0-201605 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

>> WARNING: vmlinux.o(.text+0x6d5828): Section mismatch in reference from the function acpi_osi_handler() to the variable .init.data:osi_setup_entries
   The function acpi_osi_handler() references
   the variable __initdata osi_setup_entries.
   This is often because acpi_osi_handler lacks a __initdata
   annotation or the annotation of osi_setup_entries is wrong.
--
>> WARNING: vmlinux.o(.text+0x6d5872): Section mismatch in reference from the function acpi_osi_handler() to the (unknown reference) .init.data:(unknown)
   The function acpi_osi_handler() references
   the (unknown reference) __initdata (unknown).
   This is often because acpi_osi_handler lacks a __initdata
   annotation or the annotation of (unknown) is wrong.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web