ReactOS  0.4.15-dev-2700-g4b4ffa9
FxInterrupt Class Reference

#include <fxinterrupt.hpp>

Inheritance diagram for FxInterrupt:
Collaboration diagram for FxInterrupt:

Public Member Functions

 FxInterrupt (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
virtual ~FxInterrupt (VOID)
 
_Must_inspect_result_ NTSTATUS CreateWakeInterruptMachine (VOID)
 
_Must_inspect_result_ NTSTATUS Initialize (__in CfxDevice *Device, __in FxObject *Parent, __in PWDF_INTERRUPT_CONFIG Configuration)
 
_Must_inspect_result_ NTSTATUS InitializeWorker (__in FxObject *Parent, __in PWDF_INTERRUPT_CONFIG Configuration)
 
_Must_inspect_result_ NTSTATUS InitializeInternal (__in FxObject *Parent, __in PWDF_INTERRUPT_CONFIG Configuration)
 
virtual BOOLEAN Dispose (VOID)
 
virtual VOID DeleteObject (VOID)
 
VOID OnPostReleaseHardware (VOID)
 
VOID DpcHandler (__in_opt PVOID SystemArgument1, __in_opt PVOID SystemArgument2)
 
BOOLEAN QueueDpcForIsr (VOID)
 
BOOLEAN Synchronize (__in PFN_WDF_INTERRUPT_SYNCHRONIZE Callback, __in WDFCONTEXT Context)
 
struct _KINTERRUPTGetInterruptPtr (VOID)
 
__inline BOOLEAN IsWakeCapable (VOID)
 
VOID SetActiveForWake (__in BOOLEAN ActiveForWake)
 
BOOLEAN IsActiveForWake (VOID)
 
VOID ProcessWakeInterruptEvent (__in FxWakeInterruptEvents Event)
 
VOID ReportActive (_In_ BOOLEAN Internal=FALSE)
 
VOID ReportInactive (_In_ BOOLEAN Internal=FALSE)
 
BOOLEAN IsSoftDisconnectCapable (VOID)
 
VOID WorkItemHandler (VOID)
 
BOOLEAN QueueWorkItemForIsr (VOID)
 
__inline BOOLEAN IsPassiveHandling (VOID)
 
__inline BOOLEAN IsPassiveConnect (VOID)
 
__inline BOOLEAN IsAutomaticSerialization (VOID)
 
VOID AcquireLock (VOID)
 
BOOLEAN TryToAcquireLock (VOID)
 
VOID ReleaseLock (VOID)
 
CfxDeviceGetDevice (VOID)
 
PWDF_INTERRUPT_INFO GetInfo (VOID)
 
WDFINTERRUPT GetHandle (VOID)
 
BOOLEAN IsSharedSpinLock (VOID)
 
BOOLEAN IsSyncIrqlSet (VOID)
 
KIRQL GetSyncIrql (VOID)
 
KIRQL GetResourceIrql (VOID)
 
BOOLEAN SharesLock (FxInterrupt *Interrupt)
 
_Must_inspect_result_ NTSTATUS Connect (__in ULONG NotifyFlags)
 
_Must_inspect_result_ NTSTATUS ConnectInternal (VOID)
 
_Must_inspect_result_ NTSTATUS Disconnect (__in ULONG NotifyFlags)
 
VOID DisconnectInternal (VOID)
 
_Must_inspect_result_ NTSTATUS ForceDisconnect (VOID)
 
_Must_inspect_result_ NTSTATUS ForceReconnect (VOID)
 
VOID FilterResourceRequirements (__inout PIO_RESOURCE_DESCRIPTOR IoResourceDescriptor)
 
VOID AssignResources (__in PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescRaw, __in PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescTrans)
 
PCM_PARTIAL_RESOURCE_DESCRIPTOR GetResources (VOID)
 
VOID AssignResourcesInternal (__in PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescRaw, __in PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescTrans, __in PWDF_INTERRUPT_INFO InterruptConfig)
 
VOID RevokeResources (VOID)
 
VOID RevokeResourcesInternal (VOID)
 
VOID SetPolicy (__in WDF_INTERRUPT_POLICY Policy, __in WDF_INTERRUPT_PRIORITY Priority, __in PGROUP_AFFINITY TargetProcessorSet)
 
VOID SetPolicyInternal (__in WDF_INTERRUPT_POLICY Policy, __in WDF_INTERRUPT_PRIORITY Priority, __in PGROUP_AFFINITY TargetProcessorSet)
 
VOID FlushQueuedDpcs (VOID)
 
VOID FlushQueuedWorkitem (VOID)
 
VOID InvokeWakeInterruptEvtIsr (VOID)
 
BOOLEAN WakeInterruptIsr (VOID)
 
BOOLEAN IsLevelTriggered (__in ULONG Flags)
 
__inline BOOLEAN QueueDeferredRoutineForIsr (VOID)
 
- Public Member Functions inherited from FxNonPagedObject
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
virtual ~FxNonPagedObject (VOID)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_maxIRQL(DISPATCH_LEVEL) __drv_setsIRQL(DISPATCH_LEVEL) VOID Lock(__out __drv_deref(__drv_savesIRQL) PKIRQL PreviousIrql)
 
 _Releases_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID Unlock(__in __drv_restoresIRQL KIRQL PreviousIrql)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) VOID LockAtDispatch(VOID)
 
 _Requires_lock_held_ (this->m_NPLock.m_Lock) _Releases_lock_(this -> m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID UnlockFromDispatch(VOID)
 
- Public Member Functions inherited from FxObject
PVOID GetCOMWrapper ()
 
void SetCOMWrapper (__drv_aliasesMem PVOID Wrapper)
 
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
virtual ~FxObject (VOID)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType Type)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in USHORT ExtraSize=0)
 
VOID operator delete (__in PVOID Memory)
 
VOID SetNoContextHeader (VOID)
 
PVOID __inline GetObjectHandle (VOID)
 
__inline FxContextHeaderGetContextHeader (VOID)
 
__inline PFX_DRIVER_GLOBALS GetDriverGlobals (VOID)
 
WDFTYPE GetType (VOID)
 
USHORT GetObjectSize (VOID)
 
LONG GetRefCnt (VOID)
 
FxTagTrackerGetTagTracker (VOID)
 
CfxDeviceGetDevice (VOID)
 
CfxDeviceBaseGetDeviceBase (VOID)
 
VOID SetDeviceBase (__in CfxDeviceBase *DeviceBase)
 
__inline VOID CallCleanup (VOID)
 
