From 6aaf257de4a4070ebc233f35a09bce4c39ea038c Mon Sep 17 00:00:00 2001 From: Sughosh Ganu Date: Wed, 17 Nov 2021 17:08:10 +0530 Subject: [PATCH] feat(fwu): pass a const metadata structure to platform routines The metadata structure copy is passed to the platform routine to set the image source to boot the platform from. This is done by reading the metadata structure. Pass the metadata as a read-only copy to the routine -- the routine only needs to consume the metadata values and should not be able to update the metadata fields. Signed-off-by: Sughosh Ganu Change-Id: I399cad99ab89c71483e5a32a1de0e22df304f8b0 --- docs/getting_started/porting-guide.rst | 2 +- include/plat/common/platform.h | 2 +- plat/arm/common/arm_io_storage.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/getting_started/porting-guide.rst b/docs/getting_started/porting-guide.rst index 24af13e76..be04b9737 100644 --- a/docs/getting_started/porting-guide.rst +++ b/docs/getting_started/porting-guide.rst @@ -889,7 +889,7 @@ Function : plat_fwu_set_images_source() [when PSA_FWU_SUPPORT == 1] :: - Argument : struct fwu_metadata *metadata + Argument : const struct fwu_metadata *metadata Return : void This function is mandatory when PSA_FWU_SUPPORT is enabled. diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h index 9a61b502c..5a8f5a340 100644 --- a/include/plat/common/platform.h +++ b/include/plat/common/platform.h @@ -389,6 +389,6 @@ int32_t plat_is_smccc_feature_available(u_register_t fid); int plat_fwu_set_metadata_image_source(unsigned int image_id, uintptr_t *dev_handle, uintptr_t *image_spec); -void plat_fwu_set_images_source(struct fwu_metadata *metadata); +void plat_fwu_set_images_source(const struct fwu_metadata *metadata); #endif /* PLATFORM_H */ diff --git a/plat/arm/common/arm_io_storage.c b/plat/arm/common/arm_io_storage.c index 387086a29..19ee1b0b0 100644 --- a/plat/arm/common/arm_io_storage.c +++ b/plat/arm/common/arm_io_storage.c @@ -217,7 +217,7 @@ void arm_set_fip_addr(uint32_t active_fw_bank_idx) * bank to get its offset and length, and update these details in the I/O policy * of the FIP image. ******************************************************************************/ -void plat_fwu_set_images_source(struct fwu_metadata *metadata) +void plat_fwu_set_images_source(const struct fwu_metadata *metadata) { arm_set_fip_addr(metadata->active_index); }