31#if defined(EVENT_TRACING)
32#include "PowerIdleStateMachine.tmh"
328 m_PowerIdleMachine)->m_PkgPnp;
447 This->m_Flags &= ~FxPowerIdleIsStarted;
474 This->m_D0NotificationEvent.Clear();
500 This->SendD0Notification();
531 ASSERT(
This->m_D0NotificationEvent.ReadState() == 0);
554 This->m_Flags &= ~FxPowerIdleTimerEnabled;
580 if (
This->m_IoCount == 0) {
605 if (
This->m_IoCount == 0) {
634 This->m_PowerTimeoutTimer.Start(
This->m_PowerTimeout,
659#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
673 This->m_Flags &= ~FxPowerIdleTimerStarted;
679 This->m_D0NotificationEvent.Clear();
711 "WDFDEVICE %p idle (in D0) not sending io present event (already sent)",
715#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
752 This->m_Flags &= ~FxPowerIdleIoPresentSent;
779 This->m_Flags &= ~FxPowerIdleIoPresentSent;
803 This->m_D0NotificationEvent.Clear();
856 "WDFDEVICE %p idle (in Dx) not sending io present event (already sent)",
860#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
923 This->SendD0Notification();
928 This->m_Flags &= ~FxPowerIdleInDx;
933 This->m_Flags &= ~FxPowerIdleTimerEnabled;
938 This->m_Flags &= ~FxPowerIdleIoPresentSent;
964 This->m_Flags &= ~FxPowerIdleTimerEnabled;
1020 This->SendD0Notification();
1083 This->SendD0Notification();
1088 This->m_Flags &= ~FxPowerIdleIoPresentSent;
1101 This->SendD0Notification();
1106 This->m_Flags &= ~FxPowerIdleIoPresentSent;
1129 if (
This->CancelIdleTimer()) {
1155 This->m_Flags &= ~FxPowerIdleTimerStarted;
1178 if (
This->CancelIdleTimer()) {
1204 This->m_Flags &= ~FxPowerIdleTimerStarted;
1206#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
1246 This->m_Flags &= ~FxPowerIdleTimerEnabled;
1251 This->SendD0Notification();
1290 pThis->
m_Lock.AcquireAtDpcLevel();
1293#if FX_IS_KERNEL_MODE
1309 pThis->
m_Lock.ReleaseFromDpcLevel();
1417 disabledImmediately =
FALSE;
1420 disabledImmediately =
TRUE;
1425 return disabledImmediately;
1560 "WDFDEVICE %p in thread %p waiting synchronously for Dx to D0 "
1591 "WDFDEVICE %p waiting for D0 in thread %p failed because of "
1592 "power failure, %!STATUS!",
1601 "WDFDEVICE %p waiting for D0 in thread %p failed because of "
1602 "invalid state , %!STATUS!",
1782 "WDFDEVICE 0x%p !devobj 0x%p The device is being power-dereferenced"
1783 " without a matching power-reference. This could occur if driver"
1784 " incorrectly calls WdfDeviceResumeIdle without a matching call to"
1785 " WdfDeviceStopIdle.",
1855 m_Flags &= ~FxPowerIdleIoPresentSent;
1871 m_Flags &= ~FxPowerIdleSendPnpPowerUpEvent;
1877#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
1954 if (
entry->TargetStates[
i].PowerIdleEvent ==
Event) {
1956 newState =
entry->TargetStates[
i].PowerIdleState;
1989 "WDFDEVICE 0x%p !devobj 0x%p power idle state %!FxPowerIdleStates!"
1990 " dropping event %!FxPowerIdleEvents!",
2003 "WDFDEVICE 0x%p !devobj 0x%p entering power idle state "
2004 "%!FxPowerIdleStates! from %!FxPowerIdleStates!",
2017 newState =
entry->StateFunc(
this);
WDFDEVICE __inline GetHandle(VOID)
MdDeviceObject __inline GetDeviceObject(VOID)
__inline PFN_WDF_DRIVER_DEVICE_ADD GetDriverDeviceAddMethod()
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
__inline CfxDevice * GetDevice(VOID)
VOID PnpProcessEvent(__in FxPnpEvent Event, __in BOOLEAN ProcessEventOnDifferentThread=FALSE)
VOID PowerPolicyProcessEvent(__in FxPowerPolicyEvent Event, __in BOOLEAN ProcessEventOnDifferentThread=FALSE)
static const FxIdleStateTable m_StateTable[]
static FxPowerIdleStates InDxDisabled(__inout FxPowerIdleMachine *This)
static MdDeferredRoutineType _PowerTimeoutDpcRoutine
_Must_inspect_result_ NTSTATUS Init(VOID)
static FxPowerIdleStates PowerUp(__inout FxPowerIdleMachine *This)
MxTimer m_PowerTimeoutTimer
static const FxPowerIdleTargetState m_StoppedStates[]
static FxPowerIdleStates CheckIoCount(__inout FxPowerIdleMachine *This)
BOOLEAN QueryReturnToIdle(VOID)
static FxPowerIdleStates TimedOutEnabled(__inout FxPowerIdleMachine *This)
static const FxPowerIdleTargetState m_TimedOutStates[]
static FxPowerIdleStates DecrementIo(__inout FxPowerIdleMachine *This)
static FxPowerIdleStates TimingOut(__inout FxPowerIdleMachine *This)
static FxPowerIdleStates InDxPowerUpFailure(__inout FxPowerIdleMachine *This)
static FxPowerIdleStates InDxIoIncrement(__inout FxPowerIdleMachine *This)
VOID ProcessEventLocked(__in FxPowerIdleEvents Event)
static FxPowerIdleStates PowerUpComplete(__inout FxPowerIdleMachine *This)
static FxPowerIdleStates PowerFailed(__inout FxPowerIdleMachine *This)
static FxPowerIdleStates StartedPowerFailed(__inout FxPowerIdleMachine *This)
static FxPowerIdleStates Disabled(__inout FxPowerIdleMachine *This)
static const FxPowerIdleTargetState m_WaitForTimeoutStates[]
static const ULONG m_IdleTimerTolerableDelayMS
static const FxPowerIdleTargetState m_DisabledStates[]
static FxPowerIdleStates TimedOutPowerDown(__inout FxPowerIdleMachine *This)
static FxPowerIdleStates TimedOutPowerDownFailed(__inout FxPowerIdleMachine *This)
FxTagTracker * m_TagTracker
static FxPowerIdleStates Disabling(__inout FxPowerIdleMachine *This)
FxPowerIdleStates m_StateHistory[FxPowerIdleEventQueueDepth]
~FxPowerIdleMachine(VOID)
_Must_inspect_result_ NTSTATUS PowerReferenceWorker(__in BOOLEAN WaitForD0, __in FxPowerReferenceFlags Flags, __in_opt PVOID Tag=NULL, __in_opt LONG Line=0, __in_opt PSTR File=NULL)
static const FxPowerIdleTargetState m_StartedStates[]
FxPowerIdleEvents m_EventHistory[FxPowerIdleEventQueueDepth]
static FxPowerIdleStates StartTimer(__inout FxPowerIdleMachine *This)
static FxPowerIdleStates CancelTimer(__inout FxPowerIdleMachine *This)
FxCREvent m_D0NotificationEvent
_Must_inspect_result_ NTSTATUS IoIncrement(VOID)
static FxPowerIdleStates InDxEnabled(__inout FxPowerIdleMachine *This)
static FxPowerIdleStates TimedOutDisabled(__inout FxPowerIdleMachine *This)
static const FxPowerIdleTargetState m_BusyStates[]
static FxPowerIdleStates Started(__inout FxPowerIdleMachine *This)
_Must_inspect_result_ NTSTATUS IoIncrementWithFlags(__in FxPowerReferenceFlags Flags, __out_opt PULONG Count=NULL)
static FxPowerIdleStates GoingToDx(__inout FxPowerIdleMachine *This)
VOID SendD0Notification(VOID)
static FxPowerIdleStates TimedOutIoIncrement(__inout FxPowerIdleMachine *This)
static FxPowerIdleStates TimerExpired(__inout FxPowerIdleMachine *This)
static const FxPowerIdleTargetState m_DisablingWaitForTimeoutStates[]
static FxPowerIdleStates Stopped(__inout FxPowerIdleMachine *This)
static const FxPowerIdleTargetState m_TimerRunningStates[]
static FxPowerIdleStates StartedPowerUp(__inout FxPowerIdleMachine *This)
VOID CheckAssumptions(VOID)
LARGE_INTEGER m_PowerTimeout
BOOLEAN DisableTimer(VOID)
FxPowerIdleStates m_CurrentIdleState
VOID ProcessPowerEvent(__in FxPowerIdleEvents Event)
static FxPowerIdleStates InDxStopped(__inout FxPowerIdleMachine *This)
static const FxPowerIdleTargetState m_InDxStates[]
VOID IoDecrement(__in_opt PVOID Tag=NULL, __in_opt LONG Line=0, __in_opt PSTR File=NULL)
static FxPowerIdleStates DisablingTimerExpired(__inout FxPowerIdleMachine *This)
UCHAR m_EventHistoryIndex
static const FxPowerIdleTargetState m_PowerFailedWaitForTimeoutStates[]
UCHAR m_StateHistoryIndex
static _Must_inspect_result_ NTSTATUS __inline CreateAndInitialize(__out FxTagTracker **TagTracker, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxTagTrackerType Type, __in BOOLEAN CaptureStack, __in FxObject *Owner, __in_opt PVOID CreateTag=NULL)
VOID UpdateTagHistory(__in PVOID Tag, __in LONG Line, __in_opt PSTR File, __in FxTagRefType RefType, __in ULONG RefCount)
CHECK_RETURN_IF_USER_MODE __inline NTSTATUS Initialize(__in_opt PVOID TimerContext, __in MdDeferredRoutine TimerCallback, __in LONG Period)
static __inline MxThread MxGetCurrentThread()
static __inline KIRQL MxGetCurrentIrql()
#define TRACINGPNPPOWERSTATES
#define NT_SUCCESS(StatCode)
#define __drv_requiresIRQL(irql)
#define __drv_maxIRQL(irql)
#define __drv_minIRQL(irql)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS pFxDriverGlobals
FxVerifierDbgBreakPoint(pFxDriverGlobals)
@ FxTrackPowerRefsAndStack
FORCEINLINE VOID FxPerfTraceDpc(_In_ PVOID DriverCallback)
@ FxPowerIdleSendPnpPowerUpEvent
@ FxPowerIdleTimerEnabled
@ FxPowerIdleTimerStarted
@ FxPowerIdleIoPresentSent
@ FxIdleDisablingWaitForTimeout
@ FxIdleTimedOutIoIncrement
@ FxIdleTimedOutPowerDown
@ FxIdleDisablingTimerExpired
@ FxIdlePowerFailedWaitForTimeout
@ FxIdleInDxPowerUpFailure
@ FxIdleTimedOutPowerDownFailed
@ FxIdleStartedPowerFailed
@ FxPowerReferenceDefault
@ FxPowerReferenceSendPnpPowerUpEvent
@ PowerIdleEventIoIncrement
@ PowerIdleEventPowerUpComplete
@ PowerIdleEventPowerDown
@ PowerIdleEventPowerDownFailed
@ PowerIdleEventTimerExpired
@ PowerIdleEventPowerUpFailed
@ PowerIdleEventIoDecrement
@ PwrPolPowerTimeoutExpired
GLuint GLuint GLsizei count
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define _Must_inspect_result_
#define UNREFERENCED_PARAMETER(P)
#define STATUS_POWER_STATE_INVALID
__inline FxPkgPnp * GetPnpPkg(__inout FxPowerIdleMachine *This)
#define TRACE_LEVEL_VERBOSE
#define TRACE_LEVEL_ERROR
#define TRACE_LEVEL_INFORMATION
CHECK_RETURN_IF_USER_MODE NTSTATUS Initialize(__in BOOLEAN InitialState=FALSE)
FxTrackPowerOption TrackPower
FxDriverGlobalsDebugExtension * DebugExtension
_Must_inspect_result_ BOOLEAN IsVerificationEnabled(__in ULONG Major, __in ULONG Minor, __in FxVerifierDownlevelOption DownLevel)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN WaitForD0
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
EVT_WDF_DRIVER_DEVICE_ADD * PFN_WDF_DRIVER_DEVICE_ADD
_Must_inspect_result_ _In_ ULONG Flags
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2