i915_drv.h 33 KB

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