1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2014, STMicroelectronics International N.V. 4 * Copyright (c) 2018, Linaro Limited. 5 */ 6 7 #ifndef USER_TA_HEADER_H 8 #define USER_TA_HEADER_H 9 10 #include <tee_api_types.h> 11 #include <util.h> 12 13 #define TA_FLAG_SINGLE_INSTANCE (1 << 2) 14 #define TA_FLAG_MULTI_SESSION (1 << 3) 15 #define TA_FLAG_INSTANCE_KEEP_ALIVE (1 << 4) /* remains after last close */ 16 #define TA_FLAG_SECURE_DATA_PATH (1 << 5) /* accesses SDP memory */ 17 #define TA_FLAG_REMAP_SUPPORT (1 << 6) /* use map/unmap syscalls */ 18 #define TA_FLAG_CACHE_MAINTENANCE (1 << 7) /* use cache flush syscall */ 19 /* 20 * TA instance can execute multiple sessions concurrently 21 * (pseudo-TAs only). 22 */ 23 #define TA_FLAG_CONCURRENT (1 << 8) 24 25 #define TA_FLAGS_MASK GENMASK_32(8, 2) 26 27 /* Deprecated macros that will be removed in the 3.2 release */ 28 #define TA_FLAG_USER_MODE 0 29 #define TA_FLAG_EXEC_DDR 0 30 31 union ta_head_func_ptr { 32 uint64_t ptr64; 33 struct ta_head_func_ptr32 { 34 uint32_t lo; 35 uint32_t hi; 36 } ptr32; 37 }; 38 39 struct ta_head { 40 TEE_UUID uuid; 41 uint32_t stack_size; 42 uint32_t flags; 43 union ta_head_func_ptr entry; 44 }; 45 46 #define TA_PROP_STR_SINGLE_INSTANCE "gpd.ta.singleInstance" 47 #define TA_PROP_STR_MULTI_SESSION "gpd.ta.multiSession" 48 #define TA_PROP_STR_KEEP_ALIVE "gpd.ta.instanceKeepAlive" 49 #define TA_PROP_STR_DATA_SIZE "gpd.ta.dataSize" 50 #define TA_PROP_STR_STACK_SIZE "gpd.ta.stackSize" 51 #define TA_PROP_STR_VERSION "gpd.ta.version" 52 #define TA_PROP_STR_DESCRIPTION "gpd.ta.description" 53 #define TA_PROP_STR_UNSAFE_PARAM "op-tee.unsafe_param" 54 #define TA_PROP_STR_REMAP "op-tee.remap" 55 #define TA_PROP_STR_CACHE_SYNC "op-tee.cache_sync" 56 57 enum user_ta_prop_type { 58 USER_TA_PROP_TYPE_BOOL, /* bool */ 59 USER_TA_PROP_TYPE_U32, /* uint32_t */ 60 USER_TA_PROP_TYPE_UUID, /* TEE_UUID */ 61 USER_TA_PROP_TYPE_IDENTITY, /* TEE_Identity */ 62 USER_TA_PROP_TYPE_STRING, /* zero terminated string of char */ 63 USER_TA_PROP_TYPE_BINARY_BLOCK, /* zero terminated base64 coded string */ 64 }; 65 66 enum user_ta_core_service_id { 67 USER_TA_CORE_ENTRY_MATH_INIT = 0x00000010, 68 USER_TA_CORE_ENTRY_GARBAGE = 0x00000011, 69 USER_TA_CORE_ENTRY_CLOSESESSION = 0x00000012, 70 }; 71 72 struct user_ta_property { 73 const char *name; 74 enum user_ta_prop_type type; 75 const void *value; 76 }; 77 78 extern const struct user_ta_property ta_props[]; 79 extern const size_t ta_num_props; 80 81 /* Needed by TEE_CheckMemoryAccessRights() */ 82 extern uint32_t ta_param_types; 83 extern TEE_Param ta_params[TEE_NUM_PARAMS]; 84 85 /* Trusted Application Function header */ 86 typedef struct ta_func_head { 87 uint32_t cmd_id; /* Trusted Application Function ID */ 88 uint32_t start; /* offset to start func */ 89 } ta_func_head_t; 90 91 int tahead_get_trace_level(void); 92 93 #endif /* USER_TA_HEADER_H */ 94