blob: 7435a73f6bc6c169a8c1db1b5a39292d8eb992aa [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
Jani Nikulaa5ce9292016-11-30 17:43:02 +020057/* Keep in gen based order, and chronological order within a gen */
Carlos Santa0eec8dc2016-08-17 12:30:51 -070058#define GEN2_FEATURES \
59 .gen = 2, .num_pipes = 1, \
60 .has_overlay = 1, .overlay_needs_physical = 1, \
Carlos Santa804b8712016-08-17 12:30:55 -070061 .has_gmch_display = 1, \
Carlos Santa31776592016-08-17 12:30:56 -070062 .hws_needs_physical = 1, \
Carlos Santa0eec8dc2016-08-17 12:30:51 -070063 .ring_mask = RENDER_RING, \
64 GEN_DEFAULT_PIPEOFFSETS, \
65 CURSOR_OFFSETS
66
Chris Wilson42f55512016-06-24 14:00:26 +010067static const struct intel_device_info intel_i830_info = {
Carlos Santa0eec8dc2016-08-17 12:30:51 -070068 GEN2_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +020069 .platform = INTEL_I830,
Carlos Santa0eec8dc2016-08-17 12:30:51 -070070 .is_mobile = 1, .cursor_needs_physical = 1,
71 .num_pipes = 2, /* legal, last one wins */
Chris Wilson42f55512016-06-24 14:00:26 +010072};
73
Jani Nikula2a307c22016-11-30 17:43:04 +020074static const struct intel_device_info intel_i845g_info = {
Carlos Santa0eec8dc2016-08-17 12:30:51 -070075 GEN2_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +020076 .platform = INTEL_I845G,
Chris Wilson42f55512016-06-24 14:00:26 +010077};
78
79static const struct intel_device_info intel_i85x_info = {
Carlos Santa0eec8dc2016-08-17 12:30:51 -070080 GEN2_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +020081 .platform = INTEL_I85X, .is_mobile = 1,
Carlos Santa0eec8dc2016-08-17 12:30:51 -070082 .num_pipes = 2, /* legal, last one wins */
Chris Wilson42f55512016-06-24 14:00:26 +010083 .cursor_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +010084 .has_fbc = 1,
Chris Wilson42f55512016-06-24 14:00:26 +010085};
86
87static const struct intel_device_info intel_i865g_info = {
Carlos Santa0eec8dc2016-08-17 12:30:51 -070088 GEN2_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +020089 .platform = INTEL_I865G,
Chris Wilson42f55512016-06-24 14:00:26 +010090};
91
Carlos Santa54d2a6a2016-08-17 12:30:50 -070092#define GEN3_FEATURES \
93 .gen = 3, .num_pipes = 2, \
Carlos Santa804b8712016-08-17 12:30:55 -070094 .has_gmch_display = 1, \
Carlos Santa54d2a6a2016-08-17 12:30:50 -070095 .ring_mask = RENDER_RING, \
96 GEN_DEFAULT_PIPEOFFSETS, \
97 CURSOR_OFFSETS
98
Chris Wilson42f55512016-06-24 14:00:26 +010099static const struct intel_device_info intel_i915g_info = {
Carlos Santa54d2a6a2016-08-17 12:30:50 -0700100 GEN3_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200101 .platform = INTEL_I915G, .cursor_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100102 .has_overlay = 1, .overlay_needs_physical = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700103 .hws_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100104};
Jani Nikulaa5ce9292016-11-30 17:43:02 +0200105
Chris Wilson42f55512016-06-24 14:00:26 +0100106static const struct intel_device_info intel_i915gm_info = {
Carlos Santa54d2a6a2016-08-17 12:30:50 -0700107 GEN3_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200108 .platform = INTEL_I915GM,
Carlos Santa54d2a6a2016-08-17 12:30:50 -0700109 .is_mobile = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100110 .cursor_needs_physical = 1,
111 .has_overlay = 1, .overlay_needs_physical = 1,
112 .supports_tv = 1,
113 .has_fbc = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700114 .hws_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100115};
Jani Nikulaa5ce9292016-11-30 17:43:02 +0200116
Chris Wilson42f55512016-06-24 14:00:26 +0100117static const struct intel_device_info intel_i945g_info = {
Carlos Santa54d2a6a2016-08-17 12:30:50 -0700118 GEN3_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200119 .platform = INTEL_I945G,
Carlos Santa54d2a6a2016-08-17 12:30:50 -0700120 .has_hotplug = 1, .cursor_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100121 .has_overlay = 1, .overlay_needs_physical = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700122 .hws_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100123};
Jani Nikulaa5ce9292016-11-30 17:43:02 +0200124
Chris Wilson42f55512016-06-24 14:00:26 +0100125static const struct intel_device_info intel_i945gm_info = {
Carlos Santa54d2a6a2016-08-17 12:30:50 -0700126 GEN3_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200127 .platform = INTEL_I945GM, .is_mobile = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100128 .has_hotplug = 1, .cursor_needs_physical = 1,
129 .has_overlay = 1, .overlay_needs_physical = 1,
130 .supports_tv = 1,
131 .has_fbc = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700132 .hws_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100133};
134
Jani Nikulaa5ce9292016-11-30 17:43:02 +0200135static const struct intel_device_info intel_g33_info = {
136 GEN3_FEATURES,
137 .platform = INTEL_G33,
138 .has_hotplug = 1,
139 .has_overlay = 1,
140};
141
142static const struct intel_device_info intel_pineview_info = {
143 GEN3_FEATURES,
Jani Nikula73f67aa2016-12-07 22:48:09 +0200144 .platform = INTEL_PINEVIEW, .is_mobile = 1,
Jani Nikulaa5ce9292016-11-30 17:43:02 +0200145 .has_hotplug = 1,
146 .has_overlay = 1,
147};
148
Carlos Santa4d495be2016-08-17 12:30:49 -0700149#define GEN4_FEATURES \
150 .gen = 4, .num_pipes = 2, \
151 .has_hotplug = 1, \
Carlos Santa804b8712016-08-17 12:30:55 -0700152 .has_gmch_display = 1, \
Carlos Santa4d495be2016-08-17 12:30:49 -0700153 .ring_mask = RENDER_RING, \
154 GEN_DEFAULT_PIPEOFFSETS, \
155 CURSOR_OFFSETS
156
Chris Wilson42f55512016-06-24 14:00:26 +0100157static const struct intel_device_info intel_i965g_info = {
Carlos Santa4d495be2016-08-17 12:30:49 -0700158 GEN4_FEATURES,
Jani Nikulac0f86832016-12-07 12:13:04 +0200159 .platform = INTEL_I965G,
Chris Wilson42f55512016-06-24 14:00:26 +0100160 .has_overlay = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700161 .hws_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100162};
163
164static const struct intel_device_info intel_i965gm_info = {
Carlos Santa4d495be2016-08-17 12:30:49 -0700165 GEN4_FEATURES,
Jani Nikulac0f86832016-12-07 12:13:04 +0200166 .platform = INTEL_I965GM,
Carlos Santa4d495be2016-08-17 12:30:49 -0700167 .is_mobile = 1, .has_fbc = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100168 .has_overlay = 1,
169 .supports_tv = 1,
Carlos Santa31776592016-08-17 12:30:56 -0700170 .hws_needs_physical = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100171};
172
Chris Wilson42f55512016-06-24 14:00:26 +0100173static const struct intel_device_info intel_g45_info = {
Carlos Santa4d495be2016-08-17 12:30:49 -0700174 GEN4_FEATURES,
Jani Nikulaf69c11a2016-11-30 17:43:05 +0200175 .platform = INTEL_G45,
Carlos Santa4d495be2016-08-17 12:30:49 -0700176 .has_pipe_cxsr = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100177 .ring_mask = RENDER_RING | BSD_RING,
Chris Wilson42f55512016-06-24 14:00:26 +0100178};
179
180static const struct intel_device_info intel_gm45_info = {
Carlos Santa4d495be2016-08-17 12:30:49 -0700181 GEN4_FEATURES,
Jani Nikulaf69c11a2016-11-30 17:43:05 +0200182 .platform = INTEL_GM45,
Carlos Santa31776592016-08-17 12:30:56 -0700183 .is_mobile = 1, .has_fbc = 1,
Carlos Santa4d495be2016-08-17 12:30:49 -0700184 .has_pipe_cxsr = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100185 .supports_tv = 1,
186 .ring_mask = RENDER_RING | BSD_RING,
Chris Wilson42f55512016-06-24 14:00:26 +0100187};
188
Carlos Santaa1323382016-08-17 12:30:47 -0700189#define GEN5_FEATURES \
190 .gen = 5, .num_pipes = 2, \
Carlos Santa31776592016-08-17 12:30:56 -0700191 .has_hotplug = 1, \
Carlos Santab355f102016-08-17 12:30:48 -0700192 .has_gmbus_irq = 1, \
Carlos Santaa1323382016-08-17 12:30:47 -0700193 .ring_mask = RENDER_RING | BSD_RING, \
194 GEN_DEFAULT_PIPEOFFSETS, \
195 CURSOR_OFFSETS
196
Chris Wilson42f55512016-06-24 14:00:26 +0100197static const struct intel_device_info intel_ironlake_d_info = {
Carlos Santaa1323382016-08-17 12:30:47 -0700198 GEN5_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200199 .platform = INTEL_IRONLAKE,
Chris Wilson42f55512016-06-24 14:00:26 +0100200};
201
202static const struct intel_device_info intel_ironlake_m_info = {
Carlos Santaa1323382016-08-17 12:30:47 -0700203 GEN5_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200204 .platform = INTEL_IRONLAKE,
Carlos Santaa1323382016-08-17 12:30:47 -0700205 .is_mobile = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100206};
207
Carlos Santa07db6be2016-08-17 12:30:38 -0700208#define GEN6_FEATURES \
209 .gen = 6, .num_pipes = 2, \
Carlos Santa31776592016-08-17 12:30:56 -0700210 .has_hotplug = 1, \
Carlos Santa07db6be2016-08-17 12:30:38 -0700211 .has_fbc = 1, \
212 .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
213 .has_llc = 1, \
Carlos Santa86f36242016-08-17 12:30:44 -0700214 .has_rc6 = 1, \
Carlos Santa33b5bf82016-08-17 12:30:45 -0700215 .has_rc6p = 1, \
Carlos Santab355f102016-08-17 12:30:48 -0700216 .has_gmbus_irq = 1, \
Carlos Santae1a525362016-08-17 12:30:52 -0700217 .has_hw_contexts = 1, \
Michel Thierry9e1d0e62016-12-05 17:57:03 -0800218 .has_aliasing_ppgtt = 1, \
Carlos Santa07db6be2016-08-17 12:30:38 -0700219 GEN_DEFAULT_PIPEOFFSETS, \
220 CURSOR_OFFSETS
221
Chris Wilson42f55512016-06-24 14:00:26 +0100222static const struct intel_device_info intel_sandybridge_d_info = {
Carlos Santa07db6be2016-08-17 12:30:38 -0700223 GEN6_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200224 .platform = INTEL_SANDYBRIDGE,
Chris Wilson42f55512016-06-24 14:00:26 +0100225};
226
227static const struct intel_device_info intel_sandybridge_m_info = {
Carlos Santa07db6be2016-08-17 12:30:38 -0700228 GEN6_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200229 .platform = INTEL_SANDYBRIDGE,
Carlos Santa07db6be2016-08-17 12:30:38 -0700230 .is_mobile = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100231};
232
233#define GEN7_FEATURES \
234 .gen = 7, .num_pipes = 3, \
Carlos Santa31776592016-08-17 12:30:56 -0700235 .has_hotplug = 1, \
Chris Wilson42f55512016-06-24 14:00:26 +0100236 .has_fbc = 1, \
237 .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
238 .has_llc = 1, \
Carlos Santa86f36242016-08-17 12:30:44 -0700239 .has_rc6 = 1, \
Carlos Santa33b5bf82016-08-17 12:30:45 -0700240 .has_rc6p = 1, \
Carlos Santab355f102016-08-17 12:30:48 -0700241 .has_gmbus_irq = 1, \
Carlos Santae1a525362016-08-17 12:30:52 -0700242 .has_hw_contexts = 1, \
Michel Thierry9e1d0e62016-12-05 17:57:03 -0800243 .has_aliasing_ppgtt = 1, \
244 .has_full_ppgtt = 1, \
Chris Wilson42f55512016-06-24 14:00:26 +0100245 GEN_DEFAULT_PIPEOFFSETS, \
246 IVB_CURSOR_OFFSETS
247
248static const struct intel_device_info intel_ivybridge_d_info = {
249 GEN7_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200250 .platform = INTEL_IVYBRIDGE,
Carlos Santaca9c4522016-08-17 12:30:54 -0700251 .has_l3_dpf = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100252};
253
254static const struct intel_device_info intel_ivybridge_m_info = {
255 GEN7_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200256 .platform = INTEL_IVYBRIDGE,
Chris Wilson42f55512016-06-24 14:00:26 +0100257 .is_mobile = 1,
Carlos Santaca9c4522016-08-17 12:30:54 -0700258 .has_l3_dpf = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100259};
260
261static const struct intel_device_info intel_ivybridge_q_info = {
262 GEN7_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200263 .platform = INTEL_IVYBRIDGE,
Chris Wilson42f55512016-06-24 14:00:26 +0100264 .num_pipes = 0, /* legal, last one wins */
Carlos Santaca9c4522016-08-17 12:30:54 -0700265 .has_l3_dpf = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100266};
267
Carlos Santa8d9c20e2016-08-17 12:30:37 -0700268static const struct intel_device_info intel_valleyview_info = {
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200269 .platform = INTEL_VALLEYVIEW,
Rodrigo Vivieb6f7712016-12-19 13:55:08 -0800270 .gen = 7,
271 .is_lp = 1,
272 .num_pipes = 2,
273 .has_psr = 1,
274 .has_runtime_pm = 1,
275 .has_rc6 = 1,
276 .has_gmbus_irq = 1,
277 .has_hw_contexts = 1,
278 .has_gmch_display = 1,
279 .has_hotplug = 1,
280 .has_aliasing_ppgtt = 1,
281 .has_full_ppgtt = 1,
282 .ring_mask = RENDER_RING | BSD_RING | BLT_RING,
283 .display_mmio_offset = VLV_DISPLAY_BASE,
284 GEN_DEFAULT_PIPEOFFSETS,
285 CURSOR_OFFSETS
Chris Wilson42f55512016-06-24 14:00:26 +0100286};
287
288#define HSW_FEATURES \
289 GEN7_FEATURES, \
290 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
291 .has_ddi = 1, \
Carlos Santa6e3b84d2016-08-17 12:30:36 -0700292 .has_fpga_dbg = 1, \
Carlos Santa4aa4c232016-08-17 12:30:39 -0700293 .has_psr = 1, \
Carlos Santa53233f02016-08-17 12:30:43 -0700294 .has_resource_streamer = 1, \
Carlos Santa1d3fe532016-08-17 12:30:46 -0700295 .has_dp_mst = 1, \
Carlos Santa33b5bf82016-08-17 12:30:45 -0700296 .has_rc6p = 0 /* RC6p removed-by HSW */, \
Carlos Santa4aa4c232016-08-17 12:30:39 -0700297 .has_runtime_pm = 1
Chris Wilson42f55512016-06-24 14:00:26 +0100298
Carlos Santa8d9c20e2016-08-17 12:30:37 -0700299static const struct intel_device_info intel_haswell_info = {
Chris Wilson42f55512016-06-24 14:00:26 +0100300 HSW_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200301 .platform = INTEL_HASWELL,
Carlos Santaca9c4522016-08-17 12:30:54 -0700302 .has_l3_dpf = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100303};
304
Chris Wilson42f55512016-06-24 14:00:26 +0100305#define BDW_FEATURES \
306 HSW_FEATURES, \
Carlos Santa4586f1d2016-08-17 12:30:53 -0700307 BDW_COLORS, \
Joonas Lahtinendfc51482016-11-03 10:39:46 +0200308 .has_logical_ring_contexts = 1, \
Michel Thierry9e1d0e62016-12-05 17:57:03 -0800309 .has_full_48bit_ppgtt = 1, \
Joonas Lahtinendfc51482016-11-03 10:39:46 +0200310 .has_64bit_reloc = 1
Chris Wilson42f55512016-06-24 14:00:26 +0100311
Carlos Santa8d9c20e2016-08-17 12:30:37 -0700312static const struct intel_device_info intel_broadwell_info = {
Chris Wilson42f55512016-06-24 14:00:26 +0100313 BDW_FEATURES,
314 .gen = 8,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200315 .platform = INTEL_BROADWELL,
Chris Wilson42f55512016-06-24 14:00:26 +0100316};
317
Carlos Santa8d9c20e2016-08-17 12:30:37 -0700318static const struct intel_device_info intel_broadwell_gt3_info = {
Chris Wilson42f55512016-06-24 14:00:26 +0100319 BDW_FEATURES,
320 .gen = 8,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200321 .platform = INTEL_BROADWELL,
Chris Wilson42f55512016-06-24 14:00:26 +0100322 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
323};
324
Chris Wilson42f55512016-06-24 14:00:26 +0100325static const struct intel_device_info intel_cherryview_info = {
326 .gen = 8, .num_pipes = 3,
Carlos Santa31776592016-08-17 12:30:56 -0700327 .has_hotplug = 1,
Rodrigo Vivi8727dc02016-12-18 13:36:26 -0800328 .is_lp = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100329 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200330 .platform = INTEL_CHERRYVIEW,
Joonas Lahtinendfc51482016-11-03 10:39:46 +0200331 .has_64bit_reloc = 1,
Carlos Santa6e3b84d2016-08-17 12:30:36 -0700332 .has_psr = 1,
Carlos Santa4aa4c232016-08-17 12:30:39 -0700333 .has_runtime_pm = 1,
Carlos Santa53233f02016-08-17 12:30:43 -0700334 .has_resource_streamer = 1,
Carlos Santa86f36242016-08-17 12:30:44 -0700335 .has_rc6 = 1,
Carlos Santab355f102016-08-17 12:30:48 -0700336 .has_gmbus_irq = 1,
Carlos Santae1a525362016-08-17 12:30:52 -0700337 .has_hw_contexts = 1,
Carlos Santa4586f1d2016-08-17 12:30:53 -0700338 .has_logical_ring_contexts = 1,
Carlos Santa804b8712016-08-17 12:30:55 -0700339 .has_gmch_display = 1,
Michel Thierry9e1d0e62016-12-05 17:57:03 -0800340 .has_aliasing_ppgtt = 1,
341 .has_full_ppgtt = 1,
Chris Wilson42f55512016-06-24 14:00:26 +0100342 .display_mmio_offset = VLV_DISPLAY_BASE,
343 GEN_CHV_PIPEOFFSETS,
344 CURSOR_OFFSETS,
345 CHV_COLORS,
346};
347
348static const struct intel_device_info intel_skylake_info = {
349 BDW_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200350 .platform = INTEL_SKYLAKE,
Chris Wilson42f55512016-06-24 14:00:26 +0100351 .gen = 9,
Carlos Santa3bacde12016-08-17 12:30:42 -0700352 .has_csr = 1,
Carlos Santa3d810fb2016-08-17 12:30:57 -0700353 .has_guc = 1,
Deepak M6f3fff62016-09-15 15:01:10 +0530354 .ddb_size = 896,
Chris Wilson42f55512016-06-24 14:00:26 +0100355};
356
357static const struct intel_device_info intel_skylake_gt3_info = {
358 BDW_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200359 .platform = INTEL_SKYLAKE,
Chris Wilson42f55512016-06-24 14:00:26 +0100360 .gen = 9,
Carlos Santa3bacde12016-08-17 12:30:42 -0700361 .has_csr = 1,
Carlos Santa3d810fb2016-08-17 12:30:57 -0700362 .has_guc = 1,
Deepak M6f3fff62016-09-15 15:01:10 +0530363 .ddb_size = 896,
Chris Wilson42f55512016-06-24 14:00:26 +0100364 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
365};
366
Rodrigo Vivi80fa66b2016-12-01 11:33:16 +0200367#define GEN9_LP_FEATURES \
368 .gen = 9, \
Ander Conselvan de Oliveira3e4274f2016-11-10 17:23:09 +0200369 .is_lp = 1, \
Rodrigo Vivi80fa66b2016-12-01 11:33:16 +0200370 .has_hotplug = 1, \
371 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
372 .num_pipes = 3, \
373 .has_64bit_reloc = 1, \
374 .has_ddi = 1, \
375 .has_fpga_dbg = 1, \
376 .has_fbc = 1, \
377 .has_runtime_pm = 1, \
378 .has_pooled_eu = 0, \
379 .has_csr = 1, \
380 .has_resource_streamer = 1, \
381 .has_rc6 = 1, \
382 .has_dp_mst = 1, \
383 .has_gmbus_irq = 1, \
384 .has_hw_contexts = 1, \
385 .has_logical_ring_contexts = 1, \
386 .has_guc = 1, \
387 .has_decoupled_mmio = 1, \
Michel Thierry9e1d0e62016-12-05 17:57:03 -0800388 .has_aliasing_ppgtt = 1, \
389 .has_full_ppgtt = 1, \
390 .has_full_48bit_ppgtt = 1, \
Rodrigo Vivi80fa66b2016-12-01 11:33:16 +0200391 GEN_DEFAULT_PIPEOFFSETS, \
392 IVB_CURSOR_OFFSETS, \
393 BDW_COLORS
394
Chris Wilson42f55512016-06-24 14:00:26 +0100395static const struct intel_device_info intel_broxton_info = {
Rodrigo Vivi80fa66b2016-12-01 11:33:16 +0200396 GEN9_LP_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200397 .platform = INTEL_BROXTON,
Deepak M6f3fff62016-09-15 15:01:10 +0530398 .ddb_size = 512,
Chris Wilson42f55512016-06-24 14:00:26 +0100399};
400
Ander Conselvan de Oliveirac22097f2016-11-14 16:25:26 +0200401static const struct intel_device_info intel_geminilake_info = {
Ander Conselvan de Oliveirac22097f2016-11-14 16:25:26 +0200402 GEN9_LP_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200403 .platform = INTEL_GEMINILAKE,
404 .is_alpha_support = 1,
Ander Conselvan de Oliveirac22097f2016-11-14 16:25:26 +0200405 .ddb_size = 1024,
406};
407
Chris Wilson42f55512016-06-24 14:00:26 +0100408static const struct intel_device_info intel_kabylake_info = {
409 BDW_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200410 .platform = INTEL_KABYLAKE,
Chris Wilson42f55512016-06-24 14:00:26 +0100411 .gen = 9,
Carlos Santa3bacde12016-08-17 12:30:42 -0700412 .has_csr = 1,
Carlos Santa3d810fb2016-08-17 12:30:57 -0700413 .has_guc = 1,
Deepak M6f3fff62016-09-15 15:01:10 +0530414 .ddb_size = 896,
Chris Wilson42f55512016-06-24 14:00:26 +0100415};
416
417static const struct intel_device_info intel_kabylake_gt3_info = {
418 BDW_FEATURES,
Jani Nikula2e0d26f2016-12-01 14:49:55 +0200419 .platform = INTEL_KABYLAKE,
Chris Wilson42f55512016-06-24 14:00:26 +0100420 .gen = 9,
Carlos Santa3bacde12016-08-17 12:30:42 -0700421 .has_csr = 1,
Carlos Santa3d810fb2016-08-17 12:30:57 -0700422 .has_guc = 1,
Deepak M6f3fff62016-09-15 15:01:10 +0530423 .ddb_size = 896,
Chris Wilson42f55512016-06-24 14:00:26 +0100424 .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
425};
426
427/*
428 * Make sure any device matches here are from most specific to most
429 * general. For example, since the Quanta match is based on the subsystem
430 * and subvendor IDs, we need it to come before the more general IVB
431 * PCI ID matches, otherwise we'll use the wrong info struct above.
432 */
433static const struct pci_device_id pciidlist[] = {
434 INTEL_I830_IDS(&intel_i830_info),
Jani Nikula2a307c22016-11-30 17:43:04 +0200435 INTEL_I845G_IDS(&intel_i845g_info),
Chris Wilson42f55512016-06-24 14:00:26 +0100436 INTEL_I85X_IDS(&intel_i85x_info),
437 INTEL_I865G_IDS(&intel_i865g_info),
438 INTEL_I915G_IDS(&intel_i915g_info),
439 INTEL_I915GM_IDS(&intel_i915gm_info),
440 INTEL_I945G_IDS(&intel_i945g_info),
441 INTEL_I945GM_IDS(&intel_i945gm_info),
442 INTEL_I965G_IDS(&intel_i965g_info),
443 INTEL_G33_IDS(&intel_g33_info),
444 INTEL_I965GM_IDS(&intel_i965gm_info),
445 INTEL_GM45_IDS(&intel_gm45_info),
446 INTEL_G45_IDS(&intel_g45_info),
447 INTEL_PINEVIEW_IDS(&intel_pineview_info),
448 INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info),
449 INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info),
450 INTEL_SNB_D_IDS(&intel_sandybridge_d_info),
451 INTEL_SNB_M_IDS(&intel_sandybridge_m_info),
452 INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */
453 INTEL_IVB_M_IDS(&intel_ivybridge_m_info),
454 INTEL_IVB_D_IDS(&intel_ivybridge_d_info),
Carlos Santa8d9c20e2016-08-17 12:30:37 -0700455 INTEL_HSW_IDS(&intel_haswell_info),
456 INTEL_VLV_IDS(&intel_valleyview_info),
457 INTEL_BDW_GT12_IDS(&intel_broadwell_info),
458 INTEL_BDW_GT3_IDS(&intel_broadwell_gt3_info),
Chris Wilson42f55512016-06-24 14:00:26 +0100459 INTEL_CHV_IDS(&intel_cherryview_info),
460 INTEL_SKL_GT1_IDS(&intel_skylake_info),
461 INTEL_SKL_GT2_IDS(&intel_skylake_info),
462 INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info),
463 INTEL_SKL_GT4_IDS(&intel_skylake_gt3_info),
464 INTEL_BXT_IDS(&intel_broxton_info),
Ander Conselvan de Oliveira8363e3c2016-11-10 17:23:08 +0200465 INTEL_GLK_IDS(&intel_geminilake_info),
Chris Wilson42f55512016-06-24 14:00:26 +0100466 INTEL_KBL_GT1_IDS(&intel_kabylake_info),
467 INTEL_KBL_GT2_IDS(&intel_kabylake_info),
468 INTEL_KBL_GT3_IDS(&intel_kabylake_gt3_info),
469 INTEL_KBL_GT4_IDS(&intel_kabylake_gt3_info),
470 {0, 0, 0}
471};
472MODULE_DEVICE_TABLE(pci, pciidlist);
473
Chris Wilson42f55512016-06-24 14:00:26 +0100474static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
475{
476 struct intel_device_info *intel_info =
477 (struct intel_device_info *) ent->driver_data;
478
Jani Nikulac007fb42016-10-31 12:18:28 +0200479 if (IS_ALPHA_SUPPORT(intel_info) && !i915.alpha_support) {
480 DRM_INFO("The driver support for your hardware in this kernel version is alpha quality\n"
481 "See CONFIG_DRM_I915_ALPHA_SUPPORT or i915.alpha_support module parameter\n"
482 "to enable support in this kernel version, or check for kernel updates.\n");
Chris Wilson42f55512016-06-24 14:00:26 +0100483 return -ENODEV;
484 }
485
486 /* Only bind to function 0 of the device. Early generations
487 * used function 1 as a placeholder for multi-head. This causes
488 * us confusion instead, especially on the systems where both
489 * functions have the same PCI-ID!
490 */
491 if (PCI_FUNC(pdev->devfn))
492 return -ENODEV;
493
494 /*
495 * apple-gmux is needed on dual GPU MacBook Pro
496 * to probe the panel if we're the inactive GPU.
497 */
498 if (vga_switcheroo_client_probe_defer(pdev))
499 return -EPROBE_DEFER;
500
501 return i915_driver_load(pdev, ent);
502}
503
Chris Wilson42f55512016-06-24 14:00:26 +0100504static void i915_pci_remove(struct pci_dev *pdev)
505{
506 struct drm_device *dev = pci_get_drvdata(pdev);
507
508 i915_driver_unload(dev);
509 drm_dev_unref(dev);
510}
511
Chris Wilsona09d0ba2016-06-24 14:00:27 +0100512static struct pci_driver i915_pci_driver = {
Chris Wilson42f55512016-06-24 14:00:26 +0100513 .name = DRIVER_NAME,
514 .id_table = pciidlist,
515 .probe = i915_pci_probe,
516 .remove = i915_pci_remove,
517 .driver.pm = &i915_pm_ops,
518};
Chris Wilsona09d0ba2016-06-24 14:00:27 +0100519
520static int __init i915_init(void)
521{
522 bool use_kms = true;
523
524 /*
525 * Enable KMS by default, unless explicitly overriden by
526 * either the i915.modeset prarameter or by the
527 * vga_text_mode_force boot option.
528 */
529
530 if (i915.modeset == 0)
531 use_kms = false;
532
533 if (vgacon_text_force() && i915.modeset == -1)
534 use_kms = false;
535
536 if (!use_kms) {
537 /* Silently fail loading to not upset userspace. */
538 DRM_DEBUG_DRIVER("KMS disabled.\n");
539 return 0;
540 }
541
542 return pci_register_driver(&i915_pci_driver);
543}
544
545static void __exit i915_exit(void)
546{
547 if (!i915_pci_driver.driver.owner)
548 return;
549
550 pci_unregister_driver(&i915_pci_driver);
551}
552
553module_init(i915_init);
554module_exit(i915_exit);
555
556MODULE_AUTHOR("Tungsten Graphics, Inc.");
557MODULE_AUTHOR("Intel Corporation");
558
559MODULE_DESCRIPTION(DRIVER_DESC);
560MODULE_LICENSE("GPL and additional rights");