1 /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
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:
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
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.
33 /* General customization:
36 #include "intel_bios.h"
38 #define DRIVER_AUTHOR "Tungsten Graphics, Inc."
40 #define DRIVER_NAME "i915"
41 #define DRIVER_DESC "Intel Graphics"
42 #define DRIVER_DATE "20080312"
44 #if defined(__linux__)
45 #define I915_HAVE_FENCE
46 #define I915_HAVE_BUFFER
52 * 1.2: Add Power Management
53 * 1.3: Add vblank support
54 * 1.4: Fix cmdbuffer path, add heap destroy
55 * 1.5: Add vblank pipe configuration
56 * 1.6: - New ioctl for scheduling buffer swaps on vertical blank
57 * - Support vertical blank on secondary display pipe
58 * 1.8: New ioctl for ARB_Occlusion_Query
59 * 1.9: Usable page flipping and triple buffering
60 * 1.10: Plane/pipe disentangling
61 * 1.11: TTM superioctl
62 * 1.12: TTM relocation optimization
64 #define DRIVER_MAJOR 1
65 #if defined(I915_HAVE_FENCE) && defined(I915_HAVE_BUFFER)
66 #define DRIVER_MINOR 13
68 #define DRIVER_MINOR 6
70 #define DRIVER_PATCHLEVEL 0
77 #ifdef I915_HAVE_BUFFER
78 #define I915_MAX_VALIDATE_BUFFERS 4096
79 struct drm_i915_validate_buffer;
82 struct drm_i915_ring_buffer {
95 struct mem_block *next;
96 struct mem_block *prev;
99 struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
102 struct drm_i915_vbl_swap {
103 struct list_head head;
104 drm_drawable_t drw_id;
106 unsigned int sequence;
108 struct drm_minor *minor;
111 struct drm_i915_master_private {
112 drm_local_map_t *sarea;
113 struct drm_i915_sarea *sarea_priv;
116 struct drm_i915_private {
117 struct drm_buffer_object *ring_buffer;
119 drm_local_map_t *mmio_map;
121 unsigned long mmiobase;
122 unsigned long mmiolen;
124 struct drm_i915_ring_buffer ring;
126 struct drm_dma_handle *status_page_dmah;
127 void *hw_status_page;
128 dma_addr_t dma_status_page;
130 unsigned int status_gfx_addr;
131 drm_local_map_t hws_map;
132 struct drm_buffer_object *hws_bo;
135 int use_mi_batchbuffer_start;
137 wait_queue_head_t irq_queue;
138 atomic_t irq_received;
139 atomic_t irq_emitted;
141 int tex_lru_log_granularity;
142 int allow_batchbuffer;
143 struct mem_block *agp_heap;
144 unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds;
146 DRM_SPINTYPE user_irq_lock;
147 int user_irq_refcount;
149 uint32_t irq_enable_reg;
151 struct workqueue_struct *wq;
153 bool cursor_needs_physical;
155 #ifdef I915_HAVE_FENCE
156 uint32_t flush_sequence;
157 uint32_t flush_flags;
158 uint32_t flush_pending;
159 uint32_t saved_flush_status;
161 #ifdef I915_HAVE_BUFFER
163 unsigned int max_validate_buffers;
164 struct mutex cmdbuf_mutex;
166 struct drm_i915_validate_buffer *val_bufs;
169 DRM_SPINTYPE swaps_lock;
170 struct drm_i915_vbl_swap vbl_swaps;
171 unsigned int swaps_pending;
174 int backlight_duty_cycle; /* restore backlight to this value */
175 bool panel_wants_dither;
176 struct drm_display_mode *panel_fixed_mode;
177 struct drm_display_mode *vbt_mode; /* if any */
179 #if defined(I915_HAVE_BUFFER)
181 struct drm_buffer_object *sarea_bo;
182 struct drm_bo_kmap_obj sarea_kmap;
184 /* Feature bits from the VBIOS */
185 int int_tv_support:1;
188 int int_crt_support:1;
218 u32 savePFIT_PGM_RATIOS;
220 u32 saveBLC_PWM_CTL2;
245 u32 savePP_ON_DELAYS;
246 u32 savePP_OFF_DELAYS;
254 u32 savePFIT_CONTROL;
255 u32 save_palette_a[256];
256 u32 save_palette_b[256];
257 u32 saveFBC_CFB_BASE;
260 u32 saveFBC_CONTROL2;
264 u32 saveCACHE_MODE_0;
267 u32 saveMI_ARB_STATE;
277 u8 saveDACDATA[256*3]; /* 256 3-byte colors */
281 enum intel_chip_family {
288 extern struct drm_ioctl_desc i915_ioctls[];
289 extern int i915_max_ioctl;
291 extern int i915_master_create(struct drm_device *dev, struct drm_master *master);
292 extern void i915_master_destroy(struct drm_device *dev, struct drm_master *master);
294 extern void i915_kernel_lost_context(struct drm_device * dev);
295 extern int i915_driver_load(struct drm_device *, unsigned long flags);
296 extern int i915_driver_unload(struct drm_device *dev);
297 extern void i915_driver_lastclose(struct drm_device * dev);
298 extern void i915_driver_preclose(struct drm_device *dev,
299 struct drm_file *file_priv);
300 extern int i915_driver_device_is_agp(struct drm_device * dev);
301 extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
303 extern void i915_emit_breadcrumb(struct drm_device *dev);
304 extern void i915_dispatch_flip(struct drm_device * dev, int pipes, int sync);
305 extern int i915_emit_mi_flush(struct drm_device *dev, uint32_t flush);
306 extern int i915_driver_firstopen(struct drm_device *dev);
307 extern int i915_do_cleanup_pageflip(struct drm_device *dev);
308 extern int i915_dma_cleanup(struct drm_device *dev);
309 extern int i915_dispatch_batchbuffer(struct drm_device * dev,
310 drm_i915_batchbuffer_t * batch);
311 extern int i915_quiescent(struct drm_device *dev);
314 extern int i915_irq_emit(struct drm_device *dev, void *data,
315 struct drm_file *file_priv);
316 extern int i915_irq_wait(struct drm_device *dev, void *data,
317 struct drm_file *file_priv);
319 extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS);
320 extern void i915_driver_irq_preinstall(struct drm_device * dev);
321 extern int i915_driver_irq_postinstall(struct drm_device * dev);
322 extern void i915_driver_irq_uninstall(struct drm_device * dev);
323 extern int i915_vblank_pipe_set(struct drm_device *dev, void *data,
324 struct drm_file *file_priv);
325 extern int i915_vblank_pipe_get(struct drm_device *dev, void *data,
326 struct drm_file *file_priv);
327 extern int i915_emit_irq(struct drm_device * dev);
328 extern void i915_enable_interrupt (struct drm_device *dev);
329 extern int i915_enable_vblank(struct drm_device *dev, int crtc);
330 extern void i915_disable_vblank(struct drm_device *dev, int crtc);
331 extern u32 i915_get_vblank_counter(struct drm_device *dev, int crtc);
332 extern int i915_vblank_swap(struct drm_device *dev, void *data,
333 struct drm_file *file_priv);
334 extern void i915_user_irq_on(struct drm_device *dev);
335 extern void i915_user_irq_off(struct drm_device *dev);
338 extern int i915_mem_alloc(struct drm_device *dev, void *data,
339 struct drm_file *file_priv);
340 extern int i915_mem_free(struct drm_device *dev, void *data,
341 struct drm_file *file_priv);
342 extern int i915_mem_init_heap(struct drm_device *dev, void *data,
343 struct drm_file *file_priv);
344 extern int i915_mem_destroy_heap(struct drm_device *dev, void *data,
345 struct drm_file *file_priv);
346 extern void i915_mem_takedown(struct mem_block **heap);
347 extern void i915_mem_release(struct drm_device * dev,
348 struct drm_file *file_priv,
349 struct mem_block *heap);
350 #ifdef I915_HAVE_FENCE
352 extern void i915_fence_handler(struct drm_device *dev);
353 extern void i915_invalidate_reported_sequence(struct drm_device *dev);
357 #ifdef I915_HAVE_BUFFER
359 extern struct drm_ttm_backend *i915_create_ttm_backend_entry(struct drm_device *dev);
360 extern int i915_fence_type(struct drm_buffer_object *bo, uint32_t *fclass,
362 extern int i915_invalidate_caches(struct drm_device *dev, uint64_t buffer_flags);
363 extern int i915_init_mem_type(struct drm_device *dev, uint32_t type,
364 struct drm_mem_type_manager *man);
365 extern uint64_t i915_evict_flags(struct drm_buffer_object *bo);
366 extern int i915_move(struct drm_buffer_object *bo, int evict,
367 int no_wait, struct drm_bo_mem_reg *new_mem);
368 void i915_flush_ttm(struct drm_ttm *ttm);
370 int i915_execbuffer(struct drm_device *dev, void *data,
371 struct drm_file *file_priv);
375 extern unsigned int i915_fbpercrtc;
378 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
379 extern void intel_init_chipset_flush_compat(struct drm_device *dev);
380 extern void intel_fini_chipset_flush_compat(struct drm_device *dev);
386 extern void intel_modeset_init(struct drm_device *dev);
387 extern void intel_modeset_cleanup(struct drm_device *dev);
390 #define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, (reg))
391 #define I915_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, (reg), (val))
392 #define I915_READ16(reg) DRM_READ16(dev_priv->mmio_map, (reg))
393 #define I915_WRITE16(reg,val) DRM_WRITE16(dev_priv->mmio_map, (reg), (val))
395 #define I915_VERBOSE 0
397 #define PRIMARY_RINGBUFFER_SIZE (128*1024)
399 #define RING_LOCALS unsigned int outring, ringmask, outcount; \
402 #define BEGIN_LP_RING(n) do { \
404 DRM_DEBUG("BEGIN_LP_RING(%d)\n", \
406 if (dev_priv->ring.space < (n)*4) \
407 i915_wait_ring(dev, (n)*4, __FUNCTION__); \
409 outring = dev_priv->ring.tail; \
410 ringmask = dev_priv->ring.tail_mask; \
411 virt = dev_priv->ring.virtual_start; \
414 #define OUT_RING(n) do { \
415 if (I915_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \
416 *(volatile unsigned int *)(virt + outring) = (n); \
419 outring &= ringmask; \
422 #define ADVANCE_LP_RING() do { \
423 if (I915_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING %x\n", outring); \
424 dev_priv->ring.tail = outring; \
425 dev_priv->ring.space -= outcount * 4; \
426 I915_WRITE(PRB0_TAIL, outring); \
429 #define BREADCRUMB_BITS 31
430 #define BREADCRUMB_MASK ((1U << BREADCRUMB_BITS) - 1)
432 #define READ_BREADCRUMB(dev_priv) (((volatile u32*)(dev_priv->hw_status_page))[5])
433 #define READ_HWSP(dev_priv, reg) (((volatile u32*)(dev_priv->hw_status_page))[reg])
435 extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
438 * The Bridge device's PCI config space has information about the
439 * fb aperture size and the amount of pre-reserved memory.
441 #define INTEL_GMCH_CTRL 0x52
442 #define INTEL_GMCH_ENABLED 0x4
443 #define INTEL_GMCH_MEM_MASK 0x1
444 #define INTEL_GMCH_MEM_64M 0x1
445 #define INTEL_GMCH_MEM_128M 0
447 #define INTEL_855_GMCH_GMS_MASK (0x7 << 4)
448 #define INTEL_855_GMCH_GMS_DISABLED (0x0 << 4)
449 #define INTEL_855_GMCH_GMS_STOLEN_1M (0x1 << 4)
450 #define INTEL_855_GMCH_GMS_STOLEN_4M (0x2 << 4)
451 #define INTEL_855_GMCH_GMS_STOLEN_8M (0x3 << 4)
452 #define INTEL_855_GMCH_GMS_STOLEN_16M (0x4 << 4)
453 #define INTEL_855_GMCH_GMS_STOLEN_32M (0x5 << 4)
455 #define INTEL_915G_GMCH_GMS_STOLEN_48M (0x6 << 4)
456 #define INTEL_915G_GMCH_GMS_STOLEN_64M (0x7 << 4)
458 /* PCI config space */
460 #define HPLLCC 0xc0 /* 855 only */
461 #define GC_CLOCK_CONTROL_MASK (3 << 0)
462 #define GC_CLOCK_133_200 (0 << 0)
463 #define GC_CLOCK_100_200 (1 << 0)
464 #define GC_CLOCK_100_133 (2 << 0)
465 #define GC_CLOCK_166_250 (3 << 0)
466 #define GCFGC 0xf0 /* 915+ only */
467 #define GC_LOW_FREQUENCY_ENABLE (1 << 7)
468 #define GC_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
469 #define GC_DISPLAY_CLOCK_333_MHZ (4 << 4)
470 #define GC_DISPLAY_CLOCK_MASK (7 << 4)
475 #define VGA_ST01_MDA 0x3ba
476 #define VGA_ST01_CGA 0x3da
478 #define VGA_MSR_WRITE 0x3c2
479 #define VGA_MSR_READ 0x3cc
480 #define VGA_MSR_MEM_EN (1<<1)
481 #define VGA_MSR_CGA_MODE (1<<0)
483 #define VGA_SR_INDEX 0x3c4
484 #define VGA_SR_DATA 0x3c5
486 #define VGA_AR_INDEX 0x3c0
487 #define VGA_AR_VID_EN (1<<5)
488 #define VGA_AR_DATA_WRITE 0x3c0
489 #define VGA_AR_DATA_READ 0x3c1
491 #define VGA_GR_INDEX 0x3ce
492 #define VGA_GR_DATA 0x3cf
494 #define VGA_GR_MEM_READ_MODE_SHIFT 3
495 #define VGA_GR_MEM_READ_MODE_PLANE 1
497 #define VGA_GR_MEM_MODE_MASK 0xc
498 #define VGA_GR_MEM_MODE_SHIFT 2
499 #define VGA_GR_MEM_A0000_AFFFF 0
500 #define VGA_GR_MEM_A0000_BFFFF 1
501 #define VGA_GR_MEM_B0000_B7FFF 2
502 #define VGA_GR_MEM_B0000_BFFFF 3
504 #define VGA_DACMASK 0x3c6
505 #define VGA_DACRX 0x3c7
506 #define VGA_DACWX 0x3c8
507 #define VGA_DACDATA 0x3c9
509 #define VGA_CR_INDEX_MDA 0x3b4
510 #define VGA_CR_DATA_MDA 0x3b5
511 #define VGA_CR_INDEX_CGA 0x3d4
512 #define VGA_CR_DATA_CGA 0x3d5
515 * Memory interface instructions used by the kernel
517 #define MI_INSTR(opcode, flags) (((opcode) << 23) | (flags))
519 #define MI_NOOP MI_INSTR(0, 0)
520 #define MI_USER_INTERRUPT MI_INSTR(0x02, 0)
521 #define MI_WAIT_FOR_EVENT MI_INSTR(0x03, 0)
522 #define MI_WAIT_FOR_PLANE_B_FLIP (1<<6)
523 #define MI_WAIT_FOR_PLANE_A_FLIP (1<<2)
524 #define MI_WAIT_FOR_PLANE_A_SCANLINES (1<<1)
525 #define MI_FLUSH MI_INSTR(0x04, 0)
526 #define MI_READ_FLUSH (1 << 0)
527 #define MI_EXE_FLUSH (1 << 1)
528 #define MI_NO_WRITE_FLUSH (1 << 2)
529 #define MI_SCENE_COUNT (1 << 3) /* just increment scene count */
530 #define MI_END_SCENE (1 << 4) /* flush binner and incr scene count */
531 #define MI_BATCH_BUFFER_END MI_INSTR(0x0a, 0)
532 #define MI_REPORT_HEAD MI_INSTR(0x07, 0)
533 #define MI_LOAD_SCAN_LINES_INCL MI_INSTR(0x12, 0)
534 #define MI_STORE_DWORD_IMM MI_INSTR(0x20, 1) /* used to have 1<<22? */
535 #define MI_STORE_DWORD_INDEX MI_INSTR(0x21, 1)
536 #define MI_LOAD_REGISTER_IMM MI_INSTR(0x22, 1)
537 #define MI_BATCH_BUFFER MI_INSTR(0x30, 1)
538 #define MI_BATCH_NON_SECURE (1)
539 #define MI_BATCH_NON_SECURE_I965 (1<<8)
540 #define MI_BATCH_BUFFER_START MI_INSTR(0x31, 0)
543 * 3D instructions used by the kernel
545 #define GFX_INSTR(opcode, flags) ((0x3 << 29) | ((opcode) << 24) | (flags))
547 #define GFX_OP_RASTER_RULES ((0x3<<29)|(0x7<<24))
548 #define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19))
549 #define SC_UPDATE_SCISSOR (0x1<<1)
550 #define SC_ENABLE_MASK (0x1<<0)
551 #define SC_ENABLE (0x1<<0)
552 #define GFX_OP_LOAD_INDIRECT ((0x3<<29)|(0x1d<<24)|(0x7<<16))
553 #define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
554 #define SCI_YMIN_MASK (0xffff<<16)
555 #define SCI_XMIN_MASK (0xffff<<0)
556 #define SCI_YMAX_MASK (0xffff<<16)
557 #define SCI_XMAX_MASK (0xffff<<0)
558 #define GFX_OP_SCISSOR_ENABLE ((0x3<<29)|(0x1c<<24)|(0x10<<19))
559 #define GFX_OP_SCISSOR_RECT ((0x3<<29)|(0x1d<<24)|(0x81<<16)|1)
560 #define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
561 #define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
562 #define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x4)
563 #define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
564 #define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
565 #define GFX_OP_DRAWRECT_INFO_I965 ((0x7900<<16)|0x2)
566 #define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|4)
567 #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6)
568 #define XY_MONO_SRC_COPY_IMM_BLT ((2<<29)|(0x71<<22)|5)
569 #define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)
570 #define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)
571 #define BLT_DEPTH_8 (0<<24)
572 #define BLT_DEPTH_16_565 (1<<24)
573 #define BLT_DEPTH_16_1555 (2<<24)
574 #define BLT_DEPTH_32 (3<<24)
575 #define BLT_ROP_GXCOPY (0xcc<<16)
576 #define XY_SRC_COPY_BLT_SRC_TILED (1<<15)
577 #define XY_SRC_COPY_BLT_DST_TILED (1<<11)
578 #define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2)
579 #define ASYNC_FLIP (1<<22)
580 #define DISPLAY_PLANE_A (0<<20)
581 #define DISPLAY_PLANE_B (1<<20)
584 * Instruction and interrupt control regs
587 #define PRB0_TAIL 0x02030
588 #define PRB0_HEAD 0x02034
589 #define PRB0_START 0x02038
590 #define PRB0_CTL 0x0203c
591 #define TAIL_ADDR 0x001FFFF8
592 #define HEAD_WRAP_COUNT 0xFFE00000
593 #define HEAD_WRAP_ONE 0x00200000
594 #define HEAD_ADDR 0x001FFFFC
595 #define RING_NR_PAGES 0x001FF000
596 #define RING_REPORT_MASK 0x00000006
597 #define RING_REPORT_64K 0x00000002
598 #define RING_REPORT_128K 0x00000004
599 #define RING_NO_REPORT 0x00000000
600 #define RING_VALID_MASK 0x00000001
601 #define RING_VALID 0x00000001
602 #define RING_INVALID 0x00000000
603 #define PRB1_TAIL 0x02040 /* 915+ only */
604 #define PRB1_HEAD 0x02044 /* 915+ only */
605 #define PRB1_START 0x02048 /* 915+ only */
606 #define PRB1_CTL 0x0204c /* 915+ only */
607 #define HWS_PGA 0x02080
608 #define IPEIR 0x02088
609 #define NOPID 0x02094
610 #define HWSTAM 0x02098
611 #define SCPD0 0x0209c /* 915+ only */
616 #define I915_PIPE_CONTROL_NOTIFY_INTERRUPT (1<<18)
617 #define I915_DISPLAY_PORT_INTERRUPT (1<<17)
618 #define I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT (1<<15)
619 #define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT (1<<14)
620 #define I915_HWB_OOM_INTERRUPT (1<<13)
621 #define I915_SYNC_STATUS_INTERRUPT (1<<12)
622 #define I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT (1<<11)
623 #define I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT (1<<10)
624 #define I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT (1<<9)
625 #define I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT (1<<8)
626 #define I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT (1<<7)
627 #define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT (1<<6)
628 #define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT (1<<5)
629 #define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT (1<<4)
630 #define I915_DEBUG_INTERRUPT (1<<2)
631 #define I915_USER_INTERRUPT (1<<1)
635 #define INSTPM 0x020c0
636 #define FW_BLC 0x020d8
637 #define FW_BLC_SELF 0x020e0 /* 915+ only */
638 #define MI_ARB_STATE 0x020e4 /* 915+ only */
639 #define CACHE_MODE_0 0x02120 /* 915+ only */
640 #define CM0_MASK_SHIFT 16
641 #define CM0_IZ_OPT_DISABLE (1<<6)
642 #define CM0_ZR_OPT_DISABLE (1<<5)
643 #define CM0_DEPTH_EVICT_DISABLE (1<<4)
644 #define CM0_COLOR_EVICT_DISABLE (1<<3)
645 #define CM0_DEPTH_WRITE_DISABLE (1<<1)
646 #define CM0_RC_OP_FLUSH_DISABLE (1<<0)
647 #define GFX_FLSH_CNTL 0x02170 /* 915+ only */
650 * Framebuffer compression (915+ only)
653 #define FBC_CFB_BASE 0x03200 /* 4k page aligned */
654 #define FBC_LL_BASE 0x03204 /* 4k page aligned */
655 #define FBC_CONTROL 0x03208
656 #define FBC_CTL_EN (1<<31)
657 #define FBC_CTL_PERIODIC (1<<30)
658 #define FBC_CTL_INTERVAL_SHIFT (16)
659 #define FBC_CTL_UNCOMPRESSIBLE (1<<14)
660 #define FBC_CTL_STRIDE_SHIFT (5)
661 #define FBC_CTL_FENCENO (1<<0)
662 #define FBC_COMMAND 0x0320c
663 #define FBC_CMD_COMPRESS (1<<0)
664 #define FBC_STATUS 0x03210
665 #define FBC_STAT_COMPRESSING (1<<31)
666 #define FBC_STAT_COMPRESSED (1<<30)
667 #define FBC_STAT_MODIFIED (1<<29)
668 #define FBC_STAT_CURRENT_LINE (1<<0)
669 #define FBC_CONTROL2 0x03214
670 #define FBC_CTL_FENCE_DBL (0<<4)
671 #define FBC_CTL_IDLE_IMM (0<<2)
672 #define FBC_CTL_IDLE_FULL (1<<2)
673 #define FBC_CTL_IDLE_LINE (2<<2)
674 #define FBC_CTL_IDLE_DEBUG (3<<2)
675 #define FBC_CTL_CPU_FENCE (1<<1)
676 #define FBC_CTL_PLANEA (0<<0)
677 #define FBC_CTL_PLANEB (1<<0)
678 #define FBC_FENCE_OFF 0x0321b
680 #define FBC_LL_SIZE (1536)
694 # define GPIO_CLOCK_DIR_MASK (1 << 0)
695 # define GPIO_CLOCK_DIR_IN (0 << 1)
696 # define GPIO_CLOCK_DIR_OUT (1 << 1)
697 # define GPIO_CLOCK_VAL_MASK (1 << 2)
698 # define GPIO_CLOCK_VAL_OUT (1 << 3)
699 # define GPIO_CLOCK_VAL_IN (1 << 4)
700 # define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
701 # define GPIO_DATA_DIR_MASK (1 << 8)
702 # define GPIO_DATA_DIR_IN (0 << 9)
703 # define GPIO_DATA_DIR_OUT (1 << 9)
704 # define GPIO_DATA_VAL_MASK (1 << 10)
705 # define GPIO_DATA_VAL_OUT (1 << 11)
706 # define GPIO_DATA_VAL_IN (1 << 12)
707 # define GPIO_DATA_PULLUP_DISABLE (1 << 13)
710 * Clock control & power management
715 #define VGA_PD 0x6010
716 #define VGA0_PD_P2_DIV_4 (1 << 7)
717 #define VGA0_PD_P1_DIV_2 (1 << 5)
718 #define VGA0_PD_P1_SHIFT 0
719 #define VGA0_PD_P1_MASK (0x1f << 0)
720 #define VGA1_PD_P2_DIV_4 (1 << 15)
721 #define VGA1_PD_P1_DIV_2 (1 << 13)
722 #define VGA1_PD_P1_SHIFT 8
723 #define VGA1_PD_P1_MASK (0x1f << 8)
724 #define DPLL_A 0x06014
725 #define DPLL_B 0x06018
726 #define DPLL_VCO_ENABLE (1 << 31)
727 #define DPLL_DVO_HIGH_SPEED (1 << 30)
728 #define DPLL_SYNCLOCK_ENABLE (1 << 29)
729 #define DPLL_VGA_MODE_DIS (1 << 28)
730 #define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
731 #define DPLLB_MODE_LVDS (2 << 26) /* i915 */
732 #define DPLL_MODE_MASK (3 << 26)
733 #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
734 #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
735 #define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
736 #define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
737 #define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
738 #define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
740 * Pixel within the current frame is counted in the PIPEAFRAMEPIXEL register
741 * and is 24 bits wide.
743 #define PIPE_PIXEL_MASK 0x00ffffff
744 #define PIPE_PIXEL_SHIFT 0
746 #define I915_FIFO_UNDERRUN_STATUS (1UL<<31)
747 #define I915_CRC_ERROR_ENABLE (1UL<<29)
748 #define I915_CRC_DONE_ENABLE (1UL<<28)
749 #define I915_GMBUS_EVENT_ENABLE (1UL<<27)
750 #define I915_VSYNC_INTERRUPT_ENABLE (1UL<<25)
751 #define I915_DISPLAY_LINE_COMPARE_ENABLE (1UL<<24)
752 #define I915_DPST_EVENT_ENABLE (1UL<<23)
753 #define I915_LEGACY_BLC_EVENT_ENABLE (1UL<<22)
754 #define I915_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21)
755 #define I915_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20)
756 #define I915_START_VBLANK_INTERRUPT_ENABLE (1UL<<18) /* 965 or later */
757 #define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17)
758 #define I915_OVERLAY_UPDATED_ENABLE (1UL<<16)
759 #define I915_CRC_ERROR_INTERRUPT_STATUS (1UL<<13)
760 #define I915_CRC_DONE_INTERRUPT_STATUS (1UL<<12)
761 #define I915_GMBUS_INTERRUPT_STATUS (1UL<<11)
762 #define I915_VSYNC_INTERRUPT_STATUS (1UL<<9)
763 #define I915_DISPLAY_LINE_COMPARE_STATUS (1UL<<8)
764 #define I915_DPST_EVENT_STATUS (1UL<<7)
765 #define I915_LEGACY_BLC_EVENT_STATUS (1UL<<6)
766 #define I915_ODD_FIELD_INTERRUPT_STATUS (1UL<<5)
767 #define I915_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4)
768 #define I915_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */
769 #define I915_VBLANK_INTERRUPT_STATUS (1UL<<1)
770 #define I915_OVERLAY_UPDATED_STATUS (1UL<<0)
772 #define SRX_INDEX 0x3c4
773 #define SRX_DATA 0x3c5
775 #define SR01_SCREEN_OFF (1<<5)
778 #define PPCR_ON (1<<0)
781 #define DVOB_ON (1<<31)
783 #define DVOC_ON (1<<31)
785 #define LVDS_ON (1<<31)
788 #define ADPA_DPMS_MASK (~(3<<10))
789 #define ADPA_DPMS_ON (0<<10)
790 #define ADPA_DPMS_SUSPEND (1<<10)
791 #define ADPA_DPMS_STANDBY (2<<10)
792 #define ADPA_DPMS_OFF (3<<10)
794 #define LP_RING 0x2030
795 #define HP_RING 0x2040
796 /* The binner has its own ring buffer:
798 #define HWB_RING 0x2400
800 #define RING_TAIL 0x00
801 #define TAIL_ADDR 0x001FFFF8
802 #define RING_HEAD 0x04
803 #define HEAD_WRAP_COUNT 0xFFE00000
804 #define HEAD_WRAP_ONE 0x00200000
805 #define HEAD_ADDR 0x001FFFFC
806 #define RING_START 0x08
807 #define START_ADDR 0xFFFFF000
808 #define RING_LEN 0x0C
809 #define RING_NR_PAGES 0x001FF000
810 #define RING_REPORT_MASK 0x00000006
811 #define RING_REPORT_64K 0x00000002
812 #define RING_REPORT_128K 0x00000004
813 #define RING_NO_REPORT 0x00000000
814 #define RING_VALID_MASK 0x00000001
815 #define RING_VALID 0x00000001
816 #define RING_INVALID 0x00000000
818 /* Scratch pad debug 0 reg:
820 #define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
822 * The i830 generation, in LVDS mode, defines P1 as the bit number set within
823 * this field (only one bit may be set).
825 #define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
826 #define DPLL_FPA01_P1_POST_DIV_SHIFT 16
827 /* i830, required in DVO non-gang */
828 #define PLL_P2_DIVIDE_BY_4 (1 << 23)
829 #define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
830 #define PLL_REF_INPUT_DREFCLK (0 << 13)
831 #define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
832 #define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */
833 #define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
834 #define PLL_REF_INPUT_MASK (3 << 13)
835 #define PLL_LOAD_PULSE_PHASE_SHIFT 9
837 * Parallel to Serial Load Pulse phase selection.
838 * Selects the phase for the 10X DPLL clock for the PCIe
839 * digital display port. The range is 4 to 13; 10 or more
840 * is just a flip delay. The default is 6
842 #define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
843 #define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
845 * SDVO multiplier for 945G/GM. Not used on 965.
847 #define SDVO_MULTIPLIER_MASK 0x000000ff
848 #define SDVO_MULTIPLIER_SHIFT_HIRES 4
849 #define SDVO_MULTIPLIER_SHIFT_VGA 0
850 #define DPLL_A_MD 0x0601c /* 965+ only */
852 * UDI pixel divider, controlling how many pixels are stuffed into a packet.
854 * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
856 #define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
857 #define DPLL_MD_UDI_DIVIDER_SHIFT 24
858 /* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
859 #define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
860 #define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
862 * SDVO/UDI pixel multiplier.
864 * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
865 * clock rate is 10 times the DPLL clock. At low resolution/refresh rate
866 * modes, the bus rate would be below the limits, so SDVO allows for stuffing
867 * dummy bytes in the datastream at an increased clock rate, with both sides of
868 * the link knowing how many bytes are fill.
870 * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
871 * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be
872 * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
873 * through an SDVO command.
875 * This register field has values of multiplication factor minus 1, with
876 * a maximum multiplier of 5 for SDVO.
878 #define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00
879 #define DPLL_MD_UDI_MULTIPLIER_SHIFT 8
881 * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
882 * This best be set to the default value (3) or the CRT won't work. No,
883 * I don't entirely understand what this does...
885 #define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
886 #define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
887 #define DPLL_B_MD 0x06020 /* 965+ only */
892 #define FP_N_DIV_MASK 0x003f0000
893 #define FP_N_DIV_SHIFT 16
894 #define FP_M1_DIV_MASK 0x00003f00
895 #define FP_M1_DIV_SHIFT 8
896 #define FP_M2_DIV_MASK 0x0000003f
897 #define FP_M2_DIV_SHIFT 0
898 #define DPLL_TEST 0x606c
899 #define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
900 #define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
901 #define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
902 #define DPLLB_TEST_SDVO_DIV_MASK (3 << 22)
903 #define DPLLB_TEST_N_BYPASS (1 << 19)
904 #define DPLLB_TEST_M_BYPASS (1 << 18)
905 #define DPLLB_INPUT_BUFFER_ENABLE (1 << 16)
906 #define DPLLA_TEST_N_BYPASS (1 << 3)
907 #define DPLLA_TEST_M_BYPASS (1 << 2)
908 #define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
909 #define D_STATE 0x6104
910 #define CG_2D_DIS 0x6200
911 #define CG_3D_DIS 0x6204
917 #define PALETTE_A 0x0a000
918 #define PALETTE_B 0x0a800
924 #define OVADD 0x30000
925 #define DOVSTA 0x30008
926 #define OC_BUF (0x3<<20)
927 #define OGAMC5 0x30010
928 #define OGAMC4 0x30014
929 #define OGAMC3 0x30018
930 #define OGAMC2 0x3001c
931 #define OGAMC1 0x30020
932 #define OGAMC0 0x30024
935 * Display engine regs
938 /* Pipe A timing regs */
939 #define HTOTAL_A 0x60000
940 #define HBLANK_A 0x60004
941 #define HSYNC_A 0x60008
942 #define VTOTAL_A 0x6000c
943 #define VBLANK_A 0x60010
944 #define VSYNC_A 0x60014
945 #define PIPEASRC 0x6001c
946 #define BCLRPAT_A 0x60020
948 /* Pipe B timing regs */
949 #define HTOTAL_B 0x61000
950 #define HBLANK_B 0x61004
951 #define HSYNC_B 0x61008
952 #define VTOTAL_B 0x6100c
953 #define VBLANK_B 0x61010
954 #define VSYNC_B 0x61014
955 #define PIPEBSRC 0x6101c
956 #define BCLRPAT_B 0x61020
958 /* VGA port control */
960 #define ADPA_DAC_ENABLE (1<<31)
961 #define ADPA_DAC_DISABLE 0
962 #define ADPA_PIPE_SELECT_MASK (1<<30)
963 #define ADPA_PIPE_A_SELECT 0
964 #define ADPA_PIPE_B_SELECT (1<<30)
965 #define ADPA_USE_VGA_HVPOLARITY (1<<15)
966 #define ADPA_SETS_HVPOLARITY 0
967 #define ADPA_VSYNC_CNTL_DISABLE (1<<11)
968 #define ADPA_VSYNC_CNTL_ENABLE 0
969 #define ADPA_HSYNC_CNTL_DISABLE (1<<10)
970 #define ADPA_HSYNC_CNTL_ENABLE 0
971 #define ADPA_VSYNC_ACTIVE_HIGH (1<<4)
972 #define ADPA_VSYNC_ACTIVE_LOW 0
973 #define ADPA_HSYNC_ACTIVE_HIGH (1<<3)
974 #define ADPA_HSYNC_ACTIVE_LOW 0
975 #define ADPA_DPMS_MASK (~(3<<10))
976 #define ADPA_DPMS_ON (0<<10)
977 #define ADPA_DPMS_SUSPEND (1<<10)
978 #define ADPA_DPMS_STANDBY (2<<10)
979 #define ADPA_DPMS_OFF (3<<10)
981 /* Hotplug control (945+ only) */
982 #define PORT_HOTPLUG_EN 0x61110
983 #define SDVOB_HOTPLUG_INT_EN (1 << 26)
984 #define SDVOC_HOTPLUG_INT_EN (1 << 25)
985 #define TV_HOTPLUG_INT_EN (1 << 18)
986 #define CRT_HOTPLUG_INT_EN (1 << 9)
987 #define CRT_HOTPLUG_FORCE_DETECT (1 << 3)
989 #define PORT_HOTPLUG_STAT 0x61114
990 #define CRT_HOTPLUG_INT_STATUS (1 << 11)
991 #define TV_HOTPLUG_INT_STATUS (1 << 10)
992 #define CRT_HOTPLUG_MONITOR_MASK (3 << 8)
993 #define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)
994 #define CRT_HOTPLUG_MONITOR_MONO (2 << 8)
995 #define CRT_HOTPLUG_MONITOR_NONE (0 << 8)
996 #define SDVOC_HOTPLUG_INT_STATUS (1 << 7)
997 #define SDVOB_HOTPLUG_INT_STATUS (1 << 6)
999 /* SDVO port control */
1000 #define SDVOB 0x61140
1001 #define SDVOC 0x61160
1002 #define SDVO_ENABLE (1 << 31)
1003 #define SDVO_PIPE_B_SELECT (1 << 30)
1004 #define SDVO_STALL_SELECT (1 << 29)
1005 #define SDVO_INTERRUPT_ENABLE (1 << 26)
1007 * 915G/GM SDVO pixel multiplier.
1009 * Programmed value is multiplier - 1, up to 5x.
1011 * \sa DPLL_MD_UDI_MULTIPLIER_MASK
1013 #define SDVO_PORT_MULTIPLY_MASK (7 << 23)
1014 #define SDVO_PORT_MULTIPLY_SHIFT 23
1015 #define SDVO_PHASE_SELECT_MASK (15 << 19)
1016 #define SDVO_PHASE_SELECT_DEFAULT (6 << 19)
1017 #define SDVO_CLOCK_OUTPUT_INVERT (1 << 18)
1018 #define SDVOC_GANG_MODE (1 << 16)
1019 #define SDVO_BORDER_ENABLE (1 << 7)
1020 #define SDVOB_PCIE_CONCURRENCY (1 << 3)
1021 #define SDVO_DETECTED (1 << 2)
1022 /* Bits to be preserved when writing */
1023 #define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14) | (1 << 26))
1024 #define SDVOC_PRESERVE_MASK ((1 << 17) | (1 << 26))
1026 /* DVO port control */
1027 #define DVOA 0x61120
1028 #define DVOB 0x61140
1029 #define DVOC 0x61160
1030 #define DVO_ENABLE (1 << 31)
1031 #define DVO_PIPE_B_SELECT (1 << 30)
1032 #define DVO_PIPE_STALL_UNUSED (0 << 28)
1033 #define DVO_PIPE_STALL (1 << 28)
1034 #define DVO_PIPE_STALL_TV (2 << 28)
1035 #define DVO_PIPE_STALL_MASK (3 << 28)
1036 #define DVO_USE_VGA_SYNC (1 << 15)
1037 #define DVO_DATA_ORDER_I740 (0 << 14)
1038 #define DVO_DATA_ORDER_FP (1 << 14)
1039 #define DVO_VSYNC_DISABLE (1 << 11)
1040 #define DVO_HSYNC_DISABLE (1 << 10)
1041 #define DVO_VSYNC_TRISTATE (1 << 9)
1042 #define DVO_HSYNC_TRISTATE (1 << 8)
1043 #define DVO_BORDER_ENABLE (1 << 7)
1044 #define DVO_DATA_ORDER_GBRG (1 << 6)
1045 #define DVO_DATA_ORDER_RGGB (0 << 6)
1046 #define DVO_DATA_ORDER_GBRG_ERRATA (0 << 6)
1047 #define DVO_DATA_ORDER_RGGB_ERRATA (1 << 6)
1048 #define DVO_VSYNC_ACTIVE_HIGH (1 << 4)
1049 #define DVO_HSYNC_ACTIVE_HIGH (1 << 3)
1050 #define DVO_BLANK_ACTIVE_HIGH (1 << 2)
1051 #define DVO_OUTPUT_CSTATE_PIXELS (1 << 1) /* SDG only */
1052 #define DVO_OUTPUT_SOURCE_SIZE_PIXELS (1 << 0) /* SDG only */
1053 #define DVO_PRESERVE_MASK (0x7<<24)
1054 #define DVOA_SRCDIM 0x61124
1055 #define DVOB_SRCDIM 0x61144
1056 #define DVOC_SRCDIM 0x61164
1057 #define DVO_SRCDIM_HORIZONTAL_SHIFT 12
1058 #define DVO_SRCDIM_VERTICAL_SHIFT 0
1060 /* LVDS port control */
1061 #define LVDS 0x61180
1063 * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
1064 * the DPLL semantics change when the LVDS is assigned to that pipe.
1066 #define LVDS_PORT_EN (1 << 31)
1067 /* Selects pipe B for LVDS data. Must be set on pre-965. */
1068 #define LVDS_PIPEB_SELECT (1 << 30)
1070 * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
1073 #define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
1074 #define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
1075 #define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
1077 * Controls the A3 data pair, which contains the additional LSBs for 24 bit
1078 * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
1081 #define LVDS_A3_POWER_MASK (3 << 6)
1082 #define LVDS_A3_POWER_DOWN (0 << 6)
1083 #define LVDS_A3_POWER_UP (3 << 6)
1085 * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
1088 #define LVDS_CLKB_POWER_MASK (3 << 4)
1089 #define LVDS_CLKB_POWER_DOWN (0 << 4)
1090 #define LVDS_CLKB_POWER_UP (3 << 4)
1092 * Controls the B0-B3 data pairs. This must be set to match the DPLL p2
1093 * setting for whether we are in dual-channel mode. The B3 pair will
1094 * additionally only be powered up when LVDS_A3_POWER_UP is set.
1096 #define LVDS_B0B3_POWER_MASK (3 << 2)
1097 #define LVDS_B0B3_POWER_DOWN (0 << 2)
1098 #define LVDS_B0B3_POWER_UP (3 << 2)
1100 /* Panel power sequencing */
1101 #define PP_STATUS 0x61200
1102 #define PP_ON (1 << 31)
1104 * Indicates that all dependencies of the panel are on:
1108 * - LVDS/DVOB/DVOC on
1110 #define PP_READY (1 << 30)
1111 #define PP_SEQUENCE_NONE (0 << 28)
1112 #define PP_SEQUENCE_ON (1 << 28)
1113 #define PP_SEQUENCE_OFF (2 << 28)
1114 #define PP_SEQUENCE_MASK 0x30000000
1115 #define PP_CONTROL 0x61204
1116 #define POWER_TARGET_ON (1 << 0)
1117 #define PP_ON_DELAYS 0x61208
1118 #define PP_OFF_DELAYS 0x6120c
1119 #define PP_DIVISOR 0x61210
1122 #define PFIT_CONTROL 0x61230
1123 #define PFIT_ENABLE (1 << 31)
1124 #define PFIT_PIPE_MASK (3 << 29)
1125 #define PFIT_PIPE_SHIFT 29
1126 #define VERT_INTERP_DISABLE (0 << 10)
1127 #define VERT_INTERP_BILINEAR (1 << 10)
1128 #define VERT_INTERP_MASK (3 << 10)
1129 #define VERT_AUTO_SCALE (1 << 9)
1130 #define HORIZ_INTERP_DISABLE (0 << 6)
1131 #define HORIZ_INTERP_BILINEAR (1 << 6)
1132 #define HORIZ_INTERP_MASK (3 << 6)
1133 #define HORIZ_AUTO_SCALE (1 << 5)
1134 #define PANEL_8TO6_DITHER_ENABLE (1 << 3)
1135 #define PFIT_PGM_RATIOS 0x61234
1136 #define PFIT_VERT_SCALE_MASK 0xfff00000
1137 #define PFIT_HORIZ_SCALE_MASK 0x0000fff0
1138 #define PFIT_AUTO_RATIOS 0x61238
1140 /* Backlight control */
1141 #define BLC_PWM_CTL 0x61254
1142 #define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
1143 #define BLC_PWM_CTL2 0x61250 /* 965+ only */
1145 * This is the most significant 15 bits of the number of backlight cycles in a
1146 * complete cycle of the modulated backlight control.
1148 * The actual value is this field multiplied by two.
1150 #define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
1151 #define BLM_LEGACY_MODE (1 << 16)
1153 * This is the number of cycles out of the backlight modulation cycle for which
1154 * the backlight is on.
1156 * This field must be no greater than the number of cycles in the complete
1157 * backlight modulation cycle.
1159 #define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
1160 #define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
1162 /* TV port control */
1163 #define TV_CTL 0x68000
1164 /** Enables the TV encoder */
1165 # define TV_ENC_ENABLE (1 << 31)
1166 /** Sources the TV encoder input from pipe B instead of A. */
1167 # define TV_ENC_PIPEB_SELECT (1 << 30)
1168 /** Outputs composite video (DAC A only) */
1169 # define TV_ENC_OUTPUT_COMPOSITE (0 << 28)
1170 /** Outputs SVideo video (DAC B/C) */
1171 # define TV_ENC_OUTPUT_SVIDEO (1 << 28)
1172 /** Outputs Component video (DAC A/B/C) */
1173 # define TV_ENC_OUTPUT_COMPONENT (2 << 28)
1174 /** Outputs Composite and SVideo (DAC A/B/C) */
1175 # define TV_ENC_OUTPUT_SVIDEO_COMPOSITE (3 << 28)
1176 # define TV_TRILEVEL_SYNC (1 << 21)
1177 /** Enables slow sync generation (945GM only) */
1178 # define TV_SLOW_SYNC (1 << 20)
1179 /** Selects 4x oversampling for 480i and 576p */
1180 # define TV_OVERSAMPLE_4X (0 << 18)
1181 /** Selects 2x oversampling for 720p and 1080i */
1182 # define TV_OVERSAMPLE_2X (1 << 18)
1183 /** Selects no oversampling for 1080p */
1184 # define TV_OVERSAMPLE_NONE (2 << 18)
1185 /** Selects 8x oversampling */
1186 # define TV_OVERSAMPLE_8X (3 << 18)
1187 /** Selects progressive mode rather than interlaced */
1188 # define TV_PROGRESSIVE (1 << 17)
1189 /** Sets the colorburst to PAL mode. Required for non-M PAL modes. */
1190 # define TV_PAL_BURST (1 << 16)
1191 /** Field for setting delay of Y compared to C */
1192 # define TV_YC_SKEW_MASK (7 << 12)
1193 /** Enables a fix for 480p/576p standard definition modes on the 915GM only */
1194 # define TV_ENC_SDP_FIX (1 << 11)
1196 * Enables a fix for the 915GM only.
1198 * Not sure what it does.
1200 # define TV_ENC_C0_FIX (1 << 10)
1201 /** Bits that must be preserved by software */
1202 # define TV_CTL_SAVE ((3 << 8) | (3 << 6))
1203 # define TV_FUSE_STATE_MASK (3 << 4)
1204 /** Read-only state that reports all features enabled */
1205 # define TV_FUSE_STATE_ENABLED (0 << 4)
1206 /** Read-only state that reports that Macrovision is disabled in hardware*/
1207 # define TV_FUSE_STATE_NO_MACROVISION (1 << 4)
1208 /** Read-only state that reports that TV-out is disabled in hardware. */
1209 # define TV_FUSE_STATE_DISABLED (2 << 4)
1210 /** Normal operation */
1211 # define TV_TEST_MODE_NORMAL (0 << 0)
1212 /** Encoder test pattern 1 - combo pattern */
1213 # define TV_TEST_MODE_PATTERN_1 (1 << 0)
1214 /** Encoder test pattern 2 - full screen vertical 75% color bars */
1215 # define TV_TEST_MODE_PATTERN_2 (2 << 0)
1216 /** Encoder test pattern 3 - full screen horizontal 75% color bars */
1217 # define TV_TEST_MODE_PATTERN_3 (3 << 0)
1218 /** Encoder test pattern 4 - random noise */
1219 # define TV_TEST_MODE_PATTERN_4 (4 << 0)
1220 /** Encoder test pattern 5 - linear color ramps */
1221 # define TV_TEST_MODE_PATTERN_5 (5 << 0)
1223 * This test mode forces the DACs to 50% of full output.
1225 * This is used for load detection in combination with TVDAC_SENSE_MASK
1227 # define TV_TEST_MODE_MONITOR_DETECT (7 << 0)
1228 # define TV_TEST_MODE_MASK (7 << 0)
1230 #define TV_DAC 0x68004
1232 * Reports that DAC state change logic has reported change (RO).
1234 * This gets cleared when TV_DAC_STATE_EN is cleared
1236 # define TVDAC_STATE_CHG (1 << 31)
1237 # define TVDAC_SENSE_MASK (7 << 28)
1238 /** Reports that DAC A voltage is above the detect threshold */
1239 # define TVDAC_A_SENSE (1 << 30)
1240 /** Reports that DAC B voltage is above the detect threshold */
1241 # define TVDAC_B_SENSE (1 << 29)
1242 /** Reports that DAC C voltage is above the detect threshold */
1243 # define TVDAC_C_SENSE (1 << 28)
1245 * Enables DAC state detection logic, for load-based TV detection.
1247 * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set
1248 * to off, for load detection to work.
1250 # define TVDAC_STATE_CHG_EN (1 << 27)
1251 /** Sets the DAC A sense value to high */
1252 # define TVDAC_A_SENSE_CTL (1 << 26)
1253 /** Sets the DAC B sense value to high */
1254 # define TVDAC_B_SENSE_CTL (1 << 25)
1255 /** Sets the DAC C sense value to high */
1256 # define TVDAC_C_SENSE_CTL (1 << 24)
1257 /** Overrides the ENC_ENABLE and DAC voltage levels */
1258 # define DAC_CTL_OVERRIDE (1 << 7)
1259 /** Sets the slew rate. Must be preserved in software */
1260 # define ENC_TVDAC_SLEW_FAST (1 << 6)
1261 # define DAC_A_1_3_V (0 << 4)
1262 # define DAC_A_1_1_V (1 << 4)
1263 # define DAC_A_0_7_V (2 << 4)
1264 # define DAC_A_OFF (3 << 4)
1265 # define DAC_B_1_3_V (0 << 2)
1266 # define DAC_B_1_1_V (1 << 2)
1267 # define DAC_B_0_7_V (2 << 2)
1268 # define DAC_B_OFF (3 << 2)
1269 # define DAC_C_1_3_V (0 << 0)
1270 # define DAC_C_1_1_V (1 << 0)
1271 # define DAC_C_0_7_V (2 << 0)
1272 # define DAC_C_OFF (3 << 0)
1275 * CSC coefficients are stored in a floating point format with 9 bits of
1276 * mantissa and 2 or 3 bits of exponent. The exponent is represented as 2**-n,
1277 * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with
1278 * -1 (0x3) being the only legal negative value.
1280 #define TV_CSC_Y 0x68010
1281 # define TV_RY_MASK 0x07ff0000
1282 # define TV_RY_SHIFT 16
1283 # define TV_GY_MASK 0x00000fff
1284 # define TV_GY_SHIFT 0
1286 #define TV_CSC_Y2 0x68014
1287 # define TV_BY_MASK 0x07ff0000
1288 # define TV_BY_SHIFT 16
1290 * Y attenuation for component video.
1292 * Stored in 1.9 fixed point.
1294 # define TV_AY_MASK 0x000003ff
1295 # define TV_AY_SHIFT 0
1297 #define TV_CSC_U 0x68018
1298 # define TV_RU_MASK 0x07ff0000
1299 # define TV_RU_SHIFT 16
1300 # define TV_GU_MASK 0x000007ff
1301 # define TV_GU_SHIFT 0
1303 #define TV_CSC_U2 0x6801c
1304 # define TV_BU_MASK 0x07ff0000
1305 # define TV_BU_SHIFT 16
1307 * U attenuation for component video.
1309 * Stored in 1.9 fixed point.
1311 # define TV_AU_MASK 0x000003ff
1312 # define TV_AU_SHIFT 0
1314 #define TV_CSC_V 0x68020
1315 # define TV_RV_MASK 0x0fff0000
1316 # define TV_RV_SHIFT 16
1317 # define TV_GV_MASK 0x000007ff
1318 # define TV_GV_SHIFT 0
1320 #define TV_CSC_V2 0x68024
1321 # define TV_BV_MASK 0x07ff0000
1322 # define TV_BV_SHIFT 16
1324 * V attenuation for component video.
1326 * Stored in 1.9 fixed point.
1328 # define TV_AV_MASK 0x000007ff
1329 # define TV_AV_SHIFT 0
1331 #define TV_CLR_KNOBS 0x68028
1332 /** 2s-complement brightness adjustment */
1333 # define TV_BRIGHTNESS_MASK 0xff000000
1334 # define TV_BRIGHTNESS_SHIFT 24
1335 /** Contrast adjustment, as a 2.6 unsigned floating point number */
1336 # define TV_CONTRAST_MASK 0x00ff0000
1337 # define TV_CONTRAST_SHIFT 16
1338 /** Saturation adjustment, as a 2.6 unsigned floating point number */
1339 # define TV_SATURATION_MASK 0x0000ff00
1340 # define TV_SATURATION_SHIFT 8
1341 /** Hue adjustment, as an integer phase angle in degrees */
1342 # define TV_HUE_MASK 0x000000ff
1343 # define TV_HUE_SHIFT 0
1345 #define TV_CLR_LEVEL 0x6802c
1346 /** Controls the DAC level for black */
1347 # define TV_BLACK_LEVEL_MASK 0x01ff0000
1348 # define TV_BLACK_LEVEL_SHIFT 16
1349 /** Controls the DAC level for blanking */
1350 # define TV_BLANK_LEVEL_MASK 0x000001ff
1351 # define TV_BLANK_LEVEL_SHIFT 0
1353 #define TV_H_CTL_1 0x68030
1354 /** Number of pixels in the hsync. */
1355 # define TV_HSYNC_END_MASK 0x1fff0000
1356 # define TV_HSYNC_END_SHIFT 16
1357 /** Total number of pixels minus one in the line (display and blanking). */
1358 # define TV_HTOTAL_MASK 0x00001fff
1359 # define TV_HTOTAL_SHIFT 0
1361 #define TV_H_CTL_2 0x68034
1362 /** Enables the colorburst (needed for non-component color) */
1363 # define TV_BURST_ENA (1 << 31)
1364 /** Offset of the colorburst from the start of hsync, in pixels minus one. */
1365 # define TV_HBURST_START_SHIFT 16
1366 # define TV_HBURST_START_MASK 0x1fff0000
1367 /** Length of the colorburst */
1368 # define TV_HBURST_LEN_SHIFT 0
1369 # define TV_HBURST_LEN_MASK 0x0001fff
1371 #define TV_H_CTL_3 0x68038
1372 /** End of hblank, measured in pixels minus one from start of hsync */
1373 # define TV_HBLANK_END_SHIFT 16
1374 # define TV_HBLANK_END_MASK 0x1fff0000
1375 /** Start of hblank, measured in pixels minus one from start of hsync */
1376 # define TV_HBLANK_START_SHIFT 0
1377 # define TV_HBLANK_START_MASK 0x0001fff
1379 #define TV_V_CTL_1 0x6803c
1381 # define TV_NBR_END_SHIFT 16
1382 # define TV_NBR_END_MASK 0x07ff0000
1384 # define TV_VI_END_F1_SHIFT 8
1385 # define TV_VI_END_F1_MASK 0x00003f00
1387 # define TV_VI_END_F2_SHIFT 0
1388 # define TV_VI_END_F2_MASK 0x0000003f
1390 #define TV_V_CTL_2 0x68040
1391 /** Length of vsync, in half lines */
1392 # define TV_VSYNC_LEN_MASK 0x07ff0000
1393 # define TV_VSYNC_LEN_SHIFT 16
1394 /** Offset of the start of vsync in field 1, measured in one less than the
1395 * number of half lines.
1397 # define TV_VSYNC_START_F1_MASK 0x00007f00
1398 # define TV_VSYNC_START_F1_SHIFT 8
1400 * Offset of the start of vsync in field 2, measured in one less than the
1401 * number of half lines.
1403 # define TV_VSYNC_START_F2_MASK 0x0000007f
1404 # define TV_VSYNC_START_F2_SHIFT 0
1406 #define TV_V_CTL_3 0x68044
1407 /** Enables generation of the equalization signal */
1408 # define TV_EQUAL_ENA (1 << 31)
1409 /** Length of vsync, in half lines */
1410 # define TV_VEQ_LEN_MASK 0x007f0000
1411 # define TV_VEQ_LEN_SHIFT 16
1412 /** Offset of the start of equalization in field 1, measured in one less than
1413 * the number of half lines.
1415 # define TV_VEQ_START_F1_MASK 0x0007f00
1416 # define TV_VEQ_START_F1_SHIFT 8
1418 * Offset of the start of equalization in field 2, measured in one less than
1419 * the number of half lines.
1421 # define TV_VEQ_START_F2_MASK 0x000007f
1422 # define TV_VEQ_START_F2_SHIFT 0
1424 #define TV_V_CTL_4 0x68048
1426 * Offset to start of vertical colorburst, measured in one less than the
1427 * number of lines from vertical start.
1429 # define TV_VBURST_START_F1_MASK 0x003f0000
1430 # define TV_VBURST_START_F1_SHIFT 16
1432 * Offset to the end of vertical colorburst, measured in one less than the
1433 * number of lines from the start of NBR.
1435 # define TV_VBURST_END_F1_MASK 0x000000ff
1436 # define TV_VBURST_END_F1_SHIFT 0
1438 #define TV_V_CTL_5 0x6804c
1440 * Offset to start of vertical colorburst, measured in one less than the
1441 * number of lines from vertical start.
1443 # define TV_VBURST_START_F2_MASK 0x003f0000
1444 # define TV_VBURST_START_F2_SHIFT 16
1446 * Offset to the end of vertical colorburst, measured in one less than the
1447 * number of lines from the start of NBR.
1449 # define TV_VBURST_END_F2_MASK 0x000000ff
1450 # define TV_VBURST_END_F2_SHIFT 0
1452 #define TV_V_CTL_6 0x68050
1454 * Offset to start of vertical colorburst, measured in one less than the
1455 * number of lines from vertical start.
1457 # define TV_VBURST_START_F3_MASK 0x003f0000
1458 # define TV_VBURST_START_F3_SHIFT 16
1460 * Offset to the end of vertical colorburst, measured in one less than the
1461 * number of lines from the start of NBR.
1463 # define TV_VBURST_END_F3_MASK 0x000000ff
1464 # define TV_VBURST_END_F3_SHIFT 0
1466 #define TV_V_CTL_7 0x68054
1468 * Offset to start of vertical colorburst, measured in one less than the
1469 * number of lines from vertical start.
1471 # define TV_VBURST_START_F4_MASK 0x003f0000
1472 # define TV_VBURST_START_F4_SHIFT 16
1474 * Offset to the end of vertical colorburst, measured in one less than the
1475 * number of lines from the start of NBR.
1477 # define TV_VBURST_END_F4_MASK 0x000000ff
1478 # define TV_VBURST_END_F4_SHIFT 0
1480 #define TV_SC_CTL_1 0x68060
1481 /** Turns on the first subcarrier phase generation DDA */
1482 # define TV_SC_DDA1_EN (1 << 31)
1483 /** Turns on the first subcarrier phase generation DDA */
1484 # define TV_SC_DDA2_EN (1 << 30)
1485 /** Turns on the first subcarrier phase generation DDA */
1486 # define TV_SC_DDA3_EN (1 << 29)
1487 /** Sets the subcarrier DDA to reset frequency every other field */
1488 # define TV_SC_RESET_EVERY_2 (0 << 24)
1489 /** Sets the subcarrier DDA to reset frequency every fourth field */
1490 # define TV_SC_RESET_EVERY_4 (1 << 24)
1491 /** Sets the subcarrier DDA to reset frequency every eighth field */
1492 # define TV_SC_RESET_EVERY_8 (2 << 24)
1493 /** Sets the subcarrier DDA to never reset the frequency */
1494 # define TV_SC_RESET_NEVER (3 << 24)
1495 /** Sets the peak amplitude of the colorburst.*/
1496 # define TV_BURST_LEVEL_MASK 0x00ff0000
1497 # define TV_BURST_LEVEL_SHIFT 16
1498 /** Sets the increment of the first subcarrier phase generation DDA */
1499 # define TV_SCDDA1_INC_MASK 0x00000fff
1500 # define TV_SCDDA1_INC_SHIFT 0
1502 #define TV_SC_CTL_2 0x68064
1503 /** Sets the rollover for the second subcarrier phase generation DDA */
1504 # define TV_SCDDA2_SIZE_MASK 0x7fff0000
1505 # define TV_SCDDA2_SIZE_SHIFT 16
1506 /** Sets the increent of the second subcarrier phase generation DDA */
1507 # define TV_SCDDA2_INC_MASK 0x00007fff
1508 # define TV_SCDDA2_INC_SHIFT 0
1510 #define TV_SC_CTL_3 0x68068
1511 /** Sets the rollover for the third subcarrier phase generation DDA */
1512 # define TV_SCDDA3_SIZE_MASK 0x7fff0000
1513 # define TV_SCDDA3_SIZE_SHIFT 16
1514 /** Sets the increent of the third subcarrier phase generation DDA */
1515 # define TV_SCDDA3_INC_MASK 0x00007fff
1516 # define TV_SCDDA3_INC_SHIFT 0
1518 #define TV_WIN_POS 0x68070
1519 /** X coordinate of the display from the start of horizontal active */
1520 # define TV_XPOS_MASK 0x1fff0000
1521 # define TV_XPOS_SHIFT 16
1522 /** Y coordinate of the display from the start of vertical active (NBR) */
1523 # define TV_YPOS_MASK 0x00000fff
1524 # define TV_YPOS_SHIFT 0
1526 #define TV_WIN_SIZE 0x68074
1527 /** Horizontal size of the display window, measured in pixels*/
1528 # define TV_XSIZE_MASK 0x1fff0000
1529 # define TV_XSIZE_SHIFT 16
1531 * Vertical size of the display window, measured in pixels.
1533 * Must be even for interlaced modes.
1535 # define TV_YSIZE_MASK 0x00000fff
1536 # define TV_YSIZE_SHIFT 0
1538 #define TV_FILTER_CTL_1 0x68080
1540 * Enables automatic scaling calculation.
1542 * If set, the rest of the registers are ignored, and the calculated values can
1543 * be read back from the register.
1545 # define TV_AUTO_SCALE (1 << 31)
1547 * Disables the vertical filter.
1549 * This is required on modes more than 1024 pixels wide */
1550 # define TV_V_FILTER_BYPASS (1 << 29)
1551 /** Enables adaptive vertical filtering */
1552 # define TV_VADAPT (1 << 28)
1553 # define TV_VADAPT_MODE_MASK (3 << 26)
1554 /** Selects the least adaptive vertical filtering mode */
1555 # define TV_VADAPT_MODE_LEAST (0 << 26)
1556 /** Selects the moderately adaptive vertical filtering mode */
1557 # define TV_VADAPT_MODE_MODERATE (1 << 26)
1558 /** Selects the most adaptive vertical filtering mode */
1559 # define TV_VADAPT_MODE_MOST (3 << 26)
1561 * Sets the horizontal scaling factor.
1563 * This should be the fractional part of the horizontal scaling factor divided
1564 * by the oversampling rate. TV_HSCALE should be less than 1, and set to:
1566 * (src width - 1) / ((oversample * dest width) - 1)
1568 # define TV_HSCALE_FRAC_MASK 0x00003fff
1569 # define TV_HSCALE_FRAC_SHIFT 0
1571 #define TV_FILTER_CTL_2 0x68084
1573 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
1575 * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1)
1577 # define TV_VSCALE_INT_MASK 0x00038000
1578 # define TV_VSCALE_INT_SHIFT 15
1580 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
1582 * \sa TV_VSCALE_INT_MASK
1584 # define TV_VSCALE_FRAC_MASK 0x00007fff
1585 # define TV_VSCALE_FRAC_SHIFT 0
1587 #define TV_FILTER_CTL_3 0x68088
1589 * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
1591 * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1))
1593 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
1595 # define TV_VSCALE_IP_INT_MASK 0x00038000
1596 # define TV_VSCALE_IP_INT_SHIFT 15
1598 * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
1600 * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
1602 * \sa TV_VSCALE_IP_INT_MASK
1604 # define TV_VSCALE_IP_FRAC_MASK 0x00007fff
1605 # define TV_VSCALE_IP_FRAC_SHIFT 0
1607 #define TV_CC_CONTROL 0x68090
1608 # define TV_CC_ENABLE (1 << 31)
1610 * Specifies which field to send the CC data in.
1612 * CC data is usually sent in field 0.
1614 # define TV_CC_FID_MASK (1 << 27)
1615 # define TV_CC_FID_SHIFT 27
1616 /** Sets the horizontal position of the CC data. Usually 135. */
1617 # define TV_CC_HOFF_MASK 0x03ff0000
1618 # define TV_CC_HOFF_SHIFT 16
1619 /** Sets the vertical position of the CC data. Usually 21 */
1620 # define TV_CC_LINE_MASK 0x0000003f
1621 # define TV_CC_LINE_SHIFT 0
1623 #define TV_CC_DATA 0x68094
1624 # define TV_CC_RDY (1 << 31)
1625 /** Second word of CC data to be transmitted. */
1626 # define TV_CC_DATA_2_MASK 0x007f0000
1627 # define TV_CC_DATA_2_SHIFT 16
1628 /** First word of CC data to be transmitted. */
1629 # define TV_CC_DATA_1_MASK 0x0000007f
1630 # define TV_CC_DATA_1_SHIFT 0
1632 #define TV_H_LUMA_0 0x68100
1633 #define TV_H_LUMA_59 0x681ec
1634 #define TV_H_CHROMA_0 0x68200
1635 #define TV_H_CHROMA_59 0x682ec
1636 #define TV_V_LUMA_0 0x68300
1637 #define TV_V_LUMA_42 0x683a8
1638 #define TV_V_CHROMA_0 0x68400
1639 #define TV_V_CHROMA_42 0x684a8
1641 /* Display & cursor control */
1644 #define PIPEADSL 0x70000
1645 #define PIPEACONF 0x70008
1646 #define PIPEACONF_ENABLE (1<<31)
1647 #define PIPEACONF_DISABLE 0
1648 #define PIPEACONF_DOUBLE_WIDE (1<<30)
1649 #define I965_PIPECONF_ACTIVE (1<<30)
1650 #define PIPEACONF_SINGLE_WIDE 0
1651 #define PIPEACONF_PIPE_UNLOCKED 0
1652 #define PIPEACONF_PIPE_LOCKED (1<<25)
1653 #define PIPEACONF_PALETTE 0
1654 #define PIPEACONF_GAMMA (1<<24)
1655 #define PIPECONF_FORCE_BORDER (1<<25)
1656 #define PIPECONF_PROGRESSIVE (0 << 21)
1657 #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
1658 #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
1659 #define PIPEASTAT 0x70024
1660 #define PIPE_FIFO_UNDERRUN_STATUS (1UL<<31)
1661 #define PIPE_CRC_ERROR_ENABLE (1UL<<29)
1662 #define PIPE_CRC_DONE_ENABLE (1UL<<28)
1663 #define PIPE_GMBUS_EVENT_ENABLE (1UL<<27)
1664 #define PIPE_HOTPLUG_INTERRUPT_ENABLE (1UL<<26)
1665 #define PIPE_VSYNC_INTERRUPT_ENABLE (1UL<<25)
1666 #define PIPE_DISPLAY_LINE_COMPARE_ENABLE (1UL<<24)
1667 #define PIPE_DPST_EVENT_ENABLE (1UL<<23)
1668 #define PIPE_LEGACY_BLC_EVENT_ENABLE (1UL<<22)
1669 #define PIPE_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21)
1670 #define PIPE_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20)
1671 #define PIPE_HOTPLUG_TV_INTERRUPT_ENABLE (1UL<<18) /* pre-965 */
1672 #define PIPE_START_VBLANK_INTERRUPT_ENABLE (1UL<<18) /* 965 or later */
1673 #define PIPE_VBLANK_INTERRUPT_ENABLE (1UL<<17)
1674 #define PIPE_OVERLAY_UPDATED_ENABLE (1UL<<16)
1675 #define PIPE_CRC_ERROR_INTERRUPT_STATUS (1UL<<13)
1676 #define PIPE_CRC_DONE_INTERRUPT_STATUS (1UL<<12)
1677 #define PIPE_GMBUS_INTERRUPT_STATUS (1UL<<11)
1678 #define PIPE_HOTPLUG_INTERRUPT_STATUS (1UL<<10)
1679 #define PIPE_VSYNC_INTERRUPT_STATUS (1UL<<9)
1680 #define PIPE_DISPLAY_LINE_COMPARE_STATUS (1UL<<8)
1681 #define PIPE_DPST_EVENT_STATUS (1UL<<7)
1682 #define PIPE_LEGACY_BLC_EVENT_STATUS (1UL<<6)
1683 #define PIPE_ODD_FIELD_INTERRUPT_STATUS (1UL<<5)
1684 #define PIPE_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4)
1685 #define PIPE_HOTPLUG_TV_INTERRUPT_STATUS (1UL<<2) /* pre-965 */
1686 #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */
1687 #define PIPE_VBLANK_INTERRUPT_STATUS (1UL<<1)
1688 #define PIPE_OVERLAY_UPDATED_STATUS (1UL<<0)
1690 #define DSPARB 0x70030
1691 #define DSPARB_CSTART_MASK (0x7f << 7)
1692 #define DSPARB_CSTART_SHIFT 7
1693 #define DSPARB_BSTART_MASK (0x7f)
1694 #define DSPARB_BSTART_SHIFT 0
1696 * The two pipe frame counter registers are not synchronized, so
1697 * reading a stable value is somewhat tricky. The following code
1701 * high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
1702 * PIPE_FRAME_HIGH_SHIFT;
1703 * low1 = ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >>
1704 * PIPE_FRAME_LOW_SHIFT);
1705 * high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
1706 * PIPE_FRAME_HIGH_SHIFT);
1707 * } while (high1 != high2);
1708 * frame = (high1 << 8) | low1;
1710 #define PIPEAFRAMEHIGH 0x70040
1711 #define PIPE_FRAME_HIGH_MASK 0x0000ffff
1712 #define PIPE_FRAME_HIGH_SHIFT 0
1713 #define PIPEAFRAMEPIXEL 0x70044
1714 #define PIPE_FRAME_LOW_MASK 0xff000000
1715 #define PIPE_FRAME_LOW_SHIFT 24
1716 #define PIPE_PIXEL_MASK 0x00ffffff
1717 #define PIPE_PIXEL_SHIFT 0
1719 /* Cursor A & B regs */
1720 #define CURACNTR 0x70080
1721 #define CURSOR_MODE_DISABLE 0x00
1722 #define CURSOR_MODE_64_32B_AX 0x07
1723 #define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX)
1724 #define MCURSOR_GAMMA_ENABLE (1 << 26)
1725 #define CURABASE 0x70084
1726 #define CURAPOS 0x70088
1727 #define CURSOR_POS_MASK 0x007FF
1728 #define CURSOR_POS_SIGN 0x8000
1729 #define CURSOR_X_SHIFT 0
1730 #define CURSOR_Y_SHIFT 16
1731 #define CURBCNTR 0x700c0
1732 #define CURBBASE 0x700c4
1733 #define CURBPOS 0x700c8
1735 /* Display A control */
1736 #define DSPACNTR 0x70180
1737 #define DISPLAY_PLANE_ENABLE (1<<31)
1738 #define DISPLAY_PLANE_DISABLE 0
1739 #define DISPPLANE_GAMMA_ENABLE (1<<30)
1740 #define DISPPLANE_GAMMA_DISABLE 0
1741 #define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
1742 #define DISPPLANE_8BPP (0x2<<26)
1743 #define DISPPLANE_15_16BPP (0x4<<26)
1744 #define DISPPLANE_16BPP (0x5<<26)
1745 #define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
1746 #define DISPPLANE_32BPP (0x7<<26)
1747 #define DISPPLANE_STEREO_ENABLE (1<<25)
1748 #define DISPPLANE_STEREO_DISABLE 0
1749 #define DISPPLANE_SEL_PIPE_MASK (1<<24)
1750 #define DISPPLANE_SEL_PIPE_A 0
1751 #define DISPPLANE_SEL_PIPE_B (1<<24)
1752 #define DISPPLANE_SRC_KEY_ENABLE (1<<22)
1753 #define DISPPLANE_SRC_KEY_DISABLE 0
1754 #define DISPPLANE_LINE_DOUBLE (1<<20)
1755 #define DISPPLANE_NO_LINE_DOUBLE 0
1756 #define DISPPLANE_STEREO_POLARITY_FIRST 0
1757 #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
1758 #define DSPAADDR 0x70184
1759 #define DSPASTRIDE 0x70188
1760 #define DSPAPOS 0x7018C /* reserved */
1761 #define DSPASIZE 0x70190
1762 #define DSPASURF 0x7019C /* 965+ only */
1763 #define DSPATILEOFF 0x701A4 /* 965+ only */
1766 #define SWF00 0x71410
1767 #define SWF01 0x71414
1768 #define SWF02 0x71418
1769 #define SWF03 0x7141c
1770 #define SWF04 0x71420
1771 #define SWF05 0x71424
1772 #define SWF06 0x71428
1773 #define SWF10 0x70410
1774 #define SWF11 0x70414
1775 #define SWF14 0x71420
1776 #define SWF30 0x72414
1777 #define SWF31 0x72418
1778 #define SWF32 0x7241c
1781 #define PIPEBDSL 0x71000
1782 #define PIPEBCONF 0x71008
1783 #define PIPEBSTAT 0x71024
1784 #define PIPEBFRAMEHIGH 0x71040
1785 #define PIPEBFRAMEPIXEL 0x71044
1787 /* Display B control */
1788 #define DSPBCNTR 0x71180
1789 #define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
1790 #define DISPPLANE_ALPHA_TRANS_DISABLE 0
1791 #define DISPPLANE_SPRITE_ABOVE_DISPLAY 0
1792 #define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
1793 #define DSPBADDR 0x71184
1794 #define DSPBSTRIDE 0x71188
1795 #define DSPBPOS 0x7118C
1796 #define DSPBSIZE 0x71190
1797 #define DSPBSURF 0x7119C
1798 #define DSPBTILEOFF 0x711A4
1801 #define VGACNTRL 0x71400
1802 # define VGA_DISP_DISABLE (1 << 31)
1803 # define VGA_2X_MODE (1 << 30)
1804 # define VGA_PIPE_B_SELECT (1 << 29)
1806 /* Chipset type macros */
1808 #define IS_I830(dev) ((dev)->pci_device == 0x3577)
1809 #define IS_845G(dev) ((dev)->pci_device == 0x2562)
1810 #define IS_I85X(dev) ((dev)->pci_device == 0x3582)
1811 #define IS_I855(dev) ((dev)->pci_device == 0x3582)
1812 #define IS_I865G(dev) ((dev)->pci_device == 0x2572)
1814 #define IS_I915G(dev) ((dev)->pci_device == 0x2582 || (dev)->pci_device == 0x258a)
1815 #define IS_I915GM(dev) ((dev)->pci_device == 0x2592)
1816 #define IS_I945G(dev) ((dev)->pci_device == 0x2772)
1817 #define IS_I945GM(dev) ((dev)->pci_device == 0x27A2 ||\
1818 (dev)->pci_device == 0x27AE)
1819 #define IS_I965G(dev) ((dev)->pci_device == 0x2972 || \
1820 (dev)->pci_device == 0x2982 || \
1821 (dev)->pci_device == 0x2992 || \
1822 (dev)->pci_device == 0x29A2 || \
1823 (dev)->pci_device == 0x2A02 || \
1824 (dev)->pci_device == 0x2A12 || \
1825 (dev)->pci_device == 0x2A42)
1827 #define IS_I965GM(dev) ((dev)->pci_device == 0x2A02)
1829 #define IS_IGD_GM(dev) ((dev)->pci_device == 0x2A42)
1831 #define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \
1832 (dev)->pci_device == 0x29B2 || \
1833 (dev)->pci_device == 0x29D2)
1835 #define IS_I9XX(dev) (IS_I915G(dev) || IS_I915GM(dev) || IS_I945G(dev) || \
1836 IS_I945GM(dev) || IS_I965G(dev) || IS_G33(dev))
1838 #define IS_MOBILE(dev) (IS_I830(dev) || IS_I85X(dev) || IS_I915GM(dev) || \
1839 IS_I945GM(dev) || IS_I965GM(dev) || IS_IGD_GM(dev))
1841 #define I915_NEED_GFX_HWS(dev) (IS_G33(dev) || IS_IGD_GM(dev))