2 * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
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.
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
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/>.
17 #ifndef _ABI_BPMP_ABI_H_
18 #define _ABI_BPMP_ABI_H_
25 #define __ABI_PACKED __attribute__((packed))
28 #ifdef NO_GCC_EXTENSIONS
29 #define EMPTY char empty;
45 * @defgroup MRQ MRQ Messages
46 * @brief Messages sent to/from BPMP via IPC
48 * @defgroup MRQ_Format Message Format
49 * @defgroup MRQ_Codes Message Request (MRQ) Codes
50 * @defgroup MRQ_Payloads Message Payloads
51 * @defgroup Error_Codes Error Codes
56 * @addtogroup MRQ_Format Message Format
58 * The CPU requests the BPMP to perform a particular service by
59 * sending it an IVC frame containing a single MRQ message. An MRQ
60 * message consists of a @ref mrq_request followed by a payload whose
61 * format depends on mrq_request::mrq.
63 * The BPMP processes the data and replies with an IVC frame (on the
64 * same IVC channel) containing and MRQ response. An MRQ response
65 * consists of a @ref mrq_response followed by a payload whose format
66 * depends on the associated mrq_request::mrq.
68 * A well-defined subset of the MRQ messages that the CPU sends to the
69 * BPMP can lead to BPMP eventually sending an MRQ message to the
70 * CPU. For example, when the CPU uses an #MRQ_THERMAL message to set
71 * a thermal trip point, the BPMP may eventually send a single
72 * #MRQ_THERMAL message of its own to the CPU indicating that the trip
73 * point has been crossed.
79 * @brief header for an MRQ message
81 * Provides the MRQ number for the MRQ message: #mrq. The remainder of
82 * the MRQ message is a payload (immediately following the
83 * mrq_request) whose format depends on mrq.
85 * @todo document the flags
88 /** @brief MRQ number of the request */
90 /** @brief flags for the request */
96 * @brief header for an MRQ response
98 * Provides an error code for the associated MRQ message. The
99 * remainder of the MRQ response is a payload (immediately following
100 * the mrq_response) whose format depends on the associated
103 * @todo document the flags
105 struct mrq_response
{
106 /** @brief error code for the MRQ request itself */
108 /** @brief flags for the response */
113 * @ingroup MRQ_Format
114 * Minimum needed size for an IPC message buffer
116 #define MSG_MIN_SZ 128
118 * @ingroup MRQ_Format
119 * Minimum size guaranteed for data in an IPC message buffer
121 #define MSG_DATA_MIN_SZ 120
125 * @name Legal MRQ codes
126 * These are the legal values for mrq_request::mrq
131 #define MRQ_QUERY_TAG 1
132 #define MRQ_MODULE_LOAD 4
133 #define MRQ_MODULE_UNLOAD 5
134 #define MRQ_TRACE_MODIFY 7
135 #define MRQ_WRITE_TRACE 8
136 #define MRQ_THREADED_PING 9
137 #define MRQ_MODULE_MAIL 11
138 #define MRQ_DEBUGFS 19
142 #define MRQ_QUERY_ABI 23
143 #define MRQ_PG_READ_STATE 25
144 #define MRQ_PG_UPDATE_STATE 26
145 #define MRQ_THERMAL 27
146 #define MRQ_CPU_VHINT 28
147 #define MRQ_ABI_RATCHET 29
148 #define MRQ_EMC_DVFS_LATENCY 31
149 #define MRQ_TRACE_ITER 64
155 * @brief Maximum MRQ code to be sent by CPU software to
156 * BPMP. Subject to change in future
158 #define MAX_CPU_MRQ_ID 64
161 * @addtogroup MRQ_Payloads Message Payloads
164 * @defgroup Query_Tag Query Tag
165 * @defgroup Module Loadable Modules
171 * @defgroup ABI_info ABI Info
172 * @defgroup MC_Flush MC Flush
173 * @defgroup Powergating
175 * @defgroup Vhint CPU Voltage hint
176 * @defgroup MRQ_Deprecated Deprecated MRQ messages
185 * @brief A simple ping
190 * * Request Payload: @ref mrq_ping_request
191 * * Response Payload: @ref mrq_ping_response
194 * @def MRQ_THREADED_PING
195 * @brief A deeper ping
200 * * Request Payload: @ref mrq_ping_request
201 * * Response Payload: @ref mrq_ping_response
203 * Behavior is equivalent to a simple #MRQ_PING except that BPMP
204 * responds from a thread context (providing a slightly more robust
211 * @brief request with #MRQ_PING
213 * Used by the sender of an #MRQ_PING message to request a pong from
214 * recipient. The response from the recipient is computed based on
217 struct mrq_ping_request
{
218 /** @brief arbitrarily chosen value */
224 * @brief response to #MRQ_PING
226 * Sent in response to an #MRQ_PING message. #reply should be the
227 * mrq_ping_request challenge left shifted by 1 with the carry-bit
231 struct mrq_ping_response
{
232 /** @brief response to the MRQ_PING challege */
239 * @brief Query BPMP firmware's tag (i.e. version information)
242 * * Initiators: CCPLEX
244 * * Request Payload: @ref mrq_query_tag_request
245 * * Response Payload: N/A
251 * @brief request with #MRQ_QUERY_TAG
253 * Used by #MRQ_QUERY_TAG call to ask BPMP to fill in the memory
254 * pointed by #addr with BPMP firmware header.
256 * The sender is reponsible for ensuring that #addr is mapped in to
257 * the recipient's address map.
259 struct mrq_query_tag_request
{
260 /** @brief base address to store the firmware header */
266 * @def MRQ_MODULE_LOAD
267 * @brief dynamically load a BPMP code module
270 * * Initiators: CCPLEX
272 * * Request Payload: @ref mrq_module_load_request
273 * * Response Payload: @ref mrq_module_load_response
275 * @note This MRQ is disabled on production systems
281 * @brief request with #MRQ_MODULE_LOAD
283 * Used by #MRQ_MODULE_LOAD calls to ask the recipient to dynamically
284 * load the code located at #phys_addr and having size #size
285 * bytes. #phys_addr is treated as a void pointer.
287 * The recipient copies the code from #phys_addr to locally allocated
288 * memory prior to responding to this message.
290 * @todo document the module header format
292 * The sender is responsible for ensuring that the code is mapped in
293 * the recipient's address map.
296 struct mrq_module_load_request
{
297 /** @brief base address of the code to load. Treated as (void *) */
298 uint32_t phys_addr
; /* (void *) */
299 /** @brief size in bytes of code to load */
305 * @brief response to #MRQ_MODULE_LOAD
307 * @todo document mrq_response::err
309 struct mrq_module_load_response
{
310 /** @brief handle to the loaded module */
316 * @def MRQ_MODULE_UNLOAD
317 * @brief unload a previously loaded code module
320 * * Initiators: CCPLEX
322 * * Request Payload: @ref mrq_module_unload_request
323 * * Response Payload: N/A
325 * @note This MRQ is disabled on production systems
330 * @brief request with #MRQ_MODULE_UNLOAD
332 * Used by #MRQ_MODULE_UNLOAD calls to request that a previously loaded
333 * module be unloaded.
335 struct mrq_module_unload_request
{
336 /** @brief handle of the module to unload */
342 * @def MRQ_TRACE_MODIFY
343 * @brief modify the set of enabled trace events
346 * * Initiators: CCPLEX
348 * * Request Payload: @ref mrq_trace_modify_request
349 * * Response Payload: @ref mrq_trace_modify_response
351 * @note This MRQ is disabled on production systems
356 * @brief request with #MRQ_TRACE_MODIFY
358 * Used by %MRQ_TRACE_MODIFY calls to enable or disable specify trace
359 * events. #set takes precedence for any bit set in both #set and
362 struct mrq_trace_modify_request
{
363 /** @brief bit mask of trace events to disable */
365 /** @brief bit mask of trace events to enable */
371 * @brief response to #MRQ_TRACE_MODIFY
373 * Sent in repsonse to an #MRQ_TRACE_MODIFY message. #mask reflects the
374 * state of which events are enabled after the recipient acted on the
378 struct mrq_trace_modify_response
{
379 /** @brief bit mask of trace event enable states */
385 * @def MRQ_WRITE_TRACE
386 * @brief Write trace data to a buffer
389 * * Initiators: CCPLEX
391 * * Request Payload: @ref mrq_write_trace_request
392 * * Response Payload: @ref mrq_write_trace_response
394 * mrq_response::err depends on the @ref mrq_write_trace_request field
395 * values. err is -#BPMP_EINVAL if size is zero or area is NULL or
396 * area is in an illegal range. A positive value for err indicates the
397 * number of bytes written to area.
399 * @note This MRQ is disabled on production systems
404 * @brief request with #MRQ_WRITE_TRACE
406 * Used by MRQ_WRITE_TRACE calls to ask the recipient to copy trace
407 * data from the recipient's local buffer to the output buffer. #area
408 * is treated as a byte-aligned pointer in the recipient's address
411 * The sender is responsible for ensuring that the output
412 * buffer is mapped in the recipient's address map. The recipient is
413 * responsible for protecting its own code and data from accidental
416 struct mrq_write_trace_request
{
417 /** @brief base address of output buffer */
419 /** @brief size in bytes of the output buffer */
425 * @brief response to #MRQ_WRITE_TRACE
427 * Once this response is sent, the respondent will not access the
428 * output buffer further.
430 struct mrq_write_trace_response
{
432 * @brief flag whether more data remains in local buffer
434 * Value is 1 if the entire local trace buffer has been
435 * drained to the outputbuffer. Value is 0 otherwise.
441 struct mrq_threaded_ping_request
{
446 struct mrq_threaded_ping_response
{
452 * @def MRQ_MODULE_MAIL
453 * @brief send a message to a loadable module
458 * * Request Payload: @ref mrq_module_mail_request
459 * * Response Payload: @ref mrq_module_mail_response
461 * @note This MRQ is disabled on production systems
466 * @brief request with #MRQ_MODULE_MAIL
468 struct mrq_module_mail_request
{
469 /** @brief handle to the previously loaded module */
471 /** @brief module-specific mail payload
473 * The length of data[ ] is unknown to the BPMP core firmware
474 * but it is limited to the size of an IPC message.
476 uint8_t data
[EMPTY_ARRAY
];
481 * @brief response to #MRQ_MODULE_MAIL
483 struct mrq_module_mail_response
{
484 /** @brief module-specific mail payload
486 * The length of data[ ] is unknown to the BPMP core firmware
487 * but it is limited to the size of an IPC message.
489 uint8_t data
[EMPTY_ARRAY
];
495 * @brief Interact with BPMP's debugfs file nodes
500 * * Request Payload: @ref mrq_debugfs_request
501 * * Response Payload: @ref mrq_debugfs_response
505 * @addtogroup Debugfs
508 * The BPMP firmware implements a pseudo-filesystem called
509 * debugfs. Any driver within the firmware may register with debugfs
510 * to expose an arbitrary set of "files" in the filesystem. When
511 * software on the CPU writes to a debugfs file, debugfs passes the
512 * written data to a callback provided by the driver. When software on
513 * the CPU reads a debugfs file, debugfs queries the driver for the
514 * data to return to the CPU. The intention of the debugfs filesystem
515 * is to provide information useful for debugging the system at
518 * @note The files exposed via debugfs are not part of the
519 * BPMP firmware's ABI. debugfs files may be added or removed in any
520 * given version of the firmware. Typically the semantics of a debugfs
521 * file are consistent from version to version but even that is not
526 /** @ingroup Debugfs */
527 enum mrq_debugfs_commands
{
528 CMD_DEBUGFS_READ
= 1,
529 CMD_DEBUGFS_WRITE
= 2,
530 CMD_DEBUGFS_DUMPDIR
= 3,
536 * @brief parameters for CMD_DEBUGFS_READ/WRITE command
538 struct cmd_debugfs_fileop_request
{
539 /** @brief physical address pointing at filename */
541 /** @brief length in bytes of filename buffer */
543 /** @brief physical address pointing to data buffer */
545 /** @brief length in bytes of data buffer */
551 * @brief parameters for CMD_DEBUGFS_READ/WRITE command
553 struct cmd_debugfs_dumpdir_request
{
554 /** @brief physical address pointing to data buffer */
556 /** @brief length in bytes of data buffer */
562 * @brief response data for CMD_DEBUGFS_READ/WRITE command
564 struct cmd_debugfs_fileop_response
{
565 /** @brief always 0 */
567 /** @brief number of bytes read from or written to data buffer */
573 * @brief response data for CMD_DEBUGFS_DUMPDIR command
575 struct cmd_debugfs_dumpdir_response
{
576 /** @brief always 0 */
578 /** @brief number of bytes read from or written to data buffer */
584 * @brief request with #MRQ_DEBUGFS.
586 * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs
587 * command to execute. Legal commands are the values of @ref
588 * mrq_debugfs_commands. Each command requires a specific additional
592 * |-------------------|-------|
593 * |CMD_DEBUGFS_READ |fop |
594 * |CMD_DEBUGFS_WRITE |fop |
595 * |CMD_DEBUGFS_DUMPDIR|dumpdir|
597 struct mrq_debugfs_request
{
600 struct cmd_debugfs_fileop_request fop
;
601 struct cmd_debugfs_dumpdir_request dumpdir
;
608 struct mrq_debugfs_response
{
609 /** @brief always 0 */
612 /** @brief response data for CMD_DEBUGFS_READ OR
613 * CMD_DEBUGFS_WRITE command
615 struct cmd_debugfs_fileop_response fop
;
616 /** @brief response data for CMD_DEBUGFS_DUMPDIR command */
617 struct cmd_debugfs_dumpdir_response dumpdir
;
622 * @addtogroup Debugfs
625 #define DEBUGFS_S_ISDIR (1 << 9)
626 #define DEBUGFS_S_IRUSR (1 << 8)
627 #define DEBUGFS_S_IWUSR (1 << 7)
634 * @brief reset an IP block
639 * * Request Payload: @ref mrq_reset_request
640 * * Response Payload: N/A
646 enum mrq_reset_commands
{
647 CMD_RESET_ASSERT
= 1,
648 CMD_RESET_DEASSERT
= 2,
649 CMD_RESET_MODULE
= 3,
650 CMD_RESET_MAX
, /* not part of ABI and subject to change */
655 * @brief request with MRQ_RESET
657 * Used by the sender of an #MRQ_RESET message to request BPMP to
658 * assert or or deassert a given reset line.
660 struct mrq_reset_request
{
661 /** @brief reset action to perform (@enum mrq_reset_commands) */
663 /** @brief id of the reset to affected */
670 * @brief issue an i2c transaction
675 * * Request Payload: @ref mrq_i2c_request
676 * * Response Payload: @ref mrq_i2c_response
683 #define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE (MSG_DATA_MIN_SZ - 12)
684 #define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE (MSG_DATA_MIN_SZ - 4)
689 * @name Serial I2C flags
690 * Use these flags with serial_i2c_request::flags
693 #define SERIALI2C_TEN 0x0010
694 #define SERIALI2C_RD 0x0001
695 #define SERIALI2C_STOP 0x8000
696 #define SERIALI2C_NOSTART 0x4000
697 #define SERIALI2C_REV_DIR_ADDR 0x2000
698 #define SERIALI2C_IGNORE_NAK 0x1000
699 #define SERIALI2C_NO_RD_ACK 0x0800
700 #define SERIALI2C_RECV_LEN 0x0400
709 * @brief serializable i2c request
711 * Instances of this structure are packed (little-endian) into
712 * cmd_i2c_xfer_request::data_buf. Each instance represents a single
713 * transaction (or a portion of a transaction with repeated starts) on
716 * Because these structures are packed, some instances are likely to
717 * be misaligned. Additionally because #data is variable length, it is
718 * not possible to iterate through a serialized list of these
719 * structures without inspecting #len in each instance. It may be
720 * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf
721 * manually rather than using this structure definition.
723 struct serial_i2c_request
{
724 /** @brief I2C slave address */
726 /** @brief bitmask of SERIALI2C_ flags */
728 /** @brief length of I2C transaction in bytes */
730 /** @brief for write transactions only, #len bytes of data */
736 * @brief trigger one or more i2c transactions
738 struct cmd_i2c_xfer_request
{
739 /** @brief valid bus number from mach-t186/i2c-t186.h*/
742 /** @brief count of valid bytes in #data_buf*/
745 /** @brief serialized packed instances of @ref serial_i2c_request*/
746 uint8_t data_buf
[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE
];
751 * @brief container for data read from the i2c bus
753 * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute
754 * zero or more I2C reads. The data read from the bus is serialized
757 struct cmd_i2c_xfer_response
{
758 /** @brief count of valid bytes in #data_buf*/
760 /** @brief i2c read data */
761 uint8_t data_buf
[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE
];
766 * @brief request with #MRQ_I2C
768 struct mrq_i2c_request
{
769 /** @brief always CMD_I2C_XFER (i.e. 1) */
771 /** @brief parameters of the transfer request */
772 struct cmd_i2c_xfer_request xfer
;
777 * @brief response to #MRQ_I2C
779 struct mrq_i2c_response
{
780 struct cmd_i2c_xfer_response xfer
;
790 * * Request Payload: @ref mrq_clk_request
791 * * Response Payload: @ref mrq_clk_response
797 * @name MRQ_CLK sub-commands
801 CMD_CLK_GET_RATE
= 1,
802 CMD_CLK_SET_RATE
= 2,
803 CMD_CLK_ROUND_RATE
= 3,
804 CMD_CLK_GET_PARENT
= 4,
805 CMD_CLK_SET_PARENT
= 5,
806 CMD_CLK_IS_ENABLED
= 6,
809 CMD_CLK_GET_ALL_INFO
= 14,
810 CMD_CLK_GET_MAX_CLK_ID
= 15,
815 #define MRQ_CLK_NAME_MAXLEN 40
816 #define MRQ_CLK_MAX_PARENTS 16
819 struct cmd_clk_get_rate_request
{
823 struct cmd_clk_get_rate_response
{
827 struct cmd_clk_set_rate_request
{
832 struct cmd_clk_set_rate_response
{
836 struct cmd_clk_round_rate_request
{
841 struct cmd_clk_round_rate_response
{
846 struct cmd_clk_get_parent_request
{
850 struct cmd_clk_get_parent_response
{
854 struct cmd_clk_set_parent_request
{
858 struct cmd_clk_set_parent_response
{
863 struct cmd_clk_is_enabled_request
{
867 struct cmd_clk_is_enabled_response
{
872 struct cmd_clk_enable_request
{
877 struct cmd_clk_enable_response
{
882 struct cmd_clk_disable_request
{
887 struct cmd_clk_disable_response
{
892 struct cmd_clk_get_all_info_request
{
896 struct cmd_clk_get_all_info_response
{
899 uint32_t parents
[MRQ_CLK_MAX_PARENTS
];
901 uint8_t name
[MRQ_CLK_NAME_MAXLEN
];
905 struct cmd_clk_get_max_clk_id_request
{
909 struct cmd_clk_get_max_clk_id_response
{
916 * @brief request with #MRQ_CLK
918 * Used by the sender of an #MRQ_CLK message to control clocks. The
919 * clk_request is split into several sub-commands. Some sub-commands
920 * require no additional data. Others have a sub-command specific
923 * |sub-command |payload |
924 * |----------------------------|-----------------------|
925 * |CMD_CLK_GET_RATE |- |
926 * |CMD_CLK_SET_RATE |clk_set_rate |
927 * |CMD_CLK_ROUND_RATE |clk_round_rate |
928 * |CMD_CLK_GET_PARENT |- |
929 * |CMD_CLK_SET_PARENT |clk_set_parent |
930 * |CMD_CLK_IS_ENABLED |- |
931 * |CMD_CLK_ENABLE |- |
932 * |CMD_CLK_DISABLE |- |
933 * |CMD_CLK_GET_ALL_INFO |- |
934 * |CMD_CLK_GET_MAX_CLK_ID |- |
938 struct mrq_clk_request
{
939 /** @brief sub-command and clock id concatenated to 32-bit word.
940 * - bits[31..24] is the sub-cmd.
941 * - bits[23..0] is the clock id
947 struct cmd_clk_get_rate_request clk_get_rate
;
948 struct cmd_clk_set_rate_request clk_set_rate
;
949 struct cmd_clk_round_rate_request clk_round_rate
;
951 struct cmd_clk_get_parent_request clk_get_parent
;
952 struct cmd_clk_set_parent_request clk_set_parent
;
954 struct cmd_clk_enable_request clk_enable
;
956 struct cmd_clk_disable_request clk_disable
;
958 struct cmd_clk_is_enabled_request clk_is_enabled
;
960 struct cmd_clk_get_all_info_request clk_get_all_info
;
962 struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id
;
968 * @brief response to MRQ_CLK
970 * Each sub-command supported by @ref mrq_clk_request may return
971 * sub-command-specific data. Some do and some do not as indicated in
972 * the following table
974 * |sub-command |payload |
975 * |----------------------------|------------------------|
976 * |CMD_CLK_GET_RATE |clk_get_rate |
977 * |CMD_CLK_SET_RATE |clk_set_rate |
978 * |CMD_CLK_ROUND_RATE |clk_round_rate |
979 * |CMD_CLK_GET_PARENT |clk_get_parent |
980 * |CMD_CLK_SET_PARENT |clk_set_parent |
981 * |CMD_CLK_IS_ENABLED |clk_is_enabled |
982 * |CMD_CLK_ENABLE |- |
983 * |CMD_CLK_DISABLE |- |
984 * |CMD_CLK_GET_ALL_INFO |clk_get_all_info |
985 * |CMD_CLK_GET_MAX_CLK_ID |clk_get_max_id |
989 struct mrq_clk_response
{
991 struct cmd_clk_get_rate_response clk_get_rate
;
992 struct cmd_clk_set_rate_response clk_set_rate
;
993 struct cmd_clk_round_rate_response clk_round_rate
;
994 struct cmd_clk_get_parent_response clk_get_parent
;
995 struct cmd_clk_set_parent_response clk_set_parent
;
997 struct cmd_clk_enable_response clk_enable
;
999 struct cmd_clk_disable_response clk_disable
;
1000 struct cmd_clk_is_enabled_response clk_is_enabled
;
1001 struct cmd_clk_get_all_info_response clk_get_all_info
;
1002 struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id
;
1007 * @ingroup MRQ_Codes
1008 * @def MRQ_QUERY_ABI
1009 * @brief check if an MRQ is implemented
1014 * * Request Payload: @ref mrq_query_abi_request
1015 * * Response Payload: @ref mrq_query_abi_response
1020 * @brief request with MRQ_QUERY_ABI
1022 * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported
1025 struct mrq_query_abi_request
{
1026 /** @brief MRQ code to query */
1032 * @brief response to MRQ_QUERY_ABI
1034 struct mrq_query_abi_response
{
1035 /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */
1040 * @ingroup MRQ_Codes
1041 * @def MRQ_PG_READ_STATE
1042 * @brief read the power-gating state of a partition
1047 * * Request Payload: @ref mrq_pg_read_state_request
1048 * * Response Payload: @ref mrq_pg_read_state_response
1049 * @addtogroup Powergating
1054 * @brief request with #MRQ_PG_READ_STATE
1056 * Used by MRQ_PG_READ_STATE call to read the current state of a
1059 struct mrq_pg_read_state_request
{
1060 /** @brief ID of partition */
1061 uint32_t partition_id
;
1065 * @brief response to MRQ_PG_READ_STATE
1066 * @todo define possible errors.
1068 struct mrq_pg_read_state_response
{
1069 /** @brief read as don't care */
1070 uint32_t sram_state
;
1071 /** @brief state of power partition
1075 uint32_t logic_state
;
1081 * @ingroup MRQ_Codes
1082 * @def MRQ_PG_UPDATE_STATE
1083 * @brief modify the power-gating state of a partition
1088 * * Request Payload: @ref mrq_pg_update_state_request
1089 * * Response Payload: N/A
1090 * @addtogroup Powergating
1095 * @brief request with mrq_pg_update_state_request
1097 * Used by #MRQ_PG_UPDATE_STATE call to request BPMP to change the
1098 * state of a power partition #partition_id.
1100 struct mrq_pg_update_state_request
{
1101 /** @brief ID of partition */
1102 uint32_t partition_id
;
1103 /** @brief secondary control of power partition
1104 * @details Ignored by many versions of the BPMP
1105 * firmware. For maximum compatibility, set the value
1106 * according to @logic_state
1107 * * 0x1: power ON partition (@ref logic_state == 0x3)
1108 * * 0x3: power OFF partition (@ref logic_state == 0x1)
1110 uint32_t sram_state
;
1111 /** @brief controls state of power partition, legal values are
1112 * * 0x1 : power OFF partition
1113 * * 0x3 : power ON partition
1115 uint32_t logic_state
;
1116 /** @brief change state of clocks of the power partition, legal values
1117 * * 0x0 : do not change clock state
1118 * * 0x1 : disable partition clocks (only applicable when
1119 * @ref logic_state == 0x1)
1120 * * 0x3 : enable partition clocks (only applicable when
1121 * @ref logic_state == 0x3)
1123 uint32_t clock_state
;
1128 * @ingroup MRQ_Codes
1130 * @brief interact with BPMP thermal framework
1135 * * Request Payload: TODO
1136 * * Response Payload: TODO
1138 * @addtogroup Thermal
1140 * The BPMP firmware includes a thermal framework. Drivers within the
1141 * bpmp firmware register with the framework to provide thermal
1142 * zones. Each thermal zone corresponds to an entity whose temperature
1143 * can be measured. The framework also has a notion of trip points. A
1144 * trip point consists of a thermal zone id, a temperature, and a
1145 * callback routine. The framework invokes the callback when the zone
1146 * hits the indicated temperature. The BPMP firmware uses this thermal
1147 * framework interally to implement various temperature-dependent
1150 * Software on the CPU can use #MRQ_THERMAL (with payload @ref
1151 * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal
1152 * framework. The CPU must It can query the number of supported zones,
1153 * query zone temperatures, and set trip points.
1155 * When a trip point set by the CPU gets crossed, BPMP firmware issues
1156 * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a
1157 * payload of @ref mrq_thermal_bpmp_to_host_request.
1160 enum mrq_thermal_host_to_bpmp_cmd
{
1162 * @brief Check whether the BPMP driver supports the specified
1165 * Host needs to supply request parameters.
1167 * mrq_response::err is 0 if the specified request is
1168 * supported and -#BPMP_ENODEV otherwise.
1170 CMD_THERMAL_QUERY_ABI
= 0,
1173 * @brief Get the current temperature of the specified zone.
1175 * Host needs to supply request parameters.
1177 * mrq_response::err is
1178 * * 0: Temperature query succeeded.
1179 * * -#BPMP_EINVAL: Invalid request parameters.
1180 * * -#BPMP_ENOENT: No driver registered for thermal zone..
1181 * * -#BPMP_EFAULT: Problem reading temperature measurement.
1183 CMD_THERMAL_GET_TEMP
= 1,
1186 * @brief Enable or disable and set the lower and upper
1187 * thermal limits for a thermal trip point. Each zone has
1190 * Host needs to supply request parameters. Once the
1191 * temperature hits a trip point, the BPMP will send a message
1192 * to the CPU having MRQ=MRQ_THERMAL and
1193 * type=CMD_THERMAL_HOST_TRIP_REACHED
1195 * mrq_response::err is
1196 * * 0: Trip successfully set.
1197 * * -#BPMP_EINVAL: Invalid request parameters.
1198 * * -#BPMP_ENOENT: No driver registered for thermal zone.
1199 * * -#BPMP_EFAULT: Problem setting trip point.
1201 CMD_THERMAL_SET_TRIP
= 2,
1204 * @brief Get the number of supported thermal zones.
1206 * No request parameters required.
1208 * mrq_response::err is always 0, indicating success.
1210 CMD_THERMAL_GET_NUM_ZONES
= 3,
1212 /** @brief: number of supported host-to-bpmp commands. May
1213 * increase in future
1215 CMD_THERMAL_HOST_TO_BPMP_NUM
1218 enum mrq_thermal_bpmp_to_host_cmd
{
1220 * @brief Indication that the temperature for a zone has
1221 * exceeded the range indicated in the thermal trip point
1224 * BPMP needs to supply request parameters. Host only needs to
1227 CMD_THERMAL_HOST_TRIP_REACHED
= 100,
1229 /** @brief: number of supported bpmp-to-host commands. May
1230 * increase in future
1232 CMD_THERMAL_BPMP_TO_HOST_NUM
1236 * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI
1238 * zone: Request type for which to check existence.
1240 struct cmd_thermal_query_abi_request
{
1245 * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP
1247 * zone: Number of thermal zone.
1249 struct cmd_thermal_get_temp_request
{
1254 * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP
1256 * error: 0 if request succeeded.
1257 * -BPMP_EINVAL if request parameters were invalid.
1258 * -BPMP_ENOENT if no driver was registered for the specified thermal zone.
1259 * -BPMP_EFAULT for other thermal zone driver errors.
1260 * temp: Current temperature in millicelsius.
1262 struct cmd_thermal_get_temp_response
{
1267 * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP
1269 * zone: Number of thermal zone.
1270 * low: Temperature of lower trip point in millicelsius
1271 * high: Temperature of upper trip point in millicelsius
1272 * enabled: 1 to enable trip point, 0 to disable trip point
1274 struct cmd_thermal_set_trip_request
{
1282 * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED
1284 * zone: Number of thermal zone where trip point was reached.
1286 struct cmd_thermal_host_trip_reached_request
{
1291 * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES
1293 * num: Number of supported thermal zones. The thermal zones are indexed
1294 * starting from zero.
1296 struct cmd_thermal_get_num_zones_response
{
1301 * Host->BPMP request data.
1303 * Reply type is union mrq_thermal_bpmp_to_host_response.
1305 * type: Type of request. Values listed in enum mrq_thermal_type.
1306 * data: Request type specific parameters.
1308 struct mrq_thermal_host_to_bpmp_request
{
1311 struct cmd_thermal_query_abi_request query_abi
;
1312 struct cmd_thermal_get_temp_request get_temp
;
1313 struct cmd_thermal_set_trip_request set_trip
;
1318 * BPMP->Host request data.
1320 * type: Type of request. Values listed in enum mrq_thermal_type.
1321 * data: Request type specific parameters.
1323 struct mrq_thermal_bpmp_to_host_request
{
1326 struct cmd_thermal_host_trip_reached_request host_trip_reached
;
1331 * Data in reply to a Host->BPMP request.
1333 union mrq_thermal_bpmp_to_host_response
{
1334 struct cmd_thermal_get_temp_response get_temp
;
1335 struct cmd_thermal_get_num_zones_response get_num_zones
;
1340 * @ingroup MRQ_Codes
1341 * @def MRQ_CPU_VHINT
1342 * @brief Query CPU voltage hint data
1345 * * Initiators: CCPLEX
1347 * * Request Payload: @ref mrq_cpu_vhint_request
1348 * * Response Payload: N/A
1350 * @addtogroup Vhint CPU Voltage hint
1355 * @brief request with #MRQ_CPU_VHINT
1357 * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data
1358 * from BPMP to memory space pointed by #addr. CCPLEX is responsible
1359 * to allocate sizeof(cpu_vhint_data) sized block of memory and
1360 * appropriately map it for BPMP before sending the request.
1362 struct mrq_cpu_vhint_request
{
1363 /** @brief IOVA address for the #cpu_vhint_data */
1364 uint32_t addr
; /* struct cpu_vhint_data * */
1365 /** @brief ID of the cluster whose data is requested */
1366 uint32_t cluster_id
; /* enum cluster_id */
1370 * @brief description of the CPU v/f relation
1372 * Used by #MRQ_CPU_VHINT call to carry data pointed by #addr of
1373 * struct mrq_cpu_vhint_request
1375 struct cpu_vhint_data
{
1376 uint32_t ref_clk_hz
; /**< reference frequency in Hz */
1377 uint16_t pdiv
; /**< post divider value */
1378 uint16_t mdiv
; /**< input divider value */
1379 uint16_t ndiv_max
; /**< fMAX expressed with max NDIV value */
1380 /** table of ndiv values as a function of vINDEX (voltage index) */
1382 /** minimum allowed NDIV value */
1384 /** minimum allowed voltage hint value (as in vINDEX) */
1386 /** maximum allowed voltage hint value (as in vINDEX) */
1388 /** post-multiplier for vindex value */
1389 uint16_t vindex_mult
;
1390 /** post-divider for vindex value */
1391 uint16_t vindex_div
;
1392 /** reserved for future use */
1393 uint16_t reserved
[328];
1399 * @ingroup MRQ_Codes
1400 * @def MRQ_ABI_RATCHET
1401 * @brief ABI ratchet value query
1406 * * Request Payload: @ref mrq_abi_ratchet_request
1407 * * Response Payload: @ref mrq_abi_ratchet_response
1408 * @addtogroup ABI_info
1413 * @brief an ABI compatibility mechanism
1415 * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future
1416 * revision of this header file.
1417 * 1. That future revision deprecates some MRQ
1418 * 2. That future revision introduces a breaking change to an existing
1420 * 3. A bug is discovered in an existing implementation of the BPMP-FW
1421 * (or possibly one of its clients) which warrants deprecating that
1424 #define BPMP_ABI_RATCHET_VALUE 3
1427 * @brief request with #MRQ_ABI_RATCHET.
1429 * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header
1430 * against which the requester was compiled.
1432 * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may
1433 * reply with mrq_response::err = -#BPMP_ERANGE to indicate that
1434 * BPMP-FW cannot interoperate correctly with the requester. Requester
1435 * should cease further communication with BPMP.
1437 * Otherwise, err shall be 0.
1439 struct mrq_abi_ratchet_request
{
1440 /** @brief requester's ratchet value */
1445 * @brief response to #MRQ_ABI_RATCHET
1447 * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header
1448 * against which BPMP firwmare was compiled.
1450 * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE,
1451 * the requster must either interoperate with BPMP according to an ABI
1452 * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease
1453 * communication with BPMP.
1455 * If mrq_response::err is 0 and ratchet is greater than or equal to the
1456 * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue
1459 struct mrq_abi_ratchet_response
{
1460 /** @brief BPMP's ratchet value */
1466 * @ingroup MRQ_Codes
1467 * @def MRQ_EMC_DVFS_LATENCY
1468 * @brief query frequency dependent EMC DVFS latency
1471 * * Initiators: CCPLEX
1473 * * Request Payload: N/A
1474 * * Response Payload: @ref mrq_emc_dvfs_latency_response
1480 * @brief used by @ref mrq_emc_dvfs_latency_response
1482 struct emc_dvfs_latency
{
1483 /** @brief EMC frequency in kHz */
1485 /** @brief EMC DVFS latency in nanoseconds */
1489 #define EMC_DVFS_LATENCY_MAX_SIZE 14
1491 * @brief response to #MRQ_EMC_DVFS_LATENCY
1493 struct mrq_emc_dvfs_latency_response
{
1494 /** @brief the number valid entries in #pairs */
1496 /** @brief EMC <frequency, latency> information */
1497 struct emc_dvfs_latency pairs
[EMC_DVFS_LATENCY_MAX_SIZE
];
1503 * @ingroup MRQ_Codes
1504 * @def MRQ_TRACE_ITER
1505 * @brief manage the trace iterator
1508 * * Initiators: CCPLEX
1510 * * Request Payload: N/A
1511 * * Response Payload: @ref mrq_trace_iter_request
1516 /** @brief (re)start the tracing now. Ignore older events */
1517 TRACE_ITER_INIT
= 0,
1518 /** @brief clobber all events in the trace buffer */
1519 TRACE_ITER_CLEAN
= 1
1523 * @brief request with #MRQ_TRACE_ITER
1525 struct mrq_trace_iter_request
{
1526 /** @brief TRACE_ITER_INIT or TRACE_ITER_CLEAN */
1537 * 4.1 CPU enumerations
1539 * See <mach-t186/system-t186.h>
1541 * 4.2 CPU Cluster enumerations
1543 * See <mach-t186/system-t186.h>
1545 * 4.3 System low power state enumerations
1547 * See <mach-t186/system-t186.h>
1551 * 4.4 Clock enumerations
1553 * For clock enumerations, see <mach-t186/clk-t186.h>
1557 * 4.5 Reset enumerations
1559 * For reset enumerations, see <mach-t186/reset-t186.h>
1563 * 4.6 Thermal sensor enumerations
1565 * For thermal sensor enumerations, see <mach-t186/thermal-t186.h>
1569 * @defgroup Error_Codes
1570 * Negative values for mrq_response::err generally indicate some
1571 * error. The ABI defines the following error codes. Negating these
1572 * defines is an exercise left to the user.
1575 /** @brief No such file or directory */
1576 #define BPMP_ENOENT 2
1577 /** @brief No MRQ handler */
1578 #define BPMP_ENOHANDLER 3
1579 /** @brief I/O error */
1581 /** @brief Bad sub-MRQ command */
1582 #define BPMP_EBADCMD 6
1583 /** @brief Not enough memory */
1584 #define BPMP_ENOMEM 12
1585 /** @brief Permission denied */
1586 #define BPMP_EACCES 13
1587 /** @brief Bad address */
1588 #define BPMP_EFAULT 14
1589 /** @brief No such device */
1590 #define BPMP_ENODEV 19
1591 /** @brief Argument is a directory */
1592 #define BPMP_EISDIR 21
1593 /** @brief Invalid argument */
1594 #define BPMP_EINVAL 22
1595 /** @brief Timeout during operation */
1596 #define BPMP_ETIMEDOUT 23
1597 /** @brief Out of range */
1598 #define BPMP_ERANGE 34