blob: d4772ee76c51a9ae297dca245c048f7ec48bde3e [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Christopher Ferris525ce912017-07-26 13:12:53 -07007#ifndef __TEE_H
8#define __TEE_H
9#include <linux/ioctl.h>
10#include <linux/types.h>
11#define TEE_IOC_MAGIC 0xa4
12#define TEE_IOC_BASE 0
Christopher Ferris525ce912017-07-26 13:12:53 -070013#define TEE_MAX_ARG_SIZE 1024
14#define TEE_GEN_CAP_GP (1 << 0)
Christopher Ferris1308ad32017-11-14 17:32:13 -080015#define TEE_GEN_CAP_PRIVILEGED (1 << 1)
Christopher Ferris76a1d452018-06-27 14:12:29 -070016#define TEE_GEN_CAP_REG_MEM (1 << 2)
Christopher Ferris32ff3f82020-12-14 13:10:04 -080017#define TEE_GEN_CAP_MEMREF_NULL (1 << 3)
18#define TEE_MEMREF_NULL (__u64) (- 1)
Christopher Ferris525ce912017-07-26 13:12:53 -070019#define TEE_IMPL_ID_OPTEE 1
Christopher Ferrisbb9fcb42020-04-06 11:38:04 -070020#define TEE_IMPL_ID_AMDTEE 2
Christopher Ferris525ce912017-07-26 13:12:53 -070021#define TEE_OPTEE_CAP_TZ (1 << 0)
22struct tee_ioctl_version_data {
23 __u32 impl_id;
24 __u32 impl_caps;
25 __u32 gen_caps;
26};
27#define TEE_IOC_VERSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 0, struct tee_ioctl_version_data)
28struct tee_ioctl_shm_alloc_data {
29 __u64 size;
30 __u32 flags;
31 __s32 id;
32};
33#define TEE_IOC_SHM_ALLOC _IOWR(TEE_IOC_MAGIC, TEE_IOC_BASE + 1, struct tee_ioctl_shm_alloc_data)
34struct tee_ioctl_buf_data {
35 __u64 buf_ptr;
36 __u64 buf_len;
37};
38#define TEE_IOCTL_PARAM_ATTR_TYPE_NONE 0
39#define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT 1
40#define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT 2
41#define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT 3
42#define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT 5
43#define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT 6
44#define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT 7
45#define TEE_IOCTL_PARAM_ATTR_TYPE_MASK 0xff
Christopher Ferris76a1d452018-06-27 14:12:29 -070046#define TEE_IOCTL_PARAM_ATTR_META 0x100
47#define TEE_IOCTL_PARAM_ATTR_MASK (TEE_IOCTL_PARAM_ATTR_TYPE_MASK | TEE_IOCTL_PARAM_ATTR_META)
Christopher Ferris525ce912017-07-26 13:12:53 -070048#define TEE_IOCTL_LOGIN_PUBLIC 0
49#define TEE_IOCTL_LOGIN_USER 1
50#define TEE_IOCTL_LOGIN_GROUP 2
51#define TEE_IOCTL_LOGIN_APPLICATION 4
52#define TEE_IOCTL_LOGIN_USER_APPLICATION 5
53#define TEE_IOCTL_LOGIN_GROUP_APPLICATION 6
Christopher Ferris8177cdf2020-08-03 11:53:55 -070054#define TEE_IOCTL_LOGIN_REE_KERNEL_MIN 0x80000000
55#define TEE_IOCTL_LOGIN_REE_KERNEL_MAX 0xBFFFFFFF
56#define TEE_IOCTL_LOGIN_REE_KERNEL 0x80000000
Christopher Ferris525ce912017-07-26 13:12:53 -070057struct tee_ioctl_param {
58 __u64 attr;
59 __u64 a;
60 __u64 b;
61 __u64 c;
62};
63#define TEE_IOCTL_UUID_LEN 16
64struct tee_ioctl_open_session_arg {
65 __u8 uuid[TEE_IOCTL_UUID_LEN];
66 __u8 clnt_uuid[TEE_IOCTL_UUID_LEN];
67 __u32 clnt_login;
68 __u32 cancel_id;
69 __u32 session;
70 __u32 ret;
71 __u32 ret_origin;
72 __u32 num_params;
73 struct tee_ioctl_param params[];
74};
75#define TEE_IOC_OPEN_SESSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 2, struct tee_ioctl_buf_data)
76struct tee_ioctl_invoke_arg {
77 __u32 func;
78 __u32 session;
79 __u32 cancel_id;
80 __u32 ret;
81 __u32 ret_origin;
82 __u32 num_params;
83 struct tee_ioctl_param params[];
84};
85#define TEE_IOC_INVOKE _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 3, struct tee_ioctl_buf_data)
86struct tee_ioctl_cancel_arg {
87 __u32 cancel_id;
88 __u32 session;
89};
90#define TEE_IOC_CANCEL _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 4, struct tee_ioctl_cancel_arg)
91struct tee_ioctl_close_session_arg {
92 __u32 session;
93};
94#define TEE_IOC_CLOSE_SESSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 5, struct tee_ioctl_close_session_arg)
95struct tee_iocl_supp_recv_arg {
96 __u32 func;
97 __u32 num_params;
98 struct tee_ioctl_param params[];
99};
100#define TEE_IOC_SUPPL_RECV _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 6, struct tee_ioctl_buf_data)
101struct tee_iocl_supp_send_arg {
102 __u32 ret;
103 __u32 num_params;
104 struct tee_ioctl_param params[];
105};
106#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 -0700107struct tee_ioctl_shm_register_data {
108 __u64 addr;
109 __u64 length;
110 __u32 flags;
111 __s32 id;
112};
113#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 -0700114#endif