brintos

brintos / linux-shallow public Read only

0
0
Text · 4.3 KiB · 87a59cc Raw
143 lines · c
1/* SPDX-License-Identifier: BSD-2-Clause */2/*3 * Copyright (c) 2016-2021, Linaro Limited4 */5 6#ifndef __OPTEE_RPC_CMD_H7#define __OPTEE_RPC_CMD_H8 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 normal15 * client communication described above. The supplicant receives requests16 * and sends responses.17 */18 19/*20 * Get time21 *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 seconds26 * [out]    value[0].b	    Number of nano seconds.27 */28#define OPTEE_RPC_CMD_GET_TIME		329 30/*31 * Notification from/to secure world.32 *33 * If secure world needs to wait for something, for instance a mutex, it34 * does a notification wait request instead of spinning in secure world.35 * Conversely can a synchronous notification can be sent when a secure36 * world mutex with a thread waiting thread is unlocked.37 *38 * This interface can also be used to wait for a asynchronous notification39 * which instead is sent via a non-secure interrupt.40 *41 * Waiting on notification42 * [in]    value[0].a	    OPTEE_RPC_NOTIFICATION_WAIT43 * [in]    value[0].b	    notification value44 * [in]    value[0].c	    timeout in milliseconds or 0 if no timeout45 *46 * Sending a synchronous notification47 * [in]    value[0].a	    OPTEE_RPC_NOTIFICATION_SEND48 * [in]    value[0].b	    notification value49 */50#define OPTEE_RPC_CMD_NOTIFICATION	451#define OPTEE_RPC_NOTIFICATION_WAIT	052#define OPTEE_RPC_NOTIFICATION_SEND	153 54/*55 * Suspend execution56 *57 * [in]    value[0].a	Number of milliseconds to suspend58 */59#define OPTEE_RPC_CMD_SUSPEND		560 61/*62 * Allocate a piece of shared memory63 *64 * [in]    value[0].a	    Type of memory one of65 *			    OPTEE_RPC_SHM_TYPE_* below66 * [in]    value[0].b	    Requested size67 * [in]    value[0].c	    Required alignment68 * [out]   memref[0]	    Buffer69 */70#define OPTEE_RPC_CMD_SHM_ALLOC		671/* Memory that can be shared with a non-secure user space application */72#define OPTEE_RPC_SHM_TYPE_APPL		073/* Memory only shared with non-secure kernel */74#define OPTEE_RPC_SHM_TYPE_KERNEL	175 76/*77 * Free shared memory previously allocated with OPTEE_RPC_CMD_SHM_ALLOC78 *79 * [in]     value[0].a	    Type of memory one of80 *			    OPTEE_RPC_SHM_TYPE_* above81 * [in]     value[0].b	    Value of shared memory reference or cookie82 */83#define OPTEE_RPC_CMD_SHM_FREE		784 85/*86 * Issue master requests (read and write operations) to an I2C chip.87 *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.97 */98#define OPTEE_RPC_CMD_I2C_TRANSFER	2199 100/* I2C master transfer modes */101#define OPTEE_RPC_I2C_TRANSFER_RD	0102#define OPTEE_RPC_I2C_TRANSFER_WR	1103 104/* I2C master control flags */105#define OPTEE_RPC_I2C_FLAGS_TEN_BIT	BIT(0)106 107/*108 * Reset RPMB probing109 *110 * Releases an eventually already used RPMB devices and starts over searching111 * for RPMB devices. Returns the kind of shared memory to use in subsequent112 * OPTEE_RPC_CMD_RPMB_PROBE_NEXT and OPTEE_RPC_CMD_RPMB calls.113 *114 * [out]    value[0].a	    OPTEE_RPC_SHM_TYPE_*, the parameter for115 *			    OPTEE_RPC_CMD_SHM_ALLOC116 */117#define OPTEE_RPC_CMD_RPMB_PROBE_RESET	22118 119/*120 * Probe next RPMB device121 *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 CID126 */127#define OPTEE_RPC_CMD_RPMB_PROBE_NEXT	23128 129/* Type of RPMB device */130#define OPTEE_RPC_RPMB_EMMC		0131#define OPTEE_RPC_RPMB_UFS		1132#define OPTEE_RPC_RPMB_NVME		2133 134/*135 * Replay Protected Memory Block access136 *137 * [in]     memref[0]	    Frames to device138 * [out]    memref[1]	    Frames from device139 */140#define OPTEE_RPC_CMD_RPMB_FRAMES	24141 142#endif /*__OPTEE_RPC_CMD_H*/143