162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright 2012 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 * Authors: Alex Deucher
2362306a36Sopenharmony_ci */
2462306a36Sopenharmony_ci#ifndef __CIK_REG_H__
2562306a36Sopenharmony_ci#define __CIK_REG_H__
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define CIK_DIDT_IND_INDEX                        0xca00
2862306a36Sopenharmony_ci#define CIK_DIDT_IND_DATA                         0xca04
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define CIK_DC_GPIO_HPD_MASK                      0x65b0
3162306a36Sopenharmony_ci#define CIK_DC_GPIO_HPD_A                         0x65b4
3262306a36Sopenharmony_ci#define CIK_DC_GPIO_HPD_EN                        0x65b8
3362306a36Sopenharmony_ci#define CIK_DC_GPIO_HPD_Y                         0x65bc
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#define CIK_GRPH_CONTROL                          0x6804
3662306a36Sopenharmony_ci#       define CIK_GRPH_DEPTH(x)                  (((x) & 0x3) << 0)
3762306a36Sopenharmony_ci#       define CIK_GRPH_DEPTH_8BPP                0
3862306a36Sopenharmony_ci#       define CIK_GRPH_DEPTH_16BPP               1
3962306a36Sopenharmony_ci#       define CIK_GRPH_DEPTH_32BPP               2
4062306a36Sopenharmony_ci#       define CIK_GRPH_NUM_BANKS(x)              (((x) & 0x3) << 2)
4162306a36Sopenharmony_ci#       define CIK_ADDR_SURF_2_BANK               0
4262306a36Sopenharmony_ci#       define CIK_ADDR_SURF_4_BANK               1
4362306a36Sopenharmony_ci#       define CIK_ADDR_SURF_8_BANK               2
4462306a36Sopenharmony_ci#       define CIK_ADDR_SURF_16_BANK              3
4562306a36Sopenharmony_ci#       define CIK_GRPH_Z(x)                      (((x) & 0x3) << 4)
4662306a36Sopenharmony_ci#       define CIK_GRPH_BANK_WIDTH(x)             (((x) & 0x3) << 6)
4762306a36Sopenharmony_ci#       define CIK_ADDR_SURF_BANK_WIDTH_1         0
4862306a36Sopenharmony_ci#       define CIK_ADDR_SURF_BANK_WIDTH_2         1
4962306a36Sopenharmony_ci#       define CIK_ADDR_SURF_BANK_WIDTH_4         2
5062306a36Sopenharmony_ci#       define CIK_ADDR_SURF_BANK_WIDTH_8         3
5162306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT(x)                 (((x) & 0x7) << 8)
5262306a36Sopenharmony_ci/* 8 BPP */
5362306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_INDEXED            0
5462306a36Sopenharmony_ci/* 16 BPP */
5562306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_ARGB1555           0
5662306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_ARGB565            1
5762306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_ARGB4444           2
5862306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_AI88               3
5962306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_MONO16             4
6062306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_BGRA5551           5
6162306a36Sopenharmony_ci/* 32 BPP */
6262306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_ARGB8888           0
6362306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_ARGB2101010        1
6462306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_32BPP_DIG          2
6562306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_8B_ARGB2101010     3
6662306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_BGRA1010102        4
6762306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_8B_BGRA1010102     5
6862306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_RGB111110          6
6962306a36Sopenharmony_ci#       define CIK_GRPH_FORMAT_BGR101111          7
7062306a36Sopenharmony_ci#       define CIK_GRPH_BANK_HEIGHT(x)            (((x) & 0x3) << 11)
7162306a36Sopenharmony_ci#       define CIK_ADDR_SURF_BANK_HEIGHT_1        0
7262306a36Sopenharmony_ci#       define CIK_ADDR_SURF_BANK_HEIGHT_2        1
7362306a36Sopenharmony_ci#       define CIK_ADDR_SURF_BANK_HEIGHT_4        2
7462306a36Sopenharmony_ci#       define CIK_ADDR_SURF_BANK_HEIGHT_8        3
7562306a36Sopenharmony_ci#       define CIK_GRPH_TILE_SPLIT(x)             (((x) & 0x7) << 13)
7662306a36Sopenharmony_ci#       define CIK_ADDR_SURF_TILE_SPLIT_64B       0
7762306a36Sopenharmony_ci#       define CIK_ADDR_SURF_TILE_SPLIT_128B      1
7862306a36Sopenharmony_ci#       define CIK_ADDR_SURF_TILE_SPLIT_256B      2
7962306a36Sopenharmony_ci#       define CIK_ADDR_SURF_TILE_SPLIT_512B      3
8062306a36Sopenharmony_ci#       define CIK_ADDR_SURF_TILE_SPLIT_1KB       4
8162306a36Sopenharmony_ci#       define CIK_ADDR_SURF_TILE_SPLIT_2KB       5
8262306a36Sopenharmony_ci#       define CIK_ADDR_SURF_TILE_SPLIT_4KB       6
8362306a36Sopenharmony_ci#       define CIK_GRPH_MACRO_TILE_ASPECT(x)      (((x) & 0x3) << 18)
8462306a36Sopenharmony_ci#       define CIK_ADDR_SURF_MACRO_TILE_ASPECT_1  0
8562306a36Sopenharmony_ci#       define CIK_ADDR_SURF_MACRO_TILE_ASPECT_2  1
8662306a36Sopenharmony_ci#       define CIK_ADDR_SURF_MACRO_TILE_ASPECT_4  2
8762306a36Sopenharmony_ci#       define CIK_ADDR_SURF_MACRO_TILE_ASPECT_8  3
8862306a36Sopenharmony_ci#       define CIK_GRPH_ARRAY_MODE(x)             (((x) & 0x7) << 20)
8962306a36Sopenharmony_ci#       define CIK_GRPH_ARRAY_LINEAR_GENERAL      0
9062306a36Sopenharmony_ci#       define CIK_GRPH_ARRAY_LINEAR_ALIGNED      1
9162306a36Sopenharmony_ci#       define CIK_GRPH_ARRAY_1D_TILED_THIN1      2
9262306a36Sopenharmony_ci#       define CIK_GRPH_ARRAY_2D_TILED_THIN1      4
9362306a36Sopenharmony_ci#       define CIK_GRPH_PIPE_CONFIG(x)		 (((x) & 0x1f) << 24)
9462306a36Sopenharmony_ci#       define CIK_ADDR_SURF_P2			 0
9562306a36Sopenharmony_ci#       define CIK_ADDR_SURF_P4_8x16		 4
9662306a36Sopenharmony_ci#       define CIK_ADDR_SURF_P4_16x16		 5
9762306a36Sopenharmony_ci#       define CIK_ADDR_SURF_P4_16x32		 6
9862306a36Sopenharmony_ci#       define CIK_ADDR_SURF_P4_32x32		 7
9962306a36Sopenharmony_ci#       define CIK_ADDR_SURF_P8_16x16_8x16	 8
10062306a36Sopenharmony_ci#       define CIK_ADDR_SURF_P8_16x32_8x16	 9
10162306a36Sopenharmony_ci#       define CIK_ADDR_SURF_P8_32x32_8x16	 10
10262306a36Sopenharmony_ci#       define CIK_ADDR_SURF_P8_16x32_16x16	 11
10362306a36Sopenharmony_ci#       define CIK_ADDR_SURF_P8_32x32_16x16	 12
10462306a36Sopenharmony_ci#       define CIK_ADDR_SURF_P8_32x32_16x32	 13
10562306a36Sopenharmony_ci#       define CIK_ADDR_SURF_P8_32x64_32x32	 14
10662306a36Sopenharmony_ci#       define CIK_GRPH_MICRO_TILE_MODE(x)       (((x) & 0x7) << 29)
10762306a36Sopenharmony_ci#       define CIK_DISPLAY_MICRO_TILING          0
10862306a36Sopenharmony_ci#       define CIK_THIN_MICRO_TILING             1
10962306a36Sopenharmony_ci#       define CIK_DEPTH_MICRO_TILING            2
11062306a36Sopenharmony_ci#       define CIK_ROTATED_MICRO_TILING          4
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci/* CUR blocks at 0x6998, 0x7598, 0x10198, 0x10d98, 0x11998, 0x12598 */
11362306a36Sopenharmony_ci#define CIK_CUR_CONTROL                           0x6998
11462306a36Sopenharmony_ci#       define CIK_CURSOR_EN                      (1 << 0)
11562306a36Sopenharmony_ci#       define CIK_CURSOR_MODE(x)                 (((x) & 0x3) << 8)
11662306a36Sopenharmony_ci#       define CIK_CURSOR_MONO                    0
11762306a36Sopenharmony_ci#       define CIK_CURSOR_24_1                    1
11862306a36Sopenharmony_ci#       define CIK_CURSOR_24_8_PRE_MULT           2
11962306a36Sopenharmony_ci#       define CIK_CURSOR_24_8_UNPRE_MULT         3
12062306a36Sopenharmony_ci#       define CIK_CURSOR_2X_MAGNIFY              (1 << 16)
12162306a36Sopenharmony_ci#       define CIK_CURSOR_FORCE_MC_ON             (1 << 20)
12262306a36Sopenharmony_ci#       define CIK_CURSOR_URGENT_CONTROL(x)       (((x) & 0x7) << 24)
12362306a36Sopenharmony_ci#       define CIK_CURSOR_URGENT_ALWAYS           0
12462306a36Sopenharmony_ci#       define CIK_CURSOR_URGENT_1_8              1
12562306a36Sopenharmony_ci#       define CIK_CURSOR_URGENT_1_4              2
12662306a36Sopenharmony_ci#       define CIK_CURSOR_URGENT_3_8              3
12762306a36Sopenharmony_ci#       define CIK_CURSOR_URGENT_1_2              4
12862306a36Sopenharmony_ci#define CIK_CUR_SURFACE_ADDRESS                   0x699c
12962306a36Sopenharmony_ci#       define CIK_CUR_SURFACE_ADDRESS_MASK       0xfffff000
13062306a36Sopenharmony_ci#define CIK_CUR_SIZE                              0x69a0
13162306a36Sopenharmony_ci#define CIK_CUR_SURFACE_ADDRESS_HIGH              0x69a4
13262306a36Sopenharmony_ci#define CIK_CUR_POSITION                          0x69a8
13362306a36Sopenharmony_ci#define CIK_CUR_HOT_SPOT                          0x69ac
13462306a36Sopenharmony_ci#define CIK_CUR_COLOR1                            0x69b0
13562306a36Sopenharmony_ci#define CIK_CUR_COLOR2                            0x69b4
13662306a36Sopenharmony_ci#define CIK_CUR_UPDATE                            0x69b8
13762306a36Sopenharmony_ci#       define CIK_CURSOR_UPDATE_PENDING          (1 << 0)
13862306a36Sopenharmony_ci#       define CIK_CURSOR_UPDATE_TAKEN            (1 << 1)
13962306a36Sopenharmony_ci#       define CIK_CURSOR_UPDATE_LOCK             (1 << 16)
14062306a36Sopenharmony_ci#       define CIK_CURSOR_DISABLE_MULTIPLE_UPDATE (1 << 24)
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci#define CIK_ALPHA_CONTROL                         0x6af0
14362306a36Sopenharmony_ci#       define CIK_CURSOR_ALPHA_BLND_ENA          (1 << 1)
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci#define CIK_LB_DATA_FORMAT                        0x6b00
14662306a36Sopenharmony_ci#       define CIK_INTERLEAVE_EN                  (1 << 3)
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci#define CIK_LB_DESKTOP_HEIGHT                     0x6b0c
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci#define SQ_IND_INDEX					0x8DE0
15162306a36Sopenharmony_ci#define SQ_CMD						0x8DEC
15262306a36Sopenharmony_ci#define SQ_IND_DATA					0x8DE4
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci/*
15562306a36Sopenharmony_ci * The TCP_WATCHx_xxxx addresses that are shown here are in dwords,
15662306a36Sopenharmony_ci * and that's why they are multiplied by 4
15762306a36Sopenharmony_ci */
15862306a36Sopenharmony_ci#define TCP_WATCH0_ADDR_H				(0x32A0*4)
15962306a36Sopenharmony_ci#define TCP_WATCH1_ADDR_H				(0x32A3*4)
16062306a36Sopenharmony_ci#define TCP_WATCH2_ADDR_H				(0x32A6*4)
16162306a36Sopenharmony_ci#define TCP_WATCH3_ADDR_H				(0x32A9*4)
16262306a36Sopenharmony_ci#define TCP_WATCH0_ADDR_L				(0x32A1*4)
16362306a36Sopenharmony_ci#define TCP_WATCH1_ADDR_L				(0x32A4*4)
16462306a36Sopenharmony_ci#define TCP_WATCH2_ADDR_L				(0x32A7*4)
16562306a36Sopenharmony_ci#define TCP_WATCH3_ADDR_L				(0x32AA*4)
16662306a36Sopenharmony_ci#define TCP_WATCH0_CNTL					(0x32A2*4)
16762306a36Sopenharmony_ci#define TCP_WATCH1_CNTL					(0x32A5*4)
16862306a36Sopenharmony_ci#define TCP_WATCH2_CNTL					(0x32A8*4)
16962306a36Sopenharmony_ci#define TCP_WATCH3_CNTL					(0x32AB*4)
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci#define CPC_INT_CNTL					0xC2D0
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci#define CP_HQD_IQ_RPTR					0xC970u
17462306a36Sopenharmony_ci#define SDMA0_RLC0_RB_CNTL				0xD400u
17562306a36Sopenharmony_ci#define	SDMA_RB_VMID(x)					(x << 24)
17662306a36Sopenharmony_ci#define	SDMA0_RLC0_RB_BASE				0xD404u
17762306a36Sopenharmony_ci#define	SDMA0_RLC0_RB_BASE_HI				0xD408u
17862306a36Sopenharmony_ci#define	SDMA0_RLC0_RB_RPTR				0xD40Cu
17962306a36Sopenharmony_ci#define	SDMA0_RLC0_RB_WPTR				0xD410u
18062306a36Sopenharmony_ci#define	SDMA0_RLC0_RB_WPTR_POLL_CNTL			0xD414u
18162306a36Sopenharmony_ci#define	SDMA0_RLC0_RB_WPTR_POLL_ADDR_HI			0xD418u
18262306a36Sopenharmony_ci#define	SDMA0_RLC0_RB_WPTR_POLL_ADDR_LO			0xD41Cu
18362306a36Sopenharmony_ci#define	SDMA0_RLC0_RB_RPTR_ADDR_HI			0xD420u
18462306a36Sopenharmony_ci#define	SDMA0_RLC0_RB_RPTR_ADDR_LO			0xD424u
18562306a36Sopenharmony_ci#define	SDMA0_RLC0_IB_CNTL				0xD428u
18662306a36Sopenharmony_ci#define	SDMA0_RLC0_IB_RPTR				0xD42Cu
18762306a36Sopenharmony_ci#define	SDMA0_RLC0_IB_OFFSET				0xD430u
18862306a36Sopenharmony_ci#define	SDMA0_RLC0_IB_BASE_LO				0xD434u
18962306a36Sopenharmony_ci#define	SDMA0_RLC0_IB_BASE_HI				0xD438u
19062306a36Sopenharmony_ci#define	SDMA0_RLC0_IB_SIZE				0xD43Cu
19162306a36Sopenharmony_ci#define	SDMA0_RLC0_SKIP_CNTL				0xD440u
19262306a36Sopenharmony_ci#define	SDMA0_RLC0_CONTEXT_STATUS			0xD444u
19362306a36Sopenharmony_ci#define	SDMA_RLC_IDLE					(1 << 2)
19462306a36Sopenharmony_ci#define	SDMA0_RLC0_DOORBELL				0xD448u
19562306a36Sopenharmony_ci#define	SDMA_OFFSET(x)					(x << 0)
19662306a36Sopenharmony_ci#define	SDMA_DB_ENABLE					(1 << 28)
19762306a36Sopenharmony_ci#define	SDMA0_RLC0_VIRTUAL_ADDR				0xD49Cu
19862306a36Sopenharmony_ci#define	SDMA_ATC					(1 << 0)
19962306a36Sopenharmony_ci#define	SDMA_VA_PTR32					(1 << 4)
20062306a36Sopenharmony_ci#define	SDMA_VA_SHARED_BASE(x)				(x << 8)
20162306a36Sopenharmony_ci#define	SDMA0_RLC0_APE1_CNTL				0xD4A0u
20262306a36Sopenharmony_ci#define	SDMA0_RLC0_DOORBELL_LOG				0xD4A4u
20362306a36Sopenharmony_ci#define	SDMA0_RLC0_WATERMARK				0xD4A8u
20462306a36Sopenharmony_ci#define	SDMA0_CNTL					0xD010
20562306a36Sopenharmony_ci#define	SDMA1_CNTL					0xD810
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_cienum {
20862306a36Sopenharmony_ci	MAX_TRAPID = 8,		/* 3 bits in the bitfield.  */
20962306a36Sopenharmony_ci	MAX_WATCH_ADDRESSES = 4
21062306a36Sopenharmony_ci};
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_cienum {
21362306a36Sopenharmony_ci	ADDRESS_WATCH_REG_ADDR_HI = 0,
21462306a36Sopenharmony_ci	ADDRESS_WATCH_REG_ADDR_LO,
21562306a36Sopenharmony_ci	ADDRESS_WATCH_REG_CNTL,
21662306a36Sopenharmony_ci	ADDRESS_WATCH_REG_MAX
21762306a36Sopenharmony_ci};
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_cienum {				/*  not defined in the CI/KV reg file  */
22062306a36Sopenharmony_ci	ADDRESS_WATCH_REG_CNTL_ATC_BIT = 0x10000000UL,
22162306a36Sopenharmony_ci	ADDRESS_WATCH_REG_CNTL_DEFAULT_MASK = 0x00FFFFFF,
22262306a36Sopenharmony_ci	ADDRESS_WATCH_REG_ADDLOW_MASK_EXTENSION = 0x03000000,
22362306a36Sopenharmony_ci	/* extend the mask to 26 bits in order to match the low address field */
22462306a36Sopenharmony_ci	ADDRESS_WATCH_REG_ADDLOW_SHIFT = 6,
22562306a36Sopenharmony_ci	ADDRESS_WATCH_REG_ADDHIGH_MASK = 0xFFFF
22662306a36Sopenharmony_ci};
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ciunion TCP_WATCH_CNTL_BITS {
22962306a36Sopenharmony_ci	struct {
23062306a36Sopenharmony_ci		uint32_t mask:24;
23162306a36Sopenharmony_ci		uint32_t vmid:4;
23262306a36Sopenharmony_ci		uint32_t atc:1;
23362306a36Sopenharmony_ci		uint32_t mode:2;
23462306a36Sopenharmony_ci		uint32_t valid:1;
23562306a36Sopenharmony_ci	} bitfields, bits;
23662306a36Sopenharmony_ci	uint32_t u32All;
23762306a36Sopenharmony_ci	signed int i32All;
23862306a36Sopenharmony_ci	float f32All;
23962306a36Sopenharmony_ci};
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_ci#endif
242