diff options
author | Marc Bonnici <marc.bonnici@arm.com> | 2021-09-01 13:46:38 +0100 |
---|---|---|
committer | Marc Bonnici <marc.bonnici@arm.com> | 2021-10-07 11:37:29 +0100 |
commit | 32145dd0ed980df4f088cba6c633af25c0595ac0 (patch) | |
tree | 049d6335fd22bcb749d5e4e61794f2756d743f2a | |
parent | 86d106389ffa14e45b84feea635b748463c45a5a (diff) | |
download | trusted-firmware-a-32145dd0ed980df4f088cba6c633af25c0595ac0.tar.gz |
spmc: Add inital helper function to obtain current ctx
Currently only uses flags to determine source world and
therefore which context to access. Need to expand to tracking
which of potentially multiple contexts were last executing.
Change-Id: I07bd305f1ead99d07f1f6a73041b1f615446736c
Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
-rw-r--r-- | services/std_svc/spm/spmc/spmc_main.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/services/std_svc/spm/spmc/spmc_main.c b/services/std_svc/spm/spmc/spmc_main.c index 8a42e054e8..ca60e1bb11 100644 --- a/services/std_svc/spm/spmc/spmc_main.c +++ b/services/std_svc/spm/spmc/spmc_main.c @@ -55,6 +55,19 @@ el3_lp_desc_t* get_el3_lp_array(void) { return el3_lp_descs; } +/* + * Initial implementation to obtain source of SMC ctx. + * Currently assumes only single context per world. + * TODO: Expand to track multiple partitions. + */ +spmc_sp_context_t* spmc_get_current_ctx(uint64_t flags) { + if (is_caller_secure(flags)) { + return &(spmc_sp_ctx[SWLD_CTX_INDEX]); + } + else { + return &(spmc_nwld_ctx[NWLD_CTX_INDEX]); + } +} /******************************************************************************* * Return FFA_ERROR with specified error code |