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