diff options
author | Paul Mackerras <paulus@samba.org> | 2006-08-01 10:37:25 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-08-01 10:37:25 +1000 |
commit | 57cad8084e0837e0f2c97da789ec9b3f36809be9 (patch) | |
tree | e9c790afb4286f78cb08d9664f58baa7e876fe55 /arch/powerpc/kernel/pci_32.c | |
parent | cb18bd40030c879cd93fef02fd579f74dbab473d (diff) | |
parent | 49b1e3ea19b1c95c2f012b8331ffb3b169e4c042 (diff) | |
download | blackbird-op-linux-57cad8084e0837e0f2c97da789ec9b3f36809be9.tar.gz blackbird-op-linux-57cad8084e0837e0f2c97da789ec9b3f36809be9.zip |
Merge branch 'merge'
Diffstat (limited to 'arch/powerpc/kernel/pci_32.c')
-rw-r--r-- | arch/powerpc/kernel/pci_32.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c index 3f6bd36e9e14..9b49f8691d29 100644 --- a/arch/powerpc/kernel/pci_32.c +++ b/arch/powerpc/kernel/pci_32.c @@ -11,6 +11,7 @@ #include <linux/sched.h> #include <linux/errno.h> #include <linux/bootmem.h> +#include <linux/irq.h> #include <asm/processor.h> #include <asm/io.h> @@ -18,7 +19,6 @@ #include <asm/sections.h> #include <asm/pci-bridge.h> #include <asm/byteorder.h> -#include <asm/irq.h> #include <asm/uaccess.h> #include <asm/machdep.h> @@ -1423,15 +1423,37 @@ int pci_read_irq_line(struct pci_dev *pci_dev) DBG("Try to map irq for %s...\n", pci_name(pci_dev)); + /* Try to get a mapping from the device-tree */ if (of_irq_map_pci(pci_dev, &oirq)) { - DBG(" -> failed !\n"); - return -1; - } + u8 line, pin; + + /* If that fails, lets fallback to what is in the config + * space and map that through the default controller. We + * also set the type to level low since that's what PCI + * interrupts are. If your platform does differently, then + * either provide a proper interrupt tree or don't use this + * function. + */ + if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_PIN, &pin)) + return -1; + if (pin == 0) + return -1; + if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_LINE, &line) || + line == 0xff) { + return -1; + } + DBG(" -> no map ! Using irq line %d from PCI config\n", line); - DBG(" -> got one, spec %d cells (0x%08x...) on %s\n", - oirq.size, oirq.specifier[0], oirq.controller->full_name); + virq = irq_create_mapping(NULL, line); + if (virq != NO_IRQ) + set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); + } else { + DBG(" -> got one, spec %d cells (0x%08x...) on %s\n", + oirq.size, oirq.specifier[0], oirq.controller->full_name); - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, oirq.size); + virq = irq_create_of_mapping(oirq.controller, oirq.specifier, + oirq.size); + } if(virq == NO_IRQ) { DBG(" -> failed to map !\n"); return -1; |