linux/include/soc/tegra/bpmp-abi.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0-only */
   2/*
   3 * Copyright (c) 2014-2018, NVIDIA CORPORATION.  All rights reserved.
   4 */
   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 * @defgroup MRQ MRQ Messages
  34 * @brief Messages sent to/from BPMP via IPC
  35 * @{
  36 *   @defgroup MRQ_Format Message Format
  37 *   @defgroup MRQ_Codes Message Request (MRQ) Codes
  38 *   @defgroup MRQ_Payloads Message Payloads
  39 *   @defgroup Error_Codes Error Codes
  40 * @}
  41 */
  42
  43/**
  44 * @addtogroup MRQ_Format
  45 * @{
  46 * The CPU requests the BPMP to perform a particular service by
  47 * sending it an IVC frame containing a single MRQ message. An MRQ
  48 * message consists of a @ref mrq_request followed by a payload whose
  49 * format depends on mrq_request::mrq.
  50 *
  51 * The BPMP processes the data and replies with an IVC frame (on the
  52 * same IVC channel) containing and MRQ response. An MRQ response
  53 * consists of a @ref mrq_response followed by a payload whose format
  54 * depends on the associated mrq_request::mrq.
  55 *
  56 * A well-defined subset of the MRQ messages that the CPU sends to the
  57 * BPMP can lead to BPMP eventually sending an MRQ message to the
  58 * CPU. For example, when the CPU uses an #MRQ_THERMAL message to set
  59 * a thermal trip point, the BPMP may eventually send a single
  60 * #MRQ_THERMAL message of its own to the CPU indicating that the trip
  61 * point has been crossed.
  62 * @}
  63 */
  64
  65/**
  66 * @ingroup MRQ_Format
  67 * @brief Header for an MRQ message
  68 *
  69 * Provides the MRQ number for the MRQ message: #mrq. The remainder of
  70 * the MRQ message is a payload (immediately following the
  71 * mrq_request) whose format depends on mrq.
  72 */
  73struct mrq_request {
  74        /** @brief MRQ number of the request */
  75        uint32_t mrq;
  76        /**
  77         * @brief Flags providing follow up directions to the receiver
  78         *
  79         * | Bit | Description                                |
  80         * |-----|--------------------------------------------|
  81         * | 1   | ring the sender's doorbell when responding |
  82         * | 0   | should be 1                                |
  83         */
  84        uint32_t flags;
  85} __ABI_PACKED;
  86
  87/**
  88 * @ingroup MRQ_Format
  89 * @brief Header for an MRQ response
  90 *
  91 *  Provides an error code for the associated MRQ message. The
  92 *  remainder of the MRQ response is a payload (immediately following
  93 *  the mrq_response) whose format depends on the associated
  94 *  mrq_request::mrq
  95 */
  96struct mrq_response {
  97        /** @brief Error code for the MRQ request itself */
  98        int32_t err;
  99        /** @brief Reserved for future use */
 100        uint32_t flags;
 101} __ABI_PACKED;
 102
 103/**
 104 * @ingroup MRQ_Format
 105 * Minimum needed size for an IPC message buffer
 106 */
 107#define MSG_MIN_SZ      128
 108/**
 109 * @ingroup MRQ_Format
 110 *  Minimum size guaranteed for data in an IPC message buffer
 111 */
 112#define MSG_DATA_MIN_SZ 120
 113
 114/**
 115 * @ingroup MRQ_Codes
 116 * @name Legal MRQ codes
 117 * These are the legal values for mrq_request::mrq
 118 * @{
 119 */
 120
 121#define MRQ_PING                0
 122#define MRQ_QUERY_TAG           1
 123#define MRQ_MODULE_LOAD         4
 124#define MRQ_MODULE_UNLOAD       5
 125#define MRQ_TRACE_MODIFY        7
 126#define MRQ_WRITE_TRACE         8
 127#define MRQ_THREADED_PING       9
 128#define MRQ_MODULE_MAIL         11
 129#define MRQ_DEBUGFS             19
 130#define MRQ_RESET               20
 131#define MRQ_I2C                 21
 132#define MRQ_CLK                 22
 133#define MRQ_QUERY_ABI           23
 134#define MRQ_PG_READ_STATE       25
 135#define MRQ_PG_UPDATE_STATE     26
 136#define MRQ_THERMAL             27
 137#define MRQ_CPU_VHINT           28
 138#define MRQ_ABI_RATCHET         29
 139#define MRQ_EMC_DVFS_LATENCY    31
 140#define MRQ_TRACE_ITER          64
 141#define MRQ_RINGBUF_CONSOLE     65
 142#define MRQ_PG                  66
 143#define MRQ_CPU_NDIV_LIMITS     67
 144#define MRQ_STRAP               68
 145#define MRQ_UPHY                69
 146#define MRQ_CPU_AUTO_CC3        70
 147#define MRQ_QUERY_FW_TAG        71
 148#define MRQ_FMON                72
 149#define MRQ_EC                  73
 150#define MRQ_FBVOLT_STATUS       74
 151
 152/** @} */
 153
 154/**
 155 * @ingroup MRQ_Codes
 156 * @brief Maximum MRQ code to be sent by CPU software to
 157 * BPMP. Subject to change in future
 158 */
 159#define MAX_CPU_MRQ_ID          74
 160
 161/**
 162 * @addtogroup MRQ_Payloads
 163 * @{
 164 *   @defgroup Ping Ping
 165 *   @defgroup Query_Tag Query Tag
 166 *   @defgroup Module Loadable Modules
 167 *   @defgroup Trace Trace
 168 *   @defgroup Debugfs Debug File System
 169 *   @defgroup Reset Reset
 170 *   @defgroup I2C I2C
 171 *   @defgroup Clocks Clocks
 172 *   @defgroup ABI_info ABI Info
 173 *   @defgroup Powergating Power Gating
 174 *   @defgroup Thermal Thermal
 175 *   @defgroup Vhint CPU Voltage hint
 176 *   @defgroup EMC EMC
 177 *   @defgroup CPU NDIV Limits
 178 *   @defgroup RingbufConsole Ring Buffer Console
 179 *   @defgroup Strap Straps
 180 *   @defgroup UPHY UPHY
 181 *   @defgroup CC3 Auto-CC3
 182 *   @defgroup FMON FMON
 183 *   @defgroup EC EC
 184 *   @defgroup Fbvolt_status Fuse Burn Voltage Status
 185 * @}
 186 */
 187
 188/**
 189 * @ingroup MRQ_Codes
 190 * @def MRQ_PING
 191 * @brief A simple ping
 192 *
 193 * * Platforms: All
 194 * * Initiators: Any
 195 * * Targets: Any
 196 * * Request Payload: @ref mrq_ping_request
 197 * * Response Payload: @ref mrq_ping_response
 198 *
 199 * @ingroup MRQ_Codes
 200 * @def MRQ_THREADED_PING
 201 * @brief A deeper ping
 202 *
 203 * * Platforms: All
 204 * * Initiators: Any
 205 * * Targets: BPMP
 206 * * Request Payload: @ref mrq_ping_request
 207 * * Response Payload: @ref mrq_ping_response
 208 *
 209 * Behavior is equivalent to a simple #MRQ_PING except that BPMP
 210 * responds from a thread context (providing a slightly more robust
 211 * sign of life).
 212 *
 213 */
 214
 215/**
 216 * @ingroup Ping
 217 * @brief Request with #MRQ_PING
 218 *
 219 * Used by the sender of an #MRQ_PING message to request a pong from
 220 * recipient. The response from the recipient is computed based on
 221 * #challenge.
 222 */
 223struct mrq_ping_request {
 224/** @brief Arbitrarily chosen value */
 225        uint32_t challenge;
 226} __ABI_PACKED;
 227
 228/**
 229 * @ingroup Ping
 230 * @brief Response to #MRQ_PING
 231 *
 232 * Sent in response to an #MRQ_PING message. #reply should be the
 233 * mrq_ping_request challenge left shifted by 1 with the carry-bit
 234 * dropped.
 235 *
 236 */
 237struct mrq_ping_response {
 238        /** @brief Response to the MRQ_PING challege */
 239        uint32_t reply;
 240} __ABI_PACKED;
 241
 242/**
 243 * @ingroup MRQ_Codes
 244 * @def MRQ_QUERY_TAG
 245 * @brief Query BPMP firmware's tag (i.e. unique identifer)
 246 *
 247 * @deprecated Use #MRQ_QUERY_FW_TAG instead.
 248 *
 249 * * Platforms: All
 250 * * Initiators: CCPLEX
 251 * * Targets: BPMP
 252 * * Request Payload: @ref mrq_query_tag_request
 253 * * Response Payload: N/A
 254 *
 255 */
 256
 257/**
 258 * @ingroup Query_Tag
 259 * @brief Request with #MRQ_QUERY_TAG
 260 *
 261 * @deprecated This structure will be removed in future version.
 262 * Use MRQ_QUERY_FW_TAG instead.
 263 */
 264struct mrq_query_tag_request {
 265  /** @brief Base address to store the firmware tag */
 266        uint32_t addr;
 267} __ABI_PACKED;
 268
 269
 270/**
 271 * @ingroup MRQ_Codes
 272 * @def MRQ_QUERY_FW_TAG
 273 * @brief Query BPMP firmware's tag (i.e. unique identifier)
 274 *
 275 * * Platforms: All
 276 * * Initiators: Any
 277 * * Targets: BPMP
 278 * * Request Payload: N/A
 279 * * Response Payload: @ref mrq_query_fw_tag_response
 280 *
 281 */
 282
 283/**
 284 * @ingroup Query_Tag
 285 * @brief Response to #MRQ_QUERY_FW_TAG
 286 *
 287 * Sent in response to #MRQ_QUERY_FW_TAG message. #tag contains the unique
 288 * identifier for the version of firmware issuing the reply.
 289 *
 290 */
 291struct mrq_query_fw_tag_response {
 292  /** @brief Array to store tag information */
 293        uint8_t tag[32];
 294} __ABI_PACKED;
 295
 296/**
 297 * @ingroup MRQ_Codes
 298 * @def MRQ_MODULE_LOAD
 299 * @brief Dynamically load a BPMP code module
 300 *
 301 * * Platforms: T210, T214, T186
 302 * @cond (bpmp_t210 || bpmp_t214 || bpmp_t186)
 303 * * Initiators: CCPLEX
 304 * * Targets: BPMP
 305 * * Request Payload: @ref mrq_module_load_request
 306 * * Response Payload: @ref mrq_module_load_response
 307 *
 308 * @note This MRQ is disabled on production systems
 309 *
 310 */
 311
 312/**
 313 * @ingroup Module
 314 * @brief Request with #MRQ_MODULE_LOAD
 315 *
 316 * Used by #MRQ_MODULE_LOAD calls to ask the recipient to dynamically
 317 * load the code located at #phys_addr and having size #size
 318 * bytes. #phys_addr is treated as a void pointer.
 319 *
 320 * The recipient copies the code from #phys_addr to locally allocated
 321 * memory prior to responding to this message.
 322 *
 323 * @todo document the module header format
 324 *
 325 * The sender is responsible for ensuring that the code is mapped in
 326 * the recipient's address map.
 327 *
 328 */
 329struct mrq_module_load_request {
 330        /** @brief Base address of the code to load. Treated as (void *) */
 331        uint32_t phys_addr; /* (void *) */
 332        /** @brief Size in bytes of code to load */
 333        uint32_t size;
 334} __ABI_PACKED;
 335
 336/**
 337 * @ingroup Module
 338 * @brief Response to #MRQ_MODULE_LOAD
 339 *
 340 * @todo document mrq_response::err
 341 */
 342struct mrq_module_load_response {
 343        /** @brief Handle to the loaded module */
 344        uint32_t base;
 345} __ABI_PACKED;
 346/** @endcond*/
 347
 348/**
 349 * @ingroup MRQ_Codes
 350 * @def MRQ_MODULE_UNLOAD
 351 * @brief Unload a previously loaded code module
 352 *
 353 * * Platforms: T210, T214, T186
 354 * @cond (bpmp_t210 || bpmp_t214 || bpmp_t186)
 355 * * Initiators: CCPLEX
 356 * * Targets: BPMP
 357 * * Request Payload: @ref mrq_module_unload_request
 358 * * Response Payload: N/A
 359 *
 360 * @note This MRQ is disabled on production systems
 361 */
 362
 363/**
 364 * @ingroup Module
 365 * @brief Request with #MRQ_MODULE_UNLOAD
 366 *
 367 * Used by #MRQ_MODULE_UNLOAD calls to request that a previously loaded
 368 * module be unloaded.
 369 */
 370struct mrq_module_unload_request {
 371        /** @brief Handle of the module to unload */
 372        uint32_t base;
 373} __ABI_PACKED;
 374/** @endcond*/
 375
 376/**
 377 * @ingroup MRQ_Codes
 378 * @def MRQ_TRACE_MODIFY
 379 * @brief Modify the set of enabled trace events
 380 *
 381 * * Platforms: All
 382 * * Initiators: CCPLEX
 383 * * Targets: BPMP
 384 * * Request Payload: @ref mrq_trace_modify_request
 385 * * Response Payload: @ref mrq_trace_modify_response
 386 *
 387 * @note This MRQ is disabled on production systems
 388 */
 389
 390/**
 391 * @ingroup Trace
 392 * @brief Request with #MRQ_TRACE_MODIFY
 393 *
 394 * Used by %MRQ_TRACE_MODIFY calls to enable or disable specify trace
 395 * events.  #set takes precedence for any bit set in both #set and
 396 * #clr.
 397 */
 398struct mrq_trace_modify_request {
 399        /** @brief Bit mask of trace events to disable */
 400        uint32_t clr;
 401        /** @brief Bit mask of trace events to enable */
 402        uint32_t set;
 403} __ABI_PACKED;
 404
 405/**
 406 * @ingroup Trace
 407 * @brief Response to #MRQ_TRACE_MODIFY
 408 *
 409 * Sent in repsonse to an #MRQ_TRACE_MODIFY message. #mask reflects the
 410 * state of which events are enabled after the recipient acted on the
 411 * message.
 412 *
 413 */
 414struct mrq_trace_modify_response {
 415        /** @brief Bit mask of trace event enable states */
 416        uint32_t mask;
 417} __ABI_PACKED;
 418
 419/**
 420 * @ingroup MRQ_Codes
 421 * @def MRQ_WRITE_TRACE
 422 * @brief Write trace data to a buffer
 423 *
 424 * * Platforms: All
 425 * * Initiators: CCPLEX
 426 * * Targets: BPMP
 427 * * Request Payload: @ref mrq_write_trace_request
 428 * * Response Payload: @ref mrq_write_trace_response
 429 *
 430 * mrq_response::err depends on the @ref mrq_write_trace_request field
 431 * values. err is -#BPMP_EINVAL if size is zero or area is NULL or
 432 * area is in an illegal range. A positive value for err indicates the
 433 * number of bytes written to area.
 434 *
 435 * @note This MRQ is disabled on production systems
 436 */
 437
 438/**
 439 * @ingroup Trace
 440 * @brief Request with #MRQ_WRITE_TRACE
 441 *
 442 * Used by MRQ_WRITE_TRACE calls to ask the recipient to copy trace
 443 * data from the recipient's local buffer to the output buffer. #area
 444 * is treated as a byte-aligned pointer in the recipient's address
 445 * space.
 446 *
 447 * The sender is responsible for ensuring that the output
 448 * buffer is mapped in the recipient's address map. The recipient is
 449 * responsible for protecting its own code and data from accidental
 450 * overwrites.
 451 */
 452struct mrq_write_trace_request {
 453        /** @brief Base address of output buffer */
 454        uint32_t area;
 455        /** @brief Size in bytes of the output buffer */
 456        uint32_t size;
 457} __ABI_PACKED;
 458
 459/**
 460 * @ingroup Trace
 461 * @brief Response to #MRQ_WRITE_TRACE
 462 *
 463 * Once this response is sent, the respondent will not access the
 464 * output buffer further.
 465 */
 466struct mrq_write_trace_response {
 467        /**
 468         * @brief Flag whether more data remains in local buffer
 469         *
 470         * Value is 1 if the entire local trace buffer has been
 471         * drained to the outputbuffer. Value is 0 otherwise.
 472         */
 473        uint32_t eof;
 474} __ABI_PACKED;
 475
 476/** @private */
 477struct mrq_threaded_ping_request {
 478        uint32_t challenge;
 479} __ABI_PACKED;
 480
 481/** @private */
 482struct mrq_threaded_ping_response {
 483        uint32_t reply;
 484} __ABI_PACKED;
 485
 486/**
 487 * @ingroup MRQ_Codes
 488 * @def MRQ_MODULE_MAIL
 489 * @brief Send a message to a loadable module
 490 *
 491 * * Platforms: T210, T214, T186
 492 * @cond (bpmp_t210 || bpmp_t214 || bpmp_t186)
 493 * * Initiators: Any
 494 * * Targets: BPMP
 495 * * Request Payload: @ref mrq_module_mail_request
 496 * * Response Payload: @ref mrq_module_mail_response
 497 *
 498 * @note This MRQ is disabled on production systems
 499 */
 500
 501/**
 502 * @ingroup Module
 503 * @brief Request with #MRQ_MODULE_MAIL
 504 */
 505struct mrq_module_mail_request {
 506        /** @brief Handle to the previously loaded module */
 507        uint32_t base;
 508        /** @brief Module-specific mail payload
 509         *
 510         * The length of data[ ] is unknown to the BPMP core firmware
 511         * but it is limited to the size of an IPC message.
 512         */
 513        uint8_t data[EMPTY_ARRAY];
 514} __ABI_PACKED;
 515
 516/**
 517 * @ingroup Module
 518 * @brief Response to #MRQ_MODULE_MAIL
 519 */
 520struct mrq_module_mail_response {
 521        /** @brief Module-specific mail payload
 522         *
 523         * The length of data[ ] is unknown to the BPMP core firmware
 524         * but it is limited to the size of an IPC message.
 525         */
 526        uint8_t data[EMPTY_ARRAY];
 527} __ABI_PACKED;
 528/** @endcond */
 529
 530/**
 531 * @ingroup MRQ_Codes
 532 * @def MRQ_DEBUGFS
 533 * @brief Interact with BPMP's debugfs file nodes
 534 *
 535 * * Platforms: T186, T194
 536 * * Initiators: Any
 537 * * Targets: BPMP
 538 * * Request Payload: @ref mrq_debugfs_request
 539 * * Response Payload: @ref mrq_debugfs_response
 540 */
 541
 542/**
 543 * @addtogroup Debugfs
 544 * @{
 545 *
 546 * The BPMP firmware implements a pseudo-filesystem called
 547 * debugfs. Any driver within the firmware may register with debugfs
 548 * to expose an arbitrary set of "files" in the filesystem. When
 549 * software on the CPU writes to a debugfs file, debugfs passes the
 550 * written data to a callback provided by the driver. When software on
 551 * the CPU reads a debugfs file, debugfs queries the driver for the
 552 * data to return to the CPU. The intention of the debugfs filesystem
 553 * is to provide information useful for debugging the system at
 554 * runtime.
 555 *
 556 * @note The files exposed via debugfs are not part of the
 557 * BPMP firmware's ABI. debugfs files may be added or removed in any
 558 * given version of the firmware. Typically the semantics of a debugfs
 559 * file are consistent from version to version but even that is not
 560 * guaranteed.
 561 *
 562 * @}
 563 */
 564
 565/** @ingroup Debugfs */
 566enum mrq_debugfs_commands {
 567        /** @brief Perform read */
 568        CMD_DEBUGFS_READ = 1,
 569        /** @brief Perform write */
 570        CMD_DEBUGFS_WRITE = 2,
 571        /** @brief Perform dumping directory */
 572        CMD_DEBUGFS_DUMPDIR = 3,
 573        /** @brief Not a command */
 574        CMD_DEBUGFS_MAX
 575};
 576
 577/**
 578 * @ingroup Debugfs
 579 * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
 580 */
 581struct cmd_debugfs_fileop_request {
 582        /** @brief Physical address pointing at filename */
 583        uint32_t fnameaddr;
 584        /** @brief Length in bytes of filename buffer */
 585        uint32_t fnamelen;
 586        /** @brief Physical address pointing to data buffer */
 587        uint32_t dataaddr;
 588        /** @brief Length in bytes of data buffer */
 589        uint32_t datalen;
 590} __ABI_PACKED;
 591
 592/**
 593 * @ingroup Debugfs
 594 * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
 595 */
 596struct cmd_debugfs_dumpdir_request {
 597        /** @brief Physical address pointing to data buffer */
 598        uint32_t dataaddr;
 599        /** @brief Length in bytes of data buffer */
 600        uint32_t datalen;
 601} __ABI_PACKED;
 602
 603/**
 604 * @ingroup Debugfs
 605 * @brief Response data for CMD_DEBUGFS_READ/WRITE command
 606 */
 607struct cmd_debugfs_fileop_response {
 608        /** @brief Always 0 */
 609        uint32_t reserved;
 610        /** @brief Number of bytes read from or written to data buffer */
 611        uint32_t nbytes;
 612} __ABI_PACKED;
 613
 614/**
 615 * @ingroup Debugfs
 616 * @brief Response data for CMD_DEBUGFS_DUMPDIR command
 617 */
 618struct cmd_debugfs_dumpdir_response {
 619        /** @brief Always 0 */
 620        uint32_t reserved;
 621        /** @brief Number of bytes read from or written to data buffer */
 622        uint32_t nbytes;
 623} __ABI_PACKED;
 624
 625/**
 626 * @ingroup Debugfs
 627 * @brief Request with #MRQ_DEBUGFS.
 628 *
 629 * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs
 630 * command to execute. Legal commands are the values of @ref
 631 * mrq_debugfs_commands. Each command requires a specific additional
 632 * payload of data.
 633 *
 634 * |command            |payload|
 635 * |-------------------|-------|
 636 * |CMD_DEBUGFS_READ   |fop    |
 637 * |CMD_DEBUGFS_WRITE  |fop    |
 638 * |CMD_DEBUGFS_DUMPDIR|dumpdir|
 639 */
 640struct mrq_debugfs_request {
 641        /** @brief Sub-command (@ref mrq_debugfs_commands) */
 642        uint32_t cmd;
 643        union {
 644                struct cmd_debugfs_fileop_request fop;
 645                struct cmd_debugfs_dumpdir_request dumpdir;
 646        } __UNION_ANON;
 647} __ABI_PACKED;
 648
 649/**
 650 * @ingroup Debugfs
 651 */
 652struct mrq_debugfs_response {
 653        /** @brief Always 0 */
 654        int32_t reserved;
 655        union {
 656                /** @brief Response data for CMD_DEBUGFS_READ OR
 657                 * CMD_DEBUGFS_WRITE command
 658                 */
 659                struct cmd_debugfs_fileop_response fop;
 660                /** @brief Response data for CMD_DEBUGFS_DUMPDIR command */
 661                struct cmd_debugfs_dumpdir_response dumpdir;
 662        } __UNION_ANON;
 663} __ABI_PACKED;
 664
 665/**
 666 * @addtogroup Debugfs
 667 * @{
 668 */
 669#define DEBUGFS_S_ISDIR (1 << 9)
 670#define DEBUGFS_S_IRUSR (1 << 8)
 671#define DEBUGFS_S_IWUSR (1 << 7)
 672/** @} */
 673
 674/**
 675 * @ingroup MRQ_Codes
 676 * @def MRQ_RESET
 677 * @brief Reset an IP block
 678 *
 679 * * Platforms: T186, T194
 680 * * Initiators: Any
 681 * * Targets: BPMP
 682 * * Request Payload: @ref mrq_reset_request
 683 * * Response Payload: @ref mrq_reset_response
 684 *
 685 * @addtogroup Reset
 686 * @{
 687 */
 688
 689enum mrq_reset_commands {
 690        /** @brief Assert module reset */
 691        CMD_RESET_ASSERT = 1,
 692        /** @brief Deassert module reset */
 693        CMD_RESET_DEASSERT = 2,
 694        /** @brief Assert and deassert the module reset */
 695        CMD_RESET_MODULE = 3,
 696        /** @brief Get the highest reset ID */
 697        CMD_RESET_GET_MAX_ID = 4,
 698        /** @brief Not part of ABI and subject to change */
 699        CMD_RESET_MAX,
 700};
 701
 702/**
 703 * @brief Request with MRQ_RESET
 704 *
 705 * Used by the sender of an #MRQ_RESET message to request BPMP to
 706 * assert or or deassert a given reset line.
 707 */
 708struct mrq_reset_request {
 709        /** @brief Reset action to perform (@ref mrq_reset_commands) */
 710        uint32_t cmd;
 711        /** @brief Id of the reset to affected */
 712        uint32_t reset_id;
 713} __ABI_PACKED;
 714
 715/**
 716 * @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When
 717 * this sub-command is not supported, firmware will return -BPMP_EBADCMD
 718 * in mrq_response::err.
 719 */
 720struct cmd_reset_get_max_id_response {
 721        /** @brief Max reset id */
 722        uint32_t max_id;
 723} __ABI_PACKED;
 724
 725/**
 726 * @brief Response with MRQ_RESET
 727 *
 728 * Each sub-command supported by @ref mrq_reset_request may return
 729 * sub-command-specific data. Some do and some do not as indicated
 730 * in the following table
 731 *
 732 * | sub-command          | payload          |
 733 * |----------------------|------------------|
 734 * | CMD_RESET_ASSERT     | -                |
 735 * | CMD_RESET_DEASSERT   | -                |
 736 * | CMD_RESET_MODULE     | -                |
 737 * | CMD_RESET_GET_MAX_ID | reset_get_max_id |
 738 */
 739struct mrq_reset_response {
 740        union {
 741                struct cmd_reset_get_max_id_response reset_get_max_id;
 742        } __UNION_ANON;
 743} __ABI_PACKED;
 744
 745/** @} */
 746
 747/**
 748 * @ingroup MRQ_Codes
 749 * @def MRQ_I2C
 750 * @brief Issue an i2c transaction
 751 *
 752 * * Platforms: T186, T194
 753 * * Initiators: Any
 754 * * Targets: BPMP
 755 * * Request Payload: @ref mrq_i2c_request
 756 * * Response Payload: @ref mrq_i2c_response
 757 *
 758 * @addtogroup I2C
 759 * @{
 760 */
 761#define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE   (MSG_DATA_MIN_SZ - 12)
 762#define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE  (MSG_DATA_MIN_SZ - 4)
 763
 764#define SERIALI2C_TEN           0x0010
 765#define SERIALI2C_RD            0x0001
 766#define SERIALI2C_STOP          0x8000
 767#define SERIALI2C_NOSTART       0x4000
 768#define SERIALI2C_REV_DIR_ADDR  0x2000
 769#define SERIALI2C_IGNORE_NAK    0x1000
 770#define SERIALI2C_NO_RD_ACK     0x0800
 771#define SERIALI2C_RECV_LEN      0x0400
 772
 773enum {
 774        CMD_I2C_XFER = 1
 775};
 776
 777/**
 778 * @brief Serializable i2c request
 779 *
 780 * Instances of this structure are packed (little-endian) into
 781 * cmd_i2c_xfer_request::data_buf. Each instance represents a single
 782 * transaction (or a portion of a transaction with repeated starts) on
 783 * an i2c bus.
 784 *
 785 * Because these structures are packed, some instances are likely to
 786 * be misaligned. Additionally because #data is variable length, it is
 787 * not possible to iterate through a serialized list of these
 788 * structures without inspecting #len in each instance.  It may be
 789 * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf
 790 * manually rather than using this structure definition.
 791*/
 792struct serial_i2c_request {
 793        /** @brief I2C slave address */
 794        uint16_t addr;
 795        /** @brief Bitmask of SERIALI2C_ flags */
 796        uint16_t flags;
 797        /** @brief Length of I2C transaction in bytes */
 798        uint16_t len;
 799        /** @brief For write transactions only, #len bytes of data */
 800        uint8_t data[];
 801} __ABI_PACKED;
 802
 803/**
 804 * @brief Trigger one or more i2c transactions
 805 */
 806struct cmd_i2c_xfer_request {
 807        /** @brief Valid bus number from @ref bpmp_i2c_ids*/
 808        uint32_t bus_id;
 809
 810        /** @brief Count of valid bytes in #data_buf*/
 811        uint32_t data_size;
 812
 813        /** @brief Serialized packed instances of @ref serial_i2c_request*/
 814        uint8_t data_buf[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE];
 815} __ABI_PACKED;
 816
 817/**
 818 * @brief Container for data read from the i2c bus
 819 *
 820 * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute
 821 * zero or more I2C reads. The data read from the bus is serialized
 822 * into #data_buf.
 823 */
 824struct cmd_i2c_xfer_response {
 825        /** @brief Count of valid bytes in #data_buf*/
 826        uint32_t data_size;
 827        /** @brief I2c read data */
 828        uint8_t data_buf[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE];
 829} __ABI_PACKED;
 830
 831/**
 832 * @brief Request with #MRQ_I2C
 833 */
 834struct mrq_i2c_request {
 835        /** @brief Always CMD_I2C_XFER (i.e. 1) */
 836        uint32_t cmd;
 837        /** @brief Parameters of the transfer request */
 838        struct cmd_i2c_xfer_request xfer;
 839} __ABI_PACKED;
 840
 841/**
 842 * @brief Response to #MRQ_I2C
 843 */
 844struct mrq_i2c_response {
 845        struct cmd_i2c_xfer_response xfer;
 846} __ABI_PACKED;
 847
 848/** @} */
 849
 850/**
 851 * @ingroup MRQ_Codes
 852 * @def MRQ_CLK
 853 * @brief Perform a clock operation
 854 *
 855 * * Platforms: T186, T194
 856 * * Initiators: Any
 857 * * Targets: BPMP
 858 * * Request Payload: @ref mrq_clk_request
 859 * * Response Payload: @ref mrq_clk_response
 860 *
 861 * @addtogroup Clocks
 862 * @{
 863 */
 864enum {
 865        CMD_CLK_GET_RATE = 1,
 866        CMD_CLK_SET_RATE = 2,
 867        CMD_CLK_ROUND_RATE = 3,
 868        CMD_CLK_GET_PARENT = 4,
 869        CMD_CLK_SET_PARENT = 5,
 870        CMD_CLK_IS_ENABLED = 6,
 871        CMD_CLK_ENABLE = 7,
 872        CMD_CLK_DISABLE = 8,
 873        CMD_CLK_GET_ALL_INFO = 14,
 874        CMD_CLK_GET_MAX_CLK_ID = 15,
 875        CMD_CLK_GET_FMAX_AT_VMIN = 16,
 876        CMD_CLK_MAX,
 877};
 878
 879#define BPMP_CLK_HAS_MUX        (1 << 0)
 880#define BPMP_CLK_HAS_SET_RATE   (1 << 1)
 881#define BPMP_CLK_IS_ROOT        (1 << 2)
 882
 883#define MRQ_CLK_NAME_MAXLEN     40
 884#define MRQ_CLK_MAX_PARENTS     16
 885
 886/** @private */
 887struct cmd_clk_get_rate_request {
 888        EMPTY
 889} __ABI_PACKED;
 890
 891struct cmd_clk_get_rate_response {
 892        int64_t rate;
 893} __ABI_PACKED;
 894
 895struct cmd_clk_set_rate_request {
 896        int32_t unused;
 897        int64_t rate;
 898} __ABI_PACKED;
 899
 900struct cmd_clk_set_rate_response {
 901        int64_t rate;
 902} __ABI_PACKED;
 903
 904struct cmd_clk_round_rate_request {
 905        int32_t unused;
 906        int64_t rate;
 907} __ABI_PACKED;
 908
 909struct cmd_clk_round_rate_response {
 910        int64_t rate;
 911} __ABI_PACKED;
 912
 913/** @private */
 914struct cmd_clk_get_parent_request {
 915        EMPTY
 916} __ABI_PACKED;
 917
 918struct cmd_clk_get_parent_response {
 919        uint32_t parent_id;
 920} __ABI_PACKED;
 921
 922struct cmd_clk_set_parent_request {
 923        uint32_t parent_id;
 924} __ABI_PACKED;
 925
 926struct cmd_clk_set_parent_response {
 927        uint32_t parent_id;
 928} __ABI_PACKED;
 929
 930/** @private */
 931struct cmd_clk_is_enabled_request {
 932        EMPTY
 933} __ABI_PACKED;
 934
 935struct cmd_clk_is_enabled_response {
 936        int32_t state;
 937} __ABI_PACKED;
 938
 939/** @private */
 940struct cmd_clk_enable_request {
 941        EMPTY
 942} __ABI_PACKED;
 943
 944/** @private */
 945struct cmd_clk_enable_response {
 946        EMPTY
 947} __ABI_PACKED;
 948
 949/** @private */
 950struct cmd_clk_disable_request {
 951        EMPTY
 952} __ABI_PACKED;
 953
 954/** @private */
 955struct cmd_clk_disable_response {
 956        EMPTY
 957} __ABI_PACKED;
 958
 959/** @private */
 960struct cmd_clk_get_all_info_request {
 961        EMPTY
 962} __ABI_PACKED;
 963
 964struct cmd_clk_get_all_info_response {
 965        uint32_t flags;
 966        uint32_t parent;
 967        uint32_t parents[MRQ_CLK_MAX_PARENTS];
 968        uint8_t num_parents;
 969        uint8_t name[MRQ_CLK_NAME_MAXLEN];
 970} __ABI_PACKED;
 971
 972/** @private */
 973struct cmd_clk_get_max_clk_id_request {
 974        EMPTY
 975} __ABI_PACKED;
 976
 977struct cmd_clk_get_max_clk_id_response {
 978        uint32_t max_id;
 979} __ABI_PACKED;
 980
 981/** @private */
 982struct cmd_clk_get_fmax_at_vmin_request {
 983        EMPTY
 984} __ABI_PACKED;
 985
 986struct cmd_clk_get_fmax_at_vmin_response {
 987        int64_t rate;
 988} __ABI_PACKED;
 989
 990/**
 991 * @ingroup Clocks
 992 * @brief Request with #MRQ_CLK
 993 *
 994 * Used by the sender of an #MRQ_CLK message to control clocks. The
 995 * clk_request is split into several sub-commands. Some sub-commands
 996 * require no additional data. Others have a sub-command specific
 997 * payload
 998 *
 999 * |sub-command                 |payload                |
1000 * |----------------------------|-----------------------|
1001 * |CMD_CLK_GET_RATE            |-                      |
1002 * |CMD_CLK_SET_RATE            |clk_set_rate           |
1003 * |CMD_CLK_ROUND_RATE          |clk_round_rate         |
1004 * |CMD_CLK_GET_PARENT          |-                      |
1005 * |CMD_CLK_SET_PARENT          |clk_set_parent         |
1006 * |CMD_CLK_IS_ENABLED          |-                      |
1007 * |CMD_CLK_ENABLE              |-                      |
1008 * |CMD_CLK_DISABLE             |-                      |
1009 * |CMD_CLK_GET_ALL_INFO        |-                      |
1010 * |CMD_CLK_GET_MAX_CLK_ID      |-                      |
1011 * |CMD_CLK_GET_FMAX_AT_VMIN    |-
1012 * |
1013 *
1014 */
1015
1016struct mrq_clk_request {
1017        /** @brief Sub-command and clock id concatenated to 32-bit word.
1018         * - bits[31..24] is the sub-cmd.
1019         * - bits[23..0] is the clock id
1020         */
1021        uint32_t cmd_and_id;
1022
1023        union {
1024                /** @private */
1025                struct cmd_clk_get_rate_request clk_get_rate;
1026                struct cmd_clk_set_rate_request clk_set_rate;
1027                struct cmd_clk_round_rate_request clk_round_rate;
1028                /** @private */
1029                struct cmd_clk_get_parent_request clk_get_parent;
1030                struct cmd_clk_set_parent_request clk_set_parent;
1031                /** @private */
1032                struct cmd_clk_enable_request clk_enable;
1033                /** @private */
1034                struct cmd_clk_disable_request clk_disable;
1035                /** @private */
1036                struct cmd_clk_is_enabled_request clk_is_enabled;
1037                /** @private */
1038                struct cmd_clk_get_all_info_request clk_get_all_info;
1039                /** @private */
1040                struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id;
1041                /** @private */
1042                struct cmd_clk_get_fmax_at_vmin_request clk_get_fmax_at_vmin;
1043        } __UNION_ANON;
1044} __ABI_PACKED;
1045
1046/**
1047 * @ingroup Clocks
1048 * @brief Response to MRQ_CLK
1049 *
1050 * Each sub-command supported by @ref mrq_clk_request may return
1051 * sub-command-specific data. Some do and some do not as indicated in
1052 * the following table
1053 *
1054 * |sub-command                 |payload                 |
1055 * |----------------------------|------------------------|
1056 * |CMD_CLK_GET_RATE            |clk_get_rate            |
1057 * |CMD_CLK_SET_RATE            |clk_set_rate            |
1058 * |CMD_CLK_ROUND_RATE          |clk_round_rate          |
1059 * |CMD_CLK_GET_PARENT          |clk_get_parent          |
1060 * |CMD_CLK_SET_PARENT          |clk_set_parent          |
1061 * |CMD_CLK_IS_ENABLED          |clk_is_enabled          |
1062 * |CMD_CLK_ENABLE              |-                       |
1063 * |CMD_CLK_DISABLE             |-                       |
1064 * |CMD_CLK_GET_ALL_INFO        |clk_get_all_info        |
1065 * |CMD_CLK_GET_MAX_CLK_ID      |clk_get_max_id          |
1066 * |CMD_CLK_GET_FMAX_AT_VMIN    |clk_get_fmax_at_vmin    |
1067 *
1068 */
1069
1070struct mrq_clk_response {
1071        union {
1072                struct cmd_clk_get_rate_response clk_get_rate;
1073                struct cmd_clk_set_rate_response clk_set_rate;
1074                struct cmd_clk_round_rate_response clk_round_rate;
1075                struct cmd_clk_get_parent_response clk_get_parent;
1076                struct cmd_clk_set_parent_response clk_set_parent;
1077                /** @private */
1078                struct cmd_clk_enable_response clk_enable;
1079                /** @private */
1080                struct cmd_clk_disable_response clk_disable;
1081                struct cmd_clk_is_enabled_response clk_is_enabled;
1082                struct cmd_clk_get_all_info_response clk_get_all_info;
1083                struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id;
1084                struct cmd_clk_get_fmax_at_vmin_response clk_get_fmax_at_vmin;
1085        } __UNION_ANON;
1086} __ABI_PACKED;
1087
1088/** @} */
1089
1090/**
1091 * @ingroup MRQ_Codes
1092 * @def MRQ_QUERY_ABI
1093 * @brief Check if an MRQ is implemented
1094 *
1095 * * Platforms: All
1096 * * Initiators: Any
1097 * * Targets: Any except DMCE
1098 * * Request Payload: @ref mrq_query_abi_request
1099 * * Response Payload: @ref mrq_query_abi_response
1100 */
1101
1102/**
1103 * @ingroup ABI_info
1104 * @brief Request with MRQ_QUERY_ABI
1105 *
1106 * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported
1107 * by the recipient.
1108 */
1109struct mrq_query_abi_request {
1110        /** @brief MRQ code to query */
1111        uint32_t mrq;
1112} __ABI_PACKED;
1113
1114/**
1115 * @ingroup ABI_info
1116 * @brief Response to MRQ_QUERY_ABI
1117 *
1118 * @note mrq_response::err of 0 indicates that the query was
1119 * successful, not that the MRQ itself is supported!
1120 */
1121struct mrq_query_abi_response {
1122        /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */
1123        int32_t status;
1124} __ABI_PACKED;
1125
1126/**
1127 * @ingroup MRQ_Codes
1128 * @def MRQ_PG_READ_STATE
1129 * @brief Read the power-gating state of a partition
1130 *
1131 * * Platforms: T186
1132 * @cond bpmp_t186
1133 * * Initiators: Any
1134 * * Targets: BPMP
1135 * * Request Payload: @ref mrq_pg_read_state_request
1136 * * Response Payload: @ref mrq_pg_read_state_response
1137 */
1138
1139/**
1140 * @ingroup Powergating
1141 * @brief Request with #MRQ_PG_READ_STATE
1142 *
1143 * Used by MRQ_PG_READ_STATE call to read the current state of a
1144 * partition.
1145 */
1146struct mrq_pg_read_state_request {
1147        /** @brief ID of partition */
1148        uint32_t partition_id;
1149} __ABI_PACKED;
1150
1151/**
1152 * @ingroup Powergating
1153 * @brief Response to MRQ_PG_READ_STATE
1154 * @todo define possible errors.
1155 */
1156struct mrq_pg_read_state_response {
1157        /** @brief Read as don't care */
1158        uint32_t sram_state;
1159        /** @brief State of power partition
1160         * * 0 : off
1161         * * 1 : on
1162         */
1163        uint32_t logic_state;
1164} __ABI_PACKED;
1165/** @endcond*/
1166/** @} */
1167
1168/**
1169 * @ingroup MRQ_Codes
1170 * @def MRQ_PG_UPDATE_STATE
1171 * @brief Modify the power-gating state of a partition. In contrast to
1172 * MRQ_PG calls, the operations that change state (on/off) of power
1173 * partition are reference counted.
1174 *
1175 * * Platforms: T186
1176 * @cond bpmp_t186
1177 * * Initiators: Any
1178 * * Targets: BPMP
1179 * * Request Payload: @ref mrq_pg_update_state_request
1180 * * Response Payload: N/A
1181 */
1182
1183/**
1184 * @ingroup Powergating
1185 * @brief Request with mrq_pg_update_state_request
1186 *
1187 * Used by #MRQ_PG_UPDATE_STATE call to request BPMP to change the
1188 * state of a power partition #partition_id.
1189 */
1190struct mrq_pg_update_state_request {
1191        /** @brief ID of partition */
1192        uint32_t partition_id;
1193        /** @brief Secondary control of power partition
1194         *  @details Ignored by many versions of the BPMP
1195         *  firmware. For maximum compatibility, set the value
1196         *  according to @ref logic_state
1197         * *  0x1: power ON partition (@ref logic_state == 0x3)
1198         * *  0x3: power OFF partition (@ref logic_state == 0x1)
1199         */
1200        uint32_t sram_state;
1201        /** @brief Controls state of power partition, legal values are
1202         * *  0x1 : power OFF partition
1203         * *  0x3 : power ON partition
1204         */
1205        uint32_t logic_state;
1206        /** @brief Change state of clocks of the power partition, legal values
1207         * *  0x0 : do not change clock state
1208         * *  0x1 : disable partition clocks (only applicable when
1209         *          @ref logic_state == 0x1)
1210         * *  0x3 : enable partition clocks (only applicable when
1211         *          @ref logic_state == 0x3)
1212         */
1213        uint32_t clock_state;
1214} __ABI_PACKED;
1215/** @endcond*/
1216
1217/**
1218 * @ingroup MRQ_Codes
1219 * @def MRQ_PG
1220 * @brief Control power-gating state of a partition. In contrast to
1221 * MRQ_PG_UPDATE_STATE, operations that change the power partition
1222 * state are NOT reference counted
1223 *
1224 * @note BPMP-FW forcefully turns off some partitions as part of SC7 entry
1225 * because their state cannot be adequately restored on exit. Therefore,
1226 * it is recommended to power off all domains via MRQ_PG prior to SC7 entry.
1227 * See @ref bpmp_pdomain_ids for further detail.
1228 *
1229 * * Platforms: T186, T194
1230 * * Initiators: Any
1231 * * Targets: BPMP
1232 * * Request Payload: @ref mrq_pg_request
1233 * * Response Payload: @ref mrq_pg_response
1234 *
1235 * @addtogroup Powergating
1236 * @{
1237 */
1238enum mrq_pg_cmd {
1239        /**
1240         * @brief Check whether the BPMP driver supports the specified
1241         * request type
1242         *
1243         * mrq_response::err is 0 if the specified request is
1244         * supported and -#BPMP_ENODEV otherwise.
1245         */
1246        CMD_PG_QUERY_ABI = 0,
1247
1248        /**
1249         * @brief Set the current state of specified power domain. The
1250         * possible values for power domains are defined in enum
1251         * pg_states
1252         *
1253         * mrq_response:err is
1254         * 0: Success
1255         * -#BPMP_EINVAL: Invalid request parameters
1256         */
1257        CMD_PG_SET_STATE = 1,
1258
1259        /**
1260         * @brief Get the current state of specified power domain. The
1261         * possible values for power domains are defined in enum
1262         * pg_states
1263         *
1264         * mrq_response:err is
1265         * 0: Success
1266         * -#BPMP_EINVAL: Invalid request parameters
1267         */
1268        CMD_PG_GET_STATE = 2,
1269
1270        /**
1271         * @brief Get the name string of specified power domain id.
1272         *
1273         * mrq_response:err is
1274         * 0: Success
1275         * -#BPMP_EINVAL: Invalid request parameters
1276         */
1277        CMD_PG_GET_NAME = 3,
1278
1279
1280        /**
1281         * @brief Get the highest power domain id in the system. Not
1282         * all IDs between 0 and max_id are valid IDs.
1283         *
1284         * mrq_response:err is
1285         * 0: Success
1286         * -#BPMP_EINVAL: Invalid request parameters
1287         */
1288        CMD_PG_GET_MAX_ID = 4,
1289};
1290
1291#define MRQ_PG_NAME_MAXLEN      40
1292
1293enum pg_states {
1294        /** @brief Power domain is OFF */
1295        PG_STATE_OFF = 0,
1296        /** @brief Power domain is ON */
1297        PG_STATE_ON = 1,
1298        /**
1299         * @brief a legacy state where power domain and the clock
1300         * associated to the domain are ON.
1301         * This state is only supported in T186, and the use of it is
1302         * deprecated.
1303         */
1304        PG_STATE_RUNNING = 2,
1305};
1306
1307struct cmd_pg_query_abi_request {
1308        /** @ref mrq_pg_cmd */
1309        uint32_t type;
1310} __ABI_PACKED;
1311
1312struct cmd_pg_set_state_request {
1313        /** @ref pg_states */
1314        uint32_t state;
1315} __ABI_PACKED;
1316
1317struct cmd_pg_get_state_response {
1318        /** @ref pg_states */
1319        uint32_t state;
1320} __ABI_PACKED;
1321
1322struct cmd_pg_get_name_response {
1323        uint8_t name[MRQ_PG_NAME_MAXLEN];
1324} __ABI_PACKED;
1325
1326struct cmd_pg_get_max_id_response {
1327        uint32_t max_id;
1328} __ABI_PACKED;
1329
1330/**
1331 * @brief Request with #MRQ_PG
1332 *
1333 * Used by the sender of an #MRQ_PG message to control power
1334 * partitions. The pg_request is split into several sub-commands. Some
1335 * sub-commands require no additional data. Others have a sub-command
1336 * specific payload
1337 *
1338 * |sub-command                 |payload                |
1339 * |----------------------------|-----------------------|
1340 * |CMD_PG_QUERY_ABI            | query_abi             |
1341 * |CMD_PG_SET_STATE            | set_state             |
1342 * |CMD_PG_GET_STATE            | -                     |
1343 * |CMD_PG_GET_NAME             | -                     |
1344 * |CMD_PG_GET_MAX_ID           | -                     |
1345 *
1346 */
1347struct mrq_pg_request {
1348        uint32_t cmd;
1349        uint32_t id;
1350        union {
1351                struct cmd_pg_query_abi_request query_abi;
1352                struct cmd_pg_set_state_request set_state;
1353        } __UNION_ANON;
1354} __ABI_PACKED;
1355
1356/**
1357 * @brief Response to MRQ_PG
1358 *
1359 * Each sub-command supported by @ref mrq_pg_request may return
1360 * sub-command-specific data. Some do and some do not as indicated in
1361 * the following table
1362 *
1363 * |sub-command                 |payload                |
1364 * |----------------------------|-----------------------|
1365 * |CMD_PG_QUERY_ABI            | -                     |
1366 * |CMD_PG_SET_STATE            | -                     |
1367 * |CMD_PG_GET_STATE            | get_state             |
1368 * |CMD_PG_GET_NAME             | get_name              |
1369 * |CMD_PG_GET_MAX_ID           | get_max_id            |
1370 */
1371struct mrq_pg_response {
1372        union {
1373                struct cmd_pg_get_state_response get_state;
1374                struct cmd_pg_get_name_response get_name;
1375                struct cmd_pg_get_max_id_response get_max_id;
1376        } __UNION_ANON;
1377} __ABI_PACKED;
1378
1379/** @} */
1380
1381/**
1382 * @ingroup MRQ_Codes
1383 * @def MRQ_THERMAL
1384 * @brief Interact with BPMP thermal framework
1385 *
1386 * * Platforms: T186, T194
1387 * * Initiators: Any
1388 * * Targets: Any
1389 * * Request Payload: TODO
1390 * * Response Payload: TODO
1391 *
1392 * @addtogroup Thermal
1393 *
1394 * The BPMP firmware includes a thermal framework. Drivers within the
1395 * bpmp firmware register with the framework to provide thermal
1396 * zones. Each thermal zone corresponds to an entity whose temperature
1397 * can be measured. The framework also has a notion of trip points. A
1398 * trip point consists of a thermal zone id, a temperature, and a
1399 * callback routine. The framework invokes the callback when the zone
1400 * hits the indicated temperature. The BPMP firmware uses this thermal
1401 * framework interally to implement various temperature-dependent
1402 * functions.
1403 *
1404 * Software on the CPU can use #MRQ_THERMAL (with payload @ref
1405 * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal
1406 * framework. The CPU must It can query the number of supported zones,
1407 * query zone temperatures, and set trip points.
1408 *
1409 * When a trip point set by the CPU gets crossed, BPMP firmware issues
1410 * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a
1411 * payload of @ref mrq_thermal_bpmp_to_host_request.
1412 * @{
1413 */
1414enum mrq_thermal_host_to_bpmp_cmd {
1415        /**
1416         * @brief Check whether the BPMP driver supports the specified
1417         * request type.
1418         *
1419         * Host needs to supply request parameters.
1420         *
1421         * mrq_response::err is 0 if the specified request is
1422         * supported and -#BPMP_ENODEV otherwise.
1423         */
1424        CMD_THERMAL_QUERY_ABI = 0,
1425
1426        /**
1427         * @brief Get the current temperature of the specified zone.
1428         *
1429         * Host needs to supply request parameters.
1430         *
1431         * mrq_response::err is
1432         * *  0: Temperature query succeeded.
1433         * *  -#BPMP_EINVAL: Invalid request parameters.
1434         * *  -#BPMP_ENOENT: No driver registered for thermal zone..
1435         * *  -#BPMP_EFAULT: Problem reading temperature measurement.
1436         */
1437        CMD_THERMAL_GET_TEMP = 1,
1438
1439        /**
1440         * @brief Enable or disable and set the lower and upper
1441         *   thermal limits for a thermal trip point. Each zone has
1442         *   one trip point.
1443         *
1444         * Host needs to supply request parameters. Once the
1445         * temperature hits a trip point, the BPMP will send a message
1446         * to the CPU having MRQ=MRQ_THERMAL and
1447         * type=CMD_THERMAL_HOST_TRIP_REACHED
1448         *
1449         * mrq_response::err is
1450         * *  0: Trip successfully set.
1451         * *  -#BPMP_EINVAL: Invalid request parameters.
1452         * *  -#BPMP_ENOENT: No driver registered for thermal zone.
1453         * *  -#BPMP_EFAULT: Problem setting trip point.
1454         */
1455        CMD_THERMAL_SET_TRIP = 2,
1456
1457        /**
1458         * @brief Get the number of supported thermal zones.
1459         *
1460         * No request parameters required.
1461         *
1462         * mrq_response::err is always 0, indicating success.
1463         */
1464        CMD_THERMAL_GET_NUM_ZONES = 3,
1465
1466        /** @brief: number of supported host-to-bpmp commands. May
1467         * increase in future
1468         */
1469        CMD_THERMAL_HOST_TO_BPMP_NUM
1470};
1471
1472enum mrq_thermal_bpmp_to_host_cmd {
1473        /**
1474         * @brief Indication that the temperature for a zone has
1475         *   exceeded the range indicated in the thermal trip point
1476         *   for the zone.
1477         *
1478         * BPMP needs to supply request parameters. Host only needs to
1479         * acknowledge.
1480         */
1481        CMD_THERMAL_HOST_TRIP_REACHED = 100,
1482
1483        /** @brief: number of supported bpmp-to-host commands. May
1484         * increase in future
1485         */
1486        CMD_THERMAL_BPMP_TO_HOST_NUM
1487};
1488
1489/*
1490 * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI
1491 *
1492 * zone: Request type for which to check existence.
1493 */
1494struct cmd_thermal_query_abi_request {
1495        uint32_t type;
1496} __ABI_PACKED;
1497
1498/*
1499 * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP
1500 *
1501 * zone: Number of thermal zone.
1502 */
1503struct cmd_thermal_get_temp_request {
1504        uint32_t zone;
1505} __ABI_PACKED;
1506
1507/*
1508 * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP
1509 *
1510 * error: 0 if request succeeded.
1511 *      -BPMP_EINVAL if request parameters were invalid.
1512 *      -BPMP_ENOENT if no driver was registered for the specified thermal zone.
1513 *      -BPMP_EFAULT for other thermal zone driver errors.
1514 * temp: Current temperature in millicelsius.
1515 */
1516struct cmd_thermal_get_temp_response {
1517        int32_t temp;
1518} __ABI_PACKED;
1519
1520/*
1521 * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP
1522 *
1523 * zone: Number of thermal zone.
1524 * low: Temperature of lower trip point in millicelsius
1525 * high: Temperature of upper trip point in millicelsius
1526 * enabled: 1 to enable trip point, 0 to disable trip point
1527 */
1528struct cmd_thermal_set_trip_request {
1529        uint32_t zone;
1530        int32_t low;
1531        int32_t high;
1532        uint32_t enabled;
1533} __ABI_PACKED;
1534
1535/*
1536 * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED
1537 *
1538 * zone: Number of thermal zone where trip point was reached.
1539 */
1540struct cmd_thermal_host_trip_reached_request {
1541        uint32_t zone;
1542} __ABI_PACKED;
1543
1544/*
1545 * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES
1546 *
1547 * num: Number of supported thermal zones. The thermal zones are indexed
1548 *      starting from zero.
1549 */
1550struct cmd_thermal_get_num_zones_response {
1551        uint32_t num;
1552} __ABI_PACKED;
1553
1554/*
1555 * Host->BPMP request data.
1556 *
1557 * Reply type is union mrq_thermal_bpmp_to_host_response.
1558 *
1559 * type: Type of request. Values listed in enum mrq_thermal_type.
1560 * data: Request type specific parameters.
1561 */
1562struct mrq_thermal_host_to_bpmp_request {
1563        uint32_t type;
1564        union {
1565                struct cmd_thermal_query_abi_request query_abi;
1566                struct cmd_thermal_get_temp_request get_temp;
1567                struct cmd_thermal_set_trip_request set_trip;
1568        } __UNION_ANON;
1569} __ABI_PACKED;
1570
1571/*
1572 * BPMP->Host request data.
1573 *
1574 * type: Type of request. Values listed in enum mrq_thermal_type.
1575 * data: Request type specific parameters.
1576 */
1577struct mrq_thermal_bpmp_to_host_request {
1578        uint32_t type;
1579        union {
1580                struct cmd_thermal_host_trip_reached_request host_trip_reached;
1581        } __UNION_ANON;
1582} __ABI_PACKED;
1583
1584/*
1585 * Data in reply to a Host->BPMP request.
1586 */
1587union mrq_thermal_bpmp_to_host_response {
1588        struct cmd_thermal_get_temp_response get_temp;
1589        struct cmd_thermal_get_num_zones_response get_num_zones;
1590} __ABI_PACKED;
1591/** @} */
1592
1593/**
1594 * @ingroup MRQ_Codes
1595 * @def MRQ_CPU_VHINT
1596 * @brief Query CPU voltage hint data
1597 *
1598 * * Platforms: T186
1599 * @cond bpmp_t186
1600 * * Initiators: CCPLEX
1601 * * Targets: BPMP
1602 * * Request Payload: @ref mrq_cpu_vhint_request
1603 * * Response Payload: N/A
1604 *
1605 * @addtogroup Vhint
1606 * @{
1607 */
1608
1609/**
1610 * @brief Request with #MRQ_CPU_VHINT
1611 *
1612 * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data
1613 * from BPMP to memory space pointed by #addr. CCPLEX is responsible
1614 * to allocate sizeof(cpu_vhint_data) sized block of memory and
1615 * appropriately map it for BPMP before sending the request.
1616 */
1617struct mrq_cpu_vhint_request {
1618        /** @brief IOVA address for the #cpu_vhint_data */
1619        uint32_t addr;
1620        /** @brief ID of the cluster whose data is requested */
1621        uint32_t cluster_id;
1622} __ABI_PACKED;
1623
1624/**
1625 * @brief Description of the CPU v/f relation
1626 *
1627 * Used by #MRQ_CPU_VHINT call to carry data pointed by
1628 * #mrq_cpu_vhint_request::addr
1629 */
1630struct cpu_vhint_data {
1631        uint32_t ref_clk_hz; /**< reference frequency in Hz */
1632        uint16_t pdiv; /**< post divider value */
1633        uint16_t mdiv; /**< input divider value */
1634        uint16_t ndiv_max; /**< fMAX expressed with max NDIV value */
1635        /** table of ndiv values as a function of vINDEX (voltage index) */
1636        uint16_t ndiv[80];
1637        /** minimum allowed NDIV value */
1638        uint16_t ndiv_min;
1639        /** minimum allowed voltage hint value (as in vINDEX) */
1640        uint16_t vfloor;
1641        /** maximum allowed voltage hint value (as in vINDEX) */
1642        uint16_t vceil;
1643        /** post-multiplier for vindex value */
1644        uint16_t vindex_mult;
1645        /** post-divider for vindex value */
1646        uint16_t vindex_div;
1647        /** reserved for future use */
1648        uint16_t reserved[328];
1649} __ABI_PACKED;
1650/** @endcond */
1651/** @} */
1652
1653/**
1654 * @ingroup MRQ_Codes
1655 * @def MRQ_ABI_RATCHET
1656 * @brief ABI ratchet value query
1657 *
1658 * * Platforms: T186, T194
1659 * * Initiators: Any
1660 * * Targets: BPMP
1661 * * Request Payload: @ref mrq_abi_ratchet_request
1662 * * Response Payload: @ref mrq_abi_ratchet_response
1663 * @addtogroup ABI_info
1664 * @{
1665 */
1666
1667/**
1668 * @brief An ABI compatibility mechanism
1669 *
1670 * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future
1671 * revision of this header file.
1672 * 1. That future revision deprecates some MRQ
1673 * 2. That future revision introduces a breaking change to an existing
1674 *    MRQ or
1675 * 3. A bug is discovered in an existing implementation of the BPMP-FW
1676 *    (or possibly one of its clients) which warrants deprecating that
1677 *    implementation.
1678 */
1679#define BPMP_ABI_RATCHET_VALUE 3
1680
1681/**
1682 * @brief Request with #MRQ_ABI_RATCHET.
1683 *
1684 * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header
1685 * against which the requester was compiled.
1686 *
1687 * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may
1688 * reply with mrq_response::err = -#BPMP_ERANGE to indicate that
1689 * BPMP-FW cannot interoperate correctly with the requester. Requester
1690 * should cease further communication with BPMP.
1691 *
1692 * Otherwise, err shall be 0.
1693 */
1694struct mrq_abi_ratchet_request {
1695        /** @brief Requester's ratchet value */
1696        uint16_t ratchet;
1697};
1698
1699/**
1700 * @brief Response to #MRQ_ABI_RATCHET
1701 *
1702 * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header
1703 * against which BPMP firwmare was compiled.
1704 *
1705 * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE,
1706 * the requster must either interoperate with BPMP according to an ABI
1707 * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease
1708 * communication with BPMP.
1709 *
1710 * If mrq_response::err is 0 and ratchet is greater than or equal to the
1711 * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue
1712 * normal operation.
1713 */
1714struct mrq_abi_ratchet_response {
1715        /** @brief BPMP's ratchet value */
1716        uint16_t ratchet;
1717};
1718/** @} */
1719
1720/**
1721 * @ingroup MRQ_Codes
1722 * @def MRQ_EMC_DVFS_LATENCY
1723 * @brief Query frequency dependent EMC DVFS latency
1724 *
1725 * * Platforms: T186, T194
1726 * * Initiators: CCPLEX
1727 * * Targets: BPMP
1728 * * Request Payload: N/A
1729 * * Response Payload: @ref mrq_emc_dvfs_latency_response
1730 * @addtogroup EMC
1731 * @{
1732 */
1733
1734/**
1735 * @brief Used by @ref mrq_emc_dvfs_latency_response
1736 */
1737struct emc_dvfs_latency {
1738        /** @brief EMC frequency in kHz */
1739        uint32_t freq;
1740        /** @brief EMC DVFS latency in nanoseconds */
1741        uint32_t latency;
1742} __ABI_PACKED;
1743
1744#define EMC_DVFS_LATENCY_MAX_SIZE       14
1745/**
1746 * @brief Response to #MRQ_EMC_DVFS_LATENCY
1747 */
1748struct mrq_emc_dvfs_latency_response {
1749        /** @brief The number valid entries in #pairs */
1750        uint32_t num_pairs;
1751        /** @brief EMC <frequency, latency> information */
1752        struct emc_dvfs_latency pairs[EMC_DVFS_LATENCY_MAX_SIZE];
1753} __ABI_PACKED;
1754
1755/** @} */
1756
1757/**
1758 * @ingroup MRQ_Codes
1759 * @def MRQ_CPU_NDIV_LIMITS
1760 * @brief CPU freq. limits in ndiv
1761 *
1762 * * Platforms: T194 onwards
1763 * @cond bpmp_t194
1764 * * Initiators: CCPLEX
1765 * * Targets: BPMP
1766 * * Request Payload: @ref mrq_cpu_ndiv_limits_request
1767 * * Response Payload: @ref mrq_cpu_ndiv_limits_response
1768 * @addtogroup CPU
1769 * @{
1770 */
1771
1772/**
1773 * @brief Request for ndiv limits of a cluster
1774 */
1775struct mrq_cpu_ndiv_limits_request {
1776        /** @brief Enum cluster_id */
1777        uint32_t cluster_id;
1778} __ABI_PACKED;
1779
1780/**
1781 * @brief Response to #MRQ_CPU_NDIV_LIMITS
1782 */
1783struct mrq_cpu_ndiv_limits_response {
1784        /** @brief Reference frequency in Hz */
1785        uint32_t ref_clk_hz;
1786        /** @brief Post divider value */
1787        uint16_t pdiv;
1788        /** @brief Input divider value */
1789        uint16_t mdiv;
1790        /** @brief FMAX expressed with max NDIV value */
1791        uint16_t ndiv_max;
1792        /** @brief Minimum allowed NDIV value */
1793        uint16_t ndiv_min;
1794} __ABI_PACKED;
1795
1796/** @} */
1797/** @endcond */
1798
1799/**
1800 * @ingroup MRQ_Codes
1801 * @def MRQ_CPU_AUTO_CC3
1802 * @brief Query CPU cluster auto-CC3 configuration
1803 *
1804 * * Platforms: T194 onwards
1805 * @cond bpmp_t194
1806 * * Initiators: CCPLEX
1807 * * Targets: BPMP
1808 * * Request Payload: @ref mrq_cpu_auto_cc3_request
1809 * * Response Payload: @ref mrq_cpu_auto_cc3_response
1810 * @addtogroup CC3
1811 *
1812 * Queries from BPMP auto-CC3 configuration (allowed/not allowed) for a
1813 * specified cluster. CCPLEX s/w uses this information to override its own
1814 * device tree auto-CC3 settings, so that BPMP device tree is a single source of
1815 * auto-CC3 platform configuration.
1816 *
1817 * @{
1818 */
1819
1820/**
1821 * @brief Request for auto-CC3 configuration of a cluster
1822 */
1823struct mrq_cpu_auto_cc3_request {
1824        /** @brief Enum cluster_id (logical cluster id, known to CCPLEX s/w) */
1825        uint32_t cluster_id;
1826} __ABI_PACKED;
1827
1828/**
1829 * @brief Response to #MRQ_CPU_AUTO_CC3
1830 */
1831struct mrq_cpu_auto_cc3_response {
1832        /**
1833         * @brief auto-CC3 configuration
1834         *
1835         * - bits[31..10] reserved.
1836         * - bits[9..1] cc3 ndiv
1837         * - bit [0] if "1" auto-CC3 is allowed, if "0" auto-CC3 is not allowed
1838         */
1839        uint32_t auto_cc3_config;
1840} __ABI_PACKED;
1841
1842/** @} */
1843/** @endcond */
1844
1845/**
1846 * @ingroup MRQ_Codes
1847 * @def MRQ_TRACE_ITER
1848 * @brief Manage the trace iterator
1849 *
1850 * * Platforms: All
1851 * * Initiators: CCPLEX
1852 * * Targets: BPMP
1853 * * Request Payload: N/A
1854 * * Response Payload: @ref mrq_trace_iter_request
1855 * @addtogroup Trace
1856 * @{
1857 */
1858enum {
1859        /** @brief (re)start the tracing now. Ignore older events */
1860        TRACE_ITER_INIT = 0,
1861        /** @brief Clobber all events in the trace buffer */
1862        TRACE_ITER_CLEAN = 1
1863};
1864
1865/**
1866 * @brief Request with #MRQ_TRACE_ITER
1867 */
1868struct mrq_trace_iter_request {
1869        /** @brief TRACE_ITER_INIT or TRACE_ITER_CLEAN */
1870        uint32_t cmd;
1871} __ABI_PACKED;
1872
1873/** @} */
1874
1875/**
1876 * @ingroup MRQ_Codes
1877 * @def MRQ_RINGBUF_CONSOLE
1878 * @brief A ring buffer debug console for BPMP
1879 * @addtogroup RingbufConsole
1880 *
1881 * The ring buffer debug console aims to be a substitute for the UART debug
1882 * console. The debug console is implemented with two ring buffers in the
1883 * BPMP-FW, the RX (receive) and TX (transmit) buffers. Characters can be read
1884 * and written to the buffers by the host via the MRQ interface.
1885 *
1886 * @{
1887 */
1888
1889/**
1890 * @brief Maximum number of bytes transferred in a single write command to the
1891 * BPMP
1892 *
1893 * This is determined by the number of free bytes in the message struct,
1894 * rounded down to a multiple of four.
1895 */
1896#define MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN 112
1897
1898/**
1899 * @brief Maximum number of bytes transferred in a single read command to the
1900 * BPMP
1901 *
1902 * This is determined by the number of free bytes in the message struct,
1903 * rounded down to a multiple of four.
1904 */
1905#define MRQ_RINGBUF_CONSOLE_MAX_READ_LEN 116
1906
1907enum mrq_ringbuf_console_host_to_bpmp_cmd {
1908        /**
1909         * @brief Check whether the BPMP driver supports the specified request
1910         * type
1911         *
1912         * mrq_response::err is 0 if the specified request is supported and
1913         * -#BPMP_ENODEV otherwise
1914         */
1915        CMD_RINGBUF_CONSOLE_QUERY_ABI = 0,
1916        /**
1917         * @brief Perform a read operation on the BPMP TX buffer
1918         *
1919         * mrq_response::err is 0
1920         */
1921        CMD_RINGBUF_CONSOLE_READ = 1,
1922        /**
1923         * @brief Perform a write operation on the BPMP RX buffer
1924         *
1925         * mrq_response::err is 0 if the operation was successful and
1926         * -#BPMP_ENODEV otherwise
1927         */
1928        CMD_RINGBUF_CONSOLE_WRITE = 2,
1929        /**
1930         * @brief Get the length of the buffer and the physical addresses of
1931         * the buffer data and the head and tail counters
1932         *
1933         * mrq_response::err is 0 if the operation was successful and
1934         * -#BPMP_ENODEV otherwise
1935         */
1936        CMD_RINGBUF_CONSOLE_GET_FIFO = 3,
1937};
1938
1939/**
1940 * @ingroup RingbufConsole
1941 * @brief Host->BPMP request data for request type
1942 * #CMD_RINGBUF_CONSOLE_QUERY_ABI
1943 */
1944struct cmd_ringbuf_console_query_abi_req {
1945        /** @brief Command identifier to be queried */
1946        uint32_t cmd;
1947} __ABI_PACKED;
1948
1949/** @private */
1950struct cmd_ringbuf_console_query_abi_resp {
1951        EMPTY
1952} __ABI_PACKED;
1953
1954/**
1955 * @ingroup RingbufConsole
1956 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_READ
1957 */
1958struct cmd_ringbuf_console_read_req {
1959        /**
1960         * @brief Number of bytes requested to be read from the BPMP TX buffer
1961         */
1962        uint8_t len;
1963} __ABI_PACKED;
1964
1965/**
1966 * @ingroup RingbufConsole
1967 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_READ
1968 */
1969struct cmd_ringbuf_console_read_resp {
1970        /** @brief The actual data read from the BPMP TX buffer */
1971        uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_READ_LEN];
1972        /** @brief Number of bytes in cmd_ringbuf_console_read_resp::data */
1973        uint8_t len;
1974} __ABI_PACKED;
1975
1976/**
1977 * @ingroup RingbufConsole
1978 * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_WRITE
1979 */
1980struct cmd_ringbuf_console_write_req {
1981        /** @brief The actual data to be written to the BPMP RX buffer */
1982        uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN];
1983        /** @brief Number of bytes in cmd_ringbuf_console_write_req::data */
1984        uint8_t len;
1985} __ABI_PACKED;
1986
1987/**
1988 * @ingroup RingbufConsole
1989 * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_WRITE
1990 */
1991struct cmd_ringbuf_console_write_resp {
1992        /** @brief Number of bytes of available space in the BPMP RX buffer */
1993        uint32_t space_avail;
1994        /** @brief Number of bytes that were written to the BPMP RX buffer */
1995        uint8_t len;
1996} __ABI_PACKED;
1997
1998/** @private */
1999struct cmd_ringbuf_console_get_fifo_req {
2000        EMPTY
2001} __ABI_PACKED;
2002
2003/**
2004 * @ingroup RingbufConsole
2005 * @brief BPMP->Host reply data for request type #CMD_RINGBUF_CONSOLE_GET_FIFO
2006 */
2007struct cmd_ringbuf_console_get_fifo_resp {
2008        /** @brief Physical address of the BPMP TX buffer */
2009        uint64_t bpmp_tx_buf_addr;
2010        /** @brief Physical address of the BPMP TX buffer head counter */
2011        uint64_t bpmp_tx_head_addr;
2012        /** @brief Physical address of the BPMP TX buffer tail counter */
2013        uint64_t bpmp_tx_tail_addr;
2014        /** @brief Length of the BPMP TX buffer */
2015        uint32_t bpmp_tx_buf_len;
2016} __ABI_PACKED;
2017
2018/**
2019 * @ingroup RingbufConsole
2020 * @brief Host->BPMP request data.
2021 *
2022 * Reply type is union #mrq_ringbuf_console_bpmp_to_host_response .
2023 */
2024struct mrq_ringbuf_console_host_to_bpmp_request {
2025        /**
2026         * @brief Type of request. Values listed in enum
2027         * #mrq_ringbuf_console_host_to_bpmp_cmd.
2028         */
2029        uint32_t type;
2030        /** @brief  request type specific parameters. */
2031        union {
2032                struct cmd_ringbuf_console_query_abi_req query_abi;
2033                struct cmd_ringbuf_console_read_req read;
2034                struct cmd_ringbuf_console_write_req write;
2035                struct cmd_ringbuf_console_get_fifo_req get_fifo;
2036        } __UNION_ANON;
2037} __ABI_PACKED;
2038
2039/**
2040 * @ingroup RingbufConsole
2041 * @brief Host->BPMP reply data
2042 *
2043 * In response to struct #mrq_ringbuf_console_host_to_bpmp_request.
2044 */
2045union mrq_ringbuf_console_bpmp_to_host_response {
2046        struct cmd_ringbuf_console_query_abi_resp query_abi;
2047        struct cmd_ringbuf_console_read_resp read;
2048        struct cmd_ringbuf_console_write_resp write;
2049        struct cmd_ringbuf_console_get_fifo_resp get_fifo;
2050} __ABI_PACKED;
2051/** @} */
2052
2053/**
2054 * @ingroup MRQ_Codes
2055 * @def MRQ_STRAP
2056 * @brief Set a strap value controlled by BPMP
2057 *
2058 * * Platforms: T194 onwards
2059 * @cond bpmp_t194
2060 * * Initiators: CCPLEX
2061 * * Targets: BPMP
2062 * * Request Payload: @ref mrq_strap_request
2063 * * Response Payload: N/A
2064 * @addtogroup Strap
2065 *
2066 * A strap is an input that is sampled by a hardware unit during the
2067 * unit's startup process. The sampled value of a strap affects the
2068 * behavior of the unit until the unit is restarted. Many hardware
2069 * units sample their straps at the instant that their resets are
2070 * deasserted.
2071 *
2072 * BPMP owns registers which act as straps to various units. It
2073 * exposes limited control of those straps via #MRQ_STRAP.
2074 *
2075 * @{
2076 */
2077enum mrq_strap_cmd {
2078        /** @private */
2079        STRAP_RESERVED = 0,
2080        /** @brief Set a strap value */
2081        STRAP_SET = 1
2082};
2083
2084/**
2085 * @brief Request with #MRQ_STRAP
2086 */
2087struct mrq_strap_request {
2088        /** @brief @ref mrq_strap_cmd */
2089        uint32_t cmd;
2090        /** @brief Strap ID from @ref Strap_Ids */
2091        uint32_t id;
2092        /** @brief Desired value for strap (if cmd is #STRAP_SET) */
2093        uint32_t value;
2094} __ABI_PACKED;
2095
2096/**
2097 * @defgroup Strap_Ids Strap Identifiers
2098 * @}
2099 */
2100/** @endcond */
2101
2102/**
2103 * @ingroup MRQ_Codes
2104 * @def MRQ_UPHY
2105 * @brief Perform a UPHY operation
2106 *
2107 * * Platforms: T194 onwards
2108 * @cond bpmp_t194
2109 * * Initiators: CCPLEX
2110 * * Targets: BPMP
2111 * * Request Payload: @ref mrq_uphy_request
2112 * * Response Payload: @ref mrq_uphy_response
2113 *
2114 * @addtogroup UPHY
2115 * @{
2116 */
2117enum {
2118        CMD_UPHY_PCIE_LANE_MARGIN_CONTROL = 1,
2119        CMD_UPHY_PCIE_LANE_MARGIN_STATUS = 2,
2120        CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT = 3,
2121        CMD_UPHY_PCIE_CONTROLLER_STATE = 4,
2122        CMD_UPHY_MAX,
2123};
2124
2125struct cmd_uphy_margin_control_request {
2126        /** @brief Enable margin */
2127        int32_t en;
2128        /** @brief Clear the number of error and sections */
2129        int32_t clr;
2130        /** @brief Set x offset (1's complement) for left/right margin type (y should be 0) */
2131        uint32_t x;
2132        /** @brief Set y offset (1's complement) for left/right margin type (x should be 0) */
2133        uint32_t y;
2134        /** @brief Set number of bit blocks for each margin section */
2135        uint32_t nblks;
2136} __ABI_PACKED;
2137
2138struct cmd_uphy_margin_status_response {
2139        /** @brief Number of errors observed */
2140        uint32_t status;
2141} __ABI_PACKED;
2142
2143struct cmd_uphy_ep_controller_pll_init_request {
2144        /** @brief EP controller number, valid: 0, 4, 5 */
2145        uint8_t ep_controller;
2146} __ABI_PACKED;
2147
2148struct cmd_uphy_pcie_controller_state_request {
2149        /** @brief PCIE controller number, valid: 0, 1, 2, 3, 4 */
2150        uint8_t pcie_controller;
2151        uint8_t enable;
2152} __ABI_PACKED;
2153
2154/**
2155 * @ingroup UPHY
2156 * @brief Request with #MRQ_UPHY
2157 *
2158 * Used by the sender of an #MRQ_UPHY message to control UPHY Lane RX margining.
2159 * The uphy_request is split into several sub-commands. Some sub-commands
2160 * require no additional data. Others have a sub-command specific payload
2161 *
2162 * |sub-command                          |payload                                 |
2163 * |------------------------------------ |----------------------------------------|
2164 * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL    |uphy_set_margin_control                 |
2165 * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS     |                                        |
2166 * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT |cmd_uphy_ep_controller_pll_init_request |
2167 * |CMD_UPHY_PCIE_CONTROLLER_STATE       |cmd_uphy_pcie_controller_state_request  |
2168 *
2169 */
2170
2171struct mrq_uphy_request {
2172        /** @brief Lane number. */
2173        uint16_t lane;
2174        /** @brief Sub-command id. */
2175        uint16_t cmd;
2176
2177        union {
2178                struct cmd_uphy_margin_control_request uphy_set_margin_control;
2179                struct cmd_uphy_ep_controller_pll_init_request ep_ctrlr_pll_init;
2180                struct cmd_uphy_pcie_controller_state_request controller_state;
2181        } __UNION_ANON;
2182} __ABI_PACKED;
2183
2184/**
2185 * @ingroup UPHY
2186 * @brief Response to MRQ_UPHY
2187 *
2188 * Each sub-command supported by @ref mrq_uphy_request may return
2189 * sub-command-specific data. Some do and some do not as indicated in
2190 * the following table
2191 *
2192 * |sub-command                       |payload                 |
2193 * |----------------------------      |------------------------|
2194 * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL |                        |
2195 * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS  |uphy_get_margin_status  |
2196 *
2197 */
2198
2199struct mrq_uphy_response {
2200        union {
2201                struct cmd_uphy_margin_status_response uphy_get_margin_status;
2202        } __UNION_ANON;
2203} __ABI_PACKED;
2204
2205/** @} */
2206/** @endcond */
2207
2208/**
2209 * @ingroup MRQ_Codes
2210 * @def MRQ_FMON
2211 * @brief Perform a frequency monitor configuration operations
2212 *
2213 * * Platforms: T194 onwards
2214 * @cond bpmp_t194
2215 * * Initiators: CCPLEX
2216 * * Targets: BPMP
2217 * * Request Payload: @ref mrq_fmon_request
2218 * * Response Payload: @ref mrq_fmon_response
2219 *
2220 * @addtogroup FMON
2221 * @{
2222 */
2223enum {
2224        /**
2225         * @brief Clamp FMON configuration to specified rate.
2226         *
2227         * The monitored clock must be running for clamp to succeed. If
2228         * clamped, FMON configuration is preserved when clock rate
2229         * and/or state is changed.
2230         */
2231        CMD_FMON_GEAR_CLAMP = 1,
2232        /**
2233         * @brief Release clamped FMON configuration.
2234         *
2235         * Allow FMON configuration to follow monitored clock rate
2236         * and/or state changes.
2237         */
2238        CMD_FMON_GEAR_FREE = 2,
2239        /**
2240         * @brief Return rate FMON is clamped at, or 0 if FMON is not
2241         *         clamped.
2242         *
2243         * Inherently racy, since clamp state can be changed
2244         * concurrently. Useful for testing.
2245         */
2246        CMD_FMON_GEAR_GET = 3,
2247        CMD_FMON_NUM,
2248};
2249
2250struct cmd_fmon_gear_clamp_request {
2251        int32_t unused;
2252        int64_t rate;
2253} __ABI_PACKED;
2254
2255/** @private */
2256struct cmd_fmon_gear_clamp_response {
2257        EMPTY
2258} __ABI_PACKED;
2259
2260/** @private */
2261struct cmd_fmon_gear_free_request {
2262        EMPTY
2263} __ABI_PACKED;
2264
2265/** @private */
2266struct cmd_fmon_gear_free_response {
2267        EMPTY
2268} __ABI_PACKED;
2269
2270/** @private */
2271struct cmd_fmon_gear_get_request {
2272        EMPTY
2273} __ABI_PACKED;
2274
2275struct cmd_fmon_gear_get_response {
2276        int64_t rate;
2277} __ABI_PACKED;
2278
2279/**
2280 * @ingroup FMON
2281 * @brief Request with #MRQ_FMON
2282 *
2283 * Used by the sender of an #MRQ_FMON message to configure clock
2284 * frequency monitors. The FMON request is split into several
2285 * sub-commands. Some sub-commands require no additional data.
2286 * Others have a sub-command specific payload
2287 *
2288 * |sub-command                 |payload                |
2289 * |----------------------------|-----------------------|
2290 * |CMD_FMON_GEAR_CLAMP         |fmon_gear_clamp        |
2291 * |CMD_FMON_GEAR_FREE          |-                      |
2292 * |CMD_FMON_GEAR_GET           |-                      |
2293 *
2294 */
2295
2296struct mrq_fmon_request {
2297        /** @brief Sub-command and clock id concatenated to 32-bit word.
2298         * - bits[31..24] is the sub-cmd.
2299         * - bits[23..0] is monitored clock id used to select target
2300         *   FMON
2301         */
2302        uint32_t cmd_and_id;
2303
2304        union {
2305                struct cmd_fmon_gear_clamp_request fmon_gear_clamp;
2306                /** @private */
2307                struct cmd_fmon_gear_free_request fmon_gear_free;
2308                /** @private */
2309                struct cmd_fmon_gear_get_request fmon_gear_get;
2310        } __UNION_ANON;
2311} __ABI_PACKED;
2312
2313/**
2314 * @ingroup FMON
2315 * @brief Response to MRQ_FMON
2316 *
2317 * Each sub-command supported by @ref mrq_fmon_request may
2318 * return sub-command-specific data as indicated below.
2319 *
2320 * |sub-command                 |payload                 |
2321 * |----------------------------|------------------------|
2322 * |CMD_FMON_GEAR_CLAMP         |-                       |
2323 * |CMD_FMON_GEAR_FREE          |-                       |
2324 * |CMD_FMON_GEAR_GET           |fmon_gear_get           |
2325 *
2326 */
2327
2328struct mrq_fmon_response {
2329        union {
2330                /** @private */
2331                struct cmd_fmon_gear_clamp_response fmon_gear_clamp;
2332                /** @private */
2333                struct cmd_fmon_gear_free_response fmon_gear_free;
2334                struct cmd_fmon_gear_get_response fmon_gear_get;
2335        } __UNION_ANON;
2336} __ABI_PACKED;
2337
2338/** @} */
2339/** @endcond */
2340
2341/**
2342 * @ingroup MRQ_Codes
2343 * @def MRQ_EC
2344 * @brief Provide status information on faults reported by Error
2345 *        Collator (EC) to HSM.
2346 *
2347 * * Platforms: T194 onwards
2348 * @cond bpmp_t194
2349 * * Initiators: CCPLEX
2350 * * Targets: BPMP
2351 * * Request Payload: @ref mrq_ec_request
2352 * * Response Payload: @ref mrq_ec_response
2353 *
2354 * @note This MRQ ABI is under construction, and subject to change
2355 *
2356 * @addtogroup EC
2357 * @{
2358 */
2359enum {
2360        /**
2361         * @brief Retrieve specified EC status.
2362         *
2363         * mrq_response::err is 0 if the operation was successful, or @n
2364         * -#BPMP_ENODEV if target EC is not owned by BPMP @n
2365         * -#BPMP_EACCES if target EC power domain is turned off
2366         */
2367        CMD_EC_STATUS_GET = 1,
2368        CMD_EC_NUM,
2369};
2370
2371/** @brief BPMP ECs error types */
2372enum bpmp_ec_err_type {
2373        /** @brief Parity error on internal data path
2374         *
2375         *  Error descriptor @ref ec_err_simple_desc.
2376         */
2377        EC_ERR_TYPE_PARITY_INTERNAL             = 1,
2378
2379        /** @brief ECC SEC error on internal data path
2380         *
2381         *  Error descriptor @ref ec_err_simple_desc.
2382         */
2383        EC_ERR_TYPE_ECC_SEC_INTERNAL            = 2,
2384
2385        /** @brief ECC DED error on internal data path
2386         *
2387         *  Error descriptor @ref ec_err_simple_desc.
2388         */
2389        EC_ERR_TYPE_ECC_DED_INTERNAL            = 3,
2390
2391        /** @brief Comparator error
2392         *
2393         *  Error descriptor @ref ec_err_simple_desc.
2394         */
2395        EC_ERR_TYPE_COMPARATOR                  = 4,
2396
2397        /** @brief Register parity error
2398         *
2399         *  Error descriptor @ref ec_err_reg_parity_desc.
2400         */
2401        EC_ERR_TYPE_REGISTER_PARITY             = 5,
2402
2403        /** @brief Parity error from on-chip SRAM/FIFO
2404         *
2405         *  Error descriptor @ref ec_err_simple_desc.
2406         */
2407        EC_ERR_TYPE_PARITY_SRAM                 = 6,
2408
2409        /** @brief Clock Monitor error
2410         *
2411         *  Error descriptor @ref ec_err_fmon_desc.
2412         */
2413        EC_ERR_TYPE_CLOCK_MONITOR               = 9,
2414
2415        /** @brief Voltage Monitor error
2416         *
2417         *  Error descriptor @ref ec_err_vmon_desc.
2418         */
2419        EC_ERR_TYPE_VOLTAGE_MONITOR             = 10,
2420
2421        /** @brief SW Correctable error
2422         *
2423         *  Error descriptor @ref ec_err_simple_desc.
2424         */
2425        EC_ERR_TYPE_SW_CORRECTABLE              = 16,
2426
2427        /** @brief SW Uncorrectable error
2428         *
2429         *  Error descriptor @ref ec_err_simple_desc.
2430         */
2431        EC_ERR_TYPE_SW_UNCORRECTABLE            = 17,
2432
2433        /** @brief Other HW Correctable error
2434         *
2435         *  Error descriptor @ref ec_err_simple_desc.
2436         */
2437        EC_ERR_TYPE_OTHER_HW_CORRECTABLE        = 32,
2438
2439        /** @brief Other HW Uncorrectable error
2440         *
2441         *  Error descriptor @ref ec_err_simple_desc.
2442         */
2443        EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE      = 33,
2444};
2445
2446/** @brief Group of registers with parity error. */
2447enum ec_registers_group {
2448        /** @brief Functional registers group */
2449        EC_ERR_GROUP_FUNC_REG           = 0,
2450        /** @brief SCR registers group */
2451        EC_ERR_GROUP_SCR_REG            = 1,
2452};
2453
2454/**
2455 * @defgroup bpmp_ec_status_flags EC Status Flags
2456 * @addtogroup bpmp_ec_status_flags
2457 * @{
2458 */
2459/** @brief No EC error found flag */
2460#define EC_STATUS_FLAG_NO_ERROR         0x0001
2461/** @brief Last EC error found flag */
2462#define EC_STATUS_FLAG_LAST_ERROR       0x0002
2463/** @brief EC latent error flag */
2464#define EC_STATUS_FLAG_LATENT_ERROR     0x0004
2465/** @} */
2466
2467/**
2468 * @defgroup bpmp_ec_desc_flags EC Descriptor Flags
2469 * @addtogroup bpmp_ec_desc_flags
2470 * @{
2471 */
2472/** @brief EC descriptor error resolved flag */
2473#define EC_DESC_FLAG_RESOLVED           0x0001
2474/** @brief EC descriptor failed to retrieve id flag */
2475#define EC_DESC_FLAG_NO_ID              0x0002
2476/** @} */
2477
2478/**
2479 * |error type                       | fmon_clk_id values        |
2480 * |---------------------------------|---------------------------|
2481 * |@ref EC_ERR_TYPE_CLOCK_MONITOR   |@ref bpmp_clock_ids        |
2482 */
2483struct ec_err_fmon_desc {
2484        /** @brief Bitmask of @ref bpmp_ec_desc_flags  */
2485        uint16_t desc_flags;
2486        /** @brief FMON monitored clock id */
2487        uint16_t fmon_clk_id;
2488        /** @brief Bitmask of @ref bpmp_fmon_faults_flags */
2489        uint32_t fmon_faults;
2490        /** @brief FMON faults access error */
2491        int32_t fmon_access_error;
2492} __ABI_PACKED;
2493
2494/**
2495 * |error type                       | vmon_adc_id values        |
2496 * |---------------------------------|---------------------------|
2497 * |@ref EC_ERR_TYPE_VOLTAGE_MONITOR |@ref bpmp_adc_ids          |
2498 */
2499struct ec_err_vmon_desc {
2500        /** @brief Bitmask of @ref bpmp_ec_desc_flags  */
2501        uint16_t desc_flags;
2502        /** @brief VMON rail adc id */
2503        uint16_t vmon_adc_id;
2504        /** @brief Bitmask of @ref bpmp_vmon_faults_flags */
2505        uint32_t vmon_faults;
2506        /** @brief VMON faults access error */
2507        int32_t vmon_access_error;
2508} __ABI_PACKED;
2509
2510/**
2511 * |error type                       | reg_id values             |
2512 * |---------------------------------|---------------------------|
2513 * |@ref EC_ERR_TYPE_REGISTER_PARITY |@ref bpmp_ec_registers_ids |
2514 */
2515struct ec_err_reg_parity_desc {
2516        /** @brief Bitmask of @ref bpmp_ec_desc_flags  */
2517        uint16_t desc_flags;
2518        /** @brief Register id */
2519        uint16_t reg_id;
2520        /** @brief Register group @ref ec_registers_group */
2521        uint16_t reg_group;
2522} __ABI_PACKED;
2523
2524/**
2525 * |error type                              | err_source_id values      |
2526 * |----------------------------------------|---------------------------|
2527 * |@ref EC_ERR_TYPE_PARITY_INTERNAL        |@ref bpmp_ec_ipath_ids     |
2528 * |@ref EC_ERR_TYPE_ECC_SEC_INTERNAL       |@ref bpmp_ec_ipath_ids     |
2529 * |@ref EC_ERR_TYPE_ECC_DED_INTERNAL       |@ref bpmp_ec_ipath_ids     |
2530 * |@ref EC_ERR_TYPE_COMPARATOR             |@ref bpmp_ec_comparator_ids|
2531 * |@ref EC_ERR_TYPE_PARITY_SRAM            |@ref bpmp_clock_ids        |
2532 * |@ref EC_ERR_TYPE_SW_CORRECTABLE         |@ref bpmp_ec_misc_ids      |
2533 * |@ref EC_ERR_TYPE_SW_UNCORRECTABLE       |@ref bpmp_ec_misc_ids      |
2534 * |@ref EC_ERR_TYPE_OTHER_HW_CORRECTABLE   |@ref bpmp_ec_misc_ids      |
2535 * |@ref EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE |@ref bpmp_ec_misc_ids      |
2536 */
2537struct ec_err_simple_desc {
2538        /** @brief Bitmask of @ref bpmp_ec_desc_flags  */
2539        uint16_t desc_flags;
2540        /** @brief Error source id. Id space depends on error type. */
2541        uint16_t err_source_id;
2542} __ABI_PACKED;
2543
2544/** @brief Union of EC error descriptors */
2545union ec_err_desc {
2546        struct ec_err_fmon_desc fmon_desc;
2547        struct ec_err_vmon_desc vmon_desc;
2548        struct ec_err_reg_parity_desc reg_parity_desc;
2549        struct ec_err_simple_desc simple_desc;
2550} __ABI_PACKED;
2551
2552struct cmd_ec_status_get_request {
2553        /** @brief HSM error line number that identifies target EC. */
2554        uint32_t ec_hsm_id;
2555} __ABI_PACKED;
2556
2557/** EC status maximum number of descriptors */
2558#define EC_ERR_STATUS_DESC_MAX_NUM      4
2559
2560struct cmd_ec_status_get_response {
2561        /** @brief Target EC id (the same id received with request). */
2562        uint32_t ec_hsm_id;
2563        /**
2564         * @brief Bitmask of @ref bpmp_ec_status_flags
2565         *
2566         * If NO_ERROR flag is set, error_ fields should be ignored
2567         */
2568        uint32_t ec_status_flags;
2569        /** @brief Found EC error index. */
2570        uint32_t error_idx;
2571        /** @brief  Found EC error type @ref bpmp_ec_err_type. */
2572        uint32_t error_type;
2573        /** @brief  Number of returned EC error descriptors */
2574        uint32_t error_desc_num;
2575        /** @brief  EC error descriptors */
2576        union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];
2577} __ABI_PACKED;
2578
2579/**
2580 * @ingroup EC
2581 * @brief Request with #MRQ_EC
2582 *
2583 * Used by the sender of an #MRQ_EC message to access ECs owned
2584 * by BPMP.
2585 *
2586 * |sub-command                 |payload                |
2587 * |----------------------------|-----------------------|
2588 * |@ref CMD_EC_STATUS_GET      |ec_status_get          |
2589 *
2590 */
2591
2592struct mrq_ec_request {
2593        /** @brief Sub-command id. */
2594        uint32_t cmd_id;
2595
2596        union {
2597                struct cmd_ec_status_get_request ec_status_get;
2598        } __UNION_ANON;
2599} __ABI_PACKED;
2600
2601/**
2602 * @ingroup EC
2603 * @brief Response to MRQ_EC
2604 *
2605 * Each sub-command supported by @ref mrq_ec_request may return
2606 * sub-command-specific data as indicated below.
2607 *
2608 * |sub-command                 |payload                 |
2609 * |----------------------------|------------------------|
2610 * |@ref CMD_EC_STATUS_GET      |ec_status_get           |
2611 *
2612 */
2613
2614struct mrq_ec_response {
2615        union {
2616                struct cmd_ec_status_get_response ec_status_get;
2617        } __UNION_ANON;
2618} __ABI_PACKED;
2619
2620/** @} */
2621/** @endcond */
2622
2623/**
2624 * @ingroup MRQ_Codes
2625 * @def MRQ_FBVOLT_STATUS
2626 * @brief Provides status information about voltage state for fuse burning
2627 *
2628 * * Platforms: T194 onwards
2629 * @cond bpmp_t194
2630 * * Initiators: CCPLEX
2631 * * Target: BPMP
2632 * * Request Payload: None
2633 * * Response Payload: @ref mrq_fbvolt_status_response
2634 * @{
2635 */
2636
2637/**
2638 * @ingroup Fbvolt_status
2639 * @brief Response to #MRQ_FBVOLT_STATUS
2640 *
2641 * Value of #ready reflects if core voltages are in a suitable state for buring
2642 * fuses. A value of 0x1 indicates that core voltages are ready for burning
2643 * fuses. A value of 0x0 indicates that core voltages are not ready.
2644 */
2645struct mrq_fbvolt_status_response {
2646        /** @brief Bit [0:0] - ready status, bits [31:1] - reserved */
2647        uint32_t ready;
2648        /** @brief Reserved */
2649        uint32_t unused;
2650} __ABI_PACKED;
2651
2652/** @} */
2653/** @endcond */
2654
2655/**
2656 * @addtogroup Error_Codes
2657 * Negative values for mrq_response::err generally indicate some
2658 * error. The ABI defines the following error codes. Negating these
2659 * defines is an exercise left to the user.
2660 * @{
2661 */
2662
2663/** @brief No such file or directory */
2664#define BPMP_ENOENT     2
2665/** @brief No MRQ handler */
2666#define BPMP_ENOHANDLER 3
2667/** @brief I/O error */
2668#define BPMP_EIO        5
2669/** @brief Bad sub-MRQ command */
2670#define BPMP_EBADCMD    6
2671/** @brief Not enough memory */
2672#define BPMP_ENOMEM     12
2673/** @brief Permission denied */
2674#define BPMP_EACCES     13
2675/** @brief Bad address */
2676#define BPMP_EFAULT     14
2677/** @brief No such device */
2678#define BPMP_ENODEV     19
2679/** @brief Argument is a directory */
2680#define BPMP_EISDIR     21
2681/** @brief Invalid argument */
2682#define BPMP_EINVAL     22
2683/** @brief Timeout during operation */
2684#define BPMP_ETIMEDOUT  23
2685/** @brief Out of range */
2686#define BPMP_ERANGE     34
2687/** @brief Function not implemented */
2688#define  BPMP_ENOSYS    38
2689/** @brief Invalid slot */
2690#define BPMP_EBADSLT    57
2691
2692/** @} */
2693
2694#endif
2695