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/platform/ext/common/tfm_hal_isolation_v8m.c b/platform/ext/common/tfm_hal_isolation_v8m.c
index 93c4ab4..aa7ba46 100644
--- a/platform/ext/common/tfm_hal_isolation_v8m.c
+++ b/platform/ext/common/tfm_hal_isolation_v8m.c
@@ -291,10 +291,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
p_asset = LOAD_INFO_ASSET(p_ldinf);
get_partition_named_mmio_list(&mmio_list, &mmio_list_length);
diff --git a/platform/ext/target/arm/corstone1000/tfm_hal_isolation.c b/platform/ext/target/arm/corstone1000/tfm_hal_isolation.c
index 0344cbf..e3cf6f2 100644
--- a/platform/ext/target/arm/corstone1000/tfm_hal_isolation.c
+++ b/platform/ext/target/arm/corstone1000/tfm_hal_isolation.c
@@ -178,10 +178,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
partition_attrs = ((uint32_t)privileged << HANDLE_ATTR_PRIV_POS) &
HANDLE_ATTR_PRIV_MASK;
partition_attrs |= ((uint32_t)ns_agent << HANDLE_ATTR_NS_POS) &
diff --git a/platform/ext/target/arm/mps2/an519/tfm_hal_isolation.c b/platform/ext/target/arm/mps2/an519/tfm_hal_isolation.c
index 55caa0d..cf70119 100644
--- a/platform/ext/target/arm/mps2/an519/tfm_hal_isolation.c
+++ b/platform/ext/target/arm/mps2/an519/tfm_hal_isolation.c
@@ -176,10 +176,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
p_asset = LOAD_INFO_ASSET(p_ldinf);
/*
diff --git a/platform/ext/target/arm/mps2/an521/tfm_hal_isolation.c b/platform/ext/target/arm/mps2/an521/tfm_hal_isolation.c
index 9a142e5..9ef3cd8 100644
--- a/platform/ext/target/arm/mps2/an521/tfm_hal_isolation.c
+++ b/platform/ext/target/arm/mps2/an521/tfm_hal_isolation.c
@@ -399,10 +399,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
/*
diff --git a/platform/ext/target/arm/musca_b1/tfm_hal_isolation.c b/platform/ext/target/arm/musca_b1/tfm_hal_isolation.c
index 5a85768..3a633ed 100644
--- a/platform/ext/target/arm/musca_b1/tfm_hal_isolation.c
+++ b/platform/ext/target/arm/musca_b1/tfm_hal_isolation.c
@@ -283,10 +283,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
p_asset = LOAD_INFO_ASSET(p_ldinf);
/*
diff --git a/platform/ext/target/arm/musca_s1/tfm_hal_isolation.c b/platform/ext/target/arm/musca_s1/tfm_hal_isolation.c
index 3ea88a1..307b84b 100644
--- a/platform/ext/target/arm/musca_s1/tfm_hal_isolation.c
+++ b/platform/ext/target/arm/musca_s1/tfm_hal_isolation.c
@@ -184,10 +184,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
p_asset = LOAD_INFO_ASSET(p_ldinf);
/*
diff --git a/platform/ext/target/arm/rss/common/tfm_hal_isolation.c b/platform/ext/target/arm/rss/common/tfm_hal_isolation.c
index 38beb33..6bb833e 100644
--- a/platform/ext/target/arm/rss/common/tfm_hal_isolation.c
+++ b/platform/ext/target/arm/rss/common/tfm_hal_isolation.c
@@ -199,10 +199,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
p_asset = LOAD_INFO_ASSET(p_ldinf);
/*
diff --git a/platform/ext/target/cypress/psoc64/tfm_hal_isolation.c b/platform/ext/target/cypress/psoc64/tfm_hal_isolation.c
index fec25d2..402b068 100644
--- a/platform/ext/target/cypress/psoc64/tfm_hal_isolation.c
+++ b/platform/ext/target/cypress/psoc64/tfm_hal_isolation.c
@@ -105,10 +105,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
p_asset = LOAD_INFO_ASSET(p_ldinf);
/*
diff --git a/platform/ext/target/nordic_nrf/common/core/tfm_hal_isolation.c b/platform/ext/target/nordic_nrf/common/core/tfm_hal_isolation.c
index a9cb069..56b051b 100644
--- a/platform/ext/target/nordic_nrf/common/core/tfm_hal_isolation.c
+++ b/platform/ext/target/nordic_nrf/common/core/tfm_hal_isolation.c
@@ -82,10 +82,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
partition_attrs = ((uint32_t)privileged << HANDLE_ATTR_PRIV_POS) &
HANDLE_ATTR_PRIV_MASK;
partition_attrs |= ((uint32_t)ns_agent << HANDLE_ATTR_NS_POS) &
diff --git a/platform/ext/target/nuvoton/common/tfm_hal_isolation.c b/platform/ext/target/nuvoton/common/tfm_hal_isolation.c
index aa1c9e8..ca7dac2 100644
--- a/platform/ext/target/nuvoton/common/tfm_hal_isolation.c
+++ b/platform/ext/target/nuvoton/common/tfm_hal_isolation.c
@@ -271,10 +271,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
p_asset = LOAD_INFO_ASSET(p_ldinf);
/*
diff --git a/platform/ext/target/nxp/common/tfm_hal_isolation.c b/platform/ext/target/nxp/common/tfm_hal_isolation.c
index b03ccf6..dd5e657 100644
--- a/platform/ext/target/nxp/common/tfm_hal_isolation.c
+++ b/platform/ext/target/nxp/common/tfm_hal_isolation.c
@@ -316,10 +316,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
p_asset = LOAD_INFO_ASSET(p_ldinf);
/*
* Validate if the named MMIO of partition is allowed by the platform.
diff --git a/platform/ext/target/stm/common/stm32l5xx/secure/tfm_hal_isolation.c b/platform/ext/target/stm/common/stm32l5xx/secure/tfm_hal_isolation.c
index d788663..72c7019 100644
--- a/platform/ext/target/stm/common/stm32l5xx/secure/tfm_hal_isolation.c
+++ b/platform/ext/target/stm/common/stm32l5xx/secure/tfm_hal_isolation.c
@@ -274,10 +274,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
p_asset = LOAD_INFO_ASSET(p_ldinf);
/*
diff --git a/platform/ext/target/stm/common/stm32u5xx/secure/tfm_hal_isolation.c b/platform/ext/target/stm/common/stm32u5xx/secure/tfm_hal_isolation.c
index de62efc..e2820d7 100644
--- a/platform/ext/target/stm/common/stm32u5xx/secure/tfm_hal_isolation.c
+++ b/platform/ext/target/stm/common/stm32u5xx/secure/tfm_hal_isolation.c
@@ -364,10 +364,10 @@
#if TFM_LVL == 1
privileged = true;
#else
- privileged = IS_PARTITION_PSA_ROT(p_ldinf);
+ privileged = IS_PSA_ROT(p_ldinf);
#endif
- ns_agent = IS_PARTITION_NS_AGENT(p_ldinf);
+ ns_agent = IS_NS_AGENT(p_ldinf);
p_asset = LOAD_INFO_ASSET(p_ldinf);
/*
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.