Back to home page

OSCL-LXR

 
 

    


0001 #ifndef _INTELFBHW_H
0002 #define _INTELFBHW_H
0003 
0004 /* $DHD: intelfb/intelfbhw.h,v 1.5 2003/06/27 15:06:25 dawes Exp $ */
0005 
0006 
0007 /*** HW-specific data ***/
0008 
0009 /* Information about the 852GM/855GM variants */
0010 #define INTEL_85X_CAPID     0x44
0011 #define INTEL_85X_VARIANT_MASK      0x7
0012 #define INTEL_85X_VARIANT_SHIFT     5
0013 #define INTEL_VAR_855GME        0x0
0014 #define INTEL_VAR_855GM         0x4
0015 #define INTEL_VAR_852GME        0x2
0016 #define INTEL_VAR_852GM         0x5
0017 
0018 /* Information about DVO/LVDS Ports */
0019 #define DVOA_PORT  0x1
0020 #define DVOB_PORT  0x2
0021 #define DVOC_PORT  0x4
0022 #define LVDS_PORT  0x8
0023 
0024 /*
0025  * The Bridge device's PCI config space has information about the
0026  * fb aperture size and the amount of pre-reserved memory.
0027  */
0028 #define INTEL_GMCH_CTRL     0x52
0029 #define INTEL_GMCH_ENABLED      0x4
0030 #define INTEL_GMCH_MEM_MASK     0x1
0031 #define INTEL_GMCH_MEM_64M      0x1
0032 #define INTEL_GMCH_MEM_128M     0
0033 
0034 #define INTEL_830_GMCH_GMS_MASK     (0x7 << 4)
0035 #define INTEL_830_GMCH_GMS_DISABLED (0x0 << 4)
0036 #define INTEL_830_GMCH_GMS_LOCAL    (0x1 << 4)
0037 #define INTEL_830_GMCH_GMS_STOLEN_512   (0x2 << 4)
0038 #define INTEL_830_GMCH_GMS_STOLEN_1024  (0x3 << 4)
0039 #define INTEL_830_GMCH_GMS_STOLEN_8192  (0x4 << 4)
0040 
0041 #define INTEL_855_GMCH_GMS_MASK     (0x7 << 4)
0042 #define INTEL_855_GMCH_GMS_DISABLED (0x0 << 4)
0043 #define INTEL_855_GMCH_GMS_STOLEN_1M    (0x1 << 4)
0044 #define INTEL_855_GMCH_GMS_STOLEN_4M    (0x2 << 4)
0045 #define INTEL_855_GMCH_GMS_STOLEN_8M    (0x3 << 4)
0046 #define INTEL_855_GMCH_GMS_STOLEN_16M   (0x4 << 4)
0047 #define INTEL_855_GMCH_GMS_STOLEN_32M   (0x5 << 4)
0048 
0049 #define INTEL_915G_GMCH_GMS_STOLEN_48M  (0x6 << 4)
0050 #define INTEL_915G_GMCH_GMS_STOLEN_64M  (0x7 << 4)
0051 
0052 /* HW registers */
0053 
0054 /* Fence registers */
0055 #define FENCE           0x2000
0056 #define FENCE_NUM           8
0057 
0058 /* Primary ring buffer */
0059 #define PRI_RING_TAIL       0x2030
0060 #define RING_TAIL_MASK          0x001ffff8
0061 #define RING_INUSE          0x1
0062 
0063 #define PRI_RING_HEAD       0x2034
0064 #define RING_HEAD_WRAP_MASK     0x7ff
0065 #define RING_HEAD_WRAP_SHIFT        21
0066 #define RING_HEAD_MASK          0x001ffffc
0067 
0068 #define PRI_RING_START      0x2038
0069 #define RING_START_MASK         0xfffff000
0070 
0071 #define PRI_RING_LENGTH     0x203c
0072 #define RING_LENGTH_MASK        0x001ff000
0073 #define RING_REPORT_MASK        (0x3 << 1)
0074 #define RING_NO_REPORT          (0x0 << 1)
0075 #define RING_REPORT_64K         (0x1 << 1)
0076 #define RING_REPORT_4K          (0x2 << 1)
0077 #define RING_REPORT_128K        (0x3 << 1)
0078 #define RING_ENABLE         0x1
0079 
0080 /*
0081  * Tail can't wrap to any closer than RING_MIN_FREE bytes of the head,
0082  * and the last RING_MIN_FREE bytes need to be padded with MI_NOOP
0083  */
0084 #define RING_MIN_FREE           64
0085 
0086 #define IPEHR           0x2088
0087 
0088 #define INSTDONE        0x2090
0089 #define PRI_RING_EMPTY          1
0090 
0091 #define HWSTAM          0x2098
0092 #define IER         0x20A0
0093 #define IIR         0x20A4
0094 #define IMR         0x20A8
0095 #define VSYNC_PIPE_A_INTERRUPT      (1 << 7)
0096 #define PIPE_A_EVENT_INTERRUPT      (1 << 6)
0097 #define VSYNC_PIPE_B_INTERRUPT      (1 << 5)
0098 #define PIPE_B_EVENT_INTERRUPT      (1 << 4)
0099 #define HOST_PORT_EVENT_INTERRUPT   (1 << 3)
0100 #define CAPTURE_EVENT_INTERRUPT     (1 << 2)
0101 #define USER_DEFINED_INTERRUPT      (1 << 1)
0102 #define BREAKPOINT_INTERRUPT        1
0103 
0104 #define INSTPM          0x20c0
0105 #define SYNC_FLUSH_ENABLE       (1 << 5)
0106 
0107 #define INSTPS          0x20c4
0108 
0109 #define MEM_MODE        0x20cc
0110 
0111 #define MASK_SHIFT          16
0112 
0113 #define FW_BLC_0        0x20d8
0114 #define FW_DISPA_WM_SHIFT       0
0115 #define FW_DISPA_WM_MASK        0x3f
0116 #define FW_DISPA_BL_SHIFT       8
0117 #define FW_DISPA_BL_MASK        0xf
0118 #define FW_DISPB_WM_SHIFT       16
0119 #define FW_DISPB_WM_MASK        0x1f
0120 #define FW_DISPB_BL_SHIFT       24
0121 #define FW_DISPB_BL_MASK        0x7
0122 
0123 #define FW_BLC_1        0x20dc
0124 #define FW_DISPC_WM_SHIFT       0
0125 #define FW_DISPC_WM_MASK        0x1f
0126 #define FW_DISPC_BL_SHIFT       8
0127 #define FW_DISPC_BL_MASK        0x7
0128 
0129 #define GPIOA             0x5010
0130 #define GPIOB             0x5014
0131 #define GPIOC             0x5018 /* this may be external DDC on i830 */
0132 #define GPIOD             0x501C /* this is DVO DDC */
0133 #define GPIOE             0x5020 /* this is DVO i2C */
0134 #define GPIOF             0x5024
0135 
0136 /* PLL registers */
0137 #define VGA0_DIVISOR        0x06000
0138 #define VGA1_DIVISOR        0x06004
0139 #define VGAPD           0x06010
0140 #define VGAPD_0_P1_SHIFT        0
0141 #define VGAPD_0_P1_FORCE_DIV2       (1 << 5)
0142 #define VGAPD_0_P2_SHIFT        7
0143 #define VGAPD_1_P1_SHIFT        8
0144 #define VGAPD_1_P1_FORCE_DIV2       (1 << 13)
0145 #define VGAPD_1_P2_SHIFT        15
0146 
0147 #define DPLL_A          0x06014
0148 #define DPLL_B          0x06018
0149 #define DPLL_VCO_ENABLE         (1 << 31)
0150 #define DPLL_2X_CLOCK_ENABLE        (1 << 30)
0151 #define DPLL_SYNCLOCK_ENABLE        (1 << 29)
0152 #define DPLL_VGA_MODE_DISABLE       (1 << 28)
0153 #define DPLL_P2_MASK            1
0154 #define DPLL_P2_SHIFT           23
0155 #define DPLL_I9XX_P2_SHIFT              24
0156 #define DPLL_P1_FORCE_DIV2      (1 << 21)
0157 #define DPLL_P1_MASK            0x1f
0158 #define DPLL_P1_SHIFT           16
0159 #define DPLL_REFERENCE_SELECT_MASK  (0x3 << 13)
0160 #define DPLL_REFERENCE_DEFAULT      (0x0 << 13)
0161 #define DPLL_REFERENCE_TVCLK        (0x2 << 13)
0162 #define DPLL_RATE_SELECT_MASK       (1 << 8)
0163 #define DPLL_RATE_SELECT_FP0        (0 << 8)
0164 #define DPLL_RATE_SELECT_FP1        (1 << 8)
0165 
0166 #define FPA0            0x06040
0167 #define FPA1            0x06044
0168 #define FPB0            0x06048
0169 #define FPB1            0x0604c
0170 #define FP_DIVISOR_MASK         0x3f
0171 #define FP_N_DIVISOR_SHIFT      16
0172 #define FP_M1_DIVISOR_SHIFT     8
0173 #define FP_M2_DIVISOR_SHIFT     0
0174 
0175 /* PLL parameters (these are for 852GM/855GM/865G, check earlier chips). */
0176 /* Clock values are in units of kHz */
0177 #define PLL_REFCLK      48000
0178 #define MIN_CLOCK       25000
0179 #define MAX_CLOCK       350000
0180 
0181 /* Two pipes */
0182 #define PIPE_A          0
0183 #define PIPE_B          1
0184 #define PIPE_MASK       1
0185 
0186 /* palette registers */
0187 #define PALETTE_A       0x0a000
0188 #define PALETTE_B       0x0a800
0189 #ifndef PALETTE_8_ENTRIES
0190 #define PALETTE_8_ENTRIES       256
0191 #endif
0192 #define PALETTE_8_SIZE          (PALETTE_8_ENTRIES * 4)
0193 #define PALETTE_10_ENTRIES      128
0194 #define PALETTE_10_SIZE         (PALETTE_10_ENTRIES * 8)
0195 #define PALETTE_8_MASK          0xff
0196 #define PALETTE_8_RED_SHIFT     16
0197 #define PALETTE_8_GREEN_SHIFT       8
0198 #define PALETTE_8_BLUE_SHIFT        0
0199 
0200 /* CRTC registers */
0201 #define HTOTAL_A        0x60000
0202 #define HBLANK_A        0x60004
0203 #define HSYNC_A         0x60008
0204 #define VTOTAL_A        0x6000c
0205 #define VBLANK_A        0x60010
0206 #define VSYNC_A         0x60014
0207 #define SRC_SIZE_A      0x6001c
0208 #define BCLRPAT_A       0x60020
0209 
0210 #define HTOTAL_B        0x61000
0211 #define HBLANK_B        0x61004
0212 #define HSYNC_B         0x61008
0213 #define VTOTAL_B        0x6100c
0214 #define VBLANK_B        0x61010
0215 #define VSYNC_B         0x61014
0216 #define SRC_SIZE_B      0x6101c
0217 #define BCLRPAT_B       0x61020
0218 
0219 #define HTOTAL_MASK         0xfff
0220 #define HTOTAL_SHIFT            16
0221 #define HACTIVE_MASK            0x7ff
0222 #define HACTIVE_SHIFT           0
0223 #define HBLANKEND_MASK          0xfff
0224 #define HBLANKEND_SHIFT         16
0225 #define HBLANKSTART_MASK        0xfff
0226 #define HBLANKSTART_SHIFT       0
0227 #define HSYNCEND_MASK           0xfff
0228 #define HSYNCEND_SHIFT          16
0229 #define HSYNCSTART_MASK         0xfff
0230 #define HSYNCSTART_SHIFT        0
0231 #define VTOTAL_MASK         0xfff
0232 #define VTOTAL_SHIFT            16
0233 #define VACTIVE_MASK            0x7ff
0234 #define VACTIVE_SHIFT           0
0235 #define VBLANKEND_MASK          0xfff
0236 #define VBLANKEND_SHIFT         16
0237 #define VBLANKSTART_MASK        0xfff
0238 #define VBLANKSTART_SHIFT       0
0239 #define VSYNCEND_MASK           0xfff
0240 #define VSYNCEND_SHIFT          16
0241 #define VSYNCSTART_MASK         0xfff
0242 #define VSYNCSTART_SHIFT        0
0243 #define SRC_SIZE_HORIZ_MASK     0x7ff
0244 #define SRC_SIZE_HORIZ_SHIFT        16
0245 #define SRC_SIZE_VERT_MASK      0x7ff
0246 #define SRC_SIZE_VERT_SHIFT     0
0247 
0248 #define ADPA            0x61100
0249 #define ADPA_DAC_ENABLE         (1 << 31)
0250 #define ADPA_DAC_DISABLE        0
0251 #define ADPA_PIPE_SELECT_SHIFT      30
0252 #define ADPA_USE_VGA_HVPOLARITY     (1 << 15)
0253 #define ADPA_SETS_HVPOLARITY        0
0254 #define ADPA_DPMS_CONTROL_MASK      (0x3 << 10)
0255 #define ADPA_DPMS_D0            (0x0 << 10)
0256 #define ADPA_DPMS_D2            (0x1 << 10)
0257 #define ADPA_DPMS_D1            (0x2 << 10)
0258 #define ADPA_DPMS_D3            (0x3 << 10)
0259 #define ADPA_VSYNC_ACTIVE_SHIFT     4
0260 #define ADPA_HSYNC_ACTIVE_SHIFT     3
0261 #define ADPA_SYNC_ACTIVE_MASK       1
0262 #define ADPA_SYNC_ACTIVE_HIGH       1
0263 #define ADPA_SYNC_ACTIVE_LOW        0
0264 
0265 #define DVOA            0x61120
0266 #define DVOB            0x61140
0267 #define DVOC            0x61160
0268 #define LVDS            0x61180
0269 #define PORT_ENABLE             (1 << 31)
0270 #define PORT_PIPE_SELECT_SHIFT          30
0271 #define PORT_TV_FLAGS_MASK              0xFF
0272 #define PORT_TV_FLAGS                   0xC4    /* ripped from my BIOS
0273                            to understand and correct */
0274 
0275 #define DVOA_SRCDIM     0x61124
0276 #define DVOB_SRCDIM     0x61144
0277 #define DVOC_SRCDIM     0x61164
0278 
0279 #define PIPEA_DSL       0x70000
0280 #define PIPEB_DSL       0x71000
0281 #define PIPEACONF       0x70008
0282 #define PIPEBCONF       0x71008
0283 #define PIPEASTAT       0x70024 /* bits 0-15 are "write 1 to clear" */
0284 #define PIPEBSTAT       0x71024
0285 
0286 #define PIPECONF_ENABLE         (1 << 31)
0287 #define PIPECONF_DISABLE        0
0288 #define PIPECONF_DOUBLE_WIDE        (1 << 30)
0289 #define PIPECONF_SINGLE_WIDE        0
0290 #define PIPECONF_LOCKED         (1 << 25)
0291 #define PIPECONF_UNLOCKED       0
0292 #define PIPECONF_GAMMA          (1 << 24)
0293 #define PIPECONF_PALETTE        0
0294 #define PIPECONF_PROGRESSIVE            (0 << 21)
0295 #define PIPECONF_INTERLACE_W_FIELD_INDICATION   (6 << 21)
0296 #define PIPECONF_INTERLACE_FIELD_0_ONLY     (7 << 21)
0297 #define PIPECONF_INTERLACE_MASK         (7 << 21)
0298 
0299 /* enable bits, write 1 to enable */
0300 #define PIPESTAT_FIFO_UNDERRUN      (1 << 31)
0301 #define PIPESTAT_CRC_ERROR_EN       (1 << 29)
0302 #define PIPESTAT_CRC_DONE_EN        (1 << 28)
0303 #define PIPESTAT_HOTPLUG_EN     (1 << 26)
0304 #define PIPESTAT_VERTICAL_SYNC_EN   (1 << 25)
0305 #define PIPESTAT_DISPLINE_COMP_EN   (1 << 24)
0306 #define PIPESTAT_FLD_EVT_ODD_EN     (1 << 21)
0307 #define PIPESTAT_FLD_EVT_EVEN_EN    (1 << 20)
0308 #define PIPESTAT_TV_HOTPLUG_EN      (1 << 18)
0309 #define PIPESTAT_VBLANK_EN      (1 << 17)
0310 #define PIPESTAT_OVL_UPDATE_EN      (1 << 16)
0311 /* status bits, write 1 to clear */
0312 #define PIPESTAT_HOTPLUG_STATE      (1 << 15)
0313 #define PIPESTAT_CRC_ERROR      (1 << 13)
0314 #define PIPESTAT_CRC_DONE       (1 << 12)
0315 #define PIPESTAT_HOTPLUG        (1 << 10)
0316 #define PIPESTAT_VSYNC          (1 << 9)
0317 #define PIPESTAT_DISPLINE_COMP      (1 << 8)
0318 #define PIPESTAT_FLD_EVT_ODD        (1 << 5)
0319 #define PIPESTAT_FLD_EVT_EVEN       (1 << 4)
0320 #define PIPESTAT_TV_HOTPLUG     (1 << 2)
0321 #define PIPESTAT_VBLANK         (1 << 1)
0322 #define PIPESTAT_OVL_UPDATE     (1 << 0)
0323 
0324 #define DISPARB         0x70030
0325 #define DISPARB_AEND_MASK       0x1ff
0326 #define DISPARB_AEND_SHIFT      0
0327 #define DISPARB_BEND_MASK       0x3ff
0328 #define DISPARB_BEND_SHIFT      9
0329 
0330 /* Desktop HW cursor */
0331 #define CURSOR_CONTROL      0x70080
0332 #define CURSOR_ENABLE           (1 << 31)
0333 #define CURSOR_GAMMA_ENABLE     (1 << 30)
0334 #define CURSOR_STRIDE_MASK      (0x3 << 28)
0335 #define CURSOR_STRIDE_256       (0x0 << 28)
0336 #define CURSOR_STRIDE_512       (0x1 << 28)
0337 #define CURSOR_STRIDE_1K        (0x2 << 28)
0338 #define CURSOR_STRIDE_2K        (0x3 << 28)
0339 #define CURSOR_FORMAT_MASK      (0x7 << 24)
0340 #define CURSOR_FORMAT_2C        (0x0 << 24)
0341 #define CURSOR_FORMAT_3C        (0x1 << 24)
0342 #define CURSOR_FORMAT_4C        (0x2 << 24)
0343 #define CURSOR_FORMAT_ARGB      (0x4 << 24)
0344 #define CURSOR_FORMAT_XRGB      (0x5 << 24)
0345 
0346 /* Mobile HW cursor (and i810) */
0347 #define CURSOR_A_CONTROL    CURSOR_CONTROL
0348 #define CURSOR_B_CONTROL    0x700c0
0349 #define CURSOR_MODE_MASK        0x27
0350 #define CURSOR_MODE_DISABLE     0
0351 #define CURSOR_MODE_64_3C       0x04
0352 #define CURSOR_MODE_64_4C_AX        0x05
0353 #define CURSOR_MODE_64_4C       0x06
0354 #define CURSOR_MODE_64_32B_AX       0x07
0355 #define CURSOR_MODE_64_ARGB_AX      0x27
0356 #define CURSOR_PIPE_SELECT_SHIFT    28
0357 #define CURSOR_MOBILE_GAMMA_ENABLE  (1 << 26)
0358 #define CURSOR_MEM_TYPE_LOCAL       (1 << 25)
0359 
0360 /* All platforms (desktop has no pipe B) */
0361 #define CURSOR_A_BASEADDR   0x70084
0362 #define CURSOR_B_BASEADDR   0x700c4
0363 #define CURSOR_BASE_MASK        0xffffff00
0364 
0365 #define CURSOR_A_POSITION   0x70088
0366 #define CURSOR_B_POSITION   0x700c8
0367 #define CURSOR_POS_SIGN         (1 << 15)
0368 #define CURSOR_POS_MASK         0x7ff
0369 #define CURSOR_X_SHIFT          0
0370 #define CURSOR_Y_SHIFT          16
0371 
0372 #define CURSOR_A_PALETTE0   0x70090
0373 #define CURSOR_A_PALETTE1   0x70094
0374 #define CURSOR_A_PALETTE2   0x70098
0375 #define CURSOR_A_PALETTE3   0x7009c
0376 #define CURSOR_B_PALETTE0   0x700d0
0377 #define CURSOR_B_PALETTE1   0x700d4
0378 #define CURSOR_B_PALETTE2   0x700d8
0379 #define CURSOR_B_PALETTE3   0x700dc
0380 #define CURSOR_COLOR_MASK           0xff
0381 #define CURSOR_RED_SHIFT            16
0382 #define CURSOR_GREEN_SHIFT          8
0383 #define CURSOR_BLUE_SHIFT           0
0384 #define CURSOR_PALETTE_MASK         0xffffff
0385 
0386 /* Desktop only */
0387 #define CURSOR_SIZE     0x700a0
0388 #define CURSOR_SIZE_MASK        0x3ff
0389 #define CURSOR_SIZE_H_SHIFT     0
0390 #define CURSOR_SIZE_V_SHIFT     12
0391 
0392 #define DSPACNTR        0x70180
0393 #define DSPBCNTR        0x71180
0394 #define DISPPLANE_PLANE_ENABLE      (1 << 31)
0395 #define DISPPLANE_PLANE_DISABLE     0
0396 #define DISPPLANE_GAMMA_ENABLE      (1<<30)
0397 #define DISPPLANE_GAMMA_DISABLE     0
0398 #define DISPPLANE_PIXFORMAT_MASK    (0xf<<26)
0399 #define DISPPLANE_8BPP          (0x2<<26)
0400 #define DISPPLANE_15_16BPP      (0x4<<26)
0401 #define DISPPLANE_16BPP         (0x5<<26)
0402 #define DISPPLANE_32BPP_NO_ALPHA    (0x6<<26)
0403 #define DISPPLANE_32BPP         (0x7<<26)
0404 #define DISPPLANE_STEREO_ENABLE     (1<<25)
0405 #define DISPPLANE_STEREO_DISABLE    0
0406 #define DISPPLANE_SEL_PIPE_SHIFT    24
0407 #define DISPPLANE_SRC_KEY_ENABLE    (1<<22)
0408 #define DISPPLANE_SRC_KEY_DISABLE   0
0409 #define DISPPLANE_LINE_DOUBLE       (1<<20)
0410 #define DISPPLANE_NO_LINE_DOUBLE    0
0411 #define DISPPLANE_STEREO_POLARITY_FIRST 0
0412 #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
0413 /* plane B only */
0414 #define DISPPLANE_ALPHA_TRANS_ENABLE    (1<<15)
0415 #define DISPPLANE_ALPHA_TRANS_DISABLE   0
0416 #define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0
0417 #define DISPPLANE_SPRITE_ABOVE_OVERLAY  1
0418 
0419 #define DSPABASE        0x70184
0420 #define DSPASTRIDE      0x70188
0421 
0422 #define DSPBBASE        0x71184
0423 #define DSPBSTRIDE      0x71188
0424 
0425 #define VGACNTRL        0x71400
0426 #define VGA_DISABLE         (1 << 31)
0427 #define VGA_ENABLE          0
0428 #define VGA_PIPE_SELECT_SHIFT       29
0429 #define VGA_PALETTE_READ_SELECT     23
0430 #define VGA_PALETTE_A_WRITE_DISABLE (1 << 22)
0431 #define VGA_PALETTE_B_WRITE_DISABLE (1 << 21)
0432 #define VGA_LEGACY_PALETTE      (1 << 20)
0433 #define VGA_6BIT_DAC            0
0434 #define VGA_8BIT_DAC            (1 << 20)
0435 
0436 #define ADD_ID          0x71408
0437 #define ADD_ID_MASK         0xff
0438 
0439 /* BIOS scratch area registers (830M and 845G). */
0440 #define SWF0            0x71410
0441 #define SWF1            0x71414
0442 #define SWF2            0x71418
0443 #define SWF3            0x7141c
0444 #define SWF4            0x71420
0445 #define SWF5            0x71424
0446 #define SWF6            0x71428
0447 
0448 /* BIOS scratch area registers (852GM, 855GM, 865G). */
0449 #define SWF00           0x70410
0450 #define SWF01           0x70414
0451 #define SWF02           0x70418
0452 #define SWF03           0x7041c
0453 #define SWF04           0x70420
0454 #define SWF05           0x70424
0455 #define SWF06           0x70428
0456 
0457 #define SWF10           SWF0
0458 #define SWF11           SWF1
0459 #define SWF12           SWF2
0460 #define SWF13           SWF3
0461 #define SWF14           SWF4
0462 #define SWF15           SWF5
0463 #define SWF16           SWF6
0464 
0465 #define SWF30           0x72414
0466 #define SWF31           0x72418
0467 #define SWF32           0x7241c
0468 
0469 /* Memory Commands */
0470 #define MI_NOOP         (0x00 << 23)
0471 #define MI_NOOP_WRITE_ID        (1 << 22)
0472 #define MI_NOOP_ID_MASK         ((1 << 22) - 1)
0473 
0474 #define MI_FLUSH        (0x04 << 23)
0475 #define MI_WRITE_DIRTY_STATE        (1 << 4)
0476 #define MI_END_SCENE            (1 << 3)
0477 #define MI_INHIBIT_RENDER_CACHE_FLUSH   (1 << 2)
0478 #define MI_INVALIDATE_MAP_CACHE     (1 << 0)
0479 
0480 #define MI_STORE_DWORD_IMM  ((0x20 << 23) | 1)
0481 
0482 /* 2D Commands */
0483 #define COLOR_BLT_CMD       ((2 << 29) | (0x40 << 22) | 3)
0484 #define XY_COLOR_BLT_CMD    ((2 << 29) | (0x50 << 22) | 4)
0485 #define XY_SETUP_CLIP_BLT_CMD   ((2 << 29) | (0x03 << 22) | 1)
0486 #define XY_SRC_COPY_BLT_CMD ((2 << 29) | (0x53 << 22) | 6)
0487 #define SRC_COPY_BLT_CMD    ((2 << 29) | (0x43 << 22) | 4)
0488 #define XY_MONO_PAT_BLT_CMD ((2 << 29) | (0x52 << 22) | 7)
0489 #define XY_MONO_SRC_BLT_CMD ((2 << 29) | (0x54 << 22) | 6)
0490 #define XY_MONO_SRC_IMM_BLT_CMD ((2 << 29) | (0x71 << 22) | 5)
0491 #define TXT_IMM_BLT_CMD         ((2 << 29) | (0x30 << 22) | 2)
0492 #define SETUP_BLT_CMD           ((2 << 29) | (0x00 << 22) | 6)
0493 
0494 #define DW_LENGTH_MASK          0xff
0495 
0496 #define WRITE_ALPHA         (1 << 21)
0497 #define WRITE_RGB           (1 << 20)
0498 #define VERT_SEED           (3 << 8)
0499 #define HORIZ_SEED          (3 << 12)
0500 
0501 #define COLOR_DEPTH_8           (0 << 24)
0502 #define COLOR_DEPTH_16          (1 << 24)
0503 #define COLOR_DEPTH_32          (3 << 24)
0504 
0505 #define SRC_ROP_GXCOPY          0xcc
0506 #define SRC_ROP_GXXOR           0x66
0507 
0508 #define PAT_ROP_GXCOPY                  0xf0
0509 #define PAT_ROP_GXXOR                   0x5a
0510 
0511 #define PITCH_SHIFT         0
0512 #define ROP_SHIFT           16
0513 #define WIDTH_SHIFT         0
0514 #define HEIGHT_SHIFT            16
0515 
0516 /* in bytes */
0517 #define MAX_MONO_IMM_SIZE       128
0518 
0519 
0520 /*** Macros ***/
0521 
0522 /* I/O macros */
0523 #define INREG8(addr)          readb((u8 __iomem *)(dinfo->mmio_base + (addr)))
0524 #define INREG16(addr)         readw((u16 __iomem *)(dinfo->mmio_base + (addr)))
0525 #define INREG(addr)       readl((u32 __iomem *)(dinfo->mmio_base + (addr)))
0526 #define OUTREG8(addr, val)    writeb((val),(u8 __iomem *)(dinfo->mmio_base + \
0527                                (addr)))
0528 #define OUTREG16(addr, val)    writew((val),(u16 __iomem *)(dinfo->mmio_base + \
0529                                (addr)))
0530 #define OUTREG(addr, val)     writel((val),(u32 __iomem *)(dinfo->mmio_base + \
0531                                      (addr)))
0532 
0533 /* Ring buffer macros */
0534 #define OUT_RING(n) do {                        \
0535     writel((n), (u32 __iomem *)(dinfo->ring.virtual + dinfo->ring_tail));\
0536     dinfo->ring_tail += 4;                      \
0537     dinfo->ring_tail &= dinfo->ring_tail_mask;          \
0538 } while (0)
0539 
0540 #define START_RING(n)   do {                        \
0541     if (dinfo->ring_space < (n) * 4)                \
0542         wait_ring(dinfo,(n) * 4);               \
0543     dinfo->ring_space -= (n) * 4;                   \
0544 } while (0)
0545 
0546 #define ADVANCE_RING()  do {                        \
0547     OUTREG(PRI_RING_TAIL, dinfo->ring_tail);                        \
0548 } while (0)
0549 
0550 #define DO_RING_IDLE()  do {                        \
0551     u32 head, tail;                         \
0552     do {                                \
0553         head = INREG(PRI_RING_HEAD) & RING_HEAD_MASK;       \
0554         tail = INREG(PRI_RING_TAIL) & RING_TAIL_MASK;       \
0555         udelay(10);                     \
0556     } while (head != tail);                     \
0557 } while (0)
0558 
0559 
0560 /* function protoypes */
0561 extern int intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo);
0562 extern int intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
0563                 int *stolen_size);
0564 extern int intelfbhw_check_non_crt(struct intelfb_info *dinfo);
0565 extern const char *intelfbhw_dvo_to_string(int dvo);
0566 extern int intelfbhw_validate_mode(struct intelfb_info *dinfo,
0567                    struct fb_var_screeninfo *var);
0568 extern int intelfbhw_pan_display(struct fb_var_screeninfo *var,
0569                  struct fb_info *info);
0570 extern void intelfbhw_do_blank(int blank, struct fb_info *info);
0571 extern void intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno,
0572                 unsigned red, unsigned green, unsigned blue,
0573                 unsigned transp);
0574 extern int intelfbhw_read_hw_state(struct intelfb_info *dinfo,
0575                    struct intelfb_hwstate *hw, int flag);
0576 extern void intelfbhw_print_hw_state(struct intelfb_info *dinfo,
0577                      struct intelfb_hwstate *hw);
0578 extern int intelfbhw_mode_to_hw(struct intelfb_info *dinfo,
0579                 struct intelfb_hwstate *hw,
0580                 struct fb_var_screeninfo *var);
0581 extern int intelfbhw_program_mode(struct intelfb_info *dinfo,
0582                   const struct intelfb_hwstate *hw, int blank);
0583 extern void intelfbhw_do_sync(struct intelfb_info *dinfo);
0584 extern void intelfbhw_2d_stop(struct intelfb_info *dinfo);
0585 extern void intelfbhw_2d_start(struct intelfb_info *dinfo);
0586 extern void intelfbhw_do_fillrect(struct intelfb_info *dinfo, u32 x, u32 y,
0587                   u32 w, u32 h, u32 color, u32 pitch, u32 bpp,
0588                   u32 rop);
0589 extern void intelfbhw_do_bitblt(struct intelfb_info *dinfo, u32 curx, u32 cury,
0590                 u32 dstx, u32 dsty, u32 w, u32 h, u32 pitch,
0591                 u32 bpp);
0592 extern int intelfbhw_do_drawglyph(struct intelfb_info *dinfo, u32 fg, u32 bg,
0593                   u32 w, u32 h, const u8* cdat, u32 x, u32 y,
0594                   u32 pitch, u32 bpp);
0595 extern void intelfbhw_cursor_init(struct intelfb_info *dinfo);
0596 extern void intelfbhw_cursor_hide(struct intelfb_info *dinfo);
0597 extern void intelfbhw_cursor_show(struct intelfb_info *dinfo);
0598 extern void intelfbhw_cursor_setpos(struct intelfb_info *dinfo, int x, int y);
0599 extern void intelfbhw_cursor_setcolor(struct intelfb_info *dinfo, u32 bg,
0600                       u32 fg);
0601 extern void intelfbhw_cursor_load(struct intelfb_info *dinfo, int width,
0602                   int height, u8 *data);
0603 extern void intelfbhw_cursor_reset(struct intelfb_info *dinfo);
0604 extern int intelfbhw_enable_irq(struct intelfb_info *dinfo);
0605 extern void intelfbhw_disable_irq(struct intelfb_info *dinfo);
0606 extern int intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe);
0607 extern int intelfbhw_active_pipe(const struct intelfb_hwstate *hw);
0608 
0609 #endif /* _INTELFBHW_H */