• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 _QSEECOM_H_
20 #define _QSEECOM_H_
21 #include <linux/types.h>
22 #include <linux/ioctl.h>
23 #define MAX_ION_FD 4
24 #define MAX_APP_NAME_SIZE 64
25 #define QSEECOM_HASH_SIZE 32
26 #define QSEECOM_TA_ION_ALLOCATE_DELAY 50
27 #define QSEECOM_TA_ION_ALLOCATE_MAX_ATTEMP 20
28 #define ICE_KEY_SIZE 32
29 #define ICE_SALT_SIZE 32
30 struct qseecom_register_listener_req {
31   uint32_t listener_id;
32   int32_t ifd_data_fd;
33   void * virt_sb_base;
34   uint32_t sb_size;
35 };
36 struct qseecom_send_cmd_req {
37   void * cmd_req_buf;
38   unsigned int cmd_req_len;
39   void * resp_buf;
40   unsigned int resp_len;
41 };
42 struct qseecom_ion_fd_info {
43   int32_t fd;
44   uint32_t cmd_buf_offset;
45 };
46 struct qseecom_send_modfd_cmd_req {
47   void * cmd_req_buf;
48   unsigned int cmd_req_len;
49   void * resp_buf;
50   unsigned int resp_len;
51   struct qseecom_ion_fd_info ifd_data[MAX_ION_FD];
52 };
53 struct qseecom_send_resp_req {
54   void * resp_buf;
55   unsigned int resp_len;
56 };
57 struct qseecom_load_img_req {
58   uint32_t mdt_len;
59   uint32_t img_len;
60   int32_t ifd_data_fd;
61   char img_name[MAX_APP_NAME_SIZE];
62   uint32_t app_arch;
63   uint32_t app_id;
64 };
65 struct qseecom_set_sb_mem_param_req {
66   int32_t ifd_data_fd;
67   void * virt_sb_base;
68   uint32_t sb_len;
69 };
70 struct qseecom_qseos_version_req {
71   unsigned int qseos_version;
72 };
73 struct qseecom_qseos_app_load_query {
74   char app_name[MAX_APP_NAME_SIZE];
75   uint32_t app_id;
76   uint32_t app_arch;
77 };
78 struct qseecom_send_svc_cmd_req {
79   uint32_t cmd_id;
80   void * cmd_req_buf;
81   unsigned int cmd_req_len;
82   void * resp_buf;
83   unsigned int resp_len;
84 };
85 enum qseecom_key_management_usage_type {
86   QSEOS_KM_USAGE_DISK_ENCRYPTION = 0x01,
87   QSEOS_KM_USAGE_FILE_ENCRYPTION = 0x02,
88   QSEOS_KM_USAGE_UFS_ICE_DISK_ENCRYPTION = 0x03,
89   QSEOS_KM_USAGE_SDCC_ICE_DISK_ENCRYPTION = 0x04,
90   QSEOS_KM_USAGE_MAX
91 };
92 struct qseecom_create_key_req {
93   unsigned char hash32[QSEECOM_HASH_SIZE];
94   enum qseecom_key_management_usage_type usage;
95 };
96 struct qseecom_wipe_key_req {
97   enum qseecom_key_management_usage_type usage;
98   int wipe_key_flag;
99 };
100 struct qseecom_update_key_userinfo_req {
101   unsigned char current_hash32[QSEECOM_HASH_SIZE];
102   unsigned char new_hash32[QSEECOM_HASH_SIZE];
103   enum qseecom_key_management_usage_type usage;
104 };
105 #define SHA256_DIGEST_LENGTH (256 / 8)
106 struct qseecom_save_partition_hash_req {
107   int partition_id;
108   char digest[SHA256_DIGEST_LENGTH];
109 };
110 struct qseecom_is_es_activated_req {
111   int is_activated;
112 };
113 struct qseecom_mdtp_cipher_dip_req {
114   uint8_t * in_buf;
115   uint32_t in_buf_size;
116   uint8_t * out_buf;
117   uint32_t out_buf_size;
118   uint32_t direction;
119 };
120 enum qseecom_bandwidth_request_mode {
121   INACTIVE = 0,
122   LOW,
123   MEDIUM,
124   HIGH,
125 };
126 struct qseecom_send_modfd_listener_resp {
127   void * resp_buf_ptr;
128   unsigned int resp_len;
129   struct qseecom_ion_fd_info ifd_data[MAX_ION_FD];
130 };
131 struct qseecom_qteec_req {
132   void * req_ptr;
133   uint32_t req_len;
134   void * resp_ptr;
135   uint32_t resp_len;
136 };
137 struct qseecom_qteec_modfd_req {
138   void * req_ptr;
139   uint32_t req_len;
140   void * resp_ptr;
141   uint32_t resp_len;
142   struct qseecom_ion_fd_info ifd_data[MAX_ION_FD];
143 };
144 struct qseecom_sg_entry {
145   uint32_t phys_addr;
146   uint32_t len;
147 };
148 struct qseecom_sg_entry_64bit {
149   uint64_t phys_addr;
150   uint32_t len;
151 } __attribute__((packed));
152 #define QSEECOM_SG_LIST_BUF_FORMAT_VERSION_1 1
153 #define QSEECOM_SG_LIST_BUF_FORMAT_VERSION_2 2
154 struct qseecom_sg_list_buf_hdr_64bit {
155   struct qseecom_sg_entry_64bit blank_entry;
156   uint32_t version;
157   uint64_t new_buf_phys_addr;
158   uint32_t nents_total;
159 } __attribute__((packed));
160 #define QSEECOM_SG_LIST_BUF_HDR_SZ_64BIT sizeof(struct qseecom_sg_list_buf_hdr_64bit)
161 #define MAX_CE_PIPE_PAIR_PER_UNIT 3
162 #define INVALID_CE_INFO_UNIT_NUM 0xffffffff
163 #define CE_PIPE_PAIR_USE_TYPE_FDE 0
164 #define CE_PIPE_PAIR_USE_TYPE_PFE 1
165 struct qseecom_ce_pipe_entry {
166   int valid;
167   unsigned int ce_num;
168   unsigned int ce_pipe_pair;
169 };
170 struct qseecom_ice_data_t {
171   int flag;
172 };
173 #define MAX_CE_INFO_HANDLE_SIZE 32
174 struct qseecom_ce_info_req {
175   unsigned char handle[MAX_CE_INFO_HANDLE_SIZE];
176   unsigned int usage;
177   unsigned int unit_num;
178   unsigned int num_ce_pipe_entries;
179   struct qseecom_ce_pipe_entry ce_pipe_entry[MAX_CE_PIPE_PAIR_PER_UNIT];
180 };
181 struct qseecom_ice_key_data_t {
182   uint8_t key[ICE_KEY_SIZE];
183   uint32_t key_len;
184   uint8_t salt[ICE_SALT_SIZE];
185   uint32_t salt_len;
186 };
187 #define SG_ENTRY_SZ sizeof(struct qseecom_sg_entry)
188 #define SG_ENTRY_SZ_64BIT sizeof(struct qseecom_sg_entry_64bit)
189 struct file;
190 #define QSEECOM_IOC_MAGIC 0x97
191 #define QSEECOM_IOCTL_REGISTER_LISTENER_REQ _IOWR(QSEECOM_IOC_MAGIC, 1, struct qseecom_register_listener_req)
192 #define QSEECOM_IOCTL_UNREGISTER_LISTENER_REQ _IO(QSEECOM_IOC_MAGIC, 2)
193 #define QSEECOM_IOCTL_SEND_CMD_REQ _IOWR(QSEECOM_IOC_MAGIC, 3, struct qseecom_send_cmd_req)
194 #define QSEECOM_IOCTL_SEND_MODFD_CMD_REQ _IOWR(QSEECOM_IOC_MAGIC, 4, struct qseecom_send_modfd_cmd_req)
195 #define QSEECOM_IOCTL_RECEIVE_REQ _IO(QSEECOM_IOC_MAGIC, 5)
196 #define QSEECOM_IOCTL_SEND_RESP_REQ _IO(QSEECOM_IOC_MAGIC, 6)
197 #define QSEECOM_IOCTL_LOAD_APP_REQ _IOWR(QSEECOM_IOC_MAGIC, 7, struct qseecom_load_img_req)
198 #define QSEECOM_IOCTL_SET_MEM_PARAM_REQ _IOWR(QSEECOM_IOC_MAGIC, 8, struct qseecom_set_sb_mem_param_req)
199 #define QSEECOM_IOCTL_UNLOAD_APP_REQ _IO(QSEECOM_IOC_MAGIC, 9)
200 #define QSEECOM_IOCTL_GET_QSEOS_VERSION_REQ _IOWR(QSEECOM_IOC_MAGIC, 10, struct qseecom_qseos_version_req)
201 #define QSEECOM_IOCTL_PERF_ENABLE_REQ _IO(QSEECOM_IOC_MAGIC, 11)
202 #define QSEECOM_IOCTL_PERF_DISABLE_REQ _IO(QSEECOM_IOC_MAGIC, 12)
203 #define QSEECOM_IOCTL_LOAD_EXTERNAL_ELF_REQ _IOWR(QSEECOM_IOC_MAGIC, 13, struct qseecom_load_img_req)
204 #define QSEECOM_IOCTL_UNLOAD_EXTERNAL_ELF_REQ _IO(QSEECOM_IOC_MAGIC, 14)
205 #define QSEECOM_IOCTL_APP_LOADED_QUERY_REQ _IOWR(QSEECOM_IOC_MAGIC, 15, struct qseecom_qseos_app_load_query)
206 #define QSEECOM_IOCTL_SEND_CMD_SERVICE_REQ _IOWR(QSEECOM_IOC_MAGIC, 16, struct qseecom_send_svc_cmd_req)
207 #define QSEECOM_IOCTL_CREATE_KEY_REQ _IOWR(QSEECOM_IOC_MAGIC, 17, struct qseecom_create_key_req)
208 #define QSEECOM_IOCTL_WIPE_KEY_REQ _IOWR(QSEECOM_IOC_MAGIC, 18, struct qseecom_wipe_key_req)
209 #define QSEECOM_IOCTL_SAVE_PARTITION_HASH_REQ _IOWR(QSEECOM_IOC_MAGIC, 19, struct qseecom_save_partition_hash_req)
210 #define QSEECOM_IOCTL_IS_ES_ACTIVATED_REQ _IOWR(QSEECOM_IOC_MAGIC, 20, struct qseecom_is_es_activated_req)
211 #define QSEECOM_IOCTL_SEND_MODFD_RESP _IOWR(QSEECOM_IOC_MAGIC, 21, struct qseecom_send_modfd_listener_resp)
212 #define QSEECOM_IOCTL_SET_BUS_SCALING_REQ _IOWR(QSEECOM_IOC_MAGIC, 23, int)
213 #define QSEECOM_IOCTL_UPDATE_KEY_USER_INFO_REQ _IOWR(QSEECOM_IOC_MAGIC, 24, struct qseecom_update_key_userinfo_req)
214 #define QSEECOM_QTEEC_IOCTL_OPEN_SESSION_REQ _IOWR(QSEECOM_IOC_MAGIC, 30, struct qseecom_qteec_modfd_req)
215 #define QSEECOM_QTEEC_IOCTL_CLOSE_SESSION_REQ _IOWR(QSEECOM_IOC_MAGIC, 31, struct qseecom_qteec_req)
216 #define QSEECOM_QTEEC_IOCTL_INVOKE_MODFD_CMD_REQ _IOWR(QSEECOM_IOC_MAGIC, 32, struct qseecom_qteec_modfd_req)
217 #define QSEECOM_QTEEC_IOCTL_REQUEST_CANCELLATION_REQ _IOWR(QSEECOM_IOC_MAGIC, 33, struct qseecom_qteec_modfd_req)
218 #define QSEECOM_IOCTL_MDTP_CIPHER_DIP_REQ _IOWR(QSEECOM_IOC_MAGIC, 34, struct qseecom_mdtp_cipher_dip_req)
219 #define QSEECOM_IOCTL_SEND_MODFD_CMD_64_REQ _IOWR(QSEECOM_IOC_MAGIC, 35, struct qseecom_send_modfd_cmd_req)
220 #define QSEECOM_IOCTL_SEND_MODFD_RESP_64 _IOWR(QSEECOM_IOC_MAGIC, 36, struct qseecom_send_modfd_listener_resp)
221 #define QSEECOM_IOCTL_GET_CE_PIPE_INFO _IOWR(QSEECOM_IOC_MAGIC, 40, struct qseecom_ce_info_req)
222 #define QSEECOM_IOCTL_FREE_CE_PIPE_INFO _IOWR(QSEECOM_IOC_MAGIC, 41, struct qseecom_ce_info_req)
223 #define QSEECOM_IOCTL_QUERY_CE_PIPE_INFO _IOWR(QSEECOM_IOC_MAGIC, 42, struct qseecom_ce_info_req)
224 #define QSEECOM_IOCTL_SET_ICE_INFO _IOWR(QSEECOM_IOC_MAGIC, 43, struct qseecom_ice_data_t)
225 #define QSEECOM_IOCTL_FBE_CLEAR_KEY _IOWR(QSEECOM_IOC_MAGIC, 44, struct qseecom_ice_key_data_t)
226 #endif
227