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>
This commit is contained in:
parent
48f88df158
commit
490d4fe417
|
@ -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;
|
||||
|
|
|
@ -122,6 +122,7 @@ enum {
|
|||
};
|
||||
struct pci_bus {
|
||||
struct pci_controller *host; /* associated host controller */
|
||||
struct device_d *parent;
|
||||
struct list_head node; /* node in list of buses */
|
||||
struct list_head children; /* list of child buses */
|
||||
struct list_head devices; /* list of devices on this bus */
|
||||
|
@ -158,6 +159,7 @@ extern struct pci_ops *pci_ops;
|
|||
*/
|
||||
struct pci_controller {
|
||||
struct pci_controller *next;
|
||||
struct device_d *parent;
|
||||
struct pci_bus *bus;
|
||||
|
||||
struct pci_ops *pci_ops;
|
||||
|
|
Loading…
Reference in New Issue