Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 /*
0003  * Copyright (c) 2016-2021, Linaro Limited
0004  */
0005 
0006 #ifndef __OPTEE_RPC_CMD_H
0007 #define __OPTEE_RPC_CMD_H
0008 
0009 /*
0010  * All RPC is done with a struct optee_msg_arg as bearer of information,
0011  * struct optee_msg_arg::arg holds values defined by OPTEE_RPC_CMD_* below.
0012  * Only the commands handled by the kernel driver are defined here.
0013  *
0014  * RPC communication with tee-supplicant is reversed compared to normal
0015  * client communication described above. The supplicant receives requests
0016  * and sends responses.
0017  */
0018 
0019 /*
0020  * Get time
0021  *
0022  * Returns number of seconds and nano seconds since the Epoch,
0023  * 1970-01-01 00:00:00 +0000 (UTC).
0024  *
0025  * [out]    value[0].a      Number of seconds
0026  * [out]    value[0].b      Number of nano seconds.
0027  */
0028 #define OPTEE_RPC_CMD_GET_TIME      3
0029 
0030 /*
0031  * Notification from/to secure world.
0032  *
0033  * If secure world needs to wait for something, for instance a mutex, it
0034  * does a notification wait request instead of spinning in secure world.
0035  * Conversely can a synchronous notification can be sent when a secure
0036  * world mutex with a thread waiting thread is unlocked.
0037  *
0038  * This interface can also be used to wait for a asynchronous notification
0039  * which instead is sent via a non-secure interrupt.
0040  *
0041  * Waiting on notification
0042  * [in]    value[0].a       OPTEE_RPC_NOTIFICATION_WAIT
0043  * [in]    value[0].b       notification value
0044  *
0045  * Sending a synchronous notification
0046  * [in]    value[0].a       OPTEE_RPC_NOTIFICATION_SEND
0047  * [in]    value[0].b       notification value
0048  */
0049 #define OPTEE_RPC_CMD_NOTIFICATION  4
0050 #define OPTEE_RPC_NOTIFICATION_WAIT 0
0051 #define OPTEE_RPC_NOTIFICATION_SEND 1
0052 
0053 /*
0054  * Suspend execution
0055  *
0056  * [in]    value[0].a   Number of milliseconds to suspend
0057  */
0058 #define OPTEE_RPC_CMD_SUSPEND       5
0059 
0060 /*
0061  * Allocate a piece of shared memory
0062  *
0063  * [in]    value[0].a       Type of memory one of
0064  *              OPTEE_RPC_SHM_TYPE_* below
0065  * [in]    value[0].b       Requested size
0066  * [in]    value[0].c       Required alignment
0067  * [out]   memref[0]        Buffer
0068  */
0069 #define OPTEE_RPC_CMD_SHM_ALLOC     6
0070 /* Memory that can be shared with a non-secure user space application */
0071 #define OPTEE_RPC_SHM_TYPE_APPL     0
0072 /* Memory only shared with non-secure kernel */
0073 #define OPTEE_RPC_SHM_TYPE_KERNEL   1
0074 
0075 /*
0076  * Free shared memory previously allocated with OPTEE_RPC_CMD_SHM_ALLOC
0077  *
0078  * [in]     value[0].a      Type of memory one of
0079  *              OPTEE_RPC_SHM_TYPE_* above
0080  * [in]     value[0].b      Value of shared memory reference or cookie
0081  */
0082 #define OPTEE_RPC_CMD_SHM_FREE      7
0083 
0084 /*
0085  * Issue master requests (read and write operations) to an I2C chip.
0086  *
0087  * [in]     value[0].a      Transfer mode (OPTEE_RPC_I2C_TRANSFER_*)
0088  * [in]     value[0].b      The I2C bus (a.k.a adapter).
0089  *              16 bit field.
0090  * [in]     value[0].c      The I2C chip (a.k.a address).
0091  *              16 bit field (either 7 or 10 bit effective).
0092  * [in]     value[1].a      The I2C master control flags (ie, 10 bit address).
0093  *              16 bit field.
0094  * [in/out] memref[2]       Buffer used for data transfers.
0095  * [out]    value[3].a      Number of bytes transferred by the REE.
0096  */
0097 #define OPTEE_RPC_CMD_I2C_TRANSFER  21
0098 
0099 /* I2C master transfer modes */
0100 #define OPTEE_RPC_I2C_TRANSFER_RD   0
0101 #define OPTEE_RPC_I2C_TRANSFER_WR   1
0102 
0103 /* I2C master control flags */
0104 #define OPTEE_RPC_I2C_FLAGS_TEN_BIT BIT(0)
0105 
0106 #endif /*__OPTEE_RPC_CMD_H*/