S1 | S2 | S3 | S4 | S5 | ||
---|---|---|---|---|---|---|
W98 | D0 | D0 | D0 | D0 | D0 | D3 |
W2000 | ? | D3 | D3 | D3 | ? | ? |
Wdm2 | D0 | D3 | D3 | D3 | D3 | D3 |
The
The
Finally, note that another PnP IRP, IRP_MN_QUERY_RELATIONS, has a PowerRelations subtype that asks for the PDOs of the devices that are related to the current device. These other devices are powered down when this device powers down.
Advanced Power Management
The basic idea of IRP_MN_WAIT_WAKE Power IRP is quite simple. It lets devices wake the system up from a sleeping state. A classic example is letting an incoming call from a modem wake up the system. Alternatively, a soft power on/off switch could power the system up when it is pressed.
Send an IRP_MN_WAIT_WAKE IRP to yourself using
The situation becomes complicated when your bus driver cannot wake up the system. The bus driver FDO must generate another IRP_MN_WAIT_WAKE IRP and send it to its PDO. This continues until the root ACPI driver is reached, which can wake the system up. Each IRP_MN_ WAIT_WAKE IRP is completed in turn by the bus drivers when a wake event is detected.
You must be prepared to cancel an IRP_MN_WAIT_WAKE IRP when a device is removed.
When a device is stopped, the IRP_MN_WAIT_WAKE IRP must be cancelled and sent again when the resources have been reassigned.
A driver can send an IRP_MN_POWER_SEQUENCE IRP to its bus driver (device power policy manager) to see how many times the device has entered the device states D1, D2, and D3. This information is used to see if a device did power down and so needs to be powered up.
A bus driver zeroes these counts when the device is created. It then increments the relevant count every time it moves into that device state. It never zeroes the counts again.
The PoRegisterSystemState kernel call provides a function similar to the
The similar function,
These functions are only available in W2000.
A driver can register to receive power notification events on a device tree using the
In Windows 2000, a driver can use a kernel callback object to detect when the system power policy changes or when a sleep or shutdown is imminent. Register a callback routine to receive notification of CallbackPowerState events.
First, initialise an attribute block using
You can also register to receive CallbackSetSystemTime notifications when the system time is changed. Finally, you can create your own callback object; calling
Chapter 12 shows that Windows Management Instrumentation (WMI) is a facility that lets users interact with drivers. In fact, it will be just system operators, developers, or network professionals who wish to use WMI to see what is happening in a system, possibly to diagnose a fault condition.
A driver supports WMI by handling the IRP_MJ_SYSTEM_CONTROL IRP. WMI lets drivers make information available to users or receive data from them. The data objects are in structures identified by GUIDs. There are various standard WMI data blocks, but drivers can define their own data blocks, if need be.
The Power Management portion of a driver can use two standard WMI data blocks to let a user enable or disable two features. The
A driver that supports these WMI features may also let their settings be changed using IOCTLs.
GUID_POWER_DEVICE_TIMEOUT is also defined to let the user change the idle timeouts. This feature is not working in W2000 Beta 3.
If you implement WMI for the
Figure 10.4 Wdm3 Power Management device properties
Conclusion