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