Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (c) 2015-2019, Linaro Limited
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #ifndef _OPTEE_MSG_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #define _OPTEE_MSG_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/bitops.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * This file defines the OP-TEE message protocol (ABI) used to communicate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * with an instance of OP-TEE running in secure world.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * This file is divided into three sections.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * 1. Formatting of messages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * 2. Requests from normal world
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * 3. Requests from secure world, Remote Procedure Call (RPC), handled by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *    tee-supplicant.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * Part 1 - formatting of messages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define OPTEE_MSG_ATTR_TYPE_NONE		0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define OPTEE_MSG_ATTR_TYPE_VALUE_INPUT		0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #define OPTEE_MSG_ATTR_TYPE_VALUE_OUTPUT	0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #define OPTEE_MSG_ATTR_TYPE_VALUE_INOUT		0x3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define OPTEE_MSG_ATTR_TYPE_RMEM_INPUT		0x5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define OPTEE_MSG_ATTR_TYPE_RMEM_OUTPUT		0x6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define OPTEE_MSG_ATTR_TYPE_RMEM_INOUT		0x7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #define OPTEE_MSG_ATTR_TYPE_TMEM_INPUT		0x9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #define OPTEE_MSG_ATTR_TYPE_TMEM_OUTPUT		0xa
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define OPTEE_MSG_ATTR_TYPE_TMEM_INOUT		0xb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define OPTEE_MSG_ATTR_TYPE_MASK		GENMASK(7, 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * Meta parameter to be absorbed by the Secure OS and not passed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  * to the Trusted Application.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * Currently only used with OPTEE_MSG_CMD_OPEN_SESSION.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define OPTEE_MSG_ATTR_META			BIT(8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * Pointer to a list of pages used to register user-defined SHM buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * Used with OPTEE_MSG_ATTR_TYPE_TMEM_*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  * buf_ptr should point to the beginning of the buffer. Buffer will contain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  * list of page addresses. OP-TEE core can reconstruct contiguous buffer from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  * that page addresses list. Page addresses are stored as 64 bit values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  * Last entry on a page should point to the next page of buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  * Every entry in buffer should point to a 4k page beginning (12 least
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  * significant bits must be equal to zero).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * 12 least significant bints of optee_msg_param.u.tmem.buf_ptr should hold page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  * offset of the user buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * So, entries should be placed like members of this structure:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * struct page_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  *   uint64_t pages_array[OPTEE_MSG_NONCONTIG_PAGE_SIZE/sizeof(uint64_t) - 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  *   uint64_t next_page_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  * };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  * Structure is designed to exactly fit into the page size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  * OPTEE_MSG_NONCONTIG_PAGE_SIZE which is a standard 4KB page.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  * The size of 4KB is chosen because this is the smallest page size for ARM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  * architectures. If REE uses larger pages, it should divide them to 4KB ones.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) #define OPTEE_MSG_ATTR_NONCONTIG		BIT(9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)  * Memory attributes for caching passed with temp memrefs. The actual value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)  * used is defined outside the message protocol with the exception of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  * OPTEE_MSG_ATTR_CACHE_PREDEFINED which means the attributes already
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  * defined for the memory range should be used. If optee_smc.h is used as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  * bearer of this protocol OPTEE_SMC_SHM_* is used for values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) #define OPTEE_MSG_ATTR_CACHE_SHIFT		16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) #define OPTEE_MSG_ATTR_CACHE_MASK		GENMASK(2, 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) #define OPTEE_MSG_ATTR_CACHE_PREDEFINED		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * Same values as TEE_LOGIN_* from TEE Internal API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #define OPTEE_MSG_LOGIN_PUBLIC			0x00000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) #define OPTEE_MSG_LOGIN_USER			0x00000001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) #define OPTEE_MSG_LOGIN_GROUP			0x00000002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) #define OPTEE_MSG_LOGIN_APPLICATION		0x00000004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) #define OPTEE_MSG_LOGIN_APPLICATION_USER	0x00000005
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) #define OPTEE_MSG_LOGIN_APPLICATION_GROUP	0x00000006
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)  * Page size used in non-contiguous buffer entries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) #define OPTEE_MSG_NONCONTIG_PAGE_SIZE		4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  * struct optee_msg_param_tmem - temporary memory reference parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)  * @buf_ptr:	Address of the buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)  * @size:	Size of the buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)  * @shm_ref:	Temporary shared memory reference, pointer to a struct tee_shm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)  * Secure and normal world communicates pointers as physical address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  * instead of the virtual address. This is because secure and normal world
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  * have completely independent memory mapping. Normal world can even have a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  * hypervisor which need to translate the guest physical address (AKA IPA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)  * in ARM documentation) to a real physical address before passing the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)  * structure to secure world.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) struct optee_msg_param_tmem {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	u64 buf_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	u64 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	u64 shm_ref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)  * struct optee_msg_param_rmem - registered memory reference parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)  * @offs:	Offset into shared memory reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)  * @size:	Size of the buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)  * @shm_ref:	Shared memory reference, pointer to a struct tee_shm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) struct optee_msg_param_rmem {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	u64 offs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	u64 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	u64 shm_ref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  * struct optee_msg_param_value - opaque value parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  * Value parameters are passed unchecked between normal and secure world.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct optee_msg_param_value {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	u64 a;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	u64 b;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	u64 c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)  * struct optee_msg_param - parameter used together with struct optee_msg_arg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  * @attr:	attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  * @tmem:	parameter by temporary memory reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  * @rmem:	parameter by registered memory reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  * @value:	parameter by opaque value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  * @octets:	parameter by octet string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)  * @attr & OPTEE_MSG_ATTR_TYPE_MASK indicates if tmem, rmem or value is used in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)  * the union. OPTEE_MSG_ATTR_TYPE_VALUE_* indicates value or octets,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)  * OPTEE_MSG_ATTR_TYPE_TMEM_* indicates @tmem and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)  * OPTEE_MSG_ATTR_TYPE_RMEM_* indicates @rmem,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)  * OPTEE_MSG_ATTR_TYPE_NONE indicates that none of the members are used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) struct optee_msg_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	u64 attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		struct optee_msg_param_tmem tmem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 		struct optee_msg_param_rmem rmem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 		struct optee_msg_param_value value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		u8 octets[24];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	} u;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)  * struct optee_msg_arg - call argument
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)  * @cmd: Command, one of OPTEE_MSG_CMD_* or OPTEE_MSG_RPC_CMD_*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)  * @func: Trusted Application function, specific to the Trusted Application,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)  *	     used if cmd == OPTEE_MSG_CMD_INVOKE_COMMAND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)  * @session: In parameter for all OPTEE_MSG_CMD_* except
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  *	     OPTEE_MSG_CMD_OPEN_SESSION where it's an output parameter instead
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)  * @cancel_id: Cancellation id, a unique value to identify this request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)  * @ret: return value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)  * @ret_origin: origin of the return value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)  * @num_params: number of parameters supplied to the OS Command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)  * @params: the parameters supplied to the OS Command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)  * All normal calls to Trusted OS uses this struct. If cmd requires further
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)  * information than what these field holds it can be passed as a parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)  * tagged as meta (setting the OPTEE_MSG_ATTR_META bit in corresponding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)  * attrs field). All parameters tagged as meta has to come first.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)  * Temp memref parameters can be fragmented if supported by the Trusted OS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)  * (when optee_smc.h is bearer of this protocol this is indicated with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)  * OPTEE_SMC_SEC_CAP_UNREGISTERED_SHM). If a logical memref parameter is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)  * fragmented then has all but the last fragment the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)  * OPTEE_MSG_ATTR_FRAGMENT bit set in attrs. Even if a memref is fragmented
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  * it will still be presented as a single logical memref to the Trusted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)  * Application.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) struct optee_msg_arg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	u32 cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	u32 func;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	u32 session;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	u32 cancel_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	u32 pad;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	u32 ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	u32 ret_origin;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	u32 num_params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	/* num_params tells the actual number of element in params */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	struct optee_msg_param params[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)  * OPTEE_MSG_GET_ARG_SIZE - return size of struct optee_msg_arg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * @num_params: Number of parameters embedded in the struct optee_msg_arg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)  * Returns the size of the struct optee_msg_arg together with the number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)  * of embedded parameters.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) #define OPTEE_MSG_GET_ARG_SIZE(num_params) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	(sizeof(struct optee_msg_arg) + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	 sizeof(struct optee_msg_param) * (num_params))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)  * Part 2 - requests from normal world
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)  *****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)  * Return the following UID if using API specified in this file without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  * further extensions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)  * 384fb3e0-e7f8-11e3-af63-0002a5d5c51b.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)  * Represented in 4 32-bit words in OPTEE_MSG_UID_0, OPTEE_MSG_UID_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)  * OPTEE_MSG_UID_2, OPTEE_MSG_UID_3.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) #define OPTEE_MSG_UID_0			0x384fb3e0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) #define OPTEE_MSG_UID_1			0xe7f811e3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) #define OPTEE_MSG_UID_2			0xaf630002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) #define OPTEE_MSG_UID_3			0xa5d5c51b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) #define OPTEE_MSG_FUNCID_CALLS_UID	0xFF01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)  * Returns 2.0 if using API specified in this file without further
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)  * extensions. Represented in 2 32-bit words in OPTEE_MSG_REVISION_MAJOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  * and OPTEE_MSG_REVISION_MINOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) #define OPTEE_MSG_REVISION_MAJOR	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) #define OPTEE_MSG_REVISION_MINOR	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) #define OPTEE_MSG_FUNCID_CALLS_REVISION	0xFF03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)  * Get UUID of Trusted OS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)  * Used by non-secure world to figure out which Trusted OS is installed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)  * Note that returned UUID is the UUID of the Trusted OS, not of the API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)  * Returns UUID in 4 32-bit words in the same way as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)  * OPTEE_MSG_FUNCID_CALLS_UID described above.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) #define OPTEE_MSG_OS_OPTEE_UUID_0	0x486178e0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) #define OPTEE_MSG_OS_OPTEE_UUID_1	0xe7f811e3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) #define OPTEE_MSG_OS_OPTEE_UUID_2	0xbc5e0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) #define OPTEE_MSG_OS_OPTEE_UUID_3	0xa5d5c51b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) #define OPTEE_MSG_FUNCID_GET_OS_UUID	0x0000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)  * Get revision of Trusted OS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)  * Used by non-secure world to figure out which version of the Trusted OS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)  * is installed. Note that the returned revision is the revision of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)  * Trusted OS, not of the API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)  * Returns revision in 2 32-bit words in the same way as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)  * OPTEE_MSG_CALLS_REVISION described above.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) #define OPTEE_MSG_FUNCID_GET_OS_REVISION	0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)  * Do a secure call with struct optee_msg_arg as argument
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)  * The OPTEE_MSG_CMD_* below defines what goes in struct optee_msg_arg::cmd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)  * OPTEE_MSG_CMD_OPEN_SESSION opens a session to a Trusted Application.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)  * The first two parameters are tagged as meta, holding two value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)  * parameters to pass the following information:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)  * param[0].u.value.a-b uuid of Trusted Application
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)  * param[1].u.value.a-b uuid of Client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)  * param[1].u.value.c Login class of client OPTEE_MSG_LOGIN_*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)  * OPTEE_MSG_CMD_INVOKE_COMMAND invokes a command a previously opened
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)  * session to a Trusted Application.  struct optee_msg_arg::func is Trusted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)  * Application function, specific to the Trusted Application.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)  * OPTEE_MSG_CMD_CLOSE_SESSION closes a previously opened session to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)  * Trusted Application.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)  * OPTEE_MSG_CMD_CANCEL cancels a currently invoked command.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)  * OPTEE_MSG_CMD_REGISTER_SHM registers a shared memory reference. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)  * information is passed as:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)  * [in] param[0].attr			OPTEE_MSG_ATTR_TYPE_TMEM_INPUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)  *					[| OPTEE_MSG_ATTR_FRAGMENT]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)  * [in] param[0].u.tmem.buf_ptr		physical address (of first fragment)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)  * [in] param[0].u.tmem.size		size (of first fragment)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)  * [in] param[0].u.tmem.shm_ref		holds shared memory reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)  * ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)  * The shared memory can optionally be fragmented, temp memrefs can follow
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)  * each other with all but the last with the OPTEE_MSG_ATTR_FRAGMENT bit set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)  * OPTEE_MSG_CMD_UNREGISTER_SHM unregisteres a previously registered shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)  * memory reference. The information is passed as:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)  * [in] param[0].attr			OPTEE_MSG_ATTR_TYPE_RMEM_INPUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)  * [in] param[0].u.rmem.shm_ref		holds shared memory reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)  * [in] param[0].u.rmem.offs		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)  * [in] param[0].u.rmem.size		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) #define OPTEE_MSG_CMD_OPEN_SESSION	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) #define OPTEE_MSG_CMD_INVOKE_COMMAND	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) #define OPTEE_MSG_CMD_CLOSE_SESSION	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) #define OPTEE_MSG_CMD_CANCEL		3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) #define OPTEE_MSG_CMD_REGISTER_SHM	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) #define OPTEE_MSG_CMD_UNREGISTER_SHM	5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) #define OPTEE_MSG_FUNCID_CALL_WITH_ARG	0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) /*****************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)  * Part 3 - Requests from secure world, RPC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)  *****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)  * All RPC is done with a struct optee_msg_arg as bearer of information,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)  * struct optee_msg_arg::arg holds values defined by OPTEE_MSG_RPC_CMD_* below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)  * RPC communication with tee-supplicant is reversed compared to normal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)  * client communication desribed above. The supplicant receives requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)  * and sends responses.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)  * Load a TA into memory, defined in tee-supplicant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) #define OPTEE_MSG_RPC_CMD_LOAD_TA	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)  * Reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) #define OPTEE_MSG_RPC_CMD_RPMB		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)  * File system access, defined in tee-supplicant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) #define OPTEE_MSG_RPC_CMD_FS		2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)  * Get time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)  * Returns number of seconds and nano seconds since the Epoch,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)  * 1970-01-01 00:00:00 +0000 (UTC).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)  * [out] param[0].u.value.a	Number of seconds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)  * [out] param[0].u.value.b	Number of nano seconds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) #define OPTEE_MSG_RPC_CMD_GET_TIME	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)  * Wait queue primitive, helper for secure world to implement a wait queue.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)  * If secure world need to wait for a secure world mutex it issues a sleep
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)  * request instead of spinning in secure world. Conversely is a wakeup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)  * request issued when a secure world mutex with a thread waiting thread is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)  * unlocked.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)  * Waiting on a key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)  * [in] param[0].u.value.a OPTEE_MSG_RPC_WAIT_QUEUE_SLEEP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)  * [in] param[0].u.value.b wait key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)  * Waking up a key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)  * [in] param[0].u.value.a OPTEE_MSG_RPC_WAIT_QUEUE_WAKEUP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)  * [in] param[0].u.value.b wakeup key
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) #define OPTEE_MSG_RPC_CMD_WAIT_QUEUE	4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) #define OPTEE_MSG_RPC_WAIT_QUEUE_SLEEP	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) #define OPTEE_MSG_RPC_WAIT_QUEUE_WAKEUP	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)  * Suspend execution
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)  * [in] param[0].value	.a number of milliseconds to suspend
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) #define OPTEE_MSG_RPC_CMD_SUSPEND	5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)  * Allocate a piece of shared memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)  * Shared memory can optionally be fragmented, to support that additional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)  * spare param entries are allocated to make room for eventual fragments.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)  * The spare param entries has .attr = OPTEE_MSG_ATTR_TYPE_NONE when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)  * unused. All returned temp memrefs except the last should have the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391)  * OPTEE_MSG_ATTR_FRAGMENT bit set in the attr field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)  * [in]  param[0].u.value.a		type of memory one of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394)  *					OPTEE_MSG_RPC_SHM_TYPE_* below
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)  * [in]  param[0].u.value.b		requested size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)  * [in]  param[0].u.value.c		required alignment
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)  * [out] param[0].u.tmem.buf_ptr	physical address (of first fragment)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)  * [out] param[0].u.tmem.size		size (of first fragment)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)  * [out] param[0].u.tmem.shm_ref	shared memory reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)  * ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)  * [out] param[n].u.tmem.buf_ptr	physical address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)  * [out] param[n].u.tmem.size		size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)  * [out] param[n].u.tmem.shm_ref	shared memory reference (same value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)  *					as in param[n-1].u.tmem.shm_ref)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) #define OPTEE_MSG_RPC_CMD_SHM_ALLOC	6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) /* Memory that can be shared with a non-secure user space application */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) #define OPTEE_MSG_RPC_SHM_TYPE_APPL	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) /* Memory only shared with non-secure kernel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) #define OPTEE_MSG_RPC_SHM_TYPE_KERNEL	1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)  * Free shared memory previously allocated with OPTEE_MSG_RPC_CMD_SHM_ALLOC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)  * [in]  param[0].u.value.a		type of memory one of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417)  *					OPTEE_MSG_RPC_SHM_TYPE_* above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)  * [in]  param[0].u.value.b		value of shared memory reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419)  *					returned in param[0].u.tmem.shm_ref
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)  *					above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) #define OPTEE_MSG_RPC_CMD_SHM_FREE	7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)  * Access a device on an i2c bus
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)  * [in]  param[0].u.value.a		mode: RD(0), WR(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)  * [in]  param[0].u.value.b		i2c adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)  * [in]  param[0].u.value.c		i2c chip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)  * [in]  param[1].u.value.a		i2c control flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)  * [in/out] memref[2]			buffer to exchange the transfer data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434)  *					with the secure world
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)  * [out]  param[3].u.value.a		bytes transferred by the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) #define OPTEE_MSG_RPC_CMD_I2C_TRANSFER 21
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) /* I2C master transfer modes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) #define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) #define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) /* I2C master control flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) #define OPTEE_MSG_RPC_CMD_I2C_FLAGS_TEN_BIT  BIT(0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) #endif /* _OPTEE_MSG_H */