nid.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  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 DMIF_ADDR_CONFIG 0xBD4
  43. #define SRBM_STATUS 0x0E50
  44. #define VM_CONTEXT0_REQUEST_RESPONSE 0x1470
  45. #define REQUEST_TYPE(x) (((x) & 0xf) << 0)
  46. #define RESPONSE_TYPE_MASK 0x000000F0
  47. #define RESPONSE_TYPE_SHIFT 4
  48. #define VM_L2_CNTL 0x1400
  49. #define ENABLE_L2_CACHE (1 << 0)
  50. #define ENABLE_L2_FRAGMENT_PROCESSING (1 << 1)
  51. #define ENABLE_L2_PTE_CACHE_LRU_UPDATE_BY_WRITE (1 << 9)
  52. #define ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE (1 << 10)
  53. #define EFFECTIVE_L2_QUEUE_SIZE(x) (((x) & 7) << 14)
  54. #define CONTEXT1_IDENTITY_ACCESS_MODE(x) (((x) & 3) << 18)
  55. /* CONTEXT1_IDENTITY_ACCESS_MODE
  56. * 0 physical = logical
  57. * 1 logical via context1 page table
  58. * 2 inside identity aperture use translation, outside physical = logical
  59. * 3 inside identity aperture physical = logical, outside use translation
  60. */
  61. #define VM_L2_CNTL2 0x1404
  62. #define INVALIDATE_ALL_L1_TLBS (1 << 0)
  63. #define INVALIDATE_L2_CACHE (1 << 1)
  64. #define VM_L2_CNTL3 0x1408
  65. #define BANK_SELECT(x) ((x) << 0)
  66. #define CACHE_UPDATE_MODE(x) ((x) << 6)
  67. #define L2_CACHE_BIGK_ASSOCIATIVITY (1 << 20)
  68. #define L2_CACHE_BIGK_FRAGMENT_SIZE(x) ((x) << 15)
  69. #define VM_L2_STATUS 0x140C
  70. #define L2_BUSY (1 << 0)
  71. #define VM_CONTEXT0_CNTL 0x1410
  72. #define ENABLE_CONTEXT (1 << 0)
  73. #define PAGE_TABLE_DEPTH(x) (((x) & 3) << 1)
  74. #define RANGE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 4)
  75. #define VM_CONTEXT1_CNTL 0x1414
  76. #define VM_CONTEXT0_CNTL2 0x1430
  77. #define VM_CONTEXT1_CNTL2 0x1434
  78. #define VM_INVALIDATE_REQUEST 0x1478
  79. #define VM_INVALIDATE_RESPONSE 0x147c
  80. #define VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR 0x1518
  81. #define VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR 0x151c
  82. #define VM_CONTEXT0_PAGE_TABLE_BASE_ADDR 0x153C
  83. #define VM_CONTEXT0_PAGE_TABLE_START_ADDR 0x155C
  84. #define VM_CONTEXT0_PAGE_TABLE_END_ADDR 0x157C
  85. #define MC_SHARED_CHMAP 0x2004
  86. #define NOOFCHAN_SHIFT 12
  87. #define NOOFCHAN_MASK 0x00003000
  88. #define MC_SHARED_CHREMAP 0x2008
  89. #define MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2034
  90. #define MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038
  91. #define MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203C
  92. #define MC_VM_MX_L1_TLB_CNTL 0x2064
  93. #define ENABLE_L1_TLB (1 << 0)
  94. #define ENABLE_L1_FRAGMENT_PROCESSING (1 << 1)
  95. #define SYSTEM_ACCESS_MODE_PA_ONLY (0 << 3)
  96. #define SYSTEM_ACCESS_MODE_USE_SYS_MAP (1 << 3)
  97. #define SYSTEM_ACCESS_MODE_IN_SYS (2 << 3)
  98. #define SYSTEM_ACCESS_MODE_NOT_IN_SYS (3 << 3)
  99. #define SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU (0 << 5)
  100. #define ENABLE_ADVANCED_DRIVER_MODEL (1 << 6)
  101. #define MC_SHARED_BLACKOUT_CNTL 0x20ac
  102. #define MC_ARB_RAMCFG 0x2760
  103. #define NOOFBANK_SHIFT 0
  104. #define NOOFBANK_MASK 0x00000003
  105. #define NOOFRANK_SHIFT 2
  106. #define NOOFRANK_MASK 0x00000004
  107. #define NOOFROWS_SHIFT 3
  108. #define NOOFROWS_MASK 0x00000038
  109. #define NOOFCOLS_SHIFT 6
  110. #define NOOFCOLS_MASK 0x000000C0
  111. #define CHANSIZE_SHIFT 8
  112. #define CHANSIZE_MASK 0x00000100
  113. #define BURSTLENGTH_SHIFT 9
  114. #define BURSTLENGTH_MASK 0x00000200
  115. #define CHANSIZE_OVERRIDE (1 << 11)
  116. #define MC_SEQ_SUP_CNTL 0x28c8
  117. #define RUN_MASK (1 << 0)
  118. #define MC_SEQ_SUP_PGM 0x28cc
  119. #define MC_IO_PAD_CNTL_D0 0x29d0
  120. #define MEM_FALL_OUT_CMD (1 << 8)
  121. #define MC_SEQ_MISC0 0x2a00
  122. #define MC_SEQ_MISC0_GDDR5_SHIFT 28
  123. #define MC_SEQ_MISC0_GDDR5_MASK 0xf0000000
  124. #define MC_SEQ_MISC0_GDDR5_VALUE 5
  125. #define MC_SEQ_IO_DEBUG_INDEX 0x2a44
  126. #define MC_SEQ_IO_DEBUG_DATA 0x2a48
  127. #define HDP_HOST_PATH_CNTL 0x2C00
  128. #define HDP_NONSURFACE_BASE 0x2C04
  129. #define HDP_NONSURFACE_INFO 0x2C08
  130. #define HDP_NONSURFACE_SIZE 0x2C0C
  131. #define HDP_ADDR_CONFIG 0x2F48
  132. #define HDP_MISC_CNTL 0x2F4C
  133. #define HDP_FLUSH_INVALIDATE_CACHE (1 << 0)
  134. #define CC_SYS_RB_BACKEND_DISABLE 0x3F88
  135. #define GC_USER_SYS_RB_BACKEND_DISABLE 0x3F8C
  136. #define CGTS_SYS_TCC_DISABLE 0x3F90
  137. #define CGTS_USER_SYS_TCC_DISABLE 0x3F94
  138. #define CONFIG_MEMSIZE 0x5428
  139. #define HDP_MEM_COHERENCY_FLUSH_CNTL 0x5480
  140. #define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0
  141. #define GRBM_CNTL 0x8000
  142. #define GRBM_READ_TIMEOUT(x) ((x) << 0)
  143. #define GRBM_STATUS 0x8010
  144. #define CMDFIFO_AVAIL_MASK 0x0000000F
  145. #define RING2_RQ_PENDING (1 << 4)
  146. #define SRBM_RQ_PENDING (1 << 5)
  147. #define RING1_RQ_PENDING (1 << 6)
  148. #define CF_RQ_PENDING (1 << 7)
  149. #define PF_RQ_PENDING (1 << 8)
  150. #define GDS_DMA_RQ_PENDING (1 << 9)
  151. #define GRBM_EE_BUSY (1 << 10)
  152. #define SX_CLEAN (1 << 11)
  153. #define DB_CLEAN (1 << 12)
  154. #define CB_CLEAN (1 << 13)
  155. #define TA_BUSY (1 << 14)
  156. #define GDS_BUSY (1 << 15)
  157. #define VGT_BUSY_NO_DMA (1 << 16)
  158. #define VGT_BUSY (1 << 17)
  159. #define IA_BUSY_NO_DMA (1 << 18)
  160. #define IA_BUSY (1 << 19)
  161. #define SX_BUSY (1 << 20)
  162. #define SH_BUSY (1 << 21)
  163. #define SPI_BUSY (1 << 22)
  164. #define SC_BUSY (1 << 24)
  165. #define PA_BUSY (1 << 25)
  166. #define DB_BUSY (1 << 26)
  167. #define CP_COHERENCY_BUSY (1 << 28)
  168. #define CP_BUSY (1 << 29)
  169. #define CB_BUSY (1 << 30)
  170. #define GUI_ACTIVE (1 << 31)
  171. #define GRBM_STATUS_SE0 0x8014
  172. #define GRBM_STATUS_SE1 0x8018
  173. #define SE_SX_CLEAN (1 << 0)
  174. #define SE_DB_CLEAN (1 << 1)
  175. #define SE_CB_CLEAN (1 << 2)
  176. #define SE_VGT_BUSY (1 << 23)
  177. #define SE_PA_BUSY (1 << 24)
  178. #define SE_TA_BUSY (1 << 25)
  179. #define SE_SX_BUSY (1 << 26)
  180. #define SE_SPI_BUSY (1 << 27)
  181. #define SE_SH_BUSY (1 << 28)
  182. #define SE_SC_BUSY (1 << 29)
  183. #define SE_DB_BUSY (1 << 30)
  184. #define SE_CB_BUSY (1 << 31)
  185. #define GRBM_SOFT_RESET 0x8020
  186. #define SOFT_RESET_CP (1 << 0)
  187. #define SOFT_RESET_CB (1 << 1)
  188. #define SOFT_RESET_DB (1 << 3)
  189. #define SOFT_RESET_GDS (1 << 4)
  190. #define SOFT_RESET_PA (1 << 5)
  191. #define SOFT_RESET_SC (1 << 6)
  192. #define SOFT_RESET_SPI (1 << 8)
  193. #define SOFT_RESET_SH (1 << 9)
  194. #define SOFT_RESET_SX (1 << 10)
  195. #define SOFT_RESET_TC (1 << 11)
  196. #define SOFT_RESET_TA (1 << 12)
  197. #define SOFT_RESET_VGT (1 << 14)
  198. #define SOFT_RESET_IA (1 << 15)
  199. #define SCRATCH_REG0 0x8500
  200. #define SCRATCH_REG1 0x8504
  201. #define SCRATCH_REG2 0x8508
  202. #define SCRATCH_REG3 0x850C
  203. #define SCRATCH_REG4 0x8510
  204. #define SCRATCH_REG5 0x8514
  205. #define SCRATCH_REG6 0x8518
  206. #define SCRATCH_REG7 0x851C
  207. #define SCRATCH_UMSK 0x8540
  208. #define SCRATCH_ADDR 0x8544
  209. #define CP_SEM_WAIT_TIMER 0x85BC
  210. #define CP_ME_CNTL 0x86D8
  211. #define CP_ME_HALT (1 << 28)
  212. #define CP_PFP_HALT (1 << 26)
  213. #define CP_RB2_RPTR 0x86f8
  214. #define CP_RB1_RPTR 0x86fc
  215. #define CP_RB0_RPTR 0x8700
  216. #define CP_RB_WPTR_DELAY 0x8704
  217. #define CP_MEQ_THRESHOLDS 0x8764
  218. #define MEQ1_START(x) ((x) << 0)
  219. #define MEQ2_START(x) ((x) << 8)
  220. #define CP_PERFMON_CNTL 0x87FC
  221. #define VGT_CACHE_INVALIDATION 0x88C4
  222. #define CACHE_INVALIDATION(x) ((x) << 0)
  223. #define VC_ONLY 0
  224. #define TC_ONLY 1
  225. #define VC_AND_TC 2
  226. #define AUTO_INVLD_EN(x) ((x) << 6)
  227. #define NO_AUTO 0
  228. #define ES_AUTO 1
  229. #define GS_AUTO 2
  230. #define ES_AND_GS_AUTO 3
  231. #define VGT_GS_VERTEX_REUSE 0x88D4
  232. #define CC_GC_SHADER_PIPE_CONFIG 0x8950
  233. #define GC_USER_SHADER_PIPE_CONFIG 0x8954
  234. #define INACTIVE_QD_PIPES(x) ((x) << 8)
  235. #define INACTIVE_QD_PIPES_MASK 0x0000FF00
  236. #define INACTIVE_QD_PIPES_SHIFT 8
  237. #define INACTIVE_SIMDS(x) ((x) << 16)
  238. #define INACTIVE_SIMDS_MASK 0xFFFF0000
  239. #define INACTIVE_SIMDS_SHIFT 16
  240. #define VGT_PRIMITIVE_TYPE 0x8958
  241. #define VGT_NUM_INSTANCES 0x8974
  242. #define VGT_TF_RING_SIZE 0x8988
  243. #define VGT_OFFCHIP_LDS_BASE 0x89b4
  244. #define PA_SC_LINE_STIPPLE_STATE 0x8B10
  245. #define PA_CL_ENHANCE 0x8A14
  246. #define CLIP_VTX_REORDER_ENA (1 << 0)
  247. #define NUM_CLIP_SEQ(x) ((x) << 1)
  248. #define PA_SC_FIFO_SIZE 0x8BCC
  249. #define SC_PRIM_FIFO_SIZE(x) ((x) << 0)
  250. #define SC_HIZ_TILE_FIFO_SIZE(x) ((x) << 12)
  251. #define SC_EARLYZ_TILE_FIFO_SIZE(x) ((x) << 20)
  252. #define PA_SC_FORCE_EOV_MAX_CNTS 0x8B24
  253. #define FORCE_EOV_MAX_CLK_CNT(x) ((x) << 0)
  254. #define FORCE_EOV_MAX_REZ_CNT(x) ((x) << 16)
  255. #define SQ_CONFIG 0x8C00
  256. #define VC_ENABLE (1 << 0)
  257. #define EXPORT_SRC_C (1 << 1)
  258. #define GFX_PRIO(x) ((x) << 2)
  259. #define CS1_PRIO(x) ((x) << 4)
  260. #define CS2_PRIO(x) ((x) << 6)
  261. #define SQ_GPR_RESOURCE_MGMT_1 0x8C04
  262. #define NUM_PS_GPRS(x) ((x) << 0)
  263. #define NUM_VS_GPRS(x) ((x) << 16)
  264. #define NUM_CLAUSE_TEMP_GPRS(x) ((x) << 28)
  265. #define SQ_ESGS_RING_SIZE 0x8c44
  266. #define SQ_GSVS_RING_SIZE 0x8c4c
  267. #define SQ_ESTMP_RING_BASE 0x8c50
  268. #define SQ_ESTMP_RING_SIZE 0x8c54
  269. #define SQ_GSTMP_RING_BASE 0x8c58
  270. #define SQ_GSTMP_RING_SIZE 0x8c5c
  271. #define SQ_VSTMP_RING_BASE 0x8c60
  272. #define SQ_VSTMP_RING_SIZE 0x8c64
  273. #define SQ_PSTMP_RING_BASE 0x8c68
  274. #define SQ_PSTMP_RING_SIZE 0x8c6c
  275. #define SQ_MS_FIFO_SIZES 0x8CF0
  276. #define CACHE_FIFO_SIZE(x) ((x) << 0)
  277. #define FETCH_FIFO_HIWATER(x) ((x) << 8)
  278. #define DONE_FIFO_HIWATER(x) ((x) << 16)
  279. #define ALU_UPDATE_FIFO_HIWATER(x) ((x) << 24)
  280. #define SQ_LSTMP_RING_BASE 0x8e10
  281. #define SQ_LSTMP_RING_SIZE 0x8e14
  282. #define SQ_HSTMP_RING_BASE 0x8e18
  283. #define SQ_HSTMP_RING_SIZE 0x8e1c
  284. #define SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 0x8D8C
  285. #define DYN_GPR_ENABLE (1 << 8)
  286. #define SQ_CONST_MEM_BASE 0x8df8
  287. #define SX_EXPORT_BUFFER_SIZES 0x900C
  288. #define COLOR_BUFFER_SIZE(x) ((x) << 0)
  289. #define POSITION_BUFFER_SIZE(x) ((x) << 8)
  290. #define SMX_BUFFER_SIZE(x) ((x) << 16)
  291. #define SX_DEBUG_1 0x9058
  292. #define ENABLE_NEW_SMX_ADDRESS (1 << 16)
  293. #define SPI_CONFIG_CNTL 0x9100
  294. #define GPR_WRITE_PRIORITY(x) ((x) << 0)
  295. #define SPI_CONFIG_CNTL_1 0x913C
  296. #define VTX_DONE_DELAY(x) ((x) << 0)
  297. #define INTERP_ONE_PRIM_PER_ROW (1 << 4)
  298. #define CRC_SIMD_ID_WADDR_DISABLE (1 << 8)
  299. #define CGTS_TCC_DISABLE 0x9148
  300. #define CGTS_USER_TCC_DISABLE 0x914C
  301. #define TCC_DISABLE_MASK 0xFFFF0000
  302. #define TCC_DISABLE_SHIFT 16
  303. #define CGTS_SM_CTRL_REG 0x9150
  304. #define OVERRIDE (1 << 21)
  305. #define TA_CNTL_AUX 0x9508
  306. #define DISABLE_CUBE_WRAP (1 << 0)
  307. #define DISABLE_CUBE_ANISO (1 << 1)
  308. #define TCP_CHAN_STEER_LO 0x960c
  309. #define TCP_CHAN_STEER_HI 0x9610
  310. #define CC_RB_BACKEND_DISABLE 0x98F4
  311. #define BACKEND_DISABLE(x) ((x) << 16)
  312. #define GB_ADDR_CONFIG 0x98F8
  313. #define NUM_PIPES(x) ((x) << 0)
  314. #define NUM_PIPES_MASK 0x00000007
  315. #define NUM_PIPES_SHIFT 0
  316. #define PIPE_INTERLEAVE_SIZE(x) ((x) << 4)
  317. #define PIPE_INTERLEAVE_SIZE_MASK 0x00000070
  318. #define PIPE_INTERLEAVE_SIZE_SHIFT 4
  319. #define BANK_INTERLEAVE_SIZE(x) ((x) << 8)
  320. #define NUM_SHADER_ENGINES(x) ((x) << 12)
  321. #define NUM_SHADER_ENGINES_MASK 0x00003000
  322. #define NUM_SHADER_ENGINES_SHIFT 12
  323. #define SHADER_ENGINE_TILE_SIZE(x) ((x) << 16)
  324. #define SHADER_ENGINE_TILE_SIZE_MASK 0x00070000
  325. #define SHADER_ENGINE_TILE_SIZE_SHIFT 16
  326. #define NUM_GPUS(x) ((x) << 20)
  327. #define NUM_GPUS_MASK 0x00700000
  328. #define NUM_GPUS_SHIFT 20
  329. #define MULTI_GPU_TILE_SIZE(x) ((x) << 24)
  330. #define MULTI_GPU_TILE_SIZE_MASK 0x03000000
  331. #define MULTI_GPU_TILE_SIZE_SHIFT 24
  332. #define ROW_SIZE(x) ((x) << 28)
  333. #define ROW_SIZE_MASK 0x30000000
  334. #define ROW_SIZE_SHIFT 28
  335. #define NUM_LOWER_PIPES(x) ((x) << 30)
  336. #define NUM_LOWER_PIPES_MASK 0x40000000
  337. #define NUM_LOWER_PIPES_SHIFT 30
  338. #define GB_BACKEND_MAP 0x98FC
  339. #define CB_PERF_CTR0_SEL_0 0x9A20
  340. #define CB_PERF_CTR0_SEL_1 0x9A24
  341. #define CB_PERF_CTR1_SEL_0 0x9A28
  342. #define CB_PERF_CTR1_SEL_1 0x9A2C
  343. #define CB_PERF_CTR2_SEL_0 0x9A30
  344. #define CB_PERF_CTR2_SEL_1 0x9A34
  345. #define CB_PERF_CTR3_SEL_0 0x9A38
  346. #define CB_PERF_CTR3_SEL_1 0x9A3C
  347. #define GC_USER_RB_BACKEND_DISABLE 0x9B7C
  348. #define BACKEND_DISABLE_MASK 0x00FF0000
  349. #define BACKEND_DISABLE_SHIFT 16
  350. #define SMX_DC_CTL0 0xA020
  351. #define USE_HASH_FUNCTION (1 << 0)
  352. #define NUMBER_OF_SETS(x) ((x) << 1)
  353. #define FLUSH_ALL_ON_EVENT (1 << 10)
  354. #define STALL_ON_EVENT (1 << 11)
  355. #define SMX_EVENT_CTL 0xA02C
  356. #define ES_FLUSH_CTL(x) ((x) << 0)
  357. #define GS_FLUSH_CTL(x) ((x) << 3)
  358. #define ACK_FLUSH_CTL(x) ((x) << 6)
  359. #define SYNC_FLUSH_CTL (1 << 8)
  360. #define CP_RB0_BASE 0xC100
  361. #define CP_RB0_CNTL 0xC104
  362. #define RB_BUFSZ(x) ((x) << 0)
  363. #define RB_BLKSZ(x) ((x) << 8)
  364. #define RB_NO_UPDATE (1 << 27)
  365. #define RB_RPTR_WR_ENA (1 << 31)
  366. #define BUF_SWAP_32BIT (2 << 16)
  367. #define CP_RB0_RPTR_ADDR 0xC10C
  368. #define CP_RB0_RPTR_ADDR_HI 0xC110
  369. #define CP_RB0_WPTR 0xC114
  370. #define CP_RB1_BASE 0xC180
  371. #define CP_RB1_CNTL 0xC184
  372. #define CP_RB1_RPTR_ADDR 0xC188
  373. #define CP_RB1_RPTR_ADDR_HI 0xC18C
  374. #define CP_RB1_WPTR 0xC190
  375. #define CP_RB2_BASE 0xC194
  376. #define CP_RB2_CNTL 0xC198
  377. #define CP_RB2_RPTR_ADDR 0xC19C
  378. #define CP_RB2_RPTR_ADDR_HI 0xC1A0
  379. #define CP_RB2_WPTR 0xC1A4
  380. #define CP_PFP_UCODE_ADDR 0xC150
  381. #define CP_PFP_UCODE_DATA 0xC154
  382. #define CP_ME_RAM_RADDR 0xC158
  383. #define CP_ME_RAM_WADDR 0xC15C
  384. #define CP_ME_RAM_DATA 0xC160
  385. #define CP_DEBUG 0xC1FC
  386. /*
  387. * PM4
  388. */
  389. #define PACKET_TYPE0 0
  390. #define PACKET_TYPE1 1
  391. #define PACKET_TYPE2 2
  392. #define PACKET_TYPE3 3
  393. #define CP_PACKET_GET_TYPE(h) (((h) >> 30) & 3)
  394. #define CP_PACKET_GET_COUNT(h) (((h) >> 16) & 0x3FFF)
  395. #define CP_PACKET0_GET_REG(h) (((h) & 0xFFFF) << 2)
  396. #define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF)
  397. #define PACKET0(reg, n) ((PACKET_TYPE0 << 30) | \
  398. (((reg) >> 2) & 0xFFFF) | \
  399. ((n) & 0x3FFF) << 16)
  400. #define CP_PACKET2 0x80000000
  401. #define PACKET2_PAD_SHIFT 0
  402. #define PACKET2_PAD_MASK (0x3fffffff << 0)
  403. #define PACKET2(v) (CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
  404. #define PACKET3(op, n) ((PACKET_TYPE3 << 30) | \
  405. (((op) & 0xFF) << 8) | \
  406. ((n) & 0x3FFF) << 16)
  407. /* Packet 3 types */
  408. #define PACKET3_NOP 0x10
  409. #define PACKET3_SET_BASE 0x11
  410. #define PACKET3_CLEAR_STATE 0x12
  411. #define PACKET3_INDEX_BUFFER_SIZE 0x13
  412. #define PACKET3_DEALLOC_STATE 0x14
  413. #define PACKET3_DISPATCH_DIRECT 0x15
  414. #define PACKET3_DISPATCH_INDIRECT 0x16
  415. #define PACKET3_INDIRECT_BUFFER_END 0x17
  416. #define PACKET3_SET_PREDICATION 0x20
  417. #define PACKET3_REG_RMW 0x21
  418. #define PACKET3_COND_EXEC 0x22
  419. #define PACKET3_PRED_EXEC 0x23
  420. #define PACKET3_DRAW_INDIRECT 0x24
  421. #define PACKET3_DRAW_INDEX_INDIRECT 0x25
  422. #define PACKET3_INDEX_BASE 0x26
  423. #define PACKET3_DRAW_INDEX_2 0x27
  424. #define PACKET3_CONTEXT_CONTROL 0x28
  425. #define PACKET3_DRAW_INDEX_OFFSET 0x29
  426. #define PACKET3_INDEX_TYPE 0x2A
  427. #define PACKET3_DRAW_INDEX 0x2B
  428. #define PACKET3_DRAW_INDEX_AUTO 0x2D
  429. #define PACKET3_DRAW_INDEX_IMMD 0x2E
  430. #define PACKET3_NUM_INSTANCES 0x2F
  431. #define PACKET3_DRAW_INDEX_MULTI_AUTO 0x30
  432. #define PACKET3_INDIRECT_BUFFER 0x32
  433. #define PACKET3_STRMOUT_BUFFER_UPDATE 0x34
  434. #define PACKET3_DRAW_INDEX_OFFSET_2 0x35
  435. #define PACKET3_DRAW_INDEX_MULTI_ELEMENT 0x36
  436. #define PACKET3_WRITE_DATA 0x37
  437. #define PACKET3_MEM_SEMAPHORE 0x39
  438. #define PACKET3_MPEG_INDEX 0x3A
  439. #define PACKET3_WAIT_REG_MEM 0x3C
  440. #define PACKET3_MEM_WRITE 0x3D
  441. #define PACKET3_SURFACE_SYNC 0x43
  442. # define PACKET3_CB0_DEST_BASE_ENA (1 << 6)
  443. # define PACKET3_CB1_DEST_BASE_ENA (1 << 7)
  444. # define PACKET3_CB2_DEST_BASE_ENA (1 << 8)
  445. # define PACKET3_CB3_DEST_BASE_ENA (1 << 9)
  446. # define PACKET3_CB4_DEST_BASE_ENA (1 << 10)
  447. # define PACKET3_CB5_DEST_BASE_ENA (1 << 11)
  448. # define PACKET3_CB6_DEST_BASE_ENA (1 << 12)
  449. # define PACKET3_CB7_DEST_BASE_ENA (1 << 13)
  450. # define PACKET3_DB_DEST_BASE_ENA (1 << 14)
  451. # define PACKET3_CB8_DEST_BASE_ENA (1 << 15)
  452. # define PACKET3_CB9_DEST_BASE_ENA (1 << 16)
  453. # define PACKET3_CB10_DEST_BASE_ENA (1 << 17)
  454. # define PACKET3_CB11_DEST_BASE_ENA (1 << 18)
  455. # define PACKET3_FULL_CACHE_ENA (1 << 20)
  456. # define PACKET3_TC_ACTION_ENA (1 << 23)
  457. # define PACKET3_CB_ACTION_ENA (1 << 25)
  458. # define PACKET3_DB_ACTION_ENA (1 << 26)
  459. # define PACKET3_SH_ACTION_ENA (1 << 27)
  460. # define PACKET3_SX_ACTION_ENA (1 << 28)
  461. #define PACKET3_ME_INITIALIZE 0x44
  462. #define PACKET3_ME_INITIALIZE_DEVICE_ID(x) ((x) << 16)
  463. #define PACKET3_COND_WRITE 0x45
  464. #define PACKET3_EVENT_WRITE 0x46
  465. #define PACKET3_EVENT_WRITE_EOP 0x47
  466. #define PACKET3_EVENT_WRITE_EOS 0x48
  467. #define PACKET3_PREAMBLE_CNTL 0x4A
  468. # define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE (2 << 28)
  469. # define PACKET3_PREAMBLE_END_CLEAR_STATE (3 << 28)
  470. #define PACKET3_ALU_PS_CONST_BUFFER_COPY 0x4C
  471. #define PACKET3_ALU_VS_CONST_BUFFER_COPY 0x4D
  472. #define PACKET3_ALU_PS_CONST_UPDATE 0x4E
  473. #define PACKET3_ALU_VS_CONST_UPDATE 0x4F
  474. #define PACKET3_ONE_REG_WRITE 0x57
  475. #define PACKET3_SET_CONFIG_REG 0x68
  476. #define PACKET3_SET_CONFIG_REG_START 0x00008000
  477. #define PACKET3_SET_CONFIG_REG_END 0x0000ac00
  478. #define PACKET3_SET_CONTEXT_REG 0x69
  479. #define PACKET3_SET_CONTEXT_REG_START 0x00028000
  480. #define PACKET3_SET_CONTEXT_REG_END 0x00029000
  481. #define PACKET3_SET_ALU_CONST 0x6A
  482. /* alu const buffers only; no reg file */
  483. #define PACKET3_SET_BOOL_CONST 0x6B
  484. #define PACKET3_SET_BOOL_CONST_START 0x0003a500
  485. #define PACKET3_SET_BOOL_CONST_END 0x0003a518
  486. #define PACKET3_SET_LOOP_CONST 0x6C
  487. #define PACKET3_SET_LOOP_CONST_START 0x0003a200
  488. #define PACKET3_SET_LOOP_CONST_END 0x0003a500
  489. #define PACKET3_SET_RESOURCE 0x6D
  490. #define PACKET3_SET_RESOURCE_START 0x00030000
  491. #define PACKET3_SET_RESOURCE_END 0x00038000
  492. #define PACKET3_SET_SAMPLER 0x6E
  493. #define PACKET3_SET_SAMPLER_START 0x0003c000
  494. #define PACKET3_SET_SAMPLER_END 0x0003c600
  495. #define PACKET3_SET_CTL_CONST 0x6F
  496. #define PACKET3_SET_CTL_CONST_START 0x0003cff0
  497. #define PACKET3_SET_CTL_CONST_END 0x0003ff0c
  498. #define PACKET3_SET_RESOURCE_OFFSET 0x70
  499. #define PACKET3_SET_ALU_CONST_VS 0x71
  500. #define PACKET3_SET_ALU_CONST_DI 0x72
  501. #define PACKET3_SET_CONTEXT_REG_INDIRECT 0x73
  502. #define PACKET3_SET_RESOURCE_INDIRECT 0x74
  503. #define PACKET3_SET_APPEND_CNT 0x75
  504. #endif