Microsoft KB Archive/243823

{|
 * width="100%"|

INFO: Checking Device Power State in Interrupt Service Routines

 * }

Q243823

-

The information in this article applies to:


 * Microsoft Windows 98 Driver Development Kit (DDK)
 * Microsoft Windows 2000 Driver Development Kit (DDK)

-

SUMMARY
Device drivers that support interrupt sharing, such as Peripheral Component Interconnect (PCI) drivers, must not access their hardware device from within an Interrupt Service Routine (ISR) unless the device is in a power state that is sufficient to accept the request. If the power state is not sufficient to accept the request, the system may stop responding (hang) because the hardware access may not be completed.

MORE INFORMATION
Interrupt Service Routines in drivers that support power management must always check the device power state if the driver permits interrupt sharing. When devices are put into a low power state (for instance, D3) the driver's ISR may still be called if another device asserts the shared interrupt line. The ISR must first check the device power state before accessing the device to determine whether it needs to service the interrupt.

All device drivers, including Windows Driver Model (WDM) drivers and virtual device drivers (VxDs), must follow this requirement in their ISRs. Different driver models use different methods to notify drivers of device power state changes. Microsoft Windows NT and WDM drivers receive power state change notifications through IRP_MN_SET_POWER requests, while VxDs receive CONFIG_APM_SET_Dx messages (where Dx represents a power state from D0 to D3).

The concept of device-level power management is supported in Advanced Configuration and Power Interface (ACPI)-compliant Microsoft operating systems, including Microsoft Windows 98 and Microsoft Windows 2000. Drivers that run on these operating systems must be aware that devices may be placed in a low-power state at any time for a variety of reasons, including device inactivity. For example, on Windows 98, VCOMM places a port into a low-power state when an application or driver closes the port. Other classes of drivers must be able to handle dynamic device power transitions. In general, the device Class driver (for example, VCOMM) is the power policy owner, and controls when device power transitions occur. As Windows Class drivers add new power management capabilities (for instance, NDIS5), it is increasingly important for Windows drivers to be power-aware.