GPIO OperationRegion

How ACPI models GPIO-backed platform state and why GPIO numbering, polarity, wake flags, and controller paths are common firmware bugs.

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

Modern platforms use GPIOs for far more than simple high/low outputs.

A single GPIO can represent:

  • lid state
  • tablet mode
  • camera privacy switch
  • touchpad interrupt
  • device reset line
  • power enable line
  • wake source

ACPI can expose GPIOs through _CRS descriptors and through GPIO OperationRegions.

GPIO in _CRS vs GPIO OperationRegion

Item Value Note
GpioInt in _CRS Interrupt resource Tells the OS driver which GPIO interrupt belongs to the device.
GpioIo in _CRS GPIO I/O resource Can describe reset or enable pins consumed by the driver.
GeneralPurposeIo OperationRegion AML-accessible GPIO field Lets AML read or write GPIO-backed state.
Wake flags ExclusiveAndWake / SharedAndWake Important for sleep and wake behavior.

Real World Example: camera privacy switch

A camera privacy switch may be wired to a GPIO. The OS may need to know the state, while firmware may also send notifications when it changes.

OperationRegion (GPRG, GeneralPurposeIo, Zero, One)
Field (GPRG, ByteAcc, NoLock, Preserve)
{
    CPSW, 1
}

Method (GCPS, 0, NotSerialized)
{
    Return (CPSW)
}

If GPIO polarity is wrong, the OS reports privacy on when it is off.

Debug Diary: wake instantly after sleep

Symptom:

System enters S3
Immediately wakes again
Wake source points to GPIO controller

The issue may be:

  • wrong active level
  • wake GPIO not masked before sleep
  • stale event status not cleared
  • _PRW references the wrong GPE
  • _CRS marks a GPIO as wake-capable when it should not

GPIO ACPI 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.