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