Muokkaa

Jaa


Overview of Wait/Wake Operation

The operating system's wake-up mechanism works as shown in the following figure.

diagram illustrating an overview of irp-mn-wait-wake processing.

  1. While the system and device are in the working state, the power policy owner for a device determines that its device should be enabled ("armed") for wake-up. The power policy owner requests a power IRP (PoRequestPowerIrp with minor code IRP_MN_WAIT_WAKE) to be sent to its PDO to inform all drivers in its device stack. In the request, the policy owner specifies a callback routine (not the same as an IoCompletion routine).

  2. The power manager, through the I/O manager, sends the IRP to the top of the device stack.

  3. Drivers set IoCompletion routines and pass the IRP down until it reaches the bus driver.

  4. The bus driver enables wake-up on the physical device, if it can, and marks the IRP pending. If necessary, it also requests a wait/wake IRP for its parent.

  5. Sometime later, an external wake-up signal arrives.

  6. The bus driver completes the IRP_MN_WAIT_WAKE.

  7. I/O manager calls IoCompletion routines that were set as drivers passed the IRP down the stack.

  8. I/O manager calls the callback routine set by the policy owner when it requested the IRP.

The IRP_MN_WAIT_WAKE request does not change the power state of the device or the system. It merely enables wake-up on the device so that later, if the device enters an appropriate sleep state, an external signal will cause the device (and possibly the system) to awaken.

When a wake-up signal arrives, the drivers' behavior is the same whether the device wakes the system or only itself. If the device is enabled for wake-up and the system is in a sleep state from which the device can awaken it, the device will awaken the system. If the device is enabled for wake-up and the system is in the working state, only the device will awaken.

Because computers and devices vary in design, particularly with respect to power planes, the supported system and device power states -- and thus the states that can support wait/wake -- are not the same on all hardware configurations. Therefore, any driver that owns power policy for its device and every bus driver must pay careful attention to the capabilities of the individual configuration on which it is running. For further information, see Determining Whether a Device Can Wake the System.

For further details on wait/wake operations, see Understanding the Path of Wait/Wake IRPs through a Device Tree and Overview of Wait/Wake IRP Completion.