Core: Add secure and trusted flags to partition DB

Add a new flags field to the secure partition DB. Add two flags,
signalling whether the partition is secure and/or trusted. When a
partition ID is checked whether its partition is secure or not, the new
flag is used, instead of comparing the partition ID to the partition ID
of the non-secure partition. This creates the possibility for the TF-M
to be able to handle multiple non-secure partitions.

Change-Id: I0a99eeb1b439892a709b934de6d66f9598781a8c
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/secure_fw/spm/spm_api.c b/secure_fw/spm/spm_api.c
index 1705de8..06938fc 100644
--- a/secure_fw/spm/spm_api.c
+++ b/secure_fw/spm/spm_api.c
@@ -93,6 +93,7 @@
     part_ptr = &(g_spm_partition_db.partitions[
             g_spm_partition_db.partition_count]);
     part_ptr->static_data.partition_id = TFM_SP_NON_SECURE_ID;
+    part_ptr->static_data.partition_flags = 0;
     part_ptr->runtime_data.partition_state = SPM_PARTITION_STATE_UNINIT;
     ++g_spm_partition_db.partition_count;
 
@@ -103,6 +104,8 @@
     part_ptr = &(g_spm_partition_db.partitions[
             g_spm_partition_db.partition_count]);
     part_ptr->static_data.partition_id = TFM_SP_CORE_ID;
+    part_ptr->static_data.partition_flags =
+                    SPM_PART_FLAG_SECURE | SPM_PART_FLAG_TRUSTED;
     part_ptr->runtime_data.partition_state = SPM_PARTITION_STATE_UNINIT;
     ++g_spm_partition_db.partition_count;
 
@@ -400,8 +403,14 @@
             partition_id;
 }
 
+uint32_t tfm_spm_partition_get_flags(uint32_t partition_idx)
+{
+    return g_spm_partition_db.partitions[partition_idx].static_data.
+            partition_flags;
+}
+
 const struct spm_partition_runtime_data_t *
-             tfm_spm_partition_get_runtime_data(uint32_t partition_idx)
+            tfm_spm_partition_get_runtime_data(uint32_t partition_idx)
 {
     return &(g_spm_partition_db.partitions[partition_idx].runtime_data);
 }