As part of the OnNow initiative, Microsoft, working with hardware system developers, established the Advanced Configuration and Power Interface (ACPI) BIOS. ACPI replaces the outdated Advanced Power Management (APM) BIOS interface for power management. Proper operation of Windows 2000 power management features depend upon BIOS support of ACPI. When installed on non-ACPI-compliant platforms, Windows 2000 degrades to the capability extended by APM-compliant BIOS. To fully exercise WDM driver power management code, a system with ACPI BIOS enabled must be used. Further, Windows 2000 should be installed with ACPI enabled (typically a BIOS setup screen option). While APM-only support is suitable for gross-level power management, the full blown ACPI feature set is required to gain the full range of device power management supported by Windows 2000. APM support is sufficient for battery management in mobile devices. Idle ManagementSince the most obvious form of power savings that occurs is the power down of idle devices (i.e., devices that remain unused for an extended period of time), Windows 2000 provides a convenient mechanism for device drivers to request a power IRP IRP_MN_SET_POWER after a specified timeout period. The Power Manager function PoRegisterDeviceForIdleDetection, described in Table 10.8, provides this functionality. The return value from PoRegisterDeviceForIdleDetection is a pointer to an idle counter that is incremented each second. When and if the counter reaches the timeout value specified (argument two or three), the Power Manager sends an IRP_MN_SET_POWER request of the power state specified in argument four. The timer/counter must be manually reset by driver code, as appropriate, by calling PoSetDeviceBusy, described in Table 10.9. Of course, setting too short a timeout interval burdens a driver with frequent calls to PoSetDeviceBusy, so conservative timeout values would seem appropriate.
User Interface for Power ManagementThe suggested user interface for Power Management is the Control Panel applet of Windows 2000, Power Options. To extend the Power Options applet with a driver-customized property sheet requires the use of Microsoft's COM object model and registration of the property sheet. An example of providing such an extension is provided on the companion Web site of this book, www.W2KdriverBook.com Some knowledge of ATL (Active Template Library) is required to understand the example.
|