Mona Hossain | 2892b6b | 2012-02-17 13:53:11 -0800 | [diff] [blame] | 1 | #ifndef __QSEECOM_H_ |
| 2 | #define __QSEECOM_H_ |
| 3 | |
| 4 | #include <linux/types.h> |
| 5 | #include <linux/ioctl.h> |
| 6 | |
| 7 | #define MAX_ION_FD 4 |
| 8 | #define MAX_APP_NAME_SIZE 32 |
Mona Hossain | 4cf78a9 | 2013-02-14 12:06:41 -0800 | [diff] [blame] | 9 | #define QSEECOM_HASH_SIZE 32 |
Mona Hossain | 2892b6b | 2012-02-17 13:53:11 -0800 | [diff] [blame] | 10 | /* |
| 11 | * struct qseecom_register_listener_req - |
| 12 | * for register listener ioctl request |
| 13 | * @listener_id - service id (shared between userspace and QSE) |
| 14 | * @ifd_data_fd - ion handle |
| 15 | * @virt_sb_base - shared buffer base in user space |
| 16 | * @sb_size - shared buffer size |
| 17 | */ |
| 18 | struct qseecom_register_listener_req { |
| 19 | uint32_t listener_id; /* in */ |
| 20 | int32_t ifd_data_fd; /* in */ |
| 21 | uint32_t virt_sb_base; /* in */ |
| 22 | uint32_t sb_size; /* in */ |
| 23 | }; |
| 24 | |
| 25 | /* |
| 26 | * struct qseecom_send_cmd_req - for send command ioctl request |
| 27 | * @cmd_req_len - command buffer length |
| 28 | * @cmd_req_buf - command buffer |
| 29 | * @resp_len - response buffer length |
| 30 | * @resp_buf - response buffer |
| 31 | */ |
| 32 | struct qseecom_send_cmd_req { |
| 33 | void *cmd_req_buf; /* in */ |
| 34 | unsigned int cmd_req_len; /* in */ |
| 35 | void *resp_buf; /* in/out */ |
| 36 | unsigned int resp_len; /* in/out */ |
| 37 | }; |
| 38 | |
Mona Hossain | 2892b6b | 2012-02-17 13:53:11 -0800 | [diff] [blame] | 39 | /* |
| 40 | * struct qseecom_ion_fd_info - ion fd handle data information |
| 41 | * @fd - ion handle to some memory allocated in user space |
| 42 | * @cmd_buf_offset - command buffer offset |
| 43 | */ |
| 44 | struct qseecom_ion_fd_info { |
| 45 | int32_t fd; |
| 46 | uint32_t cmd_buf_offset; |
| 47 | }; |
| 48 | /* |
| 49 | * struct qseecom_send_modfd_cmd_req - for send command ioctl request |
| 50 | * @cmd_req_len - command buffer length |
| 51 | * @cmd_req_buf - command buffer |
| 52 | * @resp_len - response buffer length |
| 53 | * @resp_buf - response buffer |
| 54 | * @ifd_data_fd - ion handle to memory allocated in user space |
| 55 | * @cmd_buf_offset - command buffer offset |
| 56 | */ |
| 57 | struct qseecom_send_modfd_cmd_req { |
| 58 | void *cmd_req_buf; /* in */ |
| 59 | unsigned int cmd_req_len; /* in */ |
| 60 | void *resp_buf; /* in/out */ |
| 61 | unsigned int resp_len; /* in/out */ |
| 62 | struct qseecom_ion_fd_info ifd_data[MAX_ION_FD]; |
| 63 | }; |
Hariprasad Dhalinarasimha | 23fdcd9 | 2013-05-01 14:51:09 -0700 | [diff] [blame] | 64 | |
Mona Hossain | 2892b6b | 2012-02-17 13:53:11 -0800 | [diff] [blame] | 65 | /* |
| 66 | * struct qseecom_listener_send_resp_req - signal to continue the send_cmd req. |
| 67 | * Used as a trigger from HLOS service to notify QSEECOM that it's done with its |
| 68 | * operation and provide the response for QSEECOM can continue the incomplete |
| 69 | * command execution |
| 70 | * @resp_len - Length of the response |
| 71 | * @resp_buf - Response buffer where the response of the cmd should go. |
| 72 | */ |
| 73 | struct qseecom_send_resp_req { |
| 74 | void *resp_buf; /* in */ |
| 75 | unsigned int resp_len; /* in */ |
| 76 | }; |
| 77 | |
| 78 | /* |
| 79 | * struct qseecom_load_img_data - for sending image length information and |
| 80 | * ion file descriptor to the qseecom driver. ion file descriptor is used |
| 81 | * for retrieving the ion file handle and in turn the physical address of |
| 82 | * the image location. |
| 83 | * @mdt_len - Length of the .mdt file in bytes. |
| 84 | * @img_len - Length of the .mdt + .b00 +..+.bxx images files in bytes |
| 85 | * @ion_fd - Ion file descriptor used when allocating memory. |
| 86 | * @img_name - Name of the image. |
| 87 | */ |
| 88 | struct qseecom_load_img_req { |
| 89 | uint32_t mdt_len; /* in */ |
| 90 | uint32_t img_len; /* in */ |
| 91 | int32_t ifd_data_fd; /* in */ |
| 92 | char img_name[MAX_APP_NAME_SIZE]; /* in */ |
| 93 | int app_id; /* out*/ |
| 94 | }; |
| 95 | |
| 96 | struct qseecom_set_sb_mem_param_req { |
| 97 | int32_t ifd_data_fd; /* in */ |
| 98 | uint32_t virt_sb_base; /* in */ |
| 99 | uint32_t sb_len; /* in */ |
| 100 | }; |
| 101 | |
| 102 | /* |
| 103 | * struct qseecom_qseos_version_req - get qseos version |
| 104 | * @qseos_version - version number |
| 105 | */ |
| 106 | struct qseecom_qseos_version_req { |
| 107 | unsigned int qseos_version; /* in */ |
| 108 | }; |
| 109 | |
Ramesh Masavarapu | 1ee4ac8 | 2012-06-22 15:38:34 -0700 | [diff] [blame] | 110 | /* |
| 111 | * struct qseecom_qseos_app_load_query - verify if app is loaded in qsee |
| 112 | * @app_name[MAX_APP_NAME_SIZE]- name of the app. |
Ramesh Masavarapu | 13d9967 | 2012-07-17 11:05:15 -0700 | [diff] [blame] | 113 | * @app_id - app id. |
Ramesh Masavarapu | 1ee4ac8 | 2012-06-22 15:38:34 -0700 | [diff] [blame] | 114 | */ |
| 115 | struct qseecom_qseos_app_load_query { |
| 116 | char app_name[MAX_APP_NAME_SIZE]; /* in */ |
Ramesh Masavarapu | 13d9967 | 2012-07-17 11:05:15 -0700 | [diff] [blame] | 117 | int app_id; /* out */ |
Ramesh Masavarapu | 1ee4ac8 | 2012-06-22 15:38:34 -0700 | [diff] [blame] | 118 | }; |
| 119 | |
Hariprasad Dhalinarasimha | adf27a8 | 2013-02-11 15:07:59 -0800 | [diff] [blame] | 120 | struct qseecom_send_svc_cmd_req { |
| 121 | uint32_t cmd_id; |
| 122 | void *cmd_req_buf; /* in */ |
| 123 | unsigned int cmd_req_len; /* in */ |
| 124 | void *resp_buf; /* in/out */ |
| 125 | unsigned int resp_len; /* in/out */ |
| 126 | }; |
| 127 | |
Mona Hossain | 4cf78a9 | 2013-02-14 12:06:41 -0800 | [diff] [blame] | 128 | enum qseecom_key_management_usage_type { |
| 129 | QSEOS_KM_USAGE_DISK_ENCRYPTION = 0x01, |
Zhen Kong | 9730ddf | 2013-12-17 16:49:43 -0800 | [diff] [blame] | 130 | QSEOS_KM_USAGE_MAX |
Mona Hossain | 4cf78a9 | 2013-02-14 12:06:41 -0800 | [diff] [blame] | 131 | }; |
| 132 | |
| 133 | struct qseecom_create_key_req { |
| 134 | unsigned char hash32[QSEECOM_HASH_SIZE]; |
| 135 | enum qseecom_key_management_usage_type usage; |
| 136 | }; |
| 137 | |
| 138 | struct qseecom_wipe_key_req { |
| 139 | enum qseecom_key_management_usage_type usage; |
| 140 | }; |
| 141 | |
Zhen Kong | 9730ddf | 2013-12-17 16:49:43 -0800 | [diff] [blame] | 142 | struct qseecom_update_key_userinfo_req { |
| 143 | unsigned char current_hash32[QSEECOM_HASH_SIZE]; |
| 144 | unsigned char new_hash32[QSEECOM_HASH_SIZE]; |
| 145 | enum qseecom_key_management_usage_type usage; |
| 146 | }; |
| 147 | |
Amir Samuelov | d1fc741 | 2013-03-10 16:56:13 +0200 | [diff] [blame] | 148 | #define SHA256_DIGEST_LENGTH (256/8) |
| 149 | /* |
| 150 | * struct qseecom_save_partition_hash_req |
| 151 | * @partition_id - partition id. |
| 152 | * @hash[SHA256_DIGEST_LENGTH] - sha256 digest. |
| 153 | */ |
| 154 | struct qseecom_save_partition_hash_req { |
| 155 | int partition_id; /* in */ |
| 156 | char digest[SHA256_DIGEST_LENGTH]; /* in */ |
| 157 | }; |
| 158 | |
| 159 | /* |
| 160 | * struct qseecom_is_es_activated_req |
| 161 | * @is_activated - 1=true , 0=false |
| 162 | */ |
| 163 | struct qseecom_is_es_activated_req { |
| 164 | int is_activated; /* out */ |
| 165 | }; |
| 166 | |
Hariprasad Dhalinarasimha | 23fdcd9 | 2013-05-01 14:51:09 -0700 | [diff] [blame] | 167 | enum qseecom_buffer_protection { |
| 168 | QSEOS_UNPROTECTED_BUFFER, |
| 169 | QSEOS_PROTECT_BUFFER, |
| 170 | QSEOS_UNPROTECT_PROTECTED_BUFFER, |
| 171 | }; |
| 172 | |
Zhen Kong | a2b15e1 | 2013-08-27 12:05:06 -0700 | [diff] [blame] | 173 | enum qseecom_bandwidth_request_mode { |
| 174 | INACTIVE = 0, |
| 175 | LOW, |
| 176 | MEDIUM, |
| 177 | HIGH, |
| 178 | }; |
| 179 | |
Hariprasad Dhalinarasimha | 23fdcd9 | 2013-05-01 14:51:09 -0700 | [diff] [blame] | 180 | /* |
| 181 | * struct qseecom_send_modfd_resp - for send command ioctl request |
| 182 | * @req_len - command buffer length |
| 183 | * @req_buf - command buffer |
| 184 | * @ifd_data_fd - ion handle to memory allocated in user space |
| 185 | * @cmd_buf_offset - command buffer offset |
| 186 | */ |
| 187 | struct qseecom_send_modfd_listener_resp { |
| 188 | void *resp_buf_ptr; /* in */ |
| 189 | unsigned int resp_len; /* in */ |
| 190 | struct qseecom_ion_fd_info ifd_data[MAX_ION_FD]; /* in */ |
| 191 | enum qseecom_buffer_protection protection_mode; /* in */ |
| 192 | }; |
| 193 | |
Mona Hossain | 2892b6b | 2012-02-17 13:53:11 -0800 | [diff] [blame] | 194 | #define QSEECOM_IOC_MAGIC 0x97 |
| 195 | |
| 196 | |
| 197 | #define QSEECOM_IOCTL_REGISTER_LISTENER_REQ \ |
| 198 | _IOWR(QSEECOM_IOC_MAGIC, 1, struct qseecom_register_listener_req) |
| 199 | |
| 200 | #define QSEECOM_IOCTL_UNREGISTER_LISTENER_REQ \ |
| 201 | _IO(QSEECOM_IOC_MAGIC, 2) |
| 202 | |
| 203 | #define QSEECOM_IOCTL_SEND_CMD_REQ \ |
| 204 | _IOWR(QSEECOM_IOC_MAGIC, 3, struct qseecom_send_cmd_req) |
| 205 | |
| 206 | #define QSEECOM_IOCTL_SEND_MODFD_CMD_REQ \ |
| 207 | _IOWR(QSEECOM_IOC_MAGIC, 4, struct qseecom_send_modfd_cmd_req) |
| 208 | |
| 209 | #define QSEECOM_IOCTL_RECEIVE_REQ \ |
| 210 | _IO(QSEECOM_IOC_MAGIC, 5) |
| 211 | |
| 212 | #define QSEECOM_IOCTL_SEND_RESP_REQ \ |
| 213 | _IO(QSEECOM_IOC_MAGIC, 6) |
| 214 | |
| 215 | #define QSEECOM_IOCTL_LOAD_APP_REQ \ |
| 216 | _IOWR(QSEECOM_IOC_MAGIC, 7, struct qseecom_load_img_req) |
| 217 | |
| 218 | #define QSEECOM_IOCTL_SET_MEM_PARAM_REQ \ |
| 219 | _IOWR(QSEECOM_IOC_MAGIC, 8, struct qseecom_set_sb_mem_param_req) |
| 220 | |
| 221 | #define QSEECOM_IOCTL_UNLOAD_APP_REQ \ |
| 222 | _IO(QSEECOM_IOC_MAGIC, 9) |
| 223 | |
| 224 | #define QSEECOM_IOCTL_GET_QSEOS_VERSION_REQ \ |
| 225 | _IOWR(QSEECOM_IOC_MAGIC, 10, struct qseecom_qseos_version_req) |
| 226 | |
| 227 | #define QSEECOM_IOCTL_PERF_ENABLE_REQ \ |
| 228 | _IO(QSEECOM_IOC_MAGIC, 11) |
| 229 | |
| 230 | #define QSEECOM_IOCTL_PERF_DISABLE_REQ \ |
| 231 | _IO(QSEECOM_IOC_MAGIC, 12) |
| 232 | |
Mona Hossain | 5ab9d77 | 2012-04-11 21:00:40 -0700 | [diff] [blame] | 233 | #define QSEECOM_IOCTL_LOAD_EXTERNAL_ELF_REQ \ |
| 234 | _IOWR(QSEECOM_IOC_MAGIC, 13, struct qseecom_load_img_req) |
| 235 | |
| 236 | #define QSEECOM_IOCTL_UNLOAD_EXTERNAL_ELF_REQ \ |
| 237 | _IO(QSEECOM_IOC_MAGIC, 14) |
| 238 | |
Ramesh Masavarapu | 1ee4ac8 | 2012-06-22 15:38:34 -0700 | [diff] [blame] | 239 | #define QSEECOM_IOCTL_APP_LOADED_QUERY_REQ \ |
| 240 | _IOWR(QSEECOM_IOC_MAGIC, 15, struct qseecom_qseos_app_load_query) |
| 241 | |
Hariprasad Dhalinarasimha | adf27a8 | 2013-02-11 15:07:59 -0800 | [diff] [blame] | 242 | #define QSEECOM_IOCTL_SEND_CMD_SERVICE_REQ \ |
| 243 | _IOWR(QSEECOM_IOC_MAGIC, 16, struct qseecom_send_svc_cmd_req) |
| 244 | |
Mona Hossain | 4cf78a9 | 2013-02-14 12:06:41 -0800 | [diff] [blame] | 245 | #define QSEECOM_IOCTL_CREATE_KEY_REQ \ |
| 246 | _IOWR(QSEECOM_IOC_MAGIC, 17, struct qseecom_create_key_req) |
| 247 | |
| 248 | #define QSEECOM_IOCTL_WIPE_KEY_REQ \ |
| 249 | _IOWR(QSEECOM_IOC_MAGIC, 18, struct qseecom_wipe_key_req) |
| 250 | |
Amir Samuelov | d1fc741 | 2013-03-10 16:56:13 +0200 | [diff] [blame] | 251 | #define QSEECOM_IOCTL_SAVE_PARTITION_HASH_REQ \ |
| 252 | _IOWR(QSEECOM_IOC_MAGIC, 19, struct qseecom_save_partition_hash_req) |
| 253 | |
| 254 | #define QSEECOM_IOCTL_IS_ES_ACTIVATED_REQ \ |
| 255 | _IOWR(QSEECOM_IOC_MAGIC, 20, struct qseecom_is_es_activated_req) |
Ramesh Masavarapu | 1ee4ac8 | 2012-06-22 15:38:34 -0700 | [diff] [blame] | 256 | |
Hariprasad Dhalinarasimha | 23fdcd9 | 2013-05-01 14:51:09 -0700 | [diff] [blame] | 257 | #define QSEECOM_IOCTL_SEND_MODFD_RESP \ |
| 258 | _IOWR(QSEECOM_IOC_MAGIC, 21, struct qseecom_send_modfd_listener_resp) |
| 259 | |
| 260 | #define QSEECOM_IOCTL_UNPROTECT_BUF \ |
| 261 | _IOWR(QSEECOM_IOC_MAGIC, 22, int) |
Zhen Kong | a2b15e1 | 2013-08-27 12:05:06 -0700 | [diff] [blame] | 262 | |
| 263 | #define QSEECOM_IOCTL_SET_BUS_SCALING_REQ \ |
| 264 | _IOWR(QSEECOM_IOC_MAGIC, 23, int) |
| 265 | |
Zhen Kong | 9730ddf | 2013-12-17 16:49:43 -0800 | [diff] [blame] | 266 | #define QSEECOM_IOCTL_UPDATE_KEY_USER_INFO_REQ \ |
| 267 | _IOWR(QSEECOM_IOC_MAGIC, 24, struct qseecom_update_key_userinfo_req) |
| 268 | |
Mona Hossain | 2892b6b | 2012-02-17 13:53:11 -0800 | [diff] [blame] | 269 | #endif /* __QSEECOM_H_ */ |