[Skiboot] [PATCH 4/6] core/pci: Add phb->ops->device_remove

Gavin Shan gwshan at linux.vnet.ibm.com
Thu Mar 30 10:05:29 AEDT 2017


This adds another PHB callback (device_remove()), corresponding to
device_init(). With it, the PHB3 layer can receive notification
upon PCI topology changes. This functionality will be used by the
subsequent patches.

Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
---
 core/pci.c     | 3 +++
 hw/p7ioc-phb.c | 1 +
 hw/phb3.c      | 1 +
 hw/phb4.c      | 1 +
 include/pci.h  | 1 +
 5 files changed, 7 insertions(+)

diff --git a/core/pci.c b/core/pci.c
index 6864e6f..a8b4b69 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -526,6 +526,9 @@ void pci_remove_bus(struct phb *phb, struct list_head *list)
 	list_for_each_safe(list, pd, tmp, link) {
 		pci_remove_bus(phb, &pd->children);
 
+		if (phb->ops->device_remove)
+			phb->ops->device_remove(phb, pd);
+
 		/* Release device node and PCI slot */
 		if (pd->dn)
 			dt_free(pd->dn);
diff --git a/hw/p7ioc-phb.c b/hw/p7ioc-phb.c
index 82d4f15..21f6c3e 100644
--- a/hw/p7ioc-phb.c
+++ b/hw/p7ioc-phb.c
@@ -2318,6 +2318,7 @@ static const struct phb_ops p7ioc_phb_ops = {
 	.choose_bus		= p7ioc_choose_bus,
 	.get_reserved_pe_number	= p7ioc_get_reserved_pe_number,
 	.device_init		= p7ioc_device_init,
+	.device_remove		= NULL,
 	.pci_reinit		= p7ioc_pci_reinit,
 	.eeh_freeze_status	= p7ioc_eeh_freeze_status,
 	.eeh_freeze_clear	= p7ioc_eeh_freeze_clear,
diff --git a/hw/phb3.c b/hw/phb3.c
index 08eb872..b105fb2 100644
--- a/hw/phb3.c
+++ b/hw/phb3.c
@@ -3810,6 +3810,7 @@ static const struct phb_ops phb3_ops = {
 	.choose_bus		= phb3_choose_bus,
 	.get_reserved_pe_number	= phb3_get_reserved_pe_number,
 	.device_init		= phb3_device_init,
+	.device_remove		= NULL,
 	.ioda_reset		= phb3_ioda_reset,
 	.papr_errinjct_reset	= phb3_papr_errinjct_reset,
 	.pci_reinit		= phb3_pci_reinit,
diff --git a/hw/phb4.c b/hw/phb4.c
index 894b61a..21e846e 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -2371,6 +2371,7 @@ static const struct phb_ops phb4_ops = {
 	.choose_bus		= phb4_choose_bus,
 	.get_reserved_pe_number	= phb4_get_reserved_pe_number,
 	.device_init		= phb4_device_init,
+	.device_remove		= NULL,
 	.ioda_reset		= phb4_ioda_reset,
 	.papr_errinjct_reset	= phb4_papr_errinjct_reset,
 	.pci_reinit		= phb4_pci_reinit,
diff --git a/include/pci.h b/include/pci.h
index 44bedf6..faeafbb 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -207,6 +207,7 @@ struct phb_ops {
 	 */
 	int (*device_init)(struct phb *phb, struct pci_device *device,
 			   void *data);
+	void (*device_remove)(struct phb *phb, struct pci_device *pd);
 
 	/* PHB final fixup is called after PCI probing is completed */
 	void (*phb_final_fixup)(struct phb *phb);
-- 
2.7.4



More information about the Skiboot mailing list