xref: /linux/include/soc/tegra/bpmp-abi.h (revision 83c18a324570193140cafc12c88eb1e370564078)
1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
2 /*
3  * Copyright (c) 2014-2025, NVIDIA CORPORATION.  All rights reserved.
4  */
5 
6 #ifndef ABI_BPMP_ABI_H
7 #define ABI_BPMP_ABI_H
8 
9 #if defined(LK) || defined(BPMP_ABI_HAVE_STDC)
10 #include <stddef.h>
11 #include <stdint.h>
12 #endif
13 
14 #ifndef BPMP_ABI_PACKED
15 #ifdef __ABI_PACKED
16 #define BPMP_ABI_PACKED __ABI_PACKED
17 #else
18 #define BPMP_ABI_PACKED __attribute__((packed))
19 #endif
20 #endif
21 
22 #ifdef NO_GCC_EXTENSIONS
23 #define BPMP_ABI_EMPTY char empty;
24 #define BPMP_ABI_EMPTY_ARRAY 1
25 #else
26 #define BPMP_ABI_EMPTY
27 #define BPMP_ABI_EMPTY_ARRAY 0
28 #endif
29 
30 #ifndef BPMP_UNION_ANON
31 #ifdef __UNION_ANON
32 #define BPMP_UNION_ANON __UNION_ANON
33 #else
34 #define BPMP_UNION_ANON
35 #endif
36 #endif
37 
38 /**
39  * @file
40  */
41 
42 /**
43  * @defgroup MRQ MRQ Messages
44  * @brief Messages sent to/from BPMP via IPC
45  * @{
46  *   @defgroup MRQ_Format Message Format
47  *   @defgroup MRQ_Codes Message Request (MRQ) Codes
48  *   @defgroup MRQ_Payloads Message Payloads
49  *   @defgroup Error_Codes Error Codes
50  * @}
51  */
52 
53 /**
54  * @addtogroup MRQ_Format
55  * @{
56  * The CPU requests the BPMP to perform a particular service by
57  * sending it an IVC frame containing a single MRQ message. An MRQ
58  * message consists of a @ref mrq_request followed by a payload whose
59  * format depends on mrq_request::mrq.
60  *
61  * The BPMP processes the data and replies with an IVC frame (on the
62  * same IVC channel) containing and MRQ response. An MRQ response
63  * consists of a @ref mrq_response followed by a payload whose format
64  * depends on the associated mrq_request::mrq.
65  *
66  * A well-defined subset of the MRQ messages that the CPU sends to the
67  * BPMP can lead to BPMP eventually sending an MRQ message to the
68  * CPU. For example, when the CPU uses an #MRQ_THERMAL message to set
69  * a thermal trip point, the BPMP may eventually send a single
70  * #MRQ_THERMAL message of its own to the CPU indicating that the trip
71  * point has been crossed.
72  * @}
73  */
74 
75 /**
76  * @ingroup MRQ_Format
77  *
78  * Request an answer from the peer.
79  * This should be set in mrq_request::flags for all requests targetted
80  * at BPMP. For requests originating in BPMP, this flag is optional except
81  * for messages targeting MCE, for which the field must be set.
82  * When this flag is not set, the remote peer must not send a response
83  * back.
84  */
85 #define BPMP_MAIL_DO_ACK	(1U << 0U)
86 
87 /**
88  * @ingroup MRQ_Format
89  *
90  * Ring the sender's doorbell when responding. This should be set unless
91  * the sender wants to poll the underlying communications layer directly.
92  *
93  * An optional direction that can be specified in mrq_request::flags.
94  */
95 #define BPMP_MAIL_RING_DB	(1U << 1U)
96 
97 /**
98  * @ingroup MRQ_Format
99  *
100  * This is set in mrq_request::flags for requests that have CRC present and
101  * correspondingly in mrq_response::flags for responses that have CRC present.
102  */
103 #define BPMP_MAIL_CRC_PRESENT	(1U << 2U)
104 
105 /**
106  * @ingroup MRQ_Format
107  * @brief Header for an MRQ message
108  *
109  * Provides the MRQ number for the MRQ message: #mrq. The remainder of
110  * the MRQ message is a payload (immediately following the
111  * mrq_request) whose format depends on mrq.
112  */
113 struct mrq_request {
114 	/** @brief MRQ number of the request */
115 	uint32_t mrq;
116 
117 	/**
118 	 * @brief 32bit word containing a number of fields as follows:
119 	 *
120 	 * 	struct {
121 	 * 		uint8_t options:4;
122 	 * 		uint8_t xid:4;
123 	 * 		uint8_t payload_length;
124 	 * 		uint16_t crc16;
125 	 * 	};
126 	 *
127 	 * **options** directions to the receiver and indicates CRC presence.
128 	 *
129 	 * #BPMP_MAIL_DO_ACK and  #BPMP_MAIL_RING_DB see documentation of respective options.
130 	 * #BPMP_MAIL_CRC_PRESENT is supported on T234 and later platforms. It indicates the
131 	 * crc16, xid and length fields are present when set.
132 	 * Some platform configurations, especially when targeted to applications requiring
133 	 * functional safety, mandate this option being set or otherwise will respond with
134 	 * -#BPMP_EBADMSG and ignore the request.
135 	 *
136 	 * **xid** is a transaction ID.
137 	 *
138 	 * Only used when #BPMP_MAIL_CRC_PRESENT is set.
139 	 *
140 	 * **payload_length** of the message expressed in bytes without the size of this header.
141 	 * See tables below for minimum accepted payload lengths for each MRQ.
142 	 *
143 	 * Only used when #BPMP_MAIL_CRC_PRESENT is set.
144 	 *
145 	 * | MRQ                   | Sub-command                           | Minimum payload length
146 	 * | --------------------- | ------------------------------------  | ------------------------------------------------------- |
147 	 * | #MRQ_PING             | -                                     | 4                                                       |
148 	 * | #MRQ_THREADED_PING    | -                                     | 4                                                       |
149 	 * | #MRQ_RESET            | any                                   | 8                                                       |
150 	 * | #MRQ_I2C              | -                                     | 12 + cmd_i2c_xfer_request.data_size                     |
151 	 * | #MRQ_CLK              | #CMD_CLK_GET_RATE                     | 4                                                       |
152 	 * | #MRQ_CLK              | #CMD_CLK_SET_RATE                     | 16                                                      |
153 	 * | #MRQ_CLK              | #CMD_CLK_ROUND_RATE                   | 16                                                      |
154 	 * | #MRQ_CLK              | #CMD_CLK_GET_PARENT                   | 4                                                       |
155 	 * | #MRQ_CLK              | #CMD_CLK_SET_PARENT                   | 8                                                       |
156 	 * | #MRQ_CLK              | #CMD_CLK_ENABLE                       | 4                                                       |
157 	 * | #MRQ_CLK              | #CMD_CLK_DISABLE                      | 4                                                       |
158 	 * | #MRQ_CLK              | #CMD_CLK_IS_ENABLED                   | 4                                                       |
159 	 * | #MRQ_CLK              | #CMD_CLK_GET_ALL_INFO                 | 4                                                       |
160 	 * | #MRQ_CLK              | #CMD_CLK_GET_MAX_CLK_ID               | 4                                                       |
161 	 * | #MRQ_CLK              | #CMD_CLK_GET_FMAX_AT_VMIN             | 4                                                       |
162 	 * | #MRQ_QUERY_ABI        | -                                     | 4                                                       |
163 	 * | #MRQ_PG               | #CMD_PG_QUERY_ABI                     | 12                                                      |
164 	 * | #MRQ_PG               | #CMD_PG_SET_STATE                     | 12                                                      |
165 	 * | #MRQ_PG               | #CMD_PG_GET_STATE                     | 8                                                       |
166 	 * | #MRQ_PG               | #CMD_PG_GET_NAME                      | 8                                                       |
167 	 * | #MRQ_PG               | #CMD_PG_GET_MAX_ID                    | 8                                                       |
168 	 * | #MRQ_THERMAL          | #CMD_THERMAL_QUERY_ABI                | 8                                                       |
169 	 * | #MRQ_THERMAL          | #CMD_THERMAL_GET_TEMP                 | 8                                                       |
170 	 * | #MRQ_THERMAL          | #CMD_THERMAL_GET_NUM_ZONES            | 4                                                       |
171 	 * | #MRQ_THERMAL          | #CMD_THERMAL_GET_THERMTRIP            | 8                                                       |
172 	 * | #MRQ_ABI_RATCHET      | -                                     | 2                                                       |
173 	 * | #MRQ_EMC_DVFS_LATENCY | -                                     | 8                                                       |
174 	 * | #MRQ_QUERY_FW_TAG     | -                                     | 0                                                       |
175 	 * | #MRQ_DEBUG            | #CMD_DEBUG_OPEN_RO                    | 4 + length of cmd_debug_fopen_request.name              |
176 	 * | #MRQ_DEBUG            | #CMD_DEBUG_OPEN_WO                    | 4 + length of cmd_debug_fopen_request.name              |
177 	 * | #MRQ_DEBUG            | #CMD_DEBUG_READ                       | 8                                                       |
178 	 * | #MRQ_DEBUG            | #CMD_DEBUG_WRITE                      | 12 + cmd_debug_fwrite_request.datalen                   |
179 	 * | #MRQ_DEBUG            | #CMD_DEBUG_CLOSE                      | 8                                                       |
180 	 *
181 	 * @cond (bpmp_t186)
182 	 * The following additional MRQ is supported on T186 -platform:
183 	 *
184 	 * | MRQ                   | Sub-command                           | Minimum payload length                |
185 	 * | --------------------- | ------------------------------------- | ------------------------------------- |
186 	 * | #MRQ_CPU_VHINT        | -                                     | 8                                     |
187 	 * | #MRQ_THERMAL          | #CMD_THERMAL_SET_TRIP                 | 20                                    |
188 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_QUERY_ABI        | 8                                     |
189 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_READ             | 5                                     |
190 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_WRITE            | 5 + cmd_ringbuf_console_write_req.len |
191 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_GET_FIFO         | 4                                     |
192 	 * @endcond
193 	 *
194 	 * @cond (bpmp_t194)
195 	 * The following additional MRQs are supported on T194 -platform:
196 	 *
197 	 * | MRQ                   | Sub-command                           | Minimum payload length                |
198 	 * | --------------------- | ------------------------------------- | ------------------------------------- |
199 	 * | #MRQ_CPU_NDIV_LIMITS  | -                                     | 4                                     |
200 	 * | #MRQ_STRAP            | #STRAP_SET                            | 12                                    |
201 	 * | #MRQ_CPU_AUTO_CC3     | -                                     | 4                                     |
202 	 * | #MRQ_EC               | #CMD_EC_STATUS_EX_GET                 | 12                                    |
203 	 * | #MRQ_FMON             | #CMD_FMON_GEAR_CLAMP                  | 16                                    |
204 	 * | #MRQ_FMON             | #CMD_FMON_GEAR_FREE                   | 4                                     |
205 	 * | #MRQ_FMON             | #CMD_FMON_GEAR_GET                    | 4                                     |
206 	 * | #MRQ_FMON             | #CMD_FMON_FAULT_STS_GET               | 8                                     |
207 	 * | #MRQ_THERMAL          | #CMD_THERMAL_SET_TRIP                 | 20                                    |
208 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_QUERY_ABI        | 8                                     |
209 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_READ             | 5                                     |
210 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_WRITE            | 5 + cmd_ringbuf_console_write_req.len |
211 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_GET_FIFO         | 4                                     |
212 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_LANE_MARGIN_CONTROL    | 24                                    |
213 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_LANE_MARGIN_STATUS     | 4                                     |
214 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT | 5                                     |
215 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_CONTROLLER_STATE       | 6                                     |
216 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF  | 5                                     |
217 	 * @endcond
218 	 *
219 	 * @cond (bpmp_safe && bpmp_t234)
220 	 * The following additional MRQ is supported on functional-safety
221 	 * builds for the T234 platform:
222 	 *
223 	 * | MRQ                   | Sub-command                           | Minimum payload length                |
224 	 * | --------------------- | ------------------------------------- | ------------------------------------- |
225 	 * | #MRQ_CPU_NDIV_LIMITS  | -                                     | 4                                     |
226 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_QUERY_ABI        | 8                                     |
227 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_READ             | 5                                     |
228 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_WRITE            | 5 + cmd_ringbuf_console_write_req.len |
229 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_GET_FIFO         | 4                                     |
230 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_LANE_MARGIN_CONTROL    | 24                                    |
231 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_LANE_MARGIN_STATUS     | 4                                     |
232 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT | 5                                     |
233 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_CONTROLLER_STATE       | 6                                     |
234 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF  | 5                                     |
235 	 * | #MRQ_FMON             | #CMD_FMON_GEAR_CLAMP                  | 16                                    |
236 	 * | #MRQ_FMON             | #CMD_FMON_GEAR_FREE                   | 4                                     |
237 	 * | #MRQ_FMON             | #CMD_FMON_GEAR_GET                    | 4                                     |
238 	 * | #MRQ_FMON             | #CMD_FMON_FAULT_STS_GET               | 8                                     |
239 	 * | #MRQ_EMC_DVFS_EMCHUB  | -                                     | 8                                     |
240 	 * | #MRQ_EMC_DISP_RFL     | -                                     | 4                                     |
241 	 *
242 	 * @endcond
243 	 *
244 	 * @cond (!bpmp_safe && bpmp_t234)
245 	 *
246 	 * The following additional MRQs are supported on non-functional-safety
247 	 * builds for the T234 and T238 -platforms:
248 	 *
249 	 * | MRQ                   | Sub-command                           | Minimum payload length                              |
250 	 * | --------------------- | ------------------------------------- | --------------------------------------------------- |
251 	 * | #MRQ_CPU_NDIV_LIMITS  | -                                     | 4                                                   |
252 	 * | #MRQ_STRAP            | #STRAP_SET                            | 12                                                  |
253 	 * | #MRQ_THERMAL          | #CMD_THERMAL_SET_TRIP                 | 20                                                  |
254 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_QUERY_ABI        | 8                                                   |
255 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_READ             | 5                                                   |
256 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_WRITE            | 5 + cmd_ringbuf_console_write_req.len               |
257 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_GET_FIFO         | 4                                                   |
258 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_LANE_MARGIN_CONTROL    | 24                                                  |
259 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_LANE_MARGIN_STATUS     | 4                                                   |
260 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT | 5                                                   |
261 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_CONTROLLER_STATE       | 6                                                   |
262 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF  | 5                                                   |
263 	 * | #MRQ_FMON             | #CMD_FMON_GEAR_CLAMP                  | 16                                                  |
264 	 * | #MRQ_FMON             | #CMD_FMON_GEAR_FREE                   | 4                                                   |
265 	 * | #MRQ_FMON             | #CMD_FMON_GEAR_GET                    | 4                                                   |
266 	 * | #MRQ_FMON             | #CMD_FMON_FAULT_STS_GET               | 8                                                   |
267 	 * | #MRQ_EMC_DVFS_EMCHUB  | -                                     | 8                                                   |
268 	 * | #MRQ_EMC_DISP_RFL     | -                                     | 4                                                   |
269 	 * | #MRQ_BWMGR            | #CMD_BWMGR_QUERY_ABI                  | 8                                                   |
270 	 * | #MRQ_BWMGR            | #CMD_BWMGR_CALC_RATE                  | 8 + 8 * cmd_bwmgr_calc_rate_request.num_iso_clients |
271 	 * | #MRQ_ISO_CLIENT       | #CMD_ISO_CLIENT_QUERY_ABI             | 8                                                   |
272 	 * | #MRQ_ISO_CLIENT       | #CMD_ISO_CLIENT_CALCULATE_LA          | 16                                                  |
273 	 * | #MRQ_ISO_CLIENT       | #CMD_ISO_CLIENT_SET_LA                | 16                                                  |
274 	 * | #MRQ_ISO_CLIENT       | #CMD_ISO_CLIENT_GET_MAX_BW            | 8                                                   |
275 	 * | #MRQ_BWMGR_INT        | #CMD_BWMGR_INT_QUERY_ABI              | 8                                                   |
276 	 * | #MRQ_BWMGR_INT        | #CMD_BWMGR_INT_CALC_AND_SET           | 16                                                  |
277 	 * | #MRQ_BWMGR_INT        | #CMD_BWMGR_INT_CAP_SET                | 8                                                   |
278 	 * | #MRQ_BWMGR_INT        | #CMD_BWMGR_INT_GET_LAST_REQUEST       | 9                                                   |
279 	 * | #MRQ_OC_STATUS        | -                                     | 0                                                   |
280 	 * @endcond
281 	 *
282 	 * @cond bpmp_t238
283 	 * The following additional MRQs are supported on T238 platform:
284 	 *
285 	 * | MRQ                   | Sub-command                           | Minimum payload length                              |
286 	 * | --------------------- | ------------------------------------- | --------------------------------------------------- |
287 	 * | #MRQ_CPU_NDIV_LIMITS  | -                                     | 4                                                   |
288 	 * | #MRQ_STRAP            | #STRAP_SET                            | 12                                                  |
289 	 * | #MRQ_THERMAL          | #CMD_THERMAL_SET_TRIP                 | 20                                                  |
290 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_QUERY_ABI        | 8                                                   |
291 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_READ             | 5                                                   |
292 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_WRITE            | 5 + cmd_ringbuf_console_write_req.len               |
293 	 * | #MRQ_RINGBUF_CONSOLE  | #CMD_RINGBUF_CONSOLE_GET_FIFO         | 4                                                   |
294 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_LANE_MARGIN_CONTROL    | 24                                                  |
295 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_LANE_MARGIN_STATUS     | 4                                                   |
296 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT | 5                                                   |
297 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_CONTROLLER_STATE       | 6                                                   |
298 	 * | #MRQ_UPHY             | #CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF  | 5                                                   |
299 	 * | #MRQ_FMON             | #CMD_FMON_GEAR_CLAMP                  | 16                                                  |
300 	 * | #MRQ_FMON             | #CMD_FMON_GEAR_FREE                   | 4                                                   |
301 	 * | #MRQ_FMON             | #CMD_FMON_GEAR_GET                    | 4                                                   |
302 	 * | #MRQ_FMON             | #CMD_FMON_FAULT_STS_GET               | 8                                                   |
303 	 * | #MRQ_EMC_DVFS_EMCHUB  | -                                     | 8                                                   |
304 	 * | #MRQ_EMC_DISP_RFL     | -                                     | 4                                                   |
305 	 * | #MRQ_BWMGR            | #CMD_BWMGR_QUERY_ABI                  | 8                                                   |
306 	 * | #MRQ_BWMGR            | #CMD_BWMGR_CALC_RATE                  | 8 + 8 * cmd_bwmgr_calc_rate_request.num_iso_clients |
307 	 * | #MRQ_ISO_CLIENT       | #CMD_ISO_CLIENT_QUERY_ABI             | 8                                                   |
308 	 * | #MRQ_ISO_CLIENT       | #CMD_ISO_CLIENT_CALCULATE_LA          | 16                                                  |
309 	 * | #MRQ_ISO_CLIENT       | #CMD_ISO_CLIENT_SET_LA                | 16                                                  |
310 	 * | #MRQ_ISO_CLIENT       | #CMD_ISO_CLIENT_GET_MAX_BW            | 8                                                   |
311 	 * | #MRQ_BWMGR_INT        | #CMD_BWMGR_INT_QUERY_ABI              | 8                                                   |
312 	 * | #MRQ_BWMGR_INT        | #CMD_BWMGR_INT_CALC_AND_SET           | 16                                                  |
313 	 * | #MRQ_BWMGR_INT        | #CMD_BWMGR_INT_CAP_SET                | 8                                                   |
314 	 * | #MRQ_BWMGR_INT        | #CMD_BWMGR_INT_GET_LAST_REQUEST       | 9                                                   |
315 	 * | #MRQ_OC_STATUS        | -                                     | 0                                                   |
316 	 * | #MRQ_THROTTLE         | #CMD_THROTTLE_SET_OC_CONFIG           | 5                                                   |
317 	 * @endcond
318 	 *
319 	 * @cond (bpmp_th500)
320 	 * The following additional MRQs are supported on TH500 -platform:
321 	 *
322 	 * | MRQ                  | Sub-command                           | Minimum payload length |
323 	 * | -------------------- | ------------------------------------- | ---------------------- |
324 	 * | #MRQ_CPU_NDIV_LIMITS | -                                     | 4                      |
325 	 * | #MRQ_THERMAL         | #CMD_THERMAL_SET_TRIP                 | 20                     |
326 	 * | #MRQ_STRAP           | #STRAP_SET                            | 12                     |
327 	 * | #MRQ_SHUTDOWN        | -                                     | 4                      |
328 	 * | #MRQ_UPHY            | #CMD_UPHY_PCIE_LANE_MARGIN_CONTROL    | 24                     |
329 	 * | #MRQ_UPHY            | #CMD_UPHY_PCIE_LANE_MARGIN_STATUS     | 4                      |
330 	 * | #MRQ_UPHY            | #CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT | 5                      |
331 	 * | #MRQ_UPHY            | #CMD_UPHY_PCIE_CONTROLLER_STATE       | 6                      |
332 	 * | #MRQ_UPHY            | #CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF  | 5                      |
333 	 * | #MRQ_UPHY            | #CMD_UPHY_PCIE_CONFIG_VDM             | 3                      |
334 	 * | #MRQ_TELEMETRY       | -                                     | 8                      |
335 	 * | #MRQ_PWR_LIMIT       | #CMD_PWR_LIMIT_QUERY_ABI              | 8                      |
336 	 * | #MRQ_PWR_LIMIT       | #CMD_PWR_LIMIT_SET                    | 20                     |
337 	 * | #MRQ_PWR_LIMIT       | #CMD_PWR_LIMIT_GET                    | 16                     |
338 	 * | #MRQ_PWR_LIMIT       | #CMD_PWR_LIMIT_CURR_CAP               | 8                      |
339 	 * | #MRQ_GEARS           | -                                     | 0                      |
340 	 * | #MRQ_C2C             | #CMD_C2C_QUERY_ABI                    | 8                      |
341 	 * | #MRQ_C2C             | #CMD_C2C_START_INITIALIZATION         | 5                      |
342 	 * | #MRQ_C2C             | #CMD_C2C_GET_STATUS                   | 4                      |
343 	 * | #MRQ_C2C             | #CMD_C2C_HOTRESET_PREP                | 5                      |
344 	 * | #MRQ_C2C             | #CMD_C2C_START_HOTRESET               | 5                      |
345 	 * | #MRQ_THROTTLE        | #CMD_THROTTLE_QUERY_ABI               | 4                      |
346 	 * | #MRQ_THROTTLE        | #CMD_THROTTLE_GET_CHIPTHROT_STATUS    | 4                      |
347 	 * | #MRQ_PWRMODEL        | #CMD_PWRMODEL_QUERY_ABI               | 8                      |
348 	 * | #MRQ_PWRMODEL        | #CMD_PWRMODEL_PWR_GET                 | 16                     |
349 	 * | #MRQ_PWR_CNTRL       | #CMD_PWR_CNTRL_QUERY_ABI              | 8                      |
350 	 * | #MRQ_PWR_CNTRL       | #CMD_PWR_CNTRL_BYPASS_SET             | 12                     |
351 	 * | #MRQ_PWR_CNTRL       | #CMD_PWR_CNTRL_BYPASS_GET             | 8                      |
352 	 * @endcond
353 	 *
354 	 * @cond (bpmp_tb500)
355 	 * The following additional MRQs are supported on TB500 -platform:
356 	 *
357 	 * | MRQ                  | Sub-command                              | Minimum payload length |
358 	 * | -------------------- | ---------------------------------------- | ---------------------- |
359 	 * | #MRQ_PWR_LIMIT       | #CMD_PWR_LIMIT_QUERY_ABI                 | 8                      |
360 	 * | #MRQ_PWR_LIMIT       | #CMD_PWR_LIMIT_SET                       | 20                     |
361 	 * | #MRQ_PWR_LIMIT       | #CMD_PWR_LIMIT_GET                       | 16                     |
362 	 * | #MRQ_PWR_LIMIT       | #CMD_PWR_LIMIT_CURR_CAP                  | 8                      |
363 	 * | #MRQ_TELEMETRY_EX    | #CMD_TELEMETRY_EX_QUERY_ABI              | 8                      |
364 	 * | #MRQ_TELEMETRY_EX    | #CMD_TELEMETRY_EX_BASE_SZ_GET            | 12                     |
365 	 * | #MRQ_THROTTLE        | #CMD_THROTTLE_GET_CHIPTHROT_STATUS       | 4                      |
366 	 * | #MRQ_C2C             | #CMD_C2C_QUERY_ABI                       | 8                      |
367 	 * | #MRQ_C2C             | #CMD_C2C_START_INITIALIZATION            | 5                      |
368 	 * | #MRQ_C2C             | #CMD_C2C_GET_STATUS                      | 4                      |
369 	 * | #MRQ_C2C             | #CMD_C2C_HOTRESET_PREP                   | 5                      |
370 	 * | #MRQ_C2C             | #CMD_C2C_START_HOTRESET                  | 5                      |
371 	 * | MRQ_HWPM             | CMD_HWPM_QUERY_ABI                       | 4                      |
372 	 * | MRQ_HWPM             | CMD_HWPM_IPMU_SET_TRIGGERS               | 120                    |
373 	 * | MRQ_HWPM             | CMD_HWPM_IPMU_SET_PAYLOADS_SHIFTS        | 120                    |
374 	 * | MRQ_HWPM             | CMD_HWPM_IPMU_GET_MAX_PAYLOADS           | 0                      |
375 	 * | MRQ_HWPM             | CMD_HWPM_NVTHERM_SET_SAMPLE_RATE         | 4                      |
376 	 * | MRQ_HWPM             | CMD_HWPM_NVTHERM_SET_BUBBLE_INTERVAL     | 4                      |
377 	 * | MRQ_HWPM             | CMD_HWPM_NVTHERM_SET_FLEX_CHANNELS       | 120                    |
378 	 * | MRQ_HWPM             | CMD_HWPM_ISENSE_GET_SENSOR_NAME          | 4                      |
379 	 * | MRQ_HWPM             | CMD_HWPM_ISENSE_GET_SENSOR_CHANNEL       | 4                      |
380 	 * | MRQ_HWPM             | CMD_HWPM_ISENSE_GET_SENSOR_SCALE_FACTOR  | 4                      |
381 	 * | MRQ_HWPM             | CMD_HWPM_ISENSE_GET_SENSOR_OFFSET        | 4                      |
382 	 * | MRQ_HWPM             | CMD_HWPM_ISENSE_GET_SUM_BLOCK_NAME       | 4                      |
383 	 * | MRQ_HWPM             | CMD_HWPM_ISENSE_GET_SUM_BLOCK_INPUTS     | 4                      |
384 	 * | MRQ_DVFS             | CMD_DVFS_QUERY_ABI                       | 4                      |
385 	 * | MRQ_DVFS             | CMD_DVFS_SET_CTRL_STATE                  | 8                      |
386 	 * | MRQ_DVFS             | CMD_DVFS_SET_MGR_STATE                   | 8                      |
387 	 * | MRQ_PPP_PROFILE      | CMD_PPP_PROFILE_QUERY_ABI                | 8                      |
388 	 * | MRQ_PPP_PROFILE      | CMD_PPP_PROFILE_QUERY_MASKS              | 8                      |
389 	 * | MRQ_PPP_PROFILE      | CMD_PPP_CORE_QUERY_CPU_MASK              | 8                      |
390 	 * | MRQ_PPP_PROFILE      | CMD_PPP_AVAILABLE_QUERY                  | 4                      |
391 	 * @endcond
392 	 *
393 	 * @cond (bpmp_safe && bpmp_t264)
394 	 * The following additional MRQ is supported on functional-safety
395 	 * builds for the T264 platform:
396 	 *
397 	 * | MRQ                  | Sub-command                       | Minimum payload length |
398 	 * | -------------------- | --------------------------------- | ---------------------- |
399 	 * | #MRQ_CPU_NDIV_LIMITS | -                                 | 4                      |
400 	 * | #MRQ_STRAP           | #STRAP_SET                        | 12                     |
401 	 * | #MRQ_SHUTDOWN        | -                                 | 4                      |
402 	 * | #MRQ_FMON            | #CMD_FMON_GEAR_CLAMP              | 16                     |
403 	 * | #MRQ_FMON            | #CMD_FMON_GEAR_FREE               | 4                      |
404 	 * | #MRQ_FMON            | #CMD_FMON_GEAR_GET                | 4                      |
405 	 * | #MRQ_FMON            | #CMD_FMON_FAULT_STS_GET           | 8                      |
406 	 * | #MRQ_PCIE            | #CMD_PCIE_EP_CONTROLLER_INIT      | 5                      |
407 	 * | #MRQ_PCIE            | #CMD_PCIE_EP_CONTROLLER_OFF       | 5                      |
408 	 * | #MRQ_CR7             | #CMD_CR7_ENTRY                    | 12                     |
409 	 * | #MRQ_CR7             | #CMD_CR7_EXIT                     | 12                     |
410 	 * | #MRQ_SLC             | #CMD_SLC_QUERY_ABI                | 8                      |
411 	 * | #MRQ_SLC             | #CMD_SLC_BYPASS_SET               | 8                      |
412 	 * | #MRQ_SLC             | #CMD_SLC_BYPASS_GET               | 4                      |
413 	 * @endcond
414 	 *
415 	 * @cond (!bpmp_safe && bpmp_t264)
416 	 * The following additional MRQs are supported on non-functional-safety
417 	 * builds for the T264 -platform:
418 	 *
419 	 * | MRQ                  | Sub-command                       | Minimum payload length |
420 	 * | -------------------- | --------------------------------- | ---------------------- |
421 	 * | #MRQ_CPU_NDIV_LIMITS | -                                 | 4                      |
422 	 * | #MRQ_STRAP           | #STRAP_SET                        | 12                     |
423 	 * | #MRQ_SHUTDOWN        | -                                 | 4                      |
424 	 * | #MRQ_FMON            | #CMD_FMON_GEAR_CLAMP              | 16                     |
425 	 * | #MRQ_FMON            | #CMD_FMON_GEAR_FREE               | 4                      |
426 	 * | #MRQ_FMON            | #CMD_FMON_GEAR_GET                | 4                      |
427 	 * | #MRQ_FMON            | #CMD_FMON_FAULT_STS_GET           | 8                      |
428 	 * | #MRQ_OC_STATUS       | -                                 | 0                      |
429 	 * | #MRQ_PCIE            | #CMD_PCIE_EP_CONTROLLER_INIT      | 5                      |
430 	 * | #MRQ_PCIE            | #CMD_PCIE_EP_CONTROLLER_OFF       | 5                      |
431 	 * | #MRQ_PCIE            | #CMD_PCIE_RP_CONTROLLER_OFF       | 5                      |
432 	 * | #MRQ_CR7             | #CMD_CR7_ENTRY                    | 12                     |
433 	 * | #MRQ_CR7             | #CMD_CR7_EXIT                     | 12                     |
434 	 * | #MRQ_SLC             | #CMD_SLC_QUERY_ABI                | 8                      |
435 	 * | #MRQ_SLC             | #CMD_SLC_BYPASS_SET               | 8                      |
436 	 * | #MRQ_SLC             | #CMD_SLC_BYPASS_GET               | 4                      |
437 	 * | #MRQ_ISO_CLIENT      | #CMD_ISO_CLIENT_QUERY_ABI         | 8                      |
438 	 * | #MRQ_ISO_CLIENT      | #CMD_ISO_CLIENT_CALCULATE_LA      | 16                     |
439 	 * | #MRQ_ISO_CLIENT      | #CMD_ISO_CLIENT_SET_LA            | 16                     |
440 	 * | #MRQ_ISO_CLIENT      | #CMD_ISO_CLIENT_GET_MAX_BW        | 8                      |
441 	 * | #MRQ_BWMGR_INT       | #CMD_BWMGR_INT_QUERY_ABI          | 8                      |
442 	 * | #MRQ_BWMGR_INT       | #CMD_BWMGR_INT_CALC_AND_SET       | 16                     |
443 	 * | #MRQ_BWMGR_INT       | #CMD_BWMGR_INT_CAP_SET            | 8                      |
444 	 * | #MRQ_BWMGR_INT       | #CMD_BWMGR_INT_CURR_AVAILABLE_BW  | 8                      |
445 	 * | #MRQ_BWMGR_INT       | #CMD_BWMGR_INT_GET_LAST_REQUEST   | 9                      |
446 	 * @endcond
447 	 *
448 	 * **crc16**
449 	 *
450 	 * CRC16 using polynomial x^16 + x^14 + x^12 + x^11 + x^8 + x^5 + x^4 + x^2 + 1
451 	 * and initialization value 0x4657. The CRC is calculated over all bytes of the message
452 	 * including this header. However the crc16 field is considered to be set to 0 when
453 	 * calculating the CRC. Only used when #BPMP_MAIL_CRC_PRESENT is set. If
454 	 * #BPMP_MAIL_CRC_PRESENT is set and this field does not match the CRC as
455 	 * calculated by BPMP, -#BPMP_EBADMSG will be returned and the request will
456 	 * be ignored. See code snippet below on how to calculate the CRC.
457 	 *
458 	 * @code
459 	 *	uint16_t calc_crc_digest(uint16_t crc, uint8_t *data, size_t size)
460 	 *	{
461 	 *		for (size_t i = 0; i < size; i++) {
462 	 *			crc ^= data[i] << 8;
463 	 *			for (size_t j = 0; j < 8; j++) {
464 	 *				if ((crc & 0x8000) == 0x8000) {
465 	 *					crc = (crc << 1) ^ 0xAC9A;
466 	 *				} else {
467 	 *					crc = (crc << 1);
468 	 *				}
469 	 *			}
470 	 *		}
471 	 *		return crc;
472 	 *	}
473 	 *
474 	 *	uint16_t calc_crc(uint8_t *data, size_t size)
475 	 *	{
476 	 *		return calc_crc_digest(0x4657, data, size);
477 	 *	}
478 	 * @endcode
479 	 */
480 	uint32_t flags;
481 } BPMP_ABI_PACKED;
482 
483 /**
484  * @ingroup MRQ_Format
485  * @brief Header for an MRQ response
486  *
487  *  Provides an error code for the associated MRQ message. The
488  *  remainder of the MRQ response is a payload (immediately following
489  *  the mrq_response) whose format depends on the associated
490  *  mrq_request::mrq
491  */
492 struct mrq_response {
493 	/** @brief Error code for the MRQ request itself */
494 	int32_t err;
495 
496 	/**
497 	 * @brief 32bit word containing a number of fields as follows:
498 	 *
499 	 * 	struct {
500 	 * 		uint8_t options:4;
501 	 * 		uint8_t xid:4;
502 	 * 		uint8_t payload_length;
503 	 * 		uint16_t crc16;
504 	 * 	};
505 	 *
506 	 * **options** indicates CRC presence.
507 	 *
508 	 * #BPMP_MAIL_CRC_PRESENT is supported on T234 and later platforms and
509 	 * indicates the crc16 related fields are present when set.
510 	 *
511 	 * **xid** is the transaction ID as sent by the requestor.
512 	 *
513 	 * **length** of the message expressed in bytes without the size of this header.
514 	 * Note: For DMCE communication, this field expresses the length as a multiple of 4 bytes
515 	 * rather than bytes.
516 	 *
517 	 * **crc16**
518 	 *
519 	 * CRC16 using polynomial x^16 + x^14 + x^12 + x^11 + x^8 + x^5 + x^4 + x^2 + 1
520 	 * and initialization value 0x4657. The CRC is calculated over all bytes of the message
521 	 * including this header. However the crc16 field is considered to be set to 0 when
522 	 * calculating the CRC. Only used when #BPMP_MAIL_CRC_PRESENT is set.
523 	 */
524 	uint32_t flags;
525 } BPMP_ABI_PACKED;
526 
527 /**
528  * @ingroup MRQ_Format
529  * Minimum needed size for an IPC message buffer
530  */
531 #define MSG_MIN_SZ	128U
532 /**
533  * @ingroup MRQ_Format
534  *  Minimum size guaranteed for data in an IPC message buffer
535  */
536 #define MSG_DATA_MIN_SZ	120U
537 
538 /**
539  * @ingroup MRQ_Codes
540  * @name Legal MRQ codes
541  * These are the legal values for mrq_request::mrq
542  * @{
543  */
544 
545 #define MRQ_PING		0U
546 #define MRQ_QUERY_TAG		1U
547 #define MRQ_THREADED_PING	9U
548 #define MRQ_DEBUGFS		19U
549 #define MRQ_RESET		20U
550 #define MRQ_I2C			21U
551 #define MRQ_CLK			22U
552 #define MRQ_QUERY_ABI		23U
553 #define MRQ_THERMAL		27U
554 #define MRQ_CPU_VHINT		28U
555 #define MRQ_ABI_RATCHET		29U
556 #define MRQ_EMC_DVFS_LATENCY	31U
557 //adoc: tag::bpmp_dmce_mrq_shutdown[]
558 #define MRQ_SHUTDOWN		49U
559 //adoc: end::bpmp_dmce_mrq_shutdown[]
560 #define MRQ_RINGBUF_CONSOLE	65U
561 #define MRQ_PG			66U
562 #define MRQ_CPU_NDIV_LIMITS	67U
563 #define MRQ_STRAP               68U
564 #define MRQ_UPHY		69U
565 #define MRQ_CPU_AUTO_CC3	70U
566 #define MRQ_QUERY_FW_TAG	71U
567 #define MRQ_FMON		72U
568 #define MRQ_EC			73U
569 #define MRQ_DEBUG		75U
570 #define MRQ_EMC_DVFS_EMCHUB	76U
571 #define MRQ_BWMGR		77U
572 #define MRQ_ISO_CLIENT		78U
573 #define MRQ_EMC_DISP_RFL	79U
574 #define MRQ_TELEMETRY		80U
575 #define MRQ_PWR_LIMIT		81U
576 #define MRQ_GEARS		82U
577 #define MRQ_BWMGR_INT		83U
578 #define MRQ_OC_STATUS		84U
579 #define MRQ_C2C			85U
580 #define MRQ_THROTTLE		86U
581 #define MRQ_PWRMODEL		87U
582 #define MRQ_PCIE		88U
583 #define MRQ_PWR_CNTRL		89U
584 #define MRQ_CR7			90U
585 #define MRQ_SLC			91U
586 #define MRQ_TELEMETRY_EX	92U
587 #define MRQ_HWPM		93U
588 #define MRQ_DVFS		94U
589 #define MRQ_PPP_PROFILE		95U
590 
591 /**
592  * @brief Maximum MRQ code to be sent by CPU software to
593  * BPMP. Subject to change in future
594  */
595 #define MAX_CPU_MRQ_ID		95U
596 
597 /** @} */
598 
599 /**
600  * @addtogroup MRQ_Payloads
601  * @{
602  *   @defgroup Ping Ping
603  *   @defgroup Query_Tag Query Tag
604  *   @defgroup Debugfs Debug File System
605  *   @defgroup Reset Reset
606  *   @defgroup I2C I2C
607  *   @defgroup Clocks Clocks
608  *   @defgroup ABI_info ABI Info
609  *   @defgroup Powergating Power Gating
610  *   @defgroup Thermal Thermal
611  *   @defgroup Throttle Throttle
612  *   @defgroup OC_status OC status
613  *   @defgroup Vhint CPU Voltage hint
614  *   @defgroup EMC EMC
615  *   @defgroup BWMGR BWMGR
616  *   @defgroup ISO_CLIENT ISO_CLIENT
617  *   @defgroup CPU NDIV Limits
618  *   @defgroup RingbufConsole Ring Buffer Console
619  *   @defgroup Strap Straps
620  *   @defgroup UPHY UPHY
621  *   @defgroup CC3 Auto-CC3
622  *   @defgroup FMON FMON
623  *   @defgroup EC EC
624  *   @defgroup Telemetry Telemetry
625  *   @defgroup Pwrlimit PWR_LIMIT
626  *   @defgroup Gears Gears
627  *   @defgroup Shutdown Shutdown
628  *   @defgroup BWMGR_INT Bandwidth Manager Integrated
629  *   @defgroup C2C C2C
630  *   @defgroup Pwrmodel Power Model
631  *   @defgroup Pwrcntrl Power Controllers
632  * @cond bpmp_t264
633  * *  @defgroup PCIE PCIE
634  * *  @defgroup CR7 CR7
635  * *  @defgroup Slc Slc
636  * @endcond
637  * @cond bpmp_tb500
638  * *  @defgroup Telemetry_ex Telemetry Expanded
639  * *  @defgroup HWPM Hardware Performance Monitoring
640  * *  @defgroup DVFS Dynamic Voltage and Frequency Scaling
641  * *  @defgroup PPP power/performance profiles
642  * @endcond
643  * @} MRQ_Payloads
644  */
645 
646 /**
647  * @ingroup MRQ_Codes
648  * @def MRQ_PING
649  * @brief A simple ping
650  *
651  * * Initiators: Any
652  * * Targets: Any
653  * * Request Payload: @ref mrq_ping_request
654  * * Response Payload: @ref mrq_ping_response
655  *
656  * @ingroup MRQ_Codes
657  * @def MRQ_THREADED_PING
658  * @brief A deeper ping
659  *
660  * * Initiators: Any
661  * * Targets: BPMP
662  * * Request Payload: @ref mrq_ping_request
663  * * Response Payload: @ref mrq_ping_response
664  *
665  * Behavior is equivalent to a simple #MRQ_PING except that BPMP
666  * responds from a thread context (providing a slightly more robust
667  * sign of life).
668  *
669  */
670 
671 /**
672  * @ingroup Ping
673  * @brief Request with #MRQ_PING
674  *
675  * Used by the sender of an #MRQ_PING message to request a pong from
676  * recipient. The response from the recipient is computed based on the
677  * mrq_ping_request::challenge -value.
678  */
679 struct mrq_ping_request {
680 /** @brief Arbitrarily chosen value */
681 	uint32_t challenge;
682 } BPMP_ABI_PACKED;
683 
684 /**
685  * @ingroup Ping
686  * @brief Response to #MRQ_PING
687  *
688  * Sent in response to an #MRQ_PING message. #reply should be the
689  * mrq_ping_request challenge left shifted by 1 with the carry-bit
690  * dropped.
691  *
692  */
693 struct mrq_ping_response {
694 	/** @brief Response to the MRQ_PING challege */
695 	uint32_t reply;
696 } BPMP_ABI_PACKED;
697 
698 /**
699  * @ingroup MRQ_Codes
700  * @def MRQ_QUERY_TAG
701  * @brief Query BPMP firmware's tag (i.e. unique identifer)
702  *
703  * @deprecated Use #MRQ_QUERY_FW_TAG instead.
704  *
705  * @details
706  * * Initiators: CCPLEX
707  * * Targets: BPMP
708  * * Request Payload: @ref mrq_query_tag_request
709  * * Response Payload: N/A
710  *
711  */
712 
713 /**
714  * @ingroup Query_Tag
715  * @brief Request with #MRQ_QUERY_TAG
716  *
717  * @deprecated This structure will be removed in future version.
718  * Use #MRQ_QUERY_FW_TAG instead.
719  */
720 struct mrq_query_tag_request {
721   /** @brief Base address to store the firmware tag */
722 	uint32_t addr;
723 } BPMP_ABI_PACKED;
724 
725 
726 /**
727  * @ingroup MRQ_Codes
728  * @def MRQ_QUERY_FW_TAG
729  * @brief Query BPMP firmware's tag (i.e. unique identifier)
730  *
731  * * Initiators: Any
732  * * Targets: BPMP
733  * * Request Payload: N/A
734  * * Response Payload: @ref mrq_query_fw_tag_response
735  *
736  */
737 
738 /**
739  * @ingroup Query_Tag
740  * @brief Response to #MRQ_QUERY_FW_TAG
741  *
742  * Sent in response to #MRQ_QUERY_FW_TAG message. #tag contains the unique
743  * identifier for the version of firmware issuing the reply.
744  */
745 struct mrq_query_fw_tag_response {
746 	/** @brief Array to store tag information */
747 	uint8_t tag[32];
748 } BPMP_ABI_PACKED;
749 
750 /** @private */
751 struct mrq_threaded_ping_request {
752 	uint32_t challenge;
753 } BPMP_ABI_PACKED;
754 
755 /** @private */
756 struct mrq_threaded_ping_response {
757 	uint32_t reply;
758 } BPMP_ABI_PACKED;
759 
760 /**
761  * @ingroup MRQ_Codes
762  * @def MRQ_DEBUGFS
763  * @brief Interact with BPMP's debugfs file nodes
764  *
765  * @deprecated Use #MRQ_DEBUG instead.
766  *
767  * * Initiators: Any
768  * * Targets: BPMP
769  * * Request Payload: @ref mrq_debugfs_request
770  * * Response Payload: @ref mrq_debugfs_response
771  */
772 
773 /**
774  * @addtogroup Debugfs
775  * @{
776  *
777  * The BPMP firmware implements a pseudo-filesystem called
778  * debugfs. Any driver within the firmware may register with debugfs
779  * to expose an arbitrary set of "files" in the filesystem. When
780  * software on the CPU writes to a debugfs file, debugfs passes the
781  * written data to a callback provided by the driver. When software on
782  * the CPU reads a debugfs file, debugfs queries the driver for the
783  * data to return to the CPU. The intention of the debugfs filesystem
784  * is to provide information useful for debugging the system at
785  * runtime.
786  *
787  * @note The files exposed via debugfs are not part of the
788  * BPMP firmware's ABI. debugfs files may be added or removed in any
789  * given version of the firmware. Typically the semantics of a debugfs
790  * file are consistent from version to version but even that is not
791  * guaranteed.
792  *
793  * @}
794  */
795 
796 /** @ingroup Debugfs */
797 enum mrq_debugfs_commands {
798 	/** @brief Perform read */
799 	CMD_DEBUGFS_READ = 1,
800 	/** @brief Perform write */
801 	CMD_DEBUGFS_WRITE = 2,
802 	/** @brief Perform dumping directory */
803 	CMD_DEBUGFS_DUMPDIR = 3,
804 	/** @brief Not a command */
805 	CMD_DEBUGFS_MAX
806 };
807 
808 /**
809  * @ingroup Debugfs
810  * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
811  */
812 struct cmd_debugfs_fileop_request {
813 	/** @brief Physical address pointing at filename */
814 	uint32_t fnameaddr;
815 	/** @brief Length in bytes of filename buffer */
816 	uint32_t fnamelen;
817 	/** @brief Physical address pointing to data buffer */
818 	uint32_t dataaddr;
819 	/** @brief Length in bytes of data buffer */
820 	uint32_t datalen;
821 } BPMP_ABI_PACKED;
822 
823 /**
824  * @ingroup Debugfs
825  * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
826  */
827 struct cmd_debugfs_dumpdir_request {
828 	/** @brief Physical address pointing to data buffer */
829 	uint32_t dataaddr;
830 	/** @brief Length in bytes of data buffer */
831 	uint32_t datalen;
832 } BPMP_ABI_PACKED;
833 
834 /**
835  * @ingroup Debugfs
836  * @brief Response data for CMD_DEBUGFS_READ/WRITE command
837  */
838 struct cmd_debugfs_fileop_response {
839 	/** @brief Always 0 */
840 	uint32_t reserved;
841 	/** @brief Number of bytes read from or written to data buffer */
842 	uint32_t nbytes;
843 } BPMP_ABI_PACKED;
844 
845 /**
846  * @ingroup Debugfs
847  * @brief Response data for CMD_DEBUGFS_DUMPDIR command
848  */
849 struct cmd_debugfs_dumpdir_response {
850 	/** @brief Always 0 */
851 	uint32_t reserved;
852 	/** @brief Number of bytes read from or written to data buffer */
853 	uint32_t nbytes;
854 } BPMP_ABI_PACKED;
855 
856 /**
857  * @ingroup Debugfs
858  * @brief Request with #MRQ_DEBUG.
859  *
860  * The sender of an MRQ_DEBUG message uses #cmd to specify a debugfs
861  * command to execute. Legal commands are the values of @ref
862  * mrq_debugfs_commands. Each command requires a specific additional
863  * payload of data.
864  *
865  * |command            |payload|
866  * |-------------------|-------|
867  * |CMD_DEBUGFS_READ   |fop    |
868  * |CMD_DEBUGFS_WRITE  |fop    |
869  * |CMD_DEBUGFS_DUMPDIR|dumpdir|
870  */
871 struct mrq_debugfs_request {
872 	/** @brief Sub-command (@ref mrq_debugfs_commands) */
873 	uint32_t cmd;
874 	union {
875 		struct cmd_debugfs_fileop_request fop;
876 		struct cmd_debugfs_dumpdir_request dumpdir;
877 	} BPMP_UNION_ANON;
878 } BPMP_ABI_PACKED;
879 
880 /**
881  * @ingroup Debugfs
882  */
883 struct mrq_debugfs_response {
884 	/** @brief Always 0 */
885 	int32_t reserved;
886 	union {
887 		/** @brief Response data for CMD_DEBUGFS_READ OR
888 		 * CMD_DEBUGFS_WRITE command
889 		 */
890 		struct cmd_debugfs_fileop_response fop;
891 		/** @brief Response data for CMD_DEBUGFS_DUMPDIR command */
892 		struct cmd_debugfs_dumpdir_response dumpdir;
893 	} BPMP_UNION_ANON;
894 } BPMP_ABI_PACKED;
895 
896 /**
897  * @addtogroup Debugfs
898  * @{
899  */
900 #define DEBUGFS_S_ISDIR	(1 << 9)
901 #define DEBUGFS_S_IRUSR	(1 << 8)
902 #define DEBUGFS_S_IWUSR	(1 << 7)
903 /** @} Debugfs */
904 
905 /**
906  * @ingroup MRQ_Codes
907  * @def MRQ_DEBUG
908  * @brief Interact with BPMP-FW debugfs file nodes. Use message payload
909  * for exchanging data. This is functionally equivalent to
910  * the deprecated MRQ_DEBUGFS but the way in which data is exchanged is
911  * different. When software running on CPU tries to read a debugfs file,
912  * the file path and read data will be stored in message payload.
913  * Since the message payload size is limited, a debugfs file
914  * transaction might require multiple frames of data exchanged
915  * between BPMP and CPU until the transaction completes.
916  *
917  * * Initiators: Any
918  * * Targets: BPMP
919  * * Request Payload: @ref mrq_debug_request
920  * * Response Payload: @ref mrq_debug_response
921  */
922 
923 /** @ingroup Debugfs */
924 enum mrq_debug_commands {
925 	/**
926 	 * @brief Open file represented by the path in
927 	 * cmd_debug_fopen_request::name for read operation
928 	 */
929 	CMD_DEBUG_OPEN_RO = 0,
930 	/**
931 	 * @brief Open file represented by the path in
932 	 * cmd_debug_fopen_request::name for write operation
933 	 */
934 	CMD_DEBUG_OPEN_WO = 1,
935 	/**
936 	 * @brief Perform read on a previously opened file handle represented
937 	 *        by the cmd_debug_fread_request::fd -value.
938 	 */
939 	CMD_DEBUG_READ = 2,
940 	/**
941 	 * @brief Perform write on a previously opened file handle represented
942 	 *        by the cmd_debug_fwrite_request::fd -value.
943 	 */
944 	CMD_DEBUG_WRITE = 3,
945 	/**
946 	 * @brief Close previously opened file handle.
947 	 */
948 	CMD_DEBUG_CLOSE = 4,
949 	/**
950 	 * @brief Not a command, represents maximum number of supported
951 	 *        sub-commands
952 	 */
953 	CMD_DEBUG_MAX
954 };
955 
956 /**
957  * @ingroup Debugfs
958  * @brief Maximum number of files that can be open at a given time
959  */
960 #define DEBUG_MAX_OPEN_FILES	1
961 
962 /**
963  * @ingroup Debugfs
964  * @brief Maximum size of null-terminated file name string in bytes.
965  * Value is derived from memory available in message payload while
966  * using @ref cmd_debug_fopen_request
967  * Value 4 corresponds to size of @ref mrq_debug_commands
968  * in @ref mrq_debug_request.
969  * 120 - 4 dbg_cmd(32bit)  = 116
970  */
971 #define DEBUG_FNAME_MAX_SZ	(MSG_DATA_MIN_SZ - 4)
972 
973 /**
974  * @ingroup Debugfs
975  * @brief Parameters for #CMD_DEBUG_OPEN_RO and #CMD_DEBUG_OPEN_WO -commands
976  */
977 struct cmd_debug_fopen_request {
978 	/**
979 	 * @brief File name - Null-terminated string with maximum
980 	 *        length including the terminator defined by the
981 	 *        #DEBUG_FNAME_MAX_SZ -preprocessor constant.
982 	 */
983 	char name[DEBUG_FNAME_MAX_SZ];
984 } BPMP_ABI_PACKED;
985 
986 /**
987  * @ingroup Debugfs
988  * @brief Response data for #CMD_DEBUG_OPEN_RO and #CMD_DEBUG_OPEN_WO commands
989  */
990 struct cmd_debug_fopen_response {
991 	/** @brief Identifier for file access */
992 	uint32_t fd;
993 	/** @brief Data length. File data size for READ command.
994 	 *         Maximum allowed length for WRITE command
995 	 */
996 	uint32_t datalen;
997 } BPMP_ABI_PACKED;
998 
999 /**
1000  * @ingroup Debugfs
1001  * @brief Parameters for #CMD_DEBUG_READ command
1002  */
1003 struct cmd_debug_fread_request {
1004 	/**
1005 	 * @brief File access identifier received in response
1006 	 *        to #CMD_DEBUG_OPEN_RO request
1007 	 */
1008 	uint32_t fd;
1009 } BPMP_ABI_PACKED;
1010 
1011 /**
1012  * @ingroup Debugfs
1013  * @brief Maximum size of read data in bytes.
1014  * Value is derived from memory available in message payload while
1015  * using @ref cmd_debug_fread_response.
1016  */
1017 #define DEBUG_READ_MAX_SZ	(MSG_DATA_MIN_SZ - 4)
1018 
1019 /**
1020  * @ingroup Debugfs
1021  * @brief Response data for #CMD_DEBUG_READ command
1022  */
1023 struct cmd_debug_fread_response {
1024 	/** @brief Size of data provided in this response in bytes */
1025 	uint32_t readlen;
1026 	/** @brief File data from seek position */
1027 	char data[DEBUG_READ_MAX_SZ];
1028 } BPMP_ABI_PACKED;
1029 
1030 /**
1031  * @ingroup Debugfs
1032  * @brief Maximum size of write data in bytes.
1033  * Value is derived from memory available in message payload while
1034  * using @ref cmd_debug_fwrite_request.
1035  */
1036 #define DEBUG_WRITE_MAX_SZ	(MSG_DATA_MIN_SZ - 12)
1037 
1038 /**
1039  * @ingroup Debugfs
1040  * @brief Parameters for #CMD_DEBUG_WRITE command
1041  */
1042 struct cmd_debug_fwrite_request {
1043 	/** @brief File access identifier received in response
1044 	 *         to prior #CMD_DEBUG_OPEN_RO -request
1045 	 */
1046 	uint32_t fd;
1047 	/** @brief Size of write data in bytes */
1048 	uint32_t datalen;
1049 	/** @brief Data to be written */
1050 	char data[DEBUG_WRITE_MAX_SZ];
1051 } BPMP_ABI_PACKED;
1052 
1053 /**
1054  * @ingroup Debugfs
1055  * @brief Parameters for #CMD_DEBUG_CLOSE command
1056  */
1057 struct cmd_debug_fclose_request {
1058 	/**
1059 	 * @brief File access identifier received in prior response
1060 	 *        to #CMD_DEBUG_OPEN_RO or #CMD_DEBUG_OPEN_WO -request.
1061 	 */
1062 	uint32_t fd;
1063 } BPMP_ABI_PACKED;
1064 
1065 /**
1066  * @ingroup Debugfs
1067  * @brief Request with #MRQ_DEBUG.
1068  *
1069  * The sender of an #MRQ_DEBUG message uses mrq_debug_request::cmd to specify
1070  * which debugfs sub-command to execute. Legal sub-commands are the values
1071  * specified in the @ref mrq_debug_commands -enumeration. Each sub-command
1072  * requires a specific additional payload of data according to the following
1073  * table:
1074  *
1075  * |Sub-command         |Payload structure          |
1076  * |--------------------|---------------------------|
1077  * |#CMD_DEBUG_OPEN_RO  |cmd_debug_fopen_request    |
1078  * |#CMD_DEBUG_OPEN_WO  |cmd_debug_fopen_request    |
1079  * |#CMD_DEBUG_READ     |cmd_debug_fread_request    |
1080  * |#CMD_DEBUG_WRITE    |cmd_debug_fwrite_request   |
1081  * |#CMD_DEBUG_CLOSE    |cmd_debug_fclose_request   |
1082  */
1083 struct mrq_debug_request {
1084 	/** @brief Sub-command identifier from @ref mrq_debug_commands */
1085 	uint32_t cmd;
1086 	union {
1087 		/**
1088 		 * @brief Request payload for #CMD_DEBUG_OPEN_RO and
1089 		 *        #CMD_DEBUG_OPEN_WO sub-commands
1090 		 */
1091 		struct cmd_debug_fopen_request fop;
1092 		/** @brief Request payload for #CMD_DEBUG_READ sub-command */
1093 		struct cmd_debug_fread_request frd;
1094 		/** @brief Request payload for #CMD_DEBUG_WRITE sub-command */
1095 		struct cmd_debug_fwrite_request fwr;
1096 		/** @brief Request payload for #CMD_DEBUG_CLOSE sub-command */
1097 		struct cmd_debug_fclose_request fcl;
1098 	} BPMP_UNION_ANON;
1099 } BPMP_ABI_PACKED;
1100 
1101 /**
1102  * @ingroup Debugfs
1103  */
1104 struct mrq_debug_response {
1105 	union {
1106 		/**
1107 		 * @brief Response data for the #CMD_DEBUG_OPEN_RO and
1108 		 *        #CMD_DEBUG_OPEN_WO sub-commands
1109 		 */
1110 		struct cmd_debug_fopen_response fop;
1111 		/** @brief Response data for the #CMD_DEBUG_READ sub-command */
1112 		struct cmd_debug_fread_response frd;
1113 	} BPMP_UNION_ANON;
1114 } BPMP_ABI_PACKED;
1115 
1116 /**
1117  * @ingroup MRQ_Codes
1118  * @def MRQ_RESET
1119  * @brief Reset an IP block
1120  *
1121  * * Initiators: Any
1122  * * Targets: BPMP
1123  * * Request Payload: @ref mrq_reset_request
1124  * * Response Payload: @ref mrq_reset_response
1125  *
1126  * @addtogroup Reset
1127  * @{
1128  */
1129 
1130 /**
1131  * @brief Sub-command identifiers for #MRQ_RESET
1132  */
1133 enum mrq_reset_commands {
1134 	/**
1135 	 * @brief Assert module reset
1136 	 *
1137 	 * mrq_response::err is
1138 	 * * 0 if the operation was successful
1139 	 * * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid
1140 	 * * -#BPMP_EACCES if mrq master is not an owner of target domain reset
1141 	 * * -#BPMP_ENOTSUP if target domain h/w state does not allow reset
1142 	 */
1143 	CMD_RESET_ASSERT = 1,
1144 	/**
1145 	 * @brief Deassert module reset
1146 	 *
1147 	 * mrq_response::err is
1148 	 * * 0 if the operation was successful
1149 	 * * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid
1150 	 * * -#BPMP_EACCES if mrq master is not an owner of target domain reset
1151 	 * * -#BPMP_ENOTSUP if target domain h/w state does not allow reset
1152 	 */
1153 	CMD_RESET_DEASSERT = 2,
1154 	/**
1155 	 * @brief Assert and deassert the module reset
1156 	 *
1157 	 * mrq_response::err is
1158 	 * * 0 if the operation was successful
1159 	 * * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid
1160 	 * * -#BPMP_EACCES if mrq master is not an owner of target domain reset
1161 	 * * -#BPMP_ENOTSUP if target domain h/w state does not allow reset
1162 	 */
1163 	CMD_RESET_MODULE = 3,
1164 	/**
1165 	 * @brief Get the highest reset ID
1166 	 *
1167 	 * mrq_response::err is
1168 	 * * 0 if the operation was successful
1169 	 * * -#BPMP_ENODEV if no reset domains are supported (number of IDs is 0)
1170 	 */
1171 	CMD_RESET_GET_MAX_ID = 4,
1172 
1173 	/** @brief Not part of ABI and subject to change */
1174 	CMD_RESET_MAX,
1175 };
1176 
1177 /**
1178  * @brief Request with #MRQ_RESET
1179  *
1180  * Used by the sender of an #MRQ_RESET message to request BPMP to
1181  * assert or deassert a given reset line.
1182  */
1183 struct mrq_reset_request {
1184 	/** @brief Reset action to perform, from @ref mrq_reset_commands */
1185 	uint32_t cmd;
1186 	/** @brief ID of the reset to affected, from @ref bpmp_reset_ids */
1187 	uint32_t reset_id;
1188 } BPMP_ABI_PACKED;
1189 
1190 /**
1191  * @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When
1192  * this sub-command is not supported, firmware will return -BPMP_EBADCMD
1193  * in mrq_response::err.
1194  */
1195 struct cmd_reset_get_max_id_response {
1196 	/** @brief Max reset id */
1197 	uint32_t max_id;
1198 } BPMP_ABI_PACKED;
1199 
1200 /**
1201  * @brief Response with MRQ_RESET
1202  *
1203  * Each sub-command supported by @ref mrq_reset_request may return
1204  * sub-command-specific data. Some do and some do not as indicated
1205  * in the following table:
1206  *
1207  * | sub-command          | payload          |
1208  * |----------------------|------------------|
1209  * | CMD_RESET_ASSERT     | -                |
1210  * | CMD_RESET_DEASSERT   | -                |
1211  * | CMD_RESET_MODULE     | -                |
1212  * | CMD_RESET_GET_MAX_ID | reset_get_max_id |
1213  */
1214 struct mrq_reset_response {
1215 	union {
1216 		struct cmd_reset_get_max_id_response reset_get_max_id;
1217 	} BPMP_UNION_ANON;
1218 } BPMP_ABI_PACKED;
1219 
1220 /** @} Reset */
1221 
1222 /**
1223  * @ingroup MRQ_Codes
1224  * @def MRQ_I2C
1225  * @brief Issue an i2c transaction
1226  *
1227  * * Initiators: Any
1228  * * Targets: BPMP
1229  * * Request Payload: @ref mrq_i2c_request
1230  * * Response Payload: @ref mrq_i2c_response
1231  *
1232  * @addtogroup I2C
1233  * @{
1234  */
1235 
1236 /**
1237  * @brief Size of the cmd_i2c_xfer_request::data_buf -member array in bytes.
1238  */
1239 #define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE	(MSG_DATA_MIN_SZ - 12U)
1240 
1241 /**
1242  * @brief Size of the cmd_i2c_xfer_response::data_buf -member array in bytes.
1243  */
1244 #define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE	(MSG_DATA_MIN_SZ - 4U)
1245 
1246 /**
1247  * @defgroup seriali2c_flags I2C flags
1248  *
1249  * @brief I2C transaction modifier flags for each transaction segment
1250  * in #MRQ_I2C subcommand CMD_I2C_XFER
1251  */
1252 
1253 /**
1254  * @addtogroup seriali2c_flags
1255  * @{
1256  */
1257 
1258 /** @brief when set, use 10-bit I2C slave address */
1259 #define SERIALI2C_TEN           0x0010U
1260 /** @brief when set, perform a Read transaction */
1261 #define SERIALI2C_RD            0x0001U
1262 /**
1263  * @brief when set, no repeated START is issued between the segments
1264  * of transaction. This flag is ignored for the first segment as any
1265  * transaction always starts with a START condition
1266  */
1267 #define SERIALI2C_NOSTART       0x4000U
1268 /**
1269  * @brief when set, a no-ACK from slave device is ignored and treated
1270  * always as success
1271  */
1272 #define SERIALI2C_IGNORE_NAK    0x1000U
1273 /** @} seriali2c_flags */
1274 
1275 /** brief Unused flag. Retained for backwards compatibility. */
1276 #define SERIALI2C_STOP          0x8000U
1277 /** brief Unused flag. Retained for backwards compatibility. */
1278 #define SERIALI2C_REV_DIR_ADDR  0x2000U
1279 /** brief Unused flag. Retained for backwards compatibility. */
1280 #define SERIALI2C_NO_RD_ACK     0x0800U
1281 /** brief Unused flag. Retained for backwards compatibility. */
1282 #define SERIALI2C_RECV_LEN      0x0400U
1283 
1284 /**
1285  * @brief Supported I2C sub-command identifiers
1286  */
1287 enum mrq_i2c_commands {
1288 	/** @brief Perform an I2C transaction */
1289 	CMD_I2C_XFER = 1
1290 };
1291 
1292 /**
1293  * @brief Serializable i2c request
1294  *
1295  * Instances of this structure are packed (little-endian) into
1296  * cmd_i2c_xfer_request::data_buf. Each instance represents a single
1297  * transaction (or a portion of a transaction with repeated starts) on
1298  * an i2c bus.
1299  *
1300  * Because these structures are packed, some instances are likely to
1301  * be misaligned. Additionally because #data is variable length, it is
1302  * not possible to iterate through a serialized list of these
1303  * structures without inspecting #len in each instance.  It may be
1304  * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf
1305  * manually rather than using this structure definition.
1306 */
1307 struct serial_i2c_request {
1308 	/** @brief I2C slave address */
1309 	uint16_t addr;
1310 	/** @brief Bitmask of @ref seriali2c_flags */
1311 	uint16_t flags;
1312 	/** @brief Length of I2C transaction in bytes */
1313 	uint16_t len;
1314 	/** @brief For write transactions only, #len bytes of data */
1315 	uint8_t data[];
1316 } BPMP_ABI_PACKED;
1317 
1318 /**
1319  * @brief Trigger one or more i2c transactions
1320  */
1321 struct cmd_i2c_xfer_request {
1322 	/**
1323 	 * @brief Tegra PWR_I2C bus identifier
1324 	 *
1325 	 * @cond (bpmp_t186 || bpmp_t194 || bpmp_t234 || bpmp_t238 || bpmp_t264)
1326 	 * Must be set to 5.
1327 	 * @endcond
1328 	 *
1329 	 * @cond (bpmp_th500)
1330 	 * Must be set to 1.
1331 	 * @endcond
1332 	 */
1333 	uint32_t bus_id;
1334 
1335 	/** @brief Count of valid bytes in #data_buf*/
1336 	uint32_t data_size;
1337 
1338 	/** @brief Serialized packed instances of @ref serial_i2c_request*/
1339 	uint8_t data_buf[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE];
1340 } BPMP_ABI_PACKED;
1341 
1342 /**
1343  * @brief Container for data read from the i2c bus
1344  *
1345  * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute
1346  * zero or more I2C reads. The data read from the bus is serialized
1347  * into #data_buf.
1348  */
1349 struct cmd_i2c_xfer_response {
1350 	/** @brief Count of valid bytes in #data_buf*/
1351 	uint32_t data_size;
1352 	/** @brief I2C read data */
1353 	uint8_t data_buf[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE];
1354 } BPMP_ABI_PACKED;
1355 
1356 /**
1357  * @brief Request with #MRQ_I2C
1358  */
1359 struct mrq_i2c_request {
1360 	/** @brief Always CMD_I2C_XFER (i.e. 1) */
1361 	uint32_t cmd;
1362 	/** @brief Parameters of the transfer request */
1363 	struct cmd_i2c_xfer_request xfer;
1364 } BPMP_ABI_PACKED;
1365 
1366 /**
1367  * @brief Response to #MRQ_I2C
1368  *
1369  * mrq_response::err value for this response is defined as:
1370  *
1371  * | Value              | Description                                                         |
1372  * |--------------------|---------------------------------------------------------------------|
1373  * | 0                  | Success                                                             |
1374  * | -#BPMP_EBADCMD     | mrq_i2c_request::cmd is other than 1                                |
1375  * | -#BPMP_EINVAL      | cmd_i2c_xfer_request does not contain correctly formatted request   |
1376  * | -#BPMP_ENODEV      | cmd_i2c_xfer_request::bus_id is not supported by BPMP               |
1377  * | -#BPMP_EACCES      | I2C transaction is not allowed due to firewall rules                |
1378  * | -#BPMP_ETIMEDOUT   | I2C transaction times out                                           |
1379  * | -#BPMP_ENXIO       | I2C slave device does not reply with ACK to the transaction         |
1380  * | -#BPMP_EAGAIN      | ARB_LOST condition is detected by the I2C controller                |
1381  * | -#BPMP_EIO         | Any other I2C controller error code than NO_ACK or ARB_LOST         |
1382  */
1383 struct mrq_i2c_response {
1384 	struct cmd_i2c_xfer_response xfer;
1385 } BPMP_ABI_PACKED;
1386 
1387 /** @} I2C */
1388 
1389 /**
1390  * @ingroup MRQ_Codes
1391  * @def MRQ_CLK
1392  * @brief Perform a clock operation
1393  *
1394  * * Initiators: Any
1395  * * Targets: BPMP
1396  * * Request Payload: @ref mrq_clk_request
1397  * * Response Payload: @ref mrq_clk_response
1398  *
1399  * @addtogroup Clocks
1400  * @{
1401  */
1402 
1403 /**
1404  * @brief Sub-command identifiers for #MRQ_CLK
1405  */
1406 enum mrq_clk_commands {
1407 	/** Get clock rate */
1408 	CMD_CLK_GET_RATE = 1,
1409 
1410 	/** Set clock rate */
1411 	CMD_CLK_SET_RATE = 2,
1412 
1413 	/** Get attainable clock rate closer to a given rate */
1414 	CMD_CLK_ROUND_RATE = 3,
1415 
1416 	/** Get parent clock identifier for a given clock */
1417 	CMD_CLK_GET_PARENT = 4,
1418 
1419 	/** Change clock parent */
1420 	CMD_CLK_SET_PARENT = 5,
1421 
1422 	/** Get clock enable status */
1423 	CMD_CLK_IS_ENABLED = 6,
1424 
1425 	/** Enable a clock */
1426 	CMD_CLK_ENABLE = 7,
1427 
1428 	/** Disable a clock */
1429 	CMD_CLK_DISABLE = 8,
1430 
1431 	/** Get all information about a clock */
1432 	CMD_CLK_GET_ALL_INFO = 14,
1433 
1434 	/** Get largest supported clock identifier */
1435 	CMD_CLK_GET_MAX_CLK_ID = 15,
1436 
1437 	/** Get clock maximum rate at VMIN */
1438 	CMD_CLK_GET_FMAX_AT_VMIN = 16,
1439 
1440 	/** Largest supported #MRQ_CLK sub-command identifier + 1 */
1441 	CMD_CLK_MAX,
1442 };
1443 
1444 /**
1445  * Flag bit set in cmd_clk_get_all_info_response::flags -field when clock
1446  * supports changing of the parent clock at runtime.
1447  */
1448 #define BPMP_CLK_HAS_MUX	(1U << 0U)
1449 
1450 /**
1451  * Flag bit set in cmd_clk_get_all_info_response::flags -field when clock
1452  * supports changing the clock rate at runtime.
1453  */
1454 #define BPMP_CLK_HAS_SET_RATE	(1U << 1U)
1455 
1456 /**
1457  * Flag bit set in cmd_clk_get_all_info_response::flags -field when clock is a
1458  * root clock without visible parents.
1459  */
1460 #define BPMP_CLK_IS_ROOT	(1U << 2U)
1461 
1462 #define BPMP_CLK_IS_VAR_ROOT	(1U << 3U)
1463 
1464 /**
1465  * @brief Protection against rate and parent changes
1466  *
1467  * #MRQ_CLK command #CMD_CLK_SET_RATE or #MRQ_CLK command #CMD_CLK_SET_PARENT
1468  * will return -#BPMP_EACCES.
1469  */
1470 #define BPMP_CLK_RATE_PARENT_CHANGE_DENIED (1U << 30)
1471 
1472 /**
1473  * @brief Protection against state changes
1474  *
1475  * #MRQ_CLK command #CMD_CLK_ENABLE or #MRQ_CLK command #CMD_CLK_DISABLE
1476  * will return -#BPMP_EACCES.
1477  */
1478 #define BPMP_CLK_STATE_CHANGE_DENIED (1U << 31)
1479 
1480 /**
1481  * Size of the cmd_clk_get_all_info_response::name -array in number
1482  * of elements.
1483  */
1484 #define MRQ_CLK_NAME_MAXLEN	40U
1485 
1486 /**
1487  * @brief Maximum number of elements in parent_id arrays of clock info responses.
1488  */
1489 #define MRQ_CLK_MAX_PARENTS	16U
1490 
1491 /**
1492  * @brief Request payload for #MRQ_CLK sub-command #CMD_CLK_GET_RATE
1493  *
1494  * This structure is an empty placeholder for future expansion of this
1495  * sub-command.
1496  */
1497 struct cmd_clk_get_rate_request {
1498 	BPMP_ABI_EMPTY
1499 } BPMP_ABI_PACKED;
1500 
1501 /**
1502  * @brief Response payload for #MRQ_CLK sub-command #CMD_CLK_GET_RATE
1503  */
1504 struct cmd_clk_get_rate_response {
1505 	/**
1506 	 * Current rate of the given clock in Hz if mrq_response::err is 0 to
1507 	 * indicate successful #CMD_CLK_GET_RATE -request.
1508 	 */
1509 	int64_t rate;
1510 } BPMP_ABI_PACKED;
1511 
1512 /**
1513  * @brief Request payload for #MRQ_CLK sub-command #CMD_CLK_SET_RATE
1514  */
1515 struct cmd_clk_set_rate_request {
1516 	/** Unused / reserved field. */
1517 	int32_t unused;
1518 
1519 	/** Requested rate of the clock in Hz. */
1520 	int64_t rate;
1521 } BPMP_ABI_PACKED;
1522 
1523 /**
1524  * @brief Response payload for #MRQ_CLK sub-command #CMD_CLK_SET_RATE
1525  */
1526 struct cmd_clk_set_rate_response {
1527 	/**
1528 	 * If request was successful (mrq_response::err is 0), set to the new
1529 	 * rate of the given clock in Hz.
1530 	 */
1531 	int64_t rate;
1532 } BPMP_ABI_PACKED;
1533 
1534 /**
1535  * @brief Request payload for #MRQ_CLK sub-command #CMD_CLK_ROUND_RATE
1536  */
1537 struct cmd_clk_round_rate_request {
1538 	/** Unused / reserved field. */
1539 	int32_t unused;
1540 
1541 	/** Target rate for the clock */
1542 	int64_t rate;
1543 } BPMP_ABI_PACKED;
1544 
1545 /**
1546  * @brief Response payload for #MRQ_CLK sub-command #CMD_CLK_ROUND_RATE
1547  */
1548 struct cmd_clk_round_rate_response {
1549 	/**
1550 	 * The attainable rate if request was successful
1551 	 * (mrq_response::err is 0).
1552 	 */
1553 	int64_t rate;
1554 } BPMP_ABI_PACKED;
1555 
1556 /**
1557  * @brief Request payload for #MRQ_CLK sub-command #CMD_CLK_GET_PARENT
1558  *
1559  * This structure is an empty placeholder for future expansion of this
1560  * sub-command.
1561  */
1562 struct cmd_clk_get_parent_request {
1563 	BPMP_ABI_EMPTY
1564 } BPMP_ABI_PACKED;
1565 
1566 /**
1567  * @brief Response payload for #MRQ_CLK sub-command #CMD_CLK_GET_PARENT
1568  */
1569 struct cmd_clk_get_parent_response {
1570 	/**
1571 	 * The clock identifier of the parent clock if request was successful
1572 	 * (mrq_response::err is 0).
1573 	 */
1574 	uint32_t parent_id;
1575 } BPMP_ABI_PACKED;
1576 
1577 /**
1578  * @brief Request payload for #MRQ_CLK sub-command #CMD_CLK_SET_PARENT
1579  */
1580 struct cmd_clk_set_parent_request {
1581 	/**
1582 	 * The clock identifier of the new parent clock.
1583 	 */
1584 	uint32_t parent_id;
1585 } BPMP_ABI_PACKED;
1586 
1587 /**
1588  * @brief Response payload for #MRQ_CLK sub-command #CMD_CLK_SET_PARENT
1589  */
1590 struct cmd_clk_set_parent_response {
1591 	/**
1592 	 * The clock identifier of the new parent clock if request was
1593 	 * successful (mrq_response::err is 0).
1594 	 */
1595 	uint32_t parent_id;
1596 } BPMP_ABI_PACKED;
1597 
1598 /**
1599  * @brief Request payload for #CMD_CLK_IS_ENABLED -sub-command
1600  *
1601  * This structure is an empty placeholder for future expansion of this
1602  * sub-command.
1603  */
1604 struct cmd_clk_is_enabled_request {
1605 	BPMP_ABI_EMPTY
1606 } BPMP_ABI_PACKED;
1607 
1608 /**
1609  * @brief Response payload for #MRQ_CLK sub-command #CMD_CLK_IS_ENABLED
1610  */
1611 struct cmd_clk_is_enabled_response {
1612 	/**
1613 	 * @brief The state of the clock that has been successfully
1614 	 * requested with #CMD_CLK_ENABLE or #CMD_CLK_DISABLE by the
1615 	 * master invoking the command earlier.
1616 	 *
1617 	 * The state may not reflect the physical state of the clock
1618 	 * if there are some other masters requesting it to be
1619 	 * enabled. Valid values:
1620 	 *
1621 	 * * Value 0: The clock is disabled,
1622 	 * * Value 1: The clock is enabled.
1623 	 */
1624 	int32_t state;
1625 } BPMP_ABI_PACKED;
1626 
1627 /**
1628  * @brief Request payload for #MRQ_CLK sub-command #CMD_CLK_ENABLE
1629  *
1630  * This structure is an empty placeholder for future expansion of this
1631  * sub-command.
1632  */
1633 struct cmd_clk_enable_request {
1634 	BPMP_ABI_EMPTY
1635 } BPMP_ABI_PACKED;
1636 
1637 /**
1638  * @brief Response payload for #MRQ_CLK sub-command #CMD_CLK_ENABLE
1639  *
1640  * This structure is an empty placeholder for future expansion of this
1641  * sub-command.
1642  */
1643 struct cmd_clk_enable_response {
1644 	BPMP_ABI_EMPTY
1645 } BPMP_ABI_PACKED;
1646 
1647 /**
1648  * @brief Request payload for #MRQ_CLK sub-command #CMD_CLK_DISABLE
1649  *
1650  * This structure is an empty placeholder for future expansion of this
1651  * sub-command.
1652  */
1653 struct cmd_clk_disable_request {
1654 	BPMP_ABI_EMPTY
1655 } BPMP_ABI_PACKED;
1656 
1657 /**
1658  * @brief Response payload for #MRQ_CLK sub-command #CMD_CLK_DISABLE
1659  *
1660  * This structure is an empty placeholder for future expansion of this
1661  * sub-command.
1662  */
1663 struct cmd_clk_disable_response {
1664 	BPMP_ABI_EMPTY
1665 } BPMP_ABI_PACKED;
1666 
1667 /**
1668  * @brief Request payload for #MRQ_CLK sub-command #CMD_CLK_GET_ALL_INFO
1669  *
1670  * This structure is an empty placeholder for future expansion of this
1671  * sub-command.
1672  */
1673 struct cmd_clk_get_all_info_request {
1674 	BPMP_ABI_EMPTY
1675 } BPMP_ABI_PACKED;
1676 
1677 
1678 /**
1679  * @brief Response payload for #MRQ_CLK sub-command #CMD_CLK_GET_ALL_INFO
1680  *
1681  * The values in the response are only set and valid if request status in
1682  * mrq_response::err is 0.
1683  */
1684 struct cmd_clk_get_all_info_response {
1685 	/**
1686 	 * State / informational flags for the clock:
1687 	 *
1688 	 * | Flag bit               | Description                              |
1689 	 * |------------------------|------------------------------------------|
1690 	 * | #BPMP_CLK_IS_ROOT      | Clock is a root clock.                   |
1691 	 * | #BPMP_CLK_HAS_MUX      | Clock supports changing of parent clock. |
1692 	 * | #BPMP_CLK_HAS_SET_RATE | Clock supports changing clock rate.      |
1693 	 */
1694 	uint32_t flags;
1695 
1696 	/**
1697 	 * Current parent clock identifier.
1698 	 */
1699 	uint32_t parent;
1700 
1701 	/**
1702 	 * Array of possible parent clock identifiers.
1703 	 */
1704 	uint32_t parents[MRQ_CLK_MAX_PARENTS];
1705 
1706 	/**
1707 	 * Number of identifiers in the #parents -array.
1708 	 */
1709 	uint8_t num_parents;
1710 
1711 	/**
1712 	 * Friendly name of the clock, truncated to fit the array
1713 	 * and null-terminated.
1714 	 */
1715 	uint8_t name[MRQ_CLK_NAME_MAXLEN];
1716 } BPMP_ABI_PACKED;
1717 
1718 
1719 /**
1720  * @brief Request payload for #MRQ_CLK sub-command #CMD_CLK_GET_MAX_CLK_ID
1721  *
1722  * This structure is an empty placeholder for future expansion of this
1723  * sub-command.
1724  */
1725 struct cmd_clk_get_max_clk_id_request {
1726 	BPMP_ABI_EMPTY
1727 } BPMP_ABI_PACKED;
1728 
1729 /**
1730  * @brief Response payload for #MRQ_CLK sub-command #CMD_CLK_GET_MAX_CLK_ID
1731  */
1732 struct cmd_clk_get_max_clk_id_response {
1733 	/** @brief Largest supported clock identifier. */
1734 	uint32_t max_id;
1735 } BPMP_ABI_PACKED;
1736 
1737 /**
1738  * @brief Request payload for #MRQ_CLK sub-command #CMD_CLK_GET_FMAX_AT_VMIN
1739  *
1740  * This structure is an empty placeholder for future expansion of this
1741  * sub-command.
1742  */
1743 struct cmd_clk_get_fmax_at_vmin_request {
1744 	BPMP_ABI_EMPTY
1745 } BPMP_ABI_PACKED;
1746 
1747 /**
1748  * @brief Response payload for #MRQ_CLK sub-command #CMD_CLK_GET_FMAX_AT_VMIN
1749  */
1750 struct cmd_clk_get_fmax_at_vmin_response {
1751 	int64_t rate;
1752 } BPMP_ABI_PACKED;
1753 
1754 
1755 /**
1756  * @ingroup Clocks
1757  * @brief Request with #MRQ_CLK
1758  *
1759  * Used by the sender of an #MRQ_CLK message to control clocks. The
1760  * clk_request is split into several sub-commands. Some sub-commands
1761  * require no additional data. Others have a sub-command specific
1762  * payload
1763  *
1764  * |Sub-command                 |Payload                      |
1765  * |----------------------------|-----------------------------|
1766  * |#CMD_CLK_GET_RATE           |-                            |
1767  * |#CMD_CLK_SET_RATE           |#cmd_clk_set_rate_request    |
1768  * |#CMD_CLK_ROUND_RATE         |#cmd_clk_round_rate_request  |
1769  * |#CMD_CLK_GET_PARENT         |-                            |
1770  * |#CMD_CLK_SET_PARENT         |#cmd_clk_set_parent_request  |
1771  * |#CMD_CLK_IS_ENABLED         |-                            |
1772  * |#CMD_CLK_ENABLE             |-                            |
1773  * |#CMD_CLK_DISABLE            |-                            |
1774  * |#CMD_CLK_GET_ALL_INFO       |-                            |
1775  * |#CMD_CLK_GET_MAX_CLK_ID     |-                            |
1776  * |#CMD_CLK_GET_FMAX_AT_VMIN   |-                            |
1777  */
1778 
1779 struct mrq_clk_request {
1780 	/** @brief Sub-command and clock id concatenated to 32-bit word.
1781 	 *
1782 	 * - bits[31..24] is the sub-command ID from @ref mrq_clk_commands.
1783 	 * - bits[23..0] is the clock identifier from @ref bpmp_clock_ids.
1784 	 */
1785 	uint32_t cmd_and_id;
1786 
1787 	union {
1788 		/** @private */
1789 		struct cmd_clk_get_rate_request clk_get_rate;
1790 		struct cmd_clk_set_rate_request clk_set_rate;
1791 		struct cmd_clk_round_rate_request clk_round_rate;
1792 		/** @private */
1793 		struct cmd_clk_get_parent_request clk_get_parent;
1794 		struct cmd_clk_set_parent_request clk_set_parent;
1795 		/** @private */
1796 		struct cmd_clk_enable_request clk_enable;
1797 		/** @private */
1798 		struct cmd_clk_disable_request clk_disable;
1799 		/** @private */
1800 		struct cmd_clk_is_enabled_request clk_is_enabled;
1801 		/** @private */
1802 		struct cmd_clk_get_all_info_request clk_get_all_info;
1803 		/** @private */
1804 		struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id;
1805 		/** @private */
1806 		struct cmd_clk_get_fmax_at_vmin_request clk_get_fmax_at_vmin;
1807 	} BPMP_UNION_ANON;
1808 } BPMP_ABI_PACKED;
1809 
1810 /**
1811  * @ingroup Clocks
1812  * @brief Response to MRQ_CLK
1813  *
1814  * Each sub-command supported by @ref mrq_clk_request may return
1815  * sub-command-specific data. Some do and some do not as indicated in
1816  * the following table:
1817  *
1818  * |Sub-command                 |Payload                            |
1819  * |----------------------------|-----------------------------------|
1820  * |#CMD_CLK_GET_RATE           |#cmd_clk_get_rate_response         |
1821  * |#CMD_CLK_SET_RATE           |#cmd_clk_set_rate_response         |
1822  * |#CMD_CLK_ROUND_RATE         |#cmd_clk_round_rate_response       |
1823  * |#CMD_CLK_GET_PARENT         |#cmd_clk_get_parent_response       |
1824  * |#CMD_CLK_SET_PARENT         |#cmd_clk_set_parent_response       |
1825  * |#CMD_CLK_IS_ENABLED         |#cmd_clk_is_enabled_response       |
1826  * |#CMD_CLK_ENABLE             |-                                  |
1827  * |#CMD_CLK_DISABLE            |-                                  |
1828  * |#CMD_CLK_GET_ALL_INFO       |#cmd_clk_get_all_info_response     |
1829  * |#CMD_CLK_GET_MAX_CLK_ID     |#cmd_clk_get_max_clk_id_response   |
1830  * |#CMD_CLK_GET_FMAX_AT_VMIN   |#cmd_clk_get_fmax_at_vmin_response |
1831  *
1832  */
1833 
1834 struct mrq_clk_response {
1835 	union {
1836 		struct cmd_clk_get_rate_response clk_get_rate;
1837 		struct cmd_clk_set_rate_response clk_set_rate;
1838 		struct cmd_clk_round_rate_response clk_round_rate;
1839 		struct cmd_clk_get_parent_response clk_get_parent;
1840 		struct cmd_clk_set_parent_response clk_set_parent;
1841 		/** @private */
1842 		struct cmd_clk_enable_response clk_enable;
1843 		/** @private */
1844 		struct cmd_clk_disable_response clk_disable;
1845 		struct cmd_clk_is_enabled_response clk_is_enabled;
1846 		struct cmd_clk_get_all_info_response clk_get_all_info;
1847 		struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id;
1848 		struct cmd_clk_get_fmax_at_vmin_response clk_get_fmax_at_vmin;
1849 	} BPMP_UNION_ANON;
1850 } BPMP_ABI_PACKED;
1851 
1852 /** @} Clocks */
1853 
1854 /**
1855  * @ingroup MRQ_Codes
1856  * @def MRQ_QUERY_ABI
1857  * @brief Check if an MRQ is implemented
1858  *
1859  * * Initiators: Any
1860  * * Targets: Any except DMCE
1861  * * Request Payload: @ref mrq_query_abi_request
1862  * * Response Payload: @ref mrq_query_abi_response
1863  */
1864 
1865 /**
1866  * @ingroup ABI_info
1867  * @brief Request with #MRQ_QUERY_ABI
1868  *
1869  * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported
1870  * by the recipient.
1871  */
1872 struct mrq_query_abi_request {
1873 	/** @brief MRQ code to query */
1874 	uint32_t mrq;
1875 } BPMP_ABI_PACKED;
1876 
1877 /**
1878  * @ingroup ABI_info
1879  * @brief Response to MRQ_QUERY_ABI
1880  *
1881  * @note mrq_response::err of 0 indicates that the query was
1882  * successful, not that the MRQ itself is supported!
1883  */
1884 struct mrq_query_abi_response {
1885 	/**
1886 	 * This response field is set to:
1887 	 * - 0 if queried MRQ is supported, or
1888 	 * - -#BPMP_ENODEV if queried MRQ is not supported
1889 	 */
1890 	int32_t status;
1891 } BPMP_ABI_PACKED;
1892 
1893 /**
1894  *
1895  * @ingroup MRQ_Codes
1896  * @def MRQ_PG
1897  * @brief Control power-gating state of a partition.
1898  *
1899  * @cond (bpmp_t194 || bpmp_t186)
1900  * @note On T194 and earlier BPMP-FW forcefully turns off some partitions as
1901  * part of SC7 entry because their state cannot be adequately restored on exit.
1902  * Therefore, it is recommended to power off all domains via MRQ_PG prior to SC7
1903  * entry.
1904  * See @ref bpmp_pdomain_ids for further detail.
1905  * @endcond
1906  *
1907  * * Initiators: Any
1908  * * Targets: BPMP
1909  * * Request Payload: @ref mrq_pg_request
1910  * * Response Payload: @ref mrq_pg_response
1911  *
1912  * @addtogroup Powergating
1913  * @{
1914  */
1915 
1916 /**
1917  * @brief Sub-command identifiers for #MRQ_PG -command.
1918  */
1919 enum mrq_pg_cmd {
1920 	/**
1921 	 * @brief Check whether the BPMP driver supports the specified
1922 	 * request type
1923 	 *
1924 	 * mrq_response::err is 0 if the specified request is
1925 	 * supported and -#BPMP_ENODEV otherwise.
1926 	 */
1927 	CMD_PG_QUERY_ABI = 0,
1928 
1929 	/**
1930 	 * @brief Set the current state of specified power domain. The
1931 	 * possible values for power domains are defined in enum
1932 	 * pg_states
1933 	 *
1934 	 * mrq_response:err for this sub-command is defined as:
1935 	 *
1936 	 * | Value          | Description                                                              |
1937 	 * | -------------- | ------------------------------------------------------------------------ |
1938 	 * | 0              | Request was successful.                                                  |
1939 	 * | -#BPMP_EINVAL  | Invalid request parameters were provided.                                |
1940 	 * | -#BPMP_EACCES  | Permission denied or always-off partition was attempted to be turned on. |
1941 	 * | Any other <0   | Internal error while performing the operation.                           |
1942 	 */
1943 	CMD_PG_SET_STATE = 1,
1944 
1945 	/**
1946 	 * @brief Get the current state of specified power domain. The
1947 	 * possible values for power domains are defined in enum
1948 	 * pg_states
1949 	 *
1950 	 * mrq_response:err for this sub-command is defined as:
1951 	 *
1952 	 * | Value          | Description                                    |
1953 	 * | -------------- | ---------------------------------------------- |
1954 	 * | 0              | Request was successful.                        |
1955 	 * | -#BPMP_EINVAL  | Invalid request parameters were provided.      |
1956 	 * | Any other <0   | Internal error while performing the operation. |
1957 	 */
1958 	CMD_PG_GET_STATE = 2,
1959 
1960 	/**
1961 	 * @brief Get the name string of specified power domain id.
1962 	 *
1963 	 * mrq_response:err for this sub-command is defined as:
1964 	 *
1965 	 * | Value          | Description                                    |
1966 	 * | -------------- | ---------------------------------------------- |
1967 	 * | 0              | Request was successful.                        |
1968 	 * | -#BPMP_EINVAL  | Invalid request parameters were provided.      |
1969 	 * | Any other <0   | Internal error while performing the operation. |
1970 	 */
1971 	CMD_PG_GET_NAME = 3,
1972 
1973 
1974 	/**
1975 	 * @brief Get the highest power domain id in the system. Not
1976 	 * all IDs between 0 and max_id are valid IDs.
1977 	 *
1978 	 * mrq_response:err for this sub-command is defined as:
1979 	 *
1980 	 * | Value          | Description                                    |
1981 	 * | -------------- | ---------------------------------------------- |
1982 	 * | 0              | Request was successful.                        |
1983 	 * | -#BPMP_EINVAL  | Invalid request parameters were provided.      |
1984 	 * | Any other <0   | Internal error while performing the operation. |
1985 	 */
1986 	CMD_PG_GET_MAX_ID = 4,
1987 };
1988 
1989 #define MRQ_PG_NAME_MAXLEN	40
1990 
1991 /**
1992  * @brief State value for the cmd_pg_set_state_request::state -field.
1993  */
1994 enum pg_states {
1995 	/** @brief Power domain is OFF */
1996 	PG_STATE_OFF = 0,
1997 	/** @brief Power domain is ON */
1998 	PG_STATE_ON = 1,
1999 
2000 	/** @cond bpmp_t186 */
2001 	/**
2002 	 * @brief a legacy state where power domain and the clock
2003 	 * associated to the domain are ON.
2004 	 * This state is only supported in T186, and the use of it is
2005 	 * deprecated.
2006 	 */
2007 	PG_STATE_RUNNING = 2,
2008 	/** @endcond */
2009 };
2010 
2011 struct cmd_pg_query_abi_request {
2012 	/** #MRQ_PG sub-command identifier from @ref mrq_pg_cmd */
2013 	uint32_t type;
2014 } BPMP_ABI_PACKED;
2015 
2016 struct cmd_pg_set_state_request {
2017 	/** One of the state values from @ref pg_states */
2018 	uint32_t state;
2019 } BPMP_ABI_PACKED;
2020 
2021 /**
2022  * @brief Response payload for the #MRQ_PG sub-command #CMD_PG_GET_STATE
2023  */
2024 struct cmd_pg_get_state_response {
2025 	/**
2026 	 * @brief The state of the power partition that has been
2027 	 * successfully requested by the master earlier using #MRQ_PG
2028 	 * command #CMD_PG_SET_STATE.
2029 	 *
2030 	 * The state may not reflect the physical state of the power
2031 	 * partition if there are some other masters requesting it to
2032 	 * be enabled.
2033 	 *
2034 	 * See @ref pg_states for possible values.
2035 	 */
2036 	uint32_t state;
2037 } BPMP_ABI_PACKED;
2038 
2039 /**
2040  * @brief Response payload for the #MRQ_PG sub-command #CMD_PG_GET_NAME
2041  */
2042 struct cmd_pg_get_name_response {
2043 	/**
2044 	 * @brief On successful response contains the null-terminated
2045 	 *        friendly name of the requested power-domain.
2046 	 */
2047 	uint8_t name[MRQ_PG_NAME_MAXLEN];
2048 } BPMP_ABI_PACKED;
2049 
2050 /**
2051  * @brief Response payload for the #MRQ_PG sub-command #CMD_PG_GET_MAX_ID
2052  */
2053 struct cmd_pg_get_max_id_response {
2054 	uint32_t max_id;
2055 } BPMP_ABI_PACKED;
2056 
2057 /**
2058  * @brief Request with #MRQ_PG
2059  *
2060  * Used by the sender of an #MRQ_PG message to control power
2061  * partitions. The expected payload depends on the sub-command identifier.
2062  * Some sub-commands require no additional data while others have a sub-command
2063  * specific payload:
2064  *
2065  * |Sub-command                 |Payload                    |
2066  * |----------------------------|---------------------------|
2067  * |#CMD_PG_QUERY_ABI           | #cmd_pg_query_abi_request |
2068  * |#CMD_PG_SET_STATE           | #cmd_pg_set_state_request |
2069  * |#CMD_PG_GET_STATE           | -                         |
2070  * |#CMD_PG_GET_NAME            | -                         |
2071  * |#CMD_PG_GET_MAX_ID          | -                         |
2072  *
2073  */
2074 struct mrq_pg_request {
2075 	/** @brief Sub-command identifier from @ref mrq_pg_cmd. */
2076 	uint32_t cmd;
2077 
2078 	/**
2079 	 * @brief Power-domain identifier
2080 	 */
2081 	uint32_t id;
2082 
2083 	union {
2084 		struct cmd_pg_query_abi_request query_abi;
2085 		struct cmd_pg_set_state_request set_state;
2086 	} BPMP_UNION_ANON;
2087 } BPMP_ABI_PACKED;
2088 
2089 /**
2090  * @brief Response to #MRQ_PG
2091  *
2092  * Some of the #MRQ_PG sub-commands return a sub-command -specific payload
2093  * as specified in the following table:
2094  *
2095  * |Sub-command         |Payload                       |
2096  * |--------------------|------------------------------|
2097  * |#CMD_PG_QUERY_ABI   | -                            |
2098  * |#CMD_PG_SET_STATE   | -                            |
2099  * |#CMD_PG_GET_STATE   | #cmd_pg_get_state_response   |
2100  * |#CMD_PG_GET_NAME    | #cmd_pg_get_name_response    |
2101  * |#CMD_PG_GET_MAX_ID  | #cmd_pg_get_max_id_response  |
2102  */
2103 struct mrq_pg_response {
2104 	union {
2105 		struct cmd_pg_get_state_response get_state;
2106 		struct cmd_pg_get_name_response get_name;
2107 		struct cmd_pg_get_max_id_response get_max_id;
2108 	} BPMP_UNION_ANON;
2109 } BPMP_ABI_PACKED;
2110 
2111 /** @} Powergating */
2112 
2113 /**
2114  * @ingroup MRQ_Codes
2115  * @def MRQ_THERMAL
2116  * @brief Interact with BPMP thermal framework
2117  *
2118  * * Initiators: Any
2119  * * Targets: Any
2120  * * Request Payload: #mrq_thermal_host_to_bpmp_request
2121  * * Response Payload: #mrq_thermal_bpmp_to_host_response
2122  *
2123  * @addtogroup Thermal
2124  *
2125  * The BPMP firmware includes a thermal framework. Drivers within the
2126  * bpmp firmware register with the framework to provide thermal
2127  * zones. Each thermal zone corresponds to an entity whose temperature
2128  * can be measured. The framework also has a notion of trip points. A
2129  * trip point consists of a thermal zone id, a temperature, and a
2130  * callback routine. The framework invokes the callback when the zone
2131  * hits the indicated temperature. The BPMP firmware uses this thermal
2132  * framework interally to implement various temperature-dependent
2133  * functions.
2134  *
2135  * Software on the CPU can use #MRQ_THERMAL (with payload @ref
2136  * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal
2137  * framework. The CPU must It can query the number of supported zones,
2138  * query zone temperatures, and set trip points.
2139  *
2140  * When a trip point set by the CPU gets crossed, BPMP firmware issues
2141  * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a
2142  * payload of @ref mrq_thermal_bpmp_to_host_request.
2143  * @{
2144  */
2145 
2146 /**
2147  * @brief Sub-command identifiers for Host->BPMP #MRQ_THERMAL -command.
2148  */
2149 enum mrq_thermal_host_to_bpmp_cmd {
2150 	/**
2151 	 * @brief Check whether BPMP-FW supports the specified
2152 	 *        #MRQ_THERMAL sub-command.
2153 	 *
2154 	 * Host needs to supply request parameters.
2155 	 *
2156 	 * mrq_response::err is 0 if the specified request is
2157 	 * supported and -#BPMP_ENODEV otherwise.
2158 	 */
2159 	CMD_THERMAL_QUERY_ABI = 0,
2160 
2161 	/**
2162 	 * @brief Get the current temperature of the specified zone.
2163 	 *
2164 	 * Host needs to supply request parameters.
2165 	 *
2166 	 * mrq_response::err value for this sub-command is:
2167 	 *
2168 	 * | Value          | Description                               |
2169 	 * | -------------- | ----------------------------------------- |
2170 	 * | 0              | Temperature query succeeded.              |
2171 	 * | -#BPMP_EINVAL  | Invalid request parameters.               |
2172 	 * | -#BPMP_ENOENT  | No driver registered for thermal zone.    |
2173 	 * | -#BPMP_EFAULT  | Problem reading temperature measurement.  |
2174 	 */
2175 	CMD_THERMAL_GET_TEMP = 1,
2176 
2177 	/**
2178 	 * @cond (!bpmp_safe && !bpmp_t264)
2179 	 * @brief Enable or disable and set the lower and upper
2180 	 *   thermal limits for a thermal trip point. Each zone has
2181 	 *   one trip point.
2182 	 *
2183 	 * Host needs to supply request parameters. Once the
2184 	 * temperature hits a trip point, the BPMP will send a message
2185 	 * to the CPU having MRQ command identifier equal to #MRQ_THERMAL and
2186 	 * sub-command identifier equal to #CMD_THERMAL_HOST_TRIP_REACHED.
2187 	 *
2188 	 * If #CMD_THERMAL_SET_TRIP -sub-command is issued for a
2189 	 * thermal zone that is currently power gated and unable to
2190 	 * report temperature, a temperature of -256C is used as
2191 	 * temperature for evaluation of the trip.
2192 	 *
2193 	 * mrq_response::err for this sub-command is defined as:
2194 	 *
2195 	 * | Value           | Description                            |
2196 	 * | --------------- | -------------------------------------- |
2197 	 * | 0               | Trip successfully set.                 |
2198 	 * | -#BPMP_EINVAL   | Invalid request parameters.            |
2199 	 * | -#BPMP_ENOENT   | No driver registered for thermal zone. |
2200 	 * | -#BPMP_EFAULT   | Problem setting trip point.            |
2201 	 */
2202 	CMD_THERMAL_SET_TRIP = 2,
2203 	 /** @endcond */
2204 
2205 	/**
2206 	 * @brief Get the number of supported thermal zones.
2207 	 *
2208 	 * No request parameters required.
2209 	 *
2210 	 * mrq_response::err is always 0, indicating success.
2211 	 */
2212 	CMD_THERMAL_GET_NUM_ZONES = 3,
2213 
2214 	/**
2215 	 * @brief Get the thermal trip value of the specified zone.
2216 	 *
2217 	 * Host needs to supply request parameters.
2218 	 *
2219 	 * mrq_response::err for this sub-command is defined as:
2220 	 *
2221 	 * | Value           | Description                            |
2222 	 * | --------------- | -------------------------------------- |
2223 	 * | 0               | Valid zone information returned.       |
2224 	 * | -#BPMP_EINVAL   | Invalid request parameters.            |
2225 	 * | -#BPMP_ENOENT   | No driver registered for thermal zone. |
2226 	 * | -#BPMP_ERANGE   | Thermal trip is invalid or disabled.   |
2227 	 * | -#BPMP_EFAULT   | Problem reading zone information.      |
2228 	 */
2229 	CMD_THERMAL_GET_THERMTRIP = 4,
2230 
2231 	/**
2232 	 * @brief Number of supported host-to-bpmp commands.
2233 	 */
2234 	CMD_THERMAL_HOST_TO_BPMP_NUM
2235 };
2236 
2237 /**
2238  * @brief Sub-command identifiers for BPMP->host #MRQ_THERMAL -command
2239  */
2240 enum mrq_thermal_bpmp_to_host_cmd {
2241 	/**
2242 	 * @brief Indication that the temperature for a zone has
2243 	 *        exceeded the range indicated in the thermal trip point
2244 	 *        for the zone.
2245 	 *
2246 	 * BPMP-FW needs to supply request parameters. Host only needs to
2247 	 * acknowledge.
2248 	 */
2249 	CMD_THERMAL_HOST_TRIP_REACHED = 100,
2250 
2251 	/**
2252 	 * @brief: Number of supported bpmp-to-host commands. May
2253 	 * increase in future.
2254 	 */
2255 	CMD_THERMAL_BPMP_TO_HOST_NUM
2256 };
2257 
2258 /**
2259  * Host->BPMP request payload for the #CMD_THERMAL_QUERY_ABI sub-command
2260  */
2261 struct cmd_thermal_query_abi_request {
2262 	/**
2263 	 * Request type for which to check whether supported by BPMP-FW.
2264 	 *
2265 	 * Valid identifiers are available at #mrq_thermal_host_to_bpmp_cmd
2266 	 */
2267 	uint32_t type;
2268 } BPMP_ABI_PACKED;
2269 
2270 /**
2271  * Host->BPMP request payload for the #CMD_THERMAL_GET_TEMP sub-command
2272  */
2273 struct cmd_thermal_get_temp_request {
2274 	/** Thermal zone identifier from @ref bpmp_thermal_ids. */
2275 	uint32_t zone;
2276 } BPMP_ABI_PACKED;
2277 
2278 /**
2279  * BPMP->Host response payload for the #CMD_THERMAL_GET_TEMP sub-command.
2280  *
2281  * mrq_response::err is defined as:
2282  *
2283  * | Value         | Description                                              |
2284  * | ------------- | -------------------------------------------------------- |
2285  * | 0             | Request succeeded.                                       |
2286  * | -#BPMP_EINVAL | Request parameters were invalid.                         |
2287  * | -#BPMP_ENOENT | No driver was registered for the specified thermal zone. |
2288  * | -#BPMP_EFAULT | For other BPMP-FW internal thermal zone driver errors.   |
2289  */
2290 struct cmd_thermal_get_temp_response {
2291 	/** @brief Current temperature in millicelsius. */
2292 	int32_t temp;
2293 } BPMP_ABI_PACKED;
2294 
2295 /**
2296  * @cond (!bpmp_safe && !bpmp_t264)
2297  *
2298  * Host->BPMP request payload for the #CMD_THERMAL_SET_TRIP sub-command.
2299  */
2300 struct cmd_thermal_set_trip_request {
2301 	/** @brief Thermal zone identifier from @ref bpmp_thermal_ids. */
2302 	uint32_t zone;
2303 	/** @brief Temperature of lower trip point in millicelsius */
2304 	int32_t low;
2305 	/** @brief Temperature of upper trip point in millicelsius */
2306 	int32_t high;
2307 	/** 1 to enable trip point, 0 to disable trip point */
2308 	uint32_t enabled;
2309 } BPMP_ABI_PACKED;
2310 
2311 /**
2312  * BPMP->Host request payload for the #CMD_THERMAL_HOST_TRIP_REACHED sub-command.
2313  */
2314 struct cmd_thermal_host_trip_reached_request {
2315 	/**
2316 	 * @brief ID of the thermal zone where trip point was reached,
2317 	 *        from @ref bpmp_thermal_ids.
2318 	 */
2319 	uint32_t zone;
2320 } BPMP_ABI_PACKED;
2321 /** @endcond */
2322 
2323 /**
2324  * BPMP->Host response payload for the #CMD_THERMAL_GET_NUM_ZONES sub-command.
2325  */
2326 struct cmd_thermal_get_num_zones_response {
2327 	/**
2328 	 * @brief Number of supported thermal zones.
2329 	 *
2330 	 * The thermal zones are indexed starting from zero.
2331 	 */
2332 	uint32_t num;
2333 } BPMP_ABI_PACKED;
2334 
2335 /**
2336  * Host->BPMP request payload for the #CMD_THERMAL_GET_THERMTRIP sub-command.
2337  */
2338 struct cmd_thermal_get_thermtrip_request {
2339 	/** @brief Thermal zone identifier from @ref bpmp_thermal_ids. */
2340 	uint32_t zone;
2341 } BPMP_ABI_PACKED;
2342 
2343 /**
2344  * BPMP->Host response payload for the #CMD_THERMAL_GET_THERMTRIP sub-command.
2345  */
2346 struct cmd_thermal_get_thermtrip_response {
2347 	/** @brief HW shutdown temperature in millicelsius. */
2348 	int32_t thermtrip;
2349 } BPMP_ABI_PACKED;
2350 
2351 /**
2352  * Host->BPMP #MRQ_THERMAL request payload.
2353  *
2354  * Response payload type is #mrq_thermal_bpmp_to_host_response.
2355  */
2356 struct mrq_thermal_host_to_bpmp_request {
2357 	/**
2358 	 * Request sub-command identifier from @ref mrq_thermal_host_to_bpmp_cmd.
2359 	 */
2360 	uint32_t type;
2361 
2362 	union {
2363 		struct cmd_thermal_query_abi_request query_abi;
2364 		struct cmd_thermal_get_temp_request get_temp;
2365 		struct cmd_thermal_set_trip_request set_trip;
2366 		struct cmd_thermal_get_thermtrip_request get_thermtrip;
2367 	} BPMP_UNION_ANON;
2368 } BPMP_ABI_PACKED;
2369 
2370 /**
2371  * @brief Request payload for the BPMP->Host #MRQ_THERMAL command.
2372  */
2373 struct mrq_thermal_bpmp_to_host_request {
2374 	/**
2375 	 * Request sub-command identifier from @ref mrq_thermal_bpmp_to_host_cmd.
2376 	 */
2377 	uint32_t type;
2378 
2379 	union {
2380 		struct cmd_thermal_host_trip_reached_request host_trip_reached;
2381 	} BPMP_UNION_ANON;
2382 } BPMP_ABI_PACKED;
2383 
2384 /**
2385  * @brief Response payload for the Host->BPMP #MRQ_THERMAL command.
2386  */
2387 union mrq_thermal_bpmp_to_host_response {
2388 	struct cmd_thermal_get_temp_response get_temp;
2389 	struct cmd_thermal_get_thermtrip_response get_thermtrip;
2390 	struct cmd_thermal_get_num_zones_response get_num_zones;
2391 } BPMP_ABI_PACKED;
2392 
2393 /** @} Thermal */
2394 
2395 /** @cond (!bpmp_safe && (bpmp_t234 || bpmp_t238 || bpmp_t264))
2396  * @ingroup MRQ_Codes
2397  * @def MRQ_OC_STATUS
2398  * @brief Query overcurrent status
2399  *
2400  * * Initiators: CCPLEX
2401  * * Targets: BPMP
2402  * * Request Payload: N/A
2403  * * Response Payload: @ref mrq_oc_status_response
2404  *
2405  * @addtogroup OC_status
2406  * @{
2407  */
2408 
2409 /**
2410  * @brief Size of the mrq_oc_status_response::throt_en and
2411  *        mrq_oc_status_response::event_cnt -arrays.
2412  */
2413 #define OC_STATUS_MAX_SIZE	24U
2414 
2415 /**
2416  * @brief Response payload for the #MRQ_OC_STATUS -command.
2417  *
2418  * mrq_response::err is 0 if the operation was successful and
2419  * -#BPMP_ENODEV otherwise.
2420  */
2421 struct mrq_oc_status_response {
2422 	/**
2423 	 * @brief Value for each overcurrent alarm where zero signifies
2424 	 * throttle is disabled, and non-zero throttle is enabled.
2425 	 */
2426 	uint8_t throt_en[OC_STATUS_MAX_SIZE];
2427 
2428 	/**
2429 	 * @brief Total number of overcurrent events for each overcurrent alarm.
2430 	 */
2431 	uint32_t event_cnt[OC_STATUS_MAX_SIZE];
2432 } BPMP_ABI_PACKED;
2433 
2434 /** @} OC_status */
2435 /** @endcond */
2436 
2437 /** @cond (bpmp_th500 || bpmp_tb500 || bpmp_t238)
2438  * @ingroup MRQ_Codes
2439  * @def MRQ_THROTTLE
2440  * @brief Overcurrent throttling
2441  *
2442  * * Initiators: CCPLEX
2443  * * Targets: BPMP
2444  * * Request Payload: @ref mrq_throttle_request
2445  * * Response Payload: @ref mrq_throttle_response
2446  * @addtogroup Throttle
2447  * @{
2448  */
2449 enum mrq_throttle_cmd {
2450 	/**
2451 	 * @brief Check whether the BPMP-FW supports the specified
2452 	 * #MRQ_THROTTLE sub-command.
2453 	 *
2454 	 * mrq_response::err is 0 if the specified request is
2455 	 * supported and -#BPMP_ENODEV otherwise.
2456 	 */
2457 	CMD_THROTTLE_QUERY_ABI = 0,
2458 
2459 	/**
2460 	 * @cond (bpmp_th500 || bpmp_tb500)
2461 	 * @brief query chipthrot status
2462 	 *
2463 	 * mrq_response:err is defined as:
2464 	 *
2465 	 * | Value          | Description                                                  |
2466 	 * |----------------|--------------------------------------------------------------|
2467 	 * | 0              | Success                                                      |
2468 	 * | -#BPMP_ENODEV  | CMD_THROTTLE_GET_CHIPTHROT_STATUS is not supported by BPMP-FW|
2469 	 */
2470 	CMD_THROTTLE_GET_CHIPTHROT_STATUS = 1,
2471 	/** @endcond */
2472 
2473 	/**
2474 	 * @cond bpmp_t238
2475 	 * @brief program OC throttle configuration
2476 	 *
2477 	 * mrq_response:err is defined as:
2478 	 *
2479 	 * | Value          | Description                                                  |
2480 	 * |----------------|--------------------------------------------------------------|
2481 	 * | 0              | Success                                                      |
2482 	 * | -#BPMP_EINVAL  | ID out of range or alarm for this ID not enabled at boot     |
2483 	 * | -#BPMP_ENODEV  | CMD_THROTTLE_SET_OC_CONFIG is not supported by BPMP-FW       |
2484 	 */
2485 	CMD_THROTTLE_SET_OC_CONFIG = 2,
2486 	/** @endcond */
2487 };
2488 
2489 /**
2490  * @brief Request payload for #MRQ_THROTTLE sub-command #CMD_THROTTLE_QUERY_ABI
2491  */
2492 struct cmd_throttle_query_abi_request {
2493 	uint32_t cmd; /**< @ref mrq_throttle_cmd */
2494 } BPMP_ABI_PACKED;
2495 
2496 /**
2497  * @cond bpmp_th500
2498  * @brief Response payload for #MRQ_THROTTLE sub-command
2499  * #CMD_THROTTLE_GET_CHIPTHROT_STATUS
2500  *
2501  * Bit-mask of all h/w throttling actions that have been engaged since
2502  * last invocation of this command
2503  * Bit 0...11  : HW throttling status of the thermal zones.
2504  * Bit 12...23 : Reserved for future thermal zone events.
2505  * Bit 24...25 : HW throttling status of the Over current Alarms OC1 & OC2.
2506  * Bit 26...31 : Reserved for future Over current alarm events.
2507  * Bit 32...63 : Reserved for future use.
2508  * @endcond
2509  * @cond bpmp_tb500
2510  * @brief Response payload for #MRQ_THROTTLE sub-command
2511  * #CMD_THROTTLE_GET_CHIPTHROT_STATUS
2512  *
2513  * Bit-mask of all h/w throttling actions that have been engaged since
2514  * last invocation of this command
2515  * Bit 0       : HW throttling status of the TB500C_TJ_MAX thermal zone.
2516  * Bit 1...63  : Reserved for future use.
2517  * @endcond
2518  * @cond (bpmp_th500 || bpmp_tb500)
2519  */
2520 struct cmd_throttle_get_chipthrot_status_response {
2521 	uint64_t status;
2522 } BPMP_ABI_PACKED;
2523 /** @endcond */
2524 
2525 /**
2526  * @cond bpmp_t238
2527  * @brief Request payload for #MRQ_THROTTLE sub-command
2528  * #CMD_THROTTLE_SET_OC_CONFIG
2529  *
2530  * Only alarms that have been configured as enabled in BPMP-DTB at boot can
2531  * be reconfigured with this MRQ.
2532  */
2533 struct cmd_throttle_set_oc_config_request {
2534 	/** @brief valid OC alarm ID from @ref bpmp_soctherm_edp_oc_ids */
2535 	uint32_t id;
2536 	/** @brief Throttling enable/disable
2537 	 *
2538 	 * Set to 1 to enable throttling, or 0 to disable. Other values are
2539 	 * disallowed.
2540 	 */
2541 	uint8_t en_throttle;
2542 } BPMP_ABI_PACKED;
2543 /** @endcond */
2544 
2545 /**
2546  * @brief Request payload for the #MRQ_THROTTLE -command
2547  *
2548  * | Sub-command                        | Request payload                  |
2549  * |------------------------------------|----------------------------------|
2550  * | #CMD_THROTTLE_QUERY_ABI            | #cmd_throttle_query_abi_request  |
2551  *
2552  * @cond bpmp_th500
2553  * The following additional sub-commands are supported on TH500 platforms:
2554  * | Sub-command                        | Request payload                  |
2555  * |------------------------------------|----------------------------------|
2556  * | #CMD_THROTTLE_GET_CHIPTHROT_STATUS | -                                |
2557  * @endcond
2558  *
2559  * @cond bpmp_tb500
2560  * The following additional sub-commands are supported on TB500 platforms:
2561  * | Sub-command                        | Request payload                  |
2562  * |------------------------------------|----------------------------------|
2563  * | #CMD_THROTTLE_GET_CHIPTHROT_STATUS | -                                |
2564  * @endcond
2565  *
2566  * @cond bpmp_t238
2567  * The following additional sub-commands are supported on T238 platforms:
2568  * | Sub-command                        | Request payload                     |
2569  * |------------------------------------|-------------------------------------|
2570  * | #CMD_THROTTLE_SET_OC_CONFIG        | #cmd_throttle_set_oc_config_request |
2571  * @endcond
2572  */
2573 struct mrq_throttle_request {
2574 	uint32_t cmd;
2575 	union {
2576 		struct cmd_throttle_query_abi_request throttle_query_abi_req;
2577 		/** @cond bpmp_t238 */
2578 		struct cmd_throttle_set_oc_config_request throttle_set_oc_config_req;
2579 		/** @endcond */
2580 	} BPMP_UNION_ANON;
2581 } BPMP_ABI_PACKED;
2582 
2583 /**
2584  * @brief Response payload for the #MRQ_THROTTLE -command.
2585  *
2586  * | Sub-command                        | Response payload                           |
2587  * |------------------------------------|--------------------------------------------|
2588  * | #CMD_THROTTLE_QUERY_ABI            | -                                          |
2589  *
2590  * @cond bpmp_th500
2591  * The following additional sub-commands are supported on TH500 platforms:
2592  * | Sub-command                        | Response payload                           |
2593  * |------------------------------------|--------------------------------------------|
2594  * | #CMD_THROTTLE_GET_CHIPTHROT_STATUS | #cmd_throttle_get_chipthrot_status_response|
2595  * @endcond
2596  *
2597  * @cond bpmp_tb500
2598  * The following additional sub-commands are supported on TB500 platforms:
2599  * | Sub-command                        | Response payload                           |
2600  * |------------------------------------|--------------------------------------------|
2601  * | #CMD_THROTTLE_GET_CHIPTHROT_STATUS | #cmd_throttle_get_chipthrot_status_response|
2602  * @endcond
2603  *
2604  * @cond bpmp_t238
2605  * The following additional sub-commands are supported on T238 platforms:
2606  * | Sub-command                        | Response payload                           |
2607  * |------------------------------------|--------------------------------------------|
2608  * | #CMD_THROTTLE_SET_OC_CONFIG        | -                                          |
2609  * @endcond
2610  */
2611 struct mrq_throttle_response {
2612 	union {
2613 		/** @cond (bpmp_th500 || bpmp_tb500) */
2614 		struct cmd_throttle_get_chipthrot_status_response throttle_get_chipthrot_status_resp;
2615 		/** @endcond */
2616 	} BPMP_UNION_ANON;
2617 } BPMP_ABI_PACKED;
2618 /** @} Throttle */
2619 /** @endcond */
2620 
2621 
2622 /** @cond bpmp_t186
2623  * @ingroup MRQ_Codes
2624  * @def MRQ_CPU_VHINT
2625  * @brief Query CPU voltage hint data
2626  *
2627  * * Initiators: CCPLEX
2628  * * Targets: BPMP
2629  * * Request Payload: @ref mrq_cpu_vhint_request
2630  * * Response Payload: N/A
2631  *
2632  * @addtogroup Vhint
2633  * @{
2634  */
2635 
2636 /**
2637  * @brief Request with #MRQ_CPU_VHINT
2638  *
2639  * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data
2640  * from BPMP to memory space pointed by #addr. CCPLEX is responsible
2641  * to allocate sizeof(cpu_vhint_data) sized block of memory and
2642  * appropriately map it for BPMP before sending the request.
2643  */
2644 struct mrq_cpu_vhint_request {
2645 	/** @brief IOVA address for the #cpu_vhint_data */
2646 	uint32_t addr;
2647 	/** @brief ID of the cluster whose data is requested */
2648 	uint32_t cluster_id;
2649 } BPMP_ABI_PACKED;
2650 
2651 /**
2652  * @brief Description of the CPU v/f relation
2653  *
2654  * Used by #MRQ_CPU_VHINT call to carry data pointed by
2655  * #mrq_cpu_vhint_request::addr
2656  */
2657 struct cpu_vhint_data {
2658 	uint32_t ref_clk_hz; /**< reference frequency in Hz */
2659 	uint16_t pdiv; /**< post divider value */
2660 	uint16_t mdiv; /**< input divider value */
2661 	uint16_t ndiv_max; /**< fMAX expressed with max NDIV value */
2662 	/** table of ndiv values as a function of vINDEX (voltage index) */
2663 	uint16_t ndiv[80];
2664 	/** minimum allowed NDIV value */
2665 	uint16_t ndiv_min;
2666 	/** minimum allowed voltage hint value (as in vINDEX) */
2667 	uint16_t vfloor;
2668 	/** maximum allowed voltage hint value (as in vINDEX) */
2669 	uint16_t vceil;
2670 	/** post-multiplier for vindex value */
2671 	uint16_t vindex_mult;
2672 	/** post-divider for vindex value */
2673 	uint16_t vindex_div;
2674 	/** reserved for future use */
2675 	uint16_t reserved[328];
2676 } BPMP_ABI_PACKED;
2677 
2678 /** @} Vhint */
2679 /** @endcond */
2680 
2681 /**
2682  * @ingroup MRQ_Codes
2683  * @def MRQ_ABI_RATCHET
2684  * @brief ABI ratchet value query
2685  *
2686  * * Initiators: Any
2687  * * Targets: BPMP
2688  * * Request Payload: @ref mrq_abi_ratchet_request
2689  * * Response Payload: @ref mrq_abi_ratchet_response
2690  * @addtogroup ABI_info
2691  * @{
2692  */
2693 
2694 /**
2695  * @brief An ABI compatibility mechanism
2696  *
2697  * #BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future
2698  * revision of this header file.
2699  * 1. That future revision deprecates some MRQ
2700  * 2. That future revision introduces a breaking change to an existing
2701  *    MRQ or
2702  * 3. A bug is discovered in an existing implementation of the BPMP-FW
2703  *    (or possibly one of its clients) which warrants deprecating that
2704  *    implementation.
2705  */
2706 #define BPMP_ABI_RATCHET_VALUE 3
2707 
2708 /**
2709  * @brief Request with #MRQ_ABI_RATCHET.
2710  *
2711  * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header
2712  * against which the requester was compiled.
2713  *
2714  * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may
2715  * reply with mrq_response::err = -#BPMP_ERANGE to indicate that
2716  * BPMP-FW cannot interoperate correctly with the requester. Requester
2717  * should cease further communication with BPMP.
2718  *
2719  * Otherwise, err shall be 0.
2720  */
2721 struct mrq_abi_ratchet_request {
2722 	/** @brief Requester's ratchet value */
2723 	uint16_t ratchet;
2724 };
2725 
2726 /**
2727  * @brief Response to #MRQ_ABI_RATCHET
2728  *
2729  * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header
2730  * against which BPMP firwmare was compiled.
2731  *
2732  * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE,
2733  * the requster must either interoperate with BPMP according to an ABI
2734  * header version with #BPMP_ABI_RATCHET_VALUE = ratchet or cease
2735  * communication with BPMP.
2736  *
2737  * If mrq_response::err is 0 and ratchet is greater than or equal to the
2738  * requester's #BPMP_ABI_RATCHET_VALUE, the requester should continue
2739  * normal operation.
2740  */
2741 struct mrq_abi_ratchet_response {
2742 	/** @brief BPMP's ratchet value */
2743 	uint16_t ratchet;
2744 };
2745 
2746 /** @} ABI_info */
2747 
2748 /**
2749  * @ingroup MRQ_Codes
2750  * @def MRQ_EMC_DVFS_LATENCY
2751  * @brief Query frequency dependent EMC DVFS latency
2752  *
2753  * On T264 and onwards, this MRQ service is available only when
2754  * BPMP-FW has valid DRAM timing table passed by earlier boot stages.
2755  *
2756  * * Initiators: CCPLEX
2757  * * Targets: BPMP
2758  * * Request Payload: N/A
2759  * * Response Payload: @ref mrq_emc_dvfs_latency_response
2760  * @addtogroup EMC
2761  * @{
2762  */
2763 
2764 /**
2765  * @brief Used by @ref mrq_emc_dvfs_latency_response
2766  */
2767 struct emc_dvfs_latency {
2768 	/** @brief EMC DVFS node frequency in kHz */
2769 	uint32_t freq;
2770 	/** @brief EMC DVFS latency in nanoseconds */
2771 	uint32_t latency;
2772 } BPMP_ABI_PACKED;
2773 
2774 #define EMC_DVFS_LATENCY_MAX_SIZE	14
2775 /**
2776  * @brief Response to #MRQ_EMC_DVFS_LATENCY
2777  */
2778 struct mrq_emc_dvfs_latency_response {
2779 	/**
2780 	 * @brief The number valid entries in #pairs
2781 	 *
2782 	 * Valid range is [0, #EMC_DVFS_LATENCY_MAX_SIZE]
2783 	 */
2784 	uint32_t num_pairs;
2785 	/** @brief EMC DVFS node <frequency, latency> information */
2786 	struct emc_dvfs_latency pairs[EMC_DVFS_LATENCY_MAX_SIZE];
2787 } BPMP_ABI_PACKED;
2788 
2789 /** @} EMC */
2790 
2791 /** @cond (bpmp_t234)
2792  * @ingroup MRQ_Codes
2793  * @def MRQ_EMC_DVFS_EMCHUB
2794  * @brief Query EMC HUB frequencies
2795  *
2796  * * Initiators: CCPLEX
2797  * * Targets: BPMP
2798  * * Request Payload: N/A
2799  * * Response Payload: @ref mrq_emc_dvfs_emchub_response
2800  * @addtogroup EMC
2801  * @{
2802  */
2803 
2804 /**
2805  * @brief Used by @ref mrq_emc_dvfs_emchub_response
2806  */
2807 struct emc_dvfs_emchub {
2808 	/** @brief EMC DVFS node frequency in kHz */
2809 	uint32_t freq;
2810 	/** @brief EMC HUB frequency in kHz */
2811 	uint32_t hub_freq;
2812 } BPMP_ABI_PACKED;
2813 
2814 #define EMC_DVFS_EMCHUB_MAX_SIZE	EMC_DVFS_LATENCY_MAX_SIZE
2815 /**
2816  * @brief Response to #MRQ_EMC_DVFS_EMCHUB
2817  */
2818 struct mrq_emc_dvfs_emchub_response {
2819 	/** @brief The number valid entries in #pairs */
2820 	uint32_t num_pairs;
2821 	/** @brief EMC DVFS node <frequency, hub frequency> information */
2822 	struct emc_dvfs_emchub pairs[EMC_DVFS_EMCHUB_MAX_SIZE];
2823 } BPMP_ABI_PACKED;
2824 
2825 /** @} EMC */
2826 /** @endcond */
2827 
2828 /** @cond (bpmp_t234)
2829  * @ingroup MRQ_Codes
2830  * @def MRQ_EMC_DISP_RFL
2831  * @brief Set EMC display RFL handshake mode of operations
2832  *
2833  * * Initiators: CCPLEX
2834  * * Targets: BPMP
2835  * * Request Payload: @ref mrq_emc_disp_rfl_request
2836  * * Response Payload: N/A
2837  *
2838  * @addtogroup EMC
2839  * @{
2840  */
2841 
2842 /**
2843  * @brief Allowed mode values for the mrq_emc_disp_rfl_request::mode -field.
2844  */
2845 enum mrq_emc_disp_rfl_mode {
2846 	/** @brief EMC display RFL handshake disabled  */
2847 	EMC_DISP_RFL_MODE_DISABLED = 0,
2848 	/** @brief EMC display RFL handshake enabled  */
2849 	EMC_DISP_RFL_MODE_ENABLED = 1,
2850 };
2851 
2852 /**
2853  * @ingroup EMC
2854  * @brief Request with #MRQ_EMC_DISP_RFL
2855  *
2856  * Used by the sender of an #MRQ_EMC_DISP_RFL message to
2857  * request the mode of EMC display RFL handshake.
2858  *
2859  * mrq_response::err for this request is defined as:
2860  *
2861  * | Value          | Description                                   |
2862  * | -------------- | --------------------------------------------- |
2863  * | 0              | RFL mode is set successfully.                 |
2864  * | -#BPMP_EINVAL  | Invalid mode requested.                       |
2865  * | -#BPMP_ENOSYS  | RFL handshake is not supported.               |
2866  * | -#BPMP_EACCES  | Permission denied.                            |
2867  * | -#BPMP_ENODEV  | if disp rfl mrq is not supported by BPMP-FW.  |
2868  */
2869 struct mrq_emc_disp_rfl_request {
2870 	/** @brief EMC display RFL mode from @ref mrq_emc_disp_rfl_mode */
2871 	uint32_t mode;
2872 } BPMP_ABI_PACKED;
2873 
2874 /** @} EMC */
2875 /** @endcond */
2876 
2877 /** @cond (!bpmp_safe && (bpmp_t234 || bpmp_t238))
2878  * @ingroup MRQ_Codes
2879  * @def MRQ_BWMGR
2880  * @brief Bandwidth manager (BWMGR) commands
2881  *
2882  * * Initiators: CCPLEX
2883  * * Targets: BPMP
2884  * * Request Payload: @ref mrq_bwmgr_request
2885  * * Response Payload: @ref mrq_bwmgr_response
2886  *
2887  * @addtogroup BWMGR
2888  * @{
2889  */
2890 
2891 /**
2892  * @brief Sub-command identifiers for #MRQ_BWMGR
2893  */
2894 enum mrq_bwmgr_cmd {
2895 	/**
2896 	 * @brief Check whether BPMP-FW supports the specified
2897 	 * #MRQ_BWMGR sub-command.
2898 	 *
2899 	 * mrq_response::err is defined to be:
2900 	 *
2901 	 * | Value          | Description
2902 	 * |----------------|----------------------------
2903 	 * | 0              | Specified sub-command is supported.
2904 	 * | -#BPMP_ENODEV  | Specified sub-command is not supported.
2905 	 */
2906 	CMD_BWMGR_QUERY_ABI = 0,
2907 
2908 	/**
2909 	 * @brief Determine DRAM rate to satisfy ISO/NISO bandwidth requests
2910 	 *
2911 	 * mrq_response::err is defined to be:
2912 	 *
2913 	 * | Value          | Description
2914 	 * |----------------|----------------------------
2915 	 * | 0              | Rate calculation succeeded.
2916 	 * | -#BPMP_EINVAL  | Invalid request parameters.
2917 	 * | -#BPMP_ENOTSUP | Requested bandwidth is not available.
2918 	 * | <0             | Any other internal error.
2919 	 */
2920 	CMD_BWMGR_CALC_RATE = 1
2921 };
2922 
2923 /**
2924  * @brief Request payload for #MRQ_BWMGR sub-command #CMD_BWMGR_QUERY_ABI
2925  */
2926 struct cmd_bwmgr_query_abi_request {
2927 	/** @brief Sub-command identifier from @ref mrq_bwmgr_cmd. */
2928 	uint32_t type;
2929 } BPMP_ABI_PACKED;
2930 
2931 /**
2932  * @brief Used by @ref cmd_bwmgr_calc_rate_request
2933  */
2934 struct iso_req {
2935 	/** @brief BWMGR client ID from @ref bpmp_bwmgr_ids */
2936 	uint32_t id;
2937 	/** @brief Bandwidth in kBps requested by client */
2938 	uint32_t iso_bw;
2939 } BPMP_ABI_PACKED;
2940 
2941 /**
2942  * @brief Size of the cmd_bwmgr_calc_rate_request::isobw_reqs -array.
2943  */
2944 #define MAX_ISO_CLIENTS		13U
2945 
2946 /**
2947  * @brief Request payload for #MRQ_BWMGR sub-command #CMD_BWMGR_CALC_RATE
2948  */
2949 struct cmd_bwmgr_calc_rate_request {
2950 	/** @brief Total bandwidth in kBps requested by all NISO clients. */
2951 	uint32_t sum_niso_bw;
2952 	/** @brief The number of ISO client requests in #isobw_reqs -array */
2953 	uint32_t num_iso_clients;
2954 	/** @brief iso_req <id, iso_bw> information */
2955 	struct iso_req isobw_reqs[MAX_ISO_CLIENTS];
2956 } BPMP_ABI_PACKED;
2957 
2958 /**
2959  * @brief Response payload for #MRQ_BWMGR sub-command #CMD_BWMGR_CALC_RATE
2960  */
2961 struct cmd_bwmgr_calc_rate_response {
2962 	/**
2963 	 * @brief Minimum DRAM data clock rate in kHz to satisfy all ISO client
2964 	 *        bandwidth requests.
2965 	 */
2966 	uint32_t iso_rate_min;
2967 
2968 	/**
2969 	 * @brief Minimum DRAM data clock rate in kHz to satisfy all
2970 	 *        bandwidth requests.
2971 	 */
2972 	uint32_t total_rate_min;
2973 } BPMP_ABI_PACKED;
2974 
2975 /**
2976  * @brief Request payload for the #MRQ_BWMGR -command.
2977  *
2978  * |Sub-command           |Payload                      |
2979  * |----------------------|-----------------------------|
2980  * |#CMD_BWMGR_QUERY_ABI  |#cmd_bwmgr_query_abi_request |
2981  * |#CMD_BWMGR_CALC_RATE  |#cmd_bwmgr_calc_rate_request |
2982  */
2983 struct mrq_bwmgr_request {
2984 	/** @brief Sub-command identifier from @ref mrq_bwmgr_cmd. */
2985 	uint32_t cmd;
2986 	union {
2987 		struct cmd_bwmgr_query_abi_request query_abi;
2988 		struct cmd_bwmgr_calc_rate_request bwmgr_rate_req;
2989 	} BPMP_UNION_ANON;
2990 } BPMP_ABI_PACKED;
2991 
2992 /**
2993  * @brief Response payload for the #MRQ_BWMGR -command.
2994  *
2995  * |Sub-command           |Payload                       |
2996  * |----------------------|------------------------------|
2997  * |#CMD_BWMGR_CALC_RATE  |#cmd_bwmgr_calc_rate_response |
2998  */
2999 struct mrq_bwmgr_response {
3000 	union {
3001 		struct cmd_bwmgr_calc_rate_response bwmgr_rate_resp;
3002 	} BPMP_UNION_ANON;
3003 } BPMP_ABI_PACKED;
3004 
3005 /** @} BWMGR */
3006 /** @endcond */
3007 
3008 /** @cond (!bpmp_safe && (bpmp_t234 || bpmp_t238 || bpmp_t264))
3009  * @ingroup MRQ_Codes
3010  * @def MRQ_BWMGR_INT
3011  * @brief BPMP-FW integrated BWMGR requests
3012  *
3013  * * Initiators: CCPLEX
3014  * * Targets: BPMP
3015  * * Request Payload: @ref mrq_bwmgr_int_request
3016  * * Response Payload: @ref mrq_bwmgr_int_response
3017  *
3018  * @addtogroup BWMGR_INT
3019  * @{
3020  */
3021 
3022 /**
3023  * @brief Sub-command identifiers for #MRQ_BWMGR_INT
3024  */
3025 enum mrq_bwmgr_int_cmd {
3026 	/**
3027 	 * @brief Check whether the BPMP-FW supports the specified
3028 	 * sub-command.
3029 	 *
3030 	 * mrq_response::err is 0 if the specified request is
3031 	 * supported and -#BPMP_ENODEV otherwise.
3032 	 */
3033 	CMD_BWMGR_INT_QUERY_ABI = 1,
3034 
3035 	/**
3036 	 * @brief Determine and set DRAM rate to satisfy ISO/NISO bandwidth requests.
3037 	 *
3038 	 * mrq_response::err is defined as:
3039 	 *
3040 	 * |Value            |Description                                                                                                     |
3041 	 * |-----------------|----------------------------------------------------------------------------------------------------------------|
3042 	 * |0                |Request succeeded.                                                                                              |
3043 	 * |-#BPMP_EINVAL    |Invalid request parameters, cmd_bwmgr_int_calc_and_set_response::rate is not set.                               |
3044 	 * |-#BPMP_ENOTSUP   |Requested bandwidth is not available, cmd_bwmgr_int_calc_and_set_response::rate is the current DRAM clock rate. |
3045 	 * |<0               |Any other internal error.                                                                                       |
3046 	 */
3047 	CMD_BWMGR_INT_CALC_AND_SET = 2,
3048 
3049 	/**
3050 	 * @brief Set a max DRAM frequency for the bandwidth manager.
3051 	 *
3052 	 * mrq_response::err is defined as:
3053 	 *
3054 	 * |Value            |Description                               |
3055 	 * |-----------------|------------------------------------------|
3056 	 * |0                |Request succeeded.                        |
3057 	 * |-#BPMP_ENOTSUP   |Requested cap frequency is not possible.  |
3058 	 * |<0               |Any other internal error.                 |
3059 	 */
3060 	CMD_BWMGR_INT_CAP_SET = 3,
3061 
3062 	/**
3063 	 * @brief Obtain the maximum amount of bandwidth currently allocatable
3064 	 * to the requesting client.
3065 	 *
3066 	 * mrq_response::err is defined as:
3067 	 *
3068 	 * |Value            |Description                               |
3069 	 * |-----------------|------------------------------------------|
3070 	 * |0                |Request succeeded.                        |
3071 	 * |-#BPMP_EINVAL    |Invalid request parameters.               |
3072 	 * |<0               |Any other internal error.                 |
3073 	 */
3074 	CMD_BWMGR_INT_CURR_AVAILABLE_BW = 4,
3075 	/**
3076 	 * @brief Get the last request made by the client.
3077 	 *
3078 	 * mrq_response::err is defined as:
3079 	 *
3080 	 * |Value            |Description                               |
3081 	 * |-----------------|------------------------------------------|
3082 	 * |0                |Request succeeded.                        |
3083 	 * |-#BPMP_EINVAL    |Invalid request parameters.               |
3084 	 * |<0               |Any other internal error.                 |
3085 	 */
3086 	CMD_BWMGR_INT_GET_LAST_REQUEST = 5,
3087 };
3088 
3089 /**
3090  * @brief Request payload for #MRQ_BWMGR_INT sub-command #CMD_BWMGR_INT_QUERY_ABI
3091  */
3092 struct cmd_bwmgr_int_query_abi_request {
3093 	/** @brief Sub-command identifier from @ref mrq_bwmgr_int_cmd. */
3094 	uint32_t type;
3095 } BPMP_ABI_PACKED;
3096 
3097 /**
3098  * @defgroup bwmgr_int_unit_type BWMGR_INT floor unit-types
3099  * @addtogroup bwmgr_int_unit_type
3100  * @{
3101  */
3102 /** @brief kilobytes per second unit-type */
3103 #define BWMGR_INT_UNIT_KBPS  0U
3104 /** @brief kilohertz unit-type */
3105 #define BWMGR_INT_UNIT_KHZ   1U
3106 
3107 /** @} bwmgr_int_unit_type */
3108 
3109 /**
3110  * @brief Request payload for #MRQ_BWMGR_INT sub-command #CMD_BWMGR_INT_CALC_AND_SET
3111  */
3112 struct cmd_bwmgr_int_calc_and_set_request {
3113 	/** @brief BWGMR client ID from @ref bpmp_bwmgr_ids */
3114 	uint32_t client_id;
3115 	/** @brief Average NISO bandwidth usage in kBps requested by client. */
3116 	uint32_t niso_bw;
3117 	/**
3118 	 * @brief Average ISO bandwidth usage in kBps requested by client.
3119 	 *
3120 	 * Value is ignored if client is NISO as determined by #client_id.
3121 	 */
3122 	uint32_t iso_bw;
3123 	/**
3124 	 * @brief Memory clock floor requested by client, unit of the value
3125 	 *        is determined by #floor_unit -field.
3126 	 */
3127 	uint32_t mc_floor;
3128 	/**
3129 	 * @brief Value set to determine the unit of the #mc_floor value:
3130 	 *
3131 	 * | Value                 | Unit                 |
3132 	 * |-----------------------|----------------------|
3133 	 * | #BWMGR_INT_UNIT_KBPS  | Kilobytes per second |
3134 	 * | #BWMGR_INT_UNIT_KHZ   | Kilohertz            |
3135 	 */
3136 	uint8_t floor_unit;
3137 } BPMP_ABI_PACKED;
3138 
3139 /**
3140  * @brief Response payload for #MRQ_BWMGR_INT sub-command #CMD_BWMGR_INT_CALC_AND_SET
3141  */
3142 struct cmd_bwmgr_int_calc_and_set_response {
3143 	/** @brief Currently set memory clock frequency in Hz */
3144 	uint64_t rate;
3145 } BPMP_ABI_PACKED;
3146 
3147 /**
3148  * @brief Request payload for #MRQ_BWMGR_INT sub-command #CMD_BWMGR_INT_CAP_SET
3149  */
3150 struct cmd_bwmgr_int_cap_set_request {
3151 	/** @brief Requested cap frequency in Hz. */
3152 	uint64_t rate;
3153 } BPMP_ABI_PACKED;
3154 
3155 /**
3156  * @brief Request payload for #MRQ_BWMGR_INT sub-command #CMD_BWMGR_INT_CURR_AVAILABLE_BW
3157  */
3158 struct cmd_bwmgr_int_curr_available_bw_request {
3159 	/** @brief BWMGR client ID from @ref bpmp_bwmgr_ids */
3160 	uint32_t id;
3161 } BPMP_ABI_PACKED;
3162 
3163 /**
3164  * @brief Response payload for #MRQ_BWMGR_INT sub-command #CMD_BWMGR_INT_CURR_AVAILABLE_BW
3165  */
3166 struct cmd_bwmgr_int_curr_available_bw_response {
3167 	/** @brief Current cap frequency in KHz. */
3168 	uint64_t cap_rate;
3169 	/** @brief Currently available bandwidth for the requesting client
3170 	 * to allocate in KBps.
3171 	 */
3172 	uint64_t available_bw;
3173 } BPMP_ABI_PACKED;
3174 
3175 struct cmd_bwmgr_int_get_last_request_request {
3176 	/** @brief BWMGR client ID from @ref bpmp_bwmgr_ids */
3177 	uint32_t id;
3178 	/**
3179 	 * @brief Value set to determine the unit of the returned mc_floor value:
3180 	 *
3181 	 * | Value                 | Unit                 |
3182 	 * |-----------------------|----------------------|
3183 	 * | #BWMGR_INT_UNIT_KBPS  | Kilobytes per second |
3184 	 * | #BWMGR_INT_UNIT_KHZ   | Kilohertz            |
3185 	 */
3186 	uint8_t floor_unit;
3187 } BPMP_ABI_PACKED;
3188 
3189 struct cmd_bwmgr_int_get_last_request_response {
3190 	/** @brief BWGMR client ID from @ref bpmp_bwmgr_ids */
3191 	uint32_t client_id;
3192 	/** @brief Average NISO bandwidth usage in kBps requested by client. */
3193 	uint32_t niso_bw;
3194 	/**
3195 	 * @brief Average ISO bandwidth usage in kBps requested by client.
3196 	 */
3197 	uint32_t iso_bw;
3198 	/**
3199 	 * @brief Memory clock floor requested by client, unit of the value
3200 	 *        is determined by #floor_unit -field.
3201 	 */
3202 	uint32_t mc_floor;
3203 	/**
3204 	 * @brief Value set to determine the unit of the #mc_floor value:
3205 	 *
3206 	 * | Value                 | Unit                 |
3207 	 * |-----------------------|----------------------|
3208 	 * | #BWMGR_INT_UNIT_KBPS  | Kilobytes per second |
3209 	 * | #BWMGR_INT_UNIT_KHZ   | Kilohertz            |
3210 	 */
3211 	uint8_t floor_unit;
3212 } BPMP_ABI_PACKED;
3213 
3214 /**
3215  * @brief Request payload for the #MRQ_BWMGR_INT -command.
3216  *
3217  * |Sub-command                      |Payload                                  |
3218  * |---------------------------------|-----------------------------------------|
3219  * |#CMD_BWMGR_INT_QUERY_ABI         |#cmd_bwmgr_int_query_abi_request         |
3220  * |#CMD_BWMGR_INT_CALC_AND_SET      |#cmd_bwmgr_int_calc_and_set_request      |
3221  * |#CMD_BWMGR_INT_CAP_SET           |#cmd_bwmgr_int_cap_set_request           |
3222  * |#CMD_BWMGR_INT_GET_LAST_REQUEST  |#cmd_bwmgr_int_get_last_request_request  |
3223  *
3224  * The following additional sub-commands are supported on T264 platforms:
3225  *
3226  * |Sub-command                      |Payload                                  |
3227  * |---------------------------------|-----------------------------------------|
3228  * |#CMD_BWMGR_INT_CURR_AVAILABLE_BW |#cmd_bwmgr_int_curr_available_bw_request |
3229  */
3230 struct mrq_bwmgr_int_request {
3231 	/** @brief Sub-command identifier from @ref mrq_bwmgr_int_cmd. */
3232 	uint32_t cmd;
3233 	union {
3234 		struct cmd_bwmgr_int_query_abi_request query_abi;
3235 		struct cmd_bwmgr_int_calc_and_set_request bwmgr_calc_set_req;
3236 		struct cmd_bwmgr_int_cap_set_request bwmgr_cap_set_req;
3237 		struct cmd_bwmgr_int_curr_available_bw_request bwmgr_curr_available_bw_req;
3238 		struct cmd_bwmgr_int_get_last_request_request bwmgr_get_last_request_req;
3239 	} BPMP_UNION_ANON;
3240 } BPMP_ABI_PACKED;
3241 
3242 /**
3243  * @brief Response payload for the #MRQ_BWMGR_INT -command.
3244  *
3245  * |Sub-command                      |Payload                                   |
3246  * |---------------------------------|------------------------------------------|
3247  * |#CMD_BWMGR_INT_CALC_AND_SET      |#cmd_bwmgr_int_calc_and_set_response      |
3248  * |#CMD_BWMGR_INT_GET_LAST_REQUEST  |#cmd_bwmgr_int_get_last_request_response  |
3249  *
3250  * The following additional sub-commands are supported on T264 platforms:
3251  * |Sub-command                      |Payload                                   |
3252  * |---------------------------------|------------------------------------------|
3253  * |#CMD_BWMGR_INT_CURR_AVAILABLE_BW |#cmd_bwmgr_int_curr_available_bw_response |
3254  */
3255 struct mrq_bwmgr_int_response {
3256 	union {
3257 		struct cmd_bwmgr_int_calc_and_set_response bwmgr_calc_set_resp;
3258 		struct cmd_bwmgr_int_curr_available_bw_response bwmgr_curr_available_bw_resp;
3259 		struct cmd_bwmgr_int_get_last_request_response bwmgr_get_last_request_resp;
3260 	} BPMP_UNION_ANON;
3261 } BPMP_ABI_PACKED;
3262 
3263 /** @} BWMGR_INT */
3264 /** @endcond */
3265 
3266 /** @cond (!bpmp_safe && (bpmp_t234 || bpmp_t238 || bpmp_t264))
3267  * @ingroup MRQ_Codes
3268  * @def MRQ_ISO_CLIENT
3269  * @brief ISO client requests
3270  *
3271  * * Initiators: CCPLEX
3272  * * Targets: BPMP
3273  * * Request Payload: @ref mrq_iso_client_request
3274  * * Response Payload: @ref mrq_iso_client_response
3275  *
3276  * @addtogroup ISO_CLIENT
3277  * @{
3278  */
3279 
3280 /**
3281  * @brief Sub-command identifiers for #MRQ_ISO_CLIENT.
3282  */
3283 enum mrq_iso_client_cmd {
3284 	/**
3285 	 * @brief Check whether BPMP-FW supports a specified
3286 	 *        #MRQ_ISO_CLIENT sub-command.
3287 	 *
3288 	 * mrq_response::err is 0 if the specified request is
3289 	 * supported and -#BPMP_ENODEV otherwise.
3290 	 */
3291 	CMD_ISO_CLIENT_QUERY_ABI = 0,
3292 
3293 	/**
3294 	 * @brief Determine legal LA for ISO client.
3295 	 *
3296 	 * Without programming LA MC registers, calculate and ensure that
3297 	 * a legal LA is possible for the ISO bandwidth requested by the
3298 	 * ISO client.
3299 	 *
3300 	 * mrq_response::err for this sub-command is defined as:
3301 	 *
3302 	 * | Value         | Description                                                  |
3303 	 * |---------------|--------------------------------------------------------------|
3304 	 * | 0             | Request successful and legal LA is possible.                 |
3305 	 * | -#BPMP_EINVAL | Invalid request parameters.                                  |
3306 	 * | -#BPMP_EFAULT | Legal LA is not possible for client requested ISO bandwidth. |
3307 	 * | <0            | Any other internal error.                                    |
3308 	 */
3309 	CMD_ISO_CLIENT_CALCULATE_LA = 1,
3310 
3311 	/**
3312 	 * @brief Set LA for ISO client.
3313 	 *
3314 	 * Calculate and program the LA/PTSA MC registers corresponding to the
3315 	 * ISO client making the bandwidth request.
3316 	 *
3317 	 * mrq_response::err for this sub-command is defined as:
3318 	 *
3319 	 * | Value         | Description                                  |
3320 	 * |---------------|----------------------------------------------|
3321 	 * | 0             | Setting LA succeeded.                        |
3322 	 * | -#BPMP_EINVAL | Invalid request parameters.                  |
3323 	 * | -#BPMP_EFAULT | Failed to calculate or program MC registers. |
3324 	 * | <0            | Any other internal error.                    |
3325 	 */
3326 	CMD_ISO_CLIENT_SET_LA = 2,
3327 
3328 	/**
3329 	 * @brief Get maximum possible bandwidth for ISO client.
3330 	 *
3331 	 * mrq_response::err for this sub-command is defined as:
3332 	 *
3333 	 * | Value         | Description                                  |
3334 	 * |---------------|----------------------------------------------|
3335 	 * | 0             | Operation successful.                        |
3336 	 * | -#BPMP_EINVAL | Invalid request parameters.                  |
3337 	 * | <0            | Any other internal error.                    |
3338 	 */
3339 	CMD_ISO_CLIENT_GET_MAX_BW = 3
3340 };
3341 
3342 /**
3343  * @brief Request payload for #MRQ_ISO_CLIENT sub-command #CMD_ISO_CLIENT_QUERY_ABI
3344  */
3345 struct cmd_iso_client_query_abi_request {
3346 	/**
3347 	 * @brief Sub-command identifier from @ref mrq_iso_client_cmd
3348 	 *        for which to check existence.
3349 	 */
3350 	uint32_t type;
3351 } BPMP_ABI_PACKED;
3352 
3353 /**
3354  * @brief Request payload #MRQ_ISO_CLIENT sub-command #CMD_ISO_CLIENT_CALCULATE_LA
3355  */
3356 struct cmd_iso_client_calculate_la_request {
3357 	/** @brief BWMGR client ID from @ref bpmp_bwmgr_ids */
3358 	uint32_t id;
3359 	/** @brief Bandwidth requested in kBps for the client specified in #id. */
3360 	uint32_t bw;
3361 	/**
3362 	 * @brief Initial DRAM bandwidth floor in kBps for the ISO client specified in #id.
3363 	 *
3364 	 * ISO client will perform mempool allocation and DVFS buffering based
3365 	 * on this value.
3366 	 */
3367 	uint32_t init_bw_floor;
3368 } BPMP_ABI_PACKED;
3369 
3370 /**
3371  * @brief Response payload for #MRQ_ISO_CLIENT sub-command #CMD_ISO_CLIENT_CALCULATE_LA
3372  */
3373 struct cmd_iso_client_calculate_la_response {
3374 	/** @brief Minimum DRAM rate in kHz at which a legal LA is possible */
3375 	uint32_t la_rate_floor;
3376 	/**
3377 	 * Minimum DRAM frequency in kHz required to satisfy this clients
3378 	 * ISO bandwidth request, assuming all other ISO clients are inactive.
3379 	 */
3380 	uint32_t iso_client_only_rate;
3381 } BPMP_ABI_PACKED;
3382 
3383 /**
3384  * @brief Request payload for #MRQ_ISO_CLIENT sub-command #CMD_ISO_CLIENT_SET_LA
3385  */
3386 struct cmd_iso_client_set_la_request {
3387 	/** @brief BMWGR client ID from @ref bpmp_bwmgr_ids */
3388 	uint32_t id;
3389 	/** @brief Bandwidth requested in kBps for the client specified in #id. */
3390 	uint32_t bw;
3391 	/**
3392 	 * @brief Final DRAM bandwidth floor in kBps.
3393 	 *
3394 	 * Sometimes the initial cmd_iso_client_calculate_la_request::dram_bw_floor
3395 	 * passed by ISO client may need to be updated by considering higher
3396 	 * DRAM frequencies. This is the final DRAM bandwidth floor value used
3397 	 * to calculate and program MC registers.
3398 	 */
3399 	uint32_t final_bw_floor;
3400 } BPMP_ABI_PACKED;
3401 
3402 /**
3403  * @brief Request payload for #MRQ_ISO_CLIENT sub-command #CMD_ISO_CLIENT_GET_MAX_BW
3404  */
3405 struct cmd_iso_client_get_max_bw_request {
3406 	/** @brief BWMGR client ID from @ref bpmp_bwmgr_ids */
3407 	uint32_t id;
3408 } BPMP_ABI_PACKED;
3409 
3410 /**
3411  * @brief Used by @ref cmd_iso_client_get_max_bw_response
3412  */
3413 struct iso_max_bw {
3414 	/** @brief dram frequency in kHz */
3415 	uint32_t freq;
3416 	/** @brief max possible iso-bw in kBps */
3417 	uint32_t iso_bw;
3418 } BPMP_ABI_PACKED;
3419 
3420 /**
3421  * @brief Size of the cmd_iso_client_get_max_bw_response::pairs -array.
3422  */
3423 #define ISO_MAX_BW_MAX_SIZE	14U
3424 
3425 /**
3426  * @brief Response payload for #MRQ_ISO_CLIENT sub-command #CMD_ISO_CLIENT_GET_MAX_BW
3427  */
3428 struct cmd_iso_client_get_max_bw_response {
3429 	/** @brief The number valid entries in iso_max_bw pairs */
3430 	uint32_t num_pairs;
3431 	/** @brief max ISOBW <dram freq, max bw> information */
3432 	struct iso_max_bw pairs[ISO_MAX_BW_MAX_SIZE];
3433 } BPMP_ABI_PACKED;
3434 
3435 /**
3436  * @brief Request payload for #MRQ_ISO_CLIENT command.
3437  *
3438  * Each #MRQ_ISO_CLIENT -command is expected to include a sub-command specific
3439  * payload as defined in table below:
3440  *
3441  * |Sub-command                  |Request payload                       |
3442  * |-----------------------------|--------------------------------------|
3443  * |#CMD_ISO_CLIENT_QUERY_ABI    |#cmd_iso_client_query_abi_request     |
3444  * |#CMD_ISO_CLIENT_CALCULATE_LA |#cmd_iso_client_calculate_la_request  |
3445  * |#CMD_ISO_CLIENT_SET_LA       |#cmd_iso_client_set_la_request        |
3446  * |#CMD_ISO_CLIENT_GET_MAX_BW   |#cmd_iso_client_get_max_bw_request    |
3447  */
3448 struct mrq_iso_client_request {
3449 	/** @brief Sub-command identifier from @ref mrq_iso_client_cmd. */
3450 	uint32_t cmd;
3451 
3452 	union {
3453 		struct cmd_iso_client_query_abi_request query_abi;
3454 		struct cmd_iso_client_calculate_la_request calculate_la_req;
3455 		struct cmd_iso_client_set_la_request set_la_req;
3456 		struct cmd_iso_client_get_max_bw_request max_isobw_req;
3457 	} BPMP_UNION_ANON;
3458 } BPMP_ABI_PACKED;
3459 
3460 /**
3461  * @brief Response payload for #MRQ_ISO_CLIENT command.
3462  *
3463  * Some of the sub-commands supported by #MRQ_ISO_CLIENT may return
3464  * a sub-command -specific payload in the MRQ response as defined in table
3465  * below:
3466  *
3467  * |Sub-command                  |Response payload                      |
3468  * |---------------------------- |--------------------------------------|
3469  * |#CMD_ISO_CLIENT_QUERY_ABI    |-                                     |
3470  * |#CMD_ISO_CLIENT_CALCULATE_LA |#cmd_iso_client_calculate_la_response |
3471  * |#CMD_ISO_CLIENT_SET_LA       |-                                     |
3472  * |#CMD_ISO_CLIENT_GET_MAX_BW   |#cmd_iso_client_get_max_bw_response   |
3473  *
3474  */
3475 struct mrq_iso_client_response {
3476 	union {
3477 		struct cmd_iso_client_calculate_la_response calculate_la_resp;
3478 		struct cmd_iso_client_get_max_bw_response max_isobw_resp;
3479 	} BPMP_UNION_ANON;
3480 } BPMP_ABI_PACKED;
3481 
3482 /** @} ISO_CLIENT */
3483 /** @endcond */
3484 
3485 /** @cond (!bpmp_t186)
3486  * @ingroup MRQ_Codes
3487  * @def MRQ_CPU_NDIV_LIMITS
3488  * @brief Return CPU cluster NDIV limits
3489  *
3490  * * Initiators: CCPLEX
3491  * * Targets: BPMP
3492  * * Request Payload: @ref mrq_cpu_ndiv_limits_request
3493  * * Response Payload: @ref mrq_cpu_ndiv_limits_response
3494  * @addtogroup CPU
3495  * @{
3496  */
3497 
3498 /**
3499  * @brief Request payload for the #MRQ_CPU_NDIV_LIMITS -command
3500  */
3501 struct mrq_cpu_ndiv_limits_request {
3502 	/** @brief Logical CPU cluster identifier */
3503 	uint32_t cluster_id;
3504 } BPMP_ABI_PACKED;
3505 
3506 /**
3507  * @brief Response to #MRQ_CPU_NDIV_LIMITS
3508  */
3509 struct mrq_cpu_ndiv_limits_response {
3510 	/** @brief Reference frequency in Hz */
3511 	uint32_t ref_clk_hz;
3512 	/** @brief Post divider value */
3513 	uint16_t pdiv;
3514 	/** @brief Input divider value */
3515 	uint16_t mdiv;
3516 	/** @brief FMAX expressed with max NDIV value */
3517 	uint16_t ndiv_max;
3518 	/** @brief Minimum allowed NDIV value */
3519 	uint16_t ndiv_min;
3520 } BPMP_ABI_PACKED;
3521 
3522 /** @} CPU */
3523 /** @endcond */
3524 
3525 
3526 /** @cond (bpmp_t194)
3527  * @ingroup MRQ_Codes
3528  * @def MRQ_CPU_AUTO_CC3
3529  * @brief Query CPU cluster auto-CC3 configuration
3530  *
3531  * * Initiators: CCPLEX
3532  * * Targets: BPMP
3533  * * Request Payload: @ref mrq_cpu_auto_cc3_request
3534  * * Response Payload: @ref mrq_cpu_auto_cc3_response
3535  * @addtogroup CC3
3536  *
3537  * Queries from BPMP auto-CC3 configuration (allowed/not allowed) for a
3538  * specified cluster. CCPLEX s/w uses this information to override its own
3539  * device tree auto-CC3 settings, so that BPMP device tree is a single source of
3540  * auto-CC3 platform configuration.
3541  *
3542  * @{
3543  */
3544 
3545 /**
3546  * @brief Request payload for the #MRQ_CPU_AUTO_CC3 -command
3547  */
3548 struct mrq_cpu_auto_cc3_request {
3549 	/** @brief Logical CPU cluster ID */
3550 	uint32_t cluster_id;
3551 } BPMP_ABI_PACKED;
3552 
3553 /**
3554  * @brief Response payload for the #MRQ_CPU_AUTO_CC3 -command
3555  */
3556 struct mrq_cpu_auto_cc3_response {
3557 	/**
3558 	 * @brief auto-CC3 configuration
3559 	 *
3560 	 * - bits[31..10] reserved.
3561 	 * - bits[9..1] cc3 ndiv
3562 	 * - bit [0] if "1" auto-CC3 is allowed, if "0" auto-CC3 is not allowed
3563 	 */
3564 	uint32_t auto_cc3_config;
3565 } BPMP_ABI_PACKED;
3566 
3567 /** @} CC3 */
3568 /** @endcond */
3569 
3570 /** @cond (bpmp_t186 || bpmp_t194 || bpmp_t234)
3571  * @ingroup MRQ_Codes
3572  * @def MRQ_RINGBUF_CONSOLE
3573  * @brief A ring buffer debug console for BPMP
3574  * @addtogroup RingbufConsole
3575  *
3576  * The ring buffer debug console aims to be a substitute for the UART debug
3577  * console. The debug console is implemented with two ring buffers in the
3578  * BPMP-FW, the RX (receive) and TX (transmit) buffers. Characters can be read
3579  * and written to the buffers by the host via the MRQ interface.
3580  *
3581  * @{
3582  */
3583 
3584 /**
3585  * @brief Maximum number of bytes transferred in a single write command to the
3586  * BPMP
3587  *
3588  * This is determined by the number of free bytes in the message struct,
3589  * rounded down to a multiple of four.
3590  */
3591 #define MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN 112
3592 
3593 /**
3594  * @brief Maximum number of bytes transferred in a single read command to the
3595  * BPMP
3596  *
3597  * This is determined by the number of free bytes in the message struct,
3598  * rounded down to a multiple of four.
3599  */
3600 #define MRQ_RINGBUF_CONSOLE_MAX_READ_LEN 116
3601 
3602 enum mrq_ringbuf_console_host_to_bpmp_cmd {
3603 	/**
3604 	 * @brief Check whether the BPMP driver supports the specified request
3605 	 * type
3606 	 *
3607 	 * mrq_response::err is 0 if the specified request is supported and
3608 	 * -#BPMP_ENODEV otherwise
3609 	 */
3610 	CMD_RINGBUF_CONSOLE_QUERY_ABI = 0,
3611 	/**
3612 	 * @brief Perform a read operation on the BPMP TX buffer
3613 	 *
3614 	 * mrq_response::err is 0
3615 	 */
3616 	CMD_RINGBUF_CONSOLE_READ = 1,
3617 	/**
3618 	 * @brief Perform a write operation on the BPMP RX buffer
3619 	 *
3620 	 * mrq_response::err is 0 if the operation was successful and
3621 	 * -#BPMP_ENODEV otherwise
3622 	 */
3623 	CMD_RINGBUF_CONSOLE_WRITE = 2,
3624 	/**
3625 	 * @brief Get the length of the buffer and the physical addresses of
3626 	 * the buffer data and the head and tail counters
3627 	 *
3628 	 * mrq_response::err is 0 if the operation was successful and
3629 	 * -#BPMP_ENODEV otherwise
3630 	 */
3631 	CMD_RINGBUF_CONSOLE_GET_FIFO = 3,
3632 };
3633 
3634 /**
3635  * @ingroup RingbufConsole
3636  * @brief Host->BPMP request data for request type
3637  * #CMD_RINGBUF_CONSOLE_QUERY_ABI
3638  */
3639 struct cmd_ringbuf_console_query_abi_req {
3640 	/** @brief Command identifier to be queried */
3641 	uint32_t cmd;
3642 } BPMP_ABI_PACKED;
3643 
3644 /** @private */
3645 struct cmd_ringbuf_console_query_abi_resp {
3646 	BPMP_ABI_EMPTY
3647 } BPMP_ABI_PACKED;
3648 
3649 /**
3650  * @ingroup RingbufConsole
3651  * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_READ
3652  */
3653 struct cmd_ringbuf_console_read_req {
3654 	/**
3655 	 * @brief Number of bytes requested to be read from the BPMP TX buffer.
3656 	 *
3657 	 * Valid range is [0, #MRQ_RINGBUF_CONSOLE_MAX_READ_LEN]
3658 	 */
3659 	uint8_t len;
3660 } BPMP_ABI_PACKED;
3661 
3662 /**
3663  * @ingroup RingbufConsole
3664  * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_READ
3665  */
3666 struct cmd_ringbuf_console_read_resp {
3667 	/** @brief The actual data read from the BPMP TX buffer */
3668 	uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_READ_LEN];
3669 	/**
3670 	 * @brief Number of bytes in cmd_ringbuf_console_read_resp::data
3671 	 *
3672 	 * Valid range is [0, #MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN]
3673 	 */
3674 	uint8_t len;
3675 } BPMP_ABI_PACKED;
3676 
3677 /**
3678  * @ingroup RingbufConsole
3679  * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_WRITE
3680  */
3681 struct cmd_ringbuf_console_write_req {
3682 	/** @brief The actual data to be written to the BPMP RX buffer */
3683 	uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN];
3684 	/** @brief Number of bytes in cmd_ringbuf_console_write_req::data */
3685 	uint8_t len;
3686 } BPMP_ABI_PACKED;
3687 
3688 /**
3689  * @ingroup RingbufConsole
3690  * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_WRITE
3691  */
3692 struct cmd_ringbuf_console_write_resp {
3693 	/** @brief Number of bytes of available space in the BPMP RX buffer */
3694 	uint32_t space_avail;
3695 	/** @brief Number of bytes that were written to the BPMP RX buffer */
3696 	uint8_t len;
3697 } BPMP_ABI_PACKED;
3698 
3699 /** @private */
3700 struct cmd_ringbuf_console_get_fifo_req {
3701 	BPMP_ABI_EMPTY
3702 } BPMP_ABI_PACKED;
3703 
3704 /**
3705  * @ingroup RingbufConsole
3706  * @brief BPMP->Host reply data for request type #CMD_RINGBUF_CONSOLE_GET_FIFO
3707  */
3708 struct cmd_ringbuf_console_get_fifo_resp {
3709 	/** @brief Physical address of the BPMP TX buffer */
3710 	uint64_t bpmp_tx_buf_addr;
3711 	/** @brief Physical address of the BPMP TX buffer head counter */
3712 	uint64_t bpmp_tx_head_addr;
3713 	/** @brief Physical address of the BPMP TX buffer tail counter */
3714 	uint64_t bpmp_tx_tail_addr;
3715 	/** @brief Length of the BPMP TX buffer */
3716 	uint32_t bpmp_tx_buf_len;
3717 } BPMP_ABI_PACKED;
3718 
3719 /**
3720  * @ingroup RingbufConsole
3721  * @brief Host->BPMP request data.
3722  *
3723  * Reply type is union #mrq_ringbuf_console_bpmp_to_host_response .
3724  */
3725 struct mrq_ringbuf_console_host_to_bpmp_request {
3726 	/**
3727 	 * @brief Type of request. Values listed in enum
3728 	 * #mrq_ringbuf_console_host_to_bpmp_cmd.
3729 	 */
3730 	uint32_t type;
3731 	/** @brief  request type specific parameters. */
3732 	union {
3733 		struct cmd_ringbuf_console_query_abi_req query_abi;
3734 		struct cmd_ringbuf_console_read_req read;
3735 		struct cmd_ringbuf_console_write_req write;
3736 		struct cmd_ringbuf_console_get_fifo_req get_fifo;
3737 	} BPMP_UNION_ANON;
3738 } BPMP_ABI_PACKED;
3739 
3740 /**
3741  * @ingroup RingbufConsole
3742  * @brief Host->BPMP reply data
3743  *
3744  * In response to struct #mrq_ringbuf_console_host_to_bpmp_request.
3745  */
3746 union mrq_ringbuf_console_bpmp_to_host_response {
3747 	struct cmd_ringbuf_console_query_abi_resp query_abi;
3748 	struct cmd_ringbuf_console_read_resp read;
3749 	struct cmd_ringbuf_console_write_resp write;
3750 	struct cmd_ringbuf_console_get_fifo_resp get_fifo;
3751 } BPMP_ABI_PACKED;
3752 
3753 /** @} RingbufConsole */
3754 /** @endcond */
3755 
3756 /** @cond (!bpmp_t186 && !(bpmp_safe && bpmp_t234))
3757  * @ingroup MRQ_Codes
3758  * @def MRQ_STRAP
3759  * @brief Set a strap value controlled by BPMP
3760  *
3761  * * Initiators: CCPLEX
3762  * * Targets: BPMP
3763  * * Request Payload: @ref mrq_strap_request
3764  * * Response Payload: N/A
3765  * @addtogroup Strap
3766  *
3767  * A strap is an input that is sampled by a hardware unit during the
3768  * unit's startup process. The sampled value of a strap affects the
3769  * behavior of the unit until the unit is restarted. Many hardware
3770  * units sample their straps at the instant that their resets are
3771  * deasserted.
3772  *
3773  * BPMP owns registers which act as straps to various units. It
3774  * exposes limited control of those registers via #MRQ_STRAP.
3775  *
3776  * @{
3777  */
3778 
3779 /**
3780  * @brief Sub-command identifiers for the #MRQ_STRAP -command.
3781  */
3782 enum mrq_strap_cmd {
3783 	/** @private */
3784 	STRAP_RESERVED = 0,
3785 	/** @brief Set a strap value */
3786 	STRAP_SET = 1
3787 };
3788 
3789 /**
3790  * @brief Request payload for the #MRQ_STRAP -command.
3791  */
3792 struct mrq_strap_request {
3793 	/** @brief Sub-command identifier from @ref mrq_strap_cmd */
3794 	uint32_t cmd;
3795 	/**
3796 	 * @if (bpmp_t234 || bpmp_th500 || bpmp_t264)
3797 	 * @brief Strap ID from @ref bpmp_strap_ids
3798 	 * @else
3799 	 * @brief Strap ID (undefined)
3800 	 * @endif
3801 	 */
3802 	uint32_t id;
3803 	/** @brief Desired value for strap (if #cmd is #STRAP_SET) */
3804 	uint32_t value;
3805 } BPMP_ABI_PACKED;
3806 
3807 /** @} Strap */
3808 /** @endcond */
3809 
3810 /** @cond (bpmp_t194 || bpmp_t234 || bpmp_th500)
3811  * @ingroup MRQ_Codes
3812  * @def MRQ_UPHY
3813  * @brief Perform a UPHY operation
3814  *
3815  * * Initiators: CCPLEX
3816  * * Targets: BPMP
3817  * * Request Payload: @ref mrq_uphy_request
3818  * * Response Payload: @ref mrq_uphy_response
3819  *
3820  * @addtogroup UPHY
3821  * @{
3822  */
3823 
3824 /**
3825  * @brief Sub-command identifiers for #MRQ_UPHY.
3826  */
3827 enum mrq_uphy_cmd {
3828 	/** @brief Trigger PCIE lane margining procedure. */
3829 	CMD_UPHY_PCIE_LANE_MARGIN_CONTROL = 1,
3830 	/** @brief Return PCIE lane margining status. */
3831 	CMD_UPHY_PCIE_LANE_MARGIN_STATUS = 2,
3832 	/** @brief Initialize PCIE EP PLL controller. */
3833 	CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT = 3,
3834 	/** @brief Set state of the PCIE RP/EP controller. */
3835 	CMD_UPHY_PCIE_CONTROLLER_STATE = 4,
3836 	/** @brief Disable PCIE EP PLL controller. */
3837 	CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF = 5,
3838 
3839 	/**
3840 	 * @cond bpmp_t238
3841 	 * @brief Initialize and enable UPHY display port.
3842 	 */
3843 	CMD_UPHY_DISPLAY_PORT_INIT = 6,
3844 	/** @brief Disable UPHY display port. */
3845 	CMD_UPHY_DISPLAY_PORT_OFF = 7,
3846 	/** @brief Trigger sequence to restore XUSB DYN lanes during SC7 exit. */
3847 	CMD_UPHY_XUSB_DYN_LANES_RESTORE = 8,
3848 	/** @endcond */
3849 
3850 	/**
3851 	 * @cond bpmp_th500
3852 	 * @brief Perform UPHY Lane EOM scan.
3853 	 */
3854 	CMD_UPHY_LANE_EOM_SCAN = 9,
3855 	/** @brief Config PCIe VDM with a given BDF ID. */
3856 	CMD_UPHY_PCIE_CONFIG_VDM = 10,
3857 	/** @endcond */
3858 
3859 	CMD_UPHY_MAX,
3860 };
3861 
3862 /**
3863  * @brief Request payload for #MRQ_UPHY sub-command #CMD_UPHY_PCIE_LANE_MARGIN_CONTROL.
3864  */
3865 struct cmd_uphy_margin_control_request {
3866 	/**
3867 	 * @brief Enable margin.
3868 	 *
3869 	 * Valid values:
3870 	 * * Value 0 disables margin,
3871 	 * * Value 1 enables margin.
3872 	 */
3873 	int32_t en;
3874 	/**
3875 	 * @brief Clear the number of error and sections.
3876 	 *
3877 	 * Valid values:
3878 	 *
3879 	 * * Value 0: Skip clear,
3880 	 * * Value 1: Perform clear.
3881 	 */
3882 	int32_t clr;
3883 	/**
3884 	 * @brief Set x offset (1's complement) for left/right margin type (y should be 0).
3885 	 *
3886 	 * Valid range is [0, 127]
3887 	 */
3888 	uint32_t x;
3889 	/**
3890 	 * @brief Set y offset (1's complement) for left/right margin type (x should be 0)
3891 	 *
3892 	 * Valid range is [0, 63]
3893 	 */
3894 	uint32_t y;
3895 	/**
3896 	 * @brief Set number of bit blocks for each margin section.
3897 	 *
3898 	 * Valid range is [0, 15]
3899 	 */
3900 	uint32_t nblks;
3901 } BPMP_ABI_PACKED;
3902 
3903 /**
3904  * @brief Response payload for #MRQ_UPHY sub-command #CMD_UPHY_PCIE_LANE_MARGIN_STATUS.
3905  */
3906 struct cmd_uphy_margin_status_response {
3907 	/** @brief Number of errors observed */
3908 	uint32_t status;
3909 } BPMP_ABI_PACKED;
3910 
3911 /**
3912  * @brief Request payload for #MRQ_UPHY sub-command #CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT.
3913  */
3914 struct cmd_uphy_ep_controller_pll_init_request {
3915 	/** @brief EP controller number, T194 valid: 0, 4, 5; T234 valid: 5, 6, 7, 10; T238 valid: 0 */
3916 	uint8_t ep_controller;
3917 } BPMP_ABI_PACKED;
3918 
3919 /**
3920  * @brief Request payload for #MRQ_UPHY sub-command #CMD_UPHY_PCIE_CONTROLLER_STATE.
3921  */
3922 struct cmd_uphy_pcie_controller_state_request {
3923 	/** @brief PCIE controller number, T194 valid: 0-4; T234 valid: 0-10; T238 valid: 0-3 */
3924 	uint8_t pcie_controller;
3925 	/** @brief Nonzero value to enable controller, zero value to disable */
3926 	uint8_t enable;
3927 } BPMP_ABI_PACKED;
3928 
3929 /**
3930  * @brief Request payload for #MRQ_UPHY sub-command #CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF.
3931  */
3932 struct cmd_uphy_ep_controller_pll_off_request {
3933 	/** @brief EP controller number, T194 valid: 0, 4, 5; T234 valid: 5, 6, 7, 10; T238 valid: 0 */
3934 	uint8_t ep_controller;
3935 } BPMP_ABI_PACKED;
3936 
3937 /**
3938  * @cond bpmp_t238
3939  * @brief Request payload for #MRQ_UPHY sub-command #CMD_UPHY_DISPLAY_PORT_INIT.
3940  */
3941 struct cmd_uphy_display_port_init_request {
3942 	/** @brief DisplayPort link rate, T238 valid: 1620, 2700, 5400, 8100, 2160, 2430, 3240, 4320, 6750 */
3943 	uint16_t link_rate;
3944 	/** @brief 1: lane 0; 2: lane 1; 3: lane 0 and 1 */
3945 	uint16_t lanes_bitmap;
3946 } BPMP_ABI_PACKED;
3947 
3948 /**
3949  * @brief Request payload for #MRQ_UPHY sub-command #CMD_UPHY_XUSB_DYN_LANES_RESTORE.
3950  */
3951 struct cmd_uphy_xusb_dyn_lanes_restore_request {
3952 	/** @brief 1: lane 0; 2: lane 1; 3: lane 0 and 1 */
3953 	uint16_t lanes_bitmap;
3954 } BPMP_ABI_PACKED;
3955 /** @endcond */
3956 
3957 /**
3958  * @cond bpmp_th500
3959  * @brief Request payload for #MRQ_UPHY sub-command #CMD_UPHY_LANE_EOM_SCAN
3960  */
3961 struct cmd_uphy_lane_eom_scan_request {
3962 	/** @brief UPHY brick number, valid: 0-5 */
3963 	uint32_t brick;
3964 	/** @brief UPHY lane number, valid: 0-15 for UPHY0-UPHY3, 0-1 for UPHY4-UPHY5 */
3965 	uint32_t lane;
3966 	/** @brief Perform EOM for PCIE GEN5 link: 1 for yes, 0 for no. */
3967 	uint32_t pcie_gen5;
3968 } BPMP_ABI_PACKED;
3969 
3970 /**
3971  * @brief Response payload for #MRQ_UPHY sub-command #CMD_UPHY_LANE_EOM_SCAN
3972  */
3973 struct cmd_uphy_lane_eom_scan_response {
3974 	uint32_t data;
3975 } BPMP_ABI_PACKED;
3976 
3977 /**
3978  * @brief Request payload for #MRQ_UPHY sub-command #CMD_UPHY_PCIE_CONFIG_VDM
3979  */
3980 struct cmd_uphy_pcie_config_vdm_request {
3981 	uint8_t pcie_controller;
3982 	/**
3983 	 * @brief Bus/Dev/Func ID to be programmed for VDM.
3984 	 *
3985 	 * - bits[15..8] Bus
3986 	 * - bits[7..3]  Dev
3987 	 * - bit [2..0]  Func
3988 	 */
3989 	uint16_t bdf;
3990 } BPMP_ABI_PACKED;
3991 /** @endcond */
3992 
3993 /**
3994  * @ingroup UPHY
3995  * @brief Request payload for the #MRQ_UPHY -command.
3996  *
3997  * Used by the sender of an #MRQ_UPHY message to control UPHY.
3998  * The uphy_request is split into several sub-commands. CMD_UPHY_PCIE_LANE_MARGIN_STATUS
3999  * requires no additional data. Others have a sub-command specific payload. Below table
4000  * shows sub-commands with their corresponding payload data.
4001  *
4002  * |sub-command                           |payload                                  |
4003  * |--------------------------------------|-----------------------------------------|
4004  * |#CMD_UPHY_PCIE_LANE_MARGIN_CONTROL    |#cmd_uphy_margin_control_request         |
4005  * |#CMD_UPHY_PCIE_LANE_MARGIN_STATUS     |-                                        |
4006  * |#CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT |#cmd_uphy_ep_controller_pll_init_request |
4007  * |#CMD_UPHY_PCIE_CONTROLLER_STATE       |#cmd_uphy_pcie_controller_state_request  |
4008  * |#CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF  |#cmd_uphy_ep_controller_pll_off_request  |
4009  *
4010  * @cond bpmp_t238
4011  * The following additional sub-commands are supported on T238 platforms:
4012  *
4013  * |sub-command                           |payload                                  |
4014  * |--------------------------------------|-----------------------------------------|
4015  * |#CMD_UPHY_DISPLAY_PORT_INIT           |#cmd_uphy_display_port_init_request      |
4016  * |#CMD_UPHY_DISPLAY_PORT_OFF            |-                                        |
4017  * |#CMD_UPHY_XUSB_DYN_LANES_RESTORE      |#cmd_uphy_xusb_dyn_lanes_restore_request |
4018  * @endcond
4019  *
4020  * @cond bpmp_th500
4021  * The following additional sub-commands are supported on TH500 platforms:
4022  * |sub-command                           |payload                                  |
4023  * |--------------------------------------|-----------------------------------------|
4024  * |#CMD_UPHY_LANE_EOM_SCAN               |#cmd_uphy_lane_eom_scan_request          |
4025  * |#CMD_UPHY_PCIE_CONFIG_VDM             |#cmd_uphy_pcie_config_vdm_request        |
4026  * @endcond
4027  */
4028 struct mrq_uphy_request {
4029 	/** @brief Lane number. */
4030 	uint16_t lane;
4031 	/** @brief Sub-command ID from @ref mrq_uphy_cmd. */
4032 	uint16_t cmd;
4033 
4034 	union {
4035 		struct cmd_uphy_margin_control_request uphy_set_margin_control;
4036 		struct cmd_uphy_ep_controller_pll_init_request ep_ctrlr_pll_init;
4037 		struct cmd_uphy_pcie_controller_state_request controller_state;
4038 		struct cmd_uphy_ep_controller_pll_off_request ep_ctrlr_pll_off;
4039 		/** @cond bpmp_t238 */
4040 		struct cmd_uphy_display_port_init_request display_port_init;
4041 		struct cmd_uphy_xusb_dyn_lanes_restore_request xusb_dyn_lanes_restore;
4042 		/** @endcond */
4043 		/** @cond bpmp_th500 */
4044 		struct cmd_uphy_lane_eom_scan_request lane_eom_scan;
4045 		struct cmd_uphy_pcie_config_vdm_request pcie_vdm;
4046 		/** @endcond */
4047 	} BPMP_UNION_ANON;
4048 } BPMP_ABI_PACKED;
4049 
4050 /**
4051  * @ingroup UPHY
4052  * @brief Response payload for the #MRQ_UPHY -command.
4053  *
4054  * Each sub-command supported by @ref mrq_uphy_request may return
4055  * sub-command-specific data. Some do and some do not as indicated in
4056  * the following table
4057  *
4058  * |sub-command                        |payload                          |
4059  * |-----------------------------------|---------------------------------|
4060  * |#CMD_UPHY_PCIE_LANE_MARGIN_CONTROL |-                                |
4061  * |#CMD_UPHY_PCIE_LANE_MARGIN_STATUS  |#cmd_uphy_margin_status_response |
4062  *
4063  * @cond bpmp_th500
4064  * The following additional sub-commands are supported on TH500 platforms:
4065  * |sub-command                        |payload                          |
4066  * |-----------------------------------|---------------------------------|
4067  * |#CMD_UPHY_LANE_EOM_SCAN            |#cmd_uphy_lane_eom_scan_response |
4068  * |#CMD_UPHY_PCIE_CONFIG_VDM          |-                                |
4069  * @endcond
4070  */
4071 struct mrq_uphy_response {
4072 	union {
4073 		struct cmd_uphy_margin_status_response uphy_get_margin_status;
4074 		/** @cond bpmp_th500 */
4075 		struct cmd_uphy_lane_eom_scan_response eom_status;
4076 		/** @endcond */
4077 	} BPMP_UNION_ANON;
4078 } BPMP_ABI_PACKED;
4079 
4080 /** @} UPHY */
4081 /** @endcond */
4082 
4083 /** @cond (bpmp_t194 || bpmp_t234 || bpmp_t238 || bpmp_t264)
4084  * @ingroup MRQ_Codes
4085  * @def MRQ_FMON
4086  * @brief Perform a frequency monitor configuration operation
4087  *
4088  * * Initiators: CCPLEX
4089  * * Targets: BPMP
4090  * * Request Payload: @ref mrq_fmon_request
4091  * * Response Payload: @ref mrq_fmon_response
4092  *
4093  * @addtogroup FMON
4094  * @{
4095  */
4096 
4097 /**
4098  * @brief Sub-command identifiers for #MRQ_FMON
4099  */
4100 enum mrq_fmon_cmd {
4101 	/**
4102 	 * @brief Clamp FMON configuration to specified rate.
4103 	 *
4104 	 * The monitored clock must be running for clamp to succeed. If
4105 	 * clamped, FMON configuration is preserved when clock rate
4106 	 * and/or state is changed.
4107 	 *
4108 	 * mrq_response::err for this sub-command is defined to be:
4109 	 *
4110 	 * | Value             | Description                                       |
4111 	 * |-------------------|---------------------------------------------------|
4112 	 * | 0                 | Operation was successful.                         |
4113 	 * | -#BPMP_EBADCMD    | Subcommand is not supported.                      |
4114 	 * | -#BPMP_EACCES     | FMON access error.                                |
4115 	 * | -#BPMP_EBADSLT    | Clamp FMON on cluster with auto-CC3 enabled.      |
4116 	 * | -#BPMP_EBUSY      | FMON is already clamped at different rate.        |
4117 	 * | -#BPMP_EFAULT     | Self-diagnostic error detected.                   |
4118 	 * | -#BPMP_EINVAL     | Invalid FMON configuration.                       |
4119 	 * | -#BPMP_EOPNOTSUPP | Not in production mode.                           |
4120 	 * | -#BPMP_ENODEV     | Invalid clock ID in mrq_fmon_request::cmd_and_id. |
4121 	 * | -#BPMP_ENOENT     | No calibration data, uninitialized.               |
4122 	 * | -#BPMP_ENOTSUP    | AVFS config not set.                              |
4123 	 * | -#BPMP_ENOSYS     | Clamp FMON on cluster clock w/ no NAFLL.          |
4124 	 * | -#BPMP_ETIMEDOUT  | Operation timed out.                              |
4125 	 */
4126 	CMD_FMON_GEAR_CLAMP = 1,
4127 
4128 	/**
4129 	 * @brief Release clamped FMON configuration.
4130 	 *
4131 	 * Allow FMON configuration to follow monitored clock rate
4132 	 * and/or state changes.
4133 	 *
4134 	 * mrq_response::err for this sub-command is defined to be:
4135 	 *
4136 	 * | Value             | Description                                       |
4137 	 * |-------------------|---------------------------------------------------|
4138 	 * | 0                 | Operation was successful.                         |
4139 	 * | -#BPMP_EBADCMD    | Subcommand is not supported.                      |
4140 	 * | -#BPMP_ENODEV     | Invalid clock ID in mrq_fmon_request::cmd_and_id. |
4141 	 * | -#BPMP_ENOENT     | No calibration data, uninitialized.               |
4142 	 * | -#BPMP_ENOTSUP    | AVFS config not set.                              |
4143 	 * | -#BPMP_EOPNOTSUPP | Not in production mode.                           |
4144 	 */
4145 	CMD_FMON_GEAR_FREE = 2,
4146 
4147 	/**
4148 	 * @brief Return rate FMON is clamped at, or 0 if FMON is not clamped.
4149 	 *
4150 	 * Inherently racy, since clamp state can be changed concurrently,
4151 	 * only provided and useful for testing purposes.
4152 	 *
4153 	 * mrq_response::err for this sub-command is defined to be:
4154 	 *
4155 	 * | Value             | Description                                       |
4156 	 * |-------------------|---------------------------------------------------|
4157 	 * | 0                 | Operation was successful.                         |
4158 	 * | -#BPMP_EBADCMD    | Subcommand is not supported.                      |
4159 	 * | -#BPMP_ENODEV     | Invalid clock ID in mrq_fmon_request::cmd_and_id. |
4160 	 * | -#BPMP_ENOENT     | No calibration data, uninitialized.               |
4161 	 * | -#BPMP_ENOTSUP    | AVFS config not set.                              |
4162 	 * | -#BPMP_EOPNOTSUPP | Not in production mode.                           |
4163 	 */
4164 	CMD_FMON_GEAR_GET = 3,
4165 
4166 	/**
4167 	 * @brief Return current status of FMON faults detected by FMON
4168 	 *        HW or SW since last invocation of this sub-command.
4169 	 *        Clears fault status.
4170 	 *
4171 	 * mrq_response::err for this sub-command is defined to be:
4172 	 *
4173 	 * | Value             | Description                                       |
4174 	 * |-------------------|---------------------------------------------------|
4175 	 * | 0                 | Operation was successful.                         |
4176 	 * | -#BPMP_EBADCMD    | Subcommand is not supported.                      |
4177 	 * | -#BPMP_ENODEV     | Invalid clock ID in mrq_fmon_request::cmd_and_id. |
4178 	 * | -#BPMP_ENOENT     | No calibration data, uninitialized.               |
4179 	 * | -#BPMP_ENOTSUP    | AVFS config not set.                              |
4180 	 * | -#BPMP_EOPNOTSUPP | Not in production mode.                           |
4181 	 * | -#BPMP_EINVAL     | Invalid fault type.                               |
4182 	 */
4183 	CMD_FMON_FAULT_STS_GET = 4,
4184 };
4185 
4186 /**
4187  * @cond DEPRECATED
4188  * Kept for backward compatibility
4189  */
4190 #define CMD_FMON_NUM		4
4191 
4192 /** @endcond */
4193 
4194 /**
4195  * @defgroup fmon_fault_type FMON fault types
4196  * @addtogroup fmon_fault_type
4197  * @{
4198  */
4199 /** @brief All detected FMON faults (HW or SW) */
4200 #define FMON_FAULT_TYPE_ALL		0U
4201 /** @brief FMON faults detected by HW */
4202 #define FMON_FAULT_TYPE_HW		1U
4203 /** @brief FMON faults detected by SW */
4204 #define FMON_FAULT_TYPE_SW		2U
4205 
4206 /** @} fmon_fault_type */
4207 
4208 /**
4209  * @brief Request payload for #MRQ_FMON sub-command #CMD_FMON_GEAR_CLAMP.
4210  */
4211 struct cmd_fmon_gear_clamp_request {
4212 	/** @brief Unused / reserved */
4213 	int32_t unused;
4214 
4215 	/** @brief Target rate in Hz. Valid range for the rate is [1, INT64_MAX] */
4216 	int64_t rate;
4217 } BPMP_ABI_PACKED;
4218 
4219 /** @private */
4220 struct cmd_fmon_gear_clamp_response {
4221 	BPMP_ABI_EMPTY
4222 } BPMP_ABI_PACKED;
4223 
4224 /** @private */
4225 struct cmd_fmon_gear_free_request {
4226 	BPMP_ABI_EMPTY
4227 } BPMP_ABI_PACKED;
4228 
4229 /** @private */
4230 struct cmd_fmon_gear_free_response {
4231 	BPMP_ABI_EMPTY
4232 } BPMP_ABI_PACKED;
4233 
4234 /** @private */
4235 struct cmd_fmon_gear_get_request {
4236 	BPMP_ABI_EMPTY
4237 } BPMP_ABI_PACKED;
4238 
4239 /**
4240  * @brief Response payload for #MRQ_FMON sub-command #CMD_FMON_GEAR_GET.
4241  */
4242 struct cmd_fmon_gear_get_response {
4243 	int64_t rate;
4244 } BPMP_ABI_PACKED;
4245 
4246 /**
4247  * @brief Request payload for #MRQ_FMON sub-command #CMD_FMON_FAULT_STS_GET
4248  */
4249 struct cmd_fmon_fault_sts_get_request {
4250 	/**
4251 	 * @brief Which fault types to return in response:
4252 	 *
4253 	 * | Value                | Description                             |
4254 	 * |----------------------|-----------------------------------------|
4255 	 * | #FMON_FAULT_TYPE_ALL | Return all detected faults (HW and SW). |
4256 	 * | #FMON_FAULT_TYPE_HW  | Return only HW detected faults.         |
4257 	 * | #FMON_FAULT_TYPE_SW  | Return only SW detected faults.         |
4258 	 */
4259 	uint32_t fault_type;
4260 } BPMP_ABI_PACKED;
4261 
4262 /**
4263  * @brief Response payload for #MRQ_FMON sub-command #CMD_FMON_FAULT_STS_GET
4264  */
4265 struct cmd_fmon_fault_sts_get_response {
4266 	/**
4267 	 * Bitmask of detected HW / SW specific faults, or 0 if no faults have
4268 	 * been detected since last invocation of #CMD_FMON_FAULT_STS_GET.
4269 	 */
4270 	uint32_t fault_sts;
4271 } BPMP_ABI_PACKED;
4272 
4273 /**
4274  * @ingroup FMON
4275  * @brief Request payload for the #MRQ_FMON -command.
4276  *
4277  * Used by the sender of an #MRQ_FMON message to configure clock
4278  * frequency monitors. The FMON request is split into several
4279  * sub-commands. Sub-command specific payloads are defined in
4280  * the following table:
4281  *
4282  * |Sub-command             |Payload                         |
4283  * |------------------------|--------------------------------|
4284  * |#CMD_FMON_GEAR_CLAMP    |#cmd_fmon_gear_clamp_request    |
4285  * |#CMD_FMON_GEAR_FREE     |-                               |
4286  * |#CMD_FMON_GEAR_GET      |-                               |
4287  * |#CMD_FMON_FAULT_STS_GET |#cmd_fmon_fault_sts_get_request |
4288  *
4289  */
4290 struct mrq_fmon_request {
4291 	/**
4292 	 * @brief Sub-command and clock id concatenated to 32-bit word.
4293 	 *
4294 	 * - bits[31..24] -> Sub-command identifier from @ref mrq_fmon_cmd.
4295 	 * - bits[23..0] -> Monitored clock identifier used to select target FMON.
4296 	 */
4297 	uint32_t cmd_and_id;
4298 
4299 	union {
4300 		struct cmd_fmon_gear_clamp_request fmon_gear_clamp;
4301 		/** @private */
4302 		struct cmd_fmon_gear_free_request fmon_gear_free;
4303 		/** @private */
4304 		struct cmd_fmon_gear_get_request fmon_gear_get;
4305 		struct cmd_fmon_fault_sts_get_request fmon_fault_sts_get;
4306 	} BPMP_UNION_ANON;
4307 } BPMP_ABI_PACKED;
4308 
4309 /**
4310  * @ingroup FMON
4311  * @brief Response payload for the #MRQ_FMON -command.
4312  *
4313  * Each sub-command supported by @ref mrq_fmon_request may
4314  * return sub-command-specific data as indicated below.
4315  *
4316  * |Sub-command             |Payload                          |
4317  * |------------------------|---------------------------------|
4318  * |#CMD_FMON_GEAR_CLAMP    |-                                |
4319  * |#CMD_FMON_GEAR_FREE     |-                                |
4320  * |#CMD_FMON_GEAR_GET      |#cmd_fmon_gear_get_response      |
4321  * |#CMD_FMON_FAULT_STS_GET |#cmd_fmon_fault_sts_get_response |
4322  *
4323  */
4324 struct mrq_fmon_response {
4325 	union {
4326 		/** @private */
4327 		struct cmd_fmon_gear_clamp_response fmon_gear_clamp;
4328 		/** @private */
4329 		struct cmd_fmon_gear_free_response fmon_gear_free;
4330 		struct cmd_fmon_gear_get_response fmon_gear_get;
4331 		struct cmd_fmon_fault_sts_get_response fmon_fault_sts_get;
4332 	} BPMP_UNION_ANON;
4333 } BPMP_ABI_PACKED;
4334 
4335 /** @} FMON */
4336 /** @endcond */
4337 
4338 /** @cond (bpmp_t194)
4339  * @ingroup MRQ_Codes
4340  * @def MRQ_EC
4341  * @brief Provide status information on faults reported by Error
4342  *        Collator (EC) to HSM.
4343  *
4344  * * Initiators: CCPLEX
4345  * * Targets: BPMP
4346  * * Request Payload: @ref mrq_ec_request
4347  * * Response Payload: @ref mrq_ec_response
4348  *
4349  * @note This MRQ ABI is under construction, and subject to change
4350  *
4351  * @addtogroup EC
4352  * @{
4353  */
4354 enum {
4355 	/**
4356 	 * @cond DEPRECATED
4357 	 * @brief Retrieve specified EC status.
4358 	 *
4359 	 * mrq_response::err is 0 if the operation was successful, or @n
4360 	 * -#BPMP_ENODEV if target EC is not owned by BPMP @n
4361 	 * -#BPMP_EACCES if target EC power domain is turned off @n
4362 	 * -#BPMP_EBADCMD if subcommand is not supported
4363 	 * @endcond
4364 	 */
4365 	CMD_EC_STATUS_GET = 1,	/* deprecated */
4366 
4367 	/**
4368 	 * @brief Retrieve specified EC extended status (includes error
4369 	 *        counter and user values).
4370 	 *
4371 	 * mrq_response::err is 0 if the operation was successful, or @n
4372 	 * -#BPMP_ENODEV if target EC is not owned by BPMP @n
4373 	 * -#BPMP_EACCES if target EC power domain is turned off @n
4374 	 * -#BPMP_EBADCMD if subcommand is not supported
4375 	 */
4376 	CMD_EC_STATUS_EX_GET = 2,
4377 	CMD_EC_NUM,
4378 };
4379 
4380 /** @brief BPMP ECs error types */
4381 enum bpmp_ec_err_type {
4382 	/** @brief Parity error on internal data path
4383 	 *
4384 	 *  Error descriptor @ref ec_err_simple_desc.
4385 	 */
4386 	EC_ERR_TYPE_PARITY_INTERNAL		= 1,
4387 
4388 	/** @brief ECC SEC error on internal data path
4389 	 *
4390 	 *  Error descriptor @ref ec_err_simple_desc.
4391 	 */
4392 	EC_ERR_TYPE_ECC_SEC_INTERNAL		= 2,
4393 
4394 	/** @brief ECC DED error on internal data path
4395 	 *
4396 	 *  Error descriptor @ref ec_err_simple_desc.
4397 	 */
4398 	EC_ERR_TYPE_ECC_DED_INTERNAL		= 3,
4399 
4400 	/** @brief Comparator error
4401 	 *
4402 	 *  Error descriptor @ref ec_err_simple_desc.
4403 	 */
4404 	EC_ERR_TYPE_COMPARATOR			= 4,
4405 
4406 	/** @brief Register parity error
4407 	 *
4408 	 *  Error descriptor @ref ec_err_reg_parity_desc.
4409 	 */
4410 	EC_ERR_TYPE_REGISTER_PARITY		= 5,
4411 
4412 	/** @brief Parity error from on-chip SRAM/FIFO
4413 	 *
4414 	 *  Error descriptor @ref ec_err_simple_desc.
4415 	 */
4416 	EC_ERR_TYPE_PARITY_SRAM			= 6,
4417 
4418 	/** @brief Clock Monitor error
4419 	 *
4420 	 *  Error descriptor @ref ec_err_fmon_desc.
4421 	 */
4422 	EC_ERR_TYPE_CLOCK_MONITOR		= 9,
4423 
4424 	/** @brief Voltage Monitor error
4425 	 *
4426 	 *  Error descriptor @ref ec_err_vmon_desc.
4427 	 */
4428 	EC_ERR_TYPE_VOLTAGE_MONITOR		= 10,
4429 
4430 	/** @brief SW Correctable error
4431 	 *
4432 	 *  Error descriptor @ref ec_err_sw_error_desc.
4433 	 */
4434 	EC_ERR_TYPE_SW_CORRECTABLE		= 16,
4435 
4436 	/** @brief SW Uncorrectable error
4437 	 *
4438 	 *  Error descriptor @ref ec_err_sw_error_desc.
4439 	 */
4440 	EC_ERR_TYPE_SW_UNCORRECTABLE		= 17,
4441 
4442 	/** @brief Other HW Correctable error
4443 	 *
4444 	 *  Error descriptor @ref ec_err_simple_desc.
4445 	 */
4446 	EC_ERR_TYPE_OTHER_HW_CORRECTABLE	= 32,
4447 
4448 	/** @brief Other HW Uncorrectable error
4449 	 *
4450 	 *  Error descriptor @ref ec_err_simple_desc.
4451 	 */
4452 	EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE	= 33,
4453 };
4454 
4455 /** @brief Group of registers with parity error. */
4456 enum ec_registers_group {
4457 	/** @brief Functional registers group */
4458 	EC_ERR_GROUP_FUNC_REG		= 0U,
4459 	/** @brief SCR registers group */
4460 	EC_ERR_GROUP_SCR_REG		= 1U,
4461 };
4462 
4463 /**
4464  * @defgroup bpmp_ec_status_flags EC Status Flags
4465  * @addtogroup bpmp_ec_status_flags
4466  * @{
4467  */
4468 /** @brief No EC error found flag */
4469 #define EC_STATUS_FLAG_NO_ERROR		0x0001U
4470 /** @brief Last EC error found flag */
4471 #define EC_STATUS_FLAG_LAST_ERROR	0x0002U
4472 /** @brief EC latent error flag */
4473 #define EC_STATUS_FLAG_LATENT_ERROR	0x0004U
4474 
4475 /** @} bpmp_ec_status_flags */
4476 
4477 /**
4478  * @defgroup bpmp_ec_desc_flags EC Descriptor Flags
4479  * @addtogroup bpmp_ec_desc_flags
4480  * @{
4481  */
4482 /** @brief EC descriptor error resolved flag */
4483 #define EC_DESC_FLAG_RESOLVED		0x0001U
4484 /** @brief EC descriptor failed to retrieve id flag */
4485 #define EC_DESC_FLAG_NO_ID		0x0002U
4486 
4487 /** @} bpmp_ec_desc_flags */
4488 
4489 /**
4490  * |error type                       | fmon_clk_id values        |
4491  * |---------------------------------|---------------------------|
4492  * |@ref EC_ERR_TYPE_CLOCK_MONITOR   |@ref bpmp_clock_ids        |
4493  */
4494 struct ec_err_fmon_desc {
4495 	/** @brief Bitmask of @ref bpmp_ec_desc_flags  */
4496 	uint16_t desc_flags;
4497 	/** @brief FMON monitored clock id */
4498 	uint16_t fmon_clk_id;
4499 	/**
4500 	 * @brief Bitmask of fault flags
4501 	 *
4502 	 * @ref bpmp_fmon_faults_flags
4503 	 */
4504 	uint32_t fmon_faults;
4505 	/** @brief FMON faults access error */
4506 	int32_t fmon_access_error;
4507 } BPMP_ABI_PACKED;
4508 
4509 /**
4510  * | error type                      | vmon_adc_id values        |
4511  * |---------------------------------|---------------------------|
4512  * |@ref EC_ERR_TYPE_VOLTAGE_MONITOR |@ref bpmp_adc_ids          |
4513  */
4514 struct ec_err_vmon_desc {
4515 	/** @brief Bitmask of @ref bpmp_ec_desc_flags  */
4516 	uint16_t desc_flags;
4517 	/** @brief VMON rail adc id */
4518 	uint16_t vmon_adc_id;
4519 	/** @brief Bitmask of bpmp_vmon_faults_flags */
4520 	uint32_t vmon_faults;
4521 	/** @brief VMON faults access error */
4522 	int32_t vmon_access_error;
4523 } BPMP_ABI_PACKED;
4524 
4525 /**
4526  * |error type                       | reg_id values         |
4527  * |---------------------------------|-----------------------|
4528  * |@ref EC_ERR_TYPE_REGISTER_PARITY | bpmp_ec_registers_ids |
4529  */
4530 struct ec_err_reg_parity_desc {
4531 	/** @brief Bitmask of @ref bpmp_ec_desc_flags  */
4532 	uint16_t desc_flags;
4533 	/** @brief Register id */
4534 	uint16_t reg_id;
4535 	/** @brief Register group @ref ec_registers_group */
4536 	uint16_t reg_group;
4537 } BPMP_ABI_PACKED;
4538 
4539 /**
4540  * |error type                        | err_source_id values |
4541  * |--------------------------------- |----------------------|
4542  * |@ref EC_ERR_TYPE_SW_CORRECTABLE   | bpmp_ec_ce_swd_ids   |
4543  * |@ref EC_ERR_TYPE_SW_UNCORRECTABLE | bpmp_ec_ue_swd_ids   |
4544  */
4545 struct ec_err_sw_error_desc {
4546 	/** @brief Bitmask of @ref bpmp_ec_desc_flags  */
4547 	uint16_t desc_flags;
4548 	/** @brief Error source id */
4549 	uint16_t err_source_id;
4550 	/** @brief Sw error data */
4551 	uint32_t sw_error_data;
4552 } BPMP_ABI_PACKED;
4553 
4554 /**
4555  * |error type                              | err_source_id values   |
4556  * |----------------------------------------|------------------------|
4557  * |@ref EC_ERR_TYPE_PARITY_INTERNAL        |  bpmp_ec_ipath_ids     |
4558  * |@ref EC_ERR_TYPE_ECC_SEC_INTERNAL       |  bpmp_ec_ipath_ids     |
4559  * |@ref EC_ERR_TYPE_ECC_DED_INTERNAL       |  bpmp_ec_ipath_ids     |
4560  * |@ref EC_ERR_TYPE_COMPARATOR             |  bpmp_ec_comparator_ids|
4561  * |@ref EC_ERR_TYPE_OTHER_HW_CORRECTABLE   |  bpmp_ec_misc_hwd_ids  |
4562  * |@ref EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE |  bpmp_ec_misc_hwd_ids  |
4563  * |@ref EC_ERR_TYPE_PARITY_SRAM            |  bpmp_clock_ids        |
4564  */
4565 struct ec_err_simple_desc {
4566 	/** @brief Bitmask of @ref bpmp_ec_desc_flags  */
4567 	uint16_t desc_flags;
4568 	/** @brief Error source id. Id space depends on error type. */
4569 	uint16_t err_source_id;
4570 } BPMP_ABI_PACKED;
4571 
4572 /** @brief Union of EC error descriptors */
4573 union ec_err_desc {
4574 	struct ec_err_fmon_desc fmon_desc;
4575 	struct ec_err_vmon_desc vmon_desc;
4576 	struct ec_err_reg_parity_desc reg_parity_desc;
4577 	struct ec_err_sw_error_desc sw_error_desc;
4578 	struct ec_err_simple_desc simple_desc;
4579 } BPMP_ABI_PACKED;
4580 
4581 struct cmd_ec_status_get_request {
4582 	/** @brief HSM error line number that identifies target EC. */
4583 	uint32_t ec_hsm_id;
4584 } BPMP_ABI_PACKED;
4585 
4586 /** EC status maximum number of descriptors */
4587 #define EC_ERR_STATUS_DESC_MAX_NUM	4U
4588 
4589 /**
4590  * @cond DEPRECATED
4591  */
4592 struct cmd_ec_status_get_response {
4593 	/** @brief Target EC id (the same id received with request). */
4594 	uint32_t ec_hsm_id;
4595 	/**
4596 	 * @brief Bitmask of @ref bpmp_ec_status_flags
4597 	 *
4598 	 * If NO_ERROR flag is set, error_ fields should be ignored
4599 	 */
4600 	uint32_t ec_status_flags;
4601 	/** @brief Found EC error index. */
4602 	uint32_t error_idx;
4603 	/** @brief  Found EC error type @ref bpmp_ec_err_type. */
4604 	uint32_t error_type;
4605 	/** @brief  Number of returned EC error descriptors */
4606 	uint32_t error_desc_num;
4607 	/** @brief  EC error descriptors */
4608 	union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];
4609 } BPMP_ABI_PACKED;
4610 /** @endcond */
4611 
4612 struct cmd_ec_status_ex_get_response {
4613 	/** @brief Target EC id (the same id received with request). */
4614 	uint32_t ec_hsm_id;
4615 	/**
4616 	 * @brief Bitmask of @ref bpmp_ec_status_flags
4617 	 *
4618 	 * If NO_ERROR flag is set, error_ fields should be ignored
4619 	 */
4620 	uint32_t ec_status_flags;
4621 	/** @brief Found EC error index. */
4622 	uint32_t error_idx;
4623 	/** @brief  Found EC error type @ref bpmp_ec_err_type. */
4624 	uint32_t error_type;
4625 	/** @brief  Found EC mission error counter value */
4626 	uint32_t error_counter;
4627 	/** @brief  Found EC mission error user value */
4628 	uint32_t error_uval;
4629 	/** @brief  Reserved entry    */
4630 	uint32_t reserved;
4631 	/** @brief  Number of returned EC error descriptors */
4632 	uint32_t error_desc_num;
4633 	/** @brief  EC error descriptors */
4634 	union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];
4635 } BPMP_ABI_PACKED;
4636 
4637 /**
4638  * @ingroup EC
4639  * @brief Request with #MRQ_EC
4640  *
4641  * Used by the sender of an #MRQ_EC message to access ECs owned
4642  * by BPMP.
4643  *
4644  * @cond DEPRECATED
4645  * |sub-command                 |payload                |
4646  * |----------------------------|-----------------------|
4647  * |@ref CMD_EC_STATUS_GET      |ec_status_get          |
4648  * @endcond
4649  *
4650  * |sub-command                 |payload                |
4651  * |----------------------------|-----------------------|
4652  * |@ref CMD_EC_STATUS_EX_GET   |ec_status_get          |
4653  *
4654  */
4655 
4656 struct mrq_ec_request {
4657 	/** @brief Sub-command id. */
4658 	uint32_t cmd_id;
4659 
4660 	union {
4661 		struct cmd_ec_status_get_request ec_status_get;
4662 	} BPMP_UNION_ANON;
4663 } BPMP_ABI_PACKED;
4664 
4665 /**
4666  * @ingroup EC
4667  * @brief Response to MRQ_EC
4668  *
4669  * Each sub-command supported by @ref mrq_ec_request may return
4670  * sub-command-specific data as indicated below.
4671  *
4672  * @cond DEPRECATED
4673  * |sub-command                 |payload                 |
4674  * |----------------------------|------------------------|
4675  * |@ref CMD_EC_STATUS_GET      |ec_status_get           |
4676  * @endcond
4677  *
4678  * |sub-command                 |payload                 |
4679  * |----------------------------|------------------------|
4680  * |@ref CMD_EC_STATUS_EX_GET   |ec_status_ex_get        |
4681  *
4682  */
4683 
4684 struct mrq_ec_response {
4685 	union {
4686 		/**
4687 		 * @cond DEPRECATED
4688 		 */
4689 		struct cmd_ec_status_get_response ec_status_get;
4690 		/** @endcond */
4691 		struct cmd_ec_status_ex_get_response ec_status_ex_get;
4692 	} BPMP_UNION_ANON;
4693 } BPMP_ABI_PACKED;
4694 
4695 /** @} EC */
4696 /** @endcond */
4697 
4698 /** @cond (bpmp_th500)
4699  * @ingroup MRQ_Codes
4700  * @def MRQ_TELEMETRY
4701  * @brief Get address of memory buffer refreshed with recently sampled
4702  *        telemetry data
4703  *
4704  * * Initiators: CCPLEX
4705  * * Targets: BPMP
4706  * * Request Payload: N/A
4707  * * Response Payload: @ref mrq_telemetry_response
4708  * @addtogroup Telemetry
4709  * @{
4710  */
4711 
4712 /**
4713  * @brief Response payload for the #MRQ_TELEMETRY -command
4714  *
4715  * mrq_response::err is defined as:
4716  *
4717  * | Value           | Description                                                |
4718  * |-----------------|------------------------------------------------------------|
4719  * | 0               | Telemetry data is available at returned address.           |
4720  * | -#BPMP_EACCES   | MRQ master is not allowed to request buffer refresh.       |
4721  * | -#BPMP_ENAVAIL  | Telemetry buffer cannot be refreshed via this MRQ channel. |
4722  * | -#BPMP_ENOTSUP  | Telemetry buffer is not supported by BPMP-FW.              |
4723  * | -#BPMP_ENODEV   | Telemetry MRQ is not supported by BPMP-FW.                 |
4724  */
4725 struct mrq_telemetry_response {
4726 	/** @brief Physical address of telemetry data buffer */
4727 	uint64_t data_buf_addr;	/**< see @ref bpmp_telemetry_layout */
4728 } BPMP_ABI_PACKED;
4729 
4730 /** @} Telemetry */
4731 /** @endcond */
4732 
4733 /** @cond (bpmp_tb500)
4734  * @ingroup MRQ_Codes
4735  * @def MRQ_TELEMETRY_EX
4736  * @brief Get telemetry configuration settings.
4737  *
4738  * * Initiators: Any
4739  * * Targets: BPMP
4740  * * Request Payload: @ref mrq_telemetry_ex_request
4741  * * Response Payload: @ref mrq_telemetry_ex_response
4742  *
4743  * @addtogroup Telemetry_ex
4744  * @{
4745  */
4746 
4747 /**
4748  * @brief Sub-command identifiers for #MRQ_TELEMETRY_EX.
4749  */
4750 enum mrq_telemetry_ex_cmd {
4751 	/**
4752 	 * @brief Check whether the BPMP-FW supports the specified
4753 	 * #MRQ_TELEMETRY_EX sub-command.
4754 	 *
4755 	 * mrq_response::err is 0 if the specified request is
4756 	 * supported and -#BPMP_ENODEV otherwise.
4757 	 */
4758 	CMD_TELEMETRY_EX_QUERY_ABI = 0,
4759 
4760 	/**
4761 	 * @brief Get telemetry buffer base address and data size
4762 	 *
4763 	 * mrq_response:err is defined as:
4764 	 *
4765 	 * | Value          | Description                                    |
4766 	 * |----------------|------------------------------------------------|
4767 	 * | 0              | Success                                        |
4768 	 * | -#BPMP_ENODEV  | #MRQ_TELEMETRY_EX is not supported by BPMP-FW. |
4769 	 */
4770 	CMD_TELEMETRY_EX_BASE_SZ_GET = 1,
4771 };
4772 
4773 /**
4774  * @brief Request data for #MRQ_TELEMETRY_EX sub-command
4775  *        #CMD_TELEMETRY_EX_QUERY_ABI
4776  */
4777 struct cmd_telemetry_ex_query_abi_request {
4778 	/** @brief Sub-command identifier from @ref mrq_telemetry_ex_cmd */
4779 	uint32_t cmd_code;
4780 } BPMP_ABI_PACKED;
4781 
4782 /**
4783  * @brief Response payload for #MRQ_TELEMETRY_EX sub-command
4784  *        #CMD_TELEMETRY_EX_BASE_SZ_GET
4785  */
4786 struct cmd_telemetry_ex_base_sz_get_response {
4787 	/**
4788 	 *  @brief Physical address of telemetry data buffer
4789 	 *
4790 	 *  0 if no buffer is allocated for the initiator sending MRQ.
4791 	 */
4792 	uint64_t buf_base_addr;
4793 	/** @brief Telemetry data size in bytes */
4794 	uint32_t buf_size;
4795 } BPMP_ABI_PACKED;
4796 
4797 /**
4798  * @brief Request payload for the #MRQ_TELEMETRY_EX -command
4799  *
4800  * | Sub-command                   | Request payload                        |
4801  * |-------------------------------|----------------------------------------|
4802  * | #CMD_TELEMETRY_EX_QUERY_ABI   | #cmd_telemetry_ex_query_abi_request    |
4803  * | #CMD_TELEMETRY_EX_BASE_SZ_GET | -                                      |
4804  */
4805 struct mrq_telemetry_ex_request {
4806 	/** @brief Sub-command ID from @ref mrq_telemetry_ex_cmd. */
4807 	uint32_t cmd;
4808 	union {
4809 		struct cmd_telemetry_ex_query_abi_request
4810 			telemetry_ex_query_abi_req;
4811 	} BPMP_UNION_ANON;
4812 } BPMP_ABI_PACKED;
4813 
4814 /**
4815  * @brief Response payload for the #MRQ_TELEMETRY_EX -command.
4816  *
4817  * | Sub-command                   | Response payload                       |
4818  * |-------------------------------|----------------------------------------|
4819  * | #CMD_TELEMETRY_EX_QUERY_ABI   | -                                      |
4820  * | #CMD_TELEMETRY_EX_BASE_SZ_GET | #cmd_telemetry_ex_base_sz_get_response |
4821  */
4822 struct mrq_telemetry_ex_response {
4823 	union {
4824 		struct cmd_telemetry_ex_base_sz_get_response
4825 			telemetry_ex_base_sz_get_rsp;
4826 	} BPMP_UNION_ANON;
4827 } BPMP_ABI_PACKED;
4828 
4829 /** @} Telemetry_ex */
4830 /** @endcond */
4831 
4832 /** @cond (bpmp_th500 || bpmp_tb500)
4833  * @ingroup MRQ_Codes
4834  * @def MRQ_PWR_LIMIT
4835  * @brief Control power limits.
4836  *
4837  * * Initiators: Any
4838  * * Targets: BPMP
4839  * * Request Payload: @ref mrq_pwr_limit_request
4840  * * Response Payload: @ref mrq_pwr_limit_response
4841  *
4842  * @addtogroup Pwrlimit
4843  * @{
4844  */
4845 
4846 /**
4847  * @brief Sub-command identifiers for #MRQ_PWR_LIMIT.
4848  */
4849 enum mrq_pwr_limit_cmd {
4850 	/**
4851 	 * @brief Check whether the BPMP-FW supports the specified
4852 	 * #MRQ_PWR_LIMIT sub-command.
4853 	 *
4854 	 * mrq_response::err is 0 if the specified request is
4855 	 * supported and -#BPMP_ENODEV otherwise.
4856 	 */
4857 	CMD_PWR_LIMIT_QUERY_ABI = 0,
4858 
4859 	/**
4860 	 * @brief Set power limit
4861 	 *
4862 	 * mrq_response:err is defined as:
4863 	 *
4864 	 * | Value          | Description                                 |
4865 	 * |----------------|---------------------------------------------|
4866 	 * | 0              | Success                                     |
4867 	 * | -#BPMP_ENODEV  | #MRQ_PWR_LIMIT is not supported by BPMP-FW. |
4868 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
4869 	 * | -#BPMP_EACCES  | Request is not accepted.                    |
4870 	 */
4871 	CMD_PWR_LIMIT_SET = 1,
4872 
4873 	/**
4874 	 * @brief Get power limit setting
4875 	 *
4876 	 * mrq_response:err is defined as:
4877 	 *
4878 	 * | Value          | Description                                 |
4879 	 * |----------------|---------------------------------------------|
4880 	 * | 0              | Success                                     |
4881 	 * | -#BPMP_ENODEV  | #MRQ_PWR_LIMIT is not supported by BPMP-FW. |
4882 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
4883 	 */
4884 	CMD_PWR_LIMIT_GET = 2,
4885 
4886 	/**
4887 	 * @brief Get current aggregated power cap
4888 	 *
4889 	 * Get currently applied power cap for the specified limit id
4890 	 * aggregated across all limit sources and types.
4891 	 *
4892 	 * mrq_response:err is defined as:
4893 	 *
4894 	 * | Value          | Description                                 |
4895 	 * |----------------|---------------------------------------------|
4896 	 * | 0              | Success                                     |
4897 	 * | -#BPMP_ENODEV  | #MRQ_PWR_LIMIT is not supported by BPMP-FW. |
4898 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
4899 	 */
4900 	CMD_PWR_LIMIT_CURR_CAP = 3,
4901 };
4902 
4903 /**
4904  * @defgroup bpmp_pwr_limit_type PWR_LIMIT TYPEs
4905  * @{
4906  */
4907 /** @brief Limit value specifies target cap */
4908 #define PWR_LIMIT_TYPE_TARGET_CAP		0U
4909 /** @brief Limit value specifies maximum possible target cap */
4910 #define PWR_LIMIT_TYPE_BOUND_MAX		1U
4911 /** @brief Limit value specifies minimum possible target cap */
4912 #define PWR_LIMIT_TYPE_BOUND_MIN		2U
4913 /** @brief Number of limit types supported by #MRQ_PWR_LIMIT command */
4914 #define PWR_LIMIT_TYPE_NUM			3U
4915 
4916 /** @} bpmp_pwr_limit_type */
4917 
4918 /**
4919  * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_QUERY_ABI
4920  */
4921 struct cmd_pwr_limit_query_abi_request {
4922 	/** @brief Sub-command identifier from @ref mrq_pwr_limit_cmd */
4923 	uint32_t cmd_code;
4924 } BPMP_ABI_PACKED;
4925 
4926 /**
4927  * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_SET
4928  *
4929  * Set specified limit of specified type from specified source. The success of
4930  * the request means that specified value is accepted as input to arbitration
4931  * with other sources settings for the same limit of the same type. Zero limit
4932  * is ignored by the arbitration (i.e., indicates "no limit set").
4933  */
4934 struct cmd_pwr_limit_set_request {
4935 	/** @brief Power limit identifier from @ref bpmp_pwr_limit_id */
4936 	uint32_t limit_id;
4937 	/** @brief Power limit source identifier from @ref bpmp_pwr_limit_src */
4938 	uint32_t limit_src;  /**< @ref bpmp_pwr_limit_src */
4939 	/** @brief Power limit type from @ref bpmp_pwr_limit_type */
4940 	uint32_t limit_type;
4941 	/** @brief New power limit value */
4942 	uint32_t limit_setting;
4943 } BPMP_ABI_PACKED;
4944 
4945 /**
4946  * @brief Request payload for #MRQ_PWR_LIMIT sub-command #CMD_PWR_LIMIT_GET
4947  *
4948  * Get previously set from specified source specified limit value of specified
4949  * type.
4950  */
4951 struct cmd_pwr_limit_get_request {
4952 	/** @brief Power limit identifier from @ref bpmp_pwr_limit_id */
4953 	uint32_t limit_id;
4954 	/** @brief Power limit source identifier from @ref bpmp_pwr_limit_src */
4955 	uint32_t limit_src;  /**< @ref bpmp_pwr_limit_src */
4956 	/** @brief Power limit type from @ref bpmp_pwr_limit_type */
4957 	uint32_t limit_type;
4958 } BPMP_ABI_PACKED;
4959 
4960 /**
4961  * @brief Response payload for #MRQ_PWR_LIMIT sub-command #CMD_PWR_LIMIT_GET
4962  */
4963 struct cmd_pwr_limit_get_response {
4964 	/** @brief Power limit value */
4965 	uint32_t limit_setting;
4966 } BPMP_ABI_PACKED;
4967 
4968 /**
4969  * @brief Request payload for #MRQ_PWR_LIMIT sub-command #CMD_PWR_LIMIT_CURR_CAP
4970  *
4971  * For specified limit get current power cap aggregated from all sources.
4972  */
4973 struct cmd_pwr_limit_curr_cap_request {
4974 	/** @brief Power limit identifier from @ref bpmp_pwr_limit_id */
4975 	uint32_t limit_id;
4976 } BPMP_ABI_PACKED;
4977 
4978 /**
4979  * @brief Response payload for #MRQ_PWR_LIMIT sub-command #CMD_PWR_LIMIT_CURR_CAP
4980  */
4981 struct cmd_pwr_limit_curr_cap_response {
4982 	/** @brief Current power cap value */
4983 	uint32_t curr_cap;
4984 } BPMP_ABI_PACKED;
4985 
4986 /**
4987  * @brief Request payload for the #MRQ_PWR_LIMIT -command
4988  *
4989  * | Sub-command              | Request payload                  |
4990  * |--------------------------|----------------------------------|
4991  * | #CMD_PWR_LIMIT_QUERY_ABI | #cmd_pwr_limit_query_abi_request |
4992  * | #CMD_PWR_LIMIT_SET       | #cmd_pwr_limit_set_request       |
4993  * | #CMD_PWR_LIMIT_GET       | #cmd_pwr_limit_get_request       |
4994  * | #CMD_PWR_LIMIT_CURR_CAP  | #cmd_pwr_limit_curr_cap_request  |
4995  */
4996 struct mrq_pwr_limit_request {
4997 	uint32_t cmd;
4998 	union {
4999 		struct cmd_pwr_limit_query_abi_request pwr_limit_query_abi_req;
5000 		struct cmd_pwr_limit_set_request pwr_limit_set_req;
5001 		struct cmd_pwr_limit_get_request pwr_limit_get_req;
5002 		struct cmd_pwr_limit_curr_cap_request pwr_limit_curr_cap_req;
5003 	} BPMP_UNION_ANON;
5004 } BPMP_ABI_PACKED;
5005 
5006 /**
5007  * @brief Response payload for the #MRQ_PWR_LIMIT -command.
5008  *
5009  * | Sub-command              | Response payload                 |
5010  * |--------------------------|----------------------------------|
5011  * | #CMD_PWR_LIMIT_QUERY_ABI | -                                |
5012  * | #CMD_PWR_LIMIT_SET       | -                                |
5013  * | #CMD_PWR_LIMIT_GET       | #cmd_pwr_limit_get_response      |
5014  * | #CMD_PWR_LIMIT_CURR_CAP  | #cmd_pwr_limit_curr_cap_response |
5015  */
5016 struct mrq_pwr_limit_response {
5017 	union {
5018 		struct cmd_pwr_limit_get_response pwr_limit_get_rsp;
5019 		struct cmd_pwr_limit_curr_cap_response pwr_limit_curr_cap_rsp;
5020 	} BPMP_UNION_ANON;
5021 } BPMP_ABI_PACKED;
5022 
5023 /** @} Pwrlimit */
5024 /** @endcond */
5025 
5026 
5027 
5028 /** @cond (bpmp_th500)
5029  * @ingroup MRQ_Codes
5030  * @def MRQ_PWRMODEL
5031  * @brief Retrieve power evaluted by SoC power model.
5032  *
5033  * * Initiators: Any
5034  * * Targets: BPMP
5035  * * Request Payload: @ref mrq_pwrmodel_request
5036  * * Response Payload: @ref mrq_pwrmodel_response
5037  *
5038  * @addtogroup Pwrmodel
5039  * @{
5040  */
5041 
5042 /**
5043  * @brief Sub-command identifiers for #MRQ_PWRMODEL.
5044  */
5045 enum mrq_pwrmodel_cmd {
5046 	/**
5047 	 * @brief Check whether the BPMP-FW supports the specified
5048 	 * #MRQ_PWRMODEL sub-command.
5049 	 *
5050 	 * mrq_response::err is 0 if the specified request is
5051 	 * supported and -#BPMP_ENODEV otherwise.
5052 	 */
5053 	CMD_PWRMODEL_QUERY_ABI = 0,
5054 
5055 	/**
5056 	 * @brief Get power model output power
5057 	 *
5058 	 * mrq_response:err is defined as:
5059 	 *
5060 	 * | Value          | Description                                 |
5061 	 * |----------------|---------------------------------------------|
5062 	 * | 0              | Success                                     |
5063 	 * | -#BPMP_ENODEV  | #MRQ_PWRMODEL is not supported by BPMP-FW.  |
5064 	 * | -#BPMP_ERANGE  | Power model calculation overflow.           |
5065 	 */
5066 	CMD_PWRMODEL_PWR_GET = 1,
5067 };
5068 
5069 /**
5070  * @brief Request data for #MRQ_PWRMODEL sub-command #CMD_PWRMODEL_QUERY_ABI
5071  */
5072 struct cmd_pwrmodel_query_abi_request {
5073 	/** @brief Sub-command identifier from @ref mrq_pwrmodel_cmd */
5074 	uint32_t cmd_code;
5075 } BPMP_ABI_PACKED;
5076 
5077 /**
5078  * @brief Request payload for #MRQ_PWRMODEL sub-command #CMD_PWRMODEL_PWR_GET
5079  *
5080  * Rerieve power evaluated by power model for specified work-load factor,
5081  * temperature, and cpu iso frequency for all cores.
5082  */
5083 struct cmd_pwrmodel_pwr_get_request {
5084 	/** @brief Unitless work load factor to evaluate power model at */
5085 	uint32_t work_load_factor;
5086 	/** @brief CPU frequency in kHz to evaluate power model at */
5087 	uint32_t cpu_frequency;
5088 	/** @brief Temperature in mC to evaluate power model at */
5089 	int32_t temperature;
5090 } BPMP_ABI_PACKED;
5091 
5092 /**
5093  * @brief Response payload for #MRQ_PWRMODEL sub-command #CMD_PWRMODEL_PWR_GET
5094  */
5095 struct cmd_pwrmodel_pwr_get_response {
5096 	/** @brief Power model output in mW */
5097 	uint32_t power;
5098 } BPMP_ABI_PACKED;
5099 
5100 /**
5101  * @brief Request payload for the #MRQ_PWRMODEL -command
5102  *
5103  * | Sub-command              | Request payload                  |
5104  * |--------------------------|----------------------------------|
5105  * | #CMD_PWRMODEL_QUERY_ABI  | #cmd_pwrmodel_query_abi_request  |
5106  * | #CMD_PWRMODEL_PWR_GET    | #cmd_pwrmodel_pwr_get_request    |
5107  */
5108 struct mrq_pwrmodel_request {
5109 	uint32_t cmd;
5110 	union {
5111 		struct cmd_pwrmodel_query_abi_request pwrmodel_query_abi_req;
5112 		struct cmd_pwrmodel_pwr_get_request pwrmodel_pwr_get_req;
5113 	} BPMP_UNION_ANON;
5114 } BPMP_ABI_PACKED;
5115 
5116 /**
5117  * @brief Response payload for the #MRQ_PWRMODEL -command.
5118  *
5119  * | Sub-command              | Response payload                 |
5120  * |--------------------------|----------------------------------|
5121  * | #CMD_PWRMODEL_QUERY_ABI  | -                                |
5122  * | #CMD_PWRMODEL_PWR_GET    | #cmd_pwrmodel_pwr_get_response   |
5123  */
5124 struct mrq_pwrmodel_response {
5125 	union {
5126 		struct cmd_pwrmodel_pwr_get_response pwrmodel_pwr_get_rsp;
5127 	} BPMP_UNION_ANON;
5128 } BPMP_ABI_PACKED;
5129 
5130 /** @} Pwrmodel */
5131 /** @endcond */
5132 
5133 
5134 /** @cond (bpmp_th500)
5135  * @ingroup MRQ_Codes
5136  * @def MRQ_PWR_CNTRL
5137  * @brief Configure power controllers.
5138  *
5139  * * Initiators: Any
5140  * * Targets: BPMP
5141  * * Request Payload: @ref mrq_pwr_cntrl_request
5142  * * Response Payload: @ref mrq_pwr_cntrl_response
5143  *
5144  * @addtogroup Pwrcntrl
5145  * @{
5146  */
5147 
5148 /**
5149  * @brief Sub-command identifiers for #MRQ_PWR_CNTRL.
5150  */
5151 enum mrq_pwr_cntrl_cmd {
5152 	/**
5153 	 * @brief Check whether the BPMP-FW supports the specified
5154 	 * #MRQ_PWR_CNTRL sub-command.
5155 	 *
5156 	 * mrq_response::err is 0 if the specified request is
5157 	 * supported and -#BPMP_ENODEV otherwise.
5158 	 */
5159 	CMD_PWR_CNTRL_QUERY_ABI = 0,
5160 
5161 	/**
5162 	 * @brief Switch power controller to/out of bypass mode
5163 	 *
5164 	 * mrq_response:err is defined as:
5165 	 *
5166 	 * | Value          | Description                                 |
5167 	 * |----------------|---------------------------------------------|
5168 	 * | 0              | Success                                     |
5169 	 * | -#BPMP_ENODEV  | #MRQ_PWR_CNTRL is not supported by BPMP-FW. |
5170 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
5171 	 * | -#BPMP_ENOTSUP | Bypass mode is not supported.               |
5172 	 */
5173 	CMD_PWR_CNTRL_BYPASS_SET = 1,
5174 
5175 	/**
5176 	 * @brief Get power controller bypass mode status
5177 	 *
5178 	 * mrq_response:err is defined as:
5179 	 *
5180 	 * | Value          | Description                                 |
5181 	 * |----------------|---------------------------------------------|
5182 	 * | 0              | Success                                     |
5183 	 * | -#BPMP_ENODEV  | #MRQ_PWR_CNTRL is not supported by BPMP-FW. |
5184 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
5185 	 */
5186 	CMD_PWR_CNTRL_BYPASS_GET = 2,
5187 };
5188 
5189 /**
5190  * @brief Request data for #MRQ_PWR_CNTRL sub-command #CMD_PWR_CNTRL_QUERY_ABI
5191  */
5192 struct cmd_pwr_cntrl_query_abi_request {
5193 	/** @brief Sub-command identifier from @ref mrq_pwr_cntrl_cmd */
5194 	uint32_t cmd_code;
5195 } BPMP_ABI_PACKED;
5196 
5197 /**
5198  * @brief Request data for #MRQ_PWR_CNTRL sub-command #CMD_PWR_CNTRL_BYPASS_SET
5199  *
5200  * Switch specified power controller to / out of bypass mode provided such
5201  * mode is supported by the controller.
5202  */
5203 struct cmd_pwr_cntrl_bypass_set_request {
5204 	/** @brief Power controller identifier from @ref bpmp_pwr_cntrl_id */
5205 	uint32_t cntrl_id;
5206 	/**
5207 	 * @brief Bypass setting.
5208 	 *
5209 	 * Valid values:
5210 	 *
5211 	 * * 1 to enter bypass mode,
5212 	 * * 0 to exit bypass mode.
5213 	 */
5214 	uint32_t bypass_setting;
5215 } BPMP_ABI_PACKED;
5216 
5217 /**
5218  * @brief Request data for #MRQ_PWR_CNTRL sub-command #CMD_PWR_CNTRL_BYPASS_GET
5219  *
5220  * Get bypass mode status of the specified power controller.
5221  */
5222 struct cmd_pwr_cntrl_bypass_get_request {
5223 	/** @brief Power controller identifier from @ref bpmp_pwr_cntrl_id */
5224 	uint32_t cntrl_id;
5225 } BPMP_ABI_PACKED;
5226 
5227 /**
5228  * @brief Response data for #MRQ_PWR_CNTRL sub-command #CMD_PWR_CNTRL_BYPASS_GET
5229  *
5230  * Get current bypass mode status if such mode is supported by the controller.
5231  * Otherwise, return "out of bypass" .
5232  */
5233 struct cmd_pwr_cntrl_bypass_get_response {
5234 	/**
5235 	 * @brief Bypass mode status: 1 controller is in bypass,
5236 	 * 0 controller is out of bypass.
5237 	 */
5238 	uint32_t bypass_status;
5239 } BPMP_ABI_PACKED;
5240 
5241 /**
5242  * @brief Request payload for the #MRQ_PWR_CNTRL -command
5243  *
5244  * | Sub-command               | Request payload                   |
5245  * |---------------------------|-----------------------------------|
5246  * | #CMD_PWR_CNTRL_QUERY_ABI  | #cmd_pwr_cntrl_query_abi_request  |
5247  * | #CMD_PWR_CNTRL_BYPASS_SET | #cmd_pwr_cntrl_bypass_set_request |
5248  * | #CMD_PWR_CNTRL_BYPASS_GET | #cmd_pwr_cntrl_bypass_get_request |
5249  */
5250 struct mrq_pwr_cntrl_request {
5251 	uint32_t cmd;
5252 	union {
5253 		struct cmd_pwr_cntrl_query_abi_request pwr_cntrl_query_abi_req;
5254 		struct cmd_pwr_cntrl_bypass_set_request pwr_cntrl_bypass_set_req;
5255 		struct cmd_pwr_cntrl_bypass_get_request pwr_cntrl_bypass_get_req;
5256 	} BPMP_UNION_ANON;
5257 } BPMP_ABI_PACKED;
5258 
5259 /**
5260  * @brief Response payload for the #MRQ_PWR_CNTRL -command.
5261  *
5262  * | Sub-command               | Response payload                  |
5263  * |---------------------------|-----------------------------------|
5264  * | #CMD_PWR_CNTRL_QUERY_ABI  | -                                 |
5265  * | #CMD_PWR_CNTRL_BYPASS_SET | -                                 |
5266  * | #CMD_PWR_CNTRL_BYPASS_GET | #cmd_pwr_cntrl_bypass_get_response|
5267  */
5268 struct mrq_pwr_cntrl_response {
5269 	union {
5270 		struct cmd_pwr_cntrl_bypass_get_response pwr_cntrl_bypass_get_rsp;
5271 	} BPMP_UNION_ANON;
5272 } BPMP_ABI_PACKED;
5273 
5274 /** @} Pwrcntrl */
5275 /** @endcond */
5276 
5277 
5278 /** @cond (bpmp_t264)
5279  * @ingroup MRQ_Codes
5280  * @def MRQ_SLC
5281  * @brief Configure SLC state.
5282  *
5283  * * Initiators: Any
5284  * * Targets: BPMP
5285  * * Request Payload: @ref mrq_slc_request
5286  * * Response Payload: @ref mrq_slc_response
5287  *
5288  * @addtogroup Slc
5289  * @{
5290  */
5291 
5292 /**
5293  * @brief Sub-command identifiers for #MRQ_SLC.
5294  */
5295 enum mrq_slc_cmd {
5296 	/**
5297 	 * @brief Check whether the BPMP-FW supports the specified
5298 	 * #MRQ_SLC sub-command.
5299 	 *
5300 	 * mrq_response::err is 0 if the specified request is
5301 	 * supported and -#BPMP_ENODEV otherwise.
5302 	 */
5303 	CMD_SLC_QUERY_ABI = 0,
5304 
5305 	/**
5306 	 * @brief Switch SLC to/out of bypass mode
5307 	 *
5308 	 * mrq_response:err is defined as:
5309 	 *
5310 	 * | Value          | Description                                 |
5311 	 * |----------------|---------------------------------------------|
5312 	 * | 0              | Success                                     |
5313 	 * | -#BPMP_ENODEV  | #MRQ_SLC is not supported by BPMP-FW.       |
5314 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
5315 	 * | -#BPMP_ENOTSUP | Bypass mode is not supported.               |
5316 	 */
5317 	CMD_SLC_BYPASS_SET = 1,
5318 
5319 	/**
5320 	 * @brief Get SLC bypass mode status
5321 	 *
5322 	 * mrq_response:err is defined as:
5323 	 *
5324 	 * | Value          | Description                                 |
5325 	 * |----------------|---------------------------------------------|
5326 	 * | 0              | Success                                     |
5327 	 * | -#BPMP_ENODEV  | #MRQ_SLC is not supported by BPMP-FW.       |
5328 	 */
5329 	CMD_SLC_BYPASS_GET = 2,
5330 };
5331 
5332 /**
5333  * @brief Request data for #MRQ_SLC sub-command #CMD_SLC_QUERY_ABI
5334  */
5335 struct cmd_slc_query_abi_request {
5336 	/** @brief Sub-command identifier from @ref mrq_slc_cmd */
5337 	uint32_t cmd_code;
5338 } BPMP_ABI_PACKED;
5339 
5340 /**
5341  * @brief Request data for #MRQ_SLC sub-command #CMD_SLC_BYPASS_SET
5342  *
5343  * Switch SLC to / out of bypass mode provided such
5344  * mode is supported by the SLC.
5345  */
5346 struct cmd_slc_bypass_set_request {
5347 	/**
5348 	 * @brief Bypass setting.
5349 	 *
5350 	 * Valid values:
5351 	 *
5352 	 * * 1 to enter bypass mode,
5353 	 * * 0 to exit bypass mode.
5354 	 */
5355 	uint32_t bypass_setting;
5356 } BPMP_ABI_PACKED;
5357 
5358 /**
5359  * @brief Response data for #MRQ_SLC sub-command #CMD_SLC_BYPASS_GET
5360  *
5361  * Get current bypass mode status if such mode is supported by the SLC.
5362  * Otherwise, return "out of bypass" .
5363  */
5364 struct cmd_slc_bypass_get_response {
5365 	/**
5366 	 * @brief Bypass mode status: 1 SLC is in bypass,
5367 	 * 0 SLC is out of bypass.
5368 	 */
5369 	uint32_t bypass_status;
5370 } BPMP_ABI_PACKED;
5371 
5372 /**
5373  * @brief Request payload for the #MRQ_SLC -command
5374  *
5375  * | Sub-command               | Request payload                   |
5376  * |---------------------------|-----------------------------------|
5377  * | #CMD_SLC_QUERY_ABI        | #cmd_slc_query_abi_request        |
5378  * | #CMD_SLC_BYPASS_SET       | #cmd_slc_bypass_set_request       |
5379  * | #CMD_SLC_BYPASS_GET       | -       |
5380  */
5381 struct mrq_slc_request {
5382 	uint32_t cmd;
5383 	union {
5384 		struct cmd_slc_query_abi_request slc_query_abi_req;
5385 		struct cmd_slc_bypass_set_request slc_bypass_set_req;
5386 	} BPMP_UNION_ANON;
5387 } BPMP_ABI_PACKED;
5388 
5389 /**
5390  * @brief Response payload for the #MRQ_SLC -command.
5391  *
5392  * | Sub-command               | Response payload                  |
5393  * |---------------------------|-----------------------------------|
5394  * | #CMD_SLC_QUERY_ABI        | -                                 |
5395  * | #CMD_SLC_BYPASS_SET       | -                                 |
5396  * | #CMD_SLC_BYPASS_GET       | #cmd_slc_bypass_get_response      |
5397  */
5398 struct mrq_slc_response {
5399 	union {
5400 		struct cmd_slc_bypass_get_response slc_bypass_get_rsp;
5401 	} BPMP_UNION_ANON;
5402 } BPMP_ABI_PACKED;
5403 
5404 /** @} Slc */
5405 /** @endcond */
5406 
5407 /** @cond (bpmp_th500)
5408  * @ingroup MRQ_Codes
5409  * @def MRQ_GEARS
5410  * @brief Get thresholds for NDIV offset switching
5411  *
5412  * * Initiators: CCPLEX
5413  * * Targets: BPMP
5414  * * Request Payload: N/A
5415  * * Response Payload: @ref mrq_gears_response
5416  * @addtogroup Gears
5417  * @{
5418  */
5419 
5420 /**
5421  * @brief Response to #MRQ_GEARS
5422  *
5423  * Used by the sender of an #MRQ_GEARS message to request thresholds
5424  * for NDIV offset switching.
5425  *
5426  * The mrq_gears_response::ncpu array defines four thresholds in units
5427  * of number of online CPUS to be used for choosing between five different
5428  * NDIV offset settings for CCPLEX cluster NAFLLs
5429  *
5430  * 1. If number of online CPUs < ncpu[0] use offset0
5431  * 2. If number of online CPUs < ncpu[1] use offset1
5432  * 3. If number of online CPUs < ncpu[2] use offset2
5433  * 4. If number of online CPUs < ncpu[3] use offset3
5434  * 5. If number of online CPUs >= ncpu[3] disable offsetting
5435  *
5436  * For TH500 mrq_gears_response::ncpu array has four valid entries.
5437  *
5438  * mrq_response::err is
5439  * * 0: gears defined and response data valid
5440  * * -#BPMP_ENODEV: MRQ is not supported by BPMP-FW
5441  * * -#BPMP_EACCES: Operation not permitted for the MRQ master
5442  * * -#BPMP_ENAVAIL: NDIV offsetting is disabled
5443  */
5444 struct mrq_gears_response {
5445 	/** @brief number of online CPUs for each gear */
5446 	uint32_t ncpu[8];
5447 	/** @brief ndiv offset for each gear */
5448 	uint32_t ndiv_offset[8];
5449 	/** @brief voltage below which gears are disabled */
5450 	uint32_t uv_threshold;
5451 } BPMP_ABI_PACKED;
5452 
5453 /** @} Gears */
5454 /** @endcond */
5455 
5456 
5457 /**
5458  * @ingroup MRQ_Codes
5459  * @def MRQ_SHUTDOWN
5460  * @brief System shutdown
5461  *
5462  * This message indicates system shutdown or reboot request. BPMP will
5463  * initiate system shutdown/reboot after receiving this message, it
5464  * may include turning off some rails in sequence and programming
5465  * PMIC.
5466  *
5467  * * Initiators: CPU_S, MCE
5468  * * Targets: BPMP
5469  * * Request Payload: @ref mrq_shutdown_request
5470  * * Response Payload: N/A
5471  * @addtogroup Shutdown
5472  * @{
5473  */
5474 
5475 /**
5476  * @brief Request with #MRQ_SHUTDOWN
5477  */
5478 struct mrq_shutdown_request {
5479 	/**
5480 	 * @brief Shutdown state ID
5481 	 *
5482 	 * Legal values:
5483 	 * *  0 - Power off
5484 	 * *  1 - Reboot
5485 	 * @cond bpmp_t264
5486 	 * *  2 - Suspend
5487 	 * @endcond
5488 	 */
5489 	uint32_t state;
5490 } BPMP_ABI_PACKED;
5491 
5492 /** @} Shutdown */
5493 
5494 /** @cond (bpmp_th500 || bpmp_tb500)
5495  * @defgroup bpmp_c2c_status C2C link status
5496  * @addtogroup bpmp_c2c_status
5497  * @{
5498  */
5499 /** @brief initial status code */
5500 #define BPMP_C2C_STATUS_INIT_NOT_STARTED		0
5501 /** @brief Invalid speedo code */
5502 #define BPMP_C2C_STATUS_C2C_INVALID_SPEEDO_CODE		7
5503 /** @brief Invalid frequency */
5504 #define BPMP_C2C_STATUS_C2C_INVALID_FREQ		8
5505 /** @brief Invalid link */
5506 #define BPMP_C2C_STATUS_C2C_INVALID_LINK		9
5507 /** @brief refpll lock polling times out - partition 0 */
5508 #define BPMP_C2C_STATUS_C2C0_REFPLL_FAIL		10
5509 /** @brief refpll lock polling times out - partition 1 */
5510 #define BPMP_C2C_STATUS_C2C1_REFPLL_FAIL		11
5511 /** @brief PLL cal times out - partition 0 */
5512 #define BPMP_C2C_STATUS_C2C0_PLLCAL_FAIL		12
5513 /** @brief PLL cal times out - partition 1 */
5514 #define BPMP_C2C_STATUS_C2C1_PLLCAL_FAIL		13
5515 /** @brief clock detection times out - partition 0 */
5516 #define BPMP_C2C_STATUS_C2C0_CLKDET_FAIL		14
5517 /** @brief clock detection times out - partition 1 */
5518 #define BPMP_C2C_STATUS_C2C1_CLKDET_FAIL		15
5519 /** @brief Final trainings fail partition 0 */
5520 #define BPMP_C2C_STATUS_C2C0_TR_FAIL			16
5521 /** @brief Final trainings fail partition 1 */
5522 #define BPMP_C2C_STATUS_C2C1_TR_FAIL			17
5523 /** @brief C2C FW init done */
5524 #define NV_GFW_GLOBAL_DEVINIT_C2C_STATUS_C2C_FW_INIT_DONE	20
5525 /** @brief C2C FW init failed partition 0 */
5526 #define NV_GFW_GLOBAL_DEVINIT_C2C_STATUS_C2C0_FW_INIT_FAIL	21
5527 /** @brief C2C FW init failed partition 1 */
5528 #define NV_GFW_GLOBAL_DEVINIT_C2C_STATUS_C2C1_FW_INIT_FAIL	22
5529 /** @brief no failure seen, c2c init was successful */
5530 #define BPMP_C2C_STATUS_C2C_LINK_TRAIN_PASS		255
5531 /** @} bpmp_c2c_status */
5532 
5533 /**
5534  * @ingroup MRQ_Codes
5535  * @def MRQ_C2C
5536  * @brief Control C2C partitions initialization.
5537  *
5538  * * Initiators: Any
5539  * * Targets: BPMP
5540  * * Request Payload: @ref mrq_c2c_request
5541  * * Response Payload: @ref mrq_c2c_response
5542  *
5543  * @addtogroup C2C
5544  * @{
5545  */
5546 enum mrq_c2c_cmd {
5547 	/**
5548 	 * @brief Check whether the BPMP driver supports the specified request
5549 	 * type
5550 	 *
5551 	 * mrq_response:: err is 0 if the specified request is supported and
5552 	 * -#BPMP_ENODEV otherwise
5553 	 */
5554 	CMD_C2C_QUERY_ABI = 0,
5555 
5556 	/**
5557 	 * @brief Start C2C initialization
5558 	 *
5559 	 * mrq_response:err is
5560 	 * * 0: Success
5561 	 * * -#BPMP_ENODEV: MRQ_C2C is not supported by BPMP-FW
5562 	 * * -#BPMP_ENAVAIL: Invalid request parameters
5563 	 * * -#BPMP_EACCES: Request is not accepted
5564 	 */
5565 	CMD_C2C_START_INITIALIZATION = 1,
5566 
5567 	/**
5568 	 * @brief Command to query current C2C training status
5569 	 *
5570 	 * This command will return the result of the latest C2C re-training that is initiated with
5571 	 * MRQ_C2C.CMD_C2C_START_INITIALIZATION or MRQ_C2C.CMD_C2C_START_HOTRESET calls.
5572 	 * If no training has been initiated yet, the command will return code BPMP_C2C_STATUS_INIT_NOT_STARTED.
5573 	 *
5574 	 * mrq_response:err is
5575 	 * * 0: Success
5576 	 * * -#BPMP_ENODEV: MRQ_C2C is not supported by BPMP-FW
5577 	 * * -#BPMP_EACCES: Request is not accepted
5578 	 */
5579 	CMD_C2C_GET_STATUS = 2,
5580 	/**
5581 	 * @brief C2C hot-reset precondition
5582 	 *
5583 	 * mrq_response:err is
5584 	 * * 0: Success
5585 	 * * -#BPMP_ENODEV: MRQ_C2C is not supported by BPMP-FW
5586 	 * * -#BPMP_ENAVAIL: Invalid request parameters
5587 	 * * -#BPMP_EACCES: Request is not accepted
5588 	 */
5589 	CMD_C2C_HOTRESET_PREP = 3,
5590 	/**
5591 	 * @brief Start C2C hot-reset
5592 	 *
5593 	 * mrq_response:err is
5594 	 * * 0: Success
5595 	 * * -#BPMP_ENODEV: MRQ_C2C is not supported by BPMP-FW
5596 	 * * -#BPMP_ENAVAIL: Invalid request parameters
5597 	 * * -#BPMP_EACCES: Request is not accepted
5598 	 */
5599 	CMD_C2C_START_HOTRESET = 4,
5600 
5601 	CMD_C2C_MAX
5602 };
5603 
5604 /**
5605  * @brief Request data for #MRQ_C2C command CMD_C2C_QUERY_ABI
5606  */
5607 struct cmd_c2c_query_abi_request {
5608 	/** @brief Command identifier to be queried */
5609 	uint32_t cmd;
5610 } BPMP_ABI_PACKED;
5611 
5612 /**
5613  * @brief Request data for #MRQ_C2C command CMD_C2C_START_INITIALIZATION
5614  */
5615 struct cmd_c2c_start_init_request {
5616 	/** @brief 1: partition 0; 2: partition 1; 3: partition 0 and 1; */
5617 	uint8_t partitions;
5618 } BPMP_ABI_PACKED;
5619 
5620 /**
5621  * @brief Response data for #MRQ_C2C command CMD_C2C_START_INITIALIZATION
5622  */
5623 struct cmd_c2c_start_init_response {
5624 	/** @brief Refer to @ref bpmp_c2c_status */
5625 	uint8_t status;
5626 } BPMP_ABI_PACKED;
5627 
5628 /**
5629  * @brief Response data for #MRQ_C2C command CMD_C2C_GET_STATUS
5630  */
5631 struct cmd_c2c_get_status_response {
5632 	/** @brief Refer to @ref bpmp_c2c_status */
5633 	uint8_t status;
5634 } BPMP_ABI_PACKED;
5635 
5636 /**
5637  * @brief Request data for #MRQ_C2C command CMD_C2C_HOTRESET_PREP
5638  */
5639 struct cmd_c2c_hotreset_prep_request {
5640 	/** @brief 1: partition 0; 2: partition 1; 3: partition 0 and 1; */
5641 	uint8_t partitions;
5642 } BPMP_ABI_PACKED;
5643 
5644 /**
5645  * @brief Request data for #MRQ_C2C command CMD_C2C_START_HOTRESET
5646  */
5647 struct cmd_c2c_start_hotreset_request {
5648 	/** @brief 1: partition 0; 2: partition 1; 3: partition 0 and 1; */
5649 	uint8_t partitions;
5650 } BPMP_ABI_PACKED;
5651 
5652 /**
5653  * @brief Response data for #MRQ_C2C command CMD_C2C_START_HOTRESET
5654  */
5655 struct cmd_c2c_start_hotreset_response {
5656 	/** @brief Refer to @ref bpmp_c2c_status */
5657 	uint8_t status;
5658 } BPMP_ABI_PACKED;
5659 
5660 /**
5661  * @brief Request with #MRQ_C2C
5662  *
5663  * |sub-command                  |payload                        |
5664  * |-----------------------------|-------------------------------|
5665  * |CMD_C2C_QUERY_ABI            |cmd_c2c_query_abi_request      |
5666  * |CMD_C2C_START_INITIALIZATION |cmd_c2c_start_init_request     |
5667  * |CMD_C2C_GET_STATUS           |                               |
5668  * |CMD_C2C_HOTRESET_PREP        |cmd_c2c_hotreset_prep_request  |
5669  * |CMD_C2C_START_HOTRESET       |cmd_c2c_start_hotreset_request |
5670 
5671  */
5672 struct mrq_c2c_request {
5673 	uint32_t cmd;
5674 	union {
5675 		struct cmd_c2c_query_abi_request c2c_query_abi_req;
5676 		struct cmd_c2c_start_init_request c2c_start_init_req;
5677 		struct cmd_c2c_hotreset_prep_request c2c_hotreset_prep_req;
5678 		struct cmd_c2c_start_hotreset_request c2c_start_hotreset_req;
5679 	} BPMP_UNION_ANON;
5680 } BPMP_ABI_PACKED;
5681 
5682 /**
5683  * @brief Response to MRQ_C2C
5684  *
5685  * |sub-command                  |payload                         |
5686  * |-----------------------------|--------------------------------|
5687  * |CMD_C2C_QUERY_ABI            |                                |
5688  * |CMD_C2C_START_INITIALIZATION |cmd_c2c_start_init_response     |
5689  * |CMD_C2C_GET_STATUS           |cmd_c2c_get_status_response     |
5690  * |CMD_C2C_HOTRESET_PREP        |                                |
5691  * |CMD_C2C_START_HOTRESET       |cmd_c2c_start_hotreset_response |
5692  */
5693 struct mrq_c2c_response {
5694 	union {
5695 		struct cmd_c2c_start_init_response c2c_start_init_resp;
5696 		struct cmd_c2c_get_status_response c2c_get_status_resp;
5697 		struct cmd_c2c_start_hotreset_response c2c_start_hotreset_resp;
5698 	} BPMP_UNION_ANON;
5699 } BPMP_ABI_PACKED;
5700 /** @} */
5701 /** @endcond */
5702 
5703 
5704 /** @cond (bpmp_t264)
5705  * @ingroup MRQ_Codes
5706  * @def MRQ_PCIE
5707  * @brief Perform a PCIE operation
5708  *
5709  * * Initiators: CCPLEX
5710  * * Targets: BPMP
5711  * * Request Payload: @ref mrq_pcie_request
5712  *
5713  * @addtogroup PCIE
5714  * @{
5715  */
5716 
5717 /**
5718  * @brief Sub-command identifiers for #MRQ_PCIE.
5719  */
5720 enum mrq_pcie_cmd {
5721 	/** @brief Initialize PCIE EP controller. */
5722 	CMD_PCIE_EP_CONTROLLER_INIT = 0,
5723 	/** @brief Disable PCIE EP controller. */
5724 	CMD_PCIE_EP_CONTROLLER_OFF = 1,
5725 
5726 	/** @brief Disable PCIE RP controller. */
5727 	CMD_PCIE_RP_CONTROLLER_OFF = 100,
5728 
5729 	CMD_PCIE_MAX,
5730 };
5731 
5732 /**
5733  * @brief Request payload for #MRQ_PCIE sub-command #CMD_PCIE_EP_CONTROLLER_INIT.
5734  */
5735 struct cmd_pcie_ep_controller_init_request {
5736 	/**
5737 	 * @brief PCIe EP controller number.
5738 	 * Valid entries for T264 are 2, 4 and 5.
5739 	 */
5740 	uint8_t ep_controller;
5741 	/**
5742 	 * @brief PCIe EP function programming interface code.
5743 	 * Valid range in HW is [0, 0xFFU], BPMP-FW programs the input value without any check.
5744 	 * It is up to the requester to send valid input as documented in "PCI CODE AND ID
5745 	 * ASSIGNMENT SPECIFICATION".
5746 	 */
5747 	uint8_t progif_code;
5748 	/**
5749 	 * @brief PCIe EP function sub-class code.
5750 	 * Valid range in HW is [0, 0xFFU], BPMP-FW programs the input value without any check.
5751 	 * It is up to the requester to send valid input as documented in "PCI CODE AND ID
5752 	 * ASSIGNMENT SPECIFICATION".
5753 	 */
5754 	uint8_t subclass_code;
5755 	/**
5756 	 * @brief PCIe EP function base class code.
5757 	 * Valid range in HW is [0, 0xFFU], BPMP-FW programs the input value without any check.
5758 	 * It is up to the requester to send valid input as documented in "PCI CODE AND ID
5759 	 * ASSIGNMENT SPECIFICATION".
5760 	 */
5761 	uint8_t baseclass_code;
5762 	/**
5763 	 * @brief PCIe EP function device id.
5764 	 * Valid range is [0, 0x7FU], only LSB 7 bits are writable in 16-bit PCI device id.
5765 	 * Valid range check is done on input value and returns -BPMP_EINVAL on failure.
5766 	 */
5767 	uint8_t deviceid;
5768 	/**
5769 	 * @brief PCIe EP EP BAR1 size.
5770 	 * Valid range is [6U, 16U], which translate to [64MB, 64GB] size.
5771 	 * Valid range check is done on input value and returns -BPMP_EINVAL on failure.
5772 	 */
5773 	uint8_t bar1_size;
5774 } BPMP_ABI_PACKED;
5775 
5776 /**
5777  * @brief Request payload for #MRQ_PCIE sub-command #CMD_PCIE_EP_CONTROLLER_OFF.
5778  */
5779 struct cmd_pcie_ep_controller_off_request {
5780 	/** @brief EP controller number, T264 valid: 2, 4, 5. */
5781 	uint8_t ep_controller;
5782 } BPMP_ABI_PACKED;
5783 
5784 /**
5785  * @brief Request payload for #MRQ_PCIE sub-command #CMD_PCIE_RP_CONTROLLER_OFF.
5786  */
5787 struct cmd_pcie_rp_controller_off_request {
5788 	/** @brief RP controller number, T264 valid: 1-5 */
5789 	uint8_t rp_controller;
5790 } BPMP_ABI_PACKED;
5791 
5792 /**
5793  * @ingroup PCIE
5794  * @brief Request payload for the #MRQ_PCIE command.
5795  *
5796  * Used by the sender of an #MRQ_PCIE message to control PCIE.
5797  * Below table shows sub-commands with their corresponding payload data.
5798  *
5799  * |sub-command                           |payload                                  |
5800  * |--------------------------------------|-----------------------------------------|
5801  * |#CMD_PCIE_EP_CONTROLLER_INIT          |#cmd_pcie_ep_controller_init_request     |
5802  * |#CMD_PCIE_EP_CONTROLLER_OFF           |#cmd_pcie_ep_controller_off_request      |
5803  *
5804  * @cond (!bpmp_safe)
5805  *
5806  * The following additional MRQs are supported on non-functional-safety
5807  * builds:
5808  * |sub-command                           |payload                                  |
5809  * |--------------------------------------|-----------------------------------------|
5810  * |#CMD_PCIE_RP_CONTROLLER_OFF           |#cmd_pcie_rp_controller_off_request      |
5811  *
5812  * @endcond
5813  *
5814  */
5815 struct mrq_pcie_request {
5816 	/** @brief Sub-command ID from @ref mrq_pcie_cmd. */
5817 	uint32_t cmd;
5818 
5819 	union {
5820 		struct cmd_pcie_ep_controller_init_request ep_ctrlr_init;
5821 		struct cmd_pcie_ep_controller_off_request ep_ctrlr_off;
5822 		/** @cond (!bpmp_safe) */
5823 		struct cmd_pcie_rp_controller_off_request rp_ctrlr_off;
5824 		/** @endcond */
5825 	} BPMP_UNION_ANON;
5826 } BPMP_ABI_PACKED;
5827 
5828 /** @} PCIE */
5829 /** @endcond */
5830 
5831 /** @cond (bpmp_t264)
5832  * @ingroup MRQ_Codes
5833  * @def MRQ_CR7
5834  * @brief Perform a CR7 operation
5835  *
5836  * * Initiators: CPU_S
5837  * * Targets: BPMP
5838  * * Request Payload: @ref mrq_cr7_request
5839  *
5840  * @addtogroup CR7
5841  * @{
5842  */
5843 
5844 /**
5845  * @brief Payload for #MRQ_CR7
5846  * 2 fields for future parameters are provided. These must be 0 currently.
5847  */
5848 struct cmd_cr7_request {
5849 	uint32_t fld0;
5850 	uint32_t fld1;
5851 } BPMP_ABI_PACKED;
5852 
5853 struct cmd_cr7_query_abi_request {
5854 	/** #MRQ_CR7 sub-command identifier from @ref mrq_cr7_cmd */
5855 	uint32_t type;
5856 } BPMP_ABI_PACKED;
5857 
5858 /**
5859  * @brief Sub-command identifiers for #MRQ_CR7.
5860  */
5861 enum mrq_cr7_cmd {
5862 	/**
5863 	 * @brief Check whether the BPMP driver supports the specified request
5864 	 * type
5865 	 *
5866 	 * mrq_response:: err is 0 if the specified request is supported and
5867 	 * -#BPMP_ENODEV otherwise
5868 	 */
5869 	CMD_CR7_QUERY_ABI = 0,
5870 
5871 	/** @brief Enter CR7 state on the package BPMP-FW is running on. */
5872 	CMD_CR7_ENTRY = 1,
5873 	/** @brief Exit CR7 state on the package BPMP-FW is running on. */
5874 	CMD_CR7_EXIT = 2,
5875 
5876 	CMD_CR7_MAX,
5877 };
5878 
5879 /**
5880  * @ingroup CR7
5881  * @brief #MRQ_CR7 structure
5882  *
5883  * |Sub-command                 |Payload                    |
5884  * |----------------------------|---------------------------|
5885  * |#CMD_CR7_QUERY_ABI          | #cmd_cr7_query_abi_request|
5886  * |#CMD_CR7_ENTRY              | #cmd_cr7_request	    |
5887  * |#CMD_CR7_EXIT               | #cmd_cr7_request	    |
5888 
5889  */
5890 struct mrq_cr7_request {
5891 	/** @brief Sub-command ID from @ref mrq_cr7_cmd. */
5892 	uint32_t cmd;
5893 	union {
5894 		struct cmd_cr7_query_abi_request query_abi;
5895 		struct cmd_cr7_request cr7_request;
5896 	} BPMP_UNION_ANON;
5897 } BPMP_ABI_PACKED;
5898 
5899 /** @} CR7 */
5900 /** @endcond */
5901 
5902 /** @cond (bpmp_tb500)
5903  * @ingroup MRQ_Codes
5904  * @def MRQ_HWPM
5905  * @brief Configure and query HWPM functionality
5906  *
5907  * * Initiators: CCPLEX
5908  * * Targets: BPMP
5909  * * Request Payload: @ref mrq_hwpm_request
5910  * * Response Payload: @ref mrq_hwpm_response
5911  *
5912  * @addtogroup HWPM
5913  * @{
5914  */
5915 
5916 /**
5917  * @brief Sub-command identifiers for #MRQ_HWPM.
5918  */
5919 enum mrq_hwpm_cmd {
5920 	/**
5921 	 * @brief Check whether the BPMP-FW supports the specified
5922 	 * #MRQ_HWPM sub-command.
5923 	 *
5924 	 * mrq_response:err is 0 if the specified request is
5925 	 * supported and -#BPMP_ENODEV otherwise.
5926 	 */
5927 	CMD_HWPM_QUERY_ABI = 1,
5928 
5929 	/**
5930 	 * @brief Configure IPMU triggers
5931 	 *
5932 	 * mrq_response:err is defined as:
5933 	 *
5934 	 * | Value          | Description                                 |
5935 	 * | -------------- | ------------------------------------------- |
5936 	 * | 0              | Success                                     |
5937 	 * | -#BPMP_ENODEV  | #MRQ_HWPM is not supported by BPMP-FW.      |
5938 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
5939 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
5940 	 */
5941 	CMD_HWPM_IPMU_SET_TRIGGERS = 2,
5942 
5943 	/**
5944 	 * @brief Configure IPMU payloads and shifts
5945 	 *
5946 	 * mrq_response:err is defined as:
5947 	 *
5948 	 * | Value          | Description                                 |
5949 	 * | -------------- | ------------------------------------------- |
5950 	 * | 0              | Success                                     |
5951 	 * | -#BPMP_ENODEV  | #MRQ_HWPM is not supported by BPMP-FW.      |
5952 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
5953 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
5954 	 */
5955 	CMD_HWPM_IPMU_SET_PAYLOADS_SHIFTS = 3,
5956 
5957 	/**
5958 	 * @brief Get maximum number of payloads
5959 	 *
5960 	 * mrq_response:err is defined as:
5961 	 *
5962 	 * | Value          | Description                                 |
5963 	 * | -------------- | ------------------------------------------- |
5964 	 * | 0              | Success                                     |
5965 	 * | -#BPMP_ENODEV  | #MRQ_HWPM is not supported by BPMP-FW.      |
5966 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
5967 	 */
5968 	CMD_HWPM_IPMU_GET_MAX_PAYLOADS = 4,
5969 
5970 	/**
5971 	 * @brief Configure NVTHERM sample rate
5972 	 *
5973 	 * mrq_response:err is defined as:
5974 	 *
5975 	 * | Value          | Description                                 |
5976 	 * | -------------- | ------------------------------------------- |
5977 	 * | 0              | Success                                     |
5978 	 * | -#BPMP_ENODEV  | #MRQ_HWPM is not supported by BPMP-FW.      |
5979 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
5980 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
5981 	 */
5982 	CMD_HWPM_NVTHERM_SET_SAMPLE_RATE = 5,
5983 
5984 	/**
5985 	 * @brief Set NVTHERM bubble interval
5986 	 *
5987 	 * mrq_response:err is defined as:
5988 	 *
5989 	 * | Value          | Description                                 |
5990 	 * | -------------- | ------------------------------------------- |
5991 	 * | 0              | Success                                     |
5992 	 * | -#BPMP_ENODEV  | #MRQ_HWPM is not supported by BPMP-FW.      |
5993 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
5994 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
5995 	 */
5996 	CMD_HWPM_NVTHERM_SET_BUBBLE_INTERVAL = 6,
5997 
5998 	/**
5999 	 * @brief Configure NVTHERM DG flexible channels
6000 	 *
6001 	 * mrq_response:err is defined as:
6002 	 *
6003 	 * | Value          | Description                                 |
6004 	 * | -------------- | ------------------------------------------- |
6005 	 * | 0              | Success                                     |
6006 	 * | -#BPMP_ENODEV  | #MRQ_HWPM is not supported by BPMP-FW.      |
6007 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
6008 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
6009 	 */
6010 	CMD_HWPM_NVTHERM_SET_FLEX_CHANNELS = 7,
6011 
6012 	/**
6013 	 * @brief Get ISENSE sensor name
6014 	 *
6015 	 * mrq_response:err is defined as:
6016 	 *
6017 	 * | Value          | Description                                 |
6018 	 * | -------------- | ------------------------------------------- |
6019 	 * | 0              | Success                                     |
6020 	 * | -#BPMP_ENODEV  | #MRQ_HWPM is not supported by BPMP-FW.      |
6021 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
6022 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
6023 	 */
6024 	CMD_HWPM_ISENSE_GET_SENSOR_NAME = 8,
6025 
6026 	/**
6027 	 * @brief Get ISENSE sensor channel
6028 	 *
6029 	 * mrq_response:err is defined as:
6030 	 *
6031 	 * | Value          | Description                                 |
6032 	 * | -------------- | ------------------------------------------- |
6033 	 * | 0              | Success                                     |
6034 	 * | -#BPMP_ENODEV  | #MRQ_HWPM is not supported by BPMP-FW.      |
6035 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
6036 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
6037 	 */
6038 	CMD_HWPM_ISENSE_GET_SENSOR_CHANNEL = 9,
6039 
6040 	/**
6041 	 * @brief Get ISENSE sensor scale factor
6042 	 *
6043 	 * mrq_response:err is defined as:
6044 	 *
6045 	 * | Value          | Description                                 |
6046 	 * | -------------- | ------------------------------------------- |
6047 	 * | 0              | Success                                     |
6048 	 * | -#BPMP_ENODEV  | #MRQ_HWPM is not supported by BPMP-FW.      |
6049 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
6050 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
6051 	 */
6052 	CMD_HWPM_ISENSE_GET_SENSOR_SCALE_FACTOR = 10,
6053 
6054 	/**
6055 	 * @brief Get ISENSE sensor offset
6056 	 *
6057 	 * mrq_response:err is defined as:
6058 	 *
6059 	 * | Value          | Description                                 |
6060 	 * | -------------- | ------------------------------------------- |
6061 	 * | 0              | Success                                     |
6062 	 * | -#BPMP_ENODEV  | #MRQ_HWPM is not supported by BPMP-FW.      |
6063 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
6064 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
6065 	 * | -#BPMP_ENODATA | No sensor offset.                           |
6066 	 */
6067 	CMD_HWPM_ISENSE_GET_SENSOR_OFFSET = 11,
6068 
6069 	/**
6070 	 * @brief Get ISENSE sum block name
6071 	 *
6072 	 * mrq_response:err is defined as:
6073 	 *
6074 	 * | Value          | Description                                 |
6075 	 * | -------------- | ------------------------------------------- |
6076 	 * | 0              | Success                                     |
6077 	 * | -#BPMP_ENODEV  | #MRQ_HWPM is not supported by BPMP-FW.      |
6078 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
6079 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
6080 	 */
6081 	CMD_HWPM_ISENSE_GET_SUM_BLOCK_NAME = 12,
6082 
6083 	/**
6084 	 * @brief Get ISENSE sum input sensor IDs
6085 	 *
6086 	 * mrq_response:err is defined as:
6087 	 *
6088 	 * | Value          | Description                                 |
6089 	 * | -------------- | ------------------------------------------- |
6090 	 * | 0              | Success                                     |
6091 	 * | -#BPMP_ENODEV  | #MRQ_HWPM is not supported by BPMP-FW.      |
6092 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
6093 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
6094 	 */
6095 	CMD_HWPM_ISENSE_GET_SUM_BLOCK_INPUTS = 13,
6096 
6097 	/**
6098 	 * @brief Largest supported #MRQ_HWPM sub-command identifier + 1
6099 	 */
6100 	CMD_HWPM_MAX,
6101 };
6102 
6103 /**
6104  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_QUERY_ABI
6105  */
6106 struct cmd_hwpm_query_abi_req {
6107 	/** @brief Sub-command identifier from @ref mrq_hwpm_cmd */
6108 	uint32_t cmd_code;
6109 } BPMP_ABI_PACKED;
6110 
6111 /**
6112  * @brief Maximum array length for IPMU trigger bitmask
6113  */
6114 #define HWPM_IPMU_TRIGGER_ARR_LEN	28U
6115 
6116 /**
6117  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_IPMU_SET_TRIGGERS
6118  */
6119 struct cmd_hwpm_ipmu_set_triggers_req {
6120 	/** @brief IPMU physical ID
6121 	 *
6122 	 * @note Valid range from [0, MAX_CPU_CORES), see @ref bpmp_hwpm_core_config
6123 	 */
6124 	uint32_t ipmu_phys_id;
6125 	/** @brief Trigger bitmask, see @ref bpmp_ipmu_trigger_ids
6126 	 *
6127 	 * @note Setting a trigger bit will cause the associated trigger to
6128 	 *       generate an output packet from IPMU to the HWPM perfmux.
6129 	 * @note Up to a maximum possible 896 triggers
6130 	 */
6131 	uint32_t triggers[HWPM_IPMU_TRIGGER_ARR_LEN];
6132 } BPMP_ABI_PACKED;
6133 
6134 /**
6135  * @brief Array length for IPMU payload bitmask
6136  */
6137 #define HWPM_IPMU_PAYLOAD_ARR_LEN	26U
6138 
6139 /**
6140  * @brief Array length for IPMU payload shift bitmask
6141  */
6142 #define HWPM_IPMU_SHIFT_ARR_LEN	2U
6143 
6144 /**
6145  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_IPMU_SET_PAYLOADS_SHIFTS
6146  */
6147 struct cmd_hwpm_ipmu_set_payloads_shifts_req {
6148 	/** @brief IPMU physical ID
6149 	 *
6150 	 * @note Valid range from [0, MAX_CPU_CORES), see @ref bpmp_hwpm_core_config
6151 	 */
6152 	uint32_t ipmu_phys_id;
6153 	/** @brief Payload bitmask, see @ref bpmp_ipmu_payload_ids
6154 	 *
6155 	 * @note Setting a payload bit will add the associated payload to the
6156 	 *       IPMU output packet.
6157 	 * @note The maximum number of payloads is platform dependent,
6158 	 *       @see #CMD_HWPM_IPMU_GET_MAX_PAYLOADS
6159 	 * @note To disable IPMU streaming on this instance, set all payload bits to 0.
6160 	 * @note Up to a maximum of 832 available payloads
6161 	 */
6162 	uint32_t payloads[HWPM_IPMU_PAYLOAD_ARR_LEN];
6163 	/**
6164 	 * @brief Payload shift mask
6165 	 *
6166 	 * @note Setting the i-th shift bit will right-shift the
6167 	 *       i-th enabled payload by 1 bit.
6168 	 * @note Up to a maximum of 64 simultaneous emitted payloads
6169 	 */
6170 	uint32_t shifts[HWPM_IPMU_SHIFT_ARR_LEN];
6171 } BPMP_ABI_PACKED;
6172 
6173 /**
6174  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_IPMU_GET_MAX_PAYLOADS
6175  */
6176 struct cmd_hwpm_ipmu_get_max_payloads_req {
6177 	BPMP_ABI_EMPTY
6178 } BPMP_ABI_PACKED;
6179 
6180 /**
6181  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_NVTHERM_SET_SAMPLE_RATE
6182  */
6183 struct cmd_hwpm_nvtherm_set_sample_rate_req {
6184 	/** @brief Sample rate in microseconds
6185 	 *
6186 	 * @note Requesting a sample rate of 0 will disable NVTHERM streaming.
6187 	 */
6188 	uint32_t sample_rate;
6189 } BPMP_ABI_PACKED;
6190 
6191 /**
6192  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_NVTHERM_SET_BUBBLE_INTERVAL
6193  */
6194 struct cmd_hwpm_nvtherm_set_bubble_interval_req {
6195 	/** @brief Bubble interval in microseconds */
6196 	uint32_t bubble_interval;
6197 } BPMP_ABI_PACKED;
6198 
6199 /**
6200  * @brief Maximum array length for NVTHERM flexible channel bitmask
6201  */
6202 #define HWPM_NVTHERM_FLEX_CHANNEL_ARR_LEN	29U
6203 
6204 /**
6205  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_NVTHERM_SET_FLEX_CHANNELS
6206  */
6207 struct cmd_hwpm_nvtherm_set_flex_channels_req {
6208 	/** @brief NVTHERM flexible channel bitmask
6209 	 *
6210 	 * @see #bpmp_nvtherm_flex_channel_ids
6211 	 *
6212 	 * @note Up to a maximum of 928 flexible channels
6213 	 */
6214 	uint32_t channels[HWPM_NVTHERM_FLEX_CHANNEL_ARR_LEN];
6215 } BPMP_ABI_PACKED;
6216 
6217 /**
6218  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_ISENSE_GET_SENSOR_NAME
6219  */
6220 struct cmd_hwpm_isense_get_sensor_name_req {
6221 	/** @brief Sensor ID from @ref bpmp_isense_sensor_ids */
6222 	uint32_t sensor_id;
6223 } BPMP_ABI_PACKED;
6224 
6225 /**
6226  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_ISENSE_GET_SENSOR_CHANNEL
6227  */
6228 struct cmd_hwpm_isense_get_sensor_channel_req {
6229 	/** @brief Sensor ID from @ref bpmp_isense_sensor_ids */
6230 	uint32_t sensor_id;
6231 } BPMP_ABI_PACKED;
6232 
6233 /**
6234  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_ISENSE_GET_SENSOR_SCALE_FACTOR
6235  */
6236 struct cmd_hwpm_isense_get_sensor_scale_factor_req {
6237 	/** @brief Sensor ID from @ref bpmp_isense_sensor_ids */
6238 	uint32_t sensor_id;
6239 } BPMP_ABI_PACKED;
6240 
6241 /**
6242  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_ISENSE_GET_SENSOR_OFFSET
6243  */
6244 struct cmd_hwpm_isense_get_sensor_offset_req {
6245 	/** @brief Sensor ID from @ref bpmp_isense_sensor_ids */
6246 	uint32_t sensor_id;
6247 } BPMP_ABI_PACKED;
6248 
6249 /**
6250  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_ISENSE_GET_SUM_BLOCK_NAME
6251  */
6252 struct cmd_hwpm_isense_get_sum_block_name_req {
6253 	/** @brief Sum block index */
6254 	uint32_t sum_block_index;
6255 } BPMP_ABI_PACKED;
6256 
6257 /**
6258  * @brief Request data for #MRQ_HWPM sub-command #CMD_HWPM_ISENSE_GET_SUM_BLOCK_INPUTS
6259  */
6260 struct cmd_hwpm_isense_get_sum_block_inputs_req {
6261 	/** @brief Sum block index */
6262 	uint32_t sum_block_index;
6263 } BPMP_ABI_PACKED;
6264 
6265 /**
6266  * @brief Response data for #MRQ_HWPM sub-command #CMD_HWPM_IPMU_GET_MAX_PAYLOADS
6267  */
6268 struct cmd_hwpm_ipmu_get_max_payloads_resp {
6269 	/** @brief Maximum number of payloads */
6270 	uint32_t max_payloads;
6271 } BPMP_ABI_PACKED;
6272 
6273 /**
6274  * @brief Maximum array length for ISENSE sensor name
6275  */
6276 #define HWPM_ISENSE_SENSOR_MAX_NAME_LEN		64U
6277 
6278 /**
6279  * @brief Response data for #MRQ_HWPM sub-command #CMD_HWPM_ISENSE_GET_SENSOR_NAME
6280  */
6281 struct cmd_hwpm_isense_get_sensor_name_resp {
6282 	/** @brief Sensor name */
6283 	char sensor_name[HWPM_ISENSE_SENSOR_MAX_NAME_LEN];
6284 } BPMP_ABI_PACKED;
6285 
6286 /**
6287  * @brief Response data for #MRQ_HWPM sub-command #CMD_HWPM_ISENSE_GET_SENSOR_CHANNEL
6288  */
6289 struct cmd_hwpm_isense_get_sensor_channel_resp {
6290 	/** @brief Physical channel index */
6291 	uint32_t channel_index;
6292 } BPMP_ABI_PACKED;
6293 
6294 /**
6295  * @brief Response data for #MRQ_HWPM sub-command #CMD_HWPM_ISENSE_GET_SENSOR_SCALE_FACTOR
6296  */
6297 struct cmd_hwpm_isense_get_sensor_scale_factor_resp {
6298 	/** @brief Scale factor */
6299 	float scale_factor;
6300 } BPMP_ABI_PACKED;
6301 
6302 /**
6303  * @brief Response data for #MRQ_HWPM sub-command #CMD_HWPM_ISENSE_GET_SENSOR_OFFSET
6304  */
6305 struct cmd_hwpm_isense_get_sensor_offset_resp {
6306 	/** @brief Offset sensor ID */
6307 	uint32_t offset_sensor_id;
6308 } BPMP_ABI_PACKED;
6309 
6310 /**
6311  * @brief Maximum array length for ISENSE sum name
6312  */
6313 #define HWPM_ISENSE_SUM_BLOCK_MAX_NAME_LEN	64U
6314 
6315 /**
6316  * @brief Response data for #MRQ_HWPM sub-command #CMD_HWPM_ISENSE_GET_SUM_BLOCK_NAME
6317  */
6318 struct cmd_hwpm_isense_get_sum_block_name_resp {
6319 	/** @brief Sum block name */
6320 	char sum_block_name[HWPM_ISENSE_SUM_BLOCK_MAX_NAME_LEN];
6321 } BPMP_ABI_PACKED;
6322 
6323 /**
6324  * @brief Maximum array length for ISENSE sum block input sensor IDs
6325  */
6326 #define HWPM_ISENSE_SUM_BLOCK_INPUTS_MAX	16U
6327 
6328 /**
6329  * @brief Response data for #MRQ_HWPM sub-command #CMD_HWPM_ISENSE_GET_SUM_BLOCK_INPUTS
6330  */
6331 struct cmd_hwpm_isense_get_sum_block_inputs_resp {
6332 	/** @brief Input channel indices; negative if no input is applied */
6333 	int32_t input_channel_idx[HWPM_ISENSE_SUM_BLOCK_INPUTS_MAX];
6334 } BPMP_ABI_PACKED;
6335 
6336 /**
6337  * @brief Request payload for the #MRQ_HWPM -command
6338  *
6339  * | Sub-command                              | Request payload                              |
6340  * | ---------------------------------------- | -------------------------------------------- |
6341  * | #CMD_HWPM_QUERY_ABI                      | #cmd_hwpm_query_abi_req                      |
6342  * | #CMD_HWPM_IPMU_SET_TRIGGERS              | #cmd_hwpm_ipmu_set_triggers_req              |
6343  * | #CMD_HWPM_IPMU_SET_PAYLOADS_SHIFTS       | #cmd_hwpm_ipmu_set_payloads_shifts_req       |
6344  * | #CMD_HWPM_IPMU_GET_MAX_PAYLOADS          | #cmd_hwpm_ipmu_get_max_payloads_req          |
6345  * | #CMD_HWPM_NVTHERM_SET_SAMPLE_RATE        | #cmd_hwpm_nvtherm_set_sample_rate_req        |
6346  * | #CMD_HWPM_NVTHERM_SET_BUBBLE_INTERVAL    | #cmd_hwpm_nvtherm_set_bubble_interval_req    |
6347  * | #CMD_HWPM_NVTHERM_SET_FLEX_CHANNELS      | #cmd_hwpm_nvtherm_set_flex_channels_req      |
6348  * | #CMD_HWPM_ISENSE_GET_SENSOR_CHANNEL      | #cmd_hwpm_isense_get_sensor_channel_req      |
6349  * | #CMD_HWPM_ISENSE_GET_SENSOR_SCALE_FACTOR | #cmd_hwpm_isense_get_sensor_scale_factor_req |
6350  * | #CMD_HWPM_ISENSE_GET_SENSOR_OFFSET       | #cmd_hwpm_isense_get_sensor_offset_req       |
6351  * | #CMD_HWPM_ISENSE_GET_SUM_BLOCK_NAME      | #cmd_hwpm_isense_get_sum_block_name_req      |
6352  * | #CMD_HWPM_ISENSE_GET_SUM_BLOCK_INPUTS    | #cmd_hwpm_isense_get_sum_block_inputs_req    |
6353  */
6354 struct mrq_hwpm_request {
6355 	uint32_t cmd;
6356 	union {
6357 		struct cmd_hwpm_query_abi_req query_abi;
6358 		struct cmd_hwpm_ipmu_set_triggers_req ipmu_set_triggers;
6359 		struct cmd_hwpm_ipmu_set_payloads_shifts_req ipmu_set_payloads_shifts;
6360 		struct cmd_hwpm_ipmu_get_max_payloads_req ipmu_get_max_payloads;
6361 		struct cmd_hwpm_nvtherm_set_sample_rate_req nvtherm_set_sample_rate;
6362 		struct cmd_hwpm_nvtherm_set_bubble_interval_req nvtherm_set_bubble_interval;
6363 		struct cmd_hwpm_nvtherm_set_flex_channels_req nvtherm_set_flex_channels;
6364 		struct cmd_hwpm_isense_get_sensor_name_req isense_get_sensor_name;
6365 		struct cmd_hwpm_isense_get_sensor_channel_req isense_get_sensor_channel;
6366 		struct cmd_hwpm_isense_get_sensor_scale_factor_req isense_get_sensor_scale_factor;
6367 		struct cmd_hwpm_isense_get_sensor_offset_req isense_get_sensor_offset;
6368 		struct cmd_hwpm_isense_get_sum_block_name_req isense_get_sum_block_name;
6369 		struct cmd_hwpm_isense_get_sum_block_inputs_req isense_get_sum_block_inputs;
6370 	} BPMP_UNION_ANON;
6371 } BPMP_ABI_PACKED;
6372 
6373 /**
6374  * @brief Response payload for the #MRQ_HWPM -command
6375  *
6376  * | Sub-command                              | Response payload                              |
6377  * | ---------------------------------------- | --------------------------------------------- |
6378  * | #CMD_HWPM_QUERY_ABI                      | -                                             |
6379  * | #CMD_HWPM_IPMU_SET_TRIGGERS              | -                                             |
6380  * | #CMD_HWPM_IPMU_SET_PAYLOADS_SHIFTS       | -                                             |
6381  * | #CMD_HWPM_IPMU_GET_MAX_PAYLOADS          | #cmd_hwpm_ipmu_get_max_payloads_resp          |
6382  * | #CMD_HWPM_NVTHERM_SET_SAMPLE_RATE        | -                                             |
6383  * | #CMD_HWPM_NVTHERM_SET_BUBBLE_INTERVAL    | -                                             |
6384  * | #CMD_HWPM_NVTHERM_SET_FLEX_CHANNELS      | -                                             |
6385  * | #CMD_HWPM_ISENSE_GET_SENSOR_NAME         | #cmd_hwpm_isense_get_sensor_name_resp         |
6386  * | #CMD_HWPM_ISENSE_GET_SENSOR_CHANNEL      | #cmd_hwpm_isense_get_sensor_channel_resp      |
6387  * | #CMD_HWPM_ISENSE_GET_SENSOR_SCALE_FACTOR | #cmd_hwpm_isense_get_sensor_scale_factor_resp |
6388  * | #CMD_HWPM_ISENSE_GET_SENSOR_OFFSET       | #cmd_hwpm_isense_get_sensor_offset_resp       |
6389  * | #CMD_HWPM_ISENSE_GET_SUM_BLOCK_NAME      | #cmd_hwpm_isense_get_sum_block_name_resp      |
6390  * | #CMD_HWPM_ISENSE_GET_SUM_BLOCK_INPUTS    | #cmd_hwpm_isense_get_sum_block_inputs_resp    |
6391  */
6392 struct mrq_hwpm_response {
6393 	uint32_t err;
6394 	union {
6395 		struct cmd_hwpm_ipmu_get_max_payloads_resp ipmu_get_max_payloads;
6396 		struct cmd_hwpm_isense_get_sensor_name_resp isense_get_sensor_name;
6397 		struct cmd_hwpm_isense_get_sensor_channel_resp isense_get_sensor_channel;
6398 		struct cmd_hwpm_isense_get_sensor_scale_factor_resp isense_get_sensor_scale_factor;
6399 		struct cmd_hwpm_isense_get_sensor_offset_resp isense_get_sensor_offset;
6400 		struct cmd_hwpm_isense_get_sum_block_name_resp isense_get_sum_block_name;
6401 		struct cmd_hwpm_isense_get_sum_block_inputs_resp isense_get_sum_block_inputs;
6402 	} BPMP_UNION_ANON;
6403 } BPMP_ABI_PACKED;
6404 
6405 /** @} HWPM */
6406 /** @endcond */
6407 
6408 /** @cond (bpmp_tb500)
6409  * @ingroup MRQ_Codes
6410  * @def MRQ_DVFS
6411  * @brief Configure DVFS functionality
6412  *
6413  * * Initiators: CCPLEX
6414  * * Targets: BPMP
6415  * * Request Payload: @ref mrq_dvfs_request
6416  *
6417  * @addtogroup DVFS
6418  * @{
6419  */
6420 
6421 /**
6422  * @brief Sub-command identifiers for #MRQ_DVFS.
6423  */
6424 enum mrq_dvfs_cmd {
6425 	/**
6426 	 * @brief Check whether the BPMP-FW supports the specified
6427 	 * #MRQ_DVFS sub-command.
6428 	 *
6429 	 * mrq_response:err is 0 if the specified request is
6430 	 * supported and -#BPMP_ENODEV otherwise.
6431 	 */
6432 	CMD_DVFS_QUERY_ABI = 1,
6433 
6434 	/**
6435 	 * @brief Configure DVFS controller
6436 	 *
6437 	 * mrq_response:err is defined as:
6438 	 *
6439 	 * | Value          | Description                                 |
6440 	 * | -------------- | ------------------------------------------- |
6441 	 * | 0              | Success                                     |
6442 	 * | -#BPMP_ENODEV  | #MRQ_DVFS is not supported by BPMP-FW.      |
6443 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
6444 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
6445 	 */
6446 	CMD_DVFS_SET_CTRL_STATE = 2,
6447 
6448 	/**
6449 	 * @brief Configure DVFS manager
6450 	 *
6451 	 * mrq_response:err is defined as:
6452 	 *
6453 	 * | Value          | Description                                 |
6454 	 * | -------------- | ------------------------------------------- |
6455 	 * | 0              | Success                                     |
6456 	 * | -#BPMP_ENODEV  | #MRQ_DVFS is not supported by BPMP-FW.      |
6457 	 * | -#BPMP_ENOTSUP | Subcommand is not supported by BPMP-FW.     |
6458 	 * | -#BPMP_EINVAL  | Invalid request parameters.                 |
6459 	 */
6460 	CMD_DVFS_SET_MGR_STATE = 3,
6461 
6462 	/**
6463 	 * @brief Largest supported #MRQ_DVFS sub-command identifier + 1
6464 	 */
6465 	CMD_DVFS_MAX,
6466 };
6467 
6468 /**
6469  * @brief Request data for #MRQ_DVFS sub-command #CMD_DVFS_QUERY_ABI
6470  */
6471 struct cmd_dvfs_query_abi_req {
6472 	/** @brief Sub-command identifier from @ref mrq_dvfs_cmd */
6473 	uint32_t cmd_code;
6474 } BPMP_ABI_PACKED;
6475 
6476 struct cmd_dvfs_set_ctrl_state_req {
6477 	/** @brief Controller ID from @ref bpmp_dvfs_ctrl_ids */
6478 	uint32_t ctrl_id;
6479 	/** @brief Controller enable state */
6480 	uint32_t enable;
6481 } BPMP_ABI_PACKED;
6482 
6483 struct cmd_dvfs_set_mgr_state_req {
6484 	/** @brief Manager ID from @ref bpmp_dvfs_mgr_ids */
6485 	uint32_t mgr_id;
6486 	/** @brief Manager enable state */
6487 	uint32_t enable;
6488 } BPMP_ABI_PACKED;
6489 
6490 /**
6491  * @brief Request payload for the #MRQ_DVFS -command
6492  *
6493  * | Sub-command                              | Request payload                              |
6494  * | ---------------------------------------- | -------------------------------------------- |
6495  * | #CMD_DVFS_QUERY_ABI                      | #cmd_dvfs_query_abi_req                      |
6496  * | #CMD_DVFS_SET_CTRL_STATE                 | #cmd_dvfs_set_ctrl_state_req                 |
6497  * | #CMD_DVFS_SET_MGR_STATE                  | #cmd_dvfs_set_mgr_state_req                  |
6498  */
6499 struct mrq_dvfs_request {
6500 	uint32_t cmd;
6501 	union {
6502 		struct cmd_dvfs_query_abi_req query_abi;
6503 		struct cmd_dvfs_set_ctrl_state_req set_ctrl_state;
6504 		struct cmd_dvfs_set_mgr_state_req set_mgr_state;
6505 	} BPMP_UNION_ANON;
6506 } BPMP_ABI_PACKED;
6507 
6508 /** @} DVFS */
6509 /** @endcond */
6510 
6511 /** @cond (bpmp_tb500)
6512  * @ingroup MRQ_Codes
6513  * @def MRQ_PPP_PROFILE
6514  * @brief Get power/performance profile configuration settings.
6515  *
6516  * * Initiators: Any
6517  * * Targets: BPMP
6518  * * Request Payload: @ref mrq_ppp_profile_request
6519  * * Response Payload: @ref mrq_ppp_profile_response
6520  *
6521  * @addtogroup PPP
6522  * @{
6523  */
6524 
6525 /**
6526  * @brief Sub-command identifiers for #MRQ_PPP_PROFILE.
6527  */
6528 enum mrq_ppp_profile_cmd {
6529 	/**
6530 	 * @brief Check whether the BPMP-FW supports the specified
6531 	 * #MRQ_PPP_PROFILE sub-command.
6532 	 *
6533 	 * mrq_ppp_profile_response:err is 0 if the specified request is
6534 	 * supported and -#BPMP_ENOTSUP otherwise.
6535 	 */
6536 
6537 	CMD_PPP_PROFILE_QUERY_ABI = 0,
6538 	/**
6539 	 * @brief Query the BPMP for the CPU core and SLC slice configuration associated
6540 	 * with a given Power/Performance Profile (PPP).
6541 	 *
6542 	 * mrq_ppp_profile_response:err is defined as:
6543 	 *
6544 	 * | Value	    | Description                                    |
6545 	 * |----------------|------------------------------------------------|
6546 	 * | 0		    | Success                                        |
6547 	 * | -#BPMP_ENOTSUP | #MRQ_PPP_PROFILE is not supported by BPMP-FW.  |
6548 	 * | -#BPMP_EINVAL  | Invalid request parameters.                    |
6549 	 */
6550 	CMD_PPP_PROFILE_QUERY_MASKS = 1,
6551 	/**
6552 	 * @brief Query BPMP for the CPU mask corresponding to a requested
6553 	 * number of active CPU cores.
6554 	 *
6555 	 * mrq_ppp_profile_response:err is defined as:
6556 	 *
6557 	 * | Value          | Description                                    |
6558 	 * |----------------|------------------------------------------------|
6559 	 * | 0              | Success                                        |
6560 	 * | -#BPMP_ENOTSUP | #MRQ_PPP_PROFILE is not supported by BPMP-FW.  |
6561 	 * | -#BPMP_EINVAL  | Invalid request parameters.                    |
6562 	 */
6563 	CMD_PPP_CORE_QUERY_CPU_MASK = 2,
6564 	/**
6565 	 * @brief Query BPMP-FW for the currently available Power/Performance Profiles.
6566 	 *
6567 	 * mrq_ppp_profile_response:err is defined as:
6568 	 *
6569 	 * | Value          | Description                                    |
6570 	 * |----------------|------------------------------------------------|
6571 	 * | 0              | Success                                        |
6572 	 * | -#BPMP_ENOTSUP | #MRQ_PPP_PROFILE is not supported by BPMP-FW.  |
6573 	 * | -#BPMP_EINVAL  | Invalid request parameters.                    |
6574 	 */
6575 	CMD_PPP_AVAILABLE_QUERY = 3,
6576 };
6577 
6578 /**
6579  * @brief Request data for #MRQ_PPP_PROFILE sub-command
6580  *        #CMD_PPP_PROFILE_QUERY_ABI
6581  */
6582 struct cmd_ppp_profile_query_abi_req {
6583 	/** @brief Sub-command identifier from @ref mrq_ppp_profile_cmd */
6584 	uint32_t cmd_code;
6585 } BPMP_ABI_PACKED;
6586 
6587 /**
6588  * @brief Response data for #MRQ_PPP_PROFILE sub-command
6589  *        #CMD_PPP_AVAILABLE_QUERY
6590  */
6591 struct cmd_ppp_available_query_resp {
6592 	/**
6593 	 * @brief Bitmask of available profiles.
6594 	 * Bit N = 1 ⇒ profile N is available
6595 	 */
6596 	uint32_t avail_ppp_mask;
6597 } BPMP_ABI_PACKED;
6598 
6599 /**
6600  * @brief Request data for #MRQ_PPP_PROFILE sub-command
6601  *        #CMD_PPP_PROFILE_QUERY_MASKS
6602  */
6603 struct cmd_ppp_profile_query_masks_req {
6604 	/** @brief power/perf profile identifier */
6605 	uint32_t profile_id;
6606 } BPMP_ABI_PACKED;
6607 
6608 /**
6609  * @brief Response payload for #MRQ_PPP_PROFILE sub-command
6610  *        #CMD_PPP_PROFILE_QUERY_MASKS
6611  */
6612 struct cmd_ppp_profile_query_masks_resp {
6613 	/** @brief Enabled cores in this profile */
6614 	uint32_t  num_active_cores;
6615 	/** @brief Enabled SLC slices in this profile */
6616 	uint32_t  num_active_slcs;
6617 	/** @brief Number of valid words in active_core_masks array */
6618 	uint32_t  max_num_core_words;
6619 	/** @brief Number of valid words in active_slc_masks array */
6620 	uint32_t  max_num_slc_words;
6621 	/** @brief Enabled cores bit mask (bit N = 1 => core N enabled) */
6622 	uint32_t  active_core_masks[8];
6623 	/** @brief Enabled SLC slices bit mask (bit N = 1 => SLC slice N enabled) */
6624 	uint32_t  active_slc_masks[8];
6625 } BPMP_ABI_PACKED;
6626 
6627 /**
6628  * @brief Request data for #MRQ_PPP_PROFILE sub-command
6629  *        #CMD_PPP_CORE_QUERY_CPU_MASK
6630  */
6631 struct cmd_ppp_core_query_cpu_mask_req {
6632 	/** @brief Requested number of active cores */
6633 	uint32_t num_cores;
6634 } BPMP_ABI_PACKED;
6635 
6636 /**
6637  * @brief Response data for #MRQ_PPP_PROFILE sub-command
6638  *        #CMD_PPP_CORE_QUERY_CPU_MASK
6639  */
6640 struct cmd_ppp_core_query_cpu_mask_resp {
6641 	/** @brief Number of valid words in active_core_masks array */
6642 	uint32_t max_num_words;
6643 	/** @brief Enabled CPU core bitmask (bit N = 1 ⇒ core N enabled) */
6644 	uint32_t active_core_masks[8];
6645 } BPMP_ABI_PACKED;
6646 
6647 /**
6648  * @brief Request payload for the #MRQ_PPP_PROFILE -command
6649  *
6650  * | Sub-command                   | Request payload                        |
6651  * |-------------------------------|----------------------------------------|
6652  * | #CMD_PPP_PROFILE_QUERY_ABI    | #cmd_ppp_profile_query_abi_req         |
6653  * | #CMD_PPP_PROFILE_QUERY_MASKS  | #cmd_ppp_profile_query_masks_req       |
6654  * | #CMD_PPP_CORE_QUERY_CPU_MASK  | #cmd_ppp_core_query_cpu_mask_req           |
6655  * | #CMD_PPP_AVAILABLE_QUERY      | -                                      |
6656  */
6657 struct mrq_ppp_profile_request {
6658 	/** @brief Sub-command ID from @ref mrq_ppp_profile_cmd. */
6659 	uint32_t cmd;
6660 	union {
6661 		struct cmd_ppp_profile_query_abi_req query_abi;
6662 		struct cmd_ppp_profile_query_masks_req ppp_profile_masks_req;
6663 		struct cmd_ppp_core_query_cpu_mask_req ppp_core_mask_req;
6664 	} BPMP_UNION_ANON;
6665 } BPMP_ABI_PACKED;
6666 
6667 /**
6668  * @brief Response payload for the #MRQ_PPP_PROFILE -command.
6669  *
6670  * | Sub-command                   | Response payload                       |
6671  * |-------------------------------|----------------------------------------|
6672  * | #CMD_PPP_PROFILE_QUERY_ABI    | -                                      |
6673  * | #CMD_PPP_PROFILE_QUERY_MASKS  | #cmd_ppp_profile_query_masks_resp      |
6674  * | #CMD_PPP_CORE_QUERY_CPU_MASK  | #cmd_ppp_core_query_cpu_mask_resp          |
6675  * | #CMD_PPP_AVAILABLE_QUERY      | #cmd_ppp_available_query_resp          |
6676  */
6677 struct mrq_ppp_profile_response {
6678 	uint32_t err;
6679 	union {
6680 		struct cmd_ppp_profile_query_masks_resp ppp_profile_masks_resp;
6681 		struct cmd_ppp_core_query_cpu_mask_resp ppp_core_mask_resp;
6682 		struct cmd_ppp_available_query_resp ppp_avail_query_resp;
6683 	} BPMP_UNION_ANON;
6684 } BPMP_ABI_PACKED;
6685 
6686 /** @} PPP */
6687 /** @endcond */
6688 
6689 /**
6690  * @addtogroup Error_Codes
6691  * Negative values for mrq_response::err generally indicate some
6692  * error. The ABI defines the following error codes. Negating these
6693  * defines is an exercise left to the user.
6694  * @{
6695  */
6696 
6697 /** @brief Operation not permitted */
6698 #define BPMP_EPERM	1
6699 /** @brief No such file or directory */
6700 #define BPMP_ENOENT	2
6701 /** @brief No MRQ handler */
6702 #define BPMP_ENOHANDLER	3
6703 /** @brief I/O error */
6704 #define BPMP_EIO	5
6705 /** @brief Bad sub-MRQ command */
6706 #define BPMP_EBADCMD	6
6707 /** @brief Resource temporarily unavailable */
6708 #define BPMP_EAGAIN	11
6709 /** @brief Not enough memory */
6710 #define BPMP_ENOMEM	12
6711 /** @brief Permission denied */
6712 #define BPMP_EACCES	13
6713 /** @brief Bad address */
6714 #define BPMP_EFAULT	14
6715 /** @brief Resource busy */
6716 #define BPMP_EBUSY	16
6717 /** @brief No such device */
6718 #define BPMP_ENODEV	19
6719 /** @brief Argument is a directory */
6720 #define BPMP_EISDIR	21
6721 /** @brief Invalid argument */
6722 #define BPMP_EINVAL	22
6723 /** @brief Timeout during operation */
6724 #define BPMP_ETIMEDOUT  23
6725 /** @brief Out of range */
6726 #define BPMP_ERANGE	34
6727 /** @brief Function not implemented */
6728 #define BPMP_ENOSYS	38
6729 /** @brief Invalid slot */
6730 #define BPMP_EBADSLT	57
6731 /** @brief No data */
6732 #define BPMP_ENODATA	61
6733 /** @brief Invalid message */
6734 #define BPMP_EBADMSG	77
6735 /** @brief Operation not supported */
6736 #define BPMP_EOPNOTSUPP 95
6737 /** @brief Targeted resource not available */
6738 #define BPMP_ENAVAIL	119
6739 /** @brief Not supported */
6740 #define BPMP_ENOTSUP	134
6741 /** @brief No such device or address */
6742 #define BPMP_ENXIO	140
6743 
6744 /** @} Error_Codes */
6745 
6746 #if defined(BPMP_ABI_CHECKS)
6747 #include "bpmp_abi_checks.h"
6748 #endif
6749 
6750 #endif
6751