bpmp-abi.h 81 KB

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