[PATCH v8 1/5] efi: add EFI_SYSTEM_TABLE_POINTER for debug

Ilias Apalodimas ilias.apalodimas at linaro.org
Thu Jul 3 10:41:30 CEST 2025


On Thu, 3 Jul 2025 at 10:25, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 03.07.25 08:28, Ying-Chun Liu (PaulLiu) wrote:
> > From: "Ying-Chun Liu (PaulLiu)" <paul.liu at linaro.org>
> >
> > Add EFI_SYSTEM_TABLE_POINTER structure for remote debugger to locate
> > the address of EFI_SYSTEM_TABLE.
> >
> > This feature is described in UEFI SPEC version 2.10. Section 18.4.2.
> > The implementation ensures support for hardware-assisted debugging and
> > provides a standardized mechanism for debuggers to discover the EFI
> > system table.
> >
> > Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu at linaro.org>
> > Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> > Tested-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> > Cc: Peter Robinson <pbrobinson at gmail.com>
> > Cc: Simon Glass <sjg at chromium.org>
> > ---
> > V2: add Kconfig options to turn on/off this feature.
> > V3: make efi_initialize_system_table_pointer() do the job as described.
> > V4: use efi_alloc_aligned_pages() for system_table_pointer.
> > V5: move the code into a separate module.
> > V6: Use macros to replace size_4MB
> > V7: Fix the code based on the review. Update license field.
> > V8: Fix pointer casting that causes qemu_arm_defconfig failed. Modify KConfig
> >      so that more defconfigs enabled by default.
> > ---

[...]

> > +
> > +     if (!systab_pointer) {
> > +             log_err("Installing EFI system table pointer failed\n");
> > +             return EFI_OUT_OF_RESOURCES;
> > +     }
> > +
> > +     memset(systab_pointer, 0, sizeof(struct efi_system_table_pointer));
>
> systab_pointer->crc32 = 0;
>
> would have been an alternative. Maybe Ilias wants to change that when
> merging.
>
> Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>

Thanks Heinrich. I'll have a look at the patches shortly and queue
them. I'll change the line above on my PR

/Ilias
>
> > +
> > +     systab_pointer->signature = EFI_SYSTEM_TABLE_SIGNATURE;
> > +     systab_pointer->efi_system_table_base = (uintptr_t)&systab;
> > +     systab_pointer->crc32 = crc32(0,
> > +                                   (const unsigned char *)systab_pointer,
> > +                                   sizeof(struct efi_system_table_pointer));
> > +
> > +     return EFI_SUCCESS;
> > +}
> > diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
> > index 48f91da5df7..78c5059256a 100644
> > --- a/lib/efi_loader/efi_setup.c
> > +++ b/lib/efi_loader/efi_setup.c
> > @@ -278,6 +278,13 @@ efi_status_t efi_init_obj_list(void)
> >       if (ret != EFI_SUCCESS)
> >               goto out;
> >
> > +     /* Initialize system table pointer */
> > +     if (IS_ENABLED(CONFIG_EFI_DEBUG_SUPPORT)) {
> > +             ret = efi_initialize_system_table_pointer();
> > +             if (ret != EFI_SUCCESS)
> > +                     goto out;
> > +     }
> > +
> >       if (IS_ENABLED(CONFIG_EFI_ECPT)) {
> >               ret = efi_ecpt_register();
> >               if (ret != EFI_SUCCESS)
>


More information about the U-Boot mailing list