blacklist.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. *
  7. * Copyright (C) 2004 Len Brown <len.brown@intel.com>
  8. * Copyright (C) 2002 Andy Grover <andrew.grover@intel.com>
  9. *
  10. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2 of the License, or (at
  15. * your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful, but
  18. * WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License along
  23. * with this program; if not, write to the Free Software Foundation, Inc.,
  24. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  25. *
  26. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  27. */
  28. #include <linux/kernel.h>
  29. #include <linux/module.h>
  30. #include <linux/init.h>
  31. #include <linux/acpi.h>
  32. #include <acpi/acpi_bus.h>
  33. #include <linux/dmi.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. acpi_table_type table;
  45. enum acpi_blacklist_predicates oem_revision_predicate;
  46. char *reason;
  47. u32 is_critical_error;
  48. };
  49. /*
  50. * POLICY: If *anything* doesn't work, put it on the blacklist.
  51. * If they are critical errors, mark it critical, and abort driver load.
  52. */
  53. static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
  54. /* Compaq Presario 1700 */
  55. {"PTLTD ", " DSDT ", 0x06040000, ACPI_DSDT, less_than_or_equal,
  56. "Multiple problems", 1},
  57. /* Sony FX120, FX140, FX150? */
  58. {"SONY ", "U0 ", 0x20010313, ACPI_DSDT, less_than_or_equal,
  59. "ACPI driver problem", 1},
  60. /* Compaq Presario 800, Insyde BIOS */
  61. {"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal,
  62. "Does not use _REG to protect EC OpRegions", 1},
  63. /* IBM 600E - _ADR should return 7, but it returns 1 */
  64. {"IBM ", "TP600E ", 0x00000105, ACPI_DSDT, less_than_or_equal,
  65. "Incorrect _ADR", 1},
  66. {"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions,
  67. "Bogus PCI routing", 1},
  68. {""}
  69. };
  70. #if CONFIG_ACPI_BLACKLIST_YEAR
  71. static int __init blacklist_by_year(void)
  72. {
  73. int year;
  74. char *s = dmi_get_system_info(DMI_BIOS_DATE);
  75. if (!s)
  76. return 0;
  77. if (!*s)
  78. return 0;
  79. s = strrchr(s, '/');
  80. if (!s)
  81. return 0;
  82. s += 1;
  83. year = simple_strtoul(s, NULL, 0);
  84. if (year < 100) { /* 2-digit year */
  85. year += 1900;
  86. if (year < 1996) /* no dates < spec 1.0 */
  87. year += 100;
  88. }
  89. if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
  90. printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
  91. "acpi=force is required to enable ACPI\n",
  92. year, CONFIG_ACPI_BLACKLIST_YEAR);
  93. return 1;
  94. }
  95. return 0;
  96. }
  97. #else
  98. static inline int blacklist_by_year(void)
  99. {
  100. return 0;
  101. }
  102. #endif
  103. int __init acpi_blacklisted(void)
  104. {
  105. int i = 0;
  106. int blacklisted = 0;
  107. struct acpi_table_header *table_header;
  108. while (acpi_blacklist[i].oem_id[0] != '\0') {
  109. if (acpi_get_table_header_early
  110. (acpi_blacklist[i].table, &table_header)) {
  111. i++;
  112. continue;
  113. }
  114. if (strncmp(acpi_blacklist[i].oem_id, table_header->oem_id, 6)) {
  115. i++;
  116. continue;
  117. }
  118. if (strncmp
  119. (acpi_blacklist[i].oem_table_id, table_header->oem_table_id,
  120. 8)) {
  121. i++;
  122. continue;
  123. }
  124. if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
  125. || (acpi_blacklist[i].oem_revision_predicate ==
  126. less_than_or_equal
  127. && table_header->oem_revision <=
  128. acpi_blacklist[i].oem_revision)
  129. || (acpi_blacklist[i].oem_revision_predicate ==
  130. greater_than_or_equal
  131. && table_header->oem_revision >=
  132. acpi_blacklist[i].oem_revision)
  133. || (acpi_blacklist[i].oem_revision_predicate == equal
  134. && table_header->oem_revision ==
  135. acpi_blacklist[i].oem_revision)) {
  136. printk(KERN_ERR PREFIX
  137. "Vendor \"%6.6s\" System \"%8.8s\" "
  138. "Revision 0x%x has a known ACPI BIOS problem.\n",
  139. acpi_blacklist[i].oem_id,
  140. acpi_blacklist[i].oem_table_id,
  141. acpi_blacklist[i].oem_revision);
  142. printk(KERN_ERR PREFIX
  143. "Reason: %s. This is a %s error\n",
  144. acpi_blacklist[i].reason,
  145. (acpi_blacklist[i].
  146. is_critical_error ? "non-recoverable" :
  147. "recoverable"));
  148. blacklisted = acpi_blacklist[i].is_critical_error;
  149. break;
  150. } else {
  151. i++;
  152. }
  153. }
  154. blacklisted += blacklist_by_year();
  155. return blacklisted;
  156. }