[Skiboot] [PATCH 1/2] pci: Track peers of slots

Russell Currey ruscur at russell.cc
Mon Nov 20 17:32:12 AEDT 2017


Witherspoon introduced a new concept where one physical slot is shared
between two PHBs.  Making a slot aware of its peer enables syncing
between them where necessary.

Signed-off-by: Russell Currey <ruscur at russell.cc>
---
 core/pci-slot.c                | 1 +
 include/pci-slot.h             | 1 +
 platforms/astbmc/witherspoon.c | 5 ++++-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/core/pci-slot.c b/core/pci-slot.c
index 6d3ed6cb..8bddc147 100644
--- a/core/pci-slot.c
+++ b/core/pci-slot.c
@@ -178,6 +178,7 @@ struct pci_slot *pci_slot_alloc(struct phb *phb,
 	slot->power_state = PCI_SLOT_POWER_ON;
 	slot->ops.run_sm = pci_slot_run_sm;
 	slot->ops.prepare_link_change = pci_slot_prepare_link_change;
+	slot->peer_slot = NULL;
 	if (!pd) {
 		slot->id = PCI_PHB_SLOT_ID(phb);
 		phb->slot = slot;
diff --git a/include/pci-slot.h b/include/pci-slot.h
index 1d323aa7..bb66d7c7 100644
--- a/include/pci-slot.h
+++ b/include/pci-slot.h
@@ -186,6 +186,7 @@ struct pci_slot {
 	uint64_t		retries;
 	uint64_t		link_retries;
 	struct pci_slot_ops	ops;
+	struct pci_slot		*peer_slot;
 	void			*data;
 };
 
diff --git a/platforms/astbmc/witherspoon.c b/platforms/astbmc/witherspoon.c
index 1caa2edb..b9ed2778 100644
--- a/platforms/astbmc/witherspoon.c
+++ b/platforms/astbmc/witherspoon.c
@@ -457,8 +457,11 @@ static void phb4_pre_pci_fixup_witherspoon(void)
 			slot0->ops.get_presence_state(slot0, &p0);
 		if (slot1->ops.get_presence_state)
 			slot1->ops.get_presence_state(slot1, &p1);
-		if (p0 == 1 && p1 == 1)
+		if (p0 == 1 && p1 == 1) {
 			phb4_activate_shared_slot_witherspoon(chip1);
+			slot0->peer_slot = slot1;
+			slot1->peer_slot = slot0;
+		}
 	}
 }
 
-- 
2.14.1



More information about the Skiboot mailing list