1 /* 2 * teek_client_type.h 3 * 4 * define exported structures 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 #ifndef TEE_CLIENT_TYPE_H 18 #define TEE_CLIENT_TYPE_H 19 20 #include <linux/list.h> 21 #include "teek_client_constants.h" 22 23 #ifndef NULL 24 #define NULL 0 25 #endif 26 27 struct teec_uuid { 28 uint32_t time_low; 29 uint16_t time_mid; 30 uint16_t timehi_and_version; 31 uint8_t clockseq_and_node[8]; 32 }; 33 34 struct teec_context { 35 void *dev; 36 uint8_t *ta_path; 37 struct list_head shrd_mem_list; 38 }; 39 40 struct teec_session { 41 uint32_t session_id; 42 struct teec_uuid service_id; 43 uint32_t ops_cnt; 44 struct teec_context *context; 45 }; 46 47 struct teec_sharedmemory { 48 void *buffer; 49 uint32_t size; 50 uint32_t flags; 51 uint32_t ops_cnt; 52 bool is_allocated; 53 struct list_head head; 54 struct teec_context *context; 55 }; 56 57 struct teec_tempmemory_reference { 58 void *buffer; 59 uint32_t size; 60 }; 61 62 struct teec_registeredmemory_reference { 63 struct teec_sharedmemory *parent; 64 uint32_t size; 65 uint32_t offset; 66 }; 67 68 69 struct teec_value { 70 uint32_t a; 71 uint32_t b; 72 }; 73 74 struct teec_ion_reference { 75 int ion_share_fd; 76 uint32_t ion_size; 77 }; 78 79 union teec_parameter { 80 struct teec_tempmemory_reference tmpref; 81 struct teec_registeredmemory_reference memref; 82 struct teec_value value; 83 struct teec_ion_reference ionref; 84 }; 85 86 struct teec_tui_parameter { 87 uint32_t event_type; 88 /* tui event type */ 89 uint32_t value; 90 /* return value, is keycode if tui event is getkeycode */ 91 uint32_t notch; /* notch size of phone */ 92 uint32_t width; /* width of foldable screen */ 93 uint32_t height; /* height of foldable screen */ 94 uint32_t fold_state; /* state of foldable screen */ 95 uint32_t display_state; /* one state of folded state */ 96 uint32_t phy_width; /* real width of the mobile */ 97 uint32_t phy_height; /* real height of the mobile */ 98 }; 99 100 struct teec_operation { 101 uint32_t started; 102 uint32_t paramtypes; 103 union teec_parameter params[4]; /* GP has four params */ 104 struct teec_session *session; 105 bool cancel_flag; 106 }; 107 108 typedef uint32_t TEEC_Result; 109 110 typedef struct teec_uuid TEEC_UUID; 111 112 typedef struct teec_context TEEC_Context; 113 114 typedef struct teec_session TEEC_Session; 115 116 typedef struct teec_sharedmemory TEEC_SharedMemory; 117 118 typedef struct teec_tempmemory_reference TEEC_TempMemoryReference; 119 120 typedef struct teec_registeredmemory_reference TEEC_RegisteredMemoryReference; 121 122 typedef struct teec_value TEEC_Value; 123 124 typedef struct teec_ion_reference TEEC_IonReference; 125 126 typedef union teec_parameter TEEC_Parameter; 127 128 typedef struct teec_tui_parameter TEEC_TUI_Parameter; 129 130 typedef struct { 131 uint32_t started; 132 uint32_t paramTypes; 133 TEEC_Parameter params[4]; 134 TEEC_Session *session; 135 bool cancel_flag; 136 } TEEC_Operation; 137 138 #endif 139