diff mbox

[03/10] phb4: Better logs why the slot didn't work

Message ID 20170720062220.14667-3-mikey@neuling.org
State Accepted
Headers show

Commit Message

Michael Neuling July 20, 2017, 6:22 a.m. UTC
Better logs why the slot didn't work and make it a PR_ERR so users
see it by default.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---
 hw/phb4.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/hw/phb4.c b/hw/phb4.c
index 16304d52ac..48c591f4f3 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -2167,7 +2167,16 @@  static int64_t phb4_retry_state(struct pci_slot *slot)
 	struct phb4 *p = phb_to_phb4(slot->phb);
 
 	if (!slot->link_retries--) {
-		PHBERR(p, "Link detected but won't train\n");
+		switch (slot->state) {
+		case PHB4_SLOT_LINK_WAIT_ELECTRICAL:
+			PHBERR(p, "Presence detected but no electrical link\n");
+			break;
+		case PHB4_SLOT_LINK_WAIT:
+			PHBERR(p, "Electrical link detected but won't train\n");
+			break;
+		default:
+			PHBERR(p, "Unknown link issue\n");
+		}
 		return OPAL_HARDWARE;
 	}