diff options
author | Alan DeMars <ademars@ti.com> | 2019-10-22 08:23:29 -0700 |
---|---|---|
committer | Ken Liu <ken.liu@arm.com> | 2019-11-18 05:46:45 +0000 |
commit | 6184469e36f99ef23d3c7bae2e74c12fc720f96a (patch) | |
tree | 34e4bb64cdbc18f8a15574f17254e084a5e1126d | |
parent | f050170fd4950c6a6336d244e2745d2a2bb081ca (diff) | |
download | trusted-firmware-m-6184469e36f99ef23d3c7bae2e74c12fc720f96a.tar.gz |
Core: Enable platform specific extensions to the core set of SVC handlers
Support is provided for both the PSA IPC and Library models.
To enable platform specific SVC handlers, add
-DPLATFORM_SVC_HANDLERS=True to the CMAKE command line.
When PLATFORM_SVC_HANDLERS is defined, user must provide an
implementation of:
int32_t platform_svc_handlers(tfm_svc_number_t svc_num,
uint32_t *ctx, uint32_t lr);
Change-Id: I5fc641038732d2630e954f6c9b12df929b65c24a
Signed-off-by: Alan DeMars <ademars@ti.com>
-rw-r--r-- | CommonConfig.cmake | 4 | ||||
-rw-r--r-- | secure_fw/core/ipc/tfm_svcalls.c | 9 | ||||
-rw-r--r-- | secure_fw/core/tfm_core_svcalls_func.c | 8 | ||||
-rw-r--r-- | secure_fw/include/core/tfm_core_svc.h | 1 |
4 files changed, 22 insertions, 0 deletions
diff --git a/CommonConfig.cmake b/CommonConfig.cmake index 0c9c76460c..0e83118ae2 100644 --- a/CommonConfig.cmake +++ b/CommonConfig.cmake @@ -155,6 +155,10 @@ endif() # Option to demonstrate usage of secure-only peripheral set (SECURE_UART1 OFF) +if (PLATFORM_SVC_HANDLERS) + add_definitions(-DPLATFORM_SVC_HANDLERS) +endif() + if (REGRESSION) set(SERVICES_TEST_ENABLED ON) endif() diff --git a/secure_fw/core/ipc/tfm_svcalls.c b/secure_fw/core/ipc/tfm_svcalls.c index 3721ba2300..c1a7c157ca 100644 --- a/secure_fw/core/ipc/tfm_svcalls.c +++ b/secure_fw/core/ipc/tfm_svcalls.c @@ -28,6 +28,11 @@ #include "tfm_psa_client_call.h" #include "tfm_rpc.h" +#ifdef PLATFORM_SVC_HANDLERS +extern int32_t platform_svc_handlers(tfm_svc_number_t svc_num, + uint32_t *ctx, uint32_t lr); +#endif + void tfm_irq_handler(uint32_t partition_id, psa_signal_t signal, int32_t irq_line); @@ -1012,8 +1017,12 @@ int32_t SVC_Handler_IPC(tfm_svc_number_t svc_num, uint32_t *ctx, uint32_t lr) break; default: +#ifdef PLATFORM_SVC_HANDLERS + return (platform_svc_handlers(svc_num, ctx, lr)); +#else LOG_MSG("Unknown SVC number requested!"); return PSA_ERROR_GENERIC_ERROR; +#endif } return PSA_SUCCESS; } diff --git a/secure_fw/core/tfm_core_svcalls_func.c b/secure_fw/core/tfm_core_svcalls_func.c index 3332508a86..ef0a6494aa 100644 --- a/secure_fw/core/tfm_core_svcalls_func.c +++ b/secure_fw/core/tfm_core_svcalls_func.c @@ -19,6 +19,11 @@ #include "tfm_peripherals_def.h" #include "tfm_irq_list.h" +#ifdef PLATFORM_SVC_HANDLERS +extern int32_t platform_svc_handlers(tfm_svc_number_t svc_num, + uint32_t *svc_args, uint32_t lr); +#endif + /* Include the definitions of the privileged IRQ handlers in case of library * model */ @@ -88,6 +93,9 @@ uint32_t tfm_core_svc_handler(uint32_t *svc_args, uint32_t lr, uint32_t *msp) tfm_core_get_boot_data_handler(svc_args); break; default: +#ifdef PLATFORM_SVC_HANDLERS + svc_args[0] = platform_svc_handlers(svc_num, svc_args, lr); +#endif break; } diff --git a/secure_fw/include/core/tfm_core_svc.h b/secure_fw/include/core/tfm_core_svc.h index a96b7f7322..426ed34088 100644 --- a/secure_fw/include/core/tfm_core_svc.h +++ b/secure_fw/include/core/tfm_core_svc.h @@ -44,6 +44,7 @@ typedef enum { TFM_SVC_PSA_NOTIFY, TFM_SVC_PSA_CLEAR, #endif + TFM_SVC_PLATFORM_BASE = 50 /* leave room for additional Core handlers */ } tfm_svc_number_t; #define SVC(code) __ASM volatile("svc %0" : : "I" (code)) |