xref: /reactos/sdk/include/ddk/video.h (revision 122eaeb6)
1 /*
2  * video.h
3  *
4  * Video port and miniport driver interface
5  *
6  * This file is part of the w32api package.
7  *
8  * Contributors:
9  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10  *
11  * THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  * This source code is offered for use in the public domain. You may
14  * use, modify or distribute it freely.
15  *
16  * This code is distributed in the hope that it will be useful but
17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  * DISCLAIMED. This includes but is not limited to warranties of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  */
22 
23 #pragma once
24 
25 #define __VIDEO_H__
26 
27 #include "ntddvdeo.h"
28 #include "videoagp.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #ifndef _NTOSDEF_
35 
36 #ifdef PAGED_CODE
37 #undef PAGED_CODE
38 #endif
39 
40 #if defined(_MSC_VER)
41 #define ALLOC_PRAGMA 1
42 #endif
43 
44 #if defined(_VIDEOPORT_)
45 #define VPAPI
46 #else
47 #define VPAPI DECLSPEC_IMPORT
48 #endif
49 
50 #if DBG
51 #define PAGED_CODE() \
52   if (VideoPortGetCurrentIrql() > 1 /* APC_LEVEL */) { \
53     VideoPortDebugPrint(Error, "Video: Pageable code called at IRQL %d\n", VideoPortGetCurrentIrql() ); \
54     ASSERT(FALSE); \
55   }
56 #else
57 #define PAGED_CODE()
58 #endif /* DBG */
59 
60 ULONG
61 NTAPI
62 DriverEntry(
63   PVOID Context1,
64   PVOID Context2);
65 
66 #else
67 
68 #define VPAPI
69 
70 #endif /* _NTOSDEF_ */
71 
72 #if DBG
73 #define VideoDebugPrint(x) VideoPortDebugPrint x
74 #else
75 #define VideoDebugPrint(x)
76 #endif
77 
78 #define GET_VIDEO_PHYSICAL_ADDRESS(scatterList,                        \
79                                    VirtualAddress,                     \
80                                    InputBuffer,                        \
81                                    pLength,                            \
82                                    Address)                            \
83   do {                                                                 \
84     ULONG_PTR byteOffset;                                              \
85                                                                        \
86     byteOffset = (PCHAR) VirtualAddress - (PCHAR)InputBuffer;          \
87     while (byteOffset >= scatterList->Length) {                        \
88       byteOffset -= scatterList->Length;                               \
89       scatterList++;                                                   \
90     }                                                                  \
91     *pLength = scatterList->Length - byteOffset;                       \
92     Address = (ULONG_PTR) (scatterList->PhysicalAddress + byteOffset); \
93   } while (0)
94 
95 #define GET_VIDEO_SCATTERGATHER(ppDma) (**(PVRB_SG **)ppDma)
96 
97 /* VIDEO_ACCESS_RANGE.RangePassive */
98 #define VIDEO_RANGE_PASSIVE_DECODE        1
99 #define VIDEO_RANGE_10_BIT_DECODE         2
100 
101 #define SIZE_OF_NT4_VIDEO_PORT_CONFIG_INFO FIELD_OFFSET(VIDEO_PORT_CONFIG_INFO, Master)
102 #define SIZE_OF_WXP_VIDEO_PORT_CONFIG_INFO sizeof(VIDEO_PORT_CONFIG_INFO)
103 
104 #define SET_USER_EVENT    0x01
105 #define SET_DISPLAY_EVENT 0x02
106 
107 #define EVENT_TYPE_MASK                   1
108 #define SYNCHRONIZATION_EVENT             0
109 #define NOTIFICATION_EVENT                1
110 
111 #define INITIAL_EVENT_STATE_MASK          2
112 #define INITIAL_EVENT_NOT_SIGNALED        0
113 #define INITIAL_EVENT_SIGNALED            2
114 
115 #define DISPLAY_ADAPTER_HW_ID             0xFFFFFFFF
116 
117 #define VIDEO_INVALID_CHILD_ID            0xFFFFFFFF
118 
119 #define SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA, HwStartDma)
120 #define SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA FIELD_OFFSET(VIDEO_HW_INITIALIZATION_DATA, Reserved)
121 #define SIZE_OF_WXP_VIDEO_HW_INITIALIZATION_DATA (SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA + sizeof(ULONG))
122 
123 #define VIDEO_PORT_AGP_INTERFACE_VERSION_1                 1
124 #define VIDEO_PORT_AGP_INTERFACE_VERSION_2                 2
125 #define VIDEO_PORT_I2C_INTERFACE_VERSION_1                 1
126 #define VIDEO_PORT_I2C_INTERFACE_VERSION_2                 2
127 #define VIDEO_PORT_INT10_INTERFACE_VERSION_1               1
128 #define VIDEO_PORT_WCMEMORYPROTECTION_INTERFACE_VERSION_1  1
129 #define VIDEO_PORT_DEBUG_REPORT_INTERFACE_VERSION_1        1
130 
131 /* Flags for VideoPortGetDeviceBase and VideoPortMapMemory */
132 #define VIDEO_MEMORY_SPACE_MEMORY         0x00
133 #define VIDEO_MEMORY_SPACE_IO             0x01
134 #define VIDEO_MEMORY_SPACE_USER_MODE      0x02
135 #define VIDEO_MEMORY_SPACE_DENSE          0x04
136 #define VIDEO_MEMORY_SPACE_P6CACHE        0x08
137 
138 /* PVIDEO_HW_GET_CHILD_DESCRIPTOR return values */
139 #define VIDEO_ENUM_MORE_DEVICES           ERROR_CONTINUE
140 #define VIDEO_ENUM_NO_MORE_DEVICES        ERROR_NO_MORE_DEVICES
141 #define VIDEO_ENUM_INVALID_DEVICE         ERROR_INVALID_NAME
142 
143 #define DEVICE_VGA_ENABLED                1
144 
145 /* VideoPortCheckForDeviceExistence.Flags constants */
146 #define CDE_USE_SUBSYSTEM_IDS             0x00000001
147 #define CDE_USE_REVISION                  0x00000002
148 
149 #define BUGCHECK_DATA_SIZE_RESERVED       48
150 
151 #define VIDEO_DEBUG_REPORT_MAX_SIZE       0x8000
152 
153 typedef LONG VP_STATUS, *PVP_STATUS;
154 typedef ULONG DMA_EVENT_FLAGS;
155 
156 typedef struct _VIDEO_PORT_SPIN_LOCK *PSPIN_LOCK;
157 typedef struct _VIDEO_DEBUG_REPORT *PVIDEO_DEBUG_REPORT;
158 typedef struct __DMA_PARAMETERS *PDMA;
159 typedef struct __VP_DMA_ADAPTER *PVP_DMA_ADAPTER;
160 
161 typedef PVOID
162 (NTAPI *PVIDEO_PORT_GET_PROC_ADDRESS)(
163   IN PVOID HwDeviceExtension,
164   IN PUCHAR FunctionName);
165 
166 typedef struct _VIDEO_PORT_CONFIG_INFO {
167   ULONG Length;
168   ULONG SystemIoBusNumber;
169   INTERFACE_TYPE AdapterInterfaceType;
170   ULONG BusInterruptLevel;
171   ULONG BusInterruptVector;
172   KINTERRUPT_MODE InterruptMode;
173   ULONG NumEmulatorAccessEntries;
174   PEMULATOR_ACCESS_ENTRY EmulatorAccessEntries;
175   ULONG_PTR EmulatorAccessEntriesContext;
176   PHYSICAL_ADDRESS VdmPhysicalVideoMemoryAddress;
177   ULONG VdmPhysicalVideoMemoryLength;
178   ULONG HardwareStateSize;
179   ULONG DmaChannel;
180   ULONG DmaPort;
181   UCHAR DmaShareable;
182   UCHAR InterruptShareable;
183   BOOLEAN Master;
184   DMA_WIDTH DmaWidth;
185   DMA_SPEED DmaSpeed;
186   BOOLEAN bMapBuffers;
187   BOOLEAN NeedPhysicalAddresses;
188   BOOLEAN DemandMode;
189   ULONG MaximumTransferLength;
190   ULONG NumberOfPhysicalBreaks;
191   BOOLEAN ScatterGather;
192   ULONG MaximumScatterGatherChunkSize;
193   PVIDEO_PORT_GET_PROC_ADDRESS VideoPortGetProcAddress;
194   PWSTR DriverRegistryPath;
195   ULONGLONG SystemMemorySize;
196 } VIDEO_PORT_CONFIG_INFO, *PVIDEO_PORT_CONFIG_INFO;
197 
198 typedef VP_STATUS
199 (NTAPI *PVIDEO_HW_FIND_ADAPTER)(
200   IN PVOID HwDeviceExtension,
201   IN PVOID HwContext,
202   IN PWSTR ArgumentString,
203   IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo,
204   OUT PUCHAR Again);
205 
206 typedef BOOLEAN
207 (NTAPI *PVIDEO_HW_INITIALIZE)(
208   IN PVOID HwDeviceExtension);
209 
210 typedef BOOLEAN
211 (NTAPI *PVIDEO_HW_INTERRUPT)(
212   IN PVOID HwDeviceExtension);
213 
214 typedef struct _VIDEO_ACCESS_RANGE {
215   PHYSICAL_ADDRESS RangeStart;
216   ULONG RangeLength;
217   UCHAR RangeInIoSpace;
218   UCHAR RangeVisible;
219   UCHAR RangeShareable;
220   UCHAR RangePassive;
221 } VIDEO_ACCESS_RANGE, *PVIDEO_ACCESS_RANGE;
222 
223 typedef VOID
224 (NTAPI *PVIDEO_HW_LEGACYRESOURCES)(
225   IN ULONG VendorId,
226   IN ULONG DeviceId,
227   IN OUT PVIDEO_ACCESS_RANGE *LegacyResourceList,
228   IN OUT PULONG LegacyResourceCount);
229 
230 typedef enum _HW_DMA_RETURN {
231   DmaAsyncReturn,
232   DmaSyncReturn
233 } HW_DMA_RETURN, *PHW_DMA_RETURN;
234 
235 typedef HW_DMA_RETURN
236 (NTAPI *PVIDEO_HW_START_DMA)(
237   PVOID HwDeviceExtension,
238   PDMA pDma);
239 
240 typedef struct _VP_SCATTER_GATHER_ELEMENT {
241   PHYSICAL_ADDRESS Address;
242   ULONG Length;
243   ULONG_PTR Reserved;
244 } VP_SCATTER_GATHER_ELEMENT, *PVP_SCATTER_GATHER_ELEMENT;
245 
246 typedef struct _VP_SCATTER_GATHER_LIST {
247   ULONG NumberOfElements;
248   ULONG_PTR Reserved;
249   VP_SCATTER_GATHER_ELEMENT Elements[0];
250 } VP_SCATTER_GATHER_LIST, *PVP_SCATTER_GATHER_LIST;
251 
252 typedef VOID
253 (NTAPI *PEXECUTE_DMA)(
254   IN PVOID HwDeviceExtension,
255   IN PVP_DMA_ADAPTER VpDmaAdapter,
256   IN PVP_SCATTER_GATHER_LIST SGList,
257   IN PVOID Context);
258 
259 /* PVIDEO_HW_GET_CHILD_DESCRIPTOR.ChildEnumInfo constants */
260 typedef struct _VIDEO_CHILD_ENUM_INFO {
261   ULONG Size;
262   ULONG ChildDescriptorSize;
263   ULONG ChildIndex;
264   ULONG ACPIHwId;
265   PVOID ChildHwDeviceExtension;
266 } VIDEO_CHILD_ENUM_INFO, *PVIDEO_CHILD_ENUM_INFO;
267 
268 /* PVIDEO_HW_GET_CHILD_DESCRIPTOR.VideoChildType constants */
269 typedef enum _VIDEO_CHILD_TYPE {
270   Monitor = 1,
271   NonPrimaryChip,
272   VideoChip,
273   Other
274 } VIDEO_CHILD_TYPE, *PVIDEO_CHILD_TYPE;
275 
276 typedef VP_STATUS
277 (NTAPI *PVIDEO_HW_GET_CHILD_DESCRIPTOR)(
278   IN PVOID HwDeviceExtension,
279   IN PVIDEO_CHILD_ENUM_INFO ChildEnumInfo,
280   OUT PVIDEO_CHILD_TYPE VideoChildType,
281   OUT PUCHAR pChildDescriptor,
282   OUT PULONG UId,
283   OUT PULONG pUnused);
284 
285 typedef VP_STATUS
286 (NTAPI *PVIDEO_HW_POWER_SET)(
287   IN PVOID HwDeviceExtension,
288   IN ULONG HwId,
289   IN PVIDEO_POWER_MANAGEMENT VideoPowerControl);
290 
291 typedef VP_STATUS
292 (NTAPI *PVIDEO_HW_POWER_GET)(
293   IN PVOID HwDeviceExtension,
294   IN ULONG HwId,
295   IN OUT PVIDEO_POWER_MANAGEMENT VideoPowerControl);
296 
297 typedef struct _QUERY_INTERFACE {
298   CONST GUID *InterfaceType;
299   USHORT Size;
300   USHORT Version;
301   PINTERFACE Interface;
302   PVOID InterfaceSpecificData;
303 } QUERY_INTERFACE, *PQUERY_INTERFACE;
304 
305 typedef VP_STATUS
306 (NTAPI *PVIDEO_HW_QUERY_INTERFACE)(
307   IN PVOID HwDeviceExtension,
308   IN OUT PQUERY_INTERFACE QueryInterface);
309 
310 typedef VP_STATUS
311 (NTAPI *PVIDEO_HW_CHILD_CALLBACK)(
312   PVOID HwDeviceExtension,
313   PVOID ChildDeviceExtension);
314 
315 typedef BOOLEAN
316 (NTAPI *PVIDEO_HW_RESET_HW)(
317   IN PVOID HwDeviceExtension,
318   IN ULONG Columns,
319   IN ULONG Rows);
320 
321 typedef struct _STATUS_BLOCK {
322   _ANONYMOUS_UNION union {
323     VP_STATUS Status;
324     PVOID Pointer;
325   } DUMMYUNIONNAME;
326   ULONG_PTR Information;
327 } STATUS_BLOCK, *PSTATUS_BLOCK;
328 
329 typedef struct _VIDEO_REQUEST_PACKET {
330   ULONG IoControlCode;
331   PSTATUS_BLOCK StatusBlock;
332   PVOID InputBuffer;
333   ULONG InputBufferLength;
334   PVOID OutputBuffer;
335   ULONG OutputBufferLength;
336 } VIDEO_REQUEST_PACKET, *PVIDEO_REQUEST_PACKET;
337 
338 typedef BOOLEAN
339 (NTAPI *PVIDEO_HW_START_IO)(
340   IN PVOID HwDeviceExtension,
341   IN PVIDEO_REQUEST_PACKET RequestPacket);
342 
343 typedef VOID
344 (NTAPI *PVIDEO_HW_TIMER)(
345   IN PVOID HwDeviceExtension);
346 
347 typedef VOID
348 (NTAPI *PVIDEO_WRITE_CLOCK_LINE)(
349   PVOID HwDeviceExtension,
350   UCHAR Data);
351 
352 typedef VOID
353 (NTAPI *PVIDEO_WRITE_DATA_LINE)(
354   PVOID HwDeviceExtension,
355   UCHAR Data);
356 
357 typedef BOOLEAN
358 (NTAPI *PVIDEO_READ_CLOCK_LINE)(
359   PVOID HwDeviceExtension);
360 
361 typedef BOOLEAN
362 (NTAPI *PVIDEO_READ_DATA_LINE)(
363   PVOID HwDeviceExtension);
364 
365 typedef VOID
366 (NTAPI *PVIDEO_WAIT_VSYNC_ACTIVE)(
367   PVOID HwDeviceExtension);
368 
369 typedef struct _I2C_CALLBACKS {
370   IN PVIDEO_WRITE_CLOCK_LINE WriteClockLine;
371   IN PVIDEO_WRITE_DATA_LINE WriteDataLine;
372   IN PVIDEO_READ_CLOCK_LINE ReadClockLine;
373   IN PVIDEO_READ_DATA_LINE ReadDataLine;
374 } I2C_CALLBACKS, *PI2C_CALLBACKS;
375 
376 typedef BOOLEAN
377 (NTAPI *PI2C_START)(
378   IN PVOID HwDeviceExtension,
379   IN PI2C_CALLBACKS I2CCallbacks);
380 
381 typedef BOOLEAN
382 (NTAPI *PI2C_STOP)(
383   IN PVOID HwDeviceExtension,
384   IN PI2C_CALLBACKS I2CCallbacks);
385 
386 typedef BOOLEAN
387 (NTAPI *PI2C_WRITE)(
388   IN PVOID HwDeviceExtension,
389   IN PI2C_CALLBACKS I2CCallbacks,
390   IN PUCHAR Buffer,
391   IN ULONG Length);
392 
393 typedef BOOLEAN
394 (NTAPI *PI2C_READ)(
395   IN PVOID HwDeviceExtension,
396   IN PI2C_CALLBACKS I2CCallbacks,
397   OUT PUCHAR Buffer,
398   IN ULONG Length);
399 
400 typedef struct _VIDEO_I2C_CONTROL {
401   IN PVIDEO_WRITE_CLOCK_LINE WriteClockLine;
402   IN PVIDEO_WRITE_DATA_LINE WriteDataLine;
403   IN PVIDEO_READ_CLOCK_LINE ReadClockLine;
404   IN PVIDEO_READ_DATA_LINE ReadDataLine;
405   IN ULONG I2CDelay;
406 } VIDEO_I2C_CONTROL, *PVIDEO_I2C_CONTROL;
407 
408 typedef BOOLEAN
409 (NTAPI *PI2C_START_2)(
410   IN PVOID HwDeviceExtension,
411   IN PVIDEO_I2C_CONTROL I2CControl);
412 
413 typedef BOOLEAN
414 (NTAPI *PI2C_STOP_2)(
415   IN PVOID HwDeviceExtension,
416   IN PVIDEO_I2C_CONTROL I2CControl);
417 
418 typedef BOOLEAN
419 (NTAPI *PI2C_WRITE_2)(
420   IN PVOID HwDeviceExtension,
421   IN PVIDEO_I2C_CONTROL I2CControl,
422   IN PUCHAR Buffer,
423   IN ULONG Length);
424 
425 typedef BOOLEAN
426 (NTAPI *PI2C_READ_2)(
427   IN PVOID HwDeviceExtension,
428   IN PVIDEO_I2C_CONTROL I2CControl,
429   OUT PUCHAR Buffer,
430   IN ULONG Length,
431   IN BOOLEAN EndOfRead);
432 
433 typedef struct _INT10_BIOS_ARGUMENTS {
434   ULONG Eax;
435   ULONG Ebx;
436   ULONG Ecx;
437   ULONG Edx;
438   ULONG Esi;
439   ULONG Edi;
440   ULONG Ebp;
441   USHORT SegDs;
442   USHORT SegEs;
443 } INT10_BIOS_ARGUMENTS, *PINT10_BIOS_ARGUMENTS;
444 
445 typedef VP_STATUS
446 (NTAPI *PINT10_CALL_BIOS)(
447   IN PVOID Context,
448   IN OUT PINT10_BIOS_ARGUMENTS BiosArguments);
449 
450 typedef VP_STATUS
451 (NTAPI *PINT10_ALLOCATE_BUFFER)(
452   IN PVOID Context,
453   OUT PUSHORT Seg,
454   OUT PUSHORT Off,
455   IN OUT PULONG Length);
456 
457 typedef VP_STATUS
458 (NTAPI *PINT10_FREE_BUFFER)(
459   IN PVOID Context,
460   IN USHORT Seg,
461   IN USHORT Off);
462 
463 typedef VP_STATUS
464 (NTAPI *PINT10_READ_MEMORY)(
465   IN PVOID Context,
466   IN USHORT Seg,
467   IN USHORT Off,
468   OUT PVOID Buffer,
469   IN ULONG Length);
470 
471 typedef VP_STATUS
472 (NTAPI *PINT10_WRITE_MEMORY)(
473   IN PVOID Context,
474   IN USHORT Seg,
475   IN USHORT Off,
476   IN PVOID Buffer,
477   IN ULONG Length);
478 
479 typedef VP_STATUS
480 (NTAPI *PROTECT_WC_MEMORY)(
481   IN PVOID Context,
482   IN PVOID HwDeviceExtension);
483 
484 typedef VP_STATUS
485 (NTAPI *RESTORE_WC_MEMORY)(
486   IN PVOID Context,
487   IN PVOID HwDeviceExtension);
488 
489 typedef enum _VIDEO_DEVICE_DATA_TYPE {
490   VpMachineData = 0,
491   VpCmosData,
492   VpBusData,
493   VpControllerData,
494   VpMonitorData
495 } VIDEO_DEVICE_DATA_TYPE, *PVIDEO_DEVICE_DATA_TYPE;
496 
497 typedef VP_STATUS
498 (NTAPI *PMINIPORT_QUERY_DEVICE_ROUTINE)(
499   IN PVOID HwDeviceExtension,
500   IN PVOID Context,
501   IN VIDEO_DEVICE_DATA_TYPE DeviceDataType,
502   IN PVOID Identifier,
503   IN ULONG IdentifierLength,
504   IN PVOID ConfigurationData,
505   IN ULONG ConfigurationDataLength,
506   IN OUT PVOID ComponentInformation,
507   IN ULONG ComponentInformationLength);
508 
509 typedef VP_STATUS
510 (NTAPI *PMINIPORT_GET_REGISTRY_ROUTINE)(
511   IN PVOID HwDeviceExtension,
512   IN PVOID Context,
513   IN OUT PWSTR ValueName,
514   IN OUT PVOID ValueData,
515   IN ULONG ValueLength);
516 
517 typedef VOID
518 (NTAPI *PMINIPORT_DPC_ROUTINE)(
519   IN PVOID HwDeviceExtension,
520   IN PVOID Context);
521 
522 typedef BOOLEAN
523 (NTAPI *PMINIPORT_SYNCHRONIZE_ROUTINE)(
524   IN PVOID Context);
525 
526 typedef VOID
527 (NTAPI *PVIDEO_BUGCHECK_CALLBACK)(
528   IN PVOID HwDeviceExtension,
529   IN ULONG BugcheckCode,
530   IN PUCHAR Buffer,
531   IN ULONG BufferSize);
532 
533 /* VideoPortSynchronizeExecution.Priority constants */
534 typedef enum VIDEO_SYNCHRONIZE_PRIORITY {
535   VpLowPriority = 0,
536   VpMediumPriority,
537   VpHighPriority
538 } VIDEO_SYNCHRONIZE_PRIORITY, *PVIDEO_SYNCHRONIZE_PRIORITY;
539 
540 /* VideoPortAllocatePool.PoolType constants */
541 typedef enum _VP_POOL_TYPE {
542   VpNonPagedPool = 0,
543   VpPagedPool,
544   VpNonPagedPoolCacheAligned = 4,
545   VpPagedPoolCacheAligned
546 } VP_POOL_TYPE, *PVP_POOL_TYPE;
547 
548 typedef enum _DMA_FLAGS {
549   VideoPortUnlockAfterDma = 1,
550   VideoPortKeepPagesLocked,
551   VideoPortDmaInitOnly
552 } DMA_FLAGS;
553 
554 /*
555  * Data returned with VpControllerData.
556  *
557  * The first two fields, InterfaceType and BusNumber, are common
558  * with the CM_FULL_RESOURCE_DESCRIPTOR header.
559  * The other fields are of legacy layout, instead of the newer
560  * CM_PARTIAL_RESOURCE_LIST one.
561  */
562 typedef struct _VIDEO_HARDWARE_CONFIGURATION_DATA {
563   INTERFACE_TYPE InterfaceType;
564   ULONG BusNumber;
565   USHORT Version;
566   USHORT Revision;
567   USHORT Irql;
568   USHORT Vector;
569   ULONG ControlBase;
570   ULONG ControlSize;
571   ULONG CursorBase;
572   ULONG CursorSize;
573   ULONG FrameBase;
574   ULONG FrameSize;
575 } VIDEO_HARDWARE_CONFIGURATION_DATA, *PVIDEO_HARDWARE_CONFIGURATION_DATA;
576 
577 typedef struct _VIDEO_X86_BIOS_ARGUMENTS {
578   ULONG Eax;
579   ULONG Ebx;
580   ULONG Ecx;
581   ULONG Edx;
582   ULONG Esi;
583   ULONG Edi;
584   ULONG Ebp;
585 } VIDEO_X86_BIOS_ARGUMENTS, *PVIDEO_X86_BIOS_ARGUMENTS;
586 
587 typedef enum VIDEO_DEBUG_LEVEL {
588   Error = 0,
589   Warn,
590   Trace,
591   Info
592 } VIDEO_DEBUG_LEVEL, *PVIDEO_DEBUG_LEVEL;
593 
594 #ifndef _NTOS_
595 
596 typedef VP_STATUS
597 (NTAPI *PDRIVER_IO_PORT_UCHAR)(
598   IN ULONG_PTR Context,
599   IN ULONG Port,
600   IN UCHAR AccessMode,
601   IN PUCHAR Data);
602 
603 typedef VP_STATUS
604 (NTAPI *PDRIVER_IO_PORT_UCHAR_STRING)(
605   IN ULONG_PTR Context,
606   IN ULONG Port,
607   IN UCHAR AccessMode,
608   IN PUCHAR Data,
609   IN ULONG DataLength);
610 
611 typedef VP_STATUS
612 (NTAPI *PDRIVER_IO_PORT_ULONG)(
613   IN ULONG_PTR Context,
614   IN ULONG Port,
615   IN UCHAR AccessMode,
616   IN PULONG Data);
617 
618 typedef VP_STATUS
619 (NTAPI *PDRIVER_IO_PORT_ULONG_STRING)(
620   IN ULONG_PTR Context,
621   IN ULONG Port,
622   IN UCHAR AccessMode,
623   IN PULONG Data,
624   IN ULONG DataLength);
625 
626 typedef VP_STATUS
627 (NTAPI *PDRIVER_IO_PORT_USHORT)(
628   IN ULONG_PTR Context,
629   IN ULONG Port,
630   IN UCHAR AccessMode,
631   IN PUSHORT Data);
632 
633 typedef VP_STATUS
634 (NTAPI *PDRIVER_IO_PORT_USHORT_STRING)(
635   IN ULONG_PTR Context,
636   IN ULONG Port,
637   IN UCHAR AccessMode,
638   IN PUSHORT Data,
639   IN ULONG DataLength);
640 
641 #endif /* _NTOS_ */
642 
643 typedef struct __VRB_SG {
644   __int64 PhysicalAddress;
645   ULONG Length;
646 } VRB_SG, *PVRB_SG;
647 
648 typedef enum _VP_LOCK_OPERATION {
649   VpReadAccess = 0,
650   VpWriteAccess,
651   VpModifyAccess
652 } VP_LOCK_OPERATION;
653 
654 typedef struct _VP_DEVICE_DESCRIPTION {
655   BOOLEAN ScatterGather;
656   BOOLEAN Dma32BitAddresses;
657   BOOLEAN Dma64BitAddresses;
658   ULONG MaximumLength;
659 } VP_DEVICE_DESCRIPTION, *PVP_DEVICE_DESCRIPTION;
660 
661 typedef struct _VIDEO_CHILD_STATE {
662   ULONG Id;
663   ULONG State;
664 } VIDEO_CHILD_STATE, *PVIDEO_CHILD_STATE;
665 
666 typedef struct _VIDEO_CHILD_STATE_CONFIGURATION {
667   ULONG Count;
668   VIDEO_CHILD_STATE ChildStateArray[ANYSIZE_ARRAY];
669 } VIDEO_CHILD_STATE_CONFIGURATION, *PVIDEO_CHILD_STATE_CONFIGURATION;
670 
671 typedef struct _VIDEO_HW_INITIALIZATION_DATA {
672   ULONG HwInitDataSize;
673   INTERFACE_TYPE AdapterInterfaceType;
674   PVIDEO_HW_FIND_ADAPTER HwFindAdapter;
675   PVIDEO_HW_INITIALIZE HwInitialize;
676   PVIDEO_HW_INTERRUPT HwInterrupt;
677   PVIDEO_HW_START_IO HwStartIO;
678   ULONG HwDeviceExtensionSize;
679   ULONG StartingDeviceNumber;
680   PVIDEO_HW_RESET_HW HwResetHw;
681   PVIDEO_HW_TIMER HwTimer;
682   PVIDEO_HW_START_DMA HwStartDma;
683   PVIDEO_HW_POWER_SET HwSetPowerState;
684   PVIDEO_HW_POWER_GET HwGetPowerState;
685   PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor;
686   PVIDEO_HW_QUERY_INTERFACE HwQueryInterface;
687   ULONG HwChildDeviceExtensionSize;
688   PVIDEO_ACCESS_RANGE HwLegacyResourceList;
689   ULONG HwLegacyResourceCount;
690   PVIDEO_HW_LEGACYRESOURCES HwGetLegacyResources;
691   BOOLEAN AllowEarlyEnumeration;
692   ULONG Reserved;
693 } VIDEO_HW_INITIALIZATION_DATA, *PVIDEO_HW_INITIALIZATION_DATA;
694 
695 typedef struct _I2C_FNC_TABLE {
696   IN ULONG Size;
697   IN PVIDEO_WRITE_CLOCK_LINE WriteClockLine;
698   IN PVIDEO_WRITE_DATA_LINE WriteDataLine;
699   IN PVIDEO_READ_CLOCK_LINE ReadClockLine;
700   IN PVIDEO_READ_DATA_LINE ReadDataLine;
701   IN PVIDEO_WAIT_VSYNC_ACTIVE WaitVsync;
702   PVOID Reserved;
703 } I2C_FNC_TABLE, *PI2C_FNC_TABLE;
704 
705 typedef struct _DDC_CONTROL {
706   IN ULONG Size;
707   IN I2C_CALLBACKS I2CCallbacks;
708   IN UCHAR EdidSegment;
709 } DDC_CONTROL, *PDDC_CONTROL;
710 
711 /* VideoPortQueryServices.ServicesType constants */
712 typedef enum _VIDEO_PORT_SERVICES {
713   VideoPortServicesAGP = 1,
714   VideoPortServicesI2C,
715   VideoPortServicesHeadless,
716   VideoPortServicesInt10,
717   VideoPortServicesDebugReport,
718   VideoPortServicesWCMemoryProtection
719 } VIDEO_PORT_SERVICES;
720 
721 typedef struct _VIDEO_PORT_AGP_INTERFACE {
722   SHORT Size;
723   SHORT Version;
724   PVOID Context;
725   PINTERFACE_REFERENCE InterfaceReference;
726   PINTERFACE_DEREFERENCE InterfaceDereference;
727   PAGP_RESERVE_PHYSICAL AgpReservePhysical;
728   PAGP_RELEASE_PHYSICAL AgpReleasePhysical;
729   PAGP_COMMIT_PHYSICAL AgpCommitPhysical;
730   PAGP_FREE_PHYSICAL AgpFreePhysical;
731   PAGP_RESERVE_VIRTUAL AgpReserveVirtual;
732   PAGP_RELEASE_VIRTUAL AgpReleaseVirtual;
733   PAGP_COMMIT_VIRTUAL AgpCommitVirtual;
734   PAGP_FREE_VIRTUAL AgpFreeVirtual;
735   ULONGLONG AgpAllocationLimit;
736 } VIDEO_PORT_AGP_INTERFACE, *PVIDEO_PORT_AGP_INTERFACE;
737 
738 typedef struct _VIDEO_PORT_AGP_INTERFACE_2 {
739   IN USHORT Size;
740   IN USHORT Version;
741   OUT PVOID Context;
742   OUT PINTERFACE_REFERENCE InterfaceReference;
743   OUT PINTERFACE_DEREFERENCE InterfaceDereference;
744   OUT PAGP_RESERVE_PHYSICAL AgpReservePhysical;
745   OUT PAGP_RELEASE_PHYSICAL AgpReleasePhysical;
746   OUT PAGP_COMMIT_PHYSICAL AgpCommitPhysical;
747   OUT PAGP_FREE_PHYSICAL AgpFreePhysical;
748   OUT PAGP_RESERVE_VIRTUAL AgpReserveVirtual;
749   OUT PAGP_RELEASE_VIRTUAL AgpReleaseVirtual;
750   OUT PAGP_COMMIT_VIRTUAL AgpCommitVirtual;
751   OUT PAGP_FREE_VIRTUAL AgpFreeVirtual;
752   OUT ULONGLONG AgpAllocationLimit;
753   OUT PAGP_SET_RATE AgpSetRate;
754 } VIDEO_PORT_AGP_INTERFACE_2, *PVIDEO_PORT_AGP_INTERFACE_2;
755 
756 typedef struct _VIDEO_PORT_I2C_INTERFACE {
757   USHORT Size;
758   USHORT Version;
759   PVOID Context;
760   PINTERFACE_REFERENCE InterfaceReference;
761   PINTERFACE_DEREFERENCE InterfaceDereference;
762   PI2C_START I2CStart;
763   PI2C_STOP I2CStop;
764   PI2C_WRITE I2CWrite;
765   PI2C_READ I2CRead;
766 } VIDEO_PORT_I2C_INTERFACE, *PVIDEO_PORT_I2C_INTERFACE;
767 
768 typedef struct _VIDEO_PORT_I2C_INTERFACE_2 {
769   IN USHORT Size;
770   IN USHORT Version;
771   OUT PVOID Context;
772   OUT PINTERFACE_REFERENCE InterfaceReference;
773   OUT PINTERFACE_DEREFERENCE InterfaceDereference;
774   OUT PI2C_START_2 I2CStart;
775   OUT PI2C_STOP_2 I2CStop;
776   OUT PI2C_WRITE_2 I2CWrite;
777   OUT PI2C_READ_2 I2CRead;
778 } VIDEO_PORT_I2C_INTERFACE_2, *PVIDEO_PORT_I2C_INTERFACE_2;
779 
780 typedef struct _VIDEO_PORT_INT10_INTERFACE {
781   IN USHORT Size;
782   IN USHORT Version;
783   OUT PVOID Context;
784   OUT PINTERFACE_REFERENCE InterfaceReference;
785   OUT PINTERFACE_DEREFERENCE InterfaceDereference;
786   OUT PINT10_ALLOCATE_BUFFER Int10AllocateBuffer;
787   OUT PINT10_FREE_BUFFER Int10FreeBuffer;
788   OUT PINT10_READ_MEMORY Int10ReadMemory;
789   OUT PINT10_WRITE_MEMORY Int10WriteMemory;
790   OUT PINT10_CALL_BIOS Int10CallBios;
791 } VIDEO_PORT_INT10_INTERFACE, *PVIDEO_PORT_INT10_INTERFACE;
792 
793 typedef struct _VIDEO_PORT_WCMEMORYPROTECTION_INTERFACE {
794   IN USHORT Size;
795   IN USHORT Version;
796   OUT PVOID Context;
797   OUT PINTERFACE_REFERENCE InterfaceReference;
798   OUT PINTERFACE_DEREFERENCE InterfaceDereference;
799   OUT PROTECT_WC_MEMORY VideoPortProtectWCMemory;
800   OUT RESTORE_WC_MEMORY VideoPortRestoreWCMemory;
801 } VIDEO_PORT_WCMEMORYPROTECTION_INTERFACE, *PVIDEO_PORT_WCMEMORYPROTECTION_INTERFACE;
802 
803 typedef struct _VPOSVERSIONINFO {
804   IN ULONG Size;
805   OUT ULONG MajorVersion;
806   OUT ULONG MinorVersion;
807   OUT ULONG BuildNumber;
808   OUT USHORT ServicePackMajor;
809   OUT USHORT ServicePackMinor;
810 } VPOSVERSIONINFO, *PVPOSVERSIONINFO;
811 
812 typedef struct _VIDEO_PORT_DEBUG_REPORT_INTERFACE {
813   IN USHORT Size;
814   IN USHORT Version;
815   OUT PVOID Context;
816   OUT PINTERFACE_REFERENCE InterfaceReference;
817   OUT PINTERFACE_DEREFERENCE InterfaceDereference;
818   OUT PVIDEO_DEBUG_REPORT (*DbgReportCreate)(
819     IN PVOID HwDeviceExtension,
820     IN ULONG ulCode,
821     IN ULONG_PTR ulpArg1,
822     IN ULONG_PTR ulpArg2,
823     IN ULONG_PTR ulpArg3,
824     IN ULONG_PTR ulpArg4
825   );
826   OUT BOOLEAN (*DbgReportSecondaryData)(
827     IN OUT PVIDEO_DEBUG_REPORT pReport,
828     IN PVOID pvData,
829     IN ULONG ulDataSize
830   );
831   OUT VOID (*DbgReportComplete)(
832     IN OUT PVIDEO_DEBUG_REPORT pReport
833   );
834 } VIDEO_PORT_DEBUG_REPORT_INTERFACE, *PVIDEO_PORT_DEBUG_REPORT_INTERFACE;
835 
836 /* Video port functions for miniports */
837 
838 VPAPI
839 VP_STATUS
840 NTAPI
841 VideoPortAllocateBuffer(
842   IN PVOID HwDeviceExtension,
843   IN ULONG Size,
844   OUT PVOID *Buffer);
845 
846 VPAPI
847 VOID
848 NTAPI
849 VideoPortAcquireDeviceLock(
850   IN PVOID HwDeviceExtension);
851 
852 VPAPI
853 ULONG
854 NTAPI
855 VideoPortCompareMemory(
856   IN PVOID Source1,
857   IN PVOID Source2,
858   IN SIZE_T Length);
859 
860 VPAPI
861 BOOLEAN
862 NTAPI
863 VideoPortDDCMonitorHelper(
864   IN PVOID HwDeviceExtension,
865   IN PVOID DDCControl,
866   IN OUT PUCHAR EdidBuffer,
867   IN ULONG EdidBufferSize);
868 
869 VPAPI
870 VOID
871 __cdecl
872 VideoPortDebugPrint(
873   IN VIDEO_DEBUG_LEVEL DebugPrintLevel,
874   IN PSTR DebugMessage,
875   IN ...);
876 
877 VPAPI
878 VP_STATUS
879 NTAPI
880 VideoPortDisableInterrupt(
881   IN PVOID HwDeviceExtension);
882 
883 VPAPI
884 VP_STATUS
885 NTAPI
886 VideoPortEnableInterrupt(
887   IN PVOID HwDeviceExtension);
888 
889 VPAPI
890 VP_STATUS
891 NTAPI
892 VideoPortEnumerateChildren(
893   IN PVOID HwDeviceExtension,
894   IN PVOID Reserved);
895 
896 VPAPI
897 VOID
898 NTAPI
899 VideoPortFreeDeviceBase(
900   IN PVOID HwDeviceExtension,
901   IN PVOID MappedAddress);
902 
903 VPAPI
904 VP_STATUS
905 NTAPI
906 VideoPortGetAccessRanges(
907     _In_ PVOID HwDeviceExtension,
908     _In_opt_ ULONG NumRequestedResources,
909     _In_reads_opt_(NumRequestedResources)
910         PIO_RESOURCE_DESCRIPTOR RequestedResources,
911     _In_ ULONG NumAccessRanges,
912     _Out_writes_(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges,
913     _In_ PVOID VendorId,
914     _In_ PVOID DeviceId,
915     _Out_ PULONG Slot);
916 
917 VPAPI
918 PVOID
919 NTAPI
920 VideoPortGetAssociatedDeviceExtension(
921   IN PVOID DeviceObject);
922 
923 VPAPI
924 ULONG
925 NTAPI
926 VideoPortGetBusData(
927   IN PVOID HwDeviceExtension,
928   IN BUS_DATA_TYPE BusDataType,
929   IN ULONG SlotNumber,
930   IN OUT PVOID Buffer,
931   IN ULONG Offset,
932   IN ULONG Length);
933 
934 VPAPI
935 UCHAR
936 NTAPI
937 VideoPortGetCurrentIrql(VOID);
938 
939 VPAPI
940 PVOID
941 NTAPI
942 VideoPortGetDeviceBase(
943   IN PVOID HwDeviceExtension,
944   IN PHYSICAL_ADDRESS IoAddress,
945   IN ULONG NumberOfUchars,
946   IN UCHAR InIoSpace);
947 
948 VPAPI
949 VP_STATUS
950 NTAPI
951 VideoPortGetDeviceData(
952   IN PVOID HwDeviceExtension,
953   IN VIDEO_DEVICE_DATA_TYPE DeviceDataType,
954   IN PMINIPORT_QUERY_DEVICE_ROUTINE CallbackRoutine,
955   IN PVOID Context);
956 
957 VPAPI
958 VP_STATUS
959 NTAPI
960 VideoPortGetRegistryParameters(
961   IN PVOID HwDeviceExtension,
962   IN PWSTR ParameterName,
963   IN UCHAR IsParameterFileName,
964   IN PMINIPORT_GET_REGISTRY_ROUTINE CallbackRoutine,
965   IN PVOID Context);
966 
967 VPAPI
968 PVOID
969 NTAPI
970 VideoPortGetRomImage(
971   IN PVOID HwDeviceExtension,
972   IN PVOID Unused1,
973   IN ULONG Unused2,
974   IN ULONG Length);
975 
976 VPAPI
977 VP_STATUS
978 NTAPI
979 VideoPortGetVgaStatus(
980   IN PVOID HwDeviceExtension,
981   OUT PULONG VgaStatus);
982 
983 VPAPI
984 LONG
985 FASTCALL
986 VideoPortInterlockedDecrement(
987   IN PLONG Addend);
988 
989 VPAPI
990 LONG
991 FASTCALL
992 VideoPortInterlockedExchange(
993   IN OUT PLONG Target,
994   IN LONG Value);
995 
996 VPAPI
997 LONG
998 FASTCALL
999 VideoPortInterlockedIncrement(
1000   IN PLONG Addend);
1001 
1002 VPAPI
1003 ULONG
1004 NTAPI
1005 VideoPortInitialize(
1006   IN PVOID Argument1,
1007   IN PVOID Argument2,
1008   IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
1009   IN PVOID HwContext);
1010 
1011 VPAPI
1012 VP_STATUS
1013 NTAPI
1014 VideoPortInt10(
1015   IN PVOID HwDeviceExtension,
1016   IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments);
1017 
1018 VPAPI
1019 VOID
1020 NTAPI
1021 VideoPortLogError(
1022   IN PVOID HwDeviceExtension,
1023   IN PVIDEO_REQUEST_PACKET Vrp OPTIONAL,
1024   IN VP_STATUS ErrorCode,
1025   IN ULONG UniqueId);
1026 
1027 VPAPI
1028 VP_STATUS
1029 NTAPI
1030 VideoPortMapBankedMemory(
1031   IN PVOID HwDeviceExtension,
1032   IN PHYSICAL_ADDRESS PhysicalAddress,
1033   IN OUT PULONG Length,
1034   PULONG InIoSpace,
1035   PVOID *VirtualAddress,
1036   ULONG BankLength,
1037   UCHAR ReadWriteBank,
1038   PBANKED_SECTION_ROUTINE BankRoutine,
1039   PVOID Context);
1040 
1041 VPAPI
1042 VP_STATUS
1043 NTAPI
1044 VideoPortMapMemory(
1045   IN PVOID HwDeviceExtension,
1046   IN PHYSICAL_ADDRESS PhysicalAddress,
1047   IN OUT PULONG Length,
1048   IN PULONG InIoSpace,
1049   IN OUT PVOID *VirtualAddress);
1050 
1051 VPAPI
1052 VOID
1053 NTAPI
1054 VideoPortMoveMemory(
1055   IN PVOID Destination,
1056   IN PVOID Source,
1057   IN ULONG Length);
1058 
1059 VPAPI
1060 LONGLONG
1061 NTAPI
1062 VideoPortQueryPerformanceCounter(
1063   IN PVOID HwDeviceExtension,
1064   OUT PLONGLONG PerformanceFrequency OPTIONAL);
1065 
1066 VPAPI
1067 VP_STATUS
1068 NTAPI
1069 VideoPortQueryServices(
1070   IN PVOID HwDeviceExtension,
1071   IN VIDEO_PORT_SERVICES ServicesType,
1072   IN OUT PINTERFACE Interface);
1073 
1074 VPAPI
1075 BOOLEAN
1076 NTAPI
1077 VideoPortQueueDpc(
1078   IN PVOID HwDeviceExtension,
1079   IN PMINIPORT_DPC_ROUTINE CallbackRoutine,
1080   IN PVOID Context);
1081 
1082 VPAPI
1083 VOID
1084 NTAPI
1085 VideoPortReadPortBufferUchar(
1086   IN PUCHAR Port,
1087   OUT PUCHAR Buffer,
1088   IN ULONG Count);
1089 
1090 VPAPI
1091 VOID
1092 NTAPI
1093 VideoPortReadPortBufferUlong(
1094   IN PULONG Port,
1095   OUT PULONG Buffer,
1096   IN ULONG Count);
1097 
1098 VPAPI
1099 VOID
1100 NTAPI
1101 VideoPortReadPortBufferUshort(
1102   IN PUSHORT Port,
1103   OUT PUSHORT Buffer,
1104   IN ULONG Count);
1105 
1106 VPAPI
1107 UCHAR
1108 NTAPI
1109 VideoPortReadPortUchar(
1110   IN PUCHAR Port);
1111 
1112 VPAPI
1113 ULONG
1114 NTAPI
1115 VideoPortReadPortUlong(
1116   IN PULONG Port);
1117 
1118 VPAPI
1119 USHORT
1120 NTAPI
1121 VideoPortReadPortUshort(
1122   IN PUSHORT Port);
1123 
1124 VPAPI
1125 VOID
1126 NTAPI
1127 VideoPortReadRegisterBufferUchar(
1128   IN PUCHAR Register,
1129   OUT PUCHAR Buffer,
1130   IN ULONG Count);
1131 
1132 VPAPI
1133 VOID
1134 NTAPI
1135 VideoPortReadRegisterBufferUlong(
1136   IN PULONG Register,
1137   OUT PULONG Buffer,
1138   IN ULONG Count);
1139 
1140 VPAPI
1141 VOID
1142 NTAPI
1143 VideoPortReadRegisterBufferUshort(
1144   IN PUSHORT Register,
1145   OUT PUSHORT Buffer,
1146   IN ULONG Count);
1147 
1148 VPAPI
1149 UCHAR
1150 NTAPI
1151 VideoPortReadRegisterUchar(
1152   IN PUCHAR Register);
1153 
1154 VPAPI
1155 ULONG
1156 NTAPI
1157 VideoPortReadRegisterUlong(
1158   IN PULONG Register);
1159 
1160 VPAPI
1161 USHORT
1162 NTAPI
1163 VideoPortReadRegisterUshort(
1164   IN PUSHORT Register);
1165 
1166 VPAPI
1167 VOID
1168 NTAPI
1169 VideoPortReleaseBuffer(
1170   IN PVOID HwDeviceExtension,
1171   IN PVOID Buffer);
1172 
1173 VPAPI
1174 VOID
1175 NTAPI
1176 VideoPortReleaseDeviceLock(
1177   IN PVOID HwDeviceExtension);
1178 
1179 VPAPI
1180 BOOLEAN
1181 NTAPI
1182 VideoPortScanRom(
1183   PVOID HwDeviceExtension,
1184   PUCHAR RomBase,
1185   ULONG RomLength,
1186   PUCHAR String);
1187 
1188 VPAPI
1189 ULONG
1190 NTAPI
1191 VideoPortSetBusData(
1192   IN PVOID HwDeviceExtension,
1193   IN BUS_DATA_TYPE BusDataType,
1194   IN ULONG SlotNumber,
1195   IN PVOID Buffer,
1196   IN ULONG Offset,
1197   IN ULONG Length);
1198 
1199 VPAPI
1200 VP_STATUS
1201 NTAPI
1202 VideoPortSetRegistryParameters(
1203   IN PVOID HwDeviceExtension,
1204   IN PWSTR ValueName,
1205   IN PVOID ValueData,
1206   IN ULONG ValueLength);
1207 
1208 VPAPI
1209 VP_STATUS
1210 NTAPI
1211 VideoPortSetTrappedEmulatorPorts(
1212   IN PVOID HwDeviceExtension,
1213   IN ULONG NumAccessRanges,
1214   IN PVIDEO_ACCESS_RANGE AccessRange);
1215 
1216 VPAPI
1217 VOID
1218 NTAPI
1219 VideoPortStallExecution(
1220   IN ULONG Microseconds);
1221 
1222 VPAPI
1223 VOID
1224 NTAPI
1225 VideoPortStartTimer(
1226   IN PVOID HwDeviceExtension);
1227 
1228 VPAPI
1229 VOID
1230 NTAPI
1231 VideoPortStopTimer(
1232   IN PVOID HwDeviceExtension);
1233 
1234 VPAPI
1235 BOOLEAN
1236 NTAPI
1237 VideoPortSynchronizeExecution(
1238   IN PVOID HwDeviceExtension,
1239   IN VIDEO_SYNCHRONIZE_PRIORITY Priority,
1240   IN PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine,
1241   IN PVOID Context);
1242 
1243 VPAPI
1244 VP_STATUS
1245 NTAPI
1246 VideoPortUnmapMemory(
1247   IN PVOID HwDeviceExtension,
1248   IN OUT PVOID VirtualAddress,
1249   IN HANDLE ProcessHandle);
1250 
1251 VPAPI
1252 VP_STATUS
1253 NTAPI
1254 VideoPortVerifyAccessRanges(
1255     _In_ PVOID HwDeviceExtension,
1256     _In_opt_ ULONG NumAccessRanges,
1257     _In_reads_opt_(NumAccessRanges) PVIDEO_ACCESS_RANGE AccessRanges);
1258 
1259 VPAPI
1260 VOID
1261 NTAPI
1262 VideoPortWritePortBufferUchar(
1263   IN PUCHAR Port,
1264   IN PUCHAR Buffer,
1265   IN ULONG Count);
1266 
1267 VPAPI
1268 VOID
1269 NTAPI
1270 VideoPortWritePortBufferUlong(
1271   IN PULONG Port,
1272   IN PULONG Buffer,
1273   IN ULONG Count);
1274 
1275 VPAPI
1276 VOID
1277 NTAPI
1278 VideoPortWritePortBufferUshort(
1279   IN PUSHORT Port,
1280   IN PUSHORT Buffer,
1281   IN ULONG Count);
1282 
1283 VPAPI
1284 VOID
1285 NTAPI
1286 VideoPortWritePortUchar(
1287   IN PUCHAR Port,
1288   IN UCHAR Value);
1289 
1290 VPAPI
1291 VOID
1292 NTAPI
1293 VideoPortWritePortUlong(
1294   IN PULONG Port,
1295   IN ULONG Value);
1296 
1297 VPAPI
1298 VOID
1299 NTAPI
1300 VideoPortWritePortUshort(
1301   IN PUSHORT Port,
1302   IN USHORT Value);
1303 
1304 VPAPI
1305 VOID
1306 NTAPI
1307 VideoPortWriteRegisterBufferUchar(
1308   IN PUCHAR Register,
1309   IN PUCHAR Buffer,
1310   IN ULONG Count);
1311 
1312 VPAPI
1313 VOID
1314 NTAPI
1315 VideoPortWriteRegisterBufferUlong(
1316   IN PULONG Register,
1317   IN PULONG Buffer,
1318   IN ULONG Count);
1319 
1320 VPAPI
1321 VOID
1322 NTAPI
1323 VideoPortWriteRegisterBufferUshort(
1324   IN PUSHORT Register,
1325   IN PUSHORT Buffer,
1326   IN ULONG Count);
1327 
1328 VPAPI
1329 VOID
1330 NTAPI
1331 VideoPortWriteRegisterUchar(
1332   IN PUCHAR Register,
1333   IN UCHAR Value);
1334 
1335 VPAPI
1336 VOID
1337 NTAPI
1338 VideoPortWriteRegisterUlong(
1339   IN PULONG Register,
1340   IN ULONG Value);
1341 
1342 VPAPI
1343 VOID
1344 NTAPI
1345 VideoPortWriteRegisterUshort(
1346   IN PUSHORT Register,
1347   IN USHORT Value);
1348 
1349 VPAPI
1350 VOID
1351 NTAPI
1352 VideoPortZeroDeviceMemory(
1353   IN PVOID Destination,
1354   IN ULONG Length);
1355 
1356 VPAPI
1357 VOID
1358 NTAPI
1359 VideoPortZeroMemory(
1360   IN PVOID Destination,
1361   IN ULONG Length);
1362 
1363 VPAPI
1364 PVOID
1365 NTAPI
1366 VideoPortAllocateContiguousMemory(
1367   IN PVOID HwDeviceExtension,
1368   IN ULONG NumberOfBytes,
1369   IN PHYSICAL_ADDRESS HighestAcceptableAddress);
1370 
1371 VPAPI
1372 PVOID
1373 NTAPI
1374 VideoPortGetCommonBuffer(
1375   IN PVOID HwDeviceExtension,
1376   IN ULONG DesiredLength,
1377   IN ULONG Alignment,
1378   OUT PPHYSICAL_ADDRESS LogicalAddress,
1379   OUT PULONG pActualLength,
1380   IN BOOLEAN CacheEnabled);
1381 
1382 VPAPI
1383 VOID
1384 NTAPI
1385 VideoPortFreeCommonBuffer(
1386   IN PVOID HwDeviceExtension,
1387   IN ULONG Length,
1388   IN PVOID VirtualAddress,
1389   IN PHYSICAL_ADDRESS LogicalAddress,
1390   IN BOOLEAN CacheEnabled);
1391 
1392 VPAPI
1393 PDMA
1394 NTAPI
1395 VideoPortDoDma(
1396   IN PVOID HwDeviceExtension,
1397   IN PDMA pDma,
1398   IN DMA_FLAGS DmaFlags);
1399 
1400 VPAPI
1401 BOOLEAN
1402 NTAPI
1403 VideoPortLockPages(
1404   IN PVOID HwDeviceExtension,
1405   IN OUT PVIDEO_REQUEST_PACKET pVrp,
1406   IN OUT PEVENT pUEvent,
1407   IN PEVENT pDisplayEvent,
1408   IN DMA_FLAGS DmaFlags);
1409 
1410 VPAPI
1411 BOOLEAN
1412 NTAPI
1413 VideoPortUnlockPages(
1414   IN PVOID hwDeviceExtension,
1415   IN OUT PDMA pDma);
1416 
1417 VPAPI
1418 BOOLEAN
1419 NTAPI
1420 VideoPortSignalDmaComplete(
1421   IN PVOID HwDeviceExtension,
1422   IN PDMA pDmaHandle);
1423 
1424 VPAPI
1425 PVOID
1426 NTAPI
1427 VideoPortGetMdl(
1428   IN PVOID HwDeviceExtension,
1429   IN PDMA pDma);
1430 
1431 VPAPI
1432 PVOID
1433 NTAPI
1434 VideoPortGetDmaContext(
1435   IN PVOID HwDeviceExtension,
1436   IN PDMA pDma);
1437 
1438 VPAPI
1439 VOID
1440 NTAPI
1441 VideoPortSetDmaContext(
1442   IN PVOID HwDeviceExtension,
1443   OUT PDMA pDma,
1444   IN PVOID InstanceContext);
1445 
1446 VPAPI
1447 ULONG
1448 NTAPI
1449 VideoPortGetBytesUsed(
1450   IN PVOID HwDeviceExtension,
1451   IN PDMA pDma);
1452 
1453 VPAPI
1454 VOID
1455 NTAPI
1456 VideoPortSetBytesUsed(
1457   IN PVOID HwDeviceExtension,
1458   IN OUT PDMA pDma,
1459   IN ULONG BytesUsed);
1460 
1461 VPAPI
1462 PDMA
1463 NTAPI
1464 VideoPortAssociateEventsWithDmaHandle(
1465   IN PVOID HwDeviceExtension,
1466   IN OUT PVIDEO_REQUEST_PACKET pVrp,
1467   IN PVOID MappedUserEvent,
1468   IN PVOID DisplayDriverEvent);
1469 
1470 VPAPI
1471 PDMA
1472 NTAPI
1473 VideoPortMapDmaMemory(
1474   IN PVOID HwDeviceExtension,
1475   IN PVIDEO_REQUEST_PACKET pVrp,
1476   IN PHYSICAL_ADDRESS BoardAddress,
1477   IN PULONG Length,
1478   IN PULONG InIoSpace,
1479   IN PVOID MappedUserEvent,
1480   IN PVOID DisplayDriverEvent,
1481   IN OUT PVOID *VirtualAddress);
1482 
1483 VPAPI
1484 BOOLEAN
1485 NTAPI
1486 VideoPortUnmapDmaMemory(
1487   IN PVOID HwDeviceExtension,
1488   IN PVOID VirtualAddress,
1489   IN HANDLE ProcessHandle,
1490   IN PDMA BoardMemoryHandle);
1491 
1492 VPAPI
1493 VP_STATUS
1494 NTAPI
1495 VideoPortCreateSecondaryDisplay(
1496   IN PVOID HwDeviceExtension,
1497   IN OUT PVOID *SecondaryDeviceExtension,
1498   IN ULONG ulFlag);
1499 
1500 VPAPI
1501 PVP_DMA_ADAPTER
1502 NTAPI
1503 VideoPortGetDmaAdapter(
1504   IN PVOID HwDeviceExtension,
1505   IN PVP_DEVICE_DESCRIPTION VpDeviceDescription);
1506 
1507 VPAPI
1508 VOID
1509 NTAPI
1510 VideoPortPutDmaAdapter(
1511   IN PVOID HwDeviceExtension,
1512   IN PVP_DMA_ADAPTER VpDmaAdapter);
1513 
1514 VPAPI
1515 PVOID
1516 NTAPI
1517 VideoPortAllocateCommonBuffer(
1518   IN PVOID HwDeviceExtension,
1519   IN PVP_DMA_ADAPTER VpDmaAdapter,
1520   IN ULONG DesiredLength,
1521   OUT PPHYSICAL_ADDRESS LogicalAddress,
1522   IN BOOLEAN CacheEnabled,
1523   PVOID Reserved);
1524 
1525 VPAPI
1526 VOID
1527 NTAPI
1528 VideoPortReleaseCommonBuffer(
1529   IN PVOID HwDeviceExtension,
1530   IN PVP_DMA_ADAPTER VpDmaAdapter,
1531   IN ULONG Length,
1532   IN PHYSICAL_ADDRESS LogicalAddress,
1533   IN PVOID VirtualAddress,
1534   IN BOOLEAN CacheEnabled);
1535 
1536 VPAPI
1537 PVOID
1538 NTAPI
1539 VideoPortLockBuffer(
1540   IN PVOID HwDeviceExtension,
1541   IN PVOID BaseAddress,
1542   IN ULONG Length,
1543   IN VP_LOCK_OPERATION Operation);
1544 
1545 VPAPI
1546 VOID
1547 NTAPI
1548 VideoPortUnlockBuffer(
1549   IN PVOID HwDeviceExtension,
1550   IN PVOID Mdl);
1551 
1552 VPAPI
1553 VP_STATUS
1554 NTAPI
1555 VideoPortStartDma(
1556   IN PVOID HwDeviceExtension,
1557   IN PVP_DMA_ADAPTER VpDmaAdapter,
1558   IN PVOID Mdl,
1559   IN ULONG Offset,
1560   IN OUT PULONG pLength,
1561   IN PEXECUTE_DMA ExecuteDmaRoutine,
1562   IN PVOID Context,
1563   IN BOOLEAN WriteToDevice);
1564 
1565 VPAPI
1566 VP_STATUS
1567 NTAPI
1568 VideoPortCompleteDma(
1569   IN PVOID HwDeviceExtension,
1570   IN PVP_DMA_ADAPTER VpDmaAdapter,
1571   IN PVP_SCATTER_GATHER_LIST VpScatterGather,
1572   IN BOOLEAN WriteToDevice);
1573 
1574 VPAPI
1575 VP_STATUS
1576 NTAPI
1577 VideoPortCreateEvent(
1578   IN PVOID HwDeviceExtension,
1579   IN ULONG EventFlag,
1580   IN PVOID Unused,
1581   OUT PEVENT *ppEvent);
1582 
1583 VPAPI
1584 VP_STATUS
1585 NTAPI
1586 VideoPortDeleteEvent(
1587   IN PVOID HwDeviceExtension,
1588   IN PEVENT pEvent);
1589 
1590 VPAPI
1591 LONG
1592 NTAPI
1593 VideoPortSetEvent(
1594   IN PVOID HwDeviceExtension,
1595   IN PEVENT pEvent);
1596 
1597 VPAPI
1598 VOID
1599 NTAPI
1600 VideoPortClearEvent(
1601   IN PVOID HwDeviceExtension,
1602   IN PEVENT pEvent);
1603 
1604 VPAPI
1605 LONG
1606 NTAPI
1607 VideoPortReadStateEvent(
1608   IN PVOID HwDeviceExtension,
1609   IN PEVENT pEvent);
1610 
1611 VPAPI
1612 VP_STATUS
1613 NTAPI
1614 VideoPortWaitForSingleObject(
1615   IN PVOID HwDeviceExtension,
1616   IN PVOID Object,
1617   IN PLARGE_INTEGER Timeout OPTIONAL);
1618 
1619 VPAPI
1620 PVOID
1621 NTAPI
1622 VideoPortAllocatePool(
1623   IN PVOID HwDeviceExtension,
1624   IN VP_POOL_TYPE PoolType,
1625   IN SIZE_T NumberOfBytes,
1626   IN ULONG Tag);
1627 
1628 VPAPI
1629 VOID
1630 NTAPI
1631 VideoPortFreePool(
1632   IN PVOID HwDeviceExtension,
1633   IN PVOID Ptr);
1634 
1635 VPAPI
1636 VP_STATUS
1637 NTAPI
1638 VideoPortCreateSpinLock(
1639   IN PVOID HwDeviceExtension,
1640   OUT PSPIN_LOCK *SpinLock);
1641 
1642 VPAPI
1643 VP_STATUS
1644 NTAPI
1645 VideoPortDeleteSpinLock(
1646   IN PVOID HwDeviceExtension,
1647   IN PSPIN_LOCK SpinLock);
1648 
1649 VPAPI
1650 VOID
1651 NTAPI
1652 VideoPortAcquireSpinLock(
1653   IN PVOID HwDeviceExtension,
1654   IN PSPIN_LOCK SpinLock,
1655   OUT PUCHAR OldIrql);
1656 
1657 VPAPI
1658 VOID
1659 NTAPI
1660 VideoPortAcquireSpinLockAtDpcLevel(
1661   IN PVOID HwDeviceExtension,
1662   IN PSPIN_LOCK SpinLock);
1663 
1664 VPAPI
1665 VOID
1666 NTAPI
1667 VideoPortReleaseSpinLock(
1668   IN PVOID HwDeviceExtension,
1669   IN PSPIN_LOCK SpinLock,
1670   IN UCHAR NewIrql);
1671 
1672 VPAPI
1673 VOID
1674 NTAPI
1675 VideoPortReleaseSpinLockFromDpcLevel(
1676   IN PVOID HwDeviceExtension,
1677   IN PSPIN_LOCK SpinLock);
1678 
1679 VPAPI
1680 VOID
1681 NTAPI
1682 VideoPortQuerySystemTime(
1683   OUT PLARGE_INTEGER CurrentTime);
1684 
1685 VPAPI
1686 BOOLEAN
1687 NTAPI
1688 VideoPortCheckForDeviceExistence(
1689   IN PVOID HwDeviceExtension,
1690   IN USHORT VendorId,
1691   IN USHORT DeviceId,
1692   IN UCHAR RevisionId,
1693   IN USHORT SubVendorId,
1694   IN USHORT SubSystemId,
1695   IN ULONG Flags);
1696 
1697 VPAPI
1698 ULONG
1699 NTAPI
1700 VideoPortGetAssociatedDeviceID(
1701   IN PVOID DeviceObject);
1702 
1703 VPAPI
1704 VP_STATUS
1705 NTAPI
1706 VideoPortFlushRegistry(
1707   PVOID HwDeviceExtension);
1708 
1709 VPAPI
1710 VP_STATUS
1711 NTAPI
1712 VideoPortGetVersion(
1713   IN PVOID HwDeviceExtension,
1714   IN OUT PVPOSVERSIONINFO pVpOsVersionInfo);
1715 
1716 VPAPI
1717 BOOLEAN
1718 NTAPI
1719 VideoPortIsNoVesa(VOID);
1720 
1721 VPAPI
1722 VP_STATUS
1723 NTAPI
1724 VideoPortRegisterBugcheckCallback(
1725   IN PVOID HwDeviceExtension,
1726   IN ULONG BugcheckCode,
1727   IN PVIDEO_BUGCHECK_CALLBACK Callback,
1728   IN ULONG BugcheckDataSize);
1729 
1730 VPAPI
1731 PVIDEO_DEBUG_REPORT
1732 NTAPI
1733 VideoPortDbgReportCreate(
1734   IN PVOID HwDeviceExtension,
1735   IN ULONG ulCode,
1736   IN ULONG_PTR ulpArg1,
1737   IN ULONG_PTR ulpArg2,
1738   IN ULONG_PTR ulpArg3,
1739   IN ULONG_PTR ulpArg4);
1740 
1741 VPAPI
1742 BOOLEAN
1743 NTAPI
1744 VideoPortDbgReportSecondaryData(
1745   IN OUT PVIDEO_DEBUG_REPORT pReport,
1746   IN PVOID pvData,
1747   IN ULONG ulDataSize);
1748 
1749 VPAPI
1750 VOID
1751 NTAPI
1752 VideoPortDbgReportComplete(
1753   IN OUT PVIDEO_DEBUG_REPORT pReport);
1754 
1755 #ifdef __cplusplus
1756 }
1757 #endif
1758