i915_pci.c 20.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * Copyright © 2016 Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 *
 */

25
#include <linux/console.h>
26 27 28 29
#include <linux/vgaarb.h>
#include <linux/vga_switcheroo.h>

#include "i915_drv.h"
30
#include "i915_selftest.h"
31

32
#define PLATFORM(x) .platform = (x), .platform_mask = BIT(x)
33 34
#define GEN(x) .gen = (x), .gen_mask = BIT((x) - 1)

35
#define GEN_DEFAULT_PIPEOFFSETS \
36 37 38 39 40 41 42 43 44 45 46 47
	.pipe_offsets = { \
		[TRANSCODER_A] = PIPE_A_OFFSET,	\
		[TRANSCODER_B] = PIPE_B_OFFSET, \
		[TRANSCODER_C] = PIPE_C_OFFSET, \
		[TRANSCODER_EDP] = PIPE_EDP_OFFSET, \
	}, \
	.trans_offsets = { \
		[TRANSCODER_A] = TRANSCODER_A_OFFSET, \
		[TRANSCODER_B] = TRANSCODER_B_OFFSET, \
		[TRANSCODER_C] = TRANSCODER_C_OFFSET, \
		[TRANSCODER_EDP] = TRANSCODER_EDP_OFFSET, \
	}
48 49

#define GEN_CHV_PIPEOFFSETS \
50 51 52 53 54 55 56 57 58 59
	.pipe_offsets = { \
		[TRANSCODER_A] = PIPE_A_OFFSET, \
		[TRANSCODER_B] = PIPE_B_OFFSET, \
		[TRANSCODER_C] = CHV_PIPE_C_OFFSET, \
	}, \
	.trans_offsets = { \
		[TRANSCODER_A] = TRANSCODER_A_OFFSET, \
		[TRANSCODER_B] = TRANSCODER_B_OFFSET, \
		[TRANSCODER_C] = CHV_TRANSCODER_C_OFFSET, \
	}
60 61 62 63 64 65 66 67 68 69 70

#define CURSOR_OFFSETS \
	.cursor_offsets = { CURSOR_A_OFFSET, CURSOR_B_OFFSET, CHV_CURSOR_C_OFFSET }

#define IVB_CURSOR_OFFSETS \
	.cursor_offsets = { CURSOR_A_OFFSET, IVB_CURSOR_B_OFFSET, IVB_CURSOR_C_OFFSET }

#define BDW_COLORS \
	.color = { .degamma_lut_size = 512, .gamma_lut_size = 512 }
#define CHV_COLORS \
	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }
R
Rodrigo Vivi 已提交
71 72
#define GLK_COLORS \
	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024 }
73

74
/* Keep in gen based order, and chronological order within a gen */
75 76 77 78

#define GEN_DEFAULT_PAGE_SIZES \
	.page_sizes = I915_GTT_PAGE_SIZE_4K

79
#define GEN2_FEATURES \
80 81
	GEN(2), \
	.num_pipes = 1, \
82
	.has_overlay = 1, .overlay_needs_physical = 1, \
83
	.has_gmch_display = 1, \
84
	.hws_needs_physical = 1, \
85
	.unfenced_needs_alignment = 1, \
86
	.ring_mask = RENDER_RING, \
87
	.has_snoop = true, \
88
	.has_coherent_ggtt = false, \
89
	GEN_DEFAULT_PIPEOFFSETS, \
90
	GEN_DEFAULT_PAGE_SIZES, \
91 92
	CURSOR_OFFSETS

93
static const struct intel_device_info intel_i830_info = {
94
	GEN2_FEATURES,
95
	PLATFORM(INTEL_I830),
96 97
	.is_mobile = 1, .cursor_needs_physical = 1,
	.num_pipes = 2, /* legal, last one wins */
98 99
};

100
static const struct intel_device_info intel_i845g_info = {
101
	GEN2_FEATURES,
102
	PLATFORM(INTEL_I845G),
103 104
};

105
static const struct intel_device_info intel_i85x_info = {
106
	GEN2_FEATURES,
107 108
	PLATFORM(INTEL_I85X),
	.is_mobile = 1,
109
	.num_pipes = 2, /* legal, last one wins */
110 111 112 113
	.cursor_needs_physical = 1,
	.has_fbc = 1,
};

