blob: 2941674f35eb5aae272a3000edd491993ec1b0aa [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#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>
Andi Kleen69e1a332005-09-12 18:49:24 +02006#include <asm/numa.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include "pci.h"
8
9struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum)
10{
Andi Kleen69e1a332005-09-12 18:49:24 +020011 struct pci_bus *bus;
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 if (domain != 0) {
14 printk(KERN_WARNING "PCI: Multiple domains not supported\n");
15 return NULL;
16 }
17
Andi Kleen69e1a332005-09-12 18:49:24 +020018 bus = pcibios_scan_root(busnum);
19#ifdef CONFIG_ACPI_NUMA
20 if (bus != NULL) {
21 int pxm = acpi_get_pxm(device->handle);
22 if (pxm >= 0) {
23 bus->sysdata = (void *)(unsigned long)pxm_to_node(pxm);
24 printk("bus %d -> pxm %d -> node %ld\n",
25 busnum, pxm, (long)(bus->sysdata));
26 }
27 }
28#endif
29
30 return bus;
Linus Torvalds1da177e2005-04-16 15:20:36 -070031}
32
33extern int pci_routeirq;
34static int __init pci_acpi_init(void)
35{
36 struct pci_dev *dev = NULL;
37
38 if (pcibios_scanned)
39 return 0;
40
41 if (acpi_noirq)
42 return 0;
43
44 printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n");
45 acpi_irq_penalty_init();
46 pcibios_scanned++;
47 pcibios_enable_irq = acpi_pci_irq_enable;
David Shaohua Li87bec662005-07-27 23:02:00 -040048 pcibios_disable_irq = acpi_pci_irq_disable;
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
50 if (pci_routeirq) {
51 /*
52 * PCI IRQ routing is set up by pci_enable_device(), but we
53 * also do it here in case there are still broken drivers that
54 * don't use pci_enable_device().
55 */
56 printk(KERN_INFO "PCI: Routing PCI interrupts for all devices because \"pci=routeirq\" specified\n");
57 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL)
58 acpi_pci_irq_enable(dev);
59 } else
60 printk(KERN_INFO "PCI: If a device doesn't work, try \"pci=routeirq\". If it helps, post a report\n");
61
62#ifdef CONFIG_X86_IO_APIC
63 if (acpi_ioapic)
64 print_IO_APIC();
65#endif
66
67 return 0;
68}
69subsys_initcall(pci_acpi_init);