diff options
author | Dimitris Papastamos <dimitris.papastamos@arm.com> | 2017-07-03 17:02:27 +0100 |
---|---|---|
committer | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2017-09-04 15:18:44 +0100 |
commit | 155c394b84f8d24784df9411789c41a45dc4888d (patch) | |
tree | 80405a2bf6b4666ca2651c12e9fdec84d3c5f66f /fwu | |
parent | ad1ed6053174b8255c947d23007c0a36ceb499fd (diff) |
Issue reset SMC in ns_bl1u to prepare for the next image
After loading and authenticating an image, we need to issue
a reset SMC for TF to clear its internal state.
Without a reset SMC, the image overlap checks fail because
the state is not cleared. This breaks FWU when TFTF
is built with FWU_BL_TEST=0.
Change-Id: Idf27d0ac07131c2ea838b36344d51b8b94d58ccd
Signed-off-by: Dimitris Papastamos <dimitris.papastamos@arm.com>
Signed-off-by: Sandrine Bailleux <sandrine.bailleux@arm.com>
Diffstat (limited to 'fwu')
-rw-r--r-- | fwu/ns_bl1u/ns_bl1u_main.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/fwu/ns_bl1u/ns_bl1u_main.c b/fwu/ns_bl1u/ns_bl1u_main.c index c6e6582..f55a79e 100644 --- a/fwu/ns_bl1u/ns_bl1u_main.c +++ b/fwu/ns_bl1u/ns_bl1u_main.c @@ -210,22 +210,28 @@ void ns_bl1u_main(void) ns_bl1u_fwu_smc_call(FWU_SMC_IMAGE_EXECUTE, image_desc->image_id, 0, 0, 0); CHECK_SMC_RESULT(0); - } + #if FWU_BL_TEST - if (image_desc->execute == FWU_EXEC) { /* Check if executing again the same image returns error. */ INFO("NS_BL1U: TEST Calling SMC to execute again\n"); ns_bl1u_fwu_smc_call(FWU_SMC_IMAGE_EXECUTE, ns_bl1u_desc[index].image_id, 0, 0, 0); CHECK_SMC_RESULT(-EPERM); - } else if (image_desc->image_id != SCP_BL2U_IMAGE_ID) { - /* The SCP_BL2U shouldn't be reset as it is needed by BL2U */ - INFO("NS_BL1U: TEST Calling SMC to RESET\n"); - ns_bl1u_fwu_smc_call(FWU_SMC_IMAGE_RESET, image_desc->image_id, - 0, 0, 0); - CHECK_SMC_RESULT(0); - } #endif + } else { + /* + * If the image is not executable, its internal state + * needs to be reset, unless it is for later consumption + * by another CPU (like for the SCP_BL2U firmware). + */ + if (image_desc->image_id != SCP_BL2U_IMAGE_ID) { + INFO("NS_BL1U: Calling RESET SMC\n"); + ns_bl1u_fwu_smc_call(FWU_SMC_IMAGE_RESET, + image_desc->image_id, + 0, 0, 0); + CHECK_SMC_RESULT(0); + } + } } /* |