blob: 5cfe713a25e3c3113627d0efb022f040bc1cb842 [file] [log] [blame]
Christopher Ferris525ce912017-07-26 13:12:53 -07001/****************************************************************************
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 Ferris1308ad32017-11-14 17:32:13 -080029#define TEE_GEN_CAP_PRIVILEGED (1 << 1)
Christopher Ferris76a1d452018-06-27 14:12:29 -070030#define TEE_GEN_CAP_REG_MEM (1 << 2)
Christopher Ferris32ff3f82020-12-14 13:10:04 -080031#define TEE_GEN_CAP_MEMREF_NULL (1 << 3)
32#define TEE_MEMREF_NULL (__u64) (- 1)
Christopher Ferris525ce912017-07-26 13:12:53 -070033#define TEE_IMPL_ID_OPTEE 1
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070034#define TEE_IMPL_ID_AMDTEE 2
Christopher Ferris525ce912017-07-26 13:12:53 -070035#define TEE_OPTEE_CAP_TZ (1 << 0)
36struct 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)
42struct 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)
48struct 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 Ferris76a1d452018-06-27 14:12:29 -070060#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 Ferris525ce912017-07-26 13:12:53 -070062#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 Ferris8177cdf2020-08-03 11:53:55 -070068#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 Ferris525ce912017-07-26 13:12:53 -070071struct tee_ioctl_param {
72 __u64 attr;
73 __u64 a;
74 __u64 b;
75 __u64 c;
76};
77#define TEE_IOCTL_UUID_LEN 16
78struct 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)
90struct 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)
100struct 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)
105struct 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)
109struct 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)
115struct 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 Ferris76a1d452018-06-27 14:12:29 -0700121struct 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 Ferris525ce912017-07-26 13:12:53 -0700128#endif