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.

686 lines
20 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. vga.h
  5. Abstract:
  6. This module contains the definitions for the code that implements the
  7. VGA device driver.
  8. Author:
  9. Environment:
  10. Kernel mode
  11. Revision History:
  12. --*/
  13. //
  14. // Base address of VGA memory range. Also used as base address of VGA
  15. // memory when loading a font, which is done with the VGA mapped at A0000.
  16. //
  17. #define MEM_VGA 0xA0000
  18. #define MEM_VGA_SIZE 0x20000
  19. //
  20. // Index in the access range sturture for video memory
  21. // !!! This must match the VgaAccessRange structure !!!
  22. // !!! Memory is in the structure, index 2 (3rd entry) !!!
  23. #define VGA_MEMORY 2
  24. //
  25. // VGA port-related definitions.
  26. //
  27. //
  28. // Port definitions for filling the ACCSES_RANGES structure in the miniport
  29. // information, defines the range of I/O ports the VGA spans.
  30. // There is a break in the IO ports - a few ports are used for the parallel
  31. // port. Those cannot be defined in the ACCESS_RANGE, but are still mapped
  32. // so all VGA ports are in one address range.
  33. //
  34. #define VGA_BASE_IO_PORT 0x000003B0
  35. #define VGA_START_BREAK_PORT 0x000003BB
  36. #define VGA_END_BREAK_PORT 0x000003C0
  37. #define VGA_MAX_IO_PORT 0x000003DF
  38. //
  39. // VGA register definitions
  40. //
  41. // ports in monochrome mode
  42. #define CRTC_ADDRESS_PORT_MONO 0x0004 // CRT Controller Address and
  43. #define CRTC_DATA_PORT_MONO 0x0005 // Data registers in mono mode
  44. #define FEAT_CTRL_WRITE_PORT_MONO 0x000A // Feature Control write port
  45. // in mono mode
  46. #define INPUT_STATUS_1_MONO 0x000A // Input Status 1 register read
  47. // port in mono mode
  48. #define ATT_INITIALIZE_PORT_MONO INPUT_STATUS_1_MONO
  49. // Register to read to reset
  50. // Attribute Controller index/data
  51. #define ATT_ADDRESS_PORT 0x0010 // Attribute Controller Address and
  52. #define ATT_DATA_WRITE_PORT 0x0010 // Data registers share one port
  53. // for writes, but only Address is
  54. // readable at 0x3C0
  55. #define ATT_DATA_READ_PORT 0x0011 // Attribute Controller Data reg is
  56. // readable here
  57. #define MISC_OUTPUT_REG_WRITE_PORT 0x0012 // Miscellaneous Output reg write
  58. // port
  59. #define INPUT_STATUS_0_PORT 0x0012 // Input Status 0 register read
  60. // port
  61. #define VIDEO_SUBSYSTEM_ENABLE_PORT 0x0013 // Bit 0 enables/disables the
  62. // entire VGA subsystem
  63. #define SEQ_ADDRESS_PORT 0x0014 // Sequence Controller Address and
  64. #define SEQ_DATA_PORT 0x0015 // Data registers
  65. #define DAC_PIXEL_MASK_PORT 0x0016 // DAC pixel mask reg
  66. #define DAC_ADDRESS_READ_PORT 0x0017 // DAC register read index reg,
  67. // write-only
  68. #define DAC_STATE_PORT 0x0017 // DAC state (read/write),
  69. // read-only
  70. #define DAC_ADDRESS_WRITE_PORT 0x0018 // DAC register write index reg
  71. #define DAC_DATA_REG_PORT 0x0019 // DAC data transfer reg
  72. #define FEAT_CTRL_READ_PORT 0x001A // Feature Control read port
  73. #define MISC_OUTPUT_REG_READ_PORT 0x001C // Miscellaneous Output reg read
  74. // port
  75. #define GRAPH_ADDRESS_PORT 0x001E // Graphics Controller Address
  76. #define GRAPH_DATA_PORT 0x001F // and Data registers
  77. #define CRTC_ADDRESS_PORT_COLOR 0x0024 // CRT Controller Address and
  78. #define CRTC_DATA_PORT_COLOR 0x0025 // Data registers in color mode
  79. #define FEAT_CTRL_WRITE_PORT_COLOR 0x002A // Feature Control write port
  80. #define INPUT_STATUS_1_COLOR 0x002A // Input Status 1 register read
  81. // port in color mode
  82. #define ATT_INITIALIZE_PORT_COLOR INPUT_STATUS_1_COLOR
  83. // Register to read to reset
  84. // Attribute Controller index/data
  85. // toggle in color mode
  86. //
  87. // Offsets in HardwareStateHeader->PortValue[] of save areas for non-indexed
  88. // VGA registers.
  89. //
  90. #define CRTC_ADDRESS_MONO_OFFSET 0x04
  91. #define FEAT_CTRL_WRITE_MONO_OFFSET 0x0A
  92. #define ATT_ADDRESS_OFFSET 0x10
  93. #define MISC_OUTPUT_REG_WRITE_OFFSET 0x12
  94. #define VIDEO_SUBSYSTEM_ENABLE_OFFSET 0x13
  95. #define SEQ_ADDRESS_OFFSET 0x14
  96. #define DAC_PIXEL_MASK_OFFSET 0x16
  97. #define DAC_STATE_OFFSET 0x17
  98. #define DAC_ADDRESS_WRITE_OFFSET 0x18
  99. #define GRAPH_ADDRESS_OFFSET 0x1E
  100. #define CRTC_ADDRESS_COLOR_OFFSET 0x24
  101. #define FEAT_CTRL_WRITE_COLOR_OFFSET 0x2A
  102. //
  103. // VGA indexed register indexes.
  104. //
  105. #define IND_CURSOR_START 0x0A // index in CRTC of the Cursor Start
  106. #define IND_CURSOR_END 0x0B // and End registers
  107. #define IND_CURSOR_HIGH_LOC 0x0E // index in CRTC of the Cursor Location
  108. #define IND_CURSOR_LOW_LOC 0x0F // High and Low Registers
  109. #define IND_VSYNC_END 0x11 // index in CRTC of the Vertical Sync
  110. // End register, which has the bit
  111. // that protects/unprotects CRTC
  112. // index registers 0-7
  113. #define IND_SET_RESET_ENABLE 0x01 // index of Set/Reset Enable reg in GC
  114. #define IND_DATA_ROTATE 0x03 // index of Data Rotate reg in GC
  115. #define IND_READ_MAP 0x04 // index of Read Map reg in Graph Ctlr
  116. #define IND_GRAPH_MODE 0x05 // index of Mode reg in Graph Ctlr
  117. #define IND_GRAPH_MISC 0x06 // index of Misc reg in Graph Ctlr
  118. #define IND_BIT_MASK 0x08 // index of Bit Mask reg in Graph Ctlr
  119. #define IND_SYNC_RESET 0x00 // index of Sync Reset reg in Seq
  120. #define IND_MAP_MASK 0x02 // index of Map Mask in Sequencer
  121. #define IND_MEMORY_MODE 0x04 // index of Memory Mode reg in Seq
  122. #define IND_CRTC_PROTECT 0x11 // index of reg containing regs 0-7 in
  123. // CRTC
  124. #define START_SYNC_RESET_VALUE 0x01 // value for Sync Reset reg to start
  125. // synchronous reset
  126. #define END_SYNC_RESET_VALUE 0x03 // value for Sync Reset reg to end
  127. // synchronous reset
  128. //
  129. // Values for Attribute Controller Index register to turn video off
  130. // and on, by setting bit 5 to 0 (off) or 1 (on).
  131. //
  132. #define VIDEO_DISABLE 0
  133. #define VIDEO_ENABLE 0x20
  134. //
  135. // Value written to the Read Map register when identifying the existence of
  136. // a VGA in VgaInitialize. This value must be different from the final test
  137. // value written to the Bit Mask in that routine.
  138. //
  139. #define READ_MAP_TEST_SETTING 0x03
  140. //
  141. // Masks to keep only the significant bits of the Graphics Controller and
  142. // Sequencer Address registers. Masking is necessary because some VGAs, such
  143. // as S3-based ones, don't return unused bits set to 0, and some SVGAs use
  144. // these bits if extensions are enabled.
  145. //
  146. #define GRAPH_ADDR_MASK 0x0F
  147. #define SEQ_ADDR_MASK 0x07
  148. //
  149. // Mask used to toggle Chain4 bit in the Sequencer's Memory Mode register.
  150. //
  151. #define CHAIN4_MASK 0x08
  152. //
  153. // Default text mode setting for various registers, used to restore their
  154. // states if VGA detection fails after they've been modified.
  155. //
  156. #define MEMORY_MODE_TEXT_DEFAULT 0x02
  157. #define BIT_MASK_DEFAULT 0xFF
  158. #define READ_MAP_DEFAULT 0x00
  159. //
  160. // Palette-related info.
  161. //
  162. //
  163. // Highest valid DAC color register index.
  164. //
  165. #define VIDEO_MAX_COLOR_REGISTER 0xFF
  166. //
  167. // Highest valid palette register index
  168. //
  169. #define VIDEO_MAX_PALETTE_REGISTER 0x0F
  170. //
  171. // For a mode, the type of banking supported. Controls the information
  172. // returned in VIDEO_BANK_SELECT. PlanarHCBanking includes NormalBanking.
  173. //
  174. typedef enum _BANK_TYPE {
  175. NoBanking = 0,
  176. NormalBanking,
  177. PlanarHCBanking
  178. } BANK_TYPE, *PBANK_TYPE;
  179. //
  180. // Structure used to describe each video mode in ModesVGA[].
  181. //
  182. typedef struct {
  183. USHORT fbType; // color or monochrome, text or graphics, via
  184. // VIDEO_MODE_COLOR and VIDEO_MODE_GRAPHICS
  185. USHORT numPlanes; // # of video memory planes
  186. USHORT bitsPerPlane; // # of bits of color in each plane
  187. SHORT col; // # of text columns across screen with default font
  188. SHORT row; // # of text rows down screen with default font
  189. USHORT hres; // # of pixels across screen
  190. USHORT vres; // # of scan lines down screen
  191. USHORT frequency; // refresh rate in Hz
  192. USHORT wbytes; // # of bytes from start of one scan line to start of next
  193. ULONG sbytes; // total size of addressable display memory in bytes
  194. BANK_TYPE banktype; // NoBanking, NormalBanking, PlanarHCBanking
  195. #ifdef INT10_MODE_SET
  196. ULONG Int10ModeNumber;
  197. #else
  198. PUSHORT CmdStrings; // pointer to array of register-setting commands
  199. #endif
  200. ULONG MemoryBase; // Base of frame buffer
  201. ULONG FrameOffset; // Offset from beginning of frame buffer for this mode
  202. ULONG FrameLength; // Size of available frame buffer
  203. ULONG MemoryLength; // Total memory
  204. ULONG PixelsPerScan; // This is larger than hres if we need to stretch scan
  205. BOOLEAN NonVgaHardware; // If this mode is compatible with VGA hw register & io ports
  206. ULONG Granularity; // The window granularity for banked modes
  207. } VIDEOMODE, *PVIDEOMODE;
  208. //
  209. // Mode into which to put the VGA before starting a VDM, so it's a plain
  210. // vanilla VGA. (This is the mode's index in ModesVGA[], currently standard
  211. // 80x25 text mode.)
  212. //
  213. #define DEFAULT_MODE 0
  214. //
  215. // Info for the validator functions.
  216. //
  217. //
  218. // Number of each type of indexed register in a standard VGA, used by
  219. // validator and state save/restore functions.
  220. //
  221. // Note: VDMs currently only support basic VGAs only.
  222. //
  223. #define VGA_NUM_SEQUENCER_PORTS 5
  224. #define VGA_NUM_CRTC_PORTS 25
  225. #define VGA_NUM_GRAPH_CONT_PORTS 9
  226. #define VGA_NUM_ATTRIB_CONT_PORTS 21
  227. #define VGA_NUM_DAC_ENTRIES 256
  228. //
  229. // Number of each type of extended indexed register.
  230. //
  231. #define EXT_NUM_SEQUENCER_PORTS 0
  232. #define EXT_NUM_CRTC_PORTS 0
  233. #define EXT_NUM_GRAPH_CONT_PORTS 0
  234. #define EXT_NUM_ATTRIB_CONT_PORTS 0
  235. #define EXT_NUM_DAC_ENTRIES 0
  236. //
  237. // Info used by the Validator functions and save/restore code.
  238. // Structure used to trap register accesses that must be done atomically.
  239. //
  240. #define VGA_MAX_VALIDATOR_DATA 100
  241. #define VGA_VALIDATOR_UCHAR_ACCESS 1
  242. #define VGA_VALIDATOR_USHORT_ACCESS 2
  243. #define VGA_VALIDATOR_ULONG_ACCESS 3
  244. typedef struct _VGA_VALIDATOR_DATA {
  245. ULONG Port;
  246. UCHAR AccessType;
  247. ULONG Data;
  248. } VGA_VALIDATOR_DATA, *PVGA_VALIDATOR_DATA;
  249. //
  250. // Info for the save and restore state functions.
  251. //
  252. //
  253. // Number of bytes to save in each plane.
  254. //
  255. #define VGA_PLANE_SIZE 0x10000
  256. //
  257. // These constants determine the offsets within the
  258. // VIDEO_HARDWARE_STATE_HEADER structure that are used to save and
  259. // restore the VGA's state.
  260. //
  261. #define VGA_HARDWARE_STATE_SIZE sizeof(VIDEO_HARDWARE_STATE_HEADER)
  262. #define VGA_BASIC_SEQUENCER_OFFSET (VGA_HARDWARE_STATE_SIZE + 0)
  263. #define VGA_BASIC_CRTC_OFFSET (VGA_BASIC_SEQUENCER_OFFSET + \
  264. VGA_NUM_SEQUENCER_PORTS)
  265. #define VGA_BASIC_GRAPH_CONT_OFFSET (VGA_BASIC_CRTC_OFFSET + \
  266. VGA_NUM_CRTC_PORTS)
  267. #define VGA_BASIC_ATTRIB_CONT_OFFSET (VGA_BASIC_GRAPH_CONT_OFFSET + \
  268. VGA_NUM_GRAPH_CONT_PORTS)
  269. #define VGA_BASIC_DAC_OFFSET (VGA_BASIC_ATTRIB_CONT_OFFSET + \
  270. VGA_NUM_ATTRIB_CONT_PORTS)
  271. #define VGA_BASIC_LATCHES_OFFSET (VGA_BASIC_DAC_OFFSET + \
  272. (3 * VGA_NUM_DAC_ENTRIES))
  273. #define VGA_EXT_SEQUENCER_OFFSET (VGA_BASIC_LATCHES_OFFSET + 4)
  274. #define VGA_EXT_CRTC_OFFSET (VGA_EXT_SEQUENCER_OFFSET + \
  275. EXT_NUM_SEQUENCER_PORTS)
  276. #define VGA_EXT_GRAPH_CONT_OFFSET (VGA_EXT_CRTC_OFFSET + \
  277. EXT_NUM_CRTC_PORTS)
  278. #define VGA_EXT_ATTRIB_CONT_OFFSET (VGA_EXT_GRAPH_CONT_OFFSET + \
  279. EXT_NUM_GRAPH_CONT_PORTS)
  280. #define VGA_EXT_DAC_OFFSET (VGA_EXT_ATTRIB_CONT_OFFSET + \
  281. EXT_NUM_ATTRIB_CONT_PORTS)
  282. #define VGA_VALIDATOR_OFFSET (VGA_EXT_DAC_OFFSET + 4 * EXT_NUM_DAC_ENTRIES)
  283. #define VGA_VALIDATOR_AREA_SIZE sizeof (ULONG) + (VGA_MAX_VALIDATOR_DATA * \
  284. sizeof (VGA_VALIDATOR_DATA)) + \
  285. sizeof (ULONG) + \
  286. sizeof (ULONG) + \
  287. sizeof (PVIDEO_ACCESS_RANGE)
  288. #define VGA_MISC_DATA_AREA_OFFSET VGA_VALIDATOR_OFFSET + VGA_VALIDATOR_AREA_SIZE
  289. #define VGA_MISC_DATA_AREA_SIZE 0
  290. #define VGA_PLANE_0_OFFSET VGA_MISC_DATA_AREA_OFFSET + VGA_MISC_DATA_AREA_SIZE
  291. #define VGA_PLANE_1_OFFSET VGA_PLANE_0_OFFSET + VGA_PLANE_SIZE
  292. #define VGA_PLANE_2_OFFSET VGA_PLANE_1_OFFSET + VGA_PLANE_SIZE
  293. #define VGA_PLANE_3_OFFSET VGA_PLANE_2_OFFSET + VGA_PLANE_SIZE
  294. //
  295. // Space needed to store all state data.
  296. //
  297. #define VGA_TOTAL_STATE_SIZE VGA_PLANE_3_OFFSET + VGA_PLANE_SIZE
  298. //
  299. // Device extension for the driver object. This data is only used
  300. // locally, so this structure can be added to as needed.
  301. //
  302. typedef struct _HW_DEVICE_EXTENSION {
  303. PUCHAR IOAddress; // base I/O address of VGA ports
  304. PVOID VideoMemoryAddress; // base virtual memory address of VGA memory
  305. ULONG ModeIndex; // index of current mode in ModesVGA[]
  306. PVIDEOMODE CurrentMode; // pointer to VIDEOMODE structure for
  307. // current mode
  308. USHORT FontPelColumns; // Width of the font in pels
  309. USHORT FontPelRows; // height of the font in pels
  310. VIDEO_CURSOR_POSITION CursorPosition; // current cursor position
  311. UCHAR CursorEnable; // whether cursor is enabled or not
  312. UCHAR CursorTopScanLine; // Cursor Start register setting (top scan)
  313. UCHAR CursorBottomScanLine; // Cursor End register setting (bottom scan)
  314. PHYSICAL_ADDRESS PhysicalVideoMemoryBase; // physical memory address and
  315. ULONG PhysicalVideoMemoryLength; // length of display memory
  316. PHYSICAL_ADDRESS PhysicalFrameBaseOffset; // physical memory address and
  317. ULONG PhysicalFrameLength; // length of display memory for
  318. // the current mode.
  319. //
  320. // These 4 fields must be at the end of the device extension and must be
  321. // kept in this order since this data will be copied to and from the save
  322. // state buffer that is passed to and from the VDM.
  323. //
  324. ULONG TrappedValidatorCount; // number of entries in the Trapped
  325. // validator data Array.
  326. VGA_VALIDATOR_DATA TrappedValidatorData[VGA_MAX_VALIDATOR_DATA];
  327. // Data trapped by the validator routines
  328. // but not yet played back into the VGA
  329. // register.
  330. ULONG SequencerAddressValue; // Determines if the Sequencer Address Port
  331. // is currently selecting the SyncReset data
  332. // register.
  333. ULONG CurrentNumVdmAccessRanges; // Number of access ranges in
  334. // the access range array pointed
  335. // to by the next field
  336. PVIDEO_ACCESS_RANGE CurrentVdmAccessRange; // Access range currently
  337. // associated to the VDM
  338. VIDEO_PORT_INT10_INTERFACE Int10; // Int10 interface
  339. USHORT VdmSeg; // Segment of Bios transfer area
  340. USHORT VdmOff; // Offset of Bios transfer area
  341. } HW_DEVICE_EXTENSION, *PHW_DEVICE_EXTENSION;
  342. //
  343. // Function prototypes.
  344. //
  345. VP_STATUS
  346. VgaFindAdapter(
  347. PVOID HwDeviceExtension,
  348. PVOID HwContext,
  349. PWSTR ArgumentString,
  350. PVIDEO_PORT_CONFIG_INFO ConfigInfo,
  351. PUCHAR Again
  352. );
  353. BOOLEAN
  354. VgaInitialize(
  355. PVOID HwDeviceExtension
  356. );
  357. BOOLEAN
  358. VgaStartIO(
  359. PVOID HwDeviceExtension,
  360. PVIDEO_REQUEST_PACKET RequestPacket
  361. );
  362. //
  363. // Private function prototypes.
  364. //
  365. VP_STATUS
  366. VgaQueryAvailableModes(
  367. PHW_DEVICE_EXTENSION HwDeviceExtension,
  368. PVIDEO_MODE_INFORMATION ModeInformation,
  369. ULONG ModeInformationSize,
  370. PULONG OutputSize
  371. );
  372. VP_STATUS
  373. VgaQueryNumberOfAvailableModes(
  374. PHW_DEVICE_EXTENSION HwDeviceExtension,
  375. PVIDEO_NUM_MODES NumModes,
  376. ULONG NumModesSize,
  377. PULONG OutputSize
  378. );
  379. VP_STATUS
  380. VgaQueryCurrentMode(
  381. PHW_DEVICE_EXTENSION HwDeviceExtension,
  382. PVIDEO_MODE_INFORMATION ModeInformation,
  383. ULONG ModeInformationSize,
  384. PULONG OutputSize
  385. );
  386. VP_STATUS
  387. VgaSetMode(
  388. PHW_DEVICE_EXTENSION HwDeviceExtension,
  389. PVIDEO_MODE Mode,
  390. ULONG ModeSize,
  391. PULONG FrameBufferIsMoved
  392. );
  393. VP_STATUS
  394. VgaLoadAndSetFont(
  395. PHW_DEVICE_EXTENSION HwDeviceExtension,
  396. PVIDEO_LOAD_FONT_INFORMATION FontInformation,
  397. ULONG FontInformationSize
  398. );
  399. VP_STATUS
  400. VgaQueryCursorPosition(
  401. PHW_DEVICE_EXTENSION HwDeviceExtension,
  402. PVIDEO_CURSOR_POSITION CursorPosition,
  403. ULONG CursorPositionSize,
  404. PULONG OutputSize
  405. );
  406. VP_STATUS
  407. VgaSetCursorPosition(
  408. PHW_DEVICE_EXTENSION HwDeviceExtension,
  409. PVIDEO_CURSOR_POSITION CursorPosition,
  410. ULONG CursorPositionSize
  411. );
  412. VP_STATUS
  413. VgaQueryCursorAttributes(
  414. PHW_DEVICE_EXTENSION HwDeviceExtension,
  415. PVIDEO_CURSOR_ATTRIBUTES CursorAttributes,
  416. ULONG CursorAttributesSize,
  417. PULONG OutputSize
  418. );
  419. VP_STATUS
  420. VgaSetCursorAttributes(
  421. PHW_DEVICE_EXTENSION HwDeviceExtension,
  422. PVIDEO_CURSOR_ATTRIBUTES CursorAttributes,
  423. ULONG CursorAttributesSize
  424. );
  425. BOOLEAN
  426. VgaIsPresent(
  427. PHW_DEVICE_EXTENSION HwDeviceExtension
  428. );
  429. VP_STATUS
  430. VgaInterpretCmdStream(
  431. PHW_DEVICE_EXTENSION HwDeviceExtension,
  432. PUSHORT pusCmdStream
  433. );
  434. VP_STATUS
  435. VgaSetPaletteReg(
  436. PHW_DEVICE_EXTENSION HwDeviceExtension,
  437. PVIDEO_PALETTE_DATA PaletteBuffer,
  438. ULONG PaletteBufferSize
  439. );
  440. VP_STATUS
  441. VgaSetColorLookup(
  442. PHW_DEVICE_EXTENSION HwDeviceExtension,
  443. PVIDEO_CLUT ClutBuffer,
  444. ULONG ClutBufferSize
  445. );
  446. VP_STATUS
  447. VgaRestoreHardwareState(
  448. PHW_DEVICE_EXTENSION HwDeviceExtension,
  449. PVIDEO_HARDWARE_STATE HardwareState,
  450. ULONG HardwareStateSize
  451. );
  452. VP_STATUS
  453. VgaSaveHardwareState(
  454. PHW_DEVICE_EXTENSION HwDeviceExtension,
  455. PVIDEO_HARDWARE_STATE HardwareState,
  456. ULONG HardwareStateSize,
  457. PULONG OutputSize
  458. );
  459. VP_STATUS
  460. VgaGetBankSelectCode(
  461. PHW_DEVICE_EXTENSION HwDeviceExtension,
  462. PVIDEO_BANK_SELECT BankSelect,
  463. ULONG BankSelectSize,
  464. PULONG OutputSize
  465. );
  466. VOID
  467. VgaZeroVideoMemory(
  468. PHW_DEVICE_EXTENSION HwDeviceExtension
  469. );
  470. //
  471. // Entry points for the VGA validator. Used in VgaEmulatorAccessEntries[].
  472. //
  473. VP_STATUS
  474. VgaValidatorUcharEntry (
  475. ULONG_PTR Context,
  476. ULONG Port,
  477. UCHAR AccessMode,
  478. PUCHAR Data
  479. );
  480. VP_STATUS
  481. VgaValidatorUshortEntry (
  482. ULONG_PTR Context,
  483. ULONG Port,
  484. UCHAR AccessMode,
  485. PUSHORT Data
  486. );
  487. VP_STATUS
  488. VgaValidatorUlongEntry (
  489. ULONG_PTR Context,
  490. ULONG Port,
  491. UCHAR AccessMode,
  492. PULONG Data
  493. );
  494. BOOLEAN
  495. VgaPlaybackValidatorData (
  496. PVOID Context
  497. );
  498. VP_STATUS
  499. VgaSetBankPosition(
  500. PHW_DEVICE_EXTENSION hwDeviceExtension,
  501. PBANK_POSITION BankPosition
  502. );
  503. USHORT
  504. RaiseToPower2(
  505. USHORT x
  506. );
  507. ULONG
  508. RaiseToPower2Ulong(
  509. ULONG x
  510. );
  511. BOOLEAN
  512. IsPower2(
  513. USHORT x
  514. );
  515. //
  516. // Global to make sure driver is only loaded once.
  517. //
  518. extern ULONG VgaLoaded;
  519. #if DBG
  520. #define MAX_CONTROL_HISTORY 512
  521. extern ULONG giControlCode;
  522. extern ULONG gaIOControlCode[];
  523. #endif
  524. //
  525. // Bank switch code start and end labels, define in HARDWARE.ASM
  526. //
  527. extern UCHAR BankSwitchStart;
  528. extern UCHAR BankSwitchEnd;
  529. //
  530. // Vga init scripts for font loading
  531. //
  532. extern USHORT EnableA000Data[];
  533. extern USHORT DisableA000Color[];
  534. extern USHORT VGA_640x480[];
  535. extern USHORT VGA_TEXT_0[];
  536. extern USHORT VGA_TEXT_1[];
  537. extern USHORT ModeX240[];
  538. extern USHORT ModeX200[];
  539. extern USHORT ModeXDoubleScans[];
  540. extern VIDEOMODE ModesVGA[];
  541. extern ULONG NumVideoModes;
  542. extern PVIDEOMODE VgaModeList;
  543. #define NUM_VGA_ACCESS_RANGES 5
  544. extern VIDEO_ACCESS_RANGE VgaAccessRange[];
  545. #define VGA_NUM_EMULATOR_ACCESS_ENTRIES 8
  546. extern EMULATOR_ACCESS_ENTRY VgaEmulatorAccessEntries[];
  547. #define NUM_MINIMAL_VGA_VALIDATOR_ACCESS_RANGE 5
  548. extern VIDEO_ACCESS_RANGE MinimalVgaValidatorAccessRange[];
  549. #define NUM_FULL_VGA_VALIDATOR_ACCESS_RANGE 3
  550. extern VIDEO_ACCESS_RANGE FullVgaValidatorAccessRange[];