blacklist.c 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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. #ifdef CONFIG_ACPI_REV_OVERRIDE_POSSIBLE
  149. static int __init dmi_enable_rev_override(const struct dmi_system_id *d)
  150. {
  151. printk(KERN_NOTICE PREFIX "DMI detected: %s (force ACPI _REV to 5)\n",
  152. d->ident);
  153. acpi_rev_override_setup(NULL);
  154. return 0;
  155. }
  156. #endif
  157. static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
  158. {
  159. .callback = dmi_disable_osi_vista,
  160. .ident = "Fujitsu Siemens",
  161. .matches = {
  162. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  163. DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"),
  164. },
  165. },
  166. {
  167. /*
  168. * There have a NVIF method in MSI GX723 DSDT need call by Nvidia
  169. * driver (e.g. nouveau) when user press brightness hotkey.
  170. * Currently, nouveau driver didn't do the job and it causes there
  171. * have a infinite while loop in DSDT when user press hotkey.
  172. * We add MSI GX723's dmi information to this table for workaround
  173. * this issue.
  174. * Will remove MSI GX723 from the table after nouveau grows support.
  175. */
  176. .callback = dmi_disable_osi_vista,
  177. .ident = "MSI GX723",
  178. .matches = {
  179. DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"),
  180. DMI_MATCH(DMI_PRODUCT_NAME, "GX723"),
  181. },
  182. },
  183. {
  184. .callback = dmi_disable_osi_vista,
  185. .ident = "Sony VGN-NS10J_S",
  186. .matches = {
  187. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  188. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS10J_S"),
  189. },
  190. },
  191. {
  192. .callback = dmi_disable_osi_vista,
  193. .ident = "Sony VGN-SR290J",
  194. .matches = {
  195. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  196. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR290J"),
  197. },
  198. },
  199. {
  200. .callback = dmi_disable_osi_vista,
  201. .ident = "VGN-NS50B_L",
  202. .matches = {
  203. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  204. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS50B_L"),
  205. },
  206. },
  207. {
  208. .callback = dmi_disable_osi_vista,
  209. .ident = "VGN-SR19XN",
  210. .matches = {
  211. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  212. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR19XN"),
  213. },
  214. },
  215. {
  216. .callback = dmi_disable_osi_vista,
  217. .ident = "Toshiba Satellite L355",
  218. .matches = {
  219. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  220. DMI_MATCH(DMI_PRODUCT_VERSION, "Satellite L355"),
  221. },
  222. },
  223. {
  224. .callback = dmi_disable_osi_win7,
  225. .ident = "ASUS K50IJ",
  226. .matches = {
  227. DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
  228. DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"),
  229. },
  230. },
  231. {
  232. .callback = dmi_disable_osi_vista,
  233. .ident = "Toshiba P305D",
  234. .matches = {
  235. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  236. DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P305D"),
  237. },
  238. },
  239. {
  240. .callback = dmi_disable_osi_vista,
  241. .ident = "Toshiba NB100",
  242. .matches = {
  243. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  244. DMI_MATCH(DMI_PRODUCT_NAME, "NB100"),
  245. },
  246. },
  247. /*
  248. * The wireless hotkey does not work on those machines when
  249. * returning true for _OSI("Windows 2012")
  250. */
  251. {
  252. .callback = dmi_disable_osi_win8,
  253. .ident = "Dell Inspiron 7737",
  254. .matches = {
  255. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  256. DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7737"),
  257. },
  258. },
  259. {
  260. .callback = dmi_disable_osi_win8,
  261. .ident = "Dell Inspiron 7537",
  262. .matches = {
  263. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  264. DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 7537"),
  265. },
  266. },
  267. {
  268. .callback = dmi_disable_osi_win8,
  269. .ident = "Dell Inspiron 5437",
  270. .matches = {
  271. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  272. DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5437"),
  273. },
  274. },
  275. {
  276. .callback = dmi_disable_osi_win8,
  277. .ident = "Dell Inspiron 3437",
  278. .matches = {
  279. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  280. DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 3437"),
  281. },
  282. },
  283. {
  284. .callback = dmi_disable_osi_win8,
  285. .ident = "Dell Vostro 3446",
  286. .matches = {
  287. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  288. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3446"),
  289. },
  290. },
  291. {
  292. .callback = dmi_disable_osi_win8,
  293. .ident = "Dell Vostro 3546",
  294. .matches = {
  295. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  296. DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3546"),
  297. },
  298. },
  299. /*
  300. * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
  301. * Linux ignores it, except for the machines enumerated below.
  302. */
  303. /*
  304. * Without this this EEEpc exports a non working WMI interface, with
  305. * this it exports a working "good old" eeepc_laptop interface, fixing
  306. * both brightness control, and rfkill not working.
  307. */
  308. {
  309. .callback = dmi_enable_osi_linux,
  310. .ident = "Asus EEE PC 1015PX",
  311. .matches = {
  312. DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."),
  313. DMI_MATCH(DMI_PRODUCT_NAME, "1015PX"),
  314. },
  315. },
  316. #ifdef CONFIG_ACPI_REV_OVERRIDE_POSSIBLE
  317. /*
  318. * DELL XPS 13 (2015) switches sound between HDA and I2S
  319. * depending on the ACPI _REV callback. If userspace supports
  320. * I2S sufficiently (or if you do not care about sound), you
  321. * can safely disable this quirk.
  322. */
  323. {
  324. .callback = dmi_enable_rev_override,
  325. .ident = "DELL XPS 13 (2015)",
  326. .matches = {
  327. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  328. DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9343"),
  329. },
  330. },
  331. #endif
  332. {}
  333. };
  334. #endif /* CONFIG_DMI */