Skip to content
This repository was archived by the owner on Apr 16, 2021. It is now read-only.

Commit f420ac2

Browse files
committed
Update mbed to mbed-os-5.4.0-rc1-15235-g08d17d0128
1 parent d803a96 commit f420ac2

File tree

48 files changed

+823
-157
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+823
-157
lines changed

cores/arduino/mbed/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_spm_hal.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Arm Limited. All rights reserved.
2+
* Copyright (c) 2018-2019, Arm Limited. All rights reserved.
33
*
44
* SPDX-License-Identifier: BSD-3-Clause
55
*
@@ -28,7 +28,7 @@
2828
*/
2929
struct tfm_spm_partition_platform_data_t;
3030

31-
#if TFM_LVL != 1
31+
#if defined (TFM_PSA_API) || (TFM_LVL != 1)
3232
/**
3333
* \brief Holds SPM db fields that define the memory regions used by a
3434
* partition.
@@ -147,7 +147,7 @@ uint32_t tfm_spm_hal_get_ns_MSP(void);
147147
uint32_t tfm_spm_hal_get_ns_entry_point(void);
148148

149149

150-
#if TFM_LVL != 1
150+
#if (TFM_LVL != 1) && !defined(TFM_PSA_API)
151151
/**
152152
* \brief Configure the sandbox for a partition.
153153
*

cores/arduino/mbed/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/include/tfm_spm.h

+38-12
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ struct tfm_spm_ipc_partition_t {
7575
*/
7676
uint32_t tfm_spm_partition_get_running_partition_id_ext(void);
7777

78+
/**
79+
* \brief Get the current partition mode.
80+
*
81+
* \param[in] partition_idx Index of current partition
82+
*
83+
* \retval TFM_PARTITION_PRIVILEGED_MODE Privileged mode
84+
* \retval TFM_PARTITION_UNPRIVILEGED_MODE Unprivileged mode
85+
*/
86+
uint32_t tfm_spm_partition_get_privileged_mode(uint32_t partition_idx);
87+
7888
/******************** Service handle management functions ********************/
7989

8090
/**
@@ -279,22 +289,38 @@ int32_t tfm_spm_check_client_version(struct tfm_spm_service_t *service,
279289
uint32_t minor_version);
280290

281291
/**
282-
* \brief Check the memory reference is valid.
283-
*
284-
* \param[in] buffer Pointer of memory reference
285-
* \param[in] len Length of memory reference in bytes
286-
* \param[in] ns_caller From non-secure caller
287-
* \param[in] access Type of access specified by the
288-
* \ref tfm_memory_access_e
289-
*
290-
* \retval IPC_SUCCESS Success
291-
* \retval IPC_ERROR_BAD_PARAMETERS Bad parameters input
292-
* \retval IPC_ERROR_MEMORY_CHECK Check failed
292+
* \brief Check the memory reference is valid.
293+
*
294+
* \param[in] buffer Pointer of memory reference
295+
* \param[in] len Length of memory reference in bytes
296+
* \param[in] ns_caller From non-secure caller
297+
* \param[in] access Type of access specified by the
298+
* \ref tfm_memory_access_e
299+
* \param[in] privileged Privileged mode or unprivileged mode:
300+
* \ref TFM_PARTITION_UNPRIVILEGED_MODE
301+
* \ref TFM_PARTITION_PRIVILEGED_MODE
302+
*
303+
* \retval IPC_SUCCESS Success
304+
* \retval IPC_ERROR_BAD_PARAMETERS Bad parameters input
305+
* \retval IPC_ERROR_MEMORY_CHECK Check failed
293306
*/
294307
int32_t tfm_memory_check(void *buffer, size_t len, int32_t ns_caller,
295-
enum tfm_memory_access_e access);
308+
enum tfm_memory_access_e access,
309+
uint32_t privileged);
296310

297311
/* This function should be called before schedule function */
298312
void tfm_spm_init(void);
299313

314+
/*
315+
* PendSV specified function.
316+
*
317+
* Parameters :
318+
* ctxb - State context storage pointer
319+
*
320+
* Notes:
321+
* This is a staging API. Scheduler should be called in SPM finally and
322+
* this function will be obsoleted later.
323+
*/
324+
void tfm_pendsv_do_schedule(struct tfm_state_context_ext *ctxb);
325+
300326
#endif

cores/arduino/mbed/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/include/tfm_thread.h

+18-9
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,19 @@ struct tfm_thrd_ctx *tfm_thrd_curr_thread(void);
177177
*/
178178
struct tfm_thrd_ctx *tfm_thrd_next_thread(void);
179179

180+
/*
181+
* Start scheduler for existing threads
182+
*
183+
* Parameters:
184+
* pth - pointer of the caller context collecting thread
185+
*
186+
* Notes :
187+
* This function should be called only ONCE to start the scheduler.
188+
* Caller needs to provide a thread object to collect current context.
189+
* The usage of the collected context is caller defined.
190+
*/
191+
void tfm_thrd_start_scheduler(struct tfm_thrd_ctx *pth);
192+
180193
/*
181194
* Activate a scheduling action after exception.
182195
*
@@ -201,23 +214,19 @@ void tfm_thrd_context_switch(struct tfm_state_context_ext *ctxb,
201214
struct tfm_thrd_ctx *next);
202215

203216
/*
204-
* Exit current running thread.
217+
* Svcall to exit current running thread.
205218
*
206219
* Notes :
207220
* Remove current thread out of schedulable list.
208221
*/
209-
void tfm_thrd_do_exit(void);
222+
void tfm_svcall_thrd_exit(void);
210223

211224
/*
212-
* PendSV specified function.
213-
*
214-
* Parameters :
215-
* ctxb - State context storage pointer
225+
* Exit current running thread for client.
216226
*
217227
* Notes:
218-
* This is a staging API. Scheduler should be called in SPM finally and
219-
* this function will be obsoleted later.
228+
* Must be called in thread mode.
220229
*/
221-
void tfm_pendsv_do_schedule(struct tfm_state_context_ext *ctxb);
230+
void tfm_thrd_exit(void);
222231

223232
#endif

cores/arduino/mbed/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/tfm_nspm.h

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Arm Limited. All rights reserved.
2+
* Copyright (c) 2018-2019, Arm Limited. All rights reserved.
33
*
44
* SPDX-License-Identifier: BSD-3-Clause
55
*
@@ -23,4 +23,15 @@ void tfm_nspm_configure_clients(void);
2323
*/
2424
int32_t tfm_nspm_get_current_client_id(void);
2525

26+
#ifdef TFM_PSA_API
27+
/**
28+
* \brief NSPM thread main entry function
29+
*
30+
* \return PSA_SUCCESS indicates failed.
31+
*
32+
* Note: This function should not return back.
33+
*/
34+
psa_status_t tfm_nspm_thread_entry(void);
35+
#endif
36+
2637
#endif /* __TFM_NSPM_H__ */

cores/arduino/mbed/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/tfm_secure_api.h

+41-11
Original file line numberDiff line numberDiff line change
@@ -96,30 +96,59 @@ int32_t tfm_core_sfn_request_thread_mode(struct tfm_sfn_req_s *desc_ptr);
9696
* This function assumes, that the current MPU configuration is set for the
9797
* partition to be checked.
9898
*
99-
* \param[in] p The start address of the range to check
100-
* \param[in] s The size of the range to check
101-
* \param[in] ns_caller Whether the current partition is a non-secure one
99+
* \param[in] p The start address of the range to check
100+
* \param[in] s The size of the range to check
101+
* \param[in] ns_caller Whether the current partition is a non-secure one
102+
* \param[in] privileged Privileged mode or unprivileged mode:
103+
* \ref TFM_PARTITION_UNPRIVILEGED_MODE
104+
* \ref TFM_PARTITION_PRIVILEGED_MODE
102105
*
103-
* \return 1 if the partition has access to the memory range, 0 otherwise.
106+
* \return TFM_SUCCESS if the partition has access to the memory range,
107+
* TFM_ERROR_GENERIC otherwise.
104108
*/
105109
int32_t tfm_core_has_read_access_to_region(const void *p, size_t s,
106-
uint32_t ns_caller);
110+
uint32_t ns_caller,
111+
uint32_t privileged);
107112

