]> bbs.cooldavid.org Git - net-next-2.6.git/blame - drivers/char/drm/i915_drv.h
drm/i915: fix off by one in VGA save/restore of AR & CR regs.
[net-next-2.6.git] / drivers / char / drm / 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
33/* General customization:
34 */
35
36#define DRIVER_AUTHOR "Tungsten Graphics, Inc."
37
38#define DRIVER_NAME "i915"
39#define DRIVER_DESC "Intel Graphics"
de227f5f 40#define DRIVER_DATE "20060119"
1da177e4
LT
41
42/* Interface history:
43 *
44 * 1.1: Original.
0d6aa60b
DA
45 * 1.2: Add Power Management
46 * 1.3: Add vblank support
de227f5f 47 * 1.4: Fix cmdbuffer path, add heap destroy
702880f2 48 * 1.5: Add vblank pipe configuration
2228ed67
MD
49 * 1.6: - New ioctl for scheduling buffer swaps on vertical blank
50 * - Support vertical blank on secondary display pipe
1da177e4
LT
51 */
52#define DRIVER_MAJOR 1
2228ed67 53#define DRIVER_MINOR 6
1da177e4
LT
54#define DRIVER_PATCHLEVEL 0
55
1da177e4
LT
56typedef struct _drm_i915_ring_buffer {
57 int tail_mask;
58 unsigned long Start;
59 unsigned long End;
60 unsigned long Size;
61 u8 *virtual_start;
62 int head;
63 int tail;
64 int space;
65 drm_local_map_t map;
66} drm_i915_ring_buffer_t;
67
68struct mem_block {
69 struct mem_block *next;
70 struct mem_block *prev;
71 int start;
72 int size;
6c340eac 73 struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
1da177e4
LT
74};
75
a6b54f3f
MD
76typedef struct _drm_i915_vbl_swap {
77 struct list_head head;
78 drm_drawable_t drw_id;
af6061af 79 unsigned int pipe;
a6b54f3f
MD
80 unsigned int sequence;
81} drm_i915_vbl_swap_t;
82
1da177e4
LT
83typedef struct drm_i915_private {
84 drm_local_map_t *sarea;
85 drm_local_map_t *mmio_map;
86
87 drm_i915_sarea_t *sarea_priv;
88 drm_i915_ring_buffer_t ring;
89
9c8da5eb 90 drm_dma_handle_t *status_page_dmah;
1da177e4 91 void *hw_status_page;
1da177e4 92 dma_addr_t dma_status_page;
af6061af 93 unsigned long counter;
dc7a9319
WZ
94 unsigned int status_gfx_addr;
95 drm_local_map_t hws_map;
1da177e4 96
a6b54f3f 97 unsigned int cpp;
1da177e4
LT
98 int back_offset;
99 int front_offset;
100 int current_page;
101 int page_flipping;
102 int use_mi_batchbuffer_start;
103
104 wait_queue_head_t irq_queue;
105 atomic_t irq_received;
af6061af 106 atomic_t irq_emitted;
1da177e4
LT
107
108 int tex_lru_log_granularity;
109 int allow_batchbuffer;
110 struct mem_block *agp_heap;
0d6aa60b 111 unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds;
702880f2 112 int vblank_pipe;
a6b54f3f
MD
113
114 spinlock_t swaps_lock;
115 drm_i915_vbl_swap_t vbl_swaps;
116 unsigned int swaps_pending;
ba8bbcf6
JB
117
118 /* Register state */
119 u8 saveLBB;
120 u32 saveDSPACNTR;
121 u32 saveDSPBCNTR;
122 u32 savePIPEACONF;
123 u32 savePIPEBCONF;
124 u32 savePIPEASRC;
125 u32 savePIPEBSRC;
126 u32 saveFPA0;
127 u32 saveFPA1;
128 u32 saveDPLL_A;
129 u32 saveDPLL_A_MD;
130 u32 saveHTOTAL_A;
131 u32 saveHBLANK_A;
132 u32 saveHSYNC_A;
133 u32 saveVTOTAL_A;
134 u32 saveVBLANK_A;
135 u32 saveVSYNC_A;
136 u32 saveBCLRPAT_A;
0da3ea12 137 u32 savePIPEASTAT;
ba8bbcf6
JB
138 u32 saveDSPASTRIDE;
139 u32 saveDSPASIZE;
140 u32 saveDSPAPOS;
141 u32 saveDSPABASE;
142 u32 saveDSPASURF;
143 u32 saveDSPATILEOFF;
144 u32 savePFIT_PGM_RATIOS;
145 u32 saveBLC_PWM_CTL;
146 u32 saveBLC_PWM_CTL2;
147 u32 saveFPB0;
148 u32 saveFPB1;
149 u32 saveDPLL_B;
150 u32 saveDPLL_B_MD;
151 u32 saveHTOTAL_B;
152 u32 saveHBLANK_B;
153 u32 saveHSYNC_B;
154 u32 saveVTOTAL_B;
155 u32 saveVBLANK_B;
156 u32 saveVSYNC_B;
157 u32 saveBCLRPAT_B;
0da3ea12 158 u32 savePIPEBSTAT;
ba8bbcf6
JB
159 u32 saveDSPBSTRIDE;
160 u32 saveDSPBSIZE;
161 u32 saveDSPBPOS;
162 u32 saveDSPBBASE;
163 u32 saveDSPBSURF;
164 u32 saveDSPBTILEOFF;
165 u32 saveVCLK_DIVISOR_VGA0;
166 u32 saveVCLK_DIVISOR_VGA1;
167 u32 saveVCLK_POST_DIV;
168 u32 saveVGACNTRL;
169 u32 saveADPA;
170 u32 saveLVDS;
171 u32 saveLVDSPP_ON;
172 u32 saveLVDSPP_OFF;
173 u32 saveDVOA;
174 u32 saveDVOB;
175 u32 saveDVOC;
176 u32 savePP_ON;
177 u32 savePP_OFF;
178 u32 savePP_CONTROL;
179 u32 savePP_CYCLE;
180 u32 savePFIT_CONTROL;
181 u32 save_palette_a[256];
182 u32 save_palette_b[256];
183 u32 saveFBC_CFB_BASE;
184 u32 saveFBC_LL_BASE;
185 u32 saveFBC_CONTROL;
186 u32 saveFBC_CONTROL2;
0da3ea12
JB
187 u32 saveIER;
188 u32 saveIIR;
189 u32 saveIMR;
1f84e550
KP
190 u32 saveCACHE_MODE_0;
191 u32 saveDSPCLK_GATE_D;
192 u32 saveMI_ARB_STATE;
ba8bbcf6
JB
193 u32 saveSWF0[16];
194 u32 saveSWF1[16];
195 u32 saveSWF2[3];
196 u8 saveMSR;
197 u8 saveSR[8];
123f794f 198 u8 saveGR[25];
ba8bbcf6 199 u8 saveAR_INDEX;
a59e122a 200 u8 saveAR[21];
ba8bbcf6
JB
201 u8 saveDACMASK;
202 u8 saveDACDATA[256*3]; /* 256 3-byte colors */
a59e122a 203 u8 saveCR[37];
1da177e4
LT
204} drm_i915_private_t;
205
c153f45f 206extern struct drm_ioctl_desc i915_ioctls[];
b3a83639
DA
207extern int i915_max_ioctl;
208
1da177e4 209 /* i915_dma.c */
84b1fd10 210extern void i915_kernel_lost_context(struct drm_device * dev);
22eae947 211extern int i915_driver_load(struct drm_device *, unsigned long flags);
ba8bbcf6 212extern int i915_driver_unload(struct drm_device *);
84b1fd10 213extern void i915_driver_lastclose(struct drm_device * dev);
6c340eac
EA
214extern void i915_driver_preclose(struct drm_device *dev,
215 struct drm_file *file_priv);
84b1fd10 216extern int i915_driver_device_is_agp(struct drm_device * dev);
0d6aa60b
DA
217extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
218 unsigned long arg);
af6061af 219
1da177e4 220/* i915_irq.c */
c153f45f
EA
221extern int i915_irq_emit(struct drm_device *dev, void *data,
222 struct drm_file *file_priv);
223extern int i915_irq_wait(struct drm_device *dev, void *data,
224 struct drm_file *file_priv);
1da177e4 225
84b1fd10
DA
226extern int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence);
227extern int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
1da177e4 228extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS);
84b1fd10 229extern void i915_driver_irq_preinstall(struct drm_device * dev);
af6061af 230extern void i915_driver_irq_postinstall(struct drm_device * dev);
84b1fd10 231extern void i915_driver_irq_uninstall(struct drm_device * dev);
c153f45f
EA
232extern int i915_vblank_pipe_set(struct drm_device *dev, void *data,
233 struct drm_file *file_priv);
234extern int i915_vblank_pipe_get(struct drm_device *dev, void *data,
235 struct drm_file *file_priv);
236extern int i915_vblank_swap(struct drm_device *dev, void *data,
237 struct drm_file *file_priv);
1da177e4
LT
238
239/* i915_mem.c */
c153f45f
EA
240extern int i915_mem_alloc(struct drm_device *dev, void *data,
241 struct drm_file *file_priv);
242extern int i915_mem_free(struct drm_device *dev, void *data,
243 struct drm_file *file_priv);
244extern int i915_mem_init_heap(struct drm_device *dev, void *data,
245 struct drm_file *file_priv);
246extern int i915_mem_destroy_heap(struct drm_device *dev, void *data,
247 struct drm_file *file_priv);
1da177e4 248extern void i915_mem_takedown(struct mem_block **heap);
84b1fd10 249extern void i915_mem_release(struct drm_device * dev,
6c340eac 250 struct drm_file *file_priv, struct mem_block *heap);
1da177e4 251
0d6aa60b
DA
252#define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, (reg))
253#define I915_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, (reg), (val))
bc5f4523 254#define I915_READ16(reg) DRM_READ16(dev_priv->mmio_map, (reg))
0d6aa60b 255#define I915_WRITE16(reg,val) DRM_WRITE16(dev_priv->mmio_map, (reg), (val))
1da177e4
LT
256
257#define I915_VERBOSE 0
258
259#define RING_LOCALS unsigned int outring, ringmask, outcount; \
260 volatile char *virt;
261
262#define BEGIN_LP_RING(n) do { \
263 if (I915_VERBOSE) \
3e684eae
MN
264 DRM_DEBUG("BEGIN_LP_RING(%d)\n", (n)); \
265 if (dev_priv->ring.space < (n)*4) \
bf9d8929 266 i915_wait_ring(dev, (n)*4, __func__); \
1da177e4
LT
267 outcount = 0; \
268 outring = dev_priv->ring.tail; \
269 ringmask = dev_priv->ring.tail_mask; \
270 virt = dev_priv->ring.virtual_start; \
271} while (0)
272
273#define OUT_RING(n) do { \
274 if (I915_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \
c29b669c 275 *(volatile unsigned int *)(virt + outring) = (n); \
1da177e4
LT
276 outcount++; \
277 outring += 4; \
278 outring &= ringmask; \
279} while (0)
280
281#define ADVANCE_LP_RING() do { \
282 if (I915_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING %x\n", outring); \
283 dev_priv->ring.tail = outring; \
284 dev_priv->ring.space -= outcount * 4; \
285 I915_WRITE(LP_RING + RING_TAIL, outring); \
286} while(0)
287
84b1fd10 288extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
1da177e4 289
ba8bbcf6
JB
290/* Extended config space */
291#define LBB 0xf4
292
293/* VGA stuff */
294
295#define VGA_ST01_MDA 0x3ba
296#define VGA_ST01_CGA 0x3da
297
298#define VGA_MSR_WRITE 0x3c2
299#define VGA_MSR_READ 0x3cc
300#define VGA_MSR_MEM_EN (1<<1)
301#define VGA_MSR_CGA_MODE (1<<0)
302
303#define VGA_SR_INDEX 0x3c4
304#define VGA_SR_DATA 0x3c5
305
306#define VGA_AR_INDEX 0x3c0
307#define VGA_AR_VID_EN (1<<5)
308#define VGA_AR_DATA_WRITE 0x3c0
309#define VGA_AR_DATA_READ 0x3c1
310
311#define VGA_GR_INDEX 0x3ce
312#define VGA_GR_DATA 0x3cf
313/* GR05 */
314#define VGA_GR_MEM_READ_MODE_SHIFT 3
315#define VGA_GR_MEM_READ_MODE_PLANE 1
316/* GR06 */
317#define VGA_GR_MEM_MODE_MASK 0xc
318#define VGA_GR_MEM_MODE_SHIFT 2
319#define VGA_GR_MEM_A0000_AFFFF 0
320#define VGA_GR_MEM_A0000_BFFFF 1
321#define VGA_GR_MEM_B0000_B7FFF 2
322#define VGA_GR_MEM_B0000_BFFFF 3
323
324#define VGA_DACMASK 0x3c6
325#define VGA_DACRX 0x3c7
326#define VGA_DACWX 0x3c8
327#define VGA_DACDATA 0x3c9
328
329#define VGA_CR_INDEX_MDA 0x3b4
330#define VGA_CR_DATA_MDA 0x3b5
331#define VGA_CR_INDEX_CGA 0x3d4
332#define VGA_CR_DATA_CGA 0x3d5
333
bc5f4523 334#define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
1da177e4
LT
335#define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23))
336#define CMD_REPORT_HEAD (7<<23)
337#define CMD_STORE_DWORD_IDX ((0x21<<23) | 0x1)
338#define CMD_OP_BATCH_BUFFER ((0x0<<29)|(0x30<<23)|0x1)
339
340#define INST_PARSER_CLIENT 0x00000000
341#define INST_OP_FLUSH 0x02000000
342#define INST_FLUSH_MAP_CACHE 0x00000001
343
344#define BB1_START_ADDR_MASK (~0x7)
345#define BB1_PROTECTED (1<<0)
346#define BB1_UNPROTECTED (0<<0)
347#define BB2_END_ADDR_MASK (~0x7)
348
ba8bbcf6
JB
349/* Framebuffer compression */
350#define FBC_CFB_BASE 0x03200 /* 4k page aligned */
351#define FBC_LL_BASE 0x03204 /* 4k page aligned */
352#define FBC_CONTROL 0x03208
353#define FBC_CTL_EN (1<<31)
354#define FBC_CTL_PERIODIC (1<<30)
355#define FBC_CTL_INTERVAL_SHIFT (16)
356#define FBC_CTL_UNCOMPRESSIBLE (1<<14)
357#define FBC_CTL_STRIDE_SHIFT (5)
358#define FBC_CTL_FENCENO (1<<0)
359#define FBC_COMMAND 0x0320c
360#define FBC_CMD_COMPRESS (1<<0)
361#define FBC_STATUS 0x03210
362#define FBC_STAT_COMPRESSING (1<<31)
363#define FBC_STAT_COMPRESSED (1<<30)
364#define FBC_STAT_MODIFIED (1<<29)
365#define FBC_STAT_CURRENT_LINE (1<<0)
366#define FBC_CONTROL2 0x03214
367#define FBC_CTL_FENCE_DBL (0<<4)
368#define FBC_CTL_IDLE_IMM (0<<2)
369#define FBC_CTL_IDLE_FULL (1<<2)
370#define FBC_CTL_IDLE_LINE (2<<2)
371#define FBC_CTL_IDLE_DEBUG (3<<2)
372#define FBC_CTL_CPU_FENCE (1<<1)
373#define FBC_CTL_PLANEA (0<<0)
374#define FBC_CTL_PLANEB (1<<0)
375#define FBC_FENCE_OFF 0x0321b
376
377#define FBC_LL_SIZE (1536)
378#define FBC_LL_PAD (32)
379
380/* Interrupt bits:
381 */
af6061af
DA
382#define USER_INT_FLAG (1<<1)
383#define VSYNC_PIPEB_FLAG (1<<5)
384#define VSYNC_PIPEA_FLAG (1<<7)
385#define HWB_OOM_FLAG (1<<13) /* binner out of memory */
ba8bbcf6 386
1da177e4
LT
387#define I915REG_HWSTAM 0x02098
388#define I915REG_INT_IDENTITY_R 0x020a4
bc5f4523 389#define I915REG_INT_MASK_R 0x020a8
1da177e4
LT
390#define I915REG_INT_ENABLE_R 0x020a0
391
e4a7b1d1
DA
392#define I915REG_PIPEASTAT 0x70024
393#define I915REG_PIPEBSTAT 0x71024
af6061af
DA
394
395#define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17)
396#define I915_VBLANK_CLEAR (1UL<<1)
e4a7b1d1 397
1da177e4
LT
398#define SRX_INDEX 0x3c4
399#define SRX_DATA 0x3c5
400#define SR01 1
bc5f4523 401#define SR01_SCREEN_OFF (1<<5)
1da177e4
LT
402
403#define PPCR 0x61204
404#define PPCR_ON (1<<0)
405
0d6aa60b
DA
406#define DVOB 0x61140
407#define DVOB_ON (1<<31)
408#define DVOC 0x61160
409#define DVOC_ON (1<<31)
410#define LVDS 0x61180
411#define LVDS_ON (1<<31)
412
1da177e4
LT
413#define ADPA 0x61100
414#define ADPA_DPMS_MASK (~(3<<10))
415#define ADPA_DPMS_ON (0<<10)
416#define ADPA_DPMS_SUSPEND (1<<10)
417#define ADPA_DPMS_STANDBY (2<<10)
418#define ADPA_DPMS_OFF (3<<10)
419
420#define NOPID 0x2094
bc5f4523
DA
421#define LP_RING 0x2030
422#define HP_RING 0x2040
ba8bbcf6
JB
423/* The binner has its own ring buffer:
424 */
425#define HWB_RING 0x2400
426
bc5f4523 427#define RING_TAIL 0x00
1da177e4 428#define TAIL_ADDR 0x001FFFF8
bc5f4523
DA
429#define RING_HEAD 0x04
430#define HEAD_WRAP_COUNT 0xFFE00000
431#define HEAD_WRAP_ONE 0x00200000
432#define HEAD_ADDR 0x001FFFFC
433#define RING_START 0x08
434#define START_ADDR 0x0xFFFFF000
435#define RING_LEN 0x0C
436#define RING_NR_PAGES 0x001FF000
437#define RING_REPORT_MASK 0x00000006
438#define RING_REPORT_64K 0x00000002
439#define RING_REPORT_128K 0x00000004
440#define RING_NO_REPORT 0x00000000
441#define RING_VALID_MASK 0x00000001
442#define RING_VALID 0x00000001
443#define RING_INVALID 0x00000000
1da177e4 444
ba8bbcf6
JB
445/* Instruction parser error reg:
446 */
447#define IPEIR 0x2088
448
449/* Scratch pad debug 0 reg:
450 */
451#define SCPD0 0x209c
452
453/* Error status reg:
454 */
455#define ESR 0x20b8
456
457/* Secondary DMA fetch address debug reg:
458 */
459#define DMA_FADD_S 0x20d4
460
1f84e550
KP
461/* Memory Interface Arbitration State
462 */
463#define MI_ARB_STATE 0x20e4
464
ba8bbcf6
JB
465/* Cache mode 0 reg.
466 * - Manipulating render cache behaviour is central
467 * to the concept of zone rendering, tuning this reg can help avoid
468 * unnecessary render cache reads and even writes (for z/stencil)
469 * at beginning and end of scene.
470 *
471 * - To change a bit, write to this reg with a mask bit set and the
472 * bit of interest either set or cleared. EG: (BIT<<16) | BIT to set.
473 */
474#define Cache_Mode_0 0x2120
1f84e550 475#define CACHE_MODE_0 0x2120
ba8bbcf6
JB
476#define CM0_MASK_SHIFT 16
477#define CM0_IZ_OPT_DISABLE (1<<6)
478#define CM0_ZR_OPT_DISABLE (1<<5)
479#define CM0_DEPTH_EVICT_DISABLE (1<<4)
480#define CM0_COLOR_EVICT_DISABLE (1<<3)
481#define CM0_DEPTH_WRITE_DISABLE (1<<1)
482#define CM0_RC_OP_FLUSH_DISABLE (1<<0)
483
484
485/* Graphics flush control. A CPU write flushes the GWB of all writes.
486 * The data is discarded.
487 */
488#define GFX_FLSH_CNTL 0x2170
489
490/* Binner control. Defines the location of the bin pointer list:
491 */
492#define BINCTL 0x2420
493#define BC_MASK (1 << 9)
494
495/* Binned scene info.
496 */
497#define BINSCENE 0x2428
498#define BS_OP_LOAD (1 << 8)
499#define BS_MASK (1 << 22)
500
501/* Bin command parser debug reg:
502 */
503#define BCPD 0x2480
504
505/* Bin memory control debug reg:
506 */
507#define BMCD 0x2484
508
509/* Bin data cache debug reg:
510 */
511#define BDCD 0x2488
512
513/* Binner pointer cache debug reg:
514 */
515#define BPCD 0x248c
516
517/* Binner scratch pad debug reg:
518 */
519#define BINSKPD 0x24f0
520
521/* HWB scratch pad debug reg:
522 */
523#define HWBSKPD 0x24f4
524
525/* Binner memory pool reg:
526 */
527#define BMP_BUFFER 0x2430
528#define BMP_PAGE_SIZE_4K (0 << 10)
529#define BMP_BUFFER_SIZE_SHIFT 1
530#define BMP_ENABLE (1 << 0)
531
532/* Get/put memory from the binner memory pool:
533 */
534#define BMP_GET 0x2438
535#define BMP_PUT 0x2440
536#define BMP_OFFSET_SHIFT 5
537
538/* 3D state packets:
539 */
540#define GFX_OP_RASTER_RULES ((0x3<<29)|(0x7<<24))
541
1da177e4
LT
542#define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19))
543#define SC_UPDATE_SCISSOR (0x1<<1)
544#define SC_ENABLE_MASK (0x1<<0)
545#define SC_ENABLE (0x1<<0)
546
ba8bbcf6
JB
547#define GFX_OP_LOAD_INDIRECT ((0x3<<29)|(0x1d<<24)|(0x7<<16))
548
1da177e4
LT
549#define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
550#define SCI_YMIN_MASK (0xffff<<16)
551#define SCI_XMIN_MASK (0xffff<<0)
552#define SCI_YMAX_MASK (0xffff<<16)
553#define SCI_XMAX_MASK (0xffff<<0)
554
555#define GFX_OP_SCISSOR_ENABLE ((0x3<<29)|(0x1c<<24)|(0x10<<19))
556#define GFX_OP_SCISSOR_RECT ((0x3<<29)|(0x1d<<24)|(0x81<<16)|1)
557#define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
558#define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
559#define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x4)
560#define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
561#define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
562
c29b669c
AH
563#define GFX_OP_DRAWRECT_INFO_I965 ((0x7900<<16)|0x2)
564
ba8bbcf6 565#define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|4)
a6b54f3f
MD
566#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6)
567#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)
568#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)
7b832b56
KP
569#define XY_SRC_COPY_BLT_SRC_TILED (1<<15)
570#define XY_SRC_COPY_BLT_DST_TILED (1<<11)
a6b54f3f 571
bc5f4523
DA
572#define MI_BATCH_BUFFER ((0x30<<23)|1)
573#define MI_BATCH_BUFFER_START (0x31<<23)
574#define MI_BATCH_BUFFER_END (0xA<<23)
1da177e4 575#define MI_BATCH_NON_SECURE (1)
21f16289 576#define MI_BATCH_NON_SECURE_I965 (1<<8)
1da177e4
LT
577
578#define MI_WAIT_FOR_EVENT ((0x3<<23))
ba8bbcf6 579#define MI_WAIT_FOR_PLANE_B_FLIP (1<<6)
1da177e4
LT
580#define MI_WAIT_FOR_PLANE_A_FLIP (1<<2)
581#define MI_WAIT_FOR_PLANE_A_SCANLINES (1<<1)
582
583#define MI_LOAD_SCAN_LINES_INCL ((0x12<<23))
584
585#define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2)
586#define ASYNC_FLIP (1<<22)
ba8bbcf6
JB
587#define DISPLAY_PLANE_A (0<<20)
588#define DISPLAY_PLANE_B (1<<20)
589
590/* Display regs */
591#define DSPACNTR 0x70180
592#define DSPBCNTR 0x71180
593#define DISPPLANE_SEL_PIPE_MASK (1<<24)
594
595/* Define the region of interest for the binner:
596 */
597#define CMD_OP_BIN_CONTROL ((0x3<<29)|(0x1d<<24)|(0x84<<16)|4)
1da177e4
LT
598
599#define CMD_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1)
600
ba8bbcf6
JB
601#define CMD_MI_FLUSH (0x04 << 23)
602#define MI_NO_WRITE_FLUSH (1 << 2)
603#define MI_READ_FLUSH (1 << 0)
604#define MI_EXE_FLUSH (1 << 1)
605#define MI_END_SCENE (1 << 4) /* flush binner and incr scene count */
606#define MI_SCENE_COUNT (1 << 3) /* just increment scene count */
607
608#define BREADCRUMB_BITS 31
609#define BREADCRUMB_MASK ((1U << BREADCRUMB_BITS) - 1)
610
611#define READ_BREADCRUMB(dev_priv) (((volatile u32*)(dev_priv->hw_status_page))[5])
612#define READ_HWSP(dev_priv, reg) (((volatile u32*)(dev_priv->hw_status_page))[reg])
613
614#define BLC_PWM_CTL 0x61254
615#define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
616
617#define BLC_PWM_CTL2 0x61250
618/**
619 * This is the most significant 15 bits of the number of backlight cycles in a
620 * complete cycle of the modulated backlight control.
621 *
622 * The actual value is this field multiplied by two.
623 */
624#define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
625#define BLM_LEGACY_MODE (1 << 16)
626/**
627 * This is the number of cycles out of the backlight modulation cycle for which
628 * the backlight is on.
629 *
630 * This field must be no greater than the number of cycles in the complete
631 * backlight modulation cycle.
632 */
633#define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
634#define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
635
636#define I915_GCFGC 0xf0
637#define I915_LOW_FREQUENCY_ENABLE (1 << 7)
638#define I915_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
639#define I915_DISPLAY_CLOCK_333_MHZ (4 << 4)
640#define I915_DISPLAY_CLOCK_MASK (7 << 4)
641
642#define I855_HPLLCC 0xc0
643#define I855_CLOCK_CONTROL_MASK (3 << 0)
644#define I855_CLOCK_133_200 (0 << 0)
645#define I855_CLOCK_100_200 (1 << 0)
646#define I855_CLOCK_100_133 (2 << 0)
647#define I855_CLOCK_166_250 (3 << 0)
648
649/* p317, 319
650 */
651#define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */
652#define VCLK2_VCO_N 0x600a
653#define VCLK2_VCO_DIV_SEL 0x6012
654
655#define VCLK_DIVISOR_VGA0 0x6000
656#define VCLK_DIVISOR_VGA1 0x6004
657#define VCLK_POST_DIV 0x6010
658/** Selects a post divisor of 4 instead of 2. */
659# define VGA1_PD_P2_DIV_4 (1 << 15)
660/** Overrides the p2 post divisor field */
661# define VGA1_PD_P1_DIV_2 (1 << 13)
662# define VGA1_PD_P1_SHIFT 8
663/** P1 value is 2 greater than this field */
664# define VGA1_PD_P1_MASK (0x1f << 8)
665/** Selects a post divisor of 4 instead of 2. */
666# define VGA0_PD_P2_DIV_4 (1 << 7)
667/** Overrides the p2 post divisor field */
668# define VGA0_PD_P1_DIV_2 (1 << 5)
669# define VGA0_PD_P1_SHIFT 0
670/** P1 value is 2 greater than this field */
671# define VGA0_PD_P1_MASK (0x1f << 0)
672
1f84e550
KP
673#define DSPCLK_GATE_D 0x6200
674
ba8bbcf6
JB
675/* I830 CRTC registers */
676#define HTOTAL_A 0x60000
677#define HBLANK_A 0x60004
678#define HSYNC_A 0x60008
679#define VTOTAL_A 0x6000c
680#define VBLANK_A 0x60010
681#define VSYNC_A 0x60014
682#define PIPEASRC 0x6001c
683#define BCLRPAT_A 0x60020
684#define VSYNCSHIFT_A 0x60028
685
686#define HTOTAL_B 0x61000
687#define HBLANK_B 0x61004
688#define HSYNC_B 0x61008
689#define VTOTAL_B 0x6100c
690#define VBLANK_B 0x61010
691#define VSYNC_B 0x61014
692#define PIPEBSRC 0x6101c
693#define BCLRPAT_B 0x61020
694#define VSYNCSHIFT_B 0x61028
695
696#define PP_STATUS 0x61200
697# define PP_ON (1 << 31)
698/**
699 * Indicates that all dependencies of the panel are on:
700 *
701 * - PLL enabled
702 * - pipe enabled
703 * - LVDS/DVOB/DVOC on
704 */
705# define PP_READY (1 << 30)
706# define PP_SEQUENCE_NONE (0 << 28)
707# define PP_SEQUENCE_ON (1 << 28)
708# define PP_SEQUENCE_OFF (2 << 28)
709# define PP_SEQUENCE_MASK 0x30000000
710#define PP_CONTROL 0x61204
711# define POWER_TARGET_ON (1 << 0)
712
713#define LVDSPP_ON 0x61208
714#define LVDSPP_OFF 0x6120c
715#define PP_CYCLE 0x61210
716
717#define PFIT_CONTROL 0x61230
718# define PFIT_ENABLE (1 << 31)
719# define PFIT_PIPE_MASK (3 << 29)
720# define PFIT_PIPE_SHIFT 29
721# define VERT_INTERP_DISABLE (0 << 10)
722# define VERT_INTERP_BILINEAR (1 << 10)
723# define VERT_INTERP_MASK (3 << 10)
724# define VERT_AUTO_SCALE (1 << 9)
725# define HORIZ_INTERP_DISABLE (0 << 6)
726# define HORIZ_INTERP_BILINEAR (1 << 6)
727# define HORIZ_INTERP_MASK (3 << 6)
728# define HORIZ_AUTO_SCALE (1 << 5)
729# define PANEL_8TO6_DITHER_ENABLE (1 << 3)
730
731#define PFIT_PGM_RATIOS 0x61234
732# define PFIT_VERT_SCALE_MASK 0xfff00000
733# define PFIT_HORIZ_SCALE_MASK 0x0000fff0
734
735#define PFIT_AUTO_RATIOS 0x61238
736
737
738#define DPLL_A 0x06014
739#define DPLL_B 0x06018
740# define DPLL_VCO_ENABLE (1 << 31)
741# define DPLL_DVO_HIGH_SPEED (1 << 30)
742# define DPLL_SYNCLOCK_ENABLE (1 << 29)
743# define DPLL_VGA_MODE_DIS (1 << 28)
744# define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
745# define DPLLB_MODE_LVDS (2 << 26) /* i915 */
746# define DPLL_MODE_MASK (3 << 26)
747# define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
748# define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
749# define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
750# define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
751# define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
752# define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
753/**
754 * The i830 generation, in DAC/serial mode, defines p1 as two plus this
755 * bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set.
756 */
757# define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
758/**
759 * The i830 generation, in LVDS mode, defines P1 as the bit number set within
760 * this field (only one bit may be set).
761 */
762# define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
763# define DPLL_FPA01_P1_POST_DIV_SHIFT 16
764# define PLL_P2_DIVIDE_BY_4 (1 << 23) /* i830, required in DVO non-gang */
765# define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
766# define PLL_REF_INPUT_DREFCLK (0 << 13)
767# define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
768# define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */
769# define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
770# define PLL_REF_INPUT_MASK (3 << 13)
771# define PLL_LOAD_PULSE_PHASE_SHIFT 9
772/*
773 * Parallel to Serial Load Pulse phase selection.
774 * Selects the phase for the 10X DPLL clock for the PCIe
775 * digital display port. The range is 4 to 13; 10 or more
776 * is just a flip delay. The default is 6
777 */
778# define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
779# define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
780
781/**
782 * SDVO multiplier for 945G/GM. Not used on 965.
783 *
784 * \sa DPLL_MD_UDI_MULTIPLIER_MASK
785 */
786# define SDVO_MULTIPLIER_MASK 0x000000ff
787# define SDVO_MULTIPLIER_SHIFT_HIRES 4
788# define SDVO_MULTIPLIER_SHIFT_VGA 0
789
790/** @defgroup DPLL_MD
791 * @{
792 */
793/** Pipe A SDVO/UDI clock multiplier/divider register for G965. */
794#define DPLL_A_MD 0x0601c
795/** Pipe B SDVO/UDI clock multiplier/divider register for G965. */
796#define DPLL_B_MD 0x06020
797/**
798 * UDI pixel divider, controlling how many pixels are stuffed into a packet.
799 *
800 * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
801 */
802# define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
803# define DPLL_MD_UDI_DIVIDER_SHIFT 24
804/** UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
805# define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
806# define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
807/**
808 * SDVO/UDI pixel multiplier.
809 *
810 * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
811 * clock rate is 10 times the DPLL clock. At low resolution/refresh rate
812 * modes, the bus rate would be below the limits, so SDVO allows for stuffing
813 * dummy bytes in the datastream at an increased clock rate, with both sides of
814 * the link knowing how many bytes are fill.
815 *
816 * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
817 * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be
818 * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
819 * through an SDVO command.
820 *
821 * This register field has values of multiplication factor minus 1, with
822 * a maximum multiplier of 5 for SDVO.
823 */
824# define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00
825# define DPLL_MD_UDI_MULTIPLIER_SHIFT 8
826/** SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
827 * This best be set to the default value (3) or the CRT won't work. No,
828 * I don't entirely understand what this does...
829 */
830# define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
831# define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
832/** @} */
833
834#define DPLL_TEST 0x606c
835# define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
836# define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
837# define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
838# define DPLLB_TEST_SDVO_DIV_MASK (3 << 22)
839# define DPLLB_TEST_N_BYPASS (1 << 19)
840# define DPLLB_TEST_M_BYPASS (1 << 18)
841# define DPLLB_INPUT_BUFFER_ENABLE (1 << 16)
842# define DPLLA_TEST_N_BYPASS (1 << 3)
843# define DPLLA_TEST_M_BYPASS (1 << 2)
844# define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
845
846#define ADPA 0x61100
847#define ADPA_DAC_ENABLE (1<<31)
848#define ADPA_DAC_DISABLE 0
849#define ADPA_PIPE_SELECT_MASK (1<<30)
850#define ADPA_PIPE_A_SELECT 0
851#define ADPA_PIPE_B_SELECT (1<<30)
852#define ADPA_USE_VGA_HVPOLARITY (1<<15)
853#define ADPA_SETS_HVPOLARITY 0
854#define ADPA_VSYNC_CNTL_DISABLE (1<<11)
855#define ADPA_VSYNC_CNTL_ENABLE 0
856#define ADPA_HSYNC_CNTL_DISABLE (1<<10)
857#define ADPA_HSYNC_CNTL_ENABLE 0
858#define ADPA_VSYNC_ACTIVE_HIGH (1<<4)
859#define ADPA_VSYNC_ACTIVE_LOW 0
860#define ADPA_HSYNC_ACTIVE_HIGH (1<<3)
861#define ADPA_HSYNC_ACTIVE_LOW 0
862
863#define FPA0 0x06040
864#define FPA1 0x06044
865#define FPB0 0x06048
866#define FPB1 0x0604c
867# define FP_N_DIV_MASK 0x003f0000
868# define FP_N_DIV_SHIFT 16
869# define FP_M1_DIV_MASK 0x00003f00
870# define FP_M1_DIV_SHIFT 8
871# define FP_M2_DIV_MASK 0x0000003f
872# define FP_M2_DIV_SHIFT 0
873
874
875#define PORT_HOTPLUG_EN 0x61110
876# define SDVOB_HOTPLUG_INT_EN (1 << 26)
877# define SDVOC_HOTPLUG_INT_EN (1 << 25)
878# define TV_HOTPLUG_INT_EN (1 << 18)
879# define CRT_HOTPLUG_INT_EN (1 << 9)
880# define CRT_HOTPLUG_FORCE_DETECT (1 << 3)
881
882#define PORT_HOTPLUG_STAT 0x61114
883# define CRT_HOTPLUG_INT_STATUS (1 << 11)
884# define TV_HOTPLUG_INT_STATUS (1 << 10)
885# define CRT_HOTPLUG_MONITOR_MASK (3 << 8)
886# define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)
887# define CRT_HOTPLUG_MONITOR_MONO (2 << 8)
888# define CRT_HOTPLUG_MONITOR_NONE (0 << 8)
889# define SDVOC_HOTPLUG_INT_STATUS (1 << 7)
890# define SDVOB_HOTPLUG_INT_STATUS (1 << 6)
891
892#define SDVOB 0x61140
893#define SDVOC 0x61160
894#define SDVO_ENABLE (1 << 31)
895#define SDVO_PIPE_B_SELECT (1 << 30)
896#define SDVO_STALL_SELECT (1 << 29)
897#define SDVO_INTERRUPT_ENABLE (1 << 26)
898/**
899 * 915G/GM SDVO pixel multiplier.
900 *
901 * Programmed value is multiplier - 1, up to 5x.
902 *
903 * \sa DPLL_MD_UDI_MULTIPLIER_MASK
904 */
905#define SDVO_PORT_MULTIPLY_MASK (7 << 23)
906#define SDVO_PORT_MULTIPLY_SHIFT 23
907#define SDVO_PHASE_SELECT_MASK (15 << 19)
908#define SDVO_PHASE_SELECT_DEFAULT (6 << 19)
909#define SDVO_CLOCK_OUTPUT_INVERT (1 << 18)
910#define SDVOC_GANG_MODE (1 << 16)
911#define SDVO_BORDER_ENABLE (1 << 7)
912#define SDVOB_PCIE_CONCURRENCY (1 << 3)
913#define SDVO_DETECTED (1 << 2)
914/* Bits to be preserved when writing */
915#define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14))
916#define SDVOC_PRESERVE_MASK (1 << 17)
917
918/** @defgroup LVDS
919 * @{
920 */
921/**
922 * This register controls the LVDS output enable, pipe selection, and data
923 * format selection.
924 *
925 * All of the clock/data pairs are force powered down by power sequencing.
926 */
927#define LVDS 0x61180
928/**
929 * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
930 * the DPLL semantics change when the LVDS is assigned to that pipe.
931 */
932# define LVDS_PORT_EN (1 << 31)
933/** Selects pipe B for LVDS data. Must be set on pre-965. */
934# define LVDS_PIPEB_SELECT (1 << 30)
935
936/**
937 * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
938 * pixel.
939 */
940# define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
941# define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
942# define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
943/**
944 * Controls the A3 data pair, which contains the additional LSBs for 24 bit
945 * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
946 * on.
947 */
948# define LVDS_A3_POWER_MASK (3 << 6)
949# define LVDS_A3_POWER_DOWN (0 << 6)
950# define LVDS_A3_POWER_UP (3 << 6)
951/**
952 * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
953 * is set.
954 */
955# define LVDS_CLKB_POWER_MASK (3 << 4)
956# define LVDS_CLKB_POWER_DOWN (0 << 4)
957# define LVDS_CLKB_POWER_UP (3 << 4)
958
959/**
960 * Controls the B0-B3 data pairs. This must be set to match the DPLL p2
961 * setting for whether we are in dual-channel mode. The B3 pair will
962 * additionally only be powered up when LVDS_A3_POWER_UP is set.
963 */
964# define LVDS_B0B3_POWER_MASK (3 << 2)
965# define LVDS_B0B3_POWER_DOWN (0 << 2)
966# define LVDS_B0B3_POWER_UP (3 << 2)
967
968#define PIPEACONF 0x70008
969#define PIPEACONF_ENABLE (1<<31)
970#define PIPEACONF_DISABLE 0
971#define PIPEACONF_DOUBLE_WIDE (1<<30)
972#define I965_PIPECONF_ACTIVE (1<<30)
973#define PIPEACONF_SINGLE_WIDE 0
974#define PIPEACONF_PIPE_UNLOCKED 0
975#define PIPEACONF_PIPE_LOCKED (1<<25)
976#define PIPEACONF_PALETTE 0
977#define PIPEACONF_GAMMA (1<<24)
978#define PIPECONF_FORCE_BORDER (1<<25)
979#define PIPECONF_PROGRESSIVE (0 << 21)
980#define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
981#define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
982
983#define PIPEBCONF 0x71008
984#define PIPEBCONF_ENABLE (1<<31)
985#define PIPEBCONF_DISABLE 0
986#define PIPEBCONF_DOUBLE_WIDE (1<<30)
987#define PIPEBCONF_DISABLE 0
988#define PIPEBCONF_GAMMA (1<<24)
989#define PIPEBCONF_PALETTE 0
990
991#define PIPEBGCMAXRED 0x71010
992#define PIPEBGCMAXGREEN 0x71014
993#define PIPEBGCMAXBLUE 0x71018
994#define PIPEBSTAT 0x71024
995#define PIPEBFRAMEHIGH 0x71040
996#define PIPEBFRAMEPIXEL 0x71044
997
998#define DSPACNTR 0x70180
999#define DSPBCNTR 0x71180
1000#define DISPLAY_PLANE_ENABLE (1<<31)
1001#define DISPLAY_PLANE_DISABLE 0
1002#define DISPPLANE_GAMMA_ENABLE (1<<30)
1003#define DISPPLANE_GAMMA_DISABLE 0
1004#define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
1005#define DISPPLANE_8BPP (0x2<<26)
1006#define DISPPLANE_15_16BPP (0x4<<26)
1007#define DISPPLANE_16BPP (0x5<<26)
1008#define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
1009#define DISPPLANE_32BPP (0x7<<26)
1010#define DISPPLANE_STEREO_ENABLE (1<<25)
1011#define DISPPLANE_STEREO_DISABLE 0
1012#define DISPPLANE_SEL_PIPE_MASK (1<<24)
1013#define DISPPLANE_SEL_PIPE_A 0
1014#define DISPPLANE_SEL_PIPE_B (1<<24)
1015#define DISPPLANE_SRC_KEY_ENABLE (1<<22)
1016#define DISPPLANE_SRC_KEY_DISABLE 0
1017#define DISPPLANE_LINE_DOUBLE (1<<20)
1018#define DISPPLANE_NO_LINE_DOUBLE 0
1019#define DISPPLANE_STEREO_POLARITY_FIRST 0
1020#define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
1021/* plane B only */
1022#define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
1023#define DISPPLANE_ALPHA_TRANS_DISABLE 0
1024#define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0
1025#define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
1026
1027#define DSPABASE 0x70184
1028#define DSPASTRIDE 0x70188
1029
1030#define DSPBBASE 0x71184
1031#define DSPBADDR DSPBBASE
1032#define DSPBSTRIDE 0x71188
1033
1034#define DSPAKEYVAL 0x70194
1035#define DSPAKEYMASK 0x70198
1036
1037#define DSPAPOS 0x7018C /* reserved */
1038#define DSPASIZE 0x70190
1039#define DSPBPOS 0x7118C
1040#define DSPBSIZE 0x71190
1041
1042#define DSPASURF 0x7019C
1043#define DSPATILEOFF 0x701A4
1044
1045#define DSPBSURF 0x7119C
1046#define DSPBTILEOFF 0x711A4
1047
1048#define VGACNTRL 0x71400
1049# define VGA_DISP_DISABLE (1 << 31)
1050# define VGA_2X_MODE (1 << 30)
1051# define VGA_PIPE_B_SELECT (1 << 29)
1052
1053/*
1054 * Some BIOS scratch area registers. The 845 (and 830?) store the amount
1055 * of video memory available to the BIOS in SWF1.
1056 */
1057
1058#define SWF0 0x71410
1059
1060/*
1061 * 855 scratch registers.
1062 */
1063#define SWF10 0x70410
1064
1065#define SWF30 0x72414
1066
1067/*
1068 * Overlay registers. These are overlay registers accessed via MMIO.
1069 * Those loaded via the overlay register page are defined in i830_video.c.
1070 */
1071#define OVADD 0x30000
1072
1073#define DOVSTA 0x30008
1074#define OC_BUF (0x3<<20)
1075
1076#define OGAMC5 0x30010
1077#define OGAMC4 0x30014
1078#define OGAMC3 0x30018
1079#define OGAMC2 0x3001c
1080#define OGAMC1 0x30020
1081#define OGAMC0 0x30024
1082/*
1083 * Palette registers
1084 */
1085#define PALETTE_A 0x0a000
1086#define PALETTE_B 0x0a800
1087
1088#define IS_I830(dev) ((dev)->pci_device == 0x3577)
1089#define IS_845G(dev) ((dev)->pci_device == 0x2562)
1090#define IS_I85X(dev) ((dev)->pci_device == 0x3582)
1091#define IS_I855(dev) ((dev)->pci_device == 0x3582)
1092#define IS_I865G(dev) ((dev)->pci_device == 0x2572)
1093
4d1f7888 1094#define IS_I915G(dev) ((dev)->pci_device == 0x2582 || (dev)->pci_device == 0x258a)
ba8bbcf6
JB
1095#define IS_I915GM(dev) ((dev)->pci_device == 0x2592)
1096#define IS_I945G(dev) ((dev)->pci_device == 0x2772)
3bf48468
JB
1097#define IS_I945GM(dev) ((dev)->pci_device == 0x27A2 ||\
1098 (dev)->pci_device == 0x27AE)
ba8bbcf6
JB
1099#define IS_I965G(dev) ((dev)->pci_device == 0x2972 || \
1100 (dev)->pci_device == 0x2982 || \
1101 (dev)->pci_device == 0x2992 || \
1102 (dev)->pci_device == 0x29A2 || \
1103 (dev)->pci_device == 0x2A02 || \
5f5f9d4c
ZW
1104 (dev)->pci_device == 0x2A12 || \
1105 (dev)->pci_device == 0x2A42)
ba8bbcf6
JB
1106
1107#define IS_I965GM(dev) ((dev)->pci_device == 0x2A02)
1108
5f5f9d4c
ZW
1109#define IS_IGD_GM(dev) ((dev)->pci_device == 0x2A42)
1110
ba8bbcf6
JB
1111#define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \
1112 (dev)->pci_device == 0x29B2 || \
1113 (dev)->pci_device == 0x29D2)
1114
1115#define IS_I9XX(dev) (IS_I915G(dev) || IS_I915GM(dev) || IS_I945G(dev) || \
1116 IS_I945GM(dev) || IS_I965G(dev) || IS_G33(dev))
1117
1118#define IS_MOBILE(dev) (IS_I830(dev) || IS_I85X(dev) || IS_I915GM(dev) || \
5f5f9d4c 1119 IS_I945GM(dev) || IS_I965GM(dev) || IS_IGD_GM(dev))
ba8bbcf6 1120
b39d50e5
ZW
1121#define I915_NEED_GFX_HWS(dev) (IS_G33(dev) || IS_IGD_GM(dev))
1122
ba8bbcf6 1123#define PRIMARY_RINGBUFFER_SIZE (128*1024)
0d6aa60b 1124
1da177e4 1125#endif