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, \ |
Carlos Santa | 07db6be | 2016-08-17 12:30:38 -0700 | [diff] [blame] | 207 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 208 | CURSOR_OFFSETS |
| 209 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 210 | static const struct intel_device_info intel_sandybridge_d_info = { |
Carlos Santa | 07db6be | 2016-08-17 12:30:38 -0700 | [diff] [blame] | 211 | GEN6_FEATURES, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 212 | }; |
| 213 | |
| 214 | static const struct intel_device_info intel_sandybridge_m_info = { |
Carlos Santa | 07db6be | 2016-08-17 12:30:38 -0700 | [diff] [blame] | 215 | GEN6_FEATURES, |
| 216 | .is_mobile = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 217 | }; |
| 218 | |
| 219 | #define GEN7_FEATURES \ |
| 220 | .gen = 7, .num_pipes = 3, \ |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 221 | .has_hotplug = 1, \ |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 222 | .has_fbc = 1, \ |
| 223 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \ |
| 224 | .has_llc = 1, \ |
Carlos Santa | 86f3624 | 2016-08-17 12:30:44 -0700 | [diff] [blame] | 225 | .has_rc6 = 1, \ |
Carlos Santa | 33b5bf8 | 2016-08-17 12:30:45 -0700 | [diff] [blame] | 226 | .has_rc6p = 1, \ |
Carlos Santa | b355f10 | 2016-08-17 12:30:48 -0700 | [diff] [blame] | 227 | .has_gmbus_irq = 1, \ |
Carlos Santa | e1a52536 | 2016-08-17 12:30:52 -0700 | [diff] [blame] | 228 | .has_hw_contexts = 1, \ |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 229 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 230 | IVB_CURSOR_OFFSETS |
| 231 | |
| 232 | static const struct intel_device_info intel_ivybridge_d_info = { |
| 233 | GEN7_FEATURES, |
| 234 | .is_ivybridge = 1, |
Carlos Santa | ca9c452 | 2016-08-17 12:30:54 -0700 | [diff] [blame] | 235 | .has_l3_dpf = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 236 | }; |
| 237 | |
| 238 | static const struct intel_device_info intel_ivybridge_m_info = { |
| 239 | GEN7_FEATURES, |
| 240 | .is_ivybridge = 1, |
| 241 | .is_mobile = 1, |
Carlos Santa | ca9c452 | 2016-08-17 12:30:54 -0700 | [diff] [blame] | 242 | .has_l3_dpf = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 243 | }; |
| 244 | |
| 245 | static const struct intel_device_info intel_ivybridge_q_info = { |
| 246 | GEN7_FEATURES, |
| 247 | .is_ivybridge = 1, |
| 248 | .num_pipes = 0, /* legal, last one wins */ |
Carlos Santa | ca9c452 | 2016-08-17 12:30:54 -0700 | [diff] [blame] | 249 | .has_l3_dpf = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 250 | }; |
| 251 | |
| 252 | #define VLV_FEATURES \ |
| 253 | .gen = 7, .num_pipes = 2, \ |
Carlos Santa | 6e3b84d | 2016-08-17 12:30:36 -0700 | [diff] [blame] | 254 | .has_psr = 1, \ |
Carlos Santa | 4aa4c23 | 2016-08-17 12:30:39 -0700 | [diff] [blame] | 255 | .has_runtime_pm = 1, \ |
Carlos Santa | 86f3624 | 2016-08-17 12:30:44 -0700 | [diff] [blame] | 256 | .has_rc6 = 1, \ |
Carlos Santa | b355f10 | 2016-08-17 12:30:48 -0700 | [diff] [blame] | 257 | .has_gmbus_irq = 1, \ |
Carlos Santa | e1a52536 | 2016-08-17 12:30:52 -0700 | [diff] [blame] | 258 | .has_hw_contexts = 1, \ |
Carlos Santa | 804b871 | 2016-08-17 12:30:55 -0700 | [diff] [blame] | 259 | .has_gmch_display = 1, \ |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 260 | .has_hotplug = 1, \ |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 261 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \ |
| 262 | .display_mmio_offset = VLV_DISPLAY_BASE, \ |
| 263 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 264 | CURSOR_OFFSETS |
| 265 | |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 266 | static const struct intel_device_info intel_valleyview_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 267 | VLV_FEATURES, |
| 268 | .is_valleyview = 1, |
| 269 | }; |
| 270 | |
| 271 | #define HSW_FEATURES \ |
| 272 | GEN7_FEATURES, \ |
| 273 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \ |
| 274 | .has_ddi = 1, \ |
Carlos Santa | 6e3b84d | 2016-08-17 12:30:36 -0700 | [diff] [blame] | 275 | .has_fpga_dbg = 1, \ |
Carlos Santa | 4aa4c23 | 2016-08-17 12:30:39 -0700 | [diff] [blame] | 276 | .has_psr = 1, \ |
Carlos Santa | 53233f0 | 2016-08-17 12:30:43 -0700 | [diff] [blame] | 277 | .has_resource_streamer = 1, \ |
Carlos Santa | 1d3fe53 | 2016-08-17 12:30:46 -0700 | [diff] [blame] | 278 | .has_dp_mst = 1, \ |
Carlos Santa | 33b5bf8 | 2016-08-17 12:30:45 -0700 | [diff] [blame] | 279 | .has_rc6p = 0 /* RC6p removed-by HSW */, \ |
Carlos Santa | 4aa4c23 | 2016-08-17 12:30:39 -0700 | [diff] [blame] | 280 | .has_runtime_pm = 1 |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 281 | |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 282 | static const struct intel_device_info intel_haswell_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 283 | HSW_FEATURES, |
| 284 | .is_haswell = 1, |
Carlos Santa | ca9c452 | 2016-08-17 12:30:54 -0700 | [diff] [blame] | 285 | .has_l3_dpf = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 286 | }; |
| 287 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 288 | #define BDW_FEATURES \ |
| 289 | HSW_FEATURES, \ |
Carlos Santa | 4586f1d | 2016-08-17 12:30:53 -0700 | [diff] [blame] | 290 | BDW_COLORS, \ |
Joonas Lahtinen | dfc5148 | 2016-11-03 10:39:46 +0200 | [diff] [blame] | 291 | .has_logical_ring_contexts = 1, \ |
| 292 | .has_64bit_reloc = 1 |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 293 | |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 294 | static const struct intel_device_info intel_broadwell_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 295 | BDW_FEATURES, |
| 296 | .gen = 8, |
| 297 | .is_broadwell = 1, |
| 298 | }; |
| 299 | |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 300 | static const struct intel_device_info intel_broadwell_gt3_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 301 | BDW_FEATURES, |
| 302 | .gen = 8, |
| 303 | .is_broadwell = 1, |
| 304 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, |
| 305 | }; |
| 306 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 307 | static const struct intel_device_info intel_cherryview_info = { |
| 308 | .gen = 8, .num_pipes = 3, |
Carlos Santa | 3177659 | 2016-08-17 12:30:56 -0700 | [diff] [blame] | 309 | .has_hotplug = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 310 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, |
| 311 | .is_cherryview = 1, |
Joonas Lahtinen | dfc5148 | 2016-11-03 10:39:46 +0200 | [diff] [blame] | 312 | .has_64bit_reloc = 1, |
Carlos Santa | 6e3b84d | 2016-08-17 12:30:36 -0700 | [diff] [blame] | 313 | .has_psr = 1, |
Carlos Santa | 4aa4c23 | 2016-08-17 12:30:39 -0700 | [diff] [blame] | 314 | .has_runtime_pm = 1, |
Carlos Santa | 53233f0 | 2016-08-17 12:30:43 -0700 | [diff] [blame] | 315 | .has_resource_streamer = 1, |
Carlos Santa | 86f3624 | 2016-08-17 12:30:44 -0700 | [diff] [blame] | 316 | .has_rc6 = 1, |
Carlos Santa | b355f10 | 2016-08-17 12:30:48 -0700 | [diff] [blame] | 317 | .has_gmbus_irq = 1, |
Carlos Santa | e1a52536 | 2016-08-17 12:30:52 -0700 | [diff] [blame] | 318 | .has_hw_contexts = 1, |
Carlos Santa | 4586f1d | 2016-08-17 12:30:53 -0700 | [diff] [blame] | 319 | .has_logical_ring_contexts = 1, |
Carlos Santa | 804b871 | 2016-08-17 12:30:55 -0700 | [diff] [blame] | 320 | .has_gmch_display = 1, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 321 | .display_mmio_offset = VLV_DISPLAY_BASE, |
| 322 | GEN_CHV_PIPEOFFSETS, |
| 323 | CURSOR_OFFSETS, |
| 324 | CHV_COLORS, |
| 325 | }; |
| 326 | |
| 327 | static const struct intel_device_info intel_skylake_info = { |
| 328 | BDW_FEATURES, |
| 329 | .is_skylake = 1, |
| 330 | .gen = 9, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame] | 331 | .has_csr = 1, |
Carlos Santa | 3d810fb | 2016-08-17 12:30:57 -0700 | [diff] [blame] | 332 | .has_guc = 1, |
Deepak M | 6f3fff6 | 2016-09-15 15:01:10 +0530 | [diff] [blame] | 333 | .ddb_size = 896, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 334 | }; |
| 335 | |
| 336 | static const struct intel_device_info intel_skylake_gt3_info = { |
| 337 | BDW_FEATURES, |
| 338 | .is_skylake = 1, |
| 339 | .gen = 9, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame] | 340 | .has_csr = 1, |
Carlos Santa | 3d810fb | 2016-08-17 12:30:57 -0700 | [diff] [blame] | 341 | .has_guc = 1, |
Deepak M | 6f3fff6 | 2016-09-15 15:01:10 +0530 | [diff] [blame] | 342 | .ddb_size = 896, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 343 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, |
| 344 | }; |
| 345 | |
Rodrigo Vivi | 80fa66b | 2016-12-01 11:33:16 +0200 | [diff] [blame] | 346 | #define GEN9_LP_FEATURES \ |
| 347 | .gen = 9, \ |
Ander Conselvan de Oliveira | 3e4274f | 2016-11-10 17:23:09 +0200 | [diff] [blame^] | 348 | .is_lp = 1, \ |
Rodrigo Vivi | 80fa66b | 2016-12-01 11:33:16 +0200 | [diff] [blame] | 349 | .has_hotplug = 1, \ |
| 350 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \ |
| 351 | .num_pipes = 3, \ |
| 352 | .has_64bit_reloc = 1, \ |
| 353 | .has_ddi = 1, \ |
| 354 | .has_fpga_dbg = 1, \ |
| 355 | .has_fbc = 1, \ |
| 356 | .has_runtime_pm = 1, \ |
| 357 | .has_pooled_eu = 0, \ |
| 358 | .has_csr = 1, \ |
| 359 | .has_resource_streamer = 1, \ |
| 360 | .has_rc6 = 1, \ |
| 361 | .has_dp_mst = 1, \ |
| 362 | .has_gmbus_irq = 1, \ |
| 363 | .has_hw_contexts = 1, \ |
| 364 | .has_logical_ring_contexts = 1, \ |
| 365 | .has_guc = 1, \ |
| 366 | .has_decoupled_mmio = 1, \ |
| 367 | GEN_DEFAULT_PIPEOFFSETS, \ |
| 368 | IVB_CURSOR_OFFSETS, \ |
| 369 | BDW_COLORS |
| 370 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 371 | static const struct intel_device_info intel_broxton_info = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 372 | .is_broxton = 1, |
Rodrigo Vivi | 80fa66b | 2016-12-01 11:33:16 +0200 | [diff] [blame] | 373 | GEN9_LP_FEATURES, |
Deepak M | 6f3fff6 | 2016-09-15 15:01:10 +0530 | [diff] [blame] | 374 | .ddb_size = 512, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 375 | }; |
| 376 | |
Ander Conselvan de Oliveira | c22097f | 2016-11-14 16:25:26 +0200 | [diff] [blame] | 377 | static const struct intel_device_info intel_geminilake_info = { |
| 378 | .is_alpha_support = 1, |
| 379 | .is_geminilake = 1, |
| 380 | GEN9_LP_FEATURES, |
| 381 | .ddb_size = 1024, |
| 382 | }; |
| 383 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 384 | static const struct intel_device_info intel_kabylake_info = { |
| 385 | BDW_FEATURES, |
| 386 | .is_kabylake = 1, |
| 387 | .gen = 9, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame] | 388 | .has_csr = 1, |
Carlos Santa | 3d810fb | 2016-08-17 12:30:57 -0700 | [diff] [blame] | 389 | .has_guc = 1, |
Deepak M | 6f3fff6 | 2016-09-15 15:01:10 +0530 | [diff] [blame] | 390 | .ddb_size = 896, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 391 | }; |
| 392 | |
| 393 | static const struct intel_device_info intel_kabylake_gt3_info = { |
| 394 | BDW_FEATURES, |
| 395 | .is_kabylake = 1, |
| 396 | .gen = 9, |
Carlos Santa | 3bacde1 | 2016-08-17 12:30:42 -0700 | [diff] [blame] | 397 | .has_csr = 1, |
Carlos Santa | 3d810fb | 2016-08-17 12:30:57 -0700 | [diff] [blame] | 398 | .has_guc = 1, |
Deepak M | 6f3fff6 | 2016-09-15 15:01:10 +0530 | [diff] [blame] | 399 | .ddb_size = 896, |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 400 | .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, |
| 401 | }; |
| 402 | |
| 403 | /* |
| 404 | * Make sure any device matches here are from most specific to most |
| 405 | * general. For example, since the Quanta match is based on the subsystem |
| 406 | * and subvendor IDs, we need it to come before the more general IVB |
| 407 | * PCI ID matches, otherwise we'll use the wrong info struct above. |
| 408 | */ |
| 409 | static const struct pci_device_id pciidlist[] = { |
| 410 | INTEL_I830_IDS(&intel_i830_info), |
| 411 | INTEL_I845G_IDS(&intel_845g_info), |
| 412 | INTEL_I85X_IDS(&intel_i85x_info), |
| 413 | INTEL_I865G_IDS(&intel_i865g_info), |
| 414 | INTEL_I915G_IDS(&intel_i915g_info), |
| 415 | INTEL_I915GM_IDS(&intel_i915gm_info), |
| 416 | INTEL_I945G_IDS(&intel_i945g_info), |
| 417 | INTEL_I945GM_IDS(&intel_i945gm_info), |
| 418 | INTEL_I965G_IDS(&intel_i965g_info), |
| 419 | INTEL_G33_IDS(&intel_g33_info), |
| 420 | INTEL_I965GM_IDS(&intel_i965gm_info), |
| 421 | INTEL_GM45_IDS(&intel_gm45_info), |
| 422 | INTEL_G45_IDS(&intel_g45_info), |
| 423 | INTEL_PINEVIEW_IDS(&intel_pineview_info), |
| 424 | INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info), |
| 425 | INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info), |
| 426 | INTEL_SNB_D_IDS(&intel_sandybridge_d_info), |
| 427 | INTEL_SNB_M_IDS(&intel_sandybridge_m_info), |
| 428 | INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */ |
| 429 | INTEL_IVB_M_IDS(&intel_ivybridge_m_info), |
| 430 | INTEL_IVB_D_IDS(&intel_ivybridge_d_info), |
Carlos Santa | 8d9c20e | 2016-08-17 12:30:37 -0700 | [diff] [blame] | 431 | INTEL_HSW_IDS(&intel_haswell_info), |
| 432 | INTEL_VLV_IDS(&intel_valleyview_info), |
| 433 | INTEL_BDW_GT12_IDS(&intel_broadwell_info), |
| 434 | INTEL_BDW_GT3_IDS(&intel_broadwell_gt3_info), |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 435 | INTEL_CHV_IDS(&intel_cherryview_info), |
| 436 | INTEL_SKL_GT1_IDS(&intel_skylake_info), |
| 437 | INTEL_SKL_GT2_IDS(&intel_skylake_info), |
| 438 | INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info), |
| 439 | INTEL_SKL_GT4_IDS(&intel_skylake_gt3_info), |
| 440 | INTEL_BXT_IDS(&intel_broxton_info), |
Ander Conselvan de Oliveira | 8363e3c | 2016-11-10 17:23:08 +0200 | [diff] [blame] | 441 | INTEL_GLK_IDS(&intel_geminilake_info), |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 442 | INTEL_KBL_GT1_IDS(&intel_kabylake_info), |
| 443 | INTEL_KBL_GT2_IDS(&intel_kabylake_info), |
| 444 | INTEL_KBL_GT3_IDS(&intel_kabylake_gt3_info), |
| 445 | INTEL_KBL_GT4_IDS(&intel_kabylake_gt3_info), |
| 446 | {0, 0, 0} |
| 447 | }; |
| 448 | MODULE_DEVICE_TABLE(pci, pciidlist); |
| 449 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 450 | static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
| 451 | { |
| 452 | struct intel_device_info *intel_info = |
| 453 | (struct intel_device_info *) ent->driver_data; |
| 454 | |
Jani Nikula | c007fb4 | 2016-10-31 12:18:28 +0200 | [diff] [blame] | 455 | if (IS_ALPHA_SUPPORT(intel_info) && !i915.alpha_support) { |
| 456 | DRM_INFO("The driver support for your hardware in this kernel version is alpha quality\n" |
| 457 | "See CONFIG_DRM_I915_ALPHA_SUPPORT or i915.alpha_support module parameter\n" |
| 458 | "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] | 459 | return -ENODEV; |
| 460 | } |
| 461 | |
| 462 | /* Only bind to function 0 of the device. Early generations |
| 463 | * used function 1 as a placeholder for multi-head. This causes |
| 464 | * us confusion instead, especially on the systems where both |
| 465 | * functions have the same PCI-ID! |
| 466 | */ |
| 467 | if (PCI_FUNC(pdev->devfn)) |
| 468 | return -ENODEV; |
| 469 | |
| 470 | /* |
| 471 | * apple-gmux is needed on dual GPU MacBook Pro |
| 472 | * to probe the panel if we're the inactive GPU. |
| 473 | */ |
| 474 | if (vga_switcheroo_client_probe_defer(pdev)) |
| 475 | return -EPROBE_DEFER; |
| 476 | |
| 477 | return i915_driver_load(pdev, ent); |
| 478 | } |
| 479 | |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 480 | static void i915_pci_remove(struct pci_dev *pdev) |
| 481 | { |
| 482 | struct drm_device *dev = pci_get_drvdata(pdev); |
| 483 | |
| 484 | i915_driver_unload(dev); |
| 485 | drm_dev_unref(dev); |
| 486 | } |
| 487 | |
Chris Wilson | a09d0ba | 2016-06-24 14:00:27 +0100 | [diff] [blame] | 488 | static struct pci_driver i915_pci_driver = { |
Chris Wilson | 42f5551 | 2016-06-24 14:00:26 +0100 | [diff] [blame] | 489 | .name = DRIVER_NAME, |
| 490 | .id_table = pciidlist, |
| 491 | .probe = i915_pci_probe, |
| 492 | .remove = i915_pci_remove, |
| 493 | .driver.pm = &i915_pm_ops, |
| 494 | }; |
Chris Wilson | a09d0ba | 2016-06-24 14:00:27 +0100 | [diff] [blame] | 495 | |
| 496 | static int __init i915_init(void) |
| 497 | { |
| 498 | bool use_kms = true; |
| 499 | |
| 500 | /* |
| 501 | * Enable KMS by default, unless explicitly overriden by |
| 502 | * either the i915.modeset prarameter or by the |
| 503 | * vga_text_mode_force boot option. |
| 504 | */ |
| 505 | |
| 506 | if (i915.modeset == 0) |
| 507 | use_kms = false; |
| 508 | |
| 509 | if (vgacon_text_force() && i915.modeset == -1) |
| 510 | use_kms = false; |
| 511 | |
| 512 | if (!use_kms) { |
| 513 | /* Silently fail loading to not upset userspace. */ |
| 514 | DRM_DEBUG_DRIVER("KMS disabled.\n"); |
| 515 | return 0; |
| 516 | } |
| 517 | |
| 518 | return pci_register_driver(&i915_pci_driver); |
| 519 | } |
| 520 | |
| 521 | static void __exit i915_exit(void) |
| 522 | { |
| 523 | if (!i915_pci_driver.driver.owner) |
| 524 | return; |
| 525 | |
| 526 | pci_unregister_driver(&i915_pci_driver); |
| 527 | } |
| 528 | |
| 529 | module_init(i915_init); |
| 530 | module_exit(i915_exit); |
| 531 | |
| 532 | MODULE_AUTHOR("Tungsten Graphics, Inc."); |
| 533 | MODULE_AUTHOR("Intel Corporation"); |
| 534 | |
| 535 | MODULE_DESCRIPTION(DRIVER_DESC); |
| 536 | MODULE_LICENSE("GPL and additional rights"); |