SPM: Rename IS_PARTITION_*** to IS_***
Remove redundant namespace 'PARTITION' to make it shorter.
And updated the flags bit assignment explanation comments for easier understanding.
Signed-off-by: Summer Qin <summer.qin@arm.com>
Change-Id: I218e08b945309017f07e2e595a3c684e00be4bdf
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.c b/secure_fw/spm/cmsis_psa/spm_ipc.c
index 21d01e1..de771b4 100755
--- a/secure_fw/spm/cmsis_psa/spm_ipc.c
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.c
@@ -425,7 +425,7 @@
tfm_core_panic();
}
- return IS_PARTITION_NS_AGENT(partition->p_ldinf);
+ return IS_NS_AGENT(partition->p_ldinf);
}
int32_t tfm_spm_get_client_id(bool ns_caller)
diff --git a/secure_fw/spm/ffm/backend_ipc.c b/secure_fw/spm/ffm/backend_ipc.c
index 469e7f3..b727be1 100644
--- a/secure_fw/spm/ffm/backend_ipc.c
+++ b/secure_fw/spm/ffm/backend_ipc.c
@@ -121,7 +121,7 @@
/* common runtime metadata */
allocate_size = sizeof(*p_rt_meta);
- if (!IS_PARTITION_IPC_MODEL(p_pt_ldi)) {
+ if (!IS_IPC_MODEL(p_pt_ldi)) {
/* SFN specific metadata - SFN function table */
allocate_size += sizeof(service_fn_t) * p_pt_ldi->nservices;
}
@@ -140,7 +140,7 @@
p_rt_meta->n_sfn = 0;
p_sfn_table = p_rt_meta->sfn_table;
- if (!IS_PARTITION_IPC_MODEL(p_pt_ldi)) {
+ if (!IS_IPC_MODEL(p_pt_ldi)) {
/* SFN table. The signal bit of the service is the same index of SFN. */
for (int i = 0; i < p_pt_ldi->nservices; i++) {
p_sfn_table[i] = (service_fn_t)p_srv_ldi[i].sfn;
@@ -237,7 +237,7 @@
TO_THREAD_PRIORITY(PARTITION_PRIORITY(p_pldi->flags)));
#if (CONFIG_TFM_PSA_API_CROSS_CALL == 1) && defined(CONFIG_TFM_USE_TRUSTZONE)
- if (IS_PARTITION_NS_AGENT(p_pldi)) {
+ if (IS_NS_AGENT(p_pldi)) {
/* Get the context from ns_agent_tz */
if (p_pldi->pid == 0) {
SPM_THREAD_CONTEXT = &p_pt->ctx_ctrl;
@@ -245,7 +245,7 @@
}
#endif
- if (IS_PARTITION_IPC_MODEL(p_pldi)) {
+ if (IS_IPC_MODEL(p_pldi)) {
/* IPC Partition */
thrd_entry = POSITION_TO_ENTRY(p_pldi->entry, thrd_fn_t);
} else {
diff --git a/secure_fw/spm/ffm/backend_sfn.c b/secure_fw/spm/ffm/backend_sfn.c
index c9d9d6d..7e24131 100644
--- a/secure_fw/spm/ffm/backend_sfn.c
+++ b/secure_fw/spm/ffm/backend_sfn.c
@@ -94,7 +94,7 @@
p_curr = GET_CURRENT_COMPONENT();
/* Call partition initialization routine one by one. */
UNI_LIST_FOREACH(p_part, PARTITION_LIST_ADDR, next) {
- if (IS_PARTITION_IPC_MODEL(p_part->p_ldinf)) {
+ if (IS_IPC_MODEL(p_part->p_ldinf)) {
continue;
}
@@ -132,7 +132,7 @@
* Built-in partitions still have thread instances: NS Agent (TZ) and
* IDLE partition, and NS Agent (TZ) needs to be specific cared here.
*/
- if (IS_PARTITION_NS_AGENT(p_pldi)) {
+ if (IS_NS_AGENT(p_pldi)) {
ARCH_CTXCTRL_INIT(&ns_agent_ctrl,
LOAD_ALLOCED_STACK_ADDR(p_pldi),
p_pldi->stack_size);
diff --git a/secure_fw/spm/include/load/partition_defs.h b/secure_fw/spm/include/load/partition_defs.h
index 37cce25..d007c56 100644
--- a/secure_fw/spm/include/load/partition_defs.h
+++ b/secure_fw/spm/include/load/partition_defs.h
@@ -24,10 +24,19 @@
#define PARTITION_INFO_MAGIC (0x5F5F0000)
/*
- * Partition load data - flags
- * bit 7-0: priority
- * bit 8: 1 - PSA_ROT, 0 - APP_ROT
- * bit 9: 1 - IPC model, 0 - SFN model
+ * Partition flag start
+ *
+ * 31 10 9 8 7 0
+ * +---------+--+---+---+----------+
+ * | RES[21] |NS|I/S|A/P| Priority |
+ * +---------+--+---+---+----------+
+ *
+ * Field Desc Value
+ * Priority: Partition Priority Lowest, low, normal, high, hightest
+ * A/P: ARoT or PRoT domain 1: PRoT 0: ARoT
+ * I/S: IPC or SFN typed partition 1: IPC 0: SFN
+ * NS: NS Agent or not 1: NS Agent 0: Not
+ * RES: 21 bits reserved 0
*/
#define PARTITION_PRI_HIGHEST (0x0)
#define PARTITION_PRI_HIGH (0xF)
@@ -50,12 +59,13 @@
#define PTR_TO_REFERENCE(x) (uintptr_t)(x)
#define REFERENCE_TO_PTR(x, t) (t)(x)
-#define IS_PARTITION_PSA_ROT(pldi) (!!((pldi)->flags \
+#define IS_PSA_ROT(pldi) (!!((pldi)->flags \
& PARTITION_MODEL_PSA_ROT))
-#define IS_PARTITION_IPC_MODEL(pldi) (!!((pldi)->flags \
- & PARTITION_MODEL_IPC))
-#define IS_PARTITION_NS_AGENT(pldi) (!!((pldi)->flags \
- & PARTITION_NS_AGENT))
+#define IS_IPC_MODEL(pldi) (!!((pldi)->flags \
+ & PARTITION_MODEL_IPC))
+#define IS_NS_AGENT(pldi) (!!((pldi)->flags \
+ & PARTITION_NS_AGENT))
+/* Partition flag end */
/*
* Common partition structure type, the extendable data is right after it.