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