Introduce the APM BIOS Interface Presented by Hants
Introduce the APM BIOS Interface Presented by Hants Zhang Approved by JR Jen & W. L Sung 2004/03/02 Rev. 1. 0 11/1/2020 1
Agenda § § § § 1. APM Introduction 2. APM Model 3. APM Software Layer 4. APM Software Interface 5. Firmware Error Codes 6. Summaries 7. Q&A 11/1/2020 2
1. APM Introduction § § § 1. 1 APM Overview 1. 2 APM System 1. 3 Terms 11/1/2020 3
1. 1 APM Overview § What is APM? APM( advanced power management) is defined by Intel and Microsoft Corp in 1992. The latest version is 1. 2. § Function of APM: Control the device power sate through BIOS. § APM VS ACPI: In ACPI environment OS control all device’s power state and the BIOS provide system information only. 11/1/2020 4
1. 2 APM System 11/1/2020 5
1. 2 APM System § APM BIOS is the software interface to the motherboard and its power managed devices. § APM driver module connects to the APM BIOS and communicate with the APM-aware application. § APM-aware Device Driver modules provides the software interface for add-in devices. § APM-aware Applications interface with the APM driver to monitor and control power 11/1/2020 6 management
1. 3 Terms § Add-in Device is not on the motherboard. § APM Connection is a protocol and mechanism by which an APM Driver and an APM BIOS intercommunicate. § CPU CORE includes the CPU clock, cache, system bus, and system timers. § Resume timer is a system timer used to wake up the system from a low power state at a specified time. § System Idle is a inactive state. 11/1/2020 7
2. APM Model § § 2. 1 System Power State 2. 2 Device Control 2. 3 CPU Control 2. 4 System Power State Transition 11/1/2020 8
2. 1 System Power States § § § 2. 1. 1 Full On State 2. 1. 2 APM Enable State 2. 1. 3 APM Standby 2. 1. 4 APM Suspend 2. 1. 5 Off State 11/1/2020 9
2. 1. 1 Full On State § § The Full On State is the default mode. System is on working. System is not power managed. All device are on. 11/1/2020 10
2. 1. 2 APM Enable State § In the APM Enable State the system is doing work but some unused devices may not be powered. § The CPU clock is slowed or stopped and devices are power managed as needed. 11/1/2020 11
2. 1. 3 APM Standby § The system enters the APM Standby State after a short period inactivity. § The system is in a low power state with some power savings. § Most device are in a low power mode. § The CPU clock is slowed or stopped. § System returns quickly to the APM Enable State. § Interrupts must still be processed normally. 11/1/2020 12
2. 1. 4 APM Suspend § The system enter the APM Suspend State after a relatively long period of inactivity. § System takes a relative long time to return to the APM Enable State. § System is not working and in a low power state with maximum power savings § Most power managed device are not powered § The CPU clock is stopped and the CPU core is in its minimum power state. 11/1/2020 13
2. 1. 5 Off State § § In this State the system is not working. The power supply is off. Operational parameters are not saved. System resets and initializes when the transitioning to the Full On State. 11/1/2020 14
2. 2 Device Control § § § 2. 2. 1 Device Control Overview 2. 2. 2 Device On Mode 2. 2. 3 Device Power Managed Mode 2. 2. 4 Device Power Low Mode 2. 2. 5 Device Off Mode 11/1/2020 15
2. 2. 1 Device Control Overview § Devices may be power-managed either by the system BIOS or by the OS. § Using the “Disable Device Power Management” function, the OS may tell the BIOS to stop power managing a particular device. § The device control has four modes: Device On, Device Power Managed, Device Low Power, and Device Off. 11/1/2020 16
2. 2. 2 Device On Mode § Device On Mode: In this mode device is fully powered and able to perform work, all device features are available. 11/1/2020 17
2. 2. 3 Device Power Managed Mode § Device Power Managed: In this mode Device is working, but some features may not be operational, or may be functioning at reduced performance levels. 11/1/2020 18
2. 2. 4 Device Low Power § Device Low Power: in this mode device is not working. Power is maintained and devices may have variable numbers of low power sub modes. 11/1/2020 19
2. 2. 5 Device Off Mode § Device Off: in this mode device is not working. Device is powered off. 11/1/2020 20
2. 3 CPU Core Control § 2. 3. 1 CPU Core Control Overview § 2. 3. 2 CPU Core Control Modes 11/1/2020 21
2. 3. 1 CPU Core Control Overview § The CPU core is typically the last device to power off and the first device to power on. § The CPU core includes the CPU clock, cache, system bus, and system timers. § The CPU core is controlled through APM BIOS. APM Driver may notify the APM BIOS about CPU usage but the APM BIOS determines the action to take. 11/1/2020 22
2. 3. 1 CPU Core Control Modes § The CPU core is required to perform system power state changes. § Slow Clock: Reduced speed operation, reduced power consumption, reduced performance level, interrupts restore to Full On Mode, restoration to Full On appears instantaneous. § Stop: Only a hardware interrupt starts the clock, restoration to Full On appears instantaneous. 11/1/2020 23
2. 4 System Power State Transitions § 2. 4. 1 State Transitions Overview § 2. 4. 2 System State Transition’s Operation 11/1/2020 24
2. 4. 1 State Transition Overview § Inactivity causes a gradual powering down of the system. § The system state changes are caused by the APM BIOS due to system activity level, interrupts, and external events or due to software requests. § APM BIOS and APM Driver cooperate to effect system state transitions. 11/1/2020 25
2. 4. 2 State Transition’s Operation 11/1/2020 26
3. APM Software Layer § § 3. 1 APM Software overview 3. 2 The BIOS Layer 3. 3 The Operating System Layer 3. 4 The Application Layer 11/1/2020 27
3. 1 APM Software Layer Overview 11/1/2020 28
3. 1 APM Software Layer Overview (Cont. ) § The APM Driver sends information to the APM BIOS via function calls. § The APM Driver uses polling function calls to the APM BIOS to gather information about power management events. § The APM Driver exchanges power management information with its APMaware applications. 11/1/2020 29
3. 2 APM BIOS Layer § The APM BIOS interfaces directly to the power managed system mother board hardware. § BIOS may provide some degree of power management functionality without any support from OS or application § The APM BIOS will connect with APM Driver to enhance the functionality. § It is supplied by the OEM and is specified to the hardware platform. 11/1/2020 30
3. 3 The OS Layer § The APM Driver has three primary power management functions as followings. 1) Passing calls and information between the application and APM BIOS layers. 2) Arbitrating application power management calls in a multitasking environment. 3) Identifying power saving opportunities not apparent at the application or BIOS layer. 11/1/2020 31
3. 4 The Application Layer § APM-aware applications assist in power management by providing information. § Different OS may provide varying levels of support for APM-aware applications and device drivers. 11/1/2020 32
4. APM Software Interface § § 4. 1 4. 2 4. 3 4. 4 11/1/2020 Power Management Events APM Function Overview APM Standard Functions Call OEM Defined Functions Call 33
4. 1 Power Management Events § 4. 1. 1 PM Events Overview § 4. 1. 2 PM Events Codes 11/1/2020 34
4. 1. 1 PM Events Overview § Power Management Events are communicated from the APM BIOS to the APM Driver. § The APM Driver polls to determine if a Power Management Event has occurred by issuing the Get PM Event call. § The APM BIOS provides notification of a Power Management Event only once. 11/1/2020 35
4. 1. 2 PM Events Codes § § § § § 0001 H 0002 H 0003 H 0004 H 0005 H 0006 H 0007 H 0008 H 0009 H 11/1/2020 System Standby Request Notification System Suspend Request Notification Normal Resume System Notification Critical Resume System Notification Battery Low Notification Power Status Change Notification Update Time Notification Critical System Suspend Notification User System Standby Request Notification 36
4. 1. 2 PM Events Codes (Cont. ) § 000 AH User System Suspend Request Notification. § 000 BH System Standby Resume Notification § 000 Ch- Capabilities Change Notification § 000 DH- 00 FFH Reserved System Events § 0100 H – 01 FFH Reserved Device Events § 0200 H - 02 FFH OEM Defined APM Events § 0300 H - FFFFH Reserved 11/1/2020 37
4. 2 APM Function Overview § § § 4. 2. 1 CPU Usage Functions 4. 2. 2 Power Device IDs 4. 2. 3 APM Functions 11/1/2020 38
4. 2. 1 CPU Usage Functions § APM BIOS defines CPU Idle and CPU Busy functions and these functions are used by the APM Driver to indicate CPU usage to the APM BIOS. § The CPU Idle function means that the APM Driver detected minimal processing at the application level. § The CPU Busy function means that the APM Driver detected that the application level is no longer operating with minimal processing. 11/1/2020 39
4. 2. 2 Power Device IDs § § § § The Power Device ID are saved into BX register. 00 h APM BIOS 01 h All devices power managed by the APM 01 xxh Display 02 xxh Secondary Storage 03 xxh Parallel Ports 04 xxh Serial Ports 05 xxh Network Adaptors 11/1/2020 40
4. 2. 2 Power Device IDs (Cont. ) § § § § 06 xxh PCMCIA sockets 07 xxh Reserved 80 xxh Batteries 81 xxh-dffh Reserved Exxxh OEM-defined Power Device IDs Fxxxh Reserved OEM defined Power Device IDs accommodate devices such as Coprocessors, Memory, Keyboard, Mice, other Handheld entry devices, PCMCIA cards, and clocks. 11/1/2020 41
4. 2. 3 APM Functions § APM Session Functions determines whether APM BIOS support exists. § APM Status and Control Functions query and/or control the power state of the system and /or devices. § PM Event Polling returns information about a power event. § OEM Defined Functions are reserved for OEM APM implementations including OEM Defined Function and OEM Installation check. 11/1/2020 42
4. 3 APM Standard Functions Call 4. 3. 1 APM Standard Functions Call Overview 4. 3. 2 APM Standard Functions Call sample. 11/1/2020 43
4. 3. 1 APM Standard Functions Call Overview § § § Set Power State(07 h). Get Power State(0 Ah). Get Capabilities(10 h). 11/1/2020 44
4. 3. 2 APM Standard Functions Call Sample § § § § Call “Set Power State” function INT 15 h AH = 53 H APM AL = 07 H (Set Power State) BX = Power device ID CX = Power state Returns: if function successful Carry = 0; if function failed Carry = 1, AH = Error Code 11/1/2020 45
4. 4 OEM Defined Functions Call § 4. 4. 1 OEM APM Installation Check(80 h) § 4. 4. 2 OEM APM Function(80 h) 11/1/2020 46
4. 4. 1 OEM APM Installation Check § This call checks to see if the APM BIOS supports OEM hardware-dependent functions. § INT 15 h § AH = 53 H APM § AL = 80 H OEM APM § BH = 7 FH Installation check § Returns : if functions successful Carry = 0, BX = OEM ID, or Carry = 1, AH = Error Code( OEM – Defined ). 11/1/2020 47
4. 4. 2 OEM APM Function(80 h) § This function accesses OEM productspecific APM functions. § AH = 53 H APM § AL = 80 H OEM APM § BH = 00 H-7 EH, 80 H-FFH OEM Defined § Returns : if functions successful Carry = 0, or Carry = 1, AH = Error Code( OEM – Defined ). 11/1/2020 48
5. Firmware Error Codes § 5. 1 Error Code Groupings § 5. 2 Some Important Error Code 11/1/2020 49
5. 1 Error Code Groupings § § § § Interface and general errors CPU Errors Device errors System errors PM Event Errors Reserved errors Undefined function 11/1/2020 00 h-1 Fh 20 h-3 Fh 40 h-5 Fh 60 h-7 Fh 80 h-9 Fh A 0 h-FEh FFh 50
5. 2 Some Important Error Code § 01 h Power Management functionality disabled. § 09 h Unrecognized Device ID. § 60 h Unable to enter requested state 11/1/2020 51
6. Summaries § APM BIOS Interface masks the details of hardware specific. This allow a developer without the knowledge of hardware to develop applications controlling the Power Management. § APM BIOS communicates with hardware and OS Driver to enhanced the Power Management effectiveness. § APM BIOS control the hardware power consumption 11/1/2020 52
7. Q&A § Thanks A Lot! 11/1/2020 53
- Slides: 53