• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2016-2021, Linaro Limited
4  */
5 
6 #ifndef __OPTEE_RPC_CMD_H
7 #define __OPTEE_RPC_CMD_H
8 
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.
13  *
14  * RPC communication with tee-supplicant is reversed compared to normal
15  * client communication described above. The supplicant receives requests
16  * and sends responses.
17  */
18 
19 /*
20  * Get time
21  *
22  * Returns number of seconds and nano seconds since the Epoch,
23  * 1970-01-01 00:00:00 +0000 (UTC).
24  *
25  * [out]    value[0].a	    Number of seconds
26  * [out]    value[0].b	    Number of nano seconds.
27  */
28 #define OPTEE_RPC_CMD_GET_TIME		3
29 
30 /*
31  * Notification from/to secure world.
32  *
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.
37  *
38  * This interface can also be used to wait for a asynchronous notification
39  * which instead is sent via a non-secure interrupt.
40  *
41  * Waiting on notification
42  * [in]    value[0].a	    OPTEE_RPC_NOTIFICATION_WAIT
43  * [in]    value[0].b	    notification value
44  *
45  * Sending a synchronous notification
46  * [in]    value[0].a	    OPTEE_RPC_NOTIFICATION_SEND
47  * [in]    value[0].b	    notification value
48  */
49 #define OPTEE_RPC_CMD_NOTIFICATION	4
50 #define OPTEE_RPC_NOTIFICATION_WAIT	0
51 #define OPTEE_RPC_NOTIFICATION_SEND	1
52 
53 /*
54  * Suspend execution
55  *
56  * [in]    value[0].a	Number of milliseconds to suspend
57  */
58 #define OPTEE_RPC_CMD_SUSPEND		5
59 
60 /*
61  * Allocate a piece of shared memory
62  *
63  * [in]    value[0].a	    Type of memory one of
64  *			    OPTEE_RPC_SHM_TYPE_* below
65  * [in]    value[0].b	    Requested size
66  * [in]    value[0].c	    Required alignment
67  * [out]   memref[0]	    Buffer
68  */
69 #define OPTEE_RPC_CMD_SHM_ALLOC		6
70 /* Memory that can be shared with a non-secure user space application */
71 #define OPTEE_RPC_SHM_TYPE_APPL		0
72 /* Memory only shared with non-secure kernel */
73 #define OPTEE_RPC_SHM_TYPE_KERNEL	1
74 
75 /*
76  * Free shared memory previously allocated with OPTEE_RPC_CMD_SHM_ALLOC
77  *
78  * [in]     value[0].a	    Type of memory one of
79  *			    OPTEE_RPC_SHM_TYPE_* above
80  * [in]     value[0].b	    Value of shared memory reference or cookie
81  */
82 #define OPTEE_RPC_CMD_SHM_FREE		7
83 
84 /*
85  * Issue master requests (read and write operations) to an I2C chip.
86  *
87  * [in]     value[0].a	    Transfer mode (OPTEE_RPC_I2C_TRANSFER_*)
88  * [in]     value[0].b	    The I2C bus (a.k.a adapter).
89  *				16 bit field.
90  * [in]     value[0].c	    The I2C chip (a.k.a address).
91  *				16 bit field (either 7 or 10 bit effective).
92  * [in]     value[1].a	    The I2C master control flags (ie, 10 bit address).
93  *				16 bit field.
94  * [in/out] memref[2]	    Buffer used for data transfers.
95  * [out]    value[3].a	    Number of bytes transferred by the REE.
96  */
97 #define OPTEE_RPC_CMD_I2C_TRANSFER	21
98 
99 /* I2C master transfer modes */
100 #define OPTEE_RPC_I2C_TRANSFER_RD	0
101 #define OPTEE_RPC_I2C_TRANSFER_WR	1
102 
103 /* I2C master control flags */
104 #define OPTEE_RPC_I2C_FLAGS_TEN_BIT	BIT(0)
105 
106 #endif /*__OPTEE_RPC_CMD_H*/
107