Skip to content

Commit

Permalink
hw/p8-i2c: Don't print warnings when dumping registers
Browse files Browse the repository at this point in the history
There's not much point complaining if we can't collect debug data. Log a
obviously-wrong value and continue. Also convert to using
i2cm_read_reg() rather than xscom_read() directly while we're here.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
oohal committed Dec 4, 2019
1 parent 08cd61e commit 8b3012e
Showing 1 changed file with 10 additions and 42 deletions.
52 changes: 10 additions & 42 deletions hw/p8-i2c.c
Expand Up @@ -237,7 +237,6 @@ static void p8_i2c_print_debug_info(struct p8_i2c_master_port *port,
{
struct p8_i2c_master *master = port->master;
uint64_t cmd, mode, stat, estat, intm, intc;
int rc;

/* Print master and request structure bits */
log_simple_error(&e_info(OPAL_RC_I2C_TRANSFER),
Expand All @@ -255,48 +254,17 @@ static void p8_i2c_print_debug_info(struct p8_i2c_master_port *port,
" start_time=%016llx end_time=%016llx (duration=%016llx)\n",
master->start_time, end_time, end_time - master->start_time);

/* Dump the current state of i2c registers */
rc = xscom_read(master->chip_id, master->xscom_base + I2C_CMD_REG,
&cmd);
if (rc) {
prlog(PR_DEBUG, "I2C: Failed to read CMD_REG\n");
cmd = 0ull;
}

rc = xscom_read(master->chip_id, master->xscom_base + I2C_MODE_REG,
&mode);
if (rc) {
prlog(PR_DEBUG, "I2C: Failed to read MODE_REG\n");
mode = 0ull;
}

rc = xscom_read(master->chip_id, master->xscom_base + I2C_STAT_REG,
&stat);
if (rc) {
prlog(PR_DEBUG, "I2C: Failed to read STAT_REG\n");
stat = 0ull;
}
/* initialise to some fake value in case of read errors */
cmd = mode = stat = estat = intm = intc = 0xDEAD;

rc = xscom_read(master->chip_id, master->xscom_base + I2C_EXTD_STAT_REG,
&estat);
if (rc) {
prlog(PR_DEBUG, "I2C: Failed to read EXTD_STAT_REG\n");
estat = 0ull;
}

rc = xscom_read(master->chip_id, master->xscom_base + I2C_INTR_MASK_REG,
&intm);
if (rc) {
prlog(PR_DEBUG, "I2C: Failed to read INTR_MASK_REG\n");
intm = 0ull;
}

rc = xscom_read(master->chip_id, master->xscom_base + I2C_INTR_COND_REG,
&intc);
if (rc) {
prlog(PR_DEBUG, "I2C: Failed to read INTR_COND_REG\n");
intc = 0ull;
}
/* Dump the current state of i2c registers */
i2cm_read_reg(master, I2C_CMD_REG, &cmd);
i2cm_read_reg(master, I2C_MODE_REG, &mode);
i2cm_read_reg(master, I2C_MODE_REG, &mode);
i2cm_read_reg(master, I2C_STAT_REG, &stat);
i2cm_read_reg(master, I2C_EXTD_STAT_REG, &estat);
i2cm_read_reg(master, I2C_INTR_MASK_REG, &intm);
i2cm_read_reg(master, I2C_INTR_COND_REG, &intc);

log_simple_error(&e_info(OPAL_RC_I2C_TRANSFER), "I2C: Register dump--\n"
" cmd:0x%016llx\tmode:0x%016llx\tstat:0x%016llx\n"
Expand Down

0 comments on commit 8b3012e

Please sign in to comment.