Thanks Paul

On Wed, 11 Jun 2025 at 08:08, Ying-Chun Liu (PaulLiu)
<paul...@debian.org> wrote:
>
> From: "Ying-Chun Liu (PaulLiu)" <paul....@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....@linaro.org>
> Cc: Heinrich Schuchardt <xypron.g...@gmx.de>
> Cc: Ilias Apalodimas <ilias.apalodi...@linaro.org>
> Cc: Peter Robinson <pbrobin...@gmail.com>
> Cc: Simon Glass <s...@chromium.org>
> ---

Reviewed-by: Ilias Apalodimas <ilias.apalodi...@linaro.org>

A nit below

[...]

> +{
> +       const int size_4MB = 0x00400000;

We already have macros for these

Thanks
/Ilias

> +       uintptr_t addr;
> +       u32 crc32_value;
> +
> +       /* Allocate configuration table array */
> +       addr = (uintptr_t)efi_alloc_aligned_pages(sizeof(struct 
> efi_system_table_pointer),
> +                                                 EFI_RUNTIME_SERVICES_DATA,
> +                                                 size_4MB);
> +
> +       if (!addr) {
> +               log_err("Installing EFI system table pointer failed\n");
> +               return EFI_OUT_OF_RESOURCES;
> +       }
> +
> +       systab_pointer = (struct efi_system_table_pointer *)addr;
> +       memset(systab_pointer, 0, sizeof(struct efi_system_table_pointer));
> +
> +       systab_pointer->signature = EFI_SYSTEM_TABLE_SIGNATURE;
> +       systab_pointer->efi_system_table_base = (efi_physical_addr_t)&systab;
> +
> +       crc32_value = crc32(0,
> +                           (const unsigned char *)systab_pointer,
> +                           sizeof(struct efi_system_table_pointer));
> +       systab_pointer->crc32 = crc32_value;
> +
> +       return EFI_SUCCESS;
> +}
> diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
> index 48f91da5df7..6193b9f6d0c 100644
> --- a/lib/efi_loader/efi_setup.c
> +++ b/lib/efi_loader/efi_setup.c
> @@ -278,6 +278,14 @@ 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)
> --
> 2.39.5
>

Reply via email to