earlyquirk.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * Do early PCI probing for bug detection when the main PCI subsystem is
  3. * not up yet.
  4. */
  5. #include <linux/init.h>
  6. #include <linux/kernel.h>
  7. #include <linux/pci.h>
  8. #include <linux/acpi.h>
  9. #include <asm/pci-direct.h>
  10. #include <asm/acpi.h>
  11. #include <asm/apic.h>
  12. #ifdef CONFIG_ACPI
  13. static int __init nvidia_hpet_check(struct acpi_table_header *header)
  14. {
  15. return 0;
  16. }
  17. #endif
  18. static int __init check_bridge(int vendor, int device)
  19. {
  20. #ifdef CONFIG_ACPI
  21. static int warned;
  22. /* According to Nvidia all timer overrides are bogus unless HPET
  23. is enabled. */
  24. if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) {
  25. if (!warned && acpi_table_parse(ACPI_SIG_HPET,
  26. nvidia_hpet_check)) {
  27. warned = 1;
  28. acpi_skip_timer_override = 1;
  29. printk(KERN_INFO "Nvidia board "
  30. "detected. Ignoring ACPI "
  31. "timer override.\n");
  32. printk(KERN_INFO "If you got timer trouble "
  33. "try acpi_use_timer_override\n");
  34. }
  35. }
  36. #endif
  37. if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) {
  38. timer_over_8254 = 0;
  39. printk(KERN_INFO "ATI board detected. Disabling timer routing "
  40. "over 8254.\n");
  41. }
  42. return 0;
  43. }
  44. void __init check_acpi_pci(void)
  45. {
  46. int num, slot, func;
  47. /* Assume the machine supports type 1. If not it will
  48. always read ffffffff and should not have any side effect.
  49. Actually a few buggy systems can machine check. Allow the user
  50. to disable it by command line option at least -AK */
  51. if (!early_pci_allowed())
  52. return;
  53. /* Poor man's PCI discovery */
  54. for (num = 0; num < 32; num++) {
  55. for (slot = 0; slot < 32; slot++) {
  56. for (func = 0; func < 8; func++) {
  57. u32 class;
  58. u32 vendor;
  59. class = read_pci_config(num, slot, func,
  60. PCI_CLASS_REVISION);
  61. if (class == 0xffffffff)
  62. break;
  63. if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
  64. continue;
  65. vendor = read_pci_config(num, slot, func,
  66. PCI_VENDOR_ID);
  67. if (check_bridge(vendor & 0xffff, vendor >> 16))
  68. return;
  69. }
  70. }
  71. }
  72. }