ReactOS 0.4.16-dev-336-gb667d82
pnpstatemachine.cpp File Reference
#include "pnppriv.hpp"
#include <wdmguid.h>
#include <ntstrsafe.h>
Include dependency graph for pnpstatemachine.cpp:

Go to the source code of this file.

Macros

#define VALIDATE_PNP_STATE(_CurrentState, _NewState)   (0)
 
#define RESTART_START_ACHIEVED_NAME   L"StartAchieved"
 
#define RESTART_START_TIME_NAME   L"StartTime"
 
#define RESTART_COUNT_NAME   L"Count"
 

Functions

 __drv_when (!NT_SUCCESS(return), __drv_arg(ResourcesMatched, _Must_inspect_result_)) NTSTATUS FxPkgPnp
 

Macro Definition Documentation

◆ RESTART_COUNT_NAME

#define RESTART_COUNT_NAME   L"Count"

Definition at line 4517 of file pnpstatemachine.cpp.

◆ RESTART_START_ACHIEVED_NAME

#define RESTART_START_ACHIEVED_NAME   L"StartAchieved"

Definition at line 4515 of file pnpstatemachine.cpp.

◆ RESTART_START_TIME_NAME

#define RESTART_START_TIME_NAME   L"StartTime"

Definition at line 4516 of file pnpstatemachine.cpp.

◆ VALIDATE_PNP_STATE

#define VALIDATE_PNP_STATE (   _CurrentState,
  _NewState 
)    (0)

Definition at line 66 of file pnpstatemachine.cpp.

Function Documentation

◆ __drv_when()

__drv_when ( NT_SUCCESSreturn,
__drv_arg(ResourcesMatched, _Must_inspect_result_  
)

Definition at line 3476 of file pnpstatemachine.cpp.

3495{
3497 *ResourcesMatched = FALSE;
3498
3499 //
3500 // FxPnpStateRemoved:
3501 // Mark the device a not removed. This is just so that anybody sending
3502 // a PnP IRP_MN_QUERY_DEVICE_STATE gets a reasonable answer.
3503 //
3504 // FxPnpStateFailed, FxPnpStateResourcesChanged:
3505 // Both of these values can be set to true and cause another start to
3506 // be sent down the stack. Reset these values back to false. If there is
3507 // a need to set these values, the driver can set them in
3508 // EvtDevicePrepareHardware.
3509 //
3510 m_PnpStateAndCaps.Value &= ~(FxPnpStateRemovedMask |
3513 m_PnpStateAndCaps.Value |= (FxPnpStateRemovedUseDefault |
3516
3517 //
3518 // This will parse the resources and setup all the WDFINTERRUPT handles
3519 //
3520 status = PnpMatchResources();
3521
3522 if (!NT_SUCCESS(status)) {
3523 *ResourcesMatched = FALSE;
3524 SetInternalFailure();
3525 SetPendingPnpIrpStatus(status);
3526 return status;
3527 }
3528
3529#if (FX_CORE_MODE == FX_CORE_USER_MODE)
3530 //
3531 // Build register resource table
3532 //
3533 status = m_Resources->BuildRegisterResourceTable();
3534 if (!NT_SUCCESS(status)) {
3535 SetInternalFailure();
3536 SetPendingPnpIrpStatus(status);
3537 goto exit;
3538 }
3539
3540 //
3541 // Build Port resource table
3542 //
3543 status = m_Resources->BuildPortResourceTable();
3544 if (!NT_SUCCESS(status)) {
3545 SetInternalFailure();
3546 SetPendingPnpIrpStatus(status);
3547 goto exit;
3548 }
3549
3550 //
3551 // We keep track if the device has any connection resources,
3552 // in which case we allow unrestricted access to interrupts
3553 // regardless of the UmdfDirectHardwareAccess directive.
3554 //
3555 status = m_Resources->CheckForConnectionResources();
3556 if (!NT_SUCCESS(status)) {
3557 SetInternalFailure();
3558 SetPendingPnpIrpStatus(status);
3559 goto exit;
3560 }
3561#endif
3562
3563 *ResourcesMatched = TRUE;
3564
3565 m_Device->SetCallbackFlags(
3567 );
3568
3569 status = m_DevicePrepareHardware.Invoke(m_Device->GetHandle(),
3570 m_ResourcesRaw->GetHandle(),
3571 m_Resources->GetHandle());
3572
3573 m_Device->ClearCallbackFlags(
3575 );
3576
3577 if (!NT_SUCCESS(status)) {
3579 "EvtDevicePrepareHardware failed %!STATUS!", status);
3580
3583 GetDriverGlobals(), TRACE_LEVEL_ERROR, TRACINGPNP,
3584 "EvtDevicePrepareHardware returned an invalid status "
3585 "STATUS_NOT_SUPPORTED");
3586
3587 if (GetDriverGlobals()->IsVerificationEnabled(1, 11, OkForDownLevel)) {
3588 FxVerifierDbgBreakPoint(GetDriverGlobals());
3589 }
3590 }
3591
3592 SetInternalFailure();
3593 SetPendingPnpIrpStatus(status);
3594 goto exit;
3595 }
3596
3597 //
3598 // Now that we have assigned the resources to all the interrupts, figure out
3599 // the highest synch irql for each interrupt set which shares a spinlock.
3600 //
3601 PnpAssignInterruptsSyncIrql();
3602
3603 //
3604 // Do mode-specific work. For KMDF, there is nothing additional to do.
3605 //
3606 status = PnpPrepareHardwareInternal();
3607 if (!NT_SUCCESS(status)) {
3609 "PrepareHardware failed %!STATUS!", status);
3610
3611 SetInternalFailure();
3612 SetPendingPnpIrpStatus(status);
3613 }
3614
3615exit:
3616 return status;
3617}
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
#define TRACINGPNP
Definition: dbgtrace.h:67
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
FxVerifierDbgBreakPoint(pFxDriverGlobals)
@ OkForDownLevel
Definition: fxglobals.h:80
@ FXDEVICE_CALLBACK_IN_PREPARE_HARDWARE
Definition: fxpkgpnp.hpp:88
@ FxPnpStateResourcesChangedUseDefault
Definition: fxpkgpnp.hpp:277
@ FxPnpStateRemovedMask
Definition: fxpkgpnp.hpp:273
@ FxPnpStateFailedMask
Definition: fxpkgpnp.hpp:263
@ FxPnpStateRemovedUseDefault
Definition: fxpkgpnp.hpp:272
@ FxPnpStateFailedUseDefault
Definition: fxpkgpnp.hpp:262
@ FxPnpStateResourcesChangedMask
Definition: fxpkgpnp.hpp:278
#define exit(n)
Definition: config.h:202
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
Definition: ps.c:97