blob: 6e4cff34cd4bb8aea66c9ba27d728ba7680059c7 [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 Ferris7ac54f52024-08-07 21:07:12 +000021#define TEE_IMPL_ID_TSTEE 3
Christopher Ferris525ce912017-07-26 13:12:53 -070022#define TEE_OPTEE_CAP_TZ (1 << 0)
23struct tee_ioctl_version_data {
24 __u32 impl_id;
25 __u32 impl_caps;
26 __u32 gen_caps;
27};
28#define TEE_IOC_VERSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 0, struct tee_ioctl_version_data)
29struct tee_ioctl_shm_alloc_data {
30 __u64 size;
31 __u32 flags;
32 __s32 id;
33};
34#define TEE_IOC_SHM_ALLOC _IOWR(TEE_IOC_MAGIC, TEE_IOC_BASE + 1, struct tee_ioctl_shm_alloc_data)
35struct tee_ioctl_buf_data {
36 __u64 buf_ptr;
37 __u64 buf_len;
38};
39#define TEE_IOCTL_PARAM_ATTR_TYPE_NONE 0
40#define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT 1
41#define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT 2
42#define TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT 3
43#define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INPUT 5
44#define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT 6
45#define TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT 7
46#define TEE_IOCTL_PARAM_ATTR_TYPE_MASK 0xff
Christopher Ferris76a1d452018-06-27 14:12:29 -070047#define TEE_IOCTL_PARAM_ATTR_META 0x100
48#define TEE_IOCTL_PARAM_ATTR_MASK (TEE_IOCTL_PARAM_ATTR_TYPE_MASK | TEE_IOCTL_PARAM_ATTR_META)
Christopher Ferris525ce912017-07-26 13:12:53 -070049#define TEE_IOCTL_LOGIN_PUBLIC 0
50#define TEE_IOCTL_LOGIN_USER 1
51#define TEE_IOCTL_LOGIN_GROUP 2
52#define TEE_IOCTL_LOGIN_APPLICATION 4
53#define TEE_IOCTL_LOGIN_USER_APPLICATION 5
54#define TEE_IOCTL_LOGIN_GROUP_APPLICATION 6
Christopher Ferris8177cdf2020-08-03 11:53:55 -070055#define TEE_IOCTL_LOGIN_REE_KERNEL_MIN 0x80000000
56#define TEE_IOCTL_LOGIN_REE_KERNEL_MAX 0xBFFFFFFF
57#define TEE_IOCTL_LOGIN_REE_KERNEL 0x80000000
Christopher Ferris525ce912017-07-26 13:12:53 -070058struct tee_ioctl_param {
59 __u64 attr;
60 __u64 a;
61 __u64 b;
62 __u64 c;
63};
64#define TEE_IOCTL_UUID_LEN 16
65struct tee_ioctl_open_session_arg {
66 __u8 uuid[TEE_IOCTL_UUID_LEN];
67 __u8 clnt_uuid[TEE_IOCTL_UUID_LEN];
68 __u32 clnt_login;
69 __u32 cancel_id;
70 __u32 session;
71 __u32 ret;
72 __u32 ret_origin;
73 __u32 num_params;
74 struct tee_ioctl_param params[];
75};
76#define TEE_IOC_OPEN_SESSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 2, struct tee_ioctl_buf_data)
77struct tee_ioctl_invoke_arg {
78 __u32 func;
79 __u32 session;
80 __u32 cancel_id;
81 __u32 ret;
82 __u32 ret_origin;
83 __u32 num_params;
84 struct tee_ioctl_param params[];
85};
86#define TEE_IOC_INVOKE _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 3, struct tee_ioctl_buf_data)
87struct tee_ioctl_cancel_arg {
88 __u32 cancel_id;
89 __u32 session;
90};
91#define TEE_IOC_CANCEL _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 4, struct tee_ioctl_cancel_arg)
92struct tee_ioctl_close_session_arg {
93 __u32 session;
94};
95#define TEE_IOC_CLOSE_SESSION _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 5, struct tee_ioctl_close_session_arg)
96struct tee_iocl_supp_recv_arg {
97 __u32 func;
98 __u32 num_params;
99 struct tee_ioctl_param params[];
100};
101#define TEE_IOC_SUPPL_RECV _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 6, struct tee_ioctl_buf_data)
102struct tee_iocl_supp_send_arg {
103 __u32 ret;
104 __u32 num_params;
105 struct tee_ioctl_param params[];
106};
107#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 -0700108struct tee_ioctl_shm_register_data {
109 __u64 addr;
110 __u64 length;
111 __u32 flags;
112 __s32 id;
113};
114#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 -0700115#endif