ULONG __inline AddRef (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG Release (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG AddRefOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG ReleaseOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual _Must_inspect_result_ NTSTATUS QueryInterface (__in FxQueryInterfaceParams *Params)
 
VOID MarkTraceState (VOID)
 
BOOLEAN __inline IsTraceState (VOID)
 
VOID __inline TraceDroppedEvent (__in FxObjectDroppedEvent Event)
 
VOID MarkPassiveDispose (__in FxObjectLockState State=ObjectLock)
 
VOID MarkPassiveCallbacks (__in FxObjectLockState State=ObjectLock)
 
VOID MarkForceDisposeThread (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsPassiveCallbacks (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsPassiveDispose (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsForceDisposeThread (__in BOOLEAN AcquireLock=TRUE)
 
VOID MarkCommitted (VOID)
 
BOOLEAN IsCommitted (VOID)
 
VOID MarkDisposeOverride (__in FxObjectLockState State=ObjectLock)
 
VOID MarkNoDeleteDDI (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsNoDeleteDDI (VOID)
 
_Must_inspect_result_ NTSTATUS Commit (__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
 
VOID DeleteFromFailedCreate (VOID)
 
VOID ClearEvtCallbacks (VOID)
 
BOOLEAN EarlyDispose (VOID)
 
_Must_inspect_result_ NTSTATUS AssignParentObject (__in FxObject *ParentObject)
 
_Must_inspect_result_ NTSTATUS AddContext (__in FxContextHeader *Header, __in PVOID *Context, __in PWDF_OBJECT_ATTRIBUTES Attributes)
 
_Must_inspect_result_ NTSTATUS RemoveParentAssignment (VOID)
 
_Must_inspect_result_ FxObjectGetParentObjectReferenced (__in PVOID Tag)
 
BOOLEAN IsDisposed (VOID)
 

Static Public Member Functions

static _Must_inspect_result_ NTSTATUS _CreateAndInit (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in CfxDevice *Device, __in_opt FxObject *Parent, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in PWDF_INTERRUPT_CONFIG Configuration, __out FxInterrupt **Interrupt)
 
static BOOLEAN _IsMessageInterrupt (__in USHORT ResourceFlags)
 
static BOOLEAN _IsWakeHintedInterrupt (__in USHORT ResourceFlags)
 
- Static Public Member Functions inherited from FxObject
static FxObject_FromDisposeEntry (__in PSINGLE_LIST_ENTRY Entry)
 
static FxObject_GetObjectFromHandle (__in WDFOBJECT Handle, __inout PWDFOBJECT_OFFSET ObjectOffset)
 
static PVOID __inline _ToHandle (__in FxObject *Object)
 
static VOID __inline _ReferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static VOID __inline _DereferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static PVOID _GetDebugBase (__in FxObject *Object)
 
static PFX_POOL_HEADER _CleanupPointer (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *Object)
 
static _Must_inspect_result_ NTSTATUS _GetEffectiveLock (__in FxObject *Object, __in_opt IFxHasCallbacks *Callbacks, __in BOOLEAN AutomaticLocking, __in BOOLEAN PassiveCallbacks, __out FxCallbackLock **CallbackLock, __out_opt FxObject **CallbackLockObject)
 
static _Must_inspect_result_ NTSTATUS _ObjectQuery (_In_ FxObject *Object, _In_ CONST GUID *Guid, _In_ ULONG QueryBufferLength, _Out_writes_bytes_(QueryBufferLength) PVOID QueryBuffer)
 

Protected Attributes

LIST_ENTRY m_PnpList
 
- Protected Attributes inherited from FxObject
union {
   CfxDeviceBase *   m_DeviceBase
 
   CfxDevice *   m_Device
 
}; 
 

Private Member Functions

VOID Reset (VOID)
 
VOID ResetInternal (VOID)
 
VOID SetSyncIrql (KIRQL SyncIrql)
 
VOID FlushAndRundown (VOID)
 
VOID FlushAndRundownInternal (VOID)
 
NTSTATUS InterruptEnable (VOID)
 
NTSTATUS InterruptEnableInvokeCallback (VOID)
 
NTSTATUS InterruptDisable (VOID)
 
NTSTATUS InterruptDisableInvokeCallback (VOID)
 

Private Attributes

friend FxPkgPnp
 
WDF_TRI_STATE m_ShareVector
 
struct _KINTERRUPTm_Interrupt
 
MdLockm_SpinLock
 
KIRQL m_OldIrql
 
volatile KIRQL m_SynchronizeIrql
 
MxLock m_BuiltInSpinLock
 
FxWaitLockm_WaitLock
 
KDPC m_Dpc
 
FxSystemWorkItemm_SystemWorkItem
 
FxCallbackLockm_CallbackLock
 
BOOLEAN m_DisposeWaitLock
 
BOOLEAN m_UseSoftDisconnect
 
BOOLEAN m_PassiveHandling
 
BOOLEAN m_AddedToList
 
BOOLEAN m_Connected
 
BOOLEAN m_ForceDisconnected
 
BOOLEAN m_Enabled
 
BOOLEAN m_FloatingSave
 
BOOLEAN m_CreatedInPrepareHardware
 
FxWakeInterruptMachinem_WakeInterruptMachine
 
BOOLEAN m_Active
 
BOOLEAN m_SetPolicy
 
WDF_INTERRUPT_POLICY m_Policy
 
WDF_INTERRUPT_PRIORITY m_Priority
 
GROUP_AFFINITY m_Processors
 
PFN_WDF_INTERRUPT_ENABLE m_EvtInterruptEnable
 
PFN_WDF_INTERRUPT_DISABLE m_EvtInterruptDisable
 
PFN_WDF_INTERRUPT_ISR m_EvtInterruptIsr
 
PFN_WDF_INTERRUPT_DPC m_EvtInterruptDpc
 
PFN_WDF_INTERRUPT_WORKITEM m_EvtInterruptWorkItem
 
RD_INTERRUPT_CONTEXT m_RdInterruptContext
 
FxInterruptWaitblockm_InterruptWaitblock
 
BOOLEAN m_CanQueue
 
BOOLEAN m_PassiveHandlingByRedirector
 
WDF_INTERRUPT_INFO m_InterruptInfo
 
PCM_PARTIAL_RESOURCE_DESCRIPTOR m_CmTranslatedResource
 
struct _KINTERRUPTm_InterruptCaptured
 
BOOLEAN m_Disconnecting
 
BOOLEAN m_IsEdgeTriggeredNonMsiInterrupt
 

Static Private Attributes

static MdInterruptSynchronizeRoutineType _InterruptMarkDisconnecting
 
static MdInterruptServiceRoutineType _InterruptThunk
 
static EVT_SYSTEMWORKITEM _InterruptWorkItemCallback
 
static MdInterruptSynchronizeRoutineType _InterruptSynchronizeThunk
 
static MdDeferredRoutineType _InterruptDpcThunk
 
static MdInterruptSynchronizeRoutineType _InterruptEnableThunk
 
static MdInterruptSynchronizeRoutineType _InterruptDisableThunk
 

Additional Inherited Members

- Protected Member Functions inherited from FxObject
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
FxObjectDebugExtensionGetDebugExtension (VOID)
 
BOOLEAN IsDebug (VOID)
 
VOID AllocateTagTracker (__in WDFTYPE Type)
 
virtual VOID SelfDestruct (VOID)
 
PVOID __inline GetObjectHandleUnchecked (VOID)
 
VOID __inline DestroyChildren (VOID)
 
VOID DeleteEarlyDisposedObject (VOID)
 
- Static Protected Member Functions inherited from FxObject
static PVOID _GetBase (__in FxObject *Object)
 

Detailed Description

Definition at line 45 of file fxinterrupt.hpp.

Constructor & Destructor Documentation

◆ FxInterrupt()

FxInterrupt::FxInterrupt ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals)

Definition at line 143 of file interruptobject.cpp.

145  :
147 {
148 
149  m_Interrupt = NULL;
150 
152 
155 
157 
161 
163  m_WaitLock = NULL;
165 
167 
168  //
169  // We want platform specific behavior for soft disconnect to avoid any
170  // compat issues on existing platforms. In later versions (after 1.11) the
171  // platform differenciation could be removed.
172  //
173 #if defined(_ARM_)
175 #else
177 #endif
178 
179 #if FX_IS_KERNEL_MODE
181 
182  m_Active = FALSE;
184 
185 #elif FX_IS_USER_MODE
186 
189  m_CanQueue = FALSE;
191 #endif
192 
195 
197 
199  m_Connected = FALSE;
201  m_Enabled = FALSE;
203 
205 
206  // This field is init later on.
208 
211 
212  Reset();
213 
214  // This is set up by Initialize
215  m_SpinLock = NULL;
216 
217  //
218  // MSI Support
219  //
221 
222  //
223  // WdfIrqPolicyOneCloseProcessor is a safe policy to use. It ensures that
224  // old devices continue to work without any change in their functionality.
225  //
229  m_SetPolicy = FALSE;
230 
232 
233  //
234  // Driver writer can only create WDFINTERRUPTs, not delete them
235  //
239 }
FxWaitLock * m_WaitLock
Definition: fxinterrupt.hpp:77
static MdDeferredRoutineType _InterruptDpcThunk
FxNonPagedObject(__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
BOOLEAN m_AddedToList
#define TRUE
Definition: types.h:120
VOID Reset(VOID)
BOOLEAN m_IsEdgeTriggeredNonMsiInterrupt
BOOLEAN m_CreatedInPrepareHardware
VOID MarkPassiveDispose(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:944
PFN_WDF_INTERRUPT_DISABLE m_EvtInterruptDisable
BOOLEAN m_DisposeWaitLock
Definition: fxinterrupt.hpp:98
RD_INTERRUPT_CONTEXT m_RdInterruptContext
BOOLEAN m_CanQueue
WDF_TRI_STATE m_ShareVector
Definition: fxinterrupt.hpp:54
FxSystemWorkItem * m_SystemWorkItem
Definition: fxinterrupt.hpp:87
BOOLEAN m_Disconnecting
PCM_PARTIAL_RESOURCE_DESCRIPTOR m_CmTranslatedResource
CLIPBOARD_GLOBALS Globals
Definition: clipbrd.c:13
#define FALSE
Definition: types.h:117
BOOLEAN m_ForceDisconnected
WDF_INTERRUPT_POLICY m_Policy
VOID MarkDisposeOverride(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1101
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
BOOLEAN m_Enabled
WDF_INTERRUPT_PRIORITY m_Priority
BOOLEAN m_FloatingSave
BOOLEAN m_PassiveHandlingByRedirector
BOOLEAN m_PassiveHandling
LIST_ENTRY m_PnpList
PFN_WDF_INTERRUPT_WORKITEM m_EvtInterruptWorkItem
BOOLEAN m_Active
BOOLEAN m_UseSoftDisconnect
BOOLEAN m_SetPolicy
BOOLEAN m_Connected
MdLock * m_SpinLock
Definition: fxinterrupt.hpp:64
FxCallbackLock * m_CallbackLock
Definition: fxinterrupt.hpp:93
VOID MarkNoDeleteDDI(__in FxObjectLockState State=ObjectLock)
Definition: fxobject.hpp:1118
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
KIRQL m_OldIrql
Definition: fxinterrupt.hpp:66
PFN_WDF_INTERRUPT_ISR m_EvtInterruptIsr
PFN_WDF_INTERRUPT_ENABLE m_EvtInterruptEnable
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define NULL
Definition: types.h:112
FxInterruptWaitblock * m_InterruptWaitblock
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PFN_WDF_INTERRUPT_DPC m_EvtInterruptDpc
GROUP_AFFINITY m_Processors
FxWakeInterruptMachine * m_WakeInterruptMachine
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:711
struct _KINTERRUPT * m_InterruptCaptured
WDF_INTERRUPT_INFO m_InterruptInfo
FORCEINLINE VOID WDF_INTERRUPT_INFO_INIT(_Out_ PWDF_INTERRUPT_INFO Info)
Definition: wdfinterrupt.h:325

Referenced by _CreateAndInit().

◆ ~FxInterrupt()

FxInterrupt::~FxInterrupt ( VOID  )
virtual

Definition at line 241 of file interruptobject.cpp.

242 {
243 
244  //
245  // If this hits, its because someone destroyed the INTERRUPT by
246  // removing too many references by mistake without calling WdfObjectDelete
247  //
248  if( m_Interrupt != NULL ) {
251  "Destroy Interrupt destroyed without calling WdfObjectDelete, or "
252  "by Framework processing DeviceRemove. Possible reference count problem?");
254  }
255 
256  if (m_Device != NULL) {
259  "Destroy Interrupt destroyed without calling WdfObjectDelete, or "
260  "by Framework processing DeviceRemove. Possible reference count problem?");
262  }
263 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGPNP
Definition: dbgtrace.h:67
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
FxVerifierDbgBreakPoint(pFxDriverGlobals)

Member Function Documentation

◆ _CreateAndInit()

_Must_inspect_result_ NTSTATUS FxInterrupt::_CreateAndInit ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in CfxDevice Device,
__in_opt FxObject Parent,
__in PWDF_OBJECT_ATTRIBUTES  Attributes,
__in PWDF_INTERRUPT_CONFIG  Configuration,
__out FxInterrupt **  Interrupt 
)
static

Definition at line 421 of file interruptobject.cpp.

429 {
432 
433  pFxInterrupt = new (FxDriverGlobals, Attributes)
434  FxInterrupt(FxDriverGlobals);
435 
436  if (pFxInterrupt == NULL) {
438 
440  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGPNP,
441  "not enough memory to allocate WDFINTERRUPT for WDFDEVICE %p, "
442  "%!STATUS!", Device, status);
443 
444  return status;
445  }
446 
447  if (NULL == Parent) {
448  Parent = Device;
449  }
450 
452 
453  if (NT_SUCCESS(status)) {
455  if (!NT_SUCCESS(status)) {
457  FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGPNP,
458  "FxInterrupt Commit failed %!STATUS!", status);
459  }
460  }
461 
462  if (NT_SUCCESS(status)) {
464  }
465  else {
467  return status;
468  }
469 
470  if (Configuration->CanWakeDevice) {
472  }
473 
474  if (!NT_SUCCESS(status)) {
476  }
477 
478  return status;
479 }
_Must_inspect_result_ NTSTATUS Initialize(__in CfxDevice *Device, __in FxObject *Parent, __in PWDF_INTERRUPT_CONFIG Configuration)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ NTSTATUS Commit(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
Definition: fxobject.cpp:904
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG Configuration
Definition: wdfinterrupt.h:372
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFINTERRUPT * Interrupt
Definition: wdfinterrupt.h:372
LONG NTSTATUS
Definition: precomp.h:26
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:728
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FxInterrupt * pFxInterrupt
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGPNP
Definition: dbgtrace.h:67
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
_Must_inspect_result_ NTSTATUS CreateWakeInterruptMachine(VOID)
FxInterrupt(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
VOID DeleteFromFailedCreate(VOID)
Definition: fxobject.cpp:391
static SERVICE_STATUS status
Definition: service.c:31
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
Definition: ps.c:97

◆ _IsMessageInterrupt()

static BOOLEAN FxInterrupt::_IsMessageInterrupt ( __in USHORT  ResourceFlags)
inlinestatic

Definition at line 695 of file fxinterrupt.hpp.

698  {
699  if (ResourceFlags & CM_RESOURCE_INTERRUPT_MESSAGE) {
700  return TRUE;
701  }
702  else {
703  return FALSE;
704  }
705  }
#define TRUE
Definition: types.h:120
#define CM_RESOURCE_INTERRUPT_MESSAGE
Definition: cmtypes.h:145
#define FALSE
Definition: types.h:117

Referenced by AssignResources(), FxPkgPnp::FilterResourceRequirements(), FxPkgPnp::PnpMatchResources(), and FxPkgPnp::ValidateInterruptResourceCm().

◆ _IsWakeHintedInterrupt()

static BOOLEAN FxInterrupt::_IsWakeHintedInterrupt ( __in USHORT  ResourceFlags)
inlinestatic

Definition at line 709 of file fxinterrupt.hpp.

712  {
713  if (ResourceFlags & CM_RESOURCE_INTERRUPT_WAKE_HINT) {
714  return TRUE;
715  }
716  else {
717  return FALSE;
718  }
719  }
#define CM_RESOURCE_INTERRUPT_WAKE_HINT
Definition: cmtypes.h:149
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117

◆ AcquireLock()

VOID FxInterrupt::AcquireLock ( VOID  )

Definition at line 1877 of file interruptobject.cpp.

1879 {
1880  if (FALSE == m_PassiveHandling) {
1881  struct _KINTERRUPT* kinterrupt = GetInterruptPtr();
1882 
1883  //
1884  // DIRQL interrupt handling.
1885  //
1886  ASSERTMSG("Can't synchronize when the interrupt isn't connected: ",
1887  kinterrupt != NULL);
1888 
1889  if (NULL != kinterrupt) {
1891  }
1892  }
1893  else {
1894  //
1895  // Passive-level interrupt handling when automatic serialization is off.
1896  //
1898  ASSERT(m_WaitLock != NULL);
1899  m_WaitLock->AcquireLock(GetDriverGlobals(), NULL);
1900  }
1901 }
FxWaitLock * m_WaitLock
Definition: fxinterrupt.hpp:77
static __inline KIRQL MxAcquireInterruptSpinLock(_Inout_ PKINTERRUPT Interrupt)
Definition: mxgeneralkm.h:767
#define FALSE
Definition: types.h:117
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define ASSERT(a)
Definition: mode.c:44
BOOLEAN m_PassiveHandling
static __inline KIRQL MxGetCurrentIrql()
Definition: mxgeneralkm.h:86
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
KIRQL m_OldIrql
Definition: fxinterrupt.hpp:66
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
#define NULL
Definition: types.h:112
struct _KINTERRUPT * GetInterruptPtr(VOID)

Referenced by _Requires_lock_not_held_(), InterruptDisableInvokeCallback(), InterruptEnableInvokeCallback(), and InvokeWakeInterruptEvtIsr().

◆ AssignResources()

VOID FxInterrupt::AssignResources ( __in PCM_PARTIAL_RESOURCE_DESCRIPTOR  CmDescRaw,
__in PCM_PARTIAL_RESOURCE_DESCRIPTOR  CmDescTrans 
)

Definition at line 928 of file interruptobject.cpp.

951 {
952  if (CmDescTrans->u.Interrupt.Group > 0 &&
954  //
955  // This should never happen.
956  //
958  }
959 
960 #if FX_IS_USER_MODE
961  //
962  // For UMDF, see if this is level-triggered interrupt in which case we need
963  // reflector to handle it at passive level. Also, level-triggered
964  // support is present only on Win8 and newer. Note that, for KMDF, driver
965  // would have provided the choice of handling at passive level so we know
966  // that early on for KMDF, however for UMDF, driver can't specify the choice
967  // and UMDF figures out whether to handle at passive or not by looking at
968  // the interrupt type in resources.
969  //
970  if (IsLevelTriggered(CmDescTrans->Flags) &&
973  }
974 #endif
975 
976  if (IsPassiveConnect() && _IsMessageInterrupt(CmDescTrans->Flags)) {
979  "Driver cannot specify PassiveHandling for MSI interrupts.");
981  // IoConnectInterruptEx will fail later on.
982  }
983 
984  m_InterruptInfo.Group = CmDescTrans->u.Interrupt.Group;
985  m_InterruptInfo.TargetProcessorSet = CmDescTrans->u.Interrupt.Affinity;
986  m_InterruptInfo.ShareDisposition = CmDescTrans->ShareDisposition;
988  CmDescTrans->Flags & CM_RESOURCE_INTERRUPT_LATCHED ? Latched : LevelSensitive;
989 
990  //
991  // Interrupt's IRQL.
992  //
993  m_InterruptInfo.Irql = (KIRQL)CmDescTrans->u.Interrupt.Level;
994 
995  if (IsPassiveConnect()) {
997  }
998 
999  //
1000  // Note if this is an MSI interrupt
1001  //
1002  m_InterruptInfo.MessageSignaled = _IsMessageInterrupt(CmDescTrans->Flags);
1003 
1004  //
1005  // Edge-triggered interrupts that are ActiveBoth are made stateful by the OS
1006  // (GPIO buttons driver) to track buttons' press/release state. This is because
1007  // the driver may not have the ability to read the state directly from the hardware.
1008  //
1009  // There is no way to identify ActiveBoth interrupts since KINTERRUPT_POLARITY is
1010  // not exposed to client drivers, so we decided to apply this logic to all
1011  // edge-triggered non-MSI interrupts.
1012  //
1015 
1017  CmDescRaw->u.MessageInterrupt.Raw.MessageCount > 1) {
1018  //
1019  // This is an assignment for a multi-message PCI 2.2-style resource.
1020  // Thus the vector and message data have to be deduced.
1021  //
1022  m_InterruptInfo.Vector = CmDescTrans->u.Interrupt.Vector + m_InterruptInfo.MessageNumber;
1023 
1025  }
1026  else {
1027  //
1028  // This is an assignment for a single interrupt, either line-based or
1029  // PCI 2.2 single-message MSI, or PCI 3.0 MSI-X-style resource.
1030  //
1031  m_InterruptInfo.Vector = CmDescTrans->u.Interrupt.Vector;
1032 
1035  }
1036  else {
1037  if (IsLevelTriggered(CmDescTrans->Flags)) {
1039  }
1040  else {
1042  }
1043  }
1044  }
1045 
1046  if (IsPassiveConnect()) {
1048  }
1049 
1050  //
1051  // Do mode-specific work. For KMDF, it's a no-op.
1052  // For UMDF, send a sync message to Reflector to assign resources.
1053  //
1054  AssignResourcesInternal(CmDescRaw, CmDescTrans, &m_InterruptInfo);
1055 
1056  //
1057  // Weak ref to the translated resource interrupt descriptor.
1058  // It is valid from prepare hardware callback to release hardware callback.
1059  //
1060  m_CmTranslatedResource = CmDescTrans;
1061 
1064  "Is MSI? %d, MSI-ID %d, AffinityPolicy %!WDF_INTERRUPT_POLICY!, "
1065  "Priority %!WDF_INTERRUPT_PRIORITY!, Group %d, Affinity 0x%I64x, "
1066  "Irql 0x%x, Vector 0x%x\n",
1069  m_Policy,
1070  m_Priority,
1071  m_InterruptInfo.Group,
1075 
1076 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
__inline BOOLEAN IsPassiveConnect(VOID)
#define TRUE
Definition: types.h:120
BOOLEAN m_IsEdgeTriggeredNonMsiInterrupt
virtual VOID SetDeviceTelemetryInfoFlags(_In_ FxDeviceInfoFlags Flag)
Definition: fxdevice.hpp:1807
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29
VOID AssignResourcesInternal(__in PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescRaw, __in PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescTrans, __in PWDF_INTERRUPT_INFO InterruptConfig)
PCM_PARTIAL_RESOURCE_DESCRIPTOR m_CmTranslatedResource
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
KAFFINITY TargetProcessorSet
Definition: wdfinterrupt.h:306
WDF_INTERRUPT_POLICY m_Policy
WDF_INTERRUPT_PRIORITY m_Priority
BOOLEAN IsLevelTriggered(__in ULONG Flags)
KINTERRUPT_MODE Mode
Definition: wdfinterrupt.h:311
BOOLEAN m_PassiveHandlingByRedirector
uint64_t ULONGLONG
Definition: typedefs.h:67
_Must_inspect_result_ __inline BOOLEAN FxIsProcessorGroupSupported(VOID)
Definition: fxglobalskm.h:734
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGPNP
Definition: dbgtrace.h:67
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
_Must_inspect_result_ __inline BOOLEAN FxIsPassiveLevelInterruptSupported(VOID)
Definition: fxglobals.h:1081
static BOOLEAN _IsMessageInterrupt(__in USHORT ResourceFlags)
WDF_INTERRUPT_INFO m_InterruptInfo
FxVerifierDbgBreakPoint(pFxDriverGlobals)

Referenced by Initialize(), and FxPkgPnp::PnpMatchResources().

◆ AssignResourcesInternal()

VOID FxInterrupt::AssignResourcesInternal ( __in PCM_PARTIAL_RESOURCE_DESCRIPTOR  CmDescRaw,
__in PCM_PARTIAL_RESOURCE_DESCRIPTOR  CmDescTrans,
__in PWDF_INTERRUPT_INFO  InterruptConfig 
)

Definition at line 71 of file fxinterruptkm.hpp.

76 {
77  UNREFERENCED_PARAMETER(CmDescRaw);
78  UNREFERENCED_PARAMETER(CmDescTrans);
79  UNREFERENCED_PARAMETER(InterruptInfo);
80 
81  //
82  // Does nothing for KMDF
83  //
84 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317

Referenced by AssignResources().

◆ Connect()

_Must_inspect_result_ NTSTATUS FxInterrupt::Connect ( __in ULONG  NotifyFlags)

Definition at line 1189 of file interruptobject.cpp.

1209 {
1211  NTSTATUS status;
1212 
1214 
1215  if ((NotifyFlags & NotifyResourcesExplicitPowerup) &&
1216  IsActiveForWake()) {
1217  //
1218  // If an interrupt is marked as wakeable and the device has been set to
1219  // wake via a driver-owned ISR, leave the interrupt connected.
1220  //
1222 
1223  return STATUS_SUCCESS;
1224  }
1225 
1226  //
1227  // See if we need to just do soft connect. We do soft connect on explicit
1228  // power up if driver opted-in for that.
1229  //
1230  if (IsSoftDisconnectCapable() &&
1231  (NotifyFlags & NotifyResourcesExplicitPowerup)){
1232 
1233  ReportActive(TRUE);
1234 
1236  goto Enable;
1237  }
1238 
1239  //
1240  // We should either be disconnected or being asked to connect in the NP path
1241  //
1242  ASSERT(m_Connected == FALSE || (NotifyFlags & NotifyResourcesNP));
1243 
1244  if (m_ForceDisconnected) {
1245  return STATUS_SUCCESS;
1246  }
1247 
1248  //
1249  // Check to see if this interrupt object was actually assigned any
1250  // resources. If it wasn't, then don't attempt to connect. A WDFINTERRUPT
1251  // object won't be assigned any resources if the underlying device wasn't
1252  // granted any by the PnP manager.
1253  //
1254  if (m_InterruptInfo.Vector == 0) {
1255  return STATUS_SUCCESS;
1256  }
1257 
1258  //
1259  // If we are in an NP path, the interrupt remained connected while the device
1260  // went into Dx so there is no need to reconnect it.
1261  //
1262  if ((NotifyFlags & NotifyResourcesNP) == 0) {
1263 
1264  ASSERT(m_Interrupt == NULL);
1266 
1267  //
1268  // Call pnp manager to connect the interrupt. For KMDF, we call
1269  // kernel DDI, whereas for UMDF, we send a sync message to redirector.
1270  //
1271  status = ConnectInternal();
1272 
1273  if (!NT_SUCCESS(status)) {
1274  m_Interrupt = NULL;
1275 
1278  "IoConnectInterrupt(Ex) Failed,"
1279  " SpinLock 0x%p,"
1280  " Vector 0x%x,"
1281  " IRQL 0x%x,"
1282  " Synchronize IRQL 0x%x,"
1283  " Mode 0x%x,"
1284  " ShareVector %s,"
1285  " ProcessorGroup %d,"
1286  " ProcessorEnableMask 0x%I64x,"
1287  " FloatingSave %s,"
1288  " %!STATUS!",
1289  m_SpinLock,
1295  CmResourceShareShared ? "True" : "False",
1296  m_InterruptInfo.Group,
1298  m_FloatingSave ? "True" : "False",
1299  status
1300  );
1301 
1302  return status;
1303  }
1304 
1305  m_Connected = TRUE;
1306 
1307 #if FX_IS_KERNEL_MODE
1308  m_Active = TRUE;
1309 #endif
1310 
1311  }
1312  else {
1314  ASSERT(m_Interrupt != NULL);
1315  }
1316 
1317 Enable:
1318 
1319  //
1320  // Enable the interrupt at the hardware.
1321  //
1322  status = InterruptEnable();
1323  if (!NT_SUCCESS(status)) {
1326  "EvtInterruptEnable WDFDEVICE %p, WDFINTERRUPT %p, PKINTERRUPT %p "
1327  "returned %!STATUS!", m_Device->GetHandle(), GetHandle(),
1328  m_Interrupt, status);
1329 
1330  return status;
1331  }
1332 
1333  m_Enabled = TRUE;
1334 
1335  return status;
1336 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
_Must_inspect_result_ NTSTATUS ConnectInternal(VOID)
#define TRUE
Definition: types.h:120
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
NTSTATUS InterruptEnable(VOID)
#define FALSE
Definition: types.h:117
BOOLEAN m_ForceDisconnected
KAFFINITY TargetProcessorSet
Definition: wdfinterrupt.h:306
volatile KIRQL m_SynchronizeIrql
Definition: fxinterrupt.hpp:67
VOID ReportActive(_In_ BOOLEAN Internal=FALSE)
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
BOOLEAN IsSoftDisconnectCapable(VOID)
BOOLEAN m_Enabled
BOOLEAN m_FloatingSave
KINTERRUPT_MODE Mode
Definition: wdfinterrupt.h:311
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
uint64_t ULONGLONG
Definition: typedefs.h:67
BOOLEAN m_PassiveHandling
BOOLEAN m_Active
BOOLEAN m_Connected
MdLock * m_SpinLock
Definition: fxinterrupt.hpp:64
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGPNP
Definition: dbgtrace.h:67
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
WDFINTERRUPT GetHandle(VOID)
#define STATUS_SUCCESS
Definition: shellext.h:65
VOID SetActiveForWake(__in BOOLEAN ActiveForWake)
static SERVICE_STATUS status
Definition: service.c:31
BOOLEAN IsActiveForWake(VOID)
WDF_INTERRUPT_INFO m_InterruptInfo
Definition: ps.c:97

Referenced by ForceReconnect(), and FxPkgPnp::NotifyResourceObjectsD0().

◆ ConnectInternal()

NTSTATUS FxInterrupt::ConnectInternal ( VOID  )

Definition at line 130 of file interruptobjectkm.cpp.

133 {
134  IO_CONNECT_INTERRUPT_PARAMETERS connectParams;
135  FxPkgPnp* fxPkgPnp;
136 
137  fxPkgPnp = m_Device->m_PkgPnp;
138 
139  //
140  // Tell the PnP Manager to connect the interrupt.
141  //
142  ASSERT(fxPkgPnp->m_IoConnectInterruptEx != NULL);
143 
144  //
145  // We're running on Longhorn or later (or somebody backported the new
146  // interrupt code,) so tell the PnP manager everything we can about this
147  // device.
148  //
149  RtlZeroMemory(&connectParams, sizeof(connectParams));
150 
152  connectParams.Version = CONNECT_FULLY_SPECIFIED_GROUP;
153  }
154  else {
155  connectParams.Version = CONNECT_FULLY_SPECIFIED;
156  }
157 
159  connectParams.FullySpecified.InterruptObject = &m_Interrupt;
161  connectParams.FullySpecified.ServiceContext = this;
162  connectParams.FullySpecified.SpinLock = m_SpinLock;
165  connectParams.FullySpecified.Irql = m_InterruptInfo.Irql;
167  connectParams.FullySpecified.Group = m_InterruptInfo.Group;
169  connectParams.FullySpecified.ShareVector =
172 
173  return fxPkgPnp->m_IoConnectInterruptEx(&connectParams);
174 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
static MdInterruptServiceRoutineType _InterruptThunk
#define TRUE
Definition: types.h:120
#define CONNECT_FULLY_SPECIFIED_GROUP
#define CONNECT_FULLY_SPECIFIED
#define FALSE
Definition: types.h:117
KAFFINITY TargetProcessorSet
Definition: wdfinterrupt.h:306
volatile KIRQL m_SynchronizeIrql
Definition: fxinterrupt.hpp:67
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
IO_CONNECT_INTERRUPT_FULLY_SPECIFIED_PARAMETERS FullySpecified
Definition: iotypes.h:397
BOOLEAN m_FloatingSave
KINTERRUPT_MODE Mode
Definition: wdfinterrupt.h:311
MdDeviceObject __inline GetPhysicalDevice(VOID)
Definition: fxdevice.hpp:228
#define ASSERT(a)
Definition: mode.c:44
_Must_inspect_result_ __inline BOOLEAN FxIsProcessorGroupSupported(VOID)
Definition: fxglobalskm.h:734
MdLock * m_SpinLock
Definition: fxinterrupt.hpp:64
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
PFN_IO_CONNECT_INTERRUPT_EX m_IoConnectInterruptEx
Definition: fxpkgpnp.hpp:4288
#define NULL
Definition: types.h:112
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
WDF_INTERRUPT_INFO m_InterruptInfo

Referenced by Connect().

◆ CreateWakeInterruptMachine()

_Must_inspect_result_ NTSTATUS FxInterrupt::CreateWakeInterruptMachine ( VOID  )

Definition at line 267 of file interruptobject.cpp.

282 {
284  FxWakeInterruptMachine * fxWakeInterruptMachine = NULL;
285 
287 
288  fxWakeInterruptMachine = new (m_Device->m_PkgPnp->GetDriverGlobals())
290 
291  if (NULL == fxWakeInterruptMachine) {
296  "WDFDEVICE 0x%p failed to allocate FxWakeInterruptMachine. %!STATUS!.",
297  m_Device, status);
298  goto exit;
299  }
300 
301  status = fxWakeInterruptMachine->Initialize(m_Device->m_PkgPnp->GetDriverGlobals());
302  if (!NT_SUCCESS(status)) {
306  "WDFDEVICE 0x%p failed to initialize FxWakeInterruptMachine. %!STATUS!.",
307  m_Device, status);
308  goto exit;
309  }
310 
311  status = fxWakeInterruptMachine->Init(
314  fxWakeInterruptMachine
315  );
316  if (!NT_SUCCESS(status)) {
320  "WDFDEVICE 0x%p failed to init FxWakeInterruptMachine. %!STATUS!.",
321  m_Device, status);
322  goto exit;
323  }
324 
325  m_WakeInterruptMachine = fxWakeInterruptMachine;
326 
327  fxWakeInterruptMachine->m_IsrEvent.Initialize(SynchronizationEvent,FALSE);
328 
330 
334  "WDFDEVICE 0x%p created wake interrupt",
335  m_Device);
336 
337 exit:
338  if (!NT_SUCCESS(status)) {
339  if (NULL != fxWakeInterruptMachine) {
340  delete fxWakeInterruptMachine;
341  }
342  }
343  return status;
344 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
VOID WakeInterruptCreated(VOID)
Definition: fxpkgpnp.hpp:4074
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ NTSTATUS Init(__inout FxPkgPnp *Pnp, __in PFN_PNP_EVENT_WORKER WorkerRoutine, __in PVOID WorkerContext=NULL)
Definition: eventqueue.cpp:370
CHECK_RETURN_IF_USER_MODE __inline NTSTATUS Initialize(__in EVENT_TYPE Type, __in BOOLEAN InitialState)
Definition: mxeventkm.h:55
_Must_inspect_result_ NTSTATUS Initialize(__in PFX_DRIVER_GLOBALS DriverGlobals)
Definition: eventqueue.cpp:55
#define FALSE
Definition: types.h:117
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGPNP
Definition: dbgtrace.h:67
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
static VOID _ProcessEventInner(__inout FxPkgPnp *PkgPnp, __inout FxPostProcessInfo *Info, __in PVOID WorkerContext)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
void exit(int exitcode)
Definition: _exit.c:33
FxWakeInterruptMachine * m_WakeInterruptMachine
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by _CreateAndInit().

◆ DeleteObject()

VOID FxInterrupt::DeleteObject ( VOID  )
virtual

Reimplemented from FxObject.

Definition at line 857 of file interruptobject.cpp.

860 {
861  if (m_AddedToList) {
862  //
863  // Pop this off of PnP's list of interrupts.
864  //
866  }
867 
868  if (m_CmTranslatedResource != NULL) {
869  //
870  // This can happen if driver explicitly deletes the interrupt in its
871  // release hardware callback.
872  //
873  RevokeResources();
874  }
875 
877  delete m_WakeInterruptMachine;
879  }
880 
881  //
882  // Use the base FxObject's DeleteObject implementation which will Dispose us
883  //
884  FxNonPagedObject::DeleteObject(); // __super call
885 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
virtual VOID DeleteObject(VOID)
BOOLEAN m_AddedToList
PCM_PARTIAL_RESOURCE_DESCRIPTOR m_CmTranslatedResource
VOID RevokeResources(VOID)
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
#define NULL
Definition: types.h:112
FxWakeInterruptMachine * m_WakeInterruptMachine
VOID RemoveInterruptObject(__in FxInterrupt *Interrupt)
Definition: fxpkgpnp.cpp:5965

Referenced by OnPostReleaseHardware().

◆ Disconnect()

_Must_inspect_result_ NTSTATUS FxInterrupt::Disconnect ( __in ULONG  NotifyFlags)

Definition at line 1340 of file interruptobject.cpp.

1361 {
1363  NTSTATUS status, finalStatus;
1364 
1365  finalStatus = STATUS_SUCCESS;
1367 
1368  //
1369  // Check to see if this interrupt object was actually assigned any
1370  // resources. If it wasn't, then don't attempt to disconnect. A
1371  // WDFINTERRUPT object won't be assigned any resources if the underlying
1372  // device wasn't granted any by the PnP manager.
1373  //
1374 
1375  if (m_InterruptInfo.Vector == 0) {
1376  return STATUS_SUCCESS;
1377  }
1378 
1379  if (IsWakeCapable() &&
1380  (NotifyFlags & NotifyResourcesArmedForWake)) {
1381  //
1382  // If an interrupt is marked as wakeable and the device has been set to
1383  // wake via a driver-owned ISR, leave the interrupt connected.
1384  //
1386 
1388 
1389  return STATUS_SUCCESS;
1390  }
1391 
1392  //
1393  // This takes care of the power-up failure path for interrupt that doesnt
1394  // support soft disconnect. The interrupt has already been hard
1395  // disconnected in power-up failure path.
1396  //
1397  if ((NotifyFlags & NotifyResourcesDisconnectInactive) &&
1398  (IsSoftDisconnectCapable() == FALSE) &&
1399  (IsActiveForWake() == FALSE)) {
1400  //
1401  // We got here to disconnect an inactive interrupt. But if
1402  // this interrupt is not Soft Disconnect capable then it was
1403  // never made inactive in the first place so nothing to do here.
1404  // It should already be hard disconnected by now.
1405  //
1406  ASSERT(NotifyFlags & NotifyResourcesForceDisconnect);
1407 
1408  return STATUS_SUCCESS;
1409  }
1410 
1411 
1412  if (m_Connected == FALSE) {
1413  //
1414  // No way we can be not connect and enabled
1415  //
1416  ASSERT(m_Enabled == FALSE);
1417 
1418  //
1419  // if m_Connected is FALSE because the driver forcefully disconnected
1420  // the interrupt we still want to disconnect the actual interrupt object
1421  // if the caller wants to force disconnect (e.g., the device is being
1422  // removed)
1423  //
1424  if (m_Interrupt != NULL &&
1425  (NotifyFlags & NotifyResourcesForceDisconnect)) {
1426  //
1427  // If the driver lets the state machine handle the interrupt state
1428  // we should never get here so make sure the driver forced the issue.
1429  //
1431 
1432  goto Disconnect;
1433  }
1434 
1435  return STATUS_SUCCESS;
1436  }
1437 
1438  if (m_Enabled && ((NotifyFlags & NotifyResourcesSurpriseRemoved) == 0)) {
1439 
1440  //
1441  //
1442  // For wake capable interrupts it is possible to enter this path
1443  // with NotifyResourcesDisconnectInactive flag if the device fails
1444  // to power up after the interrupt was left connected during Dx
1445  //
1446  if (IsWakeCapable() == FALSE) {
1447  ASSERT((NotifyFlags & NotifyResourcesDisconnectInactive) == 0);
1448  }
1449 
1450  //
1451  // Disable the interrupt at the hardware.
1452  //
1454 
1455  m_Enabled = FALSE;
1456 
1457  if (!NT_SUCCESS(status)) {
1458  //
1459  // Even upon failure we continue because we don't want to leave
1460  // the interrupt connected when we tear down the stack.
1461  //
1464  "EvtInterruptDisable WDFDEVICE %p, WDFINTERRUPT %p, "
1465  "PKINTERRUPT %p returned %!STATUS!",
1466  m_Device->GetHandle(),
1468 
1469  //
1470  // Overwrite the previous value. Not a big deal since both are
1471  // errors.
1472  //
1473  finalStatus = status;
1474  }
1475  }
1476 
1477 #if FX_IS_KERNEL_MODE
1478  //
1479  // Some edge-triggered interrupts may fire before the connection process is
1480  // finished and m_Interrupt is set. To accomodate them, we save the KINTERRUPT
1481  // in _InterruptThunk to m_InterruptCaptured which serves as a backup for
1482  // m_Interrupt. Now we need to NULL m_InterruptCaptured and ensure that
1483  // _InterruptThunk will not re-capture it.
1484  //
1486  //
1487  // Synchronize the setting of m_Disconnecting with any running ISRs.
1488  // No new ISR callbacks will run after _SynchronizeExecution returns,
1489  // until m_Disconnecting is set to FALSE again.
1490  //
1491  if (m_Interrupt != NULL) {
1493  }
1494 
1495  //
1496  // Because m_Disconnecting was set, we know the ISR
1497  // will not re-capture the KINTERRUPT again.
1498  //
1500  }
1501 #endif
1502 
1503  //
1504  // Now flush queued callbacks so that we know that nobody is still trying to
1505  // synchronize against this interrupt. For KMDF this will flush DPCs and
1506  // for UMDF this will send a message to reflector to flush queued DPCs.
1507  //
1508  FlushQueuedDpcs();
1509 
1510 #if FX_IS_KERNEL_MODE
1511  //
1512  // Rundown the workitem if present (passive-level interrupt support or KMDF).
1513  // Not needed for UMDF since reflector doesn't use workitem for isr.
1514  //
1516 
1517 #endif
1518 
1519  //
1520  // See if we need to just do soft disconnect. Soft disconnect is done only
1521  // during explicit power down.
1522  //
1523  if (IsSoftDisconnectCapable() &&
1524  (NotifyFlags & NotifyResourcesExplicitPowerDown)) {
1526 
1527  goto Exit;
1528  }
1529 
1530  //
1531  // In the NP path we disable the interrupt but do not disconnect the
1532  // interrupt. (That is b/c IoDisconnectInterrupt is a pagable function and
1533  // calling it could cause paging I/O on this device which will be unserviceable
1534  // because it is in Dx.
1535  //
1536  if (NotifyFlags & NotifyResourcesNP) {
1537  //
1538  // If we are in the NP path, force disconnect should not be set. Force
1539  // disconnect is setup during a query remove/stop power down.
1540  //
1541  ASSERT((NotifyFlags & NotifyResourcesForceDisconnect) == 0);
1542 
1543  goto Exit;
1544  }
1545 
1546 Disconnect:
1547  //
1548  // Disconnect the interrupt. For KMDF, this calls the kernel DDI, and for
1549  // UMDF, sends a sync message to reflector.
1550  //
1552 
1553  if (IsActiveForWake()) {
1554  //
1555  // Since the interrupt has been disconnected, it not longer active
1556  // for wake
1557  //
1559  }
1560 
1561  m_Connected = FALSE;
1562 
1563 #if FX_IS_KERNEL_MODE
1564  m_Active = FALSE;
1565 #endif
1566 
1567 Exit:
1569 
1570  return finalStatus;
1571 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
#define TRUE
Definition: types.h:120
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
static MdInterruptSynchronizeRoutineType _InterruptMarkDisconnecting
VOID FlushQueuedWorkitem(VOID)
BOOLEAN m_IsEdgeTriggeredNonMsiInterrupt
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ NTSTATUS Disconnect(__in ULONG NotifyFlags)
BOOLEAN m_Disconnecting
#define FALSE
Definition: types.h:117
BOOLEAN m_ForceDisconnected
VOID DisconnectInternal(VOID)
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
BOOLEAN IsSoftDisconnectCapable(VOID)
BOOLEAN m_Enabled
BOOLEAN _SynchronizeExecution(__in MdInterrupt Interrupt, __in MdInterruptSynchronizeRoutine SynchronizeRoutine, __in PVOID SynchronizeContext)
VOID FlushQueuedDpcs(VOID)
PFX_DRIVER_GLOBALS pFxDriverGlobals
#define ASSERT(a)
Definition: mode.c:44
NTSTATUS InterruptDisable(VOID)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static void Exit(void)
Definition: sock.c:1331
BOOLEAN m_Active
BOOLEAN m_Connected
__inline BOOLEAN IsWakeCapable(VOID)
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGPNP
Definition: dbgtrace.h:67
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
WDFINTERRUPT GetHandle(VOID)
#define STATUS_SUCCESS
Definition: shellext.h:65
VOID ReportInactive(_In_ BOOLEAN Internal=FALSE)
VOID SetActiveForWake(__in BOOLEAN ActiveForWake)
static SERVICE_STATUS status
Definition: service.c:31
BOOLEAN IsActiveForWake(VOID)
struct _KINTERRUPT * m_InterruptCaptured
WDF_INTERRUPT_INFO m_InterruptInfo
Definition: ps.c:97

Referenced by ForceDisconnect(), and FxPkgPnp::NotifyResourceObjectsDx().

◆ DisconnectInternal()

VOID FxInterrupt::DisconnectInternal ( VOID  )

Definition at line 177 of file interruptobjectkm.cpp.

180 {
182  PKINTERRUPT interruptObject;
183  FxPkgPnp* fxPkgPnp;
184 
185  fxPkgPnp = m_Device->m_PkgPnp;
186 
187  //
188  // Now null these pointers so that we can catch anyone trying to use them
189  // erroneously.
190  //
191  interruptObject = m_Interrupt;
192  m_Interrupt = NULL;
193 
194  //
195  // Disconnect the interrupt.
196  //
197  ASSERT(fxPkgPnp->m_IoDisconnectInterruptEx != NULL);
198 
199  RtlZeroMemory(&params, sizeof(params));
200 
203  }
204  else {
206  }
207 
208  params.ConnectionContext.InterruptObject = interruptObject;
209 
210  fxPkgPnp->m_IoDisconnectInterruptEx(&params);
211 
212  return;
213 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
#define CONNECT_FULLY_SPECIFIED_GROUP
#define CONNECT_FULLY_SPECIFIED
PFN_IO_DISCONNECT_INTERRUPT_EX m_IoDisconnectInterruptEx
Definition: fxpkgpnp.hpp:4289
GLenum const GLfloat * params
Definition: glext.h:5645
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
#define ASSERT(a)
Definition: mode.c:44
_Must_inspect_result_ __inline BOOLEAN FxIsProcessorGroupSupported(VOID)
Definition: fxglobalskm.h:734
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
#define NULL
Definition: types.h:112
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by Disconnect().

◆ Dispose()

BOOLEAN FxInterrupt::Dispose ( VOID  )
virtual

Reimplemented from FxObject.

Definition at line 915 of file interruptobject.cpp.

918 {
919  // MarkPassiveDispose() in Initialize ensures this
921 
922  FlushAndRundown();
923 
924  return TRUE;
925 }
#define TRUE
Definition: types.h:120
#define ASSERT(a)
Definition: mode.c:44
VOID FlushAndRundown(VOID)
static __inline KIRQL MxGetCurrentIrql()
Definition: mxgeneralkm.h:86
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693

◆ DpcHandler()

VOID FxInterrupt::DpcHandler ( __in_opt PVOID  SystemArgument1,
__in_opt PVOID  SystemArgument2 
)

Definition at line 52 of file interruptobjectkm.cpp.

56 {
59 
61 
63 
64  //
65  // Call the drivers registered DpcForIsr event callback
66  //
67  if (m_CallbackLock != NULL) {
68  KIRQL irql = 0;
69 
73  }
74  else {
76  }
77 
78  return;
79 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
virtual void Lock(__out PKIRQL PreviousIrql)=0
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
#define ASSERT(a)
Definition: mode.c:44
FxCallbackLock * m_CallbackLock
Definition: fxinterrupt.hpp:93
virtual void Unlock(__in KIRQL PreviousIrql)=0
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
#define NULL
Definition: types.h:112
WDFINTERRUPT GetHandle(VOID)
FX_TRACK_DRIVER(fxDriverGlobals)
PFN_WDF_INTERRUPT_DPC m_EvtInterruptDpc

◆ FilterResourceRequirements()

VOID FxInterrupt::FilterResourceRequirements ( __inout PIO_RESOURCE_DESCRIPTOR  IoResourceDescriptor)

Definition at line 216 of file interruptobjectkm.cpp.

237 {
238  //
239  // Set sharing policy.
240  //
241  switch (m_ShareVector) {
242  case WdfTrue:
243  //
244  // Override the bus driver's value, explicitly sharing this interrupt.
245  //
246  IoResourceDescriptor->ShareDisposition = CmResourceShareShared;
247  break;
248 
249  case WdfFalse:
250  //
251  // Override the bus driver's value, explicitly claiming this interrupt
252  // as non-shared.
253  //
254  IoResourceDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
255  break;
256 
257  case WdfUseDefault:
258  default:
259  //
260  // Leave the bus driver's value alone.
261  //
262  break;
263  }
264 
265  //
266  // Apply policy. Only do this if we are running on an OS which supports
267  // the notion of Interrupt Policy and if the policy is not already included
268  // by the bus driver based on registry settings.
269  //
271  m_SetPolicy &&
272  (IoResourceDescriptor->Flags & CM_RESOURCE_INTERRUPT_POLICY_INCLUDED) == 0x0) {
273 
274  IoResourceDescriptor->Flags |= CM_RESOURCE_INTERRUPT_POLICY_INCLUDED;
275  IoResourceDescriptor->u.Interrupt.AffinityPolicy = (IRQ_DEVICE_POLICY)m_Policy;
276  IoResourceDescriptor->u.Interrupt.PriorityPolicy = (IRQ_PRIORITY)m_Priority;
277  IoResourceDescriptor->u.Interrupt.TargetedProcessors = m_Processors.Mask;
278  IoResourceDescriptor->u.Interrupt.Group = m_Processors.Group;
279  }
280 }
enum _IRQ_DEVICE_POLICY IRQ_DEVICE_POLICY
GLint x0
Definition: linetemp.h:95
WDF_TRI_STATE m_ShareVector
Definition: fxinterrupt.hpp:54
enum _IRQ_PRIORITY IRQ_PRIORITY
WDF_INTERRUPT_POLICY m_Policy
#define CM_RESOURCE_INTERRUPT_POLICY_INCLUDED
Definition: cmtypes.h:146
WDF_INTERRUPT_PRIORITY m_Priority
KAFFINITY Mask
Definition: ntbasedef.h:660
BOOLEAN m_SetPolicy
FxLibraryGlobalsType FxLibraryGlobals
Definition: globals.cpp:95
#define NULL
Definition: types.h:112
GROUP_AFFINITY m_Processors
PFN_IO_CONNECT_INTERRUPT_EX IoConnectInterruptEx
Definition: fxglobals.h:730
$USHORT Group
Definition: ntbasedef.h:661

Referenced by FxPkgPnp::FilterResourceRequirements().

◆ FlushAndRundown()

VOID FxInterrupt::FlushAndRundown ( VOID  )
private

Definition at line 1646 of file interruptobject.cpp.

1647 {
1648  FxObject* pObject;
1649 
1650  //
1651  // This called at PASSIVE_LEVEL which is required for
1652  // IoDisconnectInterrupt and KeFlushQueuedDpcs
1653  //
1655 
1656  //
1657  // If we have the KeFlushQueuedDpcs function call it
1658  // to ensure the DPC routine is no longer running before
1659  // we release the final reference to memory and the framework objects
1660  //
1661  FlushQueuedDpcs();
1662 
1663  //
1664  // Do mode-specific work.
1665  //
1667 
1668  //
1669  // Release the reference taken in FxInterrupt::Initialize
1670  //
1671  if (m_Device != NULL) {
1672  pObject = m_Device;
1673  m_Device = NULL;
1674 
1675  pObject->RELEASE(this);
1676  }
1677 
1678  //
1679  // Release the reference taken in FxInterrupt::Initialize
1680  //
1682 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
FxObject * pObject
static MdInterruptServiceRoutineType _InterruptThunk
#define RELEASE(_tag)
Definition: fxobject.hpp:50
VOID FlushAndRundownInternal(VOID)
VOID FlushQueuedDpcs(VOID)
#define ASSERT(a)
Definition: mode.c:44
static __inline KIRQL MxGetCurrentIrql()
Definition: mxgeneralkm.h:86
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define NULL
Definition: types.h:112

Referenced by Dispose().

◆ FlushAndRundownInternal()

VOID FxInterrupt::FlushAndRundownInternal ( VOID  )
private

Definition at line 413 of file interruptobjectkm.cpp.

416 {
417  //
418  // Rundown the workitem.
419  //
420  if (m_SystemWorkItem != NULL) {
423  }
424 
425  //
426  // If present, delete the default passive-lock.
427  //
428  if (m_DisposeWaitLock) {
429  ASSERT(m_WaitLock != NULL);
431  m_WaitLock = NULL;
433  }
434 }
FxWaitLock * m_WaitLock
Definition: fxinterrupt.hpp:77
virtual VOID DeleteObject(VOID)
BOOLEAN m_DisposeWaitLock
Definition: fxinterrupt.hpp:98
FxSystemWorkItem * m_SystemWorkItem
Definition: fxinterrupt.hpp:87
#define FALSE
Definition: types.h:117
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112

Referenced by FlushAndRundown().

◆ FlushQueuedDpcs()

VOID FxInterrupt::FlushQueuedDpcs ( VOID  )

Definition at line 283 of file interruptobjectkm.cpp.

286 {
288 }
VOID NTAPI KeFlushQueuedDpcs(VOID)
Definition: dpc.c:918

Referenced by Disconnect(), and FlushAndRundown().

◆ FlushQueuedWorkitem()

VOID FxInterrupt::FlushQueuedWorkitem ( VOID  )

Definition at line 1864 of file interruptobject.cpp.

1867 {
1868  if (m_SystemWorkItem != NULL) {
1870  }
1871 }
FxSystemWorkItem * m_SystemWorkItem
Definition: fxinterrupt.hpp:87
#define NULL
Definition: types.h:112

Referenced by Disconnect().

◆ ForceDisconnect()

_Must_inspect_result_ NTSTATUS FxInterrupt::ForceDisconnect ( VOID  )

Definition at line 1576 of file interruptobject.cpp.

1579 {
1580  ULONG flags;
1581 
1582  //
1583  // Since we have no context or coordination of power state when these calls
1584  // are made, our only recourse is to see if the device is power pagable or
1585  // not and use that as the basis for our flags.
1586  //
1589  }
1590  else {
1592  }
1593 
1594  //
1595  // Log the event because the driver is not allow the state machine to handle
1596  // the interrupt's state.
1597  //
1600  "Force disconnect called on WDFDEVICE %p, WDFINTERRUPT %p, PKINTERRUPT %p",
1602 
1604 
1605  return Disconnect(flags);
1606 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
#define DO_POWER_PAGABLE
#define TRUE
Definition: types.h:120
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29
_Must_inspect_result_ NTSTATUS Disconnect(__in ULONG NotifyFlags)
BOOLEAN m_ForceDisconnected
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
ULONG __inline GetDeviceObjectFlags(VOID)
Definition: fxdevice.hpp:192
GLbitfield flags
Definition: glext.h:7161
#define TRACINGPNP
Definition: dbgtrace.h:67
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
WDFINTERRUPT GetHandle(VOID)
unsigned int ULONG
Definition: retypes.h:1

◆ ForceReconnect()

_Must_inspect_result_ NTSTATUS FxInterrupt::ForceReconnect ( VOID  )

Definition at line 1610 of file interruptobject.cpp.

1613 {
1614  ULONG flags;
1615 
1616  //
1617  // Since we have no context or coordination of power state when these calls
1618  // are made, our only recourse is to see if the device is power pagable or
1619  // not and use that as the basis for our flags.
1620  //
1623  }
1624  else {
1626  }
1627 
1628  //
1629  // Log the event because the driver is not allow the state machine to handle
1630  // the interrupt's state.
1631  //
1634  "Force connect called on WDFDEVICE %p, WDFINTERRUPT %p, PKINTERRUPT %p",
1636 
1638 
1639  return Connect(flags);
1640 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
#define DO_POWER_PAGABLE
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29
_Must_inspect_result_ NTSTATUS Connect(__in ULONG NotifyFlags)
#define FALSE
Definition: types.h:117
BOOLEAN m_ForceDisconnected
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
ULONG __inline GetDeviceObjectFlags(VOID)
Definition: fxdevice.hpp:192
GLbitfield flags
Definition: glext.h:7161
#define TRACINGPNP
Definition: dbgtrace.h:67
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
WDFINTERRUPT GetHandle(VOID)
unsigned int ULONG
Definition: retypes.h:1

◆ GetDevice()

CfxDevice* FxInterrupt::GetDevice ( VOID  )
inline

Definition at line 517 of file fxinterrupt.hpp.

520  {
521  return m_Device;
522  }
CfxDevice * m_Device
Definition: fxobject.hpp:329

Referenced by WdfInterruptGetDevice().

◆ GetHandle()

◆ GetInfo()

PWDF_INTERRUPT_INFO FxInterrupt::GetInfo ( VOID  )

Definition at line 902 of file interruptobject.cpp.

905 {
906  return &m_InterruptInfo;
907 }
WDF_INTERRUPT_INFO m_InterruptInfo

◆ GetInterruptPtr()

__inline struct _KINTERRUPT * FxInterrupt::GetInterruptPtr ( VOID  )

Definition at line 34 of file fxinterruptkm.hpp.

37 {
38  struct _KINTERRUPT* interrupt = m_Interrupt;
39 
40  if (interrupt == NULL) {
41  interrupt = m_InterruptCaptured;
42  }
43 
44  return interrupt;
45 }
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
#define NULL
Definition: types.h:112
struct _KINTERRUPT * m_InterruptCaptured

Referenced by AcquireLock(), ReleaseLock(), Synchronize(), and WdfInterruptWdmGetInterrupt().

◆ GetResourceIrql()

KIRQL FxInterrupt::GetResourceIrql ( VOID  )
inline

Definition at line 562 of file fxinterrupt.hpp.

565  {
566  return m_InterruptInfo.Irql;
567  }
WDF_INTERRUPT_INFO m_InterruptInfo

Referenced by FxPkgPnp::PnpAssignInterruptsSyncIrql().

◆ GetResources()

PCM_PARTIAL_RESOURCE_DESCRIPTOR FxInterrupt::GetResources ( VOID  )
inline

Definition at line 768 of file fxinterrupt.hpp.

771  {
772  // Weak ref to the translated resource interrupt descriptor.
773  // It is valid from prepare hardware callback to release hardware callback.
774  return m_CmTranslatedResource;
775  }
PCM_PARTIAL_RESOURCE_DESCRIPTOR m_CmTranslatedResource

Referenced by FxPkgPnp::ValidateInterruptResourceCm().

◆ GetSyncIrql()

KIRQL FxInterrupt::GetSyncIrql ( VOID  )
inline

Definition at line 554 of file fxinterrupt.hpp.

557  {
558  return m_SynchronizeIrql;
559  }
volatile KIRQL m_SynchronizeIrql
Definition: fxinterrupt.hpp:67

Referenced by FxPkgPnp::PnpAssignInterruptsSyncIrql().

◆ Initialize()

_Must_inspect_result_ NTSTATUS FxInterrupt::Initialize ( __in CfxDevice Device,
__in FxObject Parent,
__in PWDF_INTERRUPT_CONFIG  Configuration 
)

Definition at line 483 of file interruptobject.cpp.

488 {
490  FxPkgPnp* pkgPnp;
491 
494 
495  //
496  // DIRQL handling: FxInterrupt can be parented by, and optionally
497  // serialize its DpcForIsr or WorItemForIsr with an FxDevice or
498  // FxIoQueue.
499  //
500  // Passive handling: FxInterrupt can be parented by, and optionally
501  // serialize its WorItemForIsr with an FxDevice or FxIoQueue.
502 
503  //
504  // Add a reference to the device object we are associated with. We will be
505  // notified in Dispose to release this reference.
506  //
507  Device->ADDREF(this);
508 
509  //
510  // It is important to store the Device only after taking the reference
511  // because Dispose checks for m_Device != NULL to release the reference. If
512  // assign it here and then take the reference later, we can return failure
513  // in between the assignment and reference and then release a reference that
514  // was not taken in Dispose.
515  //
516  m_Device = Device;
517  pkgPnp = m_Device->m_PkgPnp;
518 
519  //
520  // NOTE: Since Dispose always releases this reference, we *must* take this
521  // reference, so that even if we return error, the reference is
522  // still there to be removed on cleanup.
523  //
525 
526  //
527  // Values always supplied by the caller
528  //
529  m_ShareVector = Configuration->ShareVector;
530  m_FloatingSave = Configuration->FloatingSave;
531 
532  m_EvtInterruptEnable = Configuration->EvtInterruptEnable;
533  m_EvtInterruptDisable = Configuration->EvtInterruptDisable;
534 
535  //
536  // Do further initialization
537  //
539  if (!NT_SUCCESS(status)) {
540  return status;
541  }
542 
543  //
544  // Update the message number used for MSI support
545  //
547 
548  //
549  // This logic is executed when the driver creates interrupts in its
550  // EvtDevicePrepareHardware callback.
551  //
552  if (Configuration->InterruptRaw != NULL) {
553 
554  ASSERT(Configuration->InterruptTranslated != NULL);
556 
558 
559  //
560  // Get the real resource descriptors not the copies.
561  //
562  cmDescRaw = &(CONTAINING_RECORD(Configuration->InterruptRaw,
563  FxResourceCm,
564  m_DescriptorClone))->m_Descriptor;
565 
566  cmDescTrans = &(CONTAINING_RECORD(Configuration->InterruptTranslated,
567  FxResourceCm,
568  m_DescriptorClone))->m_Descriptor;
569  //
570  // Assign resources to this interrupt.
571  //
572  FxInterrupt::AssignResources(cmDescRaw, cmDescTrans);
573  }
574 
575  // Add this interrupt to the list of them being kept in the PnP package.
576  pkgPnp->AddInterruptObject(this);
577 
579 
580  return STATUS_SUCCESS;
581 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
static MdInterruptServiceRoutineType _InterruptThunk
VOID AssignResources(__in PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescRaw, __in PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescTrans)
BOOLEAN m_AddedToList
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG Configuration
Definition: wdfinterrupt.h:372
#define TRUE
Definition: types.h:120
BOOLEAN m_CreatedInPrepareHardware
LONG NTSTATUS
Definition: precomp.h:26
PFN_WDF_INTERRUPT_DISABLE m_EvtInterruptDisable
WDF_TRI_STATE m_ShareVector
Definition: fxinterrupt.hpp:54
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:728
#define ADDREF(_tag)
Definition: fxobject.hpp:49
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
BOOLEAN m_FloatingSave
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG m_InterruptObjectCount
Definition: fxpkgpnp.hpp:4308
__inline WDF_DEVICE_PNP_STATE GetDevicePnpState()
Definition: fxdevice.hpp:1149
_Must_inspect_result_ NTSTATUS InitializeWorker(__in FxObject *Parent, __in PWDF_INTERRUPT_CONFIG Configuration)
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
PFN_WDF_INTERRUPT_ENABLE m_EvtInterruptEnable
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
#define NULL
Definition: types.h:112
VOID AddInterruptObject(__in FxInterrupt *Interrupt)
Definition: fxpkgpnp.cpp:5928
return &pObject m_DescriptorClone
#define STATUS_SUCCESS
Definition: shellext.h:65
static SERVICE_STATUS status
Definition: service.c:31
WDF_INTERRUPT_INFO m_InterruptInfo
Definition: ps.c:97

Referenced by _CreateAndInit().

◆ InitializeInternal()

_Must_inspect_result_ NTSTATUS FxInterrupt::InitializeInternal ( __in FxObject Parent,
__in PWDF_INTERRUPT_CONFIG  Configuration 
)

Definition at line 38 of file interruptobjectkm.cpp.

42 {
45 
46  DO_NOTHING();
47 
48  return STATUS_SUCCESS;
49 }
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG Configuration
Definition: wdfinterrupt.h:372
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:728
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DO_NOTHING()
Definition: mxgeneral.h:32

Referenced by InitializeWorker().

◆ InitializeWorker()

_Must_inspect_result_ NTSTATUS FxInterrupt::InitializeWorker ( __in FxObject Parent,
__in PWDF_INTERRUPT_CONFIG  Configuration 
)

Definition at line 585 of file interruptobject.cpp.

589 {
590  FxObject* tmpObject;
593  CfxDeviceBase* deviceBase;
594  BOOLEAN passiveCallbacks;
595 
597  const WDFTYPE parentType = Parent->GetType();
598 
599  //
600  // Init interrupt's callbacks.
601  //
602  m_EvtInterruptIsr = Configuration->EvtInterruptIsr;
603  m_EvtInterruptDpc = Configuration->EvtInterruptDpc;
604  m_EvtInterruptWorkItem = Configuration->EvtInterruptWorkItem;
605 
606  //
607  // Init soft disconnect configuration
608  //
609  switch (Configuration->ReportInactiveOnPowerDown) {
610  case WdfTrue:
612  break;
613 
614  case WdfFalse:
616  break;
617 
618  case WdfUseDefault:
619  default:
620  //
621  // Leave the driver's value alone.
622  //
623  break;
624  }
625 
626  //
627  // TRUE if passive-level interrupt handling is enabled for this interrupt.
628  //
629  m_PassiveHandling = Configuration->PassiveHandling;
630 
631  //
632  // If the caller specified a spinlock we use it.
633  //
634  if (Configuration->SpinLock != NULL) {
635  FxSpinLock* pFxSpinLock;
636 
638  Configuration->SpinLock,
640  (PVOID*)&pFxSpinLock);
641 
642  pFxSpinLock->SetInterruptSpinLock();
643 
644  m_SpinLock = pFxSpinLock->GetLock();
645  }
646  else if (m_PassiveHandling == FALSE) {
647  //
648  // If the caller does not specify a spinlock, and this is
649  // a DIRQL interrupt we use a built in one.
650  // Originally this logic was added to allow Acquire/Release Lock
651  // to work on W2K platforms that does not support
652  // KeAcquireInterruptSpinLock.
653  //
655  }
656 
657  //
658  // Automatic serialization: the DPC or work-item is synchronized with
659  // the parent's callback lock.
660  //
661 
662  //
663  // Get the first ancestor that implements callbacks.
664  //
666 
667  //
668  // Validate parent:
669  // - the specified device (from API) must be one of the ancestors.
670  // - the parent can only be a queue or a device.
671  //
672  if (m_DeviceBase == NULL || deviceBase != m_DeviceBase ||
673  (parentType != FX_TYPE_QUEUE && parentType != FX_TYPE_DEVICE)) {
677  "The specified object 0x%p is not a valid parent for a "
678  "WDFINTERRUPT, WDF_INTERRUPT_CONFIG structure 0x%p passed, "
679  "%!STATUS!", Parent->GetObjectHandle(), Configuration, status);
680 
681  return status;
682  }
683 
684  //
685  // If automatic-serialization is off, m_CallbackLock is NULL.
686  // else if parent doesn't use locking, m_CallbackLock is NULL.
687  // else if work-item ISR callback set, m_CallbackLock is a passive lock.
688  // else m_CallbackLock is a spin-lock.
689  //
690  // Note: logic retrieves the parent's callback lock when automatic
691  // serialization is on even if work-item or DPC callbacks are not set,
692  // this is not to break the existing behavior/validation.
693  //
694  if (Configuration->EvtInterruptWorkItem != NULL) {
695  passiveCallbacks = TRUE;
696  }
697  else if (Configuration->EvtInterruptDpc != NULL) {
698  passiveCallbacks = FALSE;
699  }
700  else if (m_PassiveHandling) {
701  passiveCallbacks = TRUE;
702  }
703  else {
704  passiveCallbacks = FALSE;
705  }
706 
708  callbacks, // IFxHasCallbacks*
709  Configuration->AutomaticSerialization,
710  passiveCallbacks,
712  &tmpObject // No reference count is taken.
713  );
714  if (!NT_SUCCESS(status)) {
715  //
716  // We should never incur this error.
717  //
719  return status;
720  }
721 
722  //
723  // If the parent is a queue, the queue inherits the deletion constraints of the
724  // interrupt object, i.e., driver cannot manually delete the queue.
725  //
726  if (FX_TYPE_QUEUE == parentType) {
727  ((FxIoQueue*)Parent)->SetInterruptQueue();
728  }
729 
730  //
731  // Passive-level handling: init wait-lock.
732  //
733  if (m_PassiveHandling) {
734  ASSERT(NULL == m_SpinLock);
735 
736  //
737  //If the caller specified a waitlock, we use it.
738  //
739  if (Configuration->WaitLock != NULL) {
742  Configuration->WaitLock,
744  (PVOID*)&m_WaitLock);
745  }
746 
747  //
748  // Use a default lock if none was specified.
749  //
750  if (NULL == m_WaitLock) {
751  WDFWAITLOCK waitLock = NULL;
752  WDF_OBJECT_ATTRIBUTES attributes;
753 
754  WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
755 
758  &attributes,
759  NULL,
760  FALSE,
761  &waitLock);
762 
763  if (!NT_SUCCESS(status)) {
765  "Could not allocate waitlock, %!STATUS!",
766  status);
767  return status;
768  }
769 
771  waitLock,
773  (PVOID*)&m_WaitLock);
774  //
775  // Explicitly dispose this wait-lock object.
776  //
778  }
779  }
780 
781  //
782  // If needed, initialize the interrupt's workitem.
783  // Alloacte workitem if driver specified EvtInterruptWorkitem.
784  // In addition, for Umdf, allocate workitem if driver alternatively
785  // specified EvtInterruptDpc. Note that driver is not allwed to specify both.
786  //
787  if (m_EvtInterruptWorkItem != NULL ||
793 
794  if (!NT_SUCCESS(status)) {
796  "Could not allocate workitem, %!STATUS!",
797  status);
798  return status;
799  }
800  }
801 
802  //
803  // Do mode-apecific initialization
804  //
806  if (!NT_SUCCESS(status)) {
807  return status;
808  }
809 
810  return STATUS_SUCCESS;
811 }
FxWaitLock * m_WaitLock
Definition: fxinterrupt.hpp:77
CfxDevice * m_Device
Definition: fxobject.hpp:329
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PVOID WdmObject, __out FxSystemWorkItem **pObject)
MdDeviceObject __inline GetDeviceObject(VOID)
Definition: fxdevice.hpp:174
static _Must_inspect_result_ NTSTATUS _GetEffectiveLock(__in FxObject *Object, __in_opt IFxHasCallbacks *Callbacks, __in BOOLEAN AutomaticLocking, __in BOOLEAN PassiveCallbacks, __out FxCallbackLock **CallbackLock, __out_opt FxObject **CallbackLockObject)
Definition: fxobject.cpp:1044
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG Configuration
Definition: wdfinterrupt.h:372
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN m_DisposeWaitLock
Definition: fxinterrupt.hpp:98
BOOLEAN IsUserModeFramework
Definition: fxglobals.h:825
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), Fdo, FX_TYPE_DEVICE,(PVOID *)&pFdo)
FxSystemWorkItem * m_SystemWorkItem
Definition: fxinterrupt.hpp:87
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:728
static FxDeviceBase * _SearchForDevice(__in FxObject *Object, __out_opt IFxHasCallbacks **Callbacks)
#define FALSE
Definition: types.h:117
MdLock & Get()
Definition: mxlock.h:43
#define STATUS_WDF_INCOMPATIBLE_EXECUTION_LEVEL
Definition: wdfstatus.h:198
unsigned char BOOLEAN
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
BOOLEAN m_PassiveHandling
PFN_WDF_INTERRUPT_WORKITEM m_EvtInterruptWorkItem
MdLock * GetLock(VOID)
Definition: fxspinlock.hpp:65
BOOLEAN m_UseSoftDisconnect
MdLock * m_SpinLock
Definition: fxinterrupt.hpp:64
CfxDeviceBase * m_DeviceBase
Definition: fxobject.hpp:328
FxCallbackLock * m_CallbackLock
Definition: fxinterrupt.hpp:93
FxLibraryGlobalsType FxLibraryGlobals
Definition: globals.cpp:95
PFN_WDF_INTERRUPT_ISR m_EvtInterruptIsr
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
FORCEINLINE VOID WDF_OBJECT_ATTRIBUTES_INIT(_Out_ PWDF_OBJECT_ATTRIBUTES Attributes)
Definition: wdfobject.h:147
#define TRACINGPNP
Definition: dbgtrace.h:67
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
PFX_DRIVER_GLOBALS fxDriverGlobals
USHORT WDFTYPE
Definition: fxtypes.h:29
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS DriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in_opt FxObject *ParentObject, __in BOOLEAN AssignDriverAsDefaultParent, __out WDFWAITLOCK *LockHandle)
Definition: fxwaitlock.cpp:32
#define NULL
Definition: types.h:112
_Must_inspect_result_ NTSTATUS InitializeInternal(__in FxObject *Parent, __in PWDF_INTERRUPT_CONFIG Configuration)
MxLock m_BuiltInSpinLock
Definition: fxinterrupt.hpp:72
PFN_WDF_INTERRUPT_DPC m_EvtInterruptDpc
#define STATUS_SUCCESS
Definition: shellext.h:65
static int callbacks
Definition: xmllint.c:873
static SERVICE_STATUS status
Definition: service.c:31
VOID SetInterruptSpinLock(VOID)
Definition: fxspinlock.hpp:73
Definition: ps.c:97

Referenced by Initialize().

◆ InterruptDisable()

NTSTATUS FxInterrupt::InterruptDisable ( VOID  )
private

Definition at line 1795 of file interruptobject.cpp.

1798 {
1800 
1801  params.Interrupt = this;
1802  params.ReturnVal = STATUS_SUCCESS;
1803 
1804  if (m_EvtInterruptDisable != NULL) {
1806  }
1807 
1808  return params.ReturnVal;
1809 }
PFN_WDF_INTERRUPT_DISABLE m_EvtInterruptDisable
GLenum const GLfloat * params
Definition: glext.h:5645
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
BOOLEAN _SynchronizeExecution(__in MdInterrupt Interrupt, __in MdInterruptSynchronizeRoutine SynchronizeRoutine, __in PVOID SynchronizeContext)
static MdInterruptSynchronizeRoutineType _InterruptDisableThunk
#define NULL
Definition: types.h:112
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by Disconnect().

◆ InterruptDisableInvokeCallback()

NTSTATUS FxInterrupt::InterruptDisableInvokeCallback ( VOID  )
private

Definition at line 1751 of file interruptobject.cpp.

1754 {
1755  NTSTATUS status;
1756 
1757  if (m_PassiveHandling) {
1758  //
1759  // Passive-level interrupt handling: acquire our internal passive-lock
1760  // after the kernel acquired its own passive-lock and before invoking
1761  // the callback.
1762  //
1763  AcquireLock();
1765  m_Device->GetHandle());
1766  ReleaseLock();
1767  }
1768  else {
1769  //
1770  // DIRQL interrupt handling: invoke the callback.
1771  //
1773  m_Device->GetHandle());
1774  }
1775 
1776  return status;
1777 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
LONG NTSTATUS
Definition: precomp.h:26
PFN_WDF_INTERRUPT_DISABLE m_EvtInterruptDisable
BOOLEAN m_PassiveHandling
VOID ReleaseLock(VOID)
WDFINTERRUPT GetHandle(VOID)
VOID AcquireLock(VOID)
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ InterruptEnable()