114
static const struct intel_device_info intel_i865g_info = {
115
	GEN2_FEATURES,
116
	PLATFORM(INTEL_I865G),
117 118
};

119
#define GEN3_FEATURES \
120 121
	GEN(3), \
	.num_pipes = 2, \
122
	.has_gmch_display = 1, \
123
	.ring_mask = RENDER_RING, \
124
	.has_snoop = true, \
125
	.has_coherent_ggtt = true, \
126
	GEN_DEFAULT_PIPEOFFSETS, \
127
	GEN_DEFAULT_PAGE_SIZES, \
128 129
	CURSOR_OFFSETS

130
static const struct intel_device_info intel_i915g_info = {
131
	GEN3_FEATURES,
132
	PLATFORM(INTEL_I915G),
133
	.has_coherent_ggtt = false,
134
	.cursor_needs_physical = 1,
135
	.has_overlay = 1, .overlay_needs_physical = 1,
136
	.hws_needs_physical = 1,
137
	.unfenced_needs_alignment = 1,
138
};
139

140
static const struct intel_device_info intel_i915gm_info = {
141
	GEN3_FEATURES,
142
	PLATFORM(INTEL_I915GM),
143
	.is_mobile = 1,
144 145 146 147
	.cursor_needs_physical = 1,
	.has_overlay = 1, .overlay_needs_physical = 1,
	.supports_tv = 1,
	.has_fbc = 1,
148
	.hws_needs_physical = 1,
149
	.unfenced_needs_alignment = 1,
150
};
151

152
static const struct intel_device_info intel_i945g_info = {
153
	GEN3_FEATURES,
154
	PLATFORM(INTEL_I945G),
155
	.has_hotplug = 1, .cursor_needs_physical = 1,
156
	.has_overlay = 1, .overlay_needs_physical = 1,
157
	.hws_needs_physical = 1,
158
	.unfenced_needs_alignment = 1,
159
};
160

161
static const struct intel_device_info intel_i945gm_info = {
162
	GEN3_FEATURES,
163 164
	PLATFORM(INTEL_I945GM),
	.is_mobile = 1,
165 166 167 168
	.has_hotplug = 1, .cursor_needs_physical = 1,
	.has_overlay = 1, .overlay_needs_physical = 1,
	.supports_tv = 1,
	.has_fbc = 1,
169
	.hws_needs_physical = 1,
170
	.unfenced_needs_alignment = 1,
171 172
};

173
static const struct intel_device_info intel_g33_info = {
174
	GEN3_FEATURES,
175
	PLATFORM(INTEL_G33),
176 177 178 179
	.has_hotplug = 1,
	.has_overlay = 1,
};

180
static const struct intel_device_info intel_pineview_info = {
181
	GEN3_FEATURES,
182 183
	PLATFORM(INTEL_PINEVIEW),
	.is_mobile = 1,
184 185 186 187
	.has_hotplug = 1,
	.has_overlay = 1,
};

188
#define GEN4_FEATURES \
189 190
	GEN(4), \
	.num_pipes = 2, \
191
	.has_hotplug = 1, \
192
	.has_gmch_display = 1, \
193
	.ring_mask = RENDER_RING, \
194
	.has_snoop = true, \
195
	.has_coherent_ggtt = true, \
196
	GEN_DEFAULT_PIPEOFFSETS, \
197
	GEN_DEFAULT_PAGE_SIZES, \
198 199
	CURSOR_OFFSETS

200
static const struct intel_device_info intel_i965g_info = {
201
	GEN4_FEATURES,
202
	PLATFORM(INTEL_I965G),
203
	.has_overlay = 1,
204
	.hws_needs_physical = 1,
205
	.has_snoop = false,
206 207
};

208
static const struct intel_device_info intel_i965gm_info = {
209
	GEN4_FEATURES,
210
	PLATFORM(INTEL_I965GM),
211
	.is_mobile = 1, .has_fbc = 1,
212 213
	.has_overlay = 1,
	.supports_tv = 1,
214
	.hws_needs_physical = 1,
215
	.has_snoop = false,
216 217
};

