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.

415 lines
11 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. dpower.h
  5. Abstract:
  6. This handles requests to have devices set themselves at specific power
  7. levels
  8. Author:
  9. Jason Clark (jasoncl)
  10. Stephane Plante (splante)
  11. Environment:
  12. Kernel mode only.
  13. Revision History:
  14. 09-Oct-96 Initial Revision
  15. 20-Nov-96 Interrupt Vector support
  16. 31-Mar-97 Cleanup
  17. 29-Sep-97 Major Rewrite
  18. --*/
  19. #ifndef _DEVPOWER_H_
  20. #define _DEVPOWER_H_
  21. #define DEVICE_POWER_MAXIMUM 4
  22. #define SYSTEM_POWER_MAXIMUM 6
  23. //
  24. // Prototype function pointer
  25. //
  26. typedef NTSTATUS (*PACPI_POWER_FUNCTION)( IN PACPI_POWER_REQUEST);
  27. extern BOOLEAN AcpiPowerDpcRunning;
  28. extern BOOLEAN AcpiPowerWorkDone;
  29. extern KSPIN_LOCK AcpiPowerLock;
  30. extern KSPIN_LOCK AcpiPowerQueueLock;
  31. extern LIST_ENTRY AcpiPowerDelayedQueueList;
  32. extern LIST_ENTRY AcpiPowerQueueList;
  33. extern LIST_ENTRY AcpiPowerPhase0List;
  34. extern LIST_ENTRY AcpiPowerPhase1List;
  35. extern LIST_ENTRY AcpiPowerPhase2List;
  36. extern LIST_ENTRY AcpiPowerPhase3List;
  37. extern LIST_ENTRY AcpiPowerPhase4List;
  38. extern LIST_ENTRY AcpiPowerPhase5List;
  39. extern LIST_ENTRY AcpiPowerWaitWakeList;
  40. extern LIST_ENTRY AcpiPowerSynchronizeList;
  41. extern LIST_ENTRY AcpiPowerNodeList;
  42. extern KDPC AcpiPowerDpc;
  43. extern BOOLEAN AcpiPowerLeavingS0;
  44. extern NPAGED_LOOKASIDE_LIST ObjectDataLookAsideList;
  45. extern NPAGED_LOOKASIDE_LIST RequestLookAsideList;
  46. extern DEVICE_POWER_STATE DevicePowerStateTranslation[DEVICE_POWER_MAXIMUM];
  47. extern SYSTEM_POWER_STATE SystemPowerStateTranslation[SYSTEM_POWER_MAXIMUM];
  48. extern ULONG AcpiSystemStateTranslation[PowerSystemMaximum];
  49. VOID
  50. ACPIDeviceCancelWaitWakeIrp(
  51. IN PDEVICE_OBJECT DeviceObject,
  52. IN PIRP Irp
  53. );
  54. VOID EXPORT
  55. ACPIDeviceCancelWaitWakeIrpCallBack(
  56. IN PNSOBJ AcpiObject,
  57. IN NTSTATUS Status,
  58. IN POBJDATA ObjectData,
  59. IN PVOID Context
  60. );
  61. VOID
  62. ACPIDeviceCompleteCommon(
  63. IN PULONG OldWorkDone,
  64. IN ULONG NewWorkDone
  65. );
  66. VOID EXPORT
  67. ACPIDeviceCompleteGenericPhase(
  68. IN PNSOBJ AcpiObject,
  69. IN NTSTATUS Status,
  70. IN POBJDATA ObjectData,
  71. IN PVOID Context
  72. );
  73. VOID EXPORT
  74. ACPIDeviceCompleteInterpreterRequest(
  75. IN PVOID Context
  76. );
  77. VOID EXPORT
  78. ACPIDeviceCompletePhase3Off(
  79. IN PNSOBJ AcpiObject,
  80. IN NTSTATUS Status,
  81. IN POBJDATA ObjectData,
  82. IN PVOID Context
  83. );
  84. VOID EXPORT
  85. ACPIDeviceCompletePhase3On(
  86. IN PNSOBJ AcpiObject,
  87. IN NTSTATUS Status,
  88. IN POBJDATA ObjectData,
  89. IN PVOID Context
  90. );
  91. VOID
  92. ACPIDeviceCompleteRequest(
  93. IN PACPI_POWER_REQUEST PowerRequest
  94. );
  95. NTSTATUS
  96. ACPIDeviceInitializePowerRequest(
  97. IN PDEVICE_EXTENSION DeviceExtension,
  98. IN POWER_STATE Power,
  99. IN PACPI_POWER_CALLBACK CallBack,
  100. IN PVOID CallBackContext,
  101. IN POWER_ACTION PowerAction,
  102. IN ACPI_POWER_REQUEST_TYPE RequestType,
  103. IN ULONG Flags
  104. );
  105. NTSTATUS
  106. ACPIDeviceInternalDelayedDeviceRequest(
  107. IN PDEVICE_EXTENSION DeviceExtension,
  108. IN DEVICE_POWER_STATE DeviceState,
  109. IN PACPI_POWER_CALLBACK CallBack,
  110. IN PVOID CallBackContext
  111. );
  112. NTSTATUS
  113. ACPIDeviceInternalDeviceRequest(
  114. IN PDEVICE_EXTENSION DeviceExtension,
  115. IN DEVICE_POWER_STATE DeviceState,
  116. IN PACPI_POWER_CALLBACK CallBack,
  117. IN PVOID CallBackContext,
  118. IN ULONG Flags
  119. );
  120. VOID
  121. ACPIDeviceInternalQueueRequest(
  122. IN PDEVICE_EXTENSION DeviceExtension,
  123. IN PACPI_POWER_REQUEST PowerRequest,
  124. IN ULONG Flags
  125. );
  126. VOID
  127. ACPIDeviceIrpCompleteRequest(
  128. IN PDEVICE_EXTENSION DeviceExtension,
  129. IN PVOID Context,
  130. IN NTSTATUS Status
  131. );
  132. VOID
  133. ACPIDeviceIrpDelayedDeviceOffRequest(
  134. IN PDEVICE_EXTENSION DeviceExtension,
  135. IN PVOID Context,
  136. IN NTSTATUS Status
  137. );
  138. VOID
  139. ACPIDeviceIrpDelayedDeviceOnRequest(
  140. IN PDEVICE_EXTENSION DeviceExtension,
  141. IN PVOID Context,
  142. IN NTSTATUS Status
  143. );
  144. NTSTATUS
  145. ACPIDeviceIrpDeviceFilterRequest(
  146. IN PDEVICE_OBJECT DeviceObject,
  147. IN PIRP Irp,
  148. IN PACPI_POWER_CALLBACK CallBack
  149. );
  150. NTSTATUS
  151. ACPIDeviceIrpDeviceRequest(
  152. IN PDEVICE_OBJECT DeviceObject,
  153. IN PIRP Irp,
  154. IN PACPI_POWER_CALLBACK CallBack
  155. );
  156. VOID
  157. ACPIDeviceIrpForwardRequest(
  158. IN PDEVICE_EXTENSION DeviceExtension,
  159. IN PVOID Context,
  160. IN NTSTATUS Status
  161. );
  162. NTSTATUS
  163. ACPIDeviceIrpSystemRequest(
  164. IN PDEVICE_OBJECT DeviceObject,
  165. IN PIRP Irp,
  166. IN PACPI_POWER_CALLBACK CallBack
  167. );
  168. NTSTATUS
  169. ACPIDeviceIrpWaitWakeRequest(
  170. IN PDEVICE_OBJECT DeviceObject,
  171. IN PIRP Irp,
  172. IN PACPI_POWER_CALLBACK CallBack
  173. );
  174. VOID
  175. ACPIDeviceIrpWaitWakeRequestComplete(
  176. IN PACPI_POWER_REQUEST PowerRequest
  177. );
  178. VOID EXPORT
  179. ACPIDeviceIrpWaitWakeRequestPending(
  180. IN PNSOBJ AcpiObject,
  181. IN NTSTATUS Status,
  182. IN POBJDATA ObjectData,
  183. IN PVOID Context
  184. );
  185. NTSTATUS
  186. ACPIDeviceIrpWarmEjectRequest(
  187. IN PDEVICE_EXTENSION DeviceExtension,
  188. IN PIRP Irp,
  189. IN PACPI_POWER_CALLBACK CallBack,
  190. IN BOOLEAN UpdateHardwareProfile
  191. );
  192. #define ACPIDeviceMapACPIPowerState( STATE ) \
  193. (STATE >= PowerSystemMaximum ? \
  194. (ULONG) -1 : AcpiSystemStateTranslation[STATE])
  195. #define ACPIDeviceMapPowerState( STATE ) \
  196. (STATE >= DEVICE_POWER_MAXIMUM ? \
  197. PowerDeviceUnspecified : \
  198. DevicePowerStateTranslation[STATE])
  199. #define ACPIDeviceMapSystemState( STATE) \
  200. (STATE >= SYSTEM_POWER_MAXIMUM ? \
  201. PowerSystemUnspecified : \
  202. SystemPowerStateTranslation[STATE])
  203. NTSTATUS
  204. ACPIDevicePowerDetermineSupportedDeviceStates(
  205. IN PDEVICE_EXTENSION DeviceExtension,
  206. IN PULONG SupportedPrStates,
  207. IN PULONG SupportedPsStates
  208. );
  209. VOID
  210. ACPIDevicePowerDpc(
  211. IN PKDPC Dpc,
  212. IN PVOID DpcContext,
  213. IN PVOID SystemArgument1,
  214. IN PVOID SystemArgument2
  215. );
  216. NTSTATUS
  217. ACPIDevicePowerFlushQueue(
  218. PDEVICE_EXTENSION DeviceExtension
  219. );
  220. VOID
  221. ACPIDevicePowerNotifyEvent(
  222. IN PDEVICE_EXTENSION DeviceExtension,
  223. IN PVOID Context,
  224. IN NTSTATUS Status
  225. );
  226. NTSTATUS
  227. ACPIDevicePowerProcessForward(
  228. IN PACPI_POWER_REQUEST PowerRequest
  229. );
  230. NTSTATUS
  231. ACPIDevicePowerProcessGenericPhase(
  232. IN PLIST_ENTRY ListEntry,
  233. IN PACPI_POWER_FUNCTION **DispatchTable,
  234. IN BOOLEAN Complete
  235. );
  236. NTSTATUS
  237. ACPIDevicePowerProcessInvalid(
  238. IN PACPI_POWER_REQUEST PowerRequest
  239. );
  240. NTSTATUS
  241. ACPIDevicePowerProcessPhase0DeviceSubPhase1(
  242. IN PACPI_POWER_REQUEST PowerRequest
  243. );
  244. NTSTATUS
  245. ACPIDevicePowerProcessPhase0DeviceSubPhase2(
  246. IN PACPI_POWER_REQUEST PowerRequest
  247. );
  248. NTSTATUS
  249. ACPIDevicePowerProcessPhase0SystemSubPhase1(
  250. IN PACPI_POWER_REQUEST PowerRequest
  251. );
  252. NTSTATUS
  253. ACPIDevicePowerProcessPhase1DeviceSubPhase1(
  254. IN PACPI_POWER_REQUEST PowerRequest
  255. );
  256. NTSTATUS
  257. ACPIDevicePowerProcessPhase1DeviceSubPhase2(
  258. IN PACPI_POWER_REQUEST PowerRequest
  259. );
  260. NTSTATUS
  261. ACPIDevicePowerProcessPhase1DeviceSubPhase3(
  262. IN PACPI_POWER_REQUEST PowerRequest
  263. );
  264. NTSTATUS
  265. ACPIDevicePowerProcessPhase1DeviceSubPhase4(
  266. IN PACPI_POWER_REQUEST PowerRequest
  267. );
  268. NTSTATUS
  269. ACPIDevicePowerProcessPhase2SystemSubPhase1(
  270. IN PACPI_POWER_REQUEST PowerRequest
  271. );
  272. NTSTATUS
  273. ACPIDevicePowerProcessPhase2SystemSubPhase2(
  274. IN PACPI_POWER_REQUEST PowerRequest
  275. );
  276. NTSTATUS
  277. ACPIDevicePowerProcessPhase2SystemSubPhase3(
  278. IN PACPI_POWER_REQUEST PowerRequest
  279. );
  280. NTSTATUS
  281. ACPIDevicePowerProcessPhase3(
  282. VOID
  283. );
  284. NTSTATUS
  285. ACPIDevicePowerProcessPhase4(
  286. VOID
  287. );
  288. NTSTATUS
  289. ACPIDevicePowerProcessPhase5DeviceSubPhase1(
  290. IN PACPI_POWER_REQUEST PowerRequest
  291. );
  292. NTSTATUS
  293. ACPIDevicePowerProcessPhase5DeviceSubPhase2(
  294. IN PACPI_POWER_REQUEST PowerRequest
  295. );
  296. NTSTATUS
  297. ACPIDevicePowerProcessPhase5DeviceSubPhase3(
  298. IN PACPI_POWER_REQUEST PowerRequest
  299. );
  300. NTSTATUS
  301. ACPIDevicePowerProcessPhase5DeviceSubPhase4(
  302. IN PACPI_POWER_REQUEST PowerRequest
  303. );
  304. NTSTATUS
  305. ACPIDevicePowerProcessPhase5DeviceSubPhase5(
  306. IN PACPI_POWER_REQUEST PowerRequest
  307. );
  308. NTSTATUS
  309. ACPIDevicePowerProcessPhase5DeviceSubPhase6(
  310. IN PACPI_POWER_REQUEST PowerRequest
  311. );
  312. NTSTATUS
  313. ACPIDevicePowerProcessPhase5SystemSubPhase1(
  314. IN PACPI_POWER_REQUEST PowerRequest
  315. );
  316. NTSTATUS
  317. ACPIDevicePowerProcessPhase5SystemSubPhase2(
  318. IN PACPI_POWER_REQUEST PowerRequest
  319. );
  320. NTSTATUS
  321. ACPIDevicePowerProcessPhase5SystemSubPhase3(
  322. IN PACPI_POWER_REQUEST PowerRequest
  323. );
  324. NTSTATUS
  325. ACPIDevicePowerProcessPhase5SystemSubPhase4(
  326. IN PACPI_POWER_REQUEST PowerRequest
  327. );
  328. NTSTATUS
  329. ACPIDevicePowerProcessPhase5WarmEjectSubPhase1(
  330. IN PACPI_POWER_REQUEST PowerRequest
  331. );
  332. NTSTATUS
  333. ACPIDevicePowerProcessPhase5WarmEjectSubPhase2(
  334. IN PACPI_POWER_REQUEST PowerRequest
  335. );
  336. NTSTATUS
  337. ACPIDevicePowerProcessSynchronizeList(
  338. IN PLIST_ENTRY ListEntry
  339. );
  340. #endif