NTSTATUS FxInterrupt::InterruptEnable ( VOID  )
private

Definition at line 1731 of file interruptobject.cpp.

1734 {
1736 
1737  params.Interrupt = this;
1738  params.ReturnVal = STATUS_SUCCESS;
1739 
1740  if (m_EvtInterruptEnable) {
1742  }
1743 
1744  return params.ReturnVal;
1745 }
GLenum const GLfloat * params
Definition: glext.h:5645
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
BOOLEAN _SynchronizeExecution(__in MdInterrupt Interrupt, __in MdInterruptSynchronizeRoutine SynchronizeRoutine, __in PVOID SynchronizeContext)
static MdInterruptSynchronizeRoutineType _InterruptEnableThunk
PFN_WDF_INTERRUPT_ENABLE m_EvtInterruptEnable
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by Connect().

◆ InterruptEnableInvokeCallback()

NTSTATUS FxInterrupt::InterruptEnableInvokeCallback ( VOID  )
private

Definition at line 1688 of file interruptobject.cpp.

1691 {
1692  NTSTATUS status;
1693 
1694  if (m_PassiveHandling) {
1695  //
1696  // Passive-level interrupt handling: acquire our internal passive-lock
1697  // after the kernel acquired its own passive-lock and before invoking
1698  // the callback.
1699  //
1700  AcquireLock();
1702  m_Device->GetHandle());
1703  ReleaseLock();
1704  }
1705  else {
1706  //
1707  // DIRQL interrupt handling: invoke the callback.
1708  //
1710  m_Device->GetHandle());
1711  }
1712 
1713  return status;
1714 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN m_PassiveHandling
VOID ReleaseLock(VOID)
PFN_WDF_INTERRUPT_ENABLE m_EvtInterruptEnable
WDFINTERRUPT GetHandle(VOID)
VOID AcquireLock(VOID)
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ InvokeWakeInterruptEvtIsr()

