qed_int.c 97 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270
  1. /* QLogic qed NIC Driver
  2. * Copyright (c) 2015-2017 QLogic Corporation
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and /or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. #include <linux/types.h>
  33. #include <asm/byteorder.h>
  34. #include <linux/io.h>
  35. #include <linux/bitops.h>
  36. #include <linux/delay.h>
  37. #include <linux/dma-mapping.h>
  38. #include <linux/errno.h>
  39. #include <linux/interrupt.h>
  40. #include <linux/kernel.h>
  41. #include <linux/pci.h>
  42. #include <linux/slab.h>
  43. #include <linux/string.h>
  44. #include "qed.h"
  45. #include "qed_hsi.h"
  46. #include "qed_hw.h"
  47. #include "qed_init_ops.h"
  48. #include "qed_int.h"
  49. #include "qed_mcp.h"
  50. #include "qed_reg_addr.h"
  51. #include "qed_sp.h"
  52. #include "qed_sriov.h"
  53. #include "qed_vf.h"
  54. struct qed_pi_info {
  55. qed_int_comp_cb_t comp_cb;
  56. void *cookie;
  57. };
  58. struct qed_sb_sp_info {
  59. struct qed_sb_info sb_info;
  60. /* per protocol index data */
  61. struct qed_pi_info pi_info_arr[PIS_PER_SB];
  62. };
  63. enum qed_attention_type {
  64. QED_ATTN_TYPE_ATTN,
  65. QED_ATTN_TYPE_PARITY,
  66. };
  67. #define SB_ATTN_ALIGNED_SIZE(p_hwfn) \
  68. ALIGNED_TYPE_SIZE(struct atten_status_block, p_hwfn)
  69. struct aeu_invert_reg_bit {
  70. char bit_name[30];
  71. #define ATTENTION_PARITY (1 << 0)
  72. #define ATTENTION_LENGTH_MASK (0x00000ff0)
  73. #define ATTENTION_LENGTH_SHIFT (4)
  74. #define ATTENTION_LENGTH(flags) (((flags) & ATTENTION_LENGTH_MASK) >> \
  75. ATTENTION_LENGTH_SHIFT)
  76. #define ATTENTION_SINGLE (1 << ATTENTION_LENGTH_SHIFT)
  77. #define ATTENTION_PAR (ATTENTION_SINGLE | ATTENTION_PARITY)
  78. #define ATTENTION_PAR_INT ((2 << ATTENTION_LENGTH_SHIFT) | \
  79. ATTENTION_PARITY)
  80. /* Multiple bits start with this offset */
  81. #define ATTENTION_OFFSET_MASK (0x000ff000)
  82. #define ATTENTION_OFFSET_SHIFT (12)
  83. unsigned int flags;
  84. /* Callback to call if attention will be triggered */
  85. int (*cb)(struct qed_hwfn *p_hwfn);
  86. enum block_id block_index;
  87. };
  88. struct aeu_invert_reg {
  89. struct aeu_invert_reg_bit bits[32];
  90. };
  91. #define MAX_ATTN_GRPS (8)
  92. #define NUM_ATTN_REGS (9)
  93. /* HW Attention register */
  94. struct attn_hw_reg {
  95. u16 reg_idx; /* Index of this register in its block */
  96. u16 num_of_bits; /* number of valid attention bits */
  97. u32 sts_addr; /* Address of the STS register */
  98. u32 sts_clr_addr; /* Address of the STS_CLR register */
  99. u32 sts_wr_addr; /* Address of the STS_WR register */
  100. u32 mask_addr; /* Address of the MASK register */
  101. };
  102. /* HW block attention registers */
  103. struct attn_hw_regs {
  104. u16 num_of_int_regs; /* Number of interrupt regs */
  105. u16 num_of_prty_regs; /* Number of parity regs */
  106. struct attn_hw_reg **int_regs; /* interrupt regs */
  107. struct attn_hw_reg **prty_regs; /* parity regs */
  108. };
  109. /* HW block attention registers */
  110. struct attn_hw_block {
  111. const char *name; /* Block name */
  112. struct attn_hw_regs chip_regs[1];
  113. };
  114. static struct attn_hw_reg grc_int0_bb_b0 = {
  115. 0, 4, 0x50180, 0x5018c, 0x50188, 0x50184};
  116. static struct attn_hw_reg *grc_int_bb_b0_regs[1] = {
  117. &grc_int0_bb_b0};
  118. static struct attn_hw_reg grc_prty1_bb_b0 = {
  119. 0, 2, 0x50200, 0x5020c, 0x50208, 0x50204};
  120. static struct attn_hw_reg *grc_prty_bb_b0_regs[1] = {
  121. &grc_prty1_bb_b0};
  122. static struct attn_hw_reg miscs_int0_bb_b0 = {
  123. 0, 3, 0x9180, 0x918c, 0x9188, 0x9184};
  124. static struct attn_hw_reg miscs_int1_bb_b0 = {
  125. 1, 11, 0x9190, 0x919c, 0x9198, 0x9194};
  126. static struct attn_hw_reg *miscs_int_bb_b0_regs[2] = {
  127. &miscs_int0_bb_b0, &miscs_int1_bb_b0};
  128. static struct attn_hw_reg miscs_prty0_bb_b0 = {
  129. 0, 1, 0x91a0, 0x91ac, 0x91a8, 0x91a4};
  130. static struct attn_hw_reg *miscs_prty_bb_b0_regs[1] = {
  131. &miscs_prty0_bb_b0};
  132. static struct attn_hw_reg misc_int0_bb_b0 = {
  133. 0, 1, 0x8180, 0x818c, 0x8188, 0x8184};
  134. static struct attn_hw_reg *misc_int_bb_b0_regs[1] = {
  135. &misc_int0_bb_b0};
  136. static struct attn_hw_reg pglue_b_int0_bb_b0 = {
  137. 0, 23, 0x2a8180, 0x2a818c, 0x2a8188, 0x2a8184};
  138. static struct attn_hw_reg *pglue_b_int_bb_b0_regs[1] = {
  139. &pglue_b_int0_bb_b0};
  140. static struct attn_hw_reg pglue_b_prty0_bb_b0 = {
  141. 0, 1, 0x2a8190, 0x2a819c, 0x2a8198, 0x2a8194};
  142. static struct attn_hw_reg pglue_b_prty1_bb_b0 = {
  143. 1, 22, 0x2a8200, 0x2a820c, 0x2a8208, 0x2a8204};
  144. static struct attn_hw_reg *pglue_b_prty_bb_b0_regs[2] = {
  145. &pglue_b_prty0_bb_b0, &pglue_b_prty1_bb_b0};
  146. static struct attn_hw_reg cnig_int0_bb_b0 = {
  147. 0, 6, 0x2182e8, 0x2182f4, 0x2182f0, 0x2182ec};
  148. static struct attn_hw_reg *cnig_int_bb_b0_regs[1] = {
  149. &cnig_int0_bb_b0};
  150. static struct attn_hw_reg cnig_prty0_bb_b0 = {
  151. 0, 2, 0x218348, 0x218354, 0x218350, 0x21834c};
  152. static struct attn_hw_reg *cnig_prty_bb_b0_regs[1] = {
  153. &cnig_prty0_bb_b0};
  154. static struct attn_hw_reg cpmu_int0_bb_b0 = {
  155. 0, 1, 0x303e0, 0x303ec, 0x303e8, 0x303e4};
  156. static struct attn_hw_reg *cpmu_int_bb_b0_regs[1] = {
  157. &cpmu_int0_bb_b0};
  158. static struct attn_hw_reg ncsi_int0_bb_b0 = {
  159. 0, 1, 0x404cc, 0x404d8, 0x404d4, 0x404d0};
  160. static struct attn_hw_reg *ncsi_int_bb_b0_regs[1] = {
  161. &ncsi_int0_bb_b0};
  162. static struct attn_hw_reg ncsi_prty1_bb_b0 = {
  163. 0, 1, 0x40000, 0x4000c, 0x40008, 0x40004};
  164. static struct attn_hw_reg *ncsi_prty_bb_b0_regs[1] = {
  165. &ncsi_prty1_bb_b0};
  166. static struct attn_hw_reg opte_prty1_bb_b0 = {
  167. 0, 11, 0x53000, 0x5300c, 0x53008, 0x53004};
  168. static struct attn_hw_reg opte_prty0_bb_b0 = {
  169. 1, 1, 0x53208, 0x53214, 0x53210, 0x5320c};
  170. static struct attn_hw_reg *opte_prty_bb_b0_regs[2] = {
  171. &opte_prty1_bb_b0, &opte_prty0_bb_b0};
  172. static struct attn_hw_reg bmb_int0_bb_b0 = {
  173. 0, 16, 0x5400c0, 0x5400cc, 0x5400c8, 0x5400c4};
  174. static struct attn_hw_reg bmb_int1_bb_b0 = {
  175. 1, 28, 0x5400d8, 0x5400e4, 0x5400e0, 0x5400dc};
  176. static struct attn_hw_reg bmb_int2_bb_b0 = {
  177. 2, 26, 0x5400f0, 0x5400fc, 0x5400f8, 0x5400f4};
  178. static struct attn_hw_reg bmb_int3_bb_b0 = {
  179. 3, 31, 0x540108, 0x540114, 0x540110, 0x54010c};
  180. static struct attn_hw_reg bmb_int4_bb_b0 = {
  181. 4, 27, 0x540120, 0x54012c, 0x540128, 0x540124};
  182. static struct attn_hw_reg bmb_int5_bb_b0 = {
  183. 5, 29, 0x540138, 0x540144, 0x540140, 0x54013c};
  184. static struct attn_hw_reg bmb_int6_bb_b0 = {
  185. 6, 30, 0x540150, 0x54015c, 0x540158, 0x540154};
  186. static struct attn_hw_reg bmb_int7_bb_b0 = {
  187. 7, 32, 0x540168, 0x540174, 0x540170, 0x54016c};
  188. static struct attn_hw_reg bmb_int8_bb_b0 = {
  189. 8, 32, 0x540184, 0x540190, 0x54018c, 0x540188};
  190. static struct attn_hw_reg bmb_int9_bb_b0 = {
  191. 9, 32, 0x54019c, 0x5401a8, 0x5401a4, 0x5401a0};
  192. static struct attn_hw_reg bmb_int10_bb_b0 = {
  193. 10, 3, 0x5401b4, 0x5401c0, 0x5401bc, 0x5401b8};
  194. static struct attn_hw_reg bmb_int11_bb_b0 = {
  195. 11, 4, 0x5401cc, 0x5401d8, 0x5401d4, 0x5401d0};
  196. static struct attn_hw_reg *bmb_int_bb_b0_regs[12] = {
  197. &bmb_int0_bb_b0, &bmb_int1_bb_b0, &bmb_int2_bb_b0, &bmb_int3_bb_b0,
  198. &bmb_int4_bb_b0, &bmb_int5_bb_b0, &bmb_int6_bb_b0, &bmb_int7_bb_b0,
  199. &bmb_int8_bb_b0, &bmb_int9_bb_b0, &bmb_int10_bb_b0, &bmb_int11_bb_b0};
  200. static struct attn_hw_reg bmb_prty0_bb_b0 = {
  201. 0, 5, 0x5401dc, 0x5401e8, 0x5401e4, 0x5401e0};
  202. static struct attn_hw_reg bmb_prty1_bb_b0 = {
  203. 1, 31, 0x540400, 0x54040c, 0x540408, 0x540404};
  204. static struct attn_hw_reg bmb_prty2_bb_b0 = {
  205. 2, 15, 0x540410, 0x54041c, 0x540418, 0x540414};
  206. static struct attn_hw_reg *bmb_prty_bb_b0_regs[3] = {
  207. &bmb_prty0_bb_b0, &bmb_prty1_bb_b0, &bmb_prty2_bb_b0};
  208. static struct attn_hw_reg pcie_prty1_bb_b0 = {
  209. 0, 17, 0x54000, 0x5400c, 0x54008, 0x54004};
  210. static struct attn_hw_reg *pcie_prty_bb_b0_regs[1] = {
  211. &pcie_prty1_bb_b0};
  212. static struct attn_hw_reg mcp2_prty0_bb_b0 = {
  213. 0, 1, 0x52040, 0x5204c, 0x52048, 0x52044};
  214. static struct attn_hw_reg mcp2_prty1_bb_b0 = {
  215. 1, 12, 0x52204, 0x52210, 0x5220c, 0x52208};
  216. static struct attn_hw_reg *mcp2_prty_bb_b0_regs[2] = {
  217. &mcp2_prty0_bb_b0, &mcp2_prty1_bb_b0};
  218. static struct attn_hw_reg pswhst_int0_bb_b0 = {
  219. 0, 18, 0x2a0180, 0x2a018c, 0x2a0188, 0x2a0184};
  220. static struct attn_hw_reg *pswhst_int_bb_b0_regs[1] = {
  221. &pswhst_int0_bb_b0};
  222. static struct attn_hw_reg pswhst_prty0_bb_b0 = {
  223. 0, 1, 0x2a0190, 0x2a019c, 0x2a0198, 0x2a0194};
  224. static struct attn_hw_reg pswhst_prty1_bb_b0 = {
  225. 1, 17, 0x2a0200, 0x2a020c, 0x2a0208, 0x2a0204};
  226. static struct attn_hw_reg *pswhst_prty_bb_b0_regs[2] = {
  227. &pswhst_prty0_bb_b0, &pswhst_prty1_bb_b0};
  228. static struct attn_hw_reg pswhst2_int0_bb_b0 = {
  229. 0, 5, 0x29e180, 0x29e18c, 0x29e188, 0x29e184};
  230. static struct attn_hw_reg *pswhst2_int_bb_b0_regs[1] = {
  231. &pswhst2_int0_bb_b0};
  232. static struct attn_hw_reg pswhst2_prty0_bb_b0 = {
  233. 0, 1, 0x29e190, 0x29e19c, 0x29e198, 0x29e194};
  234. static struct attn_hw_reg *pswhst2_prty_bb_b0_regs[1] = {
  235. &pswhst2_prty0_bb_b0};
  236. static struct attn_hw_reg pswrd_int0_bb_b0 = {
  237. 0, 3, 0x29c180, 0x29c18c, 0x29c188, 0x29c184};
  238. static struct attn_hw_reg *pswrd_int_bb_b0_regs[1] = {
  239. &pswrd_int0_bb_b0};
  240. static struct attn_hw_reg pswrd_prty0_bb_b0 = {
  241. 0, 1, 0x29c190, 0x29c19c, 0x29c198, 0x29c194};
  242. static struct attn_hw_reg *pswrd_prty_bb_b0_regs[1] = {
  243. &pswrd_prty0_bb_b0};
  244. static struct attn_hw_reg pswrd2_int0_bb_b0 = {
  245. 0, 5, 0x29d180, 0x29d18c, 0x29d188, 0x29d184};
  246. static struct attn_hw_reg *pswrd2_int_bb_b0_regs[1] = {
  247. &pswrd2_int0_bb_b0};
  248. static struct attn_hw_reg pswrd2_prty0_bb_b0 = {
  249. 0, 1, 0x29d190, 0x29d19c, 0x29d198, 0x29d194};
  250. static struct attn_hw_reg pswrd2_prty1_bb_b0 = {
  251. 1, 31, 0x29d200, 0x29d20c, 0x29d208, 0x29d204};
  252. static struct attn_hw_reg pswrd2_prty2_bb_b0 = {
  253. 2, 3, 0x29d210, 0x29d21c, 0x29d218, 0x29d214};
  254. static struct attn_hw_reg *pswrd2_prty_bb_b0_regs[3] = {
  255. &pswrd2_prty0_bb_b0, &pswrd2_prty1_bb_b0, &pswrd2_prty2_bb_b0};
  256. static struct attn_hw_reg pswwr_int0_bb_b0 = {
  257. 0, 16, 0x29a180, 0x29a18c, 0x29a188, 0x29a184};
  258. static struct attn_hw_reg *pswwr_int_bb_b0_regs[1] = {
  259. &pswwr_int0_bb_b0};
  260. static struct attn_hw_reg pswwr_prty0_bb_b0 = {
  261. 0, 1, 0x29a190, 0x29a19c, 0x29a198, 0x29a194};
  262. static struct attn_hw_reg *pswwr_prty_bb_b0_regs[1] = {
  263. &pswwr_prty0_bb_b0};
  264. static struct attn_hw_reg pswwr2_int0_bb_b0 = {
  265. 0, 19, 0x29b180, 0x29b18c, 0x29b188, 0x29b184};
  266. static struct attn_hw_reg *pswwr2_int_bb_b0_regs[1] = {
  267. &pswwr2_int0_bb_b0};
  268. static struct attn_hw_reg pswwr2_prty0_bb_b0 = {
  269. 0, 1, 0x29b190, 0x29b19c, 0x29b198, 0x29b194};
  270. static struct attn_hw_reg pswwr2_prty1_bb_b0 = {
  271. 1, 31, 0x29b200, 0x29b20c, 0x29b208, 0x29b204};
  272. static struct attn_hw_reg pswwr2_prty2_bb_b0 = {
  273. 2, 31, 0x29b210, 0x29b21c, 0x29b218, 0x29b214};
  274. static struct attn_hw_reg pswwr2_prty3_bb_b0 = {
  275. 3, 31, 0x29b220, 0x29b22c, 0x29b228, 0x29b224};
  276. static struct attn_hw_reg pswwr2_prty4_bb_b0 = {
  277. 4, 20, 0x29b230, 0x29b23c, 0x29b238, 0x29b234};
  278. static struct attn_hw_reg *pswwr2_prty_bb_b0_regs[5] = {
  279. &pswwr2_prty0_bb_b0, &pswwr2_prty1_bb_b0, &pswwr2_prty2_bb_b0,
  280. &pswwr2_prty3_bb_b0, &pswwr2_prty4_bb_b0};
  281. static struct attn_hw_reg pswrq_int0_bb_b0 = {
  282. 0, 21, 0x280180, 0x28018c, 0x280188, 0x280184};
  283. static struct attn_hw_reg *pswrq_int_bb_b0_regs[1] = {
  284. &pswrq_int0_bb_b0};
  285. static struct attn_hw_reg pswrq_prty0_bb_b0 = {
  286. 0, 1, 0x280190, 0x28019c, 0x280198, 0x280194};
  287. static struct attn_hw_reg *pswrq_prty_bb_b0_regs[1] = {
  288. &pswrq_prty0_bb_b0};
  289. static struct attn_hw_reg pswrq2_int0_bb_b0 = {
  290. 0, 15, 0x240180, 0x24018c, 0x240188, 0x240184};
  291. static struct attn_hw_reg *pswrq2_int_bb_b0_regs[1] = {
  292. &pswrq2_int0_bb_b0};
  293. static struct attn_hw_reg pswrq2_prty1_bb_b0 = {
  294. 0, 9, 0x240200, 0x24020c, 0x240208, 0x240204};
  295. static struct attn_hw_reg *pswrq2_prty_bb_b0_regs[1] = {
  296. &pswrq2_prty1_bb_b0};
  297. static struct attn_hw_reg pglcs_int0_bb_b0 = {
  298. 0, 1, 0x1d00, 0x1d0c, 0x1d08, 0x1d04};
  299. static struct attn_hw_reg *pglcs_int_bb_b0_regs[1] = {
  300. &pglcs_int0_bb_b0};
  301. static struct attn_hw_reg dmae_int0_bb_b0 = {
  302. 0, 2, 0xc180, 0xc18c, 0xc188, 0xc184};
  303. static struct attn_hw_reg *dmae_int_bb_b0_regs[1] = {
  304. &dmae_int0_bb_b0};
  305. static struct attn_hw_reg dmae_prty1_bb_b0 = {
  306. 0, 3, 0xc200, 0xc20c, 0xc208, 0xc204};
  307. static struct attn_hw_reg *dmae_prty_bb_b0_regs[1] = {
  308. &dmae_prty1_bb_b0};
  309. static struct attn_hw_reg ptu_int0_bb_b0 = {
  310. 0, 8, 0x560180, 0x56018c, 0x560188, 0x560184};
  311. static struct attn_hw_reg *ptu_int_bb_b0_regs[1] = {
  312. &ptu_int0_bb_b0};
  313. static struct attn_hw_reg ptu_prty1_bb_b0 = {
  314. 0, 18, 0x560200, 0x56020c, 0x560208, 0x560204};
  315. static struct attn_hw_reg *ptu_prty_bb_b0_regs[1] = {
  316. &ptu_prty1_bb_b0};
  317. static struct attn_hw_reg tcm_int0_bb_b0 = {
  318. 0, 8, 0x1180180, 0x118018c, 0x1180188, 0x1180184};
  319. static struct attn_hw_reg tcm_int1_bb_b0 = {
  320. 1, 32, 0x1180190, 0x118019c, 0x1180198, 0x1180194};
  321. static struct attn_hw_reg tcm_int2_bb_b0 = {
  322. 2, 1, 0x11801a0, 0x11801ac, 0x11801a8, 0x11801a4};
  323. static struct attn_hw_reg *tcm_int_bb_b0_regs[3] = {
  324. &tcm_int0_bb_b0, &tcm_int1_bb_b0, &tcm_int2_bb_b0};
  325. static struct attn_hw_reg tcm_prty1_bb_b0 = {
  326. 0, 31, 0x1180200, 0x118020c, 0x1180208, 0x1180204};
  327. static struct attn_hw_reg tcm_prty2_bb_b0 = {
  328. 1, 2, 0x1180210, 0x118021c, 0x1180218, 0x1180214};
  329. static struct attn_hw_reg *tcm_prty_bb_b0_regs[2] = {
  330. &tcm_prty1_bb_b0, &tcm_prty2_bb_b0};
  331. static struct attn_hw_reg mcm_int0_bb_b0 = {
  332. 0, 14, 0x1200180, 0x120018c, 0x1200188, 0x1200184};
  333. static struct attn_hw_reg mcm_int1_bb_b0 = {
  334. 1, 26, 0x1200190, 0x120019c, 0x1200198, 0x1200194};
  335. static struct attn_hw_reg mcm_int2_bb_b0 = {
  336. 2, 1, 0x12001a0, 0x12001ac, 0x12001a8, 0x12001a4};
  337. static struct attn_hw_reg *mcm_int_bb_b0_regs[3] = {
  338. &mcm_int0_bb_b0, &mcm_int1_bb_b0, &mcm_int2_bb_b0};
  339. static struct attn_hw_reg mcm_prty1_bb_b0 = {
  340. 0, 31, 0x1200200, 0x120020c, 0x1200208, 0x1200204};
  341. static struct attn_hw_reg mcm_prty2_bb_b0 = {
  342. 1, 4, 0x1200210, 0x120021c, 0x1200218, 0x1200214};
  343. static struct attn_hw_reg *mcm_prty_bb_b0_regs[2] = {
  344. &mcm_prty1_bb_b0, &mcm_prty2_bb_b0};
  345. static struct attn_hw_reg ucm_int0_bb_b0 = {
  346. 0, 17, 0x1280180, 0x128018c, 0x1280188, 0x1280184};
  347. static struct attn_hw_reg ucm_int1_bb_b0 = {
  348. 1, 29, 0x1280190, 0x128019c, 0x1280198, 0x1280194};
  349. static struct attn_hw_reg ucm_int2_bb_b0 = {
  350. 2, 1, 0x12801a0, 0x12801ac, 0x12801a8, 0x12801a4};
  351. static struct attn_hw_reg *ucm_int_bb_b0_regs[3] = {
  352. &ucm_int0_bb_b0, &ucm_int1_bb_b0, &ucm_int2_bb_b0};
  353. static struct attn_hw_reg ucm_prty1_bb_b0 = {
  354. 0, 31, 0x1280200, 0x128020c, 0x1280208, 0x1280204};
  355. static struct attn_hw_reg ucm_prty2_bb_b0 = {
  356. 1, 7, 0x1280210, 0x128021c, 0x1280218, 0x1280214};
  357. static struct attn_hw_reg *ucm_prty_bb_b0_regs[2] = {
  358. &ucm_prty1_bb_b0, &ucm_prty2_bb_b0};
  359. static struct attn_hw_reg xcm_int0_bb_b0 = {
  360. 0, 16, 0x1000180, 0x100018c, 0x1000188, 0x1000184};
  361. static struct attn_hw_reg xcm_int1_bb_b0 = {
  362. 1, 25, 0x1000190, 0x100019c, 0x1000198, 0x1000194};
  363. static struct attn_hw_reg xcm_int2_bb_b0 = {
  364. 2, 8, 0x10001a0, 0x10001ac, 0x10001a8, 0x10001a4};
  365. static struct attn_hw_reg *xcm_int_bb_b0_regs[3] = {
  366. &xcm_int0_bb_b0, &xcm_int1_bb_b0, &xcm_int2_bb_b0};
  367. static struct attn_hw_reg xcm_prty1_bb_b0 = {
  368. 0, 31, 0x1000200, 0x100020c, 0x1000208, 0x1000204};
  369. static struct attn_hw_reg xcm_prty2_bb_b0 = {
  370. 1, 11, 0x1000210, 0x100021c, 0x1000218, 0x1000214};
  371. static struct attn_hw_reg *xcm_prty_bb_b0_regs[2] = {
  372. &xcm_prty1_bb_b0, &xcm_prty2_bb_b0};
  373. static struct attn_hw_reg ycm_int0_bb_b0 = {
  374. 0, 13, 0x1080180, 0x108018c, 0x1080188, 0x1080184};
  375. static struct attn_hw_reg ycm_int1_bb_b0 = {
  376. 1, 23, 0x1080190, 0x108019c, 0x1080198, 0x1080194};
  377. static struct attn_hw_reg ycm_int2_bb_b0 = {
  378. 2, 1, 0x10801a0, 0x10801ac, 0x10801a8, 0x10801a4};
  379. static struct attn_hw_reg *ycm_int_bb_b0_regs[3] = {
  380. &ycm_int0_bb_b0, &ycm_int1_bb_b0, &ycm_int2_bb_b0};
  381. static struct attn_hw_reg ycm_prty1_bb_b0 = {
  382. 0, 31, 0x1080200, 0x108020c, 0x1080208, 0x1080204};
  383. static struct attn_hw_reg ycm_prty2_bb_b0 = {
  384. 1, 3, 0x1080210, 0x108021c, 0x1080218, 0x1080214};
  385. static struct attn_hw_reg *ycm_prty_bb_b0_regs[2] = {
  386. &ycm_prty1_bb_b0, &ycm_prty2_bb_b0};
  387. static struct attn_hw_reg pcm_int0_bb_b0 = {
  388. 0, 5, 0x1100180, 0x110018c, 0x1100188, 0x1100184};
  389. static struct attn_hw_reg pcm_int1_bb_b0 = {
  390. 1, 14, 0x1100190, 0x110019c, 0x1100198, 0x1100194};
  391. static struct attn_hw_reg pcm_int2_bb_b0 = {
  392. 2, 1, 0x11001a0, 0x11001ac, 0x11001a8, 0x11001a4};
  393. static struct attn_hw_reg *pcm_int_bb_b0_regs[3] = {
  394. &pcm_int0_bb_b0, &pcm_int1_bb_b0, &pcm_int2_bb_b0};
  395. static struct attn_hw_reg pcm_prty1_bb_b0 = {
  396. 0, 11, 0x1100200, 0x110020c, 0x1100208, 0x1100204};
  397. static struct attn_hw_reg *pcm_prty_bb_b0_regs[1] = {
  398. &pcm_prty1_bb_b0};
  399. static struct attn_hw_reg qm_int0_bb_b0 = {
  400. 0, 22, 0x2f0180, 0x2f018c, 0x2f0188, 0x2f0184};
  401. static struct attn_hw_reg *qm_int_bb_b0_regs[1] = {
  402. &qm_int0_bb_b0};
  403. static struct attn_hw_reg qm_prty0_bb_b0 = {
  404. 0, 11, 0x2f0190, 0x2f019c, 0x2f0198, 0x2f0194};
  405. static struct attn_hw_reg qm_prty1_bb_b0 = {
  406. 1, 31, 0x2f0200, 0x2f020c, 0x2f0208, 0x2f0204};
  407. static struct attn_hw_reg qm_prty2_bb_b0 = {
  408. 2, 31, 0x2f0210, 0x2f021c, 0x2f0218, 0x2f0214};
  409. static struct attn_hw_reg qm_prty3_bb_b0 = {
  410. 3, 11, 0x2f0220, 0x2f022c, 0x2f0228, 0x2f0224};
  411. static struct attn_hw_reg *qm_prty_bb_b0_regs[4] = {
  412. &qm_prty0_bb_b0, &qm_prty1_bb_b0, &qm_prty2_bb_b0, &qm_prty3_bb_b0};
  413. static struct attn_hw_reg tm_int0_bb_b0 = {
  414. 0, 32, 0x2c0180, 0x2c018c, 0x2c0188, 0x2c0184};
  415. static struct attn_hw_reg tm_int1_bb_b0 = {
  416. 1, 11, 0x2c0190, 0x2c019c, 0x2c0198, 0x2c0194};
  417. static struct attn_hw_reg *tm_int_bb_b0_regs[2] = {
  418. &tm_int0_bb_b0, &tm_int1_bb_b0};
  419. static struct attn_hw_reg tm_prty1_bb_b0 = {
  420. 0, 17, 0x2c0200, 0x2c020c, 0x2c0208, 0x2c0204};
  421. static struct attn_hw_reg *tm_prty_bb_b0_regs[1] = {
  422. &tm_prty1_bb_b0};
  423. static struct attn_hw_reg dorq_int0_bb_b0 = {
  424. 0, 9, 0x100180, 0x10018c, 0x100188, 0x100184};
  425. static struct attn_hw_reg *dorq_int_bb_b0_regs[1] = {
  426. &dorq_int0_bb_b0};
  427. static struct attn_hw_reg dorq_prty0_bb_b0 = {
  428. 0, 1, 0x100190, 0x10019c, 0x100198, 0x100194};
  429. static struct attn_hw_reg dorq_prty1_bb_b0 = {
  430. 1, 6, 0x100200, 0x10020c, 0x100208, 0x100204};
  431. static struct attn_hw_reg *dorq_prty_bb_b0_regs[2] = {
  432. &dorq_prty0_bb_b0, &dorq_prty1_bb_b0};
  433. static struct attn_hw_reg brb_int0_bb_b0 = {
  434. 0, 32, 0x3400c0, 0x3400cc, 0x3400c8, 0x3400c4};
  435. static struct attn_hw_reg brb_int1_bb_b0 = {
  436. 1, 30, 0x3400d8, 0x3400e4, 0x3400e0, 0x3400dc};
  437. static struct attn_hw_reg brb_int2_bb_b0 = {
  438. 2, 28, 0x3400f0, 0x3400fc, 0x3400f8, 0x3400f4};
  439. static struct attn_hw_reg brb_int3_bb_b0 = {
  440. 3, 31, 0x340108, 0x340114, 0x340110, 0x34010c};
  441. static struct attn_hw_reg brb_int4_bb_b0 = {
  442. 4, 27, 0x340120, 0x34012c, 0x340128, 0x340124};
  443. static struct attn_hw_reg brb_int5_bb_b0 = {
  444. 5, 1, 0x340138, 0x340144, 0x340140, 0x34013c};
  445. static struct attn_hw_reg brb_int6_bb_b0 = {
  446. 6, 8, 0x340150, 0x34015c, 0x340158, 0x340154};
  447. static struct attn_hw_reg brb_int7_bb_b0 = {
  448. 7, 32, 0x340168, 0x340174, 0x340170, 0x34016c};
  449. static struct attn_hw_reg brb_int8_bb_b0 = {
  450. 8, 17, 0x340184, 0x340190, 0x34018c, 0x340188};
  451. static struct attn_hw_reg brb_int9_bb_b0 = {
  452. 9, 1, 0x34019c, 0x3401a8, 0x3401a4, 0x3401a0};
  453. static struct attn_hw_reg brb_int10_bb_b0 = {
  454. 10, 14, 0x3401b4, 0x3401c0, 0x3401bc, 0x3401b8};
  455. static struct attn_hw_reg brb_int11_bb_b0 = {
  456. 11, 8, 0x3401cc, 0x3401d8, 0x3401d4, 0x3401d0};
  457. static struct attn_hw_reg *brb_int_bb_b0_regs[12] = {
  458. &brb_int0_bb_b0, &brb_int1_bb_b0, &brb_int2_bb_b0, &brb_int3_bb_b0,
  459. &brb_int4_bb_b0, &brb_int5_bb_b0, &brb_int6_bb_b0, &brb_int7_bb_b0,
  460. &brb_int8_bb_b0, &brb_int9_bb_b0, &brb_int10_bb_b0, &brb_int11_bb_b0};
  461. static struct attn_hw_reg brb_prty0_bb_b0 = {
  462. 0, 5, 0x3401dc, 0x3401e8, 0x3401e4, 0x3401e0};
  463. static struct attn_hw_reg brb_prty1_bb_b0 = {
  464. 1, 31, 0x340400, 0x34040c, 0x340408, 0x340404};
  465. static struct attn_hw_reg brb_prty2_bb_b0 = {
  466. 2, 14, 0x340410, 0x34041c, 0x340418, 0x340414};
  467. static struct attn_hw_reg *brb_prty_bb_b0_regs[3] = {
  468. &brb_prty0_bb_b0, &brb_prty1_bb_b0, &brb_prty2_bb_b0};
  469. static struct attn_hw_reg src_int0_bb_b0 = {
  470. 0, 1, 0x2381d8, 0x2381dc, 0x2381e0, 0x2381e4};
  471. static struct attn_hw_reg *src_int_bb_b0_regs[1] = {
  472. &src_int0_bb_b0};
  473. static struct attn_hw_reg prs_int0_bb_b0 = {
  474. 0, 2, 0x1f0040, 0x1f004c, 0x1f0048, 0x1f0044};
  475. static struct attn_hw_reg *prs_int_bb_b0_regs[1] = {
  476. &prs_int0_bb_b0};
  477. static struct attn_hw_reg prs_prty0_bb_b0 = {
  478. 0, 2, 0x1f0050, 0x1f005c, 0x1f0058, 0x1f0054};
  479. static struct attn_hw_reg prs_prty1_bb_b0 = {
  480. 1, 31, 0x1f0204, 0x1f0210, 0x1f020c, 0x1f0208};
  481. static struct attn_hw_reg prs_prty2_bb_b0 = {
  482. 2, 5, 0x1f0214, 0x1f0220, 0x1f021c, 0x1f0218};
  483. static struct attn_hw_reg *prs_prty_bb_b0_regs[3] = {
  484. &prs_prty0_bb_b0, &prs_prty1_bb_b0, &prs_prty2_bb_b0};
  485. static struct attn_hw_reg tsdm_int0_bb_b0 = {
  486. 0, 26, 0xfb0040, 0xfb004c, 0xfb0048, 0xfb0044};
  487. static struct attn_hw_reg *tsdm_int_bb_b0_regs[1] = {
  488. &tsdm_int0_bb_b0};
  489. static struct attn_hw_reg tsdm_prty1_bb_b0 = {
  490. 0, 10, 0xfb0200, 0xfb020c, 0xfb0208, 0xfb0204};
  491. static struct attn_hw_reg *tsdm_prty_bb_b0_regs[1] = {
  492. &tsdm_prty1_bb_b0};
  493. static struct attn_hw_reg msdm_int0_bb_b0 = {
  494. 0, 26, 0xfc0040, 0xfc004c, 0xfc0048, 0xfc0044};
  495. static struct attn_hw_reg *msdm_int_bb_b0_regs[1] = {
  496. &msdm_int0_bb_b0};
  497. static struct attn_hw_reg msdm_prty1_bb_b0 = {
  498. 0, 11, 0xfc0200, 0xfc020c, 0xfc0208, 0xfc0204};
  499. static struct attn_hw_reg *msdm_prty_bb_b0_regs[1] = {
  500. &msdm_prty1_bb_b0};
  501. static struct attn_hw_reg usdm_int0_bb_b0 = {
  502. 0, 26, 0xfd0040, 0xfd004c, 0xfd0048, 0xfd0044};
  503. static struct attn_hw_reg *usdm_int_bb_b0_regs[1] = {
  504. &usdm_int0_bb_b0};
  505. static struct attn_hw_reg usdm_prty1_bb_b0 = {
  506. 0, 10, 0xfd0200, 0xfd020c, 0xfd0208, 0xfd0204};
  507. static struct attn_hw_reg *usdm_prty_bb_b0_regs[1] = {
  508. &usdm_prty1_bb_b0};
  509. static struct attn_hw_reg xsdm_int0_bb_b0 = {
  510. 0, 26, 0xf80040, 0xf8004c, 0xf80048, 0xf80044};
  511. static struct attn_hw_reg *xsdm_int_bb_b0_regs[1] = {
  512. &xsdm_int0_bb_b0};
  513. static struct attn_hw_reg xsdm_prty1_bb_b0 = {
  514. 0, 10, 0xf80200, 0xf8020c, 0xf80208, 0xf80204};
  515. static struct attn_hw_reg *xsdm_prty_bb_b0_regs[1] = {
  516. &xsdm_prty1_bb_b0};
  517. static struct attn_hw_reg ysdm_int0_bb_b0 = {
  518. 0, 26, 0xf90040, 0xf9004c, 0xf90048, 0xf90044};
  519. static struct attn_hw_reg *ysdm_int_bb_b0_regs[1] = {
  520. &ysdm_int0_bb_b0};
  521. static struct attn_hw_reg ysdm_prty1_bb_b0 = {
  522. 0, 9, 0xf90200, 0xf9020c, 0xf90208, 0xf90204};
  523. static struct attn_hw_reg *ysdm_prty_bb_b0_regs[1] = {
  524. &ysdm_prty1_bb_b0};
  525. static struct attn_hw_reg psdm_int0_bb_b0 = {
  526. 0, 26, 0xfa0040, 0xfa004c, 0xfa0048, 0xfa0044};
  527. static struct attn_hw_reg *psdm_int_bb_b0_regs[1] = {
  528. &psdm_int0_bb_b0};
  529. static struct attn_hw_reg psdm_prty1_bb_b0 = {
  530. 0, 9, 0xfa0200, 0xfa020c, 0xfa0208, 0xfa0204};
  531. static struct attn_hw_reg *psdm_prty_bb_b0_regs[1] = {
  532. &psdm_prty1_bb_b0};
  533. static struct attn_hw_reg tsem_int0_bb_b0 = {
  534. 0, 32, 0x1700040, 0x170004c, 0x1700048, 0x1700044};
  535. static struct attn_hw_reg tsem_int1_bb_b0 = {
  536. 1, 13, 0x1700050, 0x170005c, 0x1700058, 0x1700054};
  537. static struct attn_hw_reg tsem_fast_memory_int0_bb_b0 = {
  538. 2, 1, 0x1740040, 0x174004c, 0x1740048, 0x1740044};
  539. static struct attn_hw_reg *tsem_int_bb_b0_regs[3] = {
  540. &tsem_int0_bb_b0, &tsem_int1_bb_b0, &tsem_fast_memory_int0_bb_b0};
  541. static struct attn_hw_reg tsem_prty0_bb_b0 = {
  542. 0, 3, 0x17000c8, 0x17000d4, 0x17000d0, 0x17000cc};
  543. static struct attn_hw_reg tsem_prty1_bb_b0 = {
  544. 1, 6, 0x1700200, 0x170020c, 0x1700208, 0x1700204};
  545. static struct attn_hw_reg tsem_fast_memory_vfc_config_prty1_bb_b0 = {
  546. 2, 6, 0x174a200, 0x174a20c, 0x174a208, 0x174a204};
  547. static struct attn_hw_reg *tsem_prty_bb_b0_regs[3] = {
  548. &tsem_prty0_bb_b0, &tsem_prty1_bb_b0,
  549. &tsem_fast_memory_vfc_config_prty1_bb_b0};
  550. static struct attn_hw_reg msem_int0_bb_b0 = {
  551. 0, 32, 0x1800040, 0x180004c, 0x1800048, 0x1800044};
  552. static struct attn_hw_reg msem_int1_bb_b0 = {
  553. 1, 13, 0x1800050, 0x180005c, 0x1800058, 0x1800054};
  554. static struct attn_hw_reg msem_fast_memory_int0_bb_b0 = {
  555. 2, 1, 0x1840040, 0x184004c, 0x1840048, 0x1840044};
  556. static struct attn_hw_reg *msem_int_bb_b0_regs[3] = {
  557. &msem_int0_bb_b0, &msem_int1_bb_b0, &msem_fast_memory_int0_bb_b0};
  558. static struct attn_hw_reg msem_prty0_bb_b0 = {
  559. 0, 3, 0x18000c8, 0x18000d4, 0x18000d0, 0x18000cc};
  560. static struct attn_hw_reg msem_prty1_bb_b0 = {
  561. 1, 6, 0x1800200, 0x180020c, 0x1800208, 0x1800204};
  562. static struct attn_hw_reg *msem_prty_bb_b0_regs[2] = {
  563. &msem_prty0_bb_b0, &msem_prty1_bb_b0};
  564. static struct attn_hw_reg usem_int0_bb_b0 = {
  565. 0, 32, 0x1900040, 0x190004c, 0x1900048, 0x1900044};
  566. static struct attn_hw_reg usem_int1_bb_b0 = {
  567. 1, 13, 0x1900050, 0x190005c, 0x1900058, 0x1900054};
  568. static struct attn_hw_reg usem_fast_memory_int0_bb_b0 = {
  569. 2, 1, 0x1940040, 0x194004c, 0x1940048, 0x1940044};
  570. static struct attn_hw_reg *usem_int_bb_b0_regs[3] = {
  571. &usem_int0_bb_b0, &usem_int1_bb_b0, &usem_fast_memory_int0_bb_b0};
  572. static struct attn_hw_reg usem_prty0_bb_b0 = {
  573. 0, 3, 0x19000c8, 0x19000d4, 0x19000d0, 0x19000cc};
  574. static struct attn_hw_reg usem_prty1_bb_b0 = {
  575. 1, 6, 0x1900200, 0x190020c, 0x1900208, 0x1900204};
  576. static struct attn_hw_reg *usem_prty_bb_b0_regs[2] = {
  577. &usem_prty0_bb_b0, &usem_prty1_bb_b0};
  578. static struct attn_hw_reg xsem_int0_bb_b0 = {
  579. 0, 32, 0x1400040, 0x140004c, 0x1400048, 0x1400044};
  580. static struct attn_hw_reg xsem_int1_bb_b0 = {
  581. 1, 13, 0x1400050, 0x140005c, 0x1400058, 0x1400054};
  582. static struct attn_hw_reg xsem_fast_memory_int0_bb_b0 = {
  583. 2, 1, 0x1440040, 0x144004c, 0x1440048, 0x1440044};
  584. static struct attn_hw_reg *xsem_int_bb_b0_regs[3] = {
  585. &xsem_int0_bb_b0, &xsem_int1_bb_b0, &xsem_fast_memory_int0_bb_b0};
  586. static struct attn_hw_reg xsem_prty0_bb_b0 = {
  587. 0, 3, 0x14000c8, 0x14000d4, 0x14000d0, 0x14000cc};
  588. static struct attn_hw_reg xsem_prty1_bb_b0 = {
  589. 1, 7, 0x1400200, 0x140020c, 0x1400208, 0x1400204};
  590. static struct attn_hw_reg *xsem_prty_bb_b0_regs[2] = {
  591. &xsem_prty0_bb_b0, &xsem_prty1_bb_b0};
  592. static struct attn_hw_reg ysem_int0_bb_b0 = {
  593. 0, 32, 0x1500040, 0x150004c, 0x1500048, 0x1500044};
  594. static struct attn_hw_reg ysem_int1_bb_b0 = {
  595. 1, 13, 0x1500050, 0x150005c, 0x1500058, 0x1500054};
  596. static struct attn_hw_reg ysem_fast_memory_int0_bb_b0 = {
  597. 2, 1, 0x1540040, 0x154004c, 0x1540048, 0x1540044};
  598. static struct attn_hw_reg *ysem_int_bb_b0_regs[3] = {
  599. &ysem_int0_bb_b0, &ysem_int1_bb_b0, &ysem_fast_memory_int0_bb_b0};
  600. static struct attn_hw_reg ysem_prty0_bb_b0 = {
  601. 0, 3, 0x15000c8, 0x15000d4, 0x15000d0, 0x15000cc};
  602. static struct attn_hw_reg ysem_prty1_bb_b0 = {
  603. 1, 7, 0x1500200, 0x150020c, 0x1500208, 0x1500204};
  604. static struct attn_hw_reg *ysem_prty_bb_b0_regs[2] = {
  605. &ysem_prty0_bb_b0, &ysem_prty1_bb_b0};
  606. static struct attn_hw_reg psem_int0_bb_b0 = {
  607. 0, 32, 0x1600040, 0x160004c, 0x1600048, 0x1600044};
  608. static struct attn_hw_reg psem_int1_bb_b0 = {
  609. 1, 13, 0x1600050, 0x160005c, 0x1600058, 0x1600054};
  610. static struct attn_hw_reg psem_fast_memory_int0_bb_b0 = {
  611. 2, 1, 0x1640040, 0x164004c, 0x1640048, 0x1640044};
  612. static struct attn_hw_reg *psem_int_bb_b0_regs[3] = {
  613. &psem_int0_bb_b0, &psem_int1_bb_b0, &psem_fast_memory_int0_bb_b0};
  614. static struct attn_hw_reg psem_prty0_bb_b0 = {
  615. 0, 3, 0x16000c8, 0x16000d4, 0x16000d0, 0x16000cc};
  616. static struct attn_hw_reg psem_prty1_bb_b0 = {
  617. 1, 6, 0x1600200, 0x160020c, 0x1600208, 0x1600204};
  618. static struct attn_hw_reg psem_fast_memory_vfc_config_prty1_bb_b0 = {
  619. 2, 6, 0x164a200, 0x164a20c, 0x164a208, 0x164a204};
  620. static struct attn_hw_reg *psem_prty_bb_b0_regs[3] = {
  621. &psem_prty0_bb_b0, &psem_prty1_bb_b0,
  622. &psem_fast_memory_vfc_config_prty1_bb_b0};
  623. static struct attn_hw_reg rss_int0_bb_b0 = {
  624. 0, 12, 0x238980, 0x23898c, 0x238988, 0x238984};
  625. static struct attn_hw_reg *rss_int_bb_b0_regs[1] = {
  626. &rss_int0_bb_b0};
  627. static struct attn_hw_reg rss_prty1_bb_b0 = {
  628. 0, 4, 0x238a00, 0x238a0c, 0x238a08, 0x238a04};
  629. static struct attn_hw_reg *rss_prty_bb_b0_regs[1] = {
  630. &rss_prty1_bb_b0};
  631. static struct attn_hw_reg tmld_int0_bb_b0 = {
  632. 0, 6, 0x4d0180, 0x4d018c, 0x4d0188, 0x4d0184};
  633. static struct attn_hw_reg *tmld_int_bb_b0_regs[1] = {
  634. &tmld_int0_bb_b0};
  635. static struct attn_hw_reg tmld_prty1_bb_b0 = {
  636. 0, 8, 0x4d0200, 0x4d020c, 0x4d0208, 0x4d0204};
  637. static struct attn_hw_reg *tmld_prty_bb_b0_regs[1] = {
  638. &tmld_prty1_bb_b0};
  639. static struct attn_hw_reg muld_int0_bb_b0 = {
  640. 0, 6, 0x4e0180, 0x4e018c, 0x4e0188, 0x4e0184};
  641. static struct attn_hw_reg *muld_int_bb_b0_regs[1] = {
  642. &muld_int0_bb_b0};
  643. static struct attn_hw_reg muld_prty1_bb_b0 = {
  644. 0, 10, 0x4e0200, 0x4e020c, 0x4e0208, 0x4e0204};
  645. static struct attn_hw_reg *muld_prty_bb_b0_regs[1] = {
  646. &muld_prty1_bb_b0};
  647. static struct attn_hw_reg yuld_int0_bb_b0 = {
  648. 0, 6, 0x4c8180, 0x4c818c, 0x4c8188, 0x4c8184};
  649. static struct attn_hw_reg *yuld_int_bb_b0_regs[1] = {
  650. &yuld_int0_bb_b0};
  651. static struct attn_hw_reg yuld_prty1_bb_b0 = {
  652. 0, 6, 0x4c8200, 0x4c820c, 0x4c8208, 0x4c8204};
  653. static struct attn_hw_reg *yuld_prty_bb_b0_regs[1] = {
  654. &yuld_prty1_bb_b0};
  655. static struct attn_hw_reg xyld_int0_bb_b0 = {
  656. 0, 6, 0x4c0180, 0x4c018c, 0x4c0188, 0x4c0184};
  657. static struct attn_hw_reg *xyld_int_bb_b0_regs[1] = {
  658. &xyld_int0_bb_b0};
  659. static struct attn_hw_reg xyld_prty1_bb_b0 = {
  660. 0, 9, 0x4c0200, 0x4c020c, 0x4c0208, 0x4c0204};
  661. static struct attn_hw_reg *xyld_prty_bb_b0_regs[1] = {
  662. &xyld_prty1_bb_b0};
  663. static struct attn_hw_reg prm_int0_bb_b0 = {
  664. 0, 11, 0x230040, 0x23004c, 0x230048, 0x230044};
  665. static struct attn_hw_reg *prm_int_bb_b0_regs[1] = {
  666. &prm_int0_bb_b0};
  667. static struct attn_hw_reg prm_prty0_bb_b0 = {
  668. 0, 1, 0x230050, 0x23005c, 0x230058, 0x230054};
  669. static struct attn_hw_reg prm_prty1_bb_b0 = {
  670. 1, 24, 0x230200, 0x23020c, 0x230208, 0x230204};
  671. static struct attn_hw_reg *prm_prty_bb_b0_regs[2] = {
  672. &prm_prty0_bb_b0, &prm_prty1_bb_b0};
  673. static struct attn_hw_reg pbf_pb1_int0_bb_b0 = {
  674. 0, 9, 0xda0040, 0xda004c, 0xda0048, 0xda0044};
  675. static struct attn_hw_reg *pbf_pb1_int_bb_b0_regs[1] = {
  676. &pbf_pb1_int0_bb_b0};
  677. static struct attn_hw_reg pbf_pb1_prty0_bb_b0 = {
  678. 0, 1, 0xda0050, 0xda005c, 0xda0058, 0xda0054};
  679. static struct attn_hw_reg *pbf_pb1_prty_bb_b0_regs[1] = {
  680. &pbf_pb1_prty0_bb_b0};
  681. static struct attn_hw_reg pbf_pb2_int0_bb_b0 = {
  682. 0, 9, 0xda4040, 0xda404c, 0xda4048, 0xda4044};
  683. static struct attn_hw_reg *pbf_pb2_int_bb_b0_regs[1] = {
  684. &pbf_pb2_int0_bb_b0};
  685. static struct attn_hw_reg pbf_pb2_prty0_bb_b0 = {
  686. 0, 1, 0xda4050, 0xda405c, 0xda4058, 0xda4054};
  687. static struct attn_hw_reg *pbf_pb2_prty_bb_b0_regs[1] = {
  688. &pbf_pb2_prty0_bb_b0};
  689. static struct attn_hw_reg rpb_int0_bb_b0 = {
  690. 0, 9, 0x23c040, 0x23c04c, 0x23c048, 0x23c044};
  691. static struct attn_hw_reg *rpb_int_bb_b0_regs[1] = {
  692. &rpb_int0_bb_b0};
  693. static struct attn_hw_reg rpb_prty0_bb_b0 = {
  694. 0, 1, 0x23c050, 0x23c05c, 0x23c058, 0x23c054};
  695. static struct attn_hw_reg *rpb_prty_bb_b0_regs[1] = {
  696. &rpb_prty0_bb_b0};
  697. static struct attn_hw_reg btb_int0_bb_b0 = {
  698. 0, 16, 0xdb00c0, 0xdb00cc, 0xdb00c8, 0xdb00c4};
  699. static struct attn_hw_reg btb_int1_bb_b0 = {
  700. 1, 16, 0xdb00d8, 0xdb00e4, 0xdb00e0, 0xdb00dc};
  701. static struct attn_hw_reg btb_int2_bb_b0 = {
  702. 2, 4, 0xdb00f0, 0xdb00fc, 0xdb00f8, 0xdb00f4};
  703. static struct attn_hw_reg btb_int3_bb_b0 = {
  704. 3, 32, 0xdb0108, 0xdb0114, 0xdb0110, 0xdb010c};
  705. static struct attn_hw_reg btb_int4_bb_b0 = {
  706. 4, 23, 0xdb0120, 0xdb012c, 0xdb0128, 0xdb0124};
  707. static struct attn_hw_reg btb_int5_bb_b0 = {
  708. 5, 32, 0xdb0138, 0xdb0144, 0xdb0140, 0xdb013c};
  709. static struct attn_hw_reg btb_int6_bb_b0 = {
  710. 6, 1, 0xdb0150, 0xdb015c, 0xdb0158, 0xdb0154};
  711. static struct attn_hw_reg btb_int8_bb_b0 = {
  712. 7, 1, 0xdb0184, 0xdb0190, 0xdb018c, 0xdb0188};
  713. static struct attn_hw_reg btb_int9_bb_b0 = {
  714. 8, 1, 0xdb019c, 0xdb01a8, 0xdb01a4, 0xdb01a0};
  715. static struct attn_hw_reg btb_int10_bb_b0 = {
  716. 9, 1, 0xdb01b4, 0xdb01c0, 0xdb01bc, 0xdb01b8};
  717. static struct attn_hw_reg btb_int11_bb_b0 = {
  718. 10, 2, 0xdb01cc, 0xdb01d8, 0xdb01d4, 0xdb01d0};
  719. static struct attn_hw_reg *btb_int_bb_b0_regs[11] = {
  720. &btb_int0_bb_b0, &btb_int1_bb_b0, &btb_int2_bb_b0, &btb_int3_bb_b0,
  721. &btb_int4_bb_b0, &btb_int5_bb_b0, &btb_int6_bb_b0, &btb_int8_bb_b0,
  722. &btb_int9_bb_b0, &btb_int10_bb_b0, &btb_int11_bb_b0};
  723. static struct attn_hw_reg btb_prty0_bb_b0 = {
  724. 0, 5, 0xdb01dc, 0xdb01e8, 0xdb01e4, 0xdb01e0};
  725. static struct attn_hw_reg btb_prty1_bb_b0 = {
  726. 1, 23, 0xdb0400, 0xdb040c, 0xdb0408, 0xdb0404};
  727. static struct attn_hw_reg *btb_prty_bb_b0_regs[2] = {
  728. &btb_prty0_bb_b0, &btb_prty1_bb_b0};
  729. static struct attn_hw_reg pbf_int0_bb_b0 = {
  730. 0, 1, 0xd80180, 0xd8018c, 0xd80188, 0xd80184};
  731. static struct attn_hw_reg *pbf_int_bb_b0_regs[1] = {
  732. &pbf_int0_bb_b0};
  733. static struct attn_hw_reg pbf_prty0_bb_b0 = {
  734. 0, 1, 0xd80190, 0xd8019c, 0xd80198, 0xd80194};
  735. static struct attn_hw_reg pbf_prty1_bb_b0 = {
  736. 1, 31, 0xd80200, 0xd8020c, 0xd80208, 0xd80204};
  737. static struct attn_hw_reg pbf_prty2_bb_b0 = {
  738. 2, 27, 0xd80210, 0xd8021c, 0xd80218, 0xd80214};
  739. static struct attn_hw_reg *pbf_prty_bb_b0_regs[3] = {
  740. &pbf_prty0_bb_b0, &pbf_prty1_bb_b0, &pbf_prty2_bb_b0};
  741. static struct attn_hw_reg rdif_int0_bb_b0 = {
  742. 0, 8, 0x300180, 0x30018c, 0x300188, 0x300184};
  743. static struct attn_hw_reg *rdif_int_bb_b0_regs[1] = {
  744. &rdif_int0_bb_b0};
  745. static struct attn_hw_reg rdif_prty0_bb_b0 = {
  746. 0, 1, 0x300190, 0x30019c, 0x300198, 0x300194};
  747. static struct attn_hw_reg *rdif_prty_bb_b0_regs[1] = {
  748. &rdif_prty0_bb_b0};
  749. static struct attn_hw_reg tdif_int0_bb_b0 = {
  750. 0, 8, 0x310180, 0x31018c, 0x310188, 0x310184};
  751. static struct attn_hw_reg *tdif_int_bb_b0_regs[1] = {
  752. &tdif_int0_bb_b0};
  753. static struct attn_hw_reg tdif_prty0_bb_b0 = {
  754. 0, 1, 0x310190, 0x31019c, 0x310198, 0x310194};
  755. static struct attn_hw_reg tdif_prty1_bb_b0 = {
  756. 1, 11, 0x310200, 0x31020c, 0x310208, 0x310204};
  757. static struct attn_hw_reg *tdif_prty_bb_b0_regs[2] = {
  758. &tdif_prty0_bb_b0, &tdif_prty1_bb_b0};
  759. static struct attn_hw_reg cdu_int0_bb_b0 = {
  760. 0, 8, 0x5801c0, 0x5801c4, 0x5801c8, 0x5801cc};
  761. static struct attn_hw_reg *cdu_int_bb_b0_regs[1] = {
  762. &cdu_int0_bb_b0};
  763. static struct attn_hw_reg cdu_prty1_bb_b0 = {
  764. 0, 5, 0x580200, 0x58020c, 0x580208, 0x580204};
  765. static struct attn_hw_reg *cdu_prty_bb_b0_regs[1] = {
  766. &cdu_prty1_bb_b0};
  767. static struct attn_hw_reg ccfc_int0_bb_b0 = {
  768. 0, 2, 0x2e0180, 0x2e018c, 0x2e0188, 0x2e0184};
  769. static struct attn_hw_reg *ccfc_int_bb_b0_regs[1] = {
  770. &ccfc_int0_bb_b0};
  771. static struct attn_hw_reg ccfc_prty1_bb_b0 = {
  772. 0, 2, 0x2e0200, 0x2e020c, 0x2e0208, 0x2e0204};
  773. static struct attn_hw_reg ccfc_prty0_bb_b0 = {
  774. 1, 6, 0x2e05e4, 0x2e05f0, 0x2e05ec, 0x2e05e8};
  775. static struct attn_hw_reg *ccfc_prty_bb_b0_regs[2] = {
  776. &ccfc_prty1_bb_b0, &ccfc_prty0_bb_b0};
  777. static struct attn_hw_reg tcfc_int0_bb_b0 = {
  778. 0, 2, 0x2d0180, 0x2d018c, 0x2d0188, 0x2d0184};
  779. static struct attn_hw_reg *tcfc_int_bb_b0_regs[1] = {
  780. &tcfc_int0_bb_b0};
  781. static struct attn_hw_reg tcfc_prty1_bb_b0 = {
  782. 0, 2, 0x2d0200, 0x2d020c, 0x2d0208, 0x2d0204};
  783. static struct attn_hw_reg tcfc_prty0_bb_b0 = {
  784. 1, 6, 0x2d05e4, 0x2d05f0, 0x2d05ec, 0x2d05e8};
  785. static struct attn_hw_reg *tcfc_prty_bb_b0_regs[2] = {
  786. &tcfc_prty1_bb_b0, &tcfc_prty0_bb_b0};
  787. static struct attn_hw_reg igu_int0_bb_b0 = {
  788. 0, 11, 0x180180, 0x18018c, 0x180188, 0x180184};
  789. static struct attn_hw_reg *igu_int_bb_b0_regs[1] = {
  790. &igu_int0_bb_b0};
  791. static struct attn_hw_reg igu_prty0_bb_b0 = {
  792. 0, 1, 0x180190, 0x18019c, 0x180198, 0x180194};
  793. static struct attn_hw_reg igu_prty1_bb_b0 = {
  794. 1, 31, 0x180200, 0x18020c, 0x180208, 0x180204};
  795. static struct attn_hw_reg igu_prty2_bb_b0 = {
  796. 2, 1, 0x180210, 0x18021c, 0x180218, 0x180214};
  797. static struct attn_hw_reg *igu_prty_bb_b0_regs[3] = {
  798. &igu_prty0_bb_b0, &igu_prty1_bb_b0, &igu_prty2_bb_b0};
  799. static struct attn_hw_reg cau_int0_bb_b0 = {
  800. 0, 11, 0x1c00d4, 0x1c00d8, 0x1c00dc, 0x1c00e0};
  801. static struct attn_hw_reg *cau_int_bb_b0_regs[1] = {
  802. &cau_int0_bb_b0};
  803. static struct attn_hw_reg cau_prty1_bb_b0 = {
  804. 0, 13, 0x1c0200, 0x1c020c, 0x1c0208, 0x1c0204};
  805. static struct attn_hw_reg *cau_prty_bb_b0_regs[1] = {
  806. &cau_prty1_bb_b0};
  807. static struct attn_hw_reg dbg_int0_bb_b0 = {
  808. 0, 1, 0x10180, 0x1018c, 0x10188, 0x10184};
  809. static struct attn_hw_reg *dbg_int_bb_b0_regs[1] = {
  810. &dbg_int0_bb_b0};
  811. static struct attn_hw_reg dbg_prty1_bb_b0 = {
  812. 0, 1, 0x10200, 0x1020c, 0x10208, 0x10204};
  813. static struct attn_hw_reg *dbg_prty_bb_b0_regs[1] = {
  814. &dbg_prty1_bb_b0};
  815. static struct attn_hw_reg nig_int0_bb_b0 = {
  816. 0, 12, 0x500040, 0x50004c, 0x500048, 0x500044};
  817. static struct attn_hw_reg nig_int1_bb_b0 = {
  818. 1, 32, 0x500050, 0x50005c, 0x500058, 0x500054};
  819. static struct attn_hw_reg nig_int2_bb_b0 = {
  820. 2, 20, 0x500060, 0x50006c, 0x500068, 0x500064};
  821. static struct attn_hw_reg nig_int3_bb_b0 = {
  822. 3, 18, 0x500070, 0x50007c, 0x500078, 0x500074};
  823. static struct attn_hw_reg nig_int4_bb_b0 = {
  824. 4, 20, 0x500080, 0x50008c, 0x500088, 0x500084};
  825. static struct attn_hw_reg nig_int5_bb_b0 = {
  826. 5, 18, 0x500090, 0x50009c, 0x500098, 0x500094};
  827. static struct attn_hw_reg *nig_int_bb_b0_regs[6] = {
  828. &nig_int0_bb_b0, &nig_int1_bb_b0, &nig_int2_bb_b0, &nig_int3_bb_b0,
  829. &nig_int4_bb_b0, &nig_int5_bb_b0};
  830. static struct attn_hw_reg nig_prty0_bb_b0 = {
  831. 0, 1, 0x5000a0, 0x5000ac, 0x5000a8, 0x5000a4};
  832. static struct attn_hw_reg nig_prty1_bb_b0 = {
  833. 1, 31, 0x500200, 0x50020c, 0x500208, 0x500204};
  834. static struct attn_hw_reg nig_prty2_bb_b0 = {
  835. 2, 31, 0x500210, 0x50021c, 0x500218, 0x500214};
  836. static struct attn_hw_reg nig_prty3_bb_b0 = {
  837. 3, 31, 0x500220, 0x50022c, 0x500228, 0x500224};
  838. static struct attn_hw_reg nig_prty4_bb_b0 = {
  839. 4, 17, 0x500230, 0x50023c, 0x500238, 0x500234};
  840. static struct attn_hw_reg *nig_prty_bb_b0_regs[5] = {
  841. &nig_prty0_bb_b0, &nig_prty1_bb_b0, &nig_prty2_bb_b0,
  842. &nig_prty3_bb_b0, &nig_prty4_bb_b0};
  843. static struct attn_hw_reg ipc_int0_bb_b0 = {
  844. 0, 13, 0x2050c, 0x20518, 0x20514, 0x20510};
  845. static struct attn_hw_reg *ipc_int_bb_b0_regs[1] = {
  846. &ipc_int0_bb_b0};
  847. static struct attn_hw_reg ipc_prty0_bb_b0 = {
  848. 0, 1, 0x2051c, 0x20528, 0x20524, 0x20520};
  849. static struct attn_hw_reg *ipc_prty_bb_b0_regs[1] = {
  850. &ipc_prty0_bb_b0};
  851. static struct attn_hw_block attn_blocks[] = {
  852. {"grc", {{1, 1, grc_int_bb_b0_regs, grc_prty_bb_b0_regs} } },
  853. {"miscs", {{2, 1, miscs_int_bb_b0_regs, miscs_prty_bb_b0_regs} } },
  854. {"misc", {{1, 0, misc_int_bb_b0_regs, NULL} } },
  855. {"dbu", {{0, 0, NULL, NULL} } },
  856. {"pglue_b", {{1, 2, pglue_b_int_bb_b0_regs,
  857. pglue_b_prty_bb_b0_regs} } },
  858. {"cnig", {{1, 1, cnig_int_bb_b0_regs, cnig_prty_bb_b0_regs} } },
  859. {"cpmu", {{1, 0, cpmu_int_bb_b0_regs, NULL} } },
  860. {"ncsi", {{1, 1, ncsi_int_bb_b0_regs, ncsi_prty_bb_b0_regs} } },
  861. {"opte", {{0, 2, NULL, opte_prty_bb_b0_regs} } },
  862. {"bmb", {{12, 3, bmb_int_bb_b0_regs, bmb_prty_bb_b0_regs} } },
  863. {"pcie", {{0, 1, NULL, pcie_prty_bb_b0_regs} } },
  864. {"mcp", {{0, 0, NULL, NULL} } },
  865. {"mcp2", {{0, 2, NULL, mcp2_prty_bb_b0_regs} } },
  866. {"pswhst", {{1, 2, pswhst_int_bb_b0_regs, pswhst_prty_bb_b0_regs} } },
  867. {"pswhst2", {{1, 1, pswhst2_int_bb_b0_regs,
  868. pswhst2_prty_bb_b0_regs} } },
  869. {"pswrd", {{1, 1, pswrd_int_bb_b0_regs, pswrd_prty_bb_b0_regs} } },
  870. {"pswrd2", {{1, 3, pswrd2_int_bb_b0_regs, pswrd2_prty_bb_b0_regs} } },
  871. {"pswwr", {{1, 1, pswwr_int_bb_b0_regs, pswwr_prty_bb_b0_regs} } },
  872. {"pswwr2", {{1, 5, pswwr2_int_bb_b0_regs, pswwr2_prty_bb_b0_regs} } },
  873. {"pswrq", {{1, 1, pswrq_int_bb_b0_regs, pswrq_prty_bb_b0_regs} } },
  874. {"pswrq2", {{1, 1, pswrq2_int_bb_b0_regs, pswrq2_prty_bb_b0_regs} } },
  875. {"pglcs", {{1, 0, pglcs_int_bb_b0_regs, NULL} } },
  876. {"dmae", {{1, 1, dmae_int_bb_b0_regs, dmae_prty_bb_b0_regs} } },
  877. {"ptu", {{1, 1, ptu_int_bb_b0_regs, ptu_prty_bb_b0_regs} } },
  878. {"tcm", {{3, 2, tcm_int_bb_b0_regs, tcm_prty_bb_b0_regs} } },
  879. {"mcm", {{3, 2, mcm_int_bb_b0_regs, mcm_prty_bb_b0_regs} } },
  880. {"ucm", {{3, 2, ucm_int_bb_b0_regs, ucm_prty_bb_b0_regs} } },
  881. {"xcm", {{3, 2, xcm_int_bb_b0_regs, xcm_prty_bb_b0_regs} } },
  882. {"ycm", {{3, 2, ycm_int_bb_b0_regs, ycm_prty_bb_b0_regs} } },
  883. {"pcm", {{3, 1, pcm_int_bb_b0_regs, pcm_prty_bb_b0_regs} } },
  884. {"qm", {{1, 4, qm_int_bb_b0_regs, qm_prty_bb_b0_regs} } },
  885. {"tm", {{2, 1, tm_int_bb_b0_regs, tm_prty_bb_b0_regs} } },
  886. {"dorq", {{1, 2, dorq_int_bb_b0_regs, dorq_prty_bb_b0_regs} } },
  887. {"brb", {{12, 3, brb_int_bb_b0_regs, brb_prty_bb_b0_regs} } },
  888. {"src", {{1, 0, src_int_bb_b0_regs, NULL} } },
  889. {"prs", {{1, 3, prs_int_bb_b0_regs, prs_prty_bb_b0_regs} } },
  890. {"tsdm", {{1, 1, tsdm_int_bb_b0_regs, tsdm_prty_bb_b0_regs} } },
  891. {"msdm", {{1, 1, msdm_int_bb_b0_regs, msdm_prty_bb_b0_regs} } },
  892. {"usdm", {{1, 1, usdm_int_bb_b0_regs, usdm_prty_bb_b0_regs} } },
  893. {"xsdm", {{1, 1, xsdm_int_bb_b0_regs, xsdm_prty_bb_b0_regs} } },
  894. {"ysdm", {{1, 1, ysdm_int_bb_b0_regs, ysdm_prty_bb_b0_regs} } },
  895. {"psdm", {{1, 1, psdm_int_bb_b0_regs, psdm_prty_bb_b0_regs} } },
  896. {"tsem", {{3, 3, tsem_int_bb_b0_regs, tsem_prty_bb_b0_regs} } },
  897. {"msem", {{3, 2, msem_int_bb_b0_regs, msem_prty_bb_b0_regs} } },
  898. {"usem", {{3, 2, usem_int_bb_b0_regs, usem_prty_bb_b0_regs} } },
  899. {"xsem", {{3, 2, xsem_int_bb_b0_regs, xsem_prty_bb_b0_regs} } },
  900. {"ysem", {{3, 2, ysem_int_bb_b0_regs, ysem_prty_bb_b0_regs} } },
  901. {"psem", {{3, 3, psem_int_bb_b0_regs, psem_prty_bb_b0_regs} } },
  902. {"rss", {{1, 1, rss_int_bb_b0_regs, rss_prty_bb_b0_regs} } },
  903. {"tmld", {{1, 1, tmld_int_bb_b0_regs, tmld_prty_bb_b0_regs} } },
  904. {"muld", {{1, 1, muld_int_bb_b0_regs, muld_prty_bb_b0_regs} } },
  905. {"yuld", {{1, 1, yuld_int_bb_b0_regs, yuld_prty_bb_b0_regs} } },
  906. {"xyld", {{1, 1, xyld_int_bb_b0_regs, xyld_prty_bb_b0_regs} } },
  907. {"prm", {{1, 2, prm_int_bb_b0_regs, prm_prty_bb_b0_regs} } },
  908. {"pbf_pb1", {{1, 1, pbf_pb1_int_bb_b0_regs,
  909. pbf_pb1_prty_bb_b0_regs} } },
  910. {"pbf_pb2", {{1, 1, pbf_pb2_int_bb_b0_regs,
  911. pbf_pb2_prty_bb_b0_regs} } },
  912. {"rpb", { {1, 1, rpb_int_bb_b0_regs, rpb_prty_bb_b0_regs} } },
  913. {"btb", { {11, 2, btb_int_bb_b0_regs, btb_prty_bb_b0_regs} } },
  914. {"pbf", { {1, 3, pbf_int_bb_b0_regs, pbf_prty_bb_b0_regs} } },
  915. {"rdif", { {1, 1, rdif_int_bb_b0_regs, rdif_prty_bb_b0_regs} } },
  916. {"tdif", { {1, 2, tdif_int_bb_b0_regs, tdif_prty_bb_b0_regs} } },
  917. {"cdu", { {1, 1, cdu_int_bb_b0_regs, cdu_prty_bb_b0_regs} } },
  918. {"ccfc", { {1, 2, ccfc_int_bb_b0_regs, ccfc_prty_bb_b0_regs} } },
  919. {"tcfc", { {1, 2, tcfc_int_bb_b0_regs, tcfc_prty_bb_b0_regs} } },
  920. {"igu", { {1, 3, igu_int_bb_b0_regs, igu_prty_bb_b0_regs} } },
  921. {"cau", { {1, 1, cau_int_bb_b0_regs, cau_prty_bb_b0_regs} } },
  922. {"umac", { {0, 0, NULL, NULL} } },
  923. {"xmac", { {0, 0, NULL, NULL} } },
  924. {"dbg", { {1, 1, dbg_int_bb_b0_regs, dbg_prty_bb_b0_regs} } },
  925. {"nig", { {6, 5, nig_int_bb_b0_regs, nig_prty_bb_b0_regs} } },
  926. {"wol", { {0, 0, NULL, NULL} } },
  927. {"bmbn", { {0, 0, NULL, NULL} } },
  928. {"ipc", { {1, 1, ipc_int_bb_b0_regs, ipc_prty_bb_b0_regs} } },
  929. {"nwm", { {0, 0, NULL, NULL} } },
  930. {"nws", { {0, 0, NULL, NULL} } },
  931. {"ms", { {0, 0, NULL, NULL} } },
  932. {"phy_pcie", { {0, 0, NULL, NULL} } },
  933. {"misc_aeu", { {0, 0, NULL, NULL} } },
  934. {"bar0_map", { {0, 0, NULL, NULL} } },};
  935. /* Specific HW attention callbacks */
  936. static int qed_mcp_attn_cb(struct qed_hwfn *p_hwfn)
  937. {
  938. u32 tmp = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt, MCP_REG_CPU_STATE);
  939. /* This might occur on certain instances; Log it once then mask it */
  940. DP_INFO(p_hwfn->cdev, "MCP_REG_CPU_STATE: %08x - Masking...\n",
  941. tmp);
  942. qed_wr(p_hwfn, p_hwfn->p_dpc_ptt, MCP_REG_CPU_EVENT_MASK,
  943. 0xffffffff);
  944. return 0;
  945. }
  946. #define QED_PSWHST_ATTENTION_INCORRECT_ACCESS (0x1)
  947. #define ATTENTION_INCORRECT_ACCESS_WR_MASK (0x1)
  948. #define ATTENTION_INCORRECT_ACCESS_WR_SHIFT (0)
  949. #define ATTENTION_INCORRECT_ACCESS_CLIENT_MASK (0xf)
  950. #define ATTENTION_INCORRECT_ACCESS_CLIENT_SHIFT (1)
  951. #define ATTENTION_INCORRECT_ACCESS_VF_VALID_MASK (0x1)
  952. #define ATTENTION_INCORRECT_ACCESS_VF_VALID_SHIFT (5)
  953. #define ATTENTION_INCORRECT_ACCESS_VF_ID_MASK (0xff)
  954. #define ATTENTION_INCORRECT_ACCESS_VF_ID_SHIFT (6)
  955. #define ATTENTION_INCORRECT_ACCESS_PF_ID_MASK (0xf)
  956. #define ATTENTION_INCORRECT_ACCESS_PF_ID_SHIFT (14)
  957. #define ATTENTION_INCORRECT_ACCESS_BYTE_EN_MASK (0xff)
  958. #define ATTENTION_INCORRECT_ACCESS_BYTE_EN_SHIFT (18)
  959. static int qed_pswhst_attn_cb(struct qed_hwfn *p_hwfn)
  960. {
  961. u32 tmp = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  962. PSWHST_REG_INCORRECT_ACCESS_VALID);
  963. if (tmp & QED_PSWHST_ATTENTION_INCORRECT_ACCESS) {
  964. u32 addr, data, length;
  965. addr = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  966. PSWHST_REG_INCORRECT_ACCESS_ADDRESS);
  967. data = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  968. PSWHST_REG_INCORRECT_ACCESS_DATA);
  969. length = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  970. PSWHST_REG_INCORRECT_ACCESS_LENGTH);
  971. DP_INFO(p_hwfn->cdev,
  972. "Incorrect access to %08x of length %08x - PF [%02x] VF [%04x] [valid %02x] client [%02x] write [%02x] Byte-Enable [%04x] [%08x]\n",
  973. addr, length,
  974. (u8) GET_FIELD(data, ATTENTION_INCORRECT_ACCESS_PF_ID),
  975. (u8) GET_FIELD(data, ATTENTION_INCORRECT_ACCESS_VF_ID),
  976. (u8) GET_FIELD(data,
  977. ATTENTION_INCORRECT_ACCESS_VF_VALID),
  978. (u8) GET_FIELD(data,
  979. ATTENTION_INCORRECT_ACCESS_CLIENT),
  980. (u8) GET_FIELD(data, ATTENTION_INCORRECT_ACCESS_WR),
  981. (u8) GET_FIELD(data,
  982. ATTENTION_INCORRECT_ACCESS_BYTE_EN),
  983. data);
  984. }
  985. return 0;
  986. }
  987. #define QED_GRC_ATTENTION_VALID_BIT (1 << 0)
  988. #define QED_GRC_ATTENTION_ADDRESS_MASK (0x7fffff)
  989. #define QED_GRC_ATTENTION_ADDRESS_SHIFT (0)
  990. #define QED_GRC_ATTENTION_RDWR_BIT (1 << 23)
  991. #define QED_GRC_ATTENTION_MASTER_MASK (0xf)
  992. #define QED_GRC_ATTENTION_MASTER_SHIFT (24)
  993. #define QED_GRC_ATTENTION_PF_MASK (0xf)
  994. #define QED_GRC_ATTENTION_PF_SHIFT (0)
  995. #define QED_GRC_ATTENTION_VF_MASK (0xff)
  996. #define QED_GRC_ATTENTION_VF_SHIFT (4)
  997. #define QED_GRC_ATTENTION_PRIV_MASK (0x3)
  998. #define QED_GRC_ATTENTION_PRIV_SHIFT (14)
  999. #define QED_GRC_ATTENTION_PRIV_VF (0)
  1000. static const char *attn_master_to_str(u8 master)
  1001. {
  1002. switch (master) {
  1003. case 1: return "PXP";
  1004. case 2: return "MCP";
  1005. case 3: return "MSDM";
  1006. case 4: return "PSDM";
  1007. case 5: return "YSDM";
  1008. case 6: return "USDM";
  1009. case 7: return "TSDM";
  1010. case 8: return "XSDM";
  1011. case 9: return "DBU";
  1012. case 10: return "DMAE";
  1013. default:
  1014. return "Unknown";
  1015. }
  1016. }
  1017. static int qed_grc_attn_cb(struct qed_hwfn *p_hwfn)
  1018. {
  1019. u32 tmp, tmp2;
  1020. /* We've already cleared the timeout interrupt register, so we learn
  1021. * of interrupts via the validity register
  1022. */
  1023. tmp = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1024. GRC_REG_TIMEOUT_ATTN_ACCESS_VALID);
  1025. if (!(tmp & QED_GRC_ATTENTION_VALID_BIT))
  1026. goto out;
  1027. /* Read the GRC timeout information */
  1028. tmp = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1029. GRC_REG_TIMEOUT_ATTN_ACCESS_DATA_0);
  1030. tmp2 = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1031. GRC_REG_TIMEOUT_ATTN_ACCESS_DATA_1);
  1032. DP_INFO(p_hwfn->cdev,
  1033. "GRC timeout [%08x:%08x] - %s Address [%08x] [Master %s] [PF: %02x %s %02x]\n",
  1034. tmp2, tmp,
  1035. (tmp & QED_GRC_ATTENTION_RDWR_BIT) ? "Write to" : "Read from",
  1036. GET_FIELD(tmp, QED_GRC_ATTENTION_ADDRESS) << 2,
  1037. attn_master_to_str(GET_FIELD(tmp, QED_GRC_ATTENTION_MASTER)),
  1038. GET_FIELD(tmp2, QED_GRC_ATTENTION_PF),
  1039. (GET_FIELD(tmp2, QED_GRC_ATTENTION_PRIV) ==
  1040. QED_GRC_ATTENTION_PRIV_VF) ? "VF" : "(Ireelevant)",
  1041. GET_FIELD(tmp2, QED_GRC_ATTENTION_VF));
  1042. out:
  1043. /* Regardles of anything else, clean the validity bit */
  1044. qed_wr(p_hwfn, p_hwfn->p_dpc_ptt,
  1045. GRC_REG_TIMEOUT_ATTN_ACCESS_VALID, 0);
  1046. return 0;
  1047. }
  1048. #define PGLUE_ATTENTION_VALID (1 << 29)
  1049. #define PGLUE_ATTENTION_RD_VALID (1 << 26)
  1050. #define PGLUE_ATTENTION_DETAILS_PFID_MASK (0xf)
  1051. #define PGLUE_ATTENTION_DETAILS_PFID_SHIFT (20)
  1052. #define PGLUE_ATTENTION_DETAILS_VF_VALID_MASK (0x1)
  1053. #define PGLUE_ATTENTION_DETAILS_VF_VALID_SHIFT (19)
  1054. #define PGLUE_ATTENTION_DETAILS_VFID_MASK (0xff)
  1055. #define PGLUE_ATTENTION_DETAILS_VFID_SHIFT (24)
  1056. #define PGLUE_ATTENTION_DETAILS2_WAS_ERR_MASK (0x1)
  1057. #define PGLUE_ATTENTION_DETAILS2_WAS_ERR_SHIFT (21)
  1058. #define PGLUE_ATTENTION_DETAILS2_BME_MASK (0x1)
  1059. #define PGLUE_ATTENTION_DETAILS2_BME_SHIFT (22)
  1060. #define PGLUE_ATTENTION_DETAILS2_FID_EN_MASK (0x1)
  1061. #define PGLUE_ATTENTION_DETAILS2_FID_EN_SHIFT (23)
  1062. #define PGLUE_ATTENTION_ICPL_VALID (1 << 23)
  1063. #define PGLUE_ATTENTION_ZLR_VALID (1 << 25)
  1064. #define PGLUE_ATTENTION_ILT_VALID (1 << 23)
  1065. static int qed_pglub_rbc_attn_cb(struct qed_hwfn *p_hwfn)
  1066. {
  1067. u32 tmp;
  1068. tmp = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1069. PGLUE_B_REG_TX_ERR_WR_DETAILS2);
  1070. if (tmp & PGLUE_ATTENTION_VALID) {
  1071. u32 addr_lo, addr_hi, details;
  1072. addr_lo = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1073. PGLUE_B_REG_TX_ERR_WR_ADD_31_0);
  1074. addr_hi = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1075. PGLUE_B_REG_TX_ERR_WR_ADD_63_32);
  1076. details = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1077. PGLUE_B_REG_TX_ERR_WR_DETAILS);
  1078. DP_INFO(p_hwfn,
  1079. "Illegal write by chip to [%08x:%08x] blocked.\n"
  1080. "Details: %08x [PFID %02x, VFID %02x, VF_VALID %02x]\n"
  1081. "Details2 %08x [Was_error %02x BME deassert %02x FID_enable deassert %02x]\n",
  1082. addr_hi, addr_lo, details,
  1083. (u8)GET_FIELD(details, PGLUE_ATTENTION_DETAILS_PFID),
  1084. (u8)GET_FIELD(details, PGLUE_ATTENTION_DETAILS_VFID),
  1085. GET_FIELD(details,
  1086. PGLUE_ATTENTION_DETAILS_VF_VALID) ? 1 : 0,
  1087. tmp,
  1088. GET_FIELD(tmp,
  1089. PGLUE_ATTENTION_DETAILS2_WAS_ERR) ? 1 : 0,
  1090. GET_FIELD(tmp,
  1091. PGLUE_ATTENTION_DETAILS2_BME) ? 1 : 0,
  1092. GET_FIELD(tmp,
  1093. PGLUE_ATTENTION_DETAILS2_FID_EN) ? 1 : 0);
  1094. }
  1095. tmp = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1096. PGLUE_B_REG_TX_ERR_RD_DETAILS2);
  1097. if (tmp & PGLUE_ATTENTION_RD_VALID) {
  1098. u32 addr_lo, addr_hi, details;
  1099. addr_lo = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1100. PGLUE_B_REG_TX_ERR_RD_ADD_31_0);
  1101. addr_hi = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1102. PGLUE_B_REG_TX_ERR_RD_ADD_63_32);
  1103. details = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1104. PGLUE_B_REG_TX_ERR_RD_DETAILS);
  1105. DP_INFO(p_hwfn,
  1106. "Illegal read by chip from [%08x:%08x] blocked.\n"
  1107. " Details: %08x [PFID %02x, VFID %02x, VF_VALID %02x]\n"
  1108. " Details2 %08x [Was_error %02x BME deassert %02x FID_enable deassert %02x]\n",
  1109. addr_hi, addr_lo, details,
  1110. (u8)GET_FIELD(details, PGLUE_ATTENTION_DETAILS_PFID),
  1111. (u8)GET_FIELD(details, PGLUE_ATTENTION_DETAILS_VFID),
  1112. GET_FIELD(details,
  1113. PGLUE_ATTENTION_DETAILS_VF_VALID) ? 1 : 0,
  1114. tmp,
  1115. GET_FIELD(tmp, PGLUE_ATTENTION_DETAILS2_WAS_ERR) ? 1
  1116. : 0,
  1117. GET_FIELD(tmp, PGLUE_ATTENTION_DETAILS2_BME) ? 1 : 0,
  1118. GET_FIELD(tmp, PGLUE_ATTENTION_DETAILS2_FID_EN) ? 1
  1119. : 0);
  1120. }
  1121. tmp = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1122. PGLUE_B_REG_TX_ERR_WR_DETAILS_ICPL);
  1123. if (tmp & PGLUE_ATTENTION_ICPL_VALID)
  1124. DP_INFO(p_hwfn, "ICPL eror - %08x\n", tmp);
  1125. tmp = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1126. PGLUE_B_REG_MASTER_ZLR_ERR_DETAILS);
  1127. if (tmp & PGLUE_ATTENTION_ZLR_VALID) {
  1128. u32 addr_hi, addr_lo;
  1129. addr_lo = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1130. PGLUE_B_REG_MASTER_ZLR_ERR_ADD_31_0);
  1131. addr_hi = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1132. PGLUE_B_REG_MASTER_ZLR_ERR_ADD_63_32);
  1133. DP_INFO(p_hwfn, "ZLR eror - %08x [Address %08x:%08x]\n",
  1134. tmp, addr_hi, addr_lo);
  1135. }
  1136. tmp = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1137. PGLUE_B_REG_VF_ILT_ERR_DETAILS2);
  1138. if (tmp & PGLUE_ATTENTION_ILT_VALID) {
  1139. u32 addr_hi, addr_lo, details;
  1140. addr_lo = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1141. PGLUE_B_REG_VF_ILT_ERR_ADD_31_0);
  1142. addr_hi = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1143. PGLUE_B_REG_VF_ILT_ERR_ADD_63_32);
  1144. details = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1145. PGLUE_B_REG_VF_ILT_ERR_DETAILS);
  1146. DP_INFO(p_hwfn,
  1147. "ILT error - Details %08x Details2 %08x [Address %08x:%08x]\n",
  1148. details, tmp, addr_hi, addr_lo);
  1149. }
  1150. /* Clear the indications */
  1151. qed_wr(p_hwfn, p_hwfn->p_dpc_ptt,
  1152. PGLUE_B_REG_LATCHED_ERRORS_CLR, (1 << 2));
  1153. return 0;
  1154. }
  1155. #define QED_DORQ_ATTENTION_REASON_MASK (0xfffff)
  1156. #define QED_DORQ_ATTENTION_OPAQUE_MASK (0xffff)
  1157. #define QED_DORQ_ATTENTION_SIZE_MASK (0x7f)
  1158. #define QED_DORQ_ATTENTION_SIZE_SHIFT (16)
  1159. static int qed_dorq_attn_cb(struct qed_hwfn *p_hwfn)
  1160. {
  1161. u32 reason;
  1162. reason = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt, DORQ_REG_DB_DROP_REASON) &
  1163. QED_DORQ_ATTENTION_REASON_MASK;
  1164. if (reason) {
  1165. u32 details = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1166. DORQ_REG_DB_DROP_DETAILS);
  1167. DP_INFO(p_hwfn->cdev,
  1168. "DORQ db_drop: address 0x%08x Opaque FID 0x%04x Size [bytes] 0x%08x Reason: 0x%08x\n",
  1169. qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1170. DORQ_REG_DB_DROP_DETAILS_ADDRESS),
  1171. (u16)(details & QED_DORQ_ATTENTION_OPAQUE_MASK),
  1172. GET_FIELD(details, QED_DORQ_ATTENTION_SIZE) * 4,
  1173. reason);
  1174. }
  1175. return -EINVAL;
  1176. }
  1177. /* Notice aeu_invert_reg must be defined in the same order of bits as HW; */
  1178. static struct aeu_invert_reg aeu_descs[NUM_ATTN_REGS] = {
  1179. {
  1180. { /* After Invert 1 */
  1181. {"GPIO0 function%d",
  1182. (32 << ATTENTION_LENGTH_SHIFT), NULL, MAX_BLOCK_ID},
  1183. }
  1184. },
  1185. {
  1186. { /* After Invert 2 */
  1187. {"PGLUE config_space", ATTENTION_SINGLE,
  1188. NULL, MAX_BLOCK_ID},
  1189. {"PGLUE misc_flr", ATTENTION_SINGLE,
  1190. NULL, MAX_BLOCK_ID},
  1191. {"PGLUE B RBC", ATTENTION_PAR_INT,
  1192. qed_pglub_rbc_attn_cb, BLOCK_PGLUE_B},
  1193. {"PGLUE misc_mctp", ATTENTION_SINGLE,
  1194. NULL, MAX_BLOCK_ID},
  1195. {"Flash event", ATTENTION_SINGLE, NULL, MAX_BLOCK_ID},
  1196. {"SMB event", ATTENTION_SINGLE, NULL, MAX_BLOCK_ID},
  1197. {"Main Power", ATTENTION_SINGLE, NULL, MAX_BLOCK_ID},
  1198. {"SW timers #%d", (8 << ATTENTION_LENGTH_SHIFT) |
  1199. (1 << ATTENTION_OFFSET_SHIFT),
  1200. NULL, MAX_BLOCK_ID},
  1201. {"PCIE glue/PXP VPD %d",
  1202. (16 << ATTENTION_LENGTH_SHIFT), NULL, BLOCK_PGLCS},
  1203. }
  1204. },
  1205. {
  1206. { /* After Invert 3 */
  1207. {"General Attention %d",
  1208. (32 << ATTENTION_LENGTH_SHIFT), NULL, MAX_BLOCK_ID},
  1209. }
  1210. },
  1211. {
  1212. { /* After Invert 4 */
  1213. {"General Attention 32", ATTENTION_SINGLE,
  1214. NULL, MAX_BLOCK_ID},
  1215. {"General Attention %d",
  1216. (2 << ATTENTION_LENGTH_SHIFT) |
  1217. (33 << ATTENTION_OFFSET_SHIFT), NULL, MAX_BLOCK_ID},
  1218. {"General Attention 35", ATTENTION_SINGLE,
  1219. NULL, MAX_BLOCK_ID},
  1220. {"CNIG port %d", (4 << ATTENTION_LENGTH_SHIFT),
  1221. NULL, BLOCK_CNIG},
  1222. {"MCP CPU", ATTENTION_SINGLE,
  1223. qed_mcp_attn_cb, MAX_BLOCK_ID},
  1224. {"MCP Watchdog timer", ATTENTION_SINGLE,
  1225. NULL, MAX_BLOCK_ID},
  1226. {"MCP M2P", ATTENTION_SINGLE, NULL, MAX_BLOCK_ID},
  1227. {"AVS stop status ready", ATTENTION_SINGLE,
  1228. NULL, MAX_BLOCK_ID},
  1229. {"MSTAT", ATTENTION_PAR_INT, NULL, MAX_BLOCK_ID},
  1230. {"MSTAT per-path", ATTENTION_PAR_INT,
  1231. NULL, MAX_BLOCK_ID},
  1232. {"Reserved %d", (6 << ATTENTION_LENGTH_SHIFT),
  1233. NULL, MAX_BLOCK_ID},
  1234. {"NIG", ATTENTION_PAR_INT, NULL, BLOCK_NIG},
  1235. {"BMB/OPTE/MCP", ATTENTION_PAR_INT, NULL, BLOCK_BMB},
  1236. {"BTB", ATTENTION_PAR_INT, NULL, BLOCK_BTB},
  1237. {"BRB", ATTENTION_PAR_INT, NULL, BLOCK_BRB},
  1238. {"PRS", ATTENTION_PAR_INT, NULL, BLOCK_PRS},
  1239. }
  1240. },
  1241. {
  1242. { /* After Invert 5 */
  1243. {"SRC", ATTENTION_PAR_INT, NULL, BLOCK_SRC},
  1244. {"PB Client1", ATTENTION_PAR_INT, NULL, BLOCK_PBF_PB1},
  1245. {"PB Client2", ATTENTION_PAR_INT, NULL, BLOCK_PBF_PB2},
  1246. {"RPB", ATTENTION_PAR_INT, NULL, BLOCK_RPB},
  1247. {"PBF", ATTENTION_PAR_INT, NULL, BLOCK_PBF},
  1248. {"QM", ATTENTION_PAR_INT, NULL, BLOCK_QM},
  1249. {"TM", ATTENTION_PAR_INT, NULL, BLOCK_TM},
  1250. {"MCM", ATTENTION_PAR_INT, NULL, BLOCK_MCM},
  1251. {"MSDM", ATTENTION_PAR_INT, NULL, BLOCK_MSDM},
  1252. {"MSEM", ATTENTION_PAR_INT, NULL, BLOCK_MSEM},
  1253. {"PCM", ATTENTION_PAR_INT, NULL, BLOCK_PCM},
  1254. {"PSDM", ATTENTION_PAR_INT, NULL, BLOCK_PSDM},
  1255. {"PSEM", ATTENTION_PAR_INT, NULL, BLOCK_PSEM},
  1256. {"TCM", ATTENTION_PAR_INT, NULL, BLOCK_TCM},
  1257. {"TSDM", ATTENTION_PAR_INT, NULL, BLOCK_TSDM},
  1258. {"TSEM", ATTENTION_PAR_INT, NULL, BLOCK_TSEM},
  1259. }
  1260. },
  1261. {
  1262. { /* After Invert 6 */
  1263. {"UCM", ATTENTION_PAR_INT, NULL, BLOCK_UCM},
  1264. {"USDM", ATTENTION_PAR_INT, NULL, BLOCK_USDM},
  1265. {"USEM", ATTENTION_PAR_INT, NULL, BLOCK_USEM},
  1266. {"XCM", ATTENTION_PAR_INT, NULL, BLOCK_XCM},
  1267. {"XSDM", ATTENTION_PAR_INT, NULL, BLOCK_XSDM},
  1268. {"XSEM", ATTENTION_PAR_INT, NULL, BLOCK_XSEM},
  1269. {"YCM", ATTENTION_PAR_INT, NULL, BLOCK_YCM},
  1270. {"YSDM", ATTENTION_PAR_INT, NULL, BLOCK_YSDM},
  1271. {"YSEM", ATTENTION_PAR_INT, NULL, BLOCK_YSEM},
  1272. {"XYLD", ATTENTION_PAR_INT, NULL, BLOCK_XYLD},
  1273. {"TMLD", ATTENTION_PAR_INT, NULL, BLOCK_TMLD},
  1274. {"MYLD", ATTENTION_PAR_INT, NULL, BLOCK_MULD},
  1275. {"YULD", ATTENTION_PAR_INT, NULL, BLOCK_YULD},
  1276. {"DORQ", ATTENTION_PAR_INT,
  1277. qed_dorq_attn_cb, BLOCK_DORQ},
  1278. {"DBG", ATTENTION_PAR_INT, NULL, BLOCK_DBG},
  1279. {"IPC", ATTENTION_PAR_INT, NULL, BLOCK_IPC},
  1280. }
  1281. },
  1282. {
  1283. { /* After Invert 7 */
  1284. {"CCFC", ATTENTION_PAR_INT, NULL, BLOCK_CCFC},
  1285. {"CDU", ATTENTION_PAR_INT, NULL, BLOCK_CDU},
  1286. {"DMAE", ATTENTION_PAR_INT, NULL, BLOCK_DMAE},
  1287. {"IGU", ATTENTION_PAR_INT, NULL, BLOCK_IGU},
  1288. {"ATC", ATTENTION_PAR_INT, NULL, MAX_BLOCK_ID},
  1289. {"CAU", ATTENTION_PAR_INT, NULL, BLOCK_CAU},
  1290. {"PTU", ATTENTION_PAR_INT, NULL, BLOCK_PTU},
  1291. {"PRM", ATTENTION_PAR_INT, NULL, BLOCK_PRM},
  1292. {"TCFC", ATTENTION_PAR_INT, NULL, BLOCK_TCFC},
  1293. {"RDIF", ATTENTION_PAR_INT, NULL, BLOCK_RDIF},
  1294. {"TDIF", ATTENTION_PAR_INT, NULL, BLOCK_TDIF},
  1295. {"RSS", ATTENTION_PAR_INT, NULL, BLOCK_RSS},
  1296. {"MISC", ATTENTION_PAR_INT, NULL, BLOCK_MISC},
  1297. {"MISCS", ATTENTION_PAR_INT, NULL, BLOCK_MISCS},
  1298. {"PCIE", ATTENTION_PAR, NULL, BLOCK_PCIE},
  1299. {"Vaux PCI core", ATTENTION_SINGLE, NULL, BLOCK_PGLCS},
  1300. {"PSWRQ", ATTENTION_PAR_INT, NULL, BLOCK_PSWRQ},
  1301. }
  1302. },
  1303. {
  1304. { /* After Invert 8 */
  1305. {"PSWRQ (pci_clk)", ATTENTION_PAR_INT,
  1306. NULL, BLOCK_PSWRQ2},
  1307. {"PSWWR", ATTENTION_PAR_INT, NULL, BLOCK_PSWWR},
  1308. {"PSWWR (pci_clk)", ATTENTION_PAR_INT,
  1309. NULL, BLOCK_PSWWR2},
  1310. {"PSWRD", ATTENTION_PAR_INT, NULL, BLOCK_PSWRD},
  1311. {"PSWRD (pci_clk)", ATTENTION_PAR_INT,
  1312. NULL, BLOCK_PSWRD2},
  1313. {"PSWHST", ATTENTION_PAR_INT,
  1314. qed_pswhst_attn_cb, BLOCK_PSWHST},
  1315. {"PSWHST (pci_clk)", ATTENTION_PAR_INT,
  1316. NULL, BLOCK_PSWHST2},
  1317. {"GRC", ATTENTION_PAR_INT,
  1318. qed_grc_attn_cb, BLOCK_GRC},
  1319. {"CPMU", ATTENTION_PAR_INT, NULL, BLOCK_CPMU},
  1320. {"NCSI", ATTENTION_PAR_INT, NULL, BLOCK_NCSI},
  1321. {"MSEM PRAM", ATTENTION_PAR, NULL, MAX_BLOCK_ID},
  1322. {"PSEM PRAM", ATTENTION_PAR, NULL, MAX_BLOCK_ID},
  1323. {"TSEM PRAM", ATTENTION_PAR, NULL, MAX_BLOCK_ID},
  1324. {"USEM PRAM", ATTENTION_PAR, NULL, MAX_BLOCK_ID},
  1325. {"XSEM PRAM", ATTENTION_PAR, NULL, MAX_BLOCK_ID},
  1326. {"YSEM PRAM", ATTENTION_PAR, NULL, MAX_BLOCK_ID},
  1327. {"pxp_misc_mps", ATTENTION_PAR, NULL, BLOCK_PGLCS},
  1328. {"PCIE glue/PXP Exp. ROM", ATTENTION_SINGLE,
  1329. NULL, BLOCK_PGLCS},
  1330. {"PERST_B assertion", ATTENTION_SINGLE,
  1331. NULL, MAX_BLOCK_ID},
  1332. {"PERST_B deassertion", ATTENTION_SINGLE,
  1333. NULL, MAX_BLOCK_ID},
  1334. {"Reserved %d", (2 << ATTENTION_LENGTH_SHIFT),
  1335. NULL, MAX_BLOCK_ID},
  1336. }
  1337. },
  1338. {
  1339. { /* After Invert 9 */
  1340. {"MCP Latched memory", ATTENTION_PAR,
  1341. NULL, MAX_BLOCK_ID},
  1342. {"MCP Latched scratchpad cache", ATTENTION_SINGLE,
  1343. NULL, MAX_BLOCK_ID},
  1344. {"MCP Latched ump_tx", ATTENTION_PAR,
  1345. NULL, MAX_BLOCK_ID},
  1346. {"MCP Latched scratchpad", ATTENTION_PAR,
  1347. NULL, MAX_BLOCK_ID},
  1348. {"Reserved %d", (28 << ATTENTION_LENGTH_SHIFT),
  1349. NULL, MAX_BLOCK_ID},
  1350. }
  1351. },
  1352. };
  1353. #define ATTN_STATE_BITS (0xfff)
  1354. #define ATTN_BITS_MASKABLE (0x3ff)
  1355. struct qed_sb_attn_info {
  1356. /* Virtual & Physical address of the SB */
  1357. struct atten_status_block *sb_attn;
  1358. dma_addr_t sb_phys;
  1359. /* Last seen running index */
  1360. u16 index;
  1361. /* A mask of the AEU bits resulting in a parity error */
  1362. u32 parity_mask[NUM_ATTN_REGS];
  1363. /* A pointer to the attention description structure */
  1364. struct aeu_invert_reg *p_aeu_desc;
  1365. /* Previously asserted attentions, which are still unasserted */
  1366. u16 known_attn;
  1367. /* Cleanup address for the link's general hw attention */
  1368. u32 mfw_attn_addr;
  1369. };
  1370. static inline u16 qed_attn_update_idx(struct qed_hwfn *p_hwfn,
  1371. struct qed_sb_attn_info *p_sb_desc)
  1372. {
  1373. u16 rc = 0, index;
  1374. /* Make certain HW write took affect */
  1375. mmiowb();
  1376. index = le16_to_cpu(p_sb_desc->sb_attn->sb_index);
  1377. if (p_sb_desc->index != index) {
  1378. p_sb_desc->index = index;
  1379. rc = QED_SB_ATT_IDX;
  1380. }
  1381. /* Make certain we got a consistent view with HW */
  1382. mmiowb();
  1383. return rc;
  1384. }
  1385. /**
  1386. * @brief qed_int_assertion - handles asserted attention bits
  1387. *
  1388. * @param p_hwfn
  1389. * @param asserted_bits newly asserted bits
  1390. * @return int
  1391. */
  1392. static int qed_int_assertion(struct qed_hwfn *p_hwfn, u16 asserted_bits)
  1393. {
  1394. struct qed_sb_attn_info *sb_attn_sw = p_hwfn->p_sb_attn;
  1395. u32 igu_mask;
  1396. /* Mask the source of the attention in the IGU */
  1397. igu_mask = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt, IGU_REG_ATTENTION_ENABLE);
  1398. DP_VERBOSE(p_hwfn, NETIF_MSG_INTR, "IGU mask: 0x%08x --> 0x%08x\n",
  1399. igu_mask, igu_mask & ~(asserted_bits & ATTN_BITS_MASKABLE));
  1400. igu_mask &= ~(asserted_bits & ATTN_BITS_MASKABLE);
  1401. qed_wr(p_hwfn, p_hwfn->p_dpc_ptt, IGU_REG_ATTENTION_ENABLE, igu_mask);
  1402. DP_VERBOSE(p_hwfn, NETIF_MSG_INTR,
  1403. "inner known ATTN state: 0x%04x --> 0x%04x\n",
  1404. sb_attn_sw->known_attn,
  1405. sb_attn_sw->known_attn | asserted_bits);
  1406. sb_attn_sw->known_attn |= asserted_bits;
  1407. /* Handle MCP events */
  1408. if (asserted_bits & 0x100) {
  1409. qed_mcp_handle_events(p_hwfn, p_hwfn->p_dpc_ptt);
  1410. /* Clean the MCP attention */
  1411. qed_wr(p_hwfn, p_hwfn->p_dpc_ptt,
  1412. sb_attn_sw->mfw_attn_addr, 0);
  1413. }
  1414. DIRECT_REG_WR((u8 __iomem *)p_hwfn->regview +
  1415. GTT_BAR0_MAP_REG_IGU_CMD +
  1416. ((IGU_CMD_ATTN_BIT_SET_UPPER -
  1417. IGU_CMD_INT_ACK_BASE) << 3),
  1418. (u32)asserted_bits);
  1419. DP_VERBOSE(p_hwfn, NETIF_MSG_INTR, "set cmd IGU: 0x%04x\n",
  1420. asserted_bits);
  1421. return 0;
  1422. }
  1423. static void qed_int_deassertion_print_bit(struct qed_hwfn *p_hwfn,
  1424. struct attn_hw_reg *p_reg_desc,
  1425. struct attn_hw_block *p_block,
  1426. enum qed_attention_type type,
  1427. u32 val, u32 mask)
  1428. {
  1429. int j;
  1430. for (j = 0; j < p_reg_desc->num_of_bits; j++) {
  1431. if (!(val & (1 << j)))
  1432. continue;
  1433. DP_NOTICE(p_hwfn,
  1434. "%s (%s): reg %d [0x%08x], bit %d [%s]\n",
  1435. p_block->name,
  1436. type == QED_ATTN_TYPE_ATTN ? "Interrupt" :
  1437. "Parity",
  1438. p_reg_desc->reg_idx, p_reg_desc->sts_addr,
  1439. j, (mask & (1 << j)) ? " [MASKED]" : "");
  1440. }
  1441. }
  1442. /**
  1443. * @brief qed_int_deassertion_aeu_bit - handles the effects of a single
  1444. * cause of the attention
  1445. *
  1446. * @param p_hwfn
  1447. * @param p_aeu - descriptor of an AEU bit which caused the attention
  1448. * @param aeu_en_reg - register offset of the AEU enable reg. which configured
  1449. * this bit to this group.
  1450. * @param bit_index - index of this bit in the aeu_en_reg
  1451. *
  1452. * @return int
  1453. */
  1454. static int
  1455. qed_int_deassertion_aeu_bit(struct qed_hwfn *p_hwfn,
  1456. struct aeu_invert_reg_bit *p_aeu,
  1457. u32 aeu_en_reg,
  1458. u32 bitmask)
  1459. {
  1460. int rc = -EINVAL;
  1461. u32 val;
  1462. DP_INFO(p_hwfn, "Deasserted attention `%s'[%08x]\n",
  1463. p_aeu->bit_name, bitmask);
  1464. /* Call callback before clearing the interrupt status */
  1465. if (p_aeu->cb) {
  1466. DP_INFO(p_hwfn, "`%s (attention)': Calling Callback function\n",
  1467. p_aeu->bit_name);
  1468. rc = p_aeu->cb(p_hwfn);
  1469. }
  1470. /* Handle HW block interrupt registers */
  1471. if (p_aeu->block_index != MAX_BLOCK_ID) {
  1472. struct attn_hw_block *p_block;
  1473. u32 mask;
  1474. int i;
  1475. p_block = &attn_blocks[p_aeu->block_index];
  1476. /* Handle each interrupt register */
  1477. for (i = 0; i < p_block->chip_regs[0].num_of_int_regs; i++) {
  1478. struct attn_hw_reg *p_reg_desc;
  1479. u32 sts_addr;
  1480. p_reg_desc = p_block->chip_regs[0].int_regs[i];
  1481. /* In case of fatal attention, don't clear the status
  1482. * so it would appear in following idle check.
  1483. */
  1484. if (rc == 0)
  1485. sts_addr = p_reg_desc->sts_clr_addr;
  1486. else
  1487. sts_addr = p_reg_desc->sts_addr;
  1488. val = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt, sts_addr);
  1489. mask = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1490. p_reg_desc->mask_addr);
  1491. qed_int_deassertion_print_bit(p_hwfn, p_reg_desc,
  1492. p_block,
  1493. QED_ATTN_TYPE_ATTN,
  1494. val, mask);
  1495. }
  1496. }
  1497. /* If the attention is benign, no need to prevent it */
  1498. if (!rc)
  1499. goto out;
  1500. /* Prevent this Attention from being asserted in the future */
  1501. val = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt, aeu_en_reg);
  1502. qed_wr(p_hwfn, p_hwfn->p_dpc_ptt, aeu_en_reg, (val & ~bitmask));
  1503. DP_INFO(p_hwfn, "`%s' - Disabled future attentions\n",
  1504. p_aeu->bit_name);
  1505. out:
  1506. return rc;
  1507. }
  1508. static void qed_int_parity_print(struct qed_hwfn *p_hwfn,
  1509. struct aeu_invert_reg_bit *p_aeu,
  1510. struct attn_hw_block *p_block,
  1511. u8 bit_index)
  1512. {
  1513. int i;
  1514. for (i = 0; i < p_block->chip_regs[0].num_of_prty_regs; i++) {
  1515. struct attn_hw_reg *p_reg_desc;
  1516. u32 val, mask;
  1517. p_reg_desc = p_block->chip_regs[0].prty_regs[i];
  1518. val = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1519. p_reg_desc->sts_clr_addr);
  1520. mask = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1521. p_reg_desc->mask_addr);
  1522. qed_int_deassertion_print_bit(p_hwfn, p_reg_desc,
  1523. p_block,
  1524. QED_ATTN_TYPE_PARITY,
  1525. val, mask);
  1526. }
  1527. }
  1528. /**
  1529. * @brief qed_int_deassertion_parity - handle a single parity AEU source
  1530. *
  1531. * @param p_hwfn
  1532. * @param p_aeu - descriptor of an AEU bit which caused the parity
  1533. * @param bit_index
  1534. */
  1535. static void qed_int_deassertion_parity(struct qed_hwfn *p_hwfn,
  1536. struct aeu_invert_reg_bit *p_aeu,
  1537. u8 bit_index)
  1538. {
  1539. u32 block_id = p_aeu->block_index;
  1540. DP_INFO(p_hwfn->cdev, "%s[%d] parity attention is set\n",
  1541. p_aeu->bit_name, bit_index);
  1542. if (block_id != MAX_BLOCK_ID) {
  1543. qed_int_parity_print(p_hwfn, p_aeu, &attn_blocks[block_id],
  1544. bit_index);
  1545. /* In BB, there's a single parity bit for several blocks */
  1546. if (block_id == BLOCK_BTB) {
  1547. qed_int_parity_print(p_hwfn, p_aeu,
  1548. &attn_blocks[BLOCK_OPTE],
  1549. bit_index);
  1550. qed_int_parity_print(p_hwfn, p_aeu,
  1551. &attn_blocks[BLOCK_MCP],
  1552. bit_index);
  1553. }
  1554. }
  1555. }
  1556. /**
  1557. * @brief - handles deassertion of previously asserted attentions.
  1558. *
  1559. * @param p_hwfn
  1560. * @param deasserted_bits - newly deasserted bits
  1561. * @return int
  1562. *
  1563. */
  1564. static int qed_int_deassertion(struct qed_hwfn *p_hwfn,
  1565. u16 deasserted_bits)
  1566. {
  1567. struct qed_sb_attn_info *sb_attn_sw = p_hwfn->p_sb_attn;
  1568. u32 aeu_inv_arr[NUM_ATTN_REGS], aeu_mask;
  1569. u8 i, j, k, bit_idx;
  1570. int rc = 0;
  1571. /* Read the attention registers in the AEU */
  1572. for (i = 0; i < NUM_ATTN_REGS; i++) {
  1573. aeu_inv_arr[i] = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1574. MISC_REG_AEU_AFTER_INVERT_1_IGU +
  1575. i * 0x4);
  1576. DP_VERBOSE(p_hwfn, NETIF_MSG_INTR,
  1577. "Deasserted bits [%d]: %08x\n",
  1578. i, aeu_inv_arr[i]);
  1579. }
  1580. /* Find parity attentions first */
  1581. for (i = 0; i < NUM_ATTN_REGS; i++) {
  1582. struct aeu_invert_reg *p_aeu = &sb_attn_sw->p_aeu_desc[i];
  1583. u32 en = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt,
  1584. MISC_REG_AEU_ENABLE1_IGU_OUT_0 +
  1585. i * sizeof(u32));
  1586. u32 parities;
  1587. /* Skip register in which no parity bit is currently set */
  1588. parities = sb_attn_sw->parity_mask[i] & aeu_inv_arr[i] & en;
  1589. if (!parities)
  1590. continue;
  1591. for (j = 0, bit_idx = 0; bit_idx < 32; j++) {
  1592. struct aeu_invert_reg_bit *p_bit = &p_aeu->bits[j];
  1593. if ((p_bit->flags & ATTENTION_PARITY) &&
  1594. !!(parities & BIT(bit_idx)))
  1595. qed_int_deassertion_parity(p_hwfn, p_bit,
  1596. bit_idx);
  1597. bit_idx += ATTENTION_LENGTH(p_bit->flags);
  1598. }
  1599. }
  1600. /* Find non-parity cause for attention and act */
  1601. for (k = 0; k < MAX_ATTN_GRPS; k++) {
  1602. struct aeu_invert_reg_bit *p_aeu;
  1603. /* Handle only groups whose attention is currently deasserted */
  1604. if (!(deasserted_bits & (1 << k)))
  1605. continue;
  1606. for (i = 0; i < NUM_ATTN_REGS; i++) {
  1607. u32 aeu_en = MISC_REG_AEU_ENABLE1_IGU_OUT_0 +
  1608. i * sizeof(u32) +
  1609. k * sizeof(u32) * NUM_ATTN_REGS;
  1610. u32 en, bits;
  1611. en = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt, aeu_en);
  1612. bits = aeu_inv_arr[i] & en;
  1613. /* Skip if no bit from this group is currently set */
  1614. if (!bits)
  1615. continue;
  1616. /* Find all set bits from current register which belong
  1617. * to current group, making them responsible for the
  1618. * previous assertion.
  1619. */
  1620. for (j = 0, bit_idx = 0; bit_idx < 32; j++) {
  1621. u8 bit, bit_len;
  1622. u32 bitmask;
  1623. p_aeu = &sb_attn_sw->p_aeu_desc[i].bits[j];
  1624. /* No need to handle parity-only bits */
  1625. if (p_aeu->flags == ATTENTION_PAR)
  1626. continue;
  1627. bit = bit_idx;
  1628. bit_len = ATTENTION_LENGTH(p_aeu->flags);
  1629. if (p_aeu->flags & ATTENTION_PAR_INT) {
  1630. /* Skip Parity */
  1631. bit++;
  1632. bit_len--;
  1633. }
  1634. bitmask = bits & (((1 << bit_len) - 1) << bit);
  1635. if (bitmask) {
  1636. /* Handle source of the attention */
  1637. qed_int_deassertion_aeu_bit(p_hwfn,
  1638. p_aeu,
  1639. aeu_en,
  1640. bitmask);
  1641. }
  1642. bit_idx += ATTENTION_LENGTH(p_aeu->flags);
  1643. }
  1644. }
  1645. }
  1646. /* Clear IGU indication for the deasserted bits */
  1647. DIRECT_REG_WR((u8 __iomem *)p_hwfn->regview +
  1648. GTT_BAR0_MAP_REG_IGU_CMD +
  1649. ((IGU_CMD_ATTN_BIT_CLR_UPPER -
  1650. IGU_CMD_INT_ACK_BASE) << 3),
  1651. ~((u32)deasserted_bits));
  1652. /* Unmask deasserted attentions in IGU */
  1653. aeu_mask = qed_rd(p_hwfn, p_hwfn->p_dpc_ptt, IGU_REG_ATTENTION_ENABLE);
  1654. aeu_mask |= (deasserted_bits & ATTN_BITS_MASKABLE);
  1655. qed_wr(p_hwfn, p_hwfn->p_dpc_ptt, IGU_REG_ATTENTION_ENABLE, aeu_mask);
  1656. /* Clear deassertion from inner state */
  1657. sb_attn_sw->known_attn &= ~deasserted_bits;
  1658. return rc;
  1659. }
  1660. static int qed_int_attentions(struct qed_hwfn *p_hwfn)
  1661. {
  1662. struct qed_sb_attn_info *p_sb_attn_sw = p_hwfn->p_sb_attn;
  1663. struct atten_status_block *p_sb_attn = p_sb_attn_sw->sb_attn;
  1664. u32 attn_bits = 0, attn_acks = 0;
  1665. u16 asserted_bits, deasserted_bits;
  1666. __le16 index;
  1667. int rc = 0;
  1668. /* Read current attention bits/acks - safeguard against attentions
  1669. * by guaranting work on a synchronized timeframe
  1670. */
  1671. do {
  1672. index = p_sb_attn->sb_index;
  1673. attn_bits = le32_to_cpu(p_sb_attn->atten_bits);
  1674. attn_acks = le32_to_cpu(p_sb_attn->atten_ack);
  1675. } while (index != p_sb_attn->sb_index);
  1676. p_sb_attn->sb_index = index;
  1677. /* Attention / Deassertion are meaningful (and in correct state)
  1678. * only when they differ and consistent with known state - deassertion
  1679. * when previous attention & current ack, and assertion when current
  1680. * attention with no previous attention
  1681. */
  1682. asserted_bits = (attn_bits & ~attn_acks & ATTN_STATE_BITS) &
  1683. ~p_sb_attn_sw->known_attn;
  1684. deasserted_bits = (~attn_bits & attn_acks & ATTN_STATE_BITS) &
  1685. p_sb_attn_sw->known_attn;
  1686. if ((asserted_bits & ~0x100) || (deasserted_bits & ~0x100)) {
  1687. DP_INFO(p_hwfn,
  1688. "Attention: Index: 0x%04x, Bits: 0x%08x, Acks: 0x%08x, asserted: 0x%04x, De-asserted 0x%04x [Prev. known: 0x%04x]\n",
  1689. index, attn_bits, attn_acks, asserted_bits,
  1690. deasserted_bits, p_sb_attn_sw->known_attn);
  1691. } else if (asserted_bits == 0x100) {
  1692. DP_INFO(p_hwfn, "MFW indication via attention\n");
  1693. } else {
  1694. DP_VERBOSE(p_hwfn, NETIF_MSG_INTR,
  1695. "MFW indication [deassertion]\n");
  1696. }
  1697. if (asserted_bits) {
  1698. rc = qed_int_assertion(p_hwfn, asserted_bits);
  1699. if (rc)
  1700. return rc;
  1701. }
  1702. if (deasserted_bits)
  1703. rc = qed_int_deassertion(p_hwfn, deasserted_bits);
  1704. return rc;
  1705. }
  1706. static void qed_sb_ack_attn(struct qed_hwfn *p_hwfn,
  1707. void __iomem *igu_addr, u32 ack_cons)
  1708. {
  1709. struct igu_prod_cons_update igu_ack = { 0 };
  1710. igu_ack.sb_id_and_flags =
  1711. ((ack_cons << IGU_PROD_CONS_UPDATE_SB_INDEX_SHIFT) |
  1712. (1 << IGU_PROD_CONS_UPDATE_UPDATE_FLAG_SHIFT) |
  1713. (IGU_INT_NOP << IGU_PROD_CONS_UPDATE_ENABLE_INT_SHIFT) |
  1714. (IGU_SEG_ACCESS_ATTN <<
  1715. IGU_PROD_CONS_UPDATE_SEGMENT_ACCESS_SHIFT));
  1716. DIRECT_REG_WR(igu_addr, igu_ack.sb_id_and_flags);
  1717. /* Both segments (interrupts & acks) are written to same place address;
  1718. * Need to guarantee all commands will be received (in-order) by HW.
  1719. */
  1720. mmiowb();
  1721. barrier();
  1722. }
  1723. void qed_int_sp_dpc(unsigned long hwfn_cookie)
  1724. {
  1725. struct qed_hwfn *p_hwfn = (struct qed_hwfn *)hwfn_cookie;
  1726. struct qed_pi_info *pi_info = NULL;
  1727. struct qed_sb_attn_info *sb_attn;
  1728. struct qed_sb_info *sb_info;
  1729. int arr_size;
  1730. u16 rc = 0;
  1731. if (!p_hwfn->p_sp_sb) {
  1732. DP_ERR(p_hwfn->cdev, "DPC called - no p_sp_sb\n");
  1733. return;
  1734. }
  1735. sb_info = &p_hwfn->p_sp_sb->sb_info;
  1736. arr_size = ARRAY_SIZE(p_hwfn->p_sp_sb->pi_info_arr);
  1737. if (!sb_info) {
  1738. DP_ERR(p_hwfn->cdev,
  1739. "Status block is NULL - cannot ack interrupts\n");
  1740. return;
  1741. }
  1742. if (!p_hwfn->p_sb_attn) {
  1743. DP_ERR(p_hwfn->cdev, "DPC called - no p_sb_attn");
  1744. return;
  1745. }
  1746. sb_attn = p_hwfn->p_sb_attn;
  1747. DP_VERBOSE(p_hwfn, NETIF_MSG_INTR, "DPC Called! (hwfn %p %d)\n",
  1748. p_hwfn, p_hwfn->my_id);
  1749. /* Disable ack for def status block. Required both for msix +
  1750. * inta in non-mask mode, in inta does no harm.
  1751. */
  1752. qed_sb_ack(sb_info, IGU_INT_DISABLE, 0);
  1753. /* Gather Interrupts/Attentions information */
  1754. if (!sb_info->sb_virt) {
  1755. DP_ERR(p_hwfn->cdev,
  1756. "Interrupt Status block is NULL - cannot check for new interrupts!\n");
  1757. } else {
  1758. u32 tmp_index = sb_info->sb_ack;
  1759. rc = qed_sb_update_sb_idx(sb_info);
  1760. DP_VERBOSE(p_hwfn->cdev, NETIF_MSG_INTR,
  1761. "Interrupt indices: 0x%08x --> 0x%08x\n",
  1762. tmp_index, sb_info->sb_ack);
  1763. }
  1764. if (!sb_attn || !sb_attn->sb_attn) {
  1765. DP_ERR(p_hwfn->cdev,
  1766. "Attentions Status block is NULL - cannot check for new attentions!\n");
  1767. } else {
  1768. u16 tmp_index = sb_attn->index;
  1769. rc |= qed_attn_update_idx(p_hwfn, sb_attn);
  1770. DP_VERBOSE(p_hwfn->cdev, NETIF_MSG_INTR,
  1771. "Attention indices: 0x%08x --> 0x%08x\n",
  1772. tmp_index, sb_attn->index);
  1773. }
  1774. /* Check if we expect interrupts at this time. if not just ack them */
  1775. if (!(rc & QED_SB_EVENT_MASK)) {
  1776. qed_sb_ack(sb_info, IGU_INT_ENABLE, 1);
  1777. return;
  1778. }
  1779. /* Check the validity of the DPC ptt. If not ack interrupts and fail */
  1780. if (!p_hwfn->p_dpc_ptt) {
  1781. DP_NOTICE(p_hwfn->cdev, "Failed to allocate PTT\n");
  1782. qed_sb_ack(sb_info, IGU_INT_ENABLE, 1);
  1783. return;
  1784. }
  1785. if (rc & QED_SB_ATT_IDX)
  1786. qed_int_attentions(p_hwfn);
  1787. if (rc & QED_SB_IDX) {
  1788. int pi;
  1789. /* Look for a free index */
  1790. for (pi = 0; pi < arr_size; pi++) {
  1791. pi_info = &p_hwfn->p_sp_sb->pi_info_arr[pi];
  1792. if (pi_info->comp_cb)
  1793. pi_info->comp_cb(p_hwfn, pi_info->cookie);
  1794. }
  1795. }
  1796. if (sb_attn && (rc & QED_SB_ATT_IDX))
  1797. /* This should be done before the interrupts are enabled,
  1798. * since otherwise a new attention will be generated.
  1799. */
  1800. qed_sb_ack_attn(p_hwfn, sb_info->igu_addr, sb_attn->index);
  1801. qed_sb_ack(sb_info, IGU_INT_ENABLE, 1);
  1802. }
  1803. static void qed_int_sb_attn_free(struct qed_hwfn *p_hwfn)
  1804. {
  1805. struct qed_sb_attn_info *p_sb = p_hwfn->p_sb_attn;
  1806. if (!p_sb)
  1807. return;
  1808. if (p_sb->sb_attn)
  1809. dma_free_coherent(&p_hwfn->cdev->pdev->dev,
  1810. SB_ATTN_ALIGNED_SIZE(p_hwfn),
  1811. p_sb->sb_attn, p_sb->sb_phys);
  1812. kfree(p_sb);
  1813. }
  1814. static void qed_int_sb_attn_setup(struct qed_hwfn *p_hwfn,
  1815. struct qed_ptt *p_ptt)
  1816. {
  1817. struct qed_sb_attn_info *sb_info = p_hwfn->p_sb_attn;
  1818. memset(sb_info->sb_attn, 0, sizeof(*sb_info->sb_attn));
  1819. sb_info->index = 0;
  1820. sb_info->known_attn = 0;
  1821. /* Configure Attention Status Block in IGU */
  1822. qed_wr(p_hwfn, p_ptt, IGU_REG_ATTN_MSG_ADDR_L,
  1823. lower_32_bits(p_hwfn->p_sb_attn->sb_phys));
  1824. qed_wr(p_hwfn, p_ptt, IGU_REG_ATTN_MSG_ADDR_H,
  1825. upper_32_bits(p_hwfn->p_sb_attn->sb_phys));
  1826. }
  1827. static void qed_int_sb_attn_init(struct qed_hwfn *p_hwfn,
  1828. struct qed_ptt *p_ptt,
  1829. void *sb_virt_addr, dma_addr_t sb_phy_addr)
  1830. {
  1831. struct qed_sb_attn_info *sb_info = p_hwfn->p_sb_attn;
  1832. int i, j, k;
  1833. sb_info->sb_attn = sb_virt_addr;
  1834. sb_info->sb_phys = sb_phy_addr;
  1835. /* Set the pointer to the AEU descriptors */
  1836. sb_info->p_aeu_desc = aeu_descs;
  1837. /* Calculate Parity Masks */
  1838. memset(sb_info->parity_mask, 0, sizeof(u32) * NUM_ATTN_REGS);
  1839. for (i = 0; i < NUM_ATTN_REGS; i++) {
  1840. /* j is array index, k is bit index */
  1841. for (j = 0, k = 0; k < 32; j++) {
  1842. unsigned int flags = aeu_descs[i].bits[j].flags;
  1843. if (flags & ATTENTION_PARITY)
  1844. sb_info->parity_mask[i] |= 1 << k;
  1845. k += ATTENTION_LENGTH(flags);
  1846. }
  1847. DP_VERBOSE(p_hwfn, NETIF_MSG_INTR,
  1848. "Attn Mask [Reg %d]: 0x%08x\n",
  1849. i, sb_info->parity_mask[i]);
  1850. }
  1851. /* Set the address of cleanup for the mcp attention */
  1852. sb_info->mfw_attn_addr = (p_hwfn->rel_pf_id << 3) +
  1853. MISC_REG_AEU_GENERAL_ATTN_0;
  1854. qed_int_sb_attn_setup(p_hwfn, p_ptt);
  1855. }
  1856. static int qed_int_sb_attn_alloc(struct qed_hwfn *p_hwfn,
  1857. struct qed_ptt *p_ptt)
  1858. {
  1859. struct qed_dev *cdev = p_hwfn->cdev;
  1860. struct qed_sb_attn_info *p_sb;
  1861. dma_addr_t p_phys = 0;
  1862. void *p_virt;
  1863. /* SB struct */
  1864. p_sb = kmalloc(sizeof(*p_sb), GFP_KERNEL);
  1865. if (!p_sb)
  1866. return -ENOMEM;
  1867. /* SB ring */
  1868. p_virt = dma_alloc_coherent(&cdev->pdev->dev,
  1869. SB_ATTN_ALIGNED_SIZE(p_hwfn),
  1870. &p_phys, GFP_KERNEL);
  1871. if (!p_virt) {
  1872. kfree(p_sb);
  1873. return -ENOMEM;
  1874. }
  1875. /* Attention setup */
  1876. p_hwfn->p_sb_attn = p_sb;
  1877. qed_int_sb_attn_init(p_hwfn, p_ptt, p_virt, p_phys);
  1878. return 0;
  1879. }
  1880. /* coalescing timeout = timeset << (timer_res + 1) */
  1881. #define QED_CAU_DEF_RX_USECS 24
  1882. #define QED_CAU_DEF_TX_USECS 48
  1883. void qed_init_cau_sb_entry(struct qed_hwfn *p_hwfn,
  1884. struct cau_sb_entry *p_sb_entry,
  1885. u8 pf_id, u16 vf_number, u8 vf_valid)
  1886. {
  1887. struct qed_dev *cdev = p_hwfn->cdev;
  1888. u32 cau_state;
  1889. u8 timer_res;
  1890. memset(p_sb_entry, 0, sizeof(*p_sb_entry));
  1891. SET_FIELD(p_sb_entry->params, CAU_SB_ENTRY_PF_NUMBER, pf_id);
  1892. SET_FIELD(p_sb_entry->params, CAU_SB_ENTRY_VF_NUMBER, vf_number);
  1893. SET_FIELD(p_sb_entry->params, CAU_SB_ENTRY_VF_VALID, vf_valid);
  1894. SET_FIELD(p_sb_entry->params, CAU_SB_ENTRY_SB_TIMESET0, 0x7F);
  1895. SET_FIELD(p_sb_entry->params, CAU_SB_ENTRY_SB_TIMESET1, 0x7F);
  1896. cau_state = CAU_HC_DISABLE_STATE;
  1897. if (cdev->int_coalescing_mode == QED_COAL_MODE_ENABLE) {
  1898. cau_state = CAU_HC_ENABLE_STATE;
  1899. if (!cdev->rx_coalesce_usecs)
  1900. cdev->rx_coalesce_usecs = QED_CAU_DEF_RX_USECS;
  1901. if (!cdev->tx_coalesce_usecs)
  1902. cdev->tx_coalesce_usecs = QED_CAU_DEF_TX_USECS;
  1903. }
  1904. /* Coalesce = (timeset << timer-res), timeset is 7bit wide */
  1905. if (cdev->rx_coalesce_usecs <= 0x7F)
  1906. timer_res = 0;
  1907. else if (cdev->rx_coalesce_usecs <= 0xFF)
  1908. timer_res = 1;
  1909. else
  1910. timer_res = 2;
  1911. SET_FIELD(p_sb_entry->params, CAU_SB_ENTRY_TIMER_RES0, timer_res);
  1912. if (cdev->tx_coalesce_usecs <= 0x7F)
  1913. timer_res = 0;
  1914. else if (cdev->tx_coalesce_usecs <= 0xFF)
  1915. timer_res = 1;
  1916. else
  1917. timer_res = 2;
  1918. SET_FIELD(p_sb_entry->params, CAU_SB_ENTRY_TIMER_RES1, timer_res);
  1919. SET_FIELD(p_sb_entry->data, CAU_SB_ENTRY_STATE0, cau_state);
  1920. SET_FIELD(p_sb_entry->data, CAU_SB_ENTRY_STATE1, cau_state);
  1921. }
  1922. void qed_int_cau_conf_sb(struct qed_hwfn *p_hwfn,
  1923. struct qed_ptt *p_ptt,
  1924. dma_addr_t sb_phys,
  1925. u16 igu_sb_id, u16 vf_number, u8 vf_valid)
  1926. {
  1927. struct cau_sb_entry sb_entry;
  1928. qed_init_cau_sb_entry(p_hwfn, &sb_entry, p_hwfn->rel_pf_id,
  1929. vf_number, vf_valid);
  1930. if (p_hwfn->hw_init_done) {
  1931. /* Wide-bus, initialize via DMAE */
  1932. u64 phys_addr = (u64)sb_phys;
  1933. qed_dmae_host2grc(p_hwfn, p_ptt, (u64)(uintptr_t)&phys_addr,
  1934. CAU_REG_SB_ADDR_MEMORY +
  1935. igu_sb_id * sizeof(u64), 2, 0);
  1936. qed_dmae_host2grc(p_hwfn, p_ptt, (u64)(uintptr_t)&sb_entry,
  1937. CAU_REG_SB_VAR_MEMORY +
  1938. igu_sb_id * sizeof(u64), 2, 0);
  1939. } else {
  1940. /* Initialize Status Block Address */
  1941. STORE_RT_REG_AGG(p_hwfn,
  1942. CAU_REG_SB_ADDR_MEMORY_RT_OFFSET +
  1943. igu_sb_id * 2,
  1944. sb_phys);
  1945. STORE_RT_REG_AGG(p_hwfn,
  1946. CAU_REG_SB_VAR_MEMORY_RT_OFFSET +
  1947. igu_sb_id * 2,
  1948. sb_entry);
  1949. }
  1950. /* Configure pi coalescing if set */
  1951. if (p_hwfn->cdev->int_coalescing_mode == QED_COAL_MODE_ENABLE) {
  1952. u8 num_tc = p_hwfn->hw_info.num_hw_tc;
  1953. u8 timeset, timer_res;
  1954. u8 i;
  1955. /* timeset = (coalesce >> timer-res), timeset is 7bit wide */
  1956. if (p_hwfn->cdev->rx_coalesce_usecs <= 0x7F)
  1957. timer_res = 0;
  1958. else if (p_hwfn->cdev->rx_coalesce_usecs <= 0xFF)
  1959. timer_res = 1;
  1960. else
  1961. timer_res = 2;
  1962. timeset = (u8)(p_hwfn->cdev->rx_coalesce_usecs >> timer_res);
  1963. qed_int_cau_conf_pi(p_hwfn, p_ptt, igu_sb_id, RX_PI,
  1964. QED_COAL_RX_STATE_MACHINE, timeset);
  1965. if (p_hwfn->cdev->tx_coalesce_usecs <= 0x7F)
  1966. timer_res = 0;
  1967. else if (p_hwfn->cdev->tx_coalesce_usecs <= 0xFF)
  1968. timer_res = 1;
  1969. else
  1970. timer_res = 2;
  1971. timeset = (u8)(p_hwfn->cdev->tx_coalesce_usecs >> timer_res);
  1972. for (i = 0; i < num_tc; i++) {
  1973. qed_int_cau_conf_pi(p_hwfn, p_ptt,
  1974. igu_sb_id, TX_PI(i),
  1975. QED_COAL_TX_STATE_MACHINE,
  1976. timeset);
  1977. }
  1978. }
  1979. }
  1980. void qed_int_cau_conf_pi(struct qed_hwfn *p_hwfn,
  1981. struct qed_ptt *p_ptt,
  1982. u16 igu_sb_id,
  1983. u32 pi_index,
  1984. enum qed_coalescing_fsm coalescing_fsm,
  1985. u8 timeset)
  1986. {
  1987. struct cau_pi_entry pi_entry;
  1988. u32 sb_offset, pi_offset;
  1989. if (IS_VF(p_hwfn->cdev))
  1990. return;
  1991. sb_offset = igu_sb_id * PIS_PER_SB;
  1992. memset(&pi_entry, 0, sizeof(struct cau_pi_entry));
  1993. SET_FIELD(pi_entry.prod, CAU_PI_ENTRY_PI_TIMESET, timeset);
  1994. if (coalescing_fsm == QED_COAL_RX_STATE_MACHINE)
  1995. SET_FIELD(pi_entry.prod, CAU_PI_ENTRY_FSM_SEL, 0);
  1996. else
  1997. SET_FIELD(pi_entry.prod, CAU_PI_ENTRY_FSM_SEL, 1);
  1998. pi_offset = sb_offset + pi_index;
  1999. if (p_hwfn->hw_init_done) {
  2000. qed_wr(p_hwfn, p_ptt,
  2001. CAU_REG_PI_MEMORY + pi_offset * sizeof(u32),
  2002. *((u32 *)&(pi_entry)));
  2003. } else {
  2004. STORE_RT_REG(p_hwfn,
  2005. CAU_REG_PI_MEMORY_RT_OFFSET + pi_offset,
  2006. *((u32 *)&(pi_entry)));
  2007. }
  2008. }
  2009. void qed_int_sb_setup(struct qed_hwfn *p_hwfn,
  2010. struct qed_ptt *p_ptt, struct qed_sb_info *sb_info)
  2011. {
  2012. /* zero status block and ack counter */
  2013. sb_info->sb_ack = 0;
  2014. memset(sb_info->sb_virt, 0, sizeof(*sb_info->sb_virt));
  2015. if (IS_PF(p_hwfn->cdev))
  2016. qed_int_cau_conf_sb(p_hwfn, p_ptt, sb_info->sb_phys,
  2017. sb_info->igu_sb_id, 0, 0);
  2018. }
  2019. /**
  2020. * @brief qed_get_igu_sb_id - given a sw sb_id return the
  2021. * igu_sb_id
  2022. *
  2023. * @param p_hwfn
  2024. * @param sb_id
  2025. *
  2026. * @return u16
  2027. */
  2028. static u16 qed_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id)
  2029. {
  2030. u16 igu_sb_id;
  2031. /* Assuming continuous set of IGU SBs dedicated for given PF */
  2032. if (sb_id == QED_SP_SB_ID)
  2033. igu_sb_id = p_hwfn->hw_info.p_igu_info->igu_dsb_id;
  2034. else if (IS_PF(p_hwfn->cdev))
  2035. igu_sb_id = sb_id + p_hwfn->hw_info.p_igu_info->igu_base_sb;
  2036. else
  2037. igu_sb_id = qed_vf_get_igu_sb_id(p_hwfn, sb_id);
  2038. if (sb_id == QED_SP_SB_ID)
  2039. DP_VERBOSE(p_hwfn, NETIF_MSG_INTR,
  2040. "Slowpath SB index in IGU is 0x%04x\n", igu_sb_id);
  2041. else
  2042. DP_VERBOSE(p_hwfn, NETIF_MSG_INTR,
  2043. "SB [%04x] <--> IGU SB [%04x]\n", sb_id, igu_sb_id);
  2044. return igu_sb_id;
  2045. }
  2046. int qed_int_sb_init(struct qed_hwfn *p_hwfn,
  2047. struct qed_ptt *p_ptt,
  2048. struct qed_sb_info *sb_info,
  2049. void *sb_virt_addr, dma_addr_t sb_phy_addr, u16 sb_id)
  2050. {
  2051. sb_info->sb_virt = sb_virt_addr;
  2052. sb_info->sb_phys = sb_phy_addr;
  2053. sb_info->igu_sb_id = qed_get_igu_sb_id(p_hwfn, sb_id);
  2054. if (sb_id != QED_SP_SB_ID) {
  2055. p_hwfn->sbs_info[sb_id] = sb_info;
  2056. p_hwfn->num_sbs++;
  2057. }
  2058. sb_info->cdev = p_hwfn->cdev;
  2059. /* The igu address will hold the absolute address that needs to be
  2060. * written to for a specific status block
  2061. */
  2062. if (IS_PF(p_hwfn->cdev)) {
  2063. sb_info->igu_addr = (u8 __iomem *)p_hwfn->regview +
  2064. GTT_BAR0_MAP_REG_IGU_CMD +
  2065. (sb_info->igu_sb_id << 3);
  2066. } else {
  2067. sb_info->igu_addr = (u8 __iomem *)p_hwfn->regview +
  2068. PXP_VF_BAR0_START_IGU +
  2069. ((IGU_CMD_INT_ACK_BASE +
  2070. sb_info->igu_sb_id) << 3);
  2071. }
  2072. sb_info->flags |= QED_SB_INFO_INIT;
  2073. qed_int_sb_setup(p_hwfn, p_ptt, sb_info);
  2074. return 0;
  2075. }
  2076. int qed_int_sb_release(struct qed_hwfn *p_hwfn,
  2077. struct qed_sb_info *sb_info, u16 sb_id)
  2078. {
  2079. if (sb_id == QED_SP_SB_ID) {
  2080. DP_ERR(p_hwfn, "Do Not free sp sb using this function");
  2081. return -EINVAL;
  2082. }
  2083. /* zero status block and ack counter */
  2084. sb_info->sb_ack = 0;
  2085. memset(sb_info->sb_virt, 0, sizeof(*sb_info->sb_virt));
  2086. if (p_hwfn->sbs_info[sb_id] != NULL) {
  2087. p_hwfn->sbs_info[sb_id] = NULL;
  2088. p_hwfn->num_sbs--;
  2089. }
  2090. return 0;
  2091. }
  2092. static void qed_int_sp_sb_free(struct qed_hwfn *p_hwfn)
  2093. {
  2094. struct qed_sb_sp_info *p_sb = p_hwfn->p_sp_sb;
  2095. if (!p_sb)
  2096. return;
  2097. if (p_sb->sb_info.sb_virt)
  2098. dma_free_coherent(&p_hwfn->cdev->pdev->dev,
  2099. SB_ALIGNED_SIZE(p_hwfn),
  2100. p_sb->sb_info.sb_virt,
  2101. p_sb->sb_info.sb_phys);
  2102. kfree(p_sb);
  2103. }
  2104. static int qed_int_sp_sb_alloc(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
  2105. {
  2106. struct qed_sb_sp_info *p_sb;
  2107. dma_addr_t p_phys = 0;
  2108. void *p_virt;
  2109. /* SB struct */
  2110. p_sb = kmalloc(sizeof(*p_sb), GFP_KERNEL);
  2111. if (!p_sb)
  2112. return -ENOMEM;
  2113. /* SB ring */
  2114. p_virt = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
  2115. SB_ALIGNED_SIZE(p_hwfn),
  2116. &p_phys, GFP_KERNEL);
  2117. if (!p_virt) {
  2118. kfree(p_sb);
  2119. return -ENOMEM;
  2120. }
  2121. /* Status Block setup */
  2122. p_hwfn->p_sp_sb = p_sb;
  2123. qed_int_sb_init(p_hwfn, p_ptt, &p_sb->sb_info, p_virt,
  2124. p_phys, QED_SP_SB_ID);
  2125. memset(p_sb->pi_info_arr, 0, sizeof(p_sb->pi_info_arr));
  2126. return 0;
  2127. }
  2128. int qed_int_register_cb(struct qed_hwfn *p_hwfn,
  2129. qed_int_comp_cb_t comp_cb,
  2130. void *cookie, u8 *sb_idx, __le16 **p_fw_cons)
  2131. {
  2132. struct qed_sb_sp_info *p_sp_sb = p_hwfn->p_sp_sb;
  2133. int rc = -ENOMEM;
  2134. u8 pi;
  2135. /* Look for a free index */
  2136. for (pi = 0; pi < ARRAY_SIZE(p_sp_sb->pi_info_arr); pi++) {
  2137. if (p_sp_sb->pi_info_arr[pi].comp_cb)
  2138. continue;
  2139. p_sp_sb->pi_info_arr[pi].comp_cb = comp_cb;
  2140. p_sp_sb->pi_info_arr[pi].cookie = cookie;
  2141. *sb_idx = pi;
  2142. *p_fw_cons = &p_sp_sb->sb_info.sb_virt->pi_array[pi];
  2143. rc = 0;
  2144. break;
  2145. }
  2146. return rc;
  2147. }
  2148. int qed_int_unregister_cb(struct qed_hwfn *p_hwfn, u8 pi)
  2149. {
  2150. struct qed_sb_sp_info *p_sp_sb = p_hwfn->p_sp_sb;
  2151. if (p_sp_sb->pi_info_arr[pi].comp_cb == NULL)
  2152. return -ENOMEM;
  2153. p_sp_sb->pi_info_arr[pi].comp_cb = NULL;
  2154. p_sp_sb->pi_info_arr[pi].cookie = NULL;
  2155. return 0;
  2156. }
  2157. u16 qed_int_get_sp_sb_id(struct qed_hwfn *p_hwfn)
  2158. {
  2159. return p_hwfn->p_sp_sb->sb_info.igu_sb_id;
  2160. }
  2161. void qed_int_igu_enable_int(struct qed_hwfn *p_hwfn,
  2162. struct qed_ptt *p_ptt, enum qed_int_mode int_mode)
  2163. {
  2164. u32 igu_pf_conf = IGU_PF_CONF_FUNC_EN | IGU_PF_CONF_ATTN_BIT_EN;
  2165. p_hwfn->cdev->int_mode = int_mode;
  2166. switch (p_hwfn->cdev->int_mode) {
  2167. case QED_INT_MODE_INTA:
  2168. igu_pf_conf |= IGU_PF_CONF_INT_LINE_EN;
  2169. igu_pf_conf |= IGU_PF_CONF_SINGLE_ISR_EN;
  2170. break;
  2171. case QED_INT_MODE_MSI:
  2172. igu_pf_conf |= IGU_PF_CONF_MSI_MSIX_EN;
  2173. igu_pf_conf |= IGU_PF_CONF_SINGLE_ISR_EN;
  2174. break;
  2175. case QED_INT_MODE_MSIX:
  2176. igu_pf_conf |= IGU_PF_CONF_MSI_MSIX_EN;
  2177. break;
  2178. case QED_INT_MODE_POLL:
  2179. break;
  2180. }
  2181. qed_wr(p_hwfn, p_ptt, IGU_REG_PF_CONFIGURATION, igu_pf_conf);
  2182. }
  2183. int qed_int_igu_enable(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
  2184. enum qed_int_mode int_mode)
  2185. {
  2186. int rc = 0;
  2187. /* Configure AEU signal change to produce attentions */
  2188. qed_wr(p_hwfn, p_ptt, IGU_REG_ATTENTION_ENABLE, 0);
  2189. qed_wr(p_hwfn, p_ptt, IGU_REG_LEADING_EDGE_LATCH, 0xfff);
  2190. qed_wr(p_hwfn, p_ptt, IGU_REG_TRAILING_EDGE_LATCH, 0xfff);
  2191. qed_wr(p_hwfn, p_ptt, IGU_REG_ATTENTION_ENABLE, 0xfff);
  2192. /* Flush the writes to IGU */
  2193. mmiowb();
  2194. /* Unmask AEU signals toward IGU */
  2195. qed_wr(p_hwfn, p_ptt, MISC_REG_AEU_MASK_ATTN_IGU, 0xff);
  2196. if ((int_mode != QED_INT_MODE_INTA) || IS_LEAD_HWFN(p_hwfn)) {
  2197. rc = qed_slowpath_irq_req(p_hwfn);
  2198. if (rc) {
  2199. DP_NOTICE(p_hwfn, "Slowpath IRQ request failed\n");
  2200. return -EINVAL;
  2201. }
  2202. p_hwfn->b_int_requested = true;
  2203. }
  2204. /* Enable interrupt Generation */
  2205. qed_int_igu_enable_int(p_hwfn, p_ptt, int_mode);
  2206. p_hwfn->b_int_enabled = 1;
  2207. return rc;
  2208. }
  2209. void qed_int_igu_disable_int(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
  2210. {
  2211. p_hwfn->b_int_enabled = 0;
  2212. if (IS_VF(p_hwfn->cdev))
  2213. return;
  2214. qed_wr(p_hwfn, p_ptt, IGU_REG_PF_CONFIGURATION, 0);
  2215. }
  2216. #define IGU_CLEANUP_SLEEP_LENGTH (1000)
  2217. static void qed_int_igu_cleanup_sb(struct qed_hwfn *p_hwfn,
  2218. struct qed_ptt *p_ptt,
  2219. u32 sb_id, bool cleanup_set, u16 opaque_fid)
  2220. {
  2221. u32 cmd_ctrl = 0, val = 0, sb_bit = 0, sb_bit_addr = 0, data = 0;
  2222. u32 pxp_addr = IGU_CMD_INT_ACK_BASE + sb_id;
  2223. u32 sleep_cnt = IGU_CLEANUP_SLEEP_LENGTH;
  2224. /* Set the data field */
  2225. SET_FIELD(data, IGU_CLEANUP_CLEANUP_SET, cleanup_set ? 1 : 0);
  2226. SET_FIELD(data, IGU_CLEANUP_CLEANUP_TYPE, 0);
  2227. SET_FIELD(data, IGU_CLEANUP_COMMAND_TYPE, IGU_COMMAND_TYPE_SET);
  2228. /* Set the control register */
  2229. SET_FIELD(cmd_ctrl, IGU_CTRL_REG_PXP_ADDR, pxp_addr);
  2230. SET_FIELD(cmd_ctrl, IGU_CTRL_REG_FID, opaque_fid);
  2231. SET_FIELD(cmd_ctrl, IGU_CTRL_REG_TYPE, IGU_CTRL_CMD_TYPE_WR);
  2232. qed_wr(p_hwfn, p_ptt, IGU_REG_COMMAND_REG_32LSB_DATA, data);
  2233. barrier();
  2234. qed_wr(p_hwfn, p_ptt, IGU_REG_COMMAND_REG_CTRL, cmd_ctrl);
  2235. /* Flush the write to IGU */
  2236. mmiowb();
  2237. /* calculate where to read the status bit from */
  2238. sb_bit = 1 << (sb_id % 32);
  2239. sb_bit_addr = sb_id / 32 * sizeof(u32);
  2240. sb_bit_addr += IGU_REG_CLEANUP_STATUS_0;
  2241. /* Now wait for the command to complete */
  2242. do {
  2243. val = qed_rd(p_hwfn, p_ptt, sb_bit_addr);
  2244. if ((val & sb_bit) == (cleanup_set ? sb_bit : 0))
  2245. break;
  2246. usleep_range(5000, 10000);
  2247. } while (--sleep_cnt);
  2248. if (!sleep_cnt)
  2249. DP_NOTICE(p_hwfn,
  2250. "Timeout waiting for clear status 0x%08x [for sb %d]\n",
  2251. val, sb_id);
  2252. }
  2253. void qed_int_igu_init_pure_rt_single(struct qed_hwfn *p_hwfn,
  2254. struct qed_ptt *p_ptt,
  2255. u32 sb_id, u16 opaque, bool b_set)
  2256. {
  2257. int pi, i;
  2258. /* Set */
  2259. if (b_set)
  2260. qed_int_igu_cleanup_sb(p_hwfn, p_ptt, sb_id, 1, opaque);
  2261. /* Clear */
  2262. qed_int_igu_cleanup_sb(p_hwfn, p_ptt, sb_id, 0, opaque);
  2263. /* Wait for the IGU SB to cleanup */
  2264. for (i = 0; i < IGU_CLEANUP_SLEEP_LENGTH; i++) {
  2265. u32 val;
  2266. val = qed_rd(p_hwfn, p_ptt,
  2267. IGU_REG_WRITE_DONE_PENDING + ((sb_id / 32) * 4));
  2268. if (val & (1 << (sb_id % 32)))
  2269. usleep_range(10, 20);
  2270. else
  2271. break;
  2272. }
  2273. if (i == IGU_CLEANUP_SLEEP_LENGTH)
  2274. DP_NOTICE(p_hwfn,
  2275. "Failed SB[0x%08x] still appearing in WRITE_DONE_PENDING\n",
  2276. sb_id);
  2277. /* Clear the CAU for the SB */
  2278. for (pi = 0; pi < 12; pi++)
  2279. qed_wr(p_hwfn, p_ptt,
  2280. CAU_REG_PI_MEMORY + (sb_id * 12 + pi) * 4, 0);
  2281. }
  2282. void qed_int_igu_init_pure_rt(struct qed_hwfn *p_hwfn,
  2283. struct qed_ptt *p_ptt,
  2284. bool b_set, bool b_slowpath)
  2285. {
  2286. u32 igu_base_sb = p_hwfn->hw_info.p_igu_info->igu_base_sb;
  2287. u32 igu_sb_cnt = p_hwfn->hw_info.p_igu_info->igu_sb_cnt;
  2288. u32 sb_id = 0, val = 0;
  2289. val = qed_rd(p_hwfn, p_ptt, IGU_REG_BLOCK_CONFIGURATION);
  2290. val |= IGU_REG_BLOCK_CONFIGURATION_VF_CLEANUP_EN;
  2291. val &= ~IGU_REG_BLOCK_CONFIGURATION_PXP_TPH_INTERFACE_EN;
  2292. qed_wr(p_hwfn, p_ptt, IGU_REG_BLOCK_CONFIGURATION, val);
  2293. DP_VERBOSE(p_hwfn, NETIF_MSG_INTR,
  2294. "IGU cleaning SBs [%d,...,%d]\n",
  2295. igu_base_sb, igu_base_sb + igu_sb_cnt - 1);
  2296. for (sb_id = igu_base_sb; sb_id < igu_base_sb + igu_sb_cnt; sb_id++)
  2297. qed_int_igu_init_pure_rt_single(p_hwfn, p_ptt, sb_id,
  2298. p_hwfn->hw_info.opaque_fid,
  2299. b_set);
  2300. if (!b_slowpath)
  2301. return;
  2302. sb_id = p_hwfn->hw_info.p_igu_info->igu_dsb_id;
  2303. DP_VERBOSE(p_hwfn, NETIF_MSG_INTR,
  2304. "IGU cleaning slowpath SB [%d]\n", sb_id);
  2305. qed_int_igu_init_pure_rt_single(p_hwfn, p_ptt, sb_id,
  2306. p_hwfn->hw_info.opaque_fid, b_set);
  2307. }
  2308. static u32 qed_int_igu_read_cam_block(struct qed_hwfn *p_hwfn,
  2309. struct qed_ptt *p_ptt, u16 sb_id)
  2310. {
  2311. u32 val = qed_rd(p_hwfn, p_ptt,
  2312. IGU_REG_MAPPING_MEMORY + sizeof(u32) * sb_id);
  2313. struct qed_igu_block *p_block;
  2314. p_block = &p_hwfn->hw_info.p_igu_info->igu_map.igu_blocks[sb_id];
  2315. /* stop scanning when hit first invalid PF entry */
  2316. if (!GET_FIELD(val, IGU_MAPPING_LINE_VALID) &&
  2317. GET_FIELD(val, IGU_MAPPING_LINE_PF_VALID))
  2318. goto out;
  2319. /* Fill the block information */
  2320. p_block->status = QED_IGU_STATUS_VALID;
  2321. p_block->function_id = GET_FIELD(val,
  2322. IGU_MAPPING_LINE_FUNCTION_NUMBER);
  2323. p_block->is_pf = GET_FIELD(val, IGU_MAPPING_LINE_PF_VALID);
  2324. p_block->vector_number = GET_FIELD(val,
  2325. IGU_MAPPING_LINE_VECTOR_NUMBER);
  2326. DP_VERBOSE(p_hwfn, NETIF_MSG_INTR,
  2327. "IGU_BLOCK: [SB 0x%04x, Value in CAM 0x%08x] func_id = %d is_pf = %d vector_num = 0x%x\n",
  2328. sb_id, val, p_block->function_id,
  2329. p_block->is_pf, p_block->vector_number);
  2330. out:
  2331. return val;
  2332. }
  2333. int qed_int_igu_read_cam(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
  2334. {
  2335. struct qed_igu_info *p_igu_info;
  2336. u32 val, min_vf = 0, max_vf = 0;
  2337. u16 sb_id, last_iov_sb_id = 0;
  2338. struct qed_igu_block *blk;
  2339. u16 prev_sb_id = 0xFF;
  2340. p_hwfn->hw_info.p_igu_info = kzalloc(sizeof(*p_igu_info), GFP_KERNEL);
  2341. if (!p_hwfn->hw_info.p_igu_info)
  2342. return -ENOMEM;
  2343. p_igu_info = p_hwfn->hw_info.p_igu_info;
  2344. /* Initialize base sb / sb cnt for PFs and VFs */
  2345. p_igu_info->igu_base_sb = 0xffff;
  2346. p_igu_info->igu_sb_cnt = 0;
  2347. p_igu_info->igu_dsb_id = 0xffff;
  2348. p_igu_info->igu_base_sb_iov = 0xffff;
  2349. if (p_hwfn->cdev->p_iov_info) {
  2350. struct qed_hw_sriov_info *p_iov = p_hwfn->cdev->p_iov_info;
  2351. min_vf = p_iov->first_vf_in_pf;
  2352. max_vf = p_iov->first_vf_in_pf + p_iov->total_vfs;
  2353. }
  2354. for (sb_id = 0; sb_id < QED_MAPPING_MEMORY_SIZE(p_hwfn->cdev);
  2355. sb_id++) {
  2356. blk = &p_igu_info->igu_map.igu_blocks[sb_id];
  2357. val = qed_int_igu_read_cam_block(p_hwfn, p_ptt, sb_id);
  2358. /* stop scanning when hit first invalid PF entry */
  2359. if (!GET_FIELD(val, IGU_MAPPING_LINE_VALID) &&
  2360. GET_FIELD(val, IGU_MAPPING_LINE_PF_VALID))
  2361. break;
  2362. if (blk->is_pf) {
  2363. if (blk->function_id == p_hwfn->rel_pf_id) {
  2364. blk->status |= QED_IGU_STATUS_PF;
  2365. if (blk->vector_number == 0) {
  2366. if (p_igu_info->igu_dsb_id == 0xffff)
  2367. p_igu_info->igu_dsb_id = sb_id;
  2368. } else {
  2369. if (p_igu_info->igu_base_sb ==
  2370. 0xffff) {
  2371. p_igu_info->igu_base_sb = sb_id;
  2372. } else if (prev_sb_id != sb_id - 1) {
  2373. DP_NOTICE(p_hwfn->cdev,
  2374. "consecutive igu vectors for HWFN %x broken",
  2375. p_hwfn->rel_pf_id);
  2376. break;
  2377. }
  2378. prev_sb_id = sb_id;
  2379. /* we don't count the default */
  2380. (p_igu_info->igu_sb_cnt)++;
  2381. }
  2382. }
  2383. } else {
  2384. if ((blk->function_id >= min_vf) &&
  2385. (blk->function_id < max_vf)) {
  2386. /* Available for VFs of this PF */
  2387. if (p_igu_info->igu_base_sb_iov == 0xffff) {
  2388. p_igu_info->igu_base_sb_iov = sb_id;
  2389. } else if (last_iov_sb_id != sb_id - 1) {
  2390. if (!val) {
  2391. DP_VERBOSE(p_hwfn->cdev,
  2392. NETIF_MSG_INTR,
  2393. "First uninitialized IGU CAM entry at index 0x%04x\n",
  2394. sb_id);
  2395. } else {
  2396. DP_NOTICE(p_hwfn->cdev,
  2397. "Consecutive igu vectors for HWFN %x vfs is broken [jumps from %04x to %04x]\n",
  2398. p_hwfn->rel_pf_id,
  2399. last_iov_sb_id,
  2400. sb_id); }
  2401. break;
  2402. }
  2403. blk->status |= QED_IGU_STATUS_FREE;
  2404. p_hwfn->hw_info.p_igu_info->free_blks++;
  2405. last_iov_sb_id = sb_id;
  2406. }
  2407. }
  2408. }
  2409. /* There's a possibility the igu_sb_cnt_iov doesn't properly reflect
  2410. * the number of VF SBs [especially for first VF on engine, as we can't
  2411. * differentiate between empty entries and its entries].
  2412. * Since we don't really support more SBs than VFs today, prevent any
  2413. * such configuration by sanitizing the number of SBs to equal the
  2414. * number of VFs.
  2415. */
  2416. if (IS_PF_SRIOV(p_hwfn)) {
  2417. u16 total_vfs = p_hwfn->cdev->p_iov_info->total_vfs;
  2418. if (total_vfs < p_igu_info->free_blks) {
  2419. DP_VERBOSE(p_hwfn,
  2420. (NETIF_MSG_INTR | QED_MSG_IOV),
  2421. "Limiting number of SBs for IOV - %04x --> %04x\n",
  2422. p_igu_info->free_blks,
  2423. p_hwfn->cdev->p_iov_info->total_vfs);
  2424. p_igu_info->free_blks = total_vfs;
  2425. } else if (total_vfs > p_igu_info->free_blks) {
  2426. DP_NOTICE(p_hwfn,
  2427. "IGU has only %04x SBs for VFs while the device has %04x VFs\n",
  2428. p_igu_info->free_blks, total_vfs);
  2429. return -EINVAL;
  2430. }
  2431. }
  2432. p_igu_info->igu_sb_cnt_iov = p_igu_info->free_blks;
  2433. DP_VERBOSE(
  2434. p_hwfn,
  2435. NETIF_MSG_INTR,
  2436. "IGU igu_base_sb=0x%x [IOV 0x%x] igu_sb_cnt=%d [IOV 0x%x] igu_dsb_id=0x%x\n",
  2437. p_igu_info->igu_base_sb,
  2438. p_igu_info->igu_base_sb_iov,
  2439. p_igu_info->igu_sb_cnt,
  2440. p_igu_info->igu_sb_cnt_iov,
  2441. p_igu_info->igu_dsb_id);
  2442. if (p_igu_info->igu_base_sb == 0xffff ||
  2443. p_igu_info->igu_dsb_id == 0xffff ||
  2444. p_igu_info->igu_sb_cnt == 0) {
  2445. DP_NOTICE(p_hwfn,
  2446. "IGU CAM returned invalid values igu_base_sb=0x%x igu_sb_cnt=%d igu_dsb_id=0x%x\n",
  2447. p_igu_info->igu_base_sb,
  2448. p_igu_info->igu_sb_cnt,
  2449. p_igu_info->igu_dsb_id);
  2450. return -EINVAL;
  2451. }
  2452. return 0;
  2453. }
  2454. /**
  2455. * @brief Initialize igu runtime registers
  2456. *
  2457. * @param p_hwfn
  2458. */
  2459. void qed_int_igu_init_rt(struct qed_hwfn *p_hwfn)
  2460. {
  2461. u32 igu_pf_conf = IGU_PF_CONF_FUNC_EN;
  2462. STORE_RT_REG(p_hwfn, IGU_REG_PF_CONFIGURATION_RT_OFFSET, igu_pf_conf);
  2463. }
  2464. u64 qed_int_igu_read_sisr_reg(struct qed_hwfn *p_hwfn)
  2465. {
  2466. u32 lsb_igu_cmd_addr = IGU_REG_SISR_MDPC_WMASK_LSB_UPPER -
  2467. IGU_CMD_INT_ACK_BASE;
  2468. u32 msb_igu_cmd_addr = IGU_REG_SISR_MDPC_WMASK_MSB_UPPER -
  2469. IGU_CMD_INT_ACK_BASE;
  2470. u32 intr_status_hi = 0, intr_status_lo = 0;
  2471. u64 intr_status = 0;
  2472. intr_status_lo = REG_RD(p_hwfn,
  2473. GTT_BAR0_MAP_REG_IGU_CMD +
  2474. lsb_igu_cmd_addr * 8);
  2475. intr_status_hi = REG_RD(p_hwfn,
  2476. GTT_BAR0_MAP_REG_IGU_CMD +
  2477. msb_igu_cmd_addr * 8);
  2478. intr_status = ((u64)intr_status_hi << 32) + (u64)intr_status_lo;
  2479. return intr_status;
  2480. }
  2481. static void qed_int_sp_dpc_setup(struct qed_hwfn *p_hwfn)
  2482. {
  2483. tasklet_init(p_hwfn->sp_dpc,
  2484. qed_int_sp_dpc, (unsigned long)p_hwfn);
  2485. p_hwfn->b_sp_dpc_enabled = true;
  2486. }
  2487. static int qed_int_sp_dpc_alloc(struct qed_hwfn *p_hwfn)
  2488. {
  2489. p_hwfn->sp_dpc = kmalloc(sizeof(*p_hwfn->sp_dpc), GFP_KERNEL);
  2490. if (!p_hwfn->sp_dpc)
  2491. return -ENOMEM;
  2492. return 0;
  2493. }
  2494. static void qed_int_sp_dpc_free(struct qed_hwfn *p_hwfn)
  2495. {
  2496. kfree(p_hwfn->sp_dpc);
  2497. }
  2498. int qed_int_alloc(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
  2499. {
  2500. int rc = 0;
  2501. rc = qed_int_sp_dpc_alloc(p_hwfn);
  2502. if (rc)
  2503. return rc;
  2504. rc = qed_int_sp_sb_alloc(p_hwfn, p_ptt);
  2505. if (rc)
  2506. return rc;
  2507. rc = qed_int_sb_attn_alloc(p_hwfn, p_ptt);
  2508. return rc;
  2509. }
  2510. void qed_int_free(struct qed_hwfn *p_hwfn)
  2511. {
  2512. qed_int_sp_sb_free(p_hwfn);
  2513. qed_int_sb_attn_free(p_hwfn);
  2514. qed_int_sp_dpc_free(p_hwfn);
  2515. }
  2516. void qed_int_setup(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
  2517. {
  2518. qed_int_sb_setup(p_hwfn, p_ptt, &p_hwfn->p_sp_sb->sb_info);
  2519. qed_int_sb_attn_setup(p_hwfn, p_ptt);
  2520. qed_int_sp_dpc_setup(p_hwfn);
  2521. }
  2522. void qed_int_get_num_sbs(struct qed_hwfn *p_hwfn,
  2523. struct qed_sb_cnt_info *p_sb_cnt_info)
  2524. {
  2525. struct qed_igu_info *info = p_hwfn->hw_info.p_igu_info;
  2526. if (!info || !p_sb_cnt_info)
  2527. return;
  2528. p_sb_cnt_info->sb_cnt = info->igu_sb_cnt;
  2529. p_sb_cnt_info->sb_iov_cnt = info->igu_sb_cnt_iov;
  2530. p_sb_cnt_info->sb_free_blk = info->free_blks;
  2531. }
  2532. u16 qed_int_queue_id_from_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id)
  2533. {
  2534. struct qed_igu_info *p_info = p_hwfn->hw_info.p_igu_info;
  2535. /* Determine origin of SB id */
  2536. if ((sb_id >= p_info->igu_base_sb) &&
  2537. (sb_id < p_info->igu_base_sb + p_info->igu_sb_cnt)) {
  2538. return sb_id - p_info->igu_base_sb;
  2539. } else if ((sb_id >= p_info->igu_base_sb_iov) &&
  2540. (sb_id < p_info->igu_base_sb_iov + p_info->igu_sb_cnt_iov)) {
  2541. /* We want the first VF queue to be adjacent to the
  2542. * last PF queue. Since L2 queues can be partial to
  2543. * SBs, we'll use the feature instead.
  2544. */
  2545. return sb_id - p_info->igu_base_sb_iov +
  2546. FEAT_NUM(p_hwfn, QED_PF_L2_QUE);
  2547. } else {
  2548. DP_NOTICE(p_hwfn, "SB %d not in range for function\n", sb_id);
  2549. return 0;
  2550. }
  2551. }
  2552. void qed_int_disable_post_isr_release(struct qed_dev *cdev)
  2553. {
  2554. int i;
  2555. for_each_hwfn(cdev, i)
  2556. cdev->hwfns[i].b_int_requested = false;
  2557. }
  2558. int qed_int_set_timer_res(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
  2559. u8 timer_res, u16 sb_id, bool tx)
  2560. {
  2561. struct cau_sb_entry sb_entry;
  2562. int rc;
  2563. if (!p_hwfn->hw_init_done) {
  2564. DP_ERR(p_hwfn, "hardware not initialized yet\n");
  2565. return -EINVAL;
  2566. }
  2567. rc = qed_dmae_grc2host(p_hwfn, p_ptt, CAU_REG_SB_VAR_MEMORY +
  2568. sb_id * sizeof(u64),
  2569. (u64)(uintptr_t)&sb_entry, 2, 0);
  2570. if (rc) {
  2571. DP_ERR(p_hwfn, "dmae_grc2host failed %d\n", rc);
  2572. return rc;
  2573. }
  2574. if (tx)
  2575. SET_FIELD(sb_entry.params, CAU_SB_ENTRY_TIMER_RES1, timer_res);
  2576. else
  2577. SET_FIELD(sb_entry.params, CAU_SB_ENTRY_TIMER_RES0, timer_res);
  2578. rc = qed_dmae_host2grc(p_hwfn, p_ptt,
  2579. (u64)(uintptr_t)&sb_entry,
  2580. CAU_REG_SB_VAR_MEMORY +
  2581. sb_id * sizeof(u64), 2, 0);
  2582. if (rc) {
  2583. DP_ERR(p_hwfn, "dmae_host2grc failed %d\n", rc);
  2584. return rc;
  2585. }
  2586. return rc;
  2587. }