Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> |
Andi Kleen | 69e1a33 | 2005-09-12 18:49:24 +0200 | [diff] [blame^] | 6 | #include <asm/numa.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | #include "pci.h" |
| 8 | |
| 9 | struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int domain, int busnum) |
| 10 | { |
Andi Kleen | 69e1a33 | 2005-09-12 18:49:24 +0200 | [diff] [blame^] | 11 | struct pci_bus *bus; |
| 12 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | if (domain != 0) { |
| 14 | printk(KERN_WARNING "PCI: Multiple domains not supported\n"); |
| 15 | return NULL; |
| 16 | } |
| 17 | |
Andi Kleen | 69e1a33 | 2005-09-12 18:49:24 +0200 | [diff] [blame^] | 18 | 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | extern int pci_routeirq; |
| 34 | static 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 Li | 87bec66 | 2005-07-27 23:02:00 -0400 | [diff] [blame] | 48 | pcibios_disable_irq = acpi_pci_irq_disable; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
| 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 | } |
| 69 | subsys_initcall(pci_acpi_init); |