[Skiboot] [PATCH] phb4_creset: Skip the freset presence detect check

Oliver O'Halloran oohall at gmail.com
Wed Nov 7 11:52:36 AEDT 2018

The phb4_creset() function uses phb4_freset() to bring up the slot
after the PHB logic is brought out of reset. When switching to using
the freset logic it resets the slot state to PHB4_SLOT_NORMAL.

When entering phb4_freset in the normal state we check if there is
a card present in the slot and take an early exit if there is no
card detected.

This is broken when there is no physical presence detect signal
(optional for non-hotplug slots) because we rely on the in-band
presence detect mechanism which will always report no presence
while PERST# is asserted.

We can fix this by skipping the PHB4_SLOT_NORMAL state and entering
PHB4_SLOT_FRESET_START directly, which is what we do at boot time.
 hw/phb4.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/phb4.c b/hw/phb4.c
index 49ce1cdfd959..2de7c71ba353 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -3264,7 +3264,8 @@ static int64_t phb4_creset(struct pci_slot *slot)
 		pci_slot_set_state(slot, PHB4_SLOT_CRESET_FRESET);
 		return pci_slot_set_sm_timeout(slot, msecs_to_tb(100));
-		pci_slot_set_state(slot, PHB4_SLOT_NORMAL);
+		pci_slot_set_state(slot, PHB4_SLOT_FRESET_START);
 		return slot->ops.freset(slot);
 		PHBERR(p, "CRESET: Unexpected slot state %08x, resetting...\n",

More information about the Skiboot mailing list