mgag200_reg.h 22 KB

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