[wdmaudiodev] Re: WaveRT MiniportDriver receiving IRP_MJ_CREATE in D3

  • From: Matthew van Eerde <Matthew.van.Eerde@xxxxxxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Wed, 23 Jul 2014 16:08:47 +0000

From a Windows developer:

[T]he driver should not directly ask for a power D0/D3 IRP.  Since these I/Os 
are not going through the portcls, they can disable Idle management, this would 
bring/keep the device in D0.  Note that the API in portcls  to disable idle 
management is not referenced counted, this means if they have multiple threads 
calling this API, the end result is unknown. If multiple threads are involved, 
they should serialize them and keep a ref count on when to turn on/off idle 
management

[…]

Take a look at the SetIdlePowerManagement in 
http://msdn.microsoft.com/en-us/library/windows/hardware/ff536844(v=vs.85).aspx
Note that they should also call the RegisterAdapterPowerManagement on that 
interface and support the IAdapterPowerManagement3.

From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Surabhi Ghaisas
Sent: Tuesday, July 22, 2014 9:03 PM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: WaveRT MiniportDriver receiving IRP_MJ_CREATE in D3

Thanks Tim. Yes, my device needs to be in D0 for IRP processing.

On Tue, Jul 22, 2014 at 10:36 PM, Tim Roberts 
<timr@xxxxxxxxx<mailto:timr@xxxxxxxxx>> wrote:
Surabhi Ghaisas wrote:
>
> In WaveRT miniport driver I am exposing one device interface for use
> by custom application by means of IoRegisterDeviceInterface. I want to
> handle the IRPs that come for this interface in miniport driver
> itself. For the same I have registered my own handlers for
> IRP_MJ_CREATE and IRP_MJ_DEVICE_CONTROL.
>
> What I am observing is when there is no activity for my device my
> driver enters D3 state as expected. After which when I launch my
> custom application I receive calls to IRP_MJ_CREATE and then
> IRP_MJ_DEVICE_CONTROL for registered interface as expected but all
> this time  driver state remains D3. I do not get a call to change
> driver state to D0 before receiving these IRP calls. Is this expected
> behaviour?
Yes.  It is up to the driver to decide when the device has to power up.
For KS requests, the port driver has that knowledge.  When you bypass
the port driver, you have to do it.

By the way, you have opened a real can of worms here.  There are a large
number of players involved (KS, Port class, Miniport, Bus), and each one
of them thinks they own a piece of the power management pie.

I'm a little surprised your device goes into D3.  I didn't know the
WaveRT port driver would do that.


> Should miniport driver make call to PoSetPowerState for IRPs that are
> not passed on portclass?
Do your IRPs require the device to be in D0?  If so, then you need to
send an IRP_MJ_POWER with IRP_MN_SET_POWER.  One of the existing drivers
will call PoSetPowerState.  I don't have any clue whether this will
actually work.  The port driver thinks it is managing the power policy.

--
Tim Roberts, timr@xxxxxxxxx<mailto:timr@xxxxxxxxx>
Providenza & Boekelheide, Inc.

******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx<mailto:wdmaudiodev@xxxxxxxxxxxxx>
Subscribe:    
mailto:wdmaudiodev-request@xxxxxxxxxxxxx<mailto:wdmaudiodev-request@xxxxxxxxxxxxx>?subject=subscribe
Unsubscribe:  
mailto:wdmaudiodev-request@xxxxxxxxxxxxx<mailto:wdmaudiodev-request@xxxxxxxxxxxxx>?subject=unsubscribe
Moderator:    
mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx<mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx>

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts: