blacklist.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. /*
  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.
  6. * Check given machine against acpi_osi_dmi_table[].
  7. *
  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. #include <linux/kernel.h>
  30. #include <linux/init.h>
  31. #include <linux/acpi.h>
  32. #include <linux/dmi.h>
  33. #include "internal.h"
  34. enum acpi_blacklist_predicates {
  35. all_versions,
  36. less_than_or_equal,
  37. equal,
  38. greater_than_or_equal,
  39. };
  40. struct acpi_blacklist_item {
  41. char oem_id[7];
  42. char oem_table_id[9];
  43. u32 oem_revision;
  44. char *table;
  45. enum acpi_blacklist_predicates oem_revision_predicate;
  46. char *reason;
  47. u32 is_critical_error;
  48. };
  49. static struct dmi_system_id acpi_osi_dmi_table[] __initdata;
  50. /*
  51. * POLICY: If *anything* doesn't work, put it on the blacklist.
  52. * If they are critical errors, mark it critical, and abort driver load.
  53. */
  54. static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
  55. /* Compaq Presario 1700 */
  56. {"PTLTD ", " DSDT ", 0x06040000, ACPI_SIG_DSDT, less_than_or_equal,
  57. "Multiple problems", 1},
  58. /* Sony FX120, FX140, FX150? */
  59. {"SONY ", "U0 ", 0x20010313, ACPI_SIG_DSDT, less_than_or_equal,
  60. "ACPI driver problem", 1},
  61. /* Compaq Presario 800, Insyde BIOS */
  62. {"INT440", "SYSFexxx", 0x00001001, ACPI_SIG_DSDT, less_than_or_equal,
  63. "Does not use _REG to protect EC OpRegions", 1},
  64. /* IBM 600E - _ADR should return 7, but it returns 1 */
  65. {"IBM ", "TP600E ", 0x00000105, ACPI_SIG_DSDT, less_than_or_equal,
  66. "Incorrect _ADR", 1},
  67. {""}
  68. };
  69. int __init acpi_blacklisted(void)
  70. {
  71. int i = 0;
  72. int blacklisted = 0;
  73. struct acpi_table_header table_header;
  74. while (acpi_blacklist[i].oem_id[0] != '\0') {
  75. if (acpi_get_table_header(acpi_blacklist[i].table, 0, &table_header)) {
  76. i++;
  77. continue;
  78. }
  79. if (strncmp(acpi_blacklist[i].oem_id, table_header.oem_id, 6)) {
  80. i++;
  81. continue;
  82. }
  83. if (strncmp
  84. (acpi_blacklist[i].oem_table_id, table_header.oem_table_id,
  85. 8)) {
  86. i++;
  87. continue;
  88. }
  89. if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
  90. || (acpi_blacklist[i].oem_revision_predicate ==
  91. less_than_or_equal
  92. && table_header.oem_revision <=
  93. acpi_blacklist[i].oem_revision)
  94. || (acpi_blacklist[i].oem_revision_predicate ==
  95. greater_than_or_equal
  96. && table_header.oem_revision >=
  97. acpi_blacklist[i].oem_revision)
  98. || (acpi_blacklist[i].oem_revision_predicate == equal
  99. && table_header.oem_revision ==
  100. acpi_blacklist[i].oem_revision)) {
  101. printk(KERN_ERR PREFIX
  102. "Vendor \"%6.6s\" System \"%8.8s\" "
  103. "Revision 0x%x has a known ACPI BIOS problem.\n",
  104. acpi_blacklist[i].oem_id,
  105. acpi_blacklist[i].oem_table_id,
  106. acpi_blacklist[i].oem_revision);
  107. printk(KERN_ERR PREFIX
  108. "Reason: %s. This is a %s error\n",
  109. acpi_blacklist[i].reason,
  110. (acpi_blacklist[i].
  111. is_critical_error ? "non-recoverable" :
  112. "recoverable"));
  113. blacklisted = acpi_blacklist[i].is_critical_error;
  114. break;
  115. } else {
  116. i++;
  117. }
  118. }
  119. dmi_check_system(acpi_osi_dmi_table);
  120. return blacklisted;
  121. }
  122. #ifdef CONFIG_DMI
  123. static int __init dmi_enable_osi_linux(const struct dmi_system_id *d)
  124. {
  125. acpi_dmi_osi_linux(1, d); /* enable */
  126. return 0;
  127. }
  128. static int __init dmi_disable_osi_vista(const struct dmi_system_id *d)
  129. {
  130. printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
  131. acpi_osi_setup("!Windows 2006");
  132. acpi_osi_setup("!Windows 2006 SP1");
  133. acpi_osi_setup("!Windows 2006 SP2");
  134. return 0;
  135. }
  136. static int __init dmi_disable_osi_win7(const struct dmi_system_id *d)
  137. {
  138. printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
  139. acpi_osi_setup("!Windows 2009");
  140. return 0;
  141. }
  142. static int __init dmi_disable_osi_win8(const struct dmi_system_id *d)
  143. {
  144. printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
  145. acpi_osi_setup("!Windows 2012");
  146. return 0;
  147. }
  148. static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
  149. {
  150. .callback = dmi_disable_osi_vista,
  151. .ident = "Fujitsu Siemens",
  152. .matches = {
  153. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  154. DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"),
  155. },
  156. },
  157. {
  158. /*
  159. * There have a NVIF method in MSI GX723 DSDT need call by Nvidia
  160. * driver (e.g. nouveau) when user press brightness hotkey.
  161. * Currently, nouveau driver didn't do the job and it causes there
  162. * have a infinite while loop in DSDT when user press hotkey.
  163. * We add MSI GX723's dmi information to this table for workaround
  164. * this issue.
  165. * Will remove MSI GX723 from the table after nouveau grows support.
  166. */
  167. .callback = dmi_disable_osi_vista,
  168. .ident = "MSI GX723",
  169. .matches = {
  170. DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"),
  171. DMI_MATCH(DMI_PRODUCT_NAME, "GX723"),
  172. },
  173. },
  174. {
  175. .callback = dmi_disable_osi_vista,
  176. .ident = "Sony VGN-NS10J_S",
  177. .matches = {
  178. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  179. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS10J_S"),
  180. },
  181. },
  182. {
  183. .callback = dmi_disable_osi_vista,
  184. .ident = "Sony VGN-SR290J",
  185. .matches = {
  186. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  187. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR290J"),
  188. },
  189. },
  190. {
  191. .callback = dmi_disable_osi_vista,
  192. .ident = "VGN-NS50B_L",
  193. .matches = {
  194. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  195. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS50B_L"),
  196. },
  197. },
  198. {
  199. .callback = dmi_disable_osi_vista,
  200. .ident = "Toshiba Satellite L355",
  201. .matches = {
  202. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  203. DMI_MATCH(DMI_PRODUCT_VERSION, "Satellite L355"),
  204. },
  205. },
  206. {
  207. .callback = dmi_disable_osi_win7,
  208. .ident = "ASUS K50IJ",
  209. .matches = {
  210. DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
  211. DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"),
  212. },
  213. },
  214. {
  215. .callback = dmi_disable_osi_vista,
  216. .ident = "Toshiba P305D",
  217. .matches = {
  218. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  219. DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P305D"),
  220. },
  221. },
  222. {
  223. .callback = dmi_disable_osi_vista,
  224. .ident = "Toshiba NB100",
  225. .matches = {
  226. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  227. DMI_MATCH(DMI_PRODUCT_NAME, "NB100"),
  228. },
  229. },
  230. /*
  231. * The following machines have broken backlight support when reporting
  232. * the Windows 2012 OSI, so disable it until their support is fixed.
  233. */
  234. {
  235. .callback = dmi_disable_osi_win8,
  236. .ident = "ASUS Zenbook Prime UX31A",
  237. .matches = {
  238. DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
  239. DMI_MATCH(DMI_PRODUCT_NAME, "UX31A"),
  240. },
  241. },
  242. {
  243. .callback = dmi_disable_osi_win8,
  244. .ident = "ThinkPad Edge E530",
  245. .matches = {
  246. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  247. DMI_MATCH(DMI_PRODUCT_VERSION, "3259A2G"),
  248. },
  249. },
  250. {
  251. .callback = dmi_disable_osi_win8,
  252. .ident = "ThinkPad Edge E530",
  253. .matches = {
  254. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  255. DMI_MATCH(DMI_PRODUCT_VERSION, "3259CTO"),
  256. },
  257. },
  258. {
  259. .callback = dmi_disable_osi_win8,
  260. .ident = "ThinkPad Edge E530",
  261. .matches = {
  262. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  263. DMI_MATCH(DMI_PRODUCT_VERSION, "3259HJG"),
  264. },
  265. },
  266. {
  267. .callback = dmi_disable_osi_win8,
  268. .ident = "Acer Aspire V5-573G",
  269. .matches = {
  270. DMI_MATCH(DMI_SYS_VENDOR, "Acer Aspire"),
  271. DMI_MATCH(DMI_PRODUCT_VERSION, "V5-573G/Dazzle_HW"),
  272. },
  273. },
  274. {
  275. .callback = dmi_disable_osi_win8,
  276. .ident = "Acer Aspire V5-572G",
  277. .matches = {
  278. DMI_MATCH(DMI_SYS_VENDOR, "Acer Aspire"),
  279. DMI_MATCH(DMI_PRODUCT_VERSION, "V5-572G/Dazzle_CX"),
  280. },
  281. },
  282. {
  283. .callback = dmi_disable_osi_win8,
  284. .ident = "ThinkPad T431s",
  285. .matches = {
  286. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  287. DMI_MATCH(DMI_PRODUCT_VERSION, "20AACTO1WW"),
  288. },
  289. },
  290. {
  291. .callback = dmi_disable_osi_win8,
  292. .ident = "ThinkPad T430",
  293. .matches = {
  294. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  295. DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"),
  296. },
  297. },
  298. {
  299. .callback = dmi_disable_osi_win8,
  300. .ident = "Dell Inspiron 7737",
  301. .matches = {
  302. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  303. DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7737"),
  304. },
  305. },
  306. /*
  307. * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
  308. * Linux ignores it, except for the machines enumerated below.
  309. */
  310. /*
  311. * Lenovo has a mix of systems OSI(Linux) situations
  312. * and thus we can not wildcard the vendor.
  313. *
  314. * _OSI(Linux) helps sound
  315. * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad R61"),
  316. * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T61"),
  317. * T400, T500
  318. * _OSI(Linux) has Linux specific hooks
  319. * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"),
  320. * _OSI(Linux) is a NOP:
  321. * DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"),
  322. * DMI_MATCH(DMI_PRODUCT_VERSION, "LENOVO3000 V100"),
  323. */
  324. {
  325. .callback = dmi_enable_osi_linux,
  326. .ident = "Lenovo ThinkPad R61",
  327. .matches = {
  328. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  329. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad R61"),
  330. },
  331. },
  332. {
  333. .callback = dmi_enable_osi_linux,
  334. .ident = "Lenovo ThinkPad T61",
  335. .matches = {
  336. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  337. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T61"),
  338. },
  339. },
  340. {
  341. .callback = dmi_enable_osi_linux,
  342. .ident = "Lenovo ThinkPad X61",
  343. .matches = {
  344. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  345. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"),
  346. },
  347. },
  348. {
  349. .callback = dmi_enable_osi_linux,
  350. .ident = "Lenovo ThinkPad T400",
  351. .matches = {
  352. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  353. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T400"),
  354. },
  355. },
  356. {
  357. .callback = dmi_enable_osi_linux,
  358. .ident = "Lenovo ThinkPad T500",
  359. .matches = {
  360. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  361. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T500"),
  362. },
  363. },
  364. /*
  365. * Without this this EEEpc exports a non working WMI interface, with
  366. * this it exports a working "good old" eeepc_laptop interface, fixing
  367. * both brightness control, and rfkill not working.
  368. */
  369. {
  370. .callback = dmi_enable_osi_linux,
  371. .ident = "Asus EEE PC 1015PX",
  372. .matches = {
  373. DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."),
  374. DMI_MATCH(DMI_PRODUCT_NAME, "1015PX"),
  375. },
  376. },
  377. {}
  378. };
  379. #endif /* CONFIG_DMI */