diff options
author | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2018-11-27 08:36:02 +0000 |
---|---|---|
committer | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2018-12-11 13:45:41 +0000 |
commit | 680389a65a004d2af007abccf0a0352f2c0eb529 (patch) | |
tree | 84d1f5adf7382cb8899978d7106bd49ee690b7da /services | |
parent | 26010da11629f27ddf013ba6127198b33edcd574 (diff) |
SPM: Load image and RD from SP package
Load SP and RD from package instead of relying on RD being already
loaded in memory and the SP being loaded as a BL32 image.
Change-Id: I18d4fbf4597656c6a7e878e1d7c01a8a324f3f8a
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'services')
-rw-r--r-- | services/std_svc/spm/spm_main.c | 20 | ||||
-rw-r--r-- | services/std_svc/spm/spm_private.h | 6 |
2 files changed, 26 insertions, 0 deletions
diff --git a/services/std_svc/spm/spm_main.c b/services/std_svc/spm/spm_main.c index ad1262cb..6de4858b 100644 --- a/services/std_svc/spm/spm_main.c +++ b/services/std_svc/spm/spm_main.c @@ -157,7 +157,10 @@ static int32_t spm_init(void) ******************************************************************************/ int32_t spm_setup(void) { + int rc; sp_context_t *ctx; + void *sp_base, *rd_base; + size_t sp_size, rd_size; /* Disable MMU at EL1 (initialized by BL2) */ disable_mmu_icache_el1(); @@ -167,9 +170,26 @@ int32_t spm_setup(void) ctx = &sp_ctx; + rc = plat_spm_sp_get_next_address(&sp_base, &sp_size, + &rd_base, &rd_size); + if (rc != 0) { + ERROR("No Secure Partition found.\n"); + panic(); + } + /* Assign translation tables context. */ ctx->xlat_ctx_handle = spm_get_sp_xlat_context(); + /* Save location of the image in physical memory */ + ctx->image_base = (uintptr_t)sp_base; + ctx->image_size = sp_size; + + rc = plat_spm_sp_rd_load(&ctx->rd, rd_base, rd_size); + if (rc < 0) { + ERROR("Error while loading RD blob.\n"); + panic(); + } + spm_sp_setup(ctx); /* Register init function for deferred init. */ diff --git a/services/std_svc/spm/spm_private.h b/services/std_svc/spm/spm_private.h index ec3f48ea..ee13e94e 100644 --- a/services/std_svc/spm/spm_private.h +++ b/services/std_svc/spm/spm_private.h @@ -32,6 +32,7 @@ #ifndef __ASSEMBLY__ #include <spinlock.h> +#include <sp_res_desc.h> #include <stdint.h> #include <xlat_tables_v2.h> @@ -42,9 +43,14 @@ typedef enum sp_state { } sp_state_t; typedef struct sp_context { + /* Location of the image in physical memory */ + unsigned long long image_base; + size_t image_size; + uint64_t c_rt_ctx; cpu_context_t cpu_ctx; xlat_ctx_t *xlat_ctx_handle; + struct sp_res_desc rd; sp_state_t state; spinlock_t state_lock; |