intelfbhw.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. #ifndef _INTELFBHW_H
  2. #define _INTELFBHW_H
  3. /* $DHD: intelfb/intelfbhw.h,v 1.5 2003/06/27 15:06:25 dawes Exp $ */
  4. /*** HW-specific data ***/
  5. /* Information about the 852GM/855GM variants */
  6. #define INTEL_85X_CAPID 0x44
  7. #define INTEL_85X_VARIANT_MASK 0x7
  8. #define INTEL_85X_VARIANT_SHIFT 5
  9. #define INTEL_VAR_855GME 0x0
  10. #define INTEL_VAR_855GM 0x4
  11. #define INTEL_VAR_852GME 0x2
  12. #define INTEL_VAR_852GM 0x5
  13. /* Information about DVO/LVDS Ports */
  14. #define DVOA_PORT 0x1
  15. #define DVOB_PORT 0x2
  16. #define DVOC_PORT 0x4
  17. #define LVDS_PORT 0x8
  18. /*
  19. * The Bridge device's PCI config space has information about the
  20. * fb aperture size and the amount of pre-reserved memory.
  21. */
  22. #define INTEL_GMCH_CTRL 0x52
  23. #define INTEL_GMCH_ENABLED 0x4
  24. #define INTEL_GMCH_MEM_MASK 0x1
  25. #define INTEL_GMCH_MEM_64M 0x1
  26. #define INTEL_GMCH_MEM_128M 0
  27. #define INTEL_830_GMCH_GMS_MASK (0x7 << 4)
  28. #define INTEL_830_GMCH_GMS_DISABLED (0x0 << 4)
  29. #define INTEL_830_GMCH_GMS_LOCAL (0x1 << 4)
  30. #define INTEL_830_GMCH_GMS_STOLEN_512 (0x2 << 4)
  31. #define INTEL_830_GMCH_GMS_STOLEN_1024 (0x3 << 4)
  32. #define INTEL_830_GMCH_GMS_STOLEN_8192 (0x4 << 4)
  33. #define INTEL_855_GMCH_GMS_MASK (0x7 << 4)
  34. #define INTEL_855_GMCH_GMS_DISABLED (0x0 << 4)
  35. #define INTEL_855_GMCH_GMS_STOLEN_1M (0x1 << 4)
  36. #define INTEL_855_GMCH_GMS_STOLEN_4M (0x2 << 4)
  37. #define INTEL_855_GMCH_GMS_STOLEN_8M (0x3 << 4)
  38. #define INTEL_855_GMCH_GMS_STOLEN_16M (0x4 << 4)
  39. #define INTEL_855_GMCH_GMS_STOLEN_32M (0x5 << 4)
  40. #define INTEL_915G_GMCH_GMS_STOLEN_48M (0x6 << 4)
  41. #define INTEL_915G_GMCH_GMS_STOLEN_64M (0x7 << 4)
  42. /* HW registers */
  43. /* Fence registers */
  44. #define FENCE 0x2000
  45. #define FENCE_NUM 8
  46. /* Primary ring buffer */
  47. #define PRI_RING_TAIL 0x2030
  48. #define RING_TAIL_MASK 0x001ffff8
  49. #define RING_INUSE 0x1
  50. #define PRI_RING_HEAD 0x2034
  51. #define RING_HEAD_WRAP_MASK 0x7ff
  52. #define RING_HEAD_WRAP_SHIFT 21
  53. #define RING_HEAD_MASK 0x001ffffc
  54. #define PRI_RING_START 0x2038
  55. #define RING_START_MASK 0xfffff000
  56. #define PRI_RING_LENGTH 0x203c
  57. #define RING_LENGTH_MASK 0x001ff000
  58. #define RING_REPORT_MASK (0x3 << 1)
  59. #define RING_NO_REPORT (0x0 << 1)
  60. #define RING_REPORT_64K (0x1 << 1)
  61. #define RING_REPORT_4K (0x2 << 1)
  62. #define RING_REPORT_128K (0x3 << 1)
  63. #define RING_ENABLE 0x1
  64. /*
  65. * Tail can't wrap to any closer than RING_MIN_FREE bytes of the head,
  66. * and the last RING_MIN_FREE bytes need to be padded with MI_NOOP
  67. */
  68. #define RING_MIN_FREE 64
  69. #define IPEHR 0x2088
  70. #define INSTDONE 0x2090
  71. #define PRI_RING_EMPTY 1
  72. #define HWSTAM 0x2098
  73. #define IER 0x20A0
  74. #define IIR 0x20A4
  75. #define IMR 0x20A8
  76. #define VSYNC_PIPE_A_INTERRUPT (1 << 7)
  77. #define PIPE_A_EVENT_INTERRUPT (1 << 6)
  78. #define VSYNC_PIPE_B_INTERRUPT (1 << 5)
  79. #define PIPE_B_EVENT_INTERRUPT (1 << 4)
  80. #define HOST_PORT_EVENT_INTERRUPT (1 << 3)
  81. #define CAPTURE_EVENT_INTERRUPT (1 << 2)
  82. #define USER_DEFINED_INTERRUPT (1 << 1)
  83. #define BREAKPOINT_INTERRUPT 1
  84. #define INSTPM 0x20c0
  85. #define SYNC_FLUSH_ENABLE (1 << 5)
  86. #define INSTPS 0x20c4
  87. #define MEM_MODE 0x20cc
  88. #define MASK_SHIFT 16
  89. #define FW_BLC_0 0x20d8
  90. #define FW_DISPA_WM_SHIFT 0
  91. #define FW_DISPA_WM_MASK 0x3f
  92. #define FW_DISPA_BL_SHIFT 8
  93. #define FW_DISPA_BL_MASK 0xf
  94. #define FW_DISPB_WM_SHIFT 16
  95. #define FW_DISPB_WM_MASK 0x1f
  96. #define FW_DISPB_BL_SHIFT 24
  97. #define FW_DISPB_BL_MASK 0x7
  98. #define FW_BLC_1 0x20dc
  99. #define FW_DISPC_WM_SHIFT 0
  100. #define FW_DISPC_WM_MASK 0x1f
  101. #define FW_DISPC_BL_SHIFT 8
  102. #define FW_DISPC_BL_MASK 0x7
  103. #define GPIOA 0x5010
  104. #define GPIOB 0x5014
  105. #define GPIOC 0x5018 /* this may be external DDC on i830 */
  106. #define GPIOD 0x501C /* this is DVO DDC */
  107. #define GPIOE 0x5020 /* this is DVO i2C */
  108. #define GPIOF 0x5024
  109. /* PLL registers */
  110. #define VGA0_DIVISOR 0x06000
  111. #define VGA1_DIVISOR 0x06004
  112. #define VGAPD 0x06010
  113. #define VGAPD_0_P1_SHIFT 0
  114. #define VGAPD_0_P1_FORCE_DIV2 (1 << 5)
  115. #define VGAPD_0_P2_SHIFT 7
  116. #define VGAPD_1_P1_SHIFT 8
  117. #define VGAPD_1_P1_FORCE_DIV2 (1 << 13)
  118. #define VGAPD_1_P2_SHIFT 15
  119. #define DPLL_A 0x06014
  120. #define DPLL_B 0x06018
  121. #define DPLL_VCO_ENABLE (1 << 31)
  122. #define DPLL_2X_CLOCK_ENABLE (1 << 30)
  123. #define DPLL_SYNCLOCK_ENABLE (1 << 29)
  124. #define DPLL_VGA_MODE_DISABLE (1 << 28)
  125. #define DPLL_P2_MASK 1
  126. #define DPLL_P2_SHIFT 23
  127. #define DPLL_I9XX_P2_SHIFT 24
  128. #define DPLL_P1_FORCE_DIV2 (1 << 21)
  129. #define DPLL_P1_MASK 0x1f
  130. #define DPLL_P1_SHIFT 16
  131. #define DPLL_REFERENCE_SELECT_MASK (0x3 << 13)
  132. #define DPLL_REFERENCE_DEFAULT (0x0 << 13)
  133. #define DPLL_REFERENCE_TVCLK (0x2 << 13)
  134. #define DPLL_RATE_SELECT_MASK (1 << 8)
  135. #define DPLL_RATE_SELECT_FP0 (0 << 8)
  136. #define DPLL_RATE_SELECT_FP1 (1 << 8)
  137. #define FPA0 0x06040
  138. #define FPA1 0x06044
  139. #define FPB0 0x06048
  140. #define FPB1 0x0604c
  141. #define FP_DIVISOR_MASK 0x3f
  142. #define FP_N_DIVISOR_SHIFT 16
  143. #define FP_M1_DIVISOR_SHIFT 8
  144. #define FP_M2_DIVISOR_SHIFT 0
  145. /* PLL parameters (these are for 852GM/855GM/865G, check earlier chips). */
  146. /* Clock values are in units of kHz */
  147. #define PLL_REFCLK 48000
  148. #define MIN_CLOCK 25000
  149. #define MAX_CLOCK 350000
  150. /* Two pipes */
  151. #define PIPE_A 0
  152. #define PIPE_B 1
  153. #define PIPE_MASK 1
  154. /* palette registers */
  155. #define PALETTE_A 0x0a000
  156. #define PALETTE_B 0x0a800
  157. #ifndef PALETTE_8_ENTRIES
  158. #define PALETTE_8_ENTRIES 256
  159. #endif
  160. #define PALETTE_8_SIZE (PALETTE_8_ENTRIES * 4)
  161. #define PALETTE_10_ENTRIES 128
  162. #define PALETTE_10_SIZE (PALETTE_10_ENTRIES * 8)
  163. #define PALETTE_8_MASK 0xff
  164. #define PALETTE_8_RED_SHIFT 16
  165. #define PALETTE_8_GREEN_SHIFT 8
  166. #define PALETTE_8_BLUE_SHIFT 0
  167. /* CRTC registers */
  168. #define HTOTAL_A 0x60000
  169. #define HBLANK_A 0x60004
  170. #define HSYNC_A 0x60008
  171. #define VTOTAL_A 0x6000c
  172. #define VBLANK_A 0x60010
  173. #define VSYNC_A 0x60014
  174. #define SRC_SIZE_A 0x6001c
  175. #define BCLRPAT_A 0x60020
  176. #define HTOTAL_B 0x61000
  177. #define HBLANK_B 0x61004
  178. #define HSYNC_B 0x61008
  179. #define VTOTAL_B 0x6100c
  180. #define VBLANK_B 0x61010
  181. #define VSYNC_B 0x61014
  182. #define SRC_SIZE_B 0x6101c
  183. #define BCLRPAT_B 0x61020
  184. #define HTOTAL_MASK 0xfff
  185. #define HTOTAL_SHIFT 16
  186. #define HACTIVE_MASK 0x7ff
  187. #define HACTIVE_SHIFT 0
  188. #define HBLANKEND_MASK 0xfff
  189. #define HBLANKEND_SHIFT 16
  190. #define HBLANKSTART_MASK 0xfff
  191. #define HBLANKSTART_SHIFT 0
  192. #define HSYNCEND_MASK 0xfff
  193. #define HSYNCEND_SHIFT 16
  194. #define HSYNCSTART_MASK 0xfff
  195. #define HSYNCSTART_SHIFT 0
  196. #define VTOTAL_MASK 0xfff
  197. #define VTOTAL_SHIFT 16
  198. #define VACTIVE_MASK 0x7ff
  199. #define VACTIVE_SHIFT 0
  200. #define VBLANKEND_MASK 0xfff
  201. #define VBLANKEND_SHIFT 16
  202. #define VBLANKSTART_MASK 0xfff
  203. #define VBLANKSTART_SHIFT 0
  204. #define VSYNCEND_MASK 0xfff
  205. #define VSYNCEND_SHIFT 16
  206. #define VSYNCSTART_MASK 0xfff
  207. #define VSYNCSTART_SHIFT 0
  208. #define SRC_SIZE_HORIZ_MASK 0x7ff
  209. #define SRC_SIZE_HORIZ_SHIFT 16
  210. #define SRC_SIZE_VERT_MASK 0x7ff
  211. #define SRC_SIZE_VERT_SHIFT 0
  212. #define ADPA 0x61100
  213. #define ADPA_DAC_ENABLE (1 << 31)
  214. #define ADPA_DAC_DISABLE 0
  215. #define ADPA_PIPE_SELECT_SHIFT 30
  216. #define ADPA_USE_VGA_HVPOLARITY (1 << 15)
  217. #define ADPA_SETS_HVPOLARITY 0
  218. #define ADPA_DPMS_CONTROL_MASK (0x3 << 10)
  219. #define ADPA_DPMS_D0 (0x0 << 10)
  220. #define ADPA_DPMS_D2 (0x1 << 10)
  221. #define ADPA_DPMS_D1 (0x2 << 10)
  222. #define ADPA_DPMS_D3 (0x3 << 10)
  223. #define ADPA_VSYNC_ACTIVE_SHIFT 4
  224. #define ADPA_HSYNC_ACTIVE_SHIFT 3
  225. #define ADPA_SYNC_ACTIVE_MASK 1
  226. #define ADPA_SYNC_ACTIVE_HIGH 1
  227. #define ADPA_SYNC_ACTIVE_LOW 0
  228. #define DVOA 0x61120
  229. #define DVOB 0x61140
  230. #define DVOC 0x61160
  231. #define LVDS 0x61180
  232. #define PORT_ENABLE (1 << 31)
  233. #define PORT_PIPE_SELECT_SHIFT 30
  234. #define PORT_TV_FLAGS_MASK 0xFF
  235. #define PORT_TV_FLAGS 0xC4 /* ripped from my BIOS
  236. to understand and correct */
  237. #define DVOA_SRCDIM 0x61124
  238. #define DVOB_SRCDIM 0x61144
  239. #define DVOC_SRCDIM 0x61164
  240. #define PIPEA_DSL 0x70000
  241. #define PIPEB_DSL 0x71000
  242. #define PIPEACONF 0x70008
  243. #define PIPEBCONF 0x71008
  244. #define PIPEASTAT 0x70024 /* bits 0-15 are "write 1 to clear" */
  245. #define PIPEBSTAT 0x71024
  246. #define PIPECONF_ENABLE (1 << 31)
  247. #define PIPECONF_DISABLE 0
  248. #define PIPECONF_DOUBLE_WIDE (1 << 30)
  249. #define PIPECONF_SINGLE_WIDE 0
  250. #define PIPECONF_LOCKED (1 << 25)
  251. #define PIPECONF_UNLOCKED 0
  252. #define PIPECONF_GAMMA (1 << 24)
  253. #define PIPECONF_PALETTE 0
  254. #define PIPECONF_PROGRESSIVE (0 << 21)
  255. #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
  256. #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
  257. #define PIPECONF_INTERLACE_MASK (7 << 21)
  258. /* enable bits, write 1 to enable */
  259. #define PIPESTAT_FIFO_UNDERRUN (1 << 31)
  260. #define PIPESTAT_CRC_ERROR_EN (1 << 29)
  261. #define PIPESTAT_CRC_DONE_EN (1 << 28)
  262. #define PIPESTAT_HOTPLUG_EN (1 << 26)
  263. #define PIPESTAT_VERTICAL_SYNC_EN (1 << 25)
  264. #define PIPESTAT_DISPLINE_COMP_EN (1 << 24)
  265. #define PIPESTAT_FLD_EVT_ODD_EN (1 << 21)
  266. #define PIPESTAT_FLD_EVT_EVEN_EN (1 << 20)
  267. #define PIPESTAT_TV_HOTPLUG_EN (1 << 18)
  268. #define PIPESTAT_VBLANK_EN (1 << 17)
  269. #define PIPESTAT_OVL_UPDATE_EN (1 << 16)
  270. /* status bits, write 1 to clear */
  271. #define PIPESTAT_HOTPLUG_STATE (1 << 15)
  272. #define PIPESTAT_CRC_ERROR (1 << 13)
  273. #define PIPESTAT_CRC_DONE (1 << 12)
  274. #define PIPESTAT_HOTPLUG (1 << 10)
  275. #define PIPESTAT_VSYNC (1 << 9)
  276. #define PIPESTAT_DISPLINE_COMP (1 << 8)
  277. #define PIPESTAT_FLD_EVT_ODD (1 << 5)
  278. #define PIPESTAT_FLD_EVT_EVEN (1 << 4)
  279. #define PIPESTAT_TV_HOTPLUG (1 << 2)
  280. #define PIPESTAT_VBLANK (1 << 1)
  281. #define PIPESTAT_OVL_UPDATE (1 << 0)
  282. #define DISPARB 0x70030
  283. #define DISPARB_AEND_MASK 0x1ff
  284. #define DISPARB_AEND_SHIFT 0
  285. #define DISPARB_BEND_MASK 0x3ff
  286. #define DISPARB_BEND_SHIFT 9
  287. /* Desktop HW cursor */
  288. #define CURSOR_CONTROL 0x70080
  289. #define CURSOR_ENABLE (1 << 31)
  290. #define CURSOR_GAMMA_ENABLE (1 << 30)
  291. #define CURSOR_STRIDE_MASK (0x3 << 28)
  292. #define CURSOR_STRIDE_256 (0x0 << 28)
  293. #define CURSOR_STRIDE_512 (0x1 << 28)
  294. #define CURSOR_STRIDE_1K (0x2 << 28)
  295. #define CURSOR_STRIDE_2K (0x3 << 28)
  296. #define CURSOR_FORMAT_MASK (0x7 << 24)
  297. #define CURSOR_FORMAT_2C (0x0 << 24)
  298. #define CURSOR_FORMAT_3C (0x1 << 24)
  299. #define CURSOR_FORMAT_4C (0x2 << 24)
  300. #define CURSOR_FORMAT_ARGB (0x4 << 24)
  301. #define CURSOR_FORMAT_XRGB (0x5 << 24)
  302. /* Mobile HW cursor (and i810) */
  303. #define CURSOR_A_CONTROL CURSOR_CONTROL
  304. #define CURSOR_B_CONTROL 0x700c0
  305. #define CURSOR_MODE_MASK 0x27
  306. #define CURSOR_MODE_DISABLE 0
  307. #define CURSOR_MODE_64_3C 0x04
  308. #define CURSOR_MODE_64_4C_AX 0x05
  309. #define CURSOR_MODE_64_4C 0x06
  310. #define CURSOR_MODE_64_32B_AX 0x07
  311. #define CURSOR_MODE_64_ARGB_AX 0x27
  312. #define CURSOR_PIPE_SELECT_SHIFT 28
  313. #define CURSOR_MOBILE_GAMMA_ENABLE (1 << 26)
  314. #define CURSOR_MEM_TYPE_LOCAL (1 << 25)
  315. /* All platforms (desktop has no pipe B) */
  316. #define CURSOR_A_BASEADDR 0x70084
  317. #define CURSOR_B_BASEADDR 0x700c4
  318. #define CURSOR_BASE_MASK 0xffffff00
  319. #define CURSOR_A_POSITION 0x70088
  320. #define CURSOR_B_POSITION 0x700c8
  321. #define CURSOR_POS_SIGN (1 << 15)
  322. #define CURSOR_POS_MASK 0x7ff
  323. #define CURSOR_X_SHIFT 0
  324. #define CURSOR_Y_SHIFT 16
  325. #define CURSOR_A_PALETTE0 0x70090
  326. #define CURSOR_A_PALETTE1 0x70094
  327. #define CURSOR_A_PALETTE2 0x70098
  328. #define CURSOR_A_PALETTE3 0x7009c
  329. #define CURSOR_B_PALETTE0 0x700d0
  330. #define CURSOR_B_PALETTE1 0x700d4
  331. #define CURSOR_B_PALETTE2 0x700d8
  332. #define CURSOR_B_PALETTE3 0x700dc
  333. #define CURSOR_COLOR_MASK 0xff
  334. #define CURSOR_RED_SHIFT 16
  335. #define CURSOR_GREEN_SHIFT 8
  336. #define CURSOR_BLUE_SHIFT 0
  337. #define CURSOR_PALETTE_MASK 0xffffff
  338. /* Desktop only */
  339. #define CURSOR_SIZE 0x700a0
  340. #define CURSOR_SIZE_MASK 0x3ff
  341. #define CURSOR_SIZE_H_SHIFT 0
  342. #define CURSOR_SIZE_V_SHIFT 12
  343. #define DSPACNTR 0x70180
  344. #define DSPBCNTR 0x71180
  345. #define DISPPLANE_PLANE_ENABLE (1 << 31)
  346. #define DISPPLANE_PLANE_DISABLE 0
  347. #define DISPPLANE_GAMMA_ENABLE (1<<30)
  348. #define DISPPLANE_GAMMA_DISABLE 0
  349. #define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
  350. #define DISPPLANE_8BPP (0x2<<26)
  351. #define DISPPLANE_15_16BPP (0x4<<26)
  352. #define DISPPLANE_16BPP (0x5<<26)
  353. #define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
  354. #define DISPPLANE_32BPP (0x7<<26)
  355. #define DISPPLANE_STEREO_ENABLE (1<<25)
  356. #define DISPPLANE_STEREO_DISABLE 0
  357. #define DISPPLANE_SEL_PIPE_SHIFT 24
  358. #define DISPPLANE_SRC_KEY_ENABLE (1<<22)
  359. #define DISPPLANE_SRC_KEY_DISABLE 0
  360. #define DISPPLANE_LINE_DOUBLE (1<<20)
  361. #define DISPPLANE_NO_LINE_DOUBLE 0
  362. #define DISPPLANE_STEREO_POLARITY_FIRST 0
  363. #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
  364. /* plane B only */
  365. #define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
  366. #define DISPPLANE_ALPHA_TRANS_DISABLE 0
  367. #define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0
  368. #define DISPPLANE_SPRITE_ABOVE_OVERLAY 1
  369. #define DSPABASE 0x70184
  370. #define DSPASTRIDE 0x70188
  371. #define DSPBBASE 0x71184
  372. #define DSPBSTRIDE 0x71188
  373. #define VGACNTRL 0x71400
  374. #define VGA_DISABLE (1 << 31)
  375. #define VGA_ENABLE 0
  376. #define VGA_PIPE_SELECT_SHIFT 29
  377. #define VGA_PALETTE_READ_SELECT 23
  378. #define VGA_PALETTE_A_WRITE_DISABLE (1 << 22)
  379. #define VGA_PALETTE_B_WRITE_DISABLE (1 << 21)
  380. #define VGA_LEGACY_PALETTE (1 << 20)
  381. #define VGA_6BIT_DAC 0
  382. #define VGA_8BIT_DAC (1 << 20)
  383. #define ADD_ID 0x71408
  384. #define ADD_ID_MASK 0xff
  385. /* BIOS scratch area registers (830M and 845G). */
  386. #define SWF0 0x71410
  387. #define SWF1 0x71414
  388. #define SWF2 0x71418
  389. #define SWF3 0x7141c
  390. #define SWF4 0x71420
  391. #define SWF5 0x71424
  392. #define SWF6 0x71428
  393. /* BIOS scratch area registers (852GM, 855GM, 865G). */
  394. #define SWF00 0x70410
  395. #define SWF01 0x70414
  396. #define SWF02 0x70418
  397. #define SWF03 0x7041c
  398. #define SWF04 0x70420
  399. #define SWF05 0x70424
  400. #define SWF06 0x70428
  401. #define SWF10 SWF0
  402. #define SWF11 SWF1
  403. #define SWF12 SWF2
  404. #define SWF13 SWF3
  405. #define SWF14 SWF4
  406. #define SWF15 SWF5
  407. #define SWF16 SWF6
  408. #define SWF30 0x72414
  409. #define SWF31 0x72418
  410. #define SWF32 0x7241c
  411. /* Memory Commands */
  412. #define MI_NOOP (0x00 << 23)
  413. #define MI_NOOP_WRITE_ID (1 << 22)
  414. #define MI_NOOP_ID_MASK ((1 << 22) - 1)
  415. #define MI_FLUSH (0x04 << 23)
  416. #define MI_WRITE_DIRTY_STATE (1 << 4)
  417. #define MI_END_SCENE (1 << 3)
  418. #define MI_INHIBIT_RENDER_CACHE_FLUSH (1 << 2)
  419. #define MI_INVALIDATE_MAP_CACHE (1 << 0)
  420. #define MI_STORE_DWORD_IMM ((0x20 << 23) | 1)
  421. /* 2D Commands */
  422. #define COLOR_BLT_CMD ((2 << 29) | (0x40 << 22) | 3)
  423. #define XY_COLOR_BLT_CMD ((2 << 29) | (0x50 << 22) | 4)
  424. #define XY_SETUP_CLIP_BLT_CMD ((2 << 29) | (0x03 << 22) | 1)
  425. #define XY_SRC_COPY_BLT_CMD ((2 << 29) | (0x53 << 22) | 6)
  426. #define SRC_COPY_BLT_CMD ((2 << 29) | (0x43 << 22) | 4)
  427. #define XY_MONO_PAT_BLT_CMD ((2 << 29) | (0x52 << 22) | 7)
  428. #define XY_MONO_SRC_BLT_CMD ((2 << 29) | (0x54 << 22) | 6)
  429. #define XY_MONO_SRC_IMM_BLT_CMD ((2 << 29) | (0x71 << 22) | 5)
  430. #define TXT_IMM_BLT_CMD ((2 << 29) | (0x30 << 22) | 2)
  431. #define SETUP_BLT_CMD ((2 << 29) | (0x00 << 22) | 6)
  432. #define DW_LENGTH_MASK 0xff
  433. #define WRITE_ALPHA (1 << 21)
  434. #define WRITE_RGB (1 << 20)
  435. #define VERT_SEED (3 << 8)
  436. #define HORIZ_SEED (3 << 12)
  437. #define COLOR_DEPTH_8 (0 << 24)
  438. #define COLOR_DEPTH_16 (1 << 24)
  439. #define COLOR_DEPTH_32 (3 << 24)
  440. #define SRC_ROP_GXCOPY 0xcc
  441. #define SRC_ROP_GXXOR 0x66
  442. #define PAT_ROP_GXCOPY 0xf0
  443. #define PAT_ROP_GXXOR 0x5a
  444. #define PITCH_SHIFT 0
  445. #define ROP_SHIFT 16
  446. #define WIDTH_SHIFT 0
  447. #define HEIGHT_SHIFT 16
  448. /* in bytes */
  449. #define MAX_MONO_IMM_SIZE 128
  450. /*** Macros ***/
  451. /* I/O macros */
  452. #define INREG8(addr) readb((u8 __iomem *)(dinfo->mmio_base + (addr)))
  453. #define INREG16(addr) readw((u16 __iomem *)(dinfo->mmio_base + (addr)))
  454. #define INREG(addr) readl((u32 __iomem *)(dinfo->mmio_base + (addr)))
  455. #define OUTREG8(addr, val) writeb((val),(u8 __iomem *)(dinfo->mmio_base + \
  456. (addr)))
  457. #define OUTREG16(addr, val) writew((val),(u16 __iomem *)(dinfo->mmio_base + \
  458. (addr)))
  459. #define OUTREG(addr, val) writel((val),(u32 __iomem *)(dinfo->mmio_base + \
  460. (addr)))
  461. /* Ring buffer macros */
  462. #define OUT_RING(n) do { \
  463. writel((n), (u32 __iomem *)(dinfo->ring.virtual + dinfo->ring_tail));\
  464. dinfo->ring_tail += 4; \
  465. dinfo->ring_tail &= dinfo->ring_tail_mask; \
  466. } while (0)
  467. #define START_RING(n) do { \
  468. if (dinfo->ring_space < (n) * 4) \
  469. wait_ring(dinfo,(n) * 4); \
  470. dinfo->ring_space -= (n) * 4; \
  471. } while (0)
  472. #define ADVANCE_RING() do { \
  473. OUTREG(PRI_RING_TAIL, dinfo->ring_tail); \
  474. } while (0)
  475. #define DO_RING_IDLE() do { \
  476. u32 head, tail; \
  477. do { \
  478. head = INREG(PRI_RING_HEAD) & RING_HEAD_MASK; \
  479. tail = INREG(PRI_RING_TAIL) & RING_TAIL_MASK; \
  480. udelay(10); \
  481. } while (head != tail); \
  482. } while (0)
  483. /* function protoypes */
  484. extern int intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo);
  485. extern int intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
  486. int *stolen_size);
  487. extern int intelfbhw_check_non_crt(struct intelfb_info *dinfo);
  488. extern const char *intelfbhw_dvo_to_string(int dvo);
  489. extern int intelfbhw_validate_mode(struct intelfb_info *dinfo,
  490. struct fb_var_screeninfo *var);
  491. extern int intelfbhw_pan_display(struct fb_var_screeninfo *var,
  492. struct fb_info *info);
  493. extern void intelfbhw_do_blank(int blank, struct fb_info *info);
  494. extern void intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno,
  495. unsigned red, unsigned green, unsigned blue,
  496. unsigned transp);
  497. extern int intelfbhw_read_hw_state(struct intelfb_info *dinfo,
  498. struct intelfb_hwstate *hw, int flag);
  499. extern void intelfbhw_print_hw_state(struct intelfb_info *dinfo,
  500. struct intelfb_hwstate *hw);
  501. extern int intelfbhw_mode_to_hw(struct intelfb_info *dinfo,
  502. struct intelfb_hwstate *hw,
  503. struct fb_var_screeninfo *var);
  504. extern int intelfbhw_program_mode(struct intelfb_info *dinfo,
  505. const struct intelfb_hwstate *hw, int blank);
  506. extern void intelfbhw_do_sync(struct intelfb_info *dinfo);
  507. extern void intelfbhw_2d_stop(struct intelfb_info *dinfo);
  508. extern void intelfbhw_2d_start(struct intelfb_info *dinfo);
  509. extern void intelfbhw_do_fillrect(struct intelfb_info *dinfo, u32 x, u32 y,
  510. u32 w, u32 h, u32 color, u32 pitch, u32 bpp,
  511. u32 rop);
  512. extern void intelfbhw_do_bitblt(struct intelfb_info *dinfo, u32 curx, u32 cury,
  513. u32 dstx, u32 dsty, u32 w, u32 h, u32 pitch,
  514. u32 bpp);
  515. extern int intelfbhw_do_drawglyph(struct intelfb_info *dinfo, u32 fg, u32 bg,
  516. u32 w, u32 h, const u8* cdat, u32 x, u32 y,
  517. u32 pitch, u32 bpp);
  518. extern void intelfbhw_cursor_init(struct intelfb_info *dinfo);
  519. extern void intelfbhw_cursor_hide(struct intelfb_info *dinfo);
  520. extern void intelfbhw_cursor_show(struct intelfb_info *dinfo);
  521. extern void intelfbhw_cursor_setpos(struct intelfb_info *dinfo, int x, int y);
  522. extern void intelfbhw_cursor_setcolor(struct intelfb_info *dinfo, u32 bg,
  523. u32 fg);
  524. extern void intelfbhw_cursor_load(struct intelfb_info *dinfo, int width,
  525. int height, u8 *data);
  526. extern void intelfbhw_cursor_reset(struct intelfb_info *dinfo);
  527. extern int intelfbhw_enable_irq(struct intelfb_info *dinfo);
  528. extern void intelfbhw_disable_irq(struct intelfb_info *dinfo);
  529. extern int intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe);
  530. extern int intelfbhw_active_pipe(const struct intelfb_hwstate *hw);
  531. #endif /* _INTELFBHW_H */