blob: 0c4ca4d318b32b94dcd69d3324d8172d71efa0e7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * blacklist.c
3 *
4 * Check to see if the given machine has a known bad ACPI BIOS
5 * or if the BIOS is too old.
Len Brownd4b7dc42008-01-23 20:50:56 -05006 * Check given machine against acpi_osi_dmi_table[].
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 *
8 * Copyright (C) 2004 Len Brown <len.brown@intel.com>
9 * Copyright (C) 2002 Andy Grover <andrew.grover@intel.com>
10 *
11 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or (at
16 * your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 *
27 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28 */
29
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include <linux/kernel.h>
31#include <linux/module.h>
32#include <linux/init.h>
33#include <linux/acpi.h>
34#include <acpi/acpi_bus.h>
35#include <linux/dmi.h>
36
Len Brown4be44fc2005-08-05 00:44:28 -040037enum acpi_blacklist_predicates {
38 all_versions,
39 less_than_or_equal,
40 equal,
41 greater_than_or_equal,
Linus Torvalds1da177e2005-04-16 15:20:36 -070042};
43
Len Brown4be44fc2005-08-05 00:44:28 -040044struct acpi_blacklist_item {
45 char oem_id[7];
46 char oem_table_id[9];
47 u32 oem_revision;
Alexey Starikovskiyad71860a2007-02-02 19:48:19 +030048 char *table;
Len Brown4be44fc2005-08-05 00:44:28 -040049 enum acpi_blacklist_predicates oem_revision_predicate;
50 char *reason;
51 u32 is_critical_error;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052};
53
Len Brownd4b7dc42008-01-23 20:50:56 -050054static struct dmi_system_id acpi_osi_dmi_table[] __initdata;
55
Linus Torvalds1da177e2005-04-16 15:20:36 -070056/*
57 * POLICY: If *anything* doesn't work, put it on the blacklist.
58 * If they are critical errors, mark it critical, and abort driver load.
59 */
Len Brown4be44fc2005-08-05 00:44:28 -040060static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 /* Compaq Presario 1700 */
Alexey Starikovskiyad71860a2007-02-02 19:48:19 +030062 {"PTLTD ", " DSDT ", 0x06040000, ACPI_SIG_DSDT, less_than_or_equal,
Len Brown4be44fc2005-08-05 00:44:28 -040063 "Multiple problems", 1},
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 /* Sony FX120, FX140, FX150? */
Alexey Starikovskiyad71860a2007-02-02 19:48:19 +030065 {"SONY ", "U0 ", 0x20010313, ACPI_SIG_DSDT, less_than_or_equal,
Len Brown4be44fc2005-08-05 00:44:28 -040066 "ACPI driver problem", 1},
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 /* Compaq Presario 800, Insyde BIOS */
Alexey Starikovskiyad71860a2007-02-02 19:48:19 +030068 {"INT440", "SYSFexxx", 0x00001001, ACPI_SIG_DSDT, less_than_or_equal,
Len Brown4be44fc2005-08-05 00:44:28 -040069 "Does not use _REG to protect EC OpRegions", 1},
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 /* IBM 600E - _ADR should return 7, but it returns 1 */
Alexey Starikovskiyad71860a2007-02-02 19:48:19 +030071 {"IBM ", "TP600E ", 0x00000105, ACPI_SIG_DSDT, less_than_or_equal,
Len Brown4be44fc2005-08-05 00:44:28 -040072 "Incorrect _ADR", 1},
Linus Torvalds1da177e2005-04-16 15:20:36 -070073
74 {""}
75};
76
Linus Torvalds1da177e2005-04-16 15:20:36 -070077#if CONFIG_ACPI_BLACKLIST_YEAR
78
Len Brown4be44fc2005-08-05 00:44:28 -040079static int __init blacklist_by_year(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070080{
Tejun Heo3e5cd1f2009-08-16 21:02:36 +090081 int year;
82
Andi Kleenf083a322006-03-25 16:30:19 +010083 /* Doesn't exist? Likely an old system */
Tejun Heo3e5cd1f2009-08-16 21:02:36 +090084 if (!dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL)) {
Anthony Godshall, Ampro Computers, Inc5b27b172007-03-09 21:19:05 -050085 printk(KERN_ERR PREFIX "no DMI BIOS year, "
86 "acpi=force is required to enable ACPI\n" );
Andi Kleenf083a322006-03-25 16:30:19 +010087 return 1;
Anthony Godshall, Ampro Computers, Inc5b27b172007-03-09 21:19:05 -050088 }
Andi Kleenf083a322006-03-25 16:30:19 +010089 /* 0? Likely a buggy new BIOS */
Anthony Godshall, Ampro Computers, Inc5b27b172007-03-09 21:19:05 -050090 if (year == 0) {
91 printk(KERN_ERR PREFIX "DMI BIOS year==0, "
92 "assuming ACPI-capable machine\n" );
Linus Torvalds1da177e2005-04-16 15:20:36 -070093 return 0;
Anthony Godshall, Ampro Computers, Inc5b27b172007-03-09 21:19:05 -050094 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
Len Brown4be44fc2005-08-05 00:44:28 -040096 printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
97 "acpi=force is required to enable ACPI\n",
98 year, CONFIG_ACPI_BLACKLIST_YEAR);
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 return 1;
100 }
101 return 0;
102}
103#else
Len Brown4be44fc2005-08-05 00:44:28 -0400104static inline int blacklist_by_year(void)
105{
106 return 0;
107}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108#endif
109
Len Brown4be44fc2005-08-05 00:44:28 -0400110int __init acpi_blacklisted(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111{
112 int i = 0;
113 int blacklisted = 0;
Alexey Starikovskiy428f2112007-02-02 19:48:22 +0300114 struct acpi_table_header table_header;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115
Len Brown4be44fc2005-08-05 00:44:28 -0400116 while (acpi_blacklist[i].oem_id[0] != '\0') {
Alexey Starikovskiyad71860a2007-02-02 19:48:19 +0300117 if (acpi_get_table_header(acpi_blacklist[i].table, 0, &table_header)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 i++;
119 continue;
120 }
121
Alexey Starikovskiy428f2112007-02-02 19:48:22 +0300122 if (strncmp(acpi_blacklist[i].oem_id, table_header.oem_id, 6)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 i++;
124 continue;
125 }
126
Len Brown4be44fc2005-08-05 00:44:28 -0400127 if (strncmp
Alexey Starikovskiy428f2112007-02-02 19:48:22 +0300128 (acpi_blacklist[i].oem_table_id, table_header.oem_table_id,
Len Brown4be44fc2005-08-05 00:44:28 -0400129 8)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130 i++;
131 continue;
132 }
133
134 if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
Len Brown4be44fc2005-08-05 00:44:28 -0400135 || (acpi_blacklist[i].oem_revision_predicate ==
136 less_than_or_equal
Alexey Starikovskiy428f2112007-02-02 19:48:22 +0300137 && table_header.oem_revision <=
Len Brown4be44fc2005-08-05 00:44:28 -0400138 acpi_blacklist[i].oem_revision)
139 || (acpi_blacklist[i].oem_revision_predicate ==
140 greater_than_or_equal
Alexey Starikovskiy428f2112007-02-02 19:48:22 +0300141 && table_header.oem_revision >=
Len Brown4be44fc2005-08-05 00:44:28 -0400142 acpi_blacklist[i].oem_revision)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 || (acpi_blacklist[i].oem_revision_predicate == equal
Alexey Starikovskiy428f2112007-02-02 19:48:22 +0300144 && table_header.oem_revision ==
Len Brown4be44fc2005-08-05 00:44:28 -0400145 acpi_blacklist[i].oem_revision)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146
Len Brown4be44fc2005-08-05 00:44:28 -0400147 printk(KERN_ERR PREFIX
148 "Vendor \"%6.6s\" System \"%8.8s\" "
149 "Revision 0x%x has a known ACPI BIOS problem.\n",
150 acpi_blacklist[i].oem_id,
151 acpi_blacklist[i].oem_table_id,
152 acpi_blacklist[i].oem_revision);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153
Len Brown4be44fc2005-08-05 00:44:28 -0400154 printk(KERN_ERR PREFIX
155 "Reason: %s. This is a %s error\n",
156 acpi_blacklist[i].reason,
157 (acpi_blacklist[i].
158 is_critical_error ? "non-recoverable" :
159 "recoverable"));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160
161 blacklisted = acpi_blacklist[i].is_critical_error;
162 break;
Len Brown4be44fc2005-08-05 00:44:28 -0400163 } else {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164 i++;
165 }
166 }
167
168 blacklisted += blacklist_by_year();
169
Len Brownd4b7dc42008-01-23 20:50:56 -0500170 dmi_check_system(acpi_osi_dmi_table);
171
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172 return blacklisted;
173}
Len Brownd4b7dc42008-01-23 20:50:56 -0500174#ifdef CONFIG_DMI
Len Brown98f1db22008-01-23 20:56:18 -0500175static int __init dmi_enable_osi_linux(const struct dmi_system_id *d)
176{
177 acpi_dmi_osi_linux(1, d); /* enable */
178 return 0;
179}
Len Brown46c1fbd2008-02-13 23:13:25 -0500180static int __init dmi_disable_osi_vista(const struct dmi_system_id *d)
181{
182 printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
183 acpi_osi_setup("!Windows 2006");
184 return 0;
185}
Len Browna1bd4e32008-01-23 21:19:27 -0500186
Len Brownd4b7dc42008-01-23 20:50:56 -0500187static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
Len Brown46c1fbd2008-02-13 23:13:25 -0500188 {
189 .callback = dmi_disable_osi_vista,
190 .ident = "Fujitsu Siemens",
191 .matches = {
192 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
Len Browna6e08872008-11-08 01:21:10 -0500193 DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"),
Len Brown46c1fbd2008-02-13 23:13:25 -0500194 },
195 },
Zhang Rui35a7c64f2009-06-22 11:31:17 +0800196 {
197 .callback = dmi_disable_osi_vista,
198 .ident = "Sony VGN-NS10J_S",
199 .matches = {
200 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
201 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS10J_S"),
202 },
203 },
204 {
205 .callback = dmi_disable_osi_vista,
206 .ident = "Sony VGN-SR290J",
207 .matches = {
208 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
209 DMI_MATCH(DMI_PRODUCT_NAME, "Sony VGN-SR290J"),
210 },
211 },
Len Browna6e08872008-11-08 01:21:10 -0500212
Len Browna1bd4e32008-01-23 21:19:27 -0500213 /*
Len Browna6e08872008-11-08 01:21:10 -0500214 * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
215 * Linux ignores it, except for the machines enumerated below.
Len Browna1bd4e32008-01-23 21:19:27 -0500216 */
Len Browna6e08872008-11-08 01:21:10 -0500217
Len Browna1bd4e32008-01-23 21:19:27 -0500218 /*
219 * Lenovo has a mix of systems OSI(Linux) situations
220 * and thus we can not wildcard the vendor.
221 *
Len Brown98f1db22008-01-23 20:56:18 -0500222 * _OSI(Linux) helps sound
223 * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad R61"),
224 * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T61"),
Len Brownbb546752008-02-10 21:29:56 -0500225 * _OSI(Linux) has Linux specific hooks
226 * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"),
Len Browna1bd4e32008-01-23 21:19:27 -0500227 * _OSI(Linux) is a NOP:
228 * DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"),
Len Brownbb546752008-02-10 21:29:56 -0500229 * DMI_MATCH(DMI_PRODUCT_VERSION, "LENOVO3000 V100"),
Len Brown98f1db22008-01-23 20:56:18 -0500230 */
231 {
232 .callback = dmi_enable_osi_linux,
233 .ident = "Lenovo ThinkPad R61",
234 .matches = {
235 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
236 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad R61"),
237 },
238 },
239 {
240 .callback = dmi_enable_osi_linux,
241 .ident = "Lenovo ThinkPad T61",
242 .matches = {
243 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
244 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T61"),
245 },
246 },
Len Browna1bd4e32008-01-23 21:19:27 -0500247 {
Len Brownbb546752008-02-10 21:29:56 -0500248 .callback = dmi_enable_osi_linux,
Len Brown446b1df2008-02-07 16:23:00 -0500249 .ident = "Lenovo ThinkPad X61",
250 .matches = {
251 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
252 DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"),
253 },
254 },
Len Brownd4b7dc42008-01-23 20:50:56 -0500255 {}
256};
257
258#endif /* CONFIG_DMI */