218
static const struct intel_device_info intel_g45_info = {
219
	GEN4_FEATURES,
220
	PLATFORM(INTEL_G45),
221 222 223
	.ring_mask = RENDER_RING | BSD_RING,
};

224
static const struct intel_device_info intel_gm45_info = {
225
	GEN4_FEATURES,
226
	PLATFORM(INTEL_GM45),
227
	.is_mobile = 1, .has_fbc = 1,
228 229 230 231
	.supports_tv = 1,
	.ring_mask = RENDER_RING | BSD_RING,
};

232
#define GEN5_FEATURES \
233 234
	GEN(5), \
	.num_pipes = 2, \
235
	.has_hotplug = 1, \
236
	.ring_mask = RENDER_RING | BSD_RING, \
237
	.has_snoop = true, \
238
	.has_coherent_ggtt = true, \
239 240
	/* ilk does support rc6, but we do not implement [power] contexts */ \
	.has_rc6 = 0, \
241
	GEN_DEFAULT_PIPEOFFSETS, \
242
	GEN_DEFAULT_PAGE_SIZES, \
243 244
	CURSOR_OFFSETS

245
static const struct intel_device_info intel_ironlake_d_info = {
246
	GEN5_FEATURES,
247
	PLATFORM(INTEL_IRONLAKE),
248 249
};

250
static const struct intel_device_info intel_ironlake_m_info = {
251
	GEN5_FEATURES,
252
	PLATFORM(INTEL_IRONLAKE),
253
	.is_mobile = 1, .has_fbc = 1,
254 255
};

256
#define GEN6_FEATURES \
257 258
	GEN(6), \
	.num_pipes = 2, \
259
	.has_hotplug = 1, \
260 261
	.has_fbc = 1, \
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
262
	.has_coherent_ggtt = true, \
263
	.has_llc = 1, \
264
	.has_rc6 = 1, \
265
	.has_rc6p = 1, \
266
	.ppgtt = INTEL_PPGTT_ALIASING, \
267
	GEN_DEFAULT_PIPEOFFSETS, \
268
	GEN_DEFAULT_PAGE_SIZES, \
269 270
	CURSOR_OFFSETS

271 272
#define SNB_D_PLATFORM \
	GEN6_FEATURES, \
273
	PLATFORM(INTEL_SANDYBRIDGE)
274

275
static const struct intel_device_info intel_sandybridge_d_gt1_info = {
276 277
	SNB_D_PLATFORM,
	.gt = 1,
278 279
};

280
static const struct intel_device_info intel_sandybridge_d_gt2_info = {
281 282 283 284 285 286
	SNB_D_PLATFORM,
	.gt = 2,
};

#define SNB_M_PLATFORM \
	GEN6_FEATURES, \
287
	PLATFORM(INTEL_SANDYBRIDGE), \
288 289 290
	.is_mobile = 1


291
static const struct intel_device_info intel_sandybridge_m_gt1_info = {
292 293 294 295
	SNB_M_PLATFORM,
	.gt = 1,
};

296
static const struct intel_device_info intel_sandybridge_m_gt2_info = {
297 298
	SNB_M_PLATFORM,
	.gt = 2,
299 300 301
};

#define GEN7_FEATURES  \
302 303
	GEN(7), \
	.num_pipes = 3, \
304
	.has_hotplug = 1, \
305 306
	.has_fbc = 1, \
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
307
	.has_coherent_ggtt = true, \
308
	.has_llc = 1, \
309
	.has_rc6 = 1, \
310
	.has_rc6p = 1, \
311
	.ppgtt = INTEL_PPGTT_FULL, \
312
	GEN_DEFAULT_PIPEOFFSETS, \
313
	GEN_DEFAULT_PAGE_SIZES, \
314 315
	IVB_CURSOR_OFFSETS

316 317
#define IVB_D_PLATFORM \
	GEN7_FEATURES, \
318
	PLATFORM(INTEL_IVYBRIDGE), \
319 320
	.has_l3_dpf = 1

