Maxim
Mon Sep 11 04:05:22 CDT 2006
> Once done the Power Manager and the class drivers will determine when
> to generate the START STOP UNIT command to stop the device.
Correct. Look at Disk/ClassPnP class driver source, it sends START STOP UNIT in
response to the D power IRP.
For CDs, it terminates the possible music play when the Dn power IRP arrives
:-)
>Also I
> assume the class drivers will generate the START STOP UNIT to start the
> device before issuing any further IO commands.
I don't think so. If IO arrives to powered down disk PDO - then your port's PDO
must initiate powering it up using PoRequestPowerIrp to state D0.
>to register for idle detection using timeout -1
...yes, and set the correct ->DeviceType in the PDO - FILE_DEVICE_DISK, for
instance - according to SCSI INQUIRY data.
>and call the PoSetDeviceBusy in my StartIO routines.
No. PoSetDeviceBusy must be called in DispatchInternalDeviceControl _before the
queue_ on each request with a SRB in it. You can even go further and call it
only for each request which requires the device motor to be spinning - read the
SCSI spec for the list. Some commands - like INQUIRY and some MODE SENSE - can
be executed on the drive with the motor powered off.
Also, do not forget that, if the PDO is in state > D0, you must call
PoStartNextPowerIrp to D0 instead of PoSetDeviceBusy.
The queue consumer must be blocked while the device is in > D0. This stop flag
can be combined with "locked queue" flag governed by LOCK_QUEUE IOCTL and used
by "bypass locked queue" IRPs - these IRPs (like the START STOP UNIT for
resume) bypass both "powered down" queue and "locked" queue. I believe these 2
queues are the same in SCSIPORT.
"Frozen" queue is another thing.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com