VOID FxInterrupt::InvokeWakeInterruptEvtIsr ( VOID  )

Definition at line 347 of file interruptobject.cpp.

362 {
365 
366  //
367  // Acquire our internal passive-lock after the kernel acquired its own
368  // passive-lock and before invoking the callback.
369  //
370  AcquireLock();
371 
373  GetHandle(),
375  ReleaseLock();
376 }
#define ASSERT(a)
Definition: mode.c:44
BOOLEAN m_PassiveHandling
VOID ReleaseLock(VOID)
PFN_WDF_INTERRUPT_ISR m_EvtInterruptIsr
#define NULL
Definition: types.h:112
WDFINTERRUPT GetHandle(VOID)
FxWakeInterruptMachine * m_WakeInterruptMachine
VOID AcquireLock(VOID)
WDF_INTERRUPT_INFO m_InterruptInfo

◆ IsActiveForWake()

BOOLEAN FxInterrupt::IsActiveForWake ( VOID  )
inline

Definition at line 357 of file fxinterrupt.hpp.

360  {
361  if ((m_WakeInterruptMachine != NULL) &&
363  return TRUE;
364  } else {
365  return FALSE;
366  }
367  }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NULL
Definition: types.h:112
FxWakeInterruptMachine * m_WakeInterruptMachine

