i915: Remove most of the code under gen >= 4 checks.
[mesa.git] / src / mesa / drivers / dri / i965 / intel_chipset.h
1 /*
2 * Copyright © 2007 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 * Authors:
24 * Eric Anholt <eric@anholt.net>
25 *
26 */
27
28 #define PCI_CHIP_I810 0x7121
29 #define PCI_CHIP_I810_DC100 0x7123
30 #define PCI_CHIP_I810_E 0x7125
31 #define PCI_CHIP_I815 0x1132
32
33 #define PCI_CHIP_I830_M 0x3577
34 #define PCI_CHIP_845_G 0x2562
35 #define PCI_CHIP_I855_GM 0x3582
36 #define PCI_CHIP_I865_G 0x2572
37
38 #define PCI_CHIP_I915_G 0x2582
39 #define PCI_CHIP_E7221_G 0x258A
40 #define PCI_CHIP_I915_GM 0x2592
41 #define PCI_CHIP_I945_G 0x2772
42 #define PCI_CHIP_I945_GM 0x27A2
43 #define PCI_CHIP_I945_GME 0x27AE
44
45 #define PCI_CHIP_Q35_G 0x29B2
46 #define PCI_CHIP_G33_G 0x29C2
47 #define PCI_CHIP_Q33_G 0x29D2
48
49 #define PCI_CHIP_IGD_GM 0xA011
50 #define PCI_CHIP_IGD_G 0xA001
51
52 #define IS_IGDGM(devid) (devid == PCI_CHIP_IGD_GM)
53 #define IS_IGDG(devid) (devid == PCI_CHIP_IGD_G)
54 #define IS_IGD(devid) (IS_IGDG(devid) || IS_IGDGM(devid))
55
56 #define PCI_CHIP_I965_G 0x29A2
57 #define PCI_CHIP_I965_Q 0x2992
58 #define PCI_CHIP_I965_G_1 0x2982
59 #define PCI_CHIP_I946_GZ 0x2972
60 #define PCI_CHIP_I965_GM 0x2A02
61 #define PCI_CHIP_I965_GME 0x2A12
62
63 #define PCI_CHIP_GM45_GM 0x2A42
64
65 #define PCI_CHIP_IGD_E_G 0x2E02
66 #define PCI_CHIP_Q45_G 0x2E12
67 #define PCI_CHIP_G45_G 0x2E22
68 #define PCI_CHIP_G41_G 0x2E32
69 #define PCI_CHIP_B43_G 0x2E42
70 #define PCI_CHIP_B43_G1 0x2E92
71
72 #define PCI_CHIP_ILD_G 0x0042
73 #define PCI_CHIP_ILM_G 0x0046
74
75 #define PCI_CHIP_SANDYBRIDGE_GT1 0x0102 /* Desktop */
76 #define PCI_CHIP_SANDYBRIDGE_GT2 0x0112
77 #define PCI_CHIP_SANDYBRIDGE_GT2_PLUS 0x0122
78 #define PCI_CHIP_SANDYBRIDGE_M_GT1 0x0106 /* Mobile */
79 #define PCI_CHIP_SANDYBRIDGE_M_GT2 0x0116
80 #define PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS 0x0126
81 #define PCI_CHIP_SANDYBRIDGE_S 0x010A /* Server */
82
83 #define PCI_CHIP_IVYBRIDGE_GT1 0x0152 /* Desktop */
84 #define PCI_CHIP_IVYBRIDGE_GT2 0x0162
85 #define PCI_CHIP_IVYBRIDGE_M_GT1 0x0156 /* Mobile */
86 #define PCI_CHIP_IVYBRIDGE_M_GT2 0x0166
87 #define PCI_CHIP_IVYBRIDGE_S_GT1 0x015a /* Server */
88 #define PCI_CHIP_IVYBRIDGE_S_GT2 0x016a
89
90 #define PCI_CHIP_BAYTRAIL_M_1 0x0F31
91 #define PCI_CHIP_BAYTRAIL_M_2 0x0F32
92 #define PCI_CHIP_BAYTRAIL_M_3 0x0F33
93 #define PCI_CHIP_BAYTRAIL_M_4 0x0157
94 #define PCI_CHIP_BAYTRAIL_D 0x0155
95
96 #define PCI_CHIP_HASWELL_GT1 0x0402 /* Desktop */
97 #define PCI_CHIP_HASWELL_GT2 0x0412
98 #define PCI_CHIP_HASWELL_GT3 0x0422
99 #define PCI_CHIP_HASWELL_M_GT1 0x0406 /* Mobile */
100 #define PCI_CHIP_HASWELL_M_GT2 0x0416
101 #define PCI_CHIP_HASWELL_M_GT3 0x0426
102 #define PCI_CHIP_HASWELL_S_GT1 0x040A /* Server */
103 #define PCI_CHIP_HASWELL_S_GT2 0x041A
104 #define PCI_CHIP_HASWELL_S_GT3 0x042A
105 #define PCI_CHIP_HASWELL_B_GT1 0x040B /* Reserved */
106 #define PCI_CHIP_HASWELL_B_GT2 0x041B
107 #define PCI_CHIP_HASWELL_B_GT3 0x042B
108 #define PCI_CHIP_HASWELL_E_GT1 0x040E /* Reserved */
109 #define PCI_CHIP_HASWELL_E_GT2 0x041E
110 #define PCI_CHIP_HASWELL_E_GT3 0x042E
111 #define PCI_CHIP_HASWELL_SDV_GT1 0x0C02 /* Desktop */
112 #define PCI_CHIP_HASWELL_SDV_GT2 0x0C12
113 #define PCI_CHIP_HASWELL_SDV_GT3 0x0C22
114 #define PCI_CHIP_HASWELL_SDV_M_GT1 0x0C06 /* Mobile */
115 #define PCI_CHIP_HASWELL_SDV_M_GT2 0x0C16
116 #define PCI_CHIP_HASWELL_SDV_M_GT3 0x0C26
117 #define PCI_CHIP_HASWELL_SDV_S_GT1 0x0C0A /* Server */
118 #define PCI_CHIP_HASWELL_SDV_S_GT2 0x0C1A
119 #define PCI_CHIP_HASWELL_SDV_S_GT3 0x0C2A
120 #define PCI_CHIP_HASWELL_SDV_B_GT1 0x0C0B /* Reserved */
121 #define PCI_CHIP_HASWELL_SDV_B_GT2 0x0C1B
122 #define PCI_CHIP_HASWELL_SDV_B_GT3 0x0C2B
123 #define PCI_CHIP_HASWELL_SDV_E_GT1 0x0C0E /* Reserved */
124 #define PCI_CHIP_HASWELL_SDV_E_GT2 0x0C1E
125 #define PCI_CHIP_HASWELL_SDV_E_GT3 0x0C2E
126 #define PCI_CHIP_HASWELL_ULT_GT1 0x0A02 /* Desktop */
127 #define PCI_CHIP_HASWELL_ULT_GT2 0x0A12
128 #define PCI_CHIP_HASWELL_ULT_GT3 0x0A22
129 #define PCI_CHIP_HASWELL_ULT_M_GT1 0x0A06 /* Mobile */
130 #define PCI_CHIP_HASWELL_ULT_M_GT2 0x0A16
131 #define PCI_CHIP_HASWELL_ULT_M_GT3 0x0A26
132 #define PCI_CHIP_HASWELL_ULT_S_GT1 0x0A0A /* Server */
133 #define PCI_CHIP_HASWELL_ULT_S_GT2 0x0A1A
134 #define PCI_CHIP_HASWELL_ULT_S_GT3 0x0A2A
135 #define PCI_CHIP_HASWELL_ULT_B_GT1 0x0A0B /* Reserved */
136 #define PCI_CHIP_HASWELL_ULT_B_GT2 0x0A1B
137 #define PCI_CHIP_HASWELL_ULT_B_GT3 0x0A2B
138 #define PCI_CHIP_HASWELL_ULT_E_GT1 0x0A0E /* Reserved */
139 #define PCI_CHIP_HASWELL_ULT_E_GT2 0x0A1E
140 #define PCI_CHIP_HASWELL_ULT_E_GT3 0x0A2E
141 #define PCI_CHIP_HASWELL_CRW_GT1 0x0D02 /* Desktop */
142 #define PCI_CHIP_HASWELL_CRW_GT2 0x0D12
143 #define PCI_CHIP_HASWELL_CRW_GT3 0x0D22
144 #define PCI_CHIP_HASWELL_CRW_M_GT1 0x0D06 /* Mobile */
145 #define PCI_CHIP_HASWELL_CRW_M_GT2 0x0D16
146 #define PCI_CHIP_HASWELL_CRW_M_GT3 0x0D26
147 #define PCI_CHIP_HASWELL_CRW_S_GT1 0x0D0A /* Server */
148 #define PCI_CHIP_HASWELL_CRW_S_GT2 0x0D1A
149 #define PCI_CHIP_HASWELL_CRW_S_GT3 0x0D2A
150 #define PCI_CHIP_HASWELL_CRW_B_GT1 0x0D0B /* Reserved */
151 #define PCI_CHIP_HASWELL_CRW_B_GT2 0x0D1B
152 #define PCI_CHIP_HASWELL_CRW_B_GT3 0x0D2B
153 #define PCI_CHIP_HASWELL_CRW_E_GT1 0x0D0E /* Reserved */
154 #define PCI_CHIP_HASWELL_CRW_E_GT2 0x0D1E
155 #define PCI_CHIP_HASWELL_CRW_E_GT3 0x0D2E
156
157 #define IS_MOBILE(devid) (devid == PCI_CHIP_I855_GM || \
158 devid == PCI_CHIP_I915_GM || \
159 devid == PCI_CHIP_I945_GM || \
160 devid == PCI_CHIP_I945_GME || \
161 devid == PCI_CHIP_I965_GM || \
162 devid == PCI_CHIP_I965_GME || \
163 devid == PCI_CHIP_GM45_GM || \
164 IS_IGD(devid) || \
165 devid == PCI_CHIP_ILM_G)
166
167 #define IS_G45(devid) (devid == PCI_CHIP_IGD_E_G || \
168 devid == PCI_CHIP_Q45_G || \
169 devid == PCI_CHIP_G45_G || \
170 devid == PCI_CHIP_G41_G || \
171 devid == PCI_CHIP_B43_G || \
172 devid == PCI_CHIP_B43_G1)
173 #define IS_GM45(devid) (devid == PCI_CHIP_GM45_GM)
174 #define IS_G4X(devid) (IS_G45(devid) || IS_GM45(devid))
175
176 #define IS_ILD(devid) (devid == PCI_CHIP_ILD_G)
177 #define IS_ILM(devid) (devid == PCI_CHIP_ILM_G)
178 #define IS_GEN5(devid) (IS_ILD(devid) || IS_ILM(devid))
179
180 #define IS_915(devid) (devid == PCI_CHIP_I915_G || \
181 devid == PCI_CHIP_E7221_G || \
182 devid == PCI_CHIP_I915_GM)
183
184 #define IS_945(devid) (devid == PCI_CHIP_I945_G || \
185 devid == PCI_CHIP_I945_GM || \
186 devid == PCI_CHIP_I945_GME || \
187 devid == PCI_CHIP_G33_G || \
188 devid == PCI_CHIP_Q33_G || \
189 devid == PCI_CHIP_Q35_G || IS_IGD(devid))
190
191 #define IS_GEN4(devid) (devid == PCI_CHIP_I965_G || \
192 devid == PCI_CHIP_I965_Q || \
193 devid == PCI_CHIP_I965_G_1 || \
194 devid == PCI_CHIP_I965_GM || \
195 devid == PCI_CHIP_I965_GME || \
196 devid == PCI_CHIP_I946_GZ || \
197 IS_G4X(devid))
198
199 /* Compat macro for intel_decode.c */
200 #define IS_IRONLAKE(devid) IS_GEN5(devid)
201
202 #define IS_SNB_GT1(devid) (devid == PCI_CHIP_SANDYBRIDGE_GT1 || \
203 devid == PCI_CHIP_SANDYBRIDGE_M_GT1 || \
204 devid == PCI_CHIP_SANDYBRIDGE_S)
205
206 #define IS_SNB_GT2(devid) (devid == PCI_CHIP_SANDYBRIDGE_GT2 || \
207 devid == PCI_CHIP_SANDYBRIDGE_GT2_PLUS || \
208 devid == PCI_CHIP_SANDYBRIDGE_M_GT2 || \
209 devid == PCI_CHIP_SANDYBRIDGE_M_GT2_PLUS)
210
211 #define IS_GEN6(devid) (IS_SNB_GT1(devid) || IS_SNB_GT2(devid))
212
213 #define IS_IVB_GT1(devid) (devid == PCI_CHIP_IVYBRIDGE_GT1 || \
214 devid == PCI_CHIP_IVYBRIDGE_M_GT1 || \
215 devid == PCI_CHIP_IVYBRIDGE_S_GT1)
216
217 #define IS_IVB_GT2(devid) (devid == PCI_CHIP_IVYBRIDGE_GT2 || \
218 devid == PCI_CHIP_IVYBRIDGE_M_GT2 || \
219 devid == PCI_CHIP_IVYBRIDGE_S_GT2)
220
221 #define IS_IVYBRIDGE(devid) (IS_IVB_GT1(devid) || IS_IVB_GT2(devid))
222
223 #define IS_BAYTRAIL(devid) (devid == PCI_CHIP_BAYTRAIL_M_1 || \
224 devid == PCI_CHIP_BAYTRAIL_M_2 || \
225 devid == PCI_CHIP_BAYTRAIL_M_3 || \
226 devid == PCI_CHIP_BAYTRAIL_M_4 || \
227 devid == PCI_CHIP_BAYTRAIL_D)
228
229 #define IS_GEN7(devid) (IS_IVYBRIDGE(devid) || \
230 IS_BAYTRAIL(devid) || \
231 IS_HASWELL(devid))
232
233 #define IS_HSW_GT1(devid) (devid == PCI_CHIP_HASWELL_GT1 || \
234 devid == PCI_CHIP_HASWELL_M_GT1 || \
235 devid == PCI_CHIP_HASWELL_S_GT1 || \
236 devid == PCI_CHIP_HASWELL_B_GT1 || \
237 devid == PCI_CHIP_HASWELL_E_GT1 || \
238 devid == PCI_CHIP_HASWELL_SDV_GT1 || \
239 devid == PCI_CHIP_HASWELL_SDV_M_GT1 || \
240 devid == PCI_CHIP_HASWELL_SDV_S_GT1 || \
241 devid == PCI_CHIP_HASWELL_SDV_B_GT1 || \
242 devid == PCI_CHIP_HASWELL_SDV_E_GT1 || \
243 devid == PCI_CHIP_HASWELL_ULT_GT1 || \
244 devid == PCI_CHIP_HASWELL_ULT_M_GT1 || \
245 devid == PCI_CHIP_HASWELL_ULT_S_GT1 || \
246 devid == PCI_CHIP_HASWELL_ULT_B_GT1 || \
247 devid == PCI_CHIP_HASWELL_ULT_E_GT1 || \
248 devid == PCI_CHIP_HASWELL_CRW_GT1 || \
249 devid == PCI_CHIP_HASWELL_CRW_M_GT1 || \
250 devid == PCI_CHIP_HASWELL_CRW_S_GT1 || \
251 devid == PCI_CHIP_HASWELL_CRW_B_GT1 || \
252 devid == PCI_CHIP_HASWELL_CRW_E_GT1)
253 #define IS_HSW_GT2(devid) (devid == PCI_CHIP_HASWELL_GT2 || \
254 devid == PCI_CHIP_HASWELL_M_GT2 || \
255 devid == PCI_CHIP_HASWELL_S_GT2 || \
256 devid == PCI_CHIP_HASWELL_B_GT2 || \
257 devid == PCI_CHIP_HASWELL_E_GT2 || \
258 devid == PCI_CHIP_HASWELL_SDV_GT2 || \
259 devid == PCI_CHIP_HASWELL_SDV_M_GT2 || \
260 devid == PCI_CHIP_HASWELL_SDV_S_GT2 || \
261 devid == PCI_CHIP_HASWELL_SDV_B_GT2 || \
262 devid == PCI_CHIP_HASWELL_SDV_E_GT2 || \
263 devid == PCI_CHIP_HASWELL_ULT_GT2 || \
264 devid == PCI_CHIP_HASWELL_ULT_M_GT2 || \
265 devid == PCI_CHIP_HASWELL_ULT_S_GT2 || \
266 devid == PCI_CHIP_HASWELL_ULT_B_GT2 || \
267 devid == PCI_CHIP_HASWELL_ULT_E_GT2 || \
268 devid == PCI_CHIP_HASWELL_CRW_GT2 || \
269 devid == PCI_CHIP_HASWELL_CRW_M_GT2 || \
270 devid == PCI_CHIP_HASWELL_CRW_S_GT2 || \
271 devid == PCI_CHIP_HASWELL_CRW_B_GT2 || \
272 devid == PCI_CHIP_HASWELL_CRW_E_GT2)
273 #define IS_HSW_GT3(devid) (devid == PCI_CHIP_HASWELL_GT3 || \
274 devid == PCI_CHIP_HASWELL_M_GT3 || \
275 devid == PCI_CHIP_HASWELL_S_GT3 || \
276 devid == PCI_CHIP_HASWELL_B_GT3 || \
277 devid == PCI_CHIP_HASWELL_E_GT3 || \
278 devid == PCI_CHIP_HASWELL_SDV_GT3 || \
279 devid == PCI_CHIP_HASWELL_SDV_M_GT3 || \
280 devid == PCI_CHIP_HASWELL_SDV_S_GT3 || \
281 devid == PCI_CHIP_HASWELL_SDV_B_GT3 || \
282 devid == PCI_CHIP_HASWELL_SDV_E_GT3 || \
283 devid == PCI_CHIP_HASWELL_ULT_GT3 || \
284 devid == PCI_CHIP_HASWELL_ULT_M_GT3 || \
285 devid == PCI_CHIP_HASWELL_ULT_S_GT3 || \
286 devid == PCI_CHIP_HASWELL_ULT_B_GT3 || \
287 devid == PCI_CHIP_HASWELL_ULT_E_GT3 || \
288 devid == PCI_CHIP_HASWELL_CRW_GT3 || \
289 devid == PCI_CHIP_HASWELL_CRW_M_GT3 || \
290 devid == PCI_CHIP_HASWELL_CRW_S_GT3 || \
291 devid == PCI_CHIP_HASWELL_CRW_B_GT3 || \
292 devid == PCI_CHIP_HASWELL_CRW_E_GT3)
293
294 #define IS_HASWELL(devid) (IS_HSW_GT1(devid) || \
295 IS_HSW_GT2(devid) || \
296 IS_HSW_GT3(devid))
297
298 #define IS_965(devid) (IS_GEN4(devid) || \
299 IS_G4X(devid) || \
300 IS_GEN5(devid) || \
301 IS_GEN6(devid) || \
302 IS_GEN7(devid))
303
304 #define IS_9XX(devid) (IS_915(devid) || \
305 IS_945(devid) || \
306 IS_965(devid))
307
308 #define IS_GEN3(devid) (IS_915(devid) || \
309 IS_945(devid))
310
311 #define IS_GEN2(devid) (devid == PCI_CHIP_I830_M || \
312 devid == PCI_CHIP_845_G || \
313 devid == PCI_CHIP_I855_GM || \
314 devid == PCI_CHIP_I865_G)