diff mbox series

hw/p8-i2c: Print the set error bits

Message ID 20180731071647.708-1-oohall@gmail.com
State Accepted
Headers show
Series hw/p8-i2c: Print the set error bits | expand

Checks

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

Commit Message

Oliver O'Halloran July 31, 2018, 7:16 a.m. UTC
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@gmail.com>
---
 hw/p8-i2c.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Stewart Smith Aug. 2, 2018, 6:49 a.m. UTC | #1
"Oliver O'Halloran" <oohall@gmail.com> writes:
> 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@gmail.com>
> ---
>  hw/p8-i2c.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)

I was going to make some wisecrack of just asking you what they meant,
but in reality I'd just look them up and grumble loudly to myself.

Merged to master as of b465be797e8673a38e6b136b18ed593335cfe11e
diff mbox series

Patch

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)