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>
This commit is contained in:
Kyösti Mälkki 2017-09-04 11:10:17 +03:00
parent 900ecbf6e1
commit eab5c12ee0
1 changed files with 15 additions and 1 deletions

View File

@ -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);