1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2014-2016, NVIDIA CORPORATION.
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;
34 * @defgroup MRQ MRQ Messages
35 * @brief Messages sent to/from BPMP via IPC
37 * @defgroup MRQ_Format Message Format
38 * @defgroup MRQ_Codes Message Request (MRQ) Codes
39 * @defgroup MRQ_Payloads Message Payloads
40 * @defgroup Error_Codes Error Codes
45 * @addtogroup MRQ_Format Message Format
47 * The CPU requests the BPMP to perform a particular service by
48 * sending it an IVC frame containing a single MRQ message. An MRQ
49 * message consists of a @ref mrq_request followed by a payload whose
50 * format depends on mrq_request::mrq.
52 * The BPMP processes the data and replies with an IVC frame (on the
53 * same IVC channel) containing and MRQ response. An MRQ response
54 * consists of a @ref mrq_response followed by a payload whose format
55 * depends on the associated mrq_request::mrq.
57 * A well-defined subset of the MRQ messages that the CPU sends to the
58 * BPMP can lead to BPMP eventually sending an MRQ message to the
59 * CPU. For example, when the CPU uses an #MRQ_THERMAL message to set
60 * a thermal trip point, the BPMP may eventually send a single
61 * #MRQ_THERMAL message of its own to the CPU indicating that the trip
62 * point has been crossed.
68 * @brief header for an MRQ message
70 * Provides the MRQ number for the MRQ message: #mrq. The remainder of
71 * the MRQ message is a payload (immediately following the
72 * mrq_request) whose format depends on mrq.
74 * @todo document the flags
77 /** @brief MRQ number of the request */
79 /** @brief flags for the request */
85 * @brief header for an MRQ response
87 * Provides an error code for the associated MRQ message. The
88 * remainder of the MRQ response is a payload (immediately following
89 * the mrq_response) whose format depends on the associated
92 * @todo document the flags
95 /** @brief error code for the MRQ request itself */
97 /** @brief flags for the response */
102 * @ingroup MRQ_Format
103 * Minimum needed size for an IPC message buffer
105 #define MSG_MIN_SZ 128
107 * @ingroup MRQ_Format
108 * Minimum size guaranteed for data in an IPC message buffer
110 #define MSG_DATA_MIN_SZ 120
114 * @name Legal MRQ codes
115 * These are the legal values for mrq_request::mrq
120 #define MRQ_QUERY_TAG 1
121 #define MRQ_MODULE_LOAD 4
122 #define MRQ_MODULE_UNLOAD 5
123 #define MRQ_TRACE_MODIFY 7
124 #define MRQ_WRITE_TRACE 8
125 #define MRQ_THREADED_PING 9
126 #define MRQ_MODULE_MAIL 11
127 #define MRQ_DEBUGFS 19
131 #define MRQ_QUERY_ABI 23
132 #define MRQ_PG_READ_STATE 25
133 #define MRQ_PG_UPDATE_STATE 26
134 #define MRQ_THERMAL 27
135 #define MRQ_CPU_VHINT 28
136 #define MRQ_ABI_RATCHET 29
137 #define MRQ_EMC_DVFS_LATENCY 31
138 #define MRQ_TRACE_ITER 64
144 * @brief Maximum MRQ code to be sent by CPU software to
145 * BPMP. Subject to change in future
147 #define MAX_CPU_MRQ_ID 64
150 * @addtogroup MRQ_Payloads Message Payloads
153 * @defgroup Query_Tag Query Tag
154 * @defgroup Module Loadable Modules
160 * @defgroup ABI_info ABI Info
161 * @defgroup MC_Flush MC Flush
162 * @defgroup Powergating
164 * @defgroup Vhint CPU Voltage hint
165 * @defgroup MRQ_Deprecated Deprecated MRQ messages
174 * @brief A simple ping
179 * * Request Payload: @ref mrq_ping_request
180 * * Response Payload: @ref mrq_ping_response
183 * @def MRQ_THREADED_PING
184 * @brief A deeper ping
189 * * Request Payload: @ref mrq_ping_request
190 * * Response Payload: @ref mrq_ping_response
192 * Behavior is equivalent to a simple #MRQ_PING except that BPMP
193 * responds from a thread context (providing a slightly more robust
200 * @brief request with #MRQ_PING
202 * Used by the sender of an #MRQ_PING message to request a pong from
203 * recipient. The response from the recipient is computed based on
206 struct mrq_ping_request {
207 /** @brief arbitrarily chosen value */
213 * @brief response to #MRQ_PING
215 * Sent in response to an #MRQ_PING message. #reply should be the
216 * mrq_ping_request challenge left shifted by 1 with the carry-bit
220 struct mrq_ping_response {
221 /** @brief response to the MRQ_PING challege */
228 * @brief Query BPMP firmware's tag (i.e. version information)
231 * * Initiators: CCPLEX
233 * * Request Payload: @ref mrq_query_tag_request
234 * * Response Payload: N/A
240 * @brief request with #MRQ_QUERY_TAG
242 * Used by #MRQ_QUERY_TAG call to ask BPMP to fill in the memory
243 * pointed by #addr with BPMP firmware header.
245 * The sender is reponsible for ensuring that #addr is mapped in to
246 * the recipient's address map.
248 struct mrq_query_tag_request {
249 /** @brief base address to store the firmware header */
255 * @def MRQ_MODULE_LOAD
256 * @brief dynamically load a BPMP code module
259 * * Initiators: CCPLEX
261 * * Request Payload: @ref mrq_module_load_request
262 * * Response Payload: @ref mrq_module_load_response
264 * @note This MRQ is disabled on production systems
270 * @brief request with #MRQ_MODULE_LOAD
272 * Used by #MRQ_MODULE_LOAD calls to ask the recipient to dynamically
273 * load the code located at #phys_addr and having size #size
274 * bytes. #phys_addr is treated as a void pointer.
276 * The recipient copies the code from #phys_addr to locally allocated
277 * memory prior to responding to this message.
279 * @todo document the module header format
281 * The sender is responsible for ensuring that the code is mapped in
282 * the recipient's address map.
285 struct mrq_module_load_request {
286 /** @brief base address of the code to load. Treated as (void *) */
287 uint32_t phys_addr; /* (void *) */
288 /** @brief size in bytes of code to load */
294 * @brief response to #MRQ_MODULE_LOAD
296 * @todo document mrq_response::err
298 struct mrq_module_load_response {
299 /** @brief handle to the loaded module */
305 * @def MRQ_MODULE_UNLOAD
306 * @brief unload a previously loaded code module
309 * * Initiators: CCPLEX
311 * * Request Payload: @ref mrq_module_unload_request
312 * * Response Payload: N/A
314 * @note This MRQ is disabled on production systems
319 * @brief request with #MRQ_MODULE_UNLOAD
321 * Used by #MRQ_MODULE_UNLOAD calls to request that a previously loaded
322 * module be unloaded.
324 struct mrq_module_unload_request {
325 /** @brief handle of the module to unload */
331 * @def MRQ_TRACE_MODIFY
332 * @brief modify the set of enabled trace events
335 * * Initiators: CCPLEX
337 * * Request Payload: @ref mrq_trace_modify_request
338 * * Response Payload: @ref mrq_trace_modify_response
340 * @note This MRQ is disabled on production systems
345 * @brief request with #MRQ_TRACE_MODIFY
347 * Used by %MRQ_TRACE_MODIFY calls to enable or disable specify trace
348 * events. #set takes precedence for any bit set in both #set and
351 struct mrq_trace_modify_request {
352 /** @brief bit mask of trace events to disable */
354 /** @brief bit mask of trace events to enable */
360 * @brief response to #MRQ_TRACE_MODIFY
362 * Sent in repsonse to an #MRQ_TRACE_MODIFY message. #mask reflects the
363 * state of which events are enabled after the recipient acted on the
367 struct mrq_trace_modify_response {
368 /** @brief bit mask of trace event enable states */
374 * @def MRQ_WRITE_TRACE
375 * @brief Write trace data to a buffer
378 * * Initiators: CCPLEX
380 * * Request Payload: @ref mrq_write_trace_request
381 * * Response Payload: @ref mrq_write_trace_response
383 * mrq_response::err depends on the @ref mrq_write_trace_request field
384 * values. err is -#BPMP_EINVAL if size is zero or area is NULL or
385 * area is in an illegal range. A positive value for err indicates the
386 * number of bytes written to area.
388 * @note This MRQ is disabled on production systems
393 * @brief request with #MRQ_WRITE_TRACE
395 * Used by MRQ_WRITE_TRACE calls to ask the recipient to copy trace
396 * data from the recipient's local buffer to the output buffer. #area
397 * is treated as a byte-aligned pointer in the recipient's address
400 * The sender is responsible for ensuring that the output
401 * buffer is mapped in the recipient's address map. The recipient is
402 * responsible for protecting its own code and data from accidental
405 struct mrq_write_trace_request {
406 /** @brief base address of output buffer */
408 /** @brief size in bytes of the output buffer */
414 * @brief response to #MRQ_WRITE_TRACE
416 * Once this response is sent, the respondent will not access the
417 * output buffer further.
419 struct mrq_write_trace_response {
421 * @brief flag whether more data remains in local buffer
423 * Value is 1 if the entire local trace buffer has been
424 * drained to the outputbuffer. Value is 0 otherwise.
430 struct mrq_threaded_ping_request {
435 struct mrq_threaded_ping_response {
441 * @def MRQ_MODULE_MAIL
442 * @brief send a message to a loadable module
447 * * Request Payload: @ref mrq_module_mail_request
448 * * Response Payload: @ref mrq_module_mail_response
450 * @note This MRQ is disabled on production systems
455 * @brief request with #MRQ_MODULE_MAIL
457 struct mrq_module_mail_request {
458 /** @brief handle to the previously loaded module */
460 /** @brief module-specific mail payload
462 * The length of data[ ] is unknown to the BPMP core firmware
463 * but it is limited to the size of an IPC message.
465 uint8_t data[EMPTY_ARRAY];
470 * @brief response to #MRQ_MODULE_MAIL
472 struct mrq_module_mail_response {
473 /** @brief module-specific mail payload
475 * The length of data[ ] is unknown to the BPMP core firmware
476 * but it is limited to the size of an IPC message.
478 uint8_t data[EMPTY_ARRAY];
484 * @brief Interact with BPMP's debugfs file nodes
489 * * Request Payload: @ref mrq_debugfs_request
490 * * Response Payload: @ref mrq_debugfs_response
494 * @addtogroup Debugfs
497 * The BPMP firmware implements a pseudo-filesystem called
498 * debugfs. Any driver within the firmware may register with debugfs
499 * to expose an arbitrary set of "files" in the filesystem. When
500 * software on the CPU writes to a debugfs file, debugfs passes the
501 * written data to a callback provided by the driver. When software on
502 * the CPU reads a debugfs file, debugfs queries the driver for the
503 * data to return to the CPU. The intention of the debugfs filesystem
504 * is to provide information useful for debugging the system at
507 * @note The files exposed via debugfs are not part of the
508 * BPMP firmware's ABI. debugfs files may be added or removed in any
509 * given version of the firmware. Typically the semantics of a debugfs
510 * file are consistent from version to version but even that is not
515 /** @ingroup Debugfs */
516 enum mrq_debugfs_commands {
517 CMD_DEBUGFS_READ = 1,
518 CMD_DEBUGFS_WRITE = 2,
519 CMD_DEBUGFS_DUMPDIR = 3,
525 * @brief parameters for CMD_DEBUGFS_READ/WRITE command
527 struct cmd_debugfs_fileop_request {
528 /** @brief physical address pointing at filename */
530 /** @brief length in bytes of filename buffer */
532 /** @brief physical address pointing to data buffer */
534 /** @brief length in bytes of data buffer */
540 * @brief parameters for CMD_DEBUGFS_READ/WRITE command
542 struct cmd_debugfs_dumpdir_request {
543 /** @brief physical address pointing to data buffer */
545 /** @brief length in bytes of data buffer */
551 * @brief response data for CMD_DEBUGFS_READ/WRITE command
553 struct cmd_debugfs_fileop_response {
554 /** @brief always 0 */
556 /** @brief number of bytes read from or written to data buffer */
562 * @brief response data for CMD_DEBUGFS_DUMPDIR command
564 struct cmd_debugfs_dumpdir_response {
565 /** @brief always 0 */
567 /** @brief number of bytes read from or written to data buffer */
573 * @brief request with #MRQ_DEBUGFS.
575 * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs
576 * command to execute. Legal commands are the values of @ref
577 * mrq_debugfs_commands. Each command requires a specific additional
581 * |-------------------|-------|
582 * |CMD_DEBUGFS_READ |fop |
583 * |CMD_DEBUGFS_WRITE |fop |
584 * |CMD_DEBUGFS_DUMPDIR|dumpdir|
586 struct mrq_debugfs_request {
589 struct cmd_debugfs_fileop_request fop;
590 struct cmd_debugfs_dumpdir_request dumpdir;
597 struct mrq_debugfs_response {
598 /** @brief always 0 */
601 /** @brief response data for CMD_DEBUGFS_READ OR
602 * CMD_DEBUGFS_WRITE command
604 struct cmd_debugfs_fileop_response fop;
605 /** @brief response data for CMD_DEBUGFS_DUMPDIR command */
606 struct cmd_debugfs_dumpdir_response dumpdir;
611 * @addtogroup Debugfs
614 #define DEBUGFS_S_ISDIR (1 << 9)
615 #define DEBUGFS_S_IRUSR (1 << 8)
616 #define DEBUGFS_S_IWUSR (1 << 7)
623 * @brief reset an IP block
628 * * Request Payload: @ref mrq_reset_request
629 * * Response Payload: N/A
635 enum mrq_reset_commands {
636 CMD_RESET_ASSERT = 1,
637 CMD_RESET_DEASSERT = 2,
638 CMD_RESET_MODULE = 3,
639 CMD_RESET_MAX, /* not part of ABI and subject to change */
644 * @brief request with MRQ_RESET
646 * Used by the sender of an #MRQ_RESET message to request BPMP to
647 * assert or or deassert a given reset line.
649 struct mrq_reset_request {
650 /** @brief reset action to perform (@enum mrq_reset_commands) */
652 /** @brief id of the reset to affected */
659 * @brief issue an i2c transaction
664 * * Request Payload: @ref mrq_i2c_request
665 * * Response Payload: @ref mrq_i2c_response
672 #define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE (MSG_DATA_MIN_SZ - 12)
673 #define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE (MSG_DATA_MIN_SZ - 4)
678 * @name Serial I2C flags
679 * Use these flags with serial_i2c_request::flags
682 #define SERIALI2C_TEN 0x0010
683 #define SERIALI2C_RD 0x0001
684 #define SERIALI2C_STOP 0x8000
685 #define SERIALI2C_NOSTART 0x4000
686 #define SERIALI2C_REV_DIR_ADDR 0x2000
687 #define SERIALI2C_IGNORE_NAK 0x1000
688 #define SERIALI2C_NO_RD_ACK 0x0800
689 #define SERIALI2C_RECV_LEN 0x0400
698 * @brief serializable i2c request
700 * Instances of this structure are packed (little-endian) into
701 * cmd_i2c_xfer_request::data_buf. Each instance represents a single
702 * transaction (or a portion of a transaction with repeated starts) on
705 * Because these structures are packed, some instances are likely to
706 * be misaligned. Additionally because #data is variable length, it is
707 * not possible to iterate through a serialized list of these
708 * structures without inspecting #len in each instance. It may be
709 * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf
710 * manually rather than using this structure definition.
712 struct serial_i2c_request {
713 /** @brief I2C slave address */
715 /** @brief bitmask of SERIALI2C_ flags */
717 /** @brief length of I2C transaction in bytes */
719 /** @brief for write transactions only, #len bytes of data */
725 * @brief trigger one or more i2c transactions
727 struct cmd_i2c_xfer_request {
728 /** @brief valid bus number from mach-t186/i2c-t186.h*/
731 /** @brief count of valid bytes in #data_buf*/
734 /** @brief serialized packed instances of @ref serial_i2c_request*/
735 uint8_t data_buf[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE];
740 * @brief container for data read from the i2c bus
742 * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute
743 * zero or more I2C reads. The data read from the bus is serialized
746 struct cmd_i2c_xfer_response {
747 /** @brief count of valid bytes in #data_buf*/
749 /** @brief i2c read data */
750 uint8_t data_buf[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE];
755 * @brief request with #MRQ_I2C
757 struct mrq_i2c_request {
758 /** @brief always CMD_I2C_XFER (i.e. 1) */
760 /** @brief parameters of the transfer request */
761 struct cmd_i2c_xfer_request xfer;
766 * @brief response to #MRQ_I2C
768 struct mrq_i2c_response {
769 struct cmd_i2c_xfer_response xfer;
779 * * Request Payload: @ref mrq_clk_request
780 * * Response Payload: @ref mrq_clk_response
786 * @name MRQ_CLK sub-commands
790 CMD_CLK_GET_RATE = 1,
791 CMD_CLK_SET_RATE = 2,
792 CMD_CLK_ROUND_RATE = 3,
793 CMD_CLK_GET_PARENT = 4,
794 CMD_CLK_SET_PARENT = 5,
795 CMD_CLK_IS_ENABLED = 6,
798 CMD_CLK_GET_ALL_INFO = 14,
799 CMD_CLK_GET_MAX_CLK_ID = 15,
804 #define MRQ_CLK_NAME_MAXLEN 40
805 #define MRQ_CLK_MAX_PARENTS 16
808 struct cmd_clk_get_rate_request {
812 struct cmd_clk_get_rate_response {
816 struct cmd_clk_set_rate_request {
821 struct cmd_clk_set_rate_response {
825 struct cmd_clk_round_rate_request {
830 struct cmd_clk_round_rate_response {
835 struct cmd_clk_get_parent_request {
839 struct cmd_clk_get_parent_response {
843 struct cmd_clk_set_parent_request {
847 struct cmd_clk_set_parent_response {
852 struct cmd_clk_is_enabled_request {
856 struct cmd_clk_is_enabled_response {
861 struct cmd_clk_enable_request {
866 struct cmd_clk_enable_response {
871 struct cmd_clk_disable_request {
876 struct cmd_clk_disable_response {
881 struct cmd_clk_get_all_info_request {
885 struct cmd_clk_get_all_info_response {
888 uint32_t parents[MRQ_CLK_MAX_PARENTS];
890 uint8_t name[MRQ_CLK_NAME_MAXLEN];
894 struct cmd_clk_get_max_clk_id_request {
898 struct cmd_clk_get_max_clk_id_response {
905 * @brief request with #MRQ_CLK
907 * Used by the sender of an #MRQ_CLK message to control clocks. The
908 * clk_request is split into several sub-commands. Some sub-commands
909 * require no additional data. Others have a sub-command specific
912 * |sub-command |payload |
913 * |----------------------------|-----------------------|
914 * |CMD_CLK_GET_RATE |- |
915 * |CMD_CLK_SET_RATE |clk_set_rate |
916 * |CMD_CLK_ROUND_RATE |clk_round_rate |
917 * |CMD_CLK_GET_PARENT |- |
918 * |CMD_CLK_SET_PARENT |clk_set_parent |
919 * |CMD_CLK_IS_ENABLED |- |
920 * |CMD_CLK_ENABLE |- |
921 * |CMD_CLK_DISABLE |- |
922 * |CMD_CLK_GET_ALL_INFO |- |
923 * |CMD_CLK_GET_MAX_CLK_ID |- |
927 struct mrq_clk_request {
928 /** @brief sub-command and clock id concatenated to 32-bit word.
929 * - bits[31..24] is the sub-cmd.
930 * - bits[23..0] is the clock id
936 struct cmd_clk_get_rate_request clk_get_rate;
937 struct cmd_clk_set_rate_request clk_set_rate;
938 struct cmd_clk_round_rate_request clk_round_rate;
940 struct cmd_clk_get_parent_request clk_get_parent;
941 struct cmd_clk_set_parent_request clk_set_parent;
943 struct cmd_clk_enable_request clk_enable;
945 struct cmd_clk_disable_request clk_disable;
947 struct cmd_clk_is_enabled_request clk_is_enabled;
949 struct cmd_clk_get_all_info_request clk_get_all_info;
951 struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id;
957 * @brief response to MRQ_CLK
959 * Each sub-command supported by @ref mrq_clk_request may return
960 * sub-command-specific data. Some do and some do not as indicated in
961 * the following table
963 * |sub-command |payload |
964 * |----------------------------|------------------------|
965 * |CMD_CLK_GET_RATE |clk_get_rate |
966 * |CMD_CLK_SET_RATE |clk_set_rate |
967 * |CMD_CLK_ROUND_RATE |clk_round_rate |
968 * |CMD_CLK_GET_PARENT |clk_get_parent |
969 * |CMD_CLK_SET_PARENT |clk_set_parent |
970 * |CMD_CLK_IS_ENABLED |clk_is_enabled |
971 * |CMD_CLK_ENABLE |- |
972 * |CMD_CLK_DISABLE |- |
973 * |CMD_CLK_GET_ALL_INFO |clk_get_all_info |
974 * |CMD_CLK_GET_MAX_CLK_ID |clk_get_max_id |
978 struct mrq_clk_response {
980 struct cmd_clk_get_rate_response clk_get_rate;
981 struct cmd_clk_set_rate_response clk_set_rate;
982 struct cmd_clk_round_rate_response clk_round_rate;
983 struct cmd_clk_get_parent_response clk_get_parent;
984 struct cmd_clk_set_parent_response clk_set_parent;
986 struct cmd_clk_enable_response clk_enable;
988 struct cmd_clk_disable_response clk_disable;
989 struct cmd_clk_is_enabled_response clk_is_enabled;
990 struct cmd_clk_get_all_info_response clk_get_all_info;
991 struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id;
998 * @brief check if an MRQ is implemented
1003 * * Request Payload: @ref mrq_query_abi_request
1004 * * Response Payload: @ref mrq_query_abi_response
1009 * @brief request with MRQ_QUERY_ABI
1011 * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported
1014 struct mrq_query_abi_request {
1015 /** @brief MRQ code to query */
1021 * @brief response to MRQ_QUERY_ABI
1023 struct mrq_query_abi_response {
1024 /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */
1029 * @ingroup MRQ_Codes
1030 * @def MRQ_PG_READ_STATE
1031 * @brief read the power-gating state of a partition
1036 * * Request Payload: @ref mrq_pg_read_state_request
1037 * * Response Payload: @ref mrq_pg_read_state_response
1038 * @addtogroup Powergating
1043 * @brief request with #MRQ_PG_READ_STATE
1045 * Used by MRQ_PG_READ_STATE call to read the current state of a
1048 struct mrq_pg_read_state_request {
1049 /** @brief ID of partition */
1050 uint32_t partition_id;
1054 * @brief response to MRQ_PG_READ_STATE
1055 * @todo define possible errors.
1057 struct mrq_pg_read_state_response {
1058 /** @brief read as don't care */
1059 uint32_t sram_state;
1060 /** @brief state of power partition
1064 uint32_t logic_state;
1070 * @ingroup MRQ_Codes
1071 * @def MRQ_PG_UPDATE_STATE
1072 * @brief modify the power-gating state of a partition
1077 * * Request Payload: @ref mrq_pg_update_state_request
1078 * * Response Payload: N/A
1079 * @addtogroup Powergating
1084 * @brief request with mrq_pg_update_state_request
1086 * Used by #MRQ_PG_UPDATE_STATE call to request BPMP to change the
1087 * state of a power partition #partition_id.
1089 struct mrq_pg_update_state_request {
1090 /** @brief ID of partition */
1091 uint32_t partition_id;
1092 /** @brief secondary control of power partition
1093 * @details Ignored by many versions of the BPMP
1094 * firmware. For maximum compatibility, set the value
1095 * according to @logic_state
1096 * * 0x1: power ON partition (@ref logic_state == 0x3)
1097 * * 0x3: power OFF partition (@ref logic_state == 0x1)
1099 uint32_t sram_state;
1100 /** @brief controls state of power partition, legal values are
1101 * * 0x1 : power OFF partition
1102 * * 0x3 : power ON partition
1104 uint32_t logic_state;
1105 /** @brief change state of clocks of the power partition, legal values
1106 * * 0x0 : do not change clock state
1107 * * 0x1 : disable partition clocks (only applicable when
1108 * @ref logic_state == 0x1)
1109 * * 0x3 : enable partition clocks (only applicable when
1110 * @ref logic_state == 0x3)
1112 uint32_t clock_state;
1117 * @ingroup MRQ_Codes
1119 * @brief interact with BPMP thermal framework
1124 * * Request Payload: TODO
1125 * * Response Payload: TODO
1127 * @addtogroup Thermal
1129 * The BPMP firmware includes a thermal framework. Drivers within the
1130 * bpmp firmware register with the framework to provide thermal
1131 * zones. Each thermal zone corresponds to an entity whose temperature
1132 * can be measured. The framework also has a notion of trip points. A
1133 * trip point consists of a thermal zone id, a temperature, and a
1134 * callback routine. The framework invokes the callback when the zone
1135 * hits the indicated temperature. The BPMP firmware uses this thermal
1136 * framework interally to implement various temperature-dependent
1139 * Software on the CPU can use #MRQ_THERMAL (with payload @ref
1140 * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal
1141 * framework. The CPU must It can query the number of supported zones,
1142 * query zone temperatures, and set trip points.
1144 * When a trip point set by the CPU gets crossed, BPMP firmware issues
1145 * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a
1146 * payload of @ref mrq_thermal_bpmp_to_host_request.
1149 enum mrq_thermal_host_to_bpmp_cmd {
1151 * @brief Check whether the BPMP driver supports the specified
1154 * Host needs to supply request parameters.
1156 * mrq_response::err is 0 if the specified request is
1157 * supported and -#BPMP_ENODEV otherwise.
1159 CMD_THERMAL_QUERY_ABI = 0,
1162 * @brief Get the current temperature of the specified zone.
1164 * Host needs to supply request parameters.
1166 * mrq_response::err is
1167 * * 0: Temperature query succeeded.
1168 * * -#BPMP_EINVAL: Invalid request parameters.
1169 * * -#BPMP_ENOENT: No driver registered for thermal zone..
1170 * * -#BPMP_EFAULT: Problem reading temperature measurement.
1172 CMD_THERMAL_GET_TEMP = 1,
1175 * @brief Enable or disable and set the lower and upper
1176 * thermal limits for a thermal trip point. Each zone has
1179 * Host needs to supply request parameters. Once the
1180 * temperature hits a trip point, the BPMP will send a message
1181 * to the CPU having MRQ=MRQ_THERMAL and
1182 * type=CMD_THERMAL_HOST_TRIP_REACHED
1184 * mrq_response::err is
1185 * * 0: Trip successfully set.
1186 * * -#BPMP_EINVAL: Invalid request parameters.
1187 * * -#BPMP_ENOENT: No driver registered for thermal zone.
1188 * * -#BPMP_EFAULT: Problem setting trip point.
1190 CMD_THERMAL_SET_TRIP = 2,
1193 * @brief Get the number of supported thermal zones.
1195 * No request parameters required.
1197 * mrq_response::err is always 0, indicating success.
1199 CMD_THERMAL_GET_NUM_ZONES = 3,
1201 /** @brief: number of supported host-to-bpmp commands. May
1202 * increase in future
1204 CMD_THERMAL_HOST_TO_BPMP_NUM
1207 enum mrq_thermal_bpmp_to_host_cmd {
1209 * @brief Indication that the temperature for a zone has
1210 * exceeded the range indicated in the thermal trip point
1213 * BPMP needs to supply request parameters. Host only needs to
1216 CMD_THERMAL_HOST_TRIP_REACHED = 100,
1218 /** @brief: number of supported bpmp-to-host commands. May
1219 * increase in future
1221 CMD_THERMAL_BPMP_TO_HOST_NUM
1225 * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI
1227 * zone: Request type for which to check existence.
1229 struct cmd_thermal_query_abi_request {
1234 * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP
1236 * zone: Number of thermal zone.
1238 struct cmd_thermal_get_temp_request {
1243 * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP
1245 * error: 0 if request succeeded.
1246 * -BPMP_EINVAL if request parameters were invalid.
1247 * -BPMP_ENOENT if no driver was registered for the specified thermal zone.
1248 * -BPMP_EFAULT for other thermal zone driver errors.
1249 * temp: Current temperature in millicelsius.
1251 struct cmd_thermal_get_temp_response {
1256 * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP
1258 * zone: Number of thermal zone.
1259 * low: Temperature of lower trip point in millicelsius
1260 * high: Temperature of upper trip point in millicelsius
1261 * enabled: 1 to enable trip point, 0 to disable trip point
1263 struct cmd_thermal_set_trip_request {
1271 * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED
1273 * zone: Number of thermal zone where trip point was reached.
1275 struct cmd_thermal_host_trip_reached_request {
1280 * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES
1282 * num: Number of supported thermal zones. The thermal zones are indexed
1283 * starting from zero.
1285 struct cmd_thermal_get_num_zones_response {
1290 * Host->BPMP request data.
1292 * Reply type is union mrq_thermal_bpmp_to_host_response.
1294 * type: Type of request. Values listed in enum mrq_thermal_type.
1295 * data: Request type specific parameters.
1297 struct mrq_thermal_host_to_bpmp_request {
1300 struct cmd_thermal_query_abi_request query_abi;
1301 struct cmd_thermal_get_temp_request get_temp;
1302 struct cmd_thermal_set_trip_request set_trip;
1307 * BPMP->Host request data.
1309 * type: Type of request. Values listed in enum mrq_thermal_type.
1310 * data: Request type specific parameters.
1312 struct mrq_thermal_bpmp_to_host_request {
1315 struct cmd_thermal_host_trip_reached_request host_trip_reached;
1320 * Data in reply to a Host->BPMP request.
1322 union mrq_thermal_bpmp_to_host_response {
1323 struct cmd_thermal_get_temp_response get_temp;
1324 struct cmd_thermal_get_num_zones_response get_num_zones;
1329 * @ingroup MRQ_Codes
1330 * @def MRQ_CPU_VHINT
1331 * @brief Query CPU voltage hint data
1334 * * Initiators: CCPLEX
1336 * * Request Payload: @ref mrq_cpu_vhint_request
1337 * * Response Payload: N/A
1339 * @addtogroup Vhint CPU Voltage hint
1344 * @brief request with #MRQ_CPU_VHINT
1346 * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data
1347 * from BPMP to memory space pointed by #addr. CCPLEX is responsible
1348 * to allocate sizeof(cpu_vhint_data) sized block of memory and
1349 * appropriately map it for BPMP before sending the request.
1351 struct mrq_cpu_vhint_request {
1352 /** @brief IOVA address for the #cpu_vhint_data */
1353 uint32_t addr; /* struct cpu_vhint_data * */
1354 /** @brief ID of the cluster whose data is requested */
1355 uint32_t cluster_id; /* enum cluster_id */
1359 * @brief description of the CPU v/f relation
1361 * Used by #MRQ_CPU_VHINT call to carry data pointed by #addr of
1362 * struct mrq_cpu_vhint_request
1364 struct cpu_vhint_data {
1365 uint32_t ref_clk_hz; /**< reference frequency in Hz */
1366 uint16_t pdiv; /**< post divider value */
1367 uint16_t mdiv; /**< input divider value */
1368 uint16_t ndiv_max; /**< fMAX expressed with max NDIV value */
1369 /** table of ndiv values as a function of vINDEX (voltage index) */
1371 /** minimum allowed NDIV value */
1373 /** minimum allowed voltage hint value (as in vINDEX) */
1375 /** maximum allowed voltage hint value (as in vINDEX) */
1377 /** post-multiplier for vindex value */
1378 uint16_t vindex_mult;
1379 /** post-divider for vindex value */
1380 uint16_t vindex_div;
1381 /** reserved for future use */
1382 uint16_t reserved[328];
1388 * @ingroup MRQ_Codes
1389 * @def MRQ_ABI_RATCHET
1390 * @brief ABI ratchet value query
1395 * * Request Payload: @ref mrq_abi_ratchet_request
1396 * * Response Payload: @ref mrq_abi_ratchet_response
1397 * @addtogroup ABI_info
1402 * @brief an ABI compatibility mechanism
1404 * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future
1405 * revision of this header file.
1406 * 1. That future revision deprecates some MRQ
1407 * 2. That future revision introduces a breaking change to an existing
1409 * 3. A bug is discovered in an existing implementation of the BPMP-FW
1410 * (or possibly one of its clients) which warrants deprecating that
1413 #define BPMP_ABI_RATCHET_VALUE 3
1416 * @brief request with #MRQ_ABI_RATCHET.
1418 * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header
1419 * against which the requester was compiled.
1421 * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may
1422 * reply with mrq_response::err = -#BPMP_ERANGE to indicate that
1423 * BPMP-FW cannot interoperate correctly with the requester. Requester
1424 * should cease further communication with BPMP.
1426 * Otherwise, err shall be 0.
1428 struct mrq_abi_ratchet_request {
1429 /** @brief requester's ratchet value */
1434 * @brief response to #MRQ_ABI_RATCHET
1436 * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header
1437 * against which BPMP firwmare was compiled.
1439 * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE,
1440 * the requster must either interoperate with BPMP according to an ABI
1441 * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease
1442 * communication with BPMP.
1444 * If mrq_response::err is 0 and ratchet is greater than or equal to the
1445 * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue
1448 struct mrq_abi_ratchet_response {
1449 /** @brief BPMP's ratchet value */
1455 * @ingroup MRQ_Codes
1456 * @def MRQ_EMC_DVFS_LATENCY
1457 * @brief query frequency dependent EMC DVFS latency
1460 * * Initiators: CCPLEX
1462 * * Request Payload: N/A
1463 * * Response Payload: @ref mrq_emc_dvfs_latency_response
1469 * @brief used by @ref mrq_emc_dvfs_latency_response
1471 struct emc_dvfs_latency {
1472 /** @brief EMC frequency in kHz */
1474 /** @brief EMC DVFS latency in nanoseconds */
1478 #define EMC_DVFS_LATENCY_MAX_SIZE 14
1480 * @brief response to #MRQ_EMC_DVFS_LATENCY
1482 struct mrq_emc_dvfs_latency_response {
1483 /** @brief the number valid entries in #pairs */
1485 /** @brief EMC <frequency, latency> information */
1486 struct emc_dvfs_latency pairs[EMC_DVFS_LATENCY_MAX_SIZE];
1492 * @ingroup MRQ_Codes
1493 * @def MRQ_TRACE_ITER
1494 * @brief manage the trace iterator
1497 * * Initiators: CCPLEX
1499 * * Request Payload: N/A
1500 * * Response Payload: @ref mrq_trace_iter_request
1505 /** @brief (re)start the tracing now. Ignore older events */
1506 TRACE_ITER_INIT = 0,
1507 /** @brief clobber all events in the trace buffer */
1508 TRACE_ITER_CLEAN = 1
1512 * @brief request with #MRQ_TRACE_ITER
1514 struct mrq_trace_iter_request {
1515 /** @brief TRACE_ITER_INIT or TRACE_ITER_CLEAN */
1526 * 4.1 CPU enumerations
1528 * See <mach-t186/system-t186.h>
1530 * 4.2 CPU Cluster enumerations
1532 * See <mach-t186/system-t186.h>
1534 * 4.3 System low power state enumerations
1536 * See <mach-t186/system-t186.h>
1540 * 4.4 Clock enumerations
1542 * For clock enumerations, see <mach-t186/clk-t186.h>
1546 * 4.5 Reset enumerations
1548 * For reset enumerations, see <mach-t186/reset-t186.h>
1552 * 4.6 Thermal sensor enumerations
1554 * For thermal sensor enumerations, see <mach-t186/thermal-t186.h>
1558 * @defgroup Error_Codes
1559 * Negative values for mrq_response::err generally indicate some
1560 * error. The ABI defines the following error codes. Negating these
1561 * defines is an exercise left to the user.
1564 /** @brief No such file or directory */
1565 #define BPMP_ENOENT 2
1566 /** @brief No MRQ handler */
1567 #define BPMP_ENOHANDLER 3
1568 /** @brief I/O error */
1570 /** @brief Bad sub-MRQ command */
1571 #define BPMP_EBADCMD 6
1572 /** @brief Not enough memory */
1573 #define BPMP_ENOMEM 12
1574 /** @brief Permission denied */
1575 #define BPMP_EACCES 13
1576 /** @brief Bad address */
1577 #define BPMP_EFAULT 14
1578 /** @brief No such device */
1579 #define BPMP_ENODEV 19
1580 /** @brief Argument is a directory */
1581 #define BPMP_EISDIR 21
1582 /** @brief Invalid argument */
1583 #define BPMP_EINVAL 22
1584 /** @brief Timeout during operation */
1585 #define BPMP_ETIMEDOUT 23
1586 /** @brief Out of range */
1587 #define BPMP_ERANGE 34