bpmp-abi.h 51 KB

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