Core: SPM to rely on manifest files for database

Remove manual service attribute lists and rely on
manifest list generated include files.

Change-Id: Ica1b524f5ac48a80223f28c5253f383397b95290
Signed-off-by: Miklos Balint <miklos.balint@arm.com>
diff --git a/secure_fw/spm/spm_api.c b/secure_fw/spm/spm_api.c
index e83c62e..67fc42c 100644
--- a/secure_fw/spm/spm_api.c
+++ b/secure_fw/spm/spm_api.c
@@ -127,7 +127,7 @@
     ++g_spm_partition_db.partition_count;
 
     /* Add user-defined secure partitions */
-    #include "user_partition_defines.inc"
+    #include "secure_fw/services/tfm_partition_list.inc"
 
     g_spm_partition_db.is_init = 1;
 
diff --git a/secure_fw/spm/spm_db.h b/secure_fw/spm/spm_db.h
index d223f88..4b92557 100644
--- a/secure_fw/spm/spm_db.h
+++ b/secure_fw/spm/spm_db.h
@@ -13,12 +13,6 @@
 #include "target_cfg.h"
 #include "spm_partition_defs.h"
 
-/* This limit is only used to define the size of the database reserved for
- * partitions. There's no requirement that it match the number of partitions
- * that get registered in a specific build
- */
-#define SPM_MAX_PARTITIONS (7)
-
 struct spm_partition_desc_t;
 struct spm_partition_db_t;
 
diff --git a/secure_fw/spm/spm_partition_defs.h b/secure_fw/spm/spm_partition_defs.h
index e950027..85ab1ec 100644
--- a/secure_fw/spm/spm_partition_defs.h
+++ b/secure_fw/spm/spm_partition_defs.h
@@ -17,6 +17,8 @@
 #define INVALID_PARTITION_ID (~0U)
 
 /* ***** partition ID-s internal to the TFM ***** */
+#define TFM_INTERNAL_PARTITIONS (2)
+
 /* From the SPM point of view the non secure processing environment is handled
  * as a special secure partition. This simplifies the context switch
  * operations.
@@ -27,18 +29,12 @@
  */
 #define TFM_SP_CORE_ID (1)
 
-#ifdef TFM_PARTITION_TEST_CORE
-#define TFM_SP_CORE_TEST_ID (2)
-#define TFM_SP_CORE_TEST_2_ID (3)
-#endif /* TFM_PARTITION_TEST_CORE */
+#include "secure_fw/services/tfm_partition_defs.inc"
 
-/* Give SST test service next ID after core test services */
-#ifdef TFM_PARTITION_TEST_SST
-#define TFM_SP_SST_TEST_PARTITION_ID (4)
-#endif /* TFM_PARTITION_TEST_SST */
-
-/* ***** Normal partition ID-s ***** */
-#define TFM_SP_STORAGE_ID (TFM_SP_BASE)
-#define TFM_SP_AUDIT_LOG_ID (TFM_SP_BASE + 1)
+/* This limit is only used to define the size of the database reserved for
+ * partitions. There's no requirement that it match the number of partitions
+ * that get registered in a specific build
+ */
+#define SPM_MAX_PARTITIONS (TFM_MAX_USER_PARTITIONS + TFM_INTERNAL_PARTITIONS)
 
 #endif /* __SPM_PARTITION_DEFS_H__ */
diff --git a/secure_fw/spm/user_partition_defines.inc b/secure_fw/spm/user_partition_defines.inc
deleted file mode 100644
index 9afd110..0000000
--- a/secure_fw/spm/user_partition_defines.inc
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __USER_PARTITION_DEFINES_INC__
-#define __USER_PARTITION_DEFINES_INC__
-
-/* PARTITION_DECLARE have to be called for a service, before calling
- * any of PARTITION_ADD_INIT_FUNC or PARTITION_ADD_PERIPHERAL
- */
-
-#ifdef TFM_PARTITION_TEST_CORE
-/****************************** TFM_SP_CORE_TEST ******************************/
-PARTITION_DECLARE(TFM_SP_CORE_TEST, SPM_PART_FLAG_SECURE);
-PARTITION_ADD_INIT_FUNC(TFM_SP_CORE_TEST, core_test_init);
-PARTITION_ADD_PERIPHERAL(TFM_SP_CORE_TEST,
-    MPS2_IO_FPGAIO_BASE_S, MPS2_IO_FPGAIO_BASE_S + 0xFFF,
-    PPC_SP_APB_PPC_EXP2, CMSDK_FPGA_IO_PPC_POS);
-
-/***************************** TFM_SP_CORE_TEST_2 *****************************/
-PARTITION_DECLARE(TFM_SP_CORE_TEST_2, SPM_PART_FLAG_SECURE);
-PARTITION_ADD_INIT_FUNC(TFM_SP_CORE_TEST_2, core_test_2_init);
-#endif /* TFM_PARTITION_TEST_CORE */
-
-/******************************* TFM_SP_STORAGE *******************************/
-PARTITION_DECLARE(TFM_SP_STORAGE, SPM_PART_FLAG_SECURE | SPM_PART_FLAG_TRUSTED);
-PARTITION_ADD_INIT_FUNC(TFM_SP_STORAGE, sst_am_prepare);
-
-/******************************* TFM_SP_AUDIT_LOG *****************************/
-PARTITION_DECLARE(TFM_SP_AUDIT_LOG,
-                  SPM_PART_FLAG_SECURE | SPM_PART_FLAG_TRUSTED);
-PARTITION_ADD_INIT_FUNC(TFM_SP_AUDIT_LOG, log_core_init);
-
-#ifndef LOG_UART_REDIRECTION
-#define LOG_UART_REDIRECTION (0U)
-#endif
-#if (LOG_UART_REDIRECTION == 1U)
-PARTITION_ADD_PERIPHERAL(TFM_SP_AUDIT_LOG,
-    UART1_BASE_S, UART1_BASE_S + 0xFFF,
-    PPC_SP_APB_PPC_EXP1, CMSDK_UART1_APB_PPC_POS)
-#endif
-
-#ifdef TFM_PARTITION_TEST_SST
-/**************************** TFM_SP_SST_TEST_PARTITION ***********************/
-PARTITION_DECLARE(TFM_SP_SST_TEST_PARTITION, SPM_PART_FLAG_SECURE);
-PARTITION_ADD_INIT_FUNC(TFM_SP_SST_TEST_PARTITION, sst_test_service_init);
-#endif /* TFM_PARTITION_TEST_SST */
-
-#endif /* __USER_PARTITION_DEFINES_INC__ */