blacklist.c 9.3 KB

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