1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _UAPI_QSEECOM_H_
20 #define _UAPI_QSEECOM_H_
21 #include <linux/types.h>
22 #include <linux/ioctl.h>
23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
24 #define MAX_ION_FD 4
25 #define MAX_APP_NAME_SIZE 64
26 #define QSEECOM_HASH_SIZE 32
27 struct qseecom_register_listener_req {
28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
29   uint32_t listener_id;
30   int32_t ifd_data_fd;
31   void * virt_sb_base;
32   uint32_t sb_size;
33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
34 };
35 struct qseecom_send_cmd_req {
36   void * cmd_req_buf;
37   unsigned int cmd_req_len;
38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
39   void * resp_buf;
40   unsigned int resp_len;
41 };
42 struct qseecom_ion_fd_info {
43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
44   int32_t fd;
45   uint32_t cmd_buf_offset;
46 };
47 struct qseecom_send_modfd_cmd_req {
48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
49   void * cmd_req_buf;
50   unsigned int cmd_req_len;
51   void * resp_buf;
52   unsigned int resp_len;
53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
54   struct qseecom_ion_fd_info ifd_data[MAX_ION_FD];
55 };
56 struct qseecom_send_resp_req {
57   void * resp_buf;
58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
59   unsigned int resp_len;
60 };
61 struct qseecom_load_img_req {
62   uint32_t mdt_len;
63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
64   uint32_t img_len;
65   int32_t ifd_data_fd;
66   char img_name[MAX_APP_NAME_SIZE];
67   uint32_t app_arch;
68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
69   int app_id;
70 };
71 struct qseecom_set_sb_mem_param_req {
72   int32_t ifd_data_fd;
73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
74   void * virt_sb_base;
75   uint32_t sb_len;
76 };
77 struct qseecom_qseos_version_req {
78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
79   unsigned int qseos_version;
80 };
81 struct qseecom_qseos_app_load_query {
82   char app_name[MAX_APP_NAME_SIZE];
83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
84   int app_id;
85   uint32_t app_arch;
86 };
87 struct qseecom_send_svc_cmd_req {
88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
89   uint32_t cmd_id;
90   void * cmd_req_buf;
91   unsigned int cmd_req_len;
92   void * resp_buf;
93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94   unsigned int resp_len;
95 };
96 enum qseecom_key_management_usage_type {
97   QSEOS_KM_USAGE_DISK_ENCRYPTION = 0x01,
98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99   QSEOS_KM_USAGE_FILE_ENCRYPTION = 0x02,
100   QSEOS_KM_USAGE_UFS_ICE_DISK_ENCRYPTION = 0x03,
101   QSEOS_KM_USAGE_SDCC_ICE_DISK_ENCRYPTION = 0x04,
102   QSEOS_KM_USAGE_MAX
103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
104 };
105 struct qseecom_create_key_req {
106   unsigned char hash32[QSEECOM_HASH_SIZE];
107   enum qseecom_key_management_usage_type usage;
108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
109 };
110 struct qseecom_wipe_key_req {
111   enum qseecom_key_management_usage_type usage;
112   int wipe_key_flag;
113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
114 };
115 struct qseecom_update_key_userinfo_req {
116   unsigned char current_hash32[QSEECOM_HASH_SIZE];
117   unsigned char new_hash32[QSEECOM_HASH_SIZE];
118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119   enum qseecom_key_management_usage_type usage;
120 };
121 #define SHA256_DIGEST_LENGTH (256 / 8)
122 struct qseecom_save_partition_hash_req {
123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
124   int partition_id;
125   char digest[SHA256_DIGEST_LENGTH];
126 };
127 struct qseecom_is_es_activated_req {
128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129   int is_activated;
130 };
131 struct qseecom_mdtp_cipher_dip_req {
132   uint8_t * in_buf;
133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134   uint32_t in_buf_size;
135   uint8_t * out_buf;
136   uint32_t out_buf_size;
137   uint32_t direction;
138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
139 };
140 enum qseecom_bandwidth_request_mode {
141   INACTIVE = 0,
142   LOW,
143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
144   MEDIUM,
145   HIGH,
146 };
147 struct qseecom_send_modfd_listener_resp {
148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
149   void * resp_buf_ptr;
150   unsigned int resp_len;
151   struct qseecom_ion_fd_info ifd_data[MAX_ION_FD];
152 };
153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154 struct qseecom_qteec_req {
155   void * req_ptr;
156   uint32_t req_len;
157   void * resp_ptr;
158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159   uint32_t resp_len;
160 };
161 struct qseecom_qteec_modfd_req {
162   void * req_ptr;
163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
164   uint32_t req_len;
165   void * resp_ptr;
166   uint32_t resp_len;
167   struct qseecom_ion_fd_info ifd_data[MAX_ION_FD];
168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
169 };
170 struct qseecom_sg_entry {
171   uint32_t phys_addr;
172   uint32_t len;
173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
174 };
175 struct qseecom_sg_entry_64bit {
176   uint64_t phys_addr;
177   uint32_t len;
178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
179 } __attribute__((packed));
180 #define QSEECOM_SG_LIST_BUF_FORMAT_VERSION_1 1
181 #define QSEECOM_SG_LIST_BUF_FORMAT_VERSION_2 2
182 struct qseecom_sg_list_buf_hdr_64bit {
183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
184   struct qseecom_sg_entry_64bit blank_entry;
185   uint32_t version;
186   uint64_t new_buf_phys_addr;
187   uint32_t nents_total;
188 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
189 } __attribute__((packed));
190 #define QSEECOM_SG_LIST_BUF_HDR_SZ_64BIT sizeof(struct qseecom_sg_list_buf_hdr_64bit)
191 #define MAX_CE_PIPE_PAIR_PER_UNIT 3
192 #define INVALID_CE_INFO_UNIT_NUM 0xffffffff
193 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
194 #define CE_PIPE_PAIR_USE_TYPE_FDE 0
195 #define CE_PIPE_PAIR_USE_TYPE_PFE 1
196 struct qseecom_ce_pipe_entry {
197   int valid;
198 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
199   unsigned int ce_num;
200   unsigned int ce_pipe_pair;
201 };
202 #define MAX_CE_INFO_HANDLE_SIZE 32
203 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
204 struct qseecom_ce_info_req {
205   unsigned char handle[MAX_CE_INFO_HANDLE_SIZE];
206   unsigned int usage;
207   unsigned int unit_num;
208 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
209   unsigned int num_ce_pipe_entries;
210   struct qseecom_ce_pipe_entry ce_pipe_entry[MAX_CE_PIPE_PAIR_PER_UNIT];
211 };
212 #define SG_ENTRY_SZ sizeof(struct qseecom_sg_entry)
213 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
214 #define SG_ENTRY_SZ_64BIT sizeof(struct qseecom_sg_entry_64bit)
215 struct file;
216 #define QSEECOM_IOC_MAGIC 0x97
217 #define QSEECOM_IOCTL_REGISTER_LISTENER_REQ _IOWR(QSEECOM_IOC_MAGIC, 1, struct qseecom_register_listener_req)
218 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
219 #define QSEECOM_IOCTL_UNREGISTER_LISTENER_REQ _IO(QSEECOM_IOC_MAGIC, 2)
220 #define QSEECOM_IOCTL_SEND_CMD_REQ _IOWR(QSEECOM_IOC_MAGIC, 3, struct qseecom_send_cmd_req)
221 #define QSEECOM_IOCTL_SEND_MODFD_CMD_REQ _IOWR(QSEECOM_IOC_MAGIC, 4, struct qseecom_send_modfd_cmd_req)
222 #define QSEECOM_IOCTL_RECEIVE_REQ _IO(QSEECOM_IOC_MAGIC, 5)
223 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
224 #define QSEECOM_IOCTL_SEND_RESP_REQ _IO(QSEECOM_IOC_MAGIC, 6)
225 #define QSEECOM_IOCTL_LOAD_APP_REQ _IOWR(QSEECOM_IOC_MAGIC, 7, struct qseecom_load_img_req)
226 #define QSEECOM_IOCTL_SET_MEM_PARAM_REQ _IOWR(QSEECOM_IOC_MAGIC, 8, struct qseecom_set_sb_mem_param_req)
227 #define QSEECOM_IOCTL_UNLOAD_APP_REQ _IO(QSEECOM_IOC_MAGIC, 9)
228 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
229 #define QSEECOM_IOCTL_GET_QSEOS_VERSION_REQ _IOWR(QSEECOM_IOC_MAGIC, 10, struct qseecom_qseos_version_req)
230 #define QSEECOM_IOCTL_PERF_ENABLE_REQ _IO(QSEECOM_IOC_MAGIC, 11)
231 #define QSEECOM_IOCTL_PERF_DISABLE_REQ _IO(QSEECOM_IOC_MAGIC, 12)
232 #define QSEECOM_IOCTL_LOAD_EXTERNAL_ELF_REQ _IOWR(QSEECOM_IOC_MAGIC, 13, struct qseecom_load_img_req)
233 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
234 #define QSEECOM_IOCTL_UNLOAD_EXTERNAL_ELF_REQ _IO(QSEECOM_IOC_MAGIC, 14)
235 #define QSEECOM_IOCTL_APP_LOADED_QUERY_REQ _IOWR(QSEECOM_IOC_MAGIC, 15, struct qseecom_qseos_app_load_query)
236 #define QSEECOM_IOCTL_SEND_CMD_SERVICE_REQ _IOWR(QSEECOM_IOC_MAGIC, 16, struct qseecom_send_svc_cmd_req)
237 #define QSEECOM_IOCTL_CREATE_KEY_REQ _IOWR(QSEECOM_IOC_MAGIC, 17, struct qseecom_create_key_req)
238 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
239 #define QSEECOM_IOCTL_WIPE_KEY_REQ _IOWR(QSEECOM_IOC_MAGIC, 18, struct qseecom_wipe_key_req)
240 #define QSEECOM_IOCTL_SAVE_PARTITION_HASH_REQ _IOWR(QSEECOM_IOC_MAGIC, 19, struct qseecom_save_partition_hash_req)
241 #define QSEECOM_IOCTL_IS_ES_ACTIVATED_REQ _IOWR(QSEECOM_IOC_MAGIC, 20, struct qseecom_is_es_activated_req)
242 #define QSEECOM_IOCTL_SEND_MODFD_RESP _IOWR(QSEECOM_IOC_MAGIC, 21, struct qseecom_send_modfd_listener_resp)
243 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
244 #define QSEECOM_IOCTL_SET_BUS_SCALING_REQ _IOWR(QSEECOM_IOC_MAGIC, 23, int)
245 #define QSEECOM_IOCTL_UPDATE_KEY_USER_INFO_REQ _IOWR(QSEECOM_IOC_MAGIC, 24, struct qseecom_update_key_userinfo_req)
246 #define QSEECOM_QTEEC_IOCTL_OPEN_SESSION_REQ _IOWR(QSEECOM_IOC_MAGIC, 30, struct qseecom_qteec_modfd_req)
247 #define QSEECOM_QTEEC_IOCTL_CLOSE_SESSION_REQ _IOWR(QSEECOM_IOC_MAGIC, 31, struct qseecom_qteec_req)
248 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
249 #define QSEECOM_QTEEC_IOCTL_INVOKE_MODFD_CMD_REQ _IOWR(QSEECOM_IOC_MAGIC, 32, struct qseecom_qteec_modfd_req)
250 #define QSEECOM_QTEEC_IOCTL_REQUEST_CANCELLATION_REQ _IOWR(QSEECOM_IOC_MAGIC, 33, struct qseecom_qteec_modfd_req)
251 #define QSEECOM_IOCTL_MDTP_CIPHER_DIP_REQ _IOWR(QSEECOM_IOC_MAGIC, 34, struct qseecom_mdtp_cipher_dip_req)
252 #define QSEECOM_IOCTL_SEND_MODFD_CMD_64_REQ _IOWR(QSEECOM_IOC_MAGIC, 35, struct qseecom_send_modfd_cmd_req)
253 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
254 #define QSEECOM_IOCTL_SEND_MODFD_RESP_64 _IOWR(QSEECOM_IOC_MAGIC, 36, struct qseecom_send_modfd_listener_resp)
255 #define QSEECOM_IOCTL_GET_CE_PIPE_INFO _IOWR(QSEECOM_IOC_MAGIC, 40, struct qseecom_ce_info_req)
256 #define QSEECOM_IOCTL_FREE_CE_PIPE_INFO _IOWR(QSEECOM_IOC_MAGIC, 41, struct qseecom_ce_info_req)
257 #define QSEECOM_IOCTL_QUERY_CE_PIPE_INFO _IOWR(QSEECOM_IOC_MAGIC, 42, struct qseecom_ce_info_req)
258 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
259 #endif
260 
261