From 75e9440124d554fedb1816c518d5dad6e832728f Mon Sep 17 00:00:00 2001 From: Gavin Shan Date: Fri, 16 Oct 2015 16:08:16 +1100 Subject: PCI: Trace device node from PCI device When nvLink and nVida's GPU included in PCI topology, we have the emulated PCI devices to represent nvLinks, which is associated with the real GPU PCI device with help of device-tree. The patch introduces one more field "dn" to "struct pci_device" to make the job easier. The patch also adds one more PHB operations "device_node_fixup", which is to be called when populating PCI device node so that we have chance to link the emulated PCI device and the real GPU device through device tree. Signed-off-by: Gavin Shan Signed-off-by: Stewart Smith --- core/pci.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core/pci.c') diff --git a/core/pci.c b/core/pci.c index a8015cb..22d38b5 100644 --- a/core/pci.c +++ b/core/pci.c @@ -1342,7 +1342,7 @@ static void pci_add_one_node(struct phb *phb, struct pci_device *pd, else snprintf(name, MAX_NAME - 1, "%s@%x", cname, (pd->bdfn >> 3) & 0x1f); - np = dt_new(parent_node, name); + pd->dn = np = dt_new(parent_node, name); /* XXX FIXME: make proper "compatible" properties */ if (pci_has_cap(pd, PCI_CFG_CAP_ID_EXP, false)) { @@ -1386,9 +1386,12 @@ static void pci_add_one_node(struct phb *phb, struct pci_device *pd, reg[1] = reg[2] = reg[3] = reg[4] = 0; dt_add_property(np, "reg", reg, sizeof(reg)); + /* Device node fixup */ + if (phb->ops->device_node_fixup) + phb->ops->device_node_fixup(phb, pd); + /* Print summary info about the device */ pci_print_summary_line(phb, pd, np, rev_class, cname); - if (!pd->is_bridge) return; -- cgit v1.1