From c19d6a6ce59873f2326b14bb4af69048cceb9300 Mon Sep 17 00:00:00 2001 From: Kyösti Mälkki Date: Thu, 4 Jul 2019 21:39:28 +0300 Subject: device/pci: Replace use of dev_find_slot() for IRQs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I48c0de73338430282ce1a4442bbeb7c867dc174c Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/34079 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/device/pci_device.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'src/device/pci_device.c') diff --git a/src/device/pci_device.c b/src/device/pci_device.c index a2af0ec999..2c724aad50 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -1499,27 +1499,24 @@ int get_pci_irq_pins(struct device *dev, struct device **parent_bdg) * * This function should be called for each PCI slot in your system. * - * @param bus Pointer to the bus structure. - * @param slot TODO + * @param dev Pointer to dev structure. * @param pIntAtoD An array of IRQ #s that are assigned to PINTA through PINTD * of this slot. The particular IRQ #s that are passed in depend on the * routing inside your southbridge and on your board. */ -void pci_assign_irqs(unsigned bus, unsigned slot, - const unsigned char pIntAtoD[4]) +void pci_assign_irqs(struct device *dev, const unsigned char pIntAtoD[4]) { - unsigned int funct; - struct device *pdev; - u8 line, irq; + u8 slot, line, irq; - /* Each slot may contain up to eight functions. */ - for (funct = 0; funct < 8; funct++) { - pdev = dev_find_slot(bus, (slot << 3) + funct); + /* Each device may contain up to eight functions. */ + slot = dev->path.pci.devfn >> 3; - if (!pdev) - continue; + for (; dev ; dev = dev->sibling) { + + if (dev->path.pci.devfn >> 3 != slot) + break; - line = pci_read_config8(pdev, PCI_INTERRUPT_PIN); + line = pci_read_config8(dev, PCI_INTERRUPT_PIN); /* PCI spec says all values except 1..4 are reserved. */ if ((line < 1) || (line > 4)) @@ -1527,11 +1524,9 @@ void pci_assign_irqs(unsigned bus, unsigned slot, irq = pIntAtoD[line - 1]; - printk(BIOS_DEBUG, "Assigning IRQ %d to %d:%x.%d\n", - irq, bus, slot, funct); + printk(BIOS_DEBUG, "Assigning IRQ %d to %s\n", irq, dev_path(dev)); - pci_write_config8(pdev, PCI_INTERRUPT_LINE, - pIntAtoD[line - 1]); + pci_write_config8(dev, PCI_INTERRUPT_LINE, pIntAtoD[line - 1]); #ifdef PARANOID_IRQ_ASSIGNMENTS irq = pci_read_config8(pdev, PCI_INTERRUPT_LINE); -- cgit v1.2.3