Tools: Generate SPM configurations in script

The manifest tool has two places (config_impl.h and config_impl.cmake)
to check SFN/IPC Partitions numbers.
This doubles the maintainance effort.

This patch moves those checks forward to the manifest script.
This patch also adds back all the SPM configurations to config_impl.h
so that all sources need them only have to include the head file but
no need to add compiler definitions.

This patch removes the backend.c and builds the backend_ipc/sfn.c
according to the configurations.

Change-Id: I8da72bccc547df6ee4b2503869daf490b04bcf8b
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/tools/config_impl.cmake.template b/tools/config_impl.cmake.template
index 4c9dbcc..5aeb360 100644
--- a/tools/config_impl.cmake.template
+++ b/tools/config_impl.cmake.template
@@ -9,29 +9,12 @@
 ########{{utilities.donotedit_warning}}########
 
 if(TFM_PSA_API)
-{% if partition_statistics['ipc_partition_num'] > 0
-    and partition_statistics['sfn_partition_num'] == 0 %}
-    set(CONFIG_TFM_SPM_BACKEND_IPC ON PARENT_SCOPE)
+    set(CONFIG_TFM_SPM_BACKEND_SFN {{config_impl['CONFIG_TFM_SPM_BACKEND_SFN']}} PARENT_SCOPE)
+    set(CONFIG_TFM_SPM_BACKEND_IPC {{config_impl['CONFIG_TFM_SPM_BACKEND_IPC']}} PARENT_SCOPE)
 
-    if(TFM_ISOLATION_LEVEL GREATER 1)
-        set(CONFIG_TFM_PSA_API_SUPERVISOR_CALL ON PARENT_SCOPE)
-    else()
-        set(CONFIG_TFM_PSA_API_CROSS_CALL ON PARENT_SCOPE)
-    endif()
-{% elif partition_statistics['sfn_partition_num'] > 0
-    and partition_statistics['ipc_partition_num'] == 0 %}
-    set(CONFIG_TFM_SPM_BACKEND_SFN ON PARENT_SCOPE)
-    set(CONFIG_TFM_PSA_API_SFN_CALL ON PARENT_SCOPE)
-
-    if(TFM_ISOLATION_LEVEL GREATER 1)
-        message(FATAL_ERROR "High isolation level SFN model is not supported.")
-    endif()
-{% elif partition_statistics['sfn_partition_num'] > 0
-    and partition_statistics['ipc_partition_num'] > 0 %}
-    message(FATAL_ERROR "IPC and SFN co-work not supported yet.")
-{% else %}
-    message(FATAL_ERROR "Invalid partition number input, check configurations.")
-{% endif %}
+    set(CONFIG_TFM_PSA_API_SFN_CALL        {{config_impl['CONFIG_TFM_PSA_API_SFN_CALL']}}        PARENT_SCOPE)
+    set(CONFIG_TFM_PSA_API_CROSS_CALL      {{config_impl['CONFIG_TFM_PSA_API_CROSS_CALL']}}      PARENT_SCOPE)
+    set(CONFIG_TFM_PSA_API_SUPERVISOR_CALL {{config_impl['CONFIG_TFM_PSA_API_SUPERVISOR_CALL']}} PARENT_SCOPE)
 
     if((CONFIG_TFM_FP GREATER 0) AND CONFIG_TFM_SPM_BACKEND_SFN)
         message(FATAL_ERROR "FP is not supported for SFN model.")