sid.h 107 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462
  1. /*
  2. * Copyright 2011 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: Alex Deucher
  23. */
  24. #ifndef SI_H
  25. #define SI_H
  26. #define TAHITI_RB_BITMAP_WIDTH_PER_SH 2
  27. #define TAHITI_GB_ADDR_CONFIG_GOLDEN 0x12011003
  28. #define VERDE_GB_ADDR_CONFIG_GOLDEN 0x12010002
  29. #define HAINAN_GB_ADDR_CONFIG_GOLDEN 0x02010001
  30. #define SI_MAX_SH_GPRS 256
  31. #define SI_MAX_TEMP_GPRS 16
  32. #define SI_MAX_SH_THREADS 256
  33. #define SI_MAX_SH_STACK_ENTRIES 4096
  34. #define SI_MAX_FRC_EOV_CNT 16384
  35. #define SI_MAX_BACKENDS 8
  36. #define SI_MAX_BACKENDS_MASK 0xFF
  37. #define SI_MAX_BACKENDS_PER_SE_MASK 0x0F
  38. #define SI_MAX_SIMDS 12
  39. #define SI_MAX_SIMDS_MASK 0x0FFF
  40. #define SI_MAX_SIMDS_PER_SE_MASK 0x00FF
  41. #define SI_MAX_PIPES 8
  42. #define SI_MAX_PIPES_MASK 0xFF
  43. #define SI_MAX_PIPES_PER_SIMD_MASK 0x3F
  44. #define SI_MAX_LDS_NUM 0xFFFF
  45. #define SI_MAX_TCC 16
  46. #define SI_MAX_TCC_MASK 0xFFFF
  47. #define AMDGPU_NUM_OF_VMIDS 8
  48. /* SMC IND accessor regs */
  49. #define SMC_IND_INDEX_0 0x80
  50. #define SMC_IND_DATA_0 0x81
  51. #define SMC_IND_ACCESS_CNTL 0x8A
  52. # define AUTO_INCREMENT_IND_0 (1 << 0)
  53. #define SMC_MESSAGE_0 0x8B
  54. #define SMC_RESP_0 0x8C
  55. /* CG IND registers are accessed via SMC indirect space + SMC_CG_IND_START */
  56. #define SMC_CG_IND_START 0xc0030000
  57. #define SMC_CG_IND_END 0xc0040000
  58. #define CG_CGTT_LOCAL_0 0x400
  59. #define CG_CGTT_LOCAL_1 0x401
  60. /* SMC IND registers */
  61. #define SMC_SYSCON_RESET_CNTL 0x80000000
  62. # define RST_REG (1 << 0)
  63. #define SMC_SYSCON_CLOCK_CNTL_0 0x80000004
  64. # define CK_DISABLE (1 << 0)
  65. # define CKEN (1 << 24)
  66. #define VGA_HDP_CONTROL 0xCA
  67. #define VGA_MEMORY_DISABLE (1 << 4)
  68. #define DCCG_DISP_SLOW_SELECT_REG 0x13F
  69. #define DCCG_DISP1_SLOW_SELECT(x) ((x) << 0)
  70. #define DCCG_DISP1_SLOW_SELECT_MASK (7 << 0)
  71. #define DCCG_DISP1_SLOW_SELECT_SHIFT 0
  72. #define DCCG_DISP2_SLOW_SELECT(x) ((x) << 4)
  73. #define DCCG_DISP2_SLOW_SELECT_MASK (7 << 4)
  74. #define DCCG_DISP2_SLOW_SELECT_SHIFT 4
  75. #define CG_SPLL_FUNC_CNTL 0x180
  76. #define SPLL_RESET (1 << 0)
  77. #define SPLL_SLEEP (1 << 1)
  78. #define SPLL_BYPASS_EN (1 << 3)
  79. #define SPLL_REF_DIV(x) ((x) << 4)
  80. #define SPLL_REF_DIV_MASK (0x3f << 4)
  81. #define SPLL_PDIV_A(x) ((x) << 20)
  82. #define SPLL_PDIV_A_MASK (0x7f << 20)
  83. #define SPLL_PDIV_A_SHIFT 20
  84. #define CG_SPLL_FUNC_CNTL_2 0x181
  85. #define SCLK_MUX_SEL(x) ((x) << 0)
  86. #define SCLK_MUX_SEL_MASK (0x1ff << 0)
  87. #define SPLL_CTLREQ_CHG (1 << 23)
  88. #define SCLK_MUX_UPDATE (1 << 26)
  89. #define CG_SPLL_FUNC_CNTL_3 0x182
  90. #define SPLL_FB_DIV(x) ((x) << 0)
  91. #define SPLL_FB_DIV_MASK (0x3ffffff << 0)
  92. #define SPLL_FB_DIV_SHIFT 0
  93. #define SPLL_DITHEN (1 << 28)
  94. #define CG_SPLL_FUNC_CNTL_4 0x183
  95. #define SPLL_STATUS 0x185
  96. #define SPLL_CHG_STATUS (1 << 1)
  97. #define SPLL_CNTL_MODE 0x186
  98. #define SPLL_SW_DIR_CONTROL (1 << 0)
  99. # define SPLL_REFCLK_SEL(x) ((x) << 26)
  100. # define SPLL_REFCLK_SEL_MASK (3 << 26)
  101. #define CG_SPLL_SPREAD_SPECTRUM 0x188
  102. #define SSEN (1 << 0)
  103. #define CLK_S(x) ((x) << 4)
  104. #define CLK_S_MASK (0xfff << 4)
  105. #define CLK_S_SHIFT 4
  106. #define CG_SPLL_SPREAD_SPECTRUM_2 0x189
  107. #define CLK_V(x) ((x) << 0)
  108. #define CLK_V_MASK (0x3ffffff << 0)
  109. #define CLK_V_SHIFT 0
  110. #define CG_SPLL_AUTOSCALE_CNTL 0x18b
  111. # define AUTOSCALE_ON_SS_CLEAR (1 << 9)
  112. /* discrete uvd clocks */
  113. #define CG_UPLL_FUNC_CNTL 0x18d
  114. # define UPLL_RESET_MASK 0x00000001
  115. # define UPLL_SLEEP_MASK 0x00000002
  116. # define UPLL_BYPASS_EN_MASK 0x00000004
  117. # define UPLL_CTLREQ_MASK 0x00000008
  118. # define UPLL_VCO_MODE_MASK 0x00000600
  119. # define UPLL_REF_DIV_MASK 0x003F0000
  120. # define UPLL_CTLACK_MASK 0x40000000
  121. # define UPLL_CTLACK2_MASK 0x80000000
  122. #define CG_UPLL_FUNC_CNTL_2 0x18e
  123. # define UPLL_PDIV_A(x) ((x) << 0)
  124. # define UPLL_PDIV_A_MASK 0x0000007F
  125. # define UPLL_PDIV_B(x) ((x) << 8)
  126. # define UPLL_PDIV_B_MASK 0x00007F00
  127. # define VCLK_SRC_SEL(x) ((x) << 20)
  128. # define VCLK_SRC_SEL_MASK 0x01F00000
  129. # define DCLK_SRC_SEL(x) ((x) << 25)
  130. # define DCLK_SRC_SEL_MASK 0x3E000000
  131. #define CG_UPLL_FUNC_CNTL_3 0x18f
  132. # define UPLL_FB_DIV(x) ((x) << 0)
  133. # define UPLL_FB_DIV_MASK 0x01FFFFFF
  134. #define CG_UPLL_FUNC_CNTL_4 0x191
  135. # define UPLL_SPARE_ISPARE9 0x00020000
  136. #define CG_UPLL_FUNC_CNTL_5 0x192
  137. # define RESET_ANTI_MUX_MASK 0x00000200
  138. #define CG_UPLL_SPREAD_SPECTRUM 0x194
  139. # define SSEN_MASK 0x00000001
  140. #define MPLL_BYPASSCLK_SEL 0x197
  141. # define MPLL_CLKOUT_SEL(x) ((x) << 8)
  142. # define MPLL_CLKOUT_SEL_MASK 0xFF00
  143. #define CG_CLKPIN_CNTL 0x198
  144. # define XTALIN_DIVIDE (1 << 1)
  145. # define BCLK_AS_XCLK (1 << 2)
  146. #define CG_CLKPIN_CNTL_2 0x199
  147. # define FORCE_BIF_REFCLK_EN (1 << 3)
  148. # define MUX_TCLK_TO_XCLK (1 << 8)
  149. #define THM_CLK_CNTL 0x19b
  150. # define CMON_CLK_SEL(x) ((x) << 0)
  151. # define CMON_CLK_SEL_MASK 0xFF
  152. # define TMON_CLK_SEL(x) ((x) << 8)
  153. # define TMON_CLK_SEL_MASK 0xFF00
  154. #define MISC_CLK_CNTL 0x19c
  155. # define DEEP_SLEEP_CLK_SEL(x) ((x) << 0)
  156. # define DEEP_SLEEP_CLK_SEL_MASK 0xFF
  157. # define ZCLK_SEL(x) ((x) << 8)
  158. # define ZCLK_SEL_MASK 0xFF00
  159. #define CG_THERMAL_CTRL 0x1c0
  160. #define DPM_EVENT_SRC(x) ((x) << 0)
  161. #define DPM_EVENT_SRC_MASK (7 << 0)
  162. #define DIG_THERM_DPM(x) ((x) << 14)
  163. #define DIG_THERM_DPM_MASK 0x003FC000
  164. #define DIG_THERM_DPM_SHIFT 14
  165. #define CG_THERMAL_STATUS 0x1c1
  166. #define FDO_PWM_DUTY(x) ((x) << 9)
  167. #define FDO_PWM_DUTY_MASK (0xff << 9)
  168. #define FDO_PWM_DUTY_SHIFT 9
  169. #define CG_THERMAL_INT 0x1c2
  170. #define DIG_THERM_INTH(x) ((x) << 8)
  171. #define DIG_THERM_INTH_MASK 0x0000FF00
  172. #define DIG_THERM_INTH_SHIFT 8
  173. #define DIG_THERM_INTL(x) ((x) << 16)
  174. #define DIG_THERM_INTL_MASK 0x00FF0000
  175. #define DIG_THERM_INTL_SHIFT 16
  176. #define THERM_INT_MASK_HIGH (1 << 24)
  177. #define THERM_INT_MASK_LOW (1 << 25)
  178. #define CG_MULT_THERMAL_CTRL 0x1c4
  179. #define TEMP_SEL(x) ((x) << 20)
  180. #define TEMP_SEL_MASK (0xff << 20)
  181. #define TEMP_SEL_SHIFT 20
  182. #define CG_MULT_THERMAL_STATUS 0x1c5
  183. #define ASIC_MAX_TEMP(x) ((x) << 0)
  184. #define ASIC_MAX_TEMP_MASK 0x000001ff
  185. #define ASIC_MAX_TEMP_SHIFT 0
  186. #define CTF_TEMP(x) ((x) << 9)
  187. #define CTF_TEMP_MASK 0x0003fe00
  188. #define CTF_TEMP_SHIFT 9
  189. #define CG_FDO_CTRL0 0x1d5
  190. #define FDO_STATIC_DUTY(x) ((x) << 0)
  191. #define FDO_STATIC_DUTY_MASK 0x000000FF
  192. #define FDO_STATIC_DUTY_SHIFT 0
  193. #define CG_FDO_CTRL1 0x1d6
  194. #define FMAX_DUTY100(x) ((x) << 0)
  195. #define FMAX_DUTY100_MASK 0x000000FF
  196. #define FMAX_DUTY100_SHIFT 0
  197. #define CG_FDO_CTRL2 0x1d7
  198. #define TMIN(x) ((x) << 0)
  199. #define TMIN_MASK 0x000000FF
  200. #define TMIN_SHIFT 0
  201. #define FDO_PWM_MODE(x) ((x) << 11)
  202. #define FDO_PWM_MODE_MASK (7 << 11)
  203. #define FDO_PWM_MODE_SHIFT 11
  204. #define TACH_PWM_RESP_RATE(x) ((x) << 25)
  205. #define TACH_PWM_RESP_RATE_MASK (0x7f << 25)
  206. #define TACH_PWM_RESP_RATE_SHIFT 25
  207. #define CG_TACH_CTRL 0x1dc
  208. # define EDGE_PER_REV(x) ((x) << 0)
  209. # define EDGE_PER_REV_MASK (0x7 << 0)
  210. # define EDGE_PER_REV_SHIFT 0
  211. # define TARGET_PERIOD(x) ((x) << 3)
  212. # define TARGET_PERIOD_MASK 0xfffffff8
  213. # define TARGET_PERIOD_SHIFT 3
  214. #define CG_TACH_STATUS 0x1dd
  215. # define TACH_PERIOD(x) ((x) << 0)
  216. # define TACH_PERIOD_MASK 0xffffffff
  217. # define TACH_PERIOD_SHIFT 0
  218. #define GENERAL_PWRMGT 0x1e0
  219. # define GLOBAL_PWRMGT_EN (1 << 0)
  220. # define STATIC_PM_EN (1 << 1)
  221. # define THERMAL_PROTECTION_DIS (1 << 2)
  222. # define THERMAL_PROTECTION_TYPE (1 << 3)
  223. # define SW_SMIO_INDEX(x) ((x) << 6)
  224. # define SW_SMIO_INDEX_MASK (1 << 6)
  225. # define SW_SMIO_INDEX_SHIFT 6
  226. # define VOLT_PWRMGT_EN (1 << 10)
  227. # define DYN_SPREAD_SPECTRUM_EN (1 << 23)
  228. #define CG_TPC 0x1e1
  229. #define SCLK_PWRMGT_CNTL 0x1e2
  230. # define SCLK_PWRMGT_OFF (1 << 0)
  231. # define SCLK_LOW_D1 (1 << 1)
  232. # define FIR_RESET (1 << 4)
  233. # define FIR_FORCE_TREND_SEL (1 << 5)
  234. # define FIR_TREND_MODE (1 << 6)
  235. # define DYN_GFX_CLK_OFF_EN (1 << 7)
  236. # define GFX_CLK_FORCE_ON (1 << 8)
  237. # define GFX_CLK_REQUEST_OFF (1 << 9)
  238. # define GFX_CLK_FORCE_OFF (1 << 10)
  239. # define GFX_CLK_OFF_ACPI_D1 (1 << 11)
  240. # define GFX_CLK_OFF_ACPI_D2 (1 << 12)
  241. # define GFX_CLK_OFF_ACPI_D3 (1 << 13)
  242. # define DYN_LIGHT_SLEEP_EN (1 << 14)
  243. #define TARGET_AND_CURRENT_PROFILE_INDEX 0x1e6
  244. # define CURRENT_STATE_INDEX_MASK (0xf << 4)
  245. # define CURRENT_STATE_INDEX_SHIFT 4
  246. #define CG_FTV 0x1ef
  247. #define CG_FFCT_0 0x1f0
  248. # define UTC_0(x) ((x) << 0)
  249. # define UTC_0_MASK (0x3ff << 0)
  250. # define DTC_0(x) ((x) << 10)
  251. # define DTC_0_MASK (0x3ff << 10)
  252. #define CG_BSP 0x1ff
  253. # define BSP(x) ((x) << 0)
  254. # define BSP_MASK (0xffff << 0)
  255. # define BSU(x) ((x) << 16)
  256. # define BSU_MASK (0xf << 16)
  257. #define CG_AT 0x200
  258. # define CG_R(x) ((x) << 0)
  259. # define CG_R_MASK (0xffff << 0)
  260. # define CG_L(x) ((x) << 16)
  261. # define CG_L_MASK (0xffff << 16)
  262. #define CG_GIT 0x201
  263. # define CG_GICST(x) ((x) << 0)
  264. # define CG_GICST_MASK (0xffff << 0)
  265. # define CG_GIPOT(x) ((x) << 16)
  266. # define CG_GIPOT_MASK (0xffff << 16)
  267. #define CG_SSP 0x203
  268. # define SST(x) ((x) << 0)
  269. # define SST_MASK (0xffff << 0)
  270. # define SSTU(x) ((x) << 16)
  271. # define SSTU_MASK (0xf << 16)
  272. #define CG_DISPLAY_GAP_CNTL 0x20a
  273. # define DISP1_GAP(x) ((x) << 0)
  274. # define DISP1_GAP_MASK (3 << 0)
  275. # define DISP2_GAP(x) ((x) << 2)
  276. # define DISP2_GAP_MASK (3 << 2)
  277. # define VBI_TIMER_COUNT(x) ((x) << 4)
  278. # define VBI_TIMER_COUNT_MASK (0x3fff << 4)
  279. # define VBI_TIMER_UNIT(x) ((x) << 20)
  280. # define VBI_TIMER_UNIT_MASK (7 << 20)
  281. # define DISP1_GAP_MCHG(x) ((x) << 24)
  282. # define DISP1_GAP_MCHG_MASK (3 << 24)
  283. # define DISP2_GAP_MCHG(x) ((x) << 26)
  284. # define DISP2_GAP_MCHG_MASK (3 << 26)
  285. #define CG_ULV_CONTROL 0x21e
  286. #define CG_ULV_PARAMETER 0x21f
  287. #define SMC_SCRATCH0 0x221
  288. #define CG_CAC_CTRL 0x22e
  289. # define CAC_WINDOW(x) ((x) << 0)
  290. # define CAC_WINDOW_MASK 0x00ffffff
  291. #define DMIF_ADDR_CONFIG 0x2F5
  292. #define DMIF_ADDR_CALC 0x300
  293. #define PIPE0_DMIF_BUFFER_CONTROL 0x0328
  294. # define DMIF_BUFFERS_ALLOCATED(x) ((x) << 0)
  295. # define DMIF_BUFFERS_ALLOCATED_COMPLETED (1 << 4)
  296. #define SRBM_STATUS 0x394
  297. #define GRBM_RQ_PENDING (1 << 5)
  298. #define VMC_BUSY (1 << 8)
  299. #define MCB_BUSY (1 << 9)
  300. #define MCB_NON_DISPLAY_BUSY (1 << 10)
  301. #define MCC_BUSY (1 << 11)
  302. #define MCD_BUSY (1 << 12)
  303. #define SEM_BUSY (1 << 14)
  304. #define IH_BUSY (1 << 17)
  305. #define SRBM_SOFT_RESET 0x398
  306. #define SOFT_RESET_BIF (1 << 1)
  307. #define SOFT_RESET_DC (1 << 5)
  308. #define SOFT_RESET_DMA1 (1 << 6)
  309. #define SOFT_RESET_GRBM (1 << 8)
  310. #define SOFT_RESET_HDP (1 << 9)
  311. #define SOFT_RESET_IH (1 << 10)
  312. #define SOFT_RESET_MC (1 << 11)
  313. #define SOFT_RESET_ROM (1 << 14)
  314. #define SOFT_RESET_SEM (1 << 15)
  315. #define SOFT_RESET_VMC (1 << 17)
  316. #define SOFT_RESET_DMA (1 << 20)
  317. #define SOFT_RESET_TST (1 << 21)
  318. #define SOFT_RESET_REGBB (1 << 22)
  319. #define SOFT_RESET_ORB (1 << 23)
  320. #define CC_SYS_RB_BACKEND_DISABLE 0x3A0
  321. #define GC_USER_SYS_RB_BACKEND_DISABLE 0x3A1
  322. #define SRBM_READ_ERROR 0x3A6
  323. #define SRBM_INT_CNTL 0x3A8
  324. #define SRBM_INT_ACK 0x3AA
  325. #define SRBM_STATUS2 0x3B1
  326. #define DMA_BUSY (1 << 5)
  327. #define DMA1_BUSY (1 << 6)
  328. #define VM_L2_CNTL 0x500
  329. #define ENABLE_L2_CACHE (1 << 0)
  330. #define ENABLE_L2_FRAGMENT_PROCESSING (1 << 1)
  331. #define L2_CACHE_PTE_ENDIAN_SWAP_MODE(x) ((x) << 2)
  332. #define L2_CACHE_PDE_ENDIAN_SWAP_MODE(x) ((x) << 4)
  333. #define ENABLE_L2_PTE_CACHE_LRU_UPDATE_BY_WRITE (1 << 9)
  334. #define ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE (1 << 10)
  335. #define EFFECTIVE_L2_QUEUE_SIZE(x) (((x) & 7) << 15)
  336. #define CONTEXT1_IDENTITY_ACCESS_MODE(x) (((x) & 3) << 19)
  337. #define VM_L2_CNTL2 0x501
  338. #define INVALIDATE_ALL_L1_TLBS (1 << 0)
  339. #define INVALIDATE_L2_CACHE (1 << 1)
  340. #define INVALIDATE_CACHE_MODE(x) ((x) << 26)
  341. #define INVALIDATE_PTE_AND_PDE_CACHES 0
  342. #define INVALIDATE_ONLY_PTE_CACHES 1
  343. #define INVALIDATE_ONLY_PDE_CACHES 2
  344. #define VM_L2_CNTL3 0x502
  345. #define BANK_SELECT(x) ((x) << 0)
  346. #define L2_CACHE_UPDATE_MODE(x) ((x) << 6)
  347. #define L2_CACHE_BIGK_FRAGMENT_SIZE(x) ((x) << 15)
  348. #define L2_CACHE_BIGK_ASSOCIATIVITY (1 << 20)
  349. #define VM_L2_STATUS 0x503
  350. #define L2_BUSY (1 << 0)
  351. #define VM_CONTEXT0_CNTL 0x504
  352. #define ENABLE_CONTEXT (1 << 0)
  353. #define PAGE_TABLE_DEPTH(x) (((x) & 3) << 1)
  354. #define RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 3)
  355. #define RANGE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 4)
  356. #define DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 6)
  357. #define DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 7)
  358. #define PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 9)
  359. #define PDE0_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 10)
  360. #define VALID_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 12)
  361. #define VALID_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 13)
  362. #define READ_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 15)
  363. #define READ_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 16)
  364. #define WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 18)
  365. #define WRITE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 19)
  366. #define PAGE_TABLE_BLOCK_SIZE(x) (((x) & 0xF) << 24)
  367. #define VM_CONTEXT1_CNTL 0x505
  368. #define VM_CONTEXT0_CNTL2 0x50C
  369. #define VM_CONTEXT1_CNTL2 0x50D
  370. #define VM_CONTEXT8_PAGE_TABLE_BASE_ADDR 0x50E
  371. #define VM_CONTEXT9_PAGE_TABLE_BASE_ADDR 0x50F
  372. #define VM_CONTEXT10_PAGE_TABLE_BASE_ADDR 0x510
  373. #define VM_CONTEXT11_PAGE_TABLE_BASE_ADDR 0x511
  374. #define VM_CONTEXT12_PAGE_TABLE_BASE_ADDR 0x512
  375. #define VM_CONTEXT13_PAGE_TABLE_BASE_ADDR 0x513
  376. #define VM_CONTEXT14_PAGE_TABLE_BASE_ADDR 0x514
  377. #define VM_CONTEXT15_PAGE_TABLE_BASE_ADDR 0x515
  378. #define VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x53f
  379. #define VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x537
  380. #define PROTECTIONS_MASK (0xf << 0)
  381. #define PROTECTIONS_SHIFT 0
  382. /* bit 0: range
  383. * bit 1: pde0
  384. * bit 2: valid
  385. * bit 3: read
  386. * bit 4: write
  387. */
  388. #define MEMORY_CLIENT_ID_MASK (0xff << 12)
  389. #define MEMORY_CLIENT_ID_SHIFT 12
  390. #define MEMORY_CLIENT_RW_MASK (1 << 24)
  391. #define MEMORY_CLIENT_RW_SHIFT 24
  392. #define FAULT_VMID_MASK (0xf << 25)
  393. #define FAULT_VMID_SHIFT 25
  394. #define VM_INVALIDATE_REQUEST 0x51E
  395. #define VM_INVALIDATE_RESPONSE 0x51F
  396. #define VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR 0x546
  397. #define VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR 0x547
  398. #define VM_CONTEXT0_PAGE_TABLE_BASE_ADDR 0x54F
  399. #define VM_CONTEXT1_PAGE_TABLE_BASE_ADDR 0x550
  400. #define VM_CONTEXT2_PAGE_TABLE_BASE_ADDR 0x551
  401. #define VM_CONTEXT3_PAGE_TABLE_BASE_ADDR 0x552
  402. #define VM_CONTEXT4_PAGE_TABLE_BASE_ADDR 0x553
  403. #define VM_CONTEXT5_PAGE_TABLE_BASE_ADDR 0x554
  404. #define VM_CONTEXT6_PAGE_TABLE_BASE_ADDR 0x555
  405. #define VM_CONTEXT7_PAGE_TABLE_BASE_ADDR 0x556
  406. #define VM_CONTEXT0_PAGE_TABLE_START_ADDR 0x557
  407. #define VM_CONTEXT1_PAGE_TABLE_START_ADDR 0x558
  408. #define VM_CONTEXT0_PAGE_TABLE_END_ADDR 0x55F
  409. #define VM_CONTEXT1_PAGE_TABLE_END_ADDR 0x560
  410. #define VM_L2_CG 0x570
  411. #define MC_CG_ENABLE (1 << 18)
  412. #define MC_LS_ENABLE (1 << 19)
  413. #define MC_SHARED_CHMAP 0x801
  414. #define NOOFCHAN_SHIFT 12
  415. #define NOOFCHAN_MASK 0x0000f000
  416. #define MC_SHARED_CHREMAP 0x802
  417. #define MC_VM_FB_LOCATION 0x809
  418. #define MC_VM_AGP_TOP 0x80A
  419. #define MC_VM_AGP_BOT 0x80B
  420. #define MC_VM_AGP_BASE 0x80C
  421. #define MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x80D
  422. #define MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x80E
  423. #define MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x80F
  424. #define MC_VM_MX_L1_TLB_CNTL 0x819
  425. #define ENABLE_L1_TLB (1 << 0)
  426. #define ENABLE_L1_FRAGMENT_PROCESSING (1 << 1)
  427. #define SYSTEM_ACCESS_MODE_PA_ONLY (0 << 3)
  428. #define SYSTEM_ACCESS_MODE_USE_SYS_MAP (1 << 3)
  429. #define SYSTEM_ACCESS_MODE_IN_SYS (2 << 3)
  430. #define SYSTEM_ACCESS_MODE_NOT_IN_SYS (3 << 3)
  431. #define SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU (0 << 5)
  432. #define ENABLE_ADVANCED_DRIVER_MODEL (1 << 6)
  433. #define MC_SHARED_BLACKOUT_CNTL 0x82B
  434. #define MC_HUB_MISC_HUB_CG 0x82E
  435. #define MC_HUB_MISC_VM_CG 0x82F
  436. #define MC_HUB_MISC_SIP_CG 0x830
  437. #define MC_XPB_CLK_GAT 0x91E
  438. #define MC_CITF_MISC_RD_CG 0x992
  439. #define MC_CITF_MISC_WR_CG 0x993
  440. #define MC_CITF_MISC_VM_CG 0x994
  441. #define MC_ARB_RAMCFG 0x9D8
  442. #define NOOFBANK_SHIFT 0
  443. #define NOOFBANK_MASK 0x00000003
  444. #define NOOFRANK_SHIFT 2
  445. #define NOOFRANK_MASK 0x00000004
  446. #define NOOFROWS_SHIFT 3
  447. #define NOOFROWS_MASK 0x00000038
  448. #define NOOFCOLS_SHIFT 6
  449. #define NOOFCOLS_MASK 0x000000C0
  450. #define CHANSIZE_SHIFT 8
  451. #define CHANSIZE_MASK 0x00000100
  452. #define CHANSIZE_OVERRIDE (1 << 11)
  453. #define NOOFGROUPS_SHIFT 12
  454. #define NOOFGROUPS_MASK 0x00001000
  455. #define MC_ARB_DRAM_TIMING 0x9DD
  456. #define MC_ARB_DRAM_TIMING2 0x9DE
  457. #define MC_ARB_BURST_TIME 0xA02
  458. #define STATE0(x) ((x) << 0)
  459. #define STATE0_MASK (0x1f << 0)
  460. #define STATE0_SHIFT 0
  461. #define STATE1(x) ((x) << 5)
  462. #define STATE1_MASK (0x1f << 5)
  463. #define STATE1_SHIFT 5
  464. #define STATE2(x) ((x) << 10)
  465. #define STATE2_MASK (0x1f << 10)
  466. #define STATE2_SHIFT 10
  467. #define STATE3(x) ((x) << 15)
  468. #define STATE3_MASK (0x1f << 15)
  469. #define STATE3_SHIFT 15
  470. #define MC_SEQ_TRAIN_WAKEUP_CNTL 0xA3A
  471. #define TRAIN_DONE_D0 (1 << 30)
  472. #define TRAIN_DONE_D1 (1 << 31)
  473. #define MC_SEQ_SUP_CNTL 0xA32
  474. #define RUN_MASK (1 << 0)
  475. #define MC_SEQ_SUP_PGM 0xA33
  476. #define MC_PMG_AUTO_CMD 0xA34
  477. #define MC_IO_PAD_CNTL_D0 0xA74
  478. #define MEM_FALL_OUT_CMD (1 << 8)
  479. #define MC_SEQ_RAS_TIMING 0xA28
  480. #define MC_SEQ_CAS_TIMING 0xA29
  481. #define MC_SEQ_MISC_TIMING 0xA2A
  482. #define MC_SEQ_MISC_TIMING2 0xA2B
  483. #define MC_SEQ_PMG_TIMING 0xA2C
  484. #define MC_SEQ_RD_CTL_D0 0xA2D
  485. #define MC_SEQ_RD_CTL_D1 0xA2E
  486. #define MC_SEQ_WR_CTL_D0 0xA2F
  487. #define MC_SEQ_WR_CTL_D1 0xA30
  488. #define MC_SEQ_MISC0 0xA80
  489. #define MC_SEQ_MISC0_VEN_ID_SHIFT 8
  490. #define MC_SEQ_MISC0_VEN_ID_MASK 0x00000f00
  491. #define MC_SEQ_MISC0_VEN_ID_VALUE 3
  492. #define MC_SEQ_MISC0_REV_ID_SHIFT 12
  493. #define MC_SEQ_MISC0_REV_ID_MASK 0x0000f000
  494. #define MC_SEQ_MISC0_REV_ID_VALUE 1
  495. #define MC_SEQ_MISC0_GDDR5_SHIFT 28
  496. #define MC_SEQ_MISC0_GDDR5_MASK 0xf0000000
  497. #define MC_SEQ_MISC0_GDDR5_VALUE 5
  498. #define MC_SEQ_MISC1 0xA81
  499. #define MC_SEQ_RESERVE_M 0xA82
  500. #define MC_PMG_CMD_EMRS 0xA83
  501. #define MC_SEQ_IO_DEBUG_INDEX 0xA91
  502. #define MC_SEQ_IO_DEBUG_DATA 0xA92
  503. #define MC_SEQ_MISC5 0xA95
  504. #define MC_SEQ_MISC6 0xA96
  505. #define MC_SEQ_MISC7 0xA99
  506. #define MC_SEQ_RAS_TIMING_LP 0xA9B
  507. #define MC_SEQ_CAS_TIMING_LP 0xA9C
  508. #define MC_SEQ_MISC_TIMING_LP 0xA9D
  509. #define MC_SEQ_MISC_TIMING2_LP 0xA9E
  510. #define MC_SEQ_WR_CTL_D0_LP 0xA9F
  511. #define MC_SEQ_WR_CTL_D1_LP 0xAA0
  512. #define MC_SEQ_PMG_CMD_EMRS_LP 0xAA1
  513. #define MC_SEQ_PMG_CMD_MRS_LP 0xAA2
  514. #define MC_PMG_CMD_MRS 0xAAB
  515. #define MC_SEQ_RD_CTL_D0_LP 0xAC7
  516. #define MC_SEQ_RD_CTL_D1_LP 0xAC8
  517. #define MC_PMG_CMD_MRS1 0xAD1
  518. #define MC_SEQ_PMG_CMD_MRS1_LP 0xAD2
  519. #define MC_SEQ_PMG_TIMING_LP 0xAD3
  520. #define MC_SEQ_WR_CTL_2 0xAD5
  521. #define MC_SEQ_WR_CTL_2_LP 0xAD6
  522. #define MC_PMG_CMD_MRS2 0xAD7
  523. #define MC_SEQ_PMG_CMD_MRS2_LP 0xAD8
  524. #define MCLK_PWRMGT_CNTL 0xAE8
  525. # define DLL_SPEED(x) ((x) << 0)
  526. # define DLL_SPEED_MASK (0x1f << 0)
  527. # define DLL_READY (1 << 6)
  528. # define MC_INT_CNTL (1 << 7)
  529. # define MRDCK0_PDNB (1 << 8)
  530. # define MRDCK1_PDNB (1 << 9)
  531. # define MRDCK0_RESET (1 << 16)
  532. # define MRDCK1_RESET (1 << 17)
  533. # define DLL_READY_READ (1 << 24)
  534. #define DLL_CNTL 0xAE9
  535. # define MRDCK0_BYPASS (1 << 24)
  536. # define MRDCK1_BYPASS (1 << 25)
  537. #define MPLL_CNTL_MODE 0xAEC
  538. # define MPLL_MCLK_SEL (1 << 11)
  539. #define MPLL_FUNC_CNTL 0xAED
  540. #define BWCTRL(x) ((x) << 20)
  541. #define BWCTRL_MASK (0xff << 20)
  542. #define MPLL_FUNC_CNTL_1 0xAEE
  543. #define VCO_MODE(x) ((x) << 0)
  544. #define VCO_MODE_MASK (3 << 0)
  545. #define CLKFRAC(x) ((x) << 4)
  546. #define CLKFRAC_MASK (0xfff << 4)
  547. #define CLKF(x) ((x) << 16)
  548. #define CLKF_MASK (0xfff << 16)
  549. #define MPLL_FUNC_CNTL_2 0xAEF
  550. #define MPLL_AD_FUNC_CNTL 0xAF0
  551. #define YCLK_POST_DIV(x) ((x) << 0)
  552. #define YCLK_POST_DIV_MASK (7 << 0)
  553. #define MPLL_DQ_FUNC_CNTL 0xAF1
  554. #define YCLK_SEL(x) ((x) << 4)
  555. #define YCLK_SEL_MASK (1 << 4)
  556. #define MPLL_SS1 0xAF3
  557. #define CLKV(x) ((x) << 0)
  558. #define CLKV_MASK (0x3ffffff << 0)
  559. #define MPLL_SS2 0xAF4
  560. #define CLKS(x) ((x) << 0)
  561. #define CLKS_MASK (0xfff << 0)
  562. #define HDP_HOST_PATH_CNTL 0xB00
  563. #define CLOCK_GATING_DIS (1 << 23)
  564. #define HDP_NONSURFACE_BASE 0xB01
  565. #define HDP_NONSURFACE_INFO 0xB02
  566. #define HDP_NONSURFACE_SIZE 0xB03
  567. #define HDP_DEBUG0 0xBCC
  568. #define HDP_ADDR_CONFIG 0xBD2
  569. #define HDP_MISC_CNTL 0xBD3
  570. #define HDP_FLUSH_INVALIDATE_CACHE (1 << 0)
  571. #define HDP_MEM_POWER_LS 0xBD4
  572. #define HDP_LS_ENABLE (1 << 0)
  573. #define ATC_MISC_CG 0xCD4
  574. #define IH_RB_CNTL 0xF80
  575. # define IH_RB_ENABLE (1 << 0)
  576. # define IH_IB_SIZE(x) ((x) << 1) /* log2 */
  577. # define IH_RB_FULL_DRAIN_ENABLE (1 << 6)
  578. # define IH_WPTR_WRITEBACK_ENABLE (1 << 8)
  579. # define IH_WPTR_WRITEBACK_TIMER(x) ((x) << 9) /* log2 */
  580. # define IH_WPTR_OVERFLOW_ENABLE (1 << 16)
  581. # define IH_WPTR_OVERFLOW_CLEAR (1 << 31)
  582. #define IH_RB_BASE 0xF81
  583. #define IH_RB_RPTR 0xF82
  584. #define IH_RB_WPTR 0xF83
  585. # define RB_OVERFLOW (1 << 0)
  586. # define WPTR_OFFSET_MASK 0x3fffc
  587. #define IH_RB_WPTR_ADDR_HI 0xF84
  588. #define IH_RB_WPTR_ADDR_LO 0xF85
  589. #define IH_CNTL 0xF86
  590. # define ENABLE_INTR (1 << 0)
  591. # define IH_MC_SWAP(x) ((x) << 1)
  592. # define IH_MC_SWAP_NONE 0
  593. # define IH_MC_SWAP_16BIT 1
  594. # define IH_MC_SWAP_32BIT 2
  595. # define IH_MC_SWAP_64BIT 3
  596. # define RPTR_REARM (1 << 4)
  597. # define MC_WRREQ_CREDIT(x) ((x) << 15)
  598. # define MC_WR_CLEAN_CNT(x) ((x) << 20)
  599. # define MC_VMID(x) ((x) << 25)
  600. #define CONFIG_MEMSIZE 0x150A
  601. #define INTERRUPT_CNTL 0x151A
  602. # define IH_DUMMY_RD_OVERRIDE (1 << 0)
  603. # define IH_DUMMY_RD_EN (1 << 1)
  604. # define IH_REQ_NONSNOOP_EN (1 << 3)
  605. # define GEN_IH_INT_EN (1 << 8)
  606. #define INTERRUPT_CNTL2 0x151B
  607. #define HDP_MEM_COHERENCY_FLUSH_CNTL 0x1520
  608. #define BIF_FB_EN 0x1524
  609. #define FB_READ_EN (1 << 0)
  610. #define FB_WRITE_EN (1 << 1)
  611. #define HDP_REG_COHERENCY_FLUSH_CNTL 0x1528
  612. /* DCE6 ELD audio interface */
  613. #define AZ_F0_CODEC_ENDPOINT_INDEX 0x1780
  614. # define AZ_ENDPOINT_REG_INDEX(x) (((x) & 0xff) << 0)
  615. # define AZ_ENDPOINT_REG_WRITE_EN (1 << 8)
  616. #define AZ_F0_CODEC_ENDPOINT_DATA 0x1781
  617. #define AZ_F0_CODEC_PIN_CONTROL_CHANNEL_SPEAKER 0x25
  618. #define SPEAKER_ALLOCATION(x) (((x) & 0x7f) << 0)
  619. #define SPEAKER_ALLOCATION_MASK (0x7f << 0)
  620. #define SPEAKER_ALLOCATION_SHIFT 0
  621. #define HDMI_CONNECTION (1 << 16)
  622. #define DP_CONNECTION (1 << 17)
  623. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR0 0x28 /* LPCM */
  624. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR1 0x29 /* AC3 */
  625. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR2 0x2A /* MPEG1 */
  626. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR3 0x2B /* MP3 */
  627. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR4 0x2C /* MPEG2 */
  628. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR5 0x2D /* AAC */
  629. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR6 0x2E /* DTS */
  630. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR7 0x2F /* ATRAC */
  631. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR8 0x30 /* one bit audio - leave at 0 (default) */
  632. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR9 0x31 /* Dolby Digital */
  633. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR10 0x32 /* DTS-HD */
  634. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR11 0x33 /* MAT-MLP */
  635. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR12 0x34 /* DTS */
  636. #define AZ_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR13 0x35 /* WMA Pro */
  637. # define MAX_CHANNELS(x) (((x) & 0x7) << 0)
  638. /* max channels minus one. 7 = 8 channels */
  639. # define SUPPORTED_FREQUENCIES(x) (((x) & 0xff) << 8)
  640. # define DESCRIPTOR_BYTE_2(x) (((x) & 0xff) << 16)
  641. # define SUPPORTED_FREQUENCIES_STEREO(x) (((x) & 0xff) << 24) /* LPCM only */
  642. /* SUPPORTED_FREQUENCIES, SUPPORTED_FREQUENCIES_STEREO
  643. * bit0 = 32 kHz
  644. * bit1 = 44.1 kHz
  645. * bit2 = 48 kHz
  646. * bit3 = 88.2 kHz
  647. * bit4 = 96 kHz
  648. * bit5 = 176.4 kHz
  649. * bit6 = 192 kHz
  650. */
  651. #define AZ_F0_CODEC_PIN_CONTROL_RESPONSE_LIPSYNC 0x37
  652. # define VIDEO_LIPSYNC(x) (((x) & 0xff) << 0)
  653. # define AUDIO_LIPSYNC(x) (((x) & 0xff) << 8)
  654. /* VIDEO_LIPSYNC, AUDIO_LIPSYNC
  655. * 0 = invalid
  656. * x = legal delay value
  657. * 255 = sync not supported
  658. */
  659. #define AZ_F0_CODEC_PIN_CONTROL_RESPONSE_HBR 0x38
  660. # define HBR_CAPABLE (1 << 0) /* enabled by default */
  661. #define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO0 0x3a
  662. # define MANUFACTURER_ID(x) (((x) & 0xffff) << 0)
  663. # define PRODUCT_ID(x) (((x) & 0xffff) << 16)
  664. #define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO1 0x3b
  665. # define SINK_DESCRIPTION_LEN(x) (((x) & 0xff) << 0)
  666. #define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO2 0x3c
  667. # define PORT_ID0(x) (((x) & 0xffffffff) << 0)
  668. #define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO3 0x3d
  669. # define PORT_ID1(x) (((x) & 0xffffffff) << 0)
  670. #define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO4 0x3e
  671. # define DESCRIPTION0(x) (((x) & 0xff) << 0)
  672. # define DESCRIPTION1(x) (((x) & 0xff) << 8)
  673. # define DESCRIPTION2(x) (((x) & 0xff) << 16)
  674. # define DESCRIPTION3(x) (((x) & 0xff) << 24)
  675. #define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO5 0x3f
  676. # define DESCRIPTION4(x) (((x) & 0xff) << 0)
  677. # define DESCRIPTION5(x) (((x) & 0xff) << 8)
  678. # define DESCRIPTION6(x) (((x) & 0xff) << 16)
  679. # define DESCRIPTION7(x) (((x) & 0xff) << 24)
  680. #define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO6 0x40
  681. # define DESCRIPTION8(x) (((x) & 0xff) << 0)
  682. # define DESCRIPTION9(x) (((x) & 0xff) << 8)
  683. # define DESCRIPTION10(x) (((x) & 0xff) << 16)
  684. # define DESCRIPTION11(x) (((x) & 0xff) << 24)
  685. #define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO7 0x41
  686. # define DESCRIPTION12(x) (((x) & 0xff) << 0)
  687. # define DESCRIPTION13(x) (((x) & 0xff) << 8)
  688. # define DESCRIPTION14(x) (((x) & 0xff) << 16)
  689. # define DESCRIPTION15(x) (((x) & 0xff) << 24)
  690. #define AZ_F0_CODEC_PIN_CONTROL_SINK_INFO8 0x42
  691. # define DESCRIPTION16(x) (((x) & 0xff) << 0)
  692. # define DESCRIPTION17(x) (((x) & 0xff) << 8)
  693. #define AZ_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL 0x54
  694. # define AUDIO_ENABLED (1 << 31)
  695. #define AZ_F0_CODEC_PIN_CONTROL_RESPONSE_CONFIGURATION_DEFAULT 0x56
  696. #define PORT_CONNECTIVITY_MASK (3 << 30)
  697. #define PORT_CONNECTIVITY_SHIFT 30
  698. #define DC_LB_MEMORY_SPLIT 0x1AC3
  699. #define DC_LB_MEMORY_CONFIG(x) ((x) << 20)
  700. #define PRIORITY_A_CNT 0x1AC6
  701. #define PRIORITY_MARK_MASK 0x7fff
  702. #define PRIORITY_OFF (1 << 16)
  703. #define PRIORITY_ALWAYS_ON (1 << 20)
  704. #define PRIORITY_B_CNT 0x1AC7
  705. #define DPG_PIPE_ARBITRATION_CONTROL3 0x1B32
  706. # define LATENCY_WATERMARK_MASK(x) ((x) << 16)
  707. #define DPG_PIPE_LATENCY_CONTROL 0x1B33
  708. # define LATENCY_LOW_WATERMARK(x) ((x) << 0)
  709. # define LATENCY_HIGH_WATERMARK(x) ((x) << 16)
  710. /* 0x6bb8, 0x77b8, 0x103b8, 0x10fb8, 0x11bb8, 0x127b8 */
  711. #define VLINE_STATUS 0x1AEE
  712. # define VLINE_OCCURRED (1 << 0)
  713. # define VLINE_ACK (1 << 4)
  714. # define VLINE_STAT (1 << 12)
  715. # define VLINE_INTERRUPT (1 << 16)
  716. # define VLINE_INTERRUPT_TYPE (1 << 17)
  717. /* 0x6bbc, 0x77bc, 0x103bc, 0x10fbc, 0x11bbc, 0x127bc */
  718. #define VBLANK_STATUS 0x1AEF
  719. # define VBLANK_OCCURRED (1 << 0)
  720. # define VBLANK_ACK (1 << 4)
  721. # define VBLANK_STAT (1 << 12)
  722. # define VBLANK_INTERRUPT (1 << 16)
  723. # define VBLANK_INTERRUPT_TYPE (1 << 17)
  724. /* 0x6b40, 0x7740, 0x10340, 0x10f40, 0x11b40, 0x12740 */
  725. #define INT_MASK 0x1AD0
  726. # define VBLANK_INT_MASK (1 << 0)
  727. # define VLINE_INT_MASK (1 << 4)
  728. #define DISP_INTERRUPT_STATUS 0x183D
  729. # define LB_D1_VLINE_INTERRUPT (1 << 2)
  730. # define LB_D1_VBLANK_INTERRUPT (1 << 3)
  731. # define DC_HPD1_INTERRUPT (1 << 17)
  732. # define DC_HPD1_RX_INTERRUPT (1 << 18)
  733. # define DACA_AUTODETECT_INTERRUPT (1 << 22)
  734. # define DACB_AUTODETECT_INTERRUPT (1 << 23)
  735. # define DC_I2C_SW_DONE_INTERRUPT (1 << 24)
  736. # define DC_I2C_HW_DONE_INTERRUPT (1 << 25)
  737. #define DISP_INTERRUPT_STATUS_CONTINUE 0x183E
  738. # define LB_D2_VLINE_INTERRUPT (1 << 2)
  739. # define LB_D2_VBLANK_INTERRUPT (1 << 3)
  740. # define DC_HPD2_INTERRUPT (1 << 17)
  741. # define DC_HPD2_RX_INTERRUPT (1 << 18)
  742. # define DISP_TIMER_INTERRUPT (1 << 24)
  743. #define DISP_INTERRUPT_STATUS_CONTINUE2 0x183F
  744. # define LB_D3_VLINE_INTERRUPT (1 << 2)
  745. # define LB_D3_VBLANK_INTERRUPT (1 << 3)
  746. # define DC_HPD3_INTERRUPT (1 << 17)
  747. # define DC_HPD3_RX_INTERRUPT (1 << 18)
  748. #define DISP_INTERRUPT_STATUS_CONTINUE3 0x1840
  749. # define LB_D4_VLINE_INTERRUPT (1 << 2)
  750. # define LB_D4_VBLANK_INTERRUPT (1 << 3)
  751. # define DC_HPD4_INTERRUPT (1 << 17)
  752. # define DC_HPD4_RX_INTERRUPT (1 << 18)
  753. #define DISP_INTERRUPT_STATUS_CONTINUE4 0x1853
  754. # define LB_D5_VLINE_INTERRUPT (1 << 2)
  755. # define LB_D5_VBLANK_INTERRUPT (1 << 3)
  756. # define DC_HPD5_INTERRUPT (1 << 17)
  757. # define DC_HPD5_RX_INTERRUPT (1 << 18)
  758. #define DISP_INTERRUPT_STATUS_CONTINUE5 0x1854
  759. # define LB_D6_VLINE_INTERRUPT (1 << 2)
  760. # define LB_D6_VBLANK_INTERRUPT (1 << 3)
  761. # define DC_HPD6_INTERRUPT (1 << 17)
  762. # define DC_HPD6_RX_INTERRUPT (1 << 18)
  763. /* 0x6858, 0x7458, 0x10058, 0x10c58, 0x11858, 0x12458 */
  764. #define GRPH_INT_STATUS 0x1A16
  765. # define GRPH_PFLIP_INT_OCCURRED (1 << 0)
  766. # define GRPH_PFLIP_INT_CLEAR (1 << 8)
  767. /* 0x685c, 0x745c, 0x1005c, 0x10c5c, 0x1185c, 0x1245c */
  768. #define GRPH_INT_CONTROL 0x1A17
  769. # define GRPH_PFLIP_INT_MASK (1 << 0)
  770. # define GRPH_PFLIP_INT_TYPE (1 << 8)
  771. #define DAC_AUTODETECT_INT_CONTROL 0x19F2
  772. #define DC_HPD1_INT_STATUS 0x1807
  773. #define DC_HPD2_INT_STATUS 0x180A
  774. #define DC_HPD3_INT_STATUS 0x180D
  775. #define DC_HPD4_INT_STATUS 0x1810
  776. #define DC_HPD5_INT_STATUS 0x1813
  777. #define DC_HPD6_INT_STATUS 0x1816
  778. # define DC_HPDx_INT_STATUS (1 << 0)
  779. # define DC_HPDx_SENSE (1 << 1)
  780. # define DC_HPDx_RX_INT_STATUS (1 << 8)
  781. #define DC_HPD1_INT_CONTROL 0x1808
  782. #define DC_HPD2_INT_CONTROL 0x180B
  783. #define DC_HPD3_INT_CONTROL 0x180E
  784. #define DC_HPD4_INT_CONTROL 0x1811
  785. #define DC_HPD5_INT_CONTROL 0x1814
  786. #define DC_HPD6_INT_CONTROL 0x1817
  787. # define DC_HPDx_INT_ACK (1 << 0)
  788. # define DC_HPDx_INT_POLARITY (1 << 8)
  789. # define DC_HPDx_INT_EN (1 << 16)
  790. # define DC_HPDx_RX_INT_ACK (1 << 20)
  791. # define DC_HPDx_RX_INT_EN (1 << 24)
  792. #define DC_HPD1_CONTROL 0x1809
  793. #define DC_HPD2_CONTROL 0x180C
  794. #define DC_HPD3_CONTROL 0x180F
  795. #define DC_HPD4_CONTROL 0x1812
  796. #define DC_HPD5_CONTROL 0x1815
  797. #define DC_HPD6_CONTROL 0x1818
  798. # define DC_HPDx_CONNECTION_TIMER(x) ((x) << 0)
  799. # define DC_HPDx_RX_INT_TIMER(x) ((x) << 16)
  800. # define DC_HPDx_EN (1 << 28)
  801. #define DPG_PIPE_STUTTER_CONTROL 0x1B35
  802. # define STUTTER_ENABLE (1 << 0)
  803. /* 0x6e98, 0x7a98, 0x10698, 0x11298, 0x11e98, 0x12a98 */
  804. #define CRTC_STATUS_FRAME_COUNT 0x1BA6
  805. /* Audio clocks */
  806. #define DCCG_AUDIO_DTO_SOURCE 0x05ac
  807. # define DCCG_AUDIO_DTO0_SOURCE_SEL(x) ((x) << 0) /* crtc0 - crtc5 */
  808. # define DCCG_AUDIO_DTO_SEL (1 << 4) /* 0=dto0 1=dto1 */
  809. #define DCCG_AUDIO_DTO0_PHASE 0x05b0
  810. #define DCCG_AUDIO_DTO0_MODULE 0x05b4
  811. #define DCCG_AUDIO_DTO1_PHASE 0x05c0
  812. #define DCCG_AUDIO_DTO1_MODULE 0x05c4
  813. #define AFMT_AUDIO_SRC_CONTROL 0x1c4f
  814. #define AFMT_AUDIO_SRC_SELECT(x) (((x) & 7) << 0)
  815. /* AFMT_AUDIO_SRC_SELECT
  816. * 0 = stream0
  817. * 1 = stream1
  818. * 2 = stream2
  819. * 3 = stream3
  820. * 4 = stream4
  821. * 5 = stream5
  822. */
  823. #define GRBM_CNTL 0x2000
  824. #define GRBM_READ_TIMEOUT(x) ((x) << 0)
  825. #define GRBM_STATUS2 0x2002
  826. #define RLC_RQ_PENDING (1 << 0)
  827. #define RLC_BUSY (1 << 8)
  828. #define TC_BUSY (1 << 9)
  829. #define GRBM_STATUS 0x2004
  830. #define CMDFIFO_AVAIL_MASK 0x0000000F
  831. #define RING2_RQ_PENDING (1 << 4)
  832. #define SRBM_RQ_PENDING (1 << 5)
  833. #define RING1_RQ_PENDING (1 << 6)
  834. #define CF_RQ_PENDING (1 << 7)
  835. #define PF_RQ_PENDING (1 << 8)
  836. #define GDS_DMA_RQ_PENDING (1 << 9)
  837. #define GRBM_EE_BUSY (1 << 10)
  838. #define DB_CLEAN (1 << 12)
  839. #define CB_CLEAN (1 << 13)
  840. #define TA_BUSY (1 << 14)
  841. #define GDS_BUSY (1 << 15)
  842. #define VGT_BUSY (1 << 17)
  843. #define IA_BUSY_NO_DMA (1 << 18)
  844. #define IA_BUSY (1 << 19)
  845. #define SX_BUSY (1 << 20)
  846. #define SPI_BUSY (1 << 22)
  847. #define BCI_BUSY (1 << 23)
  848. #define SC_BUSY (1 << 24)
  849. #define PA_BUSY (1 << 25)
  850. #define DB_BUSY (1 << 26)
  851. #define CP_COHERENCY_BUSY (1 << 28)
  852. #define CP_BUSY (1 << 29)
  853. #define CB_BUSY (1 << 30)
  854. #define GUI_ACTIVE (1 << 31)
  855. #define GRBM_STATUS_SE0 0x2005
  856. #define GRBM_STATUS_SE1 0x2006
  857. #define SE_DB_CLEAN (1 << 1)
  858. #define SE_CB_CLEAN (1 << 2)
  859. #define SE_BCI_BUSY (1 << 22)
  860. #define SE_VGT_BUSY (1 << 23)
  861. #define SE_PA_BUSY (1 << 24)
  862. #define SE_TA_BUSY (1 << 25)
  863. #define SE_SX_BUSY (1 << 26)
  864. #define SE_SPI_BUSY (1 << 27)
  865. #define SE_SC_BUSY (1 << 29)
  866. #define SE_DB_BUSY (1 << 30)
  867. #define SE_CB_BUSY (1 << 31)
  868. #define GRBM_SOFT_RESET 0x2008
  869. #define SOFT_RESET_CP (1 << 0)
  870. #define SOFT_RESET_CB (1 << 1)
  871. #define SOFT_RESET_RLC (1 << 2)
  872. #define SOFT_RESET_DB (1 << 3)
  873. #define SOFT_RESET_GDS (1 << 4)
  874. #define SOFT_RESET_PA (1 << 5)
  875. #define SOFT_RESET_SC (1 << 6)
  876. #define SOFT_RESET_BCI (1 << 7)
  877. #define SOFT_RESET_SPI (1 << 8)
  878. #define SOFT_RESET_SX (1 << 10)
  879. #define SOFT_RESET_TC (1 << 11)
  880. #define SOFT_RESET_TA (1 << 12)
  881. #define SOFT_RESET_VGT (1 << 14)
  882. #define SOFT_RESET_IA (1 << 15)
  883. #define GRBM_GFX_INDEX 0x200B
  884. #define INSTANCE_INDEX(x) ((x) << 0)
  885. #define SH_INDEX(x) ((x) << 8)
  886. #define SE_INDEX(x) ((x) << 16)
  887. #define SH_BROADCAST_WRITES (1 << 29)
  888. #define INSTANCE_BROADCAST_WRITES (1 << 30)
  889. #define SE_BROADCAST_WRITES (1 << 31)
  890. #define GRBM_INT_CNTL 0x2018
  891. # define RDERR_INT_ENABLE (1 << 0)
  892. # define GUI_IDLE_INT_ENABLE (1 << 19)
  893. #define CP_STRMOUT_CNTL 0x213F
  894. #define SCRATCH_REG0 0x2140
  895. #define SCRATCH_REG1 0x2141
  896. #define SCRATCH_REG2 0x2142
  897. #define SCRATCH_REG3 0x2143
  898. #define SCRATCH_REG4 0x2144
  899. #define SCRATCH_REG5 0x2145
  900. #define SCRATCH_REG6 0x2146
  901. #define SCRATCH_REG7 0x2147
  902. #define SCRATCH_UMSK 0x2150
  903. #define SCRATCH_ADDR 0x2151
  904. #define CP_SEM_WAIT_TIMER 0x216F
  905. #define CP_SEM_INCOMPLETE_TIMER_CNTL 0x2172
  906. #define CP_ME_CNTL 0x21B6
  907. #define CP_CE_HALT (1 << 24)
  908. #define CP_PFP_HALT (1 << 26)
  909. #define CP_ME_HALT (1 << 28)
  910. #define CP_COHER_CNTL2 0x217A
  911. #define CP_RB2_RPTR 0x21BE
  912. #define CP_RB1_RPTR 0x21BF
  913. #define CP_RB0_RPTR 0x21C0
  914. #define CP_RB_WPTR_DELAY 0x21C1
  915. #define CP_QUEUE_THRESHOLDS 0x21D8
  916. #define ROQ_IB1_START(x) ((x) << 0)
  917. #define ROQ_IB2_START(x) ((x) << 8)
  918. #define CP_MEQ_THRESHOLDS 0x21D9
  919. #define MEQ1_START(x) ((x) << 0)
  920. #define MEQ2_START(x) ((x) << 8)
  921. #define CP_PERFMON_CNTL 0x21FF
  922. #define VGT_VTX_VECT_EJECT_REG 0x222C
  923. #define VGT_CACHE_INVALIDATION 0x2231
  924. #define CACHE_INVALIDATION(x) ((x) << 0)
  925. #define VC_ONLY 0
  926. #define TC_ONLY 1
  927. #define VC_AND_TC 2
  928. #define AUTO_INVLD_EN(x) ((x) << 6)
  929. #define NO_AUTO 0
  930. #define ES_AUTO 1
  931. #define GS_AUTO 2
  932. #define ES_AND_GS_AUTO 3
  933. #define VGT_ESGS_RING_SIZE 0x2232
  934. #define VGT_GSVS_RING_SIZE 0x2233
  935. #define VGT_GS_VERTEX_REUSE 0x2235
  936. #define VGT_PRIMITIVE_TYPE 0x2256
  937. #define VGT_INDEX_TYPE 0x2257
  938. #define VGT_NUM_INDICES 0x225C
  939. #define VGT_NUM_INSTANCES 0x225D
  940. #define VGT_TF_RING_SIZE 0x2262
  941. #define VGT_HS_OFFCHIP_PARAM 0x226C
  942. #define VGT_TF_MEMORY_BASE 0x226E
  943. #define CC_GC_SHADER_ARRAY_CONFIG 0x226F
  944. #define INACTIVE_CUS_MASK 0xFFFF0000
  945. #define INACTIVE_CUS_SHIFT 16
  946. #define GC_USER_SHADER_ARRAY_CONFIG 0x2270
  947. #define PA_CL_ENHANCE 0x2285
  948. #define CLIP_VTX_REORDER_ENA (1 << 0)
  949. #define NUM_CLIP_SEQ(x) ((x) << 1)
  950. #define PA_SU_LINE_STIPPLE_VALUE 0x2298
  951. #define PA_SC_LINE_STIPPLE_STATE 0x22C4
  952. #define PA_SC_FORCE_EOV_MAX_CNTS 0x22C9
  953. #define FORCE_EOV_MAX_CLK_CNT(x) ((x) << 0)
  954. #define FORCE_EOV_MAX_REZ_CNT(x) ((x) << 16)
  955. #define PA_SC_FIFO_SIZE 0x22F3
  956. #define SC_FRONTEND_PRIM_FIFO_SIZE(x) ((x) << 0)
  957. #define SC_BACKEND_PRIM_FIFO_SIZE(x) ((x) << 6)
  958. #define SC_HIZ_TILE_FIFO_SIZE(x) ((x) << 15)
  959. #define SC_EARLYZ_TILE_FIFO_SIZE(x) ((x) << 23)
  960. #define PA_SC_ENHANCE 0x22FC
  961. #define SQ_CONFIG 0x2300
  962. #define SQC_CACHES 0x2302
  963. #define SQ_POWER_THROTTLE 0x2396
  964. #define MIN_POWER(x) ((x) << 0)
  965. #define MIN_POWER_MASK (0x3fff << 0)
  966. #define MIN_POWER_SHIFT 0
  967. #define MAX_POWER(x) ((x) << 16)
  968. #define MAX_POWER_MASK (0x3fff << 16)
  969. #define MAX_POWER_SHIFT 0
  970. #define SQ_POWER_THROTTLE2 0x2397
  971. #define MAX_POWER_DELTA(x) ((x) << 0)
  972. #define MAX_POWER_DELTA_MASK (0x3fff << 0)
  973. #define MAX_POWER_DELTA_SHIFT 0
  974. #define STI_SIZE(x) ((x) << 16)
  975. #define STI_SIZE_MASK (0x3ff << 16)
  976. #define STI_SIZE_SHIFT 16
  977. #define LTI_RATIO(x) ((x) << 27)
  978. #define LTI_RATIO_MASK (0xf << 27)
  979. #define LTI_RATIO_SHIFT 27
  980. #define SX_DEBUG_1 0x2418
  981. #define SPI_STATIC_THREAD_MGMT_1 0x2438
  982. #define SPI_STATIC_THREAD_MGMT_2 0x2439
  983. #define SPI_STATIC_THREAD_MGMT_3 0x243A
  984. #define SPI_PS_MAX_WAVE_ID 0x243B
  985. #define SPI_CONFIG_CNTL 0x2440
  986. #define SPI_CONFIG_CNTL_1 0x244F
  987. #define VTX_DONE_DELAY(x) ((x) << 0)
  988. #define INTERP_ONE_PRIM_PER_ROW (1 << 4)
  989. #define CGTS_TCC_DISABLE 0x2452
  990. #define CGTS_USER_TCC_DISABLE 0x2453
  991. #define TCC_DISABLE_MASK 0xFFFF0000
  992. #define TCC_DISABLE_SHIFT 16
  993. #define CGTS_SM_CTRL_REG 0x2454
  994. #define OVERRIDE (1 << 21)
  995. #define LS_OVERRIDE (1 << 22)
  996. #define SPI_LB_CU_MASK 0x24D5
  997. #define TA_CNTL_AUX 0x2542
  998. #define CC_RB_BACKEND_DISABLE 0x263D
  999. #define BACKEND_DISABLE(x) ((x) << 16)
  1000. #define GB_ADDR_CONFIG 0x263E
  1001. #define NUM_PIPES(x) ((x) << 0)
  1002. #define NUM_PIPES_MASK 0x00000007
  1003. #define NUM_PIPES_SHIFT 0
  1004. #define PIPE_INTERLEAVE_SIZE(x) ((x) << 4)
  1005. #define PIPE_INTERLEAVE_SIZE_MASK 0x00000070
  1006. #define PIPE_INTERLEAVE_SIZE_SHIFT 4
  1007. #define NUM_SHADER_ENGINES(x) ((x) << 12)
  1008. #define NUM_SHADER_ENGINES_MASK 0x00003000
  1009. #define NUM_SHADER_ENGINES_SHIFT 12
  1010. #define SHADER_ENGINE_TILE_SIZE(x) ((x) << 16)
  1011. #define SHADER_ENGINE_TILE_SIZE_MASK 0x00070000
  1012. #define SHADER_ENGINE_TILE_SIZE_SHIFT 16
  1013. #define NUM_GPUS(x) ((x) << 20)
  1014. #define NUM_GPUS_MASK 0x00700000
  1015. #define NUM_GPUS_SHIFT 20
  1016. #define MULTI_GPU_TILE_SIZE(x) ((x) << 24)
  1017. #define MULTI_GPU_TILE_SIZE_MASK 0x03000000
  1018. #define MULTI_GPU_TILE_SIZE_SHIFT 24
  1019. #define ROW_SIZE(x) ((x) << 28)
  1020. #define ROW_SIZE_MASK 0x30000000
  1021. #define ROW_SIZE_SHIFT 28
  1022. #define GB_TILE_MODE0 0x2644
  1023. # define MICRO_TILE_MODE(x) ((x) << 0)
  1024. # define ADDR_SURF_DISPLAY_MICRO_TILING 0
  1025. # define ADDR_SURF_THIN_MICRO_TILING 1
  1026. # define ADDR_SURF_DEPTH_MICRO_TILING 2
  1027. # define ARRAY_MODE(x) ((x) << 2)
  1028. # define ARRAY_LINEAR_GENERAL 0
  1029. # define ARRAY_LINEAR_ALIGNED 1
  1030. # define ARRAY_1D_TILED_THIN1 2
  1031. # define ARRAY_2D_TILED_THIN1 4
  1032. # define PIPE_CONFIG(x) ((x) << 6)
  1033. # define ADDR_SURF_P2 0
  1034. # define ADDR_SURF_P4_8x16 4
  1035. # define ADDR_SURF_P4_16x16 5
  1036. # define ADDR_SURF_P4_16x32 6
  1037. # define ADDR_SURF_P4_32x32 7
  1038. # define ADDR_SURF_P8_16x16_8x16 8
  1039. # define ADDR_SURF_P8_16x32_8x16 9
  1040. # define ADDR_SURF_P8_32x32_8x16 10
  1041. # define ADDR_SURF_P8_16x32_16x16 11
  1042. # define ADDR_SURF_P8_32x32_16x16 12
  1043. # define ADDR_SURF_P8_32x32_16x32 13
  1044. # define ADDR_SURF_P8_32x64_32x32 14
  1045. # define TILE_SPLIT(x) ((x) << 11)
  1046. # define ADDR_SURF_TILE_SPLIT_64B 0
  1047. # define ADDR_SURF_TILE_SPLIT_128B 1
  1048. # define ADDR_SURF_TILE_SPLIT_256B 2
  1049. # define ADDR_SURF_TILE_SPLIT_512B 3
  1050. # define ADDR_SURF_TILE_SPLIT_1KB 4
  1051. # define ADDR_SURF_TILE_SPLIT_2KB 5
  1052. # define ADDR_SURF_TILE_SPLIT_4KB 6
  1053. # define BANK_WIDTH(x) ((x) << 14)
  1054. # define ADDR_SURF_BANK_WIDTH_1 0
  1055. # define ADDR_SURF_BANK_WIDTH_2 1
  1056. # define ADDR_SURF_BANK_WIDTH_4 2
  1057. # define ADDR_SURF_BANK_WIDTH_8 3
  1058. # define BANK_HEIGHT(x) ((x) << 16)
  1059. # define ADDR_SURF_BANK_HEIGHT_1 0
  1060. # define ADDR_SURF_BANK_HEIGHT_2 1
  1061. # define ADDR_SURF_BANK_HEIGHT_4 2
  1062. # define ADDR_SURF_BANK_HEIGHT_8 3
  1063. # define MACRO_TILE_ASPECT(x) ((x) << 18)
  1064. # define ADDR_SURF_MACRO_ASPECT_1 0
  1065. # define ADDR_SURF_MACRO_ASPECT_2 1
  1066. # define ADDR_SURF_MACRO_ASPECT_4 2
  1067. # define ADDR_SURF_MACRO_ASPECT_8 3
  1068. # define NUM_BANKS(x) ((x) << 20)
  1069. # define ADDR_SURF_2_BANK 0
  1070. # define ADDR_SURF_4_BANK 1
  1071. # define ADDR_SURF_8_BANK 2
  1072. # define ADDR_SURF_16_BANK 3
  1073. #define GB_TILE_MODE1 0x2645
  1074. #define GB_TILE_MODE2 0x2646
  1075. #define GB_TILE_MODE3 0x2647
  1076. #define GB_TILE_MODE4 0x2648
  1077. #define GB_TILE_MODE5 0x2649
  1078. #define GB_TILE_MODE6 0x264a
  1079. #define GB_TILE_MODE7 0x264b
  1080. #define GB_TILE_MODE8 0x264c
  1081. #define GB_TILE_MODE9 0x264d
  1082. #define GB_TILE_MODE10 0x264e
  1083. #define GB_TILE_MODE11 0x264f
  1084. #define GB_TILE_MODE12 0x2650
  1085. #define GB_TILE_MODE13 0x2651
  1086. #define GB_TILE_MODE14 0x2652
  1087. #define GB_TILE_MODE15 0x2653
  1088. #define GB_TILE_MODE16 0x2654
  1089. #define GB_TILE_MODE17 0x2655
  1090. #define GB_TILE_MODE18 0x2656
  1091. #define GB_TILE_MODE19 0x2657
  1092. #define GB_TILE_MODE20 0x2658
  1093. #define GB_TILE_MODE21 0x2659
  1094. #define GB_TILE_MODE22 0x265a
  1095. #define GB_TILE_MODE23 0x265b
  1096. #define GB_TILE_MODE24 0x265c
  1097. #define GB_TILE_MODE25 0x265d
  1098. #define GB_TILE_MODE26 0x265e
  1099. #define GB_TILE_MODE27 0x265f
  1100. #define GB_TILE_MODE28 0x2660
  1101. #define GB_TILE_MODE29 0x2661
  1102. #define GB_TILE_MODE30 0x2662
  1103. #define GB_TILE_MODE31 0x2663
  1104. #define CB_PERFCOUNTER0_SELECT0 0x2688
  1105. #define CB_PERFCOUNTER0_SELECT1 0x2689
  1106. #define CB_PERFCOUNTER1_SELECT0 0x268A
  1107. #define CB_PERFCOUNTER1_SELECT1 0x268B
  1108. #define CB_PERFCOUNTER2_SELECT0 0x268C
  1109. #define CB_PERFCOUNTER2_SELECT1 0x268D
  1110. #define CB_PERFCOUNTER3_SELECT0 0x268E
  1111. #define CB_PERFCOUNTER3_SELECT1 0x268F
  1112. #define CB_CGTT_SCLK_CTRL 0x2698
  1113. #define GC_USER_RB_BACKEND_DISABLE 0x26DF
  1114. #define BACKEND_DISABLE_MASK 0x00FF0000
  1115. #define BACKEND_DISABLE_SHIFT 16
  1116. #define TCP_CHAN_STEER_LO 0x2B03
  1117. #define TCP_CHAN_STEER_HI 0x2B94
  1118. #define CP_RB0_BASE 0x3040
  1119. #define CP_RB0_CNTL 0x3041
  1120. #define RB_BUFSZ(x) ((x) << 0)
  1121. #define RB_BLKSZ(x) ((x) << 8)
  1122. #define BUF_SWAP_32BIT (2 << 16)
  1123. #define RB_NO_UPDATE (1 << 27)
  1124. #define RB_RPTR_WR_ENA (1 << 31)
  1125. #define CP_RB0_RPTR_ADDR 0x3043
  1126. #define CP_RB0_RPTR_ADDR_HI 0x3044
  1127. #define CP_RB0_WPTR 0x3045
  1128. #define CP_PFP_UCODE_ADDR 0x3054
  1129. #define CP_PFP_UCODE_DATA 0x3055
  1130. #define CP_ME_RAM_RADDR 0x3056
  1131. #define CP_ME_RAM_WADDR 0x3057
  1132. #define CP_ME_RAM_DATA 0x3058
  1133. #define CP_CE_UCODE_ADDR 0x305A
  1134. #define CP_CE_UCODE_DATA 0x305B
  1135. #define CP_RB1_BASE 0x3060
  1136. #define CP_RB1_CNTL 0x3061
  1137. #define CP_RB1_RPTR_ADDR 0x3062
  1138. #define CP_RB1_RPTR_ADDR_HI 0x3063
  1139. #define CP_RB1_WPTR 0x3064
  1140. #define CP_RB2_BASE 0x3065
  1141. #define CP_RB2_CNTL 0x3066
  1142. #define CP_RB2_RPTR_ADDR 0x3067
  1143. #define CP_RB2_RPTR_ADDR_HI 0x3068
  1144. #define CP_RB2_WPTR 0x3069
  1145. #define CP_INT_CNTL_RING0 0x306A
  1146. #define CP_INT_CNTL_RING1 0x306B
  1147. #define CP_INT_CNTL_RING2 0x306C
  1148. # define CNTX_BUSY_INT_ENABLE (1 << 19)
  1149. # define CNTX_EMPTY_INT_ENABLE (1 << 20)
  1150. # define WAIT_MEM_SEM_INT_ENABLE (1 << 21)
  1151. # define TIME_STAMP_INT_ENABLE (1 << 26)
  1152. # define CP_RINGID2_INT_ENABLE (1 << 29)
  1153. # define CP_RINGID1_INT_ENABLE (1 << 30)
  1154. # define CP_RINGID0_INT_ENABLE (1 << 31)
  1155. #define CP_INT_STATUS_RING0 0x306D
  1156. #define CP_INT_STATUS_RING1 0x306E
  1157. #define CP_INT_STATUS_RING2 0x306F
  1158. # define WAIT_MEM_SEM_INT_STAT (1 << 21)
  1159. # define TIME_STAMP_INT_STAT (1 << 26)
  1160. # define CP_RINGID2_INT_STAT (1 << 29)
  1161. # define CP_RINGID1_INT_STAT (1 << 30)
  1162. # define CP_RINGID0_INT_STAT (1 << 31)
  1163. #define CP_MEM_SLP_CNTL 0x3079
  1164. # define CP_MEM_LS_EN (1 << 0)
  1165. #define CP_DEBUG 0x307F
  1166. #define RLC_CNTL 0x30C0
  1167. # define RLC_ENABLE (1 << 0)
  1168. #define RLC_RL_BASE 0x30C1
  1169. #define RLC_RL_SIZE 0x30C2
  1170. #define RLC_LB_CNTL 0x30C3
  1171. # define LOAD_BALANCE_ENABLE (1 << 0)
  1172. #define RLC_SAVE_AND_RESTORE_BASE 0x30C4
  1173. #define RLC_LB_CNTR_MAX 0x30C5
  1174. #define RLC_LB_CNTR_INIT 0x30C6
  1175. #define RLC_CLEAR_STATE_RESTORE_BASE 0x30C8
  1176. #define RLC_UCODE_ADDR 0x30CB
  1177. #define RLC_UCODE_DATA 0x30CC
  1178. #define RLC_GPU_CLOCK_COUNT_LSB 0x30CE
  1179. #define RLC_GPU_CLOCK_COUNT_MSB 0x30CF
  1180. #define RLC_CAPTURE_GPU_CLOCK_COUNT 0x30D0
  1181. #define RLC_MC_CNTL 0x30D1
  1182. #define RLC_UCODE_CNTL 0x30D2
  1183. #define RLC_STAT 0x30D3
  1184. # define RLC_BUSY_STATUS (1 << 0)
  1185. # define GFX_POWER_STATUS (1 << 1)
  1186. # define GFX_CLOCK_STATUS (1 << 2)
  1187. # define GFX_LS_STATUS (1 << 3)
  1188. #define RLC_PG_CNTL 0x30D7
  1189. # define GFX_PG_ENABLE (1 << 0)
  1190. # define GFX_PG_SRC (1 << 1)
  1191. #define RLC_CGTT_MGCG_OVERRIDE 0x3100
  1192. #define RLC_CGCG_CGLS_CTRL 0x3101
  1193. # define CGCG_EN (1 << 0)
  1194. # define CGLS_EN (1 << 1)
  1195. #define RLC_TTOP_D 0x3105
  1196. # define RLC_PUD(x) ((x) << 0)
  1197. # define RLC_PUD_MASK (0xff << 0)
  1198. # define RLC_PDD(x) ((x) << 8)
  1199. # define RLC_PDD_MASK (0xff << 8)
  1200. # define RLC_TTPD(x) ((x) << 16)
  1201. # define RLC_TTPD_MASK (0xff << 16)
  1202. # define RLC_MSD(x) ((x) << 24)
  1203. # define RLC_MSD_MASK (0xff << 24)
  1204. #define RLC_LB_INIT_CU_MASK 0x3107
  1205. #define RLC_PG_AO_CU_MASK 0x310B
  1206. #define RLC_MAX_PG_CU 0x310C
  1207. # define MAX_PU_CU(x) ((x) << 0)
  1208. # define MAX_PU_CU_MASK (0xff << 0)
  1209. #define RLC_AUTO_PG_CTRL 0x310C
  1210. # define AUTO_PG_EN (1 << 0)
  1211. # define GRBM_REG_SGIT(x) ((x) << 3)
  1212. # define GRBM_REG_SGIT_MASK (0xffff << 3)
  1213. # define PG_AFTER_GRBM_REG_ST(x) ((x) << 19)
  1214. # define PG_AFTER_GRBM_REG_ST_MASK (0x1fff << 19)
  1215. #define RLC_SERDES_WR_MASTER_MASK_0 0x3115
  1216. #define RLC_SERDES_WR_MASTER_MASK_1 0x3116
  1217. #define RLC_SERDES_WR_CTRL 0x3117
  1218. #define RLC_SERDES_MASTER_BUSY_0 0x3119
  1219. #define RLC_SERDES_MASTER_BUSY_1 0x311A
  1220. #define RLC_GCPM_GENERAL_3 0x311E
  1221. #define DB_RENDER_CONTROL 0xA000
  1222. #define DB_DEPTH_INFO 0xA00F
  1223. #define PA_SC_RASTER_CONFIG 0xA0D4
  1224. # define RB_MAP_PKR0(x) ((x) << 0)
  1225. # define RB_MAP_PKR0_MASK (0x3 << 0)
  1226. # define RB_MAP_PKR1(x) ((x) << 2)
  1227. # define RB_MAP_PKR1_MASK (0x3 << 2)
  1228. # define RASTER_CONFIG_RB_MAP_0 0
  1229. # define RASTER_CONFIG_RB_MAP_1 1
  1230. # define RASTER_CONFIG_RB_MAP_2 2
  1231. # define RASTER_CONFIG_RB_MAP_3 3
  1232. # define RB_XSEL2(x) ((x) << 4)
  1233. # define RB_XSEL2_MASK (0x3 << 4)
  1234. # define RB_XSEL (1 << 6)
  1235. # define RB_YSEL (1 << 7)
  1236. # define PKR_MAP(x) ((x) << 8)
  1237. # define PKR_MAP_MASK (0x3 << 8)
  1238. # define RASTER_CONFIG_PKR_MAP_0 0
  1239. # define RASTER_CONFIG_PKR_MAP_1 1
  1240. # define RASTER_CONFIG_PKR_MAP_2 2
  1241. # define RASTER_CONFIG_PKR_MAP_3 3
  1242. # define PKR_XSEL(x) ((x) << 10)
  1243. # define PKR_XSEL_MASK (0x3 << 10)
  1244. # define PKR_YSEL(x) ((x) << 12)
  1245. # define PKR_YSEL_MASK (0x3 << 12)
  1246. # define SC_MAP(x) ((x) << 16)
  1247. # define SC_MAP_MASK (0x3 << 16)
  1248. # define SC_XSEL(x) ((x) << 18)
  1249. # define SC_XSEL_MASK (0x3 << 18)
  1250. # define SC_YSEL(x) ((x) << 20)
  1251. # define SC_YSEL_MASK (0x3 << 20)
  1252. # define SE_MAP(x) ((x) << 24)
  1253. # define SE_MAP_MASK (0x3 << 24)
  1254. # define RASTER_CONFIG_SE_MAP_0 0
  1255. # define RASTER_CONFIG_SE_MAP_1 1
  1256. # define RASTER_CONFIG_SE_MAP_2 2
  1257. # define RASTER_CONFIG_SE_MAP_3 3
  1258. # define SE_XSEL(x) ((x) << 26)
  1259. # define SE_XSEL_MASK (0x3 << 26)
  1260. # define SE_YSEL(x) ((x) << 28)
  1261. # define SE_YSEL_MASK (0x3 << 28)
  1262. #define VGT_EVENT_INITIATOR 0xA2A4
  1263. # define SAMPLE_STREAMOUTSTATS1 (1 << 0)
  1264. # define SAMPLE_STREAMOUTSTATS2 (2 << 0)
  1265. # define SAMPLE_STREAMOUTSTATS3 (3 << 0)
  1266. # define CACHE_FLUSH_TS (4 << 0)
  1267. # define CACHE_FLUSH (6 << 0)
  1268. # define CS_PARTIAL_FLUSH (7 << 0)
  1269. # define VGT_STREAMOUT_RESET (10 << 0)
  1270. # define END_OF_PIPE_INCR_DE (11 << 0)
  1271. # define END_OF_PIPE_IB_END (12 << 0)
  1272. # define RST_PIX_CNT (13 << 0)
  1273. # define VS_PARTIAL_FLUSH (15 << 0)
  1274. # define PS_PARTIAL_FLUSH (16 << 0)
  1275. # define CACHE_FLUSH_AND_INV_TS_EVENT (20 << 0)
  1276. # define ZPASS_DONE (21 << 0)
  1277. # define CACHE_FLUSH_AND_INV_EVENT (22 << 0)
  1278. # define PERFCOUNTER_START (23 << 0)
  1279. # define PERFCOUNTER_STOP (24 << 0)
  1280. # define PIPELINESTAT_START (25 << 0)
  1281. # define PIPELINESTAT_STOP (26 << 0)
  1282. # define PERFCOUNTER_SAMPLE (27 << 0)
  1283. # define SAMPLE_PIPELINESTAT (30 << 0)
  1284. # define SAMPLE_STREAMOUTSTATS (32 << 0)
  1285. # define RESET_VTX_CNT (33 << 0)
  1286. # define VGT_FLUSH (36 << 0)
  1287. # define BOTTOM_OF_PIPE_TS (40 << 0)
  1288. # define DB_CACHE_FLUSH_AND_INV (42 << 0)
  1289. # define FLUSH_AND_INV_DB_DATA_TS (43 << 0)
  1290. # define FLUSH_AND_INV_DB_META (44 << 0)
  1291. # define FLUSH_AND_INV_CB_DATA_TS (45 << 0)
  1292. # define FLUSH_AND_INV_CB_META (46 << 0)
  1293. # define CS_DONE (47 << 0)
  1294. # define PS_DONE (48 << 0)
  1295. # define FLUSH_AND_INV_CB_PIXEL_DATA (49 << 0)
  1296. # define THREAD_TRACE_START (51 << 0)
  1297. # define THREAD_TRACE_STOP (52 << 0)
  1298. # define THREAD_TRACE_FLUSH (54 << 0)
  1299. # define THREAD_TRACE_FINISH (55 << 0)
  1300. /* PIF PHY0 registers idx/data 0x8/0xc */
  1301. #define PB0_PIF_CNTL 0x10
  1302. # define LS2_EXIT_TIME(x) ((x) << 17)
  1303. # define LS2_EXIT_TIME_MASK (0x7 << 17)
  1304. # define LS2_EXIT_TIME_SHIFT 17
  1305. #define PB0_PIF_PAIRING 0x11
  1306. # define MULTI_PIF (1 << 25)
  1307. #define PB0_PIF_PWRDOWN_0 0x12
  1308. # define PLL_POWER_STATE_IN_TXS2_0(x) ((x) << 7)
  1309. # define PLL_POWER_STATE_IN_TXS2_0_MASK (0x7 << 7)
  1310. # define PLL_POWER_STATE_IN_TXS2_0_SHIFT 7
  1311. # define PLL_POWER_STATE_IN_OFF_0(x) ((x) << 10)
  1312. # define PLL_POWER_STATE_IN_OFF_0_MASK (0x7 << 10)
  1313. # define PLL_POWER_STATE_IN_OFF_0_SHIFT 10
  1314. # define PLL_RAMP_UP_TIME_0(x) ((x) << 24)
  1315. # define PLL_RAMP_UP_TIME_0_MASK (0x7 << 24)
  1316. # define PLL_RAMP_UP_TIME_0_SHIFT 24
  1317. #define PB0_PIF_PWRDOWN_1 0x13
  1318. # define PLL_POWER_STATE_IN_TXS2_1(x) ((x) << 7)
  1319. # define PLL_POWER_STATE_IN_TXS2_1_MASK (0x7 << 7)
  1320. # define PLL_POWER_STATE_IN_TXS2_1_SHIFT 7
  1321. # define PLL_POWER_STATE_IN_OFF_1(x) ((x) << 10)
  1322. # define PLL_POWER_STATE_IN_OFF_1_MASK (0x7 << 10)
  1323. # define PLL_POWER_STATE_IN_OFF_1_SHIFT 10
  1324. # define PLL_RAMP_UP_TIME_1(x) ((x) << 24)
  1325. # define PLL_RAMP_UP_TIME_1_MASK (0x7 << 24)
  1326. # define PLL_RAMP_UP_TIME_1_SHIFT 24
  1327. #define PB0_PIF_PWRDOWN_2 0x17
  1328. # define PLL_POWER_STATE_IN_TXS2_2(x) ((x) << 7)
  1329. # define PLL_POWER_STATE_IN_TXS2_2_MASK (0x7 << 7)
  1330. # define PLL_POWER_STATE_IN_TXS2_2_SHIFT 7
  1331. # define PLL_POWER_STATE_IN_OFF_2(x) ((x) << 10)
  1332. # define PLL_POWER_STATE_IN_OFF_2_MASK (0x7 << 10)
  1333. # define PLL_POWER_STATE_IN_OFF_2_SHIFT 10
  1334. # define PLL_RAMP_UP_TIME_2(x) ((x) << 24)
  1335. # define PLL_RAMP_UP_TIME_2_MASK (0x7 << 24)
  1336. # define PLL_RAMP_UP_TIME_2_SHIFT 24
  1337. #define PB0_PIF_PWRDOWN_3 0x18
  1338. # define PLL_POWER_STATE_IN_TXS2_3(x) ((x) << 7)
  1339. # define PLL_POWER_STATE_IN_TXS2_3_MASK (0x7 << 7)
  1340. # define PLL_POWER_STATE_IN_TXS2_3_SHIFT 7
  1341. # define PLL_POWER_STATE_IN_OFF_3(x) ((x) << 10)
  1342. # define PLL_POWER_STATE_IN_OFF_3_MASK (0x7 << 10)
  1343. # define PLL_POWER_STATE_IN_OFF_3_SHIFT 10
  1344. # define PLL_RAMP_UP_TIME_3(x) ((x) << 24)
  1345. # define PLL_RAMP_UP_TIME_3_MASK (0x7 << 24)
  1346. # define PLL_RAMP_UP_TIME_3_SHIFT 24
  1347. /* PIF PHY1 registers idx/data 0x10/0x14 */
  1348. #define PB1_PIF_CNTL 0x10
  1349. #define PB1_PIF_PAIRING 0x11
  1350. #define PB1_PIF_PWRDOWN_0 0x12
  1351. #define PB1_PIF_PWRDOWN_1 0x13
  1352. #define PB1_PIF_PWRDOWN_2 0x17
  1353. #define PB1_PIF_PWRDOWN_3 0x18
  1354. /* PCIE registers idx/data 0x30/0x34 */
  1355. #define PCIE_CNTL2 0x1c /* PCIE */
  1356. # define SLV_MEM_LS_EN (1 << 16)
  1357. # define SLV_MEM_AGGRESSIVE_LS_EN (1 << 17)
  1358. # define MST_MEM_LS_EN (1 << 18)
  1359. # define REPLAY_MEM_LS_EN (1 << 19)
  1360. #define PCIE_LC_STATUS1 0x28 /* PCIE */
  1361. # define LC_REVERSE_RCVR (1 << 0)
  1362. # define LC_REVERSE_XMIT (1 << 1)
  1363. # define LC_OPERATING_LINK_WIDTH_MASK (0x7 << 2)
  1364. # define LC_OPERATING_LINK_WIDTH_SHIFT 2
  1365. # define LC_DETECTED_LINK_WIDTH_MASK (0x7 << 5)
  1366. # define LC_DETECTED_LINK_WIDTH_SHIFT 5
  1367. #define PCIE_P_CNTL 0x40 /* PCIE */
  1368. # define P_IGNORE_EDB_ERR (1 << 6)
  1369. /* PCIE PORT registers idx/data 0x38/0x3c */
  1370. #define PCIE_LC_CNTL 0xa0
  1371. # define LC_L0S_INACTIVITY(x) ((x) << 8)
  1372. # define LC_L0S_INACTIVITY_MASK (0xf << 8)
  1373. # define LC_L0S_INACTIVITY_SHIFT 8
  1374. # define LC_L1_INACTIVITY(x) ((x) << 12)
  1375. # define LC_L1_INACTIVITY_MASK (0xf << 12)
  1376. # define LC_L1_INACTIVITY_SHIFT 12
  1377. # define LC_PMI_TO_L1_DIS (1 << 16)
  1378. # define LC_ASPM_TO_L1_DIS (1 << 24)
  1379. #define PCIE_LC_LINK_WIDTH_CNTL 0xa2 /* PCIE_P */
  1380. # define LC_LINK_WIDTH_SHIFT 0
  1381. # define LC_LINK_WIDTH_MASK 0x7
  1382. # define LC_LINK_WIDTH_X0 0
  1383. # define LC_LINK_WIDTH_X1 1
  1384. # define LC_LINK_WIDTH_X2 2
  1385. # define LC_LINK_WIDTH_X4 3
  1386. # define LC_LINK_WIDTH_X8 4
  1387. # define LC_LINK_WIDTH_X16 6
  1388. # define LC_LINK_WIDTH_RD_SHIFT 4
  1389. # define LC_LINK_WIDTH_RD_MASK 0x70
  1390. # define LC_RECONFIG_ARC_MISSING_ESCAPE (1 << 7)
  1391. # define LC_RECONFIG_NOW (1 << 8)
  1392. # define LC_RENEGOTIATION_SUPPORT (1 << 9)
  1393. # define LC_RENEGOTIATE_EN (1 << 10)
  1394. # define LC_SHORT_RECONFIG_EN (1 << 11)
  1395. # define LC_UPCONFIGURE_SUPPORT (1 << 12)
  1396. # define LC_UPCONFIGURE_DIS (1 << 13)
  1397. # define LC_DYN_LANES_PWR_STATE(x) ((x) << 21)
  1398. # define LC_DYN_LANES_PWR_STATE_MASK (0x3 << 21)
  1399. # define LC_DYN_LANES_PWR_STATE_SHIFT 21
  1400. #define PCIE_LC_N_FTS_CNTL 0xa3 /* PCIE_P */
  1401. # define LC_XMIT_N_FTS(x) ((x) << 0)
  1402. # define LC_XMIT_N_FTS_MASK (0xff << 0)
  1403. # define LC_XMIT_N_FTS_SHIFT 0
  1404. # define LC_XMIT_N_FTS_OVERRIDE_EN (1 << 8)
  1405. # define LC_N_FTS_MASK (0xff << 24)
  1406. #define PCIE_LC_SPEED_CNTL 0xa4 /* PCIE_P */
  1407. # define LC_GEN2_EN_STRAP (1 << 0)
  1408. # define LC_GEN3_EN_STRAP (1 << 1)
  1409. # define LC_TARGET_LINK_SPEED_OVERRIDE_EN (1 << 2)
  1410. # define LC_TARGET_LINK_SPEED_OVERRIDE_MASK (0x3 << 3)
  1411. # define LC_TARGET_LINK_SPEED_OVERRIDE_SHIFT 3
  1412. # define LC_FORCE_EN_SW_SPEED_CHANGE (1 << 5)
  1413. # define LC_FORCE_DIS_SW_SPEED_CHANGE (1 << 6)
  1414. # define LC_FORCE_EN_HW_SPEED_CHANGE (1 << 7)
  1415. # define LC_FORCE_DIS_HW_SPEED_CHANGE (1 << 8)
  1416. # define LC_INITIATE_LINK_SPEED_CHANGE (1 << 9)
  1417. # define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_MASK (0x3 << 10)
  1418. # define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_SHIFT 10
  1419. # define LC_CURRENT_DATA_RATE_MASK (0x3 << 13) /* 0/1/2 = gen1/2/3 */
  1420. # define LC_CURRENT_DATA_RATE_SHIFT 13
  1421. # define LC_CLR_FAILED_SPD_CHANGE_CNT (1 << 16)
  1422. # define LC_OTHER_SIDE_EVER_SENT_GEN2 (1 << 18)
  1423. # define LC_OTHER_SIDE_SUPPORTS_GEN2 (1 << 19)
  1424. # define LC_OTHER_SIDE_EVER_SENT_GEN3 (1 << 20)
  1425. # define LC_OTHER_SIDE_SUPPORTS_GEN3 (1 << 21)
  1426. #define PCIE_LC_CNTL2 0xb1
  1427. # define LC_ALLOW_PDWN_IN_L1 (1 << 17)
  1428. # define LC_ALLOW_PDWN_IN_L23 (1 << 18)
  1429. #define PCIE_LC_CNTL3 0xb5 /* PCIE_P */
  1430. # define LC_GO_TO_RECOVERY (1 << 30)
  1431. #define PCIE_LC_CNTL4 0xb6 /* PCIE_P */
  1432. # define LC_REDO_EQ (1 << 5)
  1433. # define LC_SET_QUIESCE (1 << 13)
  1434. /*
  1435. * UVD
  1436. */
  1437. #define UVD_UDEC_ADDR_CONFIG 0x3bd3
  1438. #define UVD_UDEC_DB_ADDR_CONFIG 0x3bd4
  1439. #define UVD_UDEC_DBW_ADDR_CONFIG 0x3bd5
  1440. #define UVD_RBC_RB_RPTR 0x3da4
  1441. #define UVD_RBC_RB_WPTR 0x3da5
  1442. #define UVD_STATUS 0x3daf
  1443. #define UVD_CGC_CTRL 0x3dc2
  1444. # define DCM (1 << 0)
  1445. # define CG_DT(x) ((x) << 2)
  1446. # define CG_DT_MASK (0xf << 2)
  1447. # define CLK_OD(x) ((x) << 6)
  1448. # define CLK_OD_MASK (0x1f << 6)
  1449. /* UVD CTX indirect */
  1450. #define UVD_CGC_MEM_CTRL 0xC0
  1451. #define UVD_CGC_CTRL2 0xC1
  1452. # define DYN_OR_EN (1 << 0)
  1453. # define DYN_RR_EN (1 << 1)
  1454. # define G_DIV_ID(x) ((x) << 2)
  1455. # define G_DIV_ID_MASK (0x7 << 2)
  1456. /*
  1457. * PM4
  1458. */
  1459. #define PACKET0(reg, n) ((RADEON_PACKET_TYPE0 << 30) | \
  1460. (((reg) >> 2) & 0xFFFF) | \
  1461. ((n) & 0x3FFF) << 16)
  1462. #define CP_PACKET2 0x80000000
  1463. #define PACKET2_PAD_SHIFT 0
  1464. #define PACKET2_PAD_MASK (0x3fffffff << 0)
  1465. #define PACKET2(v) (CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
  1466. #define RADEON_PACKET_TYPE3 3
  1467. #define PACKET3(op, n) ((RADEON_PACKET_TYPE3 << 30) | \
  1468. (((op) & 0xFF) << 8) | \
  1469. ((n) & 0x3FFF) << 16)
  1470. #define PACKET3_COMPUTE(op, n) (PACKET3(op, n) | 1 << 1)
  1471. /* Packet 3 types */
  1472. #define PACKET3_NOP 0x10
  1473. #define PACKET3_SET_BASE 0x11
  1474. #define PACKET3_BASE_INDEX(x) ((x) << 0)
  1475. #define GDS_PARTITION_BASE 2
  1476. #define CE_PARTITION_BASE 3
  1477. #define PACKET3_CLEAR_STATE 0x12
  1478. #define PACKET3_INDEX_BUFFER_SIZE 0x13
  1479. #define PACKET3_DISPATCH_DIRECT 0x15
  1480. #define PACKET3_DISPATCH_INDIRECT 0x16
  1481. #define PACKET3_ALLOC_GDS 0x1B
  1482. #define PACKET3_WRITE_GDS_RAM 0x1C
  1483. #define PACKET3_ATOMIC_GDS 0x1D
  1484. #define PACKET3_ATOMIC 0x1E
  1485. #define PACKET3_OCCLUSION_QUERY 0x1F
  1486. #define PACKET3_SET_PREDICATION 0x20
  1487. #define PACKET3_REG_RMW 0x21
  1488. #define PACKET3_COND_EXEC 0x22
  1489. #define PACKET3_PRED_EXEC 0x23
  1490. #define PACKET3_DRAW_INDIRECT 0x24
  1491. #define PACKET3_DRAW_INDEX_INDIRECT 0x25
  1492. #define PACKET3_INDEX_BASE 0x26
  1493. #define PACKET3_DRAW_INDEX_2 0x27
  1494. #define PACKET3_CONTEXT_CONTROL 0x28
  1495. #define PACKET3_INDEX_TYPE 0x2A
  1496. #define PACKET3_DRAW_INDIRECT_MULTI 0x2C
  1497. #define PACKET3_DRAW_INDEX_AUTO 0x2D
  1498. #define PACKET3_DRAW_INDEX_IMMD 0x2E
  1499. #define PACKET3_NUM_INSTANCES 0x2F
  1500. #define PACKET3_DRAW_INDEX_MULTI_AUTO 0x30
  1501. #define PACKET3_INDIRECT_BUFFER_CONST 0x31
  1502. #define PACKET3_INDIRECT_BUFFER 0x3F
  1503. #define PACKET3_STRMOUT_BUFFER_UPDATE 0x34
  1504. #define PACKET3_DRAW_INDEX_OFFSET_2 0x35
  1505. #define PACKET3_DRAW_INDEX_MULTI_ELEMENT 0x36
  1506. #define PACKET3_WRITE_DATA 0x37
  1507. #define WRITE_DATA_DST_SEL(x) ((x) << 8)
  1508. /* 0 - register
  1509. * 1 - memory (sync - via GRBM)
  1510. * 2 - tc/l2
  1511. * 3 - gds
  1512. * 4 - reserved
  1513. * 5 - memory (async - direct)
  1514. */
  1515. #define WR_ONE_ADDR (1 << 16)
  1516. #define WR_CONFIRM (1 << 20)
  1517. #define WRITE_DATA_ENGINE_SEL(x) ((x) << 30)
  1518. /* 0 - me
  1519. * 1 - pfp
  1520. * 2 - ce
  1521. */
  1522. #define PACKET3_DRAW_INDEX_INDIRECT_MULTI 0x38
  1523. #define PACKET3_MEM_SEMAPHORE 0x39
  1524. #define PACKET3_MPEG_INDEX 0x3A
  1525. #define PACKET3_COPY_DW 0x3B
  1526. #define PACKET3_WAIT_REG_MEM 0x3C
  1527. #define WAIT_REG_MEM_FUNCTION(x) ((x) << 0)
  1528. /* 0 - always
  1529. * 1 - <
  1530. * 2 - <=
  1531. * 3 - ==
  1532. * 4 - !=
  1533. * 5 - >=
  1534. * 6 - >
  1535. */
  1536. #define WAIT_REG_MEM_MEM_SPACE(x) ((x) << 4)
  1537. /* 0 - reg
  1538. * 1 - mem
  1539. */
  1540. #define WAIT_REG_MEM_ENGINE(x) ((x) << 8)
  1541. /* 0 - me
  1542. * 1 - pfp
  1543. */
  1544. #define PACKET3_MEM_WRITE 0x3D
  1545. #define PACKET3_COPY_DATA 0x40
  1546. #define PACKET3_CP_DMA 0x41
  1547. /* 1. header
  1548. * 2. SRC_ADDR_LO or DATA [31:0]
  1549. * 3. CP_SYNC [31] | SRC_SEL [30:29] | ENGINE [27] | DST_SEL [21:20] |
  1550. * SRC_ADDR_HI [7:0]
  1551. * 4. DST_ADDR_LO [31:0]
  1552. * 5. DST_ADDR_HI [7:0]
  1553. * 6. COMMAND [30:21] | BYTE_COUNT [20:0]
  1554. */
  1555. # define PACKET3_CP_DMA_DST_SEL(x) ((x) << 20)
  1556. /* 0 - DST_ADDR
  1557. * 1 - GDS
  1558. */
  1559. # define PACKET3_CP_DMA_ENGINE(x) ((x) << 27)
  1560. /* 0 - ME
  1561. * 1 - PFP
  1562. */
  1563. # define PACKET3_CP_DMA_SRC_SEL(x) ((x) << 29)
  1564. /* 0 - SRC_ADDR
  1565. * 1 - GDS
  1566. * 2 - DATA
  1567. */
  1568. # define PACKET3_CP_DMA_CP_SYNC (1 << 31)
  1569. /* COMMAND */
  1570. # define PACKET3_CP_DMA_DIS_WC (1 << 21)
  1571. # define PACKET3_CP_DMA_CMD_SRC_SWAP(x) ((x) << 22)
  1572. /* 0 - none
  1573. * 1 - 8 in 16
  1574. * 2 - 8 in 32
  1575. * 3 - 8 in 64
  1576. */
  1577. # define PACKET3_CP_DMA_CMD_DST_SWAP(x) ((x) << 24)
  1578. /* 0 - none
  1579. * 1 - 8 in 16
  1580. * 2 - 8 in 32
  1581. * 3 - 8 in 64
  1582. */
  1583. # define PACKET3_CP_DMA_CMD_SAS (1 << 26)
  1584. /* 0 - memory
  1585. * 1 - register
  1586. */
  1587. # define PACKET3_CP_DMA_CMD_DAS (1 << 27)
  1588. /* 0 - memory
  1589. * 1 - register
  1590. */
  1591. # define PACKET3_CP_DMA_CMD_SAIC (1 << 28)
  1592. # define PACKET3_CP_DMA_CMD_DAIC (1 << 29)
  1593. # define PACKET3_CP_DMA_CMD_RAW_WAIT (1 << 30)
  1594. #define PACKET3_PFP_SYNC_ME 0x42
  1595. #define PACKET3_SURFACE_SYNC 0x43
  1596. # define PACKET3_DEST_BASE_0_ENA (1 << 0)
  1597. # define PACKET3_DEST_BASE_1_ENA (1 << 1)
  1598. # define PACKET3_CB0_DEST_BASE_ENA (1 << 6)
  1599. # define PACKET3_CB1_DEST_BASE_ENA (1 << 7)
  1600. # define PACKET3_CB2_DEST_BASE_ENA (1 << 8)
  1601. # define PACKET3_CB3_DEST_BASE_ENA (1 << 9)
  1602. # define PACKET3_CB4_DEST_BASE_ENA (1 << 10)
  1603. # define PACKET3_CB5_DEST_BASE_ENA (1 << 11)
  1604. # define PACKET3_CB6_DEST_BASE_ENA (1 << 12)
  1605. # define PACKET3_CB7_DEST_BASE_ENA (1 << 13)
  1606. # define PACKET3_DB_DEST_BASE_ENA (1 << 14)
  1607. # define PACKET3_DEST_BASE_2_ENA (1 << 19)
  1608. # define PACKET3_DEST_BASE_3_ENA (1 << 21)
  1609. # define PACKET3_TCL1_ACTION_ENA (1 << 22)
  1610. # define PACKET3_TC_ACTION_ENA (1 << 23)
  1611. # define PACKET3_CB_ACTION_ENA (1 << 25)
  1612. # define PACKET3_DB_ACTION_ENA (1 << 26)
  1613. # define PACKET3_SH_KCACHE_ACTION_ENA (1 << 27)
  1614. # define PACKET3_SH_ICACHE_ACTION_ENA (1 << 29)
  1615. #define PACKET3_ME_INITIALIZE 0x44
  1616. #define PACKET3_ME_INITIALIZE_DEVICE_ID(x) ((x) << 16)
  1617. #define PACKET3_COND_WRITE 0x45
  1618. #define PACKET3_EVENT_WRITE 0x46
  1619. #define EVENT_TYPE(x) ((x) << 0)
  1620. #define EVENT_INDEX(x) ((x) << 8)
  1621. /* 0 - any non-TS event
  1622. * 1 - ZPASS_DONE
  1623. * 2 - SAMPLE_PIPELINESTAT
  1624. * 3 - SAMPLE_STREAMOUTSTAT*
  1625. * 4 - *S_PARTIAL_FLUSH
  1626. * 5 - EOP events
  1627. * 6 - EOS events
  1628. * 7 - CACHE_FLUSH, CACHE_FLUSH_AND_INV_EVENT
  1629. */
  1630. #define INV_L2 (1 << 20)
  1631. /* INV TC L2 cache when EVENT_INDEX = 7 */
  1632. #define PACKET3_EVENT_WRITE_EOP 0x47
  1633. #define DATA_SEL(x) ((x) << 29)
  1634. /* 0 - discard
  1635. * 1 - send low 32bit data
  1636. * 2 - send 64bit data
  1637. * 3 - send 64bit counter value
  1638. */
  1639. #define INT_SEL(x) ((x) << 24)
  1640. /* 0 - none
  1641. * 1 - interrupt only (DATA_SEL = 0)
  1642. * 2 - interrupt when data write is confirmed
  1643. */
  1644. #define PACKET3_EVENT_WRITE_EOS 0x48
  1645. #define PACKET3_PREAMBLE_CNTL 0x4A
  1646. # define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE (2 << 28)
  1647. # define PACKET3_PREAMBLE_END_CLEAR_STATE (3 << 28)
  1648. #define PACKET3_ONE_REG_WRITE 0x57
  1649. #define PACKET3_LOAD_CONFIG_REG 0x5F
  1650. #define PACKET3_LOAD_CONTEXT_REG 0x60
  1651. #define PACKET3_LOAD_SH_REG 0x61
  1652. #define PACKET3_SET_CONFIG_REG 0x68
  1653. #define PACKET3_SET_CONFIG_REG_START 0x00002000
  1654. #define PACKET3_SET_CONFIG_REG_END 0x00002c00
  1655. #define PACKET3_SET_CONTEXT_REG 0x69
  1656. #define PACKET3_SET_CONTEXT_REG_START 0x000a000
  1657. #define PACKET3_SET_CONTEXT_REG_END 0x000a400
  1658. #define PACKET3_SET_CONTEXT_REG_INDIRECT 0x73
  1659. #define PACKET3_SET_RESOURCE_INDIRECT 0x74
  1660. #define PACKET3_SET_SH_REG 0x76
  1661. #define PACKET3_SET_SH_REG_START 0x00002c00
  1662. #define PACKET3_SET_SH_REG_END 0x00003000
  1663. #define PACKET3_SET_SH_REG_OFFSET 0x77
  1664. #define PACKET3_ME_WRITE 0x7A
  1665. #define PACKET3_SCRATCH_RAM_WRITE 0x7D
  1666. #define PACKET3_SCRATCH_RAM_READ 0x7E
  1667. #define PACKET3_CE_WRITE 0x7F
  1668. #define PACKET3_LOAD_CONST_RAM 0x80
  1669. #define PACKET3_WRITE_CONST_RAM 0x81
  1670. #define PACKET3_WRITE_CONST_RAM_OFFSET 0x82
  1671. #define PACKET3_DUMP_CONST_RAM 0x83
  1672. #define PACKET3_INCREMENT_CE_COUNTER 0x84
  1673. #define PACKET3_INCREMENT_DE_COUNTER 0x85
  1674. #define PACKET3_WAIT_ON_CE_COUNTER 0x86
  1675. #define PACKET3_WAIT_ON_DE_COUNTER 0x87
  1676. #define PACKET3_WAIT_ON_DE_COUNTER_DIFF 0x88
  1677. #define PACKET3_SET_CE_DE_COUNTERS 0x89
  1678. #define PACKET3_WAIT_ON_AVAIL_BUFFER 0x8A
  1679. #define PACKET3_SWITCH_BUFFER 0x8B
  1680. /* ASYNC DMA - first instance at 0xd000, second at 0xd800 */
  1681. #define DMA0_REGISTER_OFFSET 0x0 /* not a register */
  1682. #define DMA1_REGISTER_OFFSET 0x200 /* not a register */
  1683. #define DMA_RB_CNTL 0x3400
  1684. # define DMA_RB_ENABLE (1 << 0)
  1685. # define DMA_RB_SIZE(x) ((x) << 1) /* log2 */
  1686. # define DMA_RB_SWAP_ENABLE (1 << 9) /* 8IN32 */
  1687. # define DMA_RPTR_WRITEBACK_ENABLE (1 << 12)
  1688. # define DMA_RPTR_WRITEBACK_SWAP_ENABLE (1 << 13) /* 8IN32 */
  1689. # define DMA_RPTR_WRITEBACK_TIMER(x) ((x) << 16) /* log2 */
  1690. #define DMA_RB_BASE 0x3401
  1691. #define DMA_RB_RPTR 0x3402
  1692. #define DMA_RB_WPTR 0x3403
  1693. #define DMA_RB_RPTR_ADDR_HI 0x3407
  1694. #define DMA_RB_RPTR_ADDR_LO 0x3408
  1695. #define DMA_IB_CNTL 0x3409
  1696. # define DMA_IB_ENABLE (1 << 0)
  1697. # define DMA_IB_SWAP_ENABLE (1 << 4)
  1698. # define CMD_VMID_FORCE (1 << 31)
  1699. #define DMA_IB_RPTR 0x340a
  1700. #define DMA_CNTL 0x340b
  1701. # define TRAP_ENABLE (1 << 0)
  1702. # define SEM_INCOMPLETE_INT_ENABLE (1 << 1)
  1703. # define SEM_WAIT_INT_ENABLE (1 << 2)
  1704. # define DATA_SWAP_ENABLE (1 << 3)
  1705. # define FENCE_SWAP_ENABLE (1 << 4)
  1706. # define CTXEMPTY_INT_ENABLE (1 << 28)
  1707. #define DMA_STATUS_REG 0x340d
  1708. # define DMA_IDLE (1 << 0)
  1709. #define DMA_TILING_CONFIG 0x342e
  1710. #define DMA_POWER_CNTL 0x342f
  1711. # define MEM_POWER_OVERRIDE (1 << 8)
  1712. #define DMA_CLK_CTRL 0x3430
  1713. #define DMA_PG 0x3435
  1714. # define PG_CNTL_ENABLE (1 << 0)
  1715. #define DMA_PGFSM_CONFIG 0x3436
  1716. #define DMA_PGFSM_WRITE 0x3437
  1717. #define DMA_PACKET(cmd, b, t, s, n) ((((cmd) & 0xF) << 28) | \
  1718. (((b) & 0x1) << 26) | \
  1719. (((t) & 0x1) << 23) | \
  1720. (((s) & 0x1) << 22) | \
  1721. (((n) & 0xFFFFF) << 0))
  1722. #define DMA_IB_PACKET(cmd, vmid, n) ((((cmd) & 0xF) << 28) | \
  1723. (((vmid) & 0xF) << 20) | \
  1724. (((n) & 0xFFFFF) << 0))
  1725. #define DMA_PTE_PDE_PACKET(n) ((2 << 28) | \
  1726. (1 << 26) | \
  1727. (1 << 21) | \
  1728. (((n) & 0xFFFFF) << 0))
  1729. /* async DMA Packet types */
  1730. #define DMA_PACKET_WRITE 0x2
  1731. #define DMA_PACKET_COPY 0x3
  1732. #define DMA_PACKET_INDIRECT_BUFFER 0x4
  1733. #define DMA_PACKET_SEMAPHORE 0x5
  1734. #define DMA_PACKET_FENCE 0x6
  1735. #define DMA_PACKET_TRAP 0x7
  1736. #define DMA_PACKET_SRBM_WRITE 0x9
  1737. #define DMA_PACKET_CONSTANT_FILL 0xd
  1738. #define DMA_PACKET_POLL_REG_MEM 0xe
  1739. #define DMA_PACKET_NOP 0xf
  1740. #define VCE_STATUS 0x20004
  1741. #define VCE_VCPU_CNTL 0x20014
  1742. #define VCE_CLK_EN (1 << 0)
  1743. #define VCE_VCPU_CACHE_OFFSET0 0x20024
  1744. #define VCE_VCPU_CACHE_SIZE0 0x20028
  1745. #define VCE_VCPU_CACHE_OFFSET1 0x2002c
  1746. #define VCE_VCPU_CACHE_SIZE1 0x20030
  1747. #define VCE_VCPU_CACHE_OFFSET2 0x20034
  1748. #define VCE_VCPU_CACHE_SIZE2 0x20038
  1749. #define VCE_SOFT_RESET 0x20120
  1750. #define VCE_ECPU_SOFT_RESET (1 << 0)
  1751. #define VCE_FME_SOFT_RESET (1 << 2)
  1752. #define VCE_RB_BASE_LO2 0x2016c
  1753. #define VCE_RB_BASE_HI2 0x20170
  1754. #define VCE_RB_SIZE2 0x20174
  1755. #define VCE_RB_RPTR2 0x20178
  1756. #define VCE_RB_WPTR2 0x2017c
  1757. #define VCE_RB_BASE_LO 0x20180
  1758. #define VCE_RB_BASE_HI 0x20184
  1759. #define VCE_RB_SIZE 0x20188
  1760. #define VCE_RB_RPTR 0x2018c
  1761. #define VCE_RB_WPTR 0x20190
  1762. #define VCE_CLOCK_GATING_A 0x202f8
  1763. #define VCE_CLOCK_GATING_B 0x202fc
  1764. #define VCE_UENC_CLOCK_GATING 0x205bc
  1765. #define VCE_UENC_REG_CLOCK_GATING 0x205c0
  1766. #define VCE_FW_REG_STATUS 0x20e10
  1767. # define VCE_FW_REG_STATUS_BUSY (1 << 0)
  1768. # define VCE_FW_REG_STATUS_PASS (1 << 3)
  1769. # define VCE_FW_REG_STATUS_DONE (1 << 11)
  1770. #define VCE_LMI_FW_START_KEYSEL 0x20e18
  1771. #define VCE_LMI_FW_PERIODIC_CTRL 0x20e20
  1772. #define VCE_LMI_CTRL2 0x20e74
  1773. #define VCE_LMI_CTRL 0x20e98
  1774. #define VCE_LMI_VM_CTRL 0x20ea0
  1775. #define VCE_LMI_SWAP_CNTL 0x20eb4
  1776. #define VCE_LMI_SWAP_CNTL1 0x20eb8
  1777. #define VCE_LMI_CACHE_CTRL 0x20ef4
  1778. #define VCE_CMD_NO_OP 0x00000000
  1779. #define VCE_CMD_END 0x00000001
  1780. #define VCE_CMD_IB 0x00000002
  1781. #define VCE_CMD_FENCE 0x00000003
  1782. #define VCE_CMD_TRAP 0x00000004
  1783. #define VCE_CMD_IB_AUTO 0x00000005
  1784. #define VCE_CMD_SEMAPHORE 0x00000006
  1785. //#dce stupp
  1786. /* display controller offsets used for crtc/cur/lut/grph/viewport/etc. */
  1787. #define SI_CRTC0_REGISTER_OFFSET 0 //(0x6df0 - 0x6df0)/4
  1788. #define SI_CRTC1_REGISTER_OFFSET 0x300 //(0x79f0 - 0x6df0)/4
  1789. #define SI_CRTC2_REGISTER_OFFSET 0x2600 //(0x105f0 - 0x6df0)/4
  1790. #define SI_CRTC3_REGISTER_OFFSET 0x2900 //(0x111f0 - 0x6df0)/4
  1791. #define SI_CRTC4_REGISTER_OFFSET 0x2c00 //(0x11df0 - 0x6df0)/4
  1792. #define SI_CRTC5_REGISTER_OFFSET 0x2f00 //(0x129f0 - 0x6df0)/4
  1793. #define CURSOR_WIDTH 64
  1794. #define CURSOR_HEIGHT 64
  1795. #define AMDGPU_MM_INDEX 0x0000
  1796. #define AMDGPU_MM_DATA 0x0001
  1797. #define VERDE_NUM_CRTC 6
  1798. #define BLACKOUT_MODE_MASK 0x00000007
  1799. #define VGA_RENDER_CONTROL 0xC0
  1800. #define R_000300_VGA_RENDER_CONTROL 0xC0
  1801. #define C_000300_VGA_VSTATUS_CNTL 0xFFFCFFFF
  1802. #define EVERGREEN_CRTC_STATUS 0x1BA3
  1803. #define EVERGREEN_CRTC_V_BLANK (1 << 0)
  1804. #define EVERGREEN_CRTC_STATUS_POSITION 0x1BA4
  1805. /* CRTC blocks at 0x6df0, 0x79f0, 0x105f0, 0x111f0, 0x11df0, 0x129f0 */
  1806. #define EVERGREEN_CRTC_V_BLANK_START_END 0x1b8d
  1807. #define EVERGREEN_CRTC_CONTROL 0x1b9c
  1808. #define EVERGREEN_CRTC_MASTER_EN (1 << 0)
  1809. #define EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE (1 << 24)
  1810. #define EVERGREEN_CRTC_BLANK_CONTROL 0x1b9d
  1811. #define EVERGREEN_CRTC_BLANK_DATA_EN (1 << 8)
  1812. #define EVERGREEN_CRTC_V_BLANK (1 << 0)
  1813. #define EVERGREEN_CRTC_STATUS_HV_COUNT 0x1ba8
  1814. #define EVERGREEN_CRTC_UPDATE_LOCK 0x1bb5
  1815. #define EVERGREEN_MASTER_UPDATE_LOCK 0x1bbd
  1816. #define EVERGREEN_MASTER_UPDATE_MODE 0x1bbe
  1817. #define EVERGREEN_GRPH_UPDATE_LOCK (1 << 16)
  1818. #define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x1a07
  1819. #define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x1a08
  1820. #define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS 0x1a04
  1821. #define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS 0x1a05
  1822. #define EVERGREEN_GRPH_UPDATE 0x1a11
  1823. #define EVERGREEN_VGA_MEMORY_BASE_ADDRESS 0xc4
  1824. #define EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH 0xc9
  1825. #define EVERGREEN_GRPH_SURFACE_UPDATE_PENDING (1 << 2)
  1826. #define EVERGREEN_DATA_FORMAT 0x1ac0
  1827. # define EVERGREEN_INTERLEAVE_EN (1 << 0)
  1828. #define MC_SHARED_CHMAP__NOOFCHAN_MASK 0xf000
  1829. #define MC_SHARED_CHMAP__NOOFCHAN__SHIFT 0xc
  1830. #define R600_D1GRPH_ARRAY_MODE_LINEAR_GENERAL (0 << 20)
  1831. #define R600_D1GRPH_ARRAY_MODE_LINEAR_ALIGNED (1 << 20)
  1832. #define R600_D1GRPH_ARRAY_MODE_1D_TILED_THIN1 (2 << 20)
  1833. #define R600_D1GRPH_ARRAY_MODE_2D_TILED_THIN1 (4 << 20)
  1834. #define R700_D1GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x1a45
  1835. #define R700_D2GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x1845
  1836. #define R700_D2GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x1847
  1837. #define R700_D1GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x1a47
  1838. #define DISP_INTERRUPT_STATUS__LB_D1_VBLANK_INTERRUPT_MASK 0x8
  1839. #define DISP_INTERRUPT_STATUS_CONTINUE__LB_D2_VBLANK_INTERRUPT_MASK 0x8
  1840. #define DISP_INTERRUPT_STATUS_CONTINUE2__LB_D3_VBLANK_INTERRUPT_MASK 0x8
  1841. #define DISP_INTERRUPT_STATUS_CONTINUE3__LB_D4_VBLANK_INTERRUPT_MASK 0x8
  1842. #define DISP_INTERRUPT_STATUS_CONTINUE4__LB_D5_VBLANK_INTERRUPT_MASK 0x8
  1843. #define DISP_INTERRUPT_STATUS_CONTINUE5__LB_D6_VBLANK_INTERRUPT_MASK 0x8
  1844. #define DISP_INTERRUPT_STATUS__LB_D1_VLINE_INTERRUPT_MASK 0x4
  1845. #define DISP_INTERRUPT_STATUS_CONTINUE__LB_D2_VLINE_INTERRUPT_MASK 0x4
  1846. #define DISP_INTERRUPT_STATUS_CONTINUE2__LB_D3_VLINE_INTERRUPT_MASK 0x4
  1847. #define DISP_INTERRUPT_STATUS_CONTINUE3__LB_D4_VLINE_INTERRUPT_MASK 0x4
  1848. #define DISP_INTERRUPT_STATUS_CONTINUE4__LB_D5_VLINE_INTERRUPT_MASK 0x4
  1849. #define DISP_INTERRUPT_STATUS_CONTINUE5__LB_D6_VLINE_INTERRUPT_MASK 0x4
  1850. #define DISP_INTERRUPT_STATUS__DC_HPD1_INTERRUPT_MASK 0x20000
  1851. #define DISP_INTERRUPT_STATUS_CONTINUE__DC_HPD2_INTERRUPT_MASK 0x20000
  1852. #define DISP_INTERRUPT_STATUS_CONTINUE2__DC_HPD3_INTERRUPT_MASK 0x20000
  1853. #define DISP_INTERRUPT_STATUS_CONTINUE3__DC_HPD4_INTERRUPT_MASK 0x20000
  1854. #define DISP_INTERRUPT_STATUS_CONTINUE4__DC_HPD5_INTERRUPT_MASK 0x20000
  1855. #define DISP_INTERRUPT_STATUS_CONTINUE5__DC_HPD6_INTERRUPT_MASK 0x20000
  1856. #define GRPH_INTERRUPT_STATUS__GRPH_PFLIP_INT_OCCURRED_MASK 0x1
  1857. #define GRPH_INTERRUPT_STATUS__GRPH_PFLIP_INT_CLEAR_MASK 0x100
  1858. #define DC_HPD1_INT_CONTROL__DC_HPD1_INT_ACK_MASK 0x1
  1859. #define R600_D1GRPH_SWAP_CONTROL 0x1843
  1860. #define R600_D1GRPH_SWAP_ENDIAN_NONE (0 << 0)
  1861. #define R600_D1GRPH_SWAP_ENDIAN_16BIT (1 << 0)
  1862. #define R600_D1GRPH_SWAP_ENDIAN_32BIT (2 << 0)
  1863. #define R600_D1GRPH_SWAP_ENDIAN_64BIT (3 << 0)
  1864. #define AVIVO_D1VGA_CONTROL 0x00cc
  1865. # define AVIVO_DVGA_CONTROL_MODE_ENABLE (1 << 0)
  1866. # define AVIVO_DVGA_CONTROL_TIMING_SELECT (1 << 8)
  1867. # define AVIVO_DVGA_CONTROL_SYNC_POLARITY_SELECT (1 << 9)
  1868. # define AVIVO_DVGA_CONTROL_OVERSCAN_TIMING_SELECT (1 << 10)
  1869. # define AVIVO_DVGA_CONTROL_OVERSCAN_COLOR_EN (1 << 16)
  1870. # define AVIVO_DVGA_CONTROL_ROTATE (1 << 24)
  1871. #define AVIVO_D2VGA_CONTROL 0x00ce
  1872. #define R600_BUS_CNTL 0x1508
  1873. # define R600_BIOS_ROM_DIS (1 << 1)
  1874. #define R600_ROM_CNTL 0x580
  1875. # define R600_SCK_OVERWRITE (1 << 1)
  1876. # define R600_SCK_PRESCALE_CRYSTAL_CLK_SHIFT 28
  1877. # define R600_SCK_PRESCALE_CRYSTAL_CLK_MASK (0xf << 28)
  1878. #define GRPH_INTERRUPT_CONTROL__GRPH_PFLIP_INT_MASK_MASK 0x1
  1879. #define FMT_BIT_DEPTH_CONTROL 0x1bf2
  1880. #define FMT_TRUNCATE_EN (1 << 0)
  1881. #define FMT_TRUNCATE_DEPTH (1 << 4)
  1882. #define FMT_SPATIAL_DITHER_EN (1 << 8)
  1883. #define FMT_SPATIAL_DITHER_MODE(x) ((x) << 9)
  1884. #define FMT_SPATIAL_DITHER_DEPTH (1 << 12)
  1885. #define FMT_FRAME_RANDOM_ENABLE (1 << 13)
  1886. #define FMT_RGB_RANDOM_ENABLE (1 << 14)
  1887. #define FMT_HIGHPASS_RANDOM_ENABLE (1 << 15)
  1888. #define FMT_TEMPORAL_DITHER_EN (1 << 16)
  1889. #define FMT_TEMPORAL_DITHER_DEPTH (1 << 20)
  1890. #define FMT_TEMPORAL_DITHER_OFFSET(x) ((x) << 21)
  1891. #define FMT_TEMPORAL_LEVEL (1 << 24)
  1892. #define FMT_TEMPORAL_DITHER_RESET (1 << 25)
  1893. #define FMT_25FRC_SEL(x) ((x) << 26)
  1894. #define FMT_50FRC_SEL(x) ((x) << 28)
  1895. #define FMT_75FRC_SEL(x) ((x) << 30)
  1896. #define EVERGREEN_DC_LUT_CONTROL 0x1a80
  1897. #define EVERGREEN_DC_LUT_BLACK_OFFSET_BLUE 0x1a81
  1898. #define EVERGREEN_DC_LUT_BLACK_OFFSET_GREEN 0x1a82
  1899. #define EVERGREEN_DC_LUT_BLACK_OFFSET_RED 0x1a83
  1900. #define EVERGREEN_DC_LUT_WHITE_OFFSET_BLUE 0x1a84
  1901. #define EVERGREEN_DC_LUT_WHITE_OFFSET_GREEN 0x1a85
  1902. #define EVERGREEN_DC_LUT_WHITE_OFFSET_RED 0x1a86
  1903. #define EVERGREEN_DC_LUT_30_COLOR 0x1a7c
  1904. #define EVERGREEN_DC_LUT_RW_INDEX 0x1a79
  1905. #define EVERGREEN_DC_LUT_WRITE_EN_MASK 0x1a7e
  1906. #define EVERGREEN_DC_LUT_RW_MODE 0x1a78
  1907. #define EVERGREEN_GRPH_ENABLE 0x1a00
  1908. #define EVERGREEN_GRPH_CONTROL 0x1a01
  1909. #define EVERGREEN_GRPH_DEPTH(x) (((x) & 0x3) << 0)
  1910. #define EVERGREEN_GRPH_DEPTH_8BPP 0
  1911. #define EVERGREEN_GRPH_DEPTH_16BPP 1
  1912. #define EVERGREEN_GRPH_DEPTH_32BPP 2
  1913. #define EVERGREEN_GRPH_NUM_BANKS(x) (((x) & 0x3) << 2)
  1914. #define EVERGREEN_ADDR_SURF_2_BANK 0
  1915. #define EVERGREEN_ADDR_SURF_4_BANK 1
  1916. #define EVERGREEN_ADDR_SURF_8_BANK 2
  1917. #define EVERGREEN_ADDR_SURF_16_BANK 3
  1918. #define EVERGREEN_GRPH_Z(x) (((x) & 0x3) << 4)
  1919. #define EVERGREEN_GRPH_BANK_WIDTH(x) (((x) & 0x3) << 6)
  1920. #define EVERGREEN_ADDR_SURF_BANK_WIDTH_1 0
  1921. #define EVERGREEN_ADDR_SURF_BANK_WIDTH_2 1
  1922. #define EVERGREEN_ADDR_SURF_BANK_WIDTH_4 2
  1923. #define EVERGREEN_ADDR_SURF_BANK_WIDTH_8 3
  1924. #define EVERGREEN_GRPH_FORMAT(x) (((x) & 0x7) << 8)
  1925. #define EVERGREEN_GRPH_FORMAT_INDEXED 0
  1926. #define EVERGREEN_GRPH_FORMAT_ARGB1555 0
  1927. #define EVERGREEN_GRPH_FORMAT_ARGB565 1
  1928. #define EVERGREEN_GRPH_FORMAT_ARGB4444 2
  1929. #define EVERGREEN_GRPH_FORMAT_AI88 3
  1930. #define EVERGREEN_GRPH_FORMAT_MONO16 4
  1931. #define EVERGREEN_GRPH_FORMAT_BGRA5551 5
  1932. /* 32 BPP */
  1933. #define EVERGREEN_GRPH_FORMAT_ARGB8888 0
  1934. #define EVERGREEN_GRPH_FORMAT_ARGB2101010 1
  1935. #define EVERGREEN_GRPH_FORMAT_32BPP_DIG 2
  1936. #define EVERGREEN_GRPH_FORMAT_8B_ARGB2101010 3
  1937. #define EVERGREEN_GRPH_FORMAT_BGRA1010102 4
  1938. #define EVERGREEN_GRPH_FORMAT_8B_BGRA1010102 5
  1939. #define EVERGREEN_GRPH_FORMAT_RGB111110 6
  1940. #define EVERGREEN_GRPH_FORMAT_BGR101111 7
  1941. #define EVERGREEN_GRPH_BANK_HEIGHT(x) (((x) & 0x3) << 11)
  1942. #define EVERGREEN_ADDR_SURF_BANK_HEIGHT_1 0
  1943. #define EVERGREEN_ADDR_SURF_BANK_HEIGHT_2 1
  1944. #define EVERGREEN_ADDR_SURF_BANK_HEIGHT_4 2
  1945. #define EVERGREEN_ADDR_SURF_BANK_HEIGHT_8 3
  1946. #define EVERGREEN_GRPH_TILE_SPLIT(x) (((x) & 0x7) << 13)
  1947. #define EVERGREEN_ADDR_SURF_TILE_SPLIT_64B 0
  1948. #define EVERGREEN_ADDR_SURF_TILE_SPLIT_128B 1
  1949. #define EVERGREEN_ADDR_SURF_TILE_SPLIT_256B 2
  1950. #define EVERGREEN_ADDR_SURF_TILE_SPLIT_512B 3
  1951. #define EVERGREEN_ADDR_SURF_TILE_SPLIT_1KB 4
  1952. #define EVERGREEN_ADDR_SURF_TILE_SPLIT_2KB 5
  1953. #define EVERGREEN_ADDR_SURF_TILE_SPLIT_4KB 6
  1954. #define EVERGREEN_GRPH_MACRO_TILE_ASPECT(x) (((x) & 0x3) << 18)
  1955. #define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_1 0
  1956. #define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_2 1
  1957. #define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_4 2
  1958. #define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_8 3
  1959. #define EVERGREEN_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20)
  1960. #define EVERGREEN_GRPH_ARRAY_LINEAR_GENERAL 0
  1961. #define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED 1
  1962. #define EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1 2
  1963. #define EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1 4
  1964. #define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_1 0
  1965. #define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_2 1
  1966. #define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_4 2
  1967. #define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_8 3
  1968. #define EVERGREEN_GRPH_SWAP_CONTROL 0x1a03
  1969. #define EVERGREEN_GRPH_ENDIAN_SWAP(x) (((x) & 0x3) << 0)
  1970. # define EVERGREEN_GRPH_ENDIAN_NONE 0
  1971. # define EVERGREEN_GRPH_ENDIAN_8IN16 1
  1972. # define EVERGREEN_GRPH_ENDIAN_8IN32 2
  1973. # define EVERGREEN_GRPH_ENDIAN_8IN64 3
  1974. #define EVERGREEN_D3VGA_CONTROL 0xf8
  1975. #define EVERGREEN_D4VGA_CONTROL 0xf9
  1976. #define EVERGREEN_D5VGA_CONTROL 0xfa
  1977. #define EVERGREEN_D6VGA_CONTROL 0xfb
  1978. #define EVERGREEN_GRPH_SURFACE_ADDRESS_MASK 0xffffff00
  1979. #define EVERGREEN_GRPH_LUT_10BIT_BYPASS_CONTROL 0x1a02
  1980. #define EVERGREEN_LUT_10BIT_BYPASS_EN (1 << 8)
  1981. #define EVERGREEN_GRPH_PITCH 0x1a06
  1982. #define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x1a07
  1983. #define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x1a08
  1984. #define EVERGREEN_GRPH_SURFACE_OFFSET_X 0x1a09
  1985. #define EVERGREEN_GRPH_SURFACE_OFFSET_Y 0x1a0a
  1986. #define EVERGREEN_GRPH_X_START 0x1a0b
  1987. #define EVERGREEN_GRPH_Y_START 0x1a0c
  1988. #define EVERGREEN_GRPH_X_END 0x1a0d
  1989. #define EVERGREEN_GRPH_Y_END 0x1a0e
  1990. #define EVERGREEN_GRPH_UPDATE 0x1a11
  1991. #define EVERGREEN_GRPH_SURFACE_UPDATE_PENDING (1 << 2)
  1992. #define EVERGREEN_GRPH_UPDATE_LOCK (1 << 16)
  1993. #define EVERGREEN_GRPH_FLIP_CONTROL 0x1a12
  1994. #define EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN (1 << 0)
  1995. #define EVERGREEN_VIEWPORT_START 0x1b5c
  1996. #define EVERGREEN_VIEWPORT_SIZE 0x1b5d
  1997. #define EVERGREEN_DESKTOP_HEIGHT 0x1ac1
  1998. /* CUR blocks at 0x6998, 0x7598, 0x10198, 0x10d98, 0x11998, 0x12598 */
  1999. #define EVERGREEN_CUR_CONTROL 0x1a66
  2000. # define EVERGREEN_CURSOR_EN (1 << 0)
  2001. # define EVERGREEN_CURSOR_MODE(x) (((x) & 0x3) << 8)
  2002. # define EVERGREEN_CURSOR_MONO 0
  2003. # define EVERGREEN_CURSOR_24_1 1
  2004. # define EVERGREEN_CURSOR_24_8_PRE_MULT 2
  2005. # define EVERGREEN_CURSOR_24_8_UNPRE_MULT 3
  2006. # define EVERGREEN_CURSOR_2X_MAGNIFY (1 << 16)
  2007. # define EVERGREEN_CURSOR_FORCE_MC_ON (1 << 20)
  2008. # define EVERGREEN_CURSOR_URGENT_CONTROL(x) (((x) & 0x7) << 24)
  2009. # define EVERGREEN_CURSOR_URGENT_ALWAYS 0
  2010. # define EVERGREEN_CURSOR_URGENT_1_8 1
  2011. # define EVERGREEN_CURSOR_URGENT_1_4 2
  2012. # define EVERGREEN_CURSOR_URGENT_3_8 3
  2013. # define EVERGREEN_CURSOR_URGENT_1_2 4
  2014. #define EVERGREEN_CUR_SURFACE_ADDRESS 0x1a67
  2015. # define EVERGREEN_CUR_SURFACE_ADDRESS_MASK 0xfffff000
  2016. #define EVERGREEN_CUR_SIZE 0x1a68
  2017. #define EVERGREEN_CUR_SURFACE_ADDRESS_HIGH 0x1a69
  2018. #define EVERGREEN_CUR_POSITION 0x1a6a
  2019. #define EVERGREEN_CUR_HOT_SPOT 0x1a6b
  2020. #define EVERGREEN_CUR_COLOR1 0x1a6c
  2021. #define EVERGREEN_CUR_COLOR2 0x1a6d
  2022. #define EVERGREEN_CUR_UPDATE 0x1a6e
  2023. # define EVERGREEN_CURSOR_UPDATE_PENDING (1 << 0)
  2024. # define EVERGREEN_CURSOR_UPDATE_TAKEN (1 << 1)
  2025. # define EVERGREEN_CURSOR_UPDATE_LOCK (1 << 16)
  2026. # define EVERGREEN_CURSOR_DISABLE_MULTIPLE_UPDATE (1 << 24)
  2027. #define NI_INPUT_CSC_CONTROL 0x1a35
  2028. # define NI_INPUT_CSC_GRPH_MODE(x) (((x) & 0x3) << 0)
  2029. # define NI_INPUT_CSC_BYPASS 0
  2030. # define NI_INPUT_CSC_PROG_COEFF 1
  2031. # define NI_INPUT_CSC_PROG_SHARED_MATRIXA 2
  2032. # define NI_INPUT_CSC_OVL_MODE(x) (((x) & 0x3) << 4)
  2033. #define NI_OUTPUT_CSC_CONTROL 0x1a3c
  2034. # define NI_OUTPUT_CSC_GRPH_MODE(x) (((x) & 0x7) << 0)
  2035. # define NI_OUTPUT_CSC_BYPASS 0
  2036. # define NI_OUTPUT_CSC_TV_RGB 1
  2037. # define NI_OUTPUT_CSC_YCBCR_601 2
  2038. # define NI_OUTPUT_CSC_YCBCR_709 3
  2039. # define NI_OUTPUT_CSC_PROG_COEFF 4
  2040. # define NI_OUTPUT_CSC_PROG_SHARED_MATRIXB 5
  2041. # define NI_OUTPUT_CSC_OVL_MODE(x) (((x) & 0x7) << 4)
  2042. #define NI_DEGAMMA_CONTROL 0x1a58
  2043. # define NI_GRPH_DEGAMMA_MODE(x) (((x) & 0x3) << 0)
  2044. # define NI_DEGAMMA_BYPASS 0
  2045. # define NI_DEGAMMA_SRGB_24 1
  2046. # define NI_DEGAMMA_XVYCC_222 2
  2047. # define NI_OVL_DEGAMMA_MODE(x) (((x) & 0x3) << 4)
  2048. # define NI_ICON_DEGAMMA_MODE(x) (((x) & 0x3) << 8)
  2049. # define NI_CURSOR_DEGAMMA_MODE(x) (((x) & 0x3) << 12)
  2050. #define NI_GAMUT_REMAP_CONTROL 0x1a59
  2051. # define NI_GRPH_GAMUT_REMAP_MODE(x) (((x) & 0x3) << 0)
  2052. # define NI_GAMUT_REMAP_BYPASS 0
  2053. # define NI_GAMUT_REMAP_PROG_COEFF 1
  2054. # define NI_GAMUT_REMAP_PROG_SHARED_MATRIXA 2
  2055. # define NI_GAMUT_REMAP_PROG_SHARED_MATRIXB 3
  2056. # define NI_OVL_GAMUT_REMAP_MODE(x) (((x) & 0x3) << 4)
  2057. #define NI_REGAMMA_CONTROL 0x1aa0
  2058. # define NI_GRPH_REGAMMA_MODE(x) (((x) & 0x7) << 0)
  2059. # define NI_REGAMMA_BYPASS 0
  2060. # define NI_REGAMMA_SRGB_24 1
  2061. # define NI_REGAMMA_XVYCC_222 2
  2062. # define NI_REGAMMA_PROG_A 3
  2063. # define NI_REGAMMA_PROG_B 4
  2064. # define NI_OVL_REGAMMA_MODE(x) (((x) & 0x7) << 4)
  2065. #define NI_PRESCALE_GRPH_CONTROL 0x1a2d
  2066. # define NI_GRPH_PRESCALE_BYPASS (1 << 4)
  2067. #define NI_PRESCALE_OVL_CONTROL 0x1a31
  2068. # define NI_OVL_PRESCALE_BYPASS (1 << 4)
  2069. #define NI_INPUT_GAMMA_CONTROL 0x1a10
  2070. # define NI_GRPH_INPUT_GAMMA_MODE(x) (((x) & 0x3) << 0)
  2071. # define NI_INPUT_GAMMA_USE_LUT 0
  2072. # define NI_INPUT_GAMMA_BYPASS 1
  2073. # define NI_INPUT_GAMMA_SRGB_24 2
  2074. # define NI_INPUT_GAMMA_XVYCC_222 3
  2075. # define NI_OVL_INPUT_GAMMA_MODE(x) (((x) & 0x3) << 4)
  2076. #define IH_RB_WPTR__RB_OVERFLOW_MASK 0x1
  2077. #define IH_RB_CNTL__WPTR_OVERFLOW_CLEAR_MASK 0x80000000
  2078. #define SRBM_STATUS__IH_BUSY_MASK 0x20000
  2079. #define SRBM_SOFT_RESET__SOFT_RESET_IH_MASK 0x400
  2080. #define BLACKOUT_MODE_MASK 0x00000007
  2081. #define VGA_RENDER_CONTROL 0xC0
  2082. #define R_000300_VGA_RENDER_CONTROL 0xC0
  2083. #define C_000300_VGA_VSTATUS_CNTL 0xFFFCFFFF
  2084. #define EVERGREEN_CRTC_STATUS 0x1BA3
  2085. #define EVERGREEN_CRTC_V_BLANK (1 << 0)
  2086. #define EVERGREEN_CRTC_STATUS_POSITION 0x1BA4
  2087. /* CRTC blocks at 0x6df0, 0x79f0, 0x105f0, 0x111f0, 0x11df0, 0x129f0 */
  2088. #define EVERGREEN_CRTC_V_BLANK_START_END 0x1b8d
  2089. #define EVERGREEN_CRTC_CONTROL 0x1b9c
  2090. # define EVERGREEN_CRTC_MASTER_EN (1 << 0)
  2091. # define EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE (1 << 24)
  2092. #define EVERGREEN_CRTC_BLANK_CONTROL 0x1b9d
  2093. # define EVERGREEN_CRTC_BLANK_DATA_EN (1 << 8)
  2094. # define EVERGREEN_CRTC_V_BLANK (1 << 0)
  2095. #define EVERGREEN_CRTC_STATUS_HV_COUNT 0x1ba8
  2096. #define EVERGREEN_CRTC_UPDATE_LOCK 0x1bb5
  2097. #define EVERGREEN_MASTER_UPDATE_LOCK 0x1bbd
  2098. #define EVERGREEN_MASTER_UPDATE_MODE 0x1bbe
  2099. #define EVERGREEN_GRPH_UPDATE_LOCK (1 << 16)
  2100. #define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x1a07
  2101. #define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x1a08
  2102. #define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS 0x1a04
  2103. #define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS 0x1a05
  2104. #define EVERGREEN_GRPH_UPDATE 0x1a11
  2105. #define EVERGREEN_VGA_MEMORY_BASE_ADDRESS 0xc4
  2106. #define EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH 0xc9
  2107. #define EVERGREEN_GRPH_SURFACE_UPDATE_PENDING (1 << 2)
  2108. #define mmVM_CONTEXT1_CNTL__xxRANGE_PROTECTION_FAULT_ENABLE_DEFAULT_MASK 0x10
  2109. #define mmVM_CONTEXT1_CNTL__xxRANGE_PROTECTION_FAULT_ENABLE_DEFAULT__SHIFT 0x4
  2110. #define mmVM_CONTEXT1_CNTL__xxDUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT_MASK 0x80
  2111. #define mmVM_CONTEXT1_CNTL__xxDUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT__SHIFT 0x7
  2112. #define mmVM_CONTEXT1_CNTL__xxPDE0_PROTECTION_FAULT_ENABLE_DEFAULT_MASK 0x400
  2113. #define mmVM_CONTEXT1_CNTL__xxPDE0_PROTECTION_FAULT_ENABLE_DEFAULT__SHIFT 0xa
  2114. #define mmVM_CONTEXT1_CNTL__xxVALID_PROTECTION_FAULT_ENABLE_DEFAULT_MASK 0x2000
  2115. #define mmVM_CONTEXT1_CNTL__xxVALID_PROTECTION_FAULT_ENABLE_DEFAULT__SHIFT 0xd
  2116. #define mmVM_CONTEXT1_CNTL__xxREAD_PROTECTION_FAULT_ENABLE_DEFAULT_MASK 0x10000
  2117. #define mmVM_CONTEXT1_CNTL__xxREAD_PROTECTION_FAULT_ENABLE_DEFAULT__SHIFT 0x10
  2118. #define mmVM_CONTEXT1_CNTL__xxWRITE_PROTECTION_FAULT_ENABLE_DEFAULT_MASK 0x80000
  2119. #define mmVM_CONTEXT1_CNTL__xxWRITE_PROTECTION_FAULT_ENABLE_DEFAULT__SHIFT 0x13
  2120. #define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxVMID_MASK 0x1e000000
  2121. #define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxVMID__SHIFT 0x19
  2122. #define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxPROTECTIONS_MASK 0xff
  2123. #define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxPROTECTIONS__SHIFT 0x0
  2124. #define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxMEMORY_CLIENT_ID_MASK 0xff000
  2125. #define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxMEMORY_CLIENT_ID__SHIFT 0xc
  2126. #define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxMEMORY_CLIENT_RW_MASK 0x1000000
  2127. #define mmVM_CONTEXT1_PROTECTION_FAULT_STATUS__xxMEMORY_CLIENT_RW__SHIFT 0x18
  2128. #define mmMC_SHARED_BLACKOUT_CNTL__xxBLACKOUT_MODE_MASK 0x7
  2129. #define mmMC_SHARED_BLACKOUT_CNTL__xxBLACKOUT_MODE__SHIFT 0x0
  2130. #define mmBIF_FB_EN__xxFB_READ_EN_MASK 0x1
  2131. #define mmBIF_FB_EN__xxFB_READ_EN__SHIFT 0x0
  2132. #define mmBIF_FB_EN__xxFB_WRITE_EN_MASK 0x2
  2133. #define mmBIF_FB_EN__xxFB_WRITE_EN__SHIFT 0x1
  2134. #define mmSRBM_SOFT_RESET__xxSOFT_RESET_VMC_MASK 0x20000
  2135. #define mmSRBM_SOFT_RESET__xxSOFT_RESET_VMC__SHIFT 0x11
  2136. #define mmSRBM_SOFT_RESET__xxSOFT_RESET_MC_MASK 0x800
  2137. #define mmSRBM_SOFT_RESET__xxSOFT_RESET_MC__SHIFT 0xb
  2138. #define VM_CONTEXT1_CNTL__RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK 0x8
  2139. #define VM_CONTEXT1_CNTL__RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT__SHIFT 0x3
  2140. #define VM_CONTEXT1_CNTL__DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK 0x40
  2141. #define VM_CONTEXT1_CNTL__DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT__SHIFT 0x6
  2142. #define VM_CONTEXT1_CNTL__PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK 0x200
  2143. #define VM_CONTEXT1_CNTL__PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT__SHIFT 0x9
  2144. #define VM_CONTEXT1_CNTL__VALID_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK 0x1000
  2145. #define VM_CONTEXT1_CNTL__VALID_PROTECTION_FAULT_ENABLE_INTERRUPT__SHIFT 0xc
  2146. #define VM_CONTEXT1_CNTL__READ_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK 0x8000
  2147. #define VM_CONTEXT1_CNTL__READ_PROTECTION_FAULT_ENABLE_INTERRUPT__SHIFT 0xf
  2148. #define VM_CONTEXT1_CNTL__WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK 0x40000
  2149. #define VM_CONTEXT1_CNTL__WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT__SHIFT 0x12
  2150. #define MC_SEQ_MISC0__MT__MASK 0xf0000000
  2151. #define MC_SEQ_MISC0__MT__GDDR1 0x10000000
  2152. #define MC_SEQ_MISC0__MT__DDR2 0x20000000
  2153. #define MC_SEQ_MISC0__MT__GDDR3 0x30000000
  2154. #define MC_SEQ_MISC0__MT__GDDR4 0x40000000
  2155. #define MC_SEQ_MISC0__MT__GDDR5 0x50000000
  2156. #define MC_SEQ_MISC0__MT__HBM 0x60000000
  2157. #define MC_SEQ_MISC0__MT__DDR3 0xB0000000
  2158. #define SRBM_STATUS__MCB_BUSY_MASK 0x200
  2159. #define SRBM_STATUS__MCB_BUSY__SHIFT 0x9
  2160. #define SRBM_STATUS__MCB_NON_DISPLAY_BUSY_MASK 0x400
  2161. #define SRBM_STATUS__MCB_NON_DISPLAY_BUSY__SHIFT 0xa
  2162. #define SRBM_STATUS__MCC_BUSY_MASK 0x800
  2163. #define SRBM_STATUS__MCC_BUSY__SHIFT 0xb
  2164. #define SRBM_STATUS__MCD_BUSY_MASK 0x1000
  2165. #define SRBM_STATUS__MCD_BUSY__SHIFT 0xc
  2166. #define SRBM_STATUS__VMC_BUSY_MASK 0x100
  2167. #define SRBM_STATUS__VMC_BUSY__SHIFT 0x8
  2168. #define GRBM_STATUS__GUI_ACTIVE_MASK 0x80000000
  2169. #define CP_INT_CNTL_RING__TIME_STAMP_INT_ENABLE_MASK 0x4000000
  2170. #define CP_INT_CNTL_RING0__PRIV_REG_INT_ENABLE_MASK 0x800000
  2171. #define CP_INT_CNTL_RING0__PRIV_INSTR_INT_ENABLE_MASK 0x400000
  2172. #define PACKET3_SEM_WAIT_ON_SIGNAL (0x1 << 12)
  2173. #define PACKET3_SEM_SEL_SIGNAL (0x6 << 29)
  2174. #define PACKET3_SEM_SEL_WAIT (0x7 << 29)
  2175. #define CONFIG_CNTL 0x1509
  2176. #define CC_DRM_ID_STRAPS 0X1559
  2177. #define AMDGPU_PCIE_INDEX 0xc
  2178. #define AMDGPU_PCIE_DATA 0xd
  2179. #define DMA_SEM_INCOMPLETE_TIMER_CNTL 0x3411
  2180. #define DMA_SEM_WAIT_FAIL_TIMER_CNTL 0x3412
  2181. #define DMA_MODE 0x342f
  2182. #define DMA_RB_RPTR_ADDR_HI 0x3407
  2183. #define DMA_RB_RPTR_ADDR_LO 0x3408
  2184. #define DMA_BUSY_MASK 0x20
  2185. #define DMA1_BUSY_MASK 0X40
  2186. #define SDMA_MAX_INSTANCE 2
  2187. #define PCIE_BUS_CLK 10000
  2188. #define TCLK (PCIE_BUS_CLK / 10)
  2189. #define CC_DRM_ID_STRAPS__ATI_REV_ID_MASK 0xf0000000
  2190. #define CC_DRM_ID_STRAPS__ATI_REV_ID__SHIFT 0x1c
  2191. #define PCIE_PORT_INDEX 0xe
  2192. #define PCIE_PORT_DATA 0xf
  2193. #define EVERGREEN_PIF_PHY0_INDEX 0x8
  2194. #define EVERGREEN_PIF_PHY0_DATA 0xc
  2195. #define EVERGREEN_PIF_PHY1_INDEX 0x10
  2196. #define EVERGREEN_PIF_PHY1_DATA 0x14
  2197. #define MC_VM_FB_OFFSET 0x81a
  2198. #endif