1 /* 2 * Copyright (c) 2021-2024, Arm Limited. All rights reserved. 3 * Copyright (c) 2021-2023 Cypress Semiconductor Corporation (an Infineon 4 * company) or an affiliate of Cypress Semiconductor Corporation. All rights 5 * reserved. 6 * 7 * SPDX-License-Identifier: BSD-3-Clause 8 * 9 */ 10 11 /***** WARNING: This file SHOULD BE CHANGED according to storage template *****/ 12 13 #include <stdint.h> 14 #include <stddef.h> 15 #include "compiler_ext_defs.h" 16 #include "config_impl.h" 17 #include "spm.h" 18 #include "load/partition_defs.h" 19 #include "load/service_defs.h" 20 #include "load/asset_defs.h" 21 /* Note that region_defs.h must be included before tfm_s_linker_alignments.h 22 * to let platform overwrite default alignment values. 23 */ 24 #include "region_defs.h" 25 #include "tfm_s_linker_alignments.h" 26 27 #define TFM_SP_NS_AGENT_NDEPS (0) 28 #define TFM_SP_NS_AGENT_NSERVS (0) 29 #if TFM_ISOLATION_LEVEL == 3 30 #define TFM_SP_NS_AGENT_NASSETS (1) 31 #endif 32 33 /* Entrypoint function declaration */ 34 extern void ns_agent_tz_main(void); 35 36 /* Stack size must be aligned to satisfy platform alignment requirements */ 37 #define TFM_NS_AGENT_TZ_STACK_SIZE_ALIGNED \ 38 ROUND_UP_TO_MULTIPLE(CONFIG_TFM_NS_AGENT_TZ_STACK_SIZE,\ 39 TFM_LINKER_NS_AGENT_TZ_STACK_ALIGNMENT) 40 41 /* Stack */ 42 uint8_t ns_agent_tz_stack[TFM_NS_AGENT_TZ_STACK_SIZE_ALIGNED] __aligned(TFM_LINKER_NS_AGENT_TZ_STACK_ALIGNMENT); 43 44 struct partition_tfm_sp_ns_agent_tz_load_info_t { 45 /* common length load data */ 46 struct partition_load_info_t load_info; 47 /* per-partition variable length load data */ 48 uintptr_t stack_addr; 49 uintptr_t heap_addr; 50 #if TFM_ISOLATION_LEVEL == 3 51 struct asset_desc_t assets[TFM_SP_NS_AGENT_NASSETS]; 52 #endif 53 } __attribute__((aligned(4))); 54 55 /* Partition load, deps, service load data. Put to a dedicated section. */ 56 #if defined(__ICCARM__) 57 /* Section priority: lowest */ 58 #pragma location = ".part_load_priority_00" 59 __root 60 #endif 61 const struct partition_tfm_sp_ns_agent_tz_load_info_t 62 tfm_sp_ns_agent_tz_load __attribute__((used, section(".part_load_priority_00"))) = { 63 .load_info = { 64 .psa_ff_ver = 0x0100 | PARTITION_INFO_MAGIC, 65 .pid = TFM_SP_TZ_AGENT, 66 .flags = (PARTITION_PRI_LOWEST - 1) 67 | PARTITION_MODEL_IPC 68 | PARTITION_MODEL_PSA_ROT 69 | PARTITION_NS_AGENT_TZ, 70 .entry = ENTRY_TO_POSITION(ns_agent_tz_main), 71 .stack_size = TFM_NS_AGENT_TZ_STACK_SIZE_ALIGNED, 72 .heap_size = 0, 73 .client_id_base = -0x3c00ffff, 74 .client_id_limit = -0x3c000000, 75 .ndeps = TFM_SP_NS_AGENT_NDEPS, 76 .nservices = TFM_SP_NS_AGENT_NSERVS, 77 #if TFM_ISOLATION_LEVEL == 3 78 .nassets = TFM_SP_NS_AGENT_NASSETS, 79 #else 80 .nassets = 0, 81 #endif 82 }, 83 .stack_addr = (uintptr_t)ns_agent_tz_stack, 84 .heap_addr = 0, 85 #if TFM_ISOLATION_LEVEL == 3 86 .assets = { 87 { 88 .mem.start = (uintptr_t)ns_agent_tz_stack, 89 90 .mem.limit = 91 (uintptr_t)&ns_agent_tz_stack[TFM_NS_AGENT_TZ_STACK_SIZE_ALIGNED], 92 .attr = ASSET_ATTR_READ_WRITE, 93 }, 94 }, 95 #endif 96 }; 97 #if defined(__ICCARM__) 98 /* Section priority: lowest */ 99 #pragma location = ".bss.part_runtime_priority_00" 100 __root 101 #endif 102 /* Placeholder for partition runtime space. Do not reference it. */ 103 static struct partition_t tfm_sp_ns_agent_tz_partition_runtime_item 104 __attribute__((used, section(".bss.part_runtime_priority_00"))); 105