xref: /haiku/src/add-ons/kernel/drivers/graphics/radeon_hd/driver.cpp (revision 610f99c838cb661ff85377789ffd3ad4ff672a08)
1 /*
2  * Copyright (c) 2002, Thomas Kurschel
3  * Copyright 2004-2016 Haiku, Inc. All rights reserved.
4  * Distributed under the terms of the MIT License.
5  *
6  * Authors:
7  *		Thomas Kurschel
8  *		Clemens Zeidler, <haiku@clemens-zeidler.de>
9  *		Alexander von Gluck IV, kallisti5@unixzen.com
10  */
11 
12 
13 #include "driver.h"
14 #include "device.h"
15 #include "lock.h"
16 
17 #include <stdlib.h>
18 #include <stdio.h>
19 #include <string.h>
20 
21 #include <AGP.h>
22 #include <KernelExport.h>
23 #include <OS.h>
24 #include <PCI.h>
25 #include <SupportDefs.h>
26 
27 
28 #define TRACE_DRIVER
29 #ifdef TRACE_DRIVER
30 #	define TRACE(x...) dprintf("radeon_hd: " x)
31 #else
32 #	define TRACE(x...) ;
33 #endif
34 
35 #define ERROR(x...) dprintf("radeon_hd: " x)
36 
37 #define MAX_CARDS 1
38 
39 
40 // ATI / AMD cards starting at the Radeon X700 have an AtomBIOS
41 
42 // list of supported devices
43 const struct supported_device {
44 	uint32		pciID;
45 	uint8		dceMajor;	// Display block family
46 	uint8		dceMinor;	// Display block family
47 	uint16		chipsetID;
48 	uint32		chipsetFlags;
49 	const char*	deviceName;
50 } kSupportedDevices[] = {
51 	// Marketing Names: Radeon X?00
52 	// Intorduced: 2004
53 	// Codename: Loki
54 	// R420 Series  (Radeon) DCE 0.0 (*very* early AtomBIOS)
55 
56 	// Marketing Names: Radeon X1?00
57 	// Introduced: 2005
58 	// Codename: Fudo
59 	#if 0
60 	{0x791e, 1, 0, RADEON_RS690, CHIP_IGP, "Radeon X1200"},
61 	{0x791f, 1, 0, RADEON_RS690, CHIP_IGP, "Radeon X1200"},
62 	{0x793f, 1, 0, RADEON_RS600, CHIP_IGP, "Radeon X1200"},
63 	{0x7941, 1, 0, RADEON_RS600, CHIP_IGP, "Radeon X1200"},
64 	{0x7942, 1, 0, RADEON_RS600, CHIP_IGP, "Radeon X1250"},
65 	{0x796c, 1, 0, RADEON_RS740, CHIP_IGP, "Radeon RS740"},
66 	{0x796d, 1, 0, RADEON_RS740, CHIP_IGP, "Radeon RS740"},
67 	{0x796e, 1, 0, RADEON_RS740, CHIP_IGP, "Radeon 2100"},
68 	{0x796f, 1, 0, RADEON_RS740, CHIP_IGP, "Radeon RS740"},
69 	{0x7140, 1, 0, RADEON_RV515, CHIP_STD, "Radeon X1600"},
70 	{0x7100, 1, 0, RADEON_R520,  CHIP_STD, "Radeon X1800"},
71 	{0x7104, 1, 0, RADEON_R520,  CHIP_STD, "FireGL v7200"},
72 	{0x7109, 1, 0, RADEON_R520,  CHIP_STD, "Radeon X1800"},
73 	{0x710a, 1, 0, RADEON_R520,  CHIP_STD, "Radeon X1800"},
74 	{0x710b, 1, 0, RADEON_R520,  CHIP_STD, "Radeon X1800"},
75 	{0x710c, 1, 0, RADEON_R520,  CHIP_STD, "Radeon X1800"},
76 	{0x7120, 1, 0, RADEON_R520,  CHIP_STD, "Radeon X1800"},
77 	{0x7129, 1, 0, RADEON_R520,  CHIP_STD, "Radeon X1800"},
78 	#endif
79 
80 	// Marketing Names: Radeon HD 24xx - HD 42xx
81 	// Introduced: 2006
82 	// Codename: Pele
83 	// Process: 55 nm
84 	{0x94c7, 2, 0, RADEON_RV610, CHIP_STD, "Radeon HD 2350"},
85 	{0x94c1, 2, 0, RADEON_RV610, CHIP_IGP, "Radeon HD 2400"},
86 	{0x94c3, 2, 0, RADEON_RV610, CHIP_STD, "Radeon HD 2400"},
87 	{0x94c9, 2, 0, RADEON_RV610, CHIP_IGP, "Mobility Radeon HD 2400"},
88 	{0x94cc, 2, 0, RADEON_RV610, CHIP_STD, "Radeon HD 2400"},
89 	{0x9519, 2, 0, RADEON_RV630, CHIP_STD, "AMD FireStream 9170"},
90 	{0x9586, 2, 0, RADEON_RV630, CHIP_STD, "Radeon HD 2600"},
91 	{0x9588, 2, 0, RADEON_RV630, CHIP_STD, "Radeon HD 2600"},
92 	{0x958a, 2, 0, RADEON_RV630, CHIP_STD, "Radeon HD 2600 X2"},
93 	//	Radeon 2700		- RV630
94 	{0x9400, 2, 0, RADEON_R600,  CHIP_STD, "Radeon HD 2900"},
95 	{0x9401, 2, 0, RADEON_R600,  CHIP_STD, "Radeon HD 2900"},
96 	{0x9402, 2, 0, RADEON_R600,  CHIP_STD, "Radeon HD 2900"},
97 	{0x9403, 2, 0, RADEON_R600,  CHIP_STD, "Radeon HD 2900 Pro"},
98 	{0x9405, 2, 0, RADEON_R600,  CHIP_STD, "Radeon HD 2900"},
99 	{0x940a, 2, 0, RADEON_R600,  CHIP_STD, "Radeon FireGL V8650"},
100 	{0x940b, 2, 0, RADEON_R600,  CHIP_STD, "Radeon FireGL V8600"},
101 	{0x940f, 2, 0, RADEON_R600,  CHIP_STD, "Radeon FireGL V7600"},
102 	{0x9616, 2, 0, RADEON_RV610, CHIP_IGP, "Radeon HD 3000"},
103 	{0x9611, 3, 0, RADEON_RV620, CHIP_IGP, "Radeon HD 3100"},
104 	{0x9613, 3, 0, RADEON_RV620, CHIP_IGP, "Radeon HD 3100"},
105 	{0x9610, 2, 0, RADEON_RV610, CHIP_IGP, "Radeon HD 3200"},
106 	{0x9612, 2, 0, RADEON_RV610, CHIP_IGP, "Radeon HD 3200"},
107 	{0x9615, 2, 0, RADEON_RV610, CHIP_IGP, "Radeon HD 3200"},
108 	{0x9614, 2, 0, RADEON_RV610, CHIP_IGP, "Radeon HD 3300"},
109 	//  Radeon 3430		- RV620
110 	{0x95c2, 3, 0, RADEON_RV620, CHIP_STD, "Radeon HD 3430"},
111 	{0x95c5, 3, 0, RADEON_RV620, CHIP_STD, "Radeon HD 3450"},
112 	{0x95c6, 3, 0, RADEON_RV620, CHIP_STD, "Radeon HD 3450"},
113 	{0x95c7, 3, 0, RADEON_RV620, CHIP_STD, "Radeon HD 3450"},
114 	{0x95c9, 3, 0, RADEON_RV620, CHIP_STD, "Radeon HD 3450"},
115 	{0x95c4, 3, 0, RADEON_RV620, CHIP_STD, "Radeon HD 3470"},
116 	{0x95c0, 3, 0, RADEON_RV620, CHIP_STD, "Radeon HD 3550"},
117 	{0x9581, 2, 0, RADEON_RV630, CHIP_STD, "Radeon HD 3600"},
118 	{0x9583, 2, 0, RADEON_RV630, CHIP_STD, "Radeon HD 3600"},
119 	{0x9598, 2, 0, RADEON_RV630, CHIP_STD, "Radeon HD 3600"},
120 	{0x9591, 3, 0, RADEON_RV635, CHIP_STD, "Radeon HD 3600"},
121 	{0x9589, 2, 0, RADEON_RV630, CHIP_STD, "Radeon HD 3610"},
122 	//  Radeon 3650		- RV635
123 	//  Radeon 3670		- RV635
124 	{0x9507, 2, 0, RADEON_RV670, CHIP_STD, "Radeon HD 3830"},
125 	{0x9505, 2, 0, RADEON_RV670, CHIP_STD, "Radeon HD 3850"},
126 	{0x9513, 2, 0, RADEON_RV670, CHIP_STD, "Radeon HD 3850 X2"},
127 	{0x9515, 2, 0, RADEON_RV670, CHIP_STD, "Radeon HD 3850"},
128 	{0x9501, 2, 0, RADEON_RV670, CHIP_STD, "Radeon HD 3870"},
129 	{0x950F, 2, 0, RADEON_RV670, CHIP_STD | CHIP_X2, "Radeon HD 3870 X2"},
130 	{0x9710, 3, 0, RADEON_RV620, CHIP_IGP, "Radeon HD 4200"},
131 	{0x9715, 3, 0, RADEON_RV620, CHIP_IGP, "Radeon HD 4250"},
132 	{0x9712, 3, 0, RADEON_RV620, CHIP_IGP, "Radeon HD 4270"},
133 	{0x9714, 3, 0, RADEON_RV620, CHIP_IGP, "Radeon HD 4290"},
134 
135 	// Marketing Names: Radeon HD 4330 - HD 4890, HD 51xx, HD 5xxV
136 	// Introduced: 2008
137 	// Codename: Wekiva
138 	// Process: 55 nm
139 	//	Radeon 4330		- RV710
140 	{0x954f, 3, 2, RADEON_RV710, CHIP_IGP, "Radeon HD 4300"},
141 	{0x9552, 3, 2, RADEON_RV710, CHIP_IGP, "Radeon HD 4300"},
142 	{0x9553, 3, 2, RADEON_RV710, CHIP_IGP, "Radeon HD 4500"},
143 	{0x9555, 3, 2, RADEON_RV710, CHIP_STD, "Radeon HD 4350"},
144 	{0x9540, 3, 2, RADEON_RV710, CHIP_STD, "Radeon HD 4550"},
145 	{0x9452, 3, 2, RADEON_RV730, CHIP_STD, "AMD FireStream 9250"},
146 	{0x9480, 3, 2, RADEON_RV730, CHIP_STD, "Radeon HD 4650"},
147 	{0x9488, 3, 2, RADEON_RV730, CHIP_MOBILE, "Radeon HD 4650"},
148 	{0x9498, 3, 2, RADEON_RV730, CHIP_STD, "Radeon HD 4650"},
149 	{0x94b4, 3, 2, RADEON_RV740, CHIP_STD, "Radeon HD 4700"},
150 	{0x9490, 3, 2, RADEON_RV730, CHIP_STD, "Radeon HD 4710"},
151 	{0x94b3, 3, 2, RADEON_RV740, CHIP_STD, "Radeon HD 4770"},
152 	{0x94b5, 3, 2, RADEON_RV740, CHIP_STD, "Radeon HD 4770"},
153 	{0x9450, 3, 1, RADEON_RV770, CHIP_STD, "AMD FireStream 9270"},
154 	{0x944a, 3, 1, RADEON_RV770, CHIP_MOBILE, "Radeon HD 4850"},
155 	{0x944e, 3, 1, RADEON_RV770, CHIP_STD, "Radeon HD 4810"},
156 	{0x944c, 3, 1, RADEON_RV770, CHIP_STD, "Radeon HD 4830"},
157 	{0x9442, 3, 1, RADEON_RV770, CHIP_STD, "Radeon HD 4850"},
158 	{0x9443, 3, 1, RADEON_RV770, CHIP_STD | CHIP_X2, "Radeon HD 4850 X2"},
159 	{0x94a1, 3, 1, RADEON_RV770, CHIP_IGP, "Radeon HD 4860"},
160 	{0x9440, 3, 1, RADEON_RV770, CHIP_STD, "Radeon HD 4870"},
161 	{0x9441, 3, 1, RADEON_RV770, CHIP_STD | CHIP_X2, "Radeon HD 4870 X2"},
162 	{0x9460, 3, 1, RADEON_RV770, CHIP_STD, "Radeon HD 4890"},
163 
164 	// From here on AMD no longer used numeric identifiers
165 	// Marketing names can collide for different generations of cards
166 	// as such we should ignore them at all costs (besides the card name)
167 
168 	// Introduced: 2009
169 	// Codename: Evergreen
170 	// Process: 40 nm
171 	//  Cedar
172 	{0x68e1, 4, 0, RADEON_CEDAR, CHIP_STD, "Radeon HD 5430"},
173 	{0x68f9, 4, 0, RADEON_CEDAR, CHIP_STD, "Radeon HD 5450"},
174 	{0x68e0, 4, 0, RADEON_CEDAR, CHIP_IGP, "Radeon HD 5470"},
175 	{0x68e4, 4, 0, RADEON_CEDAR, CHIP_MOBILE, "Radeon HD 6370"},
176 	//  Redwood
177 	{0x68da, 4, 0, RADEON_REDWOOD, CHIP_STD, "Radeon HD 5500"},
178 	{0x68d9, 4, 0, RADEON_REDWOOD, CHIP_STD, "Radeon HD 5570"},
179 	{0x675f, 4, 0, RADEON_REDWOOD, CHIP_STD, "Radeon HD 5570"},
180 	{0x68b9, 4, 0, RADEON_REDWOOD, CHIP_STD, "Radeon HD 5600"},
181 	{0x68c1, 4, 0, RADEON_REDWOOD, CHIP_STD, "Radeon HD 5650"},
182 	{0x68c8, 4, 0, RADEON_REDWOOD, CHIP_STD, "FirePro V4800"},
183 	{0x68d8, 4, 0, RADEON_REDWOOD, CHIP_STD, "Radeon HD 5670"},
184 	//  Juniper
185 	{0x68be, 4, 0, RADEON_JUNIPER, CHIP_STD, "Radeon HD 5700"},
186 	{0x68b8, 4, 0, RADEON_JUNIPER, CHIP_STD, "Radeon HD 5770"},
187 	//  Juniper LE / XT (67X0 is rebranded 57X0 + tweaks)
188 #if 0
189 	// Not working: #8154
190 	{0x68bf, 4, 0, RADEON_JUNIPER, CHIP_STD, "Radeon HD 6750"},
191 #endif
192 	{0x68ba, 4, 0, RADEON_JUNIPER, CHIP_STD, "Radeon HD 6770"},
193 	//  Cypress
194 	{0x689e, 4, 0, RADEON_CYPRESS, CHIP_STD, "Radeon HD 5800"},
195 	{0x6899, 4, 0, RADEON_CYPRESS, CHIP_STD, "Radeon HD 5850"},
196 	{0x6898, 4, 0, RADEON_CYPRESS, CHIP_STD, "Radeon HD 5870"},
197 	//  Hemlock
198 	{0x689c, 4, 0, RADEON_HEMLOCK, CHIP_STD | CHIP_X2, "Radeon HD 5900 X2"},
199 	{0x689d, 4, 0, RADEON_HEMLOCK, CHIP_STD | CHIP_X2, "Radeon HD 5900 X2"},
200 	// Fusion APUS
201 	//  Palm
202 	{0x9804, 4, 1, RADEON_PALM, CHIP_APU, "Radeon HD 6250"},
203 	{0x9805, 4, 1, RADEON_PALM, CHIP_APU, "Radeon HD 6290"},
204 	{0x9807, 4, 1, RADEON_PALM, CHIP_APU, "Radeon HD 6290"},
205 	{0x9802, 4, 1, RADEON_PALM, CHIP_APU, "Radeon HD 6310"},
206 	{0x9803, 4, 1, RADEON_PALM, CHIP_APU, "Radeon HD 6310"},
207 	{0x9806, 4, 1, RADEON_PALM, CHIP_APU, "Radeon HD 6320"},
208 	{0x9808, 4, 1, RADEON_PALM, CHIP_APU, "Radeon HD 7340"},
209 	//  Sumo (no VGA / LVDS!, only DP)
210 	{0x9640, 4, 1, RADEON_SUMO, CHIP_APU, "Radeon HD 6550D"},
211 	{0x9641, 4, 1, RADEON_SUMO, CHIP_APU, "Radeon HD Sumo"},
212 #if 0
213 	// Not working: #10335, #12026
214 	{0x9647, 4, 1, RADEON_SUMO, CHIP_APU, "Radeon HD 6520G"},
215 	{0x9648, 4, 1, RADEON_SUMO, CHIP_APU, "Radeon HD 6480G"},
216 #endif
217 	{0x964a, 4, 1, RADEON_SUMO, CHIP_APU, "Radeon HD 6530D"},
218 	{0x964e, 4, 1, RADEON_SUMO, CHIP_APU, "Radeon HD Sumo"},
219 	{0x964f, 4, 1, RADEON_SUMO, CHIP_APU, "Radeon HD Sumo"},
220 	//  Sumo2 (no VGA / LVDS!, only DP)
221 	{0x9642, 4, 1, RADEON_SUMO2, CHIP_APU, "Radeon HD 6370D"},
222 	{0x9643, 4, 1, RADEON_SUMO2, CHIP_APU, "Radeon HD Sumo2"},
223 	{0x9644, 4, 1, RADEON_SUMO2, CHIP_APU, "Radeon HD 6410D"},
224 	{0x9645, 4, 1, RADEON_SUMO2, CHIP_APU, "Radeon HD Sumo2"},
225 
226 	// Introduced: 2010
227 	// Codename: Nothern Islands
228 	// Process: 40 nm
229 	//  Caicos
230 #if 0
231 	// Not working: #12313
232 	{0x6760, 5, 0, RADEON_CAICOS, CHIP_MOBILE, "Radeon HD 6470"},
233 #endif
234 	{0x6761, 5, 0, RADEON_CAICOS, CHIP_MOBILE, "Radeon HD 6430"},
235 	{0x6762, 5, 0, RADEON_CAICOS, CHIP_STD, "Radeon HD Caicos"},
236 	{0x6763, 5, 0, RADEON_CAICOS, CHIP_DISCREET, "Radeon HD E6460"},
237 	{0x6764, 5, 0, RADEON_CAICOS, CHIP_STD, "Radeon HD Caicos"},
238 	{0x6765, 5, 0, RADEON_CAICOS, CHIP_STD, "Radeon HD Caicos"},
239 	{0x6766, 5, 0, RADEON_CAICOS, CHIP_STD, "Radeon HD Caicos"},
240 	{0x6767, 5, 0, RADEON_CAICOS, CHIP_STD, "Radeon HD Caicos"},
241 	{0x6768, 5, 0, RADEON_CAICOS, CHIP_STD, "Radeon HD Caicos"},
242 	{0x6770, 5, 0, RADEON_CAICOS, CHIP_STD, "Radeon HD 6400"},
243 	{0x6778, 5, 0, RADEON_CAICOS, CHIP_STD, "Radeon HD 7470/8470"},
244 	{0x6779, 5, 0, RADEON_CAICOS, CHIP_STD, "Radeon HD 6450/7450/8450"},
245 	{0x68fa, 5, 0, RADEON_CAICOS, CHIP_STD, "Radeon HD 7350"},
246 	{0x677b, 5, 0, RADEON_CAICOS, CHIP_STD, "Radeon HD 7400"},
247 	{0x6772, 5, 0, RADEON_CAICOS, CHIP_APU, "Radeon HD 7400A"},
248 	{0x6771, 5, 0, RADEON_CAICOS, CHIP_STD, "Radeon HD 8490"},
249 	//  Turks
250 	{0x6740, 5, 0, RADEON_TURKS, CHIP_MOBILE, "Radeon HD 6770M"},
251 	{0x6741, 5, 0, RADEON_TURKS, CHIP_MOBILE, "Radeon HD 6650M"},
252 	{0x6742, 5, 0, RADEON_TURKS, CHIP_MOBILE, "Radeon HD 6625M"},
253 	{0x6743, 5, 0, RADEON_TURKS, CHIP_DISCREET, "Radeon HD E6760"},
254 	{0x6744, 5, 0, RADEON_TURKS, CHIP_MOBILE, "Radeon HD Turks"},
255 	{0x6745, 5, 0, RADEON_TURKS, CHIP_MOBILE, "Radeon HD Turks"},
256 	{0x6746, 5, 0, RADEON_TURKS, CHIP_STD, "FirePro V???? (turks)"},
257 	{0x6747, 5, 0, RADEON_TURKS, CHIP_STD, "FirePro V???? (turks)"},
258 	{0x6748, 5, 0, RADEON_TURKS, CHIP_STD, "FirePro V???? (turks)"},
259 	{0x6749, 5, 0, RADEON_TURKS, CHIP_STD, "FirePro V4900"},
260 	{0x6750, 5, 0, RADEON_TURKS, CHIP_STD, "Radeon HD 6500"},
261 	{0x6758, 5, 0, RADEON_TURKS, CHIP_STD, "Radeon HD 6670"},
262 	{0x6759, 5, 0, RADEON_TURKS, CHIP_STD, "Radeon HD 6570/7570"},
263 	{0x675d, 5, 0, RADEON_TURKS, CHIP_STD, "Radeon HD 7570"},
264 	{0x6850, 6, 0, RADEON_TURKS, CHIP_MOBILE, "Radeon HD 7570"},
265 #if 0
266 	// Not working: #12026
267 	{0x6840, 6, 0, RADEON_TURKS, CHIP_MOBILE, "Radeon HD 7670"},
268 #endif
269 	//  Barts
270 	{0x673e, 5, 0, RADEON_BARTS, CHIP_STD, "Radeon HD 6790"},
271 #if 0
272 	// Not working: #8765
273 	{0x6739, 5, 0, RADEON_BARTS, CHIP_STD, "Radeon HD 6850"},
274 #endif
275 	{0x6738, 5, 0, RADEON_BARTS, CHIP_STD, "Radeon HD 6870"},
276 	//  Cayman
277 	{0x6700, 5, 0, RADEON_CAYMAN, CHIP_STD, "Radeon HD Cayman"},
278 	{0x6701, 5, 0, RADEON_CAYMAN, CHIP_STD, "Radeon HD Cayman"},
279 	{0x6702, 5, 0, RADEON_CAYMAN, CHIP_STD, "Radeon HD Cayman"},
280 	{0x6703, 5, 0, RADEON_CAYMAN, CHIP_STD, "Radeon HD Cayman"},
281 	{0x6704, 5, 0, RADEON_CAYMAN, CHIP_STD, "FirePro V7900"},
282 	{0x6705, 5, 0, RADEON_CAYMAN, CHIP_STD, "Radeon HD Cayman"},
283 	{0x6706, 5, 0, RADEON_CAYMAN, CHIP_STD, "FirePro V???? (cayman)"},
284 	{0x6707, 5, 0, RADEON_CAYMAN, CHIP_STD, "Radeon HD Cayman"},
285 	{0x6708, 5, 0, RADEON_CAYMAN, CHIP_STD, "Radeon HD Cayman"},
286 	{0x6709, 5, 0, RADEON_CAYMAN, CHIP_STD, "Radeon HD Cayman"},
287 	{0x6718, 5, 0, RADEON_CAYMAN, CHIP_STD, "Radeon HD 6970"},
288 	{0x6719, 5, 0, RADEON_CAYMAN, CHIP_STD, "Radeon HD 6950"},
289 	{0x671c, 5, 0, RADEON_CAYMAN, CHIP_STD, "Radeon HD Cayman"},
290 	{0x671f, 5, 0, RADEON_CAYMAN, CHIP_STD, "Radeon HD 6900"},
291 	//  Antilles (Top, Dual GPU)
292 	{0x671d, 5, 0, RADEON_ANTILLES, CHIP_STD, "Radeon HD 6990"},
293 
294 
295 	// Introduced: Late 2011
296 	// Codename: Southern Islands
297 	// Process: 28 nm
298 	//  Cape Verde
299 	{0x6820, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
300 	{0x6821, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
301 	{0x6823, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
302 	{0x6824, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
303 	{0x6825, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
304 	{0x6826, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
305 	{0x6827, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
306 	{0x6828, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
307 	{0x6829, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
308 	{0x682a, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
309 	{0x682b, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
310 	{0x682c, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "FirePro W4100"},
311 	{0x682d, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
312 	{0x682f, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
313 	{0x6830, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
314 	{0x6831, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
315 	{0x6835, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon R7 Series"},
316 	{0x6837, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
317 	{0x6838, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
318 	{0x6839, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
319 	{0x683b, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD Verde"},
320 	{0x683d, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD 7770"},
321 	{0x683f, 6, 0, RADEON_CAPEVERDE, CHIP_STD, "Radeon HD 7750"},
322 	//  Pitcairn
323 	{0x6800, 6, 0, RADEON_PITCAIRN, CHIP_MOBILE, "Radeon HD 7970"},
324 	{0x6801, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD Pitcairn"},
325 	{0x6802, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD Pitcairn"},
326 	{0x6806, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD Pitcairn"},
327 	{0x6808, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD Pitcairn"},
328 	{0x6809, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD Pitcairn"},
329 	{0x6810, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD R9 270X"},
330 	{0x6811, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD R9 270"},
331 	{0x6816, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD Pitcairn"},
332 	{0x6817, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD Pitcairn"},
333 	{0x6818, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD 7870"},
334 	{0x6819, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD 7800"},
335 	{0x684c, 6, 0, RADEON_PITCAIRN, CHIP_STD, "Radeon HD Pitcairn"},
336 	//  Tahiti
337 	{0x6780, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD Tahiti"},
338 	{0x6784, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD Tahiti"},
339 	{0x6788, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD Tahiti"},
340 	{0x678a, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD Tahiti"},
341 	{0x6790, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD Tahiti"},
342 	{0x679e, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD Tahiti"},
343 	{0x679f, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD Tahiti"},
344 	{0x679a, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD 7950"},
345 	{0x6798, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD 7970"},
346 	{0x6799, 6, 0, RADEON_TAHITI, CHIP_STD, "Radeon HD 7990"},
347 	//  Aruba   DCE 6.1 Trinity / Richland
348 	{0x9900, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7660"},
349 	{0x9901, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7660"},
350 	{0x9903, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7640"},
351 	{0x9904, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7560"},
352 	{0x9905, 6, 1, RADEON_ARUBA, CHIP_APU, "FirePro A300"},
353 	{0x9906, 6, 1, RADEON_ARUBA, CHIP_APU, "FirePro A300"},
354 	{0x9907, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7560"},
355 	{0x9908, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7620"},
356 	{0x9909, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7500"},
357 	{0x990a, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7500"},
358 	{0x990b, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 8650"},
359 	{0x990d, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 8550"},
360 	{0x990f, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 8610"},
361 	{0x9910, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7660"},
362 	{0x9913, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7640"},
363 	{0x9917, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7620"},
364 	{0x9918, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7600"},
365 	{0x9919, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7500"},
366 	{0x9990, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7920"},
367 	{0x9991, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7540"},
368 	{0x9992, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7420"},
369 #if 0
370 	// Known not to work: https://dev.haiku-os.org/ticket/10606
371 	{0x9993, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7480"},
372 #endif
373 	{0x9994, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7400"},
374 	{0x9995, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 8450"},
375 	{0x9996, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 8470"},
376 	{0x9997, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 8350"},
377 #if 0
378 	// Known not to work: reported by ttcoder & Dane
379 	{0x9998, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 8730"},
380 #endif
381 	{0x999a, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 8410"},
382 	{0x999b, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 8310"},
383 	{0x999c, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 8650"},
384 	{0x999d, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 8550"},
385 #if 0
386 	// Not working: #12026
387 	{0x99a0, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7520"},
388 #endif
389 	{0x99a2, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7420"},
390 	{0x99a4, 6, 1, RADEON_ARUBA, CHIP_APU, "Radeon HD 7400"},
391 	//  Oland   DCE 6,4
392 	{0x990c, 6, 4, RADEON_OLAND, CHIP_STD, "Radeon HD 8670"},
393 	{0x990e, 6, 4, RADEON_OLAND, CHIP_STD, "Radeon HD 8570"},
394 	{0x6600, 6, 4, RADEON_OLAND, CHIP_MOBILE, "Radeon HD 8750M"},
395 	{0x6601, 6, 4, RADEON_OLAND, CHIP_MOBILE, "Radeon HD 8730M"},
396 	{0x6602, 6, 4, RADEON_OLAND, CHIP_MOBILE, "Radeon HD Oland"},
397 	{0x6603, 6, 4, RADEON_OLAND, CHIP_MOBILE, "Radeon HD Oland"},
398 	{0x6604, 6, 4, RADEON_OLAND, CHIP_MOBILE, "Radeon R7 M270"},
399 	{0x6605, 6, 4, RADEON_OLAND, CHIP_MOBILE, "Radeon R7 M260"},
400 	{0x6606, 6, 4, RADEON_OLAND, CHIP_MOBILE, "Radeon HD 8790"},
401 	{0x6607, 6, 4, RADEON_OLAND, CHIP_MOBILE, "Radeon HD 8350"},
402 	{0x6608, 6, 4, RADEON_OLAND, CHIP_STD, "FirePro W2100"},
403 	{0x6610, 6, 4, RADEON_OLAND, CHIP_STD, "Radeon R7 250"},
404 	{0x6611, 6, 4, RADEON_OLAND, CHIP_STD, "Radeon R7 200"},
405 	{0x6613, 6, 4, RADEON_OLAND, CHIP_STD, "Radeon R7 240"},
406 	{0x6620, 6, 4, RADEON_OLAND, CHIP_STD, "Radeon R7 240"},
407 	{0x6621, 6, 4, RADEON_OLAND, CHIP_STD, "Radeon HD Oland"},
408 	{0x6623, 6, 4, RADEON_OLAND, CHIP_STD, "Radeon HD Oland"},
409 	{0x6631, 6, 4, RADEON_OLAND, CHIP_STD, "Radeon HD Oland"},
410 	//  Hainan  NODCE. No display hardware, OpenCL 3D engine.
411 	//{0x6670, 0, 0, RADEON_HAINAN, CHIP_COM, "Radeon HD Hainan compute"},
412 
413 	// Introduced: Late 2013
414 	// Codename: Sea Islands
415 	// Process: 28 nm
416 	//  Kaveri DCE 8.1
417 	{0x1304, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon HD Kaveri"},
418 	{0x1305, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon HD Kaveri"},
419 	{0x1306, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon HD Kaveri"},
420 	{0x1307, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon HD Kaveri"},
421 	{0x1308, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon HD Kaveri"},
422 	{0x1309, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R7 Series"},
423 	{0x130a, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R6 Series"},
424 	{0x130b, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R4 Series"},
425 	{0x130c, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R7 Series"},
426 	{0x130d, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R6 Series"},
427 	{0x130e, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R5 Series"},
428 	{0x130f, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R7 Series"},
429 	{0x1310, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon HD Kaveri"},
430 	{0x1311, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon HD Kaveri"},
431 	{0x1312, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon HD Kaveri"},
432 	{0x1313, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R7 Series"},
433 	{0x1314, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon HD Kaveri"},
434 	{0x1315, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R5 Series"},
435 	{0x1316, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R5 Series"},
436 	{0x1317, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon HD Kaveri"},
437 	{0x1318, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R5 Series"},
438 	{0x131b, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R5 Series"},
439 	{0x131c, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R7 Series"},
440 	{0x131d, 8, 1, RADEON_KAVERI, CHIP_STD, "Radeon R6 Series"},
441 	//  Bonaire DCE 8.2
442 	{0x6640, 8, 2, RADEON_BONAIRE, CHIP_MOBILE, "Radeon R9 380"},
443 	{0x6641, 8, 2, RADEON_BONAIRE, CHIP_MOBILE, "Radeon HD 8930M"},
444 	{0x6646, 8, 2, RADEON_BONAIRE, CHIP_MOBILE, "Radeon R9 380"},
445 	{0x6647, 8, 2, RADEON_BONAIRE, CHIP_MOBILE, "Radeon R9 380"},
446 	{0x6649, 8, 2, RADEON_BONAIRE, CHIP_STD, "FirePro W5100"},
447 	{0x6650, 8, 2, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"},
448 	{0x6651, 8, 2, RADEON_BONAIRE, CHIP_STD, "Radeon HD Bonaire"},
449 	{0x6658, 8, 2, RADEON_BONAIRE, CHIP_STD, "Radeon R7 200"},
450 	{0x665c, 8, 2, RADEON_BONAIRE, CHIP_STD, "Radeon HD 7790"},
451 	{0x665d, 8, 2, RADEON_BONAIRE, CHIP_STD, "Radeon R7 200"},
452 	{0x665f, 8, 2, RADEON_BONAIRE, CHIP_STD, "Radeon R7 300"},
453 	//  Kabini DCE 8.3
454 #if 0
455 	// Not working: #10939
456 	{0x9830, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD 8400"},
457 	{0x9831, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD 8400"},
458 #endif
459 	{0x9832, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD 8330"},
460 	{0x9833, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD 8330"},
461 	{0x9834, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD 8210"},
462 	{0x9835, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD 8210"},
463 	{0x9836, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD 8280"},
464 	{0x9837, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD 8280"},
465 	{0x9838, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD 8240"},
466 	{0x9839, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD 8180"},
467 	{0x983a, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD Kabini"},
468 	{0x983b, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD Kabini"},
469 	{0x983c, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD Kabini"},
470 	{0x983d, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD 8250"},
471 	{0x983e, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD Kabini"},
472 	{0x983f, 8, 3, RADEON_KABINI, CHIP_STD, "Radeon HD Kabini"},
473 	//  Mullins DCE 8.3
474 	{0x9850, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD R3"},
475 	{0x9851, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD R2"},
476 	{0x9852, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD R2"},
477 	{0x9853, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD R2"},
478 	{0x9854, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD R2"},
479 	{0x9855, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD R3"},
480 	{0x9856, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD R2"},
481 	{0x9857, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD R2"},
482 	{0x9858, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD Mullins"},
483 	{0x9859, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD Mullins"},
484 	{0x985a, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD Mullins"},
485 	{0x985b, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD Mullins"},
486 	{0x985c, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD Mullins"},
487 	{0x985d, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD Mullins"},
488 	{0x985e, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD Mullins"},
489 	{0x985f, 8, 3, RADEON_MULLINS, CHIP_STD, "Radeon HD Mullins"},
490 	//  Hawaii DCE 8.5
491 	{0x67a0, 8, 5, RADEON_HAWAII, CHIP_STD, "Radeon FirePro W9100"},
492 	{0x67a1, 8, 5, RADEON_HAWAII, CHIP_STD, "Radeon FirePro W8100"},
493 	{0x67a2, 8, 5, RADEON_HAWAII, CHIP_STD, "Radeon HD Hawaii"},
494 	{0x67a8, 8, 5, RADEON_HAWAII, CHIP_STD, "Radeon HD Hawaii"},
495 	{0x67a9, 8, 5, RADEON_HAWAII, CHIP_STD, "Radeon HD Hawaii"},
496 	{0x67aa, 8, 5, RADEON_HAWAII, CHIP_STD, "Radeon HD Hawaii"},
497 	{0x67b0, 8, 5, RADEON_HAWAII, CHIP_STD, "Radeon R9 290X/390X"},
498 	{0x67b1, 8, 5, RADEON_HAWAII, CHIP_STD, "Radeon R9 290/390"},
499 	{0x67b8, 8, 5, RADEON_HAWAII, CHIP_STD, "Radeon HD Hawaii"},
500 	{0x67b9, 8, 5, RADEON_HAWAII, CHIP_STD, "Radeon R9 295X2"},
501 	{0x67ba, 8, 5, RADEON_HAWAII, CHIP_STD, "Radeon HD Hawaii"},
502 	{0x67be, 8, 5, RADEON_HAWAII, CHIP_STD, "Radeon HD Hawaii"},
503 
504 	// WARN: DCE versions below here get sketchy
505 
506 	// Introduced: 2014
507 	// Codename: Volcanic Islands
508 	// Process: 28 nm
509 	// Iceland (aka topaz) NO DCE
510 	//{0x6900, 99, 0, RADEON_TOPAZ, CHIP_STD, "Radeon HD Topaz"},
511 	//{0x6901, 99, 0, RADEON_TOPAZ, CHIP_STD, "Radeon HD Topaz"},
512 	//{0x6902, 99, 0, RADEON_TOPAZ, CHIP_STD, "Radeon HD Topaz"},
513 	//{0x6903, 99, 0, RADEON_TOPAZ, CHIP_STD, "Radeon HD Topaz"},
514 	//{0x6907, 99, 0, RADEON_TOPAZ, CHIP_STD, "Radeon HD Topaz"},
515 	// Tonga DCE 10.0
516 	{0x6920, 10, 0, RADEON_TONGA, CHIP_STD, "Radeon R9 M395/M395X"},
517 	{0x6921, 10, 0, RADEON_TONGA, CHIP_STD, "Radeon R9 M295/M390X"},
518 	{0x6928, 10, 0, RADEON_TONGA, CHIP_STD, "Radeon HD Tonga"},
519 	{0x6929, 10, 0, RADEON_TONGA, CHIP_STD, "Radeon FirePro S7150"},
520 	{0x692b, 10, 0, RADEON_TONGA, CHIP_STD, "Radeon FirePro W7100"},
521 	{0x692f, 10, 0, RADEON_TONGA, CHIP_STD, "Radeon FirePro S7150V"},
522 	{0x6930, 10, 0, RADEON_TONGA, CHIP_STD, "Radeon HD 6930"},
523 	{0x6938, 10, 0, RADEON_TONGA, CHIP_STD, "Radeon R9 380X/M295X"},
524 	{0x6939, 10, 0, RADEON_TONGA, CHIP_STD, "Radeon R9 285/380"},
525 	// Fiji DCE 10.1?
526 	{0x7300, 10, 1, RADEON_FIJI, CHIP_STD, "Radeon R9 Fury"},
527 	{0x730f, 10, 1, RADEON_FIJI, CHIP_STD, "Radeon HD Fiji"},
528 	// Carrizo DCE 11.0
529 	{0x9870, 11, 0, RADEON_CARRIZO, CHIP_APU, "Radeon HD Carrizo"},
530 	{0x9874, 11, 0, RADEON_CARRIZO, CHIP_APU, "Radeon HD Carrizo"},
531 	{0x9875, 11, 0, RADEON_CARRIZO, CHIP_APU, "Radeon HD Carrizo"},
532 	{0x9876, 11, 0, RADEON_CARRIZO, CHIP_APU, "Radeon HD Carrizo"},
533 	{0x9877, 11, 0, RADEON_CARRIZO, CHIP_APU, "Radeon HD Carrizo"},
534 	// Stoney Ridge 11.1?
535 	{0x98e4, 11, 1, RADEON_STONEY, CHIP_APU, "Radeon HD Stoney Ridge"},
536 
537 	// Introduced: 2016
538 	// Codename: Artic Islands / Polaris
539 	// Process: 14 nm
540 	// Polaris 11
541 	{0x67e0, 12, 1, RADEON_POLARIS11, CHIP_STD, "Radeon Pro WX 4170"},
542 	{0x67e3, 12, 1, RADEON_POLARIS11, CHIP_STD, "Radeon Pro WX 4100"},
543 	{0x67e8, 12, 1, RADEON_POLARIS11, CHIP_STD, "Radeon Pro WX 4130"},
544 	{0x67eb, 12, 1, RADEON_POLARIS11, CHIP_STD, "Radeon Pro V5300X"},
545 	{0x67ef, 12, 1, RADEON_POLARIS11, CHIP_STD, "Radeon RX 460"},
546 	{0x67ff, 12, 1, RADEON_POLARIS11, CHIP_STD, "Radeon RX 560"},
547 	{0x67e1, 12, 1, RADEON_POLARIS11, CHIP_STD, "Radeon Polaris 11"},
548 	{0x67e7, 12, 1, RADEON_POLARIS11, CHIP_STD, "Radeon Polaris 11"},
549 	{0x67e9, 12, 1, RADEON_POLARIS11, CHIP_STD, "Radeon Polaris 11"},
550 	// Polaris 10
551 	{0x67c0, 12, 0, RADEON_POLARIS10, CHIP_STD, "Radeon Pro WX 7100 Mobile"},
552 	{0x67c1, 12, 0, RADEON_POLARIS10, CHIP_STD, "Radeon Polaris 10"},
553 	{0x67c2, 12, 0, RADEON_POLARIS10, CHIP_STD, "Radeon Pro V7300X"},
554 	{0x67c4, 12, 0, RADEON_POLARIS10, CHIP_STD, "Radeon Pro WX 7100"},
555 	{0x67c7, 12, 0, RADEON_POLARIS10, CHIP_STD, "Radeon Pro WX 5100"},
556 	{0x67c8, 12, 0, RADEON_POLARIS10, CHIP_STD, "Radeon Polaris 10"},
557 	{0x67c9, 12, 0, RADEON_POLARIS10, CHIP_STD, "Radeon Polaris 10"},
558 	{0x67ca, 12, 0, RADEON_POLARIS10, CHIP_STD, "Radeon Polaris 10"},
559 	{0x67cc, 12, 0, RADEON_POLARIS10, CHIP_STD, "Radeon Polaris 10"},
560 	{0x67cf, 12, 0, RADEON_POLARIS10, CHIP_STD, "Radeon Polaris 10"},
561 	{0x67d0, 12, 0, RADEON_POLARIS10, CHIP_STD, "Radeon Pro V7300X"},
562 	{0x67df, 12, 0, RADEON_POLARIS10, CHIP_STD, "Radeon RX 470/480"},
563 	// Polaris 12
564 	{0x6980, 12, 2, RADEON_POLARIS12, CHIP_STD, "Radeon Polaris 12"},
565 	{0x6981, 12, 2, RADEON_POLARIS12, CHIP_STD, "Radeon Pro WX 3200"},
566 	{0x6985, 12, 2, RADEON_POLARIS12, CHIP_STD, "Radeon Pro WX 3100"},
567 	{0x6986, 12, 2, RADEON_POLARIS12, CHIP_STD, "Radeon Polaris 12"},
568 	{0x6987, 12, 2, RADEON_POLARIS12, CHIP_STD, "Radeon 540X/550X/RX 640"},
569 	{0x6995, 12, 2, RADEON_POLARIS12, CHIP_STD, "Radeon Pro WX 2100"},
570 	{0x6997, 12, 2, RADEON_POLARIS12, CHIP_STD, "Radeon Polaris 12"},
571 	{0x699f, 12, 2, RADEON_POLARIS12, CHIP_STD, "Radeon 540/540X/RX 540X"},
572 
573 	// Introduced: 2017
574 	// Codename: Vega
575 	// Process: 14nm
576 	{0x694c, 13, 0, RADEON_VEGAM, CHIP_MOBILE, "Radeon RX Vega M GH"},
577 	{0x694e, 13, 0, RADEON_VEGAM, CHIP_MOBILE, "Radeon RX Vega M GL"},
578 	{0x694f, 13, 0, RADEON_VEGAM, CHIP_MOBILE, "Radeon Pro WX Vega M GL"},
579 	// Vega 10
580 	{0x6860, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Instinct MI25"},
581 	{0x6861, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Pro WX 9100"},
582 	{0x6862, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Pro SSG"},
583 	{0x6863, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Vega Frontier"},
584 	{0x6864, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Pro V340"},
585 	{0x6867, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Pro Vega 56"},
586 	{0x6868, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Pro WX 8100/8200"},
587 	{0x6869, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Vega 10"},
588 	{0x686a, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Vega 10"},
589 	{0x686b, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Vega 10"},
590 	{0x686c, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Instinct MI25 MxGPU"},
591 	{0x686d, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Vega 10"},
592 	{0x686e, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Vega 10"},
593 	{0x686f, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Vega 10"},
594 	{0x687f, 13, 0, RADEON_VEGA10, CHIP_STD, "Radeon Vega 56/64"},
595 	// Vega 12
596 	{0x69a0, 13, 0, RADEON_VEGA12, CHIP_STD, "Radeon Vega 12"},
597 	{0x69a1, 13, 0, RADEON_VEGA12, CHIP_STD, "Radeon Vega 12"},
598 	{0x69a2, 13, 0, RADEON_VEGA12, CHIP_STD, "Radeon Vega 12"},
599 	{0x69a3, 13, 0, RADEON_VEGA12, CHIP_STD, "Radeon Vega 12"},
600 	{0x69af, 13, 0, RADEON_VEGA12, CHIP_STD, "Radeon Pro Vega 12"},
601 	// Vega 20
602 	{0x66a0, 13, 2, RADEON_VEGA20, CHIP_STD, "Radeon Vega 20"},
603 	{0x66a1, 13, 2, RADEON_VEGA20, CHIP_STD, "Radeon Vega 20"},
604 	{0x66a2, 13, 2, RADEON_VEGA20, CHIP_STD, "Radeon Vega 20"},
605 	{0x66a3, 13, 2, RADEON_VEGA20, CHIP_STD, "Radeon Vega 20"},
606 	{0x66a4, 13, 2, RADEON_VEGA20, CHIP_STD, "Radeon Vega 20"},
607 	{0x66a7, 13, 2, RADEON_VEGA20, CHIP_STD, "Radeon Pro Vega 20"},
608 	{0x66af, 13, 2, RADEON_VEGA20, CHIP_STD, "Radeon Pro Vega 20"},
609 	// Raven (APU)
610 	{0x15dd, 13, 0, RADEON_RAVEN, CHIP_APU, "Radeon Vega Raven"},
611 	{0x15d8, 13, 0, RADEON_RAVEN, CHIP_APU, "Radeon Vega Raven"},
612 
613 	// TODO: We might need to split NAVI into NAVI10, NAVI12, etc
614 
615 	// Introduced: 2019
616 	// Codename: Navi
617 	// Process: 7nm FinFET
618 	// Navi 10
619 	{0x7310, 13, 3, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
620 	{0x7312, 13, 3, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
621 	{0x7318, 13, 3, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
622 	{0x7319, 13, 3, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
623 	{0x731a, 13, 3, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
624 	{0x731b, 13, 3, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
625 	{0x731e, 13, 3, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
626 	{0x731f, 13, 3, RADEON_NAVI, CHIP_STD, "Radeon RX 5600 / 5700"},
627 	// Renoir?
628 	{0x1636, 13, 3, RADEON_NAVI, CHIP_APU, "Radeon Renoir"},
629 	{0x1638, 13, 3, RADEON_NAVI, CHIP_APU, "Radeon Renoir"},
630 	{0x164c, 13, 3, RADEON_NAVI, CHIP_APU, "Radeon Renoir"},
631 	// Navi 14
632 	{0x7340, 13, 3, RADEON_NAVI, CHIP_STD, "Radeon RX 5500"},
633 	// Navi 21/22 aka "Sienna Cichlid"?
634 	{0x73a0, 13, 4, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
635 	{0x73a1, 13, 4, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
636 	{0x73a2, 13, 4, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
637 	{0x73a3, 13, 4, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
638 	{0x73ab, 13, 4, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
639 	{0x73ae, 13, 4, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
640 	{0x73bf, 13, 4, RADEON_NAVI, CHIP_STD, "Radeon RX 6800 / 6900 XT"},
641 	{0x73cf, 13, 4, RADEON_NAVI, CHIP_STD, "Radeon RX Navi"},
642 	{0x73df, 13, 4, RADEON_NAVI, CHIP_STD, "Radeon RX 6700 XT"},
643 	// Van Gogh?
644 	{0x163f, 13, 4, RADEON_NAVI, CHIP_STD, "Radeon RX Navi (Van Gogh)"},
645 	// Navy Flounder?
646 	{0x73c0, 13, 5, RADEON_NAVI, CHIP_STD, "Radeon RX Navi (Navy)"},
647 	{0x73c1, 13, 5, RADEON_NAVI, CHIP_STD, "Radeon RX Navi (Navy)"},
648 	{0x73c3, 13, 5, RADEON_NAVI, CHIP_STD, "Radeon RX Navi (Navy)"},
649 	{0x73df, 13, 5, RADEON_NAVI, CHIP_STD, "Radeon RX Navi (Navy)"},
650 	// Dimgrey Cavefish?
651 	{0x73e0, 13, 5, RADEON_NAVI, CHIP_STD, "Radeon RX Navi (Dimgrey)"},
652 	{0x73e1, 13, 5, RADEON_NAVI, CHIP_STD, "Radeon RX Navi (Dimgrey)"},
653 	{0x73e2, 13, 5, RADEON_NAVI, CHIP_STD, "Radeon RX Navi (Dimgrey)"},
654 	{0x73ff, 13, 5, RADEON_NAVI, CHIP_STD, "Radeon RX Navi (Dimgrey)"},
655 };
656 
657 
658 int32 api_version = B_CUR_DRIVER_API_VERSION;
659 
660 
661 char* gDeviceNames[MAX_CARDS + 1];
662 radeon_info* gDeviceInfo[MAX_CARDS];
663 pci_module_info* gPCI;
664 mutex gLock;
665 
666 
667 static status_t
668 get_next_radeon_hd(int32* _cookie, pci_info &info, uint32 &type)
669 {
670 	int32 index = *_cookie;
671 
672 	// find devices
673 
674 	for (; gPCI->get_nth_pci_info(index, &info) == B_OK; index++) {
675 		// check vendor
676 		if (info.vendor_id != VENDOR_ID_ATI
677 			|| info.class_base != PCI_display
678 			|| info.class_sub != PCI_vga)
679 			continue;
680 
681 		// check device
682 		for (uint32 i = 0; i < sizeof(kSupportedDevices)
683 				/ sizeof(kSupportedDevices[0]); i++) {
684 			if (info.device_id == kSupportedDevices[i].pciID) {
685 				type = i;
686 				*_cookie = index + 1;
687 				return B_OK;
688 			}
689 		}
690 	}
691 
692 	return B_ENTRY_NOT_FOUND;
693 }
694 
695 
696 extern "C" const char**
697 publish_devices(void)
698 {
699 	TRACE("%s\n", __func__);
700 	return (const char**)gDeviceNames;
701 }
702 
703 
704 extern "C" status_t
705 init_hardware(void)
706 {
707 	TRACE("%s\n", __func__);
708 
709 	status_t status = get_module(B_PCI_MODULE_NAME, (module_info**)&gPCI);
710 	if (status != B_OK) {
711 		ERROR("%s: ERROR: pci module unavailable\n", __func__);
712 		return status;
713 	}
714 
715 	int32 cookie = 0;
716 	uint32 type;
717 	pci_info info;
718 	status = get_next_radeon_hd(&cookie, info, type);
719 
720 	put_module(B_PCI_MODULE_NAME);
721 	return status;
722 }
723 
724 
725 extern "C" status_t
726 init_driver(void)
727 {
728 	TRACE("%s\n", __func__);
729 
730 	status_t status = get_module(B_PCI_MODULE_NAME, (module_info**)&gPCI);
731 	if (status != B_OK) {
732 		ERROR("%s: ERROR: pci module unavailable\n", __func__);
733 		return status;
734 	}
735 
736 	mutex_init(&gLock, "radeon hd ksync");
737 
738 	// find devices
739 
740 	int32 found = 0;
741 
742 	for (int32 cookie = 0; found < MAX_CARDS;) {
743 		pci_info* info = (pci_info*)malloc(sizeof(pci_info));
744 		if (info == NULL)
745 			break;
746 
747 		uint32 type;
748 		status = get_next_radeon_hd(&cookie, *info, type);
749 		if (status < B_OK) {
750 			free(info);
751 			break;
752 		}
753 
754 		// create device names & allocate device info structure
755 
756 		char name[64];
757 		sprintf(name, "graphics/radeon_hd_%02x%02x%02x",
758 			info->bus, info->device,
759 			info->function);
760 
761 		gDeviceNames[found] = strdup(name);
762 		if (gDeviceNames[found] == NULL)
763 			break;
764 
765 		gDeviceInfo[found] = (radeon_info*)malloc(sizeof(radeon_info));
766 		if (gDeviceInfo[found] == NULL) {
767 			free(gDeviceNames[found]);
768 			break;
769 		}
770 
771 		// initialize the structure for later use
772 
773 		memset(gDeviceInfo[found], 0, sizeof(radeon_info));
774 		gDeviceInfo[found]->init_status = B_NO_INIT;
775 		gDeviceInfo[found]->id = found;
776 		gDeviceInfo[found]->pci = info;
777 		gDeviceInfo[found]->registers = info->u.h0.base_registers[0];
778 		gDeviceInfo[found]->pciID = kSupportedDevices[type].pciID;
779 		gDeviceInfo[found]->deviceName = kSupportedDevices[type].deviceName;
780 		gDeviceInfo[found]->chipsetID = kSupportedDevices[type].chipsetID;
781 		gDeviceInfo[found]->dceMajor = kSupportedDevices[type].dceMajor;
782 		gDeviceInfo[found]->dceMinor = kSupportedDevices[type].dceMinor;
783 		gDeviceInfo[found]->chipsetFlags = kSupportedDevices[type].chipsetFlags;
784 
785 		ERROR("%s: GPU(%" B_PRId32 ") %s, revision = 0x%x\n", __func__, found,
786 			kSupportedDevices[type].deviceName, info->revision);
787 
788 		found++;
789 	}
790 
791 	gDeviceNames[found] = NULL;
792 
793 	if (found == 0) {
794 		mutex_destroy(&gLock);
795 		put_module(B_AGP_GART_MODULE_NAME);
796 		put_module(B_PCI_MODULE_NAME);
797 		ERROR("%s: no supported devices found\n", __func__);
798 		return ENODEV;
799 	}
800 
801 	return B_OK;
802 }
803 
804 
805 extern "C" void
806 uninit_driver(void)
807 {
808 	TRACE("%s\n", __func__);
809 
810 	mutex_destroy(&gLock);
811 
812 	// free device related structures
813 	char* name;
814 	for (int32 index = 0; (name = gDeviceNames[index]) != NULL; index++) {
815 		free(gDeviceInfo[index]);
816 		free(name);
817 	}
818 
819 	put_module(B_PCI_MODULE_NAME);
820 }
821 
822 
823 extern "C" device_hooks*
824 find_device(const char* name)
825 {
826 	int index;
827 
828 	TRACE("%s\n", __func__);
829 
830 	for (index = 0; gDeviceNames[index] != NULL; index++) {
831 		if (!strcmp(name, gDeviceNames[index]))
832 			return &gDeviceHooks;
833 	}
834 
835 	ERROR("%s: %s wasn't found!\n", __func__, name);
836 	return NULL;
837 }
838 
839