[PATCH v4 12/24] efi_loader: fwu_arm_psa: Add set_image and get_image_info support

Ilias Apalodimas ilias.apalodimas at linaro.org
Wed Aug 20 14:28:22 CEST 2025


Hi Abdelllatif

On Fri, 25 Jul 2025 at 18:50, <abdellatif.elkhlifi at arm.com> wrote:
>
> From: Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
>
> Implement set_image and get_image_info through RAW functions
>
> The implementation is done using efi_firmware_raw_set_image()
> and efi_firmware_get_image_info()
>
> Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
> Signed-off-by: Davidson kumaresan <davidson.kumaresan at arm.com>
> Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Cc: Sughosh Ganu <sughosh.ganu at linaro.org>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Michal Simek <michal.simek at amd.com>
> Cc: Marek Vasut <marek.vasut+renesas at mailbox.org>
> Cc: Casey Connolly <casey.connolly at linaro.org>
> Cc: Adriano Cordova <adrianox at gmail.com>
>
> ---
>
> Changelog of changes:
> ===========================
>
> v2:
>
> * Following Heinrich comment: The changes at efi_firmware_raw_set_image()
>     simplified by removing the "else" so it is clear we are just adding FWU_ARM_PSA
>     support and skipping the use of DFU in case of FWU_ARM_PSA
>
> v1:
>
> * Add set_image and get_image_info support for FWU_ARM_PSA
>
>  lib/efi_loader/efi_firmware.c | 35 +++++++++++++++++++++++++++++++----
>  1 file changed, 31 insertions(+), 4 deletions(-)
>
> diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
> index 75501e21557..38945b34e7b 100644
> --- a/lib/efi_loader/efi_firmware.c
> +++ b/lib/efi_loader/efi_firmware.c
> @@ -4,6 +4,12 @@
>   *
>   *  Copyright (c) 2020 Linaro Limited
>   *                     Author: AKASHI Takahiro
> + *
> + * Copyright 2025 Arm Limited and/or its affiliates <open-source-office at arm.com>
> + *
> + * Authors:
> + *   Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
> + *   Davidson kumaresan <davidson.kumaresan at arm.com>

Copyright updates are usually done on significant contributions. I am
not this qualifies as such.
Tom is there a policy for that in U-Boot docs?

>   */
>
>  #define LOG_CATEGORY LOGC_EFI
> @@ -14,6 +20,7 @@
>  #include <efi_variable.h>
>  #include <env.h>
>  #include <fwu.h>
> +#include <fwu_arm_psa.h>
>  #include <image.h>
>  #include <signatures.h>
>
> @@ -601,10 +608,21 @@ efi_status_t EFIAPI efi_firmware_get_image_info(
>              !descriptor_size || !package_version || !package_version_name))
>                 return EFI_EXIT(EFI_INVALID_PARAMETER);
>
> -       ret = efi_fill_image_desc_array(image_info_size, image_info,
> -                                       descriptor_version, descriptor_count,
> -                                       descriptor_size, package_version,
> -                                       package_version_name);
> +       if (IS_ENABLED(CONFIG_FWU_ARM_PSA)) {
> +               ret = fwu_arm_psa_get_image_info(image_info_size, image_info,
> +                                                descriptor_version,
> +                                                descriptor_count,
> +                                                descriptor_size,
> +                                                package_version,
> +                                                package_version_name);
> +       } else {
> +               ret = efi_fill_image_desc_array(image_info_size, image_info,
> +                                               descriptor_version,
> +                                               descriptor_count,
> +                                               descriptor_size,
> +                                               package_version,
> +                                               package_version_name);
> +       }

Since the functions above seem to accept the same arguments, why don't
we you define your own version of efi_fill_image_desc_array() if PSA
is enabled?
GetImageInfo() is defined by the EFI spec and I'd like to keep it as
abstracted as possible from the internal implementation details.


>
>         return EFI_EXIT(ret);
>  }
> @@ -749,6 +767,15 @@ efi_status_t EFIAPI efi_firmware_raw_set_image(
>         if (status != EFI_SUCCESS)
>                 return EFI_EXIT(status);
>
> +       if (IS_ENABLED(CONFIG_FWU_ARM_PSA)) {
> +               if (fwu_update_image(image, image_index, image_size))
> +                       return EFI_EXIT(EFI_DEVICE_ERROR);
> +
> +               efi_firmware_set_fmp_state_var(&state, image_index);
> +
> +               return EFI_EXIT(EFI_SUCCESS);
> +       }
> +
>         /*
>          * dfu_alt_num is assigned from 0 while image_index starts from 1.
>          * dfu_alt_num is calculated by (image_index - 1) when multi bank update
> --
> 2.25.1
>

Thanks
/Ilias


More information about the U-Boot mailing list