intelfbhw.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  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_I9XX_P2_SHIFT 24
  110. #define DPLL_P1_FORCE_DIV2 (1 << 21)
  111. #define DPLL_P1_MASK 0x1f
  112. #define DPLL_P1_SHIFT 16
  113. #define DPLL_REFERENCE_SELECT_MASK (0x3 << 13)
  114. #define DPLL_REFERENCE_DEFAULT (0x0 << 13)
  115. #define DPLL_REFERENCE_TVCLK (0x2 << 13)
  116. #define DPLL_RATE_SELECT_MASK (1 << 8)
  117. #define DPLL_RATE_SELECT_FP0 (0 << 8)
  118. #define DPLL_RATE_SELECT_FP1 (1 << 8)
  119. #define FPA0 0x06040
  120. #define FPA1 0x06044
  121. #define FPB0 0x06048
  122. #define FPB1 0x0604c
  123. #define FP_DIVISOR_MASK 0x3f
  124. #define FP_N_DIVISOR_SHIFT 16
  125. #define FP_M1_DIVISOR_SHIFT 8
  126. #define FP_M2_DIVISOR_SHIFT 0
  127. /* PLL parameters (these are for 852GM/855GM/865G, check earlier chips). */
  128. /* Clock values are in units of kHz */
  129. #define PLL_REFCLK 48000
  130. #define MIN_CLOCK 25000
  131. #define MAX_CLOCK 350000
  132. /* Two pipes */
  133. #define PIPE_A 0
  134. #define PIPE_B 1
  135. #define PIPE_MASK 1
  136. /* palette registers */
  137. #define PALETTE_A 0x0a000
  138. #define PALETTE_B 0x0a800
  139. #ifndef PALETTE_8_ENTRIES
  140. #define PALETTE_8_ENTRIES 256
  141. #endif
  142. #define PALETTE_8_SIZE (PALETTE_8_ENTRIES * 4)
  143. #define PALETTE_10_ENTRIES 128
  144. #define PALETTE_10_SIZE (PALETTE_10_ENTRIES * 8)
  145. #define PALETTE_8_MASK 0xff
  146. #define PALETTE_8_RED_SHIFT 16
  147. #define PALETTE_8_GREEN_SHIFT 8
  148. #define PALETTE_8_BLUE_SHIFT 0
  149. /* CRTC registers */
  150. #define HTOTAL_A 0x60000
  151. #define HBLANK_A 0x60004
  152. #define HSYNC_A 0x60008
  153. #define VTOTAL_A 0x6000c
  154. #define VBLANK_A 0x60010
  155. #define VSYNC_A 0x60014
  156. #define SRC_SIZE_A 0x6001c
  157. #define BCLRPAT_A 0x60020
  158. #define HTOTAL_B 0x61000
  159. #define HBLANK_B 0x61004
  160. #define HSYNC_B 0x61008
  161. #define VTOTAL_B 0x6100c
  162. #define VBLANK_B 0x61010
  163. #define VSYNC_B 0x61014
  164. #define SRC_SIZE_B 0x6101c
  165. #define BCLRPAT_B 0x61020
  166. #define HTOTAL_MASK 0xfff
  167. #define HTOTAL_SHIFT 16
  168. #define HACTIVE_MASK 0x7ff
  169. #define HACTIVE_SHIFT 0
  170. #define HBLANKEND_MASK 0xfff
  171. #define HBLANKEND_SHIFT 16
  172. #define HBLANKSTART_MASK 0xfff
  173. #define HBLANKSTART_SHIFT 0
  174. #define HSYNCEND_MASK 0xfff
  175. #define HSYNCEND_SHIFT 16
  176. #define HSYNCSTART_MASK 0xfff
  177. #define HSYNCSTART_SHIFT 0
  178. #define VTOTAL_MASK 0xfff
  179. #define VTOTAL_SHIFT 16
  180. #define VACTIVE_MASK 0x7ff
  181. #define VACTIVE_SHIFT 0
  182. #define VBLANKEND_MASK 0xfff
  183. #define VBLANKEND_SHIFT 16
  184. #define VBLANKSTART_MASK 0xfff
  185. #define VBLANKSTART_SHIFT 0
  186. #define VSYNCEND_MASK 0xfff
  187. #define VSYNCEND_SHIFT 16
  188. #define VSYNCSTART_MASK 0xfff
  189. #define VSYNCSTART_SHIFT 0
  190. #define SRC_SIZE_HORIZ_MASK 0x7ff
  191. #define SRC_SIZE_HORIZ_SHIFT 16
  192. #define SRC_SIZE_VERT_MASK 0x7ff
  193. #define SRC_SIZE_VERT_SHIFT 0
  194. #define ADPA 0x61100
  195. #define ADPA_DAC_ENABLE (1 << 31)
  196. #define ADPA_DAC_DISABLE 0
  197. #define ADPA_PIPE_SELECT_SHIFT 30
  198. #define ADPA_USE_VGA_HVPOLARITY (1 << 15)
  199. #define ADPA_SETS_HVPOLARITY 0
  200. #define ADPA_DPMS_CONTROL_MASK (0x3 << 10)
  201. #define ADPA_DPMS_D0 (0x0 << 10)
  202. #define ADPA_DPMS_D2 (0x1 << 10)
  203. #define ADPA_DPMS_D1 (0x2 << 10)
  204. #define ADPA_DPMS_D3 (0x3 << 10)
  205. #define ADPA_VSYNC_ACTIVE_SHIFT 4
  206. #define ADPA_HSYNC_ACTIVE_SHIFT 3
  207. #define ADPA_SYNC_ACTIVE_MASK 1
  208. #define ADPA_SYNC_ACTIVE_HIGH 1
  209. #define ADPA_SYNC_ACTIVE_LOW 0
  210. #define DVOA 0x61120
  211. #define DVOB 0x61140
  212. #define DVOC 0x61160
  213. #define LVDS 0x61180
  214. #define PORT_ENABLE (1 << 31)
  215. #define PORT_PIPE_SELECT_SHIFT 30
  216. #define PORT_TV_FLAGS_MASK 0xFF
  217. #define PORT_TV_FLAGS 0xC4 // ripped from my BIOS
  218. // to understand and correct
  219. #define DVOA_SRCDIM 0x61124
  220. #define DVOB_SRCDIM 0x61144
  221. #define DVOC_SRCDIM 0x61164
  222. #define PIPEACONF 0x70008
  223. #define PIPEBCONF 0x71008
  224. #define PIPECONF_ENABLE (1 << 31)
  225. #define PIPECONF_DISABLE 0
  226. #define PIPECONF_DOUBLE_WIDE (1 << 30)
  227. #define PIPECONF_SINGLE_WIDE 0
  228. #define PIPECONF_LOCKED (1 << 25)
  229. #define PIPECONF_UNLOCKED 0
  230. #define PIPECONF_GAMMA (1 << 24)
  231. #define PIPECONF_PALETTE 0
  232. #define DISPARB 0x70030
  233. #define DISPARB_AEND_MASK 0x1ff
  234. #define DISPARB_AEND_SHIFT 0
  235. #define DISPARB_BEND_MASK 0x3ff
  236. #define DISPARB_BEND_SHIFT 9
  237. /* Desktop HW cursor */
  238. #define CURSOR_CONTROL 0x70080
  239. #define CURSOR_ENABLE (1 << 31)
  240. #define CURSOR_GAMMA_ENABLE (1 << 30)
  241. #define CURSOR_STRIDE_MASK (0x3 << 28)
  242. #define CURSOR_STRIDE_256 (0x0 << 28)
  243. #define CURSOR_STRIDE_512 (0x1 << 28)
  244. #define CURSOR_STRIDE_1K (0x2 << 28)
  245. #define CURSOR_STRIDE_2K (0x3 << 28)
  246. #define CURSOR_FORMAT_MASK (0x7 << 24)
  247. #define CURSOR_FORMAT_2C (0x0 << 24)
  248. #define CURSOR_FORMAT_3C (0x1 << 24)
  249. #define CURSOR_FORMAT_4C (0x2 << 24)
  250. #define CURSOR_FORMAT_ARGB (0x4 << 24)
  251. #define CURSOR_FORMAT_XRGB (0x5 << 24)
  252. /* Mobile HW cursor (and i810) */
  253. #define CURSOR_A_CONTROL CURSOR_CONTROL
  254. #define CURSOR_B_CONTROL 0x700c0
  255. #define CURSOR_MODE_MASK 0x27
  256. #define CURSOR_MODE_DISABLE 0
  257. #define CURSOR_MODE_64_3C 0x04
  258. #define CURSOR_MODE_64_4C_AX 0x05
  259. #define CURSOR_MODE_64_4C 0x06
  260. #define CURSOR_MODE_64_32B_AX 0x07
  261. #define CURSOR_MODE_64_ARGB_AX 0x27
  262. #define CURSOR_PIPE_SELECT_SHIFT 28
  263. #define CURSOR_MOBILE_GAMMA_ENABLE (1 << 26)
  264. #define CURSOR_MEM_TYPE_LOCAL (1 << 25)
  265. /* All platforms (desktop has no pipe B) */
  266. #define CURSOR_A_BASEADDR 0x70084
  267. #define CURSOR_B_BASEADDR 0x700c4
  268. #define CURSOR_BASE_MASK 0xffffff00
  269. #define CURSOR_A_POSITION 0x70088
  270. #define CURSOR_B_POSITION 0x700c8
  271. #define CURSOR_POS_SIGN (1 << 15)
  272. #define CURSOR_POS_MASK 0x7ff
  273. #define CURSOR_X_SHIFT 0
  274. #define CURSOR_Y_SHIFT 16
  275. #define CURSOR_A_PALETTE0 0x70090
  276. #define CURSOR_A_PALETTE1 0x70094
  277. #define CURSOR_A_PALETTE2 0x70098
  278. #define CURSOR_A_PALETTE3 0x7009c
  279. #define CURSOR_B_PALETTE0 0x700d0
  280. #define CURSOR_B_PALETTE1 0x700d4
  281. #define CURSOR_B_PALETTE2 0x700d8
  282. #define CURSOR_B_PALETTE3 0x700dc
  283. #define CURSOR_COLOR_MASK 0xff
  284. #define CURSOR_RED_SHIFT 16
  285. #define CURSOR_GREEN_SHIFT 8
  286. #define CURSOR_BLUE_SHIFT 0
  287. #define CURSOR_PALETTE_MASK 0xffffff
  288. /* Desktop only */
  289. #define CURSOR_SIZE 0x700a0
  290. #define CURSOR_SIZE_MASK 0x3ff
  291. #define CURSOR_SIZE_H_SHIFT 0
  292. #define CURSOR_SIZE_V_SHIFT 12
  293. #define DSPACNTR 0x70180
  294. #define DSPBCNTR 0x71180
  295. #define DISPPLANE_PLANE_ENABLE (1 << 31)
  296. #define DISPPLANE_PLANE_DISABLE 0
  297. #define DISPPLANE_GAMMA_ENABLE (1<<30)
  298. #define DISPPLANE_GAMMA_DISABLE 0
  299. #define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
  300. #define DISPPLANE_8BPP (0x2<<26)
  301. #define DISPPLANE_15_16BPP (0x4<<26)
  302. #define DISPPLANE_16BPP (0x5<<26)
  303. #define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
  304. #define DISPPLANE_32BPP (0x7<<26)
  305. #define DISPPLANE_STEREO_ENABLE (1<<25)
  306. #define DISPPLANE_STEREO_DISABLE 0
  307. #define DISPPLANE_SEL_PIPE_SHIFT 24
  308. #define DISPPLANE_SRC_KEY_ENABLE (1<<22)
  309. #define DISPPLANE_SRC_KEY_DISABLE 0
  310. #define DISPPLANE_LINE_DOUBLE (1<<20)
  311. #define DISPPLANE_NO_LINE_DOUBLE 0
  312. #define DISPPLANE_STEREO_POLARITY_FIRST 0
  313. #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
  314. /* plane B only */
  315. #define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
  316. #define DISPPLANE_ALPHA_TRANS_DISABLE 0
  317. #define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0
  318. #define DISPPLANE_SPRITE_ABOVE_OVERLAY 1
  319. #define DSPABASE 0x70184
  320. #define DSPASTRIDE 0x70188
  321. #define DSPBBASE 0x71184
  322. #define DSPBSTRIDE 0x71188
  323. #define VGACNTRL 0x71400
  324. #define VGA_DISABLE (1 << 31)
  325. #define VGA_ENABLE 0
  326. #define VGA_PIPE_SELECT_SHIFT 29
  327. #define VGA_PALETTE_READ_SELECT 23
  328. #define VGA_PALETTE_A_WRITE_DISABLE (1 << 22)
  329. #define VGA_PALETTE_B_WRITE_DISABLE (1 << 21)
  330. #define VGA_LEGACY_PALETTE (1 << 20)
  331. #define VGA_6BIT_DAC 0
  332. #define VGA_8BIT_DAC (1 << 20)
  333. #define ADD_ID 0x71408
  334. #define ADD_ID_MASK 0xff
  335. /* BIOS scratch area registers (830M and 845G). */
  336. #define SWF0 0x71410
  337. #define SWF1 0x71414
  338. #define SWF2 0x71418
  339. #define SWF3 0x7141c
  340. #define SWF4 0x71420
  341. #define SWF5 0x71424
  342. #define SWF6 0x71428
  343. /* BIOS scratch area registers (852GM, 855GM, 865G). */
  344. #define SWF00 0x70410
  345. #define SWF01 0x70414
  346. #define SWF02 0x70418
  347. #define SWF03 0x7041c
  348. #define SWF04 0x70420
  349. #define SWF05 0x70424
  350. #define SWF06 0x70428
  351. #define SWF10 SWF0
  352. #define SWF11 SWF1
  353. #define SWF12 SWF2
  354. #define SWF13 SWF3
  355. #define SWF14 SWF4
  356. #define SWF15 SWF5
  357. #define SWF16 SWF6
  358. #define SWF30 0x72414
  359. #define SWF31 0x72418
  360. #define SWF32 0x7241c
  361. /* Memory Commands */
  362. #define MI_NOOP (0x00 << 23)
  363. #define MI_NOOP_WRITE_ID (1 << 22)
  364. #define MI_NOOP_ID_MASK ((1 << 22) - 1)
  365. #define MI_FLUSH (0x04 << 23)
  366. #define MI_WRITE_DIRTY_STATE (1 << 4)
  367. #define MI_END_SCENE (1 << 3)
  368. #define MI_INHIBIT_RENDER_CACHE_FLUSH (1 << 2)
  369. #define MI_INVALIDATE_MAP_CACHE (1 << 0)
  370. #define MI_STORE_DWORD_IMM ((0x20 << 23) | 1)
  371. /* 2D Commands */
  372. #define COLOR_BLT_CMD ((2 << 29) | (0x40 << 22) | 3)
  373. #define XY_COLOR_BLT_CMD ((2 << 29) | (0x50 << 22) | 4)
  374. #define XY_SETUP_CLIP_BLT_CMD ((2 << 29) | (0x03 << 22) | 1)
  375. #define XY_SRC_COPY_BLT_CMD ((2 << 29) | (0x53 << 22) | 6)
  376. #define SRC_COPY_BLT_CMD ((2 << 29) | (0x43 << 22) | 4)
  377. #define XY_MONO_PAT_BLT_CMD ((2 << 29) | (0x52 << 22) | 7)
  378. #define XY_MONO_SRC_BLT_CMD ((2 << 29) | (0x54 << 22) | 6)
  379. #define XY_MONO_SRC_IMM_BLT_CMD ((2 << 29) | (0x71 << 22) | 5)
  380. #define TXT_IMM_BLT_CMD ((2 << 29) | (0x30 << 22) | 2)
  381. #define SETUP_BLT_CMD ((2 << 29) | (0x00 << 22) | 6)
  382. #define DW_LENGTH_MASK 0xff
  383. #define WRITE_ALPHA (1 << 21)
  384. #define WRITE_RGB (1 << 20)
  385. #define VERT_SEED (3 << 8)
  386. #define HORIZ_SEED (3 << 12)
  387. #define COLOR_DEPTH_8 (0 << 24)
  388. #define COLOR_DEPTH_16 (1 << 24)
  389. #define COLOR_DEPTH_32 (3 << 24)
  390. #define SRC_ROP_GXCOPY 0xcc
  391. #define SRC_ROP_GXXOR 0x66
  392. #define PAT_ROP_GXCOPY 0xf0
  393. #define PAT_ROP_GXXOR 0x5a
  394. #define PITCH_SHIFT 0
  395. #define ROP_SHIFT 16
  396. #define WIDTH_SHIFT 0
  397. #define HEIGHT_SHIFT 16
  398. /* in bytes */
  399. #define MAX_MONO_IMM_SIZE 128
  400. /*** Macros ***/
  401. /* I/O macros */
  402. #define INREG8(addr) readb((u8 __iomem *)(dinfo->mmio_base + (addr)))
  403. #define INREG(addr) readl((u32 __iomem *)(dinfo->mmio_base + (addr)))
  404. #define OUTREG8(addr, val) writeb((val),(u8 __iomem *)(dinfo->mmio_base + \
  405. (addr)))
  406. #define OUTREG(addr, val) writel((val),(u32 __iomem *)(dinfo->mmio_base + \
  407. (addr)))
  408. /* Ring buffer macros */
  409. #define OUT_RING(n) do { \
  410. writel((n), (u32 __iomem *)(dinfo->ring.virtual + dinfo->ring_tail));\
  411. dinfo->ring_tail += 4; \
  412. dinfo->ring_tail &= dinfo->ring_tail_mask; \
  413. } while (0)
  414. #define START_RING(n) do { \
  415. if (dinfo->ring_space < (n) * 4) \
  416. wait_ring(dinfo,(n) * 4); \
  417. dinfo->ring_space -= (n) * 4; \
  418. } while (0)
  419. #define ADVANCE_RING() do { \
  420. OUTREG(PRI_RING_TAIL, dinfo->ring_tail); \
  421. } while (0)
  422. #define DO_RING_IDLE() do { \
  423. u32 head, tail; \
  424. do { \
  425. head = INREG(PRI_RING_HEAD) & RING_HEAD_MASK; \
  426. tail = INREG(PRI_RING_TAIL) & RING_TAIL_MASK; \
  427. udelay(10); \
  428. } while (head != tail); \
  429. } while (0)
  430. /* function protoypes */
  431. extern int intelfbhw_get_chipset(struct pci_dev *pdev, struct intelfb_info *dinfo);
  432. extern int intelfbhw_get_memory(struct pci_dev *pdev, int *aperture_size,
  433. int *stolen_size);
  434. extern int intelfbhw_check_non_crt(struct intelfb_info *dinfo);
  435. extern const char *intelfbhw_dvo_to_string(int dvo);
  436. extern int intelfbhw_validate_mode(struct intelfb_info *dinfo,
  437. struct fb_var_screeninfo *var);
  438. extern int intelfbhw_pan_display(struct fb_var_screeninfo *var,
  439. struct fb_info *info);
  440. extern void intelfbhw_do_blank(int blank, struct fb_info *info);
  441. extern void intelfbhw_setcolreg(struct intelfb_info *dinfo, unsigned regno,
  442. unsigned red, unsigned green, unsigned blue,
  443. unsigned transp);
  444. extern int intelfbhw_read_hw_state(struct intelfb_info *dinfo,
  445. struct intelfb_hwstate *hw, int flag);
  446. extern void intelfbhw_print_hw_state(struct intelfb_info *dinfo,
  447. struct intelfb_hwstate *hw);
  448. extern int intelfbhw_mode_to_hw(struct intelfb_info *dinfo,
  449. struct intelfb_hwstate *hw,
  450. struct fb_var_screeninfo *var);
  451. extern int intelfbhw_program_mode(struct intelfb_info *dinfo,
  452. const struct intelfb_hwstate *hw, int blank);
  453. extern void intelfbhw_do_sync(struct intelfb_info *dinfo);
  454. extern void intelfbhw_2d_stop(struct intelfb_info *dinfo);
  455. extern void intelfbhw_2d_start(struct intelfb_info *dinfo);
  456. extern void intelfbhw_do_fillrect(struct intelfb_info *dinfo, u32 x, u32 y,
  457. u32 w, u32 h, u32 color, u32 pitch, u32 bpp,
  458. u32 rop);
  459. extern void intelfbhw_do_bitblt(struct intelfb_info *dinfo, u32 curx, u32 cury,
  460. u32 dstx, u32 dsty, u32 w, u32 h, u32 pitch,
  461. u32 bpp);
  462. extern int intelfbhw_do_drawglyph(struct intelfb_info *dinfo, u32 fg, u32 bg,
  463. u32 w, u32 h, const u8* cdat, u32 x, u32 y,
  464. u32 pitch, u32 bpp);
  465. extern void intelfbhw_cursor_init(struct intelfb_info *dinfo);
  466. extern void intelfbhw_cursor_hide(struct intelfb_info *dinfo);
  467. extern void intelfbhw_cursor_show(struct intelfb_info *dinfo);
  468. extern void intelfbhw_cursor_setpos(struct intelfb_info *dinfo, int x, int y);
  469. extern void intelfbhw_cursor_setcolor(struct intelfb_info *dinfo, u32 bg,
  470. u32 fg);
  471. extern void intelfbhw_cursor_load(struct intelfb_info *dinfo, int width,
  472. int height, u8 *data);
  473. extern void intelfbhw_cursor_reset(struct intelfb_info *dinfo);
  474. #endif /* _INTELFBHW_H */