nid.h 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368
  1. /*
  2. * Copyright 2010 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 NI_H
  25. #define NI_H
  26. #define CAYMAN_MAX_SH_GPRS 256
  27. #define CAYMAN_MAX_TEMP_GPRS 16
  28. #define CAYMAN_MAX_SH_THREADS 256
  29. #define CAYMAN_MAX_SH_STACK_ENTRIES 4096
  30. #define CAYMAN_MAX_FRC_EOV_CNT 16384
  31. #define CAYMAN_MAX_BACKENDS 8
  32. #define CAYMAN_MAX_BACKENDS_MASK 0xFF
  33. #define CAYMAN_MAX_BACKENDS_PER_SE_MASK 0xF
  34. #define CAYMAN_MAX_SIMDS 16
  35. #define CAYMAN_MAX_SIMDS_MASK 0xFFFF
  36. #define CAYMAN_MAX_SIMDS_PER_SE_MASK 0xFFF
  37. #define CAYMAN_MAX_PIPES 8
  38. #define CAYMAN_MAX_PIPES_MASK 0xFF
  39. #define CAYMAN_MAX_LDS_NUM 0xFFFF
  40. #define CAYMAN_MAX_TCC 16
  41. #define CAYMAN_MAX_TCC_MASK 0xFF
  42. #define CAYMAN_GB_ADDR_CONFIG_GOLDEN 0x02011003
  43. #define ARUBA_GB_ADDR_CONFIG_GOLDEN 0x12010001
  44. #define DMIF_ADDR_CONFIG 0xBD4
  45. /* fusion vce clocks */
  46. #define CG_ECLK_CNTL 0x620
  47. # define ECLK_DIVIDER_MASK 0x7f
  48. # define ECLK_DIR_CNTL_EN (1 << 8)
  49. #define CG_ECLK_STATUS 0x624
  50. # define ECLK_STATUS (1 << 0)
  51. /* DCE6 only */
  52. #define DMIF_ADDR_CALC 0xC00
  53. #define SRBM_GFX_CNTL 0x0E44
  54. #define RINGID(x) (((x) & 0x3) << 0)
  55. #define VMID(x) (((x) & 0x7) << 0)
  56. #define SRBM_STATUS 0x0E50
  57. #define RLC_RQ_PENDING (1 << 3)
  58. #define GRBM_RQ_PENDING (1 << 5)
  59. #define VMC_BUSY (1 << 8)
  60. #define MCB_BUSY (1 << 9)
  61. #define MCB_NON_DISPLAY_BUSY (1 << 10)
  62. #define MCC_BUSY (1 << 11)
  63. #define MCD_BUSY (1 << 12)
  64. #define SEM_BUSY (1 << 14)
  65. #define RLC_BUSY (1 << 15)
  66. #define IH_BUSY (1 << 17)
  67. #define SRBM_SOFT_RESET 0x0E60
  68. #define SOFT_RESET_BIF (1 << 1)
  69. #define SOFT_RESET_CG (1 << 2)
  70. #define SOFT_RESET_DC (1 << 5)
  71. #define SOFT_RESET_DMA1 (1 << 6)
  72. #define SOFT_RESET_GRBM (1 << 8)
  73. #define SOFT_RESET_HDP (1 << 9)
  74. #define SOFT_RESET_IH (1 << 10)
  75. #define SOFT_RESET_MC (1 << 11)
  76. #define SOFT_RESET_RLC (1 << 13)
  77. #define SOFT_RESET_ROM (1 << 14)
  78. #define SOFT_RESET_SEM (1 << 15)
  79. #define SOFT_RESET_VMC (1 << 17)
  80. #define SOFT_RESET_DMA (1 << 20)
  81. #define SOFT_RESET_TST (1 << 21)
  82. #define SOFT_RESET_REGBB (1 << 22)
  83. #define SOFT_RESET_ORB (1 << 23)
  84. #define SRBM_READ_ERROR 0xE98
  85. #define SRBM_INT_CNTL 0xEA0
  86. #define SRBM_INT_ACK 0xEA8
  87. #define SRBM_STATUS2 0x0EC4
  88. #define DMA_BUSY (1 << 5)
  89. #define DMA1_BUSY (1 << 6)
  90. #define VM_CONTEXT0_REQUEST_RESPONSE 0x1470
  91. #define REQUEST_TYPE(x) (((x) & 0xf) << 0)
  92. #define RESPONSE_TYPE_MASK 0x000000F0
  93. #define RESPONSE_TYPE_SHIFT 4
  94. #define VM_L2_CNTL 0x1400
  95. #define ENABLE_L2_CACHE (1 << 0)
  96. #define ENABLE_L2_FRAGMENT_PROCESSING (1 << 1)
  97. #define ENABLE_L2_PTE_CACHE_LRU_UPDATE_BY_WRITE (1 << 9)
  98. #define ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE (1 << 10)
  99. #define EFFECTIVE_L2_QUEUE_SIZE(x) (((x) & 7) << 14)
  100. #define CONTEXT1_IDENTITY_ACCESS_MODE(x) (((x) & 3) << 18)
  101. /* CONTEXT1_IDENTITY_ACCESS_MODE
  102. * 0 physical = logical
  103. * 1 logical via context1 page table
  104. * 2 inside identity aperture use translation, outside physical = logical
  105. * 3 inside identity aperture physical = logical, outside use translation
  106. */
  107. #define VM_L2_CNTL2 0x1404
  108. #define INVALIDATE_ALL_L1_TLBS (1 << 0)
  109. #define INVALIDATE_L2_CACHE (1 << 1)
  110. #define VM_L2_CNTL3 0x1408
  111. #define BANK_SELECT(x) ((x) << 0)
  112. #define CACHE_UPDATE_MODE(x) ((x) << 6)
  113. #define L2_CACHE_BIGK_ASSOCIATIVITY (1 << 20)
  114. #define L2_CACHE_BIGK_FRAGMENT_SIZE(x) ((x) << 15)
  115. #define VM_L2_STATUS 0x140C
  116. #define L2_BUSY (1 << 0)
  117. #define VM_CONTEXT0_CNTL 0x1410
  118. #define ENABLE_CONTEXT (1 << 0)
  119. #define PAGE_TABLE_DEPTH(x) (((x) & 3) << 1)
  120. #define RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 3)
  121. #define RANGE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 4)
  122. #define DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 6)
  123. #define DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 7)
  124. #define PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 9)
  125. #define PDE0_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 10)
  126. #define VALID_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 12)
  127. #define VALID_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 13)
  128. #define READ_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 15)
  129. #define READ_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 16)
  130. #define WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 18)
  131. #define WRITE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 19)
  132. #define PAGE_TABLE_BLOCK_SIZE(x) (((x) & 0xF) << 24)
  133. #define VM_CONTEXT1_CNTL 0x1414
  134. #define VM_CONTEXT0_CNTL2 0x1430
  135. #define VM_CONTEXT1_CNTL2 0x1434
  136. #define VM_INVALIDATE_REQUEST 0x1478
  137. #define VM_INVALIDATE_RESPONSE 0x147c
  138. #define VM_CONTEXT1_PROTECTION_FAULT_ADDR 0x14FC
  139. #define VM_CONTEXT1_PROTECTION_FAULT_STATUS 0x14DC
  140. #define PROTECTIONS_MASK (0xf << 0)
  141. #define PROTECTIONS_SHIFT 0
  142. /* bit 0: range
  143. * bit 2: pde0
  144. * bit 3: valid
  145. * bit 4: read
  146. * bit 5: write
  147. */
  148. #define MEMORY_CLIENT_ID_MASK (0xff << 12)
  149. #define MEMORY_CLIENT_ID_SHIFT 12
  150. #define MEMORY_CLIENT_RW_MASK (1 << 24)
  151. #define MEMORY_CLIENT_RW_SHIFT 24
  152. #define FAULT_VMID_MASK (0x7 << 25)
  153. #define FAULT_VMID_SHIFT 25
  154. #define VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR 0x1518
  155. #define VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR 0x151c
  156. #define VM_CONTEXT0_PAGE_TABLE_BASE_ADDR 0x153C
  157. #define VM_CONTEXT0_PAGE_TABLE_START_ADDR 0x155C
  158. #define VM_CONTEXT0_PAGE_TABLE_END_ADDR 0x157C
  159. #define MC_SHARED_CHMAP 0x2004
  160. #define NOOFCHAN_SHIFT 12
  161. #define NOOFCHAN_MASK 0x00003000
  162. #define MC_SHARED_CHREMAP 0x2008
  163. #define MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2034
  164. #define MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038
  165. #define MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203C
  166. #define MC_VM_MX_L1_TLB_CNTL 0x2064
  167. #define ENABLE_L1_TLB (1 << 0)
  168. #define ENABLE_L1_FRAGMENT_PROCESSING (1 << 1)
  169. #define SYSTEM_ACCESS_MODE_PA_ONLY (0 << 3)
  170. #define SYSTEM_ACCESS_MODE_USE_SYS_MAP (1 << 3)
  171. #define SYSTEM_ACCESS_MODE_IN_SYS (2 << 3)
  172. #define SYSTEM_ACCESS_MODE_NOT_IN_SYS (3 << 3)
  173. #define SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU (0 << 5)
  174. #define ENABLE_ADVANCED_DRIVER_MODEL (1 << 6)
  175. #define FUS_MC_VM_FB_OFFSET 0x2068
  176. #define MC_SHARED_BLACKOUT_CNTL 0x20ac
  177. #define MC_ARB_RAMCFG 0x2760
  178. #define NOOFBANK_SHIFT 0
  179. #define NOOFBANK_MASK 0x00000003
  180. #define NOOFRANK_SHIFT 2
  181. #define NOOFRANK_MASK 0x00000004
  182. #define NOOFROWS_SHIFT 3
  183. #define NOOFROWS_MASK 0x00000038
  184. #define NOOFCOLS_SHIFT 6
  185. #define NOOFCOLS_MASK 0x000000C0
  186. #define CHANSIZE_SHIFT 8
  187. #define CHANSIZE_MASK 0x00000100
  188. #define BURSTLENGTH_SHIFT 9
  189. #define BURSTLENGTH_MASK 0x00000200
  190. #define CHANSIZE_OVERRIDE (1 << 11)
  191. #define MC_SEQ_SUP_CNTL 0x28c8
  192. #define RUN_MASK (1 << 0)
  193. #define MC_SEQ_SUP_PGM 0x28cc
  194. #define MC_IO_PAD_CNTL_D0 0x29d0
  195. #define MEM_FALL_OUT_CMD (1 << 8)
  196. #define MC_SEQ_MISC0 0x2a00
  197. #define MC_SEQ_MISC0_GDDR5_SHIFT 28
  198. #define MC_SEQ_MISC0_GDDR5_MASK 0xf0000000
  199. #define MC_SEQ_MISC0_GDDR5_VALUE 5
  200. #define MC_SEQ_IO_DEBUG_INDEX 0x2a44
  201. #define MC_SEQ_IO_DEBUG_DATA 0x2a48
  202. #define HDP_HOST_PATH_CNTL 0x2C00
  203. #define HDP_NONSURFACE_BASE 0x2C04
  204. #define HDP_NONSURFACE_INFO 0x2C08
  205. #define HDP_NONSURFACE_SIZE 0x2C0C
  206. #define HDP_ADDR_CONFIG 0x2F48
  207. #define HDP_MISC_CNTL 0x2F4C
  208. #define HDP_FLUSH_INVALIDATE_CACHE (1 << 0)
  209. #define CC_SYS_RB_BACKEND_DISABLE 0x3F88
  210. #define GC_USER_SYS_RB_BACKEND_DISABLE 0x3F8C
  211. #define CGTS_SYS_TCC_DISABLE 0x3F90
  212. #define CGTS_USER_SYS_TCC_DISABLE 0x3F94
  213. #define RLC_GFX_INDEX 0x3FC4
  214. #define CONFIG_MEMSIZE 0x5428
  215. #define HDP_MEM_COHERENCY_FLUSH_CNTL 0x5480
  216. #define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0
  217. #define GRBM_CNTL 0x8000
  218. #define GRBM_READ_TIMEOUT(x) ((x) << 0)
  219. #define GRBM_STATUS 0x8010
  220. #define CMDFIFO_AVAIL_MASK 0x0000000F
  221. #define RING2_RQ_PENDING (1 << 4)
  222. #define SRBM_RQ_PENDING (1 << 5)
  223. #define RING1_RQ_PENDING (1 << 6)
  224. #define CF_RQ_PENDING (1 << 7)
  225. #define PF_RQ_PENDING (1 << 8)
  226. #define GDS_DMA_RQ_PENDING (1 << 9)
  227. #define GRBM_EE_BUSY (1 << 10)
  228. #define SX_CLEAN (1 << 11)
  229. #define DB_CLEAN (1 << 12)
  230. #define CB_CLEAN (1 << 13)
  231. #define TA_BUSY (1 << 14)
  232. #define GDS_BUSY (1 << 15)
  233. #define VGT_BUSY_NO_DMA (1 << 16)
  234. #define VGT_BUSY (1 << 17)
  235. #define IA_BUSY_NO_DMA (1 << 18)
  236. #define IA_BUSY (1 << 19)
  237. #define SX_BUSY (1 << 20)
  238. #define SH_BUSY (1 << 21)
  239. #define SPI_BUSY (1 << 22)
  240. #define SC_BUSY (1 << 24)
  241. #define PA_BUSY (1 << 25)
  242. #define DB_BUSY (1 << 26)
  243. #define CP_COHERENCY_BUSY (1 << 28)
  244. #define CP_BUSY (1 << 29)
  245. #define CB_BUSY (1 << 30)
  246. #define GUI_ACTIVE (1 << 31)
  247. #define GRBM_STATUS_SE0 0x8014
  248. #define GRBM_STATUS_SE1 0x8018
  249. #define SE_SX_CLEAN (1 << 0)
  250. #define SE_DB_CLEAN (1 << 1)
  251. #define SE_CB_CLEAN (1 << 2)
  252. #define SE_VGT_BUSY (1 << 23)
  253. #define SE_PA_BUSY (1 << 24)
  254. #define SE_TA_BUSY (1 << 25)
  255. #define SE_SX_BUSY (1 << 26)
  256. #define SE_SPI_BUSY (1 << 27)
  257. #define SE_SH_BUSY (1 << 28)
  258. #define SE_SC_BUSY (1 << 29)
  259. #define SE_DB_BUSY (1 << 30)
  260. #define SE_CB_BUSY (1 << 31)
  261. #define GRBM_SOFT_RESET 0x8020
  262. #define SOFT_RESET_CP (1 << 0)
  263. #define SOFT_RESET_CB (1 << 1)
  264. #define SOFT_RESET_DB (1 << 3)
  265. #define SOFT_RESET_GDS (1 << 4)
  266. #define SOFT_RESET_PA (1 << 5)
  267. #define SOFT_RESET_SC (1 << 6)
  268. #define SOFT_RESET_SPI (1 << 8)
  269. #define SOFT_RESET_SH (1 << 9)
  270. #define SOFT_RESET_SX (1 << 10)
  271. #define SOFT_RESET_TC (1 << 11)
  272. #define SOFT_RESET_TA (1 << 12)
  273. #define SOFT_RESET_VGT (1 << 14)
  274. #define SOFT_RESET_IA (1 << 15)
  275. #define GRBM_GFX_INDEX 0x802C
  276. #define INSTANCE_INDEX(x) ((x) << 0)
  277. #define SE_INDEX(x) ((x) << 16)
  278. #define INSTANCE_BROADCAST_WRITES (1 << 30)
  279. #define SE_BROADCAST_WRITES (1 << 31)
  280. #define SCRATCH_REG0 0x8500
  281. #define SCRATCH_REG1 0x8504
  282. #define SCRATCH_REG2 0x8508
  283. #define SCRATCH_REG3 0x850C
  284. #define SCRATCH_REG4 0x8510
  285. #define SCRATCH_REG5 0x8514
  286. #define SCRATCH_REG6 0x8518
  287. #define SCRATCH_REG7 0x851C
  288. #define SCRATCH_UMSK 0x8540
  289. #define SCRATCH_ADDR 0x8544
  290. #define CP_SEM_WAIT_TIMER 0x85BC
  291. #define CP_SEM_INCOMPLETE_TIMER_CNTL 0x85C8
  292. #define CP_COHER_CNTL2 0x85E8
  293. #define CP_STALLED_STAT1 0x8674
  294. #define CP_STALLED_STAT2 0x8678
  295. #define CP_BUSY_STAT 0x867C
  296. #define CP_STAT 0x8680
  297. #define CP_ME_CNTL 0x86D8
  298. #define CP_ME_HALT (1 << 28)
  299. #define CP_PFP_HALT (1 << 26)
  300. #define CP_RB2_RPTR 0x86f8
  301. #define CP_RB1_RPTR 0x86fc
  302. #define CP_RB0_RPTR 0x8700
  303. #define CP_RB_WPTR_DELAY 0x8704
  304. #define CP_MEQ_THRESHOLDS 0x8764
  305. #define MEQ1_START(x) ((x) << 0)
  306. #define MEQ2_START(x) ((x) << 8)
  307. #define CP_PERFMON_CNTL 0x87FC
  308. #define VGT_CACHE_INVALIDATION 0x88C4
  309. #define CACHE_INVALIDATION(x) ((x) << 0)
  310. #define VC_ONLY 0
  311. #define TC_ONLY 1
  312. #define VC_AND_TC 2
  313. #define AUTO_INVLD_EN(x) ((x) << 6)
  314. #define NO_AUTO 0
  315. #define ES_AUTO 1
  316. #define GS_AUTO 2
  317. #define ES_AND_GS_AUTO 3
  318. #define VGT_GS_VERTEX_REUSE 0x88D4
  319. #define CC_GC_SHADER_PIPE_CONFIG 0x8950
  320. #define GC_USER_SHADER_PIPE_CONFIG 0x8954
  321. #define INACTIVE_QD_PIPES(x) ((x) << 8)
  322. #define INACTIVE_QD_PIPES_MASK 0x0000FF00
  323. #define INACTIVE_QD_PIPES_SHIFT 8
  324. #define INACTIVE_SIMDS(x) ((x) << 16)
  325. #define INACTIVE_SIMDS_MASK 0xFFFF0000
  326. #define INACTIVE_SIMDS_SHIFT 16
  327. #define VGT_PRIMITIVE_TYPE 0x8958
  328. #define VGT_NUM_INSTANCES 0x8974
  329. #define VGT_TF_RING_SIZE 0x8988
  330. #define VGT_OFFCHIP_LDS_BASE 0x89b4
  331. #define PA_SC_LINE_STIPPLE_STATE 0x8B10
  332. #define PA_CL_ENHANCE 0x8A14
  333. #define CLIP_VTX_REORDER_ENA (1 << 0)
  334. #define NUM_CLIP_SEQ(x) ((x) << 1)
  335. #define PA_SC_FIFO_SIZE 0x8BCC
  336. #define SC_PRIM_FIFO_SIZE(x) ((x) << 0)
  337. #define SC_HIZ_TILE_FIFO_SIZE(x) ((x) << 12)
  338. #define SC_EARLYZ_TILE_FIFO_SIZE(x) ((x) << 20)
  339. #define PA_SC_FORCE_EOV_MAX_CNTS 0x8B24
  340. #define FORCE_EOV_MAX_CLK_CNT(x) ((x) << 0)
  341. #define FORCE_EOV_MAX_REZ_CNT(x) ((x) << 16)
  342. #define SQ_CONFIG 0x8C00
  343. #define VC_ENABLE (1 << 0)
  344. #define EXPORT_SRC_C (1 << 1)
  345. #define GFX_PRIO(x) ((x) << 2)
  346. #define CS1_PRIO(x) ((x) << 4)
  347. #define CS2_PRIO(x) ((x) << 6)
  348. #define SQ_GPR_RESOURCE_MGMT_1 0x8C04
  349. #define NUM_PS_GPRS(x) ((x) << 0)
  350. #define NUM_VS_GPRS(x) ((x) << 16)
  351. #define NUM_CLAUSE_TEMP_GPRS(x) ((x) << 28)
  352. #define SQ_ESGS_RING_SIZE 0x8c44
  353. #define SQ_GSVS_RING_SIZE 0x8c4c
  354. #define SQ_ESTMP_RING_BASE 0x8c50
  355. #define SQ_ESTMP_RING_SIZE 0x8c54
  356. #define SQ_GSTMP_RING_BASE 0x8c58
  357. #define SQ_GSTMP_RING_SIZE 0x8c5c
  358. #define SQ_VSTMP_RING_BASE 0x8c60
  359. #define SQ_VSTMP_RING_SIZE 0x8c64
  360. #define SQ_PSTMP_RING_BASE 0x8c68
  361. #define SQ_PSTMP_RING_SIZE 0x8c6c
  362. #define SQ_MS_FIFO_SIZES 0x8CF0
  363. #define CACHE_FIFO_SIZE(x) ((x) << 0)
  364. #define FETCH_FIFO_HIWATER(x) ((x) << 8)
  365. #define DONE_FIFO_HIWATER(x) ((x) << 16)
  366. #define ALU_UPDATE_FIFO_HIWATER(x) ((x) << 24)
  367. #define SQ_LSTMP_RING_BASE 0x8e10
  368. #define SQ_LSTMP_RING_SIZE 0x8e14
  369. #define SQ_HSTMP_RING_BASE 0x8e18
  370. #define SQ_HSTMP_RING_SIZE 0x8e1c
  371. #define SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 0x8D8C
  372. #define DYN_GPR_ENABLE (1 << 8)
  373. #define SQ_CONST_MEM_BASE 0x8df8
  374. #define SX_EXPORT_BUFFER_SIZES 0x900C
  375. #define COLOR_BUFFER_SIZE(x) ((x) << 0)
  376. #define POSITION_BUFFER_SIZE(x) ((x) << 8)
  377. #define SMX_BUFFER_SIZE(x) ((x) << 16)
  378. #define SX_DEBUG_1 0x9058
  379. #define ENABLE_NEW_SMX_ADDRESS (1 << 16)
  380. #define SPI_CONFIG_CNTL 0x9100
  381. #define GPR_WRITE_PRIORITY(x) ((x) << 0)
  382. #define SPI_CONFIG_CNTL_1 0x913C
  383. #define VTX_DONE_DELAY(x) ((x) << 0)
  384. #define INTERP_ONE_PRIM_PER_ROW (1 << 4)
  385. #define CRC_SIMD_ID_WADDR_DISABLE (1 << 8)
  386. #define CGTS_TCC_DISABLE 0x9148
  387. #define CGTS_USER_TCC_DISABLE 0x914C
  388. #define TCC_DISABLE_MASK 0xFFFF0000
  389. #define TCC_DISABLE_SHIFT 16
  390. #define CGTS_SM_CTRL_REG 0x9150
  391. #define OVERRIDE (1 << 21)
  392. #define TA_CNTL_AUX 0x9508
  393. #define DISABLE_CUBE_WRAP (1 << 0)
  394. #define DISABLE_CUBE_ANISO (1 << 1)
  395. #define TCP_CHAN_STEER_LO 0x960c
  396. #define TCP_CHAN_STEER_HI 0x9610
  397. #define CC_RB_BACKEND_DISABLE 0x98F4
  398. #define BACKEND_DISABLE(x) ((x) << 16)
  399. #define GB_ADDR_CONFIG 0x98F8
  400. #define NUM_PIPES(x) ((x) << 0)
  401. #define NUM_PIPES_MASK 0x00000007
  402. #define NUM_PIPES_SHIFT 0
  403. #define PIPE_INTERLEAVE_SIZE(x) ((x) << 4)
  404. #define PIPE_INTERLEAVE_SIZE_MASK 0x00000070
  405. #define PIPE_INTERLEAVE_SIZE_SHIFT 4
  406. #define BANK_INTERLEAVE_SIZE(x) ((x) << 8)
  407. #define NUM_SHADER_ENGINES(x) ((x) << 12)
  408. #define NUM_SHADER_ENGINES_MASK 0x00003000
  409. #define NUM_SHADER_ENGINES_SHIFT 12
  410. #define SHADER_ENGINE_TILE_SIZE(x) ((x) << 16)
  411. #define SHADER_ENGINE_TILE_SIZE_MASK 0x00070000
  412. #define SHADER_ENGINE_TILE_SIZE_SHIFT 16
  413. #define NUM_GPUS(x) ((x) << 20)
  414. #define NUM_GPUS_MASK 0x00700000
  415. #define NUM_GPUS_SHIFT 20
  416. #define MULTI_GPU_TILE_SIZE(x) ((x) << 24)
  417. #define MULTI_GPU_TILE_SIZE_MASK 0x03000000
  418. #define MULTI_GPU_TILE_SIZE_SHIFT 24
  419. #define ROW_SIZE(x) ((x) << 28)
  420. #define ROW_SIZE_MASK 0x30000000
  421. #define ROW_SIZE_SHIFT 28
  422. #define NUM_LOWER_PIPES(x) ((x) << 30)
  423. #define NUM_LOWER_PIPES_MASK 0x40000000
  424. #define NUM_LOWER_PIPES_SHIFT 30
  425. #define GB_BACKEND_MAP 0x98FC
  426. #define CB_PERF_CTR0_SEL_0 0x9A20
  427. #define CB_PERF_CTR0_SEL_1 0x9A24
  428. #define CB_PERF_CTR1_SEL_0 0x9A28
  429. #define CB_PERF_CTR1_SEL_1 0x9A2C
  430. #define CB_PERF_CTR2_SEL_0 0x9A30
  431. #define CB_PERF_CTR2_SEL_1 0x9A34
  432. #define CB_PERF_CTR3_SEL_0 0x9A38
  433. #define CB_PERF_CTR3_SEL_1 0x9A3C
  434. #define GC_USER_RB_BACKEND_DISABLE 0x9B7C
  435. #define BACKEND_DISABLE_MASK 0x00FF0000
  436. #define BACKEND_DISABLE_SHIFT 16
  437. #define SMX_DC_CTL0 0xA020
  438. #define USE_HASH_FUNCTION (1 << 0)
  439. #define NUMBER_OF_SETS(x) ((x) << 1)
  440. #define FLUSH_ALL_ON_EVENT (1 << 10)
  441. #define STALL_ON_EVENT (1 << 11)
  442. #define SMX_EVENT_CTL 0xA02C
  443. #define ES_FLUSH_CTL(x) ((x) << 0)
  444. #define GS_FLUSH_CTL(x) ((x) << 3)
  445. #define ACK_FLUSH_CTL(x) ((x) << 6)
  446. #define SYNC_FLUSH_CTL (1 << 8)
  447. #define CP_RB0_BASE 0xC100
  448. #define CP_RB0_CNTL 0xC104
  449. #define RB_BUFSZ(x) ((x) << 0)
  450. #define RB_BLKSZ(x) ((x) << 8)
  451. #define RB_NO_UPDATE (1 << 27)
  452. #define RB_RPTR_WR_ENA (1 << 31)
  453. #define BUF_SWAP_32BIT (2 << 16)
  454. #define CP_RB0_RPTR_ADDR 0xC10C
  455. #define CP_RB0_RPTR_ADDR_HI 0xC110
  456. #define CP_RB0_WPTR 0xC114
  457. #define CP_INT_CNTL 0xC124
  458. # define CNTX_BUSY_INT_ENABLE (1 << 19)
  459. # define CNTX_EMPTY_INT_ENABLE (1 << 20)
  460. # define TIME_STAMP_INT_ENABLE (1 << 26)
  461. #define CP_RB1_BASE 0xC180
  462. #define CP_RB1_CNTL 0xC184
  463. #define CP_RB1_RPTR_ADDR 0xC188
  464. #define CP_RB1_RPTR_ADDR_HI 0xC18C
  465. #define CP_RB1_WPTR 0xC190
  466. #define CP_RB2_BASE 0xC194
  467. #define CP_RB2_CNTL 0xC198
  468. #define CP_RB2_RPTR_ADDR 0xC19C
  469. #define CP_RB2_RPTR_ADDR_HI 0xC1A0
  470. #define CP_RB2_WPTR 0xC1A4
  471. #define CP_PFP_UCODE_ADDR 0xC150
  472. #define CP_PFP_UCODE_DATA 0xC154
  473. #define CP_ME_RAM_RADDR 0xC158
  474. #define CP_ME_RAM_WADDR 0xC15C
  475. #define CP_ME_RAM_DATA 0xC160
  476. #define CP_DEBUG 0xC1FC
  477. #define VGT_EVENT_INITIATOR 0x28a90
  478. # define CACHE_FLUSH_AND_INV_EVENT_TS (0x14 << 0)
  479. # define CACHE_FLUSH_AND_INV_EVENT (0x16 << 0)
  480. /* TN SMU registers */
  481. #define TN_CURRENT_GNB_TEMP 0x1F390
  482. /* pm registers */
  483. #define SMC_MSG 0x20c
  484. #define HOST_SMC_MSG(x) ((x) << 0)
  485. #define HOST_SMC_MSG_MASK (0xff << 0)
  486. #define HOST_SMC_MSG_SHIFT 0
  487. #define HOST_SMC_RESP(x) ((x) << 8)
  488. #define HOST_SMC_RESP_MASK (0xff << 8)
  489. #define HOST_SMC_RESP_SHIFT 8
  490. #define SMC_HOST_MSG(x) ((x) << 16)
  491. #define SMC_HOST_MSG_MASK (0xff << 16)
  492. #define SMC_HOST_MSG_SHIFT 16
  493. #define SMC_HOST_RESP(x) ((x) << 24)
  494. #define SMC_HOST_RESP_MASK (0xff << 24)
  495. #define SMC_HOST_RESP_SHIFT 24
  496. #define CG_SPLL_FUNC_CNTL 0x600
  497. #define SPLL_RESET (1 << 0)
  498. #define SPLL_SLEEP (1 << 1)
  499. #define SPLL_BYPASS_EN (1 << 3)
  500. #define SPLL_REF_DIV(x) ((x) << 4)
  501. #define SPLL_REF_DIV_MASK (0x3f << 4)
  502. #define SPLL_PDIV_A(x) ((x) << 20)
  503. #define SPLL_PDIV_A_MASK (0x7f << 20)
  504. #define SPLL_PDIV_A_SHIFT 20
  505. #define CG_SPLL_FUNC_CNTL_2 0x604
  506. #define SCLK_MUX_SEL(x) ((x) << 0)
  507. #define SCLK_MUX_SEL_MASK (0x1ff << 0)
  508. #define CG_SPLL_FUNC_CNTL_3 0x608
  509. #define SPLL_FB_DIV(x) ((x) << 0)
  510. #define SPLL_FB_DIV_MASK (0x3ffffff << 0)
  511. #define SPLL_FB_DIV_SHIFT 0
  512. #define SPLL_DITHEN (1 << 28)
  513. #define MPLL_CNTL_MODE 0x61c
  514. # define SS_SSEN (1 << 24)
  515. # define SS_DSMODE_EN (1 << 25)
  516. #define MPLL_AD_FUNC_CNTL 0x624
  517. #define CLKF(x) ((x) << 0)
  518. #define CLKF_MASK (0x7f << 0)
  519. #define CLKR(x) ((x) << 7)
  520. #define CLKR_MASK (0x1f << 7)
  521. #define CLKFRAC(x) ((x) << 12)
  522. #define CLKFRAC_MASK (0x1f << 12)
  523. #define YCLK_POST_DIV(x) ((x) << 17)
  524. #define YCLK_POST_DIV_MASK (3 << 17)
  525. #define IBIAS(x) ((x) << 20)
  526. #define IBIAS_MASK (0x3ff << 20)
  527. #define RESET (1 << 30)
  528. #define PDNB (1 << 31)
  529. #define MPLL_AD_FUNC_CNTL_2 0x628
  530. #define BYPASS (1 << 19)
  531. #define BIAS_GEN_PDNB (1 << 24)
  532. #define RESET_EN (1 << 25)
  533. #define VCO_MODE (1 << 29)
  534. #define MPLL_DQ_FUNC_CNTL 0x62c
  535. #define MPLL_DQ_FUNC_CNTL_2 0x630
  536. #define GENERAL_PWRMGT 0x63c
  537. # define GLOBAL_PWRMGT_EN (1 << 0)
  538. # define STATIC_PM_EN (1 << 1)
  539. # define THERMAL_PROTECTION_DIS (1 << 2)
  540. # define THERMAL_PROTECTION_TYPE (1 << 3)
  541. # define ENABLE_GEN2PCIE (1 << 4)
  542. # define ENABLE_GEN2XSP (1 << 5)
  543. # define SW_SMIO_INDEX(x) ((x) << 6)
  544. # define SW_SMIO_INDEX_MASK (3 << 6)
  545. # define SW_SMIO_INDEX_SHIFT 6
  546. # define LOW_VOLT_D2_ACPI (1 << 8)
  547. # define LOW_VOLT_D3_ACPI (1 << 9)
  548. # define VOLT_PWRMGT_EN (1 << 10)
  549. # define BACKBIAS_PAD_EN (1 << 18)
  550. # define BACKBIAS_VALUE (1 << 19)
  551. # define DYN_SPREAD_SPECTRUM_EN (1 << 23)
  552. # define AC_DC_SW (1 << 24)
  553. #define SCLK_PWRMGT_CNTL 0x644
  554. # define SCLK_PWRMGT_OFF (1 << 0)
  555. # define SCLK_LOW_D1 (1 << 1)
  556. # define FIR_RESET (1 << 4)
  557. # define FIR_FORCE_TREND_SEL (1 << 5)
  558. # define FIR_TREND_MODE (1 << 6)
  559. # define DYN_GFX_CLK_OFF_EN (1 << 7)
  560. # define GFX_CLK_FORCE_ON (1 << 8)
  561. # define GFX_CLK_REQUEST_OFF (1 << 9)
  562. # define GFX_CLK_FORCE_OFF (1 << 10)
  563. # define GFX_CLK_OFF_ACPI_D1 (1 << 11)
  564. # define GFX_CLK_OFF_ACPI_D2 (1 << 12)
  565. # define GFX_CLK_OFF_ACPI_D3 (1 << 13)
  566. # define DYN_LIGHT_SLEEP_EN (1 << 14)
  567. #define MCLK_PWRMGT_CNTL 0x648
  568. # define DLL_SPEED(x) ((x) << 0)
  569. # define DLL_SPEED_MASK (0x1f << 0)
  570. # define MPLL_PWRMGT_OFF (1 << 5)
  571. # define DLL_READY (1 << 6)
  572. # define MC_INT_CNTL (1 << 7)
  573. # define MRDCKA0_PDNB (1 << 8)
  574. # define MRDCKA1_PDNB (1 << 9)
  575. # define MRDCKB0_PDNB (1 << 10)
  576. # define MRDCKB1_PDNB (1 << 11)
  577. # define MRDCKC0_PDNB (1 << 12)
  578. # define MRDCKC1_PDNB (1 << 13)
  579. # define MRDCKD0_PDNB (1 << 14)
  580. # define MRDCKD1_PDNB (1 << 15)
  581. # define MRDCKA0_RESET (1 << 16)
  582. # define MRDCKA1_RESET (1 << 17)
  583. # define MRDCKB0_RESET (1 << 18)
  584. # define MRDCKB1_RESET (1 << 19)
  585. # define MRDCKC0_RESET (1 << 20)
  586. # define MRDCKC1_RESET (1 << 21)
  587. # define MRDCKD0_RESET (1 << 22)
  588. # define MRDCKD1_RESET (1 << 23)
  589. # define DLL_READY_READ (1 << 24)
  590. # define USE_DISPLAY_GAP (1 << 25)
  591. # define USE_DISPLAY_URGENT_NORMAL (1 << 26)
  592. # define MPLL_TURNOFF_D2 (1 << 28)
  593. #define DLL_CNTL 0x64c
  594. # define MRDCKA0_BYPASS (1 << 24)
  595. # define MRDCKA1_BYPASS (1 << 25)
  596. # define MRDCKB0_BYPASS (1 << 26)
  597. # define MRDCKB1_BYPASS (1 << 27)
  598. # define MRDCKC0_BYPASS (1 << 28)
  599. # define MRDCKC1_BYPASS (1 << 29)
  600. # define MRDCKD0_BYPASS (1 << 30)
  601. # define MRDCKD1_BYPASS (1 << 31)
  602. #define TARGET_AND_CURRENT_PROFILE_INDEX 0x66c
  603. # define CURRENT_STATE_INDEX_MASK (0xf << 4)
  604. # define CURRENT_STATE_INDEX_SHIFT 4
  605. #define CG_AT 0x6d4
  606. # define CG_R(x) ((x) << 0)
  607. # define CG_R_MASK (0xffff << 0)
  608. # define CG_L(x) ((x) << 16)
  609. # define CG_L_MASK (0xffff << 16)
  610. #define CG_BIF_REQ_AND_RSP 0x7f4
  611. #define CG_CLIENT_REQ(x) ((x) << 0)
  612. #define CG_CLIENT_REQ_MASK (0xff << 0)
  613. #define CG_CLIENT_REQ_SHIFT 0
  614. #define CG_CLIENT_RESP(x) ((x) << 8)
  615. #define CG_CLIENT_RESP_MASK (0xff << 8)
  616. #define CG_CLIENT_RESP_SHIFT 8
  617. #define CLIENT_CG_REQ(x) ((x) << 16)
  618. #define CLIENT_CG_REQ_MASK (0xff << 16)
  619. #define CLIENT_CG_REQ_SHIFT 16
  620. #define CLIENT_CG_RESP(x) ((x) << 24)
  621. #define CLIENT_CG_RESP_MASK (0xff << 24)
  622. #define CLIENT_CG_RESP_SHIFT 24
  623. #define CG_SPLL_SPREAD_SPECTRUM 0x790
  624. #define SSEN (1 << 0)
  625. #define CLK_S(x) ((x) << 4)
  626. #define CLK_S_MASK (0xfff << 4)
  627. #define CLK_S_SHIFT 4
  628. #define CG_SPLL_SPREAD_SPECTRUM_2 0x794
  629. #define CLK_V(x) ((x) << 0)
  630. #define CLK_V_MASK (0x3ffffff << 0)
  631. #define CLK_V_SHIFT 0
  632. #define SMC_SCRATCH0 0x81c
  633. #define CG_SPLL_FUNC_CNTL_4 0x850
  634. #define MPLL_SS1 0x85c
  635. #define CLKV(x) ((x) << 0)
  636. #define CLKV_MASK (0x3ffffff << 0)
  637. #define MPLL_SS2 0x860
  638. #define CLKS(x) ((x) << 0)
  639. #define CLKS_MASK (0xfff << 0)
  640. #define CG_CAC_CTRL 0x88c
  641. #define TID_CNT(x) ((x) << 0)
  642. #define TID_CNT_MASK (0x3fff << 0)
  643. #define TID_UNIT(x) ((x) << 14)
  644. #define TID_UNIT_MASK (0xf << 14)
  645. #define CG_IND_ADDR 0x8f8
  646. #define CG_IND_DATA 0x8fc
  647. /* CGIND regs */
  648. #define CG_CGTT_LOCAL_0 0x00
  649. #define CG_CGTT_LOCAL_1 0x01
  650. #define MC_CG_CONFIG 0x25bc
  651. #define MCDW_WR_ENABLE (1 << 0)
  652. #define MCDX_WR_ENABLE (1 << 1)
  653. #define MCDY_WR_ENABLE (1 << 2)
  654. #define MCDZ_WR_ENABLE (1 << 3)
  655. #define MC_RD_ENABLE(x) ((x) << 4)
  656. #define MC_RD_ENABLE_MASK (3 << 4)
  657. #define INDEX(x) ((x) << 6)
  658. #define INDEX_MASK (0xfff << 6)
  659. #define INDEX_SHIFT 6
  660. #define MC_ARB_CAC_CNTL 0x2750
  661. #define ENABLE (1 << 0)
  662. #define READ_WEIGHT(x) ((x) << 1)
  663. #define READ_WEIGHT_MASK (0x3f << 1)
  664. #define READ_WEIGHT_SHIFT 1
  665. #define WRITE_WEIGHT(x) ((x) << 7)
  666. #define WRITE_WEIGHT_MASK (0x3f << 7)
  667. #define WRITE_WEIGHT_SHIFT 7
  668. #define ALLOW_OVERFLOW (1 << 13)
  669. #define MC_ARB_DRAM_TIMING 0x2774
  670. #define MC_ARB_DRAM_TIMING2 0x2778
  671. #define MC_ARB_RFSH_RATE 0x27b0
  672. #define POWERMODE0(x) ((x) << 0)
  673. #define POWERMODE0_MASK (0xff << 0)
  674. #define POWERMODE0_SHIFT 0
  675. #define POWERMODE1(x) ((x) << 8)
  676. #define POWERMODE1_MASK (0xff << 8)
  677. #define POWERMODE1_SHIFT 8
  678. #define POWERMODE2(x) ((x) << 16)
  679. #define POWERMODE2_MASK (0xff << 16)
  680. #define POWERMODE2_SHIFT 16
  681. #define POWERMODE3(x) ((x) << 24)
  682. #define POWERMODE3_MASK (0xff << 24)
  683. #define POWERMODE3_SHIFT 24
  684. #define MC_ARB_CG 0x27e8
  685. #define CG_ARB_REQ(x) ((x) << 0)
  686. #define CG_ARB_REQ_MASK (0xff << 0)
  687. #define CG_ARB_REQ_SHIFT 0
  688. #define CG_ARB_RESP(x) ((x) << 8)
  689. #define CG_ARB_RESP_MASK (0xff << 8)
  690. #define CG_ARB_RESP_SHIFT 8
  691. #define ARB_CG_REQ(x) ((x) << 16)
  692. #define ARB_CG_REQ_MASK (0xff << 16)
  693. #define ARB_CG_REQ_SHIFT 16
  694. #define ARB_CG_RESP(x) ((x) << 24)
  695. #define ARB_CG_RESP_MASK (0xff << 24)
  696. #define ARB_CG_RESP_SHIFT 24
  697. #define MC_ARB_DRAM_TIMING_1 0x27f0
  698. #define MC_ARB_DRAM_TIMING_2 0x27f4
  699. #define MC_ARB_DRAM_TIMING_3 0x27f8
  700. #define MC_ARB_DRAM_TIMING2_1 0x27fc
  701. #define MC_ARB_DRAM_TIMING2_2 0x2800
  702. #define MC_ARB_DRAM_TIMING2_3 0x2804
  703. #define MC_ARB_BURST_TIME 0x2808
  704. #define STATE0(x) ((x) << 0)
  705. #define STATE0_MASK (0x1f << 0)
  706. #define STATE0_SHIFT 0
  707. #define STATE1(x) ((x) << 5)
  708. #define STATE1_MASK (0x1f << 5)
  709. #define STATE1_SHIFT 5
  710. #define STATE2(x) ((x) << 10)
  711. #define STATE2_MASK (0x1f << 10)
  712. #define STATE2_SHIFT 10
  713. #define STATE3(x) ((x) << 15)
  714. #define STATE3_MASK (0x1f << 15)
  715. #define STATE3_SHIFT 15
  716. #define MC_CG_DATAPORT 0x2884
  717. #define MC_SEQ_RAS_TIMING 0x28a0
  718. #define MC_SEQ_CAS_TIMING 0x28a4
  719. #define MC_SEQ_MISC_TIMING 0x28a8
  720. #define MC_SEQ_MISC_TIMING2 0x28ac
  721. #define MC_SEQ_PMG_TIMING 0x28b0
  722. #define MC_SEQ_RD_CTL_D0 0x28b4
  723. #define MC_SEQ_RD_CTL_D1 0x28b8
  724. #define MC_SEQ_WR_CTL_D0 0x28bc
  725. #define MC_SEQ_WR_CTL_D1 0x28c0
  726. #define MC_SEQ_MISC0 0x2a00
  727. #define MC_SEQ_MISC0_GDDR5_SHIFT 28
  728. #define MC_SEQ_MISC0_GDDR5_MASK 0xf0000000
  729. #define MC_SEQ_MISC0_GDDR5_VALUE 5
  730. #define MC_SEQ_MISC1 0x2a04
  731. #define MC_SEQ_RESERVE_M 0x2a08
  732. #define MC_PMG_CMD_EMRS 0x2a0c
  733. #define MC_SEQ_MISC3 0x2a2c
  734. #define MC_SEQ_MISC5 0x2a54
  735. #define MC_SEQ_MISC6 0x2a58
  736. #define MC_SEQ_MISC7 0x2a64
  737. #define MC_SEQ_RAS_TIMING_LP 0x2a6c
  738. #define MC_SEQ_CAS_TIMING_LP 0x2a70
  739. #define MC_SEQ_MISC_TIMING_LP 0x2a74
  740. #define MC_SEQ_MISC_TIMING2_LP 0x2a78
  741. #define MC_SEQ_WR_CTL_D0_LP 0x2a7c
  742. #define MC_SEQ_WR_CTL_D1_LP 0x2a80
  743. #define MC_SEQ_PMG_CMD_EMRS_LP 0x2a84
  744. #define MC_SEQ_PMG_CMD_MRS_LP 0x2a88
  745. #define MC_PMG_CMD_MRS 0x2aac
  746. #define MC_SEQ_RD_CTL_D0_LP 0x2b1c
  747. #define MC_SEQ_RD_CTL_D1_LP 0x2b20
  748. #define MC_PMG_CMD_MRS1 0x2b44
  749. #define MC_SEQ_PMG_CMD_MRS1_LP 0x2b48
  750. #define MC_SEQ_PMG_TIMING_LP 0x2b4c
  751. #define MC_PMG_CMD_MRS2 0x2b5c
  752. #define MC_SEQ_PMG_CMD_MRS2_LP 0x2b60
  753. #define AUX_CONTROL 0x6200
  754. #define AUX_EN (1 << 0)
  755. #define AUX_LS_READ_EN (1 << 8)
  756. #define AUX_LS_UPDATE_DISABLE(x) (((x) & 0x1) << 12)
  757. #define AUX_HPD_DISCON(x) (((x) & 0x1) << 16)
  758. #define AUX_DET_EN (1 << 18)
  759. #define AUX_HPD_SEL(x) (((x) & 0x7) << 20)
  760. #define AUX_IMPCAL_REQ_EN (1 << 24)
  761. #define AUX_TEST_MODE (1 << 28)
  762. #define AUX_DEGLITCH_EN (1 << 29)
  763. #define AUX_SW_CONTROL 0x6204
  764. #define AUX_SW_GO (1 << 0)
  765. #define AUX_LS_READ_TRIG (1 << 2)
  766. #define AUX_SW_START_DELAY(x) (((x) & 0xf) << 4)
  767. #define AUX_SW_WR_BYTES(x) (((x) & 0x1f) << 16)
  768. #define AUX_SW_INTERRUPT_CONTROL 0x620c
  769. #define AUX_SW_DONE_INT (1 << 0)
  770. #define AUX_SW_DONE_ACK (1 << 1)
  771. #define AUX_SW_DONE_MASK (1 << 2)
  772. #define AUX_SW_LS_DONE_INT (1 << 4)
  773. #define AUX_SW_LS_DONE_MASK (1 << 6)
  774. #define AUX_SW_STATUS 0x6210
  775. #define AUX_SW_DONE (1 << 0)
  776. #define AUX_SW_REQ (1 << 1)
  777. #define AUX_SW_RX_TIMEOUT_STATE(x) (((x) & 0x7) << 4)
  778. #define AUX_SW_RX_TIMEOUT (1 << 7)
  779. #define AUX_SW_RX_OVERFLOW (1 << 8)
  780. #define AUX_SW_RX_HPD_DISCON (1 << 9)
  781. #define AUX_SW_RX_PARTIAL_BYTE (1 << 10)
  782. #define AUX_SW_NON_AUX_MODE (1 << 11)
  783. #define AUX_SW_RX_MIN_COUNT_VIOL (1 << 12)
  784. #define AUX_SW_RX_INVALID_STOP (1 << 14)
  785. #define AUX_SW_RX_SYNC_INVALID_L (1 << 17)
  786. #define AUX_SW_RX_SYNC_INVALID_H (1 << 18)
  787. #define AUX_SW_RX_INVALID_START (1 << 19)
  788. #define AUX_SW_RX_RECV_NO_DET (1 << 20)
  789. #define AUX_SW_RX_RECV_INVALID_H (1 << 22)
  790. #define AUX_SW_RX_RECV_INVALID_V (1 << 23)
  791. #define AUX_SW_DATA 0x6218
  792. #define AUX_SW_DATA_RW (1 << 0)
  793. #define AUX_SW_DATA_MASK(x) (((x) & 0xff) << 8)
  794. #define AUX_SW_DATA_INDEX(x) (((x) & 0x1f) << 16)
  795. #define AUX_SW_AUTOINCREMENT_DISABLE (1 << 31)
  796. #define LB_SYNC_RESET_SEL 0x6b28
  797. #define LB_SYNC_RESET_SEL_MASK (3 << 0)
  798. #define LB_SYNC_RESET_SEL_SHIFT 0
  799. #define DC_STUTTER_CNTL 0x6b30
  800. #define DC_STUTTER_ENABLE_A (1 << 0)
  801. #define DC_STUTTER_ENABLE_B (1 << 1)
  802. #define SQ_CAC_THRESHOLD 0x8e4c
  803. #define VSP(x) ((x) << 0)
  804. #define VSP_MASK (0xff << 0)
  805. #define VSP_SHIFT 0
  806. #define VSP0(x) ((x) << 8)
  807. #define VSP0_MASK (0xff << 8)
  808. #define VSP0_SHIFT 8
  809. #define GPR(x) ((x) << 16)
  810. #define GPR_MASK (0xff << 16)
  811. #define GPR_SHIFT 16
  812. #define SQ_POWER_THROTTLE 0x8e58
  813. #define MIN_POWER(x) ((x) << 0)
  814. #define MIN_POWER_MASK (0x3fff << 0)
  815. #define MIN_POWER_SHIFT 0
  816. #define MAX_POWER(x) ((x) << 16)
  817. #define MAX_POWER_MASK (0x3fff << 16)
  818. #define MAX_POWER_SHIFT 0
  819. #define SQ_POWER_THROTTLE2 0x8e5c
  820. #define MAX_POWER_DELTA(x) ((x) << 0)
  821. #define MAX_POWER_DELTA_MASK (0x3fff << 0)
  822. #define MAX_POWER_DELTA_SHIFT 0
  823. #define STI_SIZE(x) ((x) << 16)
  824. #define STI_SIZE_MASK (0x3ff << 16)
  825. #define STI_SIZE_SHIFT 16
  826. #define LTI_RATIO(x) ((x) << 27)
  827. #define LTI_RATIO_MASK (0xf << 27)
  828. #define LTI_RATIO_SHIFT 27
  829. /* CG indirect registers */
  830. #define CG_CAC_REGION_1_WEIGHT_0 0x83
  831. #define WEIGHT_TCP_SIG0(x) ((x) << 0)
  832. #define WEIGHT_TCP_SIG0_MASK (0x3f << 0)
  833. #define WEIGHT_TCP_SIG0_SHIFT 0
  834. #define WEIGHT_TCP_SIG1(x) ((x) << 6)
  835. #define WEIGHT_TCP_SIG1_MASK (0x3f << 6)
  836. #define WEIGHT_TCP_SIG1_SHIFT 6
  837. #define WEIGHT_TA_SIG(x) ((x) << 12)
  838. #define WEIGHT_TA_SIG_MASK (0x3f << 12)
  839. #define WEIGHT_TA_SIG_SHIFT 12
  840. #define CG_CAC_REGION_1_WEIGHT_1 0x84
  841. #define WEIGHT_TCC_EN0(x) ((x) << 0)
  842. #define WEIGHT_TCC_EN0_MASK (0x3f << 0)
  843. #define WEIGHT_TCC_EN0_SHIFT 0
  844. #define WEIGHT_TCC_EN1(x) ((x) << 6)
  845. #define WEIGHT_TCC_EN1_MASK (0x3f << 6)
  846. #define WEIGHT_TCC_EN1_SHIFT 6
  847. #define WEIGHT_TCC_EN2(x) ((x) << 12)
  848. #define WEIGHT_TCC_EN2_MASK (0x3f << 12)
  849. #define WEIGHT_TCC_EN2_SHIFT 12
  850. #define WEIGHT_TCC_EN3(x) ((x) << 18)
  851. #define WEIGHT_TCC_EN3_MASK (0x3f << 18)
  852. #define WEIGHT_TCC_EN3_SHIFT 18
  853. #define CG_CAC_REGION_2_WEIGHT_0 0x85
  854. #define WEIGHT_CB_EN0(x) ((x) << 0)
  855. #define WEIGHT_CB_EN0_MASK (0x3f << 0)
  856. #define WEIGHT_CB_EN0_SHIFT 0
  857. #define WEIGHT_CB_EN1(x) ((x) << 6)
  858. #define WEIGHT_CB_EN1_MASK (0x3f << 6)
  859. #define WEIGHT_CB_EN1_SHIFT 6
  860. #define WEIGHT_CB_EN2(x) ((x) << 12)
  861. #define WEIGHT_CB_EN2_MASK (0x3f << 12)
  862. #define WEIGHT_CB_EN2_SHIFT 12
  863. #define WEIGHT_CB_EN3(x) ((x) << 18)
  864. #define WEIGHT_CB_EN3_MASK (0x3f << 18)
  865. #define WEIGHT_CB_EN3_SHIFT 18
  866. #define CG_CAC_REGION_2_WEIGHT_1 0x86
  867. #define WEIGHT_DB_SIG0(x) ((x) << 0)
  868. #define WEIGHT_DB_SIG0_MASK (0x3f << 0)
  869. #define WEIGHT_DB_SIG0_SHIFT 0
  870. #define WEIGHT_DB_SIG1(x) ((x) << 6)
  871. #define WEIGHT_DB_SIG1_MASK (0x3f << 6)
  872. #define WEIGHT_DB_SIG1_SHIFT 6
  873. #define WEIGHT_DB_SIG2(x) ((x) << 12)
  874. #define WEIGHT_DB_SIG2_MASK (0x3f << 12)
  875. #define WEIGHT_DB_SIG2_SHIFT 12
  876. #define WEIGHT_DB_SIG3(x) ((x) << 18)
  877. #define WEIGHT_DB_SIG3_MASK (0x3f << 18)
  878. #define WEIGHT_DB_SIG3_SHIFT 18
  879. #define CG_CAC_REGION_2_WEIGHT_2 0x87
  880. #define WEIGHT_SXM_SIG0(x) ((x) << 0)
  881. #define WEIGHT_SXM_SIG0_MASK (0x3f << 0)
  882. #define WEIGHT_SXM_SIG0_SHIFT 0
  883. #define WEIGHT_SXM_SIG1(x) ((x) << 6)
  884. #define WEIGHT_SXM_SIG1_MASK (0x3f << 6)
  885. #define WEIGHT_SXM_SIG1_SHIFT 6
  886. #define WEIGHT_SXM_SIG2(x) ((x) << 12)
  887. #define WEIGHT_SXM_SIG2_MASK (0x3f << 12)
  888. #define WEIGHT_SXM_SIG2_SHIFT 12
  889. #define WEIGHT_SXS_SIG0(x) ((x) << 18)
  890. #define WEIGHT_SXS_SIG0_MASK (0x3f << 18)
  891. #define WEIGHT_SXS_SIG0_SHIFT 18
  892. #define WEIGHT_SXS_SIG1(x) ((x) << 24)
  893. #define WEIGHT_SXS_SIG1_MASK (0x3f << 24)
  894. #define WEIGHT_SXS_SIG1_SHIFT 24
  895. #define CG_CAC_REGION_3_WEIGHT_0 0x88
  896. #define WEIGHT_XBR_0(x) ((x) << 0)
  897. #define WEIGHT_XBR_0_MASK (0x3f << 0)
  898. #define WEIGHT_XBR_0_SHIFT 0
  899. #define WEIGHT_XBR_1(x) ((x) << 6)
  900. #define WEIGHT_XBR_1_MASK (0x3f << 6)
  901. #define WEIGHT_XBR_1_SHIFT 6
  902. #define WEIGHT_XBR_2(x) ((x) << 12)
  903. #define WEIGHT_XBR_2_MASK (0x3f << 12)
  904. #define WEIGHT_XBR_2_SHIFT 12
  905. #define WEIGHT_SPI_SIG0(x) ((x) << 18)
  906. #define WEIGHT_SPI_SIG0_MASK (0x3f << 18)
  907. #define WEIGHT_SPI_SIG0_SHIFT 18
  908. #define CG_CAC_REGION_3_WEIGHT_1 0x89
  909. #define WEIGHT_SPI_SIG1(x) ((x) << 0)
  910. #define WEIGHT_SPI_SIG1_MASK (0x3f << 0)
  911. #define WEIGHT_SPI_SIG1_SHIFT 0
  912. #define WEIGHT_SPI_SIG2(x) ((x) << 6)
  913. #define WEIGHT_SPI_SIG2_MASK (0x3f << 6)
  914. #define WEIGHT_SPI_SIG2_SHIFT 6
  915. #define WEIGHT_SPI_SIG3(x) ((x) << 12)
  916. #define WEIGHT_SPI_SIG3_MASK (0x3f << 12)
  917. #define WEIGHT_SPI_SIG3_SHIFT 12
  918. #define WEIGHT_SPI_SIG4(x) ((x) << 18)
  919. #define WEIGHT_SPI_SIG4_MASK (0x3f << 18)
  920. #define WEIGHT_SPI_SIG4_SHIFT 18
  921. #define WEIGHT_SPI_SIG5(x) ((x) << 24)
  922. #define WEIGHT_SPI_SIG5_MASK (0x3f << 24)
  923. #define WEIGHT_SPI_SIG5_SHIFT 24
  924. #define CG_CAC_REGION_4_WEIGHT_0 0x8a
  925. #define WEIGHT_LDS_SIG0(x) ((x) << 0)
  926. #define WEIGHT_LDS_SIG0_MASK (0x3f << 0)
  927. #define WEIGHT_LDS_SIG0_SHIFT 0
  928. #define WEIGHT_LDS_SIG1(x) ((x) << 6)
  929. #define WEIGHT_LDS_SIG1_MASK (0x3f << 6)
  930. #define WEIGHT_LDS_SIG1_SHIFT 6
  931. #define WEIGHT_SC(x) ((x) << 24)
  932. #define WEIGHT_SC_MASK (0x3f << 24)
  933. #define WEIGHT_SC_SHIFT 24
  934. #define CG_CAC_REGION_4_WEIGHT_1 0x8b
  935. #define WEIGHT_BIF(x) ((x) << 0)
  936. #define WEIGHT_BIF_MASK (0x3f << 0)
  937. #define WEIGHT_BIF_SHIFT 0
  938. #define WEIGHT_CP(x) ((x) << 6)
  939. #define WEIGHT_CP_MASK (0x3f << 6)
  940. #define WEIGHT_CP_SHIFT 6
  941. #define WEIGHT_PA_SIG0(x) ((x) << 12)
  942. #define WEIGHT_PA_SIG0_MASK (0x3f << 12)
  943. #define WEIGHT_PA_SIG0_SHIFT 12
  944. #define WEIGHT_PA_SIG1(x) ((x) << 18)
  945. #define WEIGHT_PA_SIG1_MASK (0x3f << 18)
  946. #define WEIGHT_PA_SIG1_SHIFT 18
  947. #define WEIGHT_VGT_SIG0(x) ((x) << 24)
  948. #define WEIGHT_VGT_SIG0_MASK (0x3f << 24)
  949. #define WEIGHT_VGT_SIG0_SHIFT 24
  950. #define CG_CAC_REGION_4_WEIGHT_2 0x8c
  951. #define WEIGHT_VGT_SIG1(x) ((x) << 0)
  952. #define WEIGHT_VGT_SIG1_MASK (0x3f << 0)
  953. #define WEIGHT_VGT_SIG1_SHIFT 0
  954. #define WEIGHT_VGT_SIG2(x) ((x) << 6)
  955. #define WEIGHT_VGT_SIG2_MASK (0x3f << 6)
  956. #define WEIGHT_VGT_SIG2_SHIFT 6
  957. #define WEIGHT_DC_SIG0(x) ((x) << 12)
  958. #define WEIGHT_DC_SIG0_MASK (0x3f << 12)
  959. #define WEIGHT_DC_SIG0_SHIFT 12
  960. #define WEIGHT_DC_SIG1(x) ((x) << 18)
  961. #define WEIGHT_DC_SIG1_MASK (0x3f << 18)
  962. #define WEIGHT_DC_SIG1_SHIFT 18
  963. #define WEIGHT_DC_SIG2(x) ((x) << 24)
  964. #define WEIGHT_DC_SIG2_MASK (0x3f << 24)
  965. #define WEIGHT_DC_SIG2_SHIFT 24
  966. #define CG_CAC_REGION_4_WEIGHT_3 0x8d
  967. #define WEIGHT_DC_SIG3(x) ((x) << 0)
  968. #define WEIGHT_DC_SIG3_MASK (0x3f << 0)
  969. #define WEIGHT_DC_SIG3_SHIFT 0
  970. #define WEIGHT_UVD_SIG0(x) ((x) << 6)
  971. #define WEIGHT_UVD_SIG0_MASK (0x3f << 6)
  972. #define WEIGHT_UVD_SIG0_SHIFT 6
  973. #define WEIGHT_UVD_SIG1(x) ((x) << 12)
  974. #define WEIGHT_UVD_SIG1_MASK (0x3f << 12)
  975. #define WEIGHT_UVD_SIG1_SHIFT 12
  976. #define WEIGHT_SPARE0(x) ((x) << 18)
  977. #define WEIGHT_SPARE0_MASK (0x3f << 18)
  978. #define WEIGHT_SPARE0_SHIFT 18
  979. #define WEIGHT_SPARE1(x) ((x) << 24)
  980. #define WEIGHT_SPARE1_MASK (0x3f << 24)
  981. #define WEIGHT_SPARE1_SHIFT 24
  982. #define CG_CAC_REGION_5_WEIGHT_0 0x8e
  983. #define WEIGHT_SQ_VSP(x) ((x) << 0)
  984. #define WEIGHT_SQ_VSP_MASK (0x3fff << 0)
  985. #define WEIGHT_SQ_VSP_SHIFT 0
  986. #define WEIGHT_SQ_VSP0(x) ((x) << 14)
  987. #define WEIGHT_SQ_VSP0_MASK (0x3fff << 14)
  988. #define WEIGHT_SQ_VSP0_SHIFT 14
  989. #define CG_CAC_REGION_4_OVERRIDE_4 0xab
  990. #define OVR_MODE_SPARE_0(x) ((x) << 16)
  991. #define OVR_MODE_SPARE_0_MASK (0x1 << 16)
  992. #define OVR_MODE_SPARE_0_SHIFT 16
  993. #define OVR_VAL_SPARE_0(x) ((x) << 17)
  994. #define OVR_VAL_SPARE_0_MASK (0x1 << 17)
  995. #define OVR_VAL_SPARE_0_SHIFT 17
  996. #define OVR_MODE_SPARE_1(x) ((x) << 18)
  997. #define OVR_MODE_SPARE_1_MASK (0x3f << 18)
  998. #define OVR_MODE_SPARE_1_SHIFT 18
  999. #define OVR_VAL_SPARE_1(x) ((x) << 19)
  1000. #define OVR_VAL_SPARE_1_MASK (0x3f << 19)
  1001. #define OVR_VAL_SPARE_1_SHIFT 19
  1002. #define CG_CAC_REGION_5_WEIGHT_1 0xb7
  1003. #define WEIGHT_SQ_GPR(x) ((x) << 0)
  1004. #define WEIGHT_SQ_GPR_MASK (0x3fff << 0)
  1005. #define WEIGHT_SQ_GPR_SHIFT 0
  1006. #define WEIGHT_SQ_LDS(x) ((x) << 14)
  1007. #define WEIGHT_SQ_LDS_MASK (0x3fff << 14)
  1008. #define WEIGHT_SQ_LDS_SHIFT 14
  1009. /* PCIE link stuff */
  1010. #define PCIE_LC_TRAINING_CNTL 0xa1 /* PCIE_P */
  1011. #define PCIE_LC_LINK_WIDTH_CNTL 0xa2 /* PCIE_P */
  1012. # define LC_LINK_WIDTH_SHIFT 0
  1013. # define LC_LINK_WIDTH_MASK 0x7
  1014. # define LC_LINK_WIDTH_X0 0
  1015. # define LC_LINK_WIDTH_X1 1
  1016. # define LC_LINK_WIDTH_X2 2
  1017. # define LC_LINK_WIDTH_X4 3
  1018. # define LC_LINK_WIDTH_X8 4
  1019. # define LC_LINK_WIDTH_X16 6
  1020. # define LC_LINK_WIDTH_RD_SHIFT 4
  1021. # define LC_LINK_WIDTH_RD_MASK 0x70
  1022. # define LC_RECONFIG_ARC_MISSING_ESCAPE (1 << 7)
  1023. # define LC_RECONFIG_NOW (1 << 8)
  1024. # define LC_RENEGOTIATION_SUPPORT (1 << 9)
  1025. # define LC_RENEGOTIATE_EN (1 << 10)
  1026. # define LC_SHORT_RECONFIG_EN (1 << 11)
  1027. # define LC_UPCONFIGURE_SUPPORT (1 << 12)
  1028. # define LC_UPCONFIGURE_DIS (1 << 13)
  1029. #define PCIE_LC_SPEED_CNTL 0xa4 /* PCIE_P */
  1030. # define LC_GEN2_EN_STRAP (1 << 0)
  1031. # define LC_TARGET_LINK_SPEED_OVERRIDE_EN (1 << 1)
  1032. # define LC_FORCE_EN_HW_SPEED_CHANGE (1 << 5)
  1033. # define LC_FORCE_DIS_HW_SPEED_CHANGE (1 << 6)
  1034. # define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_MASK (0x3 << 8)
  1035. # define LC_SPEED_CHANGE_ATTEMPTS_ALLOWED_SHIFT 3
  1036. # define LC_CURRENT_DATA_RATE (1 << 11)
  1037. # define LC_HW_VOLTAGE_IF_CONTROL(x) ((x) << 12)
  1038. # define LC_HW_VOLTAGE_IF_CONTROL_MASK (3 << 12)
  1039. # define LC_HW_VOLTAGE_IF_CONTROL_SHIFT 12
  1040. # define LC_VOLTAGE_TIMER_SEL_MASK (0xf << 14)
  1041. # define LC_CLR_FAILED_SPD_CHANGE_CNT (1 << 21)
  1042. # define LC_OTHER_SIDE_EVER_SENT_GEN2 (1 << 23)
  1043. # define LC_OTHER_SIDE_SUPPORTS_GEN2 (1 << 24)
  1044. #define MM_CFGREGS_CNTL 0x544c
  1045. # define MM_WR_TO_CFG_EN (1 << 3)
  1046. #define LINK_CNTL2 0x88 /* F0 */
  1047. # define TARGET_LINK_SPEED_MASK (0xf << 0)
  1048. # define SELECTABLE_DEEMPHASIS (1 << 6)
  1049. /*
  1050. * UVD
  1051. */
  1052. #define UVD_SEMA_ADDR_LOW 0xEF00
  1053. #define UVD_SEMA_ADDR_HIGH 0xEF04
  1054. #define UVD_SEMA_CMD 0xEF08
  1055. #define UVD_UDEC_ADDR_CONFIG 0xEF4C
  1056. #define UVD_UDEC_DB_ADDR_CONFIG 0xEF50
  1057. #define UVD_UDEC_DBW_ADDR_CONFIG 0xEF54
  1058. #define UVD_RBC_RB_RPTR 0xF690
  1059. #define UVD_RBC_RB_WPTR 0xF694
  1060. #define UVD_STATUS 0xf6bc
  1061. /*
  1062. * PM4
  1063. */
  1064. #define PACKET0(reg, n) ((RADEON_PACKET_TYPE0 << 30) | \
  1065. (((reg) >> 2) & 0xFFFF) | \
  1066. ((n) & 0x3FFF) << 16)
  1067. #define CP_PACKET2 0x80000000
  1068. #define PACKET2_PAD_SHIFT 0
  1069. #define PACKET2_PAD_MASK (0x3fffffff << 0)
  1070. #define PACKET2(v) (CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
  1071. #define PACKET3(op, n) ((RADEON_PACKET_TYPE3 << 30) | \
  1072. (((op) & 0xFF) << 8) | \
  1073. ((n) & 0x3FFF) << 16)
  1074. /* Packet 3 types */
  1075. #define PACKET3_NOP 0x10
  1076. #define PACKET3_SET_BASE 0x11
  1077. #define PACKET3_CLEAR_STATE 0x12
  1078. #define PACKET3_INDEX_BUFFER_SIZE 0x13
  1079. #define PACKET3_DEALLOC_STATE 0x14
  1080. #define PACKET3_DISPATCH_DIRECT 0x15
  1081. #define PACKET3_DISPATCH_INDIRECT 0x16
  1082. #define PACKET3_INDIRECT_BUFFER_END 0x17
  1083. #define PACKET3_MODE_CONTROL 0x18
  1084. #define PACKET3_SET_PREDICATION 0x20
  1085. #define PACKET3_REG_RMW 0x21
  1086. #define PACKET3_COND_EXEC 0x22
  1087. #define PACKET3_PRED_EXEC 0x23
  1088. #define PACKET3_DRAW_INDIRECT 0x24
  1089. #define PACKET3_DRAW_INDEX_INDIRECT 0x25
  1090. #define PACKET3_INDEX_BASE 0x26
  1091. #define PACKET3_DRAW_INDEX_2 0x27
  1092. #define PACKET3_CONTEXT_CONTROL 0x28
  1093. #define PACKET3_DRAW_INDEX_OFFSET 0x29
  1094. #define PACKET3_INDEX_TYPE 0x2A
  1095. #define PACKET3_DRAW_INDEX 0x2B
  1096. #define PACKET3_DRAW_INDEX_AUTO 0x2D
  1097. #define PACKET3_DRAW_INDEX_IMMD 0x2E
  1098. #define PACKET3_NUM_INSTANCES 0x2F
  1099. #define PACKET3_DRAW_INDEX_MULTI_AUTO 0x30
  1100. #define PACKET3_INDIRECT_BUFFER 0x32
  1101. #define PACKET3_STRMOUT_BUFFER_UPDATE 0x34
  1102. #define PACKET3_DRAW_INDEX_OFFSET_2 0x35
  1103. #define PACKET3_DRAW_INDEX_MULTI_ELEMENT 0x36
  1104. #define PACKET3_WRITE_DATA 0x37
  1105. #define PACKET3_MEM_SEMAPHORE 0x39
  1106. #define PACKET3_MPEG_INDEX 0x3A
  1107. #define PACKET3_WAIT_REG_MEM 0x3C
  1108. #define WAIT_REG_MEM_FUNCTION(x) ((x) << 0)
  1109. /* 0 - always
  1110. * 1 - <
  1111. * 2 - <=
  1112. * 3 - ==
  1113. * 4 - !=
  1114. * 5 - >=
  1115. * 6 - >
  1116. */
  1117. #define WAIT_REG_MEM_MEM_SPACE(x) ((x) << 4)
  1118. /* 0 - reg
  1119. * 1 - mem
  1120. */
  1121. #define WAIT_REG_MEM_ENGINE(x) ((x) << 8)
  1122. /* 0 - me
  1123. * 1 - pfp
  1124. */
  1125. #define PACKET3_MEM_WRITE 0x3D
  1126. #define PACKET3_PFP_SYNC_ME 0x42
  1127. #define PACKET3_SURFACE_SYNC 0x43
  1128. # define PACKET3_CB0_DEST_BASE_ENA (1 << 6)
  1129. # define PACKET3_CB1_DEST_BASE_ENA (1 << 7)
  1130. # define PACKET3_CB2_DEST_BASE_ENA (1 << 8)
  1131. # define PACKET3_CB3_DEST_BASE_ENA (1 << 9)
  1132. # define PACKET3_CB4_DEST_BASE_ENA (1 << 10)
  1133. # define PACKET3_CB5_DEST_BASE_ENA (1 << 11)
  1134. # define PACKET3_CB6_DEST_BASE_ENA (1 << 12)
  1135. # define PACKET3_CB7_DEST_BASE_ENA (1 << 13)
  1136. # define PACKET3_DB_DEST_BASE_ENA (1 << 14)
  1137. # define PACKET3_CB8_DEST_BASE_ENA (1 << 15)
  1138. # define PACKET3_CB9_DEST_BASE_ENA (1 << 16)
  1139. # define PACKET3_CB10_DEST_BASE_ENA (1 << 17)
  1140. # define PACKET3_CB11_DEST_BASE_ENA (1 << 18)
  1141. # define PACKET3_FULL_CACHE_ENA (1 << 20)
  1142. # define PACKET3_TC_ACTION_ENA (1 << 23)
  1143. # define PACKET3_CB_ACTION_ENA (1 << 25)
  1144. # define PACKET3_DB_ACTION_ENA (1 << 26)
  1145. # define PACKET3_SH_ACTION_ENA (1 << 27)
  1146. # define PACKET3_SX_ACTION_ENA (1 << 28)
  1147. # define PACKET3_ENGINE_ME (1 << 31)
  1148. #define PACKET3_ME_INITIALIZE 0x44
  1149. #define PACKET3_ME_INITIALIZE_DEVICE_ID(x) ((x) << 16)
  1150. #define PACKET3_COND_WRITE 0x45
  1151. #define PACKET3_EVENT_WRITE 0x46
  1152. #define EVENT_TYPE(x) ((x) << 0)
  1153. #define EVENT_INDEX(x) ((x) << 8)
  1154. /* 0 - any non-TS event
  1155. * 1 - ZPASS_DONE
  1156. * 2 - SAMPLE_PIPELINESTAT
  1157. * 3 - SAMPLE_STREAMOUTSTAT*
  1158. * 4 - *S_PARTIAL_FLUSH
  1159. * 5 - TS events
  1160. */
  1161. #define PACKET3_EVENT_WRITE_EOP 0x47
  1162. #define DATA_SEL(x) ((x) << 29)
  1163. /* 0 - discard
  1164. * 1 - send low 32bit data
  1165. * 2 - send 64bit data
  1166. * 3 - send 64bit counter value
  1167. */
  1168. #define INT_SEL(x) ((x) << 24)
  1169. /* 0 - none
  1170. * 1 - interrupt only (DATA_SEL = 0)
  1171. * 2 - interrupt when data write is confirmed
  1172. */
  1173. #define PACKET3_EVENT_WRITE_EOS 0x48
  1174. #define PACKET3_PREAMBLE_CNTL 0x4A
  1175. # define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE (2 << 28)
  1176. # define PACKET3_PREAMBLE_END_CLEAR_STATE (3 << 28)
  1177. #define PACKET3_ALU_PS_CONST_BUFFER_COPY 0x4C
  1178. #define PACKET3_ALU_VS_CONST_BUFFER_COPY 0x4D
  1179. #define PACKET3_ALU_PS_CONST_UPDATE 0x4E
  1180. #define PACKET3_ALU_VS_CONST_UPDATE 0x4F
  1181. #define PACKET3_ONE_REG_WRITE 0x57
  1182. #define PACKET3_SET_CONFIG_REG 0x68
  1183. #define PACKET3_SET_CONFIG_REG_START 0x00008000
  1184. #define PACKET3_SET_CONFIG_REG_END 0x0000ac00
  1185. #define PACKET3_SET_CONTEXT_REG 0x69
  1186. #define PACKET3_SET_CONTEXT_REG_START 0x00028000
  1187. #define PACKET3_SET_CONTEXT_REG_END 0x00029000
  1188. #define PACKET3_SET_ALU_CONST 0x6A
  1189. /* alu const buffers only; no reg file */
  1190. #define PACKET3_SET_BOOL_CONST 0x6B
  1191. #define PACKET3_SET_BOOL_CONST_START 0x0003a500
  1192. #define PACKET3_SET_BOOL_CONST_END 0x0003a518
  1193. #define PACKET3_SET_LOOP_CONST 0x6C
  1194. #define PACKET3_SET_LOOP_CONST_START 0x0003a200
  1195. #define PACKET3_SET_LOOP_CONST_END 0x0003a500
  1196. #define PACKET3_SET_RESOURCE 0x6D
  1197. #define PACKET3_SET_RESOURCE_START 0x00030000
  1198. #define PACKET3_SET_RESOURCE_END 0x00038000
  1199. #define PACKET3_SET_SAMPLER 0x6E
  1200. #define PACKET3_SET_SAMPLER_START 0x0003c000
  1201. #define PACKET3_SET_SAMPLER_END 0x0003c600
  1202. #define PACKET3_SET_CTL_CONST 0x6F
  1203. #define PACKET3_SET_CTL_CONST_START 0x0003cff0
  1204. #define PACKET3_SET_CTL_CONST_END 0x0003ff0c
  1205. #define PACKET3_SET_RESOURCE_OFFSET 0x70
  1206. #define PACKET3_SET_ALU_CONST_VS 0x71
  1207. #define PACKET3_SET_ALU_CONST_DI 0x72
  1208. #define PACKET3_SET_CONTEXT_REG_INDIRECT 0x73
  1209. #define PACKET3_SET_RESOURCE_INDIRECT 0x74
  1210. #define PACKET3_SET_APPEND_CNT 0x75
  1211. #define PACKET3_ME_WRITE 0x7A
  1212. /* ASYNC DMA - first instance at 0xd000, second at 0xd800 */
  1213. #define DMA0_REGISTER_OFFSET 0x0 /* not a register */
  1214. #define DMA1_REGISTER_OFFSET 0x800 /* not a register */
  1215. #define DMA_RB_CNTL 0xd000
  1216. # define DMA_RB_ENABLE (1 << 0)
  1217. # define DMA_RB_SIZE(x) ((x) << 1) /* log2 */
  1218. # define DMA_RB_SWAP_ENABLE (1 << 9) /* 8IN32 */
  1219. # define DMA_RPTR_WRITEBACK_ENABLE (1 << 12)
  1220. # define DMA_RPTR_WRITEBACK_SWAP_ENABLE (1 << 13) /* 8IN32 */
  1221. # define DMA_RPTR_WRITEBACK_TIMER(x) ((x) << 16) /* log2 */
  1222. #define DMA_RB_BASE 0xd004
  1223. #define DMA_RB_RPTR 0xd008
  1224. #define DMA_RB_WPTR 0xd00c
  1225. #define DMA_RB_RPTR_ADDR_HI 0xd01c
  1226. #define DMA_RB_RPTR_ADDR_LO 0xd020
  1227. #define DMA_IB_CNTL 0xd024
  1228. # define DMA_IB_ENABLE (1 << 0)
  1229. # define DMA_IB_SWAP_ENABLE (1 << 4)
  1230. # define CMD_VMID_FORCE (1 << 31)
  1231. #define DMA_IB_RPTR 0xd028
  1232. #define DMA_CNTL 0xd02c
  1233. # define TRAP_ENABLE (1 << 0)
  1234. # define SEM_INCOMPLETE_INT_ENABLE (1 << 1)
  1235. # define SEM_WAIT_INT_ENABLE (1 << 2)
  1236. # define DATA_SWAP_ENABLE (1 << 3)
  1237. # define FENCE_SWAP_ENABLE (1 << 4)
  1238. # define CTXEMPTY_INT_ENABLE (1 << 28)
  1239. #define DMA_STATUS_REG 0xd034
  1240. # define DMA_IDLE (1 << 0)
  1241. #define DMA_SEM_INCOMPLETE_TIMER_CNTL 0xd044
  1242. #define DMA_SEM_WAIT_FAIL_TIMER_CNTL 0xd048
  1243. #define DMA_TILING_CONFIG 0xd0b8
  1244. #define DMA_MODE 0xd0bc
  1245. #define DMA_PACKET(cmd, t, s, n) ((((cmd) & 0xF) << 28) | \
  1246. (((t) & 0x1) << 23) | \
  1247. (((s) & 0x1) << 22) | \
  1248. (((n) & 0xFFFFF) << 0))
  1249. #define DMA_IB_PACKET(cmd, vmid, n) ((((cmd) & 0xF) << 28) | \
  1250. (((vmid) & 0xF) << 20) | \
  1251. (((n) & 0xFFFFF) << 0))
  1252. #define DMA_PTE_PDE_PACKET(n) ((2 << 28) | \
  1253. (1 << 26) | \
  1254. (1 << 21) | \
  1255. (((n) & 0xFFFFF) << 0))
  1256. #define DMA_SRBM_POLL_PACKET ((9 << 28) | \
  1257. (1 << 27) | \
  1258. (1 << 26))
  1259. #define DMA_SRBM_READ_PACKET ((9 << 28) | \
  1260. (1 << 27))
  1261. /* async DMA Packet types */
  1262. #define DMA_PACKET_WRITE 0x2
  1263. #define DMA_PACKET_COPY 0x3
  1264. #define DMA_PACKET_INDIRECT_BUFFER 0x4
  1265. #define DMA_PACKET_SEMAPHORE 0x5
  1266. #define DMA_PACKET_FENCE 0x6
  1267. #define DMA_PACKET_TRAP 0x7
  1268. #define DMA_PACKET_SRBM_WRITE 0x9
  1269. #define DMA_PACKET_CONSTANT_FILL 0xd
  1270. #define DMA_PACKET_NOP 0xf
  1271. #endif