mgag200_reg.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. /*
  2. * MGA Millennium (MGA2064W) functions
  3. * MGA Mystique (MGA1064SG) functions
  4. *
  5. * Copyright 1996 The XFree86 Project, Inc.
  6. *
  7. * Authors
  8. * Dirk Hohndel
  9. * hohndel@XFree86.Org
  10. * David Dawes
  11. * dawes@XFree86.Org
  12. * Contributors:
  13. * Guy DESBIEF, Aix-en-provence, France
  14. * g.desbief@aix.pacwan.net
  15. * MGA1064SG Mystique register file
  16. */
  17. #ifndef _MGA_REG_H_
  18. #define _MGA_REG_H_
  19. #define MGAREG_DWGCTL 0x1c00
  20. #define MGAREG_MACCESS 0x1c04
  21. /* the following is a mystique only register */
  22. #define MGAREG_MCTLWTST 0x1c08
  23. #define MGAREG_ZORG 0x1c0c
  24. #define MGAREG_PAT0 0x1c10
  25. #define MGAREG_PAT1 0x1c14
  26. #define MGAREG_PLNWT 0x1c1c
  27. #define MGAREG_BCOL 0x1c20
  28. #define MGAREG_FCOL 0x1c24
  29. #define MGAREG_SRC0 0x1c30
  30. #define MGAREG_SRC1 0x1c34
  31. #define MGAREG_SRC2 0x1c38
  32. #define MGAREG_SRC3 0x1c3c
  33. #define MGAREG_XYSTRT 0x1c40
  34. #define MGAREG_XYEND 0x1c44
  35. #define MGAREG_SHIFT 0x1c50
  36. /* the following is a mystique only register */
  37. #define MGAREG_DMAPAD 0x1c54
  38. #define MGAREG_SGN 0x1c58
  39. #define MGAREG_LEN 0x1c5c
  40. #define MGAREG_AR0 0x1c60
  41. #define MGAREG_AR1 0x1c64
  42. #define MGAREG_AR2 0x1c68
  43. #define MGAREG_AR3 0x1c6c
  44. #define MGAREG_AR4 0x1c70
  45. #define MGAREG_AR5 0x1c74
  46. #define MGAREG_AR6 0x1c78
  47. #define MGAREG_CXBNDRY 0x1c80
  48. #define MGAREG_FXBNDRY 0x1c84
  49. #define MGAREG_YDSTLEN 0x1c88
  50. #define MGAREG_PITCH 0x1c8c
  51. #define MGAREG_YDST 0x1c90
  52. #define MGAREG_YDSTORG 0x1c94
  53. #define MGAREG_YTOP 0x1c98
  54. #define MGAREG_YBOT 0x1c9c
  55. #define MGAREG_CXLEFT 0x1ca0
  56. #define MGAREG_CXRIGHT 0x1ca4
  57. #define MGAREG_FXLEFT 0x1ca8
  58. #define MGAREG_FXRIGHT 0x1cac
  59. #define MGAREG_XDST 0x1cb0
  60. #define MGAREG_DR0 0x1cc0
  61. #define MGAREG_DR1 0x1cc4
  62. #define MGAREG_DR2 0x1cc8
  63. #define MGAREG_DR3 0x1ccc
  64. #define MGAREG_DR4 0x1cd0
  65. #define MGAREG_DR5 0x1cd4
  66. #define MGAREG_DR6 0x1cd8
  67. #define MGAREG_DR7 0x1cdc
  68. #define MGAREG_DR8 0x1ce0
  69. #define MGAREG_DR9 0x1ce4
  70. #define MGAREG_DR10 0x1ce8
  71. #define MGAREG_DR11 0x1cec
  72. #define MGAREG_DR12 0x1cf0
  73. #define MGAREG_DR13 0x1cf4
  74. #define MGAREG_DR14 0x1cf8
  75. #define MGAREG_DR15 0x1cfc
  76. #define MGAREG_SRCORG 0x2cb4
  77. #define MGAREG_DSTORG 0x2cb8
  78. /* add or or this to one of the previous "power registers" to start
  79. the drawing engine */
  80. #define MGAREG_EXEC 0x0100
  81. #define MGAREG_FIFOSTATUS 0x1e10
  82. #define MGAREG_Status 0x1e14
  83. #define MGAREG_CACHEFLUSH 0x1fff
  84. #define MGAREG_ICLEAR 0x1e18
  85. #define MGAREG_IEN 0x1e1c
  86. #define MGAREG_VCOUNT 0x1e20
  87. #define MGAREG_Reset 0x1e40
  88. #define MGAREG_OPMODE 0x1e54
  89. /* Warp Registers */
  90. #define MGAREG_WIADDR 0x1dc0
  91. #define MGAREG_WIADDR2 0x1dd8
  92. #define MGAREG_WGETMSB 0x1dc8
  93. #define MGAREG_WVRTXSZ 0x1dcc
  94. #define MGAREG_WACCEPTSEQ 0x1dd4
  95. #define MGAREG_WMISC 0x1e70
  96. #define MGAREG_MEMCTL 0x2e08
  97. /* OPMODE register additives */
  98. #define MGAOPM_DMA_GENERAL (0x00 << 2)
  99. #define MGAOPM_DMA_BLIT (0x01 << 2)
  100. #define MGAOPM_DMA_VECTOR (0x10 << 2)
  101. /* MACCESS register additives */
  102. #define MGAMAC_PW8 0x00
  103. #define MGAMAC_PW16 0x01
  104. #define MGAMAC_PW24 0x03 /* not a typo */
  105. #define MGAMAC_PW32 0x02 /* not a typo */
  106. #define MGAMAC_BYPASS332 0x10000000
  107. #define MGAMAC_NODITHER 0x40000000
  108. #define MGAMAC_DIT555 0x80000000
  109. /* DWGCTL register additives */
  110. /* Lines */
  111. #define MGADWG_LINE_OPEN 0x00
  112. #define MGADWG_AUTOLINE_OPEN 0x01
  113. #define MGADWG_LINE_CLOSE 0x02
  114. #define MGADWG_AUTOLINE_CLOSE 0x03
  115. /* Trapezoids */
  116. #define MGADWG_TRAP 0x04
  117. #define MGADWG_TEXTURE_TRAP 0x06
  118. /* BitBlts */
  119. #define MGADWG_BITBLT 0x08
  120. #define MGADWG_FBITBLT 0x0c
  121. #define MGADWG_ILOAD 0x09
  122. #define MGADWG_ILOAD_SCALE 0x0d
  123. #define MGADWG_ILOAD_FILTER 0x0f
  124. #define MGADWG_ILOAD_HIQH 0x07
  125. #define MGADWG_ILOAD_HIQHV 0x0e
  126. #define MGADWG_IDUMP 0x0a
  127. /* atype access to WRAM */
  128. #define MGADWG_RPL ( 0x00 << 4 )
  129. #define MGADWG_RSTR ( 0x01 << 4 )
  130. #define MGADWG_ZI ( 0x03 << 4 )
  131. #define MGADWG_BLK ( 0x04 << 4 )
  132. #define MGADWG_I ( 0x07 << 4 )
  133. /* specifies whether bit blits are linear or xy */
  134. #define MGADWG_LINEAR ( 0x01 << 7 )
  135. /* z drawing mode. use MGADWG_NOZCMP for always */
  136. #define MGADWG_NOZCMP ( 0x00 << 8 )
  137. #define MGADWG_ZE ( 0x02 << 8 )
  138. #define MGADWG_ZNE ( 0x03 << 8 )
  139. #define MGADWG_ZLT ( 0x04 << 8 )
  140. #define MGADWG_ZLTE ( 0x05 << 8 )
  141. #define MGADWG_GT ( 0x06 << 8 )
  142. #define MGADWG_GTE ( 0x07 << 8 )
  143. /* use this to force colour expansion circuitry to do its stuff */
  144. #define MGADWG_SOLID ( 0x01 << 11 )
  145. /* ar register at zero */
  146. #define MGADWG_ARZERO ( 0x01 << 12 )
  147. #define MGADWG_SGNZERO ( 0x01 << 13 )
  148. #define MGADWG_SHIFTZERO ( 0x01 << 14 )
  149. /* See table on 4-43 for bop ALU operations */
  150. /* See table on 4-44 for translucidity masks */
  151. #define MGADWG_BMONOLEF ( 0x00 << 25 )
  152. #define MGADWG_BMONOWF ( 0x04 << 25 )
  153. #define MGADWG_BPLAN ( 0x01 << 25 )
  154. /* note that if bfcol is specified and you're doing a bitblt, it causes
  155. a fbitblt to be performed, so check that you obey the fbitblt rules */
  156. #define MGADWG_BFCOL ( 0x02 << 25 )
  157. #define MGADWG_BUYUV ( 0x0e << 25 )
  158. #define MGADWG_BU32BGR ( 0x03 << 25 )
  159. #define MGADWG_BU32RGB ( 0x07 << 25 )
  160. #define MGADWG_BU24BGR ( 0x0b << 25 )
  161. #define MGADWG_BU24RGB ( 0x0f << 25 )
  162. #define MGADWG_PATTERN ( 0x01 << 29 )
  163. #define MGADWG_TRANSC ( 0x01 << 30 )
  164. #define MGAREG_MISC_WRITE 0x3c2
  165. #define MGAREG_MISC_READ 0x3cc
  166. #define MGAREG_MEM_MISC_WRITE 0x1fc2
  167. #define MGAREG_MEM_MISC_READ 0x1fcc
  168. #define MGAREG_MISC_IOADSEL (0x1 << 0)
  169. #define MGAREG_MISC_RAMMAPEN (0x1 << 1)
  170. #define MGAREG_MISC_CLK_SEL_VGA25 (0x0 << 2)
  171. #define MGAREG_MISC_CLK_SEL_VGA28 (0x1 << 2)
  172. #define MGAREG_MISC_CLK_SEL_MGA_PIX (0x2 << 2)
  173. #define MGAREG_MISC_CLK_SEL_MGA_MSK (0x3 << 2)
  174. #define MGAREG_MISC_VIDEO_DIS (0x1 << 4)
  175. #define MGAREG_MISC_HIGH_PG_SEL (0x1 << 5)
  176. /* MMIO VGA registers */
  177. #define MGAREG_SEQ_INDEX 0x1fc4
  178. #define MGAREG_SEQ_DATA 0x1fc5
  179. #define MGAREG_CRTC_INDEX 0x1fd4
  180. #define MGAREG_CRTC_DATA 0x1fd5
  181. #define MGAREG_CRTCEXT_INDEX 0x1fde
  182. #define MGAREG_CRTCEXT_DATA 0x1fdf
  183. /* Cursor X and Y position */
  184. #define MGA_CURPOSXL 0x3c0c
  185. #define MGA_CURPOSXH 0x3c0d
  186. #define MGA_CURPOSYL 0x3c0e
  187. #define MGA_CURPOSYH 0x3c0f
  188. /* MGA bits for registers PCI_OPTION_REG */
  189. #define MGA1064_OPT_SYS_CLK_PCI ( 0x00 << 0 )
  190. #define MGA1064_OPT_SYS_CLK_PLL ( 0x01 << 0 )
  191. #define MGA1064_OPT_SYS_CLK_EXT ( 0x02 << 0 )
  192. #define MGA1064_OPT_SYS_CLK_MSK ( 0x03 << 0 )
  193. #define MGA1064_OPT_SYS_CLK_DIS ( 0x01 << 2 )
  194. #define MGA1064_OPT_G_CLK_DIV_1 ( 0x01 << 3 )
  195. #define MGA1064_OPT_M_CLK_DIV_1 ( 0x01 << 4 )
  196. #define MGA1064_OPT_SYS_PLL_PDN ( 0x01 << 5 )
  197. #define MGA1064_OPT_VGA_ION ( 0x01 << 8 )
  198. /* MGA registers in PCI config space */
  199. #define PCI_MGA_INDEX 0x44
  200. #define PCI_MGA_DATA 0x48
  201. #define PCI_MGA_OPTION 0x40
  202. #define PCI_MGA_OPTION2 0x50
  203. #define PCI_MGA_OPTION3 0x54
  204. #define RAMDAC_OFFSET 0x3c00
  205. /* TVP3026 direct registers */
  206. #define TVP3026_INDEX 0x00
  207. #define TVP3026_WADR_PAL 0x00
  208. #define TVP3026_COL_PAL 0x01
  209. #define TVP3026_PIX_RD_MSK 0x02
  210. #define TVP3026_RADR_PAL 0x03
  211. #define TVP3026_CUR_COL_ADDR 0x04
  212. #define TVP3026_CUR_COL_DATA 0x05
  213. #define TVP3026_DATA 0x0a
  214. #define TVP3026_CUR_RAM 0x0b
  215. #define TVP3026_CUR_XLOW 0x0c
  216. #define TVP3026_CUR_XHI 0x0d
  217. #define TVP3026_CUR_YLOW 0x0e
  218. #define TVP3026_CUR_YHI 0x0f
  219. /* TVP3026 indirect registers */
  220. #define TVP3026_SILICON_REV 0x01
  221. #define TVP3026_CURSOR_CTL 0x06
  222. #define TVP3026_LATCH_CTL 0x0f
  223. #define TVP3026_TRUE_COLOR_CTL 0x18
  224. #define TVP3026_MUX_CTL 0x19
  225. #define TVP3026_CLK_SEL 0x1a
  226. #define TVP3026_PAL_PAGE 0x1c
  227. #define TVP3026_GEN_CTL 0x1d
  228. #define TVP3026_MISC_CTL 0x1e
  229. #define TVP3026_GEN_IO_CTL 0x2a
  230. #define TVP3026_GEN_IO_DATA 0x2b
  231. #define TVP3026_PLL_ADDR 0x2c
  232. #define TVP3026_PIX_CLK_DATA 0x2d
  233. #define TVP3026_MEM_CLK_DATA 0x2e
  234. #define TVP3026_LOAD_CLK_DATA 0x2f
  235. #define TVP3026_KEY_RED_LOW 0x32
  236. #define TVP3026_KEY_RED_HI 0x33
  237. #define TVP3026_KEY_GREEN_LOW 0x34
  238. #define TVP3026_KEY_GREEN_HI 0x35
  239. #define TVP3026_KEY_BLUE_LOW 0x36
  240. #define TVP3026_KEY_BLUE_HI 0x37
  241. #define TVP3026_KEY_CTL 0x38
  242. #define TVP3026_MCLK_CTL 0x39
  243. #define TVP3026_SENSE_TEST 0x3a
  244. #define TVP3026_TEST_DATA 0x3b
  245. #define TVP3026_CRC_LSB 0x3c
  246. #define TVP3026_CRC_MSB 0x3d
  247. #define TVP3026_CRC_CTL 0x3e
  248. #define TVP3026_ID 0x3f
  249. #define TVP3026_RESET 0xff
  250. /* MGA1064 DAC Register file */
  251. /* MGA1064 direct registers */
  252. #define MGA1064_INDEX 0x00
  253. #define MGA1064_WADR_PAL 0x00
  254. #define MGA1064_SPAREREG 0x00
  255. #define MGA1064_COL_PAL 0x01
  256. #define MGA1064_PIX_RD_MSK 0x02
  257. #define MGA1064_RADR_PAL 0x03
  258. #define MGA1064_DATA 0x0a
  259. #define MGA1064_CUR_XLOW 0x0c
  260. #define MGA1064_CUR_XHI 0x0d
  261. #define MGA1064_CUR_YLOW 0x0e
  262. #define MGA1064_CUR_YHI 0x0f
  263. /* MGA1064 indirect registers */
  264. #define MGA1064_DVI_PIPE_CTL 0x03
  265. #define MGA1064_CURSOR_BASE_ADR_LOW 0x04
  266. #define MGA1064_CURSOR_BASE_ADR_HI 0x05
  267. #define MGA1064_CURSOR_CTL 0x06
  268. #define MGA1064_CURSOR_COL0_RED 0x08
  269. #define MGA1064_CURSOR_COL0_GREEN 0x09
  270. #define MGA1064_CURSOR_COL0_BLUE 0x0a
  271. #define MGA1064_CURSOR_COL1_RED 0x0c
  272. #define MGA1064_CURSOR_COL1_GREEN 0x0d
  273. #define MGA1064_CURSOR_COL1_BLUE 0x0e
  274. #define MGA1064_CURSOR_COL2_RED 0x010
  275. #define MGA1064_CURSOR_COL2_GREEN 0x011
  276. #define MGA1064_CURSOR_COL2_BLUE 0x012
  277. #define MGA1064_VREF_CTL 0x018
  278. #define MGA1064_MUL_CTL 0x19
  279. #define MGA1064_MUL_CTL_8bits 0x0
  280. #define MGA1064_MUL_CTL_15bits 0x01
  281. #define MGA1064_MUL_CTL_16bits 0x02
  282. #define MGA1064_MUL_CTL_24bits 0x03
  283. #define MGA1064_MUL_CTL_32bits 0x04
  284. #define MGA1064_MUL_CTL_2G8V16bits 0x05
  285. #define MGA1064_MUL_CTL_G16V16bits 0x06
  286. #define MGA1064_MUL_CTL_32_24bits 0x07
  287. #define MGA1064_PIX_CLK_CTL 0x1a
  288. #define MGA1064_PIX_CLK_CTL_CLK_DIS ( 0x01 << 2 )
  289. #define MGA1064_PIX_CLK_CTL_CLK_POW_DOWN ( 0x01 << 3 )
  290. #define MGA1064_PIX_CLK_CTL_SEL_PCI ( 0x00 << 0 )
  291. #define MGA1064_PIX_CLK_CTL_SEL_PLL ( 0x01 << 0 )
  292. #define MGA1064_PIX_CLK_CTL_SEL_EXT ( 0x02 << 0 )
  293. #define MGA1064_PIX_CLK_CTL_SEL_MSK ( 0x03 << 0 )
  294. #define MGA1064_GEN_CTL 0x1d
  295. #define MGA1064_GEN_CTL_SYNC_ON_GREEN_DIS (0x01 << 5)
  296. #define MGA1064_MISC_CTL 0x1e
  297. #define MGA1064_MISC_CTL_DAC_EN ( 0x01 << 0 )
  298. #define MGA1064_MISC_CTL_VGA ( 0x01 << 1 )
  299. #define MGA1064_MISC_CTL_DIS_CON ( 0x03 << 1 )
  300. #define MGA1064_MISC_CTL_MAFC ( 0x02 << 1 )
  301. #define MGA1064_MISC_CTL_VGA8 ( 0x01 << 3 )
  302. #define MGA1064_MISC_CTL_DAC_RAM_CS ( 0x01 << 4 )
  303. #define MGA1064_GEN_IO_CTL2 0x29
  304. #define MGA1064_GEN_IO_CTL 0x2a
  305. #define MGA1064_GEN_IO_DATA 0x2b
  306. #define MGA1064_SYS_PLL_M 0x2c
  307. #define MGA1064_SYS_PLL_N 0x2d
  308. #define MGA1064_SYS_PLL_P 0x2e
  309. #define MGA1064_SYS_PLL_STAT 0x2f
  310. #define MGA1064_REMHEADCTL 0x30
  311. #define MGA1064_REMHEADCTL_CLKDIS ( 0x01 << 0 )
  312. #define MGA1064_REMHEADCTL_CLKSL_OFF ( 0x00 << 1 )
  313. #define MGA1064_REMHEADCTL_CLKSL_PLL ( 0x01 << 1 )
  314. #define MGA1064_REMHEADCTL_CLKSL_PCI ( 0x02 << 1 )
  315. #define MGA1064_REMHEADCTL_CLKSL_MSK ( 0x03 << 1 )
  316. #define MGA1064_REMHEADCTL2 0x31
  317. #define MGA1064_ZOOM_CTL 0x38
  318. #define MGA1064_SENSE_TST 0x3a
  319. #define MGA1064_CRC_LSB 0x3c
  320. #define MGA1064_CRC_MSB 0x3d
  321. #define MGA1064_CRC_CTL 0x3e
  322. #define MGA1064_COL_KEY_MSK_LSB 0x40
  323. #define MGA1064_COL_KEY_MSK_MSB 0x41
  324. #define MGA1064_COL_KEY_LSB 0x42
  325. #define MGA1064_COL_KEY_MSB 0x43
  326. #define MGA1064_PIX_PLLA_M 0x44
  327. #define MGA1064_PIX_PLLA_N 0x45
  328. #define MGA1064_PIX_PLLA_P 0x46
  329. #define MGA1064_PIX_PLLB_M 0x48
  330. #define MGA1064_PIX_PLLB_N 0x49
  331. #define MGA1064_PIX_PLLB_P 0x4a
  332. #define MGA1064_PIX_PLLC_M 0x4c
  333. #define MGA1064_PIX_PLLC_N 0x4d
  334. #define MGA1064_PIX_PLLC_P 0x4e
  335. #define MGA1064_PIX_PLL_STAT 0x4f
  336. /*Added for G450 dual head*/
  337. #define MGA1064_VID_PLL_STAT 0x8c
  338. #define MGA1064_VID_PLL_P 0x8D
  339. #define MGA1064_VID_PLL_M 0x8E
  340. #define MGA1064_VID_PLL_N 0x8F
  341. /* Modified PLL for G200 Winbond (G200WB) */
  342. #define MGA1064_WB_PIX_PLLC_M 0xb7
  343. #define MGA1064_WB_PIX_PLLC_N 0xb6
  344. #define MGA1064_WB_PIX_PLLC_P 0xb8
  345. /* Modified PLL for G200 Maxim (G200EV) */
  346. #define MGA1064_EV_PIX_PLLC_M 0xb6
  347. #define MGA1064_EV_PIX_PLLC_N 0xb7
  348. #define MGA1064_EV_PIX_PLLC_P 0xb8
  349. /* Modified PLL for G200 EH */
  350. #define MGA1064_EH_PIX_PLLC_M 0xb6
  351. #define MGA1064_EH_PIX_PLLC_N 0xb7
  352. #define MGA1064_EH_PIX_PLLC_P 0xb8
  353. /* Modified PLL for G200 Maxim (G200ER) */
  354. #define MGA1064_ER_PIX_PLLC_M 0xb7
  355. #define MGA1064_ER_PIX_PLLC_N 0xb6
  356. #define MGA1064_ER_PIX_PLLC_P 0xb8
  357. #define MGA1064_DISP_CTL 0x8a
  358. #define MGA1064_DISP_CTL_DAC1OUTSEL_MASK 0x01
  359. #define MGA1064_DISP_CTL_DAC1OUTSEL_DIS 0x00
  360. #define MGA1064_DISP_CTL_DAC1OUTSEL_EN 0x01
  361. #define MGA1064_DISP_CTL_DAC2OUTSEL_MASK (0x03 << 2)
  362. #define MGA1064_DISP_CTL_DAC2OUTSEL_DIS 0x00
  363. #define MGA1064_DISP_CTL_DAC2OUTSEL_CRTC1 (0x01 << 2)
  364. #define MGA1064_DISP_CTL_DAC2OUTSEL_CRTC2 (0x02 << 2)
  365. #define MGA1064_DISP_CTL_DAC2OUTSEL_TVE (0x03 << 2)
  366. #define MGA1064_DISP_CTL_PANOUTSEL_MASK (0x03 << 5)
  367. #define MGA1064_DISP_CTL_PANOUTSEL_DIS 0x00
  368. #define MGA1064_DISP_CTL_PANOUTSEL_CRTC1 (0x01 << 5)
  369. #define MGA1064_DISP_CTL_PANOUTSEL_CRTC2RGB (0x02 << 5)
  370. #define MGA1064_DISP_CTL_PANOUTSEL_CRTC2656 (0x03 << 5)
  371. #define MGA1064_SYNC_CTL 0x8b
  372. #define MGA1064_PWR_CTL 0xa0
  373. #define MGA1064_PWR_CTL_DAC2_EN (0x01 << 0)
  374. #define MGA1064_PWR_CTL_VID_PLL_EN (0x01 << 1)
  375. #define MGA1064_PWR_CTL_PANEL_EN (0x01 << 2)
  376. #define MGA1064_PWR_CTL_RFIFO_EN (0x01 << 3)
  377. #define MGA1064_PWR_CTL_CFIFO_EN (0x01 << 4)
  378. #define MGA1064_PAN_CTL 0xa2
  379. /* Using crtc2 */
  380. #define MGAREG2_C2CTL 0x10
  381. #define MGAREG2_C2HPARAM 0x14
  382. #define MGAREG2_C2HSYNC 0x18
  383. #define MGAREG2_C2VPARAM 0x1c
  384. #define MGAREG2_C2VSYNC 0x20
  385. #define MGAREG2_C2STARTADD0 0x28
  386. #define MGAREG2_C2OFFSET 0x40
  387. #define MGAREG2_C2DATACTL 0x4c
  388. #define MGAREG_C2CTL 0x3c10
  389. #define MGAREG_C2CTL_C2_EN 0x01
  390. #define MGAREG_C2_HIPRILVL_M (0x07 << 4)
  391. #define MGAREG_C2_MAXHIPRI_M (0x07 << 8)
  392. #define MGAREG_C2CTL_PIXCLKSEL_MASK (0x03 << 1)
  393. #define MGAREG_C2CTL_PIXCLKSELH_MASK (0x01 << 14)
  394. #define MGAREG_C2CTL_PIXCLKSEL_PCICLK 0x00
  395. #define MGAREG_C2CTL_PIXCLKSEL_VDOCLK (0x01 << 1)
  396. #define MGAREG_C2CTL_PIXCLKSEL_PIXELPLL (0x02 << 1)
  397. #define MGAREG_C2CTL_PIXCLKSEL_VIDEOPLL (0x03 << 1)
  398. #define MGAREG_C2CTL_PIXCLKSEL_VDCLK (0x01 << 14)
  399. #define MGAREG_C2CTL_PIXCLKSEL_CRISTAL (0x01 << 1) | (0x01 << 14)
  400. #define MGAREG_C2CTL_PIXCLKSEL_SYSTEMPLL (0x02 << 1) | (0x01 << 14)
  401. #define MGAREG_C2CTL_PIXCLKDIS_MASK (0x01 << 3)
  402. #define MGAREG_C2CTL_PIXCLKDIS_DISABLE (0x01 << 3)
  403. #define MGAREG_C2CTL_CRTCDACSEL_MASK (0x01 << 20)
  404. #define MGAREG_C2CTL_CRTCDACSEL_CRTC1 0x00
  405. #define MGAREG_C2CTL_CRTCDACSEL_CRTC2 (0x01 << 20)
  406. #define MGAREG_C2HPARAM 0x3c14
  407. #define MGAREG_C2HSYNC 0x3c18
  408. #define MGAREG_C2VPARAM 0x3c1c
  409. #define MGAREG_C2VSYNC 0x3c20
  410. #define MGAREG_C2STARTADD0 0x3c28
  411. #define MGAREG_C2OFFSET 0x3c40
  412. #define MGAREG_C2DATACTL 0x3c4c
  413. /* video register */
  414. #define MGAREG_BESA1C3ORG 0x3d60
  415. #define MGAREG_BESA1CORG 0x3d10
  416. #define MGAREG_BESA1ORG 0x3d00
  417. #define MGAREG_BESCTL 0x3d20
  418. #define MGAREG_BESGLOBCTL 0x3dc0
  419. #define MGAREG_BESHCOORD 0x3d28
  420. #define MGAREG_BESHISCAL 0x3d30
  421. #define MGAREG_BESHSRCEND 0x3d3c
  422. #define MGAREG_BESHSRCLST 0x3d50
  423. #define MGAREG_BESHSRCST 0x3d38
  424. #define MGAREG_BESLUMACTL 0x3d40
  425. #define MGAREG_BESPITCH 0x3d24
  426. #define MGAREG_BESV1SRCLST 0x3d54
  427. #define MGAREG_BESV1WGHT 0x3d48
  428. #define MGAREG_BESVCOORD 0x3d2c
  429. #define MGAREG_BESVISCAL 0x3d34
  430. /* texture engine registers */
  431. #define MGAREG_TMR0 0x2c00
  432. #define MGAREG_TMR1 0x2c04
  433. #define MGAREG_TMR2 0x2c08
  434. #define MGAREG_TMR3 0x2c0c
  435. #define MGAREG_TMR4 0x2c10
  436. #define MGAREG_TMR5 0x2c14
  437. #define MGAREG_TMR6 0x2c18
  438. #define MGAREG_TMR7 0x2c1c
  439. #define MGAREG_TMR8 0x2c20
  440. #define MGAREG_TEXORG 0x2c24
  441. #define MGAREG_TEXWIDTH 0x2c28
  442. #define MGAREG_TEXHEIGHT 0x2c2c
  443. #define MGAREG_TEXCTL 0x2c30
  444. # define MGA_TW4 (0x00000000)
  445. # define MGA_TW8 (0x00000001)
  446. # define MGA_TW15 (0x00000002)
  447. # define MGA_TW16 (0x00000003)
  448. # define MGA_TW12 (0x00000004)
  449. # define MGA_TW32 (0x00000006)
  450. # define MGA_TW8A (0x00000007)
  451. # define MGA_TW8AL (0x00000008)
  452. # define MGA_TW422 (0x0000000A)
  453. # define MGA_TW422UYVY (0x0000000B)
  454. # define MGA_PITCHLIN (0x00000100)
  455. # define MGA_NOPERSPECTIVE (0x00200000)
  456. # define MGA_TAKEY (0x02000000)
  457. # define MGA_TAMASK (0x04000000)
  458. # define MGA_CLAMPUV (0x18000000)
  459. # define MGA_TEXMODULATE (0x20000000)
  460. #define MGAREG_TEXCTL2 0x2c3c
  461. # define MGA_G400_TC2_MAGIC (0x00008000)
  462. # define MGA_TC2_DECALBLEND (0x00000001)
  463. # define MGA_TC2_IDECAL (0x00000002)
  464. # define MGA_TC2_DECALDIS (0x00000004)
  465. # define MGA_TC2_CKSTRANSDIS (0x00000010)
  466. # define MGA_TC2_BORDEREN (0x00000020)
  467. # define MGA_TC2_SPECEN (0x00000040)
  468. # define MGA_TC2_DUALTEX (0x00000080)
  469. # define MGA_TC2_TABLEFOG (0x00000100)
  470. # define MGA_TC2_BUMPMAP (0x00000200)
  471. # define MGA_TC2_SELECT_TMU1 (0x80000000)
  472. #define MGAREG_TEXTRANS 0x2c34
  473. #define MGAREG_TEXTRANSHIGH 0x2c38
  474. #define MGAREG_TEXFILTER 0x2c58
  475. # define MGA_MIN_NRST (0x00000000)
  476. # define MGA_MIN_BILIN (0x00000002)
  477. # define MGA_MIN_ANISO (0x0000000D)
  478. # define MGA_MAG_NRST (0x00000000)
  479. # define MGA_MAG_BILIN (0x00000020)
  480. # define MGA_FILTERALPHA (0x00100000)
  481. #define MGAREG_ALPHASTART 0x2c70
  482. #define MGAREG_ALPHAXINC 0x2c74
  483. #define MGAREG_ALPHAYINC 0x2c78
  484. #define MGAREG_ALPHACTRL 0x2c7c
  485. # define MGA_SRC_ZERO (0x00000000)
  486. # define MGA_SRC_ONE (0x00000001)
  487. # define MGA_SRC_DST_COLOR (0x00000002)
  488. # define MGA_SRC_ONE_MINUS_DST_COLOR (0x00000003)
  489. # define MGA_SRC_ALPHA (0x00000004)
  490. # define MGA_SRC_ONE_MINUS_SRC_ALPHA (0x00000005)
  491. # define MGA_SRC_DST_ALPHA (0x00000006)
  492. # define MGA_SRC_ONE_MINUS_DST_ALPHA (0x00000007)
  493. # define MGA_SRC_SRC_ALPHA_SATURATE (0x00000008)
  494. # define MGA_SRC_BLEND_MASK (0x0000000f)
  495. # define MGA_DST_ZERO (0x00000000)
  496. # define MGA_DST_ONE (0x00000010)
  497. # define MGA_DST_SRC_COLOR (0x00000020)
  498. # define MGA_DST_ONE_MINUS_SRC_COLOR (0x00000030)
  499. # define MGA_DST_SRC_ALPHA (0x00000040)
  500. # define MGA_DST_ONE_MINUS_SRC_ALPHA (0x00000050)
  501. # define MGA_DST_DST_ALPHA (0x00000060)
  502. # define MGA_DST_ONE_MINUS_DST_ALPHA (0x00000070)
  503. # define MGA_DST_BLEND_MASK (0x00000070)
  504. # define MGA_ALPHACHANNEL (0x00000100)
  505. # define MGA_VIDEOALPHA (0x00000200)
  506. # define MGA_DIFFUSEDALPHA (0x01000000)
  507. # define MGA_MODULATEDALPHA (0x02000000)
  508. #define MGAREG_TDUALSTAGE0 (0x2CF8)
  509. #define MGAREG_TDUALSTAGE1 (0x2CFC)
  510. # define MGA_TDS_COLOR_ARG2_DIFFUSE (0x00000000)
  511. # define MGA_TDS_COLOR_ARG2_SPECULAR (0x00000001)
  512. # define MGA_TDS_COLOR_ARG2_FCOL (0x00000002)
  513. # define MGA_TDS_COLOR_ARG2_PREVSTAGE (0x00000003)
  514. # define MGA_TDS_COLOR_ALPHA_DIFFUSE (0x00000000)
  515. # define MGA_TDS_COLOR_ALPHA_FCOL (0x00000004)
  516. # define MGA_TDS_COLOR_ALPHA_CURRTEX (0x00000008)
  517. # define MGA_TDS_COLOR_ALPHA_PREVTEX (0x0000000c)
  518. # define MGA_TDS_COLOR_ALPHA_PREVSTAGE (0x00000010)
  519. # define MGA_TDS_COLOR_ARG1_REPLICATEALPHA (0x00000020)
  520. # define MGA_TDS_COLOR_ARG1_INV (0x00000040)
  521. # define MGA_TDS_COLOR_ARG2_REPLICATEALPHA (0x00000080)
  522. # define MGA_TDS_COLOR_ARG2_INV (0x00000100)
  523. # define MGA_TDS_COLOR_ALPHA1INV (0x00000200)
  524. # define MGA_TDS_COLOR_ALPHA2INV (0x00000400)
  525. # define MGA_TDS_COLOR_ARG1MUL_ALPHA1 (0x00000800)
  526. # define MGA_TDS_COLOR_ARG2MUL_ALPHA2 (0x00001000)
  527. # define MGA_TDS_COLOR_ARG1ADD_MULOUT (0x00002000)
  528. # define MGA_TDS_COLOR_ARG2ADD_MULOUT (0x00004000)
  529. # define MGA_TDS_COLOR_MODBRIGHT_2X (0x00008000)
  530. # define MGA_TDS_COLOR_MODBRIGHT_4X (0x00010000)
  531. # define MGA_TDS_COLOR_ADD_SUB (0x00000000)
  532. # define MGA_TDS_COLOR_ADD_ADD (0x00020000)
  533. # define MGA_TDS_COLOR_ADD2X (0x00040000)
  534. # define MGA_TDS_COLOR_ADDBIAS (0x00080000)
  535. # define MGA_TDS_COLOR_BLEND (0x00100000)
  536. # define MGA_TDS_COLOR_SEL_ARG1 (0x00000000)
  537. # define MGA_TDS_COLOR_SEL_ARG2 (0x00200000)
  538. # define MGA_TDS_COLOR_SEL_ADD (0x00400000)
  539. # define MGA_TDS_COLOR_SEL_MUL (0x00600000)
  540. # define MGA_TDS_ALPHA_ARG1_INV (0x00800000)
  541. # define MGA_TDS_ALPHA_ARG2_DIFFUSE (0x00000000)
  542. # define MGA_TDS_ALPHA_ARG2_FCOL (0x01000000)
  543. # define MGA_TDS_ALPHA_ARG2_PREVTEX (0x02000000)
  544. # define MGA_TDS_ALPHA_ARG2_PREVSTAGE (0x03000000)
  545. # define MGA_TDS_ALPHA_ARG2_INV (0x04000000)
  546. # define MGA_TDS_ALPHA_ADD (0x08000000)
  547. # define MGA_TDS_ALPHA_ADDBIAS (0x10000000)
  548. # define MGA_TDS_ALPHA_ADD2X (0x20000000)
  549. # define MGA_TDS_ALPHA_SEL_ARG1 (0x00000000)
  550. # define MGA_TDS_ALPHA_SEL_ARG2 (0x40000000)
  551. # define MGA_TDS_ALPHA_SEL_ADD (0x80000000)
  552. # define MGA_TDS_ALPHA_SEL_MUL (0xc0000000)
  553. #define MGAREG_DWGSYNC 0x2c4c
  554. #define MGAREG_AGP_PLL 0x1e4c
  555. #define MGA_AGP2XPLL_ENABLE 0x1
  556. #define MGA_AGP2XPLL_DISABLE 0x0
  557. #endif