A.4.6 SCSI Miniport Driver's HwScsiDmaStarted Routine
A miniport driver of an HBA that uses the system DMA controller must have a HwScsiDmaStarted routine.
For a data transfer operation, such a miniport driver must call ScsiPortIoMapTransfer, passing in the pointers to its device extension for per-HBA data and to the SRB requesting the transfer, along with a range of logical addresses for the buffer from which or into which the data will be transferred.
Note that the logical address range passed to ScsiPortIoMapTransfer either must be the mapped values for the input SRB's DataBuffer and DataTransferLength or a proper subset of this range. For most transfer requests, a miniport driver writer can assume that all data specified in the input SRB can be transferred in a single DMA operation.
In particular, a miniport driver might have to carry out more than one slave DMA transfer operation to satisfy a given SRB only if the HBA provides application-dedicated support and the application sends large transfer requests directly to the miniport driver. Otherwise, it is the responsibility of the Windows NT SCSI class drivers to split up large transfer requests into a set of partial transfer requests, each sized to suit the capabilities of the HBA (see Section A.1.4.5).
ScsiPortIoMapTransfer calls the miniport's HwScsiDmaStarted routine when the system DMA controller is ready to transfer data between system memory and the HBA. HwScsiDmaStarted must set up the HBA for the transfer operation.
When a transfer operation is complete, the miniport driver must call ScsiPortFlushDma before it calls ScsiPortNotification with the SRB and/or calls ScsiPortIoMapTransfer to set up the DMA controller again for a subrange in an application-supplied buffer if the HBA is dedicated to the support of a user-mode application.
ScsiPortFlushDma flushes any remaining data cached in the DMA controller. Note that ScsiPortFlushDma also can be called to cancel a system DMA transfer, even if the miniport's HwScsiDmaStarted routine has not yet been called.
For more information about ScsiPortIoMapTransfer and ScsiPortFlushDma, see the Kernel-Mode Driver Reference.