- Implement PcRequestNewPowerState

svn path=/trunk/; revision=38723
This commit is contained in:
Johannes Anderwald 2009-01-12 15:57:49 +00:00
parent 0afaa05791
commit db8b3ac429
2 changed files with 47 additions and 23 deletions

View file

@ -36,3 +36,50 @@ PcRegisterAdapterPowerManagement(
DeviceExt->AdapterPowerManagement = pPower;
return STATUS_SUCCESS;
}
static
VOID
NTAPI
PwrCompletionCallback(
IN PDEVICE_OBJECT DeviceObject,
IN UCHAR MinorFunction,
IN POWER_STATE PowerState,
IN PVOID Context,
IN PIO_STATUS_BLOCK IoStatus)
{
KeSetEvent((PRKEVENT)Context, IO_NO_INCREMENT, FALSE);
}
/*
* @implemented
*/
NTSTATUS NTAPI
PcRequestNewPowerState(
IN PDEVICE_OBJECT DeviceObject,
IN DEVICE_POWER_STATE RequestedNewState)
{
KEVENT Event;
NTSTATUS Status;
POWER_STATE PowerState;
PCExtension* DeviceExt;
if (!DeviceObject || !RequestedNewState)
return STATUS_INVALID_PARAMETER;
DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
PowerState.DeviceState = RequestedNewState;
PowerState.SystemState = PowerSystemUnspecified;
Status = PoRequestPowerIrp(DeviceExt->PhysicalDeviceObject, IRP_MN_SET_POWER, PowerState, PwrCompletionCallback, (PVOID)&Event, NULL);
if (NT_SUCCESS(Status))
{
KeWaitForSingleObject((PVOID)&Event, Executive, KernelMode, FALSE, NULL);
}
return Status;
}

View file

@ -12,29 +12,6 @@
#include "private.h"
#include <portcls.h>
/*
Factory Stubs
*/
/* ===============================================================
Power Management
*/
/*
* @unimplemented
*/
NTSTATUS NTAPI
PcRequestNewPowerState(
IN PDEVICE_OBJECT pDeviceObject,
IN DEVICE_POWER_STATE RequestedNewState)
{
UNIMPLEMENTED;
return STATUS_UNSUCCESSFUL;
}
/* ===============================================================
Properties
*/