[Skiboot] [PATCH] hw/p8-i2c: Print the set error bits

Oliver O'Halloran oohall at gmail.com
Tue Jul 31 17:16:47 AEST 2018


This is purely to save me from having to look it up every time someone
gets an I2C error.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 hw/p8-i2c.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index 3bf9678ce976..905834b86e54 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -318,6 +318,16 @@ static void p8_i2c_print_debug_info(struct p8_i2c_master_port *port,
 			 "    cmd:0x%016llx\tmode:0x%016llx\tstat:0x%016llx\n"
 			 "  estat:0x%016llx\tintm:0x%016llx\tintc:0x%016llx\n",
 			 cmd, mode, stat, estat, intm, intc);
+
+	log_simple_error(&e_info(OPAL_RC_I2C_TRANSFER),
+		"I2C: Error bits set: %s%s%s%s%s%s%s\n",
+		(stat & I2C_STAT_NACK_RCVD_ERR) ? "nack, " : "",
+		(stat & I2C_STAT_INVALID_CMD) ? "cmd invalid, " : "",
+		(stat & I2C_STAT_LBUS_PARITY_ERR) ? "interal parity, " : "",
+		(stat & I2C_STAT_BKEND_OVERRUN_ERR) ? "backend overrun, " : "",
+		(stat & I2C_STAT_BKEND_ACCESS_ERR) ? "backend access, " : "",
+		(stat & I2C_STAT_ARBT_LOST_ERR) ? "arbitration loss, " : "",
+		(stat & I2C_STAT_STOP_ERR) ? "stop error, " : "");
 }
 
 static bool p8_i2c_has_irqs(struct p8_i2c_master *master)
-- 
2.9.5



More information about the Skiboot mailing list