summaryrefslogtreecommitdiff
path: root/cmd/bdinfo.c
diff options
context:
space:
mode:
authorOvidiu Panait <ovpanait@gmail.com>2022-08-29 20:02:04 +0300
committerMichal Simek <michal.simek@amd.com>2022-09-13 11:32:48 +0200
commitae90d16ac78a2d7bd0327f71c26b46b5182315d3 (patch)
tree2ae7c84ffeecf2e751382c2b4b412a307531b87c /cmd/bdinfo.c
parent3f351cd358a3581844f3cacdfe60710bf925d75d (diff)
cmd: bdinfo: introduce bdinfo_print_size() helper
Add bdinfo_print_size() helper to display size variables (such as cache sizes) in bdinfo format. The size is printed as "xxx Bytes", "xxx KiB", "xxx MiB", "xxx GiB", etc as needed; Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Ovidiu Panait <ovpanait@gmail.com> Reviewed-by: Jason Liu <jason.hui.liu@nxp.com> Link: https://lore.kernel.org/r/20220829170205.1274484-3-ovpanait@gmail.com Signed-off-by: Michal Simek <michal.simek@amd.com>
Diffstat (limited to 'cmd/bdinfo.c')
-rw-r--r--cmd/bdinfo.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 8a1bea4e34..af2e9757db 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -16,9 +16,16 @@
#include <vsprintf.h>
#include <asm/cache.h>
#include <asm/global_data.h>
+#include <display_options.h>
DECLARE_GLOBAL_DATA_PTR;
+void bdinfo_print_size(const char *name, uint64_t size)
+{
+ printf("%-12s= ", name);
+ print_size(size, "\n");
+}
+
void bdinfo_print_num_l(const char *name, ulong value)
{
printf("%-12s= 0x%0*lx\n", name, 2 * (int)sizeof(value), value);