]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/gpu/drm/i915/i915_drv.h
drm/i915: add support for power wells
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / i915 / i915_drv.h
CommitLineData
1da177e4
LT
1/* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
2 */
0d6aa60b 3/*
bc54fd1a 4 *
1da177e4
LT
5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * All Rights Reserved.
bc54fd1a
DA
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
18 * of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
24 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 *
0d6aa60b 28 */
1da177e4
LT
29
30#ifndef _I915_DRV_H_
31#define _I915_DRV_H_
32
585fb111 33#include "i915_reg.h"
79e53945 34#include "intel_bios.h"
8187a2b7 35#include "intel_ringbuffer.h"
0839ccb8 36#include <linux/io-mapping.h>
f899fc64 37#include <linux/i2c.h>
c167a6fc 38#include <linux/i2c-algo-bit.h>
0ade6386 39#include <drm/intel-gtt.h>
aaa6fd2a 40#include <linux/backlight.h>
585fb111 41
1da177e4
LT
42/* General customization:
43 */
44
45#define DRIVER_AUTHOR "Tungsten Graphics, Inc."
46
47#define DRIVER_NAME "i915"
48#define DRIVER_DESC "Intel Graphics"
673a394b 49#define DRIVER_DATE "20080730"
1da177e4 50
317c35d1
JB
51enum pipe {
52 PIPE_A = 0,
53 PIPE_B,
9db4a9c7
JB
54 PIPE_C,
55 I915_MAX_PIPES
317c35d1 56};
9db4a9c7 57#define pipe_name(p) ((p) + 'A')
317c35d1 58
80824003
JB
59enum plane {
60 PLANE_A = 0,
61 PLANE_B,
9db4a9c7 62 PLANE_C,
80824003 63};
9db4a9c7 64#define plane_name(p) ((p) + 'A')
52440211 65
62fdfeaf
EA
66#define I915_GEM_GPU_DOMAINS (~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT))
67
9db4a9c7
JB
68#define for_each_pipe(p) for ((p) = 0; (p) < dev_priv->num_pipe; (p)++)
69
1da177e4
LT
70/* Interface history:
71 *
72 * 1.1: Original.
0d6aa60b
DA
73 * 1.2: Add Power Management
74 * 1.3: Add vblank support
de227f5f 75 * 1.4: Fix cmdbuffer path, add heap destroy
702880f2 76 * 1.5: Add vblank pipe configuration
2228ed67
MD
77 * 1.6: - New ioctl for scheduling buffer swaps on vertical blank
78 * - Support vertical blank on secondary display pipe
1da177e4
LT
79 */
80#define DRIVER_MAJOR 1
2228ed67 81#define DRIVER_MINOR 6
1da177e4
LT
82#define DRIVER_PATCHLEVEL 0
83
673a394b 84#define WATCH_COHERENCY 0
23bc5982 85#define WATCH_LISTS 0
673a394b 86
71acb5eb
DA
87#define I915_GEM_PHYS_CURSOR_0 1
88#define I915_GEM_PHYS_CURSOR_1 2
89#define I915_GEM_PHYS_OVERLAY_REGS 3
90#define I915_MAX_PHYS_OBJECT (I915_GEM_PHYS_OVERLAY_REGS)
91
92struct drm_i915_gem_phys_object {
93 int id;
94 struct page **page_list;
95 drm_dma_handle_t *handle;
05394f39 96 struct drm_i915_gem_object *cur_obj;
71acb5eb
DA
97};
98
1da177e4
LT
99struct mem_block {
100 struct mem_block *next;
101 struct mem_block *prev;
102 int start;
103 int size;
6c340eac 104 struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
1da177e4
LT
105};
106
0a3e67a4
JB
107struct opregion_header;
108struct opregion_acpi;
109struct opregion_swsci;
110struct opregion_asle;
8d715f00 111struct drm_i915_private;
0a3e67a4 112
8ee1c3db
MG
113struct intel_opregion {
114 struct opregion_header *header;
115 struct opregion_acpi *acpi;
116 struct opregion_swsci *swsci;
117 struct opregion_asle *asle;
44834a67 118 void *vbt;
01fe9dbd 119 u32 __iomem *lid_state;
8ee1c3db 120};
44834a67 121#define OPREGION_SIZE (8*1024)
8ee1c3db 122
6ef3d427
CW
123struct intel_overlay;
124struct intel_overlay_error_state;
125
7c1c2871
DA
126struct drm_i915_master_private {
127 drm_local_map_t *sarea;
128 struct _drm_i915_sarea *sarea_priv;
129};
de151cf6 130#define I915_FENCE_REG_NONE -1
4b9de737
DV
131#define I915_MAX_NUM_FENCES 16
132/* 16 fences + sign bit for FENCE_REG_NONE */
133#define I915_MAX_NUM_FENCE_BITS 5
de151cf6
JB
134
135struct drm_i915_fence_reg {
007cc8ac 136 struct list_head lru_list;
caea7476 137 struct drm_i915_gem_object *obj;
d9e86c0e 138 uint32_t setup_seqno;
1690e1eb 139 int pin_count;
de151cf6 140};
7c1c2871 141
9b9d172d 142struct sdvo_device_mapping {
e957d772 143 u8 initialized;
9b9d172d 144 u8 dvo_port;
145 u8 slave_addr;
146 u8 dvo_wiring;
e957d772 147 u8 i2c_pin;
b1083333 148 u8 ddc_pin;
9b9d172d 149};
150
c4a1d9e4
CW
151struct intel_display_error_state;
152
63eeaf38
JB
153struct drm_i915_error_state {
154 u32 eir;
155 u32 pgtbl_er;
9db4a9c7 156 u32 pipestat[I915_MAX_PIPES];
c1cd90ed
DV
157 u32 tail[I915_NUM_RINGS];
158 u32 head[I915_NUM_RINGS];
d27b1e0e
DV
159 u32 ipeir[I915_NUM_RINGS];
160 u32 ipehr[I915_NUM_RINGS];
161 u32 instdone[I915_NUM_RINGS];
162 u32 acthd[I915_NUM_RINGS];
7e3b8737
DV
163 u32 semaphore_mboxes[I915_NUM_RINGS][I915_NUM_RINGS - 1];
164 /* our own tracking of ring head and tail */
165 u32 cpu_ring_head[I915_NUM_RINGS];
166 u32 cpu_ring_tail[I915_NUM_RINGS];
1d8f38f4 167 u32 error; /* gen6+ */
c1cd90ed
DV
168 u32 instpm[I915_NUM_RINGS];
169 u32 instps[I915_NUM_RINGS];
63eeaf38 170 u32 instdone1;
d27b1e0e 171 u32 seqno[I915_NUM_RINGS];
9df30794 172 u64 bbaddr;
33f3f518
DV
173 u32 fault_reg[I915_NUM_RINGS];
174 u32 done_reg;
c1cd90ed 175 u32 faddr[I915_NUM_RINGS];
4b9de737 176 u64 fence[I915_MAX_NUM_FENCES];
63eeaf38 177 struct timeval time;
52d39a21
CW
178 struct drm_i915_error_ring {
179 struct drm_i915_error_object {
180 int page_count;
181 u32 gtt_offset;
182 u32 *pages[0];
183 } *ringbuffer, *batchbuffer;
184 struct drm_i915_error_request {
185 long jiffies;
186 u32 seqno;
ee4f42b1 187 u32 tail;
52d39a21
CW
188 } *requests;
189 int num_requests;
190 } ring[I915_NUM_RINGS];
9df30794 191 struct drm_i915_error_buffer {
a779e5ab 192 u32 size;
9df30794
CW
193 u32 name;
194 u32 seqno;
195 u32 gtt_offset;
196 u32 read_domains;
197 u32 write_domain;
4b9de737 198 s32 fence_reg:I915_MAX_NUM_FENCE_BITS;
9df30794
CW
199 s32 pinned:2;
200 u32 tiling:2;
201 u32 dirty:1;
202 u32 purgeable:1;
5d1333fc 203 s32 ring:4;
93dfb40c 204 u32 cache_level:2;
c724e8a9
CW
205 } *active_bo, *pinned_bo;
206 u32 active_bo_count, pinned_bo_count;
6ef3d427 207 struct intel_overlay_error_state *overlay;
c4a1d9e4 208 struct intel_display_error_state *display;
63eeaf38
JB
209};
210
e70236a8
JB
211struct drm_i915_display_funcs {
212 void (*dpms)(struct drm_crtc *crtc, int mode);
ee5382ae 213 bool (*fbc_enabled)(struct drm_device *dev);
e70236a8
JB
214 void (*enable_fbc)(struct drm_crtc *crtc, unsigned long interval);
215 void (*disable_fbc)(struct drm_device *dev);
216 int (*get_display_clock_speed)(struct drm_device *dev);
217 int (*get_fifo_size)(struct drm_device *dev, int plane);
d210246a 218 void (*update_wm)(struct drm_device *dev);
b840d907
JB
219 void (*update_sprite_wm)(struct drm_device *dev, int pipe,
220 uint32_t sprite_width, int pixel_size);
f564048e
EA
221 int (*crtc_mode_set)(struct drm_crtc *crtc,
222 struct drm_display_mode *mode,
223 struct drm_display_mode *adjusted_mode,
224 int x, int y,
225 struct drm_framebuffer *old_fb);
e0dac65e
WF
226 void (*write_eld)(struct drm_connector *connector,
227 struct drm_crtc *crtc);
674cf967 228 void (*fdi_link_train)(struct drm_crtc *crtc);
6067aaea 229 void (*init_clock_gating)(struct drm_device *dev);
645c62a5 230 void (*init_pch_clock_gating)(struct drm_device *dev);
8c9f3aaf
JB
231 int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc,
232 struct drm_framebuffer *fb,
233 struct drm_i915_gem_object *obj);
17638cd6
JB
234 int (*update_plane)(struct drm_crtc *crtc, struct drm_framebuffer *fb,
235 int x, int y);
8d715f00
KP
236 void (*force_wake_get)(struct drm_i915_private *dev_priv);
237 void (*force_wake_put)(struct drm_i915_private *dev_priv);
e70236a8
JB
238 /* clock updates for mode set */
239 /* cursor updates */
240 /* render clock increase/decrease */
241 /* display clock increase/decrease */
242 /* pll clock increase/decrease */
e70236a8
JB
243};
244
cfdf1fa2 245struct intel_device_info {
c96c3a8c 246 u8 gen;
0206e353
AJ
247 u8 is_mobile:1;
248 u8 is_i85x:1;
249 u8 is_i915g:1;
250 u8 is_i945gm:1;
251 u8 is_g33:1;
252 u8 need_gfx_hws:1;
253 u8 is_g4x:1;
254 u8 is_pineview:1;
255 u8 is_broadwater:1;
256 u8 is_crestline:1;
257 u8 is_ivybridge:1;
70a3eb7a 258 u8 is_valleyview:1;
7e508a27 259 u8 has_pch_split:1;
4cae9ae0 260 u8 is_haswell:1;
0206e353
AJ
261 u8 has_fbc:1;
262 u8 has_pipe_cxsr:1;
263 u8 has_hotplug:1;
264 u8 cursor_needs_physical:1;
265 u8 has_overlay:1;
266 u8 overlay_needs_physical:1;
267 u8 supports_tv:1;
268 u8 has_bsd_ring:1;
269 u8 has_blt_ring:1;
3d29b842 270 u8 has_llc:1;
cfdf1fa2
KH
271};
272
1d2a314c
DV
273#define I915_PPGTT_PD_ENTRIES 512
274#define I915_PPGTT_PT_ENTRIES 1024
275struct i915_hw_ppgtt {
276 unsigned num_pd_entries;
277 struct page **pt_pages;
278 uint32_t pd_offset;
279 dma_addr_t *pt_dma_addr;
280 dma_addr_t scratch_page_dma_addr;
281};
282
b5e50c3f 283enum no_fbc_reason {
bed4a673 284 FBC_NO_OUTPUT, /* no outputs enabled to compress */
b5e50c3f
JB
285 FBC_STOLEN_TOO_SMALL, /* not enough space to hold compressed buffers */
286 FBC_UNSUPPORTED_MODE, /* interlace or doublescanned mode */
287 FBC_MODE_TOO_LARGE, /* mode too large for compression */
288 FBC_BAD_PLANE, /* fbc not supported on plane */
289 FBC_NOT_TILED, /* buffer not tiled */
9c928d16 290 FBC_MULTIPLE_PIPES, /* more than one pipe active */
c1a9f047 291 FBC_MODULE_PARAM,
b5e50c3f
JB
292};
293
3bad0781
ZW
294enum intel_pch {
295 PCH_IBX, /* Ibexpeak PCH */
296 PCH_CPT, /* Cougarpoint PCH */
eb877ebf 297 PCH_LPT, /* Lynxpoint PCH */
3bad0781
ZW
298};
299
b690e96c 300#define QUIRK_PIPEA_FORCE (1<<0)
435793df 301#define QUIRK_LVDS_SSC_DISABLE (1<<1)
4dca20ef 302#define QUIRK_INVERT_BRIGHTNESS (1<<2)
b690e96c 303
8be48d92 304struct intel_fbdev;
1630fe75 305struct intel_fbc_work;
38651674 306
c2b9152f
DV
307struct intel_gmbus {
308 struct i2c_adapter adapter;
f6f808c8 309 bool force_bit;
c2b9152f 310 u32 reg0;
36c785f0 311 u32 gpio_reg;
c167a6fc 312 struct i2c_algo_bit_data bit_algo;
c2b9152f
DV
313 struct drm_i915_private *dev_priv;
314};
315
1da177e4 316typedef struct drm_i915_private {
673a394b
EA
317 struct drm_device *dev;
318
cfdf1fa2
KH
319 const struct intel_device_info *info;
320
ac5c4e76 321 int has_gem;
72bfa19c 322 int relative_constants_mode;
ac5c4e76 323
3043c60c 324 void __iomem *regs;
9f1f46a4
DV
325 /** gt_fifo_count and the subsequent register write are synchronized
326 * with dev->struct_mutex. */
327 unsigned gt_fifo_count;
328 /** forcewake_count is protected by gt_lock */
329 unsigned forcewake_count;
330 /** gt_lock is also taken in irq contexts. */
331 struct spinlock gt_lock;
1da177e4 332
f2c9677b 333 struct intel_gmbus gmbus[GMBUS_NUM_PORTS];
f899fc64 334
8a8ed1f5
YS
335 /** gmbus_mutex protects against concurrent usage of the single hw gmbus
336 * controller on different i2c buses. */
337 struct mutex gmbus_mutex;
338
110447fc
DV
339 /**
340 * Base address of the gmbus and gpio block.
341 */
342 uint32_t gpio_mmio_base;
343
ec2a4c3f 344 struct pci_dev *bridge_dev;
1ec14ad3 345 struct intel_ring_buffer ring[I915_NUM_RINGS];
6f392d54 346 uint32_t next_seqno;
1da177e4 347
9c8da5eb 348 drm_dma_handle_t *status_page_dmah;
0a3e67a4 349 uint32_t counter;
dc7a9319 350 drm_local_map_t hws_map;
05394f39
CW
351 struct drm_i915_gem_object *pwrctx;
352 struct drm_i915_gem_object *renderctx;
1da177e4 353
d7658989
JB
354 struct resource mch_res;
355
a6b54f3f 356 unsigned int cpp;
1da177e4
LT
357 int back_offset;
358 int front_offset;
359 int current_page;
360 int page_flipping;
1da177e4 361
1da177e4 362 atomic_t irq_received;
1ec14ad3
CW
363
364 /* protects the irq masks */
365 spinlock_t irq_lock;
57f350b6
JB
366
367 /* DPIO indirect register protection */
368 spinlock_t dpio_lock;
369
ed4cb414 370 /** Cached value of IMR to avoid reads in updating the bitfield */
7c463586 371 u32 pipestat[2];
1ec14ad3
CW
372 u32 irq_mask;
373 u32 gt_irq_mask;
374 u32 pch_irq_mask;
1da177e4 375
5ca58282
JB
376 u32 hotplug_supported_mask;
377 struct work_struct hotplug_work;
378
1da177e4
LT
379 int tex_lru_log_granularity;
380 int allow_batchbuffer;
0d6aa60b 381 unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds;
702880f2 382 int vblank_pipe;
a3524f1b 383 int num_pipe;
a6b54f3f 384
f65d9421 385 /* For hangcheck timer */
576ae4b8 386#define DRM_I915_HANGCHECK_PERIOD 1500 /* in ms */
f65d9421
BG
387 struct timer_list hangcheck_timer;
388 int hangcheck_count;
389 uint32_t last_acthd;
097354eb
DV
390 uint32_t last_acthd_bsd;
391 uint32_t last_acthd_blt;
cbb465e7
CW
392 uint32_t last_instdone;
393 uint32_t last_instdone1;
f65d9421 394
80824003 395 unsigned long cfb_size;
016b9b61
CW
396 unsigned int cfb_fb;
397 enum plane cfb_plane;
bed4a673 398 int cfb_y;
1630fe75 399 struct intel_fbc_work *fbc_work;
80824003 400
8ee1c3db
MG
401 struct intel_opregion opregion;
402
02e792fb
DV
403 /* overlay */
404 struct intel_overlay *overlay;
b840d907 405 bool sprite_scaling_enabled;
02e792fb 406
79e53945 407 /* LVDS info */
a9573556 408 int backlight_level; /* restore backlight to this value */
47356eb6 409 bool backlight_enabled;
88631706
ML
410 struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
411 struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
79e53945
JB
412
413 /* Feature bits from the VBIOS */
95281e35
HE
414 unsigned int int_tv_support:1;
415 unsigned int lvds_dither:1;
416 unsigned int lvds_vbt:1;
417 unsigned int int_crt_support:1;
43565a06 418 unsigned int lvds_use_ssc:1;
abd06860 419 unsigned int display_clock_mode:1;
43565a06 420 int lvds_ssc_freq;
b0354385
TI
421 unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */
422 unsigned int lvds_val; /* used for checking LVDS channel mode */
5ceb0f9b 423 struct {
9f0e7ff4
JB
424 int rate;
425 int lanes;
426 int preemphasis;
427 int vswing;
428
429 bool initialized;
430 bool support;
431 int bpp;
432 struct edp_power_seq pps;
5ceb0f9b 433 } edp;
89667383 434 bool no_aux_handshake;
79e53945 435
c1c7af60
JB
436 struct notifier_block lid_notifier;
437
f899fc64 438 int crt_ddc_pin;
4b9de737 439 struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */
de151cf6
JB
440 int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
441 int num_fence_regs; /* 8 on pre-965, 16 otherwise */
442
95534263 443 unsigned int fsb_freq, mem_freq, is_ddr3;
7662c8bd 444
63eeaf38
JB
445 spinlock_t error_lock;
446 struct drm_i915_error_state *first_error;
8a905236 447 struct work_struct error_work;
30dbf0c0 448 struct completion error_completion;
9c9fe1f8 449 struct workqueue_struct *wq;
63eeaf38 450
e70236a8
JB
451 /* Display functions */
452 struct drm_i915_display_funcs display;
453
3bad0781
ZW
454 /* PCH chipset type */
455 enum intel_pch pch_type;
456
b690e96c
JB
457 unsigned long quirks;
458
ba8bbcf6 459 /* Register state */
c9354c85 460 bool modeset_on_lid;
ba8bbcf6
JB
461 u8 saveLBB;
462 u32 saveDSPACNTR;
463 u32 saveDSPBCNTR;
e948e994 464 u32 saveDSPARB;
968b503e 465 u32 saveHWS;
ba8bbcf6
JB
466 u32 savePIPEACONF;
467 u32 savePIPEBCONF;
468 u32 savePIPEASRC;
469 u32 savePIPEBSRC;
470 u32 saveFPA0;
471 u32 saveFPA1;
472 u32 saveDPLL_A;
473 u32 saveDPLL_A_MD;
474 u32 saveHTOTAL_A;
475 u32 saveHBLANK_A;
476 u32 saveHSYNC_A;
477 u32 saveVTOTAL_A;
478 u32 saveVBLANK_A;
479 u32 saveVSYNC_A;
480 u32 saveBCLRPAT_A;
5586c8bc 481 u32 saveTRANSACONF;
42048781
ZW
482 u32 saveTRANS_HTOTAL_A;
483 u32 saveTRANS_HBLANK_A;
484 u32 saveTRANS_HSYNC_A;
485 u32 saveTRANS_VTOTAL_A;
486 u32 saveTRANS_VBLANK_A;
487 u32 saveTRANS_VSYNC_A;
0da3ea12 488 u32 savePIPEASTAT;
ba8bbcf6
JB
489 u32 saveDSPASTRIDE;
490 u32 saveDSPASIZE;
491 u32 saveDSPAPOS;
585fb111 492 u32 saveDSPAADDR;
ba8bbcf6
JB
493 u32 saveDSPASURF;
494 u32 saveDSPATILEOFF;
495 u32 savePFIT_PGM_RATIOS;
0eb96d6e 496 u32 saveBLC_HIST_CTL;
ba8bbcf6
JB
497 u32 saveBLC_PWM_CTL;
498 u32 saveBLC_PWM_CTL2;
42048781
ZW
499 u32 saveBLC_CPU_PWM_CTL;
500 u32 saveBLC_CPU_PWM_CTL2;
ba8bbcf6
JB
501 u32 saveFPB0;
502 u32 saveFPB1;
503 u32 saveDPLL_B;
504 u32 saveDPLL_B_MD;
505 u32 saveHTOTAL_B;
506 u32 saveHBLANK_B;
507 u32 saveHSYNC_B;
508 u32 saveVTOTAL_B;
509 u32 saveVBLANK_B;
510 u32 saveVSYNC_B;
511 u32 saveBCLRPAT_B;
5586c8bc 512 u32 saveTRANSBCONF;
42048781
ZW
513 u32 saveTRANS_HTOTAL_B;
514 u32 saveTRANS_HBLANK_B;
515 u32 saveTRANS_HSYNC_B;
516 u32 saveTRANS_VTOTAL_B;
517 u32 saveTRANS_VBLANK_B;
518 u32 saveTRANS_VSYNC_B;
0da3ea12 519 u32 savePIPEBSTAT;
ba8bbcf6
JB
520 u32 saveDSPBSTRIDE;
521 u32 saveDSPBSIZE;
522 u32 saveDSPBPOS;
585fb111 523 u32 saveDSPBADDR;
ba8bbcf6
JB
524 u32 saveDSPBSURF;
525 u32 saveDSPBTILEOFF;
585fb111
JB
526 u32 saveVGA0;
527 u32 saveVGA1;
528 u32 saveVGA_PD;
ba8bbcf6
JB
529 u32 saveVGACNTRL;
530 u32 saveADPA;
531 u32 saveLVDS;
585fb111
JB
532 u32 savePP_ON_DELAYS;
533 u32 savePP_OFF_DELAYS;
ba8bbcf6
JB
534 u32 saveDVOA;
535 u32 saveDVOB;
536 u32 saveDVOC;
537 u32 savePP_ON;
538 u32 savePP_OFF;
539 u32 savePP_CONTROL;
585fb111 540 u32 savePP_DIVISOR;
ba8bbcf6
JB
541 u32 savePFIT_CONTROL;
542 u32 save_palette_a[256];
543 u32 save_palette_b[256];
06027f91 544 u32 saveDPFC_CB_BASE;
ba8bbcf6
JB
545 u32 saveFBC_CFB_BASE;
546 u32 saveFBC_LL_BASE;
547 u32 saveFBC_CONTROL;
548 u32 saveFBC_CONTROL2;
0da3ea12
JB
549 u32 saveIER;
550 u32 saveIIR;
551 u32 saveIMR;
42048781
ZW
552 u32 saveDEIER;
553 u32 saveDEIMR;
554 u32 saveGTIER;
555 u32 saveGTIMR;
556 u32 saveFDI_RXA_IMR;
557 u32 saveFDI_RXB_IMR;
1f84e550 558 u32 saveCACHE_MODE_0;
1f84e550 559 u32 saveMI_ARB_STATE;
ba8bbcf6
JB
560 u32 saveSWF0[16];
561 u32 saveSWF1[16];
562 u32 saveSWF2[3];
563 u8 saveMSR;
564 u8 saveSR[8];
123f794f 565 u8 saveGR[25];
ba8bbcf6 566 u8 saveAR_INDEX;
a59e122a 567 u8 saveAR[21];
ba8bbcf6 568 u8 saveDACMASK;
a59e122a 569 u8 saveCR[37];
4b9de737 570 uint64_t saveFENCE[I915_MAX_NUM_FENCES];
1fd1c624
EA
571 u32 saveCURACNTR;
572 u32 saveCURAPOS;
573 u32 saveCURABASE;
574 u32 saveCURBCNTR;
575 u32 saveCURBPOS;
576 u32 saveCURBBASE;
577 u32 saveCURSIZE;
a4fc5ed6
KP
578 u32 saveDP_B;
579 u32 saveDP_C;
580 u32 saveDP_D;
581 u32 savePIPEA_GMCH_DATA_M;
582 u32 savePIPEB_GMCH_DATA_M;
583 u32 savePIPEA_GMCH_DATA_N;
584 u32 savePIPEB_GMCH_DATA_N;
585 u32 savePIPEA_DP_LINK_M;
586 u32 savePIPEB_DP_LINK_M;
587 u32 savePIPEA_DP_LINK_N;
588 u32 savePIPEB_DP_LINK_N;
42048781
ZW
589 u32 saveFDI_RXA_CTL;
590 u32 saveFDI_TXA_CTL;
591 u32 saveFDI_RXB_CTL;
592 u32 saveFDI_TXB_CTL;
593 u32 savePFA_CTL_1;
594 u32 savePFB_CTL_1;
595 u32 savePFA_WIN_SZ;
596 u32 savePFB_WIN_SZ;
597 u32 savePFA_WIN_POS;
598 u32 savePFB_WIN_POS;
5586c8bc
ZW
599 u32 savePCH_DREF_CONTROL;
600 u32 saveDISP_ARB_CTL;
601 u32 savePIPEA_DATA_M1;
602 u32 savePIPEA_DATA_N1;
603 u32 savePIPEA_LINK_M1;
604 u32 savePIPEA_LINK_N1;
605 u32 savePIPEB_DATA_M1;
606 u32 savePIPEB_DATA_N1;
607 u32 savePIPEB_LINK_M1;
608 u32 savePIPEB_LINK_N1;
b5b72e89 609 u32 saveMCHBAR_RENDER_STANDBY;
cda2bb78 610 u32 savePCH_PORT_HOTPLUG;
673a394b
EA
611
612 struct {
19966754 613 /** Bridge to intel-gtt-ko */
c64f7ba5 614 const struct intel_gtt *gtt;
19966754 615 /** Memory allocator for GTT stolen memory */
fe669bf8 616 struct drm_mm stolen;
19966754 617 /** Memory allocator for GTT */
673a394b 618 struct drm_mm gtt_space;
93a37f20
DV
619 /** List of all objects in gtt_space. Used to restore gtt
620 * mappings on resume */
621 struct list_head gtt_list;
bee4a186
CW
622
623 /** Usable portion of the GTT for GEM */
624 unsigned long gtt_start;
a6e0aa42 625 unsigned long gtt_mappable_end;
bee4a186 626 unsigned long gtt_end;
673a394b 627
0839ccb8 628 struct io_mapping *gtt_mapping;
ab657db1 629 int gtt_mtrr;
0839ccb8 630
1d2a314c
DV
631 /** PPGTT used for aliasing the PPGTT with the GTT */
632 struct i915_hw_ppgtt *aliasing_ppgtt;
633
17250b71 634 struct shrinker inactive_shrinker;
31169714 635
69dc4987
CW
636 /**
637 * List of objects currently involved in rendering.
638 *
639 * Includes buffers having the contents of their GPU caches
640 * flushed, not necessarily primitives. last_rendering_seqno
641 * represents when the rendering involved will be completed.
642 *
643 * A reference is held on the buffer while on this list.
644 */
645 struct list_head active_list;
646
673a394b
EA
647 /**
648 * List of objects which are not in the ringbuffer but which
649 * still have a write_domain which needs to be flushed before
650 * unbinding.
651 *
ce44b0ea
EA
652 * last_rendering_seqno is 0 while an object is in this list.
653 *
673a394b
EA
654 * A reference is held on the buffer while on this list.
655 */
656 struct list_head flushing_list;
657
658 /**
659 * LRU list of objects which are not in the ringbuffer and
660 * are ready to unbind, but are still in the GTT.
661 *
ce44b0ea
EA
662 * last_rendering_seqno is 0 while an object is in this list.
663 *
673a394b
EA
664 * A reference is not held on the buffer while on this list,
665 * as merely being GTT-bound shouldn't prevent its being
666 * freed, and we'll pull it off the list in the free path.
667 */
668 struct list_head inactive_list;
669
f13d3f73
CW
670 /**
671 * LRU list of objects which are not in the ringbuffer but
672 * are still pinned in the GTT.
673 */
674 struct list_head pinned_list;
675
a09ba7fa
EA
676 /** LRU list of objects with fence regs on them. */
677 struct list_head fence_list;
678
be72615b
CW
679 /**
680 * List of objects currently pending being freed.
681 *
682 * These objects are no longer in use, but due to a signal
683 * we were prevented from freeing them at the appointed time.
684 */
685 struct list_head deferred_free_list;
686
673a394b
EA
687 /**
688 * We leave the user IRQ off as much as possible,
689 * but this means that requests will finish and never
690 * be retired once the system goes idle. Set a timer to
691 * fire periodically while the ring is running. When it
692 * fires, go retire requests.
693 */
694 struct delayed_work retire_work;
695
ce453d81
CW
696 /**
697 * Are we in a non-interruptible section of code like
698 * modesetting?
699 */
700 bool interruptible;
701
673a394b
EA
702 /**
703 * Flag if the X Server, and thus DRM, is not currently in
704 * control of the device.
705 *
706 * This is set between LeaveVT and EnterVT. It needs to be
707 * replaced with a semaphore. It also needs to be
708 * transitioned away from for kernel modesetting.
709 */
710 int suspended;
711
712 /**
713 * Flag if the hardware appears to be wedged.
714 *
715 * This is set when attempts to idle the device timeout.
25985edc 716 * It prevents command submission from occurring and makes
673a394b
EA
717 * every pending request fail
718 */
ba1234d1 719 atomic_t wedged;
673a394b
EA
720
721 /** Bit 6 swizzling required for X tiling */
722 uint32_t bit_6_swizzle_x;
723 /** Bit 6 swizzling required for Y tiling */
724 uint32_t bit_6_swizzle_y;
71acb5eb
DA
725
726 /* storage for physical objects */
727 struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT];
9220434a 728
73aa808f 729 /* accounting, useful for userland debugging */
73aa808f 730 size_t gtt_total;
6299f992
CW
731 size_t mappable_gtt_total;
732 size_t object_memory;
73aa808f 733 u32 object_count;
673a394b 734 } mm;
9b9d172d 735 struct sdvo_device_mapping sdvo_mappings[2];
a3e17eb8
ZY
736 /* indicate whether the LVDS_BORDER should be enabled or not */
737 unsigned int lvds_border_bits;
1d8e1c75
CW
738 /* Panel fitter placement and size for Ironlake+ */
739 u32 pch_pf_pos, pch_pf_size;
652c393a 740
27f8227b
JB
741 struct drm_crtc *plane_to_crtc_mapping[3];
742 struct drm_crtc *pipe_to_crtc_mapping[3];
6b95a207 743 wait_queue_head_t pending_flip_queue;
1afe3e9d 744 bool flip_pending_is_done;
6b95a207 745
652c393a
JB
746 /* Reclocking support */
747 bool render_reclock_avail;
748 bool lvds_downclock_avail;
18f9ed12
ZY
749 /* indicates the reduced downclock for LVDS*/
750 int lvds_downclock;
652c393a
JB
751 struct work_struct idle_work;
752 struct timer_list idle_timer;
753 bool busy;
754 u16 orig_clock;
6363ee6f
ZY
755 int child_dev_num;
756 struct child_device_config *child_dev;
a2565377 757 struct drm_connector *int_lvds_connector;
aaa6fd2a 758 struct drm_connector *int_edp_connector;
f97108d1 759
c4804411 760 bool mchbar_need_disable;
f97108d1 761
4912d041
BW
762 struct work_struct rps_work;
763 spinlock_t rps_lock;
764 u32 pm_iir;
765
f97108d1
JB
766 u8 cur_delay;
767 u8 min_delay;
768 u8 max_delay;
7648fa99
JB
769 u8 fmax;
770 u8 fstart;
771
05394f39
CW
772 u64 last_count1;
773 unsigned long last_time1;
4ed0b577 774 unsigned long chipset_power;
05394f39
CW
775 u64 last_count2;
776 struct timespec last_time2;
777 unsigned long gfx_power;
778 int c_m;
779 int r_t;
780 u8 corr;
7648fa99 781 spinlock_t *mchdev_lock;
b5e50c3f
JB
782
783 enum no_fbc_reason no_fbc_reason;
38651674 784
20bf377e
JB
785 struct drm_mm_node *compressed_fb;
786 struct drm_mm_node *compressed_llb;
34dc4d44 787
ae681d96
CW
788 unsigned long last_gpu_reset;
789
8be48d92
DA
790 /* list of fbdev register on this device */
791 struct intel_fbdev *fbdev;
e953fd7b 792
aaa6fd2a
MG
793 struct backlight_device *backlight;
794
e953fd7b 795 struct drm_property *broadcast_rgb_property;
3f43c48d 796 struct drm_property *force_audio_property;
1da177e4
LT
797} drm_i915_private_t;
798
b1d7e4b4
WF
799enum hdmi_force_audio {
800 HDMI_AUDIO_OFF_DVI = -2, /* no aux data for HDMI-DVI converter */
801 HDMI_AUDIO_OFF, /* force turn off HDMI audio */
802 HDMI_AUDIO_AUTO, /* trust EDID */
803 HDMI_AUDIO_ON, /* force turn on HDMI audio */
804};
805
93dfb40c
CW
806enum i915_cache_level {
807 I915_CACHE_NONE,
808 I915_CACHE_LLC,
809 I915_CACHE_LLC_MLC, /* gen6+ */
810};
811
673a394b 812struct drm_i915_gem_object {
c397b908 813 struct drm_gem_object base;
673a394b
EA
814
815 /** Current space allocated to this object in the GTT, if any. */
816 struct drm_mm_node *gtt_space;
93a37f20 817 struct list_head gtt_list;
673a394b
EA
818
819 /** This object's place on the active/flushing/inactive lists */
69dc4987
CW
820 struct list_head ring_list;
821 struct list_head mm_list;
99fcb766
DV
822 /** This object's place on GPU write list */
823 struct list_head gpu_write_list;
432e58ed
CW
824 /** This object's place in the batchbuffer or on the eviction list */
825 struct list_head exec_list;
673a394b
EA
826
827 /**
828 * This is set if the object is on the active or flushing lists
829 * (has pending rendering), and is not set if it's on inactive (ready
830 * to be unbound).
831 */
0206e353 832 unsigned int active:1;
673a394b
EA
833
834 /**
835 * This is set if the object has been written to since last bound
836 * to the GTT
837 */
0206e353 838 unsigned int dirty:1;
778c3544 839
87ca9c8a
CW
840 /**
841 * This is set if the object has been written to since the last
842 * GPU flush.
843 */
0206e353 844 unsigned int pending_gpu_write:1;
87ca9c8a 845
778c3544
DV
846 /**
847 * Fence register bits (if any) for this object. Will be set
848 * as needed when mapped into the GTT.
849 * Protected by dev->struct_mutex.
778c3544 850 */
4b9de737 851 signed int fence_reg:I915_MAX_NUM_FENCE_BITS;
778c3544 852
778c3544
DV
853 /**
854 * Advice: are the backing pages purgeable?
855 */
0206e353 856 unsigned int madv:2;
778c3544 857
778c3544
DV
858 /**
859 * Current tiling mode for the object.
860 */
0206e353
AJ
861 unsigned int tiling_mode:2;
862 unsigned int tiling_changed:1;
778c3544
DV
863
864 /** How many users have pinned this object in GTT space. The following
865 * users can each hold at most one reference: pwrite/pread, pin_ioctl
866 * (via user_pin_count), execbuffer (objects are not allowed multiple
867 * times for the same batchbuffer), and the framebuffer code. When
868 * switching/pageflipping, the framebuffer code has at most two buffers
869 * pinned per crtc.
870 *
871 * In the worst case this is 1 + 1 + 1 + 2*2 = 7. That would fit into 3
872 * bits with absolutely no headroom. So use 4 bits. */
0206e353 873 unsigned int pin_count:4;
778c3544 874#define DRM_I915_GEM_OBJECT_MAX_PIN_COUNT 0xf
673a394b 875
75e9e915
DV
876 /**
877 * Is the object at the current location in the gtt mappable and
878 * fenceable? Used to avoid costly recalculations.
879 */
0206e353 880 unsigned int map_and_fenceable:1;
75e9e915 881
fb7d516a
DV
882 /**
883 * Whether the current gtt mapping needs to be mappable (and isn't just
884 * mappable by accident). Track pin and fault separate for a more
885 * accurate mappable working set.
886 */
0206e353
AJ
887 unsigned int fault_mappable:1;
888 unsigned int pin_mappable:1;
fb7d516a 889
caea7476
CW
890 /*
891 * Is the GPU currently using a fence to access this buffer,
892 */
893 unsigned int pending_fenced_gpu_access:1;
894 unsigned int fenced_gpu_access:1;
895
93dfb40c
CW
896 unsigned int cache_level:2;
897
7bddb01f 898 unsigned int has_aliasing_ppgtt_mapping:1;
74898d7e 899 unsigned int has_global_gtt_mapping:1;
7bddb01f 900
856fa198 901 struct page **pages;
673a394b 902
185cbcb3
DV
903 /**
904 * DMAR support
905 */
906 struct scatterlist *sg_list;
907 int num_sg;
908
67731b87
CW
909 /**
910 * Used for performing relocations during execbuffer insertion.
911 */
912 struct hlist_node exec_node;
913 unsigned long exec_handle;
6fe4f140 914 struct drm_i915_gem_exec_object2 *exec_entry;
67731b87 915
673a394b
EA
916 /**
917 * Current offset of the object in GTT space.
918 *
919 * This is the same as gtt_space->start
920 */
921 uint32_t gtt_offset;
e67b8ce1 922
673a394b
EA
923 /** Breadcrumb of last rendering to the buffer. */
924 uint32_t last_rendering_seqno;
caea7476
CW
925 struct intel_ring_buffer *ring;
926
927 /** Breadcrumb of last fenced GPU access to the buffer. */
928 uint32_t last_fenced_seqno;
929 struct intel_ring_buffer *last_fenced_ring;
673a394b 930
778c3544 931 /** Current tiling stride for the object, if it's tiled. */
de151cf6 932 uint32_t stride;
673a394b 933
280b713b 934 /** Record of address bit 17 of each page at last unbind. */
d312ec25 935 unsigned long *bit_17;
280b713b 936
79e53945
JB
937 /** User space pin count and filp owning the pin */
938 uint32_t user_pin_count;
939 struct drm_file *pin_filp;
71acb5eb
DA
940
941 /** for phy allocated objects */
942 struct drm_i915_gem_phys_object *phys_obj;
b70d11da 943
6b95a207
KH
944 /**
945 * Number of crtcs where this object is currently the fb, but
946 * will be page flipped away on the next vblank. When it
947 * reaches 0, dev_priv->pending_flip_queue will be woken up.
948 */
949 atomic_t pending_flip;
673a394b
EA
950};
951
62b8b215 952#define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
23010e43 953
673a394b
EA
954/**
955 * Request queue structure.
956 *
957 * The request queue allows us to note sequence numbers that have been emitted
958 * and may be associated with active buffers to be retired.
959 *
960 * By keeping this list, we can avoid having to do questionable
961 * sequence-number comparisons on buffer last_rendering_seqnos, and associate
962 * an emission time with seqnos for tracking how far ahead of the GPU we are.
963 */
964struct drm_i915_gem_request {
852835f3
ZN
965 /** On Which ring this request was generated */
966 struct intel_ring_buffer *ring;
967
673a394b
EA
968 /** GEM sequence number associated with this request. */
969 uint32_t seqno;
970
a71d8d94
CW
971 /** Postion in the ringbuffer of the end of the request */
972 u32 tail;
973
673a394b
EA
974 /** Time at which this request was emitted, in jiffies. */
975 unsigned long emitted_jiffies;
976
b962442e 977 /** global list entry for this request */
673a394b 978 struct list_head list;
b962442e 979
f787a5f5 980 struct drm_i915_file_private *file_priv;
b962442e
EA
981 /** file_priv list entry for this request */
982 struct list_head client_list;
673a394b
EA
983};
984
985struct drm_i915_file_private {
986 struct {
1c25595f 987 struct spinlock lock;
b962442e 988 struct list_head request_list;
673a394b
EA
989 } mm;
990};
991
cae5852d
ZN
992#define INTEL_INFO(dev) (((struct drm_i915_private *) (dev)->dev_private)->info)
993
994#define IS_I830(dev) ((dev)->pci_device == 0x3577)
995#define IS_845G(dev) ((dev)->pci_device == 0x2562)
996#define IS_I85X(dev) (INTEL_INFO(dev)->is_i85x)
997#define IS_I865G(dev) ((dev)->pci_device == 0x2572)
998#define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g)
999#define IS_I915GM(dev) ((dev)->pci_device == 0x2592)
1000#define IS_I945G(dev) ((dev)->pci_device == 0x2772)
1001#define IS_I945GM(dev) (INTEL_INFO(dev)->is_i945gm)
1002#define IS_BROADWATER(dev) (INTEL_INFO(dev)->is_broadwater)
1003#define IS_CRESTLINE(dev) (INTEL_INFO(dev)->is_crestline)
1004#define IS_GM45(dev) ((dev)->pci_device == 0x2A42)
1005#define IS_G4X(dev) (INTEL_INFO(dev)->is_g4x)
1006#define IS_PINEVIEW_G(dev) ((dev)->pci_device == 0xa001)
1007#define IS_PINEVIEW_M(dev) ((dev)->pci_device == 0xa011)
1008#define IS_PINEVIEW(dev) (INTEL_INFO(dev)->is_pineview)
1009#define IS_G33(dev) (INTEL_INFO(dev)->is_g33)
1010#define IS_IRONLAKE_D(dev) ((dev)->pci_device == 0x0042)
1011#define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046)
4b65177b 1012#define IS_IVYBRIDGE(dev) (INTEL_INFO(dev)->is_ivybridge)
70a3eb7a 1013#define IS_VALLEYVIEW(dev) (INTEL_INFO(dev)->is_valleyview)
4cae9ae0 1014#define IS_HASWELL(dev) (INTEL_INFO(dev)->is_haswell)
cae5852d
ZN
1015#define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
1016
85436696
JB
1017/*
1018 * The genX designation typically refers to the render engine, so render
1019 * capability related checks should use IS_GEN, while display and other checks
1020 * have their own (e.g. HAS_PCH_SPLIT for ILK+ display, IS_foo for particular
1021 * chips, etc.).
1022 */
cae5852d
ZN
1023#define IS_GEN2(dev) (INTEL_INFO(dev)->gen == 2)
1024#define IS_GEN3(dev) (INTEL_INFO(dev)->gen == 3)
1025#define IS_GEN4(dev) (INTEL_INFO(dev)->gen == 4)
1026#define IS_GEN5(dev) (INTEL_INFO(dev)->gen == 5)
1027#define IS_GEN6(dev) (INTEL_INFO(dev)->gen == 6)
85436696 1028#define IS_GEN7(dev) (INTEL_INFO(dev)->gen == 7)
cae5852d
ZN
1029
1030#define HAS_BSD(dev) (INTEL_INFO(dev)->has_bsd_ring)
1031#define HAS_BLT(dev) (INTEL_INFO(dev)->has_blt_ring)
3d29b842 1032#define HAS_LLC(dev) (INTEL_INFO(dev)->has_llc)
cae5852d
ZN
1033#define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws)
1034
1d2a314c
DV
1035#define HAS_ALIASING_PPGTT(dev) (INTEL_INFO(dev)->gen >=6)
1036
05394f39 1037#define HAS_OVERLAY(dev) (INTEL_INFO(dev)->has_overlay)
cae5852d
ZN
1038#define OVERLAY_NEEDS_PHYSICAL(dev) (INTEL_INFO(dev)->overlay_needs_physical)
1039
1040/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
1041 * rows, which changed the alignment requirements and fence programming.
1042 */
1043#define HAS_128_BYTE_Y_TILING(dev) (!IS_GEN2(dev) && !(IS_I915G(dev) || \
1044 IS_I915GM(dev)))
1045#define SUPPORTS_DIGITAL_OUTPUTS(dev) (!IS_GEN2(dev) && !IS_PINEVIEW(dev))
1046#define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_GEN5(dev))
1047#define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_GEN5(dev))
1048#define SUPPORTS_EDP(dev) (IS_IRONLAKE_M(dev))
1049#define SUPPORTS_TV(dev) (INTEL_INFO(dev)->supports_tv)
1050#define I915_HAS_HOTPLUG(dev) (INTEL_INFO(dev)->has_hotplug)
1051/* dsparb controlled by hw only */
1052#define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev))
1053
1054#define HAS_FW_BLC(dev) (INTEL_INFO(dev)->gen > 2)
1055#define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr)
1056#define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc)
cae5852d 1057
7e508a27 1058#define HAS_PCH_SPLIT(dev) (INTEL_INFO(dev)->has_pch_split)
eceae481 1059#define HAS_PIPE_CONTROL(dev) (INTEL_INFO(dev)->gen >= 5)
cae5852d
ZN
1060
1061#define INTEL_PCH_TYPE(dev) (((struct drm_i915_private *)(dev)->dev_private)->pch_type)
eb877ebf 1062#define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT)
cae5852d
ZN
1063#define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT)
1064#define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX)
1065
05394f39
CW
1066#include "i915_trace.h"
1067
c153f45f 1068extern struct drm_ioctl_desc i915_ioctls[];
b3a83639 1069extern int i915_max_ioctl;
a35d9d3c
BW
1070extern unsigned int i915_fbpercrtc __always_unused;
1071extern int i915_panel_ignore_lid __read_mostly;
1072extern unsigned int i915_powersave __read_mostly;
f45b5557 1073extern int i915_semaphores __read_mostly;
a35d9d3c 1074extern unsigned int i915_lvds_downclock __read_mostly;
121d527a 1075extern int i915_lvds_channel_mode __read_mostly;
4415e63b 1076extern int i915_panel_use_ssc __read_mostly;
a35d9d3c 1077extern int i915_vbt_sdvo_panel_type __read_mostly;
c0f372b3 1078extern int i915_enable_rc6 __read_mostly;
4415e63b 1079extern int i915_enable_fbc __read_mostly;
a35d9d3c 1080extern bool i915_enable_hangcheck __read_mostly;
e21af88d 1081extern bool i915_enable_ppgtt __read_mostly;
b3a83639 1082
6a9ee8af
DA
1083extern int i915_suspend(struct drm_device *dev, pm_message_t state);
1084extern int i915_resume(struct drm_device *dev);
7c1c2871
DA
1085extern int i915_master_create(struct drm_device *dev, struct drm_master *master);
1086extern void i915_master_destroy(struct drm_device *dev, struct drm_master *master);
1087
1da177e4 1088 /* i915_dma.c */
84b1fd10 1089extern void i915_kernel_lost_context(struct drm_device * dev);
22eae947 1090extern int i915_driver_load(struct drm_device *, unsigned long flags);
ba8bbcf6 1091extern int i915_driver_unload(struct drm_device *);
673a394b 1092extern int i915_driver_open(struct drm_device *dev, struct drm_file *file_priv);
84b1fd10 1093extern void i915_driver_lastclose(struct drm_device * dev);
6c340eac
EA
1094extern void i915_driver_preclose(struct drm_device *dev,
1095 struct drm_file *file_priv);
673a394b
EA
1096extern void i915_driver_postclose(struct drm_device *dev,
1097 struct drm_file *file_priv);
84b1fd10 1098extern int i915_driver_device_is_agp(struct drm_device * dev);
0d6aa60b
DA
1099extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
1100 unsigned long arg);
673a394b 1101extern int i915_emit_box(struct drm_device *dev,
c4e7a414
CW
1102 struct drm_clip_rect *box,
1103 int DR1, int DR4);
f803aa55 1104extern int i915_reset(struct drm_device *dev, u8 flags);
7648fa99
JB
1105extern unsigned long i915_chipset_val(struct drm_i915_private *dev_priv);
1106extern unsigned long i915_mch_val(struct drm_i915_private *dev_priv);
1107extern unsigned long i915_gfx_val(struct drm_i915_private *dev_priv);
1108extern void i915_update_gfx_val(struct drm_i915_private *dev_priv);
1109
af6061af 1110
1da177e4 1111/* i915_irq.c */
f65d9421 1112void i915_hangcheck_elapsed(unsigned long data);
527f9e90 1113void i915_handle_error(struct drm_device *dev, bool wedged);
c153f45f
EA
1114extern int i915_irq_emit(struct drm_device *dev, void *data,
1115 struct drm_file *file_priv);
1116extern int i915_irq_wait(struct drm_device *dev, void *data,
1117 struct drm_file *file_priv);
1da177e4 1118
f71d4af4 1119extern void intel_irq_init(struct drm_device *dev);
b1f14ad0 1120
c153f45f
EA
1121extern int i915_vblank_pipe_set(struct drm_device *dev, void *data,
1122 struct drm_file *file_priv);
1123extern int i915_vblank_pipe_get(struct drm_device *dev, void *data,
1124 struct drm_file *file_priv);
1125extern int i915_vblank_swap(struct drm_device *dev, void *data,
1126 struct drm_file *file_priv);
1da177e4 1127
7c463586
KP
1128void
1129i915_enable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask);
1130
1131void
1132i915_disable_pipestat(drm_i915_private_t *dev_priv, int pipe, u32 mask);
1133
0206e353 1134void intel_enable_asle(struct drm_device *dev);
01c66889 1135
3bd3c932
CW
1136#ifdef CONFIG_DEBUG_FS
1137extern void i915_destroy_error_state(struct drm_device *dev);
1138#else
1139#define i915_destroy_error_state(x)
1140#endif
1141
7c463586 1142
673a394b
EA
1143/* i915_gem.c */
1144int i915_gem_init_ioctl(struct drm_device *dev, void *data,
1145 struct drm_file *file_priv);
1146int i915_gem_create_ioctl(struct drm_device *dev, void *data,
1147 struct drm_file *file_priv);
1148int i915_gem_pread_ioctl(struct drm_device *dev, void *data,
1149 struct drm_file *file_priv);
1150int i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
1151 struct drm_file *file_priv);
1152int i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
1153 struct drm_file *file_priv);
de151cf6
JB
1154int i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
1155 struct drm_file *file_priv);
673a394b
EA
1156int i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
1157 struct drm_file *file_priv);
1158int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
1159 struct drm_file *file_priv);
1160int i915_gem_execbuffer(struct drm_device *dev, void *data,
1161 struct drm_file *file_priv);
76446cac
JB
1162int i915_gem_execbuffer2(struct drm_device *dev, void *data,
1163 struct drm_file *file_priv);
673a394b
EA
1164int i915_gem_pin_ioctl(struct drm_device *dev, void *data,
1165 struct drm_file *file_priv);
1166int i915_gem_unpin_ioctl(struct drm_device *dev, void *data,
1167 struct drm_file *file_priv);
1168int i915_gem_busy_ioctl(struct drm_device *dev, void *data,
1169 struct drm_file *file_priv);
1170int i915_gem_throttle_ioctl(struct drm_device *dev, void *data,
1171 struct drm_file *file_priv);
3ef94daa
CW
1172int i915_gem_madvise_ioctl(struct drm_device *dev, void *data,
1173 struct drm_file *file_priv);
673a394b
EA
1174int i915_gem_entervt_ioctl(struct drm_device *dev, void *data,
1175 struct drm_file *file_priv);
1176int i915_gem_leavevt_ioctl(struct drm_device *dev, void *data,
1177 struct drm_file *file_priv);
1178int i915_gem_set_tiling(struct drm_device *dev, void *data,
1179 struct drm_file *file_priv);
1180int i915_gem_get_tiling(struct drm_device *dev, void *data,
1181 struct drm_file *file_priv);
5a125c3c
EA
1182int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
1183 struct drm_file *file_priv);
673a394b 1184void i915_gem_load(struct drm_device *dev);
673a394b 1185int i915_gem_init_object(struct drm_gem_object *obj);
db53a302 1186int __must_check i915_gem_flush_ring(struct intel_ring_buffer *ring,
88241785
CW
1187 uint32_t invalidate_domains,
1188 uint32_t flush_domains);
05394f39
CW
1189struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
1190 size_t size);
673a394b 1191void i915_gem_free_object(struct drm_gem_object *obj);
2021746e
CW
1192int __must_check i915_gem_object_pin(struct drm_i915_gem_object *obj,
1193 uint32_t alignment,
1194 bool map_and_fenceable);
05394f39 1195void i915_gem_object_unpin(struct drm_i915_gem_object *obj);
2021746e 1196int __must_check i915_gem_object_unbind(struct drm_i915_gem_object *obj);
05394f39 1197void i915_gem_release_mmap(struct drm_i915_gem_object *obj);
673a394b 1198void i915_gem_lastclose(struct drm_device *dev);
f787a5f5 1199
54cf91dc 1200int __must_check i915_mutex_lock_interruptible(struct drm_device *dev);
ce453d81 1201int __must_check i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj);
54cf91dc 1202void i915_gem_object_move_to_active(struct drm_i915_gem_object *obj,
1ec14ad3
CW
1203 struct intel_ring_buffer *ring,
1204 u32 seqno);
54cf91dc 1205
ff72145b
DA
1206int i915_gem_dumb_create(struct drm_file *file_priv,
1207 struct drm_device *dev,
1208 struct drm_mode_create_dumb *args);
1209int i915_gem_mmap_gtt(struct drm_file *file_priv, struct drm_device *dev,
1210 uint32_t handle, uint64_t *offset);
1211int i915_gem_dumb_destroy(struct drm_file *file_priv, struct drm_device *dev,
0206e353 1212 uint32_t handle);
f787a5f5
CW
1213/**
1214 * Returns true if seq1 is later than seq2.
1215 */
1216static inline bool
1217i915_seqno_passed(uint32_t seq1, uint32_t seq2)
1218{
1219 return (int32_t)(seq1 - seq2) >= 0;
1220}
1221
53d227f2 1222u32 i915_gem_next_request_seqno(struct intel_ring_buffer *ring);
54cf91dc 1223
d9e86c0e 1224int __must_check i915_gem_object_get_fence(struct drm_i915_gem_object *obj,
ce453d81 1225 struct intel_ring_buffer *pipelined);
d9e86c0e 1226int __must_check i915_gem_object_put_fence(struct drm_i915_gem_object *obj);
2021746e 1227
1690e1eb
CW
1228static inline void
1229i915_gem_object_pin_fence(struct drm_i915_gem_object *obj)
1230{
1231 if (obj->fence_reg != I915_FENCE_REG_NONE) {
1232 struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
1233 dev_priv->fence_regs[obj->fence_reg].pin_count++;
1234 }
1235}
1236
1237static inline void
1238i915_gem_object_unpin_fence(struct drm_i915_gem_object *obj)
1239{
1240 if (obj->fence_reg != I915_FENCE_REG_NONE) {
1241 struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
1242 dev_priv->fence_regs[obj->fence_reg].pin_count--;
1243 }
1244}
1245
b09a1fec 1246void i915_gem_retire_requests(struct drm_device *dev);
a71d8d94
CW
1247void i915_gem_retire_requests_ring(struct intel_ring_buffer *ring);
1248
069efc1d 1249void i915_gem_reset(struct drm_device *dev);
05394f39 1250void i915_gem_clflush_object(struct drm_i915_gem_object *obj);
2021746e
CW
1251int __must_check i915_gem_object_set_domain(struct drm_i915_gem_object *obj,
1252 uint32_t read_domains,
1253 uint32_t write_domain);
a8198eea 1254int __must_check i915_gem_object_finish_gpu(struct drm_i915_gem_object *obj);
f691e2f4
DV
1255int __must_check i915_gem_init_hw(struct drm_device *dev);
1256void i915_gem_init_swizzling(struct drm_device *dev);
e21af88d 1257void i915_gem_init_ppgtt(struct drm_device *dev);
79e53945 1258void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
b93f9cf1 1259int __must_check i915_gpu_idle(struct drm_device *dev, bool do_retire);
2021746e 1260int __must_check i915_gem_idle(struct drm_device *dev);
db53a302
CW
1261int __must_check i915_add_request(struct intel_ring_buffer *ring,
1262 struct drm_file *file,
1263 struct drm_i915_gem_request *request);
1264int __must_check i915_wait_request(struct intel_ring_buffer *ring,
b93f9cf1
BW
1265 uint32_t seqno,
1266 bool do_retire);
de151cf6 1267int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
2021746e
CW
1268int __must_check
1269i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj,
1270 bool write);
1271int __must_check
dabdfe02
CW
1272i915_gem_object_set_to_cpu_domain(struct drm_i915_gem_object *obj, bool write);
1273int __must_check
2da3b9b9
CW
1274i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
1275 u32 alignment,
2021746e 1276 struct intel_ring_buffer *pipelined);
71acb5eb 1277int i915_gem_attach_phys_object(struct drm_device *dev,
05394f39 1278 struct drm_i915_gem_object *obj,
6eeefaf3
CW
1279 int id,
1280 int align);
71acb5eb 1281void i915_gem_detach_phys_object(struct drm_device *dev,
05394f39 1282 struct drm_i915_gem_object *obj);
71acb5eb 1283void i915_gem_free_all_phys_object(struct drm_device *dev);
05394f39 1284void i915_gem_release(struct drm_device *dev, struct drm_file *file);
673a394b 1285
467cffba 1286uint32_t
e28f8711
CW
1287i915_gem_get_unfenced_gtt_alignment(struct drm_device *dev,
1288 uint32_t size,
1289 int tiling_mode);
467cffba 1290
e4ffd173
CW
1291int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
1292 enum i915_cache_level cache_level);
1293
76aaf220 1294/* i915_gem_gtt.c */
1d2a314c
DV
1295int __must_check i915_gem_init_aliasing_ppgtt(struct drm_device *dev);
1296void i915_gem_cleanup_aliasing_ppgtt(struct drm_device *dev);
7bddb01f
DV
1297void i915_ppgtt_bind_object(struct i915_hw_ppgtt *ppgtt,
1298 struct drm_i915_gem_object *obj,
1299 enum i915_cache_level cache_level);
1300void i915_ppgtt_unbind_object(struct i915_hw_ppgtt *ppgtt,
1301 struct drm_i915_gem_object *obj);
1d2a314c 1302
76aaf220 1303void i915_gem_restore_gtt_mappings(struct drm_device *dev);
74163907
DV
1304int __must_check i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj);
1305void i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj,
e4ffd173 1306 enum i915_cache_level cache_level);
05394f39 1307void i915_gem_gtt_unbind_object(struct drm_i915_gem_object *obj);
74163907 1308void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj);
644ec02b
DV
1309void i915_gem_init_global_gtt(struct drm_device *dev,
1310 unsigned long start,
1311 unsigned long mappable_end,
1312 unsigned long end);
76aaf220 1313
b47eb4a2 1314/* i915_gem_evict.c */
2021746e
CW
1315int __must_check i915_gem_evict_something(struct drm_device *dev, int min_size,
1316 unsigned alignment, bool mappable);
1317int __must_check i915_gem_evict_everything(struct drm_device *dev,
1318 bool purgeable_only);
1319int __must_check i915_gem_evict_inactive(struct drm_device *dev,
1320 bool purgeable_only);
b47eb4a2 1321
673a394b
EA
1322/* i915_gem_tiling.c */
1323void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
05394f39
CW
1324void i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj);
1325void i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj);
673a394b
EA
1326
1327/* i915_gem_debug.c */
05394f39 1328void i915_gem_dump_object(struct drm_i915_gem_object *obj, int len,
673a394b 1329 const char *where, uint32_t mark);
23bc5982
CW
1330#if WATCH_LISTS
1331int i915_verify_lists(struct drm_device *dev);
673a394b 1332#else
23bc5982 1333#define i915_verify_lists(dev) 0
673a394b 1334#endif
05394f39
CW
1335void i915_gem_object_check_coherency(struct drm_i915_gem_object *obj,
1336 int handle);
1337void i915_gem_dump_object(struct drm_i915_gem_object *obj, int len,
673a394b 1338 const char *where, uint32_t mark);
1da177e4 1339
2017263e 1340/* i915_debugfs.c */
27c202ad
BG
1341int i915_debugfs_init(struct drm_minor *minor);
1342void i915_debugfs_cleanup(struct drm_minor *minor);
2017263e 1343
317c35d1
JB
1344/* i915_suspend.c */
1345extern int i915_save_state(struct drm_device *dev);
1346extern int i915_restore_state(struct drm_device *dev);
0a3e67a4
JB
1347
1348/* i915_suspend.c */
1349extern int i915_save_state(struct drm_device *dev);
1350extern int i915_restore_state(struct drm_device *dev);
317c35d1 1351
f899fc64
CW
1352/* intel_i2c.c */
1353extern int intel_setup_gmbus(struct drm_device *dev);
1354extern void intel_teardown_gmbus(struct drm_device *dev);
3bd7d909
DK
1355extern inline bool intel_gmbus_is_port_valid(unsigned port)
1356{
2ed06c93 1357 return (port >= GMBUS_PORT_SSC && port <= GMBUS_PORT_DPD);
3bd7d909
DK
1358}
1359
1360extern struct i2c_adapter *intel_gmbus_get_adapter(
1361 struct drm_i915_private *dev_priv, unsigned port);
e957d772
CW
1362extern void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed);
1363extern void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit);
b8232e90
CW
1364extern inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter)
1365{
1366 return container_of(adapter, struct intel_gmbus, adapter)->force_bit;
1367}
f899fc64
CW
1368extern void intel_i2c_reset(struct drm_device *dev);
1369
3b617967 1370/* intel_opregion.c */
44834a67
CW
1371extern int intel_opregion_setup(struct drm_device *dev);
1372#ifdef CONFIG_ACPI
1373extern void intel_opregion_init(struct drm_device *dev);
1374extern void intel_opregion_fini(struct drm_device *dev);
3b617967
CW
1375extern void intel_opregion_asle_intr(struct drm_device *dev);
1376extern void intel_opregion_gse_intr(struct drm_device *dev);
1377extern void intel_opregion_enable_asle(struct drm_device *dev);
65e082c9 1378#else
44834a67
CW
1379static inline void intel_opregion_init(struct drm_device *dev) { return; }
1380static inline void intel_opregion_fini(struct drm_device *dev) { return; }
3b617967
CW
1381static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; }
1382static inline void intel_opregion_gse_intr(struct drm_device *dev) { return; }
1383static inline void intel_opregion_enable_asle(struct drm_device *dev) { return; }
65e082c9 1384#endif
8ee1c3db 1385
723bfd70
JB
1386/* intel_acpi.c */
1387#ifdef CONFIG_ACPI
1388extern void intel_register_dsm_handler(void);
1389extern void intel_unregister_dsm_handler(void);
1390#else
1391static inline void intel_register_dsm_handler(void) { return; }
1392static inline void intel_unregister_dsm_handler(void) { return; }
1393#endif /* CONFIG_ACPI */
1394
79e53945
JB
1395/* modesetting */
1396extern void intel_modeset_init(struct drm_device *dev);
2c7111db 1397extern void intel_modeset_gem_init(struct drm_device *dev);
79e53945 1398extern void intel_modeset_cleanup(struct drm_device *dev);
28d52043 1399extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state);
ee5382ae 1400extern bool intel_fbc_enabled(struct drm_device *dev);
43a9539f 1401extern void intel_disable_fbc(struct drm_device *dev);
7648fa99 1402extern bool ironlake_set_drps(struct drm_device *dev, u8 val);
9fb526db 1403extern void ironlake_init_pch_refclk(struct drm_device *dev);
d5bb081b 1404extern void ironlake_enable_rc6(struct drm_device *dev);
3b8d8d91 1405extern void gen6_set_rps(struct drm_device *dev, u8 val);
0206e353
AJ
1406extern void intel_detect_pch(struct drm_device *dev);
1407extern int intel_trans_dp_port_sel(struct drm_crtc *crtc);
3bad0781 1408
8d715f00
KP
1409extern void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv);
1410extern void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv);
1411extern void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv);
1412extern void __gen6_gt_force_wake_mt_put(struct drm_i915_private *dev_priv);
1413
575155a9
JB
1414extern void vlv_force_wake_get(struct drm_i915_private *dev_priv);
1415extern void vlv_force_wake_put(struct drm_i915_private *dev_priv);
1416
6ef3d427 1417/* overlay */
3bd3c932 1418#ifdef CONFIG_DEBUG_FS
6ef3d427
CW
1419extern struct intel_overlay_error_state *intel_overlay_capture_error_state(struct drm_device *dev);
1420extern void intel_overlay_print_error_state(struct seq_file *m, struct intel_overlay_error_state *error);
c4a1d9e4
CW
1421
1422extern struct intel_display_error_state *intel_display_capture_error_state(struct drm_device *dev);
1423extern void intel_display_print_error_state(struct seq_file *m,
1424 struct drm_device *dev,
1425 struct intel_display_error_state *error);
3bd3c932 1426#endif
6ef3d427 1427
1ec14ad3
CW
1428#define LP_RING(d) (&((struct drm_i915_private *)(d))->ring[RCS])
1429
1430#define BEGIN_LP_RING(n) \
1431 intel_ring_begin(LP_RING(dev_priv), (n))
1432
1433#define OUT_RING(x) \
1434 intel_ring_emit(LP_RING(dev_priv), x)
1435
1436#define ADVANCE_LP_RING() \
1437 intel_ring_advance(LP_RING(dev_priv))
1438
546b0974
EA
1439/**
1440 * Lock test for when it's just for synchronization of ring access.
1441 *
1442 * In that case, we don't need to do it when GEM is initialized as nobody else
1443 * has access to the ring.
1444 */
05394f39 1445#define RING_LOCK_TEST_WITH_RETURN(dev, file) do { \
1ec14ad3 1446 if (LP_RING(dev->dev_private)->obj == NULL) \
05394f39 1447 LOCK_TEST_WITH_RETURN(dev, file); \
546b0974
EA
1448} while (0)
1449
b7287d80
BW
1450/* On SNB platform, before reading ring registers forcewake bit
1451 * must be set to prevent GT core from power down and stale values being
1452 * returned.
1453 */
fcca7926
BW
1454void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv);
1455void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv);
67a3744f 1456int __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv);
b7287d80 1457
5f75377d 1458#define __i915_read(x, y) \
f7000883 1459 u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg);
fcca7926 1460
5f75377d
KP
1461__i915_read(8, b)
1462__i915_read(16, w)
1463__i915_read(32, l)
1464__i915_read(64, q)
1465#undef __i915_read
1466
1467#define __i915_write(x, y) \
f7000883
AK
1468 void i915_write##x(struct drm_i915_private *dev_priv, u32 reg, u##x val);
1469
5f75377d
KP
1470__i915_write(8, b)
1471__i915_write(16, w)
1472__i915_write(32, l)
1473__i915_write(64, q)
1474#undef __i915_write
1475
1476#define I915_READ8(reg) i915_read8(dev_priv, (reg))
1477#define I915_WRITE8(reg, val) i915_write8(dev_priv, (reg), (val))
1478
1479#define I915_READ16(reg) i915_read16(dev_priv, (reg))
1480#define I915_WRITE16(reg, val) i915_write16(dev_priv, (reg), (val))
1481#define I915_READ16_NOTRACE(reg) readw(dev_priv->regs + (reg))
1482#define I915_WRITE16_NOTRACE(reg, val) writew(val, dev_priv->regs + (reg))
1483
1484#define I915_READ(reg) i915_read32(dev_priv, (reg))
1485#define I915_WRITE(reg, val) i915_write32(dev_priv, (reg), (val))
cae5852d
ZN
1486#define I915_READ_NOTRACE(reg) readl(dev_priv->regs + (reg))
1487#define I915_WRITE_NOTRACE(reg, val) writel(val, dev_priv->regs + (reg))
5f75377d
KP
1488
1489#define I915_WRITE64(reg, val) i915_write64(dev_priv, (reg), (val))
1490#define I915_READ64(reg) i915_read64(dev_priv, (reg))
cae5852d
ZN
1491
1492#define POSTING_READ(reg) (void)I915_READ_NOTRACE(reg)
1493#define POSTING_READ16(reg) (void)I915_READ16_NOTRACE(reg)
1494
ba4f01a3 1495
1da177e4 1496#endif