321
static const struct intel_device_info intel_ivybridge_d_gt1_info = {
322 323
	IVB_D_PLATFORM,
	.gt = 1,
324 325
};

326
static const struct intel_device_info intel_ivybridge_d_gt2_info = {
327 328 329 330 331 332
	IVB_D_PLATFORM,
	.gt = 2,
};

#define IVB_M_PLATFORM \
	GEN7_FEATURES, \
333
	PLATFORM(INTEL_IVYBRIDGE), \
334 335 336
	.is_mobile = 1, \
	.has_l3_dpf = 1

337
static const struct intel_device_info intel_ivybridge_m_gt1_info = {
338 339 340 341
	IVB_M_PLATFORM,
	.gt = 1,
};

342
static const struct intel_device_info intel_ivybridge_m_gt2_info = {
343 344
	IVB_M_PLATFORM,
	.gt = 2,
345 346
};

347
static const struct intel_device_info intel_ivybridge_q_info = {
348
	GEN7_FEATURES,
349
	PLATFORM(INTEL_IVYBRIDGE),
350
	.gt = 2,
351
	.num_pipes = 0, /* legal, last one wins */
352
	.has_l3_dpf = 1,
353 354
};

355
static const struct intel_device_info intel_valleyview_info = {
356
	PLATFORM(INTEL_VALLEYVIEW),
357
	GEN(7),
358 359 360 361 362 363
	.is_lp = 1,
	.num_pipes = 2,
	.has_runtime_pm = 1,
	.has_rc6 = 1,
	.has_gmch_display = 1,
	.has_hotplug = 1,
364
	.ppgtt = INTEL_PPGTT_FULL,
365
	.has_snoop = true,
366
	.has_coherent_ggtt = false,
367 368
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING,
	.display_mmio_offset = VLV_DISPLAY_BASE,
369
	GEN_DEFAULT_PAGE_SIZES,
370 371
	GEN_DEFAULT_PIPEOFFSETS,
	CURSOR_OFFSETS
372 373
};

374
#define G75_FEATURES  \
375 376 377
	GEN7_FEATURES, \
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
	.has_ddi = 1, \
378
	.has_fpga_dbg = 1, \
379
	.has_psr = 1, \
380
	.has_dp_mst = 1, \
381
	.has_rc6p = 0 /* RC6p removed-by HSW */, \
382
	.has_runtime_pm = 1
383

384
#define HSW_PLATFORM \
385
	G75_FEATURES, \
386
	PLATFORM(INTEL_HASWELL), \
387 388
	.has_l3_dpf = 1

389
static const struct intel_device_info intel_haswell_gt1_info = {
390 391 392 393
	HSW_PLATFORM,
	.gt = 1,
};

394
static const struct intel_device_info intel_haswell_gt2_info = {
395 396 397 398
	HSW_PLATFORM,
	.gt = 2,
};

399
static const struct intel_device_info intel_haswell_gt3_info = {
400 401
	HSW_PLATFORM,
	.gt = 3,
402 403
};

404 405
#define GEN8_FEATURES \
	G75_FEATURES, \
406
	GEN(8), \
407
	BDW_COLORS, \
408 409
	.page_sizes = I915_GTT_PAGE_SIZE_4K | \
		      I915_GTT_PAGE_SIZE_2M, \
410
	.has_logical_ring_contexts = 1, \
411
	.ppgtt = INTEL_PPGTT_FULL_4LVL, \
412 413
	.has_64bit_reloc = 1, \
	.has_reset_engine = 1
414

415
#define BDW_PLATFORM \
416
	GEN8_FEATURES, \
417
	PLATFORM(INTEL_BROADWELL)
418

419
static const struct intel_device_info intel_broadwell_gt1_info = {
420 421 422 423
	BDW_PLATFORM,
	.gt = 1,
};

424
static const struct intel_device_info intel_broadwell_gt2_info = {
425
	BDW_PLATFORM,
426 427 428
	.gt = 2,
};

429
static const struct intel_device_info intel_broadwell_rsvd_info = {
430 431 432 433 434
	BDW_PLATFORM,
	.gt = 3,
	/* According to the device ID those devices are GT3, they were
	 * previously treated as not GT3, keep it like that.
	 */
435 436
};

