Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

939 lines
32 KiB

  1. //*************************************************************************
  2. //** **
  3. //** AMACHCX.H **
  4. //** **
  5. //** Copyright (c) 1993, ATI Technologies Inc. **
  6. //*************************************************************************
  7. //
  8. // Created from the CH0.H 68800CX header file to get CX and standard
  9. // register definitions in the same format.
  10. //
  11. // Created from the 68800.H and 68801.H in the Windows NT Group
  12. // as a simple merging of the files so ALL Mach8 and Mach32 defines
  13. // are located in one H file.
  14. //
  15. // Created the 68800.inc file which includes equates, macros, etc
  16. // from the following include files:
  17. // 8514vesa.inc, vga1regs.inc, m32regs.inc, 8514.inc
  18. //
  19. // supplement Defines and values to the 68800 Family.
  20. //
  21. // This is a "C" only file and is NOT derived from any Assembler INC files.
  22. /********************** PolyTron RCS Utilities
  23. $Revision: 1.17 $
  24. $Date: 15 Apr 1996 16:57:28 $
  25. $Author: RWolff $
  26. $Log: S:/source/wnt/ms11/miniport/archive/amachcx.h_v $
  27. *
  28. * Rev 1.17 15 Apr 1996 16:57:28 RWolff
  29. * Added definitions for various revisions of the GX and CX ASICs
  30. *
  31. * Rev 1.16 01 Mar 1996 12:09:48 RWolff
  32. * VGA Graphics Index and Graphics Data are now handled as separate
  33. * registers rather than as offsets into the block of VGA registers.
  34. *
  35. * Rev 1.15 22 Sep 1995 16:47:08 RWolff
  36. * Added definitions for AL values of accelerator BIOS functions to
  37. * allow switching on the low byte of the function.
  38. *
  39. * Rev 1.14 24 Aug 1995 15:41:12 RWolff
  40. * Changed detection of block I/O cards to match Microsoft's
  41. * standard for plug-and-play.
  42. *
  43. * Rev 1.13 24 Feb 1995 12:28:36 RWOLFF
  44. * Added definitions used for relocatable I/O and 24BPP text banding
  45. *
  46. * Rev 1.12 20 Feb 1995 18:00:34 RWOLFF
  47. * Added definition for GX rev. E ASIC.
  48. *
  49. * Rev 1.11 23 Dec 1994 10:48:02 ASHANMUG
  50. * ALPHA/Chrontel-DAC
  51. *
  52. * Rev 1.10 18 Nov 1994 11:52:12 RWOLFF
  53. * Register name change to CLOCK_CNTL to match latest documents, added
  54. * some new bitfield definitions for registers.
  55. *
  56. * Rev 1.9 14 Sep 1994 15:20:58 RWOLFF
  57. * Added definitions for all 32BPP colour orderings.
  58. *
  59. * Rev 1.8 31 Aug 1994 16:11:08 RWOLFF
  60. * Removed VGA_SLEEP from enumeration of registers used on Mach 64
  61. * (we don't access it, and it conflicts with DigiBoard), added
  62. * support for BGRx in 32BPP (used by TVP3026 DAC).
  63. *
  64. * Rev 1.7 20 Jul 1994 12:59:38 RWOLFF
  65. * Added support for multiple I/O base addresses for accelerator registers.
  66. *
  67. * Rev 1.6 12 May 1994 11:21:22 RWOLFF
  68. * Added masks for pitch and pixel depth fields of ECX for BIOS_LOAD_CRTC
  69. * call.
  70. *
  71. * Rev 1.5 05 May 1994 13:40:40 RWOLFF
  72. * Added definitions for chip identification register fields.
  73. *
  74. * Rev 1.4 04 May 1994 10:58:48 RWOLFF
  75. * Added definitions for MEM_SIZE field in MEM_CNTL register.
  76. *
  77. * Rev 1.3 27 Apr 1994 13:57:28 RWOLFF
  78. * Added definitions for offsets of graphics index and graphics data
  79. * registers from start of block of VGA registers.
  80. *
  81. * Rev 1.2 14 Mar 1994 16:31:58 RWOLFF
  82. * Added offset and pitch masks for SRC_OFF_PITCH register.
  83. *
  84. * Rev 1.1 03 Mar 1994 12:36:40 ASHANMUG
  85. * Correct GAMMA bit
  86. *
  87. * Rev 1.0 31 Jan 1994 11:26:34 RWOLFF
  88. * Initial revision.
  89. *
  90. * Rev 1.4 24 Jan 1994 18:00:52 RWOLFF
  91. * Added new definitions for fields introduced in 94/01/19 BIOS document.
  92. *
  93. * Rev 1.3 14 Jan 1994 15:17:18 RWOLFF
  94. * Added definition for bit in GEN_TEST_CNTL to enable block write,
  95. * BIOS function codes now take AH value from a single definition
  96. * to allow single-point change of all codes, updated function codes
  97. * to match BIOS version 0.13.
  98. *
  99. * Rev 1.2 30 Nov 1993 18:09:14 RWOLFF
  100. * Fixed enumeration of register names, added definitions for more fields in
  101. * more registers, removed redundant definitions.
  102. *
  103. * Rev 1.1 05 Nov 1993 13:21:24 RWOLFF
  104. * Defined and enumerated values now use same naming conventions as AMACH.H
  105. *
  106. * Rev 1.0 03 Sep 1993 14:26:46 RWOLFF
  107. * Initial revision.
  108. End of PolyTron RCS section *****************/
  109. #define REVISION 0x0002 // No one should use this
  110. /*
  111. * Offsets from start of linear aperture to start of memory-mapped
  112. * registers on 4M and 8M cards, and offset from start of address
  113. * space to start of memory-mapped registers when VGA is enabled.
  114. */
  115. #define OFFSET_4M 0x3FFC00
  116. #define OFFSET_8M 0x7FFC00
  117. #define OFFSET_VGA 0x0BFC00
  118. /*
  119. * Base addresses for Mach 64 accelerator registers.
  120. */
  121. #define M64_STD_BASE_ADDR 0x02EC
  122. #define M64_ALT_BASE_ADDR_1 0x01C8
  123. #define M64_ALT_BASE_ADDR_2 0x01CC
  124. #define NUM_BASE_ADDRESSES 3
  125. /*
  126. * CRTC I/O registers. Only the variable portion
  127. * of the register is given here. To get the full
  128. * register, add the base address.
  129. */
  130. #define IO_CRTC_H_TOTAL_DISP 0x0000
  131. #define IO_CRTC_H_SYNC_STRT_WID 0x0400
  132. #define IO_CRTC_V_TOTAL_DISP 0x0800
  133. #define IO_CRTC_V_SYNC_STRT_WID 0x0C00
  134. #define IO_CRTC_CRNT_VLINE 0x1000
  135. #define IO_CRTC_OFF_PITCH 0x1400
  136. #define IO_CRTC_INT_CNTL 0x1800
  137. #define IO_CRTC_GEN_CNTL 0x1C00
  138. #define IO_OVR_CLR 0x2000
  139. #define IO_OVR_WID_LEFT_RIGHT 0x2400
  140. #define IO_OVR_WID_TOP_BOTTOM 0x2800
  141. #define IO_CUR_CLR0 0x2C00
  142. #define IO_CUR_CLR1 0x3000
  143. #define IO_CUR_OFFSET 0x3400
  144. #define IO_CUR_HORZ_VERT_POSN 0x3800
  145. #define IO_CUR_HORZ_VERT_OFF 0x3C00
  146. #define IO_SCRATCH_REG0 0x4000
  147. #define IO_SCRATCH_REG1 0x4400
  148. #define IO_CLOCK_CNTL 0x4800
  149. #define IO_BUS_CNTL 0x4C00
  150. #define IO_MEM_CNTL 0x5000
  151. #define IO_MEM_VGA_WP_SEL 0x5400
  152. #define IO_MEM_VGA_RP_SEL 0x5800
  153. #define IO_DAC_REGS 0x5C00
  154. #define IO_DAC_CNTL 0x6000
  155. #define IO_GEN_TEST_CNTL 0x6400
  156. #define IO_CONFIG_CNTL 0x6800
  157. #define IO_CONFIG_CHIP_ID 0x6C00
  158. #define IO_CONFIG_STAT0 0x7000
  159. #define IO_CONFIG_STAT1 0x7400
  160. // CRTC MEM Registers
  161. #define MM_CRTC_H_TOTAL_DISP 0x0000
  162. #define MM_CRTC_H_SYNC_STRT_WID 0x0001
  163. #define MM_CRTC_V_TOTAL_DISP 0x0002
  164. #define MM_CRTC_V_SYNC_STRT_WID 0x0003
  165. #define MM_CRTC_CRNT_VLINE 0x0004
  166. #define MM_CRTC_OFF_PITCH 0x0005
  167. #define MM_CRTC_INT_CNTL 0x0006
  168. #define MM_CRTC_GEN_CNTL 0x0007
  169. #define MM_OVR_CLR 0x0010
  170. #define MM_OVR_WID_LEFT_RIGHT 0x0011
  171. #define MM_OVR_WID_TOP_BOTTOM 0x0012
  172. #define MM_CUR_CLR0 0x0018
  173. #define MM_CUR_CLR1 0x0019
  174. #define MM_CUR_OFFSET 0x001A
  175. #define MM_CUR_HORZ_VERT_POSN 0x001B
  176. #define MM_CUR_HORZ_VERT_OFF 0x001C
  177. #define MM_SCRATCH_REG0 0x0020
  178. #define MM_SCRATCH_REG1 0x0021
  179. #define MM_CLOCK_CNTL 0x0024
  180. #define MM_BUS_CNTL 0x0028
  181. #define MM_MEM_CNTL 0x002C
  182. #define MM_MEM_VGA_WP_SEL 0x002D
  183. #define MM_MEM_VGA_RP_SEL 0x002E
  184. #define MM_DAC_REGS 0x0030
  185. #define MM_DAC_CNTL 0x0031
  186. #define MM_GEN_TEST_CNTL 0x0034
  187. /*
  188. * This register does not exist in memory-mapped form,
  189. * but on cards with relocatable I/O, the I/O index of
  190. * each register matches its memory-mapped index. This
  191. * register was assigned an otherwise unused index for
  192. * this purpose.
  193. */
  194. #define MM_CONFIG_CNTL 0x0037
  195. #define MM_CONFIG_CHIP_ID 0x0038
  196. #define MM_CONFIG_STAT0 0x0039
  197. #define MM_CONFIG_STAT1 0x003A
  198. #define MM_DST_OFF_PITCH 0x0040
  199. #define MM_DST_X 0x0041
  200. #define MM_DST_Y 0x0042
  201. #define MM_DST_Y_X 0x0043
  202. #define MM_DST_WIDTH 0x0044
  203. #define MM_DST_HEIGHT 0x0045
  204. #define MM_DST_HEIGHT_WIDTH 0x0046
  205. #define MM_DST_X_WIDTH 0x0047
  206. #define MM_DST_BRES_LNTH 0x0048
  207. #define MM_DST_BRES_ERR 0x0049
  208. #define MM_DST_BRES_INC 0x004A
  209. #define MM_DST_BRES_DEC 0x004B
  210. #define MM_DST_CNTL 0x004C
  211. #define MM_SRC_OFF_PITCH 0x0060
  212. #define MM_SRC_X 0x0061
  213. #define MM_SRC_Y 0x0062
  214. #define MM_SRC_Y_X 0x0063
  215. #define MM_SRC_WIDTH1 0x0064
  216. #define MM_SRC_HEIGHT1 0x0065
  217. #define MM_SRC_HEIGHT1_WIDTH1 0x0066
  218. #define MM_SRC_X_START 0x0067
  219. #define MM_SRC_Y_START 0x0068
  220. #define MM_SRC_Y_X_START 0x0069
  221. #define MM_SRC_WIDTH2 0x006A
  222. #define MM_SRC_HEIGHT2 0x006B
  223. #define MM_SRC_HEIGHT2_WIDTH2 0x006C
  224. #define MM_SRC_CNTL 0x006D
  225. #define MM_HOST_DATA0 0x0080
  226. #define MM_HOST_DATA1 0x0081
  227. #define MM_HOST_DATA2 0x0082
  228. #define MM_HOST_DATA3 0x0083
  229. #define MM_HOST_DATA4 0x0084
  230. #define MM_HOST_DATA5 0x0085
  231. #define MM_HOST_DATA6 0x0086
  232. #define MM_HOST_DATA7 0x0087
  233. #define MM_HOST_DATA8 0x0088
  234. #define MM_HOST_DATA9 0x0089
  235. #define MM_HOST_DATA10 0x008A
  236. #define MM_HOST_DATA11 0x008B
  237. #define MM_HOST_DATA12 0x008C
  238. #define MM_HOST_DATA13 0x008D
  239. #define MM_HOST_DATA14 0x008E
  240. #define MM_HOST_DATA15 0x008F
  241. #define MM_HOST_CNTL 0x0090
  242. #define MM_PAT_REG0 0x00A0
  243. #define MM_PAT_REG1 0x00A1
  244. #define MM_PAT_CNTL 0x00A2
  245. #define MM_SC_LEFT 0x00A8
  246. #define MM_SC_RIGHT 0x00A9
  247. #define MM_SC_LEFT_RIGHT 0x00AA
  248. #define MM_SC_TOP 0x00AB
  249. #define MM_SC_BOTTOM 0x00AC
  250. #define MM_SC_TOP_BOTTOM 0x00AD
  251. #define MM_DP_BKGD_CLR 0x00B0
  252. #define MM_DP_FRGD_CLR 0x00B1
  253. #define MM_DP_WRITE_MASK 0x00B2
  254. #define MM_DP_CHAIN_MASK 0x00B3
  255. #define MM_DP_PIX_WIDTH 0x00B4
  256. #define MM_DP_MIX 0x00B5
  257. #define MM_DP_SRC 0x00B6
  258. #define MM_CLR_CMP_CLR 0x00C0
  259. #define MM_CLR_CMP_MSK 0x00C1
  260. #define MM_CLR_CMP_CNTL 0x00C2
  261. #define MM_FIFO_STAT 0x00C4
  262. #define MM_CONTEXT_MASK 0x00C8
  263. #define MM_CONTEXT_SAVE_CNTL 0x00CA
  264. #define MM_CONTEXT_LOAD_CNTL 0x00CB
  265. #define MM_GUI_TRAJ_CNTL 0x00CC
  266. #define MM_GUI_STAT 0x00CE
  267. /*
  268. * VGAWonder-compatible registers (all in I/O space).
  269. */
  270. #define IO_VGA_SLEEP 0x0102
  271. #define IO_VGA_BASE_IO_PORT 0x03B0
  272. #define IO_VGA_START_BREAK_PORT 0x03BB
  273. #define IO_VGA_END_BREAK_PORT 0x03C0
  274. #define IO_VGA_MAX_IO_PORT 0x03DF
  275. /*
  276. * VGA Sequencer index/data registers (most frequently used
  277. * of VGAWonder-compatible registers).
  278. */
  279. #define IO_VGA_SEQ_IND 0x03C4
  280. #define IO_VGA_SEQ_DATA 0x03C5
  281. /*
  282. * VGA Graphics index/data registers (another frequently used
  283. * VGA register pair)
  284. */
  285. #define IO_VGA_GRAX_IND 0x03CE
  286. #define IO_VGA_GRAX_DATA 0x03CF
  287. /*
  288. * ATI extended registers
  289. */
  290. #define IO_reg1CE 0x01CE
  291. #define IO_reg1CF 0x01CF
  292. /*
  293. * Define the registers as subscripts to an array
  294. */
  295. enum {
  296. VGA_BASE_IO_PORT=0 ,
  297. VGA_END_BREAK_PORT ,
  298. VGA_SEQ_IND ,
  299. VGA_SEQ_DATA ,
  300. VGA_GRAX_IND ,
  301. VGA_GRAX_DATA ,
  302. reg1CE ,
  303. reg1CF ,
  304. CRTC_H_TOTAL_DISP ,
  305. CRTC_H_SYNC_STRT_WID ,
  306. CRTC_V_TOTAL_DISP ,
  307. CRTC_V_SYNC_STRT_WID ,
  308. CRTC_CRNT_VLINE ,
  309. CRTC_OFF_PITCH ,
  310. CRTC_INT_CNTL ,
  311. CRTC_GEN_CNTL ,
  312. OVR_CLR ,
  313. OVR_WID_LEFT_RIGHT ,
  314. OVR_WID_TOP_BOTTOM ,
  315. CUR_CLR0 ,
  316. CUR_CLR1 ,
  317. CUR_OFFSET ,
  318. CUR_HORZ_VERT_POSN ,
  319. CUR_HORZ_VERT_OFF ,
  320. SCRATCH_REG0 ,
  321. SCRATCH_REG1 ,
  322. CLOCK_CNTL ,
  323. BUS_CNTL ,
  324. MEM_CNTL ,
  325. MEM_VGA_WP_SEL ,
  326. MEM_VGA_RP_SEL ,
  327. DAC_REGS ,
  328. DAC_CNTL ,
  329. GEN_TEST_CNTL ,
  330. CONFIG_CNTL ,
  331. CONFIG_CHIP_ID ,
  332. CONFIG_STAT0 ,
  333. CONFIG_STAT1 ,
  334. DST_OFF_PITCH ,
  335. DST_X ,
  336. DST_Y ,
  337. DST_Y_X ,
  338. DST_WIDTH ,
  339. DST_HEIGHT ,
  340. DST_HEIGHT_WIDTH ,
  341. DST_X_WIDTH ,
  342. DST_BRES_LNTH ,
  343. DST_BRES_ERR ,
  344. DST_BRES_INC ,
  345. DST_BRES_DEC ,
  346. DST_CNTL ,
  347. SRC_OFF_PITCH ,
  348. SRC_X ,
  349. SRC_Y ,
  350. SRC_Y_X ,
  351. SRC_WIDTH1 ,
  352. SRC_HEIGHT1 ,
  353. SRC_HEIGHT1_WIDTH1 ,
  354. SRC_X_START ,
  355. SRC_Y_START ,
  356. SRC_Y_X_START ,
  357. SRC_WIDTH2 ,
  358. SRC_HEIGHT2 ,
  359. SRC_HEIGHT2_WIDTH2 ,
  360. SRC_CNTL ,
  361. HOST_DATA0 ,
  362. HOST_DATA1 ,
  363. HOST_DATA2 ,
  364. HOST_DATA3 ,
  365. HOST_DATA4 ,
  366. HOST_DATA5 ,
  367. HOST_DATA6 ,
  368. HOST_DATA7 ,
  369. HOST_DATA8 ,
  370. HOST_DATA9 ,
  371. HOST_DATA10 ,
  372. HOST_DATA11 ,
  373. HOST_DATA12 ,
  374. HOST_DATA13 ,
  375. HOST_DATA14 ,
  376. HOST_DATA15 ,
  377. HOST_CNTL ,
  378. PAT_REG0 ,
  379. PAT_REG1 ,
  380. PAT_CNTL ,
  381. SC_LEFT ,
  382. SC_RIGHT ,
  383. SC_LEFT_RIGHT ,
  384. SC_TOP ,
  385. SC_BOTTOM ,
  386. SC_TOP_BOTTOM ,
  387. DP_BKGD_CLR ,
  388. DP_FRGD_CLR ,
  389. DP_WRITE_MASK ,
  390. DP_CHAIN_MASK ,
  391. DP_PIX_WIDTH ,
  392. DP_MIX ,
  393. DP_SRC ,
  394. CLR_CMP_CLR ,
  395. CLR_CMP_MSK ,
  396. CLR_CMP_CNTL ,
  397. FIFO_STAT ,
  398. CONTEXT_MASK ,
  399. CONTEXT_SAVE_CNTL ,
  400. CONTEXT_LOAD_CNTL ,
  401. GUI_TRAJ_CNTL ,
  402. GUI_STAT
  403. };
  404. /*
  405. * Bit fields used in the registers.
  406. *
  407. * CRT Offset and Pitch
  408. */
  409. #define CRTC_OFF_PITCH_Offset 0x000FFFFF
  410. #define CRTC_OFF_PITCH_Pitch 0xFFC00000
  411. /*
  412. * CRT General Control
  413. */
  414. #define CRTC_GEN_CNTL_DblScan 0x00000001
  415. #define CRTC_GEN_CNTL_Interlace 0x00000002
  416. #define CRTC_GEN_CNTL_HSynDisab 0x00000004
  417. #define CRTC_GEN_CNTL_VSynDisab 0x00000008
  418. #define CRTC_GEN_CNTL_CompSync 0x00000010
  419. #define CRTC_GEN_CNTL_MuxMode 0x00000020
  420. #define CRTC_GEN_CNTL_DispDisab 0x00000040
  421. #define CRTC_GEN_CNTL_DepthMask 0x00000700
  422. #define CRTC_GEN_CNTL_Dep4 0x00000100
  423. #define CRTC_GEN_CNTL_Dep8 0x00000200
  424. #define CRTC_GEN_CNTL_Dep15_555 0x00000300
  425. #define CRTC_GEN_CNTL_Dep16_565 0x00000400
  426. #define CRTC_GEN_CNTL_Dep24 0x00000500
  427. #define CRTC_GEN_CNTL_Dep32 0x00000600
  428. #define CRTC_GEN_CNTL_ShowVga 0x00000000
  429. #define CRTC_GEN_CNTL_ShowAcc 0x01000000
  430. #define CRTC_GEN_CNTL_CrtcEna 0x02000000
  431. /*
  432. * Clock control
  433. */
  434. #define CLOCK_CNTL_ClockStrobe 0x00000040
  435. /*
  436. * Memory Control
  437. */
  438. #define MEM_CNTL_MemSizeMsk 0x00000007
  439. #define MEM_CNTL_MemSize512k 0x00000000
  440. #define MEM_CNTL_MemSize1Mb 0x00000001
  441. #define MEM_CNTL_MemSize2Mb 0x00000002
  442. #define MEM_CNTL_MemSize4Mb 0x00000003
  443. #define MEM_CNTL_MemSize6Mb 0x00000004
  444. #define MEM_CNTL_MemSize8Mb 0x00000005
  445. #define MEM_CNTL_MemBndryMsk 0x00070000
  446. #define MEM_CNTL_MemBndryEn 0x00040000
  447. #define MEM_CNTL_MemBndry0k 0x00000000
  448. #define MEM_CNTL_MemBndry256k 0x00010000
  449. #define MEM_CNTL_MemBndry512k 0x00020000
  450. #define MEM_CNTL_MemBndry1Mb 0x00030000
  451. /*
  452. * DAC control
  453. */
  454. #define DAC_CNTL_ExtSelMask 0x00000003
  455. #define DAC_CNTL_ExtSelStrip ~DAC_CNTL_ExtSelMask
  456. #define DAC_CNTL_ExtSelRS2 0x00000001
  457. #define DAC_CNTL_ExtSelRS3 0x00000002
  458. #define DAC_CNTL_VgaAddrEna 0x00002000
  459. /*
  460. * General and Test control
  461. */
  462. #define GEN_TEST_CNTL_CursorEna 0x00000080
  463. #define GEN_TEST_CNTL_GuiEna 0x00000100
  464. #define GEN_TEST_CNTL_BlkWrtEna 0x00000200
  465. #define GEN_TEST_CNTL_GuiRegEna 0x00020000
  466. #define GEN_TEST_CNTL_TestMode 0x00700000
  467. #define GEN_TEST_CNTL_TestMode0 0x00000000
  468. #define GEN_TEST_CNTL_TestMode1 0x00100000
  469. #define GEN_TEST_CNTL_TestMode2 0x00200000
  470. #define GEN_TEST_CNTL_TestMode3 0x00300000
  471. #define GEN_TEST_CNTL_TestMode4 0x00400000
  472. #define GEN_TEST_CNTL_MemWR 0x01000000
  473. #define GEN_TEST_CNTL_MemStrobe 0x02000000
  474. #define GEN_TEST_CNTL_DstSSEna 0x04000000
  475. #define GEN_TEST_CNTL_DstSSStrobe 0x08000000
  476. #define GEN_TEST_CNTL_SrcSSEna 0x10000000
  477. #define GEN_TEST_CNTL_SrcSSStrobe 0x20000000
  478. /*
  479. * Configuration Control
  480. */
  481. #define CONFIG_CNTL_LinApDisab 0x00000000
  482. #define CONFIG_CNTL_LinAp4M 0x00000001
  483. #define CONFIG_CNTL_LinAp8M 0x00000002
  484. #define CONFIG_CNTL_LinApMask 0x00000003
  485. #define CONFIG_CNTL_VgaApDisab 0x00000000
  486. #define CONFIG_CNTL_VgaApEnab 0x00000004
  487. #define CONFIG_CNTL_LinApLocMask 0x00003FF0
  488. #define CONFIG_CNTL_LinApLocShift 4
  489. #define CONFIG_CNTL_CardIDMask 0x00070000
  490. #define CONFIG_CNTL_VgaEnabled 0x00000000
  491. #define CONFIG_CNTL_VgaDisabled 0x00080000
  492. /*
  493. * Chip identification
  494. */
  495. #define CONFIG_CHIP_ID_TypeMask 0x0000FFFF
  496. #define CONFIG_CHIP_ID_ClassMask 0x00FF0000
  497. #define CONFIG_CHIP_ID_RevMask 0xFF000000
  498. #define CONFIG_CHIP_ID_TypeGX 0x000000D7
  499. #define CONFIG_CHIP_ID_TypeCX 0x00000057
  500. #define CONFIG_CHIP_ID_RevC 0x00000000
  501. #define CONFIG_CHIP_ID_RevD 0x01000000
  502. #define CONFIG_CHIP_ID_RevE 0x02000000
  503. #define CONFIG_CHIP_ID_RevF 0x03000000
  504. #define CONFIG_CHIP_ID_GXRevC CONFIG_CHIP_ID_TypeGX | CONFIG_CHIP_ID_RevC
  505. #define CONFIG_CHIP_ID_GXRevD CONFIG_CHIP_ID_TypeGX | CONFIG_CHIP_ID_RevD
  506. #define CONFIG_CHIP_ID_GXRevE CONFIG_CHIP_ID_TypeGX | CONFIG_CHIP_ID_RevE
  507. #define CONFIG_CHIP_ID_GXRevF CONFIG_CHIP_ID_TypeGX | CONFIG_CHIP_ID_RevF
  508. //
  509. // ASIC IDs (upper byte of CONFIG_CHIP_ID)
  510. //
  511. #define ASIC_ID_NEC_VT_A3 0x08000000
  512. #define ASIC_ID_NEC_VT_A4 0x48000000
  513. #define ASIC_ID_SGS_VT_A4 0x40000000
  514. /*
  515. * Configuration status register 0
  516. */
  517. #define CONFIG_STAT0_BusMask 0x00000007
  518. #define CONFIG_STAT0_MemTypeMask 0x00000038
  519. #define CONFIG_STAT0_DRAM256x4 0x00000000
  520. #define CONFIG_STAT0_VRAM256xAny 0x00000008
  521. #define CONFIG_STAT0_VRAM256x16ssr 0x00000010
  522. #define CONFIG_STAT0_DRAM256x16 0x00000018
  523. #define CONFIG_STAT0_GDRAM256x16 0x00000020
  524. #define CONFIG_STAT0_EVRAM256xAny 0x00000028
  525. #define CONFIG_STAT0_EVRAM256x16ssr 0x00000030
  526. #define CONFIG_STAT0_MemTypeShift 3
  527. #define CONFIG_STAT0_DualCasEna 0x00000040
  528. #define CONFIG_STAT0_LocalBusOpt 0x00000180
  529. #define CONFIG_STAT0_DacTypeMask 0x00000E00
  530. #define CONFIG_STAT0_DacTypeShift 9
  531. #define CONFIG_STAT0_CardId 0x00007000
  532. #define CONFIG_STAT0_NoTristate 0x00008000
  533. #define CONFIG_STAT0_ExtRomAddr 0x003F0000
  534. #define CONFIG_STAT0_RomDisab 0x00400000
  535. #define CONFIG_STAT0_VgaEna 0x00800000
  536. #define CONFIG_STAT0_VlbCfg 0x01000000
  537. #define CONFIG_STAT0_ChipEna 0x02000000
  538. #define CONFIG_STAT0_NoReadDelay 0x04000000
  539. #define CONFIG_STAT0_RomOption 0x08000000
  540. #define CONFIG_STAT0_BusOption 0x10000000
  541. #define CONFIG_STAT0_LBDacWriteEna 0x20000000
  542. #define CONFIG_STAT0_VlbRdyDisab 0x40000000
  543. #define CONFIG_STAT0_Ap4GigRange 0x80000000
  544. /*
  545. * Destination width
  546. */
  547. #define DST_WIDTH_Disable 0x80000000
  548. /*
  549. * Destination control
  550. */
  551. #define DST_CNTL_XDir 0x00000001
  552. #define DST_CNTL_YDir 0x00000002
  553. #define DST_CNTL_YMajor 0x00000004
  554. #define DST_CNTL_XTile 0x00000008
  555. #define DST_CNTL_YTile 0x00000010
  556. #define DST_CNTL_LastPel 0x00000020
  557. #define DST_CNTL_PolyEna 0x00000040
  558. #define DST_CNTL_24_RotEna 0x00000080
  559. #define DST_CNTL_24_Rot 0x00000700
  560. /*
  561. * Source offset and pitch
  562. */
  563. #define SRC_OFF_PITCH_Offset 0x000FFFFF
  564. #define SRC_OFF_PITCH_Pitch 0xFFC00000
  565. /*
  566. * Source control
  567. */
  568. #define SRC_CNTL_PatEna 0x0001
  569. #define SRC_CNTL_PatRotEna 0x0002
  570. #define SRC_CNTL_LinearEna 0x0004
  571. #define SRC_CNTL_ByteAlign 0x0008
  572. #define SRC_CNTL_LineXDir 0x0010
  573. /*
  574. * Host control
  575. */
  576. #define HOST_CNTL_ByteAlign 0x0001
  577. /*
  578. * Pattern control
  579. */
  580. #define PAT_CNTL_MonoEna 0x0001
  581. #define PAT_CNTL_Clr4x2Ena 0x0002
  582. #define PAT_CNTL_Clr8x1Ena 0x0004
  583. /*
  584. * Datapath Source selections
  585. */
  586. #define DP_SRC_BkgdClr 0x0000
  587. #define DP_SRC_FrgdClr 0x0001
  588. #define DP_SRC_Host 0x0002
  589. #define DP_SRC_Blit 0x0003
  590. #define DP_SRC_Pattern 0x0004
  591. #define DP_SRC_Always1 0x00000000
  592. #define DP_SRC_MonoPattern 0x00010000
  593. #define DP_SRC_MonoHost 0x00020000
  594. #define DP_SRC_MonoBlit 0x00030000
  595. /*
  596. * Colour Comparison control
  597. */
  598. #define CLR_CMP_CNTL_Source 0x00010000
  599. /*
  600. * Context load and store pointers
  601. */
  602. #define CONTEXT_LOAD_Cmd 0x00030000
  603. #define CONTEXT_LOAD_CmdLoad 0x00010000
  604. #define CONTEXT_LOAD_CmdBlt 0x00020000
  605. #define CONTEXT_LOAD_CmdLine 0x00030000
  606. #define CONTEXT_LOAD_Disable 0x80000000
  607. //---------------------------------------------------------
  608. //---------------------------------------------------------
  609. // Define the ASIC revisions into something Useful
  610. #define MACH32_REV3 0
  611. #define MACH32_REV5 1 // not in production
  612. #define MACH32_REV6 2
  613. #define MACH32_CX 4
  614. //---------------------------------------------------------
  615. // Mix functions
  616. #define MIX_FN_NOT_D 0x0000 //NOT dest
  617. #define MIX_FN_ZERO 0x0001 //dest = 0
  618. #define MIX_FN_ONE 0x0002 //dest = 1
  619. #define MIX_FN_LEAVE_ALONE 0x0003 //dest
  620. #define MIX_FN_NOT_S 0x0004 //NOT source
  621. #define MIX_FN_XOR 0x0005 //source XOR dest
  622. #define MIX_FN_XNOR 0x0006 //source XOR NOT dest
  623. #define MIX_FN_PAINT 0x0007 //source
  624. #define MIX_FN_NAND 0x0008 //NOT source OR NOT dest
  625. #define MIX_FN_D_OR_NOT_S 0x0009 //NOT source OR dest
  626. #define MIX_FN_NOT_D_OR_S 0x000A //source OR NOT dest
  627. #define MIX_FN_OR 0x000B //source OR dest
  628. #define MIX_FN_AND 0x000C //dest AND source
  629. #define MIX_FN_NOT_D_AND_S 0x000D //NOT dest AND source
  630. #define MIX_FN_D_AND_NOT_S 0x000E //dest AND NOT source
  631. #define MIX_FN_NOR 0x000F //NOT dest AND NOT source
  632. #define MIX_FN_AVG 0x0017 // (dest+source)/2
  633. //
  634. //
  635. //---------------------------------------------------------
  636. //
  637. /*
  638. * Values for DP_PIX_WIDTH register
  639. */
  640. #define DP_PIX_WIDTH_Mono 0x00000000
  641. #define DP_PIX_WIDTH_4bpp 0x00000001
  642. #define DP_PIX_WIDTH_8bpp 0x00000002
  643. #define DP_PIX_WIDTH_15bpp 0x00000003
  644. #define DP_PIX_WIDTH_16bpp 0x00000004
  645. #define DP_PIX_WIDTH_32bpp 0x00000006
  646. #define DP_PIX_WIDTH_NibbleSwap 0x01000000
  647. /*
  648. * Values for DP_SRC register
  649. */
  650. #define DP_BKGD_SRC_BG 0x00000000 // Background Color Reg
  651. #define DP_BKGD_SRC_FG 0x00000001 // Foreground Color Reg
  652. #define DP_BKGD_SRC_HOST 0x00000002 // Host data
  653. #define DP_BKGD_SRC_BLIT 0x00000003 // VRAM blit source
  654. #define DP_BKGD_SRC_PATT 0x00000004 // Pattern registers
  655. //
  656. #define DP_FRGD_SRC_BG 0x00000000 // Background Color Register
  657. #define DP_FRGD_SRC_FG 0x00000100 // Foreground Color Register
  658. #define DP_FRGD_SRC_HOST 0x00000200 // Host data
  659. #define DP_FRGD_SRC_BLIT 0x00000300 // VRAM blit source
  660. #define DP_FRGD_SRC_PATT 0x00000400 // Pattern registers
  661. //
  662. #define DP_MONO_SRC_ONE 0x00000000 // Always '1'
  663. #define DP_MONO_SRC_PATT 0x00010000 // Pattern registers
  664. #define DP_MONO_SRC_HOST 0x00020000 // Host data
  665. #define DP_MONO_SRC_BLIT 0x00030000 // Blit source
  666. /*
  667. * Values for FIFO_STAT register
  668. */
  669. #define ONE_WORD 0x00008000 /* One free FIFO entry */
  670. #define TWO_WORDS 0x0000C000
  671. #define THREE_WORDS 0x0000E000
  672. #define FOUR_WORDS 0x0000F000
  673. #define FIVE_WORDS 0x0000F800
  674. #define SIX_WORDS 0x0000FC00
  675. #define SEVEN_WORDS 0x0000FE00
  676. #define EIGHT_WORDS 0x0000FF00
  677. #define NINE_WORDS 0x0000FF80
  678. #define TEN_WORDS 0x0000FFC0
  679. #define ELEVEN_WORDS 0x0000FFE0
  680. #define TWELVE_WORDS 0x0000FFF0
  681. #define THIRTEEN_WORDS 0x0000FFF8
  682. #define FOURTEEN_WORDS 0x0000FFFC
  683. #define FIFTEEN_WORDS 0x0000FFFE
  684. #define SIXTEEN_WORDS 0x0000FFFF /* Sixteen free FIFO entries */
  685. #define FIFO_ERR 0x80000000 /* FIFO overrun error */
  686. /*
  687. * Fields in GUI_TRAJ_CNTL register
  688. */
  689. #define GUI_TRAJ_CNTL_DxtXDir 0x00000001 // 1=left to right
  690. #define GUI_TRAJ_CNTL_DstYDir 0x00000002 // 1=top to bottom
  691. #define GUI_TRAJ_CNTL_DstYMajor 0x00000004 // 1=Y-major line
  692. #define GUI_TRAJ_CNTL_DstXTile 0x00000008 // Enable tiling in X direction
  693. #define GUI_TRAJ_CNTL_DstYTile 0x00000010 // Enable tiling in Y direction
  694. #define GUI_TRAJ_CNTL_DstLastPel 0x00000020 // Draw last pixel
  695. #define GUI_TRAJ_CNTL_DstPolygonEna 0x00000040 // Polygon outline/fill enable
  696. #define GUI_TRAJ_CNTL_SrcPattEna 0x00010000 // Enable pattern source
  697. #define GUI_TRAJ_CNTL_SrcPattRotEna 0x00020000 // Enable pattern source rotation
  698. #define GUI_TRAJ_CNTL_SrcLinearEna 0x00040000 // Source advanced linearly in memory
  699. #define GUI_TRAJ_CNTL_SrcByteAlign 0x00080000 // Source is byte aligned
  700. #define GUI_TRAJ_CNTL_SrcLineXDir 0x00100000 // Source X direction during Bresenham linedraw
  701. #define GUI_TRAJ_CNTL_PattMonoEna 0x01000000 // Monochrome 8x8 pattern enable
  702. #define GUI_TRAJ_CNTL_PattClr4x2Ena 0x02000000 // Colour 4x2 pattern enable
  703. #define GUI_TRAJ_CNTL_PattClr8x1Ena 0x04000000 // Colour 8x1 pattern enable
  704. #define GUI_TRAJ_CNTL_HostByteAlign 0x10000000 // Host data is byte aligned
  705. /*
  706. * Fields in GUI_STAT register
  707. */
  708. #define GUI_STAT_GuiActive 0x00000001 /* Engine busy */
  709. /*
  710. * Extended BIOS services. Word values are function selectors, doubleword
  711. * values are bit flags which may be ORed with each other for "write"
  712. * calls or extracted for "read" calls.
  713. */
  714. #define BIOS_PREFIX_VGA_ENAB 0xA000 /* Accelerator BIOS prefix with VGA enabled */
  715. #define BIOS_PREFIX_MAX_DISAB 0xAF00 /* Highest allowed BIOS prefix with VGA disabled */
  716. #define BIOS_PREFIX_INCREMENT 0x0100 /* Step between BIOS prefixes */
  717. #define BIOS_PREFIX_UNASSIGNED 0xFF00 /* Flag to show this card's BIOS prefix is not yet known */
  718. #define BIOS_LOAD_CRTC_LB 0x00
  719. #define BIOS_LOAD_CRTC phwDeviceExtension->BiosPrefix | BIOS_LOAD_CRTC_LB
  720. #define BIOS_DEPTH_MASK 0x00000007
  721. #define BIOS_DEPTH_4BPP 0x00000001
  722. #define BIOS_DEPTH_8BPP 0x00000002
  723. #define BIOS_DEPTH_15BPP_555 0x00000003
  724. #define BIOS_DEPTH_16BPP_565 0x00000004
  725. #define BIOS_DEPTH_24BPP 0x00000005
  726. #define BIOS_DEPTH_32BPP 0x00000006
  727. #define BIOS_ORDER_32BPP_MASK 0x00000028
  728. #define BIOS_DEPTH_ORDER_MASK BIOS_DEPTH_MASK | BIOS_ORDER_32BPP_MASK
  729. #define BIOS_ORDER_32BPP_RGBx 0x00000000
  730. #define BIOS_ORDER_32BPP_xRGB 0x00000008
  731. #define BIOS_ORDER_32BPP_BGRx 0x00000020
  732. #define BIOS_ORDER_32BPP_xBGR 0x00000028
  733. #define BIOS_DEPTH_32BPP_RGBx BIOS_DEPTH_32BPP | BIOS_ORDER_32BPP_RGBx
  734. #define BIOS_DEPTH_32BPP_xRGB BIOS_DEPTH_32BPP | BIOS_ORDER_32BPP_xRGB
  735. #define BIOS_DEPTH_32BPP_BGRx BIOS_DEPTH_32BPP | BIOS_ORDER_32BPP_BGRx
  736. #define BIOS_DEPTH_32BPP_xBGR BIOS_DEPTH_32BPP | BIOS_ORDER_32BPP_xBGR
  737. #define BIOS_ENABLE_GAMMA 0x00000010 /* Enable gamma correction */
  738. #define BIOS_PITCH_MASK 0x000000C0
  739. #define BIOS_PITCH_1024 0x00000000 /* Screen pitch 1024 pixels */
  740. #define BIOS_PITCH_UNCHANGED 0x00000040 /* Don't change screen pitch */
  741. #define BIOS_PITCH_HOR_RES 0x00000080 /* Screen pitch is horizontal resolution */
  742. #define BIOS_RES_MASK 0x0000FF00
  743. #define BIOS_RES_640x480 0x00001200
  744. #define BIOS_RES_800x600 0x00006A00
  745. #define BIOS_RES_1024x768 0x00005500
  746. #define BIOS_RES_EEPROM 0x00008000 /* Load table from EEPROM */
  747. #define BIOS_RES_BUFFER 0x00008100 /* Load table from buffer in first 1M */
  748. #define BIOS_RES_HIGH_BUFFER 0x00009100 /* Load table from unrestricted buffer */
  749. #define BIOS_RES_OEM 0x00008200 /* OEM-specific mode */
  750. #define BIOS_RES_1280x1024 0x00008300
  751. #define BIOS_RES_1600x1200 0x00008400
  752. #define BIOS_SET_MODE_LB 0x01
  753. #define BIOS_SET_MODE phwDeviceExtension->BiosPrefix | BIOS_SET_MODE_LB
  754. #define BIOS_MODE_VGA 0x00000000
  755. #define BIOS_MODE_COPROCESSOR 0x00000001
  756. #define BIOS_LOAD_SET_LB 0x02
  757. #define BIOS_LOAD_SET phwDeviceExtension->BiosPrefix | BIOS_LOAD_SET_LB
  758. #define BIOS_READ_EEPROM_LB 0x03
  759. #define BIOS_READ_EEPROM phwDeviceExtension->BiosPrefix | BIOS_READ_EEPROM_LB
  760. #define BIOS_WRITE_EEPROM_LB 0x04
  761. #define BIOS_WRITE_EEPROM phwDeviceExtension->BiosPrefix | BIOS_WRITE_EEPROM_LB
  762. #define BIOS_APERTURE_LB 0x05
  763. #define BIOS_APERTURE phwDeviceExtension->BiosPrefix | BIOS_APERTURE_LB
  764. #define BIOS_DISABLE_APERTURE 0x00000000
  765. #define BIOS_LINEAR_APERTURE 0x00000001
  766. #define BIOS_VGA_APERTURE 0x00000004
  767. #define BIOS_SHORT_QUERY_LB 0x06
  768. #define BIOS_SHORT_QUERY phwDeviceExtension->BiosPrefix | BIOS_SHORT_QUERY_LB
  769. #define BIOS_AP_DISABLED 0x00000000
  770. #define BIOS_AP_4M 0x00000001
  771. #define BIOS_AP_8M 0x00000002
  772. #define BIOS_AP_16M 0x00000003
  773. #define BIOS_AP_SIZEMASK 0x00000003
  774. #define BIOS_AP_SETTABLE 0x00000000 /* User can set aperture */
  775. #define BIOS_AP_FIXED 0x00000040 /* Aperture location is fixed */
  776. #define BIOS_AP_RNG_128M 0x00000000 /* Aperture must be below 128M */
  777. #define BIOS_AP_RNG_4G 0x00000080 /* Aperture can be anywhere */
  778. #define BIOS_CAP_LIST_LB 0x07
  779. #define BIOS_CAP_LIST phwDeviceExtension->BiosPrefix | BIOS_CAP_LIST_LB
  780. #define BIOS_GET_QUERY_SIZE_LB 0x08
  781. #define BIOS_GET_QUERY_SIZE phwDeviceExtension->BiosPrefix | BIOS_GET_QUERY_SIZE_LB
  782. #define BIOS_QUERY_LB 0x09
  783. #define BIOS_QUERY phwDeviceExtension->BiosPrefix | BIOS_QUERY_LB
  784. /*
  785. * The following values are used for both BIOS_GET_QUERY_SIZE
  786. * and BIOS_QUERY
  787. */
  788. #define BIOS_QUERY_HEADER 0x00000000 /* Get header information only */
  789. #define BIOS_QUERY_FULL 0x00000001 /* Also get mode tables */
  790. #define BIOS_GET_CLOCK_LB 0x0A
  791. #define BIOS_GET_CLOCK phwDeviceExtension->BiosPrefix | BIOS_GET_CLOCK_LB
  792. #define BIOS_SET_CLOCK_LB 0x0B
  793. #define BIOS_SET_CLOCK phwDeviceExtension->BiosPrefix | BIOS_SET_CLOCK_LB
  794. #define BIOS_SET_DPMS_LB 0x0C
  795. #define BIOS_SET_DPMS phwDeviceExtension->BiosPrefix | BIOS_SET_DPMS_LB
  796. #define BIOS_GET_DPMS_LB 0x0D
  797. #define BIOS_GET_DPMS phwDeviceExtension->BiosPrefix | BIOS_GET_DPMS_LB
  798. #define BIOS_DPMS_ACTIVE 0x00000000
  799. #define BIOS_DPMS_STANDBY 0x00000001
  800. #define BIOS_DPMS_SUSPEND 0x00000002
  801. #define BIOS_DPMS_OFF 0x00000003
  802. #define BIOS_DPMS_BLANK_SCREEN 0x00000004
  803. /*
  804. * Set and return Graphics Controller's power management state.
  805. */
  806. #define BIOS_SET_PM_LB 0x0E
  807. #define BIOS_SET_PM phwDeviceExtension->BiosPrefix | BIOS_SET_PM_LB
  808. #define BIOS_GET_PM_LB 0x0F
  809. #define BIOS_GET_PM phwDeviceExtension->BiosPrefix | BIOS_GET_PM_LB
  810. #define BIOS_RAMDAC_STATE_LB 0x10
  811. #define BIOS_RAMDAC_STATE phwDeviceExtension->BiosPrefix | BIOS_RAMDAC_STATE_LB
  812. #define BIOS_RAMDAC_NORMAL 0x00000000
  813. #define BIOS_RAMDAC_SLEEP 0x00000001
  814. #define BIOS_STORAGE_INFO_LB 0x11 /* Get external storage device info */
  815. #define BIOS_STORAGE_INFO phwDeviceExtension->BiosPrefix | BIOS_STORAGE_INFO_LB
  816. #define BIOS_DEVICE_TYPE 0x0000000F
  817. #define BIOS_READ_WRITE 0x00000000
  818. #define BIOS_RDONLY 0x00000010
  819. #define BIOS_NO_READ_WRITE 0x00000030
  820. #define BIOS_READ_WRITE_APP 0x00000040
  821. #define BIOS_NO_EXT_STORAGE 0x00000080
  822. #define BIOS_NUM_16BIT_ENTRIES 0x0000FF00
  823. #define BIOS_CRTC_TABLE_OFFSET 0x000000FF
  824. #define BIOS_CRTC_TABLE_SIZE 0x0000FF00
  825. #define BIOS_QUERY_IOBASE_LB 0x12 /* Get I/O base address */
  826. #define BIOS_QUERY_IOBASE phwDeviceExtension->BiosPrefix | BIOS_QUERY_IOBASE_LB
  827. #define BIOS_DDC_SUPPORT_LB 0x13 /* Get Display Data Channel support information */
  828. #define BIOS_DDC_SUPPORT phwDeviceExtension->BiosPrefix | BIOS_DDC_SUPPORT_LB
  829. #define REG_BLOCK_0 0x00000100
  830. #define GP_IO (REG_BLOCK_0 | 0x1E)