earlyquirk.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #ifdef CONFIG_ACPI
  14. /* According to Nvidia all timer overrides are bogus. Just ignore
  15. them all. */
  16. if (vendor == PCI_VENDOR_ID_NVIDIA) {
  17. acpi_skip_timer_override = 1;
  18. }
  19. #endif
  20. if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) {
  21. timer_over_8254 = 0;
  22. printk(KERN_INFO "ATI board detected. Disabling timer routing "
  23. "over 8254.\n");
  24. }
  25. return 0;
  26. }
  27. void __init check_acpi_pci(void)
  28. {
  29. int num, slot, func;
  30. /* Assume the machine supports type 1. If not it will
  31. always read ffffffff and should not have any side effect. */
  32. /* Poor man's PCI discovery */
  33. for (num = 0; num < 32; num++) {
  34. for (slot = 0; slot < 32; slot++) {
  35. for (func = 0; func < 8; func++) {
  36. u32 class;
  37. u32 vendor;
  38. class = read_pci_config(num, slot, func,
  39. PCI_CLASS_REVISION);
  40. if (class == 0xffffffff)
  41. break;
  42. if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
  43. continue;
  44. vendor = read_pci_config(num, slot, func,
  45. PCI_VENDOR_ID);
  46. if (check_bridge(vendor & 0xffff, vendor >> 16))
  47. return;
  48. }
  49. }
  50. }
  51. }