[PATCH 1/3] efi_loader: initrddump: use efi_uintn_t in printx
Adriano Cordova Fedeli
adriano.cordova at canonical.com
Wed May 7 17:45:38 CEST 2025
On Wed, 7 May 2025 at 11:03, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
> Am 7. Mai 2025 16:46:17 MESZ schrieb Adriano Cordova <adrianox at gmail.com>:
> >Use efi_uintn_t so that it also works in 32-bits.
> >
> >Signed-off-by: Adriano Cordova <adriano.cordova at canonical.com>
> >---
> > lib/efi_loader/initrddump.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/lib/efi_loader/initrddump.c b/lib/efi_loader/initrddump.c
> >index 615119043d1..8d08f7c5cd5 100644
> >--- a/lib/efi_loader/initrddump.c
> >+++ b/lib/efi_loader/initrddump.c
> >@@ -99,7 +99,7 @@ static void error(u16 *string)
> > * @val: value to print;
> > * @prec: minimum number of digits to print
> > */
> >-static void printx(u64 val, u32 prec)
> >+static void printx(efi_uintn_t val, u32 prec)
> > {
> > int i;
> > u16 c;
> >@@ -342,7 +342,7 @@ static efi_status_t do_load(void)
> > return EFI_LOAD_ERROR;
> > }
> > print(u"crc32: 0x");
> >- printx(crc32, 8);
> >+ printx((efi_uintn_t)crc32, 8);
>
> Why wouldn't the code work for u64 which is defined as unsigned long long?
> That type must be supported by all EFI architectures.
>
> Best regards
>
> Heinrich
>
> To be honest I do not know, but it does not run. The function printx works
with an u64 argument, but it is currently called with initrd_size,
which is an UINTN as returned by the LF2 protocol, and with crc32, which is
u32. The compiler should do the conversions by itself, but
for some reason if u64 is used the app initirddump.efi does not run on
riscv32: the booting freezes both locally and in the CI and is not
debuggable by printf statements (i.e. no printf in initrddump:efi_main(),
even before the first call to printx, prints).
Best,
Adriano
>
> > print(u"\r\n");
> >
> > return EFI_SUCCESS;
>
>
More information about the U-Boot
mailing list