aboutsummaryrefslogtreecommitdiff
path: root/interface
diff options
context:
space:
mode:
Diffstat (limited to 'interface')
-rw-r--r--interface/CMakeLists.txt1
-rw-r--r--interface/include/multi_core/tfm_ns_mailbox.h53
-rw-r--r--interface/src/multi_core/tfm_ns_mailbox.c16
-rw-r--r--interface/src/multi_core/tfm_ns_mailbox_rtos_api.c2
4 files changed, 39 insertions, 33 deletions
diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt
index 188e651c95..16e6504eec 100644
--- a/interface/CMakeLists.txt
+++ b/interface/CMakeLists.txt
@@ -47,7 +47,6 @@ target_compile_definitions(psa_interface
$<$<BOOL:${CONFIG_TFM_ENABLE_CTX_MGMT}>:CONFIG_TFM_ENABLE_CTX_MGMT>
$<$<BOOL:${TFM_ISOLATION_LEVEL}>:TFM_LVL=${TFM_ISOLATION_LEVEL}>
$<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:TFM_MULTI_CORE_TOPOLOGY>
- $<$<BOOL:${TFM_MULTI_CORE_MULTI_CLIENT_CALL}>:TFM_MULTI_CORE_MULTI_CLIENT_CALL>
$<$<BOOL:${FORWARD_PROT_MSG}>:FORWARD_PROT_MSG=${FORWARD_PROT_MSG}>
$<$<BOOL:${TFM_SP_META_PTR_ENABLE}>:TFM_SP_META_PTR_ENABLE>
)
diff --git a/interface/include/multi_core/tfm_ns_mailbox.h b/interface/include/multi_core/tfm_ns_mailbox.h
index 6b64443fa0..69d0b2999b 100644
--- a/interface/include/multi_core/tfm_ns_mailbox.h
+++ b/interface/include/multi_core/tfm_ns_mailbox.h
@@ -18,6 +18,10 @@
extern "C" {
#endif
+#if !defined(TFM_MULTI_CORE_NS_OS) && (NUM_MAILBOX_QUEUE_SLOT > 1)
+#error "NUM_MAILBOX_QUEUE_SLOT should be set to 1 for NS bare metal environment"
+#endif
+
#ifdef TFM_MULTI_CORE_TEST
/**
* \brief The structure to hold the statistics result of NSPE mailbox
@@ -64,6 +68,7 @@ int32_t tfm_ns_mailbox_client_call(uint32_t call_type,
int32_t client_id,
int32_t *reply);
+#ifdef TFM_MULTI_CORE_NS_OS
/**
* \brief Go through mailbox messages already replied by SPE mailbox and
* wake up the owner tasks of replied mailbox messages.
@@ -76,6 +81,12 @@ int32_t tfm_ns_mailbox_client_call(uint32_t call_type,
* \return Other return code Failed with an error code
*/
int32_t tfm_ns_mailbox_wake_reply_owner_isr(void);
+#else
+static inline int32_t tfm_ns_mailbox_wake_reply_owner_isr(void)
+{
+ return MAILBOX_NO_PEND_EVENT;
+}
+#endif
/**
* \brief Platform specific NSPE mailbox initialization.
@@ -127,22 +138,7 @@ void tfm_ns_mailbox_hal_enter_critical_isr(void);
*/
void tfm_ns_mailbox_hal_exit_critical_isr(void);
-#ifdef FORWARD_PROT_MSG
-static inline int32_t tfm_ns_mailbox_os_lock_init(void)
-{
- return MAILBOX_SUCCESS;
-}
-
-static inline uint32_t tfm_ns_mailbox_os_lock_acquire(void)
-{
- return MAILBOX_SUCCESS;
-}
-
-static inline uint32_t tfm_ns_mailbox_os_lock_release(void)
-{
- return MAILBOX_SUCCESS;
-}
-#else /* FORWARD_PROT_MSG */
+#ifdef TFM_MULTI_CORE_NS_OS
/**
* \brief Initialize the multi-core lock for synchronizing PSA client call(s)
* The actual implementation depends on the non-secure use scenario.
@@ -169,9 +165,7 @@ int32_t tfm_ns_mailbox_os_lock_acquire(void);
* \return \ref MAILBOX_GENERIC_ERROR on error
*/
int32_t tfm_ns_mailbox_os_lock_release(void);
-#endif /* FORWARD_PROT_MSG */
-#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
/**
* \brief Get the handle of the current non-secure task executing mailbox
* functionalities
@@ -208,16 +202,31 @@ void tfm_ns_mailbox_os_wait_reply(void);
* \param[in] task_handle The handle to the task to be woken up.
*/
void tfm_ns_mailbox_os_wake_task_isr(const void *task_handle);
-#else /* TFM_MULTI_CORE_MULTI_CLIENT_CALL */
+#else /* TFM_MULTI_CORE_NS_OS */
#define tfm_ns_mailbox_os_wait_reply() do {} while (0)
+#define tfm_ns_mailbox_os_wake_task_isr(task) do {} while (0)
+
+static inline int32_t tfm_ns_mailbox_os_lock_init(void)
+{
+ return MAILBOX_SUCCESS;
+}
+
+static inline int32_t tfm_ns_mailbox_os_lock_acquire(void)
+{
+ return MAILBOX_SUCCESS;
+}
+
+static inline int32_t tfm_ns_mailbox_os_lock_release(void)
+{
+ return MAILBOX_SUCCESS;
+}
+
static inline const void *tfm_ns_mailbox_os_get_task_handle(void)
{
return NULL;
}
-
-#define tfm_ns_mailbox_os_wake_task_isr(task) do {} while (0)
-#endif /* TFM_MULTI_CORE_MULTI_CLIENT_CALL */
+#endif /* TFM_MULTI_CORE_NS_OS */
#ifdef TFM_MULTI_CORE_TEST
/**
diff --git a/interface/src/multi_core/tfm_ns_mailbox.c b/interface/src/multi_core/tfm_ns_mailbox.c
index 2096b6e523..90836ff5e5 100644
--- a/interface/src/multi_core/tfm_ns_mailbox.c
+++ b/interface/src/multi_core/tfm_ns_mailbox.c
@@ -80,7 +80,7 @@ static inline void clear_queue_slot_woken(uint8_t idx)
}
}
-#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
+#ifdef TFM_MULTI_CORE_NS_OS
/*
* When NSPE mailbox only covers a single non-secure core, spinlock only
* requires to disable IRQ.
@@ -98,15 +98,15 @@ static inline void ns_mailbox_spin_unlock(void)
{
__enable_irq();
}
-#else /* TFM_MULTI_CORE_MULTI_CLIENT_CALL */
+#else /* TFM_MULTI_CORE_NS_OS */
/*
- * Local spinlock is implemented as a dummy one when multiple PSA client call
- * feature is disabled, since interrupt is not required in NS mailbox.
+ * Local spinlock is implemented as a dummy one when integrating with NS bare
+ * metal environment since interrupt is not required in NS mailbox.
*/
#define ns_mailbox_spin_lock() do {} while (0)
#define ns_mailbox_spin_unlock() do {} while (0)
-#endif /* TFM_MULTI_CORE_MULTI_CLIENT_CALL */
+#endif /* TFM_MULTI_CORE_NS_OS */
static uint8_t acquire_empty_slot(struct ns_mailbox_queue_t *queue)
{
@@ -303,7 +303,7 @@ exit:
return ret;
}
-#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
+#ifdef TFM_MULTI_CORE_NS_OS
int32_t tfm_ns_mailbox_wake_reply_owner_isr(void)
{
uint8_t idx;
@@ -362,7 +362,7 @@ static inline bool mailbox_wait_reply_signal(uint8_t idx)
return is_set;
}
-#else /* TFM_MULTI_CORE_MULTI_CLIENT_CALL */
+#else /* TFM_MULTI_CORE_NS_OS */
static inline bool mailbox_wait_reply_signal(uint8_t idx)
{
bool is_set = false;
@@ -378,7 +378,7 @@ static inline bool mailbox_wait_reply_signal(uint8_t idx)
return is_set;
}
-#endif /* TFM_MULTI_CORE_MULTI_CLIENT_CALL */
+#endif /* TFM_MULTI_CORE_NS_OS */
static int32_t mailbox_wait_reply(uint8_t idx)
{
diff --git a/interface/src/multi_core/tfm_ns_mailbox_rtos_api.c b/interface/src/multi_core/tfm_ns_mailbox_rtos_api.c
index f7d23d2bc4..1ac1b4fba7 100644
--- a/interface/src/multi_core/tfm_ns_mailbox_rtos_api.c
+++ b/interface/src/multi_core/tfm_ns_mailbox_rtos_api.c
@@ -28,7 +28,6 @@
static void *ns_lock_handle = NULL;
-#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
const void *tfm_ns_mailbox_os_get_task_handle(void)
{
return os_wrapper_thread_get_handle();
@@ -43,7 +42,6 @@ void tfm_ns_mailbox_os_wake_task_isr(const void *task_handle)
{
os_wrapper_thread_set_flag_isr((void *)task_handle, MAILBOX_THREAD_FLAG);
}
-#endif /* TFM_MULTI_CORE_MULTI_CLIENT_CALL */
int32_t tfm_ns_mailbox_os_lock_init(void)
{