blob: 389a33090707a80ed64c8cafdd44e0cbd04e4993 [file] [log] [blame]
Chris Wilson42f55512016-06-24 14:00:26 +01001/*
2 * Copyright © 2016 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 */
24
Chris Wilsona09d0ba2016-06-24 14:00:27 +010025#include <linux/console.h>
Chris Wilson42f55512016-06-24 14:00:26 +010026#include <linux/vgaarb.h>
27#include <linux/vga_switcheroo.h>
28
29#include "i915_drv.h"
30
31#define GEN_DEFAULT_PIPEOFFSETS \
32 .pipe_offsets = { PIPE_A_OFFSET, PIPE_B_OFFSET, \
33 PIPE_C_OFFSET, PIPE_EDP_OFFSET }, \
34 .trans_offsets = { TRANSCODER_A_OFFSET, TRANSCODER_B_OFFSET, \
35 TRANSCODER_C_OFFSET, TRANSCODER_EDP_OFFSET }, \
36 .palette_offsets = { PALETTE_A_OFFSET, PALETTE_B_OFFSET }
37
38#define GEN_CHV_PIPEOFFSETS \
39 .pipe_offsets = { PIPE_A_OFFSET, PIPE_B_OFFSET, \
40 CHV_PIPE_C_OFFSET }, \
41 .trans_offsets = { TRANSCODER_A_OFFSET, TRANSCODER_B_OFFSET, \
42 CHV_TRANSCODER_C_OFFSET, }, \
43 .palette_offsets = { PALETTE_A_OFFSET, PALETTE_B_OFFSET, \
44 CHV_PALETTE_C_OFFSET }
45
46#define CURSOR_OFFSETS \
47 .cursor_offsets = { CURSOR_A_OFFSET, CURSOR_B_OFFSET, CHV_CURSOR_C_OFFSET }
48
49#define IVB_CURSOR_OFFSETS \
50 .cursor_offsets = { CURSOR_A_OFFSET, IVB_CURSOR_B_OFFSET, IVB_CURSOR_C_OFFSET }
51
52#define BDW_COLORS \
53 .color = { .degamma_lut_size = 512, .gamma_lut_size = 512 }
54#define CHV_COLORS \
55 .color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }
56
Carlos Santa0eec8dc2016-08-17 12:30:51 -070057#define GEN2_FEATURES \
58 .gen = 2, .num_pipes = 1, \
59 .has_overlay = 1, .overlay_needs_physical = 1, \
Carlos Santa804b8712016-08-17 12:30:55 -070060 .has_gmch_display = 1, \
Carlos Santa31776592016-08-17 12:30:56 -070061 .hws_needs_physical = 1, \
Carlos Santa0eec8dc2016-08-17 12:30:51 -070062 .ring_mask = RENDER_RING, \
63 GEN_DEFAULT_PIPEOFFSETS, \
64 CURSOR_OFFSETS
65
Chris Wilson42f55512016-06-24 14:00:26 +010066static const struct intel_device_info intel_i830_info = {
Carlos Santa0eec8dc2016-08-17 12:30:51 -070067 GEN2_FEATURES,
68 .is_mobile = 1, .cursor_needs_physical = 1,
69 .num_pipes = 2, /* legal, last one wins */
Chris Wilson42f55512016-06-24 14:00:26 +010070};
71
72static const struct intel_device_info intel_845g_info = {
Carlos Santa0eec8dc2016-08-17 12:30:51 -070073 GEN2_FEATURES,
Chris Wilson42f55512016-06-24 14:00:26 +010074};
75
76static const struct intel_device_info intel_i85x_info = {
Carlos Santa0eec8dc2016-08-17 12:30:51 -070077 GEN2_FEATURES,
78 .is_i85x = 1, .is_mobile = 1,
79 .num_pipes = 2, /* legal, last one wins */
Chris Wilson42f55512016-06-24 14:00:26 +010080 .cursor_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +010081 .has_fbc = 1,
Chris Wilson42f55512016-06-24 14:00:26 +010082};
83
84static const struct intel_device_info intel_i865g_info = {
Carlos Santa0eec8dc2016-08-17 12:30:51 -070085 GEN2_FEATURES,
Chris Wilson42f55512016-06-24 14:00:26 +010086};
87
Carlos Santa54d2a6a2016-08-17 12:30:50 -070088#define GEN3_FEATURES \
89 .gen = 3, .num_pipes = 2, \
Carlos Santa804b8712016-08-17 12:30:55 -070090 .has_gmch_display = 1, \
Carlos Santa54d2a6a2016-08-17 12:30:50 -070091 .ring_mask = RENDER_RING, \
92 GEN_DEFAULT_PIPEOFFSETS, \
93 CURSOR_OFFSETS
94
Chris Wilson42f55512016-06-24 14:00:26 +010095static const struct intel_device_info intel_i915g_info = {
Carlos Santa54d2a6a2016-08-17 12:30:50 -070096 GEN3_FEATURES,
97 .is_i915g = 1, .cursor_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +010098 .has_overlay = 1, .overlay_needs_physical = 1,
Carlos Santa31776592016-08-17 12:30:56 -070099 .hws_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100100};
101static const struct intel_device_info intel_i915gm_info = {
Carlos Santa54d2a6a2016-08-17 12:30:50 -0700102 GEN3_FEATURES,
103 .is_mobile = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100104 .cursor_needs_physical = 1,
105 .has_overlay = 1, .overlay_needs_physical = 1,
106 .supports_tv = 1,
107 .has_fbc = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700108 .hws_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100109};
110static const struct intel_device_info intel_i945g_info = {
Carlos Santa54d2a6a2016-08-17 12:30:50 -0700111 GEN3_FEATURES,
112 .has_hotplug = 1, .cursor_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100113 .has_overlay = 1, .overlay_needs_physical = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700114 .hws_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100115};
116static const struct intel_device_info intel_i945gm_info = {
Carlos Santa54d2a6a2016-08-17 12:30:50 -0700117 GEN3_FEATURES,
118 .is_i945gm = 1, .is_mobile = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100119 .has_hotplug = 1, .cursor_needs_physical = 1,
120 .has_overlay = 1, .overlay_needs_physical = 1,
121 .supports_tv = 1,
122 .has_fbc = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700123 .hws_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100124};
125
Carlos Santa4d495be2016-08-17 12:30:49 -0700126#define GEN4_FEATURES \
127 .gen = 4, .num_pipes = 2, \
128 .has_hotplug = 1, \
Carlos Santa804b8712016-08-17 12:30:55 -0700129 .has_gmch_display = 1, \
Carlos Santa4d495be2016-08-17 12:30:49 -0700130 .ring_mask = RENDER_RING, \
131 GEN_DEFAULT_PIPEOFFSETS, \
132 CURSOR_OFFSETS
133
Chris Wilson42f55512016-06-24 14:00:26 +0100134static const struct intel_device_info intel_i965g_info = {
Carlos Santa4d495be2016-08-17 12:30:49 -0700135 GEN4_FEATURES,
136 .is_broadwater = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100137 .has_overlay = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700138 .hws_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100139};
140
141static const struct intel_device_info intel_i965gm_info = {
Carlos Santa4d495be2016-08-17 12:30:49 -0700142 GEN4_FEATURES,
143 .is_crestline = 1,
144 .is_mobile = 1, .has_fbc = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100145 .has_overlay = 1,
146 .supports_tv = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700147 .hws_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100148};
149
150static const struct intel_device_info intel_g33_info = {
Carlos Santa54d2a6a2016-08-17 12:30:50 -0700151 GEN3_FEATURES,
152 .is_g33 = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700153 .has_hotplug = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100154 .has_overlay = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100155};
156
157static const struct intel_device_info intel_g45_info = {
Carlos Santa4d495be2016-08-17 12:30:49 -0700158 GEN4_FEATURES,
Carlos Santa31776592016-08-17 12:30:56 -0700159 .is_g4x = 1,
Carlos Santa4d495be2016-08-17 12:30:49 -0700160 .has_pipe_cxsr = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100161 .ring_mask = RENDER_RING | BSD_RING,
Chris Wilson42f55512016-06-24 14:00:26 +0100162};
163
164static const struct intel_device_info intel_gm45_info = {
Carlos Santa4d495be2016-08-17 12:30:49 -0700165 GEN4_FEATURES,
166 .is_g4x = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700167 .is_mobile = 1, .has_fbc = 1,
Carlos Santa4d495be2016-08-17 12:30:49 -0700168 .has_pipe_cxsr = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100169 .supports_tv = 1,
170 .ring_mask = RENDER_RING | BSD_RING,
Chris Wilson42f55512016-06-24 14:00:26 +0100171};
172
173static const struct intel_device_info intel_pineview_info = {
Carlos Santa54d2a6a2016-08-17 12:30:50 -0700174 GEN3_FEATURES,
175 .is_g33 = 1, .is_pineview = 1, .is_mobile = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700176 .has_hotplug = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100177 .has_overlay = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100178};
179
Carlos Santaa1323382016-08-17 12:30:47 -0700180#define GEN5_FEATURES \
181 .gen = 5, .num_pipes = 2, \
Carlos Santa31776592016-08-17 12:30:56 -0700182 .has_hotplug = 1, \
Carlos Santab355f102016-08-17 12:30:48 -0700183 .has_gmbus_irq = 1, \
Carlos Santaa1323382016-08-17 12:30:47 -0700184 .ring_mask = RENDER_RING | BSD_RING, \
185 GEN_DEFAULT_PIPEOFFSETS, \
186 CURSOR_OFFSETS
187
Chris Wilson42f55512016-06-24 14:00:26 +0100188static const struct intel_device_info intel_ironlake_d_info = {
Carlos Santaa1323382016-08-17 12:30:47 -0700189 GEN5_FEATURES,
Chris Wilson42f55512016-06-24 14:00:26 +0100190};
191
192static const struct intel_device_info intel_ironlake_m_info = {
Carlos Santaa1323382016-08-17 12:30:47 -0700193 GEN5_FEATURES,
194 .is_mobile = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100195};
196
Carlos Santa07db6be2016-08-17 12:30:38 -0700197#define GEN6_FEATURES \
198 .gen = 6, .num_pipes = 2, \
Carlos Santa31776592016-08-17 12:30:56 -0700199 .has_hotplug = 1, \
Carlos Santa07db6be2016-08-17 12:30:38 -0700200 .has_fbc = 1, \
201 .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
202 .has_llc = 1, \
Carlos Santa86f36242016-08-17 12:30:44 -0700203 .has_rc6 = 1, \
Carlos Santa33b5bf82016-08-17 12:30:45 -0700204 .has_rc6p = 1, \
Carlos Santab355f102016-08-17 12:30:48 -0700205 .has_gmbus_irq = 1, \
Carlos Santae1a525362016-08-17 12:30:52 -0700206 .has_hw_contexts = 1, \
Carlos Santa07db6be2016-08-17 12:30:38 -0700207 GEN_DEFAULT_PIPEOFFSETS, \
208 CURSOR_OFFSETS
209
Chris Wilson42f55512016-06-24 14:00:26 +0100210static const struct intel_device_info intel_sandybridge_d_info = {
Carlos Santa07db6be2016-08-17 12:30:38 -0700211 GEN6_FEATURES,
Chris Wilson42f55512016-06-24 14:00:26 +0100212};
213
214static const struct intel_device_info intel_sandybridge_m_info = {
Carlos Santa07db6be2016-08-17 12:30:38 -0700215 GEN6_FEATURES,
216 .is_mobile = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100217};
218
219#define GEN7_FEATURES \
220 .gen = 7, .num_pipes = 3, \
Carlos Santa31776592016-08-17 12:30:56 -0700221 .has_hotplug = 1, \
Chris Wilson42f55512016-06-24 14:00:26 +0100222 .has_fbc = 1, \
223 .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
224 .has_llc = 1, \
Carlos Santa86f36242016-08-17 12:30:44 -0700225 .has_rc6 = 1, \
Carlos Santa33b5bf82016-08-17 12:30:45 -0700226 .has_rc6p = 1, \
Carlos Santab355f102016-08-17 12:30:48 -0700227 .has_gmbus_irq = 1, \
Carlos Santae1a525362016-08-17 12:30:52 -0700228 .has_hw_contexts = 1, \
Chris Wilson42f55512016-06-24 14:00:26 +0100229 GEN_DEFAULT_PIPEOFFSETS, \
230 IVB_CURSOR_OFFSETS
231
232static const struct intel_device_info intel_ivybridge_d_info = {
233 GEN7_FEATURES,
234 .is_ivybridge = 1,
Carlos Santaca9c4522016-08-17 12:30:54 -0700235 .has_l3_dpf = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100236};
237
238static const struct intel_device_info intel_ivybridge_m_info = {
239 GEN7_FEATURES,
240 .is_ivybridge = 1,
241 .is_mobile = 1,
Carlos Santaca9c4522016-08-17 12:30:54 -0700242 .has_l3_dpf = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100243};
244
245static const struct intel_device_info intel_ivybridge_q_info = {
246 GEN7_FEATURES,
247 .is_ivybridge = 1,
248 .num_pipes = 0, /* legal, last one wins */
Carlos Santaca9c4522016-08-17 12:30:54 -0700249 .has_l3_dpf = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100250};
251
252#define VLV_FEATURES \
253 .gen = 7, .num_pipes = 2, \
Carlos Santa6e3b84d2016-08-17 12:30:36 -0700254 .has_psr = 1, \
Carlos Santa4aa4c232016-08-17 12:30:39 -0700255 .has_runtime_pm = 1, \
Carlos Santa86f36242016-08-17 12:30:44 -0700256 .has_rc6 = 1, \
Carlos Santab355f102016-08-17 12:30:48 -0700257 .has_gmbus_irq = 1, \
Carlos Santae1a525362016-08-17 12:30:52 -0700258 .has_hw_contexts = 1, \
Carlos Santa804b8712016-08-17 12:30:55 -0700259 .has_gmch_display = 1, \
Carlos Santa31776592016-08-17 12:30:56 -0700260 .has_hotplug = 1, \
Chris Wilson42f55512016-06-24 14:00:26 +0100261 .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
262 .display_mmio_offset = VLV_DISPLAY_BASE, \
263 GEN_DEFAULT_PIPEOFFSETS, \
264 CURSOR_OFFSETS
265
Carlos Santa8d9c20e2016-08-17 12:30:37 -0700266static const struct intel_device_info intel_valleyview_info = {
Chris Wilson42f55512016-06-24 14:00:26 +0100267 VLV_FEATURES,
268 .is_valleyview = 1,
269};
270
271#define HSW_FEATURES \
272 GEN7_FEATURES, \
273 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
274 .has_ddi = 1, \
Carlos Santa6e3b84d2016-08-17 12:30:36 -0700275 .has_fpga_dbg = 1, \
Carlos Santa4aa4c232016-08-17 12:30:39 -0700276 .has_psr = 1, \
Carlos Santa53233f02016-08-17 12:30:43 -0700277 .has_resource_streamer = 1, \
Carlos Santa1d3fe532016-08-17 12:30:46 -0700278 .has_dp_mst = 1, \
Carlos Santa33b5bf82016-08-17 12:30:45 -0700279 .has_rc6p = 0 /* RC6p removed-by HSW */, \
Carlos Santa4aa4c232016-08-17 12:30:39 -0700280 .has_runtime_pm = 1
Chris Wilson42f55512016-06-24 14:00:26 +0100281
Carlos Santa8d9c20e2016-08-17 12:30:37 -0700282static const struct intel_device_info intel_haswell_info = {
Chris Wilson42f55512016-06-24 14:00:26 +0100283 HSW_FEATURES,
284 .is_haswell = 1,
Carlos Santaca9c4522016-08-17 12:30:54 -0700285 .has_l3_dpf = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100286};
287
Chris Wilson42f55512016-06-24 14:00:26 +0100288#define BDW_FEATURES \
289 HSW_FEATURES, \
Carlos Santa4586f1d2016-08-17 12:30:53 -0700290 BDW_COLORS, \
Joonas Lahtinendfc51482016-11-03 10:39:46 +0200291 .has_logical_ring_contexts = 1, \
292 .has_64bit_reloc = 1
Chris Wilson42f55512016-06-24 14:00:26 +0100293
Carlos Santa8d9c20e2016-08-17 12:30:37 -0700294static const struct intel_device_info intel_broadwell_info = {
Chris Wilson42f55512016-06-24 14:00:26 +0100295 BDW_FEATURES,
296 .gen = 8,
297 .is_broadwell = 1,
298};
299
Carlos Santa8d9c20e2016-08-17 12:30:37 -0700300static const struct intel_device_info intel_broadwell_gt3_info = {
Chris Wilson42f55512016-06-24 14:00:26 +0100301 BDW_FEATURES,
302 .gen = 8,
303 .is_broadwell = 1,
304 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
305};
306
Chris Wilson42f55512016-06-24 14:00:26 +0100307static const struct intel_device_info intel_cherryview_info = {
308 .gen = 8, .num_pipes = 3,
Carlos Santa31776592016-08-17 12:30:56 -0700309 .has_hotplug = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100310 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
311 .is_cherryview = 1,
Joonas Lahtinendfc51482016-11-03 10:39:46 +0200312 .has_64bit_reloc = 1,
Carlos Santa6e3b84d2016-08-17 12:30:36 -0700313 .has_psr = 1,
Carlos Santa4aa4c232016-08-17 12:30:39 -0700314 .has_runtime_pm = 1,
Carlos Santa53233f02016-08-17 12:30:43 -0700315 .has_resource_streamer = 1,
Carlos Santa86f36242016-08-17 12:30:44 -0700316 .has_rc6 = 1,
Carlos Santab355f102016-08-17 12:30:48 -0700317 .has_gmbus_irq = 1,
Carlos Santae1a525362016-08-17 12:30:52 -0700318 .has_hw_contexts = 1,
Carlos Santa4586f1d2016-08-17 12:30:53 -0700319 .has_logical_ring_contexts = 1,
Carlos Santa804b8712016-08-17 12:30:55 -0700320 .has_gmch_display = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100321 .display_mmio_offset = VLV_DISPLAY_BASE,
322 GEN_CHV_PIPEOFFSETS,
323 CURSOR_OFFSETS,
324 CHV_COLORS,
325};
326
327static const struct intel_device_info intel_skylake_info = {
328 BDW_FEATURES,
329 .is_skylake = 1,
330 .gen = 9,
Carlos Santa3bacde12016-08-17 12:30:42 -0700331 .has_csr = 1,
Carlos Santa3d810fb2016-08-17 12:30:57 -0700332 .has_guc = 1,
Deepak M6f3fff62016-09-15 15:01:10 +0530333 .ddb_size = 896,
Chris Wilson42f55512016-06-24 14:00:26 +0100334};
335
336static const struct intel_device_info intel_skylake_gt3_info = {
337 BDW_FEATURES,
338 .is_skylake = 1,
339 .gen = 9,
Carlos Santa3bacde12016-08-17 12:30:42 -0700340 .has_csr = 1,
Carlos Santa3d810fb2016-08-17 12:30:57 -0700341 .has_guc = 1,
Deepak M6f3fff62016-09-15 15:01:10 +0530342 .ddb_size = 896,
Chris Wilson42f55512016-06-24 14:00:26 +0100343 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
344};
345
Rodrigo Vivi80fa66b2016-12-01 11:33:16 +0200346#define GEN9_LP_FEATURES \
347 .gen = 9, \
Ander Conselvan de Oliveira3e4274f2016-11-10 17:23:09 +0200348 .is_lp = 1, \
Rodrigo Vivi80fa66b2016-12-01 11:33:16 +0200349 .has_hotplug = 1, \
350 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
351 .num_pipes = 3, \
352 .has_64bit_reloc = 1, \
353 .has_ddi = 1, \
354 .has_fpga_dbg = 1, \
355 .has_fbc = 1, \
356 .has_runtime_pm = 1, \
357 .has_pooled_eu = 0, \
358 .has_csr = 1, \
359 .has_resource_streamer = 1, \
360 .has_rc6 = 1, \
361 .has_dp_mst = 1, \
362 .has_gmbus_irq = 1, \
363 .has_hw_contexts = 1, \
364 .has_logical_ring_contexts = 1, \
365 .has_guc = 1, \
366 .has_decoupled_mmio = 1, \
367 GEN_DEFAULT_PIPEOFFSETS, \
368 IVB_CURSOR_OFFSETS, \
369 BDW_COLORS
370
Chris Wilson42f55512016-06-24 14:00:26 +0100371static const struct intel_device_info intel_broxton_info = {
Chris Wilson42f55512016-06-24 14:00:26 +0100372 .is_broxton = 1,
Rodrigo Vivi80fa66b2016-12-01 11:33:16 +0200373 GEN9_LP_FEATURES,
Deepak M6f3fff62016-09-15 15:01:10 +0530374 .ddb_size = 512,
Chris Wilson42f55512016-06-24 14:00:26 +0100375};
376
Ander Conselvan de Oliveirac22097f2016-11-14 16:25:26 +0200377static const struct intel_device_info intel_geminilake_info = {
378 .is_alpha_support = 1,
379 .is_geminilake = 1,
380 GEN9_LP_FEATURES,
381 .ddb_size = 1024,
382};
383
Chris Wilson42f55512016-06-24 14:00:26 +0100384static const struct intel_device_info intel_kabylake_info = {
385 BDW_FEATURES,
386 .is_kabylake = 1,
387 .gen = 9,
Carlos Santa3bacde12016-08-17 12:30:42 -0700388 .has_csr = 1,
Carlos Santa3d810fb2016-08-17 12:30:57 -0700389 .has_guc = 1,
Deepak M6f3fff62016-09-15 15:01:10 +0530390 .ddb_size = 896,
Chris Wilson42f55512016-06-24 14:00:26 +0100391};
392
393static const struct intel_device_info intel_kabylake_gt3_info = {
394 BDW_FEATURES,
395 .is_kabylake = 1,
396 .gen = 9,
Carlos Santa3bacde12016-08-17 12:30:42 -0700397 .has_csr = 1,
Carlos Santa3d810fb2016-08-17 12:30:57 -0700398 .has_guc = 1,
Deepak M6f3fff62016-09-15 15:01:10 +0530399 .ddb_size = 896,
Chris Wilson42f55512016-06-24 14:00:26 +0100400 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
401};
402
403/*
404 * Make sure any device matches here are from most specific to most
405 * general. For example, since the Quanta match is based on the subsystem
406 * and subvendor IDs, we need it to come before the more general IVB
407 * PCI ID matches, otherwise we'll use the wrong info struct above.
408 */
409static const struct pci_device_id pciidlist[] = {
410 INTEL_I830_IDS(&intel_i830_info),
411 INTEL_I845G_IDS(&intel_845g_info),
412 INTEL_I85X_IDS(&intel_i85x_info),
413 INTEL_I865G_IDS(&intel_i865g_info),
414 INTEL_I915G_IDS(&intel_i915g_info),
415 INTEL_I915GM_IDS(&intel_i915gm_info),
416 INTEL_I945G_IDS(&intel_i945g_info),
417 INTEL_I945GM_IDS(&intel_i945gm_info),
418 INTEL_I965G_IDS(&intel_i965g_info),
419 INTEL_G33_IDS(&intel_g33_info),
420 INTEL_I965GM_IDS(&intel_i965gm_info),
421 INTEL_GM45_IDS(&intel_gm45_info),
422 INTEL_G45_IDS(&intel_g45_info),
423 INTEL_PINEVIEW_IDS(&intel_pineview_info),
424 INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info),
425 INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info),
426 INTEL_SNB_D_IDS(&intel_sandybridge_d_info),
427 INTEL_SNB_M_IDS(&intel_sandybridge_m_info),
428 INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */
429 INTEL_IVB_M_IDS(&intel_ivybridge_m_info),
430 INTEL_IVB_D_IDS(&intel_ivybridge_d_info),
Carlos Santa8d9c20e2016-08-17 12:30:37 -0700431 INTEL_HSW_IDS(&intel_haswell_info),
432 INTEL_VLV_IDS(&intel_valleyview_info),
433 INTEL_BDW_GT12_IDS(&intel_broadwell_info),
434 INTEL_BDW_GT3_IDS(&intel_broadwell_gt3_info),
Chris Wilson42f55512016-06-24 14:00:26 +0100435 INTEL_CHV_IDS(&intel_cherryview_info),
436 INTEL_SKL_GT1_IDS(&intel_skylake_info),
437 INTEL_SKL_GT2_IDS(&intel_skylake_info),
438 INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info),
439 INTEL_SKL_GT4_IDS(&intel_skylake_gt3_info),
440 INTEL_BXT_IDS(&intel_broxton_info),
Ander Conselvan de Oliveira8363e3c2016-11-10 17:23:08 +0200441 INTEL_GLK_IDS(&intel_geminilake_info),
Chris Wilson42f55512016-06-24 14:00:26 +0100442 INTEL_KBL_GT1_IDS(&intel_kabylake_info),
443 INTEL_KBL_GT2_IDS(&intel_kabylake_info),
444 INTEL_KBL_GT3_IDS(&intel_kabylake_gt3_info),
445 INTEL_KBL_GT4_IDS(&intel_kabylake_gt3_info),
446 {0, 0, 0}
447};
448MODULE_DEVICE_TABLE(pci, pciidlist);
449
Chris Wilson42f55512016-06-24 14:00:26 +0100450static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
451{
452 struct intel_device_info *intel_info =
453 (struct intel_device_info *) ent->driver_data;
454
Jani Nikulac007fb42016-10-31 12:18:28 +0200455 if (IS_ALPHA_SUPPORT(intel_info) && !i915.alpha_support) {
456 DRM_INFO("The driver support for your hardware in this kernel version is alpha quality\n"
457 "See CONFIG_DRM_I915_ALPHA_SUPPORT or i915.alpha_support module parameter\n"
458 "to enable support in this kernel version, or check for kernel updates.\n");
Chris Wilson42f55512016-06-24 14:00:26 +0100459 return -ENODEV;
460 }
461
462 /* Only bind to function 0 of the device. Early generations
463 * used function 1 as a placeholder for multi-head. This causes
464 * us confusion instead, especially on the systems where both
465 * functions have the same PCI-ID!
466 */
467 if (PCI_FUNC(pdev->devfn))
468 return -ENODEV;
469
470 /*
471 * apple-gmux is needed on dual GPU MacBook Pro
472 * to probe the panel if we're the inactive GPU.
473 */
474 if (vga_switcheroo_client_probe_defer(pdev))
475 return -EPROBE_DEFER;
476
477 return i915_driver_load(pdev, ent);
478}
479
Chris Wilson42f55512016-06-24 14:00:26 +0100480static void i915_pci_remove(struct pci_dev *pdev)
481{
482 struct drm_device *dev = pci_get_drvdata(pdev);
483
484 i915_driver_unload(dev);
485 drm_dev_unref(dev);
486}
487
Chris Wilsona09d0ba2016-06-24 14:00:27 +0100488static struct pci_driver i915_pci_driver = {
Chris Wilson42f55512016-06-24 14:00:26 +0100489 .name = DRIVER_NAME,
490 .id_table = pciidlist,
491 .probe = i915_pci_probe,
492 .remove = i915_pci_remove,
493 .driver.pm = &i915_pm_ops,
494};
Chris Wilsona09d0ba2016-06-24 14:00:27 +0100495
496static int __init i915_init(void)
497{
498 bool use_kms = true;
499
500 /*
501 * Enable KMS by default, unless explicitly overriden by
502 * either the i915.modeset prarameter or by the
503 * vga_text_mode_force boot option.
504 */
505
506 if (i915.modeset == 0)
507 use_kms = false;
508
509 if (vgacon_text_force() && i915.modeset == -1)
510 use_kms = false;
511
512 if (!use_kms) {
513 /* Silently fail loading to not upset userspace. */
514 DRM_DEBUG_DRIVER("KMS disabled.\n");
515 return 0;
516 }
517
518 return pci_register_driver(&i915_pci_driver);
519}
520
521static void __exit i915_exit(void)
522{
523 if (!i915_pci_driver.driver.owner)
524 return;
525
526 pci_unregister_driver(&i915_pci_driver);
527}
528
529module_init(i915_init);
530module_exit(i915_exit);
531
532MODULE_AUTHOR("Tungsten Graphics, Inc.");
533MODULE_AUTHOR("Intel Corporation");
534
535MODULE_DESCRIPTION(DRIVER_DESC);
536MODULE_LICENSE("GPL and additional rights");