intelfbhw.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  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 INSTPM 0x20c0
  73. #define SYNC_FLUSH_ENABLE (1 << 5)
  74. #define INSTPS 0x20c4
  75. #define MEM_MODE 0x20cc
  76. #define MASK_SHIFT 16
  77. #define FW_BLC_0 0x20d8
  78. #define FW_DISPA_WM_SHIFT 0
  79. #define FW_DISPA_WM_MASK 0x3f
  80. #define FW_DISPA_BL_SHIFT 8
  81. #define FW_DISPA_BL_MASK 0xf
  82. #define FW_DISPB_WM_SHIFT 16
  83. #define FW_DISPB_WM_MASK 0x1f
  84. #define FW_DISPB_BL_SHIFT 24
  85. #define FW_DISPB_BL_MASK 0x7
  86. #define FW_BLC_1 0x20dc
  87. #define FW_DISPC_WM_SHIFT 0
  88. #define FW_DISPC_WM_MASK 0x1f
  89. #define FW_DISPC_BL_SHIFT 8
  90. #define FW_DISPC_BL_MASK 0x7
  91. /* PLL registers */
  92. #define VGA0_DIVISOR 0x06000
  93. #define VGA1_DIVISOR 0x06004
  94. #define VGAPD 0x06010
  95. #define VGAPD_0_P1_SHIFT 0
  96. #define VGAPD_0_P1_FORCE_DIV2 (1 << 5)
  97. #define VGAPD_0_P2_SHIFT 7
  98. #define VGAPD_1_P1_SHIFT 8
  99. #define VGAPD_1_P1_FORCE_DIV2 (1 << 13)
  100. #define VGAPD_1_P2_SHIFT 15
  101. #define DPLL_A 0x06014
  102. #define DPLL_B 0x06018
  103. #define DPLL_VCO_ENABLE (1 << 31)
  104. #define DPLL_2X_CLOCK_ENABLE (1 << 30)
  105. #define DPLL_SYNCLOCK_ENABLE (1 << 29)
  106. #define DPLL_VGA_MODE_DISABLE (1 << 28)
  107. #define DPLL_P2_MASK 1
  108. #define DPLL_P2_SHIFT 23
  109. #define DPLL_P1_FORCE_DIV2 (1 << 21)
  110. #define DPLL_P1_MASK 0x1f
  111. #define DPLL_P1_SHIFT 16
  112. #define DPLL_REFERENCE_SELECT_MASK (0x3 << 13)
  113. #define DPLL_REFERENCE_DEFAULT (0x0 << 13)
  114. #define DPLL_REFERENCE_TVCLK (0x2 << 13)
  115. #define DPLL_RATE_SELECT_MASK (1 << 8)
  116. #define DPLL_RATE_SELECT_FP0 (0 << 8)
  117. #define DPLL_RATE_SELECT_FP1 (1 << 8)
  118. #define FPA0 0x06040
  119. #define FPA1 0x06044
  120. #define FPB0 0x06048
  121. #define FPB1 0x0604c
  122. #define FP_DIVISOR_MASK 0x3f
  123. #define FP_N_DIVISOR_SHIFT 16
  124. #define FP_M1_DIVISOR_SHIFT 8
  125. #define FP_M2_DIVISOR_SHIFT 0
  126. /* PLL parameters (these are for 852GM/855GM/865G, check earlier chips). */
  127. /* Clock values are in units of kHz */
  128. #define PLL_REFCLK 48000
  129. #define MIN_VCO_FREQ 930000
  130. #define MAX_VCO_FREQ 1400000
  131. #define MIN_CLOCK 25000
  132. #define MAX_CLOCK 350000
  133. #define P_TRANSITION_CLOCK 165000
  134. #define MIN_M 108
  135. #define MAX_M 140
  136. #define MIN_M1 18
  137. #define MAX_M1 26
  138. #define MIN_M2 6
  139. #define MAX_M2 16
  140. #define MIN_P 4
  141. #define MAX_P 128
  142. #define MIN_P1 0
  143. #define MAX_P1 31
  144. #define MIN_N 3
  145. #define MAX_N 16
  146. #define CALC_VCLOCK(m1, m2, n, p1, p2) \
  147. ((PLL_REFCLK * (5 * ((m1) + 2) + ((m2) + 2)) / ((n) + 2)) / \
  148. (((p1) + 2) * (1 << (p2 + 1))))
  149. #define CALC_VCLOCK3(m, n, p) ((PLL_REFCLK * (m) / (n)) / (p))
  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 PIPEACONF 0x70008
  241. #define PIPEBCONF 0x71008
  242. #define PIPECONF_ENABLE (1 << 31)
  243. #define PIPECONF_DISABLE 0
  244. #define PIPECONF_DOUBLE_WIDE (1 << 30)
  245. #define PIPECONF_SINGLE_WIDE 0
  246. #define PIPECONF_LOCKED (1 << 25)
  247. #define PIPECONF_UNLOCKED 0
  248. #define PIPECONF_GAMMA (1 << 24)
  249. #define PIPECONF_PALETTE 0
  250. #define DISPARB 0x70030
  251. #define DISPARB_AEND_MASK 0x1ff
  252. #define DISPARB_AEND_SHIFT 0
  253. #define DISPARB_BEND_MASK 0x3ff
  254. #define DISPARB_BEND_SHIFT 9
  255. /* Desktop HW cursor */
  256. #define CURSOR_CONTROL 0x70080
  257. #define CURSOR_ENABLE (1 << 31)
  258. #define CURSOR_GAMMA_ENABLE (1 << 30)
  259. #define CURSOR_STRIDE_MASK (0x3 << 28)
  260. #define CURSOR_STRIDE_256 (0x0 << 28)
  261. #define CURSOR_STRIDE_512 (0x1 << 28)
  262. #define CURSOR_STRIDE_1K (0x2 << 28)
  263. #define CURSOR_STRIDE_2K (0x3 << 28)
  264. #define CURSOR_FORMAT_MASK (0x7 << 24)
  265. #define CURSOR_FORMAT_2C (0x0 << 24)
  266. #define CURSOR_FORMAT_3C (0x1 << 24)
  267. #define CURSOR_FORMAT_4C (0x2 << 24)
  268. #define CURSOR_FORMAT_ARGB (0x4 << 24)
  269. #define CURSOR_FORMAT_XRGB (0x5 << 24)
  270. /* Mobile HW cursor (and i810) */
  271. #define CURSOR_A_CONTROL CURSOR_CONTROL
  272. #define CURSOR_B_CONTROL 0x700c0
  273. #define CURSOR_MODE_MASK 0x27
  274. #define CURSOR_MODE_DISABLE 0
  275. #define CURSOR_MODE_64_3C 0x04
  276. #define CURSOR_MODE_64_4C_AX 0x05
  277. #define CURSOR_MODE_64_4C 0x06
  278. #define CURSOR_MODE_64_32B_AX 0x07
  279. #define CURSOR_MODE_64_ARGB_AX 0x27
  280. #define CURSOR_PIPE_SELECT_SHIFT 28
  281. #define CURSOR_MOBILE_GAMMA_ENABLE (1 << 26)
  282. #define CURSOR_MEM_TYPE_LOCAL (1 << 25)
  283. /* All platforms (desktop has no pipe B) */
  284. #define CURSOR_A_BASEADDR 0x70084
  285. #define CURSOR_B_BASEADDR 0x700c4
  286. #define CURSOR_BASE_MASK 0xffffff00
  287. #define CURSOR_A_POSITION 0x70088
  288. #define CURSOR_B_POSITION 0x700c8
  289. #define CURSOR_POS_SIGN (1 << 15)
  290. #define CURSOR_POS_MASK 0x7ff
  291. #define CURSOR_X_SHIFT 0
  292. #define CURSOR_Y_SHIFT 16
  293. #define CURSOR_A_PALETTE0 0x70090
  294. #define CURSOR_A_PALETTE1 0x70094
  295. #define CURSOR_A_PALETTE2 0x70098
  296. #define CURSOR_A_PALETTE3 0x7009c
  297. #define CURSOR_B_PALETTE0 0x700d0
  298. #define CURSOR_B_PALETTE1 0x700d4
  299. #define CURSOR_B_PALETTE2 0x700d8
  300. #define CURSOR_B_PALETTE3 0x700dc
  301. #define CURSOR_COLOR_MASK 0xff
  302. #define CURSOR_RED_SHIFT 16
  303. #define CURSOR_GREEN_SHIFT 8
  304. #define CURSOR_BLUE_SHIFT 0
  305. #define CURSOR_PALETTE_MASK 0xffffff
  306. /* Desktop only */
  307. #define CURSOR_SIZE 0x700a0
  308. #define CURSOR_SIZE_MASK 0x3ff
  309. #define CURSOR_SIZE_H_SHIFT 0
  310. #define CURSOR_SIZE_V_SHIFT 12
  311. #define DSPACNTR 0x70180
  312. #define DSPBCNTR 0x71180
  313. #define DISPPLANE_PLANE_ENABLE (1 << 31)
  314. #define DISPPLANE_PLANE_DISABLE 0
  315. #define DISPPLANE_GAMMA_ENABLE (1<<30)
  316. #define DISPPLANE_GAMMA_DISABLE 0
  317. #define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
  318. #define DISPPLANE_8BPP (0x2<<26)
  319. #define DISPPLANE_15_16BPP (0x4<<26)
  320. #define DISPPLANE_16BPP (0x5<<26)
  321. #define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
  322. #define DISPPLANE_32BPP (0x7<<26)
  323. #define DISPPLANE_STEREO_ENABLE (1<<25)
  324. #define DISPPLANE_STEREO_DISABLE 0
  325. #define DISPPLANE_SEL_PIPE_SHIFT 24
  326. #define DISPPLANE_SRC_KEY_ENABLE (1<<22)
  327. #define DISPPLANE_SRC_KEY_DISABLE 0
  328. #define DISPPLANE_LINE_DOUBLE (1<<20)
  329. #define DISPPLANE_NO_LINE_DOUBLE 0
  330. #define DISPPLANE_STEREO_POLARITY_FIRST 0
  331. #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
  332. /* plane B only */
  333. #define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
  334. #define DISPPLANE_ALPHA_TRANS_DISABLE 0
  335. #define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0
  336. #define DISPPLANE_SPRITE_ABOVE_OVERLAY 1
  337. #define DSPABASE 0x70184
  338. #define DSPASTRIDE 0x70188
  339. #define DSPBBASE 0x71184
  340. #define DSPBSTRIDE 0x71188
  341. #define VGACNTRL 0x71400
  342. #define VGA_DISABLE (1 << 31)
  343. #define VGA_ENABLE 0
  344. #define VGA_PIPE_SELECT_SHIFT 29
  345. #define VGA_PALETTE_READ_SELECT 23
  346. #define VGA_PALETTE_A_WRITE_DISABLE (1 << 22)
  347. #define VGA_PALETTE_B_WRITE_DISABLE (1 << 21)
  348. #define VGA_LEGACY_PALETTE (1 << 20)
  349. #define VGA_6BIT_DAC 0
  350. #define VGA_8BIT_DAC (1 << 20)
  351. #define ADD_ID 0x71408
  352. #define ADD_ID_MASK 0xff
  353. /* BIOS scratch area registers (830M and 845G). */
  354. #define SWF0 0x71410
  355. #define SWF1 0x71414
  356. #define SWF2 0x71418
  357. #define SWF3 0x7141c
  358. #define SWF4 0x71420
  359. #define SWF5 0x71424
  360. #define SWF6 0x71428
  361. /* BIOS scratch area registers (852GM, 855GM, 865G). */
  362. #define SWF00 0x70410
  363. #define SWF01 0x70414
  364. #define SWF02 0x70418
  365. #define SWF03 0x7041c
  366. #define SWF04 0x70420
  367. #define SWF05 0x70424
  368. #define SWF06 0x70428
  369. #define SWF10 SWF0
  370. #define SWF11 SWF1
  371. #define SWF12 SWF2
  372. #define SWF13 SWF3
  373. #define SWF14 SWF4
  374. #define SWF15 SWF5
  375. #define SWF16 SWF6
  376. #define SWF30 0x72414
  377. #define SWF31 0x72418
  378. #define SWF32 0x7241c
  379. /* Memory Commands */
  380. #define MI_NOOP (0x00 << 23)
  381. #define MI_NOOP_WRITE_ID (1 << 22)
  382. #define MI_NOOP_ID_MASK ((1 << 22) - 1)
  383. #define MI_FLUSH (0x04 << 23)
  384. #define MI_WRITE_DIRTY_STATE (1 << 4)
  385. #define MI_END_SCENE (1 << 3)
  386. #define MI_INHIBIT_RENDER_CACHE_FLUSH (1 << 2)
  387. #define MI_INVALIDATE_MAP_CACHE (1 << 0)
  388. #define MI_STORE_DWORD_IMM ((0x20 << 23) | 1)
  389. /* 2D Commands */
  390. #define COLOR_BLT_CMD ((2 << 29) | (0x40 << 22) | 3)
  391. #define XY_COLOR_BLT_CMD ((2 << 29) | (0x50 << 22) | 4)
  392. #define XY_SETUP_CLIP_BLT_CMD ((2 << 29) | (0x03 << 22) | 1)
  393. #define XY_SRC_COPY_BLT_CMD ((2 << 29) | (0x53 << 22) | 6)
  394. #define SRC_COPY_BLT_CMD ((2 << 29) | (0x43 << 22) | 4)
  395. #define XY_MONO_PAT_BLT_CMD ((2 << 29) | (0x52 << 22) | 7)
  396. #define XY_MONO_SRC_BLT_CMD ((2 << 29) | (0x54 << 22) | 6)
  397. #define XY_MONO_SRC_IMM_BLT_CMD ((2 << 29) | (0x71 << 22) | 5)
  398. #define TXT_IMM_BLT_CMD ((2 << 29) | (0x30 << 22) | 2)
  399. #define SETUP_BLT_CMD ((2 << 29) | (0x00 << 22) | 6)
  400. #define DW_LENGTH_MASK 0xff
  401. #define WRITE_ALPHA (1 << 21)
  402. #define WRITE_RGB (1 << 20)
  403. #define VERT_SEED (3 << 8)
  404. #define HORIZ_SEED (3 << 12)
  405. #define COLOR_DEPTH_8 (0 << 24)
  406. #define COLOR_DEPTH_16 (1 << 24)
  407. #define COLOR_DEPTH_32 (3 << 24)
  408. #define SRC_ROP_GXCOPY 0xcc
  409. #define SRC_ROP_GXXOR 0x66
  410. #define PAT_ROP_GXCOPY 0xf0
  411. #define PAT_ROP_GXXOR 0x5a
  412. #define PITCH_SHIFT 0
  413. #define ROP_SHIFT 16
  414. #define WIDTH_SHIFT 0
  415. #define HEIGHT_SHIFT 16
  416. /* in bytes */
  417. #define MAX_MONO_IMM_SIZE 128
  418. /*** Macros ***/
  419. /* I/O macros */
  420. #define INREG8(addr) readb((u8 __iomem *)(dinfo->mmio_base + (addr)))
  421. #define INREG(addr) readl((u32 __iomem *)(dinfo->mmio_base + (addr)))
  422. #define OUTREG8(addr, val) writeb((val),(u8 __iomem *)(dinfo->mmio_base + \
  423. (addr)))
  424. #define OUTREG(addr, val) writel((val),(u32 __iomem *)(dinfo->mmio_base + \
  425. (addr)))
  426. /* Ring buffer macros */
  427. #define OUT_RING(n) do { \
  428. writel((n), (u32 __iomem *)(dinfo->ring.virtual + dinfo->ring_tail));\
  429. dinfo->ring_tail += 4; \
  430. dinfo->ring_tail &= dinfo->ring_tail_mask; \
  431. } while (0)
  432. #define START_RING(n) do { \
  433. if (dinfo->ring_space < (n) * 4) \
  434. wait_ring(dinfo,(n) * 4); \
  435. dinfo->ring_space -= (n) * 4; \
  436. } while (0)
  437. #define ADVANCE_RING() do { \
  438. OUTREG(PRI_RING_TAIL, dinfo->ring_tail); \
  439. } while (0)
  440. #define DO_RING_IDLE() do { \
  441. u32 head, tail; \
  442. do { \
  443. head = INREG(PRI_RING_HEAD) & RING_HEAD_MASK; \
  444. tail = INREG(PRI_RING_TAIL) & RING_TAIL_MASK; \
  445. udelay(10); \
  446. } while (head != tail); \
  447. } while (0)
  448. /* function protoypes */
  449. extern int intelfbhw_get_chipset(struct pci_dev *pdev, const char **name,
  450. int *chipset, int *mobile);
  451. extern int intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
  452. int *stolen_size);
  453. extern int intelfbhw_check_non_crt(struct intelfb_info *dinfo);
  454. extern const char *intelfbhw_dvo_to_string(int dvo);
  455. extern int intelfbhw_validate_mode(struct intelfb_info *dinfo,
  456. struct fb_var_screeninfo *var);
  457. extern int intelfbhw_pan_display(struct fb_var_screeninfo *var,
  458. struct fb_info *info);
  459. extern void intelfbhw_do_blank(int blank, struct fb_info *info);
  460. extern void intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno,
  461. unsigned red, unsigned green, unsigned blue,
  462. unsigned transp);
  463. extern int intelfbhw_read_hw_state(struct intelfb_info *dinfo,
  464. struct intelfb_hwstate *hw, int flag);
  465. extern void intelfbhw_print_hw_state(struct intelfb_info *dinfo,
  466. struct intelfb_hwstate *hw);
  467. extern int intelfbhw_mode_to_hw(struct intelfb_info *dinfo,
  468. struct intelfb_hwstate *hw,
  469. struct fb_var_screeninfo *var);
  470. extern int intelfbhw_program_mode(struct intelfb_info *dinfo,
  471. const struct intelfb_hwstate *hw, int blank);
  472. extern void intelfbhw_do_sync(struct intelfb_info *dinfo);
  473. extern void intelfbhw_2d_stop(struct intelfb_info *dinfo);
  474. extern void intelfbhw_2d_start(struct intelfb_info *dinfo);
  475. extern void intelfbhw_do_fillrect(struct intelfb_info *dinfo, u32 x, u32 y,
  476. u32 w, u32 h, u32 color, u32 pitch, u32 bpp,
  477. u32 rop);
  478. extern void intelfbhw_do_bitblt(struct intelfb_info *dinfo, u32 curx, u32 cury,
  479. u32 dstx, u32 dsty, u32 w, u32 h, u32 pitch,
  480. u32 bpp);
  481. extern int intelfbhw_do_drawglyph(struct intelfb_info *dinfo, u32 fg, u32 bg,
  482. u32 w, u32 h, const u8* cdat, u32 x, u32 y,
  483. u32 pitch, u32 bpp);
  484. extern void intelfbhw_cursor_init(struct intelfb_info *dinfo);
  485. extern void intelfbhw_cursor_hide(struct intelfb_info *dinfo);
  486. extern void intelfbhw_cursor_show(struct intelfb_info *dinfo);
  487. extern void intelfbhw_cursor_setpos(struct intelfb_info *dinfo, int x, int y);
  488. extern void intelfbhw_cursor_setcolor(struct intelfb_info *dinfo, u32 bg,
  489. u32 fg);
  490. extern void intelfbhw_cursor_load(struct intelfb_info *dinfo, int width,
  491. int height, u8 *data);
  492. extern void intelfbhw_cursor_reset(struct intelfb_info *dinfo);
  493. #endif /* _INTELFBHW_H */