GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / drivers / pci / setup-irq.c
blobb73a922aa9c34452acf8c40ac745a677b57b80cb
1 /* Modified by Broadcom Corp. Portions Copyright (c) Broadcom Corp, 2012. */
2 /*
3 * drivers/pci/setup-irq.c
5 * Extruded from code written by
6 * Dave Rusling (david.rusling@reo.mts.dec.com)
7 * David Mosberger (davidm@cs.arizona.edu)
8 * David Miller (davem@redhat.com)
10 * Support routines for initializing a PCI subsystem.
14 #include <linux/init.h>
15 #include <linux/kernel.h>
16 #include <linux/pci.h>
17 #include <linux/errno.h>
18 #include <linux/ioport.h>
19 #include <linux/cache.h>
22 static void __init
23 pdev_fixup_irq(struct pci_dev *dev,
24 u8 (*swizzle)(struct pci_dev *, u8 *),
25 int (*map_irq)(struct pci_dev *, u8, u8))
27 u8 pin, slot;
28 int irq = 0;
30 #ifdef CONFIG_BCM47XX
31 if (pci_domain_nr(dev->bus) == 0)
32 return;
33 #endif
35 /* If this device is not on the primary bus, we need to figure out
36 which interrupt pin it will come in on. We know which slot it
37 will come in on 'cos that slot is where the bridge is. Each
38 time the interrupt line passes through a PCI-PCI bridge we must
39 apply the swizzle function. */
41 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
42 /* Cope with illegal. */
43 if (pin > 4)
44 pin = 1;
46 if (pin != 0) {
47 /* Follow the chain of bridges, swizzling as we go. */
48 slot = (*swizzle)(dev, &pin);
50 irq = (*map_irq)(dev, slot, pin);
51 if (irq == -1)
52 irq = 0;
54 dev->irq = irq;
56 dev_dbg(&dev->dev, "fixup irq: got %d\n", dev->irq);
58 /* Always tell the device, so the driver knows what is
59 the real IRQ to use; the device does not use it. */
60 pcibios_update_irq(dev, irq);
63 void __init
64 pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *),
65 int (*map_irq)(struct pci_dev *, u8, u8))
67 struct pci_dev *dev = NULL;
68 for_each_pci_dev(dev)
69 pdev_fixup_irq(dev, swizzle, map_irq);