qed_int.c 97 KB

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