blacklist.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 = dmi_get_year(DMI_BIOS_DATE);
  74. /* Doesn't exist? Likely an old system */
  75. if (year == -1)
  76. return 1;
  77. /* 0? Likely a buggy new BIOS */
  78. if (year == 0)
  79. return 0;
  80. if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
  81. printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
  82. "acpi=force is required to enable ACPI\n",
  83. year, CONFIG_ACPI_BLACKLIST_YEAR);
  84. return 1;
  85. }
  86. return 0;
  87. }
  88. #else
  89. static inline int blacklist_by_year(void)
  90. {
  91. return 0;
  92. }
  93. #endif
  94. int __init acpi_blacklisted(void)
  95. {
  96. int i = 0;
  97. int blacklisted = 0;
  98. struct acpi_table_header *table_header;
  99. while (acpi_blacklist[i].oem_id[0] != '\0') {
  100. if (acpi_get_table_header_early
  101. (acpi_blacklist[i].table, &table_header)) {
  102. i++;
  103. continue;
  104. }
  105. if (strncmp(acpi_blacklist[i].oem_id, table_header->oem_id, 6)) {
  106. i++;
  107. continue;
  108. }
  109. if (strncmp
  110. (acpi_blacklist[i].oem_table_id, table_header->oem_table_id,
  111. 8)) {
  112. i++;
  113. continue;
  114. }
  115. if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
  116. || (acpi_blacklist[i].oem_revision_predicate ==
  117. less_than_or_equal
  118. && table_header->oem_revision <=
  119. acpi_blacklist[i].oem_revision)
  120. || (acpi_blacklist[i].oem_revision_predicate ==
  121. greater_than_or_equal
  122. && table_header->oem_revision >=
  123. acpi_blacklist[i].oem_revision)
  124. || (acpi_blacklist[i].oem_revision_predicate == equal
  125. && table_header->oem_revision ==
  126. acpi_blacklist[i].oem_revision)) {
  127. printk(KERN_ERR PREFIX
  128. "Vendor \"%6.6s\" System \"%8.8s\" "
  129. "Revision 0x%x has a known ACPI BIOS problem.\n",
  130. acpi_blacklist[i].oem_id,
  131. acpi_blacklist[i].oem_table_id,
  132. acpi_blacklist[i].oem_revision);
  133. printk(KERN_ERR PREFIX
  134. "Reason: %s. This is a %s error\n",
  135. acpi_blacklist[i].reason,
  136. (acpi_blacklist[i].
  137. is_critical_error ? "non-recoverable" :
  138. "recoverable"));
  139. blacklisted = acpi_blacklist[i].is_critical_error;
  140. break;
  141. } else {
  142. i++;
  143. }
  144. }
  145. blacklisted += blacklist_by_year();
  146. return blacklisted;
  147. }