[5/6] phb4: Ignore slot state if performing complete reset

Message ID 20170810065843.13893-5-ruscur@russell.cc
State Accepted
Headers show

Commit Message

Russell Currey Aug. 10, 2017, 6:58 a.m.
If a PHB is being completely reset, its state is about to be blown away
anyway, so if it's not in an appropriate state, creset it regardless.

Signed-off-by: Russell Currey <ruscur@russell.cc>
---
 hw/phb4.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch

diff --git a/hw/phb4.c b/hw/phb4.c
index b467e369..d13ab8c3 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -2700,8 +2700,11 @@  static int64_t phb4_creset(struct pci_slot *slot)
 		pci_slot_set_state(slot, PHB4_SLOT_NORMAL);
 		return slot->ops.freset(slot);
 	default:
-		PHBERR(p, "CRESET: Unexpected slot state %08x\n",
+		PHBERR(p, "CRESET: Unexpected slot state %08x, resetting...\n",
 		       slot->state);
+		pci_slot_set_state(slot, PHB4_SLOT_NORMAL);
+		return slot->ops.creset(slot);
+
 	}
 
 error: