[PATCH v5 09/23] FWU: Add support for the FWU Multi Bank Update feature
Patrick DELAUNAY
patrick.delaunay at foss.st.com
Tue Jun 21 13:55:45 CEST 2022
Hi,
On 6/9/22 14:29, Sughosh Ganu wrote:
> The FWU Multi Bank Update feature supports updation of firmware images
> to one of multiple sets(also called banks) of images. The firmware
> images are clubbed together in banks, with the system booting images
> from the active bank. Information on the images such as which bank
> they belong to is stored as part of the metadata structure, which is
> stored on the same storage media as the firmware images on a dedicated
> partition.
>
> At the time of update, the metadata is read to identify the bank to
> which the images need to be flashed(update bank). On a successful
> update, the metadata is modified to set the updated bank as active
> bank to subsequently boot from.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
> ---
> include/fwu.h | 12 +-
> lib/Kconfig | 6 +
> lib/Makefile | 1 +
> lib/efi_loader/efi_capsule.c | 231 ++++++++++++++++++++++++++++++++++-
> lib/efi_loader/efi_setup.c | 3 +-
> lib/fwu_updates/Kconfig | 31 +++++
> lib/fwu_updates/Makefile | 6 +
> lib/fwu_updates/fwu.c | 26 ++++
> 8 files changed, 309 insertions(+), 7 deletions(-)
> create mode 100644 lib/fwu_updates/Kconfig
> create mode 100644 lib/fwu_updates/Makefile
>
[...]
> diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c
> index af884439fb..422ef58661 100644
> --- a/lib/fwu_updates/fwu.c
> +++ b/lib/fwu_updates/fwu.c
> @@ -112,6 +112,32 @@ u8 fwu_update_checks_pass(void)
> return !trial_state && boottime_check;
> }
>
> +int fwu_trial_state_ctr_start(void)
> +{
> + int ret;
> + u32 var_attributes;
> + efi_status_t status;
> + efi_uintn_t var_size;
> + u16 trial_state_ctr;
> +
> + var_size = (efi_uintn_t)sizeof(trial_state_ctr);
> + var_attributes = EFI_VARIABLE_NON_VOLATILE |
> + EFI_VARIABLE_BOOTSERVICE_ACCESS;
> +
> + trial_state_ctr = ret = 0;
> + status = efi_set_variable_int(L"TrialStateCtr",
> + &efi_global_variable_guid,
> + var_attributes,
> + var_size,
> + &trial_state_ctr, false);
u"TrialStateCtr",
if USC2 is not mandatory.
> + if (status != EFI_SUCCESS) {
> + log_err("Unable to increment TrialStateCtr variable\n");
> + ret = -1;
> + }
> +
> + return ret;
> +}
> +
> int fwu_boottime_checks(void)
> {
> int ret;
Regards
More information about the U-Boot
mailing list