Rev 3746 | Rev 4126 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3746 | Rev 4104 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | 45 | ||
Line 46... | Line 46... | ||
46 | #define __read_mostly |
46 | #define __read_mostly |
Line 47... | Line -... | ||
47 | - | ||
48 | int init_display_kms(struct drm_device *dev); |
- | |
49 | - | ||
50 | struct drm_device *main_device; |
- | |
51 | 47 | ||
52 | struct drm_file *drm_file_handlers[256]; |
48 | int init_display_kms(struct drm_device *dev); |
53 | 49 | ||
54 | static int i915_modeset __read_mostly = 1; |
50 | static int i915_modeset __read_mostly = 1; |
55 | module_param_named(modeset, i915_modeset, int, 0400); |
51 | module_param_named(modeset, i915_modeset, int, 0400); |
Line 129... | Line 125... | ||
129 | int i915_enable_ppgtt __read_mostly = 0; |
125 | int i915_enable_ppgtt __read_mostly = 0; |
130 | module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600); |
126 | module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600); |
131 | MODULE_PARM_DESC(i915_enable_ppgtt, |
127 | MODULE_PARM_DESC(i915_enable_ppgtt, |
132 | "Enable PPGTT (default: true)"); |
128 | "Enable PPGTT (default: true)"); |
Line 133... | Line 129... | ||
133 | 129 | ||
- | 130 | int i915_enable_psr __read_mostly = 0; |
|
- | 131 | module_param_named(enable_psr, i915_enable_psr, int, 0600); |
|
- | 132 | MODULE_PARM_DESC(enable_psr, "Enable PSR (default: false)"); |
|
- | 133 | ||
134 | unsigned int i915_preliminary_hw_support __read_mostly = true; |
134 | unsigned int i915_preliminary_hw_support __read_mostly = IS_ENABLED(CONFIG_DRM_I915_PRELIMINARY_HW_SUPPORT); |
135 | module_param_named(preliminary_hw_support, i915_preliminary_hw_support, int, 0600); |
135 | module_param_named(preliminary_hw_support, i915_preliminary_hw_support, int, 0600); |
136 | MODULE_PARM_DESC(preliminary_hw_support, |
136 | MODULE_PARM_DESC(preliminary_hw_support, |
Line 137... | Line 137... | ||
137 | "Enable preliminary hardware support. (default: false)"); |
137 | "Enable preliminary hardware support."); |
138 | 138 | ||
139 | int i915_disable_power_well __read_mostly = 0; |
139 | int i915_disable_power_well __read_mostly = 0; |
140 | module_param_named(disable_power_well, i915_disable_power_well, int, 0600); |
140 | module_param_named(disable_power_well, i915_disable_power_well, int, 0600); |
- | 141 | MODULE_PARM_DESC(disable_power_well, |
|
- | 142 | "Disable the power well when possible (default: true)"); |
|
- | 143 | ||
- | 144 | int i915_enable_ips __read_mostly = 1; |
|
- | 145 | module_param_named(enable_ips, i915_enable_ips, int, 0600); |
|
- | 146 | MODULE_PARM_DESC(enable_ips, "Enable IPS (default: true)"); |
|
- | 147 | ||
- | 148 | bool i915_fastboot __read_mostly = 0; |
|
- | 149 | module_param_named(fastboot, i915_fastboot, bool, 0600); |
|
- | 150 | MODULE_PARM_DESC(fastboot, "Try to skip unnecessary mode sets at boot time " |
|
- | 151 | "(default: false)"); |
|
- | 152 | ||
- | 153 | int i915_enable_pc8 __read_mostly = 0; |
|
- | 154 | module_param_named(enable_pc8, i915_enable_pc8, int, 0600); |
|
- | 155 | MODULE_PARM_DESC(enable_pc8, "Enable support for low power package C states (PC8+) (default: true)"); |
|
- | 156 | ||
- | 157 | int i915_pc8_timeout __read_mostly = 5000; |
|
- | 158 | module_param_named(pc8_timeout, i915_pc8_timeout, int, 0600); |
|
- | 159 | MODULE_PARM_DESC(pc8_timeout, "Number of msecs of idleness required to enter PC8+ (default: 5000)"); |
|
- | 160 | ||
- | 161 | bool i915_prefault_disable __read_mostly; |
|
- | 162 | module_param_named(prefault_disable, i915_prefault_disable, bool, 0600); |
|
- | 163 | MODULE_PARM_DESC(prefault_disable, |
|
- | 164 | "Disable page prefaulting for pread/pwrite/reloc (default:false). For developers only."); |
|
- | 165 | ||
Line 141... | Line 166... | ||
141 | MODULE_PARM_DESC(disable_power_well, |
166 | static struct drm_driver driver; |
Line 142... | Line -... | ||
142 | "Disable the power well when possible (default: false)"); |
- | |
143 | - | ||
144 | #define PCI_VENDOR_ID_INTEL 0x8086 |
- | |
145 | - | ||
146 | #define INTEL_VGA_DEVICE(id, info) { \ |
- | |
147 | .class = PCI_BASE_CLASS_DISPLAY << 16, \ |
- | |
148 | .class_mask = 0xff0000, \ |
- | |
149 | .vendor = 0x8086, \ |
- | |
150 | .device = id, \ |
- | |
151 | .subvendor = PCI_ANY_ID, \ |
- | |
152 | .subdevice = PCI_ANY_ID, \ |
- | |
153 | .driver_data = (unsigned long) info } |
- | |
154 | - | ||
155 | #define INTEL_QUANTA_VGA_DEVICE(info) { \ |
- | |
156 | .class = PCI_BASE_CLASS_DISPLAY << 16, \ |
- | |
157 | .class_mask = 0xff0000, \ |
- | |
158 | .vendor = 0x8086, \ |
- | |
Line 159... | Line 167... | ||
159 | .device = 0x16a, \ |
167 | extern int intel_agp_enabled; |
160 | .subvendor = 0x152d, \ |
168 | |
161 | .subdevice = 0x8990, \ |
169 | #define PCI_VENDOR_ID_INTEL 0x8086 |
162 | .driver_data = (unsigned long) info } |
170 | |
Line 268... | Line 276... | ||
268 | 276 | ||
269 | static const struct intel_device_info intel_ivybridge_m_info = { |
277 | static const struct intel_device_info intel_ivybridge_m_info = { |
270 | GEN7_FEATURES, |
278 | GEN7_FEATURES, |
271 | .is_ivybridge = 1, |
279 | .is_ivybridge = 1, |
- | 280 | .is_mobile = 1, |
|
272 | .is_mobile = 1, |
281 | .has_fbc = 1, |
Line 273... | Line 282... | ||
273 | }; |
282 | }; |
274 | 283 | ||
275 | static const struct intel_device_info intel_ivybridge_q_info = { |
284 | static const struct intel_device_info intel_ivybridge_q_info = { |
Line 296... | Line 305... | ||
296 | }; |
305 | }; |
Line 297... | Line 306... | ||
297 | 306 | ||
298 | static const struct intel_device_info intel_haswell_d_info = { |
307 | static const struct intel_device_info intel_haswell_d_info = { |
299 | GEN7_FEATURES, |
308 | GEN7_FEATURES, |
- | 309 | .is_haswell = 1, |
|
- | 310 | .has_ddi = 1, |
|
- | 311 | .has_fpga_dbg = 1, |
|
300 | .is_haswell = 1, |
312 | .has_vebox_ring = 1, |
Line 301... | Line 313... | ||
301 | }; |
313 | }; |
302 | 314 | ||
303 | static const struct intel_device_info intel_haswell_m_info = { |
315 | static const struct intel_device_info intel_haswell_m_info = { |
304 | GEN7_FEATURES, |
316 | GEN7_FEATURES, |
- | 317 | .is_haswell = 1, |
|
- | 318 | .is_mobile = 1, |
|
- | 319 | .has_ddi = 1, |
|
- | 320 | .has_fpga_dbg = 1, |
|
305 | .is_haswell = 1, |
321 | .has_fbc = 1, |
Line -... | Line 322... | ||
- | 322 | .has_vebox_ring = 1, |
|
- | 323 | }; |
|
- | 324 | ||
- | 325 | /* |
|
- | 326 | * Make sure any device matches here are from most specific to most |
|
- | 327 | * general. For example, since the Quanta match is based on the subsystem |
|
- | 328 | * and subvendor IDs, we need it to come before the more general IVB |
|
- | 329 | * PCI ID matches, otherwise we'll use the wrong info struct above. |
|
- | 330 | */ |
|
- | 331 | #define INTEL_PCI_IDS \ |
|
- | 332 | INTEL_I915G_IDS(&intel_i915g_info), \ |
|
- | 333 | INTEL_I915GM_IDS(&intel_i915gm_info), \ |
|
- | 334 | INTEL_I945G_IDS(&intel_i945g_info), \ |
|
- | 335 | INTEL_I945GM_IDS(&intel_i945gm_info), \ |
|
- | 336 | INTEL_I965G_IDS(&intel_i965g_info), \ |
|
- | 337 | INTEL_G33_IDS(&intel_g33_info), \ |
|
- | 338 | INTEL_I965GM_IDS(&intel_i965gm_info), \ |
|
- | 339 | INTEL_GM45_IDS(&intel_gm45_info), \ |
|
- | 340 | INTEL_G45_IDS(&intel_g45_info), \ |
|
- | 341 | INTEL_PINEVIEW_IDS(&intel_pineview_info), \ |
|
- | 342 | INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info), \ |
|
- | 343 | INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info), \ |
|
- | 344 | INTEL_SNB_D_IDS(&intel_sandybridge_d_info), \ |
|
- | 345 | INTEL_SNB_M_IDS(&intel_sandybridge_m_info), \ |
|
- | 346 | INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */ \ |
|
- | 347 | INTEL_IVB_M_IDS(&intel_ivybridge_m_info), \ |
|
- | 348 | INTEL_IVB_D_IDS(&intel_ivybridge_d_info), \ |
|
- | 349 | INTEL_HSW_D_IDS(&intel_haswell_d_info), \ |
|
- | 350 | INTEL_HSW_M_IDS(&intel_haswell_m_info), \ |
|
306 | .is_mobile = 1, |
351 | INTEL_VLV_M_IDS(&intel_valleyview_m_info), \ |
307 | }; |
- | |
308 | - | ||
309 | static const struct pci_device_id pciidlist[] = { /* aka */ |
- | |
310 | INTEL_VGA_DEVICE(0x2582, &intel_i915g_info), /* I915_G */ |
- | |
311 | INTEL_VGA_DEVICE(0x258a, &intel_i915g_info), /* E7221_G */ |
- | |
312 | INTEL_VGA_DEVICE(0x2592, &intel_i915gm_info), /* I915_GM */ |
- | |
313 | INTEL_VGA_DEVICE(0x2772, &intel_i945g_info), /* I945_G */ |
- | |
314 | INTEL_VGA_DEVICE(0x27a2, &intel_i945gm_info), /* I945_GM */ |
- | |
315 | INTEL_VGA_DEVICE(0x27ae, &intel_i945gm_info), /* I945_GME */ |
- | |
316 | INTEL_VGA_DEVICE(0x2972, &intel_i965g_info), /* I946_GZ */ |
- | |
317 | INTEL_VGA_DEVICE(0x2982, &intel_i965g_info), /* G35_G */ |
- | |
318 | INTEL_VGA_DEVICE(0x2992, &intel_i965g_info), /* I965_Q */ |
- | |
319 | INTEL_VGA_DEVICE(0x29a2, &intel_i965g_info), /* I965_G */ |
- | |
320 | INTEL_VGA_DEVICE(0x29b2, &intel_g33_info), /* Q35_G */ |
- | |
321 | INTEL_VGA_DEVICE(0x29c2, &intel_g33_info), /* G33_G */ |
- | |
322 | INTEL_VGA_DEVICE(0x29d2, &intel_g33_info), /* Q33_G */ |
- | |
323 | INTEL_VGA_DEVICE(0x2a02, &intel_i965gm_info), /* I965_GM */ |
- | |
324 | INTEL_VGA_DEVICE(0x2a12, &intel_i965gm_info), /* I965_GME */ |
- | |
325 | INTEL_VGA_DEVICE(0x2a42, &intel_gm45_info), /* GM45_G */ |
- | |
326 | INTEL_VGA_DEVICE(0x2e02, &intel_g45_info), /* IGD_E_G */ |
- | |
327 | INTEL_VGA_DEVICE(0x2e12, &intel_g45_info), /* Q45_G */ |
- | |
328 | INTEL_VGA_DEVICE(0x2e22, &intel_g45_info), /* G45_G */ |
- | |
329 | INTEL_VGA_DEVICE(0x2e32, &intel_g45_info), /* G41_G */ |
- | |
330 | INTEL_VGA_DEVICE(0x2e42, &intel_g45_info), /* B43_G */ |
352 | INTEL_VLV_D_IDS(&intel_valleyview_d_info) |
331 | INTEL_VGA_DEVICE(0x2e92, &intel_g45_info), /* B43_G.1 */ |
- | |
332 | INTEL_VGA_DEVICE(0xa001, &intel_pineview_info), |
- | |
333 | INTEL_VGA_DEVICE(0xa011, &intel_pineview_info), |
- | |
334 | INTEL_VGA_DEVICE(0x0042, &intel_ironlake_d_info), |
- | |
335 | INTEL_VGA_DEVICE(0x0046, &intel_ironlake_m_info), |
- | |
336 | INTEL_VGA_DEVICE(0x0102, &intel_sandybridge_d_info), |
- | |
337 | INTEL_VGA_DEVICE(0x0112, &intel_sandybridge_d_info), |
- | |
338 | INTEL_VGA_DEVICE(0x0122, &intel_sandybridge_d_info), |
- | |
339 | INTEL_VGA_DEVICE(0x0106, &intel_sandybridge_m_info), |
- | |
340 | INTEL_VGA_DEVICE(0x0116, &intel_sandybridge_m_info), |
- | |
341 | INTEL_VGA_DEVICE(0x0126, &intel_sandybridge_m_info), |
- | |
342 | INTEL_VGA_DEVICE(0x010A, &intel_sandybridge_d_info), |
- | |
343 | INTEL_VGA_DEVICE(0x0156, &intel_ivybridge_m_info), /* GT1 mobile */ |
- | |
344 | INTEL_VGA_DEVICE(0x0166, &intel_ivybridge_m_info), /* GT2 mobile */ |
- | |
345 | INTEL_VGA_DEVICE(0x0152, &intel_ivybridge_d_info), /* GT1 desktop */ |
- | |
346 | INTEL_VGA_DEVICE(0x0162, &intel_ivybridge_d_info), /* GT2 desktop */ |
- | |
347 | INTEL_VGA_DEVICE(0x015a, &intel_ivybridge_d_info), /* GT1 server */ |
- | |
348 | INTEL_QUANTA_VGA_DEVICE(&intel_ivybridge_q_info), /* Quanta transcode */ |
- | |
349 | INTEL_VGA_DEVICE(0x016a, &intel_ivybridge_d_info), /* GT2 server */ |
- | |
350 | INTEL_VGA_DEVICE(0x0402, &intel_haswell_d_info), /* GT1 desktop */ |
- | |
351 | INTEL_VGA_DEVICE(0x0412, &intel_haswell_d_info), /* GT2 desktop */ |
- | |
352 | INTEL_VGA_DEVICE(0x0422, &intel_haswell_d_info), /* GT3 desktop */ |
- | |
353 | INTEL_VGA_DEVICE(0x040a, &intel_haswell_d_info), /* GT1 server */ |
- | |
354 | INTEL_VGA_DEVICE(0x041a, &intel_haswell_d_info), /* GT2 server */ |
- | |
355 | INTEL_VGA_DEVICE(0x042a, &intel_haswell_d_info), /* GT3 server */ |
- | |
356 | INTEL_VGA_DEVICE(0x0406, &intel_haswell_m_info), /* GT1 mobile */ |
- | |
357 | INTEL_VGA_DEVICE(0x0416, &intel_haswell_m_info), /* GT2 mobile */ |
- | |
358 | INTEL_VGA_DEVICE(0x0426, &intel_haswell_m_info), /* GT2 mobile */ |
- | |
359 | INTEL_VGA_DEVICE(0x040B, &intel_haswell_d_info), /* GT1 reserved */ |
- | |
360 | INTEL_VGA_DEVICE(0x041B, &intel_haswell_d_info), /* GT2 reserved */ |
- | |
361 | INTEL_VGA_DEVICE(0x042B, &intel_haswell_d_info), /* GT3 reserved */ |
- | |
362 | INTEL_VGA_DEVICE(0x040E, &intel_haswell_d_info), /* GT1 reserved */ |
- | |
363 | INTEL_VGA_DEVICE(0x041E, &intel_haswell_d_info), /* GT2 reserved */ |
- | |
364 | INTEL_VGA_DEVICE(0x042E, &intel_haswell_d_info), /* GT3 reserved */ |
- | |
365 | INTEL_VGA_DEVICE(0x0C02, &intel_haswell_d_info), /* SDV GT1 desktop */ |
- | |
366 | INTEL_VGA_DEVICE(0x0C12, &intel_haswell_d_info), /* SDV GT2 desktop */ |
- | |
367 | INTEL_VGA_DEVICE(0x0C22, &intel_haswell_d_info), /* SDV GT3 desktop */ |
- | |
368 | INTEL_VGA_DEVICE(0x0C0A, &intel_haswell_d_info), /* SDV GT1 server */ |
- | |
369 | INTEL_VGA_DEVICE(0x0C1A, &intel_haswell_d_info), /* SDV GT2 server */ |
- | |
370 | INTEL_VGA_DEVICE(0x0C2A, &intel_haswell_d_info), /* SDV GT3 server */ |
- | |
371 | INTEL_VGA_DEVICE(0x0C06, &intel_haswell_m_info), /* SDV GT1 mobile */ |
- | |
372 | INTEL_VGA_DEVICE(0x0C16, &intel_haswell_m_info), /* SDV GT2 mobile */ |
- | |
373 | INTEL_VGA_DEVICE(0x0C26, &intel_haswell_m_info), /* SDV GT3 mobile */ |
- | |
374 | INTEL_VGA_DEVICE(0x0C0B, &intel_haswell_d_info), /* SDV GT1 reserved */ |
- | |
375 | INTEL_VGA_DEVICE(0x0C1B, &intel_haswell_d_info), /* SDV GT2 reserved */ |
- | |
376 | INTEL_VGA_DEVICE(0x0C2B, &intel_haswell_d_info), /* SDV GT3 reserved */ |
- | |
377 | INTEL_VGA_DEVICE(0x0C0E, &intel_haswell_d_info), /* SDV GT1 reserved */ |
- | |
378 | INTEL_VGA_DEVICE(0x0C1E, &intel_haswell_d_info), /* SDV GT2 reserved */ |
- | |
379 | INTEL_VGA_DEVICE(0x0C2E, &intel_haswell_d_info), /* SDV GT3 reserved */ |
- | |
380 | INTEL_VGA_DEVICE(0x0A02, &intel_haswell_d_info), /* ULT GT1 desktop */ |
- | |
381 | INTEL_VGA_DEVICE(0x0A12, &intel_haswell_d_info), /* ULT GT2 desktop */ |
- | |
382 | INTEL_VGA_DEVICE(0x0A22, &intel_haswell_d_info), /* ULT GT3 desktop */ |
- | |
383 | INTEL_VGA_DEVICE(0x0A0A, &intel_haswell_d_info), /* ULT GT1 server */ |
- | |
384 | INTEL_VGA_DEVICE(0x0A1A, &intel_haswell_d_info), /* ULT GT2 server */ |
- | |
385 | INTEL_VGA_DEVICE(0x0A2A, &intel_haswell_d_info), /* ULT GT3 server */ |
- | |
386 | INTEL_VGA_DEVICE(0x0A06, &intel_haswell_m_info), /* ULT GT1 mobile */ |
- | |
387 | INTEL_VGA_DEVICE(0x0A16, &intel_haswell_m_info), /* ULT GT2 mobile */ |
- | |
388 | INTEL_VGA_DEVICE(0x0A26, &intel_haswell_m_info), /* ULT GT3 mobile */ |
- | |
389 | INTEL_VGA_DEVICE(0x0A0B, &intel_haswell_d_info), /* ULT GT1 reserved */ |
- | |
390 | INTEL_VGA_DEVICE(0x0A1B, &intel_haswell_d_info), /* ULT GT2 reserved */ |
- | |
391 | INTEL_VGA_DEVICE(0x0A2B, &intel_haswell_d_info), /* ULT GT3 reserved */ |
- | |
392 | INTEL_VGA_DEVICE(0x0A0E, &intel_haswell_m_info), /* ULT GT1 reserved */ |
- | |
393 | INTEL_VGA_DEVICE(0x0A1E, &intel_haswell_m_info), /* ULT GT2 reserved */ |
- | |
394 | INTEL_VGA_DEVICE(0x0A2E, &intel_haswell_m_info), /* ULT GT3 reserved */ |
- | |
395 | INTEL_VGA_DEVICE(0x0D02, &intel_haswell_d_info), /* CRW GT1 desktop */ |
- | |
396 | INTEL_VGA_DEVICE(0x0D12, &intel_haswell_d_info), /* CRW GT2 desktop */ |
- | |
397 | INTEL_VGA_DEVICE(0x0D22, &intel_haswell_d_info), /* CRW GT3 desktop */ |
- | |
398 | INTEL_VGA_DEVICE(0x0D0A, &intel_haswell_d_info), /* CRW GT1 server */ |
- | |
399 | INTEL_VGA_DEVICE(0x0D1A, &intel_haswell_d_info), /* CRW GT2 server */ |
- | |
400 | INTEL_VGA_DEVICE(0x0D2A, &intel_haswell_d_info), /* CRW GT3 server */ |
- | |
401 | INTEL_VGA_DEVICE(0x0D06, &intel_haswell_m_info), /* CRW GT1 mobile */ |
- | |
402 | INTEL_VGA_DEVICE(0x0D16, &intel_haswell_m_info), /* CRW GT2 mobile */ |
- | |
403 | INTEL_VGA_DEVICE(0x0D26, &intel_haswell_m_info), /* CRW GT3 mobile */ |
- | |
404 | INTEL_VGA_DEVICE(0x0D0B, &intel_haswell_d_info), /* CRW GT1 reserved */ |
- | |
405 | INTEL_VGA_DEVICE(0x0D1B, &intel_haswell_d_info), /* CRW GT2 reserved */ |
- | |
406 | INTEL_VGA_DEVICE(0x0D2B, &intel_haswell_d_info), /* CRW GT3 reserved */ |
- | |
407 | INTEL_VGA_DEVICE(0x0D0E, &intel_haswell_d_info), /* CRW GT1 reserved */ |
- | |
408 | INTEL_VGA_DEVICE(0x0D1E, &intel_haswell_d_info), /* CRW GT2 reserved */ |
- | |
409 | INTEL_VGA_DEVICE(0x0D2E, &intel_haswell_d_info), /* CRW GT3 reserved */ |
- | |
410 | INTEL_VGA_DEVICE(0x0f30, &intel_valleyview_m_info), |
- | |
411 | INTEL_VGA_DEVICE(0x0f31, &intel_valleyview_m_info), |
- | |
412 | INTEL_VGA_DEVICE(0x0f32, &intel_valleyview_m_info), |
- | |
413 | INTEL_VGA_DEVICE(0x0f33, &intel_valleyview_m_info), |
353 | |
414 | INTEL_VGA_DEVICE(0x0157, &intel_valleyview_m_info), |
354 | static const struct pci_device_id pciidlist[] = { /* aka */ |
Line 415... | Line 355... | ||
415 | INTEL_VGA_DEVICE(0x0155, &intel_valleyview_d_info), |
355 | INTEL_PCI_IDS, |
416 | {0, 0, 0} |
356 | {0, 0, 0} |
Line 430... | Line 370... | ||
430 | /* In all current cases, num_pipes is equivalent to the PCH_NOP setting |
370 | /* In all current cases, num_pipes is equivalent to the PCH_NOP setting |
431 | * (which really amounts to a PCH but no South Display). |
371 | * (which really amounts to a PCH but no South Display). |
432 | */ |
372 | */ |
433 | if (INTEL_INFO(dev)->num_pipes == 0) { |
373 | if (INTEL_INFO(dev)->num_pipes == 0) { |
434 | dev_priv->pch_type = PCH_NOP; |
374 | dev_priv->pch_type = PCH_NOP; |
435 | dev_priv->num_pch_pll = 0; |
- | |
436 | return; |
375 | return; |
437 | } |
376 | } |
Line 438... | Line 377... | ||
438 | 377 | ||
439 | /* |
378 | /* |
440 | * The reason to probe ISA bridge instead of Dev31:Fun0 is to |
379 | * The reason to probe ISA bridge instead of Dev31:Fun0 is to |
441 | * make graphics device passthrough work easy for VMM, that only |
380 | * make graphics device passthrough work easy for VMM, that only |
442 | * need to expose ISA bridge to let driver know the real hardware |
381 | * need to expose ISA bridge to let driver know the real hardware |
- | 382 | * underneath. This is a requirement from virtualization team. |
|
- | 383 | * |
|
- | 384 | * In some virtualized environments (e.g. XEN), there is irrelevant |
|
- | 385 | * ISA bridge in the system. To work reliably, we should scan trhough |
|
- | 386 | * all the ISA bridge devices and check for the first match, instead |
|
443 | * underneath. This is a requirement from virtualization team. |
387 | * of only checking the first one. |
444 | */ |
388 | */ |
445 | pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL); |
389 | pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, NULL); |
- | 390 | while (pch) { |
|
446 | if (pch) { |
391 | struct pci_dev *curr = pch; |
447 | if (pch->vendor == PCI_VENDOR_ID_INTEL) { |
392 | if (pch->vendor == PCI_VENDOR_ID_INTEL) { |
448 | unsigned short id; |
393 | unsigned short id; |
449 | id = pch->device & INTEL_PCH_DEVICE_ID_MASK; |
394 | id = pch->device & INTEL_PCH_DEVICE_ID_MASK; |
Line 450... | Line 395... | ||
450 | dev_priv->pch_id = id; |
395 | dev_priv->pch_id = id; |
451 | 396 | ||
452 | if (id == INTEL_PCH_IBX_DEVICE_ID_TYPE) { |
- | |
453 | dev_priv->pch_type = PCH_IBX; |
397 | if (id == INTEL_PCH_IBX_DEVICE_ID_TYPE) { |
454 | dev_priv->num_pch_pll = 2; |
398 | dev_priv->pch_type = PCH_IBX; |
455 | DRM_DEBUG_KMS("Found Ibex Peak PCH\n"); |
399 | DRM_DEBUG_KMS("Found Ibex Peak PCH\n"); |
456 | WARN_ON(!IS_GEN5(dev)); |
400 | WARN_ON(!IS_GEN5(dev)); |
457 | } else if (id == INTEL_PCH_CPT_DEVICE_ID_TYPE) { |
- | |
458 | dev_priv->pch_type = PCH_CPT; |
401 | } else if (id == INTEL_PCH_CPT_DEVICE_ID_TYPE) { |
459 | dev_priv->num_pch_pll = 2; |
402 | dev_priv->pch_type = PCH_CPT; |
460 | DRM_DEBUG_KMS("Found CougarPoint PCH\n"); |
403 | DRM_DEBUG_KMS("Found CougarPoint PCH\n"); |
461 | WARN_ON(!(IS_GEN6(dev) || IS_IVYBRIDGE(dev))); |
404 | WARN_ON(!(IS_GEN6(dev) || IS_IVYBRIDGE(dev))); |
462 | } else if (id == INTEL_PCH_PPT_DEVICE_ID_TYPE) { |
405 | } else if (id == INTEL_PCH_PPT_DEVICE_ID_TYPE) { |
463 | /* PantherPoint is CPT compatible */ |
- | |
464 | dev_priv->pch_type = PCH_CPT; |
406 | /* PantherPoint is CPT compatible */ |
465 | dev_priv->num_pch_pll = 2; |
407 | dev_priv->pch_type = PCH_CPT; |
466 | DRM_DEBUG_KMS("Found PatherPoint PCH\n"); |
408 | DRM_DEBUG_KMS("Found PatherPoint PCH\n"); |
467 | WARN_ON(!(IS_GEN6(dev) || IS_IVYBRIDGE(dev))); |
409 | WARN_ON(!(IS_GEN6(dev) || IS_IVYBRIDGE(dev))); |
468 | } else if (id == INTEL_PCH_LPT_DEVICE_ID_TYPE) { |
- | |
469 | dev_priv->pch_type = PCH_LPT; |
410 | } else if (id == INTEL_PCH_LPT_DEVICE_ID_TYPE) { |
470 | dev_priv->num_pch_pll = 0; |
411 | dev_priv->pch_type = PCH_LPT; |
471 | DRM_DEBUG_KMS("Found LynxPoint PCH\n"); |
412 | DRM_DEBUG_KMS("Found LynxPoint PCH\n"); |
472 | WARN_ON(!IS_HASWELL(dev)); |
413 | WARN_ON(!IS_HASWELL(dev)); |
473 | WARN_ON(IS_ULT(dev)); |
414 | WARN_ON(IS_ULT(dev)); |
474 | } else if (id == INTEL_PCH_LPT_LP_DEVICE_ID_TYPE) { |
- | |
475 | dev_priv->pch_type = PCH_LPT; |
415 | } else if (id == INTEL_PCH_LPT_LP_DEVICE_ID_TYPE) { |
476 | dev_priv->num_pch_pll = 0; |
416 | dev_priv->pch_type = PCH_LPT; |
477 | DRM_DEBUG_KMS("Found LynxPoint LP PCH\n"); |
417 | DRM_DEBUG_KMS("Found LynxPoint LP PCH\n"); |
- | 418 | WARN_ON(!IS_HASWELL(dev)); |
|
- | 419 | WARN_ON(!IS_ULT(dev)); |
|
478 | WARN_ON(!IS_HASWELL(dev)); |
420 | } else { |
479 | WARN_ON(!IS_ULT(dev)); |
421 | goto check_next; |
480 | } |
422 | } |
- | 423 | break; |
|
- | 424 | } |
|
- | 425 | check_next: |
|
481 | BUG_ON(dev_priv->num_pch_pll > I915_NUM_PLLS); |
426 | pch = pci_get_class(PCI_CLASS_BRIDGE_ISA << 8, curr); |
- | 427 | // pci_dev_put(curr); |
|
- | 428 | } |
|
482 | } |
429 | if (!pch) |
Line 483... | Line 430... | ||
483 | } |
430 | DRM_DEBUG_KMS("No PCH found?\n"); |
484 | } |
431 | } |
485 | 432 | ||
Line 498... | Line 445... | ||
498 | #endif |
445 | #endif |
Line 499... | Line 446... | ||
499 | 446 | ||
500 | return 1; |
447 | return 1; |
Line -... | Line 448... | ||
- | 448 | } |
|
- | 449 | ||
- | 450 | #if 0 |
|
- | 451 | static int i915_drm_freeze(struct drm_device *dev) |
|
- | 452 | { |
|
- | 453 | struct drm_i915_private *dev_priv = dev->dev_private; |
|
- | 454 | struct drm_crtc *crtc; |
|
- | 455 | ||
- | 456 | /* ignore lid events during suspend */ |
|
- | 457 | mutex_lock(&dev_priv->modeset_restore_lock); |
|
- | 458 | dev_priv->modeset_restore = MODESET_SUSPENDED; |
|
- | 459 | mutex_unlock(&dev_priv->modeset_restore_lock); |
|
- | 460 | ||
- | 461 | /* We do a lot of poking in a lot of registers, make sure they work |
|
- | 462 | * properly. */ |
|
- | 463 | hsw_disable_package_c8(dev_priv); |
|
- | 464 | intel_set_power_well(dev, true); |
|
- | 465 | ||
- | 466 | drm_kms_helper_poll_disable(dev); |
|
- | 467 | ||
- | 468 | pci_save_state(dev->pdev); |
|
- | 469 | ||
- | 470 | /* If KMS is active, we do the leavevt stuff here */ |
|
- | 471 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
|
- | 472 | int error; |
|
- | 473 | ||
- | 474 | mutex_lock(&dev->struct_mutex); |
|
- | 475 | error = i915_gem_idle(dev); |
|
- | 476 | mutex_unlock(&dev->struct_mutex); |
|
- | 477 | if (error) { |
|
- | 478 | dev_err(&dev->pdev->dev, |
|
- | 479 | "GEM idle failed, resume might fail\n"); |
|
- | 480 | return error; |
|
- | 481 | } |
|
Line -... | Line 482... | ||
- | 482 | ||
- | 483 | cancel_delayed_work_sync(&dev_priv->rps.delayed_resume_work); |
|
- | 484 | ||
- | 485 | drm_irq_uninstall(dev); |
|
- | 486 | dev_priv->enable_hotplug_processing = false; |
|
- | 487 | /* |
|
- | 488 | * Disable CRTCs directly since we want to preserve sw state |
|
- | 489 | * for _thaw. |
|
Line -... | Line 490... | ||
- | 490 | */ |
|
- | 491 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) |
|
Line -... | Line 492... | ||
- | 492 | dev_priv->display.crtc_disable(crtc); |
|
Line 501... | Line 493... | ||
501 | } |
493 | |
Line 502... | Line 494... | ||
502 | 494 | intel_modeset_suspend_hw(dev); |
|
503 | - | ||
504 | - | ||
505 | 495 | } |
|
506 | 496 | ||
Line -... | Line 497... | ||
- | 497 | i915_save_state(dev); |
|
- | 498 | ||
- | 499 | intel_opregion_fini(dev); |
|
507 | int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent); |
500 | |
508 | - | ||
509 | int i915_init(void) |
501 | console_lock(); |
- | 502 | intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED); |
|
- | 503 | console_unlock(); |
|
- | 504 | ||
- | 505 | return 0; |
|
510 | { |
506 | } |
511 | static pci_dev_t device; |
507 | |
- | 508 | int i915_suspend(struct drm_device *dev, pm_message_t state) |
|
- | 509 | { |
|
- | 510 | int error; |
|
- | 511 | ||
- | 512 | if (!dev || !dev->dev_private) { |
|
- | 513 | DRM_ERROR("dev: %p\n", dev); |
|
- | 514 | DRM_ERROR("DRM not initialized, aborting suspend.\n"); |
|
- | 515 | return -ENODEV; |
|
- | 516 | } |
|
- | 517 | ||
- | 518 | if (state.event == PM_EVENT_PRETHAW) |
|
- | 519 | return 0; |
|
- | 520 | ||
- | 521 | ||
- | 522 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
|
- | 523 | return 0; |
|
- | 524 | ||
- | 525 | error = i915_drm_freeze(dev); |
|
- | 526 | if (error) |
|
- | 527 | return error; |
|
- | 528 | ||
- | 529 | if (state.event == PM_EVENT_SUSPEND) { |
|
- | 530 | /* Shut down the device */ |
|
- | 531 | pci_disable_device(dev->pdev); |
|
- | 532 | pci_set_power_state(dev->pdev, PCI_D3hot); |
|
- | 533 | } |
|
- | 534 | ||
- | 535 | return 0; |
|
- | 536 | } |
|
- | 537 | ||
- | 538 | void intel_console_resume(struct work_struct *work) |
|
- | 539 | { |
|
- | 540 | struct drm_i915_private *dev_priv = |
|
- | 541 | container_of(work, struct drm_i915_private, |
|
- | 542 | console_resume_work); |
|
- | 543 | struct drm_device *dev = dev_priv->dev; |
|
- | 544 | ||
- | 545 | console_lock(); |
|
- | 546 | intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING); |
|
- | 547 | console_unlock(); |
|
- | 548 | } |
|
- | 549 | ||
- | 550 | static void intel_resume_hotplug(struct drm_device *dev) |
|
- | 551 | { |
|
- | 552 | struct drm_mode_config *mode_config = &dev->mode_config; |
|
- | 553 | struct intel_encoder *encoder; |
|
- | 554 | ||
- | 555 | mutex_lock(&mode_config->mutex); |
|
- | 556 | DRM_DEBUG_KMS("running encoder hotplug functions\n"); |
|
- | 557 | ||
- | 558 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) |
|
- | 559 | if (encoder->hot_plug) |
|
- | 560 | encoder->hot_plug(encoder); |
|
- | 561 | ||
- | 562 | mutex_unlock(&mode_config->mutex); |
|
- | 563 | ||
- | 564 | /* Just fire off a uevent and let userspace tell us what to do */ |
|
- | 565 | drm_helper_hpd_irq_event(dev); |
|
- | 566 | } |
|
- | 567 | static int __i915_drm_thaw(struct drm_device *dev) |
|
- | 568 | { |
|
- | 569 | struct drm_i915_private *dev_priv = dev->dev_private; |
|
- | 570 | int error = 0; |
|
- | 571 | ||
- | 572 | i915_restore_state(dev); |
|
- | 573 | intel_opregion_setup(dev); |
|
- | 574 | ||
- | 575 | /* KMS EnterVT equivalent */ |
|
- | 576 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
|
- | 577 | intel_init_pch_refclk(dev); |
|
- | 578 | ||
- | 579 | mutex_lock(&dev->struct_mutex); |
|
- | 580 | ||
- | 581 | error = i915_gem_init_hw(dev); |
|
- | 582 | mutex_unlock(&dev->struct_mutex); |
|
- | 583 | ||
- | 584 | /* We need working interrupts for modeset enabling ... */ |
|
- | 585 | drm_irq_install(dev); |
|
- | 586 | ||
- | 587 | intel_modeset_init_hw(dev); |
|
- | 588 | ||
- | 589 | drm_modeset_lock_all(dev); |
|
512 | const struct pci_device_id *ent; |
590 | intel_modeset_setup_hw_state(dev, true); |
- | 591 | drm_modeset_unlock_all(dev); |
|
- | 592 | ||
- | 593 | /* |
|
- | 594 | * ... but also need to make sure that hotplug processing |
|
- | 595 | * doesn't cause havoc. Like in the driver load code we don't |
|
- | 596 | * bother with the tiny race here where we might loose hotplug |
|
- | 597 | * notifications. |
|
- | 598 | * */ |
|
- | 599 | intel_hpd_init(dev); |
|
- | 600 | dev_priv->enable_hotplug_processing = true; |
|
- | 601 | /* Config may have changed between suspend and resume */ |
|
- | 602 | intel_resume_hotplug(dev); |
|
- | 603 | } |
|
- | 604 | ||
- | 605 | intel_opregion_init(dev); |
|
- | 606 | ||
- | 607 | /* |
|
- | 608 | * The console lock can be pretty contented on resume due |
|
- | 609 | * to all the printk activity. Try to keep it out of the hot |
|
- | 610 | * path of resume if possible. |
|
- | 611 | */ |
|
- | 612 | if (console_trylock()) { |
|
- | 613 | intel_fbdev_set_suspend(dev, FBINFO_STATE_RUNNING); |
|
- | 614 | console_unlock(); |
|
- | 615 | } else { |
|
- | 616 | schedule_work(&dev_priv->console_resume_work); |
|
- | 617 | } |
|
- | 618 | ||
- | 619 | /* Undo what we did at i915_drm_freeze so the refcount goes back to the |
|
- | 620 | * expected level. */ |
|
- | 621 | hsw_enable_package_c8(dev_priv); |
|
- | 622 | ||
- | 623 | mutex_lock(&dev_priv->modeset_restore_lock); |
|
- | 624 | dev_priv->modeset_restore = MODESET_DONE; |
|
- | 625 | mutex_unlock(&dev_priv->modeset_restore_lock); |
|
- | 626 | return error; |
|
- | 627 | } |
|
- | 628 | ||
- | 629 | static int i915_drm_thaw(struct drm_device *dev) |
|
- | 630 | { |
|
- | 631 | int error = 0; |
|
- | 632 | ||
- | 633 | intel_uncore_sanitize(dev); |
|
- | 634 | ||
- | 635 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
|
- | 636 | mutex_lock(&dev->struct_mutex); |
|
- | 637 | i915_gem_restore_gtt_mappings(dev); |
|
- | 638 | mutex_unlock(&dev->struct_mutex); |
|
- | 639 | } |
|
- | 640 | ||
- | 641 | __i915_drm_thaw(dev); |
|
- | 642 | ||
- | 643 | return error; |
|
- | 644 | } |
|
- | 645 | ||
- | 646 | int i915_resume(struct drm_device *dev) |
|
- | 647 | { |
|
- | 648 | struct drm_i915_private *dev_priv = dev->dev_private; |
|
- | 649 | int ret; |
|
- | 650 | ||
- | 651 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
|
- | 652 | return 0; |
|
- | 653 | ||
- | 654 | if (pci_enable_device(dev->pdev)) |
|
- | 655 | return -EIO; |
|
- | 656 | ||
- | 657 | pci_set_master(dev->pdev); |
|
- | 658 | ||
- | 659 | intel_uncore_sanitize(dev); |
|
- | 660 | ||
- | 661 | /* |
|
- | 662 | * Platforms with opregion should have sane BIOS, older ones (gen3 and |
|
- | 663 | * earlier) need this since the BIOS might clear all our scratch PTEs. |
|
- | 664 | */ |
|
- | 665 | if (drm_core_check_feature(dev, DRIVER_MODESET) && |
|
- | 666 | !dev_priv->opregion.header) { |
|
- | 667 | mutex_lock(&dev->struct_mutex); |
|
- | 668 | i915_gem_restore_gtt_mappings(dev); |
|
- | 669 | mutex_unlock(&dev->struct_mutex); |
|
- | 670 | } |
|
- | 671 | ||
- | 672 | ret = __i915_drm_thaw(dev); |
|
- | 673 | if (ret) |
|
- | 674 | return ret; |
|
- | 675 | ||
- | 676 | drm_kms_helper_poll_enable(dev); |
|
- | 677 | return 0; |
|
- | 678 | } |
|
- | 679 | ||
- | 680 | /** |
|
- | 681 | * i915_reset - reset chip after a hang |
|
- | 682 | * @dev: drm device to reset |
|
- | 683 | * |
|
- | 684 | * Reset the chip. Useful if a hang is detected. Returns zero on successful |
|
- | 685 | * reset or otherwise an error code. |
|
- | 686 | * |
|
- | 687 | * Procedure is fairly simple: |
|
- | 688 | * - reset the chip using the reset reg |
|
- | 689 | * - re-init context state |
|
- | 690 | * - re-init hardware status page |
|
- | 691 | * - re-init ring buffer |
|
- | 692 | * - re-init interrupt state |
|
- | 693 | * - re-init display |
|
- | 694 | */ |
|
- | 695 | int i915_reset(struct drm_device *dev) |
|
- | 696 | { |
|
- | 697 | drm_i915_private_t *dev_priv = dev->dev_private; |
|
- | 698 | bool simulated; |
|
Line -... | Line 699... | ||
- | 699 | int ret; |
|
- | 700 | ||
- | 701 | if (!i915_try_reset) |
|
- | 702 | return 0; |
|
- | 703 | ||
- | 704 | mutex_lock(&dev->struct_mutex); |
|
- | 705 | ||
- | 706 | i915_gem_reset(dev); |
|
- | 707 | ||
- | 708 | simulated = dev_priv->gpu_error.stop_rings != 0; |
|
- | 709 | ||
- | 710 | if (!simulated && get_seconds() - dev_priv->gpu_error.last_reset < 5) { |
|
- | 711 | DRM_ERROR("GPU hanging too fast, declaring wedged!\n"); |
|
- | 712 | ret = -ENODEV; |
|
- | 713 | } else { |
|
- | 714 | ret = intel_gpu_reset(dev); |
|
- | 715 | ||
- | 716 | /* Also reset the gpu hangman. */ |
|
- | 717 | if (simulated) { |
|
- | 718 | DRM_INFO("Simulated gpu hang, resetting stop_rings\n"); |
|
- | 719 | dev_priv->gpu_error.stop_rings = 0; |
|
- | 720 | if (ret == -ENODEV) { |
|
- | 721 | DRM_ERROR("Reset not implemented, but ignoring " |
|
- | 722 | "error for simulated gpu hangs\n"); |
|
- | 723 | ret = 0; |
|
- | 724 | } |
|
- | 725 | } else |
|
- | 726 | dev_priv->gpu_error.last_reset = get_seconds(); |
|
- | 727 | } |
|
- | 728 | if (ret) { |
|
- | 729 | DRM_ERROR("Failed to reset chip.\n"); |
|
- | 730 | mutex_unlock(&dev->struct_mutex); |
|
- | 731 | return ret; |
|
- | 732 | } |
|
- | 733 | ||
- | 734 | /* Ok, now get things going again... */ |
|
- | 735 | ||
- | 736 | /* |
|
- | 737 | * Everything depends on having the GTT running, so we need to start |
|
- | 738 | * there. Fortunately we don't need to do this unless we reset the |
|
- | 739 | * chip at a PCI level. |
|
- | 740 | * |
|
- | 741 | * Next we need to restore the context, but we don't use those |
|
- | 742 | * yet either... |
|
- | 743 | * |
|
- | 744 | * Ring buffer needs to be re-initialized in the KMS case, or if X |
|
- | 745 | * was running at the time of the reset (i.e. we weren't VT |
|
- | 746 | * switched away). |
|
- | 747 | */ |
|
- | 748 | if (drm_core_check_feature(dev, DRIVER_MODESET) || |
|
- | 749 | !dev_priv->ums.mm_suspended) { |
|
- | 750 | struct intel_ring_buffer *ring; |
|
- | 751 | int i; |
|
- | 752 | ||
- | 753 | dev_priv->ums.mm_suspended = 0; |
|
- | 754 | ||
- | 755 | i915_gem_init_swizzling(dev); |
|
- | 756 | ||
- | 757 | for_each_ring(ring, dev_priv, i) |
|
- | 758 | ring->init(ring); |
|
- | 759 | ||
- | 760 | i915_gem_context_init(dev); |
|
- | 761 | if (dev_priv->mm.aliasing_ppgtt) { |
|
- | 762 | ret = dev_priv->mm.aliasing_ppgtt->enable(dev); |
|
- | 763 | if (ret) |
|
- | 764 | i915_gem_cleanup_aliasing_ppgtt(dev); |
|
- | 765 | } |
|
- | 766 | ||
- | 767 | /* |
|
- | 768 | * It would make sense to re-init all the other hw state, at |
|
- | 769 | * least the rps/rc6/emon init done within modeset_init_hw. For |
|
- | 770 | * some unknown reason, this blows up my ilk, so don't. |
|
- | 771 | */ |
|
- | 772 | ||
- | 773 | mutex_unlock(&dev->struct_mutex); |
|
- | 774 | ||
- | 775 | drm_irq_uninstall(dev); |
|
- | 776 | drm_irq_install(dev); |
|
- | 777 | intel_hpd_init(dev); |
|
513 | int err; |
778 | } else { |
514 | 779 | mutex_unlock(&dev->struct_mutex); |
|
Line -... | Line 780... | ||
- | 780 | } |
|
- | 781 | ||
- | 782 | return 0; |
|
- | 783 | } |
|
- | 784 | ||
- | 785 | static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
|
- | 786 | { |
|
- | 787 | struct intel_device_info *intel_info = |
|
- | 788 | (struct intel_device_info *) ent->driver_data; |
|
- | 789 | ||
- | 790 | /* Only bind to function 0 of the device. Early generations |
|
- | 791 | * used function 1 as a placeholder for multi-head. This causes |
|
515 | ent = find_pci_device(&device, pciidlist); |
792 | * us confusion instead, especially on the systems where both |
- | 793 | * functions have the same PCI-ID! |
|
- | 794 | */ |
|
516 | if( unlikely(ent == NULL) ) |
795 | if (PCI_FUNC(pdev->devfn)) |
517 | { |
796 | return -ENODEV; |
518 | dbgprintf("device not found\n"); |
797 | |
519 | return -ENODEV; |
798 | /* We've managed to ship a kms-enabled ddx that shipped with an XvMC |
Line 520... | Line 799... | ||
520 | }; |
799 | * implementation for gen3 (and only gen3) that used legacy drm maps |
521 | - | ||
- | 800 | * (gasp!) to share buffers between X and the client. Hence we need to |
|
Line -... | Line 801... | ||
- | 801 | * keep around the fake agp stuff for gen3, even when kms is enabled. */ |
|
522 | struct intel_device_info *intel_info = |
802 | if (intel_info->gen != 3) { |
- | 803 | driver.driver_features &= |
|
- | 804 | ~(DRIVER_USE_AGP | DRIVER_REQUIRE_AGP); |
|
Line -... | Line 805... | ||
- | 805 | } else if (!intel_agp_enabled) { |
|
- | 806 | DRM_ERROR("drm/i915 can't work without intel_agp module!\n"); |
|
- | 807 | return -ENODEV; |
|
- | 808 | } |
|
- | 809 | ||
- | 810 | return drm_get_pci_dev(pdev, ent, &driver); |
|
- | 811 | } |
|
- | 812 | ||
- | 813 | static void |
|
523 | (struct intel_device_info *) ent->driver_data; |
814 | i915_pci_remove(struct pci_dev *pdev) |
524 | 815 | { |
|
525 | if (intel_info->is_valleyview) |
816 | struct drm_device *dev = pci_get_drvdata(pdev); |
526 | if(!i915_preliminary_hw_support) { |
817 | |
Line -... | Line 818... | ||
- | 818 | drm_put_dev(dev); |
|
- | 819 | } |
|
- | 820 | ||
527 | DRM_ERROR("Preliminary hardware support disabled\n"); |
821 | static int i915_pm_suspend(struct device *dev) |
- | 822 | { |
|
- | 823 | struct pci_dev *pdev = to_pci_dev(dev); |
|
Line -... | Line 824... | ||
- | 824 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
|
- | 825 | int error; |
|
- | 826 | ||
528 | return -ENODEV; |
827 | if (!drm_dev || !drm_dev->dev_private) { |
529 | } |
828 | dev_err(dev, "DRM not initialized, aborting suspend.\n"); |
Line -... | Line 829... | ||
- | 829 | return -ENODEV; |
|
- | 830 | } |
|
- | 831 | ||
- | 832 | if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF) |
|
Line -... | Line 833... | ||
- | 833 | return 0; |
|
- | 834 | ||
- | 835 | error = i915_drm_freeze(drm_dev); |
|
- | 836 | if (error) |
|
- | 837 | return error; |
|
- | 838 | ||
- | 839 | pci_disable_device(pdev); |
|
- | 840 | pci_set_power_state(pdev, PCI_D3hot); |
|
- | 841 | ||
- | 842 | return 0; |
|
- | 843 | } |
|
- | 844 | ||
- | 845 | static int i915_pm_resume(struct device *dev) |
|
- | 846 | { |
|
- | 847 | struct pci_dev *pdev = to_pci_dev(dev); |
|
- | 848 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
|
- | 849 | ||
- | 850 | return i915_resume(drm_dev); |
|
- | 851 | } |
|
- | 852 | ||
- | 853 | static int i915_pm_freeze(struct device *dev) |
|
- | 854 | { |
|
- | 855 | struct pci_dev *pdev = to_pci_dev(dev); |
|
- | 856 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
|
- | 857 | ||
- | 858 | if (!drm_dev || !drm_dev->dev_private) { |
|
- | 859 | dev_err(dev, "DRM not initialized, aborting suspend.\n"); |
|
- | 860 | return -ENODEV; |
|
- | 861 | } |
|
- | 862 | ||
- | 863 | return i915_drm_freeze(drm_dev); |
|
- | 864 | } |
|
- | 865 | ||
Line 530... | Line 866... | ||
530 | 866 | static int i915_pm_thaw(struct device *dev) |
|
531 | DRM_INFO("device %x:%x\n", device.pci_dev.vendor, |
867 | { |
532 | device.pci_dev.device); |
868 | struct pci_dev *pdev = to_pci_dev(dev); |
533 | 869 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
|
534 | if (intel_info->gen != 3) { |
870 | |
535 | 871 | return i915_drm_thaw(drm_dev); |
|
536 | } else if (init_agp() != 0) { |
872 | } |
- | 873 | ||
537 | DRM_ERROR("drm/i915 can't work without intel_agp module!\n"); |
874 | static int i915_pm_poweroff(struct device *dev) |
538 | return -ENODEV; |
875 | { |
539 | } |
876 | struct pci_dev *pdev = to_pci_dev(dev); |
540 | 877 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
|
541 | err = drm_get_dev(&device.pci_dev, ent); |
878 | |
542 | 879 | return i915_drm_freeze(drm_dev); |
|
Line 564... | Line 901... | ||
564 | // .resume = i915_resume, |
901 | // .resume = i915_resume, |
Line 565... | Line 902... | ||
565 | 902 | ||
566 | // .device_is_agp = i915_driver_device_is_agp, |
903 | // .device_is_agp = i915_driver_device_is_agp, |
567 | // .master_create = i915_master_create, |
904 | // .master_create = i915_master_create, |
- | 905 | // .master_destroy = i915_master_destroy, |
|
- | 906 | #if defined(CONFIG_DEBUG_FS) |
|
- | 907 | .debugfs_init = i915_debugfs_init, |
|
- | 908 | .debugfs_cleanup = i915_debugfs_cleanup, |
|
568 | // .master_destroy = i915_master_destroy, |
909 | #endif |
569 | .gem_init_object = i915_gem_init_object, |
910 | .gem_init_object = i915_gem_init_object, |
570 | .gem_free_object = i915_gem_free_object, |
- | |
Line 571... | Line 911... | ||
571 | // .gem_vm_ops = &i915_gem_vm_ops, |
911 | .gem_free_object = i915_gem_free_object, |
572 | 912 | ||
573 | // .prime_handle_to_fd = drm_gem_prime_handle_to_fd, |
913 | // .prime_handle_to_fd = drm_gem_prime_handle_to_fd, |
574 | // .prime_fd_to_handle = drm_gem_prime_fd_to_handle, |
914 | // .prime_fd_to_handle = drm_gem_prime_fd_to_handle, |
Line 587... | Line 927... | ||
587 | // .minor = DRIVER_MINOR, |
927 | // .minor = DRIVER_MINOR, |
588 | // .patchlevel = DRIVER_PATCHLEVEL, |
928 | // .patchlevel = DRIVER_PATCHLEVEL, |
589 | }; |
929 | }; |
Line 590... | Line -... | ||
590 | - | ||
591 | - | ||
592 | int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent) |
- | |
593 | { |
- | |
Line 594... | Line -... | ||
594 | static struct drm_device drm_dev; |
- | |
595 | static struct drm_file drm_file; |
- | |
Line 596... | Line 930... | ||
596 | 930 | ||
597 | struct drm_device *dev; |
931 | |
598 | struct drm_file *priv; |
- | |
599 | 932 | ||
600 | int ret; |
- | |
601 | - | ||
602 | dev = &drm_dev; |
- | |
603 | priv = &drm_file; |
933 | |
604 | 934 | int i915_init(void) |
|
605 | drm_file_handlers[0] = priv; |
- | |
606 | - | ||
607 | // ret = pci_enable_device(pdev); |
- | |
608 | // if (ret) |
- | |
609 | // goto err_g1; |
- | |
610 | - | ||
611 | pci_set_master(pdev); |
- | |
612 | - | ||
613 | // if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) { |
- | |
614 | // printk(KERN_ERR "DRM: Fill_in_dev failed.\n"); |
- | |
615 | // goto err_g2; |
- | |
616 | // } |
- | |
617 | - | ||
618 | dev->pdev = pdev; |
- | |
619 | dev->pci_device = pdev->device; |
- | |
620 | dev->pci_vendor = pdev->vendor; |
- | |
621 | - | ||
622 | INIT_LIST_HEAD(&dev->filelist); |
- | |
623 | INIT_LIST_HEAD(&dev->ctxlist); |
- | |
624 | INIT_LIST_HEAD(&dev->vmalist); |
- | |
625 | INIT_LIST_HEAD(&dev->maplist); |
- | |
Line 626... | Line 935... | ||
626 | 935 | { |
|
627 | spin_lock_init(&dev->count_lock); |
936 | static pci_dev_t device; |
- | 937 | const struct pci_device_id *ent; |
|
628 | mutex_init(&dev->struct_mutex); |
938 | int err; |
629 | mutex_init(&dev->ctxlist_mutex); |
939 | |
630 | 940 | ent = find_pci_device(&device, pciidlist); |
|
Line 631... | Line 941... | ||
631 | INIT_LIST_HEAD(&priv->lhead); |
941 | if( unlikely(ent == NULL) ) |
632 | INIT_LIST_HEAD(&priv->fbs); |
- | |
Line -... | Line 942... | ||
- | 942 | { |
|
- | 943 | dbgprintf("device not found\n"); |
|
- | 944 | return -ENODEV; |
|
633 | INIT_LIST_HEAD(&priv->event_list); |
945 | }; |
Line 634... | Line 946... | ||
634 | init_waitqueue_head(&priv->event_wait); |
946 | |
635 | priv->event_space = 4096; /* set aside 4k for event buffer */ |
947 | drm_core_init(); |
636 | - | ||
637 | idr_init(&priv->object_idr); |
948 | |
638 | spin_lock_init(&priv->table_lock); |
949 | DRM_INFO("device %x:%x\n", device.pci_dev.vendor, |
- | 950 | device.pci_dev.device); |
|
- | 951 | /* |
|
Line 639... | Line -... | ||
639 | - | ||
640 | dev->driver = &driver; |
- | |
641 | - | ||
642 | if (dev->driver->open) { |
- | |
643 | ret = dev->driver->open(dev, priv); |
- | |
644 | if (ret < 0) |
- | |
645 | goto err_g4; |
- | |
646 | } |
- | |
647 | - | ||
648 | ret = i915_driver_load(dev, ent->driver_data ); |
- | |
649 | - | ||
650 | if (ret) |
- | |
651 | goto err_g4; |
- | |
652 | - | ||
653 | ret = init_display_kms(dev); |
- | |
654 | - | ||
655 | if (ret) |
- | |
656 | goto err_g4; |
- | |
657 | - | ||
658 | return 0; |
- | |
659 | 952 | if (intel_info->gen != 3) { |
|
660 | err_g4: |
953 | |
Line -... | Line 954... | ||
- | 954 | } else if (init_agp() != 0) { |
|
661 | //err_g3: |
955 | DRM_ERROR("drm/i915 can't work without intel_agp module!\n"); |
662 | // if (drm_core_check_feature(dev, DRIVER_MODESET)) |
956 | return -ENODEV; |
663 | // drm_put_minor(&dev->control); |
957 | } |
664 | //err_g2: |
958 | */ |
665 | // pci_disable_device(pdev); |
959 | err = drm_get_pci_dev(&device.pci_dev, ent, &driver); |
Line 775... | Line 1069... | ||
775 | ((reg) < 0x40000) && \ |
1069 | ((reg) < 0x40000) && \ |
776 | ((reg) != FORCEWAKE)) |
1070 | ((reg) != FORCEWAKE)) |
777 | static void |
1071 | static void |
778 | ilk_dummy_write(struct drm_i915_private *dev_priv) |
1072 | ilk_dummy_write(struct drm_i915_private *dev_priv) |
779 | { |
1073 | { |
780 | /* WaIssueDummyWriteToWakeupFromRC6: Issue a dummy write to wake up the |
1074 | /* WaIssueDummyWriteToWakeupFromRC6:ilk Issue a dummy write to wake up |
781 | * chip from rc6 before touching it for real. MI_MODE is masked, hence |
1075 | * the chip from rc6 before touching it for real. MI_MODE is masked, |
782 | * harmless to write 0 into. */ |
1076 | * hence harmless to write 0 into. */ |
783 | I915_WRITE_NOTRACE(MI_MODE, 0); |
1077 | I915_WRITE_NOTRACE(MI_MODE, 0); |
784 | } |
1078 | } |
Line 785... | Line 1079... | ||
785 | 1079 | ||
786 | static void |
1080 | static void |
787 | hsw_unclaimed_reg_clear(struct drm_i915_private *dev_priv, u32 reg) |
1081 | hsw_unclaimed_reg_clear(struct drm_i915_private *dev_priv, u32 reg) |
788 | { |
1082 | { |
789 | if (IS_HASWELL(dev_priv->dev) && |
1083 | if (HAS_FPGA_DBG_UNCLAIMED(dev_priv->dev) && |
790 | (I915_READ_NOTRACE(FPGA_DBG) & FPGA_DBG_RM_NOCLAIM)) { |
1084 | (I915_READ_NOTRACE(FPGA_DBG) & FPGA_DBG_RM_NOCLAIM)) { |
791 | DRM_ERROR("Unknown unclaimed register before writing to %x\n", |
1085 | DRM_ERROR("Unknown unclaimed register before writing to %x\n", |
792 | reg); |
1086 | reg); |
793 | I915_WRITE_NOTRACE(FPGA_DBG, FPGA_DBG_RM_NOCLAIM); |
1087 | I915_WRITE_NOTRACE(FPGA_DBG, FPGA_DBG_RM_NOCLAIM); |
794 | } |
1088 | } |
Line 795... | Line 1089... | ||
795 | } |
1089 | } |
796 | 1090 | ||
797 | static void |
1091 | static void |
798 | hsw_unclaimed_reg_check(struct drm_i915_private *dev_priv, u32 reg) |
1092 | hsw_unclaimed_reg_check(struct drm_i915_private *dev_priv, u32 reg) |
799 | { |
1093 | { |
800 | if (IS_HASWELL(dev_priv->dev) && |
1094 | if (HAS_FPGA_DBG_UNCLAIMED(dev_priv->dev) && |
801 | (I915_READ_NOTRACE(FPGA_DBG) & FPGA_DBG_RM_NOCLAIM)) { |
1095 | (I915_READ_NOTRACE(FPGA_DBG) & FPGA_DBG_RM_NOCLAIM)) { |
802 | DRM_ERROR("Unclaimed write to %x\n", reg); |
1096 | DRM_ERROR("Unclaimed write to %x\n", reg); |
803 | I915_WRITE_NOTRACE(FPGA_DBG, FPGA_DBG_RM_NOCLAIM); |
1097 | I915_WRITE_NOTRACE(FPGA_DBG, FPGA_DBG_RM_NOCLAIM); |
Line 804... | Line -... | ||
804 | } |
- | |
805 | } |
- | |
806 | - | ||
807 | #define __i915_read(x, y) \ |
- | |
808 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ |
- | |
809 | u##x val = 0; \ |
- | |
810 | if (IS_GEN5(dev_priv->dev)) \ |
- | |
811 | ilk_dummy_write(dev_priv); \ |
- | |
812 | if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ |
- | |
813 | unsigned long irqflags; \ |
- | |
814 | spin_lock_irqsave(&dev_priv->gt_lock, irqflags); \ |
- | |
815 | if (dev_priv->forcewake_count == 0) \ |
- | |
816 | dev_priv->gt.force_wake_get(dev_priv); \ |
- | |
817 | val = read##y(dev_priv->regs + reg); \ |
- | |
818 | if (dev_priv->forcewake_count == 0) \ |
- | |
819 | dev_priv->gt.force_wake_put(dev_priv); \ |
- | |
820 | spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags); \ |
- | |
821 | } else { \ |
- | |
822 | val = read##y(dev_priv->regs + reg); \ |
- | |
823 | } \ |
- | |
824 | return val; \ |
- | |
825 | } |
- | |
826 | - | ||
827 | __i915_read(8, b) |
- | |
828 | __i915_read(16, w) |
- | |
829 | __i915_read(32, l) |
- | |
830 | __i915_read(64, q) |
- | |
831 | #undef __i915_read |
- | |
832 | - | ||
833 | #define __i915_write(x, y) \ |
- | |
834 | void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val) { \ |
- | |
835 | u32 __fifo_ret = 0; \ |
- | |
836 | trace_i915_reg_rw(true, reg, val, sizeof(val)); \ |
- | |
837 | if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ |
- | |
838 | __fifo_ret = __gen6_gt_wait_for_fifo(dev_priv); \ |
- | |
839 | } \ |
- | |
840 | if (IS_GEN5(dev_priv->dev)) \ |
- | |
841 | ilk_dummy_write(dev_priv); \ |
- | |
842 | hsw_unclaimed_reg_clear(dev_priv, reg); \ |
- | |
843 | write##y(val, dev_priv->regs + reg); \ |
- | |
844 | if (unlikely(__fifo_ret)) { \ |
- | |
845 | gen6_gt_check_fifodbg(dev_priv); \ |
- | |
846 | } \ |
- | |
847 | hsw_unclaimed_reg_check(dev_priv, reg); \ |
- | |
848 | } |
- | |
849 | __i915_write(8, b) |
- | |
850 | __i915_write(16, w) |
- |