Merge tag 'trace-v6.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / tee / optee / optee_rpc_cmd.h
blob87a59cc0348049554a69fabe9d9877f5ac041adc
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3 * Copyright (c) 2016-2021, Linaro Limited
4 */
6 #ifndef __OPTEE_RPC_CMD_H
7 #define __OPTEE_RPC_CMD_H
9 /*
10 * All RPC is done with a struct optee_msg_arg as bearer of information,
11 * struct optee_msg_arg::arg holds values defined by OPTEE_RPC_CMD_* below.
12 * Only the commands handled by the kernel driver are defined here.
14 * RPC communication with tee-supplicant is reversed compared to normal
15 * client communication described above. The supplicant receives requests
16 * and sends responses.
20 * Get time
22 * Returns number of seconds and nano seconds since the Epoch,
23 * 1970-01-01 00:00:00 +0000 (UTC).
25 * [out] value[0].a Number of seconds
26 * [out] value[0].b Number of nano seconds.
28 #define OPTEE_RPC_CMD_GET_TIME 3
31 * Notification from/to secure world.
33 * If secure world needs to wait for something, for instance a mutex, it
34 * does a notification wait request instead of spinning in secure world.
35 * Conversely can a synchronous notification can be sent when a secure
36 * world mutex with a thread waiting thread is unlocked.
38 * This interface can also be used to wait for a asynchronous notification
39 * which instead is sent via a non-secure interrupt.
41 * Waiting on notification
42 * [in] value[0].a OPTEE_RPC_NOTIFICATION_WAIT
43 * [in] value[0].b notification value
44 * [in] value[0].c timeout in milliseconds or 0 if no timeout
46 * Sending a synchronous notification
47 * [in] value[0].a OPTEE_RPC_NOTIFICATION_SEND
48 * [in] value[0].b notification value
50 #define OPTEE_RPC_CMD_NOTIFICATION 4
51 #define OPTEE_RPC_NOTIFICATION_WAIT 0
52 #define OPTEE_RPC_NOTIFICATION_SEND 1
55 * Suspend execution
57 * [in] value[0].a Number of milliseconds to suspend
59 #define OPTEE_RPC_CMD_SUSPEND 5
62 * Allocate a piece of shared memory
64 * [in] value[0].a Type of memory one of
65 * OPTEE_RPC_SHM_TYPE_* below
66 * [in] value[0].b Requested size
67 * [in] value[0].c Required alignment
68 * [out] memref[0] Buffer
70 #define OPTEE_RPC_CMD_SHM_ALLOC 6
71 /* Memory that can be shared with a non-secure user space application */
72 #define OPTEE_RPC_SHM_TYPE_APPL 0
73 /* Memory only shared with non-secure kernel */
74 #define OPTEE_RPC_SHM_TYPE_KERNEL 1
77 * Free shared memory previously allocated with OPTEE_RPC_CMD_SHM_ALLOC
79 * [in] value[0].a Type of memory one of
80 * OPTEE_RPC_SHM_TYPE_* above
81 * [in] value[0].b Value of shared memory reference or cookie
83 #define OPTEE_RPC_CMD_SHM_FREE 7
86 * Issue master requests (read and write operations) to an I2C chip.
88 * [in] value[0].a Transfer mode (OPTEE_RPC_I2C_TRANSFER_*)
89 * [in] value[0].b The I2C bus (a.k.a adapter).
90 * 16 bit field.
91 * [in] value[0].c The I2C chip (a.k.a address).
92 * 16 bit field (either 7 or 10 bit effective).
93 * [in] value[1].a The I2C master control flags (ie, 10 bit address).
94 * 16 bit field.
95 * [in/out] memref[2] Buffer used for data transfers.
96 * [out] value[3].a Number of bytes transferred by the REE.
98 #define OPTEE_RPC_CMD_I2C_TRANSFER 21
100 /* I2C master transfer modes */
101 #define OPTEE_RPC_I2C_TRANSFER_RD 0
102 #define OPTEE_RPC_I2C_TRANSFER_WR 1
104 /* I2C master control flags */
105 #define OPTEE_RPC_I2C_FLAGS_TEN_BIT BIT(0)
108 * Reset RPMB probing
110 * Releases an eventually already used RPMB devices and starts over searching
111 * for RPMB devices. Returns the kind of shared memory to use in subsequent
112 * OPTEE_RPC_CMD_RPMB_PROBE_NEXT and OPTEE_RPC_CMD_RPMB calls.
114 * [out] value[0].a OPTEE_RPC_SHM_TYPE_*, the parameter for
115 * OPTEE_RPC_CMD_SHM_ALLOC
117 #define OPTEE_RPC_CMD_RPMB_PROBE_RESET 22
120 * Probe next RPMB device
122 * [out] value[0].a Type of RPMB device, OPTEE_RPC_RPMB_*
123 * [out] value[0].b EXT CSD-slice 168 "RPMB Size"
124 * [out] value[0].c EXT CSD-slice 222 "Reliable Write Sector Count"
125 * [out] memref[1] Buffer with the raw CID
127 #define OPTEE_RPC_CMD_RPMB_PROBE_NEXT 23
129 /* Type of RPMB device */
130 #define OPTEE_RPC_RPMB_EMMC 0
131 #define OPTEE_RPC_RPMB_UFS 1
132 #define OPTEE_RPC_RPMB_NVME 2
135 * Replay Protected Memory Block access
137 * [in] memref[0] Frames to device
138 * [out] memref[1] Frames from device
140 #define OPTEE_RPC_CMD_RPMB_FRAMES 24
142 #endif /*__OPTEE_RPC_CMD_H*/