Leaked source code of windows server 2003
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.

747 lines
22 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. // Hardware ID for detected monitor
  172. //
  173. #define VGA_MONITOR_ID 0x12345678
  174. //
  175. // For a mode, the type of banking supported. Controls the information
  176. // returned in VIDEO_BANK_SELECT. PlanarHCBanking includes NormalBanking.
  177. //
  178. typedef enum _BANK_TYPE {
  179. NoBanking = 0,
  180. NormalBanking,
  181. PlanarHCBanking
  182. } BANK_TYPE, *PBANK_TYPE;
  183. //
  184. // Structure used to describe each video mode in ModesVGA[].
  185. //
  186. typedef struct {
  187. USHORT fbType; // color or monochrome, text or graphics, via
  188. // VIDEO_MODE_COLOR and VIDEO_MODE_GRAPHICS
  189. USHORT numPlanes; // # of video memory planes
  190. USHORT bitsPerPlane; // # of bits of color in each plane
  191. SHORT col; // # of text columns across screen with default font
  192. SHORT row; // # of text rows down screen with default font
  193. USHORT hres; // # of pixels across screen
  194. USHORT vres; // # of scan lines down screen
  195. USHORT frequency; // refresh rate in Hz
  196. USHORT wbytes; // # of bytes from start of one scan line to start of next
  197. ULONG sbytes; // total size of addressable display memory in bytes
  198. BANK_TYPE banktype; // NoBanking, NormalBanking, PlanarHCBanking
  199. ULONG Int10ModeNumber;
  200. PUSHORT CmdStrings; // pointer to array of register-setting commands
  201. ULONG MemoryBase; // Base of frame buffer
  202. ULONG FrameOffset; // Offset from beginning of frame buffer for this mode
  203. ULONG FrameLength; // Size of available frame buffer
  204. ULONG MemoryLength; // Total memory
  205. ULONG PixelsPerScan; // This is larger than hres if we need to stretch scan
  206. BOOLEAN NonVgaHardware; // If this mode is compatible with VGA hw register & io ports
  207. ULONG Granularity; // The window granularity for banked modes
  208. } VIDEOMODE, *PVIDEOMODE;
  209. //
  210. // Mode into which to put the VGA before starting a VDM, so it's a plain
  211. // vanilla VGA. (This is the mode's index in ModesVGA[], currently standard
  212. // 80x25 text mode.)
  213. //
  214. #define DEFAULT_MODE 0
  215. //
  216. // Info for the validator functions.
  217. //
  218. //
  219. // Number of each type of indexed register in a standard VGA, used by
  220. // validator and state save/restore functions.
  221. //
  222. // Note: VDMs currently only support basic VGAs only.
  223. //
  224. #define VGA_NUM_SEQUENCER_PORTS 5
  225. #define VGA_NUM_CRTC_PORTS 25
  226. #define VGA_NUM_GRAPH_CONT_PORTS 9
  227. #define VGA_NUM_ATTRIB_CONT_PORTS 21
  228. #define VGA_NUM_DAC_ENTRIES 256
  229. //
  230. // Number of each type of extended indexed register.
  231. //
  232. #define EXT_NUM_SEQUENCER_PORTS 0
  233. #define EXT_NUM_CRTC_PORTS 0
  234. #define EXT_NUM_GRAPH_CONT_PORTS 0
  235. #define EXT_NUM_ATTRIB_CONT_PORTS 0
  236. #define EXT_NUM_DAC_ENTRIES 0
  237. //
  238. // Info used by the Validator functions and save/restore code.
  239. // Structure used to trap register accesses that must be done atomically.
  240. //
  241. #define VGA_MAX_VALIDATOR_DATA 100
  242. #define VGA_VALIDATOR_UCHAR_ACCESS 1
  243. #define VGA_VALIDATOR_USHORT_ACCESS 2
  244. #define VGA_VALIDATOR_ULONG_ACCESS 3
  245. typedef struct _VGA_VALIDATOR_DATA {
  246. ULONG Port;
  247. UCHAR AccessType;
  248. ULONG Data;
  249. } VGA_VALIDATOR_DATA, *PVGA_VALIDATOR_DATA;
  250. //
  251. // Info for the save and restore state functions.
  252. //
  253. //
  254. // Number of bytes to save in each plane.
  255. //
  256. #define VGA_PLANE_SIZE 0x10000
  257. //
  258. // These constants determine the offsets within the
  259. // VIDEO_HARDWARE_STATE_HEADER structure that are used to save and
  260. // restore the VGA's state.
  261. //
  262. #define VGA_HARDWARE_STATE_SIZE sizeof(VIDEO_HARDWARE_STATE_HEADER)
  263. #define VGA_BASIC_SEQUENCER_OFFSET (VGA_HARDWARE_STATE_SIZE + 0)
  264. #define VGA_BASIC_CRTC_OFFSET (VGA_BASIC_SEQUENCER_OFFSET + \
  265. VGA_NUM_SEQUENCER_PORTS)
  266. #define VGA_BASIC_GRAPH_CONT_OFFSET (VGA_BASIC_CRTC_OFFSET + \
  267. VGA_NUM_CRTC_PORTS)
  268. #define VGA_BASIC_ATTRIB_CONT_OFFSET (VGA_BASIC_GRAPH_CONT_OFFSET + \
  269. VGA_NUM_GRAPH_CONT_PORTS)
  270. #define VGA_BASIC_DAC_OFFSET (VGA_BASIC_ATTRIB_CONT_OFFSET + \
  271. VGA_NUM_ATTRIB_CONT_PORTS)
  272. #define VGA_BASIC_LATCHES_OFFSET (VGA_BASIC_DAC_OFFSET + \
  273. (3 * VGA_NUM_DAC_ENTRIES))
  274. #define VGA_EXT_SEQUENCER_OFFSET (VGA_BASIC_LATCHES_OFFSET + 4)
  275. #define VGA_EXT_CRTC_OFFSET (VGA_EXT_SEQUENCER_OFFSET + \
  276. EXT_NUM_SEQUENCER_PORTS)
  277. #define VGA_EXT_GRAPH_CONT_OFFSET (VGA_EXT_CRTC_OFFSET + \
  278. EXT_NUM_CRTC_PORTS)
  279. #define VGA_EXT_ATTRIB_CONT_OFFSET (VGA_EXT_GRAPH_CONT_OFFSET + \
  280. EXT_NUM_GRAPH_CONT_PORTS)
  281. #define VGA_EXT_DAC_OFFSET (VGA_EXT_ATTRIB_CONT_OFFSET + \
  282. EXT_NUM_ATTRIB_CONT_PORTS)
  283. #define VGA_VALIDATOR_OFFSET (VGA_EXT_DAC_OFFSET + 4 * EXT_NUM_DAC_ENTRIES)
  284. #define VGA_VALIDATOR_AREA_SIZE sizeof (ULONG) + (VGA_MAX_VALIDATOR_DATA * \
  285. sizeof (VGA_VALIDATOR_DATA)) + \
  286. sizeof (ULONG) + \
  287. sizeof (ULONG) + \
  288. sizeof (PVIDEO_ACCESS_RANGE)
  289. #define VGA_MISC_DATA_AREA_OFFSET VGA_VALIDATOR_OFFSET + VGA_VALIDATOR_AREA_SIZE
  290. #define VGA_MISC_DATA_AREA_SIZE 0
  291. #define VGA_PLANE_0_OFFSET VGA_MISC_DATA_AREA_OFFSET + VGA_MISC_DATA_AREA_SIZE
  292. #define VGA_PLANE_1_OFFSET VGA_PLANE_0_OFFSET + VGA_PLANE_SIZE
  293. #define VGA_PLANE_2_OFFSET VGA_PLANE_1_OFFSET + VGA_PLANE_SIZE
  294. #define VGA_PLANE_3_OFFSET VGA_PLANE_2_OFFSET + VGA_PLANE_SIZE
  295. //
  296. // Space needed to store all state data.
  297. //
  298. #define VGA_TOTAL_STATE_SIZE VGA_PLANE_3_OFFSET + VGA_PLANE_SIZE
  299. //
  300. // We will always assume 128 byte edid's
  301. //
  302. #define EDID_BUFFER_SIZE 128
  303. //
  304. // Device extension for the driver object. This data is only used
  305. // locally, so this structure can be added to as needed.
  306. //
  307. typedef struct _HW_DEVICE_EXTENSION {
  308. PUCHAR IOAddress; // base I/O address of VGA ports
  309. PVOID VideoMemoryAddress; // base virtual memory address of VGA memory
  310. ULONG ModeIndex; // index of current mode in ModesVGA[]
  311. PVIDEOMODE CurrentMode; // pointer to VIDEOMODE structure for
  312. // current mode
  313. USHORT FontPelColumns; // Width of the font in pels
  314. USHORT FontPelRows; // height of the font in pels
  315. VIDEO_CURSOR_POSITION CursorPosition; // current cursor position
  316. UCHAR CursorEnable; // whether cursor is enabled or not
  317. UCHAR CursorTopScanLine; // Cursor Start register setting (top scan)
  318. UCHAR CursorBottomScanLine; // Cursor End register setting (bottom scan)
  319. PHYSICAL_ADDRESS PhysicalVideoMemoryBase; // physical memory address and
  320. ULONG PhysicalVideoMemoryLength; // length of display memory
  321. PHYSICAL_ADDRESS PhysicalFrameBaseOffset; // physical memory address and
  322. ULONG PhysicalFrameLength; // length of display memory for
  323. // the current mode.
  324. //
  325. // These 4 fields must be at the end of the device extension and must be
  326. // kept in this order since this data will be copied to and from the save
  327. // state buffer that is passed to and from the VDM.
  328. //
  329. ULONG TrappedValidatorCount; // number of entries in the Trapped
  330. // validator data Array.
  331. VGA_VALIDATOR_DATA TrappedValidatorData[VGA_MAX_VALIDATOR_DATA];
  332. // Data trapped by the validator routines
  333. // but not yet played back into the VGA
  334. // register.
  335. ULONG SequencerAddressValue; // Determines if the Sequencer Address Port
  336. // is currently selecting the SyncReset data
  337. // register.
  338. ULONG CurrentNumVdmAccessRanges; // Number of access ranges in
  339. // the access range array pointed
  340. // to by the next field
  341. PVIDEO_ACCESS_RANGE CurrentVdmAccessRange; // Access range currently
  342. // associated to the VDM
  343. VIDEO_PORT_INT10_INTERFACE Int10; // Int10 interface
  344. #if defined(PLUG_AND_PLAY)
  345. ULONG MonitorPowerCapabilities; // contains vesa power capabilites for
  346. // the monitor
  347. ULONG MonitorPowerState; // track the current monitor power
  348. // state
  349. UCHAR EdidBuffer[EDID_BUFFER_SIZE]; // cache the monitor edid
  350. BOOLEAN AlwaysUseCachedEdid; // use cache monitor edid when set
  351. USHORT VendorID; // pci vendor id
  352. USHORT DeviceID; // pci device id
  353. #endif
  354. } HW_DEVICE_EXTENSION, *PHW_DEVICE_EXTENSION;
  355. //
  356. // Function prototypes.
  357. //
  358. VP_STATUS
  359. VgaFindAdapter(
  360. PVOID HwDeviceExtension,
  361. PVOID HwContext,
  362. PWSTR ArgumentString,
  363. PVIDEO_PORT_CONFIG_INFO ConfigInfo,
  364. PUCHAR Again
  365. );
  366. BOOLEAN
  367. VgaInitialize(
  368. PVOID HwDeviceExtension
  369. );
  370. BOOLEAN
  371. VgaStartIO(
  372. PVOID HwDeviceExtension,
  373. PVIDEO_REQUEST_PACKET RequestPacket
  374. );
  375. //
  376. // Private function prototypes.
  377. //
  378. VP_STATUS
  379. VgaQueryAvailableModes(
  380. PHW_DEVICE_EXTENSION HwDeviceExtension,
  381. PVIDEO_MODE_INFORMATION ModeInformation,
  382. ULONG ModeInformationSize,
  383. PULONG OutputSize
  384. );
  385. VP_STATUS
  386. VgaQueryNumberOfAvailableModes(
  387. PHW_DEVICE_EXTENSION HwDeviceExtension,
  388. PVIDEO_NUM_MODES NumModes,
  389. ULONG NumModesSize,
  390. PULONG OutputSize
  391. );
  392. VP_STATUS
  393. VgaQueryCurrentMode(
  394. PHW_DEVICE_EXTENSION HwDeviceExtension,
  395. PVIDEO_MODE_INFORMATION ModeInformation,
  396. ULONG ModeInformationSize,
  397. PULONG OutputSize
  398. );
  399. VP_STATUS
  400. VgaSetMode(
  401. PHW_DEVICE_EXTENSION HwDeviceExtension,
  402. PVIDEO_MODE Mode,
  403. ULONG ModeSize,
  404. PULONG FrameBufferIsMoved
  405. );
  406. VP_STATUS
  407. VgaLoadAndSetFont(
  408. PHW_DEVICE_EXTENSION HwDeviceExtension,
  409. PVIDEO_LOAD_FONT_INFORMATION FontInformation,
  410. ULONG FontInformationSize
  411. );
  412. VP_STATUS
  413. VgaQueryCursorPosition(
  414. PHW_DEVICE_EXTENSION HwDeviceExtension,
  415. PVIDEO_CURSOR_POSITION CursorPosition,
  416. ULONG CursorPositionSize,
  417. PULONG OutputSize
  418. );
  419. VP_STATUS
  420. VgaSetCursorPosition(
  421. PHW_DEVICE_EXTENSION HwDeviceExtension,
  422. PVIDEO_CURSOR_POSITION CursorPosition,
  423. ULONG CursorPositionSize
  424. );
  425. VP_STATUS
  426. VgaQueryCursorAttributes(
  427. PHW_DEVICE_EXTENSION HwDeviceExtension,
  428. PVIDEO_CURSOR_ATTRIBUTES CursorAttributes,
  429. ULONG CursorAttributesSize,
  430. PULONG OutputSize
  431. );
  432. VP_STATUS
  433. VgaSetCursorAttributes(
  434. PHW_DEVICE_EXTENSION HwDeviceExtension,
  435. PVIDEO_CURSOR_ATTRIBUTES CursorAttributes,
  436. ULONG CursorAttributesSize
  437. );
  438. BOOLEAN
  439. VgaIsPresent(
  440. PHW_DEVICE_EXTENSION HwDeviceExtension
  441. );
  442. VP_STATUS
  443. VgaInterpretCmdStream(
  444. PHW_DEVICE_EXTENSION HwDeviceExtension,
  445. PUSHORT pusCmdStream
  446. );
  447. VP_STATUS
  448. VgaSetPaletteReg(
  449. PHW_DEVICE_EXTENSION HwDeviceExtension,
  450. PVIDEO_PALETTE_DATA PaletteBuffer,
  451. ULONG PaletteBufferSize
  452. );
  453. VP_STATUS
  454. VgaSetColorLookup(
  455. PHW_DEVICE_EXTENSION HwDeviceExtension,
  456. PVIDEO_CLUT ClutBuffer,
  457. ULONG ClutBufferSize
  458. );
  459. VP_STATUS
  460. VgaRestoreHardwareState(
  461. PHW_DEVICE_EXTENSION HwDeviceExtension,
  462. PVIDEO_HARDWARE_STATE HardwareState,
  463. ULONG HardwareStateSize
  464. );
  465. VP_STATUS
  466. VgaSaveHardwareState(
  467. PHW_DEVICE_EXTENSION HwDeviceExtension,
  468. PVIDEO_HARDWARE_STATE HardwareState,
  469. ULONG HardwareStateSize,
  470. PULONG OutputSize
  471. );
  472. VP_STATUS
  473. VgaGetBankSelectCode(
  474. PHW_DEVICE_EXTENSION HwDeviceExtension,
  475. PVIDEO_BANK_SELECT BankSelect,
  476. ULONG BankSelectSize,
  477. PULONG OutputSize
  478. );
  479. VOID
  480. VgaZeroVideoMemory(
  481. PHW_DEVICE_EXTENSION HwDeviceExtension
  482. );
  483. //
  484. // Entry points for the VGA validator. Used in VgaEmulatorAccessEntries[].
  485. //
  486. VP_STATUS
  487. VgaValidatorUcharEntry (
  488. ULONG_PTR Context,
  489. ULONG Port,
  490. UCHAR AccessMode,
  491. PUCHAR Data
  492. );
  493. VP_STATUS
  494. VgaValidatorUshortEntry (
  495. ULONG_PTR Context,
  496. ULONG Port,
  497. UCHAR AccessMode,
  498. PUSHORT Data
  499. );
  500. VP_STATUS
  501. VgaValidatorUlongEntry (
  502. ULONG_PTR Context,
  503. ULONG Port,
  504. UCHAR AccessMode,
  505. PULONG Data
  506. );
  507. BOOLEAN
  508. VgaPlaybackValidatorData (
  509. PVOID Context
  510. );
  511. VP_STATUS
  512. VgaSetBankPosition(
  513. PHW_DEVICE_EXTENSION hwDeviceExtension,
  514. PBANK_POSITION BankPosition
  515. );
  516. USHORT
  517. RaiseToPower2(
  518. USHORT x
  519. );
  520. ULONG
  521. RaiseToPower2Ulong(
  522. ULONG x
  523. );
  524. BOOLEAN
  525. IsPower2(
  526. USHORT x
  527. );
  528. VP_STATUS
  529. VgaGetPowerState(
  530. PVOID HwDeviceExtension,
  531. ULONG HwId,
  532. PVIDEO_POWER_MANAGEMENT VideoPowerControl
  533. );
  534. VP_STATUS
  535. VgaSetPowerState (
  536. PVOID HwDeviceExtension,
  537. ULONG HwId,
  538. PVIDEO_POWER_MANAGEMENT VideoPowerControl
  539. );
  540. ULONG
  541. VgaGetChildDescriptor(
  542. PVOID HwDeviceExtension,
  543. PVIDEO_CHILD_ENUM_INFO ChildEnumInfo,
  544. PVIDEO_CHILD_TYPE pChildType,
  545. PVOID pChildDescriptor,
  546. PULONG pUId,
  547. PULONG pUnused
  548. );
  549. VOID
  550. VgaGetMonitorEdid(
  551. PHW_DEVICE_EXTENSION hwDeviceExtension,
  552. PUCHAR Buffer,
  553. ULONG Size
  554. );
  555. VP_STATUS
  556. VgaAcquireResources(
  557. PHW_DEVICE_EXTENSION HwDeviceExtension
  558. );
  559. VOID
  560. VgaInitializeSpecialCase(
  561. PHW_DEVICE_EXTENSION hwDeviceExtension
  562. );
  563. //
  564. // Global to make sure driver is only loaded once.
  565. //
  566. extern ULONG VgaLoaded;
  567. #if DBG
  568. #define MAX_CONTROL_HISTORY 512
  569. extern ULONG giControlCode;
  570. extern ULONG gaIOControlCode[];
  571. #endif
  572. //
  573. // Bank switch code start and end labels, define in HARDWARE.ASM
  574. //
  575. extern UCHAR BankSwitchStart;
  576. extern UCHAR BankSwitchEnd;
  577. //
  578. // Vga init scripts for font loading
  579. //
  580. extern USHORT EnableA000Data[];
  581. extern USHORT DisableA000Color[];
  582. extern USHORT VGA_640x480[];
  583. extern USHORT VGA_TEXT_0[];
  584. extern USHORT VGA_TEXT_1[];
  585. extern USHORT ModeX240[];
  586. extern USHORT ModeX200[];
  587. extern USHORT ModeXDoubleScans[];
  588. extern VIDEOMODE ModesVGA[];
  589. extern ULONG NumVideoModes;
  590. extern PVIDEOMODE VgaModeList;
  591. #define NUM_VGA_ACCESS_RANGES 5
  592. #define NUM_STD_VGA_ACCESS_RANGES 3
  593. extern VIDEO_ACCESS_RANGE VgaAccessRange[];
  594. #define VGA_NUM_EMULATOR_ACCESS_ENTRIES 8
  595. extern EMULATOR_ACCESS_ENTRY VgaEmulatorAccessEntries[];
  596. #define NUM_MINIMAL_VGA_VALIDATOR_ACCESS_RANGE 5
  597. extern VIDEO_ACCESS_RANGE MinimalVgaValidatorAccessRange[];
  598. #define NUM_FULL_VGA_VALIDATOR_ACCESS_RANGE 3
  599. extern VIDEO_ACCESS_RANGE FullVgaValidatorAccessRange[];