Modifying Storage Miniport Driver Routines to Support WMI SRBs

Before the miniport driver can support WMI SRBs, you must ensure that the miniport driver contains the required HwScsiWmiQueryReginfo routine and that it performs the indicated actions for the following routines:

The DriverEntry of SCSI Miniport Driver routine:

  • If the miniport driver uses the SCSI Port WMI library, initialize the SCSI_WMILIB_CONTEXT structure as indicated in Using the SCSI Port WMI Library.

  • Indicate to the port driver whether it should allocate memory for SRB extensions. The miniport driver indicates that SRB extensions should be allocated by setting the SrbExtensionSize member of the HW_INITIALIZATION_DATA (SCSI) structure to a nonzero value.

The HwScsiFindAdapter routine:

The HwScsiStartIo routine:

  • Test Function member of the SRB to see if it is equal to SRB_FUNCTION_WMI. If this condition is TRUE, the miniport driver must process an SRB of type SCSI_WMI_REQUEST_BLOCK rather than an SRB of type SCSI_REQUEST_BLOCK.

  • Allocate memory for an SCSIWMI_REQUEST_CONTEXT structure to hold SRB context. If the miniport driver might pend WMI requests, allocate memory from the SRB extension so that the miniport driver can maintain request context throughout the processing of an SRB. Otherwise, if there is no chance that the request will ever pend, allocate the memory for the context from the stack.

  • Check Srb->WMIFlags to determine whether the request is for the adapter or for a logical unit.

  • Call the SCSI Port WMI library dispatch routine, ScsiPortWmiDispatchFunction. For an explanation of how to call this dispatch routine, see Using the SCSI Port WMI Library.

  • Call ScsiPortWmiPostProcess after processing the request if it was pended by the driver. If the driver did not pend the request, then ScsiPortWmiPostProcess should be called in the miniport driver callback routine, rather than the miniport driver's start I/O routine.

  • Set Srb->DataTransferLength and Srb->SrbStatus to the values returned by ScsiPortWmiGetReturnSize and ScsiPortWmiGetReturnStatus respectively.

  • Call ScsiPortNotification with RequestComplete and again with NextRequest or (NextLuRequest).

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft