From: Chen Yu <yu.c.chen@intel.com>
To: linux-acpi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, rjw@rjwysocki.net, lenb@kernel.org,
matthew.garrett@nebula.com, andy.shevchenko@gmail.com,
Chen Yu <yu.c.chen@intel.com>
Subject: [PATCH][v3] ACPI: Do not report _OSI("Darwin") when acpi_osi=!Darwin provided
Date: Tue, 2 Feb 2016 09:41:18 +0800 [thread overview]
Message-ID: <1454377278-3398-1-git-send-email-yu.c.chen@intel.com> (raw)
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>
---
v3:
- Simplify acpi_osi_setup_disabled suggested by Andy Shevchenko.
v2:
- Convert osi_setup_entries to non-initdata variable, to
eliminate the warning from 0-DAY test infrastructure.
---
drivers/acpi/osl.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 67da6fb..8bb3a93 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;
@@ -1688,13 +1691,30 @@ struct osi_setup_entry {
};
static struct osi_setup_entry
- osi_setup_entries[OSI_STRING_ENTRIES_MAX] __initdata = {
+ osi_setup_entries[OSI_STRING_ENTRIES_MAX] = {
{"Module Device", true},
{"Processor Device", true},
{"3.0 _SCP Extensions", true},
{"Processor Aggregator Device", true},
};
+static bool acpi_osi_setup_disabled(char *str)
+{
+ int i;
+ struct osi_setup_entry *osi;
+
+ if (str == NULL || *str == '\0')
+ return false;
+
+ for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
+ osi = &osi_setup_entries[i];
+ if (!strcmp(osi->string, str))
+ return !osi->enable;
+ }
+
+ return false;
+}
+
void __init acpi_osi_setup(char *str)
{
struct osi_setup_entry *osi;
--
1.8.4.2
next reply other threads:[~2016-02-02 1:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 1:41 Chen Yu [this message]
2016-02-22 7:57 ` [PATCH][v3] ACPI: Do not report _OSI("Darwin") when acpi_osi=!Darwin provided Zheng, Lv
2016-02-22 7:59 ` Chen, Yu C
2016-02-22 8:55 ` Zheng, Lv
2016-03-14 14:17 ` Chen, Yu C
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454377278-3398-1-git-send-email-yu.c.chen@intel.com \
--to=yu.c.chen@intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.garrett@nebula.com \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).