[Skiboot] [PATCH 07/12] lpc: Fix lpc_probe_test

Deb McLemore debmc at linux.ibm.com
Fri Oct 18 08:53:20 AEDT 2019


lpc_probe_test is expecting the irqstat to be seeded with a NORESP_ERR,
so handle appropriately.

Signed-off-by: Deb McLemore <debmc at linux.ibm.com>
---
 hw/lpc.c | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/hw/lpc.c b/hw/lpc.c
index 354d2b4..657570a 100644
--- a/hw/lpc.c
+++ b/hw/lpc.c
@@ -485,9 +485,15 @@ static int64_t lpc_probe_test(struct lpcm *lpc)
 	const uint32_t irqmask_addr = lpc_reg_opb_base + LPC_HC_IRQMASK;
 	const uint32_t irqstat_addr = lpc_reg_opb_base + LPC_HC_IRQSTAT;
 	uint32_t irqmask, irqstat;
+	static int lpc_bus_probe_counter;
 	int64_t idx;
 	int rc;
 
+	++lpc_bus_probe_counter;
+	/* compensate by one for the probe that happens before interrupts enabled */
+	prlog(PR_NOTICE, "%s COMPARE lpc_bus_probe_counter=%i to lpc_bus_err_count in log\n",
+		__func__,
+		lpc_bus_probe_counter - 1);
 	rc = opb_read(lpc, irqstat_addr, &irqstat, 4);
 	if (rc)
 		return rc;
@@ -505,19 +511,27 @@ static int64_t lpc_probe_test(struct lpcm *lpc)
 	if (rc)
 		return rc;
 
-	if (!(irqstat & LPC_HC_IRQ_BASE_IRQS))
-		return OPAL_SUCCESS;
+	/* we are expecting LPC_HC_IRQ_SYNC_NORESP_ERR */
+	if ((irqstat & LPC_HC_IRQ_BASE_IRQS)) {
+		prlog(PR_NOTICE, "%s irqstat=0x%x OPAL_SUCCESS!\n",
+			__func__, irqstat);
+	} else {
+		/* maybe bad hardware or someting else ?? */
+		prlog(PR_NOTICE, "%s irqstat=0x%x INVESTIGATE!\n",
+			__func__, irqstat);
+	}
 
 	/* Ensure we can perform a valid lookup in the error table */
 	idx = LPC_ERROR_IDX(irqstat);
 	if (idx < 0 || idx >= ARRAY_SIZE(lpc_error_table)) {
-		prerror("LPC bus error translation failed with status 0x%x\n",
-			irqstat);
+		prlog(PR_ERR, "%s bus error translation failed with idx=%llu irqstat=0x%x\n",
+			__func__, idx, irqstat);
 		return OPAL_PARAMETER;
 	}
 
 	rc = lpc_error_table[idx].rc;
-	return rc;
+	prlog(PR_TRACE, "%s VALID LOOKUP CONFIRMED idx=%llu rc=0x%x\n", __func__, idx, rc);
+	return OPAL_SUCCESS;
 }
 
 static int64_t __lpc_write(struct lpcm *lpc, enum OpalLPCAddressType addr_type,
@@ -1037,6 +1051,9 @@ static void lpc_dispatch_err_irqs(struct lpcm *lpc, uint32_t irqs)
 	/* Find and report the error */
 	err = &lpc_error_table[idx];
 	lpc_bus_err_count++;
+	prlog(PR_NOTICE, "%s COMPARE lpc_bus_err_count=%i to lpc_bus_probe_counter in log\n",
+		__func__,
+		lpc_bus_err_count);
 	if (manufacturing_mode && (lpc_bus_err_count > LPC_BUS_DEGRADED_PERF_THRESHOLD))
 		info = &e_info(OPAL_RC_LPC_SYNC_PERF);
 	else
-- 
2.7.4



More information about the Skiboot mailing list