Skip to content

Commit 8b3012e

Browse files
committed
hw/p8-i2c: Don't print warnings when dumping registers
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>
1 parent 08cd61e commit 8b3012e

File tree

1 file changed

+10
-42
lines changed

1 file changed

+10
-42
lines changed

hw/p8-i2c.c

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ static void p8_i2c_print_debug_info(struct p8_i2c_master_port *port,
237237
{
238238
struct p8_i2c_master *master = port->master;
239239
uint64_t cmd, mode, stat, estat, intm, intc;
240-
int rc;
241240

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

258-
/* Dump the current state of i2c registers */
259-
rc = xscom_read(master->chip_id, master->xscom_base + I2C_CMD_REG,
260-
&cmd);
261-
if (rc) {
262-
prlog(PR_DEBUG, "I2C: Failed to read CMD_REG\n");
263-
cmd = 0ull;
264-
}
265-
266-
rc = xscom_read(master->chip_id, master->xscom_base + I2C_MODE_REG,
267-
&mode);
268-
if (rc) {
269-
prlog(PR_DEBUG, "I2C: Failed to read MODE_REG\n");
270-
mode = 0ull;
271-
}
272-
273-
rc = xscom_read(master->chip_id, master->xscom_base + I2C_STAT_REG,
274-
&stat);
275-
if (rc) {
276-
prlog(PR_DEBUG, "I2C: Failed to read STAT_REG\n");
277-
stat = 0ull;
278-
}
257+
/* initialise to some fake value in case of read errors */
258+
cmd = mode = stat = estat = intm = intc = 0xDEAD;
279259

280-
rc = xscom_read(master->chip_id, master->xscom_base + I2C_EXTD_STAT_REG,
281-
&estat);
282-
if (rc) {
283-
prlog(PR_DEBUG, "I2C: Failed to read EXTD_STAT_REG\n");
284-
estat = 0ull;
285-
}
286-
287-
rc = xscom_read(master->chip_id, master->xscom_base + I2C_INTR_MASK_REG,
288-
&intm);
289-
if (rc) {
290-
prlog(PR_DEBUG, "I2C: Failed to read INTR_MASK_REG\n");
291-
intm = 0ull;
292-
}
293-
294-
rc = xscom_read(master->chip_id, master->xscom_base + I2C_INTR_COND_REG,
295-
&intc);
296-
if (rc) {
297-
prlog(PR_DEBUG, "I2C: Failed to read INTR_COND_REG\n");
298-
intc = 0ull;
299-
}
260+
/* Dump the current state of i2c registers */
261+
i2cm_read_reg(master, I2C_CMD_REG, &cmd);
262+
i2cm_read_reg(master, I2C_MODE_REG, &mode);
263+
i2cm_read_reg(master, I2C_MODE_REG, &mode);
264+
i2cm_read_reg(master, I2C_STAT_REG, &stat);
265+
i2cm_read_reg(master, I2C_EXTD_STAT_REG, &estat);
266+
i2cm_read_reg(master, I2C_INTR_MASK_REG, &intm);
267+
i2cm_read_reg(master, I2C_INTR_COND_REG, &intc);
300268

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

0 commit comments

Comments
 (0)