linux/include/soc/tegra/bpmp-abi.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2014-2022, NVIDIA CORPORATION.  All rights reserved.
 */

#ifndef ABI_BPMP_ABI_H
#define ABI_BPMP_ABI_H

#if defined(LK) || defined(BPMP_ABI_HAVE_STDC)
#include <stddef.h>
#include <stdint.h>
#endif

#ifndef BPMP_ABI_PACKED
#ifdef __ABI_PACKED
#define BPMP_ABI_PACKED
#else
#define BPMP_ABI_PACKED
#endif
#endif

#ifdef NO_GCC_EXTENSIONS
#define BPMP_ABI_EMPTY
#define BPMP_ABI_EMPTY_ARRAY
#else
#define BPMP_ABI_EMPTY
#define BPMP_ABI_EMPTY_ARRAY
#endif

#ifndef BPMP_UNION_ANON
#ifdef __UNION_ANON
#define BPMP_UNION_ANON
#else
#define BPMP_UNION_ANON
#endif
#endif

/**
 * @file
 */

/**
 * @defgroup MRQ MRQ Messages
 * @brief Messages sent to/from BPMP via IPC
 * @{
 *   @defgroup MRQ_Format Message Format
 *   @defgroup MRQ_Codes Message Request (MRQ) Codes
 *   @defgroup MRQ_Payloads Message Payloads
 *   @defgroup Error_Codes Error Codes
 * @}
 */

/**
 * @addtogroup MRQ_Format
 * @{
 * The CPU requests the BPMP to perform a particular service by
 * sending it an IVC frame containing a single MRQ message. An MRQ
 * message consists of a @ref mrq_request followed by a payload whose
 * format depends on mrq_request::mrq.
 *
 * The BPMP processes the data and replies with an IVC frame (on the
 * same IVC channel) containing and MRQ response. An MRQ response
 * consists of a @ref mrq_response followed by a payload whose format
 * depends on the associated mrq_request::mrq.
 *
 * A well-defined subset of the MRQ messages that the CPU sends to the
 * BPMP can lead to BPMP eventually sending an MRQ message to the
 * CPU. For example, when the CPU uses an #MRQ_THERMAL message to set
 * a thermal trip point, the BPMP may eventually send a single
 * #MRQ_THERMAL message of its own to the CPU indicating that the trip
 * point has been crossed.
 * @}
 */

/**
 * @ingroup MRQ_Format
 * Request an answer from the peer.
 * This should be set in mrq_request::flags for all requests targetted
 * at BPMP. For requests originating in BPMP, this flag is optional except
 * for messages targeting MCE, for which the field must be set.
 * When this flag is not set, the remote peer must not send a response
 * back.
 */
#define BPMP_MAIL_DO_ACK

/**
 * @ingroup MRQ_Format
 * Ring the sender's doorbell when responding. This should be set unless
 * the sender wants to poll the underlying communications layer directly.
 *
 * An optional direction that can be specified in mrq_request::flags.
 */
#define BPMP_MAIL_RING_DB

/**
 * @ingroup MRQ_Format
 * CRC present
 */
#define BPMP_MAIL_CRC_PRESENT

/**
 * @ingroup MRQ_Format
 * @brief Header for an MRQ message
 *
 * Provides the MRQ number for the MRQ message: #mrq. The remainder of
 * the MRQ message is a payload (immediately following the
 * mrq_request) whose format depends on mrq.
 */
struct mrq_request {} BPMP_ABI_PACKED;

/**
 * @ingroup MRQ_Format
 * @brief Header for an MRQ response
 *
 *  Provides an error code for the associated MRQ message. The
 *  remainder of the MRQ response is a payload (immediately following
 *  the mrq_response) whose format depends on the associated
 *  mrq_request::mrq
 */
struct mrq_response {} BPMP_ABI_PACKED;

/**
 * @ingroup MRQ_Format
 * Minimum needed size for an IPC message buffer
 */
#define MSG_MIN_SZ
/**
 * @ingroup MRQ_Format
 *  Minimum size guaranteed for data in an IPC message buffer
 */
#define MSG_DATA_MIN_SZ

/**
 * @ingroup MRQ_Codes
 * @name Legal MRQ codes
 * These are the legal values for mrq_request::mrq
 * @{
 */

#define MRQ_PING
#define MRQ_QUERY_TAG
#define MRQ_THREADED_PING
#define MRQ_DEBUGFS
#define MRQ_RESET
#define MRQ_I2C
#define MRQ_CLK
#define MRQ_QUERY_ABI
#define MRQ_THERMAL
#define MRQ_CPU_VHINT
#define MRQ_ABI_RATCHET
#define MRQ_EMC_DVFS_LATENCY
#define MRQ_RINGBUF_CONSOLE
#define MRQ_PG
#define MRQ_CPU_NDIV_LIMITS
#define MRQ_STRAP
#define MRQ_UPHY
#define MRQ_CPU_AUTO_CC3
#define MRQ_QUERY_FW_TAG
#define MRQ_FMON
#define MRQ_EC
#define MRQ_DEBUG
#define MRQ_EMC_DVFS_EMCHUB
#define MRQ_BWMGR
#define MRQ_ISO_CLIENT
#define MRQ_EMC_DISP_RFL
#define MRQ_TELEMETRY
#define MRQ_PWR_LIMIT
#define MRQ_GEARS
#define MRQ_BWMGR_INT
#define MRQ_OC_STATUS

/** @cond DEPRECATED */
#define MRQ_RESERVED_2
#define MRQ_RESERVED_3
#define MRQ_RESERVED_4
#define MRQ_RESERVED_5
#define MRQ_RESERVED_6
#define MRQ_RESERVED_7
#define MRQ_RESERVED_8
#define MRQ_RESERVED_10
#define MRQ_RESERVED_11
#define MRQ_RESERVED_12
#define MRQ_RESERVED_13
#define MRQ_RESERVED_14
#define MRQ_RESERVED_15
#define MRQ_RESERVED_16
#define MRQ_RESERVED_17
#define MRQ_RESERVED_18
#define MRQ_RESERVED_24
#define MRQ_RESERVED_25
#define MRQ_RESERVED_26
#define MRQ_RESERVED_30
#define MRQ_RESERVED_64
#define MRQ_RESERVED_74
/** @endcond DEPRECATED */

/** @} */

/**
 * @ingroup MRQ_Codes
 * @brief Maximum MRQ code to be sent by CPU software to
 * BPMP. Subject to change in future
 */
#define MAX_CPU_MRQ_ID

/**
 * @addtogroup MRQ_Payloads
 * @{
 *   @defgroup Ping Ping
 *   @defgroup Query_Tag Query Tag
 *   @defgroup Module Loadable Modules
 *   @defgroup Trace Trace
 *   @defgroup Debugfs Debug File System
 *   @defgroup Reset Reset
 *   @defgroup I2C I2C
 *   @defgroup Clocks Clocks
 *   @defgroup ABI_info ABI Info
 *   @defgroup Powergating Power Gating
 *   @defgroup Thermal Thermal
 *   @defgroup OC_status OC status
 *   @defgroup Vhint CPU Voltage hint
 *   @defgroup EMC EMC
 *   @defgroup BWMGR BWMGR
 *   @defgroup ISO_CLIENT ISO_CLIENT
 *   @defgroup CPU NDIV Limits
 *   @defgroup RingbufConsole Ring Buffer Console
 *   @defgroup Strap Straps
 *   @defgroup UPHY UPHY
 *   @defgroup CC3 Auto-CC3
 *   @defgroup FMON FMON
 *   @defgroup EC EC
 *   @defgroup Telemetry Telemetry
 *   @defgroup Pwrlimit PWR_LIMIT
 *   @defgroup Gears Gears
 *   @defgroup BWMGR_INT Bandwidth Manager Integrated
 * @} MRQ_Payloads
 */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_PING
 * @brief A simple ping
 *
 * * Platforms: All
 * * Initiators: Any
 * * Targets: Any
 * * Request Payload: @ref mrq_ping_request
 * * Response Payload: @ref mrq_ping_response
 *
 * @ingroup MRQ_Codes
 * @def MRQ_THREADED_PING
 * @brief A deeper ping
 *
 * * Platforms: All
 * * Initiators: Any
 * * Targets: BPMP
 * * Request Payload: @ref mrq_ping_request
 * * Response Payload: @ref mrq_ping_response
 *
 * Behavior is equivalent to a simple #MRQ_PING except that BPMP
 * responds from a thread context (providing a slightly more robust
 * sign of life).
 *
 */

/**
 * @ingroup Ping
 * @brief Request with #MRQ_PING
 *
 * Used by the sender of an #MRQ_PING message to request a pong from
 * recipient. The response from the recipient is computed based on
 * #challenge.
 */
struct mrq_ping_request {} BPMP_ABI_PACKED;

/**
 * @ingroup Ping
 * @brief Response to #MRQ_PING
 *
 * Sent in response to an #MRQ_PING message. #reply should be the
 * mrq_ping_request challenge left shifted by 1 with the carry-bit
 * dropped.
 *
 */
struct mrq_ping_response {} BPMP_ABI_PACKED;

/**
 * @ingroup MRQ_Codes
 * @def MRQ_QUERY_TAG
 * @brief Query BPMP firmware's tag (i.e. unique identifer)
 *
 * @deprecated Use #MRQ_QUERY_FW_TAG instead.
 *
 * * Platforms: All
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: @ref mrq_query_tag_request
 * * Response Payload: N/A
 *
 */

