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