1 /* SPDX-License-Identifier: BSD-2-Clause */
3 * Copyright (c) 2016-2021, Linaro Limited
6 #ifndef __OPTEE_RPC_CMD_H
7 #define __OPTEE_RPC_CMD_H
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.
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 * Wait queue primitive, helper for secure world to implement a wait queue.
33 * If secure world needs to wait for a secure world mutex it issues a sleep
34 * request instead of spinning in secure world. Conversely is a wakeup
35 * request issued when a secure world mutex with a thread waiting thread is
39 * [in] value[0].a OPTEE_RPC_WAIT_QUEUE_SLEEP
40 * [in] value[0].b Wait key
43 * [in] value[0].a OPTEE_RPC_WAIT_QUEUE_WAKEUP
44 * [in] value[0].b Wakeup key
46 #define OPTEE_RPC_CMD_WAIT_QUEUE 4
47 #define OPTEE_RPC_WAIT_QUEUE_SLEEP 0
48 #define OPTEE_RPC_WAIT_QUEUE_WAKEUP 1
53 * [in] value[0].a Number of milliseconds to suspend
55 #define OPTEE_RPC_CMD_SUSPEND 5
58 * Allocate a piece of shared memory
60 * [in] value[0].a Type of memory one of
61 * OPTEE_RPC_SHM_TYPE_* below
62 * [in] value[0].b Requested size
63 * [in] value[0].c Required alignment
64 * [out] memref[0] Buffer
66 #define OPTEE_RPC_CMD_SHM_ALLOC 6
67 /* Memory that can be shared with a non-secure user space application */
68 #define OPTEE_RPC_SHM_TYPE_APPL 0
69 /* Memory only shared with non-secure kernel */
70 #define OPTEE_RPC_SHM_TYPE_KERNEL 1
73 * Free shared memory previously allocated with OPTEE_RPC_CMD_SHM_ALLOC
75 * [in] value[0].a Type of memory one of
76 * OPTEE_RPC_SHM_TYPE_* above
77 * [in] value[0].b Value of shared memory reference or cookie
79 #define OPTEE_RPC_CMD_SHM_FREE 7
82 * Issue master requests (read and write operations) to an I2C chip.
84 * [in] value[0].a Transfer mode (OPTEE_RPC_I2C_TRANSFER_*)
85 * [in] value[0].b The I2C bus (a.k.a adapter).
87 * [in] value[0].c The I2C chip (a.k.a address).
88 * 16 bit field (either 7 or 10 bit effective).
89 * [in] value[1].a The I2C master control flags (ie, 10 bit address).
91 * [in/out] memref[2] Buffer used for data transfers.
92 * [out] value[3].a Number of bytes transferred by the REE.
94 #define OPTEE_RPC_CMD_I2C_TRANSFER 21
96 /* I2C master transfer modes */
97 #define OPTEE_RPC_I2C_TRANSFER_RD 0
98 #define OPTEE_RPC_I2C_TRANSFER_WR 1
100 /* I2C master control flags */
101 #define OPTEE_RPC_I2C_FLAGS_TEN_BIT BIT(0)
103 #endif /*__OPTEE_RPC_CMD_H*/