diff options
author | stefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2011-09-17 19:53:11 +0000 |
---|---|---|
committer | stefanct <stefanct@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2011-09-17 19:53:11 +0000 |
commit | 686aaad35040ae962a2dc09d4b433b1e96888b12 (patch) | |
tree | b274f6b1565e7f63344fbf08f1488606f789e12a /ichspi.c | |
parent | 63d394926754aef338416b0350c03fc651a65374 (diff) | |
download | flashrom-686aaad35040ae962a2dc09d4b433b1e96888b12.tar.gz |
ichspi: improve prettyprint_opcodes
add headers for the columns and some decoding into human readable format.
Signed-off-by: Stefan Tauner <stefan.tauner@student.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@1444 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'ichspi.c')
-rw-r--r-- | ichspi.c | 35 |
1 files changed, 23 insertions, 12 deletions
@@ -294,22 +294,34 @@ static OPCODES O_EXISTING = {}; /* pretty printing functions */ static void prettyprint_opcodes(OPCODES *ops) { - if(ops == NULL) - return; - - msg_pdbg("preop0=0x%02x, preop1=0x%02x\n", ops->preop[0], - ops->preop[1]); - 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; + + msg_pdbg2(" OP Type Pre-OP\n"); for (i = 0; i < 8; i++) { oc = ops->opcode[i]; - msg_pdbg("op[%d]=0x%02x, %d, %d\n", - i, - oc.opcode, - oc.spi_type, - oc.atomic); + t = (oc.spi_type > 3) ? "invalid" : spi_type[oc.spi_type]; + a = (oc.atomic > 2) ? "invalid" : atomic_type[oc.atomic]; + msg_pdbg2("op[%d]: 0x%02x, %s, %s\n", i, oc.opcode, t, a); } + 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) @@ -672,7 +684,6 @@ static int ich_init_opcodes(void) curopcodes = curopcodes_done; msg_pdbg("done\n"); prettyprint_opcodes(curopcodes); - msg_pdbg("\n"); return 0; } } |