blob: bff99f23860c368f5f3d708e14d36890dce50045 [file] [log] [blame]
Thomas Gleixner9952f692019-05-28 10:10:04 -07001/* SPDX-License-Identifier: GPL-2.0-only */
Thierry Reding983de5f2016-08-19 19:05:35 +02002/*
Vidya Sagaree22d0c2020-03-03 23:40:48 +05303 * Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved.
Thierry Reding983de5f2016-08-19 19:05:35 +02004 */
5
Jon Hunter4e871892020-07-12 11:01:18 +01006#ifndef ABI_BPMP_ABI_H
7#define ABI_BPMP_ABI_H
Thierry Reding983de5f2016-08-19 19:05:35 +02008
Jon Hunter4e871892020-07-12 11:01:18 +01009#if defined(LK) || defined(BPMP_ABI_HAVE_STDC)
10#include <stddef.h>
Thierry Reding983de5f2016-08-19 19:05:35 +020011#include <stdint.h>
12#endif
13
Jon Hunter4e871892020-07-12 11:01:18 +010014#ifndef BPMP_ABI_PACKED
15#ifdef __ABI_PACKED
16#define BPMP_ABI_PACKED __ABI_PACKED
17#else
18#define BPMP_ABI_PACKED __attribute__((packed))
19#endif
Thierry Reding983de5f2016-08-19 19:05:35 +020020#endif
21
22#ifdef NO_GCC_EXTENSIONS
Jon Hunter4e871892020-07-12 11:01:18 +010023#define BPMP_ABI_EMPTY char empty;
24#define BPMP_ABI_EMPTY_ARRAY 1
Thierry Reding983de5f2016-08-19 19:05:35 +020025#else
Jon Hunter4e871892020-07-12 11:01:18 +010026#define BPMP_ABI_EMPTY
27#define BPMP_ABI_EMPTY_ARRAY 0
Thierry Reding983de5f2016-08-19 19:05:35 +020028#endif
29
Jon Hunter4e871892020-07-12 11:01:18 +010030#ifndef BPMP_UNION_ANON
31#ifdef __UNION_ANON
32#define BPMP_UNION_ANON __UNION_ANON
33#else
34#define BPMP_UNION_ANON
Thierry Reding983de5f2016-08-19 19:05:35 +020035#endif
Jon Hunter4e871892020-07-12 11:01:18 +010036#endif
37
Thierry Reding983de5f2016-08-19 19:05:35 +020038/**
39 * @file
40 */
41
Thierry Reding983de5f2016-08-19 19:05:35 +020042/**
43 * @defgroup MRQ MRQ Messages
44 * @brief Messages sent to/from BPMP via IPC
45 * @{
46 * @defgroup MRQ_Format Message Format
47 * @defgroup MRQ_Codes Message Request (MRQ) Codes
48 * @defgroup MRQ_Payloads Message Payloads
49 * @defgroup Error_Codes Error Codes
50 * @}
51 */
52
53/**
Timo Alho4bef3582018-10-22 16:19:39 +030054 * @addtogroup MRQ_Format
Thierry Reding983de5f2016-08-19 19:05:35 +020055 * @{
56 * The CPU requests the BPMP to perform a particular service by
57 * sending it an IVC frame containing a single MRQ message. An MRQ
58 * message consists of a @ref mrq_request followed by a payload whose
59 * format depends on mrq_request::mrq.
60 *
61 * The BPMP processes the data and replies with an IVC frame (on the
62 * same IVC channel) containing and MRQ response. An MRQ response
63 * consists of a @ref mrq_response followed by a payload whose format
64 * depends on the associated mrq_request::mrq.
65 *
66 * A well-defined subset of the MRQ messages that the CPU sends to the
67 * BPMP can lead to BPMP eventually sending an MRQ message to the
68 * CPU. For example, when the CPU uses an #MRQ_THERMAL message to set
69 * a thermal trip point, the BPMP may eventually send a single
70 * #MRQ_THERMAL message of its own to the CPU indicating that the trip
71 * point has been crossed.
72 * @}
73 */
74
75/**
76 * @ingroup MRQ_Format
Timo Alho4bef3582018-10-22 16:19:39 +030077 * @brief Header for an MRQ message
Thierry Reding983de5f2016-08-19 19:05:35 +020078 *
79 * Provides the MRQ number for the MRQ message: #mrq. The remainder of
80 * the MRQ message is a payload (immediately following the
81 * mrq_request) whose format depends on mrq.
Thierry Reding983de5f2016-08-19 19:05:35 +020082 */
83struct mrq_request {
84 /** @brief MRQ number of the request */
85 uint32_t mrq;
Jon Hunter4e871892020-07-12 11:01:18 +010086
Thierry Reding52b8b802017-03-29 18:34:51 +020087 /**
Timo Alho4bef3582018-10-22 16:19:39 +030088 * @brief Flags providing follow up directions to the receiver
Thierry Reding52b8b802017-03-29 18:34:51 +020089 *
90 * | Bit | Description |
91 * |-----|--------------------------------------------|
92 * | 1 | ring the sender's doorbell when responding |
93 * | 0 | should be 1 |
94 */
Thierry Reding983de5f2016-08-19 19:05:35 +020095 uint32_t flags;
Jon Hunter4e871892020-07-12 11:01:18 +010096} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +020097
98/**
99 * @ingroup MRQ_Format
Timo Alho4bef3582018-10-22 16:19:39 +0300100 * @brief Header for an MRQ response
Thierry Reding983de5f2016-08-19 19:05:35 +0200101 *
102 * Provides an error code for the associated MRQ message. The
103 * remainder of the MRQ response is a payload (immediately following
104 * the mrq_response) whose format depends on the associated
105 * mrq_request::mrq
Thierry Reding983de5f2016-08-19 19:05:35 +0200106 */
107struct mrq_response {
Timo Alho4bef3582018-10-22 16:19:39 +0300108 /** @brief Error code for the MRQ request itself */
Thierry Reding983de5f2016-08-19 19:05:35 +0200109 int32_t err;
Timo Alho4bef3582018-10-22 16:19:39 +0300110 /** @brief Reserved for future use */
Thierry Reding983de5f2016-08-19 19:05:35 +0200111 uint32_t flags;
Jon Hunter4e871892020-07-12 11:01:18 +0100112} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200113
114/**
115 * @ingroup MRQ_Format
116 * Minimum needed size for an IPC message buffer
117 */
Jon Hunter4e871892020-07-12 11:01:18 +0100118#define MSG_MIN_SZ 128U
Thierry Reding983de5f2016-08-19 19:05:35 +0200119/**
120 * @ingroup MRQ_Format
121 * Minimum size guaranteed for data in an IPC message buffer
122 */
Jon Hunter4e871892020-07-12 11:01:18 +0100123#define MSG_DATA_MIN_SZ 120U
Thierry Reding983de5f2016-08-19 19:05:35 +0200124
125/**
126 * @ingroup MRQ_Codes
127 * @name Legal MRQ codes
128 * These are the legal values for mrq_request::mrq
129 * @{
130 */
131
Jon Hunter4e871892020-07-12 11:01:18 +0100132#define MRQ_PING 0U
133#define MRQ_QUERY_TAG 1U
134#define MRQ_MODULE_LOAD 4U
135#define MRQ_MODULE_UNLOAD 5U
136#define MRQ_TRACE_MODIFY 7U
137#define MRQ_WRITE_TRACE 8U
138#define MRQ_THREADED_PING 9U
139#define MRQ_MODULE_MAIL 11U
140#define MRQ_DEBUGFS 19U
141#define MRQ_RESET 20U
142#define MRQ_I2C 21U
143#define MRQ_CLK 22U
144#define MRQ_QUERY_ABI 23U
145#define MRQ_PG_READ_STATE 25U
146#define MRQ_PG_UPDATE_STATE 26U
147#define MRQ_THERMAL 27U
148#define MRQ_CPU_VHINT 28U
149#define MRQ_ABI_RATCHET 29U
150#define MRQ_EMC_DVFS_LATENCY 31U
151#define MRQ_TRACE_ITER 64U
152#define MRQ_RINGBUF_CONSOLE 65U
153#define MRQ_PG 66U
154#define MRQ_CPU_NDIV_LIMITS 67U
155#define MRQ_STRAP 68U
156#define MRQ_UPHY 69U
157#define MRQ_CPU_AUTO_CC3 70U
158#define MRQ_QUERY_FW_TAG 71U
159#define MRQ_FMON 72U
160#define MRQ_EC 73U
161#define MRQ_DEBUG 75U
Thierry Reding983de5f2016-08-19 19:05:35 +0200162
163/** @} */
164
165/**
166 * @ingroup MRQ_Codes
167 * @brief Maximum MRQ code to be sent by CPU software to
168 * BPMP. Subject to change in future
169 */
Jon Hunter4e871892020-07-12 11:01:18 +0100170#define MAX_CPU_MRQ_ID 75U
Thierry Reding983de5f2016-08-19 19:05:35 +0200171
172/**
Timo Alho4bef3582018-10-22 16:19:39 +0300173 * @addtogroup MRQ_Payloads
Thierry Reding983de5f2016-08-19 19:05:35 +0200174 * @{
Timo Alho4bef3582018-10-22 16:19:39 +0300175 * @defgroup Ping Ping
Thierry Reding983de5f2016-08-19 19:05:35 +0200176 * @defgroup Query_Tag Query Tag
177 * @defgroup Module Loadable Modules
Timo Alho4bef3582018-10-22 16:19:39 +0300178 * @defgroup Trace Trace
179 * @defgroup Debugfs Debug File System
180 * @defgroup Reset Reset
181 * @defgroup I2C I2C
182 * @defgroup Clocks Clocks
Thierry Reding983de5f2016-08-19 19:05:35 +0200183 * @defgroup ABI_info ABI Info
Timo Alho4bef3582018-10-22 16:19:39 +0300184 * @defgroup Powergating Power Gating
185 * @defgroup Thermal Thermal
Thierry Reding983de5f2016-08-19 19:05:35 +0200186 * @defgroup Vhint CPU Voltage hint
Timo Alho4bef3582018-10-22 16:19:39 +0300187 * @defgroup EMC EMC
188 * @defgroup CPU NDIV Limits
189 * @defgroup RingbufConsole Ring Buffer Console
190 * @defgroup Strap Straps
191 * @defgroup UPHY UPHY
192 * @defgroup CC3 Auto-CC3
193 * @defgroup FMON FMON
194 * @defgroup EC EC
195 * @defgroup Fbvolt_status Fuse Burn Voltage Status
Thierry Reding983de5f2016-08-19 19:05:35 +0200196 * @}
197 */
198
Thierry Reding983de5f2016-08-19 19:05:35 +0200199/**
200 * @ingroup MRQ_Codes
201 * @def MRQ_PING
202 * @brief A simple ping
203 *
204 * * Platforms: All
205 * * Initiators: Any
206 * * Targets: Any
207 * * Request Payload: @ref mrq_ping_request
208 * * Response Payload: @ref mrq_ping_response
209 *
210 * @ingroup MRQ_Codes
211 * @def MRQ_THREADED_PING
212 * @brief A deeper ping
213 *
214 * * Platforms: All
215 * * Initiators: Any
216 * * Targets: BPMP
217 * * Request Payload: @ref mrq_ping_request
218 * * Response Payload: @ref mrq_ping_response
219 *
220 * Behavior is equivalent to a simple #MRQ_PING except that BPMP
221 * responds from a thread context (providing a slightly more robust
222 * sign of life).
223 *
224 */
225
226/**
227 * @ingroup Ping
Timo Alho4bef3582018-10-22 16:19:39 +0300228 * @brief Request with #MRQ_PING
Thierry Reding983de5f2016-08-19 19:05:35 +0200229 *
230 * Used by the sender of an #MRQ_PING message to request a pong from
231 * recipient. The response from the recipient is computed based on
232 * #challenge.
233 */
234struct mrq_ping_request {
Timo Alho4bef3582018-10-22 16:19:39 +0300235/** @brief Arbitrarily chosen value */
Thierry Reding983de5f2016-08-19 19:05:35 +0200236 uint32_t challenge;
Jon Hunter4e871892020-07-12 11:01:18 +0100237} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200238
239/**
240 * @ingroup Ping
Timo Alho4bef3582018-10-22 16:19:39 +0300241 * @brief Response to #MRQ_PING
Thierry Reding983de5f2016-08-19 19:05:35 +0200242 *
243 * Sent in response to an #MRQ_PING message. #reply should be the
244 * mrq_ping_request challenge left shifted by 1 with the carry-bit
245 * dropped.
246 *
247 */
248struct mrq_ping_response {
Timo Alho4bef3582018-10-22 16:19:39 +0300249 /** @brief Response to the MRQ_PING challege */
Thierry Reding983de5f2016-08-19 19:05:35 +0200250 uint32_t reply;
Jon Hunter4e871892020-07-12 11:01:18 +0100251} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200252
253/**
254 * @ingroup MRQ_Codes
255 * @def MRQ_QUERY_TAG
Timo Alho4bef3582018-10-22 16:19:39 +0300256 * @brief Query BPMP firmware's tag (i.e. unique identifer)
257 *
258 * @deprecated Use #MRQ_QUERY_FW_TAG instead.
Thierry Reding983de5f2016-08-19 19:05:35 +0200259 *
260 * * Platforms: All
261 * * Initiators: CCPLEX
262 * * Targets: BPMP
263 * * Request Payload: @ref mrq_query_tag_request
264 * * Response Payload: N/A
265 *
266 */
267
268/**
269 * @ingroup Query_Tag
Timo Alho4bef3582018-10-22 16:19:39 +0300270 * @brief Request with #MRQ_QUERY_TAG
Thierry Reding983de5f2016-08-19 19:05:35 +0200271 *
Timo Alho4bef3582018-10-22 16:19:39 +0300272 * @deprecated This structure will be removed in future version.
273 * Use MRQ_QUERY_FW_TAG instead.
Thierry Reding983de5f2016-08-19 19:05:35 +0200274 */
275struct mrq_query_tag_request {
Timo Alho4bef3582018-10-22 16:19:39 +0300276 /** @brief Base address to store the firmware tag */
Thierry Reding983de5f2016-08-19 19:05:35 +0200277 uint32_t addr;
Jon Hunter4e871892020-07-12 11:01:18 +0100278} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200279
Timo Alho4bef3582018-10-22 16:19:39 +0300280
281/**
282 * @ingroup MRQ_Codes
283 * @def MRQ_QUERY_FW_TAG
284 * @brief Query BPMP firmware's tag (i.e. unique identifier)
285 *
286 * * Platforms: All
287 * * Initiators: Any
288 * * Targets: BPMP
289 * * Request Payload: N/A
290 * * Response Payload: @ref mrq_query_fw_tag_response
291 *
292 */
293
294/**
295 * @ingroup Query_Tag
296 * @brief Response to #MRQ_QUERY_FW_TAG
297 *
298 * Sent in response to #MRQ_QUERY_FW_TAG message. #tag contains the unique
299 * identifier for the version of firmware issuing the reply.
300 *
301 */
302struct mrq_query_fw_tag_response {
303 /** @brief Array to store tag information */
304 uint8_t tag[32];
Jon Hunter4e871892020-07-12 11:01:18 +0100305} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +0300306
Thierry Reding983de5f2016-08-19 19:05:35 +0200307/**
308 * @ingroup MRQ_Codes
309 * @def MRQ_MODULE_LOAD
Timo Alho4bef3582018-10-22 16:19:39 +0300310 * @brief Dynamically load a BPMP code module
Thierry Reding983de5f2016-08-19 19:05:35 +0200311 *
Jon Hunter4e871892020-07-12 11:01:18 +0100312 * * Platforms: T210, T210B01, T186
313 * @cond (bpmp_t210 || bpmp_t210b01 || bpmp_t186)
Thierry Reding983de5f2016-08-19 19:05:35 +0200314 * * Initiators: CCPLEX
315 * * Targets: BPMP
316 * * Request Payload: @ref mrq_module_load_request
317 * * Response Payload: @ref mrq_module_load_response
318 *
319 * @note This MRQ is disabled on production systems
320 *
321 */
322
323/**
324 * @ingroup Module
Timo Alho4bef3582018-10-22 16:19:39 +0300325 * @brief Request with #MRQ_MODULE_LOAD
Thierry Reding983de5f2016-08-19 19:05:35 +0200326 *
327 * Used by #MRQ_MODULE_LOAD calls to ask the recipient to dynamically
328 * load the code located at #phys_addr and having size #size
329 * bytes. #phys_addr is treated as a void pointer.
330 *
331 * The recipient copies the code from #phys_addr to locally allocated
332 * memory prior to responding to this message.
333 *
334 * @todo document the module header format
335 *
336 * The sender is responsible for ensuring that the code is mapped in
337 * the recipient's address map.
338 *
339 */
340struct mrq_module_load_request {
Jon Hunter4e871892020-07-12 11:01:18 +0100341 /** @brief Base address of the code to load */
342 uint32_t phys_addr;
Timo Alho4bef3582018-10-22 16:19:39 +0300343 /** @brief Size in bytes of code to load */
Thierry Reding983de5f2016-08-19 19:05:35 +0200344 uint32_t size;
Jon Hunter4e871892020-07-12 11:01:18 +0100345} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200346
347/**
348 * @ingroup Module
Timo Alho4bef3582018-10-22 16:19:39 +0300349 * @brief Response to #MRQ_MODULE_LOAD
Thierry Reding983de5f2016-08-19 19:05:35 +0200350 *
351 * @todo document mrq_response::err
352 */
353struct mrq_module_load_response {
Timo Alho4bef3582018-10-22 16:19:39 +0300354 /** @brief Handle to the loaded module */
Thierry Reding983de5f2016-08-19 19:05:35 +0200355 uint32_t base;
Jon Hunter4e871892020-07-12 11:01:18 +0100356} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +0300357/** @endcond*/
Thierry Reding983de5f2016-08-19 19:05:35 +0200358
359/**
360 * @ingroup MRQ_Codes
361 * @def MRQ_MODULE_UNLOAD
Timo Alho4bef3582018-10-22 16:19:39 +0300362 * @brief Unload a previously loaded code module
Thierry Reding983de5f2016-08-19 19:05:35 +0200363 *
Jon Hunter4e871892020-07-12 11:01:18 +0100364 * * Platforms: T210, T210B01, T186
365 * @cond (bpmp_t210 || bpmp_t210b01 || bpmp_t186)
Thierry Reding983de5f2016-08-19 19:05:35 +0200366 * * Initiators: CCPLEX
367 * * Targets: BPMP
368 * * Request Payload: @ref mrq_module_unload_request
369 * * Response Payload: N/A
370 *
371 * @note This MRQ is disabled on production systems
372 */
373
374/**
375 * @ingroup Module
Timo Alho4bef3582018-10-22 16:19:39 +0300376 * @brief Request with #MRQ_MODULE_UNLOAD
Thierry Reding983de5f2016-08-19 19:05:35 +0200377 *
378 * Used by #MRQ_MODULE_UNLOAD calls to request that a previously loaded
379 * module be unloaded.
380 */
381struct mrq_module_unload_request {
Timo Alho4bef3582018-10-22 16:19:39 +0300382 /** @brief Handle of the module to unload */
Thierry Reding983de5f2016-08-19 19:05:35 +0200383 uint32_t base;
Jon Hunter4e871892020-07-12 11:01:18 +0100384} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +0300385/** @endcond*/
Thierry Reding983de5f2016-08-19 19:05:35 +0200386
387/**
388 * @ingroup MRQ_Codes
389 * @def MRQ_TRACE_MODIFY
Timo Alho4bef3582018-10-22 16:19:39 +0300390 * @brief Modify the set of enabled trace events
Thierry Reding983de5f2016-08-19 19:05:35 +0200391 *
Jon Hunter4e871892020-07-12 11:01:18 +0100392 * @deprecated
393 *
Thierry Reding983de5f2016-08-19 19:05:35 +0200394 * * Platforms: All
395 * * Initiators: CCPLEX
396 * * Targets: BPMP
397 * * Request Payload: @ref mrq_trace_modify_request
398 * * Response Payload: @ref mrq_trace_modify_response
399 *
400 * @note This MRQ is disabled on production systems
401 */
402
403/**
404 * @ingroup Trace
Timo Alho4bef3582018-10-22 16:19:39 +0300405 * @brief Request with #MRQ_TRACE_MODIFY
Thierry Reding983de5f2016-08-19 19:05:35 +0200406 *
407 * Used by %MRQ_TRACE_MODIFY calls to enable or disable specify trace
408 * events. #set takes precedence for any bit set in both #set and
409 * #clr.
410 */
411struct mrq_trace_modify_request {
Timo Alho4bef3582018-10-22 16:19:39 +0300412 /** @brief Bit mask of trace events to disable */
Thierry Reding983de5f2016-08-19 19:05:35 +0200413 uint32_t clr;
Timo Alho4bef3582018-10-22 16:19:39 +0300414 /** @brief Bit mask of trace events to enable */
Thierry Reding983de5f2016-08-19 19:05:35 +0200415 uint32_t set;
Jon Hunter4e871892020-07-12 11:01:18 +0100416} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200417
418/**
419 * @ingroup Trace
Timo Alho4bef3582018-10-22 16:19:39 +0300420 * @brief Response to #MRQ_TRACE_MODIFY
Thierry Reding983de5f2016-08-19 19:05:35 +0200421 *
422 * Sent in repsonse to an #MRQ_TRACE_MODIFY message. #mask reflects the
423 * state of which events are enabled after the recipient acted on the
424 * message.
425 *
426 */
427struct mrq_trace_modify_response {
Timo Alho4bef3582018-10-22 16:19:39 +0300428 /** @brief Bit mask of trace event enable states */
Thierry Reding983de5f2016-08-19 19:05:35 +0200429 uint32_t mask;
Jon Hunter4e871892020-07-12 11:01:18 +0100430} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200431
432/**
433 * @ingroup MRQ_Codes
434 * @def MRQ_WRITE_TRACE
435 * @brief Write trace data to a buffer
436 *
Jon Hunter4e871892020-07-12 11:01:18 +0100437 * @deprecated
438 *
Thierry Reding983de5f2016-08-19 19:05:35 +0200439 * * Platforms: All
440 * * Initiators: CCPLEX
441 * * Targets: BPMP
442 * * Request Payload: @ref mrq_write_trace_request
443 * * Response Payload: @ref mrq_write_trace_response
444 *
445 * mrq_response::err depends on the @ref mrq_write_trace_request field
446 * values. err is -#BPMP_EINVAL if size is zero or area is NULL or
447 * area is in an illegal range. A positive value for err indicates the
448 * number of bytes written to area.
449 *
450 * @note This MRQ is disabled on production systems
451 */
452
453/**
454 * @ingroup Trace
Timo Alho4bef3582018-10-22 16:19:39 +0300455 * @brief Request with #MRQ_WRITE_TRACE
Thierry Reding983de5f2016-08-19 19:05:35 +0200456 *
457 * Used by MRQ_WRITE_TRACE calls to ask the recipient to copy trace
458 * data from the recipient's local buffer to the output buffer. #area
459 * is treated as a byte-aligned pointer in the recipient's address
460 * space.
461 *
462 * The sender is responsible for ensuring that the output
463 * buffer is mapped in the recipient's address map. The recipient is
464 * responsible for protecting its own code and data from accidental
465 * overwrites.
466 */
467struct mrq_write_trace_request {
Timo Alho4bef3582018-10-22 16:19:39 +0300468 /** @brief Base address of output buffer */
Thierry Reding983de5f2016-08-19 19:05:35 +0200469 uint32_t area;
Timo Alho4bef3582018-10-22 16:19:39 +0300470 /** @brief Size in bytes of the output buffer */
Thierry Reding983de5f2016-08-19 19:05:35 +0200471 uint32_t size;
Jon Hunter4e871892020-07-12 11:01:18 +0100472} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200473
474/**
475 * @ingroup Trace
Timo Alho4bef3582018-10-22 16:19:39 +0300476 * @brief Response to #MRQ_WRITE_TRACE
Thierry Reding983de5f2016-08-19 19:05:35 +0200477 *
478 * Once this response is sent, the respondent will not access the
479 * output buffer further.
480 */
481struct mrq_write_trace_response {
482 /**
Timo Alho4bef3582018-10-22 16:19:39 +0300483 * @brief Flag whether more data remains in local buffer
Thierry Reding983de5f2016-08-19 19:05:35 +0200484 *
485 * Value is 1 if the entire local trace buffer has been
486 * drained to the outputbuffer. Value is 0 otherwise.
487 */
488 uint32_t eof;
Jon Hunter4e871892020-07-12 11:01:18 +0100489} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200490
491/** @private */
492struct mrq_threaded_ping_request {
493 uint32_t challenge;
Jon Hunter4e871892020-07-12 11:01:18 +0100494} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200495
496/** @private */
497struct mrq_threaded_ping_response {
498 uint32_t reply;
Jon Hunter4e871892020-07-12 11:01:18 +0100499} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200500
501/**
502 * @ingroup MRQ_Codes
503 * @def MRQ_MODULE_MAIL
Timo Alho4bef3582018-10-22 16:19:39 +0300504 * @brief Send a message to a loadable module
Thierry Reding983de5f2016-08-19 19:05:35 +0200505 *
Jon Hunter4e871892020-07-12 11:01:18 +0100506 * * Platforms: T210, T210B01, T186
507 * @cond (bpmp_t210 || bpmp_t210b01 || bpmp_t186)
Thierry Reding983de5f2016-08-19 19:05:35 +0200508 * * Initiators: Any
509 * * Targets: BPMP
510 * * Request Payload: @ref mrq_module_mail_request
511 * * Response Payload: @ref mrq_module_mail_response
512 *
513 * @note This MRQ is disabled on production systems
514 */
515
516/**
517 * @ingroup Module
Timo Alho4bef3582018-10-22 16:19:39 +0300518 * @brief Request with #MRQ_MODULE_MAIL
Thierry Reding983de5f2016-08-19 19:05:35 +0200519 */
520struct mrq_module_mail_request {
Timo Alho4bef3582018-10-22 16:19:39 +0300521 /** @brief Handle to the previously loaded module */
Thierry Reding983de5f2016-08-19 19:05:35 +0200522 uint32_t base;
Timo Alho4bef3582018-10-22 16:19:39 +0300523 /** @brief Module-specific mail payload
Thierry Reding983de5f2016-08-19 19:05:35 +0200524 *
525 * The length of data[ ] is unknown to the BPMP core firmware
526 * but it is limited to the size of an IPC message.
527 */
Jon Hunter4e871892020-07-12 11:01:18 +0100528 uint8_t data[BPMP_ABI_EMPTY_ARRAY];
529} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200530
531/**
532 * @ingroup Module
Timo Alho4bef3582018-10-22 16:19:39 +0300533 * @brief Response to #MRQ_MODULE_MAIL
Thierry Reding983de5f2016-08-19 19:05:35 +0200534 */
535struct mrq_module_mail_response {
Timo Alho4bef3582018-10-22 16:19:39 +0300536 /** @brief Module-specific mail payload
Thierry Reding983de5f2016-08-19 19:05:35 +0200537 *
538 * The length of data[ ] is unknown to the BPMP core firmware
539 * but it is limited to the size of an IPC message.
540 */
Jon Hunter4e871892020-07-12 11:01:18 +0100541 uint8_t data[BPMP_ABI_EMPTY_ARRAY];
542} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +0300543/** @endcond */
Thierry Reding983de5f2016-08-19 19:05:35 +0200544
545/**
546 * @ingroup MRQ_Codes
547 * @def MRQ_DEBUGFS
548 * @brief Interact with BPMP's debugfs file nodes
549 *
Jon Hunter5e37b9c2020-07-12 11:01:17 +0100550 * @deprecated use MRQ_DEBUG instead.
551 *
Timo Alho4bef3582018-10-22 16:19:39 +0300552 * * Platforms: T186, T194
Thierry Reding983de5f2016-08-19 19:05:35 +0200553 * * Initiators: Any
554 * * Targets: BPMP
555 * * Request Payload: @ref mrq_debugfs_request
556 * * Response Payload: @ref mrq_debugfs_response
557 */
558
559/**
560 * @addtogroup Debugfs
561 * @{
562 *
563 * The BPMP firmware implements a pseudo-filesystem called
564 * debugfs. Any driver within the firmware may register with debugfs
565 * to expose an arbitrary set of "files" in the filesystem. When
566 * software on the CPU writes to a debugfs file, debugfs passes the
567 * written data to a callback provided by the driver. When software on
568 * the CPU reads a debugfs file, debugfs queries the driver for the
569 * data to return to the CPU. The intention of the debugfs filesystem
570 * is to provide information useful for debugging the system at
571 * runtime.
572 *
573 * @note The files exposed via debugfs are not part of the
574 * BPMP firmware's ABI. debugfs files may be added or removed in any
575 * given version of the firmware. Typically the semantics of a debugfs
576 * file are consistent from version to version but even that is not
577 * guaranteed.
578 *
579 * @}
580 */
Timo Alho4bef3582018-10-22 16:19:39 +0300581
Thierry Reding983de5f2016-08-19 19:05:35 +0200582/** @ingroup Debugfs */
583enum mrq_debugfs_commands {
Timo Alho4bef3582018-10-22 16:19:39 +0300584 /** @brief Perform read */
Thierry Reding983de5f2016-08-19 19:05:35 +0200585 CMD_DEBUGFS_READ = 1,
Timo Alho4bef3582018-10-22 16:19:39 +0300586 /** @brief Perform write */
Thierry Reding983de5f2016-08-19 19:05:35 +0200587 CMD_DEBUGFS_WRITE = 2,
Timo Alho4bef3582018-10-22 16:19:39 +0300588 /** @brief Perform dumping directory */
Thierry Reding983de5f2016-08-19 19:05:35 +0200589 CMD_DEBUGFS_DUMPDIR = 3,
Timo Alho4bef3582018-10-22 16:19:39 +0300590 /** @brief Not a command */
Thierry Reding983de5f2016-08-19 19:05:35 +0200591 CMD_DEBUGFS_MAX
592};
593
594/**
595 * @ingroup Debugfs
Timo Alho4bef3582018-10-22 16:19:39 +0300596 * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
Thierry Reding983de5f2016-08-19 19:05:35 +0200597 */
598struct cmd_debugfs_fileop_request {
Timo Alho4bef3582018-10-22 16:19:39 +0300599 /** @brief Physical address pointing at filename */
Thierry Reding983de5f2016-08-19 19:05:35 +0200600 uint32_t fnameaddr;
Timo Alho4bef3582018-10-22 16:19:39 +0300601 /** @brief Length in bytes of filename buffer */
Thierry Reding983de5f2016-08-19 19:05:35 +0200602 uint32_t fnamelen;
Timo Alho4bef3582018-10-22 16:19:39 +0300603 /** @brief Physical address pointing to data buffer */
Thierry Reding983de5f2016-08-19 19:05:35 +0200604 uint32_t dataaddr;
Timo Alho4bef3582018-10-22 16:19:39 +0300605 /** @brief Length in bytes of data buffer */
Thierry Reding983de5f2016-08-19 19:05:35 +0200606 uint32_t datalen;
Jon Hunter4e871892020-07-12 11:01:18 +0100607} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200608
609/**
610 * @ingroup Debugfs
Timo Alho4bef3582018-10-22 16:19:39 +0300611 * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
Thierry Reding983de5f2016-08-19 19:05:35 +0200612 */
613struct cmd_debugfs_dumpdir_request {
Timo Alho4bef3582018-10-22 16:19:39 +0300614 /** @brief Physical address pointing to data buffer */
Thierry Reding983de5f2016-08-19 19:05:35 +0200615 uint32_t dataaddr;
Timo Alho4bef3582018-10-22 16:19:39 +0300616 /** @brief Length in bytes of data buffer */
Thierry Reding983de5f2016-08-19 19:05:35 +0200617 uint32_t datalen;
Jon Hunter4e871892020-07-12 11:01:18 +0100618} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200619
620/**
621 * @ingroup Debugfs
Timo Alho4bef3582018-10-22 16:19:39 +0300622 * @brief Response data for CMD_DEBUGFS_READ/WRITE command
Thierry Reding983de5f2016-08-19 19:05:35 +0200623 */
624struct cmd_debugfs_fileop_response {
Timo Alho4bef3582018-10-22 16:19:39 +0300625 /** @brief Always 0 */
Thierry Reding983de5f2016-08-19 19:05:35 +0200626 uint32_t reserved;
Timo Alho4bef3582018-10-22 16:19:39 +0300627 /** @brief Number of bytes read from or written to data buffer */
Thierry Reding983de5f2016-08-19 19:05:35 +0200628 uint32_t nbytes;
Jon Hunter4e871892020-07-12 11:01:18 +0100629} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200630
631/**
632 * @ingroup Debugfs
Timo Alho4bef3582018-10-22 16:19:39 +0300633 * @brief Response data for CMD_DEBUGFS_DUMPDIR command
Thierry Reding983de5f2016-08-19 19:05:35 +0200634 */
635struct cmd_debugfs_dumpdir_response {
Timo Alho4bef3582018-10-22 16:19:39 +0300636 /** @brief Always 0 */
Thierry Reding983de5f2016-08-19 19:05:35 +0200637 uint32_t reserved;
Timo Alho4bef3582018-10-22 16:19:39 +0300638 /** @brief Number of bytes read from or written to data buffer */
Thierry Reding983de5f2016-08-19 19:05:35 +0200639 uint32_t nbytes;
Jon Hunter4e871892020-07-12 11:01:18 +0100640} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200641
642/**
643 * @ingroup Debugfs
Timo Alho4bef3582018-10-22 16:19:39 +0300644 * @brief Request with #MRQ_DEBUGFS.
Thierry Reding983de5f2016-08-19 19:05:35 +0200645 *
646 * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs
647 * command to execute. Legal commands are the values of @ref
648 * mrq_debugfs_commands. Each command requires a specific additional
649 * payload of data.
650 *
651 * |command |payload|
652 * |-------------------|-------|
653 * |CMD_DEBUGFS_READ |fop |
654 * |CMD_DEBUGFS_WRITE |fop |
655 * |CMD_DEBUGFS_DUMPDIR|dumpdir|
656 */
657struct mrq_debugfs_request {
Timo Alho4bef3582018-10-22 16:19:39 +0300658 /** @brief Sub-command (@ref mrq_debugfs_commands) */
Thierry Reding983de5f2016-08-19 19:05:35 +0200659 uint32_t cmd;
660 union {
661 struct cmd_debugfs_fileop_request fop;
662 struct cmd_debugfs_dumpdir_request dumpdir;
Jon Hunter4e871892020-07-12 11:01:18 +0100663 } BPMP_UNION_ANON;
664} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200665
666/**
667 * @ingroup Debugfs
668 */
669struct mrq_debugfs_response {
Timo Alho4bef3582018-10-22 16:19:39 +0300670 /** @brief Always 0 */
Thierry Reding983de5f2016-08-19 19:05:35 +0200671 int32_t reserved;
672 union {
Timo Alho4bef3582018-10-22 16:19:39 +0300673 /** @brief Response data for CMD_DEBUGFS_READ OR
Thierry Reding983de5f2016-08-19 19:05:35 +0200674 * CMD_DEBUGFS_WRITE command
675 */
676 struct cmd_debugfs_fileop_response fop;
Timo Alho4bef3582018-10-22 16:19:39 +0300677 /** @brief Response data for CMD_DEBUGFS_DUMPDIR command */
Thierry Reding983de5f2016-08-19 19:05:35 +0200678 struct cmd_debugfs_dumpdir_response dumpdir;
Jon Hunter4e871892020-07-12 11:01:18 +0100679 } BPMP_UNION_ANON;
680} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200681
682/**
683 * @addtogroup Debugfs
684 * @{
685 */
686#define DEBUGFS_S_ISDIR (1 << 9)
687#define DEBUGFS_S_IRUSR (1 << 8)
688#define DEBUGFS_S_IWUSR (1 << 7)
689/** @} */
690
Thierry Reding983de5f2016-08-19 19:05:35 +0200691/**
692 * @ingroup MRQ_Codes
Jon Hunter5e37b9c2020-07-12 11:01:17 +0100693 * @def MRQ_DEBUG
694 * @brief Interact with BPMP's debugfs file nodes. Use message payload
695 * for exchanging data. This is functionally equivalent to
696 * @ref MRQ_DEBUGFS. But the way in which data is exchanged is different.
697 * When software running on CPU tries to read a debugfs file,
698 * the file path and read data will be stored in message payload.
699 * Since the message payload size is limited, a debugfs file
700 * transaction might require multiple frames of data exchanged
701 * between BPMP and CPU until the transaction completes.
702 *
703 * * Platforms: T194
704 * * Initiators: Any
705 * * Targets: BPMP
706 * * Request Payload: @ref mrq_debug_request
707 * * Response Payload: @ref mrq_debug_response
708 */
709
710/** @ingroup Debugfs */
711enum mrq_debug_commands {
712 /** @brief Open required file for read operation */
713 CMD_DEBUG_OPEN_RO = 0,
714 /** @brief Open required file for write operation */
715 CMD_DEBUG_OPEN_WO = 1,
716 /** @brief Perform read */
717 CMD_DEBUG_READ = 2,
718 /** @brief Perform write */
719 CMD_DEBUG_WRITE = 3,
720 /** @brief Close file */
721 CMD_DEBUG_CLOSE = 4,
722 /** @brief Not a command */
723 CMD_DEBUG_MAX
724};
725
726/**
727 * @ingroup Debugfs
728 * @brief Maximum number of files that can be open at a given time
729 */
730#define DEBUG_MAX_OPEN_FILES 1
731
732/**
733 * @ingroup Debugfs
734 * @brief Maximum size of null-terminated file name string in bytes.
735 * Value is derived from memory available in message payload while
736 * using @ref cmd_debug_fopen_request
737 * Value 4 corresponds to size of @ref mrq_debug_commands
738 * in @ref mrq_debug_request.
739 * 120 - 4 dbg_cmd(32bit) = 116
740 */
741#define DEBUG_FNAME_MAX_SZ (MSG_DATA_MIN_SZ - 4)
742
743/**
744 * @ingroup Debugfs
745 * @brief Parameters for CMD_DEBUG_OPEN command
746 */
747struct cmd_debug_fopen_request {
748 /** @brief File name - Null-terminated string with maximum
749 * length @ref DEBUG_FNAME_MAX_SZ
750 */
751 char name[DEBUG_FNAME_MAX_SZ];
Jon Hunter4e871892020-07-12 11:01:18 +0100752} BPMP_ABI_PACKED;
Jon Hunter5e37b9c2020-07-12 11:01:17 +0100753
754/**
755 * @ingroup Debugfs
756 * @brief Response data for CMD_DEBUG_OPEN_RO/WO command
757 */
758struct cmd_debug_fopen_response {
759 /** @brief Identifier for file access */
760 uint32_t fd;
761 /** @brief Data length. File data size for READ command.
762 * Maximum allowed length for WRITE command
763 */
764 uint32_t datalen;
Jon Hunter4e871892020-07-12 11:01:18 +0100765} BPMP_ABI_PACKED;
Jon Hunter5e37b9c2020-07-12 11:01:17 +0100766
767/**
768 * @ingroup Debugfs
769 * @brief Parameters for CMD_DEBUG_READ command
770 */
771struct cmd_debug_fread_request {
772 /** @brief File access identifier received in response
773 * to CMD_DEBUG_OPEN_RO request
774 */
775 uint32_t fd;
Jon Hunter4e871892020-07-12 11:01:18 +0100776} BPMP_ABI_PACKED;
Jon Hunter5e37b9c2020-07-12 11:01:17 +0100777
778/**
779 * @ingroup Debugfs
780 * @brief Maximum size of read data in bytes.
781 * Value is derived from memory available in message payload while
782 * using @ref cmd_debug_fread_response.
783 */
784#define DEBUG_READ_MAX_SZ (MSG_DATA_MIN_SZ - 4)
785
786/**
787 * @ingroup Debugfs
788 * @brief Response data for CMD_DEBUG_READ command
789 */
790struct cmd_debug_fread_response {
791 /** @brief Size of data provided in this response in bytes */
792 uint32_t readlen;
793 /** @brief File data from seek position */
794 char data[DEBUG_READ_MAX_SZ];
Jon Hunter4e871892020-07-12 11:01:18 +0100795} BPMP_ABI_PACKED;
Jon Hunter5e37b9c2020-07-12 11:01:17 +0100796
797/**
798 * @ingroup Debugfs
799 * @brief Maximum size of write data in bytes.
800 * Value is derived from memory available in message payload while
801 * using @ref cmd_debug_fwrite_request.
802 */
803#define DEBUG_WRITE_MAX_SZ (MSG_DATA_MIN_SZ - 12)
804
805/**
806 * @ingroup Debugfs
807 * @brief Parameters for CMD_DEBUG_WRITE command
808 */
809struct cmd_debug_fwrite_request {
810 /** @brief File access identifier received in response
811 * to CMD_DEBUG_OPEN_RO request
812 */
813 uint32_t fd;
814 /** @brief Size of write data in bytes */
815 uint32_t datalen;
816 /** @brief Data to be written */
817 char data[DEBUG_WRITE_MAX_SZ];
Jon Hunter4e871892020-07-12 11:01:18 +0100818} BPMP_ABI_PACKED;
Jon Hunter5e37b9c2020-07-12 11:01:17 +0100819
820/**
821 * @ingroup Debugfs
822 * @brief Parameters for CMD_DEBUG_CLOSE command
823 */
824struct cmd_debug_fclose_request {
825 /** @brief File access identifier received in response
826 * to CMD_DEBUG_OPEN_RO request
827 */
828 uint32_t fd;
Jon Hunter4e871892020-07-12 11:01:18 +0100829} BPMP_ABI_PACKED;
Jon Hunter5e37b9c2020-07-12 11:01:17 +0100830
831/**
832 * @ingroup Debugfs
833 * @brief Request with #MRQ_DEBUG.
834 *
835 * The sender of an MRQ_DEBUG message uses #cmd to specify a debugfs
836 * command to execute. Legal commands are the values of @ref
837 * mrq_debug_commands. Each command requires a specific additional
838 * payload of data.
839 *
840 * |command |payload|
841 * |-------------------|-------|
842 * |CMD_DEBUG_OPEN_RO |fop |
843 * |CMD_DEBUG_OPEN_WO |fop |
844 * |CMD_DEBUG_READ |frd |
845 * |CMD_DEBUG_WRITE |fwr |
846 * |CMD_DEBUG_CLOSE |fcl |
847 */
848struct mrq_debug_request {
849 /** @brief Sub-command (@ref mrq_debug_commands) */
850 uint32_t cmd;
851 union {
852 /** @brief Request payload for CMD_DEBUG_OPEN_RO/WO command */
853 struct cmd_debug_fopen_request fop;
854 /** @brief Request payload for CMD_DEBUG_READ command */
855 struct cmd_debug_fread_request frd;
856 /** @brief Request payload for CMD_DEBUG_WRITE command */
857 struct cmd_debug_fwrite_request fwr;
858 /** @brief Request payload for CMD_DEBUG_CLOSE command */
859 struct cmd_debug_fclose_request fcl;
Jon Hunter4e871892020-07-12 11:01:18 +0100860 } BPMP_UNION_ANON;
861} BPMP_ABI_PACKED;
Jon Hunter5e37b9c2020-07-12 11:01:17 +0100862
863/**
864 * @ingroup Debugfs
865 */
866struct mrq_debug_response {
867 union {
868 /** @brief Response data for CMD_DEBUG_OPEN_RO/WO command */
869 struct cmd_debug_fopen_response fop;
870 /** @brief Response data for CMD_DEBUG_READ command */
871 struct cmd_debug_fread_response frd;
Jon Hunter4e871892020-07-12 11:01:18 +0100872 } BPMP_UNION_ANON;
873} BPMP_ABI_PACKED;
Jon Hunter5e37b9c2020-07-12 11:01:17 +0100874
875/**
876 * @ingroup MRQ_Codes
Thierry Reding983de5f2016-08-19 19:05:35 +0200877 * @def MRQ_RESET
Timo Alho4bef3582018-10-22 16:19:39 +0300878 * @brief Reset an IP block
Thierry Reding983de5f2016-08-19 19:05:35 +0200879 *
Timo Alho4bef3582018-10-22 16:19:39 +0300880 * * Platforms: T186, T194
Thierry Reding983de5f2016-08-19 19:05:35 +0200881 * * Initiators: Any
882 * * Targets: BPMP
883 * * Request Payload: @ref mrq_reset_request
Thierry Reding52b8b802017-03-29 18:34:51 +0200884 * * Response Payload: @ref mrq_reset_response
Timo Alho4bef3582018-10-22 16:19:39 +0300885 *
886 * @addtogroup Reset
887 * @{
Thierry Reding983de5f2016-08-19 19:05:35 +0200888 */
889
Thierry Reding983de5f2016-08-19 19:05:35 +0200890enum mrq_reset_commands {
Jon Hunter4e871892020-07-12 11:01:18 +0100891 /**
892 * @brief Assert module reset
893 *
894 * mrq_response::err is 0 if the operation was successful, or @n
895 * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n
896 * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n
897 * -#BPMP_ENOTSUP if target domain h/w state does not allow reset
898 */
Thierry Reding983de5f2016-08-19 19:05:35 +0200899 CMD_RESET_ASSERT = 1,
Jon Hunter4e871892020-07-12 11:01:18 +0100900 /**
901 * @brief Deassert module reset
902 *
903 * mrq_response::err is 0 if the operation was successful, or @n
904 * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n
905 * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n
906 * -#BPMP_ENOTSUP if target domain h/w state does not allow reset
907 */
Thierry Reding983de5f2016-08-19 19:05:35 +0200908 CMD_RESET_DEASSERT = 2,
Jon Hunter4e871892020-07-12 11:01:18 +0100909 /**
910 * @brief Assert and deassert the module reset
911 *
912 * mrq_response::err is 0 if the operation was successful, or @n
913 * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n
914 * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n
915 * -#BPMP_ENOTSUP if target domain h/w state does not allow reset
916 */
Thierry Reding983de5f2016-08-19 19:05:35 +0200917 CMD_RESET_MODULE = 3,
Jon Hunter4e871892020-07-12 11:01:18 +0100918 /**
919 * @brief Get the highest reset ID
920 *
921 * mrq_response::err is 0 if the operation was successful, or @n
922 * -#BPMP_ENODEV if no reset domains are supported (number of IDs is 0)
923 */
Thierry Reding52b8b802017-03-29 18:34:51 +0200924 CMD_RESET_GET_MAX_ID = 4,
Jon Hunter4e871892020-07-12 11:01:18 +0100925
Timo Alho4bef3582018-10-22 16:19:39 +0300926 /** @brief Not part of ABI and subject to change */
927 CMD_RESET_MAX,
Thierry Reding983de5f2016-08-19 19:05:35 +0200928};
929
930/**
Timo Alho4bef3582018-10-22 16:19:39 +0300931 * @brief Request with MRQ_RESET
Thierry Reding983de5f2016-08-19 19:05:35 +0200932 *
933 * Used by the sender of an #MRQ_RESET message to request BPMP to
934 * assert or or deassert a given reset line.
935 */
936struct mrq_reset_request {
Timo Alho4bef3582018-10-22 16:19:39 +0300937 /** @brief Reset action to perform (@ref mrq_reset_commands) */
Thierry Reding983de5f2016-08-19 19:05:35 +0200938 uint32_t cmd;
Timo Alho4bef3582018-10-22 16:19:39 +0300939 /** @brief Id of the reset to affected */
Thierry Reding983de5f2016-08-19 19:05:35 +0200940 uint32_t reset_id;
Jon Hunter4e871892020-07-12 11:01:18 +0100941} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +0200942
943/**
Thierry Reding52b8b802017-03-29 18:34:51 +0200944 * @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When
945 * this sub-command is not supported, firmware will return -BPMP_EBADCMD
946 * in mrq_response::err.
947 */
948struct cmd_reset_get_max_id_response {
Timo Alho4bef3582018-10-22 16:19:39 +0300949 /** @brief Max reset id */
Thierry Reding52b8b802017-03-29 18:34:51 +0200950 uint32_t max_id;
Jon Hunter4e871892020-07-12 11:01:18 +0100951} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +0200952
953/**
Thierry Reding52b8b802017-03-29 18:34:51 +0200954 * @brief Response with MRQ_RESET
955 *
956 * Each sub-command supported by @ref mrq_reset_request may return
957 * sub-command-specific data. Some do and some do not as indicated
958 * in the following table
959 *
960 * | sub-command | payload |
961 * |----------------------|------------------|
962 * | CMD_RESET_ASSERT | - |
963 * | CMD_RESET_DEASSERT | - |
964 * | CMD_RESET_MODULE | - |
965 * | CMD_RESET_GET_MAX_ID | reset_get_max_id |
966 */
967struct mrq_reset_response {
968 union {
969 struct cmd_reset_get_max_id_response reset_get_max_id;
Jon Hunter4e871892020-07-12 11:01:18 +0100970 } BPMP_UNION_ANON;
971} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +0200972
Timo Alho4bef3582018-10-22 16:19:39 +0300973/** @} */
974
Thierry Reding52b8b802017-03-29 18:34:51 +0200975/**
Thierry Reding983de5f2016-08-19 19:05:35 +0200976 * @ingroup MRQ_Codes
977 * @def MRQ_I2C
Timo Alho4bef3582018-10-22 16:19:39 +0300978 * @brief Issue an i2c transaction
Thierry Reding983de5f2016-08-19 19:05:35 +0200979 *
Timo Alho4bef3582018-10-22 16:19:39 +0300980 * * Platforms: T186, T194
Thierry Reding983de5f2016-08-19 19:05:35 +0200981 * * Initiators: Any
982 * * Targets: BPMP
983 * * Request Payload: @ref mrq_i2c_request
984 * * Response Payload: @ref mrq_i2c_response
Timo Alho4bef3582018-10-22 16:19:39 +0300985 *
Thierry Reding983de5f2016-08-19 19:05:35 +0200986 * @addtogroup I2C
987 * @{
988 */
Jon Hunter4e871892020-07-12 11:01:18 +0100989#define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE (MSG_DATA_MIN_SZ - 12U)
990#define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE (MSG_DATA_MIN_SZ - 4U)
Thierry Reding983de5f2016-08-19 19:05:35 +0200991
Jon Hunter4e871892020-07-12 11:01:18 +0100992#define SERIALI2C_TEN 0x0010U
993#define SERIALI2C_RD 0x0001U
994#define SERIALI2C_STOP 0x8000U
995#define SERIALI2C_NOSTART 0x4000U
996#define SERIALI2C_REV_DIR_ADDR 0x2000U
997#define SERIALI2C_IGNORE_NAK 0x1000U
998#define SERIALI2C_NO_RD_ACK 0x0800U
999#define SERIALI2C_RECV_LEN 0x0400U
Timo Alho4bef3582018-10-22 16:19:39 +03001000
Thierry Reding983de5f2016-08-19 19:05:35 +02001001enum {
1002 CMD_I2C_XFER = 1
1003};
1004
1005/**
Timo Alho4bef3582018-10-22 16:19:39 +03001006 * @brief Serializable i2c request
Thierry Reding983de5f2016-08-19 19:05:35 +02001007 *
1008 * Instances of this structure are packed (little-endian) into
1009 * cmd_i2c_xfer_request::data_buf. Each instance represents a single
1010 * transaction (or a portion of a transaction with repeated starts) on
1011 * an i2c bus.
1012 *
1013 * Because these structures are packed, some instances are likely to
1014 * be misaligned. Additionally because #data is variable length, it is
1015 * not possible to iterate through a serialized list of these
1016 * structures without inspecting #len in each instance. It may be
1017 * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf
1018 * manually rather than using this structure definition.
1019*/
1020struct serial_i2c_request {
1021 /** @brief I2C slave address */
1022 uint16_t addr;
Timo Alho4bef3582018-10-22 16:19:39 +03001023 /** @brief Bitmask of SERIALI2C_ flags */
Thierry Reding983de5f2016-08-19 19:05:35 +02001024 uint16_t flags;
Timo Alho4bef3582018-10-22 16:19:39 +03001025 /** @brief Length of I2C transaction in bytes */
Thierry Reding983de5f2016-08-19 19:05:35 +02001026 uint16_t len;
Timo Alho4bef3582018-10-22 16:19:39 +03001027 /** @brief For write transactions only, #len bytes of data */
Thierry Reding983de5f2016-08-19 19:05:35 +02001028 uint8_t data[];
Jon Hunter4e871892020-07-12 11:01:18 +01001029} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001030
1031/**
Timo Alho4bef3582018-10-22 16:19:39 +03001032 * @brief Trigger one or more i2c transactions
Thierry Reding983de5f2016-08-19 19:05:35 +02001033 */
1034struct cmd_i2c_xfer_request {
Timo Alho4bef3582018-10-22 16:19:39 +03001035 /** @brief Valid bus number from @ref bpmp_i2c_ids*/
Thierry Reding983de5f2016-08-19 19:05:35 +02001036 uint32_t bus_id;
1037
Timo Alho4bef3582018-10-22 16:19:39 +03001038 /** @brief Count of valid bytes in #data_buf*/
Thierry Reding983de5f2016-08-19 19:05:35 +02001039 uint32_t data_size;
1040
Timo Alho4bef3582018-10-22 16:19:39 +03001041 /** @brief Serialized packed instances of @ref serial_i2c_request*/
Thierry Reding983de5f2016-08-19 19:05:35 +02001042 uint8_t data_buf[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE];
Jon Hunter4e871892020-07-12 11:01:18 +01001043} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001044
1045/**
Timo Alho4bef3582018-10-22 16:19:39 +03001046 * @brief Container for data read from the i2c bus
Thierry Reding983de5f2016-08-19 19:05:35 +02001047 *
1048 * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute
1049 * zero or more I2C reads. The data read from the bus is serialized
1050 * into #data_buf.
1051 */
1052struct cmd_i2c_xfer_response {
Timo Alho4bef3582018-10-22 16:19:39 +03001053 /** @brief Count of valid bytes in #data_buf*/
Thierry Reding983de5f2016-08-19 19:05:35 +02001054 uint32_t data_size;
Timo Alho4bef3582018-10-22 16:19:39 +03001055 /** @brief I2c read data */
Thierry Reding983de5f2016-08-19 19:05:35 +02001056 uint8_t data_buf[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE];
Jon Hunter4e871892020-07-12 11:01:18 +01001057} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001058
1059/**
Timo Alho4bef3582018-10-22 16:19:39 +03001060 * @brief Request with #MRQ_I2C
Thierry Reding983de5f2016-08-19 19:05:35 +02001061 */
1062struct mrq_i2c_request {
Timo Alho4bef3582018-10-22 16:19:39 +03001063 /** @brief Always CMD_I2C_XFER (i.e. 1) */
Thierry Reding983de5f2016-08-19 19:05:35 +02001064 uint32_t cmd;
Timo Alho4bef3582018-10-22 16:19:39 +03001065 /** @brief Parameters of the transfer request */
Thierry Reding983de5f2016-08-19 19:05:35 +02001066 struct cmd_i2c_xfer_request xfer;
Jon Hunter4e871892020-07-12 11:01:18 +01001067} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001068
1069/**
Timo Alho4bef3582018-10-22 16:19:39 +03001070 * @brief Response to #MRQ_I2C
Jon Hunter4e871892020-07-12 11:01:18 +01001071 *
1072 * mrq_response:err is
1073 * 0: Success
1074 * -#BPMP_EBADCMD: if mrq_i2c_request::cmd is other than 1
1075 * -#BPMP_EINVAL: if cmd_i2c_xfer_request does not contain correctly formatted request
1076 * -#BPMP_ENODEV: if cmd_i2c_xfer_request::bus_id is not supported by BPMP
1077 * -#BPMP_EACCES: if i2c transaction is not allowed due to firewall rules
1078 * -#BPMP_ETIMEDOUT: if i2c transaction times out
1079 * -#BPMP_ENXIO: if i2c slave device does not reply with ACK to the transaction
1080 * -#BPMP_EAGAIN: if ARB_LOST condition is detected by the i2c controller
1081 * -#BPMP_EIO: any other i2c controller error code than NO_ACK or ARB_LOST
Thierry Reding983de5f2016-08-19 19:05:35 +02001082 */
1083struct mrq_i2c_response {
1084 struct cmd_i2c_xfer_response xfer;
Jon Hunter4e871892020-07-12 11:01:18 +01001085} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001086
Timo Alho4bef3582018-10-22 16:19:39 +03001087/** @} */
1088
Thierry Reding983de5f2016-08-19 19:05:35 +02001089/**
1090 * @ingroup MRQ_Codes
1091 * @def MRQ_CLK
Timo Alho4bef3582018-10-22 16:19:39 +03001092 * @brief Perform a clock operation
Thierry Reding983de5f2016-08-19 19:05:35 +02001093 *
Timo Alho4bef3582018-10-22 16:19:39 +03001094 * * Platforms: T186, T194
Thierry Reding983de5f2016-08-19 19:05:35 +02001095 * * Initiators: Any
1096 * * Targets: BPMP
1097 * * Request Payload: @ref mrq_clk_request
1098 * * Response Payload: @ref mrq_clk_response
Timo Alho4bef3582018-10-22 16:19:39 +03001099 *
Thierry Reding983de5f2016-08-19 19:05:35 +02001100 * @addtogroup Clocks
1101 * @{
1102 */
Thierry Reding983de5f2016-08-19 19:05:35 +02001103enum {
1104 CMD_CLK_GET_RATE = 1,
1105 CMD_CLK_SET_RATE = 2,
1106 CMD_CLK_ROUND_RATE = 3,
1107 CMD_CLK_GET_PARENT = 4,
1108 CMD_CLK_SET_PARENT = 5,
1109 CMD_CLK_IS_ENABLED = 6,
1110 CMD_CLK_ENABLE = 7,
1111 CMD_CLK_DISABLE = 8,
1112 CMD_CLK_GET_ALL_INFO = 14,
1113 CMD_CLK_GET_MAX_CLK_ID = 15,
Timo Alho4bef3582018-10-22 16:19:39 +03001114 CMD_CLK_GET_FMAX_AT_VMIN = 16,
Thierry Reding983de5f2016-08-19 19:05:35 +02001115 CMD_CLK_MAX,
1116};
Thierry Reding983de5f2016-08-19 19:05:35 +02001117
Jon Hunter4e871892020-07-12 11:01:18 +01001118#define BPMP_CLK_HAS_MUX (1U << 0U)
1119#define BPMP_CLK_HAS_SET_RATE (1U << 1U)
1120#define BPMP_CLK_IS_ROOT (1U << 2U)
1121#define BPMP_CLK_IS_VAR_ROOT (1U << 3U)
Thierry Reding52b8b802017-03-29 18:34:51 +02001122
Jon Hunter4e871892020-07-12 11:01:18 +01001123#define MRQ_CLK_NAME_MAXLEN 40U
1124#define MRQ_CLK_MAX_PARENTS 16U
Thierry Reding983de5f2016-08-19 19:05:35 +02001125
1126/** @private */
1127struct cmd_clk_get_rate_request {
Jon Hunter4e871892020-07-12 11:01:18 +01001128 BPMP_ABI_EMPTY
1129} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001130
1131struct cmd_clk_get_rate_response {
1132 int64_t rate;
Jon Hunter4e871892020-07-12 11:01:18 +01001133} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001134
1135struct cmd_clk_set_rate_request {
1136 int32_t unused;
1137 int64_t rate;
Jon Hunter4e871892020-07-12 11:01:18 +01001138} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001139
1140struct cmd_clk_set_rate_response {
1141 int64_t rate;
Jon Hunter4e871892020-07-12 11:01:18 +01001142} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001143
1144struct cmd_clk_round_rate_request {
1145 int32_t unused;
1146 int64_t rate;
Jon Hunter4e871892020-07-12 11:01:18 +01001147} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001148
1149struct cmd_clk_round_rate_response {
1150 int64_t rate;
Jon Hunter4e871892020-07-12 11:01:18 +01001151} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001152
1153/** @private */
1154struct cmd_clk_get_parent_request {
Jon Hunter4e871892020-07-12 11:01:18 +01001155 BPMP_ABI_EMPTY
1156} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001157
1158struct cmd_clk_get_parent_response {
1159 uint32_t parent_id;
Jon Hunter4e871892020-07-12 11:01:18 +01001160} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001161
1162struct cmd_clk_set_parent_request {
1163 uint32_t parent_id;
Jon Hunter4e871892020-07-12 11:01:18 +01001164} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001165
1166struct cmd_clk_set_parent_response {
1167 uint32_t parent_id;
Jon Hunter4e871892020-07-12 11:01:18 +01001168} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001169
1170/** @private */
1171struct cmd_clk_is_enabled_request {
Jon Hunter4e871892020-07-12 11:01:18 +01001172 BPMP_ABI_EMPTY
1173} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001174
Jon Hunter4e871892020-07-12 11:01:18 +01001175/**
1176 * @brief Response data to #MRQ_CLK sub-command CMD_CLK_IS_ENABLED
1177 */
Thierry Reding983de5f2016-08-19 19:05:35 +02001178struct cmd_clk_is_enabled_response {
Jon Hunter4e871892020-07-12 11:01:18 +01001179 /**
1180 * @brief The state of the clock that has been succesfully
1181 * requested with CMD_CLK_ENABLE or CMD_CLK_DISABLE by the
1182 * master invoking the command earlier.
1183 *
1184 * The state may not reflect the physical state of the clock
1185 * if there are some other masters requesting it to be
1186 * enabled.
1187 *
1188 * Value 0 is disabled, all other values indicate enabled.
1189 */
Thierry Reding983de5f2016-08-19 19:05:35 +02001190 int32_t state;
Jon Hunter4e871892020-07-12 11:01:18 +01001191} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001192
1193/** @private */
1194struct cmd_clk_enable_request {
Jon Hunter4e871892020-07-12 11:01:18 +01001195 BPMP_ABI_EMPTY
1196} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001197
1198/** @private */
1199struct cmd_clk_enable_response {
Jon Hunter4e871892020-07-12 11:01:18 +01001200 BPMP_ABI_EMPTY
1201} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001202
1203/** @private */
1204struct cmd_clk_disable_request {
Jon Hunter4e871892020-07-12 11:01:18 +01001205 BPMP_ABI_EMPTY
1206} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001207
1208/** @private */
1209struct cmd_clk_disable_response {
Jon Hunter4e871892020-07-12 11:01:18 +01001210 BPMP_ABI_EMPTY
1211} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001212
1213/** @private */
1214struct cmd_clk_get_all_info_request {
Jon Hunter4e871892020-07-12 11:01:18 +01001215 BPMP_ABI_EMPTY
1216} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001217
1218struct cmd_clk_get_all_info_response {
1219 uint32_t flags;
1220 uint32_t parent;
1221 uint32_t parents[MRQ_CLK_MAX_PARENTS];
1222 uint8_t num_parents;
1223 uint8_t name[MRQ_CLK_NAME_MAXLEN];
Jon Hunter4e871892020-07-12 11:01:18 +01001224} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001225
1226/** @private */
1227struct cmd_clk_get_max_clk_id_request {
Jon Hunter4e871892020-07-12 11:01:18 +01001228 BPMP_ABI_EMPTY
1229} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001230
1231struct cmd_clk_get_max_clk_id_response {
1232 uint32_t max_id;
Jon Hunter4e871892020-07-12 11:01:18 +01001233} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03001234
1235/** @private */
1236struct cmd_clk_get_fmax_at_vmin_request {
Jon Hunter4e871892020-07-12 11:01:18 +01001237 BPMP_ABI_EMPTY
1238} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03001239
1240struct cmd_clk_get_fmax_at_vmin_response {
1241 int64_t rate;
Jon Hunter4e871892020-07-12 11:01:18 +01001242} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001243
1244/**
1245 * @ingroup Clocks
Timo Alho4bef3582018-10-22 16:19:39 +03001246 * @brief Request with #MRQ_CLK
Thierry Reding983de5f2016-08-19 19:05:35 +02001247 *
1248 * Used by the sender of an #MRQ_CLK message to control clocks. The
1249 * clk_request is split into several sub-commands. Some sub-commands
1250 * require no additional data. Others have a sub-command specific
1251 * payload
1252 *
1253 * |sub-command |payload |
1254 * |----------------------------|-----------------------|
1255 * |CMD_CLK_GET_RATE |- |
1256 * |CMD_CLK_SET_RATE |clk_set_rate |
1257 * |CMD_CLK_ROUND_RATE |clk_round_rate |
1258 * |CMD_CLK_GET_PARENT |- |
1259 * |CMD_CLK_SET_PARENT |clk_set_parent |
1260 * |CMD_CLK_IS_ENABLED |- |
1261 * |CMD_CLK_ENABLE |- |
1262 * |CMD_CLK_DISABLE |- |
1263 * |CMD_CLK_GET_ALL_INFO |- |
1264 * |CMD_CLK_GET_MAX_CLK_ID |- |
Timo Alho4bef3582018-10-22 16:19:39 +03001265 * |CMD_CLK_GET_FMAX_AT_VMIN |-
1266 * |
Thierry Reding983de5f2016-08-19 19:05:35 +02001267 *
1268 */
1269
1270struct mrq_clk_request {
Timo Alho4bef3582018-10-22 16:19:39 +03001271 /** @brief Sub-command and clock id concatenated to 32-bit word.
Thierry Reding983de5f2016-08-19 19:05:35 +02001272 * - bits[31..24] is the sub-cmd.
1273 * - bits[23..0] is the clock id
1274 */
1275 uint32_t cmd_and_id;
1276
1277 union {
1278 /** @private */
1279 struct cmd_clk_get_rate_request clk_get_rate;
1280 struct cmd_clk_set_rate_request clk_set_rate;
1281 struct cmd_clk_round_rate_request clk_round_rate;
1282 /** @private */
1283 struct cmd_clk_get_parent_request clk_get_parent;
1284 struct cmd_clk_set_parent_request clk_set_parent;
1285 /** @private */
1286 struct cmd_clk_enable_request clk_enable;
1287 /** @private */
1288 struct cmd_clk_disable_request clk_disable;
1289 /** @private */
1290 struct cmd_clk_is_enabled_request clk_is_enabled;
1291 /** @private */
1292 struct cmd_clk_get_all_info_request clk_get_all_info;
1293 /** @private */
1294 struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id;
Timo Alho4bef3582018-10-22 16:19:39 +03001295 /** @private */
1296 struct cmd_clk_get_fmax_at_vmin_request clk_get_fmax_at_vmin;
Jon Hunter4e871892020-07-12 11:01:18 +01001297 } BPMP_UNION_ANON;
1298} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001299
1300/**
1301 * @ingroup Clocks
Timo Alho4bef3582018-10-22 16:19:39 +03001302 * @brief Response to MRQ_CLK
Thierry Reding983de5f2016-08-19 19:05:35 +02001303 *
1304 * Each sub-command supported by @ref mrq_clk_request may return
1305 * sub-command-specific data. Some do and some do not as indicated in
1306 * the following table
1307 *
1308 * |sub-command |payload |
1309 * |----------------------------|------------------------|
1310 * |CMD_CLK_GET_RATE |clk_get_rate |
1311 * |CMD_CLK_SET_RATE |clk_set_rate |
1312 * |CMD_CLK_ROUND_RATE |clk_round_rate |
1313 * |CMD_CLK_GET_PARENT |clk_get_parent |
1314 * |CMD_CLK_SET_PARENT |clk_set_parent |
1315 * |CMD_CLK_IS_ENABLED |clk_is_enabled |
1316 * |CMD_CLK_ENABLE |- |
1317 * |CMD_CLK_DISABLE |- |
1318 * |CMD_CLK_GET_ALL_INFO |clk_get_all_info |
1319 * |CMD_CLK_GET_MAX_CLK_ID |clk_get_max_id |
Timo Alho4bef3582018-10-22 16:19:39 +03001320 * |CMD_CLK_GET_FMAX_AT_VMIN |clk_get_fmax_at_vmin |
Thierry Reding983de5f2016-08-19 19:05:35 +02001321 *
1322 */
1323
1324struct mrq_clk_response {
1325 union {
1326 struct cmd_clk_get_rate_response clk_get_rate;
1327 struct cmd_clk_set_rate_response clk_set_rate;
1328 struct cmd_clk_round_rate_response clk_round_rate;
1329 struct cmd_clk_get_parent_response clk_get_parent;
1330 struct cmd_clk_set_parent_response clk_set_parent;
1331 /** @private */
1332 struct cmd_clk_enable_response clk_enable;
1333 /** @private */
1334 struct cmd_clk_disable_response clk_disable;
1335 struct cmd_clk_is_enabled_response clk_is_enabled;
1336 struct cmd_clk_get_all_info_response clk_get_all_info;
1337 struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id;
Timo Alho4bef3582018-10-22 16:19:39 +03001338 struct cmd_clk_get_fmax_at_vmin_response clk_get_fmax_at_vmin;
Jon Hunter4e871892020-07-12 11:01:18 +01001339 } BPMP_UNION_ANON;
1340} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001341
Timo Alho4bef3582018-10-22 16:19:39 +03001342/** @} */
1343
Thierry Reding983de5f2016-08-19 19:05:35 +02001344/**
1345 * @ingroup MRQ_Codes
1346 * @def MRQ_QUERY_ABI
Timo Alho4bef3582018-10-22 16:19:39 +03001347 * @brief Check if an MRQ is implemented
Thierry Reding983de5f2016-08-19 19:05:35 +02001348 *
1349 * * Platforms: All
1350 * * Initiators: Any
Thierry Reding52b8b802017-03-29 18:34:51 +02001351 * * Targets: Any except DMCE
Thierry Reding983de5f2016-08-19 19:05:35 +02001352 * * Request Payload: @ref mrq_query_abi_request
1353 * * Response Payload: @ref mrq_query_abi_response
1354 */
1355
1356/**
1357 * @ingroup ABI_info
Timo Alho4bef3582018-10-22 16:19:39 +03001358 * @brief Request with MRQ_QUERY_ABI
Thierry Reding983de5f2016-08-19 19:05:35 +02001359 *
1360 * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported
1361 * by the recipient.
1362 */
1363struct mrq_query_abi_request {
1364 /** @brief MRQ code to query */
1365 uint32_t mrq;
Jon Hunter4e871892020-07-12 11:01:18 +01001366} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001367
1368/**
1369 * @ingroup ABI_info
Timo Alho4bef3582018-10-22 16:19:39 +03001370 * @brief Response to MRQ_QUERY_ABI
Thierry Reding52b8b802017-03-29 18:34:51 +02001371 *
1372 * @note mrq_response::err of 0 indicates that the query was
1373 * successful, not that the MRQ itself is supported!
Thierry Reding983de5f2016-08-19 19:05:35 +02001374 */
1375struct mrq_query_abi_response {
1376 /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */
1377 int32_t status;
Jon Hunter4e871892020-07-12 11:01:18 +01001378} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001379
1380/**
1381 * @ingroup MRQ_Codes
1382 * @def MRQ_PG_READ_STATE
Timo Alho4bef3582018-10-22 16:19:39 +03001383 * @brief Read the power-gating state of a partition
Thierry Reding983de5f2016-08-19 19:05:35 +02001384 *
1385 * * Platforms: T186
Timo Alho4bef3582018-10-22 16:19:39 +03001386 * @cond bpmp_t186
Thierry Reding983de5f2016-08-19 19:05:35 +02001387 * * Initiators: Any
1388 * * Targets: BPMP
1389 * * Request Payload: @ref mrq_pg_read_state_request
1390 * * Response Payload: @ref mrq_pg_read_state_response
Thierry Reding983de5f2016-08-19 19:05:35 +02001391 */
1392
1393/**
Timo Alho4bef3582018-10-22 16:19:39 +03001394 * @ingroup Powergating
1395 * @brief Request with #MRQ_PG_READ_STATE
Thierry Reding983de5f2016-08-19 19:05:35 +02001396 *
1397 * Used by MRQ_PG_READ_STATE call to read the current state of a
1398 * partition.
1399 */
1400struct mrq_pg_read_state_request {
1401 /** @brief ID of partition */
1402 uint32_t partition_id;
Jon Hunter4e871892020-07-12 11:01:18 +01001403} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001404
1405/**
Timo Alho4bef3582018-10-22 16:19:39 +03001406 * @ingroup Powergating
1407 * @brief Response to MRQ_PG_READ_STATE
Thierry Reding983de5f2016-08-19 19:05:35 +02001408 * @todo define possible errors.
1409 */
1410struct mrq_pg_read_state_response {
Timo Alho4bef3582018-10-22 16:19:39 +03001411 /** @brief Read as don't care */
Thierry Reding983de5f2016-08-19 19:05:35 +02001412 uint32_t sram_state;
Timo Alho4bef3582018-10-22 16:19:39 +03001413 /** @brief State of power partition
Thierry Reding983de5f2016-08-19 19:05:35 +02001414 * * 0 : off
1415 * * 1 : on
1416 */
1417 uint32_t logic_state;
Jon Hunter4e871892020-07-12 11:01:18 +01001418} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03001419/** @endcond*/
Thierry Reding983de5f2016-08-19 19:05:35 +02001420/** @} */
1421
1422/**
1423 * @ingroup MRQ_Codes
1424 * @def MRQ_PG_UPDATE_STATE
Timo Alho4bef3582018-10-22 16:19:39 +03001425 * @brief Modify the power-gating state of a partition. In contrast to
Thierry Reding52b8b802017-03-29 18:34:51 +02001426 * MRQ_PG calls, the operations that change state (on/off) of power
1427 * partition are reference counted.
Thierry Reding983de5f2016-08-19 19:05:35 +02001428 *
1429 * * Platforms: T186
Timo Alho4bef3582018-10-22 16:19:39 +03001430 * @cond bpmp_t186
Thierry Reding983de5f2016-08-19 19:05:35 +02001431 * * Initiators: Any
1432 * * Targets: BPMP
1433 * * Request Payload: @ref mrq_pg_update_state_request
1434 * * Response Payload: N/A
Thierry Reding983de5f2016-08-19 19:05:35 +02001435 */
1436
1437/**
Timo Alho4bef3582018-10-22 16:19:39 +03001438 * @ingroup Powergating
1439 * @brief Request with mrq_pg_update_state_request
Thierry Reding983de5f2016-08-19 19:05:35 +02001440 *
1441 * Used by #MRQ_PG_UPDATE_STATE call to request BPMP to change the
1442 * state of a power partition #partition_id.
1443 */
1444struct mrq_pg_update_state_request {
1445 /** @brief ID of partition */
1446 uint32_t partition_id;
Timo Alho4bef3582018-10-22 16:19:39 +03001447 /** @brief Secondary control of power partition
Thierry Reding983de5f2016-08-19 19:05:35 +02001448 * @details Ignored by many versions of the BPMP
1449 * firmware. For maximum compatibility, set the value
Timo Alho4bef3582018-10-22 16:19:39 +03001450 * according to @ref logic_state
Thierry Reding983de5f2016-08-19 19:05:35 +02001451 * * 0x1: power ON partition (@ref logic_state == 0x3)
1452 * * 0x3: power OFF partition (@ref logic_state == 0x1)
1453 */
1454 uint32_t sram_state;
Timo Alho4bef3582018-10-22 16:19:39 +03001455 /** @brief Controls state of power partition, legal values are
Thierry Reding983de5f2016-08-19 19:05:35 +02001456 * * 0x1 : power OFF partition
1457 * * 0x3 : power ON partition
1458 */
1459 uint32_t logic_state;
Timo Alho4bef3582018-10-22 16:19:39 +03001460 /** @brief Change state of clocks of the power partition, legal values
Thierry Reding983de5f2016-08-19 19:05:35 +02001461 * * 0x0 : do not change clock state
1462 * * 0x1 : disable partition clocks (only applicable when
1463 * @ref logic_state == 0x1)
1464 * * 0x3 : enable partition clocks (only applicable when
1465 * @ref logic_state == 0x3)
1466 */
1467 uint32_t clock_state;
Jon Hunter4e871892020-07-12 11:01:18 +01001468} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03001469/** @endcond*/
Thierry Reding983de5f2016-08-19 19:05:35 +02001470
1471/**
1472 * @ingroup MRQ_Codes
Thierry Reding52b8b802017-03-29 18:34:51 +02001473 * @def MRQ_PG
1474 * @brief Control power-gating state of a partition. In contrast to
1475 * MRQ_PG_UPDATE_STATE, operations that change the power partition
1476 * state are NOT reference counted
1477 *
Timo Alho4bef3582018-10-22 16:19:39 +03001478 * @note BPMP-FW forcefully turns off some partitions as part of SC7 entry
1479 * because their state cannot be adequately restored on exit. Therefore,
1480 * it is recommended to power off all domains via MRQ_PG prior to SC7 entry.
1481 * See @ref bpmp_pdomain_ids for further detail.
1482 *
1483 * * Platforms: T186, T194
Thierry Reding52b8b802017-03-29 18:34:51 +02001484 * * Initiators: Any
1485 * * Targets: BPMP
1486 * * Request Payload: @ref mrq_pg_request
1487 * * Response Payload: @ref mrq_pg_response
Timo Alho4bef3582018-10-22 16:19:39 +03001488 *
Thierry Reding52b8b802017-03-29 18:34:51 +02001489 * @addtogroup Powergating
1490 * @{
1491 */
Thierry Reding52b8b802017-03-29 18:34:51 +02001492enum mrq_pg_cmd {
1493 /**
1494 * @brief Check whether the BPMP driver supports the specified
1495 * request type
1496 *
1497 * mrq_response::err is 0 if the specified request is
1498 * supported and -#BPMP_ENODEV otherwise.
1499 */
1500 CMD_PG_QUERY_ABI = 0,
1501
1502 /**
1503 * @brief Set the current state of specified power domain. The
1504 * possible values for power domains are defined in enum
1505 * pg_states
1506 *
1507 * mrq_response:err is
1508 * 0: Success
1509 * -#BPMP_EINVAL: Invalid request parameters
1510 */
1511 CMD_PG_SET_STATE = 1,
1512
1513 /**
1514 * @brief Get the current state of specified power domain. The
1515 * possible values for power domains are defined in enum
1516 * pg_states
1517 *
1518 * mrq_response:err is
1519 * 0: Success
1520 * -#BPMP_EINVAL: Invalid request parameters
1521 */
1522 CMD_PG_GET_STATE = 2,
1523
1524 /**
Timo Alho4bef3582018-10-22 16:19:39 +03001525 * @brief Get the name string of specified power domain id.
Thierry Reding52b8b802017-03-29 18:34:51 +02001526 *
1527 * mrq_response:err is
1528 * 0: Success
1529 * -#BPMP_EINVAL: Invalid request parameters
1530 */
1531 CMD_PG_GET_NAME = 3,
1532
1533
1534 /**
Timo Alho4bef3582018-10-22 16:19:39 +03001535 * @brief Get the highest power domain id in the system. Not
Thierry Reding52b8b802017-03-29 18:34:51 +02001536 * all IDs between 0 and max_id are valid IDs.
1537 *
1538 * mrq_response:err is
1539 * 0: Success
1540 * -#BPMP_EINVAL: Invalid request parameters
1541 */
1542 CMD_PG_GET_MAX_ID = 4,
1543};
Thierry Reding52b8b802017-03-29 18:34:51 +02001544
1545#define MRQ_PG_NAME_MAXLEN 40
1546
Thierry Reding52b8b802017-03-29 18:34:51 +02001547enum pg_states {
Timo Alho4bef3582018-10-22 16:19:39 +03001548 /** @brief Power domain is OFF */
Thierry Reding52b8b802017-03-29 18:34:51 +02001549 PG_STATE_OFF = 0,
Timo Alho4bef3582018-10-22 16:19:39 +03001550 /** @brief Power domain is ON */
Thierry Reding52b8b802017-03-29 18:34:51 +02001551 PG_STATE_ON = 1,
Timo Alho4bef3582018-10-22 16:19:39 +03001552 /**
1553 * @brief a legacy state where power domain and the clock
1554 * associated to the domain are ON.
1555 * This state is only supported in T186, and the use of it is
1556 * deprecated.
1557 */
Thierry Reding52b8b802017-03-29 18:34:51 +02001558 PG_STATE_RUNNING = 2,
1559};
1560
1561struct cmd_pg_query_abi_request {
Timo Alho4bef3582018-10-22 16:19:39 +03001562 /** @ref mrq_pg_cmd */
1563 uint32_t type;
Jon Hunter4e871892020-07-12 11:01:18 +01001564} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02001565
1566struct cmd_pg_set_state_request {
Timo Alho4bef3582018-10-22 16:19:39 +03001567 /** @ref pg_states */
1568 uint32_t state;
Jon Hunter4e871892020-07-12 11:01:18 +01001569} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02001570
Jon Hunter4e871892020-07-12 11:01:18 +01001571/**
1572 * @brief Response data to #MRQ_PG sub command #CMD_PG_GET_STATE
1573 */
Thierry Reding52b8b802017-03-29 18:34:51 +02001574struct cmd_pg_get_state_response {
Jon Hunter4e871892020-07-12 11:01:18 +01001575 /**
1576 * @brief The state of the power partition that has been
1577 * succesfuly requested by the master earlier using #MRQ_PG
1578 * command #CMD_PG_SET_STATE.
1579 *
1580 * The state may not reflect the physical state of the power
1581 * partition if there are some other masters requesting it to
1582 * be enabled.
1583 *
1584 * See @ref pg_states for possible values
1585 */
Timo Alho4bef3582018-10-22 16:19:39 +03001586 uint32_t state;
Jon Hunter4e871892020-07-12 11:01:18 +01001587} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02001588
1589struct cmd_pg_get_name_response {
1590 uint8_t name[MRQ_PG_NAME_MAXLEN];
Jon Hunter4e871892020-07-12 11:01:18 +01001591} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02001592
1593struct cmd_pg_get_max_id_response {
1594 uint32_t max_id;
Jon Hunter4e871892020-07-12 11:01:18 +01001595} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02001596
1597/**
Timo Alho4bef3582018-10-22 16:19:39 +03001598 * @brief Request with #MRQ_PG
Thierry Reding52b8b802017-03-29 18:34:51 +02001599 *
1600 * Used by the sender of an #MRQ_PG message to control power
1601 * partitions. The pg_request is split into several sub-commands. Some
1602 * sub-commands require no additional data. Others have a sub-command
1603 * specific payload
1604 *
1605 * |sub-command |payload |
1606 * |----------------------------|-----------------------|
1607 * |CMD_PG_QUERY_ABI | query_abi |
1608 * |CMD_PG_SET_STATE | set_state |
1609 * |CMD_PG_GET_STATE | - |
1610 * |CMD_PG_GET_NAME | - |
1611 * |CMD_PG_GET_MAX_ID | - |
1612 *
1613 */
Thierry Reding52b8b802017-03-29 18:34:51 +02001614struct mrq_pg_request {
1615 uint32_t cmd;
1616 uint32_t id;
1617 union {
1618 struct cmd_pg_query_abi_request query_abi;
1619 struct cmd_pg_set_state_request set_state;
Jon Hunter4e871892020-07-12 11:01:18 +01001620 } BPMP_UNION_ANON;
1621} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02001622
1623/**
Timo Alho4bef3582018-10-22 16:19:39 +03001624 * @brief Response to MRQ_PG
Thierry Reding52b8b802017-03-29 18:34:51 +02001625 *
1626 * Each sub-command supported by @ref mrq_pg_request may return
1627 * sub-command-specific data. Some do and some do not as indicated in
1628 * the following table
1629 *
1630 * |sub-command |payload |
1631 * |----------------------------|-----------------------|
1632 * |CMD_PG_QUERY_ABI | - |
1633 * |CMD_PG_SET_STATE | - |
1634 * |CMD_PG_GET_STATE | get_state |
1635 * |CMD_PG_GET_NAME | get_name |
1636 * |CMD_PG_GET_MAX_ID | get_max_id |
Thierry Reding52b8b802017-03-29 18:34:51 +02001637 */
Thierry Reding52b8b802017-03-29 18:34:51 +02001638struct mrq_pg_response {
1639 union {
1640 struct cmd_pg_get_state_response get_state;
1641 struct cmd_pg_get_name_response get_name;
1642 struct cmd_pg_get_max_id_response get_max_id;
Jon Hunter4e871892020-07-12 11:01:18 +01001643 } BPMP_UNION_ANON;
1644} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02001645
Timo Alho4bef3582018-10-22 16:19:39 +03001646/** @} */
1647
Thierry Reding52b8b802017-03-29 18:34:51 +02001648/**
1649 * @ingroup MRQ_Codes
Thierry Reding983de5f2016-08-19 19:05:35 +02001650 * @def MRQ_THERMAL
Timo Alho4bef3582018-10-22 16:19:39 +03001651 * @brief Interact with BPMP thermal framework
Thierry Reding983de5f2016-08-19 19:05:35 +02001652 *
Timo Alho4bef3582018-10-22 16:19:39 +03001653 * * Platforms: T186, T194
Thierry Reding983de5f2016-08-19 19:05:35 +02001654 * * Initiators: Any
1655 * * Targets: Any
1656 * * Request Payload: TODO
1657 * * Response Payload: TODO
1658 *
1659 * @addtogroup Thermal
1660 *
1661 * The BPMP firmware includes a thermal framework. Drivers within the
1662 * bpmp firmware register with the framework to provide thermal
1663 * zones. Each thermal zone corresponds to an entity whose temperature
1664 * can be measured. The framework also has a notion of trip points. A
1665 * trip point consists of a thermal zone id, a temperature, and a
1666 * callback routine. The framework invokes the callback when the zone
1667 * hits the indicated temperature. The BPMP firmware uses this thermal
1668 * framework interally to implement various temperature-dependent
1669 * functions.
1670 *
1671 * Software on the CPU can use #MRQ_THERMAL (with payload @ref
1672 * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal
1673 * framework. The CPU must It can query the number of supported zones,
1674 * query zone temperatures, and set trip points.
1675 *
1676 * When a trip point set by the CPU gets crossed, BPMP firmware issues
1677 * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a
1678 * payload of @ref mrq_thermal_bpmp_to_host_request.
1679 * @{
1680 */
1681enum mrq_thermal_host_to_bpmp_cmd {
1682 /**
1683 * @brief Check whether the BPMP driver supports the specified
1684 * request type.
1685 *
1686 * Host needs to supply request parameters.
1687 *
1688 * mrq_response::err is 0 if the specified request is
1689 * supported and -#BPMP_ENODEV otherwise.
1690 */
1691 CMD_THERMAL_QUERY_ABI = 0,
1692
1693 /**
1694 * @brief Get the current temperature of the specified zone.
1695 *
1696 * Host needs to supply request parameters.
1697 *
1698 * mrq_response::err is
1699 * * 0: Temperature query succeeded.
1700 * * -#BPMP_EINVAL: Invalid request parameters.
1701 * * -#BPMP_ENOENT: No driver registered for thermal zone..
1702 * * -#BPMP_EFAULT: Problem reading temperature measurement.
1703 */
1704 CMD_THERMAL_GET_TEMP = 1,
1705
1706 /**
1707 * @brief Enable or disable and set the lower and upper
1708 * thermal limits for a thermal trip point. Each zone has
1709 * one trip point.
1710 *
1711 * Host needs to supply request parameters. Once the
1712 * temperature hits a trip point, the BPMP will send a message
1713 * to the CPU having MRQ=MRQ_THERMAL and
1714 * type=CMD_THERMAL_HOST_TRIP_REACHED
1715 *
1716 * mrq_response::err is
1717 * * 0: Trip successfully set.
1718 * * -#BPMP_EINVAL: Invalid request parameters.
1719 * * -#BPMP_ENOENT: No driver registered for thermal zone.
1720 * * -#BPMP_EFAULT: Problem setting trip point.
1721 */
1722 CMD_THERMAL_SET_TRIP = 2,
1723
1724 /**
1725 * @brief Get the number of supported thermal zones.
1726 *
1727 * No request parameters required.
1728 *
1729 * mrq_response::err is always 0, indicating success.
1730 */
1731 CMD_THERMAL_GET_NUM_ZONES = 3,
1732
Jon Hunter4e871892020-07-12 11:01:18 +01001733 /**
1734 * @brief Get the thermtrip of the specified zone.
1735 *
1736 * Host needs to supply request parameters.
1737 *
1738 * mrq_response::err is
1739 * * 0: Valid zone information returned.
1740 * * -#BPMP_EINVAL: Invalid request parameters.
1741 * * -#BPMP_ENOENT: No driver registered for thermal zone.
1742 * * -#BPMP_ERANGE if thermtrip is invalid or disabled.
1743 * * -#BPMP_EFAULT: Problem reading zone information.
1744 */
1745 CMD_THERMAL_GET_THERMTRIP = 4,
1746
Thierry Reding983de5f2016-08-19 19:05:35 +02001747 /** @brief: number of supported host-to-bpmp commands. May
1748 * increase in future
1749 */
1750 CMD_THERMAL_HOST_TO_BPMP_NUM
1751};
1752
1753enum mrq_thermal_bpmp_to_host_cmd {
1754 /**
1755 * @brief Indication that the temperature for a zone has
1756 * exceeded the range indicated in the thermal trip point
1757 * for the zone.
1758 *
1759 * BPMP needs to supply request parameters. Host only needs to
1760 * acknowledge.
1761 */
1762 CMD_THERMAL_HOST_TRIP_REACHED = 100,
1763
1764 /** @brief: number of supported bpmp-to-host commands. May
1765 * increase in future
1766 */
1767 CMD_THERMAL_BPMP_TO_HOST_NUM
1768};
1769
1770/*
1771 * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI
1772 *
1773 * zone: Request type for which to check existence.
1774 */
1775struct cmd_thermal_query_abi_request {
1776 uint32_t type;
Jon Hunter4e871892020-07-12 11:01:18 +01001777} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001778
1779/*
1780 * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP
1781 *
1782 * zone: Number of thermal zone.
1783 */
1784struct cmd_thermal_get_temp_request {
1785 uint32_t zone;
Jon Hunter4e871892020-07-12 11:01:18 +01001786} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001787
1788/*
1789 * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP
1790 *
1791 * error: 0 if request succeeded.
1792 * -BPMP_EINVAL if request parameters were invalid.
1793 * -BPMP_ENOENT if no driver was registered for the specified thermal zone.
1794 * -BPMP_EFAULT for other thermal zone driver errors.
1795 * temp: Current temperature in millicelsius.
1796 */
1797struct cmd_thermal_get_temp_response {
1798 int32_t temp;
Jon Hunter4e871892020-07-12 11:01:18 +01001799} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001800
1801/*
1802 * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP
1803 *
1804 * zone: Number of thermal zone.
1805 * low: Temperature of lower trip point in millicelsius
1806 * high: Temperature of upper trip point in millicelsius
1807 * enabled: 1 to enable trip point, 0 to disable trip point
1808 */
1809struct cmd_thermal_set_trip_request {
1810 uint32_t zone;
1811 int32_t low;
1812 int32_t high;
1813 uint32_t enabled;
Jon Hunter4e871892020-07-12 11:01:18 +01001814} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001815
1816/*
1817 * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED
1818 *
1819 * zone: Number of thermal zone where trip point was reached.
1820 */
1821struct cmd_thermal_host_trip_reached_request {
1822 uint32_t zone;
Jon Hunter4e871892020-07-12 11:01:18 +01001823} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001824
1825/*
1826 * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES
1827 *
1828 * num: Number of supported thermal zones. The thermal zones are indexed
1829 * starting from zero.
1830 */
1831struct cmd_thermal_get_num_zones_response {
1832 uint32_t num;
Jon Hunter4e871892020-07-12 11:01:18 +01001833} BPMP_ABI_PACKED;
1834
1835/*
1836 * Host->BPMP request data for request type CMD_THERMAL_GET_THERMTRIP
1837 *
1838 * zone: Number of thermal zone.
1839 */
1840struct cmd_thermal_get_thermtrip_request {
1841 uint32_t zone;
1842} BPMP_ABI_PACKED;
1843
1844/*
1845 * BPMP->Host reply data for request CMD_THERMAL_GET_THERMTRIP
1846 *
1847 * thermtrip: HW shutdown temperature in millicelsius.
1848 */
1849struct cmd_thermal_get_thermtrip_response {
1850 int32_t thermtrip;
1851} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001852
1853/*
1854 * Host->BPMP request data.
1855 *
1856 * Reply type is union mrq_thermal_bpmp_to_host_response.
1857 *
1858 * type: Type of request. Values listed in enum mrq_thermal_type.
1859 * data: Request type specific parameters.
1860 */
1861struct mrq_thermal_host_to_bpmp_request {
1862 uint32_t type;
1863 union {
1864 struct cmd_thermal_query_abi_request query_abi;
1865 struct cmd_thermal_get_temp_request get_temp;
1866 struct cmd_thermal_set_trip_request set_trip;
Jon Hunter4e871892020-07-12 11:01:18 +01001867 struct cmd_thermal_get_thermtrip_request get_thermtrip;
1868 } BPMP_UNION_ANON;
1869} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001870
1871/*
1872 * BPMP->Host request data.
1873 *
1874 * type: Type of request. Values listed in enum mrq_thermal_type.
1875 * data: Request type specific parameters.
1876 */
1877struct mrq_thermal_bpmp_to_host_request {
1878 uint32_t type;
1879 union {
1880 struct cmd_thermal_host_trip_reached_request host_trip_reached;
Jon Hunter4e871892020-07-12 11:01:18 +01001881 } BPMP_UNION_ANON;
1882} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001883
1884/*
1885 * Data in reply to a Host->BPMP request.
1886 */
1887union mrq_thermal_bpmp_to_host_response {
1888 struct cmd_thermal_get_temp_response get_temp;
Jon Hunter4e871892020-07-12 11:01:18 +01001889 struct cmd_thermal_get_thermtrip_response get_thermtrip;
Thierry Reding983de5f2016-08-19 19:05:35 +02001890 struct cmd_thermal_get_num_zones_response get_num_zones;
Jon Hunter4e871892020-07-12 11:01:18 +01001891} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001892/** @} */
1893
1894/**
1895 * @ingroup MRQ_Codes
1896 * @def MRQ_CPU_VHINT
1897 * @brief Query CPU voltage hint data
1898 *
1899 * * Platforms: T186
Timo Alho4bef3582018-10-22 16:19:39 +03001900 * @cond bpmp_t186
Thierry Reding983de5f2016-08-19 19:05:35 +02001901 * * Initiators: CCPLEX
1902 * * Targets: BPMP
1903 * * Request Payload: @ref mrq_cpu_vhint_request
1904 * * Response Payload: N/A
1905 *
Timo Alho4bef3582018-10-22 16:19:39 +03001906 * @addtogroup Vhint
Thierry Reding983de5f2016-08-19 19:05:35 +02001907 * @{
1908 */
1909
1910/**
Timo Alho4bef3582018-10-22 16:19:39 +03001911 * @brief Request with #MRQ_CPU_VHINT
Thierry Reding983de5f2016-08-19 19:05:35 +02001912 *
1913 * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data
1914 * from BPMP to memory space pointed by #addr. CCPLEX is responsible
1915 * to allocate sizeof(cpu_vhint_data) sized block of memory and
1916 * appropriately map it for BPMP before sending the request.
1917 */
1918struct mrq_cpu_vhint_request {
1919 /** @brief IOVA address for the #cpu_vhint_data */
Timo Alho4bef3582018-10-22 16:19:39 +03001920 uint32_t addr;
Thierry Reding983de5f2016-08-19 19:05:35 +02001921 /** @brief ID of the cluster whose data is requested */
Timo Alho4bef3582018-10-22 16:19:39 +03001922 uint32_t cluster_id;
Jon Hunter4e871892020-07-12 11:01:18 +01001923} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02001924
1925/**
Timo Alho4bef3582018-10-22 16:19:39 +03001926 * @brief Description of the CPU v/f relation
Thierry Reding983de5f2016-08-19 19:05:35 +02001927 *
Timo Alho4bef3582018-10-22 16:19:39 +03001928 * Used by #MRQ_CPU_VHINT call to carry data pointed by
1929 * #mrq_cpu_vhint_request::addr
Thierry Reding983de5f2016-08-19 19:05:35 +02001930 */
1931struct cpu_vhint_data {
1932 uint32_t ref_clk_hz; /**< reference frequency in Hz */
1933 uint16_t pdiv; /**< post divider value */
1934 uint16_t mdiv; /**< input divider value */
1935 uint16_t ndiv_max; /**< fMAX expressed with max NDIV value */
1936 /** table of ndiv values as a function of vINDEX (voltage index) */
1937 uint16_t ndiv[80];
1938 /** minimum allowed NDIV value */
1939 uint16_t ndiv_min;
1940 /** minimum allowed voltage hint value (as in vINDEX) */
1941 uint16_t vfloor;
1942 /** maximum allowed voltage hint value (as in vINDEX) */
1943 uint16_t vceil;
1944 /** post-multiplier for vindex value */
1945 uint16_t vindex_mult;
1946 /** post-divider for vindex value */
1947 uint16_t vindex_div;
1948 /** reserved for future use */
1949 uint16_t reserved[328];
Jon Hunter4e871892020-07-12 11:01:18 +01001950} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03001951/** @endcond */
Thierry Reding983de5f2016-08-19 19:05:35 +02001952/** @} */
1953
1954/**
1955 * @ingroup MRQ_Codes
1956 * @def MRQ_ABI_RATCHET
1957 * @brief ABI ratchet value query
1958 *
Timo Alho4bef3582018-10-22 16:19:39 +03001959 * * Platforms: T186, T194
Thierry Reding983de5f2016-08-19 19:05:35 +02001960 * * Initiators: Any
1961 * * Targets: BPMP
1962 * * Request Payload: @ref mrq_abi_ratchet_request
1963 * * Response Payload: @ref mrq_abi_ratchet_response
1964 * @addtogroup ABI_info
1965 * @{
1966 */
1967
1968/**
Timo Alho4bef3582018-10-22 16:19:39 +03001969 * @brief An ABI compatibility mechanism
Thierry Reding983de5f2016-08-19 19:05:35 +02001970 *
1971 * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future
1972 * revision of this header file.
1973 * 1. That future revision deprecates some MRQ
1974 * 2. That future revision introduces a breaking change to an existing
1975 * MRQ or
1976 * 3. A bug is discovered in an existing implementation of the BPMP-FW
1977 * (or possibly one of its clients) which warrants deprecating that
1978 * implementation.
1979 */
1980#define BPMP_ABI_RATCHET_VALUE 3
1981
1982/**
Timo Alho4bef3582018-10-22 16:19:39 +03001983 * @brief Request with #MRQ_ABI_RATCHET.
Thierry Reding983de5f2016-08-19 19:05:35 +02001984 *
1985 * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header
1986 * against which the requester was compiled.
1987 *
1988 * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may
1989 * reply with mrq_response::err = -#BPMP_ERANGE to indicate that
1990 * BPMP-FW cannot interoperate correctly with the requester. Requester
1991 * should cease further communication with BPMP.
1992 *
1993 * Otherwise, err shall be 0.
1994 */
1995struct mrq_abi_ratchet_request {
Timo Alho4bef3582018-10-22 16:19:39 +03001996 /** @brief Requester's ratchet value */
Thierry Reding983de5f2016-08-19 19:05:35 +02001997 uint16_t ratchet;
1998};
1999
2000/**
Timo Alho4bef3582018-10-22 16:19:39 +03002001 * @brief Response to #MRQ_ABI_RATCHET
Thierry Reding983de5f2016-08-19 19:05:35 +02002002 *
2003 * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header
2004 * against which BPMP firwmare was compiled.
2005 *
2006 * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE,
2007 * the requster must either interoperate with BPMP according to an ABI
2008 * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease
2009 * communication with BPMP.
2010 *
2011 * If mrq_response::err is 0 and ratchet is greater than or equal to the
2012 * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue
2013 * normal operation.
2014 */
2015struct mrq_abi_ratchet_response {
2016 /** @brief BPMP's ratchet value */
2017 uint16_t ratchet;
2018};
2019/** @} */
2020
2021/**
2022 * @ingroup MRQ_Codes
2023 * @def MRQ_EMC_DVFS_LATENCY
Timo Alho4bef3582018-10-22 16:19:39 +03002024 * @brief Query frequency dependent EMC DVFS latency
Thierry Reding983de5f2016-08-19 19:05:35 +02002025 *
Timo Alho4bef3582018-10-22 16:19:39 +03002026 * * Platforms: T186, T194
Thierry Reding983de5f2016-08-19 19:05:35 +02002027 * * Initiators: CCPLEX
2028 * * Targets: BPMP
2029 * * Request Payload: N/A
2030 * * Response Payload: @ref mrq_emc_dvfs_latency_response
2031 * @addtogroup EMC
2032 * @{
2033 */
2034
2035/**
Timo Alho4bef3582018-10-22 16:19:39 +03002036 * @brief Used by @ref mrq_emc_dvfs_latency_response
Thierry Reding983de5f2016-08-19 19:05:35 +02002037 */
2038struct emc_dvfs_latency {
Jon Hunter4e871892020-07-12 11:01:18 +01002039 /** @brief EMC DVFS node frequency in kHz */
Thierry Reding983de5f2016-08-19 19:05:35 +02002040 uint32_t freq;
2041 /** @brief EMC DVFS latency in nanoseconds */
2042 uint32_t latency;
Jon Hunter4e871892020-07-12 11:01:18 +01002043} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02002044
2045#define EMC_DVFS_LATENCY_MAX_SIZE 14
2046/**
Timo Alho4bef3582018-10-22 16:19:39 +03002047 * @brief Response to #MRQ_EMC_DVFS_LATENCY
Thierry Reding983de5f2016-08-19 19:05:35 +02002048 */
2049struct mrq_emc_dvfs_latency_response {
Timo Alho4bef3582018-10-22 16:19:39 +03002050 /** @brief The number valid entries in #pairs */
Thierry Reding983de5f2016-08-19 19:05:35 +02002051 uint32_t num_pairs;
Jon Hunter4e871892020-07-12 11:01:18 +01002052 /** @brief EMC DVFS node <frequency, latency> information */
Thierry Reding983de5f2016-08-19 19:05:35 +02002053 struct emc_dvfs_latency pairs[EMC_DVFS_LATENCY_MAX_SIZE];
Jon Hunter4e871892020-07-12 11:01:18 +01002054} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02002055
2056/** @} */
2057
2058/**
2059 * @ingroup MRQ_Codes
Timo Alho4bef3582018-10-22 16:19:39 +03002060 * @def MRQ_CPU_NDIV_LIMITS
2061 * @brief CPU freq. limits in ndiv
2062 *
2063 * * Platforms: T194 onwards
2064 * @cond bpmp_t194
2065 * * Initiators: CCPLEX
2066 * * Targets: BPMP
2067 * * Request Payload: @ref mrq_cpu_ndiv_limits_request
2068 * * Response Payload: @ref mrq_cpu_ndiv_limits_response
2069 * @addtogroup CPU
2070 * @{
2071 */
2072
2073/**
2074 * @brief Request for ndiv limits of a cluster
2075 */
2076struct mrq_cpu_ndiv_limits_request {
2077 /** @brief Enum cluster_id */
2078 uint32_t cluster_id;
Jon Hunter4e871892020-07-12 11:01:18 +01002079} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002080
2081/**
2082 * @brief Response to #MRQ_CPU_NDIV_LIMITS
2083 */
2084struct mrq_cpu_ndiv_limits_response {
2085 /** @brief Reference frequency in Hz */
2086 uint32_t ref_clk_hz;
2087 /** @brief Post divider value */
2088 uint16_t pdiv;
2089 /** @brief Input divider value */
2090 uint16_t mdiv;
2091 /** @brief FMAX expressed with max NDIV value */
2092 uint16_t ndiv_max;
2093 /** @brief Minimum allowed NDIV value */
2094 uint16_t ndiv_min;
Jon Hunter4e871892020-07-12 11:01:18 +01002095} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002096
2097/** @} */
2098/** @endcond */
2099
2100/**
2101 * @ingroup MRQ_Codes
2102 * @def MRQ_CPU_AUTO_CC3
2103 * @brief Query CPU cluster auto-CC3 configuration
2104 *
2105 * * Platforms: T194 onwards
2106 * @cond bpmp_t194
2107 * * Initiators: CCPLEX
2108 * * Targets: BPMP
2109 * * Request Payload: @ref mrq_cpu_auto_cc3_request
2110 * * Response Payload: @ref mrq_cpu_auto_cc3_response
2111 * @addtogroup CC3
2112 *
2113 * Queries from BPMP auto-CC3 configuration (allowed/not allowed) for a
2114 * specified cluster. CCPLEX s/w uses this information to override its own
2115 * device tree auto-CC3 settings, so that BPMP device tree is a single source of
2116 * auto-CC3 platform configuration.
2117 *
2118 * @{
2119 */
2120
2121/**
2122 * @brief Request for auto-CC3 configuration of a cluster
2123 */
2124struct mrq_cpu_auto_cc3_request {
2125 /** @brief Enum cluster_id (logical cluster id, known to CCPLEX s/w) */
2126 uint32_t cluster_id;
Jon Hunter4e871892020-07-12 11:01:18 +01002127} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002128
2129/**
2130 * @brief Response to #MRQ_CPU_AUTO_CC3
2131 */
2132struct mrq_cpu_auto_cc3_response {
2133 /**
2134 * @brief auto-CC3 configuration
2135 *
2136 * - bits[31..10] reserved.
2137 * - bits[9..1] cc3 ndiv
2138 * - bit [0] if "1" auto-CC3 is allowed, if "0" auto-CC3 is not allowed
2139 */
2140 uint32_t auto_cc3_config;
Jon Hunter4e871892020-07-12 11:01:18 +01002141} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002142
2143/** @} */
2144/** @endcond */
2145
2146/**
2147 * @ingroup MRQ_Codes
Thierry Reding983de5f2016-08-19 19:05:35 +02002148 * @def MRQ_TRACE_ITER
Timo Alho4bef3582018-10-22 16:19:39 +03002149 * @brief Manage the trace iterator
Thierry Reding983de5f2016-08-19 19:05:35 +02002150 *
Jon Hunter4e871892020-07-12 11:01:18 +01002151 * @deprecated
2152 *
Thierry Reding983de5f2016-08-19 19:05:35 +02002153 * * Platforms: All
2154 * * Initiators: CCPLEX
2155 * * Targets: BPMP
2156 * * Request Payload: N/A
2157 * * Response Payload: @ref mrq_trace_iter_request
2158 * @addtogroup Trace
2159 * @{
2160 */
2161enum {
2162 /** @brief (re)start the tracing now. Ignore older events */
2163 TRACE_ITER_INIT = 0,
Timo Alho4bef3582018-10-22 16:19:39 +03002164 /** @brief Clobber all events in the trace buffer */
Thierry Reding983de5f2016-08-19 19:05:35 +02002165 TRACE_ITER_CLEAN = 1
2166};
2167
2168/**
Timo Alho4bef3582018-10-22 16:19:39 +03002169 * @brief Request with #MRQ_TRACE_ITER
Thierry Reding983de5f2016-08-19 19:05:35 +02002170 */
2171struct mrq_trace_iter_request {
2172 /** @brief TRACE_ITER_INIT or TRACE_ITER_CLEAN */
2173 uint32_t cmd;
Jon Hunter4e871892020-07-12 11:01:18 +01002174} BPMP_ABI_PACKED;
Thierry Reding983de5f2016-08-19 19:05:35 +02002175
2176/** @} */
2177
Thierry Reding52b8b802017-03-29 18:34:51 +02002178/**
2179 * @ingroup MRQ_Codes
2180 * @def MRQ_RINGBUF_CONSOLE
2181 * @brief A ring buffer debug console for BPMP
2182 * @addtogroup RingbufConsole
2183 *
2184 * The ring buffer debug console aims to be a substitute for the UART debug
2185 * console. The debug console is implemented with two ring buffers in the
2186 * BPMP-FW, the RX (receive) and TX (transmit) buffers. Characters can be read
2187 * and written to the buffers by the host via the MRQ interface.
2188 *
2189 * @{
2190 */
2191
2192/**
2193 * @brief Maximum number of bytes transferred in a single write command to the
2194 * BPMP
2195 *
2196 * This is determined by the number of free bytes in the message struct,
2197 * rounded down to a multiple of four.
2198 */
2199#define MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN 112
2200
2201/**
2202 * @brief Maximum number of bytes transferred in a single read command to the
2203 * BPMP
2204 *
2205 * This is determined by the number of free bytes in the message struct,
2206 * rounded down to a multiple of four.
2207 */
2208#define MRQ_RINGBUF_CONSOLE_MAX_READ_LEN 116
2209
2210enum mrq_ringbuf_console_host_to_bpmp_cmd {
2211 /**
2212 * @brief Check whether the BPMP driver supports the specified request
2213 * type
2214 *
2215 * mrq_response::err is 0 if the specified request is supported and
2216 * -#BPMP_ENODEV otherwise
2217 */
2218 CMD_RINGBUF_CONSOLE_QUERY_ABI = 0,
2219 /**
2220 * @brief Perform a read operation on the BPMP TX buffer
2221 *
2222 * mrq_response::err is 0
2223 */
2224 CMD_RINGBUF_CONSOLE_READ = 1,
2225 /**
2226 * @brief Perform a write operation on the BPMP RX buffer
2227 *
2228 * mrq_response::err is 0 if the operation was successful and
2229 * -#BPMP_ENODEV otherwise
2230 */
2231 CMD_RINGBUF_CONSOLE_WRITE = 2,
2232 /**
2233 * @brief Get the length of the buffer and the physical addresses of
2234 * the buffer data and the head and tail counters
2235 *
2236 * mrq_response::err is 0 if the operation was successful and
2237 * -#BPMP_ENODEV otherwise
2238 */
2239 CMD_RINGBUF_CONSOLE_GET_FIFO = 3,
2240};
2241
2242/**
2243 * @ingroup RingbufConsole
2244 * @brief Host->BPMP request data for request type
2245 * #CMD_RINGBUF_CONSOLE_QUERY_ABI
2246 */
2247struct cmd_ringbuf_console_query_abi_req {
2248 /** @brief Command identifier to be queried */
2249 uint32_t cmd;
Jon Hunter4e871892020-07-12 11:01:18 +01002250} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02002251
2252/** @private */
2253struct cmd_ringbuf_console_query_abi_resp {
Jon Hunter4e871892020-07-12 11:01:18 +01002254 BPMP_ABI_EMPTY
2255} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02002256
2257/**
2258 * @ingroup RingbufConsole
2259 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_READ
2260 */
2261struct cmd_ringbuf_console_read_req {
2262 /**
2263 * @brief Number of bytes requested to be read from the BPMP TX buffer
2264 */
2265 uint8_t len;
Jon Hunter4e871892020-07-12 11:01:18 +01002266} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02002267
2268/**
2269 * @ingroup RingbufConsole
2270 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_READ
2271 */
2272struct cmd_ringbuf_console_read_resp {
2273 /** @brief The actual data read from the BPMP TX buffer */
2274 uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_READ_LEN];
2275 /** @brief Number of bytes in cmd_ringbuf_console_read_resp::data */
2276 uint8_t len;
Jon Hunter4e871892020-07-12 11:01:18 +01002277} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02002278
2279/**
2280 * @ingroup RingbufConsole
2281 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_WRITE
2282 */
2283struct cmd_ringbuf_console_write_req {
2284 /** @brief The actual data to be written to the BPMP RX buffer */
2285 uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN];
2286 /** @brief Number of bytes in cmd_ringbuf_console_write_req::data */
2287 uint8_t len;
Jon Hunter4e871892020-07-12 11:01:18 +01002288} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02002289
2290/**
2291 * @ingroup RingbufConsole
2292 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_WRITE
2293 */
2294struct cmd_ringbuf_console_write_resp {
2295 /** @brief Number of bytes of available space in the BPMP RX buffer */
2296 uint32_t space_avail;
2297 /** @brief Number of bytes that were written to the BPMP RX buffer */
2298 uint8_t len;
Jon Hunter4e871892020-07-12 11:01:18 +01002299} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02002300
2301/** @private */
2302struct cmd_ringbuf_console_get_fifo_req {
Jon Hunter4e871892020-07-12 11:01:18 +01002303 BPMP_ABI_EMPTY
2304} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02002305
2306/**
2307 * @ingroup RingbufConsole
2308 * @brief BPMP->Host reply data for request type #CMD_RINGBUF_CONSOLE_GET_FIFO
2309 */
2310struct cmd_ringbuf_console_get_fifo_resp {
2311 /** @brief Physical address of the BPMP TX buffer */
2312 uint64_t bpmp_tx_buf_addr;
2313 /** @brief Physical address of the BPMP TX buffer head counter */
2314 uint64_t bpmp_tx_head_addr;
2315 /** @brief Physical address of the BPMP TX buffer tail counter */
2316 uint64_t bpmp_tx_tail_addr;
2317 /** @brief Length of the BPMP TX buffer */
2318 uint32_t bpmp_tx_buf_len;
Jon Hunter4e871892020-07-12 11:01:18 +01002319} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02002320
2321/**
2322 * @ingroup RingbufConsole
2323 * @brief Host->BPMP request data.
2324 *
2325 * Reply type is union #mrq_ringbuf_console_bpmp_to_host_response .
2326 */
2327struct mrq_ringbuf_console_host_to_bpmp_request {
2328 /**
Timo Alho4bef3582018-10-22 16:19:39 +03002329 * @brief Type of request. Values listed in enum
Thierry Reding52b8b802017-03-29 18:34:51 +02002330 * #mrq_ringbuf_console_host_to_bpmp_cmd.
2331 */
2332 uint32_t type;
2333 /** @brief request type specific parameters. */
2334 union {
2335 struct cmd_ringbuf_console_query_abi_req query_abi;
2336 struct cmd_ringbuf_console_read_req read;
2337 struct cmd_ringbuf_console_write_req write;
2338 struct cmd_ringbuf_console_get_fifo_req get_fifo;
Jon Hunter4e871892020-07-12 11:01:18 +01002339 } BPMP_UNION_ANON;
2340} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02002341
2342/**
2343 * @ingroup RingbufConsole
2344 * @brief Host->BPMP reply data
2345 *
2346 * In response to struct #mrq_ringbuf_console_host_to_bpmp_request.
2347 */
2348union mrq_ringbuf_console_bpmp_to_host_response {
2349 struct cmd_ringbuf_console_query_abi_resp query_abi;
2350 struct cmd_ringbuf_console_read_resp read;
2351 struct cmd_ringbuf_console_write_resp write;
2352 struct cmd_ringbuf_console_get_fifo_resp get_fifo;
Jon Hunter4e871892020-07-12 11:01:18 +01002353} BPMP_ABI_PACKED;
Thierry Reding52b8b802017-03-29 18:34:51 +02002354/** @} */
2355
Timo Alho4bef3582018-10-22 16:19:39 +03002356/**
2357 * @ingroup MRQ_Codes
2358 * @def MRQ_STRAP
2359 * @brief Set a strap value controlled by BPMP
2360 *
2361 * * Platforms: T194 onwards
2362 * @cond bpmp_t194
2363 * * Initiators: CCPLEX
2364 * * Targets: BPMP
2365 * * Request Payload: @ref mrq_strap_request
2366 * * Response Payload: N/A
2367 * @addtogroup Strap
2368 *
2369 * A strap is an input that is sampled by a hardware unit during the
2370 * unit's startup process. The sampled value of a strap affects the
2371 * behavior of the unit until the unit is restarted. Many hardware
2372 * units sample their straps at the instant that their resets are
2373 * deasserted.
2374 *
2375 * BPMP owns registers which act as straps to various units. It
2376 * exposes limited control of those straps via #MRQ_STRAP.
2377 *
2378 * @{
2379 */
2380enum mrq_strap_cmd {
2381 /** @private */
2382 STRAP_RESERVED = 0,
2383 /** @brief Set a strap value */
2384 STRAP_SET = 1
2385};
2386
2387/**
2388 * @brief Request with #MRQ_STRAP
2389 */
2390struct mrq_strap_request {
2391 /** @brief @ref mrq_strap_cmd */
2392 uint32_t cmd;
2393 /** @brief Strap ID from @ref Strap_Ids */
2394 uint32_t id;
2395 /** @brief Desired value for strap (if cmd is #STRAP_SET) */
2396 uint32_t value;
Jon Hunter4e871892020-07-12 11:01:18 +01002397} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002398
2399/**
2400 * @defgroup Strap_Ids Strap Identifiers
2401 * @}
2402 */
2403/** @endcond */
2404
2405/**
2406 * @ingroup MRQ_Codes
2407 * @def MRQ_UPHY
2408 * @brief Perform a UPHY operation
2409 *
2410 * * Platforms: T194 onwards
2411 * @cond bpmp_t194
2412 * * Initiators: CCPLEX
2413 * * Targets: BPMP
2414 * * Request Payload: @ref mrq_uphy_request
2415 * * Response Payload: @ref mrq_uphy_response
2416 *
2417 * @addtogroup UPHY
2418 * @{
2419 */
2420enum {
2421 CMD_UPHY_PCIE_LANE_MARGIN_CONTROL = 1,
2422 CMD_UPHY_PCIE_LANE_MARGIN_STATUS = 2,
2423 CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT = 3,
2424 CMD_UPHY_PCIE_CONTROLLER_STATE = 4,
Vidya Sagaree22d0c2020-03-03 23:40:48 +05302425 CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF = 5,
Timo Alho4bef3582018-10-22 16:19:39 +03002426 CMD_UPHY_MAX,
2427};
2428
2429struct cmd_uphy_margin_control_request {
2430 /** @brief Enable margin */
2431 int32_t en;
2432 /** @brief Clear the number of error and sections */
2433 int32_t clr;
2434 /** @brief Set x offset (1's complement) for left/right margin type (y should be 0) */
2435 uint32_t x;
2436 /** @brief Set y offset (1's complement) for left/right margin type (x should be 0) */
2437 uint32_t y;
2438 /** @brief Set number of bit blocks for each margin section */
2439 uint32_t nblks;
Jon Hunter4e871892020-07-12 11:01:18 +01002440} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002441
2442struct cmd_uphy_margin_status_response {
2443 /** @brief Number of errors observed */
2444 uint32_t status;
Jon Hunter4e871892020-07-12 11:01:18 +01002445} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002446
2447struct cmd_uphy_ep_controller_pll_init_request {
2448 /** @brief EP controller number, valid: 0, 4, 5 */
2449 uint8_t ep_controller;
Jon Hunter4e871892020-07-12 11:01:18 +01002450} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002451
2452struct cmd_uphy_pcie_controller_state_request {
2453 /** @brief PCIE controller number, valid: 0, 1, 2, 3, 4 */
2454 uint8_t pcie_controller;
2455 uint8_t enable;
Jon Hunter4e871892020-07-12 11:01:18 +01002456} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002457
Vidya Sagaree22d0c2020-03-03 23:40:48 +05302458struct cmd_uphy_ep_controller_pll_off_request {
2459 /** @brief EP controller number, valid: 0, 4, 5 */
2460 uint8_t ep_controller;
Jon Hunter4e871892020-07-12 11:01:18 +01002461} BPMP_ABI_PACKED;
Vidya Sagaree22d0c2020-03-03 23:40:48 +05302462
Timo Alho4bef3582018-10-22 16:19:39 +03002463/**
2464 * @ingroup UPHY
2465 * @brief Request with #MRQ_UPHY
2466 *
2467 * Used by the sender of an #MRQ_UPHY message to control UPHY Lane RX margining.
2468 * The uphy_request is split into several sub-commands. Some sub-commands
2469 * require no additional data. Others have a sub-command specific payload
2470 *
2471 * |sub-command |payload |
2472 * |------------------------------------ |----------------------------------------|
2473 * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL |uphy_set_margin_control |
2474 * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS | |
2475 * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT |cmd_uphy_ep_controller_pll_init_request |
2476 * |CMD_UPHY_PCIE_CONTROLLER_STATE |cmd_uphy_pcie_controller_state_request |
Vidya Sagaree22d0c2020-03-03 23:40:48 +05302477 * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF |cmd_uphy_ep_controller_pll_off_request |
Timo Alho4bef3582018-10-22 16:19:39 +03002478 *
Thierry Reding983de5f2016-08-19 19:05:35 +02002479 */
2480
Timo Alho4bef3582018-10-22 16:19:39 +03002481struct mrq_uphy_request {
2482 /** @brief Lane number. */
2483 uint16_t lane;
2484 /** @brief Sub-command id. */
2485 uint16_t cmd;
2486
2487 union {
2488 struct cmd_uphy_margin_control_request uphy_set_margin_control;
2489 struct cmd_uphy_ep_controller_pll_init_request ep_ctrlr_pll_init;
2490 struct cmd_uphy_pcie_controller_state_request controller_state;
Vidya Sagaree22d0c2020-03-03 23:40:48 +05302491 struct cmd_uphy_ep_controller_pll_off_request ep_ctrlr_pll_off;
Jon Hunter4e871892020-07-12 11:01:18 +01002492 } BPMP_UNION_ANON;
2493} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002494
2495/**
2496 * @ingroup UPHY
2497 * @brief Response to MRQ_UPHY
Thierry Reding983de5f2016-08-19 19:05:35 +02002498 *
Timo Alho4bef3582018-10-22 16:19:39 +03002499 * Each sub-command supported by @ref mrq_uphy_request may return
2500 * sub-command-specific data. Some do and some do not as indicated in
2501 * the following table
Thierry Reding983de5f2016-08-19 19:05:35 +02002502 *
Timo Alho4bef3582018-10-22 16:19:39 +03002503 * |sub-command |payload |
2504 * |---------------------------- |------------------------|
2505 * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL | |
2506 * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS |uphy_get_margin_status |
Thierry Reding983de5f2016-08-19 19:05:35 +02002507 *
Thierry Reding983de5f2016-08-19 19:05:35 +02002508 */
2509
Timo Alho4bef3582018-10-22 16:19:39 +03002510struct mrq_uphy_response {
2511 union {
2512 struct cmd_uphy_margin_status_response uphy_get_margin_status;
Jon Hunter4e871892020-07-12 11:01:18 +01002513 } BPMP_UNION_ANON;
2514} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002515
2516/** @} */
2517/** @endcond */
2518
2519/**
2520 * @ingroup MRQ_Codes
2521 * @def MRQ_FMON
2522 * @brief Perform a frequency monitor configuration operations
Thierry Reding983de5f2016-08-19 19:05:35 +02002523 *
Timo Alho4bef3582018-10-22 16:19:39 +03002524 * * Platforms: T194 onwards
2525 * @cond bpmp_t194
2526 * * Initiators: CCPLEX
2527 * * Targets: BPMP
2528 * * Request Payload: @ref mrq_fmon_request
2529 * * Response Payload: @ref mrq_fmon_response
2530 *
2531 * @addtogroup FMON
2532 * @{
2533 */
2534enum {
2535 /**
2536 * @brief Clamp FMON configuration to specified rate.
2537 *
2538 * The monitored clock must be running for clamp to succeed. If
2539 * clamped, FMON configuration is preserved when clock rate
2540 * and/or state is changed.
2541 */
2542 CMD_FMON_GEAR_CLAMP = 1,
2543 /**
2544 * @brief Release clamped FMON configuration.
2545 *
2546 * Allow FMON configuration to follow monitored clock rate
2547 * and/or state changes.
2548 */
2549 CMD_FMON_GEAR_FREE = 2,
2550 /**
2551 * @brief Return rate FMON is clamped at, or 0 if FMON is not
2552 * clamped.
2553 *
2554 * Inherently racy, since clamp state can be changed
2555 * concurrently. Useful for testing.
2556 */
2557 CMD_FMON_GEAR_GET = 3,
2558 CMD_FMON_NUM,
2559};
2560
2561struct cmd_fmon_gear_clamp_request {
2562 int32_t unused;
2563 int64_t rate;
Jon Hunter4e871892020-07-12 11:01:18 +01002564} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002565
2566/** @private */
2567struct cmd_fmon_gear_clamp_response {
Jon Hunter4e871892020-07-12 11:01:18 +01002568 BPMP_ABI_EMPTY
2569} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002570
2571/** @private */
2572struct cmd_fmon_gear_free_request {
Jon Hunter4e871892020-07-12 11:01:18 +01002573 BPMP_ABI_EMPTY
2574} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002575
2576/** @private */
2577struct cmd_fmon_gear_free_response {
Jon Hunter4e871892020-07-12 11:01:18 +01002578 BPMP_ABI_EMPTY
2579} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002580
2581/** @private */
2582struct cmd_fmon_gear_get_request {
Jon Hunter4e871892020-07-12 11:01:18 +01002583 BPMP_ABI_EMPTY
2584} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002585
2586struct cmd_fmon_gear_get_response {
2587 int64_t rate;
Jon Hunter4e871892020-07-12 11:01:18 +01002588} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002589
2590/**
2591 * @ingroup FMON
2592 * @brief Request with #MRQ_FMON
2593 *
2594 * Used by the sender of an #MRQ_FMON message to configure clock
2595 * frequency monitors. The FMON request is split into several
2596 * sub-commands. Some sub-commands require no additional data.
2597 * Others have a sub-command specific payload
2598 *
2599 * |sub-command |payload |
2600 * |----------------------------|-----------------------|
2601 * |CMD_FMON_GEAR_CLAMP |fmon_gear_clamp |
2602 * |CMD_FMON_GEAR_FREE |- |
2603 * |CMD_FMON_GEAR_GET |- |
2604 *
Thierry Reding983de5f2016-08-19 19:05:35 +02002605 */
2606
Timo Alho4bef3582018-10-22 16:19:39 +03002607struct mrq_fmon_request {
2608 /** @brief Sub-command and clock id concatenated to 32-bit word.
2609 * - bits[31..24] is the sub-cmd.
2610 * - bits[23..0] is monitored clock id used to select target
2611 * FMON
2612 */
2613 uint32_t cmd_and_id;
2614
2615 union {
2616 struct cmd_fmon_gear_clamp_request fmon_gear_clamp;
2617 /** @private */
2618 struct cmd_fmon_gear_free_request fmon_gear_free;
2619 /** @private */
2620 struct cmd_fmon_gear_get_request fmon_gear_get;
Jon Hunter4e871892020-07-12 11:01:18 +01002621 } BPMP_UNION_ANON;
2622} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002623
2624/**
2625 * @ingroup FMON
2626 * @brief Response to MRQ_FMON
Thierry Reding983de5f2016-08-19 19:05:35 +02002627 *
Timo Alho4bef3582018-10-22 16:19:39 +03002628 * Each sub-command supported by @ref mrq_fmon_request may
2629 * return sub-command-specific data as indicated below.
2630 *
2631 * |sub-command |payload |
2632 * |----------------------------|------------------------|
2633 * |CMD_FMON_GEAR_CLAMP |- |
2634 * |CMD_FMON_GEAR_FREE |- |
2635 * |CMD_FMON_GEAR_GET |fmon_gear_get |
2636 *
Thierry Reding983de5f2016-08-19 19:05:35 +02002637 */
2638
Timo Alho4bef3582018-10-22 16:19:39 +03002639struct mrq_fmon_response {
2640 union {
2641 /** @private */
2642 struct cmd_fmon_gear_clamp_response fmon_gear_clamp;
2643 /** @private */
2644 struct cmd_fmon_gear_free_response fmon_gear_free;
2645 struct cmd_fmon_gear_get_response fmon_gear_get;
Jon Hunter4e871892020-07-12 11:01:18 +01002646 } BPMP_UNION_ANON;
2647} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002648
2649/** @} */
2650/** @endcond */
2651
2652/**
2653 * @ingroup MRQ_Codes
2654 * @def MRQ_EC
2655 * @brief Provide status information on faults reported by Error
2656 * Collator (EC) to HSM.
Thierry Reding983de5f2016-08-19 19:05:35 +02002657 *
Timo Alho4bef3582018-10-22 16:19:39 +03002658 * * Platforms: T194 onwards
2659 * @cond bpmp_t194
2660 * * Initiators: CCPLEX
2661 * * Targets: BPMP
2662 * * Request Payload: @ref mrq_ec_request
2663 * * Response Payload: @ref mrq_ec_response
2664 *
2665 * @note This MRQ ABI is under construction, and subject to change
2666 *
2667 * @addtogroup EC
2668 * @{
2669 */
2670enum {
2671 /**
Jon Hunter4e871892020-07-12 11:01:18 +01002672 * @cond DEPRECATED
Timo Alho4bef3582018-10-22 16:19:39 +03002673 * @brief Retrieve specified EC status.
2674 *
2675 * mrq_response::err is 0 if the operation was successful, or @n
2676 * -#BPMP_ENODEV if target EC is not owned by BPMP @n
Jon Hunter4e871892020-07-12 11:01:18 +01002677 * -#BPMP_EACCES if target EC power domain is turned off @n
2678 * -#BPMP_EBADCMD if subcommand is not supported
2679 * @endcond
Timo Alho4bef3582018-10-22 16:19:39 +03002680 */
Jon Hunter4e871892020-07-12 11:01:18 +01002681 CMD_EC_STATUS_GET = 1, /* deprecated */
2682
2683 /**
2684 * @brief Retrieve specified EC extended status (includes error
2685 * counter and user values).
2686 *
2687 * mrq_response::err is 0 if the operation was successful, or @n
2688 * -#BPMP_ENODEV if target EC is not owned by BPMP @n
2689 * -#BPMP_EACCES if target EC power domain is turned off @n
2690 * -#BPMP_EBADCMD if subcommand is not supported
2691 */
2692 CMD_EC_STATUS_EX_GET = 2,
Timo Alho4bef3582018-10-22 16:19:39 +03002693 CMD_EC_NUM,
2694};
2695
2696/** @brief BPMP ECs error types */
2697enum bpmp_ec_err_type {
2698 /** @brief Parity error on internal data path
2699 *
2700 * Error descriptor @ref ec_err_simple_desc.
2701 */
2702 EC_ERR_TYPE_PARITY_INTERNAL = 1,
2703
2704 /** @brief ECC SEC error on internal data path
2705 *
2706 * Error descriptor @ref ec_err_simple_desc.
2707 */
2708 EC_ERR_TYPE_ECC_SEC_INTERNAL = 2,
2709
2710 /** @brief ECC DED error on internal data path
2711 *
2712 * Error descriptor @ref ec_err_simple_desc.
2713 */
2714 EC_ERR_TYPE_ECC_DED_INTERNAL = 3,
2715
2716 /** @brief Comparator error
2717 *
2718 * Error descriptor @ref ec_err_simple_desc.
2719 */
2720 EC_ERR_TYPE_COMPARATOR = 4,
2721
2722 /** @brief Register parity error
2723 *
2724 * Error descriptor @ref ec_err_reg_parity_desc.
2725 */
2726 EC_ERR_TYPE_REGISTER_PARITY = 5,
2727
2728 /** @brief Parity error from on-chip SRAM/FIFO
2729 *
2730 * Error descriptor @ref ec_err_simple_desc.
2731 */
2732 EC_ERR_TYPE_PARITY_SRAM = 6,
2733
2734 /** @brief Clock Monitor error
2735 *
2736 * Error descriptor @ref ec_err_fmon_desc.
2737 */
2738 EC_ERR_TYPE_CLOCK_MONITOR = 9,
2739
2740 /** @brief Voltage Monitor error
2741 *
2742 * Error descriptor @ref ec_err_vmon_desc.
2743 */
2744 EC_ERR_TYPE_VOLTAGE_MONITOR = 10,
2745
2746 /** @brief SW Correctable error
2747 *
Jon Hunter4e871892020-07-12 11:01:18 +01002748 * Error descriptor @ref ec_err_sw_error_desc.
Timo Alho4bef3582018-10-22 16:19:39 +03002749 */
2750 EC_ERR_TYPE_SW_CORRECTABLE = 16,
2751
2752 /** @brief SW Uncorrectable error
2753 *
Jon Hunter4e871892020-07-12 11:01:18 +01002754 * Error descriptor @ref ec_err_sw_error_desc.
Timo Alho4bef3582018-10-22 16:19:39 +03002755 */
2756 EC_ERR_TYPE_SW_UNCORRECTABLE = 17,
2757
2758 /** @brief Other HW Correctable error
2759 *
2760 * Error descriptor @ref ec_err_simple_desc.
2761 */
2762 EC_ERR_TYPE_OTHER_HW_CORRECTABLE = 32,
2763
2764 /** @brief Other HW Uncorrectable error
2765 *
2766 * Error descriptor @ref ec_err_simple_desc.
2767 */
2768 EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE = 33,
2769};
2770
2771/** @brief Group of registers with parity error. */
2772enum ec_registers_group {
2773 /** @brief Functional registers group */
Jon Hunter4e871892020-07-12 11:01:18 +01002774 EC_ERR_GROUP_FUNC_REG = 0U,
Timo Alho4bef3582018-10-22 16:19:39 +03002775 /** @brief SCR registers group */
Jon Hunter4e871892020-07-12 11:01:18 +01002776 EC_ERR_GROUP_SCR_REG = 1U,
Timo Alho4bef3582018-10-22 16:19:39 +03002777};
2778
2779/**
2780 * @defgroup bpmp_ec_status_flags EC Status Flags
2781 * @addtogroup bpmp_ec_status_flags
2782 * @{
2783 */
2784/** @brief No EC error found flag */
Jon Hunter4e871892020-07-12 11:01:18 +01002785#define EC_STATUS_FLAG_NO_ERROR 0x0001U
Timo Alho4bef3582018-10-22 16:19:39 +03002786/** @brief Last EC error found flag */
Jon Hunter4e871892020-07-12 11:01:18 +01002787#define EC_STATUS_FLAG_LAST_ERROR 0x0002U
Timo Alho4bef3582018-10-22 16:19:39 +03002788/** @brief EC latent error flag */
Jon Hunter4e871892020-07-12 11:01:18 +01002789#define EC_STATUS_FLAG_LATENT_ERROR 0x0004U
Timo Alho4bef3582018-10-22 16:19:39 +03002790/** @} */
2791
2792/**
2793 * @defgroup bpmp_ec_desc_flags EC Descriptor Flags
2794 * @addtogroup bpmp_ec_desc_flags
2795 * @{
2796 */
2797/** @brief EC descriptor error resolved flag */
Jon Hunter4e871892020-07-12 11:01:18 +01002798#define EC_DESC_FLAG_RESOLVED 0x0001U
Timo Alho4bef3582018-10-22 16:19:39 +03002799/** @brief EC descriptor failed to retrieve id flag */
Jon Hunter4e871892020-07-12 11:01:18 +01002800#define EC_DESC_FLAG_NO_ID 0x0002U
Timo Alho4bef3582018-10-22 16:19:39 +03002801/** @} */
2802
2803/**
2804 * |error type | fmon_clk_id values |
2805 * |---------------------------------|---------------------------|
2806 * |@ref EC_ERR_TYPE_CLOCK_MONITOR |@ref bpmp_clock_ids |
2807 */
2808struct ec_err_fmon_desc {
2809 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
2810 uint16_t desc_flags;
2811 /** @brief FMON monitored clock id */
2812 uint16_t fmon_clk_id;
2813 /** @brief Bitmask of @ref bpmp_fmon_faults_flags */
2814 uint32_t fmon_faults;
2815 /** @brief FMON faults access error */
2816 int32_t fmon_access_error;
Jon Hunter4e871892020-07-12 11:01:18 +01002817} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002818
2819/**
2820 * |error type | vmon_adc_id values |
2821 * |---------------------------------|---------------------------|
2822 * |@ref EC_ERR_TYPE_VOLTAGE_MONITOR |@ref bpmp_adc_ids |
2823 */
2824struct ec_err_vmon_desc {
2825 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
2826 uint16_t desc_flags;
2827 /** @brief VMON rail adc id */
2828 uint16_t vmon_adc_id;
2829 /** @brief Bitmask of @ref bpmp_vmon_faults_flags */
2830 uint32_t vmon_faults;
2831 /** @brief VMON faults access error */
2832 int32_t vmon_access_error;
Jon Hunter4e871892020-07-12 11:01:18 +01002833} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002834
2835/**
2836 * |error type | reg_id values |
2837 * |---------------------------------|---------------------------|
2838 * |@ref EC_ERR_TYPE_REGISTER_PARITY |@ref bpmp_ec_registers_ids |
2839 */
2840struct ec_err_reg_parity_desc {
2841 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
2842 uint16_t desc_flags;
2843 /** @brief Register id */
2844 uint16_t reg_id;
2845 /** @brief Register group @ref ec_registers_group */
2846 uint16_t reg_group;
Jon Hunter4e871892020-07-12 11:01:18 +01002847} BPMP_ABI_PACKED;
2848
2849/**
2850 * |error type | err_source_id values |
2851 * |--------------------------------- |--------------------------|
2852 * |@ref EC_ERR_TYPE_SW_CORRECTABLE | @ref bpmp_ec_ce_swd_ids |
2853 * |@ref EC_ERR_TYPE_SW_UNCORRECTABLE | @ref bpmp_ec_ue_swd_ids |
2854 */
2855struct ec_err_sw_error_desc {
2856 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
2857 uint16_t desc_flags;
2858 /** @brief Error source id */
2859 uint16_t err_source_id;
2860 /** @brief Sw error data */
2861 uint32_t sw_error_data;
2862} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002863
2864/**
2865 * |error type | err_source_id values |
2866 * |----------------------------------------|---------------------------|
2867 * |@ref EC_ERR_TYPE_PARITY_INTERNAL |@ref bpmp_ec_ipath_ids |
2868 * |@ref EC_ERR_TYPE_ECC_SEC_INTERNAL |@ref bpmp_ec_ipath_ids |
2869 * |@ref EC_ERR_TYPE_ECC_DED_INTERNAL |@ref bpmp_ec_ipath_ids |
2870 * |@ref EC_ERR_TYPE_COMPARATOR |@ref bpmp_ec_comparator_ids|
2871 * |@ref EC_ERR_TYPE_PARITY_SRAM |@ref bpmp_clock_ids |
Jon Hunter4e871892020-07-12 11:01:18 +01002872 * |@ref EC_ERR_TYPE_OTHER_HW_CORRECTABLE |@ref bpmp_ec_misc_hwd_ids |
2873 * |@ref EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE |@ref bpmp_ec_misc_hwd_ids |
Timo Alho4bef3582018-10-22 16:19:39 +03002874 */
2875struct ec_err_simple_desc {
2876 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
2877 uint16_t desc_flags;
2878 /** @brief Error source id. Id space depends on error type. */
2879 uint16_t err_source_id;
Jon Hunter4e871892020-07-12 11:01:18 +01002880} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002881
2882/** @brief Union of EC error descriptors */
2883union ec_err_desc {
2884 struct ec_err_fmon_desc fmon_desc;
2885 struct ec_err_vmon_desc vmon_desc;
2886 struct ec_err_reg_parity_desc reg_parity_desc;
Jon Hunter4e871892020-07-12 11:01:18 +01002887 struct ec_err_sw_error_desc sw_error_desc;
Timo Alho4bef3582018-10-22 16:19:39 +03002888 struct ec_err_simple_desc simple_desc;
Jon Hunter4e871892020-07-12 11:01:18 +01002889} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002890
2891struct cmd_ec_status_get_request {
2892 /** @brief HSM error line number that identifies target EC. */
2893 uint32_t ec_hsm_id;
Jon Hunter4e871892020-07-12 11:01:18 +01002894} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002895
2896/** EC status maximum number of descriptors */
Jon Hunter4e871892020-07-12 11:01:18 +01002897#define EC_ERR_STATUS_DESC_MAX_NUM 4U
Timo Alho4bef3582018-10-22 16:19:39 +03002898
Jon Hunter4e871892020-07-12 11:01:18 +01002899/**
2900 * @cond DEPRECATED
2901 */
Timo Alho4bef3582018-10-22 16:19:39 +03002902struct cmd_ec_status_get_response {
2903 /** @brief Target EC id (the same id received with request). */
2904 uint32_t ec_hsm_id;
2905 /**
2906 * @brief Bitmask of @ref bpmp_ec_status_flags
2907 *
2908 * If NO_ERROR flag is set, error_ fields should be ignored
2909 */
2910 uint32_t ec_status_flags;
2911 /** @brief Found EC error index. */
2912 uint32_t error_idx;
2913 /** @brief Found EC error type @ref bpmp_ec_err_type. */
2914 uint32_t error_type;
2915 /** @brief Number of returned EC error descriptors */
2916 uint32_t error_desc_num;
2917 /** @brief EC error descriptors */
2918 union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];
Jon Hunter4e871892020-07-12 11:01:18 +01002919} BPMP_ABI_PACKED;
2920/** @endcond */
2921
2922struct cmd_ec_status_ex_get_response {
2923 /** @brief Target EC id (the same id received with request). */
2924 uint32_t ec_hsm_id;
2925 /**
2926 * @brief Bitmask of @ref bpmp_ec_status_flags
2927 *
2928 * If NO_ERROR flag is set, error_ fields should be ignored
2929 */
2930 uint32_t ec_status_flags;
2931 /** @brief Found EC error index. */
2932 uint32_t error_idx;
2933 /** @brief Found EC error type @ref bpmp_ec_err_type. */
2934 uint32_t error_type;
2935 /** @brief Found EC mission error counter value */
2936 uint32_t error_counter;
2937 /** @brief Found EC mission error user value */
2938 uint32_t error_uval;
2939 /** @brief Reserved entry */
2940 uint32_t reserved;
2941 /** @brief Number of returned EC error descriptors */
2942 uint32_t error_desc_num;
2943 /** @brief EC error descriptors */
2944 union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];
2945} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002946
2947/**
2948 * @ingroup EC
2949 * @brief Request with #MRQ_EC
2950 *
2951 * Used by the sender of an #MRQ_EC message to access ECs owned
2952 * by BPMP.
2953 *
Jon Hunter4e871892020-07-12 11:01:18 +01002954 * @cond DEPRECATED
Timo Alho4bef3582018-10-22 16:19:39 +03002955 * |sub-command |payload |
2956 * |----------------------------|-----------------------|
2957 * |@ref CMD_EC_STATUS_GET |ec_status_get |
Jon Hunter4e871892020-07-12 11:01:18 +01002958 * @endcond
2959 *
2960 * |sub-command |payload |
2961 * |----------------------------|-----------------------|
2962 * |@ref CMD_EC_STATUS_EX_GET |ec_status_get |
Timo Alho4bef3582018-10-22 16:19:39 +03002963 *
2964 */
2965
2966struct mrq_ec_request {
2967 /** @brief Sub-command id. */
2968 uint32_t cmd_id;
2969
2970 union {
2971 struct cmd_ec_status_get_request ec_status_get;
Jon Hunter4e871892020-07-12 11:01:18 +01002972 } BPMP_UNION_ANON;
2973} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03002974
2975/**
2976 * @ingroup EC
2977 * @brief Response to MRQ_EC
2978 *
2979 * Each sub-command supported by @ref mrq_ec_request may return
2980 * sub-command-specific data as indicated below.
2981 *
Jon Hunter4e871892020-07-12 11:01:18 +01002982 * @cond DEPRECATED
Timo Alho4bef3582018-10-22 16:19:39 +03002983 * |sub-command |payload |
2984 * |----------------------------|------------------------|
2985 * |@ref CMD_EC_STATUS_GET |ec_status_get |
Jon Hunter4e871892020-07-12 11:01:18 +01002986 * @endcond
2987 *
2988 * |sub-command |payload |
2989 * |----------------------------|------------------------|
2990 * |@ref CMD_EC_STATUS_EX_GET |ec_status_ex_get |
Timo Alho4bef3582018-10-22 16:19:39 +03002991 *
2992 */
2993
2994struct mrq_ec_response {
2995 union {
Jon Hunter4e871892020-07-12 11:01:18 +01002996 /**
2997 * @cond DEPRECATED
2998 */
Timo Alho4bef3582018-10-22 16:19:39 +03002999 struct cmd_ec_status_get_response ec_status_get;
Jon Hunter4e871892020-07-12 11:01:18 +01003000 /** @endcond */
3001 struct cmd_ec_status_ex_get_response ec_status_ex_get;
3002 } BPMP_UNION_ANON;
3003} BPMP_ABI_PACKED;
Timo Alho4bef3582018-10-22 16:19:39 +03003004
3005/** @} */
3006/** @endcond */
3007
3008/**
3009 * @addtogroup Error_Codes
Thierry Reding983de5f2016-08-19 19:05:35 +02003010 * Negative values for mrq_response::err generally indicate some
3011 * error. The ABI defines the following error codes. Negating these
3012 * defines is an exercise left to the user.
3013 * @{
3014 */
Timo Alho4bef3582018-10-22 16:19:39 +03003015
Jon Hunter4e871892020-07-12 11:01:18 +01003016/** @brief Operation not permitted */
3017#define BPMP_EPERM 1
Thierry Reding983de5f2016-08-19 19:05:35 +02003018/** @brief No such file or directory */
3019#define BPMP_ENOENT 2
3020/** @brief No MRQ handler */
3021#define BPMP_ENOHANDLER 3
3022/** @brief I/O error */
3023#define BPMP_EIO 5
3024/** @brief Bad sub-MRQ command */
3025#define BPMP_EBADCMD 6
Jon Hunter4e871892020-07-12 11:01:18 +01003026/** @brief Resource temporarily unavailable */
3027#define BPMP_EAGAIN 11
Thierry Reding983de5f2016-08-19 19:05:35 +02003028/** @brief Not enough memory */
3029#define BPMP_ENOMEM 12
3030/** @brief Permission denied */
3031#define BPMP_EACCES 13
3032/** @brief Bad address */
3033#define BPMP_EFAULT 14
Jon Hunter4e871892020-07-12 11:01:18 +01003034/** @brief Resource busy */
3035#define BPMP_EBUSY 16
Thierry Reding983de5f2016-08-19 19:05:35 +02003036/** @brief No such device */
3037#define BPMP_ENODEV 19
3038/** @brief Argument is a directory */
3039#define BPMP_EISDIR 21
3040/** @brief Invalid argument */
3041#define BPMP_EINVAL 22
3042/** @brief Timeout during operation */
3043#define BPMP_ETIMEDOUT 23
3044/** @brief Out of range */
3045#define BPMP_ERANGE 34
Timo Alho4bef3582018-10-22 16:19:39 +03003046/** @brief Function not implemented */
Jon Hunter4e871892020-07-12 11:01:18 +01003047#define BPMP_ENOSYS 38
Timo Alho4bef3582018-10-22 16:19:39 +03003048/** @brief Invalid slot */
3049#define BPMP_EBADSLT 57
Jon Hunter4e871892020-07-12 11:01:18 +01003050/** @brief Not supported */
3051#define BPMP_ENOTSUP 134
3052/** @brief No such device or address */
3053#define BPMP_ENXIO 140
Timo Alho4bef3582018-10-22 16:19:39 +03003054
Thierry Reding983de5f2016-08-19 19:05:35 +02003055/** @} */
Timo Alho4bef3582018-10-22 16:19:39 +03003056
Jon Hunter4e871892020-07-12 11:01:18 +01003057#if defined(BPMP_ABI_CHECKS)
3058#include "bpmp_abi_checks.h"
3059#endif
3060
Thierry Reding983de5f2016-08-19 19:05:35 +02003061#endif