Device MN_SET_POWER: returning from hibernation/standby BSOD?

Hi all,

I have my own simplified processing model for the Power management
dispatch function for an Win2K WDM driver (PCI device). I found Walter
Oneys implementation a bit hard to follow and too comprehensive for my
application. So far suspend/hibernate and shutdown works so that the
QUERY_POWER and SET_POWER IRP’s for System and Device IRP’s all appear
to work. However returning from hibernate/suspend causes a blue screen
with IRQL_NOT_LESS_OR_EQUAL. I essentially disable the device when I
power down and currently don’t do anything when it powers up (so it
should not cause interrupts or mind of it’s ISR is called). I’m
wondering if I screwed up the IRP completion somewhere. I know from
setting Bug Checks that my driver gets the Device SET power from D0 to
D3 when I come back up. This is sent from my handler for the System
SET processing. The (non-intentional) Bug check happens sometime after
my completion routine for the Device SET has returned. I set the
DO_POWER_PAGABLE flag in the device object. Here is the basic
structure:

From the Dispatch routine:


IoAcquireRemoveLock( … )
if( device powering up )
{
IoCopyCurrentIrpStackLocationToNext( Irp );
IoSetCompletionRoutine( … )
PoCallDriver( … )
return( STATUS_PENDING )
{
else …

From the completion routine:


  • reset the device to enable access (may be commented out)
  • record new device state in Device Ext
    PoSetPowerState( … ); // new device state
    IoStartNextPowerIrp( Irp );
    IoCompleteRequest( Irp, IO_NO_INCREMENT );
    IoReleaseRemoveLock( … );
    return( STATUS_SUCCESS );

Sometime after this I get the dreaded BSOD. I followed the steps in
the DDK as closely as possible.

One point I am not clear on is the save/restore or device context when
the device comes back up? I assume the device extension values are
restored for me. I don’t really care about the state of the devices
itself or any IRP’s. Also, what else should I be using the remove lock
for? Is this only relevant for Power processing or does this somehow
relate to the PnP REMOVE_DEVICE IRP’s?

Any ideas appreciated.


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com