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_USER_MODE 0 /* Deprecated, was (1 << 0) */ 14 #define TA_FLAG_EXEC_DDR 0 /* Deprecated, was (1 << 1) */ 15 #define TA_FLAG_SINGLE_INSTANCE (1 << 2) 16 #define TA_FLAG_MULTI_SESSION (1 << 3) 17 #define TA_FLAG_INSTANCE_KEEP_ALIVE (1 << 4) /* remains after last close */ 18 #define TA_FLAG_SECURE_DATA_PATH (1 << 5) /* accesses SDP memory */ 19 #define TA_FLAG_REMAP_SUPPORT 0 /* Deprecated, was (1 << 6) */ 20 #define TA_FLAG_CACHE_MAINTENANCE (1 << 7) /* use cache flush syscall */ 21 /* 22 * TA instance can execute multiple sessions concurrently 23 * (pseudo-TAs only). 24 */ 25 #define TA_FLAG_CONCURRENT (1 << 8) 26 #define TA_FLAG_DEVICE_ENUM (1 << 9) /* device enumeration */ 27 28 #define TA_FLAGS_MASK GENMASK_32(9, 0) 29 30 struct ta_head { 31 TEE_UUID uuid; 32 uint32_t stack_size; 33 uint32_t flags; 34 uint64_t depr_entry; 35 }; 36 37 #define TA_PROP_STR_SINGLE_INSTANCE "gpd.ta.singleInstance" 38 #define TA_PROP_STR_MULTI_SESSION "gpd.ta.multiSession" 39 #define TA_PROP_STR_KEEP_ALIVE "gpd.ta.instanceKeepAlive" 40 #define TA_PROP_STR_DATA_SIZE "gpd.ta.dataSize" 41 #define TA_PROP_STR_STACK_SIZE "gpd.ta.stackSize" 42 #define TA_PROP_STR_VERSION "gpd.ta.version" 43 #define TA_PROP_STR_DESCRIPTION "gpd.ta.description" 44 #define TA_PROP_STR_UNSAFE_PARAM "op-tee.unsafe_param" 45 #define TA_PROP_STR_REMAP "op-tee.remap" 46 #define TA_PROP_STR_CACHE_SYNC "op-tee.cache_sync" 47 48 enum user_ta_prop_type { 49 USER_TA_PROP_TYPE_BOOL, /* bool */ 50 USER_TA_PROP_TYPE_U32, /* uint32_t */ 51 USER_TA_PROP_TYPE_UUID, /* TEE_UUID */ 52 USER_TA_PROP_TYPE_IDENTITY, /* TEE_Identity */ 53 USER_TA_PROP_TYPE_STRING, /* zero terminated string of char */ 54 USER_TA_PROP_TYPE_BINARY_BLOCK, /* zero terminated base64 coded string */ 55 }; 56 57 enum user_ta_core_service_id { 58 USER_TA_CORE_ENTRY_MATH_INIT = 0x00000010, 59 USER_TA_CORE_ENTRY_GARBAGE = 0x00000011, 60 USER_TA_CORE_ENTRY_CLOSESESSION = 0x00000012, 61 }; 62 63 struct user_ta_property { 64 const char *name; 65 enum user_ta_prop_type type; 66 const void *value; 67 }; 68 69 extern const struct user_ta_property ta_props[]; 70 extern const size_t ta_num_props; 71 72 /* Needed by TEE_CheckMemoryAccessRights() */ 73 extern uint32_t ta_param_types; 74 extern TEE_Param ta_params[TEE_NUM_PARAMS]; 75 76 /* Trusted Application Function header */ 77 typedef struct ta_func_head { 78 uint32_t cmd_id; /* Trusted Application Function ID */ 79 uint32_t start; /* offset to start func */ 80 } ta_func_head_t; 81 82 int tahead_get_trace_level(void); 83 84 #endif /* USER_TA_HEADER_H */ 85