Handling PnP Start in a Storage Class Driver
A storage class driver performs device-specific initialization when the PnP manager calls the class driver's DispatchPnP routine with a start request (IRP_MJ_PNP with IRP_MN_START_DEVICE). The storage class driver's DispatchPnP routine either calls an internal StartDevice routine or implements the same functionality inline. Because start requests sent to an FDO must be handled first by the lowest driver in the stack, the storage class driver's DispatchPnP routine forwards the request to the next-lower driver with IoCallDriver before calling StartDevice. If the request was sent to a PDO, the driver need not forward the request before handling it.
A storage class driver's internal StartDevice routine sets up the device extension of its FDO with driver-determined data to manage I/O requests for the device. For more information, see Setting Up a Storage Class Driver's Device Extension.
A StartDevice routine should enable any device interfaces that the driver registered in its AddDevice routine. (See Device Interface Classes.) It might also create a symbolic link for its device object.
After the start of the lower device has completed, the driver can assume that the device is in the D0 power state (fully on and operational) for most purposes. If the device is not completely powered up, the port driver will queue requests until the device is ready. However, if the driver's StartDevice routine needs to perform any operations that require inrush current -- for example, to spin up a disk drive -- the driver must send a D0 power request to the next-lower driver before performing the operation.
A driver of a device of type FILE_DEVICE_DISK or FILE_DEVICE_MASS_STORAGE can register for idle detection and use the standard power policy time outs for the device class by specifying conservation and performance time-out values of -1 in its PoRegisterDeviceforIdleDetection call.
For more information about a storage class driver's DispatchPnP routine, see Handling PnP Requests to Storage Peripherals. For more information about handling PnP start requests, see Starting a Device.