Windows NT 4.0 source code leak
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.

281 lines
9.7 KiB

4 years ago
  1. // #pragma comment(exestr, "@(#) cirrus.h 1.1 95/09/28 15:31:10 nec")
  2. /*++
  3. Copyright (c) 1992 Microsoft Corporation
  4. Module Name:
  5. cirrus.h
  6. Abstract:
  7. This module contains the definitions for the code that implements the
  8. Cirrus Logic VGA 6410/6420/542x device driver.
  9. Environment:
  10. Kernel mode
  11. Notes:
  12. This module based on Cirrus Minport Driver. And modify for R96 MIPS
  13. R4400 HAL Cirrus display initialize.
  14. Revision History:
  15. --*/
  16. /*
  17. * M001 1993.19.28 A. Kuriyama @ oa2
  18. *
  19. * - Modify for R96 MIPS R4400 HAL
  20. *
  21. * Delete : Miniport Driver Interface
  22. *
  23. *
  24. * Revision History in Cirrus Miniport Driver as follows:
  25. *
  26. * L001 1993.10.15 Kuroki
  27. *
  28. * - Modify for R96 MIPS R4400 *
  29. * Delete : Micro channel Bus Initialize.
  30. * VDM & Text, Fullscreen mode support.
  31. * Banking routine.
  32. * CL64xx Chip support.
  33. * 16-color mode.
  34. *
  35. * Add : Liner Addressing.
  36. *
  37. * L002 1993.10.21 Kuroki
  38. *
  39. * - Warniing clear
  40. *
  41. * S003 1993.1.13 kbnes!A.Kuriyama
  42. *
  43. * - VGA Address was changed
  44. *
  45. */
  46. //
  47. // Change Ushort to Uchar, because R96 is mips machine.
  48. //
  49. //
  50. // Base address of VGA memory range. Also used as base address of VGA
  51. // memory when loading a font, which is done with the VGA mapped at A0000.
  52. //
  53. /* START L001 */
  54. #define LA_MASK 0xE /* S003 */
  55. #define MEM_VGA (LA_MASK << 20)
  56. #define MEM_VGA_SIZE 0x100000
  57. /* END L001 */
  58. //
  59. // Port definitions for filling the ACCSES_RANGES structure in the miniport
  60. // information, defines the range of I/O ports the VGA spans.
  61. // There is a break in the IO ports - a few ports are used for the parallel
  62. // port. Those cannot be defined in the ACCESS_RANGE, but are still mapped
  63. // so all VGA ports are in one address range.
  64. //
  65. #define VGA_BASE_IO_PORT 0x000003B0
  66. #define VGA_START_BREAK_PORT 0x000003BB
  67. #define VGA_END_BREAK_PORT 0x000003C0
  68. #define VGA_MAX_IO_PORT 0x000003DF
  69. //
  70. // VGA port-related definitions.
  71. //
  72. //
  73. // VGA register definitions
  74. //
  75. // ports in monochrome mode
  76. #define CRTC_ADDRESS_PORT_MONO 0x0004 // CRT Controller Address and
  77. #define CRTC_DATA_PORT_MONO 0x0005 // Data registers in mono mode
  78. #define FEAT_CTRL_WRITE_PORT_MONO 0x000A // Feature Control write port
  79. // in mono mode
  80. #define INPUT_STATUS_1_MONO 0x000A // Input Status 1 register read
  81. // port in mono mode
  82. #define ATT_INITIALIZE_PORT_MONO INPUT_STATUS_1_MONO
  83. // Register to read to reset
  84. // Attribute Controller index/data
  85. #define ATT_ADDRESS_PORT 0x0010 // Attribute Controller Address and
  86. #define ATT_DATA_WRITE_PORT 0x0010 // Data registers share one port
  87. // for writes, but only Address is
  88. // readable at 0x010
  89. #define ATT_DATA_READ_PORT 0x0011 // Attribute Controller Data reg is
  90. // readable here
  91. #define MISC_OUTPUT_REG_WRITE_PORT 0x0012 // Miscellaneous Output reg write
  92. // port
  93. #define INPUT_STATUS_0_PORT 0x0012 // Input Status 0 register read
  94. // port
  95. #define VIDEO_SUBSYSTEM_ENABLE_PORT 0x0013 // Bit 0 enables/disables the
  96. // entire VGA subsystem
  97. #define SEQ_ADDRESS_PORT 0x0014 // Sequence Controller Address and
  98. #define SEQ_DATA_PORT 0x0015 // Data registers
  99. #define DAC_PIXEL_MASK_PORT 0x0016 // DAC pixel mask reg
  100. #define DAC_ADDRESS_READ_PORT 0x0017 // DAC register read index reg,
  101. // write-only
  102. #define DAC_STATE_PORT 0x0017 // DAC state (read/write),
  103. // read-only
  104. #define DAC_ADDRESS_WRITE_PORT 0x0018 // DAC register write index reg
  105. #define DAC_DATA_REG_PORT 0x0019 // DAC data transfer reg
  106. #define FEAT_CTRL_READ_PORT 0x001A // Feature Control read port
  107. #define MISC_OUTPUT_REG_READ_PORT 0x001C // Miscellaneous Output reg read
  108. // port
  109. #define GRAPH_ADDRESS_PORT 0x001E // Graphics Controller Address
  110. #define GRAPH_DATA_PORT 0x001F // and Data registers
  111. // ports in color mode
  112. #define CRTC_ADDRESS_PORT_COLOR 0x0024 // CRT Controller Address and
  113. #define CRTC_DATA_PORT_COLOR 0x0025 // Data registers in color mode
  114. #define FEAT_CTRL_WRITE_PORT_COLOR 0x002A // Feature Control write port
  115. #define INPUT_STATUS_1_COLOR 0x002A // Input Status 1 register read
  116. // port in color mode
  117. #define ATT_INITIALIZE_PORT_COLOR INPUT_STATUS_1_COLOR
  118. // Register to read to reset
  119. // Attribute Controller index/data
  120. // toggle in color mode
  121. //
  122. // Offsets in HardwareStateHeader->PortValue[] of save areas for non-indexed
  123. // VGA registers.
  124. //
  125. #define CRTC_ADDRESS_MONO_OFFSET 0x04
  126. #define FEAT_CTRL_WRITE_MONO_OFFSET 0x0A
  127. #define ATT_ADDRESS_OFFSET 0x10
  128. #define MISC_OUTPUT_REG_WRITE_OFFSET 0x12
  129. #define VIDEO_SUBSYSTEM_ENABLE_OFFSET 0x13
  130. #define SEQ_ADDRESS_OFFSET 0x14
  131. #define DAC_PIXEL_MASK_OFFSET 0x16
  132. #define DAC_STATE_OFFSET 0x17
  133. #define DAC_ADDRESS_WRITE_OFFSET 0x18
  134. #define GRAPH_ADDRESS_OFFSET 0x1E
  135. #define CRTC_ADDRESS_COLOR_OFFSET 0x24
  136. #define FEAT_CTRL_WRITE_COLOR_OFFSET 0x2A
  137. // toggle in color mode
  138. //
  139. // VGA indexed register indexes.
  140. //
  141. // CL-GD542x specific registers:
  142. //
  143. #define IND_CL_EXTS_ENB 0x06 // index in Sequencer to enable exts
  144. #define IND_CL_SCRATCH_PAD 0x0A // index in Seq of POST scratch pad
  145. #define IND_CL_ID_REG 0x27 // index in CRTC of ID Register
  146. //
  147. #define IND_CURSOR_START 0x0A // index in CRTC of the Cursor Start
  148. #define IND_CURSOR_END 0x0B // and End registers
  149. #define IND_CURSOR_HIGH_LOC 0x0E // index in CRTC of the Cursor Location
  150. #define IND_CURSOR_LOW_LOC 0x0F // High and Low Registers
  151. #define IND_VSYNC_END 0x11 // index in CRTC of the Vertical Sync
  152. // End register, which has the bit
  153. // that protects/unprotects CRTC
  154. // index registers 0-7
  155. #define IND_SET_RESET_ENABLE 0x01 // index of Set/Reset Enable reg in GC
  156. #define IND_DATA_ROTATE 0x03 // index of Data Rotate reg in GC
  157. #define IND_READ_MAP 0x04 // index of Read Map reg in Graph Ctlr
  158. #define IND_GRAPH_MODE 0x05 // index of Mode reg in Graph Ctlr
  159. #define IND_GRAPH_MISC 0x06 // index of Misc reg in Graph Ctlr
  160. #define IND_BIT_MASK 0x08 // index of Bit Mask reg in Graph Ctlr
  161. #define IND_SYNC_RESET 0x00 // index of Sync Reset reg in Seq
  162. #define IND_MAP_MASK 0x02 // index of Map Mask in Sequencer
  163. #define IND_MEMORY_MODE 0x04 // index of Memory Mode reg in Seq
  164. #define IND_CRTC_PROTECT 0x11 // index of reg containing regs 0-7 in
  165. // CRTC
  166. #define IND_CRTC_COMPAT 0x34 // index of CRTC Compatibility reg
  167. // in CRTC
  168. #define START_SYNC_RESET_VALUE 0x01 // value for Sync Reset reg to start
  169. // synchronous reset
  170. #define END_SYNC_RESET_VALUE 0x03 // value for Sync Reset reg to end
  171. // synchronous reset
  172. //
  173. // Values for Attribute Controller Index register to turn video off
  174. // and on, by setting bit 5 to 0 (off) or 1 (on).
  175. //
  176. #define VIDEO_DISABLE 0
  177. #define VIDEO_ENABLE 0x20
  178. // Masks to keep only the significant bits of the Graphics Controller and
  179. // Sequencer Address registers. Masking is necessary because some VGAs, such
  180. // as S3-based ones, don't return unused bits set to 0, and some SVGAs use
  181. // these bits if extensions are enabled.
  182. //
  183. #define GRAPH_ADDR_MASK 0x0F
  184. #define SEQ_ADDR_MASK 0x07
  185. //
  186. // Mask used to toggle Chain4 bit in the Sequencer's Memory Mode register.
  187. //
  188. #define CHAIN4_MASK 0x08
  189. //
  190. // Value written to the Read Map register when identifying the existence of
  191. // a VGA in VgaInitialize. This value must be different from the final test
  192. // value written to the Bit Mask in that routine.
  193. //
  194. #define READ_MAP_TEST_SETTING 0x03
  195. //
  196. // Default text mode setting for various registers, used to restore their
  197. // states if VGA detection fails after they've been modified.
  198. //
  199. #define MEMORY_MODE_TEXT_DEFAULT 0x02
  200. #define BIT_MASK_DEFAULT 0xFF
  201. #define READ_MAP_DEFAULT 0x00
  202. //
  203. // Palette-related info.
  204. //
  205. //
  206. // Highest valid DAC color register index.
  207. //
  208. #define VIDEO_MAX_COLOR_REGISTER 0xFF
  209. //
  210. // Indices for type of memory mapping; used in ModesVGA[], must match
  211. // MemoryMap[].
  212. //
  213. typedef enum _VIDEO_MEMORY_MAP {
  214. MemMap_Mono,
  215. MemMap_CGA,
  216. MemMap_VGA
  217. } VIDEO_MEMORY_MAP, *PVIDEO_MEMORY_MAP;
  218. //
  219. // For a mode, the type of banking supported. Controls the information
  220. // returned in VIDEO_BANK_SELECT. PlanarHCBanking includes NormalBanking.
  221. //
  222. typedef enum _BANK_TYPE {
  223. NoBanking = 0,
  224. NormalBanking,
  225. PlanarHCBanking
  226. } BANK_TYPE, *PBANK_TYPE;
  227. #define CL6410 0x0001
  228. #define CL6420 0x0002
  229. #define CL542x 0x0004
  230. // bitfields for the DisplayType
  231. #define crt 0x0001
  232. #define panel 0x0002
  233. #define simulscan 0x0004 // this means both, but is unused for now.