Thomas Gleixner | 9952f69 | 2019-05-28 10:10:04 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2 | /* |
Vidya Sagar | ee22d0c | 2020-03-03 23:40:48 +0530 | [diff] [blame] | 3 | * Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved. |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef _ABI_BPMP_ABI_H_ |
| 7 | #define _ABI_BPMP_ABI_H_ |
| 8 | |
| 9 | #ifdef LK |
| 10 | #include <stdint.h> |
| 11 | #endif |
| 12 | |
| 13 | #ifndef __ABI_PACKED |
| 14 | #define __ABI_PACKED __attribute__((packed)) |
| 15 | #endif |
| 16 | |
| 17 | #ifdef NO_GCC_EXTENSIONS |
| 18 | #define EMPTY char empty; |
| 19 | #define EMPTY_ARRAY 1 |
| 20 | #else |
| 21 | #define EMPTY |
| 22 | #define EMPTY_ARRAY 0 |
| 23 | #endif |
| 24 | |
| 25 | #ifndef __UNION_ANON |
| 26 | #define __UNION_ANON |
| 27 | #endif |
| 28 | /** |
| 29 | * @file |
| 30 | */ |
| 31 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 32 | /** |
| 33 | * @defgroup MRQ MRQ Messages |
| 34 | * @brief Messages sent to/from BPMP via IPC |
| 35 | * @{ |
| 36 | * @defgroup MRQ_Format Message Format |
| 37 | * @defgroup MRQ_Codes Message Request (MRQ) Codes |
| 38 | * @defgroup MRQ_Payloads Message Payloads |
| 39 | * @defgroup Error_Codes Error Codes |
| 40 | * @} |
| 41 | */ |
| 42 | |
| 43 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 44 | * @addtogroup MRQ_Format |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 45 | * @{ |
| 46 | * The CPU requests the BPMP to perform a particular service by |
| 47 | * sending it an IVC frame containing a single MRQ message. An MRQ |
| 48 | * message consists of a @ref mrq_request followed by a payload whose |
| 49 | * format depends on mrq_request::mrq. |
| 50 | * |
| 51 | * The BPMP processes the data and replies with an IVC frame (on the |
| 52 | * same IVC channel) containing and MRQ response. An MRQ response |
| 53 | * consists of a @ref mrq_response followed by a payload whose format |
| 54 | * depends on the associated mrq_request::mrq. |
| 55 | * |
| 56 | * A well-defined subset of the MRQ messages that the CPU sends to the |
| 57 | * BPMP can lead to BPMP eventually sending an MRQ message to the |
| 58 | * CPU. For example, when the CPU uses an #MRQ_THERMAL message to set |
| 59 | * a thermal trip point, the BPMP may eventually send a single |
| 60 | * #MRQ_THERMAL message of its own to the CPU indicating that the trip |
| 61 | * point has been crossed. |
| 62 | * @} |
| 63 | */ |
| 64 | |
| 65 | /** |
| 66 | * @ingroup MRQ_Format |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 67 | * @brief Header for an MRQ message |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 68 | * |
| 69 | * Provides the MRQ number for the MRQ message: #mrq. The remainder of |
| 70 | * the MRQ message is a payload (immediately following the |
| 71 | * mrq_request) whose format depends on mrq. |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 72 | */ |
| 73 | struct mrq_request { |
| 74 | /** @brief MRQ number of the request */ |
| 75 | uint32_t mrq; |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 76 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 77 | * @brief Flags providing follow up directions to the receiver |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 78 | * |
| 79 | * | Bit | Description | |
| 80 | * |-----|--------------------------------------------| |
| 81 | * | 1 | ring the sender's doorbell when responding | |
| 82 | * | 0 | should be 1 | |
| 83 | */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 84 | uint32_t flags; |
| 85 | } __ABI_PACKED; |
| 86 | |
| 87 | /** |
| 88 | * @ingroup MRQ_Format |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 89 | * @brief Header for an MRQ response |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 90 | * |
| 91 | * Provides an error code for the associated MRQ message. The |
| 92 | * remainder of the MRQ response is a payload (immediately following |
| 93 | * the mrq_response) whose format depends on the associated |
| 94 | * mrq_request::mrq |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 95 | */ |
| 96 | struct mrq_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 97 | /** @brief Error code for the MRQ request itself */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 98 | int32_t err; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 99 | /** @brief Reserved for future use */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 100 | uint32_t flags; |
| 101 | } __ABI_PACKED; |
| 102 | |
| 103 | /** |
| 104 | * @ingroup MRQ_Format |
| 105 | * Minimum needed size for an IPC message buffer |
| 106 | */ |
| 107 | #define MSG_MIN_SZ 128 |
| 108 | /** |
| 109 | * @ingroup MRQ_Format |
| 110 | * Minimum size guaranteed for data in an IPC message buffer |
| 111 | */ |
| 112 | #define MSG_DATA_MIN_SZ 120 |
| 113 | |
| 114 | /** |
| 115 | * @ingroup MRQ_Codes |
| 116 | * @name Legal MRQ codes |
| 117 | * These are the legal values for mrq_request::mrq |
| 118 | * @{ |
| 119 | */ |
| 120 | |
| 121 | #define MRQ_PING 0 |
| 122 | #define MRQ_QUERY_TAG 1 |
| 123 | #define MRQ_MODULE_LOAD 4 |
| 124 | #define MRQ_MODULE_UNLOAD 5 |
| 125 | #define MRQ_TRACE_MODIFY 7 |
| 126 | #define MRQ_WRITE_TRACE 8 |
| 127 | #define MRQ_THREADED_PING 9 |
| 128 | #define MRQ_MODULE_MAIL 11 |
| 129 | #define MRQ_DEBUGFS 19 |
| 130 | #define MRQ_RESET 20 |
| 131 | #define MRQ_I2C 21 |
| 132 | #define MRQ_CLK 22 |
| 133 | #define MRQ_QUERY_ABI 23 |
| 134 | #define MRQ_PG_READ_STATE 25 |
| 135 | #define MRQ_PG_UPDATE_STATE 26 |
| 136 | #define MRQ_THERMAL 27 |
| 137 | #define MRQ_CPU_VHINT 28 |
| 138 | #define MRQ_ABI_RATCHET 29 |
| 139 | #define MRQ_EMC_DVFS_LATENCY 31 |
| 140 | #define MRQ_TRACE_ITER 64 |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 141 | #define MRQ_RINGBUF_CONSOLE 65 |
| 142 | #define MRQ_PG 66 |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 143 | #define MRQ_CPU_NDIV_LIMITS 67 |
| 144 | #define MRQ_STRAP 68 |
| 145 | #define MRQ_UPHY 69 |
| 146 | #define MRQ_CPU_AUTO_CC3 70 |
| 147 | #define MRQ_QUERY_FW_TAG 71 |
| 148 | #define MRQ_FMON 72 |
| 149 | #define MRQ_EC 73 |
| 150 | #define MRQ_FBVOLT_STATUS 74 |
Jon Hunter | 5e37b9c | 2020-07-12 11:01:17 +0100 | [diff] [blame^] | 151 | #define MRQ_DEBUG 75 |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 152 | |
| 153 | /** @} */ |
| 154 | |
| 155 | /** |
| 156 | * @ingroup MRQ_Codes |
| 157 | * @brief Maximum MRQ code to be sent by CPU software to |
| 158 | * BPMP. Subject to change in future |
| 159 | */ |
Jon Hunter | 5e37b9c | 2020-07-12 11:01:17 +0100 | [diff] [blame^] | 160 | #define MAX_CPU_MRQ_ID 75 |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 161 | |
| 162 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 163 | * @addtogroup MRQ_Payloads |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 164 | * @{ |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 165 | * @defgroup Ping Ping |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 166 | * @defgroup Query_Tag Query Tag |
| 167 | * @defgroup Module Loadable Modules |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 168 | * @defgroup Trace Trace |
| 169 | * @defgroup Debugfs Debug File System |
| 170 | * @defgroup Reset Reset |
| 171 | * @defgroup I2C I2C |
| 172 | * @defgroup Clocks Clocks |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 173 | * @defgroup ABI_info ABI Info |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 174 | * @defgroup Powergating Power Gating |
| 175 | * @defgroup Thermal Thermal |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 176 | * @defgroup Vhint CPU Voltage hint |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 177 | * @defgroup EMC EMC |
| 178 | * @defgroup CPU NDIV Limits |
| 179 | * @defgroup RingbufConsole Ring Buffer Console |
| 180 | * @defgroup Strap Straps |
| 181 | * @defgroup UPHY UPHY |
| 182 | * @defgroup CC3 Auto-CC3 |
| 183 | * @defgroup FMON FMON |
| 184 | * @defgroup EC EC |
| 185 | * @defgroup Fbvolt_status Fuse Burn Voltage Status |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 186 | * @} |
| 187 | */ |
| 188 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 189 | /** |
| 190 | * @ingroup MRQ_Codes |
| 191 | * @def MRQ_PING |
| 192 | * @brief A simple ping |
| 193 | * |
| 194 | * * Platforms: All |
| 195 | * * Initiators: Any |
| 196 | * * Targets: Any |
| 197 | * * Request Payload: @ref mrq_ping_request |
| 198 | * * Response Payload: @ref mrq_ping_response |
| 199 | * |
| 200 | * @ingroup MRQ_Codes |
| 201 | * @def MRQ_THREADED_PING |
| 202 | * @brief A deeper ping |
| 203 | * |
| 204 | * * Platforms: All |
| 205 | * * Initiators: Any |
| 206 | * * Targets: BPMP |
| 207 | * * Request Payload: @ref mrq_ping_request |
| 208 | * * Response Payload: @ref mrq_ping_response |
| 209 | * |
| 210 | * Behavior is equivalent to a simple #MRQ_PING except that BPMP |
| 211 | * responds from a thread context (providing a slightly more robust |
| 212 | * sign of life). |
| 213 | * |
| 214 | */ |
| 215 | |
| 216 | /** |
| 217 | * @ingroup Ping |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 218 | * @brief Request with #MRQ_PING |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 219 | * |
| 220 | * Used by the sender of an #MRQ_PING message to request a pong from |
| 221 | * recipient. The response from the recipient is computed based on |
| 222 | * #challenge. |
| 223 | */ |
| 224 | struct mrq_ping_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 225 | /** @brief Arbitrarily chosen value */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 226 | uint32_t challenge; |
| 227 | } __ABI_PACKED; |
| 228 | |
| 229 | /** |
| 230 | * @ingroup Ping |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 231 | * @brief Response to #MRQ_PING |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 232 | * |
| 233 | * Sent in response to an #MRQ_PING message. #reply should be the |
| 234 | * mrq_ping_request challenge left shifted by 1 with the carry-bit |
| 235 | * dropped. |
| 236 | * |
| 237 | */ |
| 238 | struct mrq_ping_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 239 | /** @brief Response to the MRQ_PING challege */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 240 | uint32_t reply; |
| 241 | } __ABI_PACKED; |
| 242 | |
| 243 | /** |
| 244 | * @ingroup MRQ_Codes |
| 245 | * @def MRQ_QUERY_TAG |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 246 | * @brief Query BPMP firmware's tag (i.e. unique identifer) |
| 247 | * |
| 248 | * @deprecated Use #MRQ_QUERY_FW_TAG instead. |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 249 | * |
| 250 | * * Platforms: All |
| 251 | * * Initiators: CCPLEX |
| 252 | * * Targets: BPMP |
| 253 | * * Request Payload: @ref mrq_query_tag_request |
| 254 | * * Response Payload: N/A |
| 255 | * |
| 256 | */ |
| 257 | |
| 258 | /** |
| 259 | * @ingroup Query_Tag |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 260 | * @brief Request with #MRQ_QUERY_TAG |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 261 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 262 | * @deprecated This structure will be removed in future version. |
| 263 | * Use MRQ_QUERY_FW_TAG instead. |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 264 | */ |
| 265 | struct mrq_query_tag_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 266 | /** @brief Base address to store the firmware tag */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 267 | uint32_t addr; |
| 268 | } __ABI_PACKED; |
| 269 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 270 | |
| 271 | /** |
| 272 | * @ingroup MRQ_Codes |
| 273 | * @def MRQ_QUERY_FW_TAG |
| 274 | * @brief Query BPMP firmware's tag (i.e. unique identifier) |
| 275 | * |
| 276 | * * Platforms: All |
| 277 | * * Initiators: Any |
| 278 | * * Targets: BPMP |
| 279 | * * Request Payload: N/A |
| 280 | * * Response Payload: @ref mrq_query_fw_tag_response |
| 281 | * |
| 282 | */ |
| 283 | |
| 284 | /** |
| 285 | * @ingroup Query_Tag |
| 286 | * @brief Response to #MRQ_QUERY_FW_TAG |
| 287 | * |
| 288 | * Sent in response to #MRQ_QUERY_FW_TAG message. #tag contains the unique |
| 289 | * identifier for the version of firmware issuing the reply. |
| 290 | * |
| 291 | */ |
| 292 | struct mrq_query_fw_tag_response { |
| 293 | /** @brief Array to store tag information */ |
| 294 | uint8_t tag[32]; |
| 295 | } __ABI_PACKED; |
| 296 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 297 | /** |
| 298 | * @ingroup MRQ_Codes |
| 299 | * @def MRQ_MODULE_LOAD |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 300 | * @brief Dynamically load a BPMP code module |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 301 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 302 | * * Platforms: T210, T214, T186 |
| 303 | * @cond (bpmp_t210 || bpmp_t214 || bpmp_t186) |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 304 | * * Initiators: CCPLEX |
| 305 | * * Targets: BPMP |
| 306 | * * Request Payload: @ref mrq_module_load_request |
| 307 | * * Response Payload: @ref mrq_module_load_response |
| 308 | * |
| 309 | * @note This MRQ is disabled on production systems |
| 310 | * |
| 311 | */ |
| 312 | |
| 313 | /** |
| 314 | * @ingroup Module |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 315 | * @brief Request with #MRQ_MODULE_LOAD |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 316 | * |
| 317 | * Used by #MRQ_MODULE_LOAD calls to ask the recipient to dynamically |
| 318 | * load the code located at #phys_addr and having size #size |
| 319 | * bytes. #phys_addr is treated as a void pointer. |
| 320 | * |
| 321 | * The recipient copies the code from #phys_addr to locally allocated |
| 322 | * memory prior to responding to this message. |
| 323 | * |
| 324 | * @todo document the module header format |
| 325 | * |
| 326 | * The sender is responsible for ensuring that the code is mapped in |
| 327 | * the recipient's address map. |
| 328 | * |
| 329 | */ |
| 330 | struct mrq_module_load_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 331 | /** @brief Base address of the code to load. Treated as (void *) */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 332 | uint32_t phys_addr; /* (void *) */ |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 333 | /** @brief Size in bytes of code to load */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 334 | uint32_t size; |
| 335 | } __ABI_PACKED; |
| 336 | |
| 337 | /** |
| 338 | * @ingroup Module |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 339 | * @brief Response to #MRQ_MODULE_LOAD |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 340 | * |
| 341 | * @todo document mrq_response::err |
| 342 | */ |
| 343 | struct mrq_module_load_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 344 | /** @brief Handle to the loaded module */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 345 | uint32_t base; |
| 346 | } __ABI_PACKED; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 347 | /** @endcond*/ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 348 | |
| 349 | /** |
| 350 | * @ingroup MRQ_Codes |
| 351 | * @def MRQ_MODULE_UNLOAD |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 352 | * @brief Unload a previously loaded code module |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 353 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 354 | * * Platforms: T210, T214, T186 |
| 355 | * @cond (bpmp_t210 || bpmp_t214 || bpmp_t186) |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 356 | * * Initiators: CCPLEX |
| 357 | * * Targets: BPMP |
| 358 | * * Request Payload: @ref mrq_module_unload_request |
| 359 | * * Response Payload: N/A |
| 360 | * |
| 361 | * @note This MRQ is disabled on production systems |
| 362 | */ |
| 363 | |
| 364 | /** |
| 365 | * @ingroup Module |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 366 | * @brief Request with #MRQ_MODULE_UNLOAD |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 367 | * |
| 368 | * Used by #MRQ_MODULE_UNLOAD calls to request that a previously loaded |
| 369 | * module be unloaded. |
| 370 | */ |
| 371 | struct mrq_module_unload_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 372 | /** @brief Handle of the module to unload */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 373 | uint32_t base; |
| 374 | } __ABI_PACKED; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 375 | /** @endcond*/ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 376 | |
| 377 | /** |
| 378 | * @ingroup MRQ_Codes |
| 379 | * @def MRQ_TRACE_MODIFY |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 380 | * @brief Modify the set of enabled trace events |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 381 | * |
| 382 | * * Platforms: All |
| 383 | * * Initiators: CCPLEX |
| 384 | * * Targets: BPMP |
| 385 | * * Request Payload: @ref mrq_trace_modify_request |
| 386 | * * Response Payload: @ref mrq_trace_modify_response |
| 387 | * |
| 388 | * @note This MRQ is disabled on production systems |
| 389 | */ |
| 390 | |
| 391 | /** |
| 392 | * @ingroup Trace |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 393 | * @brief Request with #MRQ_TRACE_MODIFY |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 394 | * |
| 395 | * Used by %MRQ_TRACE_MODIFY calls to enable or disable specify trace |
| 396 | * events. #set takes precedence for any bit set in both #set and |
| 397 | * #clr. |
| 398 | */ |
| 399 | struct mrq_trace_modify_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 400 | /** @brief Bit mask of trace events to disable */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 401 | uint32_t clr; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 402 | /** @brief Bit mask of trace events to enable */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 403 | uint32_t set; |
| 404 | } __ABI_PACKED; |
| 405 | |
| 406 | /** |
| 407 | * @ingroup Trace |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 408 | * @brief Response to #MRQ_TRACE_MODIFY |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 409 | * |
| 410 | * Sent in repsonse to an #MRQ_TRACE_MODIFY message. #mask reflects the |
| 411 | * state of which events are enabled after the recipient acted on the |
| 412 | * message. |
| 413 | * |
| 414 | */ |
| 415 | struct mrq_trace_modify_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 416 | /** @brief Bit mask of trace event enable states */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 417 | uint32_t mask; |
| 418 | } __ABI_PACKED; |
| 419 | |
| 420 | /** |
| 421 | * @ingroup MRQ_Codes |
| 422 | * @def MRQ_WRITE_TRACE |
| 423 | * @brief Write trace data to a buffer |
| 424 | * |
| 425 | * * Platforms: All |
| 426 | * * Initiators: CCPLEX |
| 427 | * * Targets: BPMP |
| 428 | * * Request Payload: @ref mrq_write_trace_request |
| 429 | * * Response Payload: @ref mrq_write_trace_response |
| 430 | * |
| 431 | * mrq_response::err depends on the @ref mrq_write_trace_request field |
| 432 | * values. err is -#BPMP_EINVAL if size is zero or area is NULL or |
| 433 | * area is in an illegal range. A positive value for err indicates the |
| 434 | * number of bytes written to area. |
| 435 | * |
| 436 | * @note This MRQ is disabled on production systems |
| 437 | */ |
| 438 | |
| 439 | /** |
| 440 | * @ingroup Trace |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 441 | * @brief Request with #MRQ_WRITE_TRACE |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 442 | * |
| 443 | * Used by MRQ_WRITE_TRACE calls to ask the recipient to copy trace |
| 444 | * data from the recipient's local buffer to the output buffer. #area |
| 445 | * is treated as a byte-aligned pointer in the recipient's address |
| 446 | * space. |
| 447 | * |
| 448 | * The sender is responsible for ensuring that the output |
| 449 | * buffer is mapped in the recipient's address map. The recipient is |
| 450 | * responsible for protecting its own code and data from accidental |
| 451 | * overwrites. |
| 452 | */ |
| 453 | struct mrq_write_trace_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 454 | /** @brief Base address of output buffer */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 455 | uint32_t area; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 456 | /** @brief Size in bytes of the output buffer */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 457 | uint32_t size; |
| 458 | } __ABI_PACKED; |
| 459 | |
| 460 | /** |
| 461 | * @ingroup Trace |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 462 | * @brief Response to #MRQ_WRITE_TRACE |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 463 | * |
| 464 | * Once this response is sent, the respondent will not access the |
| 465 | * output buffer further. |
| 466 | */ |
| 467 | struct mrq_write_trace_response { |
| 468 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 469 | * @brief Flag whether more data remains in local buffer |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 470 | * |
| 471 | * Value is 1 if the entire local trace buffer has been |
| 472 | * drained to the outputbuffer. Value is 0 otherwise. |
| 473 | */ |
| 474 | uint32_t eof; |
| 475 | } __ABI_PACKED; |
| 476 | |
| 477 | /** @private */ |
| 478 | struct mrq_threaded_ping_request { |
| 479 | uint32_t challenge; |
| 480 | } __ABI_PACKED; |
| 481 | |
| 482 | /** @private */ |
| 483 | struct mrq_threaded_ping_response { |
| 484 | uint32_t reply; |
| 485 | } __ABI_PACKED; |
| 486 | |
| 487 | /** |
| 488 | * @ingroup MRQ_Codes |
| 489 | * @def MRQ_MODULE_MAIL |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 490 | * @brief Send a message to a loadable module |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 491 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 492 | * * Platforms: T210, T214, T186 |
| 493 | * @cond (bpmp_t210 || bpmp_t214 || bpmp_t186) |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 494 | * * Initiators: Any |
| 495 | * * Targets: BPMP |
| 496 | * * Request Payload: @ref mrq_module_mail_request |
| 497 | * * Response Payload: @ref mrq_module_mail_response |
| 498 | * |
| 499 | * @note This MRQ is disabled on production systems |
| 500 | */ |
| 501 | |
| 502 | /** |
| 503 | * @ingroup Module |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 504 | * @brief Request with #MRQ_MODULE_MAIL |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 505 | */ |
| 506 | struct mrq_module_mail_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 507 | /** @brief Handle to the previously loaded module */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 508 | uint32_t base; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 509 | /** @brief Module-specific mail payload |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 510 | * |
| 511 | * The length of data[ ] is unknown to the BPMP core firmware |
| 512 | * but it is limited to the size of an IPC message. |
| 513 | */ |
| 514 | uint8_t data[EMPTY_ARRAY]; |
| 515 | } __ABI_PACKED; |
| 516 | |
| 517 | /** |
| 518 | * @ingroup Module |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 519 | * @brief Response to #MRQ_MODULE_MAIL |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 520 | */ |
| 521 | struct mrq_module_mail_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 522 | /** @brief Module-specific mail payload |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 523 | * |
| 524 | * The length of data[ ] is unknown to the BPMP core firmware |
| 525 | * but it is limited to the size of an IPC message. |
| 526 | */ |
| 527 | uint8_t data[EMPTY_ARRAY]; |
| 528 | } __ABI_PACKED; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 529 | /** @endcond */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 530 | |
| 531 | /** |
| 532 | * @ingroup MRQ_Codes |
| 533 | * @def MRQ_DEBUGFS |
| 534 | * @brief Interact with BPMP's debugfs file nodes |
| 535 | * |
Jon Hunter | 5e37b9c | 2020-07-12 11:01:17 +0100 | [diff] [blame^] | 536 | * @deprecated use MRQ_DEBUG instead. |
| 537 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 538 | * * Platforms: T186, T194 |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 539 | * * Initiators: Any |
| 540 | * * Targets: BPMP |
| 541 | * * Request Payload: @ref mrq_debugfs_request |
| 542 | * * Response Payload: @ref mrq_debugfs_response |
| 543 | */ |
| 544 | |
| 545 | /** |
| 546 | * @addtogroup Debugfs |
| 547 | * @{ |
| 548 | * |
| 549 | * The BPMP firmware implements a pseudo-filesystem called |
| 550 | * debugfs. Any driver within the firmware may register with debugfs |
| 551 | * to expose an arbitrary set of "files" in the filesystem. When |
| 552 | * software on the CPU writes to a debugfs file, debugfs passes the |
| 553 | * written data to a callback provided by the driver. When software on |
| 554 | * the CPU reads a debugfs file, debugfs queries the driver for the |
| 555 | * data to return to the CPU. The intention of the debugfs filesystem |
| 556 | * is to provide information useful for debugging the system at |
| 557 | * runtime. |
| 558 | * |
| 559 | * @note The files exposed via debugfs are not part of the |
| 560 | * BPMP firmware's ABI. debugfs files may be added or removed in any |
| 561 | * given version of the firmware. Typically the semantics of a debugfs |
| 562 | * file are consistent from version to version but even that is not |
| 563 | * guaranteed. |
| 564 | * |
| 565 | * @} |
| 566 | */ |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 567 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 568 | /** @ingroup Debugfs */ |
| 569 | enum mrq_debugfs_commands { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 570 | /** @brief Perform read */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 571 | CMD_DEBUGFS_READ = 1, |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 572 | /** @brief Perform write */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 573 | CMD_DEBUGFS_WRITE = 2, |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 574 | /** @brief Perform dumping directory */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 575 | CMD_DEBUGFS_DUMPDIR = 3, |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 576 | /** @brief Not a command */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 577 | CMD_DEBUGFS_MAX |
| 578 | }; |
| 579 | |
| 580 | /** |
| 581 | * @ingroup Debugfs |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 582 | * @brief Parameters for CMD_DEBUGFS_READ/WRITE command |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 583 | */ |
| 584 | struct cmd_debugfs_fileop_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 585 | /** @brief Physical address pointing at filename */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 586 | uint32_t fnameaddr; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 587 | /** @brief Length in bytes of filename buffer */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 588 | uint32_t fnamelen; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 589 | /** @brief Physical address pointing to data buffer */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 590 | uint32_t dataaddr; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 591 | /** @brief Length in bytes of data buffer */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 592 | uint32_t datalen; |
| 593 | } __ABI_PACKED; |
| 594 | |
| 595 | /** |
| 596 | * @ingroup Debugfs |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 597 | * @brief Parameters for CMD_DEBUGFS_READ/WRITE command |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 598 | */ |
| 599 | struct cmd_debugfs_dumpdir_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 600 | /** @brief Physical address pointing to data buffer */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 601 | uint32_t dataaddr; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 602 | /** @brief Length in bytes of data buffer */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 603 | uint32_t datalen; |
| 604 | } __ABI_PACKED; |
| 605 | |
| 606 | /** |
| 607 | * @ingroup Debugfs |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 608 | * @brief Response data for CMD_DEBUGFS_READ/WRITE command |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 609 | */ |
| 610 | struct cmd_debugfs_fileop_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 611 | /** @brief Always 0 */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 612 | uint32_t reserved; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 613 | /** @brief Number of bytes read from or written to data buffer */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 614 | uint32_t nbytes; |
| 615 | } __ABI_PACKED; |
| 616 | |
| 617 | /** |
| 618 | * @ingroup Debugfs |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 619 | * @brief Response data for CMD_DEBUGFS_DUMPDIR command |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 620 | */ |
| 621 | struct cmd_debugfs_dumpdir_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 622 | /** @brief Always 0 */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 623 | uint32_t reserved; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 624 | /** @brief Number of bytes read from or written to data buffer */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 625 | uint32_t nbytes; |
| 626 | } __ABI_PACKED; |
| 627 | |
| 628 | /** |
| 629 | * @ingroup Debugfs |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 630 | * @brief Request with #MRQ_DEBUGFS. |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 631 | * |
| 632 | * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs |
| 633 | * command to execute. Legal commands are the values of @ref |
| 634 | * mrq_debugfs_commands. Each command requires a specific additional |
| 635 | * payload of data. |
| 636 | * |
| 637 | * |command |payload| |
| 638 | * |-------------------|-------| |
| 639 | * |CMD_DEBUGFS_READ |fop | |
| 640 | * |CMD_DEBUGFS_WRITE |fop | |
| 641 | * |CMD_DEBUGFS_DUMPDIR|dumpdir| |
| 642 | */ |
| 643 | struct mrq_debugfs_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 644 | /** @brief Sub-command (@ref mrq_debugfs_commands) */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 645 | uint32_t cmd; |
| 646 | union { |
| 647 | struct cmd_debugfs_fileop_request fop; |
| 648 | struct cmd_debugfs_dumpdir_request dumpdir; |
| 649 | } __UNION_ANON; |
| 650 | } __ABI_PACKED; |
| 651 | |
| 652 | /** |
| 653 | * @ingroup Debugfs |
| 654 | */ |
| 655 | struct mrq_debugfs_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 656 | /** @brief Always 0 */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 657 | int32_t reserved; |
| 658 | union { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 659 | /** @brief Response data for CMD_DEBUGFS_READ OR |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 660 | * CMD_DEBUGFS_WRITE command |
| 661 | */ |
| 662 | struct cmd_debugfs_fileop_response fop; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 663 | /** @brief Response data for CMD_DEBUGFS_DUMPDIR command */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 664 | struct cmd_debugfs_dumpdir_response dumpdir; |
| 665 | } __UNION_ANON; |
| 666 | } __ABI_PACKED; |
| 667 | |
| 668 | /** |
| 669 | * @addtogroup Debugfs |
| 670 | * @{ |
| 671 | */ |
| 672 | #define DEBUGFS_S_ISDIR (1 << 9) |
| 673 | #define DEBUGFS_S_IRUSR (1 << 8) |
| 674 | #define DEBUGFS_S_IWUSR (1 << 7) |
| 675 | /** @} */ |
| 676 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 677 | /** |
| 678 | * @ingroup MRQ_Codes |
Jon Hunter | 5e37b9c | 2020-07-12 11:01:17 +0100 | [diff] [blame^] | 679 | * @def MRQ_DEBUG |
| 680 | * @brief Interact with BPMP's debugfs file nodes. Use message payload |
| 681 | * for exchanging data. This is functionally equivalent to |
| 682 | * @ref MRQ_DEBUGFS. But the way in which data is exchanged is different. |
| 683 | * When software running on CPU tries to read a debugfs file, |
| 684 | * the file path and read data will be stored in message payload. |
| 685 | * Since the message payload size is limited, a debugfs file |
| 686 | * transaction might require multiple frames of data exchanged |
| 687 | * between BPMP and CPU until the transaction completes. |
| 688 | * |
| 689 | * * Platforms: T194 |
| 690 | * * Initiators: Any |
| 691 | * * Targets: BPMP |
| 692 | * * Request Payload: @ref mrq_debug_request |
| 693 | * * Response Payload: @ref mrq_debug_response |
| 694 | */ |
| 695 | |
| 696 | /** @ingroup Debugfs */ |
| 697 | enum mrq_debug_commands { |
| 698 | /** @brief Open required file for read operation */ |
| 699 | CMD_DEBUG_OPEN_RO = 0, |
| 700 | /** @brief Open required file for write operation */ |
| 701 | CMD_DEBUG_OPEN_WO = 1, |
| 702 | /** @brief Perform read */ |
| 703 | CMD_DEBUG_READ = 2, |
| 704 | /** @brief Perform write */ |
| 705 | CMD_DEBUG_WRITE = 3, |
| 706 | /** @brief Close file */ |
| 707 | CMD_DEBUG_CLOSE = 4, |
| 708 | /** @brief Not a command */ |
| 709 | CMD_DEBUG_MAX |
| 710 | }; |
| 711 | |
| 712 | /** |
| 713 | * @ingroup Debugfs |
| 714 | * @brief Maximum number of files that can be open at a given time |
| 715 | */ |
| 716 | #define DEBUG_MAX_OPEN_FILES 1 |
| 717 | |
| 718 | /** |
| 719 | * @ingroup Debugfs |
| 720 | * @brief Maximum size of null-terminated file name string in bytes. |
| 721 | * Value is derived from memory available in message payload while |
| 722 | * using @ref cmd_debug_fopen_request |
| 723 | * Value 4 corresponds to size of @ref mrq_debug_commands |
| 724 | * in @ref mrq_debug_request. |
| 725 | * 120 - 4 dbg_cmd(32bit) = 116 |
| 726 | */ |
| 727 | #define DEBUG_FNAME_MAX_SZ (MSG_DATA_MIN_SZ - 4) |
| 728 | |
| 729 | /** |
| 730 | * @ingroup Debugfs |
| 731 | * @brief Parameters for CMD_DEBUG_OPEN command |
| 732 | */ |
| 733 | struct cmd_debug_fopen_request { |
| 734 | /** @brief File name - Null-terminated string with maximum |
| 735 | * length @ref DEBUG_FNAME_MAX_SZ |
| 736 | */ |
| 737 | char name[DEBUG_FNAME_MAX_SZ]; |
| 738 | } __ABI_PACKED; |
| 739 | |
| 740 | /** |
| 741 | * @ingroup Debugfs |
| 742 | * @brief Response data for CMD_DEBUG_OPEN_RO/WO command |
| 743 | */ |
| 744 | struct cmd_debug_fopen_response { |
| 745 | /** @brief Identifier for file access */ |
| 746 | uint32_t fd; |
| 747 | /** @brief Data length. File data size for READ command. |
| 748 | * Maximum allowed length for WRITE command |
| 749 | */ |
| 750 | uint32_t datalen; |
| 751 | } __ABI_PACKED; |
| 752 | |
| 753 | /** |
| 754 | * @ingroup Debugfs |
| 755 | * @brief Parameters for CMD_DEBUG_READ command |
| 756 | */ |
| 757 | struct cmd_debug_fread_request { |
| 758 | /** @brief File access identifier received in response |
| 759 | * to CMD_DEBUG_OPEN_RO request |
| 760 | */ |
| 761 | uint32_t fd; |
| 762 | } __ABI_PACKED; |
| 763 | |
| 764 | /** |
| 765 | * @ingroup Debugfs |
| 766 | * @brief Maximum size of read data in bytes. |
| 767 | * Value is derived from memory available in message payload while |
| 768 | * using @ref cmd_debug_fread_response. |
| 769 | */ |
| 770 | #define DEBUG_READ_MAX_SZ (MSG_DATA_MIN_SZ - 4) |
| 771 | |
| 772 | /** |
| 773 | * @ingroup Debugfs |
| 774 | * @brief Response data for CMD_DEBUG_READ command |
| 775 | */ |
| 776 | struct cmd_debug_fread_response { |
| 777 | /** @brief Size of data provided in this response in bytes */ |
| 778 | uint32_t readlen; |
| 779 | /** @brief File data from seek position */ |
| 780 | char data[DEBUG_READ_MAX_SZ]; |
| 781 | } __ABI_PACKED; |
| 782 | |
| 783 | /** |
| 784 | * @ingroup Debugfs |
| 785 | * @brief Maximum size of write data in bytes. |
| 786 | * Value is derived from memory available in message payload while |
| 787 | * using @ref cmd_debug_fwrite_request. |
| 788 | */ |
| 789 | #define DEBUG_WRITE_MAX_SZ (MSG_DATA_MIN_SZ - 12) |
| 790 | |
| 791 | /** |
| 792 | * @ingroup Debugfs |
| 793 | * @brief Parameters for CMD_DEBUG_WRITE command |
| 794 | */ |
| 795 | struct cmd_debug_fwrite_request { |
| 796 | /** @brief File access identifier received in response |
| 797 | * to CMD_DEBUG_OPEN_RO request |
| 798 | */ |
| 799 | uint32_t fd; |
| 800 | /** @brief Size of write data in bytes */ |
| 801 | uint32_t datalen; |
| 802 | /** @brief Data to be written */ |
| 803 | char data[DEBUG_WRITE_MAX_SZ]; |
| 804 | } __ABI_PACKED; |
| 805 | |
| 806 | /** |
| 807 | * @ingroup Debugfs |
| 808 | * @brief Parameters for CMD_DEBUG_CLOSE command |
| 809 | */ |
| 810 | struct cmd_debug_fclose_request { |
| 811 | /** @brief File access identifier received in response |
| 812 | * to CMD_DEBUG_OPEN_RO request |
| 813 | */ |
| 814 | uint32_t fd; |
| 815 | } __ABI_PACKED; |
| 816 | |
| 817 | /** |
| 818 | * @ingroup Debugfs |
| 819 | * @brief Request with #MRQ_DEBUG. |
| 820 | * |
| 821 | * The sender of an MRQ_DEBUG message uses #cmd to specify a debugfs |
| 822 | * command to execute. Legal commands are the values of @ref |
| 823 | * mrq_debug_commands. Each command requires a specific additional |
| 824 | * payload of data. |
| 825 | * |
| 826 | * |command |payload| |
| 827 | * |-------------------|-------| |
| 828 | * |CMD_DEBUG_OPEN_RO |fop | |
| 829 | * |CMD_DEBUG_OPEN_WO |fop | |
| 830 | * |CMD_DEBUG_READ |frd | |
| 831 | * |CMD_DEBUG_WRITE |fwr | |
| 832 | * |CMD_DEBUG_CLOSE |fcl | |
| 833 | */ |
| 834 | struct mrq_debug_request { |
| 835 | /** @brief Sub-command (@ref mrq_debug_commands) */ |
| 836 | uint32_t cmd; |
| 837 | union { |
| 838 | /** @brief Request payload for CMD_DEBUG_OPEN_RO/WO command */ |
| 839 | struct cmd_debug_fopen_request fop; |
| 840 | /** @brief Request payload for CMD_DEBUG_READ command */ |
| 841 | struct cmd_debug_fread_request frd; |
| 842 | /** @brief Request payload for CMD_DEBUG_WRITE command */ |
| 843 | struct cmd_debug_fwrite_request fwr; |
| 844 | /** @brief Request payload for CMD_DEBUG_CLOSE command */ |
| 845 | struct cmd_debug_fclose_request fcl; |
| 846 | } __UNION_ANON; |
| 847 | } __ABI_PACKED; |
| 848 | |
| 849 | /** |
| 850 | * @ingroup Debugfs |
| 851 | */ |
| 852 | struct mrq_debug_response { |
| 853 | union { |
| 854 | /** @brief Response data for CMD_DEBUG_OPEN_RO/WO command */ |
| 855 | struct cmd_debug_fopen_response fop; |
| 856 | /** @brief Response data for CMD_DEBUG_READ command */ |
| 857 | struct cmd_debug_fread_response frd; |
| 858 | } __UNION_ANON; |
| 859 | } __ABI_PACKED; |
| 860 | |
| 861 | /** |
| 862 | * @ingroup MRQ_Codes |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 863 | * @def MRQ_RESET |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 864 | * @brief Reset an IP block |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 865 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 866 | * * Platforms: T186, T194 |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 867 | * * Initiators: Any |
| 868 | * * Targets: BPMP |
| 869 | * * Request Payload: @ref mrq_reset_request |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 870 | * * Response Payload: @ref mrq_reset_response |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 871 | * |
| 872 | * @addtogroup Reset |
| 873 | * @{ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 874 | */ |
| 875 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 876 | enum mrq_reset_commands { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 877 | /** @brief Assert module reset */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 878 | CMD_RESET_ASSERT = 1, |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 879 | /** @brief Deassert module reset */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 880 | CMD_RESET_DEASSERT = 2, |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 881 | /** @brief Assert and deassert the module reset */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 882 | CMD_RESET_MODULE = 3, |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 883 | /** @brief Get the highest reset ID */ |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 884 | CMD_RESET_GET_MAX_ID = 4, |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 885 | /** @brief Not part of ABI and subject to change */ |
| 886 | CMD_RESET_MAX, |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 887 | }; |
| 888 | |
| 889 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 890 | * @brief Request with MRQ_RESET |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 891 | * |
| 892 | * Used by the sender of an #MRQ_RESET message to request BPMP to |
| 893 | * assert or or deassert a given reset line. |
| 894 | */ |
| 895 | struct mrq_reset_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 896 | /** @brief Reset action to perform (@ref mrq_reset_commands) */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 897 | uint32_t cmd; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 898 | /** @brief Id of the reset to affected */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 899 | uint32_t reset_id; |
| 900 | } __ABI_PACKED; |
| 901 | |
| 902 | /** |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 903 | * @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When |
| 904 | * this sub-command is not supported, firmware will return -BPMP_EBADCMD |
| 905 | * in mrq_response::err. |
| 906 | */ |
| 907 | struct cmd_reset_get_max_id_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 908 | /** @brief Max reset id */ |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 909 | uint32_t max_id; |
| 910 | } __ABI_PACKED; |
| 911 | |
| 912 | /** |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 913 | * @brief Response with MRQ_RESET |
| 914 | * |
| 915 | * Each sub-command supported by @ref mrq_reset_request may return |
| 916 | * sub-command-specific data. Some do and some do not as indicated |
| 917 | * in the following table |
| 918 | * |
| 919 | * | sub-command | payload | |
| 920 | * |----------------------|------------------| |
| 921 | * | CMD_RESET_ASSERT | - | |
| 922 | * | CMD_RESET_DEASSERT | - | |
| 923 | * | CMD_RESET_MODULE | - | |
| 924 | * | CMD_RESET_GET_MAX_ID | reset_get_max_id | |
| 925 | */ |
| 926 | struct mrq_reset_response { |
| 927 | union { |
| 928 | struct cmd_reset_get_max_id_response reset_get_max_id; |
| 929 | } __UNION_ANON; |
| 930 | } __ABI_PACKED; |
| 931 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 932 | /** @} */ |
| 933 | |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 934 | /** |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 935 | * @ingroup MRQ_Codes |
| 936 | * @def MRQ_I2C |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 937 | * @brief Issue an i2c transaction |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 938 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 939 | * * Platforms: T186, T194 |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 940 | * * Initiators: Any |
| 941 | * * Targets: BPMP |
| 942 | * * Request Payload: @ref mrq_i2c_request |
| 943 | * * Response Payload: @ref mrq_i2c_response |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 944 | * |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 945 | * @addtogroup I2C |
| 946 | * @{ |
| 947 | */ |
| 948 | #define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE (MSG_DATA_MIN_SZ - 12) |
| 949 | #define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE (MSG_DATA_MIN_SZ - 4) |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 950 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 951 | #define SERIALI2C_TEN 0x0010 |
| 952 | #define SERIALI2C_RD 0x0001 |
| 953 | #define SERIALI2C_STOP 0x8000 |
| 954 | #define SERIALI2C_NOSTART 0x4000 |
| 955 | #define SERIALI2C_REV_DIR_ADDR 0x2000 |
| 956 | #define SERIALI2C_IGNORE_NAK 0x1000 |
| 957 | #define SERIALI2C_NO_RD_ACK 0x0800 |
| 958 | #define SERIALI2C_RECV_LEN 0x0400 |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 959 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 960 | enum { |
| 961 | CMD_I2C_XFER = 1 |
| 962 | }; |
| 963 | |
| 964 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 965 | * @brief Serializable i2c request |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 966 | * |
| 967 | * Instances of this structure are packed (little-endian) into |
| 968 | * cmd_i2c_xfer_request::data_buf. Each instance represents a single |
| 969 | * transaction (or a portion of a transaction with repeated starts) on |
| 970 | * an i2c bus. |
| 971 | * |
| 972 | * Because these structures are packed, some instances are likely to |
| 973 | * be misaligned. Additionally because #data is variable length, it is |
| 974 | * not possible to iterate through a serialized list of these |
| 975 | * structures without inspecting #len in each instance. It may be |
| 976 | * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf |
| 977 | * manually rather than using this structure definition. |
| 978 | */ |
| 979 | struct serial_i2c_request { |
| 980 | /** @brief I2C slave address */ |
| 981 | uint16_t addr; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 982 | /** @brief Bitmask of SERIALI2C_ flags */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 983 | uint16_t flags; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 984 | /** @brief Length of I2C transaction in bytes */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 985 | uint16_t len; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 986 | /** @brief For write transactions only, #len bytes of data */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 987 | uint8_t data[]; |
| 988 | } __ABI_PACKED; |
| 989 | |
| 990 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 991 | * @brief Trigger one or more i2c transactions |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 992 | */ |
| 993 | struct cmd_i2c_xfer_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 994 | /** @brief Valid bus number from @ref bpmp_i2c_ids*/ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 995 | uint32_t bus_id; |
| 996 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 997 | /** @brief Count of valid bytes in #data_buf*/ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 998 | uint32_t data_size; |
| 999 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1000 | /** @brief Serialized packed instances of @ref serial_i2c_request*/ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1001 | uint8_t data_buf[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE]; |
| 1002 | } __ABI_PACKED; |
| 1003 | |
| 1004 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1005 | * @brief Container for data read from the i2c bus |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1006 | * |
| 1007 | * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute |
| 1008 | * zero or more I2C reads. The data read from the bus is serialized |
| 1009 | * into #data_buf. |
| 1010 | */ |
| 1011 | struct cmd_i2c_xfer_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1012 | /** @brief Count of valid bytes in #data_buf*/ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1013 | uint32_t data_size; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1014 | /** @brief I2c read data */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1015 | uint8_t data_buf[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE]; |
| 1016 | } __ABI_PACKED; |
| 1017 | |
| 1018 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1019 | * @brief Request with #MRQ_I2C |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1020 | */ |
| 1021 | struct mrq_i2c_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1022 | /** @brief Always CMD_I2C_XFER (i.e. 1) */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1023 | uint32_t cmd; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1024 | /** @brief Parameters of the transfer request */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1025 | struct cmd_i2c_xfer_request xfer; |
| 1026 | } __ABI_PACKED; |
| 1027 | |
| 1028 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1029 | * @brief Response to #MRQ_I2C |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1030 | */ |
| 1031 | struct mrq_i2c_response { |
| 1032 | struct cmd_i2c_xfer_response xfer; |
| 1033 | } __ABI_PACKED; |
| 1034 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1035 | /** @} */ |
| 1036 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1037 | /** |
| 1038 | * @ingroup MRQ_Codes |
| 1039 | * @def MRQ_CLK |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1040 | * @brief Perform a clock operation |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1041 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1042 | * * Platforms: T186, T194 |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1043 | * * Initiators: Any |
| 1044 | * * Targets: BPMP |
| 1045 | * * Request Payload: @ref mrq_clk_request |
| 1046 | * * Response Payload: @ref mrq_clk_response |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1047 | * |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1048 | * @addtogroup Clocks |
| 1049 | * @{ |
| 1050 | */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1051 | enum { |
| 1052 | CMD_CLK_GET_RATE = 1, |
| 1053 | CMD_CLK_SET_RATE = 2, |
| 1054 | CMD_CLK_ROUND_RATE = 3, |
| 1055 | CMD_CLK_GET_PARENT = 4, |
| 1056 | CMD_CLK_SET_PARENT = 5, |
| 1057 | CMD_CLK_IS_ENABLED = 6, |
| 1058 | CMD_CLK_ENABLE = 7, |
| 1059 | CMD_CLK_DISABLE = 8, |
| 1060 | CMD_CLK_GET_ALL_INFO = 14, |
| 1061 | CMD_CLK_GET_MAX_CLK_ID = 15, |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1062 | CMD_CLK_GET_FMAX_AT_VMIN = 16, |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1063 | CMD_CLK_MAX, |
| 1064 | }; |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1065 | |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1066 | #define BPMP_CLK_HAS_MUX (1 << 0) |
| 1067 | #define BPMP_CLK_HAS_SET_RATE (1 << 1) |
| 1068 | #define BPMP_CLK_IS_ROOT (1 << 2) |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1069 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1070 | #define MRQ_CLK_NAME_MAXLEN 40 |
| 1071 | #define MRQ_CLK_MAX_PARENTS 16 |
| 1072 | |
| 1073 | /** @private */ |
| 1074 | struct cmd_clk_get_rate_request { |
| 1075 | EMPTY |
| 1076 | } __ABI_PACKED; |
| 1077 | |
| 1078 | struct cmd_clk_get_rate_response { |
| 1079 | int64_t rate; |
| 1080 | } __ABI_PACKED; |
| 1081 | |
| 1082 | struct cmd_clk_set_rate_request { |
| 1083 | int32_t unused; |
| 1084 | int64_t rate; |
| 1085 | } __ABI_PACKED; |
| 1086 | |
| 1087 | struct cmd_clk_set_rate_response { |
| 1088 | int64_t rate; |
| 1089 | } __ABI_PACKED; |
| 1090 | |
| 1091 | struct cmd_clk_round_rate_request { |
| 1092 | int32_t unused; |
| 1093 | int64_t rate; |
| 1094 | } __ABI_PACKED; |
| 1095 | |
| 1096 | struct cmd_clk_round_rate_response { |
| 1097 | int64_t rate; |
| 1098 | } __ABI_PACKED; |
| 1099 | |
| 1100 | /** @private */ |
| 1101 | struct cmd_clk_get_parent_request { |
| 1102 | EMPTY |
| 1103 | } __ABI_PACKED; |
| 1104 | |
| 1105 | struct cmd_clk_get_parent_response { |
| 1106 | uint32_t parent_id; |
| 1107 | } __ABI_PACKED; |
| 1108 | |
| 1109 | struct cmd_clk_set_parent_request { |
| 1110 | uint32_t parent_id; |
| 1111 | } __ABI_PACKED; |
| 1112 | |
| 1113 | struct cmd_clk_set_parent_response { |
| 1114 | uint32_t parent_id; |
| 1115 | } __ABI_PACKED; |
| 1116 | |
| 1117 | /** @private */ |
| 1118 | struct cmd_clk_is_enabled_request { |
| 1119 | EMPTY |
| 1120 | } __ABI_PACKED; |
| 1121 | |
| 1122 | struct cmd_clk_is_enabled_response { |
| 1123 | int32_t state; |
| 1124 | } __ABI_PACKED; |
| 1125 | |
| 1126 | /** @private */ |
| 1127 | struct cmd_clk_enable_request { |
| 1128 | EMPTY |
| 1129 | } __ABI_PACKED; |
| 1130 | |
| 1131 | /** @private */ |
| 1132 | struct cmd_clk_enable_response { |
| 1133 | EMPTY |
| 1134 | } __ABI_PACKED; |
| 1135 | |
| 1136 | /** @private */ |
| 1137 | struct cmd_clk_disable_request { |
| 1138 | EMPTY |
| 1139 | } __ABI_PACKED; |
| 1140 | |
| 1141 | /** @private */ |
| 1142 | struct cmd_clk_disable_response { |
| 1143 | EMPTY |
| 1144 | } __ABI_PACKED; |
| 1145 | |
| 1146 | /** @private */ |
| 1147 | struct cmd_clk_get_all_info_request { |
| 1148 | EMPTY |
| 1149 | } __ABI_PACKED; |
| 1150 | |
| 1151 | struct cmd_clk_get_all_info_response { |
| 1152 | uint32_t flags; |
| 1153 | uint32_t parent; |
| 1154 | uint32_t parents[MRQ_CLK_MAX_PARENTS]; |
| 1155 | uint8_t num_parents; |
| 1156 | uint8_t name[MRQ_CLK_NAME_MAXLEN]; |
| 1157 | } __ABI_PACKED; |
| 1158 | |
| 1159 | /** @private */ |
| 1160 | struct cmd_clk_get_max_clk_id_request { |
| 1161 | EMPTY |
| 1162 | } __ABI_PACKED; |
| 1163 | |
| 1164 | struct cmd_clk_get_max_clk_id_response { |
| 1165 | uint32_t max_id; |
| 1166 | } __ABI_PACKED; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1167 | |
| 1168 | /** @private */ |
| 1169 | struct cmd_clk_get_fmax_at_vmin_request { |
| 1170 | EMPTY |
| 1171 | } __ABI_PACKED; |
| 1172 | |
| 1173 | struct cmd_clk_get_fmax_at_vmin_response { |
| 1174 | int64_t rate; |
| 1175 | } __ABI_PACKED; |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1176 | |
| 1177 | /** |
| 1178 | * @ingroup Clocks |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1179 | * @brief Request with #MRQ_CLK |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1180 | * |
| 1181 | * Used by the sender of an #MRQ_CLK message to control clocks. The |
| 1182 | * clk_request is split into several sub-commands. Some sub-commands |
| 1183 | * require no additional data. Others have a sub-command specific |
| 1184 | * payload |
| 1185 | * |
| 1186 | * |sub-command |payload | |
| 1187 | * |----------------------------|-----------------------| |
| 1188 | * |CMD_CLK_GET_RATE |- | |
| 1189 | * |CMD_CLK_SET_RATE |clk_set_rate | |
| 1190 | * |CMD_CLK_ROUND_RATE |clk_round_rate | |
| 1191 | * |CMD_CLK_GET_PARENT |- | |
| 1192 | * |CMD_CLK_SET_PARENT |clk_set_parent | |
| 1193 | * |CMD_CLK_IS_ENABLED |- | |
| 1194 | * |CMD_CLK_ENABLE |- | |
| 1195 | * |CMD_CLK_DISABLE |- | |
| 1196 | * |CMD_CLK_GET_ALL_INFO |- | |
| 1197 | * |CMD_CLK_GET_MAX_CLK_ID |- | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1198 | * |CMD_CLK_GET_FMAX_AT_VMIN |- |
| 1199 | * | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1200 | * |
| 1201 | */ |
| 1202 | |
| 1203 | struct mrq_clk_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1204 | /** @brief Sub-command and clock id concatenated to 32-bit word. |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1205 | * - bits[31..24] is the sub-cmd. |
| 1206 | * - bits[23..0] is the clock id |
| 1207 | */ |
| 1208 | uint32_t cmd_and_id; |
| 1209 | |
| 1210 | union { |
| 1211 | /** @private */ |
| 1212 | struct cmd_clk_get_rate_request clk_get_rate; |
| 1213 | struct cmd_clk_set_rate_request clk_set_rate; |
| 1214 | struct cmd_clk_round_rate_request clk_round_rate; |
| 1215 | /** @private */ |
| 1216 | struct cmd_clk_get_parent_request clk_get_parent; |
| 1217 | struct cmd_clk_set_parent_request clk_set_parent; |
| 1218 | /** @private */ |
| 1219 | struct cmd_clk_enable_request clk_enable; |
| 1220 | /** @private */ |
| 1221 | struct cmd_clk_disable_request clk_disable; |
| 1222 | /** @private */ |
| 1223 | struct cmd_clk_is_enabled_request clk_is_enabled; |
| 1224 | /** @private */ |
| 1225 | struct cmd_clk_get_all_info_request clk_get_all_info; |
| 1226 | /** @private */ |
| 1227 | struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1228 | /** @private */ |
| 1229 | struct cmd_clk_get_fmax_at_vmin_request clk_get_fmax_at_vmin; |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1230 | } __UNION_ANON; |
| 1231 | } __ABI_PACKED; |
| 1232 | |
| 1233 | /** |
| 1234 | * @ingroup Clocks |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1235 | * @brief Response to MRQ_CLK |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1236 | * |
| 1237 | * Each sub-command supported by @ref mrq_clk_request may return |
| 1238 | * sub-command-specific data. Some do and some do not as indicated in |
| 1239 | * the following table |
| 1240 | * |
| 1241 | * |sub-command |payload | |
| 1242 | * |----------------------------|------------------------| |
| 1243 | * |CMD_CLK_GET_RATE |clk_get_rate | |
| 1244 | * |CMD_CLK_SET_RATE |clk_set_rate | |
| 1245 | * |CMD_CLK_ROUND_RATE |clk_round_rate | |
| 1246 | * |CMD_CLK_GET_PARENT |clk_get_parent | |
| 1247 | * |CMD_CLK_SET_PARENT |clk_set_parent | |
| 1248 | * |CMD_CLK_IS_ENABLED |clk_is_enabled | |
| 1249 | * |CMD_CLK_ENABLE |- | |
| 1250 | * |CMD_CLK_DISABLE |- | |
| 1251 | * |CMD_CLK_GET_ALL_INFO |clk_get_all_info | |
| 1252 | * |CMD_CLK_GET_MAX_CLK_ID |clk_get_max_id | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1253 | * |CMD_CLK_GET_FMAX_AT_VMIN |clk_get_fmax_at_vmin | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1254 | * |
| 1255 | */ |
| 1256 | |
| 1257 | struct mrq_clk_response { |
| 1258 | union { |
| 1259 | struct cmd_clk_get_rate_response clk_get_rate; |
| 1260 | struct cmd_clk_set_rate_response clk_set_rate; |
| 1261 | struct cmd_clk_round_rate_response clk_round_rate; |
| 1262 | struct cmd_clk_get_parent_response clk_get_parent; |
| 1263 | struct cmd_clk_set_parent_response clk_set_parent; |
| 1264 | /** @private */ |
| 1265 | struct cmd_clk_enable_response clk_enable; |
| 1266 | /** @private */ |
| 1267 | struct cmd_clk_disable_response clk_disable; |
| 1268 | struct cmd_clk_is_enabled_response clk_is_enabled; |
| 1269 | struct cmd_clk_get_all_info_response clk_get_all_info; |
| 1270 | struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1271 | struct cmd_clk_get_fmax_at_vmin_response clk_get_fmax_at_vmin; |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1272 | } __UNION_ANON; |
| 1273 | } __ABI_PACKED; |
| 1274 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1275 | /** @} */ |
| 1276 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1277 | /** |
| 1278 | * @ingroup MRQ_Codes |
| 1279 | * @def MRQ_QUERY_ABI |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1280 | * @brief Check if an MRQ is implemented |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1281 | * |
| 1282 | * * Platforms: All |
| 1283 | * * Initiators: Any |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1284 | * * Targets: Any except DMCE |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1285 | * * Request Payload: @ref mrq_query_abi_request |
| 1286 | * * Response Payload: @ref mrq_query_abi_response |
| 1287 | */ |
| 1288 | |
| 1289 | /** |
| 1290 | * @ingroup ABI_info |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1291 | * @brief Request with MRQ_QUERY_ABI |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1292 | * |
| 1293 | * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported |
| 1294 | * by the recipient. |
| 1295 | */ |
| 1296 | struct mrq_query_abi_request { |
| 1297 | /** @brief MRQ code to query */ |
| 1298 | uint32_t mrq; |
| 1299 | } __ABI_PACKED; |
| 1300 | |
| 1301 | /** |
| 1302 | * @ingroup ABI_info |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1303 | * @brief Response to MRQ_QUERY_ABI |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1304 | * |
| 1305 | * @note mrq_response::err of 0 indicates that the query was |
| 1306 | * successful, not that the MRQ itself is supported! |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1307 | */ |
| 1308 | struct mrq_query_abi_response { |
| 1309 | /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */ |
| 1310 | int32_t status; |
| 1311 | } __ABI_PACKED; |
| 1312 | |
| 1313 | /** |
| 1314 | * @ingroup MRQ_Codes |
| 1315 | * @def MRQ_PG_READ_STATE |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1316 | * @brief Read the power-gating state of a partition |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1317 | * |
| 1318 | * * Platforms: T186 |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1319 | * @cond bpmp_t186 |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1320 | * * Initiators: Any |
| 1321 | * * Targets: BPMP |
| 1322 | * * Request Payload: @ref mrq_pg_read_state_request |
| 1323 | * * Response Payload: @ref mrq_pg_read_state_response |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1324 | */ |
| 1325 | |
| 1326 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1327 | * @ingroup Powergating |
| 1328 | * @brief Request with #MRQ_PG_READ_STATE |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1329 | * |
| 1330 | * Used by MRQ_PG_READ_STATE call to read the current state of a |
| 1331 | * partition. |
| 1332 | */ |
| 1333 | struct mrq_pg_read_state_request { |
| 1334 | /** @brief ID of partition */ |
| 1335 | uint32_t partition_id; |
| 1336 | } __ABI_PACKED; |
| 1337 | |
| 1338 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1339 | * @ingroup Powergating |
| 1340 | * @brief Response to MRQ_PG_READ_STATE |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1341 | * @todo define possible errors. |
| 1342 | */ |
| 1343 | struct mrq_pg_read_state_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1344 | /** @brief Read as don't care */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1345 | uint32_t sram_state; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1346 | /** @brief State of power partition |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1347 | * * 0 : off |
| 1348 | * * 1 : on |
| 1349 | */ |
| 1350 | uint32_t logic_state; |
| 1351 | } __ABI_PACKED; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1352 | /** @endcond*/ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1353 | /** @} */ |
| 1354 | |
| 1355 | /** |
| 1356 | * @ingroup MRQ_Codes |
| 1357 | * @def MRQ_PG_UPDATE_STATE |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1358 | * @brief Modify the power-gating state of a partition. In contrast to |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1359 | * MRQ_PG calls, the operations that change state (on/off) of power |
| 1360 | * partition are reference counted. |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1361 | * |
| 1362 | * * Platforms: T186 |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1363 | * @cond bpmp_t186 |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1364 | * * Initiators: Any |
| 1365 | * * Targets: BPMP |
| 1366 | * * Request Payload: @ref mrq_pg_update_state_request |
| 1367 | * * Response Payload: N/A |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1368 | */ |
| 1369 | |
| 1370 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1371 | * @ingroup Powergating |
| 1372 | * @brief Request with mrq_pg_update_state_request |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1373 | * |
| 1374 | * Used by #MRQ_PG_UPDATE_STATE call to request BPMP to change the |
| 1375 | * state of a power partition #partition_id. |
| 1376 | */ |
| 1377 | struct mrq_pg_update_state_request { |
| 1378 | /** @brief ID of partition */ |
| 1379 | uint32_t partition_id; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1380 | /** @brief Secondary control of power partition |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1381 | * @details Ignored by many versions of the BPMP |
| 1382 | * firmware. For maximum compatibility, set the value |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1383 | * according to @ref logic_state |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1384 | * * 0x1: power ON partition (@ref logic_state == 0x3) |
| 1385 | * * 0x3: power OFF partition (@ref logic_state == 0x1) |
| 1386 | */ |
| 1387 | uint32_t sram_state; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1388 | /** @brief Controls state of power partition, legal values are |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1389 | * * 0x1 : power OFF partition |
| 1390 | * * 0x3 : power ON partition |
| 1391 | */ |
| 1392 | uint32_t logic_state; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1393 | /** @brief Change state of clocks of the power partition, legal values |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1394 | * * 0x0 : do not change clock state |
| 1395 | * * 0x1 : disable partition clocks (only applicable when |
| 1396 | * @ref logic_state == 0x1) |
| 1397 | * * 0x3 : enable partition clocks (only applicable when |
| 1398 | * @ref logic_state == 0x3) |
| 1399 | */ |
| 1400 | uint32_t clock_state; |
| 1401 | } __ABI_PACKED; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1402 | /** @endcond*/ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1403 | |
| 1404 | /** |
| 1405 | * @ingroup MRQ_Codes |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1406 | * @def MRQ_PG |
| 1407 | * @brief Control power-gating state of a partition. In contrast to |
| 1408 | * MRQ_PG_UPDATE_STATE, operations that change the power partition |
| 1409 | * state are NOT reference counted |
| 1410 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1411 | * @note BPMP-FW forcefully turns off some partitions as part of SC7 entry |
| 1412 | * because their state cannot be adequately restored on exit. Therefore, |
| 1413 | * it is recommended to power off all domains via MRQ_PG prior to SC7 entry. |
| 1414 | * See @ref bpmp_pdomain_ids for further detail. |
| 1415 | * |
| 1416 | * * Platforms: T186, T194 |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1417 | * * Initiators: Any |
| 1418 | * * Targets: BPMP |
| 1419 | * * Request Payload: @ref mrq_pg_request |
| 1420 | * * Response Payload: @ref mrq_pg_response |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1421 | * |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1422 | * @addtogroup Powergating |
| 1423 | * @{ |
| 1424 | */ |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1425 | enum mrq_pg_cmd { |
| 1426 | /** |
| 1427 | * @brief Check whether the BPMP driver supports the specified |
| 1428 | * request type |
| 1429 | * |
| 1430 | * mrq_response::err is 0 if the specified request is |
| 1431 | * supported and -#BPMP_ENODEV otherwise. |
| 1432 | */ |
| 1433 | CMD_PG_QUERY_ABI = 0, |
| 1434 | |
| 1435 | /** |
| 1436 | * @brief Set the current state of specified power domain. The |
| 1437 | * possible values for power domains are defined in enum |
| 1438 | * pg_states |
| 1439 | * |
| 1440 | * mrq_response:err is |
| 1441 | * 0: Success |
| 1442 | * -#BPMP_EINVAL: Invalid request parameters |
| 1443 | */ |
| 1444 | CMD_PG_SET_STATE = 1, |
| 1445 | |
| 1446 | /** |
| 1447 | * @brief Get the current state of specified power domain. The |
| 1448 | * possible values for power domains are defined in enum |
| 1449 | * pg_states |
| 1450 | * |
| 1451 | * mrq_response:err is |
| 1452 | * 0: Success |
| 1453 | * -#BPMP_EINVAL: Invalid request parameters |
| 1454 | */ |
| 1455 | CMD_PG_GET_STATE = 2, |
| 1456 | |
| 1457 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1458 | * @brief Get the name string of specified power domain id. |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1459 | * |
| 1460 | * mrq_response:err is |
| 1461 | * 0: Success |
| 1462 | * -#BPMP_EINVAL: Invalid request parameters |
| 1463 | */ |
| 1464 | CMD_PG_GET_NAME = 3, |
| 1465 | |
| 1466 | |
| 1467 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1468 | * @brief Get the highest power domain id in the system. Not |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1469 | * all IDs between 0 and max_id are valid IDs. |
| 1470 | * |
| 1471 | * mrq_response:err is |
| 1472 | * 0: Success |
| 1473 | * -#BPMP_EINVAL: Invalid request parameters |
| 1474 | */ |
| 1475 | CMD_PG_GET_MAX_ID = 4, |
| 1476 | }; |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1477 | |
| 1478 | #define MRQ_PG_NAME_MAXLEN 40 |
| 1479 | |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1480 | enum pg_states { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1481 | /** @brief Power domain is OFF */ |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1482 | PG_STATE_OFF = 0, |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1483 | /** @brief Power domain is ON */ |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1484 | PG_STATE_ON = 1, |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1485 | /** |
| 1486 | * @brief a legacy state where power domain and the clock |
| 1487 | * associated to the domain are ON. |
| 1488 | * This state is only supported in T186, and the use of it is |
| 1489 | * deprecated. |
| 1490 | */ |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1491 | PG_STATE_RUNNING = 2, |
| 1492 | }; |
| 1493 | |
| 1494 | struct cmd_pg_query_abi_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1495 | /** @ref mrq_pg_cmd */ |
| 1496 | uint32_t type; |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1497 | } __ABI_PACKED; |
| 1498 | |
| 1499 | struct cmd_pg_set_state_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1500 | /** @ref pg_states */ |
| 1501 | uint32_t state; |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1502 | } __ABI_PACKED; |
| 1503 | |
| 1504 | struct cmd_pg_get_state_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1505 | /** @ref pg_states */ |
| 1506 | uint32_t state; |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1507 | } __ABI_PACKED; |
| 1508 | |
| 1509 | struct cmd_pg_get_name_response { |
| 1510 | uint8_t name[MRQ_PG_NAME_MAXLEN]; |
| 1511 | } __ABI_PACKED; |
| 1512 | |
| 1513 | struct cmd_pg_get_max_id_response { |
| 1514 | uint32_t max_id; |
| 1515 | } __ABI_PACKED; |
| 1516 | |
| 1517 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1518 | * @brief Request with #MRQ_PG |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1519 | * |
| 1520 | * Used by the sender of an #MRQ_PG message to control power |
| 1521 | * partitions. The pg_request is split into several sub-commands. Some |
| 1522 | * sub-commands require no additional data. Others have a sub-command |
| 1523 | * specific payload |
| 1524 | * |
| 1525 | * |sub-command |payload | |
| 1526 | * |----------------------------|-----------------------| |
| 1527 | * |CMD_PG_QUERY_ABI | query_abi | |
| 1528 | * |CMD_PG_SET_STATE | set_state | |
| 1529 | * |CMD_PG_GET_STATE | - | |
| 1530 | * |CMD_PG_GET_NAME | - | |
| 1531 | * |CMD_PG_GET_MAX_ID | - | |
| 1532 | * |
| 1533 | */ |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1534 | struct mrq_pg_request { |
| 1535 | uint32_t cmd; |
| 1536 | uint32_t id; |
| 1537 | union { |
| 1538 | struct cmd_pg_query_abi_request query_abi; |
| 1539 | struct cmd_pg_set_state_request set_state; |
| 1540 | } __UNION_ANON; |
| 1541 | } __ABI_PACKED; |
| 1542 | |
| 1543 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1544 | * @brief Response to MRQ_PG |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1545 | * |
| 1546 | * Each sub-command supported by @ref mrq_pg_request may return |
| 1547 | * sub-command-specific data. Some do and some do not as indicated in |
| 1548 | * the following table |
| 1549 | * |
| 1550 | * |sub-command |payload | |
| 1551 | * |----------------------------|-----------------------| |
| 1552 | * |CMD_PG_QUERY_ABI | - | |
| 1553 | * |CMD_PG_SET_STATE | - | |
| 1554 | * |CMD_PG_GET_STATE | get_state | |
| 1555 | * |CMD_PG_GET_NAME | get_name | |
| 1556 | * |CMD_PG_GET_MAX_ID | get_max_id | |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1557 | */ |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1558 | struct mrq_pg_response { |
| 1559 | union { |
| 1560 | struct cmd_pg_get_state_response get_state; |
| 1561 | struct cmd_pg_get_name_response get_name; |
| 1562 | struct cmd_pg_get_max_id_response get_max_id; |
| 1563 | } __UNION_ANON; |
| 1564 | } __ABI_PACKED; |
| 1565 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1566 | /** @} */ |
| 1567 | |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 1568 | /** |
| 1569 | * @ingroup MRQ_Codes |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1570 | * @def MRQ_THERMAL |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1571 | * @brief Interact with BPMP thermal framework |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1572 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1573 | * * Platforms: T186, T194 |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1574 | * * Initiators: Any |
| 1575 | * * Targets: Any |
| 1576 | * * Request Payload: TODO |
| 1577 | * * Response Payload: TODO |
| 1578 | * |
| 1579 | * @addtogroup Thermal |
| 1580 | * |
| 1581 | * The BPMP firmware includes a thermal framework. Drivers within the |
| 1582 | * bpmp firmware register with the framework to provide thermal |
| 1583 | * zones. Each thermal zone corresponds to an entity whose temperature |
| 1584 | * can be measured. The framework also has a notion of trip points. A |
| 1585 | * trip point consists of a thermal zone id, a temperature, and a |
| 1586 | * callback routine. The framework invokes the callback when the zone |
| 1587 | * hits the indicated temperature. The BPMP firmware uses this thermal |
| 1588 | * framework interally to implement various temperature-dependent |
| 1589 | * functions. |
| 1590 | * |
| 1591 | * Software on the CPU can use #MRQ_THERMAL (with payload @ref |
| 1592 | * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal |
| 1593 | * framework. The CPU must It can query the number of supported zones, |
| 1594 | * query zone temperatures, and set trip points. |
| 1595 | * |
| 1596 | * When a trip point set by the CPU gets crossed, BPMP firmware issues |
| 1597 | * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a |
| 1598 | * payload of @ref mrq_thermal_bpmp_to_host_request. |
| 1599 | * @{ |
| 1600 | */ |
| 1601 | enum mrq_thermal_host_to_bpmp_cmd { |
| 1602 | /** |
| 1603 | * @brief Check whether the BPMP driver supports the specified |
| 1604 | * request type. |
| 1605 | * |
| 1606 | * Host needs to supply request parameters. |
| 1607 | * |
| 1608 | * mrq_response::err is 0 if the specified request is |
| 1609 | * supported and -#BPMP_ENODEV otherwise. |
| 1610 | */ |
| 1611 | CMD_THERMAL_QUERY_ABI = 0, |
| 1612 | |
| 1613 | /** |
| 1614 | * @brief Get the current temperature of the specified zone. |
| 1615 | * |
| 1616 | * Host needs to supply request parameters. |
| 1617 | * |
| 1618 | * mrq_response::err is |
| 1619 | * * 0: Temperature query succeeded. |
| 1620 | * * -#BPMP_EINVAL: Invalid request parameters. |
| 1621 | * * -#BPMP_ENOENT: No driver registered for thermal zone.. |
| 1622 | * * -#BPMP_EFAULT: Problem reading temperature measurement. |
| 1623 | */ |
| 1624 | CMD_THERMAL_GET_TEMP = 1, |
| 1625 | |
| 1626 | /** |
| 1627 | * @brief Enable or disable and set the lower and upper |
| 1628 | * thermal limits for a thermal trip point. Each zone has |
| 1629 | * one trip point. |
| 1630 | * |
| 1631 | * Host needs to supply request parameters. Once the |
| 1632 | * temperature hits a trip point, the BPMP will send a message |
| 1633 | * to the CPU having MRQ=MRQ_THERMAL and |
| 1634 | * type=CMD_THERMAL_HOST_TRIP_REACHED |
| 1635 | * |
| 1636 | * mrq_response::err is |
| 1637 | * * 0: Trip successfully set. |
| 1638 | * * -#BPMP_EINVAL: Invalid request parameters. |
| 1639 | * * -#BPMP_ENOENT: No driver registered for thermal zone. |
| 1640 | * * -#BPMP_EFAULT: Problem setting trip point. |
| 1641 | */ |
| 1642 | CMD_THERMAL_SET_TRIP = 2, |
| 1643 | |
| 1644 | /** |
| 1645 | * @brief Get the number of supported thermal zones. |
| 1646 | * |
| 1647 | * No request parameters required. |
| 1648 | * |
| 1649 | * mrq_response::err is always 0, indicating success. |
| 1650 | */ |
| 1651 | CMD_THERMAL_GET_NUM_ZONES = 3, |
| 1652 | |
| 1653 | /** @brief: number of supported host-to-bpmp commands. May |
| 1654 | * increase in future |
| 1655 | */ |
| 1656 | CMD_THERMAL_HOST_TO_BPMP_NUM |
| 1657 | }; |
| 1658 | |
| 1659 | enum mrq_thermal_bpmp_to_host_cmd { |
| 1660 | /** |
| 1661 | * @brief Indication that the temperature for a zone has |
| 1662 | * exceeded the range indicated in the thermal trip point |
| 1663 | * for the zone. |
| 1664 | * |
| 1665 | * BPMP needs to supply request parameters. Host only needs to |
| 1666 | * acknowledge. |
| 1667 | */ |
| 1668 | CMD_THERMAL_HOST_TRIP_REACHED = 100, |
| 1669 | |
| 1670 | /** @brief: number of supported bpmp-to-host commands. May |
| 1671 | * increase in future |
| 1672 | */ |
| 1673 | CMD_THERMAL_BPMP_TO_HOST_NUM |
| 1674 | }; |
| 1675 | |
| 1676 | /* |
| 1677 | * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI |
| 1678 | * |
| 1679 | * zone: Request type for which to check existence. |
| 1680 | */ |
| 1681 | struct cmd_thermal_query_abi_request { |
| 1682 | uint32_t type; |
| 1683 | } __ABI_PACKED; |
| 1684 | |
| 1685 | /* |
| 1686 | * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP |
| 1687 | * |
| 1688 | * zone: Number of thermal zone. |
| 1689 | */ |
| 1690 | struct cmd_thermal_get_temp_request { |
| 1691 | uint32_t zone; |
| 1692 | } __ABI_PACKED; |
| 1693 | |
| 1694 | /* |
| 1695 | * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP |
| 1696 | * |
| 1697 | * error: 0 if request succeeded. |
| 1698 | * -BPMP_EINVAL if request parameters were invalid. |
| 1699 | * -BPMP_ENOENT if no driver was registered for the specified thermal zone. |
| 1700 | * -BPMP_EFAULT for other thermal zone driver errors. |
| 1701 | * temp: Current temperature in millicelsius. |
| 1702 | */ |
| 1703 | struct cmd_thermal_get_temp_response { |
| 1704 | int32_t temp; |
| 1705 | } __ABI_PACKED; |
| 1706 | |
| 1707 | /* |
| 1708 | * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP |
| 1709 | * |
| 1710 | * zone: Number of thermal zone. |
| 1711 | * low: Temperature of lower trip point in millicelsius |
| 1712 | * high: Temperature of upper trip point in millicelsius |
| 1713 | * enabled: 1 to enable trip point, 0 to disable trip point |
| 1714 | */ |
| 1715 | struct cmd_thermal_set_trip_request { |
| 1716 | uint32_t zone; |
| 1717 | int32_t low; |
| 1718 | int32_t high; |
| 1719 | uint32_t enabled; |
| 1720 | } __ABI_PACKED; |
| 1721 | |
| 1722 | /* |
| 1723 | * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED |
| 1724 | * |
| 1725 | * zone: Number of thermal zone where trip point was reached. |
| 1726 | */ |
| 1727 | struct cmd_thermal_host_trip_reached_request { |
| 1728 | uint32_t zone; |
| 1729 | } __ABI_PACKED; |
| 1730 | |
| 1731 | /* |
| 1732 | * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES |
| 1733 | * |
| 1734 | * num: Number of supported thermal zones. The thermal zones are indexed |
| 1735 | * starting from zero. |
| 1736 | */ |
| 1737 | struct cmd_thermal_get_num_zones_response { |
| 1738 | uint32_t num; |
| 1739 | } __ABI_PACKED; |
| 1740 | |
| 1741 | /* |
| 1742 | * Host->BPMP request data. |
| 1743 | * |
| 1744 | * Reply type is union mrq_thermal_bpmp_to_host_response. |
| 1745 | * |
| 1746 | * type: Type of request. Values listed in enum mrq_thermal_type. |
| 1747 | * data: Request type specific parameters. |
| 1748 | */ |
| 1749 | struct mrq_thermal_host_to_bpmp_request { |
| 1750 | uint32_t type; |
| 1751 | union { |
| 1752 | struct cmd_thermal_query_abi_request query_abi; |
| 1753 | struct cmd_thermal_get_temp_request get_temp; |
| 1754 | struct cmd_thermal_set_trip_request set_trip; |
| 1755 | } __UNION_ANON; |
| 1756 | } __ABI_PACKED; |
| 1757 | |
| 1758 | /* |
| 1759 | * BPMP->Host request data. |
| 1760 | * |
| 1761 | * type: Type of request. Values listed in enum mrq_thermal_type. |
| 1762 | * data: Request type specific parameters. |
| 1763 | */ |
| 1764 | struct mrq_thermal_bpmp_to_host_request { |
| 1765 | uint32_t type; |
| 1766 | union { |
| 1767 | struct cmd_thermal_host_trip_reached_request host_trip_reached; |
| 1768 | } __UNION_ANON; |
| 1769 | } __ABI_PACKED; |
| 1770 | |
| 1771 | /* |
| 1772 | * Data in reply to a Host->BPMP request. |
| 1773 | */ |
| 1774 | union mrq_thermal_bpmp_to_host_response { |
| 1775 | struct cmd_thermal_get_temp_response get_temp; |
| 1776 | struct cmd_thermal_get_num_zones_response get_num_zones; |
| 1777 | } __ABI_PACKED; |
| 1778 | /** @} */ |
| 1779 | |
| 1780 | /** |
| 1781 | * @ingroup MRQ_Codes |
| 1782 | * @def MRQ_CPU_VHINT |
| 1783 | * @brief Query CPU voltage hint data |
| 1784 | * |
| 1785 | * * Platforms: T186 |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1786 | * @cond bpmp_t186 |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1787 | * * Initiators: CCPLEX |
| 1788 | * * Targets: BPMP |
| 1789 | * * Request Payload: @ref mrq_cpu_vhint_request |
| 1790 | * * Response Payload: N/A |
| 1791 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1792 | * @addtogroup Vhint |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1793 | * @{ |
| 1794 | */ |
| 1795 | |
| 1796 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1797 | * @brief Request with #MRQ_CPU_VHINT |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1798 | * |
| 1799 | * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data |
| 1800 | * from BPMP to memory space pointed by #addr. CCPLEX is responsible |
| 1801 | * to allocate sizeof(cpu_vhint_data) sized block of memory and |
| 1802 | * appropriately map it for BPMP before sending the request. |
| 1803 | */ |
| 1804 | struct mrq_cpu_vhint_request { |
| 1805 | /** @brief IOVA address for the #cpu_vhint_data */ |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1806 | uint32_t addr; |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1807 | /** @brief ID of the cluster whose data is requested */ |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1808 | uint32_t cluster_id; |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1809 | } __ABI_PACKED; |
| 1810 | |
| 1811 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1812 | * @brief Description of the CPU v/f relation |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1813 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1814 | * Used by #MRQ_CPU_VHINT call to carry data pointed by |
| 1815 | * #mrq_cpu_vhint_request::addr |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1816 | */ |
| 1817 | struct cpu_vhint_data { |
| 1818 | uint32_t ref_clk_hz; /**< reference frequency in Hz */ |
| 1819 | uint16_t pdiv; /**< post divider value */ |
| 1820 | uint16_t mdiv; /**< input divider value */ |
| 1821 | uint16_t ndiv_max; /**< fMAX expressed with max NDIV value */ |
| 1822 | /** table of ndiv values as a function of vINDEX (voltage index) */ |
| 1823 | uint16_t ndiv[80]; |
| 1824 | /** minimum allowed NDIV value */ |
| 1825 | uint16_t ndiv_min; |
| 1826 | /** minimum allowed voltage hint value (as in vINDEX) */ |
| 1827 | uint16_t vfloor; |
| 1828 | /** maximum allowed voltage hint value (as in vINDEX) */ |
| 1829 | uint16_t vceil; |
| 1830 | /** post-multiplier for vindex value */ |
| 1831 | uint16_t vindex_mult; |
| 1832 | /** post-divider for vindex value */ |
| 1833 | uint16_t vindex_div; |
| 1834 | /** reserved for future use */ |
| 1835 | uint16_t reserved[328]; |
| 1836 | } __ABI_PACKED; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1837 | /** @endcond */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1838 | /** @} */ |
| 1839 | |
| 1840 | /** |
| 1841 | * @ingroup MRQ_Codes |
| 1842 | * @def MRQ_ABI_RATCHET |
| 1843 | * @brief ABI ratchet value query |
| 1844 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1845 | * * Platforms: T186, T194 |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1846 | * * Initiators: Any |
| 1847 | * * Targets: BPMP |
| 1848 | * * Request Payload: @ref mrq_abi_ratchet_request |
| 1849 | * * Response Payload: @ref mrq_abi_ratchet_response |
| 1850 | * @addtogroup ABI_info |
| 1851 | * @{ |
| 1852 | */ |
| 1853 | |
| 1854 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1855 | * @brief An ABI compatibility mechanism |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1856 | * |
| 1857 | * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future |
| 1858 | * revision of this header file. |
| 1859 | * 1. That future revision deprecates some MRQ |
| 1860 | * 2. That future revision introduces a breaking change to an existing |
| 1861 | * MRQ or |
| 1862 | * 3. A bug is discovered in an existing implementation of the BPMP-FW |
| 1863 | * (or possibly one of its clients) which warrants deprecating that |
| 1864 | * implementation. |
| 1865 | */ |
| 1866 | #define BPMP_ABI_RATCHET_VALUE 3 |
| 1867 | |
| 1868 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1869 | * @brief Request with #MRQ_ABI_RATCHET. |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1870 | * |
| 1871 | * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header |
| 1872 | * against which the requester was compiled. |
| 1873 | * |
| 1874 | * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may |
| 1875 | * reply with mrq_response::err = -#BPMP_ERANGE to indicate that |
| 1876 | * BPMP-FW cannot interoperate correctly with the requester. Requester |
| 1877 | * should cease further communication with BPMP. |
| 1878 | * |
| 1879 | * Otherwise, err shall be 0. |
| 1880 | */ |
| 1881 | struct mrq_abi_ratchet_request { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1882 | /** @brief Requester's ratchet value */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1883 | uint16_t ratchet; |
| 1884 | }; |
| 1885 | |
| 1886 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1887 | * @brief Response to #MRQ_ABI_RATCHET |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1888 | * |
| 1889 | * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header |
| 1890 | * against which BPMP firwmare was compiled. |
| 1891 | * |
| 1892 | * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE, |
| 1893 | * the requster must either interoperate with BPMP according to an ABI |
| 1894 | * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease |
| 1895 | * communication with BPMP. |
| 1896 | * |
| 1897 | * If mrq_response::err is 0 and ratchet is greater than or equal to the |
| 1898 | * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue |
| 1899 | * normal operation. |
| 1900 | */ |
| 1901 | struct mrq_abi_ratchet_response { |
| 1902 | /** @brief BPMP's ratchet value */ |
| 1903 | uint16_t ratchet; |
| 1904 | }; |
| 1905 | /** @} */ |
| 1906 | |
| 1907 | /** |
| 1908 | * @ingroup MRQ_Codes |
| 1909 | * @def MRQ_EMC_DVFS_LATENCY |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1910 | * @brief Query frequency dependent EMC DVFS latency |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1911 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1912 | * * Platforms: T186, T194 |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1913 | * * Initiators: CCPLEX |
| 1914 | * * Targets: BPMP |
| 1915 | * * Request Payload: N/A |
| 1916 | * * Response Payload: @ref mrq_emc_dvfs_latency_response |
| 1917 | * @addtogroup EMC |
| 1918 | * @{ |
| 1919 | */ |
| 1920 | |
| 1921 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1922 | * @brief Used by @ref mrq_emc_dvfs_latency_response |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1923 | */ |
| 1924 | struct emc_dvfs_latency { |
| 1925 | /** @brief EMC frequency in kHz */ |
| 1926 | uint32_t freq; |
| 1927 | /** @brief EMC DVFS latency in nanoseconds */ |
| 1928 | uint32_t latency; |
| 1929 | } __ABI_PACKED; |
| 1930 | |
| 1931 | #define EMC_DVFS_LATENCY_MAX_SIZE 14 |
| 1932 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1933 | * @brief Response to #MRQ_EMC_DVFS_LATENCY |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1934 | */ |
| 1935 | struct mrq_emc_dvfs_latency_response { |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1936 | /** @brief The number valid entries in #pairs */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 1937 | uint32_t num_pairs; |
| 1938 | /** @brief EMC <frequency, latency> information */ |
| 1939 | struct emc_dvfs_latency pairs[EMC_DVFS_LATENCY_MAX_SIZE]; |
| 1940 | } __ABI_PACKED; |
| 1941 | |
| 1942 | /** @} */ |
| 1943 | |
| 1944 | /** |
| 1945 | * @ingroup MRQ_Codes |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 1946 | * @def MRQ_CPU_NDIV_LIMITS |
| 1947 | * @brief CPU freq. limits in ndiv |
| 1948 | * |
| 1949 | * * Platforms: T194 onwards |
| 1950 | * @cond bpmp_t194 |
| 1951 | * * Initiators: CCPLEX |
| 1952 | * * Targets: BPMP |
| 1953 | * * Request Payload: @ref mrq_cpu_ndiv_limits_request |
| 1954 | * * Response Payload: @ref mrq_cpu_ndiv_limits_response |
| 1955 | * @addtogroup CPU |
| 1956 | * @{ |
| 1957 | */ |
| 1958 | |
| 1959 | /** |
| 1960 | * @brief Request for ndiv limits of a cluster |
| 1961 | */ |
| 1962 | struct mrq_cpu_ndiv_limits_request { |
| 1963 | /** @brief Enum cluster_id */ |
| 1964 | uint32_t cluster_id; |
| 1965 | } __ABI_PACKED; |
| 1966 | |
| 1967 | /** |
| 1968 | * @brief Response to #MRQ_CPU_NDIV_LIMITS |
| 1969 | */ |
| 1970 | struct mrq_cpu_ndiv_limits_response { |
| 1971 | /** @brief Reference frequency in Hz */ |
| 1972 | uint32_t ref_clk_hz; |
| 1973 | /** @brief Post divider value */ |
| 1974 | uint16_t pdiv; |
| 1975 | /** @brief Input divider value */ |
| 1976 | uint16_t mdiv; |
| 1977 | /** @brief FMAX expressed with max NDIV value */ |
| 1978 | uint16_t ndiv_max; |
| 1979 | /** @brief Minimum allowed NDIV value */ |
| 1980 | uint16_t ndiv_min; |
| 1981 | } __ABI_PACKED; |
| 1982 | |
| 1983 | /** @} */ |
| 1984 | /** @endcond */ |
| 1985 | |
| 1986 | /** |
| 1987 | * @ingroup MRQ_Codes |
| 1988 | * @def MRQ_CPU_AUTO_CC3 |
| 1989 | * @brief Query CPU cluster auto-CC3 configuration |
| 1990 | * |
| 1991 | * * Platforms: T194 onwards |
| 1992 | * @cond bpmp_t194 |
| 1993 | * * Initiators: CCPLEX |
| 1994 | * * Targets: BPMP |
| 1995 | * * Request Payload: @ref mrq_cpu_auto_cc3_request |
| 1996 | * * Response Payload: @ref mrq_cpu_auto_cc3_response |
| 1997 | * @addtogroup CC3 |
| 1998 | * |
| 1999 | * Queries from BPMP auto-CC3 configuration (allowed/not allowed) for a |
| 2000 | * specified cluster. CCPLEX s/w uses this information to override its own |
| 2001 | * device tree auto-CC3 settings, so that BPMP device tree is a single source of |
| 2002 | * auto-CC3 platform configuration. |
| 2003 | * |
| 2004 | * @{ |
| 2005 | */ |
| 2006 | |
| 2007 | /** |
| 2008 | * @brief Request for auto-CC3 configuration of a cluster |
| 2009 | */ |
| 2010 | struct mrq_cpu_auto_cc3_request { |
| 2011 | /** @brief Enum cluster_id (logical cluster id, known to CCPLEX s/w) */ |
| 2012 | uint32_t cluster_id; |
| 2013 | } __ABI_PACKED; |
| 2014 | |
| 2015 | /** |
| 2016 | * @brief Response to #MRQ_CPU_AUTO_CC3 |
| 2017 | */ |
| 2018 | struct mrq_cpu_auto_cc3_response { |
| 2019 | /** |
| 2020 | * @brief auto-CC3 configuration |
| 2021 | * |
| 2022 | * - bits[31..10] reserved. |
| 2023 | * - bits[9..1] cc3 ndiv |
| 2024 | * - bit [0] if "1" auto-CC3 is allowed, if "0" auto-CC3 is not allowed |
| 2025 | */ |
| 2026 | uint32_t auto_cc3_config; |
| 2027 | } __ABI_PACKED; |
| 2028 | |
| 2029 | /** @} */ |
| 2030 | /** @endcond */ |
| 2031 | |
| 2032 | /** |
| 2033 | * @ingroup MRQ_Codes |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2034 | * @def MRQ_TRACE_ITER |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2035 | * @brief Manage the trace iterator |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2036 | * |
| 2037 | * * Platforms: All |
| 2038 | * * Initiators: CCPLEX |
| 2039 | * * Targets: BPMP |
| 2040 | * * Request Payload: N/A |
| 2041 | * * Response Payload: @ref mrq_trace_iter_request |
| 2042 | * @addtogroup Trace |
| 2043 | * @{ |
| 2044 | */ |
| 2045 | enum { |
| 2046 | /** @brief (re)start the tracing now. Ignore older events */ |
| 2047 | TRACE_ITER_INIT = 0, |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2048 | /** @brief Clobber all events in the trace buffer */ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2049 | TRACE_ITER_CLEAN = 1 |
| 2050 | }; |
| 2051 | |
| 2052 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2053 | * @brief Request with #MRQ_TRACE_ITER |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2054 | */ |
| 2055 | struct mrq_trace_iter_request { |
| 2056 | /** @brief TRACE_ITER_INIT or TRACE_ITER_CLEAN */ |
| 2057 | uint32_t cmd; |
| 2058 | } __ABI_PACKED; |
| 2059 | |
| 2060 | /** @} */ |
| 2061 | |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 2062 | /** |
| 2063 | * @ingroup MRQ_Codes |
| 2064 | * @def MRQ_RINGBUF_CONSOLE |
| 2065 | * @brief A ring buffer debug console for BPMP |
| 2066 | * @addtogroup RingbufConsole |
| 2067 | * |
| 2068 | * The ring buffer debug console aims to be a substitute for the UART debug |
| 2069 | * console. The debug console is implemented with two ring buffers in the |
| 2070 | * BPMP-FW, the RX (receive) and TX (transmit) buffers. Characters can be read |
| 2071 | * and written to the buffers by the host via the MRQ interface. |
| 2072 | * |
| 2073 | * @{ |
| 2074 | */ |
| 2075 | |
| 2076 | /** |
| 2077 | * @brief Maximum number of bytes transferred in a single write command to the |
| 2078 | * BPMP |
| 2079 | * |
| 2080 | * This is determined by the number of free bytes in the message struct, |
| 2081 | * rounded down to a multiple of four. |
| 2082 | */ |
| 2083 | #define MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN 112 |
| 2084 | |
| 2085 | /** |
| 2086 | * @brief Maximum number of bytes transferred in a single read command to the |
| 2087 | * BPMP |
| 2088 | * |
| 2089 | * This is determined by the number of free bytes in the message struct, |
| 2090 | * rounded down to a multiple of four. |
| 2091 | */ |
| 2092 | #define MRQ_RINGBUF_CONSOLE_MAX_READ_LEN 116 |
| 2093 | |
| 2094 | enum mrq_ringbuf_console_host_to_bpmp_cmd { |
| 2095 | /** |
| 2096 | * @brief Check whether the BPMP driver supports the specified request |
| 2097 | * type |
| 2098 | * |
| 2099 | * mrq_response::err is 0 if the specified request is supported and |
| 2100 | * -#BPMP_ENODEV otherwise |
| 2101 | */ |
| 2102 | CMD_RINGBUF_CONSOLE_QUERY_ABI = 0, |
| 2103 | /** |
| 2104 | * @brief Perform a read operation on the BPMP TX buffer |
| 2105 | * |
| 2106 | * mrq_response::err is 0 |
| 2107 | */ |
| 2108 | CMD_RINGBUF_CONSOLE_READ = 1, |
| 2109 | /** |
| 2110 | * @brief Perform a write operation on the BPMP RX buffer |
| 2111 | * |
| 2112 | * mrq_response::err is 0 if the operation was successful and |
| 2113 | * -#BPMP_ENODEV otherwise |
| 2114 | */ |
| 2115 | CMD_RINGBUF_CONSOLE_WRITE = 2, |
| 2116 | /** |
| 2117 | * @brief Get the length of the buffer and the physical addresses of |
| 2118 | * the buffer data and the head and tail counters |
| 2119 | * |
| 2120 | * mrq_response::err is 0 if the operation was successful and |
| 2121 | * -#BPMP_ENODEV otherwise |
| 2122 | */ |
| 2123 | CMD_RINGBUF_CONSOLE_GET_FIFO = 3, |
| 2124 | }; |
| 2125 | |
| 2126 | /** |
| 2127 | * @ingroup RingbufConsole |
| 2128 | * @brief Host->BPMP request data for request type |
| 2129 | * #CMD_RINGBUF_CONSOLE_QUERY_ABI |
| 2130 | */ |
| 2131 | struct cmd_ringbuf_console_query_abi_req { |
| 2132 | /** @brief Command identifier to be queried */ |
| 2133 | uint32_t cmd; |
| 2134 | } __ABI_PACKED; |
| 2135 | |
| 2136 | /** @private */ |
| 2137 | struct cmd_ringbuf_console_query_abi_resp { |
| 2138 | EMPTY |
| 2139 | } __ABI_PACKED; |
| 2140 | |
| 2141 | /** |
| 2142 | * @ingroup RingbufConsole |
| 2143 | * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_READ |
| 2144 | */ |
| 2145 | struct cmd_ringbuf_console_read_req { |
| 2146 | /** |
| 2147 | * @brief Number of bytes requested to be read from the BPMP TX buffer |
| 2148 | */ |
| 2149 | uint8_t len; |
| 2150 | } __ABI_PACKED; |
| 2151 | |
| 2152 | /** |
| 2153 | * @ingroup RingbufConsole |
| 2154 | * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_READ |
| 2155 | */ |
| 2156 | struct cmd_ringbuf_console_read_resp { |
| 2157 | /** @brief The actual data read from the BPMP TX buffer */ |
| 2158 | uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_READ_LEN]; |
| 2159 | /** @brief Number of bytes in cmd_ringbuf_console_read_resp::data */ |
| 2160 | uint8_t len; |
| 2161 | } __ABI_PACKED; |
| 2162 | |
| 2163 | /** |
| 2164 | * @ingroup RingbufConsole |
| 2165 | * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_WRITE |
| 2166 | */ |
| 2167 | struct cmd_ringbuf_console_write_req { |
| 2168 | /** @brief The actual data to be written to the BPMP RX buffer */ |
| 2169 | uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN]; |
| 2170 | /** @brief Number of bytes in cmd_ringbuf_console_write_req::data */ |
| 2171 | uint8_t len; |
| 2172 | } __ABI_PACKED; |
| 2173 | |
| 2174 | /** |
| 2175 | * @ingroup RingbufConsole |
| 2176 | * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_WRITE |
| 2177 | */ |
| 2178 | struct cmd_ringbuf_console_write_resp { |
| 2179 | /** @brief Number of bytes of available space in the BPMP RX buffer */ |
| 2180 | uint32_t space_avail; |
| 2181 | /** @brief Number of bytes that were written to the BPMP RX buffer */ |
| 2182 | uint8_t len; |
| 2183 | } __ABI_PACKED; |
| 2184 | |
| 2185 | /** @private */ |
| 2186 | struct cmd_ringbuf_console_get_fifo_req { |
| 2187 | EMPTY |
| 2188 | } __ABI_PACKED; |
| 2189 | |
| 2190 | /** |
| 2191 | * @ingroup RingbufConsole |
| 2192 | * @brief BPMP->Host reply data for request type #CMD_RINGBUF_CONSOLE_GET_FIFO |
| 2193 | */ |
| 2194 | struct cmd_ringbuf_console_get_fifo_resp { |
| 2195 | /** @brief Physical address of the BPMP TX buffer */ |
| 2196 | uint64_t bpmp_tx_buf_addr; |
| 2197 | /** @brief Physical address of the BPMP TX buffer head counter */ |
| 2198 | uint64_t bpmp_tx_head_addr; |
| 2199 | /** @brief Physical address of the BPMP TX buffer tail counter */ |
| 2200 | uint64_t bpmp_tx_tail_addr; |
| 2201 | /** @brief Length of the BPMP TX buffer */ |
| 2202 | uint32_t bpmp_tx_buf_len; |
| 2203 | } __ABI_PACKED; |
| 2204 | |
| 2205 | /** |
| 2206 | * @ingroup RingbufConsole |
| 2207 | * @brief Host->BPMP request data. |
| 2208 | * |
| 2209 | * Reply type is union #mrq_ringbuf_console_bpmp_to_host_response . |
| 2210 | */ |
| 2211 | struct mrq_ringbuf_console_host_to_bpmp_request { |
| 2212 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2213 | * @brief Type of request. Values listed in enum |
Thierry Reding | 52b8b80 | 2017-03-29 18:34:51 +0200 | [diff] [blame] | 2214 | * #mrq_ringbuf_console_host_to_bpmp_cmd. |
| 2215 | */ |
| 2216 | uint32_t type; |
| 2217 | /** @brief request type specific parameters. */ |
| 2218 | union { |
| 2219 | struct cmd_ringbuf_console_query_abi_req query_abi; |
| 2220 | struct cmd_ringbuf_console_read_req read; |
| 2221 | struct cmd_ringbuf_console_write_req write; |
| 2222 | struct cmd_ringbuf_console_get_fifo_req get_fifo; |
| 2223 | } __UNION_ANON; |
| 2224 | } __ABI_PACKED; |
| 2225 | |
| 2226 | /** |
| 2227 | * @ingroup RingbufConsole |
| 2228 | * @brief Host->BPMP reply data |
| 2229 | * |
| 2230 | * In response to struct #mrq_ringbuf_console_host_to_bpmp_request. |
| 2231 | */ |
| 2232 | union mrq_ringbuf_console_bpmp_to_host_response { |
| 2233 | struct cmd_ringbuf_console_query_abi_resp query_abi; |
| 2234 | struct cmd_ringbuf_console_read_resp read; |
| 2235 | struct cmd_ringbuf_console_write_resp write; |
| 2236 | struct cmd_ringbuf_console_get_fifo_resp get_fifo; |
| 2237 | } __ABI_PACKED; |
| 2238 | /** @} */ |
| 2239 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2240 | /** |
| 2241 | * @ingroup MRQ_Codes |
| 2242 | * @def MRQ_STRAP |
| 2243 | * @brief Set a strap value controlled by BPMP |
| 2244 | * |
| 2245 | * * Platforms: T194 onwards |
| 2246 | * @cond bpmp_t194 |
| 2247 | * * Initiators: CCPLEX |
| 2248 | * * Targets: BPMP |
| 2249 | * * Request Payload: @ref mrq_strap_request |
| 2250 | * * Response Payload: N/A |
| 2251 | * @addtogroup Strap |
| 2252 | * |
| 2253 | * A strap is an input that is sampled by a hardware unit during the |
| 2254 | * unit's startup process. The sampled value of a strap affects the |
| 2255 | * behavior of the unit until the unit is restarted. Many hardware |
| 2256 | * units sample their straps at the instant that their resets are |
| 2257 | * deasserted. |
| 2258 | * |
| 2259 | * BPMP owns registers which act as straps to various units. It |
| 2260 | * exposes limited control of those straps via #MRQ_STRAP. |
| 2261 | * |
| 2262 | * @{ |
| 2263 | */ |
| 2264 | enum mrq_strap_cmd { |
| 2265 | /** @private */ |
| 2266 | STRAP_RESERVED = 0, |
| 2267 | /** @brief Set a strap value */ |
| 2268 | STRAP_SET = 1 |
| 2269 | }; |
| 2270 | |
| 2271 | /** |
| 2272 | * @brief Request with #MRQ_STRAP |
| 2273 | */ |
| 2274 | struct mrq_strap_request { |
| 2275 | /** @brief @ref mrq_strap_cmd */ |
| 2276 | uint32_t cmd; |
| 2277 | /** @brief Strap ID from @ref Strap_Ids */ |
| 2278 | uint32_t id; |
| 2279 | /** @brief Desired value for strap (if cmd is #STRAP_SET) */ |
| 2280 | uint32_t value; |
| 2281 | } __ABI_PACKED; |
| 2282 | |
| 2283 | /** |
| 2284 | * @defgroup Strap_Ids Strap Identifiers |
| 2285 | * @} |
| 2286 | */ |
| 2287 | /** @endcond */ |
| 2288 | |
| 2289 | /** |
| 2290 | * @ingroup MRQ_Codes |
| 2291 | * @def MRQ_UPHY |
| 2292 | * @brief Perform a UPHY operation |
| 2293 | * |
| 2294 | * * Platforms: T194 onwards |
| 2295 | * @cond bpmp_t194 |
| 2296 | * * Initiators: CCPLEX |
| 2297 | * * Targets: BPMP |
| 2298 | * * Request Payload: @ref mrq_uphy_request |
| 2299 | * * Response Payload: @ref mrq_uphy_response |
| 2300 | * |
| 2301 | * @addtogroup UPHY |
| 2302 | * @{ |
| 2303 | */ |
| 2304 | enum { |
| 2305 | CMD_UPHY_PCIE_LANE_MARGIN_CONTROL = 1, |
| 2306 | CMD_UPHY_PCIE_LANE_MARGIN_STATUS = 2, |
| 2307 | CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT = 3, |
| 2308 | CMD_UPHY_PCIE_CONTROLLER_STATE = 4, |
Vidya Sagar | ee22d0c | 2020-03-03 23:40:48 +0530 | [diff] [blame] | 2309 | CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF = 5, |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2310 | CMD_UPHY_MAX, |
| 2311 | }; |
| 2312 | |
| 2313 | struct cmd_uphy_margin_control_request { |
| 2314 | /** @brief Enable margin */ |
| 2315 | int32_t en; |
| 2316 | /** @brief Clear the number of error and sections */ |
| 2317 | int32_t clr; |
| 2318 | /** @brief Set x offset (1's complement) for left/right margin type (y should be 0) */ |
| 2319 | uint32_t x; |
| 2320 | /** @brief Set y offset (1's complement) for left/right margin type (x should be 0) */ |
| 2321 | uint32_t y; |
| 2322 | /** @brief Set number of bit blocks for each margin section */ |
| 2323 | uint32_t nblks; |
| 2324 | } __ABI_PACKED; |
| 2325 | |
| 2326 | struct cmd_uphy_margin_status_response { |
| 2327 | /** @brief Number of errors observed */ |
| 2328 | uint32_t status; |
| 2329 | } __ABI_PACKED; |
| 2330 | |
| 2331 | struct cmd_uphy_ep_controller_pll_init_request { |
| 2332 | /** @brief EP controller number, valid: 0, 4, 5 */ |
| 2333 | uint8_t ep_controller; |
| 2334 | } __ABI_PACKED; |
| 2335 | |
| 2336 | struct cmd_uphy_pcie_controller_state_request { |
| 2337 | /** @brief PCIE controller number, valid: 0, 1, 2, 3, 4 */ |
| 2338 | uint8_t pcie_controller; |
| 2339 | uint8_t enable; |
| 2340 | } __ABI_PACKED; |
| 2341 | |
Vidya Sagar | ee22d0c | 2020-03-03 23:40:48 +0530 | [diff] [blame] | 2342 | struct cmd_uphy_ep_controller_pll_off_request { |
| 2343 | /** @brief EP controller number, valid: 0, 4, 5 */ |
| 2344 | uint8_t ep_controller; |
| 2345 | } __ABI_PACKED; |
| 2346 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2347 | /** |
| 2348 | * @ingroup UPHY |
| 2349 | * @brief Request with #MRQ_UPHY |
| 2350 | * |
| 2351 | * Used by the sender of an #MRQ_UPHY message to control UPHY Lane RX margining. |
| 2352 | * The uphy_request is split into several sub-commands. Some sub-commands |
| 2353 | * require no additional data. Others have a sub-command specific payload |
| 2354 | * |
| 2355 | * |sub-command |payload | |
| 2356 | * |------------------------------------ |----------------------------------------| |
| 2357 | * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL |uphy_set_margin_control | |
| 2358 | * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS | | |
| 2359 | * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT |cmd_uphy_ep_controller_pll_init_request | |
| 2360 | * |CMD_UPHY_PCIE_CONTROLLER_STATE |cmd_uphy_pcie_controller_state_request | |
Vidya Sagar | ee22d0c | 2020-03-03 23:40:48 +0530 | [diff] [blame] | 2361 | * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF |cmd_uphy_ep_controller_pll_off_request | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2362 | * |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2363 | */ |
| 2364 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2365 | struct mrq_uphy_request { |
| 2366 | /** @brief Lane number. */ |
| 2367 | uint16_t lane; |
| 2368 | /** @brief Sub-command id. */ |
| 2369 | uint16_t cmd; |
| 2370 | |
| 2371 | union { |
| 2372 | struct cmd_uphy_margin_control_request uphy_set_margin_control; |
| 2373 | struct cmd_uphy_ep_controller_pll_init_request ep_ctrlr_pll_init; |
| 2374 | struct cmd_uphy_pcie_controller_state_request controller_state; |
Vidya Sagar | ee22d0c | 2020-03-03 23:40:48 +0530 | [diff] [blame] | 2375 | struct cmd_uphy_ep_controller_pll_off_request ep_ctrlr_pll_off; |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2376 | } __UNION_ANON; |
| 2377 | } __ABI_PACKED; |
| 2378 | |
| 2379 | /** |
| 2380 | * @ingroup UPHY |
| 2381 | * @brief Response to MRQ_UPHY |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2382 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2383 | * Each sub-command supported by @ref mrq_uphy_request may return |
| 2384 | * sub-command-specific data. Some do and some do not as indicated in |
| 2385 | * the following table |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2386 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2387 | * |sub-command |payload | |
| 2388 | * |---------------------------- |------------------------| |
| 2389 | * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL | | |
| 2390 | * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS |uphy_get_margin_status | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2391 | * |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2392 | */ |
| 2393 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2394 | struct mrq_uphy_response { |
| 2395 | union { |
| 2396 | struct cmd_uphy_margin_status_response uphy_get_margin_status; |
| 2397 | } __UNION_ANON; |
| 2398 | } __ABI_PACKED; |
| 2399 | |
| 2400 | /** @} */ |
| 2401 | /** @endcond */ |
| 2402 | |
| 2403 | /** |
| 2404 | * @ingroup MRQ_Codes |
| 2405 | * @def MRQ_FMON |
| 2406 | * @brief Perform a frequency monitor configuration operations |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2407 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2408 | * * Platforms: T194 onwards |
| 2409 | * @cond bpmp_t194 |
| 2410 | * * Initiators: CCPLEX |
| 2411 | * * Targets: BPMP |
| 2412 | * * Request Payload: @ref mrq_fmon_request |
| 2413 | * * Response Payload: @ref mrq_fmon_response |
| 2414 | * |
| 2415 | * @addtogroup FMON |
| 2416 | * @{ |
| 2417 | */ |
| 2418 | enum { |
| 2419 | /** |
| 2420 | * @brief Clamp FMON configuration to specified rate. |
| 2421 | * |
| 2422 | * The monitored clock must be running for clamp to succeed. If |
| 2423 | * clamped, FMON configuration is preserved when clock rate |
| 2424 | * and/or state is changed. |
| 2425 | */ |
| 2426 | CMD_FMON_GEAR_CLAMP = 1, |
| 2427 | /** |
| 2428 | * @brief Release clamped FMON configuration. |
| 2429 | * |
| 2430 | * Allow FMON configuration to follow monitored clock rate |
| 2431 | * and/or state changes. |
| 2432 | */ |
| 2433 | CMD_FMON_GEAR_FREE = 2, |
| 2434 | /** |
| 2435 | * @brief Return rate FMON is clamped at, or 0 if FMON is not |
| 2436 | * clamped. |
| 2437 | * |
| 2438 | * Inherently racy, since clamp state can be changed |
| 2439 | * concurrently. Useful for testing. |
| 2440 | */ |
| 2441 | CMD_FMON_GEAR_GET = 3, |
| 2442 | CMD_FMON_NUM, |
| 2443 | }; |
| 2444 | |
| 2445 | struct cmd_fmon_gear_clamp_request { |
| 2446 | int32_t unused; |
| 2447 | int64_t rate; |
| 2448 | } __ABI_PACKED; |
| 2449 | |
| 2450 | /** @private */ |
| 2451 | struct cmd_fmon_gear_clamp_response { |
| 2452 | EMPTY |
| 2453 | } __ABI_PACKED; |
| 2454 | |
| 2455 | /** @private */ |
| 2456 | struct cmd_fmon_gear_free_request { |
| 2457 | EMPTY |
| 2458 | } __ABI_PACKED; |
| 2459 | |
| 2460 | /** @private */ |
| 2461 | struct cmd_fmon_gear_free_response { |
| 2462 | EMPTY |
| 2463 | } __ABI_PACKED; |
| 2464 | |
| 2465 | /** @private */ |
| 2466 | struct cmd_fmon_gear_get_request { |
| 2467 | EMPTY |
| 2468 | } __ABI_PACKED; |
| 2469 | |
| 2470 | struct cmd_fmon_gear_get_response { |
| 2471 | int64_t rate; |
| 2472 | } __ABI_PACKED; |
| 2473 | |
| 2474 | /** |
| 2475 | * @ingroup FMON |
| 2476 | * @brief Request with #MRQ_FMON |
| 2477 | * |
| 2478 | * Used by the sender of an #MRQ_FMON message to configure clock |
| 2479 | * frequency monitors. The FMON request is split into several |
| 2480 | * sub-commands. Some sub-commands require no additional data. |
| 2481 | * Others have a sub-command specific payload |
| 2482 | * |
| 2483 | * |sub-command |payload | |
| 2484 | * |----------------------------|-----------------------| |
| 2485 | * |CMD_FMON_GEAR_CLAMP |fmon_gear_clamp | |
| 2486 | * |CMD_FMON_GEAR_FREE |- | |
| 2487 | * |CMD_FMON_GEAR_GET |- | |
| 2488 | * |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2489 | */ |
| 2490 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2491 | struct mrq_fmon_request { |
| 2492 | /** @brief Sub-command and clock id concatenated to 32-bit word. |
| 2493 | * - bits[31..24] is the sub-cmd. |
| 2494 | * - bits[23..0] is monitored clock id used to select target |
| 2495 | * FMON |
| 2496 | */ |
| 2497 | uint32_t cmd_and_id; |
| 2498 | |
| 2499 | union { |
| 2500 | struct cmd_fmon_gear_clamp_request fmon_gear_clamp; |
| 2501 | /** @private */ |
| 2502 | struct cmd_fmon_gear_free_request fmon_gear_free; |
| 2503 | /** @private */ |
| 2504 | struct cmd_fmon_gear_get_request fmon_gear_get; |
| 2505 | } __UNION_ANON; |
| 2506 | } __ABI_PACKED; |
| 2507 | |
| 2508 | /** |
| 2509 | * @ingroup FMON |
| 2510 | * @brief Response to MRQ_FMON |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2511 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2512 | * Each sub-command supported by @ref mrq_fmon_request may |
| 2513 | * return sub-command-specific data as indicated below. |
| 2514 | * |
| 2515 | * |sub-command |payload | |
| 2516 | * |----------------------------|------------------------| |
| 2517 | * |CMD_FMON_GEAR_CLAMP |- | |
| 2518 | * |CMD_FMON_GEAR_FREE |- | |
| 2519 | * |CMD_FMON_GEAR_GET |fmon_gear_get | |
| 2520 | * |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2521 | */ |
| 2522 | |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2523 | struct mrq_fmon_response { |
| 2524 | union { |
| 2525 | /** @private */ |
| 2526 | struct cmd_fmon_gear_clamp_response fmon_gear_clamp; |
| 2527 | /** @private */ |
| 2528 | struct cmd_fmon_gear_free_response fmon_gear_free; |
| 2529 | struct cmd_fmon_gear_get_response fmon_gear_get; |
| 2530 | } __UNION_ANON; |
| 2531 | } __ABI_PACKED; |
| 2532 | |
| 2533 | /** @} */ |
| 2534 | /** @endcond */ |
| 2535 | |
| 2536 | /** |
| 2537 | * @ingroup MRQ_Codes |
| 2538 | * @def MRQ_EC |
| 2539 | * @brief Provide status information on faults reported by Error |
| 2540 | * Collator (EC) to HSM. |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2541 | * |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2542 | * * Platforms: T194 onwards |
| 2543 | * @cond bpmp_t194 |
| 2544 | * * Initiators: CCPLEX |
| 2545 | * * Targets: BPMP |
| 2546 | * * Request Payload: @ref mrq_ec_request |
| 2547 | * * Response Payload: @ref mrq_ec_response |
| 2548 | * |
| 2549 | * @note This MRQ ABI is under construction, and subject to change |
| 2550 | * |
| 2551 | * @addtogroup EC |
| 2552 | * @{ |
| 2553 | */ |
| 2554 | enum { |
| 2555 | /** |
| 2556 | * @brief Retrieve specified EC status. |
| 2557 | * |
| 2558 | * mrq_response::err is 0 if the operation was successful, or @n |
| 2559 | * -#BPMP_ENODEV if target EC is not owned by BPMP @n |
| 2560 | * -#BPMP_EACCES if target EC power domain is turned off |
| 2561 | */ |
| 2562 | CMD_EC_STATUS_GET = 1, |
| 2563 | CMD_EC_NUM, |
| 2564 | }; |
| 2565 | |
| 2566 | /** @brief BPMP ECs error types */ |
| 2567 | enum bpmp_ec_err_type { |
| 2568 | /** @brief Parity error on internal data path |
| 2569 | * |
| 2570 | * Error descriptor @ref ec_err_simple_desc. |
| 2571 | */ |
| 2572 | EC_ERR_TYPE_PARITY_INTERNAL = 1, |
| 2573 | |
| 2574 | /** @brief ECC SEC error on internal data path |
| 2575 | * |
| 2576 | * Error descriptor @ref ec_err_simple_desc. |
| 2577 | */ |
| 2578 | EC_ERR_TYPE_ECC_SEC_INTERNAL = 2, |
| 2579 | |
| 2580 | /** @brief ECC DED error on internal data path |
| 2581 | * |
| 2582 | * Error descriptor @ref ec_err_simple_desc. |
| 2583 | */ |
| 2584 | EC_ERR_TYPE_ECC_DED_INTERNAL = 3, |
| 2585 | |
| 2586 | /** @brief Comparator error |
| 2587 | * |
| 2588 | * Error descriptor @ref ec_err_simple_desc. |
| 2589 | */ |
| 2590 | EC_ERR_TYPE_COMPARATOR = 4, |
| 2591 | |
| 2592 | /** @brief Register parity error |
| 2593 | * |
| 2594 | * Error descriptor @ref ec_err_reg_parity_desc. |
| 2595 | */ |
| 2596 | EC_ERR_TYPE_REGISTER_PARITY = 5, |
| 2597 | |
| 2598 | /** @brief Parity error from on-chip SRAM/FIFO |
| 2599 | * |
| 2600 | * Error descriptor @ref ec_err_simple_desc. |
| 2601 | */ |
| 2602 | EC_ERR_TYPE_PARITY_SRAM = 6, |
| 2603 | |
| 2604 | /** @brief Clock Monitor error |
| 2605 | * |
| 2606 | * Error descriptor @ref ec_err_fmon_desc. |
| 2607 | */ |
| 2608 | EC_ERR_TYPE_CLOCK_MONITOR = 9, |
| 2609 | |
| 2610 | /** @brief Voltage Monitor error |
| 2611 | * |
| 2612 | * Error descriptor @ref ec_err_vmon_desc. |
| 2613 | */ |
| 2614 | EC_ERR_TYPE_VOLTAGE_MONITOR = 10, |
| 2615 | |
| 2616 | /** @brief SW Correctable error |
| 2617 | * |
| 2618 | * Error descriptor @ref ec_err_simple_desc. |
| 2619 | */ |
| 2620 | EC_ERR_TYPE_SW_CORRECTABLE = 16, |
| 2621 | |
| 2622 | /** @brief SW Uncorrectable error |
| 2623 | * |
| 2624 | * Error descriptor @ref ec_err_simple_desc. |
| 2625 | */ |
| 2626 | EC_ERR_TYPE_SW_UNCORRECTABLE = 17, |
| 2627 | |
| 2628 | /** @brief Other HW Correctable error |
| 2629 | * |
| 2630 | * Error descriptor @ref ec_err_simple_desc. |
| 2631 | */ |
| 2632 | EC_ERR_TYPE_OTHER_HW_CORRECTABLE = 32, |
| 2633 | |
| 2634 | /** @brief Other HW Uncorrectable error |
| 2635 | * |
| 2636 | * Error descriptor @ref ec_err_simple_desc. |
| 2637 | */ |
| 2638 | EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE = 33, |
| 2639 | }; |
| 2640 | |
| 2641 | /** @brief Group of registers with parity error. */ |
| 2642 | enum ec_registers_group { |
| 2643 | /** @brief Functional registers group */ |
| 2644 | EC_ERR_GROUP_FUNC_REG = 0, |
| 2645 | /** @brief SCR registers group */ |
| 2646 | EC_ERR_GROUP_SCR_REG = 1, |
| 2647 | }; |
| 2648 | |
| 2649 | /** |
| 2650 | * @defgroup bpmp_ec_status_flags EC Status Flags |
| 2651 | * @addtogroup bpmp_ec_status_flags |
| 2652 | * @{ |
| 2653 | */ |
| 2654 | /** @brief No EC error found flag */ |
| 2655 | #define EC_STATUS_FLAG_NO_ERROR 0x0001 |
| 2656 | /** @brief Last EC error found flag */ |
| 2657 | #define EC_STATUS_FLAG_LAST_ERROR 0x0002 |
| 2658 | /** @brief EC latent error flag */ |
| 2659 | #define EC_STATUS_FLAG_LATENT_ERROR 0x0004 |
| 2660 | /** @} */ |
| 2661 | |
| 2662 | /** |
| 2663 | * @defgroup bpmp_ec_desc_flags EC Descriptor Flags |
| 2664 | * @addtogroup bpmp_ec_desc_flags |
| 2665 | * @{ |
| 2666 | */ |
| 2667 | /** @brief EC descriptor error resolved flag */ |
| 2668 | #define EC_DESC_FLAG_RESOLVED 0x0001 |
| 2669 | /** @brief EC descriptor failed to retrieve id flag */ |
| 2670 | #define EC_DESC_FLAG_NO_ID 0x0002 |
| 2671 | /** @} */ |
| 2672 | |
| 2673 | /** |
| 2674 | * |error type | fmon_clk_id values | |
| 2675 | * |---------------------------------|---------------------------| |
| 2676 | * |@ref EC_ERR_TYPE_CLOCK_MONITOR |@ref bpmp_clock_ids | |
| 2677 | */ |
| 2678 | struct ec_err_fmon_desc { |
| 2679 | /** @brief Bitmask of @ref bpmp_ec_desc_flags */ |
| 2680 | uint16_t desc_flags; |
| 2681 | /** @brief FMON monitored clock id */ |
| 2682 | uint16_t fmon_clk_id; |
| 2683 | /** @brief Bitmask of @ref bpmp_fmon_faults_flags */ |
| 2684 | uint32_t fmon_faults; |
| 2685 | /** @brief FMON faults access error */ |
| 2686 | int32_t fmon_access_error; |
| 2687 | } __ABI_PACKED; |
| 2688 | |
| 2689 | /** |
| 2690 | * |error type | vmon_adc_id values | |
| 2691 | * |---------------------------------|---------------------------| |
| 2692 | * |@ref EC_ERR_TYPE_VOLTAGE_MONITOR |@ref bpmp_adc_ids | |
| 2693 | */ |
| 2694 | struct ec_err_vmon_desc { |
| 2695 | /** @brief Bitmask of @ref bpmp_ec_desc_flags */ |
| 2696 | uint16_t desc_flags; |
| 2697 | /** @brief VMON rail adc id */ |
| 2698 | uint16_t vmon_adc_id; |
| 2699 | /** @brief Bitmask of @ref bpmp_vmon_faults_flags */ |
| 2700 | uint32_t vmon_faults; |
| 2701 | /** @brief VMON faults access error */ |
| 2702 | int32_t vmon_access_error; |
| 2703 | } __ABI_PACKED; |
| 2704 | |
| 2705 | /** |
| 2706 | * |error type | reg_id values | |
| 2707 | * |---------------------------------|---------------------------| |
| 2708 | * |@ref EC_ERR_TYPE_REGISTER_PARITY |@ref bpmp_ec_registers_ids | |
| 2709 | */ |
| 2710 | struct ec_err_reg_parity_desc { |
| 2711 | /** @brief Bitmask of @ref bpmp_ec_desc_flags */ |
| 2712 | uint16_t desc_flags; |
| 2713 | /** @brief Register id */ |
| 2714 | uint16_t reg_id; |
| 2715 | /** @brief Register group @ref ec_registers_group */ |
| 2716 | uint16_t reg_group; |
| 2717 | } __ABI_PACKED; |
| 2718 | |
| 2719 | /** |
| 2720 | * |error type | err_source_id values | |
| 2721 | * |----------------------------------------|---------------------------| |
| 2722 | * |@ref EC_ERR_TYPE_PARITY_INTERNAL |@ref bpmp_ec_ipath_ids | |
| 2723 | * |@ref EC_ERR_TYPE_ECC_SEC_INTERNAL |@ref bpmp_ec_ipath_ids | |
| 2724 | * |@ref EC_ERR_TYPE_ECC_DED_INTERNAL |@ref bpmp_ec_ipath_ids | |
| 2725 | * |@ref EC_ERR_TYPE_COMPARATOR |@ref bpmp_ec_comparator_ids| |
| 2726 | * |@ref EC_ERR_TYPE_PARITY_SRAM |@ref bpmp_clock_ids | |
| 2727 | * |@ref EC_ERR_TYPE_SW_CORRECTABLE |@ref bpmp_ec_misc_ids | |
| 2728 | * |@ref EC_ERR_TYPE_SW_UNCORRECTABLE |@ref bpmp_ec_misc_ids | |
| 2729 | * |@ref EC_ERR_TYPE_OTHER_HW_CORRECTABLE |@ref bpmp_ec_misc_ids | |
| 2730 | * |@ref EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE |@ref bpmp_ec_misc_ids | |
| 2731 | */ |
| 2732 | struct ec_err_simple_desc { |
| 2733 | /** @brief Bitmask of @ref bpmp_ec_desc_flags */ |
| 2734 | uint16_t desc_flags; |
| 2735 | /** @brief Error source id. Id space depends on error type. */ |
| 2736 | uint16_t err_source_id; |
| 2737 | } __ABI_PACKED; |
| 2738 | |
| 2739 | /** @brief Union of EC error descriptors */ |
| 2740 | union ec_err_desc { |
| 2741 | struct ec_err_fmon_desc fmon_desc; |
| 2742 | struct ec_err_vmon_desc vmon_desc; |
| 2743 | struct ec_err_reg_parity_desc reg_parity_desc; |
| 2744 | struct ec_err_simple_desc simple_desc; |
| 2745 | } __ABI_PACKED; |
| 2746 | |
| 2747 | struct cmd_ec_status_get_request { |
| 2748 | /** @brief HSM error line number that identifies target EC. */ |
| 2749 | uint32_t ec_hsm_id; |
| 2750 | } __ABI_PACKED; |
| 2751 | |
| 2752 | /** EC status maximum number of descriptors */ |
| 2753 | #define EC_ERR_STATUS_DESC_MAX_NUM 4 |
| 2754 | |
| 2755 | struct cmd_ec_status_get_response { |
| 2756 | /** @brief Target EC id (the same id received with request). */ |
| 2757 | uint32_t ec_hsm_id; |
| 2758 | /** |
| 2759 | * @brief Bitmask of @ref bpmp_ec_status_flags |
| 2760 | * |
| 2761 | * If NO_ERROR flag is set, error_ fields should be ignored |
| 2762 | */ |
| 2763 | uint32_t ec_status_flags; |
| 2764 | /** @brief Found EC error index. */ |
| 2765 | uint32_t error_idx; |
| 2766 | /** @brief Found EC error type @ref bpmp_ec_err_type. */ |
| 2767 | uint32_t error_type; |
| 2768 | /** @brief Number of returned EC error descriptors */ |
| 2769 | uint32_t error_desc_num; |
| 2770 | /** @brief EC error descriptors */ |
| 2771 | union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM]; |
| 2772 | } __ABI_PACKED; |
| 2773 | |
| 2774 | /** |
| 2775 | * @ingroup EC |
| 2776 | * @brief Request with #MRQ_EC |
| 2777 | * |
| 2778 | * Used by the sender of an #MRQ_EC message to access ECs owned |
| 2779 | * by BPMP. |
| 2780 | * |
| 2781 | * |sub-command |payload | |
| 2782 | * |----------------------------|-----------------------| |
| 2783 | * |@ref CMD_EC_STATUS_GET |ec_status_get | |
| 2784 | * |
| 2785 | */ |
| 2786 | |
| 2787 | struct mrq_ec_request { |
| 2788 | /** @brief Sub-command id. */ |
| 2789 | uint32_t cmd_id; |
| 2790 | |
| 2791 | union { |
| 2792 | struct cmd_ec_status_get_request ec_status_get; |
| 2793 | } __UNION_ANON; |
| 2794 | } __ABI_PACKED; |
| 2795 | |
| 2796 | /** |
| 2797 | * @ingroup EC |
| 2798 | * @brief Response to MRQ_EC |
| 2799 | * |
| 2800 | * Each sub-command supported by @ref mrq_ec_request may return |
| 2801 | * sub-command-specific data as indicated below. |
| 2802 | * |
| 2803 | * |sub-command |payload | |
| 2804 | * |----------------------------|------------------------| |
| 2805 | * |@ref CMD_EC_STATUS_GET |ec_status_get | |
| 2806 | * |
| 2807 | */ |
| 2808 | |
| 2809 | struct mrq_ec_response { |
| 2810 | union { |
| 2811 | struct cmd_ec_status_get_response ec_status_get; |
| 2812 | } __UNION_ANON; |
| 2813 | } __ABI_PACKED; |
| 2814 | |
| 2815 | /** @} */ |
| 2816 | /** @endcond */ |
| 2817 | |
| 2818 | /** |
| 2819 | * @ingroup MRQ_Codes |
| 2820 | * @def MRQ_FBVOLT_STATUS |
| 2821 | * @brief Provides status information about voltage state for fuse burning |
| 2822 | * |
| 2823 | * * Platforms: T194 onwards |
| 2824 | * @cond bpmp_t194 |
| 2825 | * * Initiators: CCPLEX |
| 2826 | * * Target: BPMP |
| 2827 | * * Request Payload: None |
| 2828 | * * Response Payload: @ref mrq_fbvolt_status_response |
| 2829 | * @{ |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2830 | */ |
| 2831 | |
| 2832 | /** |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2833 | * @ingroup Fbvolt_status |
| 2834 | * @brief Response to #MRQ_FBVOLT_STATUS |
| 2835 | * |
| 2836 | * Value of #ready reflects if core voltages are in a suitable state for buring |
| 2837 | * fuses. A value of 0x1 indicates that core voltages are ready for burning |
| 2838 | * fuses. A value of 0x0 indicates that core voltages are not ready. |
| 2839 | */ |
| 2840 | struct mrq_fbvolt_status_response { |
| 2841 | /** @brief Bit [0:0] - ready status, bits [31:1] - reserved */ |
| 2842 | uint32_t ready; |
| 2843 | /** @brief Reserved */ |
| 2844 | uint32_t unused; |
| 2845 | } __ABI_PACKED; |
| 2846 | |
| 2847 | /** @} */ |
| 2848 | /** @endcond */ |
| 2849 | |
| 2850 | /** |
| 2851 | * @addtogroup Error_Codes |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2852 | * Negative values for mrq_response::err generally indicate some |
| 2853 | * error. The ABI defines the following error codes. Negating these |
| 2854 | * defines is an exercise left to the user. |
| 2855 | * @{ |
| 2856 | */ |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2857 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2858 | /** @brief No such file or directory */ |
| 2859 | #define BPMP_ENOENT 2 |
| 2860 | /** @brief No MRQ handler */ |
| 2861 | #define BPMP_ENOHANDLER 3 |
| 2862 | /** @brief I/O error */ |
| 2863 | #define BPMP_EIO 5 |
| 2864 | /** @brief Bad sub-MRQ command */ |
| 2865 | #define BPMP_EBADCMD 6 |
| 2866 | /** @brief Not enough memory */ |
| 2867 | #define BPMP_ENOMEM 12 |
| 2868 | /** @brief Permission denied */ |
| 2869 | #define BPMP_EACCES 13 |
| 2870 | /** @brief Bad address */ |
| 2871 | #define BPMP_EFAULT 14 |
| 2872 | /** @brief No such device */ |
| 2873 | #define BPMP_ENODEV 19 |
| 2874 | /** @brief Argument is a directory */ |
| 2875 | #define BPMP_EISDIR 21 |
| 2876 | /** @brief Invalid argument */ |
| 2877 | #define BPMP_EINVAL 22 |
| 2878 | /** @brief Timeout during operation */ |
| 2879 | #define BPMP_ETIMEDOUT 23 |
| 2880 | /** @brief Out of range */ |
| 2881 | #define BPMP_ERANGE 34 |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2882 | /** @brief Function not implemented */ |
| 2883 | #define BPMP_ENOSYS 38 |
| 2884 | /** @brief Invalid slot */ |
| 2885 | #define BPMP_EBADSLT 57 |
| 2886 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2887 | /** @} */ |
Timo Alho | 4bef358 | 2018-10-22 16:19:39 +0300 | [diff] [blame] | 2888 | |
Thierry Reding | 983de5f | 2016-08-19 19:05:35 +0200 | [diff] [blame] | 2889 | #endif |