[RFC PATCH v2 3/8] FWU: stm32mp1: Add helper functions for accessing FWU metadata

Sughosh Ganu sughosh.ganu at linaro.org
Fri Dec 24 17:59:39 CET 2021


hi Masami,

On Fri, 24 Dec 2021 at 15:49, Masami Hiramatsu
<masami.hiramatsu at linaro.org> wrote:
>
> Hi Sughosh,
>
> 2021年12月24日(金) 19:08 Sughosh Ganu <sughosh.ganu at linaro.org>:
> >
> > hi Masami,
> >
> > On Fri, 24 Dec 2021 at 11:19, Masami Hiramatsu
> > <masami.hiramatsu at linaro.org> wrote:
> > >
> > > () should Hi Sughosh and Ilias,
> > >
> > > I would like to confirm that what the plat_fill_gpt_partition_guids()
> > > should return.
> > >
> > > 2021年12月19日(日) 16:07 Sughosh Ganu <sughosh.ganu at linaro.org>:
> > >
> > > > +static int plat_fill_gpt_partition_guids(struct blk_desc *desc,
> > > > +                                        efi_guid_t **part_guid_arr)
> > > > +{
> > > > +       int i, ret = 0;
> > > > +       u32 part;
> > > > +       struct dfu_entity *dfu;
> > > > +       struct disk_partition info;
> > > > +       efi_guid_t part_type_guid;
> > > > +       int alt_num = dfu_get_alt_number();
> > > > +
> > > > +       dfu_init_env_entities(NULL, NULL);
> > > > +
> > > > +       for (i = 0, part = 1; i < alt_num; i++) {
> > > > +               dfu = dfu_get_entity(i);
> > > > +
> > > > +               if (!dfu)
> > > > +                       continue;
> > > > +
> > > > +               /*
> > > > +                * Currently, Multi Bank update
> > > > +                * feature is being supported
> > > > +                * only on GPT partitioned
> > > > +                * MMC/SD devices.
> > > > +                */
> > > > +               if (dfu->dev_type != DFU_DEV_MMC)
> > > > +                       continue;
> > > > +
> > > > +               if (part_get_info(desc, part, &info)) {
> > > > +                       part++;
> > > > +                       continue;
> > > > +               }
> > > > +
> > > > +               uuid_str_to_bin(info.type_guid, part_type_guid.b,
> > > > +                               UUID_STR_FORMAT_GUID);
> > > > +               guidcpy((*part_guid_arr + i), &part_type_guid);
> > > > +               part++;
> > > > +       }
> > > > +
> > > > +       dfu_free_entities();
> > > > +
> > > > +       return ret;
> > > > +}
> > >
> > > So on this platform which uses GPT partition for each bank, it stores
> > > the GUID for each partition.
> > > I think this information will be shown in the ESRT, but not used for
> > > specifying capsule image_type_uuid.
> > >
> > > This is strange.
> > > Without this FWU multi-bank update, the array will only have the
> > > image_type UUID.
> > > Thus,  user can use ESRT to confirm what UUID should be specified for
> > > the capsule file. (it has image-type UUID)
> > > (of course that is fixed value on one platform anyway)
> > >
> > > And when FWU multi-bank update is enabled, that changes to the
> > > partition GUIDs. But those GUIDs are NOT used when making the capsule
> > > file nor doing the update process, because we should not specify the
> > > bank index directly, right?
> >
> > The partition GUIDs are the same as ImageTypeId field in the
> > EFI_FIRMWARE_IMAGE_DESCRIPTOR and the UpdateImageTypeId field in the
> > EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER. This value is the same
> > as the PartitionTypeGUID field in the GPT partition entry.
> >
> > ImageTypeId  = UpdateImageTypeId = PartitionTypeGUID
> >
> > This is the GUID value that is used when generating the capsule.
>
> So you meant the above "plat_fill_gpt_partition_guids()" fills the
> array with ImageTypeId?

Yes. Please note that the actual api is fwu_plat_fill_partition_guids.
For the ST board, fwu_plat_fill_partition_guids calls
plat_fill_gpt_partition_guids.

> Thus, if we have a single image type, the array will be filled with
> that single GUID?

That will depend on the dfu_alt_info setting and the platform function
fwu_plat_fill_partition_guids defined for the corresponding platform.

>
>
> > > We will set a unique image-type UUID on each image entry, and use it
> > > for making a capsule file,
> >
> > Even with the FWU feature enabled, the PartitionTypeGUID/ImageTypeId
> > is used for making the capsule. What changes for the FWU feature is
> > that the value of UpdateImageIndex/ImageIndex that is passed to the
> > capsule generation tool becomes irrelevant. When the FWU feature is
> > not enabled, the ImageIndex value that is passed to the capsule
> > generation tool is important, since this is supposed to correspond to
> > the DFU alt number -- this ImageIndex value is then used to identify
> > the partition/address to which the capsule payload is to be written.
> > With the FWU feature enabled, this value is not obtained from the
> > capsule, since the partition/address to write the image to is
> > identified at runtime based on the value of the update bank.
>
> OK.
>
> >
> > > but the capsule file itself doesn't specify
> > > the banks. And acceptance/revert capsule file also doesn't specify it.
> > > Acceptance file will also uses image_type UUID, but not the partition
> > > UUID for the bank.
> >
> > The image acceptance capsule will also contain the ImageTypeId. The
> > Accept bit will be set for the active bank image of the image type
> > specified in the acceptance capsule.
>
> OK, so the Image UUID(image slot for the banks) will not be used in
> the process, is that correct?
> I would like to confirm this, because this is important for the system
> which doesn't use GPT.

Yes, only the ImageTypeId will be used. You can check the
implementation for the GPT partitioned block devices in
fwu_gpt_set_clear_image_accept.

-sughosh

>
> Thank you,
>
> >
> > -sughosh
> >
> > >
> > > Maybe I'm wrong, but I'm confusing. And this is important for the
> > > platform which doesn't use GPT.
> > >
> > > Thank you,
> > >
> > >
> > > --
> > > Masami Hiramatsu
>
>
>
> --
> Masami Hiramatsu


More information about the U-Boot mailing list