Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2016 Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 21 | * IN THE SOFTWARE. |
| 22 | * |
| 23 | */ |
| 24 | |
Chris Wilson | a09d0ba | 2016-06-24 14:00:27 +0100 | [diff] [blame] | 25 | #include <linux/console.h> |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 26 | #include <linux/vgaarb.h> |
| 27 | #include <linux/vga_switcheroo.h> |
| 28 | |
| 29 | #include "i915_drv.h" |
| 30 | |
| 31 | #define GEN_DEFAULT_PIPEOFFSETS \ |
| 32 | .pipe_offsets = { PIPE_A_OFFSET, PIPE_B_OFFSET, \ |
| 33 | PIPE_C_OFFSET, PIPE_EDP_OFFSET }, \ |
| 34 | .trans_offsets = { TRANSCODER_A_OFFSET, TRANSCODER_B_OFFSET, \ |
| 35 | TRANSCODER_C_OFFSET, TRANSCODER_EDP_OFFSET }, \ |
| 36 | .palette_offsets = { PALETTE_A_OFFSET, PALETTE_B_OFFSET } |
| 37 | |
| 38 | #define GEN_CHV_PIPEOFFSETS \ |
| 39 | .pipe_offsets = { PIPE_A_OFFSET, PIPE_B_OFFSET, \ |
| 40 | CHV_PIPE_C_OFFSET }, \ |
| 41 | .trans_offsets = { TRANSCODER_A_OFFSET, TRANSCODER_B_OFFSET, \ |
| 42 | CHV_TRANSCODER_C_OFFSET, }, \ |
| 43 | .palette_offsets = { PALETTE_A_OFFSET, PALETTE_B_OFFSET, \ |
| 44 | CHV_PALETTE_C_OFFSET } |
| 45 | |
| 46 | #define CURSOR_OFFSETS \ |
| 47 | .cursor_offsets = { CURSOR_A_OFFSET, CURSOR_B_OFFSET, CHV_CURSOR_C_OFFSET } |
| 48 | |
| 49 | #define IVB_CURSOR_OFFSETS \ |
| 50 | .cursor_offsets = { CURSOR_A_OFFSET, IVB_CURSOR_B_OFFSET, IVB_CURSOR_C_OFFSET } |
| 51 | |
| 52 | #define BDW_COLORS \ |
| 53 | .color = { .degamma_lut_size = 512, .gamma_lut_size = 512 } |
| 54 | #define CHV_COLORS \ |
| 55 | .color = { .degamma_lut_size = 65, .gamma_lut_size = 257 } |
| 56 | |
| 57 | static const struct intel_device_info intel_i830_info = { |
| 58 | .gen = 2, .is_mobile = 1, .cursor_needs_physical = 1, .num_pipes = 2, |
| 59 | .has_overlay = 1, .overlay_needs_physical = 1, |
| 60 | .ring_mask = RENDER_RING, |
| 61 | GEN_DEFAULT_PIPEOFFSETS, |
| 62 | CURSOR_OFFSETS, |
| 63 | }; |
| 64 | |
| 65 | static const struct intel_device_info intel_845g_info = { |
| 66 | .gen = 2, .num_pipes = 1, |
| 67 | .has_overlay = 1, .overlay_needs_physical = 1, |
| 68 | .ring_mask = RENDER_RING, |
| 69 | GEN_DEFAULT_PIPEOFFSETS, |
| 70 | CURSOR_OFFSETS, |
| 71 | }; |
| 72 | |
| 73 | static const struct intel_device_info intel_i85x_info = { |
| 74 | .gen = 2, .is_i85x = 1, .is_mobile = 1, .num_pipes = 2, |
| 75 | .cursor_needs_physical = 1, |
| 76 | .has_overlay = 1, .overlay_needs_physical = 1, |
| 77 | .has_fbc = 1, |
| 78 | .ring_mask = RENDER_RING, |
| 79 | GEN_DEFAULT_PIPEOFFSETS, |
| 80 | CURSOR_OFFSETS, |
| 81 | }; |
| 82 | |
| 83 | static const struct intel_device_info intel_i865g_info = { |
| 84 | .gen = 2, .num_pipes = 1, |
| 85 | .has_overlay = 1, .overlay_needs_physical = 1, |
| 86 | .ring_mask = RENDER_RING, |
| 87 | GEN_DEFAULT_PIPEOFFSETS, |
| 88 | CURSOR_OFFSETS, |
| 89 | }; |
| 90 | |
| 91 | static const struct intel_device_info intel_i915g_info = { |
| 92 | .gen = 3, .is_i915g = 1, .cursor_needs_physical = 1, .num_pipes = 2, |
| 93 | .has_overlay = 1, .overlay_needs_physical = 1, |
| 94 | .ring_mask = RENDER_RING, |
| 95 | GEN_DEFAULT_PIPEOFFSETS, |
| 96 | CURSOR_OFFSETS, |
| 97 | }; |
| 98 | static const struct intel_device_info intel_i915gm_info = { |
| 99 | .gen = 3, .is_mobile = 1, .num_pipes = 2, |
| 100 | .cursor_needs_physical = 1, |
| 101 | .has_overlay = 1, .overlay_needs_physical = 1, |
| 102 | .supports_tv = 1, |
| 103 | .has_fbc = 1, |
| 104 | .ring_mask = RENDER_RING, |
| 105 | GEN_DEFAULT_PIPEOFFSETS, |
| 106 | CURSOR_OFFSETS, |
| 107 | }; |
| 108 | static const struct intel_device_info intel_i945g_info = { |
| 109 | .gen = 3, .has_hotplug = 1, .cursor_needs_physical = 1, .num_pipes = 2, |
| 110 | .has_overlay = 1, .overlay_needs_physical = 1, |
| 111 | .ring_mask = RENDER_RING, |
| 112 | GEN_DEFAULT_PIPEOFFSETS, |
| 113 | CURSOR_OFFSETS, |
| 114 | }; |
| 115 | static const struct intel_device_info intel_i945gm_info = { |
| 116 | .gen = 3, .is_i945gm = 1, .is_mobile = 1, .num_pipes = 2, |
| 117 | .has_hotplug = 1, .cursor_needs_physical = 1, |
| 118 | .has_overlay = 1, .overlay_needs_physical = 1, |
| 119 | .supports_tv = 1, |
| 120 | .has_fbc = 1, |
| 121 | .ring_mask = RENDER_RING, |
| 122 | GEN_DEFAULT_PIPEOFFSETS, |
| 123 | CURSOR_OFFSETS, |
| 124 | }; |
| 125 | |
| 126 | static const struct intel_device_info intel_i965g_info = { |
| 127 | .gen = 4, .is_broadwater = 1, .num_pipes = 2, |
| 128 | .has_hotplug = 1, |
| 129 | .has_overlay = 1, |
| 130 | .ring_mask = RENDER_RING, |
| 131 | GEN_DEFAULT_PIPEOFFSETS, |
| 132 | CURSOR_OFFSETS, |
| 133 | }; |
| 134 | |
| 135 | static const struct intel_device_info intel_i965gm_info = { |
| 136 | .gen = 4, .is_crestline = 1, .num_pipes = 2, |
| 137 | .is_mobile = 1, .has_fbc = 1, .has_hotplug = 1, |
| 138 | .has_overlay = 1, |
| 139 | .supports_tv = 1, |
| 140 | .ring_mask = RENDER_RING, |
| 141 | GEN_DEFAULT_PIPEOFFSETS, |
| 142 | CURSOR_OFFSETS, |
| 143 | }; |
| 144 | |
| 145 | static const struct intel_device_info intel_g33_info = { |
| 146 | .gen = 3, .is_g33 = 1, .num_pipes = 2, |
| 147 | .need_gfx_hws = 1, .has_hotplug = 1, |
| 148 | .has_overlay = 1, |
| 149 | .ring_mask = RENDER_RING, |
| 150 | GEN_DEFAULT_PIPEOFFSETS, |
| 151 | CURSOR_OFFSETS, |
| 152 | }; |
| 153 | |
| 154 | static const struct intel_device_info intel_g45_info = { |
| 155 | .gen = 4, .is_g4x = 1, .need_gfx_hws = 1, .num_pipes = 2, |
| 156 | .has_pipe_cxsr = 1, .has_hotplug = 1, |
| 157 | .ring_mask = RENDER_RING | BSD_RING, |
| 158 | GEN_DEFAULT_PIPEOFFSETS, |
| 159 | CURSOR_OFFSETS, |
| 160 | }; |
| 161 | |
| 162 | static const struct intel_device_info intel_gm45_info = { |
| 163 | .gen = 4, .is_g4x = 1, .num_pipes = 2, |
| 164 | .is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1, |
| 165 | .has_pipe_cxsr = 1, .has_hotplug = 1, |
| 166 | .supports_tv = 1, |
| 167 | .ring_mask = RENDER_RING | BSD_RING, |
| 168 | GEN_DEFAULT_PIPEOFFSETS, |
| 169 | CURSOR_OFFSETS, |
| 170 | }; |
| 171 | |
| 172 | static const struct intel_device_info intel_pineview_info = { |
| 173 | .gen = 3, .is_g33 = 1, .is_pineview = 1, .is_mobile = 1, .num_pipes = 2, |
| 174 | .need_gfx_hws = 1, .has_hotplug = 1, |
| 175 | .has_overlay = 1, |
Chris Wilson | 6ce2135 | 2016-07-29 00:45:35 +0100 | [diff] [blame] | 176 | .ring_mask = RENDER_RING, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 177 | GEN_DEFAULT_PIPEOFFSETS, |
| 178 | CURSOR_OFFSETS, |
| 179 | }; |
| 180 | |
| 181 | static const struct intel_device_info intel_ironlake_d_info = { |
| 182 | .gen = 5, .num_pipes = 2, |
| 183 | .need_gfx_hws = 1, .has_hotplug = 1, |
| 184 | .ring_mask = RENDER_RING | BSD_RING, |
| 185 | GEN_DEFAULT_PIPEOFFSETS, |
| 186 | CURSOR_OFFSETS, |
| 187 | }; |
| 188 | |
| 189 | static const struct intel_device_info intel_ironlake_m_info = { |
| 190 | .gen = 5, .is_mobile = 1, .num_pipes = 2, |
| 191 | .need_gfx_hws = 1, .has_hotplug = 1, |
| 192 | .has_fbc = 1, |
| 193 | .ring_mask = RENDER_RING | BSD_RING, |
| 194 | GEN_DEFAULT_PIPEOFFSETS, |
| 195 | CURSOR_OFFSETS, |
| 196 | }; |
| 197 | |
Carlos Santa | 07db6be | 2016-08-17 12:30:38 -0700 | [diff] [blame] | 198 | #define GEN6_FEATURES \ |
| 199 | .gen = 6, .num_pipes = 2, \ |
| 200 | .need_gfx_hws = 1, .has_hotplug = 1, \ |
| 201 | .has_fbc = 1, \ |
| 202 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \ |
| 203 | .has_llc = 1, \ |
| 204 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 205 | CURSOR_OFFSETS |
| 206 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 207 | static const struct intel_device_info intel_sandybridge_d_info = { |
Carlos Santa | 07db6be | 2016-08-17 12:30:38 -0700 | [diff] [blame] | 208 | GEN6_FEATURES, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 209 | }; |
| 210 | |
| 211 | static const struct intel_device_info intel_sandybridge_m_info = { |
Carlos Santa | 07db6be | 2016-08-17 12:30:38 -0700 | [diff] [blame] | 212 | GEN6_FEATURES, |
| 213 | .is_mobile = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 214 | }; |
| 215 | |
| 216 | #define GEN7_FEATURES \ |
| 217 | .gen = 7, .num_pipes = 3, \ |
| 218 | .need_gfx_hws = 1, .has_hotplug = 1, \ |
| 219 | .has_fbc = 1, \ |
| 220 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \ |
| 221 | .has_llc = 1, \ |
| 222 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 223 | IVB_CURSOR_OFFSETS |
| 224 | |
| 225 | static const struct intel_device_info intel_ivybridge_d_info = { |
| 226 | GEN7_FEATURES, |
| 227 | .is_ivybridge = 1, |
| 228 | }; |
| 229 | |
| 230 | static const struct intel_device_info intel_ivybridge_m_info = { |
| 231 | GEN7_FEATURES, |
| 232 | .is_ivybridge = 1, |
| 233 | .is_mobile = 1, |
| 234 | }; |
| 235 | |
| 236 | static const struct intel_device_info intel_ivybridge_q_info = { |
| 237 | GEN7_FEATURES, |
| 238 | .is_ivybridge = 1, |
| 239 | .num_pipes = 0, /* legal, last one wins */ |
| 240 | }; |
| 241 | |
| 242 | #define VLV_FEATURES \ |
| 243 | .gen = 7, .num_pipes = 2, \ |
Carlos Santa | 6e3b84d | 2016-08-17 12:30:36 -0700 | [diff] [blame] | 244 | .has_psr = 1, \ |
Carlos Santa | 4aa4c23 | 2016-08-17 12:30:39 -0700 | [diff] [blame] | 245 | .has_runtime_pm = 1, \ |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 246 | .need_gfx_hws = 1, .has_hotplug = 1, \ |
| 247 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \ |
| 248 | .display_mmio_offset = VLV_DISPLAY_BASE, \ |
| 249 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 250 | CURSOR_OFFSETS |
| 251 | |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 252 | static const struct intel_device_info intel_valleyview_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 253 | VLV_FEATURES, |
| 254 | .is_valleyview = 1, |
| 255 | }; |
| 256 | |
| 257 | #define HSW_FEATURES \ |
| 258 | GEN7_FEATURES, \ |
| 259 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \ |
| 260 | .has_ddi = 1, \ |
Carlos Santa | 6e3b84d | 2016-08-17 12:30:36 -0700 | [diff] [blame] | 261 | .has_fpga_dbg = 1, \ |
Carlos Santa | 4aa4c23 | 2016-08-17 12:30:39 -0700 | [diff] [blame] | 262 | .has_psr = 1, \ |
| 263 | .has_runtime_pm = 1 |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 264 | |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 265 | static const struct intel_device_info intel_haswell_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 266 | HSW_FEATURES, |
| 267 | .is_haswell = 1, |
| 268 | }; |
| 269 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 270 | #define BDW_FEATURES \ |
| 271 | HSW_FEATURES, \ |
| 272 | BDW_COLORS |
| 273 | |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 274 | static const struct intel_device_info intel_broadwell_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 275 | BDW_FEATURES, |
| 276 | .gen = 8, |
| 277 | .is_broadwell = 1, |
| 278 | }; |
| 279 | |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 280 | static const struct intel_device_info intel_broadwell_gt3_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 281 | BDW_FEATURES, |
| 282 | .gen = 8, |
| 283 | .is_broadwell = 1, |
| 284 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, |
| 285 | }; |
| 286 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 287 | static const struct intel_device_info intel_cherryview_info = { |
| 288 | .gen = 8, .num_pipes = 3, |
| 289 | .need_gfx_hws = 1, .has_hotplug = 1, |
| 290 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, |
| 291 | .is_cherryview = 1, |
Carlos Santa | 6e3b84d | 2016-08-17 12:30:36 -0700 | [diff] [blame] | 292 | .has_psr = 1, |
Carlos Santa | 4aa4c23 | 2016-08-17 12:30:39 -0700 | [diff] [blame] | 293 | .has_runtime_pm = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 294 | .display_mmio_offset = VLV_DISPLAY_BASE, |
| 295 | GEN_CHV_PIPEOFFSETS, |
| 296 | CURSOR_OFFSETS, |
| 297 | CHV_COLORS, |
| 298 | }; |
| 299 | |
| 300 | static const struct intel_device_info intel_skylake_info = { |
| 301 | BDW_FEATURES, |
| 302 | .is_skylake = 1, |
| 303 | .gen = 9, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame^] | 304 | .has_csr = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 305 | }; |
| 306 | |
| 307 | static const struct intel_device_info intel_skylake_gt3_info = { |
| 308 | BDW_FEATURES, |
| 309 | .is_skylake = 1, |
| 310 | .gen = 9, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame^] | 311 | .has_csr = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 312 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, |
| 313 | }; |
| 314 | |
| 315 | static const struct intel_device_info intel_broxton_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 316 | .is_broxton = 1, |
| 317 | .gen = 9, |
| 318 | .need_gfx_hws = 1, .has_hotplug = 1, |
| 319 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, |
| 320 | .num_pipes = 3, |
| 321 | .has_ddi = 1, |
| 322 | .has_fpga_dbg = 1, |
| 323 | .has_fbc = 1, |
Carlos Santa | 4aa4c23 | 2016-08-17 12:30:39 -0700 | [diff] [blame] | 324 | .has_runtime_pm = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 325 | .has_pooled_eu = 0, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame^] | 326 | .has_csr = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 327 | GEN_DEFAULT_PIPEOFFSETS, |
| 328 | IVB_CURSOR_OFFSETS, |
| 329 | BDW_COLORS, |
| 330 | }; |
| 331 | |
| 332 | static const struct intel_device_info intel_kabylake_info = { |
| 333 | BDW_FEATURES, |
| 334 | .is_kabylake = 1, |
| 335 | .gen = 9, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame^] | 336 | .has_csr = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 337 | }; |
| 338 | |
| 339 | static const struct intel_device_info intel_kabylake_gt3_info = { |
| 340 | BDW_FEATURES, |
| 341 | .is_kabylake = 1, |
| 342 | .gen = 9, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame^] | 343 | .has_csr = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 344 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, |
| 345 | }; |
| 346 | |
| 347 | /* |
| 348 | * Make sure any device matches here are from most specific to most |
| 349 | * general. For example, since the Quanta match is based on the subsystem |
| 350 | * and subvendor IDs, we need it to come before the more general IVB |
| 351 | * PCI ID matches, otherwise we'll use the wrong info struct above. |
| 352 | */ |
| 353 | static const struct pci_device_id pciidlist[] = { |
| 354 | INTEL_I830_IDS(&intel_i830_info), |
| 355 | INTEL_I845G_IDS(&intel_845g_info), |
| 356 | INTEL_I85X_IDS(&intel_i85x_info), |
| 357 | INTEL_I865G_IDS(&intel_i865g_info), |
| 358 | INTEL_I915G_IDS(&intel_i915g_info), |
| 359 | INTEL_I915GM_IDS(&intel_i915gm_info), |
| 360 | INTEL_I945G_IDS(&intel_i945g_info), |
| 361 | INTEL_I945GM_IDS(&intel_i945gm_info), |
| 362 | INTEL_I965G_IDS(&intel_i965g_info), |
| 363 | INTEL_G33_IDS(&intel_g33_info), |
| 364 | INTEL_I965GM_IDS(&intel_i965gm_info), |
| 365 | INTEL_GM45_IDS(&intel_gm45_info), |
| 366 | INTEL_G45_IDS(&intel_g45_info), |
| 367 | INTEL_PINEVIEW_IDS(&intel_pineview_info), |
| 368 | INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info), |
| 369 | INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info), |
| 370 | INTEL_SNB_D_IDS(&intel_sandybridge_d_info), |
| 371 | INTEL_SNB_M_IDS(&intel_sandybridge_m_info), |
| 372 | INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */ |
| 373 | INTEL_IVB_M_IDS(&intel_ivybridge_m_info), |
| 374 | INTEL_IVB_D_IDS(&intel_ivybridge_d_info), |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 375 | INTEL_HSW_IDS(&intel_haswell_info), |
| 376 | INTEL_VLV_IDS(&intel_valleyview_info), |
| 377 | INTEL_BDW_GT12_IDS(&intel_broadwell_info), |
| 378 | INTEL_BDW_GT3_IDS(&intel_broadwell_gt3_info), |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 379 | INTEL_CHV_IDS(&intel_cherryview_info), |
| 380 | INTEL_SKL_GT1_IDS(&intel_skylake_info), |
| 381 | INTEL_SKL_GT2_IDS(&intel_skylake_info), |
| 382 | INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info), |
| 383 | INTEL_SKL_GT4_IDS(&intel_skylake_gt3_info), |
| 384 | INTEL_BXT_IDS(&intel_broxton_info), |
| 385 | INTEL_KBL_GT1_IDS(&intel_kabylake_info), |
| 386 | INTEL_KBL_GT2_IDS(&intel_kabylake_info), |
| 387 | INTEL_KBL_GT3_IDS(&intel_kabylake_gt3_info), |
| 388 | INTEL_KBL_GT4_IDS(&intel_kabylake_gt3_info), |
| 389 | {0, 0, 0} |
| 390 | }; |
| 391 | MODULE_DEVICE_TABLE(pci, pciidlist); |
| 392 | |
| 393 | extern int i915_driver_load(struct pci_dev *pdev, |
| 394 | const struct pci_device_id *ent); |
| 395 | |
| 396 | static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 397 | { |
| 398 | struct intel_device_info *intel_info = |
| 399 | (struct intel_device_info *) ent->driver_data; |
| 400 | |
| 401 | if (IS_PRELIMINARY_HW(intel_info) && !i915.preliminary_hw_support) { |
| 402 | DRM_INFO("This hardware requires preliminary hardware support.\n" |
| 403 | "See CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT, and/or modparam preliminary_hw_support\n"); |
| 404 | return -ENODEV; |
| 405 | } |
| 406 | |
| 407 | /* Only bind to function 0 of the device. Early generations |
| 408 | * used function 1 as a placeholder for multi-head. This causes |
| 409 | * us confusion instead, especially on the systems where both |
| 410 | * functions have the same PCI-ID! |
| 411 | */ |
| 412 | if (PCI_FUNC(pdev->devfn)) |
| 413 | return -ENODEV; |
| 414 | |
| 415 | /* |
| 416 | * apple-gmux is needed on dual GPU MacBook Pro |
| 417 | * to probe the panel if we're the inactive GPU. |
| 418 | */ |
| 419 | if (vga_switcheroo_client_probe_defer(pdev)) |
| 420 | return -EPROBE_DEFER; |
| 421 | |
| 422 | return i915_driver_load(pdev, ent); |
| 423 | } |
| 424 | |
| 425 | extern void i915_driver_unload(struct drm_device *dev); |
| 426 | |
| 427 | static void i915_pci_remove(struct pci_dev *pdev) |
| 428 | { |
| 429 | struct drm_device *dev = pci_get_drvdata(pdev); |
| 430 | |
| 431 | i915_driver_unload(dev); |
| 432 | drm_dev_unref(dev); |
| 433 | } |
| 434 | |
| 435 | extern const struct dev_pm_ops i915_pm_ops; |
| 436 | |
Chris Wilson | a09d0ba | 2016-06-24 14:00:27 +0100 | [diff] [blame] | 437 | static struct pci_driver i915_pci_driver = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 438 | .name = DRIVER_NAME, |
| 439 | .id_table = pciidlist, |
| 440 | .probe = i915_pci_probe, |
| 441 | .remove = i915_pci_remove, |
| 442 | .driver.pm = &i915_pm_ops, |
| 443 | }; |
Chris Wilson | a09d0ba | 2016-06-24 14:00:27 +0100 | [diff] [blame] | 444 | |
| 445 | static int __init i915_init(void) |
| 446 | { |
| 447 | bool use_kms = true; |
| 448 | |
| 449 | /* |
| 450 | * Enable KMS by default, unless explicitly overriden by |
| 451 | * either the i915.modeset prarameter or by the |
| 452 | * vga_text_mode_force boot option. |
| 453 | */ |
| 454 | |
| 455 | if (i915.modeset == 0) |
| 456 | use_kms = false; |
| 457 | |
| 458 | if (vgacon_text_force() && i915.modeset == -1) |
| 459 | use_kms = false; |
| 460 | |
| 461 | if (!use_kms) { |
| 462 | /* Silently fail loading to not upset userspace. */ |
| 463 | DRM_DEBUG_DRIVER("KMS disabled.\n"); |
| 464 | return 0; |
| 465 | } |
| 466 | |
| 467 | return pci_register_driver(&i915_pci_driver); |
| 468 | } |
| 469 | |
| 470 | static void __exit i915_exit(void) |
| 471 | { |
| 472 | if (!i915_pci_driver.driver.owner) |
| 473 | return; |
| 474 | |
| 475 | pci_unregister_driver(&i915_pci_driver); |
| 476 | } |
| 477 | |
| 478 | module_init(i915_init); |
| 479 | module_exit(i915_exit); |
| 480 | |
| 481 | MODULE_AUTHOR("Tungsten Graphics, Inc."); |
| 482 | MODULE_AUTHOR("Intel Corporation"); |
| 483 | |
| 484 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 485 | MODULE_LICENSE("GPL and additional rights"); |