diff options
author | Matt DeVillier <matt.devillier@gmail.com> | 2024-01-15 18:11:43 -0600 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-01-18 16:48:47 +0000 |
commit | e9786d46fa7844f0aad588a6c0698c3bb2d3c08c (patch) | |
tree | 67a87859aa6584fe58a1a43b9aa1542319f575ab | |
parent | 24d765d3208d6fa1675cafd0c93cb6905f09e733 (diff) |
util/superiotool: reformat alternate dump output
Reformat alternate dump output to show default values before read
values, and to use brackets to visually indicate which values differ
from the defaults.
old output:
Register dump:
idx val def
0x07: 0x0b (0x00)
0x10: 0xff (0xff)
0x11: 0xff (0xff)
...
new output:
Register dump:
idx def val
0x07: 0x00 [0x0b]
0x10: 0xff 0xff
0x11: 0xff 0xff
...
TEST=build/dump registers from Erying SRMJ4 w/Nuvoton NCT6796D.
Change-Id: Idef2cc136151328b114620eb297ab8fd62b71bcd
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80004
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
-rw-r--r-- | util/superiotool/superiotool.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/util/superiotool/superiotool.c b/util/superiotool/superiotool.c index 576e9e6702..aee5026189 100644 --- a/util/superiotool/superiotool.c +++ b/util/superiotool/superiotool.c @@ -107,25 +107,32 @@ static void dump_regs(const struct superio_registers reg_table[], if (alternate_dump) { int skip_def = 0; + int val; - printf("\nidx val def\n"); + printf("\nidx def val\n"); for (k = 0; idx[k] != EOT; k++) { - printf("0x%02x: 0x%02x", idx[k], regval(port, idx[k])); - if (skip_def || def[k] == EOT) { skip_def = 1; printf("\n"); continue; } + + printf("0x%02x: ", idx[k]); + val = regval(port, idx[k]); + if (def[k] == NANA) - printf(" (NA)\n"); + printf("(NA) 0x%02x\n", val); else if (def[k] == RSVD) - printf(" (RR)\n"); + printf("(RR) 0x%02x\n", val); else if (def[k] == MISC) - printf(" (MM)\n"); - else - printf(" (0x%02x)\n", def[k]); + printf("(MM) 0x%02x\n", val); + else { + if (def[k] == val) + printf("0x%02x 0x%02x\n", def[k], val); + else + printf("0x%02x [0x%02x]\n", def[k], val); + } } } else { printf("\nidx"); |