The IoConnectInterrupt routine registers a device driver's InterruptService routine (ISR), so that it will be called when a device interrupts on any of a specified set of processors.
NTSTATUS IoConnectInterrupt( _Out_ PKINTERRUPT *InterruptObject, _In_ PKSERVICE_ROUTINE ServiceRoutine, _In_opt_ PVOID ServiceContext, _In_opt_ PKSPIN_LOCK SpinLock, _In_ ULONG Vector, _In_ KIRQL Irql, _In_ KIRQL SynchronizeIrql, _In_ KINTERRUPT_MODE InterruptMode, _In_ BOOLEAN ShareVector, _In_ KAFFINITY ProcessorEnableMask, _In_ BOOLEAN FloatingSave );
Pointer to the address of driver-supplied storage for a pointer to a set of interrupt objects. This pointer must be passed in subsequent calls to KeSynchronizeExecution.
Pointer to the entry point for the driver-supplied InterruptService routine.
Pointer to the driver-determined context that will be supplied to the InterruptService routine when it is called. The ServiceContext area must be in resident memory: in the device extension of a driver-created device object, in the controller extension of a driver-created controller object, or in nonpaged pool allocated by the device driver. See Providing ISR Context Information for details.
Pointer to an initialized spin lock, for which the driver supplies the storage, that will be used to synchronize access to driver-determined data shared by other driver routines. This parameter is required if the ISR handles more than one vector or if the driver has more than one ISR. Otherwise, the driver need not allocate storage for an interrupt spin lock and the input pointer is NULL.
Specifies the interrupt vector passed in the interrupt resource at the u.Interrupt.Vector member of CM_PARTIAL_RESOURCE_DESCRIPTOR.
Specifies the DIRQL passed in the interrupt resource at the u.Interrupt.Level member of CM_PARTIAL_RESOURCE_DESCRIPTOR.
Specifies the DIRQL at which the ISR will run. If the ISR handles more than one interrupt vector or the driver has more than one ISR, this value must be the highest of the Irql values passed at u.Interrupt.Level in each interrupt resource. Otherwise, the Irql and SynchronizeIrql values are identical.
Specifies whether the device interrupt is LevelSensitive or Latched.
Specifies whether the interrupt vector is sharable.
Specifies a KAFFINITY value representing the set of processors on which device interrupts can occur in this platform. This value is passed in the interrupt resource at u.Interrupt.Affinity.
Specifies whether to save the floating-point stack when the driver's device interrupts. For x86-based and Itanium-based platforms, this value must be set to FALSE. For more information about saving floating-point and MMX state, see Using Floating Point or MMX in a WDM Driver.
IoConnectInterrupt can return one of the following NTSTATUS values:
New drivers should use the IoConnectInterruptEx routine, which is easier to use. Drivers for devices that support message-signaled interrupts (MSI) must use IoConnectInterruptEx.
A PnP driver should call IoConnectInterrupt as part of device start-up, before it completes the PnP IRP_MN_START_DEVICE request.
When a driver receives an IRP_MN_START_DEVICE request, the driver receives raw and translated hardware resources in the Parameters.StartDevice.AllocatedResources and Parameters.StartDevice.AllocatedResourcesTranslated members of the IRP's IO_STACK_LOCATION structure, respectively. To connect its interrupt, the driver uses the resources at AllocatedResourcesTranslated.List.PartialResourceList.PartialDescriptors. The driver must scan the array of partial descriptors for resources of type CmResourceTypeInterrupt.
If the driver supplies the storage for the SpinLock, it must call KeInitializeSpinLock before passing its interrupt spin lock to IoConnectInterrupt.
On return from a successful call to IoConnectInterrupt, the caller's ISR can be called if interrupts are enabled on the driver's device or if ShareVector was set to TRUE. Drivers must not enable interrupts until after IoConnectInterrupt returns.
The KAFFINITY type is an affinity mask that represents a set of logical processors in a group. The KAFFINITY type is 32 bits on a 32-bit version of Windows and is 64 bits on a 64-bit version of Windows.
If a group contains n logical processors, the processors are numbered from 0 to n-1. Processor number i in the group is represented by bit i in the affinity mask, where i is in the range 0 to n-1. Affinity mask bits that do not correspond to logical processors are always zero.
For example, if a KAFFINITY value identifies the active processors in a group, the mask bit for a processor is one if the processor is active, and is zero if the processor is not active.
The number of bits in the affinity mask determines the maximum number of logical processors in a group. For a 64-bit version of Windows, the maximum number of processors per group is 64. For a 32-bit version of Windows, the maximum number of processors per group is 32. Call the KeQueryMaximumProcessorCountEx routine to obtain the maximum number of processors per group. This number depends on the hardware configuration of the multiprocessor system, but can never exceed the fixed 64-processor and 32-processor limits that are set by the 64-bit and 32-bit versions of Windows, respectively.
The GROUP_AFFINITY structure contains an affinity mask and a group number. The group number identifies the group to which the affinity mask applies.
|Windows version||Available starting with Windows 2000.|
|Header||wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)|
|DDI compliance rules||IrqlIoPassive2, PowerIrpDDis, HwStorPortProhibitedDDIs|