437
static const struct intel_device_info intel_broadwell_gt3_info = {
438
	BDW_PLATFORM,
439
	.gt = 3,
440 441 442
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
};

443
static const struct intel_device_info intel_cherryview_info = {
444
	PLATFORM(INTEL_CHERRYVIEW),
445 446
	GEN(8),
	.num_pipes = 3,
447
	.has_hotplug = 1,
448
	.is_lp = 1,
449
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
450
	.has_64bit_reloc = 1,
451
	.has_runtime_pm = 1,
452
	.has_rc6 = 1,
453
	.has_logical_ring_contexts = 1,
454
	.has_gmch_display = 1,
455
	.ppgtt = INTEL_PPGTT_FULL,
456
	.has_reset_engine = 1,
457
	.has_snoop = true,
458
	.has_coherent_ggtt = false,
459
	.display_mmio_offset = VLV_DISPLAY_BASE,
460
	GEN_DEFAULT_PAGE_SIZES,
461 462 463 464 465
	GEN_CHV_PIPEOFFSETS,
	CURSOR_OFFSETS,
	CHV_COLORS,
};

466
#define GEN9_DEFAULT_PAGE_SIZES \
467
	.page_sizes = I915_GTT_PAGE_SIZE_4K | \
468 469
		      I915_GTT_PAGE_SIZE_64K | \
		      I915_GTT_PAGE_SIZE_2M
470

471 472
#define GEN9_FEATURES \
	GEN8_FEATURES, \
473
	GEN(9), \
474
	GEN9_DEFAULT_PAGE_SIZES, \
C
Chris Wilson 已提交
475
	.has_logical_ring_preemption = 1, \
476 477
	.has_csr = 1, \
	.has_guc = 1, \
478
	.has_ipc = 1, \
479 480
	.ddb_size = 896

481 482
#define SKL_PLATFORM \
	GEN9_FEATURES, \
483 484
	/* Display WA #0477 WaDisableIPC: skl */ \
	.has_ipc = 0, \
485
	PLATFORM(INTEL_SKYLAKE)
486

487
static const struct intel_device_info intel_skylake_gt1_info = {
488
	SKL_PLATFORM,
489
	.gt = 1,
490 491
};

492
static const struct intel_device_info intel_skylake_gt2_info = {
493
	SKL_PLATFORM,
494 495 496 497 498 499 500 501
	.gt = 2,
};

#define SKL_GT3_PLUS_PLATFORM \
	SKL_PLATFORM, \
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING


502
static const struct intel_device_info intel_skylake_gt3_info = {
503 504 505 506
	SKL_GT3_PLUS_PLATFORM,
	.gt = 3,
};

507
static const struct intel_device_info intel_skylake_gt4_info = {
508 509
	SKL_GT3_PLUS_PLATFORM,
	.gt = 4,
510 511
};

512
#define GEN9_LP_FEATURES \
513
	GEN(9), \
514
	.is_lp = 1, \
515 516 517 518 519 520 521
	.has_hotplug = 1, \
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
	.num_pipes = 3, \
	.has_64bit_reloc = 1, \
	.has_ddi = 1, \
	.has_fpga_dbg = 1, \
	.has_fbc = 1, \
522
	.has_psr = 1, \
523 524 525 526 527 528
	.has_runtime_pm = 1, \
	.has_pooled_eu = 0, \
	.has_csr = 1, \
	.has_rc6 = 1, \
	.has_dp_mst = 1, \
	.has_logical_ring_contexts = 1, \
C
Chris Wilson 已提交
529
	.has_logical_ring_preemption = 1, \
530
	.has_guc = 1, \
531
	.ppgtt = INTEL_PPGTT_FULL_4LVL, \
532
	.has_reset_engine = 1, \
533
	.has_snoop = true, \
534
	.has_coherent_ggtt = false, \
535
	.has_ipc = 1, \
536
	GEN9_DEFAULT_PAGE_SIZES, \
537 538 539 540
	GEN_DEFAULT_PIPEOFFSETS, \
	IVB_CURSOR_OFFSETS, \
	BDW_COLORS

