cregit-Linux how code gets into the kernel

Release 4.13 drivers/pci/setup-irq.c

Directory: drivers/pci
/*
 *      drivers/pci/setup-irq.c
 *
 * Extruded from code written by
 *      Dave Rusling (david.rusling@reo.mts.dec.com)
 *      David Mosberger (davidm@cs.arizona.edu)
 *      David Miller (davem@redhat.com)
 *
 * Support routines for initializing a PCI subsystem.
 */


#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/cache.h>
#include "pci.h"


void __weak pcibios_update_irq(struct pci_dev *dev, int irq) { dev_dbg(&dev->dev, "assigning IRQ %02d\n", irq); pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq); }

Contributors

PersonTokensPropCommitsCommitProp
Thierry Reding35100.00%1100.00%
Total35100.00%1100.00%


void pci_assign_irq(struct pci_dev *dev) { u8 pin; u8 slot = -1; int irq = 0; struct pci_host_bridge *hbrg = pci_find_host_bridge(dev->bus); if (!(hbrg->map_irq)) { dev_dbg(&dev->dev, "runtime IRQ mapping not provided by arch\n"); return; } /* If this device is not on the primary bus, we need to figure out which interrupt pin it will come in on. We know which slot it will come in on 'cos that slot is where the bridge is. Each time the interrupt line passes through a PCI-PCI bridge we must apply the swizzle function. */ pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); /* Cope with illegal. */ if (pin > 4) pin = 1; if (pin) { /* Follow the chain of bridges, swizzling as we go. */ if (hbrg->swizzle_irq) slot = (*(hbrg->swizzle_irq))(dev, &pin); /* * If a swizzling function is not used map_irq must * ignore slot */ irq = (*(hbrg->map_irq))(dev, slot, pin); if (irq == -1) irq = 0; } dev->irq = irq; dev_dbg(&dev->dev, "assign IRQ: got %d\n", dev->irq); /* Always tell the device, so the driver knows what is the real IRQ to use; the device does not use it. */ pcibios_update_irq(dev, irq); }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)8349.40%114.29%
Matthew Minter7041.67%114.29%
Andreas Block95.36%114.29%
Björn Helgaas31.79%228.57%
Greg Kroah-Hartman21.19%114.29%
Matthew Wilcox10.60%114.29%
Total168100.00%7100.00%


void pci_fixup_irqs(u8 (*swizzle)(struct pci_dev *, u8 *), int (*map_irq)(const struct pci_dev *, u8, u8)) { /* * Implement pci_fixup_irqs() through pci_assign_irq(). * This code should be remove eventually, it is a wrapper * around pci_assign_irq() interface to keep current * pci_fixup_irqs() behaviour unchanged on architecture * code still relying on its interface. */ struct pci_dev *dev = NULL; struct pci_host_bridge *hbrg = NULL; for_each_pci_dev(dev) { hbrg = pci_find_host_bridge(dev->bus); hbrg->swizzle_irq = swizzle; hbrg->map_irq = map_irq; pci_assign_irq(dev); hbrg->swizzle_irq = NULL; hbrg->map_irq = NULL; } }

Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)4648.94%116.67%
Matthew Minter4244.68%116.67%
Vasiliy Kulikov22.13%116.67%
Greg Kroah-Hartman22.13%116.67%
Ryan Desfosses11.06%116.67%
Ralf Bächle11.06%116.67%
Total94100.00%6100.00%

EXPORT_SYMBOL_GPL(pci_fixup_irqs);

Overall Contributors

PersonTokensPropCommitsCommitProp
Linus Torvalds (pre-git)14545.17%17.69%
Matthew Minter11535.83%17.69%
Thierry Reding3510.90%17.69%
Andreas Block92.80%17.69%
Ray Jui51.56%17.69%
Greg Kroah-Hartman41.25%215.38%
Björn Helgaas30.93%215.38%
Vasiliy Kulikov20.62%17.69%
Matthew Wilcox10.31%17.69%
Ralf Bächle10.31%17.69%
Ryan Desfosses10.31%17.69%
Total321100.00%13100.00%
Directory: drivers/pci
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.