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