Referenced by Connect(), and Disconnect().

◆ IsAutomaticSerialization()

__inline BOOLEAN FxInterrupt::IsAutomaticSerialization ( VOID  )
inline

Definition at line 494 of file fxinterrupt.hpp.

497  {
498  return m_CallbackLock != NULL ? TRUE : FALSE;
499  }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
FxCallbackLock * m_CallbackLock
Definition: fxinterrupt.hpp:93
#define NULL
Definition: types.h:112

◆ IsLevelTriggered()

BOOLEAN FxInterrupt::IsLevelTriggered ( __in ULONG  Flags)
inline

Definition at line 829 of file fxinterrupt.hpp.

832  {
835  }
#define CM_RESOURCE_INTERRUPT_LEVEL_LATCHED_BITS
Definition: cmtypes.h:151
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE
Definition: cmtypes.h:143

Referenced by AssignResources().

◆ IsPassiveConnect()

__inline BOOLEAN FxInterrupt::IsPassiveConnect ( VOID  )
inline

Definition at line 464 of file fxinterrupt.hpp.

467  {
468  //
469  // UMDF's handling of interrupt is split in two parts:
470  // 1. framework code that runs at passive always in host process and
471  // therefore uses mode-agnostic code meant for passive-level handling,
472  // tracked through m_PassiveHandling member.
473  // field of interrupt object.
474  // 2. redirector code that does passive handling of all of level-triggered
475  // interrupt and DIRQL handing of all others (edge and msi). Driver
476  // doesn't have any choice in that. The m_PassiveHandling field in the
477  // interrupt config is always set for passive for UMDF (through UMDF's
478  // init function). m_PasiveHandlingByRedirector member is present to
479  // this part of code.
480  // In summary, m_PassiveHandling and m_PasiveHandlingByRedirector
481  // effectively maintain how the interrupt is connected (passive or DIRQL),
482  // for KMDF and UMDF respectively. This routine tells how the
483  // interrupt is connnected by looking at these members.
484  //
485 #if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
486  return IsPassiveHandling();
487 #else
489 #endif
490  }
BOOLEAN m_PassiveHandlingByRedirector
__inline BOOLEAN IsPassiveHandling(VOID)

Referenced by AssignResources().

◆ IsPassiveHandling()

__inline BOOLEAN FxInterrupt::IsPassiveHandling ( VOID  )
inline

◆ IsSharedSpinLock()

BOOLEAN FxInterrupt::IsSharedSpinLock ( VOID  )
inline

Definition at line 538 of file fxinterrupt.hpp.

541  {
542  return m_SpinLock != &m_BuiltInSpinLock.Get() ? TRUE : FALSE;
543  }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
MdLock & Get()
Definition: mxlock.h:43
MdLock * m_SpinLock
Definition: fxinterrupt.hpp:64
MxLock m_BuiltInSpinLock
Definition: fxinterrupt.hpp:72

Referenced by FxPkgPnp::PnpAssignInterruptsSyncIrql().

◆ IsSoftDisconnectCapable()

BOOLEAN FxInterrupt::IsSoftDisconnectCapable ( VOID  )
inline

Definition at line 391 of file fxinterrupt.hpp.

394  {
395  if (m_UseSoftDisconnect &&
397  m_Interrupt != NULL &&
398  m_Connected) {
399  return TRUE;
400  }
401  else {
402  return FALSE;
403  }
404  }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
BOOLEAN m_UseSoftDisconnect
BOOLEAN m_Connected
FxLibraryGlobalsType FxLibraryGlobals
Definition: globals.cpp:95
#define NULL
Definition: types.h:112
PFN_IO_REPORT_INTERRUPT_INACTIVE IoReportInterruptInactive
Definition: fxglobals.h:764

Referenced by Connect(), and Disconnect().

◆ IsSyncIrqlSet()

BOOLEAN FxInterrupt::IsSyncIrqlSet ( VOID  )
inline

Definition at line 546 of file fxinterrupt.hpp.

549  {
551  }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
volatile KIRQL m_SynchronizeIrql
Definition: fxinterrupt.hpp:67
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693

Referenced by FxPkgPnp::PnpAssignInterruptsSyncIrql().

◆ IsWakeCapable()

__inline BOOLEAN FxInterrupt::IsWakeCapable ( VOID  )
inline

Definition at line 341 of file fxinterrupt.hpp.

344  {
345  return ((m_WakeInterruptMachine != NULL) ? TRUE:FALSE);
346  }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NULL
Definition: types.h:112
FxWakeInterruptMachine * m_WakeInterruptMachine

Referenced by Disconnect(), FxPkgPnp::SendEventToAllWakeInterrupts(), and FxPkgPnp::ValidateInterruptResourceCm().

◆ OnPostReleaseHardware()

VOID FxInterrupt::OnPostReleaseHardware ( VOID  )

Definition at line 891 of file interruptobject.cpp.

894 {
896  // Delete this interrupt.
897  DeleteObject();
898  }
899 }
BOOLEAN m_CreatedInPrepareHardware
virtual VOID DeleteObject(VOID)

Referenced by FxPkgPnp::PnpReleaseHardware().

◆ ProcessWakeInterruptEvent()

VOID FxInterrupt::ProcessWakeInterruptEvent ( __in FxWakeInterruptEvents  Event)
inline

Definition at line 370 of file fxinterrupt.hpp.

373  {
375  }
VOID ProcessEvent(__in FxWakeInterruptEvents Event)
FxWakeInterruptMachine * m_WakeInterruptMachine

Referenced by FxPkgPnp::SendEventToAllWakeInterrupts().

◆ QueueDeferredRoutineForIsr()

__inline BOOLEAN FxInterrupt::QueueDeferredRoutineForIsr ( VOID  )
inline

Definition at line 839 of file fxinterrupt.hpp.

842  {
843  //
844  // Queue DPC for KMDF and workitem for UMDF. Note that driver can either
845  // specify EvtInterruptDpc or EvtInterruptWorkItem, and therefore it can
846  // either call WdfInterruptQueueDpcForisr or WdfInterruptQueueWorkitemForIsr.
847  //
848 
849 
850 
851 
852  //
853 #if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
854  return QueueDpcForIsr();
855 #else
856  return QueueWorkItemForIsr();
857 #endif
858  }
BOOLEAN QueueDpcForIsr(VOID)
BOOLEAN QueueWorkItemForIsr(VOID)

