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.

176 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. pnpmem.h
  5. Author:
  6. Dave Richards (daveri) 16-Aug-1999
  7. Environment:
  8. Kernel mode only.
  9. Revision History:
  10. --*/
  11. #ifndef _PNPMEM_H_
  12. #define _PNPMEM_H_
  13. #include <ntddk.h>
  14. #include <stdarg.h>
  15. #include <stdio.h>
  16. #include "errlog.h"
  17. //
  18. // A Range List Entry.
  19. //
  20. typedef struct {
  21. LIST_ENTRY ListEntry;
  22. ULONGLONG Start;
  23. ULONGLONG End;
  24. } PM_RANGE_LIST_ENTRY, *PPM_RANGE_LIST_ENTRY;
  25. //
  26. // A Range List.
  27. //
  28. typedef struct {
  29. LIST_ENTRY List;
  30. } PM_RANGE_LIST, *PPM_RANGE_LIST;
  31. //
  32. // FDO Device Extension.
  33. //
  34. typedef struct {
  35. ULONG Flags;
  36. IO_REMOVE_LOCK RemoveLock;
  37. PDEVICE_OBJECT AttachedDevice;
  38. DEVICE_POWER_STATE PowerState;
  39. DEVICE_POWER_STATE DeviceStateMapping[PowerSystemMaximum];
  40. PPM_RANGE_LIST RangeList;
  41. BOOLEAN FailQueryRemoves;
  42. } PM_DEVICE_EXTENSION, *PPM_DEVICE_EXTENSION;
  43. #define DF_SURPRISE_REMOVED 0x01
  44. PPM_RANGE_LIST
  45. PmAllocateRangeList(
  46. VOID
  47. );
  48. NTSTATUS
  49. PmInsertRangeInList(
  50. PPM_RANGE_LIST InsertionList,
  51. ULONGLONG Start,
  52. ULONGLONG End
  53. );
  54. VOID
  55. PmFreeRangeList(
  56. IN PPM_RANGE_LIST RangeList
  57. );
  58. BOOLEAN
  59. PmIsRangeListEmpty(
  60. IN PPM_RANGE_LIST RangeList
  61. );
  62. PPM_RANGE_LIST
  63. PmCopyRangeList(
  64. IN PPM_RANGE_LIST SrcRangeList
  65. );
  66. PPM_RANGE_LIST
  67. PmInvertRangeList(
  68. IN PPM_RANGE_LIST SrcRangeList
  69. );
  70. PPM_RANGE_LIST
  71. PmSubtractRangeList(
  72. IN PPM_RANGE_LIST SrcRangeList1,
  73. IN PPM_RANGE_LIST SrcRangeList2
  74. );
  75. PPM_RANGE_LIST
  76. PmIntersectRangeList(
  77. IN PPM_RANGE_LIST SrcRangeList1,
  78. IN PPM_RANGE_LIST SrcRangeList2
  79. );
  80. PPM_RANGE_LIST
  81. PmCreateRangeListFromCmResourceList(
  82. IN PCM_RESOURCE_LIST CmResourceList
  83. );
  84. PPM_RANGE_LIST
  85. PmCreateRangeListFromPhysicalMemoryRanges(
  86. VOID
  87. );
  88. NTSTATUS
  89. PmAddPhysicalMemory(
  90. IN PDEVICE_OBJECT DeviceObject,
  91. IN PPM_RANGE_LIST RangeList1
  92. );
  93. NTSTATUS
  94. PmRemovePhysicalMemory(
  95. IN PPM_RANGE_LIST RangeList1
  96. );
  97. VOID
  98. PmTrimReservedMemory(
  99. IN PPM_DEVICE_EXTENSION DeviceExtension,
  100. IN PPM_RANGE_LIST *PossiblyNewMemory
  101. );
  102. NTSTATUS
  103. PmGetRegistryValue(
  104. IN HANDLE KeyHandle,
  105. IN PWSTR ValueName,
  106. OUT PKEY_VALUE_PARTIAL_INFORMATION *Information
  107. );
  108. VOID
  109. PmDebugPrint(
  110. IN ULONG DebugPrintLevel,
  111. IN PCCHAR DebugMessage,
  112. ...
  113. );
  114. VOID
  115. PmDebugDumpRangeList(
  116. IN ULONG DebugPrintLevel,
  117. IN PCCHAR DebugMessage,
  118. PPM_RANGE_LIST RangeList
  119. );
  120. #if DBG
  121. #define PmPrint(x) PmDebugPrint x
  122. #else
  123. #define PmPrint(x)
  124. #endif
  125. #define PNPMEM_MEMORY (DPFLTR_INFO_LEVEL + 1)
  126. #define PNPMEM_PNP (DPFLTR_INFO_LEVEL + 2)
  127. VOID
  128. PmDumpOsMemoryRanges(
  129. IN PWSTR Prefix
  130. );
  131. extern BOOLEAN MemoryRemovalSupported;
  132. #endif /* _PNPMEM_H_ */