Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm into modesetting-101
authorAlan Hourihane <alanh@tungstengraphics.com>
Wed, 28 May 2008 20:01:18 +0000 (21:01 +0100)
committerAlan Hourihane <alanh@tungstengraphics.com>
Wed, 28 May 2008 20:01:18 +0000 (21:01 +0100)
Conflicts:

shared-core/i915_dma.c
shared-core/i915_drv.h

1  2 
shared-core/drm_pciids.txt
shared-core/i915_dma.c
shared-core/i915_drv.h
shared-core/i915_irq.c
shared-core/radeon_drm.h
shared-core/radeon_state.c

Simple merge
@@@ -262,15 -263,12 +262,15 @@@ static int i915_initialize(struct drm_d
                I915_WRITE(0x02080, dev_priv->dma_status_page);
        }
        DRM_DEBUG("Enabled hardware status page\n");
 +
  #ifdef I915_HAVE_BUFFER
 -      mutex_init(&dev_priv->cmdbuf_mutex);
 +      if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
 +              mutex_init(&dev_priv->cmdbuf_mutex);
 +      }
  #endif
+ #if defined(I915_HAVE_BUFFER)
        if (init->func == I915_INIT_DMA2) {
 -              ret = setup_dri2_sarea(dev, file_priv, init);
 +              int ret = setup_dri2_sarea(dev, file_priv, init);
                if (ret) {
                        i915_dma_cleanup(dev);
                        DRM_ERROR("could not set up dri2 sarea\n");
@@@ -167,25 -146,13 +167,27 @@@ struct drm_i915_private 
  #endif
  
        DRM_SPINTYPE swaps_lock;
 -      drm_i915_vbl_swap_t vbl_swaps;
 +      struct drm_i915_vbl_swap vbl_swaps;
        unsigned int swaps_pending;
 +
 +      /* LVDS info */
 +      int backlight_duty_cycle;  /* restore backlight to this value */
 +      bool panel_wants_dither;
 +      struct drm_display_mode *panel_fixed_mode;
 +      struct drm_display_mode *vbt_mode; /* if any */
 +
+ #if defined(I915_HAVE_BUFFER)
        /* DRI2 sarea */
        struct drm_buffer_object *sarea_bo;
        struct drm_bo_kmap_obj sarea_kmap;
 +
 +      /* Feature bits from the VBIOS */
 +      int int_tv_support:1;
 +      int lvds_dither:1;
 +      int lvds_vbt:1;
 +      int int_crt_support:1;
+ #endif
 +
        /* Register state */
        u8 saveLBB;
        u32 saveDSPACNTR;
@@@ -507,146 -422,30 +509,145 @@@ extern int i915_wait_ring(struct drm_de
  #define VGA_CR_INDEX_CGA 0x3d4
  #define VGA_CR_DATA_CGA 0x3d5
  
 -#define GFX_OP_USER_INTERRUPT         ((0<<29)|(2<<23))
 -#define GFX_OP_BREAKPOINT_INTERRUPT   ((0<<29)|(1<<23))
 -#define CMD_REPORT_HEAD                       (7<<23)
 -#define CMD_STORE_DWORD_IMM             ((0x20<<23) | (0x1 << 22) | 0x1)
 -#define CMD_STORE_DWORD_IDX           ((0x21<<23) | 0x1)
 -#define CMD_OP_BATCH_BUFFER  ((0x0<<29)|(0x30<<23)|0x1)
 -
 -#define CMD_MI_FLUSH         (0x04 << 23)
 -#define MI_NO_WRITE_FLUSH    (1 << 2)
 -#define MI_READ_FLUSH        (1 << 0)
 -#define MI_EXE_FLUSH         (1 << 1)
 -#define MI_END_SCENE         (1 << 4) /* flush binner and incr scene count */
 -#define MI_SCENE_COUNT       (1 << 3) /* just increment scene count */
 -
 -/* Packet to load a register value from the ring/batch command stream:
 +/*
 + * Memory interface instructions used by the kernel
 + */
 +#define MI_INSTR(opcode, flags) (((opcode) << 23) | (flags))
 +
 +#define MI_NOOP                       MI_INSTR(0, 0)
 +#define MI_USER_INTERRUPT     MI_INSTR(0x02, 0)
 +#define MI_WAIT_FOR_EVENT       MI_INSTR(0x03, 0)
 +#define   MI_WAIT_FOR_PLANE_B_FLIP      (1<<6)
 +#define   MI_WAIT_FOR_PLANE_A_FLIP      (1<<2)
 +#define   MI_WAIT_FOR_PLANE_A_SCANLINES (1<<1)
 +#define MI_FLUSH              MI_INSTR(0x04, 0)
 +#define   MI_READ_FLUSH               (1 << 0)
 +#define   MI_EXE_FLUSH                (1 << 1)
 +#define   MI_NO_WRITE_FLUSH   (1 << 2)
 +#define   MI_SCENE_COUNT      (1 << 3) /* just increment scene count */
 +#define   MI_END_SCENE                (1 << 4) /* flush binner and incr scene count */
 +#define MI_BATCH_BUFFER_END   MI_INSTR(0x0a, 0)
 +#define MI_REPORT_HEAD                MI_INSTR(0x07, 0)
 +#define MI_LOAD_SCAN_LINES_INCL MI_INSTR(0x12, 0)
 +#define MI_STORE_DWORD_IMM    MI_INSTR(0x20, 1) /* used to have 1<<22? */
 +#define MI_STORE_DWORD_INDEX  MI_INSTR(0x21, 1)
 +#define MI_LOAD_REGISTER_IMM  MI_INSTR(0x22, 1)
 +#define MI_BATCH_BUFFER               MI_INSTR(0x30, 1)
 +#define   MI_BATCH_NON_SECURE (1)
 +#define   MI_BATCH_NON_SECURE_I965 (1<<8)
 +#define MI_BATCH_BUFFER_START MI_INSTR(0x31, 0)
 +
 +/*
 + * 3D instructions used by the kernel
   */
 -#define CMD_MI_LOAD_REGISTER_IMM      ((0x22 << 23)|0x1)
 +#define GFX_INSTR(opcode, flags) ((0x3 << 29) | ((opcode) << 24) | (flags))
 +
 +#define GFX_OP_RASTER_RULES    ((0x3<<29)|(0x7<<24))
 +#define GFX_OP_SCISSOR         ((0x3<<29)|(0x1c<<24)|(0x10<<19))
 +#define   SC_UPDATE_SCISSOR       (0x1<<1)
 +#define   SC_ENABLE_MASK          (0x1<<0)
 +#define   SC_ENABLE               (0x1<<0)
 +#define GFX_OP_LOAD_INDIRECT   ((0x3<<29)|(0x1d<<24)|(0x7<<16))
 +#define GFX_OP_SCISSOR_INFO    ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
 +#define   SCI_YMIN_MASK      (0xffff<<16)
 +#define   SCI_XMIN_MASK      (0xffff<<0)
 +#define   SCI_YMAX_MASK      (0xffff<<16)
 +#define   SCI_XMAX_MASK      (0xffff<<0)
 +#define GFX_OP_SCISSOR_ENABLE  ((0x3<<29)|(0x1c<<24)|(0x10<<19))
 +#define GFX_OP_SCISSOR_RECT    ((0x3<<29)|(0x1d<<24)|(0x81<<16)|1)
 +#define GFX_OP_COLOR_FACTOR      ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
 +#define GFX_OP_STIPPLE           ((0x3<<29)|(0x1d<<24)|(0x83<<16))
 +#define GFX_OP_MAP_INFO          ((0x3<<29)|(0x1d<<24)|0x4)
 +#define GFX_OP_DESTBUFFER_VARS   ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
 +#define GFX_OP_DRAWRECT_INFO     ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
 +#define GFX_OP_DRAWRECT_INFO_I965  ((0x7900<<16)|0x2)
 +#define SRC_COPY_BLT_CMD                ((2<<29)|(0x43<<22)|4)
 +#define XY_SRC_COPY_BLT_CMD           ((2<<29)|(0x53<<22)|6)
 +#define XY_MONO_SRC_COPY_IMM_BLT      ((2<<29)|(0x71<<22)|5)
 +#define XY_SRC_COPY_BLT_WRITE_ALPHA   (1<<21)
 +#define XY_SRC_COPY_BLT_WRITE_RGB     (1<<20)
 +#define   BLT_DEPTH_8                 (0<<24)
 +#define   BLT_DEPTH_16_565            (1<<24)
 +#define   BLT_DEPTH_16_1555           (2<<24)
 +#define   BLT_DEPTH_32                        (3<<24)
 +#define   BLT_ROP_GXCOPY              (0xcc<<16)
 +#define XY_SRC_COPY_BLT_SRC_TILED     (1<<15)
 +#define XY_SRC_COPY_BLT_DST_TILED     (1<<11)
 +#define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2)
 +#define   ASYNC_FLIP                (1<<22)
 +#define   DISPLAY_PLANE_A           (0<<20)
 +#define   DISPLAY_PLANE_B           (1<<20)
  
 -#define BB1_START_ADDR_MASK   (~0x7)
 -#define BB1_PROTECTED         (1<<0)
 -#define BB1_UNPROTECTED       (0<<0)
 -#define BB2_END_ADDR_MASK     (~0x7)
 +/*
 + * Instruction and interrupt control regs
 + */
 +
 +#define PRB0_TAIL     0x02030
 +#define PRB0_HEAD     0x02034
 +#define PRB0_START    0x02038
 +#define PRB0_CTL      0x0203c
 +#define   TAIL_ADDR           0x001FFFF8
 +#define   HEAD_WRAP_COUNT     0xFFE00000
 +#define   HEAD_WRAP_ONE               0x00200000
 +#define   HEAD_ADDR           0x001FFFFC
- #define   START_ADDR          0x0xFFFFF000
 +#define   RING_NR_PAGES               0x001FF000
 +#define   RING_REPORT_MASK    0x00000006
 +#define   RING_REPORT_64K     0x00000002
 +#define   RING_REPORT_128K    0x00000004
 +#define   RING_NO_REPORT      0x00000000
 +#define   RING_VALID_MASK     0x00000001
 +#define   RING_VALID          0x00000001
 +#define   RING_INVALID                0x00000000
 +#define PRB1_TAIL     0x02040 /* 915+ only */
 +#define PRB1_HEAD     0x02044 /* 915+ only */
 +#define PRB1_START    0x02048 /* 915+ only */
 +#define PRB1_CTL      0x0204c /* 915+ only */
 +#define HWS_PGA               0x02080
 +#define IPEIR         0x02088
 +#define NOPID         0x02094
 +#define HWSTAM                0x02098
 +#define SCPD0         0x0209c /* 915+ only */
 +#define IER           0x020a0
 +#define IIR           0x020a4
 +#define IMR           0x020a8
 +#define ISR           0x020ac
 +#define   I915_PIPE_CONTROL_NOTIFY_INTERRUPT          (1<<18)
 +#define   I915_DISPLAY_PORT_INTERRUPT                 (1<<17)
 +#define   I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT  (1<<15)
 +#define   I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT    (1<<14)
 +#define   I915_HWB_OOM_INTERRUPT                      (1<<13)
 +#define   I915_SYNC_STATUS_INTERRUPT                  (1<<12)
 +#define   I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT (1<<11)
 +#define   I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT (1<<10)
 +#define   I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT   (1<<9)
 +#define   I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT (1<<8)
 +#define   I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT                (1<<7)
 +#define   I915_DISPLAY_PIPE_A_EVENT_INTERRUPT         (1<<6)
 +#define   I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT                (1<<5)
 +#define   I915_DISPLAY_PIPE_B_EVENT_INTERRUPT         (1<<4)
 +#define   I915_DEBUG_INTERRUPT                                (1<<2)
 +#define   I915_USER_INTERRUPT                         (1<<1)
 +#define EIR           0x020b0
 +#define EMR           0x020b4
 +#define ESR           0x020b8
 +#define INSTPM                0x020c0
 +#define FW_BLC                0x020d8
 +#define FW_BLC_SELF   0x020e0 /* 915+ only */
 +#define MI_ARB_STATE  0x020e4 /* 915+ only */
 +#define CACHE_MODE_0  0x02120 /* 915+ only */
 +#define   CM0_MASK_SHIFT          16
 +#define   CM0_IZ_OPT_DISABLE      (1<<6)
 +#define   CM0_ZR_OPT_DISABLE      (1<<5)
 +#define   CM0_DEPTH_EVICT_DISABLE (1<<4)
 +#define   CM0_COLOR_EVICT_DISABLE (1<<3)
 +#define   CM0_DEPTH_WRITE_DISABLE (1<<1)
 +#define   CM0_RC_OP_FLUSH_DISABLE (1<<0)
 +#define GFX_FLSH_CNTL 0x02170 /* 915+ only */
 +
 +/*
 + * Framebuffer compression (915+ only)
 + */
  
 -/* Framebuffer compression */
  #define FBC_CFB_BASE          0x03200 /* 4k page aligned */
  #define FBC_LL_BASE           0x03204 /* 4k page aligned */
  #define FBC_CONTROL           0x03208
  #define FBC_FENCE_OFF         0x0321b
  
  #define FBC_LL_SIZE           (1536)
 -#define FBC_LL_PAD            (32)
  
 -/* Interrupt bits:
 +/*
 + * GPIO regs
   */
 -#define I915_PIPE_CONTROL_NOTIFY_INTERRUPT            (1<<18)
 -#define I915_DISPLAY_PORT_INTERRUPT                   (1<<17)
 -#define I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT    (1<<15)
 -#define I915_GMCH_THERMAL_SENSOR_EVENT_INTERRUPT      (1<<14)
 -#define I915_HWB_OOM_INTERRUPT                                (1<<13) /* binner out of memory */
 -#define I915_SYNC_STATUS_INTERRUPT                    (1<<12)
 -#define I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT   (1<<11)
 -#define I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT   (1<<10)
 -#define I915_OVERLAY_PLANE_FLIP_PENDING_INTERRUPT     (1<<9)
 -#define I915_DISPLAY_PLANE_C_FLIP_PENDING_INTERRUPT   (1<<8)
 -#define I915_DISPLAY_PIPE_A_VBLANK_INTERRUPT          (1<<7)
 -#define I915_DISPLAY_PIPE_A_EVENT_INTERRUPT           (1<<6)
 -#define I915_DISPLAY_PIPE_B_VBLANK_INTERRUPT          (1<<5)
 -#define I915_DISPLAY_PIPE_B_EVENT_INTERRUPT           (1<<4)
 -#define I915_DEBUG_INTERRUPT                          (1<<2)
 -#define I915_USER_INTERRUPT                           (1<<1)
 -
 -
 -#define I915REG_HWSTAM                0x02098
 -#define I915REG_INT_IDENTITY_R        0x020a4
 -#define I915REG_INT_MASK_R    0x020a8
 -#define I915REG_INT_ENABLE_R  0x020a0
 -#define I915REG_INSTPM                0x020c0
  
 -#define PIPEADSL              0x70000
 -#define PIPEBDSL              0x71000
 +#define GPIOA                 0x5010
 +#define GPIOB                 0x5014
 +#define GPIOC                 0x5018
 +#define GPIOD                 0x501c
 +#define GPIOE                 0x5020
 +#define GPIOF                 0x5024
 +#define GPIOG                 0x5028
 +#define GPIOH                 0x502c
 +# define GPIO_CLOCK_DIR_MASK          (1 << 0)
 +# define GPIO_CLOCK_DIR_IN            (0 << 1)
 +# define GPIO_CLOCK_DIR_OUT           (1 << 1)
 +# define GPIO_CLOCK_VAL_MASK          (1 << 2)
 +# define GPIO_CLOCK_VAL_OUT           (1 << 3)
 +# define GPIO_CLOCK_VAL_IN            (1 << 4)
 +# define GPIO_CLOCK_PULLUP_DISABLE    (1 << 5)
 +# define GPIO_DATA_DIR_MASK           (1 << 8)
 +# define GPIO_DATA_DIR_IN             (0 << 9)
 +# define GPIO_DATA_DIR_OUT            (1 << 9)
 +# define GPIO_DATA_VAL_MASK           (1 << 10)
 +# define GPIO_DATA_VAL_OUT            (1 << 11)
 +# define GPIO_DATA_VAL_IN             (1 << 12)
 +# define GPIO_DATA_PULLUP_DISABLE     (1 << 13)
  
 -#define I915REG_PIPEASTAT     0x70024
 -#define I915REG_PIPEBSTAT     0x71024
  /*
 - * The two pipe frame counter registers are not synchronized, so
 - * reading a stable value is somewhat tricky. The following code 
 - * should work:
 - *
 - *  do {
 - *    high1 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
 - *             PIPE_FRAME_HIGH_SHIFT;
 - *    low1 =  ((INREG(PIPEAFRAMEPIXEL) & PIPE_FRAME_LOW_MASK) >>
 - *             PIPE_FRAME_LOW_SHIFT);
 - *    high2 = ((INREG(PIPEAFRAMEHIGH) & PIPE_FRAME_HIGH_MASK) >>
 - *             PIPE_FRAME_HIGH_SHIFT);
 - *  } while (high1 != high2);
 - *  frame = (high1 << 8) | low1;
 + * Clock control & power management
   */
 -#define PIPEAFRAMEHIGH          0x70040
 -#define PIPEBFRAMEHIGH                0x71040
 -#define PIPE_FRAME_HIGH_MASK    0x0000ffff
 -#define PIPE_FRAME_HIGH_SHIFT   0
 -#define PIPEAFRAMEPIXEL         0x70044
 -#define PIPEBFRAMEPIXEL               0x71044
  
 -#define PIPE_FRAME_LOW_MASK     0xff000000
 -#define PIPE_FRAME_LOW_SHIFT    24
 +#define VGA0  0x6000
 +#define VGA1  0x6004
 +#define VGA_PD        0x6010
 +#define   VGA0_PD_P2_DIV_4    (1 << 7)
 +#define   VGA0_PD_P1_DIV_2    (1 << 5)
 +#define   VGA0_PD_P1_SHIFT    0
 +#define   VGA0_PD_P1_MASK     (0x1f << 0)
 +#define   VGA1_PD_P2_DIV_4    (1 << 15)
 +#define   VGA1_PD_P1_DIV_2    (1 << 13)
 +#define   VGA1_PD_P1_SHIFT    8
 +#define   VGA1_PD_P1_MASK     (0x1f << 8)
 +#define DPLL_A        0x06014
 +#define DPLL_B        0x06018
 +#define   DPLL_VCO_ENABLE             (1 << 31)
 +#define   DPLL_DVO_HIGH_SPEED         (1 << 30)
 +#define   DPLL_SYNCLOCK_ENABLE                (1 << 29)
 +#define   DPLL_VGA_MODE_DIS           (1 << 28)
 +#define   DPLLB_MODE_DAC_SERIAL               (1 << 26) /* i915 */
 +#define   DPLLB_MODE_LVDS             (2 << 26) /* i915 */
 +#define   DPLL_MODE_MASK              (3 << 26)
 +#define   DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
 +#define   DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
 +#define   DPLLB_LVDS_P2_CLOCK_DIV_14  (0 << 24) /* i915 */
 +#define   DPLLB_LVDS_P2_CLOCK_DIV_7   (1 << 24) /* i915 */
 +#define   DPLL_P2_CLOCK_DIV_MASK      0x03000000 /* i915 */
 +#define   DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
  /*
-  *  The i830 generation, in DAC/serial mode, defines p1 as two plus this
-  * bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set.
+  * Pixel within the current frame is counted in the PIPEAFRAMEPIXEL register
+  * and is 24 bits wide.
+  */
+ #define PIPE_PIXEL_MASK         0x00ffffff
+ #define PIPE_PIXEL_SHIFT        0
+ #define I915_FIFO_UNDERRUN_STATUS             (1UL<<31)
+ #define I915_CRC_ERROR_ENABLE                 (1UL<<29)
+ #define I915_CRC_DONE_ENABLE                  (1UL<<28)
+ #define I915_GMBUS_EVENT_ENABLE                       (1UL<<27)
+ #define I915_VSYNC_INTERRUPT_ENABLE           (1UL<<25)
+ #define I915_DISPLAY_LINE_COMPARE_ENABLE      (1UL<<24)
+ #define I915_DPST_EVENT_ENABLE                        (1UL<<23)
+ #define I915_LEGACY_BLC_EVENT_ENABLE          (1UL<<22)
+ #define I915_ODD_FIELD_INTERRUPT_ENABLE               (1UL<<21)
+ #define I915_EVEN_FIELD_INTERRUPT_ENABLE      (1UL<<20)
+ #define I915_START_VBLANK_INTERRUPT_ENABLE    (1UL<<18)       /* 965 or later */
+ #define I915_VBLANK_INTERRUPT_ENABLE          (1UL<<17)
+ #define I915_OVERLAY_UPDATED_ENABLE           (1UL<<16)
+ #define I915_CRC_ERROR_INTERRUPT_STATUS               (1UL<<13)
+ #define I915_CRC_DONE_INTERRUPT_STATUS                (1UL<<12)
+ #define I915_GMBUS_INTERRUPT_STATUS           (1UL<<11)
+ #define I915_VSYNC_INTERRUPT_STATUS           (1UL<<9)
+ #define I915_DISPLAY_LINE_COMPARE_STATUS      (1UL<<8)
+ #define I915_DPST_EVENT_STATUS                        (1UL<<7)
+ #define I915_LEGACY_BLC_EVENT_STATUS          (1UL<<6)
+ #define I915_ODD_FIELD_INTERRUPT_STATUS               (1UL<<5)
+ #define I915_EVEN_FIELD_INTERRUPT_STATUS      (1UL<<4)
+ #define I915_START_VBLANK_INTERRUPT_STATUS    (1UL<<2)        /* 965 or later */
+ #define I915_VBLANK_INTERRUPT_STATUS          (1UL<<1)
+ #define I915_OVERLAY_UPDATED_STATUS           (1UL<<0)
+ #define SRX_INDEX             0x3c4
+ #define SRX_DATA              0x3c5
+ #define SR01                  1
+ #define SR01_SCREEN_OFF               (1<<5)
+ #define PPCR                  0x61204
+ #define PPCR_ON                       (1<<0)
+ #define DVOB                  0x61140
+ #define DVOB_ON                       (1<<31)
+ #define DVOC                  0x61160
+ #define DVOC_ON                       (1<<31)
+ #define LVDS                  0x61180
+ #define LVDS_ON                       (1<<31)
+ #define ADPA                  0x61100
+ #define ADPA_DPMS_MASK                (~(3<<10))
+ #define ADPA_DPMS_ON          (0<<10)
+ #define ADPA_DPMS_SUSPEND     (1<<10)
+ #define ADPA_DPMS_STANDBY     (2<<10)
+ #define ADPA_DPMS_OFF         (3<<10)
 -#define NOPID                   0x2094
+ #define LP_RING                       0x2030
+ #define HP_RING                       0x2040
+ /* The binner has its own ring buffer:
+  */
+ #define HWB_RING              0x2400
+ #define RING_TAIL             0x00
+ #define TAIL_ADDR             0x001FFFF8
+ #define RING_HEAD             0x04
+ #define HEAD_WRAP_COUNT               0xFFE00000
+ #define HEAD_WRAP_ONE         0x00200000
+ #define HEAD_ADDR             0x001FFFFC
+ #define RING_START            0x08
+ #define START_ADDR            0xFFFFF000
+ #define RING_LEN              0x0C
+ #define RING_NR_PAGES         0x001FF000
+ #define RING_REPORT_MASK      0x00000006
+ #define RING_REPORT_64K               0x00000002
+ #define RING_REPORT_128K      0x00000004
+ #define RING_NO_REPORT                0x00000000
+ #define RING_VALID_MASK               0x00000001
+ #define RING_VALID            0x00000001
+ #define RING_INVALID          0x00000000
 -/* Instruction parser error reg:
 - */
 -#define IPEIR                 0x2088
 -
+ /* Scratch pad debug 0 reg:
   */
 -#define SCPD0                 0x209c
 -
 -/* Error status reg:
 +#define   DPLL_FPA01_P1_POST_DIV_MASK_I830    0x001f0000
 +/*
 + * The i830 generation, in LVDS mode, defines P1 as the bit number set within
 + * this field (only one bit may be set).
   */
 -#define ESR                   0x20b8
 -
 -/* Secondary DMA fetch address debug reg:
 +#define   DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS       0x003f0000
 +#define   DPLL_FPA01_P1_POST_DIV_SHIFT        16
 +/* i830, required in DVO non-gang */
 +#define   PLL_P2_DIVIDE_BY_4          (1 << 23)
 +#define   PLL_P1_DIVIDE_BY_TWO                (1 << 21) /* i830 */
 +#define   PLL_REF_INPUT_DREFCLK               (0 << 13)
 +#define   PLL_REF_INPUT_TVCLKINA      (1 << 13) /* i830 */
 +#define   PLL_REF_INPUT_TVCLKINBC     (2 << 13) /* SDVO TVCLKIN */
 +#define   PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
 +#define   PLL_REF_INPUT_MASK          (3 << 13)
 +#define   PLL_LOAD_PULSE_PHASE_SHIFT          9
 +/*
 + * Parallel to Serial Load Pulse phase selection.
 + * Selects the phase for the 10X DPLL clock for the PCIe
 + * digital display port. The range is 4 to 13; 10 or more
 + * is just a flip delay. The default is 6
   */
 -#define DMA_FADD_S            0x20d4
 -
 -/* Memory Interface Arbitration State
 +#define   PLL_LOAD_PULSE_PHASE_MASK           (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
 +#define   DISPLAY_RATE_SELECT_FPA1            (1 << 8)
 +/*
 + * SDVO multiplier for 945G/GM. Not used on 965.
   */
 -#define MI_ARB_STATE          0x20e4
 -
 -/* Cache mode 0 reg.
 - *  - Manipulating render cache behaviour is central
 - *    to the concept of zone rendering, tuning this reg can help avoid
 - *    unnecessary render cache reads and even writes (for z/stencil)
 - *    at beginning and end of scene.
 +#define   SDVO_MULTIPLIER_MASK                        0x000000ff
 +#define   SDVO_MULTIPLIER_SHIFT_HIRES         4
 +#define   SDVO_MULTIPLIER_SHIFT_VGA           0
 +#define DPLL_A_MD 0x0601c /* 965+ only */
 +/*
 + * UDI pixel divider, controlling how many pixels are stuffed into a packet.
   *
 - * - To change a bit, write to this reg with a mask bit set and the
 - * bit of interest either set or cleared.  EG: (BIT<<16) | BIT to set.
 - */
 -#define Cache_Mode_0          0x2120
 -#define CACHE_MODE_0          0x2120
 -#define CM0_MASK_SHIFT          16
 -#define CM0_IZ_OPT_DISABLE      (1<<6)
 -#define CM0_ZR_OPT_DISABLE      (1<<5)
 -#define CM0_DEPTH_EVICT_DISABLE (1<<4)
 -#define CM0_COLOR_EVICT_DISABLE (1<<3)
 -#define CM0_DEPTH_WRITE_DISABLE (1<<1)
 -#define CM0_RC_OP_FLUSH_DISABLE (1<<0)
 -
 -
 -/* Graphics flush control.  A CPU write flushes the GWB of all writes.
 - * The data is discarded.
 - */
 -#define GFX_FLSH_CNTL         0x2170
 -
 -/* Binner control.  Defines the location of the bin pointer list:
 - */
 -#define BINCTL                        0x2420
 -#define BC_MASK                       (1 << 9)
 -
 -/* Binned scene info.
 - */
 -#define BINSCENE              0x2428
 -#define BS_OP_LOAD            (1 << 8)
 -#define BS_MASK                       (1 << 22)
 -
 -/* Bin command parser debug reg:
 - */
 -#define BCPD                  0x2480
 -
 -/* Bin memory control debug reg:
 - */
 -#define BMCD                  0x2484
 -
 -/* Bin data cache debug reg:
 - */
 -#define BDCD                  0x2488
 -
 -/* Binner pointer cache debug reg:
 - */
 -#define BPCD                  0x248c
 -
 -/* Binner scratch pad debug reg:
 - */
 -#define BINSKPD                       0x24f0
 -
 -/* HWB scratch pad debug reg:
 + * Value is pixels minus 1.  Must be set to 1 pixel for SDVO.
   */
 -#define HWBSKPD                       0x24f4
 -
 -/* Binner memory pool reg:
 +#define   DPLL_MD_UDI_DIVIDER_MASK            0x3f000000
 +#define   DPLL_MD_UDI_DIVIDER_SHIFT           24
 +/* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
 +#define   DPLL_MD_VGA_UDI_DIVIDER_MASK                0x003f0000
 +#define   DPLL_MD_VGA_UDI_DIVIDER_SHIFT               16
 +/*
 + * SDVO/UDI pixel multiplier.
 + *
 + * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
 + * clock rate is 10 times the DPLL clock.  At low resolution/refresh rate
 + * modes, the bus rate would be below the limits, so SDVO allows for stuffing
 + * dummy bytes in the datastream at an increased clock rate, with both sides of
 + * the link knowing how many bytes are fill.
 + *
 + * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
 + * rate to 130Mhz to get a bus rate of 1.30Ghz.  The DPLL clock rate would be
 + * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
 + * through an SDVO command.
 + *
 + * This register field has values of multiplication factor minus 1, with
 + * a maximum multiplier of 5 for SDVO.
   */
 -#define BMP_BUFFER            0x2430
 -#define BMP_PAGE_SIZE_4K      (0 << 10)
 -#define BMP_BUFFER_SIZE_SHIFT 1
 -#define BMP_ENABLE            (1 << 0)
 -
 -/* Get/put memory from the binner memory pool:
 +#define   DPLL_MD_UDI_MULTIPLIER_MASK         0x00003f00
 +#define   DPLL_MD_UDI_MULTIPLIER_SHIFT                8
 +/*
 + * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
 + * This best be set to the default value (3) or the CRT won't work. No,
 + * I don't entirely understand what this does...
   */
 -#define BMP_GET                       0x2438
 -#define BMP_PUT                       0x2440
 -#define BMP_OFFSET_SHIFT      5
 +#define   DPLL_MD_VGA_UDI_MULTIPLIER_MASK     0x0000003f
 +#define   DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT    0
 +#define DPLL_B_MD 0x06020 /* 965+ only */
 +#define FPA0  0x06040
 +#define FPA1  0x06044
 +#define FPB0  0x06048
 +#define FPB1  0x0604c
 +#define   FP_N_DIV_MASK               0x003f0000
 +#define   FP_N_DIV_SHIFT              16
 +#define   FP_M1_DIV_MASK      0x00003f00
 +#define   FP_M1_DIV_SHIFT              8
 +#define   FP_M2_DIV_MASK      0x0000003f
 +#define   FP_M2_DIV_SHIFT              0
 +#define DPLL_TEST     0x606c
 +#define   DPLLB_TEST_SDVO_DIV_1               (0 << 22)
 +#define   DPLLB_TEST_SDVO_DIV_2               (1 << 22)
 +#define   DPLLB_TEST_SDVO_DIV_4               (2 << 22)
 +#define   DPLLB_TEST_SDVO_DIV_MASK    (3 << 22)
 +#define   DPLLB_TEST_N_BYPASS         (1 << 19)
 +#define   DPLLB_TEST_M_BYPASS         (1 << 18)
 +#define   DPLLB_INPUT_BUFFER_ENABLE   (1 << 16)
 +#define   DPLLA_TEST_N_BYPASS         (1 << 3)
 +#define   DPLLA_TEST_M_BYPASS         (1 << 2)
 +#define   DPLLA_INPUT_BUFFER_ENABLE   (1 << 0)
 +#define D_STATE               0x6104
 +#define CG_2D_DIS     0x6200
 +#define CG_3D_DIS     0x6204
  
 -/* 3D state packets:
 +/*
 + * Palette regs
   */
 -#define GFX_OP_RASTER_RULES    ((0x3<<29)|(0x7<<24))
 -
 -#define GFX_OP_SCISSOR         ((0x3<<29)|(0x1c<<24)|(0x10<<19))
 -#define SC_UPDATE_SCISSOR       (0x1<<1)
 -#define SC_ENABLE_MASK          (0x1<<0)
 -#define SC_ENABLE               (0x1<<0)
 -
 -#define GFX_OP_LOAD_INDIRECT   ((0x3<<29)|(0x1d<<24)|(0x7<<16))
 -
 -#define GFX_OP_SCISSOR_INFO    ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
 -#define SCI_YMIN_MASK      (0xffff<<16)
 -#define SCI_XMIN_MASK      (0xffff<<0)
 -#define SCI_YMAX_MASK      (0xffff<<16)
 -#define SCI_XMAX_MASK      (0xffff<<0)
 -
 -#define GFX_OP_SCISSOR_ENABLE  ((0x3<<29)|(0x1c<<24)|(0x10<<19))
 -#define GFX_OP_SCISSOR_RECT    ((0x3<<29)|(0x1d<<24)|(0x81<<16)|1)
 -#define GFX_OP_COLOR_FACTOR      ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
 -#define GFX_OP_STIPPLE           ((0x3<<29)|(0x1d<<24)|(0x83<<16))
 -#define GFX_OP_MAP_INFO          ((0x3<<29)|(0x1d<<24)|0x4)
 -#define GFX_OP_DESTBUFFER_VARS   ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
 -#define GFX_OP_DRAWRECT_INFO     ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
  
 -#define GFX_OP_DRAWRECT_INFO_I965  ((0x7900<<16)|0x2)
 -
 -#define SRC_COPY_BLT_CMD                ((2<<29)|(0x43<<22)|4)
 -#define XY_SRC_COPY_BLT_CMD           ((2<<29)|(0x53<<22)|6)
 -#define XY_SRC_COPY_BLT_WRITE_ALPHA   (1<<21)
 -#define XY_SRC_COPY_BLT_WRITE_RGB     (1<<20)
 -#define XY_SRC_COPY_BLT_SRC_TILED     (1<<15)
 -#define XY_SRC_COPY_BLT_DST_TILED     (1<<11)
 -
 -
 -#define MI_BATCH_BUFFER               ((0x30<<23)|1)
 -#define MI_BATCH_BUFFER_START (0x31<<23)
 -#define MI_BATCH_BUFFER_END   (0xA<<23)
 -#define MI_BATCH_NON_SECURE   (1)
 -
 -#define MI_BATCH_NON_SECURE_I965 (1<<8)
 -
 -#define MI_WAIT_FOR_EVENT       ((0x3<<23))
 -#define MI_WAIT_FOR_PLANE_B_FLIP      (1<<6)
 -#define MI_WAIT_FOR_PLANE_A_FLIP      (1<<2)
 -#define MI_WAIT_FOR_PLANE_A_SCANLINES (1<<1)
 -
 -#define MI_LOAD_SCAN_LINES_INCL  ((0x12<<23))
 -
 -#define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2)
 -#define ASYNC_FLIP                (1<<22)
 -#define DISPLAY_PLANE_A           (0<<20)
 -#define DISPLAY_PLANE_B           (1<<20)
 -
 -/* Display regs */
 -#define DSPACNTR                0x70180
 -#define DSPBCNTR                0x71180
 -#define DISPPLANE_SEL_PIPE_MASK                 (1<<24)
 +#define PALETTE_A             0x0a000
 +#define PALETTE_B             0x0a800
  
 -/* Define the region of interest for the binner:
 +/*
 + * Overlay regs
   */
 -#define CMD_OP_BIN_CONTROL     ((0x3<<29)|(0x1d<<24)|(0x84<<16)|4)
  
 -#define CMD_OP_DESTBUFFER_INFO         ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1)
 -
 -#define BREADCRUMB_BITS 31
 -#define BREADCRUMB_MASK ((1U << BREADCRUMB_BITS) - 1)
 -
 -#define READ_BREADCRUMB(dev_priv)  (((volatile u32*)(dev_priv->hw_status_page))[5])
 -#define READ_HWSP(dev_priv, reg)  (((volatile u32*)(dev_priv->hw_status_page))[reg])
 -
 -#define BLC_PWM_CTL           0x61254
 -#define BACKLIGHT_MODULATION_FREQ_SHIFT               (17)
 +#define OVADD                 0x30000
 +#define DOVSTA                        0x30008
 +#define OC_BUF                        (0x3<<20)
 +#define OGAMC5                        0x30010
 +#define OGAMC4                        0x30014
 +#define OGAMC3                        0x30018
 +#define OGAMC2                        0x3001c
 +#define OGAMC1                        0x30020
 +#define OGAMC0                        0x30024
  
 -#define BLC_PWM_CTL2          0x61250
 -/**
 - * This is the most significant 15 bits of the number of backlight cycles in a
 - * complete cycle of the modulated backlight control.
 - *
 - * The actual value is this field multiplied by two.
 - */
 -#define BACKLIGHT_MODULATION_FREQ_MASK                (0x7fff << 17)
 -#define BLM_LEGACY_MODE                               (1 << 16)
 -/**
 - * This is the number of cycles out of the backlight modulation cycle for which
 - * the backlight is on.
 - *
 - * This field must be no greater than the number of cycles in the complete
 - * backlight modulation cycle.
 - */
 -#define BACKLIGHT_DUTY_CYCLE_SHIFT            (0)
 -#define BACKLIGHT_DUTY_CYCLE_MASK             (0xffff)
 -
 -#define I915_GCFGC                    0xf0
 -#define I915_LOW_FREQUENCY_ENABLE             (1 << 7)
 -#define I915_DISPLAY_CLOCK_190_200_MHZ                (0 << 4)
 -#define I915_DISPLAY_CLOCK_333_MHZ            (4 << 4)
 -#define I915_DISPLAY_CLOCK_MASK                       (7 << 4)
 -
 -#define I855_HPLLCC                   0xc0
 -#define I855_CLOCK_CONTROL_MASK                       (3 << 0)
 -#define I855_CLOCK_133_200                    (0 << 0)
 -#define I855_CLOCK_100_200                    (1 << 0)
 -#define I855_CLOCK_100_133                    (2 << 0)
 -#define I855_CLOCK_166_250                    (3 << 0)
 -
 -/* p317, 319
 +/*
 + * Display engine regs
   */
 -#define VCLK2_VCO_M        0x6008 /* treat as 16 bit? (includes msbs) */
 -#define VCLK2_VCO_N        0x600a
 -#define VCLK2_VCO_DIV_SEL  0x6012
 -
 -#define VCLK_DIVISOR_VGA0   0x6000
 -#define VCLK_DIVISOR_VGA1   0x6004
 -#define VCLK_POST_DIV     0x6010
 -/** Selects a post divisor of 4 instead of 2. */
 -# define VGA1_PD_P2_DIV_4     (1 << 15)
 -/** Overrides the p2 post divisor field */
 -# define VGA1_PD_P1_DIV_2     (1 << 13)
 -# define VGA1_PD_P1_SHIFT     8
 -/** P1 value is 2 greater than this field */
 -# define VGA1_PD_P1_MASK      (0x1f << 8)
 -/** Selects a post divisor of 4 instead of 2. */
 -# define VGA0_PD_P2_DIV_4     (1 << 7)
 -/** Overrides the p2 post divisor field */
 -# define VGA0_PD_P1_DIV_2     (1 << 5)
 -# define VGA0_PD_P1_SHIFT     0
 -/** P1 value is 2 greater than this field */
 -# define VGA0_PD_P1_MASK      (0x1f << 0)
 -
 -/* PCI D state control register */
 -#define D_STATE               0x6104
 -#define DSPCLK_GATE_D 0x6200
  
 -/* I830 CRTC registers */
 +/* Pipe A timing regs */
  #define HTOTAL_A      0x60000
  #define HBLANK_A      0x60004
  #define HSYNC_A               0x60008
Simple merge
Simple merge
Simple merge