19952f691SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2983de5f9SThierry Reding /* 3ee22d0c5SVidya Sagar * Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved. 4983de5f9SThierry Reding */ 5983de5f9SThierry Reding 6*4e871899SJon Hunter #ifndef ABI_BPMP_ABI_H 7*4e871899SJon Hunter #define ABI_BPMP_ABI_H 8983de5f9SThierry Reding 9*4e871899SJon Hunter #if defined(LK) || defined(BPMP_ABI_HAVE_STDC) 10*4e871899SJon Hunter #include <stddef.h> 11983de5f9SThierry Reding #include <stdint.h> 12983de5f9SThierry Reding #endif 13983de5f9SThierry Reding 14*4e871899SJon Hunter #ifndef BPMP_ABI_PACKED 15*4e871899SJon Hunter #ifdef __ABI_PACKED 16*4e871899SJon Hunter #define BPMP_ABI_PACKED __ABI_PACKED 17*4e871899SJon Hunter #else 18*4e871899SJon Hunter #define BPMP_ABI_PACKED __attribute__((packed)) 19*4e871899SJon Hunter #endif 20983de5f9SThierry Reding #endif 21983de5f9SThierry Reding 22983de5f9SThierry Reding #ifdef NO_GCC_EXTENSIONS 23*4e871899SJon Hunter #define BPMP_ABI_EMPTY char empty; 24*4e871899SJon Hunter #define BPMP_ABI_EMPTY_ARRAY 1 25983de5f9SThierry Reding #else 26*4e871899SJon Hunter #define BPMP_ABI_EMPTY 27*4e871899SJon Hunter #define BPMP_ABI_EMPTY_ARRAY 0 28983de5f9SThierry Reding #endif 29983de5f9SThierry Reding 30*4e871899SJon Hunter #ifndef BPMP_UNION_ANON 31*4e871899SJon Hunter #ifdef __UNION_ANON 32*4e871899SJon Hunter #define BPMP_UNION_ANON __UNION_ANON 33*4e871899SJon Hunter #else 34*4e871899SJon Hunter #define BPMP_UNION_ANON 35983de5f9SThierry Reding #endif 36*4e871899SJon Hunter #endif 37*4e871899SJon Hunter 38983de5f9SThierry Reding /** 39983de5f9SThierry Reding * @file 40983de5f9SThierry Reding */ 41983de5f9SThierry Reding 42983de5f9SThierry Reding /** 43983de5f9SThierry Reding * @defgroup MRQ MRQ Messages 44983de5f9SThierry Reding * @brief Messages sent to/from BPMP via IPC 45983de5f9SThierry Reding * @{ 46983de5f9SThierry Reding * @defgroup MRQ_Format Message Format 47983de5f9SThierry Reding * @defgroup MRQ_Codes Message Request (MRQ) Codes 48983de5f9SThierry Reding * @defgroup MRQ_Payloads Message Payloads 49983de5f9SThierry Reding * @defgroup Error_Codes Error Codes 50983de5f9SThierry Reding * @} 51983de5f9SThierry Reding */ 52983de5f9SThierry Reding 53983de5f9SThierry Reding /** 544bef358cSTimo Alho * @addtogroup MRQ_Format 55983de5f9SThierry Reding * @{ 56983de5f9SThierry Reding * The CPU requests the BPMP to perform a particular service by 57983de5f9SThierry Reding * sending it an IVC frame containing a single MRQ message. An MRQ 58983de5f9SThierry Reding * message consists of a @ref mrq_request followed by a payload whose 59983de5f9SThierry Reding * format depends on mrq_request::mrq. 60983de5f9SThierry Reding * 61983de5f9SThierry Reding * The BPMP processes the data and replies with an IVC frame (on the 62983de5f9SThierry Reding * same IVC channel) containing and MRQ response. An MRQ response 63983de5f9SThierry Reding * consists of a @ref mrq_response followed by a payload whose format 64983de5f9SThierry Reding * depends on the associated mrq_request::mrq. 65983de5f9SThierry Reding * 66983de5f9SThierry Reding * A well-defined subset of the MRQ messages that the CPU sends to the 67983de5f9SThierry Reding * BPMP can lead to BPMP eventually sending an MRQ message to the 68983de5f9SThierry Reding * CPU. For example, when the CPU uses an #MRQ_THERMAL message to set 69983de5f9SThierry Reding * a thermal trip point, the BPMP may eventually send a single 70983de5f9SThierry Reding * #MRQ_THERMAL message of its own to the CPU indicating that the trip 71983de5f9SThierry Reding * point has been crossed. 72983de5f9SThierry Reding * @} 73983de5f9SThierry Reding */ 74983de5f9SThierry Reding 75983de5f9SThierry Reding /** 76983de5f9SThierry Reding * @ingroup MRQ_Format 774bef358cSTimo Alho * @brief Header for an MRQ message 78983de5f9SThierry Reding * 79983de5f9SThierry Reding * Provides the MRQ number for the MRQ message: #mrq. The remainder of 80983de5f9SThierry Reding * the MRQ message is a payload (immediately following the 81983de5f9SThierry Reding * mrq_request) whose format depends on mrq. 82983de5f9SThierry Reding */ 83983de5f9SThierry Reding struct mrq_request { 84983de5f9SThierry Reding /** @brief MRQ number of the request */ 85983de5f9SThierry Reding uint32_t mrq; 86*4e871899SJon Hunter 8752b8b803SThierry Reding /** 884bef358cSTimo Alho * @brief Flags providing follow up directions to the receiver 8952b8b803SThierry Reding * 9052b8b803SThierry Reding * | Bit | Description | 9152b8b803SThierry Reding * |-----|--------------------------------------------| 9252b8b803SThierry Reding * | 1 | ring the sender's doorbell when responding | 9352b8b803SThierry Reding * | 0 | should be 1 | 9452b8b803SThierry Reding */ 95983de5f9SThierry Reding uint32_t flags; 96*4e871899SJon Hunter } BPMP_ABI_PACKED; 97983de5f9SThierry Reding 98983de5f9SThierry Reding /** 99983de5f9SThierry Reding * @ingroup MRQ_Format 1004bef358cSTimo Alho * @brief Header for an MRQ response 101983de5f9SThierry Reding * 102983de5f9SThierry Reding * Provides an error code for the associated MRQ message. The 103983de5f9SThierry Reding * remainder of the MRQ response is a payload (immediately following 104983de5f9SThierry Reding * the mrq_response) whose format depends on the associated 105983de5f9SThierry Reding * mrq_request::mrq 106983de5f9SThierry Reding */ 107983de5f9SThierry Reding struct mrq_response { 1084bef358cSTimo Alho /** @brief Error code for the MRQ request itself */ 109983de5f9SThierry Reding int32_t err; 1104bef358cSTimo Alho /** @brief Reserved for future use */ 111983de5f9SThierry Reding uint32_t flags; 112*4e871899SJon Hunter } BPMP_ABI_PACKED; 113983de5f9SThierry Reding 114983de5f9SThierry Reding /** 115983de5f9SThierry Reding * @ingroup MRQ_Format 116983de5f9SThierry Reding * Minimum needed size for an IPC message buffer 117983de5f9SThierry Reding */ 118*4e871899SJon Hunter #define MSG_MIN_SZ 128U 119983de5f9SThierry Reding /** 120983de5f9SThierry Reding * @ingroup MRQ_Format 121983de5f9SThierry Reding * Minimum size guaranteed for data in an IPC message buffer 122983de5f9SThierry Reding */ 123*4e871899SJon Hunter #define MSG_DATA_MIN_SZ 120U 124983de5f9SThierry Reding 125983de5f9SThierry Reding /** 126983de5f9SThierry Reding * @ingroup MRQ_Codes 127983de5f9SThierry Reding * @name Legal MRQ codes 128983de5f9SThierry Reding * These are the legal values for mrq_request::mrq 129983de5f9SThierry Reding * @{ 130983de5f9SThierry Reding */ 131983de5f9SThierry Reding 132*4e871899SJon Hunter #define MRQ_PING 0U 133*4e871899SJon Hunter #define MRQ_QUERY_TAG 1U 134*4e871899SJon Hunter #define MRQ_MODULE_LOAD 4U 135*4e871899SJon Hunter #define MRQ_MODULE_UNLOAD 5U 136*4e871899SJon Hunter #define MRQ_TRACE_MODIFY 7U 137*4e871899SJon Hunter #define MRQ_WRITE_TRACE 8U 138*4e871899SJon Hunter #define MRQ_THREADED_PING 9U 139*4e871899SJon Hunter #define MRQ_MODULE_MAIL 11U 140*4e871899SJon Hunter #define MRQ_DEBUGFS 19U 141*4e871899SJon Hunter #define MRQ_RESET 20U 142*4e871899SJon Hunter #define MRQ_I2C 21U 143*4e871899SJon Hunter #define MRQ_CLK 22U 144*4e871899SJon Hunter #define MRQ_QUERY_ABI 23U 145*4e871899SJon Hunter #define MRQ_PG_READ_STATE 25U 146*4e871899SJon Hunter #define MRQ_PG_UPDATE_STATE 26U 147*4e871899SJon Hunter #define MRQ_THERMAL 27U 148*4e871899SJon Hunter #define MRQ_CPU_VHINT 28U 149*4e871899SJon Hunter #define MRQ_ABI_RATCHET 29U 150*4e871899SJon Hunter #define MRQ_EMC_DVFS_LATENCY 31U 151*4e871899SJon Hunter #define MRQ_TRACE_ITER 64U 152*4e871899SJon Hunter #define MRQ_RINGBUF_CONSOLE 65U 153*4e871899SJon Hunter #define MRQ_PG 66U 154*4e871899SJon Hunter #define MRQ_CPU_NDIV_LIMITS 67U 155*4e871899SJon Hunter #define MRQ_STRAP 68U 156*4e871899SJon Hunter #define MRQ_UPHY 69U 157*4e871899SJon Hunter #define MRQ_CPU_AUTO_CC3 70U 158*4e871899SJon Hunter #define MRQ_QUERY_FW_TAG 71U 159*4e871899SJon Hunter #define MRQ_FMON 72U 160*4e871899SJon Hunter #define MRQ_EC 73U 161*4e871899SJon Hunter #define MRQ_DEBUG 75U 162983de5f9SThierry Reding 163983de5f9SThierry Reding /** @} */ 164983de5f9SThierry Reding 165983de5f9SThierry Reding /** 166983de5f9SThierry Reding * @ingroup MRQ_Codes 167983de5f9SThierry Reding * @brief Maximum MRQ code to be sent by CPU software to 168983de5f9SThierry Reding * BPMP. Subject to change in future 169983de5f9SThierry Reding */ 170*4e871899SJon Hunter #define MAX_CPU_MRQ_ID 75U 171983de5f9SThierry Reding 172983de5f9SThierry Reding /** 1734bef358cSTimo Alho * @addtogroup MRQ_Payloads 174983de5f9SThierry Reding * @{ 1754bef358cSTimo Alho * @defgroup Ping Ping 176983de5f9SThierry Reding * @defgroup Query_Tag Query Tag 177983de5f9SThierry Reding * @defgroup Module Loadable Modules 1784bef358cSTimo Alho * @defgroup Trace Trace 1794bef358cSTimo Alho * @defgroup Debugfs Debug File System 1804bef358cSTimo Alho * @defgroup Reset Reset 1814bef358cSTimo Alho * @defgroup I2C I2C 1824bef358cSTimo Alho * @defgroup Clocks Clocks 183983de5f9SThierry Reding * @defgroup ABI_info ABI Info 1844bef358cSTimo Alho * @defgroup Powergating Power Gating 1854bef358cSTimo Alho * @defgroup Thermal Thermal 186983de5f9SThierry Reding * @defgroup Vhint CPU Voltage hint 1874bef358cSTimo Alho * @defgroup EMC EMC 1884bef358cSTimo Alho * @defgroup CPU NDIV Limits 1894bef358cSTimo Alho * @defgroup RingbufConsole Ring Buffer Console 1904bef358cSTimo Alho * @defgroup Strap Straps 1914bef358cSTimo Alho * @defgroup UPHY UPHY 1924bef358cSTimo Alho * @defgroup CC3 Auto-CC3 1934bef358cSTimo Alho * @defgroup FMON FMON 1944bef358cSTimo Alho * @defgroup EC EC 1954bef358cSTimo Alho * @defgroup Fbvolt_status Fuse Burn Voltage Status 196983de5f9SThierry Reding * @} 197983de5f9SThierry Reding */ 198983de5f9SThierry Reding 199983de5f9SThierry Reding /** 200983de5f9SThierry Reding * @ingroup MRQ_Codes 201983de5f9SThierry Reding * @def MRQ_PING 202983de5f9SThierry Reding * @brief A simple ping 203983de5f9SThierry Reding * 204983de5f9SThierry Reding * * Platforms: All 205983de5f9SThierry Reding * * Initiators: Any 206983de5f9SThierry Reding * * Targets: Any 207983de5f9SThierry Reding * * Request Payload: @ref mrq_ping_request 208983de5f9SThierry Reding * * Response Payload: @ref mrq_ping_response 209983de5f9SThierry Reding * 210983de5f9SThierry Reding * @ingroup MRQ_Codes 211983de5f9SThierry Reding * @def MRQ_THREADED_PING 212983de5f9SThierry Reding * @brief A deeper ping 213983de5f9SThierry Reding * 214983de5f9SThierry Reding * * Platforms: All 215983de5f9SThierry Reding * * Initiators: Any 216983de5f9SThierry Reding * * Targets: BPMP 217983de5f9SThierry Reding * * Request Payload: @ref mrq_ping_request 218983de5f9SThierry Reding * * Response Payload: @ref mrq_ping_response 219983de5f9SThierry Reding * 220983de5f9SThierry Reding * Behavior is equivalent to a simple #MRQ_PING except that BPMP 221983de5f9SThierry Reding * responds from a thread context (providing a slightly more robust 222983de5f9SThierry Reding * sign of life). 223983de5f9SThierry Reding * 224983de5f9SThierry Reding */ 225983de5f9SThierry Reding 226983de5f9SThierry Reding /** 227983de5f9SThierry Reding * @ingroup Ping 2284bef358cSTimo Alho * @brief Request with #MRQ_PING 229983de5f9SThierry Reding * 230983de5f9SThierry Reding * Used by the sender of an #MRQ_PING message to request a pong from 231983de5f9SThierry Reding * recipient. The response from the recipient is computed based on 232983de5f9SThierry Reding * #challenge. 233983de5f9SThierry Reding */ 234983de5f9SThierry Reding struct mrq_ping_request { 2354bef358cSTimo Alho /** @brief Arbitrarily chosen value */ 236983de5f9SThierry Reding uint32_t challenge; 237*4e871899SJon Hunter } BPMP_ABI_PACKED; 238983de5f9SThierry Reding 239983de5f9SThierry Reding /** 240983de5f9SThierry Reding * @ingroup Ping 2414bef358cSTimo Alho * @brief Response to #MRQ_PING 242983de5f9SThierry Reding * 243983de5f9SThierry Reding * Sent in response to an #MRQ_PING message. #reply should be the 244983de5f9SThierry Reding * mrq_ping_request challenge left shifted by 1 with the carry-bit 245983de5f9SThierry Reding * dropped. 246983de5f9SThierry Reding * 247983de5f9SThierry Reding */ 248983de5f9SThierry Reding struct mrq_ping_response { 2494bef358cSTimo Alho /** @brief Response to the MRQ_PING challege */ 250983de5f9SThierry Reding uint32_t reply; 251*4e871899SJon Hunter } BPMP_ABI_PACKED; 252983de5f9SThierry Reding 253983de5f9SThierry Reding /** 254983de5f9SThierry Reding * @ingroup MRQ_Codes 255983de5f9SThierry Reding * @def MRQ_QUERY_TAG 2564bef358cSTimo Alho * @brief Query BPMP firmware's tag (i.e. unique identifer) 2574bef358cSTimo Alho * 2584bef358cSTimo Alho * @deprecated Use #MRQ_QUERY_FW_TAG instead. 259983de5f9SThierry Reding * 260983de5f9SThierry Reding * * Platforms: All 261983de5f9SThierry Reding * * Initiators: CCPLEX 262983de5f9SThierry Reding * * Targets: BPMP 263983de5f9SThierry Reding * * Request Payload: @ref mrq_query_tag_request 264983de5f9SThierry Reding * * Response Payload: N/A 265983de5f9SThierry Reding * 266983de5f9SThierry Reding */ 267983de5f9SThierry Reding 268983de5f9SThierry Reding /** 269983de5f9SThierry Reding * @ingroup Query_Tag 2704bef358cSTimo Alho * @brief Request with #MRQ_QUERY_TAG 271983de5f9SThierry Reding * 2724bef358cSTimo Alho * @deprecated This structure will be removed in future version. 2734bef358cSTimo Alho * Use MRQ_QUERY_FW_TAG instead. 274983de5f9SThierry Reding */ 275983de5f9SThierry Reding struct mrq_query_tag_request { 2764bef358cSTimo Alho /** @brief Base address to store the firmware tag */ 277983de5f9SThierry Reding uint32_t addr; 278*4e871899SJon Hunter } BPMP_ABI_PACKED; 279983de5f9SThierry Reding 2804bef358cSTimo Alho 2814bef358cSTimo Alho /** 2824bef358cSTimo Alho * @ingroup MRQ_Codes 2834bef358cSTimo Alho * @def MRQ_QUERY_FW_TAG 2844bef358cSTimo Alho * @brief Query BPMP firmware's tag (i.e. unique identifier) 2854bef358cSTimo Alho * 2864bef358cSTimo Alho * * Platforms: All 2874bef358cSTimo Alho * * Initiators: Any 2884bef358cSTimo Alho * * Targets: BPMP 2894bef358cSTimo Alho * * Request Payload: N/A 2904bef358cSTimo Alho * * Response Payload: @ref mrq_query_fw_tag_response 2914bef358cSTimo Alho * 2924bef358cSTimo Alho */ 2934bef358cSTimo Alho 2944bef358cSTimo Alho /** 2954bef358cSTimo Alho * @ingroup Query_Tag 2964bef358cSTimo Alho * @brief Response to #MRQ_QUERY_FW_TAG 2974bef358cSTimo Alho * 2984bef358cSTimo Alho * Sent in response to #MRQ_QUERY_FW_TAG message. #tag contains the unique 2994bef358cSTimo Alho * identifier for the version of firmware issuing the reply. 3004bef358cSTimo Alho * 3014bef358cSTimo Alho */ 3024bef358cSTimo Alho struct mrq_query_fw_tag_response { 3034bef358cSTimo Alho /** @brief Array to store tag information */ 3044bef358cSTimo Alho uint8_t tag[32]; 305*4e871899SJon Hunter } BPMP_ABI_PACKED; 3064bef358cSTimo Alho 307983de5f9SThierry Reding /** 308983de5f9SThierry Reding * @ingroup MRQ_Codes 309983de5f9SThierry Reding * @def MRQ_MODULE_LOAD 3104bef358cSTimo Alho * @brief Dynamically load a BPMP code module 311983de5f9SThierry Reding * 312*4e871899SJon Hunter * * Platforms: T210, T210B01, T186 313*4e871899SJon Hunter * @cond (bpmp_t210 || bpmp_t210b01 || bpmp_t186) 314983de5f9SThierry Reding * * Initiators: CCPLEX 315983de5f9SThierry Reding * * Targets: BPMP 316983de5f9SThierry Reding * * Request Payload: @ref mrq_module_load_request 317983de5f9SThierry Reding * * Response Payload: @ref mrq_module_load_response 318983de5f9SThierry Reding * 319983de5f9SThierry Reding * @note This MRQ is disabled on production systems 320983de5f9SThierry Reding * 321983de5f9SThierry Reding */ 322983de5f9SThierry Reding 323983de5f9SThierry Reding /** 324983de5f9SThierry Reding * @ingroup Module 3254bef358cSTimo Alho * @brief Request with #MRQ_MODULE_LOAD 326983de5f9SThierry Reding * 327983de5f9SThierry Reding * Used by #MRQ_MODULE_LOAD calls to ask the recipient to dynamically 328983de5f9SThierry Reding * load the code located at #phys_addr and having size #size 329983de5f9SThierry Reding * bytes. #phys_addr is treated as a void pointer. 330983de5f9SThierry Reding * 331983de5f9SThierry Reding * The recipient copies the code from #phys_addr to locally allocated 332983de5f9SThierry Reding * memory prior to responding to this message. 333983de5f9SThierry Reding * 334983de5f9SThierry Reding * @todo document the module header format 335983de5f9SThierry Reding * 336983de5f9SThierry Reding * The sender is responsible for ensuring that the code is mapped in 337983de5f9SThierry Reding * the recipient's address map. 338983de5f9SThierry Reding * 339983de5f9SThierry Reding */ 340983de5f9SThierry Reding struct mrq_module_load_request { 341*4e871899SJon Hunter /** @brief Base address of the code to load */ 342*4e871899SJon Hunter uint32_t phys_addr; 3434bef358cSTimo Alho /** @brief Size in bytes of code to load */ 344983de5f9SThierry Reding uint32_t size; 345*4e871899SJon Hunter } BPMP_ABI_PACKED; 346983de5f9SThierry Reding 347983de5f9SThierry Reding /** 348983de5f9SThierry Reding * @ingroup Module 3494bef358cSTimo Alho * @brief Response to #MRQ_MODULE_LOAD 350983de5f9SThierry Reding * 351983de5f9SThierry Reding * @todo document mrq_response::err 352983de5f9SThierry Reding */ 353983de5f9SThierry Reding struct mrq_module_load_response { 3544bef358cSTimo Alho /** @brief Handle to the loaded module */ 355983de5f9SThierry Reding uint32_t base; 356*4e871899SJon Hunter } BPMP_ABI_PACKED; 3574bef358cSTimo Alho /** @endcond*/ 358983de5f9SThierry Reding 359983de5f9SThierry Reding /** 360983de5f9SThierry Reding * @ingroup MRQ_Codes 361983de5f9SThierry Reding * @def MRQ_MODULE_UNLOAD 3624bef358cSTimo Alho * @brief Unload a previously loaded code module 363983de5f9SThierry Reding * 364*4e871899SJon Hunter * * Platforms: T210, T210B01, T186 365*4e871899SJon Hunter * @cond (bpmp_t210 || bpmp_t210b01 || bpmp_t186) 366983de5f9SThierry Reding * * Initiators: CCPLEX 367983de5f9SThierry Reding * * Targets: BPMP 368983de5f9SThierry Reding * * Request Payload: @ref mrq_module_unload_request 369983de5f9SThierry Reding * * Response Payload: N/A 370983de5f9SThierry Reding * 371983de5f9SThierry Reding * @note This MRQ is disabled on production systems 372983de5f9SThierry Reding */ 373983de5f9SThierry Reding 374983de5f9SThierry Reding /** 375983de5f9SThierry Reding * @ingroup Module 3764bef358cSTimo Alho * @brief Request with #MRQ_MODULE_UNLOAD 377983de5f9SThierry Reding * 378983de5f9SThierry Reding * Used by #MRQ_MODULE_UNLOAD calls to request that a previously loaded 379983de5f9SThierry Reding * module be unloaded. 380983de5f9SThierry Reding */ 381983de5f9SThierry Reding struct mrq_module_unload_request { 3824bef358cSTimo Alho /** @brief Handle of the module to unload */ 383983de5f9SThierry Reding uint32_t base; 384*4e871899SJon Hunter } BPMP_ABI_PACKED; 3854bef358cSTimo Alho /** @endcond*/ 386983de5f9SThierry Reding 387983de5f9SThierry Reding /** 388983de5f9SThierry Reding * @ingroup MRQ_Codes 389983de5f9SThierry Reding * @def MRQ_TRACE_MODIFY 3904bef358cSTimo Alho * @brief Modify the set of enabled trace events 391983de5f9SThierry Reding * 392*4e871899SJon Hunter * @deprecated 393*4e871899SJon Hunter * 394983de5f9SThierry Reding * * Platforms: All 395983de5f9SThierry Reding * * Initiators: CCPLEX 396983de5f9SThierry Reding * * Targets: BPMP 397983de5f9SThierry Reding * * Request Payload: @ref mrq_trace_modify_request 398983de5f9SThierry Reding * * Response Payload: @ref mrq_trace_modify_response 399983de5f9SThierry Reding * 400983de5f9SThierry Reding * @note This MRQ is disabled on production systems 401983de5f9SThierry Reding */ 402983de5f9SThierry Reding 403983de5f9SThierry Reding /** 404983de5f9SThierry Reding * @ingroup Trace 4054bef358cSTimo Alho * @brief Request with #MRQ_TRACE_MODIFY 406983de5f9SThierry Reding * 407983de5f9SThierry Reding * Used by %MRQ_TRACE_MODIFY calls to enable or disable specify trace 408983de5f9SThierry Reding * events. #set takes precedence for any bit set in both #set and 409983de5f9SThierry Reding * #clr. 410983de5f9SThierry Reding */ 411983de5f9SThierry Reding struct mrq_trace_modify_request { 4124bef358cSTimo Alho /** @brief Bit mask of trace events to disable */ 413983de5f9SThierry Reding uint32_t clr; 4144bef358cSTimo Alho /** @brief Bit mask of trace events to enable */ 415983de5f9SThierry Reding uint32_t set; 416*4e871899SJon Hunter } BPMP_ABI_PACKED; 417983de5f9SThierry Reding 418983de5f9SThierry Reding /** 419983de5f9SThierry Reding * @ingroup Trace 4204bef358cSTimo Alho * @brief Response to #MRQ_TRACE_MODIFY 421983de5f9SThierry Reding * 422983de5f9SThierry Reding * Sent in repsonse to an #MRQ_TRACE_MODIFY message. #mask reflects the 423983de5f9SThierry Reding * state of which events are enabled after the recipient acted on the 424983de5f9SThierry Reding * message. 425983de5f9SThierry Reding * 426983de5f9SThierry Reding */ 427983de5f9SThierry Reding struct mrq_trace_modify_response { 4284bef358cSTimo Alho /** @brief Bit mask of trace event enable states */ 429983de5f9SThierry Reding uint32_t mask; 430*4e871899SJon Hunter } BPMP_ABI_PACKED; 431983de5f9SThierry Reding 432983de5f9SThierry Reding /** 433983de5f9SThierry Reding * @ingroup MRQ_Codes 434983de5f9SThierry Reding * @def MRQ_WRITE_TRACE 435983de5f9SThierry Reding * @brief Write trace data to a buffer 436983de5f9SThierry Reding * 437*4e871899SJon Hunter * @deprecated 438*4e871899SJon Hunter * 439983de5f9SThierry Reding * * Platforms: All 440983de5f9SThierry Reding * * Initiators: CCPLEX 441983de5f9SThierry Reding * * Targets: BPMP 442983de5f9SThierry Reding * * Request Payload: @ref mrq_write_trace_request 443983de5f9SThierry Reding * * Response Payload: @ref mrq_write_trace_response 444983de5f9SThierry Reding * 445983de5f9SThierry Reding * mrq_response::err depends on the @ref mrq_write_trace_request field 446983de5f9SThierry Reding * values. err is -#BPMP_EINVAL if size is zero or area is NULL or 447983de5f9SThierry Reding * area is in an illegal range. A positive value for err indicates the 448983de5f9SThierry Reding * number of bytes written to area. 449983de5f9SThierry Reding * 450983de5f9SThierry Reding * @note This MRQ is disabled on production systems 451983de5f9SThierry Reding */ 452983de5f9SThierry Reding 453983de5f9SThierry Reding /** 454983de5f9SThierry Reding * @ingroup Trace 4554bef358cSTimo Alho * @brief Request with #MRQ_WRITE_TRACE 456983de5f9SThierry Reding * 457983de5f9SThierry Reding * Used by MRQ_WRITE_TRACE calls to ask the recipient to copy trace 458983de5f9SThierry Reding * data from the recipient's local buffer to the output buffer. #area 459983de5f9SThierry Reding * is treated as a byte-aligned pointer in the recipient's address 460983de5f9SThierry Reding * space. 461983de5f9SThierry Reding * 462983de5f9SThierry Reding * The sender is responsible for ensuring that the output 463983de5f9SThierry Reding * buffer is mapped in the recipient's address map. The recipient is 464983de5f9SThierry Reding * responsible for protecting its own code and data from accidental 465983de5f9SThierry Reding * overwrites. 466983de5f9SThierry Reding */ 467983de5f9SThierry Reding struct mrq_write_trace_request { 4684bef358cSTimo Alho /** @brief Base address of output buffer */ 469983de5f9SThierry Reding uint32_t area; 4704bef358cSTimo Alho /** @brief Size in bytes of the output buffer */ 471983de5f9SThierry Reding uint32_t size; 472*4e871899SJon Hunter } BPMP_ABI_PACKED; 473983de5f9SThierry Reding 474983de5f9SThierry Reding /** 475983de5f9SThierry Reding * @ingroup Trace 4764bef358cSTimo Alho * @brief Response to #MRQ_WRITE_TRACE 477983de5f9SThierry Reding * 478983de5f9SThierry Reding * Once this response is sent, the respondent will not access the 479983de5f9SThierry Reding * output buffer further. 480983de5f9SThierry Reding */ 481983de5f9SThierry Reding struct mrq_write_trace_response { 482983de5f9SThierry Reding /** 4834bef358cSTimo Alho * @brief Flag whether more data remains in local buffer 484983de5f9SThierry Reding * 485983de5f9SThierry Reding * Value is 1 if the entire local trace buffer has been 486983de5f9SThierry Reding * drained to the outputbuffer. Value is 0 otherwise. 487983de5f9SThierry Reding */ 488983de5f9SThierry Reding uint32_t eof; 489*4e871899SJon Hunter } BPMP_ABI_PACKED; 490983de5f9SThierry Reding 491983de5f9SThierry Reding /** @private */ 492983de5f9SThierry Reding struct mrq_threaded_ping_request { 493983de5f9SThierry Reding uint32_t challenge; 494*4e871899SJon Hunter } BPMP_ABI_PACKED; 495983de5f9SThierry Reding 496983de5f9SThierry Reding /** @private */ 497983de5f9SThierry Reding struct mrq_threaded_ping_response { 498983de5f9SThierry Reding uint32_t reply; 499*4e871899SJon Hunter } BPMP_ABI_PACKED; 500983de5f9SThierry Reding 501983de5f9SThierry Reding /** 502983de5f9SThierry Reding * @ingroup MRQ_Codes 503983de5f9SThierry Reding * @def MRQ_MODULE_MAIL 5044bef358cSTimo Alho * @brief Send a message to a loadable module 505983de5f9SThierry Reding * 506*4e871899SJon Hunter * * Platforms: T210, T210B01, T186 507*4e871899SJon Hunter * @cond (bpmp_t210 || bpmp_t210b01 || bpmp_t186) 508983de5f9SThierry Reding * * Initiators: Any 509983de5f9SThierry Reding * * Targets: BPMP 510983de5f9SThierry Reding * * Request Payload: @ref mrq_module_mail_request 511983de5f9SThierry Reding * * Response Payload: @ref mrq_module_mail_response 512983de5f9SThierry Reding * 513983de5f9SThierry Reding * @note This MRQ is disabled on production systems 514983de5f9SThierry Reding */ 515983de5f9SThierry Reding 516983de5f9SThierry Reding /** 517983de5f9SThierry Reding * @ingroup Module 5184bef358cSTimo Alho * @brief Request with #MRQ_MODULE_MAIL 519983de5f9SThierry Reding */ 520983de5f9SThierry Reding struct mrq_module_mail_request { 5214bef358cSTimo Alho /** @brief Handle to the previously loaded module */ 522983de5f9SThierry Reding uint32_t base; 5234bef358cSTimo Alho /** @brief Module-specific mail payload 524983de5f9SThierry Reding * 525983de5f9SThierry Reding * The length of data[ ] is unknown to the BPMP core firmware 526983de5f9SThierry Reding * but it is limited to the size of an IPC message. 527983de5f9SThierry Reding */ 528*4e871899SJon Hunter uint8_t data[BPMP_ABI_EMPTY_ARRAY]; 529*4e871899SJon Hunter } BPMP_ABI_PACKED; 530983de5f9SThierry Reding 531983de5f9SThierry Reding /** 532983de5f9SThierry Reding * @ingroup Module 5334bef358cSTimo Alho * @brief Response to #MRQ_MODULE_MAIL 534983de5f9SThierry Reding */ 535983de5f9SThierry Reding struct mrq_module_mail_response { 5364bef358cSTimo Alho /** @brief Module-specific mail payload 537983de5f9SThierry Reding * 538983de5f9SThierry Reding * The length of data[ ] is unknown to the BPMP core firmware 539983de5f9SThierry Reding * but it is limited to the size of an IPC message. 540983de5f9SThierry Reding */ 541*4e871899SJon Hunter uint8_t data[BPMP_ABI_EMPTY_ARRAY]; 542*4e871899SJon Hunter } BPMP_ABI_PACKED; 5434bef358cSTimo Alho /** @endcond */ 544983de5f9SThierry Reding 545983de5f9SThierry Reding /** 546983de5f9SThierry Reding * @ingroup MRQ_Codes 547983de5f9SThierry Reding * @def MRQ_DEBUGFS 548983de5f9SThierry Reding * @brief Interact with BPMP's debugfs file nodes 549983de5f9SThierry Reding * 5505e37b9c1SJon Hunter * @deprecated use MRQ_DEBUG instead. 5515e37b9c1SJon Hunter * 5524bef358cSTimo Alho * * Platforms: T186, T194 553983de5f9SThierry Reding * * Initiators: Any 554983de5f9SThierry Reding * * Targets: BPMP 555983de5f9SThierry Reding * * Request Payload: @ref mrq_debugfs_request 556983de5f9SThierry Reding * * Response Payload: @ref mrq_debugfs_response 557983de5f9SThierry Reding */ 558983de5f9SThierry Reding 559983de5f9SThierry Reding /** 560983de5f9SThierry Reding * @addtogroup Debugfs 561983de5f9SThierry Reding * @{ 562983de5f9SThierry Reding * 563983de5f9SThierry Reding * The BPMP firmware implements a pseudo-filesystem called 564983de5f9SThierry Reding * debugfs. Any driver within the firmware may register with debugfs 565983de5f9SThierry Reding * to expose an arbitrary set of "files" in the filesystem. When 566983de5f9SThierry Reding * software on the CPU writes to a debugfs file, debugfs passes the 567983de5f9SThierry Reding * written data to a callback provided by the driver. When software on 568983de5f9SThierry Reding * the CPU reads a debugfs file, debugfs queries the driver for the 569983de5f9SThierry Reding * data to return to the CPU. The intention of the debugfs filesystem 570983de5f9SThierry Reding * is to provide information useful for debugging the system at 571983de5f9SThierry Reding * runtime. 572983de5f9SThierry Reding * 573983de5f9SThierry Reding * @note The files exposed via debugfs are not part of the 574983de5f9SThierry Reding * BPMP firmware's ABI. debugfs files may be added or removed in any 575983de5f9SThierry Reding * given version of the firmware. Typically the semantics of a debugfs 576983de5f9SThierry Reding * file are consistent from version to version but even that is not 577983de5f9SThierry Reding * guaranteed. 578983de5f9SThierry Reding * 579983de5f9SThierry Reding * @} 580983de5f9SThierry Reding */ 5814bef358cSTimo Alho 582983de5f9SThierry Reding /** @ingroup Debugfs */ 583983de5f9SThierry Reding enum mrq_debugfs_commands { 5844bef358cSTimo Alho /** @brief Perform read */ 585983de5f9SThierry Reding CMD_DEBUGFS_READ = 1, 5864bef358cSTimo Alho /** @brief Perform write */ 587983de5f9SThierry Reding CMD_DEBUGFS_WRITE = 2, 5884bef358cSTimo Alho /** @brief Perform dumping directory */ 589983de5f9SThierry Reding CMD_DEBUGFS_DUMPDIR = 3, 5904bef358cSTimo Alho /** @brief Not a command */ 591983de5f9SThierry Reding CMD_DEBUGFS_MAX 592983de5f9SThierry Reding }; 593983de5f9SThierry Reding 594983de5f9SThierry Reding /** 595983de5f9SThierry Reding * @ingroup Debugfs 5964bef358cSTimo Alho * @brief Parameters for CMD_DEBUGFS_READ/WRITE command 597983de5f9SThierry Reding */ 598983de5f9SThierry Reding struct cmd_debugfs_fileop_request { 5994bef358cSTimo Alho /** @brief Physical address pointing at filename */ 600983de5f9SThierry Reding uint32_t fnameaddr; 6014bef358cSTimo Alho /** @brief Length in bytes of filename buffer */ 602983de5f9SThierry Reding uint32_t fnamelen; 6034bef358cSTimo Alho /** @brief Physical address pointing to data buffer */ 604983de5f9SThierry Reding uint32_t dataaddr; 6054bef358cSTimo Alho /** @brief Length in bytes of data buffer */ 606983de5f9SThierry Reding uint32_t datalen; 607*4e871899SJon Hunter } BPMP_ABI_PACKED; 608983de5f9SThierry Reding 609983de5f9SThierry Reding /** 610983de5f9SThierry Reding * @ingroup Debugfs 6114bef358cSTimo Alho * @brief Parameters for CMD_DEBUGFS_READ/WRITE command 612983de5f9SThierry Reding */ 613983de5f9SThierry Reding struct cmd_debugfs_dumpdir_request { 6144bef358cSTimo Alho /** @brief Physical address pointing to data buffer */ 615983de5f9SThierry Reding uint32_t dataaddr; 6164bef358cSTimo Alho /** @brief Length in bytes of data buffer */ 617983de5f9SThierry Reding uint32_t datalen; 618*4e871899SJon Hunter } BPMP_ABI_PACKED; 619983de5f9SThierry Reding 620983de5f9SThierry Reding /** 621983de5f9SThierry Reding * @ingroup Debugfs 6224bef358cSTimo Alho * @brief Response data for CMD_DEBUGFS_READ/WRITE command 623983de5f9SThierry Reding */ 624983de5f9SThierry Reding struct cmd_debugfs_fileop_response { 6254bef358cSTimo Alho /** @brief Always 0 */ 626983de5f9SThierry Reding uint32_t reserved; 6274bef358cSTimo Alho /** @brief Number of bytes read from or written to data buffer */ 628983de5f9SThierry Reding uint32_t nbytes; 629*4e871899SJon Hunter } BPMP_ABI_PACKED; 630983de5f9SThierry Reding 631983de5f9SThierry Reding /** 632983de5f9SThierry Reding * @ingroup Debugfs 6334bef358cSTimo Alho * @brief Response data for CMD_DEBUGFS_DUMPDIR command 634983de5f9SThierry Reding */ 635983de5f9SThierry Reding struct cmd_debugfs_dumpdir_response { 6364bef358cSTimo Alho /** @brief Always 0 */ 637983de5f9SThierry Reding uint32_t reserved; 6384bef358cSTimo Alho /** @brief Number of bytes read from or written to data buffer */ 639983de5f9SThierry Reding uint32_t nbytes; 640*4e871899SJon Hunter } BPMP_ABI_PACKED; 641983de5f9SThierry Reding 642983de5f9SThierry Reding /** 643983de5f9SThierry Reding * @ingroup Debugfs 6444bef358cSTimo Alho * @brief Request with #MRQ_DEBUGFS. 645983de5f9SThierry Reding * 646983de5f9SThierry Reding * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs 647983de5f9SThierry Reding * command to execute. Legal commands are the values of @ref 648983de5f9SThierry Reding * mrq_debugfs_commands. Each command requires a specific additional 649983de5f9SThierry Reding * payload of data. 650983de5f9SThierry Reding * 651983de5f9SThierry Reding * |command |payload| 652983de5f9SThierry Reding * |-------------------|-------| 653983de5f9SThierry Reding * |CMD_DEBUGFS_READ |fop | 654983de5f9SThierry Reding * |CMD_DEBUGFS_WRITE |fop | 655983de5f9SThierry Reding * |CMD_DEBUGFS_DUMPDIR|dumpdir| 656983de5f9SThierry Reding */ 657983de5f9SThierry Reding struct mrq_debugfs_request { 6584bef358cSTimo Alho /** @brief Sub-command (@ref mrq_debugfs_commands) */ 659983de5f9SThierry Reding uint32_t cmd; 660983de5f9SThierry Reding union { 661983de5f9SThierry Reding struct cmd_debugfs_fileop_request fop; 662983de5f9SThierry Reding struct cmd_debugfs_dumpdir_request dumpdir; 663*4e871899SJon Hunter } BPMP_UNION_ANON; 664*4e871899SJon Hunter } BPMP_ABI_PACKED; 665983de5f9SThierry Reding 666983de5f9SThierry Reding /** 667983de5f9SThierry Reding * @ingroup Debugfs 668983de5f9SThierry Reding */ 669983de5f9SThierry Reding struct mrq_debugfs_response { 6704bef358cSTimo Alho /** @brief Always 0 */ 671983de5f9SThierry Reding int32_t reserved; 672983de5f9SThierry Reding union { 6734bef358cSTimo Alho /** @brief Response data for CMD_DEBUGFS_READ OR 674983de5f9SThierry Reding * CMD_DEBUGFS_WRITE command 675983de5f9SThierry Reding */ 676983de5f9SThierry Reding struct cmd_debugfs_fileop_response fop; 6774bef358cSTimo Alho /** @brief Response data for CMD_DEBUGFS_DUMPDIR command */ 678983de5f9SThierry Reding struct cmd_debugfs_dumpdir_response dumpdir; 679*4e871899SJon Hunter } BPMP_UNION_ANON; 680*4e871899SJon Hunter } BPMP_ABI_PACKED; 681983de5f9SThierry Reding 682983de5f9SThierry Reding /** 683983de5f9SThierry Reding * @addtogroup Debugfs 684983de5f9SThierry Reding * @{ 685983de5f9SThierry Reding */ 686983de5f9SThierry Reding #define DEBUGFS_S_ISDIR (1 << 9) 687983de5f9SThierry Reding #define DEBUGFS_S_IRUSR (1 << 8) 688983de5f9SThierry Reding #define DEBUGFS_S_IWUSR (1 << 7) 689983de5f9SThierry Reding /** @} */ 690983de5f9SThierry Reding 691983de5f9SThierry Reding /** 692983de5f9SThierry Reding * @ingroup MRQ_Codes 6935e37b9c1SJon Hunter * @def MRQ_DEBUG 6945e37b9c1SJon Hunter * @brief Interact with BPMP's debugfs file nodes. Use message payload 6955e37b9c1SJon Hunter * for exchanging data. This is functionally equivalent to 6965e37b9c1SJon Hunter * @ref MRQ_DEBUGFS. But the way in which data is exchanged is different. 6975e37b9c1SJon Hunter * When software running on CPU tries to read a debugfs file, 6985e37b9c1SJon Hunter * the file path and read data will be stored in message payload. 6995e37b9c1SJon Hunter * Since the message payload size is limited, a debugfs file 7005e37b9c1SJon Hunter * transaction might require multiple frames of data exchanged 7015e37b9c1SJon Hunter * between BPMP and CPU until the transaction completes. 7025e37b9c1SJon Hunter * 7035e37b9c1SJon Hunter * * Platforms: T194 7045e37b9c1SJon Hunter * * Initiators: Any 7055e37b9c1SJon Hunter * * Targets: BPMP 7065e37b9c1SJon Hunter * * Request Payload: @ref mrq_debug_request 7075e37b9c1SJon Hunter * * Response Payload: @ref mrq_debug_response 7085e37b9c1SJon Hunter */ 7095e37b9c1SJon Hunter 7105e37b9c1SJon Hunter /** @ingroup Debugfs */ 7115e37b9c1SJon Hunter enum mrq_debug_commands { 7125e37b9c1SJon Hunter /** @brief Open required file for read operation */ 7135e37b9c1SJon Hunter CMD_DEBUG_OPEN_RO = 0, 7145e37b9c1SJon Hunter /** @brief Open required file for write operation */ 7155e37b9c1SJon Hunter CMD_DEBUG_OPEN_WO = 1, 7165e37b9c1SJon Hunter /** @brief Perform read */ 7175e37b9c1SJon Hunter CMD_DEBUG_READ = 2, 7185e37b9c1SJon Hunter /** @brief Perform write */ 7195e37b9c1SJon Hunter CMD_DEBUG_WRITE = 3, 7205e37b9c1SJon Hunter /** @brief Close file */ 7215e37b9c1SJon Hunter CMD_DEBUG_CLOSE = 4, 7225e37b9c1SJon Hunter /** @brief Not a command */ 7235e37b9c1SJon Hunter CMD_DEBUG_MAX 7245e37b9c1SJon Hunter }; 7255e37b9c1SJon Hunter 7265e37b9c1SJon Hunter /** 7275e37b9c1SJon Hunter * @ingroup Debugfs 7285e37b9c1SJon Hunter * @brief Maximum number of files that can be open at a given time 7295e37b9c1SJon Hunter */ 7305e37b9c1SJon Hunter #define DEBUG_MAX_OPEN_FILES 1 7315e37b9c1SJon Hunter 7325e37b9c1SJon Hunter /** 7335e37b9c1SJon Hunter * @ingroup Debugfs 7345e37b9c1SJon Hunter * @brief Maximum size of null-terminated file name string in bytes. 7355e37b9c1SJon Hunter * Value is derived from memory available in message payload while 7365e37b9c1SJon Hunter * using @ref cmd_debug_fopen_request 7375e37b9c1SJon Hunter * Value 4 corresponds to size of @ref mrq_debug_commands 7385e37b9c1SJon Hunter * in @ref mrq_debug_request. 7395e37b9c1SJon Hunter * 120 - 4 dbg_cmd(32bit) = 116 7405e37b9c1SJon Hunter */ 7415e37b9c1SJon Hunter #define DEBUG_FNAME_MAX_SZ (MSG_DATA_MIN_SZ - 4) 7425e37b9c1SJon Hunter 7435e37b9c1SJon Hunter /** 7445e37b9c1SJon Hunter * @ingroup Debugfs 7455e37b9c1SJon Hunter * @brief Parameters for CMD_DEBUG_OPEN command 7465e37b9c1SJon Hunter */ 7475e37b9c1SJon Hunter struct cmd_debug_fopen_request { 7485e37b9c1SJon Hunter /** @brief File name - Null-terminated string with maximum 7495e37b9c1SJon Hunter * length @ref DEBUG_FNAME_MAX_SZ 7505e37b9c1SJon Hunter */ 7515e37b9c1SJon Hunter char name[DEBUG_FNAME_MAX_SZ]; 752*4e871899SJon Hunter } BPMP_ABI_PACKED; 7535e37b9c1SJon Hunter 7545e37b9c1SJon Hunter /** 7555e37b9c1SJon Hunter * @ingroup Debugfs 7565e37b9c1SJon Hunter * @brief Response data for CMD_DEBUG_OPEN_RO/WO command 7575e37b9c1SJon Hunter */ 7585e37b9c1SJon Hunter struct cmd_debug_fopen_response { 7595e37b9c1SJon Hunter /** @brief Identifier for file access */ 7605e37b9c1SJon Hunter uint32_t fd; 7615e37b9c1SJon Hunter /** @brief Data length. File data size for READ command. 7625e37b9c1SJon Hunter * Maximum allowed length for WRITE command 7635e37b9c1SJon Hunter */ 7645e37b9c1SJon Hunter uint32_t datalen; 765*4e871899SJon Hunter } BPMP_ABI_PACKED; 7665e37b9c1SJon Hunter 7675e37b9c1SJon Hunter /** 7685e37b9c1SJon Hunter * @ingroup Debugfs 7695e37b9c1SJon Hunter * @brief Parameters for CMD_DEBUG_READ command 7705e37b9c1SJon Hunter */ 7715e37b9c1SJon Hunter struct cmd_debug_fread_request { 7725e37b9c1SJon Hunter /** @brief File access identifier received in response 7735e37b9c1SJon Hunter * to CMD_DEBUG_OPEN_RO request 7745e37b9c1SJon Hunter */ 7755e37b9c1SJon Hunter uint32_t fd; 776*4e871899SJon Hunter } BPMP_ABI_PACKED; 7775e37b9c1SJon Hunter 7785e37b9c1SJon Hunter /** 7795e37b9c1SJon Hunter * @ingroup Debugfs 7805e37b9c1SJon Hunter * @brief Maximum size of read data in bytes. 7815e37b9c1SJon Hunter * Value is derived from memory available in message payload while 7825e37b9c1SJon Hunter * using @ref cmd_debug_fread_response. 7835e37b9c1SJon Hunter */ 7845e37b9c1SJon Hunter #define DEBUG_READ_MAX_SZ (MSG_DATA_MIN_SZ - 4) 7855e37b9c1SJon Hunter 7865e37b9c1SJon Hunter /** 7875e37b9c1SJon Hunter * @ingroup Debugfs 7885e37b9c1SJon Hunter * @brief Response data for CMD_DEBUG_READ command 7895e37b9c1SJon Hunter */ 7905e37b9c1SJon Hunter struct cmd_debug_fread_response { 7915e37b9c1SJon Hunter /** @brief Size of data provided in this response in bytes */ 7925e37b9c1SJon Hunter uint32_t readlen; 7935e37b9c1SJon Hunter /** @brief File data from seek position */ 7945e37b9c1SJon Hunter char data[DEBUG_READ_MAX_SZ]; 795*4e871899SJon Hunter } BPMP_ABI_PACKED; 7965e37b9c1SJon Hunter 7975e37b9c1SJon Hunter /** 7985e37b9c1SJon Hunter * @ingroup Debugfs 7995e37b9c1SJon Hunter * @brief Maximum size of write data in bytes. 8005e37b9c1SJon Hunter * Value is derived from memory available in message payload while 8015e37b9c1SJon Hunter * using @ref cmd_debug_fwrite_request. 8025e37b9c1SJon Hunter */ 8035e37b9c1SJon Hunter #define DEBUG_WRITE_MAX_SZ (MSG_DATA_MIN_SZ - 12) 8045e37b9c1SJon Hunter 8055e37b9c1SJon Hunter /** 8065e37b9c1SJon Hunter * @ingroup Debugfs 8075e37b9c1SJon Hunter * @brief Parameters for CMD_DEBUG_WRITE command 8085e37b9c1SJon Hunter */ 8095e37b9c1SJon Hunter struct cmd_debug_fwrite_request { 8105e37b9c1SJon Hunter /** @brief File access identifier received in response 8115e37b9c1SJon Hunter * to CMD_DEBUG_OPEN_RO request 8125e37b9c1SJon Hunter */ 8135e37b9c1SJon Hunter uint32_t fd; 8145e37b9c1SJon Hunter /** @brief Size of write data in bytes */ 8155e37b9c1SJon Hunter uint32_t datalen; 8165e37b9c1SJon Hunter /** @brief Data to be written */ 8175e37b9c1SJon Hunter char data[DEBUG_WRITE_MAX_SZ]; 818*4e871899SJon Hunter } BPMP_ABI_PACKED; 8195e37b9c1SJon Hunter 8205e37b9c1SJon Hunter /** 8215e37b9c1SJon Hunter * @ingroup Debugfs 8225e37b9c1SJon Hunter * @brief Parameters for CMD_DEBUG_CLOSE command 8235e37b9c1SJon Hunter */ 8245e37b9c1SJon Hunter struct cmd_debug_fclose_request { 8255e37b9c1SJon Hunter /** @brief File access identifier received in response 8265e37b9c1SJon Hunter * to CMD_DEBUG_OPEN_RO request 8275e37b9c1SJon Hunter */ 8285e37b9c1SJon Hunter uint32_t fd; 829*4e871899SJon Hunter } BPMP_ABI_PACKED; 8305e37b9c1SJon Hunter 8315e37b9c1SJon Hunter /** 8325e37b9c1SJon Hunter * @ingroup Debugfs 8335e37b9c1SJon Hunter * @brief Request with #MRQ_DEBUG. 8345e37b9c1SJon Hunter * 8355e37b9c1SJon Hunter * The sender of an MRQ_DEBUG message uses #cmd to specify a debugfs 8365e37b9c1SJon Hunter * command to execute. Legal commands are the values of @ref 8375e37b9c1SJon Hunter * mrq_debug_commands. Each command requires a specific additional 8385e37b9c1SJon Hunter * payload of data. 8395e37b9c1SJon Hunter * 8405e37b9c1SJon Hunter * |command |payload| 8415e37b9c1SJon Hunter * |-------------------|-------| 8425e37b9c1SJon Hunter * |CMD_DEBUG_OPEN_RO |fop | 8435e37b9c1SJon Hunter * |CMD_DEBUG_OPEN_WO |fop | 8445e37b9c1SJon Hunter * |CMD_DEBUG_READ |frd | 8455e37b9c1SJon Hunter * |CMD_DEBUG_WRITE |fwr | 8465e37b9c1SJon Hunter * |CMD_DEBUG_CLOSE |fcl | 8475e37b9c1SJon Hunter */ 8485e37b9c1SJon Hunter struct mrq_debug_request { 8495e37b9c1SJon Hunter /** @brief Sub-command (@ref mrq_debug_commands) */ 8505e37b9c1SJon Hunter uint32_t cmd; 8515e37b9c1SJon Hunter union { 8525e37b9c1SJon Hunter /** @brief Request payload for CMD_DEBUG_OPEN_RO/WO command */ 8535e37b9c1SJon Hunter struct cmd_debug_fopen_request fop; 8545e37b9c1SJon Hunter /** @brief Request payload for CMD_DEBUG_READ command */ 8555e37b9c1SJon Hunter struct cmd_debug_fread_request frd; 8565e37b9c1SJon Hunter /** @brief Request payload for CMD_DEBUG_WRITE command */ 8575e37b9c1SJon Hunter struct cmd_debug_fwrite_request fwr; 8585e37b9c1SJon Hunter /** @brief Request payload for CMD_DEBUG_CLOSE command */ 8595e37b9c1SJon Hunter struct cmd_debug_fclose_request fcl; 860*4e871899SJon Hunter } BPMP_UNION_ANON; 861*4e871899SJon Hunter } BPMP_ABI_PACKED; 8625e37b9c1SJon Hunter 8635e37b9c1SJon Hunter /** 8645e37b9c1SJon Hunter * @ingroup Debugfs 8655e37b9c1SJon Hunter */ 8665e37b9c1SJon Hunter struct mrq_debug_response { 8675e37b9c1SJon Hunter union { 8685e37b9c1SJon Hunter /** @brief Response data for CMD_DEBUG_OPEN_RO/WO command */ 8695e37b9c1SJon Hunter struct cmd_debug_fopen_response fop; 8705e37b9c1SJon Hunter /** @brief Response data for CMD_DEBUG_READ command */ 8715e37b9c1SJon Hunter struct cmd_debug_fread_response frd; 872*4e871899SJon Hunter } BPMP_UNION_ANON; 873*4e871899SJon Hunter } BPMP_ABI_PACKED; 8745e37b9c1SJon Hunter 8755e37b9c1SJon Hunter /** 8765e37b9c1SJon Hunter * @ingroup MRQ_Codes 877983de5f9SThierry Reding * @def MRQ_RESET 8784bef358cSTimo Alho * @brief Reset an IP block 879983de5f9SThierry Reding * 8804bef358cSTimo Alho * * Platforms: T186, T194 881983de5f9SThierry Reding * * Initiators: Any 882983de5f9SThierry Reding * * Targets: BPMP 883983de5f9SThierry Reding * * Request Payload: @ref mrq_reset_request 88452b8b803SThierry Reding * * Response Payload: @ref mrq_reset_response 8854bef358cSTimo Alho * 8864bef358cSTimo Alho * @addtogroup Reset 8874bef358cSTimo Alho * @{ 888983de5f9SThierry Reding */ 889983de5f9SThierry Reding 890983de5f9SThierry Reding enum mrq_reset_commands { 891*4e871899SJon Hunter /** 892*4e871899SJon Hunter * @brief Assert module reset 893*4e871899SJon Hunter * 894*4e871899SJon Hunter * mrq_response::err is 0 if the operation was successful, or @n 895*4e871899SJon Hunter * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n 896*4e871899SJon Hunter * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n 897*4e871899SJon Hunter * -#BPMP_ENOTSUP if target domain h/w state does not allow reset 898*4e871899SJon Hunter */ 899983de5f9SThierry Reding CMD_RESET_ASSERT = 1, 900*4e871899SJon Hunter /** 901*4e871899SJon Hunter * @brief Deassert module reset 902*4e871899SJon Hunter * 903*4e871899SJon Hunter * mrq_response::err is 0 if the operation was successful, or @n 904*4e871899SJon Hunter * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n 905*4e871899SJon Hunter * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n 906*4e871899SJon Hunter * -#BPMP_ENOTSUP if target domain h/w state does not allow reset 907*4e871899SJon Hunter */ 908983de5f9SThierry Reding CMD_RESET_DEASSERT = 2, 909*4e871899SJon Hunter /** 910*4e871899SJon Hunter * @brief Assert and deassert the module reset 911*4e871899SJon Hunter * 912*4e871899SJon Hunter * mrq_response::err is 0 if the operation was successful, or @n 913*4e871899SJon Hunter * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n 914*4e871899SJon Hunter * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n 915*4e871899SJon Hunter * -#BPMP_ENOTSUP if target domain h/w state does not allow reset 916*4e871899SJon Hunter */ 917983de5f9SThierry Reding CMD_RESET_MODULE = 3, 918*4e871899SJon Hunter /** 919*4e871899SJon Hunter * @brief Get the highest reset ID 920*4e871899SJon Hunter * 921*4e871899SJon Hunter * mrq_response::err is 0 if the operation was successful, or @n 922*4e871899SJon Hunter * -#BPMP_ENODEV if no reset domains are supported (number of IDs is 0) 923*4e871899SJon Hunter */ 92452b8b803SThierry Reding CMD_RESET_GET_MAX_ID = 4, 925*4e871899SJon Hunter 9264bef358cSTimo Alho /** @brief Not part of ABI and subject to change */ 9274bef358cSTimo Alho CMD_RESET_MAX, 928983de5f9SThierry Reding }; 929983de5f9SThierry Reding 930983de5f9SThierry Reding /** 9314bef358cSTimo Alho * @brief Request with MRQ_RESET 932983de5f9SThierry Reding * 933983de5f9SThierry Reding * Used by the sender of an #MRQ_RESET message to request BPMP to 934983de5f9SThierry Reding * assert or or deassert a given reset line. 935983de5f9SThierry Reding */ 936983de5f9SThierry Reding struct mrq_reset_request { 9374bef358cSTimo Alho /** @brief Reset action to perform (@ref mrq_reset_commands) */ 938983de5f9SThierry Reding uint32_t cmd; 9394bef358cSTimo Alho /** @brief Id of the reset to affected */ 940983de5f9SThierry Reding uint32_t reset_id; 941*4e871899SJon Hunter } BPMP_ABI_PACKED; 942983de5f9SThierry Reding 943983de5f9SThierry Reding /** 94452b8b803SThierry Reding * @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When 94552b8b803SThierry Reding * this sub-command is not supported, firmware will return -BPMP_EBADCMD 94652b8b803SThierry Reding * in mrq_response::err. 94752b8b803SThierry Reding */ 94852b8b803SThierry Reding struct cmd_reset_get_max_id_response { 9494bef358cSTimo Alho /** @brief Max reset id */ 95052b8b803SThierry Reding uint32_t max_id; 951*4e871899SJon Hunter } BPMP_ABI_PACKED; 95252b8b803SThierry Reding 95352b8b803SThierry Reding /** 95452b8b803SThierry Reding * @brief Response with MRQ_RESET 95552b8b803SThierry Reding * 95652b8b803SThierry Reding * Each sub-command supported by @ref mrq_reset_request may return 95752b8b803SThierry Reding * sub-command-specific data. Some do and some do not as indicated 95852b8b803SThierry Reding * in the following table 95952b8b803SThierry Reding * 96052b8b803SThierry Reding * | sub-command | payload | 96152b8b803SThierry Reding * |----------------------|------------------| 96252b8b803SThierry Reding * | CMD_RESET_ASSERT | - | 96352b8b803SThierry Reding * | CMD_RESET_DEASSERT | - | 96452b8b803SThierry Reding * | CMD_RESET_MODULE | - | 96552b8b803SThierry Reding * | CMD_RESET_GET_MAX_ID | reset_get_max_id | 96652b8b803SThierry Reding */ 96752b8b803SThierry Reding struct mrq_reset_response { 96852b8b803SThierry Reding union { 96952b8b803SThierry Reding struct cmd_reset_get_max_id_response reset_get_max_id; 970*4e871899SJon Hunter } BPMP_UNION_ANON; 971*4e871899SJon Hunter } BPMP_ABI_PACKED; 97252b8b803SThierry Reding 9734bef358cSTimo Alho /** @} */ 9744bef358cSTimo Alho 97552b8b803SThierry Reding /** 976983de5f9SThierry Reding * @ingroup MRQ_Codes 977983de5f9SThierry Reding * @def MRQ_I2C 9784bef358cSTimo Alho * @brief Issue an i2c transaction 979983de5f9SThierry Reding * 9804bef358cSTimo Alho * * Platforms: T186, T194 981983de5f9SThierry Reding * * Initiators: Any 982983de5f9SThierry Reding * * Targets: BPMP 983983de5f9SThierry Reding * * Request Payload: @ref mrq_i2c_request 984983de5f9SThierry Reding * * Response Payload: @ref mrq_i2c_response 9854bef358cSTimo Alho * 986983de5f9SThierry Reding * @addtogroup I2C 987983de5f9SThierry Reding * @{ 988983de5f9SThierry Reding */ 989*4e871899SJon Hunter #define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE (MSG_DATA_MIN_SZ - 12U) 990*4e871899SJon Hunter #define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE (MSG_DATA_MIN_SZ - 4U) 991983de5f9SThierry Reding 992*4e871899SJon Hunter #define SERIALI2C_TEN 0x0010U 993*4e871899SJon Hunter #define SERIALI2C_RD 0x0001U 994*4e871899SJon Hunter #define SERIALI2C_STOP 0x8000U 995*4e871899SJon Hunter #define SERIALI2C_NOSTART 0x4000U 996*4e871899SJon Hunter #define SERIALI2C_REV_DIR_ADDR 0x2000U 997*4e871899SJon Hunter #define SERIALI2C_IGNORE_NAK 0x1000U 998*4e871899SJon Hunter #define SERIALI2C_NO_RD_ACK 0x0800U 999*4e871899SJon Hunter #define SERIALI2C_RECV_LEN 0x0400U 10004bef358cSTimo Alho 1001983de5f9SThierry Reding enum { 1002983de5f9SThierry Reding CMD_I2C_XFER = 1 1003983de5f9SThierry Reding }; 1004983de5f9SThierry Reding 1005983de5f9SThierry Reding /** 10064bef358cSTimo Alho * @brief Serializable i2c request 1007983de5f9SThierry Reding * 1008983de5f9SThierry Reding * Instances of this structure are packed (little-endian) into 1009983de5f9SThierry Reding * cmd_i2c_xfer_request::data_buf. Each instance represents a single 1010983de5f9SThierry Reding * transaction (or a portion of a transaction with repeated starts) on 1011983de5f9SThierry Reding * an i2c bus. 1012983de5f9SThierry Reding * 1013983de5f9SThierry Reding * Because these structures are packed, some instances are likely to 1014983de5f9SThierry Reding * be misaligned. Additionally because #data is variable length, it is 1015983de5f9SThierry Reding * not possible to iterate through a serialized list of these 1016983de5f9SThierry Reding * structures without inspecting #len in each instance. It may be 1017983de5f9SThierry Reding * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf 1018983de5f9SThierry Reding * manually rather than using this structure definition. 1019983de5f9SThierry Reding */ 1020983de5f9SThierry Reding struct serial_i2c_request { 1021983de5f9SThierry Reding /** @brief I2C slave address */ 1022983de5f9SThierry Reding uint16_t addr; 10234bef358cSTimo Alho /** @brief Bitmask of SERIALI2C_ flags */ 1024983de5f9SThierry Reding uint16_t flags; 10254bef358cSTimo Alho /** @brief Length of I2C transaction in bytes */ 1026983de5f9SThierry Reding uint16_t len; 10274bef358cSTimo Alho /** @brief For write transactions only, #len bytes of data */ 1028983de5f9SThierry Reding uint8_t data[]; 1029*4e871899SJon Hunter } BPMP_ABI_PACKED; 1030983de5f9SThierry Reding 1031983de5f9SThierry Reding /** 10324bef358cSTimo Alho * @brief Trigger one or more i2c transactions 1033983de5f9SThierry Reding */ 1034983de5f9SThierry Reding struct cmd_i2c_xfer_request { 10354bef358cSTimo Alho /** @brief Valid bus number from @ref bpmp_i2c_ids*/ 1036983de5f9SThierry Reding uint32_t bus_id; 1037983de5f9SThierry Reding 10384bef358cSTimo Alho /** @brief Count of valid bytes in #data_buf*/ 1039983de5f9SThierry Reding uint32_t data_size; 1040983de5f9SThierry Reding 10414bef358cSTimo Alho /** @brief Serialized packed instances of @ref serial_i2c_request*/ 1042983de5f9SThierry Reding uint8_t data_buf[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE]; 1043*4e871899SJon Hunter } BPMP_ABI_PACKED; 1044983de5f9SThierry Reding 1045983de5f9SThierry Reding /** 10464bef358cSTimo Alho * @brief Container for data read from the i2c bus 1047983de5f9SThierry Reding * 1048983de5f9SThierry Reding * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute 1049983de5f9SThierry Reding * zero or more I2C reads. The data read from the bus is serialized 1050983de5f9SThierry Reding * into #data_buf. 1051983de5f9SThierry Reding */ 1052983de5f9SThierry Reding struct cmd_i2c_xfer_response { 10534bef358cSTimo Alho /** @brief Count of valid bytes in #data_buf*/ 1054983de5f9SThierry Reding uint32_t data_size; 10554bef358cSTimo Alho /** @brief I2c read data */ 1056983de5f9SThierry Reding uint8_t data_buf[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE]; 1057*4e871899SJon Hunter } BPMP_ABI_PACKED; 1058983de5f9SThierry Reding 1059983de5f9SThierry Reding /** 10604bef358cSTimo Alho * @brief Request with #MRQ_I2C 1061983de5f9SThierry Reding */ 1062983de5f9SThierry Reding struct mrq_i2c_request { 10634bef358cSTimo Alho /** @brief Always CMD_I2C_XFER (i.e. 1) */ 1064983de5f9SThierry Reding uint32_t cmd; 10654bef358cSTimo Alho /** @brief Parameters of the transfer request */ 1066983de5f9SThierry Reding struct cmd_i2c_xfer_request xfer; 1067*4e871899SJon Hunter } BPMP_ABI_PACKED; 1068983de5f9SThierry Reding 1069983de5f9SThierry Reding /** 10704bef358cSTimo Alho * @brief Response to #MRQ_I2C 1071*4e871899SJon Hunter * 1072*4e871899SJon Hunter * mrq_response:err is 1073*4e871899SJon Hunter * 0: Success 1074*4e871899SJon Hunter * -#BPMP_EBADCMD: if mrq_i2c_request::cmd is other than 1 1075*4e871899SJon Hunter * -#BPMP_EINVAL: if cmd_i2c_xfer_request does not contain correctly formatted request 1076*4e871899SJon Hunter * -#BPMP_ENODEV: if cmd_i2c_xfer_request::bus_id is not supported by BPMP 1077*4e871899SJon Hunter * -#BPMP_EACCES: if i2c transaction is not allowed due to firewall rules 1078*4e871899SJon Hunter * -#BPMP_ETIMEDOUT: if i2c transaction times out 1079*4e871899SJon Hunter * -#BPMP_ENXIO: if i2c slave device does not reply with ACK to the transaction 1080*4e871899SJon Hunter * -#BPMP_EAGAIN: if ARB_LOST condition is detected by the i2c controller 1081*4e871899SJon Hunter * -#BPMP_EIO: any other i2c controller error code than NO_ACK or ARB_LOST 1082983de5f9SThierry Reding */ 1083983de5f9SThierry Reding struct mrq_i2c_response { 1084983de5f9SThierry Reding struct cmd_i2c_xfer_response xfer; 1085*4e871899SJon Hunter } BPMP_ABI_PACKED; 1086983de5f9SThierry Reding 10874bef358cSTimo Alho /** @} */ 10884bef358cSTimo Alho 1089983de5f9SThierry Reding /** 1090983de5f9SThierry Reding * @ingroup MRQ_Codes 1091983de5f9SThierry Reding * @def MRQ_CLK 10924bef358cSTimo Alho * @brief Perform a clock operation 1093983de5f9SThierry Reding * 10944bef358cSTimo Alho * * Platforms: T186, T194 1095983de5f9SThierry Reding * * Initiators: Any 1096983de5f9SThierry Reding * * Targets: BPMP 1097983de5f9SThierry Reding * * Request Payload: @ref mrq_clk_request 1098983de5f9SThierry Reding * * Response Payload: @ref mrq_clk_response 10994bef358cSTimo Alho * 1100983de5f9SThierry Reding * @addtogroup Clocks 1101983de5f9SThierry Reding * @{ 1102983de5f9SThierry Reding */ 1103983de5f9SThierry Reding enum { 1104983de5f9SThierry Reding CMD_CLK_GET_RATE = 1, 1105983de5f9SThierry Reding CMD_CLK_SET_RATE = 2, 1106983de5f9SThierry Reding CMD_CLK_ROUND_RATE = 3, 1107983de5f9SThierry Reding CMD_CLK_GET_PARENT = 4, 1108983de5f9SThierry Reding CMD_CLK_SET_PARENT = 5, 1109983de5f9SThierry Reding CMD_CLK_IS_ENABLED = 6, 1110983de5f9SThierry Reding CMD_CLK_ENABLE = 7, 1111983de5f9SThierry Reding CMD_CLK_DISABLE = 8, 1112983de5f9SThierry Reding CMD_CLK_GET_ALL_INFO = 14, 1113983de5f9SThierry Reding CMD_CLK_GET_MAX_CLK_ID = 15, 11144bef358cSTimo Alho CMD_CLK_GET_FMAX_AT_VMIN = 16, 1115983de5f9SThierry Reding CMD_CLK_MAX, 1116983de5f9SThierry Reding }; 1117983de5f9SThierry Reding 1118*4e871899SJon Hunter #define BPMP_CLK_HAS_MUX (1U << 0U) 1119*4e871899SJon Hunter #define BPMP_CLK_HAS_SET_RATE (1U << 1U) 1120*4e871899SJon Hunter #define BPMP_CLK_IS_ROOT (1U << 2U) 1121*4e871899SJon Hunter #define BPMP_CLK_IS_VAR_ROOT (1U << 3U) 112252b8b803SThierry Reding 1123*4e871899SJon Hunter #define MRQ_CLK_NAME_MAXLEN 40U 1124*4e871899SJon Hunter #define MRQ_CLK_MAX_PARENTS 16U 1125983de5f9SThierry Reding 1126983de5f9SThierry Reding /** @private */ 1127983de5f9SThierry Reding struct cmd_clk_get_rate_request { 1128*4e871899SJon Hunter BPMP_ABI_EMPTY 1129*4e871899SJon Hunter } BPMP_ABI_PACKED; 1130983de5f9SThierry Reding 1131983de5f9SThierry Reding struct cmd_clk_get_rate_response { 1132983de5f9SThierry Reding int64_t rate; 1133*4e871899SJon Hunter } BPMP_ABI_PACKED; 1134983de5f9SThierry Reding 1135983de5f9SThierry Reding struct cmd_clk_set_rate_request { 1136983de5f9SThierry Reding int32_t unused; 1137983de5f9SThierry Reding int64_t rate; 1138*4e871899SJon Hunter } BPMP_ABI_PACKED; 1139983de5f9SThierry Reding 1140983de5f9SThierry Reding struct cmd_clk_set_rate_response { 1141983de5f9SThierry Reding int64_t rate; 1142*4e871899SJon Hunter } BPMP_ABI_PACKED; 1143983de5f9SThierry Reding 1144983de5f9SThierry Reding struct cmd_clk_round_rate_request { 1145983de5f9SThierry Reding int32_t unused; 1146983de5f9SThierry Reding int64_t rate; 1147*4e871899SJon Hunter } BPMP_ABI_PACKED; 1148983de5f9SThierry Reding 1149983de5f9SThierry Reding struct cmd_clk_round_rate_response { 1150983de5f9SThierry Reding int64_t rate; 1151*4e871899SJon Hunter } BPMP_ABI_PACKED; 1152983de5f9SThierry Reding 1153983de5f9SThierry Reding /** @private */ 1154983de5f9SThierry Reding struct cmd_clk_get_parent_request { 1155*4e871899SJon Hunter BPMP_ABI_EMPTY 1156*4e871899SJon Hunter } BPMP_ABI_PACKED; 1157983de5f9SThierry Reding 1158983de5f9SThierry Reding struct cmd_clk_get_parent_response { 1159983de5f9SThierry Reding uint32_t parent_id; 1160*4e871899SJon Hunter } BPMP_ABI_PACKED; 1161983de5f9SThierry Reding 1162983de5f9SThierry Reding struct cmd_clk_set_parent_request { 1163983de5f9SThierry Reding uint32_t parent_id; 1164*4e871899SJon Hunter } BPMP_ABI_PACKED; 1165983de5f9SThierry Reding 1166983de5f9SThierry Reding struct cmd_clk_set_parent_response { 1167983de5f9SThierry Reding uint32_t parent_id; 1168*4e871899SJon Hunter } BPMP_ABI_PACKED; 1169983de5f9SThierry Reding 1170983de5f9SThierry Reding /** @private */ 1171983de5f9SThierry Reding struct cmd_clk_is_enabled_request { 1172*4e871899SJon Hunter BPMP_ABI_EMPTY 1173*4e871899SJon Hunter } BPMP_ABI_PACKED; 1174983de5f9SThierry Reding 1175*4e871899SJon Hunter /** 1176*4e871899SJon Hunter * @brief Response data to #MRQ_CLK sub-command CMD_CLK_IS_ENABLED 1177*4e871899SJon Hunter */ 1178983de5f9SThierry Reding struct cmd_clk_is_enabled_response { 1179*4e871899SJon Hunter /** 1180*4e871899SJon Hunter * @brief The state of the clock that has been succesfully 1181*4e871899SJon Hunter * requested with CMD_CLK_ENABLE or CMD_CLK_DISABLE by the 1182*4e871899SJon Hunter * master invoking the command earlier. 1183*4e871899SJon Hunter * 1184*4e871899SJon Hunter * The state may not reflect the physical state of the clock 1185*4e871899SJon Hunter * if there are some other masters requesting it to be 1186*4e871899SJon Hunter * enabled. 1187*4e871899SJon Hunter * 1188*4e871899SJon Hunter * Value 0 is disabled, all other values indicate enabled. 1189*4e871899SJon Hunter */ 1190983de5f9SThierry Reding int32_t state; 1191*4e871899SJon Hunter } BPMP_ABI_PACKED; 1192983de5f9SThierry Reding 1193983de5f9SThierry Reding /** @private */ 1194983de5f9SThierry Reding struct cmd_clk_enable_request { 1195*4e871899SJon Hunter BPMP_ABI_EMPTY 1196*4e871899SJon Hunter } BPMP_ABI_PACKED; 1197983de5f9SThierry Reding 1198983de5f9SThierry Reding /** @private */ 1199983de5f9SThierry Reding struct cmd_clk_enable_response { 1200*4e871899SJon Hunter BPMP_ABI_EMPTY 1201*4e871899SJon Hunter } BPMP_ABI_PACKED; 1202983de5f9SThierry Reding 1203983de5f9SThierry Reding /** @private */ 1204983de5f9SThierry Reding struct cmd_clk_disable_request { 1205*4e871899SJon Hunter BPMP_ABI_EMPTY 1206*4e871899SJon Hunter } BPMP_ABI_PACKED; 1207983de5f9SThierry Reding 1208983de5f9SThierry Reding /** @private */ 1209983de5f9SThierry Reding struct cmd_clk_disable_response { 1210*4e871899SJon Hunter BPMP_ABI_EMPTY 1211*4e871899SJon Hunter } BPMP_ABI_PACKED; 1212983de5f9SThierry Reding 1213983de5f9SThierry Reding /** @private */ 1214983de5f9SThierry Reding struct cmd_clk_get_all_info_request { 1215*4e871899SJon Hunter BPMP_ABI_EMPTY 1216*4e871899SJon Hunter } BPMP_ABI_PACKED; 1217983de5f9SThierry Reding 1218983de5f9SThierry Reding struct cmd_clk_get_all_info_response { 1219983de5f9SThierry Reding uint32_t flags; 1220983de5f9SThierry Reding uint32_t parent; 1221983de5f9SThierry Reding uint32_t parents[MRQ_CLK_MAX_PARENTS]; 1222983de5f9SThierry Reding uint8_t num_parents; 1223983de5f9SThierry Reding uint8_t name[MRQ_CLK_NAME_MAXLEN]; 1224*4e871899SJon Hunter } BPMP_ABI_PACKED; 1225983de5f9SThierry Reding 1226983de5f9SThierry Reding /** @private */ 1227983de5f9SThierry Reding struct cmd_clk_get_max_clk_id_request { 1228*4e871899SJon Hunter BPMP_ABI_EMPTY 1229*4e871899SJon Hunter } BPMP_ABI_PACKED; 1230983de5f9SThierry Reding 1231983de5f9SThierry Reding struct cmd_clk_get_max_clk_id_response { 1232983de5f9SThierry Reding uint32_t max_id; 1233*4e871899SJon Hunter } BPMP_ABI_PACKED; 12344bef358cSTimo Alho 12354bef358cSTimo Alho /** @private */ 12364bef358cSTimo Alho struct cmd_clk_get_fmax_at_vmin_request { 1237*4e871899SJon Hunter BPMP_ABI_EMPTY 1238*4e871899SJon Hunter } BPMP_ABI_PACKED; 12394bef358cSTimo Alho 12404bef358cSTimo Alho struct cmd_clk_get_fmax_at_vmin_response { 12414bef358cSTimo Alho int64_t rate; 1242*4e871899SJon Hunter } BPMP_ABI_PACKED; 1243983de5f9SThierry Reding 1244983de5f9SThierry Reding /** 1245983de5f9SThierry Reding * @ingroup Clocks 12464bef358cSTimo Alho * @brief Request with #MRQ_CLK 1247983de5f9SThierry Reding * 1248983de5f9SThierry Reding * Used by the sender of an #MRQ_CLK message to control clocks. The 1249983de5f9SThierry Reding * clk_request is split into several sub-commands. Some sub-commands 1250983de5f9SThierry Reding * require no additional data. Others have a sub-command specific 1251983de5f9SThierry Reding * payload 1252983de5f9SThierry Reding * 1253983de5f9SThierry Reding * |sub-command |payload | 1254983de5f9SThierry Reding * |----------------------------|-----------------------| 1255983de5f9SThierry Reding * |CMD_CLK_GET_RATE |- | 1256983de5f9SThierry Reding * |CMD_CLK_SET_RATE |clk_set_rate | 1257983de5f9SThierry Reding * |CMD_CLK_ROUND_RATE |clk_round_rate | 1258983de5f9SThierry Reding * |CMD_CLK_GET_PARENT |- | 1259983de5f9SThierry Reding * |CMD_CLK_SET_PARENT |clk_set_parent | 1260983de5f9SThierry Reding * |CMD_CLK_IS_ENABLED |- | 1261983de5f9SThierry Reding * |CMD_CLK_ENABLE |- | 1262983de5f9SThierry Reding * |CMD_CLK_DISABLE |- | 1263983de5f9SThierry Reding * |CMD_CLK_GET_ALL_INFO |- | 1264983de5f9SThierry Reding * |CMD_CLK_GET_MAX_CLK_ID |- | 12654bef358cSTimo Alho * |CMD_CLK_GET_FMAX_AT_VMIN |- 12664bef358cSTimo Alho * | 1267983de5f9SThierry Reding * 1268983de5f9SThierry Reding */ 1269983de5f9SThierry Reding 1270983de5f9SThierry Reding struct mrq_clk_request { 12714bef358cSTimo Alho /** @brief Sub-command and clock id concatenated to 32-bit word. 1272983de5f9SThierry Reding * - bits[31..24] is the sub-cmd. 1273983de5f9SThierry Reding * - bits[23..0] is the clock id 1274983de5f9SThierry Reding */ 1275983de5f9SThierry Reding uint32_t cmd_and_id; 1276983de5f9SThierry Reding 1277983de5f9SThierry Reding union { 1278983de5f9SThierry Reding /** @private */ 1279983de5f9SThierry Reding struct cmd_clk_get_rate_request clk_get_rate; 1280983de5f9SThierry Reding struct cmd_clk_set_rate_request clk_set_rate; 1281983de5f9SThierry Reding struct cmd_clk_round_rate_request clk_round_rate; 1282983de5f9SThierry Reding /** @private */ 1283983de5f9SThierry Reding struct cmd_clk_get_parent_request clk_get_parent; 1284983de5f9SThierry Reding struct cmd_clk_set_parent_request clk_set_parent; 1285983de5f9SThierry Reding /** @private */ 1286983de5f9SThierry Reding struct cmd_clk_enable_request clk_enable; 1287983de5f9SThierry Reding /** @private */ 1288983de5f9SThierry Reding struct cmd_clk_disable_request clk_disable; 1289983de5f9SThierry Reding /** @private */ 1290983de5f9SThierry Reding struct cmd_clk_is_enabled_request clk_is_enabled; 1291983de5f9SThierry Reding /** @private */ 1292983de5f9SThierry Reding struct cmd_clk_get_all_info_request clk_get_all_info; 1293983de5f9SThierry Reding /** @private */ 1294983de5f9SThierry Reding struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id; 12954bef358cSTimo Alho /** @private */ 12964bef358cSTimo Alho struct cmd_clk_get_fmax_at_vmin_request clk_get_fmax_at_vmin; 1297*4e871899SJon Hunter } BPMP_UNION_ANON; 1298*4e871899SJon Hunter } BPMP_ABI_PACKED; 1299983de5f9SThierry Reding 1300983de5f9SThierry Reding /** 1301983de5f9SThierry Reding * @ingroup Clocks 13024bef358cSTimo Alho * @brief Response to MRQ_CLK 1303983de5f9SThierry Reding * 1304983de5f9SThierry Reding * Each sub-command supported by @ref mrq_clk_request may return 1305983de5f9SThierry Reding * sub-command-specific data. Some do and some do not as indicated in 1306983de5f9SThierry Reding * the following table 1307983de5f9SThierry Reding * 1308983de5f9SThierry Reding * |sub-command |payload | 1309983de5f9SThierry Reding * |----------------------------|------------------------| 1310983de5f9SThierry Reding * |CMD_CLK_GET_RATE |clk_get_rate | 1311983de5f9SThierry Reding * |CMD_CLK_SET_RATE |clk_set_rate | 1312983de5f9SThierry Reding * |CMD_CLK_ROUND_RATE |clk_round_rate | 1313983de5f9SThierry Reding * |CMD_CLK_GET_PARENT |clk_get_parent | 1314983de5f9SThierry Reding * |CMD_CLK_SET_PARENT |clk_set_parent | 1315983de5f9SThierry Reding * |CMD_CLK_IS_ENABLED |clk_is_enabled | 1316983de5f9SThierry Reding * |CMD_CLK_ENABLE |- | 1317983de5f9SThierry Reding * |CMD_CLK_DISABLE |- | 1318983de5f9SThierry Reding * |CMD_CLK_GET_ALL_INFO |clk_get_all_info | 1319983de5f9SThierry Reding * |CMD_CLK_GET_MAX_CLK_ID |clk_get_max_id | 13204bef358cSTimo Alho * |CMD_CLK_GET_FMAX_AT_VMIN |clk_get_fmax_at_vmin | 1321983de5f9SThierry Reding * 1322983de5f9SThierry Reding */ 1323983de5f9SThierry Reding 1324983de5f9SThierry Reding struct mrq_clk_response { 1325983de5f9SThierry Reding union { 1326983de5f9SThierry Reding struct cmd_clk_get_rate_response clk_get_rate; 1327983de5f9SThierry Reding struct cmd_clk_set_rate_response clk_set_rate; 1328983de5f9SThierry Reding struct cmd_clk_round_rate_response clk_round_rate; 1329983de5f9SThierry Reding struct cmd_clk_get_parent_response clk_get_parent; 1330983de5f9SThierry Reding struct cmd_clk_set_parent_response clk_set_parent; 1331983de5f9SThierry Reding /** @private */ 1332983de5f9SThierry Reding struct cmd_clk_enable_response clk_enable; 1333983de5f9SThierry Reding /** @private */ 1334983de5f9SThierry Reding struct cmd_clk_disable_response clk_disable; 1335983de5f9SThierry Reding struct cmd_clk_is_enabled_response clk_is_enabled; 1336983de5f9SThierry Reding struct cmd_clk_get_all_info_response clk_get_all_info; 1337983de5f9SThierry Reding struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id; 13384bef358cSTimo Alho struct cmd_clk_get_fmax_at_vmin_response clk_get_fmax_at_vmin; 1339*4e871899SJon Hunter } BPMP_UNION_ANON; 1340*4e871899SJon Hunter } BPMP_ABI_PACKED; 1341983de5f9SThierry Reding 13424bef358cSTimo Alho /** @} */ 13434bef358cSTimo Alho 1344983de5f9SThierry Reding /** 1345983de5f9SThierry Reding * @ingroup MRQ_Codes 1346983de5f9SThierry Reding * @def MRQ_QUERY_ABI 13474bef358cSTimo Alho * @brief Check if an MRQ is implemented 1348983de5f9SThierry Reding * 1349983de5f9SThierry Reding * * Platforms: All 1350983de5f9SThierry Reding * * Initiators: Any 135152b8b803SThierry Reding * * Targets: Any except DMCE 1352983de5f9SThierry Reding * * Request Payload: @ref mrq_query_abi_request 1353983de5f9SThierry Reding * * Response Payload: @ref mrq_query_abi_response 1354983de5f9SThierry Reding */ 1355983de5f9SThierry Reding 1356983de5f9SThierry Reding /** 1357983de5f9SThierry Reding * @ingroup ABI_info 13584bef358cSTimo Alho * @brief Request with MRQ_QUERY_ABI 1359983de5f9SThierry Reding * 1360983de5f9SThierry Reding * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported 1361983de5f9SThierry Reding * by the recipient. 1362983de5f9SThierry Reding */ 1363983de5f9SThierry Reding struct mrq_query_abi_request { 1364983de5f9SThierry Reding /** @brief MRQ code to query */ 1365983de5f9SThierry Reding uint32_t mrq; 1366*4e871899SJon Hunter } BPMP_ABI_PACKED; 1367983de5f9SThierry Reding 1368983de5f9SThierry Reding /** 1369983de5f9SThierry Reding * @ingroup ABI_info 13704bef358cSTimo Alho * @brief Response to MRQ_QUERY_ABI 137152b8b803SThierry Reding * 137252b8b803SThierry Reding * @note mrq_response::err of 0 indicates that the query was 137352b8b803SThierry Reding * successful, not that the MRQ itself is supported! 1374983de5f9SThierry Reding */ 1375983de5f9SThierry Reding struct mrq_query_abi_response { 1376983de5f9SThierry Reding /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */ 1377983de5f9SThierry Reding int32_t status; 1378*4e871899SJon Hunter } BPMP_ABI_PACKED; 1379983de5f9SThierry Reding 1380983de5f9SThierry Reding /** 1381983de5f9SThierry Reding * @ingroup MRQ_Codes 1382983de5f9SThierry Reding * @def MRQ_PG_READ_STATE 13834bef358cSTimo Alho * @brief Read the power-gating state of a partition 1384983de5f9SThierry Reding * 1385983de5f9SThierry Reding * * Platforms: T186 13864bef358cSTimo Alho * @cond bpmp_t186 1387983de5f9SThierry Reding * * Initiators: Any 1388983de5f9SThierry Reding * * Targets: BPMP 1389983de5f9SThierry Reding * * Request Payload: @ref mrq_pg_read_state_request 1390983de5f9SThierry Reding * * Response Payload: @ref mrq_pg_read_state_response 1391983de5f9SThierry Reding */ 1392983de5f9SThierry Reding 1393983de5f9SThierry Reding /** 13944bef358cSTimo Alho * @ingroup Powergating 13954bef358cSTimo Alho * @brief Request with #MRQ_PG_READ_STATE 1396983de5f9SThierry Reding * 1397983de5f9SThierry Reding * Used by MRQ_PG_READ_STATE call to read the current state of a 1398983de5f9SThierry Reding * partition. 1399983de5f9SThierry Reding */ 1400983de5f9SThierry Reding struct mrq_pg_read_state_request { 1401983de5f9SThierry Reding /** @brief ID of partition */ 1402983de5f9SThierry Reding uint32_t partition_id; 1403*4e871899SJon Hunter } BPMP_ABI_PACKED; 1404983de5f9SThierry Reding 1405983de5f9SThierry Reding /** 14064bef358cSTimo Alho * @ingroup Powergating 14074bef358cSTimo Alho * @brief Response to MRQ_PG_READ_STATE 1408983de5f9SThierry Reding * @todo define possible errors. 1409983de5f9SThierry Reding */ 1410983de5f9SThierry Reding struct mrq_pg_read_state_response { 14114bef358cSTimo Alho /** @brief Read as don't care */ 1412983de5f9SThierry Reding uint32_t sram_state; 14134bef358cSTimo Alho /** @brief State of power partition 1414983de5f9SThierry Reding * * 0 : off 1415983de5f9SThierry Reding * * 1 : on 1416983de5f9SThierry Reding */ 1417983de5f9SThierry Reding uint32_t logic_state; 1418*4e871899SJon Hunter } BPMP_ABI_PACKED; 14194bef358cSTimo Alho /** @endcond*/ 1420983de5f9SThierry Reding /** @} */ 1421983de5f9SThierry Reding 1422983de5f9SThierry Reding /** 1423983de5f9SThierry Reding * @ingroup MRQ_Codes 1424983de5f9SThierry Reding * @def MRQ_PG_UPDATE_STATE 14254bef358cSTimo Alho * @brief Modify the power-gating state of a partition. In contrast to 142652b8b803SThierry Reding * MRQ_PG calls, the operations that change state (on/off) of power 142752b8b803SThierry Reding * partition are reference counted. 1428983de5f9SThierry Reding * 1429983de5f9SThierry Reding * * Platforms: T186 14304bef358cSTimo Alho * @cond bpmp_t186 1431983de5f9SThierry Reding * * Initiators: Any 1432983de5f9SThierry Reding * * Targets: BPMP 1433983de5f9SThierry Reding * * Request Payload: @ref mrq_pg_update_state_request 1434983de5f9SThierry Reding * * Response Payload: N/A 1435983de5f9SThierry Reding */ 1436983de5f9SThierry Reding 1437983de5f9SThierry Reding /** 14384bef358cSTimo Alho * @ingroup Powergating 14394bef358cSTimo Alho * @brief Request with mrq_pg_update_state_request 1440983de5f9SThierry Reding * 1441983de5f9SThierry Reding * Used by #MRQ_PG_UPDATE_STATE call to request BPMP to change the 1442983de5f9SThierry Reding * state of a power partition #partition_id. 1443983de5f9SThierry Reding */ 1444983de5f9SThierry Reding struct mrq_pg_update_state_request { 1445983de5f9SThierry Reding /** @brief ID of partition */ 1446983de5f9SThierry Reding uint32_t partition_id; 14474bef358cSTimo Alho /** @brief Secondary control of power partition 1448983de5f9SThierry Reding * @details Ignored by many versions of the BPMP 1449983de5f9SThierry Reding * firmware. For maximum compatibility, set the value 14504bef358cSTimo Alho * according to @ref logic_state 1451983de5f9SThierry Reding * * 0x1: power ON partition (@ref logic_state == 0x3) 1452983de5f9SThierry Reding * * 0x3: power OFF partition (@ref logic_state == 0x1) 1453983de5f9SThierry Reding */ 1454983de5f9SThierry Reding uint32_t sram_state; 14554bef358cSTimo Alho /** @brief Controls state of power partition, legal values are 1456983de5f9SThierry Reding * * 0x1 : power OFF partition 1457983de5f9SThierry Reding * * 0x3 : power ON partition 1458983de5f9SThierry Reding */ 1459983de5f9SThierry Reding uint32_t logic_state; 14604bef358cSTimo Alho /** @brief Change state of clocks of the power partition, legal values 1461983de5f9SThierry Reding * * 0x0 : do not change clock state 1462983de5f9SThierry Reding * * 0x1 : disable partition clocks (only applicable when 1463983de5f9SThierry Reding * @ref logic_state == 0x1) 1464983de5f9SThierry Reding * * 0x3 : enable partition clocks (only applicable when 1465983de5f9SThierry Reding * @ref logic_state == 0x3) 1466983de5f9SThierry Reding */ 1467983de5f9SThierry Reding uint32_t clock_state; 1468*4e871899SJon Hunter } BPMP_ABI_PACKED; 14694bef358cSTimo Alho /** @endcond*/ 1470983de5f9SThierry Reding 1471983de5f9SThierry Reding /** 1472983de5f9SThierry Reding * @ingroup MRQ_Codes 147352b8b803SThierry Reding * @def MRQ_PG 147452b8b803SThierry Reding * @brief Control power-gating state of a partition. In contrast to 147552b8b803SThierry Reding * MRQ_PG_UPDATE_STATE, operations that change the power partition 147652b8b803SThierry Reding * state are NOT reference counted 147752b8b803SThierry Reding * 14784bef358cSTimo Alho * @note BPMP-FW forcefully turns off some partitions as part of SC7 entry 14794bef358cSTimo Alho * because their state cannot be adequately restored on exit. Therefore, 14804bef358cSTimo Alho * it is recommended to power off all domains via MRQ_PG prior to SC7 entry. 14814bef358cSTimo Alho * See @ref bpmp_pdomain_ids for further detail. 14824bef358cSTimo Alho * 14834bef358cSTimo Alho * * Platforms: T186, T194 148452b8b803SThierry Reding * * Initiators: Any 148552b8b803SThierry Reding * * Targets: BPMP 148652b8b803SThierry Reding * * Request Payload: @ref mrq_pg_request 148752b8b803SThierry Reding * * Response Payload: @ref mrq_pg_response 14884bef358cSTimo Alho * 148952b8b803SThierry Reding * @addtogroup Powergating 149052b8b803SThierry Reding * @{ 149152b8b803SThierry Reding */ 149252b8b803SThierry Reding enum mrq_pg_cmd { 149352b8b803SThierry Reding /** 149452b8b803SThierry Reding * @brief Check whether the BPMP driver supports the specified 149552b8b803SThierry Reding * request type 149652b8b803SThierry Reding * 149752b8b803SThierry Reding * mrq_response::err is 0 if the specified request is 149852b8b803SThierry Reding * supported and -#BPMP_ENODEV otherwise. 149952b8b803SThierry Reding */ 150052b8b803SThierry Reding CMD_PG_QUERY_ABI = 0, 150152b8b803SThierry Reding 150252b8b803SThierry Reding /** 150352b8b803SThierry Reding * @brief Set the current state of specified power domain. The 150452b8b803SThierry Reding * possible values for power domains are defined in enum 150552b8b803SThierry Reding * pg_states 150652b8b803SThierry Reding * 150752b8b803SThierry Reding * mrq_response:err is 150852b8b803SThierry Reding * 0: Success 150952b8b803SThierry Reding * -#BPMP_EINVAL: Invalid request parameters 151052b8b803SThierry Reding */ 151152b8b803SThierry Reding CMD_PG_SET_STATE = 1, 151252b8b803SThierry Reding 151352b8b803SThierry Reding /** 151452b8b803SThierry Reding * @brief Get the current state of specified power domain. The 151552b8b803SThierry Reding * possible values for power domains are defined in enum 151652b8b803SThierry Reding * pg_states 151752b8b803SThierry Reding * 151852b8b803SThierry Reding * mrq_response:err is 151952b8b803SThierry Reding * 0: Success 152052b8b803SThierry Reding * -#BPMP_EINVAL: Invalid request parameters 152152b8b803SThierry Reding */ 152252b8b803SThierry Reding CMD_PG_GET_STATE = 2, 152352b8b803SThierry Reding 152452b8b803SThierry Reding /** 15254bef358cSTimo Alho * @brief Get the name string of specified power domain id. 152652b8b803SThierry Reding * 152752b8b803SThierry Reding * mrq_response:err is 152852b8b803SThierry Reding * 0: Success 152952b8b803SThierry Reding * -#BPMP_EINVAL: Invalid request parameters 153052b8b803SThierry Reding */ 153152b8b803SThierry Reding CMD_PG_GET_NAME = 3, 153252b8b803SThierry Reding 153352b8b803SThierry Reding 153452b8b803SThierry Reding /** 15354bef358cSTimo Alho * @brief Get the highest power domain id in the system. Not 153652b8b803SThierry Reding * all IDs between 0 and max_id are valid IDs. 153752b8b803SThierry Reding * 153852b8b803SThierry Reding * mrq_response:err is 153952b8b803SThierry Reding * 0: Success 154052b8b803SThierry Reding * -#BPMP_EINVAL: Invalid request parameters 154152b8b803SThierry Reding */ 154252b8b803SThierry Reding CMD_PG_GET_MAX_ID = 4, 154352b8b803SThierry Reding }; 154452b8b803SThierry Reding 154552b8b803SThierry Reding #define MRQ_PG_NAME_MAXLEN 40 154652b8b803SThierry Reding 154752b8b803SThierry Reding enum pg_states { 15484bef358cSTimo Alho /** @brief Power domain is OFF */ 154952b8b803SThierry Reding PG_STATE_OFF = 0, 15504bef358cSTimo Alho /** @brief Power domain is ON */ 155152b8b803SThierry Reding PG_STATE_ON = 1, 15524bef358cSTimo Alho /** 15534bef358cSTimo Alho * @brief a legacy state where power domain and the clock 15544bef358cSTimo Alho * associated to the domain are ON. 15554bef358cSTimo Alho * This state is only supported in T186, and the use of it is 15564bef358cSTimo Alho * deprecated. 15574bef358cSTimo Alho */ 155852b8b803SThierry Reding PG_STATE_RUNNING = 2, 155952b8b803SThierry Reding }; 156052b8b803SThierry Reding 156152b8b803SThierry Reding struct cmd_pg_query_abi_request { 15624bef358cSTimo Alho /** @ref mrq_pg_cmd */ 15634bef358cSTimo Alho uint32_t type; 1564*4e871899SJon Hunter } BPMP_ABI_PACKED; 156552b8b803SThierry Reding 156652b8b803SThierry Reding struct cmd_pg_set_state_request { 15674bef358cSTimo Alho /** @ref pg_states */ 15684bef358cSTimo Alho uint32_t state; 1569*4e871899SJon Hunter } BPMP_ABI_PACKED; 157052b8b803SThierry Reding 1571*4e871899SJon Hunter /** 1572*4e871899SJon Hunter * @brief Response data to #MRQ_PG sub command #CMD_PG_GET_STATE 1573*4e871899SJon Hunter */ 157452b8b803SThierry Reding struct cmd_pg_get_state_response { 1575*4e871899SJon Hunter /** 1576*4e871899SJon Hunter * @brief The state of the power partition that has been 1577*4e871899SJon Hunter * succesfuly requested by the master earlier using #MRQ_PG 1578*4e871899SJon Hunter * command #CMD_PG_SET_STATE. 1579*4e871899SJon Hunter * 1580*4e871899SJon Hunter * The state may not reflect the physical state of the power 1581*4e871899SJon Hunter * partition if there are some other masters requesting it to 1582*4e871899SJon Hunter * be enabled. 1583*4e871899SJon Hunter * 1584*4e871899SJon Hunter * See @ref pg_states for possible values 1585*4e871899SJon Hunter */ 15864bef358cSTimo Alho uint32_t state; 1587*4e871899SJon Hunter } BPMP_ABI_PACKED; 158852b8b803SThierry Reding 158952b8b803SThierry Reding struct cmd_pg_get_name_response { 159052b8b803SThierry Reding uint8_t name[MRQ_PG_NAME_MAXLEN]; 1591*4e871899SJon Hunter } BPMP_ABI_PACKED; 159252b8b803SThierry Reding 159352b8b803SThierry Reding struct cmd_pg_get_max_id_response { 159452b8b803SThierry Reding uint32_t max_id; 1595*4e871899SJon Hunter } BPMP_ABI_PACKED; 159652b8b803SThierry Reding 159752b8b803SThierry Reding /** 15984bef358cSTimo Alho * @brief Request with #MRQ_PG 159952b8b803SThierry Reding * 160052b8b803SThierry Reding * Used by the sender of an #MRQ_PG message to control power 160152b8b803SThierry Reding * partitions. The pg_request is split into several sub-commands. Some 160252b8b803SThierry Reding * sub-commands require no additional data. Others have a sub-command 160352b8b803SThierry Reding * specific payload 160452b8b803SThierry Reding * 160552b8b803SThierry Reding * |sub-command |payload | 160652b8b803SThierry Reding * |----------------------------|-----------------------| 160752b8b803SThierry Reding * |CMD_PG_QUERY_ABI | query_abi | 160852b8b803SThierry Reding * |CMD_PG_SET_STATE | set_state | 160952b8b803SThierry Reding * |CMD_PG_GET_STATE | - | 161052b8b803SThierry Reding * |CMD_PG_GET_NAME | - | 161152b8b803SThierry Reding * |CMD_PG_GET_MAX_ID | - | 161252b8b803SThierry Reding * 161352b8b803SThierry Reding */ 161452b8b803SThierry Reding struct mrq_pg_request { 161552b8b803SThierry Reding uint32_t cmd; 161652b8b803SThierry Reding uint32_t id; 161752b8b803SThierry Reding union { 161852b8b803SThierry Reding struct cmd_pg_query_abi_request query_abi; 161952b8b803SThierry Reding struct cmd_pg_set_state_request set_state; 1620*4e871899SJon Hunter } BPMP_UNION_ANON; 1621*4e871899SJon Hunter } BPMP_ABI_PACKED; 162252b8b803SThierry Reding 162352b8b803SThierry Reding /** 16244bef358cSTimo Alho * @brief Response to MRQ_PG 162552b8b803SThierry Reding * 162652b8b803SThierry Reding * Each sub-command supported by @ref mrq_pg_request may return 162752b8b803SThierry Reding * sub-command-specific data. Some do and some do not as indicated in 162852b8b803SThierry Reding * the following table 162952b8b803SThierry Reding * 163052b8b803SThierry Reding * |sub-command |payload | 163152b8b803SThierry Reding * |----------------------------|-----------------------| 163252b8b803SThierry Reding * |CMD_PG_QUERY_ABI | - | 163352b8b803SThierry Reding * |CMD_PG_SET_STATE | - | 163452b8b803SThierry Reding * |CMD_PG_GET_STATE | get_state | 163552b8b803SThierry Reding * |CMD_PG_GET_NAME | get_name | 163652b8b803SThierry Reding * |CMD_PG_GET_MAX_ID | get_max_id | 163752b8b803SThierry Reding */ 163852b8b803SThierry Reding struct mrq_pg_response { 163952b8b803SThierry Reding union { 164052b8b803SThierry Reding struct cmd_pg_get_state_response get_state; 164152b8b803SThierry Reding struct cmd_pg_get_name_response get_name; 164252b8b803SThierry Reding struct cmd_pg_get_max_id_response get_max_id; 1643*4e871899SJon Hunter } BPMP_UNION_ANON; 1644*4e871899SJon Hunter } BPMP_ABI_PACKED; 164552b8b803SThierry Reding 16464bef358cSTimo Alho /** @} */ 16474bef358cSTimo Alho 164852b8b803SThierry Reding /** 164952b8b803SThierry Reding * @ingroup MRQ_Codes 1650983de5f9SThierry Reding * @def MRQ_THERMAL 16514bef358cSTimo Alho * @brief Interact with BPMP thermal framework 1652983de5f9SThierry Reding * 16534bef358cSTimo Alho * * Platforms: T186, T194 1654983de5f9SThierry Reding * * Initiators: Any 1655983de5f9SThierry Reding * * Targets: Any 1656983de5f9SThierry Reding * * Request Payload: TODO 1657983de5f9SThierry Reding * * Response Payload: TODO 1658983de5f9SThierry Reding * 1659983de5f9SThierry Reding * @addtogroup Thermal 1660983de5f9SThierry Reding * 1661983de5f9SThierry Reding * The BPMP firmware includes a thermal framework. Drivers within the 1662983de5f9SThierry Reding * bpmp firmware register with the framework to provide thermal 1663983de5f9SThierry Reding * zones. Each thermal zone corresponds to an entity whose temperature 1664983de5f9SThierry Reding * can be measured. The framework also has a notion of trip points. A 1665983de5f9SThierry Reding * trip point consists of a thermal zone id, a temperature, and a 1666983de5f9SThierry Reding * callback routine. The framework invokes the callback when the zone 1667983de5f9SThierry Reding * hits the indicated temperature. The BPMP firmware uses this thermal 1668983de5f9SThierry Reding * framework interally to implement various temperature-dependent 1669983de5f9SThierry Reding * functions. 1670983de5f9SThierry Reding * 1671983de5f9SThierry Reding * Software on the CPU can use #MRQ_THERMAL (with payload @ref 1672983de5f9SThierry Reding * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal 1673983de5f9SThierry Reding * framework. The CPU must It can query the number of supported zones, 1674983de5f9SThierry Reding * query zone temperatures, and set trip points. 1675983de5f9SThierry Reding * 1676983de5f9SThierry Reding * When a trip point set by the CPU gets crossed, BPMP firmware issues 1677983de5f9SThierry Reding * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a 1678983de5f9SThierry Reding * payload of @ref mrq_thermal_bpmp_to_host_request. 1679983de5f9SThierry Reding * @{ 1680983de5f9SThierry Reding */ 1681983de5f9SThierry Reding enum mrq_thermal_host_to_bpmp_cmd { 1682983de5f9SThierry Reding /** 1683983de5f9SThierry Reding * @brief Check whether the BPMP driver supports the specified 1684983de5f9SThierry Reding * request type. 1685983de5f9SThierry Reding * 1686983de5f9SThierry Reding * Host needs to supply request parameters. 1687983de5f9SThierry Reding * 1688983de5f9SThierry Reding * mrq_response::err is 0 if the specified request is 1689983de5f9SThierry Reding * supported and -#BPMP_ENODEV otherwise. 1690983de5f9SThierry Reding */ 1691983de5f9SThierry Reding CMD_THERMAL_QUERY_ABI = 0, 1692983de5f9SThierry Reding 1693983de5f9SThierry Reding /** 1694983de5f9SThierry Reding * @brief Get the current temperature of the specified zone. 1695983de5f9SThierry Reding * 1696983de5f9SThierry Reding * Host needs to supply request parameters. 1697983de5f9SThierry Reding * 1698983de5f9SThierry Reding * mrq_response::err is 1699983de5f9SThierry Reding * * 0: Temperature query succeeded. 1700983de5f9SThierry Reding * * -#BPMP_EINVAL: Invalid request parameters. 1701983de5f9SThierry Reding * * -#BPMP_ENOENT: No driver registered for thermal zone.. 1702983de5f9SThierry Reding * * -#BPMP_EFAULT: Problem reading temperature measurement. 1703983de5f9SThierry Reding */ 1704983de5f9SThierry Reding CMD_THERMAL_GET_TEMP = 1, 1705983de5f9SThierry Reding 1706983de5f9SThierry Reding /** 1707983de5f9SThierry Reding * @brief Enable or disable and set the lower and upper 1708983de5f9SThierry Reding * thermal limits for a thermal trip point. Each zone has 1709983de5f9SThierry Reding * one trip point. 1710983de5f9SThierry Reding * 1711983de5f9SThierry Reding * Host needs to supply request parameters. Once the 1712983de5f9SThierry Reding * temperature hits a trip point, the BPMP will send a message 1713983de5f9SThierry Reding * to the CPU having MRQ=MRQ_THERMAL and 1714983de5f9SThierry Reding * type=CMD_THERMAL_HOST_TRIP_REACHED 1715983de5f9SThierry Reding * 1716983de5f9SThierry Reding * mrq_response::err is 1717983de5f9SThierry Reding * * 0: Trip successfully set. 1718983de5f9SThierry Reding * * -#BPMP_EINVAL: Invalid request parameters. 1719983de5f9SThierry Reding * * -#BPMP_ENOENT: No driver registered for thermal zone. 1720983de5f9SThierry Reding * * -#BPMP_EFAULT: Problem setting trip point. 1721983de5f9SThierry Reding */ 1722983de5f9SThierry Reding CMD_THERMAL_SET_TRIP = 2, 1723983de5f9SThierry Reding 1724983de5f9SThierry Reding /** 1725983de5f9SThierry Reding * @brief Get the number of supported thermal zones. 1726983de5f9SThierry Reding * 1727983de5f9SThierry Reding * No request parameters required. 1728983de5f9SThierry Reding * 1729983de5f9SThierry Reding * mrq_response::err is always 0, indicating success. 1730983de5f9SThierry Reding */ 1731983de5f9SThierry Reding CMD_THERMAL_GET_NUM_ZONES = 3, 1732983de5f9SThierry Reding 1733*4e871899SJon Hunter /** 1734*4e871899SJon Hunter * @brief Get the thermtrip of the specified zone. 1735*4e871899SJon Hunter * 1736*4e871899SJon Hunter * Host needs to supply request parameters. 1737*4e871899SJon Hunter * 1738*4e871899SJon Hunter * mrq_response::err is 1739*4e871899SJon Hunter * * 0: Valid zone information returned. 1740*4e871899SJon Hunter * * -#BPMP_EINVAL: Invalid request parameters. 1741*4e871899SJon Hunter * * -#BPMP_ENOENT: No driver registered for thermal zone. 1742*4e871899SJon Hunter * * -#BPMP_ERANGE if thermtrip is invalid or disabled. 1743*4e871899SJon Hunter * * -#BPMP_EFAULT: Problem reading zone information. 1744*4e871899SJon Hunter */ 1745*4e871899SJon Hunter CMD_THERMAL_GET_THERMTRIP = 4, 1746*4e871899SJon Hunter 1747983de5f9SThierry Reding /** @brief: number of supported host-to-bpmp commands. May 1748983de5f9SThierry Reding * increase in future 1749983de5f9SThierry Reding */ 1750983de5f9SThierry Reding CMD_THERMAL_HOST_TO_BPMP_NUM 1751983de5f9SThierry Reding }; 1752983de5f9SThierry Reding 1753983de5f9SThierry Reding enum mrq_thermal_bpmp_to_host_cmd { 1754983de5f9SThierry Reding /** 1755983de5f9SThierry Reding * @brief Indication that the temperature for a zone has 1756983de5f9SThierry Reding * exceeded the range indicated in the thermal trip point 1757983de5f9SThierry Reding * for the zone. 1758983de5f9SThierry Reding * 1759983de5f9SThierry Reding * BPMP needs to supply request parameters. Host only needs to 1760983de5f9SThierry Reding * acknowledge. 1761983de5f9SThierry Reding */ 1762983de5f9SThierry Reding CMD_THERMAL_HOST_TRIP_REACHED = 100, 1763983de5f9SThierry Reding 1764983de5f9SThierry Reding /** @brief: number of supported bpmp-to-host commands. May 1765983de5f9SThierry Reding * increase in future 1766983de5f9SThierry Reding */ 1767983de5f9SThierry Reding CMD_THERMAL_BPMP_TO_HOST_NUM 1768983de5f9SThierry Reding }; 1769983de5f9SThierry Reding 1770983de5f9SThierry Reding /* 1771983de5f9SThierry Reding * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI 1772983de5f9SThierry Reding * 1773983de5f9SThierry Reding * zone: Request type for which to check existence. 1774983de5f9SThierry Reding */ 1775983de5f9SThierry Reding struct cmd_thermal_query_abi_request { 1776983de5f9SThierry Reding uint32_t type; 1777*4e871899SJon Hunter } BPMP_ABI_PACKED; 1778983de5f9SThierry Reding 1779983de5f9SThierry Reding /* 1780983de5f9SThierry Reding * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP 1781983de5f9SThierry Reding * 1782983de5f9SThierry Reding * zone: Number of thermal zone. 1783983de5f9SThierry Reding */ 1784983de5f9SThierry Reding struct cmd_thermal_get_temp_request { 1785983de5f9SThierry Reding uint32_t zone; 1786*4e871899SJon Hunter } BPMP_ABI_PACKED; 1787983de5f9SThierry Reding 1788983de5f9SThierry Reding /* 1789983de5f9SThierry Reding * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP 1790983de5f9SThierry Reding * 1791983de5f9SThierry Reding * error: 0 if request succeeded. 1792983de5f9SThierry Reding * -BPMP_EINVAL if request parameters were invalid. 1793983de5f9SThierry Reding * -BPMP_ENOENT if no driver was registered for the specified thermal zone. 1794983de5f9SThierry Reding * -BPMP_EFAULT for other thermal zone driver errors. 1795983de5f9SThierry Reding * temp: Current temperature in millicelsius. 1796983de5f9SThierry Reding */ 1797983de5f9SThierry Reding struct cmd_thermal_get_temp_response { 1798983de5f9SThierry Reding int32_t temp; 1799*4e871899SJon Hunter } BPMP_ABI_PACKED; 1800983de5f9SThierry Reding 1801983de5f9SThierry Reding /* 1802983de5f9SThierry Reding * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP 1803983de5f9SThierry Reding * 1804983de5f9SThierry Reding * zone: Number of thermal zone. 1805983de5f9SThierry Reding * low: Temperature of lower trip point in millicelsius 1806983de5f9SThierry Reding * high: Temperature of upper trip point in millicelsius 1807983de5f9SThierry Reding * enabled: 1 to enable trip point, 0 to disable trip point 1808983de5f9SThierry Reding */ 1809983de5f9SThierry Reding struct cmd_thermal_set_trip_request { 1810983de5f9SThierry Reding uint32_t zone; 1811983de5f9SThierry Reding int32_t low; 1812983de5f9SThierry Reding int32_t high; 1813983de5f9SThierry Reding uint32_t enabled; 1814*4e871899SJon Hunter } BPMP_ABI_PACKED; 1815983de5f9SThierry Reding 1816983de5f9SThierry Reding /* 1817983de5f9SThierry Reding * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED 1818983de5f9SThierry Reding * 1819983de5f9SThierry Reding * zone: Number of thermal zone where trip point was reached. 1820983de5f9SThierry Reding */ 1821983de5f9SThierry Reding struct cmd_thermal_host_trip_reached_request { 1822983de5f9SThierry Reding uint32_t zone; 1823*4e871899SJon Hunter } BPMP_ABI_PACKED; 1824983de5f9SThierry Reding 1825983de5f9SThierry Reding /* 1826983de5f9SThierry Reding * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES 1827983de5f9SThierry Reding * 1828983de5f9SThierry Reding * num: Number of supported thermal zones. The thermal zones are indexed 1829983de5f9SThierry Reding * starting from zero. 1830983de5f9SThierry Reding */ 1831983de5f9SThierry Reding struct cmd_thermal_get_num_zones_response { 1832983de5f9SThierry Reding uint32_t num; 1833*4e871899SJon Hunter } BPMP_ABI_PACKED; 1834*4e871899SJon Hunter 1835*4e871899SJon Hunter /* 1836*4e871899SJon Hunter * Host->BPMP request data for request type CMD_THERMAL_GET_THERMTRIP 1837*4e871899SJon Hunter * 1838*4e871899SJon Hunter * zone: Number of thermal zone. 1839*4e871899SJon Hunter */ 1840*4e871899SJon Hunter struct cmd_thermal_get_thermtrip_request { 1841*4e871899SJon Hunter uint32_t zone; 1842*4e871899SJon Hunter } BPMP_ABI_PACKED; 1843*4e871899SJon Hunter 1844*4e871899SJon Hunter /* 1845*4e871899SJon Hunter * BPMP->Host reply data for request CMD_THERMAL_GET_THERMTRIP 1846*4e871899SJon Hunter * 1847*4e871899SJon Hunter * thermtrip: HW shutdown temperature in millicelsius. 1848*4e871899SJon Hunter */ 1849*4e871899SJon Hunter struct cmd_thermal_get_thermtrip_response { 1850*4e871899SJon Hunter int32_t thermtrip; 1851*4e871899SJon Hunter } BPMP_ABI_PACKED; 1852983de5f9SThierry Reding 1853983de5f9SThierry Reding /* 1854983de5f9SThierry Reding * Host->BPMP request data. 1855983de5f9SThierry Reding * 1856983de5f9SThierry Reding * Reply type is union mrq_thermal_bpmp_to_host_response. 1857983de5f9SThierry Reding * 1858983de5f9SThierry Reding * type: Type of request. Values listed in enum mrq_thermal_type. 1859983de5f9SThierry Reding * data: Request type specific parameters. 1860983de5f9SThierry Reding */ 1861983de5f9SThierry Reding struct mrq_thermal_host_to_bpmp_request { 1862983de5f9SThierry Reding uint32_t type; 1863983de5f9SThierry Reding union { 1864983de5f9SThierry Reding struct cmd_thermal_query_abi_request query_abi; 1865983de5f9SThierry Reding struct cmd_thermal_get_temp_request get_temp; 1866983de5f9SThierry Reding struct cmd_thermal_set_trip_request set_trip; 1867*4e871899SJon Hunter struct cmd_thermal_get_thermtrip_request get_thermtrip; 1868*4e871899SJon Hunter } BPMP_UNION_ANON; 1869*4e871899SJon Hunter } BPMP_ABI_PACKED; 1870983de5f9SThierry Reding 1871983de5f9SThierry Reding /* 1872983de5f9SThierry Reding * BPMP->Host request data. 1873983de5f9SThierry Reding * 1874983de5f9SThierry Reding * type: Type of request. Values listed in enum mrq_thermal_type. 1875983de5f9SThierry Reding * data: Request type specific parameters. 1876983de5f9SThierry Reding */ 1877983de5f9SThierry Reding struct mrq_thermal_bpmp_to_host_request { 1878983de5f9SThierry Reding uint32_t type; 1879983de5f9SThierry Reding union { 1880983de5f9SThierry Reding struct cmd_thermal_host_trip_reached_request host_trip_reached; 1881*4e871899SJon Hunter } BPMP_UNION_ANON; 1882*4e871899SJon Hunter } BPMP_ABI_PACKED; 1883983de5f9SThierry Reding 1884983de5f9SThierry Reding /* 1885983de5f9SThierry Reding * Data in reply to a Host->BPMP request. 1886983de5f9SThierry Reding */ 1887983de5f9SThierry Reding union mrq_thermal_bpmp_to_host_response { 1888983de5f9SThierry Reding struct cmd_thermal_get_temp_response get_temp; 1889*4e871899SJon Hunter struct cmd_thermal_get_thermtrip_response get_thermtrip; 1890983de5f9SThierry Reding struct cmd_thermal_get_num_zones_response get_num_zones; 1891*4e871899SJon Hunter } BPMP_ABI_PACKED; 1892983de5f9SThierry Reding /** @} */ 1893983de5f9SThierry Reding 1894983de5f9SThierry Reding /** 1895983de5f9SThierry Reding * @ingroup MRQ_Codes 1896983de5f9SThierry Reding * @def MRQ_CPU_VHINT 1897983de5f9SThierry Reding * @brief Query CPU voltage hint data 1898983de5f9SThierry Reding * 1899983de5f9SThierry Reding * * Platforms: T186 19004bef358cSTimo Alho * @cond bpmp_t186 1901983de5f9SThierry Reding * * Initiators: CCPLEX 1902983de5f9SThierry Reding * * Targets: BPMP 1903983de5f9SThierry Reding * * Request Payload: @ref mrq_cpu_vhint_request 1904983de5f9SThierry Reding * * Response Payload: N/A 1905983de5f9SThierry Reding * 19064bef358cSTimo Alho * @addtogroup Vhint 1907983de5f9SThierry Reding * @{ 1908983de5f9SThierry Reding */ 1909983de5f9SThierry Reding 1910983de5f9SThierry Reding /** 19114bef358cSTimo Alho * @brief Request with #MRQ_CPU_VHINT 1912983de5f9SThierry Reding * 1913983de5f9SThierry Reding * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data 1914983de5f9SThierry Reding * from BPMP to memory space pointed by #addr. CCPLEX is responsible 1915983de5f9SThierry Reding * to allocate sizeof(cpu_vhint_data) sized block of memory and 1916983de5f9SThierry Reding * appropriately map it for BPMP before sending the request. 1917983de5f9SThierry Reding */ 1918983de5f9SThierry Reding struct mrq_cpu_vhint_request { 1919983de5f9SThierry Reding /** @brief IOVA address for the #cpu_vhint_data */ 19204bef358cSTimo Alho uint32_t addr; 1921983de5f9SThierry Reding /** @brief ID of the cluster whose data is requested */ 19224bef358cSTimo Alho uint32_t cluster_id; 1923*4e871899SJon Hunter } BPMP_ABI_PACKED; 1924983de5f9SThierry Reding 1925983de5f9SThierry Reding /** 19264bef358cSTimo Alho * @brief Description of the CPU v/f relation 1927983de5f9SThierry Reding * 19284bef358cSTimo Alho * Used by #MRQ_CPU_VHINT call to carry data pointed by 19294bef358cSTimo Alho * #mrq_cpu_vhint_request::addr 1930983de5f9SThierry Reding */ 1931983de5f9SThierry Reding struct cpu_vhint_data { 1932983de5f9SThierry Reding uint32_t ref_clk_hz; /**< reference frequency in Hz */ 1933983de5f9SThierry Reding uint16_t pdiv; /**< post divider value */ 1934983de5f9SThierry Reding uint16_t mdiv; /**< input divider value */ 1935983de5f9SThierry Reding uint16_t ndiv_max; /**< fMAX expressed with max NDIV value */ 1936983de5f9SThierry Reding /** table of ndiv values as a function of vINDEX (voltage index) */ 1937983de5f9SThierry Reding uint16_t ndiv[80]; 1938983de5f9SThierry Reding /** minimum allowed NDIV value */ 1939983de5f9SThierry Reding uint16_t ndiv_min; 1940983de5f9SThierry Reding /** minimum allowed voltage hint value (as in vINDEX) */ 1941983de5f9SThierry Reding uint16_t vfloor; 1942983de5f9SThierry Reding /** maximum allowed voltage hint value (as in vINDEX) */ 1943983de5f9SThierry Reding uint16_t vceil; 1944983de5f9SThierry Reding /** post-multiplier for vindex value */ 1945983de5f9SThierry Reding uint16_t vindex_mult; 1946983de5f9SThierry Reding /** post-divider for vindex value */ 1947983de5f9SThierry Reding uint16_t vindex_div; 1948983de5f9SThierry Reding /** reserved for future use */ 1949983de5f9SThierry Reding uint16_t reserved[328]; 1950*4e871899SJon Hunter } BPMP_ABI_PACKED; 19514bef358cSTimo Alho /** @endcond */ 1952983de5f9SThierry Reding /** @} */ 1953983de5f9SThierry Reding 1954983de5f9SThierry Reding /** 1955983de5f9SThierry Reding * @ingroup MRQ_Codes 1956983de5f9SThierry Reding * @def MRQ_ABI_RATCHET 1957983de5f9SThierry Reding * @brief ABI ratchet value query 1958983de5f9SThierry Reding * 19594bef358cSTimo Alho * * Platforms: T186, T194 1960983de5f9SThierry Reding * * Initiators: Any 1961983de5f9SThierry Reding * * Targets: BPMP 1962983de5f9SThierry Reding * * Request Payload: @ref mrq_abi_ratchet_request 1963983de5f9SThierry Reding * * Response Payload: @ref mrq_abi_ratchet_response 1964983de5f9SThierry Reding * @addtogroup ABI_info 1965983de5f9SThierry Reding * @{ 1966983de5f9SThierry Reding */ 1967983de5f9SThierry Reding 1968983de5f9SThierry Reding /** 19694bef358cSTimo Alho * @brief An ABI compatibility mechanism 1970983de5f9SThierry Reding * 1971983de5f9SThierry Reding * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future 1972983de5f9SThierry Reding * revision of this header file. 1973983de5f9SThierry Reding * 1. That future revision deprecates some MRQ 1974983de5f9SThierry Reding * 2. That future revision introduces a breaking change to an existing 1975983de5f9SThierry Reding * MRQ or 1976983de5f9SThierry Reding * 3. A bug is discovered in an existing implementation of the BPMP-FW 1977983de5f9SThierry Reding * (or possibly one of its clients) which warrants deprecating that 1978983de5f9SThierry Reding * implementation. 1979983de5f9SThierry Reding */ 1980983de5f9SThierry Reding #define BPMP_ABI_RATCHET_VALUE 3 1981983de5f9SThierry Reding 1982983de5f9SThierry Reding /** 19834bef358cSTimo Alho * @brief Request with #MRQ_ABI_RATCHET. 1984983de5f9SThierry Reding * 1985983de5f9SThierry Reding * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header 1986983de5f9SThierry Reding * against which the requester was compiled. 1987983de5f9SThierry Reding * 1988983de5f9SThierry Reding * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may 1989983de5f9SThierry Reding * reply with mrq_response::err = -#BPMP_ERANGE to indicate that 1990983de5f9SThierry Reding * BPMP-FW cannot interoperate correctly with the requester. Requester 1991983de5f9SThierry Reding * should cease further communication with BPMP. 1992983de5f9SThierry Reding * 1993983de5f9SThierry Reding * Otherwise, err shall be 0. 1994983de5f9SThierry Reding */ 1995983de5f9SThierry Reding struct mrq_abi_ratchet_request { 19964bef358cSTimo Alho /** @brief Requester's ratchet value */ 1997983de5f9SThierry Reding uint16_t ratchet; 1998983de5f9SThierry Reding }; 1999983de5f9SThierry Reding 2000983de5f9SThierry Reding /** 20014bef358cSTimo Alho * @brief Response to #MRQ_ABI_RATCHET 2002983de5f9SThierry Reding * 2003983de5f9SThierry Reding * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header 2004983de5f9SThierry Reding * against which BPMP firwmare was compiled. 2005983de5f9SThierry Reding * 2006983de5f9SThierry Reding * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE, 2007983de5f9SThierry Reding * the requster must either interoperate with BPMP according to an ABI 2008983de5f9SThierry Reding * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease 2009983de5f9SThierry Reding * communication with BPMP. 2010983de5f9SThierry Reding * 2011983de5f9SThierry Reding * If mrq_response::err is 0 and ratchet is greater than or equal to the 2012983de5f9SThierry Reding * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue 2013983de5f9SThierry Reding * normal operation. 2014983de5f9SThierry Reding */ 2015983de5f9SThierry Reding struct mrq_abi_ratchet_response { 2016983de5f9SThierry Reding /** @brief BPMP's ratchet value */ 2017983de5f9SThierry Reding uint16_t ratchet; 2018983de5f9SThierry Reding }; 2019983de5f9SThierry Reding /** @} */ 2020983de5f9SThierry Reding 2021983de5f9SThierry Reding /** 2022983de5f9SThierry Reding * @ingroup MRQ_Codes 2023983de5f9SThierry Reding * @def MRQ_EMC_DVFS_LATENCY 20244bef358cSTimo Alho * @brief Query frequency dependent EMC DVFS latency 2025983de5f9SThierry Reding * 20264bef358cSTimo Alho * * Platforms: T186, T194 2027983de5f9SThierry Reding * * Initiators: CCPLEX 2028983de5f9SThierry Reding * * Targets: BPMP 2029983de5f9SThierry Reding * * Request Payload: N/A 2030983de5f9SThierry Reding * * Response Payload: @ref mrq_emc_dvfs_latency_response 2031983de5f9SThierry Reding * @addtogroup EMC 2032983de5f9SThierry Reding * @{ 2033983de5f9SThierry Reding */ 2034983de5f9SThierry Reding 2035983de5f9SThierry Reding /** 20364bef358cSTimo Alho * @brief Used by @ref mrq_emc_dvfs_latency_response 2037983de5f9SThierry Reding */ 2038983de5f9SThierry Reding struct emc_dvfs_latency { 2039*4e871899SJon Hunter /** @brief EMC DVFS node frequency in kHz */ 2040983de5f9SThierry Reding uint32_t freq; 2041983de5f9SThierry Reding /** @brief EMC DVFS latency in nanoseconds */ 2042983de5f9SThierry Reding uint32_t latency; 2043*4e871899SJon Hunter } BPMP_ABI_PACKED; 2044983de5f9SThierry Reding 2045983de5f9SThierry Reding #define EMC_DVFS_LATENCY_MAX_SIZE 14 2046983de5f9SThierry Reding /** 20474bef358cSTimo Alho * @brief Response to #MRQ_EMC_DVFS_LATENCY 2048983de5f9SThierry Reding */ 2049983de5f9SThierry Reding struct mrq_emc_dvfs_latency_response { 20504bef358cSTimo Alho /** @brief The number valid entries in #pairs */ 2051983de5f9SThierry Reding uint32_t num_pairs; 2052*4e871899SJon Hunter /** @brief EMC DVFS node <frequency, latency> information */ 2053983de5f9SThierry Reding struct emc_dvfs_latency pairs[EMC_DVFS_LATENCY_MAX_SIZE]; 2054*4e871899SJon Hunter } BPMP_ABI_PACKED; 2055983de5f9SThierry Reding 2056983de5f9SThierry Reding /** @} */ 2057983de5f9SThierry Reding 2058983de5f9SThierry Reding /** 2059983de5f9SThierry Reding * @ingroup MRQ_Codes 20604bef358cSTimo Alho * @def MRQ_CPU_NDIV_LIMITS 20614bef358cSTimo Alho * @brief CPU freq. limits in ndiv 20624bef358cSTimo Alho * 20634bef358cSTimo Alho * * Platforms: T194 onwards 20644bef358cSTimo Alho * @cond bpmp_t194 20654bef358cSTimo Alho * * Initiators: CCPLEX 20664bef358cSTimo Alho * * Targets: BPMP 20674bef358cSTimo Alho * * Request Payload: @ref mrq_cpu_ndiv_limits_request 20684bef358cSTimo Alho * * Response Payload: @ref mrq_cpu_ndiv_limits_response 20694bef358cSTimo Alho * @addtogroup CPU 20704bef358cSTimo Alho * @{ 20714bef358cSTimo Alho */ 20724bef358cSTimo Alho 20734bef358cSTimo Alho /** 20744bef358cSTimo Alho * @brief Request for ndiv limits of a cluster 20754bef358cSTimo Alho */ 20764bef358cSTimo Alho struct mrq_cpu_ndiv_limits_request { 20774bef358cSTimo Alho /** @brief Enum cluster_id */ 20784bef358cSTimo Alho uint32_t cluster_id; 2079*4e871899SJon Hunter } BPMP_ABI_PACKED; 20804bef358cSTimo Alho 20814bef358cSTimo Alho /** 20824bef358cSTimo Alho * @brief Response to #MRQ_CPU_NDIV_LIMITS 20834bef358cSTimo Alho */ 20844bef358cSTimo Alho struct mrq_cpu_ndiv_limits_response { 20854bef358cSTimo Alho /** @brief Reference frequency in Hz */ 20864bef358cSTimo Alho uint32_t ref_clk_hz; 20874bef358cSTimo Alho /** @brief Post divider value */ 20884bef358cSTimo Alho uint16_t pdiv; 20894bef358cSTimo Alho /** @brief Input divider value */ 20904bef358cSTimo Alho uint16_t mdiv; 20914bef358cSTimo Alho /** @brief FMAX expressed with max NDIV value */ 20924bef358cSTimo Alho uint16_t ndiv_max; 20934bef358cSTimo Alho /** @brief Minimum allowed NDIV value */ 20944bef358cSTimo Alho uint16_t ndiv_min; 2095*4e871899SJon Hunter } BPMP_ABI_PACKED; 20964bef358cSTimo Alho 20974bef358cSTimo Alho /** @} */ 20984bef358cSTimo Alho /** @endcond */ 20994bef358cSTimo Alho 21004bef358cSTimo Alho /** 21014bef358cSTimo Alho * @ingroup MRQ_Codes 21024bef358cSTimo Alho * @def MRQ_CPU_AUTO_CC3 21034bef358cSTimo Alho * @brief Query CPU cluster auto-CC3 configuration 21044bef358cSTimo Alho * 21054bef358cSTimo Alho * * Platforms: T194 onwards 21064bef358cSTimo Alho * @cond bpmp_t194 21074bef358cSTimo Alho * * Initiators: CCPLEX 21084bef358cSTimo Alho * * Targets: BPMP 21094bef358cSTimo Alho * * Request Payload: @ref mrq_cpu_auto_cc3_request 21104bef358cSTimo Alho * * Response Payload: @ref mrq_cpu_auto_cc3_response 21114bef358cSTimo Alho * @addtogroup CC3 21124bef358cSTimo Alho * 21134bef358cSTimo Alho * Queries from BPMP auto-CC3 configuration (allowed/not allowed) for a 21144bef358cSTimo Alho * specified cluster. CCPLEX s/w uses this information to override its own 21154bef358cSTimo Alho * device tree auto-CC3 settings, so that BPMP device tree is a single source of 21164bef358cSTimo Alho * auto-CC3 platform configuration. 21174bef358cSTimo Alho * 21184bef358cSTimo Alho * @{ 21194bef358cSTimo Alho */ 21204bef358cSTimo Alho 21214bef358cSTimo Alho /** 21224bef358cSTimo Alho * @brief Request for auto-CC3 configuration of a cluster 21234bef358cSTimo Alho */ 21244bef358cSTimo Alho struct mrq_cpu_auto_cc3_request { 21254bef358cSTimo Alho /** @brief Enum cluster_id (logical cluster id, known to CCPLEX s/w) */ 21264bef358cSTimo Alho uint32_t cluster_id; 2127*4e871899SJon Hunter } BPMP_ABI_PACKED; 21284bef358cSTimo Alho 21294bef358cSTimo Alho /** 21304bef358cSTimo Alho * @brief Response to #MRQ_CPU_AUTO_CC3 21314bef358cSTimo Alho */ 21324bef358cSTimo Alho struct mrq_cpu_auto_cc3_response { 21334bef358cSTimo Alho /** 21344bef358cSTimo Alho * @brief auto-CC3 configuration 21354bef358cSTimo Alho * 21364bef358cSTimo Alho * - bits[31..10] reserved. 21374bef358cSTimo Alho * - bits[9..1] cc3 ndiv 21384bef358cSTimo Alho * - bit [0] if "1" auto-CC3 is allowed, if "0" auto-CC3 is not allowed 21394bef358cSTimo Alho */ 21404bef358cSTimo Alho uint32_t auto_cc3_config; 2141*4e871899SJon Hunter } BPMP_ABI_PACKED; 21424bef358cSTimo Alho 21434bef358cSTimo Alho /** @} */ 21444bef358cSTimo Alho /** @endcond */ 21454bef358cSTimo Alho 21464bef358cSTimo Alho /** 21474bef358cSTimo Alho * @ingroup MRQ_Codes 2148983de5f9SThierry Reding * @def MRQ_TRACE_ITER 21494bef358cSTimo Alho * @brief Manage the trace iterator 2150983de5f9SThierry Reding * 2151*4e871899SJon Hunter * @deprecated 2152*4e871899SJon Hunter * 2153983de5f9SThierry Reding * * Platforms: All 2154983de5f9SThierry Reding * * Initiators: CCPLEX 2155983de5f9SThierry Reding * * Targets: BPMP 2156983de5f9SThierry Reding * * Request Payload: N/A 2157983de5f9SThierry Reding * * Response Payload: @ref mrq_trace_iter_request 2158983de5f9SThierry Reding * @addtogroup Trace 2159983de5f9SThierry Reding * @{ 2160983de5f9SThierry Reding */ 2161983de5f9SThierry Reding enum { 2162983de5f9SThierry Reding /** @brief (re)start the tracing now. Ignore older events */ 2163983de5f9SThierry Reding TRACE_ITER_INIT = 0, 21644bef358cSTimo Alho /** @brief Clobber all events in the trace buffer */ 2165983de5f9SThierry Reding TRACE_ITER_CLEAN = 1 2166983de5f9SThierry Reding }; 2167983de5f9SThierry Reding 2168983de5f9SThierry Reding /** 21694bef358cSTimo Alho * @brief Request with #MRQ_TRACE_ITER 2170983de5f9SThierry Reding */ 2171983de5f9SThierry Reding struct mrq_trace_iter_request { 2172983de5f9SThierry Reding /** @brief TRACE_ITER_INIT or TRACE_ITER_CLEAN */ 2173983de5f9SThierry Reding uint32_t cmd; 2174*4e871899SJon Hunter } BPMP_ABI_PACKED; 2175983de5f9SThierry Reding 2176983de5f9SThierry Reding /** @} */ 2177983de5f9SThierry Reding 217852b8b803SThierry Reding /** 217952b8b803SThierry Reding * @ingroup MRQ_Codes 218052b8b803SThierry Reding * @def MRQ_RINGBUF_CONSOLE 218152b8b803SThierry Reding * @brief A ring buffer debug console for BPMP 218252b8b803SThierry Reding * @addtogroup RingbufConsole 218352b8b803SThierry Reding * 218452b8b803SThierry Reding * The ring buffer debug console aims to be a substitute for the UART debug 218552b8b803SThierry Reding * console. The debug console is implemented with two ring buffers in the 218652b8b803SThierry Reding * BPMP-FW, the RX (receive) and TX (transmit) buffers. Characters can be read 218752b8b803SThierry Reding * and written to the buffers by the host via the MRQ interface. 218852b8b803SThierry Reding * 218952b8b803SThierry Reding * @{ 219052b8b803SThierry Reding */ 219152b8b803SThierry Reding 219252b8b803SThierry Reding /** 219352b8b803SThierry Reding * @brief Maximum number of bytes transferred in a single write command to the 219452b8b803SThierry Reding * BPMP 219552b8b803SThierry Reding * 219652b8b803SThierry Reding * This is determined by the number of free bytes in the message struct, 219752b8b803SThierry Reding * rounded down to a multiple of four. 219852b8b803SThierry Reding */ 219952b8b803SThierry Reding #define MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN 112 220052b8b803SThierry Reding 220152b8b803SThierry Reding /** 220252b8b803SThierry Reding * @brief Maximum number of bytes transferred in a single read command to the 220352b8b803SThierry Reding * BPMP 220452b8b803SThierry Reding * 220552b8b803SThierry Reding * This is determined by the number of free bytes in the message struct, 220652b8b803SThierry Reding * rounded down to a multiple of four. 220752b8b803SThierry Reding */ 220852b8b803SThierry Reding #define MRQ_RINGBUF_CONSOLE_MAX_READ_LEN 116 220952b8b803SThierry Reding 221052b8b803SThierry Reding enum mrq_ringbuf_console_host_to_bpmp_cmd { 221152b8b803SThierry Reding /** 221252b8b803SThierry Reding * @brief Check whether the BPMP driver supports the specified request 221352b8b803SThierry Reding * type 221452b8b803SThierry Reding * 221552b8b803SThierry Reding * mrq_response::err is 0 if the specified request is supported and 221652b8b803SThierry Reding * -#BPMP_ENODEV otherwise 221752b8b803SThierry Reding */ 221852b8b803SThierry Reding CMD_RINGBUF_CONSOLE_QUERY_ABI = 0, 221952b8b803SThierry Reding /** 222052b8b803SThierry Reding * @brief Perform a read operation on the BPMP TX buffer 222152b8b803SThierry Reding * 222252b8b803SThierry Reding * mrq_response::err is 0 222352b8b803SThierry Reding */ 222452b8b803SThierry Reding CMD_RINGBUF_CONSOLE_READ = 1, 222552b8b803SThierry Reding /** 222652b8b803SThierry Reding * @brief Perform a write operation on the BPMP RX buffer 222752b8b803SThierry Reding * 222852b8b803SThierry Reding * mrq_response::err is 0 if the operation was successful and 222952b8b803SThierry Reding * -#BPMP_ENODEV otherwise 223052b8b803SThierry Reding */ 223152b8b803SThierry Reding CMD_RINGBUF_CONSOLE_WRITE = 2, 223252b8b803SThierry Reding /** 223352b8b803SThierry Reding * @brief Get the length of the buffer and the physical addresses of 223452b8b803SThierry Reding * the buffer data and the head and tail counters 223552b8b803SThierry Reding * 223652b8b803SThierry Reding * mrq_response::err is 0 if the operation was successful and 223752b8b803SThierry Reding * -#BPMP_ENODEV otherwise 223852b8b803SThierry Reding */ 223952b8b803SThierry Reding CMD_RINGBUF_CONSOLE_GET_FIFO = 3, 224052b8b803SThierry Reding }; 224152b8b803SThierry Reding 224252b8b803SThierry Reding /** 224352b8b803SThierry Reding * @ingroup RingbufConsole 224452b8b803SThierry Reding * @brief Host->BPMP request data for request type 224552b8b803SThierry Reding * #CMD_RINGBUF_CONSOLE_QUERY_ABI 224652b8b803SThierry Reding */ 224752b8b803SThierry Reding struct cmd_ringbuf_console_query_abi_req { 224852b8b803SThierry Reding /** @brief Command identifier to be queried */ 224952b8b803SThierry Reding uint32_t cmd; 2250*4e871899SJon Hunter } BPMP_ABI_PACKED; 225152b8b803SThierry Reding 225252b8b803SThierry Reding /** @private */ 225352b8b803SThierry Reding struct cmd_ringbuf_console_query_abi_resp { 2254*4e871899SJon Hunter BPMP_ABI_EMPTY 2255*4e871899SJon Hunter } BPMP_ABI_PACKED; 225652b8b803SThierry Reding 225752b8b803SThierry Reding /** 225852b8b803SThierry Reding * @ingroup RingbufConsole 225952b8b803SThierry Reding * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_READ 226052b8b803SThierry Reding */ 226152b8b803SThierry Reding struct cmd_ringbuf_console_read_req { 226252b8b803SThierry Reding /** 226352b8b803SThierry Reding * @brief Number of bytes requested to be read from the BPMP TX buffer 226452b8b803SThierry Reding */ 226552b8b803SThierry Reding uint8_t len; 2266*4e871899SJon Hunter } BPMP_ABI_PACKED; 226752b8b803SThierry Reding 226852b8b803SThierry Reding /** 226952b8b803SThierry Reding * @ingroup RingbufConsole 227052b8b803SThierry Reding * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_READ 227152b8b803SThierry Reding */ 227252b8b803SThierry Reding struct cmd_ringbuf_console_read_resp { 227352b8b803SThierry Reding /** @brief The actual data read from the BPMP TX buffer */ 227452b8b803SThierry Reding uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_READ_LEN]; 227552b8b803SThierry Reding /** @brief Number of bytes in cmd_ringbuf_console_read_resp::data */ 227652b8b803SThierry Reding uint8_t len; 2277*4e871899SJon Hunter } BPMP_ABI_PACKED; 227852b8b803SThierry Reding 227952b8b803SThierry Reding /** 228052b8b803SThierry Reding * @ingroup RingbufConsole 228152b8b803SThierry Reding * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_WRITE 228252b8b803SThierry Reding */ 228352b8b803SThierry Reding struct cmd_ringbuf_console_write_req { 228452b8b803SThierry Reding /** @brief The actual data to be written to the BPMP RX buffer */ 228552b8b803SThierry Reding uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN]; 228652b8b803SThierry Reding /** @brief Number of bytes in cmd_ringbuf_console_write_req::data */ 228752b8b803SThierry Reding uint8_t len; 2288*4e871899SJon Hunter } BPMP_ABI_PACKED; 228952b8b803SThierry Reding 229052b8b803SThierry Reding /** 229152b8b803SThierry Reding * @ingroup RingbufConsole 229252b8b803SThierry Reding * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_WRITE 229352b8b803SThierry Reding */ 229452b8b803SThierry Reding struct cmd_ringbuf_console_write_resp { 229552b8b803SThierry Reding /** @brief Number of bytes of available space in the BPMP RX buffer */ 229652b8b803SThierry Reding uint32_t space_avail; 229752b8b803SThierry Reding /** @brief Number of bytes that were written to the BPMP RX buffer */ 229852b8b803SThierry Reding uint8_t len; 2299*4e871899SJon Hunter } BPMP_ABI_PACKED; 230052b8b803SThierry Reding 230152b8b803SThierry Reding /** @private */ 230252b8b803SThierry Reding struct cmd_ringbuf_console_get_fifo_req { 2303*4e871899SJon Hunter BPMP_ABI_EMPTY 2304*4e871899SJon Hunter } BPMP_ABI_PACKED; 230552b8b803SThierry Reding 230652b8b803SThierry Reding /** 230752b8b803SThierry Reding * @ingroup RingbufConsole 230852b8b803SThierry Reding * @brief BPMP->Host reply data for request type #CMD_RINGBUF_CONSOLE_GET_FIFO 230952b8b803SThierry Reding */ 231052b8b803SThierry Reding struct cmd_ringbuf_console_get_fifo_resp { 231152b8b803SThierry Reding /** @brief Physical address of the BPMP TX buffer */ 231252b8b803SThierry Reding uint64_t bpmp_tx_buf_addr; 231352b8b803SThierry Reding /** @brief Physical address of the BPMP TX buffer head counter */ 231452b8b803SThierry Reding uint64_t bpmp_tx_head_addr; 231552b8b803SThierry Reding /** @brief Physical address of the BPMP TX buffer tail counter */ 231652b8b803SThierry Reding uint64_t bpmp_tx_tail_addr; 231752b8b803SThierry Reding /** @brief Length of the BPMP TX buffer */ 231852b8b803SThierry Reding uint32_t bpmp_tx_buf_len; 2319*4e871899SJon Hunter } BPMP_ABI_PACKED; 232052b8b803SThierry Reding 232152b8b803SThierry Reding /** 232252b8b803SThierry Reding * @ingroup RingbufConsole 232352b8b803SThierry Reding * @brief Host->BPMP request data. 232452b8b803SThierry Reding * 232552b8b803SThierry Reding * Reply type is union #mrq_ringbuf_console_bpmp_to_host_response . 232652b8b803SThierry Reding */ 232752b8b803SThierry Reding struct mrq_ringbuf_console_host_to_bpmp_request { 232852b8b803SThierry Reding /** 23294bef358cSTimo Alho * @brief Type of request. Values listed in enum 233052b8b803SThierry Reding * #mrq_ringbuf_console_host_to_bpmp_cmd. 233152b8b803SThierry Reding */ 233252b8b803SThierry Reding uint32_t type; 233352b8b803SThierry Reding /** @brief request type specific parameters. */ 233452b8b803SThierry Reding union { 233552b8b803SThierry Reding struct cmd_ringbuf_console_query_abi_req query_abi; 233652b8b803SThierry Reding struct cmd_ringbuf_console_read_req read; 233752b8b803SThierry Reding struct cmd_ringbuf_console_write_req write; 233852b8b803SThierry Reding struct cmd_ringbuf_console_get_fifo_req get_fifo; 2339*4e871899SJon Hunter } BPMP_UNION_ANON; 2340*4e871899SJon Hunter } BPMP_ABI_PACKED; 234152b8b803SThierry Reding 234252b8b803SThierry Reding /** 234352b8b803SThierry Reding * @ingroup RingbufConsole 234452b8b803SThierry Reding * @brief Host->BPMP reply data 234552b8b803SThierry Reding * 234652b8b803SThierry Reding * In response to struct #mrq_ringbuf_console_host_to_bpmp_request. 234752b8b803SThierry Reding */ 234852b8b803SThierry Reding union mrq_ringbuf_console_bpmp_to_host_response { 234952b8b803SThierry Reding struct cmd_ringbuf_console_query_abi_resp query_abi; 235052b8b803SThierry Reding struct cmd_ringbuf_console_read_resp read; 235152b8b803SThierry Reding struct cmd_ringbuf_console_write_resp write; 235252b8b803SThierry Reding struct cmd_ringbuf_console_get_fifo_resp get_fifo; 2353*4e871899SJon Hunter } BPMP_ABI_PACKED; 235452b8b803SThierry Reding /** @} */ 235552b8b803SThierry Reding 23564bef358cSTimo Alho /** 23574bef358cSTimo Alho * @ingroup MRQ_Codes 23584bef358cSTimo Alho * @def MRQ_STRAP 23594bef358cSTimo Alho * @brief Set a strap value controlled by BPMP 23604bef358cSTimo Alho * 23614bef358cSTimo Alho * * Platforms: T194 onwards 23624bef358cSTimo Alho * @cond bpmp_t194 23634bef358cSTimo Alho * * Initiators: CCPLEX 23644bef358cSTimo Alho * * Targets: BPMP 23654bef358cSTimo Alho * * Request Payload: @ref mrq_strap_request 23664bef358cSTimo Alho * * Response Payload: N/A 23674bef358cSTimo Alho * @addtogroup Strap 23684bef358cSTimo Alho * 23694bef358cSTimo Alho * A strap is an input that is sampled by a hardware unit during the 23704bef358cSTimo Alho * unit's startup process. The sampled value of a strap affects the 23714bef358cSTimo Alho * behavior of the unit until the unit is restarted. Many hardware 23724bef358cSTimo Alho * units sample their straps at the instant that their resets are 23734bef358cSTimo Alho * deasserted. 23744bef358cSTimo Alho * 23754bef358cSTimo Alho * BPMP owns registers which act as straps to various units. It 23764bef358cSTimo Alho * exposes limited control of those straps via #MRQ_STRAP. 23774bef358cSTimo Alho * 23784bef358cSTimo Alho * @{ 23794bef358cSTimo Alho */ 23804bef358cSTimo Alho enum mrq_strap_cmd { 23814bef358cSTimo Alho /** @private */ 23824bef358cSTimo Alho STRAP_RESERVED = 0, 23834bef358cSTimo Alho /** @brief Set a strap value */ 23844bef358cSTimo Alho STRAP_SET = 1 23854bef358cSTimo Alho }; 23864bef358cSTimo Alho 23874bef358cSTimo Alho /** 23884bef358cSTimo Alho * @brief Request with #MRQ_STRAP 23894bef358cSTimo Alho */ 23904bef358cSTimo Alho struct mrq_strap_request { 23914bef358cSTimo Alho /** @brief @ref mrq_strap_cmd */ 23924bef358cSTimo Alho uint32_t cmd; 23934bef358cSTimo Alho /** @brief Strap ID from @ref Strap_Ids */ 23944bef358cSTimo Alho uint32_t id; 23954bef358cSTimo Alho /** @brief Desired value for strap (if cmd is #STRAP_SET) */ 23964bef358cSTimo Alho uint32_t value; 2397*4e871899SJon Hunter } BPMP_ABI_PACKED; 23984bef358cSTimo Alho 23994bef358cSTimo Alho /** 24004bef358cSTimo Alho * @defgroup Strap_Ids Strap Identifiers 24014bef358cSTimo Alho * @} 24024bef358cSTimo Alho */ 24034bef358cSTimo Alho /** @endcond */ 24044bef358cSTimo Alho 24054bef358cSTimo Alho /** 24064bef358cSTimo Alho * @ingroup MRQ_Codes 24074bef358cSTimo Alho * @def MRQ_UPHY 24084bef358cSTimo Alho * @brief Perform a UPHY operation 24094bef358cSTimo Alho * 24104bef358cSTimo Alho * * Platforms: T194 onwards 24114bef358cSTimo Alho * @cond bpmp_t194 24124bef358cSTimo Alho * * Initiators: CCPLEX 24134bef358cSTimo Alho * * Targets: BPMP 24144bef358cSTimo Alho * * Request Payload: @ref mrq_uphy_request 24154bef358cSTimo Alho * * Response Payload: @ref mrq_uphy_response 24164bef358cSTimo Alho * 24174bef358cSTimo Alho * @addtogroup UPHY 24184bef358cSTimo Alho * @{ 24194bef358cSTimo Alho */ 24204bef358cSTimo Alho enum { 24214bef358cSTimo Alho CMD_UPHY_PCIE_LANE_MARGIN_CONTROL = 1, 24224bef358cSTimo Alho CMD_UPHY_PCIE_LANE_MARGIN_STATUS = 2, 24234bef358cSTimo Alho CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT = 3, 24244bef358cSTimo Alho CMD_UPHY_PCIE_CONTROLLER_STATE = 4, 2425ee22d0c5SVidya Sagar CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF = 5, 24264bef358cSTimo Alho CMD_UPHY_MAX, 24274bef358cSTimo Alho }; 24284bef358cSTimo Alho 24294bef358cSTimo Alho struct cmd_uphy_margin_control_request { 24304bef358cSTimo Alho /** @brief Enable margin */ 24314bef358cSTimo Alho int32_t en; 24324bef358cSTimo Alho /** @brief Clear the number of error and sections */ 24334bef358cSTimo Alho int32_t clr; 24344bef358cSTimo Alho /** @brief Set x offset (1's complement) for left/right margin type (y should be 0) */ 24354bef358cSTimo Alho uint32_t x; 24364bef358cSTimo Alho /** @brief Set y offset (1's complement) for left/right margin type (x should be 0) */ 24374bef358cSTimo Alho uint32_t y; 24384bef358cSTimo Alho /** @brief Set number of bit blocks for each margin section */ 24394bef358cSTimo Alho uint32_t nblks; 2440*4e871899SJon Hunter } BPMP_ABI_PACKED; 24414bef358cSTimo Alho 24424bef358cSTimo Alho struct cmd_uphy_margin_status_response { 24434bef358cSTimo Alho /** @brief Number of errors observed */ 24444bef358cSTimo Alho uint32_t status; 2445*4e871899SJon Hunter } BPMP_ABI_PACKED; 24464bef358cSTimo Alho 24474bef358cSTimo Alho struct cmd_uphy_ep_controller_pll_init_request { 24484bef358cSTimo Alho /** @brief EP controller number, valid: 0, 4, 5 */ 24494bef358cSTimo Alho uint8_t ep_controller; 2450*4e871899SJon Hunter } BPMP_ABI_PACKED; 24514bef358cSTimo Alho 24524bef358cSTimo Alho struct cmd_uphy_pcie_controller_state_request { 24534bef358cSTimo Alho /** @brief PCIE controller number, valid: 0, 1, 2, 3, 4 */ 24544bef358cSTimo Alho uint8_t pcie_controller; 24554bef358cSTimo Alho uint8_t enable; 2456*4e871899SJon Hunter } BPMP_ABI_PACKED; 24574bef358cSTimo Alho 2458ee22d0c5SVidya Sagar struct cmd_uphy_ep_controller_pll_off_request { 2459ee22d0c5SVidya Sagar /** @brief EP controller number, valid: 0, 4, 5 */ 2460ee22d0c5SVidya Sagar uint8_t ep_controller; 2461*4e871899SJon Hunter } BPMP_ABI_PACKED; 2462ee22d0c5SVidya Sagar 24634bef358cSTimo Alho /** 24644bef358cSTimo Alho * @ingroup UPHY 24654bef358cSTimo Alho * @brief Request with #MRQ_UPHY 24664bef358cSTimo Alho * 24674bef358cSTimo Alho * Used by the sender of an #MRQ_UPHY message to control UPHY Lane RX margining. 24684bef358cSTimo Alho * The uphy_request is split into several sub-commands. Some sub-commands 24694bef358cSTimo Alho * require no additional data. Others have a sub-command specific payload 24704bef358cSTimo Alho * 24714bef358cSTimo Alho * |sub-command |payload | 24724bef358cSTimo Alho * |------------------------------------ |----------------------------------------| 24734bef358cSTimo Alho * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL |uphy_set_margin_control | 24744bef358cSTimo Alho * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS | | 24754bef358cSTimo Alho * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT |cmd_uphy_ep_controller_pll_init_request | 24764bef358cSTimo Alho * |CMD_UPHY_PCIE_CONTROLLER_STATE |cmd_uphy_pcie_controller_state_request | 2477ee22d0c5SVidya Sagar * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF |cmd_uphy_ep_controller_pll_off_request | 24784bef358cSTimo Alho * 2479983de5f9SThierry Reding */ 2480983de5f9SThierry Reding 24814bef358cSTimo Alho struct mrq_uphy_request { 24824bef358cSTimo Alho /** @brief Lane number. */ 24834bef358cSTimo Alho uint16_t lane; 24844bef358cSTimo Alho /** @brief Sub-command id. */ 24854bef358cSTimo Alho uint16_t cmd; 24864bef358cSTimo Alho 24874bef358cSTimo Alho union { 24884bef358cSTimo Alho struct cmd_uphy_margin_control_request uphy_set_margin_control; 24894bef358cSTimo Alho struct cmd_uphy_ep_controller_pll_init_request ep_ctrlr_pll_init; 24904bef358cSTimo Alho struct cmd_uphy_pcie_controller_state_request controller_state; 2491ee22d0c5SVidya Sagar struct cmd_uphy_ep_controller_pll_off_request ep_ctrlr_pll_off; 2492*4e871899SJon Hunter } BPMP_UNION_ANON; 2493*4e871899SJon Hunter } BPMP_ABI_PACKED; 24944bef358cSTimo Alho 24954bef358cSTimo Alho /** 24964bef358cSTimo Alho * @ingroup UPHY 24974bef358cSTimo Alho * @brief Response to MRQ_UPHY 2498983de5f9SThierry Reding * 24994bef358cSTimo Alho * Each sub-command supported by @ref mrq_uphy_request may return 25004bef358cSTimo Alho * sub-command-specific data. Some do and some do not as indicated in 25014bef358cSTimo Alho * the following table 2502983de5f9SThierry Reding * 25034bef358cSTimo Alho * |sub-command |payload | 25044bef358cSTimo Alho * |---------------------------- |------------------------| 25054bef358cSTimo Alho * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL | | 25064bef358cSTimo Alho * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS |uphy_get_margin_status | 2507983de5f9SThierry Reding * 2508983de5f9SThierry Reding */ 2509983de5f9SThierry Reding 25104bef358cSTimo Alho struct mrq_uphy_response { 25114bef358cSTimo Alho union { 25124bef358cSTimo Alho struct cmd_uphy_margin_status_response uphy_get_margin_status; 2513*4e871899SJon Hunter } BPMP_UNION_ANON; 2514*4e871899SJon Hunter } BPMP_ABI_PACKED; 25154bef358cSTimo Alho 25164bef358cSTimo Alho /** @} */ 25174bef358cSTimo Alho /** @endcond */ 25184bef358cSTimo Alho 25194bef358cSTimo Alho /** 25204bef358cSTimo Alho * @ingroup MRQ_Codes 25214bef358cSTimo Alho * @def MRQ_FMON 25224bef358cSTimo Alho * @brief Perform a frequency monitor configuration operations 2523983de5f9SThierry Reding * 25244bef358cSTimo Alho * * Platforms: T194 onwards 25254bef358cSTimo Alho * @cond bpmp_t194 25264bef358cSTimo Alho * * Initiators: CCPLEX 25274bef358cSTimo Alho * * Targets: BPMP 25284bef358cSTimo Alho * * Request Payload: @ref mrq_fmon_request 25294bef358cSTimo Alho * * Response Payload: @ref mrq_fmon_response 25304bef358cSTimo Alho * 25314bef358cSTimo Alho * @addtogroup FMON 25324bef358cSTimo Alho * @{ 25334bef358cSTimo Alho */ 25344bef358cSTimo Alho enum { 25354bef358cSTimo Alho /** 25364bef358cSTimo Alho * @brief Clamp FMON configuration to specified rate. 25374bef358cSTimo Alho * 25384bef358cSTimo Alho * The monitored clock must be running for clamp to succeed. If 25394bef358cSTimo Alho * clamped, FMON configuration is preserved when clock rate 25404bef358cSTimo Alho * and/or state is changed. 25414bef358cSTimo Alho */ 25424bef358cSTimo Alho CMD_FMON_GEAR_CLAMP = 1, 25434bef358cSTimo Alho /** 25444bef358cSTimo Alho * @brief Release clamped FMON configuration. 25454bef358cSTimo Alho * 25464bef358cSTimo Alho * Allow FMON configuration to follow monitored clock rate 25474bef358cSTimo Alho * and/or state changes. 25484bef358cSTimo Alho */ 25494bef358cSTimo Alho CMD_FMON_GEAR_FREE = 2, 25504bef358cSTimo Alho /** 25514bef358cSTimo Alho * @brief Return rate FMON is clamped at, or 0 if FMON is not 25524bef358cSTimo Alho * clamped. 25534bef358cSTimo Alho * 25544bef358cSTimo Alho * Inherently racy, since clamp state can be changed 25554bef358cSTimo Alho * concurrently. Useful for testing. 25564bef358cSTimo Alho */ 25574bef358cSTimo Alho CMD_FMON_GEAR_GET = 3, 25584bef358cSTimo Alho CMD_FMON_NUM, 25594bef358cSTimo Alho }; 25604bef358cSTimo Alho 25614bef358cSTimo Alho struct cmd_fmon_gear_clamp_request { 25624bef358cSTimo Alho int32_t unused; 25634bef358cSTimo Alho int64_t rate; 2564*4e871899SJon Hunter } BPMP_ABI_PACKED; 25654bef358cSTimo Alho 25664bef358cSTimo Alho /** @private */ 25674bef358cSTimo Alho struct cmd_fmon_gear_clamp_response { 2568*4e871899SJon Hunter BPMP_ABI_EMPTY 2569*4e871899SJon Hunter } BPMP_ABI_PACKED; 25704bef358cSTimo Alho 25714bef358cSTimo Alho /** @private */ 25724bef358cSTimo Alho struct cmd_fmon_gear_free_request { 2573*4e871899SJon Hunter BPMP_ABI_EMPTY 2574*4e871899SJon Hunter } BPMP_ABI_PACKED; 25754bef358cSTimo Alho 25764bef358cSTimo Alho /** @private */ 25774bef358cSTimo Alho struct cmd_fmon_gear_free_response { 2578*4e871899SJon Hunter BPMP_ABI_EMPTY 2579*4e871899SJon Hunter } BPMP_ABI_PACKED; 25804bef358cSTimo Alho 25814bef358cSTimo Alho /** @private */ 25824bef358cSTimo Alho struct cmd_fmon_gear_get_request { 2583*4e871899SJon Hunter BPMP_ABI_EMPTY 2584*4e871899SJon Hunter } BPMP_ABI_PACKED; 25854bef358cSTimo Alho 25864bef358cSTimo Alho struct cmd_fmon_gear_get_response { 25874bef358cSTimo Alho int64_t rate; 2588*4e871899SJon Hunter } BPMP_ABI_PACKED; 25894bef358cSTimo Alho 25904bef358cSTimo Alho /** 25914bef358cSTimo Alho * @ingroup FMON 25924bef358cSTimo Alho * @brief Request with #MRQ_FMON 25934bef358cSTimo Alho * 25944bef358cSTimo Alho * Used by the sender of an #MRQ_FMON message to configure clock 25954bef358cSTimo Alho * frequency monitors. The FMON request is split into several 25964bef358cSTimo Alho * sub-commands. Some sub-commands require no additional data. 25974bef358cSTimo Alho * Others have a sub-command specific payload 25984bef358cSTimo Alho * 25994bef358cSTimo Alho * |sub-command |payload | 26004bef358cSTimo Alho * |----------------------------|-----------------------| 26014bef358cSTimo Alho * |CMD_FMON_GEAR_CLAMP |fmon_gear_clamp | 26024bef358cSTimo Alho * |CMD_FMON_GEAR_FREE |- | 26034bef358cSTimo Alho * |CMD_FMON_GEAR_GET |- | 26044bef358cSTimo Alho * 2605983de5f9SThierry Reding */ 2606983de5f9SThierry Reding 26074bef358cSTimo Alho struct mrq_fmon_request { 26084bef358cSTimo Alho /** @brief Sub-command and clock id concatenated to 32-bit word. 26094bef358cSTimo Alho * - bits[31..24] is the sub-cmd. 26104bef358cSTimo Alho * - bits[23..0] is monitored clock id used to select target 26114bef358cSTimo Alho * FMON 26124bef358cSTimo Alho */ 26134bef358cSTimo Alho uint32_t cmd_and_id; 26144bef358cSTimo Alho 26154bef358cSTimo Alho union { 26164bef358cSTimo Alho struct cmd_fmon_gear_clamp_request fmon_gear_clamp; 26174bef358cSTimo Alho /** @private */ 26184bef358cSTimo Alho struct cmd_fmon_gear_free_request fmon_gear_free; 26194bef358cSTimo Alho /** @private */ 26204bef358cSTimo Alho struct cmd_fmon_gear_get_request fmon_gear_get; 2621*4e871899SJon Hunter } BPMP_UNION_ANON; 2622*4e871899SJon Hunter } BPMP_ABI_PACKED; 26234bef358cSTimo Alho 26244bef358cSTimo Alho /** 26254bef358cSTimo Alho * @ingroup FMON 26264bef358cSTimo Alho * @brief Response to MRQ_FMON 2627983de5f9SThierry Reding * 26284bef358cSTimo Alho * Each sub-command supported by @ref mrq_fmon_request may 26294bef358cSTimo Alho * return sub-command-specific data as indicated below. 26304bef358cSTimo Alho * 26314bef358cSTimo Alho * |sub-command |payload | 26324bef358cSTimo Alho * |----------------------------|------------------------| 26334bef358cSTimo Alho * |CMD_FMON_GEAR_CLAMP |- | 26344bef358cSTimo Alho * |CMD_FMON_GEAR_FREE |- | 26354bef358cSTimo Alho * |CMD_FMON_GEAR_GET |fmon_gear_get | 26364bef358cSTimo Alho * 2637983de5f9SThierry Reding */ 2638983de5f9SThierry Reding 26394bef358cSTimo Alho struct mrq_fmon_response { 26404bef358cSTimo Alho union { 26414bef358cSTimo Alho /** @private */ 26424bef358cSTimo Alho struct cmd_fmon_gear_clamp_response fmon_gear_clamp; 26434bef358cSTimo Alho /** @private */ 26444bef358cSTimo Alho struct cmd_fmon_gear_free_response fmon_gear_free; 26454bef358cSTimo Alho struct cmd_fmon_gear_get_response fmon_gear_get; 2646*4e871899SJon Hunter } BPMP_UNION_ANON; 2647*4e871899SJon Hunter } BPMP_ABI_PACKED; 26484bef358cSTimo Alho 26494bef358cSTimo Alho /** @} */ 26504bef358cSTimo Alho /** @endcond */ 26514bef358cSTimo Alho 26524bef358cSTimo Alho /** 26534bef358cSTimo Alho * @ingroup MRQ_Codes 26544bef358cSTimo Alho * @def MRQ_EC 26554bef358cSTimo Alho * @brief Provide status information on faults reported by Error 26564bef358cSTimo Alho * Collator (EC) to HSM. 2657983de5f9SThierry Reding * 26584bef358cSTimo Alho * * Platforms: T194 onwards 26594bef358cSTimo Alho * @cond bpmp_t194 26604bef358cSTimo Alho * * Initiators: CCPLEX 26614bef358cSTimo Alho * * Targets: BPMP 26624bef358cSTimo Alho * * Request Payload: @ref mrq_ec_request 26634bef358cSTimo Alho * * Response Payload: @ref mrq_ec_response 26644bef358cSTimo Alho * 26654bef358cSTimo Alho * @note This MRQ ABI is under construction, and subject to change 26664bef358cSTimo Alho * 26674bef358cSTimo Alho * @addtogroup EC 26684bef358cSTimo Alho * @{ 26694bef358cSTimo Alho */ 26704bef358cSTimo Alho enum { 26714bef358cSTimo Alho /** 2672*4e871899SJon Hunter * @cond DEPRECATED 26734bef358cSTimo Alho * @brief Retrieve specified EC status. 26744bef358cSTimo Alho * 26754bef358cSTimo Alho * mrq_response::err is 0 if the operation was successful, or @n 26764bef358cSTimo Alho * -#BPMP_ENODEV if target EC is not owned by BPMP @n 2677*4e871899SJon Hunter * -#BPMP_EACCES if target EC power domain is turned off @n 2678*4e871899SJon Hunter * -#BPMP_EBADCMD if subcommand is not supported 2679*4e871899SJon Hunter * @endcond 26804bef358cSTimo Alho */ 2681*4e871899SJon Hunter CMD_EC_STATUS_GET = 1, /* deprecated */ 2682*4e871899SJon Hunter 2683*4e871899SJon Hunter /** 2684*4e871899SJon Hunter * @brief Retrieve specified EC extended status (includes error 2685*4e871899SJon Hunter * counter and user values). 2686*4e871899SJon Hunter * 2687*4e871899SJon Hunter * mrq_response::err is 0 if the operation was successful, or @n 2688*4e871899SJon Hunter * -#BPMP_ENODEV if target EC is not owned by BPMP @n 2689*4e871899SJon Hunter * -#BPMP_EACCES if target EC power domain is turned off @n 2690*4e871899SJon Hunter * -#BPMP_EBADCMD if subcommand is not supported 2691*4e871899SJon Hunter */ 2692*4e871899SJon Hunter CMD_EC_STATUS_EX_GET = 2, 26934bef358cSTimo Alho CMD_EC_NUM, 26944bef358cSTimo Alho }; 26954bef358cSTimo Alho 26964bef358cSTimo Alho /** @brief BPMP ECs error types */ 26974bef358cSTimo Alho enum bpmp_ec_err_type { 26984bef358cSTimo Alho /** @brief Parity error on internal data path 26994bef358cSTimo Alho * 27004bef358cSTimo Alho * Error descriptor @ref ec_err_simple_desc. 27014bef358cSTimo Alho */ 27024bef358cSTimo Alho EC_ERR_TYPE_PARITY_INTERNAL = 1, 27034bef358cSTimo Alho 27044bef358cSTimo Alho /** @brief ECC SEC error on internal data path 27054bef358cSTimo Alho * 27064bef358cSTimo Alho * Error descriptor @ref ec_err_simple_desc. 27074bef358cSTimo Alho */ 27084bef358cSTimo Alho EC_ERR_TYPE_ECC_SEC_INTERNAL = 2, 27094bef358cSTimo Alho 27104bef358cSTimo Alho /** @brief ECC DED error on internal data path 27114bef358cSTimo Alho * 27124bef358cSTimo Alho * Error descriptor @ref ec_err_simple_desc. 27134bef358cSTimo Alho */ 27144bef358cSTimo Alho EC_ERR_TYPE_ECC_DED_INTERNAL = 3, 27154bef358cSTimo Alho 27164bef358cSTimo Alho /** @brief Comparator error 27174bef358cSTimo Alho * 27184bef358cSTimo Alho * Error descriptor @ref ec_err_simple_desc. 27194bef358cSTimo Alho */ 27204bef358cSTimo Alho EC_ERR_TYPE_COMPARATOR = 4, 27214bef358cSTimo Alho 27224bef358cSTimo Alho /** @brief Register parity error 27234bef358cSTimo Alho * 27244bef358cSTimo Alho * Error descriptor @ref ec_err_reg_parity_desc. 27254bef358cSTimo Alho */ 27264bef358cSTimo Alho EC_ERR_TYPE_REGISTER_PARITY = 5, 27274bef358cSTimo Alho 27284bef358cSTimo Alho /** @brief Parity error from on-chip SRAM/FIFO 27294bef358cSTimo Alho * 27304bef358cSTimo Alho * Error descriptor @ref ec_err_simple_desc. 27314bef358cSTimo Alho */ 27324bef358cSTimo Alho EC_ERR_TYPE_PARITY_SRAM = 6, 27334bef358cSTimo Alho 27344bef358cSTimo Alho /** @brief Clock Monitor error 27354bef358cSTimo Alho * 27364bef358cSTimo Alho * Error descriptor @ref ec_err_fmon_desc. 27374bef358cSTimo Alho */ 27384bef358cSTimo Alho EC_ERR_TYPE_CLOCK_MONITOR = 9, 27394bef358cSTimo Alho 27404bef358cSTimo Alho /** @brief Voltage Monitor error 27414bef358cSTimo Alho * 27424bef358cSTimo Alho * Error descriptor @ref ec_err_vmon_desc. 27434bef358cSTimo Alho */ 27444bef358cSTimo Alho EC_ERR_TYPE_VOLTAGE_MONITOR = 10, 27454bef358cSTimo Alho 27464bef358cSTimo Alho /** @brief SW Correctable error 27474bef358cSTimo Alho * 2748*4e871899SJon Hunter * Error descriptor @ref ec_err_sw_error_desc. 27494bef358cSTimo Alho */ 27504bef358cSTimo Alho EC_ERR_TYPE_SW_CORRECTABLE = 16, 27514bef358cSTimo Alho 27524bef358cSTimo Alho /** @brief SW Uncorrectable error 27534bef358cSTimo Alho * 2754*4e871899SJon Hunter * Error descriptor @ref ec_err_sw_error_desc. 27554bef358cSTimo Alho */ 27564bef358cSTimo Alho EC_ERR_TYPE_SW_UNCORRECTABLE = 17, 27574bef358cSTimo Alho 27584bef358cSTimo Alho /** @brief Other HW Correctable error 27594bef358cSTimo Alho * 27604bef358cSTimo Alho * Error descriptor @ref ec_err_simple_desc. 27614bef358cSTimo Alho */ 27624bef358cSTimo Alho EC_ERR_TYPE_OTHER_HW_CORRECTABLE = 32, 27634bef358cSTimo Alho 27644bef358cSTimo Alho /** @brief Other HW Uncorrectable error 27654bef358cSTimo Alho * 27664bef358cSTimo Alho * Error descriptor @ref ec_err_simple_desc. 27674bef358cSTimo Alho */ 27684bef358cSTimo Alho EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE = 33, 27694bef358cSTimo Alho }; 27704bef358cSTimo Alho 27714bef358cSTimo Alho /** @brief Group of registers with parity error. */ 27724bef358cSTimo Alho enum ec_registers_group { 27734bef358cSTimo Alho /** @brief Functional registers group */ 2774*4e871899SJon Hunter EC_ERR_GROUP_FUNC_REG = 0U, 27754bef358cSTimo Alho /** @brief SCR registers group */ 2776*4e871899SJon Hunter EC_ERR_GROUP_SCR_REG = 1U, 27774bef358cSTimo Alho }; 27784bef358cSTimo Alho 27794bef358cSTimo Alho /** 27804bef358cSTimo Alho * @defgroup bpmp_ec_status_flags EC Status Flags 27814bef358cSTimo Alho * @addtogroup bpmp_ec_status_flags 27824bef358cSTimo Alho * @{ 27834bef358cSTimo Alho */ 27844bef358cSTimo Alho /** @brief No EC error found flag */ 2785*4e871899SJon Hunter #define EC_STATUS_FLAG_NO_ERROR 0x0001U 27864bef358cSTimo Alho /** @brief Last EC error found flag */ 2787*4e871899SJon Hunter #define EC_STATUS_FLAG_LAST_ERROR 0x0002U 27884bef358cSTimo Alho /** @brief EC latent error flag */ 2789*4e871899SJon Hunter #define EC_STATUS_FLAG_LATENT_ERROR 0x0004U 27904bef358cSTimo Alho /** @} */ 27914bef358cSTimo Alho 27924bef358cSTimo Alho /** 27934bef358cSTimo Alho * @defgroup bpmp_ec_desc_flags EC Descriptor Flags 27944bef358cSTimo Alho * @addtogroup bpmp_ec_desc_flags 27954bef358cSTimo Alho * @{ 27964bef358cSTimo Alho */ 27974bef358cSTimo Alho /** @brief EC descriptor error resolved flag */ 2798*4e871899SJon Hunter #define EC_DESC_FLAG_RESOLVED 0x0001U 27994bef358cSTimo Alho /** @brief EC descriptor failed to retrieve id flag */ 2800*4e871899SJon Hunter #define EC_DESC_FLAG_NO_ID 0x0002U 28014bef358cSTimo Alho /** @} */ 28024bef358cSTimo Alho 28034bef358cSTimo Alho /** 28044bef358cSTimo Alho * |error type | fmon_clk_id values | 28054bef358cSTimo Alho * |---------------------------------|---------------------------| 28064bef358cSTimo Alho * |@ref EC_ERR_TYPE_CLOCK_MONITOR |@ref bpmp_clock_ids | 28074bef358cSTimo Alho */ 28084bef358cSTimo Alho struct ec_err_fmon_desc { 28094bef358cSTimo Alho /** @brief Bitmask of @ref bpmp_ec_desc_flags */ 28104bef358cSTimo Alho uint16_t desc_flags; 28114bef358cSTimo Alho /** @brief FMON monitored clock id */ 28124bef358cSTimo Alho uint16_t fmon_clk_id; 28134bef358cSTimo Alho /** @brief Bitmask of @ref bpmp_fmon_faults_flags */ 28144bef358cSTimo Alho uint32_t fmon_faults; 28154bef358cSTimo Alho /** @brief FMON faults access error */ 28164bef358cSTimo Alho int32_t fmon_access_error; 2817*4e871899SJon Hunter } BPMP_ABI_PACKED; 28184bef358cSTimo Alho 28194bef358cSTimo Alho /** 28204bef358cSTimo Alho * |error type | vmon_adc_id values | 28214bef358cSTimo Alho * |---------------------------------|---------------------------| 28224bef358cSTimo Alho * |@ref EC_ERR_TYPE_VOLTAGE_MONITOR |@ref bpmp_adc_ids | 28234bef358cSTimo Alho */ 28244bef358cSTimo Alho struct ec_err_vmon_desc { 28254bef358cSTimo Alho /** @brief Bitmask of @ref bpmp_ec_desc_flags */ 28264bef358cSTimo Alho uint16_t desc_flags; 28274bef358cSTimo Alho /** @brief VMON rail adc id */ 28284bef358cSTimo Alho uint16_t vmon_adc_id; 28294bef358cSTimo Alho /** @brief Bitmask of @ref bpmp_vmon_faults_flags */ 28304bef358cSTimo Alho uint32_t vmon_faults; 28314bef358cSTimo Alho /** @brief VMON faults access error */ 28324bef358cSTimo Alho int32_t vmon_access_error; 2833*4e871899SJon Hunter } BPMP_ABI_PACKED; 28344bef358cSTimo Alho 28354bef358cSTimo Alho /** 28364bef358cSTimo Alho * |error type | reg_id values | 28374bef358cSTimo Alho * |---------------------------------|---------------------------| 28384bef358cSTimo Alho * |@ref EC_ERR_TYPE_REGISTER_PARITY |@ref bpmp_ec_registers_ids | 28394bef358cSTimo Alho */ 28404bef358cSTimo Alho struct ec_err_reg_parity_desc { 28414bef358cSTimo Alho /** @brief Bitmask of @ref bpmp_ec_desc_flags */ 28424bef358cSTimo Alho uint16_t desc_flags; 28434bef358cSTimo Alho /** @brief Register id */ 28444bef358cSTimo Alho uint16_t reg_id; 28454bef358cSTimo Alho /** @brief Register group @ref ec_registers_group */ 28464bef358cSTimo Alho uint16_t reg_group; 2847*4e871899SJon Hunter } BPMP_ABI_PACKED; 2848*4e871899SJon Hunter 2849*4e871899SJon Hunter /** 2850*4e871899SJon Hunter * |error type | err_source_id values | 2851*4e871899SJon Hunter * |--------------------------------- |--------------------------| 2852*4e871899SJon Hunter * |@ref EC_ERR_TYPE_SW_CORRECTABLE | @ref bpmp_ec_ce_swd_ids | 2853*4e871899SJon Hunter * |@ref EC_ERR_TYPE_SW_UNCORRECTABLE | @ref bpmp_ec_ue_swd_ids | 2854*4e871899SJon Hunter */ 2855*4e871899SJon Hunter struct ec_err_sw_error_desc { 2856*4e871899SJon Hunter /** @brief Bitmask of @ref bpmp_ec_desc_flags */ 2857*4e871899SJon Hunter uint16_t desc_flags; 2858*4e871899SJon Hunter /** @brief Error source id */ 2859*4e871899SJon Hunter uint16_t err_source_id; 2860*4e871899SJon Hunter /** @brief Sw error data */ 2861*4e871899SJon Hunter uint32_t sw_error_data; 2862*4e871899SJon Hunter } BPMP_ABI_PACKED; 28634bef358cSTimo Alho 28644bef358cSTimo Alho /** 28654bef358cSTimo Alho * |error type | err_source_id values | 28664bef358cSTimo Alho * |----------------------------------------|---------------------------| 28674bef358cSTimo Alho * |@ref EC_ERR_TYPE_PARITY_INTERNAL |@ref bpmp_ec_ipath_ids | 28684bef358cSTimo Alho * |@ref EC_ERR_TYPE_ECC_SEC_INTERNAL |@ref bpmp_ec_ipath_ids | 28694bef358cSTimo Alho * |@ref EC_ERR_TYPE_ECC_DED_INTERNAL |@ref bpmp_ec_ipath_ids | 28704bef358cSTimo Alho * |@ref EC_ERR_TYPE_COMPARATOR |@ref bpmp_ec_comparator_ids| 28714bef358cSTimo Alho * |@ref EC_ERR_TYPE_PARITY_SRAM |@ref bpmp_clock_ids | 2872*4e871899SJon Hunter * |@ref EC_ERR_TYPE_OTHER_HW_CORRECTABLE |@ref bpmp_ec_misc_hwd_ids | 2873*4e871899SJon Hunter * |@ref EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE |@ref bpmp_ec_misc_hwd_ids | 28744bef358cSTimo Alho */ 28754bef358cSTimo Alho struct ec_err_simple_desc { 28764bef358cSTimo Alho /** @brief Bitmask of @ref bpmp_ec_desc_flags */ 28774bef358cSTimo Alho uint16_t desc_flags; 28784bef358cSTimo Alho /** @brief Error source id. Id space depends on error type. */ 28794bef358cSTimo Alho uint16_t err_source_id; 2880*4e871899SJon Hunter } BPMP_ABI_PACKED; 28814bef358cSTimo Alho 28824bef358cSTimo Alho /** @brief Union of EC error descriptors */ 28834bef358cSTimo Alho union ec_err_desc { 28844bef358cSTimo Alho struct ec_err_fmon_desc fmon_desc; 28854bef358cSTimo Alho struct ec_err_vmon_desc vmon_desc; 28864bef358cSTimo Alho struct ec_err_reg_parity_desc reg_parity_desc; 2887*4e871899SJon Hunter struct ec_err_sw_error_desc sw_error_desc; 28884bef358cSTimo Alho struct ec_err_simple_desc simple_desc; 2889*4e871899SJon Hunter } BPMP_ABI_PACKED; 28904bef358cSTimo Alho 28914bef358cSTimo Alho struct cmd_ec_status_get_request { 28924bef358cSTimo Alho /** @brief HSM error line number that identifies target EC. */ 28934bef358cSTimo Alho uint32_t ec_hsm_id; 2894*4e871899SJon Hunter } BPMP_ABI_PACKED; 28954bef358cSTimo Alho 28964bef358cSTimo Alho /** EC status maximum number of descriptors */ 2897*4e871899SJon Hunter #define EC_ERR_STATUS_DESC_MAX_NUM 4U 28984bef358cSTimo Alho 2899*4e871899SJon Hunter /** 2900*4e871899SJon Hunter * @cond DEPRECATED 2901*4e871899SJon Hunter */ 29024bef358cSTimo Alho struct cmd_ec_status_get_response { 29034bef358cSTimo Alho /** @brief Target EC id (the same id received with request). */ 29044bef358cSTimo Alho uint32_t ec_hsm_id; 29054bef358cSTimo Alho /** 29064bef358cSTimo Alho * @brief Bitmask of @ref bpmp_ec_status_flags 29074bef358cSTimo Alho * 29084bef358cSTimo Alho * If NO_ERROR flag is set, error_ fields should be ignored 29094bef358cSTimo Alho */ 29104bef358cSTimo Alho uint32_t ec_status_flags; 29114bef358cSTimo Alho /** @brief Found EC error index. */ 29124bef358cSTimo Alho uint32_t error_idx; 29134bef358cSTimo Alho /** @brief Found EC error type @ref bpmp_ec_err_type. */ 29144bef358cSTimo Alho uint32_t error_type; 29154bef358cSTimo Alho /** @brief Number of returned EC error descriptors */ 29164bef358cSTimo Alho uint32_t error_desc_num; 29174bef358cSTimo Alho /** @brief EC error descriptors */ 29184bef358cSTimo Alho union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM]; 2919*4e871899SJon Hunter } BPMP_ABI_PACKED; 2920*4e871899SJon Hunter /** @endcond */ 2921*4e871899SJon Hunter 2922*4e871899SJon Hunter struct cmd_ec_status_ex_get_response { 2923*4e871899SJon Hunter /** @brief Target EC id (the same id received with request). */ 2924*4e871899SJon Hunter uint32_t ec_hsm_id; 2925*4e871899SJon Hunter /** 2926*4e871899SJon Hunter * @brief Bitmask of @ref bpmp_ec_status_flags 2927*4e871899SJon Hunter * 2928*4e871899SJon Hunter * If NO_ERROR flag is set, error_ fields should be ignored 2929*4e871899SJon Hunter */ 2930*4e871899SJon Hunter uint32_t ec_status_flags; 2931*4e871899SJon Hunter /** @brief Found EC error index. */ 2932*4e871899SJon Hunter uint32_t error_idx; 2933*4e871899SJon Hunter /** @brief Found EC error type @ref bpmp_ec_err_type. */ 2934*4e871899SJon Hunter uint32_t error_type; 2935*4e871899SJon Hunter /** @brief Found EC mission error counter value */ 2936*4e871899SJon Hunter uint32_t error_counter; 2937*4e871899SJon Hunter /** @brief Found EC mission error user value */ 2938*4e871899SJon Hunter uint32_t error_uval; 2939*4e871899SJon Hunter /** @brief Reserved entry */ 2940*4e871899SJon Hunter uint32_t reserved; 2941*4e871899SJon Hunter /** @brief Number of returned EC error descriptors */ 2942*4e871899SJon Hunter uint32_t error_desc_num; 2943*4e871899SJon Hunter /** @brief EC error descriptors */ 2944*4e871899SJon Hunter union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM]; 2945*4e871899SJon Hunter } BPMP_ABI_PACKED; 29464bef358cSTimo Alho 29474bef358cSTimo Alho /** 29484bef358cSTimo Alho * @ingroup EC 29494bef358cSTimo Alho * @brief Request with #MRQ_EC 29504bef358cSTimo Alho * 29514bef358cSTimo Alho * Used by the sender of an #MRQ_EC message to access ECs owned 29524bef358cSTimo Alho * by BPMP. 29534bef358cSTimo Alho * 2954*4e871899SJon Hunter * @cond DEPRECATED 29554bef358cSTimo Alho * |sub-command |payload | 29564bef358cSTimo Alho * |----------------------------|-----------------------| 29574bef358cSTimo Alho * |@ref CMD_EC_STATUS_GET |ec_status_get | 2958*4e871899SJon Hunter * @endcond 2959*4e871899SJon Hunter * 2960*4e871899SJon Hunter * |sub-command |payload | 2961*4e871899SJon Hunter * |----------------------------|-----------------------| 2962*4e871899SJon Hunter * |@ref CMD_EC_STATUS_EX_GET |ec_status_get | 29634bef358cSTimo Alho * 29644bef358cSTimo Alho */ 29654bef358cSTimo Alho 29664bef358cSTimo Alho struct mrq_ec_request { 29674bef358cSTimo Alho /** @brief Sub-command id. */ 29684bef358cSTimo Alho uint32_t cmd_id; 29694bef358cSTimo Alho 29704bef358cSTimo Alho union { 29714bef358cSTimo Alho struct cmd_ec_status_get_request ec_status_get; 2972*4e871899SJon Hunter } BPMP_UNION_ANON; 2973*4e871899SJon Hunter } BPMP_ABI_PACKED; 29744bef358cSTimo Alho 29754bef358cSTimo Alho /** 29764bef358cSTimo Alho * @ingroup EC 29774bef358cSTimo Alho * @brief Response to MRQ_EC 29784bef358cSTimo Alho * 29794bef358cSTimo Alho * Each sub-command supported by @ref mrq_ec_request may return 29804bef358cSTimo Alho * sub-command-specific data as indicated below. 29814bef358cSTimo Alho * 2982*4e871899SJon Hunter * @cond DEPRECATED 29834bef358cSTimo Alho * |sub-command |payload | 29844bef358cSTimo Alho * |----------------------------|------------------------| 29854bef358cSTimo Alho * |@ref CMD_EC_STATUS_GET |ec_status_get | 2986*4e871899SJon Hunter * @endcond 2987*4e871899SJon Hunter * 2988*4e871899SJon Hunter * |sub-command |payload | 2989*4e871899SJon Hunter * |----------------------------|------------------------| 2990*4e871899SJon Hunter * |@ref CMD_EC_STATUS_EX_GET |ec_status_ex_get | 29914bef358cSTimo Alho * 29924bef358cSTimo Alho */ 29934bef358cSTimo Alho 29944bef358cSTimo Alho struct mrq_ec_response { 29954bef358cSTimo Alho union { 2996*4e871899SJon Hunter /** 2997*4e871899SJon Hunter * @cond DEPRECATED 2998*4e871899SJon Hunter */ 29994bef358cSTimo Alho struct cmd_ec_status_get_response ec_status_get; 30004bef358cSTimo Alho /** @endcond */ 3001*4e871899SJon Hunter struct cmd_ec_status_ex_get_response ec_status_ex_get; 3002*4e871899SJon Hunter } BPMP_UNION_ANON; 3003*4e871899SJon Hunter } BPMP_ABI_PACKED; 30044bef358cSTimo Alho 30054bef358cSTimo Alho /** @} */ 30064bef358cSTimo Alho /** @endcond */ 30074bef358cSTimo Alho 30084bef358cSTimo Alho /** 30094bef358cSTimo Alho * @addtogroup Error_Codes 3010983de5f9SThierry Reding * Negative values for mrq_response::err generally indicate some 3011983de5f9SThierry Reding * error. The ABI defines the following error codes. Negating these 3012983de5f9SThierry Reding * defines is an exercise left to the user. 3013983de5f9SThierry Reding * @{ 3014983de5f9SThierry Reding */ 30154bef358cSTimo Alho 3016*4e871899SJon Hunter /** @brief Operation not permitted */ 3017*4e871899SJon Hunter #define BPMP_EPERM 1 3018983de5f9SThierry Reding /** @brief No such file or directory */ 3019983de5f9SThierry Reding #define BPMP_ENOENT 2 3020983de5f9SThierry Reding /** @brief No MRQ handler */ 3021983de5f9SThierry Reding #define BPMP_ENOHANDLER 3 3022983de5f9SThierry Reding /** @brief I/O error */ 3023983de5f9SThierry Reding #define BPMP_EIO 5 3024983de5f9SThierry Reding /** @brief Bad sub-MRQ command */ 3025983de5f9SThierry Reding #define BPMP_EBADCMD 6 3026*4e871899SJon Hunter /** @brief Resource temporarily unavailable */ 3027*4e871899SJon Hunter #define BPMP_EAGAIN 11 3028983de5f9SThierry Reding /** @brief Not enough memory */ 3029983de5f9SThierry Reding #define BPMP_ENOMEM 12 3030983de5f9SThierry Reding /** @brief Permission denied */ 3031983de5f9SThierry Reding #define BPMP_EACCES 13 3032983de5f9SThierry Reding /** @brief Bad address */ 3033983de5f9SThierry Reding #define BPMP_EFAULT 14 3034*4e871899SJon Hunter /** @brief Resource busy */ 3035*4e871899SJon Hunter #define BPMP_EBUSY 16 3036983de5f9SThierry Reding /** @brief No such device */ 3037983de5f9SThierry Reding #define BPMP_ENODEV 19 3038983de5f9SThierry Reding /** @brief Argument is a directory */ 3039983de5f9SThierry Reding #define BPMP_EISDIR 21 3040983de5f9SThierry Reding /** @brief Invalid argument */ 3041983de5f9SThierry Reding #define BPMP_EINVAL 22 3042983de5f9SThierry Reding /** @brief Timeout during operation */ 3043983de5f9SThierry Reding #define BPMP_ETIMEDOUT 23 3044983de5f9SThierry Reding /** @brief Out of range */ 3045983de5f9SThierry Reding #define BPMP_ERANGE 34 30464bef358cSTimo Alho /** @brief Function not implemented */ 30474bef358cSTimo Alho #define BPMP_ENOSYS 38 30484bef358cSTimo Alho /** @brief Invalid slot */ 30494bef358cSTimo Alho #define BPMP_EBADSLT 57 3050*4e871899SJon Hunter /** @brief Not supported */ 3051*4e871899SJon Hunter #define BPMP_ENOTSUP 134 3052*4e871899SJon Hunter /** @brief No such device or address */ 3053*4e871899SJon Hunter #define BPMP_ENXIO 140 30544bef358cSTimo Alho 3055983de5f9SThierry Reding /** @} */ 30564bef358cSTimo Alho 3057*4e871899SJon Hunter #if defined(BPMP_ABI_CHECKS) 3058*4e871899SJon Hunter #include "bpmp_abi_checks.h" 3059*4e871899SJon Hunter #endif 3060*4e871899SJon Hunter 3061983de5f9SThierry Reding #endif 3062