10.2.1 Programming the Device for an I/O Operation

For any incoming IRP, NT device drivers do as much I/O processing as possible at IRQL PASSIVE_LEVEL in their Dispatch routines (or, possibly driver threads) or at IRQL DISPATCH_LEVEL, as in their StartIo routines, before they program their devices for an I/O operation.

In addition, a device driver’s StartIo routine must postpone its call to KeSynchronizeExecution with a SynchCritSection routine that programs the device to the following standard driver routines:

Every SynchCritSection routine must return control as quickly as possible, because running any SynchCritSection routine prevents the driver’s ISR from getting any work done if it is running concurrently.