Mistake on this page?
Report an issue in GitHub or email us
spm_db.h
1 /*
2  * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __SPM_DB_H__
9 #define __SPM_DB_H__
10 
11 
12 #ifdef TFM_PSA_API
13 #include "tfm_thread.h"
14 #endif
15 
17 struct spm_partition_db_t;
18 
19 typedef psa_status_t(*sp_init_function)(void);
20 
21 #define TFM_PARTITION_TYPE_APP "APPLICATION-ROT"
22 #define TFM_PARTITION_TYPE_PSA "PSA-ROT"
23 
24 #ifdef TFM_PSA_API
25 enum tfm_partition_priority {
26  TFM_PRIORITY_LOW = THRD_PRIOR_LOWEST,
27  TFM_PRIORITY_NORMAL = THRD_PRIOR_MEDIUM,
28  TFM_PRIORITY_HIGH = THRD_PRIOR_HIGHEST,
29 };
30 #else
31 enum tfm_partition_priority {
32  TFM_PRIORITY_LOW = 0xFF,
33  TFM_PRIORITY_NORMAL = 0x7F,
34  TFM_PRIORITY_HIGH = 0,
35 };
36 #endif
37 
38 #define TFM_PRIORITY(LEVEL) TFM_PRIORITY_##LEVEL
39 
40 /**
41  * Holds the fields of the partition DB used by the SPM code. The values of
42  * these fields are calculated at compile time, and set during initialisation
43  * phase.
44  */
46  uint32_t partition_id;
47  uint32_t partition_flags;
48  uint32_t partition_priority;
49  sp_init_function partition_init;
50 };
51 
52 /**
53  * Holds the fields that define a partition for SPM. The fields are further
54  * divided to structures, to keep the related fields close to each other.
55  */
57  struct spm_partition_static_data_t static_data;
58  struct spm_partition_runtime_data_t runtime_data;
59  struct tfm_spm_partition_platform_data_t *platform_data;
60 #if (TFM_LVL != 1) || defined(TFM_PSA_API)
61  struct tfm_spm_partition_memory_data_t memory_data;
62 #endif
63 #ifdef TFM_PSA_API
64  struct tfm_thrd_ctx sp_thrd;
65 #endif
66 };
67 
68 /* Macros to pick linker symbols and allow to form the partition data base */
69 #define REGION(a, b, c) a##b##c
70 #define REGION_NAME(a, b, c) REGION(a, b, c)
71 /* Changed from #if (TFM_LVL == 1) && !defined(TFM_PSA_API) to #if (TFM_LVL == 1) to avoid linker error.
72  TF-M build autogenerates region details (code, ro, rw, zi and stack ) using linker scripts. We do not
73  hve that in mbed-os build yet.
74 */
75 #if (TFM_LVL == 1)
76 #define REGION_DECLARE(a, b, c)
77 #else
78 #define REGION_DECLARE(a, b, c) extern uint32_t REGION_NAME(a, b, c)
79 #define PART_REGION_ADDR(partition, region) \
80  (uint32_t)&REGION_NAME(Image$$, partition, region)
81 #endif
82 
83 #endif /* __SPM_DB_H__ */
Holds the fields that define a partition for SPM.
Definition: spm_db.h:56
Holds the fields of the partition DB used by the SPM code.
Definition: spm_db.h:45
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.