18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2014 Advanced Micro Devices, Inc. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation 78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 128c2ecf20Sopenharmony_ci * all copies or substantial portions of the Software. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 158c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 168c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 178c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 188c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 198c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 208c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci */ 238c2ecf20Sopenharmony_ci#ifndef VI_H 248c2ecf20Sopenharmony_ci#define VI_H 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#define SDMA0_REGISTER_OFFSET 0x0 /* not a register */ 278c2ecf20Sopenharmony_ci#define SDMA1_REGISTER_OFFSET 0x200 /* not a register */ 288c2ecf20Sopenharmony_ci#define SDMA_MAX_INSTANCE 2 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define KFD_VI_SDMA_QUEUE_OFFSET 0x80 /* not a register */ 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/* crtc instance offsets */ 338c2ecf20Sopenharmony_ci#define CRTC0_REGISTER_OFFSET (0x1b9c - 0x1b9c) 348c2ecf20Sopenharmony_ci#define CRTC1_REGISTER_OFFSET (0x1d9c - 0x1b9c) 358c2ecf20Sopenharmony_ci#define CRTC2_REGISTER_OFFSET (0x1f9c - 0x1b9c) 368c2ecf20Sopenharmony_ci#define CRTC3_REGISTER_OFFSET (0x419c - 0x1b9c) 378c2ecf20Sopenharmony_ci#define CRTC4_REGISTER_OFFSET (0x439c - 0x1b9c) 388c2ecf20Sopenharmony_ci#define CRTC5_REGISTER_OFFSET (0x459c - 0x1b9c) 398c2ecf20Sopenharmony_ci#define CRTC6_REGISTER_OFFSET (0x479c - 0x1b9c) 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* dig instance offsets */ 428c2ecf20Sopenharmony_ci#define DIG0_REGISTER_OFFSET (0x4a00 - 0x4a00) 438c2ecf20Sopenharmony_ci#define DIG1_REGISTER_OFFSET (0x4b00 - 0x4a00) 448c2ecf20Sopenharmony_ci#define DIG2_REGISTER_OFFSET (0x4c00 - 0x4a00) 458c2ecf20Sopenharmony_ci#define DIG3_REGISTER_OFFSET (0x4d00 - 0x4a00) 468c2ecf20Sopenharmony_ci#define DIG4_REGISTER_OFFSET (0x4e00 - 0x4a00) 478c2ecf20Sopenharmony_ci#define DIG5_REGISTER_OFFSET (0x4f00 - 0x4a00) 488c2ecf20Sopenharmony_ci#define DIG6_REGISTER_OFFSET (0x5400 - 0x4a00) 498c2ecf20Sopenharmony_ci#define DIG7_REGISTER_OFFSET (0x5600 - 0x4a00) 508c2ecf20Sopenharmony_ci#define DIG8_REGISTER_OFFSET (0x5700 - 0x4a00) 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/* audio endpt instance offsets */ 538c2ecf20Sopenharmony_ci#define AUD0_REGISTER_OFFSET (0x17a8 - 0x17a8) 548c2ecf20Sopenharmony_ci#define AUD1_REGISTER_OFFSET (0x17ac - 0x17a8) 558c2ecf20Sopenharmony_ci#define AUD2_REGISTER_OFFSET (0x17b0 - 0x17a8) 568c2ecf20Sopenharmony_ci#define AUD3_REGISTER_OFFSET (0x17b4 - 0x17a8) 578c2ecf20Sopenharmony_ci#define AUD4_REGISTER_OFFSET (0x17b8 - 0x17a8) 588c2ecf20Sopenharmony_ci#define AUD5_REGISTER_OFFSET (0x17bc - 0x17a8) 598c2ecf20Sopenharmony_ci#define AUD6_REGISTER_OFFSET (0x17c0 - 0x17a8) 608c2ecf20Sopenharmony_ci#define AUD7_REGISTER_OFFSET (0x17c4 - 0x17a8) 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/* hpd instance offsets */ 638c2ecf20Sopenharmony_ci#define HPD0_REGISTER_OFFSET (0x1898 - 0x1898) 648c2ecf20Sopenharmony_ci#define HPD1_REGISTER_OFFSET (0x18a0 - 0x1898) 658c2ecf20Sopenharmony_ci#define HPD2_REGISTER_OFFSET (0x18a8 - 0x1898) 668c2ecf20Sopenharmony_ci#define HPD3_REGISTER_OFFSET (0x18b0 - 0x1898) 678c2ecf20Sopenharmony_ci#define HPD4_REGISTER_OFFSET (0x18b8 - 0x1898) 688c2ecf20Sopenharmony_ci#define HPD5_REGISTER_OFFSET (0x18c0 - 0x1898) 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci#define PIPEID(x) ((x) << 0) 718c2ecf20Sopenharmony_ci#define MEID(x) ((x) << 2) 728c2ecf20Sopenharmony_ci#define VMID(x) ((x) << 4) 738c2ecf20Sopenharmony_ci#define QUEUEID(x) ((x) << 8) 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define MC_SEQ_MISC0__MT__MASK 0xf0000000 768c2ecf20Sopenharmony_ci#define MC_SEQ_MISC0__MT__GDDR1 0x10000000 778c2ecf20Sopenharmony_ci#define MC_SEQ_MISC0__MT__DDR2 0x20000000 788c2ecf20Sopenharmony_ci#define MC_SEQ_MISC0__MT__GDDR3 0x30000000 798c2ecf20Sopenharmony_ci#define MC_SEQ_MISC0__MT__GDDR4 0x40000000 808c2ecf20Sopenharmony_ci#define MC_SEQ_MISC0__MT__GDDR5 0x50000000 818c2ecf20Sopenharmony_ci#define MC_SEQ_MISC0__MT__HBM 0x60000000 828c2ecf20Sopenharmony_ci#define MC_SEQ_MISC0__MT__DDR3 0xB0000000 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci/* 858c2ecf20Sopenharmony_ci * PM4 868c2ecf20Sopenharmony_ci */ 878c2ecf20Sopenharmony_ci#define PACKET_TYPE0 0 888c2ecf20Sopenharmony_ci#define PACKET_TYPE1 1 898c2ecf20Sopenharmony_ci#define PACKET_TYPE2 2 908c2ecf20Sopenharmony_ci#define PACKET_TYPE3 3 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci#define CP_PACKET_GET_TYPE(h) (((h) >> 30) & 3) 938c2ecf20Sopenharmony_ci#define CP_PACKET_GET_COUNT(h) (((h) >> 16) & 0x3FFF) 948c2ecf20Sopenharmony_ci#define CP_PACKET0_GET_REG(h) ((h) & 0xFFFF) 958c2ecf20Sopenharmony_ci#define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF) 968c2ecf20Sopenharmony_ci#define PACKET0(reg, n) ((PACKET_TYPE0 << 30) | \ 978c2ecf20Sopenharmony_ci ((reg) & 0xFFFF) | \ 988c2ecf20Sopenharmony_ci ((n) & 0x3FFF) << 16) 998c2ecf20Sopenharmony_ci#define CP_PACKET2 0x80000000 1008c2ecf20Sopenharmony_ci#define PACKET2_PAD_SHIFT 0 1018c2ecf20Sopenharmony_ci#define PACKET2_PAD_MASK (0x3fffffff << 0) 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci#define PACKET2(v) (CP_PACKET2 | REG_SET(PACKET2_PAD, (v))) 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci#define PACKET3(op, n) ((PACKET_TYPE3 << 30) | \ 1068c2ecf20Sopenharmony_ci (((op) & 0xFF) << 8) | \ 1078c2ecf20Sopenharmony_ci ((n) & 0x3FFF) << 16) 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci#define PACKET3_COMPUTE(op, n) (PACKET3(op, n) | 1 << 1) 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci/* Packet 3 types */ 1128c2ecf20Sopenharmony_ci#define PACKET3_NOP 0x10 1138c2ecf20Sopenharmony_ci#define PACKET3_SET_BASE 0x11 1148c2ecf20Sopenharmony_ci#define PACKET3_BASE_INDEX(x) ((x) << 0) 1158c2ecf20Sopenharmony_ci#define CE_PARTITION_BASE 3 1168c2ecf20Sopenharmony_ci#define PACKET3_CLEAR_STATE 0x12 1178c2ecf20Sopenharmony_ci#define PACKET3_INDEX_BUFFER_SIZE 0x13 1188c2ecf20Sopenharmony_ci#define PACKET3_DISPATCH_DIRECT 0x15 1198c2ecf20Sopenharmony_ci#define PACKET3_DISPATCH_INDIRECT 0x16 1208c2ecf20Sopenharmony_ci#define PACKET3_ATOMIC_GDS 0x1D 1218c2ecf20Sopenharmony_ci#define PACKET3_ATOMIC_MEM 0x1E 1228c2ecf20Sopenharmony_ci#define PACKET3_OCCLUSION_QUERY 0x1F 1238c2ecf20Sopenharmony_ci#define PACKET3_SET_PREDICATION 0x20 1248c2ecf20Sopenharmony_ci#define PACKET3_REG_RMW 0x21 1258c2ecf20Sopenharmony_ci#define PACKET3_COND_EXEC 0x22 1268c2ecf20Sopenharmony_ci#define PACKET3_PRED_EXEC 0x23 1278c2ecf20Sopenharmony_ci#define PACKET3_DRAW_INDIRECT 0x24 1288c2ecf20Sopenharmony_ci#define PACKET3_DRAW_INDEX_INDIRECT 0x25 1298c2ecf20Sopenharmony_ci#define PACKET3_INDEX_BASE 0x26 1308c2ecf20Sopenharmony_ci#define PACKET3_DRAW_INDEX_2 0x27 1318c2ecf20Sopenharmony_ci#define PACKET3_CONTEXT_CONTROL 0x28 1328c2ecf20Sopenharmony_ci#define PACKET3_INDEX_TYPE 0x2A 1338c2ecf20Sopenharmony_ci#define PACKET3_DRAW_INDIRECT_MULTI 0x2C 1348c2ecf20Sopenharmony_ci#define PACKET3_DRAW_INDEX_AUTO 0x2D 1358c2ecf20Sopenharmony_ci#define PACKET3_NUM_INSTANCES 0x2F 1368c2ecf20Sopenharmony_ci#define PACKET3_DRAW_INDEX_MULTI_AUTO 0x30 1378c2ecf20Sopenharmony_ci#define PACKET3_INDIRECT_BUFFER_CONST 0x33 1388c2ecf20Sopenharmony_ci#define PACKET3_STRMOUT_BUFFER_UPDATE 0x34 1398c2ecf20Sopenharmony_ci#define PACKET3_DRAW_INDEX_OFFSET_2 0x35 1408c2ecf20Sopenharmony_ci#define PACKET3_DRAW_PREAMBLE 0x36 1418c2ecf20Sopenharmony_ci#define PACKET3_WRITE_DATA 0x37 1428c2ecf20Sopenharmony_ci#define WRITE_DATA_DST_SEL(x) ((x) << 8) 1438c2ecf20Sopenharmony_ci /* 0 - register 1448c2ecf20Sopenharmony_ci * 1 - memory (sync - via GRBM) 1458c2ecf20Sopenharmony_ci * 2 - gl2 1468c2ecf20Sopenharmony_ci * 3 - gds 1478c2ecf20Sopenharmony_ci * 4 - reserved 1488c2ecf20Sopenharmony_ci * 5 - memory (async - direct) 1498c2ecf20Sopenharmony_ci */ 1508c2ecf20Sopenharmony_ci#define WR_ONE_ADDR (1 << 16) 1518c2ecf20Sopenharmony_ci#define WR_CONFIRM (1 << 20) 1528c2ecf20Sopenharmony_ci#define WRITE_DATA_CACHE_POLICY(x) ((x) << 25) 1538c2ecf20Sopenharmony_ci /* 0 - LRU 1548c2ecf20Sopenharmony_ci * 1 - Stream 1558c2ecf20Sopenharmony_ci */ 1568c2ecf20Sopenharmony_ci#define WRITE_DATA_ENGINE_SEL(x) ((x) << 30) 1578c2ecf20Sopenharmony_ci /* 0 - me 1588c2ecf20Sopenharmony_ci * 1 - pfp 1598c2ecf20Sopenharmony_ci * 2 - ce 1608c2ecf20Sopenharmony_ci */ 1618c2ecf20Sopenharmony_ci#define PACKET3_DRAW_INDEX_INDIRECT_MULTI 0x38 1628c2ecf20Sopenharmony_ci#define PACKET3_MEM_SEMAPHORE 0x39 1638c2ecf20Sopenharmony_ci# define PACKET3_SEM_USE_MAILBOX (0x1 << 16) 1648c2ecf20Sopenharmony_ci# define PACKET3_SEM_SEL_SIGNAL_TYPE (0x1 << 20) /* 0 = increment, 1 = write 1 */ 1658c2ecf20Sopenharmony_ci# define PACKET3_SEM_CLIENT_CODE ((x) << 24) /* 0 = CP, 1 = CB, 2 = DB */ 1668c2ecf20Sopenharmony_ci# define PACKET3_SEM_SEL_SIGNAL (0x6 << 29) 1678c2ecf20Sopenharmony_ci# define PACKET3_SEM_SEL_WAIT (0x7 << 29) 1688c2ecf20Sopenharmony_ci#define PACKET3_WAIT_REG_MEM 0x3C 1698c2ecf20Sopenharmony_ci#define WAIT_REG_MEM_FUNCTION(x) ((x) << 0) 1708c2ecf20Sopenharmony_ci /* 0 - always 1718c2ecf20Sopenharmony_ci * 1 - < 1728c2ecf20Sopenharmony_ci * 2 - <= 1738c2ecf20Sopenharmony_ci * 3 - == 1748c2ecf20Sopenharmony_ci * 4 - != 1758c2ecf20Sopenharmony_ci * 5 - >= 1768c2ecf20Sopenharmony_ci * 6 - > 1778c2ecf20Sopenharmony_ci */ 1788c2ecf20Sopenharmony_ci#define WAIT_REG_MEM_MEM_SPACE(x) ((x) << 4) 1798c2ecf20Sopenharmony_ci /* 0 - reg 1808c2ecf20Sopenharmony_ci * 1 - mem 1818c2ecf20Sopenharmony_ci */ 1828c2ecf20Sopenharmony_ci#define WAIT_REG_MEM_OPERATION(x) ((x) << 6) 1838c2ecf20Sopenharmony_ci /* 0 - wait_reg_mem 1848c2ecf20Sopenharmony_ci * 1 - wr_wait_wr_reg 1858c2ecf20Sopenharmony_ci */ 1868c2ecf20Sopenharmony_ci#define WAIT_REG_MEM_ENGINE(x) ((x) << 8) 1878c2ecf20Sopenharmony_ci /* 0 - me 1888c2ecf20Sopenharmony_ci * 1 - pfp 1898c2ecf20Sopenharmony_ci */ 1908c2ecf20Sopenharmony_ci#define PACKET3_INDIRECT_BUFFER 0x3F 1918c2ecf20Sopenharmony_ci#define INDIRECT_BUFFER_TCL2_VOLATILE (1 << 22) 1928c2ecf20Sopenharmony_ci#define INDIRECT_BUFFER_VALID (1 << 23) 1938c2ecf20Sopenharmony_ci#define INDIRECT_BUFFER_CACHE_POLICY(x) ((x) << 28) 1948c2ecf20Sopenharmony_ci /* 0 - LRU 1958c2ecf20Sopenharmony_ci * 1 - Stream 1968c2ecf20Sopenharmony_ci * 2 - Bypass 1978c2ecf20Sopenharmony_ci */ 1988c2ecf20Sopenharmony_ci#define INDIRECT_BUFFER_PRE_ENB(x) ((x) << 21) 1998c2ecf20Sopenharmony_ci#define PACKET3_COPY_DATA 0x40 2008c2ecf20Sopenharmony_ci#define PACKET3_PFP_SYNC_ME 0x42 2018c2ecf20Sopenharmony_ci#define PACKET3_SURFACE_SYNC 0x43 2028c2ecf20Sopenharmony_ci# define PACKET3_DEST_BASE_0_ENA (1 << 0) 2038c2ecf20Sopenharmony_ci# define PACKET3_DEST_BASE_1_ENA (1 << 1) 2048c2ecf20Sopenharmony_ci# define PACKET3_CB0_DEST_BASE_ENA (1 << 6) 2058c2ecf20Sopenharmony_ci# define PACKET3_CB1_DEST_BASE_ENA (1 << 7) 2068c2ecf20Sopenharmony_ci# define PACKET3_CB2_DEST_BASE_ENA (1 << 8) 2078c2ecf20Sopenharmony_ci# define PACKET3_CB3_DEST_BASE_ENA (1 << 9) 2088c2ecf20Sopenharmony_ci# define PACKET3_CB4_DEST_BASE_ENA (1 << 10) 2098c2ecf20Sopenharmony_ci# define PACKET3_CB5_DEST_BASE_ENA (1 << 11) 2108c2ecf20Sopenharmony_ci# define PACKET3_CB6_DEST_BASE_ENA (1 << 12) 2118c2ecf20Sopenharmony_ci# define PACKET3_CB7_DEST_BASE_ENA (1 << 13) 2128c2ecf20Sopenharmony_ci# define PACKET3_DB_DEST_BASE_ENA (1 << 14) 2138c2ecf20Sopenharmony_ci# define PACKET3_TCL1_VOL_ACTION_ENA (1 << 15) 2148c2ecf20Sopenharmony_ci# define PACKET3_TC_VOL_ACTION_ENA (1 << 16) /* L2 */ 2158c2ecf20Sopenharmony_ci# define PACKET3_TC_WB_ACTION_ENA (1 << 18) /* L2 */ 2168c2ecf20Sopenharmony_ci# define PACKET3_DEST_BASE_2_ENA (1 << 19) 2178c2ecf20Sopenharmony_ci# define PACKET3_DEST_BASE_3_ENA (1 << 21) 2188c2ecf20Sopenharmony_ci# define PACKET3_TCL1_ACTION_ENA (1 << 22) 2198c2ecf20Sopenharmony_ci# define PACKET3_TC_ACTION_ENA (1 << 23) /* L2 */ 2208c2ecf20Sopenharmony_ci# define PACKET3_CB_ACTION_ENA (1 << 25) 2218c2ecf20Sopenharmony_ci# define PACKET3_DB_ACTION_ENA (1 << 26) 2228c2ecf20Sopenharmony_ci# define PACKET3_SH_KCACHE_ACTION_ENA (1 << 27) 2238c2ecf20Sopenharmony_ci# define PACKET3_SH_KCACHE_VOL_ACTION_ENA (1 << 28) 2248c2ecf20Sopenharmony_ci# define PACKET3_SH_ICACHE_ACTION_ENA (1 << 29) 2258c2ecf20Sopenharmony_ci#define PACKET3_COND_WRITE 0x45 2268c2ecf20Sopenharmony_ci#define PACKET3_EVENT_WRITE 0x46 2278c2ecf20Sopenharmony_ci#define EVENT_TYPE(x) ((x) << 0) 2288c2ecf20Sopenharmony_ci#define EVENT_INDEX(x) ((x) << 8) 2298c2ecf20Sopenharmony_ci /* 0 - any non-TS event 2308c2ecf20Sopenharmony_ci * 1 - ZPASS_DONE, PIXEL_PIPE_STAT_* 2318c2ecf20Sopenharmony_ci * 2 - SAMPLE_PIPELINESTAT 2328c2ecf20Sopenharmony_ci * 3 - SAMPLE_STREAMOUTSTAT* 2338c2ecf20Sopenharmony_ci * 4 - *S_PARTIAL_FLUSH 2348c2ecf20Sopenharmony_ci * 5 - EOP events 2358c2ecf20Sopenharmony_ci * 6 - EOS events 2368c2ecf20Sopenharmony_ci */ 2378c2ecf20Sopenharmony_ci#define PACKET3_EVENT_WRITE_EOP 0x47 2388c2ecf20Sopenharmony_ci#define EOP_TCL1_VOL_ACTION_EN (1 << 12) 2398c2ecf20Sopenharmony_ci#define EOP_TC_VOL_ACTION_EN (1 << 13) /* L2 */ 2408c2ecf20Sopenharmony_ci#define EOP_TC_WB_ACTION_EN (1 << 15) /* L2 */ 2418c2ecf20Sopenharmony_ci#define EOP_TCL1_ACTION_EN (1 << 16) 2428c2ecf20Sopenharmony_ci#define EOP_TC_ACTION_EN (1 << 17) /* L2 */ 2438c2ecf20Sopenharmony_ci#define EOP_TCL2_VOLATILE (1 << 24) 2448c2ecf20Sopenharmony_ci#define EOP_CACHE_POLICY(x) ((x) << 25) 2458c2ecf20Sopenharmony_ci /* 0 - LRU 2468c2ecf20Sopenharmony_ci * 1 - Stream 2478c2ecf20Sopenharmony_ci * 2 - Bypass 2488c2ecf20Sopenharmony_ci */ 2498c2ecf20Sopenharmony_ci#define DATA_SEL(x) ((x) << 29) 2508c2ecf20Sopenharmony_ci /* 0 - discard 2518c2ecf20Sopenharmony_ci * 1 - send low 32bit data 2528c2ecf20Sopenharmony_ci * 2 - send 64bit data 2538c2ecf20Sopenharmony_ci * 3 - send 64bit GPU counter value 2548c2ecf20Sopenharmony_ci * 4 - send 64bit sys counter value 2558c2ecf20Sopenharmony_ci */ 2568c2ecf20Sopenharmony_ci#define INT_SEL(x) ((x) << 24) 2578c2ecf20Sopenharmony_ci /* 0 - none 2588c2ecf20Sopenharmony_ci * 1 - interrupt only (DATA_SEL = 0) 2598c2ecf20Sopenharmony_ci * 2 - interrupt when data write is confirmed 2608c2ecf20Sopenharmony_ci */ 2618c2ecf20Sopenharmony_ci#define DST_SEL(x) ((x) << 16) 2628c2ecf20Sopenharmony_ci /* 0 - MC 2638c2ecf20Sopenharmony_ci * 1 - TC/L2 2648c2ecf20Sopenharmony_ci */ 2658c2ecf20Sopenharmony_ci#define PACKET3_EVENT_WRITE_EOS 0x48 2668c2ecf20Sopenharmony_ci#define PACKET3_RELEASE_MEM 0x49 2678c2ecf20Sopenharmony_ci#define PACKET3_PREAMBLE_CNTL 0x4A 2688c2ecf20Sopenharmony_ci# define PACKET3_PREAMBLE_BEGIN_CLEAR_STATE (2 << 28) 2698c2ecf20Sopenharmony_ci# define PACKET3_PREAMBLE_END_CLEAR_STATE (3 << 28) 2708c2ecf20Sopenharmony_ci#define PACKET3_DMA_DATA 0x50 2718c2ecf20Sopenharmony_ci/* 1. header 2728c2ecf20Sopenharmony_ci * 2. CONTROL 2738c2ecf20Sopenharmony_ci * 3. SRC_ADDR_LO or DATA [31:0] 2748c2ecf20Sopenharmony_ci * 4. SRC_ADDR_HI [31:0] 2758c2ecf20Sopenharmony_ci * 5. DST_ADDR_LO [31:0] 2768c2ecf20Sopenharmony_ci * 6. DST_ADDR_HI [7:0] 2778c2ecf20Sopenharmony_ci * 7. COMMAND [30:21] | BYTE_COUNT [20:0] 2788c2ecf20Sopenharmony_ci */ 2798c2ecf20Sopenharmony_ci/* CONTROL */ 2808c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_ENGINE(x) ((x) << 0) 2818c2ecf20Sopenharmony_ci /* 0 - ME 2828c2ecf20Sopenharmony_ci * 1 - PFP 2838c2ecf20Sopenharmony_ci */ 2848c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_SRC_CACHE_POLICY(x) ((x) << 13) 2858c2ecf20Sopenharmony_ci /* 0 - LRU 2868c2ecf20Sopenharmony_ci * 1 - Stream 2878c2ecf20Sopenharmony_ci * 2 - Bypass 2888c2ecf20Sopenharmony_ci */ 2898c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_SRC_VOLATILE (1 << 15) 2908c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_DST_SEL(x) ((x) << 20) 2918c2ecf20Sopenharmony_ci /* 0 - DST_ADDR using DAS 2928c2ecf20Sopenharmony_ci * 1 - GDS 2938c2ecf20Sopenharmony_ci * 3 - DST_ADDR using L2 2948c2ecf20Sopenharmony_ci */ 2958c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_DST_CACHE_POLICY(x) ((x) << 25) 2968c2ecf20Sopenharmony_ci /* 0 - LRU 2978c2ecf20Sopenharmony_ci * 1 - Stream 2988c2ecf20Sopenharmony_ci * 2 - Bypass 2998c2ecf20Sopenharmony_ci */ 3008c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_DST_VOLATILE (1 << 27) 3018c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_SRC_SEL(x) ((x) << 29) 3028c2ecf20Sopenharmony_ci /* 0 - SRC_ADDR using SAS 3038c2ecf20Sopenharmony_ci * 1 - GDS 3048c2ecf20Sopenharmony_ci * 2 - DATA 3058c2ecf20Sopenharmony_ci * 3 - SRC_ADDR using L2 3068c2ecf20Sopenharmony_ci */ 3078c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_CP_SYNC (1 << 31) 3088c2ecf20Sopenharmony_ci/* COMMAND */ 3098c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_DIS_WC (1 << 21) 3108c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_SRC_SWAP(x) ((x) << 22) 3118c2ecf20Sopenharmony_ci /* 0 - none 3128c2ecf20Sopenharmony_ci * 1 - 8 in 16 3138c2ecf20Sopenharmony_ci * 2 - 8 in 32 3148c2ecf20Sopenharmony_ci * 3 - 8 in 64 3158c2ecf20Sopenharmony_ci */ 3168c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_DST_SWAP(x) ((x) << 24) 3178c2ecf20Sopenharmony_ci /* 0 - none 3188c2ecf20Sopenharmony_ci * 1 - 8 in 16 3198c2ecf20Sopenharmony_ci * 2 - 8 in 32 3208c2ecf20Sopenharmony_ci * 3 - 8 in 64 3218c2ecf20Sopenharmony_ci */ 3228c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_SAS (1 << 26) 3238c2ecf20Sopenharmony_ci /* 0 - memory 3248c2ecf20Sopenharmony_ci * 1 - register 3258c2ecf20Sopenharmony_ci */ 3268c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_DAS (1 << 27) 3278c2ecf20Sopenharmony_ci /* 0 - memory 3288c2ecf20Sopenharmony_ci * 1 - register 3298c2ecf20Sopenharmony_ci */ 3308c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_SAIC (1 << 28) 3318c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_DAIC (1 << 29) 3328c2ecf20Sopenharmony_ci# define PACKET3_DMA_DATA_CMD_RAW_WAIT (1 << 30) 3338c2ecf20Sopenharmony_ci#define PACKET3_ACQUIRE_MEM 0x58 3348c2ecf20Sopenharmony_ci#define PACKET3_REWIND 0x59 3358c2ecf20Sopenharmony_ci#define PACKET3_LOAD_UCONFIG_REG 0x5E 3368c2ecf20Sopenharmony_ci#define PACKET3_LOAD_SH_REG 0x5F 3378c2ecf20Sopenharmony_ci#define PACKET3_LOAD_CONFIG_REG 0x60 3388c2ecf20Sopenharmony_ci#define PACKET3_LOAD_CONTEXT_REG 0x61 3398c2ecf20Sopenharmony_ci#define PACKET3_SET_CONFIG_REG 0x68 3408c2ecf20Sopenharmony_ci#define PACKET3_SET_CONFIG_REG_START 0x00002000 3418c2ecf20Sopenharmony_ci#define PACKET3_SET_CONFIG_REG_END 0x00002c00 3428c2ecf20Sopenharmony_ci#define PACKET3_SET_CONTEXT_REG 0x69 3438c2ecf20Sopenharmony_ci#define PACKET3_SET_CONTEXT_REG_START 0x0000a000 3448c2ecf20Sopenharmony_ci#define PACKET3_SET_CONTEXT_REG_END 0x0000a400 3458c2ecf20Sopenharmony_ci#define PACKET3_SET_CONTEXT_REG_INDIRECT 0x73 3468c2ecf20Sopenharmony_ci#define PACKET3_SET_SH_REG 0x76 3478c2ecf20Sopenharmony_ci#define PACKET3_SET_SH_REG_START 0x00002c00 3488c2ecf20Sopenharmony_ci#define PACKET3_SET_SH_REG_END 0x00003000 3498c2ecf20Sopenharmony_ci#define PACKET3_SET_SH_REG_OFFSET 0x77 3508c2ecf20Sopenharmony_ci#define PACKET3_SET_QUEUE_REG 0x78 3518c2ecf20Sopenharmony_ci#define PACKET3_SET_UCONFIG_REG 0x79 3528c2ecf20Sopenharmony_ci#define PACKET3_SET_UCONFIG_REG_START 0x0000c000 3538c2ecf20Sopenharmony_ci#define PACKET3_SET_UCONFIG_REG_END 0x0000c400 3548c2ecf20Sopenharmony_ci#define PACKET3_SCRATCH_RAM_WRITE 0x7D 3558c2ecf20Sopenharmony_ci#define PACKET3_SCRATCH_RAM_READ 0x7E 3568c2ecf20Sopenharmony_ci#define PACKET3_LOAD_CONST_RAM 0x80 3578c2ecf20Sopenharmony_ci#define PACKET3_WRITE_CONST_RAM 0x81 3588c2ecf20Sopenharmony_ci#define PACKET3_DUMP_CONST_RAM 0x83 3598c2ecf20Sopenharmony_ci#define PACKET3_INCREMENT_CE_COUNTER 0x84 3608c2ecf20Sopenharmony_ci#define PACKET3_INCREMENT_DE_COUNTER 0x85 3618c2ecf20Sopenharmony_ci#define PACKET3_WAIT_ON_CE_COUNTER 0x86 3628c2ecf20Sopenharmony_ci#define PACKET3_WAIT_ON_DE_COUNTER_DIFF 0x88 3638c2ecf20Sopenharmony_ci#define PACKET3_SWITCH_BUFFER 0x8B 3648c2ecf20Sopenharmony_ci#define PACKET3_FRAME_CONTROL 0x90 3658c2ecf20Sopenharmony_ci# define FRAME_CMD(x) ((x) << 28) 3668c2ecf20Sopenharmony_ci /* 3678c2ecf20Sopenharmony_ci * x=0: tmz_begin 3688c2ecf20Sopenharmony_ci * x=1: tmz_end 3698c2ecf20Sopenharmony_ci */ 3708c2ecf20Sopenharmony_ci#define PACKET3_SET_RESOURCES 0xA0 3718c2ecf20Sopenharmony_ci/* 1. header 3728c2ecf20Sopenharmony_ci * 2. CONTROL 3738c2ecf20Sopenharmony_ci * 3. QUEUE_MASK_LO [31:0] 3748c2ecf20Sopenharmony_ci * 4. QUEUE_MASK_HI [31:0] 3758c2ecf20Sopenharmony_ci * 5. GWS_MASK_LO [31:0] 3768c2ecf20Sopenharmony_ci * 6. GWS_MASK_HI [31:0] 3778c2ecf20Sopenharmony_ci * 7. OAC_MASK [15:0] 3788c2ecf20Sopenharmony_ci * 8. GDS_HEAP_SIZE [16:11] | GDS_HEAP_BASE [5:0] 3798c2ecf20Sopenharmony_ci */ 3808c2ecf20Sopenharmony_ci# define PACKET3_SET_RESOURCES_VMID_MASK(x) ((x) << 0) 3818c2ecf20Sopenharmony_ci# define PACKET3_SET_RESOURCES_UNMAP_LATENTY(x) ((x) << 16) 3828c2ecf20Sopenharmony_ci# define PACKET3_SET_RESOURCES_QUEUE_TYPE(x) ((x) << 29) 3838c2ecf20Sopenharmony_ci#define PACKET3_MAP_QUEUES 0xA2 3848c2ecf20Sopenharmony_ci/* 1. header 3858c2ecf20Sopenharmony_ci * 2. CONTROL 3868c2ecf20Sopenharmony_ci * 3. CONTROL2 3878c2ecf20Sopenharmony_ci * 4. MQD_ADDR_LO [31:0] 3888c2ecf20Sopenharmony_ci * 5. MQD_ADDR_HI [31:0] 3898c2ecf20Sopenharmony_ci * 6. WPTR_ADDR_LO [31:0] 3908c2ecf20Sopenharmony_ci * 7. WPTR_ADDR_HI [31:0] 3918c2ecf20Sopenharmony_ci */ 3928c2ecf20Sopenharmony_ci/* CONTROL */ 3938c2ecf20Sopenharmony_ci# define PACKET3_MAP_QUEUES_QUEUE_SEL(x) ((x) << 4) 3948c2ecf20Sopenharmony_ci# define PACKET3_MAP_QUEUES_VMID(x) ((x) << 8) 3958c2ecf20Sopenharmony_ci# define PACKET3_MAP_QUEUES_QUEUE_TYPE(x) ((x) << 21) 3968c2ecf20Sopenharmony_ci# define PACKET3_MAP_QUEUES_ALLOC_FORMAT(x) ((x) << 24) 3978c2ecf20Sopenharmony_ci# define PACKET3_MAP_QUEUES_ENGINE_SEL(x) ((x) << 26) 3988c2ecf20Sopenharmony_ci# define PACKET3_MAP_QUEUES_NUM_QUEUES(x) ((x) << 29) 3998c2ecf20Sopenharmony_ci/* CONTROL2 */ 4008c2ecf20Sopenharmony_ci# define PACKET3_MAP_QUEUES_CHECK_DISABLE(x) ((x) << 1) 4018c2ecf20Sopenharmony_ci# define PACKET3_MAP_QUEUES_DOORBELL_OFFSET(x) ((x) << 2) 4028c2ecf20Sopenharmony_ci# define PACKET3_MAP_QUEUES_QUEUE(x) ((x) << 26) 4038c2ecf20Sopenharmony_ci# define PACKET3_MAP_QUEUES_PIPE(x) ((x) << 29) 4048c2ecf20Sopenharmony_ci# define PACKET3_MAP_QUEUES_ME(x) ((x) << 31) 4058c2ecf20Sopenharmony_ci#define PACKET3_UNMAP_QUEUES 0xA3 4068c2ecf20Sopenharmony_ci/* 1. header 4078c2ecf20Sopenharmony_ci * 2. CONTROL 4088c2ecf20Sopenharmony_ci * 3. CONTROL2 4098c2ecf20Sopenharmony_ci * 4. CONTROL3 4108c2ecf20Sopenharmony_ci * 5. CONTROL4 4118c2ecf20Sopenharmony_ci * 6. CONTROL5 4128c2ecf20Sopenharmony_ci */ 4138c2ecf20Sopenharmony_ci/* CONTROL */ 4148c2ecf20Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_ACTION(x) ((x) << 0) 4158c2ecf20Sopenharmony_ci /* 0 - PREEMPT_QUEUES 4168c2ecf20Sopenharmony_ci * 1 - RESET_QUEUES 4178c2ecf20Sopenharmony_ci * 2 - DISABLE_PROCESS_QUEUES 4188c2ecf20Sopenharmony_ci * 3 - PREEMPT_QUEUES_NO_UNMAP 4198c2ecf20Sopenharmony_ci */ 4208c2ecf20Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_QUEUE_SEL(x) ((x) << 4) 4218c2ecf20Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_ENGINE_SEL(x) ((x) << 26) 4228c2ecf20Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_NUM_QUEUES(x) ((x) << 29) 4238c2ecf20Sopenharmony_ci/* CONTROL2a */ 4248c2ecf20Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_PASID(x) ((x) << 0) 4258c2ecf20Sopenharmony_ci/* CONTROL2b */ 4268c2ecf20Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_DOORBELL_OFFSET0(x) ((x) << 2) 4278c2ecf20Sopenharmony_ci/* CONTROL3a */ 4288c2ecf20Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_DOORBELL_OFFSET1(x) ((x) << 2) 4298c2ecf20Sopenharmony_ci/* CONTROL3b */ 4308c2ecf20Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_RB_WPTR(x) ((x) << 0) 4318c2ecf20Sopenharmony_ci/* CONTROL4 */ 4328c2ecf20Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_DOORBELL_OFFSET2(x) ((x) << 2) 4338c2ecf20Sopenharmony_ci/* CONTROL5 */ 4348c2ecf20Sopenharmony_ci# define PACKET3_UNMAP_QUEUES_DOORBELL_OFFSET3(x) ((x) << 2) 4358c2ecf20Sopenharmony_ci#define PACKET3_QUERY_STATUS 0xA4 4368c2ecf20Sopenharmony_ci/* 1. header 4378c2ecf20Sopenharmony_ci * 2. CONTROL 4388c2ecf20Sopenharmony_ci * 3. CONTROL2 4398c2ecf20Sopenharmony_ci * 4. ADDR_LO [31:0] 4408c2ecf20Sopenharmony_ci * 5. ADDR_HI [31:0] 4418c2ecf20Sopenharmony_ci * 6. DATA_LO [31:0] 4428c2ecf20Sopenharmony_ci * 7. DATA_HI [31:0] 4438c2ecf20Sopenharmony_ci */ 4448c2ecf20Sopenharmony_ci/* CONTROL */ 4458c2ecf20Sopenharmony_ci# define PACKET3_QUERY_STATUS_CONTEXT_ID(x) ((x) << 0) 4468c2ecf20Sopenharmony_ci# define PACKET3_QUERY_STATUS_INTERRUPT_SEL(x) ((x) << 28) 4478c2ecf20Sopenharmony_ci# define PACKET3_QUERY_STATUS_COMMAND(x) ((x) << 30) 4488c2ecf20Sopenharmony_ci/* CONTROL2a */ 4498c2ecf20Sopenharmony_ci# define PACKET3_QUERY_STATUS_PASID(x) ((x) << 0) 4508c2ecf20Sopenharmony_ci/* CONTROL2b */ 4518c2ecf20Sopenharmony_ci# define PACKET3_QUERY_STATUS_DOORBELL_OFFSET(x) ((x) << 2) 4528c2ecf20Sopenharmony_ci# define PACKET3_QUERY_STATUS_ENG_SEL(x) ((x) << 25) 4538c2ecf20Sopenharmony_ci 4548c2ecf20Sopenharmony_ci 4558c2ecf20Sopenharmony_ci#define VCE_CMD_NO_OP 0x00000000 4568c2ecf20Sopenharmony_ci#define VCE_CMD_END 0x00000001 4578c2ecf20Sopenharmony_ci#define VCE_CMD_IB 0x00000002 4588c2ecf20Sopenharmony_ci#define VCE_CMD_FENCE 0x00000003 4598c2ecf20Sopenharmony_ci#define VCE_CMD_TRAP 0x00000004 4608c2ecf20Sopenharmony_ci#define VCE_CMD_IB_AUTO 0x00000005 4618c2ecf20Sopenharmony_ci#define VCE_CMD_SEMAPHORE 0x00000006 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_ci#define VCE_CMD_IB_VM 0x00000102 4648c2ecf20Sopenharmony_ci#define VCE_CMD_WAIT_GE 0x00000106 4658c2ecf20Sopenharmony_ci#define VCE_CMD_UPDATE_PTB 0x00000107 4668c2ecf20Sopenharmony_ci#define VCE_CMD_FLUSH_TLB 0x00000108 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_ci/* HEVC ENC */ 4698c2ecf20Sopenharmony_ci#define HEVC_ENC_CMD_NO_OP 0x00000000 4708c2ecf20Sopenharmony_ci#define HEVC_ENC_CMD_END 0x00000001 4718c2ecf20Sopenharmony_ci#define HEVC_ENC_CMD_FENCE 0x00000003 4728c2ecf20Sopenharmony_ci#define HEVC_ENC_CMD_TRAP 0x00000004 4738c2ecf20Sopenharmony_ci#define HEVC_ENC_CMD_IB_VM 0x00000102 4748c2ecf20Sopenharmony_ci#define HEVC_ENC_CMD_WAIT_GE 0x00000106 4758c2ecf20Sopenharmony_ci#define HEVC_ENC_CMD_UPDATE_PTB 0x00000107 4768c2ecf20Sopenharmony_ci#define HEVC_ENC_CMD_FLUSH_TLB 0x00000108 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci/* mmPA_SC_RASTER_CONFIG mask */ 4798c2ecf20Sopenharmony_ci#define RB_MAP_PKR0(x) ((x) << 0) 4808c2ecf20Sopenharmony_ci#define RB_MAP_PKR0_MASK (0x3 << 0) 4818c2ecf20Sopenharmony_ci#define RB_MAP_PKR1(x) ((x) << 2) 4828c2ecf20Sopenharmony_ci#define RB_MAP_PKR1_MASK (0x3 << 2) 4838c2ecf20Sopenharmony_ci#define RB_XSEL2(x) ((x) << 4) 4848c2ecf20Sopenharmony_ci#define RB_XSEL2_MASK (0x3 << 4) 4858c2ecf20Sopenharmony_ci#define RB_XSEL (1 << 6) 4868c2ecf20Sopenharmony_ci#define RB_YSEL (1 << 7) 4878c2ecf20Sopenharmony_ci#define PKR_MAP(x) ((x) << 8) 4888c2ecf20Sopenharmony_ci#define PKR_MAP_MASK (0x3 << 8) 4898c2ecf20Sopenharmony_ci#define PKR_XSEL(x) ((x) << 10) 4908c2ecf20Sopenharmony_ci#define PKR_XSEL_MASK (0x3 << 10) 4918c2ecf20Sopenharmony_ci#define PKR_YSEL(x) ((x) << 12) 4928c2ecf20Sopenharmony_ci#define PKR_YSEL_MASK (0x3 << 12) 4938c2ecf20Sopenharmony_ci#define SC_MAP(x) ((x) << 16) 4948c2ecf20Sopenharmony_ci#define SC_MAP_MASK (0x3 << 16) 4958c2ecf20Sopenharmony_ci#define SC_XSEL(x) ((x) << 18) 4968c2ecf20Sopenharmony_ci#define SC_XSEL_MASK (0x3 << 18) 4978c2ecf20Sopenharmony_ci#define SC_YSEL(x) ((x) << 20) 4988c2ecf20Sopenharmony_ci#define SC_YSEL_MASK (0x3 << 20) 4998c2ecf20Sopenharmony_ci#define SE_MAP(x) ((x) << 24) 5008c2ecf20Sopenharmony_ci#define SE_MAP_MASK (0x3 << 24) 5018c2ecf20Sopenharmony_ci#define SE_XSEL(x) ((x) << 26) 5028c2ecf20Sopenharmony_ci#define SE_XSEL_MASK (0x3 << 26) 5038c2ecf20Sopenharmony_ci#define SE_YSEL(x) ((x) << 28) 5048c2ecf20Sopenharmony_ci#define SE_YSEL_MASK (0x3 << 28) 5058c2ecf20Sopenharmony_ci 5068c2ecf20Sopenharmony_ci/* mmPA_SC_RASTER_CONFIG_1 mask */ 5078c2ecf20Sopenharmony_ci#define SE_PAIR_MAP(x) ((x) << 0) 5088c2ecf20Sopenharmony_ci#define SE_PAIR_MAP_MASK (0x3 << 0) 5098c2ecf20Sopenharmony_ci#define SE_PAIR_XSEL(x) ((x) << 2) 5108c2ecf20Sopenharmony_ci#define SE_PAIR_XSEL_MASK (0x3 << 2) 5118c2ecf20Sopenharmony_ci#define SE_PAIR_YSEL(x) ((x) << 4) 5128c2ecf20Sopenharmony_ci#define SE_PAIR_YSEL_MASK (0x3 << 4) 5138c2ecf20Sopenharmony_ci 5148c2ecf20Sopenharmony_ci#endif 515