mgag200_reg.h 23 KB

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