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.

244 lines
4.8 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. pnpdata.c
  5. Abstract:
  6. This module contains the plug-and-play data
  7. Author:
  8. Shie-Lin Tzong (shielint) 30-Jan-1995
  9. Environment:
  10. Kernel mode
  11. Revision History:
  12. --*/
  13. #include "pnpmgrp.h"
  14. #pragma hdrstop
  15. #include <initguid.h>
  16. //
  17. // INIT data segment
  18. //
  19. #ifdef ALLOC_DATA_PRAGMA
  20. #pragma data_seg("INIT")
  21. #endif
  22. PVOID IopPnpScratchBuffer1 = NULL;
  23. PVOID IopPnpScratchBuffer2 = NULL;
  24. PCM_RESOURCE_LIST IopInitHalResources;
  25. PDEVICE_NODE IopInitHalDeviceNode;
  26. PIOP_RESERVED_RESOURCES_RECORD IopInitReservedResourceList;
  27. //
  28. // Regular data segment
  29. //
  30. #ifdef ALLOC_DATA_PRAGMA
  31. #pragma data_seg()
  32. #endif
  33. //
  34. // IopRootDeviceNode - the head of the PnP manager's device node tree.
  35. //
  36. PDEVICE_NODE IopRootDeviceNode;
  37. //
  38. // IoPnPDriverObject - the madeup driver object for pnp manager
  39. //
  40. PDRIVER_OBJECT IoPnpDriverObject;
  41. //
  42. // IopPnPSpinLock - spinlock for Pnp code.
  43. //
  44. KSPIN_LOCK IopPnPSpinLock;
  45. //
  46. // IopDeviceTreeLock - performs synchronization around the whole device node tree.
  47. //
  48. ERESOURCE IopDeviceTreeLock;
  49. //
  50. // IopSurpriseRemoveListLock - synchronizes access to the surprise remove list.
  51. //
  52. ERESOURCE IopSurpriseRemoveListLock;
  53. //
  54. // PiEngineLock - Synchronizes the start/enum and remove engines.
  55. //
  56. ERESOURCE PiEngineLock;
  57. //
  58. // PiEventQueueEmpty - Manual reset event which is set when the queue is empty
  59. //
  60. KEVENT PiEventQueueEmpty;
  61. //
  62. // PiEnumerationLock - to synchronize boot phase device enumeration
  63. //
  64. KEVENT PiEnumerationLock;
  65. //
  66. // IopNumberDeviceNodes - Number of outstanding device nodes in the system.
  67. //
  68. ULONG IopNumberDeviceNodes;
  69. //
  70. // IopPnpEnumerationRequestList - a link list of device enumeration requests to worker thread.
  71. //
  72. LIST_ENTRY IopPnpEnumerationRequestList;
  73. //
  74. // PnPInitComplete - A flag to indicate if PnP initialization is completed.
  75. //
  76. BOOLEAN PnPInitialized;
  77. //
  78. // PnPBootDriverInitialied
  79. //
  80. BOOLEAN PnPBootDriversInitialized;
  81. //
  82. // PnPBootDriverLoaded
  83. //
  84. BOOLEAN PnPBootDriversLoaded;
  85. //
  86. // IopBootConfigsReserved - Indicates whether we have reserved BOOT configs or not.
  87. //
  88. BOOLEAN IopBootConfigsReserved;
  89. //
  90. // Variable to hold boot allocation routine.
  91. //
  92. PIO_ALLOCATE_BOOT_RESOURCES_ROUTINE IopAllocateBootResourcesRoutine;
  93. //
  94. // Device node tree sequence. Is bumped every time the tree is modified or a warm
  95. // eject is queued.
  96. //
  97. ULONG IoDeviceNodeTreeSequence;
  98. //
  99. // PnpDefaultInterfaceTYpe - Use this if the interface type of resource list is unknown.
  100. //
  101. INTERFACE_TYPE PnpDefaultInterfaceType;
  102. //
  103. // PnpStartAsynOk - control how start irp should be handled. Synchronously or Asynchronously?
  104. //
  105. BOOLEAN PnpAsyncOk;
  106. //
  107. // IopMaxDeviceNodeLevel - Level number of the DeviceNode deepest in the tree
  108. //
  109. ULONG IopMaxDeviceNodeLevel;
  110. //
  111. // IopPendingEjects - List of pending eject requests
  112. //
  113. LIST_ENTRY IopPendingEjects;
  114. //
  115. // IopPendingSurpriseRemovals - List of pending surprise removal requests
  116. //
  117. LIST_ENTRY IopPendingSurpriseRemovals;
  118. //
  119. // Warm eject lock - only one warm eject is allowed to occur at a time
  120. //
  121. KEVENT IopWarmEjectLock;
  122. //
  123. // This field contains a devobj if a warm eject is in progress.
  124. //
  125. PDEVICE_OBJECT IopWarmEjectPdo;
  126. //
  127. // Arbiter data
  128. //
  129. ARBITER_INSTANCE IopRootPortArbiter;
  130. ARBITER_INSTANCE IopRootMemArbiter;
  131. ARBITER_INSTANCE IopRootDmaArbiter;
  132. ARBITER_INSTANCE IopRootIrqArbiter;
  133. ARBITER_INSTANCE IopRootBusNumberArbiter;
  134. //
  135. // The following resource is used to control access to device-related, Plug and Play-specific
  136. // portions of the registry. These portions are:
  137. //
  138. // HKLM\System\Enum
  139. // HKLM\System\CurrentControlSet\Hardware Profiles
  140. // HKLM\System\CurrentControlSet\Services\<service>\Enum
  141. //
  142. // It allows exclusive access for writing, as well as shared access for reading.
  143. // The resource is initialized by the PnP manager initialization code during phase 0
  144. // initialization.
  145. //
  146. ERESOURCE PpRegistryDeviceResource;
  147. //
  148. // Table for Legacy Bus information
  149. //
  150. LIST_ENTRY IopLegacyBusInformationTable[MaximumInterfaceType];
  151. //
  152. // Set to TRUE in the shutdown process. This prevents us from starting any
  153. // PNP operations once there is no longer a reasonable expectation they will
  154. // succeed.
  155. //
  156. BOOLEAN PpPnpShuttingDown;
  157. //
  158. // The following semaphore is used by the IO system when it reports resource
  159. // usage to the configuration registry on behalf of a driver. This semaphore
  160. // is initialized by the I/O system initialization code when the system is
  161. // started.
  162. //
  163. KSEMAPHORE PpRegistrySemaphore;
  164. //DEFINE_GUID(REGSTR_VALUE_LEGACY_DRIVER_CLASS_GUID, 0x8ECC055D, 0x047F, 0x11D1, 0xA5, 0x37, 0x00, 0x00, 0xF8, 0x75, 0x3E, 0xD1);
  165. SYSTEM_HIVE_LIMITS PpSystemHiveLimits = {0};
  166. BOOLEAN PpSystemHiveTooLarge = FALSE;
  167. //
  168. // This is really gross.
  169. // HACK for MATROX G100 because it was too late to make this change for XP.
  170. //
  171. BOOLEAN PpCallerInitializesRequestTable = FALSE;