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