diff mbox series

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

Message ID 20200426193824.171193-2-sjg@chromium.org
State New
Headers show
Series x86: efi: Add a 64-bit coreboot payload | expand

Commit Message

Simon Glass April 26, 2020, 7:38 p.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>
---

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

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

Comments

Heinrich Schuchardt April 26, 2020, 8:21 p.m. UTC | #1
On 4/26/20 9:38 PM, Simon Glass wrote:
> It is useful to know what mode U-Boot is running in. Add a message at the
> end of the 'bdinfo' output.

X86 is not the only architecture that can run both in 32bit and 64bit
mode. The same is true for ARM and SANDBOX. Shouldn't we provide the
information for these architecture too?

The Raspberry Pi 3 is an example of an ARM board where building either
32bit or 64bit U-Boot is used depending on the bitness of the OS.

Best regards

Heinrich

>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> Changes in v2:
> - Add a new patch to indicate 32/64-bit in bdinfo
>
>  cmd/bdinfo.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> index d6a7175b37..a3129c9fe1 100644
> --- a/cmd/bdinfo.c
> +++ b/cmd/bdinfo.c
> @@ -388,6 +388,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  	print_mhz("ethspeed",	    bd->bi_ethspeed);
>  #endif
>  	print_baudrate();
> +	printf("Build: %d-bit\n", CONFIG_IS_ENABLED(X86_64) ? 64 : 32);
>
>  	return 0;
>  }
>
Simon Glass April 26, 2020, 8:32 p.m. UTC | #2
Hi Heinrich,

On Sun, 26 Apr 2020 at 14:21, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 4/26/20 9:38 PM, Simon Glass wrote:
> > It is useful to know what mode U-Boot is running in. Add a message at the
> > end of the 'bdinfo' output.
>
> X86 is not the only architecture that can run both in 32bit and 64bit
> mode. The same is true for ARM and SANDBOX. Shouldn't we provide the
> information for these architecture too?
>
> The Raspberry Pi 3 is an example of an ARM board where building either
> 32bit or 64bit U-Boot is used depending on the bitness of the OS.

Yes I think that would be good. But do we have a generic way to tell?
sizeof(int) ?

Regards,
Simon


>
> Best regards
>
> Heinrich
>
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > Changes in v2:
> > - Add a new patch to indicate 32/64-bit in bdinfo
> >
> >  cmd/bdinfo.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
> > index d6a7175b37..a3129c9fe1 100644
> > --- a/cmd/bdinfo.c
> > +++ b/cmd/bdinfo.c
> > @@ -388,6 +388,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> >       print_mhz("ethspeed",       bd->bi_ethspeed);
> >  #endif
> >       print_baudrate();
> > +     printf("Build: %d-bit\n", CONFIG_IS_ENABLED(X86_64) ? 64 : 32);
> >
> >       return 0;
> >  }
> >
>
Heinrich Schuchardt April 26, 2020, 9:14 p.m. UTC | #3
On 4/26/20 10:32 PM, Simon Glass wrote:
> Hi Heinrich,
>
> On Sun, 26 Apr 2020 at 14:21, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>>
>> On 4/26/20 9:38 PM, Simon Glass wrote:
>>> It is useful to know what mode U-Boot is running in. Add a message at the
>>> end of the 'bdinfo' output.
>>
>> X86 is not the only architecture that can run both in 32bit and 64bit
>> mode. The same is true for ARM and SANDBOX. Shouldn't we provide the
>> information for these architecture too?
>>
>> The Raspberry Pi 3 is an example of an ARM board where building either
>> 32bit or 64bit U-Boot is used depending on the bitness of the OS.
>
> Yes I think that would be good. But do we have a generic way to tell?
> sizeof(int) ?

sizeof(int) = 4 on aarch64.

Using these should be fine:

CONFIG_ARM64=y
CONFIG_ARCH_RV64I=y
CONFIG_SANDBOX64=y

(continued below)

>
> Regards,
> Simon
>
>
>>
>> Best regards
>>
>> Heinrich
>>
>>>
>>> Signed-off-by: Simon Glass <sjg at chromium.org>
>>> ---
>>>
>>> Changes in v2:
>>> - Add a new patch to indicate 32/64-bit in bdinfo
>>>
>>>  cmd/bdinfo.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
>>> index d6a7175b37..a3129c9fe1 100644
>>> --- a/cmd/bdinfo.c
>>> +++ b/cmd/bdinfo.c
>>> @@ -388,6 +388,7 @@ int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>>>       print_mhz("ethspeed",       bd->bi_ethspeed);
>>>  #endif
>>>       print_baudrate();
>>> +     printf("Build: %d-bit\n", CONFIG_IS_ENABLED(X86_64) ? 64 : 32);

"Build" it usually used to refer to a software release.

Should this be:

    printf("bitness     = %d\n", ...

or simply

    printf("%d-bit\n", ...

Best regards

Heinrich

>>>
>>>       return 0;
>>>  }
>>>
>>
Mark Kettenis April 26, 2020, 9:23 p.m. UTC | #4
> From: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Date: Sun, 26 Apr 2020 23:14:25 +0200
> 
> On 4/26/20 10:32 PM, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On Sun, 26 Apr 2020 at 14:21, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
> >>
> >> On 4/26/20 9:38 PM, Simon Glass wrote:
> >>> It is useful to know what mode U-Boot is running in. Add a message at the
> >>> end of the 'bdinfo' output.
> >>
> >> X86 is not the only architecture that can run both in 32bit and 64bit
> >> mode. The same is true for ARM and SANDBOX. Shouldn't we provide the
> >> information for these architecture too?
> >>
> >> The Raspberry Pi 3 is an example of an ARM board where building either
> >> 32bit or 64bit U-Boot is used depending on the bitness of the OS.
> >
> > Yes I think that would be good. But do we have a generic way to tell?
> > sizeof(int) ?
> 
> sizeof(int) = 4 on aarch64.

sizeof(void *) should work

(and sizeof(long) should work as well, but then there is Windows)

> Using these should be fine:
> 
> CONFIG_ARM64=y
> CONFIG_ARCH_RV64I=y
> CONFIG_SANDBOX64=y

MIPS and PowerPC can be 64-bit as well.  I don't think checking config
options scales.
diff mbox series

Patch

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index d6a7175b37..a3129c9fe1 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -388,6 +388,7 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_mhz("ethspeed",	    bd->bi_ethspeed);
 #endif
 	print_baudrate();
+	printf("Build: %d-bit\n", CONFIG_IS_ENABLED(X86_64) ? 64 : 32);
 
 	return 0;
 }