HwInterrupt Routine

On entry, a HwInterrupt routine should determine if its HBA actually generated an interrupt. HwInterrupt must return FALSE as soon as possible if it detects a spurious interrupt so the interrupt service routine for the device that generated the interrupt can be called quickly.

Otherwise, a miniport's HwInterrupt routine is generally responsible for completing the I/O operation that caused the interrupt. Depending on the HBA and the design of the miniport, a HwInterrupt routine does some or all of the following:

When the HwInterrupt routine (or an internal miniport routine) completes an SRB, it calls ScsiPortNotification twice:

1 First, with the NotificationType RequestComplete and the just satisfied request

2 Next, with the NotificationType NextRequest, or with NextLuRequest if the HBA supports tagged queueing or multiple requests per logical unit

For better overall system performance, a miniport's HwInterrupt routine should do only the minimum necessary to process I/O requests. That is, the miniport should be designed to return control from the HwInterrupt routine as quickly as possible, rather than tying up a processor and preventing other drivers from servicing device interrupts.

If interrupt-driven I/O operations take a long time to complete, a miniport driver should have a pair of HwEnableInterruptsCallback and HwDisableInterruptsCallback routines. For example, if a miniport must poll for longer than 50 microseconds doing PIO, its HwInterrupt routine should not retain control of the CPU for the full polling interval in order to complete a requested operation. Instead, its HwInterrupt routine should do the following:

1 Disable interrupts from the HBA.

2 Set up the device extension with any context necessary to complete the operation.

3 Call ScsiPortNotification with a pointer to the device extension, the NotificationType CallEnableInterrupts, and the miniport's HwEnableInterruptsCallback routine, described in HwEnableInterruptsCallback Routine.

4 Return control.

ScsiPortNotification calls the HwEnableInterruptsCallback routine as an DPC.