brintos

brintos / linux-shallow public Read only

0
0
Text · 114.7 KiB · 6b995a8 Raw
3974 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * Copyright (c) 2014-2022, NVIDIA CORPORATION.  All rights reserved.4 */5 6#ifndef ABI_BPMP_ABI_H7#define ABI_BPMP_ABI_H8 9#if defined(LK) || defined(BPMP_ABI_HAVE_STDC)10#include <stddef.h>11#include <stdint.h>12#endif13 14#ifndef BPMP_ABI_PACKED15#ifdef __ABI_PACKED16#define BPMP_ABI_PACKED __ABI_PACKED17#else18#define BPMP_ABI_PACKED __attribute__((packed))19#endif20#endif21 22#ifdef NO_GCC_EXTENSIONS23#define BPMP_ABI_EMPTY char empty;24#define BPMP_ABI_EMPTY_ARRAY 125#else26#define BPMP_ABI_EMPTY27#define BPMP_ABI_EMPTY_ARRAY 028#endif29 30#ifndef BPMP_UNION_ANON31#ifdef __UNION_ANON32#define BPMP_UNION_ANON __UNION_ANON33#else34#define BPMP_UNION_ANON35#endif36#endif37 38/**39 * @file40 */41 42/**43 * @defgroup MRQ MRQ Messages44 * @brief Messages sent to/from BPMP via IPC45 * @{46 *   @defgroup MRQ_Format Message Format47 *   @defgroup MRQ_Codes Message Request (MRQ) Codes48 *   @defgroup MRQ_Payloads Message Payloads49 *   @defgroup Error_Codes Error Codes50 * @}51 */52 53/**54 * @addtogroup MRQ_Format55 * @{56 * The CPU requests the BPMP to perform a particular service by57 * sending it an IVC frame containing a single MRQ message. An MRQ58 * message consists of a @ref mrq_request followed by a payload whose59 * format depends on mrq_request::mrq.60 *61 * The BPMP processes the data and replies with an IVC frame (on the62 * same IVC channel) containing and MRQ response. An MRQ response63 * consists of a @ref mrq_response followed by a payload whose format64 * depends on the associated mrq_request::mrq.65 *66 * A well-defined subset of the MRQ messages that the CPU sends to the67 * BPMP can lead to BPMP eventually sending an MRQ message to the68 * CPU. For example, when the CPU uses an #MRQ_THERMAL message to set69 * a thermal trip point, the BPMP may eventually send a single70 * #MRQ_THERMAL message of its own to the CPU indicating that the trip71 * point has been crossed.72 * @}73 */74 75/**76 * @ingroup MRQ_Format77 * Request an answer from the peer.78 * This should be set in mrq_request::flags for all requests targetted79 * at BPMP. For requests originating in BPMP, this flag is optional except80 * for messages targeting MCE, for which the field must be set.81 * When this flag is not set, the remote peer must not send a response82 * back.83 */84#define BPMP_MAIL_DO_ACK	(1U << 0U)85 86/**87 * @ingroup MRQ_Format88 * Ring the sender's doorbell when responding. This should be set unless89 * the sender wants to poll the underlying communications layer directly.90 *91 * An optional direction that can be specified in mrq_request::flags.92 */93#define BPMP_MAIL_RING_DB	(1U << 1U)94 95/**96 * @ingroup MRQ_Format97 * CRC present98 */99#define BPMP_MAIL_CRC_PRESENT	(1U << 2U)100 101/**102 * @ingroup MRQ_Format103 * @brief Header for an MRQ message104 *105 * Provides the MRQ number for the MRQ message: #mrq. The remainder of106 * the MRQ message is a payload (immediately following the107 * mrq_request) whose format depends on mrq.108 */109struct mrq_request {110	/** @brief MRQ number of the request */111	uint32_t mrq;112 113	/**114	 * @brief 32bit word containing a number of fields as follows:115	 *116	 * 	struct {117	 * 		uint8_t options:4;118	 * 		uint8_t xid:4;119	 * 		uint8_t payload_length;120	 * 		uint16_t crc16;121	 * 	};122	 *123	 * **options** directions to the receiver and indicates CRC presence.124	 *125	 * #BPMP_MAIL_DO_ACK and  #BPMP_MAIL_RING_DB see documentation of respective options.126	 * #BPMP_MAIL_CRC_PRESENT is supported on T234 and later platforms. It indicates the127	 * crc16, xid and length fields are present when set.128	 * Some platform configurations, especially when targeted to applications requiring129	 * functional safety, mandate this option being set or otherwise will respond with130	 * -BPMP_EBADMSG and ignore the request.131	 *132	 * **xid** is a transaction ID.133	 *134	 * Only used when #BPMP_MAIL_CRC_PRESENT is set.135	 *136	 * **payload_length** of the message expressed in bytes without the size of this header.137	 * See table below for minimum accepted payload lengths for each MRQ.138	 * Note: For DMCE communication, this field expresses the length as a multiple of 4 bytes139	 * rather than bytes.140	 *141	 * Only used when #BPMP_MAIL_CRC_PRESENT is set.142	 *143	 * | MRQ                  | CMD                                  | minimum payload length144	 * | -------------------- | ------------------------------------ | ------------------------------------------ |145	 * | MRQ_PING             |                                      | 4                                          |146	 * | MRQ_THREADED_PING    |                                      | 4                                          |147	 * | MRQ_RESET            | any                                  | 8                                          |148	 * | MRQ_I2C              |                                      | 12 + cmd_i2c_xfer_request.data_size        |149	 * | MRQ_CLK              | CMD_CLK_GET_RATE                     | 4                                          |150	 * | MRQ_CLK              | CMD_CLK_SET_RATE                     | 16                                         |151	 * | MRQ_CLK              | CMD_CLK_ROUND_RATE                   | 16                                         |152	 * | MRQ_CLK              | CMD_CLK_GET_PARENT                   | 4                                          |153	 * | MRQ_CLK              | CMD_CLK_SET_PARENT                   | 8                                          |154	 * | MRQ_CLK              | CMD_CLK_ENABLE                       | 4                                          |155	 * | MRQ_CLK              | CMD_CLK_DISABLE                      | 4                                          |156	 * | MRQ_CLK              | CMD_CLK_IS_ENABLED                   | 4                                          |157	 * | MRQ_CLK              | CMD_CLK_GET_ALL_INFO                 | 4                                          |158	 * | MRQ_CLK              | CMD_CLK_GET_MAX_CLK_ID               | 4                                          |159	 * | MRQ_CLK              | CMD_CLK_GET_FMAX_AT_VMIN             | 4                                          |160	 * | MRQ_QUERY_ABI        |                                      | 4                                          |161	 * | MRQ_PG               | CMD_PG_QUERY_ABI                     | 12                                         |162	 * | MRQ_PG               | CMD_PG_SET_STATE                     | 12                                         |163	 * | MRQ_PG               | CMD_PG_GET_STATE                     | 8                                          |164	 * | MRQ_PG               | CMD_PG_GET_NAME                      | 8                                          |165	 * | MRQ_PG               | CMD_PG_GET_MAX_ID                    | 8                                          |166	 * | MRQ_THERMAL          | CMD_THERMAL_QUERY_ABI                | 8                                          |167	 * | MRQ_THERMAL          | CMD_THERMAL_GET_TEMP                 | 8                                          |168	 * | MRQ_THERMAL          | CMD_THERMAL_SET_TRIP                 | 20                                         |169	 * | MRQ_THERMAL          | CMD_THERMAL_GET_NUM_ZONES            | 4                                          |170	 * | MRQ_THERMAL          | CMD_THERMAL_GET_THERMTRIP            | 8                                          |171	 * | MRQ_CPU_VHINT        |                                      | 8                                          |172	 * | MRQ_ABI_RATCHET      |                                      | 2                                          |173	 * | MRQ_EMC_DVFS_LATENCY |                                      | 8                                          |174	 * | MRQ_EMC_DVFS_EMCHUB  |                                      | 8                                          |175	 * | MRQ_EMC_DISP_RFL     |                                      | 4                                          |176	 * | MRQ_BWMGR            | CMD_BWMGR_QUERY_ABI                  | 8                                          |177	 * | MRQ_BWMGR            | CMD_BWMGR_CALC_RATE                  | 8 + 8 * bwmgr_rate_req.num_iso_clients     |178	 * | MRQ_ISO_CLIENT       | CMD_ISO_CLIENT_QUERY_ABI             | 8                                          |179	 * | MRQ_ISO_CLIENT       | CMD_ISO_CLIENT_CALCULATE_LA          | 16                                         |180	 * | MRQ_ISO_CLIENT       | CMD_ISO_CLIENT_SET_LA                | 16                                         |181	 * | MRQ_ISO_CLIENT       | CMD_ISO_CLIENT_GET_MAX_BW            | 8                                          |182	 * | MRQ_CPU_NDIV_LIMITS  |                                      | 4                                          |183	 * | MRQ_CPU_AUTO_CC3     |                                      | 4                                          |184	 * | MRQ_RINGBUF_CONSOLE  | CMD_RINGBUF_CONSOLE_QUERY_ABI        | 8                                          |185	 * | MRQ_RINGBUF_CONSOLE  | CMD_RINGBUF_CONSOLE_READ             | 5                                          |186	 * | MRQ_RINGBUF_CONSOLE  | CMD_RINGBUF_CONSOLE_WRITE            | 5 + cmd_ringbuf_console_write_req.len      |187	 * | MRQ_RINGBUF_CONSOLE  | CMD_RINGBUF_CONSOLE_GET_FIFO         | 4                                          |188	 * | MRQ_STRAP            | STRAP_SET                            | 12                                         |189	 * | MRQ_UPHY             | CMD_UPHY_PCIE_LANE_MARGIN_CONTROL    | 24                                         |190	 * | MRQ_UPHY             | CMD_UPHY_PCIE_LANE_MARGIN_STATUS     | 4                                          |191	 * | MRQ_UPHY             | CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT | 5                                          |192	 * | MRQ_UPHY             | CMD_UPHY_PCIE_CONTROLLER_STATE       | 6                                          |193	 * | MRQ_UPHY             | CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF  | 5                                          |194	 * | MRQ_FMON             | CMD_FMON_GEAR_CLAMP                  | 16                                         |195	 * | MRQ_FMON             | CMD_FMON_GEAR_FREE                   | 4                                          |196	 * | MRQ_FMON             | CMD_FMON_GEAR_GET                    | 4                                          |197	 * | MRQ_FMON             | CMD_FMON_FAULT_STS_GET               | 8                                          |198	 * | MRQ_EC               | CMD_EC_STATUS_EX_GET                 | 12                                         |199	 * | MRQ_QUERY_FW_TAG     |                                      | 0                                          |200	 * | MRQ_DEBUG            | CMD_DEBUG_OPEN_RO                    | 4 + length of cmd_debug_fopen_request.name |201	 * | MRQ_DEBUG            | CMD_DEBUG_OPEN_WO                    | 4 + length of cmd_debug_fopen_request.name |202	 * | MRQ_DEBUG            | CMD_DEBUG_READ                       | 8                                          |203	 * | MRQ_DEBUG            | CMD_DEBUG_WRITE                      | 12 + cmd_debug_fwrite_request.datalen      |204	 * | MRQ_DEBUG            | CMD_DEBUG_CLOSE                      | 8                                          |205	 * | MRQ_TELEMETRY        |                                      | 8                                          |206	 * | MRQ_PWR_LIMIT        | CMD_PWR_LIMIT_QUERY_ABI              | 8                                          |207	 * | MRQ_PWR_LIMIT        | CMD_PWR_LIMIT_SET                    | 20                                         |208	 * | MRQ_PWR_LIMIT        | CMD_PWR_LIMIT_GET                    | 16                                         |209	 * | MRQ_PWR_LIMIT        | CMD_PWR_LIMIT_CURR_CAP               | 8                                          |210	 * | MRQ_GEARS            |                                      | 0                                          |211	 * | MRQ_BWMGR_INT        | CMD_BWMGR_INT_QUERY_ABI              | 8                                          |212	 * | MRQ_BWMGR_INT        | CMD_BWMGR_INT_CALC_AND_SET           | 16                                         |213	 * | MRQ_BWMGR_INT        | CMD_BWMGR_INT_CAP_SET                | 8                                          |214	 * | MRQ_OC_STATUS        |                                      | 0                                          |215	 *216	 * **crc16**217	 *218	 * CRC16 using polynomial x^16 + x^14 + x^12 + x^11 + x^8 + x^5 + x^4 + x^2 + 1219	 * and initialization value 0x4657. The CRC is calculated over all bytes of the message220	 * including this header. However the crc16 field is considered to be set to 0 when221	 * calculating the CRC. Only used when #BPMP_MAIL_CRC_PRESENT is set. If222	 * #BPMP_MAIL_CRC_PRESENT is set and this field does not match the CRC as223	 * calculated by BPMP, -BPMP_EBADMSG will be returned and the request will224	 * be ignored. See code snippet below on how to calculate the CRC.225	 *226	 * @code227	 *	uint16_t calc_crc_digest(uint16_t crc, uint8_t *data, size_t size)228	 *	{229	 *		for (size_t i = 0; i < size; i++) {230	 *			crc ^= data[i] << 8;231	 *			for (size_t j = 0; j < 8; j++) {232	 *				if ((crc & 0x8000) == 0x8000) {233	 *					crc = (crc << 1) ^ 0xAC9A;234	 *				} else {235	 *					crc = (crc << 1);236	 *				}237	 *			}238	 *		}239	 *		return crc;240	 *	}241	 *242	 *	uint16_t calc_crc(uint8_t *data, size_t size)243	 *	{244	 *		return calc_crc_digest(0x4657, data, size);245	 *	}246	 * @endcode247	 */248	uint32_t flags;249} BPMP_ABI_PACKED;250 251/**252 * @ingroup MRQ_Format253 * @brief Header for an MRQ response254 *255 *  Provides an error code for the associated MRQ message. The256 *  remainder of the MRQ response is a payload (immediately following257 *  the mrq_response) whose format depends on the associated258 *  mrq_request::mrq259 */260struct mrq_response {261	/** @brief Error code for the MRQ request itself */262	int32_t err;263 264	/**265	 * @brief 32bit word containing a number of fields as follows:266	 *267	 * 	struct {268	 * 		uint8_t options:4;269	 * 		uint8_t xid:4;270	 * 		uint8_t payload_length;271	 * 		uint16_t crc16;272	 * 	};273	 *274	 * **options** indicates CRC presence.275	 *276	 * #BPMP_MAIL_CRC_PRESENT is supported on T234 and later platforms and277	 * indicates the crc16 related fields are present when set.278	 *279	 * **xid** is the transaction ID as sent by the requestor.280	 *281	 * **length** of the message expressed in bytes without the size of this header.282	 * Note: For DMCE communication, this field expresses the length as a multiple of 4 bytes283	 * rather than bytes.284	 *285	 * **crc16**286	 *287	 * CRC16 using polynomial x^16 + x^14 + x^12 + x^11 + x^8 + x^5 + x^4 + x^2 + 1288	 * and initialization value 0x4657. The CRC is calculated over all bytes of the message289	 * including this header. However the crc16 field is considered to be set to 0 when290	 * calculating the CRC. Only used when #BPMP_MAIL_CRC_PRESENT is set.291	 */292	uint32_t flags;293} BPMP_ABI_PACKED;294 295/**296 * @ingroup MRQ_Format297 * Minimum needed size for an IPC message buffer298 */299#define MSG_MIN_SZ	128U300/**301 * @ingroup MRQ_Format302 *  Minimum size guaranteed for data in an IPC message buffer303 */304#define MSG_DATA_MIN_SZ	120U305 306/**307 * @ingroup MRQ_Codes308 * @name Legal MRQ codes309 * These are the legal values for mrq_request::mrq310 * @{311 */312 313#define MRQ_PING		0U314#define MRQ_QUERY_TAG		1U315#define MRQ_THREADED_PING	9U316#define MRQ_DEBUGFS		19U317#define MRQ_RESET		20U318#define MRQ_I2C			21U319#define MRQ_CLK			22U320#define MRQ_QUERY_ABI		23U321#define MRQ_THERMAL		27U322#define MRQ_CPU_VHINT		28U323#define MRQ_ABI_RATCHET		29U324#define MRQ_EMC_DVFS_LATENCY	31U325#define MRQ_RINGBUF_CONSOLE	65U326#define MRQ_PG			66U327#define MRQ_CPU_NDIV_LIMITS	67U328#define MRQ_STRAP               68U329#define MRQ_UPHY		69U330#define MRQ_CPU_AUTO_CC3	70U331#define MRQ_QUERY_FW_TAG	71U332#define MRQ_FMON		72U333#define MRQ_EC			73U334#define MRQ_DEBUG		75U335#define MRQ_EMC_DVFS_EMCHUB	76U336#define MRQ_BWMGR		77U337#define MRQ_ISO_CLIENT		78U338#define MRQ_EMC_DISP_RFL	79U339#define MRQ_TELEMETRY		80U340#define MRQ_PWR_LIMIT		81U341#define MRQ_GEARS		82U342#define MRQ_BWMGR_INT		83U343#define MRQ_OC_STATUS		84U344 345/** @cond DEPRECATED */346#define MRQ_RESERVED_2		2U347#define MRQ_RESERVED_3		3U348#define MRQ_RESERVED_4		4U349#define MRQ_RESERVED_5   	5U350#define MRQ_RESERVED_6		6U351#define MRQ_RESERVED_7		7U352#define MRQ_RESERVED_8		8U353#define MRQ_RESERVED_10		10U354#define MRQ_RESERVED_11		11U355#define MRQ_RESERVED_12		12U356#define MRQ_RESERVED_13		13U357#define MRQ_RESERVED_14		14U358#define MRQ_RESERVED_15		15U359#define MRQ_RESERVED_16		16U360#define MRQ_RESERVED_17		17U361#define MRQ_RESERVED_18		18U362#define MRQ_RESERVED_24		24U363#define MRQ_RESERVED_25		25U364#define MRQ_RESERVED_26		26U365#define MRQ_RESERVED_30		30U366#define MRQ_RESERVED_64		64U367#define MRQ_RESERVED_74		74U368/** @endcond DEPRECATED */369 370/** @} */371 372/**373 * @ingroup MRQ_Codes374 * @brief Maximum MRQ code to be sent by CPU software to375 * BPMP. Subject to change in future376 */377#define MAX_CPU_MRQ_ID		84U378 379/**380 * @addtogroup MRQ_Payloads381 * @{382 *   @defgroup Ping Ping383 *   @defgroup Query_Tag Query Tag384 *   @defgroup Module Loadable Modules385 *   @defgroup Trace Trace386 *   @defgroup Debugfs Debug File System387 *   @defgroup Reset Reset388 *   @defgroup I2C I2C389 *   @defgroup Clocks Clocks390 *   @defgroup ABI_info ABI Info391 *   @defgroup Powergating Power Gating392 *   @defgroup Thermal Thermal393 *   @defgroup OC_status OC status394 *   @defgroup Vhint CPU Voltage hint395 *   @defgroup EMC EMC396 *   @defgroup BWMGR BWMGR397 *   @defgroup ISO_CLIENT ISO_CLIENT398 *   @defgroup CPU NDIV Limits399 *   @defgroup RingbufConsole Ring Buffer Console400 *   @defgroup Strap Straps401 *   @defgroup UPHY UPHY402 *   @defgroup CC3 Auto-CC3403 *   @defgroup FMON FMON404 *   @defgroup EC EC405 *   @defgroup Telemetry Telemetry406 *   @defgroup Pwrlimit PWR_LIMIT407 *   @defgroup Gears Gears408 *   @defgroup BWMGR_INT Bandwidth Manager Integrated409 * @} MRQ_Payloads410 */411 412/**413 * @ingroup MRQ_Codes414 * @def MRQ_PING415 * @brief A simple ping416 *417 * * Platforms: All418 * * Initiators: Any419 * * Targets: Any420 * * Request Payload: @ref mrq_ping_request421 * * Response Payload: @ref mrq_ping_response422 *423 * @ingroup MRQ_Codes424 * @def MRQ_THREADED_PING425 * @brief A deeper ping426 *427 * * Platforms: All428 * * Initiators: Any429 * * Targets: BPMP430 * * Request Payload: @ref mrq_ping_request431 * * Response Payload: @ref mrq_ping_response432 *433 * Behavior is equivalent to a simple #MRQ_PING except that BPMP434 * responds from a thread context (providing a slightly more robust435 * sign of life).436 *437 */438 439/**440 * @ingroup Ping441 * @brief Request with #MRQ_PING442 *443 * Used by the sender of an #MRQ_PING message to request a pong from444 * recipient. The response from the recipient is computed based on445 * #challenge.446 */447struct mrq_ping_request {448/** @brief Arbitrarily chosen value */449	uint32_t challenge;450} BPMP_ABI_PACKED;451 452/**453 * @ingroup Ping454 * @brief Response to #MRQ_PING455 *456 * Sent in response to an #MRQ_PING message. #reply should be the457 * mrq_ping_request challenge left shifted by 1 with the carry-bit458 * dropped.459 *460 */461struct mrq_ping_response {462	/** @brief Response to the MRQ_PING challege */463	uint32_t reply;464} BPMP_ABI_PACKED;465 466/**467 * @ingroup MRQ_Codes468 * @def MRQ_QUERY_TAG469 * @brief Query BPMP firmware's tag (i.e. unique identifer)470 *471 * @deprecated Use #MRQ_QUERY_FW_TAG instead.472 *473 * * Platforms: All474 * * Initiators: CCPLEX475 * * Targets: BPMP476 * * Request Payload: @ref mrq_query_tag_request477 * * Response Payload: N/A478 *479 */480 481/**482 * @ingroup Query_Tag483 * @brief Request with #MRQ_QUERY_TAG484 *485 * @deprecated This structure will be removed in future version.486 * Use MRQ_QUERY_FW_TAG instead.487 */488struct mrq_query_tag_request {489  /** @brief Base address to store the firmware tag */490	uint32_t addr;491} BPMP_ABI_PACKED;492 493 494/**495 * @ingroup MRQ_Codes496 * @def MRQ_QUERY_FW_TAG497 * @brief Query BPMP firmware's tag (i.e. unique identifier)498 *499 * * Platforms: All500 * * Initiators: Any501 * * Targets: BPMP502 * * Request Payload: N/A503 * * Response Payload: @ref mrq_query_fw_tag_response504 *505 */506 507/**508 * @ingroup Query_Tag509 * @brief Response to #MRQ_QUERY_FW_TAG510 *511 * Sent in response to #MRQ_QUERY_FW_TAG message. #tag contains the unique512 * identifier for the version of firmware issuing the reply.513 *514 */515struct mrq_query_fw_tag_response {516  /** @brief Array to store tag information */517	uint8_t tag[32];518} BPMP_ABI_PACKED;519 520/** @private */521struct mrq_threaded_ping_request {522	uint32_t challenge;523} BPMP_ABI_PACKED;524 525/** @private */526struct mrq_threaded_ping_response {527	uint32_t reply;528} BPMP_ABI_PACKED;529 530/**531 * @ingroup MRQ_Codes532 * @def MRQ_DEBUGFS533 * @brief Interact with BPMP's debugfs file nodes534 *535 * @deprecated use MRQ_DEBUG instead.536 *537 * * Platforms: T186, T194538 * * Initiators: Any539 * * Targets: BPMP540 * * Request Payload: @ref mrq_debugfs_request541 * * Response Payload: @ref mrq_debugfs_response542 */543 544/**545 * @addtogroup Debugfs546 * @{547 *548 * The BPMP firmware implements a pseudo-filesystem called549 * debugfs. Any driver within the firmware may register with debugfs550 * to expose an arbitrary set of "files" in the filesystem. When551 * software on the CPU writes to a debugfs file, debugfs passes the552 * written data to a callback provided by the driver. When software on553 * the CPU reads a debugfs file, debugfs queries the driver for the554 * data to return to the CPU. The intention of the debugfs filesystem555 * is to provide information useful for debugging the system at556 * runtime.557 *558 * @note The files exposed via debugfs are not part of the559 * BPMP firmware's ABI. debugfs files may be added or removed in any560 * given version of the firmware. Typically the semantics of a debugfs561 * file are consistent from version to version but even that is not562 * guaranteed.563 *564 * @}565 */566 567/** @ingroup Debugfs */568enum mrq_debugfs_commands {569	/** @brief Perform read */570	CMD_DEBUGFS_READ = 1,571	/** @brief Perform write */572	CMD_DEBUGFS_WRITE = 2,573	/** @brief Perform dumping directory */574	CMD_DEBUGFS_DUMPDIR = 3,575	/** @brief Not a command */576	CMD_DEBUGFS_MAX577};578 579/**580 * @ingroup Debugfs581 * @brief Parameters for CMD_DEBUGFS_READ/WRITE command582 */583struct cmd_debugfs_fileop_request {584	/** @brief Physical address pointing at filename */585	uint32_t fnameaddr;586	/** @brief Length in bytes of filename buffer */587	uint32_t fnamelen;588	/** @brief Physical address pointing to data buffer */589	uint32_t dataaddr;590	/** @brief Length in bytes of data buffer */591	uint32_t datalen;592} BPMP_ABI_PACKED;593 594/**595 * @ingroup Debugfs596 * @brief Parameters for CMD_DEBUGFS_READ/WRITE command597 */598struct cmd_debugfs_dumpdir_request {599	/** @brief Physical address pointing to data buffer */600	uint32_t dataaddr;601	/** @brief Length in bytes of data buffer */602	uint32_t datalen;603} BPMP_ABI_PACKED;604 605/**606 * @ingroup Debugfs607 * @brief Response data for CMD_DEBUGFS_READ/WRITE command608 */609struct cmd_debugfs_fileop_response {610	/** @brief Always 0 */611	uint32_t reserved;612	/** @brief Number of bytes read from or written to data buffer */613	uint32_t nbytes;614} BPMP_ABI_PACKED;615 616/**617 * @ingroup Debugfs618 * @brief Response data for CMD_DEBUGFS_DUMPDIR command619 */620struct cmd_debugfs_dumpdir_response {621	/** @brief Always 0 */622	uint32_t reserved;623	/** @brief Number of bytes read from or written to data buffer */624	uint32_t nbytes;625} BPMP_ABI_PACKED;626 627/**628 * @ingroup Debugfs629 * @brief Request with #MRQ_DEBUGFS.630 *631 * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs632 * command to execute. Legal commands are the values of @ref633 * mrq_debugfs_commands. Each command requires a specific additional634 * payload of data.635 *636 * |command            |payload|637 * |-------------------|-------|638 * |CMD_DEBUGFS_READ   |fop    |639 * |CMD_DEBUGFS_WRITE  |fop    |640 * |CMD_DEBUGFS_DUMPDIR|dumpdir|641 */642struct mrq_debugfs_request {643	/** @brief Sub-command (@ref mrq_debugfs_commands) */644	uint32_t cmd;645	union {646		struct cmd_debugfs_fileop_request fop;647		struct cmd_debugfs_dumpdir_request dumpdir;648	} BPMP_UNION_ANON;649} BPMP_ABI_PACKED;650 651/**652 * @ingroup Debugfs653 */654struct mrq_debugfs_response {655	/** @brief Always 0 */656	int32_t reserved;657	union {658		/** @brief Response data for CMD_DEBUGFS_READ OR659		 * CMD_DEBUGFS_WRITE command660		 */661		struct cmd_debugfs_fileop_response fop;662		/** @brief Response data for CMD_DEBUGFS_DUMPDIR command */663		struct cmd_debugfs_dumpdir_response dumpdir;664	} BPMP_UNION_ANON;665} BPMP_ABI_PACKED;666 667/**668 * @addtogroup Debugfs669 * @{670 */671#define DEBUGFS_S_ISDIR	(1 << 9)672#define DEBUGFS_S_IRUSR	(1 << 8)673#define DEBUGFS_S_IWUSR	(1 << 7)674/** @} Debugfs */675 676/**677 * @ingroup MRQ_Codes678 * @def MRQ_DEBUG679 * @brief Interact with BPMP's debugfs file nodes. Use message payload680 * for exchanging data. This is functionally equivalent to681 * @ref MRQ_DEBUGFS. But the way in which data is exchanged is different.682 * When software running on CPU tries to read a debugfs file,683 * the file path and read data will be stored in message payload.684 * Since the message payload size is limited, a debugfs file685 * transaction might require multiple frames of data exchanged686 * between BPMP and CPU until the transaction completes.687 *688 * * Platforms: T194689 * * Initiators: Any690 * * Targets: BPMP691 * * Request Payload: @ref mrq_debug_request692 * * Response Payload: @ref mrq_debug_response693 */694 695/** @ingroup Debugfs */696enum mrq_debug_commands {697	/** @brief Open required file for read operation */698	CMD_DEBUG_OPEN_RO = 0,699	/** @brief Open required file for write operation */700	CMD_DEBUG_OPEN_WO = 1,701	/** @brief Perform read */702	CMD_DEBUG_READ = 2,703	/** @brief Perform write */704	CMD_DEBUG_WRITE = 3,705	/** @brief Close file */706	CMD_DEBUG_CLOSE = 4,707	/** @brief Not a command */708	CMD_DEBUG_MAX709};710 711/**712 * @ingroup Debugfs713 * @brief Maximum number of files that can be open at a given time714 */715#define DEBUG_MAX_OPEN_FILES	1716 717/**718 * @ingroup Debugfs719 * @brief Maximum size of null-terminated file name string in bytes.720 * Value is derived from memory available in message payload while721 * using @ref cmd_debug_fopen_request722 * Value 4 corresponds to size of @ref mrq_debug_commands723 * in @ref mrq_debug_request.724 * 120 - 4 dbg_cmd(32bit)  = 116725 */726#define DEBUG_FNAME_MAX_SZ	(MSG_DATA_MIN_SZ - 4)727 728/**729 * @ingroup Debugfs730 * @brief Parameters for CMD_DEBUG_OPEN command731 */732struct cmd_debug_fopen_request {733	/** @brief File name - Null-terminated string with maximum734	 * length @ref DEBUG_FNAME_MAX_SZ735	 */736	char name[DEBUG_FNAME_MAX_SZ];737} BPMP_ABI_PACKED;738 739/**740 * @ingroup Debugfs741 * @brief Response data for CMD_DEBUG_OPEN_RO/WO command742 */743struct cmd_debug_fopen_response {744	/** @brief Identifier for file access */745	uint32_t fd;746	/** @brief Data length. File data size for READ command.747	 * Maximum allowed length for WRITE command748	 */749	uint32_t datalen;750} BPMP_ABI_PACKED;751 752/**753 * @ingroup Debugfs754 * @brief Parameters for CMD_DEBUG_READ command755 */756struct cmd_debug_fread_request {757	/** @brief File access identifier received in response758	 * to CMD_DEBUG_OPEN_RO request759	 */760	uint32_t fd;761} BPMP_ABI_PACKED;762 763/**764 * @ingroup Debugfs765 * @brief Maximum size of read data in bytes.766 * Value is derived from memory available in message payload while767 * using @ref cmd_debug_fread_response.768 */769#define DEBUG_READ_MAX_SZ	(MSG_DATA_MIN_SZ - 4)770 771/**772 * @ingroup Debugfs773 * @brief Response data for CMD_DEBUG_READ command774 */775struct cmd_debug_fread_response {776	/** @brief Size of data provided in this response in bytes */777	uint32_t readlen;778	/** @brief File data from seek position */779	char data[DEBUG_READ_MAX_SZ];780} BPMP_ABI_PACKED;781 782/**783 * @ingroup Debugfs784 * @brief Maximum size of write data in bytes.785 * Value is derived from memory available in message payload while786 * using @ref cmd_debug_fwrite_request.787 */788#define DEBUG_WRITE_MAX_SZ	(MSG_DATA_MIN_SZ - 12)789 790/**791 * @ingroup Debugfs792 * @brief Parameters for CMD_DEBUG_WRITE command793 */794struct cmd_debug_fwrite_request {795	/** @brief File access identifier received in response796	 * to CMD_DEBUG_OPEN_RO request797	 */798	uint32_t fd;799	/** @brief Size of write data in bytes */800	uint32_t datalen;801	/** @brief Data to be written */802	char data[DEBUG_WRITE_MAX_SZ];803} BPMP_ABI_PACKED;804 805/**806 * @ingroup Debugfs807 * @brief Parameters for CMD_DEBUG_CLOSE command808 */809struct cmd_debug_fclose_request {810	/** @brief File access identifier received in response811	 * to CMD_DEBUG_OPEN_RO request812	 */813	uint32_t fd;814} BPMP_ABI_PACKED;815 816/**817 * @ingroup Debugfs818 * @brief Request with #MRQ_DEBUG.819 *820 * The sender of an MRQ_DEBUG message uses #cmd to specify a debugfs821 * command to execute. Legal commands are the values of @ref822 * mrq_debug_commands. Each command requires a specific additional823 * payload of data.824 *825 * |command            |payload|826 * |-------------------|-------|827 * |CMD_DEBUG_OPEN_RO  |fop    |828 * |CMD_DEBUG_OPEN_WO  |fop    |829 * |CMD_DEBUG_READ     |frd    |830 * |CMD_DEBUG_WRITE    |fwr    |831 * |CMD_DEBUG_CLOSE    |fcl    |832 */833struct mrq_debug_request {834	/** @brief Sub-command (@ref mrq_debug_commands) */835	uint32_t cmd;836	union {837		/** @brief Request payload for CMD_DEBUG_OPEN_RO/WO command */838		struct cmd_debug_fopen_request fop;839		/** @brief Request payload for CMD_DEBUG_READ command */840		struct cmd_debug_fread_request frd;841		/** @brief Request payload for CMD_DEBUG_WRITE command */842		struct cmd_debug_fwrite_request fwr;843		/** @brief Request payload for CMD_DEBUG_CLOSE command */844		struct cmd_debug_fclose_request fcl;845	} BPMP_UNION_ANON;846} BPMP_ABI_PACKED;847 848/**849 * @ingroup Debugfs850 */851struct mrq_debug_response {852	union {853		/** @brief Response data for CMD_DEBUG_OPEN_RO/WO command */854		struct cmd_debug_fopen_response fop;855		/** @brief Response data for CMD_DEBUG_READ command */856		struct cmd_debug_fread_response frd;857	} BPMP_UNION_ANON;858} BPMP_ABI_PACKED;859 860/**861 * @ingroup MRQ_Codes862 * @def MRQ_RESET863 * @brief Reset an IP block864 *865 * * Platforms: T186, T194866 * * Initiators: Any867 * * Targets: BPMP868 * * Request Payload: @ref mrq_reset_request869 * * Response Payload: @ref mrq_reset_response870 *871 * @addtogroup Reset872 * @{873 */874 875enum mrq_reset_commands {876	/**877	 * @brief Assert module reset878	 *879	 * mrq_response::err is 0 if the operation was successful, or @n880	 * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n881	 * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n882	 * -#BPMP_ENOTSUP if target domain h/w state does not allow reset883	 */884	CMD_RESET_ASSERT = 1,885	/**886	 * @brief Deassert module reset887	 *888	 * mrq_response::err is 0 if the operation was successful, or @n889	 * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n890	 * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n891	 * -#BPMP_ENOTSUP if target domain h/w state does not allow reset892	 */893	CMD_RESET_DEASSERT = 2,894	/**895	 * @brief Assert and deassert the module reset896	 *897	 * mrq_response::err is 0 if the operation was successful, or @n898	 * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n899	 * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n900	 * -#BPMP_ENOTSUP if target domain h/w state does not allow reset901	 */902	CMD_RESET_MODULE = 3,903	/**904	 * @brief Get the highest reset ID905	 *906	 * mrq_response::err is 0 if the operation was successful, or @n907	 * -#BPMP_ENODEV if no reset domains are supported (number of IDs is 0)908	 */909	CMD_RESET_GET_MAX_ID = 4,910 911	/** @brief Not part of ABI and subject to change */912	CMD_RESET_MAX,913};914 915/**916 * @brief Request with MRQ_RESET917 *918 * Used by the sender of an #MRQ_RESET message to request BPMP to919 * assert or or deassert a given reset line.920 */921struct mrq_reset_request {922	/** @brief Reset action to perform (@ref mrq_reset_commands) */923	uint32_t cmd;924	/** @brief Id of the reset to affected */925	uint32_t reset_id;926} BPMP_ABI_PACKED;927 928/**929 * @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When930 * this sub-command is not supported, firmware will return -BPMP_EBADCMD931 * in mrq_response::err.932 */933struct cmd_reset_get_max_id_response {934	/** @brief Max reset id */935	uint32_t max_id;936} BPMP_ABI_PACKED;937 938/**939 * @brief Response with MRQ_RESET940 *941 * Each sub-command supported by @ref mrq_reset_request may return942 * sub-command-specific data. Some do and some do not as indicated943 * in the following table944 *945 * | sub-command          | payload          |946 * |----------------------|------------------|947 * | CMD_RESET_ASSERT     | -                |948 * | CMD_RESET_DEASSERT   | -                |949 * | CMD_RESET_MODULE     | -                |950 * | CMD_RESET_GET_MAX_ID | reset_get_max_id |951 */952struct mrq_reset_response {953	union {954		struct cmd_reset_get_max_id_response reset_get_max_id;955	} BPMP_UNION_ANON;956} BPMP_ABI_PACKED;957 958/** @} Reset */959 960/**961 * @ingroup MRQ_Codes962 * @def MRQ_I2C963 * @brief Issue an i2c transaction964 *965 * * Platforms: T186, T194966 * * Initiators: Any967 * * Targets: BPMP968 * * Request Payload: @ref mrq_i2c_request969 * * Response Payload: @ref mrq_i2c_response970 *971 * @addtogroup I2C972 * @{973 */974#define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE	(MSG_DATA_MIN_SZ - 12U)975#define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE	(MSG_DATA_MIN_SZ - 4U)976 977#define SERIALI2C_TEN           0x0010U978#define SERIALI2C_RD            0x0001U979#define SERIALI2C_STOP          0x8000U980#define SERIALI2C_NOSTART       0x4000U981#define SERIALI2C_REV_DIR_ADDR  0x2000U982#define SERIALI2C_IGNORE_NAK    0x1000U983#define SERIALI2C_NO_RD_ACK     0x0800U984#define SERIALI2C_RECV_LEN      0x0400U985 986enum {987	CMD_I2C_XFER = 1988};989 990/**991 * @brief Serializable i2c request992 *993 * Instances of this structure are packed (little-endian) into994 * cmd_i2c_xfer_request::data_buf. Each instance represents a single995 * transaction (or a portion of a transaction with repeated starts) on996 * an i2c bus.997 *998 * Because these structures are packed, some instances are likely to999 * be misaligned. Additionally because #data is variable length, it is1000 * not possible to iterate through a serialized list of these1001 * structures without inspecting #len in each instance.  It may be1002 * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf1003 * manually rather than using this structure definition.1004*/1005struct serial_i2c_request {1006	/** @brief I2C slave address */1007	uint16_t addr;1008	/** @brief Bitmask of SERIALI2C_ flags */1009	uint16_t flags;1010	/** @brief Length of I2C transaction in bytes */1011	uint16_t len;1012	/** @brief For write transactions only, #len bytes of data */1013	uint8_t data[];1014} BPMP_ABI_PACKED;1015 1016/**1017 * @brief Trigger one or more i2c transactions1018 */1019struct cmd_i2c_xfer_request {1020	/**1021	 * @brief Tegra PWR_I2C bus identifier1022	 *1023	 * @cond (bpmp_t234 || bpmp_t239 || bpmp_t194)1024	 * Must be set to 5.1025	 * @endcond (bpmp_t234 || bpmp_t239 || bpmp_t194)1026	 * @cond bpmp_th5001027	 * Must be set to 1.1028	 * @endcond bpmp_th5001029	 *1030	 */1031	uint32_t bus_id;1032 1033	/** @brief Count of valid bytes in #data_buf*/1034	uint32_t data_size;1035 1036	/** @brief Serialized packed instances of @ref serial_i2c_request*/1037	uint8_t data_buf[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE];1038} BPMP_ABI_PACKED;1039 1040/**1041 * @brief Container for data read from the i2c bus1042 *1043 * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute1044 * zero or more I2C reads. The data read from the bus is serialized1045 * into #data_buf.1046 */1047struct cmd_i2c_xfer_response {1048	/** @brief Count of valid bytes in #data_buf*/1049	uint32_t data_size;1050	/** @brief I2c read data */1051	uint8_t data_buf[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE];1052} BPMP_ABI_PACKED;1053 1054/**1055 * @brief Request with #MRQ_I2C1056 */1057struct mrq_i2c_request {1058	/** @brief Always CMD_I2C_XFER (i.e. 1) */1059	uint32_t cmd;1060	/** @brief Parameters of the transfer request */1061	struct cmd_i2c_xfer_request xfer;1062} BPMP_ABI_PACKED;1063 1064/**1065 * @brief Response to #MRQ_I2C1066 *1067 * mrq_response:err is1068 *  0: Success1069 *  -#BPMP_EBADCMD: if mrq_i2c_request::cmd is other than 11070 *  -#BPMP_EINVAL: if cmd_i2c_xfer_request does not contain correctly formatted request1071 *  -#BPMP_ENODEV: if cmd_i2c_xfer_request::bus_id is not supported by BPMP1072 *  -#BPMP_EACCES: if i2c transaction is not allowed due to firewall rules1073 *  -#BPMP_ETIMEDOUT: if i2c transaction times out1074 *  -#BPMP_ENXIO: if i2c slave device does not reply with ACK to the transaction1075 *  -#BPMP_EAGAIN: if ARB_LOST condition is detected by the i2c controller1076 *  -#BPMP_EIO: any other i2c controller error code than NO_ACK or ARB_LOST1077 */1078struct mrq_i2c_response {1079	struct cmd_i2c_xfer_response xfer;1080} BPMP_ABI_PACKED;1081 1082/** @} I2C */1083 1084/**1085 * @ingroup MRQ_Codes1086 * @def MRQ_CLK1087 * @brief Perform a clock operation1088 *1089 * * Platforms: T186, T1941090 * * Initiators: Any1091 * * Targets: BPMP1092 * * Request Payload: @ref mrq_clk_request1093 * * Response Payload: @ref mrq_clk_response1094 *1095 * @addtogroup Clocks1096 * @{1097 */1098enum {1099	CMD_CLK_GET_RATE = 1,1100	CMD_CLK_SET_RATE = 2,1101	CMD_CLK_ROUND_RATE = 3,1102	CMD_CLK_GET_PARENT = 4,1103	CMD_CLK_SET_PARENT = 5,1104	CMD_CLK_IS_ENABLED = 6,1105	CMD_CLK_ENABLE = 7,1106	CMD_CLK_DISABLE = 8,1107/** @cond DEPRECATED */1108	CMD_CLK_PROPERTIES = 9,1109	CMD_CLK_POSSIBLE_PARENTS = 10,1110	CMD_CLK_NUM_POSSIBLE_PARENTS = 11,1111	CMD_CLK_GET_POSSIBLE_PARENT = 12,1112	CMD_CLK_RESET_REFCOUNTS = 13,1113/** @endcond DEPRECATED */1114	CMD_CLK_GET_ALL_INFO = 14,1115	CMD_CLK_GET_MAX_CLK_ID = 15,1116	CMD_CLK_GET_FMAX_AT_VMIN = 16,1117	CMD_CLK_MAX,1118};1119 1120#define BPMP_CLK_HAS_MUX	(1U << 0U)1121#define BPMP_CLK_HAS_SET_RATE	(1U << 1U)1122#define BPMP_CLK_IS_ROOT	(1U << 2U)1123#define BPMP_CLK_IS_VAR_ROOT	(1U << 3U)1124/**1125 * @brief Protection against rate and parent changes1126 *1127 * #MRQ_CLK command #CMD_CLK_SET_RATE or #MRQ_CLK command #CMD_CLK_SET_PARENT will return1128 * -#BPMP_EACCES.1129 */1130#define BPMP_CLK_RATE_PARENT_CHANGE_DENIED (1U << 30)1131 1132/**1133 * @brief Protection against state changes1134 *1135 * #MRQ_CLK command #CMD_CLK_ENABLE or #MRQ_CLK command #CMD_CLK_DISABLE will return1136 * -#BPMP_EACCES.1137 */1138#define BPMP_CLK_STATE_CHANGE_DENIED (1U << 31)1139 1140#define MRQ_CLK_NAME_MAXLEN	40U1141#define MRQ_CLK_MAX_PARENTS	16U1142 1143/** @private */1144struct cmd_clk_get_rate_request {1145	BPMP_ABI_EMPTY1146} BPMP_ABI_PACKED;1147 1148struct cmd_clk_get_rate_response {1149	int64_t rate;1150} BPMP_ABI_PACKED;1151 1152struct cmd_clk_set_rate_request {1153	int32_t unused;1154	int64_t rate;1155} BPMP_ABI_PACKED;1156 1157struct cmd_clk_set_rate_response {1158	int64_t rate;1159} BPMP_ABI_PACKED;1160 1161struct cmd_clk_round_rate_request {1162	int32_t unused;1163	int64_t rate;1164} BPMP_ABI_PACKED;1165 1166struct cmd_clk_round_rate_response {1167	int64_t rate;1168} BPMP_ABI_PACKED;1169 1170/** @private */1171struct cmd_clk_get_parent_request {1172	BPMP_ABI_EMPTY1173} BPMP_ABI_PACKED;1174 1175struct cmd_clk_get_parent_response {1176	uint32_t parent_id;1177} BPMP_ABI_PACKED;1178 1179struct cmd_clk_set_parent_request {1180	uint32_t parent_id;1181} BPMP_ABI_PACKED;1182 1183struct cmd_clk_set_parent_response {1184	uint32_t parent_id;1185} BPMP_ABI_PACKED;1186 1187/** @private */1188struct cmd_clk_is_enabled_request {1189	BPMP_ABI_EMPTY1190} BPMP_ABI_PACKED;1191 1192/**1193 * @brief Response data to #MRQ_CLK sub-command CMD_CLK_IS_ENABLED1194 */1195struct cmd_clk_is_enabled_response {1196	/**1197	 * @brief The state of the clock that has been successfully1198	 * requested with CMD_CLK_ENABLE or CMD_CLK_DISABLE by the1199	 * master invoking the command earlier.1200	 *1201	 * The state may not reflect the physical state of the clock1202	 * if there are some other masters requesting it to be1203	 * enabled.1204	 *1205	 * Value 0 is disabled, all other values indicate enabled.1206	 */1207	int32_t state;1208} BPMP_ABI_PACKED;1209 1210/** @private */1211struct cmd_clk_enable_request {1212	BPMP_ABI_EMPTY1213} BPMP_ABI_PACKED;1214 1215/** @private */1216struct cmd_clk_enable_response {1217	BPMP_ABI_EMPTY1218} BPMP_ABI_PACKED;1219 1220/** @private */1221struct cmd_clk_disable_request {1222	BPMP_ABI_EMPTY1223} BPMP_ABI_PACKED;1224 1225/** @private */1226struct cmd_clk_disable_response {1227	BPMP_ABI_EMPTY1228} BPMP_ABI_PACKED;1229 1230/** @cond DEPRECATED */1231/** @private */1232struct cmd_clk_properties_request {1233	BPMP_ABI_EMPTY1234} BPMP_ABI_PACKED;1235 1236/** @todo flags need to be spelled out here */1237struct cmd_clk_properties_response {1238	uint32_t flags;1239} BPMP_ABI_PACKED;1240 1241/** @private */1242struct cmd_clk_possible_parents_request {1243	BPMP_ABI_EMPTY1244} BPMP_ABI_PACKED;1245 1246struct cmd_clk_possible_parents_response {1247	uint8_t num_parents;1248	uint8_t reserved[3];1249	uint32_t parent_id[MRQ_CLK_MAX_PARENTS];1250} BPMP_ABI_PACKED;1251 1252/** @private */1253struct cmd_clk_num_possible_parents_request {1254	BPMP_ABI_EMPTY1255} BPMP_ABI_PACKED;1256 1257struct cmd_clk_num_possible_parents_response {1258	uint8_t num_parents;1259} BPMP_ABI_PACKED;1260 1261struct cmd_clk_get_possible_parent_request {1262	uint8_t parent_idx;1263} BPMP_ABI_PACKED;1264 1265struct cmd_clk_get_possible_parent_response {1266	uint32_t parent_id;1267} BPMP_ABI_PACKED;1268/** @endcond DEPRECATED */1269 1270/** @private */1271struct cmd_clk_get_all_info_request {1272	BPMP_ABI_EMPTY1273} BPMP_ABI_PACKED;1274 1275struct cmd_clk_get_all_info_response {1276	uint32_t flags;1277	uint32_t parent;1278	uint32_t parents[MRQ_CLK_MAX_PARENTS];1279	uint8_t num_parents;1280	uint8_t name[MRQ_CLK_NAME_MAXLEN];1281} BPMP_ABI_PACKED;1282 1283/** @private */1284struct cmd_clk_get_max_clk_id_request {1285	BPMP_ABI_EMPTY1286} BPMP_ABI_PACKED;1287 1288struct cmd_clk_get_max_clk_id_response {1289	uint32_t max_id;1290} BPMP_ABI_PACKED;1291 1292/** @private */1293struct cmd_clk_get_fmax_at_vmin_request {1294	BPMP_ABI_EMPTY1295} BPMP_ABI_PACKED;1296 1297struct cmd_clk_get_fmax_at_vmin_response {1298	int64_t rate;1299} BPMP_ABI_PACKED;1300 1301 1302/**1303 * @ingroup Clocks1304 * @brief Request with #MRQ_CLK1305 *1306 * Used by the sender of an #MRQ_CLK message to control clocks. The1307 * clk_request is split into several sub-commands. Some sub-commands1308 * require no additional data. Others have a sub-command specific1309 * payload1310 *1311 * |sub-command                 |payload                |1312 * |----------------------------|-----------------------|1313 * |CMD_CLK_GET_RATE            |-                      |1314 * |CMD_CLK_SET_RATE            |clk_set_rate           |1315 * |CMD_CLK_ROUND_RATE          |clk_round_rate         |1316 * |CMD_CLK_GET_PARENT          |-                      |1317 * |CMD_CLK_SET_PARENT          |clk_set_parent         |1318 * |CMD_CLK_IS_ENABLED          |-                      |1319 * |CMD_CLK_ENABLE              |-                      |1320 * |CMD_CLK_DISABLE             |-                      |1321 * |CMD_CLK_GET_ALL_INFO        |-                      |1322 * |CMD_CLK_GET_MAX_CLK_ID      |-                      |1323 * |CMD_CLK_GET_FMAX_AT_VMIN    |-1324 * |1325 *1326 */1327 1328/** @cond DEPRECATED1329 *1330 * Older versions of firmware also supported following sub-commands:1331 * |CMD_CLK_PROPERTIES          |-                      |1332 * |CMD_CLK_POSSIBLE_PARENTS    |-                      |1333 * |CMD_CLK_NUM_POSSIBLE_PARENTS|-                      |1334 * |CMD_CLK_GET_POSSIBLE_PARENT |clk_get_possible_parent|1335 * |CMD_CLK_RESET_REFCOUNTS     |-                      |1336 *1337 * @endcond DEPRECATED */1338 1339struct mrq_clk_request {1340	/** @brief Sub-command and clock id concatenated to 32-bit word.1341	 * - bits[31..24] is the sub-cmd.1342	 * - bits[23..0] is the clock id1343	 */1344	uint32_t cmd_and_id;1345 1346	union {1347		/** @private */1348		struct cmd_clk_get_rate_request clk_get_rate;1349		struct cmd_clk_set_rate_request clk_set_rate;1350		struct cmd_clk_round_rate_request clk_round_rate;1351		/** @private */1352		struct cmd_clk_get_parent_request clk_get_parent;1353		struct cmd_clk_set_parent_request clk_set_parent;1354		/** @private */1355		struct cmd_clk_enable_request clk_enable;1356		/** @private */1357		struct cmd_clk_disable_request clk_disable;1358		/** @private */1359		struct cmd_clk_is_enabled_request clk_is_enabled;1360		/** @cond DEPRECATED */1361		/** @private */1362		struct cmd_clk_properties_request clk_properties;1363		/** @private */1364		struct cmd_clk_possible_parents_request clk_possible_parents;1365		/** @private */1366		struct cmd_clk_num_possible_parents_request clk_num_possible_parents;1367		struct cmd_clk_get_possible_parent_request clk_get_possible_parent;1368		/** @endcond DEPRECATED */1369		/** @private */1370		struct cmd_clk_get_all_info_request clk_get_all_info;1371		/** @private */1372		struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id;1373		/** @private */1374		struct cmd_clk_get_fmax_at_vmin_request clk_get_fmax_at_vmin;1375	} BPMP_UNION_ANON;1376} BPMP_ABI_PACKED;1377 1378/**1379 * @ingroup Clocks1380 * @brief Response to MRQ_CLK1381 *1382 * Each sub-command supported by @ref mrq_clk_request may return1383 * sub-command-specific data. Some do and some do not as indicated in1384 * the following table1385 *1386 * |sub-command                 |payload                 |1387 * |----------------------------|------------------------|1388 * |CMD_CLK_GET_RATE            |clk_get_rate            |1389 * |CMD_CLK_SET_RATE            |clk_set_rate            |1390 * |CMD_CLK_ROUND_RATE          |clk_round_rate          |1391 * |CMD_CLK_GET_PARENT          |clk_get_parent          |1392 * |CMD_CLK_SET_PARENT          |clk_set_parent          |1393 * |CMD_CLK_IS_ENABLED          |clk_is_enabled          |1394 * |CMD_CLK_ENABLE              |-                       |1395 * |CMD_CLK_DISABLE             |-                       |1396 * |CMD_CLK_GET_ALL_INFO        |clk_get_all_info        |1397 * |CMD_CLK_GET_MAX_CLK_ID      |clk_get_max_id          |1398 * |CMD_CLK_GET_FMAX_AT_VMIN    |clk_get_fmax_at_vmin    |1399 *1400 */1401 1402/** @cond DEPRECATED1403 *1404 * Older versions of firmware also supported following sub-commands:1405 * |CMD_CLK_PROPERTIES          |clk_properties          |1406 * |CMD_CLK_POSSIBLE_PARENTS    |clk_possible_parents    |1407 * |CMD_CLK_NUM_POSSIBLE_PARENTS|clk_num_possible_parents|1408 * |CMD_CLK_GET_POSSIBLE_PARENT |clk_get_possible_parents|1409 * |CMD_CLK_RESET_REFCOUNTS     |-                       |1410 *1411 * @endcond DEPRECATED */1412 1413struct mrq_clk_response {1414	union {1415		struct cmd_clk_get_rate_response clk_get_rate;1416		struct cmd_clk_set_rate_response clk_set_rate;1417		struct cmd_clk_round_rate_response clk_round_rate;1418		struct cmd_clk_get_parent_response clk_get_parent;1419		struct cmd_clk_set_parent_response clk_set_parent;1420		/** @private */1421		struct cmd_clk_enable_response clk_enable;1422		/** @private */1423		struct cmd_clk_disable_response clk_disable;1424		struct cmd_clk_is_enabled_response clk_is_enabled;1425		/** @cond DEPRECATED */1426		struct cmd_clk_properties_response clk_properties;1427		struct cmd_clk_possible_parents_response clk_possible_parents;1428		struct cmd_clk_num_possible_parents_response clk_num_possible_parents;1429		struct cmd_clk_get_possible_parent_response clk_get_possible_parent;1430		/** @endcond DEPRECATED */1431		struct cmd_clk_get_all_info_response clk_get_all_info;1432		struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id;1433		struct cmd_clk_get_fmax_at_vmin_response clk_get_fmax_at_vmin;1434	} BPMP_UNION_ANON;1435} BPMP_ABI_PACKED;1436 1437/** @} Clocks */1438 1439/**1440 * @ingroup MRQ_Codes1441 * @def MRQ_QUERY_ABI1442 * @brief Check if an MRQ is implemented1443 *1444 * * Platforms: All1445 * * Initiators: Any1446 * * Targets: Any except DMCE1447 * * Request Payload: @ref mrq_query_abi_request1448 * * Response Payload: @ref mrq_query_abi_response1449 */1450 1451/**1452 * @ingroup ABI_info1453 * @brief Request with MRQ_QUERY_ABI1454 *1455 * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported1456 * by the recipient.1457 */1458struct mrq_query_abi_request {1459	/** @brief MRQ code to query */1460	uint32_t mrq;1461} BPMP_ABI_PACKED;1462 1463/**1464 * @ingroup ABI_info1465 * @brief Response to MRQ_QUERY_ABI1466 *1467 * @note mrq_response::err of 0 indicates that the query was1468 * successful, not that the MRQ itself is supported!1469 */1470struct mrq_query_abi_response {1471	/** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */1472	int32_t status;1473} BPMP_ABI_PACKED;1474 1475/**1476 *1477 * @ingroup MRQ_Codes1478 * @def MRQ_PG1479 * @brief Control power-gating state of a partition. In contrast to1480 * MRQ_PG_UPDATE_STATE, operations that change the power partition1481 * state are NOT reference counted1482 *1483 * @cond (bpmp_t194 || bpmp_t186)1484 * @note On T194 and earlier BPMP-FW forcefully turns off some partitions as1485 * part of SC7 entry because their state cannot be adequately restored on exit.1486 * Therefore, it is recommended to power off all domains via MRQ_PG prior to SC71487 * entry.1488 * See @ref bpmp_pdomain_ids for further detail.1489 * @endcond (bpmp_t194 || bpmp_t186)1490 *1491 * * Platforms: T186, T1941492 * * Initiators: Any1493 * * Targets: BPMP1494 * * Request Payload: @ref mrq_pg_request1495 * * Response Payload: @ref mrq_pg_response1496 *1497 * @addtogroup Powergating1498 * @{1499 */1500enum mrq_pg_cmd {1501	/**1502	 * @brief Check whether the BPMP driver supports the specified1503	 * request type1504	 *1505	 * mrq_response::err is 0 if the specified request is1506	 * supported and -#BPMP_ENODEV otherwise.1507	 */1508	CMD_PG_QUERY_ABI = 0,1509 1510	/**1511	 * @brief Set the current state of specified power domain. The1512	 * possible values for power domains are defined in enum1513	 * pg_states1514	 *1515	 * mrq_response:err is1516	 * 0: Success1517	 * -#BPMP_EINVAL: Invalid request parameters1518	 */1519	CMD_PG_SET_STATE = 1,1520 1521	/**1522	 * @brief Get the current state of specified power domain. The1523	 * possible values for power domains are defined in enum1524	 * pg_states1525	 *1526	 * mrq_response:err is1527	 * 0: Success1528	 * -#BPMP_EINVAL: Invalid request parameters1529	 */1530	CMD_PG_GET_STATE = 2,1531 1532	/**1533	 * @brief Get the name string of specified power domain id.1534	 *1535	 * mrq_response:err is1536	 * 0: Success1537	 * -#BPMP_EINVAL: Invalid request parameters1538	 */1539	CMD_PG_GET_NAME = 3,1540 1541 1542	/**1543	 * @brief Get the highest power domain id in the system. Not1544	 * all IDs between 0 and max_id are valid IDs.1545	 *1546	 * mrq_response:err is1547	 * 0: Success1548	 * -#BPMP_EINVAL: Invalid request parameters1549	 */1550	CMD_PG_GET_MAX_ID = 4,1551};1552 1553#define MRQ_PG_NAME_MAXLEN	401554 1555enum pg_states {1556	/** @brief Power domain is OFF */1557	PG_STATE_OFF = 0,1558	/** @brief Power domain is ON */1559	PG_STATE_ON = 1,1560	/**1561	 * @brief a legacy state where power domain and the clock1562	 * associated to the domain are ON.1563	 * This state is only supported in T186, and the use of it is1564	 * deprecated.1565	 */1566	PG_STATE_RUNNING = 2,1567};1568 1569struct cmd_pg_query_abi_request {1570	/** @ref mrq_pg_cmd */1571	uint32_t type;1572} BPMP_ABI_PACKED;1573 1574struct cmd_pg_set_state_request {1575	/** @ref pg_states */1576	uint32_t state;1577} BPMP_ABI_PACKED;1578 1579/**1580 * @brief Response data to #MRQ_PG sub command #CMD_PG_GET_STATE1581 */1582struct cmd_pg_get_state_response {1583	/**1584	 * @brief The state of the power partition that has been1585	 * succesfuly requested by the master earlier using #MRQ_PG1586	 * command #CMD_PG_SET_STATE.1587	 *1588	 * The state may not reflect the physical state of the power1589	 * partition if there are some other masters requesting it to1590	 * be enabled.1591	 *1592	 * See @ref pg_states for possible values1593	 */1594	uint32_t state;1595} BPMP_ABI_PACKED;1596 1597struct cmd_pg_get_name_response {1598	uint8_t name[MRQ_PG_NAME_MAXLEN];1599} BPMP_ABI_PACKED;1600 1601struct cmd_pg_get_max_id_response {1602	uint32_t max_id;1603} BPMP_ABI_PACKED;1604 1605/**1606 * @brief Request with #MRQ_PG1607 *1608 * Used by the sender of an #MRQ_PG message to control power1609 * partitions. The pg_request is split into several sub-commands. Some1610 * sub-commands require no additional data. Others have a sub-command1611 * specific payload1612 *1613 * |sub-command                 |payload                |1614 * |----------------------------|-----------------------|1615 * |CMD_PG_QUERY_ABI            | query_abi             |1616 * |CMD_PG_SET_STATE            | set_state             |1617 * |CMD_PG_GET_STATE            | -                     |1618 * |CMD_PG_GET_NAME             | -                     |1619 * |CMD_PG_GET_MAX_ID           | -                     |1620 *1621 */1622struct mrq_pg_request {1623	uint32_t cmd;1624	uint32_t id;1625	union {1626		struct cmd_pg_query_abi_request query_abi;1627		struct cmd_pg_set_state_request set_state;1628	} BPMP_UNION_ANON;1629} BPMP_ABI_PACKED;1630 1631/**1632 * @brief Response to MRQ_PG1633 *1634 * Each sub-command supported by @ref mrq_pg_request may return1635 * sub-command-specific data. Some do and some do not as indicated in1636 * the following table1637 *1638 * |sub-command                 |payload                |1639 * |----------------------------|-----------------------|1640 * |CMD_PG_QUERY_ABI            | -                     |1641 * |CMD_PG_SET_STATE            | -                     |1642 * |CMD_PG_GET_STATE            | get_state             |1643 * |CMD_PG_GET_NAME             | get_name              |1644 * |CMD_PG_GET_MAX_ID           | get_max_id            |1645 */1646struct mrq_pg_response {1647	union {1648		struct cmd_pg_get_state_response get_state;1649		struct cmd_pg_get_name_response get_name;1650		struct cmd_pg_get_max_id_response get_max_id;1651	} BPMP_UNION_ANON;1652} BPMP_ABI_PACKED;1653 1654/** @} Powergating */1655 1656/**1657 * @ingroup MRQ_Codes1658 * @def MRQ_THERMAL1659 * @brief Interact with BPMP thermal framework1660 *1661 * * Platforms: T186, T1941662 * * Initiators: Any1663 * * Targets: Any1664 * * Request Payload: TODO1665 * * Response Payload: TODO1666 *1667 * @addtogroup Thermal1668 *1669 * The BPMP firmware includes a thermal framework. Drivers within the1670 * bpmp firmware register with the framework to provide thermal1671 * zones. Each thermal zone corresponds to an entity whose temperature1672 * can be measured. The framework also has a notion of trip points. A1673 * trip point consists of a thermal zone id, a temperature, and a1674 * callback routine. The framework invokes the callback when the zone1675 * hits the indicated temperature. The BPMP firmware uses this thermal1676 * framework interally to implement various temperature-dependent1677 * functions.1678 *1679 * Software on the CPU can use #MRQ_THERMAL (with payload @ref1680 * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal1681 * framework. The CPU must It can query the number of supported zones,1682 * query zone temperatures, and set trip points.1683 *1684 * When a trip point set by the CPU gets crossed, BPMP firmware issues1685 * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a1686 * payload of @ref mrq_thermal_bpmp_to_host_request.1687 * @{1688 */1689enum mrq_thermal_host_to_bpmp_cmd {1690	/**1691	 * @brief Check whether the BPMP driver supports the specified1692	 * request type.1693	 *1694	 * Host needs to supply request parameters.1695	 *1696	 * mrq_response::err is 0 if the specified request is1697	 * supported and -#BPMP_ENODEV otherwise.1698	 */1699	CMD_THERMAL_QUERY_ABI = 0,1700 1701	/**1702	 * @brief Get the current temperature of the specified zone.1703	 *1704	 * Host needs to supply request parameters.1705	 *1706	 * mrq_response::err is1707	 * *  0: Temperature query succeeded.1708	 * *  -#BPMP_EINVAL: Invalid request parameters.1709	 * *  -#BPMP_ENOENT: No driver registered for thermal zone..1710	 * *  -#BPMP_EFAULT: Problem reading temperature measurement.1711	 */1712	CMD_THERMAL_GET_TEMP = 1,1713 1714	/**1715	 * @brief Enable or disable and set the lower and upper1716	 *   thermal limits for a thermal trip point. Each zone has1717	 *   one trip point.1718	 *1719	 * Host needs to supply request parameters. Once the1720	 * temperature hits a trip point, the BPMP will send a message1721	 * to the CPU having MRQ=MRQ_THERMAL and1722	 * type=CMD_THERMAL_HOST_TRIP_REACHED1723	 *1724	 * mrq_response::err is1725	 * *  0: Trip successfully set.1726	 * *  -#BPMP_EINVAL: Invalid request parameters.1727	 * *  -#BPMP_ENOENT: No driver registered for thermal zone.1728	 * *  -#BPMP_EFAULT: Problem setting trip point.1729	 */1730	CMD_THERMAL_SET_TRIP = 2,1731 1732	/**1733	 * @brief Get the number of supported thermal zones.1734	 *1735	 * No request parameters required.1736	 *1737	 * mrq_response::err is always 0, indicating success.1738	 */1739	CMD_THERMAL_GET_NUM_ZONES = 3,1740 1741	/**1742	 * @brief Get the thermtrip of the specified zone.1743	 *1744	 * Host needs to supply request parameters.1745	 *1746	 * mrq_response::err is1747	 * *  0: Valid zone information returned.1748	 * *  -#BPMP_EINVAL: Invalid request parameters.1749	 * *  -#BPMP_ENOENT: No driver registered for thermal zone.1750	 * *  -#BPMP_ERANGE if thermtrip is invalid or disabled.1751	 * *  -#BPMP_EFAULT: Problem reading zone information.1752	 */1753	CMD_THERMAL_GET_THERMTRIP = 4,1754 1755	/** @brief: number of supported host-to-bpmp commands. May1756	 * increase in future1757	 */1758	CMD_THERMAL_HOST_TO_BPMP_NUM1759};1760 1761enum mrq_thermal_bpmp_to_host_cmd {1762	/**1763	 * @brief Indication that the temperature for a zone has1764	 *   exceeded the range indicated in the thermal trip point1765	 *   for the zone.1766	 *1767	 * BPMP needs to supply request parameters. Host only needs to1768	 * acknowledge.1769	 */1770	CMD_THERMAL_HOST_TRIP_REACHED = 100,1771 1772	/** @brief: number of supported bpmp-to-host commands. May1773	 * increase in future1774	 */1775	CMD_THERMAL_BPMP_TO_HOST_NUM1776};1777 1778/*1779 * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI1780 *1781 * zone: Request type for which to check existence.1782 */1783struct cmd_thermal_query_abi_request {1784	uint32_t type;1785} BPMP_ABI_PACKED;1786 1787/*1788 * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP1789 *1790 * zone: Number of thermal zone.1791 */1792struct cmd_thermal_get_temp_request {1793	uint32_t zone;1794} BPMP_ABI_PACKED;1795 1796/*1797 * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP1798 *1799 * error: 0 if request succeeded.1800 *	-BPMP_EINVAL if request parameters were invalid.1801 *      -BPMP_ENOENT if no driver was registered for the specified thermal zone.1802 *      -BPMP_EFAULT for other thermal zone driver errors.1803 * temp: Current temperature in millicelsius.1804 */1805struct cmd_thermal_get_temp_response {1806	int32_t temp;1807} BPMP_ABI_PACKED;1808 1809/*1810 * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP1811 *1812 * zone: Number of thermal zone.1813 * low: Temperature of lower trip point in millicelsius1814 * high: Temperature of upper trip point in millicelsius1815 * enabled: 1 to enable trip point, 0 to disable trip point1816 */1817struct cmd_thermal_set_trip_request {1818	uint32_t zone;1819	int32_t low;1820	int32_t high;1821	uint32_t enabled;1822} BPMP_ABI_PACKED;1823 1824/*1825 * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED1826 *1827 * zone: Number of thermal zone where trip point was reached.1828 */1829struct cmd_thermal_host_trip_reached_request {1830	uint32_t zone;1831} BPMP_ABI_PACKED;1832 1833/*1834 * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES1835 *1836 * num: Number of supported thermal zones. The thermal zones are indexed1837 *      starting from zero.1838 */1839struct cmd_thermal_get_num_zones_response {1840	uint32_t num;1841} BPMP_ABI_PACKED;1842 1843/*1844 * Host->BPMP request data for request type CMD_THERMAL_GET_THERMTRIP1845 *1846 * zone: Number of thermal zone.1847 */1848struct cmd_thermal_get_thermtrip_request {1849	uint32_t zone;1850} BPMP_ABI_PACKED;1851 1852/*1853 * BPMP->Host reply data for request CMD_THERMAL_GET_THERMTRIP1854 *1855 * thermtrip: HW shutdown temperature in millicelsius.1856 */1857struct cmd_thermal_get_thermtrip_response {1858	int32_t thermtrip;1859} BPMP_ABI_PACKED;1860 1861/*1862 * Host->BPMP request data.1863 *1864 * Reply type is union mrq_thermal_bpmp_to_host_response.1865 *1866 * type: Type of request. Values listed in enum mrq_thermal_type.1867 * data: Request type specific parameters.1868 */1869struct mrq_thermal_host_to_bpmp_request {1870	uint32_t type;1871	union {1872		struct cmd_thermal_query_abi_request query_abi;1873		struct cmd_thermal_get_temp_request get_temp;1874		struct cmd_thermal_set_trip_request set_trip;1875		struct cmd_thermal_get_thermtrip_request get_thermtrip;1876	} BPMP_UNION_ANON;1877} BPMP_ABI_PACKED;1878 1879/*1880 * BPMP->Host request data.1881 *1882 * type: Type of request. Values listed in enum mrq_thermal_type.1883 * data: Request type specific parameters.1884 */1885struct mrq_thermal_bpmp_to_host_request {1886	uint32_t type;1887	union {1888		struct cmd_thermal_host_trip_reached_request host_trip_reached;1889	} BPMP_UNION_ANON;1890} BPMP_ABI_PACKED;1891 1892/*1893 * Data in reply to a Host->BPMP request.1894 */1895union mrq_thermal_bpmp_to_host_response {1896	struct cmd_thermal_get_temp_response get_temp;1897	struct cmd_thermal_get_thermtrip_response get_thermtrip;1898	struct cmd_thermal_get_num_zones_response get_num_zones;1899} BPMP_ABI_PACKED;1900 1901/** @} Thermal */1902 1903/**1904 * @ingroup MRQ_Codes1905 * @def MRQ_OC_STATUS1906 * @brief Query over current status1907 *1908 * * Platforms: T2341909 * @cond bpmp_t2341910 * * Initiators: CCPLEX1911 * * Targets: BPMP1912 * * Request Payload: N/A1913 * * Response Payload: @ref mrq_oc_status_response1914 *1915 * @addtogroup OC_status1916 * @{1917 */1918 1919#define OC_STATUS_MAX_SIZE	24U1920 1921/*1922 * @brief Response to #MRQ_OC_STATUS1923 *1924 * throt_en: Value for each OC alarm where zero signifies throttle is1925 *           disabled, and non-zero throttle is enabled.1926 * event_cnt: Total number of OC events for each OC alarm.1927 *1928 * mrq_response::err is 0 if the operation was successful and1929 * -#BPMP_ENODEV otherwise.1930 */1931struct mrq_oc_status_response {1932	uint8_t throt_en[OC_STATUS_MAX_SIZE];1933	uint32_t event_cnt[OC_STATUS_MAX_SIZE];1934} BPMP_ABI_PACKED;1935 1936/** @} OC_status */1937/** @endcond bpmp_t234 */1938 1939/**1940 * @ingroup MRQ_Codes1941 * @def MRQ_CPU_VHINT1942 * @brief Query CPU voltage hint data1943 *1944 * * Platforms: T1861945 * @cond bpmp_t1861946 * * Initiators: CCPLEX1947 * * Targets: BPMP1948 * * Request Payload: @ref mrq_cpu_vhint_request1949 * * Response Payload: N/A1950 *1951 * @addtogroup Vhint1952 * @{1953 */1954 1955/**1956 * @brief Request with #MRQ_CPU_VHINT1957 *1958 * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data1959 * from BPMP to memory space pointed by #addr. CCPLEX is responsible1960 * to allocate sizeof(cpu_vhint_data) sized block of memory and1961 * appropriately map it for BPMP before sending the request.1962 */1963struct mrq_cpu_vhint_request {1964	/** @brief IOVA address for the #cpu_vhint_data */1965	uint32_t addr;1966	/** @brief ID of the cluster whose data is requested */1967	uint32_t cluster_id;1968} BPMP_ABI_PACKED;1969 1970/**1971 * @brief Description of the CPU v/f relation1972 *1973 * Used by #MRQ_CPU_VHINT call to carry data pointed by1974 * #mrq_cpu_vhint_request::addr1975 */1976struct cpu_vhint_data {1977	uint32_t ref_clk_hz; /**< reference frequency in Hz */1978	uint16_t pdiv; /**< post divider value */1979	uint16_t mdiv; /**< input divider value */1980	uint16_t ndiv_max; /**< fMAX expressed with max NDIV value */1981	/** table of ndiv values as a function of vINDEX (voltage index) */1982	uint16_t ndiv[80];1983	/** minimum allowed NDIV value */1984	uint16_t ndiv_min;1985	/** minimum allowed voltage hint value (as in vINDEX) */1986	uint16_t vfloor;1987	/** maximum allowed voltage hint value (as in vINDEX) */1988	uint16_t vceil;1989	/** post-multiplier for vindex value */1990	uint16_t vindex_mult;1991	/** post-divider for vindex value */1992	uint16_t vindex_div;1993	/** reserved for future use */1994	uint16_t reserved[328];1995} BPMP_ABI_PACKED;1996 1997/** @} Vhint */1998/** @endcond bpmp_t186 */1999 2000/**2001 * @ingroup MRQ_Codes2002 * @def MRQ_ABI_RATCHET2003 * @brief ABI ratchet value query2004 *2005 * * Platforms: T186, T1942006 * * Initiators: Any2007 * * Targets: BPMP2008 * * Request Payload: @ref mrq_abi_ratchet_request2009 * * Response Payload: @ref mrq_abi_ratchet_response2010 * @addtogroup ABI_info2011 * @{2012 */2013 2014/**2015 * @brief An ABI compatibility mechanism2016 *2017 * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future2018 * revision of this header file.2019 * 1. That future revision deprecates some MRQ2020 * 2. That future revision introduces a breaking change to an existing2021 *    MRQ or2022 * 3. A bug is discovered in an existing implementation of the BPMP-FW2023 *    (or possibly one of its clients) which warrants deprecating that2024 *    implementation.2025 */2026#define BPMP_ABI_RATCHET_VALUE 32027 2028/**2029 * @brief Request with #MRQ_ABI_RATCHET.2030 *2031 * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header2032 * against which the requester was compiled.2033 *2034 * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may2035 * reply with mrq_response::err = -#BPMP_ERANGE to indicate that2036 * BPMP-FW cannot interoperate correctly with the requester. Requester2037 * should cease further communication with BPMP.2038 *2039 * Otherwise, err shall be 0.2040 */2041struct mrq_abi_ratchet_request {2042	/** @brief Requester's ratchet value */2043	uint16_t ratchet;2044};2045 2046/**2047 * @brief Response to #MRQ_ABI_RATCHET2048 *2049 * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header2050 * against which BPMP firwmare was compiled.2051 *2052 * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE,2053 * the requster must either interoperate with BPMP according to an ABI2054 * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease2055 * communication with BPMP.2056 *2057 * If mrq_response::err is 0 and ratchet is greater than or equal to the2058 * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue2059 * normal operation.2060 */2061struct mrq_abi_ratchet_response {2062	/** @brief BPMP's ratchet value */2063	uint16_t ratchet;2064};2065 2066/** @} ABI_info */2067 2068/**2069 * @ingroup MRQ_Codes2070 * @def MRQ_EMC_DVFS_LATENCY2071 * @brief Query frequency dependent EMC DVFS latency2072 *2073 * * Platforms: T186, T194, T2342074 * * Initiators: CCPLEX2075 * * Targets: BPMP2076 * * Request Payload: N/A2077 * * Response Payload: @ref mrq_emc_dvfs_latency_response2078 * @addtogroup EMC2079 * @{2080 */2081 2082/**2083 * @brief Used by @ref mrq_emc_dvfs_latency_response2084 */2085struct emc_dvfs_latency {2086	/** @brief EMC DVFS node frequency in kHz */2087	uint32_t freq;2088	/** @brief EMC DVFS latency in nanoseconds */2089	uint32_t latency;2090} BPMP_ABI_PACKED;2091 2092#define EMC_DVFS_LATENCY_MAX_SIZE	142093/**2094 * @brief Response to #MRQ_EMC_DVFS_LATENCY2095 */2096struct mrq_emc_dvfs_latency_response {2097	/** @brief The number valid entries in #pairs */2098	uint32_t num_pairs;2099	/** @brief EMC DVFS node <frequency, latency> information */2100	struct emc_dvfs_latency pairs[EMC_DVFS_LATENCY_MAX_SIZE];2101} BPMP_ABI_PACKED;2102 2103/** @} EMC */2104 2105/**2106 * @ingroup MRQ_Codes2107 * @def MRQ_EMC_DVFS_EMCHUB2108 * @brief Query EMC HUB frequencies2109 *2110 * * Platforms: T234 onwards2111 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)2112 * * Initiators: CCPLEX2113 * * Targets: BPMP2114 * * Request Payload: N/A2115 * * Response Payload: @ref mrq_emc_dvfs_emchub_response2116 * @addtogroup EMC2117 * @{2118 */2119 2120/**2121 * @brief Used by @ref mrq_emc_dvfs_emchub_response2122 */2123struct emc_dvfs_emchub {2124	/** @brief EMC DVFS node frequency in kHz */2125	uint32_t freq;2126	/** @brief EMC HUB frequency in kHz */2127	uint32_t hub_freq;2128} BPMP_ABI_PACKED;2129 2130#define EMC_DVFS_EMCHUB_MAX_SIZE	EMC_DVFS_LATENCY_MAX_SIZE2131/**2132 * @brief Response to #MRQ_EMC_DVFS_EMCHUB2133 */2134struct mrq_emc_dvfs_emchub_response {2135	/** @brief The number valid entries in #pairs */2136	uint32_t num_pairs;2137	/** @brief EMC DVFS node <frequency, hub frequency> information */2138	struct emc_dvfs_emchub pairs[EMC_DVFS_EMCHUB_MAX_SIZE];2139} BPMP_ABI_PACKED;2140 2141/** @} EMC */2142/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */2143 2144/**2145 * @ingroup MRQ_Codes2146 * @def MRQ_EMC_DISP_RFL2147 * @brief Set EMC display RFL handshake mode of operations2148 *2149 * * Platforms: T234 onwards2150 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)2151 * * Initiators: CCPLEX2152 * * Targets: BPMP2153 * * Request Payload: @ref mrq_emc_disp_rfl_request2154 * * Response Payload: N/A2155 *2156 * @addtogroup EMC2157 * @{2158 */2159 2160enum mrq_emc_disp_rfl_mode {2161	/** @brief EMC display RFL handshake disabled  */2162	EMC_DISP_RFL_MODE_DISABLED = 0,2163	/** @brief EMC display RFL handshake enabled  */2164	EMC_DISP_RFL_MODE_ENABLED = 1,2165};2166 2167/**2168 * @ingroup EMC2169 * @brief Request with #MRQ_EMC_DISP_RFL2170 *2171 * Used by the sender of an #MRQ_EMC_DISP_RFL message to2172 * request the mode of EMC display RFL handshake.2173 *2174 * mrq_response::err is2175 * * 0: RFL mode is set successfully2176 * * -#BPMP_EINVAL: invalid mode requested2177 * * -#BPMP_ENOSYS: RFL handshake is not supported2178 * * -#BPMP_EACCES: Permission denied2179 * * -#BPMP_ENODEV: if disp rfl mrq is not supported by BPMP-FW2180 */2181struct mrq_emc_disp_rfl_request {2182	/** @brief EMC display RFL mode (@ref mrq_emc_disp_rfl_mode) */2183	uint32_t mode;2184} BPMP_ABI_PACKED;2185 2186/** @} EMC */2187/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */2188 2189/**2190 * @ingroup MRQ_Codes2191 * @def MRQ_BWMGR2192 * @brief bwmgr requests2193 *2194 * * Platforms: T234 onwards2195 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)2196 * * Initiators: CCPLEX2197 * * Targets: BPMP2198 * * Request Payload: @ref mrq_bwmgr_request2199 * * Response Payload: @ref mrq_bwmgr_response2200 *2201 * @addtogroup BWMGR2202 *2203 * @{2204 */2205 2206enum mrq_bwmgr_cmd {2207	/**2208	 * @brief Check whether the BPMP driver supports the specified2209	 * request type2210	 *2211	 * mrq_response::err is 0 if the specified request is2212	 * supported and -#BPMP_ENODEV otherwise.2213	 */2214	CMD_BWMGR_QUERY_ABI = 0,2215 2216	/**2217	 * @brief Determine dram rate to satisfy iso/niso bw requests2218	 *2219	 * mrq_response::err is2220	 * *  0: calc_rate succeeded.2221	 * *  -#BPMP_EINVAL: Invalid request parameters.2222	 * *  -#BPMP_ENOTSUP: Requested bw is not available.2223	 */2224	CMD_BWMGR_CALC_RATE = 12225};2226 2227/*2228 * request data for request type CMD_BWMGR_QUERY_ABI2229 *2230 * type: Request type for which to check existence.2231 */2232struct cmd_bwmgr_query_abi_request {2233	uint32_t type;2234} BPMP_ABI_PACKED;2235 2236/**2237 * @brief Used by @ref cmd_bwmgr_calc_rate_request2238 */2239struct iso_req {2240	/* @brief bwmgr client ID @ref bpmp_bwmgr_ids */2241	uint32_t id;2242	/* @brief bw in kBps requested by client */2243	uint32_t iso_bw;2244} BPMP_ABI_PACKED;2245 2246#define MAX_ISO_CLIENTS		13U2247/*2248 * request data for request type CMD_BWMGR_CALC_RATE2249 */2250struct cmd_bwmgr_calc_rate_request {2251	/* @brief total bw in kBps requested by all niso clients */2252	uint32_t sum_niso_bw;2253	/* @brief The number of iso clients */2254	uint32_t num_iso_clients;2255	/* @brief iso_req <id, iso_bw> information */2256	struct iso_req isobw_reqs[MAX_ISO_CLIENTS];2257} BPMP_ABI_PACKED;2258 2259/*2260 * response data for request type CMD_BWMGR_CALC_RATE2261 *2262 * iso_rate_min: min dram data clk rate in kHz to satisfy all iso bw reqs2263 * total_rate_min: min dram data clk rate in kHz to satisfy all bw reqs2264 */2265struct cmd_bwmgr_calc_rate_response {2266	uint32_t iso_rate_min;2267	uint32_t total_rate_min;2268} BPMP_ABI_PACKED;2269 2270/*2271 * @brief Request with #MRQ_BWMGR2272 *2273 *2274 * |sub-command                 |payload                       |2275 * |----------------------------|------------------------------|2276 * |CMD_BWMGR_QUERY_ABI         | cmd_bwmgr_query_abi_request  |2277 * |CMD_BWMGR_CALC_RATE         | cmd_bwmgr_calc_rate_request  |2278 *2279 */2280struct mrq_bwmgr_request {2281	uint32_t cmd;2282	union {2283		struct cmd_bwmgr_query_abi_request query_abi;2284		struct cmd_bwmgr_calc_rate_request bwmgr_rate_req;2285	} BPMP_UNION_ANON;2286} BPMP_ABI_PACKED;2287 2288/*2289 * @brief Response to MRQ_BWMGR2290 *2291 * |sub-command                 |payload                       |2292 * |----------------------------|------------------------------|2293 * |CMD_BWMGR_CALC_RATE         | cmd_bwmgr_calc_rate_response |2294 */2295struct mrq_bwmgr_response {2296	union {2297		struct cmd_bwmgr_calc_rate_response bwmgr_rate_resp;2298	} BPMP_UNION_ANON;2299} BPMP_ABI_PACKED;2300 2301/** @} BWMGR */2302/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */2303 2304/**2305 * @ingroup MRQ_Codes2306 * @def MRQ_BWMGR_INT2307 * @brief bpmp-integrated bwmgr requests2308 *2309 * * Platforms: T234 onwards2310 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)2311 * * Initiators: CCPLEX2312 * * Targets: BPMP2313 * * Request Payload: @ref mrq_bwmgr_int_request2314 * * Response Payload: @ref mrq_bwmgr_int_response2315 *2316 * @addtogroup BWMGR_INT2317 * @{2318 */2319 2320enum mrq_bwmgr_int_cmd {2321	/**2322	 * @brief Check whether the BPMP-FW supports the specified2323	 * request type2324	 *2325	 * mrq_response::err is 0 if the specified request is2326	 * supported and -#BPMP_ENODEV otherwise.2327	 */2328	CMD_BWMGR_INT_QUERY_ABI = 1,2329 2330	/**2331	 * @brief Determine and set dram rate to satisfy iso/niso bw request2332	 *2333	 * mrq_response::err is2334	 * *  0: request succeeded.2335	 * *  -#BPMP_EINVAL: Invalid request parameters.2336	 *          set_frequency in @ref cmd_bwmgr_int_calc_and_set_response2337	 *          will not be set.2338	 * *  -#BPMP_ENOTSUP: Requested bw is not available.2339	 *          set_frequency in @ref cmd_bwmgr_int_calc_and_set_response2340	 *          will be current dram-clk rate.2341	 */2342	CMD_BWMGR_INT_CALC_AND_SET = 2,2343 2344	/**2345	 * @brief Set a max DRAM frequency for the bandwidth-manager2346	 *2347	 * mrq_response::err is2348	 * *  0: request succeeded.2349	 * *  -#BPMP_ENOTSUP: Requested cap frequency is not possible.2350	 */2351	CMD_BWMGR_INT_CAP_SET = 32352};2353 2354/*2355 * request structure for request type CMD_BWMGR_QUERY_ABI2356 *2357 * type: Request type for which to check existence.2358 */2359struct cmd_bwmgr_int_query_abi_request {2360	/* @brief request type determined by @ref mrq_bwmgr_int_cmd */2361	uint32_t type;2362} BPMP_ABI_PACKED;2363 2364/**2365 * @defgroup bwmgr_int_unit_type BWMGR_INT floor unit-types2366 * @addtogroup bwmgr_int_unit_type2367 * @{2368 */2369/** @brief kilobytes per second unit-type */2370#define BWMGR_INT_UNIT_KBPS  0U2371/** @brief kilohertz unit-type */2372#define BWMGR_INT_UNIT_KHZ   1U2373 2374/** @} bwmgr_int_unit_type */2375 2376/*2377 * request data for request type CMD_BWMGR_INT_CALC_AND_SET2378 */2379struct cmd_bwmgr_int_calc_and_set_request {2380	/* @brief bwmgr client ID @ref bpmp_bwmgr_ids */2381	uint32_t client_id;2382	/* @brief average niso bw usage in kBps requested by client. */2383	uint32_t niso_bw;2384	/*2385	 * @brief average iso bw usage in kBps requested by client.2386	 *  Value is ignored if client is niso. Determined by client_id.2387	 */2388	uint32_t iso_bw;2389	/*2390	 * @brief memory clock floor requested by client.2391	 *  Unit determined by floor_unit.2392	 */2393	uint32_t mc_floor;2394	/*2395	 * @brief toggle to determine the unit-type of floor value.2396	 *  See @ref bwmgr_int_unit_type definitions for unit-type mappings.2397	 */2398	uint8_t floor_unit;2399} BPMP_ABI_PACKED;2400 2401struct cmd_bwmgr_int_cap_set_request {2402	/* @brief requested cap frequency in Hz. */2403	uint64_t rate;2404} BPMP_ABI_PACKED;2405 2406/*2407 * response data for request type CMD_BWMGR_CALC_AND_SET2408 */2409struct cmd_bwmgr_int_calc_and_set_response {2410	/* @brief current set memory clock frequency in Hz */2411	uint64_t rate;2412} BPMP_ABI_PACKED;2413 2414/*2415 * @brief Request with #MRQ_BWMGR_INT2416 *2417 *2418 * |sub-command                 |payload                            |2419 * |----------------------------|-----------------------------------|2420 * |CMD_BWMGR_INT_QUERY_ABI     | cmd_bwmgr_int_query_abi_request   |2421 * |CMD_BWMGR_INT_CALC_AND_SET  | cmd_bwmgr_int_calc_and_set_request|2422 * |CMD_BWMGR_INT_CAP_SET       | cmd_bwmgr_int_cap_set_request     |2423 *2424 */2425struct mrq_bwmgr_int_request {2426	uint32_t cmd;2427	union {2428		struct cmd_bwmgr_int_query_abi_request query_abi;2429		struct cmd_bwmgr_int_calc_and_set_request bwmgr_calc_set_req;2430		struct cmd_bwmgr_int_cap_set_request bwmgr_cap_set_req;2431	} BPMP_UNION_ANON;2432} BPMP_ABI_PACKED;2433 2434/*2435 * @brief Response to MRQ_BWMGR_INT2436 *2437 * |sub-command                 |payload                                |2438 * |----------------------------|---------------------------------------|2439 * |CMD_BWMGR_INT_CALC_AND_SET  | cmd_bwmgr_int_calc_and_set_response   |2440 */2441struct mrq_bwmgr_int_response {2442	union {2443		struct cmd_bwmgr_int_calc_and_set_response bwmgr_calc_set_resp;2444	} BPMP_UNION_ANON;2445} BPMP_ABI_PACKED;2446 2447/** @} BWMGR_INT */2448/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */2449 2450/**2451 * @ingroup MRQ_Codes2452 * @def MRQ_ISO_CLIENT2453 * @brief ISO client requests2454 *2455 * * Platforms: T234 onwards2456 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)2457 * * Initiators: CCPLEX2458 * * Targets: BPMP2459 * * Request Payload: @ref mrq_iso_client_request2460 * * Response Payload: @ref mrq_iso_client_response2461 *2462 * @addtogroup ISO_CLIENT2463 * @{2464 */2465 2466enum mrq_iso_client_cmd {2467	/**2468	 * @brief Check whether the BPMP driver supports the specified2469	 * request type2470	 *2471	 * mrq_response::err is 0 if the specified request is2472	 * supported and -#BPMP_ENODEV otherwise.2473	 */2474	CMD_ISO_CLIENT_QUERY_ABI = 0,2475 2476	/*2477	 * @brief check for legal LA for the iso client. Without programming2478	 * LA MC registers, calculate and ensure that legal LA is possible for2479	 * iso bw requested by the ISO client.2480	 *2481	 * mrq_response::err is2482	 * *  0: check la succeeded.2483	 * *  -#BPMP_EINVAL: Invalid request parameters.2484	 * *  -#BPMP_EFAULT: Legal LA is not possible for client requested iso_bw2485	 */2486	CMD_ISO_CLIENT_CALCULATE_LA = 1,2487 2488	/*2489	 * @brief set LA for the iso client. Calculate and program the LA/PTSA2490	 * MC registers corresponding to the client making bw request2491	 *2492	 * mrq_response::err is2493	 * *  0: set la succeeded.2494	 * *  -#BPMP_EINVAL: Invalid request parameters.2495	 * *  -#BPMP_EFAULT: Failed to calculate or program MC registers.2496	 */2497	CMD_ISO_CLIENT_SET_LA = 2,2498 2499	/*2500	 * @brief Get max possible bw for iso client2501	 *2502	 * mrq_response::err is2503	 * *  0: get_max_bw succeeded.2504	 * *  -#BPMP_EINVAL: Invalid request parameters.2505	 */2506	CMD_ISO_CLIENT_GET_MAX_BW = 32507};2508 2509/*2510 * request data for request type CMD_ISO_CLIENT_QUERY_ABI2511 *2512 * type: Request type for which to check existence.2513 */2514struct cmd_iso_client_query_abi_request {2515	uint32_t type;2516} BPMP_ABI_PACKED;2517 2518/*2519 * request data for request type CMD_ISO_CLIENT_CALCULATE_LA2520 *2521 * id: client ID in @ref bpmp_bwmgr_ids2522 * bw: bw requested in kBps by client ID.2523 * init_bw_floor: initial dram_bw_floor in kBps passed by client ID.2524 * ISO client will perform mempool allocation and DVFS buffering based2525 * on this dram_bw_floor.2526 */2527struct cmd_iso_client_calculate_la_request {2528	uint32_t id;2529	uint32_t bw;2530	uint32_t init_bw_floor;2531} BPMP_ABI_PACKED;2532 2533/*2534 * request data for request type CMD_ISO_CLIENT_SET_LA2535 *2536 * id: client ID in @ref bpmp_bwmgr_ids2537 * bw: bw requested in kBps by client ID.2538 * final_bw_floor: final dram_bw_floor in kBps.2539 * Sometimes the initial dram_bw_floor passed by ISO client may need to be2540 * updated by considering higher dram freq's. This is the final dram_bw_floor2541 * used to calculate and program MC registers.2542 */2543struct cmd_iso_client_set_la_request {2544	uint32_t id;2545	uint32_t bw;2546	uint32_t final_bw_floor;2547} BPMP_ABI_PACKED;2548 2549/*2550 * request data for request type CMD_ISO_CLIENT_GET_MAX_BW2551 *2552 * id: client ID in @ref bpmp_bwmgr_ids2553 */2554struct cmd_iso_client_get_max_bw_request {2555	uint32_t id;2556} BPMP_ABI_PACKED;2557 2558/*2559 * response data for request type CMD_ISO_CLIENT_CALCULATE_LA2560 *2561 * la_rate_floor: minimum dram_rate_floor in kHz at which a legal la is possible2562 * iso_client_only_rate: Minimum dram freq in kHz required to satisfy this clients2563 * iso bw request, assuming all other iso clients are inactive2564 */2565struct cmd_iso_client_calculate_la_response {2566	uint32_t la_rate_floor;2567	uint32_t iso_client_only_rate;2568} BPMP_ABI_PACKED;2569 2570/**2571 * @brief Used by @ref cmd_iso_client_get_max_bw_response2572 */2573struct iso_max_bw {2574	/* @brief dram frequency in kHz */2575	uint32_t freq;2576	/* @brief max possible iso-bw in kBps */2577	uint32_t iso_bw;2578} BPMP_ABI_PACKED;2579 2580#define ISO_MAX_BW_MAX_SIZE	14U2581/*2582 * response data for request type CMD_ISO_CLIENT_GET_MAX_BW2583 */2584struct cmd_iso_client_get_max_bw_response {2585	/* @brief The number valid entries in iso_max_bw pairs */2586	uint32_t num_pairs;2587	/* @brief max ISOBW <dram freq, max bw> information */2588	struct iso_max_bw pairs[ISO_MAX_BW_MAX_SIZE];2589} BPMP_ABI_PACKED;2590 2591/**2592 * @brief Request with #MRQ_ISO_CLIENT2593 *2594 * Used by the sender of an #MRQ_ISO_CLIENT message.2595 *2596 * |sub-command                          |payload                                 |2597 * |------------------------------------ |----------------------------------------|2598 * |CMD_ISO_CLIENT_QUERY_ABI		 |cmd_iso_client_query_abi_request        |2599 * |CMD_ISO_CLIENT_CALCULATE_LA		 |cmd_iso_client_calculate_la_request     |2600 * |CMD_ISO_CLIENT_SET_LA		 |cmd_iso_client_set_la_request           |2601 * |CMD_ISO_CLIENT_GET_MAX_BW		 |cmd_iso_client_get_max_bw_request       |2602 *2603 */2604 2605struct mrq_iso_client_request {2606	/* Type of request. Values listed in enum mrq_iso_client_cmd */2607	uint32_t cmd;2608	union {2609		struct cmd_iso_client_query_abi_request query_abi;2610		struct cmd_iso_client_calculate_la_request calculate_la_req;2611		struct cmd_iso_client_set_la_request set_la_req;2612		struct cmd_iso_client_get_max_bw_request max_isobw_req;2613	} BPMP_UNION_ANON;2614} BPMP_ABI_PACKED;2615 2616/**2617 * @brief Response to MRQ_ISO_CLIENT2618 *2619 * Each sub-command supported by @ref mrq_iso_client_request may return2620 * sub-command-specific data. Some do and some do not as indicated in2621 * the following table2622 *2623 * |sub-command                  |payload                             |2624 * |---------------------------- |------------------------------------|2625 * |CMD_ISO_CLIENT_CALCULATE_LA  |cmd_iso_client_calculate_la_response|2626 * |CMD_ISO_CLIENT_SET_LA        |N/A                                 |2627 * |CMD_ISO_CLIENT_GET_MAX_BW    |cmd_iso_client_get_max_bw_response  |2628 *2629 */2630 2631struct mrq_iso_client_response {2632	union {2633		struct cmd_iso_client_calculate_la_response calculate_la_resp;2634		struct cmd_iso_client_get_max_bw_response max_isobw_resp;2635	} BPMP_UNION_ANON;2636} BPMP_ABI_PACKED;2637 2638/** @} ISO_CLIENT */2639/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */2640 2641/**2642 * @ingroup MRQ_Codes2643 * @def MRQ_CPU_NDIV_LIMITS2644 * @brief CPU freq. limits in ndiv2645 *2646 * * Platforms: T194 onwards2647 * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)2648 * * Initiators: CCPLEX2649 * * Targets: BPMP2650 * * Request Payload: @ref mrq_cpu_ndiv_limits_request2651 * * Response Payload: @ref mrq_cpu_ndiv_limits_response2652 * @addtogroup CPU2653 * @{2654 */2655 2656/**2657 * @brief Request for ndiv limits of a cluster2658 */2659struct mrq_cpu_ndiv_limits_request {2660	/** @brief Enum cluster_id */2661	uint32_t cluster_id;2662} BPMP_ABI_PACKED;2663 2664/**2665 * @brief Response to #MRQ_CPU_NDIV_LIMITS2666 */2667struct mrq_cpu_ndiv_limits_response {2668	/** @brief Reference frequency in Hz */2669	uint32_t ref_clk_hz;2670	/** @brief Post divider value */2671	uint16_t pdiv;2672	/** @brief Input divider value */2673	uint16_t mdiv;2674	/** @brief FMAX expressed with max NDIV value */2675	uint16_t ndiv_max;2676	/** @brief Minimum allowed NDIV value */2677	uint16_t ndiv_min;2678} BPMP_ABI_PACKED;2679 2680/** @} CPU */2681/** @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500) */2682 2683/**2684 * @ingroup MRQ_Codes2685 * @def MRQ_CPU_AUTO_CC32686 * @brief Query CPU cluster auto-CC3 configuration2687 *2688 * * Platforms: T1942689 * @cond bpmp_t1942690 * * Initiators: CCPLEX2691 * * Targets: BPMP2692 * * Request Payload: @ref mrq_cpu_auto_cc3_request2693 * * Response Payload: @ref mrq_cpu_auto_cc3_response2694 * @addtogroup CC32695 *2696 * Queries from BPMP auto-CC3 configuration (allowed/not allowed) for a2697 * specified cluster. CCPLEX s/w uses this information to override its own2698 * device tree auto-CC3 settings, so that BPMP device tree is a single source of2699 * auto-CC3 platform configuration.2700 *2701 * @{2702 */2703 2704/**2705 * @brief Request for auto-CC3 configuration of a cluster2706 */2707struct mrq_cpu_auto_cc3_request {2708	/** @brief Enum cluster_id (logical cluster id, known to CCPLEX s/w) */2709	uint32_t cluster_id;2710} BPMP_ABI_PACKED;2711 2712/**2713 * @brief Response to #MRQ_CPU_AUTO_CC32714 */2715struct mrq_cpu_auto_cc3_response {2716	/**2717	 * @brief auto-CC3 configuration2718	 *2719	 * - bits[31..10] reserved.2720	 * - bits[9..1] cc3 ndiv2721	 * - bit [0] if "1" auto-CC3 is allowed, if "0" auto-CC3 is not allowed2722	 */2723	uint32_t auto_cc3_config;2724} BPMP_ABI_PACKED;2725 2726/** @} CC3 */2727/** @endcond bpmp_t194 */2728 2729/**2730 * @ingroup MRQ_Codes2731 * @def MRQ_RINGBUF_CONSOLE2732 * @brief A ring buffer debug console for BPMP2733 * @addtogroup RingbufConsole2734 *2735 * The ring buffer debug console aims to be a substitute for the UART debug2736 * console. The debug console is implemented with two ring buffers in the2737 * BPMP-FW, the RX (receive) and TX (transmit) buffers. Characters can be read2738 * and written to the buffers by the host via the MRQ interface.2739 *2740 * @{2741 */2742 2743/**2744 * @brief Maximum number of bytes transferred in a single write command to the2745 * BPMP2746 *2747 * This is determined by the number of free bytes in the message struct,2748 * rounded down to a multiple of four.2749 */2750#define MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN 1122751 2752/**2753 * @brief Maximum number of bytes transferred in a single read command to the2754 * BPMP2755 *2756 * This is determined by the number of free bytes in the message struct,2757 * rounded down to a multiple of four.2758 */2759#define MRQ_RINGBUF_CONSOLE_MAX_READ_LEN 1162760 2761enum mrq_ringbuf_console_host_to_bpmp_cmd {2762	/**2763	 * @brief Check whether the BPMP driver supports the specified request2764	 * type2765	 *2766	 * mrq_response::err is 0 if the specified request is supported and2767	 * -#BPMP_ENODEV otherwise2768	 */2769	CMD_RINGBUF_CONSOLE_QUERY_ABI = 0,2770	/**2771	 * @brief Perform a read operation on the BPMP TX buffer2772	 *2773	 * mrq_response::err is 02774	 */2775	CMD_RINGBUF_CONSOLE_READ = 1,2776	/**2777	 * @brief Perform a write operation on the BPMP RX buffer2778	 *2779	 * mrq_response::err is 0 if the operation was successful and2780	 * -#BPMP_ENODEV otherwise2781	 */2782	CMD_RINGBUF_CONSOLE_WRITE = 2,2783	/**2784	 * @brief Get the length of the buffer and the physical addresses of2785	 * the buffer data and the head and tail counters2786	 *2787	 * mrq_response::err is 0 if the operation was successful and2788	 * -#BPMP_ENODEV otherwise2789	 */2790	CMD_RINGBUF_CONSOLE_GET_FIFO = 3,2791};2792 2793/**2794 * @ingroup RingbufConsole2795 * @brief Host->BPMP request data for request type2796 * #CMD_RINGBUF_CONSOLE_QUERY_ABI2797 */2798struct cmd_ringbuf_console_query_abi_req {2799	/** @brief Command identifier to be queried */2800	uint32_t cmd;2801} BPMP_ABI_PACKED;2802 2803/** @private */2804struct cmd_ringbuf_console_query_abi_resp {2805	BPMP_ABI_EMPTY2806} BPMP_ABI_PACKED;2807 2808/**2809 * @ingroup RingbufConsole2810 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_READ2811 */2812struct cmd_ringbuf_console_read_req {2813	/**2814	 * @brief Number of bytes requested to be read from the BPMP TX buffer2815	 */2816	uint8_t len;2817} BPMP_ABI_PACKED;2818 2819/**2820 * @ingroup RingbufConsole2821 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_READ2822 */2823struct cmd_ringbuf_console_read_resp {2824	/** @brief The actual data read from the BPMP TX buffer */2825	uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_READ_LEN];2826	/** @brief Number of bytes in cmd_ringbuf_console_read_resp::data */2827	uint8_t len;2828} BPMP_ABI_PACKED;2829 2830/**2831 * @ingroup RingbufConsole2832 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_WRITE2833 */2834struct cmd_ringbuf_console_write_req {2835	/** @brief The actual data to be written to the BPMP RX buffer */2836	uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN];2837	/** @brief Number of bytes in cmd_ringbuf_console_write_req::data */2838	uint8_t len;2839} BPMP_ABI_PACKED;2840 2841/**2842 * @ingroup RingbufConsole2843 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_WRITE2844 */2845struct cmd_ringbuf_console_write_resp {2846	/** @brief Number of bytes of available space in the BPMP RX buffer */2847	uint32_t space_avail;2848	/** @brief Number of bytes that were written to the BPMP RX buffer */2849	uint8_t len;2850} BPMP_ABI_PACKED;2851 2852/** @private */2853struct cmd_ringbuf_console_get_fifo_req {2854	BPMP_ABI_EMPTY2855} BPMP_ABI_PACKED;2856 2857/**2858 * @ingroup RingbufConsole2859 * @brief BPMP->Host reply data for request type #CMD_RINGBUF_CONSOLE_GET_FIFO2860 */2861struct cmd_ringbuf_console_get_fifo_resp {2862	/** @brief Physical address of the BPMP TX buffer */2863	uint64_t bpmp_tx_buf_addr;2864	/** @brief Physical address of the BPMP TX buffer head counter */2865	uint64_t bpmp_tx_head_addr;2866	/** @brief Physical address of the BPMP TX buffer tail counter */2867	uint64_t bpmp_tx_tail_addr;2868	/** @brief Length of the BPMP TX buffer */2869	uint32_t bpmp_tx_buf_len;2870} BPMP_ABI_PACKED;2871 2872/**2873 * @ingroup RingbufConsole2874 * @brief Host->BPMP request data.2875 *2876 * Reply type is union #mrq_ringbuf_console_bpmp_to_host_response .2877 */2878struct mrq_ringbuf_console_host_to_bpmp_request {2879	/**2880	 * @brief Type of request. Values listed in enum2881	 * #mrq_ringbuf_console_host_to_bpmp_cmd.2882	 */2883	uint32_t type;2884	/** @brief  request type specific parameters. */2885	union {2886		struct cmd_ringbuf_console_query_abi_req query_abi;2887		struct cmd_ringbuf_console_read_req read;2888		struct cmd_ringbuf_console_write_req write;2889		struct cmd_ringbuf_console_get_fifo_req get_fifo;2890	} BPMP_UNION_ANON;2891} BPMP_ABI_PACKED;2892 2893/**2894 * @ingroup RingbufConsole2895 * @brief Host->BPMP reply data2896 *2897 * In response to struct #mrq_ringbuf_console_host_to_bpmp_request.2898 */2899union mrq_ringbuf_console_bpmp_to_host_response {2900	struct cmd_ringbuf_console_query_abi_resp query_abi;2901	struct cmd_ringbuf_console_read_resp read;2902	struct cmd_ringbuf_console_write_resp write;2903	struct cmd_ringbuf_console_get_fifo_resp get_fifo;2904} BPMP_ABI_PACKED;2905 2906/** @} RingbufConsole */2907 2908/**2909 * @ingroup MRQ_Codes2910 * @def MRQ_STRAP2911 * @brief Set a strap value controlled by BPMP2912 *2913 * * Platforms: T194 onwards2914 * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)2915 * * Initiators: CCPLEX2916 * * Targets: BPMP2917 * * Request Payload: @ref mrq_strap_request2918 * * Response Payload: N/A2919 * @addtogroup Strap2920 *2921 * A strap is an input that is sampled by a hardware unit during the2922 * unit's startup process. The sampled value of a strap affects the2923 * behavior of the unit until the unit is restarted. Many hardware2924 * units sample their straps at the instant that their resets are2925 * deasserted.2926 *2927 * BPMP owns registers which act as straps to various units. It2928 * exposes limited control of those straps via #MRQ_STRAP.2929 *2930 * @{2931 */2932enum mrq_strap_cmd {2933	/** @private */2934	STRAP_RESERVED = 0,2935	/** @brief Set a strap value */2936	STRAP_SET = 12937};2938 2939/**2940 * @brief Request with #MRQ_STRAP2941 */2942struct mrq_strap_request {2943	/** @brief @ref mrq_strap_cmd */2944	uint32_t cmd;2945	/** @brief Strap ID from @ref Strap_Identifiers */2946	uint32_t id;2947	/** @brief Desired value for strap (if cmd is #STRAP_SET) */2948	uint32_t value;2949} BPMP_ABI_PACKED;2950 2951/** @} Strap */2952/** @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500) */2953 2954/**2955 * @ingroup MRQ_Codes2956 * @def MRQ_UPHY2957 * @brief Perform a UPHY operation2958 *2959 * * Platforms: T194 onwards2960 * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)2961 * * Initiators: CCPLEX2962 * * Targets: BPMP2963 * * Request Payload: @ref mrq_uphy_request2964 * * Response Payload: @ref mrq_uphy_response2965 *2966 * @addtogroup UPHY2967 * @{2968 */2969enum {2970	CMD_UPHY_PCIE_LANE_MARGIN_CONTROL = 1,2971	CMD_UPHY_PCIE_LANE_MARGIN_STATUS = 2,2972	CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT = 3,2973	CMD_UPHY_PCIE_CONTROLLER_STATE = 4,2974	CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF = 5,2975	CMD_UPHY_DISPLAY_PORT_INIT = 6,2976	CMD_UPHY_DISPLAY_PORT_OFF = 7,2977	CMD_UPHY_XUSB_DYN_LANES_RESTORE = 8,2978	CMD_UPHY_MAX,2979};2980 2981struct cmd_uphy_margin_control_request {2982	/** @brief Enable margin */2983	int32_t en;2984	/** @brief Clear the number of error and sections */2985	int32_t clr;2986	/** @brief Set x offset (1's complement) for left/right margin type (y should be 0) */2987	uint32_t x;2988	/** @brief Set y offset (1's complement) for left/right margin type (x should be 0) */2989	uint32_t y;2990	/** @brief Set number of bit blocks for each margin section */2991	uint32_t nblks;2992} BPMP_ABI_PACKED;2993 2994struct cmd_uphy_margin_status_response {2995	/** @brief Number of errors observed */2996	uint32_t status;2997} BPMP_ABI_PACKED;2998 2999struct cmd_uphy_ep_controller_pll_init_request {3000	/** @brief EP controller number, T194 valid: 0, 4, 5; T234 valid: 5, 6, 7, 10; T239 valid: 0 */3001	uint8_t ep_controller;3002} BPMP_ABI_PACKED;3003 3004struct cmd_uphy_pcie_controller_state_request {3005	/** @brief PCIE controller number, T194 valid: 0-4; T234 valid: 0-10; T239 valid: 0-3 */3006	uint8_t pcie_controller;3007	uint8_t enable;3008} BPMP_ABI_PACKED;3009 3010struct cmd_uphy_ep_controller_pll_off_request {3011	/** @brief EP controller number, T194 valid: 0, 4, 5; T234 valid: 5, 6, 7, 10; T239 valid: 0 */3012	uint8_t ep_controller;3013} BPMP_ABI_PACKED;3014 3015struct cmd_uphy_display_port_init_request {3016	/** @brief DisplayPort link rate, T239 valid: 1620, 2700, 5400, 8100, 2160, 2430, 3240, 4320, 6750 */3017	uint16_t link_rate;3018	/** @brief 1: lane 0; 2: lane 1; 3: lane 0 and 1 */3019	uint16_t lanes_bitmap;3020} BPMP_ABI_PACKED;3021 3022struct cmd_uphy_xusb_dyn_lanes_restore_request {3023	/** @brief 1: lane 0; 2: lane 1; 3: lane 0 and 1 */3024	uint16_t lanes_bitmap;3025} BPMP_ABI_PACKED;3026 3027/**3028 * @ingroup UPHY3029 * @brief Request with #MRQ_UPHY3030 *3031 * Used by the sender of an #MRQ_UPHY message to control UPHY.3032 * The uphy_request is split into several sub-commands. CMD_UPHY_PCIE_LANE_MARGIN_STATUS3033 * requires no additional data. Others have a sub-command specific payload. Below table3034 * shows sub-commands with their corresponding payload data.3035 *3036 * |sub-command                          |payload                                 |3037 * |------------------------------------ |----------------------------------------|3038 * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL    |uphy_set_margin_control                 |3039 * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS     |                                        |3040 * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT |cmd_uphy_ep_controller_pll_init_request |3041 * |CMD_UPHY_PCIE_CONTROLLER_STATE       |cmd_uphy_pcie_controller_state_request  |3042 * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF  |cmd_uphy_ep_controller_pll_off_request  |3043 * |CMD_UPHY_PCIE_DISPLAY_PORT_INIT      |cmd_uphy_display_port_init_request      |3044 * |CMD_UPHY_PCIE_DISPLAY_PORT_OFF       |                                        |3045 * |CMD_UPHY_XUSB_DYN_LANES_RESTORE      |cmd_uphy_xusb_dyn_lanes_restore_request |3046 *3047 */3048 3049struct mrq_uphy_request {3050	/** @brief Lane number. */3051	uint16_t lane;3052	/** @brief Sub-command id. */3053	uint16_t cmd;3054 3055	union {3056		struct cmd_uphy_margin_control_request uphy_set_margin_control;3057		struct cmd_uphy_ep_controller_pll_init_request ep_ctrlr_pll_init;3058		struct cmd_uphy_pcie_controller_state_request controller_state;3059		struct cmd_uphy_ep_controller_pll_off_request ep_ctrlr_pll_off;3060		struct cmd_uphy_display_port_init_request display_port_init;3061		struct cmd_uphy_xusb_dyn_lanes_restore_request xusb_dyn_lanes_restore;3062	} BPMP_UNION_ANON;3063} BPMP_ABI_PACKED;3064 3065/**3066 * @ingroup UPHY3067 * @brief Response to MRQ_UPHY3068 *3069 * Each sub-command supported by @ref mrq_uphy_request may return3070 * sub-command-specific data. Some do and some do not as indicated in3071 * the following table3072 *3073 * |sub-command                       |payload                 |3074 * |----------------------------      |------------------------|3075 * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL |                        |3076 * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS  |uphy_get_margin_status  |3077 *3078 */3079 3080struct mrq_uphy_response {3081	union {3082		struct cmd_uphy_margin_status_response uphy_get_margin_status;3083	} BPMP_UNION_ANON;3084} BPMP_ABI_PACKED;3085 3086/** @} UPHY */3087/** @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500) */3088 3089/**3090 * @ingroup MRQ_Codes3091 * @def MRQ_FMON3092 * @brief Perform a frequency monitor configuration operations3093 *3094 * * Platforms: T194 onwards3095 * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)3096 * * Initiators: CCPLEX3097 * * Targets: BPMP3098 * * Request Payload: @ref mrq_fmon_request3099 * * Response Payload: @ref mrq_fmon_response3100 * @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)3101 *3102 * @addtogroup FMON3103 * @{3104 * @cond (bpmp_t194 || bpmp_t234)3105 */3106enum {3107	/**3108	 * @brief Clamp FMON configuration to specified rate.3109	 *3110	 * The monitored clock must be running for clamp to succeed. If3111	 * clamped, FMON configuration is preserved when clock rate3112	 * and/or state is changed.3113	 *3114	 * mrq_response::err is 0 if the operation was successful, or @n3115	 * -#BPMP_EACCES: FMON access error @n3116	 * -#BPMP_EBADCMD if subcommand is not supported @n3117	 * -#BPMP_EBADSLT: clamp FMON on cluster with auto-CC3 enabled @n3118	 * -#BPMP_EBUSY: fmon is already clamped at different rate @n3119	 * -#BPMP_EFAULT: self-diagnostic error @n3120	 * -#BPMP_EINVAL: invalid FMON configuration @n3121	 * -#BPMP_EOPNOTSUPP: not in production mode @n3122	 * -#BPMP_ENODEV: invalid clk_id @n3123	 * -#BPMP_ENOENT: no calibration data, uninitialized @n3124	 * -#BPMP_ENOTSUP: avfs config not set @n3125	 * -#BPMP_ENOSYS: clamp FMON on cluster clock w/ no NAFLL @n3126	 * -#BPMP_ETIMEDOUT: operation timed out @n3127	 */3128	CMD_FMON_GEAR_CLAMP = 1,3129	/**3130	 * @brief Release clamped FMON configuration.3131	 *3132	 * Allow FMON configuration to follow monitored clock rate3133	 * and/or state changes.3134	 *3135	 * mrq_response::err is 0 if the operation was successful, or @n3136	 * -#BPMP_EBADCMD if subcommand is not supported @n3137	 * -#BPMP_ENODEV: invalid clk_id @n3138	 * -#BPMP_ENOENT: no calibration data, uninitialized @n3139	 * -#BPMP_ENOTSUP: avfs config not set @n3140	 * -#BPMP_EOPNOTSUPP: not in production mode @n3141	 */3142	CMD_FMON_GEAR_FREE = 2,3143	/**3144	 * @brief Return rate FMON is clamped at, or 0 if FMON is not3145	 *         clamped.3146	 *3147	 * Inherently racy, since clamp state can be changed3148	 * concurrently. Useful for testing.3149	 *3150	 * mrq_response::err is 0 if the operation was successful, or @n3151	 * -#BPMP_EBADCMD if subcommand is not supported @n3152	 * -#BPMP_ENODEV: invalid clk_id @n3153	 * -#BPMP_ENOENT: no calibration data, uninitialized @n3154	 * -#BPMP_ENOTSUP: avfs config not set @n3155	 * -#BPMP_EOPNOTSUPP: not in production mode @n3156	 */3157	CMD_FMON_GEAR_GET = 3,3158	/**3159	 * @brief Return current status of FMON faults detected by FMON3160	 *         h/w or s/w since last invocation of this command.3161	 *         Clears fault status.3162	 *3163	 * mrq_response::err is 0 if the operation was successful, or @n3164	 * -#BPMP_EBADCMD if subcommand is not supported @n3165	 * -#BPMP_EINVAL: invalid fault type @n3166	 * -#BPMP_ENODEV: invalid clk_id @n3167	 * -#BPMP_ENOENT: no calibration data, uninitialized @n3168	 * -#BPMP_ENOTSUP: avfs config not set @n3169	 * -#BPMP_EOPNOTSUPP: not in production mode @n3170	 */3171	CMD_FMON_FAULT_STS_GET = 4,3172};3173 3174/**3175 * @cond DEPRECATED3176 * Kept for backward compatibility3177 */3178#define CMD_FMON_NUM		43179 3180/** @endcond DEPRECATED */3181 3182/**3183 * @defgroup fmon_fault_type FMON fault type3184 * @addtogroup fmon_fault_type3185 * @{3186 */3187/** @brief All detected FMON faults (h/w or s/w) */3188#define FMON_FAULT_TYPE_ALL		0U3189/** @brief FMON faults detected by h/w */3190#define FMON_FAULT_TYPE_HW		1U3191/** @brief FMON faults detected by s/w */3192#define FMON_FAULT_TYPE_SW		2U3193 3194/** @} fmon_fault_type */3195 3196 3197struct cmd_fmon_gear_clamp_request {3198	int32_t unused;3199	int64_t rate;3200} BPMP_ABI_PACKED;3201 3202/** @private */3203struct cmd_fmon_gear_clamp_response {3204	BPMP_ABI_EMPTY3205} BPMP_ABI_PACKED;3206 3207/** @private */3208struct cmd_fmon_gear_free_request {3209	BPMP_ABI_EMPTY3210} BPMP_ABI_PACKED;3211 3212/** @private */3213struct cmd_fmon_gear_free_response {3214	BPMP_ABI_EMPTY3215} BPMP_ABI_PACKED;3216 3217/** @private */3218struct cmd_fmon_gear_get_request {3219	BPMP_ABI_EMPTY3220} BPMP_ABI_PACKED;3221 3222struct cmd_fmon_gear_get_response {3223	int64_t rate;3224} BPMP_ABI_PACKED;3225 3226struct cmd_fmon_fault_sts_get_request {3227	uint32_t fault_type;	/**< @ref fmon_fault_type */3228} BPMP_ABI_PACKED;3229 3230struct cmd_fmon_fault_sts_get_response {3231	uint32_t fault_sts;3232} BPMP_ABI_PACKED;3233 3234/**3235 * @ingroup FMON3236 * @brief Request with #MRQ_FMON3237 *3238 * Used by the sender of an #MRQ_FMON message to configure clock3239 * frequency monitors. The FMON request is split into several3240 * sub-commands. Some sub-commands require no additional data.3241 * Others have a sub-command specific payload3242 *3243 * |sub-command                 |payload                |3244 * |----------------------------|-----------------------|3245 * |CMD_FMON_GEAR_CLAMP         |fmon_gear_clamp        |3246 * |CMD_FMON_GEAR_FREE          |-                      |3247 * |CMD_FMON_GEAR_GET           |-                      |3248 * |CMD_FMON_FAULT_STS_GET      |fmon_fault_sts_get     |3249 *3250 */3251struct mrq_fmon_request {3252	/** @brief Sub-command and clock id concatenated to 32-bit word.3253	 * - bits[31..24] is the sub-cmd.3254	 * - bits[23..0] is monitored clock id used to select target3255	 *   FMON3256	 */3257	uint32_t cmd_and_id;3258 3259	union {3260		struct cmd_fmon_gear_clamp_request fmon_gear_clamp;3261		/** @private */3262		struct cmd_fmon_gear_free_request fmon_gear_free;3263		/** @private */3264		struct cmd_fmon_gear_get_request fmon_gear_get;3265		struct cmd_fmon_fault_sts_get_request fmon_fault_sts_get;3266	} BPMP_UNION_ANON;3267} BPMP_ABI_PACKED;3268 3269/**3270 * @ingroup FMON3271 * @brief Response to MRQ_FMON3272 *3273 * Each sub-command supported by @ref mrq_fmon_request may3274 * return sub-command-specific data as indicated below.3275 *3276 * |sub-command                 |payload                 |3277 * |----------------------------|------------------------|3278 * |CMD_FMON_GEAR_CLAMP         |-                       |3279 * |CMD_FMON_GEAR_FREE          |-                       |3280 * |CMD_FMON_GEAR_GET           |fmon_gear_get           |3281 * |CMD_FMON_FAULT_STS_GET      |fmon_fault_sts_get      |3282 *3283 */3284 3285struct mrq_fmon_response {3286	union {3287		/** @private */3288		struct cmd_fmon_gear_clamp_response fmon_gear_clamp;3289		/** @private */3290		struct cmd_fmon_gear_free_response fmon_gear_free;3291		struct cmd_fmon_gear_get_response fmon_gear_get;3292		struct cmd_fmon_fault_sts_get_response fmon_fault_sts_get;3293	} BPMP_UNION_ANON;3294} BPMP_ABI_PACKED;3295 3296/** @endcond (bpmp_t194 || bpmp_t234) */3297/** @} FMON */3298 3299/**3300 * @ingroup MRQ_Codes3301 * @def MRQ_EC3302 * @brief Provide status information on faults reported by Error3303 *        Collator (EC) to HSM.3304 *3305 * * Platforms: T1943306 * @cond bpmp_t1943307 * * Initiators: CCPLEX3308 * * Targets: BPMP3309 * * Request Payload: @ref mrq_ec_request3310 * * Response Payload: @ref mrq_ec_response3311 *3312 * @note This MRQ ABI is under construction, and subject to change3313 *3314 * @endcond bpmp_t1943315 * @addtogroup EC3316 * @{3317 * @cond bpmp_t1943318 */3319enum {3320	/**3321	 * @cond DEPRECATED3322	 * @brief Retrieve specified EC status.3323	 *3324	 * mrq_response::err is 0 if the operation was successful, or @n3325	 * -#BPMP_ENODEV if target EC is not owned by BPMP @n3326	 * -#BPMP_EACCES if target EC power domain is turned off @n3327	 * -#BPMP_EBADCMD if subcommand is not supported3328	 * @endcond DEPRECATED3329	 */3330	CMD_EC_STATUS_GET = 1,	/* deprecated */3331 3332	/**3333	 * @brief Retrieve specified EC extended status (includes error3334	 *        counter and user values).3335	 *3336	 * mrq_response::err is 0 if the operation was successful, or @n3337	 * -#BPMP_ENODEV if target EC is not owned by BPMP @n3338	 * -#BPMP_EACCES if target EC power domain is turned off @n3339	 * -#BPMP_EBADCMD if subcommand is not supported3340	 */3341	CMD_EC_STATUS_EX_GET = 2,3342	CMD_EC_NUM,3343};3344 3345/** @brief BPMP ECs error types */3346enum bpmp_ec_err_type {3347	/** @brief Parity error on internal data path3348	 *3349	 *  Error descriptor @ref ec_err_simple_desc.3350	 */3351	EC_ERR_TYPE_PARITY_INTERNAL		= 1,3352 3353	/** @brief ECC SEC error on internal data path3354	 *3355	 *  Error descriptor @ref ec_err_simple_desc.3356	 */3357	EC_ERR_TYPE_ECC_SEC_INTERNAL		= 2,3358 3359	/** @brief ECC DED error on internal data path3360	 *3361	 *  Error descriptor @ref ec_err_simple_desc.3362	 */3363	EC_ERR_TYPE_ECC_DED_INTERNAL		= 3,3364 3365	/** @brief Comparator error3366	 *3367	 *  Error descriptor @ref ec_err_simple_desc.3368	 */3369	EC_ERR_TYPE_COMPARATOR			= 4,3370 3371	/** @brief Register parity error3372	 *3373	 *  Error descriptor @ref ec_err_reg_parity_desc.3374	 */3375	EC_ERR_TYPE_REGISTER_PARITY		= 5,3376 3377	/** @brief Parity error from on-chip SRAM/FIFO3378	 *3379	 *  Error descriptor @ref ec_err_simple_desc.3380	 */3381	EC_ERR_TYPE_PARITY_SRAM			= 6,3382 3383	/** @brief Clock Monitor error3384	 *3385	 *  Error descriptor @ref ec_err_fmon_desc.3386	 */3387	EC_ERR_TYPE_CLOCK_MONITOR		= 9,3388 3389	/** @brief Voltage Monitor error3390	 *3391	 *  Error descriptor @ref ec_err_vmon_desc.3392	 */3393	EC_ERR_TYPE_VOLTAGE_MONITOR		= 10,3394 3395	/** @brief SW Correctable error3396	 *3397	 *  Error descriptor @ref ec_err_sw_error_desc.3398	 */3399	EC_ERR_TYPE_SW_CORRECTABLE		= 16,3400 3401	/** @brief SW Uncorrectable error3402	 *3403	 *  Error descriptor @ref ec_err_sw_error_desc.3404	 */3405	EC_ERR_TYPE_SW_UNCORRECTABLE		= 17,3406 3407	/** @brief Other HW Correctable error3408	 *3409	 *  Error descriptor @ref ec_err_simple_desc.3410	 */3411	EC_ERR_TYPE_OTHER_HW_CORRECTABLE	= 32,3412 3413	/** @brief Other HW Uncorrectable error3414	 *3415	 *  Error descriptor @ref ec_err_simple_desc.3416	 */3417	EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE	= 33,3418};3419 3420/** @brief Group of registers with parity error. */3421enum ec_registers_group {3422	/** @brief Functional registers group */3423	EC_ERR_GROUP_FUNC_REG		= 0U,3424	/** @brief SCR registers group */3425	EC_ERR_GROUP_SCR_REG		= 1U,3426};3427 3428/**3429 * @defgroup bpmp_ec_status_flags EC Status Flags3430 * @addtogroup bpmp_ec_status_flags3431 * @{3432 */3433/** @brief No EC error found flag */3434#define EC_STATUS_FLAG_NO_ERROR		0x0001U3435/** @brief Last EC error found flag */3436#define EC_STATUS_FLAG_LAST_ERROR	0x0002U3437/** @brief EC latent error flag */3438#define EC_STATUS_FLAG_LATENT_ERROR	0x0004U3439 3440/** @} bpmp_ec_status_flags */3441 3442/**3443 * @defgroup bpmp_ec_desc_flags EC Descriptor Flags3444 * @addtogroup bpmp_ec_desc_flags3445 * @{3446 */3447/** @brief EC descriptor error resolved flag */3448#define EC_DESC_FLAG_RESOLVED		0x0001U3449/** @brief EC descriptor failed to retrieve id flag */3450#define EC_DESC_FLAG_NO_ID		0x0002U3451 3452/** @} bpmp_ec_desc_flags */3453 3454/**3455 * |error type                       | fmon_clk_id values        |3456 * |---------------------------------|---------------------------|3457 * |@ref EC_ERR_TYPE_CLOCK_MONITOR   |@ref bpmp_clock_ids        |3458 */3459struct ec_err_fmon_desc {3460	/** @brief Bitmask of @ref bpmp_ec_desc_flags  */3461	uint16_t desc_flags;3462	/** @brief FMON monitored clock id */3463	uint16_t fmon_clk_id;3464	/**3465	 * @brief Bitmask of fault flags3466	 *3467	 * @ref bpmp_fmon_faults_flags3468	 */3469	uint32_t fmon_faults;3470	/** @brief FMON faults access error */3471	int32_t fmon_access_error;3472} BPMP_ABI_PACKED;3473 3474/**3475 * | error type                      | vmon_adc_id values        |3476 * |---------------------------------|---------------------------|3477 * |@ref EC_ERR_TYPE_VOLTAGE_MONITOR |@ref bpmp_adc_ids          |3478 */3479struct ec_err_vmon_desc {3480	/** @brief Bitmask of @ref bpmp_ec_desc_flags  */3481	uint16_t desc_flags;3482	/** @brief VMON rail adc id */3483	uint16_t vmon_adc_id;3484	/** @brief Bitmask of bpmp_vmon_faults_flags */3485	uint32_t vmon_faults;3486	/** @brief VMON faults access error */3487	int32_t vmon_access_error;3488} BPMP_ABI_PACKED;3489 3490/**3491 * |error type                       | reg_id values         |3492 * |---------------------------------|-----------------------|3493 * |@ref EC_ERR_TYPE_REGISTER_PARITY | bpmp_ec_registers_ids |3494 */3495struct ec_err_reg_parity_desc {3496	/** @brief Bitmask of @ref bpmp_ec_desc_flags  */3497	uint16_t desc_flags;3498	/** @brief Register id */3499	uint16_t reg_id;3500	/** @brief Register group @ref ec_registers_group */3501	uint16_t reg_group;3502} BPMP_ABI_PACKED;3503 3504/**3505 * |error type                        | err_source_id values |3506 * |--------------------------------- |----------------------|3507 * |@ref EC_ERR_TYPE_SW_CORRECTABLE   | bpmp_ec_ce_swd_ids   |3508 * |@ref EC_ERR_TYPE_SW_UNCORRECTABLE | bpmp_ec_ue_swd_ids   |3509 */3510struct ec_err_sw_error_desc {3511	/** @brief Bitmask of @ref bpmp_ec_desc_flags  */3512	uint16_t desc_flags;3513	/** @brief Error source id */3514	uint16_t err_source_id;3515	/** @brief Sw error data */3516	uint32_t sw_error_data;3517} BPMP_ABI_PACKED;3518 3519/**3520 * |error type                              | err_source_id values   |3521 * |----------------------------------------|------------------------|3522 * |@ref EC_ERR_TYPE_PARITY_INTERNAL        |  bpmp_ec_ipath_ids     |3523 * |@ref EC_ERR_TYPE_ECC_SEC_INTERNAL       |  bpmp_ec_ipath_ids     |3524 * |@ref EC_ERR_TYPE_ECC_DED_INTERNAL       |  bpmp_ec_ipath_ids     |3525 * |@ref EC_ERR_TYPE_COMPARATOR             |  bpmp_ec_comparator_ids|3526 * |@ref EC_ERR_TYPE_OTHER_HW_CORRECTABLE   |  bpmp_ec_misc_hwd_ids  |3527 * |@ref EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE |  bpmp_ec_misc_hwd_ids  |3528 * |@ref EC_ERR_TYPE_PARITY_SRAM            |  bpmp_clock_ids        |3529 */3530struct ec_err_simple_desc {3531	/** @brief Bitmask of @ref bpmp_ec_desc_flags  */3532	uint16_t desc_flags;3533	/** @brief Error source id. Id space depends on error type. */3534	uint16_t err_source_id;3535} BPMP_ABI_PACKED;3536 3537/** @brief Union of EC error descriptors */3538union ec_err_desc {3539	struct ec_err_fmon_desc fmon_desc;3540	struct ec_err_vmon_desc vmon_desc;3541	struct ec_err_reg_parity_desc reg_parity_desc;3542	struct ec_err_sw_error_desc sw_error_desc;3543	struct ec_err_simple_desc simple_desc;3544} BPMP_ABI_PACKED;3545 3546struct cmd_ec_status_get_request {3547	/** @brief HSM error line number that identifies target EC. */3548	uint32_t ec_hsm_id;3549} BPMP_ABI_PACKED;3550 3551/** EC status maximum number of descriptors */3552#define EC_ERR_STATUS_DESC_MAX_NUM	4U3553 3554/**3555 * @cond DEPRECATED3556 */3557struct cmd_ec_status_get_response {3558	/** @brief Target EC id (the same id received with request). */3559	uint32_t ec_hsm_id;3560	/**3561	 * @brief Bitmask of @ref bpmp_ec_status_flags3562	 *3563	 * If NO_ERROR flag is set, error_ fields should be ignored3564	 */3565	uint32_t ec_status_flags;3566	/** @brief Found EC error index. */3567	uint32_t error_idx;3568	/** @brief  Found EC error type @ref bpmp_ec_err_type. */3569	uint32_t error_type;3570	/** @brief  Number of returned EC error descriptors */3571	uint32_t error_desc_num;3572	/** @brief  EC error descriptors */3573	union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];3574} BPMP_ABI_PACKED;3575/** @endcond DEPRECATED */3576 3577struct cmd_ec_status_ex_get_response {3578	/** @brief Target EC id (the same id received with request). */3579	uint32_t ec_hsm_id;3580	/**3581	 * @brief Bitmask of @ref bpmp_ec_status_flags3582	 *3583	 * If NO_ERROR flag is set, error_ fields should be ignored3584	 */3585	uint32_t ec_status_flags;3586	/** @brief Found EC error index. */3587	uint32_t error_idx;3588	/** @brief  Found EC error type @ref bpmp_ec_err_type. */3589	uint32_t error_type;3590	/** @brief  Found EC mission error counter value */3591	uint32_t error_counter;3592	/** @brief  Found EC mission error user value */3593	uint32_t error_uval;3594	/** @brief  Reserved entry    */3595	uint32_t reserved;3596	/** @brief  Number of returned EC error descriptors */3597	uint32_t error_desc_num;3598	/** @brief  EC error descriptors */3599	union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];3600} BPMP_ABI_PACKED;3601 3602/**3603 * @ingroup EC3604 * @brief Request with #MRQ_EC3605 *3606 * Used by the sender of an #MRQ_EC message to access ECs owned3607 * by BPMP.3608 *3609 * @cond DEPRECATED3610 * |sub-command                 |payload                |3611 * |----------------------------|-----------------------|3612 * |@ref CMD_EC_STATUS_GET      |ec_status_get          |3613 * @endcond DEPRECATED3614 *3615 * |sub-command                 |payload                |3616 * |----------------------------|-----------------------|3617 * |@ref CMD_EC_STATUS_EX_GET   |ec_status_get          |3618 *3619 */3620 3621struct mrq_ec_request {3622	/** @brief Sub-command id. */3623	uint32_t cmd_id;3624 3625	union {3626		struct cmd_ec_status_get_request ec_status_get;3627	} BPMP_UNION_ANON;3628} BPMP_ABI_PACKED;3629 3630/**3631 * @ingroup EC3632 * @brief Response to MRQ_EC3633 *3634 * Each sub-command supported by @ref mrq_ec_request may return3635 * sub-command-specific data as indicated below.3636 *3637 * @cond DEPRECATED3638 * |sub-command                 |payload                 |3639 * |----------------------------|------------------------|3640 * |@ref CMD_EC_STATUS_GET      |ec_status_get           |3641 * @endcond DEPRECATED3642 *3643 * |sub-command                 |payload                 |3644 * |----------------------------|------------------------|3645 * |@ref CMD_EC_STATUS_EX_GET   |ec_status_ex_get        |3646 *3647 */3648 3649struct mrq_ec_response {3650	union {3651		/**3652		 * @cond DEPRECATED3653		 */3654		struct cmd_ec_status_get_response ec_status_get;3655		/** @endcond DEPRECATED */3656		struct cmd_ec_status_ex_get_response ec_status_ex_get;3657	} BPMP_UNION_ANON;3658} BPMP_ABI_PACKED;3659 3660/** @endcond bpmp_t194 */3661/** @} EC */3662 3663/**3664 * @ingroup MRQ_Codes3665 * @def MRQ_TELEMETRY3666 * @brief Get address of memory buffer refreshed with recently sampled3667 *        telemetry data3668 *3669 * * Platforms: TH500 onwards3670 * @cond bpmp_th5003671 * * Initiators: CCPLEX3672 * * Targets: BPMP3673 * * Request Payload: N/A3674 * * Response Payload: @ref mrq_telemetry_response3675 * @addtogroup Telemetry3676 * @{3677 */3678 3679/**3680 * @brief Response to #MRQ_TELEMETRY3681 *3682 * mrq_response::err is3683 * * 0: Telemetry data is available at returned address3684 * * -#BPMP_EACCES: MRQ master is not allowed to request buffer refresh3685 * * -#BPMP_ENAVAIL: Telemetry buffer cannot be refreshed via this MRQ channel3686 * * -#BPMP_ENOTSUP: Telemetry buffer is not supported by BPMP-FW3687 * * -#BPMP_ENODEV: Telemetry mrq is not supported by BPMP-FW3688 */3689struct mrq_telemetry_response {3690	/** @brief Physical address of telemetry data buffer */3691	uint64_t data_buf_addr;	/**< see @ref bpmp_telemetry_layout */3692} BPMP_ABI_PACKED;3693 3694/** @} Telemetry */3695/** @endcond bpmp_th500 */3696 3697/**3698 * @ingroup MRQ_Codes3699 * @def MRQ_PWR_LIMIT3700 * @brief Control power limits.3701 *3702 * * Platforms: TH500 onwards3703 * @cond bpmp_th5003704 * * Initiators: Any3705 * * Targets: BPMP3706 * * Request Payload: @ref mrq_pwr_limit_request3707 * * Response Payload: @ref mrq_pwr_limit_response3708 *3709 * @addtogroup Pwrlimit3710 * @{3711 */3712enum mrq_pwr_limit_cmd {3713	/**3714	 * @brief Check whether the BPMP-FW supports the specified3715	 * command3716	 *3717	 * mrq_response::err is 0 if the specified request is3718	 * supported and -#BPMP_ENODEV otherwise.3719	 */3720	CMD_PWR_LIMIT_QUERY_ABI = 0,3721 3722	/**3723	 * @brief Set power limit3724	 *3725	 * mrq_response:err is3726	 * * 0: Success3727	 * * -#BPMP_ENODEV: Pwr limit mrq is not supported by BPMP-FW3728	 * * -#BPMP_ENAVAIL: Invalid request parameters3729	 * * -#BPMP_EACCES: Request is not accepted3730	 */3731	CMD_PWR_LIMIT_SET = 1,3732 3733	/**3734	 * @brief Get power limit setting3735	 *3736	 * mrq_response:err is3737	 * * 0: Success3738	 * * -#BPMP_ENODEV: Pwr limit mrq is not supported by BPMP-FW3739	 * * -#BPMP_ENAVAIL: Invalid request parameters3740	 */3741	CMD_PWR_LIMIT_GET = 2,3742 3743	/**3744	 * @brief Get current power cap3745	 *3746	 * mrq_response:err is3747	 * * 0: Success3748	 * * -#BPMP_ENODEV: Pwr limit mrq is not supported by BPMP-FW3749	 * * -#BPMP_ENAVAIL: Invalid request parameters3750	 */3751	CMD_PWR_LIMIT_CURR_CAP = 3,3752};3753 3754/**3755 * @defgroup bpmp_pwr_limit_type PWR_LIMIT TYPEs3756 * @{3757 */3758/** @brief Limit value specifies traget cap */3759#define PWR_LIMIT_TYPE_TARGET_CAP		0U3760/** @brief Limit value specifies maximum possible target cap */3761#define PWR_LIMIT_TYPE_BOUND_MAX		1U3762/** @brief Limit value specifies minimum possible target cap */3763#define PWR_LIMIT_TYPE_BOUND_MIN		2U3764/** @brief Number of limit types supported by mrq interface */3765#define PWR_LIMIT_TYPE_NUM			3U3766 3767/** @} bpmp_pwr_limit_type */3768 3769/**3770 * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_QUERY_ABI3771 */3772struct cmd_pwr_limit_query_abi_request {3773	uint32_t cmd_code; /**< @ref mrq_pwr_limit_cmd */3774} BPMP_ABI_PACKED;3775 3776/**3777 * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_SET3778 *3779 * Set specified limit of specified type from specified source. The success of3780 * the request means that specified value is accepted as input to arbitration3781 * with other sources settings for the same limit of the same type. Zero limit3782 * is ignored by the arbitration (i.e., indicates "no limit set").3783 */3784struct cmd_pwr_limit_set_request {3785	uint32_t limit_id;   /**< @ref bpmp_pwr_limit_id */3786	uint32_t limit_src;  /**< @ref bpmp_pwr_limit_src */3787	uint32_t limit_type; /**< @ref bpmp_pwr_limit_type */3788	uint32_t limit_setting;3789} BPMP_ABI_PACKED;3790 3791/**3792 * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_GET3793 *3794 * Get previously set from specified source specified limit value of specified3795 * type.3796 */3797struct cmd_pwr_limit_get_request {3798	uint32_t limit_id;   /**< @ref bpmp_pwr_limit_id */3799	uint32_t limit_src;  /**< @ref bpmp_pwr_limit_src */3800	uint32_t limit_type; /**< @ref bpmp_pwr_limit_type */3801} BPMP_ABI_PACKED;3802 3803/**3804 * @brief Response data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_GET3805 */3806struct cmd_pwr_limit_get_response {3807	uint32_t limit_setting;3808} BPMP_ABI_PACKED;3809 3810/**3811 * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_CURR_CAP3812 *3813 * For specified limit get current power cap aggregated from all sources.3814 */3815struct cmd_pwr_limit_curr_cap_request {3816	uint32_t limit_id;   /**< @ref bpmp_pwr_limit_id */3817} BPMP_ABI_PACKED;3818 3819/**3820 * @brief Response data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_CURR_CAP3821 */3822struct cmd_pwr_limit_curr_cap_response {3823	uint32_t curr_cap;3824} BPMP_ABI_PACKED;3825 3826/**3827 * @brief Request with #MRQ_PWR_LIMIT3828 *3829 * |sub-command                 |payload                          |3830 * |----------------------------|---------------------------------|3831 * |CMD_PWR_LIMIT_QUERY_ABI     | cmd_pwr_limit_query_abi_request |3832 * |CMD_PWR_LIMIT_SET           | cmd_pwr_limit_set_request       |3833 * |CMD_PWR_LIMIT_GET           | cmd_pwr_limit_get_request       |3834 * |CMD_PWR_LIMIT_CURR_CAP      | cmd_pwr_limit_curr_cap_request  |3835 */3836struct mrq_pwr_limit_request {3837	uint32_t cmd;3838	union {3839		struct cmd_pwr_limit_query_abi_request pwr_limit_query_abi_req;3840		struct cmd_pwr_limit_set_request pwr_limit_set_req;3841		struct cmd_pwr_limit_get_request pwr_limit_get_req;3842		struct cmd_pwr_limit_curr_cap_request pwr_limit_curr_cap_req;3843	} BPMP_UNION_ANON;3844} BPMP_ABI_PACKED;3845 3846/**3847 * @brief Response to MRQ_PWR_LIMIT3848 *3849 * |sub-command                 |payload                          |3850 * |----------------------------|---------------------------------|3851 * |CMD_PWR_LIMIT_QUERY_ABI     | -                               |3852 * |CMD_PWR_LIMIT_SET           | -                               |3853 * |CMD_PWR_LIMIT_GET           | cmd_pwr_limit_get_response      |3854 * |CMD_PWR_LIMIT_CURR_CAP      | cmd_pwr_limit_curr_cap_response |3855 */3856struct mrq_pwr_limit_response {3857	union {3858		struct cmd_pwr_limit_get_response pwr_limit_get_rsp;3859		struct cmd_pwr_limit_curr_cap_response pwr_limit_curr_cap_rsp;3860	} BPMP_UNION_ANON;3861} BPMP_ABI_PACKED;3862 3863/** @} PwrLimit */3864/** @endcond bpmp_th500 */3865 3866 3867/**3868 * @ingroup MRQ_Codes3869 * @def MRQ_GEARS3870 * @brief Get thresholds for NDIV offset switching3871 *3872 * * Platforms: TH500 onwards3873 * @cond bpmp_th5003874 * * Initiators: CCPLEX3875 * * Targets: BPMP3876 * * Request Payload: N/A3877 * * Response Payload: @ref mrq_gears_response3878 * @addtogroup Gears3879 * @{3880 */3881 3882/**3883 * @brief Response to #MRQ_GEARS3884 *3885 * Used by the sender of an #MRQ_GEARS message to request thresholds3886 * for NDIV offset switching.3887 *3888 * The mrq_gears_response::ncpu array defines four thresholds in units3889 * of number of online CPUS to be used for choosing between five different3890 * NDIV offset settings for CCPLEX cluster NAFLLs3891 *3892 * 1. If number of online CPUs < ncpu[0] use offset03893 * 2. If number of online CPUs < ncpu[1] use offset13894 * 3. If number of online CPUs < ncpu[2] use offset23895 * 4. If number of online CPUs < ncpu[3] use offset33896 * 5. If number of online CPUs >= ncpu[3] disable offsetting3897 *3898 * For TH500 mrq_gears_response::ncpu array has four valid entries.3899 *3900 * mrq_response::err is3901 * * 0: gears defined and response data valid3902 * * -#BPMP_ENODEV: MRQ is not supported by BPMP-FW3903 * * -#BPMP_EACCES: Operation not permitted for the MRQ master3904 * * -#BPMP_ENAVAIL: NDIV offsetting is disabled3905 */3906struct mrq_gears_response {3907	/** @brief number of online CPUs for each gear */3908	uint32_t ncpu[16];3909} BPMP_ABI_PACKED;3910 3911/** @} Gears */3912/** @endcond bpmp_th500 */3913 3914/**3915 * @addtogroup Error_Codes3916 * Negative values for mrq_response::err generally indicate some3917 * error. The ABI defines the following error codes. Negating these3918 * defines is an exercise left to the user.3919 * @{3920 */3921 3922/** @brief Operation not permitted */3923#define BPMP_EPERM	13924/** @brief No such file or directory */3925#define BPMP_ENOENT	23926/** @brief No MRQ handler */3927#define BPMP_ENOHANDLER	33928/** @brief I/O error */3929#define BPMP_EIO	53930/** @brief Bad sub-MRQ command */3931#define BPMP_EBADCMD	63932/** @brief Resource temporarily unavailable */3933#define BPMP_EAGAIN	113934/** @brief Not enough memory */3935#define BPMP_ENOMEM	123936/** @brief Permission denied */3937#define BPMP_EACCES	133938/** @brief Bad address */3939#define BPMP_EFAULT	143940/** @brief Resource busy */3941#define BPMP_EBUSY	163942/** @brief No such device */3943#define BPMP_ENODEV	193944/** @brief Argument is a directory */3945#define BPMP_EISDIR	213946/** @brief Invalid argument */3947#define BPMP_EINVAL	223948/** @brief Timeout during operation */3949#define BPMP_ETIMEDOUT  233950/** @brief Out of range */3951#define BPMP_ERANGE	343952/** @brief Function not implemented */3953#define BPMP_ENOSYS	383954/** @brief Invalid slot */3955#define BPMP_EBADSLT	573956/** @brief Invalid message */3957#define BPMP_EBADMSG	773958/** @brief Operation not supported */3959#define BPMP_EOPNOTSUPP 953960/** @brief Targeted resource not available */3961#define BPMP_ENAVAIL	1193962/** @brief Not supported */3963#define BPMP_ENOTSUP	1343964/** @brief No such device or address */3965#define BPMP_ENXIO	1403966 3967/** @} Error_Codes */3968 3969#if defined(BPMP_ABI_CHECKS)3970#include "bpmp_abi_checks.h"3971#endif3972 3973#endif3974