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.

847 lines
30 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Copyright (c) 1993 Compaq Computer Corporation
  4. Module Name:
  5. qvision.h
  6. Abstract:
  7. This module contains the definitions for the code that implements the
  8. Compaq QVision VGA device driver.
  9. Environment:
  10. Kernel mode
  11. Revision History:
  12. $0003
  13. miked: 12/14/1993
  14. Added ioctl CPQ_IOCTL_VIDEO_INFO to give asic info and more
  15. back to the hardware accelerated port driver. Also added min macro.
  16. Added #include of qry_nt.h to get access to structure
  17. VIDEO_CHIP_INFO (added to device extension).
  18. --*/
  19. //
  20. // $0003 miked 12/14/1993 - Added #include "qry_nt.h"
  21. //
  22. #include "qry_nt.h"
  23. //
  24. // QVision memory save/restore request flag
  25. //
  26. #define QV_SAVE_FRAME_BUFFER 1
  27. #define QV_RESTORE_FRAME_BUFFER 0
  28. //
  29. // Banking ifdefs to enable banking
  30. // the banking type MUST match the type in clhard.asm
  31. //
  32. #define ONE_64K_BANK 0
  33. #define TWO_32K_BANKS 1
  34. #define MULTIPLE_REFRESH_TABLES 0
  35. //
  36. // Base address of VGA memory range. Also used as base address of VGA
  37. // memory when loading a font, which is done with the VGA mapped at A0000.
  38. //
  39. #define MEM_VGA 0xA0000
  40. #define MEM_VGA_SIZE 0x20000
  41. //
  42. // Port definitions for filling the ACCSES_RANGES structure in the miniport
  43. // information, defines the range of I/O ports the VGA spans.
  44. // There is a break in the IO ports - a few ports are used for the parallel
  45. // port. Those cannot be defined in the ACCESS_RANGE, but are still mapped
  46. // so all VGA ports are in one address range.
  47. //
  48. #define VGA_BASE_IO_PORT 0x000003B0
  49. #define VGA_START_BREAK_PORT 0x000003BB
  50. #define VGA_END_BREAK_PORT 0x000003C0
  51. #define VGA_MAX_IO_PORT 0x000003DF
  52. // adrianc 4/15/1993
  53. //
  54. // We need to reserve many small ranges instead
  55. // of one large range so that we don't conflict with
  56. // any other driver which needs some of the registers
  57. // we are not using.
  58. //
  59. #define QV_START_EXT_PORT_1 0x000013C0 // extended register access
  60. #define QV_END_EXT_PORT_1 0x000013D0 // ranges reserved by the
  61. #define QV_START_EXT_PORT_2 0x000023C0 // Qvision miniport driver
  62. #define QV_END_EXT_PORT_2 0x000023D0
  63. #define QV_START_EXT_PORT_3 0x000033C0
  64. #define QV_END_EXT_PORT_3 0x000033D0
  65. #define QV_START_EXT_PORT_4 0x000046E0
  66. #define QV_END_EXT_PORT_4 0x000046F0
  67. #define QV_START_EXT_PORT_5 0x000053C0
  68. #define QV_END_EXT_PORT_5 0x000053D0
  69. #define QV_START_EXT_PORT_6 0x000063C0
  70. #define QV_END_EXT_PORT_6 0x000063D0
  71. #define QV_START_EXT_PORT_7 0x000073C0
  72. #define QV_END_EXT_PORT_7 0x000073D0
  73. #define QV_START_EXT_PORT_8 0x000083C0
  74. #define QV_END_EXT_PORT_8 0x000083D0
  75. #define QV_START_EXT_PORT_9 0x000093C0
  76. #define QV_END_EXT_PORT_9 0x000093D0
  77. //
  78. // Maximum size of the hardware mouse pointer.
  79. //
  80. #define POINTER_MAX_HEIGHT 32 // QVision can handle a
  81. #define POINTER_MAX_WIDTH 32 // 32x32x2 hardware pointer
  82. #define POINTER_COLOR_NUM 2
  83. #define POINTER_PLANE_SIZE 32*32*2 // 2K bytes for cursor data
  84. //
  85. // VGA port-related definitions.
  86. //
  87. //
  88. // VGA register definitions - offsets from VGA_BASE_IO_ADDRESS
  89. //
  90. // ports in monochrome mode
  91. #define CRTC_ADDRESS_PORT_MONO 0x0004 // CRT Controller Address and
  92. #define CRTC_DATA_PORT_MONO 0x0005 // Data registers in mono mode
  93. #define FEAT_CTRL_WRITE_PORT_MONO 0x000A // Feature Control write port
  94. // in mono mode
  95. #define INPUT_STATUS_1_MONO 0x000A // Input Status 1 register read
  96. // port in mono mode
  97. #define ATT_INITIALIZE_PORT_MONO INPUT_STATUS_1_MONO
  98. // Register to read to reset
  99. // Attribute Controller index/data
  100. #define ATT_ADDRESS_PORT 0x0010 // Attribute Controller Address and
  101. #define ATT_DATA_WRITE_PORT 0x0010 // Data registers share one port
  102. // for writes, but only Address is
  103. // readable at 0x010
  104. #define ATT_DATA_READ_PORT 0x0011 // Attribute Controller Data reg is
  105. // readable here
  106. #define MISC_OUTPUT_REG_WRITE_PORT 0x0012 // Miscellaneous Output reg write
  107. // port
  108. #define INPUT_STATUS_0_PORT 0x0012 // Input Status 0 register read
  109. // port
  110. #define VIDEO_SUBSYSTEM_ENABLE_PORT 0x0013 // Bit 0 enables/disables the
  111. // entire VGA subsystem
  112. #define SEQ_ADDRESS_PORT 0x0014 // Sequence Controller Address and
  113. #define SEQ_DATA_PORT 0x0015 // Data registers
  114. #define DAC_PIXEL_MASK_PORT 0x0016 // DAC pixel mask reg
  115. #define DAC_ADDRESS_READ_PORT 0x0017 // DAC register read index reg,
  116. // write-only
  117. #define DAC_STATE_PORT 0x0017 // DAC state (read/write),
  118. // read-only
  119. #define DAC_ADDRESS_WRITE_PORT 0x0018 // DAC register write index reg
  120. #define DAC_DATA_REG_PORT 0x0019 // DAC data transfer reg
  121. #define FEAT_CTRL_READ_PORT 0x001A // Feature Control read port
  122. #define MISC_OUTPUT_REG_READ_PORT 0x001C // Miscellaneous Output reg read
  123. // port
  124. #define GRAPH_ADDRESS_PORT 0x001E // Graphics Controller Address
  125. #define GRAPH_DATA_PORT 0x001F // and Data registers
  126. // ports in color mode
  127. #define CRTC_ADDRESS_PORT_COLOR 0x0024 // CRT Controller Address and
  128. #define CRTC_DATA_PORT_COLOR 0x0025 // Data registers in color mode
  129. #define FEAT_CTRL_WRITE_PORT_COLOR 0x002A // Feature Control write port
  130. #define INPUT_STATUS_1_COLOR 0x002A // Input Status 1 register read
  131. // port in color mode
  132. #define ATT_INITIALIZE_PORT_COLOR INPUT_STATUS_1_COLOR
  133. // Register to read to reset
  134. // Attribute Controller index/data
  135. // toggle in color mode
  136. //
  137. // Offsets in HardwareStateHeader->PortValue[] of save areas for non-indexed
  138. // VGA registers.
  139. //
  140. #define CRTC_ADDRESS_MONO_OFFSET 0x04
  141. #define FEAT_CTRL_WRITE_MONO_OFFSET 0x0A
  142. #define ATT_ADDRESS_OFFSET 0x10
  143. #define MISC_OUTPUT_REG_WRITE_OFFSET 0x12
  144. #define VIDEO_SUBSYSTEM_ENABLE_OFFSET 0x13
  145. #define SEQ_ADDRESS_OFFSET 0x14
  146. #define DAC_PIXEL_MASK_OFFSET 0x16
  147. #define DAC_STATE_OFFSET 0x17
  148. #define DAC_ADDRESS_WRITE_OFFSET 0x18
  149. #define GRAPH_ADDRESS_OFFSET 0x1E
  150. #define CRTC_ADDRESS_COLOR_OFFSET 0x24
  151. #define FEAT_CTRL_WRITE_COLOR_OFFSET 0x2A
  152. // toggle in color mode
  153. //
  154. // VGA indexed register indexes.
  155. //
  156. //
  157. #define IND_CURSOR_START 0x0A // index in CRTC of the Cursor Start
  158. #define IND_CURSOR_END 0x0B // and End registers
  159. #define IND_CURSOR_HIGH_LOC 0x0E // index in CRTC of the Cursor Location
  160. #define IND_CURSOR_LOW_LOC 0x0F // High and Low Registers
  161. #define IND_VSYNC_END 0x11 // index in CRTC of the Vertical Sync
  162. // End register, which has the bit
  163. // that protects/unprotects CRTC
  164. // index registers 0-7
  165. #define IND_SET_RESET_ENABLE 0x01 // index of Set/Reset Enable reg in GC
  166. #define IND_DATA_ROTATE 0x03 // index of Data Rotate reg in GC
  167. #define IND_READ_MAP 0x04 // index of Read Map reg in Graph Ctlr
  168. #define IND_GRAPH_MODE 0x05 // index of Mode reg in Graph Ctlr
  169. #define IND_GRAPH_MISC 0x06 // index of Misc reg in Graph Ctlr
  170. #define IND_BIT_MASK 0x08 // index of Bit Mask reg in Graph Ctlr
  171. #define IND_SYNC_RESET 0x00 // index of Sync Reset reg in Seq
  172. #define IND_MAP_MASK 0x02 // index of Map Mask in Sequencer
  173. #define IND_MEMORY_MODE 0x04 // index of Memory Mode reg in Seq
  174. #define IND_CRTC_PROTECT 0x11 // index of reg containing regs 0-7 in
  175. // CRTC
  176. #define START_SYNC_RESET_VALUE 0x01 // value for Sync Reset reg to start
  177. // synchronous reset
  178. #define END_SYNC_RESET_VALUE 0x03 // value for Sync Reset reg to end
  179. // synchronous reset
  180. #define COLOR_ADJUSTMENT 0x20 /* */
  181. //
  182. // Number of each type of indexed register in a standard VGA, used by
  183. // validator and state save/restore functions.
  184. //
  185. // Note: VDMs currently only support basic VGAs only.
  186. //
  187. #define VGA_NUM_SEQUENCER_PORTS 5
  188. #define VGA_NUM_CRTC_PORTS 25
  189. #define VGA_NUM_GRAPH_CONT_PORTS 9
  190. #define VGA_NUM_ATTRIB_CONT_PORTS 21
  191. #define VGA_NUM_DAC_ENTRIES 256
  192. //
  193. // Indices to start save/restore in extension registers:
  194. //
  195. #define QV_GRAPH_EXT_START 0x0b // qv specific extended gra indices
  196. #define QV_GRAPH_EXT_END 0x6b
  197. #define EXT_NUM_MAIN_13C6 4
  198. #define EXT_NUM_MAIN_23CX 16
  199. #define EXT_NUM_MAIN_33CX 20
  200. #define EXT_NUM_MAIN_46E8 1
  201. #define EXT_NUM_MAIN_63CX 16
  202. #define EXT_NUM_MAIN_83CX 16
  203. #define EXT_NUM_MAIN_93CX 4
  204. #define EXT_NUM_MAIN_REGISTERS EXT_NUM_MAIN_13C6 + \
  205. EXT_NUM_MAIN_23CX + \
  206. EXT_NUM_MAIN_33CX + \
  207. EXT_NUM_MAIN_46E8 + \
  208. EXT_NUM_MAIN_63CX + \
  209. EXT_NUM_MAIN_83CX + \
  210. EXT_NUM_MAIN_93CX
  211. //
  212. // Number of each type of extended indexed register.
  213. //
  214. #ifdef QV_EXTENDED_SAVE
  215. #define EXT_NUM_GRAPH_CONT_PORTS (QV_GRAPH_EXT_END - QV_GRAPH_EXT_START + 1)
  216. #else
  217. #define EXT_NUM_GRAPH_CONT_PORTS 0
  218. #endif
  219. #define EXT_NUM_SEQUENCER_PORTS 0
  220. #define EXT_NUM_CRTC_PORTS EXT_NUM_MAIN_REGISTERS
  221. #define EXT_NUM_ATTRIB_CONT_PORTS 0
  222. #define EXT_NUM_DAC_ENTRIES 4
  223. //
  224. // Values for Attribute Controller Index register to turn video off
  225. // and on, by setting bit 5 to 0 (off) or 1 (on).
  226. //
  227. #define VIDEO_DISABLE 0
  228. #define VIDEO_ENABLE 0x20
  229. // Masks to keep only the significant bits of the Graphics Controller and
  230. // Sequencer Address registers. Masking is necessary because some VGAs, such
  231. // as S3-based ones, don't return unused bits set to 0, and some SVGAs use
  232. // these bits if extensions are enabled.
  233. //
  234. #define GRAPH_ADDR_MASK 0x0F
  235. #define SEQ_ADDR_MASK 0x07
  236. //
  237. // Mask used to toggle Chain4 bit in the Sequencer's Memory Mode register.
  238. //
  239. #define CHAIN4_MASK 0x08
  240. //
  241. // Value written to the Read Map register when identifying the existence of
  242. // a VGA in VgaInitialize. This value must be different from the final test
  243. // value written to the Bit Mask in that routine.
  244. //
  245. #define READ_MAP_TEST_SETTING 0x03
  246. //
  247. // Default text mode setting for various registers, used to restore their
  248. // states if VGA detection fails after they've been modified.
  249. //
  250. #define MEMORY_MODE_TEXT_DEFAULT 0x02
  251. #define BIT_MASK_DEFAULT 0xFF
  252. #define READ_MAP_DEFAULT 0x00
  253. //
  254. // Palette-related info.
  255. //
  256. //
  257. // Highest valid DAC color register index.
  258. //
  259. #define VIDEO_MAX_COLOR_REGISTER 0xFF
  260. //
  261. // Highest valid palette register index
  262. //
  263. #define VIDEO_MAX_PALETTE_REGISTER 0x0F
  264. //
  265. // QVision specific register values.
  266. //
  267. #define DAC_CMD_0 0x83c6
  268. #define DAC_CMD_1 0x13c8
  269. #define DAC_CMD_2 0x13C9 // QVision DAC Command Register 2
  270. #define DAC_RAM_MEM 0x13c7 // DAC hardware pointer bitmap RAM
  271. #define DAC_PTR_Y_HIGH 0x93c7 // hardware pointer coordinates
  272. #define DAC_PTR_Y_LOW 0x93c6
  273. #define DAC_PTR_X_HIGH 0x93c9
  274. #define DAC_PTR_X_LOW 0x93c8
  275. #define DAC_RAM_INDEX 0x3c7
  276. #define DAC_STATUS_REG 0x13c6 // DAC status register
  277. #define DAC_CMD_3_INDEX 0x01 // DAC Cmd register 3 index for
  278. // ORION. (write it to 13c8)
  279. #define DBL_CLK 0x08 // double clock for 1280 modes
  280. #define CURSOR_ENABLE 0x02
  281. #define CURSOR_DISABLE 0x00
  282. #define CURSOR_WRITE 0x3C8 // HW Cursor registers - ecr
  283. #define CURSOR_READ 0x3C7
  284. #define CURSOR_PLANE_0 0x00
  285. #define CURSOR_PLANE_1 0x80
  286. #define CURSOR_DATA 0x13C7
  287. #define CURSOR_COLOR_READ 0x83C7
  288. #define CURSOR_COLOR_WRITE 0x83C8
  289. #define CURSOR_COLOR_DATA 0x83C9
  290. #define OVERSCAN_COLOR 0x00
  291. #define CURSOR_COLOR_1 0x01
  292. #define CURSOR_COLOR_2 0x02
  293. #define CURSOR_COLOR_3 0x03
  294. #define CURSOR_X 0x93C8 // 16-bit register
  295. #define CURSOR_Y 0x93C6 // 16-bit register
  296. #define CURSOR_CX 32 // h/w pointer width
  297. #define CURSOR_CY 32 // h/w pointer height
  298. //
  299. // Indices for type of memory mapping; used in ModesVGA[], must match
  300. // MemoryMap[].
  301. //
  302. typedef enum _VIDEO_MEMORY_MAP {
  303. MemMap_Mono,
  304. MemMap_CGA,
  305. MemMap_VGA,
  306. MemMap_Flat
  307. } VIDEO_MEMORY_MAP, *PVIDEO_MEMORY_MAP;
  308. //
  309. // For a mode, the type of banking supported. Controls the information
  310. // returned in VIDEO_BANK_SELECT. PlanarHCBanking includes NormalBanking.
  311. //
  312. typedef enum _BANK_TYPE {
  313. NoBanking = 0,
  314. NormalBanking,
  315. PlanarHCBanking
  316. } BANK_TYPE, *PBANK_TYPE;
  317. typedef enum {
  318. vmem256k = 0,
  319. vmem512k,
  320. vmem1Meg,
  321. vmem2Meg
  322. } VMEM_SIZE, *PVMEM_SIZE;
  323. typedef struct { // This can be extended later
  324. PUSHORT QVCmdStrings; // to include sveral options
  325. } CLCMD, *PCLCMD;
  326. // adrianc 4/5/1993
  327. //
  328. // QVision definitions.
  329. //
  330. typedef enum _AdapterTypes
  331. {
  332. NotAries = 0,
  333. AriesIsa, // QVision/I
  334. AriesEisa, // QVision/E
  335. FirEisa, // FIR EISA card
  336. FirIsa, // FIR ISA card
  337. JuniperEisa, // JUNIPER EISA card
  338. JuniperIsa, // JUNIPER ISA card
  339. NUM_ADAPTER_TYPES // number of supported adapters
  340. } ADAPTERTYPE, *PADAPTERTYPE;
  341. typedef enum _MonClass
  342. {
  343. Monitor_Vga = 0, // COMPAQ VGA monitor = 0
  344. Monitor_AG1024, // COMPAQ AG1024 monitor = 1
  345. Monitor_Qvision, // COMPAQ QVISION monitor = 2
  346. Monitor_1280, // COMPAQ 1280 monitor = 3
  347. Monitor_SVGA, // COMPAQ SVGA monitor = 4
  348. Monitor_60Hz, // 60Hz VRefresh rate = 6
  349. Monitor_66Hz, // 66Hz VRefresh rate = 7
  350. Monitor_68Hz, // 68Hz VRefresh rate = 8
  351. Monitor_72Hz, // 72Hz VRefresh rate = 9
  352. Monitor_75Hz, // 75Hz VRefresh rate = A
  353. Monitor_76Hz, // 76Hz VRefresh rate = B
  354. NUM_MONITOR_CLASSES,
  355. Monitor_Third_Party=99,
  356. } MONCLASS, *PMONCLASS;
  357. //
  358. // $0005 - MikeD - 02/08/94
  359. // Begin...
  360. // new struct for monitor data...
  361. //
  362. typedef struct {
  363. USHORT CommandIndex; // index into mode command table
  364. USHORT bRegsPresent; // boolean 1=program the crtc, 0=do not program
  365. USHORT MiscOut; // Misc Out register value for this mode.
  366. USHORT Overflow; // Overflow 2 register value for this mode.
  367. USHORT crtRegisters[25]; // array of CRT register values
  368. } MONRES, *PMONRES;
  369. //
  370. // MAX_RESOLUTIONS corresponds to a count of all "WWWxHHHxD_INDEX" type
  371. // command indexes, for example QV_TEXT_720x400x4_INDEX and
  372. // QV_1280x1024x8_INDEX, etc.
  373. //
  374. #define MAX_RESOLUTIONS 7
  375. typedef struct {
  376. MONRES MonitorResolution[ MAX_RESOLUTIONS ];
  377. } MONTYPE, *PMONTYPE;
  378. //
  379. // Default refresh rate for the video applet.
  380. //
  381. #define USE_HARDWARE_DEFAULT 1
  382. //
  383. // $0005 - MikeD - 02/08/94
  384. // End...
  385. //
  386. //
  387. // Structure used to describe each video mode in ModesVGA[].
  388. //
  389. typedef struct {
  390. USHORT fbType; // color or monochrome, text or graphics, via
  391. // VIDEO_MODE_COLOR and VIDEO_MODE_GRAPHICS
  392. USHORT numPlanes; // # of video memory planes
  393. USHORT bitsPerPlane; // # of bits of color in each plane
  394. SHORT col; // # of text columns across screen with default font
  395. SHORT row; // # of text rows down screen with default font
  396. USHORT hres; // # of pixels across screen
  397. USHORT vres; // # of scan lines down screen
  398. USHORT wbytes; // # of bytes from start of one scan line to start of next
  399. ULONG sbytes; // total size of addressable display memory in bytes
  400. BANK_TYPE banktype; // NoBanking, NormalBanking, PlanarHCBanking
  401. VIDEO_MEMORY_MAP MemMap; // index from VIDEO_MEMORY_MAP of memory
  402. // mapping used by this mode
  403. VMEM_SIZE VmemRequired; // video memory required for this mode
  404. BOOLEAN ValidMode; // TRUE if mode valid, FALSE if not
  405. //
  406. // the mode will be TRUE if there is enough video memory to support the
  407. // mode, and the display type(it could be a panel), will support the mode.
  408. // PANELS only support 640x480 for now.
  409. //
  410. #ifdef INIT_INT10
  411. USHORT usInt10ModeNum;
  412. #else
  413. CLCMD CmdStrings; // pointer to array of register-setting commands to
  414. #endif
  415. //
  416. // $0005 - MikeD - 02/08/94
  417. //
  418. // This ulong was added to keep the refresh rates for each video
  419. // mode. This information is returned in VgaQueryAvailableModes.
  420. // Also, ulResIndex was added as an index into the QVCMDS for each mode.
  421. //
  422. ULONG ulRefreshRate;
  423. ULONG ulResIndex; // QV_TEXT_720x400x4_INDEX, etc.
  424. } VIDEOMODE, *PVIDEOMODE;
  425. //
  426. // Mode into which to put the VGA before starting a VDM, so it's a plain
  427. // vanilla VGA. (This is the mode's index in ModesVGA[], currently standard
  428. // 80x25 text mode.)
  429. //
  430. #define DEFAULT_MODE 0
  431. //
  432. // Info used by the Validator functions and save/restore code.
  433. // Structure used to trap register accesses that must be done atomically.
  434. //
  435. #define VGA_MAX_VALIDATOR_DATA 100
  436. #define VGA_VALIDATOR_UCHAR_ACCESS 1
  437. #define VGA_VALIDATOR_USHORT_ACCESS 2
  438. #define VGA_VALIDATOR_ULONG_ACCESS 3
  439. typedef struct _VGA_VALIDATOR_DATA {
  440. ULONG Port;
  441. UCHAR AccessType;
  442. ULONG Data;
  443. } VGA_VALIDATOR_DATA, *PVGA_VALIDATOR_DATA;
  444. //
  445. // Number of bytes to save in each plane for VGA modes,
  446. // entire frame buffer size for QVision modes.
  447. //
  448. #define VGA_PLANE_SIZE 0x10000
  449. #define QV_FRAME_BUFFER_SIZE 0x40000
  450. //
  451. // These constants determine the offsets within the
  452. // VIDEO_HARDWARE_STATE_HEADER structure that are used to save and
  453. // restore the VGA's state.
  454. //
  455. #define VGA_HARDWARE_STATE_SIZE sizeof(VIDEO_HARDWARE_STATE_HEADER)
  456. #define VGA_BASIC_SEQUENCER_OFFSET (VGA_HARDWARE_STATE_SIZE + 0)
  457. #define VGA_BASIC_CRTC_OFFSET (VGA_BASIC_SEQUENCER_OFFSET + \
  458. VGA_NUM_SEQUENCER_PORTS)
  459. #define VGA_BASIC_GRAPH_CONT_OFFSET (VGA_BASIC_CRTC_OFFSET + \
  460. VGA_NUM_CRTC_PORTS)
  461. #define VGA_BASIC_ATTRIB_CONT_OFFSET (VGA_BASIC_GRAPH_CONT_OFFSET + \
  462. VGA_NUM_GRAPH_CONT_PORTS)
  463. #define VGA_BASIC_DAC_OFFSET (VGA_BASIC_ATTRIB_CONT_OFFSET + \
  464. VGA_NUM_ATTRIB_CONT_PORTS)
  465. #define VGA_BASIC_LATCHES_OFFSET (VGA_BASIC_DAC_OFFSET + \
  466. (3 * VGA_NUM_DAC_ENTRIES))
  467. #define VGA_EXT_SEQUENCER_OFFSET (VGA_BASIC_LATCHES_OFFSET + 4)
  468. #define VGA_EXT_CRTC_OFFSET (VGA_EXT_SEQUENCER_OFFSET + \
  469. EXT_NUM_SEQUENCER_PORTS)
  470. //
  471. // Establish save buffer offsets for QVision extended registers
  472. // within the VGA_EXT_CRTC range
  473. //
  474. #define EXT_MAIN_REG_13C6 0
  475. #define EXT_MAIN_REG_23CX EXT_MAIN_REG_13C6 + EXT_NUM_MAIN_13C6
  476. #define EXT_MAIN_REG_33CX EXT_MAIN_REG_23CX + EXT_NUM_MAIN_23CX
  477. #define EXT_MAIN_REG_46E8 EXT_MAIN_REG_33CX + EXT_NUM_MAIN_33CX
  478. #define EXT_MAIN_REG_63CX EXT_MAIN_REG_46E8 + EXT_NUM_MAIN_46E8
  479. #define EXT_MAIN_REG_83CX EXT_MAIN_REG_63CX + EXT_NUM_MAIN_63CX
  480. #define EXT_MAIN_REG_93CX EXT_MAIN_REG_83CX + EXT_NUM_MAIN_83CX
  481. #define VGA_EXT_GRAPH_CONT_OFFSET (VGA_EXT_CRTC_OFFSET + \
  482. EXT_NUM_CRTC_PORTS)
  483. #define VGA_EXT_ATTRIB_CONT_OFFSET (VGA_EXT_GRAPH_CONT_OFFSET + \
  484. EXT_NUM_GRAPH_CONT_PORTS)
  485. #define VGA_EXT_DAC_OFFSET (VGA_EXT_ATTRIB_CONT_OFFSET + \
  486. EXT_NUM_ATTRIB_CONT_PORTS)
  487. #define VGA_VALIDATOR_OFFSET (VGA_EXT_DAC_OFFSET + 4 * EXT_NUM_DAC_ENTRIES)
  488. #define VGA_VALIDATOR_AREA_SIZE sizeof (ULONG) + (VGA_MAX_VALIDATOR_DATA * \
  489. sizeof (VGA_VALIDATOR_DATA)) + \
  490. sizeof (ULONG) + \
  491. sizeof (ULONG) + \
  492. sizeof (PVIDEO_ACCESS_RANGE)
  493. #define VGA_MISC_DATA_AREA_OFFSET VGA_VALIDATOR_OFFSET + VGA_VALIDATOR_AREA_SIZE
  494. #define VGA_MISC_DATA_AREA_SIZE 0
  495. #define VGA_PLANE_0_OFFSET VGA_MISC_DATA_AREA_OFFSET + \
  496. VGA_MISC_DATA_AREA_SIZE
  497. #define QV_FRAME_BUFFER_OFFSET VGA_PLANE_0_OFFSET
  498. #define VGA_PLANE_1_OFFSET VGA_PLANE_0_OFFSET + VGA_PLANE_SIZE
  499. #define VGA_PLANE_2_OFFSET VGA_PLANE_1_OFFSET + VGA_PLANE_SIZE
  500. #define VGA_PLANE_3_OFFSET VGA_PLANE_2_OFFSET + VGA_PLANE_SIZE
  501. //
  502. // Space needed to store all state data.
  503. //
  504. #ifdef QV_EXTENDED_SAVE
  505. #define QV_TOTAL_STATE_SIZE QV_FRAME_BUFFER_OFFSET + QV_FRAME_BUFFER_SIZE
  506. #else
  507. #define VGA_TOTAL_STATE_SIZE VGA_PLANE_3_OFFSET + VGA_PLANE_SIZE
  508. #endif
  509. //
  510. // Device extension for the driver object. This data is only used
  511. // locally, so this structure can be added to as needed.
  512. //
  513. typedef struct _HW_DEVICE_EXTENSION {
  514. PUCHAR IOAddress; // base I/O address of VGA ports
  515. PUCHAR VideoMemoryAddress; // base virtual memory address of VGA memory
  516. ULONG NumAvailableModes; // number of available modes this session
  517. ULONG ModeIndex; // index of current mode in ModesVGA[]
  518. PVIDEOMODE CurrentMode; // pointer to VIDEOMODE structure for
  519. // current mode
  520. USHORT FontPelColumns; // Width of the font in pels
  521. USHORT FontPelRows; // height of the font in pels
  522. VIDEO_CURSOR_POSITION CursorPosition; // current cursor position
  523. UCHAR CursorEnable; // whether cursor is enabled or not
  524. UCHAR CursorTopScanLine; // Cursor Start register setting (top scan)
  525. UCHAR CursorBottomScanLine; // Cursor End register setting (bottom scan)
  526. // add HW cursor data here
  527. PHYSICAL_ADDRESS PhysicalVideoMemoryBase; // physical memory address and
  528. ULONG PhysicalVideoMemoryLength; // length of display memory
  529. PHYSICAL_ADDRESS PhysicalMemoryMappedBase;// physical memory-mapped address and
  530. ULONG PhysicalMemoryMappedLength; // length of memory-mapped block
  531. // (zero when don't use MM I/O)
  532. PHYSICAL_ADDRESS PhysicalFrameBase; // physical memory address and
  533. ULONG PhysicalFrameLength; // length of display memory for the
  534. // current mode.
  535. VMEM_SIZE InstalledVmem; // minimum memory needed by current mode
  536. // adrianc 4/4/1993
  537. //
  538. // Replaced chipType fields with the VideoHardware structure.
  539. //
  540. struct _VIDEO_HARDWARE {
  541. ADAPTERTYPE AdapterType; // controller type
  542. MONCLASS MonClass; // monitor class
  543. ULONG ulEisaID; // Controller EISA ID
  544. ULONG ulHighAddress; // high address register contents
  545. BOOLEAN fBankSwitched; // TRUE if card is bankswitched
  546. LONG lFrequency; // vertical refresh rate of the monitor
  547. // -1 = not initialized from registry
  548. // 0 = COMPAQ monitor
  549. // XX = Third Party Monitor frequency
  550. } VideoHardware;
  551. //
  552. // $0003
  553. // 12/14/93 MikeD - Added for passing info to hardware accelerated DLL
  554. //
  555. VIDEO_CHIP_INFO VideoChipInfo;
  556. //
  557. // These 4 fields must be at the end of the device extension and must be
  558. // kept in this order since this data will be copied to and from the save
  559. // state buffer that is passed to and from the VDM.
  560. //
  561. ULONG TrappedValidatorCount; // number of entries in the Trapped
  562. // validator data Array.
  563. VGA_VALIDATOR_DATA TrappedValidatorData[VGA_MAX_VALIDATOR_DATA];
  564. // Data trapped by the validator routines
  565. // but not yet played back into the VGA
  566. // register.
  567. ULONG SequencerAddressValue; // Determines if the Sequencer Address Port
  568. // is currently selecting the SyncReset data
  569. // register.
  570. ULONG CurrentNumVdmAccessRanges; // Number of access ranges in
  571. // the access range array pointed
  572. // to by the next field
  573. PVIDEO_ACCESS_RANGE CurrentVdmAccessRange; // Access range currently
  574. // associated to the VDM
  575. ULONG DacCmd2; // Current contents of DacCmd2
  576. // register.
  577. } HW_DEVICE_EXTENSION, *PHW_DEVICE_EXTENSION;
  578. //
  579. // Hardware pointer information.
  580. //
  581. #define PTR_HEIGHT 32 // height of hardware pointer in scans
  582. #define PTR_WIDTH 4 // width of hardware pointer in bytes
  583. #define PTR_WIDTH_IN_PIXELS 32 // width of hardware pointer in pixels
  584. #define VIDEO_MODE_LOCAL_POINTER 0x08 // pointer moves done in display driver
  585. //
  586. // Function prototypes.
  587. //
  588. //
  589. // Entry points for the VGA validator. Used in VgaEmulatorAccessEntries[].
  590. //
  591. VP_STATUS
  592. VgaValidatorUcharEntry (
  593. ULONG Context,
  594. ULONG Port,
  595. UCHAR AccessMode,
  596. PUCHAR Data
  597. );
  598. VP_STATUS
  599. VgaValidatorUshortEntry (
  600. ULONG Context,
  601. ULONG Port,
  602. UCHAR AccessMode,
  603. PUSHORT Data
  604. );
  605. VP_STATUS
  606. VgaValidatorUlongEntry (
  607. ULONG Context,
  608. ULONG Port,
  609. UCHAR AccessMode,
  610. PULONG Data
  611. );
  612. BOOLEAN
  613. VgaPlaybackValidatorData (
  614. PVOID Context
  615. );
  616. VP_STATUS
  617. GetMonClass (
  618. PHW_DEVICE_EXTENSION pHwDeviceExtension);
  619. extern VOID DbgBreakPoint(VOID);
  620. //
  621. // Bank switch code start and end labels, define in HARDWARE.ASM
  622. //
  623. // Different versions based on current mode
  624. //
  625. extern VIDEO_ACCESS_RANGE QVisionAccessRange[];
  626. extern UCHAR QV4kAddrBankSwitchStart;
  627. extern UCHAR QV4kAddrBankSwitchEnd;
  628. extern UCHAR QV4kAddrPlanarHCBankSwitchStart;
  629. extern UCHAR QV4kAddrPlanarHCBankSwitchEnd;
  630. extern UCHAR QV4kAddrEnablePlanarHCStart;
  631. extern UCHAR QV4kAddrEnablePlanarHCEnd;
  632. extern UCHAR QV4kAddrDisablePlanarHCStart;
  633. extern UCHAR QV4kAddrDisablePlanarHCEnd;
  634. extern UCHAR QV16kAddrBankSwitchStart;
  635. extern UCHAR QV16kAddrBankSwitchEnd;
  636. extern UCHAR QV16kAddrPlanarHCBankSwitchStart;
  637. extern UCHAR QV16kAddrPlanarHCBankSwitchEnd;
  638. extern UCHAR QV16kAddrEnablePlanarHCStart;
  639. extern UCHAR QV16kAddrEnablePlanarHCEnd;
  640. extern UCHAR QV16kAddrDisablePlanarHCStart;
  641. extern UCHAR QV16kAddrDisablePlanarHCEnd;
  642. //
  643. // Vga init scripts for font loading
  644. //
  645. extern USHORT EnableA000Data[];
  646. extern USHORT DisableA000Color[];
  647. //
  648. // Mode Information
  649. //
  650. extern ULONG NumVideoModes;
  651. extern VIDEOMODE ModesVGA[];
  652. //
  653. // Extended graphics index registers
  654. //
  655. extern UCHAR extGraIndRegs[];
  656. extern UCHAR extV32GraIndRegs[];
  657. // adrianc 4/4/1993
  658. //
  659. // EISA IDs for the COMPAQ Video cards.
  660. //
  661. #define EISA_ID_AVGA 0x0130110E
  662. #define EISA_ID_QVISION_E 0x1130110E // EISA Qvision board
  663. #define EISA_ID_QVISION_I 0x2130110E // ISA Qvision board
  664. #define EISA_ID_FIR_E 0x1131110E // EISA FIR board
  665. #define EISA_ID_FIR_I 0x2131110E // ISA FIR board
  666. #define EISA_ID_JUNIPER_E 0x1231110E // EISA JUNIPER board
  667. #define EISA_ID_JUNIPER_I 0x2231110E // ISA JUNIPER board
  668. //
  669. // QVision register definitions
  670. //
  671. #define DATAPATH_CONTROL 0x5a
  672. #define ROPSELECT_NO_ROPS 0x00
  673. #define PIXELMASK_ONLY 0x00
  674. #define PLANARMASK_NONE_0XFF 0x04
  675. #define SRC_IS_PATTERN_REGS 0x02
  676. #define PREG_0 0x33CA
  677. #define PREG_1 0x33CB
  678. #define PREG_2 0x33CC
  679. #define PREG_3 0x33CD
  680. #define PREG_4 0x33CA
  681. #define PREG_5 0x33CB
  682. #define PREG_6 0x33CC
  683. #define PREG_7 0x33CD
  684. #define ARIES_CTL_1 0x63CA
  685. #define BLT_DEST_ADDR_LO 0x63CC
  686. #define BLT_DEST_ADDR_HI 0x63CE
  687. #define BITMAP_WIDTH 0x23C2
  688. #define BITMAP_HEIGHT 0x23C4
  689. #define BLT_CMD_0 0x33CE
  690. #define BLT_CMD_1 0x33CF
  691. #define XY_SRC_ADDR 0x40
  692. #define XY_DEST_ADDR 0x80
  693. #define BLT_FORWARD 0x00
  694. #define BLT_START 0x01
  695. #define GLOBAL_BUSY_BIT 0x40
  696.