diff options
author | dp-arm <dimitris.papastamos@arm.com> | 2017-02-15 11:07:55 +0000 |
---|---|---|
committer | dp-arm <dimitris.papastamos@arm.com> | 2017-05-15 16:34:27 +0100 |
commit | a44090080308beefe64d302bcc76de70f0d1d280 (patch) | |
tree | 0edd9b32b2e24f34b9d72d25cf29a80e6a95d175 /bl1/bl1_fwu.c | |
parent | b6285d64c12ae653c39ecdc3a4c47369aca9d7b0 (diff) |
AArch32: Add `TRUSTED_BOARD_BOOT` support
This patch adds `TRUSTED_BOARD_BOOT` support for AArch32 mode.
To build this patch the "mbedtls/include/mbedtls/bignum.h"
needs to be modified to remove `#define MBEDTLS_HAVE_UDBL`
when `MBEDTLS_HAVE_INT32` is defined. This is a workaround
for "https://github.com/ARMmbed/mbedtls/issues/708"
NOTE: TBBR support on Juno AArch32 is not currently supported.
Change-Id: I86d80e30b9139adc4d9663f112801ece42deafcf
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
Co-Authored-By: Yatharth Kochar <yatharth.kochar@arm.com>
Diffstat (limited to 'bl1/bl1_fwu.c')
-rw-r--r-- | bl1/bl1_fwu.c | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/bl1/bl1_fwu.c b/bl1/bl1_fwu.c index b0985320..ace364d4 100644 --- a/bl1/bl1_fwu.c +++ b/bl1/bl1_fwu.c @@ -47,6 +47,8 @@ __dead2 static void bl1_fwu_done(void *client_cookie, void *reserved); */ static unsigned int sec_exec_image_id = INVALID_IMAGE_ID; +void cm_set_next_context(void *cpu_context); + /******************************************************************************* * Top level handler for servicing FWU SMCs. ******************************************************************************/ @@ -364,8 +366,10 @@ static int bl1_fwu_image_execute(unsigned int image_id, INFO("BL1-FWU: Executing Secure image\n"); +#ifdef AARCH64 /* Save NS-EL1 system registers. */ cm_el1_sysregs_context_save(NON_SECURE); +#endif /* Prepare the image for execution. */ bl1_prepare_next_image(image_id); @@ -373,7 +377,11 @@ static int bl1_fwu_image_execute(unsigned int image_id, /* Update the secure image id. */ sec_exec_image_id = image_id; +#ifdef AARCH64 *handle = cm_get_context(SECURE); +#else + *handle = smc_get_ctx(SECURE); +#endif return 0; } @@ -419,6 +427,10 @@ static register_t bl1_fwu_image_resume(register_t image_param, resume_sec_state = SECURE; } + INFO("BL1-FWU: Resuming %s world context\n", + (resume_sec_state == SECURE) ? "secure" : "normal"); + +#ifdef AARCH64 /* Save the EL1 system registers of calling world. */ cm_el1_sysregs_context_save(caller_sec_state); @@ -428,10 +440,16 @@ static register_t bl1_fwu_image_resume(register_t image_param, /* Update the next context. */ cm_set_next_eret_context(resume_sec_state); - INFO("BL1-FWU: Resuming %s world context\n", - (resume_sec_state == SECURE) ? "secure" : "normal"); - *handle = cm_get_context(resume_sec_state); +#else + /* Update the next context. */ + cm_set_next_context(cm_get_context(resume_sec_state)); + + /* Prepare the smc context for the next BL image. */ + smc_set_next_ctx(resume_sec_state); + + *handle = smc_get_ctx(resume_sec_state); +#endif return image_param; } @@ -461,6 +479,8 @@ static int bl1_fwu_sec_image_done(void **handle, unsigned int flags) image_desc->state = IMAGE_STATE_RESET; sec_exec_image_id = INVALID_IMAGE_ID; + INFO("BL1-FWU: Resuming Normal world context\n"); +#ifdef AARCH64 /* * Secure world is done so no need to save the context. * Just restore the Non-Secure context. @@ -470,9 +490,16 @@ static int bl1_fwu_sec_image_done(void **handle, unsigned int flags) /* Update the next context. */ cm_set_next_eret_context(NON_SECURE); - INFO("BL1-FWU: Resuming Normal world context\n"); - *handle = cm_get_context(NON_SECURE); +#else + /* Update the next context. */ + cm_set_next_context(cm_get_context(NON_SECURE)); + + /* Prepare the smc context for the next BL image. */ + smc_set_next_ctx(NON_SECURE); + + *handle = smc_get_ctx(NON_SECURE); +#endif return 0; } |