| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 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 __TEE_H | 
|  | 20 | #define __TEE_H | 
|  | 21 | #include <linux/ioctl.h> | 
|  | 22 | #include <linux/types.h> | 
|  | 23 | #define TEE_IOC_MAGIC 0xa4 | 
|  | 24 | #define TEE_IOC_BASE 0 | 
|  | 25 | #define TEE_IOCTL_SHM_MAPPED 0x1 | 
|  | 26 | #define TEE_IOCTL_SHM_DMA_BUF 0x2 | 
|  | 27 | #define TEE_MAX_ARG_SIZE 1024 | 
|  | 28 | #define TEE_GEN_CAP_GP (1 << 0) | 
| Christopher Ferris | 1308ad3 | 2017-11-14 17:32:13 -0800 | [diff] [blame] | 29 | #define TEE_GEN_CAP_PRIVILEGED (1 << 1) | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 30 | #define TEE_GEN_CAP_REG_MEM (1 << 2) | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 31 | #define TEE_IMPL_ID_OPTEE 1 | 
|  | 32 | #define TEE_OPTEE_CAP_TZ (1 << 0) | 
|  | 33 | struct tee_ioctl_version_data { | 
|  | 34 | __u32 impl_id; | 
|  | 35 | __u32 impl_caps; | 
|  | 36 | __u32 gen_caps; | 
|  | 37 | }; | 
|  | 38 | #define TEE_IOC_VERSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 0, struct tee_ioctl_version_data) | 
|  | 39 | struct tee_ioctl_shm_alloc_data { | 
|  | 40 | __u64 size; | 
|  | 41 | __u32 flags; | 
|  | 42 | __s32 id; | 
|  | 43 | }; | 
|  | 44 | #define TEE_IOC_SHM_ALLOC _IOWR(TEE_IOC_MAGIC, TEE_IOC_BASE + 1, struct tee_ioctl_shm_alloc_data) | 
|  | 45 | struct tee_ioctl_buf_data { | 
|  | 46 | __u64 buf_ptr; | 
|  | 47 | __u64 buf_len; | 
|  | 48 | }; | 
|  | 49 | #define TEE_IOCTL_PARAM_ATTR_TYPE_NONE 0 | 
|  | 50 | #define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT 1 | 
|  | 51 | #define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT 2 | 
|  | 52 | #define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT 3 | 
|  | 53 | #define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT 5 | 
|  | 54 | #define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT 6 | 
|  | 55 | #define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT 7 | 
|  | 56 | #define TEE_IOCTL_PARAM_ATTR_TYPE_MASK 0xff | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 57 | #define TEE_IOCTL_PARAM_ATTR_META 0x100 | 
|  | 58 | #define TEE_IOCTL_PARAM_ATTR_MASK (TEE_IOCTL_PARAM_ATTR_TYPE_MASK | TEE_IOCTL_PARAM_ATTR_META) | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 59 | #define TEE_IOCTL_LOGIN_PUBLIC 0 | 
|  | 60 | #define TEE_IOCTL_LOGIN_USER 1 | 
|  | 61 | #define TEE_IOCTL_LOGIN_GROUP 2 | 
|  | 62 | #define TEE_IOCTL_LOGIN_APPLICATION 4 | 
|  | 63 | #define TEE_IOCTL_LOGIN_USER_APPLICATION 5 | 
|  | 64 | #define TEE_IOCTL_LOGIN_GROUP_APPLICATION 6 | 
|  | 65 | struct tee_ioctl_param { | 
|  | 66 | __u64 attr; | 
|  | 67 | __u64 a; | 
|  | 68 | __u64 b; | 
|  | 69 | __u64 c; | 
|  | 70 | }; | 
|  | 71 | #define TEE_IOCTL_UUID_LEN 16 | 
|  | 72 | struct tee_ioctl_open_session_arg { | 
|  | 73 | __u8 uuid[TEE_IOCTL_UUID_LEN]; | 
|  | 74 | __u8 clnt_uuid[TEE_IOCTL_UUID_LEN]; | 
|  | 75 | __u32 clnt_login; | 
|  | 76 | __u32 cancel_id; | 
|  | 77 | __u32 session; | 
|  | 78 | __u32 ret; | 
|  | 79 | __u32 ret_origin; | 
|  | 80 | __u32 num_params; | 
|  | 81 | struct tee_ioctl_param params[]; | 
|  | 82 | }; | 
|  | 83 | #define TEE_IOC_OPEN_SESSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 2, struct tee_ioctl_buf_data) | 
|  | 84 | struct tee_ioctl_invoke_arg { | 
|  | 85 | __u32 func; | 
|  | 86 | __u32 session; | 
|  | 87 | __u32 cancel_id; | 
|  | 88 | __u32 ret; | 
|  | 89 | __u32 ret_origin; | 
|  | 90 | __u32 num_params; | 
|  | 91 | struct tee_ioctl_param params[]; | 
|  | 92 | }; | 
|  | 93 | #define TEE_IOC_INVOKE _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 3, struct tee_ioctl_buf_data) | 
|  | 94 | struct tee_ioctl_cancel_arg { | 
|  | 95 | __u32 cancel_id; | 
|  | 96 | __u32 session; | 
|  | 97 | }; | 
|  | 98 | #define TEE_IOC_CANCEL _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 4, struct tee_ioctl_cancel_arg) | 
|  | 99 | struct tee_ioctl_close_session_arg { | 
|  | 100 | __u32 session; | 
|  | 101 | }; | 
|  | 102 | #define TEE_IOC_CLOSE_SESSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 5, struct tee_ioctl_close_session_arg) | 
|  | 103 | struct tee_iocl_supp_recv_arg { | 
|  | 104 | __u32 func; | 
|  | 105 | __u32 num_params; | 
|  | 106 | struct tee_ioctl_param params[]; | 
|  | 107 | }; | 
|  | 108 | #define TEE_IOC_SUPPL_RECV _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 6, struct tee_ioctl_buf_data) | 
|  | 109 | struct tee_iocl_supp_send_arg { | 
|  | 110 | __u32 ret; | 
|  | 111 | __u32 num_params; | 
|  | 112 | struct tee_ioctl_param params[]; | 
|  | 113 | }; | 
|  | 114 | #define TEE_IOC_SUPPL_SEND _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 7, struct tee_ioctl_buf_data) | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 115 | struct tee_ioctl_shm_register_data { | 
|  | 116 | __u64 addr; | 
|  | 117 | __u64 length; | 
|  | 118 | __u32 flags; | 
|  | 119 | __s32 id; | 
|  | 120 | }; | 
|  | 121 | #define TEE_IOC_SHM_REGISTER _IOWR(TEE_IOC_MAGIC, TEE_IOC_BASE + 9, struct tee_ioctl_shm_register_data) | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 122 | #endif |