SPM: Merge 'internal_msg' members into handle
'internal_msg' is a member of handle, defining a dedicated type for
it causes troubles when:
- Defining interfaces for processing connections. Taking the handle
as parameter makes message abstraction unnecessary, and taking
message as paramter makes extra message-to-handle mapping happen.
This patch is basically a search and replace, which eases the review.
After the merging, several unnecessary mapping functions are removed
(set/get rhandle e.g.). Followed up patches focus on detailed refine.
Change-Id: I2ec1375fde470d4a3983848afb46575d3cb0b392
Signed-off-by: Ken Liu <Ken.Liu@arm.com>
diff --git a/secure_fw/spm/ffm/backend_ipc.c b/secure_fw/spm/ffm/backend_ipc.c
index 48c7899..443c5da 100644
--- a/secure_fw/spm/ffm/backend_ipc.c
+++ b/secure_fw/spm/ffm/backend_ipc.c
@@ -46,13 +46,13 @@
* current thread and trigger scheduler.
*/
static psa_status_t ipc_messaging(struct service_t *service,
- struct tfm_msg_body_t *msg)
+ struct conn_handle_t *hdl)
{
struct partition_t *p_owner = NULL;
psa_signal_t signal = 0;
struct critical_section_t cs_assert = CRITICAL_SECTION_STATIC_INIT;
- if (!msg || !service || !service->p_ldinf || !service->partition) {
+ if (!hdl || !service || !service->p_ldinf || !service->partition) {
return PSA_ERROR_PROGRAMMER_ERROR;
}
@@ -61,7 +61,7 @@
CRITICAL_SECTION_ENTER(cs_assert);
- UNI_LIST_INSERT_AFTER(p_owner, msg, p_messages);
+ UNI_LIST_INSERT_AFTER(p_owner, hdl, p_handles);
/* Messages put. Update signals */
p_owner->signals_asserted |= signal;
@@ -78,19 +78,19 @@
* thread.
*/
- if (!is_tfm_rpc_msg(msg)) {
- thrd_wait_on(&msg->ack_evnt, CURRENT_THREAD);
+ if (!is_tfm_rpc_msg(hdl)) {
+ thrd_wait_on(&hdl->ack_evnt, CURRENT_THREAD);
}
return PSA_SUCCESS;
}
-static int32_t ipc_replying(struct tfm_msg_body_t *p_msg, int32_t status)
+static int32_t ipc_replying(struct conn_handle_t *hdl, int32_t status)
{
- if (is_tfm_rpc_msg(p_msg)) {
- tfm_rpc_client_call_reply(p_msg, status);
+ if (is_tfm_rpc_msg(hdl)) {
+ tfm_rpc_client_call_reply(hdl, status);
} else {
- thrd_wake_up(&p_msg->ack_evnt, status);
+ thrd_wake_up(&hdl->ack_evnt, status);
}
/*
@@ -110,7 +110,7 @@
p_pt->signals_allowed |= PSA_DOORBELL | service_setting;
THRD_SYNC_INIT(&p_pt->waitobj);
- UNI_LISI_INIT_NODE(p_pt, p_messages);
+ UNI_LISI_INIT_NODE(p_pt, p_handles);
THRD_INIT(&p_pt->thrd, &p_pt->ctx_ctrl,
TO_THREAD_PRIORITY(PARTITION_PRIORITY(p_pldi->flags)));