18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2012 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 * Authors: Alex Deucher 238c2ecf20Sopenharmony_ci */ 248c2ecf20Sopenharmony_ci#ifndef __CIK_REG_H__ 258c2ecf20Sopenharmony_ci#define __CIK_REG_H__ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define CIK_DIDT_IND_INDEX 0xca00 288c2ecf20Sopenharmony_ci#define CIK_DIDT_IND_DATA 0xca04 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define CIK_DC_GPIO_HPD_MASK 0x65b0 318c2ecf20Sopenharmony_ci#define CIK_DC_GPIO_HPD_A 0x65b4 328c2ecf20Sopenharmony_ci#define CIK_DC_GPIO_HPD_EN 0x65b8 338c2ecf20Sopenharmony_ci#define CIK_DC_GPIO_HPD_Y 0x65bc 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define CIK_GRPH_CONTROL 0x6804 368c2ecf20Sopenharmony_ci# define CIK_GRPH_DEPTH(x) (((x) & 0x3) << 0) 378c2ecf20Sopenharmony_ci# define CIK_GRPH_DEPTH_8BPP 0 388c2ecf20Sopenharmony_ci# define CIK_GRPH_DEPTH_16BPP 1 398c2ecf20Sopenharmony_ci# define CIK_GRPH_DEPTH_32BPP 2 408c2ecf20Sopenharmony_ci# define CIK_GRPH_NUM_BANKS(x) (((x) & 0x3) << 2) 418c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_2_BANK 0 428c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_4_BANK 1 438c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_8_BANK 2 448c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_16_BANK 3 458c2ecf20Sopenharmony_ci# define CIK_GRPH_Z(x) (((x) & 0x3) << 4) 468c2ecf20Sopenharmony_ci# define CIK_GRPH_BANK_WIDTH(x) (((x) & 0x3) << 6) 478c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_BANK_WIDTH_1 0 488c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_BANK_WIDTH_2 1 498c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_BANK_WIDTH_4 2 508c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_BANK_WIDTH_8 3 518c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT(x) (((x) & 0x7) << 8) 528c2ecf20Sopenharmony_ci/* 8 BPP */ 538c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_INDEXED 0 548c2ecf20Sopenharmony_ci/* 16 BPP */ 558c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_ARGB1555 0 568c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_ARGB565 1 578c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_ARGB4444 2 588c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_AI88 3 598c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_MONO16 4 608c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_BGRA5551 5 618c2ecf20Sopenharmony_ci/* 32 BPP */ 628c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_ARGB8888 0 638c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_ARGB2101010 1 648c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_32BPP_DIG 2 658c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_8B_ARGB2101010 3 668c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_BGRA1010102 4 678c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_8B_BGRA1010102 5 688c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_RGB111110 6 698c2ecf20Sopenharmony_ci# define CIK_GRPH_FORMAT_BGR101111 7 708c2ecf20Sopenharmony_ci# define CIK_GRPH_BANK_HEIGHT(x) (((x) & 0x3) << 11) 718c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_BANK_HEIGHT_1 0 728c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_BANK_HEIGHT_2 1 738c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_BANK_HEIGHT_4 2 748c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_BANK_HEIGHT_8 3 758c2ecf20Sopenharmony_ci# define CIK_GRPH_TILE_SPLIT(x) (((x) & 0x7) << 13) 768c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_TILE_SPLIT_64B 0 778c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_TILE_SPLIT_128B 1 788c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_TILE_SPLIT_256B 2 798c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_TILE_SPLIT_512B 3 808c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_TILE_SPLIT_1KB 4 818c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_TILE_SPLIT_2KB 5 828c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_TILE_SPLIT_4KB 6 838c2ecf20Sopenharmony_ci# define CIK_GRPH_MACRO_TILE_ASPECT(x) (((x) & 0x3) << 18) 848c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_MACRO_TILE_ASPECT_1 0 858c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_MACRO_TILE_ASPECT_2 1 868c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_MACRO_TILE_ASPECT_4 2 878c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_MACRO_TILE_ASPECT_8 3 888c2ecf20Sopenharmony_ci# define CIK_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20) 898c2ecf20Sopenharmony_ci# define CIK_GRPH_ARRAY_LINEAR_GENERAL 0 908c2ecf20Sopenharmony_ci# define CIK_GRPH_ARRAY_LINEAR_ALIGNED 1 918c2ecf20Sopenharmony_ci# define CIK_GRPH_ARRAY_1D_TILED_THIN1 2 928c2ecf20Sopenharmony_ci# define CIK_GRPH_ARRAY_2D_TILED_THIN1 4 938c2ecf20Sopenharmony_ci# define CIK_GRPH_PIPE_CONFIG(x) (((x) & 0x1f) << 24) 948c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_P2 0 958c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_P4_8x16 4 968c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_P4_16x16 5 978c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_P4_16x32 6 988c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_P4_32x32 7 998c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_P8_16x16_8x16 8 1008c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_P8_16x32_8x16 9 1018c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_P8_32x32_8x16 10 1028c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_P8_16x32_16x16 11 1038c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_P8_32x32_16x16 12 1048c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_P8_32x32_16x32 13 1058c2ecf20Sopenharmony_ci# define CIK_ADDR_SURF_P8_32x64_32x32 14 1068c2ecf20Sopenharmony_ci# define CIK_GRPH_MICRO_TILE_MODE(x) (((x) & 0x7) << 29) 1078c2ecf20Sopenharmony_ci# define CIK_DISPLAY_MICRO_TILING 0 1088c2ecf20Sopenharmony_ci# define CIK_THIN_MICRO_TILING 1 1098c2ecf20Sopenharmony_ci# define CIK_DEPTH_MICRO_TILING 2 1108c2ecf20Sopenharmony_ci# define CIK_ROTATED_MICRO_TILING 4 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci/* CUR blocks at 0x6998, 0x7598, 0x10198, 0x10d98, 0x11998, 0x12598 */ 1138c2ecf20Sopenharmony_ci#define CIK_CUR_CONTROL 0x6998 1148c2ecf20Sopenharmony_ci# define CIK_CURSOR_EN (1 << 0) 1158c2ecf20Sopenharmony_ci# define CIK_CURSOR_MODE(x) (((x) & 0x3) << 8) 1168c2ecf20Sopenharmony_ci# define CIK_CURSOR_MONO 0 1178c2ecf20Sopenharmony_ci# define CIK_CURSOR_24_1 1 1188c2ecf20Sopenharmony_ci# define CIK_CURSOR_24_8_PRE_MULT 2 1198c2ecf20Sopenharmony_ci# define CIK_CURSOR_24_8_UNPRE_MULT 3 1208c2ecf20Sopenharmony_ci# define CIK_CURSOR_2X_MAGNIFY (1 << 16) 1218c2ecf20Sopenharmony_ci# define CIK_CURSOR_FORCE_MC_ON (1 << 20) 1228c2ecf20Sopenharmony_ci# define CIK_CURSOR_URGENT_CONTROL(x) (((x) & 0x7) << 24) 1238c2ecf20Sopenharmony_ci# define CIK_CURSOR_URGENT_ALWAYS 0 1248c2ecf20Sopenharmony_ci# define CIK_CURSOR_URGENT_1_8 1 1258c2ecf20Sopenharmony_ci# define CIK_CURSOR_URGENT_1_4 2 1268c2ecf20Sopenharmony_ci# define CIK_CURSOR_URGENT_3_8 3 1278c2ecf20Sopenharmony_ci# define CIK_CURSOR_URGENT_1_2 4 1288c2ecf20Sopenharmony_ci#define CIK_CUR_SURFACE_ADDRESS 0x699c 1298c2ecf20Sopenharmony_ci# define CIK_CUR_SURFACE_ADDRESS_MASK 0xfffff000 1308c2ecf20Sopenharmony_ci#define CIK_CUR_SIZE 0x69a0 1318c2ecf20Sopenharmony_ci#define CIK_CUR_SURFACE_ADDRESS_HIGH 0x69a4 1328c2ecf20Sopenharmony_ci#define CIK_CUR_POSITION 0x69a8 1338c2ecf20Sopenharmony_ci#define CIK_CUR_HOT_SPOT 0x69ac 1348c2ecf20Sopenharmony_ci#define CIK_CUR_COLOR1 0x69b0 1358c2ecf20Sopenharmony_ci#define CIK_CUR_COLOR2 0x69b4 1368c2ecf20Sopenharmony_ci#define CIK_CUR_UPDATE 0x69b8 1378c2ecf20Sopenharmony_ci# define CIK_CURSOR_UPDATE_PENDING (1 << 0) 1388c2ecf20Sopenharmony_ci# define CIK_CURSOR_UPDATE_TAKEN (1 << 1) 1398c2ecf20Sopenharmony_ci# define CIK_CURSOR_UPDATE_LOCK (1 << 16) 1408c2ecf20Sopenharmony_ci# define CIK_CURSOR_DISABLE_MULTIPLE_UPDATE (1 << 24) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define CIK_ALPHA_CONTROL 0x6af0 1438c2ecf20Sopenharmony_ci# define CIK_CURSOR_ALPHA_BLND_ENA (1 << 1) 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci#define CIK_LB_DATA_FORMAT 0x6b00 1468c2ecf20Sopenharmony_ci# define CIK_INTERLEAVE_EN (1 << 3) 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci#define CIK_LB_DESKTOP_HEIGHT 0x6b0c 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define SQ_IND_INDEX 0x8DE0 1518c2ecf20Sopenharmony_ci#define SQ_CMD 0x8DEC 1528c2ecf20Sopenharmony_ci#define SQ_IND_DATA 0x8DE4 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci/* 1558c2ecf20Sopenharmony_ci * The TCP_WATCHx_xxxx addresses that are shown here are in dwords, 1568c2ecf20Sopenharmony_ci * and that's why they are multiplied by 4 1578c2ecf20Sopenharmony_ci */ 1588c2ecf20Sopenharmony_ci#define TCP_WATCH0_ADDR_H (0x32A0*4) 1598c2ecf20Sopenharmony_ci#define TCP_WATCH1_ADDR_H (0x32A3*4) 1608c2ecf20Sopenharmony_ci#define TCP_WATCH2_ADDR_H (0x32A6*4) 1618c2ecf20Sopenharmony_ci#define TCP_WATCH3_ADDR_H (0x32A9*4) 1628c2ecf20Sopenharmony_ci#define TCP_WATCH0_ADDR_L (0x32A1*4) 1638c2ecf20Sopenharmony_ci#define TCP_WATCH1_ADDR_L (0x32A4*4) 1648c2ecf20Sopenharmony_ci#define TCP_WATCH2_ADDR_L (0x32A7*4) 1658c2ecf20Sopenharmony_ci#define TCP_WATCH3_ADDR_L (0x32AA*4) 1668c2ecf20Sopenharmony_ci#define TCP_WATCH0_CNTL (0x32A2*4) 1678c2ecf20Sopenharmony_ci#define TCP_WATCH1_CNTL (0x32A5*4) 1688c2ecf20Sopenharmony_ci#define TCP_WATCH2_CNTL (0x32A8*4) 1698c2ecf20Sopenharmony_ci#define TCP_WATCH3_CNTL (0x32AB*4) 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci#define CPC_INT_CNTL 0xC2D0 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci#define CP_HQD_IQ_RPTR 0xC970u 1748c2ecf20Sopenharmony_ci#define SDMA0_RLC0_RB_CNTL 0xD400u 1758c2ecf20Sopenharmony_ci#define SDMA_RB_VMID(x) (x << 24) 1768c2ecf20Sopenharmony_ci#define SDMA0_RLC0_RB_BASE 0xD404u 1778c2ecf20Sopenharmony_ci#define SDMA0_RLC0_RB_BASE_HI 0xD408u 1788c2ecf20Sopenharmony_ci#define SDMA0_RLC0_RB_RPTR 0xD40Cu 1798c2ecf20Sopenharmony_ci#define SDMA0_RLC0_RB_WPTR 0xD410u 1808c2ecf20Sopenharmony_ci#define SDMA0_RLC0_RB_WPTR_POLL_CNTL 0xD414u 1818c2ecf20Sopenharmony_ci#define SDMA0_RLC0_RB_WPTR_POLL_ADDR_HI 0xD418u 1828c2ecf20Sopenharmony_ci#define SDMA0_RLC0_RB_WPTR_POLL_ADDR_LO 0xD41Cu 1838c2ecf20Sopenharmony_ci#define SDMA0_RLC0_RB_RPTR_ADDR_HI 0xD420u 1848c2ecf20Sopenharmony_ci#define SDMA0_RLC0_RB_RPTR_ADDR_LO 0xD424u 1858c2ecf20Sopenharmony_ci#define SDMA0_RLC0_IB_CNTL 0xD428u 1868c2ecf20Sopenharmony_ci#define SDMA0_RLC0_IB_RPTR 0xD42Cu 1878c2ecf20Sopenharmony_ci#define SDMA0_RLC0_IB_OFFSET 0xD430u 1888c2ecf20Sopenharmony_ci#define SDMA0_RLC0_IB_BASE_LO 0xD434u 1898c2ecf20Sopenharmony_ci#define SDMA0_RLC0_IB_BASE_HI 0xD438u 1908c2ecf20Sopenharmony_ci#define SDMA0_RLC0_IB_SIZE 0xD43Cu 1918c2ecf20Sopenharmony_ci#define SDMA0_RLC0_SKIP_CNTL 0xD440u 1928c2ecf20Sopenharmony_ci#define SDMA0_RLC0_CONTEXT_STATUS 0xD444u 1938c2ecf20Sopenharmony_ci#define SDMA_RLC_IDLE (1 << 2) 1948c2ecf20Sopenharmony_ci#define SDMA0_RLC0_DOORBELL 0xD448u 1958c2ecf20Sopenharmony_ci#define SDMA_OFFSET(x) (x << 0) 1968c2ecf20Sopenharmony_ci#define SDMA_DB_ENABLE (1 << 28) 1978c2ecf20Sopenharmony_ci#define SDMA0_RLC0_VIRTUAL_ADDR 0xD49Cu 1988c2ecf20Sopenharmony_ci#define SDMA_ATC (1 << 0) 1998c2ecf20Sopenharmony_ci#define SDMA_VA_PTR32 (1 << 4) 2008c2ecf20Sopenharmony_ci#define SDMA_VA_SHARED_BASE(x) (x << 8) 2018c2ecf20Sopenharmony_ci#define SDMA0_RLC0_APE1_CNTL 0xD4A0u 2028c2ecf20Sopenharmony_ci#define SDMA0_RLC0_DOORBELL_LOG 0xD4A4u 2038c2ecf20Sopenharmony_ci#define SDMA0_RLC0_WATERMARK 0xD4A8u 2048c2ecf20Sopenharmony_ci#define SDMA0_CNTL 0xD010 2058c2ecf20Sopenharmony_ci#define SDMA1_CNTL 0xD810 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_cienum { 2088c2ecf20Sopenharmony_ci MAX_TRAPID = 8, /* 3 bits in the bitfield. */ 2098c2ecf20Sopenharmony_ci MAX_WATCH_ADDRESSES = 4 2108c2ecf20Sopenharmony_ci}; 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_cienum { 2138c2ecf20Sopenharmony_ci ADDRESS_WATCH_REG_ADDR_HI = 0, 2148c2ecf20Sopenharmony_ci ADDRESS_WATCH_REG_ADDR_LO, 2158c2ecf20Sopenharmony_ci ADDRESS_WATCH_REG_CNTL, 2168c2ecf20Sopenharmony_ci ADDRESS_WATCH_REG_MAX 2178c2ecf20Sopenharmony_ci}; 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_cienum { /* not defined in the CI/KV reg file */ 2208c2ecf20Sopenharmony_ci ADDRESS_WATCH_REG_CNTL_ATC_BIT = 0x10000000UL, 2218c2ecf20Sopenharmony_ci ADDRESS_WATCH_REG_CNTL_DEFAULT_MASK = 0x00FFFFFF, 2228c2ecf20Sopenharmony_ci ADDRESS_WATCH_REG_ADDLOW_MASK_EXTENSION = 0x03000000, 2238c2ecf20Sopenharmony_ci /* extend the mask to 26 bits in order to match the low address field */ 2248c2ecf20Sopenharmony_ci ADDRESS_WATCH_REG_ADDLOW_SHIFT = 6, 2258c2ecf20Sopenharmony_ci ADDRESS_WATCH_REG_ADDHIGH_MASK = 0xFFFF 2268c2ecf20Sopenharmony_ci}; 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ciunion TCP_WATCH_CNTL_BITS { 2298c2ecf20Sopenharmony_ci struct { 2308c2ecf20Sopenharmony_ci uint32_t mask:24; 2318c2ecf20Sopenharmony_ci uint32_t vmid:4; 2328c2ecf20Sopenharmony_ci uint32_t atc:1; 2338c2ecf20Sopenharmony_ci uint32_t mode:2; 2348c2ecf20Sopenharmony_ci uint32_t valid:1; 2358c2ecf20Sopenharmony_ci } bitfields, bits; 2368c2ecf20Sopenharmony_ci uint32_t u32All; 2378c2ecf20Sopenharmony_ci signed int i32All; 2388c2ecf20Sopenharmony_ci float f32All; 2398c2ecf20Sopenharmony_ci}; 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ci#endif 242