blacklist.c 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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/module.h>
  31. #include <linux/init.h>
  32. #include <linux/acpi.h>
  33. #include <acpi/acpi_bus.h>
  34. #include <linux/dmi.h>
  35. #include "internal.h"
  36. enum acpi_blacklist_predicates {
  37. all_versions,
  38. less_than_or_equal,
  39. equal,
  40. greater_than_or_equal,
  41. };
  42. struct acpi_blacklist_item {
  43. char oem_id[7];
  44. char oem_table_id[9];
  45. u32 oem_revision;
  46. char *table;
  47. enum acpi_blacklist_predicates oem_revision_predicate;
  48. char *reason;
  49. u32 is_critical_error;
  50. };
  51. static struct dmi_system_id acpi_osi_dmi_table[] __initdata;
  52. /*
  53. * POLICY: If *anything* doesn't work, put it on the blacklist.
  54. * If they are critical errors, mark it critical, and abort driver load.
  55. */
  56. static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
  57. /* Compaq Presario 1700 */
  58. {"PTLTD ", " DSDT ", 0x06040000, ACPI_SIG_DSDT, less_than_or_equal,
  59. "Multiple problems", 1},
  60. /* Sony FX120, FX140, FX150? */
  61. {"SONY ", "U0 ", 0x20010313, ACPI_SIG_DSDT, less_than_or_equal,
  62. "ACPI driver problem", 1},
  63. /* Compaq Presario 800, Insyde BIOS */
  64. {"INT440", "SYSFexxx", 0x00001001, ACPI_SIG_DSDT, less_than_or_equal,
  65. "Does not use _REG to protect EC OpRegions", 1},
  66. /* IBM 600E - _ADR should return 7, but it returns 1 */
  67. {"IBM ", "TP600E ", 0x00000105, ACPI_SIG_DSDT, less_than_or_equal,
  68. "Incorrect _ADR", 1},
  69. {""}
  70. };
  71. #if CONFIG_ACPI_BLACKLIST_YEAR
  72. static int __init blacklist_by_year(void)
  73. {
  74. int year;
  75. /* Doesn't exist? Likely an old system */
  76. if (!dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL)) {
  77. printk(KERN_ERR PREFIX "no DMI BIOS year, "
  78. "acpi=force is required to enable ACPI\n" );
  79. return 1;
  80. }
  81. /* 0? Likely a buggy new BIOS */
  82. if (year == 0) {
  83. printk(KERN_ERR PREFIX "DMI BIOS year==0, "
  84. "assuming ACPI-capable machine\n" );
  85. return 0;
  86. }
  87. if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
  88. printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
  89. "acpi=force is required to enable ACPI\n",
  90. year, CONFIG_ACPI_BLACKLIST_YEAR);
  91. return 1;
  92. }
  93. return 0;
  94. }
  95. #else
  96. static inline int blacklist_by_year(void)
  97. {
  98. return 0;
  99. }
  100. #endif
  101. int __init acpi_blacklisted(void)
  102. {
  103. int i = 0;
  104. int blacklisted = 0;
  105. struct acpi_table_header table_header;
  106. while (acpi_blacklist[i].oem_id[0] != '\0') {
  107. if (acpi_get_table_header(acpi_blacklist[i].table, 0, &table_header)) {
  108. i++;
  109. continue;
  110. }
  111. if (strncmp(acpi_blacklist[i].oem_id, table_header.oem_id, 6)) {
  112. i++;
  113. continue;
  114. }
  115. if (strncmp
  116. (acpi_blacklist[i].oem_table_id, table_header.oem_table_id,
  117. 8)) {
  118. i++;
  119. continue;
  120. }
  121. if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
  122. || (acpi_blacklist[i].oem_revision_predicate ==
  123. less_than_or_equal
  124. && table_header.oem_revision <=
  125. acpi_blacklist[i].oem_revision)
  126. || (acpi_blacklist[i].oem_revision_predicate ==
  127. greater_than_or_equal
  128. && table_header.oem_revision >=
  129. acpi_blacklist[i].oem_revision)
  130. || (acpi_blacklist[i].oem_revision_predicate == equal
  131. && table_header.oem_revision ==
  132. acpi_blacklist[i].oem_revision)) {
  133. printk(KERN_ERR PREFIX
  134. "Vendor \"%6.6s\" System \"%8.8s\" "
  135. "Revision 0x%x has a known ACPI BIOS problem.\n",
  136. acpi_blacklist[i].oem_id,
  137. acpi_blacklist[i].oem_table_id,
  138. acpi_blacklist[i].oem_revision);
  139. printk(KERN_ERR PREFIX
  140. "Reason: %s. This is a %s error\n",
  141. acpi_blacklist[i].reason,
  142. (acpi_blacklist[i].
  143. is_critical_error ? "non-recoverable" :
  144. "recoverable"));
  145. blacklisted = acpi_blacklist[i].is_critical_error;
  146. break;
  147. } else {
  148. i++;
  149. }
  150. }
  151. blacklisted += blacklist_by_year();
  152. dmi_check_system(acpi_osi_dmi_table);
  153. return blacklisted;
  154. }
  155. #ifdef CONFIG_DMI
  156. static int __init dmi_enable_osi_linux(const struct dmi_system_id *d)
  157. {
  158. acpi_dmi_osi_linux(1, d); /* enable */
  159. return 0;
  160. }
  161. static int __init dmi_disable_osi_vista(const struct dmi_system_id *d)
  162. {
  163. printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
  164. acpi_osi_setup("!Windows 2006");
  165. acpi_osi_setup("!Windows 2006 SP1");
  166. acpi_osi_setup("!Windows 2006 SP2");
  167. return 0;
  168. }
  169. static int __init dmi_disable_osi_win7(const struct dmi_system_id *d)
  170. {
  171. printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
  172. acpi_osi_setup("!Windows 2009");
  173. return 0;
  174. }
  175. static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
  176. {
  177. .callback = dmi_disable_osi_vista,
  178. .ident = "Fujitsu Siemens",
  179. .matches = {
  180. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  181. DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"),
  182. },
  183. },
  184. {
  185. /*
  186. * There have a NVIF method in MSI GX723 DSDT need call by Nvidia
  187. * driver (e.g. nouveau) when user press brightness hotkey.
  188. * Currently, nouveau driver didn't do the job and it causes there
  189. * have a infinite while loop in DSDT when user press hotkey.
  190. * We add MSI GX723's dmi information to this table for workaround
  191. * this issue.
  192. * Will remove MSI GX723 from the table after nouveau grows support.
  193. */
  194. .callback = dmi_disable_osi_vista,
  195. .ident = "MSI GX723",
  196. .matches = {
  197. DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star International"),
  198. DMI_MATCH(DMI_PRODUCT_NAME, "GX723"),
  199. },
  200. },
  201. {
  202. .callback = dmi_disable_osi_vista,
  203. .ident = "Sony VGN-NS10J_S",
  204. .matches = {
  205. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  206. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS10J_S"),
  207. },
  208. },
  209. {
  210. .callback = dmi_disable_osi_vista,
  211. .ident = "Sony VGN-SR290J",
  212. .matches = {
  213. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  214. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR290J"),
  215. },
  216. },
  217. {
  218. .callback = dmi_disable_osi_vista,
  219. .ident = "VGN-NS50B_L",
  220. .matches = {
  221. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  222. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS50B_L"),
  223. },
  224. },
  225. {
  226. .callback = dmi_disable_osi_vista,
  227. .ident = "Toshiba Satellite L355",
  228. .matches = {
  229. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  230. DMI_MATCH(DMI_PRODUCT_VERSION, "Satellite L355"),
  231. },
  232. },
  233. {
  234. .callback = dmi_disable_osi_win7,
  235. .ident = "ASUS K50IJ",
  236. .matches = {
  237. DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
  238. DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"),
  239. },
  240. },
  241. {
  242. .callback = dmi_disable_osi_vista,
  243. .ident = "Toshiba P305D",
  244. .matches = {
  245. DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
  246. DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P305D"),
  247. },
  248. },
  249. /*
  250. * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
  251. * Linux ignores it, except for the machines enumerated below.
  252. */
  253. /*
  254. * Lenovo has a mix of systems OSI(Linux) situations
  255. * and thus we can not wildcard the vendor.
  256. *
  257. * _OSI(Linux) helps sound
  258. * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad R61"),
  259. * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T61"),
  260. * T400, T500
  261. * _OSI(Linux) has Linux specific hooks
  262. * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"),
  263. * _OSI(Linux) is a NOP:
  264. * DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"),
  265. * DMI_MATCH(DMI_PRODUCT_VERSION, "LENOVO3000 V100"),
  266. */
  267. {
  268. .callback = dmi_enable_osi_linux,
  269. .ident = "Lenovo ThinkPad R61",
  270. .matches = {
  271. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  272. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad R61"),
  273. },
  274. },
  275. {
  276. .callback = dmi_enable_osi_linux,
  277. .ident = "Lenovo ThinkPad T61",
  278. .matches = {
  279. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  280. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T61"),
  281. },
  282. },
  283. {
  284. .callback = dmi_enable_osi_linux,
  285. .ident = "Lenovo ThinkPad X61",
  286. .matches = {
  287. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  288. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"),
  289. },
  290. },
  291. {
  292. .callback = dmi_enable_osi_linux,
  293. .ident = "Lenovo ThinkPad T400",
  294. .matches = {
  295. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  296. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T400"),
  297. },
  298. },
  299. {
  300. .callback = dmi_enable_osi_linux,
  301. .ident = "Lenovo ThinkPad T500",
  302. .matches = {
  303. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  304. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T500"),
  305. },
  306. },
  307. {}
  308. };
  309. #endif /* CONFIG_DMI */