1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

ichspi: improve prettyprint_opcodes

Add headers for the columns and some decoding into human readable format.

Corresponding to flashrom svn r1444.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
Stefan Tauner 2011-09-17 19:53:11 +00:00
parent 1e14639f42
commit 84e1ddea5f

View File

@ -294,22 +294,34 @@ static OPCODES O_EXISTING = {};
/* pretty printing functions */ /* pretty printing functions */
static void prettyprint_opcodes(OPCODES *ops) static void prettyprint_opcodes(OPCODES *ops)
{ {
if(ops == NULL) OPCODE oc;
const char *t;
const char *a;
uint8_t i;
static const char *const spi_type[4] = {
"read w/o addr",
"write w/o addr",
"read w/ addr",
"write w/ addr"
};
static const char *const atomic_type[3] = {
"none",
" 0 ",
" 1 "
};
if (ops == NULL)
return; return;
msg_pdbg("preop0=0x%02x, preop1=0x%02x\n", ops->preop[0], msg_pdbg2(" OP Type Pre-OP\n");
ops->preop[1]);
OPCODE oc;
uint8_t i;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
oc = ops->opcode[i]; oc = ops->opcode[i];
msg_pdbg("op[%d]=0x%02x, %d, %d\n", t = (oc.spi_type > 3) ? "invalid" : spi_type[oc.spi_type];
i, a = (oc.atomic > 2) ? "invalid" : atomic_type[oc.atomic];
oc.opcode, msg_pdbg2("op[%d]: 0x%02x, %s, %s\n", i, oc.opcode, t, a);
oc.spi_type,
oc.atomic);
} }
msg_pdbg2("Pre-OP 0: 0x%02x, Pre-OP 1: 0x%02x\n", ops->preop[0],
ops->preop[1]);
} }
#define pprint_reg(reg, bit, val, sep) msg_pdbg("%s=%d" sep, #bit, (val & reg##_##bit)>>reg##_##bit##_OFF) #define pprint_reg(reg, bit, val, sep) msg_pdbg("%s=%d" sep, #bit, (val & reg##_##bit)>>reg##_##bit##_OFF)
@ -672,7 +684,6 @@ static int ich_init_opcodes(void)
curopcodes = curopcodes_done; curopcodes = curopcodes_done;
msg_pdbg("done\n"); msg_pdbg("done\n");
prettyprint_opcodes(curopcodes); prettyprint_opcodes(curopcodes);
msg_pdbg("\n");
return 0; return 0;
} }
} }