11bb92983SJerome Forissier /* SPDX-License-Identifier: BSD-2-Clause */ 2b0104773SPascal Brand /* 3b0104773SPascal Brand * Copyright (c) 2014, STMicroelectronics International N.V. 4387b0ee3SEtienne Carriere * Copyright (c) 2018, Linaro Limited. 5b0104773SPascal Brand */ 6b0104773SPascal Brand 7b0104773SPascal Brand #ifndef USER_TA_HEADER_H 8b0104773SPascal Brand #define USER_TA_HEADER_H 9b0104773SPascal Brand 10b0104773SPascal Brand #include <tee_api_types.h> 11387b0ee3SEtienne Carriere #include <util.h> 12b0104773SPascal Brand 13fe8db355SJerome Forissier #define TA_FLAG_USER_MODE 0 /* Deprecated, was (1 << 0) */ 14fe8db355SJerome Forissier #define TA_FLAG_EXEC_DDR 0 /* Deprecated, was (1 << 1) */ 15b0104773SPascal Brand #define TA_FLAG_SINGLE_INSTANCE (1 << 2) 16b0104773SPascal Brand #define TA_FLAG_MULTI_SESSION (1 << 3) 1755d3ebe9SPascal Brand #define TA_FLAG_INSTANCE_KEEP_ALIVE (1 << 4) /* remains after last close */ 18c04e5c1dSEtienne Carriere #define TA_FLAG_SECURE_DATA_PATH (1 << 5) /* accesses SDP memory */ 19*80c4fb79SEtienne Carriere #define TA_FLAG_REMAP_SUPPORT 0 /* Deprecated, was (1 << 6) */ 2055d3ebe9SPascal Brand #define TA_FLAG_CACHE_MAINTENANCE (1 << 7) /* use cache flush syscall */ 21c7c4b6e3SJens Wiklander /* 22c7c4b6e3SJens Wiklander * TA instance can execute multiple sessions concurrently 23c7c4b6e3SJens Wiklander * (pseudo-TAs only). 24c7c4b6e3SJens Wiklander */ 25c7c4b6e3SJens Wiklander #define TA_FLAG_CONCURRENT (1 << 8) 260b611081SSumit Garg #define TA_FLAG_DEVICE_ENUM (1 << 9) /* device enumeration */ 2755d3ebe9SPascal Brand 28fe8db355SJerome Forissier #define TA_FLAGS_MASK GENMASK_32(9, 0) 29387b0ee3SEtienne Carriere 30e86f1266SJens Wiklander union ta_head_func_ptr { 31e86f1266SJens Wiklander uint64_t ptr64; 32e86f1266SJens Wiklander struct ta_head_func_ptr32 { 33e86f1266SJens Wiklander uint32_t lo; 34e86f1266SJens Wiklander uint32_t hi; 35e86f1266SJens Wiklander } ptr32; 36e86f1266SJens Wiklander }; 37e86f1266SJens Wiklander 38bc420748SJens Wiklander struct ta_head { 39bc420748SJens Wiklander TEE_UUID uuid; 40bc420748SJens Wiklander uint32_t stack_size; 41bc420748SJens Wiklander uint32_t flags; 422f04385cSJens Wiklander union ta_head_func_ptr entry; 43bc420748SJens Wiklander }; 44bc420748SJens Wiklander 4555d3ebe9SPascal Brand #define TA_PROP_STR_SINGLE_INSTANCE "gpd.ta.singleInstance" 4655d3ebe9SPascal Brand #define TA_PROP_STR_MULTI_SESSION "gpd.ta.multiSession" 4755d3ebe9SPascal Brand #define TA_PROP_STR_KEEP_ALIVE "gpd.ta.instanceKeepAlive" 4855d3ebe9SPascal Brand #define TA_PROP_STR_DATA_SIZE "gpd.ta.dataSize" 4955d3ebe9SPascal Brand #define TA_PROP_STR_STACK_SIZE "gpd.ta.stackSize" 50d71d2857SCedric Chaumont #define TA_PROP_STR_VERSION "gpd.ta.version" 51d71d2857SCedric Chaumont #define TA_PROP_STR_DESCRIPTION "gpd.ta.description" 5255d3ebe9SPascal Brand #define TA_PROP_STR_UNSAFE_PARAM "op-tee.unsafe_param" 5355d3ebe9SPascal Brand #define TA_PROP_STR_REMAP "op-tee.remap" 5455d3ebe9SPascal Brand #define TA_PROP_STR_CACHE_SYNC "op-tee.cache_sync" 55b0104773SPascal Brand 56b0104773SPascal Brand enum user_ta_prop_type { 57b0104773SPascal Brand USER_TA_PROP_TYPE_BOOL, /* bool */ 58b0104773SPascal Brand USER_TA_PROP_TYPE_U32, /* uint32_t */ 59b0104773SPascal Brand USER_TA_PROP_TYPE_UUID, /* TEE_UUID */ 60b0104773SPascal Brand USER_TA_PROP_TYPE_IDENTITY, /* TEE_Identity */ 61b0104773SPascal Brand USER_TA_PROP_TYPE_STRING, /* zero terminated string of char */ 62b0104773SPascal Brand USER_TA_PROP_TYPE_BINARY_BLOCK, /* zero terminated base64 coded string */ 63b0104773SPascal Brand }; 64b0104773SPascal Brand 65b0104773SPascal Brand enum user_ta_core_service_id { 66b0104773SPascal Brand USER_TA_CORE_ENTRY_MATH_INIT = 0x00000010, 67b0104773SPascal Brand USER_TA_CORE_ENTRY_GARBAGE = 0x00000011, 68b0104773SPascal Brand USER_TA_CORE_ENTRY_CLOSESESSION = 0x00000012, 69b0104773SPascal Brand }; 70b0104773SPascal Brand 71b0104773SPascal Brand struct user_ta_property { 72b0104773SPascal Brand const char *name; 73b0104773SPascal Brand enum user_ta_prop_type type; 74b0104773SPascal Brand const void *value; 75b0104773SPascal Brand }; 76b0104773SPascal Brand 77b0104773SPascal Brand extern const struct user_ta_property ta_props[]; 78b0104773SPascal Brand extern const size_t ta_num_props; 79b0104773SPascal Brand 80b0104773SPascal Brand /* Needed by TEE_CheckMemoryAccessRights() */ 81b0104773SPascal Brand extern uint32_t ta_param_types; 8268540524SIgor Opaniuk extern TEE_Param ta_params[TEE_NUM_PARAMS]; 83b0104773SPascal Brand 84b0104773SPascal Brand /* Trusted Application Function header */ 85b0104773SPascal Brand typedef struct ta_func_head { 86b0104773SPascal Brand uint32_t cmd_id; /* Trusted Application Function ID */ 87b0104773SPascal Brand uint32_t start; /* offset to start func */ 88b0104773SPascal Brand } ta_func_head_t; 89b0104773SPascal Brand 90b0104773SPascal Brand int tahead_get_trace_level(void); 91b0104773SPascal Brand 92b0104773SPascal Brand #endif /* USER_TA_HEADER_H */ 93