[Skiboot] [PATCH 11/16] core/pci: Get PCI slot before applying quirk
Gavin Shan
gwshan at linux.vnet.ibm.com
Fri Sep 16 15:05:18 AEST 2016
We might need know the associated PCI slot before applying the chip
level quirk (phb->ops->device_init()) so that special configuration
on the specific PCI slot can be applied.
This moves the logic of creating PCI slot, applying the quirk and
linking the newly probed device to parent's child list to function
pci_scan_one(). Also, the PCI slot is created prior to applying the
quirk.
Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
---
core/pci.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/core/pci.c b/core/pci.c
index 5da7e4f..14780a5 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -259,6 +259,16 @@ static struct pci_device *pci_scan_one(struct phb *phb, struct pci_device *paren
pd->is_bridge ? "+" : "-",
pci_has_cap(pd, PCI_CFG_CAP_ID_EXP, false) ? "+" : "-");
+ /* Try to get PCI slot behind the device */
+ if (platform.pci_get_slot_info)
+ platform.pci_get_slot_info(phb, pd);
+
+ /* Put it to the child device of list of PHB or parent */
+ if (!parent)
+ list_add_tail(&phb->devices, &pd->link);
+ else
+ list_add_tail(&parent->children, &pd->link);
+
/*
* Call PHB hook
*/
@@ -566,13 +576,6 @@ uint8_t pci_scan_bus(struct phb *phb, uint8_t bus, uint8_t max_bus,
if (!pd)
continue;
- /* Get slot info if any */
- if (platform.pci_get_slot_info)
- platform.pci_get_slot_info(phb, pd);
-
- /* Link it up */
- list_add_tail(list, &pd->link);
-
/* XXX Handle ARI */
if (!pd->is_multifunction)
continue;
@@ -580,11 +583,6 @@ uint8_t pci_scan_bus(struct phb *phb, uint8_t bus, uint8_t max_bus,
pd = pci_scan_one(phb, parent,
((uint16_t)bus << 8) | (dev << 3) | fn);
pci_check_clear_freeze(phb);
- if (pd) {
- if (platform.pci_get_slot_info)
- platform.pci_get_slot_info(phb, pd);
- list_add_tail(list, &pd->link);
- }
}
}
--
2.1.0
More information about the Skiboot
mailing list