[PATCH v2 05/39] x86: Show some EFI info with the bdinfo command

Simon Glass sjg at chromium.org
Tue Oct 26 05:29:31 CEST 2021


Hi Heinrich,

On Mon, 18 Oct 2021 at 11:15, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 9/25/21 2:30 AM, Simon Glass wrote:
> > It is useful to see some basic EFI info with the command as it forms part
> > of the information about a board.
> >
> > Add a hook for this and show the table address as a start.
> >
> > While here, fix an invalid cast in setup_efi_info(). Note that this
> > function is using a data structure defined by Linux so we cannot change
> > it. Also note that ulong is used since this is the standard in U-Boot
> > (>6k uses), despite there being quite a bit of the more verbose uintptr_t
> > (930 uses).
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > Changes in v2:
> > - Update commit message to mention why the data structure is like it is
> > - Update commit message to mention why ulong is used
> >
> >   arch/x86/cpu/efi/payload.c | 13 +++++++++++--
> >   arch/x86/include/asm/efi.h |  7 +++++++
> >   arch/x86/lib/Makefile      |  1 +
> >   arch/x86/lib/bdinfo.c      | 22 ++++++++++++++++++++++
> >   4 files changed, 41 insertions(+), 2 deletions(-)
> >   create mode 100644 arch/x86/lib/bdinfo.c
> >
> > diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c
> > index 9a73b768e9b..3a9f7d72868 100644
> > --- a/arch/x86/cpu/efi/payload.c
> > +++ b/arch/x86/cpu/efi/payload.c
> > @@ -280,15 +280,24 @@ void setup_efi_info(struct efi_info *efi_info)
> >       }
> >       efi_info->efi_memdesc_size = map->desc_size;
> >       efi_info->efi_memdesc_version = map->version;
> > -     efi_info->efi_memmap = (u32)(map->desc);
> > +     efi_info->efi_memmap = (ulong)(map->desc);
> >       efi_info->efi_memmap_size = size - sizeof(struct efi_entry_memmap);
> >
> >   #ifdef CONFIG_EFI_STUB_64BIT
> >       efi_info->efi_systab_hi = table->sys_table >> 32;
> > -     efi_info->efi_memmap_hi = (u64)(u32)(map->desc) >> 32;
> > +     efi_info->efi_memmap_hi = (u64)(ulong)map->desc >> 32;
> >       signature = EFI64_LOADER_SIGNATURE;
> >   #else
> >       signature = EFI32_LOADER_SIGNATURE;
> >   #endif
> >       memcpy(&efi_info->efi_loader_signature, signature, 4);
> >   }
> > +
> > +void efi_show_bdinfo(void)
> > +{
> > +     struct efi_entry_systable *table = NULL;
> > +     int size, ret;
> > +
> > +     ret = efi_info_get(EFIET_SYS_TABLE, (void **)&table, &size);
> > +     bdinfo_print_num_l("efi_table", (ulong)table);
>
> Some properties of the UEFI API depend on the UEFI API version
> (EFI_SYSTEM_TABLE.FirmwareRevision)

OK I will add a patch.

>
> The revision of the EFI_FILE_PROTOCOL may also be relevant for U-Boot.
>
> Maybe you want to add this information in a later patch.

This is tricky because the protocol version is no-longer available
once the payload has loaded.

[..]

Regards,
Simon


More information about the U-Boot mailing list