Referenced by WdfInterruptQueueDpcForIsr().

◆ QueueDpcForIsr()

BOOLEAN FxInterrupt::QueueDpcForIsr ( VOID  )

Definition at line 82 of file interruptobjectkm.cpp.

85 {
86  BOOLEAN queued;
87 
88  //
89  // Using this function is optional,
90  // but the caller better have registered a handler
91  //
93 
94  queued = KeInsertQueueDpc(&m_Dpc, this, NULL);
95 
96  return queued;
97 }
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:724
unsigned char BOOLEAN
#define ASSERT(a)
Definition: mode.c:44
#define NULL
Definition: types.h:112
PFN_WDF_INTERRUPT_DPC m_EvtInterruptDpc

Referenced by QueueDeferredRoutineForIsr().

◆ QueueWorkItemForIsr()

BOOLEAN FxInterrupt::QueueWorkItemForIsr ( VOID  )

Definition at line 1812 of file interruptobject.cpp.

1815 {
1816  BOOLEAN queued;
1817 
1818  //
1819  // Using this function is optional,
1820  // but the caller better have registered a handler
1821  //
1822 #if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
1824 #else
1826 #endif
1827 
1829  //
1830  // Note: if the caller runs at DIRQL, the function returns the result
1831  // of KeInsertQueueDpc() and not that of WorkItem.TryToQueue().
1832  // The latter result is lost. Docs should clarify this behavior.
1833  //
1834 #if ((FX_CORE_MODE)==(FX_CORE_KERNEL_MODE))
1835  queued = Mx::MxInsertQueueDpc(&m_Dpc, this, NULL);
1836 #else
1837  queued = FALSE;
1838  FX_VERIFY(INTERNAL, TRAPMSG("Not expected"));
1839 #endif
1840  }
1841  else {
1843  }
1844 
1845  return queued;
1846 }
static EVT_SYSTEMWORKITEM _InterruptWorkItemCallback
FxSystemWorkItem * m_SystemWorkItem
Definition: fxinterrupt.hpp:87
__inline BOOLEAN TryToEnqueue(__in PFN_WDF_SYSTEMWORKITEM CallbackFunc, __in PVOID Parameter)
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
FX_VERIFY(INTERNAL, CHECK_NOT_NULL(LoaderInterface->pIWudfHost))
#define ASSERT(a)
Definition: mode.c:44
PFN_WDF_INTERRUPT_WORKITEM m_EvtInterruptWorkItem
static __inline KIRQL MxGetCurrentIrql()
Definition: mxgeneralkm.h:86
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define NULL
Definition: types.h:112
PFN_WDF_INTERRUPT_DPC m_EvtInterruptDpc
static __inline BOOLEAN MxInsertQueueDpc(__inout PRKDPC Dpc, __in_opt PVOID SystemArgument1, __in_opt PVOID SystemArgument2)
Definition: mxgeneralkm.h:786

Referenced by QueueDeferredRoutineForIsr(), and WdfInterruptQueueWorkItemForIsr().

◆ ReleaseLock()

VOID FxInterrupt::ReleaseLock ( VOID  )

Definition at line 1932 of file interruptobject.cpp.

1934 {
1935  if (FALSE == m_PassiveHandling) {
1936  struct _KINTERRUPT* kinterrupt = GetInterruptPtr();
1937 
1938  //
1939  // DIRQL interrupt handling.
1940  //
1941  ASSERTMSG("Can't synchronize when the interrupt isn't connected: ",
1942  kinterrupt != NULL);
1943 
1944  if (NULL != kinterrupt) {
1945 #pragma prefast(suppress:__WARNING_CALLER_FAILING_TO_HOLD, "Unable to annotate ReleaseLock for this case.");
1947  }
1948  }
1949  else {
1950  //
1951  // Passive-level interrupt handling when automatic serialization is off.
1952  //
1954  ASSERT(m_WaitLock != NULL);
1955 #pragma prefast(suppress:__WARNING_CALLER_FAILING_TO_HOLD, "Unable to annotate ReleaseLock for this case.");
1956  m_WaitLock->ReleaseLock(GetDriverGlobals());
1957  }
1958 }
FxWaitLock * m_WaitLock
Definition: fxinterrupt.hpp:77
#define FALSE
Definition: types.h:117
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define ASSERT(a)
Definition: mode.c:44
BOOLEAN m_PassiveHandling
static __inline KIRQL MxGetCurrentIrql()
Definition: mxgeneralkm.h:86
static __inline VOID MxReleaseInterruptSpinLock(_Inout_ PKINTERRUPT Interrupt, _In_ KIRQL OldIrql)
Definition: mxgeneralkm.h:776
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
KIRQL m_OldIrql
Definition: fxinterrupt.hpp:66
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
#define NULL
Definition: types.h:112
struct _KINTERRUPT * GetInterruptPtr(VOID)

Referenced by _Requires_lock_held_(), InterruptDisableInvokeCallback(), InterruptEnableInvokeCallback(), and InvokeWakeInterruptEvtIsr().

◆ ReportActive()

VOID FxInterrupt::ReportActive ( _In_ BOOLEAN  Internal = FALSE)

Definition at line 457 of file interruptobjectkm.cpp.

460 {
462  FxPkgPnp* fxPkgPnp;
463 
464  fxPkgPnp = m_Device->m_PkgPnp;
465 
466  if (Internal == FALSE) {
467  //
468  // if the interrupt is not connected, you can't report active or inactive
469  //
470  if(m_Connected == FALSE || m_Interrupt == NULL) {
473  "Driver is reporting WDFINTERRUPT %p as being active even though"
474  " it is not connected.", GetHandle());
476  return;
477  }
478 
479  if (fxPkgPnp->m_IoReportInterruptActive == NULL) {
482  "Driver is calling DDI WdfInterruptReportActive() on an OS that "
483  "doesn't support the DDI.");
485  return;
486  }
487  }
488 
489  //
490  // No need to report active if interrupt is already active
491  //
492  if (m_Active) {
493  return;
494  }
495 
496  RtlZeroMemory(&parameters, sizeof(parameters));
497 
500  }
501  else {
502  parameters.Version = CONNECT_FULLY_SPECIFIED;
503  }
504 
506 
507  fxPkgPnp->m_IoReportInterruptActive(&parameters);
508  m_Active = TRUE;
509 
510  return;
511 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
#define TRUE
Definition: types.h:120
#define CONNECT_FULLY_SPECIFIED_GROUP
#define CONNECT_FULLY_SPECIFIED
#define FALSE
Definition: types.h:117
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
BOOLEAN m_Active
_Must_inspect_result_ __inline BOOLEAN FxIsProcessorGroupSupported(VOID)
Definition: fxglobalskm.h:734
BOOLEAN m_Connected
union _IO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS::@3748 ConnectionContext
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
#define TRACE_LEVEL_WARNING
Definition: storswtr.h:28
#define TRACINGPNP
Definition: dbgtrace.h:67
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
WDFINTERRUPT GetHandle(VOID)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
PFN_IO_REPORT_INTERRUPT_ACTIVE m_IoReportInterruptActive
Definition: fxpkgpnp.hpp:4293
FxVerifierDbgBreakPoint(pFxDriverGlobals)

Referenced by Connect().

◆ ReportInactive()

VOID FxInterrupt::ReportInactive ( _In_ BOOLEAN  Internal = FALSE)

Definition at line 514 of file interruptobjectkm.cpp.

517 {
519  FxPkgPnp* fxPkgPnp;
520 
521  fxPkgPnp = m_Device->m_PkgPnp;
522 
523  if (Internal == FALSE) {
524  //
525  // if the interrupt is not connected, you can't report active or inactive
526  //
527  if(m_Connected == FALSE || m_Interrupt == NULL) {
530  "Driver is reporting WDFINTERRUPT %p as being inactive even though"
531  " it is not connected.", GetHandle());
533  return;
534  }
535 
536  if (fxPkgPnp->m_IoReportInterruptInactive == NULL) {
539  "Driver is calling DDI WdfInterruptReportInactive() on an OS that "
540  "doesn't support the DDI.");
542  return;
543  }
544  }
545 
546  //
547  // No need to report Inactive if interrupt is already Inactive
548  //
549  if (m_Active == FALSE) {
550  return;
551  }
552 
553  RtlZeroMemory(&parameters, sizeof(parameters));
554 
557  }
558  else {
559  parameters.Version = CONNECT_FULLY_SPECIFIED;
560  }
561 
563 
564  fxPkgPnp->m_IoReportInterruptInactive(&parameters);
565  m_Active = FALSE;
566 
567  return;
568 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
#define CONNECT_FULLY_SPECIFIED_GROUP
#define CONNECT_FULLY_SPECIFIED
#define FALSE
Definition: types.h:117
struct _KINTERRUPT * m_Interrupt
Definition: fxinterrupt.hpp:59
BOOLEAN m_Active
_Must_inspect_result_ __inline BOOLEAN FxIsProcessorGroupSupported(VOID)
Definition: fxglobalskm.h:734
BOOLEAN m_Connected
union _IO_REPORT_INTERRUPT_ACTIVE_STATE_PARAMETERS::@3748 ConnectionContext
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
#define TRACE_LEVEL_WARNING
Definition: storswtr.h:28
#define TRACINGPNP
Definition: dbgtrace.h:67
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
PFN_IO_REPORT_INTERRUPT_INACTIVE m_IoReportInterruptInactive
Definition: fxpkgpnp.hpp:4294
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define NULL
Definition: types.h:112
WDFINTERRUPT GetHandle(VOID)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
FxVerifierDbgBreakPoint(pFxDriverGlobals)

Referenced by Disconnect().

◆ Reset()

VOID FxInterrupt::Reset ( VOID  )
private

Definition at line 814 of file interruptobject.cpp.

831 {
832  //
833  // Other values in m_InterruptInfo survive a reset, so RtlZeroMemory is not
834  // an option. Manually set the fields that need resetting.
835  //
837  m_InterruptInfo.Group = 0;
842 
844 
845  //
846  // Do mode-specific reset.
847  // For KMDF, it's a no-op.
848  // For UMDF, a message is sent to reflector to reset the interrupt info.
849  //
850  ResetInternal();
851 }
KAFFINITY TargetProcessorSet
Definition: wdfinterrupt.h:306
volatile KIRQL m_SynchronizeIrql
Definition: fxinterrupt.hpp:67
KINTERRUPT_MODE Mode
Definition: wdfinterrupt.h:311
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
VOID ResetInternal(VOID)
WDF_INTERRUPT_INFO m_InterruptInfo

Referenced by FxInterrupt(), and FxPkgPnp::PnpMatchResources().

◆ ResetInternal()

VOID FxInterrupt::ResetInternal ( VOID  )
private

Definition at line 49 of file fxinterruptkm.hpp.

52 {
53  //
54  // Does nothing for KMDF
55  //
56 }

Referenced by Reset().

◆ RevokeResources()

VOID FxInterrupt::RevokeResources ( VOID  )

Definition at line 1079 of file interruptobject.cpp.

1097 {
1098  ULONG messageNumber;
1099 
1100  //
1101  // The message # doesn't change, so we must preserve it.
1102  //
1103  messageNumber = m_InterruptInfo.MessageNumber;
1104 
1105  //
1106  // This will zero out all the fields and init the size (as the structure
1107  // can be resued again say after a rebalance).
1108  //
1110 
1111  m_InterruptInfo.MessageNumber = messageNumber;
1112 
1113  //
1114  // Used by interrupts created during 'EvtDevicePrepareHardware' callback.
1115  //
1117 
1118  //
1119  // Do mode-specific work. For KMDF, it's a no-op.
1120  // For UMDF, send a sync message to Reflector.
1121  //
1123 }
VOID RevokeResourcesInternal(VOID)
PCM_PARTIAL_RESOURCE_DESCRIPTOR m_CmTranslatedResource
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
WDF_INTERRUPT_INFO m_InterruptInfo
FORCEINLINE VOID WDF_INTERRUPT_INFO_INIT(_Out_ PWDF_INTERRUPT_INFO Info)
Definition: wdfinterrupt.h:325

Referenced by DeleteObject(), and FxPkgPnp::NotifyResourceobjectsToReleaseResources().

◆ RevokeResourcesInternal()

VOID FxInterrupt::RevokeResourcesInternal ( VOID  )

Definition at line 60 of file fxinterruptkm.hpp.

63 {
64  //
65  // Does nothing for KMDF
66  //
67 }

Referenced by RevokeResources().

◆ SetActiveForWake()

VOID FxInterrupt::SetActiveForWake ( __in BOOLEAN  ActiveForWake)
inline

Definition at line 349 of file fxinterrupt.hpp.

352  {
353  m_WakeInterruptMachine->m_ActiveForWake = ActiveForWake;
354  }
FxWakeInterruptMachine * m_WakeInterruptMachine

Referenced by Connect(), and Disconnect().

◆ SetPolicy()

VOID FxInterrupt::SetPolicy ( __in WDF_INTERRUPT_POLICY  Policy,
__in WDF_INTERRUPT_PRIORITY  Priority,
__in PGROUP_AFFINITY  TargetProcessorSet 
)

Definition at line 1126 of file interruptobject.cpp.

1152 {
1153  //
1154  // We cannot apply policy for interrupts created during prepare hardware.
1155  //
1159  "You cannot apply policy at this stage for WDFINTERRUPT 0x%p "
1160  "For interrupts created in EvtDevicePrepareHardware you must use "
1161  "EvtDeviceFilter APIs or use a pre-process routine to handle the "
1162  "IRP_MN_FILTER_RESOURCE_REQUIREMENT, %!STATUS!",
1165  }
1166 
1167  m_Policy = Policy;
1168  m_Priority = Priority;
1170 
1171  //
1172  // Make sure OS supports processor groups, default to group 0 otherwise.
1173  //
1175  m_Processors.Group = 0;
1176  }
1177 
1178  m_SetPolicy = TRUE;
1179 
1180  //
1181  // Do mode-specific work. This function does nothing for KMDF.
1182  // It sends a message to reflector for UMDF.
1183  //
1185 }
#define TRUE
Definition: types.h:120
BOOLEAN m_CreatedInPrepareHardware
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define FALSE
Definition: types.h:117
WDF_INTERRUPT_POLICY m_Policy
WDF_INTERRUPT_PRIORITY m_Priority
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY _In_ KAFFINITY TargetProcessorSet
Definition: wdfinterrupt.h:651
VOID SetPolicyInternal(__in WDF_INTERRUPT_POLICY Policy, __in WDF_INTERRUPT_PRIORITY Priority, __in PGROUP_AFFINITY TargetProcessorSet)
_Must_inspect_result_ __inline BOOLEAN FxIsProcessorGroupSupported(VOID)
Definition: fxglobalskm.h:734
BOOLEAN m_SetPolicy
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:651
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACINGPNP
Definition: dbgtrace.h:67
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
WDFINTERRUPT GetHandle(VOID)
GROUP_AFFINITY m_Processors
$USHORT Group
Definition: ntbasedef.h:661
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY Policy
Definition: wdfinterrupt.h:651
FxVerifierDbgBreakPoint(pFxDriverGlobals)

◆ SetPolicyInternal()

