xref: /reactos/sdk/include/ddk/video.h (revision 40462c92)
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 typedef struct _VIDEO_HARDWARE_CONFIGURATION_DATA {
555   INTERFACE_TYPE InterfaceType;
556   ULONG BusNumber;
557   USHORT Version;
558   USHORT Revision;
559   USHORT Irql;
560   USHORT Vector;
561   ULONG ControlBase;
562   ULONG ControlSize;
563   ULONG CursorBase;
564   ULONG CursorSize;
565   ULONG FrameBase;
566   ULONG FrameSize;
567 } VIDEO_HARDWARE_CONFIGURATION_DATA, *PVIDEO_HARDWARE_CONFIGURATION_DATA;
568 
569 typedef struct _VIDEO_X86_BIOS_ARGUMENTS {
570   ULONG Eax;
571   ULONG Ebx;
572   ULONG Ecx;
573   ULONG Edx;
574   ULONG Esi;
575   ULONG Edi;
576   ULONG Ebp;
577 } VIDEO_X86_BIOS_ARGUMENTS, *PVIDEO_X86_BIOS_ARGUMENTS;
578 
579 typedef enum VIDEO_DEBUG_LEVEL {
580   Error = 0,
581   Warn,
582   Trace,
583   Info
584 } VIDEO_DEBUG_LEVEL, *PVIDEO_DEBUG_LEVEL;
585 
586 #ifndef _NTOS_
587 
588 typedef VP_STATUS
589 (NTAPI *PDRIVER_IO_PORT_UCHAR)(
590   IN ULONG_PTR Context,
591   IN ULONG Port,
592   IN UCHAR AccessMode,
593   IN PUCHAR Data);
594 
595 typedef VP_STATUS
596 (NTAPI *PDRIVER_IO_PORT_UCHAR_STRING)(
597   IN ULONG_PTR Context,
598   IN ULONG Port,
599   IN UCHAR AccessMode,
600   IN PUCHAR Data,
601   IN ULONG DataLength);
602 
603 typedef VP_STATUS
604 (NTAPI *PDRIVER_IO_PORT_ULONG)(
605   IN ULONG_PTR Context,
606   IN ULONG Port,
607   IN UCHAR AccessMode,
608   IN PULONG Data);
609 
610 typedef VP_STATUS
611 (NTAPI *PDRIVER_IO_PORT_ULONG_STRING)(
612   IN ULONG_PTR Context,
613   IN ULONG Port,
614   IN UCHAR AccessMode,
615   IN PULONG Data,
616   IN ULONG DataLength);
617 
618 typedef VP_STATUS
619 (NTAPI *PDRIVER_IO_PORT_USHORT)(
620   IN ULONG_PTR Context,
621   IN ULONG Port,
622   IN UCHAR AccessMode,
623   IN PUSHORT Data);
624 
625 typedef VP_STATUS
626 (NTAPI *PDRIVER_IO_PORT_USHORT_STRING)(
627   IN ULONG_PTR Context,
628   IN ULONG Port,
629   IN UCHAR AccessMode,
630   IN PUSHORT Data,
631   IN ULONG DataLength);
632 
633 #endif /* _NTOS_ */
634 
635 typedef struct __VRB_SG {
636   __int64 PhysicalAddress;
637   ULONG Length;
638 } VRB_SG, *PVRB_SG;
639 
640 typedef enum _VP_LOCK_OPERATION {
641   VpReadAccess = 0,
642   VpWriteAccess,
643   VpModifyAccess
644 } VP_LOCK_OPERATION;
645 
646 typedef struct _VP_DEVICE_DESCRIPTION {
647   BOOLEAN ScatterGather;
648   BOOLEAN Dma32BitAddresses;
649   BOOLEAN Dma64BitAddresses;
650   ULONG MaximumLength;
651 } VP_DEVICE_DESCRIPTION, *PVP_DEVICE_DESCRIPTION;
652 
653 typedef struct _VIDEO_CHILD_STATE {
654   ULONG Id;
655   ULONG State;
656 } VIDEO_CHILD_STATE, *PVIDEO_CHILD_STATE;
657 
658 typedef struct _VIDEO_CHILD_STATE_CONFIGURATION {
659   ULONG Count;
660   VIDEO_CHILD_STATE ChildStateArray[ANYSIZE_ARRAY];
661 } VIDEO_CHILD_STATE_CONFIGURATION, *PVIDEO_CHILD_STATE_CONFIGURATION;
662 
663 typedef struct _VIDEO_HW_INITIALIZATION_DATA {
664   ULONG HwInitDataSize;
665   INTERFACE_TYPE AdapterInterfaceType;
666   PVIDEO_HW_FIND_ADAPTER HwFindAdapter;
667   PVIDEO_HW_INITIALIZE HwInitialize;
668   PVIDEO_HW_INTERRUPT HwInterrupt;
669   PVIDEO_HW_START_IO HwStartIO;
670   ULONG HwDeviceExtensionSize;
671   ULONG StartingDeviceNumber;
672   PVIDEO_HW_RESET_HW HwResetHw;
673   PVIDEO_HW_TIMER HwTimer;
674   PVIDEO_HW_START_DMA HwStartDma;
675   PVIDEO_HW_POWER_SET HwSetPowerState;
676   PVIDEO_HW_POWER_GET HwGetPowerState;
677   PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor;
678   PVIDEO_HW_QUERY_INTERFACE HwQueryInterface;
679   ULONG HwChildDeviceExtensionSize;
680   PVIDEO_ACCESS_RANGE HwLegacyResourceList;
681   ULONG HwLegacyResourceCount;
682   PVIDEO_HW_LEGACYRESOURCES HwGetLegacyResources;
683   BOOLEAN AllowEarlyEnumeration;
684   ULONG Reserved;
685 } VIDEO_HW_INITIALIZATION_DATA, *PVIDEO_HW_INITIALIZATION_DATA;
686 
687 typedef struct _I2C_FNC_TABLE {
688   IN ULONG Size;
689   IN PVIDEO_WRITE_CLOCK_LINE WriteClockLine;
690   IN PVIDEO_WRITE_DATA_LINE WriteDataLine;
691   IN PVIDEO_READ_CLOCK_LINE ReadClockLine;
692   IN PVIDEO_READ_DATA_LINE ReadDataLine;
693   IN PVIDEO_WAIT_VSYNC_ACTIVE WaitVsync;
694   PVOID Reserved;
695 } I2C_FNC_TABLE, *PI2C_FNC_TABLE;
696 
697 typedef struct _DDC_CONTROL {
698   IN ULONG Size;
699   IN I2C_CALLBACKS I2CCallbacks;
700   IN UCHAR EdidSegment;
701 } DDC_CONTROL, *PDDC_CONTROL;
702 
703 /* VideoPortQueryServices.ServicesType constants */
704 typedef enum _VIDEO_PORT_SERVICES {
705   VideoPortServicesAGP = 1,
706   VideoPortServicesI2C,
707   VideoPortServicesHeadless,
708   VideoPortServicesInt10,
709   VideoPortServicesDebugReport,
710   VideoPortServicesWCMemoryProtection
711 } VIDEO_PORT_SERVICES;
712 
713 typedef struct _VIDEO_PORT_AGP_INTERFACE {
714   SHORT Size;
715   SHORT Version;
716   PVOID Context;
717   PINTERFACE_REFERENCE InterfaceReference;
718   PINTERFACE_DEREFERENCE InterfaceDereference;
719   PAGP_RESERVE_PHYSICAL AgpReservePhysical;
720   PAGP_RELEASE_PHYSICAL AgpReleasePhysical;
721   PAGP_COMMIT_PHYSICAL AgpCommitPhysical;
722   PAGP_FREE_PHYSICAL AgpFreePhysical;
723   PAGP_RESERVE_VIRTUAL AgpReserveVirtual;
724   PAGP_RELEASE_VIRTUAL AgpReleaseVirtual;
725   PAGP_COMMIT_VIRTUAL AgpCommitVirtual;
726   PAGP_FREE_VIRTUAL AgpFreeVirtual;
727   ULONGLONG AgpAllocationLimit;
728 } VIDEO_PORT_AGP_INTERFACE, *PVIDEO_PORT_AGP_INTERFACE;
729 
730 typedef struct _VIDEO_PORT_AGP_INTERFACE_2 {
731   IN USHORT Size;
732   IN USHORT Version;
733   OUT PVOID Context;
734   OUT PINTERFACE_REFERENCE InterfaceReference;
735   OUT PINTERFACE_DEREFERENCE InterfaceDereference;
736   OUT PAGP_RESERVE_PHYSICAL AgpReservePhysical;
737   OUT PAGP_RELEASE_PHYSICAL AgpReleasePhysical;
738   OUT PAGP_COMMIT_PHYSICAL AgpCommitPhysical;
739   OUT PAGP_FREE_PHYSICAL AgpFreePhysical;
740   OUT PAGP_RESERVE_VIRTUAL AgpReserveVirtual;
741   OUT PAGP_RELEASE_VIRTUAL AgpReleaseVirtual;
742   OUT PAGP_COMMIT_VIRTUAL AgpCommitVirtual;
743   OUT PAGP_FREE_VIRTUAL AgpFreeVirtual;
744   OUT ULONGLONG AgpAllocationLimit;
745   OUT PAGP_SET_RATE AgpSetRate;
746 } VIDEO_PORT_AGP_INTERFACE_2, *PVIDEO_PORT_AGP_INTERFACE_2;
747 
748 typedef struct _VIDEO_PORT_I2C_INTERFACE {
749   USHORT Size;
750   USHORT Version;
751   PVOID Context;
752   PINTERFACE_REFERENCE InterfaceReference;
753   PINTERFACE_DEREFERENCE InterfaceDereference;
754   PI2C_START I2CStart;
755   PI2C_STOP I2CStop;
756   PI2C_WRITE I2CWrite;
757   PI2C_READ I2CRead;
758 } VIDEO_PORT_I2C_INTERFACE, *PVIDEO_PORT_I2C_INTERFACE;
759 
760 typedef struct _VIDEO_PORT_I2C_INTERFACE_2 {
761   IN USHORT Size;
762   IN USHORT Version;
763   OUT PVOID Context;
764   OUT PINTERFACE_REFERENCE InterfaceReference;
765   OUT PINTERFACE_DEREFERENCE InterfaceDereference;
766   OUT PI2C_START_2 I2CStart;
767   OUT PI2C_STOP_2 I2CStop;
768   OUT PI2C_WRITE_2 I2CWrite;
769   OUT PI2C_READ_2 I2CRead;
770 } VIDEO_PORT_I2C_INTERFACE_2, *PVIDEO_PORT_I2C_INTERFACE_2;
771 
772 typedef struct _VIDEO_PORT_INT10_INTERFACE {
773   IN USHORT Size;
774   IN USHORT Version;
775   OUT PVOID Context;
776   OUT PINTERFACE_REFERENCE InterfaceReference;
777   OUT PINTERFACE_DEREFERENCE InterfaceDereference;
778   OUT PINT10_ALLOCATE_BUFFER Int10AllocateBuffer;
779   OUT PINT10_FREE_BUFFER Int10FreeBuffer;
780   OUT PINT10_READ_MEMORY Int10ReadMemory;
781   OUT PINT10_WRITE_MEMORY Int10WriteMemory;
782   OUT PINT10_CALL_BIOS Int10CallBios;
783 } VIDEO_PORT_INT10_INTERFACE, *PVIDEO_PORT_INT10_INTERFACE;
784 
785 typedef struct _VIDEO_PORT_WCMEMORYPROTECTION_INTERFACE {
786   IN USHORT Size;
787   IN USHORT Version;
788   OUT PVOID Context;
789   OUT PINTERFACE_REFERENCE InterfaceReference;
790   OUT PINTERFACE_DEREFERENCE InterfaceDereference;
791   OUT PROTECT_WC_MEMORY VideoPortProtectWCMemory;
792   OUT RESTORE_WC_MEMORY VideoPortRestoreWCMemory;
793 } VIDEO_PORT_WCMEMORYPROTECTION_INTERFACE, *PVIDEO_PORT_WCMEMORYPROTECTION_INTERFACE;
794 
795 typedef struct _VPOSVERSIONINFO {
796   IN ULONG Size;
797   OUT ULONG MajorVersion;
798   OUT ULONG MinorVersion;
799   OUT ULONG BuildNumber;
800   OUT USHORT ServicePackMajor;
801   OUT USHORT ServicePackMinor;
802 } VPOSVERSIONINFO, *PVPOSVERSIONINFO;
803 
804 typedef struct _VIDEO_PORT_DEBUG_REPORT_INTERFACE {
805   IN USHORT Size;
806   IN USHORT Version;
807   OUT PVOID Context;
808   OUT PINTERFACE_REFERENCE InterfaceReference;
809   OUT PINTERFACE_DEREFERENCE InterfaceDereference;
810   OUT PVIDEO_DEBUG_REPORT (*DbgReportCreate)(
811     IN PVOID HwDeviceExtension,
812     IN ULONG ulCode,
813     IN ULONG_PTR ulpArg1,
814     IN ULONG_PTR ulpArg2,
815     IN ULONG_PTR ulpArg3,
816     IN ULONG_PTR ulpArg4
817   );
818   OUT BOOLEAN (*DbgReportSecondaryData)(
819     IN OUT PVIDEO_DEBUG_REPORT pReport,
820     IN PVOID pvData,
821     IN ULONG ulDataSize
822   );
823   OUT VOID (*DbgReportComplete)(
824     IN OUT PVIDEO_DEBUG_REPORT pReport
825   );
826 } VIDEO_PORT_DEBUG_REPORT_INTERFACE, *PVIDEO_PORT_DEBUG_REPORT_INTERFACE;
827 
828 /* Video port functions for miniports */
829 
830 VPAPI
831 VP_STATUS
832 NTAPI
833 VideoPortAllocateBuffer(
834   IN PVOID HwDeviceExtension,
835   IN ULONG Size,
836   OUT PVOID *Buffer);
837 
838 VPAPI
839 VOID
840 NTAPI
841 VideoPortAcquireDeviceLock(
842   IN PVOID HwDeviceExtension);
843 
844 VPAPI
845 ULONG
846 NTAPI
847 VideoPortCompareMemory(
848   IN PVOID Source1,
849   IN PVOID Source2,
850   IN SIZE_T Length);
851 
852 VPAPI
853 BOOLEAN
854 NTAPI
855 VideoPortDDCMonitorHelper(
856   IN PVOID HwDeviceExtension,
857   IN PVOID DDCControl,
858   IN OUT PUCHAR EdidBuffer,
859   IN ULONG EdidBufferSize);
860 
861 VPAPI
862 VOID
863 __cdecl
864 VideoPortDebugPrint(
865   IN VIDEO_DEBUG_LEVEL DebugPrintLevel,
866   IN PSTR DebugMessage,
867   IN ...);
868 
869 VPAPI
870 VP_STATUS
871 NTAPI
872 VideoPortDisableInterrupt(
873   IN PVOID HwDeviceExtension);
874 
875 VPAPI
876 VP_STATUS
877 NTAPI
878 VideoPortEnableInterrupt(
879   IN PVOID HwDeviceExtension);
880 
881 VPAPI
882 VP_STATUS
883 NTAPI
884 VideoPortEnumerateChildren(
885   IN PVOID HwDeviceExtension,
886   IN PVOID Reserved);
887 
888 VPAPI
889 VOID
890 NTAPI
891 VideoPortFreeDeviceBase(
892   IN PVOID HwDeviceExtension,
893   IN PVOID MappedAddress);
894 
895 VPAPI
896 VP_STATUS
897 NTAPI
898 VideoPortGetAccessRanges(
899   IN PVOID HwDeviceExtension,
900   IN ULONG NumRequestedResources,
901   IN PIO_RESOURCE_DESCRIPTOR RequestedResources OPTIONAL,
902   IN ULONG NumAccessRanges,
903   OUT PVIDEO_ACCESS_RANGE AccessRanges,
904   IN PVOID VendorId,
905   IN PVOID DeviceId,
906   OUT PULONG Slot);
907 
908 VPAPI
909 PVOID
910 NTAPI
911 VideoPortGetAssociatedDeviceExtension(
912   IN PVOID DeviceObject);
913 
914 VPAPI
915 ULONG
916 NTAPI
917 VideoPortGetBusData(
918   IN PVOID HwDeviceExtension,
919   IN BUS_DATA_TYPE BusDataType,
920   IN ULONG SlotNumber,
921   IN OUT PVOID Buffer,
922   IN ULONG Offset,
923   IN ULONG Length);
924 
925 VPAPI
926 UCHAR
927 NTAPI
928 VideoPortGetCurrentIrql(VOID);
929 
930 VPAPI
931 PVOID
932 NTAPI
933 VideoPortGetDeviceBase(
934   IN PVOID HwDeviceExtension,
935   IN PHYSICAL_ADDRESS IoAddress,
936   IN ULONG NumberOfUchars,
937   IN UCHAR InIoSpace);
938 
939 VPAPI
940 VP_STATUS
941 NTAPI
942 VideoPortGetDeviceData(
943   IN PVOID HwDeviceExtension,
944   IN VIDEO_DEVICE_DATA_TYPE DeviceDataType,
945   IN PMINIPORT_QUERY_DEVICE_ROUTINE CallbackRoutine,
946   IN PVOID Context);
947 
948 VPAPI
949 VP_STATUS
950 NTAPI
951 VideoPortGetRegistryParameters(
952   IN PVOID HwDeviceExtension,
953   IN PWSTR ParameterName,
954   IN UCHAR IsParameterFileName,
955   IN PMINIPORT_GET_REGISTRY_ROUTINE CallbackRoutine,
956   IN PVOID Context);
957 
958 VPAPI
959 PVOID
960 NTAPI
961 VideoPortGetRomImage(
962   IN PVOID HwDeviceExtension,
963   IN PVOID Unused1,
964   IN ULONG Unused2,
965   IN ULONG Length);
966 
967 VPAPI
968 VP_STATUS
969 NTAPI
970 VideoPortGetVgaStatus(
971   IN PVOID HwDeviceExtension,
972   OUT PULONG VgaStatus);
973 
974 VPAPI
975 LONG
976 FASTCALL
977 VideoPortInterlockedDecrement(
978   IN PLONG Addend);
979 
980 VPAPI
981 LONG
982 FASTCALL
983 VideoPortInterlockedExchange(
984   IN OUT PLONG Target,
985   IN LONG Value);
986 
987 VPAPI
988 LONG
989 FASTCALL
990 VideoPortInterlockedIncrement(
991   IN PLONG Addend);
992 
993 VPAPI
994 ULONG
995 NTAPI
996 VideoPortInitialize(
997   IN PVOID Argument1,
998   IN PVOID Argument2,
999   IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
1000   IN PVOID HwContext);
1001 
1002 VPAPI
1003 VP_STATUS
1004 NTAPI
1005 VideoPortInt10(
1006   IN PVOID HwDeviceExtension,
1007   IN PVIDEO_X86_BIOS_ARGUMENTS BiosArguments);
1008 
1009 VPAPI
1010 VOID
1011 NTAPI
1012 VideoPortLogError(
1013   IN PVOID HwDeviceExtension,
1014   IN PVIDEO_REQUEST_PACKET Vrp OPTIONAL,
1015   IN VP_STATUS ErrorCode,
1016   IN ULONG UniqueId);
1017 
1018 VPAPI
1019 VP_STATUS
1020 NTAPI
1021 VideoPortMapBankedMemory(
1022   IN PVOID HwDeviceExtension,
1023   IN PHYSICAL_ADDRESS PhysicalAddress,
1024   IN OUT PULONG Length,
1025   PULONG InIoSpace,
1026   PVOID *VirtualAddress,
1027   ULONG BankLength,
1028   UCHAR ReadWriteBank,
1029   PBANKED_SECTION_ROUTINE BankRoutine,
1030   PVOID Context);
1031 
1032 VPAPI
1033 VP_STATUS
1034 NTAPI
1035 VideoPortMapMemory(
1036   IN PVOID HwDeviceExtension,
1037   IN PHYSICAL_ADDRESS PhysicalAddress,
1038   IN OUT PULONG Length,
1039   IN PULONG InIoSpace,
1040   IN OUT PVOID *VirtualAddress);
1041 
1042 VPAPI
1043 VOID
1044 NTAPI
1045 VideoPortMoveMemory(
1046   IN PVOID Destination,
1047   IN PVOID Source,
1048   IN ULONG Length);
1049 
1050 VPAPI
1051 LONGLONG
1052 NTAPI
1053 VideoPortQueryPerformanceCounter(
1054   IN PVOID HwDeviceExtension,
1055   OUT PLONGLONG PerformanceFrequency OPTIONAL);
1056 
1057 VPAPI
1058 VP_STATUS
1059 NTAPI
1060 VideoPortQueryServices(
1061   IN PVOID HwDeviceExtension,
1062   IN VIDEO_PORT_SERVICES ServicesType,
1063   IN OUT PINTERFACE Interface);
1064 
1065 VPAPI
1066 BOOLEAN
1067 NTAPI
1068 VideoPortQueueDpc(
1069   IN PVOID HwDeviceExtension,
1070   IN PMINIPORT_DPC_ROUTINE CallbackRoutine,
1071   IN PVOID Context);
1072 
1073 VPAPI
1074 VOID
1075 NTAPI
1076 VideoPortReadPortBufferUchar(
1077   IN PUCHAR Port,
1078   OUT PUCHAR Buffer,
1079   IN ULONG Count);
1080 
1081 VPAPI
1082 VOID
1083 NTAPI
1084 VideoPortReadPortBufferUlong(
1085   IN PULONG Port,
1086   OUT PULONG Buffer,
1087   IN ULONG Count);
1088 
1089 VPAPI
1090 VOID
1091 NTAPI
1092 VideoPortReadPortBufferUshort(
1093   IN PUSHORT Port,
1094   OUT PUSHORT Buffer,
1095   IN ULONG Count);
1096 
1097 VPAPI
1098 UCHAR
1099 NTAPI
1100 VideoPortReadPortUchar(
1101   IN PUCHAR Port);
1102 
1103 VPAPI
1104 ULONG
1105 NTAPI
1106 VideoPortReadPortUlong(
1107   IN PULONG Port);
1108 
1109 VPAPI
1110 USHORT
1111 NTAPI
1112 VideoPortReadPortUshort(
1113   IN PUSHORT Port);
1114 
1115 VPAPI
1116 VOID
1117 NTAPI
1118 VideoPortReadRegisterBufferUchar(
1119   IN PUCHAR Register,
1120   OUT PUCHAR Buffer,
1121   IN ULONG Count);
1122 
1123 VPAPI
1124 VOID
1125 NTAPI
1126 VideoPortReadRegisterBufferUlong(
1127   IN PULONG Register,
1128   OUT PULONG Buffer,
1129   IN ULONG Count);
1130 
1131 VPAPI
1132 VOID
1133 NTAPI
1134 VideoPortReadRegisterBufferUshort(
1135   IN PUSHORT Register,
1136   OUT PUSHORT Buffer,
1137   IN ULONG Count);
1138 
1139 VPAPI
1140 UCHAR
1141 NTAPI
1142 VideoPortReadRegisterUchar(
1143   IN PUCHAR Register);
1144 
1145 VPAPI
1146 ULONG
1147 NTAPI
1148 VideoPortReadRegisterUlong(
1149   IN PULONG Register);
1150 
1151 VPAPI
1152 USHORT
1153 NTAPI
1154 VideoPortReadRegisterUshort(
1155   IN PUSHORT Register);
1156 
1157 VPAPI
1158 VOID
1159 NTAPI
1160 VideoPortReleaseBuffer(
1161   IN PVOID HwDeviceExtension,
1162   IN PVOID Buffer);
1163 
1164 VPAPI
1165 VOID
1166 NTAPI
1167 VideoPortReleaseDeviceLock(
1168   IN PVOID HwDeviceExtension);
1169 
1170 VPAPI
1171 BOOLEAN
1172 NTAPI
1173 VideoPortScanRom(
1174   PVOID HwDeviceExtension,
1175   PUCHAR RomBase,
1176   ULONG RomLength,
1177   PUCHAR String);
1178 
1179 VPAPI
1180 ULONG
1181 NTAPI
1182 VideoPortSetBusData(
1183   IN PVOID HwDeviceExtension,
1184   IN BUS_DATA_TYPE BusDataType,
1185   IN ULONG SlotNumber,
1186   IN PVOID Buffer,
1187   IN ULONG Offset,
1188   IN ULONG Length);
1189 
1190 VPAPI
1191 VP_STATUS
1192 NTAPI
1193 VideoPortSetRegistryParameters(
1194   IN PVOID HwDeviceExtension,
1195   IN PWSTR ValueName,
1196   IN PVOID ValueData,
1197   IN ULONG ValueLength);
1198 
1199 VPAPI
1200 VP_STATUS
1201 NTAPI
1202 VideoPortSetTrappedEmulatorPorts(
1203   IN PVOID HwDeviceExtension,
1204   IN ULONG NumAccessRanges,
1205   IN PVIDEO_ACCESS_RANGE AccessRange);
1206 
1207 VPAPI
1208 VOID
1209 NTAPI
1210 VideoPortStallExecution(
1211   IN ULONG Microseconds);
1212 
1213 VPAPI
1214 VOID
1215 NTAPI
1216 VideoPortStartTimer(
1217   IN PVOID HwDeviceExtension);
1218 
1219 VPAPI
1220 VOID
1221 NTAPI
1222 VideoPortStopTimer(
1223   IN PVOID HwDeviceExtension);
1224 
1225 VPAPI
1226 BOOLEAN
1227 NTAPI
1228 VideoPortSynchronizeExecution(
1229   IN PVOID HwDeviceExtension,
1230   IN VIDEO_SYNCHRONIZE_PRIORITY Priority,
1231   IN PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine,
1232   IN PVOID Context);
1233 
1234 VPAPI
1235 VP_STATUS
1236 NTAPI
1237 VideoPortUnmapMemory(
1238   IN PVOID HwDeviceExtension,
1239   IN OUT PVOID VirtualAddress,
1240   IN HANDLE ProcessHandle);
1241 
1242 VPAPI
1243 VP_STATUS
1244 NTAPI
1245 VideoPortVerifyAccessRanges(
1246   IN PVOID HwDeviceExtension,
1247   IN ULONG NumAccessRanges,
1248   IN PVIDEO_ACCESS_RANGE AccessRanges);
1249 
1250 VPAPI
1251 VOID
1252 NTAPI
1253 VideoPortWritePortBufferUchar(
1254   IN PUCHAR Port,
1255   IN PUCHAR Buffer,
1256   IN ULONG Count);
1257 
1258 VPAPI
1259 VOID
1260 NTAPI
1261 VideoPortWritePortBufferUlong(
1262   IN PULONG Port,
1263   IN PULONG Buffer,
1264   IN ULONG Count);
1265 
1266 VPAPI
1267 VOID
1268 NTAPI
1269 VideoPortWritePortBufferUshort(
1270   IN PUSHORT Port,
1271   IN PUSHORT Buffer,
1272   IN ULONG Count);
1273 
1274 VPAPI
1275 VOID
1276 NTAPI
1277 VideoPortWritePortUchar(
1278   IN PUCHAR Port,
1279   IN UCHAR Value);
1280 
1281 VPAPI
1282 VOID
1283 NTAPI
1284 VideoPortWritePortUlong(
1285   IN PULONG Port,
1286   IN ULONG Value);
1287 
1288 VPAPI
1289 VOID
1290 NTAPI
1291 VideoPortWritePortUshort(
1292   IN PUSHORT Port,
1293   IN USHORT Value);
1294 
1295 VPAPI
1296 VOID
1297 NTAPI
1298 VideoPortWriteRegisterBufferUchar(
1299   IN PUCHAR Register,
1300   IN PUCHAR Buffer,
1301   IN ULONG Count);
1302 
1303 VPAPI
1304 VOID
1305 NTAPI
1306 VideoPortWriteRegisterBufferUlong(
1307   IN PULONG Register,
1308   IN PULONG Buffer,
1309   IN ULONG Count);
1310 
1311 VPAPI
1312 VOID
1313 NTAPI
1314 VideoPortWriteRegisterBufferUshort(
1315   IN PUSHORT Register,
1316   IN PUSHORT Buffer,
1317   IN ULONG Count);
1318 
1319 VPAPI
1320 VOID
1321 NTAPI
1322 VideoPortWriteRegisterUchar(
1323   IN PUCHAR Register,
1324   IN UCHAR Value);
1325 
1326 VPAPI
1327 VOID
1328 NTAPI
1329 VideoPortWriteRegisterUlong(
1330   IN PULONG Register,
1331   IN ULONG Value);
1332 
1333 VPAPI
1334 VOID
1335 NTAPI
1336 VideoPortWriteRegisterUshort(
1337   IN PUSHORT Register,
1338   IN USHORT Value);
1339 
1340 VPAPI
1341 VOID
1342 NTAPI
1343 VideoPortZeroDeviceMemory(
1344   IN PVOID Destination,
1345   IN ULONG Length);
1346 
1347 VPAPI
1348 VOID
1349 NTAPI
1350 VideoPortZeroMemory(
1351   IN PVOID Destination,
1352   IN ULONG Length);
1353 
1354 VPAPI
1355 PVOID
1356 NTAPI
1357 VideoPortAllocateContiguousMemory(
1358   IN PVOID HwDeviceExtension,
1359   IN ULONG NumberOfBytes,
1360   IN PHYSICAL_ADDRESS HighestAcceptableAddress);
1361 
1362 VPAPI
1363 PVOID
1364 NTAPI
1365 VideoPortGetCommonBuffer(
1366   IN PVOID HwDeviceExtension,
1367   IN ULONG DesiredLength,
1368   IN ULONG Alignment,
1369   OUT PPHYSICAL_ADDRESS LogicalAddress,
1370   OUT PULONG pActualLength,
1371   IN BOOLEAN CacheEnabled);
1372 
1373 VPAPI
1374 VOID
1375 NTAPI
1376 VideoPortFreeCommonBuffer(
1377   IN PVOID HwDeviceExtension,
1378   IN ULONG Length,
1379   IN PVOID VirtualAddress,
1380   IN PHYSICAL_ADDRESS LogicalAddress,
1381   IN BOOLEAN CacheEnabled);
1382 
1383 VPAPI
1384 PDMA
1385 NTAPI
1386 VideoPortDoDma(
1387   IN PVOID HwDeviceExtension,
1388   IN PDMA pDma,
1389   IN DMA_FLAGS DmaFlags);
1390 
1391 VPAPI
1392 BOOLEAN
1393 NTAPI
1394 VideoPortLockPages(
1395   IN PVOID HwDeviceExtension,
1396   IN OUT PVIDEO_REQUEST_PACKET pVrp,
1397   IN OUT PEVENT pUEvent,
1398   IN PEVENT pDisplayEvent,
1399   IN DMA_FLAGS DmaFlags);
1400 
1401 VPAPI
1402 BOOLEAN
1403 NTAPI
1404 VideoPortUnlockPages(
1405   IN PVOID hwDeviceExtension,
1406   IN OUT PDMA pDma);
1407 
1408 VPAPI
1409 BOOLEAN
1410 NTAPI
1411 VideoPortSignalDmaComplete(
1412   IN PVOID HwDeviceExtension,
1413   IN PDMA pDmaHandle);
1414 
1415 VPAPI
1416 PVOID
1417 NTAPI
1418 VideoPortGetMdl(
1419   IN PVOID HwDeviceExtension,
1420   IN PDMA pDma);
1421 
1422 VPAPI
1423 PVOID
1424 NTAPI
1425 VideoPortGetDmaContext(
1426   IN PVOID HwDeviceExtension,
1427   IN PDMA pDma);
1428 
1429 VPAPI
1430 VOID
1431 NTAPI
1432 VideoPortSetDmaContext(
1433   IN PVOID HwDeviceExtension,
1434   OUT PDMA pDma,
1435   IN PVOID InstanceContext);
1436 
1437 VPAPI
1438 ULONG
1439 NTAPI
1440 VideoPortGetBytesUsed(
1441   IN PVOID HwDeviceExtension,
1442   IN PDMA pDma);
1443 
1444 VPAPI
1445 VOID
1446 NTAPI
1447 VideoPortSetBytesUsed(
1448   IN PVOID HwDeviceExtension,
1449   IN OUT PDMA pDma,
1450   IN ULONG BytesUsed);
1451 
1452 VPAPI
1453 PDMA
1454 NTAPI
1455 VideoPortAssociateEventsWithDmaHandle(
1456   IN PVOID HwDeviceExtension,
1457   IN OUT PVIDEO_REQUEST_PACKET pVrp,
1458   IN PVOID MappedUserEvent,
1459   IN PVOID DisplayDriverEvent);
1460 
1461 VPAPI
1462 PDMA
1463 NTAPI
1464 VideoPortMapDmaMemory(
1465   IN PVOID HwDeviceExtension,
1466   IN PVIDEO_REQUEST_PACKET pVrp,
1467   IN PHYSICAL_ADDRESS BoardAddress,
1468   IN PULONG Length,
1469   IN PULONG InIoSpace,
1470   IN PVOID MappedUserEvent,
1471   IN PVOID DisplayDriverEvent,
1472   IN OUT PVOID *VirtualAddress);
1473 
1474 VPAPI
1475 BOOLEAN
1476 NTAPI
1477 VideoPortUnmapDmaMemory(
1478   IN PVOID HwDeviceExtension,
1479   IN PVOID VirtualAddress,
1480   IN HANDLE ProcessHandle,
1481   IN PDMA BoardMemoryHandle);
1482 
1483 VPAPI
1484 VP_STATUS
1485 NTAPI
1486 VideoPortCreateSecondaryDisplay(
1487   IN PVOID HwDeviceExtension,
1488   IN OUT PVOID *SecondaryDeviceExtension,
1489   IN ULONG ulFlag);
1490 
1491 VPAPI
1492 PVP_DMA_ADAPTER
1493 NTAPI
1494 VideoPortGetDmaAdapter(
1495   IN PVOID HwDeviceExtension,
1496   IN PVP_DEVICE_DESCRIPTION VpDeviceDescription);
1497 
1498 VPAPI
1499 VOID
1500 NTAPI
1501 VideoPortPutDmaAdapter(
1502   IN PVOID HwDeviceExtension,
1503   IN PVP_DMA_ADAPTER VpDmaAdapter);
1504 
1505 VPAPI
1506 PVOID
1507 NTAPI
1508 VideoPortAllocateCommonBuffer(
1509   IN PVOID HwDeviceExtension,
1510   IN PVP_DMA_ADAPTER VpDmaAdapter,
1511   IN ULONG DesiredLength,
1512   OUT PPHYSICAL_ADDRESS LogicalAddress,
1513   IN BOOLEAN CacheEnabled,
1514   PVOID Reserved);
1515 
1516 VPAPI
1517 VOID
1518 NTAPI
1519 VideoPortReleaseCommonBuffer(
1520   IN PVOID HwDeviceExtension,
1521   IN PVP_DMA_ADAPTER VpDmaAdapter,
1522   IN ULONG Length,
1523   IN PHYSICAL_ADDRESS LogicalAddress,
1524   IN PVOID VirtualAddress,
1525   IN BOOLEAN CacheEnabled);
1526 
1527 VPAPI
1528 PVOID
1529 NTAPI
1530 VideoPortLockBuffer(
1531   IN PVOID HwDeviceExtension,
1532   IN PVOID BaseAddress,
1533   IN ULONG Length,
1534   IN VP_LOCK_OPERATION Operation);
1535 
1536 VPAPI
1537 VOID
1538 NTAPI
1539 VideoPortUnlockBuffer(
1540   IN PVOID HwDeviceExtension,
1541   IN PVOID Mdl);
1542 
1543 VPAPI
1544 VP_STATUS
1545 NTAPI
1546 VideoPortStartDma(
1547   IN PVOID HwDeviceExtension,
1548   IN PVP_DMA_ADAPTER VpDmaAdapter,
1549   IN PVOID Mdl,
1550   IN ULONG Offset,
1551   IN OUT PULONG pLength,
1552   IN PEXECUTE_DMA ExecuteDmaRoutine,
1553   IN PVOID Context,
1554   IN BOOLEAN WriteToDevice);
1555 
1556 VPAPI
1557 VP_STATUS
1558 NTAPI
1559 VideoPortCompleteDma(
1560   IN PVOID HwDeviceExtension,
1561   IN PVP_DMA_ADAPTER VpDmaAdapter,
1562   IN PVP_SCATTER_GATHER_LIST VpScatterGather,
1563   IN BOOLEAN WriteToDevice);
1564 
1565 VPAPI
1566 VP_STATUS
1567 NTAPI
1568 VideoPortCreateEvent(
1569   IN PVOID HwDeviceExtension,
1570   IN ULONG EventFlag,
1571   IN PVOID Unused,
1572   OUT PEVENT *ppEvent);
1573 
1574 VPAPI
1575 VP_STATUS
1576 NTAPI
1577 VideoPortDeleteEvent(
1578   IN PVOID HwDeviceExtension,
1579   IN PEVENT pEvent);
1580 
1581 VPAPI
1582 LONG
1583 NTAPI
1584 VideoPortSetEvent(
1585   IN PVOID HwDeviceExtension,
1586   IN PEVENT pEvent);
1587 
1588 VPAPI
1589 VOID
1590 NTAPI
1591 VideoPortClearEvent(
1592   IN PVOID HwDeviceExtension,
1593   IN PEVENT pEvent);
1594 
1595 VPAPI
1596 LONG
1597 NTAPI
1598 VideoPortReadStateEvent(
1599   IN PVOID HwDeviceExtension,
1600   IN PEVENT pEvent);
1601 
1602 VPAPI
1603 VP_STATUS
1604 NTAPI
1605 VideoPortWaitForSingleObject(
1606   IN PVOID HwDeviceExtension,
1607   IN PVOID Object,
1608   IN PLARGE_INTEGER Timeout OPTIONAL);
1609 
1610 VPAPI
1611 PVOID
1612 NTAPI
1613 VideoPortAllocatePool(
1614   IN PVOID HwDeviceExtension,
1615   IN VP_POOL_TYPE PoolType,
1616   IN SIZE_T NumberOfBytes,
1617   IN ULONG Tag);
1618 
1619 VPAPI
1620 VOID
1621 NTAPI
1622 VideoPortFreePool(
1623   IN PVOID HwDeviceExtension,
1624   IN PVOID Ptr);
1625 
1626 VPAPI
1627 VP_STATUS
1628 NTAPI
1629 VideoPortCreateSpinLock(
1630   IN PVOID HwDeviceExtension,
1631   OUT PSPIN_LOCK *SpinLock);
1632 
1633 VPAPI
1634 VP_STATUS
1635 NTAPI
1636 VideoPortDeleteSpinLock(
1637   IN PVOID HwDeviceExtension,
1638   IN PSPIN_LOCK SpinLock);
1639 
1640 VPAPI
1641 VOID
1642 NTAPI
1643 VideoPortAcquireSpinLock(
1644   IN PVOID HwDeviceExtension,
1645   IN PSPIN_LOCK SpinLock,
1646   OUT PUCHAR OldIrql);
1647 
1648 VPAPI
1649 VOID
1650 NTAPI
1651 VideoPortAcquireSpinLockAtDpcLevel(
1652   IN PVOID HwDeviceExtension,
1653   IN PSPIN_LOCK SpinLock);
1654 
1655 VPAPI
1656 VOID
1657 NTAPI
1658 VideoPortReleaseSpinLock(
1659   IN PVOID HwDeviceExtension,
1660   IN PSPIN_LOCK SpinLock,
1661   IN UCHAR NewIrql);
1662 
1663 VPAPI
1664 VOID
1665 NTAPI
1666 VideoPortReleaseSpinLockFromDpcLevel(
1667   IN PVOID HwDeviceExtension,
1668   IN PSPIN_LOCK SpinLock);
1669 
1670 VPAPI
1671 VOID
1672 NTAPI
1673 VideoPortQuerySystemTime(
1674   OUT PLARGE_INTEGER CurrentTime);
1675 
1676 VPAPI
1677 BOOLEAN
1678 NTAPI
1679 VideoPortCheckForDeviceExistence(
1680   IN PVOID HwDeviceExtension,
1681   IN USHORT VendorId,
1682   IN USHORT DeviceId,
1683   IN UCHAR RevisionId,
1684   IN USHORT SubVendorId,
1685   IN USHORT SubSystemId,
1686   IN ULONG Flags);
1687 
1688 VPAPI
1689 ULONG
1690 NTAPI
1691 VideoPortGetAssociatedDeviceID(
1692   IN PVOID DeviceObject);
1693 
1694 VPAPI
1695 VP_STATUS
1696 NTAPI
1697 VideoPortFlushRegistry(
1698   PVOID HwDeviceExtension);
1699 
1700 VPAPI
1701 VP_STATUS
1702 NTAPI
1703 VideoPortGetVersion(
1704   IN PVOID HwDeviceExtension,
1705   IN OUT PVPOSVERSIONINFO pVpOsVersionInfo);
1706 
1707 VPAPI
1708 BOOLEAN
1709 NTAPI
1710 VideoPortIsNoVesa(VOID);
1711 
1712 VPAPI
1713 VP_STATUS
1714 NTAPI
1715 VideoPortRegisterBugcheckCallback(
1716   IN PVOID HwDeviceExtension,
1717   IN ULONG BugcheckCode,
1718   IN PVIDEO_BUGCHECK_CALLBACK Callback,
1719   IN ULONG BugcheckDataSize);
1720 
1721 VPAPI
1722 PVIDEO_DEBUG_REPORT
1723 NTAPI
1724 VideoPortDbgReportCreate(
1725   IN PVOID HwDeviceExtension,
1726   IN ULONG ulCode,
1727   IN ULONG_PTR ulpArg1,
1728   IN ULONG_PTR ulpArg2,
1729   IN ULONG_PTR ulpArg3,
1730   IN ULONG_PTR ulpArg4);
1731 
1732 VPAPI
1733 BOOLEAN
1734 NTAPI
1735 VideoPortDbgReportSecondaryData(
1736   IN OUT PVIDEO_DEBUG_REPORT pReport,
1737   IN PVOID pvData,
1738   IN ULONG ulDataSize);
1739 
1740 VPAPI
1741 VOID
1742 NTAPI
1743 VideoPortDbgReportComplete(
1744   IN OUT PVIDEO_DEBUG_REPORT pReport);
1745 
1746 #ifdef __cplusplus
1747 }
1748 #endif
1749