A.4.2.1 Calling ScsiPortInitialize

If its HBA can be connected on more than one type of I/O bus, a miniport driver needs to call ScsiPortInitialize for each bus type and must have a HwScsiFindAdapter routine for each bus type. Such a miniport driver must modify the AdapterInterfaceType and HwScsiFindAdapter members in the HW_INITIALIZATION_DATA after each call to ScsiPortInitialize, possibly modify the miniport-supplied context data for the new bus type, and call ScsiPortInitialize for each type of bus on which a supported HBA might be connected.

Before it calls the miniport’s HwScsiFindAdapter routine, ScsiPortInitialize does all of the following:

Then, ScsiPortInitialize calls the miniport driver’s HwScsiFindAdapter routine, described in Section A.4.3.

If the miniport’s DriverEntry routine sets a particular AdapterInterfaceType value in the HW_INITIALIZATION_DATA but there is no bus of that type in the machine, the port driver returns an OS-specific status value indicating that such an HBA does not exist in the current machine. It does not call the driver-supplied HwScsiFindAdapter routine for that bus type.

A miniport driver does not remain loaded if the machine has no I/O buses of the type(s) specified by the miniport’s DriverEntry routine.

Note that ScsiPortInitialize also is responsible for the following before it returns control to the miniport’s DriverEntry routine:

Each SCSI miniport driver defines the internal structure and contents of its device extension, logical unit extensions (if any), and SRB extensions (if any). A pointer to the HBA-specific device extension is an input argument to every system-defined miniport driver routine except DriverEntry. Many ScsiPortXxx routines require this pointer as an argument.

ScsiPortInitialize can be called only from a miniport driver’s DriverEntry routine. For more information about the HW_INITIALIZATION_DATA structure and ScsiPortInitialize, see the Kernel-Mode Driver Reference.