SPM: Turn bi-directional list into uni-directional

Uni-list works well enough for linking items and easier to apply
synchronization mechanisms for it as it has only one member to
be maintained when inserting/removing.

The existing usage defines a a fixed header node to make the general
uni-directional list work easier. This fixed header node does not
need to be the same type as the list item, just need to have the
same for link indicator. With this fixed header, there is no need
to keep checking if the head is going to be updated when updating
the members of the list.

For example, a 'partition_t' as the head node and it contains the
link indicator 'p_messages' to link all pending messages. So does
the list usage in handle pool logic.

And it is still applicable to reference these uni-directional list
functions for the general list usages without a fixed head member,
just choose proper functions to match the purpose.

Change-Id: I38a04f59e5fbf799a449a38fa09ea103b554c6bd
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 0cfbcb5..48c7899 100644
--- a/secure_fw/spm/ffm/backend_ipc.c
+++ b/secure_fw/spm/ffm/backend_ipc.c
@@ -60,8 +60,8 @@
     signal = service->p_ldinf->signal;
 
     CRITICAL_SECTION_ENTER(cs_assert);
-    /* Add message to partition message list tail */
-    BI_LIST_INSERT_BEFORE(&p_owner->msg_list, &msg->msg_node);
+
+    UNI_LIST_INSERT_AFTER(p_owner, msg, p_messages);
 
     /* Messages put. Update signals */
     p_owner->signals_asserted |= signal;
@@ -110,7 +110,7 @@
     p_pt->signals_allowed |= PSA_DOORBELL | service_setting;
 
     THRD_SYNC_INIT(&p_pt->waitobj);
-    BI_LIST_INIT_NODE(&p_pt->msg_list);
+    UNI_LISI_INIT_NODE(p_pt, p_messages);
 
     THRD_INIT(&p_pt->thrd, &p_pt->ctx_ctrl,
               TO_THREAD_PRIORITY(PARTITION_PRIORITY(p_pldi->flags)));