VOID FxInterrupt::SetPolicyInternal ( __in WDF_INTERRUPT_POLICY  Policy,
__in WDF_INTERRUPT_PRIORITY  Priority,
__in PGROUP_AFFINITY  TargetProcessorSet 
)

Definition at line 88 of file fxinterruptkm.hpp.

93 {
97 
98  //
99  // Does nothing for KMDF
100  //
101 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY _In_ KAFFINITY TargetProcessorSet
Definition: wdfinterrupt.h:651
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:651
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY Policy
Definition: wdfinterrupt.h:651

Referenced by SetPolicy().

◆ SetSyncIrql()

VOID FxInterrupt::SetSyncIrql ( KIRQL  SyncIrql)
inlineprivate

Definition at line 589 of file fxinterrupt.hpp.

592  {
593  m_SynchronizeIrql = SyncIrql;
594  }
volatile KIRQL m_SynchronizeIrql
Definition: fxinterrupt.hpp:67

Referenced by FxPkgPnp::PnpAssignInterruptsSyncIrql().

◆ SharesLock()

BOOLEAN FxInterrupt::SharesLock ( FxInterrupt Interrupt)
inline

Definition at line 570 of file fxinterrupt.hpp.

573  {
574  return m_SpinLock == Interrupt->m_SpinLock ? TRUE : FALSE;
575  }
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFINTERRUPT * Interrupt
Definition: wdfinterrupt.h:372
#define FALSE
Definition: types.h:117
MdLock * m_SpinLock
Definition: fxinterrupt.hpp:64

Referenced by FxPkgPnp::PnpAssignInterruptsSyncIrql().

◆ Synchronize()

BOOLEAN FxInterrupt::Synchronize ( __in PFN_WDF_INTERRUPT_SYNCHRONIZE  Callback,
__in WDFCONTEXT  Context 
)

Definition at line 1990 of file interruptobject.cpp.

1994 {
1995  struct _KINTERRUPT* kinterrupt;
1997 
1998  params.Interrupt = this;
1999  params.Callback = Callback;
2000  params.Context = Context;
2001 
2002  kinterrupt = GetInterruptPtr();
2003 
2004 #if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
2005  ASSERTMSG("Can't synchronize when the interrupt isn't connected: ",
2006  kinterrupt != NULL);
2007 #endif
2008 
2009  return _SynchronizeExecution(kinterrupt,
2011  &params);
2012 }
GLenum const GLfloat * params
Definition: glext.h:5645
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
static MdInterruptSynchronizeRoutineType _InterruptSynchronizeThunk
BOOLEAN _SynchronizeExecution(__in MdInterrupt Interrupt, __in MdInterruptSynchronizeRoutine SynchronizeRoutine, __in PVOID SynchronizeContext)
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:456
#define NULL
Definition: types.h:112
struct tagContext Context
Definition: acpixf.h:1034
struct _KINTERRUPT * GetInterruptPtr(VOID)

◆ TryToAcquireLock()

BOOLEAN FxInterrupt::TryToAcquireLock ( VOID  )

Definition at line 1905 of file interruptobject.cpp.

1907 {
1908  LONGLONG timeout = 0;
1909 
1910  ASSERTMSG("TryToAcquireLock is only available for passive-level "
1911  "interrupt handling: ", m_PassiveHandling);
1912 
1913  if (FALSE == m_PassiveHandling) {
1914  return FALSE;
1915  }
1916 
1917  ASSERT(m_WaitLock != NULL);
1919 
1920  //
1921  // Passive-level interrupt handling. Automatic serialization is off.
1922  //
1923  return FxWaitLockInternal::IsLockAcquired(
1924  m_WaitLock->AcquireLock(GetDriverGlobals(), &timeout)
1925  );
1926 }
FxWaitLock * m_WaitLock
Definition: fxinterrupt.hpp:77
Definition: dhcpd.h:245
#define FALSE
Definition: types.h:117
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
int64_t LONGLONG
Definition: typedefs.h:68
#define ASSERT(a)
Definition: mode.c:44
BOOLEAN m_PassiveHandling
static __inline KIRQL MxGetCurrentIrql()
Definition: mxgeneralkm.h:86
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
#define NULL
Definition: types.h:112

◆ WakeInterruptIsr()

BOOLEAN FxInterrupt::WakeInterruptIsr ( VOID  )

Definition at line 379 of file interruptobject.cpp.

396 {
398 
399  //
400  // Queue an event in the state machine
401  //
403 
405  "Wake Interrupt ISR is stuck waiting for the device"
406  "to power back up and driver calllback to be processed",
407  GetHandle(),
410 
411  //
412  // State machine stores the return value of the callback in the
413  // m_Claimed member variable
414  //
416 }
ULONG DbgWaitForWakeInterruptIsrTimeoutInSec
Definition: fxglobals.h:534
VOID WaitForSignal(__in MxEvent *Event, __in PCSTR ReasonForWaiting, __in PVOID Handle, __in ULONG WarningTimeoutInSec, __in ULONG WaitSignalFlags)
Definition: globals.cpp:1705
MxEvent * GetSelfPointer(VOID)
Definition: mxevent.h:110
VOID ProcessEvent(__in FxWakeInterruptEvents Event)
#define ASSERT(a)
Definition: mode.c:44
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
#define NULL
Definition: types.h:112
WDFINTERRUPT GetHandle(VOID)
FxWakeInterruptMachine * m_WakeInterruptMachine

◆ WorkItemHandler()

VOID FxInterrupt::WorkItemHandler ( VOID  )

Definition at line 100 of file interruptobjectkm.cpp.

103 {
105 
107 
108  //
109  // Call the drivers registered WorkItemForIsr event callback
110  //
111  if (m_CallbackLock != NULL) {
112  KIRQL irql = 0;
113 
115 
119  }
120  else {
123  }
124 
125  return;
126 }
CfxDevice * m_Device
Definition: fxobject.hpp:329
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
FORCEINLINE VOID FxPerfTraceWorkItem(_In_ PVOID DriverCallback)
virtual void Lock(__out PKIRQL PreviousIrql)=0
#define ASSERT(a)
Definition: mode.c:44
PFN_WDF_INTERRUPT_WORKITEM m_EvtInterruptWorkItem
FxCallbackLock * m_CallbackLock
Definition: fxinterrupt.hpp:93
virtual void Unlock(__in KIRQL PreviousIrql)=0
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
#define NULL
Definition: types.h:112
WDFINTERRUPT GetHandle(VOID)
FX_TRACK_DRIVER(fxDriverGlobals)

Member Data Documentation

◆ _InterruptDisableThunk

BOOLEAN FxInterrupt::_InterruptDisableThunk
staticprivate

Definition at line 685 of file fxinterrupt.hpp.

Referenced by InterruptDisable().

◆ _InterruptDpcThunk

VOID FxInterrupt::_InterruptDpcThunk
staticprivate

Definition at line 622 of file fxinterrupt.hpp.

Referenced by FxInterrupt().

◆ _InterruptEnableThunk

BOOLEAN FxInterrupt::_InterruptEnableThunk
staticprivate

Definition at line 664 of file fxinterrupt.hpp.

Referenced by InterruptEnable().

◆ _InterruptMarkDisconnecting

BOOLEAN FxInterrupt::_InterruptMarkDisconnecting
staticprivate

Definition at line 224 of file fxinterrupt.hpp.

Referenced by Disconnect().

◆ _InterruptSynchronizeThunk

BOOLEAN FxInterrupt::_InterruptSynchronizeThunk
staticprivate

Definition at line 617 of file fxinterrupt.hpp.

Referenced by Synchronize().

◆ _InterruptThunk

VOID CALLBACK FxInterrupt::_InterruptThunk
staticprivate

Definition at line 611 of file fxinterrupt.hpp.

Referenced by ConnectInternal(), FlushAndRundown(), and Initialize().

◆ _InterruptWorkItemCallback

VOID FxInterrupt::_InterruptWorkItemCallback
staticprivate

Definition at line 614 of file fxinterrupt.hpp.

Referenced by QueueWorkItemForIsr().

◆ FxPkgPnp

friend FxInterrupt::FxPkgPnp
private

Definition at line 47 of file fxinterrupt.hpp.

◆ m_Active

BOOLEAN FxInterrupt::m_Active
private

Definition at line 148 of file fxinterrupt.hpp.

Referenced by Connect(), Disconnect(), FxInterrupt(), ReportActive(), and ReportInactive().

◆ m_AddedToList

BOOLEAN FxInterrupt::m_AddedToList
private

Definition at line 113 of file fxinterrupt.hpp.

Referenced by DeleteObject(), FxInterrupt(), and Initialize().

◆ m_BuiltInSpinLock

MxLock FxInterrupt::m_BuiltInSpinLock
private

Definition at line 72 of file fxinterrupt.hpp.

Referenced by InitializeWorker(), and IsSharedSpinLock().

◆ m_CallbackLock

FxCallbackLock* FxInterrupt::m_CallbackLock
private

◆ m_CanQueue

BOOLEAN FxInterrupt::m_CanQueue
private

Definition at line 188 of file fxinterrupt.hpp.

Referenced by FxInterrupt().

◆ m_CmTranslatedResource

PCM_PARTIAL_RESOURCE_DESCRIPTOR FxInterrupt::m_CmTranslatedResource
private

◆ m_Connected

BOOLEAN FxInterrupt::m_Connected
private

◆ m_CreatedInPrepareHardware

BOOLEAN FxInterrupt::m_CreatedInPrepareHardware
private

Definition at line 135 of file fxinterrupt.hpp.

Referenced by FxInterrupt(), Initialize(), OnPostReleaseHardware(), and SetPolicy().

◆ m_Disconnecting

BOOLEAN FxInterrupt::m_Disconnecting
private

Definition at line 238 of file fxinterrupt.hpp.

Referenced by Disconnect(), and FxInterrupt().

◆ m_DisposeWaitLock

BOOLEAN FxInterrupt::m_DisposeWaitLock
private

Definition at line 98 of file fxinterrupt.hpp.

Referenced by FlushAndRundownInternal(), FxInterrupt(), and InitializeWorker().

◆ m_Dpc

KDPC FxInterrupt::m_Dpc
private

Definition at line 85 of file fxinterrupt.hpp.

Referenced by FxInterrupt(), QueueDpcForIsr(), and QueueWorkItemForIsr().

◆ m_Enabled

BOOLEAN FxInterrupt::m_Enabled
private

Definition at line 125 of file fxinterrupt.hpp.

Referenced by Connect(), Disconnect(), and FxInterrupt().

◆ m_EvtInterruptDisable

PFN_WDF_INTERRUPT_DISABLE FxInterrupt::m_EvtInterruptDisable
private

◆ m_EvtInterruptDpc

PFN_WDF_INTERRUPT_DPC FxInterrupt::m_EvtInterruptDpc
private

◆ m_EvtInterruptEnable

PFN_WDF_INTERRUPT_ENABLE FxInterrupt::m_EvtInterruptEnable
private

◆ m_EvtInterruptIsr

PFN_WDF_INTERRUPT_ISR FxInterrupt::m_EvtInterruptIsr
private

Definition at line 165 of file fxinterrupt.hpp.

Referenced by FxInterrupt(), InitializeWorker(), and InvokeWakeInterruptEvtIsr().

◆ m_EvtInterruptWorkItem

PFN_WDF_INTERRUPT_WORKITEM FxInterrupt::m_EvtInterruptWorkItem
private

◆ m_FloatingSave

BOOLEAN FxInterrupt::m_FloatingSave
private

Definition at line 130 of file fxinterrupt.hpp.

Referenced by Connect(), ConnectInternal(), FxInterrupt(), and Initialize().

◆ m_ForceDisconnected

BOOLEAN FxInterrupt::m_ForceDisconnected
private

Definition at line 120 of file fxinterrupt.hpp.

Referenced by Connect(), Disconnect(), ForceDisconnect(), ForceReconnect(), and FxInterrupt().

◆ m_Interrupt

◆ m_InterruptCaptured

struct _KINTERRUPT* FxInterrupt::m_InterruptCaptured
private

Definition at line 231 of file fxinterrupt.hpp.

Referenced by Disconnect(), FxInterrupt(), and GetInterruptPtr().

◆ m_InterruptInfo

◆ m_InterruptWaitblock

FxInterruptWaitblock* FxInterrupt::m_InterruptWaitblock
private

Definition at line 181 of file fxinterrupt.hpp.

Referenced by FxInterrupt().

◆ m_IsEdgeTriggeredNonMsiInterrupt

BOOLEAN FxInterrupt::m_IsEdgeTriggeredNonMsiInterrupt
private

Definition at line 244 of file fxinterrupt.hpp.

Referenced by AssignResources(), Disconnect(), and FxInterrupt().

◆ m_OldIrql

KIRQL FxInterrupt::m_OldIrql
private

Definition at line 66 of file fxinterrupt.hpp.

Referenced by AcquireLock(), FxInterrupt(), and ReleaseLock().

◆ m_PassiveHandling

◆ m_PassiveHandlingByRedirector

BOOLEAN FxInterrupt::m_PassiveHandlingByRedirector
private

Definition at line 204 of file fxinterrupt.hpp.

Referenced by AssignResources(), FxInterrupt(), and IsPassiveConnect().

◆ m_PnpList

LIST_ENTRY FxInterrupt::m_PnpList
protected

Definition at line 248 of file fxinterrupt.hpp.

Referenced by FxInterrupt().

◆ m_Policy

WDF_INTERRUPT_POLICY FxInterrupt::m_Policy
private

◆ m_Priority

WDF_INTERRUPT_PRIORITY FxInterrupt::m_Priority
private

◆ m_Processors

GROUP_AFFINITY FxInterrupt::m_Processors
private

Definition at line 157 of file fxinterrupt.hpp.

Referenced by FilterResourceRequirements(), FxInterrupt(), and SetPolicy().

◆ m_RdInterruptContext

RD_INTERRUPT_CONTEXT FxInterrupt::m_RdInterruptContext
private

Definition at line 173 of file fxinterrupt.hpp.

Referenced by FxInterrupt().

◆ m_SetPolicy

BOOLEAN FxInterrupt::m_SetPolicy
private

Definition at line 154 of file fxinterrupt.hpp.

Referenced by FilterResourceRequirements(), FxInterrupt(), and SetPolicy().

◆ m_ShareVector

WDF_TRI_STATE FxInterrupt::m_ShareVector
private

Definition at line 54 of file fxinterrupt.hpp.

Referenced by FilterResourceRequirements(), FxInterrupt(), and Initialize().

◆ m_SpinLock

MdLock* FxInterrupt::m_SpinLock
private

◆ m_SynchronizeIrql

volatile KIRQL FxInterrupt::m_SynchronizeIrql
private

Definition at line 67 of file fxinterrupt.hpp.

Referenced by Connect(), ConnectInternal(), GetSyncIrql(), IsSyncIrqlSet(), Reset(), and SetSyncIrql().

◆ m_SystemWorkItem

FxSystemWorkItem* FxInterrupt::m_SystemWorkItem
private

◆ m_UseSoftDisconnect

BOOLEAN FxInterrupt::m_UseSoftDisconnect
private

Definition at line 104 of file fxinterrupt.hpp.

Referenced by FxInterrupt(), InitializeWorker(), and IsSoftDisconnectCapable().

◆ m_WaitLock

FxWaitLock* FxInterrupt::m_WaitLock
private

◆ m_WakeInterruptMachine


The documentation for this class was generated from the following files: