diff mbox series

phb4_creset: Skip the freset presence detect check

Message ID 20181107005236.30971-1-oohall@gmail.com
State New
Headers show
Series phb4_creset: Skip the freset presence detect check | expand


Context Check Description
snowpatch_ozlabs/make_check success Test make_check on branch master
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied

Commit Message

Oliver O'Halloran Nov. 7, 2018, 12:52 a.m. UTC
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 mbox series


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",