aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSummer Qin <summer.qin@arm.com>2020-01-06 15:40:03 +0800
committerKen Liu <ken.liu@arm.com>2020-02-13 07:22:14 +0000
commit66f1e03d8126ddfa4749d8ed379775e655dad95a (patch)
tree1f57eff896c876f84654076bc937c3f71276c2ed
parente9b61a79cae79af3dd8228c94e51fd8f796880be (diff)
downloadtrusted-firmware-m-66f1e03d8126ddfa4749d8ed379775e655dad95a.tar.gz
Core: Thread structure refine
- Change the thread context structure name from 'struct tfm_thrd_ctx' to 'struct tfm_core_thread_t'. - Change the thread context structure member from 'status' to 'state' to indicate the state machine of thread better. - Add 'core' prefix of thread functions to indicate that these functions are under core scope. Change-Id: I642956f4dde0c7cf9e0f98fbb3c670335d1b85de Signed-off-by: Summer Qin <summer.qin@arm.com>
-rw-r--r--secure_fw/core/ipc/include/tfm_thread.h85
-rw-r--r--secure_fw/core/ipc/include/tfm_wait.h6
-rw-r--r--secure_fw/core/ipc/tfm_svcalls.c6
-rw-r--r--secure_fw/core/ipc/tfm_thread.c69
-rw-r--r--secure_fw/core/ipc/tfm_wait.c16
-rw-r--r--secure_fw/spm/spm_api.h2
-rw-r--r--secure_fw/spm/spm_api_ipc.c30
7 files changed, 108 insertions, 106 deletions
diff --git a/secure_fw/core/ipc/include/tfm_thread.h b/secure_fw/core/ipc/include/tfm_thread.h
index 3b3c629db2..7cadd508cb 100644
--- a/secure_fw/core/ipc/include/tfm_thread.h
+++ b/secure_fw/core/ipc/include/tfm_thread.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,12 +12,12 @@
#include "tfm_arch.h"
#include "cmsis_compiler.h"
-/* Status code */
-#define THRD_STAT_CREATING 0
-#define THRD_STAT_RUNNING 1
-#define THRD_STAT_BLOCK 2
-#define THRD_STAT_DETACH 3
-#define THRD_STAT_INVALID 4
+/* State code */
+#define THRD_STATE_CREATING 0
+#define THRD_STATE_RUNNING 1
+#define THRD_STATE_BLOCK 2
+#define THRD_STATE_DETACH 3
+#define THRD_STATE_INVALID 4
/* Security attribute - default as security */
#define THRD_ATTR_SECURE_OFFSET 16
@@ -35,23 +35,23 @@
#define THRD_ERR_INVALID_PARAM 1
/* Thread entry function type */
-typedef void *(*tfm_thrd_func_t)(void *);
+typedef void *(*tfm_core_thrd_entry_t)(void *);
struct tfm_state_context {
struct tfm_state_context_ext ctxb;
};
/* Thread context */
-struct tfm_thrd_ctx {
- tfm_thrd_func_t pfn; /* entry function */
+struct tfm_core_thread_t {
+ tfm_core_thrd_entry_t pfn; /* entry function */
void *param; /* entry parameter */
uintptr_t sp_btm; /* stack bottom (higher address)*/
uintptr_t sp_top; /* stack top (lower address) */
uint32_t prior; /* priority */
- uint32_t status; /* status */
+ uint32_t state; /* state */
struct tfm_state_context state_ctx; /* State context */
- struct tfm_thrd_ctx *next; /* next thread in list */
+ struct tfm_core_thread_t *next; /* next thread in list */
};
/*
@@ -68,11 +68,12 @@ struct tfm_thrd_ctx {
* Thread contex rely on caller allocated memory; initialize members in
* context. This function does not insert thread into schedulable list.
*/
-void tfm_thrd_init(struct tfm_thrd_ctx *pth,
- tfm_thrd_func_t pfn, void *param,
- uintptr_t sp_btm, uintptr_t sp_top);
+void tfm_core_thrd_init(struct tfm_core_thread_t *pth,
+ tfm_core_thrd_entry_t pfn, void *param,
+ uintptr_t sp_btm, uintptr_t sp_top);
-/* Set thread priority.
+/*
+ * Set thread priority.
*
* Parameters :
* pth - pointer of thread context
@@ -80,10 +81,10 @@ void tfm_thrd_init(struct tfm_thrd_ctx *pth,
*
* Notes :
* Set thread priority. Priority is set to THRD_PRIOR_MEDIUM in
- * tfm_thrd_init().
+ * tfm_core_thrd_init().
*/
-void __STATIC_INLINE tfm_thrd_priority(struct tfm_thrd_ctx *pth,
- uint32_t prior)
+void __STATIC_INLINE tfm_core_thrd_set_priority(struct tfm_core_thread_t *pth,
+ uint32_t prior)
{
pth->prior &= ~THRD_PRIOR_MASK;
pth->prior |= prior & THRD_PRIOR_MASK;
@@ -99,40 +100,40 @@ void __STATIC_INLINE tfm_thrd_priority(struct tfm_thrd_ctx *pth,
* Notes
* Reuse prior of thread context to shift down non-secure thread priority.
*/
-void __STATIC_INLINE tfm_thrd_secure(struct tfm_thrd_ctx *pth,
- uint32_t attr_secure)
+void __STATIC_INLINE tfm_core_thrd_set_secure(struct tfm_core_thread_t *pth,
+ uint32_t attr_secure)
{
pth->prior &= ~THRD_ATTR_NON_SECURE;
pth->prior |= attr_secure;
}
/*
- * Set thread status.
+ * Set thread state.
*
* Parameters :
* pth - pointer of thread context
- * new_status - new status of thread
+ * new_state - new state of thread
*
* Return :
* None
*
* Notes :
- * Thread status is not changed if invalid status value inputed.
+ * Thread state is not changed if invalid state value inputed.
*/
-void tfm_thrd_set_status(struct tfm_thrd_ctx *pth, uint32_t new_status);
+void tfm_core_thrd_set_state(struct tfm_core_thread_t *pth, uint32_t new_state);
/*
- * Get thread status.
+ * Get thread state.
*
* Parameters :
* pth - pointer of thread context
*
* Return :
- * Status of thread
+ * State of thread
*/
-uint32_t __STATIC_INLINE tfm_thrd_get_status(struct tfm_thrd_ctx *pth)
+uint32_t __STATIC_INLINE tfm_core_thrd_get_state(struct tfm_core_thread_t *pth)
{
- return pth->status;
+ return pth->state;
}
/*
@@ -146,8 +147,8 @@ uint32_t __STATIC_INLINE tfm_thrd_get_status(struct tfm_thrd_ctx *pth)
* This API is useful for blocked syscall blocking thread. Syscall
* could set its return value to the caller before caller goes.
*/
-void __STATIC_INLINE tfm_thrd_set_retval(struct tfm_thrd_ctx *pth,
- uint32_t retval)
+void __STATIC_INLINE tfm_core_thrd_set_retval(struct tfm_core_thread_t *pth,
+ uint32_t retval)
{
TFM_STATE_RET_VAL(&pth->state_ctx) = retval;
}
@@ -163,9 +164,9 @@ void __STATIC_INLINE tfm_thrd_set_retval(struct tfm_thrd_ctx *pth,
*
* Notes :
* This function validates thread info. It returns error if thread info
- * is not correct. Thread is avaliable after successful tfm_thrd_start().
+ * is not correct. Thread is avaliable after successful tfm_core_thrd_start().
*/
-uint32_t tfm_thrd_start(struct tfm_thrd_ctx *pth);
+uint32_t tfm_core_thrd_start(struct tfm_core_thread_t *pth);
/*
* Get current running thread.
@@ -173,7 +174,7 @@ uint32_t tfm_thrd_start(struct tfm_thrd_ctx *pth);
* Return :
* Current running thread context pointer.
*/
-struct tfm_thrd_ctx *tfm_thrd_curr_thread(void);
+struct tfm_core_thread_t *tfm_core_thrd_get_curr_thread(void);
/*
* Get next running thread in list.
@@ -181,7 +182,7 @@ struct tfm_thrd_ctx *tfm_thrd_curr_thread(void);
* Return :
* Pointer of next thread to be run.
*/
-struct tfm_thrd_ctx *tfm_thrd_next_thread(void);
+struct tfm_core_thread_t *tfm_core_thrd_get_next_thread(void);
/*
* Start scheduler for existing threads
@@ -194,7 +195,7 @@ struct tfm_thrd_ctx *tfm_thrd_next_thread(void);
* Caller needs to provide a thread object to collect current context.
* The usage of the collected context is caller defined.
*/
-void tfm_thrd_start_scheduler(struct tfm_thrd_ctx *pth);
+void tfm_core_thrd_start_scheduler(struct tfm_core_thread_t *pth);
/*
* Activate a scheduling action after exception.
@@ -202,7 +203,7 @@ void tfm_thrd_start_scheduler(struct tfm_thrd_ctx *pth);
* Notes :
* This function could be called multiple times before scheduling.
*/
-void tfm_thrd_activate_schedule(void);
+void tfm_core_thrd_activate_schedule(void);
/*
* Save current context into 'prev' thread and switch to 'next'.
@@ -215,9 +216,9 @@ void tfm_thrd_activate_schedule(void);
* Notes :
* This function could be called multiple times before scheduling.
*/
-void tfm_thrd_context_switch(struct tfm_state_context_ext *ctxb,
- struct tfm_thrd_ctx *prev,
- struct tfm_thrd_ctx *next);
+void tfm_core_thrd_switch_context(struct tfm_state_context_ext *ctxb,
+ struct tfm_core_thread_t *prev,
+ struct tfm_core_thread_t *next);
/*
* Svcall to exit current running thread.
@@ -225,7 +226,7 @@ void tfm_thrd_context_switch(struct tfm_state_context_ext *ctxb,
* Notes :
* Remove current thread out of schedulable list.
*/
-void tfm_svcall_thrd_exit(void);
+void tfm_svcall_exit_thrd(void);
/*
* Exit current running thread for client.
@@ -233,6 +234,6 @@ void tfm_svcall_thrd_exit(void);
* Notes:
* Must be called in thread mode.
*/
-void tfm_thrd_exit(void);
+void tfm_core_thrd_exit(void);
#endif
diff --git a/secure_fw/core/ipc/include/tfm_wait.h b/secure_fw/core/ipc/include/tfm_wait.h
index d116f2fd03..7d2055bd1e 100644
--- a/secure_fw/core/ipc/include/tfm_wait.h
+++ b/secure_fw/core/ipc/include/tfm_wait.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -15,8 +15,8 @@
#define TFM_EVENT_MAGIC 0x65766e74
struct tfm_event_t {
- uint32_t magic; /* 'evnt' */
- struct tfm_thrd_ctx *owner; /* Event blocked thread */
+ uint32_t magic; /* 'evnt' */
+ struct tfm_core_thread_t *owner; /* Event blocked thread */
};
/*
diff --git a/secure_fw/core/ipc/tfm_svcalls.c b/secure_fw/core/ipc/tfm_svcalls.c
index fdc99cba2f..dc8169e477 100644
--- a/secure_fw/core/ipc/tfm_svcalls.c
+++ b/secure_fw/core/ipc/tfm_svcalls.c
@@ -176,7 +176,7 @@ static psa_signal_t tfm_svcall_psa_wait(uint32_t *args)
/*
* Expected signals are included in signal wait mask, ignored signals
- * should not be set and affect caller thread status. Save this mask for
+ * should not be set and affect caller thread state. Save this mask for
* further checking while signals are ready to be set.
*/
partition->runtime_data.signal_mask = signal_mask;
@@ -582,7 +582,7 @@ static void update_caller_outvec_len(struct tfm_msg_body_t *msg)
*/
/* If it is a NS request via RPC, the owner of this message is not set */
if (!is_tfm_rpc_msg(msg)) {
- TFM_CORE_ASSERT(msg->ack_evnt.owner->status == THRD_STAT_BLOCK);
+ TFM_CORE_ASSERT(msg->ack_evnt.owner->state == THRD_STATE_BLOCK);
}
while (msg->msg.out_size[i] != 0) {
@@ -1040,7 +1040,7 @@ int32_t SVC_Handler_IPC(tfm_svc_number_t svc_num, uint32_t *ctx, uint32_t lr)
switch (svc_num) {
case TFM_SVC_EXIT_THRD:
- tfm_svcall_thrd_exit();
+ tfm_svcall_exit_thrd();
break;
case TFM_SVC_PSA_FRAMEWORK_VERSION:
return tfm_svcall_psa_framework_version();
diff --git a/secure_fw/core/ipc/tfm_thread.c b/secure_fw/core/ipc/tfm_thread.c
index 5c1ad17bad..c1134a8cae 100644
--- a/secure_fw/core/ipc/tfm_thread.c
+++ b/secure_fw/core/ipc/tfm_thread.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -14,18 +14,19 @@
#include "tfm_core_utils.h"
/* Force ZERO in case ZI(bss) clear is missing */
-static struct tfm_thrd_ctx *p_thrd_head = NULL;
-static struct tfm_thrd_ctx *p_runn_head = NULL;
-static struct tfm_thrd_ctx *p_curr_thrd = NULL;
+static struct tfm_core_thread_t *p_thrd_head = NULL;
+static struct tfm_core_thread_t *p_runn_head = NULL;
+static struct tfm_core_thread_t *p_curr_thrd = NULL;
/* Define Macro to fetch global to support future expansion (PERCPU e.g.) */
#define LIST_HEAD p_thrd_head
#define RUNN_HEAD p_runn_head
#define CURR_THRD p_curr_thrd
-static struct tfm_thrd_ctx *find_next_running_thread(struct tfm_thrd_ctx *pth)
+static struct tfm_core_thread_t *find_next_running_thread(
+ struct tfm_core_thread_t *pth)
{
- while (pth && pth->status != THRD_STAT_RUNNING) {
+ while (pth && pth->state != THRD_STATE_RUNNING) {
pth = pth->next;
}
@@ -33,7 +34,7 @@ static struct tfm_thrd_ctx *find_next_running_thread(struct tfm_thrd_ctx *pth)
}
/* To get next running thread for scheduler */
-struct tfm_thrd_ctx *tfm_thrd_next_thread(void)
+struct tfm_core_thread_t *tfm_core_thrd_get_next_thread(void)
{
/*
* First RUNNING thread has highest priority since threads are sorted with
@@ -43,20 +44,20 @@ struct tfm_thrd_ctx *tfm_thrd_next_thread(void)
}
/* To get current thread for caller */
-struct tfm_thrd_ctx *tfm_thrd_curr_thread()
+struct tfm_core_thread_t *tfm_core_thrd_get_curr_thread(void)
{
return CURR_THRD;
}
/* Insert a new thread into list by descending priority (Highest at head) */
-static void insert_by_prior(struct tfm_thrd_ctx **head,
- struct tfm_thrd_ctx *node)
+static void insert_by_prior(struct tfm_core_thread_t **head,
+ struct tfm_core_thread_t *node)
{
if (*head == NULL || (node->prior <= (*head)->prior)) {
node->next = *head;
*head = node;
} else {
- struct tfm_thrd_ctx *iter = *head;
+ struct tfm_core_thread_t *iter = *head;
while (iter->next && (node->prior > iter->next->prior)) {
iter = iter->next;
@@ -70,10 +71,10 @@ static void insert_by_prior(struct tfm_thrd_ctx **head,
* Set first running thread as head to reduce enumerate
* depth while searching for a first running thread.
*/
-static void update_running_head(struct tfm_thrd_ctx **runn,
- struct tfm_thrd_ctx *node)
+static void update_running_head(struct tfm_core_thread_t **runn,
+ struct tfm_core_thread_t *node)
{
- if ((node->status == THRD_STAT_RUNNING) &&
+ if ((node->state == THRD_STATE_RUNNING) &&
(*runn == NULL || (node->prior < (*runn)->prior))) {
*runn = node;
} else {
@@ -82,12 +83,12 @@ static void update_running_head(struct tfm_thrd_ctx **runn,
}
/* Set context members only. No validation here */
-void tfm_thrd_init(struct tfm_thrd_ctx *pth,
- tfm_thrd_func_t pfn, void *param,
- uintptr_t sp_btm, uintptr_t sp_top)
+void tfm_core_thrd_init(struct tfm_core_thread_t *pth,
+ tfm_core_thrd_entry_t pfn, void *param,
+ uintptr_t sp_btm, uintptr_t sp_top)
{
pth->prior = THRD_PRIOR_MEDIUM;
- pth->status = THRD_STAT_CREATING;
+ pth->state = THRD_STATE_CREATING;
pth->pfn = pfn;
pth->param = param;
pth->sp_btm = sp_btm;
@@ -97,7 +98,7 @@ void tfm_thrd_init(struct tfm_thrd_ctx *pth,
__attribute__((section("SFN")))
static void exit_zone(void)
{
- tfm_thrd_exit();
+ tfm_core_thrd_exit();
}
static void tfm_thrd_initialize_context(struct tfm_state_context *ctx,
@@ -129,10 +130,10 @@ static void tfm_thrd_initialize_context(struct tfm_state_context *ctx,
tfm_arch_initialize_ctx_ext(&ctx->ctxb, (uint32_t)p_ctxa, (uint32_t)sp_top);
}
-uint32_t tfm_thrd_start(struct tfm_thrd_ctx *pth)
+uint32_t tfm_core_thrd_start(struct tfm_core_thread_t *pth)
{
/* Validate parameters before really start */
- if ((pth->status != THRD_STAT_CREATING) ||
+ if ((pth->state != THRD_STATE_CREATING) ||
(pth->pfn == NULL) ||
(pth->sp_btm == 0) ||
(pth->sp_top == 0)) {
@@ -148,26 +149,26 @@ uint32_t tfm_thrd_start(struct tfm_thrd_ctx *pth)
insert_by_prior(&LIST_HEAD, pth);
/* Mark it as RUNNING after insertion */
- tfm_thrd_set_status(pth, THRD_STAT_RUNNING);
+ tfm_core_thrd_set_state(pth, THRD_STATE_RUNNING);
return THRD_SUCCESS;
}
-void tfm_thrd_set_status(struct tfm_thrd_ctx *pth, uint32_t new_status)
+void tfm_core_thrd_set_state(struct tfm_core_thread_t *pth, uint32_t new_state)
{
- TFM_CORE_ASSERT(pth != NULL && new_status < THRD_STAT_INVALID);
+ TFM_CORE_ASSERT(pth != NULL && new_state < THRD_STATE_INVALID);
- pth->status = new_status;
+ pth->state = new_state;
update_running_head(&RUNN_HEAD, pth);
}
/* Scheduling won't happen immediately but after the exception returns */
-void tfm_thrd_activate_schedule(void)
+void tfm_core_thrd_activate_schedule(void)
{
tfm_arch_trigger_pendsv();
}
-void tfm_thrd_start_scheduler(struct tfm_thrd_ctx *pth)
+void tfm_core_thrd_start_scheduler(struct tfm_core_thread_t *pth)
{
/*
* There is no selected thread before scheduler start, assign the caller
@@ -183,18 +184,18 @@ void tfm_thrd_start_scheduler(struct tfm_thrd_ctx *pth)
CURR_THRD = pth;
- tfm_thrd_activate_schedule();
+ tfm_core_thrd_activate_schedule();
}
/* Remove current thread out of the schedulable list */
-void tfm_svcall_thrd_exit(void)
+void tfm_svcall_exit_thrd(void)
{
- CURR_THRD->status = THRD_STAT_DETACH;
+ CURR_THRD->state = THRD_STATE_DETACH;
tfm_arch_trigger_pendsv();
}
__attribute__((section("SFN")))
-void tfm_thrd_exit(void)
+void tfm_core_thrd_exit(void)
{
SVC(TFM_SVC_EXIT_THRD);
while (1) {
@@ -202,9 +203,9 @@ void tfm_thrd_exit(void)
}
}
-void tfm_thrd_context_switch(struct tfm_state_context_ext *ctxb,
- struct tfm_thrd_ctx *prev,
- struct tfm_thrd_ctx *next)
+void tfm_core_thrd_switch_context(struct tfm_state_context_ext *ctxb,
+ struct tfm_core_thread_t *prev,
+ struct tfm_core_thread_t *next)
{
TFM_CORE_ASSERT(prev != NULL);
TFM_CORE_ASSERT(next != NULL);
diff --git a/secure_fw/core/ipc/tfm_wait.c b/secure_fw/core/ipc/tfm_wait.c
index 549b63b2e3..39f67666ee 100644
--- a/secure_fw/core/ipc/tfm_wait.c
+++ b/secure_fw/core/ipc/tfm_wait.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,18 +12,18 @@ void tfm_event_wait(struct tfm_event_t *pevnt)
{
TFM_CORE_ASSERT(pevnt && pevnt->magic == TFM_EVENT_MAGIC);
- pevnt->owner = tfm_thrd_curr_thread();
- tfm_thrd_set_status(pevnt->owner, THRD_STAT_BLOCK);
- tfm_thrd_activate_schedule();
+ pevnt->owner = tfm_core_thrd_get_curr_thread();
+ tfm_core_thrd_set_state(pevnt->owner, THRD_STATE_BLOCK);
+ tfm_core_thrd_activate_schedule();
}
void tfm_event_wake(struct tfm_event_t *pevnt, uint32_t retval)
{
TFM_CORE_ASSERT(pevnt && pevnt->magic == TFM_EVENT_MAGIC);
- if (pevnt->owner && pevnt->owner->status == THRD_STAT_BLOCK) {
- tfm_thrd_set_status(pevnt->owner, THRD_STAT_RUNNING);
- tfm_thrd_set_retval(pevnt->owner, retval);
- tfm_thrd_activate_schedule();
+ if (pevnt->owner && pevnt->owner->state == THRD_STATE_BLOCK) {
+ tfm_core_thrd_set_state(pevnt->owner, THRD_STATE_RUNNING);
+ tfm_core_thrd_set_retval(pevnt->owner, retval);
+ tfm_core_thrd_activate_schedule();
}
}
diff --git a/secure_fw/spm/spm_api.h b/secure_fw/spm/spm_api.h
index fbcda0969f..a99033abec 100644
--- a/secure_fw/spm/spm_api.h
+++ b/secure_fw/spm/spm_api.h
@@ -91,7 +91,7 @@ struct spm_partition_runtime_data_t {
struct tfm_event_t signal_evnt; /* Event signal */
uint32_t signals; /* Service signals had been triggered*/
struct tfm_list_node_t service_list;/* Service list */
- struct tfm_thrd_ctx sp_thrd; /* Thread context */
+ struct tfm_core_thread_t sp_thrd; /* Thread object */
uint32_t assigned_signals; /* All assigned signals */
#else /* TFM_PSA_API */
uint32_t partition_state;
diff --git a/secure_fw/spm/spm_api_ipc.c b/secure_fw/spm/spm_api_ipc.c
index 38ab043e59..ec25b419b3 100644
--- a/secure_fw/spm/spm_api_ipc.c
+++ b/secure_fw/spm/spm_api_ipc.c
@@ -445,7 +445,7 @@ uint32_t tfm_spm_partition_get_stack_top(uint32_t partition_idx)
uint32_t tfm_spm_partition_get_running_partition_id(void)
{
- struct tfm_thrd_ctx *pth = tfm_thrd_curr_thread();
+ struct tfm_core_thread_t *pth = tfm_core_thrd_get_curr_thread();
struct spm_partition_desc_t *partition;
struct spm_partition_runtime_data_t *r_data;
@@ -456,16 +456,16 @@ uint32_t tfm_spm_partition_get_running_partition_id(void)
return partition->static_data->partition_id;
}
-static struct tfm_thrd_ctx *
+static struct tfm_core_thread_t *
tfm_spm_partition_get_thread_info(uint32_t partition_idx)
{
return &g_spm_partition_db.partitions[partition_idx].runtime_data.sp_thrd;
}
-static tfm_thrd_func_t
+static tfm_core_thrd_entry_t
tfm_spm_partition_get_init_func(uint32_t partition_idx)
{
- return (tfm_thrd_func_t)(g_spm_partition_db.partitions[partition_idx].
+ return (tfm_core_thrd_entry_t)(g_spm_partition_db.partitions[partition_idx].
static_data->partition_init);
}
@@ -514,7 +514,7 @@ uint32_t tfm_spm_init(void)
{
uint32_t i, j, num;
struct spm_partition_desc_t *partition;
- struct tfm_thrd_ctx *pth, *p_ns_entry_thread = NULL;
+ struct tfm_core_thread_t *pth, *p_ns_entry_thread = NULL;
const struct tfm_spm_partition_platform_data_t **platform_data_p;
tfm_pool_init(conn_handle_pool,
@@ -567,11 +567,11 @@ uint32_t tfm_spm_init(void)
tfm_core_panic();
}
- tfm_thrd_init(pth,
- tfm_spm_partition_get_init_func(i),
- NULL,
- (uintptr_t)tfm_spm_partition_get_stack_top(i),
- (uintptr_t)tfm_spm_partition_get_stack_bottom(i));
+ tfm_core_thrd_init(pth,
+ tfm_spm_partition_get_init_func(i),
+ NULL,
+ (uintptr_t)tfm_spm_partition_get_stack_top(i),
+ (uintptr_t)tfm_spm_partition_get_stack_bottom(i));
pth->prior = tfm_spm_partition_get_priority(i);
@@ -581,7 +581,7 @@ uint32_t tfm_spm_init(void)
}
/* Kick off */
- if (tfm_thrd_start(pth) != THRD_SUCCESS) {
+ if (tfm_core_thrd_start(pth) != THRD_SUCCESS) {
tfm_core_panic();
}
}
@@ -614,7 +614,7 @@ uint32_t tfm_spm_init(void)
* cleaned up and the background context is never going to return. Tell
* the scheduler that the current thread is non-secure entry thread.
*/
- tfm_thrd_start_scheduler(p_ns_entry_thread);
+ tfm_core_thrd_start_scheduler(p_ns_entry_thread);
return p_ns_entry_thread->state_ctx.ctxb.lr;
}
@@ -626,8 +626,8 @@ void tfm_pendsv_do_schedule(struct tfm_state_context_ext *ctxb)
struct spm_partition_runtime_data_t *r_data;
uint32_t is_privileged;
#endif
- struct tfm_thrd_ctx *pth_next = tfm_thrd_next_thread();
- struct tfm_thrd_ctx *pth_curr = tfm_thrd_curr_thread();
+ struct tfm_core_thread_t *pth_next = tfm_core_thrd_get_next_thread();
+ struct tfm_core_thread_t *pth_curr = tfm_core_thrd_get_curr_thread();
if (pth_next != NULL && pth_curr != pth_next) {
#if TFM_LVL == 2
@@ -648,7 +648,7 @@ void tfm_pendsv_do_schedule(struct tfm_state_context_ext *ctxb)
tfm_spm_partition_change_privilege(is_privileged);
#endif
- tfm_thrd_context_switch(ctxb, pth_curr, pth_next);
+ tfm_core_thrd_switch_context(ctxb, pth_curr, pth_next);
}
/*