SrbProcessing rule set (Storport)

Use these rules to verify that your driver correctly processes SRB requests.

In this section

Topic Description

SpDuplex

This rule verifies that this miniport is in Full Duplex mode. Any driver built according to the StorPort-miniport model must be in Full Duplex mode. Half Duplex should only be used when porting an existing SCSI driver to StorPort.

SpNoWait

This rule verifies that waits or data allocation are not performed inside StartIo.

SpReturnValue

This rule verifies that the driver's implementations of HwStorFindAdapter and VirtualHwStorFindAdapter return a valid status. A valid status is one of the following: SP_RETURN_FOUND, SP_RETURN_ERROR, SP_RETURN_BAD_CONFIG, or SP_RETURN_NOT_FOUND.

StorPortAllocatePool

This rule verifies that the miniport must not attempt to call StorPortFreePool on a deallocated buffer.

StorPortAllocatePool2

This rule verifies that the miniport must not attempt to call StorPortAllocatePool on an allocated buffer without deallocating it first.

StorPortBuildIo

This rule verifies that if the StorPort miniport's StorPortBuildIo routine returns FALSE, the SRB in question is not passed to StartIo. (In such cases, the miniport driver must complete the SRB by calling StorPortNotification with a notification type of RequestComplete from StorPortBuildIo or someplace else).

StorPortCompleteRequest

This rule verifies that no calls to StorPortCompleteRequest are made by the miniport. Usage of the StorPortCompleteRequest is not recommended; miniports should instead call StorPortNotification with notificationType = RequestComplete.

StorPortEnablePassive

This rule verifies that StorPortEnablePassiveInitialization is not called from any StorPort miniport driver routine other than HwInitialize.

StorPortFindAdapter

The HwStorFindAdapter routine must set the MaximumTransferLength and the NumberOfPhysicalBreaks fields in the PORT_CONFIGURATION_INFORMATION structure. By default, the value of both these fields is SP_UNINITIALIZED_VALUE. If either of these fields is still set to SP_UNINITIALIZED_VALUE upon exit from FindAdapter, the driver fails the rule.

StorPortNotification2

This rule verifies that calls to StorPortNotification use only allowed (i.e. documented) notification types.

StorPortPassiveFromHwInit

StorPortEnablePassiveInitialization should not be called within the HW Initialization entry point for Storport drivers if the HW Initialization entry point can be called directly from the HW Adapter Control entry point.

StorPortPerfOpts

This rule verifies that the PerfConfigData parameter that is passed to StorPortInitializePerfOpts is not NULL.

StorPortStartIo

Waits or data allocation must never be performed in the miniport's StartIo routine. The driver fails the rule if it calls StorPortStallExecution or another function that involves time-consuming operations. Since StartIo is synchronized, these calls should mostly be done in BuildIo.

StorPortTimer

The HW_TIMER routine must be defined if a call to StorPortNotification(RequestTimerCall) is made.

To select the SrbProcessing rule set

  1. Select your driver project (.vcxProj) in Microsoft Visual Studio. From the Driver menu, click Launch Static Driver Verifier….

  2. Click the Rules tab. Under Rule Sets, select SrbProcessing.

    To select the default rule set from a Visual Studio developer command prompt window, specify SrbProcessing.sdv with the /check option. For example:

    msbuild /t:sdv /p:Inputs="/check:SrbProcessing.sdv" mydriver.VcxProj /p:Configuration="Win8 Release" /p:Platform=Win32
    

    For more information, see Using Static Driver Verifier to Find Defects in Drivers and Static Driver Verifier commands (MSBuild).