541
static const struct intel_device_info intel_broxton_info = {
542
	GEN9_LP_FEATURES,
543
	PLATFORM(INTEL_BROXTON),
544
	.ddb_size = 512,
545 546
};

547
static const struct intel_device_info intel_geminilake_info = {
548
	GEN9_LP_FEATURES,
549
	PLATFORM(INTEL_GEMINILAKE),
550
	.ddb_size = 1024,
R
Rodrigo Vivi 已提交
551
	GLK_COLORS,
552 553
};

554
#define KBL_PLATFORM \
555
	GEN9_FEATURES, \
556
	PLATFORM(INTEL_KABYLAKE)
557

558
static const struct intel_device_info intel_kabylake_gt1_info = {
559
	KBL_PLATFORM,
560 561 562
	.gt = 1,
};

563
static const struct intel_device_info intel_kabylake_gt2_info = {
564 565
	KBL_PLATFORM,
	.gt = 2,
566 567
};

568
static const struct intel_device_info intel_kabylake_gt3_info = {
569
	KBL_PLATFORM,
570
	.gt = 3,
571 572 573
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
};

574
#define CFL_PLATFORM \
575
	GEN9_FEATURES, \
576
	PLATFORM(INTEL_COFFEELAKE)
577

578
static const struct intel_device_info intel_coffeelake_gt1_info = {
579 580 581 582
	CFL_PLATFORM,
	.gt = 1,
};

583
static const struct intel_device_info intel_coffeelake_gt2_info = {
584
	CFL_PLATFORM,
585
	.gt = 2,
586 587
};

588
static const struct intel_device_info intel_coffeelake_gt3_info = {
589
	CFL_PLATFORM,
590
	.gt = 3,
591 592 593
	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
};

594 595
#define GEN10_FEATURES \
	GEN9_FEATURES, \
596
	GEN(10), \
597
	.ddb_size = 1024, \
598
	.has_coherent_ggtt = false, \
R
Rodrigo Vivi 已提交
599
	GLK_COLORS
600

601
static const struct intel_device_info intel_cannonlake_info = {
602
	GEN10_FEATURES,
603
	PLATFORM(INTEL_CANNONLAKE),
604
	.gt = 2,
605 606
};

607 608
#define GEN11_FEATURES \
	GEN10_FEATURES, \
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624
	.pipe_offsets = { \
		[TRANSCODER_A] = PIPE_A_OFFSET, \
		[TRANSCODER_B] = PIPE_B_OFFSET, \
		[TRANSCODER_C] = PIPE_C_OFFSET, \
		[TRANSCODER_EDP] = PIPE_EDP_OFFSET, \
		[TRANSCODER_DSI_0] = PIPE_DSI0_OFFSET, \
		[TRANSCODER_DSI_1] = PIPE_DSI1_OFFSET, \
	}, \
	.trans_offsets = { \
		[TRANSCODER_A] = TRANSCODER_A_OFFSET, \
		[TRANSCODER_B] = TRANSCODER_B_OFFSET, \
		[TRANSCODER_C] = TRANSCODER_C_OFFSET, \
		[TRANSCODER_EDP] = TRANSCODER_EDP_OFFSET, \
		[TRANSCODER_DSI_0] = TRANSCODER_DSI0_OFFSET, \
		[TRANSCODER_DSI_1] = TRANSCODER_DSI1_OFFSET, \
	}, \
625
	GEN(11), \
626
	.ddb_size = 2048, \
627
	.has_logical_ring_elsq = 1
628

629
static const struct intel_device_info intel_icelake_11_info = {
630
	GEN11_FEATURES,
631
	PLATFORM(INTEL_ICELAKE),
632
	.is_alpha_support = 1,
633
	.ring_mask = RENDER_RING | BLT_RING | VEBOX_RING | BSD_RING | BSD3_RING,
634 635
};

636
#undef GEN
637
#undef PLATFORM
638

639 640 641 642 643 644 645 646
/*
 * Make sure any device matches here are from most specific to most
 * general.  For example, since the Quanta match is based on the subsystem
 * and subvendor IDs, we need it to come before the more general IVB
 * PCI ID matches, otherwise we'll use the wrong info struct above.
 */
