bpmp-abi.h 115 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2014-2022, 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. * Request an answer from the peer.
  69. * This should be set in mrq_request::flags for all requests targetted
  70. * at BPMP. For requests originating in BPMP, this flag is optional except
  71. * for messages targeting MCE, for which the field must be set.
  72. * When this flag is not set, the remote peer must not send a response
  73. * back.
  74. */
  75. #define BPMP_MAIL_DO_ACK (1U << 0U)
  76. /**
  77. * @ingroup MRQ_Format
  78. * Ring the sender's doorbell when responding. This should be set unless
  79. * the sender wants to poll the underlying communications layer directly.
  80. *
  81. * An optional direction that can be specified in mrq_request::flags.
  82. */
  83. #define BPMP_MAIL_RING_DB (1U << 1U)
  84. /**
  85. * @ingroup MRQ_Format
  86. * CRC present
  87. */
  88. #define BPMP_MAIL_CRC_PRESENT (1U << 2U)
  89. /**
  90. * @ingroup MRQ_Format
  91. * @brief Header for an MRQ message
  92. *
  93. * Provides the MRQ number for the MRQ message: #mrq. The remainder of
  94. * the MRQ message is a payload (immediately following the
  95. * mrq_request) whose format depends on mrq.
  96. */
  97. struct mrq_request {
  98. /** @brief MRQ number of the request */
  99. uint32_t mrq;
  100. /**
  101. * @brief 32bit word containing a number of fields as follows:
  102. *
  103. * struct {
  104. * uint8_t options:4;
  105. * uint8_t xid:4;
  106. * uint8_t payload_length;
  107. * uint16_t crc16;
  108. * };
  109. *
  110. * **options** directions to the receiver and indicates CRC presence.
  111. *
  112. * #BPMP_MAIL_DO_ACK and #BPMP_MAIL_RING_DB see documentation of respective options.
  113. * #BPMP_MAIL_CRC_PRESENT is supported on T234 and later platforms. It indicates the
  114. * crc16, xid and length fields are present when set.
  115. * Some platform configurations, especially when targeted to applications requiring
  116. * functional safety, mandate this option being set or otherwise will respond with
  117. * -BPMP_EBADMSG and ignore the request.
  118. *
  119. * **xid** is a transaction ID.
  120. *
  121. * Only used when #BPMP_MAIL_CRC_PRESENT is set.
  122. *
  123. * **payload_length** of the message expressed in bytes without the size of this header.
  124. * See table below for minimum accepted payload lengths for each MRQ.
  125. * Note: For DMCE communication, this field expresses the length as a multiple of 4 bytes
  126. * rather than bytes.
  127. *
  128. * Only used when #BPMP_MAIL_CRC_PRESENT is set.
  129. *
  130. * | MRQ | CMD | minimum payload length
  131. * | -------------------- | ------------------------------------ | ------------------------------------------ |
  132. * | MRQ_PING | | 4 |
  133. * | MRQ_THREADED_PING | | 4 |
  134. * | MRQ_RESET | any | 8 |
  135. * | MRQ_I2C | | 12 + cmd_i2c_xfer_request.data_size |
  136. * | MRQ_CLK | CMD_CLK_GET_RATE | 4 |
  137. * | MRQ_CLK | CMD_CLK_SET_RATE | 16 |
  138. * | MRQ_CLK | CMD_CLK_ROUND_RATE | 16 |
  139. * | MRQ_CLK | CMD_CLK_GET_PARENT | 4 |
  140. * | MRQ_CLK | CMD_CLK_SET_PARENT | 8 |
  141. * | MRQ_CLK | CMD_CLK_ENABLE | 4 |
  142. * | MRQ_CLK | CMD_CLK_DISABLE | 4 |
  143. * | MRQ_CLK | CMD_CLK_IS_ENABLED | 4 |
  144. * | MRQ_CLK | CMD_CLK_GET_ALL_INFO | 4 |
  145. * | MRQ_CLK | CMD_CLK_GET_MAX_CLK_ID | 4 |
  146. * | MRQ_CLK | CMD_CLK_GET_FMAX_AT_VMIN | 4 |
  147. * | MRQ_QUERY_ABI | | 4 |
  148. * | MRQ_PG | CMD_PG_QUERY_ABI | 12 |
  149. * | MRQ_PG | CMD_PG_SET_STATE | 12 |
  150. * | MRQ_PG | CMD_PG_GET_STATE | 8 |
  151. * | MRQ_PG | CMD_PG_GET_NAME | 8 |
  152. * | MRQ_PG | CMD_PG_GET_MAX_ID | 8 |
  153. * | MRQ_THERMAL | CMD_THERMAL_QUERY_ABI | 8 |
  154. * | MRQ_THERMAL | CMD_THERMAL_GET_TEMP | 8 |
  155. * | MRQ_THERMAL | CMD_THERMAL_SET_TRIP | 20 |
  156. * | MRQ_THERMAL | CMD_THERMAL_GET_NUM_ZONES | 4 |
  157. * | MRQ_THERMAL | CMD_THERMAL_GET_THERMTRIP | 8 |
  158. * | MRQ_CPU_VHINT | | 8 |
  159. * | MRQ_ABI_RATCHET | | 2 |
  160. * | MRQ_EMC_DVFS_LATENCY | | 8 |
  161. * | MRQ_EMC_DVFS_EMCHUB | | 8 |
  162. * | MRQ_EMC_DISP_RFL | | 4 |
  163. * | MRQ_BWMGR | CMD_BWMGR_QUERY_ABI | 8 |
  164. * | MRQ_BWMGR | CMD_BWMGR_CALC_RATE | 8 + 8 * bwmgr_rate_req.num_iso_clients |
  165. * | MRQ_ISO_CLIENT | CMD_ISO_CLIENT_QUERY_ABI | 8 |
  166. * | MRQ_ISO_CLIENT | CMD_ISO_CLIENT_CALCULATE_LA | 16 |
  167. * | MRQ_ISO_CLIENT | CMD_ISO_CLIENT_SET_LA | 16 |
  168. * | MRQ_ISO_CLIENT | CMD_ISO_CLIENT_GET_MAX_BW | 8 |
  169. * | MRQ_CPU_NDIV_LIMITS | | 4 |
  170. * | MRQ_CPU_AUTO_CC3 | | 4 |
  171. * | MRQ_RINGBUF_CONSOLE | CMD_RINGBUF_CONSOLE_QUERY_ABI | 8 |
  172. * | MRQ_RINGBUF_CONSOLE | CMD_RINGBUF_CONSOLE_READ | 5 |
  173. * | MRQ_RINGBUF_CONSOLE | CMD_RINGBUF_CONSOLE_WRITE | 5 + cmd_ringbuf_console_write_req.len |
  174. * | MRQ_RINGBUF_CONSOLE | CMD_RINGBUF_CONSOLE_GET_FIFO | 4 |
  175. * | MRQ_STRAP | STRAP_SET | 12 |
  176. * | MRQ_UPHY | CMD_UPHY_PCIE_LANE_MARGIN_CONTROL | 24 |
  177. * | MRQ_UPHY | CMD_UPHY_PCIE_LANE_MARGIN_STATUS | 4 |
  178. * | MRQ_UPHY | CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT | 5 |
  179. * | MRQ_UPHY | CMD_UPHY_PCIE_CONTROLLER_STATE | 6 |
  180. * | MRQ_UPHY | CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF | 5 |
  181. * | MRQ_FMON | CMD_FMON_GEAR_CLAMP | 16 |
  182. * | MRQ_FMON | CMD_FMON_GEAR_FREE | 4 |
  183. * | MRQ_FMON | CMD_FMON_GEAR_GET | 4 |
  184. * | MRQ_FMON | CMD_FMON_FAULT_STS_GET | 8 |
  185. * | MRQ_EC | CMD_EC_STATUS_EX_GET | 12 |
  186. * | MRQ_QUERY_FW_TAG | | 0 |
  187. * | MRQ_DEBUG | CMD_DEBUG_OPEN_RO | 4 + length of cmd_debug_fopen_request.name |
  188. * | MRQ_DEBUG | CMD_DEBUG_OPEN_WO | 4 + length of cmd_debug_fopen_request.name |
  189. * | MRQ_DEBUG | CMD_DEBUG_READ | 8 |
  190. * | MRQ_DEBUG | CMD_DEBUG_WRITE | 12 + cmd_debug_fwrite_request.datalen |
  191. * | MRQ_DEBUG | CMD_DEBUG_CLOSE | 8 |
  192. * | MRQ_TELEMETRY | | 8 |
  193. * | MRQ_PWR_LIMIT | CMD_PWR_LIMIT_QUERY_ABI | 8 |
  194. * | MRQ_PWR_LIMIT | CMD_PWR_LIMIT_SET | 20 |
  195. * | MRQ_PWR_LIMIT | CMD_PWR_LIMIT_GET | 16 |
  196. * | MRQ_PWR_LIMIT | CMD_PWR_LIMIT_CURR_CAP | 8 |
  197. * | MRQ_GEARS | | 0 |
  198. * | MRQ_BWMGR_INT | CMD_BWMGR_INT_QUERY_ABI | 8 |
  199. * | MRQ_BWMGR_INT | CMD_BWMGR_INT_CALC_AND_SET | 16 |
  200. * | MRQ_BWMGR_INT | CMD_BWMGR_INT_CAP_SET | 8 |
  201. * | MRQ_OC_STATUS | | 0 |
  202. *
  203. * **crc16**
  204. *
  205. * CRC16 using polynomial x^16 + x^14 + x^12 + x^11 + x^8 + x^5 + x^4 + x^2 + 1
  206. * and initialization value 0x4657. The CRC is calculated over all bytes of the message
  207. * including this header. However the crc16 field is considered to be set to 0 when
  208. * calculating the CRC. Only used when #BPMP_MAIL_CRC_PRESENT is set. If
  209. * #BPMP_MAIL_CRC_PRESENT is set and this field does not match the CRC as
  210. * calculated by BPMP, -BPMP_EBADMSG will be returned and the request will
  211. * be ignored. See code snippet below on how to calculate the CRC.
  212. *
  213. * @code
  214. * uint16_t calc_crc_digest(uint16_t crc, uint8_t *data, size_t size)
  215. * {
  216. * for (size_t i = 0; i < size; i++) {
  217. * crc ^= data[i] << 8;
  218. * for (size_t j = 0; j < 8; j++) {
  219. * if ((crc & 0x8000) == 0x8000) {
  220. * crc = (crc << 1) ^ 0xAC9A;
  221. * } else {
  222. * crc = (crc << 1);
  223. * }
  224. * }
  225. * }
  226. * return crc;
  227. * }
  228. *
  229. * uint16_t calc_crc(uint8_t *data, size_t size)
  230. * {
  231. * return calc_crc_digest(0x4657, data, size);
  232. * }
  233. * @endcode
  234. */
  235. uint32_t flags;
  236. } BPMP_ABI_PACKED;
  237. /**
  238. * @ingroup MRQ_Format
  239. * @brief Header for an MRQ response
  240. *
  241. * Provides an error code for the associated MRQ message. The
  242. * remainder of the MRQ response is a payload (immediately following
  243. * the mrq_response) whose format depends on the associated
  244. * mrq_request::mrq
  245. */
  246. struct mrq_response {
  247. /** @brief Error code for the MRQ request itself */
  248. int32_t err;
  249. /**
  250. * @brief 32bit word containing a number of fields as follows:
  251. *
  252. * struct {
  253. * uint8_t options:4;
  254. * uint8_t xid:4;
  255. * uint8_t payload_length;
  256. * uint16_t crc16;
  257. * };
  258. *
  259. * **options** indicates CRC presence.
  260. *
  261. * #BPMP_MAIL_CRC_PRESENT is supported on T234 and later platforms and
  262. * indicates the crc16 related fields are present when set.
  263. *
  264. * **xid** is the transaction ID as sent by the requestor.
  265. *
  266. * **length** of the message expressed in bytes without the size of this header.
  267. * Note: For DMCE communication, this field expresses the length as a multiple of 4 bytes
  268. * rather than bytes.
  269. *
  270. * **crc16**
  271. *
  272. * CRC16 using polynomial x^16 + x^14 + x^12 + x^11 + x^8 + x^5 + x^4 + x^2 + 1
  273. * and initialization value 0x4657. The CRC is calculated over all bytes of the message
  274. * including this header. However the crc16 field is considered to be set to 0 when
  275. * calculating the CRC. Only used when #BPMP_MAIL_CRC_PRESENT is set.
  276. */
  277. uint32_t flags;
  278. } BPMP_ABI_PACKED;
  279. /**
  280. * @ingroup MRQ_Format
  281. * Minimum needed size for an IPC message buffer
  282. */
  283. #define MSG_MIN_SZ 128U
  284. /**
  285. * @ingroup MRQ_Format
  286. * Minimum size guaranteed for data in an IPC message buffer
  287. */
  288. #define MSG_DATA_MIN_SZ 120U
  289. /**
  290. * @ingroup MRQ_Codes
  291. * @name Legal MRQ codes
  292. * These are the legal values for mrq_request::mrq
  293. * @{
  294. */
  295. #define MRQ_PING 0U
  296. #define MRQ_QUERY_TAG 1U
  297. #define MRQ_THREADED_PING 9U
  298. #define MRQ_DEBUGFS 19U
  299. #define MRQ_RESET 20U
  300. #define MRQ_I2C 21U
  301. #define MRQ_CLK 22U
  302. #define MRQ_QUERY_ABI 23U
  303. #define MRQ_THERMAL 27U
  304. #define MRQ_CPU_VHINT 28U
  305. #define MRQ_ABI_RATCHET 29U
  306. #define MRQ_EMC_DVFS_LATENCY 31U
  307. #define MRQ_RINGBUF_CONSOLE 65U
  308. #define MRQ_PG 66U
  309. #define MRQ_CPU_NDIV_LIMITS 67U
  310. #define MRQ_STRAP 68U
  311. #define MRQ_UPHY 69U
  312. #define MRQ_CPU_AUTO_CC3 70U
  313. #define MRQ_QUERY_FW_TAG 71U
  314. #define MRQ_FMON 72U
  315. #define MRQ_EC 73U
  316. #define MRQ_DEBUG 75U
  317. #define MRQ_EMC_DVFS_EMCHUB 76U
  318. #define MRQ_BWMGR 77U
  319. #define MRQ_ISO_CLIENT 78U
  320. #define MRQ_EMC_DISP_RFL 79U
  321. #define MRQ_TELEMETRY 80U
  322. #define MRQ_PWR_LIMIT 81U
  323. #define MRQ_GEARS 82U
  324. #define MRQ_BWMGR_INT 83U
  325. #define MRQ_OC_STATUS 84U
  326. /** @cond DEPRECATED */
  327. #define MRQ_RESERVED_2 2U
  328. #define MRQ_RESERVED_3 3U
  329. #define MRQ_RESERVED_4 4U
  330. #define MRQ_RESERVED_5 5U
  331. #define MRQ_RESERVED_6 6U
  332. #define MRQ_RESERVED_7 7U
  333. #define MRQ_RESERVED_8 8U
  334. #define MRQ_RESERVED_10 10U
  335. #define MRQ_RESERVED_11 11U
  336. #define MRQ_RESERVED_12 12U
  337. #define MRQ_RESERVED_13 13U
  338. #define MRQ_RESERVED_14 14U
  339. #define MRQ_RESERVED_15 15U
  340. #define MRQ_RESERVED_16 16U
  341. #define MRQ_RESERVED_17 17U
  342. #define MRQ_RESERVED_18 18U
  343. #define MRQ_RESERVED_24 24U
  344. #define MRQ_RESERVED_25 25U
  345. #define MRQ_RESERVED_26 26U
  346. #define MRQ_RESERVED_30 30U
  347. #define MRQ_RESERVED_64 64U
  348. #define MRQ_RESERVED_74 74U
  349. /** @endcond DEPRECATED */
  350. /** @} */
  351. /**
  352. * @ingroup MRQ_Codes
  353. * @brief Maximum MRQ code to be sent by CPU software to
  354. * BPMP. Subject to change in future
  355. */
  356. #define MAX_CPU_MRQ_ID 84U
  357. /**
  358. * @addtogroup MRQ_Payloads
  359. * @{
  360. * @defgroup Ping Ping
  361. * @defgroup Query_Tag Query Tag
  362. * @defgroup Module Loadable Modules
  363. * @defgroup Trace Trace
  364. * @defgroup Debugfs Debug File System
  365. * @defgroup Reset Reset
  366. * @defgroup I2C I2C
  367. * @defgroup Clocks Clocks
  368. * @defgroup ABI_info ABI Info
  369. * @defgroup Powergating Power Gating
  370. * @defgroup Thermal Thermal
  371. * @defgroup OC_status OC status
  372. * @defgroup Vhint CPU Voltage hint
  373. * @defgroup EMC EMC
  374. * @defgroup BWMGR BWMGR
  375. * @defgroup ISO_CLIENT ISO_CLIENT
  376. * @defgroup CPU NDIV Limits
  377. * @defgroup RingbufConsole Ring Buffer Console
  378. * @defgroup Strap Straps
  379. * @defgroup UPHY UPHY
  380. * @defgroup CC3 Auto-CC3
  381. * @defgroup FMON FMON
  382. * @defgroup EC EC
  383. * @defgroup Telemetry Telemetry
  384. * @defgroup Pwrlimit PWR_LIMIT
  385. * @defgroup Gears Gears
  386. * @defgroup BWMGR_INT Bandwidth Manager Integrated
  387. * @} MRQ_Payloads
  388. */
  389. /**
  390. * @ingroup MRQ_Codes
  391. * @def MRQ_PING
  392. * @brief A simple ping
  393. *
  394. * * Platforms: All
  395. * * Initiators: Any
  396. * * Targets: Any
  397. * * Request Payload: @ref mrq_ping_request
  398. * * Response Payload: @ref mrq_ping_response
  399. *
  400. * @ingroup MRQ_Codes
  401. * @def MRQ_THREADED_PING
  402. * @brief A deeper ping
  403. *
  404. * * Platforms: All
  405. * * Initiators: Any
  406. * * Targets: BPMP
  407. * * Request Payload: @ref mrq_ping_request
  408. * * Response Payload: @ref mrq_ping_response
  409. *
  410. * Behavior is equivalent to a simple #MRQ_PING except that BPMP
  411. * responds from a thread context (providing a slightly more robust
  412. * sign of life).
  413. *
  414. */
  415. /**
  416. * @ingroup Ping
  417. * @brief Request with #MRQ_PING
  418. *
  419. * Used by the sender of an #MRQ_PING message to request a pong from
  420. * recipient. The response from the recipient is computed based on
  421. * #challenge.
  422. */
  423. struct mrq_ping_request {
  424. /** @brief Arbitrarily chosen value */
  425. uint32_t challenge;
  426. } BPMP_ABI_PACKED;
  427. /**
  428. * @ingroup Ping
  429. * @brief Response to #MRQ_PING
  430. *
  431. * Sent in response to an #MRQ_PING message. #reply should be the
  432. * mrq_ping_request challenge left shifted by 1 with the carry-bit
  433. * dropped.
  434. *
  435. */
  436. struct mrq_ping_response {
  437. /** @brief Response to the MRQ_PING challege */
  438. uint32_t reply;
  439. } BPMP_ABI_PACKED;
  440. /**
  441. * @ingroup MRQ_Codes
  442. * @def MRQ_QUERY_TAG
  443. * @brief Query BPMP firmware's tag (i.e. unique identifer)
  444. *
  445. * @deprecated Use #MRQ_QUERY_FW_TAG instead.
  446. *
  447. * * Platforms: All
  448. * * Initiators: CCPLEX
  449. * * Targets: BPMP
  450. * * Request Payload: @ref mrq_query_tag_request
  451. * * Response Payload: N/A
  452. *
  453. */
  454. /**
  455. * @ingroup Query_Tag
  456. * @brief Request with #MRQ_QUERY_TAG
  457. *
  458. * @deprecated This structure will be removed in future version.
  459. * Use MRQ_QUERY_FW_TAG instead.
  460. */
  461. struct mrq_query_tag_request {
  462. /** @brief Base address to store the firmware tag */
  463. uint32_t addr;
  464. } BPMP_ABI_PACKED;
  465. /**
  466. * @ingroup MRQ_Codes
  467. * @def MRQ_QUERY_FW_TAG
  468. * @brief Query BPMP firmware's tag (i.e. unique identifier)
  469. *
  470. * * Platforms: All
  471. * * Initiators: Any
  472. * * Targets: BPMP
  473. * * Request Payload: N/A
  474. * * Response Payload: @ref mrq_query_fw_tag_response
  475. *
  476. */
  477. /**
  478. * @ingroup Query_Tag
  479. * @brief Response to #MRQ_QUERY_FW_TAG
  480. *
  481. * Sent in response to #MRQ_QUERY_FW_TAG message. #tag contains the unique
  482. * identifier for the version of firmware issuing the reply.
  483. *
  484. */
  485. struct mrq_query_fw_tag_response {
  486. /** @brief Array to store tag information */
  487. uint8_t tag[32];
  488. } BPMP_ABI_PACKED;
  489. /** @private */
  490. struct mrq_threaded_ping_request {
  491. uint32_t challenge;
  492. } BPMP_ABI_PACKED;
  493. /** @private */
  494. struct mrq_threaded_ping_response {
  495. uint32_t reply;
  496. } BPMP_ABI_PACKED;
  497. /**
  498. * @ingroup MRQ_Codes
  499. * @def MRQ_DEBUGFS
  500. * @brief Interact with BPMP's debugfs file nodes
  501. *
  502. * @deprecated use MRQ_DEBUG instead.
  503. *
  504. * * Platforms: T186, T194
  505. * * Initiators: Any
  506. * * Targets: BPMP
  507. * * Request Payload: @ref mrq_debugfs_request
  508. * * Response Payload: @ref mrq_debugfs_response
  509. */
  510. /**
  511. * @addtogroup Debugfs
  512. * @{
  513. *
  514. * The BPMP firmware implements a pseudo-filesystem called
  515. * debugfs. Any driver within the firmware may register with debugfs
  516. * to expose an arbitrary set of "files" in the filesystem. When
  517. * software on the CPU writes to a debugfs file, debugfs passes the
  518. * written data to a callback provided by the driver. When software on
  519. * the CPU reads a debugfs file, debugfs queries the driver for the
  520. * data to return to the CPU. The intention of the debugfs filesystem
  521. * is to provide information useful for debugging the system at
  522. * runtime.
  523. *
  524. * @note The files exposed via debugfs are not part of the
  525. * BPMP firmware's ABI. debugfs files may be added or removed in any
  526. * given version of the firmware. Typically the semantics of a debugfs
  527. * file are consistent from version to version but even that is not
  528. * guaranteed.
  529. *
  530. * @}
  531. */
  532. /** @ingroup Debugfs */
  533. enum mrq_debugfs_commands {
  534. /** @brief Perform read */
  535. CMD_DEBUGFS_READ = 1,
  536. /** @brief Perform write */
  537. CMD_DEBUGFS_WRITE = 2,
  538. /** @brief Perform dumping directory */
  539. CMD_DEBUGFS_DUMPDIR = 3,
  540. /** @brief Not a command */
  541. CMD_DEBUGFS_MAX
  542. };
  543. /**
  544. * @ingroup Debugfs
  545. * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
  546. */
  547. struct cmd_debugfs_fileop_request {
  548. /** @brief Physical address pointing at filename */
  549. uint32_t fnameaddr;
  550. /** @brief Length in bytes of filename buffer */
  551. uint32_t fnamelen;
  552. /** @brief Physical address pointing to data buffer */
  553. uint32_t dataaddr;
  554. /** @brief Length in bytes of data buffer */
  555. uint32_t datalen;
  556. } BPMP_ABI_PACKED;
  557. /**
  558. * @ingroup Debugfs
  559. * @brief Parameters for CMD_DEBUGFS_READ/WRITE command
  560. */
  561. struct cmd_debugfs_dumpdir_request {
  562. /** @brief Physical address pointing to data buffer */
  563. uint32_t dataaddr;
  564. /** @brief Length in bytes of data buffer */
  565. uint32_t datalen;
  566. } BPMP_ABI_PACKED;
  567. /**
  568. * @ingroup Debugfs
  569. * @brief Response data for CMD_DEBUGFS_READ/WRITE command
  570. */
  571. struct cmd_debugfs_fileop_response {
  572. /** @brief Always 0 */
  573. uint32_t reserved;
  574. /** @brief Number of bytes read from or written to data buffer */
  575. uint32_t nbytes;
  576. } BPMP_ABI_PACKED;
  577. /**
  578. * @ingroup Debugfs
  579. * @brief Response data for CMD_DEBUGFS_DUMPDIR command
  580. */
  581. struct cmd_debugfs_dumpdir_response {
  582. /** @brief Always 0 */
  583. uint32_t reserved;
  584. /** @brief Number of bytes read from or written to data buffer */
  585. uint32_t nbytes;
  586. } BPMP_ABI_PACKED;
  587. /**
  588. * @ingroup Debugfs
  589. * @brief Request with #MRQ_DEBUGFS.
  590. *
  591. * The sender of an MRQ_DEBUGFS message uses #cmd to specify a debugfs
  592. * command to execute. Legal commands are the values of @ref
  593. * mrq_debugfs_commands. Each command requires a specific additional
  594. * payload of data.
  595. *
  596. * |command |payload|
  597. * |-------------------|-------|
  598. * |CMD_DEBUGFS_READ |fop |
  599. * |CMD_DEBUGFS_WRITE |fop |
  600. * |CMD_DEBUGFS_DUMPDIR|dumpdir|
  601. */
  602. struct mrq_debugfs_request {
  603. /** @brief Sub-command (@ref mrq_debugfs_commands) */
  604. uint32_t cmd;
  605. union {
  606. struct cmd_debugfs_fileop_request fop;
  607. struct cmd_debugfs_dumpdir_request dumpdir;
  608. } BPMP_UNION_ANON;
  609. } BPMP_ABI_PACKED;
  610. /**
  611. * @ingroup Debugfs
  612. */
  613. struct mrq_debugfs_response {
  614. /** @brief Always 0 */
  615. int32_t reserved;
  616. union {
  617. /** @brief Response data for CMD_DEBUGFS_READ OR
  618. * CMD_DEBUGFS_WRITE command
  619. */
  620. struct cmd_debugfs_fileop_response fop;
  621. /** @brief Response data for CMD_DEBUGFS_DUMPDIR command */
  622. struct cmd_debugfs_dumpdir_response dumpdir;
  623. } BPMP_UNION_ANON;
  624. } BPMP_ABI_PACKED;
  625. /**
  626. * @addtogroup Debugfs
  627. * @{
  628. */
  629. #define DEBUGFS_S_ISDIR (1 << 9)
  630. #define DEBUGFS_S_IRUSR (1 << 8)
  631. #define DEBUGFS_S_IWUSR (1 << 7)
  632. /** @} Debugfs */
  633. /**
  634. * @ingroup MRQ_Codes
  635. * @def MRQ_DEBUG
  636. * @brief Interact with BPMP's debugfs file nodes. Use message payload
  637. * for exchanging data. This is functionally equivalent to
  638. * @ref MRQ_DEBUGFS. But the way in which data is exchanged is different.
  639. * When software running on CPU tries to read a debugfs file,
  640. * the file path and read data will be stored in message payload.
  641. * Since the message payload size is limited, a debugfs file
  642. * transaction might require multiple frames of data exchanged
  643. * between BPMP and CPU until the transaction completes.
  644. *
  645. * * Platforms: T194
  646. * * Initiators: Any
  647. * * Targets: BPMP
  648. * * Request Payload: @ref mrq_debug_request
  649. * * Response Payload: @ref mrq_debug_response
  650. */
  651. /** @ingroup Debugfs */
  652. enum mrq_debug_commands {
  653. /** @brief Open required file for read operation */
  654. CMD_DEBUG_OPEN_RO = 0,
  655. /** @brief Open required file for write operation */
  656. CMD_DEBUG_OPEN_WO = 1,
  657. /** @brief Perform read */
  658. CMD_DEBUG_READ = 2,
  659. /** @brief Perform write */
  660. CMD_DEBUG_WRITE = 3,
  661. /** @brief Close file */
  662. CMD_DEBUG_CLOSE = 4,
  663. /** @brief Not a command */
  664. CMD_DEBUG_MAX
  665. };
  666. /**
  667. * @ingroup Debugfs
  668. * @brief Maximum number of files that can be open at a given time
  669. */
  670. #define DEBUG_MAX_OPEN_FILES 1
  671. /**
  672. * @ingroup Debugfs
  673. * @brief Maximum size of null-terminated file name string in bytes.
  674. * Value is derived from memory available in message payload while
  675. * using @ref cmd_debug_fopen_request
  676. * Value 4 corresponds to size of @ref mrq_debug_commands
  677. * in @ref mrq_debug_request.
  678. * 120 - 4 dbg_cmd(32bit) = 116
  679. */
  680. #define DEBUG_FNAME_MAX_SZ (MSG_DATA_MIN_SZ - 4)
  681. /**
  682. * @ingroup Debugfs
  683. * @brief Parameters for CMD_DEBUG_OPEN command
  684. */
  685. struct cmd_debug_fopen_request {
  686. /** @brief File name - Null-terminated string with maximum
  687. * length @ref DEBUG_FNAME_MAX_SZ
  688. */
  689. char name[DEBUG_FNAME_MAX_SZ];
  690. } BPMP_ABI_PACKED;
  691. /**
  692. * @ingroup Debugfs
  693. * @brief Response data for CMD_DEBUG_OPEN_RO/WO command
  694. */
  695. struct cmd_debug_fopen_response {
  696. /** @brief Identifier for file access */
  697. uint32_t fd;
  698. /** @brief Data length. File data size for READ command.
  699. * Maximum allowed length for WRITE command
  700. */
  701. uint32_t datalen;
  702. } BPMP_ABI_PACKED;
  703. /**
  704. * @ingroup Debugfs
  705. * @brief Parameters for CMD_DEBUG_READ command
  706. */
  707. struct cmd_debug_fread_request {
  708. /** @brief File access identifier received in response
  709. * to CMD_DEBUG_OPEN_RO request
  710. */
  711. uint32_t fd;
  712. } BPMP_ABI_PACKED;
  713. /**
  714. * @ingroup Debugfs
  715. * @brief Maximum size of read data in bytes.
  716. * Value is derived from memory available in message payload while
  717. * using @ref cmd_debug_fread_response.
  718. */
  719. #define DEBUG_READ_MAX_SZ (MSG_DATA_MIN_SZ - 4)
  720. /**
  721. * @ingroup Debugfs
  722. * @brief Response data for CMD_DEBUG_READ command
  723. */
  724. struct cmd_debug_fread_response {
  725. /** @brief Size of data provided in this response in bytes */
  726. uint32_t readlen;
  727. /** @brief File data from seek position */
  728. char data[DEBUG_READ_MAX_SZ];
  729. } BPMP_ABI_PACKED;
  730. /**
  731. * @ingroup Debugfs
  732. * @brief Maximum size of write data in bytes.
  733. * Value is derived from memory available in message payload while
  734. * using @ref cmd_debug_fwrite_request.
  735. */
  736. #define DEBUG_WRITE_MAX_SZ (MSG_DATA_MIN_SZ - 12)
  737. /**
  738. * @ingroup Debugfs
  739. * @brief Parameters for CMD_DEBUG_WRITE command
  740. */
  741. struct cmd_debug_fwrite_request {
  742. /** @brief File access identifier received in response
  743. * to CMD_DEBUG_OPEN_RO request
  744. */
  745. uint32_t fd;
  746. /** @brief Size of write data in bytes */
  747. uint32_t datalen;
  748. /** @brief Data to be written */
  749. char data[DEBUG_WRITE_MAX_SZ];
  750. } BPMP_ABI_PACKED;
  751. /**
  752. * @ingroup Debugfs
  753. * @brief Parameters for CMD_DEBUG_CLOSE command
  754. */
  755. struct cmd_debug_fclose_request {
  756. /** @brief File access identifier received in response
  757. * to CMD_DEBUG_OPEN_RO request
  758. */
  759. uint32_t fd;
  760. } BPMP_ABI_PACKED;
  761. /**
  762. * @ingroup Debugfs
  763. * @brief Request with #MRQ_DEBUG.
  764. *
  765. * The sender of an MRQ_DEBUG message uses #cmd to specify a debugfs
  766. * command to execute. Legal commands are the values of @ref
  767. * mrq_debug_commands. Each command requires a specific additional
  768. * payload of data.
  769. *
  770. * |command |payload|
  771. * |-------------------|-------|
  772. * |CMD_DEBUG_OPEN_RO |fop |
  773. * |CMD_DEBUG_OPEN_WO |fop |
  774. * |CMD_DEBUG_READ |frd |
  775. * |CMD_DEBUG_WRITE |fwr |
  776. * |CMD_DEBUG_CLOSE |fcl |
  777. */
  778. struct mrq_debug_request {
  779. /** @brief Sub-command (@ref mrq_debug_commands) */
  780. uint32_t cmd;
  781. union {
  782. /** @brief Request payload for CMD_DEBUG_OPEN_RO/WO command */
  783. struct cmd_debug_fopen_request fop;
  784. /** @brief Request payload for CMD_DEBUG_READ command */
  785. struct cmd_debug_fread_request frd;
  786. /** @brief Request payload for CMD_DEBUG_WRITE command */
  787. struct cmd_debug_fwrite_request fwr;
  788. /** @brief Request payload for CMD_DEBUG_CLOSE command */
  789. struct cmd_debug_fclose_request fcl;
  790. } BPMP_UNION_ANON;
  791. } BPMP_ABI_PACKED;
  792. /**
  793. * @ingroup Debugfs
  794. */
  795. struct mrq_debug_response {
  796. union {
  797. /** @brief Response data for CMD_DEBUG_OPEN_RO/WO command */
  798. struct cmd_debug_fopen_response fop;
  799. /** @brief Response data for CMD_DEBUG_READ command */
  800. struct cmd_debug_fread_response frd;
  801. } BPMP_UNION_ANON;
  802. } BPMP_ABI_PACKED;
  803. /**
  804. * @ingroup MRQ_Codes
  805. * @def MRQ_RESET
  806. * @brief Reset an IP block
  807. *
  808. * * Platforms: T186, T194
  809. * * Initiators: Any
  810. * * Targets: BPMP
  811. * * Request Payload: @ref mrq_reset_request
  812. * * Response Payload: @ref mrq_reset_response
  813. *
  814. * @addtogroup Reset
  815. * @{
  816. */
  817. enum mrq_reset_commands {
  818. /**
  819. * @brief Assert module reset
  820. *
  821. * mrq_response::err is 0 if the operation was successful, or @n
  822. * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n
  823. * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n
  824. * -#BPMP_ENOTSUP if target domain h/w state does not allow reset
  825. */
  826. CMD_RESET_ASSERT = 1,
  827. /**
  828. * @brief Deassert module reset
  829. *
  830. * mrq_response::err is 0 if the operation was successful, or @n
  831. * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n
  832. * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n
  833. * -#BPMP_ENOTSUP if target domain h/w state does not allow reset
  834. */
  835. CMD_RESET_DEASSERT = 2,
  836. /**
  837. * @brief Assert and deassert the module reset
  838. *
  839. * mrq_response::err is 0 if the operation was successful, or @n
  840. * -#BPMP_EINVAL if mrq_reset_request::reset_id is invalid @n
  841. * -#BPMP_EACCES if mrq master is not an owner of target domain reset @n
  842. * -#BPMP_ENOTSUP if target domain h/w state does not allow reset
  843. */
  844. CMD_RESET_MODULE = 3,
  845. /**
  846. * @brief Get the highest reset ID
  847. *
  848. * mrq_response::err is 0 if the operation was successful, or @n
  849. * -#BPMP_ENODEV if no reset domains are supported (number of IDs is 0)
  850. */
  851. CMD_RESET_GET_MAX_ID = 4,
  852. /** @brief Not part of ABI and subject to change */
  853. CMD_RESET_MAX,
  854. };
  855. /**
  856. * @brief Request with MRQ_RESET
  857. *
  858. * Used by the sender of an #MRQ_RESET message to request BPMP to
  859. * assert or or deassert a given reset line.
  860. */
  861. struct mrq_reset_request {
  862. /** @brief Reset action to perform (@ref mrq_reset_commands) */
  863. uint32_t cmd;
  864. /** @brief Id of the reset to affected */
  865. uint32_t reset_id;
  866. } BPMP_ABI_PACKED;
  867. /**
  868. * @brief Response for MRQ_RESET sub-command CMD_RESET_GET_MAX_ID. When
  869. * this sub-command is not supported, firmware will return -BPMP_EBADCMD
  870. * in mrq_response::err.
  871. */
  872. struct cmd_reset_get_max_id_response {
  873. /** @brief Max reset id */
  874. uint32_t max_id;
  875. } BPMP_ABI_PACKED;
  876. /**
  877. * @brief Response with MRQ_RESET
  878. *
  879. * Each sub-command supported by @ref mrq_reset_request may return
  880. * sub-command-specific data. Some do and some do not as indicated
  881. * in the following table
  882. *
  883. * | sub-command | payload |
  884. * |----------------------|------------------|
  885. * | CMD_RESET_ASSERT | - |
  886. * | CMD_RESET_DEASSERT | - |
  887. * | CMD_RESET_MODULE | - |
  888. * | CMD_RESET_GET_MAX_ID | reset_get_max_id |
  889. */
  890. struct mrq_reset_response {
  891. union {
  892. struct cmd_reset_get_max_id_response reset_get_max_id;
  893. } BPMP_UNION_ANON;
  894. } BPMP_ABI_PACKED;
  895. /** @} Reset */
  896. /**
  897. * @ingroup MRQ_Codes
  898. * @def MRQ_I2C
  899. * @brief Issue an i2c transaction
  900. *
  901. * * Platforms: T186, T194
  902. * * Initiators: Any
  903. * * Targets: BPMP
  904. * * Request Payload: @ref mrq_i2c_request
  905. * * Response Payload: @ref mrq_i2c_response
  906. *
  907. * @addtogroup I2C
  908. * @{
  909. */
  910. #define TEGRA_I2C_IPC_MAX_IN_BUF_SIZE (MSG_DATA_MIN_SZ - 12U)
  911. #define TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE (MSG_DATA_MIN_SZ - 4U)
  912. #define SERIALI2C_TEN 0x0010U
  913. #define SERIALI2C_RD 0x0001U
  914. #define SERIALI2C_STOP 0x8000U
  915. #define SERIALI2C_NOSTART 0x4000U
  916. #define SERIALI2C_REV_DIR_ADDR 0x2000U
  917. #define SERIALI2C_IGNORE_NAK 0x1000U
  918. #define SERIALI2C_NO_RD_ACK 0x0800U
  919. #define SERIALI2C_RECV_LEN 0x0400U
  920. enum {
  921. CMD_I2C_XFER = 1
  922. };
  923. /**
  924. * @brief Serializable i2c request
  925. *
  926. * Instances of this structure are packed (little-endian) into
  927. * cmd_i2c_xfer_request::data_buf. Each instance represents a single
  928. * transaction (or a portion of a transaction with repeated starts) on
  929. * an i2c bus.
  930. *
  931. * Because these structures are packed, some instances are likely to
  932. * be misaligned. Additionally because #data is variable length, it is
  933. * not possible to iterate through a serialized list of these
  934. * structures without inspecting #len in each instance. It may be
  935. * easier to serialize or deserialize cmd_i2c_xfer_request::data_buf
  936. * manually rather than using this structure definition.
  937. */
  938. struct serial_i2c_request {
  939. /** @brief I2C slave address */
  940. uint16_t addr;
  941. /** @brief Bitmask of SERIALI2C_ flags */
  942. uint16_t flags;
  943. /** @brief Length of I2C transaction in bytes */
  944. uint16_t len;
  945. /** @brief For write transactions only, #len bytes of data */
  946. uint8_t data[];
  947. } BPMP_ABI_PACKED;
  948. /**
  949. * @brief Trigger one or more i2c transactions
  950. */
  951. struct cmd_i2c_xfer_request {
  952. /**
  953. * @brief Tegra PWR_I2C bus identifier
  954. *
  955. * @cond (bpmp_t234 || bpmp_t239 || bpmp_t194)
  956. * Must be set to 5.
  957. * @endcond (bpmp_t234 || bpmp_t239 || bpmp_t194)
  958. * @cond bpmp_th500
  959. * Must be set to 1.
  960. * @endcond bpmp_th500
  961. *
  962. */
  963. uint32_t bus_id;
  964. /** @brief Count of valid bytes in #data_buf*/
  965. uint32_t data_size;
  966. /** @brief Serialized packed instances of @ref serial_i2c_request*/
  967. uint8_t data_buf[TEGRA_I2C_IPC_MAX_IN_BUF_SIZE];
  968. } BPMP_ABI_PACKED;
  969. /**
  970. * @brief Container for data read from the i2c bus
  971. *
  972. * Processing an cmd_i2c_xfer_request::data_buf causes BPMP to execute
  973. * zero or more I2C reads. The data read from the bus is serialized
  974. * into #data_buf.
  975. */
  976. struct cmd_i2c_xfer_response {
  977. /** @brief Count of valid bytes in #data_buf*/
  978. uint32_t data_size;
  979. /** @brief I2c read data */
  980. uint8_t data_buf[TEGRA_I2C_IPC_MAX_OUT_BUF_SIZE];
  981. } BPMP_ABI_PACKED;
  982. /**
  983. * @brief Request with #MRQ_I2C
  984. */
  985. struct mrq_i2c_request {
  986. /** @brief Always CMD_I2C_XFER (i.e. 1) */
  987. uint32_t cmd;
  988. /** @brief Parameters of the transfer request */
  989. struct cmd_i2c_xfer_request xfer;
  990. } BPMP_ABI_PACKED;
  991. /**
  992. * @brief Response to #MRQ_I2C
  993. *
  994. * mrq_response:err is
  995. * 0: Success
  996. * -#BPMP_EBADCMD: if mrq_i2c_request::cmd is other than 1
  997. * -#BPMP_EINVAL: if cmd_i2c_xfer_request does not contain correctly formatted request
  998. * -#BPMP_ENODEV: if cmd_i2c_xfer_request::bus_id is not supported by BPMP
  999. * -#BPMP_EACCES: if i2c transaction is not allowed due to firewall rules
  1000. * -#BPMP_ETIMEDOUT: if i2c transaction times out
  1001. * -#BPMP_ENXIO: if i2c slave device does not reply with ACK to the transaction
  1002. * -#BPMP_EAGAIN: if ARB_LOST condition is detected by the i2c controller
  1003. * -#BPMP_EIO: any other i2c controller error code than NO_ACK or ARB_LOST
  1004. */
  1005. struct mrq_i2c_response {
  1006. struct cmd_i2c_xfer_response xfer;
  1007. } BPMP_ABI_PACKED;
  1008. /** @} I2C */
  1009. /**
  1010. * @ingroup MRQ_Codes
  1011. * @def MRQ_CLK
  1012. * @brief Perform a clock operation
  1013. *
  1014. * * Platforms: T186, T194
  1015. * * Initiators: Any
  1016. * * Targets: BPMP
  1017. * * Request Payload: @ref mrq_clk_request
  1018. * * Response Payload: @ref mrq_clk_response
  1019. *
  1020. * @addtogroup Clocks
  1021. * @{
  1022. */
  1023. enum {
  1024. CMD_CLK_GET_RATE = 1,
  1025. CMD_CLK_SET_RATE = 2,
  1026. CMD_CLK_ROUND_RATE = 3,
  1027. CMD_CLK_GET_PARENT = 4,
  1028. CMD_CLK_SET_PARENT = 5,
  1029. CMD_CLK_IS_ENABLED = 6,
  1030. CMD_CLK_ENABLE = 7,
  1031. CMD_CLK_DISABLE = 8,
  1032. /** @cond DEPRECATED */
  1033. CMD_CLK_PROPERTIES = 9,
  1034. CMD_CLK_POSSIBLE_PARENTS = 10,
  1035. CMD_CLK_NUM_POSSIBLE_PARENTS = 11,
  1036. CMD_CLK_GET_POSSIBLE_PARENT = 12,
  1037. CMD_CLK_RESET_REFCOUNTS = 13,
  1038. /** @endcond DEPRECATED */
  1039. CMD_CLK_GET_ALL_INFO = 14,
  1040. CMD_CLK_GET_MAX_CLK_ID = 15,
  1041. CMD_CLK_GET_FMAX_AT_VMIN = 16,
  1042. CMD_CLK_MAX,
  1043. };
  1044. #define BPMP_CLK_HAS_MUX (1U << 0U)
  1045. #define BPMP_CLK_HAS_SET_RATE (1U << 1U)
  1046. #define BPMP_CLK_IS_ROOT (1U << 2U)
  1047. #define BPMP_CLK_IS_VAR_ROOT (1U << 3U)
  1048. /**
  1049. * @brief Protection against rate and parent changes
  1050. *
  1051. * #MRQ_CLK command #CMD_CLK_SET_RATE or #MRQ_CLK command #CMD_CLK_SET_PARENT will return
  1052. * -#BPMP_EACCES.
  1053. */
  1054. #define BPMP_CLK_RATE_PARENT_CHANGE_DENIED (1U << 30)
  1055. /**
  1056. * @brief Protection against state changes
  1057. *
  1058. * #MRQ_CLK command #CMD_CLK_ENABLE or #MRQ_CLK command #CMD_CLK_DISABLE will return
  1059. * -#BPMP_EACCES.
  1060. */
  1061. #define BPMP_CLK_STATE_CHANGE_DENIED (1U << 31)
  1062. #define MRQ_CLK_NAME_MAXLEN 40U
  1063. #define MRQ_CLK_MAX_PARENTS 16U
  1064. /** @private */
  1065. struct cmd_clk_get_rate_request {
  1066. BPMP_ABI_EMPTY
  1067. } BPMP_ABI_PACKED;
  1068. struct cmd_clk_get_rate_response {
  1069. int64_t rate;
  1070. } BPMP_ABI_PACKED;
  1071. struct cmd_clk_set_rate_request {
  1072. int32_t unused;
  1073. int64_t rate;
  1074. } BPMP_ABI_PACKED;
  1075. struct cmd_clk_set_rate_response {
  1076. int64_t rate;
  1077. } BPMP_ABI_PACKED;
  1078. struct cmd_clk_round_rate_request {
  1079. int32_t unused;
  1080. int64_t rate;
  1081. } BPMP_ABI_PACKED;
  1082. struct cmd_clk_round_rate_response {
  1083. int64_t rate;
  1084. } BPMP_ABI_PACKED;
  1085. /** @private */
  1086. struct cmd_clk_get_parent_request {
  1087. BPMP_ABI_EMPTY
  1088. } BPMP_ABI_PACKED;
  1089. struct cmd_clk_get_parent_response {
  1090. uint32_t parent_id;
  1091. } BPMP_ABI_PACKED;
  1092. struct cmd_clk_set_parent_request {
  1093. uint32_t parent_id;
  1094. } BPMP_ABI_PACKED;
  1095. struct cmd_clk_set_parent_response {
  1096. uint32_t parent_id;
  1097. } BPMP_ABI_PACKED;
  1098. /** @private */
  1099. struct cmd_clk_is_enabled_request {
  1100. BPMP_ABI_EMPTY
  1101. } BPMP_ABI_PACKED;
  1102. /**
  1103. * @brief Response data to #MRQ_CLK sub-command CMD_CLK_IS_ENABLED
  1104. */
  1105. struct cmd_clk_is_enabled_response {
  1106. /**
  1107. * @brief The state of the clock that has been successfully
  1108. * requested with CMD_CLK_ENABLE or CMD_CLK_DISABLE by the
  1109. * master invoking the command earlier.
  1110. *
  1111. * The state may not reflect the physical state of the clock
  1112. * if there are some other masters requesting it to be
  1113. * enabled.
  1114. *
  1115. * Value 0 is disabled, all other values indicate enabled.
  1116. */
  1117. int32_t state;
  1118. } BPMP_ABI_PACKED;
  1119. /** @private */
  1120. struct cmd_clk_enable_request {
  1121. BPMP_ABI_EMPTY
  1122. } BPMP_ABI_PACKED;
  1123. /** @private */
  1124. struct cmd_clk_enable_response {
  1125. BPMP_ABI_EMPTY
  1126. } BPMP_ABI_PACKED;
  1127. /** @private */
  1128. struct cmd_clk_disable_request {
  1129. BPMP_ABI_EMPTY
  1130. } BPMP_ABI_PACKED;
  1131. /** @private */
  1132. struct cmd_clk_disable_response {
  1133. BPMP_ABI_EMPTY
  1134. } BPMP_ABI_PACKED;
  1135. /** @cond DEPRECATED */
  1136. /** @private */
  1137. struct cmd_clk_properties_request {
  1138. BPMP_ABI_EMPTY
  1139. } BPMP_ABI_PACKED;
  1140. /** @todo flags need to be spelled out here */
  1141. struct cmd_clk_properties_response {
  1142. uint32_t flags;
  1143. } BPMP_ABI_PACKED;
  1144. /** @private */
  1145. struct cmd_clk_possible_parents_request {
  1146. BPMP_ABI_EMPTY
  1147. } BPMP_ABI_PACKED;
  1148. struct cmd_clk_possible_parents_response {
  1149. uint8_t num_parents;
  1150. uint8_t reserved[3];
  1151. uint32_t parent_id[MRQ_CLK_MAX_PARENTS];
  1152. } BPMP_ABI_PACKED;
  1153. /** @private */
  1154. struct cmd_clk_num_possible_parents_request {
  1155. BPMP_ABI_EMPTY
  1156. } BPMP_ABI_PACKED;
  1157. struct cmd_clk_num_possible_parents_response {
  1158. uint8_t num_parents;
  1159. } BPMP_ABI_PACKED;
  1160. struct cmd_clk_get_possible_parent_request {
  1161. uint8_t parent_idx;
  1162. } BPMP_ABI_PACKED;
  1163. struct cmd_clk_get_possible_parent_response {
  1164. uint32_t parent_id;
  1165. } BPMP_ABI_PACKED;
  1166. /** @endcond DEPRECATED */
  1167. /** @private */
  1168. struct cmd_clk_get_all_info_request {
  1169. BPMP_ABI_EMPTY
  1170. } BPMP_ABI_PACKED;
  1171. struct cmd_clk_get_all_info_response {
  1172. uint32_t flags;
  1173. uint32_t parent;
  1174. uint32_t parents[MRQ_CLK_MAX_PARENTS];
  1175. uint8_t num_parents;
  1176. uint8_t name[MRQ_CLK_NAME_MAXLEN];
  1177. } BPMP_ABI_PACKED;
  1178. /** @private */
  1179. struct cmd_clk_get_max_clk_id_request {
  1180. BPMP_ABI_EMPTY
  1181. } BPMP_ABI_PACKED;
  1182. struct cmd_clk_get_max_clk_id_response {
  1183. uint32_t max_id;
  1184. } BPMP_ABI_PACKED;
  1185. /** @private */
  1186. struct cmd_clk_get_fmax_at_vmin_request {
  1187. BPMP_ABI_EMPTY
  1188. } BPMP_ABI_PACKED;
  1189. struct cmd_clk_get_fmax_at_vmin_response {
  1190. int64_t rate;
  1191. } BPMP_ABI_PACKED;
  1192. /**
  1193. * @ingroup Clocks
  1194. * @brief Request with #MRQ_CLK
  1195. *
  1196. * Used by the sender of an #MRQ_CLK message to control clocks. The
  1197. * clk_request is split into several sub-commands. Some sub-commands
  1198. * require no additional data. Others have a sub-command specific
  1199. * payload
  1200. *
  1201. * |sub-command |payload |
  1202. * |----------------------------|-----------------------|
  1203. * |CMD_CLK_GET_RATE |- |
  1204. * |CMD_CLK_SET_RATE |clk_set_rate |
  1205. * |CMD_CLK_ROUND_RATE |clk_round_rate |
  1206. * |CMD_CLK_GET_PARENT |- |
  1207. * |CMD_CLK_SET_PARENT |clk_set_parent |
  1208. * |CMD_CLK_IS_ENABLED |- |
  1209. * |CMD_CLK_ENABLE |- |
  1210. * |CMD_CLK_DISABLE |- |
  1211. * |CMD_CLK_GET_ALL_INFO |- |
  1212. * |CMD_CLK_GET_MAX_CLK_ID |- |
  1213. * |CMD_CLK_GET_FMAX_AT_VMIN |-
  1214. * |
  1215. *
  1216. */
  1217. /** @cond DEPRECATED
  1218. *
  1219. * Older versions of firmware also supported following sub-commands:
  1220. * |CMD_CLK_PROPERTIES |- |
  1221. * |CMD_CLK_POSSIBLE_PARENTS |- |
  1222. * |CMD_CLK_NUM_POSSIBLE_PARENTS|- |
  1223. * |CMD_CLK_GET_POSSIBLE_PARENT |clk_get_possible_parent|
  1224. * |CMD_CLK_RESET_REFCOUNTS |- |
  1225. *
  1226. * @endcond DEPRECATED */
  1227. struct mrq_clk_request {
  1228. /** @brief Sub-command and clock id concatenated to 32-bit word.
  1229. * - bits[31..24] is the sub-cmd.
  1230. * - bits[23..0] is the clock id
  1231. */
  1232. uint32_t cmd_and_id;
  1233. union {
  1234. /** @private */
  1235. struct cmd_clk_get_rate_request clk_get_rate;
  1236. struct cmd_clk_set_rate_request clk_set_rate;
  1237. struct cmd_clk_round_rate_request clk_round_rate;
  1238. /** @private */
  1239. struct cmd_clk_get_parent_request clk_get_parent;
  1240. struct cmd_clk_set_parent_request clk_set_parent;
  1241. /** @private */
  1242. struct cmd_clk_enable_request clk_enable;
  1243. /** @private */
  1244. struct cmd_clk_disable_request clk_disable;
  1245. /** @private */
  1246. struct cmd_clk_is_enabled_request clk_is_enabled;
  1247. /** @cond DEPRECATED */
  1248. /** @private */
  1249. struct cmd_clk_properties_request clk_properties;
  1250. /** @private */
  1251. struct cmd_clk_possible_parents_request clk_possible_parents;
  1252. /** @private */
  1253. struct cmd_clk_num_possible_parents_request clk_num_possible_parents;
  1254. struct cmd_clk_get_possible_parent_request clk_get_possible_parent;
  1255. /** @endcond DEPRECATED */
  1256. /** @private */
  1257. struct cmd_clk_get_all_info_request clk_get_all_info;
  1258. /** @private */
  1259. struct cmd_clk_get_max_clk_id_request clk_get_max_clk_id;
  1260. /** @private */
  1261. struct cmd_clk_get_fmax_at_vmin_request clk_get_fmax_at_vmin;
  1262. } BPMP_UNION_ANON;
  1263. } BPMP_ABI_PACKED;
  1264. /**
  1265. * @ingroup Clocks
  1266. * @brief Response to MRQ_CLK
  1267. *
  1268. * Each sub-command supported by @ref mrq_clk_request may return
  1269. * sub-command-specific data. Some do and some do not as indicated in
  1270. * the following table
  1271. *
  1272. * |sub-command |payload |
  1273. * |----------------------------|------------------------|
  1274. * |CMD_CLK_GET_RATE |clk_get_rate |
  1275. * |CMD_CLK_SET_RATE |clk_set_rate |
  1276. * |CMD_CLK_ROUND_RATE |clk_round_rate |
  1277. * |CMD_CLK_GET_PARENT |clk_get_parent |
  1278. * |CMD_CLK_SET_PARENT |clk_set_parent |
  1279. * |CMD_CLK_IS_ENABLED |clk_is_enabled |
  1280. * |CMD_CLK_ENABLE |- |
  1281. * |CMD_CLK_DISABLE |- |
  1282. * |CMD_CLK_GET_ALL_INFO |clk_get_all_info |
  1283. * |CMD_CLK_GET_MAX_CLK_ID |clk_get_max_id |
  1284. * |CMD_CLK_GET_FMAX_AT_VMIN |clk_get_fmax_at_vmin |
  1285. *
  1286. */
  1287. /** @cond DEPRECATED
  1288. *
  1289. * Older versions of firmware also supported following sub-commands:
  1290. * |CMD_CLK_PROPERTIES |clk_properties |
  1291. * |CMD_CLK_POSSIBLE_PARENTS |clk_possible_parents |
  1292. * |CMD_CLK_NUM_POSSIBLE_PARENTS|clk_num_possible_parents|
  1293. * |CMD_CLK_GET_POSSIBLE_PARENT |clk_get_possible_parents|
  1294. * |CMD_CLK_RESET_REFCOUNTS |- |
  1295. *
  1296. * @endcond DEPRECATED */
  1297. struct mrq_clk_response {
  1298. union {
  1299. struct cmd_clk_get_rate_response clk_get_rate;
  1300. struct cmd_clk_set_rate_response clk_set_rate;
  1301. struct cmd_clk_round_rate_response clk_round_rate;
  1302. struct cmd_clk_get_parent_response clk_get_parent;
  1303. struct cmd_clk_set_parent_response clk_set_parent;
  1304. /** @private */
  1305. struct cmd_clk_enable_response clk_enable;
  1306. /** @private */
  1307. struct cmd_clk_disable_response clk_disable;
  1308. struct cmd_clk_is_enabled_response clk_is_enabled;
  1309. /** @cond DEPRECATED */
  1310. struct cmd_clk_properties_response clk_properties;
  1311. struct cmd_clk_possible_parents_response clk_possible_parents;
  1312. struct cmd_clk_num_possible_parents_response clk_num_possible_parents;
  1313. struct cmd_clk_get_possible_parent_response clk_get_possible_parent;
  1314. /** @endcond DEPRECATED */
  1315. struct cmd_clk_get_all_info_response clk_get_all_info;
  1316. struct cmd_clk_get_max_clk_id_response clk_get_max_clk_id;
  1317. struct cmd_clk_get_fmax_at_vmin_response clk_get_fmax_at_vmin;
  1318. } BPMP_UNION_ANON;
  1319. } BPMP_ABI_PACKED;
  1320. /** @} Clocks */
  1321. /**
  1322. * @ingroup MRQ_Codes
  1323. * @def MRQ_QUERY_ABI
  1324. * @brief Check if an MRQ is implemented
  1325. *
  1326. * * Platforms: All
  1327. * * Initiators: Any
  1328. * * Targets: Any except DMCE
  1329. * * Request Payload: @ref mrq_query_abi_request
  1330. * * Response Payload: @ref mrq_query_abi_response
  1331. */
  1332. /**
  1333. * @ingroup ABI_info
  1334. * @brief Request with MRQ_QUERY_ABI
  1335. *
  1336. * Used by #MRQ_QUERY_ABI call to check if MRQ code #mrq is supported
  1337. * by the recipient.
  1338. */
  1339. struct mrq_query_abi_request {
  1340. /** @brief MRQ code to query */
  1341. uint32_t mrq;
  1342. } BPMP_ABI_PACKED;
  1343. /**
  1344. * @ingroup ABI_info
  1345. * @brief Response to MRQ_QUERY_ABI
  1346. *
  1347. * @note mrq_response::err of 0 indicates that the query was
  1348. * successful, not that the MRQ itself is supported!
  1349. */
  1350. struct mrq_query_abi_response {
  1351. /** @brief 0 if queried MRQ is supported. Else, -#BPMP_ENODEV */
  1352. int32_t status;
  1353. } BPMP_ABI_PACKED;
  1354. /**
  1355. *
  1356. * @ingroup MRQ_Codes
  1357. * @def MRQ_PG
  1358. * @brief Control power-gating state of a partition. In contrast to
  1359. * MRQ_PG_UPDATE_STATE, operations that change the power partition
  1360. * state are NOT reference counted
  1361. *
  1362. * @cond (bpmp_t194 || bpmp_t186)
  1363. * @note On T194 and earlier BPMP-FW forcefully turns off some partitions as
  1364. * part of SC7 entry because their state cannot be adequately restored on exit.
  1365. * Therefore, it is recommended to power off all domains via MRQ_PG prior to SC7
  1366. * entry.
  1367. * See @ref bpmp_pdomain_ids for further detail.
  1368. * @endcond (bpmp_t194 || bpmp_t186)
  1369. *
  1370. * * Platforms: T186, T194
  1371. * * Initiators: Any
  1372. * * Targets: BPMP
  1373. * * Request Payload: @ref mrq_pg_request
  1374. * * Response Payload: @ref mrq_pg_response
  1375. *
  1376. * @addtogroup Powergating
  1377. * @{
  1378. */
  1379. enum mrq_pg_cmd {
  1380. /**
  1381. * @brief Check whether the BPMP driver supports the specified
  1382. * request type
  1383. *
  1384. * mrq_response::err is 0 if the specified request is
  1385. * supported and -#BPMP_ENODEV otherwise.
  1386. */
  1387. CMD_PG_QUERY_ABI = 0,
  1388. /**
  1389. * @brief Set 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_SET_STATE = 1,
  1398. /**
  1399. * @brief Get the current state of specified power domain. The
  1400. * possible values for power domains are defined in enum
  1401. * pg_states
  1402. *
  1403. * mrq_response:err is
  1404. * 0: Success
  1405. * -#BPMP_EINVAL: Invalid request parameters
  1406. */
  1407. CMD_PG_GET_STATE = 2,
  1408. /**
  1409. * @brief Get the name string of specified power domain id.
  1410. *
  1411. * mrq_response:err is
  1412. * 0: Success
  1413. * -#BPMP_EINVAL: Invalid request parameters
  1414. */
  1415. CMD_PG_GET_NAME = 3,
  1416. /**
  1417. * @brief Get the highest power domain id in the system. Not
  1418. * all IDs between 0 and max_id are valid IDs.
  1419. *
  1420. * mrq_response:err is
  1421. * 0: Success
  1422. * -#BPMP_EINVAL: Invalid request parameters
  1423. */
  1424. CMD_PG_GET_MAX_ID = 4,
  1425. };
  1426. #define MRQ_PG_NAME_MAXLEN 40
  1427. enum pg_states {
  1428. /** @brief Power domain is OFF */
  1429. PG_STATE_OFF = 0,
  1430. /** @brief Power domain is ON */
  1431. PG_STATE_ON = 1,
  1432. /**
  1433. * @brief a legacy state where power domain and the clock
  1434. * associated to the domain are ON.
  1435. * This state is only supported in T186, and the use of it is
  1436. * deprecated.
  1437. */
  1438. PG_STATE_RUNNING = 2,
  1439. };
  1440. struct cmd_pg_query_abi_request {
  1441. /** @ref mrq_pg_cmd */
  1442. uint32_t type;
  1443. } BPMP_ABI_PACKED;
  1444. struct cmd_pg_set_state_request {
  1445. /** @ref pg_states */
  1446. uint32_t state;
  1447. } BPMP_ABI_PACKED;
  1448. /**
  1449. * @brief Response data to #MRQ_PG sub command #CMD_PG_GET_STATE
  1450. */
  1451. struct cmd_pg_get_state_response {
  1452. /**
  1453. * @brief The state of the power partition that has been
  1454. * succesfuly requested by the master earlier using #MRQ_PG
  1455. * command #CMD_PG_SET_STATE.
  1456. *
  1457. * The state may not reflect the physical state of the power
  1458. * partition if there are some other masters requesting it to
  1459. * be enabled.
  1460. *
  1461. * See @ref pg_states for possible values
  1462. */
  1463. uint32_t state;
  1464. } BPMP_ABI_PACKED;
  1465. struct cmd_pg_get_name_response {
  1466. uint8_t name[MRQ_PG_NAME_MAXLEN];
  1467. } BPMP_ABI_PACKED;
  1468. struct cmd_pg_get_max_id_response {
  1469. uint32_t max_id;
  1470. } BPMP_ABI_PACKED;
  1471. /**
  1472. * @brief Request with #MRQ_PG
  1473. *
  1474. * Used by the sender of an #MRQ_PG message to control power
  1475. * partitions. The pg_request is split into several sub-commands. Some
  1476. * sub-commands require no additional data. Others have a sub-command
  1477. * specific payload
  1478. *
  1479. * |sub-command |payload |
  1480. * |----------------------------|-----------------------|
  1481. * |CMD_PG_QUERY_ABI | query_abi |
  1482. * |CMD_PG_SET_STATE | set_state |
  1483. * |CMD_PG_GET_STATE | - |
  1484. * |CMD_PG_GET_NAME | - |
  1485. * |CMD_PG_GET_MAX_ID | - |
  1486. *
  1487. */
  1488. struct mrq_pg_request {
  1489. uint32_t cmd;
  1490. uint32_t id;
  1491. union {
  1492. struct cmd_pg_query_abi_request query_abi;
  1493. struct cmd_pg_set_state_request set_state;
  1494. } BPMP_UNION_ANON;
  1495. } BPMP_ABI_PACKED;
  1496. /**
  1497. * @brief Response to MRQ_PG
  1498. *
  1499. * Each sub-command supported by @ref mrq_pg_request may return
  1500. * sub-command-specific data. Some do and some do not as indicated in
  1501. * the following table
  1502. *
  1503. * |sub-command |payload |
  1504. * |----------------------------|-----------------------|
  1505. * |CMD_PG_QUERY_ABI | - |
  1506. * |CMD_PG_SET_STATE | - |
  1507. * |CMD_PG_GET_STATE | get_state |
  1508. * |CMD_PG_GET_NAME | get_name |
  1509. * |CMD_PG_GET_MAX_ID | get_max_id |
  1510. */
  1511. struct mrq_pg_response {
  1512. union {
  1513. struct cmd_pg_get_state_response get_state;
  1514. struct cmd_pg_get_name_response get_name;
  1515. struct cmd_pg_get_max_id_response get_max_id;
  1516. } BPMP_UNION_ANON;
  1517. } BPMP_ABI_PACKED;
  1518. /** @} Powergating */
  1519. /**
  1520. * @ingroup MRQ_Codes
  1521. * @def MRQ_THERMAL
  1522. * @brief Interact with BPMP thermal framework
  1523. *
  1524. * * Platforms: T186, T194
  1525. * * Initiators: Any
  1526. * * Targets: Any
  1527. * * Request Payload: TODO
  1528. * * Response Payload: TODO
  1529. *
  1530. * @addtogroup Thermal
  1531. *
  1532. * The BPMP firmware includes a thermal framework. Drivers within the
  1533. * bpmp firmware register with the framework to provide thermal
  1534. * zones. Each thermal zone corresponds to an entity whose temperature
  1535. * can be measured. The framework also has a notion of trip points. A
  1536. * trip point consists of a thermal zone id, a temperature, and a
  1537. * callback routine. The framework invokes the callback when the zone
  1538. * hits the indicated temperature. The BPMP firmware uses this thermal
  1539. * framework interally to implement various temperature-dependent
  1540. * functions.
  1541. *
  1542. * Software on the CPU can use #MRQ_THERMAL (with payload @ref
  1543. * mrq_thermal_host_to_bpmp_request) to interact with the BPMP thermal
  1544. * framework. The CPU must It can query the number of supported zones,
  1545. * query zone temperatures, and set trip points.
  1546. *
  1547. * When a trip point set by the CPU gets crossed, BPMP firmware issues
  1548. * an IPC to the CPU having mrq_request::mrq = #MRQ_THERMAL and a
  1549. * payload of @ref mrq_thermal_bpmp_to_host_request.
  1550. * @{
  1551. */
  1552. enum mrq_thermal_host_to_bpmp_cmd {
  1553. /**
  1554. * @brief Check whether the BPMP driver supports the specified
  1555. * request type.
  1556. *
  1557. * Host needs to supply request parameters.
  1558. *
  1559. * mrq_response::err is 0 if the specified request is
  1560. * supported and -#BPMP_ENODEV otherwise.
  1561. */
  1562. CMD_THERMAL_QUERY_ABI = 0,
  1563. /**
  1564. * @brief Get the current temperature of the specified zone.
  1565. *
  1566. * Host needs to supply request parameters.
  1567. *
  1568. * mrq_response::err is
  1569. * * 0: Temperature query succeeded.
  1570. * * -#BPMP_EINVAL: Invalid request parameters.
  1571. * * -#BPMP_ENOENT: No driver registered for thermal zone..
  1572. * * -#BPMP_EFAULT: Problem reading temperature measurement.
  1573. */
  1574. CMD_THERMAL_GET_TEMP = 1,
  1575. /**
  1576. * @brief Enable or disable and set the lower and upper
  1577. * thermal limits for a thermal trip point. Each zone has
  1578. * one trip point.
  1579. *
  1580. * Host needs to supply request parameters. Once the
  1581. * temperature hits a trip point, the BPMP will send a message
  1582. * to the CPU having MRQ=MRQ_THERMAL and
  1583. * type=CMD_THERMAL_HOST_TRIP_REACHED
  1584. *
  1585. * mrq_response::err is
  1586. * * 0: Trip successfully set.
  1587. * * -#BPMP_EINVAL: Invalid request parameters.
  1588. * * -#BPMP_ENOENT: No driver registered for thermal zone.
  1589. * * -#BPMP_EFAULT: Problem setting trip point.
  1590. */
  1591. CMD_THERMAL_SET_TRIP = 2,
  1592. /**
  1593. * @brief Get the number of supported thermal zones.
  1594. *
  1595. * No request parameters required.
  1596. *
  1597. * mrq_response::err is always 0, indicating success.
  1598. */
  1599. CMD_THERMAL_GET_NUM_ZONES = 3,
  1600. /**
  1601. * @brief Get the thermtrip of the specified zone.
  1602. *
  1603. * Host needs to supply request parameters.
  1604. *
  1605. * mrq_response::err is
  1606. * * 0: Valid zone information returned.
  1607. * * -#BPMP_EINVAL: Invalid request parameters.
  1608. * * -#BPMP_ENOENT: No driver registered for thermal zone.
  1609. * * -#BPMP_ERANGE if thermtrip is invalid or disabled.
  1610. * * -#BPMP_EFAULT: Problem reading zone information.
  1611. */
  1612. CMD_THERMAL_GET_THERMTRIP = 4,
  1613. /** @brief: number of supported host-to-bpmp commands. May
  1614. * increase in future
  1615. */
  1616. CMD_THERMAL_HOST_TO_BPMP_NUM
  1617. };
  1618. enum mrq_thermal_bpmp_to_host_cmd {
  1619. /**
  1620. * @brief Indication that the temperature for a zone has
  1621. * exceeded the range indicated in the thermal trip point
  1622. * for the zone.
  1623. *
  1624. * BPMP needs to supply request parameters. Host only needs to
  1625. * acknowledge.
  1626. */
  1627. CMD_THERMAL_HOST_TRIP_REACHED = 100,
  1628. /** @brief: number of supported bpmp-to-host commands. May
  1629. * increase in future
  1630. */
  1631. CMD_THERMAL_BPMP_TO_HOST_NUM
  1632. };
  1633. /*
  1634. * Host->BPMP request data for request type CMD_THERMAL_QUERY_ABI
  1635. *
  1636. * zone: Request type for which to check existence.
  1637. */
  1638. struct cmd_thermal_query_abi_request {
  1639. uint32_t type;
  1640. } BPMP_ABI_PACKED;
  1641. /*
  1642. * Host->BPMP request data for request type CMD_THERMAL_GET_TEMP
  1643. *
  1644. * zone: Number of thermal zone.
  1645. */
  1646. struct cmd_thermal_get_temp_request {
  1647. uint32_t zone;
  1648. } BPMP_ABI_PACKED;
  1649. /*
  1650. * BPMP->Host reply data for request CMD_THERMAL_GET_TEMP
  1651. *
  1652. * error: 0 if request succeeded.
  1653. * -BPMP_EINVAL if request parameters were invalid.
  1654. * -BPMP_ENOENT if no driver was registered for the specified thermal zone.
  1655. * -BPMP_EFAULT for other thermal zone driver errors.
  1656. * temp: Current temperature in millicelsius.
  1657. */
  1658. struct cmd_thermal_get_temp_response {
  1659. int32_t temp;
  1660. } BPMP_ABI_PACKED;
  1661. /*
  1662. * Host->BPMP request data for request type CMD_THERMAL_SET_TRIP
  1663. *
  1664. * zone: Number of thermal zone.
  1665. * low: Temperature of lower trip point in millicelsius
  1666. * high: Temperature of upper trip point in millicelsius
  1667. * enabled: 1 to enable trip point, 0 to disable trip point
  1668. */
  1669. struct cmd_thermal_set_trip_request {
  1670. uint32_t zone;
  1671. int32_t low;
  1672. int32_t high;
  1673. uint32_t enabled;
  1674. } BPMP_ABI_PACKED;
  1675. /*
  1676. * BPMP->Host request data for request type CMD_THERMAL_HOST_TRIP_REACHED
  1677. *
  1678. * zone: Number of thermal zone where trip point was reached.
  1679. */
  1680. struct cmd_thermal_host_trip_reached_request {
  1681. uint32_t zone;
  1682. } BPMP_ABI_PACKED;
  1683. /*
  1684. * BPMP->Host reply data for request type CMD_THERMAL_GET_NUM_ZONES
  1685. *
  1686. * num: Number of supported thermal zones. The thermal zones are indexed
  1687. * starting from zero.
  1688. */
  1689. struct cmd_thermal_get_num_zones_response {
  1690. uint32_t num;
  1691. } BPMP_ABI_PACKED;
  1692. /*
  1693. * Host->BPMP request data for request type CMD_THERMAL_GET_THERMTRIP
  1694. *
  1695. * zone: Number of thermal zone.
  1696. */
  1697. struct cmd_thermal_get_thermtrip_request {
  1698. uint32_t zone;
  1699. } BPMP_ABI_PACKED;
  1700. /*
  1701. * BPMP->Host reply data for request CMD_THERMAL_GET_THERMTRIP
  1702. *
  1703. * thermtrip: HW shutdown temperature in millicelsius.
  1704. */
  1705. struct cmd_thermal_get_thermtrip_response {
  1706. int32_t thermtrip;
  1707. } BPMP_ABI_PACKED;
  1708. /*
  1709. * Host->BPMP request data.
  1710. *
  1711. * Reply type is union mrq_thermal_bpmp_to_host_response.
  1712. *
  1713. * type: Type of request. Values listed in enum mrq_thermal_type.
  1714. * data: Request type specific parameters.
  1715. */
  1716. struct mrq_thermal_host_to_bpmp_request {
  1717. uint32_t type;
  1718. union {
  1719. struct cmd_thermal_query_abi_request query_abi;
  1720. struct cmd_thermal_get_temp_request get_temp;
  1721. struct cmd_thermal_set_trip_request set_trip;
  1722. struct cmd_thermal_get_thermtrip_request get_thermtrip;
  1723. } BPMP_UNION_ANON;
  1724. } BPMP_ABI_PACKED;
  1725. /*
  1726. * BPMP->Host request data.
  1727. *
  1728. * type: Type of request. Values listed in enum mrq_thermal_type.
  1729. * data: Request type specific parameters.
  1730. */
  1731. struct mrq_thermal_bpmp_to_host_request {
  1732. uint32_t type;
  1733. union {
  1734. struct cmd_thermal_host_trip_reached_request host_trip_reached;
  1735. } BPMP_UNION_ANON;
  1736. } BPMP_ABI_PACKED;
  1737. /*
  1738. * Data in reply to a Host->BPMP request.
  1739. */
  1740. union mrq_thermal_bpmp_to_host_response {
  1741. struct cmd_thermal_get_temp_response get_temp;
  1742. struct cmd_thermal_get_thermtrip_response get_thermtrip;
  1743. struct cmd_thermal_get_num_zones_response get_num_zones;
  1744. } BPMP_ABI_PACKED;
  1745. /** @} Thermal */
  1746. /**
  1747. * @ingroup MRQ_Codes
  1748. * @def MRQ_OC_STATUS
  1749. * @brief Query over current status
  1750. *
  1751. * * Platforms: T234
  1752. * @cond bpmp_t234
  1753. * * Initiators: CCPLEX
  1754. * * Targets: BPMP
  1755. * * Request Payload: N/A
  1756. * * Response Payload: @ref mrq_oc_status_response
  1757. *
  1758. * @addtogroup OC_status
  1759. * @{
  1760. */
  1761. #define OC_STATUS_MAX_SIZE 24U
  1762. /*
  1763. * @brief Response to #MRQ_OC_STATUS
  1764. *
  1765. * throt_en: Value for each OC alarm where zero signifies throttle is
  1766. * disabled, and non-zero throttle is enabled.
  1767. * event_cnt: Total number of OC events for each OC alarm.
  1768. *
  1769. * mrq_response::err is 0 if the operation was successful and
  1770. * -#BPMP_ENODEV otherwise.
  1771. */
  1772. struct mrq_oc_status_response {
  1773. uint8_t throt_en[OC_STATUS_MAX_SIZE];
  1774. uint32_t event_cnt[OC_STATUS_MAX_SIZE];
  1775. } BPMP_ABI_PACKED;
  1776. /** @} OC_status */
  1777. /** @endcond bpmp_t234 */
  1778. /**
  1779. * @ingroup MRQ_Codes
  1780. * @def MRQ_CPU_VHINT
  1781. * @brief Query CPU voltage hint data
  1782. *
  1783. * * Platforms: T186
  1784. * @cond bpmp_t186
  1785. * * Initiators: CCPLEX
  1786. * * Targets: BPMP
  1787. * * Request Payload: @ref mrq_cpu_vhint_request
  1788. * * Response Payload: N/A
  1789. *
  1790. * @addtogroup Vhint
  1791. * @{
  1792. */
  1793. /**
  1794. * @brief Request with #MRQ_CPU_VHINT
  1795. *
  1796. * Used by #MRQ_CPU_VHINT call by CCPLEX to retrieve voltage hint data
  1797. * from BPMP to memory space pointed by #addr. CCPLEX is responsible
  1798. * to allocate sizeof(cpu_vhint_data) sized block of memory and
  1799. * appropriately map it for BPMP before sending the request.
  1800. */
  1801. struct mrq_cpu_vhint_request {
  1802. /** @brief IOVA address for the #cpu_vhint_data */
  1803. uint32_t addr;
  1804. /** @brief ID of the cluster whose data is requested */
  1805. uint32_t cluster_id;
  1806. } BPMP_ABI_PACKED;
  1807. /**
  1808. * @brief Description of the CPU v/f relation
  1809. *
  1810. * Used by #MRQ_CPU_VHINT call to carry data pointed by
  1811. * #mrq_cpu_vhint_request::addr
  1812. */
  1813. struct cpu_vhint_data {
  1814. uint32_t ref_clk_hz; /**< reference frequency in Hz */
  1815. uint16_t pdiv; /**< post divider value */
  1816. uint16_t mdiv; /**< input divider value */
  1817. uint16_t ndiv_max; /**< fMAX expressed with max NDIV value */
  1818. /** table of ndiv values as a function of vINDEX (voltage index) */
  1819. uint16_t ndiv[80];
  1820. /** minimum allowed NDIV value */
  1821. uint16_t ndiv_min;
  1822. /** minimum allowed voltage hint value (as in vINDEX) */
  1823. uint16_t vfloor;
  1824. /** maximum allowed voltage hint value (as in vINDEX) */
  1825. uint16_t vceil;
  1826. /** post-multiplier for vindex value */
  1827. uint16_t vindex_mult;
  1828. /** post-divider for vindex value */
  1829. uint16_t vindex_div;
  1830. /** reserved for future use */
  1831. uint16_t reserved[328];
  1832. } BPMP_ABI_PACKED;
  1833. /** @} Vhint */
  1834. /** @endcond bpmp_t186 */
  1835. /**
  1836. * @ingroup MRQ_Codes
  1837. * @def MRQ_ABI_RATCHET
  1838. * @brief ABI ratchet value query
  1839. *
  1840. * * Platforms: T186, T194
  1841. * * Initiators: Any
  1842. * * Targets: BPMP
  1843. * * Request Payload: @ref mrq_abi_ratchet_request
  1844. * * Response Payload: @ref mrq_abi_ratchet_response
  1845. * @addtogroup ABI_info
  1846. * @{
  1847. */
  1848. /**
  1849. * @brief An ABI compatibility mechanism
  1850. *
  1851. * BPMP_ABI_RATCHET_VALUE may increase for various reasons in a future
  1852. * revision of this header file.
  1853. * 1. That future revision deprecates some MRQ
  1854. * 2. That future revision introduces a breaking change to an existing
  1855. * MRQ or
  1856. * 3. A bug is discovered in an existing implementation of the BPMP-FW
  1857. * (or possibly one of its clients) which warrants deprecating that
  1858. * implementation.
  1859. */
  1860. #define BPMP_ABI_RATCHET_VALUE 3
  1861. /**
  1862. * @brief Request with #MRQ_ABI_RATCHET.
  1863. *
  1864. * #ratchet should be #BPMP_ABI_RATCHET_VALUE from the ABI header
  1865. * against which the requester was compiled.
  1866. *
  1867. * If ratchet is less than BPMP's #BPMP_ABI_RATCHET_VALUE, BPMP may
  1868. * reply with mrq_response::err = -#BPMP_ERANGE to indicate that
  1869. * BPMP-FW cannot interoperate correctly with the requester. Requester
  1870. * should cease further communication with BPMP.
  1871. *
  1872. * Otherwise, err shall be 0.
  1873. */
  1874. struct mrq_abi_ratchet_request {
  1875. /** @brief Requester's ratchet value */
  1876. uint16_t ratchet;
  1877. };
  1878. /**
  1879. * @brief Response to #MRQ_ABI_RATCHET
  1880. *
  1881. * #ratchet shall be #BPMP_ABI_RATCHET_VALUE from the ABI header
  1882. * against which BPMP firwmare was compiled.
  1883. *
  1884. * If #ratchet is less than the requester's #BPMP_ABI_RATCHET_VALUE,
  1885. * the requster must either interoperate with BPMP according to an ABI
  1886. * header version with BPMP_ABI_RATCHET_VALUE = ratchet or cease
  1887. * communication with BPMP.
  1888. *
  1889. * If mrq_response::err is 0 and ratchet is greater than or equal to the
  1890. * requester's BPMP_ABI_RATCHET_VALUE, the requester should continue
  1891. * normal operation.
  1892. */
  1893. struct mrq_abi_ratchet_response {
  1894. /** @brief BPMP's ratchet value */
  1895. uint16_t ratchet;
  1896. };
  1897. /** @} ABI_info */
  1898. /**
  1899. * @ingroup MRQ_Codes
  1900. * @def MRQ_EMC_DVFS_LATENCY
  1901. * @brief Query frequency dependent EMC DVFS latency
  1902. *
  1903. * * Platforms: T186, T194, T234
  1904. * * Initiators: CCPLEX
  1905. * * Targets: BPMP
  1906. * * Request Payload: N/A
  1907. * * Response Payload: @ref mrq_emc_dvfs_latency_response
  1908. * @addtogroup EMC
  1909. * @{
  1910. */
  1911. /**
  1912. * @brief Used by @ref mrq_emc_dvfs_latency_response
  1913. */
  1914. struct emc_dvfs_latency {
  1915. /** @brief EMC DVFS node frequency in kHz */
  1916. uint32_t freq;
  1917. /** @brief EMC DVFS latency in nanoseconds */
  1918. uint32_t latency;
  1919. } BPMP_ABI_PACKED;
  1920. #define EMC_DVFS_LATENCY_MAX_SIZE 14
  1921. /**
  1922. * @brief Response to #MRQ_EMC_DVFS_LATENCY
  1923. */
  1924. struct mrq_emc_dvfs_latency_response {
  1925. /** @brief The number valid entries in #pairs */
  1926. uint32_t num_pairs;
  1927. /** @brief EMC DVFS node <frequency, latency> information */
  1928. struct emc_dvfs_latency pairs[EMC_DVFS_LATENCY_MAX_SIZE];
  1929. } BPMP_ABI_PACKED;
  1930. /** @} EMC */
  1931. /**
  1932. * @ingroup MRQ_Codes
  1933. * @def MRQ_EMC_DVFS_EMCHUB
  1934. * @brief Query EMC HUB frequencies
  1935. *
  1936. * * Platforms: T234 onwards
  1937. * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
  1938. * * Initiators: CCPLEX
  1939. * * Targets: BPMP
  1940. * * Request Payload: N/A
  1941. * * Response Payload: @ref mrq_emc_dvfs_emchub_response
  1942. * @addtogroup EMC
  1943. * @{
  1944. */
  1945. /**
  1946. * @brief Used by @ref mrq_emc_dvfs_emchub_response
  1947. */
  1948. struct emc_dvfs_emchub {
  1949. /** @brief EMC DVFS node frequency in kHz */
  1950. uint32_t freq;
  1951. /** @brief EMC HUB frequency in kHz */
  1952. uint32_t hub_freq;
  1953. } BPMP_ABI_PACKED;
  1954. #define EMC_DVFS_EMCHUB_MAX_SIZE EMC_DVFS_LATENCY_MAX_SIZE
  1955. /**
  1956. * @brief Response to #MRQ_EMC_DVFS_EMCHUB
  1957. */
  1958. struct mrq_emc_dvfs_emchub_response {
  1959. /** @brief The number valid entries in #pairs */
  1960. uint32_t num_pairs;
  1961. /** @brief EMC DVFS node <frequency, hub frequency> information */
  1962. struct emc_dvfs_emchub pairs[EMC_DVFS_EMCHUB_MAX_SIZE];
  1963. } BPMP_ABI_PACKED;
  1964. /** @} EMC */
  1965. /** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */
  1966. /**
  1967. * @ingroup MRQ_Codes
  1968. * @def MRQ_EMC_DISP_RFL
  1969. * @brief Set EMC display RFL handshake mode of operations
  1970. *
  1971. * * Platforms: T234 onwards
  1972. * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
  1973. * * Initiators: CCPLEX
  1974. * * Targets: BPMP
  1975. * * Request Payload: @ref mrq_emc_disp_rfl_request
  1976. * * Response Payload: N/A
  1977. *
  1978. * @addtogroup EMC
  1979. * @{
  1980. */
  1981. enum mrq_emc_disp_rfl_mode {
  1982. /** @brief EMC display RFL handshake disabled */
  1983. EMC_DISP_RFL_MODE_DISABLED = 0,
  1984. /** @brief EMC display RFL handshake enabled */
  1985. EMC_DISP_RFL_MODE_ENABLED = 1,
  1986. };
  1987. /**
  1988. * @ingroup EMC
  1989. * @brief Request with #MRQ_EMC_DISP_RFL
  1990. *
  1991. * Used by the sender of an #MRQ_EMC_DISP_RFL message to
  1992. * request the mode of EMC display RFL handshake.
  1993. *
  1994. * mrq_response::err is
  1995. * * 0: RFL mode is set successfully
  1996. * * -#BPMP_EINVAL: invalid mode requested
  1997. * * -#BPMP_ENOSYS: RFL handshake is not supported
  1998. * * -#BPMP_EACCES: Permission denied
  1999. * * -#BPMP_ENODEV: if disp rfl mrq is not supported by BPMP-FW
  2000. */
  2001. struct mrq_emc_disp_rfl_request {
  2002. /** @brief EMC display RFL mode (@ref mrq_emc_disp_rfl_mode) */
  2003. uint32_t mode;
  2004. } BPMP_ABI_PACKED;
  2005. /** @} EMC */
  2006. /** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */
  2007. /**
  2008. * @ingroup MRQ_Codes
  2009. * @def MRQ_BWMGR
  2010. * @brief bwmgr requests
  2011. *
  2012. * * Platforms: T234 onwards
  2013. * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
  2014. * * Initiators: CCPLEX
  2015. * * Targets: BPMP
  2016. * * Request Payload: @ref mrq_bwmgr_request
  2017. * * Response Payload: @ref mrq_bwmgr_response
  2018. *
  2019. * @addtogroup BWMGR
  2020. *
  2021. * @{
  2022. */
  2023. enum mrq_bwmgr_cmd {
  2024. /**
  2025. * @brief Check whether the BPMP driver supports the specified
  2026. * request type
  2027. *
  2028. * mrq_response::err is 0 if the specified request is
  2029. * supported and -#BPMP_ENODEV otherwise.
  2030. */
  2031. CMD_BWMGR_QUERY_ABI = 0,
  2032. /**
  2033. * @brief Determine dram rate to satisfy iso/niso bw requests
  2034. *
  2035. * mrq_response::err is
  2036. * * 0: calc_rate succeeded.
  2037. * * -#BPMP_EINVAL: Invalid request parameters.
  2038. * * -#BPMP_ENOTSUP: Requested bw is not available.
  2039. */
  2040. CMD_BWMGR_CALC_RATE = 1
  2041. };
  2042. /*
  2043. * request data for request type CMD_BWMGR_QUERY_ABI
  2044. *
  2045. * type: Request type for which to check existence.
  2046. */
  2047. struct cmd_bwmgr_query_abi_request {
  2048. uint32_t type;
  2049. } BPMP_ABI_PACKED;
  2050. /**
  2051. * @brief Used by @ref cmd_bwmgr_calc_rate_request
  2052. */
  2053. struct iso_req {
  2054. /* @brief bwmgr client ID @ref bpmp_bwmgr_ids */
  2055. uint32_t id;
  2056. /* @brief bw in kBps requested by client */
  2057. uint32_t iso_bw;
  2058. } BPMP_ABI_PACKED;
  2059. #define MAX_ISO_CLIENTS 13U
  2060. /*
  2061. * request data for request type CMD_BWMGR_CALC_RATE
  2062. */
  2063. struct cmd_bwmgr_calc_rate_request {
  2064. /* @brief total bw in kBps requested by all niso clients */
  2065. uint32_t sum_niso_bw;
  2066. /* @brief The number of iso clients */
  2067. uint32_t num_iso_clients;
  2068. /* @brief iso_req <id, iso_bw> information */
  2069. struct iso_req isobw_reqs[MAX_ISO_CLIENTS];
  2070. } BPMP_ABI_PACKED;
  2071. /*
  2072. * response data for request type CMD_BWMGR_CALC_RATE
  2073. *
  2074. * iso_rate_min: min dram data clk rate in kHz to satisfy all iso bw reqs
  2075. * total_rate_min: min dram data clk rate in kHz to satisfy all bw reqs
  2076. */
  2077. struct cmd_bwmgr_calc_rate_response {
  2078. uint32_t iso_rate_min;
  2079. uint32_t total_rate_min;
  2080. } BPMP_ABI_PACKED;
  2081. /*
  2082. * @brief Request with #MRQ_BWMGR
  2083. *
  2084. *
  2085. * |sub-command |payload |
  2086. * |----------------------------|------------------------------|
  2087. * |CMD_BWMGR_QUERY_ABI | cmd_bwmgr_query_abi_request |
  2088. * |CMD_BWMGR_CALC_RATE | cmd_bwmgr_calc_rate_request |
  2089. *
  2090. */
  2091. struct mrq_bwmgr_request {
  2092. uint32_t cmd;
  2093. union {
  2094. struct cmd_bwmgr_query_abi_request query_abi;
  2095. struct cmd_bwmgr_calc_rate_request bwmgr_rate_req;
  2096. } BPMP_UNION_ANON;
  2097. } BPMP_ABI_PACKED;
  2098. /*
  2099. * @brief Response to MRQ_BWMGR
  2100. *
  2101. * |sub-command |payload |
  2102. * |----------------------------|------------------------------|
  2103. * |CMD_BWMGR_CALC_RATE | cmd_bwmgr_calc_rate_response |
  2104. */
  2105. struct mrq_bwmgr_response {
  2106. union {
  2107. struct cmd_bwmgr_calc_rate_response bwmgr_rate_resp;
  2108. } BPMP_UNION_ANON;
  2109. } BPMP_ABI_PACKED;
  2110. /** @} BWMGR */
  2111. /** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */
  2112. /**
  2113. * @ingroup MRQ_Codes
  2114. * @def MRQ_BWMGR_INT
  2115. * @brief bpmp-integrated bwmgr requests
  2116. *
  2117. * * Platforms: T234 onwards
  2118. * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
  2119. * * Initiators: CCPLEX
  2120. * * Targets: BPMP
  2121. * * Request Payload: @ref mrq_bwmgr_int_request
  2122. * * Response Payload: @ref mrq_bwmgr_int_response
  2123. *
  2124. * @addtogroup BWMGR_INT
  2125. * @{
  2126. */
  2127. enum mrq_bwmgr_int_cmd {
  2128. /**
  2129. * @brief Check whether the BPMP-FW supports the specified
  2130. * request type
  2131. *
  2132. * mrq_response::err is 0 if the specified request is
  2133. * supported and -#BPMP_ENODEV otherwise.
  2134. */
  2135. CMD_BWMGR_INT_QUERY_ABI = 1,
  2136. /**
  2137. * @brief Determine and set dram rate to satisfy iso/niso bw request
  2138. *
  2139. * mrq_response::err is
  2140. * * 0: request succeeded.
  2141. * * -#BPMP_EINVAL: Invalid request parameters.
  2142. * set_frequency in @ref cmd_bwmgr_int_calc_and_set_response
  2143. * will not be set.
  2144. * * -#BPMP_ENOTSUP: Requested bw is not available.
  2145. * set_frequency in @ref cmd_bwmgr_int_calc_and_set_response
  2146. * will be current dram-clk rate.
  2147. */
  2148. CMD_BWMGR_INT_CALC_AND_SET = 2,
  2149. /**
  2150. * @brief Set a max DRAM frequency for the bandwidth-manager
  2151. *
  2152. * mrq_response::err is
  2153. * * 0: request succeeded.
  2154. * * -#BPMP_ENOTSUP: Requested cap frequency is not possible.
  2155. */
  2156. CMD_BWMGR_INT_CAP_SET = 3
  2157. };
  2158. /*
  2159. * request structure for request type CMD_BWMGR_QUERY_ABI
  2160. *
  2161. * type: Request type for which to check existence.
  2162. */
  2163. struct cmd_bwmgr_int_query_abi_request {
  2164. /* @brief request type determined by @ref mrq_bwmgr_int_cmd */
  2165. uint32_t type;
  2166. } BPMP_ABI_PACKED;
  2167. /**
  2168. * @defgroup bwmgr_int_unit_type BWMGR_INT floor unit-types
  2169. * @addtogroup bwmgr_int_unit_type
  2170. * @{
  2171. */
  2172. /** @brief kilobytes per second unit-type */
  2173. #define BWMGR_INT_UNIT_KBPS 0U
  2174. /** @brief kilohertz unit-type */
  2175. #define BWMGR_INT_UNIT_KHZ 1U
  2176. /** @} bwmgr_int_unit_type */
  2177. /*
  2178. * request data for request type CMD_BWMGR_INT_CALC_AND_SET
  2179. */
  2180. struct cmd_bwmgr_int_calc_and_set_request {
  2181. /* @brief bwmgr client ID @ref bpmp_bwmgr_ids */
  2182. uint32_t client_id;
  2183. /* @brief average niso bw usage in kBps requested by client. */
  2184. uint32_t niso_bw;
  2185. /*
  2186. * @brief average iso bw usage in kBps requested by client.
  2187. * Value is ignored if client is niso. Determined by client_id.
  2188. */
  2189. uint32_t iso_bw;
  2190. /*
  2191. * @brief memory clock floor requested by client.
  2192. * Unit determined by floor_unit.
  2193. */
  2194. uint32_t mc_floor;
  2195. /*
  2196. * @brief toggle to determine the unit-type of floor value.
  2197. * See @ref bwmgr_int_unit_type definitions for unit-type mappings.
  2198. */
  2199. uint8_t floor_unit;
  2200. } BPMP_ABI_PACKED;
  2201. struct cmd_bwmgr_int_cap_set_request {
  2202. /* @brief requested cap frequency in Hz. */
  2203. uint64_t rate;
  2204. } BPMP_ABI_PACKED;
  2205. /*
  2206. * response data for request type CMD_BWMGR_CALC_AND_SET
  2207. */
  2208. struct cmd_bwmgr_int_calc_and_set_response {
  2209. /* @brief current set memory clock frequency in Hz */
  2210. uint64_t rate;
  2211. } BPMP_ABI_PACKED;
  2212. /*
  2213. * @brief Request with #MRQ_BWMGR_INT
  2214. *
  2215. *
  2216. * |sub-command |payload |
  2217. * |----------------------------|-----------------------------------|
  2218. * |CMD_BWMGR_INT_QUERY_ABI | cmd_bwmgr_int_query_abi_request |
  2219. * |CMD_BWMGR_INT_CALC_AND_SET | cmd_bwmgr_int_calc_and_set_request|
  2220. * |CMD_BWMGR_INT_CAP_SET | cmd_bwmgr_int_cap_set_request |
  2221. *
  2222. */
  2223. struct mrq_bwmgr_int_request {
  2224. uint32_t cmd;
  2225. union {
  2226. struct cmd_bwmgr_int_query_abi_request query_abi;
  2227. struct cmd_bwmgr_int_calc_and_set_request bwmgr_calc_set_req;
  2228. struct cmd_bwmgr_int_cap_set_request bwmgr_cap_set_req;
  2229. } BPMP_UNION_ANON;
  2230. } BPMP_ABI_PACKED;
  2231. /*
  2232. * @brief Response to MRQ_BWMGR_INT
  2233. *
  2234. * |sub-command |payload |
  2235. * |----------------------------|---------------------------------------|
  2236. * |CMD_BWMGR_INT_CALC_AND_SET | cmd_bwmgr_int_calc_and_set_response |
  2237. */
  2238. struct mrq_bwmgr_int_response {
  2239. union {
  2240. struct cmd_bwmgr_int_calc_and_set_response bwmgr_calc_set_resp;
  2241. } BPMP_UNION_ANON;
  2242. } BPMP_ABI_PACKED;
  2243. /** @} BWMGR_INT */
  2244. /** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */
  2245. /**
  2246. * @ingroup MRQ_Codes
  2247. * @def MRQ_ISO_CLIENT
  2248. * @brief ISO client requests
  2249. *
  2250. * * Platforms: T234 onwards
  2251. * @cond (bpmp_t234 || bpmp_t239 || bpmp_th500)
  2252. * * Initiators: CCPLEX
  2253. * * Targets: BPMP
  2254. * * Request Payload: @ref mrq_iso_client_request
  2255. * * Response Payload: @ref mrq_iso_client_response
  2256. *
  2257. * @addtogroup ISO_CLIENT
  2258. * @{
  2259. */
  2260. enum mrq_iso_client_cmd {
  2261. /**
  2262. * @brief Check whether the BPMP driver supports the specified
  2263. * request type
  2264. *
  2265. * mrq_response::err is 0 if the specified request is
  2266. * supported and -#BPMP_ENODEV otherwise.
  2267. */
  2268. CMD_ISO_CLIENT_QUERY_ABI = 0,
  2269. /*
  2270. * @brief check for legal LA for the iso client. Without programming
  2271. * LA MC registers, calculate and ensure that legal LA is possible for
  2272. * iso bw requested by the ISO client.
  2273. *
  2274. * mrq_response::err is
  2275. * * 0: check la succeeded.
  2276. * * -#BPMP_EINVAL: Invalid request parameters.
  2277. * * -#BPMP_EFAULT: Legal LA is not possible for client requested iso_bw
  2278. */
  2279. CMD_ISO_CLIENT_CALCULATE_LA = 1,
  2280. /*
  2281. * @brief set LA for the iso client. Calculate and program the LA/PTSA
  2282. * MC registers corresponding to the client making bw request
  2283. *
  2284. * mrq_response::err is
  2285. * * 0: set la succeeded.
  2286. * * -#BPMP_EINVAL: Invalid request parameters.
  2287. * * -#BPMP_EFAULT: Failed to calculate or program MC registers.
  2288. */
  2289. CMD_ISO_CLIENT_SET_LA = 2,
  2290. /*
  2291. * @brief Get max possible bw for iso client
  2292. *
  2293. * mrq_response::err is
  2294. * * 0: get_max_bw succeeded.
  2295. * * -#BPMP_EINVAL: Invalid request parameters.
  2296. */
  2297. CMD_ISO_CLIENT_GET_MAX_BW = 3
  2298. };
  2299. /*
  2300. * request data for request type CMD_ISO_CLIENT_QUERY_ABI
  2301. *
  2302. * type: Request type for which to check existence.
  2303. */
  2304. struct cmd_iso_client_query_abi_request {
  2305. uint32_t type;
  2306. } BPMP_ABI_PACKED;
  2307. /*
  2308. * request data for request type CMD_ISO_CLIENT_CALCULATE_LA
  2309. *
  2310. * id: client ID in @ref bpmp_bwmgr_ids
  2311. * bw: bw requested in kBps by client ID.
  2312. * init_bw_floor: initial dram_bw_floor in kBps passed by client ID.
  2313. * ISO client will perform mempool allocation and DVFS buffering based
  2314. * on this dram_bw_floor.
  2315. */
  2316. struct cmd_iso_client_calculate_la_request {
  2317. uint32_t id;
  2318. uint32_t bw;
  2319. uint32_t init_bw_floor;
  2320. } BPMP_ABI_PACKED;
  2321. /*
  2322. * request data for request type CMD_ISO_CLIENT_SET_LA
  2323. *
  2324. * id: client ID in @ref bpmp_bwmgr_ids
  2325. * bw: bw requested in kBps by client ID.
  2326. * final_bw_floor: final dram_bw_floor in kBps.
  2327. * Sometimes the initial dram_bw_floor passed by ISO client may need to be
  2328. * updated by considering higher dram freq's. This is the final dram_bw_floor
  2329. * used to calculate and program MC registers.
  2330. */
  2331. struct cmd_iso_client_set_la_request {
  2332. uint32_t id;
  2333. uint32_t bw;
  2334. uint32_t final_bw_floor;
  2335. } BPMP_ABI_PACKED;
  2336. /*
  2337. * request data for request type CMD_ISO_CLIENT_GET_MAX_BW
  2338. *
  2339. * id: client ID in @ref bpmp_bwmgr_ids
  2340. */
  2341. struct cmd_iso_client_get_max_bw_request {
  2342. uint32_t id;
  2343. } BPMP_ABI_PACKED;
  2344. /*
  2345. * response data for request type CMD_ISO_CLIENT_CALCULATE_LA
  2346. *
  2347. * la_rate_floor: minimum dram_rate_floor in kHz at which a legal la is possible
  2348. * iso_client_only_rate: Minimum dram freq in kHz required to satisfy this clients
  2349. * iso bw request, assuming all other iso clients are inactive
  2350. */
  2351. struct cmd_iso_client_calculate_la_response {
  2352. uint32_t la_rate_floor;
  2353. uint32_t iso_client_only_rate;
  2354. } BPMP_ABI_PACKED;
  2355. /**
  2356. * @brief Used by @ref cmd_iso_client_get_max_bw_response
  2357. */
  2358. struct iso_max_bw {
  2359. /* @brief dram frequency in kHz */
  2360. uint32_t freq;
  2361. /* @brief max possible iso-bw in kBps */
  2362. uint32_t iso_bw;
  2363. } BPMP_ABI_PACKED;
  2364. #define ISO_MAX_BW_MAX_SIZE 14U
  2365. /*
  2366. * response data for request type CMD_ISO_CLIENT_GET_MAX_BW
  2367. */
  2368. struct cmd_iso_client_get_max_bw_response {
  2369. /* @brief The number valid entries in iso_max_bw pairs */
  2370. uint32_t num_pairs;
  2371. /* @brief max ISOBW <dram freq, max bw> information */
  2372. struct iso_max_bw pairs[ISO_MAX_BW_MAX_SIZE];
  2373. } BPMP_ABI_PACKED;
  2374. /**
  2375. * @brief Request with #MRQ_ISO_CLIENT
  2376. *
  2377. * Used by the sender of an #MRQ_ISO_CLIENT message.
  2378. *
  2379. * |sub-command |payload |
  2380. * |------------------------------------ |----------------------------------------|
  2381. * |CMD_ISO_CLIENT_QUERY_ABI |cmd_iso_client_query_abi_request |
  2382. * |CMD_ISO_CLIENT_CALCULATE_LA |cmd_iso_client_calculate_la_request |
  2383. * |CMD_ISO_CLIENT_SET_LA |cmd_iso_client_set_la_request |
  2384. * |CMD_ISO_CLIENT_GET_MAX_BW |cmd_iso_client_get_max_bw_request |
  2385. *
  2386. */
  2387. struct mrq_iso_client_request {
  2388. /* Type of request. Values listed in enum mrq_iso_client_cmd */
  2389. uint32_t cmd;
  2390. union {
  2391. struct cmd_iso_client_query_abi_request query_abi;
  2392. struct cmd_iso_client_calculate_la_request calculate_la_req;
  2393. struct cmd_iso_client_set_la_request set_la_req;
  2394. struct cmd_iso_client_get_max_bw_request max_isobw_req;
  2395. } BPMP_UNION_ANON;
  2396. } BPMP_ABI_PACKED;
  2397. /**
  2398. * @brief Response to MRQ_ISO_CLIENT
  2399. *
  2400. * Each sub-command supported by @ref mrq_iso_client_request may return
  2401. * sub-command-specific data. Some do and some do not as indicated in
  2402. * the following table
  2403. *
  2404. * |sub-command |payload |
  2405. * |---------------------------- |------------------------------------|
  2406. * |CMD_ISO_CLIENT_CALCULATE_LA |cmd_iso_client_calculate_la_response|
  2407. * |CMD_ISO_CLIENT_SET_LA |N/A |
  2408. * |CMD_ISO_CLIENT_GET_MAX_BW |cmd_iso_client_get_max_bw_response |
  2409. *
  2410. */
  2411. struct mrq_iso_client_response {
  2412. union {
  2413. struct cmd_iso_client_calculate_la_response calculate_la_resp;
  2414. struct cmd_iso_client_get_max_bw_response max_isobw_resp;
  2415. } BPMP_UNION_ANON;
  2416. } BPMP_ABI_PACKED;
  2417. /** @} ISO_CLIENT */
  2418. /** @endcond (bpmp_t234 || bpmp_t239 || bpmp_th500) */
  2419. /**
  2420. * @ingroup MRQ_Codes
  2421. * @def MRQ_CPU_NDIV_LIMITS
  2422. * @brief CPU freq. limits in ndiv
  2423. *
  2424. * * Platforms: T194 onwards
  2425. * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
  2426. * * Initiators: CCPLEX
  2427. * * Targets: BPMP
  2428. * * Request Payload: @ref mrq_cpu_ndiv_limits_request
  2429. * * Response Payload: @ref mrq_cpu_ndiv_limits_response
  2430. * @addtogroup CPU
  2431. * @{
  2432. */
  2433. /**
  2434. * @brief Request for ndiv limits of a cluster
  2435. */
  2436. struct mrq_cpu_ndiv_limits_request {
  2437. /** @brief Enum cluster_id */
  2438. uint32_t cluster_id;
  2439. } BPMP_ABI_PACKED;
  2440. /**
  2441. * @brief Response to #MRQ_CPU_NDIV_LIMITS
  2442. */
  2443. struct mrq_cpu_ndiv_limits_response {
  2444. /** @brief Reference frequency in Hz */
  2445. uint32_t ref_clk_hz;
  2446. /** @brief Post divider value */
  2447. uint16_t pdiv;
  2448. /** @brief Input divider value */
  2449. uint16_t mdiv;
  2450. /** @brief FMAX expressed with max NDIV value */
  2451. uint16_t ndiv_max;
  2452. /** @brief Minimum allowed NDIV value */
  2453. uint16_t ndiv_min;
  2454. } BPMP_ABI_PACKED;
  2455. /** @} CPU */
  2456. /** @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500) */
  2457. /**
  2458. * @ingroup MRQ_Codes
  2459. * @def MRQ_CPU_AUTO_CC3
  2460. * @brief Query CPU cluster auto-CC3 configuration
  2461. *
  2462. * * Platforms: T194
  2463. * @cond bpmp_t194
  2464. * * Initiators: CCPLEX
  2465. * * Targets: BPMP
  2466. * * Request Payload: @ref mrq_cpu_auto_cc3_request
  2467. * * Response Payload: @ref mrq_cpu_auto_cc3_response
  2468. * @addtogroup CC3
  2469. *
  2470. * Queries from BPMP auto-CC3 configuration (allowed/not allowed) for a
  2471. * specified cluster. CCPLEX s/w uses this information to override its own
  2472. * device tree auto-CC3 settings, so that BPMP device tree is a single source of
  2473. * auto-CC3 platform configuration.
  2474. *
  2475. * @{
  2476. */
  2477. /**
  2478. * @brief Request for auto-CC3 configuration of a cluster
  2479. */
  2480. struct mrq_cpu_auto_cc3_request {
  2481. /** @brief Enum cluster_id (logical cluster id, known to CCPLEX s/w) */
  2482. uint32_t cluster_id;
  2483. } BPMP_ABI_PACKED;
  2484. /**
  2485. * @brief Response to #MRQ_CPU_AUTO_CC3
  2486. */
  2487. struct mrq_cpu_auto_cc3_response {
  2488. /**
  2489. * @brief auto-CC3 configuration
  2490. *
  2491. * - bits[31..10] reserved.
  2492. * - bits[9..1] cc3 ndiv
  2493. * - bit [0] if "1" auto-CC3 is allowed, if "0" auto-CC3 is not allowed
  2494. */
  2495. uint32_t auto_cc3_config;
  2496. } BPMP_ABI_PACKED;
  2497. /** @} CC3 */
  2498. /** @endcond bpmp_t194 */
  2499. /**
  2500. * @ingroup MRQ_Codes
  2501. * @def MRQ_RINGBUF_CONSOLE
  2502. * @brief A ring buffer debug console for BPMP
  2503. * @addtogroup RingbufConsole
  2504. *
  2505. * The ring buffer debug console aims to be a substitute for the UART debug
  2506. * console. The debug console is implemented with two ring buffers in the
  2507. * BPMP-FW, the RX (receive) and TX (transmit) buffers. Characters can be read
  2508. * and written to the buffers by the host via the MRQ interface.
  2509. *
  2510. * @{
  2511. */
  2512. /**
  2513. * @brief Maximum number of bytes transferred in a single write command to the
  2514. * BPMP
  2515. *
  2516. * This is determined by the number of free bytes in the message struct,
  2517. * rounded down to a multiple of four.
  2518. */
  2519. #define MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN 112
  2520. /**
  2521. * @brief Maximum number of bytes transferred in a single read command to the
  2522. * BPMP
  2523. *
  2524. * This is determined by the number of free bytes in the message struct,
  2525. * rounded down to a multiple of four.
  2526. */
  2527. #define MRQ_RINGBUF_CONSOLE_MAX_READ_LEN 116
  2528. enum mrq_ringbuf_console_host_to_bpmp_cmd {
  2529. /**
  2530. * @brief Check whether the BPMP driver supports the specified request
  2531. * type
  2532. *
  2533. * mrq_response::err is 0 if the specified request is supported and
  2534. * -#BPMP_ENODEV otherwise
  2535. */
  2536. CMD_RINGBUF_CONSOLE_QUERY_ABI = 0,
  2537. /**
  2538. * @brief Perform a read operation on the BPMP TX buffer
  2539. *
  2540. * mrq_response::err is 0
  2541. */
  2542. CMD_RINGBUF_CONSOLE_READ = 1,
  2543. /**
  2544. * @brief Perform a write operation on the BPMP RX buffer
  2545. *
  2546. * mrq_response::err is 0 if the operation was successful and
  2547. * -#BPMP_ENODEV otherwise
  2548. */
  2549. CMD_RINGBUF_CONSOLE_WRITE = 2,
  2550. /**
  2551. * @brief Get the length of the buffer and the physical addresses of
  2552. * the buffer data and the head and tail counters
  2553. *
  2554. * mrq_response::err is 0 if the operation was successful and
  2555. * -#BPMP_ENODEV otherwise
  2556. */
  2557. CMD_RINGBUF_CONSOLE_GET_FIFO = 3,
  2558. };
  2559. /**
  2560. * @ingroup RingbufConsole
  2561. * @brief Host->BPMP request data for request type
  2562. * #CMD_RINGBUF_CONSOLE_QUERY_ABI
  2563. */
  2564. struct cmd_ringbuf_console_query_abi_req {
  2565. /** @brief Command identifier to be queried */
  2566. uint32_t cmd;
  2567. } BPMP_ABI_PACKED;
  2568. /** @private */
  2569. struct cmd_ringbuf_console_query_abi_resp {
  2570. BPMP_ABI_EMPTY
  2571. } BPMP_ABI_PACKED;
  2572. /**
  2573. * @ingroup RingbufConsole
  2574. * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_READ
  2575. */
  2576. struct cmd_ringbuf_console_read_req {
  2577. /**
  2578. * @brief Number of bytes requested to be read from the BPMP TX buffer
  2579. */
  2580. uint8_t len;
  2581. } BPMP_ABI_PACKED;
  2582. /**
  2583. * @ingroup RingbufConsole
  2584. * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_READ
  2585. */
  2586. struct cmd_ringbuf_console_read_resp {
  2587. /** @brief The actual data read from the BPMP TX buffer */
  2588. uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_READ_LEN];
  2589. /** @brief Number of bytes in cmd_ringbuf_console_read_resp::data */
  2590. uint8_t len;
  2591. } BPMP_ABI_PACKED;
  2592. /**
  2593. * @ingroup RingbufConsole
  2594. * @brief Host->BPMP request data for request type #CMD_RINGBUF_CONSOLE_WRITE
  2595. */
  2596. struct cmd_ringbuf_console_write_req {
  2597. /** @brief The actual data to be written to the BPMP RX buffer */
  2598. uint8_t data[MRQ_RINGBUF_CONSOLE_MAX_WRITE_LEN];
  2599. /** @brief Number of bytes in cmd_ringbuf_console_write_req::data */
  2600. uint8_t len;
  2601. } BPMP_ABI_PACKED;
  2602. /**
  2603. * @ingroup RingbufConsole
  2604. * @brief BPMP->Host response data for request type #CMD_RINGBUF_CONSOLE_WRITE
  2605. */
  2606. struct cmd_ringbuf_console_write_resp {
  2607. /** @brief Number of bytes of available space in the BPMP RX buffer */
  2608. uint32_t space_avail;
  2609. /** @brief Number of bytes that were written to the BPMP RX buffer */
  2610. uint8_t len;
  2611. } BPMP_ABI_PACKED;
  2612. /** @private */
  2613. struct cmd_ringbuf_console_get_fifo_req {
  2614. BPMP_ABI_EMPTY
  2615. } BPMP_ABI_PACKED;
  2616. /**
  2617. * @ingroup RingbufConsole
  2618. * @brief BPMP->Host reply data for request type #CMD_RINGBUF_CONSOLE_GET_FIFO
  2619. */
  2620. struct cmd_ringbuf_console_get_fifo_resp {
  2621. /** @brief Physical address of the BPMP TX buffer */
  2622. uint64_t bpmp_tx_buf_addr;
  2623. /** @brief Physical address of the BPMP TX buffer head counter */
  2624. uint64_t bpmp_tx_head_addr;
  2625. /** @brief Physical address of the BPMP TX buffer tail counter */
  2626. uint64_t bpmp_tx_tail_addr;
  2627. /** @brief Length of the BPMP TX buffer */
  2628. uint32_t bpmp_tx_buf_len;
  2629. } BPMP_ABI_PACKED;
  2630. /**
  2631. * @ingroup RingbufConsole
  2632. * @brief Host->BPMP request data.
  2633. *
  2634. * Reply type is union #mrq_ringbuf_console_bpmp_to_host_response .
  2635. */
  2636. struct mrq_ringbuf_console_host_to_bpmp_request {
  2637. /**
  2638. * @brief Type of request. Values listed in enum
  2639. * #mrq_ringbuf_console_host_to_bpmp_cmd.
  2640. */
  2641. uint32_t type;
  2642. /** @brief request type specific parameters. */
  2643. union {
  2644. struct cmd_ringbuf_console_query_abi_req query_abi;
  2645. struct cmd_ringbuf_console_read_req read;
  2646. struct cmd_ringbuf_console_write_req write;
  2647. struct cmd_ringbuf_console_get_fifo_req get_fifo;
  2648. } BPMP_UNION_ANON;
  2649. } BPMP_ABI_PACKED;
  2650. /**
  2651. * @ingroup RingbufConsole
  2652. * @brief Host->BPMP reply data
  2653. *
  2654. * In response to struct #mrq_ringbuf_console_host_to_bpmp_request.
  2655. */
  2656. union mrq_ringbuf_console_bpmp_to_host_response {
  2657. struct cmd_ringbuf_console_query_abi_resp query_abi;
  2658. struct cmd_ringbuf_console_read_resp read;
  2659. struct cmd_ringbuf_console_write_resp write;
  2660. struct cmd_ringbuf_console_get_fifo_resp get_fifo;
  2661. } BPMP_ABI_PACKED;
  2662. /** @} RingbufConsole */
  2663. /**
  2664. * @ingroup MRQ_Codes
  2665. * @def MRQ_STRAP
  2666. * @brief Set a strap value controlled by BPMP
  2667. *
  2668. * * Platforms: T194 onwards
  2669. * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
  2670. * * Initiators: CCPLEX
  2671. * * Targets: BPMP
  2672. * * Request Payload: @ref mrq_strap_request
  2673. * * Response Payload: N/A
  2674. * @addtogroup Strap
  2675. *
  2676. * A strap is an input that is sampled by a hardware unit during the
  2677. * unit's startup process. The sampled value of a strap affects the
  2678. * behavior of the unit until the unit is restarted. Many hardware
  2679. * units sample their straps at the instant that their resets are
  2680. * deasserted.
  2681. *
  2682. * BPMP owns registers which act as straps to various units. It
  2683. * exposes limited control of those straps via #MRQ_STRAP.
  2684. *
  2685. * @{
  2686. */
  2687. enum mrq_strap_cmd {
  2688. /** @private */
  2689. STRAP_RESERVED = 0,
  2690. /** @brief Set a strap value */
  2691. STRAP_SET = 1
  2692. };
  2693. /**
  2694. * @brief Request with #MRQ_STRAP
  2695. */
  2696. struct mrq_strap_request {
  2697. /** @brief @ref mrq_strap_cmd */
  2698. uint32_t cmd;
  2699. /** @brief Strap ID from @ref Strap_Identifiers */
  2700. uint32_t id;
  2701. /** @brief Desired value for strap (if cmd is #STRAP_SET) */
  2702. uint32_t value;
  2703. } BPMP_ABI_PACKED;
  2704. /** @} Strap */
  2705. /** @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500) */
  2706. /**
  2707. * @ingroup MRQ_Codes
  2708. * @def MRQ_UPHY
  2709. * @brief Perform a UPHY operation
  2710. *
  2711. * * Platforms: T194 onwards
  2712. * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
  2713. * * Initiators: CCPLEX
  2714. * * Targets: BPMP
  2715. * * Request Payload: @ref mrq_uphy_request
  2716. * * Response Payload: @ref mrq_uphy_response
  2717. *
  2718. * @addtogroup UPHY
  2719. * @{
  2720. */
  2721. enum {
  2722. CMD_UPHY_PCIE_LANE_MARGIN_CONTROL = 1,
  2723. CMD_UPHY_PCIE_LANE_MARGIN_STATUS = 2,
  2724. CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT = 3,
  2725. CMD_UPHY_PCIE_CONTROLLER_STATE = 4,
  2726. CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF = 5,
  2727. CMD_UPHY_DISPLAY_PORT_INIT = 6,
  2728. CMD_UPHY_DISPLAY_PORT_OFF = 7,
  2729. CMD_UPHY_XUSB_DYN_LANES_RESTORE = 8,
  2730. CMD_UPHY_MAX,
  2731. };
  2732. struct cmd_uphy_margin_control_request {
  2733. /** @brief Enable margin */
  2734. int32_t en;
  2735. /** @brief Clear the number of error and sections */
  2736. int32_t clr;
  2737. /** @brief Set x offset (1's complement) for left/right margin type (y should be 0) */
  2738. uint32_t x;
  2739. /** @brief Set y offset (1's complement) for left/right margin type (x should be 0) */
  2740. uint32_t y;
  2741. /** @brief Set number of bit blocks for each margin section */
  2742. uint32_t nblks;
  2743. } BPMP_ABI_PACKED;
  2744. struct cmd_uphy_margin_status_response {
  2745. /** @brief Number of errors observed */
  2746. uint32_t status;
  2747. } BPMP_ABI_PACKED;
  2748. struct cmd_uphy_ep_controller_pll_init_request {
  2749. /** @brief EP controller number, T194 valid: 0, 4, 5; T234 valid: 5, 6, 7, 10; T239 valid: 0 */
  2750. uint8_t ep_controller;
  2751. } BPMP_ABI_PACKED;
  2752. struct cmd_uphy_pcie_controller_state_request {
  2753. /** @brief PCIE controller number, T194 valid: 0-4; T234 valid: 0-10; T239 valid: 0-3 */
  2754. uint8_t pcie_controller;
  2755. uint8_t enable;
  2756. } BPMP_ABI_PACKED;
  2757. struct cmd_uphy_ep_controller_pll_off_request {
  2758. /** @brief EP controller number, T194 valid: 0, 4, 5; T234 valid: 5, 6, 7, 10; T239 valid: 0 */
  2759. uint8_t ep_controller;
  2760. } BPMP_ABI_PACKED;
  2761. struct cmd_uphy_display_port_init_request {
  2762. /** @brief DisplayPort link rate, T239 valid: 1620, 2700, 5400, 8100, 2160, 2430, 3240, 4320, 6750 */
  2763. uint16_t link_rate;
  2764. /** @brief 1: lane 0; 2: lane 1; 3: lane 0 and 1 */
  2765. uint16_t lanes_bitmap;
  2766. } BPMP_ABI_PACKED;
  2767. struct cmd_uphy_xusb_dyn_lanes_restore_request {
  2768. /** @brief 1: lane 0; 2: lane 1; 3: lane 0 and 1 */
  2769. uint16_t lanes_bitmap;
  2770. } BPMP_ABI_PACKED;
  2771. /**
  2772. * @ingroup UPHY
  2773. * @brief Request with #MRQ_UPHY
  2774. *
  2775. * Used by the sender of an #MRQ_UPHY message to control UPHY.
  2776. * The uphy_request is split into several sub-commands. CMD_UPHY_PCIE_LANE_MARGIN_STATUS
  2777. * requires no additional data. Others have a sub-command specific payload. Below table
  2778. * shows sub-commands with their corresponding payload data.
  2779. *
  2780. * |sub-command |payload |
  2781. * |------------------------------------ |----------------------------------------|
  2782. * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL |uphy_set_margin_control |
  2783. * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS | |
  2784. * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_INIT |cmd_uphy_ep_controller_pll_init_request |
  2785. * |CMD_UPHY_PCIE_CONTROLLER_STATE |cmd_uphy_pcie_controller_state_request |
  2786. * |CMD_UPHY_PCIE_EP_CONTROLLER_PLL_OFF |cmd_uphy_ep_controller_pll_off_request |
  2787. * |CMD_UPHY_PCIE_DISPLAY_PORT_INIT |cmd_uphy_display_port_init_request |
  2788. * |CMD_UPHY_PCIE_DISPLAY_PORT_OFF | |
  2789. * |CMD_UPHY_XUSB_DYN_LANES_RESTORE |cmd_uphy_xusb_dyn_lanes_restore_request |
  2790. *
  2791. */
  2792. struct mrq_uphy_request {
  2793. /** @brief Lane number. */
  2794. uint16_t lane;
  2795. /** @brief Sub-command id. */
  2796. uint16_t cmd;
  2797. union {
  2798. struct cmd_uphy_margin_control_request uphy_set_margin_control;
  2799. struct cmd_uphy_ep_controller_pll_init_request ep_ctrlr_pll_init;
  2800. struct cmd_uphy_pcie_controller_state_request controller_state;
  2801. struct cmd_uphy_ep_controller_pll_off_request ep_ctrlr_pll_off;
  2802. struct cmd_uphy_display_port_init_request display_port_init;
  2803. struct cmd_uphy_xusb_dyn_lanes_restore_request xusb_dyn_lanes_restore;
  2804. } BPMP_UNION_ANON;
  2805. } BPMP_ABI_PACKED;
  2806. /**
  2807. * @ingroup UPHY
  2808. * @brief Response to MRQ_UPHY
  2809. *
  2810. * Each sub-command supported by @ref mrq_uphy_request may return
  2811. * sub-command-specific data. Some do and some do not as indicated in
  2812. * the following table
  2813. *
  2814. * |sub-command |payload |
  2815. * |---------------------------- |------------------------|
  2816. * |CMD_UPHY_PCIE_LANE_MARGIN_CONTROL | |
  2817. * |CMD_UPHY_PCIE_LANE_MARGIN_STATUS |uphy_get_margin_status |
  2818. *
  2819. */
  2820. struct mrq_uphy_response {
  2821. union {
  2822. struct cmd_uphy_margin_status_response uphy_get_margin_status;
  2823. } BPMP_UNION_ANON;
  2824. } BPMP_ABI_PACKED;
  2825. /** @} UPHY */
  2826. /** @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500) */
  2827. /**
  2828. * @ingroup MRQ_Codes
  2829. * @def MRQ_FMON
  2830. * @brief Perform a frequency monitor configuration operations
  2831. *
  2832. * * Platforms: T194 onwards
  2833. * @cond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
  2834. * * Initiators: CCPLEX
  2835. * * Targets: BPMP
  2836. * * Request Payload: @ref mrq_fmon_request
  2837. * * Response Payload: @ref mrq_fmon_response
  2838. * @endcond (bpmp_t194 || bpmp_t234 || bpmp_t239 || bpmp_th500)
  2839. *
  2840. * @addtogroup FMON
  2841. * @{
  2842. * @cond (bpmp_t194 || bpmp_t234)
  2843. */
  2844. enum {
  2845. /**
  2846. * @brief Clamp FMON configuration to specified rate.
  2847. *
  2848. * The monitored clock must be running for clamp to succeed. If
  2849. * clamped, FMON configuration is preserved when clock rate
  2850. * and/or state is changed.
  2851. *
  2852. * mrq_response::err is 0 if the operation was successful, or @n
  2853. * -#BPMP_EACCES: FMON access error @n
  2854. * -#BPMP_EBADCMD if subcommand is not supported @n
  2855. * -#BPMP_EBADSLT: clamp FMON on cluster with auto-CC3 enabled @n
  2856. * -#BPMP_EBUSY: fmon is already clamped at different rate @n
  2857. * -#BPMP_EFAULT: self-diagnostic error @n
  2858. * -#BPMP_EINVAL: invalid FMON configuration @n
  2859. * -#BPMP_EOPNOTSUPP: not in production mode @n
  2860. * -#BPMP_ENODEV: invalid clk_id @n
  2861. * -#BPMP_ENOENT: no calibration data, uninitialized @n
  2862. * -#BPMP_ENOTSUP: avfs config not set @n
  2863. * -#BPMP_ENOSYS: clamp FMON on cluster clock w/ no NAFLL @n
  2864. * -#BPMP_ETIMEDOUT: operation timed out @n
  2865. */
  2866. CMD_FMON_GEAR_CLAMP = 1,
  2867. /**
  2868. * @brief Release clamped FMON configuration.
  2869. *
  2870. * Allow FMON configuration to follow monitored clock rate
  2871. * and/or state changes.
  2872. *
  2873. * mrq_response::err is 0 if the operation was successful, or @n
  2874. * -#BPMP_EBADCMD if subcommand is not supported @n
  2875. * -#BPMP_ENODEV: invalid clk_id @n
  2876. * -#BPMP_ENOENT: no calibration data, uninitialized @n
  2877. * -#BPMP_ENOTSUP: avfs config not set @n
  2878. * -#BPMP_EOPNOTSUPP: not in production mode @n
  2879. */
  2880. CMD_FMON_GEAR_FREE = 2,
  2881. /**
  2882. * @brief Return rate FMON is clamped at, or 0 if FMON is not
  2883. * clamped.
  2884. *
  2885. * Inherently racy, since clamp state can be changed
  2886. * concurrently. Useful for testing.
  2887. *
  2888. * mrq_response::err is 0 if the operation was successful, or @n
  2889. * -#BPMP_EBADCMD if subcommand is not supported @n
  2890. * -#BPMP_ENODEV: invalid clk_id @n
  2891. * -#BPMP_ENOENT: no calibration data, uninitialized @n
  2892. * -#BPMP_ENOTSUP: avfs config not set @n
  2893. * -#BPMP_EOPNOTSUPP: not in production mode @n
  2894. */
  2895. CMD_FMON_GEAR_GET = 3,
  2896. /**
  2897. * @brief Return current status of FMON faults detected by FMON
  2898. * h/w or s/w since last invocation of this command.
  2899. * Clears fault status.
  2900. *
  2901. * mrq_response::err is 0 if the operation was successful, or @n
  2902. * -#BPMP_EBADCMD if subcommand is not supported @n
  2903. * -#BPMP_EINVAL: invalid fault type @n
  2904. * -#BPMP_ENODEV: invalid clk_id @n
  2905. * -#BPMP_ENOENT: no calibration data, uninitialized @n
  2906. * -#BPMP_ENOTSUP: avfs config not set @n
  2907. * -#BPMP_EOPNOTSUPP: not in production mode @n
  2908. */
  2909. CMD_FMON_FAULT_STS_GET = 4,
  2910. };
  2911. /**
  2912. * @cond DEPRECATED
  2913. * Kept for backward compatibility
  2914. */
  2915. #define CMD_FMON_NUM 4
  2916. /** @endcond DEPRECATED */
  2917. /**
  2918. * @defgroup fmon_fault_type FMON fault type
  2919. * @addtogroup fmon_fault_type
  2920. * @{
  2921. */
  2922. /** @brief All detected FMON faults (h/w or s/w) */
  2923. #define FMON_FAULT_TYPE_ALL 0U
  2924. /** @brief FMON faults detected by h/w */
  2925. #define FMON_FAULT_TYPE_HW 1U
  2926. /** @brief FMON faults detected by s/w */
  2927. #define FMON_FAULT_TYPE_SW 2U
  2928. /** @} fmon_fault_type */
  2929. struct cmd_fmon_gear_clamp_request {
  2930. int32_t unused;
  2931. int64_t rate;
  2932. } BPMP_ABI_PACKED;
  2933. /** @private */
  2934. struct cmd_fmon_gear_clamp_response {
  2935. BPMP_ABI_EMPTY
  2936. } BPMP_ABI_PACKED;
  2937. /** @private */
  2938. struct cmd_fmon_gear_free_request {
  2939. BPMP_ABI_EMPTY
  2940. } BPMP_ABI_PACKED;
  2941. /** @private */
  2942. struct cmd_fmon_gear_free_response {
  2943. BPMP_ABI_EMPTY
  2944. } BPMP_ABI_PACKED;
  2945. /** @private */
  2946. struct cmd_fmon_gear_get_request {
  2947. BPMP_ABI_EMPTY
  2948. } BPMP_ABI_PACKED;
  2949. struct cmd_fmon_gear_get_response {
  2950. int64_t rate;
  2951. } BPMP_ABI_PACKED;
  2952. struct cmd_fmon_fault_sts_get_request {
  2953. uint32_t fault_type; /**< @ref fmon_fault_type */
  2954. } BPMP_ABI_PACKED;
  2955. struct cmd_fmon_fault_sts_get_response {
  2956. uint32_t fault_sts;
  2957. } BPMP_ABI_PACKED;
  2958. /**
  2959. * @ingroup FMON
  2960. * @brief Request with #MRQ_FMON
  2961. *
  2962. * Used by the sender of an #MRQ_FMON message to configure clock
  2963. * frequency monitors. The FMON request is split into several
  2964. * sub-commands. Some sub-commands require no additional data.
  2965. * Others have a sub-command specific payload
  2966. *
  2967. * |sub-command |payload |
  2968. * |----------------------------|-----------------------|
  2969. * |CMD_FMON_GEAR_CLAMP |fmon_gear_clamp |
  2970. * |CMD_FMON_GEAR_FREE |- |
  2971. * |CMD_FMON_GEAR_GET |- |
  2972. * |CMD_FMON_FAULT_STS_GET |fmon_fault_sts_get |
  2973. *
  2974. */
  2975. struct mrq_fmon_request {
  2976. /** @brief Sub-command and clock id concatenated to 32-bit word.
  2977. * - bits[31..24] is the sub-cmd.
  2978. * - bits[23..0] is monitored clock id used to select target
  2979. * FMON
  2980. */
  2981. uint32_t cmd_and_id;
  2982. union {
  2983. struct cmd_fmon_gear_clamp_request fmon_gear_clamp;
  2984. /** @private */
  2985. struct cmd_fmon_gear_free_request fmon_gear_free;
  2986. /** @private */
  2987. struct cmd_fmon_gear_get_request fmon_gear_get;
  2988. struct cmd_fmon_fault_sts_get_request fmon_fault_sts_get;
  2989. } BPMP_UNION_ANON;
  2990. } BPMP_ABI_PACKED;
  2991. /**
  2992. * @ingroup FMON
  2993. * @brief Response to MRQ_FMON
  2994. *
  2995. * Each sub-command supported by @ref mrq_fmon_request may
  2996. * return sub-command-specific data as indicated below.
  2997. *
  2998. * |sub-command |payload |
  2999. * |----------------------------|------------------------|
  3000. * |CMD_FMON_GEAR_CLAMP |- |
  3001. * |CMD_FMON_GEAR_FREE |- |
  3002. * |CMD_FMON_GEAR_GET |fmon_gear_get |
  3003. * |CMD_FMON_FAULT_STS_GET |fmon_fault_sts_get |
  3004. *
  3005. */
  3006. struct mrq_fmon_response {
  3007. union {
  3008. /** @private */
  3009. struct cmd_fmon_gear_clamp_response fmon_gear_clamp;
  3010. /** @private */
  3011. struct cmd_fmon_gear_free_response fmon_gear_free;
  3012. struct cmd_fmon_gear_get_response fmon_gear_get;
  3013. struct cmd_fmon_fault_sts_get_response fmon_fault_sts_get;
  3014. } BPMP_UNION_ANON;
  3015. } BPMP_ABI_PACKED;
  3016. /** @endcond (bpmp_t194 || bpmp_t234) */
  3017. /** @} FMON */
  3018. /**
  3019. * @ingroup MRQ_Codes
  3020. * @def MRQ_EC
  3021. * @brief Provide status information on faults reported by Error
  3022. * Collator (EC) to HSM.
  3023. *
  3024. * * Platforms: T194
  3025. * @cond bpmp_t194
  3026. * * Initiators: CCPLEX
  3027. * * Targets: BPMP
  3028. * * Request Payload: @ref mrq_ec_request
  3029. * * Response Payload: @ref mrq_ec_response
  3030. *
  3031. * @note This MRQ ABI is under construction, and subject to change
  3032. *
  3033. * @endcond bpmp_t194
  3034. * @addtogroup EC
  3035. * @{
  3036. * @cond bpmp_t194
  3037. */
  3038. enum {
  3039. /**
  3040. * @cond DEPRECATED
  3041. * @brief Retrieve specified EC status.
  3042. *
  3043. * mrq_response::err is 0 if the operation was successful, or @n
  3044. * -#BPMP_ENODEV if target EC is not owned by BPMP @n
  3045. * -#BPMP_EACCES if target EC power domain is turned off @n
  3046. * -#BPMP_EBADCMD if subcommand is not supported
  3047. * @endcond DEPRECATED
  3048. */
  3049. CMD_EC_STATUS_GET = 1, /* deprecated */
  3050. /**
  3051. * @brief Retrieve specified EC extended status (includes error
  3052. * counter and user values).
  3053. *
  3054. * mrq_response::err is 0 if the operation was successful, or @n
  3055. * -#BPMP_ENODEV if target EC is not owned by BPMP @n
  3056. * -#BPMP_EACCES if target EC power domain is turned off @n
  3057. * -#BPMP_EBADCMD if subcommand is not supported
  3058. */
  3059. CMD_EC_STATUS_EX_GET = 2,
  3060. CMD_EC_NUM,
  3061. };
  3062. /** @brief BPMP ECs error types */
  3063. enum bpmp_ec_err_type {
  3064. /** @brief Parity error on internal data path
  3065. *
  3066. * Error descriptor @ref ec_err_simple_desc.
  3067. */
  3068. EC_ERR_TYPE_PARITY_INTERNAL = 1,
  3069. /** @brief ECC SEC error on internal data path
  3070. *
  3071. * Error descriptor @ref ec_err_simple_desc.
  3072. */
  3073. EC_ERR_TYPE_ECC_SEC_INTERNAL = 2,
  3074. /** @brief ECC DED error on internal data path
  3075. *
  3076. * Error descriptor @ref ec_err_simple_desc.
  3077. */
  3078. EC_ERR_TYPE_ECC_DED_INTERNAL = 3,
  3079. /** @brief Comparator error
  3080. *
  3081. * Error descriptor @ref ec_err_simple_desc.
  3082. */
  3083. EC_ERR_TYPE_COMPARATOR = 4,
  3084. /** @brief Register parity error
  3085. *
  3086. * Error descriptor @ref ec_err_reg_parity_desc.
  3087. */
  3088. EC_ERR_TYPE_REGISTER_PARITY = 5,
  3089. /** @brief Parity error from on-chip SRAM/FIFO
  3090. *
  3091. * Error descriptor @ref ec_err_simple_desc.
  3092. */
  3093. EC_ERR_TYPE_PARITY_SRAM = 6,
  3094. /** @brief Clock Monitor error
  3095. *
  3096. * Error descriptor @ref ec_err_fmon_desc.
  3097. */
  3098. EC_ERR_TYPE_CLOCK_MONITOR = 9,
  3099. /** @brief Voltage Monitor error
  3100. *
  3101. * Error descriptor @ref ec_err_vmon_desc.
  3102. */
  3103. EC_ERR_TYPE_VOLTAGE_MONITOR = 10,
  3104. /** @brief SW Correctable error
  3105. *
  3106. * Error descriptor @ref ec_err_sw_error_desc.
  3107. */
  3108. EC_ERR_TYPE_SW_CORRECTABLE = 16,
  3109. /** @brief SW Uncorrectable error
  3110. *
  3111. * Error descriptor @ref ec_err_sw_error_desc.
  3112. */
  3113. EC_ERR_TYPE_SW_UNCORRECTABLE = 17,
  3114. /** @brief Other HW Correctable error
  3115. *
  3116. * Error descriptor @ref ec_err_simple_desc.
  3117. */
  3118. EC_ERR_TYPE_OTHER_HW_CORRECTABLE = 32,
  3119. /** @brief Other HW Uncorrectable error
  3120. *
  3121. * Error descriptor @ref ec_err_simple_desc.
  3122. */
  3123. EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE = 33,
  3124. };
  3125. /** @brief Group of registers with parity error. */
  3126. enum ec_registers_group {
  3127. /** @brief Functional registers group */
  3128. EC_ERR_GROUP_FUNC_REG = 0U,
  3129. /** @brief SCR registers group */
  3130. EC_ERR_GROUP_SCR_REG = 1U,
  3131. };
  3132. /**
  3133. * @defgroup bpmp_ec_status_flags EC Status Flags
  3134. * @addtogroup bpmp_ec_status_flags
  3135. * @{
  3136. */
  3137. /** @brief No EC error found flag */
  3138. #define EC_STATUS_FLAG_NO_ERROR 0x0001U
  3139. /** @brief Last EC error found flag */
  3140. #define EC_STATUS_FLAG_LAST_ERROR 0x0002U
  3141. /** @brief EC latent error flag */
  3142. #define EC_STATUS_FLAG_LATENT_ERROR 0x0004U
  3143. /** @} bpmp_ec_status_flags */
  3144. /**
  3145. * @defgroup bpmp_ec_desc_flags EC Descriptor Flags
  3146. * @addtogroup bpmp_ec_desc_flags
  3147. * @{
  3148. */
  3149. /** @brief EC descriptor error resolved flag */
  3150. #define EC_DESC_FLAG_RESOLVED 0x0001U
  3151. /** @brief EC descriptor failed to retrieve id flag */
  3152. #define EC_DESC_FLAG_NO_ID 0x0002U
  3153. /** @} bpmp_ec_desc_flags */
  3154. /**
  3155. * |error type | fmon_clk_id values |
  3156. * |---------------------------------|---------------------------|
  3157. * |@ref EC_ERR_TYPE_CLOCK_MONITOR |@ref bpmp_clock_ids |
  3158. */
  3159. struct ec_err_fmon_desc {
  3160. /** @brief Bitmask of @ref bpmp_ec_desc_flags */
  3161. uint16_t desc_flags;
  3162. /** @brief FMON monitored clock id */
  3163. uint16_t fmon_clk_id;
  3164. /**
  3165. * @brief Bitmask of fault flags
  3166. *
  3167. * @ref bpmp_fmon_faults_flags
  3168. */
  3169. uint32_t fmon_faults;
  3170. /** @brief FMON faults access error */
  3171. int32_t fmon_access_error;
  3172. } BPMP_ABI_PACKED;
  3173. /**
  3174. * | error type | vmon_adc_id values |
  3175. * |---------------------------------|---------------------------|
  3176. * |@ref EC_ERR_TYPE_VOLTAGE_MONITOR |@ref bpmp_adc_ids |
  3177. */
  3178. struct ec_err_vmon_desc {
  3179. /** @brief Bitmask of @ref bpmp_ec_desc_flags */
  3180. uint16_t desc_flags;
  3181. /** @brief VMON rail adc id */
  3182. uint16_t vmon_adc_id;
  3183. /** @brief Bitmask of bpmp_vmon_faults_flags */
  3184. uint32_t vmon_faults;
  3185. /** @brief VMON faults access error */
  3186. int32_t vmon_access_error;
  3187. } BPMP_ABI_PACKED;
  3188. /**
  3189. * |error type | reg_id values |
  3190. * |---------------------------------|-----------------------|
  3191. * |@ref EC_ERR_TYPE_REGISTER_PARITY | bpmp_ec_registers_ids |
  3192. */
  3193. struct ec_err_reg_parity_desc {
  3194. /** @brief Bitmask of @ref bpmp_ec_desc_flags */
  3195. uint16_t desc_flags;
  3196. /** @brief Register id */
  3197. uint16_t reg_id;
  3198. /** @brief Register group @ref ec_registers_group */
  3199. uint16_t reg_group;
  3200. } BPMP_ABI_PACKED;
  3201. /**
  3202. * |error type | err_source_id values |
  3203. * |--------------------------------- |----------------------|
  3204. * |@ref EC_ERR_TYPE_SW_CORRECTABLE | bpmp_ec_ce_swd_ids |
  3205. * |@ref EC_ERR_TYPE_SW_UNCORRECTABLE | bpmp_ec_ue_swd_ids |
  3206. */
  3207. struct ec_err_sw_error_desc {
  3208. /** @brief Bitmask of @ref bpmp_ec_desc_flags */
  3209. uint16_t desc_flags;
  3210. /** @brief Error source id */
  3211. uint16_t err_source_id;
  3212. /** @brief Sw error data */
  3213. uint32_t sw_error_data;
  3214. } BPMP_ABI_PACKED;
  3215. /**
  3216. * |error type | err_source_id values |
  3217. * |----------------------------------------|------------------------|
  3218. * |@ref EC_ERR_TYPE_PARITY_INTERNAL | bpmp_ec_ipath_ids |
  3219. * |@ref EC_ERR_TYPE_ECC_SEC_INTERNAL | bpmp_ec_ipath_ids |
  3220. * |@ref EC_ERR_TYPE_ECC_DED_INTERNAL | bpmp_ec_ipath_ids |
  3221. * |@ref EC_ERR_TYPE_COMPARATOR | bpmp_ec_comparator_ids|
  3222. * |@ref EC_ERR_TYPE_OTHER_HW_CORRECTABLE | bpmp_ec_misc_hwd_ids |
  3223. * |@ref EC_ERR_TYPE_OTHER_HW_UNCORRECTABLE | bpmp_ec_misc_hwd_ids |
  3224. * |@ref EC_ERR_TYPE_PARITY_SRAM | bpmp_clock_ids |
  3225. */
  3226. struct ec_err_simple_desc {
  3227. /** @brief Bitmask of @ref bpmp_ec_desc_flags */
  3228. uint16_t desc_flags;
  3229. /** @brief Error source id. Id space depends on error type. */
  3230. uint16_t err_source_id;
  3231. } BPMP_ABI_PACKED;
  3232. /** @brief Union of EC error descriptors */
  3233. union ec_err_desc {
  3234. struct ec_err_fmon_desc fmon_desc;
  3235. struct ec_err_vmon_desc vmon_desc;
  3236. struct ec_err_reg_parity_desc reg_parity_desc;
  3237. struct ec_err_sw_error_desc sw_error_desc;
  3238. struct ec_err_simple_desc simple_desc;
  3239. } BPMP_ABI_PACKED;
  3240. struct cmd_ec_status_get_request {
  3241. /** @brief HSM error line number that identifies target EC. */
  3242. uint32_t ec_hsm_id;
  3243. } BPMP_ABI_PACKED;
  3244. /** EC status maximum number of descriptors */
  3245. #define EC_ERR_STATUS_DESC_MAX_NUM 4U
  3246. /**
  3247. * @cond DEPRECATED
  3248. */
  3249. struct cmd_ec_status_get_response {
  3250. /** @brief Target EC id (the same id received with request). */
  3251. uint32_t ec_hsm_id;
  3252. /**
  3253. * @brief Bitmask of @ref bpmp_ec_status_flags
  3254. *
  3255. * If NO_ERROR flag is set, error_ fields should be ignored
  3256. */
  3257. uint32_t ec_status_flags;
  3258. /** @brief Found EC error index. */
  3259. uint32_t error_idx;
  3260. /** @brief Found EC error type @ref bpmp_ec_err_type. */
  3261. uint32_t error_type;
  3262. /** @brief Number of returned EC error descriptors */
  3263. uint32_t error_desc_num;
  3264. /** @brief EC error descriptors */
  3265. union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];
  3266. } BPMP_ABI_PACKED;
  3267. /** @endcond DEPRECATED */
  3268. struct cmd_ec_status_ex_get_response {
  3269. /** @brief Target EC id (the same id received with request). */
  3270. uint32_t ec_hsm_id;
  3271. /**
  3272. * @brief Bitmask of @ref bpmp_ec_status_flags
  3273. *
  3274. * If NO_ERROR flag is set, error_ fields should be ignored
  3275. */
  3276. uint32_t ec_status_flags;
  3277. /** @brief Found EC error index. */
  3278. uint32_t error_idx;
  3279. /** @brief Found EC error type @ref bpmp_ec_err_type. */
  3280. uint32_t error_type;
  3281. /** @brief Found EC mission error counter value */
  3282. uint32_t error_counter;
  3283. /** @brief Found EC mission error user value */
  3284. uint32_t error_uval;
  3285. /** @brief Reserved entry */
  3286. uint32_t reserved;
  3287. /** @brief Number of returned EC error descriptors */
  3288. uint32_t error_desc_num;
  3289. /** @brief EC error descriptors */
  3290. union ec_err_desc error_descs[EC_ERR_STATUS_DESC_MAX_NUM];
  3291. } BPMP_ABI_PACKED;
  3292. /**
  3293. * @ingroup EC
  3294. * @brief Request with #MRQ_EC
  3295. *
  3296. * Used by the sender of an #MRQ_EC message to access ECs owned
  3297. * by BPMP.
  3298. *
  3299. * @cond DEPRECATED
  3300. * |sub-command |payload |
  3301. * |----------------------------|-----------------------|
  3302. * |@ref CMD_EC_STATUS_GET |ec_status_get |
  3303. * @endcond DEPRECATED
  3304. *
  3305. * |sub-command |payload |
  3306. * |----------------------------|-----------------------|
  3307. * |@ref CMD_EC_STATUS_EX_GET |ec_status_get |
  3308. *
  3309. */
  3310. struct mrq_ec_request {
  3311. /** @brief Sub-command id. */
  3312. uint32_t cmd_id;
  3313. union {
  3314. struct cmd_ec_status_get_request ec_status_get;
  3315. } BPMP_UNION_ANON;
  3316. } BPMP_ABI_PACKED;
  3317. /**
  3318. * @ingroup EC
  3319. * @brief Response to MRQ_EC
  3320. *
  3321. * Each sub-command supported by @ref mrq_ec_request may return
  3322. * sub-command-specific data as indicated below.
  3323. *
  3324. * @cond DEPRECATED
  3325. * |sub-command |payload |
  3326. * |----------------------------|------------------------|
  3327. * |@ref CMD_EC_STATUS_GET |ec_status_get |
  3328. * @endcond DEPRECATED
  3329. *
  3330. * |sub-command |payload |
  3331. * |----------------------------|------------------------|
  3332. * |@ref CMD_EC_STATUS_EX_GET |ec_status_ex_get |
  3333. *
  3334. */
  3335. struct mrq_ec_response {
  3336. union {
  3337. /**
  3338. * @cond DEPRECATED
  3339. */
  3340. struct cmd_ec_status_get_response ec_status_get;
  3341. /** @endcond DEPRECATED */
  3342. struct cmd_ec_status_ex_get_response ec_status_ex_get;
  3343. } BPMP_UNION_ANON;
  3344. } BPMP_ABI_PACKED;
  3345. /** @endcond bpmp_t194 */
  3346. /** @} EC */
  3347. /**
  3348. * @ingroup MRQ_Codes
  3349. * @def MRQ_TELEMETRY
  3350. * @brief Get address of memory buffer refreshed with recently sampled
  3351. * telemetry data
  3352. *
  3353. * * Platforms: TH500 onwards
  3354. * @cond bpmp_th500
  3355. * * Initiators: CCPLEX
  3356. * * Targets: BPMP
  3357. * * Request Payload: N/A
  3358. * * Response Payload: @ref mrq_telemetry_response
  3359. * @addtogroup Telemetry
  3360. * @{
  3361. */
  3362. /**
  3363. * @brief Response to #MRQ_TELEMETRY
  3364. *
  3365. * mrq_response::err is
  3366. * * 0: Telemetry data is available at returned address
  3367. * * -#BPMP_EACCES: MRQ master is not allowed to request buffer refresh
  3368. * * -#BPMP_ENAVAIL: Telemetry buffer cannot be refreshed via this MRQ channel
  3369. * * -#BPMP_ENOTSUP: Telemetry buffer is not supported by BPMP-FW
  3370. * * -#BPMP_ENODEV: Telemetry mrq is not supported by BPMP-FW
  3371. */
  3372. struct mrq_telemetry_response {
  3373. /** @brief Physical address of telemetry data buffer */
  3374. uint64_t data_buf_addr; /**< see @ref bpmp_telemetry_layout */
  3375. } BPMP_ABI_PACKED;
  3376. /** @} Telemetry */
  3377. /** @endcond bpmp_th500 */
  3378. /**
  3379. * @ingroup MRQ_Codes
  3380. * @def MRQ_PWR_LIMIT
  3381. * @brief Control power limits.
  3382. *
  3383. * * Platforms: TH500 onwards
  3384. * @cond bpmp_th500
  3385. * * Initiators: Any
  3386. * * Targets: BPMP
  3387. * * Request Payload: @ref mrq_pwr_limit_request
  3388. * * Response Payload: @ref mrq_pwr_limit_response
  3389. *
  3390. * @addtogroup Pwrlimit
  3391. * @{
  3392. */
  3393. enum mrq_pwr_limit_cmd {
  3394. /**
  3395. * @brief Check whether the BPMP-FW supports the specified
  3396. * command
  3397. *
  3398. * mrq_response::err is 0 if the specified request is
  3399. * supported and -#BPMP_ENODEV otherwise.
  3400. */
  3401. CMD_PWR_LIMIT_QUERY_ABI = 0,
  3402. /**
  3403. * @brief Set power limit
  3404. *
  3405. * mrq_response:err is
  3406. * * 0: Success
  3407. * * -#BPMP_ENODEV: Pwr limit mrq is not supported by BPMP-FW
  3408. * * -#BPMP_ENAVAIL: Invalid request parameters
  3409. * * -#BPMP_EACCES: Request is not accepted
  3410. */
  3411. CMD_PWR_LIMIT_SET = 1,
  3412. /**
  3413. * @brief Get power limit setting
  3414. *
  3415. * mrq_response:err is
  3416. * * 0: Success
  3417. * * -#BPMP_ENODEV: Pwr limit mrq is not supported by BPMP-FW
  3418. * * -#BPMP_ENAVAIL: Invalid request parameters
  3419. */
  3420. CMD_PWR_LIMIT_GET = 2,
  3421. /**
  3422. * @brief Get current power cap
  3423. *
  3424. * mrq_response:err is
  3425. * * 0: Success
  3426. * * -#BPMP_ENODEV: Pwr limit mrq is not supported by BPMP-FW
  3427. * * -#BPMP_ENAVAIL: Invalid request parameters
  3428. */
  3429. CMD_PWR_LIMIT_CURR_CAP = 3,
  3430. };
  3431. /**
  3432. * @defgroup bpmp_pwr_limit_type PWR_LIMIT TYPEs
  3433. * @{
  3434. */
  3435. /** @brief Limit value specifies traget cap */
  3436. #define PWR_LIMIT_TYPE_TARGET_CAP 0U
  3437. /** @brief Limit value specifies maximum possible target cap */
  3438. #define PWR_LIMIT_TYPE_BOUND_MAX 1U
  3439. /** @brief Limit value specifies minimum possible target cap */
  3440. #define PWR_LIMIT_TYPE_BOUND_MIN 2U
  3441. /** @brief Number of limit types supported by mrq interface */
  3442. #define PWR_LIMIT_TYPE_NUM 3U
  3443. /** @} bpmp_pwr_limit_type */
  3444. /**
  3445. * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_QUERY_ABI
  3446. */
  3447. struct cmd_pwr_limit_query_abi_request {
  3448. uint32_t cmd_code; /**< @ref mrq_pwr_limit_cmd */
  3449. } BPMP_ABI_PACKED;
  3450. /**
  3451. * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_SET
  3452. *
  3453. * Set specified limit of specified type from specified source. The success of
  3454. * the request means that specified value is accepted as input to arbitration
  3455. * with other sources settings for the same limit of the same type. Zero limit
  3456. * is ignored by the arbitration (i.e., indicates "no limit set").
  3457. */
  3458. struct cmd_pwr_limit_set_request {
  3459. uint32_t limit_id; /**< @ref bpmp_pwr_limit_id */
  3460. uint32_t limit_src; /**< @ref bpmp_pwr_limit_src */
  3461. uint32_t limit_type; /**< @ref bpmp_pwr_limit_type */
  3462. uint32_t limit_setting;
  3463. } BPMP_ABI_PACKED;
  3464. /**
  3465. * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_GET
  3466. *
  3467. * Get previously set from specified source specified limit value of specified
  3468. * type.
  3469. */
  3470. struct cmd_pwr_limit_get_request {
  3471. uint32_t limit_id; /**< @ref bpmp_pwr_limit_id */
  3472. uint32_t limit_src; /**< @ref bpmp_pwr_limit_src */
  3473. uint32_t limit_type; /**< @ref bpmp_pwr_limit_type */
  3474. } BPMP_ABI_PACKED;
  3475. /**
  3476. * @brief Response data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_GET
  3477. */
  3478. struct cmd_pwr_limit_get_response {
  3479. uint32_t limit_setting;
  3480. } BPMP_ABI_PACKED;
  3481. /**
  3482. * @brief Request data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_CURR_CAP
  3483. *
  3484. * For specified limit get current power cap aggregated from all sources.
  3485. */
  3486. struct cmd_pwr_limit_curr_cap_request {
  3487. uint32_t limit_id; /**< @ref bpmp_pwr_limit_id */
  3488. } BPMP_ABI_PACKED;
  3489. /**
  3490. * @brief Response data for #MRQ_PWR_LIMIT command CMD_PWR_LIMIT_CURR_CAP
  3491. */
  3492. struct cmd_pwr_limit_curr_cap_response {
  3493. uint32_t curr_cap;
  3494. } BPMP_ABI_PACKED;
  3495. /**
  3496. * @brief Request with #MRQ_PWR_LIMIT
  3497. *
  3498. * |sub-command |payload |
  3499. * |----------------------------|---------------------------------|
  3500. * |CMD_PWR_LIMIT_QUERY_ABI | cmd_pwr_limit_query_abi_request |
  3501. * |CMD_PWR_LIMIT_SET | cmd_pwr_limit_set_request |
  3502. * |CMD_PWR_LIMIT_GET | cmd_pwr_limit_get_request |
  3503. * |CMD_PWR_LIMIT_CURR_CAP | cmd_pwr_limit_curr_cap_request |
  3504. */
  3505. struct mrq_pwr_limit_request {
  3506. uint32_t cmd;
  3507. union {
  3508. struct cmd_pwr_limit_query_abi_request pwr_limit_query_abi_req;
  3509. struct cmd_pwr_limit_set_request pwr_limit_set_req;
  3510. struct cmd_pwr_limit_get_request pwr_limit_get_req;
  3511. struct cmd_pwr_limit_curr_cap_request pwr_limit_curr_cap_req;
  3512. } BPMP_UNION_ANON;
  3513. } BPMP_ABI_PACKED;
  3514. /**
  3515. * @brief Response to MRQ_PWR_LIMIT
  3516. *
  3517. * |sub-command |payload |
  3518. * |----------------------------|---------------------------------|
  3519. * |CMD_PWR_LIMIT_QUERY_ABI | - |
  3520. * |CMD_PWR_LIMIT_SET | - |
  3521. * |CMD_PWR_LIMIT_GET | cmd_pwr_limit_get_response |
  3522. * |CMD_PWR_LIMIT_CURR_CAP | cmd_pwr_limit_curr_cap_response |
  3523. */
  3524. struct mrq_pwr_limit_response {
  3525. union {
  3526. struct cmd_pwr_limit_get_response pwr_limit_get_rsp;
  3527. struct cmd_pwr_limit_curr_cap_response pwr_limit_curr_cap_rsp;
  3528. } BPMP_UNION_ANON;
  3529. } BPMP_ABI_PACKED;
  3530. /** @} PwrLimit */
  3531. /** @endcond bpmp_th500 */
  3532. /**
  3533. * @ingroup MRQ_Codes
  3534. * @def MRQ_GEARS
  3535. * @brief Get thresholds for NDIV offset switching
  3536. *
  3537. * * Platforms: TH500 onwards
  3538. * @cond bpmp_th500
  3539. * * Initiators: CCPLEX
  3540. * * Targets: BPMP
  3541. * * Request Payload: N/A
  3542. * * Response Payload: @ref mrq_gears_response
  3543. * @addtogroup Gears
  3544. * @{
  3545. */
  3546. /**
  3547. * @brief Response to #MRQ_GEARS
  3548. *
  3549. * Used by the sender of an #MRQ_GEARS message to request thresholds
  3550. * for NDIV offset switching.
  3551. *
  3552. * The mrq_gears_response::ncpu array defines four thresholds in units
  3553. * of number of online CPUS to be used for choosing between five different
  3554. * NDIV offset settings for CCPLEX cluster NAFLLs
  3555. *
  3556. * 1. If number of online CPUs < ncpu[0] use offset0
  3557. * 2. If number of online CPUs < ncpu[1] use offset1
  3558. * 3. If number of online CPUs < ncpu[2] use offset2
  3559. * 4. If number of online CPUs < ncpu[3] use offset3
  3560. * 5. If number of online CPUs >= ncpu[3] disable offsetting
  3561. *
  3562. * For TH500 mrq_gears_response::ncpu array has four valid entries.
  3563. *
  3564. * mrq_response::err is
  3565. * * 0: gears defined and response data valid
  3566. * * -#BPMP_ENODEV: MRQ is not supported by BPMP-FW
  3567. * * -#BPMP_EACCES: Operation not permitted for the MRQ master
  3568. * * -#BPMP_ENAVAIL: NDIV offsetting is disabled
  3569. */
  3570. struct mrq_gears_response {
  3571. /** @brief number of online CPUs for each gear */
  3572. uint32_t ncpu[16];
  3573. } BPMP_ABI_PACKED;
  3574. /** @} Gears */
  3575. /** @endcond bpmp_th500 */
  3576. /**
  3577. * @addtogroup Error_Codes
  3578. * Negative values for mrq_response::err generally indicate some
  3579. * error. The ABI defines the following error codes. Negating these
  3580. * defines is an exercise left to the user.
  3581. * @{
  3582. */
  3583. /** @brief Operation not permitted */
  3584. #define BPMP_EPERM 1
  3585. /** @brief No such file or directory */
  3586. #define BPMP_ENOENT 2
  3587. /** @brief No MRQ handler */
  3588. #define BPMP_ENOHANDLER 3
  3589. /** @brief I/O error */
  3590. #define BPMP_EIO 5
  3591. /** @brief Bad sub-MRQ command */
  3592. #define BPMP_EBADCMD 6
  3593. /** @brief Resource temporarily unavailable */
  3594. #define BPMP_EAGAIN 11
  3595. /** @brief Not enough memory */
  3596. #define BPMP_ENOMEM 12
  3597. /** @brief Permission denied */
  3598. #define BPMP_EACCES 13
  3599. /** @brief Bad address */
  3600. #define BPMP_EFAULT 14
  3601. /** @brief Resource busy */
  3602. #define BPMP_EBUSY 16
  3603. /** @brief No such device */
  3604. #define BPMP_ENODEV 19
  3605. /** @brief Argument is a directory */
  3606. #define BPMP_EISDIR 21
  3607. /** @brief Invalid argument */
  3608. #define BPMP_EINVAL 22
  3609. /** @brief Timeout during operation */
  3610. #define BPMP_ETIMEDOUT 23
  3611. /** @brief Out of range */
  3612. #define BPMP_ERANGE 34
  3613. /** @brief Function not implemented */
  3614. #define BPMP_ENOSYS 38
  3615. /** @brief Invalid slot */
  3616. #define BPMP_EBADSLT 57
  3617. /** @brief Invalid message */
  3618. #define BPMP_EBADMSG 77
  3619. /** @brief Operation not supported */
  3620. #define BPMP_EOPNOTSUPP 95
  3621. /** @brief Targeted resource not available */
  3622. #define BPMP_ENAVAIL 119
  3623. /** @brief Not supported */
  3624. #define BPMP_ENOTSUP 134
  3625. /** @brief No such device or address */
  3626. #define BPMP_ENXIO 140
  3627. /** @} Error_Codes */
  3628. #if defined(BPMP_ABI_CHECKS)
  3629. #include "bpmp_abi_checks.h"
  3630. #endif
  3631. #endif