xref: /linux/drivers/acpi/osi.c (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1c942fddfSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2e5f660ebSLv Zheng /*
3e5f660ebSLv Zheng  *  osi.c - _OSI implementation
4e5f660ebSLv Zheng  *
5e5f660ebSLv Zheng  *  Copyright (C) 2016 Intel Corporation
6e5f660ebSLv Zheng  *    Author: Lv Zheng <lv.zheng@intel.com>
7e5f660ebSLv Zheng  */
8e5f660ebSLv Zheng 
9e5f660ebSLv Zheng /* Uncomment next line to get verbose printout */
10e5f660ebSLv Zheng /* #define DEBUG */
11e5f660ebSLv Zheng #define pr_fmt(fmt) "ACPI: " fmt
12e5f660ebSLv Zheng 
13e5f660ebSLv Zheng #include <linux/module.h>
14e5f660ebSLv Zheng #include <linux/kernel.h>
15e5f660ebSLv Zheng #include <linux/acpi.h>
16e5f660ebSLv Zheng #include <linux/dmi.h>
17630b3affSLukas Wunner #include <linux/platform_data/x86/apple.h>
18e5f660ebSLv Zheng 
19e5f660ebSLv Zheng #include "internal.h"
20e5f660ebSLv Zheng 
21e5f660ebSLv Zheng 
22e5f660ebSLv Zheng #define OSI_STRING_LENGTH_MAX	64
23e5f660ebSLv Zheng #define OSI_STRING_ENTRIES_MAX	16
24e5f660ebSLv Zheng 
25e5f660ebSLv Zheng struct acpi_osi_entry {
26e5f660ebSLv Zheng 	char string[OSI_STRING_LENGTH_MAX];
27e5f660ebSLv Zheng 	bool enable;
28e5f660ebSLv Zheng };
29e5f660ebSLv Zheng 
30e5f660ebSLv Zheng static struct acpi_osi_config {
31e5f660ebSLv Zheng 	u8		default_disabling;
32e5f660ebSLv Zheng 	unsigned int	linux_enable:1;
33e5f660ebSLv Zheng 	unsigned int	linux_dmi:1;
34e5f660ebSLv Zheng 	unsigned int	linux_cmdline:1;
35e5f660ebSLv Zheng 	unsigned int	darwin_enable:1;
36e5f660ebSLv Zheng 	unsigned int	darwin_dmi:1;
37e5f660ebSLv Zheng 	unsigned int	darwin_cmdline:1;
38e5f660ebSLv Zheng } osi_config;
39e5f660ebSLv Zheng 
40e5f660ebSLv Zheng static struct acpi_osi_config osi_config;
41e5f660ebSLv Zheng static struct acpi_osi_entry
42e5f660ebSLv Zheng osi_setup_entries[OSI_STRING_ENTRIES_MAX] __initdata = {
43e5f660ebSLv Zheng 	{"Module Device", true},
44e5f660ebSLv Zheng 	{"Processor Device", true},
45e5f660ebSLv Zheng 	{"3.0 _SCP Extensions", true},
46e5f660ebSLv Zheng 	{"Processor Aggregator Device", true},
47e5f660ebSLv Zheng };
48e5f660ebSLv Zheng 
acpi_osi_handler(acpi_string interface,u32 supported)49e5f660ebSLv Zheng static u32 acpi_osi_handler(acpi_string interface, u32 supported)
50e5f660ebSLv Zheng {
51e5f660ebSLv Zheng 	if (!strcmp("Linux", interface)) {
52e5f660ebSLv Zheng 		pr_notice_once(FW_BUG
53e5f660ebSLv Zheng 			"BIOS _OSI(Linux) query %s%s\n",
54e5f660ebSLv Zheng 			osi_config.linux_enable ? "honored" : "ignored",
55e5f660ebSLv Zheng 			osi_config.linux_cmdline ? " via cmdline" :
56e5f660ebSLv Zheng 			osi_config.linux_dmi ? " via DMI" : "");
57e5f660ebSLv Zheng 	}
58e5f660ebSLv Zheng 	if (!strcmp("Darwin", interface)) {
59e5f660ebSLv Zheng 		pr_notice_once(
60e5f660ebSLv Zheng 			"BIOS _OSI(Darwin) query %s%s\n",
61e5f660ebSLv Zheng 			osi_config.darwin_enable ? "honored" : "ignored",
62e5f660ebSLv Zheng 			osi_config.darwin_cmdline ? " via cmdline" :
63e5f660ebSLv Zheng 			osi_config.darwin_dmi ? " via DMI" : "");
64e5f660ebSLv Zheng 	}
65e5f660ebSLv Zheng 
66e5f660ebSLv Zheng 	return supported;
67e5f660ebSLv Zheng }
68e5f660ebSLv Zheng 
acpi_osi_setup(char * str)69e5f660ebSLv Zheng void __init acpi_osi_setup(char *str)
70e5f660ebSLv Zheng {
71e5f660ebSLv Zheng 	struct acpi_osi_entry *osi;
72e5f660ebSLv Zheng 	bool enable = true;
73e5f660ebSLv Zheng 	int i;
74e5f660ebSLv Zheng 
75e5f660ebSLv Zheng 	if (!acpi_gbl_create_osi_method)
76e5f660ebSLv Zheng 		return;
77e5f660ebSLv Zheng 
78e5f660ebSLv Zheng 	if (str == NULL || *str == '\0') {
79e5f660ebSLv Zheng 		pr_info("_OSI method disabled\n");
80e5f660ebSLv Zheng 		acpi_gbl_create_osi_method = FALSE;
81e5f660ebSLv Zheng 		return;
82e5f660ebSLv Zheng 	}
83e5f660ebSLv Zheng 
84e5f660ebSLv Zheng 	if (*str == '!') {
85e5f660ebSLv Zheng 		str++;
86e5f660ebSLv Zheng 		if (*str == '\0') {
87e5f660ebSLv Zheng 			/* Do not override acpi_osi=!* */
88e5f660ebSLv Zheng 			if (!osi_config.default_disabling)
89e5f660ebSLv Zheng 				osi_config.default_disabling =
90e5f660ebSLv Zheng 					ACPI_DISABLE_ALL_VENDOR_STRINGS;
91e5f660ebSLv Zheng 			return;
92e5f660ebSLv Zheng 		} else if (*str == '*') {
93e5f660ebSLv Zheng 			osi_config.default_disabling = ACPI_DISABLE_ALL_STRINGS;
94e5f660ebSLv Zheng 			for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
95e5f660ebSLv Zheng 				osi = &osi_setup_entries[i];
96e5f660ebSLv Zheng 				osi->enable = false;
97e5f660ebSLv Zheng 			}
98e5f660ebSLv Zheng 			return;
99e5f660ebSLv Zheng 		} else if (*str == '!') {
100e5f660ebSLv Zheng 			osi_config.default_disabling = 0;
101e5f660ebSLv Zheng 			return;
102e5f660ebSLv Zheng 		}
103e5f660ebSLv Zheng 		enable = false;
104e5f660ebSLv Zheng 	}
105e5f660ebSLv Zheng 
106e5f660ebSLv Zheng 	for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
107e5f660ebSLv Zheng 		osi = &osi_setup_entries[i];
108e5f660ebSLv Zheng 		if (!strcmp(osi->string, str)) {
109e5f660ebSLv Zheng 			osi->enable = enable;
110e5f660ebSLv Zheng 			break;
111e5f660ebSLv Zheng 		} else if (osi->string[0] == '\0') {
112e5f660ebSLv Zheng 			osi->enable = enable;
113*f1fce1cfSJustin Stitt 			strscpy(osi->string, str, OSI_STRING_LENGTH_MAX);
114e5f660ebSLv Zheng 			break;
115e5f660ebSLv Zheng 		}
116e5f660ebSLv Zheng 	}
117e5f660ebSLv Zheng }
118e5f660ebSLv Zheng 
__acpi_osi_setup_darwin(bool enable)119e5f660ebSLv Zheng static void __init __acpi_osi_setup_darwin(bool enable)
120e5f660ebSLv Zheng {
121e5f660ebSLv Zheng 	osi_config.darwin_enable = !!enable;
122e5f660ebSLv Zheng 	if (enable) {
123e5f660ebSLv Zheng 		acpi_osi_setup("!");
124e5f660ebSLv Zheng 		acpi_osi_setup("Darwin");
125e5f660ebSLv Zheng 	} else {
126e5f660ebSLv Zheng 		acpi_osi_setup("!!");
127e5f660ebSLv Zheng 		acpi_osi_setup("!Darwin");
128e5f660ebSLv Zheng 	}
129e5f660ebSLv Zheng }
130e5f660ebSLv Zheng 
acpi_osi_setup_darwin(bool enable)131e5f660ebSLv Zheng static void __init acpi_osi_setup_darwin(bool enable)
132e5f660ebSLv Zheng {
133e5f660ebSLv Zheng 	/* Override acpi_osi_dmi_blacklisted() */
134e5f660ebSLv Zheng 	osi_config.darwin_dmi = 0;
135e5f660ebSLv Zheng 	osi_config.darwin_cmdline = 1;
136e5f660ebSLv Zheng 	__acpi_osi_setup_darwin(enable);
137e5f660ebSLv Zheng }
138e5f660ebSLv Zheng 
139e5f660ebSLv Zheng /*
140e5f660ebSLv Zheng  * The story of _OSI(Linux)
141e5f660ebSLv Zheng  *
142e5f660ebSLv Zheng  * From pre-history through Linux-2.6.22, Linux responded TRUE upon a BIOS
143e5f660ebSLv Zheng  * OSI(Linux) query.
144e5f660ebSLv Zheng  *
145e5f660ebSLv Zheng  * Unfortunately, reference BIOS writers got wind of this and put
146e5f660ebSLv Zheng  * OSI(Linux) in their example code, quickly exposing this string as
147e5f660ebSLv Zheng  * ill-conceived and opening the door to an un-bounded number of BIOS
148e5f660ebSLv Zheng  * incompatibilities.
149e5f660ebSLv Zheng  *
150e5f660ebSLv Zheng  * For example, OSI(Linux) was used on resume to re-POST a video card on
151e5f660ebSLv Zheng  * one system, because Linux at that time could not do a speedy restore in
152e5f660ebSLv Zheng  * its native driver. But then upon gaining quick native restore
153e5f660ebSLv Zheng  * capability, Linux has no way to tell the BIOS to skip the time-consuming
154e5f660ebSLv Zheng  * POST -- putting Linux at a permanent performance disadvantage. On
155e5f660ebSLv Zheng  * another system, the BIOS writer used OSI(Linux) to infer native OS
156e5f660ebSLv Zheng  * support for IPMI!  On other systems, OSI(Linux) simply got in the way of
157e5f660ebSLv Zheng  * Linux claiming to be compatible with other operating systems, exposing
158e5f660ebSLv Zheng  * BIOS issues such as skipped device initialization.
159e5f660ebSLv Zheng  *
160e5f660ebSLv Zheng  * So "Linux" turned out to be a really poor chose of OSI string, and from
161e5f660ebSLv Zheng  * Linux-2.6.23 onward we respond FALSE.
162e5f660ebSLv Zheng  *
163e5f660ebSLv Zheng  * BIOS writers should NOT query _OSI(Linux) on future systems. Linux will
164e5f660ebSLv Zheng  * complain on the console when it sees it, and return FALSE. To get Linux
165e5f660ebSLv Zheng  * to return TRUE for your system  will require a kernel source update to
166e5f660ebSLv Zheng  * add a DMI entry, or boot with "acpi_osi=Linux"
167e5f660ebSLv Zheng  */
__acpi_osi_setup_linux(bool enable)168e5f660ebSLv Zheng static void __init __acpi_osi_setup_linux(bool enable)
169e5f660ebSLv Zheng {
170e5f660ebSLv Zheng 	osi_config.linux_enable = !!enable;
171e5f660ebSLv Zheng 	if (enable)
172e5f660ebSLv Zheng 		acpi_osi_setup("Linux");
173e5f660ebSLv Zheng 	else
174e5f660ebSLv Zheng 		acpi_osi_setup("!Linux");
175e5f660ebSLv Zheng }
176e5f660ebSLv Zheng 
acpi_osi_setup_linux(bool enable)177e5f660ebSLv Zheng static void __init acpi_osi_setup_linux(bool enable)
178e5f660ebSLv Zheng {
179e5f660ebSLv Zheng 	/* Override acpi_osi_dmi_blacklisted() */
180e5f660ebSLv Zheng 	osi_config.linux_dmi = 0;
181e5f660ebSLv Zheng 	osi_config.linux_cmdline = 1;
182e5f660ebSLv Zheng 	__acpi_osi_setup_linux(enable);
183e5f660ebSLv Zheng }
184e5f660ebSLv Zheng 
185e5f660ebSLv Zheng /*
186e5f660ebSLv Zheng  * Modify the list of "OS Interfaces" reported to BIOS via _OSI
187e5f660ebSLv Zheng  *
188e5f660ebSLv Zheng  * empty string disables _OSI
189e5f660ebSLv Zheng  * string starting with '!' disables that string
190e5f660ebSLv Zheng  * otherwise string is added to list, augmenting built-in strings
191e5f660ebSLv Zheng  */
acpi_osi_setup_late(void)192e5f660ebSLv Zheng static void __init acpi_osi_setup_late(void)
193e5f660ebSLv Zheng {
194e5f660ebSLv Zheng 	struct acpi_osi_entry *osi;
195e5f660ebSLv Zheng 	char *str;
196e5f660ebSLv Zheng 	int i;
197e5f660ebSLv Zheng 	acpi_status status;
198e5f660ebSLv Zheng 
199e5f660ebSLv Zheng 	if (osi_config.default_disabling) {
200e5f660ebSLv Zheng 		status = acpi_update_interfaces(osi_config.default_disabling);
201e5f660ebSLv Zheng 		if (ACPI_SUCCESS(status))
202e5f660ebSLv Zheng 			pr_info("Disabled all _OSI OS vendors%s\n",
203e5f660ebSLv Zheng 				osi_config.default_disabling ==
204e5f660ebSLv Zheng 				ACPI_DISABLE_ALL_STRINGS ?
205e5f660ebSLv Zheng 				" and feature groups" : "");
206e5f660ebSLv Zheng 	}
207e5f660ebSLv Zheng 
208e5f660ebSLv Zheng 	for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
209e5f660ebSLv Zheng 		osi = &osi_setup_entries[i];
210e5f660ebSLv Zheng 		str = osi->string;
211e5f660ebSLv Zheng 		if (*str == '\0')
212e5f660ebSLv Zheng 			break;
213e5f660ebSLv Zheng 		if (osi->enable) {
214e5f660ebSLv Zheng 			status = acpi_install_interface(str);
215e5f660ebSLv Zheng 			if (ACPI_SUCCESS(status))
216e5f660ebSLv Zheng 				pr_info("Added _OSI(%s)\n", str);
217e5f660ebSLv Zheng 		} else {
218e5f660ebSLv Zheng 			status = acpi_remove_interface(str);
219e5f660ebSLv Zheng 			if (ACPI_SUCCESS(status))
220e5f660ebSLv Zheng 				pr_info("Deleted _OSI(%s)\n", str);
221e5f660ebSLv Zheng 		}
222e5f660ebSLv Zheng 	}
223e5f660ebSLv Zheng }
224e5f660ebSLv Zheng 
osi_setup(char * str)225e5f660ebSLv Zheng static int __init osi_setup(char *str)
226e5f660ebSLv Zheng {
227e5f660ebSLv Zheng 	if (str && !strcmp("Linux", str))
228e5f660ebSLv Zheng 		acpi_osi_setup_linux(true);
229e5f660ebSLv Zheng 	else if (str && !strcmp("!Linux", str))
230e5f660ebSLv Zheng 		acpi_osi_setup_linux(false);
231e5f660ebSLv Zheng 	else if (str && !strcmp("Darwin", str))
232e5f660ebSLv Zheng 		acpi_osi_setup_darwin(true);
233e5f660ebSLv Zheng 	else if (str && !strcmp("!Darwin", str))
234e5f660ebSLv Zheng 		acpi_osi_setup_darwin(false);
235e5f660ebSLv Zheng 	else
236e5f660ebSLv Zheng 		acpi_osi_setup(str);
237e5f660ebSLv Zheng 
238e5f660ebSLv Zheng 	return 1;
239e5f660ebSLv Zheng }
240e5f660ebSLv Zheng __setup("acpi_osi=", osi_setup);
241e5f660ebSLv Zheng 
acpi_osi_is_win8(void)242e5f660ebSLv Zheng bool acpi_osi_is_win8(void)
243e5f660ebSLv Zheng {
244e5f660ebSLv Zheng 	return acpi_gbl_osi_data >= ACPI_OSI_WIN_8;
245e5f660ebSLv Zheng }
246e5f660ebSLv Zheng EXPORT_SYMBOL(acpi_osi_is_win8);
247e5f660ebSLv Zheng 
acpi_osi_dmi_darwin(void)248630b3affSLukas Wunner static void __init acpi_osi_dmi_darwin(void)
249e5f660ebSLv Zheng {
250630b3affSLukas Wunner 	pr_notice("DMI detected to setup _OSI(\"Darwin\"): Apple hardware\n");
251e5f660ebSLv Zheng 	osi_config.darwin_dmi = 1;
252630b3affSLukas Wunner 	__acpi_osi_setup_darwin(true);
253e5f660ebSLv Zheng }
254e5f660ebSLv Zheng 
acpi_osi_dmi_linux(bool enable,const struct dmi_system_id * d)2555438bc57SColin Ian King static void __init acpi_osi_dmi_linux(bool enable,
2565438bc57SColin Ian King 				      const struct dmi_system_id *d)
257e5f660ebSLv Zheng {
258e5f660ebSLv Zheng 	pr_notice("DMI detected to setup _OSI(\"Linux\"): %s\n", d->ident);
259e5f660ebSLv Zheng 	osi_config.linux_dmi = 1;
260e5f660ebSLv Zheng 	__acpi_osi_setup_linux(enable);
261e5f660ebSLv Zheng }
262e5f660ebSLv Zheng 
dmi_enable_osi_linux(const struct dmi_system_id * d)263e5f660ebSLv Zheng static int __init dmi_enable_osi_linux(const struct dmi_system_id *d)
264e5f660ebSLv Zheng {
265e5f660ebSLv Zheng 	acpi_osi_dmi_linux(true, d);
266e5f660ebSLv Zheng 
267e5f660ebSLv Zheng 	return 0;
268e5f660ebSLv Zheng }
269e5f660ebSLv Zheng 
dmi_disable_osi_vista(const struct dmi_system_id * d)270e5f660ebSLv Zheng static int __init dmi_disable_osi_vista(const struct dmi_system_id *d)
271e5f660ebSLv Zheng {
272e5f660ebSLv Zheng 	pr_notice("DMI detected: %s\n", d->ident);
273e5f660ebSLv Zheng 	acpi_osi_setup("!Windows 2006");
274e5f660ebSLv Zheng 	acpi_osi_setup("!Windows 2006 SP1");
275e5f660ebSLv Zheng 	acpi_osi_setup("!Windows 2006 SP2");
276e5f660ebSLv Zheng 
277e5f660ebSLv Zheng 	return 0;
278e5f660ebSLv Zheng }
279e5f660ebSLv Zheng 
dmi_disable_osi_win7(const struct dmi_system_id * d)280e5f660ebSLv Zheng static int __init dmi_disable_osi_win7(const struct dmi_system_id *d)
281e5f660ebSLv Zheng {
282e5f660ebSLv Zheng 	pr_notice("DMI detected: %s\n", d->ident);
283e5f660ebSLv Zheng 	acpi_osi_setup("!Windows 2009");
284e5f660ebSLv Zheng 
285e5f660ebSLv Zheng 	return 0;
286e5f660ebSLv Zheng }
287e5f660ebSLv Zheng 
dmi_disable_osi_win8(const struct dmi_system_id * d)288e5f660ebSLv Zheng static int __init dmi_disable_osi_win8(const struct dmi_system_id *d)
289e5f660ebSLv Zheng {
290e5f660ebSLv Zheng 	pr_notice("DMI detected: %s\n", d->ident);
291e5f660ebSLv Zheng 	acpi_osi_setup("!Windows 2012");
292e5f660ebSLv Zheng 
293e5f660ebSLv Zheng 	return 0;
294e5f660ebSLv Zheng }
295e5f660ebSLv Zheng 
296e5f660ebSLv Zheng /*
297e5f660ebSLv Zheng  * Linux default _OSI response behavior is determined by this DMI table.
298e5f660ebSLv Zheng  *
299e5f660ebSLv Zheng  * Note that _OSI("Linux")/_OSI("Darwin") determined here can be overridden
300e5f660ebSLv Zheng  * by acpi_osi=!Linux/acpi_osi=!Darwin command line options.
301e5f660ebSLv Zheng  */
3026faadbbbSChristoph Hellwig static const struct dmi_system_id acpi_osi_dmi_table[] __initconst = {
303e5f660ebSLv Zheng 	{
304e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
305e5f660ebSLv Zheng 	.ident = "Fujitsu Siemens",
306e5f660ebSLv Zheng 	.matches = {
307e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
308e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"),
309e5f660ebSLv Zheng 		},
310e5f660ebSLv Zheng 	},
311e5f660ebSLv Zheng 	{
312e5f660ebSLv Zheng 	/*
313e5f660ebSLv Zheng 	 * There have a NVIF method in MSI GX723 DSDT need call by Nvidia
314e5f660ebSLv Zheng 	 * driver (e.g. nouveau) when user press brightness hotkey.
315e5f660ebSLv Zheng 	 * Currently, nouveau driver didn't do the job and it causes there
316e5f660ebSLv Zheng 	 * have a infinite while loop in DSDT when user press hotkey.
317e5f660ebSLv Zheng 	 * We add MSI GX723's dmi information to this table for workaround
318e5f660ebSLv Zheng 	 * this issue.
319e5f660ebSLv Zheng 	 * Will remove MSI GX723 from the table after nouveau grows support.
320e5f660ebSLv Zheng 	 */
321e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
322e5f660ebSLv Zheng 	.ident = "MSI GX723",
323e5f660ebSLv Zheng 	.matches = {
324e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"),
325e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "GX723"),
326e5f660ebSLv Zheng 		},
327e5f660ebSLv Zheng 	},
328e5f660ebSLv Zheng 	{
329e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
330e5f660ebSLv Zheng 	.ident = "Sony VGN-NS10J_S",
331e5f660ebSLv Zheng 	.matches = {
332e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
333e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS10J_S"),
334e5f660ebSLv Zheng 		},
335e5f660ebSLv Zheng 	},
336e5f660ebSLv Zheng 	{
337e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
338e5f660ebSLv Zheng 	.ident = "Sony VGN-SR290J",
339e5f660ebSLv Zheng 	.matches = {
340e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
341e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR290J"),
342e5f660ebSLv Zheng 		},
343e5f660ebSLv Zheng 	},
344e5f660ebSLv Zheng 	{
345e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
346e5f660ebSLv Zheng 	.ident = "VGN-NS50B_L",
347e5f660ebSLv Zheng 	.matches = {
348e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
349e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS50B_L"),
350e5f660ebSLv Zheng 		},
351e5f660ebSLv Zheng 	},
352e5f660ebSLv Zheng 	{
353e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
354e5f660ebSLv Zheng 	.ident = "VGN-SR19XN",
355e5f660ebSLv Zheng 	.matches = {
356e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
357e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR19XN"),
358e5f660ebSLv Zheng 		},
359e5f660ebSLv Zheng 	},
360e5f660ebSLv Zheng 	{
361e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
362e5f660ebSLv Zheng 	.ident = "Toshiba Satellite L355",
363e5f660ebSLv Zheng 	.matches = {
364e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
365e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_VERSION, "Satellite L355"),
366e5f660ebSLv Zheng 		},
367e5f660ebSLv Zheng 	},
368e5f660ebSLv Zheng 	{
369e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win7,
370e5f660ebSLv Zheng 	.ident = "ASUS K50IJ",
371e5f660ebSLv Zheng 	.matches = {
372e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
373e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"),
374e5f660ebSLv Zheng 		},
375e5f660ebSLv Zheng 	},
376e5f660ebSLv Zheng 	{
377e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
378e5f660ebSLv Zheng 	.ident = "Toshiba P305D",
379e5f660ebSLv Zheng 	.matches = {
380e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
381e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P305D"),
382e5f660ebSLv Zheng 		},
383e5f660ebSLv Zheng 	},
384e5f660ebSLv Zheng 	{
385e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
386e5f660ebSLv Zheng 	.ident = "Toshiba NB100",
387e5f660ebSLv Zheng 	.matches = {
388e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
389e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "NB100"),
390e5f660ebSLv Zheng 		},
391e5f660ebSLv Zheng 	},
392e5f660ebSLv Zheng 
393e5f660ebSLv Zheng 	/*
394e5f660ebSLv Zheng 	 * The wireless hotkey does not work on those machines when
395e5f660ebSLv Zheng 	 * returning true for _OSI("Windows 2012")
396e5f660ebSLv Zheng 	 */
397e5f660ebSLv Zheng 	{
398e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win8,
399e5f660ebSLv Zheng 	.ident = "Dell Inspiron 7737",
400e5f660ebSLv Zheng 	.matches = {
401e5f660ebSLv Zheng 		    DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
402e5f660ebSLv Zheng 		    DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7737"),
403e5f660ebSLv Zheng 		},
404e5f660ebSLv Zheng 	},
405e5f660ebSLv Zheng 	{
406e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win8,
407e5f660ebSLv Zheng 	.ident = "Dell Inspiron 7537",
408e5f660ebSLv Zheng 	.matches = {
409e5f660ebSLv Zheng 		    DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
410e5f660ebSLv Zheng 		    DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7537"),
411e5f660ebSLv Zheng 		},
412e5f660ebSLv Zheng 	},
413e5f660ebSLv Zheng 	{
414e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win8,
415e5f660ebSLv Zheng 	.ident = "Dell Inspiron 5437",
416e5f660ebSLv Zheng 	.matches = {
417e5f660ebSLv Zheng 		    DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
418e5f660ebSLv Zheng 		    DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5437"),
419e5f660ebSLv Zheng 		},
420e5f660ebSLv Zheng 	},
421e5f660ebSLv Zheng 	{
422e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win8,
423e5f660ebSLv Zheng 	.ident = "Dell Inspiron 3437",
424e5f660ebSLv Zheng 	.matches = {
425e5f660ebSLv Zheng 		    DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
426e5f660ebSLv Zheng 		    DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 3437"),
427e5f660ebSLv Zheng 		},
428e5f660ebSLv Zheng 	},
429e5f660ebSLv Zheng 	{
430e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win8,
431e5f660ebSLv Zheng 	.ident = "Dell Vostro 3446",
432e5f660ebSLv Zheng 	.matches = {
433e5f660ebSLv Zheng 		    DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
434e5f660ebSLv Zheng 		    DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3446"),
435e5f660ebSLv Zheng 		},
436e5f660ebSLv Zheng 	},
437e5f660ebSLv Zheng 	{
438e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win8,
439e5f660ebSLv Zheng 	.ident = "Dell Vostro 3546",
440e5f660ebSLv Zheng 	.matches = {
441e5f660ebSLv Zheng 		    DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
442e5f660ebSLv Zheng 		    DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3546"),
443e5f660ebSLv Zheng 		},
444e5f660ebSLv Zheng 	},
445e5f660ebSLv Zheng 
446e5f660ebSLv Zheng 	/*
447e5f660ebSLv Zheng 	 * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
448e5f660ebSLv Zheng 	 * Linux ignores it, except for the machines enumerated below.
449e5f660ebSLv Zheng 	 */
450e5f660ebSLv Zheng 
451e5f660ebSLv Zheng 	/*
452b4447c0dSCao jin 	 * Without this EEEpc exports a non working WMI interface, with
453b4447c0dSCao jin 	 * this it exports a working "good old" eeepc_laptop interface,
454b4447c0dSCao jin 	 * fixing both brightness control, and rfkill not working.
455e5f660ebSLv Zheng 	 */
456e5f660ebSLv Zheng 	{
457e5f660ebSLv Zheng 	.callback = dmi_enable_osi_linux,
458e5f660ebSLv Zheng 	.ident = "Asus EEE PC 1015PX",
459e5f660ebSLv Zheng 	.matches = {
460e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."),
461e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "1015PX"),
462e5f660ebSLv Zheng 		},
463e5f660ebSLv Zheng 	},
464e5f660ebSLv Zheng 	{}
465e5f660ebSLv Zheng };
466e5f660ebSLv Zheng 
acpi_osi_dmi_blacklisted(void)467e5f660ebSLv Zheng static __init void acpi_osi_dmi_blacklisted(void)
468e5f660ebSLv Zheng {
469e5f660ebSLv Zheng 	dmi_check_system(acpi_osi_dmi_table);
470630b3affSLukas Wunner 
471630b3affSLukas Wunner 	/* Enable _OSI("Darwin") for Apple platforms. */
472630b3affSLukas Wunner 	if (x86_apple_machine)
473630b3affSLukas Wunner 		acpi_osi_dmi_darwin();
474e5f660ebSLv Zheng }
475e5f660ebSLv Zheng 
early_acpi_osi_init(void)476e5f660ebSLv Zheng int __init early_acpi_osi_init(void)
477e5f660ebSLv Zheng {
478e5f660ebSLv Zheng 	acpi_osi_dmi_blacklisted();
479e5f660ebSLv Zheng 
480e5f660ebSLv Zheng 	return 0;
481e5f660ebSLv Zheng }
482e5f660ebSLv Zheng 
acpi_osi_init(void)483e5f660ebSLv Zheng int __init acpi_osi_init(void)
484e5f660ebSLv Zheng {
485e5f660ebSLv Zheng 	acpi_install_interface_handler(acpi_osi_handler);
486e5f660ebSLv Zheng 	acpi_osi_setup_late();
487e5f660ebSLv Zheng 
488e5f660ebSLv Zheng 	return 0;
489e5f660ebSLv Zheng }
490