blacklist.c 10 KB

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