From e208f3244b311a23b3e7fa1c03b3e98a6228714a Mon Sep 17 00:00:00 2001 From: Rob Hughes Date: Fri, 20 Jan 2023 10:43:41 +0000 Subject: [PATCH] fix(fconf): fix FCONF_ARM_IO_UUID_NUMBER value The FCONF_ARM_IO_UUID_NUMBER macro is hardcoded to the number of entries in the `load_info` array, but this number did not match the actual length of the array in the case that TRUSTED_BOARD_BOOT is defined, but SPD_spmd is not defined. This patch fixes the hardcoded length by replacing it with a more flexible calculation which sums up the various contributing groups of entries. Signed-off-by: Rob Hughes Signed-off-by: Mikael Olsson Change-Id: I557bca7dd32c3be084bbba11d84dfa2818cb6790 --- plat/arm/common/fconf/arm_fconf_io.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/plat/arm/common/fconf/arm_fconf_io.c b/plat/arm/common/fconf/arm_fconf_io.c index 6c323312c..dfaaaae07 100644 --- a/plat/arm/common/fconf/arm_fconf_io.c +++ b/plat/arm/common/fconf/arm_fconf_io.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, ARM Limited. All rights reserved. + * Copyright (c) 2019-2023, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -277,11 +277,22 @@ struct plat_io_policy policies[MAX_NUMBER_IDS] = { #ifdef IMAGE_BL2 +#define FCONF_ARM_IO_UUID_NUM_BASE U(10) + #if TRUSTED_BOARD_BOOT -#define FCONF_ARM_IO_UUID_NUMBER U(24) +#define FCONF_ARM_IO_UUID_NUM_TBB U(12) #else -#define FCONF_ARM_IO_UUID_NUMBER U(10) -#endif +#define FCONF_ARM_IO_UUID_NUM_TBB U(0) +#endif /* TRUSTED_BOARD_BOOT */ + +#if TRUSTED_BOARD_BOOT && defined(SPD_spmd) +#define FCONF_ARM_IO_UUID_NUM_SPD U(2) +#else +#define FCONF_ARM_IO_UUID_NUM_SPD U(0) +#endif /* TRUSTED_BOARD_BOOT && defined(SPD_spmd) */ + +#define FCONF_ARM_IO_UUID_NUMBER FCONF_ARM_IO_UUID_NUM_BASE + \ + FCONF_ARM_IO_UUID_NUM_TBB + FCONF_ARM_IO_UUID_NUM_SPD static io_uuid_spec_t fconf_arm_uuids[FCONF_ARM_IO_UUID_NUMBER]; static OBJECT_POOL_ARRAY(fconf_arm_uuids_pool, fconf_arm_uuids); -- 2.39.5