App, Test: Updates for thread mode NS-S transition
- Remove the SVC call framework from the non-secure
- Update the S and NS tests to work with the new concept
- Update documentation to reflect changes
Change-Id: Iac4e1b7d11f264f1905e71a81a1d622421ea5d6d
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/interface/include/tfm_log_svc_handler.h b/interface/include/tfm_log_svc_handler.h
deleted file mode 100644
index 5c90c25..0000000
--- a/interface/include/tfm_log_svc_handler.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __TFM_LOG_SVC_HANDLER_H__
-#define __TFM_LOG_SVC_HANDLER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "tfm_log_defs.h"
-
-/**
- * \brief Retrieves the audit log (SVC function)
- *
- * \details The function reads the audit log into the buffer provided.
- * If provided buffer size is too small to fit the full log,
- * the function will read the maximum number of items in the
- * log that fit the available space in the buffer
- *
- * \param[in] size Maximum number of bytes to retrieve from the log
- * \param[in] start Index of element from where to start retrieval
- * \param[out] buffer Pointer to the buffer that will hold the log
- * \param[out] info Pointer to the \ref tfm_log_info structure
- * contained information related to the retrieved
- * portion of the log (size and number of items)
- *
- * \return Returns TFM_LOG_ERR_SUCCESS if retrieval has been completed,
- * otherwise error as specified in \ref tfm_log_err
- *
- * \note If start is equal to TFM_ALG_READ_RECENT, the function will
- * retrieve the most recent elements that fit the provided size
- */
-enum tfm_log_err tfm_log_svc_retrieve(uint32_t size,
- int32_t start,
- uint8_t *buffer,
- struct tfm_log_info *info);
-
-/**
- * \brief Gets the log information (SVC function)
- *
- * \param[out] info Pointer to the \ref tfm_log_info structure that
- * holds the current log size (both in bytes and items)
- *
- * \return Returns TFM_LOG_ERR_SUCCESS if reading has been completed,
- * otherwise error as specified in \ref tfm_log_err
- */
-enum tfm_log_err tfm_log_svc_get_info(struct tfm_log_info *info);
-
-/**
- * \brief Deletes one or more elements from the head of the log (SVC function)
- *
- * \param[in] num_items Number of elements to be deleted
- * \param[out] rem_items Pointer to the number of elements removed. This
- * value indicates the number of elements actually
- * removed from the log. In case the number of items
- * stored is less than the number of items requested
- * to remove, this value will reflect the number of
- * items effectively removed.
- *
- * \return Returns TFM_LOG_ERR_SUCCESS if removal has been completed,
- * otherwise error as specified in \ref tfm_log_err
- */
-enum tfm_log_err tfm_log_svc_delete_items(uint32_t num_items,
- uint32_t *rem_items);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_LOG_SVC_HANDLER_H__ */
diff --git a/interface/include/tfm_ns_lock.h b/interface/include/tfm_ns_lock.h
index 7361aac..0c73a60 100644
--- a/interface/include/tfm_ns_lock.h
+++ b/interface/include/tfm_ns_lock.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,18 +12,19 @@
#endif
#include <stdint.h>
-#include "tfm_ns_svc.h"
+
+typedef int32_t (*veneer_fn) (uint32_t arg0, uint32_t arg1,
+ uint32_t arg2, uint32_t arg3);
/**
* \brief NS world, NS lock based dispatcher
*
- * \details To be called from the SVC wrapper API interface
+ * \details To be called from the wrapper API interface
*/
-uint32_t tfm_ns_lock_svc_dispatch(enum tfm_svc_num svc_num,
- uint32_t arg0,
- uint32_t arg1,
- uint32_t arg2,
- uint32_t arg3);
+
+uint32_t tfm_ns_lock_dispatch(veneer_fn fn,
+ uint32_t arg0, uint32_t arg1,
+ uint32_t arg2, uint32_t arg3);
/**
* \brief NS world, Init NS lock
diff --git a/interface/include/tfm_ns_svc.h b/interface/include/tfm_ns_svc.h
deleted file mode 100644
index a88df66..0000000
--- a/interface/include/tfm_ns_svc.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#include <stdio.h>
-#include <cmsis_compiler.h>
-
-#ifndef __TFM_NS_SVC_H__
-#define __TFM_NS_SVC_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * \brief Include all the SVC handler headers
- */
-#include "tfm_sst_svc_handler.h"
-#include "tfm_log_svc_handler.h"
-#include "svc_core_test_ns.h"
-#include "sst_test_service_svc.h"
-
-/**
- * \brief Macro to encode an svc instruction
- *
- */
-#define SVC(code) __ASM("svc %0" : : "I" (code))
-
-/**
- * \def LIST_SVC_DISPATCHERS
- *
- * \brief This is an X macro which lists
- * the SVC interface exposed by the
- * available secure services. The
- * enumerator and corresponding
- * SVC handler function need to be
- * registered.
- *
- */
-#define LIST_SVC_DISPATCHERS \
- X(SVC_TFM_SST_CREATE, tfm_sst_svc_create) \
- X(SVC_TFM_SST_GET_INFO, tfm_sst_svc_get_info) \
- X(SVC_TFM_SST_GET_ATTRIBUTES, tfm_sst_svc_get_attributes) \
- X(SVC_TFM_SST_SET_ATTRIBUTES, tfm_sst_svc_set_attributes) \
- X(SVC_TFM_SST_READ, tfm_sst_svc_read) \
- X(SVC_TFM_SST_WRITE, tfm_sst_svc_write) \
- X(SVC_TFM_SST_DELETE, tfm_sst_svc_delete) \
- X(SVC_TFM_LOG_RETRIEVE, tfm_log_svc_retrieve) \
- X(SVC_TFM_LOG_GET_INFO, tfm_log_svc_get_info) \
- X(SVC_TFM_LOG_DELETE_ITEMS, tfm_log_svc_delete_items)
-
-/**
- * \def LIST_SVC_CORE_TEST_INTERACTIVE
- *
- * \brief This is an X macro which lists
- * the SVC interface available for
- * the CORE_TEST_INTERACTIVE. The
- * enumerator and corresponding
- * SVC handler function need to be
- * registered.
- *
- */
-#define LIST_SVC_CORE_TEST_INTERACTIVE \
- X(SVC_SECURE_DECREMENT_NS_LOCK_1, svc_secure_decrement_ns_lock_1) \
- X(SVC_SECURE_DECREMENT_NS_LOCK_2, svc_secure_decrement_ns_lock_2)
-
-/**
- * \def LIST_SVC_TFM_PARTITION_TEST_CORE
- *
- * \brief This is an X macro which lists
- * the SVC interface available for
- * the TEST_CORE partition. The
- * enumerator and corresponding
- * SVC handler function need to be
- * registered.
- *
- */
-#define LIST_SVC_TFM_PARTITION_TEST_CORE \
- X(SVC_TFM_CORE_TEST, svc_tfm_core_test) \
- X(SVC_TFM_CORE_TEST_MULTIPLE_CALLS, svc_tfm_core_test_multiple_calls)
-
-/**
- * \def LIST_SVC_TFM_PARTITION_TEST_SST
- *
- * \brief This is an X macro which lists
- * the SVC interface available for
- * TEST_SST partition. The
- * enumerator and corresponding
- * SVC handler function need to be
- * registered.
- *
- */
-#define LIST_SVC_TFM_PARTITION_TEST_SST \
- X(SVC_SST_TEST_SERVICE_SETUP, sst_test_service_svc_setup) \
- X(SVC_SST_TEST_SERVICE_DUMMY_ENCRYPT, sst_test_service_svc_dummy_encrypt) \
- X(SVC_SST_TEST_SERVICE_DUMMY_DECRYPT, sst_test_service_svc_dummy_decrypt) \
- X(SVC_SST_TEST_SERVICE_CLEAN, sst_test_service_svc_clean)
-
-/**
- * \def LIST_SVC_TFM_PARTITION_TEST_SECURE_SERVICES
- *
- * \brief This is an X macro which lists
- * the SVC interface available for
- * TEST_SECURE_SERVICES partition.
- * The enumerator and corresponding
- * SVC handler function need to be
- * registered.
- *
- */
-#define LIST_SVC_TFM_PARTITION_TEST_SECURE_SERVICES \
- X(SVC_TFM_SECURE_CLIENT_RUN_TESTS, tfm_secure_client_service_svc_run_tests)
-
-/**
- * \brief Numbers associated to each SVC available
- *
- * \details Start from 1 as 0 is reserved by RTX
- */
-enum tfm_svc_num {
- SVC_INVALID = 0,
-
-#define X(SVC_ENUM, SVC_HANDLER) SVC_ENUM,
- /* SVC API for Services */
- LIST_SVC_DISPATCHERS
-
-#if defined(CORE_TEST_INTERACTIVE)
- LIST_SVC_CORE_TEST_INTERACTIVE
-#endif /* CORE_TEST_INTERACTIVE */
-
-#if defined(TFM_PARTITION_TEST_CORE)
- LIST_SVC_TFM_PARTITION_TEST_CORE
-#endif /* TFM_PARTITION_TEST_CORE */
-
-#if defined(TFM_PARTITION_TEST_SST)
- LIST_SVC_TFM_PARTITION_TEST_SST
-#endif /* TFM_PARTITION_TEST_SST */
-
-#if defined(TFM_PARTITION_TEST_SECURE_SERVICES)
- LIST_SVC_TFM_PARTITION_TEST_SECURE_SERVICES
-#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
-
-#undef X
-
- /* add all the new entries above this line */
- SVC_TFM_MAX,
-};
-
-/* number of user SVC functions */
-#define USER_SVC_COUNT (SVC_TFM_MAX - 1)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_NS_SVC_H__ */
diff --git a/interface/include/tfm_sst_svc_handler.h b/interface/include/tfm_sst_svc_handler.h
deleted file mode 100644
index 57e2734..0000000
--- a/interface/include/tfm_sst_svc_handler.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- *
- */
-
-#ifndef __TFM_SST_SVC_HANDLER_H__
-#define __TFM_SST_SVC_HANDLER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "tfm_sst_defs.h"
-
-/**
- * \brief SVC funtion to allocate space for the asset, referenced by asset
- * UUID, without setting any data in the asset.
- *
- * \param[in] asset_uuid Asset UUID \ref tfm_sst_asset_id_t
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- *
- * \return Returns an PSA_SST_ERR_SUCCESS if asset is created correctly.
- * Otherwise, error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_create(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token);
-
-/**
- * \brief SVC funtion to get asset's information referenced by asset UUID.
- *
- * \param[in] asset_uuid Asset UUID
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- * \param[out] info Pointer to store the asset's information
- * \ref psa_sst_asset_info_t
- *
- * \return Returns error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_get_info(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- struct psa_sst_asset_info_t *info);
-/**
- * \brief SVC funtion to get asset's attributes referenced by asset UUID.
- *
- * \param[in] asset_uuid Asset UUID
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- * \param[out] attrs Pointer to store the asset's attributes
- * \ref psa_sst_asset_attrs_t
- *
- * \return Returns error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_get_attributes(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- struct psa_sst_asset_attrs_t *attrs);
-
-/**
- * \brief SVC funtion to set asset's attributes referenced by asset UUID.
- *
- * \param[in] asset_uuid Asset UUID
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- * \param[in] attrs Pointer to new the asset's attributes
- * \ref psa_sst_asset_attrs_t
- *
- * \return Returns error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_set_attributes(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- const struct psa_sst_asset_attrs_t *attrs);
-
-/**
- * \brief SVC funtion to read asset's data from asset referenced by asset UUID.
- *
- * \param[in] asset_uuid Asset UUID
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- * \param[out] data Pointer to data vector \ref tfm_sst_buf_t to store
- * data, size and offset
- *
- * \return Returns error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_read(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- struct tfm_sst_buf_t* data);
-
-/**
- * \brief SVC funtion to write data into an asset referenced by asset UUID.
- *
- * \param[in] asset_uuid Asset UUID
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- * \param[in] data Pointer to data vector \ref tfm_sst_buf_t which
- * contains the data to write
- *
- * \return Returns error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_write(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token,
- struct tfm_sst_buf_t* data);
-
-/**
- * \brief SVC funtion to delete the asset referenced by the asset UUID.
- *
- * \param[in] asset_uuid Asset UUID
- * \param[in] s_token Pointer to the asset's token \ref tfm_sst_token_t
- *
- * \return Returns error code as specified in \ref psa_sst_err_t
- */
-enum psa_sst_err_t tfm_sst_svc_delete(uint32_t asset_uuid,
- const struct tfm_sst_token_t *s_token);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TFM_SST_SVC_HANDLER_H__ */