From 5c21e430b62c71acc9a2b74ccf13cc1ea3af8c3f Mon Sep 17 00:00:00 2001 From: Sandrine Bailleux Date: Mon, 2 Jun 2014 15:01:00 +0100 Subject: [PATCH] juno: Add a check to verify BL2 to BL31 plat. param This concerns only debug builds. In BL2, we now pass a special value to BL3-1 through x1. In BL3-1, we check that we receive the correct value. This ensures that any platform set value is correctly passed from BL2 to BL3-1. Change-Id: Icb94d0e99ca445dcbe574a7d5e291659bba2209e --- plat/juno/bl2_plat_setup.c | 4 ++++ plat/juno/bl31_plat_setup.c | 9 +++++++-- plat/juno/juno_def.h | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/plat/juno/bl2_plat_setup.c b/plat/juno/bl2_plat_setup.c index 563f05b37..5be725ade 100644 --- a/plat/juno/bl2_plat_setup.c +++ b/plat/juno/bl2_plat_setup.c @@ -142,6 +142,10 @@ bl31_params_t *bl2_plat_get_bl31_params(void) ******************************************************************************/ struct entry_point_info *bl2_plat_get_bl31_ep_info(void) { +#if DEBUG + bl31_params_mem.bl31_ep_info.args.arg1 = JUNO_BL31_PLAT_PARAM_VAL; +#endif + return &bl31_params_mem.bl31_ep_info; } diff --git a/plat/juno/bl31_plat_setup.c b/plat/juno/bl31_plat_setup.c index cb5fd1e22..2eac0fb54 100644 --- a/plat/juno/bl31_plat_setup.c +++ b/plat/juno/bl31_plat_setup.c @@ -111,12 +111,17 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2, /* * Check params passed from BL2 should not be NULL, - * We are not checking plat_params_from_bl2 as NULL as we are not - * using it on Juno */ assert(from_bl2 != NULL); assert(from_bl2->h.type == PARAM_BL31); assert(from_bl2->h.version >= VERSION_1); + /* + * In debug builds, we pass a special value in 'plat_params_from_bl2' + * to verify platform parameters from BL2 to BL3-1. + * In release builds, it's not used. + */ + assert(((unsigned long long)plat_params_from_bl2) == + JUNO_BL31_PLAT_PARAM_VAL); /* * Copy BL3-2 and BL3-3 entry point information. diff --git a/plat/juno/juno_def.h b/plat/juno/juno_def.h index da852c5b9..6b3ba577b 100644 --- a/plat/juno/juno_def.h +++ b/plat/juno/juno_def.h @@ -31,6 +31,9 @@ #ifndef __JUNO_DEF_H__ #define __JUNO_DEF_H__ +/* Special value used to verify platform parameters from BL2 to BL3-1 */ +#define JUNO_BL31_PLAT_PARAM_VAL 0x0f1e2d3c4b5a6978ULL + /******************************************************************************* * Juno memory map related constants ******************************************************************************/ -- GitLab