Home | History | Annotate | Line # | Download | only in i915
      1  1.5  riastrad /*	$NetBSD: i915_pci.c,v 1.5 2024/01/14 22:15:15 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad  * Copyright  2016 Intel Corporation
      5  1.1  riastrad  *
      6  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
      7  1.1  riastrad  * copy of this software and associated documentation files (the "Software"),
      8  1.1  riastrad  * to deal in the Software without restriction, including without limitation
      9  1.1  riastrad  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  1.1  riastrad  * and/or sell copies of the Software, and to permit persons to whom the
     11  1.1  riastrad  * Software is furnished to do so, subject to the following conditions:
     12  1.1  riastrad  *
     13  1.1  riastrad  * The above copyright notice and this permission notice (including the next
     14  1.1  riastrad  * paragraph) shall be included in all copies or substantial portions of the
     15  1.1  riastrad  * Software.
     16  1.1  riastrad  *
     17  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     18  1.1  riastrad  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     19  1.1  riastrad  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     20  1.1  riastrad  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     21  1.1  riastrad  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     22  1.1  riastrad  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
     23  1.1  riastrad  * IN THE SOFTWARE.
     24  1.1  riastrad  *
     25  1.1  riastrad  */
     26  1.1  riastrad 
     27  1.1  riastrad #include <sys/cdefs.h>
     28  1.5  riastrad __KERNEL_RCSID(0, "$NetBSD: i915_pci.c,v 1.5 2024/01/14 22:15:15 riastradh Exp $");
     29  1.1  riastrad 
     30  1.1  riastrad #include <linux/console.h>
     31  1.1  riastrad #include <linux/vga_switcheroo.h>
     32  1.1  riastrad 
     33  1.1  riastrad #include <drm/drm_drv.h>
     34  1.1  riastrad 
     35  1.1  riastrad #include "display/intel_fbdev.h"
     36  1.1  riastrad 
     37  1.1  riastrad #include "i915_drv.h"
     38  1.1  riastrad #include "i915_perf.h"
     39  1.1  riastrad #include "i915_globals.h"
     40  1.1  riastrad #include "i915_selftest.h"
     41  1.1  riastrad 
     42  1.1  riastrad #define PLATFORM(x) .platform = (x)
     43  1.1  riastrad #define GEN(x) .gen = (x), .gen_mask = BIT((x) - 1)
     44  1.1  riastrad 
     45  1.1  riastrad #define I845_PIPE_OFFSETS \
     46  1.1  riastrad 	.pipe_offsets = { \
     47  1.1  riastrad 		[TRANSCODER_A] = PIPE_A_OFFSET,	\
     48  1.1  riastrad 	}, \
     49  1.1  riastrad 	.trans_offsets = { \
     50  1.1  riastrad 		[TRANSCODER_A] = TRANSCODER_A_OFFSET, \
     51  1.1  riastrad 	}
     52  1.1  riastrad 
     53  1.1  riastrad #define I9XX_PIPE_OFFSETS \
     54  1.1  riastrad 	.pipe_offsets = { \
     55  1.1  riastrad 		[TRANSCODER_A] = PIPE_A_OFFSET,	\
     56  1.1  riastrad 		[TRANSCODER_B] = PIPE_B_OFFSET, \
     57  1.1  riastrad 	}, \
     58  1.1  riastrad 	.trans_offsets = { \
     59  1.1  riastrad 		[TRANSCODER_A] = TRANSCODER_A_OFFSET, \
     60  1.1  riastrad 		[TRANSCODER_B] = TRANSCODER_B_OFFSET, \
     61  1.1  riastrad 	}
     62  1.1  riastrad 
     63  1.1  riastrad #define IVB_PIPE_OFFSETS \
     64  1.1  riastrad 	.pipe_offsets = { \
     65  1.1  riastrad 		[TRANSCODER_A] = PIPE_A_OFFSET,	\
     66  1.1  riastrad 		[TRANSCODER_B] = PIPE_B_OFFSET, \
     67  1.1  riastrad 		[TRANSCODER_C] = PIPE_C_OFFSET, \
     68  1.1  riastrad 	}, \
     69  1.1  riastrad 	.trans_offsets = { \
     70  1.1  riastrad 		[TRANSCODER_A] = TRANSCODER_A_OFFSET, \
     71  1.1  riastrad 		[TRANSCODER_B] = TRANSCODER_B_OFFSET, \
     72  1.1  riastrad 		[TRANSCODER_C] = TRANSCODER_C_OFFSET, \
     73  1.1  riastrad 	}
     74  1.1  riastrad 
     75  1.1  riastrad #define HSW_PIPE_OFFSETS \
     76  1.1  riastrad 	.pipe_offsets = { \
     77  1.1  riastrad 		[TRANSCODER_A] = PIPE_A_OFFSET,	\
     78  1.1  riastrad 		[TRANSCODER_B] = PIPE_B_OFFSET, \
     79  1.1  riastrad 		[TRANSCODER_C] = PIPE_C_OFFSET, \
     80  1.1  riastrad 		[TRANSCODER_EDP] = PIPE_EDP_OFFSET, \
     81  1.1  riastrad 	}, \
     82  1.1  riastrad 	.trans_offsets = { \
     83  1.1  riastrad 		[TRANSCODER_A] = TRANSCODER_A_OFFSET, \
     84  1.1  riastrad 		[TRANSCODER_B] = TRANSCODER_B_OFFSET, \
     85  1.1  riastrad 		[TRANSCODER_C] = TRANSCODER_C_OFFSET, \
     86  1.1  riastrad 		[TRANSCODER_EDP] = TRANSCODER_EDP_OFFSET, \
     87  1.1  riastrad 	}
     88  1.1  riastrad 
     89  1.1  riastrad #define CHV_PIPE_OFFSETS \
     90  1.1  riastrad 	.pipe_offsets = { \
     91  1.1  riastrad 		[TRANSCODER_A] = PIPE_A_OFFSET, \
     92  1.1  riastrad 		[TRANSCODER_B] = PIPE_B_OFFSET, \
     93  1.1  riastrad 		[TRANSCODER_C] = CHV_PIPE_C_OFFSET, \
     94  1.1  riastrad 	}, \
     95  1.1  riastrad 	.trans_offsets = { \
     96  1.1  riastrad 		[TRANSCODER_A] = TRANSCODER_A_OFFSET, \
     97  1.1  riastrad 		[TRANSCODER_B] = TRANSCODER_B_OFFSET, \
     98  1.1  riastrad 		[TRANSCODER_C] = CHV_TRANSCODER_C_OFFSET, \
     99  1.1  riastrad 	}
    100  1.1  riastrad 
    101  1.1  riastrad #define I845_CURSOR_OFFSETS \
    102  1.1  riastrad 	.cursor_offsets = { \
    103  1.1  riastrad 		[PIPE_A] = CURSOR_A_OFFSET, \
    104  1.1  riastrad 	}
    105  1.1  riastrad 
    106  1.1  riastrad #define I9XX_CURSOR_OFFSETS \
    107  1.1  riastrad 	.cursor_offsets = { \
    108  1.1  riastrad 		[PIPE_A] = CURSOR_A_OFFSET, \
    109  1.1  riastrad 		[PIPE_B] = CURSOR_B_OFFSET, \
    110  1.1  riastrad 	}
    111  1.1  riastrad 
    112  1.1  riastrad #define CHV_CURSOR_OFFSETS \
    113  1.1  riastrad 	.cursor_offsets = { \
    114  1.1  riastrad 		[PIPE_A] = CURSOR_A_OFFSET, \
    115  1.1  riastrad 		[PIPE_B] = CURSOR_B_OFFSET, \
    116  1.1  riastrad 		[PIPE_C] = CHV_CURSOR_C_OFFSET, \
    117  1.1  riastrad 	}
    118  1.1  riastrad 
    119  1.1  riastrad #define IVB_CURSOR_OFFSETS \
    120  1.1  riastrad 	.cursor_offsets = { \
    121  1.1  riastrad 		[PIPE_A] = CURSOR_A_OFFSET, \
    122  1.1  riastrad 		[PIPE_B] = IVB_CURSOR_B_OFFSET, \
    123  1.1  riastrad 		[PIPE_C] = IVB_CURSOR_C_OFFSET, \
    124  1.1  riastrad 	}
    125  1.1  riastrad 
    126  1.1  riastrad #define TGL_CURSOR_OFFSETS \
    127  1.1  riastrad 	.cursor_offsets = { \
    128  1.1  riastrad 		[PIPE_A] = CURSOR_A_OFFSET, \
    129  1.1  riastrad 		[PIPE_B] = IVB_CURSOR_B_OFFSET, \
    130  1.1  riastrad 		[PIPE_C] = IVB_CURSOR_C_OFFSET, \
    131  1.1  riastrad 		[PIPE_D] = TGL_CURSOR_D_OFFSET, \
    132  1.1  riastrad 	}
    133  1.1  riastrad 
    134  1.1  riastrad #define I9XX_COLORS \
    135  1.1  riastrad 	.color = { .gamma_lut_size = 256 }
    136  1.1  riastrad #define I965_COLORS \
    137  1.1  riastrad 	.color = { .gamma_lut_size = 129, \
    138  1.1  riastrad 		   .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
    139  1.1  riastrad 	}
    140  1.1  riastrad #define ILK_COLORS \
    141  1.1  riastrad 	.color = { .gamma_lut_size = 1024 }
    142  1.1  riastrad #define IVB_COLORS \
    143  1.1  riastrad 	.color = { .degamma_lut_size = 1024, .gamma_lut_size = 1024 }
    144  1.1  riastrad #define CHV_COLORS \
    145  1.1  riastrad 	.color = { .degamma_lut_size = 65, .gamma_lut_size = 257, \
    146  1.1  riastrad 		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
    147  1.1  riastrad 		   .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
    148  1.1  riastrad 	}
    149  1.1  riastrad #define GLK_COLORS \
    150  1.1  riastrad 	.color = { .degamma_lut_size = 33, .gamma_lut_size = 1024, \
    151  1.1  riastrad 		   .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
    152  1.1  riastrad 					DRM_COLOR_LUT_EQUAL_CHANNELS, \
    153  1.1  riastrad 	}
    154  1.1  riastrad 
    155  1.1  riastrad /* Keep in gen based order, and chronological order within a gen */
    156  1.1  riastrad 
    157  1.1  riastrad #define GEN_DEFAULT_PAGE_SIZES \
    158  1.1  riastrad 	.page_sizes = I915_GTT_PAGE_SIZE_4K
    159  1.1  riastrad 
    160  1.1  riastrad #define GEN_DEFAULT_REGIONS \
    161  1.1  riastrad 	.memory_regions = REGION_SMEM | REGION_STOLEN
    162  1.1  riastrad 
    163  1.1  riastrad #define I830_FEATURES \
    164  1.1  riastrad 	GEN(2), \
    165  1.1  riastrad 	.is_mobile = 1, \
    166  1.1  riastrad 	.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B), \
    167  1.1  riastrad 	.display.has_overlay = 1, \
    168  1.1  riastrad 	.display.cursor_needs_physical = 1, \
    169  1.1  riastrad 	.display.overlay_needs_physical = 1, \
    170  1.1  riastrad 	.display.has_gmch = 1, \
    171  1.1  riastrad 	.gpu_reset_clobbers_display = true, \
    172  1.1  riastrad 	.hws_needs_physical = 1, \
    173  1.1  riastrad 	.unfenced_needs_alignment = 1, \
    174  1.1  riastrad 	.engine_mask = BIT(RCS0), \
    175  1.1  riastrad 	.has_snoop = true, \
    176  1.1  riastrad 	.has_coherent_ggtt = false, \
    177  1.1  riastrad 	I9XX_PIPE_OFFSETS, \
    178  1.1  riastrad 	I9XX_CURSOR_OFFSETS, \
    179  1.1  riastrad 	I9XX_COLORS, \
    180  1.1  riastrad 	GEN_DEFAULT_PAGE_SIZES, \
    181  1.1  riastrad 	GEN_DEFAULT_REGIONS
    182  1.1  riastrad 
    183  1.1  riastrad #define I845_FEATURES \
    184  1.1  riastrad 	GEN(2), \
    185  1.1  riastrad 	.pipe_mask = BIT(PIPE_A), \
    186  1.1  riastrad 	.display.has_overlay = 1, \
    187  1.1  riastrad 	.display.overlay_needs_physical = 1, \
    188  1.1  riastrad 	.display.has_gmch = 1, \
    189  1.1  riastrad 	.gpu_reset_clobbers_display = true, \
    190  1.1  riastrad 	.hws_needs_physical = 1, \
    191  1.1  riastrad 	.unfenced_needs_alignment = 1, \
    192  1.1  riastrad 	.engine_mask = BIT(RCS0), \
    193  1.1  riastrad 	.has_snoop = true, \
    194  1.1  riastrad 	.has_coherent_ggtt = false, \
    195  1.1  riastrad 	I845_PIPE_OFFSETS, \
    196  1.1  riastrad 	I845_CURSOR_OFFSETS, \
    197  1.1  riastrad 	I9XX_COLORS, \
    198  1.1  riastrad 	GEN_DEFAULT_PAGE_SIZES, \
    199  1.1  riastrad 	GEN_DEFAULT_REGIONS
    200  1.1  riastrad 
    201  1.1  riastrad static const struct intel_device_info i830_info = {
    202  1.1  riastrad 	I830_FEATURES,
    203  1.1  riastrad 	PLATFORM(INTEL_I830),
    204  1.1  riastrad };
    205  1.1  riastrad 
    206  1.1  riastrad static const struct intel_device_info i845g_info = {
    207  1.1  riastrad 	I845_FEATURES,
    208  1.1  riastrad 	PLATFORM(INTEL_I845G),
    209  1.1  riastrad };
    210  1.1  riastrad 
    211  1.1  riastrad static const struct intel_device_info i85x_info = {
    212  1.1  riastrad 	I830_FEATURES,
    213  1.1  riastrad 	PLATFORM(INTEL_I85X),
    214  1.1  riastrad 	.display.has_fbc = 1,
    215  1.1  riastrad };
    216  1.1  riastrad 
    217  1.1  riastrad static const struct intel_device_info i865g_info = {
    218  1.1  riastrad 	I845_FEATURES,
    219  1.1  riastrad 	PLATFORM(INTEL_I865G),
    220  1.1  riastrad };
    221  1.1  riastrad 
    222  1.1  riastrad #define GEN3_FEATURES \
    223  1.1  riastrad 	GEN(3), \
    224  1.1  riastrad 	.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B), \
    225  1.1  riastrad 	.display.has_gmch = 1, \
    226  1.1  riastrad 	.gpu_reset_clobbers_display = true, \
    227  1.1  riastrad 	.engine_mask = BIT(RCS0), \
    228  1.1  riastrad 	.has_snoop = true, \
    229  1.1  riastrad 	.has_coherent_ggtt = true, \
    230  1.1  riastrad 	I9XX_PIPE_OFFSETS, \
    231  1.1  riastrad 	I9XX_CURSOR_OFFSETS, \
    232  1.1  riastrad 	I9XX_COLORS, \
    233  1.1  riastrad 	GEN_DEFAULT_PAGE_SIZES, \
    234  1.1  riastrad 	GEN_DEFAULT_REGIONS
    235  1.1  riastrad 
    236  1.1  riastrad static const struct intel_device_info i915g_info = {
    237  1.1  riastrad 	GEN3_FEATURES,
    238  1.1  riastrad 	PLATFORM(INTEL_I915G),
    239  1.1  riastrad 	.has_coherent_ggtt = false,
    240  1.1  riastrad 	.display.cursor_needs_physical = 1,
    241  1.1  riastrad 	.display.has_overlay = 1,
    242  1.1  riastrad 	.display.overlay_needs_physical = 1,
    243  1.1  riastrad 	.hws_needs_physical = 1,
    244  1.1  riastrad 	.unfenced_needs_alignment = 1,
    245  1.1  riastrad };
    246  1.1  riastrad 
    247  1.1  riastrad static const struct intel_device_info i915gm_info = {
    248  1.1  riastrad 	GEN3_FEATURES,
    249  1.1  riastrad 	PLATFORM(INTEL_I915GM),
    250  1.1  riastrad 	.is_mobile = 1,
    251  1.1  riastrad 	.display.cursor_needs_physical = 1,
    252  1.1  riastrad 	.display.has_overlay = 1,
    253  1.1  riastrad 	.display.overlay_needs_physical = 1,
    254  1.1  riastrad 	.display.supports_tv = 1,
    255  1.1  riastrad 	.display.has_fbc = 1,
    256  1.1  riastrad 	.hws_needs_physical = 1,
    257  1.1  riastrad 	.unfenced_needs_alignment = 1,
    258  1.1  riastrad };
    259  1.1  riastrad 
    260  1.1  riastrad static const struct intel_device_info i945g_info = {
    261  1.1  riastrad 	GEN3_FEATURES,
    262  1.1  riastrad 	PLATFORM(INTEL_I945G),
    263  1.1  riastrad 	.display.has_hotplug = 1,
    264  1.1  riastrad 	.display.cursor_needs_physical = 1,
    265  1.1  riastrad 	.display.has_overlay = 1,
    266  1.1  riastrad 	.display.overlay_needs_physical = 1,
    267  1.1  riastrad 	.hws_needs_physical = 1,
    268  1.1  riastrad 	.unfenced_needs_alignment = 1,
    269  1.1  riastrad };
    270  1.1  riastrad 
    271  1.1  riastrad static const struct intel_device_info i945gm_info = {
    272  1.1  riastrad 	GEN3_FEATURES,
    273  1.1  riastrad 	PLATFORM(INTEL_I945GM),
    274  1.1  riastrad 	.is_mobile = 1,
    275  1.1  riastrad 	.display.has_hotplug = 1,
    276  1.1  riastrad 	.display.cursor_needs_physical = 1,
    277  1.1  riastrad 	.display.has_overlay = 1,
    278  1.1  riastrad 	.display.overlay_needs_physical = 1,
    279  1.1  riastrad 	.display.supports_tv = 1,
    280  1.1  riastrad 	.display.has_fbc = 1,
    281  1.1  riastrad 	.hws_needs_physical = 1,
    282  1.1  riastrad 	.unfenced_needs_alignment = 1,
    283  1.1  riastrad };
    284  1.1  riastrad 
    285  1.1  riastrad static const struct intel_device_info g33_info = {
    286  1.1  riastrad 	GEN3_FEATURES,
    287  1.1  riastrad 	PLATFORM(INTEL_G33),
    288  1.1  riastrad 	.display.has_hotplug = 1,
    289  1.1  riastrad 	.display.has_overlay = 1,
    290  1.1  riastrad };
    291  1.1  riastrad 
    292  1.1  riastrad static const struct intel_device_info pnv_g_info = {
    293  1.1  riastrad 	GEN3_FEATURES,
    294  1.1  riastrad 	PLATFORM(INTEL_PINEVIEW),
    295  1.1  riastrad 	.display.has_hotplug = 1,
    296  1.1  riastrad 	.display.has_overlay = 1,
    297  1.1  riastrad };
    298  1.1  riastrad 
    299  1.1  riastrad static const struct intel_device_info pnv_m_info = {
    300  1.1  riastrad 	GEN3_FEATURES,
    301  1.1  riastrad 	PLATFORM(INTEL_PINEVIEW),
    302  1.1  riastrad 	.is_mobile = 1,
    303  1.1  riastrad 	.display.has_hotplug = 1,
    304  1.1  riastrad 	.display.has_overlay = 1,
    305  1.1  riastrad };
    306  1.1  riastrad 
    307  1.1  riastrad #define GEN4_FEATURES \
    308  1.1  riastrad 	GEN(4), \
    309  1.1  riastrad 	.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B), \
    310  1.1  riastrad 	.display.has_hotplug = 1, \
    311  1.1  riastrad 	.display.has_gmch = 1, \
    312  1.1  riastrad 	.gpu_reset_clobbers_display = true, \
    313  1.1  riastrad 	.engine_mask = BIT(RCS0), \
    314  1.1  riastrad 	.has_snoop = true, \
    315  1.1  riastrad 	.has_coherent_ggtt = true, \
    316  1.1  riastrad 	I9XX_PIPE_OFFSETS, \
    317  1.1  riastrad 	I9XX_CURSOR_OFFSETS, \
    318  1.1  riastrad 	I965_COLORS, \
    319  1.1  riastrad 	GEN_DEFAULT_PAGE_SIZES, \
    320  1.1  riastrad 	GEN_DEFAULT_REGIONS
    321  1.1  riastrad 
    322  1.1  riastrad static const struct intel_device_info i965g_info = {
    323  1.1  riastrad 	GEN4_FEATURES,
    324  1.1  riastrad 	PLATFORM(INTEL_I965G),
    325  1.1  riastrad 	.display.has_overlay = 1,
    326  1.1  riastrad 	.hws_needs_physical = 1,
    327  1.1  riastrad 	.has_snoop = false,
    328  1.1  riastrad };
    329  1.1  riastrad 
    330  1.1  riastrad static const struct intel_device_info i965gm_info = {
    331  1.1  riastrad 	GEN4_FEATURES,
    332  1.1  riastrad 	PLATFORM(INTEL_I965GM),
    333  1.1  riastrad 	.is_mobile = 1,
    334  1.1  riastrad 	.display.has_fbc = 1,
    335  1.1  riastrad 	.display.has_overlay = 1,
    336  1.1  riastrad 	.display.supports_tv = 1,
    337  1.1  riastrad 	.hws_needs_physical = 1,
    338  1.1  riastrad 	.has_snoop = false,
    339  1.1  riastrad };
    340  1.1  riastrad 
    341  1.1  riastrad static const struct intel_device_info g45_info = {
    342  1.1  riastrad 	GEN4_FEATURES,
    343  1.1  riastrad 	PLATFORM(INTEL_G45),
    344  1.1  riastrad 	.engine_mask = BIT(RCS0) | BIT(VCS0),
    345  1.1  riastrad 	.gpu_reset_clobbers_display = false,
    346  1.1  riastrad };
    347  1.1  riastrad 
    348  1.1  riastrad static const struct intel_device_info gm45_info = {
    349  1.1  riastrad 	GEN4_FEATURES,
    350  1.1  riastrad 	PLATFORM(INTEL_GM45),
    351  1.1  riastrad 	.is_mobile = 1,
    352  1.1  riastrad 	.display.has_fbc = 1,
    353  1.1  riastrad 	.display.supports_tv = 1,
    354  1.1  riastrad 	.engine_mask = BIT(RCS0) | BIT(VCS0),
    355  1.1  riastrad 	.gpu_reset_clobbers_display = false,
    356  1.1  riastrad };
    357  1.1  riastrad 
    358  1.1  riastrad #define GEN5_FEATURES \
    359  1.1  riastrad 	GEN(5), \
    360  1.1  riastrad 	.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B), \
    361  1.1  riastrad 	.display.has_hotplug = 1, \
    362  1.1  riastrad 	.engine_mask = BIT(RCS0) | BIT(VCS0), \
    363  1.1  riastrad 	.has_snoop = true, \
    364  1.1  riastrad 	.has_coherent_ggtt = true, \
    365  1.1  riastrad 	/* ilk does support rc6, but we do not implement [power] contexts */ \
    366  1.1  riastrad 	.has_rc6 = 0, \
    367  1.1  riastrad 	I9XX_PIPE_OFFSETS, \
    368  1.1  riastrad 	I9XX_CURSOR_OFFSETS, \
    369  1.1  riastrad 	ILK_COLORS, \
    370  1.1  riastrad 	GEN_DEFAULT_PAGE_SIZES, \
    371  1.1  riastrad 	GEN_DEFAULT_REGIONS
    372  1.1  riastrad 
    373  1.1  riastrad static const struct intel_device_info ilk_d_info = {
    374  1.1  riastrad 	GEN5_FEATURES,
    375  1.1  riastrad 	PLATFORM(INTEL_IRONLAKE),
    376  1.1  riastrad };
    377  1.1  riastrad 
    378  1.1  riastrad static const struct intel_device_info ilk_m_info = {
    379  1.1  riastrad 	GEN5_FEATURES,
    380  1.1  riastrad 	PLATFORM(INTEL_IRONLAKE),
    381  1.1  riastrad 	.is_mobile = 1,
    382  1.1  riastrad 	.display.has_fbc = 1,
    383  1.1  riastrad };
    384  1.1  riastrad 
    385  1.1  riastrad #define GEN6_FEATURES \
    386  1.1  riastrad 	GEN(6), \
    387  1.1  riastrad 	.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B), \
    388  1.1  riastrad 	.display.has_hotplug = 1, \
    389  1.1  riastrad 	.display.has_fbc = 1, \
    390  1.1  riastrad 	.engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0), \
    391  1.1  riastrad 	.has_coherent_ggtt = true, \
    392  1.1  riastrad 	.has_llc = 1, \
    393  1.1  riastrad 	.has_rc6 = 1, \
    394  1.1  riastrad 	.has_rc6p = 1, \
    395  1.1  riastrad 	.has_rps = true, \
    396  1.1  riastrad 	.ppgtt_type = INTEL_PPGTT_ALIASING, \
    397  1.1  riastrad 	.ppgtt_size = 31, \
    398  1.1  riastrad 	I9XX_PIPE_OFFSETS, \
    399  1.1  riastrad 	I9XX_CURSOR_OFFSETS, \
    400  1.1  riastrad 	ILK_COLORS, \
    401  1.1  riastrad 	GEN_DEFAULT_PAGE_SIZES, \
    402  1.1  riastrad 	GEN_DEFAULT_REGIONS
    403  1.1  riastrad 
    404  1.1  riastrad #define SNB_D_PLATFORM \
    405  1.1  riastrad 	GEN6_FEATURES, \
    406  1.1  riastrad 	PLATFORM(INTEL_SANDYBRIDGE)
    407  1.1  riastrad 
    408  1.1  riastrad static const struct intel_device_info snb_d_gt1_info = {
    409  1.1  riastrad 	SNB_D_PLATFORM,
    410  1.1  riastrad 	.gt = 1,
    411  1.1  riastrad };
    412  1.1  riastrad 
    413  1.1  riastrad static const struct intel_device_info snb_d_gt2_info = {
    414  1.1  riastrad 	SNB_D_PLATFORM,
    415  1.1  riastrad 	.gt = 2,
    416  1.1  riastrad };
    417  1.1  riastrad 
    418  1.1  riastrad #define SNB_M_PLATFORM \
    419  1.1  riastrad 	GEN6_FEATURES, \
    420  1.1  riastrad 	PLATFORM(INTEL_SANDYBRIDGE), \
    421  1.1  riastrad 	.is_mobile = 1
    422  1.1  riastrad 
    423  1.1  riastrad 
    424  1.1  riastrad static const struct intel_device_info snb_m_gt1_info = {
    425  1.1  riastrad 	SNB_M_PLATFORM,
    426  1.1  riastrad 	.gt = 1,
    427  1.1  riastrad };
    428  1.1  riastrad 
    429  1.1  riastrad static const struct intel_device_info snb_m_gt2_info = {
    430  1.1  riastrad 	SNB_M_PLATFORM,
    431  1.1  riastrad 	.gt = 2,
    432  1.1  riastrad };
    433  1.1  riastrad 
    434  1.1  riastrad #define GEN7_FEATURES  \
    435  1.1  riastrad 	GEN(7), \
    436  1.1  riastrad 	.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C), \
    437  1.1  riastrad 	.display.has_hotplug = 1, \
    438  1.1  riastrad 	.display.has_fbc = 1, \
    439  1.1  riastrad 	.engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0), \
    440  1.1  riastrad 	.has_coherent_ggtt = true, \
    441  1.1  riastrad 	.has_llc = 1, \
    442  1.1  riastrad 	.has_rc6 = 1, \
    443  1.1  riastrad 	.has_rc6p = 1, \
    444  1.1  riastrad 	.has_rps = true, \
    445  1.5  riastrad 	.ppgtt_type = INTEL_PPGTT_ALIASING, \
    446  1.1  riastrad 	.ppgtt_size = 31, \
    447  1.1  riastrad 	IVB_PIPE_OFFSETS, \
    448  1.1  riastrad 	IVB_CURSOR_OFFSETS, \
    449  1.1  riastrad 	IVB_COLORS, \
    450  1.1  riastrad 	GEN_DEFAULT_PAGE_SIZES, \
    451  1.1  riastrad 	GEN_DEFAULT_REGIONS
    452  1.1  riastrad 
    453  1.1  riastrad #define IVB_D_PLATFORM \
    454  1.1  riastrad 	GEN7_FEATURES, \
    455  1.1  riastrad 	PLATFORM(INTEL_IVYBRIDGE), \
    456  1.1  riastrad 	.has_l3_dpf = 1
    457  1.1  riastrad 
    458  1.1  riastrad static const struct intel_device_info ivb_d_gt1_info = {
    459  1.1  riastrad 	IVB_D_PLATFORM,
    460  1.1  riastrad 	.gt = 1,
    461  1.1  riastrad };
    462  1.1  riastrad 
    463  1.1  riastrad static const struct intel_device_info ivb_d_gt2_info = {
    464  1.1  riastrad 	IVB_D_PLATFORM,
    465  1.1  riastrad 	.gt = 2,
    466  1.1  riastrad };
    467  1.1  riastrad 
    468  1.1  riastrad #define IVB_M_PLATFORM \
    469  1.1  riastrad 	GEN7_FEATURES, \
    470  1.1  riastrad 	PLATFORM(INTEL_IVYBRIDGE), \
    471  1.1  riastrad 	.is_mobile = 1, \
    472  1.1  riastrad 	.has_l3_dpf = 1
    473  1.1  riastrad 
    474  1.1  riastrad static const struct intel_device_info ivb_m_gt1_info = {
    475  1.1  riastrad 	IVB_M_PLATFORM,
    476  1.1  riastrad 	.gt = 1,
    477  1.1  riastrad };
    478  1.1  riastrad 
    479  1.1  riastrad static const struct intel_device_info ivb_m_gt2_info = {
    480  1.1  riastrad 	IVB_M_PLATFORM,
    481  1.1  riastrad 	.gt = 2,
    482  1.1  riastrad };
    483  1.1  riastrad 
    484  1.1  riastrad static const struct intel_device_info ivb_q_info = {
    485  1.1  riastrad 	GEN7_FEATURES,
    486  1.1  riastrad 	PLATFORM(INTEL_IVYBRIDGE),
    487  1.1  riastrad 	.gt = 2,
    488  1.1  riastrad 	.pipe_mask = 0, /* legal, last one wins */
    489  1.1  riastrad 	.has_l3_dpf = 1,
    490  1.1  riastrad };
    491  1.1  riastrad 
    492  1.1  riastrad static const struct intel_device_info vlv_info = {
    493  1.1  riastrad 	PLATFORM(INTEL_VALLEYVIEW),
    494  1.1  riastrad 	GEN(7),
    495  1.1  riastrad 	.is_lp = 1,
    496  1.1  riastrad 	.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B),
    497  1.1  riastrad 	.has_runtime_pm = 1,
    498  1.1  riastrad 	.has_rc6 = 1,
    499  1.1  riastrad 	.has_rps = true,
    500  1.1  riastrad 	.display.has_gmch = 1,
    501  1.1  riastrad 	.display.has_hotplug = 1,
    502  1.5  riastrad 	.ppgtt_type = INTEL_PPGTT_ALIASING,
    503  1.1  riastrad 	.ppgtt_size = 31,
    504  1.1  riastrad 	.has_snoop = true,
    505  1.1  riastrad 	.has_coherent_ggtt = false,
    506  1.1  riastrad 	.engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0),
    507  1.1  riastrad 	.display_mmio_offset = VLV_DISPLAY_BASE,
    508  1.1  riastrad 	I9XX_PIPE_OFFSETS,
    509  1.1  riastrad 	I9XX_CURSOR_OFFSETS,
    510  1.1  riastrad 	I965_COLORS,
    511  1.1  riastrad 	GEN_DEFAULT_PAGE_SIZES,
    512  1.1  riastrad 	GEN_DEFAULT_REGIONS,
    513  1.1  riastrad };
    514  1.1  riastrad 
    515  1.1  riastrad #define G75_FEATURES  \
    516  1.1  riastrad 	GEN7_FEATURES, \
    517  1.1  riastrad 	.engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0), \
    518  1.1  riastrad 	.display.has_ddi = 1, \
    519  1.1  riastrad 	.has_fpga_dbg = 1, \
    520  1.1  riastrad 	.display.has_psr = 1, \
    521  1.1  riastrad 	.display.has_dp_mst = 1, \
    522  1.1  riastrad 	.has_rc6p = 0 /* RC6p removed-by HSW */, \
    523  1.1  riastrad 	HSW_PIPE_OFFSETS, \
    524  1.1  riastrad 	.has_runtime_pm = 1
    525  1.1  riastrad 
    526  1.1  riastrad #define HSW_PLATFORM \
    527  1.1  riastrad 	G75_FEATURES, \
    528  1.1  riastrad 	PLATFORM(INTEL_HASWELL), \
    529  1.1  riastrad 	.has_l3_dpf = 1
    530  1.1  riastrad 
    531  1.1  riastrad static const struct intel_device_info hsw_gt1_info = {
    532  1.1  riastrad 	HSW_PLATFORM,
    533  1.1  riastrad 	.gt = 1,
    534  1.1  riastrad };
    535  1.1  riastrad 
    536  1.1  riastrad static const struct intel_device_info hsw_gt2_info = {
    537  1.1  riastrad 	HSW_PLATFORM,
    538  1.1  riastrad 	.gt = 2,
    539  1.1  riastrad };
    540  1.1  riastrad 
    541  1.1  riastrad static const struct intel_device_info hsw_gt3_info = {
    542  1.1  riastrad 	HSW_PLATFORM,
    543  1.1  riastrad 	.gt = 3,
    544  1.1  riastrad };
    545  1.1  riastrad 
    546  1.1  riastrad #define GEN8_FEATURES \
    547  1.1  riastrad 	G75_FEATURES, \
    548  1.1  riastrad 	GEN(8), \
    549  1.1  riastrad 	.has_logical_ring_contexts = 1, \
    550  1.1  riastrad 	.ppgtt_type = INTEL_PPGTT_FULL, \
    551  1.1  riastrad 	.ppgtt_size = 48, \
    552  1.1  riastrad 	.has_64bit_reloc = 1, \
    553  1.1  riastrad 	.has_reset_engine = 1
    554  1.1  riastrad 
    555  1.1  riastrad #define BDW_PLATFORM \
    556  1.1  riastrad 	GEN8_FEATURES, \
    557  1.1  riastrad 	PLATFORM(INTEL_BROADWELL)
    558  1.1  riastrad 
    559  1.1  riastrad static const struct intel_device_info bdw_gt1_info = {
    560  1.1  riastrad 	BDW_PLATFORM,
    561  1.1  riastrad 	.gt = 1,
    562  1.1  riastrad };
    563  1.1  riastrad 
    564  1.1  riastrad static const struct intel_device_info bdw_gt2_info = {
    565  1.1  riastrad 	BDW_PLATFORM,
    566  1.1  riastrad 	.gt = 2,
    567  1.1  riastrad };
    568  1.1  riastrad 
    569  1.1  riastrad static const struct intel_device_info bdw_rsvd_info = {
    570  1.1  riastrad 	BDW_PLATFORM,
    571  1.1  riastrad 	.gt = 3,
    572  1.1  riastrad 	/* According to the device ID those devices are GT3, they were
    573  1.1  riastrad 	 * previously treated as not GT3, keep it like that.
    574  1.1  riastrad 	 */
    575  1.1  riastrad };
    576  1.1  riastrad 
    577  1.1  riastrad static const struct intel_device_info bdw_gt3_info = {
    578  1.1  riastrad 	BDW_PLATFORM,
    579  1.1  riastrad 	.gt = 3,
    580  1.1  riastrad 	.engine_mask =
    581  1.1  riastrad 		BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS1),
    582  1.1  riastrad };
    583  1.1  riastrad 
    584  1.1  riastrad static const struct intel_device_info chv_info = {
    585  1.1  riastrad 	PLATFORM(INTEL_CHERRYVIEW),
    586  1.1  riastrad 	GEN(8),
    587  1.1  riastrad 	.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C),
    588  1.1  riastrad 	.display.has_hotplug = 1,
    589  1.1  riastrad 	.is_lp = 1,
    590  1.1  riastrad 	.engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0),
    591  1.1  riastrad 	.has_64bit_reloc = 1,
    592  1.1  riastrad 	.has_runtime_pm = 1,
    593  1.1  riastrad 	.has_rc6 = 1,
    594  1.1  riastrad 	.has_rps = true,
    595  1.1  riastrad 	.has_logical_ring_contexts = 1,
    596  1.1  riastrad 	.display.has_gmch = 1,
    597  1.1  riastrad 	.ppgtt_type = INTEL_PPGTT_ALIASING,
    598  1.1  riastrad 	.ppgtt_size = 32,
    599  1.1  riastrad 	.has_reset_engine = 1,
    600  1.1  riastrad 	.has_snoop = true,
    601  1.1  riastrad 	.has_coherent_ggtt = false,
    602  1.1  riastrad 	.display_mmio_offset = VLV_DISPLAY_BASE,
    603  1.1  riastrad 	CHV_PIPE_OFFSETS,
    604  1.1  riastrad 	CHV_CURSOR_OFFSETS,
    605  1.1  riastrad 	CHV_COLORS,
    606  1.1  riastrad 	GEN_DEFAULT_PAGE_SIZES,
    607  1.1  riastrad 	GEN_DEFAULT_REGIONS,
    608  1.1  riastrad };
    609  1.1  riastrad 
    610  1.1  riastrad #define GEN9_DEFAULT_PAGE_SIZES \
    611  1.1  riastrad 	.page_sizes = I915_GTT_PAGE_SIZE_4K | \
    612  1.1  riastrad 		      I915_GTT_PAGE_SIZE_64K
    613  1.1  riastrad 
    614  1.1  riastrad #define GEN9_FEATURES \
    615  1.1  riastrad 	GEN8_FEATURES, \
    616  1.1  riastrad 	GEN(9), \
    617  1.1  riastrad 	GEN9_DEFAULT_PAGE_SIZES, \
    618  1.1  riastrad 	.has_logical_ring_preemption = 1, \
    619  1.1  riastrad 	.display.has_csr = 1, \
    620  1.1  riastrad 	.has_gt_uc = 1, \
    621  1.1  riastrad 	.display.has_hdcp = 1, \
    622  1.1  riastrad 	.display.has_ipc = 1, \
    623  1.1  riastrad 	.ddb_size = 896
    624  1.1  riastrad 
    625  1.1  riastrad #define SKL_PLATFORM \
    626  1.1  riastrad 	GEN9_FEATURES, \
    627  1.1  riastrad 	PLATFORM(INTEL_SKYLAKE)
    628  1.1  riastrad 
    629  1.1  riastrad static const struct intel_device_info skl_gt1_info = {
    630  1.1  riastrad 	SKL_PLATFORM,
    631  1.1  riastrad 	.gt = 1,
    632  1.1  riastrad };
    633  1.1  riastrad 
    634  1.1  riastrad static const struct intel_device_info skl_gt2_info = {
    635  1.1  riastrad 	SKL_PLATFORM,
    636  1.1  riastrad 	.gt = 2,
    637  1.1  riastrad };
    638  1.1  riastrad 
    639  1.1  riastrad #define SKL_GT3_PLUS_PLATFORM \
    640  1.1  riastrad 	SKL_PLATFORM, \
    641  1.1  riastrad 	.engine_mask = \
    642  1.1  riastrad 		BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS1)
    643  1.1  riastrad 
    644  1.1  riastrad 
    645  1.1  riastrad static const struct intel_device_info skl_gt3_info = {
    646  1.1  riastrad 	SKL_GT3_PLUS_PLATFORM,
    647  1.1  riastrad 	.gt = 3,
    648  1.1  riastrad };
    649  1.1  riastrad 
    650  1.1  riastrad static const struct intel_device_info skl_gt4_info = {
    651  1.1  riastrad 	SKL_GT3_PLUS_PLATFORM,
    652  1.1  riastrad 	.gt = 4,
    653  1.1  riastrad };
    654  1.1  riastrad 
    655  1.1  riastrad #define GEN9_LP_FEATURES \
    656  1.1  riastrad 	GEN(9), \
    657  1.1  riastrad 	.is_lp = 1, \
    658  1.1  riastrad 	.display.has_hotplug = 1, \
    659  1.1  riastrad 	.engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0), \
    660  1.1  riastrad 	.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C), \
    661  1.1  riastrad 	.has_64bit_reloc = 1, \
    662  1.1  riastrad 	.display.has_ddi = 1, \
    663  1.1  riastrad 	.has_fpga_dbg = 1, \
    664  1.1  riastrad 	.display.has_fbc = 1, \
    665  1.1  riastrad 	.display.has_hdcp = 1, \
    666  1.1  riastrad 	.display.has_psr = 1, \
    667  1.1  riastrad 	.has_runtime_pm = 1, \
    668  1.1  riastrad 	.display.has_csr = 1, \
    669  1.1  riastrad 	.has_rc6 = 1, \
    670  1.1  riastrad 	.has_rps = true, \
    671  1.1  riastrad 	.display.has_dp_mst = 1, \
    672  1.1  riastrad 	.has_logical_ring_contexts = 1, \
    673  1.1  riastrad 	.has_logical_ring_preemption = 1, \
    674  1.1  riastrad 	.has_gt_uc = 1, \
    675  1.1  riastrad 	.ppgtt_type = INTEL_PPGTT_FULL, \
    676  1.1  riastrad 	.ppgtt_size = 48, \
    677  1.1  riastrad 	.has_reset_engine = 1, \
    678  1.1  riastrad 	.has_snoop = true, \
    679  1.1  riastrad 	.has_coherent_ggtt = false, \
    680  1.1  riastrad 	.display.has_ipc = 1, \
    681  1.1  riastrad 	HSW_PIPE_OFFSETS, \
    682  1.1  riastrad 	IVB_CURSOR_OFFSETS, \
    683  1.1  riastrad 	IVB_COLORS, \
    684  1.1  riastrad 	GEN9_DEFAULT_PAGE_SIZES, \
    685  1.1  riastrad 	GEN_DEFAULT_REGIONS
    686  1.1  riastrad 
    687  1.1  riastrad static const struct intel_device_info bxt_info = {
    688  1.1  riastrad 	GEN9_LP_FEATURES,
    689  1.1  riastrad 	PLATFORM(INTEL_BROXTON),
    690  1.1  riastrad 	.ddb_size = 512,
    691  1.1  riastrad };
    692  1.1  riastrad 
    693  1.1  riastrad static const struct intel_device_info glk_info = {
    694  1.1  riastrad 	GEN9_LP_FEATURES,
    695  1.1  riastrad 	PLATFORM(INTEL_GEMINILAKE),
    696  1.1  riastrad 	.ddb_size = 1024,
    697  1.1  riastrad 	GLK_COLORS,
    698  1.1  riastrad };
    699  1.1  riastrad 
    700  1.1  riastrad #define KBL_PLATFORM \
    701  1.1  riastrad 	GEN9_FEATURES, \
    702  1.1  riastrad 	PLATFORM(INTEL_KABYLAKE)
    703  1.1  riastrad 
    704  1.1  riastrad static const struct intel_device_info kbl_gt1_info = {
    705  1.1  riastrad 	KBL_PLATFORM,
    706  1.1  riastrad 	.gt = 1,
    707  1.1  riastrad };
    708  1.1  riastrad 
    709  1.1  riastrad static const struct intel_device_info kbl_gt2_info = {
    710  1.1  riastrad 	KBL_PLATFORM,
    711  1.1  riastrad 	.gt = 2,
    712  1.1  riastrad };
    713  1.1  riastrad 
    714  1.1  riastrad static const struct intel_device_info kbl_gt3_info = {
    715  1.1  riastrad 	KBL_PLATFORM,
    716  1.1  riastrad 	.gt = 3,
    717  1.1  riastrad 	.engine_mask =
    718  1.1  riastrad 		BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS1),
    719  1.1  riastrad };
    720  1.1  riastrad 
    721  1.1  riastrad #define CFL_PLATFORM \
    722  1.1  riastrad 	GEN9_FEATURES, \
    723  1.1  riastrad 	PLATFORM(INTEL_COFFEELAKE)
    724  1.1  riastrad 
    725  1.1  riastrad static const struct intel_device_info cfl_gt1_info = {
    726  1.1  riastrad 	CFL_PLATFORM,
    727  1.1  riastrad 	.gt = 1,
    728  1.1  riastrad };
    729  1.1  riastrad 
    730  1.1  riastrad static const struct intel_device_info cfl_gt2_info = {
    731  1.1  riastrad 	CFL_PLATFORM,
    732  1.1  riastrad 	.gt = 2,
    733  1.1  riastrad };
    734  1.1  riastrad 
    735  1.1  riastrad static const struct intel_device_info cfl_gt3_info = {
    736  1.1  riastrad 	CFL_PLATFORM,
    737  1.1  riastrad 	.gt = 3,
    738  1.1  riastrad 	.engine_mask =
    739  1.1  riastrad 		BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS1),
    740  1.1  riastrad };
    741  1.1  riastrad 
    742  1.1  riastrad #define GEN10_FEATURES \
    743  1.1  riastrad 	GEN9_FEATURES, \
    744  1.1  riastrad 	GEN(10), \
    745  1.1  riastrad 	.ddb_size = 1024, \
    746  1.1  riastrad 	.display.has_dsc = 1, \
    747  1.1  riastrad 	.has_coherent_ggtt = false, \
    748  1.1  riastrad 	GLK_COLORS
    749  1.1  riastrad 
    750  1.1  riastrad static const struct intel_device_info cnl_info = {
    751  1.1  riastrad 	GEN10_FEATURES,
    752  1.1  riastrad 	PLATFORM(INTEL_CANNONLAKE),
    753  1.1  riastrad 	.gt = 2,
    754  1.1  riastrad };
    755  1.1  riastrad 
    756  1.1  riastrad #define GEN11_DEFAULT_PAGE_SIZES \
    757  1.1  riastrad 	.page_sizes = I915_GTT_PAGE_SIZE_4K | \
    758  1.1  riastrad 		      I915_GTT_PAGE_SIZE_64K | \
    759  1.1  riastrad 		      I915_GTT_PAGE_SIZE_2M
    760  1.1  riastrad 
    761  1.1  riastrad #define GEN11_FEATURES \
    762  1.1  riastrad 	GEN10_FEATURES, \
    763  1.1  riastrad 	GEN11_DEFAULT_PAGE_SIZES, \
    764  1.1  riastrad 	.pipe_offsets = { \
    765  1.1  riastrad 		[TRANSCODER_A] = PIPE_A_OFFSET, \
    766  1.1  riastrad 		[TRANSCODER_B] = PIPE_B_OFFSET, \
    767  1.1  riastrad 		[TRANSCODER_C] = PIPE_C_OFFSET, \
    768  1.1  riastrad 		[TRANSCODER_EDP] = PIPE_EDP_OFFSET, \
    769  1.1  riastrad 		[TRANSCODER_DSI_0] = PIPE_DSI0_OFFSET, \
    770  1.1  riastrad 		[TRANSCODER_DSI_1] = PIPE_DSI1_OFFSET, \
    771  1.1  riastrad 	}, \
    772  1.1  riastrad 	.trans_offsets = { \
    773  1.1  riastrad 		[TRANSCODER_A] = TRANSCODER_A_OFFSET, \
    774  1.1  riastrad 		[TRANSCODER_B] = TRANSCODER_B_OFFSET, \
    775  1.1  riastrad 		[TRANSCODER_C] = TRANSCODER_C_OFFSET, \
    776  1.1  riastrad 		[TRANSCODER_EDP] = TRANSCODER_EDP_OFFSET, \
    777  1.1  riastrad 		[TRANSCODER_DSI_0] = TRANSCODER_DSI0_OFFSET, \
    778  1.1  riastrad 		[TRANSCODER_DSI_1] = TRANSCODER_DSI1_OFFSET, \
    779  1.1  riastrad 	}, \
    780  1.1  riastrad 	GEN(11), \
    781  1.1  riastrad 	.ddb_size = 2048, \
    782  1.1  riastrad 	.has_logical_ring_elsq = 1, \
    783  1.1  riastrad 	.color = { .degamma_lut_size = 33, .gamma_lut_size = 262145 }
    784  1.1  riastrad 
    785  1.1  riastrad static const struct intel_device_info icl_info = {
    786  1.1  riastrad 	GEN11_FEATURES,
    787  1.1  riastrad 	PLATFORM(INTEL_ICELAKE),
    788  1.1  riastrad 	.engine_mask =
    789  1.1  riastrad 		BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0) | BIT(VCS2),
    790  1.1  riastrad };
    791  1.1  riastrad 
    792  1.1  riastrad static const struct intel_device_info ehl_info = {
    793  1.1  riastrad 	GEN11_FEATURES,
    794  1.1  riastrad 	PLATFORM(INTEL_ELKHARTLAKE),
    795  1.1  riastrad 	.require_force_probe = 1,
    796  1.1  riastrad 	.engine_mask = BIT(RCS0) | BIT(BCS0) | BIT(VCS0) | BIT(VECS0),
    797  1.1  riastrad 	.ppgtt_size = 36,
    798  1.1  riastrad };
    799  1.1  riastrad 
    800  1.1  riastrad #define GEN12_FEATURES \
    801  1.1  riastrad 	GEN11_FEATURES, \
    802  1.1  riastrad 	GEN(12), \
    803  1.1  riastrad 	.pipe_offsets = { \
    804  1.1  riastrad 		[TRANSCODER_A] = PIPE_A_OFFSET, \
    805  1.1  riastrad 		[TRANSCODER_B] = PIPE_B_OFFSET, \
    806  1.1  riastrad 		[TRANSCODER_C] = PIPE_C_OFFSET, \
    807  1.1  riastrad 		[TRANSCODER_D] = PIPE_D_OFFSET, \
    808  1.1  riastrad 		[TRANSCODER_DSI_0] = PIPE_DSI0_OFFSET, \
    809  1.1  riastrad 		[TRANSCODER_DSI_1] = PIPE_DSI1_OFFSET, \
    810  1.1  riastrad 	}, \
    811  1.1  riastrad 	.trans_offsets = { \
    812  1.1  riastrad 		[TRANSCODER_A] = TRANSCODER_A_OFFSET, \
    813  1.1  riastrad 		[TRANSCODER_B] = TRANSCODER_B_OFFSET, \
    814  1.1  riastrad 		[TRANSCODER_C] = TRANSCODER_C_OFFSET, \
    815  1.1  riastrad 		[TRANSCODER_D] = TRANSCODER_D_OFFSET, \
    816  1.1  riastrad 		[TRANSCODER_DSI_0] = TRANSCODER_DSI0_OFFSET, \
    817  1.1  riastrad 		[TRANSCODER_DSI_1] = TRANSCODER_DSI1_OFFSET, \
    818  1.1  riastrad 	}, \
    819  1.1  riastrad 	TGL_CURSOR_OFFSETS, \
    820  1.1  riastrad 	.has_global_mocs = 1, \
    821  1.1  riastrad 	.display.has_dsb = 1
    822  1.1  riastrad 
    823  1.1  riastrad static const struct intel_device_info tgl_info = {
    824  1.1  riastrad 	GEN12_FEATURES,
    825  1.1  riastrad 	PLATFORM(INTEL_TIGERLAKE),
    826  1.1  riastrad 	.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D),
    827  1.1  riastrad 	.require_force_probe = 1,
    828  1.1  riastrad 	.display.has_modular_fia = 1,
    829  1.1  riastrad 	.engine_mask =
    830  1.1  riastrad 		BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0) | BIT(VCS2),
    831  1.1  riastrad 	.has_rps = false, /* XXX disabled for debugging */
    832  1.1  riastrad };
    833  1.1  riastrad 
    834  1.1  riastrad #define GEN12_DGFX_FEATURES \
    835  1.1  riastrad 	GEN12_FEATURES, \
    836  1.1  riastrad 	.is_dgfx = 1
    837  1.1  riastrad 
    838  1.1  riastrad #undef GEN
    839  1.1  riastrad #undef PLATFORM
    840  1.1  riastrad 
    841  1.1  riastrad /*
    842  1.1  riastrad  * Make sure any device matches here are from most specific to most
    843  1.1  riastrad  * general.  For example, since the Quanta match is based on the subsystem
    844  1.1  riastrad  * and subvendor IDs, we need it to come before the more general IVB
    845  1.1  riastrad  * PCI ID matches, otherwise we'll use the wrong info struct above.
    846  1.1  riastrad  */
    847  1.1  riastrad static const struct pci_device_id pciidlist[] = {
    848  1.1  riastrad 	INTEL_I830_IDS(&i830_info),
    849  1.1  riastrad 	INTEL_I845G_IDS(&i845g_info),
    850  1.1  riastrad 	INTEL_I85X_IDS(&i85x_info),
    851  1.1  riastrad 	INTEL_I865G_IDS(&i865g_info),
    852  1.1  riastrad 	INTEL_I915G_IDS(&i915g_info),
    853  1.1  riastrad 	INTEL_I915GM_IDS(&i915gm_info),
    854  1.1  riastrad 	INTEL_I945G_IDS(&i945g_info),
    855  1.1  riastrad 	INTEL_I945GM_IDS(&i945gm_info),
    856  1.1  riastrad 	INTEL_I965G_IDS(&i965g_info),
    857  1.1  riastrad 	INTEL_G33_IDS(&g33_info),
    858  1.1  riastrad 	INTEL_I965GM_IDS(&i965gm_info),
    859  1.1  riastrad 	INTEL_GM45_IDS(&gm45_info),
    860  1.1  riastrad 	INTEL_G45_IDS(&g45_info),
    861  1.1  riastrad 	INTEL_PINEVIEW_G_IDS(&pnv_g_info),
    862  1.1  riastrad 	INTEL_PINEVIEW_M_IDS(&pnv_m_info),
    863  1.1  riastrad 	INTEL_IRONLAKE_D_IDS(&ilk_d_info),
    864  1.1  riastrad 	INTEL_IRONLAKE_M_IDS(&ilk_m_info),
    865  1.1  riastrad 	INTEL_SNB_D_GT1_IDS(&snb_d_gt1_info),
    866  1.1  riastrad 	INTEL_SNB_D_GT2_IDS(&snb_d_gt2_info),
    867  1.1  riastrad 	INTEL_SNB_M_GT1_IDS(&snb_m_gt1_info),
    868  1.1  riastrad 	INTEL_SNB_M_GT2_IDS(&snb_m_gt2_info),
    869  1.1  riastrad 	INTEL_IVB_Q_IDS(&ivb_q_info), /* must be first IVB */
    870  1.1  riastrad 	INTEL_IVB_M_GT1_IDS(&ivb_m_gt1_info),
    871  1.1  riastrad 	INTEL_IVB_M_GT2_IDS(&ivb_m_gt2_info),
    872  1.1  riastrad 	INTEL_IVB_D_GT1_IDS(&ivb_d_gt1_info),
    873  1.1  riastrad 	INTEL_IVB_D_GT2_IDS(&ivb_d_gt2_info),
    874  1.1  riastrad 	INTEL_HSW_GT1_IDS(&hsw_gt1_info),
    875  1.1  riastrad 	INTEL_HSW_GT2_IDS(&hsw_gt2_info),
    876  1.1  riastrad 	INTEL_HSW_GT3_IDS(&hsw_gt3_info),
    877  1.1  riastrad 	INTEL_VLV_IDS(&vlv_info),
    878  1.1  riastrad 	INTEL_BDW_GT1_IDS(&bdw_gt1_info),
    879  1.1  riastrad 	INTEL_BDW_GT2_IDS(&bdw_gt2_info),
    880  1.1  riastrad 	INTEL_BDW_GT3_IDS(&bdw_gt3_info),
    881  1.1  riastrad 	INTEL_BDW_RSVD_IDS(&bdw_rsvd_info),
    882  1.1  riastrad 	INTEL_CHV_IDS(&chv_info),
    883  1.1  riastrad 	INTEL_SKL_GT1_IDS(&skl_gt1_info),
    884  1.1  riastrad 	INTEL_SKL_GT2_IDS(&skl_gt2_info),
    885  1.1  riastrad 	INTEL_SKL_GT3_IDS(&skl_gt3_info),
    886  1.1  riastrad 	INTEL_SKL_GT4_IDS(&skl_gt4_info),
    887  1.1  riastrad 	INTEL_BXT_IDS(&bxt_info),
    888  1.1  riastrad 	INTEL_GLK_IDS(&glk_info),
    889  1.1  riastrad 	INTEL_KBL_GT1_IDS(&kbl_gt1_info),
    890  1.1  riastrad 	INTEL_KBL_GT2_IDS(&kbl_gt2_info),
    891  1.1  riastrad 	INTEL_KBL_GT3_IDS(&kbl_gt3_info),
    892  1.1  riastrad 	INTEL_KBL_GT4_IDS(&kbl_gt3_info),
    893  1.1  riastrad 	INTEL_AML_KBL_GT2_IDS(&kbl_gt2_info),
    894  1.1  riastrad 	INTEL_CFL_S_GT1_IDS(&cfl_gt1_info),
    895  1.1  riastrad 	INTEL_CFL_S_GT2_IDS(&cfl_gt2_info),
    896  1.1  riastrad 	INTEL_CFL_H_GT1_IDS(&cfl_gt1_info),
    897  1.1  riastrad 	INTEL_CFL_H_GT2_IDS(&cfl_gt2_info),
    898  1.1  riastrad 	INTEL_CFL_U_GT2_IDS(&cfl_gt2_info),
    899  1.1  riastrad 	INTEL_CFL_U_GT3_IDS(&cfl_gt3_info),
    900  1.1  riastrad 	INTEL_WHL_U_GT1_IDS(&cfl_gt1_info),
    901  1.1  riastrad 	INTEL_WHL_U_GT2_IDS(&cfl_gt2_info),
    902  1.1  riastrad 	INTEL_AML_CFL_GT2_IDS(&cfl_gt2_info),
    903  1.1  riastrad 	INTEL_WHL_U_GT3_IDS(&cfl_gt3_info),
    904  1.1  riastrad 	INTEL_CML_GT1_IDS(&cfl_gt1_info),
    905  1.1  riastrad 	INTEL_CML_GT2_IDS(&cfl_gt2_info),
    906  1.1  riastrad 	INTEL_CML_U_GT1_IDS(&cfl_gt1_info),
    907  1.1  riastrad 	INTEL_CML_U_GT2_IDS(&cfl_gt2_info),
    908  1.1  riastrad 	INTEL_CNL_IDS(&cnl_info),
    909  1.1  riastrad 	INTEL_ICL_11_IDS(&icl_info),
    910  1.1  riastrad 	INTEL_EHL_IDS(&ehl_info),
    911  1.1  riastrad 	INTEL_TGL_12_IDS(&tgl_info),
    912  1.1  riastrad 	{0, 0, 0}
    913  1.1  riastrad };
    914  1.1  riastrad MODULE_DEVICE_TABLE(pci, pciidlist);
    915  1.1  riastrad 
    916  1.4  riastrad #ifdef __NetBSD__
    917  1.4  riastrad 
    918  1.4  riastrad /* XXX Kludge to expose this to NetBSD driver attachment goop.  */
    919  1.4  riastrad const struct pci_device_id *const i915_device_ids = pciidlist;
    920  1.4  riastrad const size_t i915_n_device_ids = __arraycount(pciidlist);
    921  1.4  riastrad 
    922  1.4  riastrad #else
    923  1.1  riastrad static void i915_pci_remove(struct pci_dev *pdev)
    924  1.1  riastrad {
    925  1.1  riastrad 	struct drm_i915_private *i915;
    926  1.1  riastrad 
    927  1.1  riastrad 	i915 = pci_get_drvdata(pdev);
    928  1.1  riastrad 	if (!i915) /* driver load aborted, nothing to cleanup */
    929  1.1  riastrad 		return;
    930  1.1  riastrad 
    931  1.1  riastrad 	i915_driver_remove(i915);
    932  1.1  riastrad 	pci_set_drvdata(pdev, NULL);
    933  1.1  riastrad 
    934  1.1  riastrad 	drm_dev_put(&i915->drm);
    935  1.1  riastrad }
    936  1.1  riastrad 
    937  1.1  riastrad /* is device_id present in comma separated list of ids */
    938  1.1  riastrad static bool force_probe(u16 device_id, const char *devices)
    939  1.1  riastrad {
    940  1.1  riastrad 	char *s, *p, *tok;
    941  1.1  riastrad 	bool ret;
    942  1.1  riastrad 
    943  1.1  riastrad 	/* FIXME: transitional */
    944  1.1  riastrad 	if (i915_modparams.alpha_support) {
    945  1.1  riastrad 		DRM_INFO("i915.alpha_support is deprecated, use i915.force_probe=%04x instead\n",
    946  1.1  riastrad 			 device_id);
    947  1.1  riastrad 		return true;
    948  1.1  riastrad 	}
    949  1.1  riastrad 
    950  1.1  riastrad 	if (!devices || !*devices)
    951  1.1  riastrad 		return false;
    952  1.1  riastrad 
    953  1.1  riastrad 	/* match everything */
    954  1.1  riastrad 	if (strcmp(devices, "*") == 0)
    955  1.1  riastrad 		return true;
    956  1.1  riastrad 
    957  1.1  riastrad 	s = kstrdup(devices, GFP_KERNEL);
    958  1.1  riastrad 	if (!s)
    959  1.1  riastrad 		return false;
    960  1.1  riastrad 
    961  1.1  riastrad 	for (p = s, ret = false; (tok = strsep(&p, ",")) != NULL; ) {
    962  1.1  riastrad 		u16 val;
    963  1.1  riastrad 
    964  1.1  riastrad 		if (kstrtou16(tok, 16, &val) == 0 && val == device_id) {
    965  1.1  riastrad 			ret = true;
    966  1.1  riastrad 			break;
    967  1.1  riastrad 		}
    968  1.1  riastrad 	}
    969  1.1  riastrad 
    970  1.1  riastrad 	kfree(s);
    971  1.1  riastrad 
    972  1.1  riastrad 	return ret;
    973  1.1  riastrad }
    974  1.1  riastrad 
    975  1.1  riastrad static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
    976  1.1  riastrad {
    977  1.1  riastrad 	struct intel_device_info *intel_info =
    978  1.1  riastrad 		(struct intel_device_info *) ent->driver_data;
    979  1.1  riastrad 	int err;
    980  1.1  riastrad 
    981  1.1  riastrad 	if (intel_info->require_force_probe &&
    982  1.1  riastrad 	    !force_probe(pdev->device, i915_modparams.force_probe)) {
    983  1.1  riastrad 		DRM_INFO("Your graphics device %04x is not properly supported by the driver in this\n"
    984  1.1  riastrad 			 "kernel version. To force driver probe anyway, use i915.force_probe=%04x\n"
    985  1.1  riastrad 			 "module parameter or CONFIG_DRM_I915_FORCE_PROBE=%04x configuration option,\n"
    986  1.1  riastrad 			 "or (recommended) check for kernel updates.\n",
    987  1.1  riastrad 			 pdev->device, pdev->device, pdev->device);
    988  1.1  riastrad 		return -ENODEV;
    989  1.1  riastrad 	}
    990  1.1  riastrad 
    991  1.1  riastrad 	/* Only bind to function 0 of the device. Early generations
    992  1.1  riastrad 	 * used function 1 as a placeholder for multi-head. This causes
    993  1.1  riastrad 	 * us confusion instead, especially on the systems where both
    994  1.1  riastrad 	 * functions have the same PCI-ID!
    995  1.1  riastrad 	 */
    996  1.1  riastrad 	if (PCI_FUNC(pdev->devfn))
    997  1.1  riastrad 		return -ENODEV;
    998  1.1  riastrad 
    999  1.3  riastrad #ifndef __NetBSD__		/* XXX vga switcheroo */
   1000  1.1  riastrad 	/*
   1001  1.1  riastrad 	 * apple-gmux is needed on dual GPU MacBook Pro
   1002  1.1  riastrad 	 * to probe the panel if we're the inactive GPU.
   1003  1.1  riastrad 	 */
   1004  1.1  riastrad 	if (vga_switcheroo_client_probe_defer(pdev))
   1005  1.1  riastrad 		return -EPROBE_DEFER;
   1006  1.3  riastrad #endif
   1007  1.1  riastrad 
   1008  1.1  riastrad 	err = i915_driver_probe(pdev, ent);
   1009  1.1  riastrad 	if (err)
   1010  1.1  riastrad 		return err;
   1011  1.1  riastrad 
   1012  1.1  riastrad 	if (i915_inject_probe_failure(pci_get_drvdata(pdev))) {
   1013  1.1  riastrad 		i915_pci_remove(pdev);
   1014  1.1  riastrad 		return -ENODEV;
   1015  1.1  riastrad 	}
   1016  1.1  riastrad 
   1017  1.1  riastrad 	err = i915_live_selftests(pdev);
   1018  1.1  riastrad 	if (err) {
   1019  1.1  riastrad 		i915_pci_remove(pdev);
   1020  1.1  riastrad 		return err > 0 ? -ENOTTY : err;
   1021  1.1  riastrad 	}
   1022  1.1  riastrad 
   1023  1.1  riastrad 	err = i915_perf_selftests(pdev);
   1024  1.1  riastrad 	if (err) {
   1025  1.1  riastrad 		i915_pci_remove(pdev);
   1026  1.1  riastrad 		return err > 0 ? -ENOTTY : err;
   1027  1.1  riastrad 	}
   1028  1.1  riastrad 
   1029  1.1  riastrad 	return 0;
   1030  1.1  riastrad }
   1031  1.1  riastrad 
   1032  1.2  riastrad #ifndef __NetBSD__
   1033  1.1  riastrad static struct pci_driver i915_pci_driver = {
   1034  1.1  riastrad 	.name = DRIVER_NAME,
   1035  1.1  riastrad 	.id_table = pciidlist,
   1036  1.1  riastrad 	.probe = i915_pci_probe,
   1037  1.1  riastrad 	.remove = i915_pci_remove,
   1038  1.1  riastrad 	.driver.pm = &i915_pm_ops,
   1039  1.1  riastrad };
   1040  1.2  riastrad #endif
   1041  1.1  riastrad 
   1042  1.1  riastrad static int __init i915_init(void)
   1043  1.1  riastrad {
   1044  1.1  riastrad 	bool use_kms = true;
   1045  1.1  riastrad 	int err;
   1046  1.1  riastrad 
   1047  1.1  riastrad 	err = i915_globals_init();
   1048  1.1  riastrad 	if (err)
   1049  1.1  riastrad 		return err;
   1050  1.1  riastrad 
   1051  1.1  riastrad 	err = i915_mock_selftests();
   1052  1.1  riastrad 	if (err)
   1053  1.1  riastrad 		return err > 0 ? 0 : err;
   1054  1.1  riastrad 
   1055  1.1  riastrad 	/*
   1056  1.1  riastrad 	 * Enable KMS by default, unless explicitly overriden by
   1057  1.1  riastrad 	 * either the i915.modeset prarameter or by the
   1058  1.1  riastrad 	 * vga_text_mode_force boot option.
   1059  1.1  riastrad 	 */
   1060  1.1  riastrad 
   1061  1.1  riastrad 	if (i915_modparams.modeset == 0)
   1062  1.1  riastrad 		use_kms = false;
   1063  1.1  riastrad 
   1064  1.1  riastrad 	if (vgacon_text_force() && i915_modparams.modeset == -1)
   1065  1.1  riastrad 		use_kms = false;
   1066  1.1  riastrad 
   1067  1.1  riastrad 	if (!use_kms) {
   1068  1.1  riastrad 		/* Silently fail loading to not upset userspace. */
   1069  1.1  riastrad 		DRM_DEBUG_DRIVER("KMS disabled.\n");
   1070  1.1  riastrad 		return 0;
   1071  1.1  riastrad 	}
   1072  1.1  riastrad 
   1073  1.1  riastrad 	err = pci_register_driver(&i915_pci_driver);
   1074  1.1  riastrad 	if (err)
   1075  1.1  riastrad 		return err;
   1076  1.1  riastrad 
   1077  1.1  riastrad 	i915_perf_sysctl_register();
   1078  1.1  riastrad 	return 0;
   1079  1.1  riastrad }
   1080  1.1  riastrad 
   1081  1.1  riastrad static void __exit i915_exit(void)
   1082  1.1  riastrad {
   1083  1.1  riastrad 	if (!i915_pci_driver.driver.owner)
   1084  1.1  riastrad 		return;
   1085  1.1  riastrad 
   1086  1.1  riastrad 	i915_perf_sysctl_unregister();
   1087  1.1  riastrad 	pci_unregister_driver(&i915_pci_driver);
   1088  1.1  riastrad 	i915_globals_exit();
   1089  1.1  riastrad }
   1090  1.1  riastrad 
   1091  1.1  riastrad module_init(i915_init);
   1092  1.1  riastrad module_exit(i915_exit);
   1093  1.1  riastrad 
   1094  1.4  riastrad #endif
   1095  1.4  riastrad 
   1096  1.1  riastrad MODULE_AUTHOR("Tungsten Graphics, Inc.");
   1097  1.1  riastrad MODULE_AUTHOR("Intel Corporation");
   1098  1.1  riastrad 
   1099  1.1  riastrad MODULE_DESCRIPTION(DRIVER_DESC);
   1100  1.1  riastrad MODULE_LICENSE("GPL and additional rights");
   1101