earlyquirk.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 <asm/pci-direct.h>
  9. #include <asm/acpi.h>
  10. #include <asm/apic.h>
  11. static int __init check_bridge(int vendor, int device)
  12. {
  13. /* According to Nvidia all timer overrides are bogus. Just ignore
  14. them all. */
  15. if (vendor == PCI_VENDOR_ID_NVIDIA) {
  16. acpi_skip_timer_override = 1;
  17. }
  18. #ifdef CONFIG_X86_LOCAL_APIC
  19. /*
  20. * ATI IXP chipsets get double timer interrupts.
  21. * For now just do this for all ATI chipsets.
  22. * FIXME: this needs to be checked for the non ACPI case too.
  23. */
  24. if (vendor == PCI_VENDOR_ID_ATI)
  25. disable_timer_pin_1 = 1;
  26. #endif
  27. return 0;
  28. }
  29. void __init check_acpi_pci(void)
  30. {
  31. int num, slot, func;
  32. /* Assume the machine supports type 1. If not it will
  33. always read ffffffff and should not have any side effect. */
  34. /* Poor man's PCI discovery */
  35. for (num = 0; num < 32; num++) {
  36. for (slot = 0; slot < 32; slot++) {
  37. for (func = 0; func < 8; func++) {
  38. u32 class;
  39. u32 vendor;
  40. class = read_pci_config(num, slot, func,
  41. PCI_CLASS_REVISION);
  42. if (class == 0xffffffff)
  43. break;
  44. if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
  45. continue;
  46. vendor = read_pci_config(num, slot, func,
  47. PCI_VENDOR_ID);
  48. if (check_bridge(vendor & 0xffff, vendor >> 16))
  49. return;
  50. }
  51. }
  52. }
  53. }