A.4.5.2 Handling SRB_FUNCTION_EXECUTE_SCSI
After the Windows NT higher-level SCSI class drivers have loaded, most of the SRBs sent to the HwScsiStartIo routine have the Function member set to SRB_FUNCTION_EXECUTE_SCSI.
On receipt of an SRB_FUNCTION_EXECUTE_SCSI request, a miniport’s HwScsiStartIo routine does the following:
·Gets and/or sets up whatever context the miniport driver maintains in its device, logical unit, and/or SRB extensions
For example, a miniport driver might set up a logical unit extension with pointers to the SRB itself and the SRB DataBuffer pointer, the SRB DataTransferLength value, and a driver-defined value (or CDB SCSIOP_XXX value) indicating the operation to be carried out on the HBA.
·Calls an internal routine to program the HBA, as partially directed by the SRB Flags, for the requested operation
For a device I/O operation, such an internal routine generally selects the target device and sends the CDB over the bus to the target logical unit.
If the miniport driver uses system DMA, it must call ScsiPortIoMapTransfer before programming the HBA to transfer data. ScsiPortIoMapTransfer sets up the system DMA controller and calls the miniport’s HwScsiDmaStarted routine, described later in Section A.4.6.
All system-defined, required device I/O control requests sent to Windows NT SCSI class drivers are mapped to SRBs with the Function member set to SRB_FUNCTION_EXECUTE_SCSI.