![]() |
|
|||
0001 /* SPDX-License-Identifier: BSD-2-Clause */ 0002 /* 0003 * Copyright (c) 2019-2021, Linaro Limited 0004 */ 0005 0006 /* 0007 * This file is exported by OP-TEE and is kept in sync between secure world 0008 * and normal world drivers. We're using ARM FF-A 1.0 specification. 0009 */ 0010 0011 #ifndef __OPTEE_FFA_H 0012 #define __OPTEE_FFA_H 0013 0014 #include <linux/arm_ffa.h> 0015 0016 /* 0017 * Normal world sends requests with FFA_MSG_SEND_DIRECT_REQ and 0018 * responses are returned with FFA_MSG_SEND_DIRECT_RESP for normal 0019 * messages. 0020 * 0021 * All requests with FFA_MSG_SEND_DIRECT_REQ and FFA_MSG_SEND_DIRECT_RESP 0022 * are using the AArch32 SMC calling convention with register usage as 0023 * defined in FF-A specification: 0024 * w0: Function ID (0x8400006F or 0x84000070) 0025 * w1: Source/Destination IDs 0026 * w2: Reserved (MBZ) 0027 * w3-w7: Implementation defined, free to be used below 0028 */ 0029 0030 #define OPTEE_FFA_VERSION_MAJOR 1 0031 #define OPTEE_FFA_VERSION_MINOR 0 0032 0033 #define OPTEE_FFA_BLOCKING_CALL(id) (id) 0034 #define OPTEE_FFA_YIELDING_CALL_BIT 31 0035 #define OPTEE_FFA_YIELDING_CALL(id) ((id) | BIT(OPTEE_FFA_YIELDING_CALL_BIT)) 0036 0037 /* 0038 * Returns the API version implemented, currently follows the FF-A version. 0039 * Call register usage: 0040 * w3: Service ID, OPTEE_FFA_GET_API_VERSION 0041 * w4-w7: Not used (MBZ) 0042 * 0043 * Return register usage: 0044 * w3: OPTEE_FFA_VERSION_MAJOR 0045 * w4: OPTEE_FFA_VERSION_MINOR 0046 * w5-w7: Not used (MBZ) 0047 */ 0048 #define OPTEE_FFA_GET_API_VERSION OPTEE_FFA_BLOCKING_CALL(0) 0049 0050 /* 0051 * Returns the revision of OP-TEE. 0052 * 0053 * Used by non-secure world to figure out which version of the Trusted OS 0054 * is installed. Note that the returned revision is the revision of the 0055 * Trusted OS, not of the API. 0056 * 0057 * Call register usage: 0058 * w3: Service ID, OPTEE_FFA_GET_OS_VERSION 0059 * w4-w7: Unused (MBZ) 0060 * 0061 * Return register usage: 0062 * w3: CFG_OPTEE_REVISION_MAJOR 0063 * w4: CFG_OPTEE_REVISION_MINOR 0064 * w5: TEE_IMPL_GIT_SHA1 (or zero if not supported) 0065 */ 0066 #define OPTEE_FFA_GET_OS_VERSION OPTEE_FFA_BLOCKING_CALL(1) 0067 0068 /* 0069 * Exchange capabilities between normal world and secure world. 0070 * 0071 * Currently there are no defined capabilities. When features are added new 0072 * capabilities may be added. 0073 * 0074 * Call register usage: 0075 * w3: Service ID, OPTEE_FFA_EXCHANGE_CAPABILITIES 0076 * w4-w7: Note used (MBZ) 0077 * 0078 * Return register usage: 0079 * w3: Error code, 0 on success 0080 * w4: Bit[7:0]: Number of parameters needed for RPC to be supplied 0081 * as the second MSG arg struct for 0082 * OPTEE_FFA_YIELDING_CALL_WITH_ARG. 0083 * Bit[31:8]: Reserved (MBZ) 0084 * w5: Bitfield of secure world capabilities OPTEE_FFA_SEC_CAP_* below, 0085 * unused bits MBZ. 0086 * w6-w7: Not used (MBZ) 0087 */ 0088 /* 0089 * Secure world supports giving an offset into the argument shared memory 0090 * object, see also OPTEE_FFA_YIELDING_CALL_WITH_ARG 0091 */ 0092 #define OPTEE_FFA_SEC_CAP_ARG_OFFSET BIT(0) 0093 0094 #define OPTEE_FFA_EXCHANGE_CAPABILITIES OPTEE_FFA_BLOCKING_CALL(2) 0095 0096 /* 0097 * Unregister shared memory 0098 * 0099 * Call register usage: 0100 * w3: Service ID, OPTEE_FFA_YIELDING_CALL_UNREGISTER_SHM 0101 * w4: Shared memory handle, lower bits 0102 * w5: Shared memory handle, higher bits 0103 * w6-w7: Not used (MBZ) 0104 * 0105 * Return register usage: 0106 * w3: Error code, 0 on success 0107 * w4-w7: Note used (MBZ) 0108 */ 0109 #define OPTEE_FFA_UNREGISTER_SHM OPTEE_FFA_BLOCKING_CALL(3) 0110 0111 /* 0112 * Call with struct optee_msg_arg as argument in the supplied shared memory 0113 * with a zero internal offset and normal cached memory attributes. 0114 * Register usage: 0115 * w3: Service ID, OPTEE_FFA_YIELDING_CALL_WITH_ARG 0116 * w4: Lower 32 bits of a 64-bit Shared memory handle 0117 * w5: Upper 32 bits of a 64-bit Shared memory handle 0118 * w6: Offset into shared memory pointing to a struct optee_msg_arg 0119 * right after the parameters of this struct (at offset 0120 * OPTEE_MSG_GET_ARG_SIZE(num_params) follows a struct optee_msg_arg 0121 * for RPC, this struct has reserved space for the number of RPC 0122 * parameters as returned by OPTEE_FFA_EXCHANGE_CAPABILITIES. 0123 * MBZ unless the bit OPTEE_FFA_SEC_CAP_ARG_OFFSET is received with 0124 * OPTEE_FFA_EXCHANGE_CAPABILITIES. 0125 * w7: Not used (MBZ) 0126 * Resume from RPC. Register usage: 0127 * w3: Service ID, OPTEE_FFA_YIELDING_CALL_RESUME 0128 * w4-w6: Not used (MBZ) 0129 * w7: Resume info 0130 * 0131 * Normal return (yielding call is completed). Register usage: 0132 * w3: Error code, 0 on success 0133 * w4: OPTEE_FFA_YIELDING_CALL_RETURN_DONE 0134 * w5-w7: Not used (MBZ) 0135 * 0136 * RPC interrupt return (RPC from secure world). Register usage: 0137 * w3: Error code == 0 0138 * w4: Any defined RPC code but OPTEE_FFA_YIELDING_CALL_RETURN_DONE 0139 * w5-w6: Not used (MBZ) 0140 * w7: Resume info 0141 * 0142 * Possible error codes in register w3: 0143 * 0: Success 0144 * FFA_DENIED: w4 isn't one of OPTEE_FFA_YIELDING_CALL_START 0145 * OPTEE_FFA_YIELDING_CALL_RESUME 0146 * 0147 * Possible error codes for OPTEE_FFA_YIELDING_CALL_START, 0148 * FFA_BUSY: Number of OP-TEE OS threads exceeded, 0149 * try again later 0150 * FFA_DENIED: RPC shared memory object not found 0151 * FFA_INVALID_PARAMETER: Bad shared memory handle or offset into the memory 0152 * 0153 * Possible error codes for OPTEE_FFA_YIELDING_CALL_RESUME 0154 * FFA_INVALID_PARAMETER: Bad resume info 0155 */ 0156 #define OPTEE_FFA_YIELDING_CALL_WITH_ARG OPTEE_FFA_YIELDING_CALL(0) 0157 #define OPTEE_FFA_YIELDING_CALL_RESUME OPTEE_FFA_YIELDING_CALL(1) 0158 0159 #define OPTEE_FFA_YIELDING_CALL_RETURN_DONE 0 0160 #define OPTEE_FFA_YIELDING_CALL_RETURN_RPC_CMD 1 0161 #define OPTEE_FFA_YIELDING_CALL_RETURN_INTERRUPT 2 0162 0163 #endif /*__OPTEE_FFA_H*/
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |