blob: f23e000ab1cdca40a0d7fc5eb9408317fc015f7c [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 Ferris525ce912017-07-26 13:12:53 -070031#define TEE_IMPL_ID_OPTEE 1
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070032#define TEE_IMPL_ID_AMDTEE 2
Christopher Ferris525ce912017-07-26 13:12:53 -070033#define TEE_OPTEE_CAP_TZ (1 << 0)
34struct 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)
40struct 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)
46struct 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
Christopher Ferris76a1d452018-06-27 14:12:29 -070058#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)
Christopher Ferris525ce912017-07-26 13:12:53 -070060#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
Christopher Ferris8177cdf2020-08-03 11:53:55 -070066#define TEE_IOCTL_LOGIN_REE_KERNEL_MIN 0x80000000
67#define TEE_IOCTL_LOGIN_REE_KERNEL_MAX 0xBFFFFFFF
68#define TEE_IOCTL_LOGIN_REE_KERNEL 0x80000000
Christopher Ferris525ce912017-07-26 13:12:53 -070069struct tee_ioctl_param {
70 __u64 attr;
71 __u64 a;
72 __u64 b;
73 __u64 c;
74};
75#define TEE_IOCTL_UUID_LEN 16
76struct tee_ioctl_open_session_arg {
77 __u8 uuid[TEE_IOCTL_UUID_LEN];
78 __u8 clnt_uuid[TEE_IOCTL_UUID_LEN];
79 __u32 clnt_login;
80 __u32 cancel_id;
81 __u32 session;
82 __u32 ret;
83 __u32 ret_origin;
84 __u32 num_params;
85 struct tee_ioctl_param params[];
86};
87#define TEE_IOC_OPEN_SESSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 2, struct tee_ioctl_buf_data)
88struct tee_ioctl_invoke_arg {
89 __u32 func;
90 __u32 session;
91 __u32 cancel_id;
92 __u32 ret;
93 __u32 ret_origin;
94 __u32 num_params;
95 struct tee_ioctl_param params[];
96};
97#define TEE_IOC_INVOKE _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 3, struct tee_ioctl_buf_data)
98struct tee_ioctl_cancel_arg {
99 __u32 cancel_id;
100 __u32 session;
101};
102#define TEE_IOC_CANCEL _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 4, struct tee_ioctl_cancel_arg)
103struct tee_ioctl_close_session_arg {
104 __u32 session;
105};
106#define TEE_IOC_CLOSE_SESSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 5, struct tee_ioctl_close_session_arg)
107struct tee_iocl_supp_recv_arg {
108 __u32 func;
109 __u32 num_params;
110 struct tee_ioctl_param params[];
111};
112#define TEE_IOC_SUPPL_RECV _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 6, struct tee_ioctl_buf_data)
113struct tee_iocl_supp_send_arg {
114 __u32 ret;
115 __u32 num_params;
116 struct tee_ioctl_param params[];
117};
118#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 -0700119struct tee_ioctl_shm_register_data {
120 __u64 addr;
121 __u64 length;
122 __u32 flags;
123 __s32 id;
124};
125#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 -0700126#endif