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