/**
 * @ingroup Query_Tag
 * @brief Request with #MRQ_QUERY_TAG
 *
 * @deprecated This structure will be removed in future version.
 * Use MRQ_QUERY_FW_TAG instead.
 */
struct mrq_query_tag_request {} BPMP_ABI_PACKED;


/**
 * @ingroup MRQ_Codes
 * @def MRQ_QUERY_FW_TAG
 * @brief Query BPMP firmware's tag (i.e. unique identifier)
 *
 * * Platforms: All
 * * Initiators: Any
 * * Targets: BPMP
 * * Request Payload: N/A
 * * Response Payload: @ref mrq_query_fw_tag_response
 *
 */

/**
 * @ingroup Query_Tag
 * @brief Response to #MRQ_QUERY_FW_TAG
 *
 * Sent in response to #MRQ_QUERY_FW_TAG message. #tag contains the unique
 * identifier for the version of firmware issuing the reply.
 *
 */
struct mrq_query_fw_tag_response {} BPMP_ABI_PACKED;

/** @private */
struct mrq_threaded_ping_request {} BPMP_ABI_PACKED;

/** @private */
struct mrq_threaded_ping_response {} BPMP_ABI_PACKED;

/**
 * @ingroup MRQ_Codes
 * @def MRQ_DEBUGFS
 * @brief Interact with BPMP's debugfs file nodes
 *
 * @deprecated use MRQ_DEBUG instead.
 *
 * * Platforms: T186, T194
 * * Initiators: Any
 * * Targets: BPMP
 * * Request Payload: @ref mrq_debugfs_request
 * * Response Payload: @ref mrq_debugfs_response
 */

/**
 * @addtogroup Debugfs
 * @{
 *
 * The BPMP firmware implements a pseudo-filesystem called
 * debugfs. Any driver within the firmware may register with debugfs
 * to expose an arbitrary set of "files" in the filesystem. When
 * software on the CPU writes to a debugfs file, debugfs passes the
 * written data to a callback provided by the driver. When software on
 * the CPU reads a debugfs file, debugfs queries the driver for the
 * data to return to the CPU. The intention of the debugfs filesystem
 * is to provide information useful for debugging the system at
 * runtime.
 *
 * @note The files exposed via debugfs are not part of the
 * BPMP firmware's ABI. debugfs files may be added or removed in any
 * given version of the firmware. Typically the semantics of a debugfs
 * file are consistent from version to version but even that is not
 * guaranteed.
 *
 * @}
 */

/** @ingroup Debugfs */
enum mrq_debugfs_commands {};

/**
 * @ingroup Debugfs
 * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
 */
struct cmd_debugfs_fileop_request {} BPMP_ABI_PACKED;

/**
 * @ingroup Debugfs
 * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
 */
struct cmd_debugfs_dumpdir_request {} BPMP_ABI_PACKED;

/**
 * @ingroup Debugfs
 * @brief Response data for CMD_DEBUGFS_READ/WRITE command
 */
struct cmd_debugfs_fileop_response {} BPMP_ABI_PACKED;

/**
 * @ingroup Debugfs
 * @brief Response data for CMD_DEBUGFS_DUMPDIR command
 */
struct cmd_debugfs_dumpdir_response {} BPMP_ABI_PACKED;

/**
 * @ingroup Debugfs
 * @brief Request with #MRQ_DEBUGFS.
 *
 * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs
 * command to execute. Legal commands are the values of @ref
 * mrq_debugfs_commands. Each command requires a specific additional
 * payload of data.
 *
 * |command            |payload|
 * |-------------------|-------|
 * |CMD_DEBUGFS_READ   |fop    |
 * |CMD_DEBUGFS_WRITE  |fop    |
 * |CMD_DEBUGFS_DUMPDIR|dumpdir|
 */
struct mrq_debugfs_request {} BPMP_ABI_PACKED;

/**
 * @ingroup Debugfs
 */
struct mrq_debugfs_response {} BPMP_ABI_PACKED;

/**
 * @addtogroup Debugfs
 * @{
 */
#define DEBUGFS_S_ISDIR
#define DEBUGFS_S_IRUSR
#define DEBUGFS_S_IWUSR
/** @} Debugfs */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_DEBUG
 * @brief Interact with BPMP's debugfs file nodes. Use message payload
 * for exchanging data. This is functionally equivalent to
 * @ref MRQ_DEBUGFS. But the way in which data is exchanged is different.
 * When software running on CPU tries to read a debugfs file,
 * the file path and read data will be stored in message payload.
 * Since the message payload size is limited, a debugfs file
 * transaction might require multiple frames of data exchanged
 * between BPMP and CPU until the transaction completes.
 *
 * * Platforms: T194
 * * Initiators: Any
 * * Targets: BPMP
 * * Request Payload: @ref mrq_debug_request
 * * Response Payload: @ref mrq_debug_response
 */

/** @ingroup Debugfs */
enum mrq_debug_commands {};

/**
 * @ingroup Debugfs
 * @brief Maximum number of files that can be open at a given time
 */
#define DEBUG_MAX_OPEN_FILES

/**
 * @ingroup Debugfs
 * @brief Maximum size of null-terminated file name string in bytes.
 * Value is derived from memory available in message payload while
 * using @ref cmd_debug_fopen_request
 * Value 4 corresponds to size of @ref mrq_debug_commands
 * in @ref mrq_debug_request.
 * 120 - 4 dbg_cmd(32bit)  = 116
 */
#define DEBUG_FNAME_MAX_SZ

/**
 * @ingroup Debugfs
 * @brief Parameters for CMD_DEBUG_OPEN command
 */
struct cmd_debug_fopen_request {} BPMP_ABI_PACKED;

/**
 * @ingroup Debugfs
 * @brief Response data for CMD_DEBUG_OPEN_RO/WO command
 */
struct cmd_debug_fopen_response {} BPMP_ABI_PACKED;

/**
 * @ingroup Debugfs
 * @brief Parameters for CMD_DEBUG_READ command
 */
struct cmd_debug_fread_request {} BPMP_ABI_PACKED;

/**
 * @ingroup Debugfs
 * @brief Maximum size of read data in bytes.
 * Value is derived from memory available in message payload while
 * using @ref cmd_debug_fread_response.
 */
#define DEBUG_READ_MAX_SZ

/**
 * @ingroup Debugfs
 * @brief Response data for CMD_DEBUG_READ command
 */
struct cmd_debug_fread_response {} BPMP_ABI_PACKED;

/**
 * @ingroup Debugfs
 * @brief Maximum size of write data in bytes.
 * Value is derived from memory available in message payload while
 * using @ref cmd_debug_fwrite_request.
 */
#define DEBUG_WRITE_MAX_SZ

/**
 * @ingroup Debugfs
 * @brief Parameters for CMD_DEBUG_WRITE command
 */
struct cmd_debug_fwrite_request {} BPMP_ABI_PACKED;

/**
 * @ingroup Debugfs
 * @brief Parameters for CMD_DEBUG_CLOSE command
 */
struct cmd_debug_fclose_request {} BPMP_ABI_PACKED;

/**
 * @ingroup Debugfs
 * @brief Request with #MRQ_DEBUG.
 *
 * The sender of an MRQ_DEBUG message uses #cmd to specify a debugfs
 * command to execute. Legal commands are the values of @ref
 * mrq_debug_commands. Each command requires a specific additional
 * payload of data.
 *
 * |command            |payload|
 * |-------------------|-------|
 * |CMD_DEBUG_OPEN_RO  |fop    |
 * |CMD_DEBUG_OPEN_WO  |fop    |
 * |CMD_DEBUG_READ     |frd    |
 * |CMD_DEBUG_WRITE    |fwr    |
 * |CMD_DEBUG_CLOSE    |fcl    |
 */
struct mrq_debug_request {} BPMP_ABI_PACKED;

/**
 * @ingroup Debugfs
 */
struct mrq_debug_response {} BPMP_ABI_PACKED;

/**
 * @ingroup MRQ_Codes
 * @def MRQ_RESET
 * @brief Reset an IP block
 *
 * * Platforms: T186, T194
 * * Initiators: Any
 * * Targets: BPMP
 * * Request Payload: @ref mrq_reset_request
 * * Response Payload: @ref mrq_reset_response
 *
 * @addtogroup Reset
 * @{
 */

enum mrq_reset_commands {};

/**
 * @brief Request with MRQ_RESET
 *
 * Used by the sender of an #MRQ_RESET message to request BPMP to
 * assert or or deassert a given reset line.
 */
struct mrq_reset_request {} BPMP_ABI_PACKED;

/**
 * @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When
 * this sub-command is not supported, firmware will return -BPMP_EBADCMD
 * in mrq_response::err.
 */
struct cmd_reset_get_max_id_response {} BPMP_ABI_PACKED;

/**
 * @brief Response with MRQ_RESET
 *
 * Each sub-command supported by @ref mrq_reset_request may return
 * sub-command-specific data. Some do and some do not as indicated
 * in the following table
 *
 * | sub-command          | payload          |
 * |----------------------|------------------|
 * | CMD_RESET_ASSERT     | -                |
 * | CMD_RESET_DEASSERT   | -                |
 * | CMD_RESET_MODULE     | -                |
 * | CMD_RESET_GET_MAX_ID | reset_get_max_id |
 */
struct mrq_reset_response {} BPMP_ABI_PACKED;

