[Skiboot] [PATCH v7 09/17] core/pci: Trace device tree node from PCI device

Gavin Shan gwshan at linux.vnet.ibm.com
Thu Jun 4 16:19:01 AEST 2015


The patch adds one more fields "struct pci_device::dt_node" to
trace the binding device tree node from PCI device. When all the
subordinate devices behind PCI slot are unplugged in future, all
PCI device instances together with their associated device tree
nodes should be removed. The changes introduced by this patch
helps on that.

Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
---
 core/pci.c    | 3 +++
 include/pci.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/core/pci.c b/core/pci.c
index ff36af6..5e3f88e 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -1300,6 +1300,9 @@ 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));
 
+	/* Bind the device node with PCI device */
+	pd->dt_node = np;
+
 	/* Print summary info about the device */
 	pci_print_summary_line(phb, pd, np, rev_class, cname);
 
diff --git a/include/pci.h b/include/pci.h
index 2093937..e00c5a8 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -126,6 +126,7 @@ struct pci_device {
 	uint32_t		cap[64];
 	uint32_t		mps;		/* Max payload size capability */
 
+	struct dt_node		*dt_node;
 	struct pci_slot_info    *slot_info;
 	struct pci_device	*parent;
 	struct list_head	children;
-- 
2.1.0



More information about the Skiboot mailing list