Life Cycle of a Storport Driver
The life cycle of a Storport driver can be described in terms of the callback routines into the miniport driver from the Storport driver. The callback routines can be categorized into several main groups, as shown in Figure 1.
Several examples of each type of callback routine are shown in Figure 2. When the system starts and the driver is first loaded, the miniport driver's DriverEntry routine is called. This routine fills out a data structure that provides Storport with the miniport driver's entry points, also known as its callback routines, or callbacks. Near the end of this routine, the miniport driver calls StorPortInitialize. The Storport driver then calls the miniport callback routine HwStorFindAdapter, or in the case of a virtual miniport driver, VirtualHwStorFindAdapter. After returning from that routine, the miniport driver's HwStorInitialize routine is called.
Storport then obtains the miniport driver's supported control types by calling its HwStorAdapterControl routine with ScsiQuerySupportedControlTypes as a parameter.
When the system is shutdown, HwStorStartIo is called with an SRB of type SRB_FUNCTION_SHUTDOWN. When an adapter is removed or disabled while the system is running, or when the system is entering hibernate mode, HwStorAdapterControl is called with ScsiStopAdapter as a parameter. When the system is resuming from hibernate mode, HwStorAdapterControl is called with ScsiRestartAdapter as a parameter.
Build date: 2/12/2014