blob: 373da526ed6dce035679a803d7183103fc8f8c9c [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0 */
Stephen Warrena2148922016-08-08 09:41:34 -06002/*
3 * Copyright (c) 2014-2016, NVIDIA CORPORATION.
Stephen Warrena2148922016-08-08 09:41:34 -06004 */
5
6#ifndef _ABI_BPMP_ABI_H_
7#define _ABI_BPMP_ABI_H_
8
9#ifdef LK
10#include <stdint.h>
11#endif
12
13#ifndef __ABI_PACKED
14#define __ABI_PACKED __attribute__((packed))
15#endif
16
17#ifdef NO_GCC_EXTENSIONS
18#define EMPTY char empty;
19#define EMPTY_ARRAY 1
20#else
21#define EMPTY
22#define EMPTY_ARRAY 0
23#endif
24
25#ifndef __UNION_ANON
26#define __UNION_ANON
27#endif
28/**
29 * @file
30 */
31
32
33/**
34 * @defgroup MRQ MRQ Messages
35 * @brief Messages sent to/from BPMP via IPC
36 * @{
37 * @defgroup MRQ_Format Message Format
38 * @defgroup MRQ_Codes Message Request (MRQ) Codes
39 * @defgroup MRQ_Payloads Message Payloads
40 * @defgroup Error_Codes Error Codes
41 * @}
42 */
43
44/**
45 * @addtogroup MRQ_Format Message Format
46 * @{
47 * The CPU requests the BPMP to perform a particular service by
48 * sending it an IVC frame containing a single MRQ message. An MRQ
49 * message consists of a @ref mrq_request followed by a payload whose
50 * format depends on mrq_request::mrq.
51 *
52 * The BPMP processes the data and replies with an IVC frame (on the
53 * same IVC channel) containing and MRQ response. An MRQ response
54 * consists of a @ref mrq_response followed by a payload whose format
55 * depends on the associated mrq_request::mrq.
56 *
57 * A well-defined subset of the MRQ messages that the CPU sends to the
58 * BPMP can lead to BPMP eventually sending an MRQ message to the
59 * CPU. For example, when the CPU uses an #MRQ_THERMAL message to set
60 * a thermal trip point, the BPMP may eventually send a single
61 * #MRQ_THERMAL message of its own to the CPU indicating that the trip
62 * point has been crossed.
63 * @}
64 */
65
66/**
67 * @ingroup MRQ_Format
68 * @brief header for an MRQ message
69 *
70 * Provides the MRQ number for the MRQ message: #mrq. The remainder of
71 * the MRQ message is a payload (immediately following the
72 * mrq_request) whose format depends on mrq.
73 *
74 * @todo document the flags
75 */
76struct mrq_request {
77 /** @brief MRQ number of the request */
78 uint32_t mrq;
79 /** @brief flags for the request */
80 uint32_t flags;
81} __ABI_PACKED;
82
83/**
84 * @ingroup MRQ_Format
85 * @brief header for an MRQ response
86 *
87 * Provides an error code for the associated MRQ message. The
88 * remainder of the MRQ response is a payload (immediately following
89 * the mrq_response) whose format depends on the associated
90 * mrq_request::mrq
91 *
92 * @todo document the flags
93 */
94struct mrq_response {
95 /** @brief error code for the MRQ request itself */
96 int32_t err;
97 /** @brief flags for the response */
98 uint32_t flags;
99} __ABI_PACKED;
100
101/**
102 * @ingroup MRQ_Format
103 * Minimum needed size for an IPC message buffer
104 */
105#define MSG_MIN_SZ 128
106/**
107 * @ingroup MRQ_Format
108 * Minimum size guaranteed for data in an IPC message buffer
109 */
110#define MSG_DATA_MIN_SZ 120
111
112/**
113 * @ingroup MRQ_Codes
114 * @name Legal MRQ codes
115 * These are the legal values for mrq_request::mrq
116 * @{
117 */
118
119#define MRQ_PING 0
120#define MRQ_QUERY_TAG 1
121#define MRQ_MODULE_LOAD 4
122#define MRQ_MODULE_UNLOAD 5
123#define MRQ_TRACE_MODIFY 7
124#define MRQ_WRITE_TRACE 8
125#define MRQ_THREADED_PING 9
126#define MRQ_MODULE_MAIL 11
127#define MRQ_DEBUGFS 19
128#define MRQ_RESET 20
129#define MRQ_I2C 21
130#define MRQ_CLK 22
131#define MRQ_QUERY_ABI 23
132#define MRQ_PG_READ_STATE 25
133#define MRQ_PG_UPDATE_STATE 26
134#define MRQ_THERMAL 27
135#define MRQ_CPU_VHINT 28
136#define MRQ_ABI_RATCHET 29
137#define MRQ_EMC_DVFS_LATENCY 31
138#define MRQ_TRACE_ITER 64
139
140/** @} */
141
142/**
143 * @ingroup MRQ_Codes
144 * @brief Maximum MRQ code to be sent by CPU software to
145 * BPMP. Subject to change in future
146 */
147#define MAX_CPU_MRQ_ID 64
148
149/**
150 * @addtogroup MRQ_Payloads Message Payloads
151 * @{
152 * @defgroup Ping
153 * @defgroup Query_Tag Query Tag
154 * @defgroup Module Loadable Modules
155 * @defgroup Trace
156 * @defgroup Debugfs
157 * @defgroup Reset
158 * @defgroup I2C
159 * @defgroup Clocks
160 * @defgroup ABI_info ABI Info
161 * @defgroup MC_Flush MC Flush
162 * @defgroup Powergating
163 * @defgroup Thermal
164 * @defgroup Vhint CPU Voltage hint
165 * @defgroup MRQ_Deprecated Deprecated MRQ messages
166 * @defgroup EMC
167 * @}
168 */
169
170
171/**
172 * @ingroup MRQ_Codes
173 * @def MRQ_PING
174 * @brief A simple ping
175 *
176 * * Platforms: All
177 * * Initiators: Any
178 * * Targets: Any
179 * * Request Payload: @ref mrq_ping_request
180 * * Response Payload: @ref mrq_ping_response
181 *
182 * @ingroup MRQ_Codes
183 * @def MRQ_THREADED_PING
184 * @brief A deeper ping
185 *
186 * * Platforms: All
187 * * Initiators: Any
188 * * Targets: BPMP
189 * * Request Payload: @ref mrq_ping_request
190 * * Response Payload: @ref mrq_ping_response
191 *
192 * Behavior is equivalent to a simple #MRQ_PING except that BPMP
193 * responds from a thread context (providing a slightly more robust
194 * sign of life).
195 *
196 */
197
198/**
199 * @ingroup Ping
200 * @brief request with #MRQ_PING
201 *
202 * Used by the sender of an #MRQ_PING message to request a pong from
203 * recipient. The response from the recipient is computed based on
204 * #challenge.
205 */
206struct mrq_ping_request {
207/** @brief arbitrarily chosen value */
208 uint32_t challenge;
209} __ABI_PACKED;
210
211/**
212 * @ingroup Ping
213 * @brief response to #MRQ_PING
214 *
215 * Sent in response to an #MRQ_PING message. #reply should be the
216 * mrq_ping_request challenge left shifted by 1 with the carry-bit
217 * dropped.
218 *
219 */
220struct mrq_ping_response {
221 /** @brief response to the MRQ_PING challege */
222 uint32_t reply;
223} __ABI_PACKED;
224
225/**
226 * @ingroup MRQ_Codes
227 * @def MRQ_QUERY_TAG
228 * @brief Query BPMP firmware's tag (i.e. version information)
229 *
230 * * Platforms: All
231 * * Initiators: CCPLEX
232 * * Targets: BPMP
233 * * Request Payload: @ref mrq_query_tag_request
234 * * Response Payload: N/A
235 *
236 */
237
238/**
239 * @ingroup Query_Tag
240 * @brief request with #MRQ_QUERY_TAG
241 *
242 * Used by #MRQ_QUERY_TAG call to ask BPMP to fill in the memory
243 * pointed by #addr with BPMP firmware header.
244 *
245 * The sender is reponsible for ensuring that #addr is mapped in to
246 * the recipient's address map.
247 */
248struct mrq_query_tag_request {
249 /** @brief base address to store the firmware header */
250 uint32_t addr;
251} __ABI_PACKED;
252
253/**
254 * @ingroup MRQ_Codes
255 * @def MRQ_MODULE_LOAD
256 * @brief dynamically load a BPMP code module
257 *
258 * * Platforms: All
259 * * Initiators: CCPLEX
260 * * Targets: BPMP
261 * * Request Payload: @ref mrq_module_load_request
262 * * Response Payload: @ref mrq_module_load_response
263 *
264 * @note This MRQ is disabled on production systems
265 *
266 */
267
268/**
269 * @ingroup Module
270 * @brief request with #MRQ_MODULE_LOAD
271 *
272 * Used by #MRQ_MODULE_LOAD calls to ask the recipient to dynamically
273 * load the code located at #phys_addr and having size #size
274 * bytes. #phys_addr is treated as a void pointer.
275 *
276 * The recipient copies the code from #phys_addr to locally allocated
277 * memory prior to responding to this message.
278 *
279 * @todo document the module header format
280 *
281 * The sender is responsible for ensuring that the code is mapped in
282 * the recipient's address map.
283 *
284 */
285struct mrq_module_load_request {
286 /** @brief base address of the code to load. Treated as (void *) */
287 uint32_t phys_addr; /* (void *) */
288 /** @brief size in bytes of code to load */
289 uint32_t size;
290} __ABI_PACKED;
291
292/**
293 * @ingroup Module
294 * @brief response to #MRQ_MODULE_LOAD
295 *
296 * @todo document mrq_response::err
297 */
298struct mrq_module_load_response {
299 /** @brief handle to the loaded module */
300 uint32_t base;
301} __ABI_PACKED;
302
303/**
304 * @ingroup MRQ_Codes
305 * @def MRQ_MODULE_UNLOAD
306 * @brief unload a previously loaded code module
307 *
308 * * Platforms: All
309 * * Initiators: CCPLEX
310 * * Targets: BPMP
311 * * Request Payload: @ref mrq_module_unload_request
312 * * Response Payload: N/A
313 *
314 * @note This MRQ is disabled on production systems
315 */
316
317/**
318 * @ingroup Module
319 * @brief request with #MRQ_MODULE_UNLOAD
320 *
321 * Used by #MRQ_MODULE_UNLOAD calls to request that a previously loaded
322 * module be unloaded.
323 */
324struct mrq_module_unload_request {
325 /** @brief handle of the module to unload */
326 uint32_t base;
327} __ABI_PACKED;
328
329/**
330 * @ingroup MRQ_Codes
331 * @def MRQ_TRACE_MODIFY
332 * @brief modify the set of enabled trace events
333 *
334 * * Platforms: All
335 * * Initiators: CCPLEX
336 * * Targets: BPMP
337 * * Request Payload: @ref mrq_trace_modify_request
338 * * Response Payload: @ref mrq_trace_modify_response
339 *
340 * @note This MRQ is disabled on production systems
341 */
342
343/**
344 * @ingroup Trace
345 * @brief request with #MRQ_TRACE_MODIFY
346 *
347 * Used by %MRQ_TRACE_MODIFY calls to enable or disable specify trace
348 * events. #set takes precedence for any bit set in both #set and
349 * #clr.
350 */
351struct mrq_trace_modify_request {
352 /** @brief bit mask of trace events to disable */
353 uint32_t clr;
354 /** @brief bit mask of trace events to enable */
355 uint32_t set;
356} __ABI_PACKED;
357
358/**
359 * @ingroup Trace
360 * @brief response to #MRQ_TRACE_MODIFY
361 *
362 * Sent in repsonse to an #MRQ_TRACE_MODIFY message. #mask reflects the
363 * state of which events are enabled after the recipient acted on the
364 * message.
365 *
366 */
367struct mrq_trace_modify_response {
368 /** @brief bit mask of trace event enable states */
369 uint32_t mask;
370} __ABI_PACKED;
371
372/**
373 * @ingroup MRQ_Codes
374 * @def MRQ_WRITE_TRACE
375 * @brief Write trace data to a buffer
376 *
377 * * Platforms: All
378 * * Initiators: CCPLEX
379 * * Targets: BPMP
380 * * Request Payload: @ref mrq_write_trace_request
381 * * Response Payload: @ref mrq_write_trace_response
382 *
383 * mrq_response::err depends on the @ref mrq_write_trace_request field
384 * values. err is -#BPMP_EINVAL if size is zero or area is NULL or
385 * area is in an illegal range. A positive value for err indicates the
386 * number of bytes written to area.
387 *
388 * @note This MRQ is disabled on production systems
389 */
390
391/**
392 * @ingroup Trace
393 * @brief request with #MRQ_WRITE_TRACE
394 *
395 * Used by MRQ_WRITE_TRACE calls to ask the recipient to copy trace
396 * data from the recipient's local buffer to the output buffer. #area
397 * is treated as a byte-aligned pointer in the recipient's address
398 * space.
399 *
400 * The sender is responsible for ensuring that the output
401 * buffer is mapped in the recipient's address map. The recipient is
402 * responsible for protecting its own code and data from accidental
403 * overwrites.
404 */
405struct mrq_write_trace_request {
406 /** @brief base address of output buffer */
407 uint32_t area;
408 /** @brief size in bytes of the output buffer */
409 uint32_t size;
410} __ABI_PACKED;
411
412/**
413 * @ingroup Trace
414 * @brief response to #MRQ_WRITE_TRACE
415 *
416 * Once this response is sent, the respondent will not access the
417 * output buffer further.
418 */
419struct mrq_write_trace_response {
420 /**
421 * @brief flag whether more data remains in local buffer
422 *
423 * Value is 1 if the entire local trace buffer has been
424 * drained to the outputbuffer. Value is 0 otherwise.
425 */
426 uint32_t eof;
427} __ABI_PACKED;
428
429/** @private */
430struct mrq_threaded_ping_request {
431 uint32_t challenge;
432} __ABI_PACKED;
433
434/** @private */
435struct mrq_threaded_ping_response {
436 uint32_t reply;
437} __ABI_PACKED;
438
439/**
440 * @ingroup MRQ_Codes
441 * @def MRQ_MODULE_MAIL
442 * @brief send a message to a loadable module
443 *
444 * * Platforms: All
445 * * Initiators: Any
446 * * Targets: BPMP
447 * * Request Payload: @ref mrq_module_mail_request
448 * * Response Payload: @ref mrq_module_mail_response
449 *
450 * @note This MRQ is disabled on production systems
451 */
452
453/**
454 * @ingroup Module
455 * @brief request with #MRQ_MODULE_MAIL
456 */
457struct mrq_module_mail_request {
458 /** @brief handle to the previously loaded module */
459 uint32_t base;
460 /** @brief module-specific mail payload
461 *
462 * The length of data[ ] is unknown to the BPMP core firmware
463 * but it is limited to the size of an IPC message.
464 */
465 uint8_t data[EMPTY_ARRAY];
466} __ABI_PACKED;
467
468/**
469 * @ingroup Module
470 * @brief response to #MRQ_MODULE_MAIL
471 */
472struct mrq_module_mail_response {
473 /** @brief module-specific mail payload
474 *
475 * The length of data[ ] is unknown to the BPMP core firmware
476 * but it is limited to the size of an IPC message.
477 */
478 uint8_t data[EMPTY_ARRAY];
479} __ABI_PACKED;
480
481/**
482 * @ingroup MRQ_Codes
483 * @def MRQ_DEBUGFS
484 * @brief Interact with BPMP's debugfs file nodes
485 *
486 * * Platforms: T186
487 * * Initiators: Any
488 * * Targets: BPMP
489 * * Request Payload: @ref mrq_debugfs_request
490 * * Response Payload: @ref mrq_debugfs_response
491 */
492
493/**
494 * @addtogroup Debugfs
495 * @{
496 *
497 * The BPMP firmware implements a pseudo-filesystem called
498 * debugfs. Any driver within the firmware may register with debugfs
499 * to expose an arbitrary set of "files" in the filesystem. When
500 * software on the CPU writes to a debugfs file, debugfs passes the
501 * written data to a callback provided by the driver. When software on
502 * the CPU reads a debugfs file, debugfs queries the driver for the
503 * data to return to the CPU. The intention of the debugfs filesystem
504 * is to provide information useful for debugging the system at
505 * runtime.
506 *
507 * @note The files exposed via debugfs are not part of the
508 * BPMP firmware's ABI. debugfs files may be added or removed in any
509 * given version of the firmware. Typically the semantics of a debugfs
510 * file are consistent from version to version but even that is not
511 * guaranteed.
512 *
513 * @}
514 */
515/** @ingroup Debugfs */
516enum mrq_debugfs_commands {
517 CMD_DEBUGFS_READ = 1,
518 CMD_DEBUGFS_WRITE = 2,
519 CMD_DEBUGFS_DUMPDIR = 3,
520 CMD_DEBUGFS_MAX
521};
522
523/**
524 * @ingroup Debugfs
525 * @brief parameters for CMD_DEBUGFS_READ/WRITE command
526 */
527struct cmd_debugfs_fileop_request {
528 /** @brief physical address pointing at filename */
529 uint32_t fnameaddr;
530 /** @brief length in bytes of filename buffer */
531 uint32_t fnamelen;
532 /** @brief physical address pointing to data buffer */
533 uint32_t dataaddr;
534 /** @brief length in bytes of data buffer */
535 uint32_t datalen;
536} __ABI_PACKED;
537
538/**
539 * @ingroup Debugfs
540 * @brief parameters for CMD_DEBUGFS_READ/WRITE command
541 */
542struct cmd_debugfs_dumpdir_request {
543 /** @brief physical address pointing to data buffer */
544 uint32_t dataaddr;
545 /** @brief length in bytes of data buffer */
546 uint32_t datalen;
547} __ABI_PACKED;
548
549/**
550 * @ingroup Debugfs
551 * @brief response data for CMD_DEBUGFS_READ/WRITE command
552 */
553struct cmd_debugfs_fileop_response {
554 /** @brief always 0 */
555 uint32_t reserved;
556 /** @brief number of bytes read from or written to data buffer */
557 uint32_t nbytes;
558} __ABI_PACKED;
559
560/**
561 * @ingroup Debugfs
562 * @brief response data for CMD_DEBUGFS_DUMPDIR command
563 */
564struct cmd_debugfs_dumpdir_response {
565 /** @brief always 0 */
566 uint32_t reserved;
567 /** @brief number of bytes read from or written to data buffer */
568 uint32_t nbytes;
569} __ABI_PACKED;
570
571/**
572 * @ingroup Debugfs
573 * @brief request with #MRQ_DEBUGFS.
574 *
575 * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs
576 * command to execute. Legal commands are the values of @ref
577 * mrq_debugfs_commands. Each command requires a specific additional
578 * payload of data.
579 *
580 * |command |payload|
581 * |-------------------|-------|
582 * |CMD_DEBUGFS_READ |fop |
583 * |CMD_DEBUGFS_WRITE |fop |
584 * |CMD_DEBUGFS_DUMPDIR|dumpdir|
585 */
586struct mrq_debugfs_request {
587 uint32_t cmd;
588 union {
589 struct cmd_debugfs_fileop_request fop;
590 struct cmd_debugfs_dumpdir_request dumpdir;
591 } __UNION_ANON;
592} __ABI_PACKED;
593
594/**
595 * @ingroup Debugfs
596 */
597struct mrq_debugfs_response {
598 /** @brief always 0 */
599 int32_t reserved;
600 union {
601 /** @brief response data for CMD_DEBUGFS_READ OR
602 * CMD_DEBUGFS_WRITE command
603 */
604 struct cmd_debugfs_fileop_response fop;
605 /** @brief response data for CMD_DEBUGFS_DUMPDIR command */
606 struct cmd_debugfs_dumpdir_response dumpdir;
607 } __UNION_ANON;
608} __ABI_PACKED;
609
610/**
611 * @addtogroup Debugfs
612 * @{
613 */
614#define DEBUGFS_S_ISDIR (1 << 9)
615#define DEBUGFS_S_IRUSR (1 << 8)
616#define DEBUGFS_S_IWUSR (1 << 7)
617/** @} */
618
619
620/**
621 * @ingroup MRQ_Codes
622 * @def MRQ_RESET
623 * @brief reset an IP block
624 *
625 * * Platforms: T186
626 * * Initiators: Any
627 * * Targets: BPMP
628 * * Request Payload: @ref mrq_reset_request
629 * * Response Payload: N/A
630 */
631
632/**
633 * @ingroup Reset
634 */
635enum mrq_reset_commands {
636 CMD_RESET_ASSERT = 1,
637 CMD_RESET_DEASSERT = 2,
638 CMD_RESET_MODULE = 3,
639 CMD_RESET_MAX, /* not part of ABI and subject to change */
640};
641
642/**
643 * @ingroup Reset
644 * @brief request with MRQ_RESET
645 *
646 * Used by the sender of an #MRQ_RESET message to request BPMP to
647 * assert or or deassert a given reset line.
648 */
649struct mrq_reset_request {
650 /** @brief reset action to perform (@enum mrq_reset_commands) */
651 uint32_t cmd;
652 /** @brief id of the reset to affected */
653 uint32_t reset_id;
654} __ABI_PACKED;
655
656/**
657 * @ingroup MRQ_Codes
658 * @def MRQ_I2C
659 * @brief issue an i2c transaction
660 *
661 * * Platforms: T186
662 * * Initiators: Any
663 * * Targets: BPMP
664 * * Request Payload: @ref mrq_i2c_request
665 * * Response Payload: @ref mrq_i2c_response
666 */
667
668/**
669 * @addtogroup I2C
670 * @{
671 */
672#define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE (MSG_DATA_MIN_SZ - 12)
673#define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE (MSG_DATA_MIN_SZ - 4)
674/** @} */
675
676/**
677 * @ingroup I2C
678 * @name Serial I2C flags
679 * Use these flags with serial_i2c_request::flags
680 * @{
681 */
682#define SERIALI2C_TEN 0x0010
683#define SERIALI2C_RD 0x0001
684#define SERIALI2C_STOP 0x8000
685#define SERIALI2C_NOSTART 0x4000
686#define SERIALI2C_REV_DIR_ADDR 0x2000
687#define SERIALI2C_IGNORE_NAK 0x1000
688#define SERIALI2C_NO_RD_ACK 0x0800
689#define SERIALI2C_RECV_LEN 0x0400
690/** @} */
691/** @ingroup I2C */
692enum {
693 CMD_I2C_XFER = 1
694};
695
696/**
697 * @ingroup I2C
698 * @brief serializable i2c request
699 *
700 * Instances of this structure are packed (little-endian) into
701 * cmd_i2c_xfer_request::data_buf. Each instance represents a single
702 * transaction (or a portion of a transaction with repeated starts) on
703 * an i2c bus.
704 *
705 * Because these structures are packed, some instances are likely to
706 * be misaligned. Additionally because #data is variable length, it is
707 * not possible to iterate through a serialized list of these
708 * structures without inspecting #len in each instance. It may be
709 * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf
710 * manually rather than using this structure definition.
711*/
712struct serial_i2c_request {
713 /** @brief I2C slave address */
714 uint16_t addr;
715 /** @brief bitmask of SERIALI2C_ flags */
716 uint16_t flags;
717 /** @brief length of I2C transaction in bytes */
718 uint16_t len;
719 /** @brief for write transactions only, #len bytes of data */
720 uint8_t data[];
721} __ABI_PACKED;
722
723/**
724 * @ingroup I2C
725 * @brief trigger one or more i2c transactions
726 */
727struct cmd_i2c_xfer_request {
728 /** @brief valid bus number from mach-t186/i2c-t186.h*/
729 uint32_t bus_id;
730
731 /** @brief count of valid bytes in #data_buf*/
732 uint32_t data_size;
733
734 /** @brief serialized packed instances of @ref serial_i2c_request*/
735 uint8_t data_buf[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE];
736} __ABI_PACKED;
737
738/**
739 * @ingroup I2C
740 * @brief container for data read from the i2c bus
741 *
742 * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute
743 * zero or more I2C reads. The data read from the bus is serialized
744 * into #data_buf.
745 */
746struct cmd_i2c_xfer_response {
747 /** @brief count of valid bytes in #data_buf*/
748 uint32_t data_size;
749 /** @brief i2c read data */
750 uint8_t data_buf[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE];
751} __ABI_PACKED;
752
753/**
754 * @ingroup I2C
755 * @brief request with #MRQ_I2C
756 */
757struct mrq_i2c_request {
758 /** @brief always CMD_I2C_XFER (i.e. 1) */
759 uint32_t cmd;
760 /** @brief parameters of the transfer request */
761 struct cmd_i2c_xfer_request xfer;
762} __ABI_PACKED;
763
764/**
765 * @ingroup I2C
766 * @brief response to #MRQ_I2C
767 */
768struct mrq_i2c_response {
769 struct cmd_i2c_xfer_response xfer;
770} __ABI_PACKED;
771
772/**
773 * @ingroup MRQ_Codes
774 * @def MRQ_CLK
775 *
776 * * Platforms: T186
777 * * Initiators: Any
778 * * Targets: BPMP
779 * * Request Payload: @ref mrq_clk_request
780 * * Response Payload: @ref mrq_clk_response
781 * @addtogroup Clocks
782 * @{
783 */
784
785/**
786 * @name MRQ_CLK sub-commands
787 * @{
788 */
789enum {
790 CMD_CLK_GET_RATE = 1,
791 CMD_CLK_SET_RATE = 2,
792 CMD_CLK_ROUND_RATE = 3,
793 CMD_CLK_GET_PARENT = 4,
794 CMD_CLK_SET_PARENT = 5,
795 CMD_CLK_IS_ENABLED = 6,
796 CMD_CLK_ENABLE = 7,
797 CMD_CLK_DISABLE = 8,
798 CMD_CLK_GET_ALL_INFO = 14,
799 CMD_CLK_GET_MAX_CLK_ID = 15,
800 CMD_CLK_MAX,
801};
802/** @} */
803
804#define MRQ_CLK_NAME_MAXLEN 40
805#define MRQ_CLK_MAX_PARENTS 16
806
807/** @private */
808struct cmd_clk_get_rate_request {
809 EMPTY
810} __ABI_PACKED;
811
812struct cmd_clk_get_rate_response {
813 int64_t rate;
814} __ABI_PACKED;
815
816struct cmd_clk_set_rate_request {
817 int32_t unused;
818 int64_t rate;
819} __ABI_PACKED;
820
821struct cmd_clk_set_rate_response {
822 int64_t rate;
823} __ABI_PACKED;
824
825struct cmd_clk_round_rate_request {
826 int32_t unused;
827 int64_t rate;
828} __ABI_PACKED;
829
830struct cmd_clk_round_rate_response {
831 int64_t rate;
832} __ABI_PACKED;
833
834/** @private */
835struct cmd_clk_get_parent_request {
836 EMPTY
837} __ABI_PACKED;
838
839struct cmd_clk_get_parent_response {
840 uint32_t parent_id;
841} __ABI_PACKED;
842
843struct cmd_clk_set_parent_request {
844 uint32_t parent_id;
845} __ABI_PACKED;
846
847struct cmd_clk_set_parent_response {
848 uint32_t parent_id;
849} __ABI_PACKED;
850
851/** @private */
852struct cmd_clk_is_enabled_request {
853 EMPTY
854} __ABI_PACKED;
855
856struct cmd_clk_is_enabled_response {
857 int32_t state;
858} __ABI_PACKED;
859
860/** @private */
861struct cmd_clk_enable_request {
862 EMPTY
863} __ABI_PACKED;
864
865/** @private */
866struct cmd_clk_enable_response {
867 EMPTY
868} __ABI_PACKED;
869
870/** @private */
871struct cmd_clk_disable_request {
872 EMPTY
873} __ABI_PACKED;
874
875/** @private */
876struct cmd_clk_disable_response {
877 EMPTY
878} __ABI_PACKED;
879
880/** @private */
881struct cmd_clk_get_all_info_request {
882 EMPTY
883} __ABI_PACKED;
884
885struct cmd_clk_get_all_info_response {
886 uint32_t flags;
887 uint32_t parent;
888 uint32_t parents[MRQ_CLK_MAX_PARENTS];
889 uint8_t num_parents;
890 uint8_t name[MRQ_CLK_NAME_MAXLEN];
891} __ABI_PACKED;
892
893/** @private */
894struct cmd_clk_get_max_clk_id_request {
895 EMPTY
896} __ABI_PACKED;
897
898struct cmd_clk_get_max_clk_id_response {
899 uint32_t max_id;
900} __ABI_PACKED;
901/** @} */
902
903/**
904 * @ingroup Clocks
905 * @brief request with #MRQ_CLK
906 *
907 * Used by the sender of an #MRQ_CLK message to control clocks. The
908 * clk_request is split into several sub-commands. Some sub-commands
909 * require no additional data. Others have a sub-command specific
910 * payload
911 *
912 * |sub-command |payload |
913 * |----------------------------|-----------------------|
914 * |CMD_CLK_GET_RATE |- |
915 * |CMD_CLK_SET_RATE |clk_set_rate |
916 * |CMD_CLK_ROUND_RATE |clk_round_rate |
917 * |CMD_CLK_GET_PARENT |- |
918 * |CMD_CLK_SET_PARENT |clk_set_parent |
919 * |CMD_CLK_IS_ENABLED |- |
920 * |CMD_CLK_ENABLE |- |
921 * |CMD_CLK_DISABLE |- |
922 * |CMD_CLK_GET_ALL_INFO |- |
923 * |CMD_CLK_GET_MAX_CLK_ID |- |
924 *
925 */
926
927struct mrq_clk_request {
928 /** @brief sub-command and clock id concatenated to 32-bit word.
929 * - bits[31..24] is the sub-cmd.
930 * - bits[23..0] is the clock id
931 */
932 uint32_t cmd_and_id;
933
934 union {
935 /** @private */
936 struct cmd_clk_get_rate_request clk_get_rate;
937 struct cmd_clk_set_rate_request clk_set_rate;
938 struct cmd_clk_round_rate_request clk_round_rate;
939 /** @private */
940 struct cmd_clk_get_parent_request clk_get_parent;
941 struct cmd_clk_set_parent_request clk_set_parent;
942 /** @private */
943 struct cmd_clk_enable_request clk_enable;
944 /** @private */
945 struct cmd_clk_disable_request clk_disable;
946 /** @private */
947 struct cmd_clk_is_enabled_request clk_is_enabled;
948 /** @private */
949 struct cmd_clk_get_all_info_request clk_get_all_info;
950 /** @private */
951 struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id;
952 } __UNION_ANON;
953} __ABI_PACKED;
954
955/**
956 * @ingroup Clocks
957 * @brief response to MRQ_CLK
958 *
959 * Each sub-command supported by @ref mrq_clk_request may return
960 * sub-command-specific data. Some do and some do not as indicated in
961 * the following table
962 *
963 * |sub-command |payload |
964 * |----------------------------|------------------------|
965 * |CMD_CLK_GET_RATE |clk_get_rate |
966 * |CMD_CLK_SET_RATE |clk_set_rate |
967 * |CMD_CLK_ROUND_RATE |clk_round_rate |
968 * |CMD_CLK_GET_PARENT |clk_get_parent |
969 * |CMD_CLK_SET_PARENT |clk_set_parent |
970 * |CMD_CLK_IS_ENABLED |clk_is_enabled |
971 * |CMD_CLK_ENABLE |- |
972 * |CMD_CLK_DISABLE |- |
973 * |CMD_CLK_GET_ALL_INFO |clk_get_all_info |
974 * |CMD_CLK_GET_MAX_CLK_ID |clk_get_max_id |
975 *
976 */
977
978struct mrq_clk_response {
979 union {
980 struct cmd_clk_get_rate_response clk_get_rate;
981 struct cmd_clk_set_rate_response clk_set_rate;
982 struct cmd_clk_round_rate_response clk_round_rate;
983 struct cmd_clk_get_parent_response clk_get_parent;
984 struct cmd_clk_set_parent_response clk_set_parent;
985 /** @private */
986 struct cmd_clk_enable_response clk_enable;
987 /** @private */
988 struct cmd_clk_disable_response clk_disable;
989 struct cmd_clk_is_enabled_response clk_is_enabled;
990 struct cmd_clk_get_all_info_response clk_get_all_info;
991 struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id;
992 } __UNION_ANON;
993} __ABI_PACKED;
994
995/**
996 * @ingroup MRQ_Codes
997 * @def MRQ_QUERY_ABI
998 * @brief check if an MRQ is implemented
999 *
1000 * * Platforms: All
1001 * * Initiators: Any
1002 * * Targets: Any
1003 * * Request Payload: @ref mrq_query_abi_request
1004 * * Response Payload: @ref mrq_query_abi_response
1005 */
1006
1007/**
1008 * @ingroup ABI_info
1009 * @brief request with MRQ_QUERY_ABI
1010 *
1011 * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported
1012 * by the recipient.
1013 */
1014struct mrq_query_abi_request {
1015 /** @brief MRQ code to query */
1016 uint32_t mrq;
1017} __ABI_PACKED;
1018
1019/**
1020 * @ingroup ABI_info
1021 * @brief response to MRQ_QUERY_ABI
1022 */
1023struct mrq_query_abi_response {
1024 /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */
1025 int32_t status;
1026} __ABI_PACKED;
1027
1028/**
1029 * @ingroup MRQ_Codes
1030 * @def MRQ_PG_READ_STATE
1031 * @brief read the power-gating state of a partition
1032 *
1033 * * Platforms: T186
1034 * * Initiators: Any
1035 * * Targets: BPMP
1036 * * Request Payload: @ref mrq_pg_read_state_request
1037 * * Response Payload: @ref mrq_pg_read_state_response
1038 * @addtogroup Powergating
1039 * @{
1040 */
1041
1042/**
1043 * @brief request with #MRQ_PG_READ_STATE
1044 *
1045 * Used by MRQ_PG_READ_STATE call to read the current state of a
1046 * partition.
1047 */
1048struct mrq_pg_read_state_request {
1049 /** @brief ID of partition */
1050 uint32_t partition_id;
1051} __ABI_PACKED;
1052
1053/**
1054 * @brief response to MRQ_PG_READ_STATE
1055 * @todo define possible errors.
1056 */
1057struct mrq_pg_read_state_response {
1058 /** @brief read as don't care */
1059 uint32_t sram_state;
1060 /** @brief state of power partition
1061 * * 0 : off
1062 * * 1 : on
1063 */
1064 uint32_t logic_state;
1065} __ABI_PACKED;
1066
1067/** @} */
1068
1069/**
1070 * @ingroup MRQ_Codes
1071 * @def MRQ_PG_UPDATE_STATE
1072 * @brief modify the power-gating state of a partition
1073 *
1074 * * Platforms: T186
1075 * * Initiators: Any
1076 * * Targets: BPMP
1077 * * Request Payload: @ref mrq_pg_update_state_request
1078 * * Response Payload: N/A
1079 * @addtogroup Powergating
1080 * @{
1081 */
1082
1083/**
1084 * @brief request with mrq_pg_update_state_request
1085 *
1086 * Used by #MRQ_PG_UPDATE_STATE call to request BPMP to change the
1087 * state of a power partition #partition_id.
1088 */
1089struct mrq_pg_update_state_request {
1090 /** @brief ID of partition */
1091 uint32_t partition_id;
1092 /** @brief secondary control of power partition
1093 * @details Ignored by many versions of the BPMP
1094 * firmware. For maximum compatibility, set the value
1095 * according to @logic_state
1096 * * 0x1: power ON partition (@ref logic_state == 0x3)
1097 * * 0x3: power OFF partition (@ref logic_state == 0x1)
1098 */
1099 uint32_t sram_state;
1100 /** @brief controls state of power partition, legal values are
1101 * * 0x1 : power OFF partition
1102 * * 0x3 : power ON partition
1103 */
1104 uint32_t logic_state;
1105 /** @brief change state of clocks of the power partition, legal values
1106 * * 0x0 : do not change clock state
1107 * * 0x1 : disable partition clocks (only applicable when
1108 * @ref logic_state == 0x1)
1109 * * 0x3 : enable partition clocks (only applicable when
1110 * @ref logic_state == 0x3)
1111 */
1112 uint32_t clock_state;
1113} __ABI_PACKED;
1114/** @} */
1115
1116/**
1117 * @ingroup MRQ_Codes
1118 * @def MRQ_THERMAL
1119 * @brief interact with BPMP thermal framework
1120 *
1121 * * Platforms: T186
1122 * * Initiators: Any
1123 * * Targets: Any
1124 * * Request Payload: TODO
1125 * * Response Payload: TODO
1126 *
1127 * @addtogroup Thermal
1128 *
1129 * The BPMP firmware includes a thermal framework. Drivers within the
1130 * bpmp firmware register with the framework to provide thermal
1131 * zones. Each thermal zone corresponds to an entity whose temperature
1132 * can be measured. The framework also has a notion of trip points. A
1133 * trip point consists of a thermal zone id, a temperature, and a
1134 * callback routine. The framework invokes the callback when the zone
1135 * hits the indicated temperature. The BPMP firmware uses this thermal
1136 * framework interally to implement various temperature-dependent
1137 * functions.
1138 *
1139 * Software on the CPU can use #MRQ_THERMAL (with payload @ref
1140 * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal
1141 * framework. The CPU must It can query the number of supported zones,
1142 * query zone temperatures, and set trip points.
1143 *
1144 * When a trip point set by the CPU gets crossed, BPMP firmware issues
1145 * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a
1146 * payload of @ref mrq_thermal_bpmp_to_host_request.
1147 * @{
1148 */
1149enum mrq_thermal_host_to_bpmp_cmd {
1150 /**
1151 * @brief Check whether the BPMP driver supports the specified
1152 * request type.
1153 *
1154 * Host needs to supply request parameters.
1155 *
1156 * mrq_response::err is 0 if the specified request is
1157 * supported and -#BPMP_ENODEV otherwise.
1158 */
1159 CMD_THERMAL_QUERY_ABI = 0,
1160
1161 /**
1162 * @brief Get the current temperature of the specified zone.
1163 *
1164 * Host needs to supply request parameters.
1165 *
1166 * mrq_response::err is
1167 * * 0: Temperature query succeeded.
1168 * * -#BPMP_EINVAL: Invalid request parameters.
1169 * * -#BPMP_ENOENT: No driver registered for thermal zone..
1170 * * -#BPMP_EFAULT: Problem reading temperature measurement.
1171 */
1172 CMD_THERMAL_GET_TEMP = 1,
1173
1174 /**
1175 * @brief Enable or disable and set the lower and upper
1176 * thermal limits for a thermal trip point. Each zone has
1177 * one trip point.
1178 *
1179 * Host needs to supply request parameters. Once the
1180 * temperature hits a trip point, the BPMP will send a message
1181 * to the CPU having MRQ=MRQ_THERMAL and
1182 * type=CMD_THERMAL_HOST_TRIP_REACHED
1183 *
1184 * mrq_response::err is
1185 * * 0: Trip successfully set.
1186 * * -#BPMP_EINVAL: Invalid request parameters.
1187 * * -#BPMP_ENOENT: No driver registered for thermal zone.
1188 * * -#BPMP_EFAULT: Problem setting trip point.
1189 */
1190 CMD_THERMAL_SET_TRIP = 2,
1191
1192 /**
1193 * @brief Get the number of supported thermal zones.
1194 *
1195 * No request parameters required.
1196 *
1197 * mrq_response::err is always 0, indicating success.
1198 */
1199 CMD_THERMAL_GET_NUM_ZONES = 3,
1200
1201 /** @brief: number of supported host-to-bpmp commands. May
1202 * increase in future
1203 */
1204 CMD_THERMAL_HOST_TO_BPMP_NUM
1205};
1206
1207enum mrq_thermal_bpmp_to_host_cmd {
1208 /**
1209 * @brief Indication that the temperature for a zone has
1210 * exceeded the range indicated in the thermal trip point
1211 * for the zone.
1212 *
1213 * BPMP needs to supply request parameters. Host only needs to
1214 * acknowledge.
1215 */
1216 CMD_THERMAL_HOST_TRIP_REACHED = 100,
1217
1218 /** @brief: number of supported bpmp-to-host commands. May
1219 * increase in future
1220 */
1221 CMD_THERMAL_BPMP_TO_HOST_NUM
1222};
1223
1224/*
1225 * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI
1226 *
1227 * zone: Request type for which to check existence.
1228 */
1229struct cmd_thermal_query_abi_request {
1230 uint32_t type;
1231} __ABI_PACKED;
1232
1233/*
1234 * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP
1235 *
1236 * zone: Number of thermal zone.
1237 */
1238struct cmd_thermal_get_temp_request {
1239 uint32_t zone;
1240} __ABI_PACKED;
1241
1242/*
1243 * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP
1244 *
1245 * error: 0 if request succeeded.
1246 * -BPMP_EINVAL if request parameters were invalid.
1247 * -BPMP_ENOENT if no driver was registered for the specified thermal zone.
1248 * -BPMP_EFAULT for other thermal zone driver errors.
1249 * temp: Current temperature in millicelsius.
1250 */
1251struct cmd_thermal_get_temp_response {
1252 int32_t temp;
1253} __ABI_PACKED;
1254
1255/*
1256 * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP
1257 *
1258 * zone: Number of thermal zone.
1259 * low: Temperature of lower trip point in millicelsius
1260 * high: Temperature of upper trip point in millicelsius
1261 * enabled: 1 to enable trip point, 0 to disable trip point
1262 */
1263struct cmd_thermal_set_trip_request {
1264 uint32_t zone;
1265 int32_t low;
1266 int32_t high;
1267 uint32_t enabled;
1268} __ABI_PACKED;
1269
1270/*
1271 * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED
1272 *
1273 * zone: Number of thermal zone where trip point was reached.
1274 */
1275struct cmd_thermal_host_trip_reached_request {
1276 uint32_t zone;
1277} __ABI_PACKED;
1278
1279/*
1280 * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES
1281 *
1282 * num: Number of supported thermal zones. The thermal zones are indexed
1283 * starting from zero.
1284 */
1285struct cmd_thermal_get_num_zones_response {
1286 uint32_t num;
1287} __ABI_PACKED;
1288
1289/*
1290 * Host->BPMP request data.
1291 *
1292 * Reply type is union mrq_thermal_bpmp_to_host_response.
1293 *
1294 * type: Type of request. Values listed in enum mrq_thermal_type.
1295 * data: Request type specific parameters.
1296 */
1297struct mrq_thermal_host_to_bpmp_request {
1298 uint32_t type;
1299 union {
1300 struct cmd_thermal_query_abi_request query_abi;
1301 struct cmd_thermal_get_temp_request get_temp;
1302 struct cmd_thermal_set_trip_request set_trip;
1303 } __UNION_ANON;
1304} __ABI_PACKED;
1305
1306/*
1307 * BPMP->Host request data.
1308 *
1309 * type: Type of request. Values listed in enum mrq_thermal_type.
1310 * data: Request type specific parameters.
1311 */
1312struct mrq_thermal_bpmp_to_host_request {
1313 uint32_t type;
1314 union {
1315 struct cmd_thermal_host_trip_reached_request host_trip_reached;
1316 } __UNION_ANON;
1317} __ABI_PACKED;
1318
1319/*
1320 * Data in reply to a Host->BPMP request.
1321 */
1322union mrq_thermal_bpmp_to_host_response {
1323 struct cmd_thermal_get_temp_response get_temp;
1324 struct cmd_thermal_get_num_zones_response get_num_zones;
1325} __ABI_PACKED;
1326/** @} */
1327
1328/**
1329 * @ingroup MRQ_Codes
1330 * @def MRQ_CPU_VHINT
1331 * @brief Query CPU voltage hint data
1332 *
1333 * * Platforms: T186
1334 * * Initiators: CCPLEX
1335 * * Targets: BPMP
1336 * * Request Payload: @ref mrq_cpu_vhint_request
1337 * * Response Payload: N/A
1338 *
1339 * @addtogroup Vhint CPU Voltage hint
1340 * @{
1341 */
1342
1343/**
1344 * @brief request with #MRQ_CPU_VHINT
1345 *
1346 * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data
1347 * from BPMP to memory space pointed by #addr. CCPLEX is responsible
1348 * to allocate sizeof(cpu_vhint_data) sized block of memory and
1349 * appropriately map it for BPMP before sending the request.
1350 */
1351struct mrq_cpu_vhint_request {
1352 /** @brief IOVA address for the #cpu_vhint_data */
1353 uint32_t addr; /* struct cpu_vhint_data * */
1354 /** @brief ID of the cluster whose data is requested */
1355 uint32_t cluster_id; /* enum cluster_id */
1356} __ABI_PACKED;
1357
1358/**
1359 * @brief description of the CPU v/f relation
1360 *
1361 * Used by #MRQ_CPU_VHINT call to carry data pointed by #addr of
1362 * struct mrq_cpu_vhint_request
1363 */
1364struct cpu_vhint_data {
1365 uint32_t ref_clk_hz; /**< reference frequency in Hz */
1366 uint16_t pdiv; /**< post divider value */
1367 uint16_t mdiv; /**< input divider value */
1368 uint16_t ndiv_max; /**< fMAX expressed with max NDIV value */
1369 /** table of ndiv values as a function of vINDEX (voltage index) */
1370 uint16_t ndiv[80];
1371 /** minimum allowed NDIV value */
1372 uint16_t ndiv_min;
1373 /** minimum allowed voltage hint value (as in vINDEX) */
1374 uint16_t vfloor;
1375 /** maximum allowed voltage hint value (as in vINDEX) */
1376 uint16_t vceil;
1377 /** post-multiplier for vindex value */
1378 uint16_t vindex_mult;
1379 /** post-divider for vindex value */
1380 uint16_t vindex_div;
1381 /** reserved for future use */
1382 uint16_t reserved[328];
1383} __ABI_PACKED;
1384
1385/** @} */
1386
1387/**
1388 * @ingroup MRQ_Codes
1389 * @def MRQ_ABI_RATCHET
1390 * @brief ABI ratchet value query
1391 *
1392 * * Platforms: T186
1393 * * Initiators: Any
1394 * * Targets: BPMP
1395 * * Request Payload: @ref mrq_abi_ratchet_request
1396 * * Response Payload: @ref mrq_abi_ratchet_response
1397 * @addtogroup ABI_info
1398 * @{
1399 */
1400
1401/**
1402 * @brief an ABI compatibility mechanism
1403 *
1404 * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future
1405 * revision of this header file.
1406 * 1. That future revision deprecates some MRQ
1407 * 2. That future revision introduces a breaking change to an existing
1408 * MRQ or
1409 * 3. A bug is discovered in an existing implementation of the BPMP-FW
1410 * (or possibly one of its clients) which warrants deprecating that
1411 * implementation.
1412 */
1413#define BPMP_ABI_RATCHET_VALUE 3
1414
1415/**
1416 * @brief request with #MRQ_ABI_RATCHET.
1417 *
1418 * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header
1419 * against which the requester was compiled.
1420 *
1421 * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may
1422 * reply with mrq_response::err = -#BPMP_ERANGE to indicate that
1423 * BPMP-FW cannot interoperate correctly with the requester. Requester
1424 * should cease further communication with BPMP.
1425 *
1426 * Otherwise, err shall be 0.
1427 */
1428struct mrq_abi_ratchet_request {
1429 /** @brief requester's ratchet value */
1430 uint16_t ratchet;
1431};
1432
1433/**
1434 * @brief response to #MRQ_ABI_RATCHET
1435 *
1436 * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header
1437 * against which BPMP firwmare was compiled.
1438 *
1439 * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE,
1440 * the requster must either interoperate with BPMP according to an ABI
1441 * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease
1442 * communication with BPMP.
1443 *
1444 * If mrq_response::err is 0 and ratchet is greater than or equal to the
1445 * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue
1446 * normal operation.
1447 */
1448struct mrq_abi_ratchet_response {
1449 /** @brief BPMP's ratchet value */
1450 uint16_t ratchet;
1451};
1452/** @} */
1453
1454/**
1455 * @ingroup MRQ_Codes
1456 * @def MRQ_EMC_DVFS_LATENCY
1457 * @brief query frequency dependent EMC DVFS latency
1458 *
1459 * * Platforms: T186
1460 * * Initiators: CCPLEX
1461 * * Targets: BPMP
1462 * * Request Payload: N/A
1463 * * Response Payload: @ref mrq_emc_dvfs_latency_response
1464 * @addtogroup EMC
1465 * @{
1466 */
1467
1468/**
1469 * @brief used by @ref mrq_emc_dvfs_latency_response
1470 */
1471struct emc_dvfs_latency {
1472 /** @brief EMC frequency in kHz */
1473 uint32_t freq;
1474 /** @brief EMC DVFS latency in nanoseconds */
1475 uint32_t latency;
1476} __ABI_PACKED;
1477
1478#define EMC_DVFS_LATENCY_MAX_SIZE 14
1479/**
1480 * @brief response to #MRQ_EMC_DVFS_LATENCY
1481 */
1482struct mrq_emc_dvfs_latency_response {
1483 /** @brief the number valid entries in #pairs */
1484 uint32_t num_pairs;
1485 /** @brief EMC <frequency, latency> information */
1486 struct emc_dvfs_latency pairs[EMC_DVFS_LATENCY_MAX_SIZE];
1487} __ABI_PACKED;
1488
1489/** @} */
1490
1491/**
1492 * @ingroup MRQ_Codes
1493 * @def MRQ_TRACE_ITER
1494 * @brief manage the trace iterator
1495 *
1496 * * Platforms: All
1497 * * Initiators: CCPLEX
1498 * * Targets: BPMP
1499 * * Request Payload: N/A
1500 * * Response Payload: @ref mrq_trace_iter_request
1501 * @addtogroup Trace
1502 * @{
1503 */
1504enum {
1505 /** @brief (re)start the tracing now. Ignore older events */
1506 TRACE_ITER_INIT = 0,
1507 /** @brief clobber all events in the trace buffer */
1508 TRACE_ITER_CLEAN = 1
1509};
1510
1511/**
1512 * @brief request with #MRQ_TRACE_ITER
1513 */
1514struct mrq_trace_iter_request {
1515 /** @brief TRACE_ITER_INIT or TRACE_ITER_CLEAN */
1516 uint32_t cmd;
1517} __ABI_PACKED;
1518
1519/** @} */
1520
1521/*
1522 * 4. Enumerations
1523 */
1524
1525/*
1526 * 4.1 CPU enumerations
1527 *
1528 * See <mach-t186/system-t186.h>
1529 *
1530 * 4.2 CPU Cluster enumerations
1531 *
1532 * See <mach-t186/system-t186.h>
1533 *
1534 * 4.3 System low power state enumerations
1535 *
1536 * See <mach-t186/system-t186.h>
1537 */
1538
1539/*
1540 * 4.4 Clock enumerations
1541 *
1542 * For clock enumerations, see <mach-t186/clk-t186.h>
1543 */
1544
1545/*
1546 * 4.5 Reset enumerations
1547 *
1548 * For reset enumerations, see <mach-t186/reset-t186.h>
1549 */
1550
1551/*
1552 * 4.6 Thermal sensor enumerations
1553 *
1554 * For thermal sensor enumerations, see <mach-t186/thermal-t186.h>
1555 */
1556
1557/**
1558 * @defgroup Error_Codes
1559 * Negative values for mrq_response::err generally indicate some
1560 * error. The ABI defines the following error codes. Negating these
1561 * defines is an exercise left to the user.
1562 * @{
1563 */
1564/** @brief No such file or directory */
1565#define BPMP_ENOENT 2
1566/** @brief No MRQ handler */
1567#define BPMP_ENOHANDLER 3
1568/** @brief I/O error */
1569#define BPMP_EIO 5
1570/** @brief Bad sub-MRQ command */
1571#define BPMP_EBADCMD 6
1572/** @brief Not enough memory */
1573#define BPMP_ENOMEM 12
1574/** @brief Permission denied */
1575#define BPMP_EACCES 13
1576/** @brief Bad address */
1577#define BPMP_EFAULT 14
1578/** @brief No such device */
1579#define BPMP_ENODEV 19
1580/** @brief Argument is a directory */
1581#define BPMP_EISDIR 21
1582/** @brief Invalid argument */
1583#define BPMP_EINVAL 22
1584/** @brief Timeout during operation */
1585#define BPMP_ETIMEDOUT 23
1586/** @brief Out of range */
1587#define BPMP_ERANGE 34
1588/** @} */
1589/** @} */
1590#endif