35#if defined(EVENT_TRACING)
36#include "PnpStateMachine.tmh"
62#if FX_STATE_MACHINE_VERIFY
63 #define VALIDATE_PNP_STATE(_CurrentState, _NewState) \
64 ValidatePnpStateEntryFunctionReturnValue((_CurrentState), (_NewState))
66 #define VALIDATE_PNP_STATE(_CurrentState, _NewState) (0)
852 "WDFDEVICE 0x%p !devobj 0x%p current pnp state %!WDF_DEVICE_PNP_STATE! "
853 "dropping event %!FxPnpEvent! because of a full queue",
864 ASSERT(!
"The PnP queue is full. This shouldn't be able to happen.");
871 "WDFDEVICE 0x%p !devobj 0x%p current pnp state %!WDF_DEVICE_PNP_STATE! "
872 "dropping event %!FxPnpEvent! because of a closed queue",
916 ProcessOnDifferentThread
924 if (FxWaitLockInternal::IsLockAcquired(
status)) {
963 This->m_PnpMachine.m_StateMachineLock.AcquireLock(
964 This->GetDriverGlobals()
981 This->m_PnpMachine.m_StateMachineLock.ReleaseLock(
982 This->GetDriverGlobals()
1051 if (
entry->StateInfo.Bits.QueueOpen ==
FALSE) {
1069 if (
entry->FirstTargetState.PnpEvent ==
event) {
1070 newState =
entry->FirstTargetState.TargetState;
1074 else if (
entry->OtherTargetStates !=
NULL) {
1080 if (
entry->OtherTargetStates[
i].PnpEvent ==
event) {
1081 newState =
entry->OtherTargetStates[
i].TargetState;
1091 "WDFDEVICE 0x%p !devobj 0x%p current pnp state "
1092 "%!WDF_DEVICE_PNP_STATE! dropping event %!FxPnpEvent!",
1098 if ((
entry->StateInfo.Bits.KnownDroppedEvents &
event) == 0) {
1103 "WDFDEVICE 0x%p !devobj %p current state "
1104 "%!WDF_DEVICE_PNP_STATE!, policy event %!FxPnpEvent! is not"
1105 " a known dropped event, known dropped events are "
1111 entry->StateInfo.Bits.KnownDroppedEvents);
1183 "WDFDEVICE 0x%p !devobj 0x%p entering PnP State "
1184 "%!WDF_DEVICE_PNP_STATE! from %!WDF_DEVICE_PNP_STATE!",
1197 data.Data.LeaveState.CurrentState = currentState;
1198 data.Data.LeaveState.NewState = newState;
1216 data.Data.EnterState.CurrentState = currentState;
1217 data.Data.EnterState.NewState = newState;
1226 currentState = newState;
1234 newState =
entry->StateFunc(
this);
1252 data.Data.PostProcessState.CurrentState = currentState;
1283 return This->PnpEventCheckForDevicePresenceOverload();
1307 return This->PnpEventEjectHardwareOverload();
1328 if (
This->PnpSendStartDeviceDownTheStackOverload() ==
FALSE) {
1359 This->PnpFinishProcessingIrp(
TRUE);
1388 This->QueryForReenumerationInterface();
1397 if (matched ==
FALSE) {
1433 if (
This->IsPowerPolicyOwner()) {
1443 "could not query caps for stack, %!STATUS!",
status);
1452 This->PnpPowerPolicyStart();
1481 status =
This->PnpEnableInterfacesAndRegisterWmi();
1548 status =
This->m_DeviceQueryRemove.Invoke(
This->m_Device->GetHandle());
1564 "EvtDeviceQueryRemove failed, %!STATUS!",
status);
1569 "EvtDeviceQueryRemove returned an invalid status "
1570 "STATUS_NOT_SUPPORTED");
1610 status =
This->PnpPowerReferenceDuringQueryPnp();
1627 "StopIdle on WDFDEVICE %p failed, %!STATUS!, failing query remove",
1692 completeQuery =
TRUE;
1694 if (
This->m_DeviceStopCount != 0) {
1697 "Failing QueryRemoveDevice because the driver "
1698 "has indicated that it cannot be stopped, count %d",
1699 This->m_DeviceStopCount);
1703 else if (
This->IsInSpecialUse()) {
1706 "Failing QueryRemoveDevice due to open special file counts "
1707 "(paging %d, hiber %d, dump %d, boot %d)",
1719 completeQuery =
FALSE;
1723 if (completeQuery) {
1767 This->PnpPowerPolicyStop();
1768 This->PnpPowerDereferenceSelf();
1799 status =
This->m_DeviceQueryStop.Invoke(
This->m_Device->GetHandle());
1810 "EvtDeviceQueryStop failed, %!STATUS!",
status);
1815 "EvtDeviceQueryStop returned an invalid status "
1816 "STATUS_NOT_SUPPORTED");
1858 status =
This->PnpPowerReferenceDuringQueryPnp();
1875 "StopIdle on WDFDEVICE %p failed, %!STATUS!, failing query stop",
1940 if (
This->m_DeviceStopCount != 0) {
1943 "Failing QueryStopDevice because the driver "
1944 "has indicated that it cannot be stopped, count %d",
1945 This->m_DeviceStopCount);
1949 else if (
This->IsInSpecialUse()) {
1952 "Failing QueryStopDevice due to open special file counts (paging %d,"
1953 " hiber %d, dump %d, boot %d)",
1966 completeQuery =
FALSE;
1969 if (completeQuery) {
2077 This->PnpPowerDereferenceSelf();
2108 This->ChildListNotifyRemove(&
This->m_PendingChildCount);
2144 return This->PnpEventPdoRemovedOverload();
2165 if (
This->m_DeviceRemoveProcessed !=
NULL) {
2166 This->m_SetDeviceRemoveProcessed =
TRUE;
2193 This->m_DeviceSurpriseRemoval.Invoke(
This->m_Device->GetHandle());
2199 This->PnpEventSurpriseRemovePendingOverload();
2204 This->PnpFinishProcessingIrp();
2327 "EvtDeviceReleaseHardware %p failed, %!STATUS!",
2336 This->PnpPowerPolicyRemove();
2365 This->m_Device->FxLogDeviceStartTelemetryEvent();
2368 This->PnpFinishProcessingIrp();
2435 This->PnpPowerPolicyStop();
2462 This->PnpPowerPolicyStart();
2495 if (matched ==
FALSE) {
2542 This->NotifyResourceobjectsToReleaseResources();
2548 "EvtDeviceReleaseHardware failed - %!STATUS!",
2552 This->SetInternalFailure();
2560 This->PnpFinishProcessingIrp();
2583 if (
This->PnpSendStartDeviceDownTheStackOverload() ==
FALSE) {
2620 This->PnpPowerPolicyStop();
2621 This->PnpPowerDereferenceSelf();
2648 This->m_DeviceSurpriseRemoval.Invoke(
This->m_Device->GetHandle());
2653 This->PnpEventSurpriseRemovePendingOverload();
2725 return This->PnpEventFdoRemovedOverload();
2748 This->PnpPowerDereferenceSelf();
2777 This->m_DeviceSurpriseRemoval.Invoke(
This->m_Device->GetHandle());
2782 This->PnpEventSurpriseRemovePendingOverload();
2818 This->PnpPowerPolicyStop();
2842 This->PnpPowerPolicySurpriseRemove();
2898 This->PnpPowerPolicyRemove();
2936 This->PnpCheckAndIncrementRestartCount()) {
2941 This->AskParentToRemoveAndReenumerate();
2951 This->m_Device->GetPhysicalDevice()
2959 This->m_Device->GetDeviceObject()
2992 This->m_DeviceSurpriseRemoval.Invoke(
This->m_Device->GetHandle());
2997 This->PnpEventSurpriseRemovePendingOverload();
3036 This->PnpFinishProcessingIrp();
3062 This->ReleasePowerThread();
3067 This->ReleaseReenumerationInterface();
3069 This->PnpFinishProcessingIrp();
3094 This->m_Device->EarlyDispose();
3101 This->m_Device->DestroyChildren();
3127 This->PnpPowerPolicyStop();
3155 "EvtDeviceReleaseHardware failed with %!STATUS!",
status);
3159 This->SetInternalFailure();
3165 if (
This->PnpSendStartDeviceDownTheStackOverload() ==
FALSE) {
3204 if (matched ==
FALSE) {
3221 This->PnpPowerPolicyStart();
3259 This->m_PowerThreadInterfaceReferenceCount = 1;
3268 This->m_PendingChildCount = 1;
3276 This->m_Device->m_PkgIo->ResetStateForRestart();
3278 if (
This->IsPowerPolicyOwner()) {
3279 This->m_PowerPolicyMachine.m_Owner->m_PowerIdleMachine.Reset();
3292 This->m_WakeInterruptsKeepConnected =
FALSE;
3321 return This->PnpGetPostRemoveState();
3354 if (
This->m_DeviceRemoveProcessed ==
NULL) {
3356 This->m_Device->GetRemoveLock(),
3375 if (
This->m_Device->m_ParentWaitingOnChild) {
3380 if (
This->m_DeviceRemoveProcessed ==
NULL) {
3391 This->m_Device->GetRemoveLock(),
3398 This->m_PnpMachine.SetDelayedDeletion();
3404 This->m_SetDeviceRemoveProcessed =
TRUE;
3450#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
3478FxPkgPnp::PnpPrepareHardware(
3497 *ResourcesMatched =
FALSE;
3523 *ResourcesMatched =
FALSE;
3529#if (FX_CORE_MODE == FX_CORE_USER_MODE)
3563 *ResourcesMatched =
TRUE;
3579 "EvtDevicePrepareHardware failed %!STATUS!",
status);
3584 "EvtDevicePrepareHardware returned an invalid status "
3585 "STATUS_NOT_SUPPORTED");
3609 "PrepareHardware failed %!STATUS!",
status);
3653 "EvtDeviceReleaseHardware returned an invalid status "
3654 "STATUS_NOT_SUPPORTED");
3661#if (FX_CORE_MODE == FX_CORE_USER_MODE)
3918 "Entering PnpMatchResources");
3939 "Could not allocate raw resource list for WDFDEVICE 0x%p, %!STATUS!",
3948 "Could not allocate translated resource list for WDFDEVICE 0x%p, %!STATUS!",
3973 curTrans != endTrans;
3974 curTrans = curTrans->
Next(), curRaw = curRaw->
Next()) {
3991 "Not enough interrupt objects created by WDFDEVICE 0x%p",
4003 (messageCount > 1)) {
4040#if FX_IS_KERNEL_MODE
4067 ULONG characteristics;
4091 "Exiting PnpMatchResources %!STATUS!",
status);
4163 for (pleFwd =
ple->Flink;
4165 pleFwd = pleFwd->
Flink) {
4186 for (pleFwd =
ple->Flink;
4188 pleFwd = pleFwd->
Flink) {
4267 if (&
res->m_DescriptorClone == *CmResource) {
4279 "The translated PCM_PARTIAL_RESOURCE_DESCRIPTOR 0x%p is not valid, "
4280 "WDFDEVICE 0x%p, %!STATUS!",
4293 "The raw PCM_PARTIAL_RESOURCE_DESCRIPTOR 0x%p is not valid, "
4294 "WDFDEVICE 0x%p, %!STATUS!",
4303 if (
sizeof(
res->m_Descriptor) !=
4306 sizeof(
res->m_Descriptor))) {
4310 "The translated PCM_PARTIAL_RESOURCE_DESCRIPTOR 0x%p is not valid, "
4311 "driver cannot change the assigned PnP resources, WDFDEVICE 0x%p, "
4325 "The raw PCM_PARTIAL_RESOURCE_DESCRIPTOR 0x%p is not valid, "
4326 "driver cannot change the assigned PnP resources, WDFDEVICE 0x%p, "
4337 *CmResource = &
res->m_Descriptor;
4376 cmIntResourceRaw = CmIntResourceRaw;
4377 cmIntResource = CmIntResource;
4395 "The raw PCM_PARTIAL_RESOURCE_DESCRIPTOR 0x%p is not an "
4396 "interrupt resource, WDFDEVICE 0x%p, %!STATUS!",
4406 "The translated PCM_PARTIAL_RESOURCE_DESCRIPTOR 0x%p is not an "
4407 "interrupt resource, WDFDEVICE 0x%p, %!STATUS!",
4433 if (messageCount != 0) {
4437 "Multi-message MSI 2.2 interrupts must be created "
4438 "sequentially, WDFDEVICE 0x%p, %!STATUS!",
4451 "The PCM_PARTIAL_RESOURCE_DESCRIPTOR 0x%p was already used "
4452 "to create a wakable interrupt 0x%p, WDFDEVICE 0x%p and "
4453 "any functional interrupt being shared with wakable interrupt "
4454 "can not use passive level handling",
4465 "The PCM_PARTIAL_RESOURCE_DESCRIPTOR 0x%p was already used "
4466 "to create a passive level interrupt 0x%p, WDFDEVICE 0x%p and "
4467 "is now being used to create a wakable interrupt. A functional "
4468 "passive level interrupt can not be shared with wakable interrupt",
4483 "The PCM_PARTIAL_RESOURCE_DESCRIPTOR 0x%p was already used "
4484 "to create interrupt 0x%p, WDFDEVICE 0x%p",
4500 "All the MSI 2.2 interrupts for "
4501 "PCM_PARTIAL_RESOURCE_DESCRIPTOR 0x%p are already created, "
4502 "WDFDEVICE 0x%p, %!STATUS!",
4515#define RESTART_START_ACHIEVED_NAME L"StartAchieved"
4516#define RESTART_START_TIME_NAME L"StartTime"
4517#define RESTART_COUNT_NAME L"Count"
4590 BOOLEAN started, writeTick, writeCount, writeStarted;
4600 writeStarted =
FALSE;
4609 writeStarted =
TRUE;
4617 if (CreatedNewKey) {
4634 &valueNameStartTime,
4646 status = FxRegKey::_QueryULong(RestartKey,
4703 if (started ==
FALSE) {
4707 &valueNameStartAchieved,
4716 started =
value != 0;
4735 writeStarted =
TRUE;
4754 status2 = FxRegKey::_SetValue(RestartKey,
4758 sizeof(currentTickCount.
QuadPart));
4768 status = FxRegKey::_SetValue(RestartKey,
4778 status2 = FxRegKey::_SetValue(RestartKey,
#define InterlockedDecrement
static FxChildList * _FromEntry(__in FxTransactionedEntry *Entry)
VOID NotifyDeviceSurpriseRemove(VOID)
VOID DeletePortResourceTable(VOID)
VOID ValidateResourceUnmap(VOID)
NTSTATUS BuildPortResourceTable(VOID)
VOID DeleteRegisterResourceTable(VOID)
WDFCMRESLIST GetHandle(VOID)
_Must_inspect_result_ NTSTATUS CheckForConnectionResources(VOID)
NTSTATUS BuildRegisterResourceTable(VOID)
_Must_inspect_result_ NTSTATUS BuildFromWdmList(__in PCM_RESOURCE_LIST ResourceList, __in UCHAR AccessFlags)
FxCollectionEntry * Next(VOID)
WDFDEVICE __inline GetHandle(VOID)
MdDeviceObject __inline GetAttachedDevice(VOID)
FxDisposeList * m_DisposeList
MdDeviceObject __inline GetDeviceObject(VOID)
VOID SetState(__in BOOLEAN State)
UNICODE_STRING m_SymbolicLinkName
static FxDeviceInterface * _FromEntry(__in PSINGLE_LIST_ENTRY Entry)
__inline VOID SetCallbackFlags(__in BYTE Flags)
__inline VOID SetDevicePnpState(__in WDF_DEVICE_PNP_STATE DeviceState)
VOID WmiPkgDeregister(VOID)
VOID SetFilterIoType(VOID)
__inline BOOLEAN IsFilter()
NTSTATUS WmiPkgRegister(VOID)
__inline VOID ClearCallbackFlags(__in BYTE Flags)
__inline WDF_DEVICE_PNP_STATE GetDevicePnpState()
BOOLEAN IsSyncIrqlSet(VOID)
__inline BOOLEAN IsPassiveHandling(VOID)
VOID AssignResources(__in PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescRaw, __in PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescTrans)
VOID SetSyncIrql(KIRQL SyncIrql)
__inline BOOLEAN IsWakeCapable(VOID)
VOID OnPostReleaseHardware(VOID)
PCM_PARTIAL_RESOURCE_DESCRIPTOR GetResources(VOID)
BOOLEAN IsSharedSpinLock(VOID)
static BOOLEAN _IsMessageInterrupt(__in USHORT ResourceFlags)
BOOLEAN SharesLock(FxInterrupt *Interrupt)
WDFINTERRUPT GetHandle(VOID)
KIRQL GetResourceIrql(VOID)
PCM_RESOURCE_LIST GetParameterAllocatedResources()
PCM_RESOURCE_LIST GetParameterAllocatedResourcesTranslated()
VOID SetStatus(__in NTSTATUS Status)
UCHAR GetMinorFunction(VOID)
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
VOID __inline DestroyChildren(VOID)
BOOLEAN EarlyDispose(VOID)
_Must_inspect_result_ NTSTATUS StopProcessingForPower(__in FxIoStopProcessingForPowerAction Action)
static const PNP_EVENT_TARGET_STATE m_PnpInitOtherStates[]
VOID SetInternalFailure(VOID)
static WDF_DEVICE_PNP_STATE PnpEventRestartReleaseHardware(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpQueriedRemovingOtherStates[]
static WDF_DEVICE_PNP_STATE PnpEventHardwareAvailablePowerPolicyFailed(__inout FxPkgPnp *This)
FxPnpStateCallback * m_PnpStateCallbacks
VOID PnpCheckAssumptions(VOID)
BOOLEAN IsPresentPendingPnpIrp(VOID)
FxCmResList * m_Resources
static WDF_DEVICE_PNP_STATE PnpEventInitSurpriseRemoved(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventRemovedChildrenRemoved(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpStartedStoppingOtherStates[]
static const PNP_EVENT_TARGET_STATE m_PnpStoppedOtherStates[]
static WDF_DEVICE_PNP_STATE PnpEventQueryCanceled(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventQueryStopStaticCheck(__inout FxPkgPnp *This)
SINGLE_LIST_ENTRY m_DeviceInterfaceHead
FxSelfManagedIoMachine * m_SelfManagedIoMachine
static WDF_DEVICE_PNP_STATE PnpEventStartedCancelStop(__inout FxPkgPnp *This)
FxCmResList * m_ResourcesRaw
static const PNP_EVENT_TARGET_STATE m_PnpRemovedPdoWaitOtherStates[]
_Must_inspect_result_ NTSTATUS PnpEnableInterfacesAndRegisterWmi(VOID)
VOID PnpPowerPolicySurpriseRemove(VOID)
static const PNP_EVENT_TARGET_STATE m_PnpStartedStoppingFailedOtherStates[]
static WDF_DEVICE_PNP_STATE PnpEventQueriedRemoving(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventQueriedSurpriseRemove(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventStartedRemoving(__inout FxPkgPnp *This)
static const PWCHAR m_RestartStartAchievedName
static WDF_DEVICE_PNP_STATE PnpEventFailedSurpriseRemoved(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpRestartHardwareAvailableOtherStates[]
static WDF_DEVICE_PNP_STATE PnpEventFailedIoStarting(__inout FxPkgPnp *This)
FxWaitLockInternal m_DeviceInterfaceLock
MdIrp GetPendingPnpIrp(VOID)
static const PNP_EVENT_TARGET_STATE m_PnpHardwareAvailableOtherStates[]
static WDF_DEVICE_PNP_STATE PnpEventFailedInit(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpStartedRemovingOtherStates[]
BYTE m_SetDeviceRemoveProcessed
VOID PnpEnterNewState(__in WDF_DEVICE_PNP_STATE State)
static const PNP_EVENT_TARGET_STATE m_PnpQueryStopPendingOtherStates[]
FxEnumerationInfo * m_EnumInfo
VOID PnpPowerPolicyStart(VOID)
static WDF_DEVICE_PNP_STATE PnpEventRemoved(__inout FxPkgPnp *This)
BOOLEAN ShouldProcessPnpEventOnDifferentThread(__in KIRQL CurrentIrql, __in BOOLEAN CallerSpecifiedProcessingOnDifferentThread)
static const PNP_EVENT_TARGET_STATE m_PnpStoppedWaitForStartCompletionOtherStates[]
VOID PnpDisableInterfaces(VOID)
static WDF_DEVICE_PNP_STATE PnpEventInitQueryRemove(__inout FxPkgPnp *This)
_Must_inspect_result_ NTSTATUS PnpMatchResources(VOID)
static WDF_DEVICE_PNP_STATE PnpEventFailed(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventQueryStopPending(__inout FxPkgPnp *This)
VOID SetPendingPnpIrpStatus(__in NTSTATUS Status)
FxPnpMachine m_PnpMachine
static WDF_DEVICE_PNP_STATE PnpEventStartedStopping(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventRestart(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpFailedIoStartingOtherStates[]
static const PWCHAR m_RestartCountName
static WDF_DEVICE_PNP_STATE PnpEventFailedStarted(__inout FxPkgPnp *This)
VOID PnpCleanupForRemove(__in BOOLEAN GracefulRemove)
static const PNP_EVENT_TARGET_STATE m_PnpRestartOtherStates[]
static WDF_DEVICE_PNP_STATE PnpEventEnableInterfaces(__inout FxPkgPnp *This)
virtual VOID DeleteSymbolicLinkOverload(BOOLEAN GracefulRemove)=0
static const PNP_EVENT_TARGET_STATE m_PnpInitQueryRemoveOtherStates[]
MdIrp ClearPendingPnpIrp(VOID)
VOID NotifyResourceobjectsToReleaseResources(VOID)
static WDF_DEVICE_PNP_STATE PnpEventFailedPowerPolicyRemoved(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventQueryRemoveStaticCheck(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventQueryRemoveEnsureDeviceAwake(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpFailedWaitForRemoveOtherStates[]
static WDF_DEVICE_PNP_STATE PnpEventFailedPowerDown(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventHardwareAvailable(__inout FxPkgPnp *This)
static const ULONG m_RestartTimePeriodMaximum
static WDF_DEVICE_PNP_STATE PnpEventInitQueryRemoveCanceled(__inout FxPkgPnp *This)
virtual VOID PnpEventSurpriseRemovePendingOverload(VOID)
static WDF_DEVICE_PNP_STATE PnpEventStartedCancelRemove(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventStopped(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventCheckForDevicePresence(__inout FxPkgPnp *This)
VOID PnpPowerPolicyRemove(VOID)
static WDF_DEVICE_PNP_STATE PnpEventQueryStopEnsureDeviceAwake(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpRestartingOtherStates[]
static WDF_DEVICE_PNP_STATE PnpEventQueryRemoveAskDriver(__inout FxPkgPnp *This)
static const PNP_STATE_TABLE m_WdfPnpStates[]
BOOLEAN PowerIndicateWaitWakeStatus(__in NTSTATUS WaitWakeStatus)
static WDF_DEVICE_PNP_STATE PnpEventSurpriseRemoved(__inout FxPkgPnp *This)
static VOID _PnpProcessEventInner(__inout FxPkgPnp *This, __inout FxPostProcessInfo *Info, __in PVOID WorkerContext)
_Must_inspect_result_ NTSTATUS ValidateInterruptResourceCm(__in PCM_PARTIAL_RESOURCE_DESCRIPTOR CmIntResourceRaw, __in PCM_PARTIAL_RESOURCE_DESCRIPTOR CmIntResource, __in PWDF_INTERRUPT_CONFIG Configuration)
static const PNP_EVENT_TARGET_STATE m_PnpEjectFailedOtherStates[]
VOID PnpAssignInterruptsSyncIrql(VOID)
static WDF_DEVICE_PNP_STATE PnpEventStartingFromStopped(__inout FxPkgPnp *This)
static CPPNP_STATE_TABLE GetPnpTableEntry(__in WDF_DEVICE_PNP_STATE State)
FxPnpDeviceReleaseHardware m_DeviceReleaseHardware
SharedPowerData m_SharedPower
static WDF_DEVICE_PNP_STATE PnpEventRemovedPdoSurpriseRemoved(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpQueryRemovePendingOtherStates[]
FxPnpDevicePrepareHardware m_DevicePrepareHardware
VOID PnpEventRemovedCommonCode(VOID)
static const PNP_EVENT_TARGET_STATE m_PnpStartedOtherStates[]
VOID PnpProcessEvent(__in FxPnpEvent Event, __in BOOLEAN ProcessEventOnDifferentThread=FALSE)
static WDF_DEVICE_PNP_STATE PnpEventStoppedWaitForStartCompletion(__inout FxPkgPnp *This)
LIST_ENTRY m_InterruptListHead
VOID PnpFinishProcessingIrp(__in BOOLEAN IrpMustBePresent=TRUE)
_Must_inspect_result_ NTSTATUS ValidateCmResource(__inout PCM_PARTIAL_RESOURCE_DESCRIPTOR *CmResourceRaw, __inout PCM_PARTIAL_RESOURCE_DESCRIPTOR *CmResource)
static const PWCHAR m_RestartStartTimeName
FxPnpStateAndCaps m_PnpStateAndCaps
static WDF_DEVICE_PNP_STATE PnpEventQueryStopAskDriver(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpInitStartingOtherStates[]
BOOLEAN m_DeviceInterfacesCanBeEnabled
static WDF_DEVICE_PNP_STATE PnpEventInitStarting(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventQueryRemovePending(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventRestarting(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventPdoInitFailed(__inout FxPkgPnp *This)
NTSTATUS CompletePnpRequest(__inout FxIrp *Irp, __in NTSTATUS Status)
_Must_inspect_result_ NTSTATUS PnpReleaseHardware(VOID)
static const PNP_EVENT_TARGET_STATE m_PnpFailedPowerDownOtherStates[]
static WDF_DEVICE_PNP_STATE PnpEventPdoRestart(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventPdoRemoved(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventEjectHardware(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventStarted(__inout FxPkgPnp *This)
_Must_inspect_result_ NTSTATUS PnpPrepareHardwareInternal(VOID)
static WDF_DEVICE_PNP_STATE PnpEventFailedOwnHardware(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventFinal(__inout FxPkgPnp *This)
static WDF_DEVICE_PNP_STATE PnpEventRemovingDisableInterfaces(__inout FxPkgPnp *This)
VOID PnpProcessEventInner(__inout FxPostProcessInfo *Info)
static WDF_DEVICE_PNP_STATE PnpEventFdoRemoved(__inout FxPkgPnp *This)
static const ULONG m_RestartCountMaximum
static WDF_DEVICE_PNP_STATE PnpEventSurpriseRemoveIoStarted(__inout FxPkgPnp *This)
BOOLEAN PnpIncrementRestartCountLogic(_In_ HANDLE RestartKey, _In_ BOOLEAN CreatedNewKey)
static WDF_DEVICE_PNP_STATE PnpEventRestartHardwareAvailable(__inout FxPkgPnp *This)
static const PNP_EVENT_TARGET_STATE m_PnpRestartReleaseHardware[]
static WDF_DEVICE_PNP_STATE PnpEventRemovedPdoWait(__inout FxPkgPnp *This)
VOID PnpPowerPolicyStop(VOID)
VOID PowerPolicyProcessEvent(__in FxPowerPolicyEvent Event, __in BOOLEAN ProcessEventOnDifferentThread=FALSE)
_Must_inspect_result_ NTSTATUS Invoke(__in WDFDEVICE Device, __in WDFCMRESLIST ResourcesRaw, __in WDFCMRESLIST ResourcesTranslated)
_Must_inspect_result_ NTSTATUS Invoke(__in WDFDEVICE Device, __in WDFCMRESLIST ResourcesTranslated)
CM_PARTIAL_RESOURCE_DESCRIPTOR m_DescriptorClone
CM_PARTIAL_RESOURCE_DESCRIPTOR m_Descriptor
_Must_inspect_result_ FxTransactionedEntry * GetNextEntry(__in_opt FxTransactionedEntry *Entry)
VOID UnlockFromEnum(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
VOID LockForEnum(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
VOID InvalidateDeviceState(__in MdDeviceObject Fdo)
static __inline VOID MxQueryTickCount(__out PLARGE_INTEGER TickCount)
static __inline VOID MxReleaseRemoveLockAndWait(__in MdRemoveLock RemoveLock, __in PVOID Tag)
static __inline NTSTATUS MxAcquireRemoveLock(__in MdRemoveLock RemoveLock, __in_opt PVOID Tag)
static __inline ULONG MxQueryTimeIncrement()
#define STATUS_NOT_SUPPORTED
#define TRACINGPNPPOWERSTATES
#define NT_SUCCESS(StatCode)
#define __drv_when(cond, annotes)
#define __drv_arg(expr, annotes)
#define RtlCompareMemory(s1, s2, l)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
PFX_DRIVER_GLOBALS fxDriverGlobals
FxDeviceInterface * pDeviceInterface
FxVerifierDbgBreakPoint(pFxDriverGlobals)
@ FxIoStopProcessingForPowerPurgeNonManaged
@ FxIoStopProcessingForPowerPurgeManaged
@ FXDEVICE_CALLBACK_IN_PREPARE_HARDWARE
@ FxPnpStateResourcesChangedUseDefault
@ FxPnpStateRemovedUseDefault
@ FxPnpStateFailedUseDefault
@ FxPnpStateResourcesChangedMask
@ PnpEventStartDeviceComplete
@ PnpEventPwrPolStopFailed
@ PnpEventPwrPolStartFailed
@ PnpEventStartDeviceFailed
@ PnpEventPowerDownFailed
@ PnpEventChildrenRemovalComplete
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLuint GLsizei GLsizei * length
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 CmResourceTypeInterrupt
#define _Must_inspect_result_
#define FILE_REMOVABLE_MEDIA
#define UNREFERENCED_PARAMETER(P)
#define STATUS_DEVICE_POWER_FAILURE
#define RESTART_START_ACHIEVED_NAME
#define RESTART_COUNT_NAME
#define VALIDATE_PNP_STATE(_CurrentState, _NewState)
#define RESTART_START_TIME_NAME
#define STATUS_DEVICE_NOT_READY
#define TRACE_LEVEL_WARNING
#define TRACE_LEVEL_VERBOSE
#define TRACE_LEVEL_ERROR
#define TRACE_LEVEL_INFORMATION
_Must_inspect_result_ FxCollectionEntry * Start(VOID)
_Must_inspect_result_ FxCollectionEntry * End(VOID)
FxWaitLockTransactionedList m_ChildListList
UCHAR IncrementHistoryIndex(VOID)
FxWaitLockInternal m_StateMachineLock
BOOLEAN IsClosedLocked(VOID)
VOID GetFinishedState(__inout FxPostProcessInfo *Info)
FxPnpMachineStateHistory m_States
FxPnpEvent m_Queue[PnpEventQueueDepth]
VOID Invoke(__in WDF_DEVICE_PNP_STATE State, __in WDF_STATE_NOTIFICATION_TYPE Type, __in WDFDEVICE Device, __in PCWDF_DEVICE_PNP_NOTIFICATION_DATA NotificationData)
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@391::@395 MessageInterrupt
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@391 u
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
struct _SINGLE_LIST_ENTRY * Next
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_PARAMETER
#define STATUS_NO_SUCH_DEVICE
#define STATUS_UNSUCCESSFUL
#define STATUS_INVALID_DEVICE_STATE
#define STATUS_OBJECT_NAME_NOT_FOUND
USHORT History[PnpEventQueueDepth]
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
FORCEINLINE LONGLONG WDF_ABS_TIMEOUT_IN_SEC(_In_ ULONGLONG Time)
@ WdfDevStatePnpFailedPowerPolicyRemoved
@ WdfDevStatePnpFailedSurpriseRemoved
@ WdfDevStatePnpInitQueryRemove
@ WdfDevStatePnpHardwareAvailablePowerPolicyFailed
@ WdfDevStatePnpQueryRemovePending
@ WdfDevStatePnpStartedStopping
@ WdfDevStatePnpInitSurpriseRemoved
@ WdfDevStatePnpRemovedChildrenRemoved
@ WdfDevStatePnpRemovingDisableInterfaces
@ WdfDevStatePnpStartedCancelStop
@ WdfDevStatePnpStartedRemoving
@ WdfDevStatePnpRemovedWaitForChildren
@ WdfDevStatePnpQueryStopAskDriver
@ WdfDevStatePnpQueriedSurpriseRemove
@ WdfDevStatePnpFailedIoStarting
@ WdfDevStatePnpPdoRemoved
@ WdfDevStatePnpInitStarting
@ WdfDevStatePnpFailedPowerDown
@ WdfDevStatePnpStartingFromStopped
@ WdfDevStatePnpSurpriseRemove
@ WdfDevStatePnpQueryStopStaticCheck
@ WdfDevStatePnpEnableInterfaces
@ WdfDevStatePnpFailedOwnHardware
@ WdfDevStatePnpRemovedPdoWait
@ WdfDevStatePnpQueryRemoveStaticCheck
@ WdfDevStatePnpRestartHardwareAvailable
@ WdfDevStatePnpFailedStarted
@ WdfDevStatePnpQueryRemoveEnsureDeviceAwake
@ WdfDevStatePnpStartedCancelRemove
@ WdfDevStatePnpQueriedRemoving
@ WdfDevStatePnpEjectHardware
@ WdfDevStatePnpQueryStopEnsureDeviceAwake
@ WdfDevStatePnpQueryStopPending
@ WdfDevStatePnpPdoRestart
@ WdfDevStatePnpQueryCanceled
@ WdfDevStatePnpQueryRemoveAskDriver
@ WdfDevStatePnpRemovedPdoSurpriseRemoved
@ WdfDevStatePnpStoppedWaitForStartCompletion
@ WdfDevStatePnpRestarting
@ WdfDevStatePnpFailedInit
@ WdfDevStatePnpCheckForDevicePresence
@ WdfDevStatePnpRestartReleaseHardware
@ WdfDevStatePnpInitQueryRemoveCanceled
@ WdfDevStatePnpObjectCreated
@ WdfDevStatePnpFailedWaitForRemove
@ WdfDevStatePnpSurpriseRemoveIoStarted
@ WdfDevStatePnpHardwareAvailable
@ StateNotificationEnterState
@ StateNotificationPostProcessState
@ StateNotificationLeaveState
@ WdfDeviceFailedAttemptRestart
@ WdfDeviceFailedUndefined
@ WdfSpecialFileHibernation
enum _WDF_DEVICE_PNP_STATE WDF_DEVICE_PNP_STATE
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG Configuration
#define IRP_MN_START_DEVICE