4 * Video port and miniport driver interface
6 * This file is part of the w32api package.
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
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.
28 #pragma GCC system_header
32 #error winddi.h cannot be included with video.h
41 #if defined(_VIDEOPORT_)
42 #define VPAPI DECLSPEC_EXPORT
44 #define VPAPI DECLSPEC_IMPORT
51 typedef LONG VP_STATUS
;
52 typedef VP_STATUS
*PVP_STATUS
;
53 typedef struct __DMA_PARAMETERS
* PDMA
;
54 typedef struct _VIDEO_PORT_EVENT
*PEVENT
;
55 typedef struct _VIDEO_PORT_SPIN_LOCK
*PSPIN_LOCK
;
56 typedef struct __VP_DMA_ADAPTER
*PVP_DMA_ADAPTER
;
58 #define DISPLAY_ADAPTER_HW_ID 0xFFFFFFFF
60 #define EVENT_TYPE_MASK 1
61 #define SYNCHRONIZATION_EVENT 0
62 #define NOTIFICATION_EVENT 1
64 #define INITIAL_EVENT_STATE_MASK 2
65 #define INITIAL_EVENT_NOT_SIGNALED 0
66 #define INITIAL_EVENT_SIGNALED 2
68 typedef enum VIDEO_DEBUG_LEVEL
{
73 } VIDEO_DEBUG_LEVEL
, *PVIDEO_DEBUG_LEVEL
;
76 VideoPortUnlockAfterDma
= 1,
77 VideoPortKeepPagesLocked
,
81 typedef enum _HW_DMA_RETURN
{
84 } HW_DMA_RETURN
, *PHW_DMA_RETURN
;
87 (*PVIDEO_HW_START_DMA
)(
88 PVOID HwDeviceExtension
,
94 #define PAGED_CODE() \
95 if (VideoPortGetCurrentIrql() > 1 /* APC_LEVEL */) \
97 VideoPortDebugPrint(Error, "Video: Pageable code called at IRQL %d\n", VideoPortGetCurrentIrql() ); \
107 typedef struct _VIDEO_HARDWARE_CONFIGURATION_DATA
{
108 INTERFACE_TYPE InterfaceType
;
120 } VIDEO_HARDWARE_CONFIGURATION_DATA
, *PVIDEO_HARDWARE_CONFIGURATION_DATA
;
122 #define SIZE_OF_NT4_VIDEO_PORT_CONFIG_INFO 0x42
123 #define SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA 0x28
124 #define SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA 0x50
126 typedef enum _VIDEO_DEVICE_DATA_TYPE
{
132 } VIDEO_DEVICE_DATA_TYPE
, *PVIDEO_DEVICE_DATA_TYPE
;
136 /* Video miniport driver functions */
138 typedef struct _VP_SCATTER_GATHER_ELEMENT
{
139 PHYSICAL_ADDRESS Address
;
142 } VP_SCATTER_GATHER_ELEMENT
, *PVP_SCATTER_GATHER_ELEMENT
;
144 typedef struct _VP_SCATTER_GATHER_LIST
{
145 ULONG NumberOfElements
;
147 VP_SCATTER_GATHER_ELEMENT Elements
[0];
148 } VP_SCATTER_GATHER_LIST
, *PVP_SCATTER_GATHER_LIST
;
152 /*IN*/ PVOID HwDeviceExtension
,
153 /*IN*/ PVP_DMA_ADAPTER VpDmaAdapter
,
154 /*IN*/ PVP_SCATTER_GATHER_LIST SGList
,
155 /*IN*/ PVOID Context
);
158 (*PVIDEO_PORT_GET_PROC_ADDRESS
)(
159 /*IN*/ PVOID HwDeviceExtension
,
160 /*IN*/ PUCHAR FunctionName
);
162 typedef struct _VIDEO_PORT_CONFIG_INFO
{
164 ULONG SystemIoBusNumber
;
165 INTERFACE_TYPE AdapterInterfaceType
;
166 ULONG BusInterruptLevel
;
167 ULONG BusInterruptVector
;
168 KINTERRUPT_MODE InterruptMode
;
169 ULONG NumEmulatorAccessEntries
;
170 PEMULATOR_ACCESS_ENTRY EmulatorAccessEntries
;
171 ULONG_PTR EmulatorAccessEntriesContext
;
172 PHYSICAL_ADDRESS VdmPhysicalVideoMemoryAddress
;
173 ULONG VdmPhysicalVideoMemoryLength
;
174 ULONG HardwareStateSize
;
178 UCHAR InterruptShareable
;
183 BOOLEAN NeedPhysicalAddresses
;
185 ULONG MaximumTransferLength
;
186 ULONG NumberOfPhysicalBreaks
;
187 BOOLEAN ScatterGather
;
188 ULONG MaximumScatterGatherChunkSize
;
189 PVIDEO_PORT_GET_PROC_ADDRESS VideoPortGetProcAddress
;
190 PWSTR DriverRegistryPath
;
191 ULONGLONG SystemMemorySize
;
192 } VIDEO_PORT_CONFIG_INFO
, *PVIDEO_PORT_CONFIG_INFO
;
194 typedef VP_STATUS DDKAPI
195 (*PVIDEO_HW_FIND_ADAPTER
)(
196 /*IN*/ PVOID HwDeviceExtension
,
197 /*IN*/ PVOID HwContext
,
198 /*IN*/ PWSTR ArgumentString
,
199 /*IN OUT*/ PVIDEO_PORT_CONFIG_INFO ConfigInfo
,
200 /*OUT*/ PUCHAR Again
);
202 typedef VP_STATUS DDKAPI
203 (*PVIDEO_HW_POWER_GET
)(
204 /*IN*/ PVOID HwDeviceExtension
,
206 /*IN OUT*/ PVIDEO_POWER_MANAGEMENT VideoPowerControl
);
208 /* PVIDEO_HW_GET_CHILD_DESCRIPTOR return values */
209 #define VIDEO_ENUM_MORE_DEVICES ERROR_CONTINUE
210 #define VIDEO_ENUM_NO_MORE_DEVICES ERROR_NO_MORE_DEVICES
211 #define VIDEO_ENUM_INVALID_DEVICE ERROR_INVALID_NAME
213 /* PVIDEO_HW_GET_CHILD_DESCRIPTOR.ChildEnumInfo constants */
214 typedef struct _VIDEO_CHILD_ENUM_INFO
{
216 ULONG ChildDescriptorSize
;
219 PVOID ChildHwDeviceExtension
;
220 } VIDEO_CHILD_ENUM_INFO
, *PVIDEO_CHILD_ENUM_INFO
;
222 /* PVIDEO_HW_GET_CHILD_DESCRIPTOR.VideoChildType constants */
223 typedef enum _VIDEO_CHILD_TYPE
{
228 } VIDEO_CHILD_TYPE
, *PVIDEO_CHILD_TYPE
;
230 typedef VP_STATUS DDKAPI
231 (*PVIDEO_HW_GET_CHILD_DESCRIPTOR
)(
232 /*IN*/ PVOID HwDeviceExtension
,
233 /*IN*/ PVIDEO_CHILD_ENUM_INFO ChildEnumInfo
,
234 /*OUT*/ PVIDEO_CHILD_TYPE VideoChildType
,
235 /*OUT*/ PUCHAR pChildDescriptor
,
237 /*OUT*/ PULONG pUnused
);
239 typedef BOOLEAN DDKAPI
240 (*PVIDEO_HW_INITIALIZE
)(
241 /*IN*/ PVOID HwDeviceExtension
);
243 typedef BOOLEAN DDKAPI
244 (*PVIDEO_HW_INTERRUPT
)(
245 /*IN*/ PVOID HwDeviceExtension
);
247 /* VIDEO_ACCESS_RANGE.RangePassive */
248 #define VIDEO_RANGE_PASSIVE_DECODE 1
249 #define VIDEO_RANGE_10_BIT_DECODE 2
251 #ifndef VIDEO_ACCESS_RANGE_DEFINED /* also in miniport.h */
252 #define VIDEO_ACCESS_RANGE_DEFINED
253 typedef struct _VIDEO_ACCESS_RANGE
{
254 PHYSICAL_ADDRESS RangeStart
;
256 UCHAR RangeInIoSpace
;
258 UCHAR RangeShareable
;
260 } VIDEO_ACCESS_RANGE
, *PVIDEO_ACCESS_RANGE
;
264 (*PVIDEO_HW_LEGACYRESOURCES
)(
265 /*IN*/ ULONG VendorId
,
266 /*IN*/ ULONG DeviceId
,
267 /*IN OUT*/ PVIDEO_ACCESS_RANGE
*LegacyResourceList
,
268 /*IN OUT*/ PULONG LegacyResourceCount
);
270 typedef VP_STATUS DDKAPI
271 (*PMINIPORT_QUERY_DEVICE_ROUTINE
)(
272 /*IN*/ PVOID HwDeviceExtension
,
273 /*IN*/ PVOID Context
,
274 /*IN*/ VIDEO_DEVICE_DATA_TYPE DeviceDataType
,
275 /*IN*/ PVOID Identifier
,
276 /*IN*/ ULONG IdentifierLength
,
277 /*IN*/ PVOID ConfigurationData
,
278 /*IN*/ ULONG ConfigurationDataLength
,
279 /*IN OUT*/ PVOID ComponentInformation
,
280 /*IN*/ ULONG ComponentInformationLength
);
282 typedef struct _QUERY_INTERFACE
{
283 CONST GUID
*InterfaceType
;
286 PINTERFACE Interface
;
287 PVOID InterfaceSpecificData
;
288 } QUERY_INTERFACE
, *PQUERY_INTERFACE
;
290 typedef VP_STATUS DDKAPI
291 (*PVIDEO_HW_QUERY_INTERFACE
)(
292 /*IN*/ PVOID HwDeviceExtension
,
293 /*IN OUT*/ PQUERY_INTERFACE QueryInterface
);
295 typedef VP_STATUS DDKAPI
296 (*PMINIPORT_GET_REGISTRY_ROUTINE
)(
297 /*IN*/ PVOID HwDeviceExtension
,
298 /*IN*/ PVOID Context
,
299 /*IN OUT*/ PWSTR ValueName
,
300 /*IN OUT*/ PVOID ValueData
,
301 /*IN*/ ULONG ValueLength
);
303 typedef BOOLEAN DDKAPI
304 (*PVIDEO_HW_RESET_HW
)(
305 /*IN*/ PVOID HwDeviceExtension
,
306 /*IN*/ ULONG Columns
,
309 typedef VP_STATUS DDKAPI
310 (*PVIDEO_HW_POWER_SET
)(
311 /*IN*/ PVOID HwDeviceExtension
,
313 /*IN*/ PVIDEO_POWER_MANAGEMENT VideoPowerControl
);
315 typedef struct _STATUS_BLOCK
{
316 _ANONYMOUS_UNION
union {
320 ULONG_PTR Information
;
321 } STATUS_BLOCK
, *PSTATUS_BLOCK
;
323 typedef struct _VIDEO_REQUEST_PACKET
{
325 PSTATUS_BLOCK StatusBlock
;
327 ULONG InputBufferLength
;
329 ULONG OutputBufferLength
;
330 } VIDEO_REQUEST_PACKET
, *PVIDEO_REQUEST_PACKET
;
332 typedef BOOLEAN DDKAPI
333 (*PVIDEO_HW_START_IO
)(
334 /*IN*/ PVOID HwDeviceExtension
,
335 /*IN*/ PVIDEO_REQUEST_PACKET RequestPacket
);
337 typedef BOOLEAN DDKAPI
338 (*PMINIPORT_SYNCHRONIZE_ROUTINE
)(
339 /*IN*/ PVOID Context
);
343 /*IN*/ PVOID HwDeviceExtension
);
346 (*PMINIPORT_DPC_ROUTINE
)(
347 /*IN*/ PVOID HwDeviceExtension
,
348 /*IN*/ PVOID Context
);
350 typedef VP_STATUS DDKAPI
351 (*PDRIVER_IO_PORT_UCHAR
)(
352 /*IN*/ ULONG_PTR Context
,
354 /*IN*/ UCHAR AccessMode
,
357 typedef VP_STATUS DDKAPI
358 (*PDRIVER_IO_PORT_UCHAR_STRING
)(
359 /*IN*/ ULONG_PTR Context
,
361 /*IN*/ UCHAR AccessMode
,
363 /*IN*/ ULONG DataLength
);
365 typedef VP_STATUS DDKAPI
366 (*PDRIVER_IO_PORT_ULONG
)(
367 /*IN*/ ULONG_PTR Context
,
369 /*IN*/ UCHAR AccessMode
,
372 typedef VP_STATUS DDKAPI
373 (*PDRIVER_IO_PORT_ULONG_STRING
)(
374 /*IN*/ ULONG_PTR Context
,
376 /*IN*/ UCHAR AccessMode
,
378 /*IN*/ ULONG DataLength
);
380 typedef VP_STATUS DDKAPI
381 (*PDRIVER_IO_PORT_USHORT
)(
382 /*IN*/ ULONG_PTR Context
,
384 /*IN*/ UCHAR AccessMode
,
385 /*IN*/ PUSHORT Data
);
387 typedef VP_STATUS DDKAPI
388 (*PDRIVER_IO_PORT_USHORT_STRING
)(
389 /*IN*/ ULONG_PTR Context
,
391 /*IN*/ UCHAR AccessMode
,
393 /*IN*/ ULONG DataLength
);
397 typedef struct _INT10_BIOS_ARGUMENTS
{
407 } INT10_BIOS_ARGUMENTS
, *PINT10_BIOS_ARGUMENTS
;
409 typedef struct _VIDEO_CHILD_STATE
{
412 } VIDEO_CHILD_STATE
, *PVIDEO_CHILD_STATE
;
414 typedef struct _VIDEO_CHILD_STATE_CONFIGURATION
{
416 VIDEO_CHILD_STATE ChildStateArray
[ANYSIZE_ARRAY
];
417 } VIDEO_CHILD_STATE_CONFIGURATION
, *PVIDEO_CHILD_STATE_CONFIGURATION
;
419 typedef struct _VIDEO_HW_INITIALIZATION_DATA
{
420 ULONG HwInitDataSize
;
421 INTERFACE_TYPE AdapterInterfaceType
;
422 PVIDEO_HW_FIND_ADAPTER HwFindAdapter
;
423 PVIDEO_HW_INITIALIZE HwInitialize
;
424 PVIDEO_HW_INTERRUPT HwInterrupt
;
425 PVIDEO_HW_START_IO HwStartIO
;
426 ULONG HwDeviceExtensionSize
;
427 ULONG StartingDeviceNumber
;
428 PVIDEO_HW_RESET_HW HwResetHw
;
429 PVIDEO_HW_TIMER HwTimer
;
430 PVIDEO_HW_START_DMA HwStartDma
;
431 PVIDEO_HW_POWER_SET HwSetPowerState
;
432 PVIDEO_HW_POWER_GET HwGetPowerState
;
433 PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor
;
434 PVIDEO_HW_QUERY_INTERFACE HwQueryInterface
;
435 ULONG HwChildDeviceExtensionSize
;
436 PVIDEO_ACCESS_RANGE HwLegacyResourceList
;
437 ULONG HwLegacyResourceCount
;
438 PVIDEO_HW_LEGACYRESOURCES HwGetLegacyResources
;
439 BOOLEAN AllowEarlyEnumeration
;
441 } VIDEO_HW_INITIALIZATION_DATA
, *PVIDEO_HW_INITIALIZATION_DATA
;
443 /* VIDEO_PORT_AGP_INTERFACE.Version contants */
444 #define VIDEO_PORT_AGP_INTERFACE_VERSION_1 1
446 typedef struct _VIDEO_PORT_AGP_INTERFACE
{
450 PINTERFACE_REFERENCE InterfaceReference
;
451 PINTERFACE_DEREFERENCE InterfaceDereference
;
452 PAGP_RESERVE_PHYSICAL AgpReservePhysical
;
453 PAGP_RELEASE_PHYSICAL AgpReleasePhysical
;
454 PAGP_COMMIT_PHYSICAL AgpCommitPhysical
;
455 PAGP_FREE_PHYSICAL AgpFreePhysical
;
456 PAGP_RESERVE_VIRTUAL AgpReserveVirtual
;
457 PAGP_RELEASE_VIRTUAL AgpReleaseVirtual
;
458 PAGP_COMMIT_VIRTUAL AgpCommitVirtual
;
459 PAGP_FREE_VIRTUAL AgpFreeVirtual
;
460 ULONGLONG AgpAllocationLimit
;
461 } VIDEO_PORT_AGP_INTERFACE
, *PVIDEO_PORT_AGP_INTERFACE
;
463 /* VIDEO_PORT_AGP_INTERFACE_2.Version constants */
464 #define VIDEO_PORT_AGP_INTERFACE_VERSION_2 2
466 typedef struct _VIDEO_PORT_AGP_INTERFACE_2
{
468 /*IN*/ USHORT Version
;
469 /*OUT*/ PVOID Context
;
470 /*OUT*/ PINTERFACE_REFERENCE InterfaceReference
;
471 /*OUT*/ PINTERFACE_DEREFERENCE InterfaceDereference
;
472 /*OUT*/ PAGP_RESERVE_PHYSICAL AgpReservePhysical
;
473 /*OUT*/ PAGP_RELEASE_PHYSICAL AgpReleasePhysical
;
474 /*OUT*/ PAGP_COMMIT_PHYSICAL AgpCommitPhysical
;
475 /*OUT*/ PAGP_FREE_PHYSICAL AgpFreePhysical
;
476 /*OUT*/ PAGP_RESERVE_VIRTUAL AgpReserveVirtual
;
477 /*OUT*/ PAGP_RELEASE_VIRTUAL AgpReleaseVirtual
;
478 /*OUT*/ PAGP_COMMIT_VIRTUAL AgpCommitVirtual
;
479 /*OUT*/ PAGP_FREE_VIRTUAL AgpFreeVirtual
;
480 /*OUT*/ ULONGLONG AgpAllocationLimit
;
481 /*OUT*/ PAGP_SET_RATE AgpSetRate
;
482 } VIDEO_PORT_AGP_INTERFACE_2
, *PVIDEO_PORT_AGP_INTERFACE_2
;
484 #define VIDEO_PORT_I2C_INTERFACE_VERSION_1 1
487 (*PVIDEO_WRITE_CLOCK_LINE
)(
488 PVOID HwDeviceExtension
,
492 (*PVIDEO_WRITE_DATA_LINE
)(
493 PVOID HwDeviceExtension
,
496 typedef BOOLEAN DDKAPI
497 (*PVIDEO_READ_CLOCK_LINE
)(
498 PVOID HwDeviceExtension
);
500 typedef BOOLEAN DDKAPI
501 (*PVIDEO_READ_DATA_LINE
)(
502 PVOID HwDeviceExtension
);
504 typedef struct _I2C_CALLBACKS
506 /*IN*/ PVIDEO_WRITE_CLOCK_LINE WriteClockLine
;
507 /*IN*/ PVIDEO_WRITE_DATA_LINE WriteDataLine
;
508 /*IN*/ PVIDEO_READ_CLOCK_LINE ReadClockLine
;
509 /*IN*/ PVIDEO_READ_DATA_LINE ReadDataLine
;
510 } I2C_CALLBACKS
, *PI2C_CALLBACKS
;
512 typedef BOOLEAN DDKAPI
514 /*IN*/ PVOID HwDeviceExtension
,
515 /*IN*/ PI2C_CALLBACKS I2CCallbacks
);
517 typedef BOOLEAN DDKAPI
519 /*IN*/ PVOID HwDeviceExtension
,
520 /*IN*/ PI2C_CALLBACKS I2CCallbacks
);
522 typedef BOOLEAN DDKAPI
524 /*IN*/ PVOID HwDeviceExtension
,
525 /*IN*/ PI2C_CALLBACKS I2CCallbacks
,
526 /*IN*/ PUCHAR Buffer
,
527 /*IN*/ ULONG Length
);
529 typedef BOOLEAN DDKAPI
531 /*IN*/ PVOID HwDeviceExtension
,
532 /*IN*/ PI2C_CALLBACKS I2CCallbacks
,
533 /*OUT*/ PUCHAR Buffer
,
534 /*IN*/ ULONG Length
);
536 typedef struct _VIDEO_PORT_I2C_INTERFACE
{
540 PINTERFACE_REFERENCE InterfaceReference
;
541 PINTERFACE_DEREFERENCE InterfaceDereference
;
546 } VIDEO_PORT_I2C_INTERFACE
, *PVIDEO_PORT_I2C_INTERFACE
;
548 /* VIDEO_PORT_INT10_INTERFACE.Version constants */
549 #define VIDEO_PORT_INT10_INTERFACE_VERSION_1 1
551 typedef VP_STATUS DDKAPI
552 (*PINT10_ALLOCATE_BUFFER
)(
553 /*IN*/ PVOID Context
,
556 /*IN OUT*/ PULONG Length
);
558 typedef VP_STATUS DDKAPI
560 /*IN*/ PVOID Context
,
561 /*IN OUT*/ PINT10_BIOS_ARGUMENTS BiosArguments
);
563 typedef VP_STATUS DDKAPI
564 (*PINT10_FREE_BUFFER
)(
565 /*IN*/ PVOID Context
,
569 typedef VP_STATUS DDKAPI
570 (*PINT10_READ_MEMORY
)(
571 /*IN*/ PVOID Context
,
574 /*OUT*/ PVOID Buffer
,
575 /*IN*/ ULONG Length
);
577 typedef VP_STATUS DDKAPI
578 (*PINT10_WRITE_MEMORY
)(
579 /*IN*/ PVOID Context
,
583 /*IN*/ ULONG Length
);
585 typedef struct _VIDEO_PORT_INT10_INTERFACE
{
587 /*IN*/ USHORT Version
;
588 /*OUT*/ PVOID Context
;
589 /*OUT*/ PINTERFACE_REFERENCE InterfaceReference
;
590 /*OUT*/ PINTERFACE_DEREFERENCE InterfaceDereference
;
591 /*OUT*/ PINT10_ALLOCATE_BUFFER Int10AllocateBuffer
;
592 /*OUT*/ PINT10_FREE_BUFFER Int10FreeBuffer
;
593 /*OUT*/ PINT10_READ_MEMORY Int10ReadMemory
;
594 /*OUT*/ PINT10_WRITE_MEMORY Int10WriteMemory
;
595 /*OUT*/ PINT10_CALL_BIOS Int10CallBios
;
596 } VIDEO_PORT_INT10_INTERFACE
, *PVIDEO_PORT_INT10_INTERFACE
;
598 /* Flags for VideoPortGetDeviceBase and VideoPortMapMemory */
599 #define VIDEO_MEMORY_SPACE_MEMORY 0x00
600 #define VIDEO_MEMORY_SPACE_IO 0x01
601 #define VIDEO_MEMORY_SPACE_USER_MODE 0x02
602 #define VIDEO_MEMORY_SPACE_DENSE 0x04
603 #define VIDEO_MEMORY_SPACE_P6CACHE 0x08
605 typedef struct _VIDEO_X86_BIOS_ARGUMENTS
{
613 } VIDEO_X86_BIOS_ARGUMENTS
, *PVIDEO_X86_BIOS_ARGUMENTS
;
615 typedef struct _VP_DEVICE_DESCRIPTION
{
616 BOOLEAN ScatterGather
;
617 BOOLEAN Dma32BitAddresses
;
618 BOOLEAN Dma64BitAddresses
;
620 } VP_DEVICE_DESCRIPTION
, *PVP_DEVICE_DESCRIPTION
;
622 typedef struct _VPOSVERSIONINFO
{
624 /*OUT*/ ULONG MajorVersion
;
625 /*OUT*/ ULONG MinorVersion
;
626 /*OUT*/ ULONG BuildNumber
;
627 /*OUT*/ USHORT ServicePackMajor
;
628 /*OUT*/ USHORT ServicePackMinor
;
629 } VPOSVERSIONINFO
, *PVPOSVERSIONINFO
;
633 /* Video port functions for miniports */
639 /*IN*/ ULONG DebugPrintLevel
,
640 /*IN*/ PCHAR DebugMessage
,
646 VideoPortAcquireDeviceLock(
647 /*IN*/ PVOID HwDeviceExtension
);
652 VideoPortAcquireSpinLock(
653 /*IN*/ PVOID HwDeviceExtension
,
654 /*IN*/ PSPIN_LOCK SpinLock
,
655 /*OUT*/ PUCHAR OldIrql
);
660 VideoPortAcquireSpinLockAtDpcLevel(
661 /*IN*/ PVOID HwDeviceExtension
,
662 /*IN*/ PSPIN_LOCK SpinLock
);
667 VideoPortAllocateBuffer(
668 /*IN*/ PVOID HwDeviceExtension
,
670 /*OUT*/ PVOID
*Buffer
);
675 VideoPortAllocateCommonBuffer(
676 /*IN*/ PVOID HwDeviceExtension
,
677 /*IN*/ PVP_DMA_ADAPTER VpDmaAdapter
,
678 /*IN*/ ULONG DesiredLength
,
679 /*OUT*/ PPHYSICAL_ADDRESS LogicalAddress
,
680 /*IN*/ BOOLEAN CacheEnabled
,
686 VideoPortAllocateContiguousMemory(
687 /*IN*/ PVOID HwDeviceExtension
,
688 /*IN*/ ULONG NumberOfBytes
,
689 /*IN*/ PHYSICAL_ADDRESS HighestAcceptableAddress
);
691 /* VideoPortAllocatePool.PoolType constants */
692 typedef enum _VP_POOL_TYPE
{
695 VpNonPagedPoolCacheAligned
= 4,
696 VpPagedPoolCacheAligned
697 } VP_POOL_TYPE
, *PVP_POOL_TYPE
;
702 VideoPortAllocatePool(
703 /*IN*/ PVOID HwDeviceExtension
,
704 /*IN*/ VP_POOL_TYPE PoolType
,
705 /*IN*/ SIZE_T NumberOfBytes
,
711 VideoPortAssociateEventsWithDmaHandle(
712 /*IN*/ PVOID HwDeviceExtension
,
713 /*IN OUT*/ PVIDEO_REQUEST_PACKET pVrp
,
714 /*IN*/ PVOID MappedUserEvent
,
715 /*IN*/ PVOID DisplayDriverEvent
);
717 /* VideoPortCheckForDeviceExistence.Flags constants */
718 #define CDE_USE_SUBSYSTEM_IDS 0x00000001
719 #define CDE_USE_REVISION 0x00000002
724 VideoPortCheckForDeviceExistence(
725 /*IN*/ PVOID HwDeviceExtension
,
726 /*IN*/ USHORT VendorId
,
727 /*IN*/ USHORT DeviceId
,
728 /*IN*/ UCHAR RevisionId
,
729 /*IN*/ USHORT SubVendorId
,
730 /*IN*/ USHORT SubSystemId
,
737 /*IN*/ PVOID HwDeviceExtension
,
738 /*IN*/ PEVENT pEvent
);
743 VideoPortCompareMemory(
744 /*IN*/ PVOID Source1
,
745 /*IN*/ PVOID Source2
,
746 /*IN*/ ULONG Length
);
751 VideoPortCompleteDma(
752 /*IN*/ PVOID HwDeviceExtension
,
753 /*IN*/ PVP_DMA_ADAPTER VpDmaAdapter
,
754 /*IN*/ PVP_SCATTER_GATHER_LIST VpScatterGather
,
755 /*IN*/ BOOLEAN WriteToDevice
);
760 VideoPortCreateEvent(
761 /*IN*/ PVOID HwDeviceExtension
,
762 /*IN*/ ULONG EventFlag
,
764 /*OUT*/ PEVENT
*ppEvent
);
769 VideoPortCreateSecondaryDisplay(
770 /*IN*/ PVOID HwDeviceExtension
,
771 /*IN OUT*/ PVOID
*SecondaryDeviceExtension
,
772 /*IN*/ ULONG ulFlag
);
777 VideoPortCreateSpinLock(
778 /*IN*/ PVOID HwDeviceExtension
,
779 /*OUT*/ PSPIN_LOCK
*SpinLock
);
781 typedef struct _DDC_CONTROL
{
783 /*IN*/ I2C_CALLBACKS I2CCallbacks
;
784 /*IN*/ UCHAR EdidSegment
;
785 } DDC_CONTROL
, *PDDC_CONTROL
;
790 VideoPortDDCMonitorHelper(
791 /*IN*/ PVOID HwDeviceExtension
,
792 /*IN*/ PVOID DDCControl
,
793 /*IN OUT*/ PUCHAR EdidBuffer
,
794 /*IN*/ ULONG EdidBufferSize
);
800 /*IN*/ VIDEO_DEBUG_LEVEL DebugPrintLevel
,
801 /*IN*/ PCHAR DebugMessage
,
807 VideoPortDeleteEvent(
808 /*IN*/ PVOID HwDeviceExtension
,
809 /*IN*/ PEVENT pEvent
);
814 VideoPortDeleteSpinLock(
815 /*IN*/ PVOID HwDeviceExtension
,
816 /*IN*/ PSPIN_LOCK SpinLock
);
821 VideoPortDisableInterrupt(
822 /*IN*/ PVOID HwDeviceExtension
);
828 /*IN*/ PVOID HwDeviceExtension
,
830 /*IN*/ DMA_FLAGS DmaFlags
);
835 VideoPortEnableInterrupt(
836 /*IN*/ PVOID HwDeviceExtension
);
841 VideoPortEnumerateChildren(
842 /*IN*/ PVOID HwDeviceExtension
,
843 /*IN*/ PVOID Reserved
);
848 VideoPortFreeCommonBuffer(
849 /*IN*/ PVOID HwDeviceExtension
,
851 /*IN*/ PVOID VirtualAddress
,
852 /*IN*/ PHYSICAL_ADDRESS LogicalAddress
,
853 /*IN*/ BOOLEAN CacheEnabled
);
858 VideoPortFreeDeviceBase(
859 /*IN*/ PVOID HwDeviceExtension
,
860 /*IN*/ PVOID MappedAddress
);
866 /*IN*/ PVOID HwDeviceExtension
,
872 VideoPortGetAccessRanges(
873 /*IN*/ PVOID HwDeviceExtension
,
874 /*IN*/ ULONG NumRequestedResources
,
875 /*IN*/ PIO_RESOURCE_DESCRIPTOR RequestedResources
/*OPTIONAL*/,
876 /*IN*/ ULONG NumAccessRanges
,
877 /*OUT*/ PVIDEO_ACCESS_RANGE AccessRanges
,
878 /*IN*/ PVOID VendorId
,
879 /*IN*/ PVOID DeviceId
,
880 /*OUT*/ PULONG Slot
);
885 VideoPortGetAssociatedDeviceExtension(
886 /*IN*/ PVOID DeviceObject
);
891 VideoPortGetAssociatedDeviceID(
892 /*IN*/ PVOID DeviceObject
);
898 /*IN*/ PVOID HwDeviceExtension
,
899 /*IN*/ BUS_DATA_TYPE BusDataType
,
900 /*IN*/ ULONG SlotNumber
,
901 /*IN OUT*/ PVOID Buffer
,
903 /*IN*/ ULONG Length
);
908 VideoPortGetBytesUsed(
909 /*IN*/ PVOID HwDeviceExtension
,
915 VideoPortGetCommonBuffer(
916 /*IN*/ PVOID HwDeviceExtension
,
917 /*IN*/ ULONG DesiredLength
,
918 /*IN*/ ULONG Alignment
,
919 /*OUT*/ PPHYSICAL_ADDRESS LogicalAddress
,
920 /*OUT*/ PULONG pActualLength
,
921 /*IN*/ BOOLEAN CacheEnabled
);
926 VideoPortGetCurrentIrql(
932 VideoPortGetDeviceBase(
933 /*IN*/ PVOID HwDeviceExtension
,
934 /*IN*/ PHYSICAL_ADDRESS IoAddress
,
935 /*IN*/ ULONG NumberOfUchars
,
936 /*IN*/ UCHAR InIoSpace
);
941 VideoPortGetDeviceData(
942 /*IN*/ PVOID HwDeviceExtension
,
943 /*IN*/ VIDEO_DEVICE_DATA_TYPE DeviceDataType
,
944 /*IN*/ PMINIPORT_QUERY_DEVICE_ROUTINE CallbackRoutine
,
945 /*IN*/ PVOID Context
);
950 VideoPortGetDmaAdapter(
951 /*IN*/ PVOID HwDeviceExtension
,
952 /*IN*/ PVP_DEVICE_DESCRIPTION VpDeviceDescription
);
957 VideoPortGetDmaContext(
958 /*IN*/ PVOID HwDeviceExtension
,
965 /*IN*/ PVOID HwDeviceExtension
,
971 VideoPortGetRegistryParameters(
972 /*IN*/ PVOID HwDeviceExtension
,
973 /*IN*/ PWSTR ParameterName
,
974 /*IN*/ UCHAR IsParameterFileName
,
975 /*IN*/ PMINIPORT_GET_REGISTRY_ROUTINE CallbackRoutine
,
976 /*IN*/ PVOID Context
);
981 VideoPortGetRomImage(
982 /*IN*/ PVOID HwDeviceExtension
,
983 /*IN*/ PVOID Unused1
,
984 /*IN*/ ULONG Unused2
,
985 /*IN*/ ULONG Length
);
991 /*IN*/ PVOID HwDeviceExtension
,
992 /*IN OUT*/ PVPOSVERSIONINFO pVpOsVersionInfo
);
997 VideoPortGetVgaStatus(
998 /*IN*/ PVOID HwDeviceExtension
,
999 /*OUT*/ PULONG VgaStatus
);
1004 VideoPortInitialize(
1005 /*IN*/ PVOID Argument1
,
1006 /*IN*/ PVOID Argument2
,
1007 /*IN*/ PVIDEO_HW_INITIALIZATION_DATA HwInitializationData
,
1008 /*IN*/ PVOID HwContext
);
1014 /*IN*/ PVOID HwDeviceExtension
,
1015 /*IN*/ PVIDEO_X86_BIOS_ARGUMENTS BiosArguments
);
1020 VideoPortInterlockedDecrement(
1021 /*IN*/ PLONG Addend
);
1026 VideoPortInterlockedExchange(
1027 /*IN OUT*/ PLONG Target
,
1033 VideoPortInterlockedIncrement(
1034 /*IN*/ PLONG Addend
);
1036 typedef enum _VP_LOCK_OPERATION
{
1040 } VP_LOCK_OPERATION
;
1045 VideoPortLockBuffer(
1046 /*IN*/ PVOID HwDeviceExtension
,
1047 /*IN*/ PVOID BaseAddress
,
1048 /*IN*/ ULONG Length
,
1049 /*IN*/ VP_LOCK_OPERATION Operation
);
1055 /*IN*/ PVOID HwDeviceExtension
,
1056 /*IN OUT*/ PVIDEO_REQUEST_PACKET pVrp
,
1057 /*IN OUT*/ PEVENT pUEvent
,
1058 /*IN*/ PEVENT pDisplayEvent
,
1059 /*IN*/ DMA_FLAGS DmaFlags
);
1065 /*IN*/ PVOID HwDeviceExtension
,
1066 /*IN*/ PVIDEO_REQUEST_PACKET Vrp
/*OPTIONAL*/,
1067 /*IN*/ VP_STATUS ErrorCode
,
1068 /*IN*/ ULONG UniqueId
);
1073 VideoPortMapBankedMemory(
1074 /*IN*/ PVOID HwDeviceExtension
,
1075 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress
,
1076 /*IN OUT*/ PULONG Length
,
1078 PVOID
*VirtualAddress
,
1080 UCHAR ReadWriteBank
,
1081 PBANKED_SECTION_ROUTINE BankRoutine
,
1087 VideoPortMapDmaMemory(
1088 /*IN*/ PVOID HwDeviceExtension
,
1089 /*IN*/ PVIDEO_REQUEST_PACKET pVrp
,
1090 /*IN*/ PHYSICAL_ADDRESS BoardAddress
,
1091 /*IN*/ PULONG Length
,
1092 /*IN*/ PULONG InIoSpace
,
1093 /*IN*/ PVOID MappedUserEvent
,
1094 /*IN*/ PVOID DisplayDriverEvent
,
1095 /*IN OUT*/ PVOID
*VirtualAddress
);
1101 /*IN*/ PVOID HwDeviceExtension
,
1102 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress
,
1103 /*IN OUT*/ PULONG Length
,
1104 /*IN*/ PULONG InIoSpace
,
1105 /*IN OUT*/ PVOID
*VirtualAddress
);
1110 VideoPortMoveMemory(
1111 /*IN*/ PVOID Destination
,
1112 /*IN*/ PVOID Source
,
1113 /*IN*/ ULONG Length
);
1118 VideoPortPutDmaAdapter(
1119 /*IN*/ PVOID HwDeviceExtension
,
1120 /*IN*/ PVP_DMA_ADAPTER VpDmaAdapter
);
1125 VideoPortQueryPerformanceCounter(
1126 /*IN*/ PVOID HwDeviceExtension
,
1127 /*OUT*/ PLONGLONG PerformanceFrequency
/*OPTIONAL*/);
1129 /* VideoPortQueryServices.ServicesType constants */
1130 typedef enum _VIDEO_PORT_SERVICES
{
1131 VideoPortServicesAGP
= 1,
1132 VideoPortServicesI2C
,
1133 VideoPortServicesHeadless
,
1134 VideoPortServicesInt10
1135 } VIDEO_PORT_SERVICES
;
1140 VideoPortQueryServices(
1141 /*IN*/ PVOID HwDeviceExtension
,
1142 /*IN*/ VIDEO_PORT_SERVICES ServicesType
,
1143 /*IN OUT*/ PINTERFACE Interface
);
1148 VideoPortQuerySystemTime(
1149 /*OUT*/ PLARGE_INTEGER CurrentTime
);
1155 /*IN*/ PVOID HwDeviceExtension
,
1156 /*IN*/ PMINIPORT_DPC_ROUTINE CallbackRoutine
,
1157 /*IN*/ PVOID Context
);
1162 VideoPortReadPortBufferUchar(
1164 /*OUT*/ PUCHAR Buffer
,
1165 /*IN*/ ULONG Count
);
1170 VideoPortReadPortBufferUlong(
1172 /*OUT*/ PULONG Buffer
,
1173 /*IN*/ ULONG Count
);
1178 VideoPortReadPortBufferUshort(
1179 /*IN*/ PUSHORT Port
,
1180 /*OUT*/ PUSHORT Buffer
,
1181 /*IN*/ ULONG Count
);
1186 VideoPortReadPortUchar(
1187 /*IN*/ PUCHAR Port
);
1192 VideoPortReadPortUlong(
1193 /*IN*/ PULONG Port
);
1198 VideoPortReadPortUshort(
1199 /*IN*/ PUSHORT Port
);
1204 VideoPortReadRegisterBufferUchar(
1205 /*IN*/ PUCHAR Register
,
1206 /*OUT*/ PUCHAR Buffer
,
1207 /*IN*/ ULONG Count
);
1212 VideoPortReadRegisterBufferUlong(
1213 /*IN*/ PULONG Register
,
1214 /*OUT*/ PULONG Buffer
,
1215 /*IN*/ ULONG Count
);
1220 VideoPortReadRegisterBufferUshort(
1221 /*IN*/ PUSHORT Register
,
1222 /*OUT*/ PUSHORT Buffer
,
1223 /*IN*/ ULONG Count
);
1228 VideoPortReadRegisterUchar(
1229 /*IN*/ PUCHAR Register
);
1234 VideoPortReadRegisterUlong(
1235 /*IN*/ PULONG Register
);
1240 VideoPortReadRegisterUshort(
1241 /*IN*/ PUSHORT Register
);
1246 VideoPortReadStateEvent(
1247 /*IN*/ PVOID HwDeviceExtension
,
1248 /*IN*/ PEVENT pEvent
);
1253 VideoPortReleaseBuffer(
1254 /*IN*/ PVOID HwDeviceExtension
,
1255 /*IN*/ PVOID Buffer
);
1260 VideoPortReleaseCommonBuffer(
1261 /*IN*/ PVOID HwDeviceExtension
,
1262 /*IN*/ PVP_DMA_ADAPTER VpDmaAdapter
,
1263 /*IN*/ ULONG Length
,
1264 /*IN*/ PHYSICAL_ADDRESS LogicalAddress
,
1265 /*IN*/ PVOID VirtualAddress
,
1266 /*IN*/ BOOLEAN CacheEnabled
);
1271 VideoPortReleaseDeviceLock(
1272 /*IN*/ PVOID HwDeviceExtension
);
1277 VideoPortReleaseSpinLock(
1278 /*IN*/ PVOID HwDeviceExtension
,
1279 /*IN*/ PSPIN_LOCK SpinLock
,
1280 /*IN*/ UCHAR NewIrql
);
1285 VideoPortReleaseSpinLockFromDpcLevel(
1286 /*IN*/ PVOID HwDeviceExtension
,
1287 /*IN*/ PSPIN_LOCK SpinLock
);
1293 PVOID HwDeviceExtension
,
1301 VideoPortSetBusData(
1302 /*IN*/ PVOID HwDeviceExtension
,
1303 /*IN*/ BUS_DATA_TYPE BusDataType
,
1304 /*IN*/ ULONG SlotNumber
,
1305 /*IN*/ PVOID Buffer
,
1306 /*IN*/ ULONG Offset
,
1307 /*IN*/ ULONG Length
);
1312 VideoPortSetBytesUsed(
1313 /*IN*/ PVOID HwDeviceExtension
,
1314 /*IN OUT*/ PDMA pDma
,
1315 /*IN*/ ULONG BytesUsed
);
1320 VideoPortSetDmaContext(
1321 /*IN*/ PVOID HwDeviceExtension
,
1323 /*IN*/ PVOID InstanceContext
);
1329 /*IN*/ PVOID HwDeviceExtension
,
1330 /*IN*/ PEVENT pEvent
);
1335 VideoPortSetRegistryParameters(
1336 /*IN*/ PVOID HwDeviceExtension
,
1337 /*IN*/ PWSTR ValueName
,
1338 /*IN*/ PVOID ValueData
,
1339 /*IN*/ ULONG ValueLength
);
1344 VideoPortSetTrappedEmulatorPorts(
1345 /*IN*/ PVOID HwDeviceExtension
,
1346 /*IN*/ ULONG NumAccessRanges
,
1347 /*IN*/ PVIDEO_ACCESS_RANGE AccessRange
);
1352 VideoPortSignalDmaComplete(
1353 /*IN*/ PVOID HwDeviceExtension
,
1354 /*IN*/ PVOID pDmaHandle
);
1359 VideoPortStallExecution(
1360 /*IN*/ ULONG Microseconds
);
1366 /*IN*/ PVOID HwDeviceExtension
,
1367 /*IN*/ PVP_DMA_ADAPTER VpDmaAdapter
,
1369 /*IN*/ ULONG Offset
,
1370 /*IN OUT*/ PULONG pLength
,
1371 /*IN*/ PEXECUTE_DMA ExecuteDmaRoutine
,
1372 /*IN*/ PVOID Context
,
1373 /*IN*/ BOOLEAN WriteToDevice
);
1378 VideoPortStartTimer(
1379 /*IN*/ PVOID HwDeviceExtension
);
1385 /*IN*/ PVOID HwDeviceExtension
);
1387 /* VideoPortSynchronizeExecution.Priority constants */
1388 typedef enum VIDEO_SYNCHRONIZE_PRIORITY
{
1392 } VIDEO_SYNCHRONIZE_PRIORITY
, *PVIDEO_SYNCHRONIZE_PRIORITY
;
1397 VideoPortSynchronizeExecution(
1398 /*IN*/ PVOID HwDeviceExtension
,
1399 /*IN*/ VIDEO_SYNCHRONIZE_PRIORITY Priority
,
1400 /*IN*/ PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine
,
1401 /*IN*/ PVOID Context
);
1406 VideoPortUnLockBuffer(
1407 /*IN*/ PVOID HwDeviceExtension
,
1413 VideoPortUnlockPages(
1414 /*IN*/ PVOID hwDeviceExtension
,
1415 /*IN OUT*/ PDMA pDma
);
1420 VideoPortUnmapDmaMemory(
1421 /*IN*/ PVOID HwDeviceExtension
,
1422 /*IN*/ PVOID VirtualAddress
,
1423 /*IN*/ HANDLE ProcessHandle
,
1424 /*IN*/ PDMA BoardMemoryHandle
);
1429 VideoPortUnmapMemory(
1430 /*IN*/ PVOID HwDeviceExtension
,
1431 /*IN OUT*/ PVOID VirtualAddress
,
1432 /*IN*/ HANDLE ProcessHandle
);
1437 VideoPortVerifyAccessRanges(
1438 /*IN*/ PVOID HwDeviceExtension
,
1439 /*IN*/ ULONG NumAccessRanges
,
1440 /*IN*/ PVIDEO_ACCESS_RANGE AccessRanges
);
1445 VideoPortWaitForSingleObject(
1446 /*IN*/ PVOID HwDeviceExtension
,
1447 /*IN*/ PVOID Object
,
1448 /*IN*/ PLARGE_INTEGER Timeout
/*OPTIONAL*/);
1453 VideoPortWritePortBufferUchar(
1455 /*IN*/ PUCHAR Buffer
,
1456 /*IN*/ ULONG Count
);
1461 VideoPortWritePortBufferUlong(
1463 /*IN*/ PULONG Buffer
,
1464 /*IN*/ ULONG Count
);
1469 VideoPortWritePortBufferUshort(
1470 /*IN*/ PUSHORT Port
,
1471 /*IN*/ PUSHORT Buffer
,
1472 /*IN*/ ULONG Count
);
1477 VideoPortWritePortUchar(
1479 /*IN*/ UCHAR Value
);
1484 VideoPortWritePortUlong(
1486 /*IN*/ ULONG Value
);
1491 VideoPortWritePortUshort(
1492 /*IN*/ PUSHORT Port
,
1493 /*IN*/ USHORT Value
);
1498 VideoPortWriteRegisterBufferUchar(
1499 /*IN*/ PUCHAR Register
,
1500 /*IN*/ PUCHAR Buffer
,
1501 /*IN*/ ULONG Count
);
1506 VideoPortWriteRegisterBufferUlong(
1507 /*IN*/ PULONG Register
,
1508 /*IN*/ PULONG Buffer
,
1509 /*IN*/ ULONG Count
);
1514 VideoPortWriteRegisterBufferUshort(
1515 /*IN*/ PUSHORT Register
,
1516 /*IN*/ PUSHORT Buffer
,
1517 /*IN*/ ULONG Count
);
1522 VideoPortWriteRegisterUchar(
1523 /*IN*/ PUCHAR Register
,
1524 /*IN*/ UCHAR Value
);
1529 VideoPortWriteRegisterUlong(
1530 /*IN*/ PULONG Register
,
1531 /*IN*/ ULONG Value
);
1536 VideoPortWriteRegisterUshort(
1537 /*IN*/ PUSHORT Register
,
1538 /*IN*/ USHORT Value
);
1543 VideoPortZeroDeviceMemory(
1544 /*IN*/ PVOID Destination
,
1545 /*IN*/ ULONG Length
);
1550 VideoPortZeroMemory(
1551 /*IN*/ PVOID Destination
,
1552 /*2IN*/ ULONG Length
);
1555 #define VideoDebugPrint(x) VideoPortDebugPrint x
1557 #define VideoDebugPrint(x)
1564 #endif /* defined __WINDDI_H */
1566 #endif /* __VIDEO_H */