108113
/**
109114
* \brief Check whether the current partition has write access to a memory range
110115
*
111116
* This function assumes, that the current MPU configuration is set for the
112117
* partition to be checked.
113118
*
114-
* \param[in] p The start address of the range to check
115-
* \param[in] s The size of the range to check
116-
* \param[in] ns_caller Whether the current partition is a non-secure one
119+
* \param[in] p The start address of the range to check
120+
* \param[in] s The size of the range to check
121+
* \param[in] ns_caller Whether the current partition is a non-secure one
122+
* \param[in] privileged Privileged mode or unprivileged mode:
123+
* \ref TFM_PARTITION_UNPRIVILEGED_MODE
124+
* \ref TFM_PARTITION_PRIVILEGED_MODE
117125
*
118-
* \return 1 if the partition has access to the memory range, 0 otherwise.
126+
* \return TFM_SUCCESS if the partition has access to the memory range,
127+
* TFM_ERROR_GENERIC otherwise.
119128
*/
120129
int32_t tfm_core_has_write_access_to_region(void *p, size_t s,
121-
uint32_t ns_caller);
130+
uint32_t ns_caller,
131+
uint32_t privileged);
122132

133+
#ifdef TFM_PSA_API
134+
/* The following macros are only valid if secure services can be called
135+
* using veneer functions. This is not the case if IPC messaging is enabled
136+
*/
137+
#define TFM_CORE_IOVEC_SFN_REQUEST(id, fn, a, b, c, d) \
138+
do { \
139+
ERROR_MSG("Invalid TF-M configuration detected"); \
140+
tfm_secure_api_error_handler(); \
141+
/* This point never reached */ \
142+
return (int32_t)TFM_ERROR_GENERIC; \
143+
} while (0)
144+
#define TFM_CORE_SFN_REQUEST(id, fn, a, b, c, d) \
145+
do { \
146+
ERROR_MSG("Invalid TF-M configuration detected"); \
147+
tfm_secure_api_error_handler(); \
148+
/* This point never reached */ \
149+
return (int32_t)TFM_ERROR_GENERIC; \
150+
} while (0)
151+
#else
123152
#define TFM_CORE_IOVEC_SFN_REQUEST(id, fn, a, b, c, d) \
124153
return tfm_core_partition_request(id, fn, TFM_SFN_API_IOVEC, \
125154
(int32_t)a, (int32_t)b, (int32_t)c, (int32_t)d)
@@ -136,7 +165,7 @@ int32_t tfm_core_partition_request(uint32_t id, void *fn, int32_t iovec_api,
136165
struct tfm_sfn_req_s desc, *desc_ptr = &desc;
137166

138167
desc.sp_id = id;
139-
desc.sfn = fn;
168+
desc.sfn = (sfn_t) fn;
140169
desc.args = args;
141170
/*
142171
* This preprocessor condition checks if a version of GCC smaller than
@@ -180,5 +209,6 @@ int32_t tfm_core_partition_request(uint32_t id, void *fn, int32_t iovec_api,
180209

181210
}
182211
}
212+
#endif
183213

184214
#endif /* __TFM_SECURE_API_H__ */

cores/arduino/mbed/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/tfm_svc.h

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ typedef enum {
2323
#ifdef TFM_PSA_API
2424
TFM_SVC_IPC_REQUEST,
2525
TFM_SVC_SCHEDULE,
26+
TFM_SVC_EXIT_THRD,
2627
/* PSA Client SVC */
2728
TFM_SVC_PSA_FRAMEWORK_VERSION,
2829
TFM_SVC_PSA_VERSION,

0 commit comments

Comments
 (0)