162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright 2014 Advanced Micro Devices, Inc. 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 562306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 662306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation 762306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 862306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 962306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 1262306a36Sopenharmony_ci * all copies or substantial portions of the Software. 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1562306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1662306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1762306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 1862306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1962306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2062306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 2162306a36Sopenharmony_ci * 2262306a36Sopenharmony_ci */ 2362306a36Sopenharmony_ci#ifndef VI_H 2462306a36Sopenharmony_ci#define VI_H 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci#define SDMA0_REGISTER_OFFSET 0x0 /* not a register */ 2762306a36Sopenharmony_ci#define SDMA1_REGISTER_OFFSET 0x200 /* not a register */ 2862306a36Sopenharmony_ci#define SDMA_MAX_INSTANCE 2 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#define KFD_VI_SDMA_QUEUE_OFFSET 0x80 /* not a register */ 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci/* crtc instance offsets */ 3362306a36Sopenharmony_ci#define CRTC0_REGISTER_OFFSET (0x1b9c - 0x1b9c) 3462306a36Sopenharmony_ci#define CRTC1_REGISTER_OFFSET (0x1d9c - 0x1b9c) 3562306a36Sopenharmony_ci#define CRTC2_REGISTER_OFFSET (0x1f9c - 0x1b9c) 3662306a36Sopenharmony_ci#define CRTC3_REGISTER_OFFSET (0x419c - 0x1b9c) 3762306a36Sopenharmony_ci#define CRTC4_REGISTER_OFFSET (0x439c - 0x1b9c) 3862306a36Sopenharmony_ci#define CRTC5_REGISTER_OFFSET (0x459c - 0x1b9c) 3962306a36Sopenharmony_ci#define CRTC6_REGISTER_OFFSET (0x479c - 0x1b9c) 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci/* dig instance offsets */ 4262306a36Sopenharmony_ci#define DIG0_REGISTER_OFFSET (0x4a00 - 0x4a00) 4362306a36Sopenharmony_ci#define DIG1_REGISTER_OFFSET (0x4b00 - 0x4a00) 4462306a36Sopenharmony_ci#define DIG2_REGISTER_OFFSET (0x4c00 - 0x4a00) 4562306a36Sopenharmony_ci#define DIG3_REGISTER_OFFSET (0x4d00 - 0x4a00) 4662306a36Sopenharmony_ci#define DIG4_REGISTER_OFFSET (0x4e00 - 0x4a00) 4762306a36Sopenharmony_ci#define DIG5_REGISTER_OFFSET (0x4f00 - 0x4a00) 4862306a36Sopenharmony_ci#define DIG6_REGISTER_OFFSET (0x5400 - 0x4a00) 4962306a36Sopenharmony_ci#define DIG7_REGISTER_OFFSET (0x5600 - 0x4a00) 5062306a36Sopenharmony_ci#define DIG8_REGISTER_OFFSET (0x5700 - 0x4a00) 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci/* audio endpt instance offsets */ 5362306a36Sopenharmony_ci#define AUD0_REGISTER_OFFSET (0x17a8 - 0x17a8) 5462306a36Sopenharmony_ci#define AUD1_REGISTER_OFFSET (0x17ac - 0x17a8) 5562306a36Sopenharmony_ci#define AUD2_REGISTER_OFFSET (0x17b0 - 0x17a8) 5662306a36Sopenharmony_ci#define AUD3_REGISTER_OFFSET (0x17b4 - 0x17a8) 5762306a36Sopenharmony_ci#define AUD4_REGISTER_OFFSET (0x17b8 - 0x17a8) 5862306a36Sopenharmony_ci#define AUD5_REGISTER_OFFSET (0x17bc - 0x17a8) 5962306a36Sopenharmony_ci#define AUD6_REGISTER_OFFSET (0x17c0 - 0x17a8) 6062306a36Sopenharmony_ci#define AUD7_REGISTER_OFFSET (0x17c4 - 0x17a8) 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci/* hpd instance offsets */ 6362306a36Sopenharmony_ci#define HPD0_REGISTER_OFFSET (0x1898 - 0x1898) 6462306a36Sopenharmony_ci#define HPD1_REGISTER_OFFSET (0x18a0 - 0x1898) 6562306a36Sopenharmony_ci#define HPD2_REGISTER_OFFSET (0x18a8 - 0x1898) 6662306a36Sopenharmony_ci#define HPD3_REGISTER_OFFSET (0x18b0 - 0x1898) 6762306a36Sopenharmony_ci#define HPD4_REGISTER_OFFSET (0x18b8 - 0x1898) 6862306a36Sopenharmony_ci#define HPD5_REGISTER_OFFSET (0x18c0 - 0x1898) 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci#define PIPEID(x) ((x) << 0) 7162306a36Sopenharmony_ci#define MEID(x) ((x) << 2) 7262306a36Sopenharmony_ci#define VMID(x) ((x) << 4) 7362306a36Sopenharmony_ci#define QUEUEID(x) ((x) << 8) 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__MASK 0xf0000000 7662306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__GDDR1 0x10000000 7762306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__DDR2 0x20000000 7862306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__GDDR3 0x30000000 7962306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__GDDR4 0x40000000 8062306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__GDDR5 0x50000000 8162306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__HBM 0x60000000 8262306a36Sopenharmony_ci#define MC_SEQ_MISC0__MT__DDR3 0xB0000000 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci/* 8562306a36Sopenharmony_ci * PM4 8662306a36Sopenharmony_ci */ 8762306a36Sopenharmony_ci#define PACKET_TYPE0 0 8862306a36Sopenharmony_ci#define PACKET_TYPE1 1 8962306a36Sopenharmony_ci#define PACKET_TYPE2 2 9062306a36Sopenharmony_ci#define PACKET_TYPE3 3 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci#define CP_PACKET_GET_TYPE(h) (((h) >> 30) & 3) 9362306a36Sopenharmony_ci#define CP_PACKET_GET_COUNT(h) (((h) >> 16) & 0x3FFF) 9462306a36Sopenharmony_ci#define CP_PACKET0_GET_REG(h) ((h) & 0xFFFF) 9562306a36Sopenharmony_ci#define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF) 9662306a36Sopenharmony_ci#define PACKET0(reg, n) ((PACKET_TYPE0 << 30) | \ 9762306a36Sopenharmony_ci ((reg) & 0xFFFF) | \ 9862306a36Sopenharmony_ci ((n) & 0x3FFF) << 16) 9962306a36Sopenharmony_ci#define CP_PACKET2 0x80000000 10062306a36Sopenharmony_ci#define PACKET2_PAD_SHIFT 0 10162306a36Sopenharmony_ci#define PACKET2_PAD_MASK (0x3fffffff << 0) 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci#define PACKET2(v) (CP_PACKET2 | REG_SET(PACKET2_PAD, (v))) 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci#define PACKET3(op, n) ((PACKET_TYPE3 << 30) | \ 10662306a36Sopenharmony_ci (((op) & 0xFF) << 8) | \ 10762306a36Sopenharmony_ci ((n) & 0x3FFF) << 16) 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci#define PACKET3_COMPUTE(op, n) (PACKET3(op, n) | 1 << 1) 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci/* Packet 3 types */ 11262306a36Sopenharmony_ci#define PACKET3_NOP 0x10 11362306a36Sopenharmony_ci#define PACKET3_SET_BASE 0x11 11462306a36Sopenharmony_ci#define PACKET3_BASE_INDEX(x) ((x) << 0) 11562306a36Sopenharmony_ci#define CE_PARTITION_BASE 3 11662306a36Sopenharmony_ci#define PACKET3_CLEAR_STATE 0x12 11762306a36Sopenharmony_ci#define PACKET3_INDEX_BUFFER_SIZE 0x13 11862306a36Sopenharmony_ci#define PACKET3_DISPATCH_DIRECT 0x15 11962306a36Sopenharmony_ci#define PACKET3_DISPATCH_INDIRECT 0x16 12062306a36Sopenharmony_ci#define PACKET3_ATOMIC_GDS 0x1D 12162306a36Sopenharmony_ci#define PACKET3_ATOMIC_MEM 0x1E 12262306a36Sopenharmony_ci#define PACKET3_OCCLUSION_QUERY 0x1F 12362306a36Sopenharmony_ci#define PACKET3_SET_PREDICATION 0x20 12462306a36Sopenharmony_ci#define PACKET3_REG_RMW 0x21 12562306a36Sopenharmony_ci#define PACKET3_COND_EXEC 0x22 12662306a36Sopenharmony_ci#define PACKET3_PRED_EXEC 0x23 12762306a36Sopenharmony_ci#define PACKET3_DRAW_INDIRECT 0x24 12862306a36Sopenharmony_ci#define PACKET3_DRAW_INDEX_INDIRECT 0x25 12962306a36Sopenharmony_ci#define PACKET3_INDEX_BASE 0x26 13062306a36Sopenharmony_ci#define PACKET3_DRAW_INDEX_2 0x27 13162306a36Sopenharmony_ci#define PACKET3_CONTEXT_CONTROL 0x28 13262306a36Sopenharmony_ci#define PACKET3_INDEX_TYPE 0x2A 13362306a36Sopenharmony_ci#define PACKET3_DRAW_INDIRECT_MULTI 0x2C 13462306a36Sopenharmony_ci#define PACKET3_DRAW_INDEX_AUTO 0x2D 13562306a36Sopenharmony_ci#define PACKET3_NUM_INSTANCES 0x2F 13662306a36Sopenharmony_ci#define PACKET3_DRAW_INDEX_MULTI_AUTO 0x30 13762306a36Sopenharmony_ci#define PACKET3_INDIRECT_BUFFER_CONST 0x33 13862306a36Sopenharmony_ci#define PACKET3_STRMOUT_BUFFER_UPDATE 0x34 13962306a36Sopenharmony_ci#define PACKET3_DRAW_INDEX_OFFSET_2 0x35 14062306a36Sopenharmony_ci#define PACKET3_DRAW_PREAMBLE 0x36 14162306a36Sopenharmony_ci#define PACKET3_WRITE_DATA 0x37 14262306a36Sopenharmony_ci#define WRITE_DATA_DST_SEL(x) ((x) << 8) 14362306a36Sopenharmony_ci /* 0 - register 14462306a36Sopenharmony_ci * 1 - memory (sync - via GRBM) 14562306a36Sopenharmony_ci * 2 - gl2 14662306a36Sopenharmony_ci * 3 - gds 14762306a36Sopenharmony_ci * 4 - reserved 14862306a36Sopenharmony_ci * 5 - memory (async - direct) 14962306a36Sopenharmony_ci */ 15062306a36Sopenharmony_ci#define WR_ONE_ADDR (1 << 16) 15162306a36Sopenharmony_ci#define WR_CONFIRM (1 << 20) 15262306a36Sopenharmony_ci#define WRITE_DATA_CACHE_POLICY(x) ((x) << 25) 15362306a36Sopenharmony_ci /* 0 - LRU 15462306a36Sopenharmony_ci * 1 - Stream 15562306a36Sopenharmony_ci */ 15662306a36Sopenharmony_ci#define WRITE_DATA_ENGINE_SEL(x) ((x) << 30) 15762306a36Sopenharmony_ci /* 0 - me 15862306a36Sopenharmony_ci * 1 - pfp 15962306a36Sopenharmony_ci * 2 - ce 16062306a36Sopenharmony_ci */ 16162306a36Sopenharmony_ci#define PACKET3_DRAW_INDEX_INDIRECT_MULTI 0x38 16262306a36Sopenharmony_ci#define PACKET3_MEM_SEMAPHORE 0x39 16362306a36Sopenharmony_ci# define PACKET3_SEM_USE_MAILBOX (0x1 << 16) 16462306a36Sopenharmony_ci# define PACKET3_SEM_SEL_SIGNAL_TYPE (0x1 << 20) /* 0 = increment, 1 = write 1 */ 16562306a36Sopenharmony_ci# define PACKET3_SEM_CLIENT_CODE ((x) << 24) /* 0 = CP, 1 = CB, 2 = DB */ 16662306a36Sopenharmony_ci# define PACKET3_SEM_SEL_SIGNAL (0x6 << 29) 16762306a36Sopenharmony_ci# define PACKET3_SEM_SEL_WAIT (0x7 << 29) 16862306a36Sopenharmony_ci#define PACKET3_WAIT_REG_MEM 0x3C 16962306a36Sopenharmony_ci#define WAIT_REG_MEM_FUNCTION(x) ((x) << 0) 17062306a36Sopenharmony_ci /* 0 - always 17162306a36Sopenharmony_ci * 1 - < 17262306a36Sopenharmony_ci * 2 - <= 17362306a36Sopenharmony_ci * 3 - == 17462306a36Sopenharmony_ci * 4 - != 17562306a36Sopenharmony_ci * 5 - >= 17662306a36Sopenharmony_ci * 6 - > 17762306a36Sopenharmony_ci */ 17862306a36Sopenharmony_ci#define WAIT_REG_MEM_MEM_SPACE(x) ((x) << 4) 17962306a36Sopenharmony_ci /* 0 - reg 18062306a36Sopenharmony_ci * 1 - mem 18162306a36Sopenharmony_ci */ 18262306a36Sopenharmony_ci#define WAIT_REG_MEM_OPERATION(x) ((x) << 6) 18362306a36Sopenharmony_ci /* 0 - wait_reg_mem 18462306a36Sopenharmony_ci * 1 - wr_wait_wr_reg 18562306a36Sopenharmony_ci */ 18662306a36Sopenharmony_ci#define WAIT_REG_MEM_ENGINE(x) ((x) << 8) 18762306a36Sopenharmony_ci /* 0 - me 18862306a36Sopenharmony_ci * 1 - pfp 18962306a36Sopenharmony_ci */ 19062306a36Sopenharmony_ci#define PACKET3_INDIRECT_BUFFER 0x3F 19162306a36Sopenharmony_ci#define INDIRECT_BUFFER_TCL2_VOLATILE (1 << 22) 19262306a36Sopenharmony_ci#define INDIRECT_BUFFER_VALID (1 << 23) 19362306a36Sopenharmony_ci#define INDIRECT_BUFFER_CACHE_POLICY(x) ((x) << 28) 19462306a36Sopenharmony_ci /* 0 - LRU 19562306a36Sopenharmony_ci * 1 - Stream 19662306a36Sopenharmony_ci * 2 - Bypass 19762306a36Sopenharmony_ci */ 19862306a36Sopenharmony_ci#define INDIRECT_BUFFER_PRE_ENB(x) ((x) << 21) 19962306a36Sopenharmony_ci#define PACKET3_COPY_DATA 0x40 20062306a36Sopenharmony_ci#define PACKET3_PFP_SYNC_ME 0x42 20162306a36Sopenharmony_ci#define PACKET3_SURFACE_SYNC 0x43 20262306a36Sopenharmony_ci# define PACKET3_DEST_BASE_0_ENA (1 << 0) 20362306a36Sopenharmony_ci# define PACKET3_DEST_BASE_1_ENA (1 << 1) 20462306a36Sopenharmony_ci# define PACKET3_CB0_DEST_BASE_ENA (1 << 6) 20562306a36Sopenharmony_ci# define PACKET3_CB1_DEST_BASE_ENA (1 << 7) 20662306a36Sopenharmony_ci# define PACKET3_CB2_DEST_BASE_ENA (1 << 8) 20762306a36Sopenharmony_ci# define PACKET3_CB3_DEST_BASE_ENA (1 << 9) 20862306a36Sopenharmony_ci# define PACKET3_CB4_DEST_BASE_ENA (1 << 10) 20962306a36Sopenharmony_ci# define PACKET3_CB5_DEST_BASE_ENA (1 << 11) 21062306a36Sopenharmony_ci# define PACKET3_CB6_DEST_BASE_ENA (1 << 12) 21162306a36Sopenharmony_ci# define PACKET3_CB7_DEST_BASE_ENA (1 << 13) 21262306a36Sopenharmony_ci# define PACKET3_DB_DEST_BASE_ENA (1 << 14) 21362306a36Sopenharmony_ci# define PACKET3_TCL1_VOL_ACTION_ENA (1 << 15) 21462306a36Sopenharmony_ci# define PACKET3_TC_VOL_ACTION_ENA (1 << 16) /* L2 */ 21562306a36Sopenharmony_ci# define PACKET3_TC_WB_ACTION_ENA (1 << 18) /* L2 */ 21662306a36Sopenharmony_ci# define PACKET3_DEST_BASE_2_ENA (1 << 19) 21762306a36Sopenharmony_ci# define PACKET3_DEST_BASE_3_ENA (1 << 21) 21862306a36Sopenharmony_ci# define PACKET3_TCL1_ACTION_ENA (1 << 22) 21962306a36Sopenharmony_ci# define PACKET3_TC_ACTION_ENA (1 << 23) /* L2 */ 22062306a36Sopenharmony_ci# define PACKET3_CB_ACTION_ENA (1 << 25) 22162306a36Sopenharmony_ci# define PACKET3_DB_ACTION_ENA (1 << 26) 22262306a36Sopenharmony_ci# define PACKET3_SH_KCACHE_ACTION_ENA (1 << 27) 22362306a36Sopenharmony_ci# define PACKET3_SH_KCACHE_VOL_ACTION_ENA (1 << 28) 22462306a36Sopenharmony_ci# define PACKET3_SH_ICACHE_ACTION_ENA (1 << 29) 22562306a36Sopenharmony_ci#define PACKET3_COND_WRITE 0x45 22662306a36Sopenharmony_ci#define PACKET3_EVENT_WRITE 0x46 22762306a36Sopenharmony_ci#define EVENT_TYPE(x) ((x) << 0) 22862306a36Sopenharmony_ci#define EVENT_INDEX(x) ((x) << 8) 22962306a36Sopenharmony_ci /* 0 - any non-TS event 23062306a36Sopenharmony_ci * 1 - ZPASS_DONE, PIXEL_PIPE_STAT_* 23162306a36Sopenharmony_ci * 2 - SAMPLE_PIPELINESTAT 23262306a36Sopenharmony_ci * 3 - SAMPLE_STREAMOUTSTAT* 23362306a36Sopenharmony_ci * 4 - *S_PARTIAL_FLUSH 23462306a36Sopenharmony_ci * 5 - EOP events 23562306a36Sopenharmony_ci * 6 - EOS events 23662306a36Sopenharmony_ci */ 23762306a36Sopenharmony_ci#define PACKET3_EVENT_WRITE_EOP 0x47 23862306a36Sopenharmony_ci#define EOP_TCL1_VOL_ACTION_EN (1 << 12) 23962306a36Sopenharmony_ci#define EOP_TC_VOL_ACTION_EN (1 << 13) /* L2 */ 24062306a36Sopenharmony_ci#define EOP_TC_WB_ACTION_EN (1 << 15) /* L2 */ 24162306a36Sopenharmony_ci#define EOP_TCL1_ACTION_EN (1 << 16) 24262306a36Sopenharmony_ci#define EOP_TC_ACTION_EN (1 << 17) /* L2 */ 24362306a36Sopenharmony_ci#define EOP_TCL2_VOLATILE (1 << 24) 24462306a36Sopenharmony_ci#define EOP_CACHE_POLICY(x) ((x) << 25) 24562306a36Sopenharmony_ci /* 0 - LRU 24662306a36Sopenharmony_ci * 1 - Stream 24762306a36Sopenharmony_ci * 2 - Bypass 24862306a36Sopenharmony_ci */ 24962306a36Sopenharmony_ci#define DATA_SEL(x) ((x) << 29) 25062306a36Sopenharmony_ci /* 0 - discard 25162306a36Sopenharmony_ci * 1 - send low 32bit data 25262306a36Sopenharmony_ci * 2 - send 64bit data 25362306a36Sopenharmony_ci * 3 - send 64bit GPU counter value 25462306a36Sopenharmony_ci * 4 - send 64bit sys counter value 25562306a36Sopenharmony_ci */ 25662306a36Sopenharmony_ci#define INT_SEL(x) ((x) << 24) 25762306a36Sopenharmony_ci /* 0 - none 25862306a36Sopenharmony_ci * 1 - interrupt only (DATA_SEL = 0) 25962306a36Sopenharmony_ci * 2 - interrupt when data write is confirmed 26062306a36Sopenharmony_ci */ 26162306a36Sopenharmony_ci#define DST_SEL(x) ((x) << 16) 26262306a36Sopenharmony_ci /* 0 - MC 26362306a36Sopenharmony_ci * 1 - TC/L2 26462306a36Sopenharmony_ci */ 26562306a36Sopenharmony_ci#define PACKET3_EVENT_WRITE_EOS 0x48 26662306a36Sopenharmony_ci#define PACKET3_RELEASE_MEM 0x49 26762306a36Sopenharmony_ci#define PACKET3_PREAMBLE_CNTL 0x4A 26862306a36Sopenharmony_ci# define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE (2 << 28) 26962306a36Sopenharmony_ci# define PACKET3_PREAMBLE_END_CLEAR_STATE (3 << 28) 27062306a36Sopenharmony_ci#define PACKET3_DMA_DATA 0x50 27162306a36Sopenharmony_ci/* 1. header 27262306a36Sopenharmony_ci * 2. CONTROL 27362306a36Sopenharmony_ci * 3. SRC_ADDR_LO or DATA [31:0] 27462306a36Sopenharmony_ci * 4. SRC_ADDR_HI [31:0] 27562306a36Sopenharmony_ci * 5. DST_ADDR_LO [31:0] 27662306a36Sopenharmony_ci * 6. DST_ADDR_HI [7:0] 27762306a36Sopenharmony_ci * 7. COMMAND [30:21] | BYTE_COUNT [20:0] 27862306a36Sopenharmony_ci */ 27962306a36Sopenharmony_ci/* CONTROL */ 28062306a36Sopenharmony_ci# define PACKET3_DMA_DATA_ENGINE(x) ((x) << 0) 28162306a36Sopenharmony_ci /* 0 - ME 28262306a36Sopenharmony_ci * 1 - PFP 28362306a36Sopenharmony_ci */ 28462306a36Sopenharmony_ci# define PACKET3_DMA_DATA_SRC_CACHE_POLICY(x) ((x) << 13) 28562306a36Sopenharmony_ci /* 0 - LRU 28662306a36Sopenharmony_ci * 1 - Stream 28762306a36Sopenharmony_ci * 2 - Bypass 28862306a36Sopenharmony_ci */ 28962306a36Sopenharmony_ci# define PACKET3_DMA_DATA_SRC_VOLATILE (1 << 15) 29062306a36Sopenharmony_ci# define PACKET3_DMA_DATA_DST_SEL(x) ((x) << 20) 29162306a36Sopenharmony_ci /* 0 - DST_ADDR using DAS 29262306a36Sopenharmony_ci * 1 - GDS 29362306a36Sopenharmony_ci * 3 - DST_ADDR using L2 29462306a36Sopenharmony_ci */ 29562306a36Sopenharmony_ci# define PACKET3_DMA_DATA_DST_CACHE_POLICY(x) ((x) << 25) 29662306a36Sopenharmony_ci /* 0 - LRU 29762306a36Sopenharmony_ci * 1 - Stream 29862306a36Sopenharmony_ci * 2 - Bypass 29962306a36Sopenharmony_ci */ 30062306a36Sopenharmony_ci# define PACKET3_DMA_DATA_DST_VOLATILE (1 << 27) 30162306a36Sopenharmony_ci# define PACKET3_DMA_DATA_SRC_SEL(x) ((x) << 29) 30262306a36Sopenharmony_ci /* 0 - SRC_ADDR using SAS 30362306a36Sopenharmony_ci * 1 - GDS 30462306a36Sopenharmony_ci * 2 - DATA 30562306a36Sopenharmony_ci * 3 - SRC_ADDR using L2 30662306a36Sopenharmony_ci */ 30762306a36Sopenharmony_ci# define PACKET3_DMA_DATA_CP_SYNC (1 << 31) 30862306a36Sopenharmony_ci/* COMMAND */ 30962306a36Sopenharmony_ci# define PACKET3_DMA_DATA_DIS_WC (1 << 21) 31062306a36Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_SRC_SWAP(x) ((x) << 22) 31162306a36Sopenharmony_ci /* 0 - none 31262306a36Sopenharmony_ci * 1 - 8 in 16 31362306a36Sopenharmony_ci * 2 - 8 in 32 31462306a36Sopenharmony_ci * 3 - 8 in 64 31562306a36Sopenharmony_ci */ 31662306a36Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_DST_SWAP(x) ((x) << 24) 31762306a36Sopenharmony_ci /* 0 - none 31862306a36Sopenharmony_ci * 1 - 8 in 16 31962306a36Sopenharmony_ci * 2 - 8 in 32 32062306a36Sopenharmony_ci * 3 - 8 in 64 32162306a36Sopenharmony_ci */ 32262306a36Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_SAS (1 << 26) 32362306a36Sopenharmony_ci /* 0 - memory 32462306a36Sopenharmony_ci * 1 - register 32562306a36Sopenharmony_ci */ 32662306a36Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_DAS (1 << 27) 32762306a36Sopenharmony_ci /* 0 - memory 32862306a36Sopenharmony_ci * 1 - register 32962306a36Sopenharmony_ci */ 33062306a36Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_SAIC (1 << 28) 33162306a36Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_DAIC (1 << 29) 33262306a36Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_RAW_WAIT (1 << 30) 33362306a36Sopenharmony_ci#define PACKET3_ACQUIRE_MEM 0x58 33462306a36Sopenharmony_ci#define PACKET3_REWIND 0x59 33562306a36Sopenharmony_ci#define PACKET3_LOAD_UCONFIG_REG 0x5E 33662306a36Sopenharmony_ci#define PACKET3_LOAD_SH_REG 0x5F 33762306a36Sopenharmony_ci#define PACKET3_LOAD_CONFIG_REG 0x60 33862306a36Sopenharmony_ci#define PACKET3_LOAD_CONTEXT_REG 0x61 33962306a36Sopenharmony_ci#define PACKET3_SET_CONFIG_REG 0x68 34062306a36Sopenharmony_ci#define PACKET3_SET_CONFIG_REG_START 0x00002000 34162306a36Sopenharmony_ci#define PACKET3_SET_CONFIG_REG_END 0x00002c00 34262306a36Sopenharmony_ci#define PACKET3_SET_CONTEXT_REG 0x69 34362306a36Sopenharmony_ci#define PACKET3_SET_CONTEXT_REG_START 0x0000a000 34462306a36Sopenharmony_ci#define PACKET3_SET_CONTEXT_REG_END 0x0000a400 34562306a36Sopenharmony_ci#define PACKET3_SET_CONTEXT_REG_INDIRECT 0x73 34662306a36Sopenharmony_ci#define PACKET3_SET_SH_REG 0x76 34762306a36Sopenharmony_ci#define PACKET3_SET_SH_REG_START 0x00002c00 34862306a36Sopenharmony_ci#define PACKET3_SET_SH_REG_END 0x00003000 34962306a36Sopenharmony_ci#define PACKET3_SET_SH_REG_OFFSET 0x77 35062306a36Sopenharmony_ci#define PACKET3_SET_QUEUE_REG 0x78 35162306a36Sopenharmony_ci#define PACKET3_SET_UCONFIG_REG 0x79 35262306a36Sopenharmony_ci#define PACKET3_SET_UCONFIG_REG_START 0x0000c000 35362306a36Sopenharmony_ci#define PACKET3_SET_UCONFIG_REG_END 0x0000c400 35462306a36Sopenharmony_ci#define PACKET3_SCRATCH_RAM_WRITE 0x7D 35562306a36Sopenharmony_ci#define PACKET3_SCRATCH_RAM_READ 0x7E 35662306a36Sopenharmony_ci#define PACKET3_LOAD_CONST_RAM 0x80 35762306a36Sopenharmony_ci#define PACKET3_WRITE_CONST_RAM 0x81 35862306a36Sopenharmony_ci#define PACKET3_DUMP_CONST_RAM 0x83 35962306a36Sopenharmony_ci#define PACKET3_INCREMENT_CE_COUNTER 0x84 36062306a36Sopenharmony_ci#define PACKET3_INCREMENT_DE_COUNTER 0x85 36162306a36Sopenharmony_ci#define PACKET3_WAIT_ON_CE_COUNTER 0x86 36262306a36Sopenharmony_ci#define PACKET3_WAIT_ON_DE_COUNTER_DIFF 0x88 36362306a36Sopenharmony_ci#define PACKET3_SWITCH_BUFFER 0x8B 36462306a36Sopenharmony_ci#define PACKET3_FRAME_CONTROL 0x90 36562306a36Sopenharmony_ci# define FRAME_CMD(x) ((x) << 28) 36662306a36Sopenharmony_ci /* 36762306a36Sopenharmony_ci * x=0: tmz_begin 36862306a36Sopenharmony_ci * x=1: tmz_end 36962306a36Sopenharmony_ci */ 37062306a36Sopenharmony_ci#define PACKET3_SET_RESOURCES 0xA0 37162306a36Sopenharmony_ci/* 1. header 37262306a36Sopenharmony_ci * 2. CONTROL 37362306a36Sopenharmony_ci * 3. QUEUE_MASK_LO [31:0] 37462306a36Sopenharmony_ci * 4. QUEUE_MASK_HI [31:0] 37562306a36Sopenharmony_ci * 5. GWS_MASK_LO [31:0] 37662306a36Sopenharmony_ci * 6. GWS_MASK_HI [31:0] 37762306a36Sopenharmony_ci * 7. OAC_MASK [15:0] 37862306a36Sopenharmony_ci * 8. GDS_HEAP_SIZE [16:11] | GDS_HEAP_BASE [5:0] 37962306a36Sopenharmony_ci */ 38062306a36Sopenharmony_ci# define PACKET3_SET_RESOURCES_VMID_MASK(x) ((x) << 0) 38162306a36Sopenharmony_ci# define PACKET3_SET_RESOURCES_UNMAP_LATENTY(x) ((x) << 16) 38262306a36Sopenharmony_ci# define PACKET3_SET_RESOURCES_QUEUE_TYPE(x) ((x) << 29) 38362306a36Sopenharmony_ci#define PACKET3_MAP_QUEUES 0xA2 38462306a36Sopenharmony_ci/* 1. header 38562306a36Sopenharmony_ci * 2. CONTROL 38662306a36Sopenharmony_ci * 3. CONTROL2 38762306a36Sopenharmony_ci * 4. MQD_ADDR_LO [31:0] 38862306a36Sopenharmony_ci * 5. MQD_ADDR_HI [31:0] 38962306a36Sopenharmony_ci * 6. WPTR_ADDR_LO [31:0] 39062306a36Sopenharmony_ci * 7. WPTR_ADDR_HI [31:0] 39162306a36Sopenharmony_ci */ 39262306a36Sopenharmony_ci/* CONTROL */ 39362306a36Sopenharmony_ci# define PACKET3_MAP_QUEUES_QUEUE_SEL(x) ((x) << 4) 39462306a36Sopenharmony_ci# define PACKET3_MAP_QUEUES_VMID(x) ((x) << 8) 39562306a36Sopenharmony_ci# define PACKET3_MAP_QUEUES_QUEUE_TYPE(x) ((x) << 21) 39662306a36Sopenharmony_ci# define PACKET3_MAP_QUEUES_ALLOC_FORMAT(x) ((x) << 24) 39762306a36Sopenharmony_ci# define PACKET3_MAP_QUEUES_ENGINE_SEL(x) ((x) << 26) 39862306a36Sopenharmony_ci# define PACKET3_MAP_QUEUES_NUM_QUEUES(x) ((x) << 29) 39962306a36Sopenharmony_ci/* CONTROL2 */ 40062306a36Sopenharmony_ci# define PACKET3_MAP_QUEUES_CHECK_DISABLE(x) ((x) << 1) 40162306a36Sopenharmony_ci# define PACKET3_MAP_QUEUES_DOORBELL_OFFSET(x) ((x) << 2) 40262306a36Sopenharmony_ci# define PACKET3_MAP_QUEUES_QUEUE(x) ((x) << 26) 40362306a36Sopenharmony_ci# define PACKET3_MAP_QUEUES_PIPE(x) ((x) << 29) 40462306a36Sopenharmony_ci# define PACKET3_MAP_QUEUES_ME(x) ((x) << 31) 40562306a36Sopenharmony_ci#define PACKET3_UNMAP_QUEUES 0xA3 40662306a36Sopenharmony_ci/* 1. header 40762306a36Sopenharmony_ci * 2. CONTROL 40862306a36Sopenharmony_ci * 3. CONTROL2 40962306a36Sopenharmony_ci * 4. CONTROL3 41062306a36Sopenharmony_ci * 5. CONTROL4 41162306a36Sopenharmony_ci * 6. CONTROL5 41262306a36Sopenharmony_ci */ 41362306a36Sopenharmony_ci/* CONTROL */ 41462306a36Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_ACTION(x) ((x) << 0) 41562306a36Sopenharmony_ci /* 0 - PREEMPT_QUEUES 41662306a36Sopenharmony_ci * 1 - RESET_QUEUES 41762306a36Sopenharmony_ci * 2 - DISABLE_PROCESS_QUEUES 41862306a36Sopenharmony_ci * 3 - PREEMPT_QUEUES_NO_UNMAP 41962306a36Sopenharmony_ci */ 42062306a36Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_QUEUE_SEL(x) ((x) << 4) 42162306a36Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_ENGINE_SEL(x) ((x) << 26) 42262306a36Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_NUM_QUEUES(x) ((x) << 29) 42362306a36Sopenharmony_ci/* CONTROL2a */ 42462306a36Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_PASID(x) ((x) << 0) 42562306a36Sopenharmony_ci/* CONTROL2b */ 42662306a36Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_DOORBELL_OFFSET0(x) ((x) << 2) 42762306a36Sopenharmony_ci/* CONTROL3a */ 42862306a36Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_DOORBELL_OFFSET1(x) ((x) << 2) 42962306a36Sopenharmony_ci/* CONTROL3b */ 43062306a36Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_RB_WPTR(x) ((x) << 0) 43162306a36Sopenharmony_ci/* CONTROL4 */ 43262306a36Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_DOORBELL_OFFSET2(x) ((x) << 2) 43362306a36Sopenharmony_ci/* CONTROL5 */ 43462306a36Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_DOORBELL_OFFSET3(x) ((x) << 2) 43562306a36Sopenharmony_ci#define PACKET3_QUERY_STATUS 0xA4 43662306a36Sopenharmony_ci/* 1. header 43762306a36Sopenharmony_ci * 2. CONTROL 43862306a36Sopenharmony_ci * 3. CONTROL2 43962306a36Sopenharmony_ci * 4. ADDR_LO [31:0] 44062306a36Sopenharmony_ci * 5. ADDR_HI [31:0] 44162306a36Sopenharmony_ci * 6. DATA_LO [31:0] 44262306a36Sopenharmony_ci * 7. DATA_HI [31:0] 44362306a36Sopenharmony_ci */ 44462306a36Sopenharmony_ci/* CONTROL */ 44562306a36Sopenharmony_ci# define PACKET3_QUERY_STATUS_CONTEXT_ID(x) ((x) << 0) 44662306a36Sopenharmony_ci# define PACKET3_QUERY_STATUS_INTERRUPT_SEL(x) ((x) << 28) 44762306a36Sopenharmony_ci# define PACKET3_QUERY_STATUS_COMMAND(x) ((x) << 30) 44862306a36Sopenharmony_ci/* CONTROL2a */ 44962306a36Sopenharmony_ci# define PACKET3_QUERY_STATUS_PASID(x) ((x) << 0) 45062306a36Sopenharmony_ci/* CONTROL2b */ 45162306a36Sopenharmony_ci# define PACKET3_QUERY_STATUS_DOORBELL_OFFSET(x) ((x) << 2) 45262306a36Sopenharmony_ci# define PACKET3_QUERY_STATUS_ENG_SEL(x) ((x) << 25) 45362306a36Sopenharmony_ci 45462306a36Sopenharmony_ci 45562306a36Sopenharmony_ci#define VCE_CMD_NO_OP 0x00000000 45662306a36Sopenharmony_ci#define VCE_CMD_END 0x00000001 45762306a36Sopenharmony_ci#define VCE_CMD_IB 0x00000002 45862306a36Sopenharmony_ci#define VCE_CMD_FENCE 0x00000003 45962306a36Sopenharmony_ci#define VCE_CMD_TRAP 0x00000004 46062306a36Sopenharmony_ci#define VCE_CMD_IB_AUTO 0x00000005 46162306a36Sopenharmony_ci#define VCE_CMD_SEMAPHORE 0x00000006 46262306a36Sopenharmony_ci 46362306a36Sopenharmony_ci#define VCE_CMD_IB_VM 0x00000102 46462306a36Sopenharmony_ci#define VCE_CMD_WAIT_GE 0x00000106 46562306a36Sopenharmony_ci#define VCE_CMD_UPDATE_PTB 0x00000107 46662306a36Sopenharmony_ci#define VCE_CMD_FLUSH_TLB 0x00000108 46762306a36Sopenharmony_ci 46862306a36Sopenharmony_ci/* HEVC ENC */ 46962306a36Sopenharmony_ci#define HEVC_ENC_CMD_NO_OP 0x00000000 47062306a36Sopenharmony_ci#define HEVC_ENC_CMD_END 0x00000001 47162306a36Sopenharmony_ci#define HEVC_ENC_CMD_FENCE 0x00000003 47262306a36Sopenharmony_ci#define HEVC_ENC_CMD_TRAP 0x00000004 47362306a36Sopenharmony_ci#define HEVC_ENC_CMD_IB_VM 0x00000102 47462306a36Sopenharmony_ci#define HEVC_ENC_CMD_WAIT_GE 0x00000106 47562306a36Sopenharmony_ci#define HEVC_ENC_CMD_UPDATE_PTB 0x00000107 47662306a36Sopenharmony_ci#define HEVC_ENC_CMD_FLUSH_TLB 0x00000108 47762306a36Sopenharmony_ci 47862306a36Sopenharmony_ci/* mmPA_SC_RASTER_CONFIG mask */ 47962306a36Sopenharmony_ci#define RB_MAP_PKR0(x) ((x) << 0) 48062306a36Sopenharmony_ci#define RB_MAP_PKR0_MASK (0x3 << 0) 48162306a36Sopenharmony_ci#define RB_MAP_PKR1(x) ((x) << 2) 48262306a36Sopenharmony_ci#define RB_MAP_PKR1_MASK (0x3 << 2) 48362306a36Sopenharmony_ci#define RB_XSEL2(x) ((x) << 4) 48462306a36Sopenharmony_ci#define RB_XSEL2_MASK (0x3 << 4) 48562306a36Sopenharmony_ci#define RB_XSEL (1 << 6) 48662306a36Sopenharmony_ci#define RB_YSEL (1 << 7) 48762306a36Sopenharmony_ci#define PKR_MAP(x) ((x) << 8) 48862306a36Sopenharmony_ci#define PKR_MAP_MASK (0x3 << 8) 48962306a36Sopenharmony_ci#define PKR_XSEL(x) ((x) << 10) 49062306a36Sopenharmony_ci#define PKR_XSEL_MASK (0x3 << 10) 49162306a36Sopenharmony_ci#define PKR_YSEL(x) ((x) << 12) 49262306a36Sopenharmony_ci#define PKR_YSEL_MASK (0x3 << 12) 49362306a36Sopenharmony_ci#define SC_MAP(x) ((x) << 16) 49462306a36Sopenharmony_ci#define SC_MAP_MASK (0x3 << 16) 49562306a36Sopenharmony_ci#define SC_XSEL(x) ((x) << 18) 49662306a36Sopenharmony_ci#define SC_XSEL_MASK (0x3 << 18) 49762306a36Sopenharmony_ci#define SC_YSEL(x) ((x) << 20) 49862306a36Sopenharmony_ci#define SC_YSEL_MASK (0x3 << 20) 49962306a36Sopenharmony_ci#define SE_MAP(x) ((x) << 24) 50062306a36Sopenharmony_ci#define SE_MAP_MASK (0x3 << 24) 50162306a36Sopenharmony_ci#define SE_XSEL(x) ((x) << 26) 50262306a36Sopenharmony_ci#define SE_XSEL_MASK (0x3 << 26) 50362306a36Sopenharmony_ci#define SE_YSEL(x) ((x) << 28) 50462306a36Sopenharmony_ci#define SE_YSEL_MASK (0x3 << 28) 50562306a36Sopenharmony_ci 50662306a36Sopenharmony_ci/* mmPA_SC_RASTER_CONFIG_1 mask */ 50762306a36Sopenharmony_ci#define SE_PAIR_MAP(x) ((x) << 0) 50862306a36Sopenharmony_ci#define SE_PAIR_MAP_MASK (0x3 << 0) 50962306a36Sopenharmony_ci#define SE_PAIR_XSEL(x) ((x) << 2) 51062306a36Sopenharmony_ci#define SE_PAIR_XSEL_MASK (0x3 << 2) 51162306a36Sopenharmony_ci#define SE_PAIR_YSEL(x) ((x) << 4) 51262306a36Sopenharmony_ci#define SE_PAIR_YSEL_MASK (0x3 << 4) 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_ci#endif 515