I strongly suggest that you use KMDF for your driver. You will not have to deal with this complexity and state management. Now, to answer your questions
1a) you only need to unmap your resources on a pnp stop, pnp graceful remove, or a pnp surprise remove. A normal power down does not require you to unmap resources. A normal power down will not take the resources away from your driver, a power down will just stop the hw from decoding those resources.
1b) correct, the mapped VA will still be valid until the next pnp operation.
-
yes you have to track state
-
You should not change the pnp state when you power down, BUT when you get a pnp state change (stop, remove, surprise remove), it is essentially an implicit power down message coming from pnp so you should do the power down logic and then unmap the resources.
KMDF handles all of this for you, tracks the states, and gives you the right callbacks to implement this correctly and easily w/out your driver tracking any state. In addition to the pnp/power state tracking, you also get I/O queueing and I/O queue state management that can be coordinated with pnp/power state changes. To download KMDF, goto http://www.microsoft.com/whdc/driver/wdf/KMDF_pkg.mspx
d
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Aparna Argade
Sent: Friday, March 31, 2006 4:03 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Power down consequences
Hi,
I am working on the power management for the first time. I am interested to know, what the PCI bus driver and power manager do, in response to device’s transition to D3 state.
I could not get direct help regarding this in DDK.
I observed that my data is not getting written to device after I power it down. I did not receive any PnP IRP. It means power manager is doing something at hardware level. I can write data again after powering it up.
I have following questions,
- a. Do I need to do any unmapping/mapping of device resources while handling power down/up IRPs? I think I should not do it. Is it correct?
b. If not, then it means that my earlier mapped system virtual addresses will be correct, even after second power up operation and it does not depend on other devices’s PnP ?operations. Is it correct?
- The power manager does not provide the current power state of the device. Is there any way to know the current power state, apart from what I maintain in my device extension?
- I maintain PnPState in my device extension. It is normally equal to “Started”. Should I change PnPState to “StopPending” or “Stopped” while handling Power down Device IRP? Again I think I should not do it. Is it correct?
Thanks,
Aparna
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer