diff mbox series

[v3,6/7] x86: Add an indication of 32/64-bit to bdinfo

Message ID 20200501032145.110637-3-sjg@chromium.org
State Superseded
Headers show
Series x86: efi: Add a 64-bit coreboot payload | expand

Commit Message

Simon Glass May 1, 2020, 3:21 a.m. UTC
It is useful to know what mode U-Boot is running in. Add a message at the
end of the 'bdinfo' output.

Signed-off-by: Simon Glass <sjg at chromium.org>
Suggested-by: Mark Kettenis <kettenis at openbsd.org>
---

Changes in v3:
- Show bit width for all archs, use sizeof(void *)

Changes in v2:
- Add a new patch to indicate 32/64-bit in bdinfo

 cmd/bdinfo.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Heinrich Schuchardt May 1, 2020, 3:39 a.m. UTC | #1
Am May 1, 2020 3:21:44 AM UTC schrieb Simon Glass <sjg at chromium.org>:
>It is useful to know what mode U-Boot is running in. Add a message at
>the
>end of the 'bdinfo' output.
>
>Signed-off-by: Simon Glass <sjg at chromium.org>
>Suggested-by: Mark Kettenis <kettenis at openbsd.org>
>---
>
>Changes in v3:
>- Show bit width for all archs, use sizeof(void *)
>
>Changes in v2:
>- Add a new patch to indicate 32/64-bit in bdinfo
>
> cmd/bdinfo.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
>diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
>index d6a7175b37..34de89eb6d 100644
>--- a/cmd/bdinfo.c
>+++ b/cmd/bdinfo.c
>@@ -15,6 +15,11 @@
> 
> DECLARE_GLOBAL_DATA_PTR;
> 
>+__maybe_unused void print_cpu_word_size(void)
>+{
>+	printf("%-12s= %d-bit\n", "Build", (uint)sizeof(void *) * 8);

%d and uint do not match. Please, use %u for unsigned int.

Best regards

Heinrich

>+}
>+
> __maybe_unused
> static void print_num(const char *name, ulong value)
> {
>@@ -208,6 +213,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>char * const argv[])
> 	print_baudrate();
> 	print_num("relocaddr", gd->relocaddr);
> 	board_detail();
>+	print_cpu_word_size();
>+
> 	return 0;
> }
> 
>@@ -227,6 +234,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>char * const argv[])
> 
> 	print_eth_ip_addr();
> 	print_baudrate();
>+	print_cpu_word_size();
> 
> 	return 0;
> }
>@@ -252,6 +260,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>char * const argv[])
> 	print_num("fdt_blob", (ulong)gd->fdt_blob);
> 	print_num("new_fdt", (ulong)gd->new_fdt);
> 	print_num("fdt_size", (ulong)gd->fdt_size);
>+	print_cpu_word_size();
> 
> 	return 0;
> }
>@@ -283,6 +292,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>char * const argv[])
> #endif
> 	print_eth_ip_addr();
> 	print_baudrate();
>+	print_cpu_word_size();
> 
> 	return 0;
> }
>@@ -294,6 +304,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>char * const argv[])
> 	print_std_bdinfo(gd->bd);
> 	print_num("relocaddr", gd->relocaddr);
> 	print_num("reloc off", gd->reloc_off);
>+	print_cpu_word_size();
> 
> 	return 0;
> }
>@@ -354,6 +365,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag,
>int argc,
> #endif
> 	if (gd->fdt_blob)
> 		print_num("fdt_blob", (ulong)gd->fdt_blob);
>+	print_cpu_word_size();
> 
> 	return 0;
> }
>@@ -368,6 +380,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>char * const argv[])
> 	print_bi_flash(bd);
> 	print_eth_ip_addr();
> 	print_baudrate();
>+	print_cpu_word_size();
>+
> 	return 0;
> }
> 
>@@ -388,6 +402,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>char * const argv[])
> 	print_mhz("ethspeed",	    bd->bi_ethspeed);
> #endif
> 	print_baudrate();
>+	print_cpu_word_size();
> 
> 	return 0;
> }
>@@ -405,6 +420,8 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>char * const argv[])
> #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
> 	print_num("FB base  ", gd->fb_base);
> #endif
>+	print_cpu_word_size();
>+
> 	return 0;
> }
> 
>@@ -419,6 +436,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>char * const argv[])
> 	print_bi_dram(bd);
> 	print_eth_ip_addr();
> 	print_baudrate();
>+	print_cpu_word_size();
> 
> 	return 0;
> }
>@@ -435,6 +453,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>char * const argv[])
> 	print_num("reloc off", gd->reloc_off);
> 	print_eth_ip_addr();
> 	print_baudrate();
>+	print_cpu_word_size();
> 
> 	return 0;
> }
>@@ -448,6 +467,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
>char * const argv[])
> 	print_bi_mem(bd);
> 	print_eth_ip_addr();
> 	print_baudrate();
>+	print_cpu_word_size();
> 
> 	return 0;
> }
Simon Glass May 1, 2020, 3:59 a.m. UTC | #2
Hi Heinrich,

