Core: Align psa_wait() to PSA FF 1.0.0

If the signal_mask does not include any assigned signals,
it is a PROGRAMMER ERROR, trigger the tfm_panic.

Change-Id: Ib3699800e540a758b79a0a79f55f6c6ba2285187
Signed-off-by: Shawn Shan <shawn.shan@arm.com>
diff --git a/secure_fw/spm/spm_api_ipc.c b/secure_fw/spm/spm_api_ipc.c
index e42c5a1..987002f 100644
--- a/secure_fw/spm/spm_api_ipc.c
+++ b/secure_fw/spm/spm_api_ipc.c
@@ -29,6 +29,7 @@
 #include "tfm_memory_utils.h"
 #include "tfm_core_utils.h"
 #include "tfm_rpc.h"
+#include "tfm_irq_list.h"
 
 #include "secure_fw/services/tfm_service_list.inc"
 
@@ -476,7 +477,7 @@
 
 void tfm_spm_init(void)
 {
-    uint32_t i, num;
+    uint32_t i, j, num;
     struct spm_partition_desc_t *partition;
     struct tfm_thrd_ctx *pth, this_thrd;
 
@@ -493,6 +494,17 @@
             continue;
         }
 
+        /* TODO: This can be optimized by generating the assigned signal
+         *       in code generation time.
+         */
+        for (j = 0; j < tfm_core_irq_signals_count; ++j) {
+            if (tfm_core_irq_signals[j].partition_id ==
+                                        partition->static_data->partition_id) {
+                partition->runtime_data.assigned_signals |=
+                                        tfm_core_irq_signals[j].signal_value;
+            }
+        }
+
         tfm_event_init(&partition->runtime_data.signal_evnt);
         tfm_list_init(&partition->runtime_data.service_list);
 
@@ -525,6 +537,8 @@
             tfm_panic();
         }
         service[i].partition = partition;
+        partition->runtime_data.assigned_signals |= service->service_db->signal;
+
         tfm_list_init(&service[i].handle_list);
         tfm_list_add_tail(&partition->runtime_data.service_list,
                           &service[i].list);