IRP_MN_START_DEVICE in KMDF

What KMDF callback matches the IRP_MN_START_DEVICE WDM IRP? Generally, how to find correct KMDF callback for given IRP, is there some reference?

Take a look at http://www.microsoft.com/whdc/driver/wdf/WDF_Port.mspx


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

wrote in message news:xxxxx@ntdev…
> What KMDF callback matches the IRP_MN_START_DEVICE WDM IRP? Generally, how
> to find correct KMDF callback for given IRP, is there some reference?
>

Whenever this question is asked, I have to ask what is the difference between your pnp start handling and power up handling? Kmdf abstracts both into the same set of callbacks, the only difference is that EvtDevicePrepareHardware is called before the power up callbacks (and SelfManagedIoInit is called instead of SelfManagedIoRestart).

Is this a usb device? If so, you would configure the device in PrepareHardware and then use the pipes in D0Entry to power up the device

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
Sent: Tuesday, May 27, 2008 7:12 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] IRP_MN_START_DEVICE in KMDF

Take a look at http://www.microsoft.com/whdc/driver/wdf/WDF_Port.mspx


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

wrote in message news:xxxxx@ntdev…
> What KMDF callback matches the IRP_MN_START_DEVICE WDM IRP? Generally, how
> to find correct KMDF callback for given IRP, is there some reference?
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

This is PCI board driver. Looking at KMDF samples, I see that actions similar to IRP_MN_START_DEVICE handling in existing WDM driver are done in EvtPrepareHardware.
Thank you for links, these documents are useful.

Be careful in what you put in PrepareHardware() and the rest of the power up routines (D0Entry, InterruptEnable, D0EntryPostInterruptsEnabled, Dma*). Only probing your hw for a revision and mapping memory should be in PrepareHardware while the remainder of your init probably goes in the latter routines

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Wednesday, May 28, 2008 3:06 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] IRP_MN_START_DEVICE in KMDF

This is PCI board driver. Looking at KMDF samples, I see that actions similar to IRP_MN_START_DEVICE handling in existing WDM driver are done in EvtPrepareHardware.
Thank you for links, these documents are useful.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Doron Holan wrote:

Be careful in what you put in PrepareHardware() and the rest of the
power up routines (D0Entry, InterruptEnable, D0EntryPostInterruptsEnabled,
Dma*). Only probing your hw for a revision and mapping memory should
be in PrepareHardware while the remainder of your init probably goes in
the latter routines

Also don’t forget that EvtPrepareHardware can be called more than once (i.e. during PNP rebalance), so don’t use it for one-time initialization without checking state.

The pattern here is to undo what you did in PrepareHardware() in ReleaseHardware(), these 2 will always be paired together and will be called when the device is gracefully removed or surprise removed. Of course stuff like revision detection does not need to be undone in ReleaseHardware(), but doing it twice is not so bad either :wink:

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, May 28, 2008 9:16 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] IRP_MN_START_DEVICE in KMDF

Doron Holan wrote:

Be careful in what you put in PrepareHardware() and the rest of the
power up routines (D0Entry, InterruptEnable, D0EntryPostInterruptsEnabled,
Dma*). Only probing your hw for a revision and mapping memory should
be in PrepareHardware while the remainder of your init probably goes in
the latter routines

Also don’t forget that EvtPrepareHardware can be called more than once (i.e. during PNP rebalance), so don’t use it for one-time initialization without checking state.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer