From eab5c12ee0ba26bcf5412b3fb216b98db6bbc542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Mon, 4 Sep 2017 11:10:17 +0300 Subject: util/cbmem: Pretty print STAGEx_META and _CACHE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also align entries without name with additional indents. Change-Id: Ia6aa303daa11e6aec249232aadf4e346bad659d5 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/21383 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- util/cbmem/cbmem.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'util') 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); -- cgit v1.2.3