Source code of Windows XP (NT5)
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.

2268 lines
46 KiB

  1. /*++
  2. Copyright (c) 1991-2000 Microsoft Corporation
  3. Module Name:
  4. videoprt.h
  5. Abstract:
  6. This module contains the structure definitions private to the video port
  7. driver.
  8. Author:
  9. Andre Vachon (andreva) 02-Dec-1991
  10. Notes:
  11. Revision History:
  12. --*/
  13. #ifndef __VIDEOPRT_H__
  14. #define __VIDEOPRT_H__
  15. #define _NTDRIVER_
  16. #ifndef FAR
  17. #define FAR
  18. #endif
  19. #define _NTOSDEF_
  20. #define INITGUID
  21. #include "dderror.h"
  22. #include "ntosp.h"
  23. #include "wdmguid.h"
  24. #include "stdarg.h"
  25. #include "stdio.h"
  26. #include "zwapi.h"
  27. #include "ntiologc.h"
  28. #include "ntddvdeo.h"
  29. #include "video.h"
  30. #include "ntagp.h"
  31. #include "acpiioct.h"
  32. #include "agp.h"
  33. #include "inbv.h"
  34. #include "ntrtl.h"
  35. #include "ntiodump.h"
  36. //
  37. // Forward declare some basic driver objects.
  38. //
  39. typedef struct _FDO_EXTENSION *PFDO_EXTENSION;
  40. typedef struct _CHILD_PDO_EXTENSION *PCHILD_PDO_EXTENSION;
  41. //
  42. // Debugging Macro
  43. //
  44. //
  45. // When an IO routine is called, we want to make sure the miniport
  46. // in question has reported its IO ports.
  47. // VPResourceReported is TRUE when a miniport has called VideoPort-
  48. // VerifyAccessRanges.
  49. // It is set to FALSE as a default, and set back to FALSE when finishing
  50. // an iteration in the loop of VideoPortInitialize (which will reset
  51. // the default when we exit the loop also).
  52. //
  53. // This flag will also be set to TRUE by the VREATE entry point so that
  54. // the IO functions always work after init.
  55. //
  56. #if DBG
  57. #undef VideoDebugPrint
  58. #define pVideoDebugPrint(arg) VideoPortDebugPrint arg
  59. #else
  60. #define pVideoDebugPrint(arg)
  61. #endif
  62. //
  63. // Useful registry buffer length.
  64. //
  65. #define STRING_LENGTH 60
  66. //
  67. // Queue link for mapped addresses stored for unmapping
  68. //
  69. typedef struct _MAPPED_ADDRESS {
  70. struct _MAPPED_ADDRESS *NextMappedAddress;
  71. PVOID MappedAddress;
  72. PHYSICAL_ADDRESS PhysicalAddress;
  73. ULONG NumberOfUchars;
  74. ULONG RefCount;
  75. UCHAR InIoSpace;
  76. BOOLEAN bNeedsUnmapping;
  77. BOOLEAN bLargePageRequest;
  78. } MAPPED_ADDRESS, *PMAPPED_ADDRESS;
  79. //
  80. // BusDataRegistry variables
  81. //
  82. typedef struct _VP_QUERY_DEVICE {
  83. PVOID MiniportHwDeviceExtension;
  84. PVOID CallbackRoutine;
  85. PVOID MiniportContext;
  86. VP_STATUS MiniportStatus;
  87. ULONG DeviceDataType;
  88. } VP_QUERY_DEVICE, *PVP_QUERY_DEVICE;
  89. typedef struct _BUGCHECK_DATA
  90. {
  91. ULONG ulBugCheckCode;
  92. ULONG_PTR ulpBugCheckParameter1;
  93. ULONG_PTR ulpBugCheckParameter2;
  94. ULONG_PTR ulpBugCheckParameter3;
  95. ULONG_PTR ulpBugCheckParameter4;
  96. } BUGCHECK_DATA, *PBUGCHECK_DATA;
  97. //
  98. // Definition of the data passed in for the VideoPortGetRegistryParameters
  99. // function for the DeviceDataType.
  100. //
  101. #define VP_GET_REGISTRY_DATA 0
  102. #define VP_GET_REGISTRY_FILE 1
  103. //
  104. // Int10 Transfer Area
  105. //
  106. #define VDM_TRANSFER_SEGMENT 0x2000
  107. #define VDM_TRANSFER_OFFSET 0x0000
  108. #define VDM_TRANSFER_LENGTH 0x1000
  109. //
  110. // the Extended BIOS data location
  111. //
  112. #define EXTENDED_BIOS_INFO_LOCATION 0x740
  113. //
  114. // Possible values for the InterruptFlags field in the DeviceExtension
  115. //
  116. #define VP_ERROR_LOGGED 0x01
  117. //
  118. // Port driver error logging
  119. //
  120. typedef struct _VP_ERROR_LOG_ENTRY {
  121. PVOID DeviceExtension;
  122. ULONG IoControlCode;
  123. VP_STATUS ErrorCode;
  124. ULONG UniqueId;
  125. } VP_ERROR_LOG_ENTRY, *PVP_ERROR_LOG_ENTRY;
  126. typedef struct _VIDEO_PORT_DRIVER_EXTENSION {
  127. UNICODE_STRING RegistryPath;
  128. VIDEO_HW_INITIALIZATION_DATA HwInitData;
  129. } VIDEO_PORT_DRIVER_EXTENSION, *PVIDEO_PORT_DRIVER_EXTENSION;
  130. //
  131. // PnP Detection flags
  132. //
  133. #define PNP_ENABLED 0x001
  134. #define LEGACY_DETECT 0x002
  135. #define VGA_DRIVER 0x004
  136. #define LEGACY_DRIVER 0x008
  137. #define BOOT_DRIVER 0x010
  138. #define REPORT_DEVICE 0x020
  139. #define UPGRADE_FAIL_START 0x040
  140. #define FINDADAPTER_SUCCEEDED 0x080
  141. #define UPGRADE_FAIL_HWINIT 0x100
  142. #define VGA_DETECT 0x200
  143. //
  144. // Setup flags
  145. //
  146. #define SETUPTYPE_NONE 0
  147. #define SETUPTYPE_FULL 1
  148. #define SETUPTYPE_MINI 2
  149. #define SETUPTYPE_UPGRADE 4
  150. //
  151. // ResetHW Structure
  152. //
  153. typedef struct _VP_RESET_HW {
  154. PVIDEO_HW_RESET_HW ResetFunction;
  155. PVOID HwDeviceExtension;
  156. } VP_RESET_HW, *PVP_RESET_HW;
  157. //
  158. // Videoprt allocation and DEVICE_EXTENSION header tag.
  159. //
  160. #define VP_TAG 0x74725076 // 'vPrt'
  161. //
  162. // Private EVENT support for miniport.
  163. //
  164. //
  165. // This flag indicates that the enveloping VIDEO_PORT_EVENT has a PKEVENT
  166. // field filled in by ObReferenceObjectByHandle(). It cannot be waited on
  167. // at all. Must be consistent with that in pw32kevt.h in gre.
  168. //
  169. #define ENG_EVENT_FLAG_IS_MAPPED_USER 0x1
  170. //
  171. // This flag indicates that the enveloping VIDEO_PORT_EVENT is about to be
  172. // deleted and that the display driver callback is ongoing. Must be consistent
  173. // with that in pw32kevt.h in gre.
  174. //
  175. #define ENG_EVENT_FLAG_IS_INVALID 0x2
  176. //
  177. // NOTE: PVIDEO_PORT_EVENT is a private structure. It must be the same as
  178. // ENG_EVENT in pw32kevt.h for ENG/GDI.
  179. //
  180. typedef struct _VIDEO_PORT_EVENT {
  181. PVOID pKEvent;
  182. ULONG fFlags;
  183. } VIDEO_PORT_EVENT, *PVIDEO_PORT_EVENT;
  184. typedef struct _VIDEO_PORT_SPIN_LOCK {
  185. KSPIN_LOCK Lock;
  186. } VIDEO_PORT_SPIN_LOCK, *PVIDEO_PORT_SPIN_LOCK;
  187. typedef struct _VIDEO_ACPI_EVENT_CONTEXT {
  188. WORK_QUEUE_ITEM workItem;
  189. struct _DEVICE_SPECIFIC_EXTENSION *DoSpecificExtension;
  190. ULONG EventID;
  191. } VIDEO_ACPI_EVENT_CONTEXT, *PVIDEO_ACPI_EVENT_CONTEXT;
  192. //
  193. // The following takes the place of the EDID in the old DEVICE_EXTENSTION. this type
  194. // is private to the video port child enumeration code.
  195. //
  196. #define NO_EDID 0
  197. #define GOOD_EDID 1
  198. #define BAD_EDID 2
  199. #define EDID_BUFFER_SIZE 256
  200. #define NONEDID_SIGNATURE 0x95C3DA76
  201. #define ACPIDDC_EXIST 0x01
  202. #define ACPIDDC_TESTED 0x02
  203. typedef struct __VIDEO_CHILD_DESCRIPTOR {
  204. VIDEO_CHILD_TYPE Type;
  205. ULONG UId;
  206. BOOLEAN bACPIDevice;
  207. UCHAR ACPIDDCFlag;
  208. BOOLEAN ValidEDID;
  209. BOOLEAN bInvalidate;
  210. UCHAR Buffer[EDID_BUFFER_SIZE];
  211. } VIDEO_CHILD_DESCRIPTOR, *PVIDEO_CHILD_DESCRIPTOR;
  212. typedef struct __VP_DMA_ADAPTER {
  213. struct __VP_DMA_ADAPTER *NextVpDmaAdapter;
  214. PDMA_ADAPTER DmaAdapterObject;
  215. ULONG NumberOfMapRegisters;
  216. } VP_DMA_ADAPTER, *PVP_DMA_ADAPTER;
  217. typedef enum _HW_INIT_STATUS
  218. {
  219. HwInitNotCalled, // HwInitialize has not yet been called
  220. HwInitSucceeded, // HwInitialize has been called and succeeded
  221. HwInitFailed // HwInitialize has been called and failed
  222. } HW_INIT_STATUS, *PHW_INIT_STATUS;
  223. typedef enum _EXTENSION_TYPE
  224. {
  225. TypeFdoExtension,
  226. TypePdoExtension,
  227. TypeDeviceSpecificExtension
  228. } EXTENSION_TYPE, *PEXTENSION_TYPE;
  229. #define GET_DSP_EXT(p) ((((PDEVICE_SPECIFIC_EXTENSION)(p)) - 1))
  230. #define GET_FDO_EXT(p) ((((PDEVICE_SPECIFIC_EXTENSION)(p)) - 1)->pFdoExtension)
  231. //
  232. // Define HW_DEVICE_EXTENSION verification macro.
  233. //
  234. #define IS_HW_DEVICE_EXTENSION(p) (((p) != NULL) && (GET_FDO_EXT(p)->HwDeviceExtension == (p)))
  235. #define IS_PDO(p) (((p) != NULL) && \
  236. (((PCHILD_PDO_EXTENSION)(p))->Signature == VP_TAG) && \
  237. (((PCHILD_PDO_EXTENSION)(p))->ExtensionType == TypePdoExtension))
  238. #define IS_FDO(p) (((p) != NULL) && \
  239. (((PFDO_EXTENSION)(p))->Signature == VP_TAG) && \
  240. (((PFDO_EXTENSION)(p))->ExtensionType == TypeFdoExtension))
  241. typedef struct _ALLOC_ENTRY {
  242. PVOID Address;
  243. ULONG Size;
  244. struct _ALLOC_ENTRY *Next;
  245. } *PALLOC_ENTRY, ALLOC_ENTRY;
  246. //
  247. // Device Object Specific Extension
  248. //
  249. // This is data that is allocated for each device object. It contains
  250. // a pointer back to the primary FDO_EXTENSION for the hardware device.
  251. //
  252. #ifdef IOCTL_VIDEO_USE_DEVICE_IN_SESSION
  253. #define VIDEO_DEVICE_INVALID_SESSION -1
  254. #endif IOCTL_VIDEO_USE_DEVICE_IN_SESSION
  255. typedef struct _DEVICE_SPECIFIC_EXTENSION {
  256. //
  257. // VideoPort signature.
  258. //
  259. ULONG Signature;
  260. //
  261. // Indicates the type of the device extension.
  262. //
  263. EXTENSION_TYPE ExtensionType;
  264. //
  265. // Pointer to the hardware specific device extension.
  266. //
  267. PFDO_EXTENSION pFdoExtension;
  268. //
  269. // Location of the miniport device extension.
  270. //
  271. PVOID HwDeviceExtension;
  272. //
  273. // Pointer to the path name indicating the path to the drivers node in
  274. // the registry's current control set
  275. //
  276. PWSTR DriverRegistryPath;
  277. ULONG DriverRegistryPathLength;
  278. //
  279. // Callout support - Physdisp of the device in GDI
  280. //
  281. PVOID PhysDisp;
  282. BOOLEAN bACPI;
  283. ULONG CachedEventID;
  284. ULONG AcpiVideoEventsOutstanding;
  285. //
  286. // Number used to create device object name. (ie. Device\VideoX)
  287. //
  288. ULONG DeviceNumber;
  289. //
  290. // Track whether the device has been opened.
  291. //
  292. BOOLEAN DeviceOpened;
  293. //
  294. // Flags for DualView
  295. //
  296. ULONG DualviewFlags;
  297. //
  298. // Old & New device registry paths
  299. //
  300. PWSTR DriverNewRegistryPath;
  301. ULONG DriverNewRegistryPathLength;
  302. PWSTR DriverOldRegistryPath;
  303. ULONG DriverOldRegistryPathLength;
  304. #ifdef IOCTL_VIDEO_USE_DEVICE_IN_SESSION
  305. //
  306. // Session the device is currently enabled in
  307. //
  308. ULONG SessionId;
  309. #endif IOCTL_VIDEO_USE_DEVICE_IN_SESSION
  310. } DEVICE_SPECIFIC_EXTENSION, *PDEVICE_SPECIFIC_EXTENSION;
  311. //
  312. // Device Extension for the PHYSICAL Driver Object (PDO)
  313. //
  314. typedef struct _CHILD_PDO_EXTENSION {
  315. //
  316. // VideoPort signature.
  317. //
  318. ULONG Signature;
  319. //
  320. // Indicates the type of the device extension.
  321. //
  322. EXTENSION_TYPE ExtensionType;
  323. //
  324. // Pointer to the FDO extension.
  325. // It can also be used to determine if this is the PDO or FDO.
  326. //
  327. PFDO_EXTENSION pFdoExtension;
  328. //
  329. // Location of the miniport device extension.
  330. //
  331. PVOID HwDeviceExtension;
  332. //
  333. // This is only valid because ALL requests are processed synchronously.
  334. // NOTE: this must be consistent with DEVICE_EXTENSIONs.
  335. //
  336. KPROCESSOR_MODE CurrentIrpRequestorMode;
  337. //
  338. // Saved Power state to detect transitions.
  339. //
  340. DEVICE_POWER_STATE DevicePowerState;
  341. //
  342. // Power management mappings.
  343. //
  344. DEVICE_POWER_STATE DeviceMapping[PowerSystemMaximum] ;
  345. BOOLEAN IsMappingReady ;
  346. //
  347. // Event object for pVideoPortDispatch synchronization.
  348. //
  349. KMUTEX SyncMutex;
  350. IO_REMOVE_LOCK RemoveLock;
  351. ////////////////////////////////////////////////////////////////////////////
  352. //
  353. // END common header.
  354. //
  355. ////////////////////////////////////////////////////////////////////////////
  356. //
  357. // Non-paged copy of the UId in the VideoChildDescriptor, so we can do
  358. // power management at raise IRQL.
  359. //
  360. ULONG ChildUId;
  361. //
  362. // Device descriptor (EDID for monitors,etc).
  363. //
  364. PVIDEO_CHILD_DESCRIPTOR VideoChildDescriptor;
  365. //
  366. // Child PDO we created
  367. //
  368. PDEVICE_OBJECT ChildDeviceObject;
  369. //
  370. // Child FDO
  371. //
  372. PDEVICE_OBJECT ChildFdo;
  373. //
  374. // PDEVICE_OBJECT link pointer for enumeration.
  375. //
  376. struct _CHILD_PDO_EXTENSION* NextChild;
  377. //
  378. // BOOLEAN to indicate if this child device has been found
  379. // in the last enumeration.
  380. //
  381. BOOLEAN bIsEnumerated;
  382. //
  383. // Is this a lid override case. If this variable is set to TRUE,
  384. // don't bring the panel out of D3.
  385. //
  386. BOOLEAN PowerOverride;
  387. } CHILD_PDO_EXTENSION;
  388. //
  389. // Device Extension for the FUNCTIONAL Driver Object (FDO)
  390. //
  391. typedef struct _FDO_EXTENSION {
  392. //
  393. // VideoPort signature.
  394. //
  395. ULONG Signature;
  396. //
  397. // Indicates the type of the device extension.
  398. //
  399. EXTENSION_TYPE ExtensionType;
  400. //
  401. // Pointer to the FDO extension.
  402. // It can also be used to determine if this is the PDO or FDO.
  403. //
  404. PFDO_EXTENSION pFdoExtension;
  405. //
  406. // Location of the miniport device extension.
  407. //
  408. PVOID HwDeviceExtension;
  409. //
  410. // RequestorMode of the Currently processed IRP.
  411. // This is only valid because ALL requests are processed synchronously.
  412. // NOTE: this must be consistent with CHILD_PDO_EXTENSIONs.
  413. //
  414. KPROCESSOR_MODE CurrentIrpRequestorMode;
  415. //
  416. // Saved Power state to detect transitions.
  417. //
  418. DEVICE_POWER_STATE DevicePowerState;
  419. //
  420. // Power management mappings.
  421. //
  422. DEVICE_POWER_STATE DeviceMapping[PowerSystemMaximum] ;
  423. BOOLEAN IsMappingReady ;
  424. //
  425. // Monitor power override. If TRUE, always set monitors to D3.
  426. //
  427. BOOLEAN OverrideMonitorPower;
  428. //
  429. // Event object for pVideoPortDispatch synchronization.
  430. //
  431. KMUTEX SyncMutex;
  432. IO_REMOVE_LOCK RemoveLock;
  433. ////////////////////////////////////////////////////////////////////////////
  434. //
  435. // END common header.
  436. //
  437. ////////////////////////////////////////////////////////////////////////////
  438. //
  439. // Adapter device objects
  440. //
  441. PDEVICE_OBJECT FunctionalDeviceObject;
  442. PDEVICE_OBJECT PhysicalDeviceObject;
  443. PDEVICE_OBJECT AttachedDeviceObject;
  444. //
  445. // Point to the next FdoExtension
  446. //
  447. PFDO_EXTENSION NextFdoExtension;
  448. //
  449. // Pointer to the first Child PDO
  450. //
  451. ULONG ChildPdoNumber;
  452. PCHILD_PDO_EXTENSION ChildPdoList;
  453. //
  454. // Pointer to the miniport config info so that the port driver
  455. // can modify it when the miniport is asking for configuration information.
  456. //
  457. PVIDEO_PORT_CONFIG_INFO MiniportConfigInfo;
  458. //
  459. // Miniport exports
  460. //
  461. PVIDEO_HW_FIND_ADAPTER HwFindAdapter;
  462. PVIDEO_HW_INITIALIZE HwInitialize;
  463. PVIDEO_HW_INTERRUPT HwInterrupt;
  464. PVIDEO_HW_START_IO HwStartIO;
  465. PVIDEO_HW_TIMER HwTimer;
  466. PVIDEO_HW_POWER_SET HwSetPowerState;
  467. PVIDEO_HW_POWER_GET HwGetPowerState;
  468. PVIDEO_HW_START_DMA HwStartDma;
  469. PVIDEO_HW_GET_CHILD_DESCRIPTOR HwGetVideoChildDescriptor;
  470. PVIDEO_HW_QUERY_INTERFACE HwQueryInterface;
  471. PVIDEO_HW_CHILD_CALLBACK HwChildCallback;
  472. //
  473. // Legacy resources used by the driver and reported to Plug and Play
  474. // via FILTER_RESOURCE_REQUIREMENTS.
  475. //
  476. PVIDEO_ACCESS_RANGE HwLegacyResourceList;
  477. ULONG HwLegacyResourceCount;
  478. //
  479. // Linked list of all memory mapped io space (done through MmMapIoSpace)
  480. // requested by the miniport driver.
  481. // This list is kept so we can free up those ressources if the driver
  482. // fails to load or if it is unloaded at a later time.
  483. //
  484. PMAPPED_ADDRESS MappedAddressList;
  485. //
  486. // Interrupt object
  487. //
  488. PKINTERRUPT InterruptObject;
  489. //
  490. // Interrupt vector, irql and mode
  491. //
  492. ULONG InterruptVector;
  493. KIRQL InterruptIrql;
  494. KAFFINITY InterruptAffinity;
  495. KINTERRUPT_MODE InterruptMode;
  496. BOOLEAN InterruptsEnabled;
  497. //
  498. // Information about the BUS on which the adapteris located
  499. //
  500. INTERFACE_TYPE AdapterInterfaceType;
  501. ULONG SystemIoBusNumber;
  502. //
  503. // DPC used to log errors.
  504. //
  505. KDPC ErrorLogDpc;
  506. //
  507. // Stores the size and pointer to the EmulatorAccessEntries. These are
  508. // kept since they will be accessed later on when the Emulation must be
  509. // enabled.
  510. //
  511. ULONG NumEmulatorAccessEntries;
  512. PEMULATOR_ACCESS_ENTRY EmulatorAccessEntries;
  513. ULONG_PTR EmulatorAccessEntriesContext;
  514. //
  515. // Size of the miniport device extensions.
  516. //
  517. ULONG HwDeviceExtensionSize;
  518. //
  519. // Determines the size required to save the video hardware state
  520. //
  521. ULONG HardwareStateSize;
  522. //
  523. // Total memory usage of PTEs by a miniport driver.
  524. // This is used to track if the miniport is mapping too much memory
  525. //
  526. ULONG MemoryPTEUsage;
  527. //
  528. // Has the drivers HwInitialize routine been called.
  529. //
  530. HW_INIT_STATUS HwInitStatus;
  531. //
  532. // State set during an Interrupt that must be dealt with afterwards
  533. //
  534. ULONG InterruptFlags;
  535. //
  536. // LogEntry Packet so the information can be save when called from within
  537. // an interrupt.
  538. //
  539. VP_ERROR_LOG_ENTRY ErrorLogEntry;
  540. //
  541. // VDM and int10 support
  542. //
  543. PHYSICAL_ADDRESS VdmPhysicalVideoMemoryAddress;
  544. ULONG VdmPhysicalVideoMemoryLength;
  545. PEPROCESS VdmProcess;
  546. ////////////////////////////////////////////////////////////////////////////
  547. //
  548. // DMA support.
  549. //
  550. ////////////////////////////////////////////////////////////////////////////
  551. PVP_DMA_ADAPTER VpDmaAdapterHead;
  552. //
  553. // Adapter object returned by IoGetDmaAdapter. This is for old DMA stuff
  554. //
  555. PDMA_ADAPTER DmaAdapterObject;
  556. //
  557. // DPC Support
  558. //
  559. KDPC Dpc;
  560. ////////////////////////////////////////////////////////////////////////////
  561. //
  562. // Plug and Play Support
  563. //
  564. ////////////////////////////////////////////////////////////////////////////
  565. PCM_RESOURCE_LIST ResourceList;
  566. PCM_RESOURCE_LIST AllocatedResources; // bus driver list
  567. PCM_RESOURCE_LIST RawResources; // complete list
  568. PCM_RESOURCE_LIST TranslatedResources; // translated complete list
  569. //
  570. // Slot/Function number where the device is located
  571. //
  572. ULONG SlotNumber;
  573. //
  574. // Indicates whether we can enumerate children right away, or if
  575. // we need to wait for HwInitialize to be called first.
  576. //
  577. BOOLEAN AllowEarlyEnumeration;
  578. //
  579. // Interface for communication with our bus driver.
  580. //
  581. BOOLEAN ValidBusInterface;
  582. BUS_INTERFACE_STANDARD BusInterface;
  583. //
  584. // Cache away a pointer to our driver object.
  585. //
  586. PDRIVER_OBJECT DriverObject;
  587. //
  588. // Flags that indicate type of driver (VGA, PNP, etc)
  589. //
  590. ULONG Flags;
  591. //
  592. // ROM Support
  593. //
  594. PVOID RomImage;
  595. //
  596. // AGP Support
  597. //
  598. AGP_BUS_INTERFACE_STANDARD AgpInterface;
  599. //
  600. // Power management variables related to hardware reset
  601. //
  602. BOOLEAN bGDIResetHardware;
  603. //
  604. // Index to be used for the registry path:
  605. // CCS\Control\Video\[GUID]\000x
  606. // The index is used for dual-view and for legacy drivers
  607. //
  608. ULONG RegistryIndex;
  609. //
  610. // Power management vaiable. If set to TRUE the device must
  611. // stay at D0 all the time during the system Shutdown (S5) and
  612. // Hibernation (S4) requests
  613. //
  614. BOOLEAN OnHibernationPath;
  615. //
  616. // Support for bugcheck reason callbacks
  617. //
  618. PVIDEO_BUGCHECK_CALLBACK BugcheckCallback;
  619. ULONG BugcheckDataSize;
  620. } FDO_EXTENSION, *PFDO_EXTENSION;
  621. #define MAXIMUM_MEM_LIMIT_K 64
  622. //
  623. // AGP Data Structures
  624. //
  625. typedef struct _REGION {
  626. ULONG Length;
  627. ULONG NumWords; // number of USHORTs
  628. USHORT BitField[1];
  629. } REGION, *PREGION;
  630. typedef struct _PHYSICAL_RESERVE_CONTEXT
  631. {
  632. ULONG Pages;
  633. VIDEO_PORT_CACHE_TYPE Caching;
  634. PVOID MapHandle;
  635. PHYSICAL_ADDRESS PhysicalAddress;
  636. PREGION Region;
  637. PREGION MapTable;
  638. } PHYSICAL_RESERVE_CONTEXT, *PPHYSICAL_RESERVE_CONTEXT;
  639. typedef struct _VIRTUAL_RESERVE_CONTEXT
  640. {
  641. HANDLE ProcessHandle;
  642. PEPROCESS Process;
  643. PVOID VirtualAddress;
  644. PPHYSICAL_RESERVE_CONTEXT PhysicalReserveContext;
  645. PREGION Region;
  646. PREGION MapTable;
  647. } VIRTUAL_RESERVE_CONTEXT, *PVIRTUAL_RESERVE_CONTEXT;
  648. typedef struct _DEVICE_ADDRESS DEVICE_ADDRESS, *PDEVICE_ADDRESS;
  649. typedef struct _DEVICE_ADDRESS
  650. {
  651. ULONG BusNumber;
  652. ULONG Slot;
  653. PDEVICE_ADDRESS Next;
  654. };
  655. //
  656. // Support for GetProcAddress
  657. //
  658. typedef struct _PROC_ADDRESS
  659. {
  660. PUCHAR FunctionName;
  661. PVOID FunctionAddress;
  662. } PROC_ADDRESS, *PPROC_ADDRESS;
  663. #define PROC(x) #x, x
  664. //
  665. // Power Request Context Block
  666. //
  667. typedef struct tagPOWER_BLOCK
  668. {
  669. PKEVENT Event;
  670. union {
  671. NTSTATUS Status;
  672. ULONG FinalFlag;
  673. } ;
  674. PIRP Irp ;
  675. } POWER_BLOCK, *PPOWER_BLOCK;
  676. //
  677. // PowerState work item
  678. //
  679. typedef struct _POWER_STATE_WORK_ITEM {
  680. WORK_QUEUE_ITEM WorkItem;
  681. PVOID Argument1;
  682. PVOID Argument2;
  683. } POWER_STATE_WORK_ITEM, *PPOWER_STATE_WORK_ITEM;
  684. //
  685. // Support for backlight control
  686. //
  687. typedef struct _BACKLIGHT_STATUS {
  688. BOOLEAN bNewAPISupported;
  689. BOOLEAN bQuerySupportedBrightnessCalled;
  690. BOOLEAN bACBrightnessKnown;
  691. BOOLEAN bDCBrightnessKnown;
  692. BOOLEAN bACBrightnessInRegistry;
  693. BOOLEAN bDCBrightnessInRegistry;
  694. BOOLEAN bBIOSDefaultACKnown;
  695. BOOLEAN bBIOSDefaultDCKnown;
  696. UCHAR ucACBrightness;
  697. UCHAR ucDCBrightness;
  698. UCHAR ucBIOSDefaultAC;
  699. UCHAR ucBIOSDefaultDC;
  700. UCHAR ucAmbientLightLevel;
  701. } BACKLIGHT_STATUS, *PBACKLIGHT_STATUS;
  702. //
  703. // New registry key
  704. //
  705. #define SZ_GUID L"VideoID"
  706. #define SZ_LEGACY_KEY L"LegacyKey"
  707. #define SZ_VIDEO_DEVICES L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video"
  708. #define SZ_USE_NEW_KEY L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\UseNewKey"
  709. #define SZ_LIDCLOSE L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\GraphicsDrivers\\LidCloseSetPower"
  710. #define SZ_INITIAL_SETTINGS L"Settings"
  711. #define SZ_COMMON_SUBKEY L"Video"
  712. #define SZ_SERVICE L"Service"
  713. //
  714. // Global Data
  715. //
  716. #if DBG
  717. extern CHAR *BusType[];
  718. #endif
  719. extern ULONG VpSetupType;
  720. extern ULONG VpSetupTypeAtBoot;
  721. extern BOOLEAN VPFirstTime;
  722. extern PVIDEO_WIN32K_CALLOUT Win32kCallout;
  723. extern BOOLEAN EnableUSWC;
  724. extern ULONG VideoDebugLevel;
  725. extern ULONG VideoPortMaxDmaSize;
  726. extern ULONG VideoDeviceNumber;
  727. extern ULONG VideoChildDevices;
  728. extern PWSTR VideoClassString;
  729. extern UNICODE_STRING VideoClassName;
  730. extern CONFIGURATION_TYPE VpQueryDeviceControllerType;
  731. extern CONFIGURATION_TYPE VpQueryDevicePeripheralType;
  732. extern ULONG VpQueryDeviceControllerNumber;
  733. extern ULONG VpQueryDevicePeripheralNumber;
  734. extern VP_RESET_HW HwResetHw[];
  735. extern PFDO_EXTENSION FdoList[];
  736. extern PFDO_EXTENSION FdoHead;
  737. extern BOOLEAN VpBaseVideo;
  738. extern PVOID PhysicalMemorySection;
  739. extern PEPROCESS CsrProcess;
  740. extern ULONG VpC0000Compatible;
  741. extern PVOID VgaHwDeviceExtension;
  742. extern PVIDEO_ACCESS_RANGE VgaAccessRanges;
  743. extern ULONG NumVgaAccessRanges;
  744. extern PDEVICE_OBJECT DeviceOwningVga;
  745. extern PROC_ADDRESS VideoPortEntryPoints[];
  746. extern VIDEO_ACCESS_RANGE VgaLegacyResources[];
  747. extern PDEVICE_ADDRESS gDeviceAddressList;
  748. extern ULONGLONG VpSystemMemorySize;
  749. extern PDEVICE_OBJECT LCDPanelDevice;
  750. extern KMUTEX LCDPanelMutex;
  751. extern KMUTEX VpInt10Mutex;
  752. extern PVOID PowerStateCallbackHandle;
  753. extern PVOID DockCallbackHandle;
  754. extern ULONG NumDevicesStarted;
  755. extern BOOLEAN EnableNewRegistryKey;
  756. extern BOOLEAN VpSetupAllowDriversToStart;
  757. extern BOOLEAN VpSystemInitialized;
  758. extern ULONG ServerBiosAddressSpaceInitialized;
  759. extern BOOLEAN Int10BufferAllocated;
  760. extern PKEVENT VpThreadStuckEvent;
  761. extern HANDLE VpThreadStuckEventHandle;
  762. extern PDEVICE_OBJECT VpBugcheckDeviceObject;
  763. extern CONTEXT VpEaRecoveryContext;
  764. extern KBUGCHECK_REASON_CALLBACK_RECORD VpCallbackRecord;
  765. extern PVOID VpBugcheckData;
  766. extern KMUTEX VpGlobalLock;
  767. extern PVOID VpDump;
  768. extern ULONG_PTR KiBugCheckData[5]; // bugcheck data exported from ntoskrnl
  769. // {D00CE1F5-D60C-41c2-AF75-A4370C9976A3}
  770. DEFINE_GUID(VpBugcheckGUID, 0xd00ce1f5, 0xd60c, 0x41c2, 0xaf, 0x75, 0xa4, 0x37, 0xc, 0x99, 0x76, 0xa3);
  771. extern BACKLIGHT_STATUS VpBacklightStatus;
  772. extern BOOLEAN VpRunningOnAC;
  773. extern BOOLEAN VpLidCloseSetPower;
  774. #if defined(_IA64_) || defined(_AMD64_)
  775. PUCHAR BiosTransferArea;
  776. #endif
  777. typedef
  778. BOOLEAN
  779. (*PSYNCHRONIZE_ROUTINE) (
  780. PKINTERRUPT pInterrupt,
  781. PKSYNCHRONIZE_ROUTINE pkSyncronizeRoutine,
  782. PVOID pSynchContext
  783. );
  784. //
  785. // Number of legacy vga resources
  786. //
  787. #define NUM_VGA_LEGACY_RESOURCES 3
  788. #define DMA_OPERATION(a) (VpDmaAdapter->DmaAdapterObject->DmaOperations->a)
  789. //
  790. // These macros are used to protect threads which will enter the
  791. // miniport. We need to guarantee that only one thread enters
  792. // the miniport at a time.
  793. //
  794. #define ACQUIRE_DEVICE_LOCK(DeviceExtension) \
  795. KeWaitForSingleObject(&DeviceExtension->SyncMutex, \
  796. Executive, \
  797. KernelMode, \
  798. FALSE, \
  799. (PTIME)NULL);
  800. #define RELEASE_DEVICE_LOCK(DeviceExtension) \
  801. KeReleaseMutex(&DeviceExtension->SyncMutex, \
  802. FALSE);
  803. //
  804. // Define macros to stall execution for given number of milli or micro seconds.
  805. // Single call to KeStallExecutionProcessor() can be done for 50us max.
  806. //
  807. #define DELAY_MILLISECONDS(n) \
  808. { \
  809. ULONG d_ulCount; \
  810. ULONG d_ulTotal = 20 * (n); \
  811. \
  812. for (d_ulCount = 0; d_ulCount < d_ulTotal; d_ulCount++) \
  813. KeStallExecutionProcessor(50); \
  814. }
  815. #define DELAY_MICROSECONDS(n) \
  816. { \
  817. ULONG d_ulCount = (n); \
  818. \
  819. while (d_ulCount > 0) \
  820. { \
  821. if (d_ulCount >= 50) \
  822. { \
  823. KeStallExecutionProcessor(50); \
  824. d_ulCount -= 50; \
  825. } \
  826. else \
  827. { \
  828. KeStallExecutionProcessor(d_ulCount); \
  829. d_ulCount = 0; \
  830. } \
  831. } \
  832. }
  833. //
  834. // Max size for secondary dump data
  835. //
  836. #define MAX_SECONDARY_DUMP_SIZE (0x1000 - sizeof(DUMP_BLOB_FILE_HEADER) - sizeof(DUMP_BLOB_HEADER))
  837. //
  838. // Private function declarations
  839. //
  840. //
  841. // i386\porti386.c
  842. // mips\portmips.c
  843. // alpha\portalpha.c
  844. VOID
  845. pVideoPortInitializeInt10(
  846. IN PFDO_EXTENSION FdoExtension
  847. );
  848. NTSTATUS
  849. pVideoPortEnableVDM(
  850. IN PFDO_EXTENSION FdoExtension,
  851. IN BOOLEAN Enable,
  852. IN PVIDEO_VDM VdmInfo,
  853. IN ULONG VdmInfoSize
  854. );
  855. NTSTATUS
  856. pVideoPortRegisterVDM(
  857. IN PFDO_EXTENSION FdoExtension,
  858. IN PVIDEO_VDM VdmInfo,
  859. IN ULONG VdmInfoSize,
  860. OUT PVIDEO_REGISTER_VDM RegisterVdm,
  861. IN ULONG RegisterVdmSize,
  862. OUT PULONG_PTR OutputSize
  863. );
  864. NTSTATUS
  865. pVideoPortSetIOPM(
  866. IN ULONG NumAccessRanges,
  867. IN PVIDEO_ACCESS_RANGE AccessRange,
  868. IN BOOLEAN Enable,
  869. IN ULONG IOPMNumber
  870. );
  871. VP_STATUS
  872. pVideoPortGetVDMBiosData(
  873. IN PFDO_EXTENSION FdoExtension,
  874. PCHAR Buffer,
  875. ULONG Length
  876. );
  877. NTSTATUS
  878. pVideoPortPutVDMBiosData(
  879. IN PFDO_EXTENSION FdoExtension,
  880. PCHAR Buffer,
  881. ULONG Length
  882. );
  883. //
  884. // acpi.c
  885. //
  886. NTSTATUS
  887. pVideoPortQueryACPIInterface(
  888. PDEVICE_SPECIFIC_EXTENSION FdoExtension
  889. );
  890. NTSTATUS
  891. pVideoPortDockEventCallback (
  892. PVOID NotificationStructure,
  893. PDEVICE_SPECIFIC_EXTENSION DoSpecificExtension
  894. );
  895. VOID
  896. pVideoPortACPIEventCallback(
  897. PDEVICE_SPECIFIC_EXTENSION pFdoObject,
  898. ULONG eventID
  899. );
  900. VOID
  901. pVideoPortACPIEventHandler(
  902. PVIDEO_ACPI_EVENT_CONTEXT EventContext
  903. );
  904. NTSTATUS
  905. pVideoPortACPIIoctl(
  906. IN PDEVICE_OBJECT DeviceObject,
  907. IN ULONG MethodName,
  908. IN PULONG InputParam1,
  909. IN PULONG InputParam2,
  910. IN ULONG OutputBufferSize,
  911. IN PACPI_EVAL_OUTPUT_BUFFER pOutputBuffer
  912. );
  913. VOID
  914. VpRegisterLCDCallbacks(
  915. );
  916. VOID
  917. VpUnregisterLCDCallbacks(
  918. );
  919. VOID
  920. VpRegisterPowerStateCallback(
  921. VOID
  922. );
  923. VOID
  924. VpPowerStateCallback(
  925. IN PVOID CallbackContext,
  926. IN PVOID Argument1,
  927. IN PVOID Argument2
  928. );
  929. VOID
  930. VpDelayedPowerStateCallback(
  931. IN PVOID Context
  932. );
  933. NTSTATUS
  934. VpSetLCDPowerUsage(
  935. IN PDEVICE_OBJECT DeviceObject,
  936. IN BOOLEAN FullPower
  937. );
  938. NTSTATUS
  939. VpQueryBacklightLevels(
  940. IN PDEVICE_OBJECT DeviceObject,
  941. OUT PUCHAR ucBacklightLevels,
  942. OUT PULONG pulNumberOfLevelsSupported
  943. );
  944. //
  945. // ddc.c
  946. //
  947. BOOLEAN
  948. DDCReadEdidSegment(
  949. IN PVOID pHwDeviceExtension,
  950. IN PVIDEO_I2C_CONTROL pI2CControl,
  951. IN OUT PUCHAR pucEdidBuffer,
  952. IN ULONG ulEdidBufferSize,
  953. IN UCHAR ucEdidSegment,
  954. IN UCHAR ucEdidOffset,
  955. IN UCHAR ucSetOffsetAddress,
  956. IN UCHAR ucReadAddress,
  957. IN BOOLEAN bEnhancedDDC
  958. );
  959. //
  960. // dma.c
  961. //
  962. #if DBG
  963. VOID
  964. pDumpScatterGather(
  965. PVP_SCATTER_GATHER_LIST SGList
  966. );
  967. #define DUMP_SCATTER_GATHER(SGList) pDumpScatterGather(SGList)
  968. #else
  969. #define DUMP_SCATTER_GATHER(SGList)
  970. #endif
  971. PVOID
  972. VideoPortGetCommonBuffer(
  973. IN PVOID HwDeviceExtension,
  974. IN ULONG DesiredLength,
  975. IN ULONG Alignment,
  976. OUT PPHYSICAL_ADDRESS LogicalAddress,
  977. OUT PULONG ActualLength,
  978. IN BOOLEAN CacheEnabled
  979. );
  980. VOID
  981. VideoPortFreeCommonBuffer(
  982. IN PVOID HwDeviceExtension,
  983. IN ULONG Length,
  984. IN PVOID VirtualAddress,
  985. IN PHYSICAL_ADDRESS LogicalAddress,
  986. IN BOOLEAN CacheEnabled
  987. );
  988. PDMA
  989. VideoPortDoDma(
  990. IN PVOID HwDeviceExtension,
  991. IN PDMA pDma,
  992. IN DMA_FLAGS DmaFlags
  993. );
  994. BOOLEAN
  995. VideoPortLockPages(
  996. IN PVOID HwDeviceExtension,
  997. IN OUT PVIDEO_REQUEST_PACKET pVrp,
  998. IN PEVENT pMappedUserEvent,
  999. IN PEVENT pDisplayEvent,
  1000. IN DMA_FLAGS DmaFlags
  1001. );
  1002. BOOLEAN
  1003. VideoPortUnlockPages(
  1004. PVOID HwDeviceExtension,
  1005. PDMA pDma
  1006. );
  1007. PVOID
  1008. VideoPortGetMdl(
  1009. IN PVOID HwDeviceExtension,
  1010. IN PDMA pDma
  1011. );
  1012. VOID
  1013. pVideoPortListControl(
  1014. IN PDEVICE_OBJECT DeviceObject,
  1015. IN PIRP pIrp,
  1016. IN PSCATTER_GATHER_LIST ScatterGather,
  1017. IN PVOID Context
  1018. );
  1019. //
  1020. // edid.c
  1021. //
  1022. BOOLEAN
  1023. pVideoPortIsValidEDID(
  1024. PVOID Edid
  1025. );
  1026. VOID
  1027. pVideoPortGetEDIDId(
  1028. PVOID pEdid,
  1029. PWCHAR pwChar
  1030. );
  1031. PVOID
  1032. pVideoPortGetMonitordescription(
  1033. PVOID pEdid
  1034. );
  1035. ULONG
  1036. pVideoPortGetEdidOemID(
  1037. IN PVOID pEdid,
  1038. OUT PUCHAR pBuffer
  1039. );
  1040. //
  1041. // enum.c
  1042. //
  1043. NTSTATUS
  1044. pVideoPnPCapabilities(
  1045. IN PCHILD_PDO_EXTENSION PdoExtension,
  1046. IN PDEVICE_CAPABILITIES Capabilities
  1047. );
  1048. NTSTATUS
  1049. pVideoPnPResourceRequirements(
  1050. IN PCHILD_PDO_EXTENSION PdoExtension,
  1051. OUT PCM_RESOURCE_LIST * ResourceList
  1052. );
  1053. NTSTATUS
  1054. pVideoPnPQueryId(
  1055. IN PDEVICE_OBJECT DeviceObject,
  1056. IN BUS_QUERY_ID_TYPE BusQueryIdType,
  1057. IN OUT PWSTR * BusQueryId
  1058. );
  1059. NTSTATUS
  1060. VpAddPdo(
  1061. PDEVICE_OBJECT DeviceObject,
  1062. PVIDEO_CHILD_DESCRIPTOR VideoChildDescriptor
  1063. );
  1064. NTSTATUS
  1065. pVideoPortEnumerateChildren(
  1066. PDEVICE_OBJECT DeviceObject,
  1067. PIRP Irp
  1068. );
  1069. NTSTATUS
  1070. pVideoPortQueryDeviceText(
  1071. PDEVICE_OBJECT ChildDevice,
  1072. DEVICE_TEXT_TYPE TextType,
  1073. PWSTR * ReturnValue
  1074. );
  1075. NTSTATUS
  1076. pVideoPortCleanUpChildList(
  1077. PFDO_EXTENSION FdoExtension,
  1078. PDEVICE_OBJECT deviceObject
  1079. );
  1080. //
  1081. // i2c.c
  1082. //
  1083. BOOLEAN
  1084. I2CStart(
  1085. IN PVOID pHwDeviceExtension,
  1086. IN PI2C_CALLBACKS pI2CCallbacks
  1087. );
  1088. BOOLEAN
  1089. I2CStop(
  1090. IN PVOID pHwDeviceExtension,
  1091. IN PI2C_CALLBACKS pI2CCallbacks
  1092. );
  1093. BOOLEAN
  1094. I2CWrite(
  1095. IN PVOID pHwDeviceExtension,
  1096. IN PI2C_CALLBACKS pI2CCallbacks,
  1097. IN PUCHAR pucBuffer,
  1098. IN ULONG ulLength
  1099. );
  1100. BOOLEAN
  1101. I2CRead(
  1102. IN PVOID pHwDeviceExtension,
  1103. IN PI2C_CALLBACKS pI2CCallbacks,
  1104. OUT PUCHAR pucBuffer,
  1105. IN ULONG ulLength
  1106. );
  1107. BOOLEAN
  1108. I2CWriteByte(
  1109. IN PVOID pHwDeviceExtension,
  1110. IN PI2C_CALLBACKS pI2CCallbacks,
  1111. IN UCHAR ucByte
  1112. );
  1113. BOOLEAN
  1114. I2CReadByte(
  1115. IN PVOID pHwDeviceExtension,
  1116. IN PI2C_CALLBACKS pI2CCallbacks,
  1117. OUT PUCHAR pucByte,
  1118. IN BOOLEAN bMore
  1119. );
  1120. BOOLEAN
  1121. I2CWaitForClockLineHigh(
  1122. IN PVOID pHwDeviceExtension,
  1123. IN PI2C_CALLBACKS pI2CCallbacks
  1124. );
  1125. //
  1126. // i2c2.c
  1127. //
  1128. BOOLEAN
  1129. I2CStart2(
  1130. IN PVOID pHwDeviceExtension,
  1131. IN PVIDEO_I2C_CONTROL pI2CControl
  1132. );
  1133. BOOLEAN
  1134. I2CStop2(
  1135. IN PVOID pHwDeviceExtension,
  1136. IN PVIDEO_I2C_CONTROL pI2CControl
  1137. );
  1138. BOOLEAN
  1139. I2CWrite2(
  1140. IN PVOID pHwDeviceExtension,
  1141. IN PVIDEO_I2C_CONTROL pI2CControl,
  1142. IN PUCHAR pucBuffer,
  1143. IN ULONG ulLength
  1144. );
  1145. BOOLEAN
  1146. I2CRead2(
  1147. IN PVOID pHwDeviceExtension,
  1148. IN PVIDEO_I2C_CONTROL pI2CControl,
  1149. OUT PUCHAR pucBuffer,
  1150. IN ULONG ulLength,
  1151. IN BOOLEAN bEndOfRead
  1152. );
  1153. BOOLEAN
  1154. I2CWriteByte2(
  1155. IN PVOID pHwDeviceExtension,
  1156. IN PVIDEO_I2C_CONTROL pI2CControl,
  1157. IN UCHAR ucByte
  1158. );
  1159. BOOLEAN
  1160. I2CReadByte2(
  1161. IN PVOID pHwDeviceExtension,
  1162. IN PVIDEO_I2C_CONTROL pI2CControl,
  1163. OUT PUCHAR pucByte,
  1164. IN BOOLEAN bEndOfRead
  1165. );
  1166. BOOLEAN
  1167. I2CWaitForClockLineHigh2(
  1168. IN PVOID pHwDeviceExtension,
  1169. IN PVIDEO_I2C_CONTROL pI2CControl
  1170. );
  1171. //
  1172. // pnp.c
  1173. //
  1174. NTSTATUS
  1175. pVideoPortSendIrpToLowerDevice(
  1176. IN PDEVICE_OBJECT DeviceObject,
  1177. IN PIRP Irp
  1178. );
  1179. NTSTATUS
  1180. pVideoPortPowerCallDownIrpStack(
  1181. PDEVICE_OBJECT AttachedDeviceObject,
  1182. PIRP Irp
  1183. );
  1184. VOID
  1185. pVideoPortHibernateNotify(
  1186. IN PDEVICE_OBJECT Pdo,
  1187. BOOLEAN IsVideoObject
  1188. );
  1189. NTSTATUS
  1190. pVideoPortPnpDispatch(
  1191. IN PDEVICE_OBJECT DeviceObject,
  1192. IN PIRP Irp
  1193. );
  1194. NTSTATUS
  1195. pVideoPortPowerDispatch(
  1196. IN PDEVICE_OBJECT DeviceObject,
  1197. IN PIRP Irp
  1198. );
  1199. VOID
  1200. pVideoPortPowerIrpComplete(
  1201. IN PDEVICE_OBJECT DeviceObject,
  1202. IN UCHAR MinorFunction,
  1203. IN POWER_STATE PowerState,
  1204. IN PVOID Context,
  1205. IN PIO_STATUS_BLOCK IoStatus
  1206. );
  1207. NTSTATUS
  1208. pVideoPortPowerUpComplete(
  1209. IN PDEVICE_OBJECT DeviceObject,
  1210. IN PIRP Irp,
  1211. IN PVOID Context
  1212. );
  1213. //
  1214. // registry.c
  1215. //
  1216. NTSTATUS
  1217. VpGetFlags(
  1218. IN PUNICODE_STRING RegistryPath,
  1219. PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
  1220. PULONG Flags
  1221. );
  1222. BOOLEAN
  1223. IsMirrorDriver(
  1224. PFDO_EXTENSION FdoExtension
  1225. );
  1226. BOOLEAN
  1227. pOverrideConflict(
  1228. PFDO_EXTENSION FdoExtension,
  1229. BOOLEAN bSetResources
  1230. );
  1231. NTSTATUS
  1232. pVideoPortReportResourceList(
  1233. PDEVICE_SPECIFIC_EXTENSION DoSpecificExtension,
  1234. ULONG NumAccessRanges,
  1235. PVIDEO_ACCESS_RANGE AccessRanges,
  1236. PBOOLEAN Conflict,
  1237. PDEVICE_OBJECT DeviceObject,
  1238. BOOLEAN ClaimUnlistedResources
  1239. );
  1240. VOID
  1241. VpReleaseResources(
  1242. PFDO_EXTENSION FdoExtension
  1243. );
  1244. BOOLEAN
  1245. VpIsDetection(
  1246. PUNICODE_STRING RegistryPath
  1247. );
  1248. NTSTATUS
  1249. VpSetEventCompletion(
  1250. IN PDEVICE_OBJECT DeviceObject,
  1251. IN PIRP Irp,
  1252. IN PKEVENT Event
  1253. );
  1254. VOID
  1255. UpdateRegValue(
  1256. IN PUNICODE_STRING RegistryPath,
  1257. IN PWCHAR RegValue,
  1258. IN ULONG Value
  1259. );
  1260. //
  1261. // videoprt.c
  1262. //
  1263. NTSTATUS
  1264. pVideoPortCreateDeviceName(
  1265. PWSTR DeviceString,
  1266. ULONG DeviceNumber,
  1267. PUNICODE_STRING UnicodeString,
  1268. PWCHAR UnicodeBuffer
  1269. );
  1270. NTSTATUS
  1271. pVideoPortDispatch(
  1272. IN PDEVICE_OBJECT DeviceObject,
  1273. IN PIRP Irp
  1274. );
  1275. NTSTATUS
  1276. pVideoPortSystemControl(
  1277. IN PDEVICE_OBJECT DeviceObject,
  1278. IN PIRP Irp
  1279. );
  1280. PVOID
  1281. pVideoPortFreeDeviceBase(
  1282. IN PVOID HwDeviceExtension,
  1283. IN PVOID MappedAddress
  1284. );
  1285. PVOID
  1286. pVideoPortGetDeviceBase(
  1287. IN PVOID HwDeviceExtension,
  1288. IN PHYSICAL_ADDRESS IoAddress,
  1289. IN ULONG NumberOfUchars,
  1290. IN UCHAR InIoSpace,
  1291. IN BOOLEAN bLargePage
  1292. );
  1293. NTSTATUS
  1294. pVideoPortGetDeviceDataRegistry(
  1295. IN PVOID Context,
  1296. IN PUNICODE_STRING PathName,
  1297. IN INTERFACE_TYPE BusType,
  1298. IN ULONG BusNumber,
  1299. IN PKEY_VALUE_FULL_INFORMATION *BusInformation,
  1300. IN CONFIGURATION_TYPE ControllerType,
  1301. IN ULONG ControllerNumber,
  1302. IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
  1303. IN CONFIGURATION_TYPE PeripheralType,
  1304. IN ULONG PeripheralNumber,
  1305. IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation
  1306. );
  1307. NTSTATUS
  1308. pVideoPortGetRegistryCallback(
  1309. IN PWSTR ValueName,
  1310. IN ULONG ValueType,
  1311. IN PVOID ValueData,
  1312. IN ULONG ValueLength,
  1313. IN PVOID Context,
  1314. IN PVOID EntryContext
  1315. );
  1316. VOID
  1317. pVPInit(
  1318. VOID
  1319. );
  1320. NTSTATUS
  1321. VpInitializeBusCallback(
  1322. IN PVOID Context,
  1323. IN PUNICODE_STRING PathName,
  1324. IN INTERFACE_TYPE BusType,
  1325. IN ULONG BusNumber,
  1326. IN PKEY_VALUE_FULL_INFORMATION *BusInformation,
  1327. IN CONFIGURATION_TYPE ControllerType,
  1328. IN ULONG ControllerNumber,
  1329. IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
  1330. IN CONFIGURATION_TYPE PeripheralType,
  1331. IN ULONG PeripheralNumber,
  1332. IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation
  1333. );
  1334. NTSTATUS
  1335. VpCreateDevice(
  1336. IN PDRIVER_OBJECT DriverObject,
  1337. IN ULONG DeviceExtensionSize,
  1338. OUT PDEVICE_OBJECT *DeviceObject
  1339. );
  1340. ULONG
  1341. VideoPortLegacyFindAdapter(
  1342. IN PDRIVER_OBJECT DriverObject,
  1343. IN PVOID Argument2,
  1344. IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
  1345. IN PVOID HwContext,
  1346. IN ULONG PnpFlags
  1347. );
  1348. NTSTATUS
  1349. VideoPortFindAdapter(
  1350. IN PDRIVER_OBJECT DriverObject,
  1351. IN PVOID Argument2,
  1352. IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
  1353. IN PVOID HwContext,
  1354. PDEVICE_OBJECT DeviceObject,
  1355. PUCHAR nextMiniport
  1356. );
  1357. NTSTATUS
  1358. VideoPortFindAdapter2(
  1359. IN PDRIVER_OBJECT DriverObject,
  1360. IN PVOID Argument2,
  1361. IN PVIDEO_HW_INITIALIZATION_DATA HwInitializationData,
  1362. IN PVOID HwContext,
  1363. PDEVICE_OBJECT DeviceObject,
  1364. PUCHAR nextMiniport
  1365. );
  1366. NTSTATUS
  1367. VpAddDevice(
  1368. IN PDRIVER_OBJECT DriverObject,
  1369. IN PDEVICE_OBJECT PhysicalDeviceObject
  1370. );
  1371. VOID
  1372. VpDriverUnload(
  1373. IN PDRIVER_OBJECT DriverObject
  1374. );
  1375. VP_STATUS
  1376. VpRegistryCallback(
  1377. PVOID HwDeviceExtension,
  1378. PVOID Context,
  1379. PWSTR ValueName,
  1380. PVOID ValueData,
  1381. ULONG ValueLength
  1382. );
  1383. NTSTATUS
  1384. VpGetBusInterface(
  1385. PFDO_EXTENSION FdoExtension
  1386. );
  1387. PVOID
  1388. VpGetProcAddress(
  1389. IN PVOID HwDeviceExtension,
  1390. IN PUCHAR FunctionName
  1391. );
  1392. BOOLEAN
  1393. pVideoPortInterrupt(
  1394. IN PKINTERRUPT Interrupt,
  1395. IN PDEVICE_OBJECT DeviceObject
  1396. );
  1397. BOOLEAN
  1398. pVideoPortLogErrorEntry(
  1399. IN PVOID Context
  1400. );
  1401. VOID
  1402. pVideoPortLogErrorEntryDPC(
  1403. IN PKDPC Dpc,
  1404. IN PVOID DeferredContext,
  1405. IN PVOID SystemArgument1,
  1406. IN PVOID SystemArgument2
  1407. );
  1408. VOID
  1409. pVideoPortMapToNtStatus(
  1410. IN PSTATUS_BLOCK StatusBlock
  1411. );
  1412. NTSTATUS
  1413. pVideoPortMapUserPhysicalMem(
  1414. IN PFDO_EXTENSION FdoExtension,
  1415. IN HANDLE ProcessHandle OPTIONAL,
  1416. IN PHYSICAL_ADDRESS PhysicalAddress,
  1417. IN OUT PULONG Length,
  1418. IN OUT PULONG InIoSpace,
  1419. IN OUT PVOID *VirtualAddress
  1420. );
  1421. VOID
  1422. pVideoPortPowerCompletionIoctl(
  1423. IN PDEVICE_OBJECT DeviceObject,
  1424. IN UCHAR MinorFunction,
  1425. IN POWER_STATE PowerState,
  1426. IN PVOID Context,
  1427. IN PIO_STATUS_BLOCK IoStatus
  1428. );
  1429. BOOLEAN
  1430. pVideoPortSynchronizeExecution(
  1431. PVOID HwDeviceExtension,
  1432. VIDEO_SYNCHRONIZE_PRIORITY Priority,
  1433. PMINIPORT_SYNCHRONIZE_ROUTINE SynchronizeRoutine,
  1434. PVOID Context
  1435. );
  1436. VOID
  1437. pVideoPortHwTimer(
  1438. IN PDEVICE_OBJECT DeviceObject,
  1439. PVOID Context
  1440. );
  1441. BOOLEAN
  1442. pVideoPortResetDisplay(
  1443. IN ULONG Columns,
  1444. IN ULONG Rows
  1445. );
  1446. BOOLEAN
  1447. pVideoPortMapStoD(
  1448. IN PVOID DeviceExtension,
  1449. IN SYSTEM_POWER_STATE SystemState,
  1450. OUT PDEVICE_POWER_STATE DeviceState
  1451. );
  1452. //
  1453. // agp.c
  1454. //
  1455. BOOLEAN
  1456. VpQueryAgpInterface(
  1457. PFDO_EXTENSION DeviceExtension,
  1458. IN USHORT Version
  1459. );
  1460. PHYSICAL_ADDRESS
  1461. AgpReservePhysical(
  1462. IN PVOID Context,
  1463. IN ULONG Pages,
  1464. IN VIDEO_PORT_CACHE_TYPE Caching,
  1465. OUT PVOID *PhysicalReserveContext
  1466. );
  1467. VOID
  1468. AgpReleasePhysical(
  1469. PVOID Context,
  1470. PVOID PhysicalReserveContext
  1471. );
  1472. BOOLEAN
  1473. AgpCommitPhysical(
  1474. PVOID Context,
  1475. PVOID PhysicalReserveContext,
  1476. ULONG Pages,
  1477. ULONG Offset
  1478. );
  1479. VOID
  1480. AgpFreePhysical(
  1481. IN PVOID Context,
  1482. IN PVOID PhysicalReserveContext,
  1483. IN ULONG Pages,
  1484. IN ULONG Offset
  1485. );
  1486. PVOID
  1487. AgpReserveVirtual(
  1488. IN PVOID Context,
  1489. IN HANDLE ProcessHandle,
  1490. IN PVOID PhysicalReserveContext,
  1491. OUT PVOID *VirtualReserveContext
  1492. );
  1493. VOID
  1494. AgpReleaseVirtual(
  1495. IN PVOID Context,
  1496. IN PVOID VirtualReserveContext
  1497. );
  1498. PVOID
  1499. AgpCommitVirtual(
  1500. IN PVOID Context,
  1501. IN PVOID VirtualReserveContext,
  1502. IN ULONG Pages,
  1503. IN ULONG Offset
  1504. );
  1505. VOID
  1506. AgpFreeVirtual(
  1507. IN PVOID Context,
  1508. IN PVOID VirtualReserveContext,
  1509. IN ULONG Pages,
  1510. IN ULONG Offset
  1511. );
  1512. BOOLEAN
  1513. AgpSetRate(
  1514. IN PVOID Context,
  1515. IN ULONG AgpRate
  1516. );
  1517. VP_STATUS
  1518. VpGetAgpServices2(
  1519. IN PVOID pHwDeviceExtension,
  1520. OUT PVIDEO_PORT_AGP_INTERFACE_2 pAgpInterface
  1521. );
  1522. //
  1523. // ???
  1524. //
  1525. BOOLEAN
  1526. CreateBitField(
  1527. PREGION *Region,
  1528. ULONG Length
  1529. );
  1530. VOID
  1531. ModifyRegion(
  1532. PREGION Region,
  1533. ULONG Offset,
  1534. ULONG Length,
  1535. BOOLEAN Set
  1536. );
  1537. BOOLEAN
  1538. FindFirstRun(
  1539. PREGION Region,
  1540. PULONG Offset,
  1541. PULONG Length
  1542. );
  1543. NTSTATUS
  1544. VpAppendToRequirementsList(
  1545. IN PDEVICE_OBJECT DeviceObject,
  1546. IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *RequirementsList,
  1547. IN ULONG NumAccessRanges,
  1548. IN PVIDEO_ACCESS_RANGE AccessRanges
  1549. );
  1550. BOOLEAN
  1551. VpIsLegacyAccessRange(
  1552. PFDO_EXTENSION fdoExtension,
  1553. PVIDEO_ACCESS_RANGE AccessRange
  1554. );
  1555. BOOLEAN
  1556. VpIsResourceInList(
  1557. PCM_PARTIAL_RESOURCE_DESCRIPTOR pResource,
  1558. PCM_FULL_RESOURCE_DESCRIPTOR pFullResource,
  1559. PCM_RESOURCE_LIST removeList
  1560. );
  1561. PCM_RESOURCE_LIST
  1562. VpRemoveFromResourceList(
  1563. PCM_RESOURCE_LIST OriginalList,
  1564. ULONG NumAccessRanges,
  1565. PVIDEO_ACCESS_RANGE AccessRanges
  1566. );
  1567. VOID
  1568. VpEnableDisplay(
  1569. PFDO_EXTENSION fdoExtension,
  1570. BOOLEAN bState
  1571. );
  1572. VOID
  1573. VpWin32kCallout(
  1574. PVIDEO_WIN32K_CALLBACKS_PARAMS calloutParams
  1575. );
  1576. BOOLEAN
  1577. pCheckActiveMonitor(
  1578. PCHILD_PDO_EXTENSION pChildDeviceExtension
  1579. );
  1580. BOOLEAN
  1581. VpAllowFindAdapter(
  1582. PFDO_EXTENSION fdoExtension
  1583. );
  1584. VOID
  1585. InitializePowerStruct(
  1586. IN PIRP Irp,
  1587. OUT PVIDEO_POWER_MANAGEMENT vpPower,
  1588. OUT BOOLEAN * bWakeUp
  1589. );
  1590. BOOLEAN
  1591. VpTranslateResource(
  1592. IN PFDO_EXTENSION fdoExtension,
  1593. IN PULONG InIoSpace,
  1594. IN PPHYSICAL_ADDRESS PhysicalAddress,
  1595. OUT PPHYSICAL_ADDRESS TranslatedAddress
  1596. );
  1597. ULONG
  1598. GetCmResourceListSize(
  1599. PCM_RESOURCE_LIST CmResourceList
  1600. );
  1601. VOID
  1602. AddToResourceList(
  1603. ULONG BusNumber,
  1604. ULONG Slot
  1605. );
  1606. BOOLEAN
  1607. CheckResourceList(
  1608. ULONG BusNumber,
  1609. ULONG Slot
  1610. );
  1611. BOOLEAN
  1612. VpTranslateBusAddress(
  1613. IN PFDO_EXTENSION fdoExtension,
  1614. IN PPHYSICAL_ADDRESS IoAddress,
  1615. IN OUT PULONG addressSpace,
  1616. IN OUT PPHYSICAL_ADDRESS TranslatedAddress
  1617. );
  1618. VOID
  1619. pVideoPortDpcDispatcher(
  1620. IN PKDPC Dpc,
  1621. IN PVOID HwDeviceExtension,
  1622. IN PMINIPORT_DPC_ROUTINE DpcRoutine,
  1623. IN PVOID Context
  1624. );
  1625. #if DBG
  1626. VOID
  1627. DumpRequirements(
  1628. PIO_RESOURCE_REQUIREMENTS_LIST Requirements
  1629. );
  1630. VOID
  1631. DumpResourceList(
  1632. PCM_RESOURCE_LIST pcmResourceList
  1633. );
  1634. PIO_RESOURCE_REQUIREMENTS_LIST
  1635. BuildRequirements(
  1636. PCM_RESOURCE_LIST pcmResourceList
  1637. );
  1638. VOID
  1639. DumpUnicodeString(
  1640. IN PUNICODE_STRING p
  1641. );
  1642. #endif
  1643. PCM_PARTIAL_RESOURCE_DESCRIPTOR
  1644. RtlUnpackPartialDesc(
  1645. IN UCHAR Type,
  1646. IN PCM_RESOURCE_LIST ResList,
  1647. IN OUT PULONG Count
  1648. );
  1649. NTSTATUS
  1650. pVideoMiniDeviceIoControl(
  1651. IN PDEVICE_OBJECT hDevice,
  1652. IN ULONG dwIoControlCode,
  1653. IN PVOID lpInBuffer,
  1654. IN ULONG nInBufferSize,
  1655. OUT PVOID lpOutBuffer,
  1656. IN ULONG nOutBufferSize
  1657. );
  1658. ULONG
  1659. pVideoPortGetVgaStatusPci(
  1660. PVOID HwDeviceExtension
  1661. );
  1662. BOOLEAN
  1663. VpIsVgaResource(
  1664. PVIDEO_ACCESS_RANGE AccessRange
  1665. );
  1666. VOID
  1667. VpInterfaceDefaultReference(
  1668. IN PVOID pContext
  1669. );
  1670. VOID
  1671. VpInterfaceDefaultDereference(
  1672. IN PVOID pContext
  1673. );
  1674. BOOLEAN
  1675. VpEnableAdapterInterface(
  1676. PDEVICE_SPECIFIC_EXTENSION DoSpecificExtension
  1677. );
  1678. VOID
  1679. VpDisableAdapterInterface(
  1680. PFDO_EXTENSION fdoExtension
  1681. );
  1682. ULONG
  1683. VpGetDeviceCount(
  1684. PVOID HwDeviceExtension
  1685. );
  1686. VOID
  1687. VpEnableNewRegistryKey(
  1688. PFDO_EXTENSION FdoExtension,
  1689. PDEVICE_SPECIFIC_EXTENSION DoSpecificExtension,
  1690. PUNICODE_STRING RegistryPath,
  1691. ULONG RegistryIndex
  1692. );
  1693. VOID
  1694. VpInitializeKey(
  1695. PDEVICE_OBJECT PhysicalDeviceObject,
  1696. PWSTR NewRegistryPath
  1697. );
  1698. VOID
  1699. VpInitializeLegacyKey(
  1700. PWSTR OldRegistryPath,
  1701. PWSTR NewRegistryPath
  1702. );
  1703. NTSTATUS
  1704. VpCopyRegistry(
  1705. HANDLE hKeyRootSrc,
  1706. HANDLE hKeyRootDst,
  1707. PWSTR SrcKeyPath,
  1708. PWSTR DstKeyPath
  1709. );
  1710. VP_STATUS
  1711. VPSetRegistryParameters(
  1712. PVOID HwDeviceExtension,
  1713. PWSTR ValueName,
  1714. PVOID ValueData,
  1715. ULONG ValueLength,
  1716. PWSTR RegistryPath,
  1717. ULONG RegistryPathLength
  1718. );
  1719. VP_STATUS
  1720. VPGetRegistryParameters(
  1721. PVOID HwDeviceExtension,
  1722. PWSTR ParameterName,
  1723. UCHAR IsParameterFileName,
  1724. PMINIPORT_GET_REGISTRY_ROUTINE CallbackRoutine,
  1725. PVOID Context,
  1726. PWSTR RegistryPath,
  1727. ULONG RegistryPathLength
  1728. );
  1729. BOOLEAN
  1730. VpGetServiceSubkey(
  1731. PUNICODE_STRING RegistryPath,
  1732. HANDLE* pServiceSubKey
  1733. );
  1734. VP_STATUS
  1735. VpInt10AllocateBuffer(
  1736. IN PVOID Context,
  1737. OUT PUSHORT Seg,
  1738. OUT PUSHORT Off,
  1739. IN OUT PULONG Length
  1740. );
  1741. VP_STATUS
  1742. VpInt10FreeBuffer(
  1743. IN PVOID Context,
  1744. IN USHORT Seg,
  1745. IN USHORT Off
  1746. );
  1747. VP_STATUS
  1748. VpInt10ReadMemory(
  1749. IN PVOID Context,
  1750. IN USHORT Seg,
  1751. IN USHORT Off,
  1752. OUT PVOID Buffer,
  1753. IN ULONG Length
  1754. );
  1755. VP_STATUS
  1756. VpInt10WriteMemory(
  1757. IN PVOID Context,
  1758. IN USHORT Seg,
  1759. IN USHORT Off,
  1760. OUT PVOID Buffer,
  1761. IN ULONG Length
  1762. );
  1763. VP_STATUS
  1764. VpInt10CallBios(
  1765. PVOID HwDeviceExtension,
  1766. PINT10_BIOS_ARGUMENTS BiosArguments
  1767. );
  1768. VOID
  1769. pVpBugcheckCallback(
  1770. IN KBUGCHECK_CALLBACK_REASON Reason,
  1771. IN PKBUGCHECK_REASON_CALLBACK_RECORD Record,
  1772. IN OUT PVOID ReasonSpecificData,
  1773. IN ULONG ReasonSpecificDataLength
  1774. );
  1775. VOID
  1776. VpAcquireLock(
  1777. VOID
  1778. );
  1779. VOID
  1780. VpReleaseLock(
  1781. VOID
  1782. );
  1783. PVOID
  1784. VpAllocateNonPagedPoolPageAligned(
  1785. ULONG Size
  1786. );
  1787. VOID
  1788. pVpGeneralBugcheckHandler(
  1789. PKBUGCHECK_SECONDARY_DUMP_DATA DumpData
  1790. );
  1791. VOID
  1792. pVpSimulateBugcheckEA(
  1793. VOID
  1794. );
  1795. VOID
  1796. pVpWriteFile(
  1797. PWSTR pwszFileName,
  1798. PVOID pvBuffer,
  1799. ULONG ulSize
  1800. );
  1801. ULONG
  1802. pVpAppendSecondaryMinidumpData(
  1803. PVOID pvSecondaryData,
  1804. ULONG ulSecondaryDataSize,
  1805. PVOID pvDump
  1806. );
  1807. #endif // ifndef __VIDEOPRT_H__