blacklist.c 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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. return 0;
  166. }
  167. static int __init dmi_disable_osi_win7(const struct dmi_system_id *d)
  168. {
  169. printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
  170. acpi_osi_setup("!Windows 2009");
  171. return 0;
  172. }
  173. static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
  174. {
  175. .callback = dmi_disable_osi_vista,
  176. .ident = "Fujitsu Siemens",
  177. .matches = {
  178. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  179. DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"),
  180. },
  181. },
  182. {
  183. .callback = dmi_disable_osi_vista,
  184. .ident = "Sony VGN-NS10J_S",
  185. .matches = {
  186. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  187. DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS10J_S"),
  188. },
  189. },
  190. {
  191. .callback = dmi_disable_osi_vista,
  192. .ident = "Sony VGN-SR290J",
  193. .matches = {
  194. DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
  195. DMI_MATCH(DMI_PRODUCT_NAME, "Sony VGN-SR290J"),
  196. },
  197. },
  198. {
  199. .callback = dmi_disable_osi_win7,
  200. .ident = "ASUS K50IJ",
  201. .matches = {
  202. DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
  203. DMI_MATCH(DMI_PRODUCT_NAME, "K50IJ"),
  204. },
  205. },
  206. /*
  207. * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
  208. * Linux ignores it, except for the machines enumerated below.
  209. */
  210. /*
  211. * Lenovo has a mix of systems OSI(Linux) situations
  212. * and thus we can not wildcard the vendor.
  213. *
  214. * _OSI(Linux) helps sound
  215. * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad R61"),
  216. * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T61"),
  217. * T400, T500
  218. * _OSI(Linux) has Linux specific hooks
  219. * DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"),
  220. * _OSI(Linux) is a NOP:
  221. * DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"),
  222. * DMI_MATCH(DMI_PRODUCT_VERSION, "LENOVO3000 V100"),
  223. */
  224. {
  225. .callback = dmi_enable_osi_linux,
  226. .ident = "Lenovo ThinkPad R61",
  227. .matches = {
  228. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  229. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad R61"),
  230. },
  231. },
  232. {
  233. .callback = dmi_enable_osi_linux,
  234. .ident = "Lenovo ThinkPad T61",
  235. .matches = {
  236. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  237. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T61"),
  238. },
  239. },
  240. {
  241. .callback = dmi_enable_osi_linux,
  242. .ident = "Lenovo ThinkPad X61",
  243. .matches = {
  244. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  245. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X61"),
  246. },
  247. },
  248. {
  249. .callback = dmi_enable_osi_linux,
  250. .ident = "Lenovo ThinkPad T400",
  251. .matches = {
  252. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  253. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T400"),
  254. },
  255. },
  256. {
  257. .callback = dmi_enable_osi_linux,
  258. .ident = "Lenovo ThinkPad T500",
  259. .matches = {
  260. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  261. DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T500"),
  262. },
  263. },
  264. {}
  265. };
  266. #endif /* CONFIG_DMI */