diff mbox series

[1/2] pci: Track peers of slots

Message ID 20171120063213.22892-1-ruscur@russell.cc
State Accepted
Headers show
Series [1/2] pci: Track peers of slots | expand

Commit Message

Russell Currey Nov. 20, 2017, 6:32 a.m. UTC
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@russell.cc>
---
 core/pci-slot.c                | 1 +
 include/pci-slot.h             | 1 +
 platforms/astbmc/witherspoon.c | 5 ++++-
 3 files changed, 6 insertions(+), 1 deletion(-)

Comments

Stewart Smith Nov. 22, 2017, 3:36 a.m. UTC | #1
Russell Currey <ruscur@russell.cc> writes:
> 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@russell.cc>

Thanks, series merged to master as of 1172a6c57ff3c66f6361e572a1790cbcc0e5ff37
diff mbox series

Patch

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;
+		}
 	}
 }