Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * SPDX-License-Identifier: BSD-3-Clause |
| 3 | * |
| 4 | * SPDX-FileCopyrightText: Copyright TF-RMM Contributors. |
| 5 | */ |
| 6 | |
| 7 | #ifndef SMC_RMI_H |
| 8 | #define SMC_RMI_H |
| 9 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 10 | #include <smc.h> |
| 11 | |
| 12 | /* |
| 13 | * This file describes the Realm Management Interface (RMI) Application Binary |
| 14 | * Interface (ABI) for SMC calls made from Non-secure state to the RMM and |
| 15 | * serviced by the RMM. |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | /* |
| 19 | * The major version number of the RMI implementation. Increase this whenever |
| 20 | * the binary format or semantics of the SMC calls change. |
| 21 | */ |
AlexeiFedorov | 2cc6cee | 2023-10-09 16:19:05 +0100 | [diff] [blame] | 22 | #define RMI_ABI_VERSION_MAJOR UL(1) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 23 | |
| 24 | /* |
| 25 | * The minor version number of the RMI implementation. Increase this when |
| 26 | * a bug is fixed, or a feature is added without breaking binary compatibility. |
| 27 | */ |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 28 | #ifdef RMM_V1_1 |
| 29 | #define RMI_ABI_VERSION_MINOR UL(1) |
| 30 | #else |
AlexeiFedorov | ddf5daf | 2023-10-10 14:28:56 +0100 | [diff] [blame] | 31 | #define RMI_ABI_VERSION_MINOR UL(0) |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 32 | #endif |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 33 | |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 34 | #define RMI_ABI_VERSION ((RMI_ABI_VERSION_MAJOR << U(16)) | \ |
AlexeiFedorov | ddf5daf | 2023-10-10 14:28:56 +0100 | [diff] [blame] | 35 | RMI_ABI_VERSION_MINOR) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 36 | |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 37 | #define RMI_ABI_VERSION_GET_MAJOR(_version) ((_version) >> U(16)) |
| 38 | #define RMI_ABI_VERSION_GET_MINOR(_version) ((_version) & U(0xFFFF)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 39 | |
| 40 | #define SMC64_RMI_FID(_offset) SMC64_STD_FID(RMI, _offset) |
| 41 | |
| 42 | #define IS_SMC64_RMI_FID(_fid) IS_SMC64_STD_FAST_IN_RANGE(RMI, _fid) |
| 43 | |
Yousuf A | 0ec040d | 2022-10-31 12:30:57 +0000 | [diff] [blame] | 44 | /* Command completed successfully. index is zero. */ |
| 45 | #define RMI_SUCCESS U(0) |
| 46 | |
| 47 | /* |
| 48 | * The value of a command input value caused the command to fail. |
| 49 | * Index is zero. |
| 50 | */ |
| 51 | #define RMI_ERROR_INPUT U(1) |
| 52 | |
| 53 | /* |
| 54 | * An attribute of a Realm does not match the expected value. |
| 55 | * index varies between usages. |
| 56 | */ |
| 57 | #define RMI_ERROR_REALM U(2) |
| 58 | |
| 59 | /* |
| 60 | * An attribute of a REC does not match the expected value. |
| 61 | * Index is zero. |
| 62 | */ |
| 63 | #define RMI_ERROR_REC U(3) |
| 64 | |
| 65 | /* |
| 66 | * An RTT walk terminated before reaching the target RTT level, or reached |
| 67 | * an RTTE with an unexpected value. index: RTT level at which the walk |
| 68 | * terminated |
| 69 | */ |
| 70 | #define RMI_ERROR_RTT U(4) |
| 71 | |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 72 | /* An attribute of a device does not match the expected value */ |
| 73 | #define RMI_ERROR_DEVICE U(5) |
| 74 | |
| 75 | /* The command is not supported */ |
| 76 | #define RMI_ERROR_NOT_SUPPORTED U(6) |
| 77 | |
| 78 | /* RTTE in an auxiliary RTT contained an unexpected value */ |
| 79 | #define RMI_ERROR_RTT_AUX U(7) |
| 80 | |
| 81 | /* Max number of RMI Status Errors. */ |
| 82 | #define RMI_ERROR_COUNT_MAX U(8) |
Yousuf A | 0ec040d | 2022-10-31 12:30:57 +0000 | [diff] [blame] | 83 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 84 | /* |
| 85 | * The number of GPRs (starting from X0) that are |
| 86 | * configured by the host when a REC is created. |
| 87 | */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 88 | #define REC_CREATE_NR_GPRS U(8) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 89 | |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 90 | #define REC_PARAMS_FLAG_RUNNABLE (UL(1) << 0) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 91 | |
| 92 | /* |
| 93 | * The number of GPRs (starting from X0) per voluntary exit context. |
| 94 | * Per SMCCC. |
| 95 | */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 96 | #define REC_EXIT_NR_GPRS U(31) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 97 | |
| 98 | /* RmiHashAlgorithm type */ |
AlexeiFedorov | 6a4314e | 2023-10-20 15:40:14 +0100 | [diff] [blame] | 99 | #define RMI_HASH_SHA_256 0U |
| 100 | #define RMI_HASH_SHA_512 1U |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 101 | |
| 102 | /* Maximum number of Interrupt Controller List Registers */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 103 | #define REC_GIC_NUM_LRS U(16) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 104 | |
Mate Toth-Pal | 0a8f37c | 2023-08-09 13:37:55 +0200 | [diff] [blame] | 105 | #ifndef CBMC |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 106 | /* Maximum number of auxiliary granules required for a REC */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 107 | #define MAX_REC_AUX_GRANULES U(16) |
Mate Toth-Pal | 0a8f37c | 2023-08-09 13:37:55 +0200 | [diff] [blame] | 108 | #else /* CBMC */ |
| 109 | #define MAX_REC_AUX_GRANULES U(1) |
| 110 | #endif /* CBMC */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 111 | |
AlexeiFedorov | 9b29c6b | 2023-09-12 17:09:50 +0100 | [diff] [blame] | 112 | /* Whether Host has completed emulation for an Emulatable Data Abort */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 113 | #define REC_ENTRY_FLAG_EMUL_MMIO (UL(1) << 0) |
AlexeiFedorov | 9b29c6b | 2023-09-12 17:09:50 +0100 | [diff] [blame] | 114 | |
| 115 | /* Whether to inject a Synchronous External Abort into Realm */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 116 | #define REC_ENTRY_FLAG_INJECT_SEA (UL(1) << 1) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 117 | |
AlexeiFedorov | 9b29c6b | 2023-09-12 17:09:50 +0100 | [diff] [blame] | 118 | /* Whether to trap WFI/WFE execution by Realm */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 119 | #define REC_ENTRY_FLAG_TRAP_WFI (UL(1) << 2) |
| 120 | #define REC_ENTRY_FLAG_TRAP_WFE (UL(1) << 3) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 121 | |
AlexeiFedorov | 9b29c6b | 2023-09-12 17:09:50 +0100 | [diff] [blame] | 122 | /* Host response to RIPAS change request */ |
| 123 | #define REC_ENTRY_FLAG_RIPAS_RESPONSE (UL(1) << 4) |
| 124 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 125 | /* |
| 126 | * RmiRecExitReason represents the reason for a REC exit. |
| 127 | * This is returned to NS hosts via RMI_REC_ENTER::run_ptr. |
| 128 | */ |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 129 | #define RMI_EXIT_SYNC U(0) |
| 130 | #define RMI_EXIT_IRQ U(1) |
| 131 | #define RMI_EXIT_FIQ U(2) |
| 132 | #define RMI_EXIT_PSCI U(3) |
| 133 | #define RMI_EXIT_RIPAS_CHANGE U(4) |
| 134 | #define RMI_EXIT_HOST_CALL U(5) |
| 135 | #define RMI_EXIT_SERROR U(6) |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 136 | #define RMI_EXIT_DEV_COMM U(7) |
| 137 | #define RMI_EXIT_RTT_REQUEST U(8) |
| 138 | #define RMI_EXIT_S2AP_CHANGE U(9) |
| 139 | #define RMI_EXIT_VDEV_REQUEST U(10) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 140 | |
| 141 | /* RmiRttEntryState represents the state of an RTTE */ |
AlexeiFedorov | c53b1f7 | 2023-07-04 15:37:03 +0100 | [diff] [blame] | 142 | #define RMI_UNASSIGNED UL(0) |
| 143 | #define RMI_ASSIGNED UL(1) |
| 144 | #define RMI_TABLE UL(2) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 145 | |
AlexeiFedorov | 7bb7a70 | 2023-01-17 17:04:14 +0000 | [diff] [blame] | 146 | /* RmiFeature enumerations */ |
AlexeiFedorov | c09b165 | 2023-04-04 15:41:37 +0100 | [diff] [blame] | 147 | #define RMI_FEATURE_FALSE UL(0) |
| 148 | #define RMI_FEATURE_TRUE UL(1) |
AlexeiFedorov | 7bb7a70 | 2023-01-17 17:04:14 +0000 | [diff] [blame] | 149 | |
Yousuf A | a297b9b | 2022-10-13 13:54:21 +0100 | [diff] [blame] | 150 | /* RmiFeatureRegister0 format */ |
AlexeiFedorov | 9baa100 | 2024-08-05 16:02:19 +0100 | [diff] [blame] | 151 | #define RMI_FEATURE_REGISTER_0_INDEX UL(0) |
Yousuf A | a297b9b | 2022-10-13 13:54:21 +0100 | [diff] [blame] | 152 | |
AlexeiFedorov | 9baa100 | 2024-08-05 16:02:19 +0100 | [diff] [blame] | 153 | #define RMI_FEATURE_REGISTER_0_S2SZ_SHIFT UL(0) |
| 154 | #define RMI_FEATURE_REGISTER_0_S2SZ_WIDTH UL(8) |
Yousuf A | a297b9b | 2022-10-13 13:54:21 +0100 | [diff] [blame] | 155 | |
AlexeiFedorov | 9baa100 | 2024-08-05 16:02:19 +0100 | [diff] [blame] | 156 | #define RMI_FEATURE_REGISTER_0_LPA2_SHIFT UL(8) |
| 157 | #define RMI_FEATURE_REGISTER_0_LPA2_WIDTH UL(1) |
Yousuf A | a297b9b | 2022-10-13 13:54:21 +0100 | [diff] [blame] | 158 | |
AlexeiFedorov | 9baa100 | 2024-08-05 16:02:19 +0100 | [diff] [blame] | 159 | #define RMI_FEATURE_REGISTER_0_SVE_EN_SHIFT UL(9) |
| 160 | #define RMI_FEATURE_REGISTER_0_SVE_EN_WIDTH UL(1) |
Yousuf A | a297b9b | 2022-10-13 13:54:21 +0100 | [diff] [blame] | 161 | |
AlexeiFedorov | 9baa100 | 2024-08-05 16:02:19 +0100 | [diff] [blame] | 162 | #define RMI_FEATURE_REGISTER_0_SVE_VL_SHIFT UL(10) |
| 163 | #define RMI_FEATURE_REGISTER_0_SVE_VL_WIDTH UL(4) |
Yousuf A | a297b9b | 2022-10-13 13:54:21 +0100 | [diff] [blame] | 164 | |
AlexeiFedorov | 9baa100 | 2024-08-05 16:02:19 +0100 | [diff] [blame] | 165 | #define RMI_FEATURE_REGISTER_0_NUM_BPS_SHIFT UL(14) |
| 166 | #define RMI_FEATURE_REGISTER_0_NUM_BPS_WIDTH UL(6) |
AlexeiFedorov | 1800292 | 2023-04-06 10:19:51 +0100 | [diff] [blame] | 167 | |
AlexeiFedorov | 9baa100 | 2024-08-05 16:02:19 +0100 | [diff] [blame] | 168 | #define RMI_FEATURE_REGISTER_0_NUM_WPS_SHIFT UL(20) |
| 169 | #define RMI_FEATURE_REGISTER_0_NUM_WPS_WIDTH UL(6) |
AlexeiFedorov | 1800292 | 2023-04-06 10:19:51 +0100 | [diff] [blame] | 170 | |
AlexeiFedorov | 9baa100 | 2024-08-05 16:02:19 +0100 | [diff] [blame] | 171 | #define RMI_FEATURE_REGISTER_0_PMU_EN_SHIFT UL(26) |
| 172 | #define RMI_FEATURE_REGISTER_0_PMU_EN_WIDTH UL(1) |
AlexeiFedorov | 7bb7a70 | 2023-01-17 17:04:14 +0000 | [diff] [blame] | 173 | |
AlexeiFedorov | 9baa100 | 2024-08-05 16:02:19 +0100 | [diff] [blame] | 174 | #define RMI_FEATURE_REGISTER_0_PMU_NUM_CTRS_SHIFT UL(27) |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 175 | #define RMI_FEATURE_REGISTER_0_PMU_NUM_CTRS_WIDTH UL(5) |
AlexeiFedorov | 7bb7a70 | 2023-01-17 17:04:14 +0000 | [diff] [blame] | 176 | |
AlexeiFedorov | 9baa100 | 2024-08-05 16:02:19 +0100 | [diff] [blame] | 177 | #define RMI_FEATURE_REGISTER_0_HASH_SHA_256_SHIFT UL(32) |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 178 | #define RMI_FEATURE_REGISTER_0_HASH_SHA_256_WIDTH UL(1) |
AlexeiFedorov | 1800292 | 2023-04-06 10:19:51 +0100 | [diff] [blame] | 179 | |
AlexeiFedorov | 9baa100 | 2024-08-05 16:02:19 +0100 | [diff] [blame] | 180 | #define RMI_FEATURE_REGISTER_0_HASH_SHA_512_SHIFT UL(33) |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 181 | #define RMI_FEATURE_REGISTER_0_HASH_SHA_512_WIDTH UL(1) |
Arunachalam Ganapathy | f649121 | 2023-02-23 16:04:34 +0000 | [diff] [blame] | 182 | |
AlexeiFedorov | 9baa100 | 2024-08-05 16:02:19 +0100 | [diff] [blame] | 183 | #define RMI_FEATURE_REGISTER_0_GICV3_NUM_LRS_SHIFT UL(34) |
| 184 | #define RMI_FEATURE_REGISTER_0_GICV3_NUM_LRS_WIDTH UL(4) |
| 185 | |
| 186 | #define RMI_FEATURE_REGISTER_0_MAX_RECS_ORDER_SHIFT UL(38) |
| 187 | #define RMI_FEATURE_REGISTER_0_MAX_RECS_ORDER_WIDTH UL(4) |
| 188 | |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 189 | #define RMI_FEATURE_REGISTER_0_DA_EN_SHIFT UL(42) |
| 190 | #define RMI_FEATURE_REGISTER_0_DA_EN_WIDTH UL(1) |
| 191 | |
| 192 | #define RMI_FEATURE_REGISTER_0_PLANE_RTT_SHIFT UL(43) |
| 193 | #define RMI_FEATURE_REGISTER_0_PLANE_RTT_WIDTH UL(2) |
| 194 | |
| 195 | #define RMI_FEATURE_REGISTER_0_MAX_NUM_AUX_PLANES_SHIFT UL(45) |
| 196 | #define RMI_FEATURE_REGISTER_0_MAX_NUM_AUX_PLANES_WIDTH UL(4) |
| 197 | |
AlexeiFedorov | c53b1f7 | 2023-07-04 15:37:03 +0100 | [diff] [blame] | 198 | /* The RmiRipas enumeration represents realm IPA state */ |
| 199 | |
| 200 | /* Address where no Realm resources are mapped */ |
| 201 | #define RMI_EMPTY UL(0) |
| 202 | |
| 203 | /* Address where private code or data owned by the Realm is mapped */ |
| 204 | #define RMI_RAM UL(1) |
| 205 | |
| 206 | /* Address which is inaccessible to the Realm due to an action taken by the Host */ |
| 207 | #define RMI_DESTROYED UL(2) |
Yousuf A | 6280815 | 2022-10-31 10:35:42 +0000 | [diff] [blame] | 208 | |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 209 | /* Address where MMIO of an assigned Realm device is mapped. */ |
| 210 | #define RMI_IO UL(3) |
| 211 | |
AlexeiFedorov | 4d4e734 | 2023-06-12 12:10:06 +0100 | [diff] [blame] | 212 | /* RmiPmuOverflowStatus enumeration representing PMU overflow status */ |
| 213 | #define RMI_PMU_OVERFLOW_NOT_ACTIVE U(0) |
| 214 | #define RMI_PMU_OVERFLOW_ACTIVE U(1) |
| 215 | |
AlexeiFedorov | 9b29c6b | 2023-09-12 17:09:50 +0100 | [diff] [blame] | 216 | /* |
| 217 | * RmiResponse enumeration represents whether the Host accepted |
| 218 | * or rejected a Realm request |
| 219 | */ |
AlexeiFedorov | 6a4314e | 2023-10-20 15:40:14 +0100 | [diff] [blame] | 220 | #define RMI_ACCEPT 0U |
| 221 | #define RMI_REJECT 1U |
AlexeiFedorov | 9b29c6b | 2023-09-12 17:09:50 +0100 | [diff] [blame] | 222 | |
AlexeiFedorov | 2cc6cee | 2023-10-09 16:19:05 +0100 | [diff] [blame] | 223 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 224 | * FID: 0xC4000150 |
| 225 | * |
AlexeiFedorov | 2cc6cee | 2023-10-09 16:19:05 +0100 | [diff] [blame] | 226 | * arg0: Requested interface version |
| 227 | * |
| 228 | * ret0: Command return status |
| 229 | * ret1: Lower implemented interface revision |
| 230 | * ret2: Higher implemented interface revision |
| 231 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 232 | #define SMC_RMI_VERSION SMC64_RMI_FID(U(0x0)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 233 | |
| 234 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 235 | * FID: 0xC4000151 |
| 236 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 237 | * arg0 == target granule address |
| 238 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 239 | #define SMC_RMI_GRANULE_DELEGATE SMC64_RMI_FID(U(0x1)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 240 | |
| 241 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 242 | * FID: 0xC4000152 |
| 243 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 244 | * arg0 == target granule address |
| 245 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 246 | #define SMC_RMI_GRANULE_UNDELEGATE SMC64_RMI_FID(U(0x2)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 247 | |
| 248 | /* RmiDataMeasureContent type */ |
AlexeiFedorov | 93f5ec5 | 2023-08-31 14:26:53 +0100 | [diff] [blame] | 249 | #define RMI_NO_MEASURE_CONTENT U(0) |
| 250 | #define RMI_MEASURE_CONTENT U(1) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 251 | |
| 252 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 253 | * FID: 0xC4000153 |
| 254 | * |
AlexeiFedorov | ac923c8 | 2023-04-06 15:12:04 +0100 | [diff] [blame] | 255 | * arg0 == RD address |
| 256 | * arg1 == data address |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 257 | * arg2 == map address |
| 258 | * arg3 == SRC address |
| 259 | * arg4 == flags |
| 260 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 261 | #define SMC_RMI_DATA_CREATE SMC64_RMI_FID(U(0x3)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 262 | |
| 263 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 264 | * FID: 0xC4000154 |
| 265 | * |
AlexeiFedorov | ac923c8 | 2023-04-06 15:12:04 +0100 | [diff] [blame] | 266 | * arg0 == RD address |
| 267 | * arg1 == data address |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 268 | * arg2 == map address |
| 269 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 270 | #define SMC_RMI_DATA_CREATE_UNKNOWN SMC64_RMI_FID(U(0x4)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 271 | |
| 272 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 273 | * FID: 0xC4000155 |
| 274 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 275 | * arg0 == RD address |
| 276 | * arg1 == map address |
AlexeiFedorov | e2002be | 2023-04-19 17:20:12 +0100 | [diff] [blame] | 277 | * |
| 278 | * ret1 == Address(PA) of the DATA granule, if ret0 == RMI_SUCCESS. |
| 279 | * Otherwise, undefined. |
| 280 | * ret2 == Top of the non-live address region. Only valid |
AlexeiFedorov | 697445b | 2023-04-25 15:27:57 +0100 | [diff] [blame] | 281 | * if ret0 == RMI_SUCCESS or ret0 == (RMI_ERROR_RTT, x) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 282 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 283 | #define SMC_RMI_DATA_DESTROY SMC64_RMI_FID(U(0x5)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 284 | |
| 285 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 286 | * FID: 0xC4000156 |
| 287 | */ |
| 288 | #define SMC_RMI_PDEV_AUX_COUNT SMC64_RMI_FID(U(0x6)) |
| 289 | |
| 290 | /* |
| 291 | * FID: 0xC4000157 |
| 292 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 293 | * arg0 == RD address |
| 294 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 295 | #define SMC_RMI_REALM_ACTIVATE SMC64_RMI_FID(U(0x7)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 296 | |
| 297 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 298 | * FID: 0xC4000158 |
| 299 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 300 | * arg0 == RD address |
AlexeiFedorov | ac923c8 | 2023-04-06 15:12:04 +0100 | [diff] [blame] | 301 | * arg1 == struct rmi_realm_params address |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 302 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 303 | #define SMC_RMI_REALM_CREATE SMC64_RMI_FID(U(0x8)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 304 | |
| 305 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 306 | * FID: 0xC4000159 |
| 307 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 308 | * arg0 == RD address |
| 309 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 310 | #define SMC_RMI_REALM_DESTROY SMC64_RMI_FID(U(0x9)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 311 | |
| 312 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 313 | * FID: 0xC400015A |
| 314 | * |
AlexeiFedorov | ac923c8 | 2023-04-06 15:12:04 +0100 | [diff] [blame] | 315 | * arg0 == RD address |
| 316 | * arg1 == REC address |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 317 | * arg2 == struct rmm_rec address |
| 318 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 319 | #define SMC_RMI_REC_CREATE SMC64_RMI_FID(U(0xA)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 320 | |
| 321 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 322 | * FID: 0xC400015B |
| 323 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 324 | * arg0 == REC address |
| 325 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 326 | #define SMC_RMI_REC_DESTROY SMC64_RMI_FID(U(0xB)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 327 | |
| 328 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 329 | * FID: 0xC400015C |
| 330 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 331 | * arg0 == rec address |
AlexeiFedorov | ac923c8 | 2023-04-06 15:12:04 +0100 | [diff] [blame] | 332 | * arg1 == struct rec_run address |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 333 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 334 | #define SMC_RMI_REC_ENTER SMC64_RMI_FID(U(0xC)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 335 | |
| 336 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 337 | * FID: 0xC400015D |
| 338 | * |
AlexeiFedorov | ac923c8 | 2023-04-06 15:12:04 +0100 | [diff] [blame] | 339 | * arg0 == RD address |
| 340 | * arg1 == RTT address |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 341 | * arg2 == map address |
| 342 | * arg3 == level |
| 343 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 344 | #define SMC_RMI_RTT_CREATE SMC64_RMI_FID(U(0xD)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 345 | |
| 346 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 347 | * FID: 0xC400015E |
| 348 | * |
AlexeiFedorov | e2002be | 2023-04-19 17:20:12 +0100 | [diff] [blame] | 349 | * arg0 == RD address |
| 350 | * arg1 == map address |
| 351 | * arg2 == level |
| 352 | * |
| 353 | * ret1 == Address (PA) of the RTT, if ret0 == RMI_SUCCESS |
| 354 | * Otherwise, undefined. |
| 355 | * ret2 == Top of the non-live address region. Only valid |
AlexeiFedorov | 697445b | 2023-04-25 15:27:57 +0100 | [diff] [blame] | 356 | * if ret0 == RMI_SUCCESS or ret0 == (RMI_ERROR_RTT, x) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 357 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 358 | #define SMC_RMI_RTT_DESTROY SMC64_RMI_FID(U(0xE)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 359 | |
| 360 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 361 | * FID: 0xC400015F |
| 362 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 363 | * arg0 == RD address |
| 364 | * arg1 == map address |
| 365 | * arg2 == level |
| 366 | * arg3 == s2tte |
| 367 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 368 | #define SMC_RMI_RTT_MAP_UNPROTECTED SMC64_RMI_FID(U(0xF)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 369 | |
| 370 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 371 | * FID: 0xC4000160 |
| 372 | */ |
| 373 | #define SMC_RMI_VDEV_AUX_COUNT SMC64_RMI_FID(U(0x10)) |
| 374 | |
| 375 | /* |
| 376 | * FID: 0xC4000161 |
| 377 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 378 | * arg0 == RD address |
| 379 | * arg1 == map address |
| 380 | * arg2 == level |
AlexeiFedorov | 697445b | 2023-04-25 15:27:57 +0100 | [diff] [blame] | 381 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 382 | * ret1 == level |
| 383 | * ret2 == s2tte type |
| 384 | * ret3 == s2tte |
| 385 | * ret4 == ripas |
AlexeiFedorov | 697445b | 2023-04-25 15:27:57 +0100 | [diff] [blame] | 386 | * if ret0 == RMI_SUCCESS, otherwise, undefined. |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 387 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 388 | #define SMC_RMI_RTT_READ_ENTRY SMC64_RMI_FID(U(0x11)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 389 | |
| 390 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 391 | * FID: 0xC4000162 |
| 392 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 393 | * arg0 == RD address |
| 394 | * arg1 == map address |
| 395 | * arg2 == level |
| 396 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 397 | #define SMC_RMI_RTT_UNMAP_UNPROTECTED SMC64_RMI_FID(U(0x12)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 398 | |
| 399 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 400 | * FID: 0xC4000164 |
| 401 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 402 | * arg0 == calling rec address |
| 403 | * arg1 == target rec address |
| 404 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 405 | #define SMC_RMI_PSCI_COMPLETE SMC64_RMI_FID(U(0x14)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 406 | |
| 407 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 408 | * FID: 0xC4000165 |
| 409 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 410 | * arg0 == Feature register index |
| 411 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 412 | #define SMC_RMI_FEATURES SMC64_RMI_FID(U(0x15)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 413 | |
| 414 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 415 | * FID: 0xC4000166 |
| 416 | * |
AlexeiFedorov | e2002be | 2023-04-19 17:20:12 +0100 | [diff] [blame] | 417 | * arg0 == RD address |
| 418 | * arg1 == map address |
| 419 | * arg2 == level |
| 420 | * |
| 421 | * ret1 == Address(PA) of the RTT folded, if ret0 == RMI_SUCCESS |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 422 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 423 | #define SMC_RMI_RTT_FOLD SMC64_RMI_FID(U(0x16)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 424 | |
| 425 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 426 | * FID: 0xC4000167 |
| 427 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 428 | * arg0 == RD address |
| 429 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 430 | #define SMC_RMI_REC_AUX_COUNT SMC64_RMI_FID(U(0x17)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 431 | |
| 432 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 433 | * FID: 0xC4000168 |
| 434 | * |
AlexeiFedorov | ac923c8 | 2023-04-06 15:12:04 +0100 | [diff] [blame] | 435 | * arg0 == RD address |
AlexeiFedorov | 960d161 | 2023-04-25 13:23:39 +0100 | [diff] [blame] | 436 | * arg1 == start address |
| 437 | * arg2 == end address |
| 438 | * |
| 439 | * ret1 == Top of the address range where the RIPAS was updated, |
| 440 | * if ret0 == RMI_SUCCESS |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 441 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 442 | #define SMC_RMI_RTT_INIT_RIPAS SMC64_RMI_FID(U(0x18)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 443 | |
| 444 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 445 | * FID: 0xC4000169 |
| 446 | * |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 447 | * arg0 == RD address |
| 448 | * arg1 == REC address |
AlexeiFedorov | 5cf35ba | 2023-04-25 10:02:20 +0100 | [diff] [blame] | 449 | * arg2 == start address |
| 450 | * arg3 == end address |
| 451 | * |
| 452 | * ret1 == Top of the address range where the RIPAS was updated, |
| 453 | * if ret0 == RMI_SUCCESS |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 454 | */ |
Arunachalam Ganapathy | 807dda8 | 2024-05-03 14:22:43 +0100 | [diff] [blame] | 455 | #define SMC_RMI_RTT_SET_RIPAS SMC64_RMI_FID(U(0x19)) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 456 | |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 457 | /* |
| 458 | * TODO: Update the documentation of new FIDs once the 1.1 spec has stabilized. |
| 459 | */ |
| 460 | |
| 461 | /* |
| 462 | * FID: 0xC4000170 |
| 463 | */ |
| 464 | #define SMC_RMI_GRANULE_DEV_DELEGATE SMC64_RMI_FID(U(0x20)) |
| 465 | |
| 466 | /* |
| 467 | * FID: 0xC4000171 |
| 468 | */ |
| 469 | #define SMC_RMI_GRANULE_DEV_UNDELEGATE SMC64_RMI_FID(U(0x21)) |
| 470 | |
| 471 | /* |
| 472 | * FID: 0xC4000172 |
| 473 | */ |
| 474 | #define SMC_RMI_DEV_MAP SMC64_RMI_FID(U(0x22)) |
| 475 | |
| 476 | /* |
| 477 | * FID: 0xC4000173 |
| 478 | */ |
| 479 | #define SMC_RMI_DEV_UNMAP SMC64_RMI_FID(U(0x23)) |
| 480 | |
| 481 | /* |
| 482 | * FID: 0xC4000174 |
| 483 | */ |
| 484 | #define SMC_RMI_PDEV_ABORT SMC64_RMI_FID(U(0x24)) |
| 485 | |
| 486 | /* |
| 487 | * FID: 0xC4000175 |
| 488 | */ |
| 489 | #define SMC_RMI_PDEV_COMMUNICATE SMC64_RMI_FID(U(0x25)) |
| 490 | |
| 491 | /* |
| 492 | * FID: 0xC4000176 |
| 493 | */ |
| 494 | #define SMC_RMI_PDEV_CREATE SMC64_RMI_FID(U(0x26)) |
| 495 | |
| 496 | /* |
| 497 | * FID: 0xC4000177 |
| 498 | */ |
| 499 | #define SMC_RMI_PDEV_DESTROY SMC64_RMI_FID(U(0x27)) |
| 500 | |
| 501 | /* |
| 502 | * FID: 0xC4000178 |
| 503 | */ |
| 504 | #define SMC_RMI_PDEV_GET_STATE SMC64_RMI_FID(U(0x28)) |
| 505 | |
| 506 | /* |
| 507 | * FID: 0xC4000179 |
| 508 | */ |
| 509 | #define SMC_RMI_PDEV_IDE_RESET SMC64_RMI_FID(U(0x29)) |
| 510 | |
| 511 | /* |
| 512 | * FID: 0xC400017A |
| 513 | */ |
| 514 | #define SMC_RMI_PDEV_NOTIFY SMC64_RMI_FID(U(0x2A)) |
| 515 | |
| 516 | /* |
| 517 | * FID: 0xC400017B |
| 518 | */ |
| 519 | #define SMC_RMI_PDEV_SET_PUBKEY SMC64_RMI_FID(U(0x2B)) |
| 520 | |
| 521 | /* |
| 522 | * FID: 0xC400017C |
| 523 | */ |
| 524 | #define SMC_RMI_PDEV_STOP SMC64_RMI_FID(U(0x2C)) |
| 525 | |
| 526 | /* |
| 527 | * FID: 0xC400017D |
| 528 | */ |
| 529 | #define SMC_RMI_RTT_AUX_CREATE SMC64_RMI_FID(U(0x2D)) |
| 530 | |
| 531 | /* |
| 532 | * FID: 0xC400017E |
| 533 | */ |
| 534 | #define SMC_RMI_RTT_AUX_DESTROY SMC64_RMI_FID(U(0x2E)) |
| 535 | |
| 536 | /* |
| 537 | * FID: 0xC400017F |
| 538 | */ |
| 539 | #define SMC_RMI_RTT_AUX_FOLD SMC64_RMI_FID(U(0x2F)) |
| 540 | |
| 541 | /* |
| 542 | * FID: 0xC4000180 |
| 543 | */ |
| 544 | #define SMC_RMI_RTT_AUX_MAP_PROTECTED SMC64_RMI_FID(U(0x30)) |
| 545 | |
| 546 | /* |
| 547 | * FID: 0xC4000181 |
| 548 | */ |
| 549 | #define SMC_RMI_RTT_AUX_MAP_UNPROTECTED SMC64_RMI_FID(U(0x31)) |
| 550 | |
| 551 | /* |
| 552 | * FID: 0xC4000183 |
| 553 | */ |
| 554 | #define SMC_RMI_RTT_AUX_UNMAP_PROTECTED SMC64_RMI_FID(U(0x33)) |
| 555 | |
| 556 | /* |
| 557 | * FID: 0xC4000184 |
| 558 | */ |
| 559 | #define SMC_RMI_RTT_AUX_UNMAP_UNPROTECTED SMC64_RMI_FID(U(0x34)) |
| 560 | |
| 561 | /* |
| 562 | * FID: 0xC4000185 |
| 563 | */ |
| 564 | #define SMC_RMI_VDEV_ABORT SMC64_RMI_FID(U(0x35)) |
| 565 | |
| 566 | /* |
| 567 | * FID: 0xC4000186 |
| 568 | */ |
| 569 | #define SMC_RMI_VDEV_COMMUNICATE SMC64_RMI_FID(U(0x36)) |
| 570 | |
| 571 | /* |
| 572 | * FID: 0xC4000187 |
| 573 | */ |
| 574 | #define SMC_RMI_VDEV_CREATE SMC64_RMI_FID(U(0x37)) |
| 575 | |
| 576 | /* |
| 577 | * FID: 0xC4000188 |
| 578 | */ |
| 579 | #define SMC_RMI_VDEV_DESTROY SMC64_RMI_FID(U(0x38)) |
| 580 | |
| 581 | /* |
| 582 | * FID: 0xC4000189 |
| 583 | */ |
| 584 | #define SMC_RMI_VDEV_GET_STATE SMC64_RMI_FID(U(0x39)) |
| 585 | |
| 586 | /* |
| 587 | * FID: 0xC400018A |
| 588 | */ |
| 589 | #define SMC_RMI_VDEV_STOP SMC64_RMI_FID(U(0x3A)) |
| 590 | |
| 591 | /* |
| 592 | * FID: 0xC400018B |
| 593 | */ |
| 594 | #define SMC_RMI_RTT_SET_S2AP SMC64_RMI_FID(U(0x3B)) |
| 595 | |
| 596 | /* |
| 597 | * FID: 0xC400018C |
| 598 | */ |
| 599 | #define SMC_RMI_MEC_SET_SHARED SMC64_RMI_FID(U(0x3C)) |
| 600 | |
| 601 | /* |
| 602 | * FID: 0xC400018D |
| 603 | */ |
| 604 | #define SMC_RMI_MEC_SET_PRIVATE SMC64_RMI_FID(U(0x3D)) |
| 605 | |
| 606 | /* |
| 607 | * FID: 0xC400018E |
| 608 | */ |
| 609 | #define SMC_RMI_VDEV_COMPLETE SMC64_RMI_FID(U(0x3E)) |
| 610 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 611 | /* Size of Realm Personalization Value */ |
Mate Toth-Pal | c751c0d | 2023-11-14 16:56:41 +0100 | [diff] [blame] | 612 | #ifndef CBMC |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 613 | #define RPV_SIZE 64 |
Mate Toth-Pal | c751c0d | 2023-11-14 16:56:41 +0100 | [diff] [blame] | 614 | #else |
| 615 | /* |
| 616 | * Small RPV size so that `struct rd` fits in the reduced sized granule defined |
| 617 | * for CBMC |
| 618 | */ |
| 619 | #define RPV_SIZE 1 |
| 620 | #endif |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 621 | |
AlexeiFedorov | 1800292 | 2023-04-06 10:19:51 +0100 | [diff] [blame] | 622 | /* RmiRealmFlags format */ |
| 623 | #define RMI_REALM_FLAGS_LPA2_SHIFT UL(0) |
| 624 | #define RMI_REALM_FLAGS_LPA2_WIDTH UL(1) |
| 625 | |
| 626 | #define RMI_REALM_FLAGS_SVE_SHIFT UL(1) |
| 627 | #define RMI_REALM_FLAGS_SVE_WIDTH UL(1) |
| 628 | |
| 629 | #define RMI_REALM_FLAGS_PMU_SHIFT UL(2) |
| 630 | #define RMI_REALM_FLAGS_PMU_WIDTH UL(1) |
| 631 | |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 632 | #ifndef __ASSEMBLER__ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 633 | /* |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 634 | * Defines member of structure and reserves space |
| 635 | * for the next member with specified offset. |
| 636 | */ |
| 637 | #define SET_MEMBER_RMI SET_MEMBER |
| 638 | |
| 639 | /* |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 640 | * The Realm attribute parameters are shared by the Host via |
| 641 | * RMI_REALM_CREATE::params_ptr. The values can be observed or modified |
| 642 | * either by the Host or by the Realm. |
| 643 | */ |
| 644 | struct rmi_realm_params { |
AlexeiFedorov | 1800292 | 2023-04-06 10:19:51 +0100 | [diff] [blame] | 645 | /* Flags */ |
| 646 | SET_MEMBER_RMI(unsigned long flags, 0, 0x8); /* Offset 0 */ |
| 647 | /* Requested IPA width */ |
| 648 | SET_MEMBER_RMI(unsigned int s2sz, 0x8, 0x10); /* 0x8 */ |
| 649 | /* Requested SVE vector length */ |
| 650 | SET_MEMBER_RMI(unsigned int sve_vl, 0x10, 0x18); /* 0x10 */ |
| 651 | /* Requested number of breakpoints */ |
| 652 | SET_MEMBER_RMI(unsigned int num_bps, 0x18, 0x20); /* 0x18 */ |
| 653 | /* Requested number of watchpoints */ |
| 654 | SET_MEMBER_RMI(unsigned int num_wps, 0x20, 0x28); /* 0x20 */ |
| 655 | /* Requested number of PMU counters */ |
| 656 | SET_MEMBER_RMI(unsigned int pmu_num_ctrs, 0x28, 0x30); /* 0x28 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 657 | /* Measurement algorithm */ |
AlexeiFedorov | 56e1a8e | 2023-09-01 17:06:13 +0100 | [diff] [blame] | 658 | SET_MEMBER_RMI(unsigned char algorithm, 0x30, 0x400); /* 0x30 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 659 | /* Realm Personalization Value */ |
AlexeiFedorov | 1800292 | 2023-04-06 10:19:51 +0100 | [diff] [blame] | 660 | SET_MEMBER_RMI(unsigned char rpv[RPV_SIZE], 0x400, 0x800); /* 0x400 */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 661 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 662 | /* Virtual Machine Identifier */ |
| 663 | unsigned short vmid; /* 0x800 */ |
| 664 | /* Realm Translation Table base */ |
| 665 | unsigned long rtt_base; /* 0x808 */ |
| 666 | /* RTT starting level */ |
| 667 | long rtt_level_start; /* 0x810 */ |
| 668 | /* Number of starting level RTTs */ |
| 669 | unsigned int rtt_num_start; /* 0x818 */ |
| 670 | }, 0x800, 0x1000); |
| 671 | }; |
| 672 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 673 | /* |
| 674 | * The REC attribute parameters are shared by the Host via |
AlexeiFedorov | 7011513 | 2023-11-27 13:04:26 +0000 | [diff] [blame] | 675 | * RMI_REC_CREATE::params_ptr. The values can be observed or modified |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 676 | * either by the Host or by the Realm which owns the REC. |
| 677 | */ |
| 678 | struct rmi_rec_params { |
| 679 | /* Flags */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 680 | SET_MEMBER_RMI(unsigned long flags, 0, 0x100); /* Offset 0 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 681 | /* MPIDR of the REC */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 682 | SET_MEMBER_RMI(unsigned long mpidr, 0x100, 0x200); /* 0x100 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 683 | /* Program counter */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 684 | SET_MEMBER_RMI(unsigned long pc, 0x200, 0x300); /* 0x200 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 685 | /* General-purpose registers */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 686 | SET_MEMBER_RMI(unsigned long gprs[REC_CREATE_NR_GPRS], 0x300, 0x800); /* 0x300 */ |
| 687 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 688 | /* Number of auxiliary Granules */ |
| 689 | unsigned long num_aux; /* 0x800 */ |
| 690 | /* Addresses of auxiliary Granules */ |
| 691 | unsigned long aux[MAX_REC_AUX_GRANULES];/* 0x808 */ |
| 692 | }, 0x800, 0x1000); |
| 693 | }; |
| 694 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 695 | /* |
| 696 | * Structure contains data passed from the Host to the RMM on REC entry |
| 697 | */ |
AlexeiFedorov | 52912a6 | 2023-07-24 12:28:47 +0100 | [diff] [blame] | 698 | struct rmi_rec_enter { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 699 | /* Flags */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 700 | SET_MEMBER_RMI(unsigned long flags, 0, 0x200); /* Offset 0 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 701 | /* General-purpose registers */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 702 | SET_MEMBER_RMI(unsigned long gprs[REC_EXIT_NR_GPRS], 0x200, 0x300); /* 0x200 */ |
| 703 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 704 | /* GICv3 Hypervisor Control Register */ |
| 705 | unsigned long gicv3_hcr; /* 0x300 */ |
| 706 | /* GICv3 List Registers */ |
| 707 | unsigned long gicv3_lrs[REC_GIC_NUM_LRS]; /* 0x308 */ |
| 708 | }, 0x300, 0x800); |
| 709 | }; |
| 710 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 711 | /* |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 712 | * RmiVdevAction |
| 713 | * Represents realm action which triggered REC exit due to device communication. |
| 714 | * Width: 8 bits |
| 715 | */ |
| 716 | #define RMI_VDEV_ACTION_GET_INTERFACE_REPORT U(0) |
| 717 | #define RMI_VDEV_ACTION_GET_MEASUREMENTS U(1) |
| 718 | #define RMI_VDEV_ACTION_LOCK U(2) |
| 719 | #define RMI_VDEV_ACTION_START U(3) |
| 720 | #define RMI_VDEV_ACTION_STOP U(4) |
| 721 | |
| 722 | /* |
| 723 | * RmiRecExitFlags |
| 724 | * Fieldset contains flags provided by the RMM during REC exit. |
| 725 | * Width: 64 bits |
| 726 | */ |
| 727 | #define RMI_REC_EXIT_FLAGS_RIPAS_DEV_SHARED_SHIFT U(0) |
| 728 | #define RMI_REC_EXIT_FLAGS_RIPAS_DEV_SHARED_WIDTH U(1) |
| 729 | |
| 730 | /* |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 731 | * Structure contains data passed from the RMM to the Host on REC exit |
| 732 | */ |
| 733 | struct rmi_rec_exit { |
| 734 | /* Exit reason */ |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 735 | SET_MEMBER_RMI(unsigned long exit_reason, 0, 0x8);/* Offset 0 */ |
| 736 | /* RmiRecExitFlags: Flags */ |
| 737 | SET_MEMBER_RMI(unsigned long flags, 0x8, 0x100);/* 0x8 */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 738 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 739 | /* Exception Syndrome Register */ |
| 740 | unsigned long esr; /* 0x100 */ |
| 741 | /* Fault Address Register */ |
| 742 | unsigned long far; /* 0x108 */ |
| 743 | /* Hypervisor IPA Fault Address register */ |
| 744 | unsigned long hpfar; /* 0x110 */ |
| 745 | }, 0x100, 0x200); |
| 746 | /* General-purpose registers */ |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 747 | SET_MEMBER_RMI(unsigned long gprs[REC_EXIT_NR_GPRS], 0x200, 0x300); /* 0x200 */ |
| 748 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 749 | /* GICv3 Hypervisor Control Register */ |
| 750 | unsigned long gicv3_hcr; /* 0x300 */ |
| 751 | /* GICv3 List Registers */ |
| 752 | unsigned long gicv3_lrs[REC_GIC_NUM_LRS]; /* 0x308 */ |
| 753 | /* GICv3 Maintenance Interrupt State Register */ |
| 754 | unsigned long gicv3_misr; /* 0x388 */ |
| 755 | /* GICv3 Virtual Machine Control Register */ |
| 756 | unsigned long gicv3_vmcr; /* 0x390 */ |
| 757 | }, 0x300, 0x400); |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 758 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 759 | /* Counter-timer Physical Timer Control Register */ |
| 760 | unsigned long cntp_ctl; /* 0x400 */ |
| 761 | /* Counter-timer Physical Timer CompareValue Register */ |
| 762 | unsigned long cntp_cval; /* 0x408 */ |
| 763 | /* Counter-timer Virtual Timer Control Register */ |
| 764 | unsigned long cntv_ctl; /* 0x410 */ |
| 765 | /* Counter-timer Virtual Timer CompareValue Register */ |
| 766 | unsigned long cntv_cval; /* 0x418 */ |
| 767 | }, 0x400, 0x500); |
Soby Mathew | c414f2a | 2023-01-17 02:50:17 +0000 | [diff] [blame] | 768 | SET_MEMBER_RMI(struct { |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 769 | /* Base address of pending RIPAS change */ |
| 770 | unsigned long ripas_base; /* 0x500 */ |
| 771 | /* Size of pending RIPAS change */ |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame] | 772 | unsigned long ripas_top; /* 0x508 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 773 | /* RIPAS value of pending RIPAS change */ |
| 774 | unsigned char ripas_value; /* 0x510 */ |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 775 | /* |
| 776 | * Base PA of device memory region, if RIPAS change is |
| 777 | * pending due to execution of |
| 778 | * RSI_RDEV_VALIDATE_MAPPING |
| 779 | */ |
| 780 | unsigned long ripas_dev_pa; /* 0x518 */ |
| 781 | /* Base addr of target region for pending S2AP change */ |
| 782 | unsigned long s2ap_base; /* 0x520 */ |
| 783 | /* Top addr of target region for pending S2AP change */ |
| 784 | unsigned long s2ap_top; /* 0x528 */ |
| 785 | /* Virtual device ID */ |
| 786 | unsigned long vdev_id; /* 0x530 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 787 | }, 0x500, 0x600); |
| 788 | /* Host call immediate value */ |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 789 | SET_MEMBER_RMI(unsigned int imm, 0x600, 0x608); /* 0x600 */ |
| 790 | /* UInt64: Plane Index */ |
| 791 | SET_MEMBER_RMI(unsigned long plane, 0x608, 0x610); /* 0x608 */ |
| 792 | /* Address: VDEV which triggered REC exit due to device communication */ |
| 793 | SET_MEMBER_RMI(unsigned long vdev, 0x610, 0x618); /* 0x610 */ |
| 794 | /* RmiVdevAction: Action which triggered REC exit due to device comm */ |
| 795 | SET_MEMBER_RMI(unsigned char vdev_action, 0x618, 0x700); /* 0x618 */ |
AlexeiFedorov | 4d4e734 | 2023-06-12 12:10:06 +0100 | [diff] [blame] | 796 | /* PMU overflow status */ |
| 797 | SET_MEMBER_RMI(unsigned long pmu_ovf_status, 0x700, 0x800); /* 0x700 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 798 | }; |
| 799 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 800 | /* |
| 801 | * Structure contains shared information between RMM and Host |
| 802 | * during REC entry and REC exit. |
| 803 | */ |
| 804 | struct rmi_rec_run { |
| 805 | /* Entry information */ |
AlexeiFedorov | 52912a6 | 2023-07-24 12:28:47 +0100 | [diff] [blame] | 806 | SET_MEMBER_RMI(struct rmi_rec_enter enter, 0, 0x800); /* Offset 0 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 807 | /* Exit information */ |
AlexeiFedorov | eaec0c4 | 2023-02-01 18:13:32 +0000 | [diff] [blame] | 808 | SET_MEMBER_RMI(struct rmi_rec_exit exit, 0x800, 0x1000);/* 0x800 */ |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 809 | }; |
| 810 | |
Arunachalam Ganapathy | f36187e | 2024-05-07 11:49:33 +0100 | [diff] [blame^] | 811 | /* |
| 812 | * RmiPdevProtConfig |
| 813 | * Represents the protection between system and device. |
| 814 | * Width: 2 bits |
| 815 | */ |
| 816 | #define RMI_PDEV_IOCOH_E2E_IDE U(0) |
| 817 | #define RMI_PDEV_IOCOH_E2E_SYS U(1) |
| 818 | #define RMI_PDEV_FCOH_E2E_IDE U(2) |
| 819 | #define RMI_PDEV_FCOH_E2E_SYS U(3) |
| 820 | |
| 821 | /* |
| 822 | * RmiPdevFlags |
| 823 | * Fieldset contains flags provided by the Host during PDEV creation |
| 824 | * Width: 64 bits |
| 825 | */ |
| 826 | /* RmiPdevProtConfig Bits 1:0 */ |
| 827 | #define RMI_PDEV_FLAGS_PROT_CONFIG_SHIFT UL(0) |
| 828 | #define RMI_PDEV_FLAGS_PROT_CONFIG_WIDTH UL(2) |
| 829 | |
| 830 | /* |
| 831 | * RmiPdevEvent |
| 832 | * Represents physical device event. |
| 833 | * Width: 8 bits |
| 834 | */ |
| 835 | #define RMI_PDEV_EVENT_IDE_KEY_REFRESH U(0) |
| 836 | |
| 837 | /* |
| 838 | * RmiPdevState |
| 839 | * Represents the state of a PDEV |
| 840 | * Width: 8 bits |
| 841 | */ |
| 842 | #define RMI_PDEV_STATE_NEW U(0) |
| 843 | #define RMI_PDEV_STATE_NEEDS_KEY U(1) |
| 844 | #define RMI_PDEV_STATE_HAS_KEY U(2) |
| 845 | #define RMI_PDEV_STATE_READY U(3) |
| 846 | #define RMI_PDEV_STATE_COMMUNICATING U(4) |
| 847 | #define RMI_PDEV_STATE_STOPPING U(5) |
| 848 | #define RMI_PDEV_STATE_STOPPED U(6) |
| 849 | #define RMI_PDEV_STATE_ERROR U(7) |
| 850 | |
| 851 | /* |
| 852 | * RmiSignatureAlgorithm |
| 853 | * Represents signature algorithm used in PDEV set key RMI call. |
| 854 | * Width: 8 bits |
| 855 | */ |
| 856 | #define RMI_SIGNATURE_ALGORITHM_RSASSA_3072 U(0) |
| 857 | #define RMI_SIGNATURE_ALGORITHM_ECDSA_P256 U(1) |
| 858 | #define RMI_SIGNATURE_ALGORITHM_ECDSA_P384 U(2) |
| 859 | |
| 860 | /* |
| 861 | * RmiDevMemShared |
| 862 | * Represents whether device memory Granule should be shared |
| 863 | * Width: 1 bit |
| 864 | */ |
| 865 | #define RMI_DEV_MEM_PRIVATE U(0) |
| 866 | #define RMI_DEV_MEM_SHARED U(1) |
| 867 | |
| 868 | /* |
| 869 | * RmiDevDelegateFlags |
| 870 | * Fieldset contains flags provided by the Host during device memory granule |
| 871 | * delegation. |
| 872 | * Width: 64 bits |
| 873 | */ |
| 874 | /* RmiDevMemShared: Bit 0 */ |
| 875 | #define RMI_DEV_DELEGATE_FLAGS_SHARE_SHIFT U(0) |
| 876 | #define RMI_DEV_DELEGATE_FLAGS_SHARE_WIDTH U(1) |
| 877 | |
| 878 | /* |
| 879 | * RmiDevCommEnterStatus (Name in Spec RmiDevCommStatus) |
| 880 | * Represents status passed from the Host to the RMM during device communication. |
| 881 | * Width: 8 bits |
| 882 | */ |
| 883 | #define RMI_DEV_COMM_ENTER_STATUS_SUCCESS U(0) |
| 884 | #define RMI_DEV_COMM_ENTER_STATUS_ERROR U(1) |
| 885 | #define RMI_DEV_COMM_ENTER_STATUS_NONE U(2) |
| 886 | |
| 887 | /* |
| 888 | * RmiDevCommEnter |
| 889 | * This structure contains data passed from the Host to the RMM during device |
| 890 | * communication. |
| 891 | * Width: 256 (0x100) bytes |
| 892 | */ |
| 893 | struct rmi_dev_comm_enter { |
| 894 | /* RmiDevCommEnterStatus: Status of device transaction */ |
| 895 | SET_MEMBER_RMI(unsigned char status, 0, 0x8); |
| 896 | /* Address: Address of request buffer */ |
| 897 | SET_MEMBER_RMI(unsigned long req_addr, 0x8, 0x10); |
| 898 | /* Address: Address of response buffer */ |
| 899 | SET_MEMBER_RMI(unsigned long resp_addr, 0x10, 0x18); |
| 900 | /* UInt64: Amount of valid data in response buffer in bytes */ |
| 901 | SET_MEMBER_RMI(unsigned long resp_len, 0x18, 0x100); |
| 902 | }; |
| 903 | |
| 904 | /* |
| 905 | * RmiDevCommExitFlags |
| 906 | * Fieldset contains flags provided by the RMM during a device transaction. |
| 907 | * Width: 64 bits |
| 908 | */ |
| 909 | #define RMI_DEV_COMM_EXIT_FLAGS_CACHE_SHIFT UL(0) |
| 910 | #define RMI_DEV_COMM_EXIT_FLAGS_CACHE_WIDTH UL(1) |
| 911 | #define RMI_DEV_COMM_EXIT_FLAGS_SEND_SHIFT UL(1) |
| 912 | #define RMI_DEV_COMM_EXIT_FLAGS_SEND_WIDTH UL(1) |
| 913 | #define RMI_DEV_COMM_EXIT_FLAGS_WAIT_SHIFT UL(2) |
| 914 | #define RMI_DEV_COMM_EXIT_FLAGS_WAIT_WIDTH UL(1) |
| 915 | #define RMI_DEV_COMM_EXIT_FLAGS_MULTI_SHIFT UL(3) |
| 916 | #define RMI_DEV_COMM_EXIT_FLAGS_MULTI_WIDTH UL(1) |
| 917 | |
| 918 | /* |
| 919 | * RmiDevCommProtocol |
| 920 | * Represents the protocol used for device communication. |
| 921 | * Width: 8 bits |
| 922 | */ |
| 923 | #define RMI_DEV_COMM_PROTOCOL_SPDM U(0) |
| 924 | #define RMI_DEV_COMM_PROTOCOL_SECURE_SPDM U(1) |
| 925 | |
| 926 | /* |
| 927 | * RmiDevCommExit |
| 928 | * This structure contains data passed from the RMM to the Host during device |
| 929 | * communication. |
| 930 | * Width: 256 (0x100) bytes. |
| 931 | */ |
| 932 | struct rmi_dev_comm_exit { |
| 933 | /* |
| 934 | * RmiDevCommExitFlags: Flags indicating the actions the host is |
| 935 | * requested to perform |
| 936 | */ |
| 937 | SET_MEMBER_RMI(unsigned long flags, 0, 0x8); |
| 938 | /* |
| 939 | * UInt64: If flags.cache is true, offset in the device response buffer |
| 940 | * to the start of data to be cached in bytes. |
| 941 | */ |
| 942 | SET_MEMBER_RMI(unsigned long cache_offset, 0x8, 0x10); |
| 943 | /* |
| 944 | * UInt64: If flags.cache is true, amount of data to be cached in |
| 945 | * bytes. |
| 946 | */ |
| 947 | SET_MEMBER_RMI(unsigned long cache_len, 0x10, 0x18); |
| 948 | /* RmiDevCommProtocol: If flags.send is true, type of request */ |
| 949 | SET_MEMBER_RMI(unsigned char protocol, 0x18, 0x20); |
| 950 | /* |
| 951 | * UInt64: If flags.send is true, amount of valid data in request buffer |
| 952 | * in bytes |
| 953 | */ |
| 954 | SET_MEMBER_RMI(unsigned long req_len, 0x20, 0x28); |
| 955 | /* |
| 956 | * UInt64: If flags.wait is true, amount of time to wait for device |
| 957 | * response in milliseconds |
| 958 | */ |
| 959 | SET_MEMBER_RMI(unsigned long timeout, 0x28, 0x100); |
| 960 | }; |
| 961 | |
| 962 | /* |
| 963 | * RmiDevCommData |
| 964 | * This structure contains data structure shared between Host and RMM for |
| 965 | * device communication. |
| 966 | * Width: 4096 (0x1000) bytes. |
| 967 | */ |
| 968 | #define RMI_DEV_COMM_ENTER_OFFSET 0x0 |
| 969 | #define RMI_DEV_COMM_EXIT_OFFSET 0x800 |
| 970 | #define RMI_DEV_COMM_DATA_SIZE 0x1000 |
| 971 | struct rmi_dev_comm_data { |
| 972 | /* RmiDevCommEnter: Entry information */ |
| 973 | SET_MEMBER_RMI(struct rmi_dev_comm_enter enter, |
| 974 | RMI_DEV_COMM_ENTER_OFFSET, RMI_DEV_COMM_EXIT_OFFSET); |
| 975 | /* RmiDevCommExit: Exit information */ |
| 976 | SET_MEMBER_RMI(struct rmi_dev_comm_exit exit, |
| 977 | RMI_DEV_COMM_EXIT_OFFSET, RMI_DEV_COMM_DATA_SIZE); |
| 978 | }; |
| 979 | |
| 980 | /* |
| 981 | * RmiAddressRange |
| 982 | * This structure contains base and top value of an address range. |
| 983 | * Width: 16 (0x10) bytes. |
| 984 | */ |
| 985 | struct rmi_address_range { |
| 986 | /* Address: Base of the address range (inclusive) */ |
| 987 | SET_MEMBER_RMI(unsigned long base, 0, 0x8); |
| 988 | /* Address: Top of the address range (exclusive) */ |
| 989 | SET_MEMBER_RMI(unsigned long top, 0x8, 0x10); |
| 990 | }; |
| 991 | |
| 992 | /* |
| 993 | * Maximum number of aux granules paramenter passed in rmi_pdev_params during |
| 994 | * PDEV createto PDEV create |
| 995 | */ |
| 996 | #define PDEV_PARAM_AUX_GRANULES_MAX U(32) |
| 997 | |
| 998 | /* |
| 999 | * Maximum number of IO coherent RmiAddressRange parameter passed in |
| 1000 | * rmi_pdev_params during PDEV create |
| 1001 | */ |
| 1002 | #define PDEV_PARAM_IOCOH_ADDR_RANGE_MAX U(16) |
| 1003 | |
| 1004 | /* |
| 1005 | * Maximum number of fully coherent RmiAddressRange parameter passed in |
| 1006 | * rmi_pdev_params during PDEV create |
| 1007 | */ |
| 1008 | #define PDEV_PARAM_FCOH_ADDR_RANGE_MAX U(4) |
| 1009 | |
| 1010 | /* |
| 1011 | * RmiPdevParams |
| 1012 | * This structure contains parameters provided by Host during PDEV creation. |
| 1013 | * Width: 4096 (0x1000) bytes. |
| 1014 | */ |
| 1015 | struct rmi_pdev_params { |
| 1016 | /* RmiPdevFlags: Flags */ |
| 1017 | SET_MEMBER_RMI(unsigned long flags, 0, 0x8); |
| 1018 | /* Bits64: Physical device identifier */ |
| 1019 | SET_MEMBER_RMI(unsigned long pdev_id, 0x8, 0x10); |
| 1020 | /* Bits16: Segment ID */ |
| 1021 | SET_MEMBER_RMI(unsigned short segment_id, 0x10, 0x18); |
| 1022 | /* Bits16: Root Port identifier */ |
| 1023 | SET_MEMBER_RMI(unsigned short root_id, 0x18, 0x20); |
| 1024 | /* UInt64: Certificate identifier */ |
| 1025 | SET_MEMBER_RMI(unsigned long cert_id, 0x20, 0x28); |
| 1026 | /* UInt64: Base requester ID range (inclusive) */ |
| 1027 | SET_MEMBER_RMI(unsigned long rid_base, 0x28, 0x30); |
| 1028 | /* UInt64: Top of requester ID range (exclusive) */ |
| 1029 | SET_MEMBER_RMI(unsigned long rid_top, 0x30, 0x38); |
| 1030 | /* RmiHashAlgorithm: Algorithm used to generate device digests */ |
| 1031 | SET_MEMBER_RMI(unsigned char hash_algo, 0x38, 0x40); |
| 1032 | /* UInt64: Number of auxiliary granules */ |
| 1033 | SET_MEMBER_RMI(unsigned long num_aux, 0x40, 0x48); |
| 1034 | /* UInt64: IDE stream identifier */ |
| 1035 | SET_MEMBER_RMI(unsigned long ide_sid, 0x48, 0x50); |
| 1036 | /* UInt64: Number of IO-coherent address ranges */ |
| 1037 | SET_MEMBER_RMI(unsigned long iocoh_num_addr_range, 0x50, 0x58); |
| 1038 | /* UInt64: Number of fully-coherent address ranges */ |
| 1039 | SET_MEMBER_RMI(unsigned long fcoh_num_addr_range, 0x58, 0x100); |
| 1040 | |
| 1041 | /* Address: Addresses of auxiliary granules */ |
| 1042 | SET_MEMBER_RMI(unsigned long aux[PDEV_PARAM_AUX_GRANULES_MAX], 0x100, |
| 1043 | 0x200); |
| 1044 | /* RmiAddressRange: IO-coherent address range */ |
| 1045 | SET_MEMBER_RMI(struct rmi_address_range |
| 1046 | iocoh_addr_range[PDEV_PARAM_IOCOH_ADDR_RANGE_MAX], |
| 1047 | 0x200, 0x300); |
| 1048 | /* RmiAddressRange: Fully coherent address range */ |
| 1049 | SET_MEMBER_RMI(struct rmi_address_range |
| 1050 | fcoh_addr_range[PDEV_PARAM_FCOH_ADDR_RANGE_MAX], |
| 1051 | 0x300, 0x1000); |
| 1052 | }; |
| 1053 | |
| 1054 | /* |
| 1055 | * RmiVdevFlags |
| 1056 | * Fieldset contains flags provided by the Host during VDEV creation. |
| 1057 | * Width: 64 bits |
| 1058 | */ |
| 1059 | #define RMI_VDEV_FLAGS_RES0_SHIFT UL(0) |
| 1060 | #define RMI_VDEV_FLAGS_RES0_WIDTH UL(63) |
| 1061 | |
| 1062 | /* |
| 1063 | * RmiVdevState |
| 1064 | * Represents the state of the VDEV |
| 1065 | * Width: 8 bits |
| 1066 | */ |
| 1067 | #define RMI_VDEV_STATE_READY U(0) |
| 1068 | #define RMI_VDEV_STATE_COMMUNICATING U(1) |
| 1069 | #define RMI_VDEV_STATE_STOPPING U(2) |
| 1070 | #define RMI_VDEV_STATE_STOPPED U(3) |
| 1071 | #define RMI_VDEV_STATE_ERROR U(4) |
| 1072 | |
| 1073 | /* Maximum number of aux granules paramenter passed to VDEV create */ |
| 1074 | #define VDEV_PARAM_AUX_GRANULES_MAX U(32) |
| 1075 | |
| 1076 | /* |
| 1077 | * RmiVdevParams |
| 1078 | * The RmiVdevParams structure contains parameters provided by the Host during |
| 1079 | * VDEV creation. |
| 1080 | * Width: 4096 (0x1000) bytes. |
| 1081 | */ |
| 1082 | struct rmi_vdev_params { |
| 1083 | /* RmiVdevFlags: Flags */ |
| 1084 | SET_MEMBER_RMI(unsigned long flags, 0, 0x8); |
| 1085 | /* Bits64: Virtual device identifier */ |
| 1086 | SET_MEMBER_RMI(unsigned long vdev_id, 0x8, 0x10); |
| 1087 | /* Bits64: TDI identifier */ |
| 1088 | SET_MEMBER_RMI(unsigned long tdi_id, 0x10, 0x18); |
| 1089 | /* UInt64: Number of auxiliary granules */ |
| 1090 | SET_MEMBER_RMI(unsigned long num_aux, 0x18, 0x100); |
| 1091 | |
| 1092 | /* Address: Addresses of auxiliary granules */ |
| 1093 | SET_MEMBER_RMI(unsigned long aux[VDEV_PARAM_AUX_GRANULES_MAX], 0x100, |
| 1094 | 0x1000); |
| 1095 | }; |
Soby Mathew | c9b6ecd | 2023-01-17 03:40:44 +0000 | [diff] [blame] | 1096 | #endif /* __ASSEMBLER__ */ |
| 1097 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 1098 | #endif /* SMC_RMI_H */ |