SPM: Sort out tfm_secure_api.c file

- Rename 'tfm_utils.h' to 'utilities.h'.
- Rename 'tfm_spm_services_api.h'to 'tfm_spm_services.h'.
- Move 'tfm_secure_api.c' from spm/runtime to spm/model_func and
  sort out the content

Change-Id: Ie8831e2b1430eab6a2edc9b6c0487ef14f2fafc6
Signed-off-by: Summer Qin <summer.qin@arm.com>
diff --git a/secure_fw/spm/include/tfm_secure_api.h b/secure_fw/spm/include/tfm_secure_api.h
index 6b177d4..8ed7a79 100644
--- a/secure_fw/spm/include/tfm_secure_api.h
+++ b/secure_fw/spm/include/tfm_secure_api.h
@@ -14,11 +14,12 @@
 #include "tfm_arch.h"
 #include "tfm/tfm_core_svc.h"
 #include "tfm_api.h"
-#include "tfm_utils.h"
+#include "utilities.h"
 #include "tfm_boot_status.h"
 #include "psa/service.h"
 
 #ifndef TFM_MULTI_CORE_TOPOLOGY
+#ifndef TFM_PSA_API
 /*!
  * \def __tfm_secure_gateway_attributes__
  *
@@ -35,7 +36,9 @@
 #define __tfm_secure_gateway_attributes__ \
         __attribute__((cmse_nonsecure_entry, section("SFN")))
 #endif /* __GNUC__ && !__ARMCC_VERSION */
+#endif /* !TFM_PSA_API */
 
+#ifdef TFM_PSA_API
 /*!
  * \def __tfm_psa_secure_gateway_attributes__
  *
@@ -52,6 +55,7 @@
 #define __tfm_psa_secure_gateway_attributes__ \
         __attribute__((cmse_nonsecure_entry, naked, section("SFN")))
 #endif /* __GNUC__ && !__ARMCC_VERSION */
+#endif /* TFM_PSA_API */
 #endif /* TFM_MULTI_CORE_TOPOLOGY */
 
 /* Hide specific errors if not debugging */
@@ -65,6 +69,7 @@
 #error TFM_LVL is not defined!
 #endif
 
+#ifndef TFM_PSA_API
 extern void tfm_secure_api_error_handler(void);
 
 typedef int32_t(*sfn_t)(int32_t, int32_t, int32_t, int32_t);
@@ -77,53 +82,12 @@
     bool ns_caller;
 };
 
-enum tfm_memory_access_e {
-    TFM_MEMORY_ACCESS_RO = 1,
-    TFM_MEMORY_ACCESS_RW = 2,
-};
-
 extern int32_t tfm_core_get_caller_client_id(int32_t *caller_client_id);
 
-extern int32_t tfm_core_get_boot_data(uint8_t major_type,
-                                      struct tfm_boot_data *boot_data,
-                                      uint32_t len);
-
 int32_t tfm_core_sfn_request(const struct tfm_sfn_req_s *desc_ptr);
 
 int32_t tfm_spm_sfn_request_thread_mode(struct tfm_sfn_req_s *desc_ptr);
 
-/**
- * \brief Check whether a memory range is inside a memory region.
- *
- * \param[in] p             The start address of the range to check
- * \param[in] s             The size of the range to check
- * \param[in] region_start  The start address of the region, which should
- *                          contain the range
- * \param[in] region_limit  The end address of the region, which should contain
- *                          the range
- *
- * \return TFM_SUCCESS if the region contains the range,
- *         TFM_ERROR_GENERIC otherwise.
- */
-enum tfm_status_e check_address_range(const void *p, size_t s,
-                                      uintptr_t region_start,
-                                      uintptr_t region_limit);
-
-void tfm_enable_irq(psa_signal_t irq_signal);
-void tfm_disable_irq(psa_signal_t irq_signal);
-
-#ifdef TFM_PSA_API
-/* The following macros are only valid if secure services can be called
- * using veneer functions. This is not the case if IPC messaging is enabled
- */
-#define TFM_CORE_IOVEC_SFN_REQUEST(id, fn, a, b, c, d)               \
-        do {                                                         \
-            ERROR_MSG("Invalid TF-M configuration detected");        \
-            tfm_secure_api_error_handler();                          \
-            /* This point never reached */                           \
-            return (int32_t)TFM_ERROR_GENERIC;                       \
-        } while (0)
-#else
 #define TFM_CORE_IOVEC_SFN_REQUEST(id, is_ns, fn, a, b, c, d)        \
         return tfm_core_partition_request(id, is_ns, fn,             \
                 (int32_t)a, (int32_t)b, (int32_t)c, (int32_t)d)