static const struct pci_device_id pciidlist[] = {
	INTEL_I830_IDS(&intel_i830_info),
647
	INTEL_I845G_IDS(&intel_i845g_info),
648 649 650 651 652 653 654 655 656 657 658 659 660 661
	INTEL_I85X_IDS(&intel_i85x_info),
	INTEL_I865G_IDS(&intel_i865g_info),
	INTEL_I915G_IDS(&intel_i915g_info),
	INTEL_I915GM_IDS(&intel_i915gm_info),
	INTEL_I945G_IDS(&intel_i945g_info),
	INTEL_I945GM_IDS(&intel_i945gm_info),
	INTEL_I965G_IDS(&intel_i965g_info),
	INTEL_G33_IDS(&intel_g33_info),
	INTEL_I965GM_IDS(&intel_i965gm_info),
	INTEL_GM45_IDS(&intel_gm45_info),
	INTEL_G45_IDS(&intel_g45_info),
	INTEL_PINEVIEW_IDS(&intel_pineview_info),
	INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info),
	INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info),
662 663 664 665
	INTEL_SNB_D_GT1_IDS(&intel_sandybridge_d_gt1_info),
	INTEL_SNB_D_GT2_IDS(&intel_sandybridge_d_gt2_info),
	INTEL_SNB_M_GT1_IDS(&intel_sandybridge_m_gt1_info),
	INTEL_SNB_M_GT2_IDS(&intel_sandybridge_m_gt2_info),
666
	INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */
667 668 669 670 671 672 673
	INTEL_IVB_M_GT1_IDS(&intel_ivybridge_m_gt1_info),
	INTEL_IVB_M_GT2_IDS(&intel_ivybridge_m_gt2_info),
	INTEL_IVB_D_GT1_IDS(&intel_ivybridge_d_gt1_info),
	INTEL_IVB_D_GT2_IDS(&intel_ivybridge_d_gt2_info),
	INTEL_HSW_GT1_IDS(&intel_haswell_gt1_info),
	INTEL_HSW_GT2_IDS(&intel_haswell_gt2_info),
	INTEL_HSW_GT3_IDS(&intel_haswell_gt3_info),
674
	INTEL_VLV_IDS(&intel_valleyview_info),
675 676
	INTEL_BDW_GT1_IDS(&intel_broadwell_gt1_info),
	INTEL_BDW_GT2_IDS(&intel_broadwell_gt2_info),
677
	INTEL_BDW_GT3_IDS(&intel_broadwell_gt3_info),
678
	INTEL_BDW_RSVD_IDS(&intel_broadwell_rsvd_info),
679
	INTEL_CHV_IDS(&intel_cherryview_info),
680 681
	INTEL_SKL_GT1_IDS(&intel_skylake_gt1_info),
	INTEL_SKL_GT2_IDS(&intel_skylake_gt2_info),
682
	INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info),
683
	INTEL_SKL_GT4_IDS(&intel_skylake_gt4_info),
684
	INTEL_BXT_IDS(&intel_broxton_info),
685
	INTEL_GLK_IDS(&intel_geminilake_info),
686 687
	INTEL_KBL_GT1_IDS(&intel_kabylake_gt1_info),
	INTEL_KBL_GT2_IDS(&intel_kabylake_gt2_info),
688 689
	INTEL_KBL_GT3_IDS(&intel_kabylake_gt3_info),
	INTEL_KBL_GT4_IDS(&intel_kabylake_gt3_info),
690
	INTEL_AML_KBL_GT2_IDS(&intel_kabylake_gt2_info),
691 692 693
	INTEL_CFL_S_GT1_IDS(&intel_coffeelake_gt1_info),
	INTEL_CFL_S_GT2_IDS(&intel_coffeelake_gt2_info),
	INTEL_CFL_H_GT2_IDS(&intel_coffeelake_gt2_info),
694
	INTEL_CFL_U_GT2_IDS(&intel_coffeelake_gt2_info),
695
	INTEL_CFL_U_GT3_IDS(&intel_coffeelake_gt3_info),
