xref: /haiku/src/add-ons/accelerants/radeon_hd/gpu.h (revision 325089f1fcf20eb45c83e834e23f810f0533aa57)
1d356bf50SAlexander von Gluck IV /*
2d356bf50SAlexander von Gluck IV  * Copyright 2006-2011, Haiku, Inc. All Rights Reserved.
3d356bf50SAlexander von Gluck IV  * Distributed under the terms of the MIT License.
4d356bf50SAlexander von Gluck IV  *
5d356bf50SAlexander von Gluck IV  * Authors:
6d356bf50SAlexander von Gluck IV  *		Alexander von Gluck, kallisti5@unixzen.com
7d356bf50SAlexander von Gluck IV  */
893d4d552SAlexander von Gluck IV #ifndef RADEON_HD_GPU_H
993d4d552SAlexander von Gluck IV #define RADEON_HD_GPU_H
10d356bf50SAlexander von Gluck IV 
11d356bf50SAlexander von Gluck IV 
12d3e8b642SAlexander von Gluck IV #include "accelerant.h"
13d3e8b642SAlexander von Gluck IV 
1454fda1c6SAlexander von Gluck IV #include <video_configuration.h>
1554fda1c6SAlexander von Gluck IV 
16d3e8b642SAlexander von Gluck IV 
1746af8165SAlexander von Gluck IV #define HDP_REG_COHERENCY_FLUSH_CNTL 0x54A0
1846af8165SAlexander von Gluck IV #define HDP_NONSURFACE_BASE			0x2C04
1946af8165SAlexander von Gluck IV #define HDP_NONSURFACE_INFO			0x2C08
2046af8165SAlexander von Gluck IV #define HDP_NONSURFACE_SIZE			0x2C0C
2146af8165SAlexander von Gluck IV 
2246af8165SAlexander von Gluck IV 
23d356bf50SAlexander von Gluck IV // GPU Control registers. These are combined as
24d356bf50SAlexander von Gluck IV // the registers exist on all models, some flags
25d356bf50SAlexander von Gluck IV // are different though and are commented as such
26d356bf50SAlexander von Gluck IV #define CP_ME_CNTL					0x86D8
27d356bf50SAlexander von Gluck IV #define     CP_ME_HALT				(1 << 28)
28d356bf50SAlexander von Gluck IV #define     CP_PFP_HALT				(1 << 26)
29d356bf50SAlexander von Gluck IV #define CP_ME_RAM_DATA				0xC160
30d356bf50SAlexander von Gluck IV #define CP_ME_RAM_RADDR				0xC158
31d356bf50SAlexander von Gluck IV #define CP_ME_RAM_WADDR				0xC15C
32d356bf50SAlexander von Gluck IV #define CP_MEQ_THRESHOLDS			0x8764
33d356bf50SAlexander von Gluck IV #define     STQ_SPLIT(x)			((x) << 0)
34d356bf50SAlexander von Gluck IV #define CP_PERFMON_CNTL				0x87FC
35d356bf50SAlexander von Gluck IV #define CP_PFP_UCODE_ADDR			0xC150
36d356bf50SAlexander von Gluck IV #define CP_PFP_UCODE_DATA			0xC154
37d356bf50SAlexander von Gluck IV #define CP_QUEUE_THRESHOLDS			0x8760
38d356bf50SAlexander von Gluck IV #define     ROQ_IB1_START(x)		((x) << 0)
39d356bf50SAlexander von Gluck IV #define     ROQ_IB2_START(x)		((x) << 8)
40d356bf50SAlexander von Gluck IV #define CP_RB_BASE					0xC100
41d356bf50SAlexander von Gluck IV #define CP_RB_CNTL					0xC104
42d356bf50SAlexander von Gluck IV #define     RB_BUFSZ(x)				((x) << 0)
43d356bf50SAlexander von Gluck IV #define     RB_BLKSZ(x)				((x) << 8)
44d356bf50SAlexander von Gluck IV #define     RB_NO_UPDATE			(1 << 27)
45d356bf50SAlexander von Gluck IV #define     RB_RPTR_WR_ENA			(1 << 31)
46d356bf50SAlexander von Gluck IV #define     BUF_SWAP_32BIT			(2 << 16)
47d356bf50SAlexander von Gluck IV #define CP_RB_RPTR					0x8700
48d356bf50SAlexander von Gluck IV #define CP_RB_RPTR_ADDR				0xC10C
49d356bf50SAlexander von Gluck IV #define     RB_RPTR_SWAP(x)			((x) << 0)
50d356bf50SAlexander von Gluck IV #define CP_RB_RPTR_ADDR_HI			0xC110
51d356bf50SAlexander von Gluck IV #define CP_RB_RPTR_WR				0xC108
52d356bf50SAlexander von Gluck IV #define CP_RB_WPTR					0xC114
53d356bf50SAlexander von Gluck IV #define CP_RB_WPTR_ADDR				0xC118
54d356bf50SAlexander von Gluck IV #define CP_RB_WPTR_ADDR_HI			0xC11C
55d356bf50SAlexander von Gluck IV #define CP_RB_WPTR_DELAY			0x8704
56d356bf50SAlexander von Gluck IV #define CP_SEM_WAIT_TIMER			0x85BC
57d356bf50SAlexander von Gluck IV #define CP_DEBUG					0xC1FC
58d356bf50SAlexander von Gluck IV 
59d356bf50SAlexander von Gluck IV #define	NI_GRBM_CNTL				0x8000
60d356bf50SAlexander von Gluck IV #define		GRBM_READ_TIMEOUT(x)	((x) << 0)
61d356bf50SAlexander von Gluck IV #define	GRBM_STATUS					0x8010
62d356bf50SAlexander von Gluck IV #define		CMDFIFO_AVAIL_MASK		0x0000000F
63d356bf50SAlexander von Gluck IV #define		RING2_RQ_PENDING		(1 << 4)
64d356bf50SAlexander von Gluck IV #define		SRBM_RQ_PENDING			(1 << 5)
65d356bf50SAlexander von Gluck IV #define		RING1_RQ_PENDING		(1 << 6)
66d356bf50SAlexander von Gluck IV #define		CF_RQ_PENDING			(1 << 7)
67d356bf50SAlexander von Gluck IV #define		PF_RQ_PENDING			(1 << 8)
68d356bf50SAlexander von Gluck IV #define		GDS_DMA_RQ_PENDING		(1 << 9)
69d356bf50SAlexander von Gluck IV #define		GRBM_EE_BUSY			(1 << 10)
70d356bf50SAlexander von Gluck IV #define		SX_CLEAN				(1 << 11) // ni
71d356bf50SAlexander von Gluck IV #define		VC_BUSY					(1 << 11) // r600
72d356bf50SAlexander von Gluck IV #define		DB_CLEAN				(1 << 12)
73d356bf50SAlexander von Gluck IV #define		CB_CLEAN				(1 << 13)
74d356bf50SAlexander von Gluck IV #define		TA_BUSY 				(1 << 14)
75d356bf50SAlexander von Gluck IV #define		GDS_BUSY 				(1 << 15)
76d356bf50SAlexander von Gluck IV #define		VGT_BUSY_NO_DMA			(1 << 16)
77d356bf50SAlexander von Gluck IV #define		VGT_BUSY				(1 << 17)
78d356bf50SAlexander von Gluck IV #define		IA_BUSY_NO_DMA			(1 << 18) // ni
79d356bf50SAlexander von Gluck IV #define		TA03_BUSY				(1 << 18) // r600
80d356bf50SAlexander von Gluck IV #define		IA_BUSY					(1 << 19) // ni
81d356bf50SAlexander von Gluck IV #define		TC_BUSY					(1 << 19) // r600
82d356bf50SAlexander von Gluck IV #define		SX_BUSY 				(1 << 20)
83d356bf50SAlexander von Gluck IV #define		SH_BUSY 				(1 << 21)
84d356bf50SAlexander von Gluck IV #define		SPI_BUSY				(1 << 22) // AKA SPI03_BUSY r600
85d356bf50SAlexander von Gluck IV #define		SMX_BUSY				(1 << 23)
86d356bf50SAlexander von Gluck IV #define		SC_BUSY 				(1 << 24)
87d356bf50SAlexander von Gluck IV #define		PA_BUSY 				(1 << 25)
88d356bf50SAlexander von Gluck IV #define		DB_BUSY 				(1 << 26) // AKA DB03_BUSY r600
89d356bf50SAlexander von Gluck IV #define		CR_BUSY					(1 << 27)
90d356bf50SAlexander von Gluck IV #define		CP_COHERENCY_BUSY      	(1 << 28)
91d356bf50SAlexander von Gluck IV #define		CP_BUSY 				(1 << 29)
92d356bf50SAlexander von Gluck IV #define		CB_BUSY 				(1 << 30)
93d356bf50SAlexander von Gluck IV #define		GUI_ACTIVE				(1 << 31)
94d356bf50SAlexander von Gluck IV #define	GRBM_STATUS2				0x8014	// AKA GRBM_STATUS_SE0 ON NI
95d356bf50SAlexander von Gluck IV #define     CR_CLEAN				(1 << 0)
96d356bf50SAlexander von Gluck IV #define     SMX_CLEAN				(1 << 1)
97d356bf50SAlexander von Gluck IV #define     SPI0_BUSY				(1 << 8)
98d356bf50SAlexander von Gluck IV #define     SPI1_BUSY				(1 << 9)
99d356bf50SAlexander von Gluck IV #define     SPI2_BUSY				(1 << 10)
100d356bf50SAlexander von Gluck IV #define     SPI3_BUSY				(1 << 11)
101d356bf50SAlexander von Gluck IV #define     TA0_BUSY				(1 << 12)
102d356bf50SAlexander von Gluck IV #define     TA1_BUSY				(1 << 13)
103d356bf50SAlexander von Gluck IV #define     TA2_BUSY				(1 << 14)
104d356bf50SAlexander von Gluck IV #define     TA3_BUSY				(1 << 15)
105d356bf50SAlexander von Gluck IV #define     DB0_BUSY				(1 << 16)
106d356bf50SAlexander von Gluck IV #define     DB1_BUSY				(1 << 17)
107d356bf50SAlexander von Gluck IV #define     DB2_BUSY				(1 << 18)
108d356bf50SAlexander von Gluck IV #define     DB3_BUSY				(1 << 19)
109d356bf50SAlexander von Gluck IV #define     CB0_BUSY				(1 << 20)
110d356bf50SAlexander von Gluck IV #define     CB1_BUSY				(1 << 21)
111d356bf50SAlexander von Gluck IV #define     CB2_BUSY				(1 << 22)
112d356bf50SAlexander von Gluck IV #define     CB3_BUSY				(1 << 23)
113d356bf50SAlexander von Gluck IV #define	NI_GRBM_STATUS_SE1			0x8018
114d356bf50SAlexander von Gluck IV #define		SE_SX_CLEAN				(1 << 0)
115d356bf50SAlexander von Gluck IV #define		SE_DB_CLEAN				(1 << 1)
116d356bf50SAlexander von Gluck IV #define		SE_CB_CLEAN				(1 << 2)
117d356bf50SAlexander von Gluck IV #define		SE_VGT_BUSY				(1 << 23)
118d356bf50SAlexander von Gluck IV #define		SE_PA_BUSY				(1 << 24)
119d356bf50SAlexander von Gluck IV #define		SE_TA_BUSY				(1 << 25)
120d356bf50SAlexander von Gluck IV #define		SE_SX_BUSY				(1 << 26)
121d356bf50SAlexander von Gluck IV #define		SE_SPI_BUSY				(1 << 27)
122d356bf50SAlexander von Gluck IV #define		SE_SH_BUSY				(1 << 28)
123d356bf50SAlexander von Gluck IV #define		SE_SC_BUSY				(1 << 29)
124d356bf50SAlexander von Gluck IV #define		SE_DB_BUSY				(1 << 30)
125d356bf50SAlexander von Gluck IV #define		SE_CB_BUSY				(1 << 31)
126d356bf50SAlexander von Gluck IV #define	GRBM_SOFT_RESET				0x8020
127d356bf50SAlexander von Gluck IV #define SRBM_STATUS					0x0E50
128d356bf50SAlexander von Gluck IV #define		RLC_RQ_PENDING			(1 << 3)
129d356bf50SAlexander von Gluck IV #define		RCU_RQ_PENDING			(1 << 4)
130d356bf50SAlexander von Gluck IV #define		GRBM_RQ_PENDING			(1 << 5)
131d356bf50SAlexander von Gluck IV #define		HI_RQ_PENDING			(1 << 6)
132d356bf50SAlexander von Gluck IV #define		IO_EXTERN_SIGNAL		(1 << 7)
133d356bf50SAlexander von Gluck IV #define		VMC_BUSY				(1 << 8)
134d356bf50SAlexander von Gluck IV #define		MCB_BUSY				(1 << 9)
135d356bf50SAlexander von Gluck IV #define		MCDZ_BUSY				(1 << 10)
136d356bf50SAlexander von Gluck IV #define		MCDY_BUSY				(1 << 11)
137d356bf50SAlexander von Gluck IV #define		MCDX_BUSY				(1 << 12)
138d356bf50SAlexander von Gluck IV #define		MCDW_BUSY				(1 << 13)
139d356bf50SAlexander von Gluck IV #define		SEM_BUSY				(1 << 14)
140d356bf50SAlexander von Gluck IV #define		SRBM_STATUS__RLC_BUSY	(1 << 15)
141d356bf50SAlexander von Gluck IV #define		PDMA_BUSY				(1 << 16)
142d356bf50SAlexander von Gluck IV #define		IH_BUSY					(1 << 17)
143d356bf50SAlexander von Gluck IV #define		CSC_BUSY				(1 << 20)
144d356bf50SAlexander von Gluck IV #define		CMC7_BUSY				(1 << 21)
145d356bf50SAlexander von Gluck IV #define		CMC6_BUSY				(1 << 22)
146d356bf50SAlexander von Gluck IV #define		CMC5_BUSY				(1 << 23)
147d356bf50SAlexander von Gluck IV #define		CMC4_BUSY				(1 << 24)
148d356bf50SAlexander von Gluck IV #define		CMC3_BUSY				(1 << 25)
149d356bf50SAlexander von Gluck IV #define		CMC2_BUSY				(1 << 26)
150d356bf50SAlexander von Gluck IV #define		CMC1_BUSY				(1 << 27)
151d356bf50SAlexander von Gluck IV #define		CMC0_BUSY				(1 << 28)
152d356bf50SAlexander von Gluck IV #define		BIF_BUSY				(1 << 29)
153d356bf50SAlexander von Gluck IV #define		IDCT_BUSY				(1 << 30)
154d356bf50SAlexander von Gluck IV #define SRBM_SOFT_RESET				0x0E60
155d356bf50SAlexander von Gluck IV #define		SOFT_RESET_CP			(1 << 0)
156d356bf50SAlexander von Gluck IV #define		SOFT_RESET_CB			(1 << 1)
157d356bf50SAlexander von Gluck IV #define		SOFT_RESET_CR			(1 << 2)
158d356bf50SAlexander von Gluck IV #define		SOFT_RESET_DB			(1 << 3)
159d356bf50SAlexander von Gluck IV #define		SOFT_RESET_GDS			(1 << 4)
160d356bf50SAlexander von Gluck IV #define		SOFT_RESET_PA			(1 << 5)
161d356bf50SAlexander von Gluck IV #define		SOFT_RESET_SC			(1 << 6)
162d356bf50SAlexander von Gluck IV #define		SOFT_RESET_SMX			(1 << 7)
163d356bf50SAlexander von Gluck IV #define		SOFT_RESET_SPI			(1 << 8)
164d356bf50SAlexander von Gluck IV #define		SOFT_RESET_SH			(1 << 9)
165d356bf50SAlexander von Gluck IV #define		SOFT_RESET_SX			(1 << 10)
166d356bf50SAlexander von Gluck IV #define		SOFT_RESET_TC			(1 << 11)
167d356bf50SAlexander von Gluck IV #define		SOFT_RESET_TA			(1 << 12)
168d356bf50SAlexander von Gluck IV #define		SOFT_RESET_VC			(1 << 13)
169d356bf50SAlexander von Gluck IV #define		SOFT_RESET_VGT			(1 << 14)
170d356bf50SAlexander von Gluck IV #define		SOFT_RESET_IA			(1 << 15)
171d356bf50SAlexander von Gluck IV 
172d356bf50SAlexander von Gluck IV 
173d356bf50SAlexander von Gluck IV status_t radeon_gpu_reset();
174e9e9c194SAlexander von Gluck IV void radeon_gpu_mc_halt(struct gpu_state *gpuState);
175e9e9c194SAlexander von Gluck IV void radeon_gpu_mc_resume(struct gpu_state *gpuState);
17659bfec57SAlexander von Gluck IV status_t radeon_gpu_mc_idlewait();
177d356bf50SAlexander von Gluck IV status_t radeon_gpu_mc_setup();
178745450adSAlexander von Gluck IV status_t radeon_gpu_ring_setup();
179*325089f1SAlexander von Gluck IV status_t radeon_gpu_ring_boot(uint32 ringType);
1804ee41b26SAlexander von Gluck IV status_t radeon_gpu_ss_disable();
181d356bf50SAlexander von Gluck IV 
182d356bf50SAlexander von Gluck IV 
183d356bf50SAlexander von Gluck IV #endif
184