xref: /dflybsd-src/sys/dev/drm/i915/i915_pci.c (revision 5716abfee22bb12997f2be6a4cce0b691e6c5436)
11487f786SFrançois Tigeot /*
21487f786SFrançois Tigeot  * Copyright © 2016 Intel Corporation
31487f786SFrançois Tigeot  *
41487f786SFrançois Tigeot  * Permission is hereby granted, free of charge, to any person obtaining a
51487f786SFrançois Tigeot  * copy of this software and associated documentation files (the "Software"),
61487f786SFrançois Tigeot  * to deal in the Software without restriction, including without limitation
71487f786SFrançois Tigeot  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
81487f786SFrançois Tigeot  * and/or sell copies of the Software, and to permit persons to whom the
91487f786SFrançois Tigeot  * Software is furnished to do so, subject to the following conditions:
101487f786SFrançois Tigeot  *
111487f786SFrançois Tigeot  * The above copyright notice and this permission notice (including the next
121487f786SFrançois Tigeot  * paragraph) shall be included in all copies or substantial portions of the
131487f786SFrançois Tigeot  * Software.
141487f786SFrançois Tigeot  *
151487f786SFrançois Tigeot  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
161487f786SFrançois Tigeot  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
171487f786SFrançois Tigeot  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
181487f786SFrançois Tigeot  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
191487f786SFrançois Tigeot  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
201487f786SFrançois Tigeot  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
211487f786SFrançois Tigeot  * IN THE SOFTWARE.
221487f786SFrançois Tigeot  *
231487f786SFrançois Tigeot  */
241487f786SFrançois Tigeot 
251487f786SFrançois Tigeot #include <linux/console.h>
261487f786SFrançois Tigeot #include <linux/vgaarb.h>
271487f786SFrançois Tigeot #include <linux/vga_switcheroo.h>
281487f786SFrançois Tigeot 
291487f786SFrançois Tigeot #include "i915_drv.h"
30a85cb24fSFrançois Tigeot #include "i915_selftest.h"
311487f786SFrançois Tigeot 
321487f786SFrançois Tigeot #define GEN_DEFAULT_PIPEOFFSETS \
331487f786SFrançois Tigeot 	.pipe_offsets = { PIPE_A_OFFSET, PIPE_B_OFFSET, \
341487f786SFrançois Tigeot 			  PIPE_C_OFFSET, PIPE_EDP_OFFSET }, \
351487f786SFrançois Tigeot 	.trans_offsets = { TRANSCODER_A_OFFSET, TRANSCODER_B_OFFSET, \
361487f786SFrançois Tigeot 			   TRANSCODER_C_OFFSET, TRANSCODER_EDP_OFFSET }, \
371487f786SFrançois Tigeot 	.palette_offsets = { PALETTE_A_OFFSET, PALETTE_B_OFFSET }
381487f786SFrançois Tigeot 
391487f786SFrançois Tigeot #define GEN_CHV_PIPEOFFSETS \
401487f786SFrançois Tigeot 	.pipe_offsets = { PIPE_A_OFFSET, PIPE_B_OFFSET, \
411487f786SFrançois Tigeot 			  CHV_PIPE_C_OFFSET }, \
421487f786SFrançois Tigeot 	.trans_offsets = { TRANSCODER_A_OFFSET, TRANSCODER_B_OFFSET, \
431487f786SFrançois Tigeot 			   CHV_TRANSCODER_C_OFFSET, }, \
441487f786SFrançois Tigeot 	.palette_offsets = { PALETTE_A_OFFSET, PALETTE_B_OFFSET, \
451487f786SFrançois Tigeot 			     CHV_PALETTE_C_OFFSET }
461487f786SFrançois Tigeot 
471487f786SFrançois Tigeot #define CURSOR_OFFSETS \
481487f786SFrançois Tigeot 	.cursor_offsets = { CURSOR_A_OFFSET, CURSOR_B_OFFSET, CHV_CURSOR_C_OFFSET }
491487f786SFrançois Tigeot 
501487f786SFrançois Tigeot #define IVB_CURSOR_OFFSETS \
511487f786SFrançois Tigeot 	.cursor_offsets = { CURSOR_A_OFFSET, IVB_CURSOR_B_OFFSET, IVB_CURSOR_C_OFFSET }
521487f786SFrançois Tigeot 
531487f786SFrançois Tigeot #define BDW_COLORS \
541487f786SFrançois Tigeot 	.color = { .degamma_lut_size = 512, .gamma_lut_size = 512 }
551487f786SFrançois Tigeot #define CHV_COLORS \
561487f786SFrançois Tigeot 	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }
573f2dd94aSFrançois Tigeot #define GLK_COLORS \
583f2dd94aSFrançois Tigeot 	.color = { .degamma_lut_size = 0, .gamma_lut_size = 1024 }
591487f786SFrançois Tigeot 
60a85cb24fSFrançois Tigeot /* Keep in gen based order, and chronological order within a gen */
613f2dd94aSFrançois Tigeot 
623f2dd94aSFrançois Tigeot #define GEN_DEFAULT_PAGE_SIZES \
633f2dd94aSFrançois Tigeot 	.page_sizes = I915_GTT_PAGE_SIZE_4K
643f2dd94aSFrançois Tigeot 
651e12ee3bSFrançois Tigeot #define GEN2_FEATURES \
661e12ee3bSFrançois Tigeot 	.gen = 2, .num_pipes = 1, \
671e12ee3bSFrançois Tigeot 	.has_overlay = 1, .overlay_needs_physical = 1, \
681e12ee3bSFrançois Tigeot 	.has_gmch_display = 1, \
691e12ee3bSFrançois Tigeot 	.hws_needs_physical = 1, \
70a85cb24fSFrançois Tigeot 	.unfenced_needs_alignment = 1, \
711e12ee3bSFrançois Tigeot 	.ring_mask = RENDER_RING, \
723f2dd94aSFrançois Tigeot 	.has_snoop = true, \
731e12ee3bSFrançois Tigeot 	GEN_DEFAULT_PIPEOFFSETS, \
743f2dd94aSFrançois Tigeot 	GEN_DEFAULT_PAGE_SIZES, \
751e12ee3bSFrançois Tigeot 	CURSOR_OFFSETS
761e12ee3bSFrançois Tigeot 
771487f786SFrançois Tigeot static const struct intel_device_info intel_i830_info = {
781e12ee3bSFrançois Tigeot 	GEN2_FEATURES,
79a85cb24fSFrançois Tigeot 	.platform = INTEL_I830,
801e12ee3bSFrançois Tigeot 	.is_mobile = 1, .cursor_needs_physical = 1,
811e12ee3bSFrançois Tigeot 	.num_pipes = 2, /* legal, last one wins */
821487f786SFrançois Tigeot };
831487f786SFrançois Tigeot 
84a85cb24fSFrançois Tigeot static const struct intel_device_info intel_i845g_info = {
851e12ee3bSFrançois Tigeot 	GEN2_FEATURES,
86a85cb24fSFrançois Tigeot 	.platform = INTEL_I845G,
871487f786SFrançois Tigeot };
881487f786SFrançois Tigeot 
891487f786SFrançois Tigeot static const struct intel_device_info intel_i85x_info = {
901e12ee3bSFrançois Tigeot 	GEN2_FEATURES,
91a85cb24fSFrançois Tigeot 	.platform = INTEL_I85X, .is_mobile = 1,
921e12ee3bSFrançois Tigeot 	.num_pipes = 2, /* legal, last one wins */
931487f786SFrançois Tigeot 	.cursor_needs_physical = 1,
941487f786SFrançois Tigeot 	.has_fbc = 1,
951487f786SFrançois Tigeot };
961487f786SFrançois Tigeot 
971487f786SFrançois Tigeot static const struct intel_device_info intel_i865g_info = {
981e12ee3bSFrançois Tigeot 	GEN2_FEATURES,
99a85cb24fSFrançois Tigeot 	.platform = INTEL_I865G,
1001487f786SFrançois Tigeot };
1011487f786SFrançois Tigeot 
1021e12ee3bSFrançois Tigeot #define GEN3_FEATURES \
1031e12ee3bSFrançois Tigeot 	.gen = 3, .num_pipes = 2, \
1041e12ee3bSFrançois Tigeot 	.has_gmch_display = 1, \
1051e12ee3bSFrançois Tigeot 	.ring_mask = RENDER_RING, \
1063f2dd94aSFrançois Tigeot 	.has_snoop = true, \
1071e12ee3bSFrançois Tigeot 	GEN_DEFAULT_PIPEOFFSETS, \
1083f2dd94aSFrançois Tigeot 	GEN_DEFAULT_PAGE_SIZES, \
1091e12ee3bSFrançois Tigeot 	CURSOR_OFFSETS
1101e12ee3bSFrançois Tigeot 
1111487f786SFrançois Tigeot static const struct intel_device_info intel_i915g_info = {
1121e12ee3bSFrançois Tigeot 	GEN3_FEATURES,
113a85cb24fSFrançois Tigeot 	.platform = INTEL_I915G, .cursor_needs_physical = 1,
1141487f786SFrançois Tigeot 	.has_overlay = 1, .overlay_needs_physical = 1,
1151e12ee3bSFrançois Tigeot 	.hws_needs_physical = 1,
116a85cb24fSFrançois Tigeot 	.unfenced_needs_alignment = 1,
1171487f786SFrançois Tigeot };
118a85cb24fSFrançois Tigeot 
1191487f786SFrançois Tigeot static const struct intel_device_info intel_i915gm_info = {
1201e12ee3bSFrançois Tigeot 	GEN3_FEATURES,
121a85cb24fSFrançois Tigeot 	.platform = INTEL_I915GM,
1221e12ee3bSFrançois Tigeot 	.is_mobile = 1,
1231487f786SFrançois Tigeot 	.cursor_needs_physical = 1,
1241487f786SFrançois Tigeot 	.has_overlay = 1, .overlay_needs_physical = 1,
1251487f786SFrançois Tigeot 	.supports_tv = 1,
1261487f786SFrançois Tigeot 	.has_fbc = 1,
1271e12ee3bSFrançois Tigeot 	.hws_needs_physical = 1,
128a85cb24fSFrançois Tigeot 	.unfenced_needs_alignment = 1,
1291487f786SFrançois Tigeot };
130a85cb24fSFrançois Tigeot 
1311487f786SFrançois Tigeot static const struct intel_device_info intel_i945g_info = {
1321e12ee3bSFrançois Tigeot 	GEN3_FEATURES,
133a85cb24fSFrançois Tigeot 	.platform = INTEL_I945G,
1341e12ee3bSFrançois Tigeot 	.has_hotplug = 1, .cursor_needs_physical = 1,
1351487f786SFrançois Tigeot 	.has_overlay = 1, .overlay_needs_physical = 1,
1361e12ee3bSFrançois Tigeot 	.hws_needs_physical = 1,
137a85cb24fSFrançois Tigeot 	.unfenced_needs_alignment = 1,
1381487f786SFrançois Tigeot };
139a85cb24fSFrançois Tigeot 
1401487f786SFrançois Tigeot static const struct intel_device_info intel_i945gm_info = {
1411e12ee3bSFrançois Tigeot 	GEN3_FEATURES,
142a85cb24fSFrançois Tigeot 	.platform = INTEL_I945GM, .is_mobile = 1,
1431487f786SFrançois Tigeot 	.has_hotplug = 1, .cursor_needs_physical = 1,
1441487f786SFrançois Tigeot 	.has_overlay = 1, .overlay_needs_physical = 1,
1451487f786SFrançois Tigeot 	.supports_tv = 1,
1461487f786SFrançois Tigeot 	.has_fbc = 1,
1471e12ee3bSFrançois Tigeot 	.hws_needs_physical = 1,
148a85cb24fSFrançois Tigeot 	.unfenced_needs_alignment = 1,
149a85cb24fSFrançois Tigeot };
150a85cb24fSFrançois Tigeot 
151a85cb24fSFrançois Tigeot static const struct intel_device_info intel_g33_info = {
152a85cb24fSFrançois Tigeot 	GEN3_FEATURES,
153a85cb24fSFrançois Tigeot 	.platform = INTEL_G33,
154a85cb24fSFrançois Tigeot 	.has_hotplug = 1,
155a85cb24fSFrançois Tigeot 	.has_overlay = 1,
156a85cb24fSFrançois Tigeot };
157a85cb24fSFrançois Tigeot 
158a85cb24fSFrançois Tigeot static const struct intel_device_info intel_pineview_info = {
159a85cb24fSFrançois Tigeot 	GEN3_FEATURES,
160a85cb24fSFrançois Tigeot 	.platform = INTEL_PINEVIEW, .is_mobile = 1,
161a85cb24fSFrançois Tigeot 	.has_hotplug = 1,
162a85cb24fSFrançois Tigeot 	.has_overlay = 1,
1631487f786SFrançois Tigeot };
1641487f786SFrançois Tigeot 
1651e12ee3bSFrançois Tigeot #define GEN4_FEATURES \
1661e12ee3bSFrançois Tigeot 	.gen = 4, .num_pipes = 2, \
1671e12ee3bSFrançois Tigeot 	.has_hotplug = 1, \
1681e12ee3bSFrançois Tigeot 	.has_gmch_display = 1, \
1691e12ee3bSFrançois Tigeot 	.ring_mask = RENDER_RING, \
1703f2dd94aSFrançois Tigeot 	.has_snoop = true, \
1711e12ee3bSFrançois Tigeot 	GEN_DEFAULT_PIPEOFFSETS, \
1723f2dd94aSFrançois Tigeot 	GEN_DEFAULT_PAGE_SIZES, \
1731e12ee3bSFrançois Tigeot 	CURSOR_OFFSETS
1741e12ee3bSFrançois Tigeot 
1751487f786SFrançois Tigeot static const struct intel_device_info intel_i965g_info = {
1761e12ee3bSFrançois Tigeot 	GEN4_FEATURES,
177a85cb24fSFrançois Tigeot 	.platform = INTEL_I965G,
1781487f786SFrançois Tigeot 	.has_overlay = 1,
1791e12ee3bSFrançois Tigeot 	.hws_needs_physical = 1,
1803f2dd94aSFrançois Tigeot 	.has_snoop = false,
1811487f786SFrançois Tigeot };
1821487f786SFrançois Tigeot 
1831487f786SFrançois Tigeot static const struct intel_device_info intel_i965gm_info = {
1841e12ee3bSFrançois Tigeot 	GEN4_FEATURES,
185a85cb24fSFrançois Tigeot 	.platform = INTEL_I965GM,
1861e12ee3bSFrançois Tigeot 	.is_mobile = 1, .has_fbc = 1,
1871487f786SFrançois Tigeot 	.has_overlay = 1,
1881487f786SFrançois Tigeot 	.supports_tv = 1,
1891e12ee3bSFrançois Tigeot 	.hws_needs_physical = 1,
1903f2dd94aSFrançois Tigeot 	.has_snoop = false,
1911487f786SFrançois Tigeot };
1921487f786SFrançois Tigeot 
1931487f786SFrançois Tigeot static const struct intel_device_info intel_g45_info = {
1941e12ee3bSFrançois Tigeot 	GEN4_FEATURES,
195a85cb24fSFrançois Tigeot 	.platform = INTEL_G45,
1961487f786SFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING,
1971487f786SFrançois Tigeot };
1981487f786SFrançois Tigeot 
1991487f786SFrançois Tigeot static const struct intel_device_info intel_gm45_info = {
2001e12ee3bSFrançois Tigeot 	GEN4_FEATURES,
201a85cb24fSFrançois Tigeot 	.platform = INTEL_GM45,
2021e12ee3bSFrançois Tigeot 	.is_mobile = 1, .has_fbc = 1,
2031487f786SFrançois Tigeot 	.supports_tv = 1,
2041487f786SFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING,
2051487f786SFrançois Tigeot };
2061487f786SFrançois Tigeot 
2071e12ee3bSFrançois Tigeot #define GEN5_FEATURES \
2081e12ee3bSFrançois Tigeot 	.gen = 5, .num_pipes = 2, \
2091e12ee3bSFrançois Tigeot 	.has_hotplug = 1, \
2101e12ee3bSFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING, \
2113f2dd94aSFrançois Tigeot 	.has_snoop = true, \
2121e12ee3bSFrançois Tigeot 	GEN_DEFAULT_PIPEOFFSETS, \
2133f2dd94aSFrançois Tigeot 	GEN_DEFAULT_PAGE_SIZES, \
2141e12ee3bSFrançois Tigeot 	CURSOR_OFFSETS
2151e12ee3bSFrançois Tigeot 
2161487f786SFrançois Tigeot static const struct intel_device_info intel_ironlake_d_info = {
2171e12ee3bSFrançois Tigeot 	GEN5_FEATURES,
218a85cb24fSFrançois Tigeot 	.platform = INTEL_IRONLAKE,
2191487f786SFrançois Tigeot };
2201487f786SFrançois Tigeot 
2211487f786SFrançois Tigeot static const struct intel_device_info intel_ironlake_m_info = {
2221e12ee3bSFrançois Tigeot 	GEN5_FEATURES,
223a85cb24fSFrançois Tigeot 	.platform = INTEL_IRONLAKE,
224a85cb24fSFrançois Tigeot 	.is_mobile = 1, .has_fbc = 1,
2251487f786SFrançois Tigeot };
2261487f786SFrançois Tigeot 
2271e12ee3bSFrançois Tigeot #define GEN6_FEATURES \
2281e12ee3bSFrançois Tigeot 	.gen = 6, .num_pipes = 2, \
2291e12ee3bSFrançois Tigeot 	.has_hotplug = 1, \
2301e12ee3bSFrançois Tigeot 	.has_fbc = 1, \
2311e12ee3bSFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
2321e12ee3bSFrançois Tigeot 	.has_llc = 1, \
2331e12ee3bSFrançois Tigeot 	.has_rc6 = 1, \
2341e12ee3bSFrançois Tigeot 	.has_rc6p = 1, \
235a85cb24fSFrançois Tigeot 	.has_aliasing_ppgtt = 1, \
2361e12ee3bSFrançois Tigeot 	GEN_DEFAULT_PIPEOFFSETS, \
2373f2dd94aSFrançois Tigeot 	GEN_DEFAULT_PAGE_SIZES, \
2381e12ee3bSFrançois Tigeot 	CURSOR_OFFSETS
2391e12ee3bSFrançois Tigeot 
2403f2dd94aSFrançois Tigeot #define SNB_D_PLATFORM \
2413f2dd94aSFrançois Tigeot 	GEN6_FEATURES, \
2423f2dd94aSFrançois Tigeot 	.platform = INTEL_SANDYBRIDGE
2433f2dd94aSFrançois Tigeot 
2443f2dd94aSFrançois Tigeot static const struct intel_device_info intel_sandybridge_d_gt1_info = {
2453f2dd94aSFrançois Tigeot 	SNB_D_PLATFORM,
2463f2dd94aSFrançois Tigeot 	.gt = 1,
2471487f786SFrançois Tigeot };
2481487f786SFrançois Tigeot 
2493f2dd94aSFrançois Tigeot static const struct intel_device_info intel_sandybridge_d_gt2_info = {
2503f2dd94aSFrançois Tigeot 	SNB_D_PLATFORM,
2513f2dd94aSFrançois Tigeot 	.gt = 2,
2523f2dd94aSFrançois Tigeot };
2533f2dd94aSFrançois Tigeot 
2543f2dd94aSFrançois Tigeot #define SNB_M_PLATFORM \
2553f2dd94aSFrançois Tigeot 	GEN6_FEATURES, \
2563f2dd94aSFrançois Tigeot 	.platform = INTEL_SANDYBRIDGE, \
2573f2dd94aSFrançois Tigeot 	.is_mobile = 1
2583f2dd94aSFrançois Tigeot 
2593f2dd94aSFrançois Tigeot 
2603f2dd94aSFrançois Tigeot static const struct intel_device_info intel_sandybridge_m_gt1_info = {
2613f2dd94aSFrançois Tigeot 	SNB_M_PLATFORM,
2623f2dd94aSFrançois Tigeot 	.gt = 1,
2633f2dd94aSFrançois Tigeot };
2643f2dd94aSFrançois Tigeot 
2653f2dd94aSFrançois Tigeot static const struct intel_device_info intel_sandybridge_m_gt2_info = {
2663f2dd94aSFrançois Tigeot 	SNB_M_PLATFORM,
2673f2dd94aSFrançois Tigeot 	.gt = 2,
2681487f786SFrançois Tigeot };
2691487f786SFrançois Tigeot 
2701487f786SFrançois Tigeot #define GEN7_FEATURES  \
2711487f786SFrançois Tigeot 	.gen = 7, .num_pipes = 3, \
2721e12ee3bSFrançois Tigeot 	.has_hotplug = 1, \
2731487f786SFrançois Tigeot 	.has_fbc = 1, \
2741487f786SFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
2751487f786SFrançois Tigeot 	.has_llc = 1, \
2761e12ee3bSFrançois Tigeot 	.has_rc6 = 1, \
2771e12ee3bSFrançois Tigeot 	.has_rc6p = 1, \
278a85cb24fSFrançois Tigeot 	.has_aliasing_ppgtt = 1, \
279a85cb24fSFrançois Tigeot 	.has_full_ppgtt = 1, \
2801487f786SFrançois Tigeot 	GEN_DEFAULT_PIPEOFFSETS, \
2813f2dd94aSFrançois Tigeot 	GEN_DEFAULT_PAGE_SIZES, \
2821487f786SFrançois Tigeot 	IVB_CURSOR_OFFSETS
2831487f786SFrançois Tigeot 
2843f2dd94aSFrançois Tigeot #define IVB_D_PLATFORM \
2853f2dd94aSFrançois Tigeot 	GEN7_FEATURES, \
2863f2dd94aSFrançois Tigeot 	.platform = INTEL_IVYBRIDGE, \
2873f2dd94aSFrançois Tigeot 	.has_l3_dpf = 1
2883f2dd94aSFrançois Tigeot 
2893f2dd94aSFrançois Tigeot static const struct intel_device_info intel_ivybridge_d_gt1_info = {
2903f2dd94aSFrançois Tigeot 	IVB_D_PLATFORM,
2913f2dd94aSFrançois Tigeot 	.gt = 1,
2921487f786SFrançois Tigeot };
2931487f786SFrançois Tigeot 
2943f2dd94aSFrançois Tigeot static const struct intel_device_info intel_ivybridge_d_gt2_info = {
2953f2dd94aSFrançois Tigeot 	IVB_D_PLATFORM,
2963f2dd94aSFrançois Tigeot 	.gt = 2,
2973f2dd94aSFrançois Tigeot };
2983f2dd94aSFrançois Tigeot 
2993f2dd94aSFrançois Tigeot #define IVB_M_PLATFORM \
3003f2dd94aSFrançois Tigeot 	GEN7_FEATURES, \
3013f2dd94aSFrançois Tigeot 	.platform = INTEL_IVYBRIDGE, \
3023f2dd94aSFrançois Tigeot 	.is_mobile = 1, \
3033f2dd94aSFrançois Tigeot 	.has_l3_dpf = 1
3043f2dd94aSFrançois Tigeot 
3053f2dd94aSFrançois Tigeot static const struct intel_device_info intel_ivybridge_m_gt1_info = {
3063f2dd94aSFrançois Tigeot 	IVB_M_PLATFORM,
3073f2dd94aSFrançois Tigeot 	.gt = 1,
3083f2dd94aSFrançois Tigeot };
3093f2dd94aSFrançois Tigeot 
3103f2dd94aSFrançois Tigeot static const struct intel_device_info intel_ivybridge_m_gt2_info = {
3113f2dd94aSFrançois Tigeot 	IVB_M_PLATFORM,
3123f2dd94aSFrançois Tigeot 	.gt = 2,
3131487f786SFrançois Tigeot };
3141487f786SFrançois Tigeot 
3151487f786SFrançois Tigeot static const struct intel_device_info intel_ivybridge_q_info = {
3161487f786SFrançois Tigeot 	GEN7_FEATURES,
317a85cb24fSFrançois Tigeot 	.platform = INTEL_IVYBRIDGE,
3183f2dd94aSFrançois Tigeot 	.gt = 2,
3191487f786SFrançois Tigeot 	.num_pipes = 0, /* legal, last one wins */
3201e12ee3bSFrançois Tigeot 	.has_l3_dpf = 1,
3211487f786SFrançois Tigeot };
3221487f786SFrançois Tigeot 
3231e12ee3bSFrançois Tigeot static const struct intel_device_info intel_valleyview_info = {
324a85cb24fSFrançois Tigeot 	.platform = INTEL_VALLEYVIEW,
325a85cb24fSFrançois Tigeot 	.gen = 7,
326a85cb24fSFrançois Tigeot 	.is_lp = 1,
327a85cb24fSFrançois Tigeot 	.num_pipes = 2,
328a85cb24fSFrançois Tigeot 	.has_psr = 1,
329a85cb24fSFrançois Tigeot 	.has_runtime_pm = 1,
330a85cb24fSFrançois Tigeot 	.has_rc6 = 1,
331a85cb24fSFrançois Tigeot 	.has_gmch_display = 1,
332a85cb24fSFrançois Tigeot 	.has_hotplug = 1,
333a85cb24fSFrançois Tigeot 	.has_aliasing_ppgtt = 1,
334a85cb24fSFrançois Tigeot 	.has_full_ppgtt = 1,
3353f2dd94aSFrançois Tigeot 	.has_snoop = true,
336a85cb24fSFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING,
337a85cb24fSFrançois Tigeot 	.display_mmio_offset = VLV_DISPLAY_BASE,
3383f2dd94aSFrançois Tigeot 	GEN_DEFAULT_PAGE_SIZES,
339a85cb24fSFrançois Tigeot 	GEN_DEFAULT_PIPEOFFSETS,
340a85cb24fSFrançois Tigeot 	CURSOR_OFFSETS
3411487f786SFrançois Tigeot };
3421487f786SFrançois Tigeot 
3433f2dd94aSFrançois Tigeot #define G75_FEATURES  \
3441487f786SFrançois Tigeot 	GEN7_FEATURES, \
3451487f786SFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
3461487f786SFrançois Tigeot 	.has_ddi = 1, \
3471e12ee3bSFrançois Tigeot 	.has_fpga_dbg = 1, \
3481e12ee3bSFrançois Tigeot 	.has_psr = 1, \
3491e12ee3bSFrançois Tigeot 	.has_resource_streamer = 1, \
3501e12ee3bSFrançois Tigeot 	.has_dp_mst = 1, \
3511e12ee3bSFrançois Tigeot 	.has_rc6p = 0 /* RC6p removed-by HSW */, \
3521e12ee3bSFrançois Tigeot 	.has_runtime_pm = 1
3531487f786SFrançois Tigeot 
3543f2dd94aSFrançois Tigeot #define HSW_PLATFORM \
3553f2dd94aSFrançois Tigeot 	G75_FEATURES, \
3563f2dd94aSFrançois Tigeot 	.platform = INTEL_HASWELL, \
3573f2dd94aSFrançois Tigeot 	.has_l3_dpf = 1
3583f2dd94aSFrançois Tigeot 
3593f2dd94aSFrançois Tigeot static const struct intel_device_info intel_haswell_gt1_info = {
3603f2dd94aSFrançois Tigeot 	HSW_PLATFORM,
3613f2dd94aSFrançois Tigeot 	.gt = 1,
3621487f786SFrançois Tigeot };
3631487f786SFrançois Tigeot 
3643f2dd94aSFrançois Tigeot static const struct intel_device_info intel_haswell_gt2_info = {
3653f2dd94aSFrançois Tigeot 	HSW_PLATFORM,
3663f2dd94aSFrançois Tigeot 	.gt = 2,
3673f2dd94aSFrançois Tigeot };
3683f2dd94aSFrançois Tigeot 
3693f2dd94aSFrançois Tigeot static const struct intel_device_info intel_haswell_gt3_info = {
3703f2dd94aSFrançois Tigeot 	HSW_PLATFORM,
3713f2dd94aSFrançois Tigeot 	.gt = 3,
3723f2dd94aSFrançois Tigeot };
3733f2dd94aSFrançois Tigeot 
3743f2dd94aSFrançois Tigeot #define GEN8_FEATURES \
3753f2dd94aSFrançois Tigeot 	G75_FEATURES, \
3761e12ee3bSFrançois Tigeot 	BDW_COLORS, \
3773f2dd94aSFrançois Tigeot 	.page_sizes = I915_GTT_PAGE_SIZE_4K | \
3783f2dd94aSFrançois Tigeot 		      I915_GTT_PAGE_SIZE_2M, \
3794be47400SFrançois Tigeot 	.has_logical_ring_contexts = 1, \
380a85cb24fSFrançois Tigeot 	.has_full_48bit_ppgtt = 1, \
3813f2dd94aSFrançois Tigeot 	.has_64bit_reloc = 1, \
3823f2dd94aSFrançois Tigeot 	.has_reset_engine = 1
3831487f786SFrançois Tigeot 
3843f2dd94aSFrançois Tigeot #define BDW_PLATFORM \
3853f2dd94aSFrançois Tigeot 	GEN8_FEATURES, \
3863f2dd94aSFrançois Tigeot 	.gen = 8, \
3873f2dd94aSFrançois Tigeot 	.platform = INTEL_BROADWELL
3883f2dd94aSFrançois Tigeot 
3893f2dd94aSFrançois Tigeot static const struct intel_device_info intel_broadwell_gt1_info = {
3903f2dd94aSFrançois Tigeot 	BDW_PLATFORM,
3913f2dd94aSFrançois Tigeot 	.gt = 1,
3923f2dd94aSFrançois Tigeot };
3933f2dd94aSFrançois Tigeot 
3943f2dd94aSFrançois Tigeot static const struct intel_device_info intel_broadwell_gt2_info = {
3953f2dd94aSFrançois Tigeot 	BDW_PLATFORM,
3963f2dd94aSFrançois Tigeot 	.gt = 2,
3973f2dd94aSFrançois Tigeot };
3983f2dd94aSFrançois Tigeot 
3993f2dd94aSFrançois Tigeot static const struct intel_device_info intel_broadwell_rsvd_info = {
4003f2dd94aSFrançois Tigeot 	BDW_PLATFORM,
4013f2dd94aSFrançois Tigeot 	.gt = 3,
4023f2dd94aSFrançois Tigeot 	/* According to the device ID those devices are GT3, they were
4033f2dd94aSFrançois Tigeot 	 * previously treated as not GT3, keep it like that.
4043f2dd94aSFrançois Tigeot 	 */
4051487f786SFrançois Tigeot };
4061487f786SFrançois Tigeot 
4071e12ee3bSFrançois Tigeot static const struct intel_device_info intel_broadwell_gt3_info = {
4083f2dd94aSFrançois Tigeot 	BDW_PLATFORM,
4093f2dd94aSFrançois Tigeot 	.gt = 3,
4101487f786SFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
4111487f786SFrançois Tigeot };
4121487f786SFrançois Tigeot 
4131487f786SFrançois Tigeot static const struct intel_device_info intel_cherryview_info = {
4141487f786SFrançois Tigeot 	.gen = 8, .num_pipes = 3,
4151e12ee3bSFrançois Tigeot 	.has_hotplug = 1,
416a85cb24fSFrançois Tigeot 	.is_lp = 1,
4171487f786SFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
418a85cb24fSFrançois Tigeot 	.platform = INTEL_CHERRYVIEW,
4194be47400SFrançois Tigeot 	.has_64bit_reloc = 1,
4201e12ee3bSFrançois Tigeot 	.has_psr = 1,
4211e12ee3bSFrançois Tigeot 	.has_runtime_pm = 1,
4221e12ee3bSFrançois Tigeot 	.has_resource_streamer = 1,
4231e12ee3bSFrançois Tigeot 	.has_rc6 = 1,
4241e12ee3bSFrançois Tigeot 	.has_logical_ring_contexts = 1,
4251e12ee3bSFrançois Tigeot 	.has_gmch_display = 1,
426a85cb24fSFrançois Tigeot 	.has_aliasing_ppgtt = 1,
427a85cb24fSFrançois Tigeot 	.has_full_ppgtt = 1,
4283f2dd94aSFrançois Tigeot 	.has_reset_engine = 1,
4293f2dd94aSFrançois Tigeot 	.has_snoop = true,
4301487f786SFrançois Tigeot 	.display_mmio_offset = VLV_DISPLAY_BASE,
4313f2dd94aSFrançois Tigeot 	GEN_DEFAULT_PAGE_SIZES,
4321487f786SFrançois Tigeot 	GEN_CHV_PIPEOFFSETS,
4331487f786SFrançois Tigeot 	CURSOR_OFFSETS,
4341487f786SFrançois Tigeot 	CHV_COLORS,
4351487f786SFrançois Tigeot };
4361487f786SFrançois Tigeot 
4373f2dd94aSFrançois Tigeot #define GEN9_DEFAULT_PAGE_SIZES \
4383f2dd94aSFrançois Tigeot 	.page_sizes = I915_GTT_PAGE_SIZE_4K | \
4393f2dd94aSFrançois Tigeot 		      I915_GTT_PAGE_SIZE_64K | \
4403f2dd94aSFrançois Tigeot 		      I915_GTT_PAGE_SIZE_2M
4413f2dd94aSFrançois Tigeot 
4421e12ee3bSFrançois Tigeot #define GEN9_FEATURES \
4433f2dd94aSFrançois Tigeot 	GEN8_FEATURES, \
4443f2dd94aSFrançois Tigeot 	GEN9_DEFAULT_PAGE_SIZES, \
4453f2dd94aSFrançois Tigeot 	.has_logical_ring_preemption = 1, \
4463f2dd94aSFrançois Tigeot 	.has_csr = 1, \
4473f2dd94aSFrançois Tigeot 	.has_guc = 1, \
4483f2dd94aSFrançois Tigeot 	.has_ipc = 1, \
4491e12ee3bSFrançois Tigeot 	.ddb_size = 896
4501e12ee3bSFrançois Tigeot 
4513f2dd94aSFrançois Tigeot #define SKL_PLATFORM \
4523f2dd94aSFrançois Tigeot 	GEN9_FEATURES, \
4533f2dd94aSFrançois Tigeot 	.gen = 9, \
4543f2dd94aSFrançois Tigeot 	.platform = INTEL_SKYLAKE
4553f2dd94aSFrançois Tigeot 
4563f2dd94aSFrançois Tigeot static const struct intel_device_info intel_skylake_gt1_info = {
4573f2dd94aSFrançois Tigeot 	SKL_PLATFORM,
4583f2dd94aSFrançois Tigeot 	.gt = 1,
4591487f786SFrançois Tigeot };
4601487f786SFrançois Tigeot 
4613f2dd94aSFrançois Tigeot static const struct intel_device_info intel_skylake_gt2_info = {
4623f2dd94aSFrançois Tigeot 	SKL_PLATFORM,
4633f2dd94aSFrançois Tigeot 	.gt = 2,
4643f2dd94aSFrançois Tigeot };
4653f2dd94aSFrançois Tigeot 
4663f2dd94aSFrançois Tigeot #define SKL_GT3_PLUS_PLATFORM \
4673f2dd94aSFrançois Tigeot 	SKL_PLATFORM, \
4683f2dd94aSFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING
4693f2dd94aSFrançois Tigeot 
4703f2dd94aSFrançois Tigeot 
4711487f786SFrançois Tigeot static const struct intel_device_info intel_skylake_gt3_info = {
4723f2dd94aSFrançois Tigeot 	SKL_GT3_PLUS_PLATFORM,
4733f2dd94aSFrançois Tigeot 	.gt = 3,
4743f2dd94aSFrançois Tigeot };
4753f2dd94aSFrançois Tigeot 
4763f2dd94aSFrançois Tigeot static const struct intel_device_info intel_skylake_gt4_info = {
4773f2dd94aSFrançois Tigeot 	SKL_GT3_PLUS_PLATFORM,
4783f2dd94aSFrançois Tigeot 	.gt = 4,
4791487f786SFrançois Tigeot };
4801487f786SFrançois Tigeot 
481a85cb24fSFrançois Tigeot #define GEN9_LP_FEATURES \
482a85cb24fSFrançois Tigeot 	.gen = 9, \
483a85cb24fSFrançois Tigeot 	.is_lp = 1, \
484a85cb24fSFrançois Tigeot 	.has_hotplug = 1, \
485a85cb24fSFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
486a85cb24fSFrançois Tigeot 	.num_pipes = 3, \
487a85cb24fSFrançois Tigeot 	.has_64bit_reloc = 1, \
488a85cb24fSFrançois Tigeot 	.has_ddi = 1, \
489a85cb24fSFrançois Tigeot 	.has_fpga_dbg = 1, \
490a85cb24fSFrançois Tigeot 	.has_fbc = 1, \
4913f2dd94aSFrançois Tigeot 	.has_psr = 1, \
492a85cb24fSFrançois Tigeot 	.has_runtime_pm = 1, \
493a85cb24fSFrançois Tigeot 	.has_pooled_eu = 0, \
494a85cb24fSFrançois Tigeot 	.has_csr = 1, \
495a85cb24fSFrançois Tigeot 	.has_resource_streamer = 1, \
496a85cb24fSFrançois Tigeot 	.has_rc6 = 1, \
497a85cb24fSFrançois Tigeot 	.has_dp_mst = 1, \
498a85cb24fSFrançois Tigeot 	.has_logical_ring_contexts = 1, \
4993f2dd94aSFrançois Tigeot 	.has_logical_ring_preemption = 1, \
500a85cb24fSFrançois Tigeot 	.has_guc = 1, \
501a85cb24fSFrançois Tigeot 	.has_aliasing_ppgtt = 1, \
502a85cb24fSFrançois Tigeot 	.has_full_ppgtt = 1, \
503a85cb24fSFrançois Tigeot 	.has_full_48bit_ppgtt = 1, \
5043f2dd94aSFrançois Tigeot 	.has_reset_engine = 1, \
5053f2dd94aSFrançois Tigeot 	.has_snoop = true, \
5063f2dd94aSFrançois Tigeot 	.has_ipc = 1, \
5073f2dd94aSFrançois Tigeot 	GEN9_DEFAULT_PAGE_SIZES, \
508a85cb24fSFrançois Tigeot 	GEN_DEFAULT_PIPEOFFSETS, \
509a85cb24fSFrançois Tigeot 	IVB_CURSOR_OFFSETS, \
510a85cb24fSFrançois Tigeot 	BDW_COLORS
511a85cb24fSFrançois Tigeot 
5121487f786SFrançois Tigeot static const struct intel_device_info intel_broxton_info = {
513a85cb24fSFrançois Tigeot 	GEN9_LP_FEATURES,
514a85cb24fSFrançois Tigeot 	.platform = INTEL_BROXTON,
5151e12ee3bSFrançois Tigeot 	.ddb_size = 512,
5161487f786SFrançois Tigeot };
5171487f786SFrançois Tigeot 
518a85cb24fSFrançois Tigeot static const struct intel_device_info intel_geminilake_info = {
519a85cb24fSFrançois Tigeot 	GEN9_LP_FEATURES,
520a85cb24fSFrançois Tigeot 	.platform = INTEL_GEMINILAKE,
521a85cb24fSFrançois Tigeot 	.ddb_size = 1024,
5223f2dd94aSFrançois Tigeot 	GLK_COLORS,
523a85cb24fSFrançois Tigeot };
5241e12ee3bSFrançois Tigeot 
5253f2dd94aSFrançois Tigeot #define KBL_PLATFORM \
5263f2dd94aSFrançois Tigeot 	GEN9_FEATURES, \
5273f2dd94aSFrançois Tigeot 	.gen = 9, \
5283f2dd94aSFrançois Tigeot 	.platform = INTEL_KABYLAKE
5293f2dd94aSFrançois Tigeot 
530fc0abc32SFrançois Tigeot static const struct intel_device_info intel_kabylake_gt1_info = {
5313f2dd94aSFrançois Tigeot 	KBL_PLATFORM,
5323f2dd94aSFrançois Tigeot 	.gt = 1,
5331487f786SFrançois Tigeot };
5341487f786SFrançois Tigeot 
5351487f786SFrançois Tigeot static const struct intel_device_info intel_kabylake_gt2_info = {
5363f2dd94aSFrançois Tigeot 	KBL_PLATFORM,
5373f2dd94aSFrançois Tigeot 	.gt = 2,
5381487f786SFrançois Tigeot };
5391487f786SFrançois Tigeot 
5401487f786SFrançois Tigeot static const struct intel_device_info intel_kabylake_gt3_info = {
5413f2dd94aSFrançois Tigeot 	KBL_PLATFORM,
5423f2dd94aSFrançois Tigeot 	.gt = 3,
5431487f786SFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
5441487f786SFrançois Tigeot };
5451487f786SFrançois Tigeot 
5461e12ee3bSFrançois Tigeot #define CFL_PLATFORM \
5471e12ee3bSFrançois Tigeot 	GEN9_FEATURES, \
5483f2dd94aSFrançois Tigeot 	.gen = 9, \
5493f2dd94aSFrançois Tigeot 	.platform = INTEL_COFFEELAKE
5501e12ee3bSFrançois Tigeot 
5511487f786SFrançois Tigeot static const struct intel_device_info intel_coffeelake_gt1_info = {
5521e12ee3bSFrançois Tigeot 	CFL_PLATFORM,
5533f2dd94aSFrançois Tigeot 	.gt = 1,
5541487f786SFrançois Tigeot };
5551487f786SFrançois Tigeot 
5561487f786SFrançois Tigeot static const struct intel_device_info intel_coffeelake_gt2_info = {
5571e12ee3bSFrançois Tigeot 	CFL_PLATFORM,
5583f2dd94aSFrançois Tigeot 	.gt = 2,
5591487f786SFrançois Tigeot };
5601487f786SFrançois Tigeot 
5611487f786SFrançois Tigeot static const struct intel_device_info intel_coffeelake_gt3_info = {
5621e12ee3bSFrançois Tigeot 	CFL_PLATFORM,
5633f2dd94aSFrançois Tigeot 	.gt = 3,
5641487f786SFrançois Tigeot 	.ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
5651487f786SFrançois Tigeot };
5661487f786SFrançois Tigeot 
5673f2dd94aSFrançois Tigeot #define GEN10_FEATURES \
5683f2dd94aSFrançois Tigeot 	GEN9_FEATURES, \
5693f2dd94aSFrançois Tigeot 	.ddb_size = 1024, \
5703f2dd94aSFrançois Tigeot 	GLK_COLORS
5713f2dd94aSFrançois Tigeot 
5723f2dd94aSFrançois Tigeot static const struct intel_device_info intel_cannonlake_gt2_info = {
5733f2dd94aSFrançois Tigeot 	GEN10_FEATURES,
5743f2dd94aSFrançois Tigeot 	.is_alpha_support = 1,
5753f2dd94aSFrançois Tigeot 	.platform = INTEL_CANNONLAKE,
5763f2dd94aSFrançois Tigeot 	.gen = 10,
5773f2dd94aSFrançois Tigeot 	.gt = 2,
5783f2dd94aSFrançois Tigeot };
5793f2dd94aSFrançois Tigeot 
5801487f786SFrançois Tigeot /*
5811487f786SFrançois Tigeot  * Make sure any device matches here are from most specific to most
5821487f786SFrançois Tigeot  * general.  For example, since the Quanta match is based on the subsystem
5831487f786SFrançois Tigeot  * and subvendor IDs, we need it to come before the more general IVB
5841487f786SFrançois Tigeot  * PCI ID matches, otherwise we'll use the wrong info struct above.
5851487f786SFrançois Tigeot  */
5861487f786SFrançois Tigeot static const struct pci_device_id pciidlist[] = {
5871487f786SFrançois Tigeot 	INTEL_I830_IDS(&intel_i830_info),
588a85cb24fSFrançois Tigeot 	INTEL_I845G_IDS(&intel_i845g_info),
5891487f786SFrançois Tigeot 	INTEL_I85X_IDS(&intel_i85x_info),
5901487f786SFrançois Tigeot 	INTEL_I865G_IDS(&intel_i865g_info),
5911487f786SFrançois Tigeot 	INTEL_I915G_IDS(&intel_i915g_info),
5921487f786SFrançois Tigeot 	INTEL_I915GM_IDS(&intel_i915gm_info),
5931487f786SFrançois Tigeot 	INTEL_I945G_IDS(&intel_i945g_info),
5941487f786SFrançois Tigeot 	INTEL_I945GM_IDS(&intel_i945gm_info),
5951487f786SFrançois Tigeot 	INTEL_I965G_IDS(&intel_i965g_info),
5961487f786SFrançois Tigeot 	INTEL_G33_IDS(&intel_g33_info),
5971487f786SFrançois Tigeot 	INTEL_I965GM_IDS(&intel_i965gm_info),
5981487f786SFrançois Tigeot 	INTEL_GM45_IDS(&intel_gm45_info),
5991487f786SFrançois Tigeot 	INTEL_G45_IDS(&intel_g45_info),
6001487f786SFrançois Tigeot 	INTEL_PINEVIEW_IDS(&intel_pineview_info),
6011487f786SFrançois Tigeot 	INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info),
6021487f786SFrançois Tigeot 	INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info),
6033f2dd94aSFrançois Tigeot 	INTEL_SNB_D_GT1_IDS(&intel_sandybridge_d_gt1_info),
6043f2dd94aSFrançois Tigeot 	INTEL_SNB_D_GT2_IDS(&intel_sandybridge_d_gt2_info),
6053f2dd94aSFrançois Tigeot 	INTEL_SNB_M_GT1_IDS(&intel_sandybridge_m_gt1_info),
6063f2dd94aSFrançois Tigeot 	INTEL_SNB_M_GT2_IDS(&intel_sandybridge_m_gt2_info),
6071487f786SFrançois Tigeot 	INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */
6083f2dd94aSFrançois Tigeot 	INTEL_IVB_M_GT1_IDS(&intel_ivybridge_m_gt1_info),
6093f2dd94aSFrançois Tigeot 	INTEL_IVB_M_GT2_IDS(&intel_ivybridge_m_gt2_info),
6103f2dd94aSFrançois Tigeot 	INTEL_IVB_D_GT1_IDS(&intel_ivybridge_d_gt1_info),
6113f2dd94aSFrançois Tigeot 	INTEL_IVB_D_GT2_IDS(&intel_ivybridge_d_gt2_info),
6123f2dd94aSFrançois Tigeot 	INTEL_HSW_GT1_IDS(&intel_haswell_gt1_info),
6133f2dd94aSFrançois Tigeot 	INTEL_HSW_GT2_IDS(&intel_haswell_gt2_info),
6143f2dd94aSFrançois Tigeot 	INTEL_HSW_GT3_IDS(&intel_haswell_gt3_info),
6151e12ee3bSFrançois Tigeot 	INTEL_VLV_IDS(&intel_valleyview_info),
6163f2dd94aSFrançois Tigeot 	INTEL_BDW_GT1_IDS(&intel_broadwell_gt1_info),
6173f2dd94aSFrançois Tigeot 	INTEL_BDW_GT2_IDS(&intel_broadwell_gt2_info),
6181e12ee3bSFrançois Tigeot 	INTEL_BDW_GT3_IDS(&intel_broadwell_gt3_info),
6193f2dd94aSFrançois Tigeot 	INTEL_BDW_RSVD_IDS(&intel_broadwell_rsvd_info),
6201487f786SFrançois Tigeot 	INTEL_CHV_IDS(&intel_cherryview_info),
6213f2dd94aSFrançois Tigeot 	INTEL_SKL_GT1_IDS(&intel_skylake_gt1_info),
6223f2dd94aSFrançois Tigeot 	INTEL_SKL_GT2_IDS(&intel_skylake_gt2_info),
6231487f786SFrançois Tigeot 	INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info),
6243f2dd94aSFrançois Tigeot 	INTEL_SKL_GT4_IDS(&intel_skylake_gt4_info),
6251487f786SFrançois Tigeot 	INTEL_BXT_IDS(&intel_broxton_info),
626a85cb24fSFrançois Tigeot 	INTEL_GLK_IDS(&intel_geminilake_info),
627fc0abc32SFrançois Tigeot 	INTEL_KBL_GT1_IDS(&intel_kabylake_gt1_info),
628fc0abc32SFrançois Tigeot 	INTEL_KBL_GT2_IDS(&intel_kabylake_gt2_info),
6291487f786SFrançois Tigeot 	INTEL_KBL_GT3_IDS(&intel_kabylake_gt3_info),
6301487f786SFrançois Tigeot 	INTEL_KBL_GT4_IDS(&intel_kabylake_gt3_info),
6311487f786SFrançois Tigeot 	INTEL_CFL_S_GT1_IDS(&intel_coffeelake_gt1_info),
6321487f786SFrançois Tigeot 	INTEL_CFL_S_GT2_IDS(&intel_coffeelake_gt2_info),
6331487f786SFrançois Tigeot 	INTEL_CFL_H_GT2_IDS(&intel_coffeelake_gt2_info),
6341487f786SFrançois Tigeot 	INTEL_CFL_U_GT3_IDS(&intel_coffeelake_gt3_info),
6356b81ae0fSMichael Neumann 	INTEL_WHL_U_GT1_IDS(&intel_coffeelake_gt1_info),
6366b81ae0fSMichael Neumann 	INTEL_WHL_U_GT2_IDS(&intel_coffeelake_gt2_info),
6376b81ae0fSMichael Neumann 	INTEL_WHL_U_GT3_IDS(&intel_coffeelake_gt3_info),
6383f2dd94aSFrançois Tigeot 	INTEL_CNL_U_GT2_IDS(&intel_cannonlake_gt2_info),
6393f2dd94aSFrançois Tigeot 	INTEL_CNL_Y_GT2_IDS(&intel_cannonlake_gt2_info),
6401487f786SFrançois Tigeot 	{0, 0, 0}
6411487f786SFrançois Tigeot };
6421487f786SFrançois Tigeot MODULE_DEVICE_TABLE(pci, pciidlist);
6431487f786SFrançois Tigeot 
i915_pci_remove(struct pci_dev * pdev)644a85cb24fSFrançois Tigeot static void i915_pci_remove(struct pci_dev *pdev)
645a85cb24fSFrançois Tigeot {
646a85cb24fSFrançois Tigeot 	struct drm_device *dev = pci_get_drvdata(pdev);
647a85cb24fSFrançois Tigeot 
648a85cb24fSFrançois Tigeot 	i915_driver_unload(dev);
6493f2dd94aSFrançois Tigeot 	drm_dev_put(dev);
650a85cb24fSFrançois Tigeot }
651a85cb24fSFrançois Tigeot 
i915_pci_probe(struct pci_dev * pdev,const struct pci_device_id * ent)6521487f786SFrançois Tigeot static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
6531487f786SFrançois Tigeot {
6541487f786SFrançois Tigeot 	struct intel_device_info *intel_info =
6551487f786SFrançois Tigeot 		(struct intel_device_info *) ent->driver_data;
656a85cb24fSFrançois Tigeot 	int err;
6571487f786SFrançois Tigeot 
6583f2dd94aSFrançois Tigeot 	if (IS_ALPHA_SUPPORT(intel_info) && !i915_modparams.alpha_support) {
6594be47400SFrançois Tigeot 		DRM_INFO("The driver support for your hardware in this kernel version is alpha quality\n"
6604be47400SFrançois Tigeot 			 "See CONFIG_DRM_I915_ALPHA_SUPPORT or i915.alpha_support module parameter\n"
6614be47400SFrançois Tigeot 			 "to enable support in this kernel version, or check for kernel updates.\n");
6621487f786SFrançois Tigeot 		return -ENODEV;
6631487f786SFrançois Tigeot 	}
6641487f786SFrançois Tigeot 
6651487f786SFrançois Tigeot 	/* Only bind to function 0 of the device. Early generations
6661487f786SFrançois Tigeot 	 * used function 1 as a placeholder for multi-head. This causes
6671487f786SFrançois Tigeot 	 * us confusion instead, especially on the systems where both
6681487f786SFrançois Tigeot 	 * functions have the same PCI-ID!
6691487f786SFrançois Tigeot 	 */
6701487f786SFrançois Tigeot 	if (PCI_FUNC(pdev->devfn))
6711487f786SFrançois Tigeot 		return -ENODEV;
6721487f786SFrançois Tigeot 
6731487f786SFrançois Tigeot 	/*
6741487f786SFrançois Tigeot 	 * apple-gmux is needed on dual GPU MacBook Pro
6751487f786SFrançois Tigeot 	 * to probe the panel if we're the inactive GPU.
6761487f786SFrançois Tigeot 	 */
6771487f786SFrançois Tigeot 	if (vga_switcheroo_client_probe_defer(pdev))
6781487f786SFrançois Tigeot 		return -EPROBE_DEFER;
6791487f786SFrançois Tigeot 
680a85cb24fSFrançois Tigeot 	err = i915_driver_load(pdev, ent);
681a85cb24fSFrançois Tigeot 	if (err)
682a85cb24fSFrançois Tigeot 		return err;
683a85cb24fSFrançois Tigeot 
684a85cb24fSFrançois Tigeot 	err = i915_live_selftests(pdev);
685a85cb24fSFrançois Tigeot 	if (err) {
686a85cb24fSFrançois Tigeot 		i915_pci_remove(pdev);
687a85cb24fSFrançois Tigeot 		return err > 0 ? -ENOTTY : err;
6881487f786SFrançois Tigeot 	}
6891487f786SFrançois Tigeot 
690a85cb24fSFrançois Tigeot 	return 0;
6911487f786SFrançois Tigeot }
6921487f786SFrançois Tigeot 
6931487f786SFrançois Tigeot static struct pci_driver i915_pci_driver = {
6941487f786SFrançois Tigeot 	.name = DRIVER_NAME,
6951487f786SFrançois Tigeot 	.id_table = pciidlist,
6961487f786SFrançois Tigeot 	.probe = i915_pci_probe,
6971487f786SFrançois Tigeot 	.remove = i915_pci_remove,
6981487f786SFrançois Tigeot #if 0
6991487f786SFrançois Tigeot 	.driver.pm = &i915_pm_ops,
7001487f786SFrançois Tigeot #endif
7011487f786SFrançois Tigeot };
7021487f786SFrançois Tigeot 
i915_init(void)7031487f786SFrançois Tigeot static int __init i915_init(void)
7041487f786SFrançois Tigeot {
7051487f786SFrançois Tigeot 	bool use_kms = true;
706a85cb24fSFrançois Tigeot 	int err;
707a85cb24fSFrançois Tigeot 
708a85cb24fSFrançois Tigeot 	err = i915_mock_selftests();
709a85cb24fSFrançois Tigeot 	if (err)
710a85cb24fSFrançois Tigeot 		return err > 0 ? 0 : err;
7111487f786SFrançois Tigeot 
7121487f786SFrançois Tigeot 	/*
7131487f786SFrançois Tigeot 	 * Enable KMS by default, unless explicitly overriden by
7141487f786SFrançois Tigeot 	 * either the i915.modeset prarameter or by the
7151487f786SFrançois Tigeot 	 * vga_text_mode_force boot option.
7161487f786SFrançois Tigeot 	 */
7171487f786SFrançois Tigeot 
7183f2dd94aSFrançois Tigeot 	if (i915_modparams.modeset == 0)
7191487f786SFrançois Tigeot 		use_kms = false;
7201487f786SFrançois Tigeot 
7213f2dd94aSFrançois Tigeot 	if (vgacon_text_force() && i915_modparams.modeset == -1)
7221487f786SFrançois Tigeot 		use_kms = false;
7231487f786SFrançois Tigeot 
7241487f786SFrançois Tigeot 	if (!use_kms) {
7251487f786SFrançois Tigeot 		/* Silently fail loading to not upset userspace. */
7261487f786SFrançois Tigeot 		DRM_DEBUG_DRIVER("KMS disabled.\n");
7271487f786SFrançois Tigeot 		return 0;
7281487f786SFrançois Tigeot 	}
7291487f786SFrançois Tigeot 
7301487f786SFrançois Tigeot 	return pci_register_driver(&i915_pci_driver);
7311487f786SFrançois Tigeot }
7321487f786SFrançois Tigeot 
i915_exit(void)7331487f786SFrançois Tigeot static void __exit i915_exit(void)
7341487f786SFrançois Tigeot {
7351487f786SFrançois Tigeot #if 0
7361487f786SFrançois Tigeot 	if (!i915_pci_driver.driver.owner)
7371487f786SFrançois Tigeot 		return;
7381487f786SFrançois Tigeot #endif
7391487f786SFrançois Tigeot 
7401487f786SFrançois Tigeot 	pci_unregister_driver(&i915_pci_driver);
7411487f786SFrançois Tigeot }
7421487f786SFrançois Tigeot 
7431487f786SFrançois Tigeot module_init(i915_init);
7441487f786SFrançois Tigeot module_exit(i915_exit);
7451487f786SFrançois Tigeot 
7461487f786SFrançois Tigeot MODULE_AUTHOR("Tungsten Graphics, Inc.");
7471487f786SFrançois Tigeot MODULE_AUTHOR("Intel Corporation");
7481487f786SFrançois Tigeot 
7491487f786SFrançois Tigeot static int
i915_pci_probe_dfly(device_t kdev)7501487f786SFrançois Tigeot i915_pci_probe_dfly(device_t kdev)
7511487f786SFrançois Tigeot {
7521487f786SFrançois Tigeot 	int device, i = 0;
7531487f786SFrançois Tigeot 	const struct pci_device_id *ent;
7541487f786SFrançois Tigeot 	static struct pci_dev *pdev = NULL;
7551487f786SFrançois Tigeot 	static device_t bsddev;
7561487f786SFrançois Tigeot 
7571487f786SFrançois Tigeot 	if (pci_get_class(kdev) != PCIC_DISPLAY)
7581487f786SFrançois Tigeot 		return ENXIO;
7591487f786SFrançois Tigeot 
7601487f786SFrançois Tigeot 	if (pci_get_vendor(kdev) != PCI_VENDOR_ID_INTEL)
7611487f786SFrançois Tigeot 		return ENXIO;
7621487f786SFrançois Tigeot 
7631487f786SFrançois Tigeot 	device = pci_get_device(kdev);
7641487f786SFrançois Tigeot 
7651487f786SFrançois Tigeot 	for (i = 0; pciidlist[i].device != 0; i++) {
7661487f786SFrançois Tigeot 		if (pciidlist[i].device == device) {
7671487f786SFrançois Tigeot 			ent = &pciidlist[i];
7681487f786SFrançois Tigeot 			goto found;
7691487f786SFrançois Tigeot 		}
7701487f786SFrançois Tigeot 	}
7711487f786SFrançois Tigeot 
7721487f786SFrançois Tigeot 	return ENXIO;
7731487f786SFrançois Tigeot found:
7741487f786SFrançois Tigeot 	if (!strcmp(device_get_name(kdev), "drmsub"))
7751487f786SFrançois Tigeot 		bsddev = device_get_parent(kdev);
7761487f786SFrançois Tigeot 	else
7771487f786SFrançois Tigeot 		bsddev = kdev;
7781487f786SFrançois Tigeot 
7791487f786SFrançois Tigeot 	drm_init_pdev(bsddev, &pdev);
7801487f786SFrançois Tigeot 
7811487f786SFrançois Tigeot 	/* Print the contents of pdev struct. */
7821487f786SFrançois Tigeot 	drm_print_pdev(pdev);
7831487f786SFrançois Tigeot 
7841487f786SFrançois Tigeot 	return i915_pci_probe(pdev, ent);
7851487f786SFrançois Tigeot }
7861487f786SFrançois Tigeot 
i915_driver_attach(device_t kdev)7871487f786SFrançois Tigeot static int i915_driver_attach(device_t kdev)
7881487f786SFrançois Tigeot {
7891487f786SFrançois Tigeot 	return 0;
7901487f786SFrançois Tigeot }
7911487f786SFrançois Tigeot 
7921487f786SFrançois Tigeot static device_method_t i915_methods[] = {
7931487f786SFrançois Tigeot 	/* Device interface */
7941487f786SFrançois Tigeot 	DEVMETHOD(device_probe,		i915_pci_probe_dfly),
7951487f786SFrançois Tigeot 	DEVMETHOD(device_attach,	i915_driver_attach),
796a85cb24fSFrançois Tigeot #if 0
7971487f786SFrançois Tigeot 	DEVMETHOD(device_suspend,	i915_suspend_switcheroo),
7981487f786SFrançois Tigeot 	DEVMETHOD(device_resume,	i915_resume_switcheroo),
799a85cb24fSFrançois Tigeot #endif
8001487f786SFrançois Tigeot 	DEVMETHOD(device_detach,	drm_release),
8011487f786SFrançois Tigeot 	DEVMETHOD_END
8021487f786SFrançois Tigeot };
8031487f786SFrançois Tigeot 
8041487f786SFrançois Tigeot static driver_t i915_driver = {
8051487f786SFrançois Tigeot 	"drm",
8061487f786SFrançois Tigeot 	i915_methods,
8071487f786SFrançois Tigeot 	sizeof(struct drm_softc)
8081487f786SFrançois Tigeot };
8091487f786SFrançois Tigeot 
8101487f786SFrançois Tigeot extern devclass_t drm_devclass;
8111487f786SFrançois Tigeot 
812*5716abfeSMatthew Dillon DRIVER_MODULE_ORDERED(i915, vgapci, i915_driver, &drm_devclass, NULL, NULL, SI_ORDER_ANY);
8131487f786SFrançois Tigeot MODULE_DEPEND(i915, drm, 1, 1, 1);
8141487f786SFrançois Tigeot #ifdef CONFIG_ACPI
8151487f786SFrançois Tigeot MODULE_DEPEND(i915, acpi, 1, 1, 1);
8161487f786SFrançois Tigeot #endif
817