PFLUSH_ADAPTER_BUFFERS - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdm.h

PFLUSH_ADAPTER_BUFFERS PflushAdapterBuffers;

BOOLEAN PflushAdapterBuffers(
  [in] PDMA_ADAPTER DmaAdapter,
  [in] PMDL Mdl,
  [in] PVOID MapRegisterBase,
  [in] PVOID CurrentVa,
  [in] ULONG Length,
  [in] BOOLEAN WriteToDevice
)
{...}

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nc-wdm-pflush_adapter_buffers)

PFLUSH_ADAPTER_BUFFERS callback function

Description

The FlushAdapterBuffers routine flushes any data remaining in the system DMA controller's internal cache or in a bus-master adapter's internal cache at the end of a DMA transfer operation.

Parameters

DmaAdapter [in]

Pointer to the DMA_ADAPTER structure returned by IoGetDmaAdapter that represents the bus-master adapter or DMA controller.

Mdl [in]

Pointer to the MDL that describes the buffer previously passed in the driver's call to MapTransfer.

MapRegisterBase [in]

Specifies the map registers allocated for the DMA operation. The system passes this value to the driver's AdapterControl routine.

CurrentVa [in]

Pointer to the current virtual address in the buffer, described by the Mdl, where the I/O operation occurred. This value must be the same as the initial CurrentVa value passed to MapTransfer.

Length [in]

Specifies the length, in bytes, of the buffer.

WriteToDevice [in]

Specifies the direction of the DMA transfer operation: TRUE for a transfer from a buffer in system memory to the driver's device.

Return value

FlushAdapterBuffers returns TRUE if any data remaining in the DMA controller's or bus-master adapter's internal cache has been successfully flushed into system memory or out to the device.

Remarks

FlushAdapterBuffers is not a system routine that can be called directly by name. This routine is callable only by pointer from the address returned in a DMA_OPERATIONS structure. Drivers obtain the address of this routine by calling IoGetDmaAdapter.

To ensure that a DMA transfer is complete, every driver that performs DMA operations must call FlushAdapterBuffers before completing the IRP that requested the DMA transfer and before freeing the map registers.

A driver can get the initial CurrentVa for the start of a packet-based DMA transfer by calling MmGetMdlVirtualAddress. However, the value returned is an index into the Mdl, rather than a valid virtual address. If the driver must split a large transfer request into more than one DMA operation, it must update CurrentVa and Length for each DMA operation.

See also

AllocateAdapterChannel

DMA_ADAPTER

DMA_OPERATIONS

IoGetDmaAdapter

KeFlushIoBuffers

MapTransfer

MmGetMdlVirtualAddress