KeFlushIoBuffers

VOID
KeFlushIoBuffers(

IN PMDL Mdl,
IN BOOLEAN ReadOperation,
IN BOOLEAN DmaOperation
);

KeFlushIoBuffers flushes the memory region described by a given MDL from caches of all processors.

Parameters

Mdl

Points to an MDL that describes the range for the I/O buffer.

ReadOperation

Specifies TRUE if the flush is being performed for a read operation.

DmaOperation

Specifies TRUE for a DMA transfer, FALSE for PIO.

Comments

Device drivers call KeFlushIoBuffers to maintain data integrity during DMA or PIO device transfer operations. Calling this routine affects all processors in the machine.

If ReadOperation is TRUE, the driver is reading information from the device to system memory, so valid data still might be in the processor instruction and data caches. KeFlushIoBuffers flushes data from all processors’ caches to system memory, including the processor on which the caller is running.

If ReadOperation is FALSE, the driver is writing data from system memory to a device, so valid data might be in the processor’s data cache but not yet transferred to the device. KeFlushIoBuffers flushes all processor’s data caches, including the processor on which the caller is running.

As a general rule, drivers should call this routine just before beginning a DMA transfer operation or immediately following any PIO read operation.

Callers of this routine must be running at IRQL <= DISPATCH_LEVEL.

See Also

IoFlushAdapterBuffers