[PATCH v8 06/13] FWU: Add helper functions for accessing FWU metadata

Jassi Brar jaswinder.singh at linaro.org
Wed Aug 17 19:00:21 CEST 2022


On Wed, 17 Aug 2022 at 07:44, Sughosh Ganu <sughosh.ganu at linaro.org> wrote:
.....
> diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c
> new file mode 100644
> index 0000000000..9808036eec
> --- /dev/null
> +++ b/lib/fwu_updates/fwu.c
> @@ -0,0 +1,22 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2022, Linaro Limited
> + */
> +
> +#include <fwu.h>
> +#include <fwu_mdata.h>
> +
> +__weak int fwu_plat_get_update_index(u32 *update_idx)
> +{
> +       int ret;
> +       u32 active_idx;
> +
> +       ret = fwu_get_active_index(&active_idx);
> +
> +       if (ret < 0)
> +               return -1;
> +
> +       *update_idx = active_idx ^= 0x1;
> +
It shoud be
        *update_idx = (active_idx + 1) % CONFIG_FWU_NUM_BANKS;

cheers.


More information about the U-Boot mailing list