acpi.c 1.6 KB

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