xref: /linux/drivers/acpi/osi.c (revision b4447c0dcd0d270e98a88e34df52cb097acd0fd2)
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},
479251a71dSAlex Hung 	/*
489251a71dSAlex Hung 	 * Linux-Dell-Video is used by BIOS to disable RTD3 for NVidia graphics
499251a71dSAlex Hung 	 * cards as RTD3 is not supported by drivers now.  Systems with NVidia
509251a71dSAlex Hung 	 * cards will hang without RTD3 disabled.
519251a71dSAlex Hung 	 *
529251a71dSAlex Hung 	 * Once NVidia drivers officially support RTD3, this _OSI strings can
539251a71dSAlex Hung 	 * be removed if both new and old graphics cards are supported.
549251a71dSAlex Hung 	 */
559251a71dSAlex Hung 	{"Linux-Dell-Video", true},
56887532caSAlex Hung 	/*
57887532caSAlex Hung 	 * Linux-Lenovo-NV-HDMI-Audio is used by BIOS to power on NVidia's HDMI
58887532caSAlex Hung 	 * audio device which is turned off for power-saving in Windows OS.
59887532caSAlex Hung 	 * This power management feature observed on some Lenovo Thinkpad
60887532caSAlex Hung 	 * systems which will not be able to output audio via HDMI without
61887532caSAlex Hung 	 * a BIOS workaround.
62887532caSAlex Hung 	 */
63887532caSAlex Hung 	{"Linux-Lenovo-NV-HDMI-Audio", true},
6428586a51SAlex Hung 	/*
6528586a51SAlex Hung 	 * Linux-HPI-Hybrid-Graphics is used by BIOS to enable dGPU to
6628586a51SAlex Hung 	 * output video directly to external monitors on HP Inc. mobile
6728586a51SAlex Hung 	 * workstations as Nvidia and AMD VGA drivers provide limited
6828586a51SAlex Hung 	 * hybrid graphics supports.
6928586a51SAlex Hung 	 */
7028586a51SAlex Hung 	{"Linux-HPI-Hybrid-Graphics", true},
71e5f660ebSLv Zheng };
72e5f660ebSLv Zheng 
73e5f660ebSLv Zheng static u32 acpi_osi_handler(acpi_string interface, u32 supported)
74e5f660ebSLv Zheng {
75e5f660ebSLv Zheng 	if (!strcmp("Linux", interface)) {
76e5f660ebSLv Zheng 		pr_notice_once(FW_BUG
77e5f660ebSLv Zheng 			"BIOS _OSI(Linux) query %s%s\n",
78e5f660ebSLv Zheng 			osi_config.linux_enable ? "honored" : "ignored",
79e5f660ebSLv Zheng 			osi_config.linux_cmdline ? " via cmdline" :
80e5f660ebSLv Zheng 			osi_config.linux_dmi ? " via DMI" : "");
81e5f660ebSLv Zheng 	}
82e5f660ebSLv Zheng 	if (!strcmp("Darwin", interface)) {
83e5f660ebSLv Zheng 		pr_notice_once(
84e5f660ebSLv Zheng 			"BIOS _OSI(Darwin) query %s%s\n",
85e5f660ebSLv Zheng 			osi_config.darwin_enable ? "honored" : "ignored",
86e5f660ebSLv Zheng 			osi_config.darwin_cmdline ? " via cmdline" :
87e5f660ebSLv Zheng 			osi_config.darwin_dmi ? " via DMI" : "");
88e5f660ebSLv Zheng 	}
89e5f660ebSLv Zheng 
90e5f660ebSLv Zheng 	return supported;
91e5f660ebSLv Zheng }
92e5f660ebSLv Zheng 
93e5f660ebSLv Zheng void __init acpi_osi_setup(char *str)
94e5f660ebSLv Zheng {
95e5f660ebSLv Zheng 	struct acpi_osi_entry *osi;
96e5f660ebSLv Zheng 	bool enable = true;
97e5f660ebSLv Zheng 	int i;
98e5f660ebSLv Zheng 
99e5f660ebSLv Zheng 	if (!acpi_gbl_create_osi_method)
100e5f660ebSLv Zheng 		return;
101e5f660ebSLv Zheng 
102e5f660ebSLv Zheng 	if (str == NULL || *str == '\0') {
103e5f660ebSLv Zheng 		pr_info("_OSI method disabled\n");
104e5f660ebSLv Zheng 		acpi_gbl_create_osi_method = FALSE;
105e5f660ebSLv Zheng 		return;
106e5f660ebSLv Zheng 	}
107e5f660ebSLv Zheng 
108e5f660ebSLv Zheng 	if (*str == '!') {
109e5f660ebSLv Zheng 		str++;
110e5f660ebSLv Zheng 		if (*str == '\0') {
111e5f660ebSLv Zheng 			/* Do not override acpi_osi=!* */
112e5f660ebSLv Zheng 			if (!osi_config.default_disabling)
113e5f660ebSLv Zheng 				osi_config.default_disabling =
114e5f660ebSLv Zheng 					ACPI_DISABLE_ALL_VENDOR_STRINGS;
115e5f660ebSLv Zheng 			return;
116e5f660ebSLv Zheng 		} else if (*str == '*') {
117e5f660ebSLv Zheng 			osi_config.default_disabling = ACPI_DISABLE_ALL_STRINGS;
118e5f660ebSLv Zheng 			for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
119e5f660ebSLv Zheng 				osi = &osi_setup_entries[i];
120e5f660ebSLv Zheng 				osi->enable = false;
121e5f660ebSLv Zheng 			}
122e5f660ebSLv Zheng 			return;
123e5f660ebSLv Zheng 		} else if (*str == '!') {
124e5f660ebSLv Zheng 			osi_config.default_disabling = 0;
125e5f660ebSLv Zheng 			return;
126e5f660ebSLv Zheng 		}
127e5f660ebSLv Zheng 		enable = false;
128e5f660ebSLv Zheng 	}
129e5f660ebSLv Zheng 
130e5f660ebSLv Zheng 	for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
131e5f660ebSLv Zheng 		osi = &osi_setup_entries[i];
132e5f660ebSLv Zheng 		if (!strcmp(osi->string, str)) {
133e5f660ebSLv Zheng 			osi->enable = enable;
134e5f660ebSLv Zheng 			break;
135e5f660ebSLv Zheng 		} else if (osi->string[0] == '\0') {
136e5f660ebSLv Zheng 			osi->enable = enable;
137e5f660ebSLv Zheng 			strncpy(osi->string, str, OSI_STRING_LENGTH_MAX);
138e5f660ebSLv Zheng 			break;
139e5f660ebSLv Zheng 		}
140e5f660ebSLv Zheng 	}
141e5f660ebSLv Zheng }
142e5f660ebSLv Zheng 
143e5f660ebSLv Zheng static void __init __acpi_osi_setup_darwin(bool enable)
144e5f660ebSLv Zheng {
145e5f660ebSLv Zheng 	osi_config.darwin_enable = !!enable;
146e5f660ebSLv Zheng 	if (enable) {
147e5f660ebSLv Zheng 		acpi_osi_setup("!");
148e5f660ebSLv Zheng 		acpi_osi_setup("Darwin");
149e5f660ebSLv Zheng 	} else {
150e5f660ebSLv Zheng 		acpi_osi_setup("!!");
151e5f660ebSLv Zheng 		acpi_osi_setup("!Darwin");
152e5f660ebSLv Zheng 	}
153e5f660ebSLv Zheng }
154e5f660ebSLv Zheng 
155e5f660ebSLv Zheng static void __init acpi_osi_setup_darwin(bool enable)
156e5f660ebSLv Zheng {
157e5f660ebSLv Zheng 	/* Override acpi_osi_dmi_blacklisted() */
158e5f660ebSLv Zheng 	osi_config.darwin_dmi = 0;
159e5f660ebSLv Zheng 	osi_config.darwin_cmdline = 1;
160e5f660ebSLv Zheng 	__acpi_osi_setup_darwin(enable);
161e5f660ebSLv Zheng }
162e5f660ebSLv Zheng 
163e5f660ebSLv Zheng /*
164e5f660ebSLv Zheng  * The story of _OSI(Linux)
165e5f660ebSLv Zheng  *
166e5f660ebSLv Zheng  * From pre-history through Linux-2.6.22, Linux responded TRUE upon a BIOS
167e5f660ebSLv Zheng  * OSI(Linux) query.
168e5f660ebSLv Zheng  *
169e5f660ebSLv Zheng  * Unfortunately, reference BIOS writers got wind of this and put
170e5f660ebSLv Zheng  * OSI(Linux) in their example code, quickly exposing this string as
171e5f660ebSLv Zheng  * ill-conceived and opening the door to an un-bounded number of BIOS
172e5f660ebSLv Zheng  * incompatibilities.
173e5f660ebSLv Zheng  *
174e5f660ebSLv Zheng  * For example, OSI(Linux) was used on resume to re-POST a video card on
175e5f660ebSLv Zheng  * one system, because Linux at that time could not do a speedy restore in
176e5f660ebSLv Zheng  * its native driver. But then upon gaining quick native restore
177e5f660ebSLv Zheng  * capability, Linux has no way to tell the BIOS to skip the time-consuming
178e5f660ebSLv Zheng  * POST -- putting Linux at a permanent performance disadvantage. On
179e5f660ebSLv Zheng  * another system, the BIOS writer used OSI(Linux) to infer native OS
180e5f660ebSLv Zheng  * support for IPMI!  On other systems, OSI(Linux) simply got in the way of
181e5f660ebSLv Zheng  * Linux claiming to be compatible with other operating systems, exposing
182e5f660ebSLv Zheng  * BIOS issues such as skipped device initialization.
183e5f660ebSLv Zheng  *
184e5f660ebSLv Zheng  * So "Linux" turned out to be a really poor chose of OSI string, and from
185e5f660ebSLv Zheng  * Linux-2.6.23 onward we respond FALSE.
186e5f660ebSLv Zheng  *
187e5f660ebSLv Zheng  * BIOS writers should NOT query _OSI(Linux) on future systems. Linux will
188e5f660ebSLv Zheng  * complain on the console when it sees it, and return FALSE. To get Linux
189e5f660ebSLv Zheng  * to return TRUE for your system  will require a kernel source update to
190e5f660ebSLv Zheng  * add a DMI entry, or boot with "acpi_osi=Linux"
191e5f660ebSLv Zheng  */
192e5f660ebSLv Zheng static void __init __acpi_osi_setup_linux(bool enable)
193e5f660ebSLv Zheng {
194e5f660ebSLv Zheng 	osi_config.linux_enable = !!enable;
195e5f660ebSLv Zheng 	if (enable)
196e5f660ebSLv Zheng 		acpi_osi_setup("Linux");
197e5f660ebSLv Zheng 	else
198e5f660ebSLv Zheng 		acpi_osi_setup("!Linux");
199e5f660ebSLv Zheng }
200e5f660ebSLv Zheng 
201e5f660ebSLv Zheng static void __init acpi_osi_setup_linux(bool enable)
202e5f660ebSLv Zheng {
203e5f660ebSLv Zheng 	/* Override acpi_osi_dmi_blacklisted() */
204e5f660ebSLv Zheng 	osi_config.linux_dmi = 0;
205e5f660ebSLv Zheng 	osi_config.linux_cmdline = 1;
206e5f660ebSLv Zheng 	__acpi_osi_setup_linux(enable);
207e5f660ebSLv Zheng }
208e5f660ebSLv Zheng 
209e5f660ebSLv Zheng /*
210e5f660ebSLv Zheng  * Modify the list of "OS Interfaces" reported to BIOS via _OSI
211e5f660ebSLv Zheng  *
212e5f660ebSLv Zheng  * empty string disables _OSI
213e5f660ebSLv Zheng  * string starting with '!' disables that string
214e5f660ebSLv Zheng  * otherwise string is added to list, augmenting built-in strings
215e5f660ebSLv Zheng  */
216e5f660ebSLv Zheng static void __init acpi_osi_setup_late(void)
217e5f660ebSLv Zheng {
218e5f660ebSLv Zheng 	struct acpi_osi_entry *osi;
219e5f660ebSLv Zheng 	char *str;
220e5f660ebSLv Zheng 	int i;
221e5f660ebSLv Zheng 	acpi_status status;
222e5f660ebSLv Zheng 
223e5f660ebSLv Zheng 	if (osi_config.default_disabling) {
224e5f660ebSLv Zheng 		status = acpi_update_interfaces(osi_config.default_disabling);
225e5f660ebSLv Zheng 		if (ACPI_SUCCESS(status))
226e5f660ebSLv Zheng 			pr_info("Disabled all _OSI OS vendors%s\n",
227e5f660ebSLv Zheng 				osi_config.default_disabling ==
228e5f660ebSLv Zheng 				ACPI_DISABLE_ALL_STRINGS ?
229e5f660ebSLv Zheng 				" and feature groups" : "");
230e5f660ebSLv Zheng 	}
231e5f660ebSLv Zheng 
232e5f660ebSLv Zheng 	for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
233e5f660ebSLv Zheng 		osi = &osi_setup_entries[i];
234e5f660ebSLv Zheng 		str = osi->string;
235e5f660ebSLv Zheng 		if (*str == '\0')
236e5f660ebSLv Zheng 			break;
237e5f660ebSLv Zheng 		if (osi->enable) {
238e5f660ebSLv Zheng 			status = acpi_install_interface(str);
239e5f660ebSLv Zheng 			if (ACPI_SUCCESS(status))
240e5f660ebSLv Zheng 				pr_info("Added _OSI(%s)\n", str);
241e5f660ebSLv Zheng 		} else {
242e5f660ebSLv Zheng 			status = acpi_remove_interface(str);
243e5f660ebSLv Zheng 			if (ACPI_SUCCESS(status))
244e5f660ebSLv Zheng 				pr_info("Deleted _OSI(%s)\n", str);
245e5f660ebSLv Zheng 		}
246e5f660ebSLv Zheng 	}
247e5f660ebSLv Zheng }
248e5f660ebSLv Zheng 
249e5f660ebSLv Zheng static int __init osi_setup(char *str)
250e5f660ebSLv Zheng {
251e5f660ebSLv Zheng 	if (str && !strcmp("Linux", str))
252e5f660ebSLv Zheng 		acpi_osi_setup_linux(true);
253e5f660ebSLv Zheng 	else if (str && !strcmp("!Linux", str))
254e5f660ebSLv Zheng 		acpi_osi_setup_linux(false);
255e5f660ebSLv Zheng 	else if (str && !strcmp("Darwin", str))
256e5f660ebSLv Zheng 		acpi_osi_setup_darwin(true);
257e5f660ebSLv Zheng 	else if (str && !strcmp("!Darwin", str))
258e5f660ebSLv Zheng 		acpi_osi_setup_darwin(false);
259e5f660ebSLv Zheng 	else
260e5f660ebSLv Zheng 		acpi_osi_setup(str);
261e5f660ebSLv Zheng 
262e5f660ebSLv Zheng 	return 1;
263e5f660ebSLv Zheng }
264e5f660ebSLv Zheng __setup("acpi_osi=", osi_setup);
265e5f660ebSLv Zheng 
266e5f660ebSLv Zheng bool acpi_osi_is_win8(void)
267e5f660ebSLv Zheng {
268e5f660ebSLv Zheng 	return acpi_gbl_osi_data >= ACPI_OSI_WIN_8;
269e5f660ebSLv Zheng }
270e5f660ebSLv Zheng EXPORT_SYMBOL(acpi_osi_is_win8);
271e5f660ebSLv Zheng 
272630b3affSLukas Wunner static void __init acpi_osi_dmi_darwin(void)
273e5f660ebSLv Zheng {
274630b3affSLukas Wunner 	pr_notice("DMI detected to setup _OSI(\"Darwin\"): Apple hardware\n");
275e5f660ebSLv Zheng 	osi_config.darwin_dmi = 1;
276630b3affSLukas Wunner 	__acpi_osi_setup_darwin(true);
277e5f660ebSLv Zheng }
278e5f660ebSLv Zheng 
2795438bc57SColin Ian King static void __init acpi_osi_dmi_linux(bool enable,
2805438bc57SColin Ian King 				      const struct dmi_system_id *d)
281e5f660ebSLv Zheng {
282e5f660ebSLv Zheng 	pr_notice("DMI detected to setup _OSI(\"Linux\"): %s\n", d->ident);
283e5f660ebSLv Zheng 	osi_config.linux_dmi = 1;
284e5f660ebSLv Zheng 	__acpi_osi_setup_linux(enable);
285e5f660ebSLv Zheng }
286e5f660ebSLv Zheng 
287e5f660ebSLv Zheng static int __init dmi_enable_osi_linux(const struct dmi_system_id *d)
288e5f660ebSLv Zheng {
289e5f660ebSLv Zheng 	acpi_osi_dmi_linux(true, d);
290e5f660ebSLv Zheng 
291e5f660ebSLv Zheng 	return 0;
292e5f660ebSLv Zheng }
293e5f660ebSLv Zheng 
294e5f660ebSLv Zheng static int __init dmi_disable_osi_vista(const struct dmi_system_id *d)
295e5f660ebSLv Zheng {
296e5f660ebSLv Zheng 	pr_notice("DMI detected: %s\n", d->ident);
297e5f660ebSLv Zheng 	acpi_osi_setup("!Windows 2006");
298e5f660ebSLv Zheng 	acpi_osi_setup("!Windows 2006 SP1");
299e5f660ebSLv Zheng 	acpi_osi_setup("!Windows 2006 SP2");
300e5f660ebSLv Zheng 
301e5f660ebSLv Zheng 	return 0;
302e5f660ebSLv Zheng }
303e5f660ebSLv Zheng 
304e5f660ebSLv Zheng static int __init dmi_disable_osi_win7(const struct dmi_system_id *d)
305e5f660ebSLv Zheng {
306e5f660ebSLv Zheng 	pr_notice("DMI detected: %s\n", d->ident);
307e5f660ebSLv Zheng 	acpi_osi_setup("!Windows 2009");
308e5f660ebSLv Zheng 
309e5f660ebSLv Zheng 	return 0;
310e5f660ebSLv Zheng }
311e5f660ebSLv Zheng 
312e5f660ebSLv Zheng static int __init dmi_disable_osi_win8(const struct dmi_system_id *d)
313e5f660ebSLv Zheng {
314e5f660ebSLv Zheng 	pr_notice("DMI detected: %s\n", d->ident);
315e5f660ebSLv Zheng 	acpi_osi_setup("!Windows 2012");
316e5f660ebSLv Zheng 
317e5f660ebSLv Zheng 	return 0;
318e5f660ebSLv Zheng }
319e5f660ebSLv Zheng 
320e5f660ebSLv Zheng /*
321e5f660ebSLv Zheng  * Linux default _OSI response behavior is determined by this DMI table.
322e5f660ebSLv Zheng  *
323e5f660ebSLv Zheng  * Note that _OSI("Linux")/_OSI("Darwin") determined here can be overridden
324e5f660ebSLv Zheng  * by acpi_osi=!Linux/acpi_osi=!Darwin command line options.
325e5f660ebSLv Zheng  */
3266faadbbbSChristoph Hellwig static const struct dmi_system_id acpi_osi_dmi_table[] __initconst = {
327e5f660ebSLv Zheng 	{
328e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
329e5f660ebSLv Zheng 	.ident = "Fujitsu Siemens",
330e5f660ebSLv Zheng 	.matches = {
331e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
332e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"),
333e5f660ebSLv Zheng 		},
334e5f660ebSLv Zheng 	},
335e5f660ebSLv Zheng 	{
336e5f660ebSLv Zheng 	/*
337e5f660ebSLv Zheng 	 * There have a NVIF method in MSI GX723 DSDT need call by Nvidia
338e5f660ebSLv Zheng 	 * driver (e.g. nouveau) when user press brightness hotkey.
339e5f660ebSLv Zheng 	 * Currently, nouveau driver didn't do the job and it causes there
340e5f660ebSLv Zheng 	 * have a infinite while loop in DSDT when user press hotkey.
341e5f660ebSLv Zheng 	 * We add MSI GX723's dmi information to this table for workaround
342e5f660ebSLv Zheng 	 * this issue.
343e5f660ebSLv Zheng 	 * Will remove MSI GX723 from the table after nouveau grows support.
344e5f660ebSLv Zheng 	 */
345e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
346e5f660ebSLv Zheng 	.ident = "MSI GX723",
347e5f660ebSLv Zheng 	.matches = {
348e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"),
349e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "GX723"),
350e5f660ebSLv Zheng 		},
351e5f660ebSLv Zheng 	},
352e5f660ebSLv Zheng 	{
353e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
354e5f660ebSLv Zheng 	.ident = "Sony VGN-NS10J_S",
355e5f660ebSLv Zheng 	.matches = {
356e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
357e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS10J_S"),
358e5f660ebSLv Zheng 		},
359e5f660ebSLv Zheng 	},
360e5f660ebSLv Zheng 	{
361e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
362e5f660ebSLv Zheng 	.ident = "Sony VGN-SR290J",
363e5f660ebSLv Zheng 	.matches = {
364e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
365e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR290J"),
366e5f660ebSLv Zheng 		},
367e5f660ebSLv Zheng 	},
368e5f660ebSLv Zheng 	{
369e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
370e5f660ebSLv Zheng 	.ident = "VGN-NS50B_L",
371e5f660ebSLv Zheng 	.matches = {
372e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
373e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS50B_L"),
374e5f660ebSLv Zheng 		},
375e5f660ebSLv Zheng 	},
376e5f660ebSLv Zheng 	{
377e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
378e5f660ebSLv Zheng 	.ident = "VGN-SR19XN",
379e5f660ebSLv Zheng 	.matches = {
380e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
381e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR19XN"),
382e5f660ebSLv Zheng 		},
383e5f660ebSLv Zheng 	},
384e5f660ebSLv Zheng 	{
385e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
386e5f660ebSLv Zheng 	.ident = "Toshiba Satellite L355",
387e5f660ebSLv Zheng 	.matches = {
388e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
389e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_VERSION, "Satellite L355"),
390e5f660ebSLv Zheng 		},
391e5f660ebSLv Zheng 	},
392e5f660ebSLv Zheng 	{
393e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win7,
394e5f660ebSLv Zheng 	.ident = "ASUS K50IJ",
395e5f660ebSLv Zheng 	.matches = {
396e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
397e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"),
398e5f660ebSLv Zheng 		},
399e5f660ebSLv Zheng 	},
400e5f660ebSLv Zheng 	{
401e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
402e5f660ebSLv Zheng 	.ident = "Toshiba P305D",
403e5f660ebSLv Zheng 	.matches = {
404e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
405e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P305D"),
406e5f660ebSLv Zheng 		},
407e5f660ebSLv Zheng 	},
408e5f660ebSLv Zheng 	{
409e5f660ebSLv Zheng 	.callback = dmi_disable_osi_vista,
410e5f660ebSLv Zheng 	.ident = "Toshiba NB100",
411e5f660ebSLv Zheng 	.matches = {
412e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
413e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "NB100"),
414e5f660ebSLv Zheng 		},
415e5f660ebSLv Zheng 	},
416e5f660ebSLv Zheng 
417e5f660ebSLv Zheng 	/*
418e5f660ebSLv Zheng 	 * The wireless hotkey does not work on those machines when
419e5f660ebSLv Zheng 	 * returning true for _OSI("Windows 2012")
420e5f660ebSLv Zheng 	 */
421e5f660ebSLv Zheng 	{
422e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win8,
423e5f660ebSLv Zheng 	.ident = "Dell Inspiron 7737",
424e5f660ebSLv Zheng 	.matches = {
425e5f660ebSLv Zheng 		    DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
426e5f660ebSLv Zheng 		    DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7737"),
427e5f660ebSLv Zheng 		},
428e5f660ebSLv Zheng 	},
429e5f660ebSLv Zheng 	{
430e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win8,
431e5f660ebSLv Zheng 	.ident = "Dell Inspiron 7537",
432e5f660ebSLv Zheng 	.matches = {
433e5f660ebSLv Zheng 		    DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
434e5f660ebSLv Zheng 		    DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7537"),
435e5f660ebSLv Zheng 		},
436e5f660ebSLv Zheng 	},
437e5f660ebSLv Zheng 	{
438e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win8,
439e5f660ebSLv Zheng 	.ident = "Dell Inspiron 5437",
440e5f660ebSLv Zheng 	.matches = {
441e5f660ebSLv Zheng 		    DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
442e5f660ebSLv Zheng 		    DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5437"),
443e5f660ebSLv Zheng 		},
444e5f660ebSLv Zheng 	},
445e5f660ebSLv Zheng 	{
446e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win8,
447e5f660ebSLv Zheng 	.ident = "Dell Inspiron 3437",
448e5f660ebSLv Zheng 	.matches = {
449e5f660ebSLv Zheng 		    DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
450e5f660ebSLv Zheng 		    DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 3437"),
451e5f660ebSLv Zheng 		},
452e5f660ebSLv Zheng 	},
453e5f660ebSLv Zheng 	{
454e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win8,
455e5f660ebSLv Zheng 	.ident = "Dell Vostro 3446",
456e5f660ebSLv Zheng 	.matches = {
457e5f660ebSLv Zheng 		    DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
458e5f660ebSLv Zheng 		    DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3446"),
459e5f660ebSLv Zheng 		},
460e5f660ebSLv Zheng 	},
461e5f660ebSLv Zheng 	{
462e5f660ebSLv Zheng 	.callback = dmi_disable_osi_win8,
463e5f660ebSLv Zheng 	.ident = "Dell Vostro 3546",
464e5f660ebSLv Zheng 	.matches = {
465e5f660ebSLv Zheng 		    DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
466e5f660ebSLv Zheng 		    DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3546"),
467e5f660ebSLv Zheng 		},
468e5f660ebSLv Zheng 	},
469e5f660ebSLv Zheng 
470e5f660ebSLv Zheng 	/*
471e5f660ebSLv Zheng 	 * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
472e5f660ebSLv Zheng 	 * Linux ignores it, except for the machines enumerated below.
473e5f660ebSLv Zheng 	 */
474e5f660ebSLv Zheng 
475e5f660ebSLv Zheng 	/*
476*b4447c0dSCao jin 	 * Without this EEEpc exports a non working WMI interface, with
477*b4447c0dSCao jin 	 * this it exports a working "good old" eeepc_laptop interface,
478*b4447c0dSCao jin 	 * fixing both brightness control, and rfkill not working.
479e5f660ebSLv Zheng 	 */
480e5f660ebSLv Zheng 	{
481e5f660ebSLv Zheng 	.callback = dmi_enable_osi_linux,
482e5f660ebSLv Zheng 	.ident = "Asus EEE PC 1015PX",
483e5f660ebSLv Zheng 	.matches = {
484e5f660ebSLv Zheng 		     DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."),
485e5f660ebSLv Zheng 		     DMI_MATCH(DMI_PRODUCT_NAME, "1015PX"),
486e5f660ebSLv Zheng 		},
487e5f660ebSLv Zheng 	},
488e5f660ebSLv Zheng 	{}
489e5f660ebSLv Zheng };
490e5f660ebSLv Zheng 
491e5f660ebSLv Zheng static __init void acpi_osi_dmi_blacklisted(void)
492e5f660ebSLv Zheng {
493e5f660ebSLv Zheng 	dmi_check_system(acpi_osi_dmi_table);
494630b3affSLukas Wunner 
495630b3affSLukas Wunner 	/* Enable _OSI("Darwin") for Apple platforms. */
496630b3affSLukas Wunner 	if (x86_apple_machine)
497630b3affSLukas Wunner 		acpi_osi_dmi_darwin();
498e5f660ebSLv Zheng }
499e5f660ebSLv Zheng 
500e5f660ebSLv Zheng int __init early_acpi_osi_init(void)
501e5f660ebSLv Zheng {
502e5f660ebSLv Zheng 	acpi_osi_dmi_blacklisted();
503e5f660ebSLv Zheng 
504e5f660ebSLv Zheng 	return 0;
505e5f660ebSLv Zheng }
506e5f660ebSLv Zheng 
507e5f660ebSLv Zheng int __init acpi_osi_init(void)
508e5f660ebSLv Zheng {
509e5f660ebSLv Zheng 	acpi_install_interface_handler(acpi_osi_handler);
510e5f660ebSLv Zheng 	acpi_osi_setup_late();
511e5f660ebSLv Zheng 
512e5f660ebSLv Zheng 	return 0;
513e5f660ebSLv Zheng }
514