typedef struct _SCSI_REQUEST_BLOCK { USHORT Length; UCHAR Function; UCHAR SrbStatus; UCHAR ScsiStatus; UCHAR PathId; UCHAR TargetId; UCHAR Lun; UCHAR QueueTag; UCHAR QueueAction; UCHAR CdbLength; UCHAR SenseInfoBufferLength; ULONG SrbFlags; ULONG DataTransferLength; ULONG TimeOutValue; PVOID DataBuffer; PVOID SenseInfoBuffer; struct _SCSI_REQUEST_BLOCK *NextSrb; PVOID OriginalRequest; PVOID SrbExtension; ULONG QueueSortKey; UCHAR Cdb[16]; } SCSI_REQUEST_BLOCK, *PSCSI_REQUEST_BLOCK;
Operation |
Meaning |
SRB_FUNCTION_EXECUTE_SCSI | |
A SCSI device I/O request should be executed on the target logical unit. | |
SRB_FUNCTION_ABORT_COMMAND | |
A SCSIMESS_ABORT message should be sent to cancel the request pointed to by the NextSrb member. If this is a tagged-queue request, a SCSIMESS_ABORT_WITH_TAG message should be used instead. If the indicated request has been completed, this request should be completed normally. Only the SRB Function, PathId, TargetId, Lun, and NextSrb members are valid. | |
SRB_FUNCTION_RESET_DEVICE | |
The SCSI target controller should be reset using the SCSIMESS_BUS_DEVICE_RESET message. The miniport driver should complete any active requests for the target controller. Only the SRB Function, TargetId, and PathId members are valid. | |
SRB_FUNCTION_RESET_BUS | |
The SCSI bus should be reset using the SCSIMESS_BUS_DEVICE_RESET message. A miniport driver receives this request only if a given request has timed out and a subsequent request to abort the timed-out request also has timed out. Only the SRB Function and PathId members are valid. | |
SRB_FUNCTION_TERMINATE_IO | |
A SCSIMESS_TERMINATE_IO_PROCESS message should be sent to cancel the request pointed to by the NextSrb member. If the indicated request has already completed, this request should be completed normally. Only the SRB Function, PathId, TargetId, Lun, and NextSrb members are valid. | |
SRB_FUNCTION_RELEASE_RECOVERY | |
A SCSIMESS_RELEASE_RECOVERY message should be sent to the target controller. Only the SRB Function, PathId, TargetId, and Lun members are valid. | |
SRB_FUNCTION_RECEIVE_EVENT | |
The HBA should be prepared to receive an asynchronous event notification from the addressed target. The SRB DataBuffer member indicates where the data should be placed. | |
SRB_FUNCTION_SHUTDOWN | |
The system is being shut down. This request is sent to a miniport driver only if it set CachesData to TRUE in the PORT_CONFIGURATION_INFORMATION for the HBA. Such a miniport driver can receive several of these notifications before all system activity actually stops. However, the last shutdown notification will occur after the last start I/O. Only the SRB Function, PathId, TargetId, and Lun members are valid. | |
SRB_FUNCTION_FLUSH | |
The miniport should flush any cached data for the target device. This request is sent to the miniport driver only if it set CachesData to TRUE in the PORT_CONFIGURATION_INFORMATION for the HBA. Only the SRB Function, PathId, TargetId, and Lun members are valid. | |
SRB_FUNCTION_IO_CONTROL | |
The request is an I/O control request, originating in a user-mode application with a dedicated HBA. The SRB DataBuffer points to an SRB_IO_CONTROL header followed by the data area. The value in DataBuffer can be used by the driver, regardless of the value of MapBuffers. Only the SRB Function, SrbFlags, TimeOutValue, DataBuffer, and DataTransferLength members are valid, along with the SrbExtension member if the miniport driver requested SRB extensions when it initialized. If a miniport driver controls an application-dedicated HBA so it supports this request, the miniport should execute the request and notify the OS-specific port driver when the SRB has completed, using the normal mechanism of calls to ScsiPortNotification with RequestComplete and NextRequest. |
Status |
Meaning |
SRB_STATUS_PENDING | |
Indicates the request is in progress. The OS-specific port driver initializes SrbStatus to this value. A miniport driver should never set the SrbStatus member to this value. | |
SRB_STATUS_SUCCESS | |
Indicates the request was completed successfully. | |
SRB_STATUS_ABORTED | |
Indicates the request was aborted as directed by the port driver. A miniport driver sets this status in the NextSrb for a successful SRB_FUNCTION_ABORT_COMMAND request. | |
SRB_STATUS_ABORT_FAILED | |
Indicates an attempt to abort the request failed. Return this status for an SRB_FUNCTION_ABORT_COMMAND request when the specified request cannot be located. | |
SRB_STATUS_ERROR | |
Indicates the request was completed with an error in the SCSI bus status. | |
SRB_STATUS_BUSY | |
Indicates the miniport or target device could not accept the request at this time. The OS-specific port driver will resubmit the request later. | |
SRB_STATUS_INVALID_REQUEST | |
Indicates the miniport driver does not support the given request. | |
SRB_STATUS_NO_DEVICE | |
Indicates the device did not respond. | |
SRB_STATUS_TIMEOUT | |
Indicates the request timed out. | |
SRB_STATUS_SELECTION_TIMEOUT | |
Indicates the SCSI device selection timed out. | |
SRB_STATUS_COMMAND_TIMEOUT | |
Indicates the target did not complete the command within the time limit. | |
SRB_STATUS_MESSAGE_REJECTED | |
Indicates the target rejected a message. This is normally returned only for such message-type requests as SRB_FUNCTION_TERMINATE_IO. | |
SRB_STATUS_BUS_RESET | |
Indicates a bus reset occurred while this request was being executed. | |
SRB_STATUS_PARITY_ERROR | |
Indicates a parity error occurred on the SCSI bus and that a retry failed. | |
SRB_STATUS_REQUEST_SENSE_FAILED | |
Indicates the request-sense command failed. This is returned only if the HBA performs auto request sense and the miniport driver set AutoRequestSense to TRUE in the PORT_CONFIGURATION_INFORMATION for this HBA. | |
SRB_STATUS_NO_HBA | |
Indicates the HBA does not respond. | |
SRB_STATUS_DATA_OVERRUN | |
Indicates that a data overrun or underrun error occurred. The miniport also must update the SRB’s DataTransferLength member to indicate how much data actually was transferred if an underrun occurs. | |
SRB_STATUS_UNEXPECTED_BUS_FREE | |
Indicates the target disconnected unexpectedly. | |
SRB_STATUS_PHASE_SEQUENCE_FAILURE | |
Indicates the HBA detected an illegal phase sequence failure error. | |
SRB_STATUS_REQUEST_FLUSHED | |
Indicates the request for status was stopped. | |
SRB_STATUS_BAD_FUNCTION | |
Indicates the SRB Function code is not supported. | |
SRB_STATUS_INVALID_PATH_ID | |
Indicates the PathId specified in the SRB does not exist. | |
SRB_STATUS_INVALID_TARGET_ID | |
Indicates the TargetID value in the SRB is invalid. | |
SRB_STATUS_INVALID_LUN | |
Indicates the Lun value in the SRB is invalid. | |
SRB_STATUS_ERROR_RECOVERY | |
Indicates the request was completed with an error in the SCSI bus status and that the SCSI INITIATE RECOVERY message was received. | |
SRB_STATUS_AUTOSENSE_VALID | |
Indicates information returned in the SenseInfoBuffer is valid. | |
SRB_STATUS_QUEUE_FROZEN | |
A miniport driver should never set the SrbStatus member to this value. The Windows NT port driver can set this value to inform a SCSI class driver that its queue of requests for a particular peripheral has been frozen. |
Value |
Meaning |
SRB_FLAGS_QUEUE_ACTION_ENABLE | |
Indicates tagged-queue actions are to be enabled. | |
SRB_FLAGS_DISABLE_AUTOSENSE | |
Indicates that request-sense information should not be returned. | |
SRB_FLAGS_DATA_IN | |
Indicates data will be transferred from the device to the system. | |
SRB_FLAGS_DATA_OUT | |
Indicates data will be transferred from the system to the device. | |
SRB_FLAGS_UNSPECIFIED_DIRECTION | |
Defined for backward compatibility with the ASPI/CAM SCSI interfaces, this flag indicates that the transfer direction could be either of the preceding because both of the preceding flags are set. If this flag is set, a miniport driver should determine the transfer direction by examining the data phase for the target on the SCSI bus. If its HBA is a slave DMA device, such a miniport must update SRB_FLAGS_DATA_OUT or SRB_FLAGS_DATA_IN to the correct value before it calls ScsiPortIoMapTransfer. | |
SRB_FLAGS_NO_DATA_TRANSFER | |
Indicates no data transfer with this request. If this is set, the flags SRB_FLAGS_DATA_OUT, SRB_FLAGS_DATA_IN, and SRB_FLAGS_UNSPECIFIED_DIRECTION are clear. | |
SRB_FLAGS_DISABLE_SYNCH_TRANSFER | |
Indicates the HBA, if possible, should not perform a synchronous negotiation for this transfer request. | |
SRB_FLAGS_DISABLE_DISCONNECT | |
Indicates the HBA should not allow the target to disconnect from the SCSI bus during processing of this request. | |
SRB_FLAGS_BYPASS_FROZEN_QUEUE | |
Is irrelevant to miniport drivers. | |
SRB_FLAGS_NO_QUEUE_FREEZE | |
Is irrelevant to miniport drivers. | |
SRB_FLAGS_IS_ACTIVE | |
Is irrelevant to miniport drivers. | |
SRB_FLAGS_ALLOCATED_FROM_ZONE | |
Is irrelevant to miniport drivers. To a Windows NT class driver, this indicates whether the SRB was allocated from a zone buffer. If this flag is set, the class driver must call ExInterlockedFreeToZone to release the SRB; otherwise, it must call ExFreePool. | |
SRB_FLAGS_SGLIST_FROM_POOL | |
Is irrelevant to miniport drivers. To a Windows NT class driver, this indicates that memory for a scatter/gather list was allocated from nonpaged pool. If this flag is set, the class driver must call ExFreePool to release the memory after the SRB is completed. |
Windows NT SCSI class and filter drivers can send SRBs with the following Function values to the system port driver:
The preceding SRB_FUNCTION_XXX are never set in SRBs sent to SCSI miniport drivers. SRB_FUNCTION_REMOVE_DEVICE is defined for use in future versions of the system. It, too, is never set in SRBs sent to SCSI miniport drivers.
ExFreePool, ExInterlockedFreeToZone, HW_INITIALIZATION_DATA, PORT_CONFIGURATION_INFORMATION, ScsiPortGetPhysicalAddress, ScsiPortGetSrb, ScsiPortIoMapTransfer, ScsiPortNotification, SRB_IO_CONTROL