SPM: Make the parameters of interrupt APIs common
The following APIs used to be in the SVC handler codes.
The parameters are not describing.
- tfm_flih_prepare_depriv_flih
- tfm_flih_return_to_isr
Now since they are been separated in dedicated file, the prototype
should be describing.
This patch changes the parameters for this purpose.
Change-Id: Iec908551b39faf9899f7434670698f399bacda3e
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
index 8c3798c..e0d92f3 100644
--- a/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
+++ b/secure_fw/spm/cmsis_psa/tfm_core_svcalls_ipc.c
@@ -158,10 +158,13 @@
tfm_core_get_boot_data_handler(svc_args);
break;
case TFM_SVC_PREPARE_DEPRIV_FLIH:
- exc_return = tfm_flih_prepare_depriv_flih(svc_args);
+ exc_return = tfm_flih_prepare_depriv_flih(
+ (struct partition_t *)svc_args[0],
+ (uintptr_t)svc_args[1]);
break;
case TFM_SVC_FLIH_FUNC_RETURN:
- exc_return = tfm_flih_return_to_isr(svc_args[0], msp);
+ exc_return = tfm_flih_return_to_isr(svc_args[0],
+ (struct context_flih_ret_t *)msp);
break;
default:
if (((uint32_t)®ION_NAME(Image$$, ARM_LIB_STACK, $$ZI$$Limit)
diff --git a/secure_fw/spm/ffm/interrupt.c b/secure_fw/spm/ffm/interrupt.c
index 8a54e0f..87c0751 100644
--- a/secure_fw/spm/ffm/interrupt.c
+++ b/secure_fw/spm/ffm/interrupt.c
@@ -8,7 +8,6 @@
#include "interrupt.h"
#include "bitops.h"
-#include "spm_ipc.h"
#include "tfm_arch.h"
#include "tfm_hal_interrupt.h"
#include "tfm_hal_isolation.h"
@@ -50,10 +49,10 @@
extern void tfm_flih_func_return(psa_flih_result_t result);
-uint32_t tfm_flih_prepare_depriv_flih(uint32_t *svc_args)
+uint32_t tfm_flih_prepare_depriv_flih(struct partition_t *p_owner_sp,
+ uintptr_t flih_func)
{
struct partition_t *p_curr_sp;
- struct partition_t *p_owner_sp = (struct partition_t *)svc_args[0];
uintptr_t sp_limit, stack;
struct context_ctrl_t flih_ctx_ctrl;
@@ -85,7 +84,7 @@
}
tfm_arch_init_context(&flih_ctx_ctrl,
- (uintptr_t)svc_args[1], NULL,
+ flih_func, NULL,
(uintptr_t)tfm_flih_func_return,
sp_limit, stack);
@@ -95,11 +94,10 @@
}
/* Go back to ISR from FLIH functions */
-uint32_t tfm_flih_return_to_isr(psa_flih_result_t result, uint32_t *msp)
+uint32_t tfm_flih_return_to_isr(psa_flih_result_t result,
+ struct context_flih_ret_t *p_ctx_flih_ret)
{
struct partition_t *p_prev_sp, *p_owner_sp;
- struct context_flih_ret_t *p_ctx_flih_ret =
- (struct context_flih_ret_t *)msp;
p_prev_sp = GET_CTX_OWNER(p_ctx_flih_ret->state_ctx.r2);
p_owner_sp = GET_CTX_OWNER(CURRENT_THREAD->p_context_ctrl);
diff --git a/secure_fw/spm/ffm/interrupt.h b/secure_fw/spm/ffm/interrupt.h
index 1cdf1b4..ae90acf 100644
--- a/secure_fw/spm/ffm/interrupt.h
+++ b/secure_fw/spm/ffm/interrupt.h
@@ -5,6 +5,8 @@
*
*/
+#include "spm_ipc.h"
+
#include "load/interrupt_defs.h"
#include "load/partition_defs.h"
#include "psa/service.h"
@@ -41,9 +43,21 @@
/*
* Prepare execution context for deprivileged FLIH functions
- * svc_args: IRQ owner partition_t pointer, flih_func, current thread data
+ * Parameters:
+ * p_owner_sp - IRQ owner partition_t pointer
+ * flih_func - The FLIH Function
*/
-uint32_t tfm_flih_prepare_depriv_flih(uint32_t *svc_args);
+uint32_t tfm_flih_prepare_depriv_flih(struct partition_t *p_owner_sp,
+ uintptr_t flih_func);
-/* Go back to ISR from FLIH functions */
-uint32_t tfm_flih_return_to_isr(psa_flih_result_t result, uint32_t *msp);
+/*
+ * Go back to ISR from FLIH functions
+ * Parameters:
+ * result - The return value of the FLIH Function, indicating to the SPM
+ * how to complete the FLIH processing, for example setting signal
+ * to the Secure Partition.
+ * p_ctx_flih_ret - The contents on the Main Stack when this function is
+ * called. It is used to restore context.
+ */
+uint32_t tfm_flih_return_to_isr(psa_flih_result_t result,
+ struct context_flih_ret_t *p_ctx_flih_ret);