blacklist.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. {
  36. all_versions,
  37. less_than_or_equal,
  38. equal,
  39. greater_than_or_equal,
  40. };
  41. struct acpi_blacklist_item
  42. {
  43. char oem_id[7];
  44. char oem_table_id[9];
  45. u32 oem_revision;
  46. acpi_table_type table;
  47. enum acpi_blacklist_predicates oem_revision_predicate;
  48. char *reason;
  49. u32 is_critical_error;
  50. };
  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. {
  57. /* Compaq Presario 1700 */
  58. {"PTLTD ", " DSDT ", 0x06040000, ACPI_DSDT, less_than_or_equal, "Multiple problems", 1},
  59. /* Sony FX120, FX140, FX150? */
  60. {"SONY ", "U0 ", 0x20010313, ACPI_DSDT, less_than_or_equal, "ACPI driver problem", 1},
  61. /* Compaq Presario 800, Insyde BIOS */
  62. {"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal, "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, "Incorrect _ADR", 1},
  65. {"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions, "Bogus PCI routing", 1},
  66. {""}
  67. };
  68. #if CONFIG_ACPI_BLACKLIST_YEAR
  69. static int __init
  70. blacklist_by_year(void)
  71. {
  72. int year;
  73. char *s = dmi_get_system_info(DMI_BIOS_DATE);
  74. if (!s)
  75. return 0;
  76. if (!*s)
  77. return 0;
  78. s = strrchr(s, '/');
  79. if (!s)
  80. return 0;
  81. s += 1;
  82. year = simple_strtoul(s,NULL,0);
  83. if (year < 100) { /* 2-digit year */
  84. year += 1900;
  85. if (year < 1996) /* no dates < spec 1.0 */
  86. year += 100;
  87. }
  88. if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
  89. printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
  90. "acpi=force is required to enable ACPI\n",
  91. year, CONFIG_ACPI_BLACKLIST_YEAR);
  92. return 1;
  93. }
  94. return 0;
  95. }
  96. #else
  97. static inline int blacklist_by_year(void) { return 0; }
  98. #endif
  99. int __init
  100. 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. {
  107. if (acpi_get_table_header_early(acpi_blacklist[i].table, &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(acpi_blacklist[i].oem_table_id, table_header->oem_table_id, 8)) {
  116. i++;
  117. continue;
  118. }
  119. if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
  120. || (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal
  121. && table_header->oem_revision <= acpi_blacklist[i].oem_revision)
  122. || (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal
  123. && table_header->oem_revision >= acpi_blacklist[i].oem_revision)
  124. || (acpi_blacklist[i].oem_revision_predicate == equal
  125. && table_header->oem_revision == acpi_blacklist[i].oem_revision)) {
  126. printk(KERN_ERR PREFIX "Vendor \"%6.6s\" System \"%8.8s\" "
  127. "Revision 0x%x has a known ACPI BIOS problem.\n",
  128. acpi_blacklist[i].oem_id,
  129. acpi_blacklist[i].oem_table_id,
  130. acpi_blacklist[i].oem_revision);
  131. printk(KERN_ERR PREFIX "Reason: %s. This is a %s error\n",
  132. acpi_blacklist[i].reason,
  133. (acpi_blacklist[i].is_critical_error ? "non-recoverable" : "recoverable"));
  134. blacklisted = acpi_blacklist[i].is_critical_error;
  135. break;
  136. }
  137. else {
  138. i++;
  139. }
  140. }
  141. blacklisted += blacklist_by_year();
  142. return blacklisted;
  143. }