aboutsummaryrefslogtreecommitdiff
path: root/core/pci.c
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2016-06-10 15:03:39 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-06-14 16:00:16 +1000
commit72552138f07fb29dd7f4ceb0831f492e71b060d0 (patch)
tree282ccf20c07c2f41224c7363514e02ca73c4dc22 /core/pci.c
parent306b47d08a7520a08acdbbe06bcb1668eaf4b42c (diff)
downloadskiboot-72552138f07fb29dd7f4ceb0831f492e71b060d0.zip
skiboot-72552138f07fb29dd7f4ceb0831f492e71b060d0.tar.gz
skiboot-72552138f07fb29dd7f4ceb0831f492e71b060d0.tar.bz2
core/pci: Extend pci_walk_dev() for PCI slot
Currently, pci_walk_dev() iterates all PCI devices behind the specified PHB. This extends the function to allow iteration on PCI devices behind the specified PCI slot so that it can be used by PCI hotplug logic in the subsequent patches. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Reviewed-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/pci.c')
-rw-r--r--core/pci.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/core/pci.c b/core/pci.c
index fd785ee..4311b97 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -804,9 +804,9 @@ static void pci_scan_phb(void *data)
pci_scan(phb, 0, 0xff, &phb->devices, NULL, has_link);
/* Configure MPS (Max Payload Size) for PCIe domain */
- pci_walk_dev(phb, pci_get_mps, &mps);
+ pci_walk_dev(phb, NULL, pci_get_mps, &mps);
phb->mps = mps;
- pci_walk_dev(phb, pci_configure_mps, NULL);
+ pci_walk_dev(phb, NULL, pci_configure_mps, NULL);
}
int64_t pci_register_phb(struct phb *phb, int opal_id)
@@ -1588,11 +1588,15 @@ static struct pci_device *__pci_walk_dev(struct phb *phb,
}
struct pci_device *pci_walk_dev(struct phb *phb,
+ struct pci_device *pd,
int (*cb)(struct phb *,
struct pci_device *,
void *),
void *userdata)
{
+ if (pd)
+ return __pci_walk_dev(phb, &pd->children, cb, userdata);
+
return __pci_walk_dev(phb, &phb->devices, cb, userdata);
}
@@ -1612,7 +1616,7 @@ static int __pci_find_dev(struct phb *phb,
struct pci_device *pci_find_dev(struct phb *phb, uint16_t bdfn)
{
- return pci_walk_dev(phb, __pci_find_dev, &bdfn);
+ return pci_walk_dev(phb, NULL, __pci_find_dev, &bdfn);
}
static int __pci_restore_bridge_buses(struct phb *phb,
@@ -1633,7 +1637,7 @@ static int __pci_restore_bridge_buses(struct phb *phb,
void pci_restore_bridge_buses(struct phb *phb)
{
- pci_walk_dev(phb, __pci_restore_bridge_buses, NULL);
+ pci_walk_dev(phb, NULL, __pci_restore_bridge_buses, NULL);
}
struct pci_cfg_reg_filter *pci_find_cfg_reg_filter(struct pci_device *pd,