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