1 /* $OpenBSD: nid.h,v 1.2 2014/02/15 14:28:13 jsg Exp $ */ 2 /* 3 * Copyright 2010 Advanced Micro Devices, Inc. 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be included in 13 * all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 * OTHER DEALINGS IN THE SOFTWARE. 22 * 23 * Authors: Alex Deucher 24 */ 25 #ifndef NI_H 26 #define NI_H 27 28 #define CAYMAN_MAX_SH_GPRS 256 29 #define CAYMAN_MAX_TEMP_GPRS 16 30 #define CAYMAN_MAX_SH_THREADS 256 31 #define CAYMAN_MAX_SH_STACK_ENTRIES 4096 32 #define CAYMAN_MAX_FRC_EOV_CNT 16384 33 #define CAYMAN_MAX_BACKENDS 8 34 #define CAYMAN_MAX_BACKENDS_MASK 0xFF 35 #define CAYMAN_MAX_BACKENDS_PER_SE_MASK 0xF 36 #define CAYMAN_MAX_SIMDS 16 37 #define CAYMAN_MAX_SIMDS_MASK 0xFFFF 38 #define CAYMAN_MAX_SIMDS_PER_SE_MASK 0xFFF 39 #define CAYMAN_MAX_PIPES 8 40 #define CAYMAN_MAX_PIPES_MASK 0xFF 41 #define CAYMAN_MAX_LDS_NUM 0xFFFF 42 #define CAYMAN_MAX_TCC 16 43 #define CAYMAN_MAX_TCC_MASK 0xFF 44 45 #define CAYMAN_GB_ADDR_CONFIG_GOLDEN 0x02011003 46 #define ARUBA_GB_ADDR_CONFIG_GOLDEN 0x12010001 47 48 #define DMIF_ADDR_CONFIG 0xBD4 49 50 /* DCE6 only */ 51 #define DMIF_ADDR_CALC 0xC00 52 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 58 #define SRBM_SOFT_RESET 0x0E60 59 #define SOFT_RESET_BIF (1 << 1) 60 #define SOFT_RESET_CG (1 << 2) 61 #define SOFT_RESET_DC (1 << 5) 62 #define SOFT_RESET_DMA1 (1 << 6) 63 #define SOFT_RESET_GRBM (1 << 8) 64 #define SOFT_RESET_HDP (1 << 9) 65 #define SOFT_RESET_IH (1 << 10) 66 #define SOFT_RESET_MC (1 << 11) 67 #define SOFT_RESET_RLC (1 << 13) 68 #define SOFT_RESET_ROM (1 << 14) 69 #define SOFT_RESET_SEM (1 << 15) 70 #define SOFT_RESET_VMC (1 << 17) 71 #define SOFT_RESET_DMA (1 << 20) 72 #define SOFT_RESET_TST (1 << 21) 73 #define SOFT_RESET_REGBB (1 << 22) 74 #define SOFT_RESET_ORB (1 << 23) 75 76 #define VM_CONTEXT0_REQUEST_RESPONSE 0x1470 77 #define REQUEST_TYPE(x) (((x) & 0xf) << 0) 78 #define RESPONSE_TYPE_MASK 0x000000F0 79 #define RESPONSE_TYPE_SHIFT 4 80 #define VM_L2_CNTL 0x1400 81 #define ENABLE_L2_CACHE (1 << 0) 82 #define ENABLE_L2_FRAGMENT_PROCESSING (1 << 1) 83 #define ENABLE_L2_PTE_CACHE_LRU_UPDATE_BY_WRITE (1 << 9) 84 #define ENABLE_L2_PDE0_CACHE_LRU_UPDATE_BY_WRITE (1 << 10) 85 #define EFFECTIVE_L2_QUEUE_SIZE(x) (((x) & 7) << 14) 86 #define CONTEXT1_IDENTITY_ACCESS_MODE(x) (((x) & 3) << 18) 87 /* CONTEXT1_IDENTITY_ACCESS_MODE 88 * 0 physical = logical 89 * 1 logical via context1 page table 90 * 2 inside identity aperture use translation, outside physical = logical 91 * 3 inside identity aperture physical = logical, outside use translation 92 */ 93 #define VM_L2_CNTL2 0x1404 94 #define INVALIDATE_ALL_L1_TLBS (1 << 0) 95 #define INVALIDATE_L2_CACHE (1 << 1) 96 #define VM_L2_CNTL3 0x1408 97 #define BANK_SELECT(x) ((x) << 0) 98 #define CACHE_UPDATE_MODE(x) ((x) << 6) 99 #define L2_CACHE_BIGK_ASSOCIATIVITY (1 << 20) 100 #define L2_CACHE_BIGK_FRAGMENT_SIZE(x) ((x) << 15) 101 #define VM_L2_STATUS 0x140C 102 #define L2_BUSY (1 << 0) 103 #define VM_CONTEXT0_CNTL 0x1410 104 #define ENABLE_CONTEXT (1 << 0) 105 #define PAGE_TABLE_DEPTH(x) (((x) & 3) << 1) 106 #define RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 3) 107 #define RANGE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 4) 108 #define DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 6) 109 #define DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 7) 110 #define PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 9) 111 #define PDE0_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 10) 112 #define VALID_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 12) 113 #define VALID_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 13) 114 #define READ_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 15) 115 #define READ_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 16) 116 #define WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT (1 << 18) 117 #define WRITE_PROTECTION_FAULT_ENABLE_DEFAULT (1 << 19) 118 #define VM_CONTEXT1_CNTL 0x1414 119 #define VM_CONTEXT0_CNTL2 0x1430 120 #define VM_CONTEXT1_CNTL2 0x1434 121 #define VM_INVALIDATE_REQUEST 0x1478 122 #define VM_INVALIDATE_RESPONSE 0x147c 123 #define VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR 0x1518 124 #define VM_CONTEXT1_PROTECTION_FAULT_DEFAULT_ADDR 0x151c 125 #define VM_CONTEXT0_PAGE_TABLE_BASE_ADDR 0x153C 126 #define VM_CONTEXT0_PAGE_TABLE_START_ADDR 0x155C 127 #define VM_CONTEXT0_PAGE_TABLE_END_ADDR 0x157C 128 129 #define MC_SHARED_CHMAP 0x2004 130 #define NOOFCHAN_SHIFT 12 131 #define NOOFCHAN_MASK 0x00003000 132 #define MC_SHARED_CHREMAP 0x2008 133 134 #define MC_VM_SYSTEM_APERTURE_LOW_ADDR 0x2034 135 #define MC_VM_SYSTEM_APERTURE_HIGH_ADDR 0x2038 136 #define MC_VM_SYSTEM_APERTURE_DEFAULT_ADDR 0x203C 137 #define MC_VM_MX_L1_TLB_CNTL 0x2064 138 #define ENABLE_L1_TLB (1 << 0) 139 #define ENABLE_L1_FRAGMENT_PROCESSING (1 << 1) 140 #define SYSTEM_ACCESS_MODE_PA_ONLY (0 << 3) 141 #define SYSTEM_ACCESS_MODE_USE_SYS_MAP (1 << 3) 142 #define SYSTEM_ACCESS_MODE_IN_SYS (2 << 3) 143 #define SYSTEM_ACCESS_MODE_NOT_IN_SYS (3 << 3) 144 #define SYSTEM_APERTURE_UNMAPPED_ACCESS_PASS_THRU (0 << 5) 145 #define ENABLE_ADVANCED_DRIVER_MODEL (1 << 6) 146 #define FUS_MC_VM_FB_OFFSET 0x2068 147 148 #define MC_SHARED_BLACKOUT_CNTL 0x20ac 149 #define MC_ARB_RAMCFG 0x2760 150 #define NOOFBANK_SHIFT 0 151 #define NOOFBANK_MASK 0x00000003 152 #define NOOFRANK_SHIFT 2 153 #define NOOFRANK_MASK 0x00000004 154 #define NOOFROWS_SHIFT 3 155 #define NOOFROWS_MASK 0x00000038 156 #define NOOFCOLS_SHIFT 6 157 #define NOOFCOLS_MASK 0x000000C0 158 #define CHANSIZE_SHIFT 8 159 #define CHANSIZE_MASK 0x00000100 160 #define BURSTLENGTH_SHIFT 9 161 #define BURSTLENGTH_MASK 0x00000200 162 #define CHANSIZE_OVERRIDE (1 << 11) 163 #define MC_SEQ_SUP_CNTL 0x28c8 164 #define RUN_MASK (1 << 0) 165 #define MC_SEQ_SUP_PGM 0x28cc 166 #define MC_IO_PAD_CNTL_D0 0x29d0 167 #define MEM_FALL_OUT_CMD (1 << 8) 168 #define MC_SEQ_MISC0 0x2a00 169 #define MC_SEQ_MISC0_GDDR5_SHIFT 28 170 #define MC_SEQ_MISC0_GDDR5_MASK 0xf0000000 171 #define MC_SEQ_MISC0_GDDR5_VALUE 5 172 #define MC_SEQ_IO_DEBUG_INDEX 0x2a44 173 #define MC_SEQ_IO_DEBUG_DATA 0x2a48 174 175 #define HDP_HOST_PATH_CNTL 0x2C00 176 #define HDP_NONSURFACE_BASE 0x2C04 177 #define HDP_NONSURFACE_INFO 0x2C08 178 #define HDP_NONSURFACE_SIZE 0x2C0C 179 #define HDP_ADDR_CONFIG 0x2F48 180 #define HDP_MISC_CNTL 0x2F4C 181 #define HDP_FLUSH_INVALIDATE_CACHE (1 << 0) 182 183 #define CC_SYS_RB_BACKEND_DISABLE 0x3F88 184 #define GC_USER_SYS_RB_BACKEND_DISABLE 0x3F8C 185 #define CGTS_SYS_TCC_DISABLE 0x3F90 186 #define CGTS_USER_SYS_TCC_DISABLE 0x3F94 187 188 #define RLC_GFX_INDEX 0x3FC4 189 190 #define CONFIG_MEMSIZE 0x5428 191 192 #define HDP_MEM_COHERENCY_FLUSH_CNTL 0x5480 193 #define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0 194 195 #define GRBM_CNTL 0x8000 196 #define GRBM_READ_TIMEOUT(x) ((x) << 0) 197 #define GRBM_STATUS 0x8010 198 #define CMDFIFO_AVAIL_MASK 0x0000000F 199 #define RING2_RQ_PENDING (1 << 4) 200 #define SRBM_RQ_PENDING (1 << 5) 201 #define RING1_RQ_PENDING (1 << 6) 202 #define CF_RQ_PENDING (1 << 7) 203 #define PF_RQ_PENDING (1 << 8) 204 #define GDS_DMA_RQ_PENDING (1 << 9) 205 #define GRBM_EE_BUSY (1 << 10) 206 #define SX_CLEAN (1 << 11) 207 #define DB_CLEAN (1 << 12) 208 #define CB_CLEAN (1 << 13) 209 #define TA_BUSY (1 << 14) 210 #define GDS_BUSY (1 << 15) 211 #define VGT_BUSY_NO_DMA (1 << 16) 212 #define VGT_BUSY (1 << 17) 213 #define IA_BUSY_NO_DMA (1 << 18) 214 #define IA_BUSY (1 << 19) 215 #define SX_BUSY (1 << 20) 216 #define SH_BUSY (1 << 21) 217 #define SPI_BUSY (1 << 22) 218 #define SC_BUSY (1 << 24) 219 #define PA_BUSY (1 << 25) 220 #define DB_BUSY (1 << 26) 221 #define CP_COHERENCY_BUSY (1 << 28) 222 #define CP_BUSY (1 << 29) 223 #define CB_BUSY (1 << 30) 224 #define GUI_ACTIVE (1 << 31) 225 #define GRBM_STATUS_SE0 0x8014 226 #define GRBM_STATUS_SE1 0x8018 227 #define SE_SX_CLEAN (1 << 0) 228 #define SE_DB_CLEAN (1 << 1) 229 #define SE_CB_CLEAN (1 << 2) 230 #define SE_VGT_BUSY (1 << 23) 231 #define SE_PA_BUSY (1 << 24) 232 #define SE_TA_BUSY (1 << 25) 233 #define SE_SX_BUSY (1 << 26) 234 #define SE_SPI_BUSY (1 << 27) 235 #define SE_SH_BUSY (1 << 28) 236 #define SE_SC_BUSY (1 << 29) 237 #define SE_DB_BUSY (1 << 30) 238 #define SE_CB_BUSY (1 << 31) 239 #define GRBM_SOFT_RESET 0x8020 240 #define SOFT_RESET_CP (1 << 0) 241 #define SOFT_RESET_CB (1 << 1) 242 #define SOFT_RESET_DB (1 << 3) 243 #define SOFT_RESET_GDS (1 << 4) 244 #define SOFT_RESET_PA (1 << 5) 245 #define SOFT_RESET_SC (1 << 6) 246 #define SOFT_RESET_SPI (1 << 8) 247 #define SOFT_RESET_SH (1 << 9) 248 #define SOFT_RESET_SX (1 << 10) 249 #define SOFT_RESET_TC (1 << 11) 250 #define SOFT_RESET_TA (1 << 12) 251 #define SOFT_RESET_VGT (1 << 14) 252 #define SOFT_RESET_IA (1 << 15) 253 254 #define GRBM_GFX_INDEX 0x802C 255 #define INSTANCE_INDEX(x) ((x) << 0) 256 #define SE_INDEX(x) ((x) << 16) 257 #define INSTANCE_BROADCAST_WRITES (1 << 30) 258 #define SE_BROADCAST_WRITES (1 << 31) 259 260 #define SCRATCH_REG0 0x8500 261 #define SCRATCH_REG1 0x8504 262 #define SCRATCH_REG2 0x8508 263 #define SCRATCH_REG3 0x850C 264 #define SCRATCH_REG4 0x8510 265 #define SCRATCH_REG5 0x8514 266 #define SCRATCH_REG6 0x8518 267 #define SCRATCH_REG7 0x851C 268 #define SCRATCH_UMSK 0x8540 269 #define SCRATCH_ADDR 0x8544 270 #define CP_SEM_WAIT_TIMER 0x85BC 271 #define CP_SEM_INCOMPLETE_TIMER_CNTL 0x85C8 272 #define CP_COHER_CNTL2 0x85E8 273 #define CP_STALLED_STAT1 0x8674 274 #define CP_STALLED_STAT2 0x8678 275 #define CP_BUSY_STAT 0x867C 276 #define CP_STAT 0x8680 277 #define CP_ME_CNTL 0x86D8 278 #define CP_ME_HALT (1 << 28) 279 #define CP_PFP_HALT (1 << 26) 280 #define CP_RB2_RPTR 0x86f8 281 #define CP_RB1_RPTR 0x86fc 282 #define CP_RB0_RPTR 0x8700 283 #define CP_RB_WPTR_DELAY 0x8704 284 #define CP_MEQ_THRESHOLDS 0x8764 285 #define MEQ1_START(x) ((x) << 0) 286 #define MEQ2_START(x) ((x) << 8) 287 #define CP_PERFMON_CNTL 0x87FC 288 289 #define VGT_CACHE_INVALIDATION 0x88C4 290 #define CACHE_INVALIDATION(x) ((x) << 0) 291 #define VC_ONLY 0 292 #define TC_ONLY 1 293 #define VC_AND_TC 2 294 #define AUTO_INVLD_EN(x) ((x) << 6) 295 #define NO_AUTO 0 296 #define ES_AUTO 1 297 #define GS_AUTO 2 298 #define ES_AND_GS_AUTO 3 299 #define VGT_GS_VERTEX_REUSE 0x88D4 300 301 #define CC_GC_SHADER_PIPE_CONFIG 0x8950 302 #define GC_USER_SHADER_PIPE_CONFIG 0x8954 303 #define INACTIVE_QD_PIPES(x) ((x) << 8) 304 #define INACTIVE_QD_PIPES_MASK 0x0000FF00 305 #define INACTIVE_QD_PIPES_SHIFT 8 306 #define INACTIVE_SIMDS(x) ((x) << 16) 307 #define INACTIVE_SIMDS_MASK 0xFFFF0000 308 #define INACTIVE_SIMDS_SHIFT 16 309 310 #define VGT_PRIMITIVE_TYPE 0x8958 311 #define VGT_NUM_INSTANCES 0x8974 312 #define VGT_TF_RING_SIZE 0x8988 313 #define VGT_OFFCHIP_LDS_BASE 0x89b4 314 315 #define PA_SC_LINE_STIPPLE_STATE 0x8B10 316 #define PA_CL_ENHANCE 0x8A14 317 #define CLIP_VTX_REORDER_ENA (1 << 0) 318 #define NUM_CLIP_SEQ(x) ((x) << 1) 319 #define PA_SC_FIFO_SIZE 0x8BCC 320 #define SC_PRIM_FIFO_SIZE(x) ((x) << 0) 321 #define SC_HIZ_TILE_FIFO_SIZE(x) ((x) << 12) 322 #define SC_EARLYZ_TILE_FIFO_SIZE(x) ((x) << 20) 323 #define PA_SC_FORCE_EOV_MAX_CNTS 0x8B24 324 #define FORCE_EOV_MAX_CLK_CNT(x) ((x) << 0) 325 #define FORCE_EOV_MAX_REZ_CNT(x) ((x) << 16) 326 327 #define SQ_CONFIG 0x8C00 328 #define VC_ENABLE (1 << 0) 329 #define EXPORT_SRC_C (1 << 1) 330 #define GFX_PRIO(x) ((x) << 2) 331 #define CS1_PRIO(x) ((x) << 4) 332 #define CS2_PRIO(x) ((x) << 6) 333 #define SQ_GPR_RESOURCE_MGMT_1 0x8C04 334 #define NUM_PS_GPRS(x) ((x) << 0) 335 #define NUM_VS_GPRS(x) ((x) << 16) 336 #define NUM_CLAUSE_TEMP_GPRS(x) ((x) << 28) 337 #define SQ_ESGS_RING_SIZE 0x8c44 338 #define SQ_GSVS_RING_SIZE 0x8c4c 339 #define SQ_ESTMP_RING_BASE 0x8c50 340 #define SQ_ESTMP_RING_SIZE 0x8c54 341 #define SQ_GSTMP_RING_BASE 0x8c58 342 #define SQ_GSTMP_RING_SIZE 0x8c5c 343 #define SQ_VSTMP_RING_BASE 0x8c60 344 #define SQ_VSTMP_RING_SIZE 0x8c64 345 #define SQ_PSTMP_RING_BASE 0x8c68 346 #define SQ_PSTMP_RING_SIZE 0x8c6c 347 #define SQ_MS_FIFO_SIZES 0x8CF0 348 #define CACHE_FIFO_SIZE(x) ((x) << 0) 349 #define FETCH_FIFO_HIWATER(x) ((x) << 8) 350 #define DONE_FIFO_HIWATER(x) ((x) << 16) 351 #define ALU_UPDATE_FIFO_HIWATER(x) ((x) << 24) 352 #define SQ_LSTMP_RING_BASE 0x8e10 353 #define SQ_LSTMP_RING_SIZE 0x8e14 354 #define SQ_HSTMP_RING_BASE 0x8e18 355 #define SQ_HSTMP_RING_SIZE 0x8e1c 356 #define SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 0x8D8C 357 #define DYN_GPR_ENABLE (1 << 8) 358 #define SQ_CONST_MEM_BASE 0x8df8 359 360 #define SX_EXPORT_BUFFER_SIZES 0x900C 361 #define COLOR_BUFFER_SIZE(x) ((x) << 0) 362 #define POSITION_BUFFER_SIZE(x) ((x) << 8) 363 #define SMX_BUFFER_SIZE(x) ((x) << 16) 364 #define SX_DEBUG_1 0x9058 365 #define ENABLE_NEW_SMX_ADDRESS (1 << 16) 366 367 #define SPI_CONFIG_CNTL 0x9100 368 #define GPR_WRITE_PRIORITY(x) ((x) << 0) 369 #define SPI_CONFIG_CNTL_1 0x913C 370 #define VTX_DONE_DELAY(x) ((x) << 0) 371 #define INTERP_ONE_PRIM_PER_ROW (1 << 4) 372 #define CRC_SIMD_ID_WADDR_DISABLE (1 << 8) 373 374 #define CGTS_TCC_DISABLE 0x9148 375 #define CGTS_USER_TCC_DISABLE 0x914C 376 #define TCC_DISABLE_MASK 0xFFFF0000 377 #define TCC_DISABLE_SHIFT 16 378 #define CGTS_SM_CTRL_REG 0x9150 379 #define OVERRIDE (1 << 21) 380 381 #define TA_CNTL_AUX 0x9508 382 #define DISABLE_CUBE_WRAP (1 << 0) 383 #define DISABLE_CUBE_ANISO (1 << 1) 384 385 #define TCP_CHAN_STEER_LO 0x960c 386 #define TCP_CHAN_STEER_HI 0x9610 387 388 #define CC_RB_BACKEND_DISABLE 0x98F4 389 #define BACKEND_DISABLE(x) ((x) << 16) 390 #define GB_ADDR_CONFIG 0x98F8 391 #define NUM_PIPES(x) ((x) << 0) 392 #define NUM_PIPES_MASK 0x00000007 393 #define NUM_PIPES_SHIFT 0 394 #define PIPE_INTERLEAVE_SIZE(x) ((x) << 4) 395 #define PIPE_INTERLEAVE_SIZE_MASK 0x00000070 396 #define PIPE_INTERLEAVE_SIZE_SHIFT 4 397 #define BANK_INTERLEAVE_SIZE(x) ((x) << 8) 398 #define NUM_SHADER_ENGINES(x) ((x) << 12) 399 #define NUM_SHADER_ENGINES_MASK 0x00003000 400 #define NUM_SHADER_ENGINES_SHIFT 12 401 #define SHADER_ENGINE_TILE_SIZE(x) ((x) << 16) 402 #define SHADER_ENGINE_TILE_SIZE_MASK 0x00070000 403 #define SHADER_ENGINE_TILE_SIZE_SHIFT 16 404 #define NUM_GPUS(x) ((x) << 20) 405 #define NUM_GPUS_MASK 0x00700000 406 #define NUM_GPUS_SHIFT 20 407 #define MULTI_GPU_TILE_SIZE(x) ((x) << 24) 408 #define MULTI_GPU_TILE_SIZE_MASK 0x03000000 409 #define MULTI_GPU_TILE_SIZE_SHIFT 24 410 #define ROW_SIZE(x) ((x) << 28) 411 #define ROW_SIZE_MASK 0x30000000 412 #define ROW_SIZE_SHIFT 28 413 #define NUM_LOWER_PIPES(x) ((x) << 30) 414 #define NUM_LOWER_PIPES_MASK 0x40000000 415 #define NUM_LOWER_PIPES_SHIFT 30 416 #define GB_BACKEND_MAP 0x98FC 417 418 #define CB_PERF_CTR0_SEL_0 0x9A20 419 #define CB_PERF_CTR0_SEL_1 0x9A24 420 #define CB_PERF_CTR1_SEL_0 0x9A28 421 #define CB_PERF_CTR1_SEL_1 0x9A2C 422 #define CB_PERF_CTR2_SEL_0 0x9A30 423 #define CB_PERF_CTR2_SEL_1 0x9A34 424 #define CB_PERF_CTR3_SEL_0 0x9A38 425 #define CB_PERF_CTR3_SEL_1 0x9A3C 426 427 #define GC_USER_RB_BACKEND_DISABLE 0x9B7C 428 #define BACKEND_DISABLE_MASK 0x00FF0000 429 #define BACKEND_DISABLE_SHIFT 16 430 431 #define SMX_DC_CTL0 0xA020 432 #define USE_HASH_FUNCTION (1 << 0) 433 #define NUMBER_OF_SETS(x) ((x) << 1) 434 #define FLUSH_ALL_ON_EVENT (1 << 10) 435 #define STALL_ON_EVENT (1 << 11) 436 #define SMX_EVENT_CTL 0xA02C 437 #define ES_FLUSH_CTL(x) ((x) << 0) 438 #define GS_FLUSH_CTL(x) ((x) << 3) 439 #define ACK_FLUSH_CTL(x) ((x) << 6) 440 #define SYNC_FLUSH_CTL (1 << 8) 441 442 #define CP_RB0_BASE 0xC100 443 #define CP_RB0_CNTL 0xC104 444 #define RB_BUFSZ(x) ((x) << 0) 445 #define RB_BLKSZ(x) ((x) << 8) 446 #define RB_NO_UPDATE (1 << 27) 447 #define RB_RPTR_WR_ENA (1 << 31) 448 #define BUF_SWAP_32BIT (2 << 16) 449 #define CP_RB0_RPTR_ADDR 0xC10C 450 #define CP_RB0_RPTR_ADDR_HI 0xC110 451 #define CP_RB0_WPTR 0xC114 452 453 #define CP_INT_CNTL 0xC124 454 # define CNTX_BUSY_INT_ENABLE (1 << 19) 455 # define CNTX_EMPTY_INT_ENABLE (1 << 20) 456 # define TIME_STAMP_INT_ENABLE (1 << 26) 457 458 #define CP_RB1_BASE 0xC180 459 #define CP_RB1_CNTL 0xC184 460 #define CP_RB1_RPTR_ADDR 0xC188 461 #define CP_RB1_RPTR_ADDR_HI 0xC18C 462 #define CP_RB1_WPTR 0xC190 463 #define CP_RB2_BASE 0xC194 464 #define CP_RB2_CNTL 0xC198 465 #define CP_RB2_RPTR_ADDR 0xC19C 466 #define CP_RB2_RPTR_ADDR_HI 0xC1A0 467 #define CP_RB2_WPTR 0xC1A4 468 #define CP_PFP_UCODE_ADDR 0xC150 469 #define CP_PFP_UCODE_DATA 0xC154 470 #define CP_ME_RAM_RADDR 0xC158 471 #define CP_ME_RAM_WADDR 0xC15C 472 #define CP_ME_RAM_DATA 0xC160 473 #define CP_DEBUG 0xC1FC 474 475 #define VGT_EVENT_INITIATOR 0x28a90 476 # define CACHE_FLUSH_AND_INV_EVENT_TS (0x14 << 0) 477 # define CACHE_FLUSH_AND_INV_EVENT (0x16 << 0) 478 479 /* 480 * PM4 481 */ 482 #define PACKET_TYPE0 0 483 #define PACKET_TYPE1 1 484 #define PACKET_TYPE2 2 485 #define PACKET_TYPE3 3 486 487 #define CP_PACKET_GET_TYPE(h) (((h) >> 30) & 3) 488 #define CP_PACKET_GET_COUNT(h) (((h) >> 16) & 0x3FFF) 489 #define CP_PACKET0_GET_REG(h) (((h) & 0xFFFF) << 2) 490 #define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF) 491 #define PACKET0(reg, n) ((PACKET_TYPE0 << 30) | \ 492 (((reg) >> 2) & 0xFFFF) | \ 493 ((n) & 0x3FFF) << 16) 494 #define CP_PACKET2 0x80000000 495 #define PACKET2_PAD_SHIFT 0 496 #define PACKET2_PAD_MASK (0x3fffffff << 0) 497 498 #define PACKET2(v) (CP_PACKET2 | REG_SET(PACKET2_PAD, (v))) 499 500 #define PACKET3(op, n) ((PACKET_TYPE3 << 30) | \ 501 (((op) & 0xFF) << 8) | \ 502 ((n) & 0x3FFF) << 16) 503 504 /* Packet 3 types */ 505 #define PACKET3_NOP 0x10 506 #define PACKET3_SET_BASE 0x11 507 #define PACKET3_CLEAR_STATE 0x12 508 #define PACKET3_INDEX_BUFFER_SIZE 0x13 509 #define PACKET3_DEALLOC_STATE 0x14 510 #define PACKET3_DISPATCH_DIRECT 0x15 511 #define PACKET3_DISPATCH_INDIRECT 0x16 512 #define PACKET3_INDIRECT_BUFFER_END 0x17 513 #define PACKET3_MODE_CONTROL 0x18 514 #define PACKET3_SET_PREDICATION 0x20 515 #define PACKET3_REG_RMW 0x21 516 #define PACKET3_COND_EXEC 0x22 517 #define PACKET3_PRED_EXEC 0x23 518 #define PACKET3_DRAW_INDIRECT 0x24 519 #define PACKET3_DRAW_INDEX_INDIRECT 0x25 520 #define PACKET3_INDEX_BASE 0x26 521 #define PACKET3_DRAW_INDEX_2 0x27 522 #define PACKET3_CONTEXT_CONTROL 0x28 523 #define PACKET3_DRAW_INDEX_OFFSET 0x29 524 #define PACKET3_INDEX_TYPE 0x2A 525 #define PACKET3_DRAW_INDEX 0x2B 526 #define PACKET3_DRAW_INDEX_AUTO 0x2D 527 #define PACKET3_DRAW_INDEX_IMMD 0x2E 528 #define PACKET3_NUM_INSTANCES 0x2F 529 #define PACKET3_DRAW_INDEX_MULTI_AUTO 0x30 530 #define PACKET3_INDIRECT_BUFFER 0x32 531 #define PACKET3_STRMOUT_BUFFER_UPDATE 0x34 532 #define PACKET3_DRAW_INDEX_OFFSET_2 0x35 533 #define PACKET3_DRAW_INDEX_MULTI_ELEMENT 0x36 534 #define PACKET3_WRITE_DATA 0x37 535 #define PACKET3_MEM_SEMAPHORE 0x39 536 #define PACKET3_MPEG_INDEX 0x3A 537 #define PACKET3_WAIT_REG_MEM 0x3C 538 #define PACKET3_MEM_WRITE 0x3D 539 #define PACKET3_PFP_SYNC_ME 0x42 540 #define PACKET3_SURFACE_SYNC 0x43 541 # define PACKET3_CB0_DEST_BASE_ENA (1 << 6) 542 # define PACKET3_CB1_DEST_BASE_ENA (1 << 7) 543 # define PACKET3_CB2_DEST_BASE_ENA (1 << 8) 544 # define PACKET3_CB3_DEST_BASE_ENA (1 << 9) 545 # define PACKET3_CB4_DEST_BASE_ENA (1 << 10) 546 # define PACKET3_CB5_DEST_BASE_ENA (1 << 11) 547 # define PACKET3_CB6_DEST_BASE_ENA (1 << 12) 548 # define PACKET3_CB7_DEST_BASE_ENA (1 << 13) 549 # define PACKET3_DB_DEST_BASE_ENA (1 << 14) 550 # define PACKET3_CB8_DEST_BASE_ENA (1 << 15) 551 # define PACKET3_CB9_DEST_BASE_ENA (1 << 16) 552 # define PACKET3_CB10_DEST_BASE_ENA (1 << 17) 553 # define PACKET3_CB11_DEST_BASE_ENA (1 << 18) 554 # define PACKET3_FULL_CACHE_ENA (1 << 20) 555 # define PACKET3_TC_ACTION_ENA (1 << 23) 556 # define PACKET3_CB_ACTION_ENA (1 << 25) 557 # define PACKET3_DB_ACTION_ENA (1 << 26) 558 # define PACKET3_SH_ACTION_ENA (1 << 27) 559 # define PACKET3_SX_ACTION_ENA (1 << 28) 560 # define PACKET3_ENGINE_ME (1 << 31) 561 #define PACKET3_ME_INITIALIZE 0x44 562 #define PACKET3_ME_INITIALIZE_DEVICE_ID(x) ((x) << 16) 563 #define PACKET3_COND_WRITE 0x45 564 #define PACKET3_EVENT_WRITE 0x46 565 #define EVENT_TYPE(x) ((x) << 0) 566 #define EVENT_INDEX(x) ((x) << 8) 567 /* 0 - any non-TS event 568 * 1 - ZPASS_DONE 569 * 2 - SAMPLE_PIPELINESTAT 570 * 3 - SAMPLE_STREAMOUTSTAT* 571 * 4 - *S_PARTIAL_FLUSH 572 * 5 - TS events 573 */ 574 #define PACKET3_EVENT_WRITE_EOP 0x47 575 #define DATA_SEL(x) ((x) << 29) 576 /* 0 - discard 577 * 1 - send low 32bit data 578 * 2 - send 64bit data 579 * 3 - send 64bit counter value 580 */ 581 #define INT_SEL(x) ((x) << 24) 582 /* 0 - none 583 * 1 - interrupt only (DATA_SEL = 0) 584 * 2 - interrupt when data write is confirmed 585 */ 586 #define PACKET3_EVENT_WRITE_EOS 0x48 587 #define PACKET3_PREAMBLE_CNTL 0x4A 588 # define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE (2 << 28) 589 # define PACKET3_PREAMBLE_END_CLEAR_STATE (3 << 28) 590 #define PACKET3_ALU_PS_CONST_BUFFER_COPY 0x4C 591 #define PACKET3_ALU_VS_CONST_BUFFER_COPY 0x4D 592 #define PACKET3_ALU_PS_CONST_UPDATE 0x4E 593 #define PACKET3_ALU_VS_CONST_UPDATE 0x4F 594 #define PACKET3_ONE_REG_WRITE 0x57 595 #define PACKET3_SET_CONFIG_REG 0x68 596 #define PACKET3_SET_CONFIG_REG_START 0x00008000 597 #define PACKET3_SET_CONFIG_REG_END 0x0000ac00 598 #define PACKET3_SET_CONTEXT_REG 0x69 599 #define PACKET3_SET_CONTEXT_REG_START 0x00028000 600 #define PACKET3_SET_CONTEXT_REG_END 0x00029000 601 #define PACKET3_SET_ALU_CONST 0x6A 602 /* alu const buffers only; no reg file */ 603 #define PACKET3_SET_BOOL_CONST 0x6B 604 #define PACKET3_SET_BOOL_CONST_START 0x0003a500 605 #define PACKET3_SET_BOOL_CONST_END 0x0003a518 606 #define PACKET3_SET_LOOP_CONST 0x6C 607 #define PACKET3_SET_LOOP_CONST_START 0x0003a200 608 #define PACKET3_SET_LOOP_CONST_END 0x0003a500 609 #define PACKET3_SET_RESOURCE 0x6D 610 #define PACKET3_SET_RESOURCE_START 0x00030000 611 #define PACKET3_SET_RESOURCE_END 0x00038000 612 #define PACKET3_SET_SAMPLER 0x6E 613 #define PACKET3_SET_SAMPLER_START 0x0003c000 614 #define PACKET3_SET_SAMPLER_END 0x0003c600 615 #define PACKET3_SET_CTL_CONST 0x6F 616 #define PACKET3_SET_CTL_CONST_START 0x0003cff0 617 #define PACKET3_SET_CTL_CONST_END 0x0003ff0c 618 #define PACKET3_SET_RESOURCE_OFFSET 0x70 619 #define PACKET3_SET_ALU_CONST_VS 0x71 620 #define PACKET3_SET_ALU_CONST_DI 0x72 621 #define PACKET3_SET_CONTEXT_REG_INDIRECT 0x73 622 #define PACKET3_SET_RESOURCE_INDIRECT 0x74 623 #define PACKET3_SET_APPEND_CNT 0x75 624 #define PACKET3_ME_WRITE 0x7A 625 626 /* ASYNC DMA - first instance at 0xd000, second at 0xd800 */ 627 #define DMA0_REGISTER_OFFSET 0x0 /* not a register */ 628 #define DMA1_REGISTER_OFFSET 0x800 /* not a register */ 629 630 #define DMA_RB_CNTL 0xd000 631 # define DMA_RB_ENABLE (1 << 0) 632 # define DMA_RB_SIZE(x) ((x) << 1) /* log2 */ 633 # define DMA_RB_SWAP_ENABLE (1 << 9) /* 8IN32 */ 634 # define DMA_RPTR_WRITEBACK_ENABLE (1 << 12) 635 # define DMA_RPTR_WRITEBACK_SWAP_ENABLE (1 << 13) /* 8IN32 */ 636 # define DMA_RPTR_WRITEBACK_TIMER(x) ((x) << 16) /* log2 */ 637 #define DMA_RB_BASE 0xd004 638 #define DMA_RB_RPTR 0xd008 639 #define DMA_RB_WPTR 0xd00c 640 641 #define DMA_RB_RPTR_ADDR_HI 0xd01c 642 #define DMA_RB_RPTR_ADDR_LO 0xd020 643 644 #define DMA_IB_CNTL 0xd024 645 # define DMA_IB_ENABLE (1 << 0) 646 # define DMA_IB_SWAP_ENABLE (1 << 4) 647 # define CMD_VMID_FORCE (1 << 31) 648 #define DMA_IB_RPTR 0xd028 649 #define DMA_CNTL 0xd02c 650 # define TRAP_ENABLE (1 << 0) 651 # define SEM_INCOMPLETE_INT_ENABLE (1 << 1) 652 # define SEM_WAIT_INT_ENABLE (1 << 2) 653 # define DATA_SWAP_ENABLE (1 << 3) 654 # define FENCE_SWAP_ENABLE (1 << 4) 655 # define CTXEMPTY_INT_ENABLE (1 << 28) 656 #define DMA_STATUS_REG 0xd034 657 # define DMA_IDLE (1 << 0) 658 #define DMA_SEM_INCOMPLETE_TIMER_CNTL 0xd044 659 #define DMA_SEM_WAIT_FAIL_TIMER_CNTL 0xd048 660 #define DMA_TILING_CONFIG 0xd0b8 661 #define DMA_MODE 0xd0bc 662 663 #define DMA_PACKET(cmd, t, s, n) ((((cmd) & 0xF) << 28) | \ 664 (((t) & 0x1) << 23) | \ 665 (((s) & 0x1) << 22) | \ 666 (((n) & 0xFFFFF) << 0)) 667 668 #define DMA_IB_PACKET(cmd, vmid, n) ((((cmd) & 0xF) << 28) | \ 669 (((vmid) & 0xF) << 20) | \ 670 (((n) & 0xFFFFF) << 0)) 671 672 /* async DMA Packet types */ 673 #define DMA_PACKET_WRITE 0x2 674 #define DMA_PACKET_COPY 0x3 675 #define DMA_PACKET_INDIRECT_BUFFER 0x4 676 #define DMA_PACKET_SEMAPHORE 0x5 677 #define DMA_PACKET_FENCE 0x6 678 #define DMA_PACKET_TRAP 0x7 679 #define DMA_PACKET_SRBM_WRITE 0x9 680 #define DMA_PACKET_CONSTANT_FILL 0xd 681 #define DMA_PACKET_NOP 0xf 682 683 #endif 684