earlyquirk.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. static int __init check_bridge(int vendor, int device)
  11. {
  12. /* According to Nvidia all timer overrides are bogus. Just ignore
  13. them all. */
  14. if (vendor == PCI_VENDOR_ID_NVIDIA) {
  15. acpi_skip_timer_override = 1;
  16. }
  17. return 0;
  18. }
  19. void __init check_acpi_pci(void)
  20. {
  21. int num,slot,func;
  22. /* Assume the machine supports type 1. If not it will
  23. always read ffffffff and should not have any side effect. */
  24. /* Poor man's PCI discovery */
  25. for (num = 0; num < 32; num++) {
  26. for (slot = 0; slot < 32; slot++) {
  27. for (func = 0; func < 8; func++) {
  28. u32 class;
  29. u32 vendor;
  30. class = read_pci_config(num,slot,func,
  31. PCI_CLASS_REVISION);
  32. if (class == 0xffffffff)
  33. break;
  34. if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
  35. continue;
  36. vendor = read_pci_config(num, slot, func,
  37. PCI_VENDOR_ID);
  38. if (check_bridge(vendor&0xffff, vendor >> 16))
  39. return;
  40. }
  41. }
  42. }
  43. }