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