696 697
	INTEL_WHL_U_GT1_IDS(&intel_coffeelake_gt1_info),
	INTEL_WHL_U_GT2_IDS(&intel_coffeelake_gt2_info),
698
	INTEL_AML_CFL_GT2_IDS(&intel_coffeelake_gt2_info),
699
	INTEL_WHL_U_GT3_IDS(&intel_coffeelake_gt3_info),
700
	INTEL_CNL_IDS(&intel_cannonlake_info),
P
Paulo Zanoni 已提交
701
	INTEL_ICL_11_IDS(&intel_icelake_11_info),
702 703 704 705
	{0, 0, 0}
};
MODULE_DEVICE_TABLE(pci, pciidlist);

706 707
static void i915_pci_remove(struct pci_dev *pdev)
{
708 709 710 711 712
	struct drm_device *dev;

	dev = pci_get_drvdata(pdev);
	if (!dev) /* driver load aborted, nothing to cleanup */
		return;
713 714

	i915_driver_unload(dev);
715
	drm_dev_put(dev);
716 717

	pci_set_drvdata(pdev, NULL);
718 719
}

720 721 722 723
static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	struct intel_device_info *intel_info =
		(struct intel_device_info *) ent->driver_data;
724
	int err;
725

726
	if (IS_ALPHA_SUPPORT(intel_info) && !i915_modparams.alpha_support) {
727 728 729
		DRM_INFO("The driver support for your hardware in this kernel version is alpha quality\n"
			 "See CONFIG_DRM_I915_ALPHA_SUPPORT or i915.alpha_support module parameter\n"
			 "to enable support in this kernel version, or check for kernel updates.\n");
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747
		return -ENODEV;
	}

	/* Only bind to function 0 of the device. Early generations
	 * used function 1 as a placeholder for multi-head. This causes
	 * us confusion instead, especially on the systems where both
	 * functions have the same PCI-ID!
	 */
	if (PCI_FUNC(pdev->devfn))
		return -ENODEV;

	/*
	 * apple-gmux is needed on dual GPU MacBook Pro
	 * to probe the panel if we're the inactive GPU.
	 */
	if (vga_switcheroo_client_probe_defer(pdev))
		return -EPROBE_DEFER;

748 749 750
	err = i915_driver_load(pdev, ent);
	if (err)
		return err;
751

752 753 754 755 756
	if (i915_inject_load_failure()) {
		i915_pci_remove(pdev);
		return -ENODEV;
	}

757 758 759 760 761
	err = i915_live_selftests(pdev);
	if (err) {
		i915_pci_remove(pdev);
		return err > 0 ? -ENOTTY : err;
	}
762

763
	return 0;
764 765
}

766
static struct pci_driver i915_pci_driver = {
767 768 769 770 771 772
	.name = DRIVER_NAME,
	.id_table = pciidlist,
	.probe = i915_pci_probe,
	.remove = i915_pci_remove,
	.driver.pm = &i915_pm_ops,
};
773 774 775 776

static int __init i915_init(void)
{
	bool use_kms = true;
777 778 779 780 781
	int err;

	err = i915_mock_selftests();
	if (err)
		return err > 0 ? 0 : err;
782 783 784 785 786 787 788

	/*
	 * Enable KMS by default, unless explicitly overriden by
	 * either the i915.modeset prarameter or by the
	 * vga_text_mode_force boot option.
	 */

789
	if (i915_modparams.modeset == 0)
790 791
		use_kms = false;

792
	if (vgacon_text_force() && i915_modparams.modeset == -1)
793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819
		use_kms = false;

	if (!use_kms) {
		/* Silently fail loading to not upset userspace. */
		DRM_DEBUG_DRIVER("KMS disabled.\n");
		return 0;
	}

	return pci_register_driver(&i915_pci_driver);
}

static void __exit i915_exit(void)
{
	if (!i915_pci_driver.driver.owner)
		return;

	pci_unregister_driver(&i915_pci_driver);
}

module_init(i915_init);
module_exit(i915_exit);

MODULE_AUTHOR("Tungsten Graphics, Inc.");
MODULE_AUTHOR("Intel Corporation");

MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL and additional rights");