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