acpi.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #include <linux/pci.h>
  2. #include <linux/acpi.h>
  3. #include <linux/init.h>
  4. #include <linux/irq.h>
  5. #include <asm/hw_irq.h>
  6. #include <asm/numa.h>
  7. #include "pci.h"
  8. struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum)
  9. {
  10. struct pci_bus *bus;
  11. if (domain != 0) {
  12. printk(KERN_WARNING "PCI: Multiple domains not supported\n");
  13. return NULL;
  14. }
  15. bus = pcibios_scan_root(busnum);
  16. #ifdef CONFIG_ACPI_NUMA
  17. if (bus != NULL) {
  18. int pxm = acpi_get_pxm(device->handle);
  19. if (pxm >= 0) {
  20. bus->sysdata = (void *)(unsigned long)pxm_to_node(pxm);
  21. printk("bus %d -> pxm %d -> node %ld\n",
  22. busnum, pxm, (long)(bus->sysdata));
  23. }
  24. }
  25. #endif
  26. return bus;
  27. }
  28. extern int pci_routeirq;
  29. static int __init pci_acpi_init(void)
  30. {
  31. struct pci_dev *dev = NULL;
  32. if (pcibios_scanned)
  33. return 0;
  34. if (acpi_noirq)
  35. return 0;
  36. printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
  37. acpi_irq_penalty_init();
  38. pcibios_scanned++;
  39. pcibios_enable_irq = acpi_pci_irq_enable;
  40. pcibios_disable_irq = acpi_pci_irq_disable;
  41. if (pci_routeirq) {
  42. /*
  43. * PCI IRQ routing is set up by pci_enable_device(), but we
  44. * also do it here in case there are still broken drivers that
  45. * don't use pci_enable_device().
  46. */
  47. printk(KERN_INFO "PCI: Routing PCI interrupts for all devices because \"pci=routeirq\" specified\n");
  48. while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL)
  49. acpi_pci_irq_enable(dev);
  50. } else
  51. printk(KERN_INFO "PCI: If a device doesn't work, try \"pci=routeirq\". If it helps, post a report\n");
  52. #ifdef CONFIG_X86_IO_APIC
  53. if (acpi_ioapic)
  54. print_IO_APIC();
  55. #endif
  56. return 0;
  57. }
  58. subsys_initcall(pci_acpi_init);