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.

294 lines
5.6 KiB

  1. /*++
  2. Copyright (c) 1997-2000 Microsoft Corporation
  3. Module Name:
  4. local.h
  5. Abstract:
  6. This header declares the stuctures and function prototypes shared between
  7. the various modules.
  8. Author:
  9. Adam Glass
  10. Revision History:
  11. --*/
  12. #if !defined(_SPSIM_H_)
  13. #define _SPSIM_H_
  14. #include <wdm.h>
  15. #include <acpiioct.h>
  16. #include <acpimsft.h>
  17. #include "oprghdlr.h"
  18. #include "debug.h"
  19. //
  20. // --- Constants ---
  21. //
  22. //
  23. // These must be updated if any new PNP or PO irps are added
  24. //
  25. // XXX fix
  26. #define IRP_MN_PNP_MAXIMUM_FUNCTION IRP_MN_SURPRISE_REMOVAL
  27. #define IRP_MN_PO_MAXIMUM_FUNCTION IRP_MN_QUERY_POWER
  28. //
  29. // Device state flags
  30. //
  31. #define SPSIM_DEVICE_STARTED 0x00000001
  32. #define SPSIM_DEVICE_REMOVED 0x00000002
  33. #define SPSIM_DEVICE_ENUMERATED 0x00000004
  34. #define SPSIM_DEVICE_REMOVE_PENDING 0x00000008 /* DEPRECATED */
  35. #define SPSIM_DEVICE_STOP_PENDING 0x00000010 /* DEPRECATED */
  36. #define SPSIM_DEVICE_DELETED 0x00000080
  37. #define SPSIM_DEVICE_SURPRISE_REMOVED 0x00000100
  38. //
  39. // --- Type definitions ---
  40. //
  41. typedef
  42. NTSTATUS
  43. (*PSPSIM_DISPATCH)(
  44. IN PIRP Irp,
  45. IN PVOID Extension,
  46. IN PIO_STACK_LOCATION IrpStack
  47. );
  48. typedef struct {
  49. ULONG Addr;
  50. ULONG Length;
  51. } MEM_REGION_DESCRIPTOR, *PMEM_REGION_DESCRIPTOR;
  52. typedef struct {
  53. //
  54. // Flags to indicate the device's current state (use SPSIM_DEVICE_*)
  55. //
  56. ULONG DeviceState;
  57. //
  58. // The power state of the device
  59. //
  60. DEVICE_POWER_STATE PowerState;
  61. DEVICE_POWER_STATE DeviceStateMapping[PowerSystemMaximum];
  62. //
  63. // Backpointer to the device object of whom we are the extension
  64. //
  65. PDEVICE_OBJECT Self;
  66. //
  67. // The PDO for the multi-function device
  68. //
  69. PDEVICE_OBJECT PhysicalDeviceObject;
  70. //
  71. // The next device in the stack who we should send our IRPs down to
  72. //
  73. PDEVICE_OBJECT AttachedDevice;
  74. PVOID StaOpRegion;
  75. ULONG StaCount;
  76. ACPI_EVAL_OUTPUT_BUFFER *StaNames;
  77. PUCHAR StaOpRegionValues;
  78. PVOID MemOpRegion;
  79. ULONG MemCount;
  80. PMEM_REGION_DESCRIPTOR MemOpRegionValues;
  81. UNICODE_STRING SymbolicLinkName;
  82. //
  83. // Remove lock. Used to prevent the FDO from being removed while
  84. // other operations are digging around in the extension.
  85. //
  86. IO_REMOVE_LOCK RemoveLock;
  87. } SPSIM_EXTENSION, *PSPSIM_EXTENSION;
  88. //
  89. // --- Globals ---
  90. //
  91. extern PDRIVER_OBJECT SpSimDriverObject;
  92. NTSTATUS
  93. SpSimCreateFdo(
  94. PDEVICE_OBJECT *Fdo
  95. );
  96. NTSTATUS
  97. SpSimDispatchPnpFdo(
  98. IN PDEVICE_OBJECT DeviceObject,
  99. IN PSPSIM_EXTENSION Parent,
  100. IN PIO_STACK_LOCATION IrpStack,
  101. IN OUT PIRP Irp
  102. );
  103. NTSTATUS
  104. SpSimDispatchPowerFdo(
  105. IN PDEVICE_OBJECT DeviceObject,
  106. IN PSPSIM_EXTENSION Parent,
  107. IN PIO_STACK_LOCATION IrpStack,
  108. IN OUT PIRP Irp
  109. );
  110. NTSTATUS
  111. SpSimAddDevice(
  112. IN PDRIVER_OBJECT DriverObject,
  113. IN PDEVICE_OBJECT PhysicalDeviceObject
  114. );
  115. NTSTATUS
  116. SpSimDispatchPnp(
  117. IN PDEVICE_OBJECT DeviceObject,
  118. IN PIRP Irp
  119. );
  120. NTSTATUS
  121. SpSimDispatchPower(
  122. IN PDEVICE_OBJECT DeviceObject,
  123. IN PIRP Irp
  124. );
  125. NTSTATUS
  126. SpSimDispatchNop(
  127. IN PDEVICE_OBJECT DeviceObject,
  128. IN PIRP Irp
  129. );
  130. NTSTATUS
  131. SpSimDevControl(
  132. IN PDEVICE_OBJECT DeviceObject,
  133. IN PIRP Irp
  134. );
  135. NTSTATUS
  136. SpSimInstallStaOpRegionHandler(
  137. IN OUT PSPSIM_EXTENSION SpSim
  138. );
  139. NTSTATUS
  140. SpSimRemoveStaOpRegionHandler (
  141. IN OUT PSPSIM_EXTENSION SpSim
  142. );
  143. NTSTATUS
  144. SpSimInstallMemOpRegionHandler(
  145. IN OUT PSPSIM_EXTENSION SpSim
  146. );
  147. NTSTATUS
  148. SpSimRemoveMemOpRegionHandler (
  149. IN OUT PSPSIM_EXTENSION SpSim
  150. );
  151. #define SPSIM_STA_NAMES_METHOD (ULONG)'MANS'
  152. #define SPSIM_NOTIFY_DEVICE_METHOD (ULONG)'DFON'
  153. NTSTATUS
  154. SpSimCreateStaOpRegion(
  155. IN PSPSIM_EXTENSION SpSim
  156. );
  157. VOID
  158. SpSimDeleteStaOpRegion(
  159. IN PSPSIM_EXTENSION SpSim
  160. );
  161. NTSTATUS
  162. SpSimCreateMemOpRegion(
  163. IN PSPSIM_EXTENSION SpSim
  164. );
  165. VOID
  166. SpSimDeleteMemOpRegion(
  167. IN PSPSIM_EXTENSION SpSim
  168. );
  169. NTSTATUS
  170. SpSimSendIoctl(
  171. IN PDEVICE_OBJECT Device,
  172. IN ULONG IoctlCode,
  173. IN PVOID InputBuffer OPTIONAL,
  174. IN ULONG InputBufferLength,
  175. IN PVOID OutputBuffer OPTIONAL,
  176. IN ULONG OutputBufferLength
  177. );
  178. NTSTATUS
  179. EXPORT
  180. SpSimStaOpRegionHandler (
  181. ULONG AccessType,
  182. PVOID OpRegion,
  183. ULONG Address,
  184. ULONG Size,
  185. PULONG Data,
  186. ULONG_PTR Context,
  187. PACPI_OPREGION_CALLBACK CompletionHandler,
  188. PVOID CompletionContext
  189. );
  190. NTSTATUS
  191. SpSimOpenClose(
  192. IN PDEVICE_OBJECT DeviceObject,
  193. IN PIRP Irp
  194. );
  195. NTSTATUS
  196. SpSimGetManagedDevicesIoctl(
  197. PSPSIM_EXTENSION SpSim,
  198. PIRP Irp,
  199. PIO_STACK_LOCATION IrpStack
  200. );
  201. NTSTATUS
  202. SpSimAccessStaIoctl(
  203. PSPSIM_EXTENSION SpSim,
  204. PIRP Irp,
  205. PIO_STACK_LOCATION IrpStack
  206. );
  207. NTSTATUS
  208. SpSimGetDeviceName(
  209. PSPSIM_EXTENSION SpSim,
  210. PIRP Irp,
  211. PIO_STACK_LOCATION IrpStack
  212. );
  213. NTSTATUS
  214. SpSimNotifyDeviceIoctl(
  215. PSPSIM_EXTENSION SpSim,
  216. PIRP Irp,
  217. PIO_STACK_LOCATION IrpStack
  218. );
  219. NTSTATUS
  220. SpSimPassIrp(
  221. IN PIRP Irp,
  222. IN PSPSIM_EXTENSION SpSim,
  223. IN PIO_STACK_LOCATION IrpStack
  224. );
  225. #define STA_OPREGION 0x99
  226. #define MEM_OPREGION 0x9A
  227. #define MAX_MEMORY_OBJ 8
  228. #define MAX_MEMORY_DESC_PER_OBJ 1
  229. #define MIN_LARGE_DESC 32*1024*1024
  230. #endif // !defined(_SPSIM_H_)