ScsiPortNotification

VOID
    ScsiPortNotification(

        IN SCSI_NOTIFICATION_TYPE  NotificationType,
        IN PVOID  HwDeviceExtension,
       
... /* Additional parameters, as required by the given NotificationType */
           
        /* for RequestComplete add: */
            IN PSCSI_REQUEST_BLOCK Srb
        /* for NextLuRequest add: */ 
            IN UCHAR
 PathId, 
            IN UCHAR TargetId, 
            IN UCHAR Lun 
        /* for CallEnableInterrupts or CallDisableInterrupts add: */
            IN PHW_INTERRUPT  HwScsiXxxInterruptsCallback
        /* for RequestTimerCall add: */ 
            IN PHW_TIMER  HwScsiTimer,
            IN ULONG MiniportTimerValue
        );

ScsiPortNotification tells the OS-specific port driver of certain events, such as when a miniport driver completes a request or is ready to start another SRB, as well as when the HBA indicates that certain SCSI error conditions occurred during an operation.

Parameters

NotificationType
Specifies the type of notification, which can be one of the following:

Notification type

Description

RequestComplete

Indicates the given Srb has finished. If this value is set, ScsiPortNotification requires one additional parameter: the address of the SRB. After this notification, the OS-specific port driver owns the request. The miniport driver must not access the Srb, and it must not pass the Srb to another routine (such as ScsiPortLogError).

NextRequest

Indicates the miniport driver is ready for another request to a target that is not currently busy. This notification should be sent by the miniport as soon as the driver is ready for another request. Usually, this notification is sent from the HwScsiStartIo routine but, sometimes, from the HwScsiInterrupt (or HwScsiEnableInterruptsCallback) routine.

NextLuRequest

Indicates that the HBA is ready for another request for the specified logical unit. If this value is set, ScsiPortNotification requires three additional parameters: (1) the path ID, (2) the target ID, and (3) the logical unit number. This value should be used only if the HBA can queue multiple requests and support auto request sense or tagged queuing.

ResetDetected

Indicates that the HBA has detected a reset on the SCSI bus. After this notification, the miniport driver is still responsible for completing any active requests. The SCSI port driver will manage all required bus-reset delays.

CallEnableInterrupts

Indicates that the miniport driver requires the OS-specific port driver to call the miniport’s HwScsiEnableInterruptsCallback routine. If this value is set, ScsiPortNotification requires an additional parameter: the entry point for the HwScsiEnableInterruptsCallback. The miniport’s HwScsiInterrupt routine makes this call, after disabling interrupts on the HBA, to defer some interrupt-driven I/O processing if the HBA requires polling or stalling in the ISR. While the callback runs, system interrupts remain enabled but the miniport driver’s HwScsiInterrupt routine will not be called. The HwScsiEnableInterruptsCallback is responsible for completing the deferred I/O processing and for calling ScsiPortNotification again with CallDisableInterrupts and the miniport’s HwScsiDisableInterruptsCallback entry point.

CallDisableInterrupts

Indicates that the miniport driver requires the OS-specific port driver to call the miniport’s HwScsiDisableInterruptsCallback routine. If this value is set, ScsiPortNotification requires an additional parameter: the entry point for the HwScsiDisableInterruptsCallback. While this callback runs, it cannot be preempted by an interrupt except from a device with a higher priority interrupt than the HBA. In this callback, the miniport re-enables interrupts on the HBA.

RequestTimerCall

Indicates that the miniport requires the OS-specific port driver to call the miniport’s HwScsiTimer routine in the requested number of microseconds. If this value is set, ScsiPortNotification requires two additional parameters: (1) the entry point for the miniport’s HwScsiTimer routine, and (2) a MiniportTimerValue interval, in microseconds. Note that the resolution of the system timer is approximately 10 milliseconds.

HwDeviceExtension
Points to the miniport driver’s per-HBA storage area.

Comments

Every miniport driver must call ScsiPortNotification twice for each call to the miniport’s HwScsiStartIo routine with an SRB that the miniport completes successfully. First, the miniport calls ScsiPortNotification with the NotificationType NextRequest or with NextLuRequest if the miniport supports tagged queuing or multiple requests per LU. Then, the miniport calls ScsiPortNotification with the NotificationType RequestComplete and the request that it has just satisfied.

A miniport’s HwScsiInterrupt routine is most likely to call ScsiPortNotification with the NotificationType ResetDetected.

If an HBA requires the miniport to use more than a millisecond processing interrupt-driven I/O operations, its HwScsiInterrupt routine should disable interrupts on the HBA and call ScsiPortNotification with CallEnableInterrupts and a driver-supplied HwScsiEnableInterruptsCallback routine. This routine, in turn, calls ScsiPortNotification with CallDisableInterrupts and the corresponding driver-supplied HwScsiDisableInterruptsCallback.

See Also

HwScsiTimer, HwScsiDisableInterruptsCallback, HwScsiEnableInterruptsCallback, ScsiPortCompleteRequest