[PATCH v5 06/23] FWU: stm32mp1: Add helper functions for accessing FWU metadata

Sughosh Ganu sughosh.ganu at linaro.org
Thu Jun 23 08:04:37 CEST 2022


On Tue, 21 Jun 2022 at 15:19, Patrick DELAUNAY
<patrick.delaunay at foss.st.com> wrote:
>
> Hi,
>
> On 6/9/22 14:29, Sughosh Ganu wrote:
> > Add helper functions needed for accessing the FWU metadata which
> > contains information on the updatable images. These functions have
> > been added for the STM32MP157C-DK2 board which has the updatable
> > images on the uSD card, formatted as GPT partitions.
> >
> > Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
> > ---
> >   board/st/stm32mp1/stm32mp1.c | 115 +++++++++++++++++++++++++++++++++++
> >   include/fwu.h                |   2 +
> >   2 files changed, 117 insertions(+)
> >
> > diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> > index 62d98ad776..e68bf09955 100644
> > --- a/board/st/stm32mp1/stm32mp1.c
> > +++ b/board/st/stm32mp1/stm32mp1.c
> > @@ -7,9 +7,11 @@
> >
> >   #include <common.h>
> >   #include <adc.h>
> > +#include <blk.h>
> >   #include <bootm.h>
> >   #include <clk.h>
> >   #include <config.h>
> > +#include <dfu.h>
> >   #include <dm.h>
> >   #include <efi_loader.h>
> >   #include <env.h>
> > @@ -25,9 +27,11 @@
> >   #include <log.h>
> >   #include <malloc.h>
> >   #include <misc.h>
> > +#include <mmc.h>
> >   #include <mtd_node.h>
> >   #include <net.h>
> >   #include <netdev.h>
> > +#include <part.h>
> >   #include <phy.h>
> >   #include <remoteproc.h>
> >   #include <reset.h>
> > @@ -967,3 +971,114 @@ static void board_copro_image_process(ulong fw_image, size_t fw_size)
> >   }
> >
> >   U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_COPRO, board_copro_image_process);
> > +
> > +#if defined(CONFIG_FWU_MULTI_BANK_UPDATE)
> > +#include <fwu.h>
> > +#include <fwu_mdata.h>
> > +
> [...]
> > +
> > +#endif /* CONFIG_FWU_MULTI_BANK_UPDATE */
> > diff --git a/include/fwu.h b/include/fwu.h
> > index 3b1ee4e83e..36e58afa29 100644
> > --- a/include/fwu.h
> > +++ b/include/fwu.h
> > @@ -46,6 +46,8 @@ int fwu_revert_boot_index(void);
> >   int fwu_accept_image(efi_guid_t *img_type_id, u32 bank);
> >   int fwu_clear_accept_image(efi_guid_t *img_type_id, u32 bank);
> >
> > +
>
>
> Added empty line

Will remove

>
>
> >   int fwu_plat_get_alt_num(struct udevice *dev, efi_guid_t *image_guid,
> >                        int *alt_num);
> > +int fwu_plat_get_update_index(u32 *update_idx);
> >   #endif /* _FWU_H_ */
>
>
> And I am agree with Ilias remark, should be generic
>
> => search on the current UCLASS_FWU_MDATA
>
>         perhaps need a new ops in u-class ? as implementation can be
> different for GPT and MTD.

My understanding of Ilias's comments was that the function can be
generic for all GPT based platforms. But I will check if this can be
reused for both GPT and MTD devices, on the lines that you mention
above. Thanks.

-sughosh


More information about the U-Boot mailing list