0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #ifndef SOC15_H
0024 #define SOC15_H
0025
0026 #define GFX9_NUM_GFX_RINGS 1
0027 #define GFX9_NUM_COMPUTE_RINGS 8
0028
0029
0030
0031
0032 #define PACKET_TYPE0 0
0033 #define PACKET_TYPE1 1
0034 #define PACKET_TYPE2 2
0035 #define PACKET_TYPE3 3
0036
0037 #define CP_PACKET_GET_TYPE(h) (((h) >> 30) & 3)
0038 #define CP_PACKET_GET_COUNT(h) (((h) >> 16) & 0x3FFF)
0039 #define CP_PACKET0_GET_REG(h) ((h) & 0xFFFF)
0040 #define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF)
0041 #define PACKET0(reg, n) ((PACKET_TYPE0 << 30) | \
0042 ((reg) & 0xFFFF) | \
0043 ((n) & 0x3FFF) << 16)
0044 #define CP_PACKET2 0x80000000
0045 #define PACKET2_PAD_SHIFT 0
0046 #define PACKET2_PAD_MASK (0x3fffffff << 0)
0047
0048 #define PACKET2(v) (CP_PACKET2 | REG_SET(PACKET2_PAD, (v)))
0049
0050 #define PACKET3(op, n) ((PACKET_TYPE3 << 30) | \
0051 (((op) & 0xFF) << 8) | \
0052 ((n) & 0x3FFF) << 16)
0053
0054 #define PACKET3_COMPUTE(op, n) (PACKET3(op, n) | 1 << 1)
0055
0056 #define PACKETJ_CONDITION_CHECK0 0
0057 #define PACKETJ_CONDITION_CHECK1 1
0058 #define PACKETJ_CONDITION_CHECK2 2
0059 #define PACKETJ_CONDITION_CHECK3 3
0060 #define PACKETJ_CONDITION_CHECK4 4
0061 #define PACKETJ_CONDITION_CHECK5 5
0062 #define PACKETJ_CONDITION_CHECK6 6
0063 #define PACKETJ_CONDITION_CHECK7 7
0064
0065 #define PACKETJ_TYPE0 0
0066 #define PACKETJ_TYPE1 1
0067 #define PACKETJ_TYPE2 2
0068 #define PACKETJ_TYPE3 3
0069 #define PACKETJ_TYPE4 4
0070 #define PACKETJ_TYPE5 5
0071 #define PACKETJ_TYPE6 6
0072 #define PACKETJ_TYPE7 7
0073
0074 #define PACKETJ(reg, r, cond, type) ((reg & 0x3FFFF) | \
0075 ((r & 0x3F) << 18) | \
0076 ((cond & 0xF) << 24) | \
0077 ((type & 0xF) << 28))
0078
0079
0080 #define PACKET3_NOP 0x10
0081 #define PACKET3_SET_BASE 0x11
0082 #define PACKET3_BASE_INDEX(x) ((x) << 0)
0083 #define CE_PARTITION_BASE 3
0084 #define PACKET3_CLEAR_STATE 0x12
0085 #define PACKET3_INDEX_BUFFER_SIZE 0x13
0086 #define PACKET3_DISPATCH_DIRECT 0x15
0087 #define PACKET3_DISPATCH_INDIRECT 0x16
0088 #define PACKET3_ATOMIC_GDS 0x1D
0089 #define PACKET3_ATOMIC_MEM 0x1E
0090 #define PACKET3_OCCLUSION_QUERY 0x1F
0091 #define PACKET3_SET_PREDICATION 0x20
0092 #define PACKET3_REG_RMW 0x21
0093 #define PACKET3_COND_EXEC 0x22
0094 #define PACKET3_PRED_EXEC 0x23
0095 #define PACKET3_DRAW_INDIRECT 0x24
0096 #define PACKET3_DRAW_INDEX_INDIRECT 0x25
0097 #define PACKET3_INDEX_BASE 0x26
0098 #define PACKET3_DRAW_INDEX_2 0x27
0099 #define PACKET3_CONTEXT_CONTROL 0x28
0100 #define PACKET3_INDEX_TYPE 0x2A
0101 #define PACKET3_DRAW_INDIRECT_MULTI 0x2C
0102 #define PACKET3_DRAW_INDEX_AUTO 0x2D
0103 #define PACKET3_NUM_INSTANCES 0x2F
0104 #define PACKET3_DRAW_INDEX_MULTI_AUTO 0x30
0105 #define PACKET3_INDIRECT_BUFFER_CONST 0x33
0106 #define PACKET3_STRMOUT_BUFFER_UPDATE 0x34
0107 #define PACKET3_DRAW_INDEX_OFFSET_2 0x35
0108 #define PACKET3_DRAW_PREAMBLE 0x36
0109 #define PACKET3_WRITE_DATA 0x37
0110 #define WRITE_DATA_DST_SEL(x) ((x) << 8)
0111
0112
0113
0114
0115
0116
0117
0118 #define WR_ONE_ADDR (1 << 16)
0119 #define WR_CONFIRM (1 << 20)
0120 #define WRITE_DATA_CACHE_POLICY(x) ((x) << 25)
0121
0122
0123
0124 #define WRITE_DATA_ENGINE_SEL(x) ((x) << 30)
0125
0126
0127
0128
0129 #define PACKET3_DRAW_INDEX_INDIRECT_MULTI 0x38
0130 #define PACKET3_MEM_SEMAPHORE 0x39
0131 # define PACKET3_SEM_USE_MAILBOX (0x1 << 16)
0132 # define PACKET3_SEM_SEL_SIGNAL_TYPE (0x1 << 20)
0133 # define PACKET3_SEM_SEL_SIGNAL (0x6 << 29)
0134 # define PACKET3_SEM_SEL_WAIT (0x7 << 29)
0135 #define PACKET3_WAIT_REG_MEM 0x3C
0136 #define WAIT_REG_MEM_FUNCTION(x) ((x) << 0)
0137
0138
0139
0140
0141
0142
0143
0144
0145 #define WAIT_REG_MEM_MEM_SPACE(x) ((x) << 4)
0146
0147
0148
0149 #define WAIT_REG_MEM_OPERATION(x) ((x) << 6)
0150
0151
0152
0153 #define WAIT_REG_MEM_ENGINE(x) ((x) << 8)
0154
0155
0156
0157 #define PACKET3_INDIRECT_BUFFER 0x3F
0158 #define INDIRECT_BUFFER_VALID (1 << 23)
0159 #define INDIRECT_BUFFER_CACHE_POLICY(x) ((x) << 28)
0160
0161
0162
0163
0164 #define INDIRECT_BUFFER_PRE_ENB(x) ((x) << 21)
0165 #define PACKET3_COPY_DATA 0x40
0166 #define PACKET3_PFP_SYNC_ME 0x42
0167 #define PACKET3_COND_WRITE 0x45
0168 #define PACKET3_EVENT_WRITE 0x46
0169 #define EVENT_TYPE(x) ((x) << 0)
0170 #define EVENT_INDEX(x) ((x) << 8)
0171
0172
0173
0174
0175
0176
0177 #define PACKET3_RELEASE_MEM 0x49
0178 #define EVENT_TYPE(x) ((x) << 0)
0179 #define EVENT_INDEX(x) ((x) << 8)
0180 #define EOP_TCL1_VOL_ACTION_EN (1 << 12)
0181 #define EOP_TC_VOL_ACTION_EN (1 << 13)
0182 #define EOP_TC_WB_ACTION_EN (1 << 15)
0183 #define EOP_TCL1_ACTION_EN (1 << 16)
0184 #define EOP_TC_ACTION_EN (1 << 17)
0185 #define EOP_TC_NC_ACTION_EN (1 << 19)
0186 #define EOP_TC_MD_ACTION_EN (1 << 21)
0187
0188 #define DATA_SEL(x) ((x) << 29)
0189
0190
0191
0192
0193
0194
0195 #define INT_SEL(x) ((x) << 24)
0196
0197
0198
0199
0200 #define DST_SEL(x) ((x) << 16)
0201
0202
0203
0204
0205
0206
0207 #define PACKET3_PREAMBLE_CNTL 0x4A
0208 # define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE (2 << 28)
0209 # define PACKET3_PREAMBLE_END_CLEAR_STATE (3 << 28)
0210 #define PACKET3_DMA_DATA 0x50
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220 # define PACKET3_DMA_DATA_ENGINE(x) ((x) << 0)
0221
0222
0223
0224 # define PACKET3_DMA_DATA_SRC_CACHE_POLICY(x) ((x) << 13)
0225
0226
0227
0228 # define PACKET3_DMA_DATA_DST_SEL(x) ((x) << 20)
0229
0230
0231
0232
0233 # define PACKET3_DMA_DATA_DST_CACHE_POLICY(x) ((x) << 25)
0234
0235
0236
0237 # define PACKET3_DMA_DATA_SRC_SEL(x) ((x) << 29)
0238
0239
0240
0241
0242
0243 # define PACKET3_DMA_DATA_CP_SYNC (1 << 31)
0244
0245 # define PACKET3_DMA_DATA_CMD_SAS (1 << 26)
0246
0247
0248
0249 # define PACKET3_DMA_DATA_CMD_DAS (1 << 27)
0250
0251
0252
0253 # define PACKET3_DMA_DATA_CMD_SAIC (1 << 28)
0254 # define PACKET3_DMA_DATA_CMD_DAIC (1 << 29)
0255 # define PACKET3_DMA_DATA_CMD_RAW_WAIT (1 << 30)
0256 #define PACKET3_ACQUIRE_MEM 0x58
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_TC_NC_ACTION_ENA(x) ((x) << 3)
0268 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_TC_WC_ACTION_ENA(x) ((x) << 4)
0269 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_TC_INV_METADATA_ACTION_ENA(x) ((x) << 5)
0270 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_TCL1_VOL_ACTION_ENA(x) ((x) << 15)
0271 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_TC_WB_ACTION_ENA(x) ((x) << 18)
0272 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_TCL1_ACTION_ENA(x) ((x) << 22)
0273 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_TC_ACTION_ENA(x) ((x) << 23)
0274 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_CB_ACTION_ENA(x) ((x) << 25)
0275 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_DB_ACTION_ENA(x) ((x) << 26)
0276 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_SH_KCACHE_ACTION_ENA(x) ((x) << 27)
0277 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_SH_KCACHE_VOL_ACTION_ENA(x) ((x) << 28)
0278 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_SH_ICACHE_ACTION_ENA(x) ((x) << 29)
0279 #define PACKET3_ACQUIRE_MEM_CP_COHER_CNTL_SH_KCACHE_WB_ACTION_ENA(x) ((x) << 30)
0280 #define PACKET3_REWIND 0x59
0281 #define PACKET3_LOAD_UCONFIG_REG 0x5E
0282 #define PACKET3_LOAD_SH_REG 0x5F
0283 #define PACKET3_LOAD_CONFIG_REG 0x60
0284 #define PACKET3_LOAD_CONTEXT_REG 0x61
0285 #define PACKET3_SET_CONFIG_REG 0x68
0286 #define PACKET3_SET_CONFIG_REG_START 0x00002000
0287 #define PACKET3_SET_CONFIG_REG_END 0x00002c00
0288 #define PACKET3_SET_CONTEXT_REG 0x69
0289 #define PACKET3_SET_CONTEXT_REG_START 0x0000a000
0290 #define PACKET3_SET_CONTEXT_REG_END 0x0000a400
0291 #define PACKET3_SET_CONTEXT_REG_INDIRECT 0x73
0292 #define PACKET3_SET_SH_REG 0x76
0293 #define PACKET3_SET_SH_REG_START 0x00002c00
0294 #define PACKET3_SET_SH_REG_END 0x00003000
0295 #define PACKET3_SET_SH_REG_OFFSET 0x77
0296 #define PACKET3_SET_QUEUE_REG 0x78
0297 #define PACKET3_SET_UCONFIG_REG 0x79
0298 #define PACKET3_SET_UCONFIG_REG_START 0x0000c000
0299 #define PACKET3_SET_UCONFIG_REG_END 0x0000c400
0300 #define PACKET3_SET_UCONFIG_REG_INDEX_TYPE (2 << 28)
0301 #define PACKET3_SCRATCH_RAM_WRITE 0x7D
0302 #define PACKET3_SCRATCH_RAM_READ 0x7E
0303 #define PACKET3_LOAD_CONST_RAM 0x80
0304 #define PACKET3_WRITE_CONST_RAM 0x81
0305 #define PACKET3_DUMP_CONST_RAM 0x83
0306 #define PACKET3_INCREMENT_CE_COUNTER 0x84
0307 #define PACKET3_INCREMENT_DE_COUNTER 0x85
0308 #define PACKET3_WAIT_ON_CE_COUNTER 0x86
0309 #define PACKET3_WAIT_ON_DE_COUNTER_DIFF 0x88
0310 #define PACKET3_SWITCH_BUFFER 0x8B
0311 #define PACKET3_FRAME_CONTROL 0x90
0312 # define FRAME_TMZ (1 << 0)
0313 # define FRAME_CMD(x) ((x) << 28)
0314
0315
0316
0317
0318
0319 #define PACKET3_INVALIDATE_TLBS 0x98
0320 # define PACKET3_INVALIDATE_TLBS_DST_SEL(x) ((x) << 0)
0321 # define PACKET3_INVALIDATE_TLBS_ALL_HUB(x) ((x) << 4)
0322 # define PACKET3_INVALIDATE_TLBS_PASID(x) ((x) << 5)
0323 # define PACKET3_INVALIDATE_TLBS_FLUSH_TYPE(x) ((x) << 29)
0324 #define PACKET3_SET_RESOURCES 0xA0
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334 # define PACKET3_SET_RESOURCES_VMID_MASK(x) ((x) << 0)
0335 # define PACKET3_SET_RESOURCES_UNMAP_LATENTY(x) ((x) << 16)
0336 # define PACKET3_SET_RESOURCES_QUEUE_TYPE(x) ((x) << 29)
0337 #define PACKET3_MAP_QUEUES 0xA2
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347 # define PACKET3_MAP_QUEUES_QUEUE_SEL(x) ((x) << 4)
0348 # define PACKET3_MAP_QUEUES_VMID(x) ((x) << 8)
0349 # define PACKET3_MAP_QUEUES_QUEUE(x) ((x) << 13)
0350 # define PACKET3_MAP_QUEUES_PIPE(x) ((x) << 16)
0351 # define PACKET3_MAP_QUEUES_ME(x) ((x) << 18)
0352 # define PACKET3_MAP_QUEUES_QUEUE_TYPE(x) ((x) << 21)
0353 # define PACKET3_MAP_QUEUES_ALLOC_FORMAT(x) ((x) << 24)
0354 # define PACKET3_MAP_QUEUES_ENGINE_SEL(x) ((x) << 26)
0355 # define PACKET3_MAP_QUEUES_NUM_QUEUES(x) ((x) << 29)
0356
0357 # define PACKET3_MAP_QUEUES_CHECK_DISABLE(x) ((x) << 1)
0358 # define PACKET3_MAP_QUEUES_DOORBELL_OFFSET(x) ((x) << 2)
0359 #define PACKET3_UNMAP_QUEUES 0xA3
0360
0361
0362
0363
0364
0365
0366
0367
0368 # define PACKET3_UNMAP_QUEUES_ACTION(x) ((x) << 0)
0369
0370
0371
0372
0373
0374 # define PACKET3_UNMAP_QUEUES_QUEUE_SEL(x) ((x) << 4)
0375 # define PACKET3_UNMAP_QUEUES_ENGINE_SEL(x) ((x) << 26)
0376 # define PACKET3_UNMAP_QUEUES_NUM_QUEUES(x) ((x) << 29)
0377
0378 # define PACKET3_UNMAP_QUEUES_PASID(x) ((x) << 0)
0379
0380 # define PACKET3_UNMAP_QUEUES_DOORBELL_OFFSET0(x) ((x) << 2)
0381
0382 # define PACKET3_UNMAP_QUEUES_DOORBELL_OFFSET1(x) ((x) << 2)
0383
0384 # define PACKET3_UNMAP_QUEUES_RB_WPTR(x) ((x) << 0)
0385
0386 # define PACKET3_UNMAP_QUEUES_DOORBELL_OFFSET2(x) ((x) << 2)
0387
0388 # define PACKET3_UNMAP_QUEUES_DOORBELL_OFFSET3(x) ((x) << 2)
0389 #define PACKET3_QUERY_STATUS 0xA4
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399 # define PACKET3_QUERY_STATUS_CONTEXT_ID(x) ((x) << 0)
0400 # define PACKET3_QUERY_STATUS_INTERRUPT_SEL(x) ((x) << 28)
0401 # define PACKET3_QUERY_STATUS_COMMAND(x) ((x) << 30)
0402
0403 # define PACKET3_QUERY_STATUS_PASID(x) ((x) << 0)
0404
0405 # define PACKET3_QUERY_STATUS_DOORBELL_OFFSET(x) ((x) << 2)
0406 # define PACKET3_QUERY_STATUS_ENG_SEL(x) ((x) << 25)
0407
0408
0409 #define VCE_CMD_NO_OP 0x00000000
0410 #define VCE_CMD_END 0x00000001
0411 #define VCE_CMD_IB 0x00000002
0412 #define VCE_CMD_FENCE 0x00000003
0413 #define VCE_CMD_TRAP 0x00000004
0414 #define VCE_CMD_IB_AUTO 0x00000005
0415 #define VCE_CMD_SEMAPHORE 0x00000006
0416
0417 #define VCE_CMD_IB_VM 0x00000102
0418 #define VCE_CMD_WAIT_GE 0x00000106
0419 #define VCE_CMD_UPDATE_PTB 0x00000107
0420 #define VCE_CMD_FLUSH_TLB 0x00000108
0421 #define VCE_CMD_REG_WRITE 0x00000109
0422 #define VCE_CMD_REG_WAIT 0x0000010a
0423
0424 #define HEVC_ENC_CMD_NO_OP 0x00000000
0425 #define HEVC_ENC_CMD_END 0x00000001
0426 #define HEVC_ENC_CMD_FENCE 0x00000003
0427 #define HEVC_ENC_CMD_TRAP 0x00000004
0428 #define HEVC_ENC_CMD_IB_VM 0x00000102
0429 #define HEVC_ENC_CMD_REG_WRITE 0x00000109
0430 #define HEVC_ENC_CMD_REG_WAIT 0x0000010a
0431
0432 #endif