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 | |
Carlos Santa | 0eec8dc | 2016-08-17 12:30:51 -0700 | [diff] [blame] | 57 | #define GEN2_FEATURES \ |
| 58 | .gen = 2, .num_pipes = 1, \ |
| 59 | .has_overlay = 1, .overlay_needs_physical = 1, \ |
Carlos Santa | 804b871 | 2016-08-17 12:30:55 -0700 | [diff] [blame] | 60 | .has_gmch_display = 1, \ |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 61 | .hws_needs_physical = 1, \ |
Carlos Santa | 0eec8dc | 2016-08-17 12:30:51 -0700 | [diff] [blame] | 62 | .ring_mask = RENDER_RING, \ |
| 63 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 64 | CURSOR_OFFSETS |
| 65 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 66 | static const struct intel_device_info intel_i830_info = { |
Carlos Santa | 0eec8dc | 2016-08-17 12:30:51 -0700 | [diff] [blame] | 67 | GEN2_FEATURES, |
| 68 | .is_mobile = 1, .cursor_needs_physical = 1, |
| 69 | .num_pipes = 2, /* legal, last one wins */ |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | static const struct intel_device_info intel_845g_info = { |
Carlos Santa | 0eec8dc | 2016-08-17 12:30:51 -0700 | [diff] [blame] | 73 | GEN2_FEATURES, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | static const struct intel_device_info intel_i85x_info = { |
Carlos Santa | 0eec8dc | 2016-08-17 12:30:51 -0700 | [diff] [blame] | 77 | GEN2_FEATURES, |
| 78 | .is_i85x = 1, .is_mobile = 1, |
| 79 | .num_pipes = 2, /* legal, last one wins */ |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 80 | .cursor_needs_physical = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 81 | .has_fbc = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 82 | }; |
| 83 | |
| 84 | static const struct intel_device_info intel_i865g_info = { |
Carlos Santa | 0eec8dc | 2016-08-17 12:30:51 -0700 | [diff] [blame] | 85 | GEN2_FEATURES, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 86 | }; |
| 87 | |
Carlos Santa | 54d2a6a | 2016-08-17 12:30:50 -0700 | [diff] [blame] | 88 | #define GEN3_FEATURES \ |
| 89 | .gen = 3, .num_pipes = 2, \ |
Carlos Santa | 804b871 | 2016-08-17 12:30:55 -0700 | [diff] [blame] | 90 | .has_gmch_display = 1, \ |
Carlos Santa | 54d2a6a | 2016-08-17 12:30:50 -0700 | [diff] [blame] | 91 | .ring_mask = RENDER_RING, \ |
| 92 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 93 | CURSOR_OFFSETS |
| 94 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 95 | static const struct intel_device_info intel_i915g_info = { |
Carlos Santa | 54d2a6a | 2016-08-17 12:30:50 -0700 | [diff] [blame] | 96 | GEN3_FEATURES, |
| 97 | .is_i915g = 1, .cursor_needs_physical = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 98 | .has_overlay = 1, .overlay_needs_physical = 1, |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 99 | .hws_needs_physical = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 100 | }; |
| 101 | static const struct intel_device_info intel_i915gm_info = { |
Carlos Santa | 54d2a6a | 2016-08-17 12:30:50 -0700 | [diff] [blame] | 102 | GEN3_FEATURES, |
| 103 | .is_mobile = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 104 | .cursor_needs_physical = 1, |
| 105 | .has_overlay = 1, .overlay_needs_physical = 1, |
| 106 | .supports_tv = 1, |
| 107 | .has_fbc = 1, |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 108 | .hws_needs_physical = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 109 | }; |
| 110 | static const struct intel_device_info intel_i945g_info = { |
Carlos Santa | 54d2a6a | 2016-08-17 12:30:50 -0700 | [diff] [blame] | 111 | GEN3_FEATURES, |
| 112 | .has_hotplug = 1, .cursor_needs_physical = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 113 | .has_overlay = 1, .overlay_needs_physical = 1, |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 114 | .hws_needs_physical = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 115 | }; |
| 116 | static const struct intel_device_info intel_i945gm_info = { |
Carlos Santa | 54d2a6a | 2016-08-17 12:30:50 -0700 | [diff] [blame] | 117 | GEN3_FEATURES, |
| 118 | .is_i945gm = 1, .is_mobile = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 119 | .has_hotplug = 1, .cursor_needs_physical = 1, |
| 120 | .has_overlay = 1, .overlay_needs_physical = 1, |
| 121 | .supports_tv = 1, |
| 122 | .has_fbc = 1, |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 123 | .hws_needs_physical = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 124 | }; |
| 125 | |
Carlos Santa | 4d495be | 2016-08-17 12:30:49 -0700 | [diff] [blame] | 126 | #define GEN4_FEATURES \ |
| 127 | .gen = 4, .num_pipes = 2, \ |
| 128 | .has_hotplug = 1, \ |
Carlos Santa | 804b871 | 2016-08-17 12:30:55 -0700 | [diff] [blame] | 129 | .has_gmch_display = 1, \ |
Carlos Santa | 4d495be | 2016-08-17 12:30:49 -0700 | [diff] [blame] | 130 | .ring_mask = RENDER_RING, \ |
| 131 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 132 | CURSOR_OFFSETS |
| 133 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 134 | static const struct intel_device_info intel_i965g_info = { |
Carlos Santa | 4d495be | 2016-08-17 12:30:49 -0700 | [diff] [blame] | 135 | GEN4_FEATURES, |
| 136 | .is_broadwater = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 137 | .has_overlay = 1, |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 138 | .hws_needs_physical = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 139 | }; |
| 140 | |
| 141 | static const struct intel_device_info intel_i965gm_info = { |
Carlos Santa | 4d495be | 2016-08-17 12:30:49 -0700 | [diff] [blame] | 142 | GEN4_FEATURES, |
| 143 | .is_crestline = 1, |
| 144 | .is_mobile = 1, .has_fbc = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 145 | .has_overlay = 1, |
| 146 | .supports_tv = 1, |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 147 | .hws_needs_physical = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 148 | }; |
| 149 | |
| 150 | static const struct intel_device_info intel_g33_info = { |
Carlos Santa | 54d2a6a | 2016-08-17 12:30:50 -0700 | [diff] [blame] | 151 | GEN3_FEATURES, |
| 152 | .is_g33 = 1, |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 153 | .has_hotplug = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 154 | .has_overlay = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 155 | }; |
| 156 | |
| 157 | static const struct intel_device_info intel_g45_info = { |
Carlos Santa | 4d495be | 2016-08-17 12:30:49 -0700 | [diff] [blame] | 158 | GEN4_FEATURES, |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 159 | .is_g4x = 1, |
Carlos Santa | 4d495be | 2016-08-17 12:30:49 -0700 | [diff] [blame] | 160 | .has_pipe_cxsr = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 161 | .ring_mask = RENDER_RING | BSD_RING, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 162 | }; |
| 163 | |
| 164 | static const struct intel_device_info intel_gm45_info = { |
Carlos Santa | 4d495be | 2016-08-17 12:30:49 -0700 | [diff] [blame] | 165 | GEN4_FEATURES, |
| 166 | .is_g4x = 1, |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 167 | .is_mobile = 1, .has_fbc = 1, |
Carlos Santa | 4d495be | 2016-08-17 12:30:49 -0700 | [diff] [blame] | 168 | .has_pipe_cxsr = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 169 | .supports_tv = 1, |
| 170 | .ring_mask = RENDER_RING | BSD_RING, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 171 | }; |
| 172 | |
| 173 | static const struct intel_device_info intel_pineview_info = { |
Carlos Santa | 54d2a6a | 2016-08-17 12:30:50 -0700 | [diff] [blame] | 174 | GEN3_FEATURES, |
| 175 | .is_g33 = 1, .is_pineview = 1, .is_mobile = 1, |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 176 | .has_hotplug = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 177 | .has_overlay = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 178 | }; |
| 179 | |
Carlos Santa | a132338 | 2016-08-17 12:30:47 -0700 | [diff] [blame] | 180 | #define GEN5_FEATURES \ |
| 181 | .gen = 5, .num_pipes = 2, \ |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 182 | .has_hotplug = 1, \ |
Carlos Santa | b355f10 | 2016-08-17 12:30:48 -0700 | [diff] [blame] | 183 | .has_gmbus_irq = 1, \ |
Carlos Santa | a132338 | 2016-08-17 12:30:47 -0700 | [diff] [blame] | 184 | .ring_mask = RENDER_RING | BSD_RING, \ |
| 185 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 186 | CURSOR_OFFSETS |
| 187 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 188 | static const struct intel_device_info intel_ironlake_d_info = { |
Carlos Santa | a132338 | 2016-08-17 12:30:47 -0700 | [diff] [blame] | 189 | GEN5_FEATURES, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 190 | }; |
| 191 | |
| 192 | static const struct intel_device_info intel_ironlake_m_info = { |
Carlos Santa | a132338 | 2016-08-17 12:30:47 -0700 | [diff] [blame] | 193 | GEN5_FEATURES, |
| 194 | .is_mobile = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 195 | }; |
| 196 | |
Carlos Santa | 07db6be | 2016-08-17 12:30:38 -0700 | [diff] [blame] | 197 | #define GEN6_FEATURES \ |
| 198 | .gen = 6, .num_pipes = 2, \ |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 199 | .has_hotplug = 1, \ |
Carlos Santa | 07db6be | 2016-08-17 12:30:38 -0700 | [diff] [blame] | 200 | .has_fbc = 1, \ |
| 201 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \ |
| 202 | .has_llc = 1, \ |
Carlos Santa | 86f3624 | 2016-08-17 12:30:44 -0700 | [diff] [blame] | 203 | .has_rc6 = 1, \ |
Carlos Santa | 33b5bf8 | 2016-08-17 12:30:45 -0700 | [diff] [blame] | 204 | .has_rc6p = 1, \ |
Carlos Santa | b355f10 | 2016-08-17 12:30:48 -0700 | [diff] [blame] | 205 | .has_gmbus_irq = 1, \ |
Carlos Santa | e1a52536 | 2016-08-17 12:30:52 -0700 | [diff] [blame] | 206 | .has_hw_contexts = 1, \ |
Michel Thierry | 9e1d0e6 | 2016-12-05 17:57:03 -0800 | [diff] [blame^] | 207 | .has_aliasing_ppgtt = 1, \ |
Carlos Santa | 07db6be | 2016-08-17 12:30:38 -0700 | [diff] [blame] | 208 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 209 | CURSOR_OFFSETS |
| 210 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 211 | static const struct intel_device_info intel_sandybridge_d_info = { |
Carlos Santa | 07db6be | 2016-08-17 12:30:38 -0700 | [diff] [blame] | 212 | GEN6_FEATURES, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 213 | }; |
| 214 | |
| 215 | static const struct intel_device_info intel_sandybridge_m_info = { |
Carlos Santa | 07db6be | 2016-08-17 12:30:38 -0700 | [diff] [blame] | 216 | GEN6_FEATURES, |
| 217 | .is_mobile = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 218 | }; |
| 219 | |
| 220 | #define GEN7_FEATURES \ |
| 221 | .gen = 7, .num_pipes = 3, \ |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 222 | .has_hotplug = 1, \ |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 223 | .has_fbc = 1, \ |
| 224 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \ |
| 225 | .has_llc = 1, \ |
Carlos Santa | 86f3624 | 2016-08-17 12:30:44 -0700 | [diff] [blame] | 226 | .has_rc6 = 1, \ |
Carlos Santa | 33b5bf8 | 2016-08-17 12:30:45 -0700 | [diff] [blame] | 227 | .has_rc6p = 1, \ |
Carlos Santa | b355f10 | 2016-08-17 12:30:48 -0700 | [diff] [blame] | 228 | .has_gmbus_irq = 1, \ |
Carlos Santa | e1a52536 | 2016-08-17 12:30:52 -0700 | [diff] [blame] | 229 | .has_hw_contexts = 1, \ |
Michel Thierry | 9e1d0e6 | 2016-12-05 17:57:03 -0800 | [diff] [blame^] | 230 | .has_aliasing_ppgtt = 1, \ |
| 231 | .has_full_ppgtt = 1, \ |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 232 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 233 | IVB_CURSOR_OFFSETS |
| 234 | |
| 235 | static const struct intel_device_info intel_ivybridge_d_info = { |
| 236 | GEN7_FEATURES, |
| 237 | .is_ivybridge = 1, |
Carlos Santa | ca9c452 | 2016-08-17 12:30:54 -0700 | [diff] [blame] | 238 | .has_l3_dpf = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 239 | }; |
| 240 | |
| 241 | static const struct intel_device_info intel_ivybridge_m_info = { |
| 242 | GEN7_FEATURES, |
| 243 | .is_ivybridge = 1, |
| 244 | .is_mobile = 1, |
Carlos Santa | ca9c452 | 2016-08-17 12:30:54 -0700 | [diff] [blame] | 245 | .has_l3_dpf = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 246 | }; |
| 247 | |
| 248 | static const struct intel_device_info intel_ivybridge_q_info = { |
| 249 | GEN7_FEATURES, |
| 250 | .is_ivybridge = 1, |
| 251 | .num_pipes = 0, /* legal, last one wins */ |
Carlos Santa | ca9c452 | 2016-08-17 12:30:54 -0700 | [diff] [blame] | 252 | .has_l3_dpf = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 253 | }; |
| 254 | |
| 255 | #define VLV_FEATURES \ |
| 256 | .gen = 7, .num_pipes = 2, \ |
Carlos Santa | 6e3b84d | 2016-08-17 12:30:36 -0700 | [diff] [blame] | 257 | .has_psr = 1, \ |
Carlos Santa | 4aa4c23 | 2016-08-17 12:30:39 -0700 | [diff] [blame] | 258 | .has_runtime_pm = 1, \ |
Carlos Santa | 86f3624 | 2016-08-17 12:30:44 -0700 | [diff] [blame] | 259 | .has_rc6 = 1, \ |
Carlos Santa | b355f10 | 2016-08-17 12:30:48 -0700 | [diff] [blame] | 260 | .has_gmbus_irq = 1, \ |
Carlos Santa | e1a52536 | 2016-08-17 12:30:52 -0700 | [diff] [blame] | 261 | .has_hw_contexts = 1, \ |
Carlos Santa | 804b871 | 2016-08-17 12:30:55 -0700 | [diff] [blame] | 262 | .has_gmch_display = 1, \ |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 263 | .has_hotplug = 1, \ |
Michel Thierry | 9e1d0e6 | 2016-12-05 17:57:03 -0800 | [diff] [blame^] | 264 | .has_aliasing_ppgtt = 1, \ |
| 265 | .has_full_ppgtt = 1, \ |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 266 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \ |
| 267 | .display_mmio_offset = VLV_DISPLAY_BASE, \ |
| 268 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 269 | CURSOR_OFFSETS |
| 270 | |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 271 | static const struct intel_device_info intel_valleyview_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 272 | VLV_FEATURES, |
| 273 | .is_valleyview = 1, |
| 274 | }; |
| 275 | |
| 276 | #define HSW_FEATURES \ |
| 277 | GEN7_FEATURES, \ |
| 278 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \ |
| 279 | .has_ddi = 1, \ |
Carlos Santa | 6e3b84d | 2016-08-17 12:30:36 -0700 | [diff] [blame] | 280 | .has_fpga_dbg = 1, \ |
Carlos Santa | 4aa4c23 | 2016-08-17 12:30:39 -0700 | [diff] [blame] | 281 | .has_psr = 1, \ |
Carlos Santa | 53233f0 | 2016-08-17 12:30:43 -0700 | [diff] [blame] | 282 | .has_resource_streamer = 1, \ |
Carlos Santa | 1d3fe53 | 2016-08-17 12:30:46 -0700 | [diff] [blame] | 283 | .has_dp_mst = 1, \ |
Carlos Santa | 33b5bf8 | 2016-08-17 12:30:45 -0700 | [diff] [blame] | 284 | .has_rc6p = 0 /* RC6p removed-by HSW */, \ |
Carlos Santa | 4aa4c23 | 2016-08-17 12:30:39 -0700 | [diff] [blame] | 285 | .has_runtime_pm = 1 |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 286 | |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 287 | static const struct intel_device_info intel_haswell_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 288 | HSW_FEATURES, |
| 289 | .is_haswell = 1, |
Carlos Santa | ca9c452 | 2016-08-17 12:30:54 -0700 | [diff] [blame] | 290 | .has_l3_dpf = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 291 | }; |
| 292 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 293 | #define BDW_FEATURES \ |
| 294 | HSW_FEATURES, \ |
Carlos Santa | 4586f1d | 2016-08-17 12:30:53 -0700 | [diff] [blame] | 295 | BDW_COLORS, \ |
Joonas Lahtinen | dfc5148 | 2016-11-03 10:39:46 +0200 | [diff] [blame] | 296 | .has_logical_ring_contexts = 1, \ |
Michel Thierry | 9e1d0e6 | 2016-12-05 17:57:03 -0800 | [diff] [blame^] | 297 | .has_full_48bit_ppgtt = 1, \ |
Joonas Lahtinen | dfc5148 | 2016-11-03 10:39:46 +0200 | [diff] [blame] | 298 | .has_64bit_reloc = 1 |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 299 | |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 300 | static const struct intel_device_info intel_broadwell_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 301 | BDW_FEATURES, |
| 302 | .gen = 8, |
| 303 | .is_broadwell = 1, |
| 304 | }; |
| 305 | |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 306 | static const struct intel_device_info intel_broadwell_gt3_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 307 | BDW_FEATURES, |
| 308 | .gen = 8, |
| 309 | .is_broadwell = 1, |
| 310 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, |
| 311 | }; |
| 312 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 313 | static const struct intel_device_info intel_cherryview_info = { |
| 314 | .gen = 8, .num_pipes = 3, |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 315 | .has_hotplug = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 316 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, |
| 317 | .is_cherryview = 1, |
Joonas Lahtinen | dfc5148 | 2016-11-03 10:39:46 +0200 | [diff] [blame] | 318 | .has_64bit_reloc = 1, |
Carlos Santa | 6e3b84d | 2016-08-17 12:30:36 -0700 | [diff] [blame] | 319 | .has_psr = 1, |
Carlos Santa | 4aa4c23 | 2016-08-17 12:30:39 -0700 | [diff] [blame] | 320 | .has_runtime_pm = 1, |
Carlos Santa | 53233f0 | 2016-08-17 12:30:43 -0700 | [diff] [blame] | 321 | .has_resource_streamer = 1, |
Carlos Santa | 86f3624 | 2016-08-17 12:30:44 -0700 | [diff] [blame] | 322 | .has_rc6 = 1, |
Carlos Santa | b355f10 | 2016-08-17 12:30:48 -0700 | [diff] [blame] | 323 | .has_gmbus_irq = 1, |
Carlos Santa | e1a52536 | 2016-08-17 12:30:52 -0700 | [diff] [blame] | 324 | .has_hw_contexts = 1, |
Carlos Santa | 4586f1d | 2016-08-17 12:30:53 -0700 | [diff] [blame] | 325 | .has_logical_ring_contexts = 1, |
Carlos Santa | 804b871 | 2016-08-17 12:30:55 -0700 | [diff] [blame] | 326 | .has_gmch_display = 1, |
Michel Thierry | 9e1d0e6 | 2016-12-05 17:57:03 -0800 | [diff] [blame^] | 327 | .has_aliasing_ppgtt = 1, |
| 328 | .has_full_ppgtt = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 329 | .display_mmio_offset = VLV_DISPLAY_BASE, |
| 330 | GEN_CHV_PIPEOFFSETS, |
| 331 | CURSOR_OFFSETS, |
| 332 | CHV_COLORS, |
| 333 | }; |
| 334 | |
| 335 | static const struct intel_device_info intel_skylake_info = { |
| 336 | BDW_FEATURES, |
| 337 | .is_skylake = 1, |
| 338 | .gen = 9, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame] | 339 | .has_csr = 1, |
Carlos Santa | 3d810fb | 2016-08-17 12:30:57 -0700 | [diff] [blame] | 340 | .has_guc = 1, |
Deepak M | 6f3fff6 | 2016-09-15 15:01:10 +0530 | [diff] [blame] | 341 | .ddb_size = 896, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 342 | }; |
| 343 | |
| 344 | static const struct intel_device_info intel_skylake_gt3_info = { |
| 345 | BDW_FEATURES, |
| 346 | .is_skylake = 1, |
| 347 | .gen = 9, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame] | 348 | .has_csr = 1, |
Carlos Santa | 3d810fb | 2016-08-17 12:30:57 -0700 | [diff] [blame] | 349 | .has_guc = 1, |
Deepak M | 6f3fff6 | 2016-09-15 15:01:10 +0530 | [diff] [blame] | 350 | .ddb_size = 896, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 351 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, |
| 352 | }; |
| 353 | |
Rodrigo Vivi | 80fa66b | 2016-12-01 11:33:16 +0200 | [diff] [blame] | 354 | #define GEN9_LP_FEATURES \ |
| 355 | .gen = 9, \ |
Ander Conselvan de Oliveira | 3e4274f | 2016-11-10 17:23:09 +0200 | [diff] [blame] | 356 | .is_lp = 1, \ |
Rodrigo Vivi | 80fa66b | 2016-12-01 11:33:16 +0200 | [diff] [blame] | 357 | .has_hotplug = 1, \ |
| 358 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \ |
| 359 | .num_pipes = 3, \ |
| 360 | .has_64bit_reloc = 1, \ |
| 361 | .has_ddi = 1, \ |
| 362 | .has_fpga_dbg = 1, \ |
| 363 | .has_fbc = 1, \ |
| 364 | .has_runtime_pm = 1, \ |
| 365 | .has_pooled_eu = 0, \ |
| 366 | .has_csr = 1, \ |
| 367 | .has_resource_streamer = 1, \ |
| 368 | .has_rc6 = 1, \ |
| 369 | .has_dp_mst = 1, \ |
| 370 | .has_gmbus_irq = 1, \ |
| 371 | .has_hw_contexts = 1, \ |
| 372 | .has_logical_ring_contexts = 1, \ |
| 373 | .has_guc = 1, \ |
| 374 | .has_decoupled_mmio = 1, \ |
Michel Thierry | 9e1d0e6 | 2016-12-05 17:57:03 -0800 | [diff] [blame^] | 375 | .has_aliasing_ppgtt = 1, \ |
| 376 | .has_full_ppgtt = 1, \ |
| 377 | .has_full_48bit_ppgtt = 1, \ |
Rodrigo Vivi | 80fa66b | 2016-12-01 11:33:16 +0200 | [diff] [blame] | 378 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 379 | IVB_CURSOR_OFFSETS, \ |
| 380 | BDW_COLORS |
| 381 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 382 | static const struct intel_device_info intel_broxton_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 383 | .is_broxton = 1, |
Rodrigo Vivi | 80fa66b | 2016-12-01 11:33:16 +0200 | [diff] [blame] | 384 | GEN9_LP_FEATURES, |
Deepak M | 6f3fff6 | 2016-09-15 15:01:10 +0530 | [diff] [blame] | 385 | .ddb_size = 512, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 386 | }; |
| 387 | |
Ander Conselvan de Oliveira | c22097f | 2016-11-14 16:25:26 +0200 | [diff] [blame] | 388 | static const struct intel_device_info intel_geminilake_info = { |
| 389 | .is_alpha_support = 1, |
| 390 | .is_geminilake = 1, |
| 391 | GEN9_LP_FEATURES, |
| 392 | .ddb_size = 1024, |
| 393 | }; |
| 394 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 395 | static const struct intel_device_info intel_kabylake_info = { |
| 396 | BDW_FEATURES, |
| 397 | .is_kabylake = 1, |
| 398 | .gen = 9, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame] | 399 | .has_csr = 1, |
Carlos Santa | 3d810fb | 2016-08-17 12:30:57 -0700 | [diff] [blame] | 400 | .has_guc = 1, |
Deepak M | 6f3fff6 | 2016-09-15 15:01:10 +0530 | [diff] [blame] | 401 | .ddb_size = 896, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 402 | }; |
| 403 | |
| 404 | static const struct intel_device_info intel_kabylake_gt3_info = { |
| 405 | BDW_FEATURES, |
| 406 | .is_kabylake = 1, |
| 407 | .gen = 9, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame] | 408 | .has_csr = 1, |
Carlos Santa | 3d810fb | 2016-08-17 12:30:57 -0700 | [diff] [blame] | 409 | .has_guc = 1, |
Deepak M | 6f3fff6 | 2016-09-15 15:01:10 +0530 | [diff] [blame] | 410 | .ddb_size = 896, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 411 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, |
| 412 | }; |
| 413 | |
| 414 | /* |
| 415 | * Make sure any device matches here are from most specific to most |
| 416 | * general. For example, since the Quanta match is based on the subsystem |
| 417 | * and subvendor IDs, we need it to come before the more general IVB |
| 418 | * PCI ID matches, otherwise we'll use the wrong info struct above. |
| 419 | */ |
| 420 | static const struct pci_device_id pciidlist[] = { |
| 421 | INTEL_I830_IDS(&intel_i830_info), |
| 422 | INTEL_I845G_IDS(&intel_845g_info), |
| 423 | INTEL_I85X_IDS(&intel_i85x_info), |
| 424 | INTEL_I865G_IDS(&intel_i865g_info), |
| 425 | INTEL_I915G_IDS(&intel_i915g_info), |
| 426 | INTEL_I915GM_IDS(&intel_i915gm_info), |
| 427 | INTEL_I945G_IDS(&intel_i945g_info), |
| 428 | INTEL_I945GM_IDS(&intel_i945gm_info), |
| 429 | INTEL_I965G_IDS(&intel_i965g_info), |
| 430 | INTEL_G33_IDS(&intel_g33_info), |
| 431 | INTEL_I965GM_IDS(&intel_i965gm_info), |
| 432 | INTEL_GM45_IDS(&intel_gm45_info), |
| 433 | INTEL_G45_IDS(&intel_g45_info), |
| 434 | INTEL_PINEVIEW_IDS(&intel_pineview_info), |
| 435 | INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info), |
| 436 | INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info), |
| 437 | INTEL_SNB_D_IDS(&intel_sandybridge_d_info), |
| 438 | INTEL_SNB_M_IDS(&intel_sandybridge_m_info), |
| 439 | INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */ |
| 440 | INTEL_IVB_M_IDS(&intel_ivybridge_m_info), |
| 441 | INTEL_IVB_D_IDS(&intel_ivybridge_d_info), |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 442 | INTEL_HSW_IDS(&intel_haswell_info), |
| 443 | INTEL_VLV_IDS(&intel_valleyview_info), |
| 444 | INTEL_BDW_GT12_IDS(&intel_broadwell_info), |
| 445 | INTEL_BDW_GT3_IDS(&intel_broadwell_gt3_info), |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 446 | INTEL_CHV_IDS(&intel_cherryview_info), |
| 447 | INTEL_SKL_GT1_IDS(&intel_skylake_info), |
| 448 | INTEL_SKL_GT2_IDS(&intel_skylake_info), |
| 449 | INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info), |
| 450 | INTEL_SKL_GT4_IDS(&intel_skylake_gt3_info), |
| 451 | INTEL_BXT_IDS(&intel_broxton_info), |
Ander Conselvan de Oliveira | 8363e3c | 2016-11-10 17:23:08 +0200 | [diff] [blame] | 452 | INTEL_GLK_IDS(&intel_geminilake_info), |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 453 | INTEL_KBL_GT1_IDS(&intel_kabylake_info), |
| 454 | INTEL_KBL_GT2_IDS(&intel_kabylake_info), |
| 455 | INTEL_KBL_GT3_IDS(&intel_kabylake_gt3_info), |
| 456 | INTEL_KBL_GT4_IDS(&intel_kabylake_gt3_info), |
| 457 | {0, 0, 0} |
| 458 | }; |
| 459 | MODULE_DEVICE_TABLE(pci, pciidlist); |
| 460 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 461 | static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 462 | { |
| 463 | struct intel_device_info *intel_info = |
| 464 | (struct intel_device_info *) ent->driver_data; |
| 465 | |
Jani Nikula | c007fb4 | 2016-10-31 12:18:28 +0200 | [diff] [blame] | 466 | if (IS_ALPHA_SUPPORT(intel_info) && !i915.alpha_support) { |
| 467 | DRM_INFO("The driver support for your hardware in this kernel version is alpha quality\n" |
| 468 | "See CONFIG_DRM_I915_ALPHA_SUPPORT or i915.alpha_support module parameter\n" |
| 469 | "to enable support in this kernel version, or check for kernel updates.\n"); |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 470 | return -ENODEV; |
| 471 | } |
| 472 | |
| 473 | /* Only bind to function 0 of the device. Early generations |
| 474 | * used function 1 as a placeholder for multi-head. This causes |
| 475 | * us confusion instead, especially on the systems where both |
| 476 | * functions have the same PCI-ID! |
| 477 | */ |
| 478 | if (PCI_FUNC(pdev->devfn)) |
| 479 | return -ENODEV; |
| 480 | |
| 481 | /* |
| 482 | * apple-gmux is needed on dual GPU MacBook Pro |
| 483 | * to probe the panel if we're the inactive GPU. |
| 484 | */ |
| 485 | if (vga_switcheroo_client_probe_defer(pdev)) |
| 486 | return -EPROBE_DEFER; |
| 487 | |
| 488 | return i915_driver_load(pdev, ent); |
| 489 | } |
| 490 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 491 | static void i915_pci_remove(struct pci_dev *pdev) |
| 492 | { |
| 493 | struct drm_device *dev = pci_get_drvdata(pdev); |
| 494 | |
| 495 | i915_driver_unload(dev); |
| 496 | drm_dev_unref(dev); |
| 497 | } |
| 498 | |
Chris Wilson | a09d0ba | 2016-06-24 14:00:27 +0100 | [diff] [blame] | 499 | static struct pci_driver i915_pci_driver = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 500 | .name = DRIVER_NAME, |
| 501 | .id_table = pciidlist, |
| 502 | .probe = i915_pci_probe, |
| 503 | .remove = i915_pci_remove, |
| 504 | .driver.pm = &i915_pm_ops, |
| 505 | }; |
Chris Wilson | a09d0ba | 2016-06-24 14:00:27 +0100 | [diff] [blame] | 506 | |
| 507 | static int __init i915_init(void) |
| 508 | { |
| 509 | bool use_kms = true; |
| 510 | |
| 511 | /* |
| 512 | * Enable KMS by default, unless explicitly overriden by |
| 513 | * either the i915.modeset prarameter or by the |
| 514 | * vga_text_mode_force boot option. |
| 515 | */ |
| 516 | |
| 517 | if (i915.modeset == 0) |
| 518 | use_kms = false; |
| 519 | |
| 520 | if (vgacon_text_force() && i915.modeset == -1) |
| 521 | use_kms = false; |
| 522 | |
| 523 | if (!use_kms) { |
| 524 | /* Silently fail loading to not upset userspace. */ |
| 525 | DRM_DEBUG_DRIVER("KMS disabled.\n"); |
| 526 | return 0; |
| 527 | } |
| 528 | |
| 529 | return pci_register_driver(&i915_pci_driver); |
| 530 | } |
| 531 | |
| 532 | static void __exit i915_exit(void) |
| 533 | { |
| 534 | if (!i915_pci_driver.driver.owner) |
| 535 | return; |
| 536 | |
| 537 | pci_unregister_driver(&i915_pci_driver); |
| 538 | } |
| 539 | |
| 540 | module_init(i915_init); |
| 541 | module_exit(i915_exit); |
| 542 | |
| 543 | MODULE_AUTHOR("Tungsten Graphics, Inc."); |
| 544 | MODULE_AUTHOR("Intel Corporation"); |
| 545 | |
| 546 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 547 | MODULE_LICENSE("GPL and additional rights"); |