Loading...
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved.
4 */
5
6#ifndef ABI_BPMP_ABI_H
7#define ABI_BPMP_ABI_H
8
9#if defined(LK) || defined(BPMP_ABI_HAVE_STDC)
10#include <stddef.h>
11#include <stdint.h>
12#endif
13
14#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
20#endif
21
22#ifdef NO_GCC_EXTENSIONS
23#define BPMP_ABI_EMPTY char empty;
24#define BPMP_ABI_EMPTY_ARRAY 1
25#else
26#define BPMP_ABI_EMPTY
27#define BPMP_ABI_EMPTY_ARRAY 0
28#endif
29
30#ifndef BPMP_UNION_ANON
31#ifdef __UNION_ANON
32#define BPMP_UNION_ANON __UNION_ANON
33#else
34#define BPMP_UNION_ANON
35#endif
36#endif
37
38/**
39 * @file
40 */
41
42/**
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/**
54 * @addtogroup MRQ_Format
55 * @{
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
77 * Request an answer from the peer.
78 * This should be set in mrq_request::flags for all requests targetted
79 * at BPMP. For requests originating in BPMP, this flag is optional except
80 * for messages targeting MCE, for which the field must be set.
81 * When this flag is not set, the remote peer must not send a response
82 * back.
83 */
84#define BPMP_MAIL_DO_ACK (1U << 0U)
85
86/**
87 * @ingroup MRQ_Format
88 * Ring the sender's doorbell when responding. This should be set unless
89 * the sender wants to poll the underlying communications layer directly.
90 *
91 * An optional direction that can be specified in mrq_request::flags.
92 */
93#define BPMP_MAIL_RING_DB (1U << 1U)
94
95/**
96 * @ingroup MRQ_Format
97 * CRC present
98 */
99#define BPMP_MAIL_CRC_PRESENT (1U << 2U)
100
101/**
102 * @ingroup MRQ_Format
103 * @brief Header for an MRQ message
104 *
105 * Provides the MRQ number for the MRQ message: #mrq. The remainder of
106 * the MRQ message is a payload (immediately following the
107 * mrq_request) whose format depends on mrq.
108 */
109struct mrq_request {
110 /** @brief MRQ number of the request */
111 uint32_t mrq;
112
113 /**
114 * @brief 32bit word containing a number of fields as follows:
115 *
116 * struct {
117 * uint8_t options:4;
118 * uint8_t xid:4;
119 * uint8_t payload_length;
120 * uint16_t crc16;
121 * };
122 *
123 * **options** directions to the receiver and indicates CRC presence.
124 *
125 * #BPMP_MAIL_DO_ACK and #BPMP_MAIL_RING_DB see documentation of respective options.
126 * #BPMP_MAIL_CRC_PRESENT is supported on T234 and later platforms. It indicates the
127 * crc16, xid and length fields are present when set.
128 * Some platform configurations, especially when targeted to applications requiring
129 * functional safety, mandate this option being set or otherwise will respond with
130 * -BPMP_EBADMSG and ignore the request.
131 *
132 * **xid** is a transaction ID.
133 *
134 * Only used when #BPMP_MAIL_CRC_PRESENT is set.
135 *
136 * **payload_length** of the message expressed in bytes without the size of this header.
137 * See table below for minimum accepted payload lengths for each MRQ.
138 * Note: For DMCE communication, this field expresses the length as a multiple of 4 bytes
139 * rather than bytes.
140 *
141 * Only used when #BPMP_MAIL_CRC_PRESENT is set.
142 *
143 * | MRQ | CMD | minimum payload length
144 * | -------------------- | ------------------------------------ | ------------------------------------------ |
145 * | MRQ_PING | | 4 |
146 * | MRQ_THREADED_PING | | 4 |
147 * | MRQ_RESET | any | 8 |
148 * | MRQ_I2C | | 12 + cmd_i2c_xfer_request.data_size |
149 * | MRQ_CLK | CMD_CLK_GET_RATE | 4 |
150 * | MRQ_CLK | CMD_CLK_SET_RATE | 16 |
151 * | MRQ_CLK | CMD_CLK_ROUND_RATE | 16 |
152 * | MRQ_CLK | CMD_CLK_GET_PARENT | 4 |
153 * | MRQ_CLK | CMD_CLK_SET_PARENT | 8 |
154 * | MRQ_CLK | CMD_CLK_ENABLE | 4 |
155 * | MRQ_CLK | CMD_CLK_DISABLE | 4 |
156 * | MRQ_CLK | CMD_CLK_IS_ENABLED | 4 |
157 * | MRQ_CLK | CMD_CLK_GET_ALL_INFO | 4 |
158 * | MRQ_CLK | CMD_CLK_GET_MAX_CLK_ID | 4 |
159 * | MRQ_CLK | CMD_CLK_GET_FMAX_AT_VMIN | 4 |
160 * | MRQ_QUERY_ABI | | 4 |
161 * | MRQ_PG | CMD_PG_QUERY_ABI | 12 |
162 * | MRQ_PG | CMD_PG_SET_STATE | 12 |
163 * | MRQ_PG | CMD_PG_GET_STATE | 8 |
164 * | MRQ_PG | CMD_PG_GET_NAME | 8 |
165 * | MRQ_PG | CMD_PG_GET_MAX_ID | 8 |
166 * | MRQ_THERMAL | CMD_THERMAL_QUERY_ABI | 8 |
167 * | MRQ_THERMAL | CMD_THERMAL_GET_TEMP | 8 |
168 * | MRQ_THERMAL | CMD_THERMAL_SET_TRIP | 20 |
169 * | MRQ_THERMAL | CMD_THERMAL_GET_NUM_ZONES | 4 |
170 * | MRQ_THERMAL | CMD_THERMAL_GET_THERMTRIP | 8 |
171 * | MRQ_CPU_VHINT | | 8 |
172 * | MRQ_ABI_RATCHET | | 2 |
173 * | MRQ_EMC_DVFS_LATENCY | | 8 |
174 * | MRQ_EMC_DVFS_EMCHUB | | 8 |
175 * | MRQ_EMC_DISP_RFL | | 4 |
176 * | MRQ_BWMGR | CMD_BWMGR_QUERY_ABI | 8 |
177 * | MRQ_BWMGR | CMD_BWMGR_CALC_RATE | 8 + 8 * bwmgr_rate_req.num_iso_clients |
178 * | MRQ_ISO_CLIENT | CMD_ISO_CLIENT_QUERY_ABI | 8 |
179 * | MRQ_ISO_CLIENT | CMD_ISO_CLIENT_CALCULATE_LA | 16 |
180 * | MRQ_ISO_CLIENT | CMD_ISO_CLIENT_SET_LA | 16 |
181 * | MRQ_ISO_CLIENT | CMD_ISO_CLIENT_GET_MAX_BW | 8 |
182 * | MRQ_CPU_NDIV_LIMITS | | 4 |
183 * | MRQ_CPU_AUTO_CC3 | | 4 |
184 * | MRQ_RINGBUF_CONSOLE | CMD_RINGBUF_CONSOLE_QUERY_ABI | 8 |
185 * | MRQ_RINGBUF_CONSOLE | CMD_RINGBUF_CONSOLE_READ | 5 |
186 * | MRQ_RINGBUF_CONSOLE | CMD_RINGBUF_CONSOLE_WRITE | 5 + cmd_ringbuf_console_write_req.len |
187 * | MRQ_RINGBUF_CONSOLE | CMD_RINGBUF_CONSOLE_GET_FIFO | 4 |
188 * | MRQ_STRAP | STRAP_SET | 12 |
189 * | MRQ_UPHY | CMD_UPHY_PCIE_LANE_MARGIN_CONTROL | 24 |
190 * | MRQ_UPHY | CMD_UPHY_PCIE_LANE_MARGIN_STATUS | 4 |
191 * | MRQ_UPHY | CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT | 5 |
192 * | MRQ_UPHY | CMD_UPHY_PCIE_CONTROLLER_STATE | 6 |
193 * | MRQ_UPHY | CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF | 5 |
194 * | MRQ_FMON | CMD_FMON_GEAR_CLAMP | 16 |
195 * | MRQ_FMON | CMD_FMON_GEAR_FREE | 4 |
196 * | MRQ_FMON | CMD_FMON_GEAR_GET | 4 |
197 * | MRQ_FMON | CMD_FMON_FAULT_STS_GET | 8 |
198 * | MRQ_EC | CMD_EC_STATUS_EX_GET | 12 |
199 * | MRQ_QUERY_FW_TAG | | 0 |
200 * | MRQ_DEBUG | CMD_DEBUG_OPEN_RO | 4 + length of cmd_debug_fopen_request.name |
201 * | MRQ_DEBUG | CMD_DEBUG_OPEN_WO | 4 + length of cmd_debug_fopen_request.name |
202 * | MRQ_DEBUG | CMD_DEBUG_READ | 8 |
203 * | MRQ_DEBUG | CMD_DEBUG_WRITE | 12 + cmd_debug_fwrite_request.datalen |
204 * | MRQ_DEBUG | CMD_DEBUG_CLOSE | 8 |
205 * | MRQ_TELEMETRY | | 8 |
206 * | MRQ_PWR_LIMIT | CMD_PWR_LIMIT_QUERY_ABI | 8 |
207 * | MRQ_PWR_LIMIT | CMD_PWR_LIMIT_SET | 20 |
208 * | MRQ_PWR_LIMIT | CMD_PWR_LIMIT_GET | 16 |
209 * | MRQ_PWR_LIMIT | CMD_PWR_LIMIT_CURR_CAP | 8 |
210 * | MRQ_GEARS | | 0 |
211 * | MRQ_BWMGR_INT | CMD_BWMGR_INT_QUERY_ABI | 8 |
212 * | MRQ_BWMGR_INT | CMD_BWMGR_INT_CALC_AND_SET | 16 |
213 * | MRQ_BWMGR_INT | CMD_BWMGR_INT_CAP_SET | 8 |
214 * | MRQ_OC_STATUS | | 0 |
215 *
216 * **crc16**
217 *
218 * CRC16 using polynomial x^16 + x^14 + x^12 + x^11 + x^8 + x^5 + x^4 + x^2 + 1
219 * and initialization value 0x4657. The CRC is calculated over all bytes of the message
220 * including this header. However the crc16 field is considered to be set to 0 when
221 * calculating the CRC. Only used when #BPMP_MAIL_CRC_PRESENT is set. If
222 * #BPMP_MAIL_CRC_PRESENT is set and this field does not match the CRC as
223 * calculated by BPMP, -BPMP_EBADMSG will be returned and the request will
224 * be ignored. See code snippet below on how to calculate the CRC.
225 *
226 * @code
227 * uint16_t calc_crc_digest(uint16_t crc, uint8_t *data, size_t size)
228 * {
229 * for (size_t i = 0; i < size; i++) {
230 * crc ^= data[i] << 8;
231 * for (size_t j = 0; j < 8; j++) {
232 * if ((crc & 0x8000) == 0x8000) {
233 * crc = (crc << 1) ^ 0xAC9A;
234 * } else {
235 * crc = (crc << 1);
236 * }
237 * }
238 * }
239 * return crc;
240 * }
241 *
242 * uint16_t calc_crc(uint8_t *data, size_t size)
243 * {
244 * return calc_crc_digest(0x4657, data, size);
245 * }
246 * @endcode
247 */
248 uint32_t flags;
249} BPMP_ABI_PACKED;
250
251/**
252 * @ingroup MRQ_Format
253 * @brief Header for an MRQ response
254 *
255 * Provides an error code for the associated MRQ message. The
256 * remainder of the MRQ response is a payload (immediately following
257 * the mrq_response) whose format depends on the associated
258 * mrq_request::mrq
259 */
260struct mrq_response {
261 /** @brief Error code for the MRQ request itself */
262 int32_t err;
263
264 /**
265 * @brief 32bit word containing a number of fields as follows:
266 *
267 * struct {
268 * uint8_t options:4;
269 * uint8_t xid:4;
270 * uint8_t payload_length;
271 * uint16_t crc16;
272 * };
273 *
274 * **options** indicates CRC presence.
275 *
276 * #BPMP_MAIL_CRC_PRESENT is supported on T234 and later platforms and
277 * indicates the crc16 related fields are present when set.
278 *
279 * **xid** is the transaction ID as sent by the requestor.
280 *
281 * **length** of the message expressed in bytes without the size of this header.
282 * Note: For DMCE communication, this field expresses the length as a multiple of 4 bytes
283 * rather than bytes.
284 *
285 * **crc16**
286 *
287 * CRC16 using polynomial x^16 + x^14 + x^12 + x^11 + x^8 + x^5 + x^4 + x^2 + 1
288 * and initialization value 0x4657. The CRC is calculated over all bytes of the message
289 * including this header. However the crc16 field is considered to be set to 0 when
290 * calculating the CRC. Only used when #BPMP_MAIL_CRC_PRESENT is set.
291 */
292 uint32_t flags;
293} BPMP_ABI_PACKED;
294
295/**
296 * @ingroup MRQ_Format
297 * Minimum needed size for an IPC message buffer
298 */
299#define MSG_MIN_SZ 128U
300/**
301 * @ingroup MRQ_Format
302 * Minimum size guaranteed for data in an IPC message buffer
303 */
304#define MSG_DATA_MIN_SZ 120U
305
306/**
307 * @ingroup MRQ_Codes
308 * @name Legal MRQ codes
309 * These are the legal values for mrq_request::mrq
310 * @{
311 */
312
313#define MRQ_PING 0U
314#define MRQ_QUERY_TAG 1U
315#define MRQ_THREADED_PING 9U
316#define MRQ_DEBUGFS 19U
317#define MRQ_RESET 20U
318#define MRQ_I2C 21U
319#define MRQ_CLK 22U
320#define MRQ_QUERY_ABI 23U
321#define MRQ_THERMAL 27U
322#define MRQ_CPU_VHINT 28U
323#define MRQ_ABI_RATCHET 29U
324#define MRQ_EMC_DVFS_LATENCY 31U
325#define MRQ_RINGBUF_CONSOLE 65U
326#define MRQ_PG 66U
327#define MRQ_CPU_NDIV_LIMITS 67U
328#define MRQ_STRAP 68U
329#define MRQ_UPHY 69U
330#define MRQ_CPU_AUTO_CC3 70U
331#define MRQ_QUERY_FW_TAG 71U
332#define MRQ_FMON 72U
333#define MRQ_EC 73U
334#define MRQ_DEBUG 75U
335#define MRQ_EMC_DVFS_EMCHUB 76U
336#define MRQ_BWMGR 77U
337#define MRQ_ISO_CLIENT 78U
338#define MRQ_EMC_DISP_RFL 79U
339#define MRQ_TELEMETRY 80U
340#define MRQ_PWR_LIMIT 81U
341#define MRQ_GEARS 82U
342#define MRQ_BWMGR_INT 83U
343#define MRQ_OC_STATUS 84U
344
345/** @cond DEPRECATED */
346#define MRQ_RESERVED_2 2U
347#define MRQ_RESERVED_3 3U
348#define MRQ_RESERVED_4 4U
349#define MRQ_RESERVED_5 5U
350#define MRQ_RESERVED_6 6U
351#define MRQ_RESERVED_7 7U
352#define MRQ_RESERVED_8 8U
353#define MRQ_RESERVED_10 10U
354#define MRQ_RESERVED_11 11U
355#define MRQ_RESERVED_12 12U
356#define MRQ_RESERVED_13 13U
357#define MRQ_RESERVED_14 14U
358#define MRQ_RESERVED_15 15U
359#define MRQ_RESERVED_16 16U
360#define MRQ_RESERVED_17 17U
361#define MRQ_RESERVED_18 18U
362#define MRQ_RESERVED_24 24U
363#define MRQ_RESERVED_25 25U
364#define MRQ_RESERVED_26 26U
365#define MRQ_RESERVED_30 30U
366#define MRQ_RESERVED_64 64U
367#define MRQ_RESERVED_74 74U
368/** @endcond DEPRECATED */
369
370/** @} */
371
372/**
373 * @ingroup MRQ_Codes
374 * @brief Maximum MRQ code to be sent by CPU software to
375 * BPMP. Subject to change in future
376 */
377#define MAX_CPU_MRQ_ID 84U
378
379/**
380 * @addtogroup MRQ_Payloads
381 * @{
382 * @defgroup Ping Ping
383 * @defgroup Query_Tag Query Tag
384 * @defgroup Module Loadable Modules
385 * @defgroup Trace Trace
386 * @defgroup Debugfs Debug File System
387 * @defgroup Reset Reset
388 * @defgroup I2C I2C
389 * @defgroup Clocks Clocks
390 * @defgroup ABI_info ABI Info
391 * @defgroup Powergating Power Gating
392 * @defgroup Thermal Thermal
393 * @defgroup OC_status OC status
394 * @defgroup Vhint CPU Voltage hint
395 * @defgroup EMC EMC
396 * @defgroup BWMGR BWMGR
397 * @defgroup ISO_CLIENT ISO_CLIENT
398 * @defgroup CPU NDIV Limits
399 * @defgroup RingbufConsole Ring Buffer Console
400 * @defgroup Strap Straps
401 * @defgroup UPHY UPHY
402 * @defgroup CC3 Auto-CC3
403 * @defgroup FMON FMON
404 * @defgroup EC EC
405 * @defgroup Telemetry Telemetry
406 * @defgroup Pwrlimit PWR_LIMIT
407 * @defgroup Gears Gears
408 * @defgroup BWMGR_INT Bandwidth Manager Integrated
409 * @} MRQ_Payloads
410 */
411
412/**
413 * @ingroup MRQ_Codes
414 * @def MRQ_PING
415 * @brief A simple ping
416 *
417 * * Platforms: All
418 * * Initiators: Any
419 * * Targets: Any
420 * * Request Payload: @ref mrq_ping_request
421 * * Response Payload: @ref mrq_ping_response
422 *
423 * @ingroup MRQ_Codes
424 * @def MRQ_THREADED_PING
425 * @brief A deeper ping
426 *
427 * * Platforms: All
428 * * Initiators: Any
429 * * Targets: BPMP
430 * * Request Payload: @ref mrq_ping_request
431 * * Response Payload: @ref mrq_ping_response
432 *
433 * Behavior is equivalent to a simple #MRQ_PING except that BPMP
434 * responds from a thread context (providing a slightly more robust
435 * sign of life).
436 *
437 */
438
439/**
440 * @ingroup Ping
441 * @brief Request with #MRQ_PING
442 *
443 * Used by the sender of an #MRQ_PING message to request a pong from
444 * recipient. The response from the recipient is computed based on
445 * #challenge.
446 */
447struct mrq_ping_request {
448/** @brief Arbitrarily chosen value */
449 uint32_t challenge;
450} BPMP_ABI_PACKED;
451
452/**
453 * @ingroup Ping
454 * @brief Response to #MRQ_PING
455 *
456 * Sent in response to an #MRQ_PING message. #reply should be the
457 * mrq_ping_request challenge left shifted by 1 with the carry-bit
458 * dropped.
459 *
460 */
461struct mrq_ping_response {
462 /** @brief Response to the MRQ_PING challege */
463 uint32_t reply;
464} BPMP_ABI_PACKED;
465
466/**
467 * @ingroup MRQ_Codes
468 * @def MRQ_QUERY_TAG
469 * @brief Query BPMP firmware's tag (i.e. unique identifer)
470 *
471 * @deprecated Use #MRQ_QUERY_FW_TAG instead.
472 *
473 * * Platforms: All
474 * * Initiators: CCPLEX
475 * * Targets: BPMP
476 * * Request Payload: @ref mrq_query_tag_request
477 * * Response Payload: N/A
478 *
479 */
480
481/**
482 * @ingroup Query_Tag
483 * @brief Request with #MRQ_QUERY_TAG
484 *
485 * @deprecated This structure will be removed in future version.
486 * Use MRQ_QUERY_FW_TAG instead.
487 */
488struct mrq_query_tag_request {
489 /** @brief Base address to store the firmware tag */
490 uint32_t addr;
491} BPMP_ABI_PACKED;
492
493
494/**
495 * @ingroup MRQ_Codes
496 * @def MRQ_QUERY_FW_TAG
497 * @brief Query BPMP firmware's tag (i.e. unique identifier)
498 *
499 * * Platforms: All
500 * * Initiators: Any
501 * * Targets: BPMP
502 * * Request Payload: N/A
503 * * Response Payload: @ref mrq_query_fw_tag_response
504 *
505 */
506
507/**
508 * @ingroup Query_Tag
509 * @brief Response to #MRQ_QUERY_FW_TAG
510 *
511 * Sent in response to #MRQ_QUERY_FW_TAG message. #tag contains the unique
512 * identifier for the version of firmware issuing the reply.
513 *
514 */
515struct mrq_query_fw_tag_response {
516 /** @brief Array to store tag information */
517 uint8_t tag[32];
518} BPMP_ABI_PACKED;
519
520/** @private */
521struct mrq_threaded_ping_request {
522 uint32_t challenge;
523} BPMP_ABI_PACKED;
524
525/** @private */
526struct mrq_threaded_ping_response {
527 uint32_t reply;
528} BPMP_ABI_PACKED;
529
530/**
531 * @ingroup MRQ_Codes
532 * @def MRQ_DEBUGFS
533 * @brief Interact with BPMP's debugfs file nodes
534 *
535 * @deprecated use MRQ_DEBUG instead.
536 *
537 * * Platforms: T186, T194
538 * * Initiators: Any
539 * * Targets: BPMP
540 * * Request Payload: @ref mrq_debugfs_request
541 * * Response Payload: @ref mrq_debugfs_response
542 */
543
544/**
545 * @addtogroup Debugfs
546 * @{
547 *
548 * The BPMP firmware implements a pseudo-filesystem called
549 * debugfs. Any driver within the firmware may register with debugfs
550 * to expose an arbitrary set of "files" in the filesystem. When
551 * software on the CPU writes to a debugfs file, debugfs passes the
552 * written data to a callback provided by the driver. When software on
553 * the CPU reads a debugfs file, debugfs queries the driver for the
554 * data to return to the CPU. The intention of the debugfs filesystem
555 * is to provide information useful for debugging the system at
556 * runtime.
557 *
558 * @note The files exposed via debugfs are not part of the
559 * BPMP firmware's ABI. debugfs files may be added or removed in any
560 * given version of the firmware. Typically the semantics of a debugfs
561 * file are consistent from version to version but even that is not
562 * guaranteed.
563 *
564 * @}
565 */
566
567/** @ingroup Debugfs */
568enum mrq_debugfs_commands {
569 /** @brief Perform read */
570 CMD_DEBUGFS_READ = 1,
571 /** @brief Perform write */
572 CMD_DEBUGFS_WRITE = 2,
573 /** @brief Perform dumping directory */
574 CMD_DEBUGFS_DUMPDIR = 3,
575 /** @brief Not a command */
576 CMD_DEBUGFS_MAX
577};
578
579/**
580 * @ingroup Debugfs
581 * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
582 */
583struct cmd_debugfs_fileop_request {
584 /** @brief Physical address pointing at filename */
585 uint32_t fnameaddr;
586 /** @brief Length in bytes of filename buffer */
587 uint32_t fnamelen;
588 /** @brief Physical address pointing to data buffer */
589 uint32_t dataaddr;
590 /** @brief Length in bytes of data buffer */
591 uint32_t datalen;
592} BPMP_ABI_PACKED;
593
594/**
595 * @ingroup Debugfs
596 * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
597 */
598struct cmd_debugfs_dumpdir_request {
599 /** @brief Physical address pointing to data buffer */
600 uint32_t dataaddr;
601 /** @brief Length in bytes of data buffer */
602 uint32_t datalen;
603} BPMP_ABI_PACKED;
604
605/**
606 * @ingroup Debugfs
607 * @brief Response data for CMD_DEBUGFS_READ/WRITE command
608 */
609struct cmd_debugfs_fileop_response {
610 /** @brief Always 0 */
611 uint32_t reserved;
612 /** @brief Number of bytes read from or written to data buffer */
613 uint32_t nbytes;
614} BPMP_ABI_PACKED;
615
616/**
617 * @ingroup Debugfs
618 * @brief Response data for CMD_DEBUGFS_DUMPDIR command
619 */
620struct cmd_debugfs_dumpdir_response {
621 /** @brief Always 0 */
622 uint32_t reserved;
623 /** @brief Number of bytes read from or written to data buffer */
624 uint32_t nbytes;
625} BPMP_ABI_PACKED;
626
627/**
628 * @ingroup Debugfs
629 * @brief Request with #MRQ_DEBUGFS.
630 *
631 * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs
632 * command to execute. Legal commands are the values of @ref
633 * mrq_debugfs_commands. Each command requires a specific additional
634 * payload of data.
635 *
636 * |command |payload|
637 * |-------------------|-------|
638 * |CMD_DEBUGFS_READ |fop |
639 * |CMD_DEBUGFS_WRITE |fop |
640 * |CMD_DEBUGFS_DUMPDIR|dumpdir|
641 */
642struct mrq_debugfs_request {
643 /** @brief Sub-command (@ref mrq_debugfs_commands) */
644 uint32_t cmd;
645 union {
646 struct cmd_debugfs_fileop_request fop;
647 struct cmd_debugfs_dumpdir_request dumpdir;
648 } BPMP_UNION_ANON;
649} BPMP_ABI_PACKED;
650
651/**
652 * @ingroup Debugfs
653 */
654struct mrq_debugfs_response {
655 /** @brief Always 0 */
656 int32_t reserved;
657 union {
658 /** @brief Response data for CMD_DEBUGFS_READ OR
659 * CMD_DEBUGFS_WRITE command
660 */
661 struct cmd_debugfs_fileop_response fop;
662 /** @brief Response data for CMD_DEBUGFS_DUMPDIR command */
663 struct cmd_debugfs_dumpdir_response dumpdir;
664 } BPMP_UNION_ANON;
665} BPMP_ABI_PACKED;
666
667/**
668 * @addtogroup Debugfs
669 * @{
670 */
671#define DEBUGFS_S_ISDIR (1 << 9)
672#define DEBUGFS_S_IRUSR (1 << 8)
673#define DEBUGFS_S_IWUSR (1 << 7)
674/** @} Debugfs */
675
676/**
677 * @ingroup MRQ_Codes
678 * @def MRQ_DEBUG
679 * @brief Interact with BPMP's debugfs file nodes. Use message payload
680 * for exchanging data. This is functionally equivalent to
681 * @ref MRQ_DEBUGFS. But the way in which data is exchanged is different.
682 * When software running on CPU tries to read a debugfs file,
683 * the file path and read data will be stored in message payload.
684 * Since the message payload size is limited, a debugfs file
685 * transaction might require multiple frames of data exchanged
686 * between BPMP and CPU until the transaction completes.
687 *
688 * * Platforms: T194
689 * * Initiators: Any
690 * * Targets: BPMP
691 * * Request Payload: @ref mrq_debug_request
692 * * Response Payload: @ref mrq_debug_response
693 */
694
695/** @ingroup Debugfs */
696enum mrq_debug_commands {
697 /** @brief Open required file for read operation */
698 CMD_DEBUG_OPEN_RO = 0,
699 /** @brief Open required file for write operation */
700 CMD_DEBUG_OPEN_WO = 1,
701 /** @brief Perform read */
702 CMD_DEBUG_READ = 2,
703 /** @brief Perform write */
704 CMD_DEBUG_WRITE = 3,
705 /** @brief Close file */
706 CMD_DEBUG_CLOSE = 4,
707 /** @brief Not a command */
708 CMD_DEBUG_MAX
709};
710
711/**
712 * @ingroup Debugfs
713 * @brief Maximum number of files that can be open at a given time
714 */
715#define DEBUG_MAX_OPEN_FILES 1
716
717/**
718 * @ingroup Debugfs
719 * @brief Maximum size of null-terminated file name string in bytes.
720 * Value is derived from memory available in message payload while
721 * using @ref cmd_debug_fopen_request
722 * Value 4 corresponds to size of @ref mrq_debug_commands
723 * in @ref mrq_debug_request.
724 * 120 - 4 dbg_cmd(32bit) = 116
725 */
726#define DEBUG_FNAME_MAX_SZ (MSG_DATA_MIN_SZ - 4)
727
728/**
729 * @ingroup Debugfs
730 * @brief Parameters for CMD_DEBUG_OPEN command
731 */
732struct cmd_debug_fopen_request {
733 /** @brief File name - Null-terminated string with maximum
734 * length @ref DEBUG_FNAME_MAX_SZ
735 */
736 char name[DEBUG_FNAME_MAX_SZ];
737} BPMP_ABI_PACKED;
738
739/**
740 * @ingroup Debugfs
741 * @brief Response data for CMD_DEBUG_OPEN_RO/WO command
742 */
743struct cmd_debug_fopen_response {
744 /** @brief Identifier for file access */
745 uint32_t fd;
746 /** @brief Data length. File data size for READ command.
747 * Maximum allowed length for WRITE command
748 */
749 uint32_t datalen;
750} BPMP_ABI_PACKED;
751
752/**
753 * @ingroup Debugfs
754 * @brief Parameters for CMD_DEBUG_READ command
755 */
756struct cmd_debug_fread_request {
757 /** @brief File access identifier received in response
758 * to CMD_DEBUG_OPEN_RO request
759 */
760 uint32_t fd;
761} BPMP_ABI_PACKED;
762
763/**
764 * @ingroup Debugfs
765 * @brief Maximum size of read data in bytes.
766 * Value is derived from memory available in message payload while
767 * using @ref cmd_debug_fread_response.
768 */
769#define DEBUG_READ_MAX_SZ (MSG_DATA_MIN_SZ - 4)
770
771/**
772 * @ingroup Debugfs
773 * @brief Response data for CMD_DEBUG_READ command
774 */
775struct cmd_debug_fread_response {
776 /** @brief Size of data provided in this response in bytes */
777 uint32_t readlen;
778 /** @brief File data from seek position */
779 char data[DEBUG_READ_MAX_SZ];
780} BPMP_ABI_PACKED;
781
782/**
783 * @ingroup Debugfs
784 * @brief Maximum size of write data in bytes.
785 * Value is derived from memory available in message payload while
786 * using @ref cmd_debug_fwrite_request.
787 */
788#define DEBUG_WRITE_MAX_SZ (MSG_DATA_MIN_SZ - 12)
789
790/**
791 * @ingroup Debugfs
792 * @brief Parameters for CMD_DEBUG_WRITE command
793 */
794struct cmd_debug_fwrite_request {
795 /** @brief File access identifier received in response
796 * to CMD_DEBUG_OPEN_RO request
797 */
798 uint32_t fd;
799 /** @brief Size of write data in bytes */
800 uint32_t datalen;
801 /** @brief Data to be written */
802 char data[DEBUG_WRITE_MAX_SZ];
803} BPMP_ABI_PACKED;
804
805/**
806 * @ingroup Debugfs
807 * @brief Parameters for CMD_DEBUG_CLOSE command
808 */
809struct cmd_debug_fclose_request {
810 /** @brief File access identifier received in response
811 * to CMD_DEBUG_OPEN_RO request
812 */
813 uint32_t fd;
814} BPMP_ABI_PACKED;
815
816/**
817 * @ingroup Debugfs
818 * @brief Request with #MRQ_DEBUG.
819 *
820 * The sender of an MRQ_DEBUG message uses #cmd to specify a debugfs
821 * command to execute. Legal commands are the values of @ref
822 * mrq_debug_commands. Each command requires a specific additional
823 * payload of data.
824 *
825 * |command |payload|
826 * |-------------------|-------|
827 * |CMD_DEBUG_OPEN_RO |fop |
828 * |CMD_DEBUG_OPEN_WO |fop |
829 * |CMD_DEBUG_READ |frd |
830 * |CMD_DEBUG_WRITE |fwr |
831 * |CMD_DEBUG_CLOSE |fcl |
832 */
833struct mrq_debug_request {
834 /** @brief Sub-command (@ref mrq_debug_commands) */
835 uint32_t cmd;
836 union {
837 /** @brief Request payload for CMD_DEBUG_OPEN_RO/WO command */
838 struct cmd_debug_fopen_request fop;
839 /** @brief Request payload for CMD_DEBUG_READ command */
840 struct cmd_debug_fread_request frd;
841 /** @brief Request payload for CMD_DEBUG_WRITE command */
842 struct cmd_debug_fwrite_request fwr;
843 /** @brief Request payload for CMD_DEBUG_CLOSE command */
844 struct cmd_debug_fclose_request fcl;
845 } BPMP_UNION_ANON;
846} BPMP_ABI_PACKED;
847
848/**
849 * @ingroup Debugfs
850 */
851struct mrq_debug_response {
852 union {
853 /** @brief Response data for CMD_DEBUG_OPEN_RO/WO command */
854 struct cmd_debug_fopen_response fop;
855 /** @brief Response data for CMD_DEBUG_READ command */
856 struct cmd_debug_fread_response frd;
857 } BPMP_UNION_ANON;
858} BPMP_ABI_PACKED;
859
860/**
861 * @ingroup MRQ_Codes
862 * @def MRQ_RESET
863 * @brief Reset an IP block
864 *
865 * * Platforms: T186, T194
866 * * Initiators: Any
867 * * Targets: BPMP
868 * * Request Payload: @ref mrq_reset_request
869 * * Response Payload: @ref mrq_reset_response
870 *
871 * @addtogroup Reset
872 * @{
873 */
874
875enum mrq_reset_commands {
876 /**
877 * @brief Assert module reset
878 *
879 * mrq_response::err is 0 if the operation was successful, or @n
880 * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n
881 * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n
882 * -#BPMP_ENOTSUP if target domain h/w state does not allow reset
883 */
884 CMD_RESET_ASSERT = 1,
885 /**
886 * @brief Deassert module reset
887 *
888 * mrq_response::err is 0 if the operation was successful, or @n
889 * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n
890 * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n
891 * -#BPMP_ENOTSUP if target domain h/w state does not allow reset
892 */
893 CMD_RESET_DEASSERT = 2,
894 /**
895 * @brief Assert and deassert the module reset
896 *
897 * mrq_response::err is 0 if the operation was successful, or @n
898 * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n
899 * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n
900 * -#BPMP_ENOTSUP if target domain h/w state does not allow reset
901 */
902 CMD_RESET_MODULE = 3,
903 /**
904 * @brief Get the highest reset ID
905 *
906 * mrq_response::err is 0 if the operation was successful, or @n
907 * -#BPMP_ENODEV if no reset domains are supported (number of IDs is 0)
908 */
909 CMD_RESET_GET_MAX_ID = 4,
910
911 /** @brief Not part of ABI and subject to change */
912 CMD_RESET_MAX,
913};
914
915/**
916 * @brief Request with MRQ_RESET
917 *
918 * Used by the sender of an #MRQ_RESET message to request BPMP to
919 * assert or or deassert a given reset line.
920 */
921struct mrq_reset_request {
922 /** @brief Reset action to perform (@ref mrq_reset_commands) */
923 uint32_t cmd;
924 /** @brief Id of the reset to affected */
925 uint32_t reset_id;
926} BPMP_ABI_PACKED;
927
928/**
929 * @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When
930 * this sub-command is not supported, firmware will return -BPMP_EBADCMD
931 * in mrq_response::err.
932 */
933struct cmd_reset_get_max_id_response {
934 /** @brief Max reset id */
935 uint32_t max_id;
936} BPMP_ABI_PACKED;
937
938/**
939 * @brief Response with MRQ_RESET
940 *
941 * Each sub-command supported by @ref mrq_reset_request may return
942 * sub-command-specific data. Some do and some do not as indicated
943 * in the following table
944 *
945 * | sub-command | payload |
946 * |----------------------|------------------|
947 * | CMD_RESET_ASSERT | - |
948 * | CMD_RESET_DEASSERT | - |
949 * | CMD_RESET_MODULE | - |
950 * | CMD_RESET_GET_MAX_ID | reset_get_max_id |
951 */
952struct mrq_reset_response {
953 union {
954 struct cmd_reset_get_max_id_response reset_get_max_id;
955 } BPMP_UNION_ANON;
956} BPMP_ABI_PACKED;
957
958/** @} Reset */
959
960/**
961 * @ingroup MRQ_Codes
962 * @def MRQ_I2C
963 * @brief Issue an i2c transaction
964 *
965 * * Platforms: T186, T194
966 * * Initiators: Any
967 * * Targets: BPMP
968 * * Request Payload: @ref mrq_i2c_request
969 * * Response Payload: @ref mrq_i2c_response
970 *
971 * @addtogroup I2C
972 * @{
973 */
974#define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE (MSG_DATA_MIN_SZ - 12U)
975#define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE (MSG_DATA_MIN_SZ - 4U)
976
977#define SERIALI2C_TEN 0x0010U
978#define SERIALI2C_RD 0x0001U
979#define SERIALI2C_STOP 0x8000U
980#define SERIALI2C_NOSTART 0x4000U
981#define SERIALI2C_REV_DIR_ADDR 0x2000U
982#define SERIALI2C_IGNORE_NAK 0x1000U
983#define SERIALI2C_NO_RD_ACK 0x0800U
984#define SERIALI2C_RECV_LEN 0x0400U
985
986enum {
987 CMD_I2C_XFER = 1
988};
989
990/**
991 * @brief Serializable i2c request
992 *
993 * Instances of this structure are packed (little-endian) into
994 * cmd_i2c_xfer_request::data_buf. Each instance represents a single
995 * transaction (or a portion of a transaction with repeated starts) on
996 * an i2c bus.
997 *
998 * Because these structures are packed, some instances are likely to
999 * be misaligned. Additionally because #data is variable length, it is
1000 * not possible to iterate through a serialized list of these
1001 * structures without inspecting #len in each instance. It may be
1002 * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf
1003 * manually rather than using this structure definition.
1004*/
1005struct serial_i2c_request {
1006 /** @brief I2C slave address */
1007 uint16_t addr;
1008 /** @brief Bitmask of SERIALI2C_ flags */
1009 uint16_t flags;
1010 /** @brief Length of I2C transaction in bytes */
1011 uint16_t len;
1012 /** @brief For write transactions only, #len bytes of data */
1013 uint8_t data[];
1014} BPMP_ABI_PACKED;
1015
1016/**
1017 * @brief Trigger one or more i2c transactions
1018 */
1019struct cmd_i2c_xfer_request {
1020 /**
1021 * @brief Tegra PWR_I2C bus identifier
1022 *
1023 * @cond (bpmp_t234 || bpmp_t239 || bpmp_t194)
1024 * Must be set to 5.
1025 * @endcond (bpmp_t234 || bpmp_t239 || bpmp_t194)
1026 * @cond bpmp_th500
1027 * Must be set to 1.
1028 * @endcond bpmp_th500
1029 *
1030 */
1031 uint32_t bus_id;
1032
1033 /** @brief Count of valid bytes in #data_buf*/
1034 uint32_t data_size;
1035
1036 /** @brief Serialized packed instances of @ref serial_i2c_request*/
1037 uint8_t data_buf[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE];
1038} BPMP_ABI_PACKED;
1039
1040/**
1041 * @brief Container for data read from the i2c bus
1042 *
1043 * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute
1044 * zero or more I2C reads. The data read from the bus is serialized
1045 * into #data_buf.
1046 */
1047struct cmd_i2c_xfer_response {
1048 /** @brief Count of valid bytes in #data_buf*/
1049 uint32_t data_size;
1050 /** @brief I2c read data */
1051 uint8_t data_buf[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE];
1052} BPMP_ABI_PACKED;
1053
1054/**
1055 * @brief Request with #MRQ_I2C
1056 */
1057struct mrq_i2c_request {
1058 /** @brief Always CMD_I2C_XFER (i.e. 1) */
1059 uint32_t cmd;
1060 /** @brief Parameters of the transfer request */
1061 struct cmd_i2c_xfer_request xfer;
1062} BPMP_ABI_PACKED;
1063
1064/**
1065 * @brief Response to #MRQ_I2C
1066 *
1067 * mrq_response:err is
1068 * 0: Success
1069 * -#BPMP_EBADCMD: if mrq_i2c_request::cmd is other than 1
1070 * -#BPMP_EINVAL: if cmd_i2c_xfer_request does not contain correctly formatted request
1071 * -#BPMP_ENODEV: if cmd_i2c_xfer_request::bus_id is not supported by BPMP
1072 * -#BPMP_EACCES: if i2c transaction is not allowed due to firewall rules
1073 * -#BPMP_ETIMEDOUT: if i2c transaction times out
1074 * -#BPMP_ENXIO: if i2c slave device does not reply with ACK to the transaction
1075 * -#BPMP_EAGAIN: if ARB_LOST condition is detected by the i2c controller
1076 * -#BPMP_EIO: any other i2c controller error code than NO_ACK or ARB_LOST
1077 */
1078struct mrq_i2c_response {
1079 struct cmd_i2c_xfer_response xfer;
1080} BPMP_ABI_PACKED;
1081
1082/** @} I2C */
1083
1084/**
1085 * @ingroup MRQ_Codes
1086 * @def MRQ_CLK
1087 * @brief Perform a clock operation
1088 *
1089 * * Platforms: T186, T194
1090 * * Initiators: Any
1091 * * Targets: BPMP
1092 * * Request Payload: @ref mrq_clk_request
1093 * * Response Payload: @ref mrq_clk_response
1094 *
1095 * @addtogroup Clocks
1096 * @{
1097 */
1098enum {
1099 CMD_CLK_GET_RATE = 1,
1100 CMD_CLK_SET_RATE = 2,
1101 CMD_CLK_ROUND_RATE = 3,
1102 CMD_CLK_GET_PARENT = 4,
1103 CMD_CLK_SET_PARENT = 5,
1104 CMD_CLK_IS_ENABLED = 6,
1105 CMD_CLK_ENABLE = 7,
1106 CMD_CLK_DISABLE = 8,
1107/** @cond DEPRECATED */
1108 CMD_CLK_PROPERTIES = 9,
1109 CMD_CLK_POSSIBLE_PARENTS = 10,
1110 CMD_CLK_NUM_POSSIBLE_PARENTS = 11,
1111 CMD_CLK_GET_POSSIBLE_PARENT = 12,
1112 CMD_CLK_RESET_REFCOUNTS = 13,
1113/** @endcond DEPRECATED */
1114 CMD_CLK_GET_ALL_INFO = 14,
1115 CMD_CLK_GET_MAX_CLK_ID = 15,
1116 CMD_CLK_GET_FMAX_AT_VMIN = 16,
1117 CMD_CLK_MAX,
1118};
1119
1120#define BPMP_CLK_HAS_MUX (1U << 0U)
1121#define BPMP_CLK_HAS_SET_RATE (1U << 1U)
1122#define BPMP_CLK_IS_ROOT (1U << 2U)
1123#define BPMP_CLK_IS_VAR_ROOT (1U << 3U)
1124/**
1125 * @brief Protection against rate and parent changes
1126 *
1127 * #MRQ_CLK command #CMD_CLK_SET_RATE or #MRQ_CLK command #CMD_CLK_SET_PARENT will return
1128 * -#BPMP_EACCES.
1129 */
1130#define BPMP_CLK_RATE_PARENT_CHANGE_DENIED (1U << 30)
1131
1132/**
1133 * @brief Protection against state changes
1134 *
1135 * #MRQ_CLK command #CMD_CLK_ENABLE or #MRQ_CLK command #CMD_CLK_DISABLE will return
1136 * -#BPMP_EACCES.
1137 */
1138#define BPMP_CLK_STATE_CHANGE_DENIED (1U << 31)
1139
1140#define MRQ_CLK_NAME_MAXLEN 40U
1141#define MRQ_CLK_MAX_PARENTS 16U
1142
1143/** @private */
1144struct cmd_clk_get_rate_request {
1145 BPMP_ABI_EMPTY
1146} BPMP_ABI_PACKED;
1147
1148struct cmd_clk_get_rate_response {
1149 int64_t rate;
1150} BPMP_ABI_PACKED;
1151
1152struct cmd_clk_set_rate_request {
1153 int32_t unused;
1154 int64_t rate;
1155} BPMP_ABI_PACKED;
1156
1157struct cmd_clk_set_rate_response {
1158 int64_t rate;
1159} BPMP_ABI_PACKED;
1160
1161struct cmd_clk_round_rate_request {
1162 int32_t unused;
1163 int64_t rate;
1164} BPMP_ABI_PACKED;
1165
1166struct cmd_clk_round_rate_response {
1167 int64_t rate;
1168} BPMP_ABI_PACKED;
1169
1170/** @private */
1171struct cmd_clk_get_parent_request {
1172 BPMP_ABI_EMPTY
1173} BPMP_ABI_PACKED;
1174
1175struct cmd_clk_get_parent_response {
1176 uint32_t parent_id;
1177} BPMP_ABI_PACKED;
1178
1179struct cmd_clk_set_parent_request {
1180 uint32_t parent_id;
1181} BPMP_ABI_PACKED;
1182
1183struct cmd_clk_set_parent_response {
1184 uint32_t parent_id;
1185} BPMP_ABI_PACKED;
1186
1187/** @private */
1188struct cmd_clk_is_enabled_request {
1189 BPMP_ABI_EMPTY
1190} BPMP_ABI_PACKED;
1191
1192/**
1193 * @brief Response data to #MRQ_CLK sub-command CMD_CLK_IS_ENABLED
1194 */
1195struct cmd_clk_is_enabled_response {
1196 /**
1197 * @brief The state of the clock that has been successfully
1198 * requested with CMD_CLK_ENABLE or CMD_CLK_DISABLE by the
1199 * master invoking the command earlier.
1200 *
1201 * The state may not reflect the physical state of the clock
1202 * if there are some other masters requesting it to be
1203 * enabled.
1204 *
1205 * Value 0 is disabled, all other values indicate enabled.
1206 */
1207 int32_t state;
1208} BPMP_ABI_PACKED;
1209
1210/** @private */
1211struct cmd_clk_enable_request {
1212 BPMP_ABI_EMPTY
1213} BPMP_ABI_PACKED;
1214
1215/** @private */
1216struct cmd_clk_enable_response {
1217 BPMP_ABI_EMPTY
1218} BPMP_ABI_PACKED;
1219
1220/** @private */
1221struct cmd_clk_disable_request {
1222 BPMP_ABI_EMPTY
1223} BPMP_ABI_PACKED;
1224
1225/** @private */
1226struct cmd_clk_disable_response {
1227 BPMP_ABI_EMPTY
1228} BPMP_ABI_PACKED;
1229
1230/** @cond DEPRECATED */
1231/** @private */
1232struct cmd_clk_properties_request {
1233 BPMP_ABI_EMPTY
1234} BPMP_ABI_PACKED;
1235
1236/** @todo flags need to be spelled out here */
1237struct cmd_clk_properties_response {
1238 uint32_t flags;
1239} BPMP_ABI_PACKED;
1240
1241/** @private */
1242struct cmd_clk_possible_parents_request {
1243 BPMP_ABI_EMPTY
1244} BPMP_ABI_PACKED;
1245
1246struct cmd_clk_possible_parents_response {
1247 uint8_t num_parents;
1248 uint8_t reserved[3];
1249 uint32_t parent_id[MRQ_CLK_MAX_PARENTS];
1250} BPMP_ABI_PACKED;
1251
1252/** @private */
1253struct cmd_clk_num_possible_parents_request {
1254 BPMP_ABI_EMPTY
1255} BPMP_ABI_PACKED;
1256
1257struct cmd_clk_num_possible_parents_response {
1258 uint8_t num_parents;
1259} BPMP_ABI_PACKED;
1260
1261struct cmd_clk_get_possible_parent_request {
1262 uint8_t parent_idx;
1263} BPMP_ABI_PACKED;
1264
1265struct cmd_clk_get_possible_parent_response {
1266 uint32_t parent_id;
1267} BPMP_ABI_PACKED;
1268/** @endcond DEPRECATED */
1269
1270/** @private */
1271struct cmd_clk_get_all_info_request {
1272 BPMP_ABI_EMPTY
1273} BPMP_ABI_PACKED;
1274
1275struct cmd_clk_get_all_info_response {
1276 uint32_t flags;
1277 uint32_t parent;
1278 uint32_t parents[MRQ_CLK_MAX_PARENTS];
1279 uint8_t num_parents;
1280 uint8_t name[MRQ_CLK_NAME_MAXLEN];
1281} BPMP_ABI_PACKED;
1282
1283/** @private */
1284struct cmd_clk_get_max_clk_id_request {
1285 BPMP_ABI_EMPTY
1286} BPMP_ABI_PACKED;
1287
1288struct cmd_clk_get_max_clk_id_response {
1289 uint32_t max_id;
1290} BPMP_ABI_PACKED;
1291
1292/** @private */
1293struct cmd_clk_get_fmax_at_vmin_request {
1294 BPMP_ABI_EMPTY
1295} BPMP_ABI_PACKED;
1296
1297struct cmd_clk_get_fmax_at_vmin_response {
1298 int64_t rate;
1299} BPMP_ABI_PACKED;
1300
1301
1302/**
1303 * @ingroup Clocks
1304 * @brief Request with #MRQ_CLK
1305 *
1306 * Used by the sender of an #MRQ_CLK message to control clocks. The
1307 * clk_request is split into several sub-commands. Some sub-commands
1308 * require no additional data. Others have a sub-command specific
1309 * payload
1310 *
1311 * |sub-command |payload |
1312 * |----------------------------|-----------------------|
1313 * |CMD_CLK_GET_RATE |- |
1314 * |CMD_CLK_SET_RATE |clk_set_rate |
1315 * |CMD_CLK_ROUND_RATE |clk_round_rate |
1316 * |CMD_CLK_GET_PARENT |- |
1317 * |CMD_CLK_SET_PARENT |clk_set_parent |
1318 * |CMD_CLK_IS_ENABLED |- |
1319 * |CMD_CLK_ENABLE |- |
1320 * |CMD_CLK_DISABLE |- |
1321 * |CMD_CLK_GET_ALL_INFO |- |
1322 * |CMD_CLK_GET_MAX_CLK_ID |- |
1323 * |CMD_CLK_GET_FMAX_AT_VMIN |-
1324 * |
1325 *
1326 */
1327
1328/** @cond DEPRECATED
1329 *
1330 * Older versions of firmware also supported following sub-commands:
1331 * |CMD_CLK_PROPERTIES |- |
1332 * |CMD_CLK_POSSIBLE_PARENTS |- |
1333 * |CMD_CLK_NUM_POSSIBLE_PARENTS|- |
1334 * |CMD_CLK_GET_POSSIBLE_PARENT |clk_get_possible_parent|
1335 * |CMD_CLK_RESET_REFCOUNTS |- |
1336 *
1337 * @endcond DEPRECATED */
1338
1339struct mrq_clk_request {
1340 /** @brief Sub-command and clock id concatenated to 32-bit word.
1341 * - bits[31..24] is the sub-cmd.
1342 * - bits[23..0] is the clock id
1343 */
1344 uint32_t cmd_and_id;
1345
1346 union {
1347 /** @private */
1348 struct cmd_clk_get_rate_request clk_get_rate;
1349 struct cmd_clk_set_rate_request clk_set_rate;
1350 struct cmd_clk_round_rate_request clk_round_rate;
1351 /** @private */
1352 struct cmd_clk_get_parent_request clk_get_parent;
1353 struct cmd_clk_set_parent_request clk_set_parent;
1354 /** @private */
1355 struct cmd_clk_enable_request clk_enable;
1356 /** @private */
1357 struct cmd_clk_disable_request clk_disable;
1358 /** @private */
1359 struct cmd_clk_is_enabled_request clk_is_enabled;
1360 /** @cond DEPRECATED */
1361 /** @private */
1362 struct cmd_clk_properties_request clk_properties;
1363 /** @private */
1364 struct cmd_clk_possible_parents_request clk_possible_parents;
1365 /** @private */
1366 struct cmd_clk_num_possible_parents_request clk_num_possible_parents;
1367 struct cmd_clk_get_possible_parent_request clk_get_possible_parent;
1368 /** @endcond DEPRECATED */
1369 /** @private */
1370 struct cmd_clk_get_all_info_request clk_get_all_info;
1371 /** @private */
1372 struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id;
1373 /** @private */
1374 struct cmd_clk_get_fmax_at_vmin_request clk_get_fmax_at_vmin;
1375 } BPMP_UNION_ANON;
1376} BPMP_ABI_PACKED;
1377
1378/**
1379 * @ingroup Clocks
1380 * @brief Response to MRQ_CLK
1381 *
1382 * Each sub-command supported by @ref mrq_clk_request may return
1383 * sub-command-specific data. Some do and some do not as indicated in
1384 * the following table
1385 *
1386 * |sub-command |payload |
1387 * |----------------------------|------------------------|
1388 * |CMD_CLK_GET_RATE |clk_get_rate |
1389 * |CMD_CLK_SET_RATE |clk_set_rate |
1390 * |CMD_CLK_ROUND_RATE |clk_round_rate |
1391 * |CMD_CLK_GET_PARENT |clk_get_parent |
1392 * |CMD_CLK_SET_PARENT |clk_set_parent |
1393 * |CMD_CLK_IS_ENABLED |clk_is_enabled |
1394 * |CMD_CLK_ENABLE |- |
1395 * |CMD_CLK_DISABLE |- |
1396 * |CMD_CLK_GET_ALL_INFO |clk_get_all_info |
1397 * |CMD_CLK_GET_MAX_CLK_ID |clk_get_max_id |
1398 * |CMD_CLK_GET_FMAX_AT_VMIN |clk_get_fmax_at_vmin |
1399 *
1400 */
1401
1402/** @cond DEPRECATED
1403 *
1404 * Older versions of firmware also supported following sub-commands:
1405 * |CMD_CLK_PROPERTIES |clk_properties |
1406 * |CMD_CLK_POSSIBLE_PARENTS |clk_possible_parents |
1407 * |CMD_CLK_NUM_POSSIBLE_PARENTS|clk_num_possible_parents|
1408 * |CMD_CLK_GET_POSSIBLE_PARENT |clk_get_possible_parents|
1409 * |CMD_CLK_RESET_REFCOUNTS |- |
1410 *
1411 * @endcond DEPRECATED */
1412
1413struct mrq_clk_response {
1414 union {
1415 struct cmd_clk_get_rate_response clk_get_rate;
1416 struct cmd_clk_set_rate_response clk_set_rate;
1417 struct cmd_clk_round_rate_response clk_round_rate;
1418 struct cmd_clk_get_parent_response clk_get_parent;
1419 struct cmd_clk_set_parent_response clk_set_parent;
1420 /** @private */
1421 struct cmd_clk_enable_response clk_enable;
1422 /** @private */
1423 struct cmd_clk_disable_response clk_disable;
1424 struct cmd_clk_is_enabled_response clk_is_enabled;
1425 /** @cond DEPRECATED */
1426 struct cmd_clk_properties_response clk_properties;
1427 struct cmd_clk_possible_parents_response clk_possible_parents;
1428 struct cmd_clk_num_possible_parents_response clk_num_possible_parents;
1429 struct cmd_clk_get_possible_parent_response clk_get_possible_parent;
1430 /** @endcond DEPRECATED */
1431 struct cmd_clk_get_all_info_response clk_get_all_info;
1432 struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id;
1433 struct cmd_clk_get_fmax_at_vmin_response clk_get_fmax_at_vmin;
1434 } BPMP_UNION_ANON;
1435} BPMP_ABI_PACKED;
1436
1437/** @} Clocks */
1438
1439/**
1440 * @ingroup MRQ_Codes
1441 * @def MRQ_QUERY_ABI
1442 * @brief Check if an MRQ is implemented
1443 *
1444 * * Platforms: All
1445 * * Initiators: Any
1446 * * Targets: Any except DMCE
1447 * * Request Payload: @ref mrq_query_abi_request
1448 * * Response Payload: @ref mrq_query_abi_response
1449 */
1450
1451/**
1452 * @ingroup ABI_info
1453 * @brief Request with MRQ_QUERY_ABI
1454 *
1455 * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported
1456 * by the recipient.
1457 */
1458struct mrq_query_abi_request {
1459 /** @brief MRQ code to query */
1460 uint32_t mrq;
1461} BPMP_ABI_PACKED;
1462
1463/**
1464 * @ingroup ABI_info
1465 * @brief Response to MRQ_QUERY_ABI
1466 *
1467 * @note mrq_response::err of 0 indicates that the query was
1468 * successful, not that the MRQ itself is supported!
1469 */
1470struct mrq_query_abi_response {
1471 /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */
1472 int32_t status;
1473} BPMP_ABI_PACKED;
1474
1475/**
1476 *
1477 * @ingroup MRQ_Codes
1478 * @def MRQ_PG
1479 * @brief Control power-gating state of a partition. In contrast to
1480 * MRQ_PG_UPDATE_STATE, operations that change the power partition
1481 * state are NOT reference counted
1482 *
1483 * @cond (bpmp_t194 || bpmp_t186)
1484 * @note On T194 and earlier BPMP-FW forcefully turns off some partitions as
1485 * part of SC7 entry because their state cannot be adequately restored on exit.
1486 * Therefore, it is recommended to power off all domains via MRQ_PG prior to SC7
1487 * entry.
1488 * See @ref bpmp_pdomain_ids for further detail.
1489 * @endcond (bpmp_t194 || bpmp_t186)
1490 *
1491 * * Platforms: T186, T194
1492 * * Initiators: Any
1493 * * Targets: BPMP
1494 * * Request Payload: @ref mrq_pg_request
1495 * * Response Payload: @ref mrq_pg_response
1496 *
1497 * @addtogroup Powergating
1498 * @{
1499 */
1500enum mrq_pg_cmd {
1501 /**
1502 * @brief Check whether the BPMP driver supports the specified
1503 * request type
1504 *
1505 * mrq_response::err is 0 if the specified request is
1506 * supported and -#BPMP_ENODEV otherwise.
1507 */
1508 CMD_PG_QUERY_ABI = 0,
1509
1510 /**
1511 * @brief Set the current state of specified power domain. The
1512 * possible values for power domains are defined in enum
1513 * pg_states
1514 *
1515 * mrq_response:err is
1516 * 0: Success
1517 * -#BPMP_EINVAL: Invalid request parameters
1518 */
1519 CMD_PG_SET_STATE = 1,
1520
1521 /**
1522 * @brief Get the current state of specified power domain. The
1523 * possible values for power domains are defined in enum
1524 * pg_states
1525 *
1526 * mrq_response:err is
1527 * 0: Success
1528 * -#BPMP_EINVAL: Invalid request parameters
1529 */
1530 CMD_PG_GET_STATE = 2,
1531
1532 /**
1533 * @brief Get the name string of specified power domain id.
1534 *
1535 * mrq_response:err is
1536 * 0: Success
1537 * -#BPMP_EINVAL: Invalid request parameters
1538 */
1539 CMD_PG_GET_NAME = 3,
1540
1541
1542 /**
1543 * @brief Get the highest power domain id in the system. Not
1544 * all IDs between 0 and max_id are valid IDs.
1545 *
1546 * mrq_response:err is
1547 * 0: Success
1548 * -#BPMP_EINVAL: Invalid request parameters
1549 */
1550 CMD_PG_GET_MAX_ID = 4,
1551};
1552
1553#define MRQ_PG_NAME_MAXLEN 40
1554
1555enum pg_states {
1556 /** @brief Power domain is OFF */
1557 PG_STATE_OFF = 0,
1558 /** @brief Power domain is ON */
1559 PG_STATE_ON = 1,
1560 /**
1561 * @brief a legacy state where power domain and the clock
1562 * associated to the domain are ON.
1563 * This state is only supported in T186, and the use of it is
1564 * deprecated.
1565 */
1566 PG_STATE_RUNNING = 2,
1567};
1568
1569struct cmd_pg_query_abi_request {
1570 /** @ref mrq_pg_cmd */
1571 uint32_t type;
1572} BPMP_ABI_PACKED;
1573
1574struct cmd_pg_set_state_request {
1575 /** @ref pg_states */
1576 uint32_t state;
1577} BPMP_ABI_PACKED;
1578
1579/**
1580 * @brief Response data to #MRQ_PG sub command #CMD_PG_GET_STATE
1581 */
1582struct cmd_pg_get_state_response {
1583 /**
1584 * @brief The state of the power partition that has been
1585 * succesfuly requested by the master earlier using #MRQ_PG
1586 * command #CMD_PG_SET_STATE.
1587 *
1588 * The state may not reflect the physical state of the power
1589 * partition if there are some other masters requesting it to
1590 * be enabled.
1591 *
1592 * See @ref pg_states for possible values
1593 */
1594 uint32_t state;
1595} BPMP_ABI_PACKED;
1596
1597struct cmd_pg_get_name_response {
1598 uint8_t name[MRQ_PG_NAME_MAXLEN];
1599} BPMP_ABI_PACKED;
1600
1601struct cmd_pg_get_max_id_response {
1602 uint32_t max_id;
1603} BPMP_ABI_PACKED;
1604
1605/**
1606 * @brief Request with #MRQ_PG
1607 *
1608 * Used by the sender of an #MRQ_PG message to control power
1609 * partitions. The pg_request is split into several sub-commands. Some
1610 * sub-commands require no additional data. Others have a sub-command
1611 * specific payload
1612 *
1613 * |sub-command |payload |
1614 * |----------------------------|-----------------------|
1615 * |CMD_PG_QUERY_ABI | query_abi |
1616 * |CMD_PG_SET_STATE | set_state |
1617 * |CMD_PG_GET_STATE | - |
1618 * |CMD_PG_GET_NAME | - |
1619 * |CMD_PG_GET_MAX_ID | - |
1620 *
1621 */
1622struct mrq_pg_request {
1623 uint32_t cmd;
1624 uint32_t id;
1625 union {
1626 struct cmd_pg_query_abi_request query_abi;
1627 struct cmd_pg_set_state_request set_state;
1628 } BPMP_UNION_ANON;
1629} BPMP_ABI_PACKED;
1630
1631/**
1632 * @brief Response to MRQ_PG
1633 *
1634 * Each sub-command supported by @ref mrq_pg_request may return
1635 * sub-command-specific data. Some do and some do not as indicated in
1636 * the following table
1637 *
1638 * |sub-command |payload |
1639 * |----------------------------|-----------------------|
1640 * |CMD_PG_QUERY_ABI | - |
1641 * |CMD_PG_SET_STATE | - |
1642 * |CMD_PG_GET_STATE | get_state |
1643 * |CMD_PG_GET_NAME | get_name |
1644 * |CMD_PG_GET_MAX_ID | get_max_id |
1645 */
1646struct mrq_pg_response {
1647 union {
1648 struct cmd_pg_get_state_response get_state;
1649 struct cmd_pg_get_name_response get_name;
1650 struct cmd_pg_get_max_id_response get_max_id;
1651 } BPMP_UNION_ANON;
1652} BPMP_ABI_PACKED;
1653
1654/** @} Powergating */
1655
1656/**
1657 * @ingroup MRQ_Codes
1658 * @def MRQ_THERMAL
1659 * @brief Interact with BPMP thermal framework
1660 *
1661 * * Platforms: T186, T194
1662 * * Initiators: Any
1663 * * Targets: Any
1664 * * Request Payload: TODO
1665 * * Response Payload: TODO
1666 *
1667 * @addtogroup Thermal
1668 *
1669 * The BPMP firmware includes a thermal framework. Drivers within the
1670 * bpmp firmware register with the framework to provide thermal
1671 * zones. Each thermal zone corresponds to an entity whose temperature
1672 * can be measured. The framework also has a notion of trip points. A
1673 * trip point consists of a thermal zone id, a temperature, and a
1674 * callback routine. The framework invokes the callback when the zone
1675 * hits the indicated temperature. The BPMP firmware uses this thermal
1676 * framework interally to implement various temperature-dependent
1677 * functions.
1678 *
1679 * Software on the CPU can use #MRQ_THERMAL (with payload @ref
1680 * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal
1681 * framework. The CPU must It can query the number of supported zones,
1682 * query zone temperatures, and set trip points.
1683 *
1684 * When a trip point set by the CPU gets crossed, BPMP firmware issues
1685 * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a
1686 * payload of @ref mrq_thermal_bpmp_to_host_request.
1687 * @{
1688 */
1689enum mrq_thermal_host_to_bpmp_cmd {
1690 /**
1691 * @brief Check whether the BPMP driver supports the specified
1692 * request type.
1693 *
1694 * Host needs to supply request parameters.
1695 *
1696 * mrq_response::err is 0 if the specified request is
1697 * supported and -#BPMP_ENODEV otherwise.
1698 */
1699 CMD_THERMAL_QUERY_ABI = 0,
1700
1701 /**
1702 * @brief Get the current temperature of the specified zone.
1703 *
1704 * Host needs to supply request parameters.
1705 *
1706 * mrq_response::err is
1707 * * 0: Temperature query succeeded.
1708 * * -#BPMP_EINVAL: Invalid request parameters.
1709 * * -#BPMP_ENOENT: No driver registered for thermal zone..
1710 * * -#BPMP_EFAULT: Problem reading temperature measurement.
1711 */
1712 CMD_THERMAL_GET_TEMP = 1,
1713
1714 /**
1715 * @brief Enable or disable and set the lower and upper
1716 * thermal limits for a thermal trip point. Each zone has
1717 * one trip point.
1718 *
1719 * Host needs to supply request parameters. Once the
1720 * temperature hits a trip point, the BPMP will send a message
1721 * to the CPU having MRQ=MRQ_THERMAL and
1722 * type=CMD_THERMAL_HOST_TRIP_REACHED
1723 *
1724 * mrq_response::err is
1725 * * 0: Trip successfully set.
1726 * * -#BPMP_EINVAL: Invalid request parameters.
1727 * * -#BPMP_ENOENT: No driver registered for thermal zone.
1728 * * -#BPMP_EFAULT: Problem setting trip point.
1729 */
1730 CMD_THERMAL_SET_TRIP = 2,
1731
1732 /**
1733 * @brief Get the number of supported thermal zones.
1734 *
1735 * No request parameters required.
1736 *
1737 * mrq_response::err is always 0, indicating success.
1738 */
1739 CMD_THERMAL_GET_NUM_ZONES = 3,
1740
1741 /**
1742 * @brief Get the thermtrip of the specified zone.
1743 *
1744 * Host needs to supply request parameters.
1745 *
1746 * mrq_response::err is
1747 * * 0: Valid zone information returned.
1748 * * -#BPMP_EINVAL: Invalid request parameters.
1749 * * -#BPMP_ENOENT: No driver registered for thermal zone.
1750 * * -#BPMP_ERANGE if thermtrip is invalid or disabled.
1751 * * -#BPMP_EFAULT: Problem reading zone information.
1752 */
1753 CMD_THERMAL_GET_THERMTRIP = 4,
1754
1755 /** @brief: number of supported host-to-bpmp commands. May
1756 * increase in future
1757 */
1758 CMD_THERMAL_HOST_TO_BPMP_NUM
1759};
1760
1761enum mrq_thermal_bpmp_to_host_cmd {
1762 /**
1763 * @brief Indication that the temperature for a zone has
1764 * exceeded the range indicated in the thermal trip point
1765 * for the zone.
1766 *
1767 * BPMP needs to supply request parameters. Host only needs to
1768 * acknowledge.
1769 */
1770 CMD_THERMAL_HOST_TRIP_REACHED = 100,
1771
1772 /** @brief: number of supported bpmp-to-host commands. May
1773 * increase in future
1774 */
1775 CMD_THERMAL_BPMP_TO_HOST_NUM
1776};
1777
1778/*
1779 * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI
1780 *
1781 * zone: Request type for which to check existence.
1782 */
1783struct cmd_thermal_query_abi_request {
1784 uint32_t type;
1785} BPMP_ABI_PACKED;
1786
1787/*
1788 * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP
1789 *
1790 * zone: Number of thermal zone.
1791 */
1792struct cmd_thermal_get_temp_request {
1793 uint32_t zone;
1794} BPMP_ABI_PACKED;
1795
1796/*
1797 * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP
1798 *
1799 * error: 0 if request succeeded.
1800 * -BPMP_EINVAL if request parameters were invalid.
1801 * -BPMP_ENOENT if no driver was registered for the specified thermal zone.
1802 * -BPMP_EFAULT for other thermal zone driver errors.
1803 * temp: Current temperature in millicelsius.
1804 */
1805struct cmd_thermal_get_temp_response {
1806 int32_t temp;
1807} BPMP_ABI_PACKED;
1808
1809/*
1810 * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP
1811 *
1812 * zone: Number of thermal zone.
1813 * low: Temperature of lower trip point in millicelsius
1814 * high: Temperature of upper trip point in millicelsius
1815 * enabled: 1 to enable trip point, 0 to disable trip point
1816 */
1817struct cmd_thermal_set_trip_request {
1818 uint32_t zone;
1819 int32_t low;
1820 int32_t high;
1821 uint32_t enabled;
1822} BPMP_ABI_PACKED;
1823
1824/*
1825 * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED
1826 *
1827 * zone: Number of thermal zone where trip point was reached.
1828 */
1829struct cmd_thermal_host_trip_reached_request {
1830 uint32_t zone;
1831} BPMP_ABI_PACKED;
1832
1833/*
1834 * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES
1835 *
1836 * num: Number of supported thermal zones. The thermal zones are indexed
1837 * starting from zero.
1838 */
1839struct cmd_thermal_get_num_zones_response {
1840 uint32_t num;
1841} BPMP_ABI_PACKED;
1842
1843/*
1844 * Host->BPMP request data for request type CMD_THERMAL_GET_THERMTRIP
1845 *
1846 * zone: Number of thermal zone.
1847 */
1848struct cmd_thermal_get_thermtrip_request {
1849 uint32_t zone;
1850} BPMP_ABI_PACKED;
1851
1852/*
1853 * BPMP->Host reply data for request CMD_THERMAL_GET_THERMTRIP
1854 *
1855 * thermtrip: HW shutdown temperature in millicelsius.
1856 */
1857struct cmd_thermal_get_thermtrip_response {
1858 int32_t thermtrip;
1859} BPMP_ABI_PACKED;
1860
1861/*
1862 * Host->BPMP request data.
1863 *
1864 * Reply type is union mrq_thermal_bpmp_to_host_response.
1865 *
1866 * type: Type of request. Values listed in enum mrq_thermal_type.
1867 * data: Request type specific parameters.
1868 */
1869struct mrq_thermal_host_to_bpmp_request {
1870 uint32_t type;
1871 union {
1872 struct cmd_thermal_query_abi_request query_abi;
1873 struct cmd_thermal_get_temp_request get_temp;
1874 struct cmd_thermal_set_trip_request set_trip;
1875 struct cmd_thermal_get_thermtrip_request get_thermtrip;
1876 } BPMP_UNION_ANON;
1877} BPMP_ABI_PACKED;
1878
1879/*
1880 * BPMP->Host request data.
1881 *
1882 * type: Type of request. Values listed in enum mrq_thermal_type.
1883 * data: Request type specific parameters.
1884 */
1885struct mrq_thermal_bpmp_to_host_request {
1886 uint32_t type;
1887 union {
1888 struct cmd_thermal_host_trip_reached_request host_trip_reached;
1889 } BPMP_UNION_ANON;
1890} BPMP_ABI_PACKED;
1891
1892/*
1893 * Data in reply to a Host->BPMP request.
1894 */
1895union mrq_thermal_bpmp_to_host_response {
1896 struct cmd_thermal_get_temp_response get_temp;
1897 struct cmd_thermal_get_thermtrip_response get_thermtrip;
1898 struct cmd_thermal_get_num_zones_response get_num_zones;
1899} BPMP_ABI_PACKED;
1900
1901/** @} Thermal */
1902
1903/**
1904 * @ingroup MRQ_Codes
1905 * @def MRQ_OC_STATUS
1906 * @brief Query over current status
1907 *
1908 * * Platforms: T234
1909 * @cond bpmp_t234
1910 * * Initiators: CCPLEX
1911 * * Targets: BPMP
1912 * * Request Payload: N/A
1913 * * Response Payload: @ref mrq_oc_status_response
1914 *
1915 * @addtogroup OC_status
1916 * @{
1917 */
1918
1919#define OC_STATUS_MAX_SIZE 24U
1920
1921/*
1922 * @brief Response to #MRQ_OC_STATUS
1923 *
1924 * throt_en: Value for each OC alarm where zero signifies throttle is
1925 * disabled, and non-zero throttle is enabled.
1926 * event_cnt: Total number of OC events for each OC alarm.
1927 *
1928 * mrq_response::err is 0 if the operation was successful and
1929 * -#BPMP_ENODEV otherwise.
1930 */
1931struct mrq_oc_status_response {
1932 uint8_t throt_en[OC_STATUS_MAX_SIZE];
1933 uint32_t event_cnt[OC_STATUS_MAX_SIZE];
1934} BPMP_ABI_PACKED;
1935
1936/** @} OC_status */
1937/** @endcond bpmp_t234 */
1938
1939/**
1940 * @ingroup MRQ_Codes
1941 * @def MRQ_CPU_VHINT
1942 * @brief Query CPU voltage hint data
1943 *
1944 * * Platforms: T186
1945 * @cond bpmp_t186
1946 * * Initiators: CCPLEX
1947 * * Targets: BPMP
1948 * * Request Payload: @ref mrq_cpu_vhint_request
1949 * * Response Payload: N/A
1950 *
1951 * @addtogroup Vhint
1952 * @{
1953 */
1954
1955/**
1956 * @brief Request with #MRQ_CPU_VHINT
1957 *
1958 * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data
1959 * from BPMP to memory space pointed by #addr. CCPLEX is responsible
1960 * to allocate sizeof(cpu_vhint_data) sized block of memory and
1961 * appropriately map it for BPMP before sending the request.
1962 */
1963struct mrq_cpu_vhint_request {
1964 /** @brief IOVA address for the #cpu_vhint_data */
1965 uint32_t addr;
1966 /** @brief ID of the cluster whose data is requested */
1967 uint32_t cluster_id;
1968} BPMP_ABI_PACKED;
1969
1970/**
1971 * @brief Description of the CPU v/f relation
1972 *
1973 * Used by #MRQ_CPU_VHINT call to carry data pointed by
1974 * #mrq_cpu_vhint_request::addr
1975 */
1976struct cpu_vhint_data {
1977 uint32_t ref_clk_hz; /**< reference frequency in Hz */
1978 uint16_t pdiv; /**< post divider value */
1979 uint16_t mdiv; /**< input divider value */
1980 uint16_t ndiv_max; /**< fMAX expressed with max NDIV value */
1981 /** table of ndiv values as a function of vINDEX (voltage index) */
1982 uint16_t ndiv[80];
1983 /** minimum allowed NDIV value */
1984 uint16_t ndiv_min;
1985 /** minimum allowed voltage hint value (as in vINDEX) */
1986 uint16_t vfloor;
1987 /** maximum allowed voltage hint value (as in vINDEX) */
1988 uint16_t vceil;
1989 /** post-multiplier for vindex value */
1990 uint16_t vindex_mult;
1991 /** post-divider for vindex value */
1992 uint16_t vindex_div;
1993 /** reserved for future use */
1994 uint16_t reserved[328];
1995} BPMP_ABI_PACKED;
1996
1997/** @} Vhint */
1998/** @endcond bpmp_t186 */
1999
2000/**
2001 * @ingroup MRQ_Codes
2002 * @def MRQ_ABI_RATCHET
2003 * @brief ABI ratchet value query
2004 *
2005 * * Platforms: T186, T194
2006 * * Initiators: Any
2007 * * Targets: BPMP
2008 * * Request Payload: @ref mrq_abi_ratchet_request
2009 * * Response Payload: @ref mrq_abi_ratchet_response
2010 * @addtogroup ABI_info
2011 * @{
2012 */
2013
2014/**
2015 * @brief An ABI compatibility mechanism
2016 *
2017 * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future
2018 * revision of this header file.
2019 * 1. That future revision deprecates some MRQ
2020 * 2. That future revision introduces a breaking change to an existing
2021 * MRQ or
2022 * 3. A bug is discovered in an existing implementation of the BPMP-FW
2023 * (or possibly one of its clients) which warrants deprecating that
2024 * implementation.
2025 */
2026#define BPMP_ABI_RATCHET_VALUE 3
2027
2028/**
2029 * @brief Request with #MRQ_ABI_RATCHET.
2030 *
2031 * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header
2032 * against which the requester was compiled.
2033 *
2034 * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may
2035 * reply with mrq_response::err = -#BPMP_ERANGE to indicate that
2036 * BPMP-FW cannot interoperate correctly with the requester. Requester
2037 * should cease further communication with BPMP.
2038 *
2039 * Otherwise, err shall be 0.
2040 */
2041struct mrq_abi_ratchet_request {
2042 /** @brief Requester's ratchet value */
2043 uint16_t ratchet;
2044};
2045
2046/**
2047 * @brief Response to #MRQ_ABI_RATCHET
2048 *
2049 * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header
2050 * against which BPMP firwmare was compiled.
2051 *
2052 * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE,
2053 * the requster must either interoperate with BPMP according to an ABI
2054 * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease
2055 * communication with BPMP.
2056 *
2057 * If mrq_response::err is 0 and ratchet is greater than or equal to the
2058 * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue
2059 * normal operation.
2060 */
2061struct mrq_abi_ratchet_response {
2062 /** @brief BPMP's ratchet value */
2063 uint16_t ratchet;
2064};
2065
2066/** @} ABI_info */
2067
2068/**
2069 * @ingroup MRQ_Codes
2070 * @def MRQ_EMC_DVFS_LATENCY
2071 * @brief Query frequency dependent EMC DVFS latency
2072 *
2073 * * Platforms: T186, T194, T234
2074 * * Initiators: CCPLEX
2075 * * Targets: BPMP
2076 * * Request Payload: N/A
2077 * * Response Payload: @ref mrq_emc_dvfs_latency_response
2078 * @addtogroup EMC
2079 * @{
2080 */
2081
2082/**
2083 * @brief Used by @ref mrq_emc_dvfs_latency_response
2084 */
2085struct emc_dvfs_latency {
2086 /** @brief EMC DVFS node frequency in kHz */
2087 uint32_t freq;
2088 /** @brief EMC DVFS latency in nanoseconds */
2089 uint32_t latency;
2090} BPMP_ABI_PACKED;
2091
2092#define EMC_DVFS_LATENCY_MAX_SIZE 14
2093/**
2094 * @brief Response to #MRQ_EMC_DVFS_LATENCY
2095 */
2096struct mrq_emc_dvfs_latency_response {
2097 /** @brief The number valid entries in #pairs */
2098 uint32_t num_pairs;
2099 /** @brief EMC DVFS node <frequency, latency> information */
2100 struct emc_dvfs_latency pairs[EMC_DVFS_LATENCY_MAX_SIZE];
2101} BPMP_ABI_PACKED;
2102
2103/** @} EMC */
2104
2105/**
2106 * @ingroup MRQ_Codes
2107 * @def MRQ_EMC_DVFS_EMCHUB
2108 * @brief Query EMC HUB frequencies
2109 *
2110 * * Platforms: T234 onwards
2111 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
2112 * * Initiators: CCPLEX
2113 * * Targets: BPMP
2114 * * Request Payload: N/A
2115 * * Response Payload: @ref mrq_emc_dvfs_emchub_response
2116 * @addtogroup EMC
2117 * @{
2118 */
2119
2120/**
2121 * @brief Used by @ref mrq_emc_dvfs_emchub_response
2122 */
2123struct emc_dvfs_emchub {
2124 /** @brief EMC DVFS node frequency in kHz */
2125 uint32_t freq;
2126 /** @brief EMC HUB frequency in kHz */
2127 uint32_t hub_freq;
2128} BPMP_ABI_PACKED;
2129
2130#define EMC_DVFS_EMCHUB_MAX_SIZE EMC_DVFS_LATENCY_MAX_SIZE
2131/**
2132 * @brief Response to #MRQ_EMC_DVFS_EMCHUB
2133 */
2134struct mrq_emc_dvfs_emchub_response {
2135 /** @brief The number valid entries in #pairs */
2136 uint32_t num_pairs;
2137 /** @brief EMC DVFS node <frequency, hub frequency> information */
2138 struct emc_dvfs_emchub pairs[EMC_DVFS_EMCHUB_MAX_SIZE];
2139} BPMP_ABI_PACKED;
2140
2141/** @} EMC */
2142/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */
2143
2144/**
2145 * @ingroup MRQ_Codes
2146 * @def MRQ_EMC_DISP_RFL
2147 * @brief Set EMC display RFL handshake mode of operations
2148 *
2149 * * Platforms: T234 onwards
2150 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
2151 * * Initiators: CCPLEX
2152 * * Targets: BPMP
2153 * * Request Payload: @ref mrq_emc_disp_rfl_request
2154 * * Response Payload: N/A
2155 *
2156 * @addtogroup EMC
2157 * @{
2158 */
2159
2160enum mrq_emc_disp_rfl_mode {
2161 /** @brief EMC display RFL handshake disabled */
2162 EMC_DISP_RFL_MODE_DISABLED = 0,
2163 /** @brief EMC display RFL handshake enabled */
2164 EMC_DISP_RFL_MODE_ENABLED = 1,
2165};
2166
2167/**
2168 * @ingroup EMC
2169 * @brief Request with #MRQ_EMC_DISP_RFL
2170 *
2171 * Used by the sender of an #MRQ_EMC_DISP_RFL message to
2172 * request the mode of EMC display RFL handshake.
2173 *
2174 * mrq_response::err is
2175 * * 0: RFL mode is set successfully
2176 * * -#BPMP_EINVAL: invalid mode requested
2177 * * -#BPMP_ENOSYS: RFL handshake is not supported
2178 * * -#BPMP_EACCES: Permission denied
2179 * * -#BPMP_ENODEV: if disp rfl mrq is not supported by BPMP-FW
2180 */
2181struct mrq_emc_disp_rfl_request {
2182 /** @brief EMC display RFL mode (@ref mrq_emc_disp_rfl_mode) */
2183 uint32_t mode;
2184} BPMP_ABI_PACKED;
2185
2186/** @} EMC */
2187/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */
2188
2189/**
2190 * @ingroup MRQ_Codes
2191 * @def MRQ_BWMGR
2192 * @brief bwmgr requests
2193 *
2194 * * Platforms: T234 onwards
2195 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
2196 * * Initiators: CCPLEX
2197 * * Targets: BPMP
2198 * * Request Payload: @ref mrq_bwmgr_request
2199 * * Response Payload: @ref mrq_bwmgr_response
2200 *
2201 * @addtogroup BWMGR
2202 *
2203 * @{
2204 */
2205
2206enum mrq_bwmgr_cmd {
2207 /**
2208 * @brief Check whether the BPMP driver supports the specified
2209 * request type
2210 *
2211 * mrq_response::err is 0 if the specified request is
2212 * supported and -#BPMP_ENODEV otherwise.
2213 */
2214 CMD_BWMGR_QUERY_ABI = 0,
2215
2216 /**
2217 * @brief Determine dram rate to satisfy iso/niso bw requests
2218 *
2219 * mrq_response::err is
2220 * * 0: calc_rate succeeded.
2221 * * -#BPMP_EINVAL: Invalid request parameters.
2222 * * -#BPMP_ENOTSUP: Requested bw is not available.
2223 */
2224 CMD_BWMGR_CALC_RATE = 1
2225};
2226
2227/*
2228 * request data for request type CMD_BWMGR_QUERY_ABI
2229 *
2230 * type: Request type for which to check existence.
2231 */
2232struct cmd_bwmgr_query_abi_request {
2233 uint32_t type;
2234} BPMP_ABI_PACKED;
2235
2236/**
2237 * @brief Used by @ref cmd_bwmgr_calc_rate_request
2238 */
2239struct iso_req {
2240 /* @brief bwmgr client ID @ref bpmp_bwmgr_ids */
2241 uint32_t id;
2242 /* @brief bw in kBps requested by client */
2243 uint32_t iso_bw;
2244} BPMP_ABI_PACKED;
2245
2246#define MAX_ISO_CLIENTS 13U
2247/*
2248 * request data for request type CMD_BWMGR_CALC_RATE
2249 */
2250struct cmd_bwmgr_calc_rate_request {
2251 /* @brief total bw in kBps requested by all niso clients */
2252 uint32_t sum_niso_bw;
2253 /* @brief The number of iso clients */
2254 uint32_t num_iso_clients;
2255 /* @brief iso_req <id, iso_bw> information */
2256 struct iso_req isobw_reqs[MAX_ISO_CLIENTS];
2257} BPMP_ABI_PACKED;
2258
2259/*
2260 * response data for request type CMD_BWMGR_CALC_RATE
2261 *
2262 * iso_rate_min: min dram data clk rate in kHz to satisfy all iso bw reqs
2263 * total_rate_min: min dram data clk rate in kHz to satisfy all bw reqs
2264 */
2265struct cmd_bwmgr_calc_rate_response {
2266 uint32_t iso_rate_min;
2267 uint32_t total_rate_min;
2268} BPMP_ABI_PACKED;
2269
2270/*
2271 * @brief Request with #MRQ_BWMGR
2272 *
2273 *
2274 * |sub-command |payload |
2275 * |----------------------------|------------------------------|
2276 * |CMD_BWMGR_QUERY_ABI | cmd_bwmgr_query_abi_request |
2277 * |CMD_BWMGR_CALC_RATE | cmd_bwmgr_calc_rate_request |
2278 *
2279 */
2280struct mrq_bwmgr_request {
2281 uint32_t cmd;
2282 union {
2283 struct cmd_bwmgr_query_abi_request query_abi;
2284 struct cmd_bwmgr_calc_rate_request bwmgr_rate_req;
2285 } BPMP_UNION_ANON;
2286} BPMP_ABI_PACKED;
2287
2288/*
2289 * @brief Response to MRQ_BWMGR
2290 *
2291 * |sub-command |payload |
2292 * |----------------------------|------------------------------|
2293 * |CMD_BWMGR_CALC_RATE | cmd_bwmgr_calc_rate_response |
2294 */
2295struct mrq_bwmgr_response {
2296 union {
2297 struct cmd_bwmgr_calc_rate_response bwmgr_rate_resp;
2298 } BPMP_UNION_ANON;
2299} BPMP_ABI_PACKED;
2300
2301/** @} BWMGR */
2302/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */
2303
2304/**
2305 * @ingroup MRQ_Codes
2306 * @def MRQ_BWMGR_INT
2307 * @brief bpmp-integrated bwmgr requests
2308 *
2309 * * Platforms: T234 onwards
2310 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
2311 * * Initiators: CCPLEX
2312 * * Targets: BPMP
2313 * * Request Payload: @ref mrq_bwmgr_int_request
2314 * * Response Payload: @ref mrq_bwmgr_int_response
2315 *
2316 * @addtogroup BWMGR_INT
2317 * @{
2318 */
2319
2320enum mrq_bwmgr_int_cmd {
2321 /**
2322 * @brief Check whether the BPMP-FW supports the specified
2323 * request type
2324 *
2325 * mrq_response::err is 0 if the specified request is
2326 * supported and -#BPMP_ENODEV otherwise.
2327 */
2328 CMD_BWMGR_INT_QUERY_ABI = 1,
2329
2330 /**
2331 * @brief Determine and set dram rate to satisfy iso/niso bw request
2332 *
2333 * mrq_response::err is
2334 * * 0: request succeeded.
2335 * * -#BPMP_EINVAL: Invalid request parameters.
2336 * set_frequency in @ref cmd_bwmgr_int_calc_and_set_response
2337 * will not be set.
2338 * * -#BPMP_ENOTSUP: Requested bw is not available.
2339 * set_frequency in @ref cmd_bwmgr_int_calc_and_set_response
2340 * will be current dram-clk rate.
2341 */
2342 CMD_BWMGR_INT_CALC_AND_SET = 2,
2343
2344 /**
2345 * @brief Set a max DRAM frequency for the bandwidth-manager
2346 *
2347 * mrq_response::err is
2348 * * 0: request succeeded.
2349 * * -#BPMP_ENOTSUP: Requested cap frequency is not possible.
2350 */
2351 CMD_BWMGR_INT_CAP_SET = 3
2352};
2353
2354/*
2355 * request structure for request type CMD_BWMGR_QUERY_ABI
2356 *
2357 * type: Request type for which to check existence.
2358 */
2359struct cmd_bwmgr_int_query_abi_request {
2360 /* @brief request type determined by @ref mrq_bwmgr_int_cmd */
2361 uint32_t type;
2362} BPMP_ABI_PACKED;
2363
2364/**
2365 * @defgroup bwmgr_int_unit_type BWMGR_INT floor unit-types
2366 * @addtogroup bwmgr_int_unit_type
2367 * @{
2368 */
2369/** @brief kilobytes per second unit-type */
2370#define BWMGR_INT_UNIT_KBPS 0U
2371/** @brief kilohertz unit-type */
2372#define BWMGR_INT_UNIT_KHZ 1U
2373
2374/** @} bwmgr_int_unit_type */
2375
2376/*
2377 * request data for request type CMD_BWMGR_INT_CALC_AND_SET
2378 */
2379struct cmd_bwmgr_int_calc_and_set_request {
2380 /* @brief bwmgr client ID @ref bpmp_bwmgr_ids */
2381 uint32_t client_id;
2382 /* @brief average niso bw usage in kBps requested by client. */
2383 uint32_t niso_bw;
2384 /*
2385 * @brief average iso bw usage in kBps requested by client.
2386 * Value is ignored if client is niso. Determined by client_id.
2387 */
2388 uint32_t iso_bw;
2389 /*
2390 * @brief memory clock floor requested by client.
2391 * Unit determined by floor_unit.
2392 */
2393 uint32_t mc_floor;
2394 /*
2395 * @brief toggle to determine the unit-type of floor value.
2396 * See @ref bwmgr_int_unit_type definitions for unit-type mappings.
2397 */
2398 uint8_t floor_unit;
2399} BPMP_ABI_PACKED;
2400
2401struct cmd_bwmgr_int_cap_set_request {
2402 /* @brief requested cap frequency in Hz. */
2403 uint64_t rate;
2404} BPMP_ABI_PACKED;
2405
2406/*
2407 * response data for request type CMD_BWMGR_CALC_AND_SET
2408 */
2409struct cmd_bwmgr_int_calc_and_set_response {
2410 /* @brief current set memory clock frequency in Hz */
2411 uint64_t rate;
2412} BPMP_ABI_PACKED;
2413
2414/*
2415 * @brief Request with #MRQ_BWMGR_INT
2416 *
2417 *
2418 * |sub-command |payload |
2419 * |----------------------------|-----------------------------------|
2420 * |CMD_BWMGR_INT_QUERY_ABI | cmd_bwmgr_int_query_abi_request |
2421 * |CMD_BWMGR_INT_CALC_AND_SET | cmd_bwmgr_int_calc_and_set_request|
2422 * |CMD_BWMGR_INT_CAP_SET | cmd_bwmgr_int_cap_set_request |
2423 *
2424 */
2425struct mrq_bwmgr_int_request {
2426 uint32_t cmd;
2427 union {
2428 struct cmd_bwmgr_int_query_abi_request query_abi;
2429 struct cmd_bwmgr_int_calc_and_set_request bwmgr_calc_set_req;
2430 struct cmd_bwmgr_int_cap_set_request bwmgr_cap_set_req;
2431 } BPMP_UNION_ANON;
2432} BPMP_ABI_PACKED;
2433
2434/*
2435 * @brief Response to MRQ_BWMGR_INT
2436 *
2437 * |sub-command |payload |
2438 * |----------------------------|---------------------------------------|
2439 * |CMD_BWMGR_INT_CALC_AND_SET | cmd_bwmgr_int_calc_and_set_response |
2440 */
2441struct mrq_bwmgr_int_response {
2442 union {
2443 struct cmd_bwmgr_int_calc_and_set_response bwmgr_calc_set_resp;
2444 } BPMP_UNION_ANON;
2445} BPMP_ABI_PACKED;
2446
2447/** @} BWMGR_INT */
2448/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */
2449
2450/**
2451 * @ingroup MRQ_Codes
2452 * @def MRQ_ISO_CLIENT
2453 * @brief ISO client requests
2454 *
2455 * * Platforms: T234 onwards
2456 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
2457 * * Initiators: CCPLEX
2458 * * Targets: BPMP
2459 * * Request Payload: @ref mrq_iso_client_request
2460 * * Response Payload: @ref mrq_iso_client_response
2461 *
2462 * @addtogroup ISO_CLIENT
2463 * @{
2464 */
2465
2466enum mrq_iso_client_cmd {
2467 /**
2468 * @brief Check whether the BPMP driver supports the specified
2469 * request type
2470 *
2471 * mrq_response::err is 0 if the specified request is
2472 * supported and -#BPMP_ENODEV otherwise.
2473 */
2474 CMD_ISO_CLIENT_QUERY_ABI = 0,
2475
2476 /*
2477 * @brief check for legal LA for the iso client. Without programming
2478 * LA MC registers, calculate and ensure that legal LA is possible for
2479 * iso bw requested by the ISO client.
2480 *
2481 * mrq_response::err is
2482 * * 0: check la succeeded.
2483 * * -#BPMP_EINVAL: Invalid request parameters.
2484 * * -#BPMP_EFAULT: Legal LA is not possible for client requested iso_bw
2485 */
2486 CMD_ISO_CLIENT_CALCULATE_LA = 1,
2487
2488 /*
2489 * @brief set LA for the iso client. Calculate and program the LA/PTSA
2490 * MC registers corresponding to the client making bw request
2491 *
2492 * mrq_response::err is
2493 * * 0: set la succeeded.
2494 * * -#BPMP_EINVAL: Invalid request parameters.
2495 * * -#BPMP_EFAULT: Failed to calculate or program MC registers.
2496 */
2497 CMD_ISO_CLIENT_SET_LA = 2,
2498
2499 /*
2500 * @brief Get max possible bw for iso client
2501 *
2502 * mrq_response::err is
2503 * * 0: get_max_bw succeeded.
2504 * * -#BPMP_EINVAL: Invalid request parameters.
2505 */
2506 CMD_ISO_CLIENT_GET_MAX_BW = 3
2507};
2508
2509/*
2510 * request data for request type CMD_ISO_CLIENT_QUERY_ABI
2511 *
2512 * type: Request type for which to check existence.
2513 */
2514struct cmd_iso_client_query_abi_request {
2515 uint32_t type;
2516} BPMP_ABI_PACKED;
2517
2518/*
2519 * request data for request type CMD_ISO_CLIENT_CALCULATE_LA
2520 *
2521 * id: client ID in @ref bpmp_bwmgr_ids
2522 * bw: bw requested in kBps by client ID.
2523 * init_bw_floor: initial dram_bw_floor in kBps passed by client ID.
2524 * ISO client will perform mempool allocation and DVFS buffering based
2525 * on this dram_bw_floor.
2526 */
2527struct cmd_iso_client_calculate_la_request {
2528 uint32_t id;
2529 uint32_t bw;
2530 uint32_t init_bw_floor;
2531} BPMP_ABI_PACKED;
2532
2533/*
2534 * request data for request type CMD_ISO_CLIENT_SET_LA
2535 *
2536 * id: client ID in @ref bpmp_bwmgr_ids
2537 * bw: bw requested in kBps by client ID.
2538 * final_bw_floor: final dram_bw_floor in kBps.
2539 * Sometimes the initial dram_bw_floor passed by ISO client may need to be
2540 * updated by considering higher dram freq's. This is the final dram_bw_floor
2541 * used to calculate and program MC registers.
2542 */
2543struct cmd_iso_client_set_la_request {
2544 uint32_t id;
2545 uint32_t bw;
2546 uint32_t final_bw_floor;
2547} BPMP_ABI_PACKED;
2548
2549/*
2550 * request data for request type CMD_ISO_CLIENT_GET_MAX_BW
2551 *
2552 * id: client ID in @ref bpmp_bwmgr_ids
2553 */
2554struct cmd_iso_client_get_max_bw_request {
2555 uint32_t id;
2556} BPMP_ABI_PACKED;
2557
2558/*
2559 * response data for request type CMD_ISO_CLIENT_CALCULATE_LA
2560 *
2561 * la_rate_floor: minimum dram_rate_floor in kHz at which a legal la is possible
2562 * iso_client_only_rate: Minimum dram freq in kHz required to satisfy this clients
2563 * iso bw request, assuming all other iso clients are inactive
2564 */
2565struct cmd_iso_client_calculate_la_response {
2566 uint32_t la_rate_floor;
2567 uint32_t iso_client_only_rate;
2568} BPMP_ABI_PACKED;
2569
2570/**
2571 * @brief Used by @ref cmd_iso_client_get_max_bw_response
2572 */
2573struct iso_max_bw {
2574 /* @brief dram frequency in kHz */
2575 uint32_t freq;
2576 /* @brief max possible iso-bw in kBps */
2577 uint32_t iso_bw;
2578} BPMP_ABI_PACKED;
2579
2580#define ISO_MAX_BW_MAX_SIZE 14U
2581/*
2582 * response data for request type CMD_ISO_CLIENT_GET_MAX_BW
2583 */
2584struct cmd_iso_client_get_max_bw_response {
2585 /* @brief The number valid entries in iso_max_bw pairs */
2586 uint32_t num_pairs;
2587 /* @brief max ISOBW <dram freq, max bw> information */
2588 struct iso_max_bw pairs[ISO_MAX_BW_MAX_SIZE];
2589} BPMP_ABI_PACKED;
2590
2591/**
2592 * @brief Request with #MRQ_ISO_CLIENT
2593 *
2594 * Used by the sender of an #MRQ_ISO_CLIENT message.
2595 *
2596 * |sub-command |payload |
2597 * |------------------------------------ |----------------------------------------|
2598 * |CMD_ISO_CLIENT_QUERY_ABI |cmd_iso_client_query_abi_request |
2599 * |CMD_ISO_CLIENT_CALCULATE_LA |cmd_iso_client_calculate_la_request |
2600 * |CMD_ISO_CLIENT_SET_LA |cmd_iso_client_set_la_request |
2601 * |CMD_ISO_CLIENT_GET_MAX_BW |cmd_iso_client_get_max_bw_request |
2602 *
2603 */
2604
2605struct mrq_iso_client_request {
2606 /* Type of request. Values listed in enum mrq_iso_client_cmd */
2607 uint32_t cmd;
2608 union {
2609 struct cmd_iso_client_query_abi_request query_abi;
2610 struct cmd_iso_client_calculate_la_request calculate_la_req;
2611 struct cmd_iso_client_set_la_request set_la_req;
2612 struct cmd_iso_client_get_max_bw_request max_isobw_req;
2613 } BPMP_UNION_ANON;
2614} BPMP_ABI_PACKED;
2615
2616/**
2617 * @brief Response to MRQ_ISO_CLIENT
2618 *
2619 * Each sub-command supported by @ref mrq_iso_client_request may return
2620 * sub-command-specific data. Some do and some do not as indicated in
2621 * the following table
2622 *
2623 * |sub-command |payload |
2624 * |---------------------------- |------------------------------------|
2625 * |CMD_ISO_CLIENT_CALCULATE_LA |cmd_iso_client_calculate_la_response|
2626 * |CMD_ISO_CLIENT_SET_LA |N/A |
2627 * |CMD_ISO_CLIENT_GET_MAX_BW |cmd_iso_client_get_max_bw_response |
2628 *
2629 */
2630
2631struct mrq_iso_client_response {
2632 union {
2633 struct cmd_iso_client_calculate_la_response calculate_la_resp;
2634 struct cmd_iso_client_get_max_bw_response max_isobw_resp;
2635 } BPMP_UNION_ANON;
2636} BPMP_ABI_PACKED;
2637
2638/** @} ISO_CLIENT */
2639/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */
2640
2641/**
2642 * @ingroup MRQ_Codes
2643 * @def MRQ_CPU_NDIV_LIMITS
2644 * @brief CPU freq. limits in ndiv
2645 *
2646 * * Platforms: T194 onwards
2647 * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
2648 * * Initiators: CCPLEX
2649 * * Targets: BPMP
2650 * * Request Payload: @ref mrq_cpu_ndiv_limits_request
2651 * * Response Payload: @ref mrq_cpu_ndiv_limits_response
2652 * @addtogroup CPU
2653 * @{
2654 */
2655
2656/**
2657 * @brief Request for ndiv limits of a cluster
2658 */
2659struct mrq_cpu_ndiv_limits_request {
2660 /** @brief Enum cluster_id */
2661 uint32_t cluster_id;
2662} BPMP_ABI_PACKED;
2663
2664/**
2665 * @brief Response to #MRQ_CPU_NDIV_LIMITS
2666 */
2667struct mrq_cpu_ndiv_limits_response {
2668 /** @brief Reference frequency in Hz */
2669 uint32_t ref_clk_hz;
2670 /** @brief Post divider value */
2671 uint16_t pdiv;
2672 /** @brief Input divider value */
2673 uint16_t mdiv;
2674 /** @brief FMAX expressed with max NDIV value */
2675 uint16_t ndiv_max;
2676 /** @brief Minimum allowed NDIV value */
2677 uint16_t ndiv_min;
2678} BPMP_ABI_PACKED;
2679
2680/** @} CPU */
2681/** @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500) */
2682
2683/**
2684 * @ingroup MRQ_Codes
2685 * @def MRQ_CPU_AUTO_CC3
2686 * @brief Query CPU cluster auto-CC3 configuration
2687 *
2688 * * Platforms: T194
2689 * @cond bpmp_t194
2690 * * Initiators: CCPLEX
2691 * * Targets: BPMP
2692 * * Request Payload: @ref mrq_cpu_auto_cc3_request
2693 * * Response Payload: @ref mrq_cpu_auto_cc3_response
2694 * @addtogroup CC3
2695 *
2696 * Queries from BPMP auto-CC3 configuration (allowed/not allowed) for a
2697 * specified cluster. CCPLEX s/w uses this information to override its own
2698 * device tree auto-CC3 settings, so that BPMP device tree is a single source of
2699 * auto-CC3 platform configuration.
2700 *
2701 * @{
2702 */
2703
2704/**
2705 * @brief Request for auto-CC3 configuration of a cluster
2706 */
2707struct mrq_cpu_auto_cc3_request {
2708 /** @brief Enum cluster_id (logical cluster id, known to CCPLEX s/w) */
2709 uint32_t cluster_id;
2710} BPMP_ABI_PACKED;
2711
2712/**
2713 * @brief Response to #MRQ_CPU_AUTO_CC3
2714 */
2715struct mrq_cpu_auto_cc3_response {
2716 /**
2717 * @brief auto-CC3 configuration
2718 *
2719 * - bits[31..10] reserved.
2720 * - bits[9..1] cc3 ndiv
2721 * - bit [0] if "1" auto-CC3 is allowed, if "0" auto-CC3 is not allowed
2722 */
2723 uint32_t auto_cc3_config;
2724} BPMP_ABI_PACKED;
2725
2726/** @} CC3 */
2727/** @endcond bpmp_t194 */
2728
2729/**
2730 * @ingroup MRQ_Codes
2731 * @def MRQ_RINGBUF_CONSOLE
2732 * @brief A ring buffer debug console for BPMP
2733 * @addtogroup RingbufConsole
2734 *
2735 * The ring buffer debug console aims to be a substitute for the UART debug
2736 * console. The debug console is implemented with two ring buffers in the
2737 * BPMP-FW, the RX (receive) and TX (transmit) buffers. Characters can be read
2738 * and written to the buffers by the host via the MRQ interface.
2739 *
2740 * @{
2741 */
2742
2743/**
2744 * @brief Maximum number of bytes transferred in a single write command to the
2745 * BPMP
2746 *
2747 * This is determined by the number of free bytes in the message struct,
2748 * rounded down to a multiple of four.
2749 */
2750#define MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN 112
2751
2752/**
2753 * @brief Maximum number of bytes transferred in a single read command to the
2754 * BPMP
2755 *
2756 * This is determined by the number of free bytes in the message struct,
2757 * rounded down to a multiple of four.
2758 */
2759#define MRQ_RINGBUF_CONSOLE_MAX_READ_LEN 116
2760
2761enum mrq_ringbuf_console_host_to_bpmp_cmd {
2762 /**
2763 * @brief Check whether the BPMP driver supports the specified request
2764 * type
2765 *
2766 * mrq_response::err is 0 if the specified request is supported and
2767 * -#BPMP_ENODEV otherwise
2768 */
2769 CMD_RINGBUF_CONSOLE_QUERY_ABI = 0,
2770 /**
2771 * @brief Perform a read operation on the BPMP TX buffer
2772 *
2773 * mrq_response::err is 0
2774 */
2775 CMD_RINGBUF_CONSOLE_READ = 1,
2776 /**
2777 * @brief Perform a write operation on the BPMP RX buffer
2778 *
2779 * mrq_response::err is 0 if the operation was successful and
2780 * -#BPMP_ENODEV otherwise
2781 */
2782 CMD_RINGBUF_CONSOLE_WRITE = 2,
2783 /**
2784 * @brief Get the length of the buffer and the physical addresses of
2785 * the buffer data and the head and tail counters
2786 *
2787 * mrq_response::err is 0 if the operation was successful and
2788 * -#BPMP_ENODEV otherwise
2789 */
2790 CMD_RINGBUF_CONSOLE_GET_FIFO = 3,
2791};
2792
2793/**
2794 * @ingroup RingbufConsole
2795 * @brief Host->BPMP request data for request type
2796 * #CMD_RINGBUF_CONSOLE_QUERY_ABI
2797 */
2798struct cmd_ringbuf_console_query_abi_req {
2799 /** @brief Command identifier to be queried */
2800 uint32_t cmd;
2801} BPMP_ABI_PACKED;
2802
2803/** @private */
2804struct cmd_ringbuf_console_query_abi_resp {
2805 BPMP_ABI_EMPTY
2806} BPMP_ABI_PACKED;
2807
2808/**
2809 * @ingroup RingbufConsole
2810 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_READ
2811 */
2812struct cmd_ringbuf_console_read_req {
2813 /**
2814 * @brief Number of bytes requested to be read from the BPMP TX buffer
2815 */
2816 uint8_t len;
2817} BPMP_ABI_PACKED;
2818
2819/**
2820 * @ingroup RingbufConsole
2821 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_READ
2822 */
2823struct cmd_ringbuf_console_read_resp {
2824 /** @brief The actual data read from the BPMP TX buffer */
2825 uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_READ_LEN];
2826 /** @brief Number of bytes in cmd_ringbuf_console_read_resp::data */
2827 uint8_t len;
2828} BPMP_ABI_PACKED;
2829
2830/**
2831 * @ingroup RingbufConsole
2832 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_WRITE
2833 */
2834struct cmd_ringbuf_console_write_req {
2835 /** @brief The actual data to be written to the BPMP RX buffer */
2836 uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN];
2837 /** @brief Number of bytes in cmd_ringbuf_console_write_req::data */
2838 uint8_t len;
2839} BPMP_ABI_PACKED;
2840
2841/**
2842 * @ingroup RingbufConsole
2843 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_WRITE
2844 */
2845struct cmd_ringbuf_console_write_resp {
2846 /** @brief Number of bytes of available space in the BPMP RX buffer */
2847 uint32_t space_avail;
2848 /** @brief Number of bytes that were written to the BPMP RX buffer */
2849 uint8_t len;
2850} BPMP_ABI_PACKED;
2851
2852/** @private */
2853struct cmd_ringbuf_console_get_fifo_req {
2854 BPMP_ABI_EMPTY
2855} BPMP_ABI_PACKED;
2856
2857/**
2858 * @ingroup RingbufConsole
2859 * @brief BPMP->Host reply data for request type #CMD_RINGBUF_CONSOLE_GET_FIFO
2860 */
2861struct cmd_ringbuf_console_get_fifo_resp {
2862 /** @brief Physical address of the BPMP TX buffer */
2863 uint64_t bpmp_tx_buf_addr;
2864 /** @brief Physical address of the BPMP TX buffer head counter */
2865 uint64_t bpmp_tx_head_addr;
2866 /** @brief Physical address of the BPMP TX buffer tail counter */
2867 uint64_t bpmp_tx_tail_addr;
2868 /** @brief Length of the BPMP TX buffer */
2869 uint32_t bpmp_tx_buf_len;
2870} BPMP_ABI_PACKED;
2871
2872/**
2873 * @ingroup RingbufConsole
2874 * @brief Host->BPMP request data.
2875 *
2876 * Reply type is union #mrq_ringbuf_console_bpmp_to_host_response .
2877 */
2878struct mrq_ringbuf_console_host_to_bpmp_request {
2879 /**
2880 * @brief Type of request. Values listed in enum
2881 * #mrq_ringbuf_console_host_to_bpmp_cmd.
2882 */
2883 uint32_t type;
2884 /** @brief request type specific parameters. */
2885 union {
2886 struct cmd_ringbuf_console_query_abi_req query_abi;
2887 struct cmd_ringbuf_console_read_req read;
2888 struct cmd_ringbuf_console_write_req write;
2889 struct cmd_ringbuf_console_get_fifo_req get_fifo;
2890 } BPMP_UNION_ANON;
2891} BPMP_ABI_PACKED;
2892
2893/**
2894 * @ingroup RingbufConsole
2895 * @brief Host->BPMP reply data
2896 *
2897 * In response to struct #mrq_ringbuf_console_host_to_bpmp_request.
2898 */
2899union mrq_ringbuf_console_bpmp_to_host_response {
2900 struct cmd_ringbuf_console_query_abi_resp query_abi;
2901 struct cmd_ringbuf_console_read_resp read;
2902 struct cmd_ringbuf_console_write_resp write;
2903 struct cmd_ringbuf_console_get_fifo_resp get_fifo;
2904} BPMP_ABI_PACKED;
2905
2906/** @} RingbufConsole */
2907
2908/**
2909 * @ingroup MRQ_Codes
2910 * @def MRQ_STRAP
2911 * @brief Set a strap value controlled by BPMP
2912 *
2913 * * Platforms: T194 onwards
2914 * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
2915 * * Initiators: CCPLEX
2916 * * Targets: BPMP
2917 * * Request Payload: @ref mrq_strap_request
2918 * * Response Payload: N/A
2919 * @addtogroup Strap
2920 *
2921 * A strap is an input that is sampled by a hardware unit during the
2922 * unit's startup process. The sampled value of a strap affects the
2923 * behavior of the unit until the unit is restarted. Many hardware
2924 * units sample their straps at the instant that their resets are
2925 * deasserted.
2926 *
2927 * BPMP owns registers which act as straps to various units. It
2928 * exposes limited control of those straps via #MRQ_STRAP.
2929 *
2930 * @{
2931 */
2932enum mrq_strap_cmd {
2933 /** @private */
2934 STRAP_RESERVED = 0,
2935 /** @brief Set a strap value */
2936 STRAP_SET = 1
2937};
2938
2939/**
2940 * @brief Request with #MRQ_STRAP
2941 */
2942struct mrq_strap_request {
2943 /** @brief @ref mrq_strap_cmd */
2944 uint32_t cmd;
2945 /** @brief Strap ID from @ref Strap_Identifiers */
2946 uint32_t id;
2947 /** @brief Desired value for strap (if cmd is #STRAP_SET) */
2948 uint32_t value;
2949} BPMP_ABI_PACKED;
2950
2951/** @} Strap */
2952/** @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500) */
2953
2954/**
2955 * @ingroup MRQ_Codes
2956 * @def MRQ_UPHY
2957 * @brief Perform a UPHY operation
2958 *
2959 * * Platforms: T194 onwards
2960 * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
2961 * * Initiators: CCPLEX
2962 * * Targets: BPMP
2963 * * Request Payload: @ref mrq_uphy_request
2964 * * Response Payload: @ref mrq_uphy_response
2965 *
2966 * @addtogroup UPHY
2967 * @{
2968 */
2969enum {
2970 CMD_UPHY_PCIE_LANE_MARGIN_CONTROL = 1,
2971 CMD_UPHY_PCIE_LANE_MARGIN_STATUS = 2,
2972 CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT = 3,
2973 CMD_UPHY_PCIE_CONTROLLER_STATE = 4,
2974 CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF = 5,
2975 CMD_UPHY_DISPLAY_PORT_INIT = 6,
2976 CMD_UPHY_DISPLAY_PORT_OFF = 7,
2977 CMD_UPHY_XUSB_DYN_LANES_RESTORE = 8,
2978 CMD_UPHY_MAX,
2979};
2980
2981struct cmd_uphy_margin_control_request {
2982 /** @brief Enable margin */
2983 int32_t en;
2984 /** @brief Clear the number of error and sections */
2985 int32_t clr;
2986 /** @brief Set x offset (1's complement) for left/right margin type (y should be 0) */
2987 uint32_t x;
2988 /** @brief Set y offset (1's complement) for left/right margin type (x should be 0) */
2989 uint32_t y;
2990 /** @brief Set number of bit blocks for each margin section */
2991 uint32_t nblks;
2992} BPMP_ABI_PACKED;
2993
2994struct cmd_uphy_margin_status_response {
2995 /** @brief Number of errors observed */
2996 uint32_t status;
2997} BPMP_ABI_PACKED;
2998
2999struct cmd_uphy_ep_controller_pll_init_request {
3000 /** @brief EP controller number, T194 valid: 0, 4, 5; T234 valid: 5, 6, 7, 10; T239 valid: 0 */
3001 uint8_t ep_controller;
3002} BPMP_ABI_PACKED;
3003
3004struct cmd_uphy_pcie_controller_state_request {
3005 /** @brief PCIE controller number, T194 valid: 0-4; T234 valid: 0-10; T239 valid: 0-3 */
3006 uint8_t pcie_controller;
3007 uint8_t enable;
3008} BPMP_ABI_PACKED;
3009
3010struct cmd_uphy_ep_controller_pll_off_request {
3011 /** @brief EP controller number, T194 valid: 0, 4, 5; T234 valid: 5, 6, 7, 10; T239 valid: 0 */
3012 uint8_t ep_controller;
3013} BPMP_ABI_PACKED;
3014
3015struct cmd_uphy_display_port_init_request {
3016 /** @brief DisplayPort link rate, T239 valid: 1620, 2700, 5400, 8100, 2160, 2430, 3240, 4320, 6750 */
3017 uint16_t link_rate;
3018 /** @brief 1: lane 0; 2: lane 1; 3: lane 0 and 1 */
3019 uint16_t lanes_bitmap;
3020} BPMP_ABI_PACKED;
3021
3022struct cmd_uphy_xusb_dyn_lanes_restore_request {
3023 /** @brief 1: lane 0; 2: lane 1; 3: lane 0 and 1 */
3024 uint16_t lanes_bitmap;
3025} BPMP_ABI_PACKED;
3026
3027/**
3028 * @ingroup UPHY
3029 * @brief Request with #MRQ_UPHY
3030 *
3031 * Used by the sender of an #MRQ_UPHY message to control UPHY.
3032 * The uphy_request is split into several sub-commands. CMD_UPHY_PCIE_LANE_MARGIN_STATUS
3033 * requires no additional data. Others have a sub-command specific payload. Below table
3034 * shows sub-commands with their corresponding payload data.
3035 *
3036 * |sub-command |payload |
3037 * |------------------------------------ |----------------------------------------|
3038 * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL |uphy_set_margin_control |
3039 * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS | |
3040 * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT |cmd_uphy_ep_controller_pll_init_request |
3041 * |CMD_UPHY_PCIE_CONTROLLER_STATE |cmd_uphy_pcie_controller_state_request |
3042 * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF |cmd_uphy_ep_controller_pll_off_request |
3043 * |CMD_UPHY_PCIE_DISPLAY_PORT_INIT |cmd_uphy_display_port_init_request |
3044 * |CMD_UPHY_PCIE_DISPLAY_PORT_OFF | |
3045 * |CMD_UPHY_XUSB_DYN_LANES_RESTORE |cmd_uphy_xusb_dyn_lanes_restore_request |
3046 *
3047 */
3048
3049struct mrq_uphy_request {
3050 /** @brief Lane number. */
3051 uint16_t lane;
3052 /** @brief Sub-command id. */
3053 uint16_t cmd;
3054
3055 union {
3056 struct cmd_uphy_margin_control_request uphy_set_margin_control;
3057 struct cmd_uphy_ep_controller_pll_init_request ep_ctrlr_pll_init;
3058 struct cmd_uphy_pcie_controller_state_request controller_state;
3059 struct cmd_uphy_ep_controller_pll_off_request ep_ctrlr_pll_off;
3060 struct cmd_uphy_display_port_init_request display_port_init;
3061 struct cmd_uphy_xusb_dyn_lanes_restore_request xusb_dyn_lanes_restore;
3062 } BPMP_UNION_ANON;
3063} BPMP_ABI_PACKED;
3064
3065/**
3066 * @ingroup UPHY
3067 * @brief Response to MRQ_UPHY
3068 *
3069 * Each sub-command supported by @ref mrq_uphy_request may return
3070 * sub-command-specific data. Some do and some do not as indicated in
3071 * the following table
3072 *
3073 * |sub-command |payload |
3074 * |---------------------------- |------------------------|
3075 * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL | |
3076 * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS |uphy_get_margin_status |
3077 *
3078 */
3079
3080struct mrq_uphy_response {
3081 union {
3082 struct cmd_uphy_margin_status_response uphy_get_margin_status;
3083 } BPMP_UNION_ANON;
3084} BPMP_ABI_PACKED;
3085
3086/** @} UPHY */
3087/** @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500) */
3088
3089/**
3090 * @ingroup MRQ_Codes
3091 * @def MRQ_FMON
3092 * @brief Perform a frequency monitor configuration operations
3093 *
3094 * * Platforms: T194 onwards
3095 * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
3096 * * Initiators: CCPLEX
3097 * * Targets: BPMP
3098 * * Request Payload: @ref mrq_fmon_request
3099 * * Response Payload: @ref mrq_fmon_response
3100 * @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
3101 *
3102 * @addtogroup FMON
3103 * @{
3104 * @cond (bpmp_t194 || bpmp_t234)
3105 */
3106enum {
3107 /**
3108 * @brief Clamp FMON configuration to specified rate.
3109 *
3110 * The monitored clock must be running for clamp to succeed. If
3111 * clamped, FMON configuration is preserved when clock rate
3112 * and/or state is changed.
3113 *
3114 * mrq_response::err is 0 if the operation was successful, or @n
3115 * -#BPMP_EACCES: FMON access error @n
3116 * -#BPMP_EBADCMD if subcommand is not supported @n
3117 * -#BPMP_EBADSLT: clamp FMON on cluster with auto-CC3 enabled @n
3118 * -#BPMP_EBUSY: fmon is already clamped at different rate @n
3119 * -#BPMP_EFAULT: self-diagnostic error @n
3120 * -#BPMP_EINVAL: invalid FMON configuration @n
3121 * -#BPMP_EOPNOTSUPP: not in production mode @n
3122 * -#BPMP_ENODEV: invalid clk_id @n
3123 * -#BPMP_ENOENT: no calibration data, uninitialized @n
3124 * -#BPMP_ENOTSUP: avfs config not set @n
3125 * -#BPMP_ENOSYS: clamp FMON on cluster clock w/ no NAFLL @n
3126 * -#BPMP_ETIMEDOUT: operation timed out @n
3127 */
3128 CMD_FMON_GEAR_CLAMP = 1,
3129 /**
3130 * @brief Release clamped FMON configuration.
3131 *
3132 * Allow FMON configuration to follow monitored clock rate
3133 * and/or state changes.
3134 *
3135 * mrq_response::err is 0 if the operation was successful, or @n
3136 * -#BPMP_EBADCMD if subcommand is not supported @n
3137 * -#BPMP_ENODEV: invalid clk_id @n
3138 * -#BPMP_ENOENT: no calibration data, uninitialized @n
3139 * -#BPMP_ENOTSUP: avfs config not set @n
3140 * -#BPMP_EOPNOTSUPP: not in production mode @n
3141 */
3142 CMD_FMON_GEAR_FREE = 2,
3143 /**
3144 * @brief Return rate FMON is clamped at, or 0 if FMON is not
3145 * clamped.
3146 *
3147 * Inherently racy, since clamp state can be changed
3148 * concurrently. Useful for testing.
3149 *
3150 * mrq_response::err is 0 if the operation was successful, or @n
3151 * -#BPMP_EBADCMD if subcommand is not supported @n
3152 * -#BPMP_ENODEV: invalid clk_id @n
3153 * -#BPMP_ENOENT: no calibration data, uninitialized @n
3154 * -#BPMP_ENOTSUP: avfs config not set @n
3155 * -#BPMP_EOPNOTSUPP: not in production mode @n
3156 */
3157 CMD_FMON_GEAR_GET = 3,
3158 /**
3159 * @brief Return current status of FMON faults detected by FMON
3160 * h/w or s/w since last invocation of this command.
3161 * Clears fault status.
3162 *
3163 * mrq_response::err is 0 if the operation was successful, or @n
3164 * -#BPMP_EBADCMD if subcommand is not supported @n
3165 * -#BPMP_EINVAL: invalid fault type @n
3166 * -#BPMP_ENODEV: invalid clk_id @n
3167 * -#BPMP_ENOENT: no calibration data, uninitialized @n
3168 * -#BPMP_ENOTSUP: avfs config not set @n
3169 * -#BPMP_EOPNOTSUPP: not in production mode @n
3170 */
3171 CMD_FMON_FAULT_STS_GET = 4,
3172};
3173
3174/**
3175 * @cond DEPRECATED
3176 * Kept for backward compatibility
3177 */
3178#define CMD_FMON_NUM 4
3179
3180/** @endcond DEPRECATED */
3181
3182/**
3183 * @defgroup fmon_fault_type FMON fault type
3184 * @addtogroup fmon_fault_type
3185 * @{
3186 */
3187/** @brief All detected FMON faults (h/w or s/w) */
3188#define FMON_FAULT_TYPE_ALL 0U
3189/** @brief FMON faults detected by h/w */
3190#define FMON_FAULT_TYPE_HW 1U
3191/** @brief FMON faults detected by s/w */
3192#define FMON_FAULT_TYPE_SW 2U
3193
3194/** @} fmon_fault_type */
3195
3196
3197struct cmd_fmon_gear_clamp_request {
3198 int32_t unused;
3199 int64_t rate;
3200} BPMP_ABI_PACKED;
3201
3202/** @private */
3203struct cmd_fmon_gear_clamp_response {
3204 BPMP_ABI_EMPTY
3205} BPMP_ABI_PACKED;
3206
3207/** @private */
3208struct cmd_fmon_gear_free_request {
3209 BPMP_ABI_EMPTY
3210} BPMP_ABI_PACKED;
3211
3212/** @private */
3213struct cmd_fmon_gear_free_response {
3214 BPMP_ABI_EMPTY
3215} BPMP_ABI_PACKED;
3216
3217/** @private */
3218struct cmd_fmon_gear_get_request {
3219 BPMP_ABI_EMPTY
3220} BPMP_ABI_PACKED;
3221
3222struct cmd_fmon_gear_get_response {
3223 int64_t rate;
3224} BPMP_ABI_PACKED;
3225
3226struct cmd_fmon_fault_sts_get_request {
3227 uint32_t fault_type; /**< @ref fmon_fault_type */
3228} BPMP_ABI_PACKED;
3229
3230struct cmd_fmon_fault_sts_get_response {
3231 uint32_t fault_sts;
3232} BPMP_ABI_PACKED;
3233
3234/**
3235 * @ingroup FMON
3236 * @brief Request with #MRQ_FMON
3237 *
3238 * Used by the sender of an #MRQ_FMON message to configure clock
3239 * frequency monitors. The FMON request is split into several
3240 * sub-commands. Some sub-commands require no additional data.
3241 * Others have a sub-command specific payload
3242 *
3243 * |sub-command |payload |
3244 * |----------------------------|-----------------------|
3245 * |CMD_FMON_GEAR_CLAMP |fmon_gear_clamp |
3246 * |CMD_FMON_GEAR_FREE |- |
3247 * |CMD_FMON_GEAR_GET |- |
3248 * |CMD_FMON_FAULT_STS_GET |fmon_fault_sts_get |
3249 *
3250 */
3251struct mrq_fmon_request {
3252 /** @brief Sub-command and clock id concatenated to 32-bit word.
3253 * - bits[31..24] is the sub-cmd.
3254 * - bits[23..0] is monitored clock id used to select target
3255 * FMON
3256 */
3257 uint32_t cmd_and_id;
3258
3259 union {
3260 struct cmd_fmon_gear_clamp_request fmon_gear_clamp;
3261 /** @private */
3262 struct cmd_fmon_gear_free_request fmon_gear_free;
3263 /** @private */
3264 struct cmd_fmon_gear_get_request fmon_gear_get;
3265 struct cmd_fmon_fault_sts_get_request fmon_fault_sts_get;
3266 } BPMP_UNION_ANON;
3267} BPMP_ABI_PACKED;
3268
3269/**
3270 * @ingroup FMON
3271 * @brief Response to MRQ_FMON
3272 *
3273 * Each sub-command supported by @ref mrq_fmon_request may
3274 * return sub-command-specific data as indicated below.
3275 *
3276 * |sub-command |payload |
3277 * |----------------------------|------------------------|
3278 * |CMD_FMON_GEAR_CLAMP |- |
3279 * |CMD_FMON_GEAR_FREE |- |
3280 * |CMD_FMON_GEAR_GET |fmon_gear_get |
3281 * |CMD_FMON_FAULT_STS_GET |fmon_fault_sts_get |
3282 *
3283 */
3284
3285struct mrq_fmon_response {
3286 union {
3287 /** @private */
3288 struct cmd_fmon_gear_clamp_response fmon_gear_clamp;
3289 /** @private */
3290 struct cmd_fmon_gear_free_response fmon_gear_free;
3291 struct cmd_fmon_gear_get_response fmon_gear_get;
3292 struct cmd_fmon_fault_sts_get_response fmon_fault_sts_get;
3293 } BPMP_UNION_ANON;
3294} BPMP_ABI_PACKED;
3295
3296/** @endcond (bpmp_t194 || bpmp_t234) */
3297/** @} FMON */
3298
3299/**
3300 * @ingroup MRQ_Codes
3301 * @def MRQ_EC
3302 * @brief Provide status information on faults reported by Error
3303 * Collator (EC) to HSM.
3304 *
3305 * * Platforms: T194
3306 * @cond bpmp_t194
3307 * * Initiators: CCPLEX
3308 * * Targets: BPMP
3309 * * Request Payload: @ref mrq_ec_request
3310 * * Response Payload: @ref mrq_ec_response
3311 *
3312 * @note This MRQ ABI is under construction, and subject to change
3313 *
3314 * @endcond bpmp_t194
3315 * @addtogroup EC
3316 * @{
3317 * @cond bpmp_t194
3318 */
3319enum {
3320 /**
3321 * @cond DEPRECATED
3322 * @brief Retrieve specified EC status.
3323 *
3324 * mrq_response::err is 0 if the operation was successful, or @n
3325 * -#BPMP_ENODEV if target EC is not owned by BPMP @n
3326 * -#BPMP_EACCES if target EC power domain is turned off @n
3327 * -#BPMP_EBADCMD if subcommand is not supported
3328 * @endcond DEPRECATED
3329 */
3330 CMD_EC_STATUS_GET = 1, /* deprecated */
3331
3332 /**
3333 * @brief Retrieve specified EC extended status (includes error
3334 * counter and user values).
3335 *
3336 * mrq_response::err is 0 if the operation was successful, or @n
3337 * -#BPMP_ENODEV if target EC is not owned by BPMP @n
3338 * -#BPMP_EACCES if target EC power domain is turned off @n
3339 * -#BPMP_EBADCMD if subcommand is not supported
3340 */
3341 CMD_EC_STATUS_EX_GET = 2,
3342 CMD_EC_NUM,
3343};
3344
3345/** @brief BPMP ECs error types */
3346enum bpmp_ec_err_type {
3347 /** @brief Parity error on internal data path
3348 *
3349 * Error descriptor @ref ec_err_simple_desc.
3350 */
3351 EC_ERR_TYPE_PARITY_INTERNAL = 1,
3352
3353 /** @brief ECC SEC error on internal data path
3354 *
3355 * Error descriptor @ref ec_err_simple_desc.
3356 */
3357 EC_ERR_TYPE_ECC_SEC_INTERNAL = 2,
3358
3359 /** @brief ECC DED error on internal data path
3360 *
3361 * Error descriptor @ref ec_err_simple_desc.
3362 */
3363 EC_ERR_TYPE_ECC_DED_INTERNAL = 3,
3364
3365 /** @brief Comparator error
3366 *
3367 * Error descriptor @ref ec_err_simple_desc.
3368 */
3369 EC_ERR_TYPE_COMPARATOR = 4,
3370
3371 /** @brief Register parity error
3372 *
3373 * Error descriptor @ref ec_err_reg_parity_desc.
3374 */
3375 EC_ERR_TYPE_REGISTER_PARITY = 5,
3376
3377 /** @brief Parity error from on-chip SRAM/FIFO
3378 *
3379 * Error descriptor @ref ec_err_simple_desc.
3380 */
3381 EC_ERR_TYPE_PARITY_SRAM = 6,
3382
3383 /** @brief Clock Monitor error
3384 *
3385 * Error descriptor @ref ec_err_fmon_desc.
3386 */
3387 EC_ERR_TYPE_CLOCK_MONITOR = 9,
3388
3389 /** @brief Voltage Monitor error
3390 *
3391 * Error descriptor @ref ec_err_vmon_desc.
3392 */
3393 EC_ERR_TYPE_VOLTAGE_MONITOR = 10,
3394
3395 /** @brief SW Correctable error
3396 *
3397 * Error descriptor @ref ec_err_sw_error_desc.
3398 */
3399 EC_ERR_TYPE_SW_CORRECTABLE = 16,
3400
3401 /** @brief SW Uncorrectable error
3402 *
3403 * Error descriptor @ref ec_err_sw_error_desc.
3404 */
3405 EC_ERR_TYPE_SW_UNCORRECTABLE = 17,
3406
3407 /** @brief Other HW Correctable error
3408 *
3409 * Error descriptor @ref ec_err_simple_desc.
3410 */
3411 EC_ERR_TYPE_OTHER_HW_CORRECTABLE = 32,
3412
3413 /** @brief Other HW Uncorrectable error
3414 *
3415 * Error descriptor @ref ec_err_simple_desc.
3416 */
3417 EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE = 33,
3418};
3419
3420/** @brief Group of registers with parity error. */
3421enum ec_registers_group {
3422 /** @brief Functional registers group */
3423 EC_ERR_GROUP_FUNC_REG = 0U,
3424 /** @brief SCR registers group */
3425 EC_ERR_GROUP_SCR_REG = 1U,
3426};
3427
3428/**
3429 * @defgroup bpmp_ec_status_flags EC Status Flags
3430 * @addtogroup bpmp_ec_status_flags
3431 * @{
3432 */
3433/** @brief No EC error found flag */
3434#define EC_STATUS_FLAG_NO_ERROR 0x0001U
3435/** @brief Last EC error found flag */
3436#define EC_STATUS_FLAG_LAST_ERROR 0x0002U
3437/** @brief EC latent error flag */
3438#define EC_STATUS_FLAG_LATENT_ERROR 0x0004U
3439
3440/** @} bpmp_ec_status_flags */
3441
3442/**
3443 * @defgroup bpmp_ec_desc_flags EC Descriptor Flags
3444 * @addtogroup bpmp_ec_desc_flags
3445 * @{
3446 */
3447/** @brief EC descriptor error resolved flag */
3448#define EC_DESC_FLAG_RESOLVED 0x0001U
3449/** @brief EC descriptor failed to retrieve id flag */
3450#define EC_DESC_FLAG_NO_ID 0x0002U
3451
3452/** @} bpmp_ec_desc_flags */
3453
3454/**
3455 * |error type | fmon_clk_id values |
3456 * |---------------------------------|---------------------------|
3457 * |@ref EC_ERR_TYPE_CLOCK_MONITOR |@ref bpmp_clock_ids |
3458 */
3459struct ec_err_fmon_desc {
3460 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
3461 uint16_t desc_flags;
3462 /** @brief FMON monitored clock id */
3463 uint16_t fmon_clk_id;
3464 /**
3465 * @brief Bitmask of fault flags
3466 *
3467 * @ref bpmp_fmon_faults_flags
3468 */
3469 uint32_t fmon_faults;
3470 /** @brief FMON faults access error */
3471 int32_t fmon_access_error;
3472} BPMP_ABI_PACKED;
3473
3474/**
3475 * | error type | vmon_adc_id values |
3476 * |---------------------------------|---------------------------|
3477 * |@ref EC_ERR_TYPE_VOLTAGE_MONITOR |@ref bpmp_adc_ids |
3478 */
3479struct ec_err_vmon_desc {
3480 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
3481 uint16_t desc_flags;
3482 /** @brief VMON rail adc id */
3483 uint16_t vmon_adc_id;
3484 /** @brief Bitmask of bpmp_vmon_faults_flags */
3485 uint32_t vmon_faults;
3486 /** @brief VMON faults access error */
3487 int32_t vmon_access_error;
3488} BPMP_ABI_PACKED;
3489
3490/**
3491 * |error type | reg_id values |
3492 * |---------------------------------|-----------------------|
3493 * |@ref EC_ERR_TYPE_REGISTER_PARITY | bpmp_ec_registers_ids |
3494 */
3495struct ec_err_reg_parity_desc {
3496 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
3497 uint16_t desc_flags;
3498 /** @brief Register id */
3499 uint16_t reg_id;
3500 /** @brief Register group @ref ec_registers_group */
3501 uint16_t reg_group;
3502} BPMP_ABI_PACKED;
3503
3504/**
3505 * |error type | err_source_id values |
3506 * |--------------------------------- |----------------------|
3507 * |@ref EC_ERR_TYPE_SW_CORRECTABLE | bpmp_ec_ce_swd_ids |
3508 * |@ref EC_ERR_TYPE_SW_UNCORRECTABLE | bpmp_ec_ue_swd_ids |
3509 */
3510struct ec_err_sw_error_desc {
3511 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
3512 uint16_t desc_flags;
3513 /** @brief Error source id */
3514 uint16_t err_source_id;
3515 /** @brief Sw error data */
3516 uint32_t sw_error_data;
3517} BPMP_ABI_PACKED;
3518
3519/**
3520 * |error type | err_source_id values |
3521 * |----------------------------------------|------------------------|
3522 * |@ref EC_ERR_TYPE_PARITY_INTERNAL | bpmp_ec_ipath_ids |
3523 * |@ref EC_ERR_TYPE_ECC_SEC_INTERNAL | bpmp_ec_ipath_ids |
3524 * |@ref EC_ERR_TYPE_ECC_DED_INTERNAL | bpmp_ec_ipath_ids |
3525 * |@ref EC_ERR_TYPE_COMPARATOR | bpmp_ec_comparator_ids|
3526 * |@ref EC_ERR_TYPE_OTHER_HW_CORRECTABLE | bpmp_ec_misc_hwd_ids |
3527 * |@ref EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE | bpmp_ec_misc_hwd_ids |
3528 * |@ref EC_ERR_TYPE_PARITY_SRAM | bpmp_clock_ids |
3529 */
3530struct ec_err_simple_desc {
3531 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
3532 uint16_t desc_flags;
3533 /** @brief Error source id. Id space depends on error type. */
3534 uint16_t err_source_id;
3535} BPMP_ABI_PACKED;
3536
3537/** @brief Union of EC error descriptors */
3538union ec_err_desc {
3539 struct ec_err_fmon_desc fmon_desc;
3540 struct ec_err_vmon_desc vmon_desc;
3541 struct ec_err_reg_parity_desc reg_parity_desc;
3542 struct ec_err_sw_error_desc sw_error_desc;
3543 struct ec_err_simple_desc simple_desc;
3544} BPMP_ABI_PACKED;
3545
3546struct cmd_ec_status_get_request {
3547 /** @brief HSM error line number that identifies target EC. */
3548 uint32_t ec_hsm_id;
3549} BPMP_ABI_PACKED;
3550
3551/** EC status maximum number of descriptors */
3552#define EC_ERR_STATUS_DESC_MAX_NUM 4U
3553
3554/**
3555 * @cond DEPRECATED
3556 */
3557struct cmd_ec_status_get_response {
3558 /** @brief Target EC id (the same id received with request). */
3559 uint32_t ec_hsm_id;
3560 /**
3561 * @brief Bitmask of @ref bpmp_ec_status_flags
3562 *
3563 * If NO_ERROR flag is set, error_ fields should be ignored
3564 */
3565 uint32_t ec_status_flags;
3566 /** @brief Found EC error index. */
3567 uint32_t error_idx;
3568 /** @brief Found EC error type @ref bpmp_ec_err_type. */
3569 uint32_t error_type;
3570 /** @brief Number of returned EC error descriptors */
3571 uint32_t error_desc_num;
3572 /** @brief EC error descriptors */
3573 union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];
3574} BPMP_ABI_PACKED;
3575/** @endcond DEPRECATED */
3576
3577struct cmd_ec_status_ex_get_response {
3578 /** @brief Target EC id (the same id received with request). */
3579 uint32_t ec_hsm_id;
3580 /**
3581 * @brief Bitmask of @ref bpmp_ec_status_flags
3582 *
3583 * If NO_ERROR flag is set, error_ fields should be ignored
3584 */
3585 uint32_t ec_status_flags;
3586 /** @brief Found EC error index. */
3587 uint32_t error_idx;
3588 /** @brief Found EC error type @ref bpmp_ec_err_type. */
3589 uint32_t error_type;
3590 /** @brief Found EC mission error counter value */
3591 uint32_t error_counter;
3592 /** @brief Found EC mission error user value */
3593 uint32_t error_uval;
3594 /** @brief Reserved entry */
3595 uint32_t reserved;
3596 /** @brief Number of returned EC error descriptors */
3597 uint32_t error_desc_num;
3598 /** @brief EC error descriptors */
3599 union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];
3600} BPMP_ABI_PACKED;
3601
3602/**
3603 * @ingroup EC
3604 * @brief Request with #MRQ_EC
3605 *
3606 * Used by the sender of an #MRQ_EC message to access ECs owned
3607 * by BPMP.
3608 *
3609 * @cond DEPRECATED
3610 * |sub-command |payload |
3611 * |----------------------------|-----------------------|
3612 * |@ref CMD_EC_STATUS_GET |ec_status_get |
3613 * @endcond DEPRECATED
3614 *
3615 * |sub-command |payload |
3616 * |----------------------------|-----------------------|
3617 * |@ref CMD_EC_STATUS_EX_GET |ec_status_get |
3618 *
3619 */
3620
3621struct mrq_ec_request {
3622 /** @brief Sub-command id. */
3623 uint32_t cmd_id;
3624
3625 union {
3626 struct cmd_ec_status_get_request ec_status_get;
3627 } BPMP_UNION_ANON;
3628} BPMP_ABI_PACKED;
3629
3630/**
3631 * @ingroup EC
3632 * @brief Response to MRQ_EC
3633 *
3634 * Each sub-command supported by @ref mrq_ec_request may return
3635 * sub-command-specific data as indicated below.
3636 *
3637 * @cond DEPRECATED
3638 * |sub-command |payload |
3639 * |----------------------------|------------------------|
3640 * |@ref CMD_EC_STATUS_GET |ec_status_get |
3641 * @endcond DEPRECATED
3642 *
3643 * |sub-command |payload |
3644 * |----------------------------|------------------------|
3645 * |@ref CMD_EC_STATUS_EX_GET |ec_status_ex_get |
3646 *
3647 */
3648
3649struct mrq_ec_response {
3650 union {
3651 /**
3652 * @cond DEPRECATED
3653 */
3654 struct cmd_ec_status_get_response ec_status_get;
3655 /** @endcond DEPRECATED */
3656 struct cmd_ec_status_ex_get_response ec_status_ex_get;
3657 } BPMP_UNION_ANON;
3658} BPMP_ABI_PACKED;
3659
3660/** @endcond bpmp_t194 */
3661/** @} EC */
3662
3663/**
3664 * @ingroup MRQ_Codes
3665 * @def MRQ_TELEMETRY
3666 * @brief Get address of memory buffer refreshed with recently sampled
3667 * telemetry data
3668 *
3669 * * Platforms: TH500 onwards
3670 * @cond bpmp_th500
3671 * * Initiators: CCPLEX
3672 * * Targets: BPMP
3673 * * Request Payload: N/A
3674 * * Response Payload: @ref mrq_telemetry_response
3675 * @addtogroup Telemetry
3676 * @{
3677 */
3678
3679/**
3680 * @brief Response to #MRQ_TELEMETRY
3681 *
3682 * mrq_response::err is
3683 * * 0: Telemetry data is available at returned address
3684 * * -#BPMP_EACCES: MRQ master is not allowed to request buffer refresh
3685 * * -#BPMP_ENAVAIL: Telemetry buffer cannot be refreshed via this MRQ channel
3686 * * -#BPMP_ENOTSUP: Telemetry buffer is not supported by BPMP-FW
3687 * * -#BPMP_ENODEV: Telemetry mrq is not supported by BPMP-FW
3688 */
3689struct mrq_telemetry_response {
3690 /** @brief Physical address of telemetry data buffer */
3691 uint64_t data_buf_addr; /**< see @ref bpmp_telemetry_layout */
3692} BPMP_ABI_PACKED;
3693
3694/** @} Telemetry */
3695/** @endcond bpmp_th500 */
3696
3697/**
3698 * @ingroup MRQ_Codes
3699 * @def MRQ_PWR_LIMIT
3700 * @brief Control power limits.
3701 *
3702 * * Platforms: TH500 onwards
3703 * @cond bpmp_th500
3704 * * Initiators: Any
3705 * * Targets: BPMP
3706 * * Request Payload: @ref mrq_pwr_limit_request
3707 * * Response Payload: @ref mrq_pwr_limit_response
3708 *
3709 * @addtogroup Pwrlimit
3710 * @{
3711 */
3712enum mrq_pwr_limit_cmd {
3713 /**
3714 * @brief Check whether the BPMP-FW supports the specified
3715 * command
3716 *
3717 * mrq_response::err is 0 if the specified request is
3718 * supported and -#BPMP_ENODEV otherwise.
3719 */
3720 CMD_PWR_LIMIT_QUERY_ABI = 0,
3721
3722 /**
3723 * @brief Set power limit
3724 *
3725 * mrq_response:err is
3726 * * 0: Success
3727 * * -#BPMP_ENODEV: Pwr limit mrq is not supported by BPMP-FW
3728 * * -#BPMP_ENAVAIL: Invalid request parameters
3729 * * -#BPMP_EACCES: Request is not accepted
3730 */
3731 CMD_PWR_LIMIT_SET = 1,
3732
3733 /**
3734 * @brief Get power limit setting
3735 *
3736 * mrq_response:err is
3737 * * 0: Success
3738 * * -#BPMP_ENODEV: Pwr limit mrq is not supported by BPMP-FW
3739 * * -#BPMP_ENAVAIL: Invalid request parameters
3740 */
3741 CMD_PWR_LIMIT_GET = 2,
3742
3743 /**
3744 * @brief Get current power cap
3745 *
3746 * mrq_response:err is
3747 * * 0: Success
3748 * * -#BPMP_ENODEV: Pwr limit mrq is not supported by BPMP-FW
3749 * * -#BPMP_ENAVAIL: Invalid request parameters
3750 */
3751 CMD_PWR_LIMIT_CURR_CAP = 3,
3752};
3753
3754/**
3755 * @defgroup bpmp_pwr_limit_type PWR_LIMIT TYPEs
3756 * @{
3757 */
3758/** @brief Limit value specifies traget cap */
3759#define PWR_LIMIT_TYPE_TARGET_CAP 0U
3760/** @brief Limit value specifies maximum possible target cap */
3761#define PWR_LIMIT_TYPE_BOUND_MAX 1U
3762/** @brief Limit value specifies minimum possible target cap */
3763#define PWR_LIMIT_TYPE_BOUND_MIN 2U
3764/** @brief Number of limit types supported by mrq interface */
3765#define PWR_LIMIT_TYPE_NUM 3U
3766
3767/** @} bpmp_pwr_limit_type */
3768
3769/**
3770 * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_QUERY_ABI
3771 */
3772struct cmd_pwr_limit_query_abi_request {
3773 uint32_t cmd_code; /**< @ref mrq_pwr_limit_cmd */
3774} BPMP_ABI_PACKED;
3775
3776/**
3777 * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_SET
3778 *
3779 * Set specified limit of specified type from specified source. The success of
3780 * the request means that specified value is accepted as input to arbitration
3781 * with other sources settings for the same limit of the same type. Zero limit
3782 * is ignored by the arbitration (i.e., indicates "no limit set").
3783 */
3784struct cmd_pwr_limit_set_request {
3785 uint32_t limit_id; /**< @ref bpmp_pwr_limit_id */
3786 uint32_t limit_src; /**< @ref bpmp_pwr_limit_src */
3787 uint32_t limit_type; /**< @ref bpmp_pwr_limit_type */
3788 uint32_t limit_setting;
3789} BPMP_ABI_PACKED;
3790
3791/**
3792 * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_GET
3793 *
3794 * Get previously set from specified source specified limit value of specified
3795 * type.
3796 */
3797struct cmd_pwr_limit_get_request {
3798 uint32_t limit_id; /**< @ref bpmp_pwr_limit_id */
3799 uint32_t limit_src; /**< @ref bpmp_pwr_limit_src */
3800 uint32_t limit_type; /**< @ref bpmp_pwr_limit_type */
3801} BPMP_ABI_PACKED;
3802
3803/**
3804 * @brief Response data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_GET
3805 */
3806struct cmd_pwr_limit_get_response {
3807 uint32_t limit_setting;
3808} BPMP_ABI_PACKED;
3809
3810/**
3811 * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_CURR_CAP
3812 *
3813 * For specified limit get current power cap aggregated from all sources.
3814 */
3815struct cmd_pwr_limit_curr_cap_request {
3816 uint32_t limit_id; /**< @ref bpmp_pwr_limit_id */
3817} BPMP_ABI_PACKED;
3818
3819/**
3820 * @brief Response data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_CURR_CAP
3821 */
3822struct cmd_pwr_limit_curr_cap_response {
3823 uint32_t curr_cap;
3824} BPMP_ABI_PACKED;
3825
3826/**
3827 * @brief Request with #MRQ_PWR_LIMIT
3828 *
3829 * |sub-command |payload |
3830 * |----------------------------|---------------------------------|
3831 * |CMD_PWR_LIMIT_QUERY_ABI | cmd_pwr_limit_query_abi_request |
3832 * |CMD_PWR_LIMIT_SET | cmd_pwr_limit_set_request |
3833 * |CMD_PWR_LIMIT_GET | cmd_pwr_limit_get_request |
3834 * |CMD_PWR_LIMIT_CURR_CAP | cmd_pwr_limit_curr_cap_request |
3835 */
3836struct mrq_pwr_limit_request {
3837 uint32_t cmd;
3838 union {
3839 struct cmd_pwr_limit_query_abi_request pwr_limit_query_abi_req;
3840 struct cmd_pwr_limit_set_request pwr_limit_set_req;
3841 struct cmd_pwr_limit_get_request pwr_limit_get_req;
3842 struct cmd_pwr_limit_curr_cap_request pwr_limit_curr_cap_req;
3843 } BPMP_UNION_ANON;
3844} BPMP_ABI_PACKED;
3845
3846/**
3847 * @brief Response to MRQ_PWR_LIMIT
3848 *
3849 * |sub-command |payload |
3850 * |----------------------------|---------------------------------|
3851 * |CMD_PWR_LIMIT_QUERY_ABI | - |
3852 * |CMD_PWR_LIMIT_SET | - |
3853 * |CMD_PWR_LIMIT_GET | cmd_pwr_limit_get_response |
3854 * |CMD_PWR_LIMIT_CURR_CAP | cmd_pwr_limit_curr_cap_response |
3855 */
3856struct mrq_pwr_limit_response {
3857 union {
3858 struct cmd_pwr_limit_get_response pwr_limit_get_rsp;
3859 struct cmd_pwr_limit_curr_cap_response pwr_limit_curr_cap_rsp;
3860 } BPMP_UNION_ANON;
3861} BPMP_ABI_PACKED;
3862
3863/** @} PwrLimit */
3864/** @endcond bpmp_th500 */
3865
3866
3867/**
3868 * @ingroup MRQ_Codes
3869 * @def MRQ_GEARS
3870 * @brief Get thresholds for NDIV offset switching
3871 *
3872 * * Platforms: TH500 onwards
3873 * @cond bpmp_th500
3874 * * Initiators: CCPLEX
3875 * * Targets: BPMP
3876 * * Request Payload: N/A
3877 * * Response Payload: @ref mrq_gears_response
3878 * @addtogroup Gears
3879 * @{
3880 */
3881
3882/**
3883 * @brief Response to #MRQ_GEARS
3884 *
3885 * Used by the sender of an #MRQ_GEARS message to request thresholds
3886 * for NDIV offset switching.
3887 *
3888 * The mrq_gears_response::ncpu array defines four thresholds in units
3889 * of number of online CPUS to be used for choosing between five different
3890 * NDIV offset settings for CCPLEX cluster NAFLLs
3891 *
3892 * 1. If number of online CPUs < ncpu[0] use offset0
3893 * 2. If number of online CPUs < ncpu[1] use offset1
3894 * 3. If number of online CPUs < ncpu[2] use offset2
3895 * 4. If number of online CPUs < ncpu[3] use offset3
3896 * 5. If number of online CPUs >= ncpu[3] disable offsetting
3897 *
3898 * For TH500 mrq_gears_response::ncpu array has four valid entries.
3899 *
3900 * mrq_response::err is
3901 * * 0: gears defined and response data valid
3902 * * -#BPMP_ENODEV: MRQ is not supported by BPMP-FW
3903 * * -#BPMP_EACCES: Operation not permitted for the MRQ master
3904 * * -#BPMP_ENAVAIL: NDIV offsetting is disabled
3905 */
3906struct mrq_gears_response {
3907 /** @brief number of online CPUs for each gear */
3908 uint32_t ncpu[16];
3909} BPMP_ABI_PACKED;
3910
3911/** @} Gears */
3912/** @endcond bpmp_th500 */
3913
3914/**
3915 * @addtogroup Error_Codes
3916 * Negative values for mrq_response::err generally indicate some
3917 * error. The ABI defines the following error codes. Negating these
3918 * defines is an exercise left to the user.
3919 * @{
3920 */
3921
3922/** @brief Operation not permitted */
3923#define BPMP_EPERM 1
3924/** @brief No such file or directory */
3925#define BPMP_ENOENT 2
3926/** @brief No MRQ handler */
3927#define BPMP_ENOHANDLER 3
3928/** @brief I/O error */
3929#define BPMP_EIO 5
3930/** @brief Bad sub-MRQ command */
3931#define BPMP_EBADCMD 6
3932/** @brief Resource temporarily unavailable */
3933#define BPMP_EAGAIN 11
3934/** @brief Not enough memory */
3935#define BPMP_ENOMEM 12
3936/** @brief Permission denied */
3937#define BPMP_EACCES 13
3938/** @brief Bad address */
3939#define BPMP_EFAULT 14
3940/** @brief Resource busy */
3941#define BPMP_EBUSY 16
3942/** @brief No such device */
3943#define BPMP_ENODEV 19
3944/** @brief Argument is a directory */
3945#define BPMP_EISDIR 21
3946/** @brief Invalid argument */
3947#define BPMP_EINVAL 22
3948/** @brief Timeout during operation */
3949#define BPMP_ETIMEDOUT 23
3950/** @brief Out of range */
3951#define BPMP_ERANGE 34
3952/** @brief Function not implemented */
3953#define BPMP_ENOSYS 38
3954/** @brief Invalid slot */
3955#define BPMP_EBADSLT 57
3956/** @brief Invalid message */
3957#define BPMP_EBADMSG 77
3958/** @brief Operation not supported */
3959#define BPMP_EOPNOTSUPP 95
3960/** @brief Targeted resource not available */
3961#define BPMP_ENAVAIL 119
3962/** @brief Not supported */
3963#define BPMP_ENOTSUP 134
3964/** @brief No such device or address */
3965#define BPMP_ENXIO 140
3966
3967/** @} Error_Codes */
3968
3969#if defined(BPMP_ABI_CHECKS)
3970#include "bpmp_abi_checks.h"
3971#endif
3972
3973#endif
1/*
2 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef _ABI_BPMP_ABI_H_
18#define _ABI_BPMP_ABI_H_
19
20#ifdef LK
21#include <stdint.h>
22#endif
23
24#ifndef __ABI_PACKED
25#define __ABI_PACKED __attribute__((packed))
26#endif
27
28#ifdef NO_GCC_EXTENSIONS
29#define EMPTY char empty;
30#define EMPTY_ARRAY 1
31#else
32#define EMPTY
33#define EMPTY_ARRAY 0
34#endif
35
36#ifndef __UNION_ANON
37#define __UNION_ANON
38#endif
39/**
40 * @file
41 */
42
43
44/**
45 * @defgroup MRQ MRQ Messages
46 * @brief Messages sent to/from BPMP via IPC
47 * @{
48 * @defgroup MRQ_Format Message Format
49 * @defgroup MRQ_Codes Message Request (MRQ) Codes
50 * @defgroup MRQ_Payloads Message Payloads
51 * @defgroup Error_Codes Error Codes
52 * @}
53 */
54
55/**
56 * @addtogroup MRQ_Format Message Format
57 * @{
58 * The CPU requests the BPMP to perform a particular service by
59 * sending it an IVC frame containing a single MRQ message. An MRQ
60 * message consists of a @ref mrq_request followed by a payload whose
61 * format depends on mrq_request::mrq.
62 *
63 * The BPMP processes the data and replies with an IVC frame (on the
64 * same IVC channel) containing and MRQ response. An MRQ response
65 * consists of a @ref mrq_response followed by a payload whose format
66 * depends on the associated mrq_request::mrq.
67 *
68 * A well-defined subset of the MRQ messages that the CPU sends to the
69 * BPMP can lead to BPMP eventually sending an MRQ message to the
70 * CPU. For example, when the CPU uses an #MRQ_THERMAL message to set
71 * a thermal trip point, the BPMP may eventually send a single
72 * #MRQ_THERMAL message of its own to the CPU indicating that the trip
73 * point has been crossed.
74 * @}
75 */
76
77/**
78 * @ingroup MRQ_Format
79 * @brief header for an MRQ message
80 *
81 * Provides the MRQ number for the MRQ message: #mrq. The remainder of
82 * the MRQ message is a payload (immediately following the
83 * mrq_request) whose format depends on mrq.
84 */
85struct mrq_request {
86 /** @brief MRQ number of the request */
87 uint32_t mrq;
88 /**
89 * @brief flags providing follow up directions to the receiver
90 *
91 * | Bit | Description |
92 * |-----|--------------------------------------------|
93 * | 1 | ring the sender's doorbell when responding |
94 * | 0 | should be 1 |
95 */
96 uint32_t flags;
97} __ABI_PACKED;
98
99/**
100 * @ingroup MRQ_Format
101 * @brief header for an MRQ response
102 *
103 * Provides an error code for the associated MRQ message. The
104 * remainder of the MRQ response is a payload (immediately following
105 * the mrq_response) whose format depends on the associated
106 * mrq_request::mrq
107 */
108struct mrq_response {
109 /** @brief error code for the MRQ request itself */
110 int32_t err;
111 /** @brief reserved for future use */
112 uint32_t flags;
113} __ABI_PACKED;
114
115/**
116 * @ingroup MRQ_Format
117 * Minimum needed size for an IPC message buffer
118 */
119#define MSG_MIN_SZ 128
120/**
121 * @ingroup MRQ_Format
122 * Minimum size guaranteed for data in an IPC message buffer
123 */
124#define MSG_DATA_MIN_SZ 120
125
126/**
127 * @ingroup MRQ_Codes
128 * @name Legal MRQ codes
129 * These are the legal values for mrq_request::mrq
130 * @{
131 */
132
133#define MRQ_PING 0
134#define MRQ_QUERY_TAG 1
135#define MRQ_MODULE_LOAD 4
136#define MRQ_MODULE_UNLOAD 5
137#define MRQ_TRACE_MODIFY 7
138#define MRQ_WRITE_TRACE 8
139#define MRQ_THREADED_PING 9
140#define MRQ_MODULE_MAIL 11
141#define MRQ_DEBUGFS 19
142#define MRQ_RESET 20
143#define MRQ_I2C 21
144#define MRQ_CLK 22
145#define MRQ_QUERY_ABI 23
146#define MRQ_PG_READ_STATE 25
147#define MRQ_PG_UPDATE_STATE 26
148#define MRQ_THERMAL 27
149#define MRQ_CPU_VHINT 28
150#define MRQ_ABI_RATCHET 29
151#define MRQ_EMC_DVFS_LATENCY 31
152#define MRQ_TRACE_ITER 64
153#define MRQ_RINGBUF_CONSOLE 65
154#define MRQ_PG 66
155
156/** @} */
157
158/**
159 * @ingroup MRQ_Codes
160 * @brief Maximum MRQ code to be sent by CPU software to
161 * BPMP. Subject to change in future
162 */
163#define MAX_CPU_MRQ_ID 66
164
165/**
166 * @addtogroup MRQ_Payloads Message Payloads
167 * @{
168 * @defgroup Ping
169 * @defgroup Query_Tag Query Tag
170 * @defgroup Module Loadable Modules
171 * @defgroup Trace
172 * @defgroup Debugfs
173 * @defgroup Reset
174 * @defgroup I2C
175 * @defgroup Clocks
176 * @defgroup ABI_info ABI Info
177 * @defgroup MC_Flush MC Flush
178 * @defgroup Powergating
179 * @defgroup Thermal
180 * @defgroup Vhint CPU Voltage hint
181 * @defgroup MRQ_Deprecated Deprecated MRQ messages
182 * @defgroup EMC
183 * @defgroup RingbufConsole
184 * @}
185 */
186
187
188/**
189 * @ingroup MRQ_Codes
190 * @def MRQ_PING
191 * @brief A simple ping
192 *
193 * * Platforms: All
194 * * Initiators: Any
195 * * Targets: Any
196 * * Request Payload: @ref mrq_ping_request
197 * * Response Payload: @ref mrq_ping_response
198 *
199 * @ingroup MRQ_Codes
200 * @def MRQ_THREADED_PING
201 * @brief A deeper ping
202 *
203 * * Platforms: All
204 * * Initiators: Any
205 * * Targets: BPMP
206 * * Request Payload: @ref mrq_ping_request
207 * * Response Payload: @ref mrq_ping_response
208 *
209 * Behavior is equivalent to a simple #MRQ_PING except that BPMP
210 * responds from a thread context (providing a slightly more robust
211 * sign of life).
212 *
213 */
214
215/**
216 * @ingroup Ping
217 * @brief request with #MRQ_PING
218 *
219 * Used by the sender of an #MRQ_PING message to request a pong from
220 * recipient. The response from the recipient is computed based on
221 * #challenge.
222 */
223struct mrq_ping_request {
224/** @brief arbitrarily chosen value */
225 uint32_t challenge;
226} __ABI_PACKED;
227
228/**
229 * @ingroup Ping
230 * @brief response to #MRQ_PING
231 *
232 * Sent in response to an #MRQ_PING message. #reply should be the
233 * mrq_ping_request challenge left shifted by 1 with the carry-bit
234 * dropped.
235 *
236 */
237struct mrq_ping_response {
238 /** @brief response to the MRQ_PING challege */
239 uint32_t reply;
240} __ABI_PACKED;
241
242/**
243 * @ingroup MRQ_Codes
244 * @def MRQ_QUERY_TAG
245 * @brief Query BPMP firmware's tag (i.e. version information)
246 *
247 * * Platforms: All
248 * * Initiators: CCPLEX
249 * * Targets: BPMP
250 * * Request Payload: @ref mrq_query_tag_request
251 * * Response Payload: N/A
252 *
253 */
254
255/**
256 * @ingroup Query_Tag
257 * @brief request with #MRQ_QUERY_TAG
258 *
259 * Used by #MRQ_QUERY_TAG call to ask BPMP to fill in the memory
260 * pointed by #addr with BPMP firmware header.
261 *
262 * The sender is reponsible for ensuring that #addr is mapped in to
263 * the recipient's address map.
264 */
265struct mrq_query_tag_request {
266 /** @brief base address to store the firmware header */
267 uint32_t addr;
268} __ABI_PACKED;
269
270/**
271 * @ingroup MRQ_Codes
272 * @def MRQ_MODULE_LOAD
273 * @brief dynamically load a BPMP code module
274 *
275 * * Platforms: All
276 * * Initiators: CCPLEX
277 * * Targets: BPMP
278 * * Request Payload: @ref mrq_module_load_request
279 * * Response Payload: @ref mrq_module_load_response
280 *
281 * @note This MRQ is disabled on production systems
282 *
283 */
284
285/**
286 * @ingroup Module
287 * @brief request with #MRQ_MODULE_LOAD
288 *
289 * Used by #MRQ_MODULE_LOAD calls to ask the recipient to dynamically
290 * load the code located at #phys_addr and having size #size
291 * bytes. #phys_addr is treated as a void pointer.
292 *
293 * The recipient copies the code from #phys_addr to locally allocated
294 * memory prior to responding to this message.
295 *
296 * @todo document the module header format
297 *
298 * The sender is responsible for ensuring that the code is mapped in
299 * the recipient's address map.
300 *
301 */
302struct mrq_module_load_request {
303 /** @brief base address of the code to load. Treated as (void *) */
304 uint32_t phys_addr; /* (void *) */
305 /** @brief size in bytes of code to load */
306 uint32_t size;
307} __ABI_PACKED;
308
309/**
310 * @ingroup Module
311 * @brief response to #MRQ_MODULE_LOAD
312 *
313 * @todo document mrq_response::err
314 */
315struct mrq_module_load_response {
316 /** @brief handle to the loaded module */
317 uint32_t base;
318} __ABI_PACKED;
319
320/**
321 * @ingroup MRQ_Codes
322 * @def MRQ_MODULE_UNLOAD
323 * @brief unload a previously loaded code module
324 *
325 * * Platforms: All
326 * * Initiators: CCPLEX
327 * * Targets: BPMP
328 * * Request Payload: @ref mrq_module_unload_request
329 * * Response Payload: N/A
330 *
331 * @note This MRQ is disabled on production systems
332 */
333
334/**
335 * @ingroup Module
336 * @brief request with #MRQ_MODULE_UNLOAD
337 *
338 * Used by #MRQ_MODULE_UNLOAD calls to request that a previously loaded
339 * module be unloaded.
340 */
341struct mrq_module_unload_request {
342 /** @brief handle of the module to unload */
343 uint32_t base;
344} __ABI_PACKED;
345
346/**
347 * @ingroup MRQ_Codes
348 * @def MRQ_TRACE_MODIFY
349 * @brief modify the set of enabled trace events
350 *
351 * * Platforms: All
352 * * Initiators: CCPLEX
353 * * Targets: BPMP
354 * * Request Payload: @ref mrq_trace_modify_request
355 * * Response Payload: @ref mrq_trace_modify_response
356 *
357 * @note This MRQ is disabled on production systems
358 */
359
360/**
361 * @ingroup Trace
362 * @brief request with #MRQ_TRACE_MODIFY
363 *
364 * Used by %MRQ_TRACE_MODIFY calls to enable or disable specify trace
365 * events. #set takes precedence for any bit set in both #set and
366 * #clr.
367 */
368struct mrq_trace_modify_request {
369 /** @brief bit mask of trace events to disable */
370 uint32_t clr;
371 /** @brief bit mask of trace events to enable */
372 uint32_t set;
373} __ABI_PACKED;
374
375/**
376 * @ingroup Trace
377 * @brief response to #MRQ_TRACE_MODIFY
378 *
379 * Sent in repsonse to an #MRQ_TRACE_MODIFY message. #mask reflects the
380 * state of which events are enabled after the recipient acted on the
381 * message.
382 *
383 */
384struct mrq_trace_modify_response {
385 /** @brief bit mask of trace event enable states */
386 uint32_t mask;
387} __ABI_PACKED;
388
389/**
390 * @ingroup MRQ_Codes
391 * @def MRQ_WRITE_TRACE
392 * @brief Write trace data to a buffer
393 *
394 * * Platforms: All
395 * * Initiators: CCPLEX
396 * * Targets: BPMP
397 * * Request Payload: @ref mrq_write_trace_request
398 * * Response Payload: @ref mrq_write_trace_response
399 *
400 * mrq_response::err depends on the @ref mrq_write_trace_request field
401 * values. err is -#BPMP_EINVAL if size is zero or area is NULL or
402 * area is in an illegal range. A positive value for err indicates the
403 * number of bytes written to area.
404 *
405 * @note This MRQ is disabled on production systems
406 */
407
408/**
409 * @ingroup Trace
410 * @brief request with #MRQ_WRITE_TRACE
411 *
412 * Used by MRQ_WRITE_TRACE calls to ask the recipient to copy trace
413 * data from the recipient's local buffer to the output buffer. #area
414 * is treated as a byte-aligned pointer in the recipient's address
415 * space.
416 *
417 * The sender is responsible for ensuring that the output
418 * buffer is mapped in the recipient's address map. The recipient is
419 * responsible for protecting its own code and data from accidental
420 * overwrites.
421 */
422struct mrq_write_trace_request {
423 /** @brief base address of output buffer */
424 uint32_t area;
425 /** @brief size in bytes of the output buffer */
426 uint32_t size;
427} __ABI_PACKED;
428
429/**
430 * @ingroup Trace
431 * @brief response to #MRQ_WRITE_TRACE
432 *
433 * Once this response is sent, the respondent will not access the
434 * output buffer further.
435 */
436struct mrq_write_trace_response {
437 /**
438 * @brief flag whether more data remains in local buffer
439 *
440 * Value is 1 if the entire local trace buffer has been
441 * drained to the outputbuffer. Value is 0 otherwise.
442 */
443 uint32_t eof;
444} __ABI_PACKED;
445
446/** @private */
447struct mrq_threaded_ping_request {
448 uint32_t challenge;
449} __ABI_PACKED;
450
451/** @private */
452struct mrq_threaded_ping_response {
453 uint32_t reply;
454} __ABI_PACKED;
455
456/**
457 * @ingroup MRQ_Codes
458 * @def MRQ_MODULE_MAIL
459 * @brief send a message to a loadable module
460 *
461 * * Platforms: All
462 * * Initiators: Any
463 * * Targets: BPMP
464 * * Request Payload: @ref mrq_module_mail_request
465 * * Response Payload: @ref mrq_module_mail_response
466 *
467 * @note This MRQ is disabled on production systems
468 */
469
470/**
471 * @ingroup Module
472 * @brief request with #MRQ_MODULE_MAIL
473 */
474struct mrq_module_mail_request {
475 /** @brief handle to the previously loaded module */
476 uint32_t base;
477 /** @brief module-specific mail payload
478 *
479 * The length of data[ ] is unknown to the BPMP core firmware
480 * but it is limited to the size of an IPC message.
481 */
482 uint8_t data[EMPTY_ARRAY];
483} __ABI_PACKED;
484
485/**
486 * @ingroup Module
487 * @brief response to #MRQ_MODULE_MAIL
488 */
489struct mrq_module_mail_response {
490 /** @brief module-specific mail payload
491 *
492 * The length of data[ ] is unknown to the BPMP core firmware
493 * but it is limited to the size of an IPC message.
494 */
495 uint8_t data[EMPTY_ARRAY];
496} __ABI_PACKED;
497
498/**
499 * @ingroup MRQ_Codes
500 * @def MRQ_DEBUGFS
501 * @brief Interact with BPMP's debugfs file nodes
502 *
503 * * Platforms: T186
504 * * Initiators: Any
505 * * Targets: BPMP
506 * * Request Payload: @ref mrq_debugfs_request
507 * * Response Payload: @ref mrq_debugfs_response
508 */
509
510/**
511 * @addtogroup Debugfs
512 * @{
513 *
514 * The BPMP firmware implements a pseudo-filesystem called
515 * debugfs. Any driver within the firmware may register with debugfs
516 * to expose an arbitrary set of "files" in the filesystem. When
517 * software on the CPU writes to a debugfs file, debugfs passes the
518 * written data to a callback provided by the driver. When software on
519 * the CPU reads a debugfs file, debugfs queries the driver for the
520 * data to return to the CPU. The intention of the debugfs filesystem
521 * is to provide information useful for debugging the system at
522 * runtime.
523 *
524 * @note The files exposed via debugfs are not part of the
525 * BPMP firmware's ABI. debugfs files may be added or removed in any
526 * given version of the firmware. Typically the semantics of a debugfs
527 * file are consistent from version to version but even that is not
528 * guaranteed.
529 *
530 * @}
531 */
532/** @ingroup Debugfs */
533enum mrq_debugfs_commands {
534 CMD_DEBUGFS_READ = 1,
535 CMD_DEBUGFS_WRITE = 2,
536 CMD_DEBUGFS_DUMPDIR = 3,
537 CMD_DEBUGFS_MAX
538};
539
540/**
541 * @ingroup Debugfs
542 * @brief parameters for CMD_DEBUGFS_READ/WRITE command
543 */
544struct cmd_debugfs_fileop_request {
545 /** @brief physical address pointing at filename */
546 uint32_t fnameaddr;
547 /** @brief length in bytes of filename buffer */
548 uint32_t fnamelen;
549 /** @brief physical address pointing to data buffer */
550 uint32_t dataaddr;
551 /** @brief length in bytes of data buffer */
552 uint32_t datalen;
553} __ABI_PACKED;
554
555/**
556 * @ingroup Debugfs
557 * @brief parameters for CMD_DEBUGFS_READ/WRITE command
558 */
559struct cmd_debugfs_dumpdir_request {
560 /** @brief physical address pointing to data buffer */
561 uint32_t dataaddr;
562 /** @brief length in bytes of data buffer */
563 uint32_t datalen;
564} __ABI_PACKED;
565
566/**
567 * @ingroup Debugfs
568 * @brief response data for CMD_DEBUGFS_READ/WRITE command
569 */
570struct cmd_debugfs_fileop_response {
571 /** @brief always 0 */
572 uint32_t reserved;
573 /** @brief number of bytes read from or written to data buffer */
574 uint32_t nbytes;
575} __ABI_PACKED;
576
577/**
578 * @ingroup Debugfs
579 * @brief response data for CMD_DEBUGFS_DUMPDIR command
580 */
581struct cmd_debugfs_dumpdir_response {
582 /** @brief always 0 */
583 uint32_t reserved;
584 /** @brief number of bytes read from or written to data buffer */
585 uint32_t nbytes;
586} __ABI_PACKED;
587
588/**
589 * @ingroup Debugfs
590 * @brief request with #MRQ_DEBUGFS.
591 *
592 * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs
593 * command to execute. Legal commands are the values of @ref
594 * mrq_debugfs_commands. Each command requires a specific additional
595 * payload of data.
596 *
597 * |command |payload|
598 * |-------------------|-------|
599 * |CMD_DEBUGFS_READ |fop |
600 * |CMD_DEBUGFS_WRITE |fop |
601 * |CMD_DEBUGFS_DUMPDIR|dumpdir|
602 */
603struct mrq_debugfs_request {
604 uint32_t cmd;
605 union {
606 struct cmd_debugfs_fileop_request fop;
607 struct cmd_debugfs_dumpdir_request dumpdir;
608 } __UNION_ANON;
609} __ABI_PACKED;
610
611/**
612 * @ingroup Debugfs
613 */
614struct mrq_debugfs_response {
615 /** @brief always 0 */
616 int32_t reserved;
617 union {
618 /** @brief response data for CMD_DEBUGFS_READ OR
619 * CMD_DEBUGFS_WRITE command
620 */
621 struct cmd_debugfs_fileop_response fop;
622 /** @brief response data for CMD_DEBUGFS_DUMPDIR command */
623 struct cmd_debugfs_dumpdir_response dumpdir;
624 } __UNION_ANON;
625} __ABI_PACKED;
626
627/**
628 * @addtogroup Debugfs
629 * @{
630 */
631#define DEBUGFS_S_ISDIR (1 << 9)
632#define DEBUGFS_S_IRUSR (1 << 8)
633#define DEBUGFS_S_IWUSR (1 << 7)
634/** @} */
635
636
637/**
638 * @ingroup MRQ_Codes
639 * @def MRQ_RESET
640 * @brief reset an IP block
641 *
642 * * Platforms: T186
643 * * Initiators: Any
644 * * Targets: BPMP
645 * * Request Payload: @ref mrq_reset_request
646 * * Response Payload: @ref mrq_reset_response
647 */
648
649/**
650 * @ingroup Reset
651 */
652enum mrq_reset_commands {
653 CMD_RESET_ASSERT = 1,
654 CMD_RESET_DEASSERT = 2,
655 CMD_RESET_MODULE = 3,
656 CMD_RESET_GET_MAX_ID = 4,
657 CMD_RESET_MAX, /* not part of ABI and subject to change */
658};
659
660/**
661 * @ingroup Reset
662 * @brief request with MRQ_RESET
663 *
664 * Used by the sender of an #MRQ_RESET message to request BPMP to
665 * assert or or deassert a given reset line.
666 */
667struct mrq_reset_request {
668 /** @brief reset action to perform (@enum mrq_reset_commands) */
669 uint32_t cmd;
670 /** @brief id of the reset to affected */
671 uint32_t reset_id;
672} __ABI_PACKED;
673
674/**
675 * @ingroup Reset
676 * @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When
677 * this sub-command is not supported, firmware will return -BPMP_EBADCMD
678 * in mrq_response::err.
679 */
680struct cmd_reset_get_max_id_response {
681 /** @brief max reset id */
682 uint32_t max_id;
683} __ABI_PACKED;
684
685/**
686 * @ingroup Reset
687 * @brief Response with MRQ_RESET
688 *
689 * Each sub-command supported by @ref mrq_reset_request may return
690 * sub-command-specific data. Some do and some do not as indicated
691 * in the following table
692 *
693 * | sub-command | payload |
694 * |----------------------|------------------|
695 * | CMD_RESET_ASSERT | - |
696 * | CMD_RESET_DEASSERT | - |
697 * | CMD_RESET_MODULE | - |
698 * | CMD_RESET_GET_MAX_ID | reset_get_max_id |
699 */
700struct mrq_reset_response {
701 union {
702 struct cmd_reset_get_max_id_response reset_get_max_id;
703 } __UNION_ANON;
704} __ABI_PACKED;
705
706/**
707 * @ingroup MRQ_Codes
708 * @def MRQ_I2C
709 * @brief issue an i2c transaction
710 *
711 * * Platforms: T186
712 * * Initiators: Any
713 * * Targets: BPMP
714 * * Request Payload: @ref mrq_i2c_request
715 * * Response Payload: @ref mrq_i2c_response
716 */
717
718/**
719 * @addtogroup I2C
720 * @{
721 */
722#define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE (MSG_DATA_MIN_SZ - 12)
723#define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE (MSG_DATA_MIN_SZ - 4)
724/** @} */
725
726/**
727 * @ingroup I2C
728 * @name Serial I2C flags
729 * Use these flags with serial_i2c_request::flags
730 * @{
731 */
732#define SERIALI2C_TEN 0x0010
733#define SERIALI2C_RD 0x0001
734#define SERIALI2C_STOP 0x8000
735#define SERIALI2C_NOSTART 0x4000
736#define SERIALI2C_REV_DIR_ADDR 0x2000
737#define SERIALI2C_IGNORE_NAK 0x1000
738#define SERIALI2C_NO_RD_ACK 0x0800
739#define SERIALI2C_RECV_LEN 0x0400
740/** @} */
741/** @ingroup I2C */
742enum {
743 CMD_I2C_XFER = 1
744};
745
746/**
747 * @ingroup I2C
748 * @brief serializable i2c request
749 *
750 * Instances of this structure are packed (little-endian) into
751 * cmd_i2c_xfer_request::data_buf. Each instance represents a single
752 * transaction (or a portion of a transaction with repeated starts) on
753 * an i2c bus.
754 *
755 * Because these structures are packed, some instances are likely to
756 * be misaligned. Additionally because #data is variable length, it is
757 * not possible to iterate through a serialized list of these
758 * structures without inspecting #len in each instance. It may be
759 * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf
760 * manually rather than using this structure definition.
761*/
762struct serial_i2c_request {
763 /** @brief I2C slave address */
764 uint16_t addr;
765 /** @brief bitmask of SERIALI2C_ flags */
766 uint16_t flags;
767 /** @brief length of I2C transaction in bytes */
768 uint16_t len;
769 /** @brief for write transactions only, #len bytes of data */
770 uint8_t data[];
771} __ABI_PACKED;
772
773/**
774 * @ingroup I2C
775 * @brief trigger one or more i2c transactions
776 */
777struct cmd_i2c_xfer_request {
778 /** @brief valid bus number from mach-t186/i2c-t186.h*/
779 uint32_t bus_id;
780
781 /** @brief count of valid bytes in #data_buf*/
782 uint32_t data_size;
783
784 /** @brief serialized packed instances of @ref serial_i2c_request*/
785 uint8_t data_buf[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE];
786} __ABI_PACKED;
787
788/**
789 * @ingroup I2C
790 * @brief container for data read from the i2c bus
791 *
792 * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute
793 * zero or more I2C reads. The data read from the bus is serialized
794 * into #data_buf.
795 */
796struct cmd_i2c_xfer_response {
797 /** @brief count of valid bytes in #data_buf*/
798 uint32_t data_size;
799 /** @brief i2c read data */
800 uint8_t data_buf[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE];
801} __ABI_PACKED;
802
803/**
804 * @ingroup I2C
805 * @brief request with #MRQ_I2C
806 */
807struct mrq_i2c_request {
808 /** @brief always CMD_I2C_XFER (i.e. 1) */
809 uint32_t cmd;
810 /** @brief parameters of the transfer request */
811 struct cmd_i2c_xfer_request xfer;
812} __ABI_PACKED;
813
814/**
815 * @ingroup I2C
816 * @brief response to #MRQ_I2C
817 */
818struct mrq_i2c_response {
819 struct cmd_i2c_xfer_response xfer;
820} __ABI_PACKED;
821
822/**
823 * @ingroup MRQ_Codes
824 * @def MRQ_CLK
825 *
826 * * Platforms: T186
827 * * Initiators: Any
828 * * Targets: BPMP
829 * * Request Payload: @ref mrq_clk_request
830 * * Response Payload: @ref mrq_clk_response
831 * @addtogroup Clocks
832 * @{
833 */
834
835/**
836 * @name MRQ_CLK sub-commands
837 * @{
838 */
839enum {
840 CMD_CLK_GET_RATE = 1,
841 CMD_CLK_SET_RATE = 2,
842 CMD_CLK_ROUND_RATE = 3,
843 CMD_CLK_GET_PARENT = 4,
844 CMD_CLK_SET_PARENT = 5,
845 CMD_CLK_IS_ENABLED = 6,
846 CMD_CLK_ENABLE = 7,
847 CMD_CLK_DISABLE = 8,
848 CMD_CLK_GET_ALL_INFO = 14,
849 CMD_CLK_GET_MAX_CLK_ID = 15,
850 CMD_CLK_MAX,
851};
852/** @} */
853
854/**
855 * @name MRQ_CLK properties
856 * Flag bits for cmd_clk_properties_response::flags and
857 * cmd_clk_get_all_info_response::flags
858 * @{
859 */
860#define BPMP_CLK_HAS_MUX (1 << 0)
861#define BPMP_CLK_HAS_SET_RATE (1 << 1)
862#define BPMP_CLK_IS_ROOT (1 << 2)
863/** @} */
864
865#define MRQ_CLK_NAME_MAXLEN 40
866#define MRQ_CLK_MAX_PARENTS 16
867
868/** @private */
869struct cmd_clk_get_rate_request {
870 EMPTY
871} __ABI_PACKED;
872
873struct cmd_clk_get_rate_response {
874 int64_t rate;
875} __ABI_PACKED;
876
877struct cmd_clk_set_rate_request {
878 int32_t unused;
879 int64_t rate;
880} __ABI_PACKED;
881
882struct cmd_clk_set_rate_response {
883 int64_t rate;
884} __ABI_PACKED;
885
886struct cmd_clk_round_rate_request {
887 int32_t unused;
888 int64_t rate;
889} __ABI_PACKED;
890
891struct cmd_clk_round_rate_response {
892 int64_t rate;
893} __ABI_PACKED;
894
895/** @private */
896struct cmd_clk_get_parent_request {
897 EMPTY
898} __ABI_PACKED;
899
900struct cmd_clk_get_parent_response {
901 uint32_t parent_id;
902} __ABI_PACKED;
903
904struct cmd_clk_set_parent_request {
905 uint32_t parent_id;
906} __ABI_PACKED;
907
908struct cmd_clk_set_parent_response {
909 uint32_t parent_id;
910} __ABI_PACKED;
911
912/** @private */
913struct cmd_clk_is_enabled_request {
914 EMPTY
915} __ABI_PACKED;
916
917struct cmd_clk_is_enabled_response {
918 int32_t state;
919} __ABI_PACKED;
920
921/** @private */
922struct cmd_clk_enable_request {
923 EMPTY
924} __ABI_PACKED;
925
926/** @private */
927struct cmd_clk_enable_response {
928 EMPTY
929} __ABI_PACKED;
930
931/** @private */
932struct cmd_clk_disable_request {
933 EMPTY
934} __ABI_PACKED;
935
936/** @private */
937struct cmd_clk_disable_response {
938 EMPTY
939} __ABI_PACKED;
940
941/** @private */
942struct cmd_clk_get_all_info_request {
943 EMPTY
944} __ABI_PACKED;
945
946struct cmd_clk_get_all_info_response {
947 uint32_t flags;
948 uint32_t parent;
949 uint32_t parents[MRQ_CLK_MAX_PARENTS];
950 uint8_t num_parents;
951 uint8_t name[MRQ_CLK_NAME_MAXLEN];
952} __ABI_PACKED;
953
954/** @private */
955struct cmd_clk_get_max_clk_id_request {
956 EMPTY
957} __ABI_PACKED;
958
959struct cmd_clk_get_max_clk_id_response {
960 uint32_t max_id;
961} __ABI_PACKED;
962/** @} */
963
964/**
965 * @ingroup Clocks
966 * @brief request with #MRQ_CLK
967 *
968 * Used by the sender of an #MRQ_CLK message to control clocks. The
969 * clk_request is split into several sub-commands. Some sub-commands
970 * require no additional data. Others have a sub-command specific
971 * payload
972 *
973 * |sub-command |payload |
974 * |----------------------------|-----------------------|
975 * |CMD_CLK_GET_RATE |- |
976 * |CMD_CLK_SET_RATE |clk_set_rate |
977 * |CMD_CLK_ROUND_RATE |clk_round_rate |
978 * |CMD_CLK_GET_PARENT |- |
979 * |CMD_CLK_SET_PARENT |clk_set_parent |
980 * |CMD_CLK_IS_ENABLED |- |
981 * |CMD_CLK_ENABLE |- |
982 * |CMD_CLK_DISABLE |- |
983 * |CMD_CLK_GET_ALL_INFO |- |
984 * |CMD_CLK_GET_MAX_CLK_ID |- |
985 *
986 */
987
988struct mrq_clk_request {
989 /** @brief sub-command and clock id concatenated to 32-bit word.
990 * - bits[31..24] is the sub-cmd.
991 * - bits[23..0] is the clock id
992 */
993 uint32_t cmd_and_id;
994
995 union {
996 /** @private */
997 struct cmd_clk_get_rate_request clk_get_rate;
998 struct cmd_clk_set_rate_request clk_set_rate;
999 struct cmd_clk_round_rate_request clk_round_rate;
1000 /** @private */
1001 struct cmd_clk_get_parent_request clk_get_parent;
1002 struct cmd_clk_set_parent_request clk_set_parent;
1003 /** @private */
1004 struct cmd_clk_enable_request clk_enable;
1005 /** @private */
1006 struct cmd_clk_disable_request clk_disable;
1007 /** @private */
1008 struct cmd_clk_is_enabled_request clk_is_enabled;
1009 /** @private */
1010 struct cmd_clk_get_all_info_request clk_get_all_info;
1011 /** @private */
1012 struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id;
1013 } __UNION_ANON;
1014} __ABI_PACKED;
1015
1016/**
1017 * @ingroup Clocks
1018 * @brief response to MRQ_CLK
1019 *
1020 * Each sub-command supported by @ref mrq_clk_request may return
1021 * sub-command-specific data. Some do and some do not as indicated in
1022 * the following table
1023 *
1024 * |sub-command |payload |
1025 * |----------------------------|------------------------|
1026 * |CMD_CLK_GET_RATE |clk_get_rate |
1027 * |CMD_CLK_SET_RATE |clk_set_rate |
1028 * |CMD_CLK_ROUND_RATE |clk_round_rate |
1029 * |CMD_CLK_GET_PARENT |clk_get_parent |
1030 * |CMD_CLK_SET_PARENT |clk_set_parent |
1031 * |CMD_CLK_IS_ENABLED |clk_is_enabled |
1032 * |CMD_CLK_ENABLE |- |
1033 * |CMD_CLK_DISABLE |- |
1034 * |CMD_CLK_GET_ALL_INFO |clk_get_all_info |
1035 * |CMD_CLK_GET_MAX_CLK_ID |clk_get_max_id |
1036 *
1037 */
1038
1039struct mrq_clk_response {
1040 union {
1041 struct cmd_clk_get_rate_response clk_get_rate;
1042 struct cmd_clk_set_rate_response clk_set_rate;
1043 struct cmd_clk_round_rate_response clk_round_rate;
1044 struct cmd_clk_get_parent_response clk_get_parent;
1045 struct cmd_clk_set_parent_response clk_set_parent;
1046 /** @private */
1047 struct cmd_clk_enable_response clk_enable;
1048 /** @private */
1049 struct cmd_clk_disable_response clk_disable;
1050 struct cmd_clk_is_enabled_response clk_is_enabled;
1051 struct cmd_clk_get_all_info_response clk_get_all_info;
1052 struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id;
1053 } __UNION_ANON;
1054} __ABI_PACKED;
1055
1056/**
1057 * @ingroup MRQ_Codes
1058 * @def MRQ_QUERY_ABI
1059 * @brief check if an MRQ is implemented
1060 *
1061 * * Platforms: All
1062 * * Initiators: Any
1063 * * Targets: Any except DMCE
1064 * * Request Payload: @ref mrq_query_abi_request
1065 * * Response Payload: @ref mrq_query_abi_response
1066 */
1067
1068/**
1069 * @ingroup ABI_info
1070 * @brief request with MRQ_QUERY_ABI
1071 *
1072 * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported
1073 * by the recipient.
1074 */
1075struct mrq_query_abi_request {
1076 /** @brief MRQ code to query */
1077 uint32_t mrq;
1078} __ABI_PACKED;
1079
1080/**
1081 * @ingroup ABI_info
1082 * @brief response to MRQ_QUERY_ABI
1083 *
1084 * @note mrq_response::err of 0 indicates that the query was
1085 * successful, not that the MRQ itself is supported!
1086 */
1087struct mrq_query_abi_response {
1088 /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */
1089 int32_t status;
1090} __ABI_PACKED;
1091
1092/**
1093 * @ingroup MRQ_Codes
1094 * @def MRQ_PG_READ_STATE
1095 * @brief read the power-gating state of a partition
1096 *
1097 * * Platforms: T186
1098 * * Initiators: Any
1099 * * Targets: BPMP
1100 * * Request Payload: @ref mrq_pg_read_state_request
1101 * * Response Payload: @ref mrq_pg_read_state_response
1102 * @addtogroup Powergating
1103 * @{
1104 */
1105
1106/**
1107 * @brief request with #MRQ_PG_READ_STATE
1108 *
1109 * Used by MRQ_PG_READ_STATE call to read the current state of a
1110 * partition.
1111 */
1112struct mrq_pg_read_state_request {
1113 /** @brief ID of partition */
1114 uint32_t partition_id;
1115} __ABI_PACKED;
1116
1117/**
1118 * @brief response to MRQ_PG_READ_STATE
1119 * @todo define possible errors.
1120 */
1121struct mrq_pg_read_state_response {
1122 /** @brief read as don't care */
1123 uint32_t sram_state;
1124 /** @brief state of power partition
1125 * * 0 : off
1126 * * 1 : on
1127 */
1128 uint32_t logic_state;
1129} __ABI_PACKED;
1130
1131/** @} */
1132
1133/**
1134 * @ingroup MRQ_Codes
1135 * @def MRQ_PG_UPDATE_STATE
1136 * @brief modify the power-gating state of a partition. In contrast to
1137 * MRQ_PG calls, the operations that change state (on/off) of power
1138 * partition are reference counted.
1139 *
1140 * * Platforms: T186
1141 * * Initiators: Any
1142 * * Targets: BPMP
1143 * * Request Payload: @ref mrq_pg_update_state_request
1144 * * Response Payload: N/A
1145 * @addtogroup Powergating
1146 * @{
1147 */
1148
1149/**
1150 * @brief request with mrq_pg_update_state_request
1151 *
1152 * Used by #MRQ_PG_UPDATE_STATE call to request BPMP to change the
1153 * state of a power partition #partition_id.
1154 */
1155struct mrq_pg_update_state_request {
1156 /** @brief ID of partition */
1157 uint32_t partition_id;
1158 /** @brief secondary control of power partition
1159 * @details Ignored by many versions of the BPMP
1160 * firmware. For maximum compatibility, set the value
1161 * according to @logic_state
1162 * * 0x1: power ON partition (@ref logic_state == 0x3)
1163 * * 0x3: power OFF partition (@ref logic_state == 0x1)
1164 */
1165 uint32_t sram_state;
1166 /** @brief controls state of power partition, legal values are
1167 * * 0x1 : power OFF partition
1168 * * 0x3 : power ON partition
1169 */
1170 uint32_t logic_state;
1171 /** @brief change state of clocks of the power partition, legal values
1172 * * 0x0 : do not change clock state
1173 * * 0x1 : disable partition clocks (only applicable when
1174 * @ref logic_state == 0x1)
1175 * * 0x3 : enable partition clocks (only applicable when
1176 * @ref logic_state == 0x3)
1177 */
1178 uint32_t clock_state;
1179} __ABI_PACKED;
1180/** @} */
1181
1182/**
1183 * @ingroup MRQ_Codes
1184 * @def MRQ_PG
1185 * @brief Control power-gating state of a partition. In contrast to
1186 * MRQ_PG_UPDATE_STATE, operations that change the power partition
1187 * state are NOT reference counted
1188 *
1189 * * Platforms: T186
1190 * * Initiators: Any
1191 * * Targets: BPMP
1192 * * Request Payload: @ref mrq_pg_request
1193 * * Response Payload: @ref mrq_pg_response
1194 * @addtogroup Powergating
1195 * @{
1196 */
1197
1198/**
1199 * @name MRQ_PG sub-commands
1200 * @{
1201 */
1202enum mrq_pg_cmd {
1203 /**
1204 * @brief Check whether the BPMP driver supports the specified
1205 * request type
1206 *
1207 * mrq_response::err is 0 if the specified request is
1208 * supported and -#BPMP_ENODEV otherwise.
1209 */
1210 CMD_PG_QUERY_ABI = 0,
1211
1212 /**
1213 * @brief Set the current state of specified power domain. The
1214 * possible values for power domains are defined in enum
1215 * pg_states
1216 *
1217 * mrq_response:err is
1218 * 0: Success
1219 * -#BPMP_EINVAL: Invalid request parameters
1220 */
1221 CMD_PG_SET_STATE = 1,
1222
1223 /**
1224 * @brief Get the current state of specified power domain. The
1225 * possible values for power domains are defined in enum
1226 * pg_states
1227 *
1228 * mrq_response:err is
1229 * 0: Success
1230 * -#BPMP_EINVAL: Invalid request parameters
1231 */
1232 CMD_PG_GET_STATE = 2,
1233
1234 /**
1235 * @brief get the name string of specified power domain id.
1236 *
1237 * mrq_response:err is
1238 * 0: Success
1239 * -#BPMP_EINVAL: Invalid request parameters
1240 */
1241 CMD_PG_GET_NAME = 3,
1242
1243
1244 /**
1245 * @brief get the highest power domain id in the system. Not
1246 * all IDs between 0 and max_id are valid IDs.
1247 *
1248 * mrq_response:err is
1249 * 0: Success
1250 * -#BPMP_EINVAL: Invalid request parameters
1251 */
1252 CMD_PG_GET_MAX_ID = 4,
1253};
1254/** @} */
1255
1256#define MRQ_PG_NAME_MAXLEN 40
1257
1258/**
1259 * @brief possible power domain states in
1260 * cmd_pg_set_state_request:state and cmd_pg_get_state_response:state.
1261 * PG_STATE_OFF: power domain is OFF
1262 * PG_STATE_ON: power domain is ON
1263 * PG_STATE_RUNNING: power domain is ON and made into directly usable
1264 * state by turning on the clocks associated with
1265 * the domain
1266 */
1267enum pg_states {
1268 PG_STATE_OFF = 0,
1269 PG_STATE_ON = 1,
1270 PG_STATE_RUNNING = 2,
1271};
1272
1273struct cmd_pg_query_abi_request {
1274 uint32_t type; /* enum mrq_pg_cmd */
1275} __ABI_PACKED;
1276
1277struct cmd_pg_set_state_request {
1278 uint32_t state; /* enum pg_states */
1279} __ABI_PACKED;
1280
1281struct cmd_pg_get_state_response {
1282 uint32_t state; /* enum pg_states */
1283} __ABI_PACKED;
1284
1285struct cmd_pg_get_name_response {
1286 uint8_t name[MRQ_PG_NAME_MAXLEN];
1287} __ABI_PACKED;
1288
1289struct cmd_pg_get_max_id_response {
1290 uint32_t max_id;
1291} __ABI_PACKED;
1292
1293/**
1294 * @ingroup Powergating
1295 * @brief request with #MRQ_PG
1296 *
1297 * Used by the sender of an #MRQ_PG message to control power
1298 * partitions. The pg_request is split into several sub-commands. Some
1299 * sub-commands require no additional data. Others have a sub-command
1300 * specific payload
1301 *
1302 * |sub-command |payload |
1303 * |----------------------------|-----------------------|
1304 * |CMD_PG_QUERY_ABI | query_abi |
1305 * |CMD_PG_SET_STATE | set_state |
1306 * |CMD_PG_GET_STATE | - |
1307 * |CMD_PG_GET_NAME | - |
1308 * |CMD_PG_GET_MAX_ID | - |
1309 *
1310 */
1311
1312struct mrq_pg_request {
1313 uint32_t cmd;
1314 uint32_t id;
1315 union {
1316 struct cmd_pg_query_abi_request query_abi;
1317 struct cmd_pg_set_state_request set_state;
1318 } __UNION_ANON;
1319} __ABI_PACKED;
1320
1321/**
1322 * @ingroup Powergating
1323 * @brief response to MRQ_PG
1324 *
1325 * Each sub-command supported by @ref mrq_pg_request may return
1326 * sub-command-specific data. Some do and some do not as indicated in
1327 * the following table
1328 *
1329 * |sub-command |payload |
1330 * |----------------------------|-----------------------|
1331 * |CMD_PG_QUERY_ABI | - |
1332 * |CMD_PG_SET_STATE | - |
1333 * |CMD_PG_GET_STATE | get_state |
1334 * |CMD_PG_GET_NAME | get_name |
1335 * |CMD_PG_GET_MAX_ID | get_max_id |
1336 *
1337 */
1338
1339struct mrq_pg_response {
1340 union {
1341 struct cmd_pg_get_state_response get_state;
1342 struct cmd_pg_get_name_response get_name;
1343 struct cmd_pg_get_max_id_response get_max_id;
1344 } __UNION_ANON;
1345} __ABI_PACKED;
1346
1347/**
1348 * @ingroup MRQ_Codes
1349 * @def MRQ_THERMAL
1350 * @brief interact with BPMP thermal framework
1351 *
1352 * * Platforms: T186
1353 * * Initiators: Any
1354 * * Targets: Any
1355 * * Request Payload: TODO
1356 * * Response Payload: TODO
1357 *
1358 * @addtogroup Thermal
1359 *
1360 * The BPMP firmware includes a thermal framework. Drivers within the
1361 * bpmp firmware register with the framework to provide thermal
1362 * zones. Each thermal zone corresponds to an entity whose temperature
1363 * can be measured. The framework also has a notion of trip points. A
1364 * trip point consists of a thermal zone id, a temperature, and a
1365 * callback routine. The framework invokes the callback when the zone
1366 * hits the indicated temperature. The BPMP firmware uses this thermal
1367 * framework interally to implement various temperature-dependent
1368 * functions.
1369 *
1370 * Software on the CPU can use #MRQ_THERMAL (with payload @ref
1371 * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal
1372 * framework. The CPU must It can query the number of supported zones,
1373 * query zone temperatures, and set trip points.
1374 *
1375 * When a trip point set by the CPU gets crossed, BPMP firmware issues
1376 * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a
1377 * payload of @ref mrq_thermal_bpmp_to_host_request.
1378 * @{
1379 */
1380enum mrq_thermal_host_to_bpmp_cmd {
1381 /**
1382 * @brief Check whether the BPMP driver supports the specified
1383 * request type.
1384 *
1385 * Host needs to supply request parameters.
1386 *
1387 * mrq_response::err is 0 if the specified request is
1388 * supported and -#BPMP_ENODEV otherwise.
1389 */
1390 CMD_THERMAL_QUERY_ABI = 0,
1391
1392 /**
1393 * @brief Get the current temperature of the specified zone.
1394 *
1395 * Host needs to supply request parameters.
1396 *
1397 * mrq_response::err is
1398 * * 0: Temperature query succeeded.
1399 * * -#BPMP_EINVAL: Invalid request parameters.
1400 * * -#BPMP_ENOENT: No driver registered for thermal zone..
1401 * * -#BPMP_EFAULT: Problem reading temperature measurement.
1402 */
1403 CMD_THERMAL_GET_TEMP = 1,
1404
1405 /**
1406 * @brief Enable or disable and set the lower and upper
1407 * thermal limits for a thermal trip point. Each zone has
1408 * one trip point.
1409 *
1410 * Host needs to supply request parameters. Once the
1411 * temperature hits a trip point, the BPMP will send a message
1412 * to the CPU having MRQ=MRQ_THERMAL and
1413 * type=CMD_THERMAL_HOST_TRIP_REACHED
1414 *
1415 * mrq_response::err is
1416 * * 0: Trip successfully set.
1417 * * -#BPMP_EINVAL: Invalid request parameters.
1418 * * -#BPMP_ENOENT: No driver registered for thermal zone.
1419 * * -#BPMP_EFAULT: Problem setting trip point.
1420 */
1421 CMD_THERMAL_SET_TRIP = 2,
1422
1423 /**
1424 * @brief Get the number of supported thermal zones.
1425 *
1426 * No request parameters required.
1427 *
1428 * mrq_response::err is always 0, indicating success.
1429 */
1430 CMD_THERMAL_GET_NUM_ZONES = 3,
1431
1432 /** @brief: number of supported host-to-bpmp commands. May
1433 * increase in future
1434 */
1435 CMD_THERMAL_HOST_TO_BPMP_NUM
1436};
1437
1438enum mrq_thermal_bpmp_to_host_cmd {
1439 /**
1440 * @brief Indication that the temperature for a zone has
1441 * exceeded the range indicated in the thermal trip point
1442 * for the zone.
1443 *
1444 * BPMP needs to supply request parameters. Host only needs to
1445 * acknowledge.
1446 */
1447 CMD_THERMAL_HOST_TRIP_REACHED = 100,
1448
1449 /** @brief: number of supported bpmp-to-host commands. May
1450 * increase in future
1451 */
1452 CMD_THERMAL_BPMP_TO_HOST_NUM
1453};
1454
1455/*
1456 * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI
1457 *
1458 * zone: Request type for which to check existence.
1459 */
1460struct cmd_thermal_query_abi_request {
1461 uint32_t type;
1462} __ABI_PACKED;
1463
1464/*
1465 * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP
1466 *
1467 * zone: Number of thermal zone.
1468 */
1469struct cmd_thermal_get_temp_request {
1470 uint32_t zone;
1471} __ABI_PACKED;
1472
1473/*
1474 * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP
1475 *
1476 * error: 0 if request succeeded.
1477 * -BPMP_EINVAL if request parameters were invalid.
1478 * -BPMP_ENOENT if no driver was registered for the specified thermal zone.
1479 * -BPMP_EFAULT for other thermal zone driver errors.
1480 * temp: Current temperature in millicelsius.
1481 */
1482struct cmd_thermal_get_temp_response {
1483 int32_t temp;
1484} __ABI_PACKED;
1485
1486/*
1487 * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP
1488 *
1489 * zone: Number of thermal zone.
1490 * low: Temperature of lower trip point in millicelsius
1491 * high: Temperature of upper trip point in millicelsius
1492 * enabled: 1 to enable trip point, 0 to disable trip point
1493 */
1494struct cmd_thermal_set_trip_request {
1495 uint32_t zone;
1496 int32_t low;
1497 int32_t high;
1498 uint32_t enabled;
1499} __ABI_PACKED;
1500
1501/*
1502 * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED
1503 *
1504 * zone: Number of thermal zone where trip point was reached.
1505 */
1506struct cmd_thermal_host_trip_reached_request {
1507 uint32_t zone;
1508} __ABI_PACKED;
1509
1510/*
1511 * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES
1512 *
1513 * num: Number of supported thermal zones. The thermal zones are indexed
1514 * starting from zero.
1515 */
1516struct cmd_thermal_get_num_zones_response {
1517 uint32_t num;
1518} __ABI_PACKED;
1519
1520/*
1521 * Host->BPMP request data.
1522 *
1523 * Reply type is union mrq_thermal_bpmp_to_host_response.
1524 *
1525 * type: Type of request. Values listed in enum mrq_thermal_type.
1526 * data: Request type specific parameters.
1527 */
1528struct mrq_thermal_host_to_bpmp_request {
1529 uint32_t type;
1530 union {
1531 struct cmd_thermal_query_abi_request query_abi;
1532 struct cmd_thermal_get_temp_request get_temp;
1533 struct cmd_thermal_set_trip_request set_trip;
1534 } __UNION_ANON;
1535} __ABI_PACKED;
1536
1537/*
1538 * BPMP->Host request data.
1539 *
1540 * type: Type of request. Values listed in enum mrq_thermal_type.
1541 * data: Request type specific parameters.
1542 */
1543struct mrq_thermal_bpmp_to_host_request {
1544 uint32_t type;
1545 union {
1546 struct cmd_thermal_host_trip_reached_request host_trip_reached;
1547 } __UNION_ANON;
1548} __ABI_PACKED;
1549
1550/*
1551 * Data in reply to a Host->BPMP request.
1552 */
1553union mrq_thermal_bpmp_to_host_response {
1554 struct cmd_thermal_get_temp_response get_temp;
1555 struct cmd_thermal_get_num_zones_response get_num_zones;
1556} __ABI_PACKED;
1557/** @} */
1558
1559/**
1560 * @ingroup MRQ_Codes
1561 * @def MRQ_CPU_VHINT
1562 * @brief Query CPU voltage hint data
1563 *
1564 * * Platforms: T186
1565 * * Initiators: CCPLEX
1566 * * Targets: BPMP
1567 * * Request Payload: @ref mrq_cpu_vhint_request
1568 * * Response Payload: N/A
1569 *
1570 * @addtogroup Vhint CPU Voltage hint
1571 * @{
1572 */
1573
1574/**
1575 * @brief request with #MRQ_CPU_VHINT
1576 *
1577 * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data
1578 * from BPMP to memory space pointed by #addr. CCPLEX is responsible
1579 * to allocate sizeof(cpu_vhint_data) sized block of memory and
1580 * appropriately map it for BPMP before sending the request.
1581 */
1582struct mrq_cpu_vhint_request {
1583 /** @brief IOVA address for the #cpu_vhint_data */
1584 uint32_t addr; /* struct cpu_vhint_data * */
1585 /** @brief ID of the cluster whose data is requested */
1586 uint32_t cluster_id; /* enum cluster_id */
1587} __ABI_PACKED;
1588
1589/**
1590 * @brief description of the CPU v/f relation
1591 *
1592 * Used by #MRQ_CPU_VHINT call to carry data pointed by #addr of
1593 * struct mrq_cpu_vhint_request
1594 */
1595struct cpu_vhint_data {
1596 uint32_t ref_clk_hz; /**< reference frequency in Hz */
1597 uint16_t pdiv; /**< post divider value */
1598 uint16_t mdiv; /**< input divider value */
1599 uint16_t ndiv_max; /**< fMAX expressed with max NDIV value */
1600 /** table of ndiv values as a function of vINDEX (voltage index) */
1601 uint16_t ndiv[80];
1602 /** minimum allowed NDIV value */
1603 uint16_t ndiv_min;
1604 /** minimum allowed voltage hint value (as in vINDEX) */
1605 uint16_t vfloor;
1606 /** maximum allowed voltage hint value (as in vINDEX) */
1607 uint16_t vceil;
1608 /** post-multiplier for vindex value */
1609 uint16_t vindex_mult;
1610 /** post-divider for vindex value */
1611 uint16_t vindex_div;
1612 /** reserved for future use */
1613 uint16_t reserved[328];
1614} __ABI_PACKED;
1615
1616/** @} */
1617
1618/**
1619 * @ingroup MRQ_Codes
1620 * @def MRQ_ABI_RATCHET
1621 * @brief ABI ratchet value query
1622 *
1623 * * Platforms: T186
1624 * * Initiators: Any
1625 * * Targets: BPMP
1626 * * Request Payload: @ref mrq_abi_ratchet_request
1627 * * Response Payload: @ref mrq_abi_ratchet_response
1628 * @addtogroup ABI_info
1629 * @{
1630 */
1631
1632/**
1633 * @brief an ABI compatibility mechanism
1634 *
1635 * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future
1636 * revision of this header file.
1637 * 1. That future revision deprecates some MRQ
1638 * 2. That future revision introduces a breaking change to an existing
1639 * MRQ or
1640 * 3. A bug is discovered in an existing implementation of the BPMP-FW
1641 * (or possibly one of its clients) which warrants deprecating that
1642 * implementation.
1643 */
1644#define BPMP_ABI_RATCHET_VALUE 3
1645
1646/**
1647 * @brief request with #MRQ_ABI_RATCHET.
1648 *
1649 * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header
1650 * against which the requester was compiled.
1651 *
1652 * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may
1653 * reply with mrq_response::err = -#BPMP_ERANGE to indicate that
1654 * BPMP-FW cannot interoperate correctly with the requester. Requester
1655 * should cease further communication with BPMP.
1656 *
1657 * Otherwise, err shall be 0.
1658 */
1659struct mrq_abi_ratchet_request {
1660 /** @brief requester's ratchet value */
1661 uint16_t ratchet;
1662};
1663
1664/**
1665 * @brief response to #MRQ_ABI_RATCHET
1666 *
1667 * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header
1668 * against which BPMP firwmare was compiled.
1669 *
1670 * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE,
1671 * the requster must either interoperate with BPMP according to an ABI
1672 * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease
1673 * communication with BPMP.
1674 *
1675 * If mrq_response::err is 0 and ratchet is greater than or equal to the
1676 * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue
1677 * normal operation.
1678 */
1679struct mrq_abi_ratchet_response {
1680 /** @brief BPMP's ratchet value */
1681 uint16_t ratchet;
1682};
1683/** @} */
1684
1685/**
1686 * @ingroup MRQ_Codes
1687 * @def MRQ_EMC_DVFS_LATENCY
1688 * @brief query frequency dependent EMC DVFS latency
1689 *
1690 * * Platforms: T186
1691 * * Initiators: CCPLEX
1692 * * Targets: BPMP
1693 * * Request Payload: N/A
1694 * * Response Payload: @ref mrq_emc_dvfs_latency_response
1695 * @addtogroup EMC
1696 * @{
1697 */
1698
1699/**
1700 * @brief used by @ref mrq_emc_dvfs_latency_response
1701 */
1702struct emc_dvfs_latency {
1703 /** @brief EMC frequency in kHz */
1704 uint32_t freq;
1705 /** @brief EMC DVFS latency in nanoseconds */
1706 uint32_t latency;
1707} __ABI_PACKED;
1708
1709#define EMC_DVFS_LATENCY_MAX_SIZE 14
1710/**
1711 * @brief response to #MRQ_EMC_DVFS_LATENCY
1712 */
1713struct mrq_emc_dvfs_latency_response {
1714 /** @brief the number valid entries in #pairs */
1715 uint32_t num_pairs;
1716 /** @brief EMC <frequency, latency> information */
1717 struct emc_dvfs_latency pairs[EMC_DVFS_LATENCY_MAX_SIZE];
1718} __ABI_PACKED;
1719
1720/** @} */
1721
1722/**
1723 * @ingroup MRQ_Codes
1724 * @def MRQ_TRACE_ITER
1725 * @brief manage the trace iterator
1726 *
1727 * * Platforms: All
1728 * * Initiators: CCPLEX
1729 * * Targets: BPMP
1730 * * Request Payload: N/A
1731 * * Response Payload: @ref mrq_trace_iter_request
1732 * @addtogroup Trace
1733 * @{
1734 */
1735enum {
1736 /** @brief (re)start the tracing now. Ignore older events */
1737 TRACE_ITER_INIT = 0,
1738 /** @brief clobber all events in the trace buffer */
1739 TRACE_ITER_CLEAN = 1
1740};
1741
1742/**
1743 * @brief request with #MRQ_TRACE_ITER
1744 */
1745struct mrq_trace_iter_request {
1746 /** @brief TRACE_ITER_INIT or TRACE_ITER_CLEAN */
1747 uint32_t cmd;
1748} __ABI_PACKED;
1749
1750/** @} */
1751
1752/**
1753 * @ingroup MRQ_Codes
1754 * @def MRQ_RINGBUF_CONSOLE
1755 * @brief A ring buffer debug console for BPMP
1756 * @addtogroup RingbufConsole
1757 *
1758 * The ring buffer debug console aims to be a substitute for the UART debug
1759 * console. The debug console is implemented with two ring buffers in the
1760 * BPMP-FW, the RX (receive) and TX (transmit) buffers. Characters can be read
1761 * and written to the buffers by the host via the MRQ interface.
1762 *
1763 * @{
1764 */
1765
1766/**
1767 * @brief Maximum number of bytes transferred in a single write command to the
1768 * BPMP
1769 *
1770 * This is determined by the number of free bytes in the message struct,
1771 * rounded down to a multiple of four.
1772 */
1773#define MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN 112
1774
1775/**
1776 * @brief Maximum number of bytes transferred in a single read command to the
1777 * BPMP
1778 *
1779 * This is determined by the number of free bytes in the message struct,
1780 * rounded down to a multiple of four.
1781 */
1782#define MRQ_RINGBUF_CONSOLE_MAX_READ_LEN 116
1783
1784enum mrq_ringbuf_console_host_to_bpmp_cmd {
1785 /**
1786 * @brief Check whether the BPMP driver supports the specified request
1787 * type
1788 *
1789 * mrq_response::err is 0 if the specified request is supported and
1790 * -#BPMP_ENODEV otherwise
1791 */
1792 CMD_RINGBUF_CONSOLE_QUERY_ABI = 0,
1793 /**
1794 * @brief Perform a read operation on the BPMP TX buffer
1795 *
1796 * mrq_response::err is 0
1797 */
1798 CMD_RINGBUF_CONSOLE_READ = 1,
1799 /**
1800 * @brief Perform a write operation on the BPMP RX buffer
1801 *
1802 * mrq_response::err is 0 if the operation was successful and
1803 * -#BPMP_ENODEV otherwise
1804 */
1805 CMD_RINGBUF_CONSOLE_WRITE = 2,
1806 /**
1807 * @brief Get the length of the buffer and the physical addresses of
1808 * the buffer data and the head and tail counters
1809 *
1810 * mrq_response::err is 0 if the operation was successful and
1811 * -#BPMP_ENODEV otherwise
1812 */
1813 CMD_RINGBUF_CONSOLE_GET_FIFO = 3,
1814};
1815
1816/**
1817 * @ingroup RingbufConsole
1818 * @brief Host->BPMP request data for request type
1819 * #CMD_RINGBUF_CONSOLE_QUERY_ABI
1820 */
1821struct cmd_ringbuf_console_query_abi_req {
1822 /** @brief Command identifier to be queried */
1823 uint32_t cmd;
1824} __ABI_PACKED;
1825
1826/** @private */
1827struct cmd_ringbuf_console_query_abi_resp {
1828 EMPTY
1829} __ABI_PACKED;
1830
1831/**
1832 * @ingroup RingbufConsole
1833 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_READ
1834 */
1835struct cmd_ringbuf_console_read_req {
1836 /**
1837 * @brief Number of bytes requested to be read from the BPMP TX buffer
1838 */
1839 uint8_t len;
1840} __ABI_PACKED;
1841
1842/**
1843 * @ingroup RingbufConsole
1844 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_READ
1845 */
1846struct cmd_ringbuf_console_read_resp {
1847 /** @brief The actual data read from the BPMP TX buffer */
1848 uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_READ_LEN];
1849 /** @brief Number of bytes in cmd_ringbuf_console_read_resp::data */
1850 uint8_t len;
1851} __ABI_PACKED;
1852
1853/**
1854 * @ingroup RingbufConsole
1855 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_WRITE
1856 */
1857struct cmd_ringbuf_console_write_req {
1858 /** @brief The actual data to be written to the BPMP RX buffer */
1859 uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN];
1860 /** @brief Number of bytes in cmd_ringbuf_console_write_req::data */
1861 uint8_t len;
1862} __ABI_PACKED;
1863
1864/**
1865 * @ingroup RingbufConsole
1866 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_WRITE
1867 */
1868struct cmd_ringbuf_console_write_resp {
1869 /** @brief Number of bytes of available space in the BPMP RX buffer */
1870 uint32_t space_avail;
1871 /** @brief Number of bytes that were written to the BPMP RX buffer */
1872 uint8_t len;
1873} __ABI_PACKED;
1874
1875/** @private */
1876struct cmd_ringbuf_console_get_fifo_req {
1877 EMPTY
1878} __ABI_PACKED;
1879
1880/**
1881 * @ingroup RingbufConsole
1882 * @brief BPMP->Host reply data for request type #CMD_RINGBUF_CONSOLE_GET_FIFO
1883 */
1884struct cmd_ringbuf_console_get_fifo_resp {
1885 /** @brief Physical address of the BPMP TX buffer */
1886 uint64_t bpmp_tx_buf_addr;
1887 /** @brief Physical address of the BPMP TX buffer head counter */
1888 uint64_t bpmp_tx_head_addr;
1889 /** @brief Physical address of the BPMP TX buffer tail counter */
1890 uint64_t bpmp_tx_tail_addr;
1891 /** @brief Length of the BPMP TX buffer */
1892 uint32_t bpmp_tx_buf_len;
1893} __ABI_PACKED;
1894
1895/**
1896 * @ingroup RingbufConsole
1897 * @brief Host->BPMP request data.
1898 *
1899 * Reply type is union #mrq_ringbuf_console_bpmp_to_host_response .
1900 */
1901struct mrq_ringbuf_console_host_to_bpmp_request {
1902 /**
1903 * @brief type of request. Values listed in enum
1904 * #mrq_ringbuf_console_host_to_bpmp_cmd.
1905 */
1906 uint32_t type;
1907 /** @brief request type specific parameters. */
1908 union {
1909 struct cmd_ringbuf_console_query_abi_req query_abi;
1910 struct cmd_ringbuf_console_read_req read;
1911 struct cmd_ringbuf_console_write_req write;
1912 struct cmd_ringbuf_console_get_fifo_req get_fifo;
1913 } __UNION_ANON;
1914} __ABI_PACKED;
1915
1916/**
1917 * @ingroup RingbufConsole
1918 * @brief Host->BPMP reply data
1919 *
1920 * In response to struct #mrq_ringbuf_console_host_to_bpmp_request.
1921 */
1922union mrq_ringbuf_console_bpmp_to_host_response {
1923 struct cmd_ringbuf_console_query_abi_resp query_abi;
1924 struct cmd_ringbuf_console_read_resp read;
1925 struct cmd_ringbuf_console_write_resp write;
1926 struct cmd_ringbuf_console_get_fifo_resp get_fifo;
1927} __ABI_PACKED;
1928/** @} */
1929
1930/*
1931 * 4. Enumerations
1932 */
1933
1934/*
1935 * 4.1 CPU enumerations
1936 *
1937 * See <mach-t186/system-t186.h>
1938 *
1939 * 4.2 CPU Cluster enumerations
1940 *
1941 * See <mach-t186/system-t186.h>
1942 *
1943 * 4.3 System low power state enumerations
1944 *
1945 * See <mach-t186/system-t186.h>
1946 */
1947
1948/*
1949 * 4.4 Clock enumerations
1950 *
1951 * For clock enumerations, see <mach-t186/clk-t186.h>
1952 */
1953
1954/*
1955 * 4.5 Reset enumerations
1956 *
1957 * For reset enumerations, see <mach-t186/reset-t186.h>
1958 */
1959
1960/*
1961 * 4.6 Thermal sensor enumerations
1962 *
1963 * For thermal sensor enumerations, see <mach-t186/thermal-t186.h>
1964 */
1965
1966/**
1967 * @defgroup Error_Codes
1968 * Negative values for mrq_response::err generally indicate some
1969 * error. The ABI defines the following error codes. Negating these
1970 * defines is an exercise left to the user.
1971 * @{
1972 */
1973/** @brief No such file or directory */
1974#define BPMP_ENOENT 2
1975/** @brief No MRQ handler */
1976#define BPMP_ENOHANDLER 3
1977/** @brief I/O error */
1978#define BPMP_EIO 5
1979/** @brief Bad sub-MRQ command */
1980#define BPMP_EBADCMD 6
1981/** @brief Not enough memory */
1982#define BPMP_ENOMEM 12
1983/** @brief Permission denied */
1984#define BPMP_EACCES 13
1985/** @brief Bad address */
1986#define BPMP_EFAULT 14
1987/** @brief No such device */
1988#define BPMP_ENODEV 19
1989/** @brief Argument is a directory */
1990#define BPMP_EISDIR 21
1991/** @brief Invalid argument */
1992#define BPMP_EINVAL 22
1993/** @brief Timeout during operation */
1994#define BPMP_ETIMEDOUT 23
1995/** @brief Out of range */
1996#define BPMP_ERANGE 34
1997/** @} */
1998/** @} */
1999#endif