diff options
author | Lucas Stach <dev@lynxeye.de> | 2014-10-04 19:40:14 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-10-08 08:39:01 +0200 |
commit | 490d4fe4179675a68f604ec9dcc07926c57125eb (patch) | |
tree | f67d88e6d24f22d61fd8826b93b1f1c918be46b2 /drivers/pci | |
parent | 48f88df158cc6dab89230cf92faeb9389a75faf1 (diff) | |
download | barebox-490d4fe4179675a68f604ec9dcc07926c57125eb.tar.gz barebox-490d4fe4179675a68f604ec9dcc07926c57125eb.tar.xz |
pci: track parent<->child relationship
So that PCI devices hang down from bridges and root
bridges down from the PCI host controller when
calling devinfo.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pci.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 943d0e8ebe..ba9d097230 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -40,6 +40,7 @@ void register_pci_controller(struct pci_controller *hose) bus = pci_alloc_bus(); hose->bus = bus; + bus->parent = hose->parent; bus->host = hose; bus->ops = hose->pci_ops; bus->resource[PCI_BUS_RESOURCE_MEM] = hose->mem_resource; @@ -309,6 +310,7 @@ unsigned int pci_scan_bus(struct pci_bus *bus) dev->devfn = devfn; dev->vendor = l & 0xffff; dev->device = (l >> 16) & 0xffff; + dev->dev.parent = bus->parent; /* non-destructively determine if device can be a master: */ pci_read_config_byte(dev, PCI_COMMAND, &cmd); @@ -354,6 +356,8 @@ unsigned int pci_scan_bus(struct pci_bus *bus) bus->resource[PCI_BUS_RESOURCE_MEM_PREF]; child_bus->resource[PCI_BUS_RESOURCE_IO] = bus->resource[PCI_BUS_RESOURCE_IO]; + + child_bus->parent = &dev->dev; child_bus->number = bus_index++; list_add_tail(&child_bus->node, &bus->children); dev->subordinate = child_bus; |