blacklist.c 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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_rev_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. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24. */
  25. #include <linux/kernel.h>
  26. #include <linux/init.h>
  27. #include <linux/acpi.h>
  28. #include <linux/dmi.h>
  29. #include "internal.h"
  30. enum acpi_blacklist_predicates {
  31. all_versions,
  32. less_than_or_equal,
  33. equal,
  34. greater_than_or_equal,
  35. };
  36. struct acpi_blacklist_item {
  37. char oem_id[7];
  38. char oem_table_id[9];
  39. u32 oem_revision;
  40. char *table;
  41. enum acpi_blacklist_predicates oem_revision_predicate;
  42. char *reason;
  43. u32 is_critical_error;
  44. };
  45. static struct dmi_system_id acpi_rev_dmi_table[] __initdata;
  46. /*
  47. * POLICY: If *anything* doesn't work, put it on the blacklist.
  48. * If they are critical errors, mark it critical, and abort driver load.
  49. */
  50. static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
  51. /* Compaq Presario 1700 */
  52. {"PTLTD ", " DSDT ", 0x06040000, ACPI_SIG_DSDT, less_than_or_equal,
  53. "Multiple problems", 1},
  54. /* Sony FX120, FX140, FX150? */
  55. {"SONY ", "U0 ", 0x20010313, ACPI_SIG_DSDT, less_than_or_equal,
  56. "ACPI driver problem", 1},
  57. /* Compaq Presario 800, Insyde BIOS */
  58. {"INT440", "SYSFexxx", 0x00001001, ACPI_SIG_DSDT, less_than_or_equal,
  59. "Does not use _REG to protect EC OpRegions", 1},
  60. /* IBM 600E - _ADR should return 7, but it returns 1 */
  61. {"IBM ", "TP600E ", 0x00000105, ACPI_SIG_DSDT, less_than_or_equal,
  62. "Incorrect _ADR", 1},
  63. {""}
  64. };
  65. int __init acpi_blacklisted(void)
  66. {
  67. int i = 0;
  68. int blacklisted = 0;
  69. struct acpi_table_header table_header;
  70. while (acpi_blacklist[i].oem_id[0] != '\0') {
  71. if (acpi_get_table_header(acpi_blacklist[i].table, 0, &table_header)) {
  72. i++;
  73. continue;
  74. }
  75. if (strncmp(acpi_blacklist[i].oem_id, table_header.oem_id, 6)) {
  76. i++;
  77. continue;
  78. }
  79. if (strncmp
  80. (acpi_blacklist[i].oem_table_id, table_header.oem_table_id,
  81. 8)) {
  82. i++;
  83. continue;
  84. }
  85. if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
  86. || (acpi_blacklist[i].oem_revision_predicate ==
  87. less_than_or_equal
  88. && table_header.oem_revision <=
  89. acpi_blacklist[i].oem_revision)
  90. || (acpi_blacklist[i].oem_revision_predicate ==
  91. greater_than_or_equal
  92. && table_header.oem_revision >=
  93. acpi_blacklist[i].oem_revision)
  94. || (acpi_blacklist[i].oem_revision_predicate == equal
  95. && table_header.oem_revision ==
  96. acpi_blacklist[i].oem_revision)) {
  97. printk(KERN_ERR PREFIX
  98. "Vendor \"%6.6s\" System \"%8.8s\" "
  99. "Revision 0x%x has a known ACPI BIOS problem.\n",
  100. acpi_blacklist[i].oem_id,
  101. acpi_blacklist[i].oem_table_id,
  102. acpi_blacklist[i].oem_revision);
  103. printk(KERN_ERR PREFIX
  104. "Reason: %s. This is a %s error\n",
  105. acpi_blacklist[i].reason,
  106. (acpi_blacklist[i].
  107. is_critical_error ? "non-recoverable" :
  108. "recoverable"));
  109. blacklisted = acpi_blacklist[i].is_critical_error;
  110. break;
  111. } else {
  112. i++;
  113. }
  114. }
  115. (void)early_acpi_osi_init();
  116. dmi_check_system(acpi_rev_dmi_table);
  117. return blacklisted;
  118. }
  119. #ifdef CONFIG_DMI
  120. #ifdef CONFIG_ACPI_REV_OVERRIDE_POSSIBLE
  121. static int __init dmi_enable_rev_override(const struct dmi_system_id *d)
  122. {
  123. printk(KERN_NOTICE PREFIX "DMI detected: %s (force ACPI _REV to 5)\n",
  124. d->ident);
  125. acpi_rev_override_setup(NULL);
  126. return 0;
  127. }
  128. #endif
  129. static struct dmi_system_id acpi_rev_dmi_table[] __initdata = {
  130. #ifdef CONFIG_ACPI_REV_OVERRIDE_POSSIBLE
  131. /*
  132. * DELL XPS 13 (2015) switches sound between HDA and I2S
  133. * depending on the ACPI _REV callback. If userspace supports
  134. * I2S sufficiently (or if you do not care about sound), you
  135. * can safely disable this quirk.
  136. */
  137. {
  138. .callback = dmi_enable_rev_override,
  139. .ident = "DELL XPS 13 (2015)",
  140. .matches = {
  141. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  142. DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9343"),
  143. },
  144. },
  145. {
  146. .callback = dmi_enable_rev_override,
  147. .ident = "DELL Precision 5520",
  148. .matches = {
  149. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  150. DMI_MATCH(DMI_PRODUCT_NAME, "Precision 5520"),
  151. },
  152. },
  153. {
  154. .callback = dmi_enable_rev_override,
  155. .ident = "DELL Precision 3520",
  156. .matches = {
  157. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  158. DMI_MATCH(DMI_PRODUCT_NAME, "Precision 3520"),
  159. },
  160. },
  161. /*
  162. * Resolves a quirk with the Dell Latitude 3350 that
  163. * causes the ethernet adapter to not function.
  164. */
  165. {
  166. .callback = dmi_enable_rev_override,
  167. .ident = "DELL Latitude 3350",
  168. .matches = {
  169. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
  170. DMI_MATCH(DMI_PRODUCT_NAME, "Latitude 3350"),
  171. },
  172. },
  173. #endif
  174. {}
  175. };
  176. #endif /* CONFIG_DMI */