### Technical Briefing

August 1996

# Advanced Power Management

## Introduction

Most portable computers and some desktop computers have special hardware and software components to allow power savings. These components detect when parts of a computer are not being used, and they reduce or remove power to those parts. For example, when the lid of a laptop computer is folded down, they might reduce power to the screen (which is obviously not being used), and also to the processor, since, if the lid is closed, the user cannot require full processing power. This type of power management takes place automatically, but it is also often possible for the user to press a button or combination of keys that cause the computer to enter a particular power-saving mode.

There is normally a hierarchy of power-saving modes on a given computer, each level up providing more power-savings than the previous one. In general, the greater the power saving, the longer the computer takes to return to its normal power state. For example, a power-saving mode that causes the processor to run slowly but does nothing else saves only a little power, and to return to full processor speed will be almost instantaneous. On the other hand, returning to normal operation from a "hibernation mode", in which the computer is effectively powered off by the power management system (and its entire state is saved to disk), will probably take several seconds.

Power management is only available on computers that have the hardware and BIOS to support it. The operating system on a power-saving computer has a power management layer which polls the BIOS regularly to see if it is requesting any change in the power status of the PC. It will do this, for example, if there is a loss of battery or mains power, or if the user presses a power-saving key or keys on the keyboard, or indeed if the user folds down the lid of the PC. However, before the opearting system decides to enter a particular power-saving mode, it also takes into account any information it has about the use currently being made of the system, and about any power-saving options the PC's user has selected.

## Madge drivers and Advanced Power Management

Under DOS and OS/2, Madge drivers register with the operating system's power management layer, and this layer signals its power management decisions to the drivers. These signals correspond closely to the requests from the BIOS for power status changes.

If the operating system layer polls the BIOS and finds a "suspend request" pending, it will enter one of the modes of power management that give major power savings. A Madge driver in the PC will interpret this as a major power management event, and will normally close down any adapters it is using. However, if the operating system layer polls the BIOS and finds a "standby request" pending, the operating system will enter one of the power saving modes that gives only minor power savings, and the driver will interpret this as a minor power management event, and ignore it.

To enable a Madge driver to close down Ringnodes in response to a major power management event the driver's APM (Advanced Power Management) parameter needs to be enabled. The driver will then also be able to start the Ringnodes up again as soon as power is restored. (However, the driver's ability to bring the Ringnodes up again depends on the network protocols being able to resume activity after a period of shutdown.)

## Technical details

### DOS/Windows

The DOS power management layer is called POWER.EXE. It polls the BIOS for power management requests every two seconds or so, and it monitors activity levels in the PC by patching a lot of interrupts. When it decides to enter a power-saving mode, it sends a message via INT 2Fh to any program (including device drivers) that monitors INT 2Fh. Drivers cannot prevent the operating system from entering a power-saving mode.

Microsft's POWER.DRV DLL and VPOWERD.386 VxD provide additional support for power management under Windows 3.x.

### OS/2

The OS/2 power management layer is called APM.SYS. It does not load unless the PC contains BIOS support for power management. APM.SYS provides both an IDC and an IOCtl interface. Madge drivers use the IDC interface to register with APM.SYS. Under OS/2 drivers can prevent the operating system from entering a power-saving mode. However, Madge drivers make no attempt to do so.

### Windows 95/Windows NT

Under Windows 95 and NT, drivers are not power-management-aware. When a PC enters a power-saving mode, the operating system asks the driver to shut itself down, and when power is restored the system loads the driver again.

### UNIX

Different implementations of Unix vary widely in their power management strategies.

### Card Services v5.00

Card Services version 5.00 is the first version to handle management events. It monitors the operating system's power management layer, and when the system enters a power-saving mode, Card Services tells the driver that the adapter has been removed. When power is restored, it tells the driver that the adapter has been re-inserted. The driver handles these events exactly as it would handle real hot-swapping of an adapter (the removal and insertion of an adapter while its driver remains loaded).

Newer drivers for PCMCIA computers are power-management aware. These drivers communicate directly with the operating system's power management layer, and simply ignore communications about power management from Card Services version 5.00.

## Problems with laptops

Some portable computers with PCMCIA slots automatically power off PCMCIA adapters when the PC's lid is closed (or under certain other conditions). This has the same effect on the driver as the PCMCIA adapters being removed from the computer. For the drivers to handle this they need to be configured to support hot-swapping. They can then restart the adapters once the lid is re-opened and power restored.