A.4.2 SCSI Miniport Driver’s DriverEntry Routine

A DriverEntry routine is the initial entry point for most Windows NT kernel-mode drivers and for every SCSI miniport driver. A miniport’s DriverEntry routine is called with two input arguments of type PVOID and must do the following:

  1. Initialize a HW_INITIALIZATION_DATA structure on the stack with zeros.

  2. Set the HwInitializationDataSize member to sizeof(HW_INITIALIZATION_DATA).

  3. Set driver-specific and HBA-specific values in the HW_INITIALIZATION_DATA members, including the miniport driver’s entry points. The following entry points must be set:

    • HwScsiFindAdapter

    • HwScsiInitialize

    • HwScsiStartIo

    • HwScsiResetBus

    The following entry points can be set to a driver-supplied routine or must be set to NULL:

    • HwScsiInterrupt (NULL if the miniport uses polling exclusively)

    • HwScsiDmaStarted (NULL if the HBA uses PIO or is a busmaster)

    • HwScsiAdapterState (NULL if the miniport runs only on Windows NT platforms or if it is designed to also run on x86-only Windows platforms but the HBA has neither a BIOS nor x86-real-mode driver)

  4. Set up any driver-determined context data that the miniport’s HwScsiFindAdapter routine will use.

  5. Call ScsiPortInitialize with the pointers that were input to the DriverEntry routine, the address of the filled-in HW_INITIALIZATION_DATA, and the address of the context data, if any.