157e252bfSMichael Neumann /* 257e252bfSMichael Neumann * Copyright 2012 Advanced Micro Devices, Inc. 357e252bfSMichael Neumann * 457e252bfSMichael Neumann * Permission is hereby granted, free of charge, to any person obtaining a 557e252bfSMichael Neumann * copy of this software and associated documentation files (the "Software"), 657e252bfSMichael Neumann * to deal in the Software without restriction, including without limitation 757e252bfSMichael Neumann * the rights to use, copy, modify, merge, publish, distribute, sublicense, 857e252bfSMichael Neumann * and/or sell copies of the Software, and to permit persons to whom the 957e252bfSMichael Neumann * Software is furnished to do so, subject to the following conditions: 1057e252bfSMichael Neumann * 1157e252bfSMichael Neumann * The above copyright notice and this permission notice shall be included in 1257e252bfSMichael Neumann * all copies or substantial portions of the Software. 1357e252bfSMichael Neumann * 1457e252bfSMichael Neumann * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1557e252bfSMichael Neumann * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1657e252bfSMichael Neumann * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1757e252bfSMichael Neumann * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 1857e252bfSMichael Neumann * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1957e252bfSMichael Neumann * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2057e252bfSMichael Neumann * OTHER DEALINGS IN THE SOFTWARE. 2157e252bfSMichael Neumann * 2257e252bfSMichael Neumann * Authors: Alex Deucher 2357e252bfSMichael Neumann */ 2457e252bfSMichael Neumann #ifndef __CIK_REG_H__ 2557e252bfSMichael Neumann #define __CIK_REG_H__ 2657e252bfSMichael Neumann 274cd92098Szrj #define CIK_DIDT_IND_INDEX 0xca00 284cd92098Szrj #define CIK_DIDT_IND_DATA 0xca04 294cd92098Szrj 3057e252bfSMichael Neumann #define CIK_DC_GPIO_HPD_MASK 0x65b0 3157e252bfSMichael Neumann #define CIK_DC_GPIO_HPD_A 0x65b4 3257e252bfSMichael Neumann #define CIK_DC_GPIO_HPD_EN 0x65b8 3357e252bfSMichael Neumann #define CIK_DC_GPIO_HPD_Y 0x65bc 3457e252bfSMichael Neumann 3557e252bfSMichael Neumann #define CIK_GRPH_CONTROL 0x6804 3657e252bfSMichael Neumann # define CIK_GRPH_DEPTH(x) (((x) & 0x3) << 0) 3757e252bfSMichael Neumann # define CIK_GRPH_DEPTH_8BPP 0 3857e252bfSMichael Neumann # define CIK_GRPH_DEPTH_16BPP 1 3957e252bfSMichael Neumann # define CIK_GRPH_DEPTH_32BPP 2 4057e252bfSMichael Neumann # define CIK_GRPH_NUM_BANKS(x) (((x) & 0x3) << 2) 4157e252bfSMichael Neumann # define CIK_ADDR_SURF_2_BANK 0 4257e252bfSMichael Neumann # define CIK_ADDR_SURF_4_BANK 1 4357e252bfSMichael Neumann # define CIK_ADDR_SURF_8_BANK 2 4457e252bfSMichael Neumann # define CIK_ADDR_SURF_16_BANK 3 4557e252bfSMichael Neumann # define CIK_GRPH_Z(x) (((x) & 0x3) << 4) 4657e252bfSMichael Neumann # define CIK_GRPH_BANK_WIDTH(x) (((x) & 0x3) << 6) 4757e252bfSMichael Neumann # define CIK_ADDR_SURF_BANK_WIDTH_1 0 4857e252bfSMichael Neumann # define CIK_ADDR_SURF_BANK_WIDTH_2 1 4957e252bfSMichael Neumann # define CIK_ADDR_SURF_BANK_WIDTH_4 2 5057e252bfSMichael Neumann # define CIK_ADDR_SURF_BANK_WIDTH_8 3 5157e252bfSMichael Neumann # define CIK_GRPH_FORMAT(x) (((x) & 0x7) << 8) 5257e252bfSMichael Neumann /* 8 BPP */ 5357e252bfSMichael Neumann # define CIK_GRPH_FORMAT_INDEXED 0 5457e252bfSMichael Neumann /* 16 BPP */ 5557e252bfSMichael Neumann # define CIK_GRPH_FORMAT_ARGB1555 0 5657e252bfSMichael Neumann # define CIK_GRPH_FORMAT_ARGB565 1 5757e252bfSMichael Neumann # define CIK_GRPH_FORMAT_ARGB4444 2 5857e252bfSMichael Neumann # define CIK_GRPH_FORMAT_AI88 3 5957e252bfSMichael Neumann # define CIK_GRPH_FORMAT_MONO16 4 6057e252bfSMichael Neumann # define CIK_GRPH_FORMAT_BGRA5551 5 6157e252bfSMichael Neumann /* 32 BPP */ 6257e252bfSMichael Neumann # define CIK_GRPH_FORMAT_ARGB8888 0 6357e252bfSMichael Neumann # define CIK_GRPH_FORMAT_ARGB2101010 1 6457e252bfSMichael Neumann # define CIK_GRPH_FORMAT_32BPP_DIG 2 6557e252bfSMichael Neumann # define CIK_GRPH_FORMAT_8B_ARGB2101010 3 6657e252bfSMichael Neumann # define CIK_GRPH_FORMAT_BGRA1010102 4 6757e252bfSMichael Neumann # define CIK_GRPH_FORMAT_8B_BGRA1010102 5 6857e252bfSMichael Neumann # define CIK_GRPH_FORMAT_RGB111110 6 6957e252bfSMichael Neumann # define CIK_GRPH_FORMAT_BGR101111 7 7057e252bfSMichael Neumann # define CIK_GRPH_BANK_HEIGHT(x) (((x) & 0x3) << 11) 7157e252bfSMichael Neumann # define CIK_ADDR_SURF_BANK_HEIGHT_1 0 7257e252bfSMichael Neumann # define CIK_ADDR_SURF_BANK_HEIGHT_2 1 7357e252bfSMichael Neumann # define CIK_ADDR_SURF_BANK_HEIGHT_4 2 7457e252bfSMichael Neumann # define CIK_ADDR_SURF_BANK_HEIGHT_8 3 7557e252bfSMichael Neumann # define CIK_GRPH_TILE_SPLIT(x) (((x) & 0x7) << 13) 7657e252bfSMichael Neumann # define CIK_ADDR_SURF_TILE_SPLIT_64B 0 7757e252bfSMichael Neumann # define CIK_ADDR_SURF_TILE_SPLIT_128B 1 7857e252bfSMichael Neumann # define CIK_ADDR_SURF_TILE_SPLIT_256B 2 7957e252bfSMichael Neumann # define CIK_ADDR_SURF_TILE_SPLIT_512B 3 8057e252bfSMichael Neumann # define CIK_ADDR_SURF_TILE_SPLIT_1KB 4 8157e252bfSMichael Neumann # define CIK_ADDR_SURF_TILE_SPLIT_2KB 5 8257e252bfSMichael Neumann # define CIK_ADDR_SURF_TILE_SPLIT_4KB 6 8357e252bfSMichael Neumann # define CIK_GRPH_MACRO_TILE_ASPECT(x) (((x) & 0x3) << 18) 8457e252bfSMichael Neumann # define CIK_ADDR_SURF_MACRO_TILE_ASPECT_1 0 8557e252bfSMichael Neumann # define CIK_ADDR_SURF_MACRO_TILE_ASPECT_2 1 8657e252bfSMichael Neumann # define CIK_ADDR_SURF_MACRO_TILE_ASPECT_4 2 8757e252bfSMichael Neumann # define CIK_ADDR_SURF_MACRO_TILE_ASPECT_8 3 8857e252bfSMichael Neumann # define CIK_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20) 8957e252bfSMichael Neumann # define CIK_GRPH_ARRAY_LINEAR_GENERAL 0 9057e252bfSMichael Neumann # define CIK_GRPH_ARRAY_LINEAR_ALIGNED 1 9157e252bfSMichael Neumann # define CIK_GRPH_ARRAY_1D_TILED_THIN1 2 9257e252bfSMichael Neumann # define CIK_GRPH_ARRAY_2D_TILED_THIN1 4 9357e252bfSMichael Neumann # define CIK_GRPH_PIPE_CONFIG(x) (((x) & 0x1f) << 24) 9457e252bfSMichael Neumann # define CIK_ADDR_SURF_P2 0 9557e252bfSMichael Neumann # define CIK_ADDR_SURF_P4_8x16 4 9657e252bfSMichael Neumann # define CIK_ADDR_SURF_P4_16x16 5 9757e252bfSMichael Neumann # define CIK_ADDR_SURF_P4_16x32 6 9857e252bfSMichael Neumann # define CIK_ADDR_SURF_P4_32x32 7 9957e252bfSMichael Neumann # define CIK_ADDR_SURF_P8_16x16_8x16 8 10057e252bfSMichael Neumann # define CIK_ADDR_SURF_P8_16x32_8x16 9 10157e252bfSMichael Neumann # define CIK_ADDR_SURF_P8_32x32_8x16 10 10257e252bfSMichael Neumann # define CIK_ADDR_SURF_P8_16x32_16x16 11 10357e252bfSMichael Neumann # define CIK_ADDR_SURF_P8_32x32_16x16 12 10457e252bfSMichael Neumann # define CIK_ADDR_SURF_P8_32x32_16x32 13 10557e252bfSMichael Neumann # define CIK_ADDR_SURF_P8_32x64_32x32 14 10657e252bfSMichael Neumann # define CIK_GRPH_MICRO_TILE_MODE(x) (((x) & 0x7) << 29) 10757e252bfSMichael Neumann # define CIK_DISPLAY_MICRO_TILING 0 10857e252bfSMichael Neumann # define CIK_THIN_MICRO_TILING 1 10957e252bfSMichael Neumann # define CIK_DEPTH_MICRO_TILING 2 11057e252bfSMichael Neumann # define CIK_ROTATED_MICRO_TILING 4 11157e252bfSMichael Neumann 11257e252bfSMichael Neumann /* CUR blocks at 0x6998, 0x7598, 0x10198, 0x10d98, 0x11998, 0x12598 */ 11357e252bfSMichael Neumann #define CIK_CUR_CONTROL 0x6998 11457e252bfSMichael Neumann # define CIK_CURSOR_EN (1 << 0) 11557e252bfSMichael Neumann # define CIK_CURSOR_MODE(x) (((x) & 0x3) << 8) 11657e252bfSMichael Neumann # define CIK_CURSOR_MONO 0 11757e252bfSMichael Neumann # define CIK_CURSOR_24_1 1 11857e252bfSMichael Neumann # define CIK_CURSOR_24_8_PRE_MULT 2 11957e252bfSMichael Neumann # define CIK_CURSOR_24_8_UNPRE_MULT 3 12057e252bfSMichael Neumann # define CIK_CURSOR_2X_MAGNIFY (1 << 16) 12157e252bfSMichael Neumann # define CIK_CURSOR_FORCE_MC_ON (1 << 20) 12257e252bfSMichael Neumann # define CIK_CURSOR_URGENT_CONTROL(x) (((x) & 0x7) << 24) 12357e252bfSMichael Neumann # define CIK_CURSOR_URGENT_ALWAYS 0 12457e252bfSMichael Neumann # define CIK_CURSOR_URGENT_1_8 1 12557e252bfSMichael Neumann # define CIK_CURSOR_URGENT_1_4 2 12657e252bfSMichael Neumann # define CIK_CURSOR_URGENT_3_8 3 12757e252bfSMichael Neumann # define CIK_CURSOR_URGENT_1_2 4 12857e252bfSMichael Neumann #define CIK_CUR_SURFACE_ADDRESS 0x699c 12957e252bfSMichael Neumann # define CIK_CUR_SURFACE_ADDRESS_MASK 0xfffff000 13057e252bfSMichael Neumann #define CIK_CUR_SIZE 0x69a0 13157e252bfSMichael Neumann #define CIK_CUR_SURFACE_ADDRESS_HIGH 0x69a4 13257e252bfSMichael Neumann #define CIK_CUR_POSITION 0x69a8 13357e252bfSMichael Neumann #define CIK_CUR_HOT_SPOT 0x69ac 13457e252bfSMichael Neumann #define CIK_CUR_COLOR1 0x69b0 13557e252bfSMichael Neumann #define CIK_CUR_COLOR2 0x69b4 13657e252bfSMichael Neumann #define CIK_CUR_UPDATE 0x69b8 13757e252bfSMichael Neumann # define CIK_CURSOR_UPDATE_PENDING (1 << 0) 13857e252bfSMichael Neumann # define CIK_CURSOR_UPDATE_TAKEN (1 << 1) 13957e252bfSMichael Neumann # define CIK_CURSOR_UPDATE_LOCK (1 << 16) 14057e252bfSMichael Neumann # define CIK_CURSOR_DISABLE_MULTIPLE_UPDATE (1 << 24) 14157e252bfSMichael Neumann 14257e252bfSMichael Neumann #define CIK_ALPHA_CONTROL 0x6af0 14357e252bfSMichael Neumann # define CIK_CURSOR_ALPHA_BLND_ENA (1 << 1) 14457e252bfSMichael Neumann 14557e252bfSMichael Neumann #define CIK_LB_DATA_FORMAT 0x6b00 14657e252bfSMichael Neumann # define CIK_INTERLEAVE_EN (1 << 3) 14757e252bfSMichael Neumann 14857e252bfSMichael Neumann #define CIK_LB_DESKTOP_HEIGHT 0x6b0c 14957e252bfSMichael Neumann 150*c59a5c48SFrançois Tigeot #define KFD_CIK_SDMA_QUEUE_OFFSET 0x200 151*c59a5c48SFrançois Tigeot 152*c59a5c48SFrançois Tigeot #define SQ_IND_INDEX 0x8DE0 153*c59a5c48SFrançois Tigeot #define SQ_CMD 0x8DEC 154*c59a5c48SFrançois Tigeot #define SQ_IND_DATA 0x8DE4 155*c59a5c48SFrançois Tigeot 156*c59a5c48SFrançois Tigeot /* 157*c59a5c48SFrançois Tigeot * The TCP_WATCHx_xxxx addresses that are shown here are in dwords, 158*c59a5c48SFrançois Tigeot * and that's why they are multiplied by 4 159*c59a5c48SFrançois Tigeot */ 160*c59a5c48SFrançois Tigeot #define TCP_WATCH0_ADDR_H (0x32A0*4) 161*c59a5c48SFrançois Tigeot #define TCP_WATCH1_ADDR_H (0x32A3*4) 162*c59a5c48SFrançois Tigeot #define TCP_WATCH2_ADDR_H (0x32A6*4) 163*c59a5c48SFrançois Tigeot #define TCP_WATCH3_ADDR_H (0x32A9*4) 164*c59a5c48SFrançois Tigeot #define TCP_WATCH0_ADDR_L (0x32A1*4) 165*c59a5c48SFrançois Tigeot #define TCP_WATCH1_ADDR_L (0x32A4*4) 166*c59a5c48SFrançois Tigeot #define TCP_WATCH2_ADDR_L (0x32A7*4) 167*c59a5c48SFrançois Tigeot #define TCP_WATCH3_ADDR_L (0x32AA*4) 168*c59a5c48SFrançois Tigeot #define TCP_WATCH0_CNTL (0x32A2*4) 169*c59a5c48SFrançois Tigeot #define TCP_WATCH1_CNTL (0x32A5*4) 170*c59a5c48SFrançois Tigeot #define TCP_WATCH2_CNTL (0x32A8*4) 171*c59a5c48SFrançois Tigeot #define TCP_WATCH3_CNTL (0x32AB*4) 172*c59a5c48SFrançois Tigeot 173*c59a5c48SFrançois Tigeot #define CPC_INT_CNTL 0xC2D0 174*c59a5c48SFrançois Tigeot 1757dcf36dcSFrançois Tigeot #define CP_HQD_IQ_RPTR 0xC970u 176*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_RB_CNTL 0xD400u 177*c59a5c48SFrançois Tigeot #define SDMA_RB_VMID(x) (x << 24) 178*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_RB_BASE 0xD404u 179*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_RB_BASE_HI 0xD408u 180*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_RB_RPTR 0xD40Cu 181*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_RB_WPTR 0xD410u 182*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_RB_WPTR_POLL_CNTL 0xD414u 183*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_RB_WPTR_POLL_ADDR_HI 0xD418u 184*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_RB_WPTR_POLL_ADDR_LO 0xD41Cu 185*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_RB_RPTR_ADDR_HI 0xD420u 186*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_RB_RPTR_ADDR_LO 0xD424u 187*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_IB_CNTL 0xD428u 188*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_IB_RPTR 0xD42Cu 189*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_IB_OFFSET 0xD430u 190*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_IB_BASE_LO 0xD434u 191*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_IB_BASE_HI 0xD438u 192*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_IB_SIZE 0xD43Cu 193*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_SKIP_CNTL 0xD440u 194*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_CONTEXT_STATUS 0xD444u 195*c59a5c48SFrançois Tigeot #define SDMA_RLC_IDLE (1 << 2) 196*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_DOORBELL 0xD448u 197*c59a5c48SFrançois Tigeot #define SDMA_OFFSET(x) (x << 0) 198*c59a5c48SFrançois Tigeot #define SDMA_DB_ENABLE (1 << 28) 199*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_VIRTUAL_ADDR 0xD49Cu 200*c59a5c48SFrançois Tigeot #define SDMA_ATC (1 << 0) 201*c59a5c48SFrançois Tigeot #define SDMA_VA_PTR32 (1 << 4) 202*c59a5c48SFrançois Tigeot #define SDMA_VA_SHARED_BASE(x) (x << 8) 203*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_APE1_CNTL 0xD4A0u 204*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_DOORBELL_LOG 0xD4A4u 205*c59a5c48SFrançois Tigeot #define SDMA0_RLC0_WATERMARK 0xD4A8u 206*c59a5c48SFrançois Tigeot #define SDMA0_CNTL 0xD010 207*c59a5c48SFrançois Tigeot #define SDMA1_CNTL 0xD810 2087dcf36dcSFrançois Tigeot 209*c59a5c48SFrançois Tigeot enum { 210*c59a5c48SFrançois Tigeot MAX_TRAPID = 8, /* 3 bits in the bitfield. */ 211*c59a5c48SFrançois Tigeot MAX_WATCH_ADDRESSES = 4 212*c59a5c48SFrançois Tigeot }; 2137dcf36dcSFrançois Tigeot 214*c59a5c48SFrançois Tigeot enum { 215*c59a5c48SFrançois Tigeot ADDRESS_WATCH_REG_ADDR_HI = 0, 216*c59a5c48SFrançois Tigeot ADDRESS_WATCH_REG_ADDR_LO, 217*c59a5c48SFrançois Tigeot ADDRESS_WATCH_REG_CNTL, 218*c59a5c48SFrançois Tigeot ADDRESS_WATCH_REG_MAX 219*c59a5c48SFrançois Tigeot }; 220*c59a5c48SFrançois Tigeot 221*c59a5c48SFrançois Tigeot enum { /* not defined in the CI/KV reg file */ 222*c59a5c48SFrançois Tigeot ADDRESS_WATCH_REG_CNTL_ATC_BIT = 0x10000000UL, 223*c59a5c48SFrançois Tigeot ADDRESS_WATCH_REG_CNTL_DEFAULT_MASK = 0x00FFFFFF, 224*c59a5c48SFrançois Tigeot ADDRESS_WATCH_REG_ADDLOW_MASK_EXTENSION = 0x03000000, 225*c59a5c48SFrançois Tigeot /* extend the mask to 26 bits in order to match the low address field */ 226*c59a5c48SFrançois Tigeot ADDRESS_WATCH_REG_ADDLOW_SHIFT = 6, 227*c59a5c48SFrançois Tigeot ADDRESS_WATCH_REG_ADDHIGH_MASK = 0xFFFF 228*c59a5c48SFrançois Tigeot }; 229*c59a5c48SFrançois Tigeot 230*c59a5c48SFrançois Tigeot union TCP_WATCH_CNTL_BITS { 231*c59a5c48SFrançois Tigeot struct { 232*c59a5c48SFrançois Tigeot uint32_t mask:24; 233*c59a5c48SFrançois Tigeot uint32_t vmid:4; 234*c59a5c48SFrançois Tigeot uint32_t atc:1; 235*c59a5c48SFrançois Tigeot uint32_t mode:2; 236*c59a5c48SFrançois Tigeot uint32_t valid:1; 237*c59a5c48SFrançois Tigeot } bitfields, bits; 238*c59a5c48SFrançois Tigeot uint32_t u32All; 239*c59a5c48SFrançois Tigeot signed int i32All; 240*c59a5c48SFrançois Tigeot float f32All; 2417dcf36dcSFrançois Tigeot }; 2427dcf36dcSFrançois Tigeot 24357e252bfSMichael Neumann #endif 244