To understand the Windows 2000 architecture for handling wake requests, it is important to first understand the hardware operation. A device that is armed for wake detection appears to have the capability to force a sleeping system back to life. In fact, since the device is a slave of the bus, it really has only the capability to signal its intent to the bus. It is the bus hardware that in turn forces the system out of its sleep. The significance of this is that the software that drives the hardware is ultimately centered at the bus driver. The arming process starts at the top of the device stack, but the actual waiting occurs at the bottom bus driver. Thus, the overall process for the wake process is
This process is depicted in Figure 10.2. Figure 10.2. The wake process.There are several noteworthy points concerning the process. First, a device stack is allowed, at most, one outstanding WAIT_WAKE IRP at a time. Therefore, a single pointer within the FDO device extension is appropriate to hold the WAIT_WAKE IRP pointer if established. Second, the policy owner that issues the arm or disarm request must do so only when the device is at full power, state D0. Additionally, neither the device nor the system may be in a power state transition at the time the arm or disarm request is made. This last rule appears a bit restrictive in that it might make sense to decide to arm the wake device just before the device enters a reduced power mode. Instead, the decision to arm must be made a priori, with the device stack left enabled for a potential sleep-wake cycle. Canceling the Wake-Armed IRPOnce issued, an IRP_MN_WAKE_WAIT IRP remains outstanding indefinitely. The bus driver holds this request in a pended state, long before the system even enters the sleep state. To disarm the wake capability, the IRP must be canceled by the original requestor, the power policy owner. To cancel the request, the policy owner invokes the I/O Manager function IoCancelIrp, described in Table 10.7. A typical need to cancel the power IRP occurs when an armed device is stopped or ejected from the system.
|