Книга: Writing Windows WDM Device Drivers

System Power Policies

System Power Policies

The rest of this chapter looks at how device drivers handle Power Management. Some classes of device ought to have certain Power Management characteristics. These details are found in the Device Class Power Management specification.

System power states indicate the overall energy usage of a whole system, while a device power state says how much energy an individual device is using. Even though the system may be fully powered up, a device can power itself down. For example, if a battery-operated computer is fully on but the hard disk is not being used, the disk driver may reasonably decide to power the disk down to save energy. Conversely, a sleeping computer may keep its modem powered up if it is waiting for incoming faxes.

System and Device States

Windows defines six system power states and four device power states. Please be very clear about whether you are referring to system or device power states.

A POWER_STATE variable represents either a system or device power state. The POWER_STATE typedef is a union of the two enum typedefs, SYSTEM_POWER_STATE and DEVICE_POWER_STATE.

typedef union _POWER_STATE {
 SYSTEM_POWER_STATE SystemState;
 DEVICE_POWER_STATE DeviceState;
} POWER_STATE, *PPOWER__STATE;

System Power States

Table 10.1 shows the system power states along with the SYSTEM_POWER_STATE enum names and values. Sleeping state S1 has the lowest latency so the system can return to the fully on state in the quickest time possible. States S2 and S3 gradually increase power up latency and decrease power consumption.

Table 10.1 System power states

ACPI State Description Enum name
S0 Working/Fully on PowerSystemWorking(1)
S1 Sleeping PowerSystemSleeping1(2)
S2 Sleeping PowerSystemSleeping2(3)
S3 Sleeping PowerSystemSleeping3(4)
S4 Hibernating: Off, except for trickle current to the power button and similar devices. PowerSystemHibernate(5)
S5 Shutdown/Off PowerSystemShutdown(6)

Windows moves to and from only S0. There are never changes between the states S1 to S5 (e.g., from S4 to S2). Windows always assumes that it can power up to S0, so it does not have to ask drivers for permission (using the IRP_MN_QUERY_POWER request).

The IRP stack Parameters.Power.ShutdownType value gives extra information about system state changes. It is particularly useful for transitions to S5. PowerActionShutdownReset indicates a reboot while PowerActionShutdownOff means the computer is being switched off.

Device Power States

Table 10.2 shows the available device power states along with the DEVICE_POWER_STATE enum names and values. Again, state D1 has lower latency than D2.

Table 10.2 Device power states

State Description Enum name
D0 Fully working PowerDeviceD0(1)
D1 Sleeping PowerDeviceD1(2)
D2 Sleeping PowerDeviceD2(3)
D3 Off PowerDeviceD3(4)

Both the state values increase from 1 the sleepier they are.

A device need not support all the device states. DO for on and D3 for off are a basic minimum. A device is not limited in its state transitions, so a change from D1 to D3 is possible.

Later, I describe how each device (or its bus driver) provides a table for device states for each system state.

Оглавление книги


Генерация: 1.352. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз