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.

169 lines
3.0 KiB

  1. /*Copyright (c) 1999-2000 Microsoft Corporation
  2. Module Name:
  3. power.c
  4. Abstract:
  5. This module contains the Power routines for softpci.sys
  6. Author:
  7. Brandon Allsop (BrandonA) Feb. 2000
  8. Revision History:
  9. --*/
  10. #include "pch.h"
  11. NTSTATUS
  12. SoftPCIDefaultPowerHandler(
  13. IN PDEVICE_OBJECT DeviceObject,
  14. IN PIRP Irp
  15. )
  16. /*++
  17. Routine Description:
  18. Default routine to pass down power irps
  19. Arguments:
  20. DeviceObject - pointer to a device object.
  21. Irp - pointer to an I/O Request Packet.
  22. Return Value:
  23. NT status code
  24. --*/
  25. {
  26. NTSTATUS status;
  27. PSOFTPCI_DEVICE_EXTENSION devExt = (PSOFTPCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
  28. PoStartNextPowerIrp(Irp);
  29. IoSkipCurrentIrpStackLocation(Irp);
  30. status = PoCallDriver(devExt->LowerDevObj, Irp);
  31. return status;
  32. }
  33. NTSTATUS
  34. SoftPCIFDOPowerHandler(
  35. PDEVICE_OBJECT DeviceObject,
  36. PIRP Irp
  37. )
  38. /*++
  39. Routine Description:
  40. Handles Power IRPs for FDO
  41. Arguments:
  42. DeviceObject - pointer to the device object.
  43. Irp - PnP Irp to be dispatched.
  44. Return Value:
  45. NTSTATUS.
  46. --*/
  47. {
  48. PIO_STACK_LOCATION irpSp;
  49. //PSOFTPCI_DEVICE_EXTENSION devExt = (PSOFTPCI_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
  50. NTSTATUS status;
  51. irpSp = IoGetCurrentIrpStackLocation(Irp);
  52. //
  53. //BUGBUG BrandonA:
  54. // Currently we do not really keep track of our device state and therefore
  55. // we dont check if we have been removed etc before dealing with these IRPS.
  56. //
  57. // Later when we start dynamically removing our SoftPCI devices and are keeping
  58. // track of things more closely we will want to update this code as well to
  59. // stay in sync.
  60. //
  61. // Check the request type.
  62. //
  63. switch (irpSp->MinorFunction) {
  64. case IRP_MN_SET_POWER :
  65. status = SoftPCISetPower(DeviceObject, Irp);
  66. break;
  67. case IRP_MN_QUERY_POWER :
  68. status = SoftPCIQueryPowerState(DeviceObject, Irp);
  69. break;
  70. case IRP_MN_WAIT_WAKE :
  71. case IRP_MN_POWER_SEQUENCE :
  72. default:
  73. //
  74. // Pass it down
  75. //
  76. status = SoftPCIDefaultPowerHandler(DeviceObject, Irp);
  77. break;
  78. }
  79. return status;
  80. }
  81. NTSTATUS
  82. SoftPCISetPower(
  83. IN PDEVICE_OBJECT DeviceObject,
  84. IN PIRP Irp
  85. )
  86. {
  87. //Currently we do nothing but pass the IRP down
  88. return SoftPCIDefaultPowerHandler(DeviceObject, Irp);
  89. }
  90. NTSTATUS
  91. SoftPCIQueryPowerState(
  92. IN PDEVICE_OBJECT DeviceObject,
  93. IN PIRP Irp
  94. )
  95. {
  96. //Currently we do nothing but pass the IRP down
  97. return SoftPCIDefaultPowerHandler(DeviceObject, Irp);
  98. }