[Skiboot] [PATCH v5 06/15] core/pci: Trace device tree node from PCI device

Gavin Shan gwshan at linux.vnet.ibm.com
Mon Apr 27 16:26:24 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 0f9f4a0..d5dc3eb 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -1298,6 +1298,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 57ba547..9726a6e 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