earlyquirk.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. #include <asm/irq.h>
  13. #ifdef CONFIG_ACPI
  14. static int __init nvidia_hpet_check(struct acpi_table_header *header)
  15. {
  16. return 0;
  17. }
  18. #endif
  19. static int __init check_bridge(int vendor, int device)
  20. {
  21. #ifdef CONFIG_ACPI
  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 (acpi_table_parse(ACPI_SIG_HPET, nvidia_hpet_check) {
  26. acpi_skip_timer_override = 1;
  27. printk(KERN_INFO "Nvidia board "
  28. "detected. Ignoring ACPI "
  29. "timer override.\n");
  30. printk(KERN_INFO "If you got timer trouble "
  31. "try acpi_use_timer_override\n");
  32. }
  33. }
  34. #endif
  35. if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) {
  36. timer_over_8254 = 0;
  37. printk(KERN_INFO "ATI board detected. Disabling timer routing "
  38. "over 8254.\n");
  39. }
  40. return 0;
  41. }
  42. static void check_intel(void)
  43. {
  44. u16 vendor, device;
  45. vendor = read_pci_config_16(0, 0, 0, PCI_VENDOR_ID);
  46. if (vendor != PCI_VENDOR_ID_INTEL)
  47. return;
  48. device = read_pci_config_16(0, 0, 0, PCI_DEVICE_ID);
  49. #ifdef CONFIG_SMP
  50. if (device == PCI_DEVICE_ID_INTEL_E7320_MCH ||
  51. device == PCI_DEVICE_ID_INTEL_E7520_MCH ||
  52. device == PCI_DEVICE_ID_INTEL_E7525_MCH)
  53. quirk_intel_irqbalance();
  54. #endif
  55. }
  56. void __init check_acpi_pci(void)
  57. {
  58. int num, slot, func;
  59. /* Assume the machine supports type 1. If not it will
  60. always read ffffffff and should not have any side effect.
  61. Actually a few buggy systems can machine check. Allow the user
  62. to disable it by command line option at least -AK */
  63. if (!early_pci_allowed())
  64. return;
  65. check_intel();
  66. /* Poor man's PCI discovery */
  67. for (num = 0; num < 32; num++) {
  68. for (slot = 0; slot < 32; slot++) {
  69. for (func = 0; func < 8; func++) {
  70. u32 class;
  71. u32 vendor;
  72. class = read_pci_config(num, slot, func,
  73. PCI_CLASS_REVISION);
  74. if (class == 0xffffffff)
  75. break;
  76. if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
  77. continue;
  78. vendor = read_pci_config(num, slot, func,
  79. PCI_VENDOR_ID);
  80. if (check_bridge(vendor & 0xffff, vendor >> 16))
  81. return;
  82. }
  83. }
  84. }
  85. }