blob: b40b7c01c632b9ea9a07d3402433fc10ecfc2837 [file] [log] [blame]
Ashutosh Singhf4d88672017-11-29 13:35:43 +00001/*
Jamie Fox5592db02017-12-18 16:48:29 +00002 * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
Ashutosh Singhf4d88672017-11-29 13:35:43 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#include <stdio.h>
9#include <cmsis_compiler.h>
10
11#ifndef __TFM_NS_SVC_H__
12#define __TFM_NS_SVC_H__
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/**
Antonio de Angelisd9cd66e2018-03-27 11:19:59 +010019 * \brief Include all the SVC handler headers
20 */
21#include "tfm_sst_svc_handler.h"
22#include "svc_core_test_ns.h"
23#include "sst_test_service_svc.h"
24
25/**
Ashutosh Singhf4d88672017-11-29 13:35:43 +000026 * \brief Macro to encode an svc instruction
27 *
28 */
29#define SVC(code) __ASM("svc %0" : : "I" (code))
30
31/**
Antonio de Angelisd9cd66e2018-03-27 11:19:59 +010032 * \def LIST_SVC_DISPATCHERS
33 *
34 * \brief This is an X macro which lists
35 * the SVC interface exposed by the
36 * available secure services. The
37 * enumerator and corresponding
38 * SVC handler function need to be
39 * registered.
40 *
41 */
42#define LIST_SVC_DISPATCHERS \
43 X(SVC_TFM_SST_GET_HANDLE, tfm_sst_svc_get_handle) \
44 X(SVC_TFM_SST_CREATE, tfm_sst_svc_create) \
45 X(SVC_TFM_SST_GET_ATTRIBUTES, tfm_sst_svc_get_attributes) \
46 X(SVC_TFM_SST_READ, tfm_sst_svc_read) \
47 X(SVC_TFM_SST_WRITE, tfm_sst_svc_write) \
Antonio de Angelisf1c08512018-02-05 14:55:09 +000048 X(SVC_TFM_SST_DELETE, tfm_sst_svc_delete) \
49 X(SVC_TFM_LOG_RETRIEVE, NULL)
Antonio de Angelisd9cd66e2018-03-27 11:19:59 +010050
51/**
52 * \def LIST_SVC_CORE_TEST_INTERACTIVE
53 *
54 * \brief This is an X macro which lists
55 * the SVC interface available for
56 * the CORE_TEST_INTERACTIVE. The
57 * enumerator and corresponding
58 * SVC handler function need to be
59 * registered.
60 *
61 */
62#define LIST_SVC_CORE_TEST_INTERACTIVE \
63 X(SVC_SECURE_DECREMENT_NS_LOCK_1, svc_secure_decrement_ns_lock_1) \
64 X(SVC_SECURE_DECREMENT_NS_LOCK_2, svc_secure_decrement_ns_lock_2)
65
66/**
67 * \def LIST_SVC_TFM_PARTITION_TEST_CORE
68 *
69 * \brief This is an X macro which lists
70 * the SVC interface available for
71 * the TEST_CORE partition. The
72 * enumerator and corresponding
73 * SVC handler function need to be
74 * registered.
75 *
76 */
77#define LIST_SVC_TFM_PARTITION_TEST_CORE \
78 X(SVC_TFM_CORE_TEST, svc_tfm_core_test) \
79 X(SVC_TFM_CORE_TEST_MULTIPLE_CALLS, svc_tfm_core_test_multiple_calls)
80
81/**
82 * \def LIST_SVC_TFM_PARTITION_TEST_SST
83 *
84 * \brief This is an X macro which lists
85 * the SVC interface available for
86 * TEST_SST partition. The
87 * enumerator and corresponding
88 * SVC handler function need to be
89 * registered.
90 *
91 */
92#define LIST_SVC_TFM_PARTITION_TEST_SST \
93 X(SVC_SST_TEST_SERVICE_SETUP, sst_test_service_svc_setup) \
94 X(SVC_SST_TEST_SERVICE_DUMMY_ENCRYPT, sst_test_service_svc_dummy_encrypt) \
95 X(SVC_SST_TEST_SERVICE_DUMMY_DECRYPT, sst_test_service_svc_dummy_decrypt) \
96 X(SVC_SST_TEST_SERVICE_CLEAN, sst_test_service_svc_clean)
97
98/**
Ashutosh Singhf4d88672017-11-29 13:35:43 +000099 * \brief Numbers associated to each SVC available
100 *
101 * \details Start from 1 as 0 is reserved by RTX
102 */
103enum tfm_svc_num {
104 SVC_INVALID = 0,
105
Antonio de Angelisd9cd66e2018-03-27 11:19:59 +0100106#define X(SVC_ENUM, SVC_HANDLER) SVC_ENUM,
107 /* SVC API for Services */
108 LIST_SVC_DISPATCHERS
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000109
110#if defined(CORE_TEST_INTERACTIVE)
Antonio de Angelisd9cd66e2018-03-27 11:19:59 +0100111 LIST_SVC_CORE_TEST_INTERACTIVE
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000112#endif /* CORE_TEST_INTERACTIVE */
113
Mate Toth-Pal349714a2018-02-23 15:30:24 +0100114#if defined(TFM_PARTITION_TEST_CORE)
Antonio de Angelisd9cd66e2018-03-27 11:19:59 +0100115 LIST_SVC_TFM_PARTITION_TEST_CORE
Mate Toth-Pal349714a2018-02-23 15:30:24 +0100116#endif /* TFM_PARTITION_TEST_CORE */
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000117
Mate Toth-Pal349714a2018-02-23 15:30:24 +0100118#if defined(TFM_PARTITION_TEST_SST)
Antonio de Angelisd9cd66e2018-03-27 11:19:59 +0100119 LIST_SVC_TFM_PARTITION_TEST_SST
Mate Toth-Pal349714a2018-02-23 15:30:24 +0100120#endif /* TFM_PARTITION_TEST_SST */
Jamie Fox5592db02017-12-18 16:48:29 +0000121
Antonio de Angelisd9cd66e2018-03-27 11:19:59 +0100122#undef X
123
Ashutosh Singhf4d88672017-11-29 13:35:43 +0000124 /* add all the new entries above this line */
125 SVC_TFM_MAX,
126};
127
128/* number of user SVC functions */
129#define USER_SVC_COUNT (SVC_TFM_MAX - 1)
130
131#ifdef __cplusplus
132}
133#endif
134
135#endif /* __TFM_NS_SVC_H__ */