50 #define DEBUGGED_EVENT , TRUE
51 #define TRAP_ON_EVENT , FALSE
53 #define DO_EVENT_TRAP(x) if ((x)->EventDebugged == FALSE) { COVERAGE_TRAP(); }
55 #define EVENT_TRAP_FIELD BOOLEAN EventDebugged;
59 #define DEBUGGED_EVENT
61 #define DO_EVENT_TRAP(x) (0)
64 #define EVENT_TRAP_FIELD
68#if FX_STATE_MACHINE_VERIFY
69enum FxStateMachineDeviceType {
70 FxSmDeviceTypeInvalid = 0,
463 AcquireParentPowerStateLock(
472 ReleaseParentPowerStateLock(
2878#if FX_STATE_MACHINE_VERIFY
2880 CPPNP_STATE_ENTRY_FN_RETURN_STATE_TABLE
2881 GetPnpStateEntryFunctionReturnStatesTableEntry(
2889 CPPOWER_STATE_ENTRY_FN_RETURN_STATE_TABLE
2890 GetPowerStateEntryFunctionReturnStatesTableEntry(
2898 CPPWR_POL_STATE_ENTRY_FN_RETURN_STATE_TABLE
2899 GetPwrPolStateEntryFunctionReturnStatesTableEntry(
2907 ValidatePnpStateEntryFunctionReturnValue(
2913 ValidatePowerStateEntryFunctionReturnValue(
2919 ValidatePwrPolStateEntryFunctionReturnValue(
3056 Irp->MarkIrpPending();
3087 Irp->MarkIrpPending();
3262 __in BOOLEAN CallerSpecifiedProcessingOnDifferentThread
3268 __in BOOLEAN CallerSpecifiedProcessingOnDifferentThread
4058#if FX_IS_KERNEL_MODE
4284#if (FX_CORE_MODE==FX_CORE_KERNEL_MODE)
4303#if (FX_CORE_MODE==FX_CORE_USER_MODE)
4511#if FX_STATE_MACHINE_VERIFY
4515 static const PNP_STATE_ENTRY_FN_RETURN_STATE_TABLE m_WdfPnpStateEntryFunctionReturnStates[];
4516 static const POWER_STATE_ENTRY_FN_RETURN_STATE_TABLE m_WdfPowerStateEntryFunctionReturnStates[];
4517 static const PWR_POL_STATE_ENTRY_FN_RETURN_STATE_TABLE m_WdfPwrPolStateEntryFunctionReturnStates[];
4572 PkgPnp->SignalDeviceRemovedEvent();
4583 (
void) PkgPnp->FireAndForgetIrp(&
irp);
4587 PkgPnp->ProcessDelayedDeletion();
#define InterlockedIncrement
#define InterlockedDecrement
const struct winhelp_callbacks Callbacks
SYSTEM_POWER_STATE_CONTEXT GetParameterPowerSystemPowerStateContext()
VOID SetStatus(__in NTSTATUS Status)
DEVICE_POWER_STATE GetParameterPowerStateDeviceState()
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
static WDF_DEVICE_POWER_STATE PowerStartingChild(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpInitOtherStates[]
static WDF_DEVICE_POWER_POLICY_STATE PowerPolSystemWakeDeviceWakeCompletePowerUp(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_POLICY_STATE NotPowerPolOwnerStopping(__inout FxPkgPnp *This)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolStoppingD0OtherStates[]
static WDF_SPECIAL_FILE_TYPE _UsageToSpecialType(__in DEVICE_USAGE_NOTIFICATION_TYPE Type)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolSystemWakeDeviceWakeCompletePowerUpOtherStates[]
VOID SetInternalFailure(VOID)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolDeviceIdleSleeping(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventRestartReleaseHardware(__inout FxPkgPnp *This)
BOOLEAN IsSxWakeEnabled(VOID)
FxCmResList * GetTranslatedResourceList(VOID)
static WDF_DEVICE_POWER_STATE PowerDxSurpriseRemovedPowerUp(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpQueriedRemovingOtherStates[]
static CPPOWER_POLICY_STATE_TABLE GetPowerPolicyTableEntry(__in WDF_DEVICE_POWER_POLICY_STATE State)
static WDF_DEVICE_POWER_STATE PowerReportPowerDownFailed(__inout FxPkgPnp *This)
VOID AddInterruptObject(__in FxInterrupt *Interrupt)
static WDF_DEVICE_POWER_POLICY_STATE NotPowerPolOwnerStoppingPoweringDown(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_STATE PowerWakingDmaEnable(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventHardwareAvailablePowerPolicyFailed(__inout FxPkgPnp *This)
BOOLEAN PowerDmaEnableAndScan(__in BOOLEAN ImplicitPowerUp)
static MdCancelRoutineType _PowerWaitWakeCancelRoutine
static WDF_DEVICE_POWER_STATE PowerD0DisarmingWakeAtBusNP(__inout FxPkgPnp *This)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolCancelingWakeForSystemSleepWakeCanceledOtherStates[]
VOID RemoveUsageDevice(__in MdDeviceObject DependentDevice)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolTimerExpiredWakeCapablePowerDownNotProcessed(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_STATE PowerD0ArmedForWake(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_STATE PowerNotifyingD0ExitToWakeInterruptsNP(__inout FxPkgPnp *This)
VOID QueueToPowerThread(__in PWORK_QUEUE_ITEM WorkItem)
FxPnpStateCallback * m_PnpStateCallbacks
VOID PnpCheckAssumptions(VOID)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolSystemAsleepWakeArmedOtherStates[]
static WDF_DEVICE_POWER_POLICY_STATE NotPowerPolOwnerRemoved(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolSleepingWakePowerDownFailedWakeCanceled(__inout FxPkgPnp *This)
BOOLEAN IsPresentPendingPnpIrp(VOID)
FxCmResList * m_Resources
VOID ProcessDelayedDeletion(VOID)
VOID PowerPolicyPostParentToD0ToChildren(VOID)
static const POWER_EVENT_TARGET_STATE m_PowerD0BusWakeOwnerNPOtherStates[]
_Must_inspect_result_ NTSTATUS AllocateEnumInfo(VOID)
FxPnpDeviceUsageNotificationEx m_DeviceUsageNotificationEx
static WDF_DEVICE_PNP_STATE PnpEventInitSurpriseRemoved(__inout FxPkgPnp *This)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolSystemAsleepWakeArmedNPOtherStates[]
static _Must_inspect_result_ NTSTATUS _PnpCancelRemoveDevice(__inout FxPkgPnp *This, __inout FxIrp *Irp)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolSystemAsleepNoWake(__inout FxPkgPnp *This)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolWaitingArmedWakeInterruptFiredOtherStates[]
VOID ChildListNotifyRemove(__inout PLONG PendingCount)
static const POWER_POLICY_EVENT_TARGET_STATE m_NotPowerPolOwnerGotoD0States[]
static const POWER_POLICY_EVENT_TARGET_STATE m_NotPowerPolOwnerRemovedStates[]
static const POWER_POLICY_EVENT_TARGET_STATE m_NotPowerPolOwnerStoppingPoweringDownStates[]
static WDF_DEVICE_POWER_STATE PowerWakePendingNP(__inout FxPkgPnp *This)
VOID AddQueryInterface(__in FxQueryInterface *QI, __in BOOLEAN Lock)
VOID RegisterPowerPolicyCallbacks(__in PWDF_POWER_POLICY_EVENT_CALLBACKS Callbacks)
PFN_IO_REPORT_INTERRUPT_INACTIVE m_IoReportInterruptInactive
static WDF_DEVICE_POWER_POLICY_STATE PowerPolTimerExpiredWakeCapableWakeCanceled(__inout FxPkgPnp *This)
BOOLEAN HasMultipleInterrupts(VOID)
_Must_inspect_result_ NTSTATUS QueryForCapabilities(VOID)
static _Must_inspect_result_ NTSTATUS _PnpRemoveDevice(__inout FxPkgPnp *This, __inout FxIrp *Irp)
BOOLEAN PowerGotoDxIoStoppedNP(VOID)
static WDF_DEVICE_POWER_STATE PowerStartSelfManagedIoFailed(__inout FxPkgPnp *This)
FxSystemThread * m_PowerThread
_Must_inspect_result_ NTSTATUS HandleQueryBusInformation(__inout FxIrp *Irp)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolTimerExpiredNoWakePowerDownNotProcessed(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventRemovedChildrenRemoved(__inout FxPkgPnp *This)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolSystemWakeDeviceWakeEnabledWakeCanceledNPOtherStates[]
VOID PowerCompleteWakeRequestFromWithinMachine(__in NTSTATUS Status)
friend FxPowerPolicyMachine
static WDF_DEVICE_POWER_POLICY_STATE NotPowerPolOwnerStarting(__inout FxPkgPnp *This)
static VOID STDCALL _PowerThreadInterfaceDereference(__inout PVOID Context)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolStarted(__inout FxPkgPnp *This)
BOOLEAN IsS0IdleSystemManaged(VOID)
virtual VOID ReleaseReenumerationInterface(VOID)=0
static WDF_DEVICE_POWER_POLICY_STATE PowerPolSleepingWakeRevertArmWakeNP(__inout FxPkgPnp *This)
VOID __inline PowerPolicyDisarmWakeFromSx(VOID)
ULONG m_InterruptObjectCount
static const PNP_EVENT_TARGET_STATE m_PnpStartedStoppingOtherStates[]
static const PNP_EVENT_TARGET_STATE m_PnpStoppedOtherStates[]
_Must_inspect_result_ NTSTATUS CreatePowerThread(VOID)
static WDF_DEVICE_PNP_STATE PnpEventQueryCanceled(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventQueryStopStaticCheck(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolSleepingNoWakeDxRequestFailed(__inout FxPkgPnp *This)
virtual WDF_DEVICE_POWER_STATE PowerCheckDeviceTypeNPOverload(VOID)=0
static const POWER_POLICY_EVENT_TARGET_STATE m_NotPowerPolOwnerGotoDxStates[]
SINGLE_LIST_ENTRY m_DeviceInterfaceHead
FxWaitLockInternal m_QueryInterfaceLock
virtual WDF_DEVICE_PNP_STATE PnpEventFdoRemovedOverload(VOID)=0
FxSelfManagedIoMachine * m_SelfManagedIoMachine
static WDF_DEVICE_POWER_STATE PowerCheckDeviceTypeNP(__inout FxPkgPnp *This)
_Must_inspect_result_ NTSTATUS PnpPowerReferenceDuringQueryPnp(VOID)
VOID PowerSendPowerDownFailureEvent(__in FxPowerDownType Type)
VOID SetPendingDevicePowerIrp(__inout FxIrp *Irp)
static const POWER_POLICY_EVENT_TARGET_STATE m_NotPowerPolOwnerObjectCreatedStates[]
LONG m_SpecialFileCount[WdfSpecialFileMax-1]
_Must_inspect_result_ NTSTATUS PnpDeviceUsageNotification(__inout FxIrp *Irp)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolStoppingFailed(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventStartedCancelStop(__inout FxPkgPnp *This)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolS0WakeCompletePowerUpOtherStates[]
FxCmResList * m_ResourcesRaw
static const PNP_EVENT_TARGET_STATE m_PnpRemovedPdoWaitOtherStates[]
PNP_BUS_INFORMATION m_BusInformation
BOOLEAN PowerIsWakeRequestPresent(VOID)
_Must_inspect_result_ NTSTATUS PnpEnableInterfacesAndRegisterWmi(VOID)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolWakeCapableDeviceIdleOtherStates[]
FxRelatedDeviceList * m_UsageDependentDeviceList
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolTimerExpiredWakeCapablePowerDownFailedWakeInterruptArrivedOtherStates[]
static WDF_DEVICE_POWER_POLICY_STATE PowerPolSystemSleepNeedWakeCompletePowerUp(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_POLICY_STATE NotPowerPolOwnerStoppingPoweringUp(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolSystemWakeQueryIdle(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolTimerExpiredNoWakePoweredDownDisableIdleTimer(__inout FxPkgPnp *This)
VOID DisconnectInterruptNP(VOID)
PFN_IO_DISCONNECT_INTERRUPT_EX m_IoDisconnectInterruptEx
static WDF_DEVICE_POWER_STATE PowerD0DisarmingWakeAtBus(__inout FxPkgPnp *This)
static NTSTATUS _SxWakeSetItem(__in CfxDevice *Device, __in FxWmiInstanceInternal *Instance, __in ULONG DataItemId, __in ULONG InBufferSize, __in PVOID InBuffer)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolStopping(__inout FxPkgPnp *This)
VOID PnpPowerPolicySurpriseRemove(VOID)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolStartingDecideS0Wake(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_STATE PowerD0NP(__inout FxPkgPnp *This)
FxPowerStateCallback * m_PowerStateCallbacks
static WDF_DEVICE_POWER_POLICY_STATE PowerPolStartedCancelTimer(__inout FxPkgPnp *This)
BOOLEAN m_ReleaseHardwareAfterDescendantsOnFailure
static VOID STDCALL _PowerThreadInterfaceReference(__inout PVOID Context)
BOOLEAN PowerPolicyCancelWaitWake(VOID)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolTimerExpiredWakeCapableWakeSucceededOtherStates[]
static WDF_DEVICE_POWER_STATE PowerSurpriseRemoved(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpStartedStoppingFailedOtherStates[]
static WDF_DEVICE_PNP_STATE PnpEventQueriedRemoving(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolTimerExpiredWakeCapableWakeArrived(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventQueriedSurpriseRemove(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_STATE PowerReportPowerUpFailedDerefParent(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_POLICY_STATE PowerPolS0WakeDisarm(__inout FxPkgPnp *This)
static WDF_DEVICE_POWER_POLICY_STATE NotPowerPolOwnerStoppingSendStatus(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventStartedRemoving(__inout FxPkgPnp *This)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolObjectCreatedOtherStates[]
static WDF_DEVICE_POWER_STATE PowerD0SurpriseRemoved(__inout FxPkgPnp *This)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolTimerExpiredWakeCapablePowerDownFailedCancelWakeOtherStates[]
static WDF_DEVICE_POWER_POLICY_STATE PowerPolSystemWakeDeviceWakeTriggeredS0(__inout FxPkgPnp *This)
FxPowerMachine m_PowerMachine
static WDF_DEVICE_POWER_POLICY_STATE PowerPolTimerExpiredWakeCompletedPowerDown(__inout FxPkgPnp *This)
LONG m_PowerThreadInterfaceReferenceCount
static WDF_DEVICE_POWER_POLICY_STATE PowerPolCancelingUsbSSForSystemSleep(__inout FxPkgPnp *This)
virtual VOID PowerParentPowerDereference(VOID)=0
BOOLEAN ShouldProcessPowerPolicyEventOnDifferentThread(__in KIRQL CurrentIrql, __in BOOLEAN CallerSpecifiedProcessingOnDifferentThread)
static const POWER_POLICY_EVENT_TARGET_STATE m_PowerPolTimerExpiredWakeCapableCancelWakeOtherStates[]
static const PWCHAR m_RestartStartAchievedName
FxPnpDeviceD0Exit m_DeviceD0Exit
UCHAR m_SystemPowerAction