On Thu, 30 Apr 2020 at 21:39, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> Am May 1, 2020 3:21:44 AM UTC schrieb Simon Glass <sjg at chromium.org>:
> >It is useful to know what mode U-Boot is running in. Add a message at
> >the
> >end of the 'bdinfo' output.
> >
> >Signed-off-by: Simon Glass <sjg at chromium.org>
> >Suggested-by: Mark Kettenis <kettenis at openbsd.org>
> >---
> >
> >Changes in v3:
> >- Show bit width for all archs, use sizeof(void *)
> >
> >Changes in v2:
> >- Add a new patch to indicate 32/64-bit in bdinfo
> >
> > cmd/bdinfo.c | 20 ++++++++++++++++++++
> > 1 file changed, 20 insertions(+)
> >
> >diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> >index d6a7175b37..34de89eb6d 100644
> >--- a/cmd/bdinfo.c
> >+++ b/cmd/bdinfo.c
> >@@ -15,6 +15,11 @@
> >
> > DECLARE_GLOBAL_DATA_PTR;
> >
> >+__maybe_unused void print_cpu_word_size(void)
> >+{
> >+      printf("%-12s= %d-bit\n", "Build", (uint)sizeof(void *) * 8);
>
> %d and uint do not match. Please, use %u for unsigned int.

Yes I was thinking that but somehow managed to change one without the other.

Regards,
SImon
diff mbox series

Patch

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index d6a7175b37..34de89eb6d 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -15,6 +15,11 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
+__maybe_unused void print_cpu_word_size(void)
+{
+	printf("%-12s= %d-bit\n", "Build", (uint)sizeof(void *) * 8);
+}
+
 __maybe_unused
 static void print_num(const char *name, ulong value)
 {
@@ -208,6 +213,8 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_baudrate();
 	print_num("relocaddr", gd->relocaddr);
 	board_detail();
+	print_cpu_word_size();
+
 	return 0;
 }
 
@@ -227,6 +234,7 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	print_eth_ip_addr();
 	print_baudrate();
+	print_cpu_word_size();
 
 	return 0;
 }
@@ -252,6 +260,7 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_num("fdt_blob", (ulong)gd->fdt_blob);
 	print_num("new_fdt", (ulong)gd->new_fdt);
 	print_num("fdt_size", (ulong)gd->fdt_size);
+	print_cpu_word_size();
 
 	return 0;
 }
@@ -283,6 +292,7 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #endif
 	print_eth_ip_addr();
 	print_baudrate();
+	print_cpu_word_size();
 
 	return 0;
 }
@@ -294,6 +304,7 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_std_bdinfo(gd->bd);
 	print_num("relocaddr", gd->relocaddr);
 	print_num("reloc off", gd->reloc_off);
+	print_cpu_word_size();
 
 	return 0;
 }
@@ -354,6 +365,7 @@  static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 #endif
 	if (gd->fdt_blob)
 		print_num("fdt_blob", (ulong)gd->fdt_blob);
+	print_cpu_word_size();
 
 	return 0;
 }
@@ -368,6 +380,8 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_bi_flash(bd);
 	print_eth_ip_addr();
 	print_baudrate();
+	print_cpu_word_size();
+
 	return 0;
 }
 
@@ -388,6 +402,7 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_mhz("ethspeed",	    bd->bi_ethspeed);
 #endif
 	print_baudrate();
+	print_cpu_word_size();
 
 	return 0;
 }
@@ -405,6 +420,8 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
 	print_num("FB base  ", gd->fb_base);
 #endif
+	print_cpu_word_size();
+
 	return 0;
 }
 
@@ -419,6 +436,7 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_bi_dram(bd);
 	print_eth_ip_addr();
 	print_baudrate();
+	print_cpu_word_size();
 
 	return 0;
 }
@@ -435,6 +453,7 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_num("reloc off", gd->reloc_off);
 	print_eth_ip_addr();
 	print_baudrate();
+	print_cpu_word_size();
 
 	return 0;
 }
@@ -448,6 +467,7 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_bi_mem(bd);
 	print_eth_ip_addr();
 	print_baudrate();
+	print_cpu_word_size();
 
 	return 0;
 }