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.

171 lines
3.1 KiB

  1. /*++
  2. Copyright (c) 1990-2000 Microsoft Corporation All Rights Reserved
  3. Module Name:
  4. power.h
  5. Abstract:
  6. This module contains the declarations used by power.c
  7. Author:
  8. Eliyas Yakub Sep 16, 1998
  9. Environment:
  10. user and kernel
  11. Notes:
  12. Revision History:
  13. --*/
  14. #ifndef __POWER_H
  15. #define __POWER_H
  16. typedef enum {
  17. IRP_NEEDS_FORWARDING = 1,
  18. IRP_ALREADY_FORWARDED
  19. } IRP_DIRECTION;
  20. typedef struct _POWER_COMPLETION_CONTEXT {
  21. PDEVICE_OBJECT DeviceObject;
  22. PIRP SIrp;
  23. } POWER_COMPLETION_CONTEXT, *PPOWER_COMPLETION_CONTEXT;
  24. typedef struct _WORKER_THREAD_CONTEXT {
  25. PDEVICE_OBJECT DeviceObject;
  26. PIRP Irp;
  27. IRP_DIRECTION IrpDirection;
  28. PIO_WORKITEM WorkItem;
  29. } WORKER_THREAD_CONTEXT, *PWORKER_THREAD_CONTEXT;
  30. typedef struct {
  31. PAC_DC_NOTIFY_HANDLER Handler;
  32. PVOID Context;
  33. } AC_DC_TRANSITION_NOTIFY, *PAC_DC_TRANSITION_NOTIFY;
  34. NTSTATUS
  35. ProcessorDefaultPowerHandler (
  36. IN PDEVICE_OBJECT DeviceObject,
  37. IN OUT PIRP Irp
  38. );
  39. NTSTATUS
  40. ProcessorQueryPowerState (
  41. IN PDEVICE_OBJECT DeviceObject,
  42. IN OUT PIRP Irp
  43. );
  44. NTSTATUS
  45. ProcessorSetPowerState (
  46. IN PDEVICE_OBJECT DeviceObject,
  47. IN OUT PIRP Irp
  48. );
  49. VOID
  50. HoldIoRequestsWorkerRoutine(
  51. IN PDEVICE_OBJECT DeviceObject,
  52. IN PVOID Context
  53. );
  54. NTSTATUS
  55. HoldIoRequests(
  56. IN PDEVICE_OBJECT DeviceObject,
  57. IN PIRP Irp,
  58. IN IRP_DIRECTION Direction
  59. );
  60. NTSTATUS
  61. ProcessorPowerCompletionRoutine (
  62. IN PDEVICE_OBJECT DeviceObject,
  63. IN PIRP Irp,
  64. IN PVOID Context
  65. ) ;
  66. VOID
  67. ProcessorPoRequestComplete (
  68. IN PDEVICE_OBJECT DeviceObject,
  69. IN UCHAR MinorFunction,
  70. IN POWER_STATE PowerState,
  71. IN PVOID Context,
  72. IN PIO_STATUS_BLOCK IoStatus
  73. );
  74. NTSTATUS
  75. HandleSystemPowerIrp(
  76. IN PDEVICE_OBJECT DeviceObject,
  77. IN PIRP Irp
  78. );
  79. NTSTATUS
  80. OnFinishSystemPowerUp(
  81. IN PDEVICE_OBJECT Fdo,
  82. IN PIRP Irp,
  83. IN PVOID NotUsed
  84. );
  85. VOID
  86. QueueCorrespondingDeviceIrp(
  87. IN PIRP SIrp,
  88. IN PDEVICE_OBJECT DeviceObject
  89. );
  90. VOID
  91. OnPowerRequestComplete(
  92. PDEVICE_OBJECT DeviceObject,
  93. UCHAR MinorFunction,
  94. POWER_STATE state,
  95. POWER_COMPLETION_CONTEXT* ctx,
  96. PIO_STATUS_BLOCK pstatus
  97. );
  98. NTSTATUS
  99. HandleDeviceQueryPower(
  100. PDEVICE_OBJECT DeviceObject,
  101. PIRP Irp
  102. );
  103. NTSTATUS HandleDeviceSetPower(
  104. IN PDEVICE_OBJECT DeviceObject,
  105. IN PIRP Irp
  106. );
  107. NTSTATUS
  108. OnFinishDevicePowerUp(
  109. IN PDEVICE_OBJECT DeviceObject,
  110. IN PIRP Irp,
  111. IN PVOID junk
  112. );
  113. NTSTATUS
  114. BeginSetDevicePowerState(
  115. IN PDEVICE_OBJECT DeviceObject,
  116. IN PIRP Irp,
  117. IN IRP_DIRECTION Direction
  118. );
  119. NTSTATUS
  120. FinishDevicePowerIrp(
  121. IN PDEVICE_OBJECT DeviceObject,
  122. IN PIRP Irp,
  123. IN IRP_DIRECTION Direction,
  124. IN NTSTATUS Result
  125. );
  126. #endif