blob: 7a9947663f7648412a1e762cdf556bc56d77c369 [file] [log] [blame]
Shawn Shan071d86d2020-05-25 17:32:58 +08001/*
2 * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8/*********** WARNING: This is an auto-generated file. Do not edit! ***********/
9
10#ifndef __TFM_SPM_DB_FUNC_INC__
11#define __TFM_SPM_DB_FUNC_INC__
12
13#include "spm_api.h"
14#include "psa_manifest/sid.h"
15
16/**************************************************************************/
17/** IRQ count per partition */
18/**************************************************************************/
19#ifdef TFM_PARTITION_SECURE_STORAGE
20#define TFM_PARTITION_TFM_SP_STORAGE_IRQ_COUNT 0
21#endif /* TFM_PARTITION_SECURE_STORAGE */
22
23#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
24#define TFM_PARTITION_TFM_SP_ITS_IRQ_COUNT 0
25#endif /* TFM_PARTITION_INTERNAL_TRUSTED_STORAGE */
26
27#ifdef TFM_PARTITION_AUDIT_LOG
28#define TFM_PARTITION_TFM_SP_AUDIT_LOG_IRQ_COUNT 0
29#endif /* TFM_PARTITION_AUDIT_LOG */
30
31#ifdef TFM_PARTITION_CRYPTO
32#define TFM_PARTITION_TFM_SP_CRYPTO_IRQ_COUNT 0
33#endif /* TFM_PARTITION_CRYPTO */
34
35#ifdef TFM_PARTITION_PLATFORM
36#define TFM_PARTITION_TFM_SP_PLATFORM_IRQ_COUNT 0
37#endif /* TFM_PARTITION_PLATFORM */
38
39#ifdef TFM_PARTITION_INITIAL_ATTESTATION
40#define TFM_PARTITION_TFM_SP_INITIAL_ATTESTATION_IRQ_COUNT 0
41#endif /* TFM_PARTITION_INITIAL_ATTESTATION */
42
43#ifdef TFM_PARTITION_TEST_CORE
44#define TFM_PARTITION_TFM_SP_CORE_TEST_IRQ_COUNT 0
45#endif /* TFM_PARTITION_TEST_CORE */
46
47#ifdef TFM_PARTITION_TEST_CORE
48#define TFM_PARTITION_TFM_SP_CORE_TEST_2_IRQ_COUNT 0
49#endif /* TFM_PARTITION_TEST_CORE */
50
51#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
52#define TFM_PARTITION_TFM_SP_SECURE_TEST_PARTITION_IRQ_COUNT 0
53#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
54
55#ifdef TFM_PARTITION_TEST_CORE_IPC
56#define TFM_PARTITION_TFM_SP_IPC_SERVICE_TEST_IRQ_COUNT 0
57#endif /* TFM_PARTITION_TEST_CORE_IPC */
58
59#ifdef TFM_PARTITION_TEST_CORE_IPC
60#define TFM_PARTITION_TFM_SP_IPC_CLIENT_TEST_IRQ_COUNT 0
61#endif /* TFM_PARTITION_TEST_CORE_IPC */
62
63#ifdef TFM_ENABLE_IRQ_TEST
64#define TFM_PARTITION_TFM_IRQ_TEST_1_IRQ_COUNT 1
65#endif /* TFM_ENABLE_IRQ_TEST */
66
67#ifdef TFM_PARTITION_TEST_SST
68#define TFM_PARTITION_TFM_SP_SST_TEST_IRQ_COUNT 0
69#endif /* TFM_PARTITION_TEST_SST */
70
71#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
72#define TFM_PARTITION_TFM_SP_SECURE_CLIENT_2_IRQ_COUNT 0
73#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
74
75#ifdef TFM_MULTI_CORE_TEST
76#define TFM_PARTITION_TFM_SP_MULTI_CORE_TEST_IRQ_COUNT 0
77#endif /* TFM_MULTI_CORE_TEST */
78
79/**************************************************************************/
80/** Declarations of partition init functions */
81/**************************************************************************/
82#ifdef TFM_PARTITION_SECURE_STORAGE
83extern void tfm_sst_req_mngr_init(void);
84#endif /* TFM_PARTITION_SECURE_STORAGE */
85
86#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
87extern void tfm_its_req_mngr_init(void);
88#endif /* TFM_PARTITION_INTERNAL_TRUSTED_STORAGE */
89
90#ifdef TFM_PARTITION_AUDIT_LOG
91extern void audit_core_init(void);
92#endif /* TFM_PARTITION_AUDIT_LOG */
93
94#ifdef TFM_PARTITION_CRYPTO
95extern void tfm_crypto_init(void);
96#endif /* TFM_PARTITION_CRYPTO */
97
98#ifdef TFM_PARTITION_PLATFORM
99extern void platform_sp_init(void);
100#endif /* TFM_PARTITION_PLATFORM */
101
102#ifdef TFM_PARTITION_INITIAL_ATTESTATION
103extern void attest_partition_init(void);
104#endif /* TFM_PARTITION_INITIAL_ATTESTATION */
105
106#ifdef TFM_PARTITION_TEST_CORE
107extern void core_test_init(void);
108#endif /* TFM_PARTITION_TEST_CORE */
109
110#ifdef TFM_PARTITION_TEST_CORE
111extern void core_test_2_init(void);
112#endif /* TFM_PARTITION_TEST_CORE */
113
114#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
115extern void tfm_secure_client_service_init(void);
116#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
117
118#ifdef TFM_PARTITION_TEST_CORE_IPC
119extern void ipc_service_test_main(void);
120#endif /* TFM_PARTITION_TEST_CORE_IPC */
121
122#ifdef TFM_PARTITION_TEST_CORE_IPC
123extern void ipc_client_test_main(void);
124#endif /* TFM_PARTITION_TEST_CORE_IPC */
125
126#ifdef TFM_ENABLE_IRQ_TEST
127extern void tfm_irq_test_1_init(void);
128#endif /* TFM_ENABLE_IRQ_TEST */
129
130#ifdef TFM_PARTITION_TEST_SST
131extern void tfm_sst_test_init(void);
132#endif /* TFM_PARTITION_TEST_SST */
133
134#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
135extern void tfm_secure_client_2_init(void);
136#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
137
138#ifdef TFM_MULTI_CORE_TEST
139extern void multi_core_test_main(void);
140#endif /* TFM_MULTI_CORE_TEST */
141
142/**************************************************************************/
143/** Context stacks for IRQ handling */
144/**************************************************************************/
145/* The max size of the context stack can be calculated as a function of the IRQ
146 * count of the secure partition:
147 *
148 * max_stack_size = intr_ctx_size + (IRQ_CNT * (intr_ctx_size + hndl_ctx_size))
149 *
150 * where:
151 * intr_ctx: Frame pushed when the partition is interrupted
152 * hndl_ctx: Frame pushed when the partition is handling an interrupt
153 */
154static uint32_t ns_interrupt_ctx_stack[
155 sizeof(struct interrupted_ctx_stack_frame_t) / sizeof(uint32_t)];
156
157static uint32_t tfm_core_interrupt_ctx_stack[
158 sizeof(struct interrupted_ctx_stack_frame_t) / sizeof(uint32_t)];
159
160#ifdef TFM_PARTITION_SECURE_STORAGE
161static uint32_t ctx_stack_TFM_SP_STORAGE[
162 (sizeof(struct interrupted_ctx_stack_frame_t) +
163 (TFM_PARTITION_TFM_SP_STORAGE_IRQ_COUNT) * (
164 sizeof(struct interrupted_ctx_stack_frame_t) +
165 sizeof(struct handler_ctx_stack_frame_t)
166 )) / sizeof(uint32_t)];
167#endif /* TFM_PARTITION_SECURE_STORAGE */
168
169#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
170static uint32_t ctx_stack_TFM_SP_ITS[
171 (sizeof(struct interrupted_ctx_stack_frame_t) +
172 (TFM_PARTITION_TFM_SP_ITS_IRQ_COUNT) * (
173 sizeof(struct interrupted_ctx_stack_frame_t) +
174 sizeof(struct handler_ctx_stack_frame_t)
175 )) / sizeof(uint32_t)];
176#endif /* TFM_PARTITION_INTERNAL_TRUSTED_STORAGE */
177
178#ifdef TFM_PARTITION_AUDIT_LOG
179static uint32_t ctx_stack_TFM_SP_AUDIT_LOG[
180 (sizeof(struct interrupted_ctx_stack_frame_t) +
181 (TFM_PARTITION_TFM_SP_AUDIT_LOG_IRQ_COUNT) * (
182 sizeof(struct interrupted_ctx_stack_frame_t) +
183 sizeof(struct handler_ctx_stack_frame_t)
184 )) / sizeof(uint32_t)];
185#endif /* TFM_PARTITION_AUDIT_LOG */
186
187#ifdef TFM_PARTITION_CRYPTO
188static uint32_t ctx_stack_TFM_SP_CRYPTO[
189 (sizeof(struct interrupted_ctx_stack_frame_t) +
190 (TFM_PARTITION_TFM_SP_CRYPTO_IRQ_COUNT) * (
191 sizeof(struct interrupted_ctx_stack_frame_t) +
192 sizeof(struct handler_ctx_stack_frame_t)
193 )) / sizeof(uint32_t)];
194#endif /* TFM_PARTITION_CRYPTO */
195
196#ifdef TFM_PARTITION_PLATFORM
197static uint32_t ctx_stack_TFM_SP_PLATFORM[
198 (sizeof(struct interrupted_ctx_stack_frame_t) +
199 (TFM_PARTITION_TFM_SP_PLATFORM_IRQ_COUNT) * (
200 sizeof(struct interrupted_ctx_stack_frame_t) +
201 sizeof(struct handler_ctx_stack_frame_t)
202 )) / sizeof(uint32_t)];
203#endif /* TFM_PARTITION_PLATFORM */
204
205#ifdef TFM_PARTITION_INITIAL_ATTESTATION
206static uint32_t ctx_stack_TFM_SP_INITIAL_ATTESTATION[
207 (sizeof(struct interrupted_ctx_stack_frame_t) +
208 (TFM_PARTITION_TFM_SP_INITIAL_ATTESTATION_IRQ_COUNT) * (
209 sizeof(struct interrupted_ctx_stack_frame_t) +
210 sizeof(struct handler_ctx_stack_frame_t)
211 )) / sizeof(uint32_t)];
212#endif /* TFM_PARTITION_INITIAL_ATTESTATION */
213
214#ifdef TFM_PARTITION_TEST_CORE
215static uint32_t ctx_stack_TFM_SP_CORE_TEST[
216 (sizeof(struct interrupted_ctx_stack_frame_t) +
217 (TFM_PARTITION_TFM_SP_CORE_TEST_IRQ_COUNT) * (
218 sizeof(struct interrupted_ctx_stack_frame_t) +
219 sizeof(struct handler_ctx_stack_frame_t)
220 )) / sizeof(uint32_t)];
221#endif /* TFM_PARTITION_TEST_CORE */
222
223#ifdef TFM_PARTITION_TEST_CORE
224static uint32_t ctx_stack_TFM_SP_CORE_TEST_2[
225 (sizeof(struct interrupted_ctx_stack_frame_t) +
226 (TFM_PARTITION_TFM_SP_CORE_TEST_2_IRQ_COUNT) * (
227 sizeof(struct interrupted_ctx_stack_frame_t) +
228 sizeof(struct handler_ctx_stack_frame_t)
229 )) / sizeof(uint32_t)];
230#endif /* TFM_PARTITION_TEST_CORE */
231
232#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
233static uint32_t ctx_stack_TFM_SP_SECURE_TEST_PARTITION[
234 (sizeof(struct interrupted_ctx_stack_frame_t) +
235 (TFM_PARTITION_TFM_SP_SECURE_TEST_PARTITION_IRQ_COUNT) * (
236 sizeof(struct interrupted_ctx_stack_frame_t) +
237 sizeof(struct handler_ctx_stack_frame_t)
238 )) / sizeof(uint32_t)];
239#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
240
241#ifdef TFM_PARTITION_TEST_CORE_IPC
242static uint32_t ctx_stack_TFM_SP_IPC_SERVICE_TEST[
243 (sizeof(struct interrupted_ctx_stack_frame_t) +
244 (TFM_PARTITION_TFM_SP_IPC_SERVICE_TEST_IRQ_COUNT) * (
245 sizeof(struct interrupted_ctx_stack_frame_t) +
246 sizeof(struct handler_ctx_stack_frame_t)
247 )) / sizeof(uint32_t)];
248#endif /* TFM_PARTITION_TEST_CORE_IPC */
249
250#ifdef TFM_PARTITION_TEST_CORE_IPC
251static uint32_t ctx_stack_TFM_SP_IPC_CLIENT_TEST[
252 (sizeof(struct interrupted_ctx_stack_frame_t) +
253 (TFM_PARTITION_TFM_SP_IPC_CLIENT_TEST_IRQ_COUNT) * (
254 sizeof(struct interrupted_ctx_stack_frame_t) +
255 sizeof(struct handler_ctx_stack_frame_t)
256 )) / sizeof(uint32_t)];
257#endif /* TFM_PARTITION_TEST_CORE_IPC */
258
259#ifdef TFM_ENABLE_IRQ_TEST
260static uint32_t ctx_stack_TFM_IRQ_TEST_1[
261 (sizeof(struct interrupted_ctx_stack_frame_t) +
262 (TFM_PARTITION_TFM_IRQ_TEST_1_IRQ_COUNT) * (
263 sizeof(struct interrupted_ctx_stack_frame_t) +
264 sizeof(struct handler_ctx_stack_frame_t)
265 )) / sizeof(uint32_t)];
266#endif /* TFM_ENABLE_IRQ_TEST */
267
268#ifdef TFM_PARTITION_TEST_SST
269static uint32_t ctx_stack_TFM_SP_SST_TEST[
270 (sizeof(struct interrupted_ctx_stack_frame_t) +
271 (TFM_PARTITION_TFM_SP_SST_TEST_IRQ_COUNT) * (
272 sizeof(struct interrupted_ctx_stack_frame_t) +
273 sizeof(struct handler_ctx_stack_frame_t)
274 )) / sizeof(uint32_t)];
275#endif /* TFM_PARTITION_TEST_SST */
276
277#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
278static uint32_t ctx_stack_TFM_SP_SECURE_CLIENT_2[
279 (sizeof(struct interrupted_ctx_stack_frame_t) +
280 (TFM_PARTITION_TFM_SP_SECURE_CLIENT_2_IRQ_COUNT) * (
281 sizeof(struct interrupted_ctx_stack_frame_t) +
282 sizeof(struct handler_ctx_stack_frame_t)
283 )) / sizeof(uint32_t)];
284#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
285
286#ifdef TFM_MULTI_CORE_TEST
287static uint32_t ctx_stack_TFM_SP_MULTI_CORE_TEST[
288 (sizeof(struct interrupted_ctx_stack_frame_t) +
289 (TFM_PARTITION_TFM_SP_MULTI_CORE_TEST_IRQ_COUNT) * (
290 sizeof(struct interrupted_ctx_stack_frame_t) +
291 sizeof(struct handler_ctx_stack_frame_t)
292 )) / sizeof(uint32_t)];
293#endif /* TFM_MULTI_CORE_TEST */
294
295uint32_t *ctx_stack_list[] =
296{
297 ns_interrupt_ctx_stack,
298 tfm_core_interrupt_ctx_stack,
299#ifdef TFM_PARTITION_SECURE_STORAGE
300 ctx_stack_TFM_SP_STORAGE,
301#endif /* TFM_PARTITION_SECURE_STORAGE */
302#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
303 ctx_stack_TFM_SP_ITS,
304#endif /* TFM_PARTITION_INTERNAL_TRUSTED_STORAGE */
305#ifdef TFM_PARTITION_AUDIT_LOG
306 ctx_stack_TFM_SP_AUDIT_LOG,
307#endif /* TFM_PARTITION_AUDIT_LOG */
308#ifdef TFM_PARTITION_CRYPTO
309 ctx_stack_TFM_SP_CRYPTO,
310#endif /* TFM_PARTITION_CRYPTO */
311#ifdef TFM_PARTITION_PLATFORM
312 ctx_stack_TFM_SP_PLATFORM,
313#endif /* TFM_PARTITION_PLATFORM */
314#ifdef TFM_PARTITION_INITIAL_ATTESTATION
315 ctx_stack_TFM_SP_INITIAL_ATTESTATION,
316#endif /* TFM_PARTITION_INITIAL_ATTESTATION */
317#ifdef TFM_PARTITION_TEST_CORE
318 ctx_stack_TFM_SP_CORE_TEST,
319#endif /* TFM_PARTITION_TEST_CORE */
320#ifdef TFM_PARTITION_TEST_CORE
321 ctx_stack_TFM_SP_CORE_TEST_2,
322#endif /* TFM_PARTITION_TEST_CORE */
323#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
324 ctx_stack_TFM_SP_SECURE_TEST_PARTITION,
325#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
326#ifdef TFM_PARTITION_TEST_CORE_IPC
327 ctx_stack_TFM_SP_IPC_SERVICE_TEST,
328#endif /* TFM_PARTITION_TEST_CORE_IPC */
329#ifdef TFM_PARTITION_TEST_CORE_IPC
330 ctx_stack_TFM_SP_IPC_CLIENT_TEST,
331#endif /* TFM_PARTITION_TEST_CORE_IPC */
332#ifdef TFM_ENABLE_IRQ_TEST
333 ctx_stack_TFM_IRQ_TEST_1,
334#endif /* TFM_ENABLE_IRQ_TEST */
335#ifdef TFM_PARTITION_TEST_SST
336 ctx_stack_TFM_SP_SST_TEST,
337#endif /* TFM_PARTITION_TEST_SST */
338#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
339 ctx_stack_TFM_SP_SECURE_CLIENT_2,
340#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
341#ifdef TFM_MULTI_CORE_TEST
342 ctx_stack_TFM_SP_MULTI_CORE_TEST,
343#endif /* TFM_MULTI_CORE_TEST */
344};
345
346/**************************************************************************/
347/** Dependencies array for Secure Partition */
348/**************************************************************************/
349#ifdef TFM_PARTITION_SECURE_STORAGE
350static int32_t dependencies_TFM_SP_STORAGE[] =
351{
352 TFM_CRYPTO_SID,
353 TFM_ITS_SET_SID,
354 TFM_ITS_GET_SID,
355 TFM_ITS_GET_INFO_SID,
356 TFM_ITS_REMOVE_SID,
357 TFM_SP_PLATFORM_NV_COUNTER_SID,
358};
359#endif /* TFM_PARTITION_SECURE_STORAGE */
360
361#ifdef TFM_PARTITION_CRYPTO
362static int32_t dependencies_TFM_SP_CRYPTO[] =
363{
364 TFM_ITS_SET_SID,
365 TFM_ITS_GET_SID,
366 TFM_ITS_GET_INFO_SID,
367 TFM_ITS_REMOVE_SID,
368};
369#endif /* TFM_PARTITION_CRYPTO */
370
371#ifdef TFM_PARTITION_INITIAL_ATTESTATION
372static int32_t dependencies_TFM_SP_INITIAL_ATTESTATION[] =
373{
374 TFM_CRYPTO_SID,
375};
376#endif /* TFM_PARTITION_INITIAL_ATTESTATION */
377
378#ifdef TFM_PARTITION_TEST_CORE
379static int32_t dependencies_TFM_SP_CORE_TEST[] =
380{
381 SPM_CORE_TEST_2_INVERT_SID,
382 SPM_CORE_TEST_2_GET_EVERY_SECOND_BYTE_SID,
383 SPM_CORE_TEST_2_SLAVE_SERVICE_SID,
384};
385#endif /* TFM_PARTITION_TEST_CORE */
386
387#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
388static int32_t dependencies_TFM_SP_SECURE_TEST_PARTITION[] =
389{
390 TFM_SECURE_CLIENT_2_SID,
391 TFM_CRYPTO_SID,
392 TFM_SST_SET_SID,
393 TFM_SST_GET_SID,
394 TFM_SST_GET_INFO_SID,
395 TFM_SST_REMOVE_SID,
396 TFM_SST_GET_SUPPORT_SID,
397 TFM_ITS_SET_SID,
398 TFM_ITS_GET_SID,
399 TFM_ITS_GET_INFO_SID,
400 TFM_ITS_REMOVE_SID,
401 TFM_ATTEST_GET_TOKEN_SID,
402 TFM_ATTEST_GET_TOKEN_SIZE_SID,
403 TFM_ATTEST_GET_PUBLIC_KEY_SID,
404 TFM_SST_TEST_PREPARE_SID,
405 TFM_SP_PLATFORM_SYSTEM_RESET_SID,
406 TFM_SP_PLATFORM_IOCTL_SID,
407};
408#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
409
410#ifdef TFM_PARTITION_TEST_CORE_IPC
411static int32_t dependencies_TFM_SP_IPC_CLIENT_TEST[] =
412{
413 IPC_SERVICE_TEST_PSA_ACCESS_APP_READ_ONLY_MEM_SID,
414 IPC_SERVICE_TEST_PSA_ACCESS_APP_MEM_SID,
415 IPC_SERVICE_TEST_BASIC_SID,
416 IPC_SERVICE_TEST_APP_ACCESS_PSA_MEM_SID,
417};
418#endif /* TFM_PARTITION_TEST_CORE_IPC */
419
420#ifdef TFM_PARTITION_TEST_SST
421static int32_t dependencies_TFM_SP_SST_TEST[] =
422{
423 TFM_CRYPTO_SID,
424 TFM_ITS_GET_SID,
425 TFM_ITS_REMOVE_SID,
426};
427#endif /* TFM_PARTITION_TEST_SST */
428
429#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
430static int32_t dependencies_TFM_SP_SECURE_CLIENT_2[] =
431{
432 TFM_ITS_GET_SID,
433 TFM_CRYPTO_SID,
434};
435#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
436
437/**************************************************************************/
438/** The static data of the partition list */
439/**************************************************************************/
440const struct spm_partition_static_data_t static_data_list[] =
441{
442 {
443 .partition_id = TFM_SP_NON_SECURE_ID,
444 .partition_flags = 0,
445 },
446
447 {
448 .partition_id = TFM_SP_CORE_ID,
449 .partition_flags = SPM_PART_FLAG_APP_ROT | SPM_PART_FLAG_PSA_ROT,
450 },
451
452#ifdef TFM_PARTITION_SECURE_STORAGE
453 {
454 .partition_id = TFM_SP_STORAGE,
455 .partition_flags = SPM_PART_FLAG_IPC
456 | SPM_PART_FLAG_APP_ROT
457 ,
458 .partition_priority = TFM_PRIORITY(NORMAL),
459 .partition_init = tfm_sst_req_mngr_init,
460 .dependencies_num = 6,
461 .p_dependencies = dependencies_TFM_SP_STORAGE,
462 },
463#endif /* TFM_PARTITION_SECURE_STORAGE */
464
465#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
466 {
467 .partition_id = TFM_SP_ITS,
468 .partition_flags = SPM_PART_FLAG_IPC
469 | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
470 ,
471 .partition_priority = TFM_PRIORITY(NORMAL),
472 .partition_init = tfm_its_req_mngr_init,
473 .dependencies_num = 0,
474 .p_dependencies = NULL,
475 },
476#endif /* TFM_PARTITION_INTERNAL_TRUSTED_STORAGE */
477
478#ifdef TFM_PARTITION_AUDIT_LOG
479 {
480 .partition_id = TFM_SP_AUDIT_LOG,
481 .partition_flags = 0
482 | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
483 ,
484 .partition_priority = TFM_PRIORITY(NORMAL),
485 .partition_init = audit_core_init,
486 .dependencies_num = 0,
487 .p_dependencies = NULL,
488 },
489#endif /* TFM_PARTITION_AUDIT_LOG */
490
491#ifdef TFM_PARTITION_CRYPTO
492 {
493 .partition_id = TFM_SP_CRYPTO,
494 .partition_flags = SPM_PART_FLAG_IPC
495 | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
496 ,
497 .partition_priority = TFM_PRIORITY(NORMAL),
498 .partition_init = tfm_crypto_init,
499 .dependencies_num = 4,
500 .p_dependencies = dependencies_TFM_SP_CRYPTO,
501 },
502#endif /* TFM_PARTITION_CRYPTO */
503
504#ifdef TFM_PARTITION_PLATFORM
505 {
506 .partition_id = TFM_SP_PLATFORM,
507 .partition_flags = SPM_PART_FLAG_IPC
508 | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
509 ,
510 .partition_priority = TFM_PRIORITY(NORMAL),
511 .partition_init = platform_sp_init,
512 .dependencies_num = 0,
513 .p_dependencies = NULL,
514 },
515#endif /* TFM_PARTITION_PLATFORM */
516
517#ifdef TFM_PARTITION_INITIAL_ATTESTATION
518 {
519 .partition_id = TFM_SP_INITIAL_ATTESTATION,
520 .partition_flags = SPM_PART_FLAG_IPC
521 | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
522 ,
523 .partition_priority = TFM_PRIORITY(NORMAL),
524 .partition_init = attest_partition_init,
525 .dependencies_num = 1,
526 .p_dependencies = dependencies_TFM_SP_INITIAL_ATTESTATION,
527 },
528#endif /* TFM_PARTITION_INITIAL_ATTESTATION */
529
530#ifdef TFM_PARTITION_TEST_CORE
531 {
532 .partition_id = TFM_SP_CORE_TEST,
533 .partition_flags = SPM_PART_FLAG_IPC
534 | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
535 ,
536 .partition_priority = TFM_PRIORITY(NORMAL),
537 .partition_init = core_test_init,
538 .dependencies_num = 3,
539 .p_dependencies = dependencies_TFM_SP_CORE_TEST,
540 },
541#endif /* TFM_PARTITION_TEST_CORE */
542
543#ifdef TFM_PARTITION_TEST_CORE
544 {
545 .partition_id = TFM_SP_CORE_TEST_2,
546 .partition_flags = SPM_PART_FLAG_IPC
547 | SPM_PART_FLAG_APP_ROT
548 ,
549 .partition_priority = TFM_PRIORITY(NORMAL),
550 .partition_init = core_test_2_init,
551 .dependencies_num = 0,
552 .p_dependencies = NULL,
553 },
554#endif /* TFM_PARTITION_TEST_CORE */
555
556#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
557 {
558 .partition_id = TFM_SP_SECURE_TEST_PARTITION,
559 .partition_flags = SPM_PART_FLAG_IPC
560 | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
561 ,
562 .partition_priority = TFM_PRIORITY(NORMAL),
563 .partition_init = tfm_secure_client_service_init,
564 .dependencies_num = 17,
565 .p_dependencies = dependencies_TFM_SP_SECURE_TEST_PARTITION,
566 },
567#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
568
569#ifdef TFM_PARTITION_TEST_CORE_IPC
570 {
571 .partition_id = TFM_SP_IPC_SERVICE_TEST,
572 .partition_flags = SPM_PART_FLAG_IPC
573 | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
574 ,
575 .partition_priority = TFM_PRIORITY(HIGH),
576 .partition_init = ipc_service_test_main,
577 .dependencies_num = 0,
578 .p_dependencies = NULL,
579 },
580#endif /* TFM_PARTITION_TEST_CORE_IPC */
581
582#ifdef TFM_PARTITION_TEST_CORE_IPC
583 {
584 .partition_id = TFM_SP_IPC_CLIENT_TEST,
585 .partition_flags = SPM_PART_FLAG_IPC
586 | SPM_PART_FLAG_APP_ROT
587 ,
588 .partition_priority = TFM_PRIORITY(NORMAL),
589 .partition_init = ipc_client_test_main,
590 .dependencies_num = 4,
591 .p_dependencies = dependencies_TFM_SP_IPC_CLIENT_TEST,
592 },
593#endif /* TFM_PARTITION_TEST_CORE_IPC */
594
595#ifdef TFM_ENABLE_IRQ_TEST
596 {
597 .partition_id = TFM_IRQ_TEST_1,
598 .partition_flags = SPM_PART_FLAG_IPC
599 | SPM_PART_FLAG_APP_ROT
600 ,
601 .partition_priority = TFM_PRIORITY(NORMAL),
602 .partition_init = tfm_irq_test_1_init,
603 .dependencies_num = 0,
604 .p_dependencies = NULL,
605 },
606#endif /* TFM_ENABLE_IRQ_TEST */
607
608#ifdef TFM_PARTITION_TEST_SST
609 {
610 .partition_id = TFM_SP_SST_TEST,
611 .partition_flags = SPM_PART_FLAG_IPC
612 | SPM_PART_FLAG_PSA_ROT | SPM_PART_FLAG_APP_ROT
613 ,
614 .partition_priority = TFM_PRIORITY(NORMAL),
615 .partition_init = tfm_sst_test_init,
616 .dependencies_num = 3,
617 .p_dependencies = dependencies_TFM_SP_SST_TEST,
618 },
619#endif /* TFM_PARTITION_TEST_SST */
620
621#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
622 {
623 .partition_id = TFM_SP_SECURE_CLIENT_2,
624 .partition_flags = SPM_PART_FLAG_IPC
625 | SPM_PART_FLAG_APP_ROT
626 ,
627 .partition_priority = TFM_PRIORITY(NORMAL),
628 .partition_init = tfm_secure_client_2_init,
629 .dependencies_num = 2,
630 .p_dependencies = dependencies_TFM_SP_SECURE_CLIENT_2,
631 },
632#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
633
634#ifdef TFM_MULTI_CORE_TEST
635 {
636 .partition_id = TFM_SP_MULTI_CORE_TEST,
637 .partition_flags = SPM_PART_FLAG_IPC
638 | SPM_PART_FLAG_APP_ROT
639 ,
640 .partition_priority = TFM_PRIORITY(NORMAL),
641 .partition_init = multi_core_test_main,
642 .dependencies_num = 0,
643 .p_dependencies = NULL,
644 },
645#endif /* TFM_MULTI_CORE_TEST */
646
647};
648
649/**************************************************************************/
650/** The platform data of the partition list */
651/**************************************************************************/
652#ifdef TFM_PARTITION_AUDIT_LOG
653const struct tfm_spm_partition_platform_data_t *
654 platform_data_list_TFM_SP_AUDIT_LOG[] =
655{
656#ifdef AUDIT_UART_REDIRECTION
657 TFM_PERIPHERAL_UART1,
658#endif /* AUDIT_UART_REDIRECTION */
659 NULL
660};
661#endif /* TFM_PARTITION_AUDIT_LOG */
662
663#ifdef TFM_PARTITION_TEST_CORE
664const struct tfm_spm_partition_platform_data_t *
665 platform_data_list_TFM_SP_CORE_TEST[] =
666{
667 TFM_PERIPHERAL_FPGA_IO,
668 NULL
669};
670#endif /* TFM_PARTITION_TEST_CORE */
671
672#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
673const struct tfm_spm_partition_platform_data_t *
674 platform_data_list_TFM_SP_SECURE_TEST_PARTITION[] =
675{
676 TFM_PERIPHERAL_STD_UART,
677 NULL
678};
679#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
680
681#ifdef TFM_ENABLE_IRQ_TEST
682const struct tfm_spm_partition_platform_data_t *
683 platform_data_list_TFM_IRQ_TEST_1[] =
684{
685 TFM_PERIPHERAL_TIMER0,
686 NULL
687};
688#endif /* TFM_ENABLE_IRQ_TEST */
689
690const struct tfm_spm_partition_platform_data_t **platform_data_list_list[] =
691{
692 NULL,
693 NULL,
694
695#ifdef TFM_PARTITION_SECURE_STORAGE
696 NULL,
697#endif /* TFM_PARTITION_SECURE_STORAGE */
698
699#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
700 NULL,
701#endif /* TFM_PARTITION_INTERNAL_TRUSTED_STORAGE */
702
703#ifdef TFM_PARTITION_AUDIT_LOG
704 platform_data_list_TFM_SP_AUDIT_LOG,
705#endif /* TFM_PARTITION_AUDIT_LOG */
706
707#ifdef TFM_PARTITION_CRYPTO
708 NULL,
709#endif /* TFM_PARTITION_CRYPTO */
710
711#ifdef TFM_PARTITION_PLATFORM
712 NULL,
713#endif /* TFM_PARTITION_PLATFORM */
714
715#ifdef TFM_PARTITION_INITIAL_ATTESTATION
716 NULL,
717#endif /* TFM_PARTITION_INITIAL_ATTESTATION */
718
719#ifdef TFM_PARTITION_TEST_CORE
720 platform_data_list_TFM_SP_CORE_TEST,
721#endif /* TFM_PARTITION_TEST_CORE */
722
723#ifdef TFM_PARTITION_TEST_CORE
724 NULL,
725#endif /* TFM_PARTITION_TEST_CORE */
726
727#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
728 platform_data_list_TFM_SP_SECURE_TEST_PARTITION,
729#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
730
731#ifdef TFM_PARTITION_TEST_CORE_IPC
732 NULL,
733#endif /* TFM_PARTITION_TEST_CORE_IPC */
734
735#ifdef TFM_PARTITION_TEST_CORE_IPC
736 NULL,
737#endif /* TFM_PARTITION_TEST_CORE_IPC */
738
739#ifdef TFM_ENABLE_IRQ_TEST
740 platform_data_list_TFM_IRQ_TEST_1,
741#endif /* TFM_ENABLE_IRQ_TEST */
742
743#ifdef TFM_PARTITION_TEST_SST
744 NULL,
745#endif /* TFM_PARTITION_TEST_SST */
746
747#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
748 NULL,
749#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
750
751#ifdef TFM_MULTI_CORE_TEST
752 NULL,
753#endif /* TFM_MULTI_CORE_TEST */
754
755};
756
757/**************************************************************************/
758/** The partition list for the DB */
759/**************************************************************************/
760static struct spm_partition_desc_t partition_list [] =
761{
762 {{0}}, /* placeholder for Non-secure internal partition */
763 {{0}}, /* placeholder for TF-M Core internal partition */
764
765 /* -----------------------------------------------------------------------*/
766 /* - Partition DB record for TFM_SP_STORAGE */
767 /* -----------------------------------------------------------------------*/
768#ifdef TFM_PARTITION_SECURE_STORAGE
769 {
770 /* Runtime data */
771 .runtime_data = {0},
772 .static_data = NULL,
773 .platform_data_list = NULL,
774 },
775#endif /* TFM_PARTITION_SECURE_STORAGE */
776
777 /* -----------------------------------------------------------------------*/
778 /* - Partition DB record for TFM_SP_ITS */
779 /* -----------------------------------------------------------------------*/
780#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
781 {
782 /* Runtime data */
783 .runtime_data = {0},
784 .static_data = NULL,
785 .platform_data_list = NULL,
786 },
787#endif /* TFM_PARTITION_INTERNAL_TRUSTED_STORAGE */
788
789 /* -----------------------------------------------------------------------*/
790 /* - Partition DB record for TFM_SP_AUDIT_LOG */
791 /* -----------------------------------------------------------------------*/
792#ifdef TFM_PARTITION_AUDIT_LOG
793 {
794 /* Runtime data */
795 .runtime_data = {0},
796 .static_data = NULL,
797 .platform_data_list = NULL,
798 },
799#endif /* TFM_PARTITION_AUDIT_LOG */
800
801 /* -----------------------------------------------------------------------*/
802 /* - Partition DB record for TFM_SP_CRYPTO */
803 /* -----------------------------------------------------------------------*/
804#ifdef TFM_PARTITION_CRYPTO
805 {
806 /* Runtime data */
807 .runtime_data = {0},
808 .static_data = NULL,
809 .platform_data_list = NULL,
810 },
811#endif /* TFM_PARTITION_CRYPTO */
812
813 /* -----------------------------------------------------------------------*/
814 /* - Partition DB record for TFM_SP_PLATFORM */
815 /* -----------------------------------------------------------------------*/
816#ifdef TFM_PARTITION_PLATFORM
817 {
818 /* Runtime data */
819 .runtime_data = {0},
820 .static_data = NULL,
821 .platform_data_list = NULL,
822 },
823#endif /* TFM_PARTITION_PLATFORM */
824
825 /* -----------------------------------------------------------------------*/
826 /* - Partition DB record for TFM_SP_INITIAL_ATTESTATION */
827 /* -----------------------------------------------------------------------*/
828#ifdef TFM_PARTITION_INITIAL_ATTESTATION
829 {
830 /* Runtime data */
831 .runtime_data = {0},
832 .static_data = NULL,
833 .platform_data_list = NULL,
834 },
835#endif /* TFM_PARTITION_INITIAL_ATTESTATION */
836
837 /* -----------------------------------------------------------------------*/
838 /* - Partition DB record for TFM_SP_CORE_TEST */
839 /* -----------------------------------------------------------------------*/
840#ifdef TFM_PARTITION_TEST_CORE
841 {
842 /* Runtime data */
843 .runtime_data = {0},
844 .static_data = NULL,
845 .platform_data_list = NULL,
846 },
847#endif /* TFM_PARTITION_TEST_CORE */
848
849 /* -----------------------------------------------------------------------*/
850 /* - Partition DB record for TFM_SP_CORE_TEST_2 */
851 /* -----------------------------------------------------------------------*/
852#ifdef TFM_PARTITION_TEST_CORE
853 {
854 /* Runtime data */
855 .runtime_data = {0},
856 .static_data = NULL,
857 .platform_data_list = NULL,
858 },
859#endif /* TFM_PARTITION_TEST_CORE */
860
861 /* -----------------------------------------------------------------------*/
862 /* - Partition DB record for TFM_SP_SECURE_TEST_PARTITION */
863 /* -----------------------------------------------------------------------*/
864#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
865 {
866 /* Runtime data */
867 .runtime_data = {0},
868 .static_data = NULL,
869 .platform_data_list = NULL,
870 },
871#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
872
873 /* -----------------------------------------------------------------------*/
874 /* - Partition DB record for TFM_SP_IPC_SERVICE_TEST */
875 /* -----------------------------------------------------------------------*/
876#ifdef TFM_PARTITION_TEST_CORE_IPC
877 {
878 /* Runtime data */
879 .runtime_data = {0},
880 .static_data = NULL,
881 .platform_data_list = NULL,
882 },
883#endif /* TFM_PARTITION_TEST_CORE_IPC */
884
885 /* -----------------------------------------------------------------------*/
886 /* - Partition DB record for TFM_SP_IPC_CLIENT_TEST */
887 /* -----------------------------------------------------------------------*/
888#ifdef TFM_PARTITION_TEST_CORE_IPC
889 {
890 /* Runtime data */
891 .runtime_data = {0},
892 .static_data = NULL,
893 .platform_data_list = NULL,
894 },
895#endif /* TFM_PARTITION_TEST_CORE_IPC */
896
897 /* -----------------------------------------------------------------------*/
898 /* - Partition DB record for TFM_IRQ_TEST_1 */
899 /* -----------------------------------------------------------------------*/
900#ifdef TFM_ENABLE_IRQ_TEST
901 {
902 /* Runtime data */
903 .runtime_data = {0},
904 .static_data = NULL,
905 .platform_data_list = NULL,
906 },
907#endif /* TFM_ENABLE_IRQ_TEST */
908
909 /* -----------------------------------------------------------------------*/
910 /* - Partition DB record for TFM_SP_SST_TEST */
911 /* -----------------------------------------------------------------------*/
912#ifdef TFM_PARTITION_TEST_SST
913 {
914 /* Runtime data */
915 .runtime_data = {0},
916 .static_data = NULL,
917 .platform_data_list = NULL,
918 },
919#endif /* TFM_PARTITION_TEST_SST */
920
921 /* -----------------------------------------------------------------------*/
922 /* - Partition DB record for TFM_SP_SECURE_CLIENT_2 */
923 /* -----------------------------------------------------------------------*/
924#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
925 {
926 /* Runtime data */
927 .runtime_data = {0},
928 .static_data = NULL,
929 .platform_data_list = NULL,
930 },
931#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
932
933 /* -----------------------------------------------------------------------*/
934 /* - Partition DB record for TFM_SP_MULTI_CORE_TEST */
935 /* -----------------------------------------------------------------------*/
936#ifdef TFM_MULTI_CORE_TEST
937 {
938 /* Runtime data */
939 .runtime_data = {0},
940 .static_data = NULL,
941 .platform_data_list = NULL,
942 },
943#endif /* TFM_MULTI_CORE_TEST */
944
945};
946
947struct spm_partition_db_t g_spm_partition_db = {
948 .is_init = 0,
949 .partition_count = sizeof(partition_list) / sizeof(partition_list[0]),
950 .running_partition_idx = 0,
951 .partitions = partition_list,
952};
953
954#endif /* __TFM_SPM_DB_FUNC_INC__ */