Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2585 lines
61 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. video.h
  5. Abstract:
  6. Contains all structure and routine definitions common to the video port
  7. driver and the video miniport drivers.
  8. Notes:
  9. Revision History:
  10. --*/
  11. #ifndef __VIDEO_H__
  12. #define __VIDEO_H__
  13. #include <videoagp.h>
  14. //
  15. // Define port driver status code.
  16. // The values for these are the Win32 error codes
  17. //
  18. typedef LONG VP_STATUS;
  19. typedef VP_STATUS *PVP_STATUS;
  20. //
  21. // Defines for registry information and synchronization.
  22. //
  23. typedef enum VIDEO_SYNCHRONIZE_PRIORITY {
  24. VpLowPriority,
  25. VpMediumPriority,
  26. VpHighPriority
  27. } VIDEO_SYNCHRONIZE_PRIORITY, *PVIDEO_SYNCHRONIZE_PRIORITY;
  28. //
  29. // Opaque pointer type for miniport to be used to type PEVENTs received from
  30. // display driver.
  31. //
  32. typedef struct _VIDEO_PORT_EVENT *PEVENT;
  33. typedef struct _VIDEO_PORT_SPIN_LOCK *PSPIN_LOCK;
  34. //
  35. // Type of information requested with GetDeviceData
  36. //
  37. typedef enum _VIDEO_DEVICE_DATA_TYPE {
  38. VpMachineData,
  39. VpCmosData,
  40. VpBusData,
  41. VpControllerData,
  42. VpMonitorData
  43. } VIDEO_DEVICE_DATA_TYPE, *PVIDEO_DEVICE_DATA_TYPE;
  44. typedef enum _VP_POOL_TYPE {
  45. VpNonPagedPool,
  46. VpPagedPool,
  47. VpNonPagedPoolCacheAligned = 4,
  48. VpPagedPoolCacheAligned
  49. } VP_POOL_TYPE, *PVP_POOL_TYPE;
  50. //
  51. // Data returned with VpControllerData
  52. //
  53. typedef struct _VIDEO_HARDWARE_CONFIGURATION_DATA {
  54. INTERFACE_TYPE InterfaceType;
  55. ULONG BusNumber;
  56. USHORT Version;
  57. USHORT Revision;
  58. USHORT Irql;
  59. USHORT Vector;
  60. ULONG ControlBase;
  61. ULONG ControlSize;
  62. ULONG CursorBase;
  63. ULONG CursorSize;
  64. ULONG FrameBase;
  65. ULONG FrameSize;
  66. } VIDEO_HARDWARE_CONFIGURATION_DATA, *PVIDEO_HARDWARE_CONFIGURATION_DATA;
  67. //
  68. // Define structure used to call the BIOS int 10 function
  69. //
  70. typedef struct _VIDEO_X86_BIOS_ARGUMENTS {
  71. ULONG Eax;
  72. ULONG Ebx;
  73. ULONG Ecx;
  74. ULONG Edx;
  75. ULONG Esi;
  76. ULONG Edi;
  77. ULONG Ebp;
  78. } VIDEO_X86_BIOS_ARGUMENTS, *PVIDEO_X86_BIOS_ARGUMENTS;
  79. typedef struct _INT10_BIOS_ARGUMENTS {
  80. ULONG Eax;
  81. ULONG Ebx;
  82. ULONG Ecx;
  83. ULONG Edx;
  84. ULONG Esi;
  85. ULONG Edi;
  86. ULONG Ebp;
  87. USHORT SegDs;
  88. USHORT SegEs;
  89. } INT10_BIOS_ARGUMENTS, *PINT10_BIOS_ARGUMENTS;
  90. #define SIZE_OF_NT4_VIDEO_PORT_CONFIG_INFO 0x42
  91. #define SIZE_OF_NT4_VIDEO_HW_INITIALIZATION_DATA 0x28
  92. #define SIZE_OF_W2K_VIDEO_HW_INITIALIZATION_DATA 0x50
  93. //
  94. // Debugging statements. This will remove all the debug information from the
  95. // "free" version.
  96. //
  97. #if DBG
  98. #define VideoDebugPrint(arg) VideoPortDebugPrint arg
  99. #else
  100. #define VideoDebugPrint(arg)
  101. #endif
  102. typedef enum VIDEO_DEBUG_LEVEL {
  103. Error = 0,
  104. Warn,
  105. Trace,
  106. Info
  107. } VIDEO_DEBUG_LEVEL, *PVIDEO_DEBUG_LEVEL;
  108. //
  109. // Allows us to remove lots of unused code.
  110. //
  111. #ifndef _NTOSDEF_
  112. //don't pickup ntosp version
  113. #ifdef PAGED_CODE
  114. #undef PAGED_CODE
  115. #endif
  116. #define ALLOC_PRAGMA 1
  117. #define VIDEOPORT_API __declspec(dllimport)
  118. #if DBG
  119. #define PAGED_CODE() \
  120. if (VideoPortGetCurrentIrql() > 1 /*APC_LEVEL*/) { \
  121. VideoPortDebugPrint(0, "Video: Pageable code called at IRQL %d\n", VideoPortGetCurrentIrql() ); \
  122. ASSERT(FALSE); \
  123. }
  124. #else
  125. #define PAGED_CODE()
  126. #endif
  127. ULONG
  128. DriverEntry(
  129. PVOID Context1,
  130. PVOID Context2
  131. );
  132. #else
  133. #define VIDEOPORT_API
  134. #endif
  135. #ifndef _NTOS_
  136. //
  137. // These are the various function prototypes of the routines that are
  138. // provided by the kernel driver to hook out access to io ports.
  139. //
  140. typedef
  141. VP_STATUS
  142. (*PDRIVER_IO_PORT_UCHAR ) (
  143. ULONG_PTR Context,
  144. ULONG Port,
  145. UCHAR AccessMode,
  146. PUCHAR Data
  147. );
  148. typedef
  149. VP_STATUS
  150. (*PDRIVER_IO_PORT_UCHAR_STRING ) (
  151. ULONG_PTR Context,
  152. ULONG Port,
  153. UCHAR AccessMode,
  154. PUCHAR Data,
  155. ULONG DataLength
  156. );
  157. typedef
  158. VP_STATUS
  159. (*PDRIVER_IO_PORT_USHORT ) (
  160. ULONG_PTR Context,
  161. ULONG Port,
  162. UCHAR AccessMode,
  163. PUSHORT Data
  164. );
  165. typedef
  166. VP_STATUS
  167. (*PDRIVER_IO_PORT_USHORT_STRING ) (
  168. ULONG_PTR Context,
  169. ULONG Port,
  170. UCHAR AccessMode,
  171. PUSHORT Data,
  172. ULONG DataLength // number of words
  173. );
  174. typedef
  175. VP_STATUS
  176. (*PDRIVER_IO_PORT_ULONG ) (
  177. ULONG_PTR Context,
  178. ULONG Port,
  179. UCHAR AccessMode,
  180. PULONG Data
  181. );
  182. typedef
  183. VP_STATUS
  184. (*PDRIVER_IO_PORT_ULONG_STRING ) (
  185. ULONG_PTR Context,
  186. ULONG Port,
  187. UCHAR AccessMode,
  188. PULONG Data,
  189. ULONG DataLength // number of dwords
  190. );
  191. #endif // _NTOS_
  192. //
  193. // Definition of the request packet sent from the port driver to the
  194. // miniport driver. It reflects the parameters passed from the
  195. // DeviceIOControl call made by the windows display driver.
  196. //
  197. // N.B. The definition of the STATUS_BLOCK must be the same as the
  198. // the definition of IO_STATUS_BLOCK defined in ntioapi.h.
  199. //
  200. typedef struct _STATUS_BLOCK {
  201. //
  202. // Contains the status code of the operation.
  203. // This value in one of the Win32 error codes that are defined for use
  204. // in the video miniport drivers.
  205. //
  206. union {
  207. VP_STATUS Status;
  208. PVOID Pointer;
  209. };
  210. //
  211. // Information returned to the callee.
  212. // The meaning of the information varies from function to function. It
  213. // is generally used to return the minimum size for the input buffer if
  214. // the function takes an input buffer, or the amount of data transfered
  215. // back to the caller if the operation returns output.
  216. //
  217. ULONG_PTR Information;
  218. } STATUS_BLOCK, *PSTATUS_BLOCK;
  219. typedef struct _VIDEO_REQUEST_PACKET {
  220. //
  221. // The IO control code passed to the DeviceIoControl function by the
  222. // caller.
  223. //
  224. ULONG IoControlCode;
  225. //
  226. // Pointer to a status block provided by the caller. This should be
  227. // filled out by the callee with the appropriate information.
  228. //
  229. PSTATUS_BLOCK StatusBlock;
  230. //
  231. // Pointer to an input buffer which contains the information passed in
  232. // by the caller.
  233. //
  234. PVOID InputBuffer;
  235. //
  236. // Size of the input buffer
  237. //
  238. ULONG InputBufferLength;
  239. //
  240. // Pointer to an output buffer into which the data returned to the caller
  241. // should be stored.
  242. //
  243. PVOID OutputBuffer;
  244. //
  245. // Length of the output buffer. This buffer can not be grown by the
  246. // callee.
  247. //
  248. ULONG OutputBufferLength;
  249. } VIDEO_REQUEST_PACKET, *PVIDEO_REQUEST_PACKET;
  250. //
  251. // typedef for scattergather array available via GET_VIDEO_SCATTERGATHER().
  252. //
  253. typedef struct __VRB_SG {
  254. __int64 PhysicalAddress;
  255. ULONG Length;
  256. } VRB_SG, *PVRB_SG;
  257. //
  258. // Opaque type for dma handle
  259. //
  260. typedef struct __DMA_PARAMETERS * PDMA;
  261. //
  262. // The following macro returns in Address the 32 bit physical address of
  263. // the VirtualAddress lying within the InputBuffer passed into EngDevIo
  264. //
  265. #define GET_VIDEO_PHYSICAL_ADDRESS(scatterList, VirtualAddress, InputBuffer, pLength, Address) \
  266. \
  267. do { \
  268. ULONG_PTR byteOffset; \
  269. \
  270. byteOffset = (PCHAR) VirtualAddress - (PCHAR)InputBuffer; \
  271. \
  272. while (byteOffset >= scatterList->Length) { \
  273. \
  274. byteOffset -= scatterList->Length; \
  275. scatterList++; \
  276. } \
  277. \
  278. *pLength = scatterList->Length - byteOffset; \
  279. \
  280. Address = (ULONG_PTR) (scatterList->PhysicalAddress + byteOffset); \
  281. \
  282. } while (0)
  283. #define GET_VIDEO_SCATTERGATHER(ppDma) (**(PVRB_SG **)ppDma)
  284. //
  285. // Opaque type for PVP_DMA_ADAPTER
  286. //
  287. typedef struct __VP_DMA_ADAPTER *PVP_DMA_ADAPTER;
  288. typedef enum _VP_LOCK_OPERATION {
  289. VpReadAccess,
  290. VpWriteAccess,
  291. VpModifyAccess
  292. } VP_LOCK_OPERATION;
  293. typedef struct _VP_DEVICE_DESCRIPTION {
  294. BOOLEAN ScatterGather;
  295. BOOLEAN Dma32BitAddresses;
  296. BOOLEAN Dma64BitAddresses;
  297. ULONG MaximumLength;
  298. } VP_DEVICE_DESCRIPTION, *PVP_DEVICE_DESCRIPTION;
  299. typedef struct _VP_SCATTER_GATHER_ELEMENT {
  300. PHYSICAL_ADDRESS Address;
  301. ULONG Length;
  302. ULONG_PTR Reserved;
  303. } VP_SCATTER_GATHER_ELEMENT, *PVP_SCATTER_GATHER_ELEMENT;
  304. #pragma warning(disable:4200)
  305. typedef struct _VP_SCATTER_GATHER_LIST {
  306. ULONG NumberOfElements;
  307. ULONG_PTR Reserved;
  308. VP_SCATTER_GATHER_ELEMENT Elements[];
  309. } VP_SCATTER_GATHER_LIST, *PVP_SCATTER_GATHER_LIST;
  310. #pragma warning(default:4200)
  311. #define VIDEO_RANGE_PASSIVE_DECODE 0x1
  312. #define VIDEO_RANGE_10_BIT_DECODE 0x2
  313. //
  314. // The following structure is used to define access ranges. The ranges are
  315. // used to indicate which ports and memory adresses are being used by the
  316. // card.
  317. //
  318. typedef struct _VIDEO_ACCESS_RANGE {
  319. //
  320. // Indicates the starting memory address or port number of the range.
  321. // This values should be stored before being transformed by
  322. // VideoPortGetDeviceBase() which returns the logical address that must
  323. // be used by the miniport driver when referencing physical addresses.
  324. //
  325. PHYSICAL_ADDRESS RangeStart;
  326. //
  327. // Indicates the length in bytes, or number of ports in the range. This
  328. // value should indicate the range actually decoded by the adapter. For
  329. // example, if the adapter uses 7 registers but responds to eight, the
  330. // RangeLength should be set to 8.
  331. ULONG RangeLength;
  332. //
  333. // Indicates if the range is in IO space (TRUE) or in memory space (FALSE).
  334. //
  335. UCHAR RangeInIoSpace;
  336. //
  337. // Indicates if the range should be visible by the Windows display driver.
  338. // This is done so that a Windows display driver can access certain
  339. // video ports directly. This will only be allowed if the caller has the
  340. // required privileges (is a trusted subsystem) to access the range.
  341. //
  342. // Synchronization of access to ports or memory in the range must be
  343. // done explicitly by the miniport driver and the user mode process so
  344. // that they both don't try to program the device simultaneously.
  345. //
  346. // Non visible ranges should include video memory, ROM addresses, etc.
  347. // which are not required to program the device for output purposes.
  348. //
  349. //
  350. UCHAR RangeVisible;
  351. //
  352. // This field determines if the range can be shared with another device.
  353. // The rule should be applied as follow.
  354. //
  355. // - If the range of memory or IO ports should be "owned" by this driver,
  356. // and that any other driver trying to access this range may cause
  357. // a problem, FALSE should be returned.
  358. //
  359. // - If the range can be shared with another co-operating device driver,
  360. // then the share field should be set to TRUE.
  361. //
  362. // As a guideline, the VGA miniport driver will claim all of its resources
  363. // as shareable so that it can be used as a VGA compatible device with
  364. // any other driver (such as an S3 or XGA.
  365. //
  366. // Super VGA miniport drivers that implement all the VGA functionality
  367. // (declared in the Registry as VGACOMPATIBLE=1) should claim the range
  368. // as non-shareable since they don't want the VGA to run at the same time.
  369. //
  370. // Miniports for cards such as an S3 or XGA that have an XGA on the board
  371. // but do not implement the VGA functionality will run with the VGA
  372. // miniport loaded and should therefore claim all the resources shared
  373. // with the VGA as shareable.
  374. //
  375. // Miniports for cards that work with a pass-through and that can be
  376. // connected to any VGA/SVGA card should not be using any VGA ports or
  377. // memory ranges ! ... but if they do they should not claim those
  378. // resources since they will cause a conflict in the system because the
  379. // SVGA cards will have claimed them as non-shareable ...
  380. //
  381. UCHAR RangeShareable;
  382. //
  383. // Indicates that the range is decoded by the hardware, but that the
  384. // driver will never access this port.
  385. //
  386. UCHAR RangePassive;
  387. } VIDEO_ACCESS_RANGE, *PVIDEO_ACCESS_RANGE;
  388. typedef
  389. PVOID
  390. (*PVIDEO_PORT_GET_PROC_ADDRESS)(
  391. IN PVOID HwDeviceExtension,
  392. IN PUCHAR FunctionName
  393. );
  394. //
  395. // This structure contains the specific configuration information about the
  396. // device. The information is initialized by the port driver and it should
  397. // be completed by the miniport driver.
  398. // The information is used to setup the device, as weel as providing
  399. // information to the port driver so it can perform some of the requests on
  400. // behalf of the miniport driver.
  401. //
  402. typedef struct _VIDEO_PORT_CONFIG_INFO {
  403. //
  404. // Specifies the length of the PVIDEO_PORT_CONFIG_INFO structure as
  405. // returned by sizeof(). Since this structure may grow in later
  406. // releases, the miniport driver should check that the length of the
  407. // structure is greater than or equal to the length it expects (since
  408. // it is guaranteed that defined fields will not change).
  409. //
  410. // This field is always initialized by the port driver.
  411. //
  412. ULONG Length;
  413. //
  414. // Specifies which IO bus is tp be scanned. This field is used as a
  415. // parameter to some VideoPortXXX calls.
  416. //
  417. // This field is always initialized by the port driver.
  418. //
  419. ULONG SystemIoBusNumber;
  420. //
  421. // Specifies the type of bus being scanned. This field is equal to the
  422. // value being passed into VideoPortInitialize in the
  423. // VIDEO_HW_INITIALIZATION_DATA structure.
  424. //
  425. // This field is always initialized by the port driver.
  426. //
  427. INTERFACE_TYPE AdapterInterfaceType;
  428. //
  429. // Specifies the bus interrupt request level. This level corresponds to
  430. // the IRQL on ISA and MCA buses.
  431. // This value is only used if the device supports interrupts, which is
  432. // determined by the presence of an interrupt service routine in the
  433. // VIDEO_HW_INITIALIZATION_DATA structure.
  434. //
  435. // The preset default value for this field is zero. Otherwise, it is the
  436. // value found in the device configuration information.
  437. //
  438. ULONG BusInterruptLevel;
  439. //
  440. // Specifies the bus vector returned by the adapter. This is used for
  441. // systems which have IO buses that use interrupt vectors. For ISA, MCA
  442. // and EISA buses, this field is unused.
  443. //
  444. // The preset default value for this field is zero.
  445. //
  446. ULONG BusInterruptVector;
  447. //
  448. // Specifies whether this adapter uses latched or edge-triggered type
  449. // interrupts.
  450. //
  451. // This field is always initialized by the port driver.
  452. //
  453. KINTERRUPT_MODE InterruptMode;
  454. //
  455. // Specifies the number of emulator access entries that the adapter
  456. // uses. It indicates the number of array elements in the following field.
  457. //
  458. // This field can be reinitialized with the number of entries in the
  459. // EmulatorAccessEntries structure if the structure is statically
  460. // defined in the miniport driver. The EmulatorAccessEntries fields
  461. // should also be updated.
  462. //
  463. ULONG NumEmulatorAccessEntries;
  464. //
  465. // Supplies a pointer to an array of EMULATOR_ACCESS_ENTRY structures.
  466. // The number of elements in the array is indicated by the
  467. // NumEmulatorAccessEntries field. The driver should fill out each entry
  468. // for the adapter.
  469. //
  470. // The uninitialized value for the structure is NULL.
  471. // EmulatorAccessEntries will be NULL if NumEmulatorAccessEntries is
  472. // zero.
  473. //
  474. // A poiner to an array of emulator access entries can be passed back
  475. // if such a structure is defined statically in the miniport driver. The
  476. // NumEmulatorAccessEntries field should also be updated.
  477. //
  478. PEMULATOR_ACCESS_ENTRY EmulatorAccessEntries;
  479. //
  480. // This is a context values that is passed with each call to the
  481. // emulator/validator functions defined in the EmulatorAccessEntries
  482. // defined above.
  483. // This parameter should in general be a pointer to the miniports
  484. // device extension or other such storage location.
  485. //
  486. // This pointer will allow the miniport to save some state temporarily
  487. // to allow for the batching of IO requests.
  488. //
  489. ULONG_PTR EmulatorAccessEntriesContext;
  490. //
  491. // Physical address of the video memory that must be mapped into a VDM's
  492. // address space for proper BIOS support
  493. //
  494. PHYSICAL_ADDRESS VdmPhysicalVideoMemoryAddress;
  495. //
  496. // Length of the video memory that must be mapped into a VDM's addres
  497. // space for proper BIOS support.
  498. //
  499. ULONG VdmPhysicalVideoMemoryLength;
  500. //
  501. // Determines the minimum size required to store the hardware state
  502. // information returned by IOCTL_VIDEO_SAVE_HARDWARE_STATE.
  503. //
  504. // The uninitialized value for this field is zero.
  505. //
  506. // If the field is left to zero, SAVE_HARDWARE_STATE will return an
  507. // ERROR_INVALID_FUNCTION status code.
  508. //
  509. ULONG HardwareStateSize;
  510. //
  511. // New for version 3.5
  512. //
  513. //
  514. // Optional DMA channel, if required by the device.
  515. // 0 for the Channel and Port indicates DMA is not used by the device.
  516. //
  517. ULONG DmaChannel;
  518. //
  519. // Optional DMA channel, if required by the device.
  520. // 0 for the Channel and Port indicates DMA is not used by the device.
  521. //
  522. ULONG DmaPort;
  523. //
  524. // Set to 1 if the DMA channel can be shared with another device.
  525. // Set to 0 if the DMA channel must be owned exclusively by the driver.
  526. //
  527. UCHAR DmaShareable;
  528. //
  529. // Set to 1 if the interrupt can be shared with another device.
  530. // Set to 0 if the interrupt must be owned exclusively by the driver.
  531. //
  532. UCHAR InterruptShareable;
  533. //
  534. // Start new dma stuff
  535. //
  536. //
  537. // Set to TRUE if the DMA device is a busmaster, FALSE otherwise.
  538. //
  539. BOOLEAN Master;
  540. //
  541. // Set to number of bits wide. Consistent with DEVICE_DESCRIPTION.
  542. // See ntioapi.h
  543. //
  544. DMA_WIDTH DmaWidth;
  545. //
  546. // Set to speed so miniport can set DEVICE_DESCRIPTION field.
  547. // See ntioapi.h
  548. //
  549. DMA_SPEED DmaSpeed;
  550. //
  551. // Set to TRUE if the DMA device requires mapped buffers. Also
  552. // a DEVICE_DESCRIPTION field.
  553. //
  554. BOOLEAN bMapBuffers;
  555. //
  556. // Set to TRUE if the DMA device requires physical addresses.
  557. //
  558. BOOLEAN NeedPhysicalAddresses;
  559. //
  560. // Set to TRUE if the DMA device supports demand mode, FALSE otherwise.
  561. // Also DEVICE_DESCRIPTION support.
  562. //
  563. BOOLEAN DemandMode;
  564. //
  565. // Set to max transfer length the DMA device supports.
  566. //
  567. ULONG MaximumTransferLength;
  568. //
  569. // Set to max number of Physical breaks the DMA device supports.
  570. //
  571. ULONG NumberOfPhysicalBreaks;
  572. //
  573. // Set to TRUE if the DMA device supports scatter gather, FALSE otherwise.
  574. //
  575. BOOLEAN ScatterGather;
  576. //
  577. // Maximal Length in PVRB_SG returned measured in bytes. If the device
  578. // has no maximum size, zero should be entered.
  579. //
  580. ULONG MaximumScatterGatherChunkSize;
  581. //
  582. // Allow for 4.0/5.0 compatibilty
  583. //
  584. PVIDEO_PORT_GET_PROC_ADDRESS VideoPortGetProcAddress;
  585. //
  586. // Provide a pointer to the device's registry path
  587. //
  588. PWSTR DriverRegistryPath;
  589. //
  590. // Indicates to a driver the amount of physical memory in the system
  591. //
  592. ULONGLONG SystemMemorySize;
  593. } VIDEO_PORT_CONFIG_INFO, *PVIDEO_PORT_CONFIG_INFO;
  594. //
  595. // Video Adapter Dependent Routines.
  596. //
  597. typedef
  598. VP_STATUS
  599. (*PVIDEO_HW_FIND_ADAPTER) (
  600. PVOID HwDeviceExtension,
  601. PVOID HwContext,
  602. PWSTR ArgumentString,
  603. PVIDEO_PORT_CONFIG_INFO ConfigInfo,
  604. PUCHAR Again
  605. );
  606. typedef
  607. BOOLEAN
  608. (*PVIDEO_HW_INITIALIZE) (
  609. PVOID HwDeviceExtension
  610. );
  611. typedef
  612. BOOLEAN
  613. (*PVIDEO_HW_INTERRUPT) (
  614. PVOID HwDeviceExtension
  615. );
  616. typedef
  617. VOID
  618. (*PVIDEO_HW_LEGACYRESOURCES) (
  619. IN ULONG VendorId,
  620. IN ULONG DeviceId,
  621. IN OUT PVIDEO_ACCESS_RANGE *LegacyResourceList,
  622. IN OUT PULONG LegacyResourceCount
  623. );
  624. //
  625. // type to be returned by HwStartDma().
  626. //
  627. typedef enum _HW_DMA_RETURN {
  628. DmaAsyncReturn,
  629. DmaSyncReturn
  630. } HW_DMA_RETURN, *PHW_DMA_RETURN;
  631. typedef
  632. HW_DMA_RETURN
  633. (*PVIDEO_HW_START_DMA) (
  634. PVOID HwDeviceExtension,
  635. PDMA pDma
  636. );
  637. typedef
  638. VOID
  639. (*PEXECUTE_DMA)(
  640. PVOID HwDeviceExtension,
  641. PVP_DMA_ADAPTER VpDmaAdapter,
  642. PVP_SCATTER_GATHER_LIST SGList,
  643. PVOID Context
  644. );
  645. //
  646. // Flags to be passed into VideoPortLockPages() or VideoPortDoDma().
  647. //
  648. //
  649. // The flag VideoPortUnlockAfterDma tells the video port to unlock the pages
  650. // after the miniport signals that the dma is complete via the
  651. // pDmaCompletionEvent in HwStartDma. Failure to set this event at
  652. // dma completion may cause the memory to be unlocked at randon times.
  653. // This flag is best used when one wants to do one dma transfer which
  654. // occurs infrequently. It allows locking, dmaing and unlocking to be performed
  655. // in the context of 1 IOCTL.
  656. //
  657. //
  658. // The flag VideoPortKeepPagesLocked tells the video port to leave the pages
  659. // locked if possible.
  660. //
  661. //
  662. // The flag VideoPortDmaInitOnly tells the Video Port to lock the pages, but don't
  663. // call HwStartDma. Not applicable to VideoPortDoDma().
  664. //
  665. typedef enum {
  666. VideoPortUnlockAfterDma = 1,
  667. VideoPortKeepPagesLocked,
  668. VideoPortDmaInitOnly
  669. } DMA_FLAGS;
  670. //
  671. // Event flags
  672. //
  673. typedef ULONG DMA_EVENT_FLAGS;
  674. #define SET_USER_EVENT 0x01
  675. #define SET_DISPLAY_EVENT 0x02
  676. #define EVENT_TYPE_MASK 1
  677. #define SYNCHRONIZATION_EVENT 0
  678. #define NOTIFICATION_EVENT 1
  679. #define INITIAL_EVENT_STATE_MASK 2
  680. #define INITIAL_EVENT_NOT_SIGNALED 0
  681. #define INITIAL_EVENT_SIGNALED 2
  682. //
  683. // Child Enumeration structure passed in to the PVIDEO_HW_GET_CHILD_DESCRIPTOR
  684. // function.
  685. //
  686. // All these parameters are input parameters and must not be modified by the
  687. // callee
  688. //
  689. // Size - Size of the structure. It can be used by the calle for versioning.
  690. //
  691. // ChildDescriptorSize - Size of the pChildDescriptor buffer passed in as the
  692. // third parameter to PVIDEO_HW_GET_CHILD_DESCRIPTOR.
  693. //
  694. // ChildIndex - Index of the device to be enumerated. This field should be
  695. // used to enumerate devices not enumerated by ACPI or other operating
  696. // system components. If this field is set to 0 it indicates the ACPIHwId
  697. // field.
  698. //
  699. // ACPIHwId - ID returned by the ACPI BIOS that represent the device being
  700. // queried. The ACPIHwId returned by the firmware must match the HwIds
  701. // returned by the driver. The System BIOS manufacturer and the graphics
  702. // IHV must synchronize these IDs.
  703. //
  704. // ChildHwDeviceExtension - Pointer to a device extension specific to this
  705. // child device. This field will only be filled in if the miniport driver
  706. // filled the ChildHwDeviceExtensionSize to be non-NULL.
  707. //
  708. typedef struct _VIDEO_CHILD_ENUM_INFO {
  709. ULONG Size;
  710. ULONG ChildDescriptorSize;
  711. ULONG ChildIndex;
  712. ULONG ACPIHwId;
  713. PVOID ChildHwDeviceExtension;
  714. } VIDEO_CHILD_ENUM_INFO, *PVIDEO_CHILD_ENUM_INFO;
  715. //
  716. // VIDEO_CHILD_TYPE enum:
  717. //
  718. // 'Monitor' identifies a device which may have a DDC2 compliant EDID data
  719. // structure. If the video miniport detects such a device, it is to extract
  720. // the edid from the monitor and put that in the paged buffer provided by
  721. // videoprt.sys in the callback to PVIDEO_HW_GET_CHILD_DESCRIPTOR and return
  722. // this type in the the OUT PVIDEO_CHILD_TYPE parameter of that call. This
  723. // EDID, if available, will be written to the registry. If the EDID is not
  724. // available, nothing should be put in the buffer.
  725. //
  726. // 'NonPrimaryChip' identifies another VGA chip on the video board which
  727. // is not the primary VGA chip. This type is to be used if and only if the
  728. // miniport detects more than one VGA chip on the board. Such an identifier
  729. // will cause the videoprt to create another DEVICE_EXTENSION and associated
  730. // HW_DEVICE_EXTENSION to be associated with the chip so identified.
  731. //
  732. // 'Other' identifies some other video device attached to the video card. If
  733. // the miniport detects such a device, it is to put a wide char string
  734. // (WSTR) into the paged buffer provided by the videoprt.sys which is the
  735. // PNP hardware identifier of the device. This string will be used to create
  736. // a value of that name in the registry.
  737. //
  738. typedef enum {
  739. Monitor = 1,
  740. NonPrimaryChip,
  741. VideoChip,
  742. Other
  743. } VIDEO_CHILD_TYPE, *PVIDEO_CHILD_TYPE;
  744. //
  745. // define a constant that represents the display adapter self query.
  746. //
  747. #define DISPLAY_ADAPTER_HW_ID 0xFFFFFFFF
  748. //
  749. // Define invalid child device id (needed for failure return value).
  750. //
  751. #define VIDEO_INVALID_CHILD_ID 0xFFFFFFFF
  752. typedef struct _VIDEO_CHILD_STATE {
  753. ULONG Id;
  754. ULONG State;
  755. } VIDEO_CHILD_STATE, *PVIDEO_CHILD_STATE;
  756. typedef struct _VIDEO_CHILD_STATE_CONFIGURATION {
  757. ULONG Count;
  758. VIDEO_CHILD_STATE ChildStateArray[ANYSIZE_ARRAY];
  759. } VIDEO_CHILD_STATE_CONFIGURATION, *PVIDEO_CHILD_STATE_CONFIGURATION;
  760. //
  761. // The following routine should return TRUE if successful. It should:
  762. // 1) put the type of the child device in VideoChildType.
  763. // 2) put the information from the device in Buffer. This
  764. // buffer is of size 256 bytes. If the type returned in
  765. // PVideoChildType is Monitor, this buffer must contain the
  766. // EDID of the monitor if readable. If the type returned in
  767. // PVideoChildType is Other, a wide character string representing
  768. // the PNP Device Id must be put in the buffer. This string will
  769. // be used to create a key for the device if the buffer contains
  770. // an EDID. Otherwise, it is used to obtain a PNP ID for the
  771. // device.
  772. // 3) Put a miniport determined HANDLE in HwId. This value will be
  773. // passed back to the miniport for Power management operations,
  774. // as well as other operations. This allows the miniport to define
  775. // the contract between the system and the miniport which defines a
  776. // particular device.
  777. //
  778. // It should only return FALSE if there are no devices attached to that
  779. // display adapter connector.
  780. //
  781. typedef
  782. VP_STATUS
  783. (*PVIDEO_HW_GET_CHILD_DESCRIPTOR) (
  784. IN PVOID HwDeviceExtension,
  785. IN PVIDEO_CHILD_ENUM_INFO ChildEnumInfo,
  786. OUT PVIDEO_CHILD_TYPE VideoChildType,
  787. OUT PUCHAR pChildDescriptor,
  788. OUT PULONG UId,
  789. OUT PULONG pUnused
  790. );
  791. //
  792. // This routine is used to set the power on the graphics devices.
  793. // These include all the Children enumerated by GET_CHILD_DESCRIPTOR callback
  794. // as well as the graphics adapter itself.
  795. //
  796. // The HwDevice extension represent the adapter instance of the device.
  797. //
  798. // The HwId parameter is the unique ID as returned by the enumeration routine.
  799. // The miniport will only be called to set the power on the devices it
  800. // enumerated, as well as the graphics adapter itself. A HwId of 0xFFFFFFFF
  801. // will be passed in to identify the graphics adapter itself.
  802. // The miniport driver should never turn off the power to the graphics adapter
  803. // unless specifically request to.
  804. //
  805. // The VideoPowerControl is the level to which the device shold be set.
  806. // The videoport driver will manage these states.
  807. //
  808. typedef
  809. VP_STATUS
  810. (*PVIDEO_HW_POWER_SET) (
  811. PVOID HwDeviceExtension,
  812. ULONG HwId,
  813. PVIDEO_POWER_MANAGEMENT VideoPowerControl
  814. );
  815. //
  816. // This routine simply returns whether or not the device can support the
  817. // requested state.
  818. //
  819. // See HW_POWER_SET for a description of the parameters.
  820. //
  821. typedef
  822. VP_STATUS
  823. (*PVIDEO_HW_POWER_GET) (
  824. PVOID HwDeviceExtension,
  825. ULONG HwId,
  826. PVIDEO_POWER_MANAGEMENT VideoPowerControl
  827. );
  828. //
  829. // This structure should match the QueryInterface struct defined
  830. // in io.h.
  831. //
  832. typedef struct _QUERY_INTERFACE {
  833. CONST GUID *InterfaceType;
  834. USHORT Size;
  835. USHORT Version;
  836. PINTERFACE Interface;
  837. PVOID InterfaceSpecificData;
  838. } QUERY_INTERFACE, *PQUERY_INTERFACE;
  839. typedef
  840. VP_STATUS
  841. (*PVIDEO_HW_QUERY_INTERFACE) (
  842. PVOID HwDeviceExtension,
  843. PQUERY_INTERFACE QueryInterface
  844. );
  845. typedef
  846. VP_STATUS
  847. (*PVIDEO_HW_CHILD_CALLBACK) (
  848. PVOID HwDeviceExtension,
  849. PVOID ChildDeviceExtension
  850. );
  851. //
  852. // Entry point for all IOCTL calls made to the miniport driver.
  853. //
  854. typedef
  855. BOOLEAN
  856. (*PVIDEO_HW_START_IO) (
  857. PVOID HwDeviceExtension,
  858. PVIDEO_REQUEST_PACKET RequestPacket
  859. );
  860. //
  861. // The return value determines if the mode was completely programmed (TRUE)
  862. // or if an int10 should be done by the HAL to complete the modeset (FALSE).
  863. //
  864. typedef
  865. BOOLEAN
  866. (*PVIDEO_HW_RESET_HW) (
  867. PVOID HwDeviceExtension,
  868. ULONG Columns,
  869. ULONG Rows
  870. );
  871. //
  872. // Timer routine called every second.
  873. //
  874. typedef
  875. VOID
  876. (*PVIDEO_HW_TIMER) (
  877. PVOID HwDeviceExtension
  878. );
  879. //
  880. // Structure passed by the miniport entry point to the video port
  881. // initialization routine.
  882. //
  883. typedef struct _VIDEO_HW_INITIALIZATION_DATA {
  884. //
  885. // Supplies the size of the structure in bytes as determined by sizeof().
  886. //
  887. ULONG HwInitDataSize;
  888. //
  889. // Indicates the bus type the adapter works with, such as Eisa, Isa, MCA.
  890. //
  891. INTERFACE_TYPE AdapterInterfaceType;
  892. //
  893. // Supplies a pointer to the miniport driver's find adapter routine.
  894. //
  895. PVIDEO_HW_FIND_ADAPTER HwFindAdapter;
  896. //
  897. // Supplies a pointer to the miniport driver's initialization routine.
  898. //
  899. PVIDEO_HW_INITIALIZE HwInitialize;
  900. //
  901. // Supplies a pointer to the miniport driver's interrupt service routine.
  902. //
  903. PVIDEO_HW_INTERRUPT HwInterrupt;
  904. //
  905. // Supplies a pointer to the miniport driver's start io routine.
  906. //
  907. PVIDEO_HW_START_IO HwStartIO;
  908. //
  909. // Supplies the size in bytes required for the miniport driver's private
  910. // device extension. This storage is used by the miniport driver to hold
  911. // per-adapter information. A pointer to this storage is provided with
  912. // every call made to the miniport driver. This data storage is
  913. // initialized to zero by the port driver.
  914. //
  915. ULONG HwDeviceExtensionSize;
  916. //
  917. // Supplies the number with which device numbering should be started.
  918. // The device numbering is used to determine which \DeviceX entry under
  919. // the \Parameters section in the registry should be used for parameters
  920. // to the miniport driver.
  921. // The number is *automatically* incremented when the miniport is called
  922. // back in it's FindAdapter routine due to an appropriate _Again_
  923. // parameter.
  924. //
  925. ULONG StartingDeviceNumber;
  926. //
  927. // New for version 3.5
  928. //
  929. //
  930. // Supplies a pointer to the miniport driver's HwResetHw routine.
  931. //
  932. // This function is called when the machine needs to bugchecks (go back
  933. // to the blue screen).
  934. //
  935. // This function should reset the video adapter to a character mode,
  936. // or at least to a state from which an int 10 can reset the card to
  937. // a character mode.
  938. //
  939. // This routine CAN NOT call int10.
  940. // It can only call Read\Write Port\Register functions from the port driver.
  941. //
  942. // The function must also be completely in non-paged pool since the IO\MM
  943. // subsystems may have crashed.
  944. //
  945. PVIDEO_HW_RESET_HW HwResetHw;
  946. //
  947. // Pointer to a timer routine to be called every second.
  948. //
  949. PVIDEO_HW_TIMER HwTimer;
  950. //
  951. // Start of 5.0 stuff.
  952. //
  953. //
  954. // Supplies a pointer to the miniport driver's start dma routine. This routine must
  955. // return a HW_DMA_RETURN consistent with it's return behavior.
  956. //
  957. PVIDEO_HW_START_DMA HwStartDma;
  958. //
  959. // HW dependent Power management routines.
  960. //
  961. PVIDEO_HW_POWER_SET HwSetPowerState;
  962. PVIDEO_HW_POWER_GET HwGetPowerState;
  963. //
  964. // Supplies a pointer to a miniport driver routine which can be called to
  965. // enumerate devices physically attached to the graphics adapter.
  966. //
  967. PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor;
  968. //
  969. // Supplies a pointer to a miniport driver routine which can be called to
  970. // query external programming interfaces supported in the miniport
  971. // driver.
  972. //
  973. PVIDEO_HW_QUERY_INTERFACE HwQueryInterface;
  974. //
  975. // Obselete. Don't set it.
  976. //
  977. ULONG HwChildDeviceExtensionSize;
  978. //
  979. // Allows the device to report legacy resources that should be
  980. // associated with the Plug and Play device.
  981. //
  982. PVIDEO_ACCESS_RANGE HwLegacyResourceList;
  983. //
  984. // Number of elements in the legacy resource list.
  985. //
  986. ULONG HwLegacyResourceCount;
  987. //
  988. // Call this routine to allow a driver to specify it's
  989. // legacy resources based on its device/vendor id.
  990. //
  991. PVIDEO_HW_LEGACYRESOURCES HwGetLegacyResources;
  992. //
  993. // Can HwGetVideoChildDescriptor be called before HwInitialize?
  994. //
  995. BOOLEAN AllowEarlyEnumeration;
  996. //
  997. // Start of 5.1 stuff.
  998. //
  999. ULONG Reserved;
  1000. } VIDEO_HW_INITIALIZATION_DATA, *PVIDEO_HW_INITIALIZATION_DATA;
  1001. //
  1002. // DDC help routines.
  1003. //
  1004. typedef
  1005. VOID
  1006. (*PVIDEO_WRITE_CLOCK_LINE)(
  1007. PVOID HwDeviceExtension,
  1008. UCHAR Data
  1009. );
  1010. typedef
  1011. VOID
  1012. (*PVIDEO_WRITE_DATA_LINE)(
  1013. PVOID HwDeviceExtension,
  1014. UCHAR Data
  1015. );
  1016. typedef
  1017. BOOLEAN
  1018. (*PVIDEO_READ_CLOCK_LINE)(
  1019. PVOID HwDeviceExtension
  1020. );
  1021. typedef
  1022. BOOLEAN
  1023. (*PVIDEO_READ_DATA_LINE)(
  1024. PVOID HwDeviceExtension
  1025. );
  1026. typedef
  1027. VOID
  1028. (*PVIDEO_WAIT_VSYNC_ACTIVE)(
  1029. PVOID HwDeviceExtension
  1030. );
  1031. //
  1032. // Data structures used I2C and DDC helper functions.
  1033. //
  1034. typedef struct _I2C_FNC_TABLE
  1035. {
  1036. IN ULONG Size;
  1037. IN PVIDEO_WRITE_CLOCK_LINE WriteClockLine;
  1038. IN PVIDEO_WRITE_DATA_LINE WriteDataLine;
  1039. IN PVIDEO_READ_CLOCK_LINE ReadClockLine;
  1040. IN PVIDEO_READ_DATA_LINE ReadDataLine;
  1041. IN PVIDEO_WAIT_VSYNC_ACTIVE WaitVsync;
  1042. PVOID Reserved;
  1043. } I2C_FNC_TABLE, *PI2C_FNC_TABLE;
  1044. typedef struct _I2C_CALLBACKS
  1045. {
  1046. IN PVIDEO_WRITE_CLOCK_LINE WriteClockLine;
  1047. IN PVIDEO_WRITE_DATA_LINE WriteDataLine;
  1048. IN PVIDEO_READ_CLOCK_LINE ReadClockLine;
  1049. IN PVIDEO_READ_DATA_LINE ReadDataLine;
  1050. } I2C_CALLBACKS, *PI2C_CALLBACKS;
  1051. typedef struct _DDC_CONTROL
  1052. {
  1053. IN ULONG Size;
  1054. IN I2C_CALLBACKS I2CCallbacks;
  1055. IN UCHAR EdidSegment;
  1056. } DDC_CONTROL, *PDDC_CONTROL;
  1057. typedef struct _VIDEO_I2C_CONTROL
  1058. {
  1059. IN PVIDEO_WRITE_CLOCK_LINE WriteClockLine;
  1060. IN PVIDEO_WRITE_DATA_LINE WriteDataLine;
  1061. IN PVIDEO_READ_CLOCK_LINE ReadClockLine;
  1062. IN PVIDEO_READ_DATA_LINE ReadDataLine;
  1063. IN ULONG I2CDelay; // 100ns units
  1064. } VIDEO_I2C_CONTROL, *PVIDEO_I2C_CONTROL;
  1065. //
  1066. // Types of services exported by the VideoPortQueryServices().
  1067. //
  1068. typedef enum
  1069. {
  1070. VideoPortServicesAGP = 1,
  1071. VideoPortServicesI2C,
  1072. VideoPortServicesHeadless,
  1073. VideoPortServicesInt10
  1074. } VIDEO_PORT_SERVICES;
  1075. //
  1076. // AGP services interface.
  1077. //
  1078. #define VIDEO_PORT_AGP_INTERFACE_VERSION_1 1
  1079. typedef struct _VIDEO_PORT_AGP_INTERFACE
  1080. {
  1081. IN USHORT Size;
  1082. IN USHORT Version;
  1083. OUT PVOID Context;
  1084. OUT PINTERFACE_REFERENCE InterfaceReference;
  1085. OUT PINTERFACE_DEREFERENCE InterfaceDereference;
  1086. OUT PAGP_RESERVE_PHYSICAL AgpReservePhysical;
  1087. OUT PAGP_RELEASE_PHYSICAL AgpReleasePhysical;
  1088. OUT PAGP_COMMIT_PHYSICAL AgpCommitPhysical;
  1089. OUT PAGP_FREE_PHYSICAL AgpFreePhysical;
  1090. OUT PAGP_RESERVE_VIRTUAL AgpReserveVirtual;
  1091. OUT PAGP_RELEASE_VIRTUAL AgpReleaseVirtual;
  1092. OUT PAGP_COMMIT_VIRTUAL AgpCommitVirtual;
  1093. OUT PAGP_FREE_VIRTUAL AgpFreeVirtual;
  1094. OUT ULONGLONG AgpAllocationLimit;
  1095. } VIDEO_PORT_AGP_INTERFACE, *PVIDEO_PORT_AGP_INTERFACE;
  1096. #define VIDEO_PORT_AGP_INTERFACE_VERSION_2 2
  1097. typedef struct _VIDEO_PORT_AGP_INTERFACE_2
  1098. {
  1099. IN USHORT Size;
  1100. IN USHORT Version;
  1101. OUT PVOID Context;
  1102. OUT PINTERFACE_REFERENCE InterfaceReference;
  1103. OUT PINTERFACE_DEREFERENCE InterfaceDereference;
  1104. OUT PAGP_RESERVE_PHYSICAL AgpReservePhysical;
  1105. OUT PAGP_RELEASE_PHYSICAL AgpReleasePhysical;
  1106. OUT PAGP_COMMIT_PHYSICAL AgpCommitPhysical;
  1107. OUT PAGP_FREE_PHYSICAL AgpFreePhysical;
  1108. OUT PAGP_RESERVE_VIRTUAL AgpReserveVirtual;
  1109. OUT PAGP_RELEASE_VIRTUAL AgpReleaseVirtual;
  1110. OUT PAGP_COMMIT_VIRTUAL AgpCommitVirtual;
  1111. OUT PAGP_FREE_VIRTUAL AgpFreeVirtual;
  1112. OUT ULONGLONG AgpAllocationLimit;
  1113. OUT PAGP_SET_RATE AgpSetRate;
  1114. } VIDEO_PORT_AGP_INTERFACE_2, *PVIDEO_PORT_AGP_INTERFACE_2;
  1115. //
  1116. // I2C helper routines exported via VideoPortQueryServices().
  1117. //
  1118. typedef
  1119. BOOLEAN
  1120. (*PI2C_START)(
  1121. IN PVOID HwDeviceExtension,
  1122. IN PI2C_CALLBACKS I2CCallbacks
  1123. );
  1124. typedef
  1125. BOOLEAN
  1126. (*PI2C_STOP)(
  1127. IN PVOID HwDeviceExtension,
  1128. IN PI2C_CALLBACKS I2CCallbacks
  1129. );
  1130. typedef
  1131. BOOLEAN
  1132. (*PI2C_WRITE)(
  1133. IN PVOID HwDeviceExtension,
  1134. IN PI2C_CALLBACKS I2CCallbacks,
  1135. IN PUCHAR Buffer,
  1136. IN ULONG Length
  1137. );
  1138. typedef
  1139. BOOLEAN
  1140. (*PI2C_READ)(
  1141. IN PVOID HwDeviceExtension,
  1142. IN PI2C_CALLBACKS I2CCallbacks,
  1143. OUT PUCHAR Buffer,
  1144. IN ULONG Length
  1145. );
  1146. //
  1147. // I2C services interface.
  1148. //
  1149. #define VIDEO_PORT_I2C_INTERFACE_VERSION_1 1
  1150. typedef struct _VIDEO_PORT_I2C_INTERFACE
  1151. {
  1152. IN USHORT Size;
  1153. IN USHORT Version;
  1154. OUT PVOID Context;
  1155. OUT PINTERFACE_REFERENCE InterfaceReference;
  1156. OUT PINTERFACE_DEREFERENCE InterfaceDereference;
  1157. OUT PI2C_START I2CStart;
  1158. OUT PI2C_STOP I2CStop;
  1159. OUT PI2C_WRITE I2CWrite;
  1160. OUT PI2C_READ I2CRead;
  1161. } VIDEO_PORT_I2C_INTERFACE, *PVIDEO_PORT_I2C_INTERFACE;
  1162. //
  1163. // I2C helper routines exported via VideoPortQueryServices()
  1164. // for I2C interface version 2.
  1165. //
  1166. typedef
  1167. BOOLEAN
  1168. (*PI2C_START_2)(
  1169. IN PVOID HwDeviceExtension,
  1170. IN PVIDEO_I2C_CONTROL I2CControl
  1171. );
  1172. typedef
  1173. BOOLEAN
  1174. (*PI2C_STOP_2)(
  1175. IN PVOID HwDeviceExtension,
  1176. IN PVIDEO_I2C_CONTROL I2CControl
  1177. );
  1178. typedef
  1179. BOOLEAN
  1180. (*PI2C_WRITE_2)(
  1181. IN PVOID HwDeviceExtension,
  1182. IN PVIDEO_I2C_CONTROL I2CControl,
  1183. IN PUCHAR Buffer,
  1184. IN ULONG Length
  1185. );
  1186. typedef
  1187. BOOLEAN
  1188. (*PI2C_READ_2)(
  1189. IN PVOID HwDeviceExtension,
  1190. IN PVIDEO_I2C_CONTROL I2CControl,
  1191. OUT PUCHAR Buffer,
  1192. IN ULONG Length,
  1193. IN BOOLEAN EndOfRead
  1194. );
  1195. //
  1196. // I2C services interface version 2.
  1197. //
  1198. #define VIDEO_PORT_I2C_INTERFACE_VERSION_2 2
  1199. typedef struct _VIDEO_PORT_I2C_INTERFACE_2
  1200. {
  1201. IN USHORT Size;
  1202. IN USHORT Version;
  1203. OUT PVOID Context;
  1204. OUT PINTERFACE_REFERENCE InterfaceReference;
  1205. OUT PINTERFACE_DEREFERENCE InterfaceDereference;
  1206. OUT PI2C_START_2 I2CStart;
  1207. OUT PI2C_STOP_2 I2CStop;
  1208. OUT PI2C_WRITE_2 I2CWrite;
  1209. OUT PI2C_READ_2 I2CRead;
  1210. } VIDEO_PORT_I2C_INTERFACE_2, *PVIDEO_PORT_I2C_INTERFACE_2;
  1211. typedef
  1212. VP_STATUS
  1213. (*PINT10_ALLOCATE_BUFFER)(
  1214. IN PVOID Context,
  1215. OUT PUSHORT Seg,
  1216. OUT PUSHORT Off,
  1217. IN OUT PULONG Length
  1218. );
  1219. typedef
  1220. VP_STATUS
  1221. (*PINT10_FREE_BUFFER)(
  1222. IN PVOID Context,
  1223. IN USHORT Seg,
  1224. IN USHORT Off
  1225. );
  1226. typedef
  1227. VP_STATUS
  1228. (*PINT10_READ_MEMORY)(
  1229. IN PVOID Context,
  1230. IN USHORT Seg,
  1231. IN USHORT Off,
  1232. OUT PVOID Buffer,
  1233. IN ULONG Length
  1234. );
  1235. typedef
  1236. VP_STATUS
  1237. (*PINT10_WRITE_MEMORY)(
  1238. IN PVOID Context,
  1239. IN USHORT Seg,
  1240. IN USHORT Off,
  1241. IN PVOID Buffer,
  1242. IN ULONG Length
  1243. );
  1244. typedef
  1245. VP_STATUS
  1246. (*PINT10_CALL_BIOS)(
  1247. PVOID Context,
  1248. PINT10_BIOS_ARGUMENTS BiosArguments
  1249. );
  1250. #define VIDEO_PORT_INT10_INTERFACE_VERSION_1 1
  1251. typedef struct _VIDEO_PORT_INT10_INTERFACE
  1252. {
  1253. IN USHORT Size;
  1254. IN USHORT Version;
  1255. OUT PVOID Context;
  1256. OUT PINTERFACE_REFERENCE InterfaceReference;
  1257. OUT PINTERFACE_DEREFERENCE InterfaceDereference;
  1258. OUT PINT10_ALLOCATE_BUFFER Int10AllocateBuffer;
  1259. OUT PINT10_FREE_BUFFER Int10FreeBuffer;
  1260. OUT PINT10_READ_MEMORY Int10ReadMemory;
  1261. OUT PINT10_WRITE_MEMORY Int10WriteMemory;
  1262. OUT PINT10_CALL_BIOS Int10CallBios;
  1263. } VIDEO_PORT_INT10_INTERFACE, *PVIDEO_PORT_INT10_INTERFACE;
  1264. typedef struct _VPOSVERSIONINFO
  1265. {
  1266. IN ULONG Size;
  1267. OUT ULONG MajorVersion;
  1268. OUT ULONG MinorVersion;
  1269. OUT ULONG BuildNumber;
  1270. OUT USHORT ServicePackMajor;
  1271. OUT USHORT ServicePackMinor;
  1272. } VPOSVERSIONINFO, *PVPOSVERSIONINFO;
  1273. //
  1274. // Flags that can be passed to VideoPortGetDeviceBase or VideoPortMapMemory.
  1275. //
  1276. #define VIDEO_MEMORY_SPACE_MEMORY 0x00 // Should not be set by display driver
  1277. #define VIDEO_MEMORY_SPACE_IO 0x01 // Should not be set by display driver
  1278. #define VIDEO_MEMORY_SPACE_USER_MODE 0x02 // Memory pointer for application use
  1279. #define VIDEO_MEMORY_SPACE_DENSE 0x04 // Mapped dense, linearly (ALPHA)
  1280. #define VIDEO_MEMORY_SPACE_P6CACHE 0x08 // P6 MTRR caching (kernel and user)
  1281. //
  1282. // Define status codes returned by HwGetVideoChildDescriptor()
  1283. // miniport enumaration routine.
  1284. //
  1285. // Note: For backword compatibility reasons these values match
  1286. // existing WINERROR codes.
  1287. //
  1288. //
  1289. // Call again (ACPI and non-ACPI devices will be enumerated).
  1290. //
  1291. #define VIDEO_ENUM_MORE_DEVICES ERROR_CONTINUE
  1292. //
  1293. // Stop enumeration.
  1294. //
  1295. #define VIDEO_ENUM_NO_MORE_DEVICES ERROR_NO_MORE_DEVICES
  1296. //
  1297. // Call again, device could not be enumerated.
  1298. //
  1299. #define VIDEO_ENUM_INVALID_DEVICE ERROR_INVALID_NAME
  1300. //
  1301. // Define the bits in VgaStatus.
  1302. //
  1303. #define DEVICE_VGA_ENABLED 1
  1304. //
  1305. // Port driver routines called by miniport driver and callbacks.
  1306. //
  1307. VIDEOPORT_API
  1308. VP_STATUS
  1309. VideoPortAllocateBuffer(
  1310. IN PVOID HwDeviceExtension,
  1311. IN ULONG Size,
  1312. OUT PVOID *Buffer
  1313. );
  1314. VIDEOPORT_API
  1315. VOID
  1316. VideoPortAcquireDeviceLock(
  1317. IN PVOID HwDeviceExtension
  1318. );
  1319. VIDEOPORT_API
  1320. ULONG
  1321. VideoPortCompareMemory(
  1322. PVOID Source1,
  1323. PVOID Source2,
  1324. ULONG Length
  1325. );
  1326. VIDEOPORT_API
  1327. BOOLEAN
  1328. VideoPortDDCMonitorHelper(
  1329. IN PVOID HwDeviceExtension,
  1330. IN PVOID DDCControl,
  1331. IN OUT PUCHAR EdidBuffer,
  1332. IN ULONG EdidBufferSize
  1333. );
  1334. VIDEOPORT_API
  1335. VOID
  1336. VideoPortDebugPrint(
  1337. VIDEO_DEBUG_LEVEL DebugPrintLevel,
  1338. PCHAR DebugMessage,
  1339. ...
  1340. );
  1341. VIDEOPORT_API
  1342. VP_STATUS
  1343. VideoPortDisableInterrupt(
  1344. PVOID HwDeviceExtension
  1345. );
  1346. VIDEOPORT_API
  1347. VP_STATUS
  1348. VideoPortEnableInterrupt(
  1349. PVOID HwDeviceExtension
  1350. );
  1351. VIDEOPORT_API
  1352. VP_STATUS
  1353. VideoPortEnumerateChildren(
  1354. IN PVOID HwDeviceExtension,
  1355. IN PVOID Reserved
  1356. );
  1357. VIDEOPORT_API
  1358. VOID
  1359. VideoPortFreeDeviceBase(
  1360. PVOID HwDeviceExtension,
  1361. PVOID MappedAddress
  1362. );
  1363. typedef
  1364. VP_STATUS
  1365. (*PMINIPORT_QUERY_DEVICE_ROUTINE)(
  1366. PVOID HwDeviceExtension,
  1367. PVOID Context,
  1368. VIDEO_DEVICE_DATA_TYPE DeviceDataType,
  1369. PVOID Identifier,
  1370. ULONG IdentiferLength,
  1371. PVOID ConfigurationData,
  1372. ULONG ConfigurationDataLength,
  1373. PVOID ComponentInformation,
  1374. ULONG ComponentInformationLength
  1375. );
  1376. VIDEOPORT_API
  1377. VP_STATUS
  1378. VideoPortGetAccessRanges(
  1379. PVOID HwDeviceExtension,
  1380. ULONG NumRequestedResources,
  1381. PIO_RESOURCE_DESCRIPTOR RequestedResources OPTIONAL,
  1382. ULONG NumAccessRanges,
  1383. PVIDEO_ACCESS_RANGE AccessRanges,
  1384. PVOID VendorId,
  1385. PVOID DeviceId,
  1386. PULONG Slot
  1387. );
  1388. VIDEOPORT_API
  1389. PVOID
  1390. VideoPortGetAssociatedDeviceExtension(
  1391. IN PVOID DeviceObject
  1392. );
  1393. VIDEOPORT_API
  1394. ULONG
  1395. VideoPortGetBusData(
  1396. PVOID HwDeviceExtension,
  1397. BUS_DATA_TYPE BusDataType,
  1398. ULONG SlotNumber,
  1399. PVOID Buffer,
  1400. ULONG Offset,
  1401. ULONG Length
  1402. );
  1403. VIDEOPORT_API
  1404. UCHAR
  1405. VideoPortGetCurrentIrql();
  1406. VIDEOPORT_API
  1407. PVOID
  1408. VideoPortGetDeviceBase(
  1409. PVOID HwDeviceExtension,
  1410. PHYSICAL_ADDRESS IoAddress,
  1411. ULONG NumberOfUchars,
  1412. UCHAR InIoSpace
  1413. );
  1414. VIDEOPORT_API
  1415. VP_STATUS
  1416. VideoPortGetDeviceData(
  1417. PVOID HwDeviceExtension,
  1418. VIDEO_DEVICE_DATA_TYPE DeviceDataType,
  1419. PMINIPORT_QUERY_DEVICE_ROUTINE CallbackRoutine,
  1420. PVOID Context
  1421. );
  1422. typedef
  1423. VP_STATUS
  1424. (*PMINIPORT_GET_REGISTRY_ROUTINE)(
  1425. PVOID HwDeviceExtension,
  1426. PVOID Context,
  1427. PWSTR ValueName,
  1428. PVOID ValueData,
  1429. ULONG ValueLength
  1430. );
  1431. VIDEOPORT_API
  1432. VP_STATUS
  1433. VideoPortGetRegistryParameters(
  1434. PVOID HwDeviceExtension,
  1435. PWSTR ParameterName,
  1436. UCHAR IsParameterFileName,
  1437. PMINIPORT_GET_REGISTRY_ROUTINE GetRegistryRoutine,
  1438. PVOID Context
  1439. );
  1440. VIDEOPORT_API
  1441. PVOID
  1442. VideoPortGetRomImage(
  1443. IN PVOID HwDeviceExtension,
  1444. IN PVOID Unused1,
  1445. IN ULONG Unused2,
  1446. IN ULONG Length
  1447. );
  1448. VIDEOPORT_API
  1449. VP_STATUS
  1450. VideoPortGetVgaStatus(
  1451. PVOID HwDeviceExtension,
  1452. OUT PULONG VgaStatus
  1453. );
  1454. VIDEOPORT_API
  1455. LONG
  1456. FASTCALL
  1457. VideoPortInterlockedDecrement(
  1458. IN PLONG Addend
  1459. );
  1460. VIDEOPORT_API
  1461. LONG
  1462. FASTCALL
  1463. VideoPortInterlockedIncrement(
  1464. IN PLONG Addend
  1465. );
  1466. VIDEOPORT_API
  1467. LONG
  1468. FASTCALL
  1469. VideoPortInterlockedExchange(
  1470. IN OUT PLONG Target,
  1471. IN LONG Value
  1472. );
  1473. VIDEOPORT_API
  1474. ULONG
  1475. VideoPortInitialize(
  1476. PVOID Argument1,
  1477. PVOID Argument2,
  1478. PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
  1479. PVOID HwContext
  1480. );
  1481. VIDEOPORT_API
  1482. VP_STATUS
  1483. VideoPortInt10(
  1484. PVOID HwDeviceExtension,
  1485. PVIDEO_X86_BIOS_ARGUMENTS BiosArguments
  1486. );
  1487. VIDEOPORT_API
  1488. VOID
  1489. VideoPortLogError(
  1490. PVOID HwDeviceExtension,
  1491. PVIDEO_REQUEST_PACKET Vrp OPTIONAL,
  1492. VP_STATUS ErrorCode,
  1493. ULONG UniqueId
  1494. );
  1495. VIDEOPORT_API
  1496. VP_STATUS
  1497. VideoPortMapBankedMemory(
  1498. PVOID HwDeviceExtension,
  1499. PHYSICAL_ADDRESS PhysicalAddress,
  1500. PULONG Length,
  1501. PULONG InIoSpace,
  1502. PVOID *VirtualAddress,
  1503. ULONG BankLength,
  1504. UCHAR ReadWriteBank,
  1505. PBANKED_SECTION_ROUTINE BankRoutine,
  1506. PVOID Context
  1507. );
  1508. VIDEOPORT_API
  1509. VP_STATUS
  1510. VideoPortMapMemory(
  1511. PVOID HwDeviceExtension,
  1512. PHYSICAL_ADDRESS PhysicalAddress,
  1513. PULONG Length,
  1514. PULONG InIoSpace,
  1515. PVOID *VirtualAddress
  1516. );
  1517. VIDEOPORT_API
  1518. VOID
  1519. VideoPortMoveMemory(
  1520. PVOID Destination,
  1521. PVOID Source,
  1522. ULONG Length
  1523. );
  1524. VIDEOPORT_API
  1525. LONGLONG
  1526. VideoPortQueryPerformanceCounter(
  1527. IN PVOID HwDeviceExtension,
  1528. OUT PLONGLONG PerformanceFrequency OPTIONAL
  1529. );
  1530. VIDEOPORT_API
  1531. VP_STATUS
  1532. VideoPortQueryServices(
  1533. IN PVOID HwDeviceExtension,
  1534. IN VIDEO_PORT_SERVICES ServicesType,
  1535. IN OUT PINTERFACE Interface
  1536. );
  1537. typedef
  1538. VOID
  1539. (*PMINIPORT_DPC_ROUTINE)(
  1540. IN PVOID HwDeviceExtension,
  1541. IN PVOID Context
  1542. );
  1543. VIDEOPORT_API
  1544. BOOLEAN
  1545. VideoPortQueueDpc(
  1546. IN PVOID HwDeviceExtension,
  1547. IN PMINIPORT_DPC_ROUTINE CallbackRoutine,
  1548. IN PVOID Context
  1549. );
  1550. VIDEOPORT_API
  1551. UCHAR
  1552. VideoPortReadPortUchar(
  1553. PUCHAR Port
  1554. );
  1555. VIDEOPORT_API
  1556. USHORT
  1557. VideoPortReadPortUshort(
  1558. PUSHORT Port
  1559. );
  1560. VIDEOPORT_API
  1561. ULONG
  1562. VideoPortReadPortUlong(
  1563. PULONG Port
  1564. );
  1565. VIDEOPORT_API
  1566. VOID
  1567. VideoPortReadPortBufferUchar(
  1568. PUCHAR Port,
  1569. PUCHAR Buffer,
  1570. ULONG Count
  1571. );
  1572. VIDEOPORT_API
  1573. VOID
  1574. VideoPortReadPortBufferUshort(
  1575. PUSHORT Port,
  1576. PUSHORT Buffer,
  1577. ULONG Count
  1578. );
  1579. VIDEOPORT_API
  1580. VOID
  1581. VideoPortReadPortBufferUlong(
  1582. PULONG Port,
  1583. PULONG Buffer,
  1584. ULONG Count
  1585. );
  1586. VIDEOPORT_API
  1587. UCHAR
  1588. VideoPortReadRegisterUchar(
  1589. PUCHAR Register
  1590. );
  1591. VIDEOPORT_API
  1592. USHORT
  1593. VideoPortReadRegisterUshort(
  1594. PUSHORT Register
  1595. );
  1596. VIDEOPORT_API
  1597. ULONG
  1598. VideoPortReadRegisterUlong(
  1599. PULONG Register
  1600. );
  1601. VIDEOPORT_API
  1602. VOID
  1603. VideoPortReadRegisterBufferUchar(
  1604. PUCHAR Register,
  1605. PUCHAR Buffer,
  1606. ULONG Count
  1607. );
  1608. VIDEOPORT_API
  1609. VOID
  1610. VideoPortReadRegisterBufferUshort(
  1611. PUSHORT Register,
  1612. PUSHORT Buffer,
  1613. ULONG Count
  1614. );
  1615. VIDEOPORT_API
  1616. VOID
  1617. VideoPortReadRegisterBufferUlong(
  1618. PULONG Register,
  1619. PULONG Buffer,
  1620. ULONG Count
  1621. );
  1622. VIDEOPORT_API
  1623. VOID
  1624. VideoPortReleaseBuffer(
  1625. IN PVOID HwDeviceExtension,
  1626. IN PVOID Buffer
  1627. );
  1628. VIDEOPORT_API
  1629. VOID
  1630. VideoPortReleaseDeviceLock(
  1631. IN PVOID HwDeviceExtension
  1632. );
  1633. VIDEOPORT_API
  1634. BOOLEAN
  1635. VideoPortScanRom(
  1636. PVOID HwDeviceExtension,
  1637. PUCHAR RomBase,
  1638. ULONG RomLength,
  1639. PUCHAR String
  1640. );
  1641. VIDEOPORT_API
  1642. ULONG
  1643. VideoPortSetBusData(
  1644. PVOID HwDeviceExtension,
  1645. BUS_DATA_TYPE BusDataType,
  1646. ULONG SlotNumber,
  1647. PVOID Buffer,
  1648. ULONG Offset,
  1649. ULONG Length
  1650. );
  1651. VIDEOPORT_API
  1652. VP_STATUS
  1653. VideoPortSetRegistryParameters(
  1654. PVOID HwDeviceExtension,
  1655. PWSTR ValueName,
  1656. PVOID ValueData,
  1657. ULONG ValueLength
  1658. );
  1659. VIDEOPORT_API
  1660. VP_STATUS
  1661. VideoPortSetTrappedEmulatorPorts(
  1662. PVOID HwDeviceExtension,
  1663. ULONG NumAccessRanges,
  1664. PVIDEO_ACCESS_RANGE AccessRange
  1665. );
  1666. VIDEOPORT_API
  1667. VOID
  1668. VideoPortStallExecution(
  1669. ULONG Microseconds
  1670. );
  1671. VIDEOPORT_API
  1672. VOID
  1673. VideoPortStartTimer(
  1674. PVOID HwDeviceExtension
  1675. );
  1676. VIDEOPORT_API
  1677. VOID
  1678. VideoPortStopTimer(
  1679. PVOID HwDeviceExtension
  1680. );
  1681. typedef
  1682. BOOLEAN
  1683. (*PMINIPORT_SYNCHRONIZE_ROUTINE)(
  1684. PVOID Context
  1685. );
  1686. BOOLEAN
  1687. VIDEOPORT_API
  1688. VideoPortSynchronizeExecution(
  1689. PVOID HwDeviceExtension,
  1690. VIDEO_SYNCHRONIZE_PRIORITY Priority,
  1691. PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine,
  1692. PVOID Context
  1693. );
  1694. VIDEOPORT_API
  1695. VP_STATUS
  1696. VideoPortUnmapMemory(
  1697. PVOID HwDeviceExtension,
  1698. PVOID VirtualAddress,
  1699. HANDLE ProcessHandle
  1700. );
  1701. VIDEOPORT_API
  1702. VP_STATUS
  1703. VideoPortVerifyAccessRanges(
  1704. PVOID HwDeviceExtension,
  1705. ULONG NumAccessRanges,
  1706. PVIDEO_ACCESS_RANGE AccessRanges
  1707. );
  1708. VIDEOPORT_API
  1709. VOID
  1710. VideoPortWritePortUchar(
  1711. PUCHAR Port,
  1712. UCHAR Value
  1713. );
  1714. VIDEOPORT_API
  1715. VOID
  1716. VideoPortWritePortUshort(
  1717. PUSHORT Port,
  1718. USHORT Value
  1719. );
  1720. VIDEOPORT_API
  1721. VOID
  1722. VideoPortWritePortUlong(
  1723. PULONG Port,
  1724. ULONG Value
  1725. );
  1726. VIDEOPORT_API
  1727. VOID
  1728. VideoPortWritePortBufferUchar(
  1729. PUCHAR Port,
  1730. PUCHAR Buffer,
  1731. ULONG Count
  1732. );
  1733. VIDEOPORT_API
  1734. VOID
  1735. VideoPortWritePortBufferUshort(
  1736. PUSHORT Port,
  1737. PUSHORT Buffer,
  1738. ULONG Count
  1739. );
  1740. VIDEOPORT_API
  1741. VOID
  1742. VideoPortWritePortBufferUlong(
  1743. PULONG Port,
  1744. PULONG Buffer,
  1745. ULONG Count
  1746. );
  1747. VIDEOPORT_API
  1748. VOID
  1749. VideoPortWriteRegisterUchar(
  1750. PUCHAR Register,
  1751. UCHAR Value
  1752. );
  1753. VIDEOPORT_API
  1754. VOID
  1755. VideoPortWriteRegisterUshort(
  1756. PUSHORT Register,
  1757. USHORT Value
  1758. );
  1759. VIDEOPORT_API
  1760. VOID
  1761. VideoPortWriteRegisterUlong(
  1762. PULONG Register,
  1763. ULONG Value
  1764. );
  1765. VIDEOPORT_API
  1766. VOID
  1767. VideoPortWriteRegisterBufferUchar(
  1768. PUCHAR Register,
  1769. PUCHAR Buffer,
  1770. ULONG Count
  1771. );
  1772. VIDEOPORT_API
  1773. VOID
  1774. VideoPortWriteRegisterBufferUshort(
  1775. PUSHORT Register,
  1776. PUSHORT Buffer,
  1777. ULONG Count
  1778. );
  1779. VIDEOPORT_API
  1780. VOID
  1781. VideoPortWriteRegisterBufferUlong(
  1782. PULONG Register,
  1783. PULONG Buffer,
  1784. ULONG Count
  1785. );
  1786. VIDEOPORT_API
  1787. VOID
  1788. VideoPortZeroDeviceMemory(
  1789. PVOID Destination,
  1790. ULONG Length
  1791. );
  1792. VIDEOPORT_API
  1793. VOID
  1794. VideoPortZeroMemory(
  1795. PVOID Destination,
  1796. ULONG Length
  1797. );
  1798. //
  1799. // DMA support.
  1800. // TODO: Move to the separate module -- will be obsolete.
  1801. //
  1802. VIDEOPORT_API
  1803. PVOID
  1804. VideoPortAllocateContiguousMemory(
  1805. IN PVOID HwDeviceExtension,
  1806. IN ULONG NumberOfBytes,
  1807. IN PHYSICAL_ADDRESS HighestAcceptableAddress
  1808. );
  1809. VIDEOPORT_API
  1810. PVOID
  1811. VideoPortGetCommonBuffer(
  1812. IN PVOID HwDeviceExtension,
  1813. IN ULONG DesiredLength,
  1814. IN ULONG Alignment,
  1815. OUT PPHYSICAL_ADDRESS LogicalAddress,
  1816. OUT PULONG pActualLength,
  1817. IN BOOLEAN CacheEnabled
  1818. );
  1819. VIDEOPORT_API
  1820. VOID
  1821. VideoPortFreeCommonBuffer(
  1822. IN PVOID HwDeviceExtension,
  1823. IN ULONG Length,
  1824. IN PVOID VirtualAddress,
  1825. IN PHYSICAL_ADDRESS LogicalAddress,
  1826. IN BOOLEAN CacheEnabled
  1827. );
  1828. VIDEOPORT_API
  1829. PDMA
  1830. VideoPortDoDma(
  1831. IN PVOID HwDeviceExtension,
  1832. IN PDMA pDma,
  1833. IN DMA_FLAGS DmaFlags
  1834. );
  1835. VIDEOPORT_API
  1836. BOOLEAN
  1837. VideoPortLockPages(
  1838. IN PVOID HwDeviceExtension,
  1839. IN OUT PVIDEO_REQUEST_PACKET pVrp,
  1840. IN PEVENT pUEvent,
  1841. IN PEVENT pDisplayEvent,
  1842. IN DMA_FLAGS DmaFlags
  1843. );
  1844. VIDEOPORT_API
  1845. BOOLEAN
  1846. VideoPortUnlockPages(
  1847. PVOID hwDeviceExtension,
  1848. PDMA pDma
  1849. );
  1850. VIDEOPORT_API
  1851. BOOLEAN
  1852. VideoPortSignalDmaComplete(
  1853. IN PVOID HwDeviceExtension,
  1854. IN PDMA pDmaHandle
  1855. );
  1856. VIDEOPORT_API
  1857. PVOID
  1858. VideoPortGetMdl(
  1859. IN PVOID HwDeviceExtension,
  1860. IN PDMA pDma
  1861. );
  1862. VIDEOPORT_API
  1863. PVOID
  1864. VideoPortGetDmaContext(
  1865. IN PVOID HwDeviceExtension,
  1866. IN PDMA pDma
  1867. );
  1868. VIDEOPORT_API
  1869. VOID
  1870. VideoPortSetDmaContext(
  1871. IN PVOID HwDeviceExtension,
  1872. OUT PDMA pDma,
  1873. IN PVOID InstanceContext
  1874. );
  1875. VIDEOPORT_API
  1876. ULONG
  1877. VideoPortGetBytesUsed(
  1878. IN PVOID HwDeviceExtension,
  1879. IN PDMA pDma
  1880. );
  1881. VIDEOPORT_API
  1882. VOID
  1883. VideoPortSetBytesUsed(
  1884. IN PVOID HwDeviceExtension,
  1885. IN OUT PDMA pDma,
  1886. IN ULONG BytesUsed
  1887. );
  1888. VIDEOPORT_API
  1889. PDMA
  1890. VideoPortAssociateEventsWithDmaHandle(
  1891. IN PVOID HwDeviceExtension,
  1892. IN OUT PVIDEO_REQUEST_PACKET pVrp,
  1893. IN PVOID MappedUserEvent,
  1894. IN PVOID DisplayDriverEvent
  1895. );
  1896. VIDEOPORT_API
  1897. PDMA
  1898. VideoPortMapDmaMemory(
  1899. IN PVOID HwDeviceExtension,
  1900. IN PVIDEO_REQUEST_PACKET pVrp,
  1901. IN PHYSICAL_ADDRESS BoardAddress,
  1902. IN PULONG Length,
  1903. IN PULONG InIoSpace,
  1904. IN PVOID MappedUserEvent,
  1905. IN PVOID DisplayDriverEvent,
  1906. IN OUT PVOID * VirtualAddress
  1907. );
  1908. VIDEOPORT_API
  1909. BOOLEAN
  1910. VideoPortUnmapDmaMemory(
  1911. PVOID HwDeviceExtension,
  1912. PVOID VirtualAddress,
  1913. HANDLE ProcessHandle,
  1914. PDMA BoardMemoryHandle
  1915. );
  1916. VIDEOPORT_API
  1917. VP_STATUS
  1918. VideoPortCreateSecondaryDisplay(
  1919. IN PVOID HwDeviceExtension,
  1920. IN OUT PVOID *SecondaryDeviceExtension,
  1921. IN ULONG ulFlag
  1922. );
  1923. VIDEOPORT_API
  1924. PVP_DMA_ADAPTER
  1925. VideoPortGetDmaAdapter(
  1926. IN PVOID HwDeviceExtension,
  1927. IN PVP_DEVICE_DESCRIPTION VpDeviceDescription
  1928. );
  1929. VIDEOPORT_API
  1930. VOID
  1931. VideoPortPutDmaAdapter(
  1932. IN PVOID HwDeviceExtension,
  1933. IN PVP_DMA_ADAPTER VpDmaAdapter
  1934. );
  1935. VIDEOPORT_API
  1936. PVOID
  1937. VideoPortAllocateCommonBuffer(
  1938. IN PVOID HwDeviceExtension,
  1939. IN PVP_DMA_ADAPTER VpDmaAdapter,
  1940. IN ULONG DesiredLength,
  1941. OUT PPHYSICAL_ADDRESS LogicalAddress,
  1942. IN BOOLEAN CacheEnabled,
  1943. OUT PVOID Reserved
  1944. );
  1945. VIDEOPORT_API
  1946. VOID
  1947. VideoPortReleaseCommonBuffer(
  1948. IN PVOID HwDeviceExtension,
  1949. IN PVP_DMA_ADAPTER VpDmaAdapter,
  1950. IN ULONG Length,
  1951. IN PHYSICAL_ADDRESS LogicalAddress,
  1952. IN PVOID VirtualAddress,
  1953. IN BOOLEAN CacheEnabled
  1954. );
  1955. VIDEOPORT_API
  1956. PVOID
  1957. VideoPortLockBuffer(
  1958. IN PVOID HwDeviceExtension,
  1959. IN PVOID BaseAddress,
  1960. IN ULONG Length,
  1961. IN VP_LOCK_OPERATION Operation
  1962. );
  1963. VIDEOPORT_API
  1964. VOID
  1965. VideoPortUnlockBuffer(
  1966. IN PVOID HwDeviceExtension,
  1967. IN PVOID Mdl
  1968. );
  1969. VIDEOPORT_API
  1970. VP_STATUS
  1971. VideoPortStartDma(
  1972. IN PVOID HwDeviceExtension,
  1973. IN PVP_DMA_ADAPTER VpDmaAdapter,
  1974. IN PVOID Mdl,
  1975. IN ULONG Offset,
  1976. IN OUT PULONG pLength,
  1977. IN PEXECUTE_DMA ExecuteDmaRoutine,
  1978. IN PVOID Context,
  1979. IN BOOLEAN WriteToDevice
  1980. );
  1981. VIDEOPORT_API
  1982. VP_STATUS
  1983. VideoPortCompleteDma(
  1984. IN PVOID HwDeviceExtension,
  1985. IN PVP_DMA_ADAPTER VpDmaAdapter,
  1986. IN PVP_SCATTER_GATHER_LIST VpScatterGather,
  1987. IN BOOLEAN WriteToDevice
  1988. );
  1989. VIDEOPORT_API
  1990. VP_STATUS
  1991. VideoPortCreateEvent(
  1992. IN PVOID HwDeviceExtension,
  1993. IN ULONG EventFlag,
  1994. IN PVOID Unused,
  1995. OUT PEVENT *ppEvent
  1996. );
  1997. VIDEOPORT_API
  1998. VP_STATUS
  1999. VideoPortDeleteEvent(
  2000. IN PVOID HwDeviceExtension,
  2001. IN PEVENT pEvent
  2002. );
  2003. VIDEOPORT_API
  2004. LONG
  2005. VideoPortSetEvent(
  2006. IN PVOID HwDeviceExtension,
  2007. IN PEVENT pEvent
  2008. );
  2009. VIDEOPORT_API
  2010. VOID
  2011. VideoPortClearEvent(
  2012. IN PVOID HwDeviceExtension,
  2013. IN PEVENT pEvent
  2014. );
  2015. VIDEOPORT_API
  2016. LONG
  2017. VideoPortReadStateEvent(
  2018. IN PVOID HwDeviceExtension,
  2019. IN PEVENT pEvent
  2020. );
  2021. VIDEOPORT_API
  2022. VP_STATUS
  2023. VideoPortWaitForSingleObject(
  2024. IN PVOID HwDeviceExtension,
  2025. IN PVOID Object,
  2026. IN PLARGE_INTEGER Timeout
  2027. );
  2028. VIDEOPORT_API
  2029. PVOID
  2030. VideoPortAllocatePool(
  2031. IN PVOID HwDeviceExtension,
  2032. IN VP_POOL_TYPE PoolType,
  2033. IN SIZE_T NumberOfBytes,
  2034. IN ULONG Tag
  2035. );
  2036. VIDEOPORT_API
  2037. VOID
  2038. VideoPortFreePool(
  2039. IN PVOID HwDeviceExtension,
  2040. IN PVOID Ptr
  2041. );
  2042. VIDEOPORT_API
  2043. VP_STATUS
  2044. VideoPortCreateSpinLock(
  2045. IN PVOID HwDeviceExtension,
  2046. OUT PSPIN_LOCK *SpinLock
  2047. );
  2048. VIDEOPORT_API
  2049. VP_STATUS
  2050. VideoPortDeleteSpinLock(
  2051. IN PVOID HwDeviceExtension,
  2052. IN PSPIN_LOCK SpinLock
  2053. );
  2054. VIDEOPORT_API
  2055. VOID
  2056. VideoPortAcquireSpinLock(
  2057. IN PVOID HwDeviceExtension,
  2058. IN PSPIN_LOCK SpinLock,
  2059. OUT PUCHAR OldIrql
  2060. );
  2061. VIDEOPORT_API
  2062. VOID
  2063. VideoPortAcquireSpinLockAtDpcLevel(
  2064. IN PVOID HwDeviceExtension,
  2065. IN PSPIN_LOCK SpinLock
  2066. );
  2067. VIDEOPORT_API
  2068. VOID
  2069. VideoPortReleaseSpinLock(
  2070. IN PVOID HwDeviceExtension,
  2071. IN PSPIN_LOCK SpinLock,
  2072. IN UCHAR NewIrql
  2073. );
  2074. VIDEOPORT_API
  2075. VOID
  2076. VideoPortReleaseSpinLockFromDpcLevel(
  2077. IN PVOID HwDeviceExtension,
  2078. IN PSPIN_LOCK SpinLock
  2079. );
  2080. VIDEOPORT_API
  2081. VOID
  2082. VideoPortQuerySystemTime(
  2083. OUT PLARGE_INTEGER CurrentTime
  2084. );
  2085. #define CDE_USE_SUBSYSTEM_IDS 0x00000001
  2086. #define CDE_USE_REVISION 0x00000002
  2087. VIDEOPORT_API
  2088. BOOLEAN
  2089. VideoPortCheckForDeviceExistence(
  2090. IN PVOID HwDeviceExtension,
  2091. IN USHORT VendorId,
  2092. IN USHORT DeviceId,
  2093. IN UCHAR RevisionId,
  2094. IN USHORT SubVendorId,
  2095. IN USHORT SubSystemId,
  2096. IN ULONG Flags
  2097. );
  2098. VIDEOPORT_API
  2099. ULONG
  2100. VideoPortGetAssociatedDeviceID(
  2101. IN PVOID DeviceObject
  2102. );
  2103. VIDEOPORT_API
  2104. VP_STATUS
  2105. VideoPortFlushRegistry(
  2106. PVOID HwDeviceExtension
  2107. );
  2108. VIDEOPORT_API
  2109. VP_STATUS
  2110. VideoPortGetVersion(
  2111. IN PVOID HwDeviceExtension,
  2112. IN OUT PVPOSVERSIONINFO pVpOsVersionInfo
  2113. );
  2114. VIDEOPORT_API
  2115. BOOLEAN
  2116. VideoPortIsNoVesa(
  2117. VOID
  2118. );
  2119. //
  2120. // TODO: End of move block.
  2121. //
  2122. //
  2123. // Support for bugcheck reason callbacks
  2124. //
  2125. #define BUGCHECK_DATA_SIZE_RESERVED 48
  2126. typedef
  2127. VOID
  2128. (*PVIDEO_BUGCHECK_CALLBACK) (
  2129. IN PVOID HwDeviceExtension,
  2130. IN ULONG BugcheckCode,
  2131. IN PUCHAR Buffer,
  2132. IN ULONG BufferSize
  2133. );
  2134. VIDEOPORT_API
  2135. VP_STATUS
  2136. VideoPortRegisterBugcheckCallback(
  2137. IN PVOID HwDeviceExtension,
  2138. IN ULONG BugcheckCode,
  2139. IN PVIDEO_BUGCHECK_CALLBACK Callback,
  2140. IN ULONG BugcheckDataSize
  2141. );
  2142. #endif // ifndef __VIDEO_H__