1 /* 2 * teek_client_constants.h 3 * 4 * macro declaration for libteec interface for kernel CA. 5 * 6 * Copyright (C) 2022 Huawei Technologies Co., Ltd. 7 * 8 * This software is licensed under the terms of the GNU General Public 9 * License version 2, as published by the Free Software Foundation, and 10 * may be copied, distributed, and modified under those terms. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 */ 17 18 #ifndef TEEK_CLIENT_CONSTANTS_H 19 #define TEEK_CLIENT_CONSTANTS_H 20 21 enum global_service_cmd_id { 22 GLOBAL_CMD_ID_INVALID = 0x0, 23 GLOBAL_CMD_ID_BOOT_ACK = 0x1, 24 GLOBAL_CMD_ID_OPEN_SESSION = 0x2, 25 GLOBAL_CMD_ID_CLOSE_SESSION = 0x3, 26 GLOBAL_CMD_ID_LOAD_SECURE_APP = 0x4, 27 GLOBAL_CMD_ID_NEED_LOAD_APP = 0x5, 28 GLOBAL_CMD_ID_REGISTER_AGENT = 0x6, 29 GLOBAL_CMD_ID_UNREGISTER_AGENT = 0x7, 30 GLOBAL_CMD_ID_REGISTER_NOTIFY_MEMORY = 0x8, 31 GLOBAL_CMD_ID_UNREGISTER_NOTIFY_MEMORY = 0x9, 32 GLOBAL_CMD_ID_INIT_CONTENT_PATH = 0xa, 33 GLOBAL_CMD_ID_TERMINATE_CONTENT_PATH = 0xb, 34 GLOBAL_CMD_ID_ALLOC_EXCEPTION_MEM = 0xc, 35 GLOBAL_CMD_ID_TEE_TIME = 0xd, 36 GLOBAL_CMD_ID_TEE_INFO = 0xe, 37 GLOBAL_CMD_ID_REGISTER_LOG_MEM = 0xf, 38 GLOBAL_CMD_ID_KILL_TASK = 0x10, 39 GLOBAL_CMD_ID_TUI_EXCEPTION = 0x11, 40 GLOBAL_CMD_ID_ADJUST_TIME = 0x12, 41 GLOBAL_CMD_ID_SET_CA_HASH = 0x13, 42 /* set the Android's build version */ 43 GLOBAL_CMD_ID_SET_BUILD_VERSION = 0x14, 44 GLOBAL_CMD_ID_REGISTER_TTF_MEM = 0x15, 45 /* get session key for encrypting dialog */ 46 GLOBAL_CMD_ID_GET_SESSION_SECURE_PARAMS = 0x16, 47 GLOBAL_CMD_ID_REGISTER_MAILBOX = 0x17, 48 GLOBAL_CMD_ID_REGISTER_UNUSUAL_TTF_MEM = 0x18, 49 GLOBAL_CMD_ID_REGISTER_ION_MEM = 0x19, 50 GLOBAL_CMD_ID_DUMP_MEMINFO = 0x1a, 51 /* this cmd will be used to service no ca handle cmd */ 52 GLOBAL_CMD_ID_SET_SERVE_CMD = 0x1b, 53 GLOBAL_CMD_ID_ADD_DYNAMIC_ION = 0x1c, 54 GLOBAL_CMD_ID_DEL_DYNAMIC_ION = 0x1d, 55 GLOBAL_CMD_ID_RELEASE_ION_SRV = 0x1e, 56 /* this cmd for tui to get notch_size */ 57 GLOBAL_CMD_ID_TUI_NOTCH = 0x1f, 58 GLOBAL_CMD_ID_LATE_INIT = 0x20, 59 /* this cmd for tui to get information of foldable screen */ 60 GLOBAL_CMD_ID_TUI_FOLD = 0x21, 61 GLOBAL_CMD_ID_GET_TEE_VERSION = 0x22, 62 #ifdef CONFIG_CMS_SIGNATURE 63 GLOBAL_CMD_ID_UPDATE_TA_CRL = 0x23, 64 #endif 65 GLOBAL_CMD_ID_REGISTER_RESMEM = 0x24, 66 GLOBAL_CMD_ID_DUMP_SRV_SESS = 0x25, 67 GLOBAL_CMD_ID_TRACE_ENABLE = 0x26, 68 #ifdef CONFIG_LIVEPATCH_ENABLE 69 GLOBAL_CMD_ID_LIVEPATCH_UNLOAD = 0x27, 70 GLOBAL_CMD_ID_LIVEPATCH_ENABLE = 0x28, 71 GLOBAL_CMD_ID_LIVEPATCH_DISABLE = 0x29, 72 GLOBAL_CMD_ID_LIVEPATCH_QUERY = 0x2a, 73 #endif 74 GLOBAL_CMD_ID_UNKNOWN = 0x7FFFFFFE, 75 GLOBAL_CMD_ID_MAX = 0x7FFFFFFF 76 }; 77 78 enum teec_result { 79 TEEC_SUCCESS = 0x0, 80 TEEC_ERROR_INVALID_CMD = 0x1, 81 TEEC_ERROR_SERVICE_NOT_EXIST = 0x2, 82 TEEC_ERROR_SESSION_NOT_EXIST = 0x3, 83 TEEC_ERROR_SESSION_MAXIMUM, 84 TEEC_ERROR_REGISTER_EXIST_SERVICE, 85 TEEC_ERROR_TAGET_DEAD_FATAL, 86 TEEC_ERROR_READ_DATA, 87 TEEC_ERROR_WRITE_DATA, 88 TEEC_ERROR_TRUNCATE_OBJECT, 89 TEEC_ERROR_SEEK_DATA, 90 TEEC_ERROR_RENAME_OBJECT, 91 TEEC_ERROR_TRUSTED_APP_LOAD_ERROR, 92 TEEC_ERROR_GENERIC = 0xFFFF0000, 93 TEEC_ERROR_ACCESS_DENIED = 0xFFFF0001, 94 TEEC_ERROR_CANCEL = 0xFFFF0002, 95 TEEC_ERROR_ACCESS_CONFLICT = 0xFFFF0003, 96 TEEC_ERROR_EXCESS_DATA = 0xFFFF0004, 97 TEEC_ERROR_BAD_FORMAT = 0xFFFF0005, 98 TEEC_ERROR_BAD_PARAMETERS = 0xFFFF0006, 99 TEEC_ERROR_BAD_STATE = 0xFFFF0007, 100 TEEC_ERROR_ITEM_NOT_FOUND = 0xFFFF0008, 101 TEEC_ERROR_NOT_IMPLEMENTED = 0xFFFF0009, 102 TEEC_ERROR_NOT_SUPPORTED = 0xFFFF000A, 103 TEEC_ERROR_NO_DATA = 0xFFFF000B, 104 TEEC_ERROR_OUT_OF_MEMORY = 0xFFFF000C, 105 TEEC_ERROR_BUSY = 0xFFFF000D, 106 TEEC_ERROR_COMMUNICATION = 0xFFFF000E, 107 TEEC_ERROR_SECURITY = 0xFFFF000F, 108 TEEC_ERROR_SHORT_BUFFER = 0xFFFF0010, 109 TEEC_PENDING = 0xFFFF2000, 110 TEEC_PENDING2 = 0xFFFF2001, 111 TEE_ERROR_TAGET_DEAD = 0xFFFF3024, 112 TEE_ERROR_GT_DEAD = 0xFFFF3124, 113 TEEC_ERROR_MAC_INVALID = 0xFFFF3071, 114 TEEC_CLIENT_INTR = 0xFFFF4000, 115 TEEC_ERROR_TUI_IN_USE = 0xFFFF7110, 116 TEEC_ERROR_TUI_SWITCH_CHANNAL, 117 TEEC_ERROR_TUI_CFG_DRIVER, 118 TEEC_ERROR_TUI_INVALID_EVENT, 119 TEEC_ERROR_TUI_POLL_EVENT, 120 TEEC_ERROR_TUI_CANCELED, 121 TEEC_ERROR_TUI_EXIT, 122 TEEC_ERROR_TUI_NOT_AVAILABLE, 123 TEEC_ERROR_SEC_FLASH_NOT_AVAILABLE, 124 TEEC_ERROR_CA_AUTH_FAIL = 0xFFFFCFE5, 125 TEE_ERROR_AUDIT_FAIL = 0xFFFF9112, 126 TEE_ERROR_IS_DEAD = 0xFFFFABAB, 127 }; 128 129 enum TEEC_ReturnCodeOrigin { 130 TEEC_ORIGIN_API = 0x1, 131 TEEC_ORIGIN_COMMS = 0x2, 132 TEEC_ORIGIN_TEE = 0x3, 133 TEEC_ORIGIN_TRUSTED_APP = 0x4, 134 }; 135 136 enum TEEC_SharedMemCtl { 137 TEEC_MEM_INPUT = 0x1, 138 TEEC_MEM_OUTPUT = 0x2, 139 TEEC_MEM_INOUT = 0x3, 140 }; 141 142 enum TEEC_ParamType { 143 TEEC_NONE = 0x0, 144 TEEC_VALUE_INPUT = 0x01, 145 TEEC_VALUE_OUTPUT = 0x02, 146 TEEC_VALUE_INOUT = 0x03, 147 TEEC_MEMREF_TEMP_INPUT = 0x05, 148 TEEC_MEMREF_TEMP_OUTPUT = 0x06, 149 TEEC_MEMREF_TEMP_INOUT = 0x07, 150 TEEC_ION_INPUT = 0x08, 151 TEEC_ION_SGLIST_INPUT = 0x09, 152 TEEC_MEMREF_SHARED_INOUT = 0x0a, 153 TEEC_MEMREF_WHOLE = 0xc, 154 TEEC_MEMREF_PARTIAL_INPUT = 0xd, 155 TEEC_MEMREF_PARTIAL_OUTPUT = 0xe, 156 TEEC_MEMREF_PARTIAL_INOUT = 0xf 157 }; 158 159 enum TEE_ParamType { 160 TEE_PARAM_TYPE_NONE = 0x0, 161 TEE_PARAM_TYPE_VALUE_INPUT = 0x1, 162 TEE_PARAM_TYPE_VALUE_OUTPUT = 0x2, 163 TEE_PARAM_TYPE_VALUE_INOUT = 0x3, 164 TEE_PARAM_TYPE_MEMREF_INPUT = 0x5, 165 TEE_PARAM_TYPE_MEMREF_OUTPUT = 0x6, 166 TEE_PARAM_TYPE_MEMREF_INOUT = 0x7, 167 TEE_PARAM_TYPE_ION_INPUT = 0x8, 168 TEE_PARAM_TYPE_ION_SGLIST_INPUT = 0x9, 169 TEE_PARAM_TYPE_MEMREF_SHARED_INOUT = 0x0a, 170 TEE_PARAM_TYPE_RESMEM_INPUT = 0xc, 171 TEE_PARAM_TYPE_RESMEM_OUTPUT = 0xd, 172 TEE_PARAM_TYPE_RESMEM_INOUT = 0xe 173 }; 174 175 enum TEEC_LoginMethod { 176 TEEC_LOGIN_PUBLIC = 0x0, 177 TEEC_LOGIN_USER, 178 TEEC_LOGIN_GROUP, 179 TEEC_LOGIN_APPLICATION = 0x4, 180 TEEC_LOGIN_USER_APPLICATION = 0x5, 181 TEEC_LOGIN_GROUP_APPLICATION = 0x6, 182 TEEC_LOGIN_IDENTIFY = 0x7, 183 TEEK_LOGIN_IDENTIFY = 0x80000001, 184 }; 185 186 /* Add event id's name in 'view_state[]' in same order */ 187 enum tee_event_id { 188 INVOKE_CMD_START, 189 INVOKE_CMD_END, 190 SMC_SEND, 191 SMC_DONE, 192 SMC_IN, 193 SMC_OUT, 194 SMC_SLEEP, 195 SMC_PREEMPT, 196 GTASK_GET_CMD, 197 GTASK_PUT_CMD, 198 GTASK_REQ_TA, 199 GTASK_RESP_TA, 200 SPI_WAKEUP, 201 SCHED_IN, 202 SCHED_OUT, 203 INTERRUPT_HANDLE_SPI_START, 204 INTERRUPT_HANDLE_SPI_REE_RESPONSE, 205 INTERRUPT_HANDLE_SPI_REE_MISS, 206 INTERRUPT_HANDLE_SPI_REE_SCHEDULED, 207 INTERRUPT_HANDLE_SPI_END, 208 INTERRUPT_HANDLE_START, 209 INTERRUPT_HANDLE_END, 210 TEE_EVENT_MAX 211 }; 212 213 #define TZ_WQ_MAX_ACTIVE 1 214 #endif 215