qed_int.c 96 KB

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