SPM: Add backend operation 'replying'

SFN and IPC have different message replying mechanisms:

- SFN replies to the client by SPM after messaging is performed;
  while IPC partition calls 'psa_reply' initiatively to reply to
  the client.

Abstract 'replying' to decouple the backend-specific operations
out of common FFM logic.

Change-Id: Ie28a0eaa1b37dfe458328dfb6ba298a0bf979c26
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 cd35e36..ee1a4c2 100644
--- a/secure_fw/spm/ffm/backend_ipc.c
+++ b/secure_fw/spm/ffm/backend_ipc.c
@@ -80,6 +80,15 @@
     return PSA_SUCCESS;
 }
 
+static void ipc_replying(struct tfm_msg_body_t *p_msg, psa_status_t status)
+{
+    if (is_tfm_rpc_msg(p_msg)) {
+        tfm_rpc_client_call_reply(p_msg, status);
+    } else {
+        thrd_wake_up(&p_msg->ack_evnt, status);
+    }
+}
+
 /* Parameters are treated as assuredly */
 static void ipc_comp_init_assuredly(struct partition_t *p_pt,
                                     uint32_t service_setting)
@@ -132,4 +141,5 @@
     .comp_init_assuredly = ipc_comp_init_assuredly,
     .system_run          = ipc_system_run,
     .messaging           = ipc_messaging,
+    .replying            = ipc_replying,
 };