1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
6 #ifndef _ABI_BPMP_ABI_H_
7 #define _ABI_BPMP_ABI_H_
14 #define __ABI_PACKED __attribute__((packed))
17 #ifdef NO_GCC_EXTENSIONS
18 #define EMPTY char empty;
33 * @defgroup MRQ MRQ Messages
34 * @brief Messages sent to/from BPMP via IPC
36 * @defgroup MRQ_Format Message Format
37 * @defgroup MRQ_Codes Message Request (MRQ) Codes
38 * @defgroup MRQ_Payloads Message Payloads
39 * @defgroup Error_Codes Error Codes
44 * @addtogroup MRQ_Format
46 * The CPU requests the BPMP to perform a particular service by
47 * sending it an IVC frame containing a single MRQ message. An MRQ
48 * message consists of a @ref mrq_request followed by a payload whose
49 * format depends on mrq_request::mrq.
51 * The BPMP processes the data and replies with an IVC frame (on the
52 * same IVC channel) containing and MRQ response. An MRQ response
53 * consists of a @ref mrq_response followed by a payload whose format
54 * depends on the associated mrq_request::mrq.
56 * A well-defined subset of the MRQ messages that the CPU sends to the
57 * BPMP can lead to BPMP eventually sending an MRQ message to the
58 * CPU. For example, when the CPU uses an #MRQ_THERMAL message to set
59 * a thermal trip point, the BPMP may eventually send a single
60 * #MRQ_THERMAL message of its own to the CPU indicating that the trip
61 * point has been crossed.
67 * @brief Header for an MRQ message
69 * Provides the MRQ number for the MRQ message: #mrq. The remainder of
70 * the MRQ message is a payload (immediately following the
71 * mrq_request) whose format depends on mrq.
74 /** @brief MRQ number of the request */
77 * @brief Flags providing follow up directions to the receiver
79 * | Bit | Description |
80 * |-----|--------------------------------------------|
81 * | 1 | ring the sender's doorbell when responding |
89 * @brief Header for an MRQ response
91 * Provides an error code for the associated MRQ message. The
92 * remainder of the MRQ response is a payload (immediately following
93 * the mrq_response) whose format depends on the associated
97 /** @brief Error code for the MRQ request itself */
99 /** @brief Reserved for future use */
104 * @ingroup MRQ_Format
105 * Minimum needed size for an IPC message buffer
107 #define MSG_MIN_SZ 128
109 * @ingroup MRQ_Format
110 * Minimum size guaranteed for data in an IPC message buffer
112 #define MSG_DATA_MIN_SZ 120
116 * @name Legal MRQ codes
117 * These are the legal values for mrq_request::mrq
122 #define MRQ_QUERY_TAG 1
123 #define MRQ_MODULE_LOAD 4
124 #define MRQ_MODULE_UNLOAD 5
125 #define MRQ_TRACE_MODIFY 7
126 #define MRQ_WRITE_TRACE 8
127 #define MRQ_THREADED_PING 9
128 #define MRQ_MODULE_MAIL 11
129 #define MRQ_DEBUGFS 19
133 #define MRQ_QUERY_ABI 23
134 #define MRQ_PG_READ_STATE 25
135 #define MRQ_PG_UPDATE_STATE 26
136 #define MRQ_THERMAL 27
137 #define MRQ_CPU_VHINT 28
138 #define MRQ_ABI_RATCHET 29
139 #define MRQ_EMC_DVFS_LATENCY 31
140 #define MRQ_TRACE_ITER 64
141 #define MRQ_RINGBUF_CONSOLE 65
143 #define MRQ_CPU_NDIV_LIMITS 67
146 #define MRQ_CPU_AUTO_CC3 70
147 #define MRQ_QUERY_FW_TAG 71
150 #define MRQ_FBVOLT_STATUS 74
156 * @brief Maximum MRQ code to be sent by CPU software to
157 * BPMP. Subject to change in future
159 #define MAX_CPU_MRQ_ID 74
162 * @addtogroup MRQ_Payloads
164 * @defgroup Ping Ping
165 * @defgroup Query_Tag Query Tag
166 * @defgroup Module Loadable Modules
167 * @defgroup Trace Trace
168 * @defgroup Debugfs Debug File System
169 * @defgroup Reset Reset
171 * @defgroup Clocks Clocks
172 * @defgroup ABI_info ABI Info
173 * @defgroup Powergating Power Gating
174 * @defgroup Thermal Thermal
175 * @defgroup Vhint CPU Voltage hint
177 * @defgroup CPU NDIV Limits
178 * @defgroup RingbufConsole Ring Buffer Console
179 * @defgroup Strap Straps
180 * @defgroup UPHY UPHY
181 * @defgroup CC3 Auto-CC3
182 * @defgroup FMON FMON
184 * @defgroup Fbvolt_status Fuse Burn Voltage Status
191 * @brief A simple ping
196 * * Request Payload: @ref mrq_ping_request
197 * * Response Payload: @ref mrq_ping_response
200 * @def MRQ_THREADED_PING
201 * @brief A deeper ping
206 * * Request Payload: @ref mrq_ping_request
207 * * Response Payload: @ref mrq_ping_response
209 * Behavior is equivalent to a simple #MRQ_PING except that BPMP
210 * responds from a thread context (providing a slightly more robust
217 * @brief Request with #MRQ_PING
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
223 struct mrq_ping_request
{
224 /** @brief Arbitrarily chosen value */
230 * @brief Response to #MRQ_PING
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
237 struct mrq_ping_response
{
238 /** @brief Response to the MRQ_PING challege */
245 * @brief Query BPMP firmware's tag (i.e. unique identifer)
247 * @deprecated Use #MRQ_QUERY_FW_TAG instead.
250 * * Initiators: CCPLEX
252 * * Request Payload: @ref mrq_query_tag_request
253 * * Response Payload: N/A
259 * @brief Request with #MRQ_QUERY_TAG
261 * @deprecated This structure will be removed in future version.
262 * Use MRQ_QUERY_FW_TAG instead.
264 struct mrq_query_tag_request
{
265 /** @brief Base address to store the firmware tag */
272 * @def MRQ_QUERY_FW_TAG
273 * @brief Query BPMP firmware's tag (i.e. unique identifier)
278 * * Request Payload: N/A
279 * * Response Payload: @ref mrq_query_fw_tag_response
285 * @brief Response to #MRQ_QUERY_FW_TAG
287 * Sent in response to #MRQ_QUERY_FW_TAG message. #tag contains the unique
288 * identifier for the version of firmware issuing the reply.
291 struct mrq_query_fw_tag_response
{
292 /** @brief Array to store tag information */
298 * @def MRQ_MODULE_LOAD
299 * @brief Dynamically load a BPMP code module
301 * * Platforms: T210, T214, T186
302 * @cond (bpmp_t210 || bpmp_t214 || bpmp_t186)
303 * * Initiators: CCPLEX
305 * * Request Payload: @ref mrq_module_load_request
306 * * Response Payload: @ref mrq_module_load_response
308 * @note This MRQ is disabled on production systems
314 * @brief Request with #MRQ_MODULE_LOAD
316 * Used by #MRQ_MODULE_LOAD calls to ask the recipient to dynamically
317 * load the code located at #phys_addr and having size #size
318 * bytes. #phys_addr is treated as a void pointer.
320 * The recipient copies the code from #phys_addr to locally allocated
321 * memory prior to responding to this message.
323 * @todo document the module header format
325 * The sender is responsible for ensuring that the code is mapped in
326 * the recipient's address map.
329 struct mrq_module_load_request
{
330 /** @brief Base address of the code to load. Treated as (void *) */
331 uint32_t phys_addr
; /* (void *) */
332 /** @brief Size in bytes of code to load */
338 * @brief Response to #MRQ_MODULE_LOAD
340 * @todo document mrq_response::err
342 struct mrq_module_load_response
{
343 /** @brief Handle to the loaded module */
350 * @def MRQ_MODULE_UNLOAD
351 * @brief Unload a previously loaded code module
353 * * Platforms: T210, T214, T186
354 * @cond (bpmp_t210 || bpmp_t214 || bpmp_t186)
355 * * Initiators: CCPLEX
357 * * Request Payload: @ref mrq_module_unload_request
358 * * Response Payload: N/A
360 * @note This MRQ is disabled on production systems
365 * @brief Request with #MRQ_MODULE_UNLOAD
367 * Used by #MRQ_MODULE_UNLOAD calls to request that a previously loaded
368 * module be unloaded.
370 struct mrq_module_unload_request
{
371 /** @brief Handle of the module to unload */
378 * @def MRQ_TRACE_MODIFY
379 * @brief Modify the set of enabled trace events
382 * * Initiators: CCPLEX
384 * * Request Payload: @ref mrq_trace_modify_request
385 * * Response Payload: @ref mrq_trace_modify_response
387 * @note This MRQ is disabled on production systems
392 * @brief Request with #MRQ_TRACE_MODIFY
394 * Used by %MRQ_TRACE_MODIFY calls to enable or disable specify trace
395 * events. #set takes precedence for any bit set in both #set and
398 struct mrq_trace_modify_request
{
399 /** @brief Bit mask of trace events to disable */
401 /** @brief Bit mask of trace events to enable */
407 * @brief Response to #MRQ_TRACE_MODIFY
409 * Sent in repsonse to an #MRQ_TRACE_MODIFY message. #mask reflects the
410 * state of which events are enabled after the recipient acted on the
414 struct mrq_trace_modify_response
{
415 /** @brief Bit mask of trace event enable states */
421 * @def MRQ_WRITE_TRACE
422 * @brief Write trace data to a buffer
425 * * Initiators: CCPLEX
427 * * Request Payload: @ref mrq_write_trace_request
428 * * Response Payload: @ref mrq_write_trace_response
430 * mrq_response::err depends on the @ref mrq_write_trace_request field
431 * values. err is -#BPMP_EINVAL if size is zero or area is NULL or
432 * area is in an illegal range. A positive value for err indicates the
433 * number of bytes written to area.
435 * @note This MRQ is disabled on production systems
440 * @brief Request with #MRQ_WRITE_TRACE
442 * Used by MRQ_WRITE_TRACE calls to ask the recipient to copy trace
443 * data from the recipient's local buffer to the output buffer. #area
444 * is treated as a byte-aligned pointer in the recipient's address
447 * The sender is responsible for ensuring that the output
448 * buffer is mapped in the recipient's address map. The recipient is
449 * responsible for protecting its own code and data from accidental
452 struct mrq_write_trace_request
{
453 /** @brief Base address of output buffer */
455 /** @brief Size in bytes of the output buffer */
461 * @brief Response to #MRQ_WRITE_TRACE
463 * Once this response is sent, the respondent will not access the
464 * output buffer further.
466 struct mrq_write_trace_response
{
468 * @brief Flag whether more data remains in local buffer
470 * Value is 1 if the entire local trace buffer has been
471 * drained to the outputbuffer. Value is 0 otherwise.
477 struct mrq_threaded_ping_request
{
482 struct mrq_threaded_ping_response
{
488 * @def MRQ_MODULE_MAIL
489 * @brief Send a message to a loadable module
491 * * Platforms: T210, T214, T186
492 * @cond (bpmp_t210 || bpmp_t214 || bpmp_t186)
495 * * Request Payload: @ref mrq_module_mail_request
496 * * Response Payload: @ref mrq_module_mail_response
498 * @note This MRQ is disabled on production systems
503 * @brief Request with #MRQ_MODULE_MAIL
505 struct mrq_module_mail_request
{
506 /** @brief Handle to the previously loaded module */
508 /** @brief Module-specific mail payload
510 * The length of data[ ] is unknown to the BPMP core firmware
511 * but it is limited to the size of an IPC message.
513 uint8_t data
[EMPTY_ARRAY
];
518 * @brief Response to #MRQ_MODULE_MAIL
520 struct mrq_module_mail_response
{
521 /** @brief Module-specific mail payload
523 * The length of data[ ] is unknown to the BPMP core firmware
524 * but it is limited to the size of an IPC message.
526 uint8_t data
[EMPTY_ARRAY
];
533 * @brief Interact with BPMP's debugfs file nodes
535 * * Platforms: T186, T194
538 * * Request Payload: @ref mrq_debugfs_request
539 * * Response Payload: @ref mrq_debugfs_response
543 * @addtogroup Debugfs
546 * The BPMP firmware implements a pseudo-filesystem called
547 * debugfs. Any driver within the firmware may register with debugfs
548 * to expose an arbitrary set of "files" in the filesystem. When
549 * software on the CPU writes to a debugfs file, debugfs passes the
550 * written data to a callback provided by the driver. When software on
551 * the CPU reads a debugfs file, debugfs queries the driver for the
552 * data to return to the CPU. The intention of the debugfs filesystem
553 * is to provide information useful for debugging the system at
556 * @note The files exposed via debugfs are not part of the
557 * BPMP firmware's ABI. debugfs files may be added or removed in any
558 * given version of the firmware. Typically the semantics of a debugfs
559 * file are consistent from version to version but even that is not
565 /** @ingroup Debugfs */
566 enum mrq_debugfs_commands
{
567 /** @brief Perform read */
568 CMD_DEBUGFS_READ
= 1,
569 /** @brief Perform write */
570 CMD_DEBUGFS_WRITE
= 2,
571 /** @brief Perform dumping directory */
572 CMD_DEBUGFS_DUMPDIR
= 3,
573 /** @brief Not a command */
579 * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
581 struct cmd_debugfs_fileop_request
{
582 /** @brief Physical address pointing at filename */
584 /** @brief Length in bytes of filename buffer */
586 /** @brief Physical address pointing to data buffer */
588 /** @brief Length in bytes of data buffer */
594 * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
596 struct cmd_debugfs_dumpdir_request
{
597 /** @brief Physical address pointing to data buffer */
599 /** @brief Length in bytes of data buffer */
605 * @brief Response data for CMD_DEBUGFS_READ/WRITE command
607 struct cmd_debugfs_fileop_response
{
608 /** @brief Always 0 */
610 /** @brief Number of bytes read from or written to data buffer */
616 * @brief Response data for CMD_DEBUGFS_DUMPDIR command
618 struct cmd_debugfs_dumpdir_response
{
619 /** @brief Always 0 */
621 /** @brief Number of bytes read from or written to data buffer */
627 * @brief Request with #MRQ_DEBUGFS.
629 * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs
630 * command to execute. Legal commands are the values of @ref
631 * mrq_debugfs_commands. Each command requires a specific additional
635 * |-------------------|-------|
636 * |CMD_DEBUGFS_READ |fop |
637 * |CMD_DEBUGFS_WRITE |fop |
638 * |CMD_DEBUGFS_DUMPDIR|dumpdir|
640 struct mrq_debugfs_request
{
641 /** @brief Sub-command (@ref mrq_debugfs_commands) */
644 struct cmd_debugfs_fileop_request fop
;
645 struct cmd_debugfs_dumpdir_request dumpdir
;
652 struct mrq_debugfs_response
{
653 /** @brief Always 0 */
656 /** @brief Response data for CMD_DEBUGFS_READ OR
657 * CMD_DEBUGFS_WRITE command
659 struct cmd_debugfs_fileop_response fop
;
660 /** @brief Response data for CMD_DEBUGFS_DUMPDIR command */
661 struct cmd_debugfs_dumpdir_response dumpdir
;
666 * @addtogroup Debugfs
669 #define DEBUGFS_S_ISDIR (1 << 9)
670 #define DEBUGFS_S_IRUSR (1 << 8)
671 #define DEBUGFS_S_IWUSR (1 << 7)
677 * @brief Reset an IP block
679 * * Platforms: T186, T194
682 * * Request Payload: @ref mrq_reset_request
683 * * Response Payload: @ref mrq_reset_response
689 enum mrq_reset_commands
{
690 /** @brief Assert module reset */
691 CMD_RESET_ASSERT
= 1,
692 /** @brief Deassert module reset */
693 CMD_RESET_DEASSERT
= 2,
694 /** @brief Assert and deassert the module reset */
695 CMD_RESET_MODULE
= 3,
696 /** @brief Get the highest reset ID */
697 CMD_RESET_GET_MAX_ID
= 4,
698 /** @brief Not part of ABI and subject to change */
703 * @brief Request with MRQ_RESET
705 * Used by the sender of an #MRQ_RESET message to request BPMP to
706 * assert or or deassert a given reset line.
708 struct mrq_reset_request
{
709 /** @brief Reset action to perform (@ref mrq_reset_commands) */
711 /** @brief Id of the reset to affected */
716 * @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When
717 * this sub-command is not supported, firmware will return -BPMP_EBADCMD
718 * in mrq_response::err.
720 struct cmd_reset_get_max_id_response
{
721 /** @brief Max reset id */
726 * @brief Response with MRQ_RESET
728 * Each sub-command supported by @ref mrq_reset_request may return
729 * sub-command-specific data. Some do and some do not as indicated
730 * in the following table
732 * | sub-command | payload |
733 * |----------------------|------------------|
734 * | CMD_RESET_ASSERT | - |
735 * | CMD_RESET_DEASSERT | - |
736 * | CMD_RESET_MODULE | - |
737 * | CMD_RESET_GET_MAX_ID | reset_get_max_id |
739 struct mrq_reset_response
{
741 struct cmd_reset_get_max_id_response reset_get_max_id
;
750 * @brief Issue an i2c transaction
752 * * Platforms: T186, T194
755 * * Request Payload: @ref mrq_i2c_request
756 * * Response Payload: @ref mrq_i2c_response
761 #define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE (MSG_DATA_MIN_SZ - 12)
762 #define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE (MSG_DATA_MIN_SZ - 4)
764 #define SERIALI2C_TEN 0x0010
765 #define SERIALI2C_RD 0x0001
766 #define SERIALI2C_STOP 0x8000
767 #define SERIALI2C_NOSTART 0x4000
768 #define SERIALI2C_REV_DIR_ADDR 0x2000
769 #define SERIALI2C_IGNORE_NAK 0x1000
770 #define SERIALI2C_NO_RD_ACK 0x0800
771 #define SERIALI2C_RECV_LEN 0x0400
778 * @brief Serializable i2c request
780 * Instances of this structure are packed (little-endian) into
781 * cmd_i2c_xfer_request::data_buf. Each instance represents a single
782 * transaction (or a portion of a transaction with repeated starts) on
785 * Because these structures are packed, some instances are likely to
786 * be misaligned. Additionally because #data is variable length, it is
787 * not possible to iterate through a serialized list of these
788 * structures without inspecting #len in each instance. It may be
789 * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf
790 * manually rather than using this structure definition.
792 struct serial_i2c_request
{
793 /** @brief I2C slave address */
795 /** @brief Bitmask of SERIALI2C_ flags */
797 /** @brief Length of I2C transaction in bytes */
799 /** @brief For write transactions only, #len bytes of data */
804 * @brief Trigger one or more i2c transactions
806 struct cmd_i2c_xfer_request
{
807 /** @brief Valid bus number from @ref bpmp_i2c_ids*/
810 /** @brief Count of valid bytes in #data_buf*/
813 /** @brief Serialized packed instances of @ref serial_i2c_request*/
814 uint8_t data_buf
[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE
];
818 * @brief Container for data read from the i2c bus
820 * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute
821 * zero or more I2C reads. The data read from the bus is serialized
824 struct cmd_i2c_xfer_response
{
825 /** @brief Count of valid bytes in #data_buf*/
827 /** @brief I2c read data */
828 uint8_t data_buf
[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE
];
832 * @brief Request with #MRQ_I2C
834 struct mrq_i2c_request
{
835 /** @brief Always CMD_I2C_XFER (i.e. 1) */
837 /** @brief Parameters of the transfer request */
838 struct cmd_i2c_xfer_request xfer
;
842 * @brief Response to #MRQ_I2C
844 struct mrq_i2c_response
{
845 struct cmd_i2c_xfer_response xfer
;
853 * @brief Perform a clock operation
855 * * Platforms: T186, T194
858 * * Request Payload: @ref mrq_clk_request
859 * * Response Payload: @ref mrq_clk_response
865 CMD_CLK_GET_RATE
= 1,
866 CMD_CLK_SET_RATE
= 2,
867 CMD_CLK_ROUND_RATE
= 3,
868 CMD_CLK_GET_PARENT
= 4,
869 CMD_CLK_SET_PARENT
= 5,
870 CMD_CLK_IS_ENABLED
= 6,
873 CMD_CLK_GET_ALL_INFO
= 14,
874 CMD_CLK_GET_MAX_CLK_ID
= 15,
875 CMD_CLK_GET_FMAX_AT_VMIN
= 16,
879 #define BPMP_CLK_HAS_MUX (1 << 0)
880 #define BPMP_CLK_HAS_SET_RATE (1 << 1)
881 #define BPMP_CLK_IS_ROOT (1 << 2)
883 #define MRQ_CLK_NAME_MAXLEN 40
884 #define MRQ_CLK_MAX_PARENTS 16
887 struct cmd_clk_get_rate_request
{
891 struct cmd_clk_get_rate_response
{
895 struct cmd_clk_set_rate_request
{
900 struct cmd_clk_set_rate_response
{
904 struct cmd_clk_round_rate_request
{
909 struct cmd_clk_round_rate_response
{
914 struct cmd_clk_get_parent_request
{
918 struct cmd_clk_get_parent_response
{
922 struct cmd_clk_set_parent_request
{
926 struct cmd_clk_set_parent_response
{
931 struct cmd_clk_is_enabled_request
{
935 struct cmd_clk_is_enabled_response
{
940 struct cmd_clk_enable_request
{
945 struct cmd_clk_enable_response
{
950 struct cmd_clk_disable_request
{
955 struct cmd_clk_disable_response
{
960 struct cmd_clk_get_all_info_request
{
964 struct cmd_clk_get_all_info_response
{
967 uint32_t parents
[MRQ_CLK_MAX_PARENTS
];
969 uint8_t name
[MRQ_CLK_NAME_MAXLEN
];
973 struct cmd_clk_get_max_clk_id_request
{
977 struct cmd_clk_get_max_clk_id_response
{
982 struct cmd_clk_get_fmax_at_vmin_request
{
986 struct cmd_clk_get_fmax_at_vmin_response
{
992 * @brief Request with #MRQ_CLK
994 * Used by the sender of an #MRQ_CLK message to control clocks. The
995 * clk_request is split into several sub-commands. Some sub-commands
996 * require no additional data. Others have a sub-command specific
999 * |sub-command |payload |
1000 * |----------------------------|-----------------------|
1001 * |CMD_CLK_GET_RATE |- |
1002 * |CMD_CLK_SET_RATE |clk_set_rate |
1003 * |CMD_CLK_ROUND_RATE |clk_round_rate |
1004 * |CMD_CLK_GET_PARENT |- |
1005 * |CMD_CLK_SET_PARENT |clk_set_parent |
1006 * |CMD_CLK_IS_ENABLED |- |
1007 * |CMD_CLK_ENABLE |- |
1008 * |CMD_CLK_DISABLE |- |
1009 * |CMD_CLK_GET_ALL_INFO |- |
1010 * |CMD_CLK_GET_MAX_CLK_ID |- |
1011 * |CMD_CLK_GET_FMAX_AT_VMIN |-
1016 struct mrq_clk_request
{
1017 /** @brief Sub-command and clock id concatenated to 32-bit word.
1018 * - bits[31..24] is the sub-cmd.
1019 * - bits[23..0] is the clock id
1021 uint32_t cmd_and_id
;
1025 struct cmd_clk_get_rate_request clk_get_rate
;
1026 struct cmd_clk_set_rate_request clk_set_rate
;
1027 struct cmd_clk_round_rate_request clk_round_rate
;
1029 struct cmd_clk_get_parent_request clk_get_parent
;
1030 struct cmd_clk_set_parent_request clk_set_parent
;
1032 struct cmd_clk_enable_request clk_enable
;
1034 struct cmd_clk_disable_request clk_disable
;
1036 struct cmd_clk_is_enabled_request clk_is_enabled
;
1038 struct cmd_clk_get_all_info_request clk_get_all_info
;
1040 struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id
;
1042 struct cmd_clk_get_fmax_at_vmin_request clk_get_fmax_at_vmin
;
1048 * @brief Response to MRQ_CLK
1050 * Each sub-command supported by @ref mrq_clk_request may return
1051 * sub-command-specific data. Some do and some do not as indicated in
1052 * the following table
1054 * |sub-command |payload |
1055 * |----------------------------|------------------------|
1056 * |CMD_CLK_GET_RATE |clk_get_rate |
1057 * |CMD_CLK_SET_RATE |clk_set_rate |
1058 * |CMD_CLK_ROUND_RATE |clk_round_rate |
1059 * |CMD_CLK_GET_PARENT |clk_get_parent |
1060 * |CMD_CLK_SET_PARENT |clk_set_parent |
1061 * |CMD_CLK_IS_ENABLED |clk_is_enabled |
1062 * |CMD_CLK_ENABLE |- |
1063 * |CMD_CLK_DISABLE |- |
1064 * |CMD_CLK_GET_ALL_INFO |clk_get_all_info |
1065 * |CMD_CLK_GET_MAX_CLK_ID |clk_get_max_id |
1066 * |CMD_CLK_GET_FMAX_AT_VMIN |clk_get_fmax_at_vmin |
1070 struct mrq_clk_response
{
1072 struct cmd_clk_get_rate_response clk_get_rate
;
1073 struct cmd_clk_set_rate_response clk_set_rate
;
1074 struct cmd_clk_round_rate_response clk_round_rate
;
1075 struct cmd_clk_get_parent_response clk_get_parent
;
1076 struct cmd_clk_set_parent_response clk_set_parent
;
1078 struct cmd_clk_enable_response clk_enable
;
1080 struct cmd_clk_disable_response clk_disable
;
1081 struct cmd_clk_is_enabled_response clk_is_enabled
;
1082 struct cmd_clk_get_all_info_response clk_get_all_info
;
1083 struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id
;
1084 struct cmd_clk_get_fmax_at_vmin_response clk_get_fmax_at_vmin
;
1091 * @ingroup MRQ_Codes
1092 * @def MRQ_QUERY_ABI
1093 * @brief Check if an MRQ is implemented
1097 * * Targets: Any except DMCE
1098 * * Request Payload: @ref mrq_query_abi_request
1099 * * Response Payload: @ref mrq_query_abi_response
1104 * @brief Request with MRQ_QUERY_ABI
1106 * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported
1109 struct mrq_query_abi_request
{
1110 /** @brief MRQ code to query */
1116 * @brief Response to MRQ_QUERY_ABI
1118 * @note mrq_response::err of 0 indicates that the query was
1119 * successful, not that the MRQ itself is supported!
1121 struct mrq_query_abi_response
{
1122 /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */
1127 * @ingroup MRQ_Codes
1128 * @def MRQ_PG_READ_STATE
1129 * @brief Read the power-gating state of a partition
1135 * * Request Payload: @ref mrq_pg_read_state_request
1136 * * Response Payload: @ref mrq_pg_read_state_response
1140 * @ingroup Powergating
1141 * @brief Request with #MRQ_PG_READ_STATE
1143 * Used by MRQ_PG_READ_STATE call to read the current state of a
1146 struct mrq_pg_read_state_request
{
1147 /** @brief ID of partition */
1148 uint32_t partition_id
;
1152 * @ingroup Powergating
1153 * @brief Response to MRQ_PG_READ_STATE
1154 * @todo define possible errors.
1156 struct mrq_pg_read_state_response
{
1157 /** @brief Read as don't care */
1158 uint32_t sram_state
;
1159 /** @brief State of power partition
1163 uint32_t logic_state
;
1169 * @ingroup MRQ_Codes
1170 * @def MRQ_PG_UPDATE_STATE
1171 * @brief Modify the power-gating state of a partition. In contrast to
1172 * MRQ_PG calls, the operations that change state (on/off) of power
1173 * partition are reference counted.
1179 * * Request Payload: @ref mrq_pg_update_state_request
1180 * * Response Payload: N/A
1184 * @ingroup Powergating
1185 * @brief Request with mrq_pg_update_state_request
1187 * Used by #MRQ_PG_UPDATE_STATE call to request BPMP to change the
1188 * state of a power partition #partition_id.
1190 struct mrq_pg_update_state_request
{
1191 /** @brief ID of partition */
1192 uint32_t partition_id
;
1193 /** @brief Secondary control of power partition
1194 * @details Ignored by many versions of the BPMP
1195 * firmware. For maximum compatibility, set the value
1196 * according to @ref logic_state
1197 * * 0x1: power ON partition (@ref logic_state == 0x3)
1198 * * 0x3: power OFF partition (@ref logic_state == 0x1)
1200 uint32_t sram_state
;
1201 /** @brief Controls state of power partition, legal values are
1202 * * 0x1 : power OFF partition
1203 * * 0x3 : power ON partition
1205 uint32_t logic_state
;
1206 /** @brief Change state of clocks of the power partition, legal values
1207 * * 0x0 : do not change clock state
1208 * * 0x1 : disable partition clocks (only applicable when
1209 * @ref logic_state == 0x1)
1210 * * 0x3 : enable partition clocks (only applicable when
1211 * @ref logic_state == 0x3)
1213 uint32_t clock_state
;
1218 * @ingroup MRQ_Codes
1220 * @brief Control power-gating state of a partition. In contrast to
1221 * MRQ_PG_UPDATE_STATE, operations that change the power partition
1222 * state are NOT reference counted
1224 * @note BPMP-FW forcefully turns off some partitions as part of SC7 entry
1225 * because their state cannot be adequately restored on exit. Therefore,
1226 * it is recommended to power off all domains via MRQ_PG prior to SC7 entry.
1227 * See @ref bpmp_pdomain_ids for further detail.
1229 * * Platforms: T186, T194
1232 * * Request Payload: @ref mrq_pg_request
1233 * * Response Payload: @ref mrq_pg_response
1235 * @addtogroup Powergating
1240 * @brief Check whether the BPMP driver supports the specified
1243 * mrq_response::err is 0 if the specified request is
1244 * supported and -#BPMP_ENODEV otherwise.
1246 CMD_PG_QUERY_ABI
= 0,
1249 * @brief Set the current state of specified power domain. The
1250 * possible values for power domains are defined in enum
1253 * mrq_response:err is
1255 * -#BPMP_EINVAL: Invalid request parameters
1257 CMD_PG_SET_STATE
= 1,
1260 * @brief Get the current state of specified power domain. The
1261 * possible values for power domains are defined in enum
1264 * mrq_response:err is
1266 * -#BPMP_EINVAL: Invalid request parameters
1268 CMD_PG_GET_STATE
= 2,
1271 * @brief Get the name string of specified power domain id.
1273 * mrq_response:err is
1275 * -#BPMP_EINVAL: Invalid request parameters
1277 CMD_PG_GET_NAME
= 3,
1281 * @brief Get the highest power domain id in the system. Not
1282 * all IDs between 0 and max_id are valid IDs.
1284 * mrq_response:err is
1286 * -#BPMP_EINVAL: Invalid request parameters
1288 CMD_PG_GET_MAX_ID
= 4,
1291 #define MRQ_PG_NAME_MAXLEN 40
1294 /** @brief Power domain is OFF */
1296 /** @brief Power domain is ON */
1299 * @brief a legacy state where power domain and the clock
1300 * associated to the domain are ON.
1301 * This state is only supported in T186, and the use of it is
1304 PG_STATE_RUNNING
= 2,
1307 struct cmd_pg_query_abi_request
{
1308 /** @ref mrq_pg_cmd */
1312 struct cmd_pg_set_state_request
{
1313 /** @ref pg_states */
1317 struct cmd_pg_get_state_response
{
1318 /** @ref pg_states */
1322 struct cmd_pg_get_name_response
{
1323 uint8_t name
[MRQ_PG_NAME_MAXLEN
];
1326 struct cmd_pg_get_max_id_response
{
1331 * @brief Request with #MRQ_PG
1333 * Used by the sender of an #MRQ_PG message to control power
1334 * partitions. The pg_request is split into several sub-commands. Some
1335 * sub-commands require no additional data. Others have a sub-command
1338 * |sub-command |payload |
1339 * |----------------------------|-----------------------|
1340 * |CMD_PG_QUERY_ABI | query_abi |
1341 * |CMD_PG_SET_STATE | set_state |
1342 * |CMD_PG_GET_STATE | - |
1343 * |CMD_PG_GET_NAME | - |
1344 * |CMD_PG_GET_MAX_ID | - |
1347 struct mrq_pg_request
{
1351 struct cmd_pg_query_abi_request query_abi
;
1352 struct cmd_pg_set_state_request set_state
;
1357 * @brief Response to MRQ_PG
1359 * Each sub-command supported by @ref mrq_pg_request may return
1360 * sub-command-specific data. Some do and some do not as indicated in
1361 * the following table
1363 * |sub-command |payload |
1364 * |----------------------------|-----------------------|
1365 * |CMD_PG_QUERY_ABI | - |
1366 * |CMD_PG_SET_STATE | - |
1367 * |CMD_PG_GET_STATE | get_state |
1368 * |CMD_PG_GET_NAME | get_name |
1369 * |CMD_PG_GET_MAX_ID | get_max_id |
1371 struct mrq_pg_response
{
1373 struct cmd_pg_get_state_response get_state
;
1374 struct cmd_pg_get_name_response get_name
;
1375 struct cmd_pg_get_max_id_response get_max_id
;
1382 * @ingroup MRQ_Codes
1384 * @brief Interact with BPMP thermal framework
1386 * * Platforms: T186, T194
1389 * * Request Payload: TODO
1390 * * Response Payload: TODO
1392 * @addtogroup Thermal
1394 * The BPMP firmware includes a thermal framework. Drivers within the
1395 * bpmp firmware register with the framework to provide thermal
1396 * zones. Each thermal zone corresponds to an entity whose temperature
1397 * can be measured. The framework also has a notion of trip points. A
1398 * trip point consists of a thermal zone id, a temperature, and a
1399 * callback routine. The framework invokes the callback when the zone
1400 * hits the indicated temperature. The BPMP firmware uses this thermal
1401 * framework interally to implement various temperature-dependent
1404 * Software on the CPU can use #MRQ_THERMAL (with payload @ref
1405 * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal
1406 * framework. The CPU must It can query the number of supported zones,
1407 * query zone temperatures, and set trip points.
1409 * When a trip point set by the CPU gets crossed, BPMP firmware issues
1410 * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a
1411 * payload of @ref mrq_thermal_bpmp_to_host_request.
1414 enum mrq_thermal_host_to_bpmp_cmd
{
1416 * @brief Check whether the BPMP driver supports the specified
1419 * Host needs to supply request parameters.
1421 * mrq_response::err is 0 if the specified request is
1422 * supported and -#BPMP_ENODEV otherwise.
1424 CMD_THERMAL_QUERY_ABI
= 0,
1427 * @brief Get the current temperature of the specified zone.
1429 * Host needs to supply request parameters.
1431 * mrq_response::err is
1432 * * 0: Temperature query succeeded.
1433 * * -#BPMP_EINVAL: Invalid request parameters.
1434 * * -#BPMP_ENOENT: No driver registered for thermal zone..
1435 * * -#BPMP_EFAULT: Problem reading temperature measurement.
1437 CMD_THERMAL_GET_TEMP
= 1,
1440 * @brief Enable or disable and set the lower and upper
1441 * thermal limits for a thermal trip point. Each zone has
1444 * Host needs to supply request parameters. Once the
1445 * temperature hits a trip point, the BPMP will send a message
1446 * to the CPU having MRQ=MRQ_THERMAL and
1447 * type=CMD_THERMAL_HOST_TRIP_REACHED
1449 * mrq_response::err is
1450 * * 0: Trip successfully set.
1451 * * -#BPMP_EINVAL: Invalid request parameters.
1452 * * -#BPMP_ENOENT: No driver registered for thermal zone.
1453 * * -#BPMP_EFAULT: Problem setting trip point.
1455 CMD_THERMAL_SET_TRIP
= 2,
1458 * @brief Get the number of supported thermal zones.
1460 * No request parameters required.
1462 * mrq_response::err is always 0, indicating success.
1464 CMD_THERMAL_GET_NUM_ZONES
= 3,
1466 /** @brief: number of supported host-to-bpmp commands. May
1467 * increase in future
1469 CMD_THERMAL_HOST_TO_BPMP_NUM
1472 enum mrq_thermal_bpmp_to_host_cmd
{
1474 * @brief Indication that the temperature for a zone has
1475 * exceeded the range indicated in the thermal trip point
1478 * BPMP needs to supply request parameters. Host only needs to
1481 CMD_THERMAL_HOST_TRIP_REACHED
= 100,
1483 /** @brief: number of supported bpmp-to-host commands. May
1484 * increase in future
1486 CMD_THERMAL_BPMP_TO_HOST_NUM
1490 * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI
1492 * zone: Request type for which to check existence.
1494 struct cmd_thermal_query_abi_request
{
1499 * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP
1501 * zone: Number of thermal zone.
1503 struct cmd_thermal_get_temp_request
{
1508 * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP
1510 * error: 0 if request succeeded.
1511 * -BPMP_EINVAL if request parameters were invalid.
1512 * -BPMP_ENOENT if no driver was registered for the specified thermal zone.
1513 * -BPMP_EFAULT for other thermal zone driver errors.
1514 * temp: Current temperature in millicelsius.
1516 struct cmd_thermal_get_temp_response
{
1521 * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP
1523 * zone: Number of thermal zone.
1524 * low: Temperature of lower trip point in millicelsius
1525 * high: Temperature of upper trip point in millicelsius
1526 * enabled: 1 to enable trip point, 0 to disable trip point
1528 struct cmd_thermal_set_trip_request
{
1536 * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED
1538 * zone: Number of thermal zone where trip point was reached.
1540 struct cmd_thermal_host_trip_reached_request
{
1545 * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES
1547 * num: Number of supported thermal zones. The thermal zones are indexed
1548 * starting from zero.
1550 struct cmd_thermal_get_num_zones_response
{
1555 * Host->BPMP request data.
1557 * Reply type is union mrq_thermal_bpmp_to_host_response.
1559 * type: Type of request. Values listed in enum mrq_thermal_type.
1560 * data: Request type specific parameters.
1562 struct mrq_thermal_host_to_bpmp_request
{
1565 struct cmd_thermal_query_abi_request query_abi
;
1566 struct cmd_thermal_get_temp_request get_temp
;
1567 struct cmd_thermal_set_trip_request set_trip
;
1572 * BPMP->Host request data.
1574 * type: Type of request. Values listed in enum mrq_thermal_type.
1575 * data: Request type specific parameters.
1577 struct mrq_thermal_bpmp_to_host_request
{
1580 struct cmd_thermal_host_trip_reached_request host_trip_reached
;
1585 * Data in reply to a Host->BPMP request.
1587 union mrq_thermal_bpmp_to_host_response
{
1588 struct cmd_thermal_get_temp_response get_temp
;
1589 struct cmd_thermal_get_num_zones_response get_num_zones
;
1594 * @ingroup MRQ_Codes
1595 * @def MRQ_CPU_VHINT
1596 * @brief Query CPU voltage hint data
1600 * * Initiators: CCPLEX
1602 * * Request Payload: @ref mrq_cpu_vhint_request
1603 * * Response Payload: N/A
1610 * @brief Request with #MRQ_CPU_VHINT
1612 * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data
1613 * from BPMP to memory space pointed by #addr. CCPLEX is responsible
1614 * to allocate sizeof(cpu_vhint_data) sized block of memory and
1615 * appropriately map it for BPMP before sending the request.
1617 struct mrq_cpu_vhint_request
{
1618 /** @brief IOVA address for the #cpu_vhint_data */
1620 /** @brief ID of the cluster whose data is requested */
1621 uint32_t cluster_id
;
1625 * @brief Description of the CPU v/f relation
1627 * Used by #MRQ_CPU_VHINT call to carry data pointed by
1628 * #mrq_cpu_vhint_request::addr
1630 struct cpu_vhint_data
{
1631 uint32_t ref_clk_hz
; /**< reference frequency in Hz */
1632 uint16_t pdiv
; /**< post divider value */
1633 uint16_t mdiv
; /**< input divider value */
1634 uint16_t ndiv_max
; /**< fMAX expressed with max NDIV value */
1635 /** table of ndiv values as a function of vINDEX (voltage index) */
1637 /** minimum allowed NDIV value */
1639 /** minimum allowed voltage hint value (as in vINDEX) */
1641 /** maximum allowed voltage hint value (as in vINDEX) */
1643 /** post-multiplier for vindex value */
1644 uint16_t vindex_mult
;
1645 /** post-divider for vindex value */
1646 uint16_t vindex_div
;
1647 /** reserved for future use */
1648 uint16_t reserved
[328];
1654 * @ingroup MRQ_Codes
1655 * @def MRQ_ABI_RATCHET
1656 * @brief ABI ratchet value query
1658 * * Platforms: T186, T194
1661 * * Request Payload: @ref mrq_abi_ratchet_request
1662 * * Response Payload: @ref mrq_abi_ratchet_response
1663 * @addtogroup ABI_info
1668 * @brief An ABI compatibility mechanism
1670 * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future
1671 * revision of this header file.
1672 * 1. That future revision deprecates some MRQ
1673 * 2. That future revision introduces a breaking change to an existing
1675 * 3. A bug is discovered in an existing implementation of the BPMP-FW
1676 * (or possibly one of its clients) which warrants deprecating that
1679 #define BPMP_ABI_RATCHET_VALUE 3
1682 * @brief Request with #MRQ_ABI_RATCHET.
1684 * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header
1685 * against which the requester was compiled.
1687 * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may
1688 * reply with mrq_response::err = -#BPMP_ERANGE to indicate that
1689 * BPMP-FW cannot interoperate correctly with the requester. Requester
1690 * should cease further communication with BPMP.
1692 * Otherwise, err shall be 0.
1694 struct mrq_abi_ratchet_request
{
1695 /** @brief Requester's ratchet value */
1700 * @brief Response to #MRQ_ABI_RATCHET
1702 * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header
1703 * against which BPMP firwmare was compiled.
1705 * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE,
1706 * the requster must either interoperate with BPMP according to an ABI
1707 * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease
1708 * communication with BPMP.
1710 * If mrq_response::err is 0 and ratchet is greater than or equal to the
1711 * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue
1714 struct mrq_abi_ratchet_response
{
1715 /** @brief BPMP's ratchet value */
1721 * @ingroup MRQ_Codes
1722 * @def MRQ_EMC_DVFS_LATENCY
1723 * @brief Query frequency dependent EMC DVFS latency
1725 * * Platforms: T186, T194
1726 * * Initiators: CCPLEX
1728 * * Request Payload: N/A
1729 * * Response Payload: @ref mrq_emc_dvfs_latency_response
1735 * @brief Used by @ref mrq_emc_dvfs_latency_response
1737 struct emc_dvfs_latency
{
1738 /** @brief EMC frequency in kHz */
1740 /** @brief EMC DVFS latency in nanoseconds */
1744 #define EMC_DVFS_LATENCY_MAX_SIZE 14
1746 * @brief Response to #MRQ_EMC_DVFS_LATENCY
1748 struct mrq_emc_dvfs_latency_response
{
1749 /** @brief The number valid entries in #pairs */
1751 /** @brief EMC <frequency, latency> information */
1752 struct emc_dvfs_latency pairs
[EMC_DVFS_LATENCY_MAX_SIZE
];
1758 * @ingroup MRQ_Codes
1759 * @def MRQ_CPU_NDIV_LIMITS
1760 * @brief CPU freq. limits in ndiv
1762 * * Platforms: T194 onwards
1764 * * Initiators: CCPLEX
1766 * * Request Payload: @ref mrq_cpu_ndiv_limits_request
1767 * * Response Payload: @ref mrq_cpu_ndiv_limits_response
1773 * @brief Request for ndiv limits of a cluster
1775 struct mrq_cpu_ndiv_limits_request
{
1776 /** @brief Enum cluster_id */
1777 uint32_t cluster_id
;
1781 * @brief Response to #MRQ_CPU_NDIV_LIMITS
1783 struct mrq_cpu_ndiv_limits_response
{
1784 /** @brief Reference frequency in Hz */
1785 uint32_t ref_clk_hz
;
1786 /** @brief Post divider value */
1788 /** @brief Input divider value */
1790 /** @brief FMAX expressed with max NDIV value */
1792 /** @brief Minimum allowed NDIV value */
1800 * @ingroup MRQ_Codes
1801 * @def MRQ_CPU_AUTO_CC3
1802 * @brief Query CPU cluster auto-CC3 configuration
1804 * * Platforms: T194 onwards
1806 * * Initiators: CCPLEX
1808 * * Request Payload: @ref mrq_cpu_auto_cc3_request
1809 * * Response Payload: @ref mrq_cpu_auto_cc3_response
1812 * Queries from BPMP auto-CC3 configuration (allowed/not allowed) for a
1813 * specified cluster. CCPLEX s/w uses this information to override its own
1814 * device tree auto-CC3 settings, so that BPMP device tree is a single source of
1815 * auto-CC3 platform configuration.
1821 * @brief Request for auto-CC3 configuration of a cluster
1823 struct mrq_cpu_auto_cc3_request
{
1824 /** @brief Enum cluster_id (logical cluster id, known to CCPLEX s/w) */
1825 uint32_t cluster_id
;
1829 * @brief Response to #MRQ_CPU_AUTO_CC3
1831 struct mrq_cpu_auto_cc3_response
{
1833 * @brief auto-CC3 configuration
1835 * - bits[31..10] reserved.
1836 * - bits[9..1] cc3 ndiv
1837 * - bit [0] if "1" auto-CC3 is allowed, if "0" auto-CC3 is not allowed
1839 uint32_t auto_cc3_config
;
1846 * @ingroup MRQ_Codes
1847 * @def MRQ_TRACE_ITER
1848 * @brief Manage the trace iterator
1851 * * Initiators: CCPLEX
1853 * * Request Payload: N/A
1854 * * Response Payload: @ref mrq_trace_iter_request
1859 /** @brief (re)start the tracing now. Ignore older events */
1860 TRACE_ITER_INIT
= 0,
1861 /** @brief Clobber all events in the trace buffer */
1862 TRACE_ITER_CLEAN
= 1
1866 * @brief Request with #MRQ_TRACE_ITER
1868 struct mrq_trace_iter_request
{
1869 /** @brief TRACE_ITER_INIT or TRACE_ITER_CLEAN */
1876 * @ingroup MRQ_Codes
1877 * @def MRQ_RINGBUF_CONSOLE
1878 * @brief A ring buffer debug console for BPMP
1879 * @addtogroup RingbufConsole
1881 * The ring buffer debug console aims to be a substitute for the UART debug
1882 * console. The debug console is implemented with two ring buffers in the
1883 * BPMP-FW, the RX (receive) and TX (transmit) buffers. Characters can be read
1884 * and written to the buffers by the host via the MRQ interface.
1890 * @brief Maximum number of bytes transferred in a single write command to the
1893 * This is determined by the number of free bytes in the message struct,
1894 * rounded down to a multiple of four.
1896 #define MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN 112
1899 * @brief Maximum number of bytes transferred in a single read command to the
1902 * This is determined by the number of free bytes in the message struct,
1903 * rounded down to a multiple of four.
1905 #define MRQ_RINGBUF_CONSOLE_MAX_READ_LEN 116
1907 enum mrq_ringbuf_console_host_to_bpmp_cmd
{
1909 * @brief Check whether the BPMP driver supports the specified request
1912 * mrq_response::err is 0 if the specified request is supported and
1913 * -#BPMP_ENODEV otherwise
1915 CMD_RINGBUF_CONSOLE_QUERY_ABI
= 0,
1917 * @brief Perform a read operation on the BPMP TX buffer
1919 * mrq_response::err is 0
1921 CMD_RINGBUF_CONSOLE_READ
= 1,
1923 * @brief Perform a write operation on the BPMP RX buffer
1925 * mrq_response::err is 0 if the operation was successful and
1926 * -#BPMP_ENODEV otherwise
1928 CMD_RINGBUF_CONSOLE_WRITE
= 2,
1930 * @brief Get the length of the buffer and the physical addresses of
1931 * the buffer data and the head and tail counters
1933 * mrq_response::err is 0 if the operation was successful and
1934 * -#BPMP_ENODEV otherwise
1936 CMD_RINGBUF_CONSOLE_GET_FIFO
= 3,
1940 * @ingroup RingbufConsole
1941 * @brief Host->BPMP request data for request type
1942 * #CMD_RINGBUF_CONSOLE_QUERY_ABI
1944 struct cmd_ringbuf_console_query_abi_req
{
1945 /** @brief Command identifier to be queried */
1950 struct cmd_ringbuf_console_query_abi_resp
{
1955 * @ingroup RingbufConsole
1956 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_READ
1958 struct cmd_ringbuf_console_read_req
{
1960 * @brief Number of bytes requested to be read from the BPMP TX buffer
1966 * @ingroup RingbufConsole
1967 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_READ
1969 struct cmd_ringbuf_console_read_resp
{
1970 /** @brief The actual data read from the BPMP TX buffer */
1971 uint8_t data
[MRQ_RINGBUF_CONSOLE_MAX_READ_LEN
];
1972 /** @brief Number of bytes in cmd_ringbuf_console_read_resp::data */
1977 * @ingroup RingbufConsole
1978 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_WRITE
1980 struct cmd_ringbuf_console_write_req
{
1981 /** @brief The actual data to be written to the BPMP RX buffer */
1982 uint8_t data
[MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN
];
1983 /** @brief Number of bytes in cmd_ringbuf_console_write_req::data */
1988 * @ingroup RingbufConsole
1989 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_WRITE
1991 struct cmd_ringbuf_console_write_resp
{
1992 /** @brief Number of bytes of available space in the BPMP RX buffer */
1993 uint32_t space_avail
;
1994 /** @brief Number of bytes that were written to the BPMP RX buffer */
1999 struct cmd_ringbuf_console_get_fifo_req
{
2004 * @ingroup RingbufConsole
2005 * @brief BPMP->Host reply data for request type #CMD_RINGBUF_CONSOLE_GET_FIFO
2007 struct cmd_ringbuf_console_get_fifo_resp
{
2008 /** @brief Physical address of the BPMP TX buffer */
2009 uint64_t bpmp_tx_buf_addr
;
2010 /** @brief Physical address of the BPMP TX buffer head counter */
2011 uint64_t bpmp_tx_head_addr
;
2012 /** @brief Physical address of the BPMP TX buffer tail counter */
2013 uint64_t bpmp_tx_tail_addr
;
2014 /** @brief Length of the BPMP TX buffer */
2015 uint32_t bpmp_tx_buf_len
;
2019 * @ingroup RingbufConsole
2020 * @brief Host->BPMP request data.
2022 * Reply type is union #mrq_ringbuf_console_bpmp_to_host_response .
2024 struct mrq_ringbuf_console_host_to_bpmp_request
{
2026 * @brief Type of request. Values listed in enum
2027 * #mrq_ringbuf_console_host_to_bpmp_cmd.
2030 /** @brief request type specific parameters. */
2032 struct cmd_ringbuf_console_query_abi_req query_abi
;
2033 struct cmd_ringbuf_console_read_req read
;
2034 struct cmd_ringbuf_console_write_req write
;
2035 struct cmd_ringbuf_console_get_fifo_req get_fifo
;
2040 * @ingroup RingbufConsole
2041 * @brief Host->BPMP reply data
2043 * In response to struct #mrq_ringbuf_console_host_to_bpmp_request.
2045 union mrq_ringbuf_console_bpmp_to_host_response
{
2046 struct cmd_ringbuf_console_query_abi_resp query_abi
;
2047 struct cmd_ringbuf_console_read_resp read
;
2048 struct cmd_ringbuf_console_write_resp write
;
2049 struct cmd_ringbuf_console_get_fifo_resp get_fifo
;
2054 * @ingroup MRQ_Codes
2056 * @brief Set a strap value controlled by BPMP
2058 * * Platforms: T194 onwards
2060 * * Initiators: CCPLEX
2062 * * Request Payload: @ref mrq_strap_request
2063 * * Response Payload: N/A
2066 * A strap is an input that is sampled by a hardware unit during the
2067 * unit's startup process. The sampled value of a strap affects the
2068 * behavior of the unit until the unit is restarted. Many hardware
2069 * units sample their straps at the instant that their resets are
2072 * BPMP owns registers which act as straps to various units. It
2073 * exposes limited control of those straps via #MRQ_STRAP.
2077 enum mrq_strap_cmd
{
2080 /** @brief Set a strap value */
2085 * @brief Request with #MRQ_STRAP
2087 struct mrq_strap_request
{
2088 /** @brief @ref mrq_strap_cmd */
2090 /** @brief Strap ID from @ref Strap_Ids */
2092 /** @brief Desired value for strap (if cmd is #STRAP_SET) */
2097 * @defgroup Strap_Ids Strap Identifiers
2103 * @ingroup MRQ_Codes
2105 * @brief Perform a UPHY operation
2107 * * Platforms: T194 onwards
2109 * * Initiators: CCPLEX
2111 * * Request Payload: @ref mrq_uphy_request
2112 * * Response Payload: @ref mrq_uphy_response
2118 CMD_UPHY_PCIE_LANE_MARGIN_CONTROL
= 1,
2119 CMD_UPHY_PCIE_LANE_MARGIN_STATUS
= 2,
2120 CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT
= 3,
2121 CMD_UPHY_PCIE_CONTROLLER_STATE
= 4,
2125 struct cmd_uphy_margin_control_request
{
2126 /** @brief Enable margin */
2128 /** @brief Clear the number of error and sections */
2130 /** @brief Set x offset (1's complement) for left/right margin type (y should be 0) */
2132 /** @brief Set y offset (1's complement) for left/right margin type (x should be 0) */
2134 /** @brief Set number of bit blocks for each margin section */
2138 struct cmd_uphy_margin_status_response
{
2139 /** @brief Number of errors observed */
2143 struct cmd_uphy_ep_controller_pll_init_request
{
2144 /** @brief EP controller number, valid: 0, 4, 5 */
2145 uint8_t ep_controller
;
2148 struct cmd_uphy_pcie_controller_state_request
{
2149 /** @brief PCIE controller number, valid: 0, 1, 2, 3, 4 */
2150 uint8_t pcie_controller
;
2156 * @brief Request with #MRQ_UPHY
2158 * Used by the sender of an #MRQ_UPHY message to control UPHY Lane RX margining.
2159 * The uphy_request is split into several sub-commands. Some sub-commands
2160 * require no additional data. Others have a sub-command specific payload
2162 * |sub-command |payload |
2163 * |------------------------------------ |----------------------------------------|
2164 * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL |uphy_set_margin_control |
2165 * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS | |
2166 * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT |cmd_uphy_ep_controller_pll_init_request |
2167 * |CMD_UPHY_PCIE_CONTROLLER_STATE |cmd_uphy_pcie_controller_state_request |
2171 struct mrq_uphy_request
{
2172 /** @brief Lane number. */
2174 /** @brief Sub-command id. */
2178 struct cmd_uphy_margin_control_request uphy_set_margin_control
;
2179 struct cmd_uphy_ep_controller_pll_init_request ep_ctrlr_pll_init
;
2180 struct cmd_uphy_pcie_controller_state_request controller_state
;
2186 * @brief Response to MRQ_UPHY
2188 * Each sub-command supported by @ref mrq_uphy_request may return
2189 * sub-command-specific data. Some do and some do not as indicated in
2190 * the following table
2192 * |sub-command |payload |
2193 * |---------------------------- |------------------------|
2194 * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL | |
2195 * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS |uphy_get_margin_status |
2199 struct mrq_uphy_response
{
2201 struct cmd_uphy_margin_status_response uphy_get_margin_status
;
2209 * @ingroup MRQ_Codes
2211 * @brief Perform a frequency monitor configuration operations
2213 * * Platforms: T194 onwards
2215 * * Initiators: CCPLEX
2217 * * Request Payload: @ref mrq_fmon_request
2218 * * Response Payload: @ref mrq_fmon_response
2225 * @brief Clamp FMON configuration to specified rate.
2227 * The monitored clock must be running for clamp to succeed. If
2228 * clamped, FMON configuration is preserved when clock rate
2229 * and/or state is changed.
2231 CMD_FMON_GEAR_CLAMP
= 1,
2233 * @brief Release clamped FMON configuration.
2235 * Allow FMON configuration to follow monitored clock rate
2236 * and/or state changes.
2238 CMD_FMON_GEAR_FREE
= 2,
2240 * @brief Return rate FMON is clamped at, or 0 if FMON is not
2243 * Inherently racy, since clamp state can be changed
2244 * concurrently. Useful for testing.
2246 CMD_FMON_GEAR_GET
= 3,
2250 struct cmd_fmon_gear_clamp_request
{
2256 struct cmd_fmon_gear_clamp_response
{
2261 struct cmd_fmon_gear_free_request
{
2266 struct cmd_fmon_gear_free_response
{
2271 struct cmd_fmon_gear_get_request
{
2275 struct cmd_fmon_gear_get_response
{
2281 * @brief Request with #MRQ_FMON
2283 * Used by the sender of an #MRQ_FMON message to configure clock
2284 * frequency monitors. The FMON request is split into several
2285 * sub-commands. Some sub-commands require no additional data.
2286 * Others have a sub-command specific payload
2288 * |sub-command |payload |
2289 * |----------------------------|-----------------------|
2290 * |CMD_FMON_GEAR_CLAMP |fmon_gear_clamp |
2291 * |CMD_FMON_GEAR_FREE |- |
2292 * |CMD_FMON_GEAR_GET |- |
2296 struct mrq_fmon_request
{
2297 /** @brief Sub-command and clock id concatenated to 32-bit word.
2298 * - bits[31..24] is the sub-cmd.
2299 * - bits[23..0] is monitored clock id used to select target
2302 uint32_t cmd_and_id
;
2305 struct cmd_fmon_gear_clamp_request fmon_gear_clamp
;
2307 struct cmd_fmon_gear_free_request fmon_gear_free
;
2309 struct cmd_fmon_gear_get_request fmon_gear_get
;
2315 * @brief Response to MRQ_FMON
2317 * Each sub-command supported by @ref mrq_fmon_request may
2318 * return sub-command-specific data as indicated below.
2320 * |sub-command |payload |
2321 * |----------------------------|------------------------|
2322 * |CMD_FMON_GEAR_CLAMP |- |
2323 * |CMD_FMON_GEAR_FREE |- |
2324 * |CMD_FMON_GEAR_GET |fmon_gear_get |
2328 struct mrq_fmon_response
{
2331 struct cmd_fmon_gear_clamp_response fmon_gear_clamp
;
2333 struct cmd_fmon_gear_free_response fmon_gear_free
;
2334 struct cmd_fmon_gear_get_response fmon_gear_get
;
2342 * @ingroup MRQ_Codes
2344 * @brief Provide status information on faults reported by Error
2345 * Collator (EC) to HSM.
2347 * * Platforms: T194 onwards
2349 * * Initiators: CCPLEX
2351 * * Request Payload: @ref mrq_ec_request
2352 * * Response Payload: @ref mrq_ec_response
2354 * @note This MRQ ABI is under construction, and subject to change
2361 * @brief Retrieve specified EC status.
2363 * mrq_response::err is 0 if the operation was successful, or @n
2364 * -#BPMP_ENODEV if target EC is not owned by BPMP @n
2365 * -#BPMP_EACCES if target EC power domain is turned off
2367 CMD_EC_STATUS_GET
= 1,
2371 /** @brief BPMP ECs error types */
2372 enum bpmp_ec_err_type
{
2373 /** @brief Parity error on internal data path
2375 * Error descriptor @ref ec_err_simple_desc.
2377 EC_ERR_TYPE_PARITY_INTERNAL
= 1,
2379 /** @brief ECC SEC error on internal data path
2381 * Error descriptor @ref ec_err_simple_desc.
2383 EC_ERR_TYPE_ECC_SEC_INTERNAL
= 2,
2385 /** @brief ECC DED error on internal data path
2387 * Error descriptor @ref ec_err_simple_desc.
2389 EC_ERR_TYPE_ECC_DED_INTERNAL
= 3,
2391 /** @brief Comparator error
2393 * Error descriptor @ref ec_err_simple_desc.
2395 EC_ERR_TYPE_COMPARATOR
= 4,
2397 /** @brief Register parity error
2399 * Error descriptor @ref ec_err_reg_parity_desc.
2401 EC_ERR_TYPE_REGISTER_PARITY
= 5,
2403 /** @brief Parity error from on-chip SRAM/FIFO
2405 * Error descriptor @ref ec_err_simple_desc.
2407 EC_ERR_TYPE_PARITY_SRAM
= 6,
2409 /** @brief Clock Monitor error
2411 * Error descriptor @ref ec_err_fmon_desc.
2413 EC_ERR_TYPE_CLOCK_MONITOR
= 9,
2415 /** @brief Voltage Monitor error
2417 * Error descriptor @ref ec_err_vmon_desc.
2419 EC_ERR_TYPE_VOLTAGE_MONITOR
= 10,
2421 /** @brief SW Correctable error
2423 * Error descriptor @ref ec_err_simple_desc.
2425 EC_ERR_TYPE_SW_CORRECTABLE
= 16,
2427 /** @brief SW Uncorrectable error
2429 * Error descriptor @ref ec_err_simple_desc.
2431 EC_ERR_TYPE_SW_UNCORRECTABLE
= 17,
2433 /** @brief Other HW Correctable error
2435 * Error descriptor @ref ec_err_simple_desc.
2437 EC_ERR_TYPE_OTHER_HW_CORRECTABLE
= 32,
2439 /** @brief Other HW Uncorrectable error
2441 * Error descriptor @ref ec_err_simple_desc.
2443 EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE
= 33,
2446 /** @brief Group of registers with parity error. */
2447 enum ec_registers_group
{
2448 /** @brief Functional registers group */
2449 EC_ERR_GROUP_FUNC_REG
= 0,
2450 /** @brief SCR registers group */
2451 EC_ERR_GROUP_SCR_REG
= 1,
2455 * @defgroup bpmp_ec_status_flags EC Status Flags
2456 * @addtogroup bpmp_ec_status_flags
2459 /** @brief No EC error found flag */
2460 #define EC_STATUS_FLAG_NO_ERROR 0x0001
2461 /** @brief Last EC error found flag */
2462 #define EC_STATUS_FLAG_LAST_ERROR 0x0002
2463 /** @brief EC latent error flag */
2464 #define EC_STATUS_FLAG_LATENT_ERROR 0x0004
2468 * @defgroup bpmp_ec_desc_flags EC Descriptor Flags
2469 * @addtogroup bpmp_ec_desc_flags
2472 /** @brief EC descriptor error resolved flag */
2473 #define EC_DESC_FLAG_RESOLVED 0x0001
2474 /** @brief EC descriptor failed to retrieve id flag */
2475 #define EC_DESC_FLAG_NO_ID 0x0002
2479 * |error type | fmon_clk_id values |
2480 * |---------------------------------|---------------------------|
2481 * |@ref EC_ERR_TYPE_CLOCK_MONITOR |@ref bpmp_clock_ids |
2483 struct ec_err_fmon_desc
{
2484 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
2485 uint16_t desc_flags
;
2486 /** @brief FMON monitored clock id */
2487 uint16_t fmon_clk_id
;
2488 /** @brief Bitmask of @ref bpmp_fmon_faults_flags */
2489 uint32_t fmon_faults
;
2490 /** @brief FMON faults access error */
2491 int32_t fmon_access_error
;
2495 * |error type | vmon_adc_id values |
2496 * |---------------------------------|---------------------------|
2497 * |@ref EC_ERR_TYPE_VOLTAGE_MONITOR |@ref bpmp_adc_ids |
2499 struct ec_err_vmon_desc
{
2500 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
2501 uint16_t desc_flags
;
2502 /** @brief VMON rail adc id */
2503 uint16_t vmon_adc_id
;
2504 /** @brief Bitmask of @ref bpmp_vmon_faults_flags */
2505 uint32_t vmon_faults
;
2506 /** @brief VMON faults access error */
2507 int32_t vmon_access_error
;
2511 * |error type | reg_id values |
2512 * |---------------------------------|---------------------------|
2513 * |@ref EC_ERR_TYPE_REGISTER_PARITY |@ref bpmp_ec_registers_ids |
2515 struct ec_err_reg_parity_desc
{
2516 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
2517 uint16_t desc_flags
;
2518 /** @brief Register id */
2520 /** @brief Register group @ref ec_registers_group */
2525 * |error type | err_source_id values |
2526 * |----------------------------------------|---------------------------|
2527 * |@ref EC_ERR_TYPE_PARITY_INTERNAL |@ref bpmp_ec_ipath_ids |
2528 * |@ref EC_ERR_TYPE_ECC_SEC_INTERNAL |@ref bpmp_ec_ipath_ids |
2529 * |@ref EC_ERR_TYPE_ECC_DED_INTERNAL |@ref bpmp_ec_ipath_ids |
2530 * |@ref EC_ERR_TYPE_COMPARATOR |@ref bpmp_ec_comparator_ids|
2531 * |@ref EC_ERR_TYPE_PARITY_SRAM |@ref bpmp_clock_ids |
2532 * |@ref EC_ERR_TYPE_SW_CORRECTABLE |@ref bpmp_ec_misc_ids |
2533 * |@ref EC_ERR_TYPE_SW_UNCORRECTABLE |@ref bpmp_ec_misc_ids |
2534 * |@ref EC_ERR_TYPE_OTHER_HW_CORRECTABLE |@ref bpmp_ec_misc_ids |
2535 * |@ref EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE |@ref bpmp_ec_misc_ids |
2537 struct ec_err_simple_desc
{
2538 /** @brief Bitmask of @ref bpmp_ec_desc_flags */
2539 uint16_t desc_flags
;
2540 /** @brief Error source id. Id space depends on error type. */
2541 uint16_t err_source_id
;
2544 /** @brief Union of EC error descriptors */
2546 struct ec_err_fmon_desc fmon_desc
;
2547 struct ec_err_vmon_desc vmon_desc
;
2548 struct ec_err_reg_parity_desc reg_parity_desc
;
2549 struct ec_err_simple_desc simple_desc
;
2552 struct cmd_ec_status_get_request
{
2553 /** @brief HSM error line number that identifies target EC. */
2557 /** EC status maximum number of descriptors */
2558 #define EC_ERR_STATUS_DESC_MAX_NUM 4
2560 struct cmd_ec_status_get_response
{
2561 /** @brief Target EC id (the same id received with request). */
2564 * @brief Bitmask of @ref bpmp_ec_status_flags
2566 * If NO_ERROR flag is set, error_ fields should be ignored
2568 uint32_t ec_status_flags
;
2569 /** @brief Found EC error index. */
2571 /** @brief Found EC error type @ref bpmp_ec_err_type. */
2572 uint32_t error_type
;
2573 /** @brief Number of returned EC error descriptors */
2574 uint32_t error_desc_num
;
2575 /** @brief EC error descriptors */
2576 union ec_err_desc error_descs
[EC_ERR_STATUS_DESC_MAX_NUM
];
2581 * @brief Request with #MRQ_EC
2583 * Used by the sender of an #MRQ_EC message to access ECs owned
2586 * |sub-command |payload |
2587 * |----------------------------|-----------------------|
2588 * |@ref CMD_EC_STATUS_GET |ec_status_get |
2592 struct mrq_ec_request
{
2593 /** @brief Sub-command id. */
2597 struct cmd_ec_status_get_request ec_status_get
;
2603 * @brief Response to MRQ_EC
2605 * Each sub-command supported by @ref mrq_ec_request may return
2606 * sub-command-specific data as indicated below.
2608 * |sub-command |payload |
2609 * |----------------------------|------------------------|
2610 * |@ref CMD_EC_STATUS_GET |ec_status_get |
2614 struct mrq_ec_response
{
2616 struct cmd_ec_status_get_response ec_status_get
;
2624 * @ingroup MRQ_Codes
2625 * @def MRQ_FBVOLT_STATUS
2626 * @brief Provides status information about voltage state for fuse burning
2628 * * Platforms: T194 onwards
2630 * * Initiators: CCPLEX
2632 * * Request Payload: None
2633 * * Response Payload: @ref mrq_fbvolt_status_response
2638 * @ingroup Fbvolt_status
2639 * @brief Response to #MRQ_FBVOLT_STATUS
2641 * Value of #ready reflects if core voltages are in a suitable state for buring
2642 * fuses. A value of 0x1 indicates that core voltages are ready for burning
2643 * fuses. A value of 0x0 indicates that core voltages are not ready.
2645 struct mrq_fbvolt_status_response
{
2646 /** @brief Bit [0:0] - ready status, bits [31:1] - reserved */
2648 /** @brief Reserved */
2656 * @addtogroup Error_Codes
2657 * Negative values for mrq_response::err generally indicate some
2658 * error. The ABI defines the following error codes. Negating these
2659 * defines is an exercise left to the user.
2663 /** @brief No such file or directory */
2664 #define BPMP_ENOENT 2
2665 /** @brief No MRQ handler */
2666 #define BPMP_ENOHANDLER 3
2667 /** @brief I/O error */
2669 /** @brief Bad sub-MRQ command */
2670 #define BPMP_EBADCMD 6
2671 /** @brief Not enough memory */
2672 #define BPMP_ENOMEM 12
2673 /** @brief Permission denied */
2674 #define BPMP_EACCES 13
2675 /** @brief Bad address */
2676 #define BPMP_EFAULT 14
2677 /** @brief No such device */
2678 #define BPMP_ENODEV 19
2679 /** @brief Argument is a directory */
2680 #define BPMP_EISDIR 21
2681 /** @brief Invalid argument */
2682 #define BPMP_EINVAL 22
2683 /** @brief Timeout during operation */
2684 #define BPMP_ETIMEDOUT 23
2685 /** @brief Out of range */
2686 #define BPMP_ERANGE 34
2687 /** @brief Function not implemented */
2688 #define BPMP_ENOSYS 38
2689 /** @brief Invalid slot */
2690 #define BPMP_EBADSLT 57