SPM: Use flag to indicate NS Agent

NS Agent is recognized by partition ID in the existing implementation,
this needs the implementation to reserve a specific value for it
which is irrational for the significance of partition ID.

Assign a flag bit to indicate if a partition is one NS Agent or not.

This also helps abstract the coming memory-checking functionality -
the platform can perform the checking by given partition's boundaries
instead of leaving those platform-specific settings to SPM common
logic, such as executable, read-only, privileged or non-secure
accessible.

Change-Id: I06c56077afc38b1cd2eed53a226c46823896ecd5
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..69e956d 100644
--- a/secure_fw/spm/ffm/backend_ipc.c
+++ b/secure_fw/spm/ffm/backend_ipc.c
@@ -116,7 +116,7 @@
               TO_THREAD_PRIORITY(PARTITION_PRIORITY(p_pldi->flags)));
 
 #if defined(CONFIG_TFM_PSA_API_CROSS_CALL) && !defined(TFM_MULTI_CORE_TOPOLOGY)
-    if (p_pldi->pid == TFM_SP_NON_SECURE_ID) {
+    if (p_pldi->flags & PARTITION_NON_SECURE_AGENT) {
         SPM_THREAD_CONTEXT = &p_pt->ctx_ctrl;
     }
 #endif