/** @} Reset */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_I2C
 * @brief Issue an i2c transaction
 *
 * * Platforms: T186, T194
 * * Initiators: Any
 * * Targets: BPMP
 * * Request Payload: @ref mrq_i2c_request
 * * Response Payload: @ref mrq_i2c_response
 *
 * @addtogroup I2C
 * @{
 */
#define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE
#define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE

#define SERIALI2C_TEN
#define SERIALI2C_RD
#define SERIALI2C_STOP
#define SERIALI2C_NOSTART
#define SERIALI2C_REV_DIR_ADDR
#define SERIALI2C_IGNORE_NAK
#define SERIALI2C_NO_RD_ACK
#define SERIALI2C_RECV_LEN

enum {};

/**
 * @brief Serializable i2c request
 *
 * Instances of this structure are packed (little-endian) into
 * cmd_i2c_xfer_request::data_buf. Each instance represents a single
 * transaction (or a portion of a transaction with repeated starts) on
 * an i2c bus.
 *
 * Because these structures are packed, some instances are likely to
 * be misaligned. Additionally because #data is variable length, it is
 * not possible to iterate through a serialized list of these
 * structures without inspecting #len in each instance.  It may be
 * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf
 * manually rather than using this structure definition.
*/
struct serial_i2c_request {} BPMP_ABI_PACKED;

/**
 * @brief Trigger one or more i2c transactions
 */
struct cmd_i2c_xfer_request {} BPMP_ABI_PACKED;

/**
 * @brief Container for data read from the i2c bus
 *
 * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute
 * zero or more I2C reads. The data read from the bus is serialized
 * into #data_buf.
 */
struct cmd_i2c_xfer_response {} BPMP_ABI_PACKED;

/**
 * @brief Request with #MRQ_I2C
 */
struct mrq_i2c_request {} BPMP_ABI_PACKED;

/**
 * @brief Response to #MRQ_I2C
 *
 * mrq_response:err is
 *  0: Success
 *  -#BPMP_EBADCMD: if mrq_i2c_request::cmd is other than 1
 *  -#BPMP_EINVAL: if cmd_i2c_xfer_request does not contain correctly formatted request
 *  -#BPMP_ENODEV: if cmd_i2c_xfer_request::bus_id is not supported by BPMP
 *  -#BPMP_EACCES: if i2c transaction is not allowed due to firewall rules
 *  -#BPMP_ETIMEDOUT: if i2c transaction times out
 *  -#BPMP_ENXIO: if i2c slave device does not reply with ACK to the transaction
 *  -#BPMP_EAGAIN: if ARB_LOST condition is detected by the i2c controller
 *  -#BPMP_EIO: any other i2c controller error code than NO_ACK or ARB_LOST
 */
struct mrq_i2c_response {} BPMP_ABI_PACKED;

/** @} I2C */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_CLK
 * @brief Perform a clock operation
 *
 * * Platforms: T186, T194
 * * Initiators: Any
 * * Targets: BPMP
 * * Request Payload: @ref mrq_clk_request
 * * Response Payload: @ref mrq_clk_response
 *
 * @addtogroup Clocks
 * @{
 */
enum {};

#define BPMP_CLK_HAS_MUX
#define BPMP_CLK_HAS_SET_RATE
#define BPMP_CLK_IS_ROOT
#define BPMP_CLK_IS_VAR_ROOT
/**
 * @brief Protection against rate and parent changes
 *
 * #MRQ_CLK command #CMD_CLK_SET_RATE or #MRQ_CLK command #CMD_CLK_SET_PARENT will return
 * -#BPMP_EACCES.
 */
#define BPMP_CLK_RATE_PARENT_CHANGE_DENIED

/**
 * @brief Protection against state changes
 *
 * #MRQ_CLK command #CMD_CLK_ENABLE or #MRQ_CLK command #CMD_CLK_DISABLE will return
 * -#BPMP_EACCES.
 */
#define BPMP_CLK_STATE_CHANGE_DENIED

#define MRQ_CLK_NAME_MAXLEN
#define MRQ_CLK_MAX_PARENTS

/** @private */
struct cmd_clk_get_rate_request {} BPMP_ABI_PACKED;

struct cmd_clk_get_rate_response {} BPMP_ABI_PACKED;

struct cmd_clk_set_rate_request {} BPMP_ABI_PACKED;

struct cmd_clk_set_rate_response {} BPMP_ABI_PACKED;

struct cmd_clk_round_rate_request {} BPMP_ABI_PACKED;

struct cmd_clk_round_rate_response {} BPMP_ABI_PACKED;

/** @private */
struct cmd_clk_get_parent_request {} BPMP_ABI_PACKED;

struct cmd_clk_get_parent_response {} BPMP_ABI_PACKED;

struct cmd_clk_set_parent_request {} BPMP_ABI_PACKED;

struct cmd_clk_set_parent_response {} BPMP_ABI_PACKED;

/** @private */
struct cmd_clk_is_enabled_request {} BPMP_ABI_PACKED;

/**
 * @brief Response data to #MRQ_CLK sub-command CMD_CLK_IS_ENABLED
 */
struct cmd_clk_is_enabled_response {} BPMP_ABI_PACKED;

/** @private */
struct cmd_clk_enable_request {} BPMP_ABI_PACKED;

/** @private */
struct cmd_clk_enable_response {} BPMP_ABI_PACKED;

/** @private */
struct cmd_clk_disable_request {} BPMP_ABI_PACKED;

/** @private */
struct cmd_clk_disable_response {} BPMP_ABI_PACKED;

/** @cond DEPRECATED */
/** @private */
struct cmd_clk_properties_request {} BPMP_ABI_PACKED;

/** @todo flags need to be spelled out here */
struct cmd_clk_properties_response {} BPMP_ABI_PACKED;

/** @private */
struct cmd_clk_possible_parents_request {} BPMP_ABI_PACKED;

struct cmd_clk_possible_parents_response {} BPMP_ABI_PACKED;

/** @private */
struct cmd_clk_num_possible_parents_request {} BPMP_ABI_PACKED;

struct cmd_clk_num_possible_parents_response {} BPMP_ABI_PACKED;

struct cmd_clk_get_possible_parent_request {} BPMP_ABI_PACKED;

struct cmd_clk_get_possible_parent_response {} BPMP_ABI_PACKED;
/** @endcond DEPRECATED */

/** @private */
struct cmd_clk_get_all_info_request {} BPMP_ABI_PACKED;

struct cmd_clk_get_all_info_response {} BPMP_ABI_PACKED;

/** @private */
struct cmd_clk_get_max_clk_id_request {} BPMP_ABI_PACKED;

struct cmd_clk_get_max_clk_id_response {} BPMP_ABI_PACKED;

/** @private */
struct cmd_clk_get_fmax_at_vmin_request {} BPMP_ABI_PACKED;

struct cmd_clk_get_fmax_at_vmin_response {} BPMP_ABI_PACKED;


/**
 * @ingroup Clocks
 * @brief Request with #MRQ_CLK
 *
 * Used by the sender of an #MRQ_CLK message to control clocks. The
 * clk_request is split into several sub-commands. Some sub-commands
 * require no additional data. Others have a sub-command specific
 * payload
 *
 * |sub-command                 |payload                |
 * |----------------------------|-----------------------|
 * |CMD_CLK_GET_RATE            |-                      |
 * |CMD_CLK_SET_RATE            |clk_set_rate           |
 * |CMD_CLK_ROUND_RATE          |clk_round_rate         |
 * |CMD_CLK_GET_PARENT          |-                      |
 * |CMD_CLK_SET_PARENT          |clk_set_parent         |
 * |CMD_CLK_IS_ENABLED          |-                      |
 * |CMD_CLK_ENABLE              |-                      |
 * |CMD_CLK_DISABLE             |-                      |
 * |CMD_CLK_GET_ALL_INFO        |-                      |
 * |CMD_CLK_GET_MAX_CLK_ID      |-                      |
 * |CMD_CLK_GET_FMAX_AT_VMIN    |-
 * |
 *
 */

/** @cond DEPRECATED
 *
 * Older versions of firmware also supported following sub-commands:
 * |CMD_CLK_PROPERTIES          |-                      |
 * |CMD_CLK_POSSIBLE_PARENTS    |-                      |
 * |CMD_CLK_NUM_POSSIBLE_PARENTS|-                      |
 * |CMD_CLK_GET_POSSIBLE_PARENT |clk_get_possible_parent|
 * |CMD_CLK_RESET_REFCOUNTS     |-                      |
 *
 * @endcond DEPRECATED */

struct mrq_clk_request {} BPMP_ABI_PACKED;

/**
 * @ingroup Clocks
 * @brief Response to MRQ_CLK
 *
 * Each sub-command supported by @ref mrq_clk_request may return
 * sub-command-specific data. Some do and some do not as indicated in
 * the following table
 *
 * |sub-command                 |payload                 |
 * |----------------------------|------------------------|
 * |CMD_CLK_GET_RATE            |clk_get_rate            |
 * |CMD_CLK_SET_RATE            |clk_set_rate            |
 * |CMD_CLK_ROUND_RATE          |clk_round_rate          |
 * |CMD_CLK_GET_PARENT          |clk_get_parent          |
 * |CMD_CLK_SET_PARENT          |clk_set_parent          |
 * |CMD_CLK_IS_ENABLED          |clk_is_enabled          |
 * |CMD_CLK_ENABLE              |-                       |
 * |CMD_CLK_DISABLE             |-                       |
 * |CMD_CLK_GET_ALL_INFO        |clk_get_all_info        |
 * |CMD_CLK_GET_MAX_CLK_ID      |clk_get_max_id          |
 * |CMD_CLK_GET_FMAX_AT_VMIN    |clk_get_fmax_at_vmin    |
 *
 */

/** @cond DEPRECATED
 *
 * Older versions of firmware also supported following sub-commands:
 * |CMD_CLK_PROPERTIES          |clk_properties          |
 * |CMD_CLK_POSSIBLE_PARENTS    |clk_possible_parents    |
 * |CMD_CLK_NUM_POSSIBLE_PARENTS|clk_num_possible_parents|
 * |CMD_CLK_GET_POSSIBLE_PARENT |clk_get_possible_parents|
 * |CMD_CLK_RESET_REFCOUNTS     |-                       |
 *
 * @endcond DEPRECATED */

struct mrq_clk_response {} BPMP_ABI_PACKED;

/** @} Clocks */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_QUERY_ABI
 * @brief Check if an MRQ is implemented
 *
 * * Platforms: All
 * * Initiators: Any
 * * Targets: Any except DMCE
 * * Request Payload: @ref mrq_query_abi_request
 * * Response Payload: @ref mrq_query_abi_response
 */

/**
 * @ingroup ABI_info
 * @brief Request with MRQ_QUERY_ABI
 *
 * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported
 * by the recipient.
 */
struct mrq_query_abi_request {} BPMP_ABI_PACKED;

/**
 * @ingroup ABI_info
 * @brief Response to MRQ_QUERY_ABI
 *
 * @note mrq_response::err of 0 indicates that the query was
 * successful, not that the MRQ itself is supported!
 */
struct mrq_query_abi_response {} BPMP_ABI_PACKED;

/**
 *
 * @ingroup MRQ_Codes
 * @def MRQ_PG
 * @brief Control power-gating state of a partition. In contrast to
 * MRQ_PG_UPDATE_STATE, operations that change the power partition
 * state are NOT reference counted
 *
 * @cond (bpmp_t194 || bpmp_t186)
 * @note On T194 and earlier BPMP-FW forcefully turns off some partitions as
 * part of SC7 entry because their state cannot be adequately restored on exit.
 * Therefore, it is recommended to power off all domains via MRQ_PG prior to SC7
 * entry.
 * See @ref bpmp_pdomain_ids for further detail.
 * @endcond (bpmp_t194 || bpmp_t186)
 *
 * * Platforms: T186, T194
 * * Initiators: Any
 * * Targets: BPMP
 * * Request Payload: @ref mrq_pg_request
 * * Response Payload: @ref mrq_pg_response
 *
 * @addtogroup Powergating
 * @{
 */
enum mrq_pg_cmd {};

#define MRQ_PG_NAME_MAXLEN

enum pg_states {};

struct cmd_pg_query_abi_request {} BPMP_ABI_PACKED;

struct cmd_pg_set_state_request {} BPMP_ABI_PACKED;

/**
 * @brief Response data to #MRQ_PG sub command #CMD_PG_GET_STATE
 */
struct cmd_pg_get_state_response {} BPMP_ABI_PACKED;

struct cmd_pg_get_name_response {} BPMP_ABI_PACKED;

struct cmd_pg_get_max_id_response {} BPMP_ABI_PACKED;

/**
 * @brief Request with #MRQ_PG
 *
 * Used by the sender of an #MRQ_PG message to control power
 * partitions. The pg_request is split into several sub-commands. Some
 * sub-commands require no additional data. Others have a sub-command
 * specific payload
 *
 * |sub-command                 |payload                |
 * |----------------------------|-----------------------|
 * |CMD_PG_QUERY_ABI            | query_abi             |
 * |CMD_PG_SET_STATE            | set_state             |
 * |CMD_PG_GET_STATE            | -                     |
 * |CMD_PG_GET_NAME             | -                     |
 * |CMD_PG_GET_MAX_ID           | -                     |
 *
 */
struct mrq_pg_request {} BPMP_ABI_PACKED;

/**
 * @brief Response to MRQ_PG
 *
 * Each sub-command supported by @ref mrq_pg_request may return
 * sub-command-specific data. Some do and some do not as indicated in
 * the following table
 *
 * |sub-command                 |payload                |
 * |----------------------------|-----------------------|
 * |CMD_PG_QUERY_ABI            | -                     |
 * |CMD_PG_SET_STATE            | -                     |
 * |CMD_PG_GET_STATE            | get_state             |
 * |CMD_PG_GET_NAME             | get_name              |
 * |CMD_PG_GET_MAX_ID           | get_max_id            |
 */
struct mrq_pg_response {} BPMP_ABI_PACKED;

/** @} Powergating */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_THERMAL
 * @brief Interact with BPMP thermal framework
 *
 * * Platforms: T186, T194
 * * Initiators: Any
 * * Targets: Any
 * * Request Payload: TODO
 * * Response Payload: TODO
 *
 * @addtogroup Thermal
 *
 * The BPMP firmware includes a thermal framework. Drivers within the
 * bpmp firmware register with the framework to provide thermal
 * zones. Each thermal zone corresponds to an entity whose temperature
 * can be measured. The framework also has a notion of trip points. A
 * trip point consists of a thermal zone id, a temperature, and a
 * callback routine. The framework invokes the callback when the zone
 * hits the indicated temperature. The BPMP firmware uses this thermal
 * framework interally to implement various temperature-dependent
 * functions.
 *
 * Software on the CPU can use #MRQ_THERMAL (with payload @ref
 * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal
 * framework. The CPU must It can query the number of supported zones,
 * query zone temperatures, and set trip points.
 *
 * When a trip point set by the CPU gets crossed, BPMP firmware issues
 * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a
 * payload of @ref mrq_thermal_bpmp_to_host_request.
 * @{
 */
enum mrq_thermal_host_to_bpmp_cmd {};

enum mrq_thermal_bpmp_to_host_cmd {};

/*
 * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI
 *
 * zone: Request type for which to check existence.
 */
struct cmd_thermal_query_abi_request {} BPMP_ABI_PACKED;

/*
 * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP
 *
 * zone: Number of thermal zone.
 */
struct cmd_thermal_get_temp_request {} BPMP_ABI_PACKED;

/*
 * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP
 *
 * error: 0 if request succeeded.
 *	-BPMP_EINVAL if request parameters were invalid.
 *      -BPMP_ENOENT if no driver was registered for the specified thermal zone.
 *      -BPMP_EFAULT for other thermal zone driver errors.
 * temp: Current temperature in millicelsius.
 */
struct cmd_thermal_get_temp_response {} BPMP_ABI_PACKED;

/*
 * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP
 *
 * zone: Number of thermal zone.
 * low: Temperature of lower trip point in millicelsius
 * high: Temperature of upper trip point in millicelsius
 * enabled: 1 to enable trip point, 0 to disable trip point
 */
struct cmd_thermal_set_trip_request {} BPMP_ABI_PACKED;

/*
 * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED
 *
 * zone: Number of thermal zone where trip point was reached.
 */
struct cmd_thermal_host_trip_reached_request {} BPMP_ABI_PACKED;

/*
 * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES
 *
 * num: Number of supported thermal zones. The thermal zones are indexed
 *      starting from zero.
 */
struct cmd_thermal_get_num_zones_response {} BPMP_ABI_PACKED;

/*
 * Host->BPMP request data for request type CMD_THERMAL_GET_THERMTRIP
 *
 * zone: Number of thermal zone.
 */
struct cmd_thermal_get_thermtrip_request {} BPMP_ABI_PACKED;

/*
 * BPMP->Host reply data for request CMD_THERMAL_GET_THERMTRIP
 *
 * thermtrip: HW shutdown temperature in millicelsius.
 */
struct cmd_thermal_get_thermtrip_response {} BPMP_ABI_PACKED;

/*
 * Host->BPMP request data.
 *
 * Reply type is union mrq_thermal_bpmp_to_host_response.
 *
 * type: Type of request. Values listed in enum mrq_thermal_type.
 * data: Request type specific parameters.
 */
struct mrq_thermal_host_to_bpmp_request {} BPMP_ABI_PACKED;

/*
 * BPMP->Host request data.
 *
 * type: Type of request. Values listed in enum mrq_thermal_type.
 * data: Request type specific parameters.
 */
struct mrq_thermal_bpmp_to_host_request {} BPMP_ABI_PACKED;

/*
 * Data in reply to a Host->BPMP request.
 */
mrq_thermal_bpmp_to_host_response BPMP_ABI_PACKED;

/** @} Thermal */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_OC_STATUS
 * @brief Query over current status
 *
 * * Platforms: T234
 * @cond bpmp_t234
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: N/A
 * * Response Payload: @ref mrq_oc_status_response
 *
 * @addtogroup OC_status
 * @{
 */

#define OC_STATUS_MAX_SIZE

/*
 * @brief Response to #MRQ_OC_STATUS
 *
 * throt_en: Value for each OC alarm where zero signifies throttle is
 *           disabled, and non-zero throttle is enabled.
 * event_cnt: Total number of OC events for each OC alarm.
 *
 * mrq_response::err is 0 if the operation was successful and
 * -#BPMP_ENODEV otherwise.
 */
struct mrq_oc_status_response {} BPMP_ABI_PACKED;

/** @} OC_status */
/** @endcond bpmp_t234 */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_CPU_VHINT
 * @brief Query CPU voltage hint data
 *
 * * Platforms: T186
 * @cond bpmp_t186
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: @ref mrq_cpu_vhint_request
 * * Response Payload: N/A
 *
 * @addtogroup Vhint
 * @{
 */

/**
 * @brief Request with #MRQ_CPU_VHINT
 *
 * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data
 * from BPMP to memory space pointed by #addr. CCPLEX is responsible
 * to allocate sizeof(cpu_vhint_data) sized block of memory and
 * appropriately map it for BPMP before sending the request.
 */
struct mrq_cpu_vhint_request {} BPMP_ABI_PACKED;

/**
 * @brief Description of the CPU v/f relation
 *
 * Used by #MRQ_CPU_VHINT call to carry data pointed by
 * #mrq_cpu_vhint_request::addr
 */
struct cpu_vhint_data {} BPMP_ABI_PACKED;

/** @} Vhint */
/** @endcond bpmp_t186 */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_ABI_RATCHET
 * @brief ABI ratchet value query
 *
 * * Platforms: T186, T194
 * * Initiators: Any
 * * Targets: BPMP
 * * Request Payload: @ref mrq_abi_ratchet_request
 * * Response Payload: @ref mrq_abi_ratchet_response
 * @addtogroup ABI_info
 * @{
 */

/**
 * @brief An ABI compatibility mechanism
 *
 * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future
 * revision of this header file.
 * 1. That future revision deprecates some MRQ
 * 2. That future revision introduces a breaking change to an existing
 *    MRQ or
 * 3. A bug is discovered in an existing implementation of the BPMP-FW
 *    (or possibly one of its clients) which warrants deprecating that
 *    implementation.
 */
#define BPMP_ABI_RATCHET_VALUE

/**
 * @brief Request with #MRQ_ABI_RATCHET.
 *
 * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header
 * against which the requester was compiled.
 *
 * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may
 * reply with mrq_response::err = -#BPMP_ERANGE to indicate that
 * BPMP-FW cannot interoperate correctly with the requester. Requester
 * should cease further communication with BPMP.
 *
 * Otherwise, err shall be 0.
 */
struct mrq_abi_ratchet_request {};

/**
 * @brief Response to #MRQ_ABI_RATCHET
 *
 * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header
 * against which BPMP firwmare was compiled.
 *
 * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE,
 * the requster must either interoperate with BPMP according to an ABI
 * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease
 * communication with BPMP.
 *
 * If mrq_response::err is 0 and ratchet is greater than or equal to the
 * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue
 * normal operation.
 */
struct mrq_abi_ratchet_response {};

/** @} ABI_info */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_EMC_DVFS_LATENCY
 * @brief Query frequency dependent EMC DVFS latency
 *
 * * Platforms: T186, T194, T234
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: N/A
 * * Response Payload: @ref mrq_emc_dvfs_latency_response
 * @addtogroup EMC
 * @{
 */

/**
 * @brief Used by @ref mrq_emc_dvfs_latency_response
 */
struct emc_dvfs_latency {} BPMP_ABI_PACKED;

#define EMC_DVFS_LATENCY_MAX_SIZE
/**
 * @brief Response to #MRQ_EMC_DVFS_LATENCY
 */
struct mrq_emc_dvfs_latency_response {} BPMP_ABI_PACKED;

/** @} EMC */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_EMC_DVFS_EMCHUB
 * @brief Query EMC HUB frequencies
 *
 * * Platforms: T234 onwards
 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: N/A
 * * Response Payload: @ref mrq_emc_dvfs_emchub_response
 * @addtogroup EMC
 * @{
 */

/**
 * @brief Used by @ref mrq_emc_dvfs_emchub_response
 */
struct emc_dvfs_emchub {} BPMP_ABI_PACKED;

#define EMC_DVFS_EMCHUB_MAX_SIZE
/**
 * @brief Response to #MRQ_EMC_DVFS_EMCHUB
 */
struct mrq_emc_dvfs_emchub_response {} BPMP_ABI_PACKED;

/** @} EMC */
/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_EMC_DISP_RFL
 * @brief Set EMC display RFL handshake mode of operations
 *
 * * Platforms: T234 onwards
 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: @ref mrq_emc_disp_rfl_request
 * * Response Payload: N/A
 *
 * @addtogroup EMC
 * @{
 */

enum mrq_emc_disp_rfl_mode {};

/**
 * @ingroup EMC
 * @brief Request with #MRQ_EMC_DISP_RFL
 *
 * Used by the sender of an #MRQ_EMC_DISP_RFL message to
 * request the mode of EMC display RFL handshake.
 *
 * mrq_response::err is
 * * 0: RFL mode is set successfully
 * * -#BPMP_EINVAL: invalid mode requested
 * * -#BPMP_ENOSYS: RFL handshake is not supported
 * * -#BPMP_EACCES: Permission denied
 * * -#BPMP_ENODEV: if disp rfl mrq is not supported by BPMP-FW
 */
struct mrq_emc_disp_rfl_request {} BPMP_ABI_PACKED;

/** @} EMC */
/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_BWMGR
 * @brief bwmgr requests
 *
 * * Platforms: T234 onwards
 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: @ref mrq_bwmgr_request
 * * Response Payload: @ref mrq_bwmgr_response
 *
 * @addtogroup BWMGR
 *
 * @{
 */

enum mrq_bwmgr_cmd {};

/*
 * request data for request type CMD_BWMGR_QUERY_ABI
 *
 * type: Request type for which to check existence.
 */
struct cmd_bwmgr_query_abi_request {} BPMP_ABI_PACKED;

/**
 * @brief Used by @ref cmd_bwmgr_calc_rate_request
 */
struct iso_req {} BPMP_ABI_PACKED;

#define MAX_ISO_CLIENTS
/*
 * request data for request type CMD_BWMGR_CALC_RATE
 */
struct cmd_bwmgr_calc_rate_request {} BPMP_ABI_PACKED;

/*
 * response data for request type CMD_BWMGR_CALC_RATE
 *
 * iso_rate_min: min dram data clk rate in kHz to satisfy all iso bw reqs
 * total_rate_min: min dram data clk rate in kHz to satisfy all bw reqs
 */
struct cmd_bwmgr_calc_rate_response {} BPMP_ABI_PACKED;

/*
 * @brief Request with #MRQ_BWMGR
 *
 *
 * |sub-command                 |payload                       |
 * |----------------------------|------------------------------|
 * |CMD_BWMGR_QUERY_ABI         | cmd_bwmgr_query_abi_request  |
 * |CMD_BWMGR_CALC_RATE         | cmd_bwmgr_calc_rate_request  |
 *
 */
struct mrq_bwmgr_request {} BPMP_ABI_PACKED;

/*
 * @brief Response to MRQ_BWMGR
 *
 * |sub-command                 |payload                       |
 * |----------------------------|------------------------------|
 * |CMD_BWMGR_CALC_RATE         | cmd_bwmgr_calc_rate_response |
 */
struct mrq_bwmgr_response {} BPMP_ABI_PACKED;

/** @} BWMGR */
/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_BWMGR_INT
 * @brief bpmp-integrated bwmgr requests
 *
 * * Platforms: T234 onwards
 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: @ref mrq_bwmgr_int_request
 * * Response Payload: @ref mrq_bwmgr_int_response
 *
 * @addtogroup BWMGR_INT
 * @{
 */

enum mrq_bwmgr_int_cmd {};

/*
 * request structure for request type CMD_BWMGR_QUERY_ABI
 *
 * type: Request type for which to check existence.
 */
struct cmd_bwmgr_int_query_abi_request {} BPMP_ABI_PACKED;

/**
 * @defgroup bwmgr_int_unit_type BWMGR_INT floor unit-types
 * @addtogroup bwmgr_int_unit_type
 * @{
 */
/** @brief kilobytes per second unit-type */
#define BWMGR_INT_UNIT_KBPS
/** @brief kilohertz unit-type */
#define BWMGR_INT_UNIT_KHZ

/** @} bwmgr_int_unit_type */

/*
 * request data for request type CMD_BWMGR_INT_CALC_AND_SET
 */
struct cmd_bwmgr_int_calc_and_set_request {} BPMP_ABI_PACKED;

struct cmd_bwmgr_int_cap_set_request {} BPMP_ABI_PACKED;

/*
 * response data for request type CMD_BWMGR_CALC_AND_SET
 */
struct cmd_bwmgr_int_calc_and_set_response {} BPMP_ABI_PACKED;

/*
 * @brief Request with #MRQ_BWMGR_INT
 *
 *
 * |sub-command                 |payload                            |
 * |----------------------------|-----------------------------------|
 * |CMD_BWMGR_INT_QUERY_ABI     | cmd_bwmgr_int_query_abi_request   |
 * |CMD_BWMGR_INT_CALC_AND_SET  | cmd_bwmgr_int_calc_and_set_request|
 * |CMD_BWMGR_INT_CAP_SET       | cmd_bwmgr_int_cap_set_request     |
 *
 */
struct mrq_bwmgr_int_request {} BPMP_ABI_PACKED;

/*
 * @brief Response to MRQ_BWMGR_INT
 *
 * |sub-command                 |payload                                |
 * |----------------------------|---------------------------------------|
 * |CMD_BWMGR_INT_CALC_AND_SET  | cmd_bwmgr_int_calc_and_set_response   |
 */
struct mrq_bwmgr_int_response {} BPMP_ABI_PACKED;

/** @} BWMGR_INT */
/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_ISO_CLIENT
 * @brief ISO client requests
 *
 * * Platforms: T234 onwards
 * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: @ref mrq_iso_client_request
 * * Response Payload: @ref mrq_iso_client_response
 *
 * @addtogroup ISO_CLIENT
 * @{
 */

enum mrq_iso_client_cmd {};

/*
 * request data for request type CMD_ISO_CLIENT_QUERY_ABI
 *
 * type: Request type for which to check existence.
 */
struct cmd_iso_client_query_abi_request {} BPMP_ABI_PACKED;

/*
 * request data for request type CMD_ISO_CLIENT_CALCULATE_LA
 *
 * id: client ID in @ref bpmp_bwmgr_ids
 * bw: bw requested in kBps by client ID.
 * init_bw_floor: initial dram_bw_floor in kBps passed by client ID.
 * ISO client will perform mempool allocation and DVFS buffering based
 * on this dram_bw_floor.
 */
struct cmd_iso_client_calculate_la_request {} BPMP_ABI_PACKED;

/*
 * request data for request type CMD_ISO_CLIENT_SET_LA
 *
 * id: client ID in @ref bpmp_bwmgr_ids
 * bw: bw requested in kBps by client ID.
 * final_bw_floor: final dram_bw_floor in kBps.
 * Sometimes the initial dram_bw_floor passed by ISO client may need to be
 * updated by considering higher dram freq's. This is the final dram_bw_floor
 * used to calculate and program MC registers.
 */
struct cmd_iso_client_set_la_request {} BPMP_ABI_PACKED;

/*
 * request data for request type CMD_ISO_CLIENT_GET_MAX_BW
 *
 * id: client ID in @ref bpmp_bwmgr_ids
 */
struct cmd_iso_client_get_max_bw_request {} BPMP_ABI_PACKED;

/*
 * response data for request type CMD_ISO_CLIENT_CALCULATE_LA
 *
 * la_rate_floor: minimum dram_rate_floor in kHz at which a legal la is possible
 * iso_client_only_rate: Minimum dram freq in kHz required to satisfy this clients
 * iso bw request, assuming all other iso clients are inactive
 */
struct cmd_iso_client_calculate_la_response {} BPMP_ABI_PACKED;

/**
 * @brief Used by @ref cmd_iso_client_get_max_bw_response
 */
struct iso_max_bw {} BPMP_ABI_PACKED;

#define ISO_MAX_BW_MAX_SIZE
/*
 * response data for request type CMD_ISO_CLIENT_GET_MAX_BW
 */
struct cmd_iso_client_get_max_bw_response {} BPMP_ABI_PACKED;

/**
 * @brief Request with #MRQ_ISO_CLIENT
 *
 * Used by the sender of an #MRQ_ISO_CLIENT message.
 *
 * |sub-command                          |payload                                 |
 * |------------------------------------ |----------------------------------------|
 * |CMD_ISO_CLIENT_QUERY_ABI		 |cmd_iso_client_query_abi_request        |
 * |CMD_ISO_CLIENT_CALCULATE_LA		 |cmd_iso_client_calculate_la_request     |
 * |CMD_ISO_CLIENT_SET_LA		 |cmd_iso_client_set_la_request           |
 * |CMD_ISO_CLIENT_GET_MAX_BW		 |cmd_iso_client_get_max_bw_request       |
 *
 */

struct mrq_iso_client_request {} BPMP_ABI_PACKED;

/**
 * @brief Response to MRQ_ISO_CLIENT
 *
 * Each sub-command supported by @ref mrq_iso_client_request may return
 * sub-command-specific data. Some do and some do not as indicated in
 * the following table
 *
 * |sub-command                  |payload                             |
 * |---------------------------- |------------------------------------|
 * |CMD_ISO_CLIENT_CALCULATE_LA  |cmd_iso_client_calculate_la_response|
 * |CMD_ISO_CLIENT_SET_LA        |N/A                                 |
 * |CMD_ISO_CLIENT_GET_MAX_BW    |cmd_iso_client_get_max_bw_response  |
 *
 */

struct mrq_iso_client_response {} BPMP_ABI_PACKED;

/** @} ISO_CLIENT */
/** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_CPU_NDIV_LIMITS
 * @brief CPU freq. limits in ndiv
 *
 * * Platforms: T194 onwards
 * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: @ref mrq_cpu_ndiv_limits_request
 * * Response Payload: @ref mrq_cpu_ndiv_limits_response
 * @addtogroup CPU
 * @{
 */

/**
 * @brief Request for ndiv limits of a cluster
 */
struct mrq_cpu_ndiv_limits_request {} BPMP_ABI_PACKED;

/**
 * @brief Response to #MRQ_CPU_NDIV_LIMITS
 */
struct mrq_cpu_ndiv_limits_response {} BPMP_ABI_PACKED;

/** @} CPU */
/** @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500) */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_CPU_AUTO_CC3
 * @brief Query CPU cluster auto-CC3 configuration
 *
 * * Platforms: T194
 * @cond bpmp_t194
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: @ref mrq_cpu_auto_cc3_request
 * * Response Payload: @ref mrq_cpu_auto_cc3_response
 * @addtogroup CC3
 *
 * Queries from BPMP auto-CC3 configuration (allowed/not allowed) for a
 * specified cluster. CCPLEX s/w uses this information to override its own
 * device tree auto-CC3 settings, so that BPMP device tree is a single source of
 * auto-CC3 platform configuration.
 *
 * @{
 */

/**
 * @brief Request for auto-CC3 configuration of a cluster
 */
struct mrq_cpu_auto_cc3_request {} BPMP_ABI_PACKED;

/**
 * @brief Response to #MRQ_CPU_AUTO_CC3
 */
struct mrq_cpu_auto_cc3_response {} BPMP_ABI_PACKED;

/** @} CC3 */
/** @endcond bpmp_t194 */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_RINGBUF_CONSOLE
 * @brief A ring buffer debug console for BPMP
 * @addtogroup RingbufConsole
 *
 * The ring buffer debug console aims to be a substitute for the UART debug
 * console. The debug console is implemented with two ring buffers in the
 * BPMP-FW, the RX (receive) and TX (transmit) buffers. Characters can be read
 * and written to the buffers by the host via the MRQ interface.
 *
 * @{
 */

/**
 * @brief Maximum number of bytes transferred in a single write command to the
 * BPMP
 *
 * This is determined by the number of free bytes in the message struct,
 * rounded down to a multiple of four.
 */
#define MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN

/**
 * @brief Maximum number of bytes transferred in a single read command to the
 * BPMP
 *
 * This is determined by the number of free bytes in the message struct,
 * rounded down to a multiple of four.
 */
#define MRQ_RINGBUF_CONSOLE_MAX_READ_LEN

enum mrq_ringbuf_console_host_to_bpmp_cmd {};

/**
 * @ingroup RingbufConsole
 * @brief Host->BPMP request data for request type
 * #CMD_RINGBUF_CONSOLE_QUERY_ABI
 */
struct cmd_ringbuf_console_query_abi_req {} BPMP_ABI_PACKED;

/** @private */
struct cmd_ringbuf_console_query_abi_resp {} BPMP_ABI_PACKED;

/**
 * @ingroup RingbufConsole
 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_READ
 */
struct cmd_ringbuf_console_read_req {} BPMP_ABI_PACKED;

/**
 * @ingroup RingbufConsole
 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_READ
 */
struct cmd_ringbuf_console_read_resp {} BPMP_ABI_PACKED;

/**
 * @ingroup RingbufConsole
 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_WRITE
 */
struct cmd_ringbuf_console_write_req {} BPMP_ABI_PACKED;

/**
 * @ingroup RingbufConsole
 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_WRITE
 */
struct cmd_ringbuf_console_write_resp {} BPMP_ABI_PACKED;

/** @private */
struct cmd_ringbuf_console_get_fifo_req {} BPMP_ABI_PACKED;

/**
 * @ingroup RingbufConsole
 * @brief BPMP->Host reply data for request type #CMD_RINGBUF_CONSOLE_GET_FIFO
 */
struct cmd_ringbuf_console_get_fifo_resp {} BPMP_ABI_PACKED;

/**
 * @ingroup RingbufConsole
 * @brief Host->BPMP request data.
 *
 * Reply type is union #mrq_ringbuf_console_bpmp_to_host_response .
 */
struct mrq_ringbuf_console_host_to_bpmp_request {} BPMP_ABI_PACKED;

/**
 * @ingroup RingbufConsole
 * @brief Host->BPMP reply data
 *
 * In response to struct #mrq_ringbuf_console_host_to_bpmp_request.
 */
mrq_ringbuf_console_bpmp_to_host_response BPMP_ABI_PACKED;

/** @} RingbufConsole */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_STRAP
 * @brief Set a strap value controlled by BPMP
 *
 * * Platforms: T194 onwards
 * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: @ref mrq_strap_request
 * * Response Payload: N/A
 * @addtogroup Strap
 *
 * A strap is an input that is sampled by a hardware unit during the
 * unit's startup process. The sampled value of a strap affects the
 * behavior of the unit until the unit is restarted. Many hardware
 * units sample their straps at the instant that their resets are
 * deasserted.
 *
 * BPMP owns registers which act as straps to various units. It
 * exposes limited control of those straps via #MRQ_STRAP.
 *
 * @{
 */
enum mrq_strap_cmd {};

/**
 * @brief Request with #MRQ_STRAP
 */
struct mrq_strap_request {} BPMP_ABI_PACKED;

/** @} Strap */
/** @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500) */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_UPHY
 * @brief Perform a UPHY operation
 *
 * * Platforms: T194 onwards
 * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: @ref mrq_uphy_request
 * * Response Payload: @ref mrq_uphy_response
 *
 * @addtogroup UPHY
 * @{
 */
enum {};

struct cmd_uphy_margin_control_request {} BPMP_ABI_PACKED;

struct cmd_uphy_margin_status_response {} BPMP_ABI_PACKED;

struct cmd_uphy_ep_controller_pll_init_request {} BPMP_ABI_PACKED;

struct cmd_uphy_pcie_controller_state_request {} BPMP_ABI_PACKED;

struct cmd_uphy_ep_controller_pll_off_request {} BPMP_ABI_PACKED;

struct cmd_uphy_display_port_init_request {} BPMP_ABI_PACKED;

struct cmd_uphy_xusb_dyn_lanes_restore_request {} BPMP_ABI_PACKED;

/**
 * @ingroup UPHY
 * @brief Request with #MRQ_UPHY
 *
 * Used by the sender of an #MRQ_UPHY message to control UPHY.
 * The uphy_request is split into several sub-commands. CMD_UPHY_PCIE_LANE_MARGIN_STATUS
 * requires no additional data. Others have a sub-command specific payload. Below table
 * shows sub-commands with their corresponding payload data.
 *
 * |sub-command                          |payload                                 |
 * |------------------------------------ |----------------------------------------|
 * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL    |uphy_set_margin_control                 |
 * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS     |                                        |
 * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT |cmd_uphy_ep_controller_pll_init_request |
 * |CMD_UPHY_PCIE_CONTROLLER_STATE       |cmd_uphy_pcie_controller_state_request  |
 * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF  |cmd_uphy_ep_controller_pll_off_request  |
 * |CMD_UPHY_PCIE_DISPLAY_PORT_INIT      |cmd_uphy_display_port_init_request      |
 * |CMD_UPHY_PCIE_DISPLAY_PORT_OFF       |                                        |
 * |CMD_UPHY_XUSB_DYN_LANES_RESTORE      |cmd_uphy_xusb_dyn_lanes_restore_request |
 *
 */

struct mrq_uphy_request {} BPMP_ABI_PACKED;

/**
 * @ingroup UPHY
 * @brief Response to MRQ_UPHY
 *
 * Each sub-command supported by @ref mrq_uphy_request may return
 * sub-command-specific data. Some do and some do not as indicated in
 * the following table
 *
 * |sub-command                       |payload                 |
 * |----------------------------      |------------------------|
 * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL |                        |
 * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS  |uphy_get_margin_status  |
 *
 */

struct mrq_uphy_response {} BPMP_ABI_PACKED;

/** @} UPHY */
/** @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500) */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_FMON
 * @brief Perform a frequency monitor configuration operations
 *
 * * Platforms: T194 onwards
 * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: @ref mrq_fmon_request
 * * Response Payload: @ref mrq_fmon_response
 * @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
 *
 * @addtogroup FMON
 * @{
 * @cond (bpmp_t194 || bpmp_t234)
 */
enum {};

/**
 * @cond DEPRECATED
 * Kept for backward compatibility
 */
#define CMD_FMON_NUM

/** @endcond DEPRECATED */

/**
 * @defgroup fmon_fault_type FMON fault type
 * @addtogroup fmon_fault_type
 * @{
 */
/** @brief All detected FMON faults (h/w or s/w) */
#define FMON_FAULT_TYPE_ALL
/** @brief FMON faults detected by h/w */
#define FMON_FAULT_TYPE_HW
/** @brief FMON faults detected by s/w */
#define FMON_FAULT_TYPE_SW

/** @} fmon_fault_type */


struct cmd_fmon_gear_clamp_request {} BPMP_ABI_PACKED;

/** @private */
struct cmd_fmon_gear_clamp_response {} BPMP_ABI_PACKED;

/** @private */
struct cmd_fmon_gear_free_request {} BPMP_ABI_PACKED;

/** @private */
struct cmd_fmon_gear_free_response {} BPMP_ABI_PACKED;

/** @private */
struct cmd_fmon_gear_get_request {} BPMP_ABI_PACKED;

struct cmd_fmon_gear_get_response {} BPMP_ABI_PACKED;

struct cmd_fmon_fault_sts_get_request {} BPMP_ABI_PACKED;

struct cmd_fmon_fault_sts_get_response {} BPMP_ABI_PACKED;

/**
 * @ingroup FMON
 * @brief Request with #MRQ_FMON
 *
 * Used by the sender of an #MRQ_FMON message to configure clock
 * frequency monitors. The FMON request is split into several
 * sub-commands. Some sub-commands require no additional data.
 * Others have a sub-command specific payload
 *
 * |sub-command                 |payload                |
 * |----------------------------|-----------------------|
 * |CMD_FMON_GEAR_CLAMP         |fmon_gear_clamp        |
 * |CMD_FMON_GEAR_FREE          |-                      |
 * |CMD_FMON_GEAR_GET           |-                      |
 * |CMD_FMON_FAULT_STS_GET      |fmon_fault_sts_get     |
 *
 */
struct mrq_fmon_request {} BPMP_ABI_PACKED;

/**
 * @ingroup FMON
 * @brief Response to MRQ_FMON
 *
 * Each sub-command supported by @ref mrq_fmon_request may
 * return sub-command-specific data as indicated below.
 *
 * |sub-command                 |payload                 |
 * |----------------------------|------------------------|
 * |CMD_FMON_GEAR_CLAMP         |-                       |
 * |CMD_FMON_GEAR_FREE          |-                       |
 * |CMD_FMON_GEAR_GET           |fmon_gear_get           |
 * |CMD_FMON_FAULT_STS_GET      |fmon_fault_sts_get      |
 *
 */

struct mrq_fmon_response {} BPMP_ABI_PACKED;

/** @endcond (bpmp_t194 || bpmp_t234) */
/** @} FMON */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_EC
 * @brief Provide status information on faults reported by Error
 *        Collator (EC) to HSM.
 *
 * * Platforms: T194
 * @cond bpmp_t194
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: @ref mrq_ec_request
 * * Response Payload: @ref mrq_ec_response
 *
 * @note This MRQ ABI is under construction, and subject to change
 *
 * @endcond bpmp_t194
 * @addtogroup EC
 * @{
 * @cond bpmp_t194
 */
enum {};

/** @brief BPMP ECs error types */
enum bpmp_ec_err_type {};

/** @brief Group of registers with parity error. */
enum ec_registers_group {};

/**
 * @defgroup bpmp_ec_status_flags EC Status Flags
 * @addtogroup bpmp_ec_status_flags
 * @{
 */
/** @brief No EC error found flag */
#define EC_STATUS_FLAG_NO_ERROR
/** @brief Last EC error found flag */
#define EC_STATUS_FLAG_LAST_ERROR
/** @brief EC latent error flag */
#define EC_STATUS_FLAG_LATENT_ERROR

/** @} bpmp_ec_status_flags */

/**
 * @defgroup bpmp_ec_desc_flags EC Descriptor Flags
 * @addtogroup bpmp_ec_desc_flags
 * @{
 */
/** @brief EC descriptor error resolved flag */
#define EC_DESC_FLAG_RESOLVED
/** @brief EC descriptor failed to retrieve id flag */
#define EC_DESC_FLAG_NO_ID

/** @} bpmp_ec_desc_flags */

/**
 * |error type                       | fmon_clk_id values        |
 * |---------------------------------|---------------------------|
 * |@ref EC_ERR_TYPE_CLOCK_MONITOR   |@ref bpmp_clock_ids        |
 */
struct ec_err_fmon_desc {} BPMP_ABI_PACKED;

/**
 * | error type                      | vmon_adc_id values        |
 * |---------------------------------|---------------------------|
 * |@ref EC_ERR_TYPE_VOLTAGE_MONITOR |@ref bpmp_adc_ids          |
 */
struct ec_err_vmon_desc {} BPMP_ABI_PACKED;

/**
 * |error type                       | reg_id values         |
 * |---------------------------------|-----------------------|
 * |@ref EC_ERR_TYPE_REGISTER_PARITY | bpmp_ec_registers_ids |
 */
struct ec_err_reg_parity_desc {} BPMP_ABI_PACKED;

/**
 * |error type                        | err_source_id values |
 * |--------------------------------- |----------------------|
 * |@ref EC_ERR_TYPE_SW_CORRECTABLE   | bpmp_ec_ce_swd_ids   |
 * |@ref EC_ERR_TYPE_SW_UNCORRECTABLE | bpmp_ec_ue_swd_ids   |
 */
struct ec_err_sw_error_desc {} BPMP_ABI_PACKED;

/**
 * |error type                              | err_source_id values   |
 * |----------------------------------------|------------------------|
 * |@ref EC_ERR_TYPE_PARITY_INTERNAL        |  bpmp_ec_ipath_ids     |
 * |@ref EC_ERR_TYPE_ECC_SEC_INTERNAL       |  bpmp_ec_ipath_ids     |
 * |@ref EC_ERR_TYPE_ECC_DED_INTERNAL       |  bpmp_ec_ipath_ids     |
 * |@ref EC_ERR_TYPE_COMPARATOR             |  bpmp_ec_comparator_ids|
 * |@ref EC_ERR_TYPE_OTHER_HW_CORRECTABLE   |  bpmp_ec_misc_hwd_ids  |
 * |@ref EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE |  bpmp_ec_misc_hwd_ids  |
 * |@ref EC_ERR_TYPE_PARITY_SRAM            |  bpmp_clock_ids        |
 */
struct ec_err_simple_desc {} BPMP_ABI_PACKED;

/** @brief Union of EC error descriptors */
ec_err_desc BPMP_ABI_PACKED;

struct cmd_ec_status_get_request {} BPMP_ABI_PACKED;

/** EC status maximum number of descriptors */
#define EC_ERR_STATUS_DESC_MAX_NUM

/**
 * @cond DEPRECATED
 */
struct cmd_ec_status_get_response {} BPMP_ABI_PACKED;
/** @endcond DEPRECATED */

struct cmd_ec_status_ex_get_response {} BPMP_ABI_PACKED;

/**
 * @ingroup EC
 * @brief Request with #MRQ_EC
 *
 * Used by the sender of an #MRQ_EC message to access ECs owned
 * by BPMP.
 *
 * @cond DEPRECATED
 * |sub-command                 |payload                |
 * |----------------------------|-----------------------|
 * |@ref CMD_EC_STATUS_GET      |ec_status_get          |
 * @endcond DEPRECATED
 *
 * |sub-command                 |payload                |
 * |----------------------------|-----------------------|
 * |@ref CMD_EC_STATUS_EX_GET   |ec_status_get          |
 *
 */

struct mrq_ec_request {} BPMP_ABI_PACKED;

/**
 * @ingroup EC
 * @brief Response to MRQ_EC
 *
 * Each sub-command supported by @ref mrq_ec_request may return
 * sub-command-specific data as indicated below.
 *
 * @cond DEPRECATED
 * |sub-command                 |payload                 |
 * |----------------------------|------------------------|
 * |@ref CMD_EC_STATUS_GET      |ec_status_get           |
 * @endcond DEPRECATED
 *
 * |sub-command                 |payload                 |
 * |----------------------------|------------------------|
 * |@ref CMD_EC_STATUS_EX_GET   |ec_status_ex_get        |
 *
 */

struct mrq_ec_response {} BPMP_ABI_PACKED;

/** @endcond bpmp_t194 */
/** @} EC */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_TELEMETRY
 * @brief Get address of memory buffer refreshed with recently sampled
 *        telemetry data
 *
 * * Platforms: TH500 onwards
 * @cond bpmp_th500
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: N/A
 * * Response Payload: @ref mrq_telemetry_response
 * @addtogroup Telemetry
 * @{
 */

/**
 * @brief Response to #MRQ_TELEMETRY
 *
 * mrq_response::err is
 * * 0: Telemetry data is available at returned address
 * * -#BPMP_EACCES: MRQ master is not allowed to request buffer refresh
 * * -#BPMP_ENAVAIL: Telemetry buffer cannot be refreshed via this MRQ channel
 * * -#BPMP_ENOTSUP: Telemetry buffer is not supported by BPMP-FW
 * * -#BPMP_ENODEV: Telemetry mrq is not supported by BPMP-FW
 */
struct mrq_telemetry_response {} BPMP_ABI_PACKED;

/** @} Telemetry */
/** @endcond bpmp_th500 */

/**
 * @ingroup MRQ_Codes
 * @def MRQ_PWR_LIMIT
 * @brief Control power limits.
 *
 * * Platforms: TH500 onwards
 * @cond bpmp_th500
 * * Initiators: Any
 * * Targets: BPMP
 * * Request Payload: @ref mrq_pwr_limit_request
 * * Response Payload: @ref mrq_pwr_limit_response
 *
 * @addtogroup Pwrlimit
 * @{
 */
enum mrq_pwr_limit_cmd {};

/**
 * @defgroup bpmp_pwr_limit_type PWR_LIMIT TYPEs
 * @{
 */
/** @brief Limit value specifies traget cap */
#define PWR_LIMIT_TYPE_TARGET_CAP
/** @brief Limit value specifies maximum possible target cap */
#define PWR_LIMIT_TYPE_BOUND_MAX
/** @brief Limit value specifies minimum possible target cap */
#define PWR_LIMIT_TYPE_BOUND_MIN
/** @brief Number of limit types supported by mrq interface */
#define PWR_LIMIT_TYPE_NUM

/** @} bpmp_pwr_limit_type */

/**
 * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_QUERY_ABI
 */
struct cmd_pwr_limit_query_abi_request {} BPMP_ABI_PACKED;

/**
 * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_SET
 *
 * Set specified limit of specified type from specified source. The success of
 * the request means that specified value is accepted as input to arbitration
 * with other sources settings for the same limit of the same type. Zero limit
 * is ignored by the arbitration (i.e., indicates "no limit set").
 */
struct cmd_pwr_limit_set_request {} BPMP_ABI_PACKED;

/**
 * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_GET
 *
 * Get previously set from specified source specified limit value of specified
 * type.
 */
struct cmd_pwr_limit_get_request {} BPMP_ABI_PACKED;

/**
 * @brief Response data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_GET
 */
struct cmd_pwr_limit_get_response {} BPMP_ABI_PACKED;

/**
 * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_CURR_CAP
 *
 * For specified limit get current power cap aggregated from all sources.
 */
struct cmd_pwr_limit_curr_cap_request {} BPMP_ABI_PACKED;

/**
 * @brief Response data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_CURR_CAP
 */
struct cmd_pwr_limit_curr_cap_response {} BPMP_ABI_PACKED;

/**
 * @brief Request with #MRQ_PWR_LIMIT
 *
 * |sub-command                 |payload                          |
 * |----------------------------|---------------------------------|
 * |CMD_PWR_LIMIT_QUERY_ABI     | cmd_pwr_limit_query_abi_request |
 * |CMD_PWR_LIMIT_SET           | cmd_pwr_limit_set_request       |
 * |CMD_PWR_LIMIT_GET           | cmd_pwr_limit_get_request       |
 * |CMD_PWR_LIMIT_CURR_CAP      | cmd_pwr_limit_curr_cap_request  |
 */
struct mrq_pwr_limit_request {} BPMP_ABI_PACKED;

/**
 * @brief Response to MRQ_PWR_LIMIT
 *
 * |sub-command                 |payload                          |
 * |----------------------------|---------------------------------|
 * |CMD_PWR_LIMIT_QUERY_ABI     | -                               |
 * |CMD_PWR_LIMIT_SET           | -                               |
 * |CMD_PWR_LIMIT_GET           | cmd_pwr_limit_get_response      |
 * |CMD_PWR_LIMIT_CURR_CAP      | cmd_pwr_limit_curr_cap_response |
 */
struct mrq_pwr_limit_response {} BPMP_ABI_PACKED;

/** @} PwrLimit */
/** @endcond bpmp_th500 */


/**
 * @ingroup MRQ_Codes
 * @def MRQ_GEARS
 * @brief Get thresholds for NDIV offset switching
 *
 * * Platforms: TH500 onwards
 * @cond bpmp_th500
 * * Initiators: CCPLEX
 * * Targets: BPMP
 * * Request Payload: N/A
 * * Response Payload: @ref mrq_gears_response
 * @addtogroup Gears
 * @{
 */

/**
 * @brief Response to #MRQ_GEARS
 *
 * Used by the sender of an #MRQ_GEARS message to request thresholds
 * for NDIV offset switching.
 *
 * The mrq_gears_response::ncpu array defines four thresholds in units
 * of number of online CPUS to be used for choosing between five different
 * NDIV offset settings for CCPLEX cluster NAFLLs
 *
 * 1. If number of online CPUs < ncpu[0] use offset0
 * 2. If number of online CPUs < ncpu[1] use offset1
 * 3. If number of online CPUs < ncpu[2] use offset2
 * 4. If number of online CPUs < ncpu[3] use offset3
 * 5. If number of online CPUs >= ncpu[3] disable offsetting
 *
 * For TH500 mrq_gears_response::ncpu array has four valid entries.
 *
 * mrq_response::err is
 * * 0: gears defined and response data valid
 * * -#BPMP_ENODEV: MRQ is not supported by BPMP-FW
 * * -#BPMP_EACCES: Operation not permitted for the MRQ master
 * * -#BPMP_ENAVAIL: NDIV offsetting is disabled
 */
struct mrq_gears_response {} BPMP_ABI_PACKED;

/** @} Gears */
/** @endcond bpmp_th500 */

/**
 * @addtogroup Error_Codes
 * Negative values for mrq_response::err generally indicate some
 * error. The ABI defines the following error codes. Negating these
 * defines is an exercise left to the user.
 * @{
 */

/** @brief Operation not permitted */
#define BPMP_EPERM
/** @brief No such file or directory */
#define BPMP_ENOENT
/** @brief No MRQ handler */
#define BPMP_ENOHANDLER
/** @brief I/O error */
#define BPMP_EIO
/** @brief Bad sub-MRQ command */
#define BPMP_EBADCMD
/** @brief Resource temporarily unavailable */
#define BPMP_EAGAIN
/** @brief Not enough memory */
#define BPMP_ENOMEM
/** @brief Permission denied */
#define BPMP_EACCES
/** @brief Bad address */
#define BPMP_EFAULT
/** @brief Resource busy */
#define BPMP_EBUSY
/** @brief No such device */
#define BPMP_ENODEV
/** @brief Argument is a directory */
#define BPMP_EISDIR
/** @brief Invalid argument */
#define BPMP_EINVAL
/** @brief Timeout during operation */
#define BPMP_ETIMEDOUT
/** @brief Out of range */
#define BPMP_ERANGE
/** @brief Function not implemented */
#define BPMP_ENOSYS
/** @brief Invalid slot */
#define BPMP_EBADSLT
/** @brief Invalid message */
#define BPMP_EBADMSG
/** @brief Operation not supported */
#define BPMP_EOPNOTSUPP
/** @brief Targeted resource not available */
#define BPMP_ENAVAIL
/** @brief Not supported */
#define BPMP_ENOTSUP
/** @brief No such device or address */
#define BPMP_ENXIO

/** @} Error_Codes */

#if defined(BPMP_ABI_CHECKS)
#include "bpmp_abi_checks.h"
#endif

#endif