diff options
Diffstat (limited to 'secure_fw/spm/cmsis_psa/static_load.c')
-rw-r--r-- | secure_fw/spm/cmsis_psa/static_load.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/secure_fw/spm/cmsis_psa/static_load.c b/secure_fw/spm/cmsis_psa/static_load.c index e47f4fe025..680907b0c3 100644 --- a/secure_fw/spm/cmsis_psa/static_load.c +++ b/secure_fw/spm/cmsis_psa/static_load.c @@ -10,6 +10,8 @@ #include "region.h" #include "region_defs.h" #include "spm_ipc.h" +#include "tfm_plat_defs.h" +#include "tfm_spm_hal.h" #include "utilities.h" #include "load/partition_defs.h" #include "load/spm_load_api.h" @@ -163,3 +165,41 @@ void load_services_assuredly(struct partition_t *p_partition, } } } + +void load_irqs_assuredly(struct partition_t *p_partition) +{ + struct irq_load_info_t *p_irq_info; + const struct partition_load_info_t *p_ldinf; + uint32_t i; + + if (!p_partition) { + tfm_core_panic(); + } + + p_ldinf = p_partition->p_ldinf; + p_irq_info = (struct irq_load_info_t *)LOAD_INFO_IRQ(p_ldinf); + + for (i = 0; i < p_ldinf->nirqs; i++) { + p_partition->signals_allowed |= p_irq_info[i].signal; + + if (tfm_spm_hal_set_secure_irq_priority(p_irq_info[i].source, + TFM_DEFAULT_SECURE_IRQ_PRIOTITY) + != TFM_PLAT_ERR_SUCCESS) { + tfm_core_panic(); + } + + if (tfm_spm_hal_set_irq_target_state(p_irq_info[i].source, + TFM_IRQ_TARGET_STATE_SECURE) + != TFM_PLAT_ERR_SUCCESS) { + tfm_core_panic(); + } + + if ((p_ldinf->psa_ff_ver & PARTITION_INFO_VERSION_MASK) == 0x0100) { + tfm_spm_hal_enable_irq(p_irq_info[i].source); + } else if ((p_ldinf->psa_ff_ver & PARTITION_INFO_VERSION_MASK) + == 0x0101) { + tfm_spm_hal_disable_irq(p_irq_info[i].source); + } + p_irq_info++; + } +} |