diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2017-09-04 11:10:17 +0300 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2017-09-06 17:25:23 +0000 |
commit | eab5c12ee0ba26bcf5412b3fb216b98db6bbc542 (patch) | |
tree | 123b5703bffd18e5a8fd2a762c4f613c653ddd6b /util | |
parent | 900ecbf6e1772fa0c73f4152a6a35f6a4c6c907a (diff) |
util/cbmem: Pretty print STAGEx_META and _CACHE
Also align entries without name with additional indents.
Change-Id: Ia6aa303daa11e6aec249232aadf4e346bad659d5
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/21383
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/cbmem/cbmem.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c index 4c1fa0e0d9..c9df9eef08 100644 --- a/util/cbmem/cbmem.c +++ b/util/cbmem/cbmem.c @@ -809,10 +809,12 @@ struct cbmem_id_to_name { }; static const struct cbmem_id_to_name cbmem_ids[] = { CBMEM_ID_TO_NAME_TABLE }; +#define MAX_STAGEx 10 void cbmem_print_entry(int n, uint32_t id, uint64_t base, uint64_t size) { int i; const char *name; + char stage_x[20]; name = NULL; for (i = 0; i < ARRAY_SIZE(cbmem_ids); i++) { @@ -820,11 +822,23 @@ void cbmem_print_entry(int n, uint32_t id, uint64_t base, uint64_t size) name = cbmem_ids[i].name; break; } + if (id >= CBMEM_ID_STAGEx_META && + id < CBMEM_ID_STAGEx_META + MAX_STAGEx) { + snprintf(stage_x, sizeof(stage_x), "STAGE%d META", + (id - CBMEM_ID_STAGEx_META)); + name = stage_x; + } + if (id >= CBMEM_ID_STAGEx_CACHE && + id < CBMEM_ID_STAGEx_CACHE + MAX_STAGEx) { + snprintf(stage_x, sizeof(stage_x), "STAGE%d $ ", + (id - CBMEM_ID_STAGEx_CACHE)); + name = stage_x; + } } printf("%2d. ", n); if (name == NULL) - printf("%08x ", id); + printf("\t\t%08x", id); else printf("%s\t%08x", name, id); printf(" %08" PRIx64 " ", base); |