Re: [PATCH v4 07/34] efi: Add a way to obtain boot services in the app

Heinrich Schuchardt
2021-11-07T08:06:47Z

On 11/4/21 04:09, Simon Glass wrote:
> Add a function to return this information along with a stub for the
> efi_info_get() function, since calling it otherwise hangs U-Boot.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> (no changes since v1)
>
> include/efi.h | 8 +++++++-

efi.h is used both by efi_loader as well as efi_app.
At long term it would make sense to move efi_app specific stuff to a
separate include like we did for efi_loader using efi_loader.h

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> lib/efi/efi_app.c | 10 ++++++++++
> 2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/include/efi.h b/include/efi.h
> index 18c13e0370a..b5835422b95 100644
> --- a/include/efi.h
> +++ b/include/efi.h
> @@ -444,9 +444,15 @@ extern char _binary_u_boot_bin_start[], _binary_u_boot_bin_end[];
> *
> * @return pointer to EFI system table
> */
> -
> struct efi_system_table *efi_get_sys_table(void);
>
> +/**
> + * efi_get_boot() - Get access to the EFI boot services table
> + *
> + * @return pointer to EFI boot services table
> + */
> +struct efi_boot_services *efi_get_boot(void);
> +
> /**
> * efi_get_ram_base() - Find the base of RAM
> *
> diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c
> index 907bacd716a..f61665686c5 100644
> --- a/lib/efi/efi_app.c
> +++ b/lib/efi/efi_app.c
> @@ -31,11 +31,21 @@ struct efi_system_table *efi_get_sys_table(void)
> return global_priv->sys_table;
> }
>
> +struct efi_boot_services *efi_get_boot(void)
> +{
> + return global_priv->boot;
> +}
> +
> unsigned long efi_get_ram_base(void)
> {
> return global_priv->ram_base;
> }
>
> +int efi_info_get(enum efi_entry_t type, void **datap, int *sizep)
> +{
> + return -ENOSYS;
> +}
> +
> static efi_status_t setup_memory(struct efi_priv *priv)
> {
> struct efi_boot_services *boot = priv->boot;
>