OperationRegion Deep Dive

How ACPI OperationRegion connects AML methods to EC RAM, system memory, I/O ports, PCI config, GPIO, and other hardware-backed address spaces.

3 min read
Đọc bằng English Tiếng Việt 日本語
ACPI Advanced cover

An AML method reads a field:

If (LEqual (LIDS, One)) {
    Notify (LID0, 0x80)
}

Where did LIDS come from?

It may not be a normal variable. It may be a bit mapped to EC RAM, GPIO, system memory, PCI config space, or an I/O port.

That bridge is OperationRegion.

01 AML

Method reads or writes a named field

Example: `_BST` reads battery state fields, or `_Qxx` reads EC query information.

02 Field

Field maps names to bits/bytes

A named field such as `BSTA` may map to one byte inside an operation region.

03 Region

OperationRegion defines address space

The region can be EmbeddedControl, SystemMemory, SystemIO, PCI_Config, GPIO, or another ACPI address space.

04 Hardware

OS ACPI interpreter performs access

The interpreter invokes the appropriate region handler to read or write actual hardware-backed state.

OperationRegion as the bridge between AML and hardware state

Example: EC-backed region

OperationRegion (ERAM, EmbeddedControl, 0x00, 0xFF)
Field (ERAM, ByteAcc, NoLock, Preserve)
{
    Offset (0x10),
    BSTA, 8,
    Offset (0x20),
    LIDS, 1
}

BSTA and LIDS look like normal ACPI names, but reading them can trigger an EC transaction.

Why this matters

OperationRegion is where ACPI stops being only a description language and starts touching platform state.

Item Value Note
EmbeddedControl EC RAM / EC command interface Common for battery, thermal, lid, hotkey, and platform events.
SystemMemory Physical memory mapped region Used for shared memory or firmware-reserved structures.
SystemIO I/O port space Used for legacy PM registers or chipset interfaces.
PCI_Config PCI configuration space Used to read or write PCI config registers through AML.
GeneralPurposeIo GPIO region Used for GPIO-backed ACPI fields on newer platforms.

Debug Diary: EC timeout caused by innocent AML

Symptom:

ACPI Error: AE_TIME, Returned by Handler for [EmbeddedControl]
Battery status sometimes missing
Fan table looks correct

The ASL may look harmless:

Method (_BST, 0, Serialized)
{
    Return (Package() { BSTA, BRTE, BCAP, BVOL })
}

But every field access can require EC communication. If the EC is busy, locked, or not responding after resume, the AML method fails.

OperationRegion debug checklist

Found this useful?

Save it or share it with someone learning firmware, BIOS/UEFI, and embedded systems.

Nội dung liên quan

Một số bài viết, ghi chú hoặc project có liên quan đến nội dung bạn vừa đọc.

Biến note thành bài viết hoàn chỉnh

Notes là nơi ghi nhanh khái niệm.