ACPI(4)

straight outta the Kernel Interfaces Manual, section 4, no cap πŸ’…

🌸 NAME 🌸

acpi β€” Advanced Configuration and Power Management support


✨ SYNOPSIS ✨

device acpi

options ACPI_DEBUG
options DDB

πŸ’– DESCRIPTION πŸ’–

okay so bestie, the acpi driver is literally the whole vibe behind the Intel/Microsoft/Compaq/Toshiba ACPI standard. it's giving main character energy for your whole machine, fr fr.

what does it actually do? two big things and then some:

  • platform hardware discovery β€” and yes, it supersedes the PnP and PCI BIOS era of doing that πŸ™ˆ
  • power management β€” and it supersedes APM, iconic behavior honestly
  • plus other features, because it contains multitudes ✨

the ACPI core support itself? that's provided by the ACPI CA reference implementation from Intel. king behavior πŸ‘‘

heads up bestie: the acpi driver is automatically loaded by the loader(8), so you should only compile it into the kernel on platforms where ACPI is mandatory. don't be out here compiling it in for fun, that's not the move 🫢

πŸŽ€ SYSCTL VARIABLES πŸŽ€

so the whole point of the acpi driver is to give you power management without user intervention β€” it just handles it, no notes πŸ’…. but if the default settings aren't optimal for your setup, these sysctls let you modify or monitor acpi behavior.

important: some of these variables will only show up if your hardware actually supports them (like hw.acpi.acline). if it's not there, your hardware just said "no" 😭

  • debug.acpi.enable_debug_objects β€” lets you dump Debug objects without having options ACPI_DEBUG compiled in. Default is 0, which means ignore Debug objects.
  • dev.cpu.N.cx_usage β€” debugging info that lists the percent of total usage for each sleep state. the values get reset whenever dev.cpu.N.cx_lowest is modified, so don't be confused when they zero out πŸ™ˆ
  • dev.cpu.N.cx_lowest β€” the lowest Cx state to use for idling the CPU. a scheduling algorithm picks states between C1 and this setting as system load dictates. to enable ACPI CPU idling control, set machdep.idle to acpi β€” but only if it's listed in machdep.idle_available. check first bestie 🫢
  • hw.acpi.cpu.cx_supported β€” the list of supported CPU idle states plus their transition latency in microseconds. each state has a type (e.g., C2). the lore:
    • C1 is equivalent to the ia32 HLT instruction
    • C2 provides a deeper sleep with the same semantics
    • C3 provides the deepest sleep, but additionally requires bus mastering to be disabled
    • states greater than C3 provide even more power savings with the same semantics as the C3 state

and the tradeoff, because of course there's a tradeoff 😭: deeper sleeps give you more power savings but increased transition latency when an interrupt occurs.

  • dev.cpu.N.cx_method β€” the list of supported CPU idle states and their transition methods, as directed by the firmware.
  • hw.acpi.acline β€” the AC line state. 1 means online, 0 means on battery power. simple as πŸ“
  • hw.acpi.disable_on_reboot β€” disables ACPI during the reboot process. most systems reboot fine with ACPI still enabled, but some require exiting to legacy mode first. default is 0, leave ACPI enabled.
  • hw.acpi.handle_reboot β€” use the ACPI Reset Register capability to reboot the system. some newer systems require use of this register, while some only work with legacy rebooting support. hardware is messy, iykyk πŸ’€
  • hw.acpi.lid_switch_state β€” the suspend state (S1–S5) to enter when the lid switch (i.e., a notebook screen) is closed. default is "NONE" (do nothing).
  • hw.acpi.power_button_state β€” the suspend state (S1–S5) to enter when the power button is pressed. default is S5 (power-off nicely). polite πŸ’…
  • hw.acpi.reset_video β€” reset the video adapter from real mode during the resume path. some systems need this help, others have display problems if it's enabled. default is 0 (disabled).
  • hw.acpi.s4bios β€” indicates whether the system supports S4BIOS. that means the BIOS can handle all the functions of suspending the system to disk. otherwise, the OS is responsible for suspending to disk (S4OS). most current systems do not support S4BIOS. not the vibe for most of y'all πŸ™ˆ
  • hw.acpi.sleep_button_state β€” the suspend state (S1–S5) to enter when the sleep button is pressed. this is usually a special function button on the keyboard. default is S3 (suspend-to-RAM).
  • hw.acpi.sleep_delay β€” wait this number of seconds between preparing the system to suspend and actually entering the suspend state. default is 1 second.
  • hw.acpi.supported_sleep_state β€” the suspend states (S1–S5) supported by the BIOS. here's the full breakdown, get comfy:
    • S1 β€” quick suspend to RAM. the CPU enters a lower power state, but most peripherals are left running.
    • S2 β€” lower power state than S1, but with the same basic characteristics. not supported by many systems.
    • S3 β€” suspend to RAM. most devices are powered off, and the system stops running except for memory refresh.
    • S4 β€” suspend to disk. all devices are powered off, and the system stops running. when resuming, the system starts as if from a cold power on. not yet supported by FreeBSD unless S4BIOS is available.
    • S5 β€” system shuts down cleanly and powers off. the classic goodbye 🫑
  • hw.acpi.verbose β€” enable verbose printing from the various ACPI subsystems. chatty mode, activated ✨

🌈 LOADER TUNABLES 🌈

you can set these tunables at the loader(8) prompt before booting the kernel, or store them in /boot/loader.conf. and the bestie bonus: many of these also have a matching sysctl(8) entry so you can poke at them after boot too πŸ’…


  • acpi_dsdt_load β€” enables loading of a custom ACPI DSDT.
  • acpi_dsdt_name β€” the name of the DSDT table to load, if loading is enabled.
  • debug.acpi.cpu_unordered β€” do not use the MADT to match ACPI Processor objects to CPUs. this is needed on a few systems with a buggy BIOS that does not use consistent processor IDs. default is 0 (disabled).
  • debug.acpi.disabled β€” selectively disables portions of ACPI for debugging purposes.
  • debug.acpi.interpreter_slack β€” enable less strict ACPI implementations. default is 1, ignore common BIOS mistakes. generous of us honestly 🫢
  • debug.acpi.max_threads β€” specify the number of task threads that are started on boot. limiting this to 1 may help work around various BIOSes that cannot handle parallel requests. the default value is 3.
  • debug.acpi.quirks β€” override any automatic quirks completely.
  • debug.acpi.resume_beep β€” beep the PC speaker on resume. this can help diagnose suspend/resume problems. default is 0 (disabled).
  • hint.acpi.0.disabled β€” set this to 1 to disable all of ACPI. and if ACPI has been disabled on your system due to a blacklist entry for your BIOS, you can set this to 0 to re-enable ACPI for testing. sneaky little workaround, we love it 😌
  • hw.acpi.ec.poll_timeout β€” delay in milliseconds to wait for the EC to respond. try increasing this number if you get the error "AE_NO_HARDWARE_RESPONSE".
  • hw.acpi.host_mem_start β€” override the assumed memory starting address for PCI host bridges.
  • hw.acpi.install_interface, hw.acpi.remove_interface β€” install or remove OS interface(s) to control the return value of the β€˜_OSI’ query method. when an OS interface is specified in hw.acpi.install_interface, the _OSI query for that interface returns that it is supported. conversely, when an OS interface is specified in hw.acpi.remove_interface, the _OSI query returns that it is not supported. multiple interfaces can be specified in a comma-separated list, and any leading white spaces will be ignored. for example, "FreeBSD, Linux" is a valid list of two interfaces "FreeBSD" and "Linux". slay πŸ’…
  • hw.acpi.reset_video β€” enables calling the VESA reset BIOS vector on the resume path. this can fix some graphics cards that have problems such as LCD white-out after resume. default is 0 (disabled).
  • hw.acpi.serialize_methods β€” allow override of whether methods execute in parallel or not. enable this for serial behavior, which fixes "AE_ALREADY_EXISTS" errors for AML that really cannot handle parallel method execution. it is off by default since this breaks recursive methods and some IBMs use such code. yeah, that's a real warning, don't just flip it on 😭
  • hw.acpi.verbose β€” turn on verbose debugging information about what ACPI is doing.
  • hw.pci.link.%s.%d.irq β€” override the interrupt to use for this link and index. this capability should be used carefully, and only if a device is not working with acpi enabled. "%s" is the name of the link (e.g., LNKA). "%d" is the resource index when the link supports multiple IRQs. most PCI links only have one IRQ resource, so the below form should be used.
  • hw.pci.link.%s.irq β€” override the interrupt to use. this capability should be used carefully, and only if a device is not working with acpi enabled. "%s" is the name of the link (e.g., LNKA).

🚫 DISABLING ACPI 🚫

Okay bestie, real talk: ACPI support is wildly different from platform to platform, so of course there are a ton of debugging and tuning options available. Not me being surprised, it's giving "of course she has options" πŸ’…

For machines that are known to just not work with acpi enabled, there's a BIOS blacklist. Currently, the blacklist only controls whether acpi should be disabled or not. In the future, it's gonna have more granularity to control features (the infrastructure for that is already there, she's just waiting for her moment ✨).

To enable acpi (for debugging purposes, etc.) on machines that are on the blacklist, set the kernel environment variable hint.acpi.0.disabled to 0. But before you try this, consider updating your BIOS to a more recent version that may be compatible with ACPI. Fr fr, try that first πŸ™

To disable the acpi driver completely, set the kernel environment variable hint.acpi.0.disabled to 1.

Some i386 machines totally fail to operate with some or all of ACPI disabled. Other i386 machines fail with ACPI enabled. And disabling all or part of ACPI on non-i386 platforms (i.e., platforms where ACPI support is mandatory) may result in a non-functional system. Not me warning you, this is serious 😭

The acpi driver comprises a set of drivers, which may be selectively disabled in case of problems. To disable a sub-driver, list it in the kernel environment variable debug.acpi.disabled. Multiple entries can be listed, separated by a space.

ACPI sub-devices and features that can be disabled:

  • all β€” Disable all ACPI features and devices.
  • acad β€” (device) Supports AC adapter.
  • bus β€” (feature) Probes and attaches subdevices. Disabling will avoid scanning the ACPI namespace entirely.
  • children β€” (feature) Attaches standard ACPI sub-drivers and devices enumerated in the ACPI namespace. Disabling this has a similar effect to disabling β€œbus”, except that the ACPI namespace will still be scanned.
  • button β€” (device) Supports ACPI button devices (typically power and sleep buttons).
  • cmbat β€” (device) Control-method batteries device.
  • cpu β€” (device) Supports CPU power-saving and speed-setting functions.
  • ec β€” (device) Supports the ACPI Embedded Controller interface, used to communicate with embedded platform controllers.
  • isa β€” (device) Supports an ISA bus bridge defined in the ACPI namespace, typically as a child of a PCI bus.
  • lid β€” (device) Supports an ACPI laptop lid switch, which typically puts a system to sleep.
  • mwait β€” (feature) Do not ask firmware for available x86-vendor specific methods to enter Cx sleep states. Only query and use the generic I/O-based entrance method. The knob is provided to work around inconsistencies in the tables filled by firmware.
  • quirks β€” (feature) Do not honor quirks. Quirks automatically disable ACPI functionality based on the XSDT table's OEM vendor name and revision date.
  • pci β€” (device) Supports Host to PCI bridges.
  • pci_link β€” (feature) Performs PCI interrupt routing.
  • sysresource β€” (device) Pseudo-devices containing resources which ACPI claims.
  • thermal β€” (device) Supports system cooling and heat management.
  • timer β€” (device) Implements a timecounter using the ACPI fixed-frequency timer.
  • video β€” (device) Supports acpi_video(4) which may conflict with agp(4) device.

It is also possible to avoid portions of the ACPI namespace which may be causing problems, by listing the full path of the root of the region to be avoided in the kernel environment variable debug.acpi.avoid. The object and all of its children will be ignored during the bus/children scan of the namespace. The ACPI CA code will still know about the avoided region. So like, it's ghosted by the bus but still exists in the group chat πŸ’€


πŸ› DEBUGGING OUTPUT πŸ›

To enable debugging output, acpi must be compiled with options ACPI_DEBUG. Debugging output is separated between layers and levels, where a layer is a component of the ACPI subsystem, and a level is a particular kind of debugging output. Two axes, both iconic πŸ‘‘

Both layers and levels are specified as a whitespace-separated list of tokens, with layers listed in debug.acpi.layer and levels in debug.acpi.level.

The first set of layers is for ACPI-CA components, and the second is for FreeBSD drivers. The ACPI-CA layer descriptions include the prefix for the files they refer to. The supported layers are:

  • ACPI_UTILITIES β€” Utility ("ut") functions
  • ACPI_HARDWARE β€” Hardware access ("hw")
  • ACPI_EVENTS β€” Event and GPE ("ev")
  • ACPI_TABLES β€” Table access ("tb")
  • ACPI_NAMESPACE β€” Namespace evaluation ("ns")
  • ACPI_PARSER β€” AML parser ("ps")
  • ACPI_DISPATCHER β€” Internal representation of interpreter state ("ds")
  • ACPI_EXECUTER β€” Execute AML methods ("ex")
  • ACPI_RESOURCES β€” Resource parsing ("rs")
  • ACPI_CA_DEBUGGER β€” Debugger implementation ("db", "dm")
  • ACPI_OS_SERVICES β€” Usermode support routines ("os")
  • ACPI_CA_DISASSEMBLER β€” Disassembler implementation (unused)
  • ACPI_ALL_COMPONENTS β€” All the above ACPI-CA components
  • ACPI_AC_ADAPTER β€” AC adapter driver
  • ACPI_BATTERY β€” Control-method battery driver
  • ACPI_BUS β€” ACPI, ISA, and PCI bus drivers
  • ACPI_BUTTON β€” Power and sleep button driver
  • ACPI_EC β€” Embedded controller driver
  • ACPI_FAN β€” Fan driver
  • ACPI_OEM β€” Platform-specific driver for hotkeys, LED, etc.
  • ACPI_POWER β€” Power resource driver
  • ACPI_PROCESSOR β€” CPU driver
  • ACPI_THERMAL β€” Thermal zone driver
  • ACPI_TIMER β€” Timer driver
  • ACPI_ALL_DRIVERS β€” All the above FreeBSD ACPI drivers

The supported levels are:

  • ACPI_LV_INIT β€” Initialization progress
  • ACPI_LV_DEBUG_OBJECT β€” Stores to objects
  • ACPI_LV_INFO β€” General information and progress
  • ACPI_LV_REPAIR β€” Repair a common problem with predefined methods
  • ACPI_LV_ALL_EXCEPTIONS β€” All the previous levels
  • ACPI_LV_PARSE
  • ACPI_LV_DISPATCH
  • ACPI_LV_EXEC
  • ACPI_LV_NAMES
  • ACPI_LV_OPREGION
  • ACPI_LV_BFIELD
  • ACPI_LV_TABLES
  • ACPI_LV_VALUES
  • ACPI_LV_OBJECTS
  • ACPI_LV_RESOURCES
  • ACPI_LV_USER_REQUESTS
  • ACPI_LV_PACKAGE
  • ACPI_LV_VERBOSITY1 β€” All the previous levels
  • ACPI_LV_ALLOCATIONS
  • ACPI_LV_FUNCTIONS
  • ACPI_LV_OPTIMIZATIONS
  • ACPI_LV_VERBOSITY2 β€” All the previous levels
  • ACPI_LV_ALL β€” Synonym for "ACPI_LV_VERBOSITY2"
  • ACPI_LV_MUTEX
  • ACPI_LV_THREADS
  • ACPI_LV_IO
  • ACPI_LV_INTERRUPTS
  • ACPI_LV_VERBOSITY3 β€” All the previous levels
  • ACPI_LV_AML_DISASSEMBLE
  • ACPI_LV_VERBOSE_INFO
  • ACPI_LV_FULL_TABLES
  • ACPI_LV_EVENTS
  • ACPI_LV_VERBOSE β€” All levels after "ACPI_LV_VERBOSITY3"
  • ACPI_LV_INIT_NAMES
  • ACPI_LV_LOAD

Selection of the appropriate layer and level values is important to avoid massive amounts of debugging output. Like bestie, you will be flooded. For example, the following configuration is a good way to gather initial information. It enables debug output for both ACPI-CA and the acpi driver, printing basic information about errors, warnings, and progress.

debug.acpi.layer="ACPI_ALL_COMPONENTS ACPI_ALL_DRIVERS"
debug.acpi.level="ACPI_LV_ALL_EXCEPTIONS"

Debugging output by the ACPI CA subsystem is prefixed with the module name in lowercase, followed by a source line number. Output from the FreeBSD-local code follows the same format, but the module name is uppercased. lowercase = CA subsystem, UPPERCASE = FreeBSD local, that's the tell 😌


🌈 OVERRIDING YOUR BIOS BYTECODE 🌈

ACPI interprets bytecode named AML (ACPI Machine Language) provided by the BIOS vendor as a memory image at boot time. Sometimes, the AML code contains a bug that does not appear when parsed by the Microsoft implementation. FreeBSD provides a way to override it with your own AML code to work around or debug such problems. Note that all AML in your DSDT and any SSDT tables is overridden.

In order to load your AML code, you must edit /boot/loader.conf and include the following lines.

acpi_dsdt_load="YES"
acpi_dsdt_name="/boot/acpi_dsdt.aml" # You may change this name.

In order to prepare your AML code, you will need the acpidump(8) and iasl(8) utilities and some ACPI knowledge. Skill issue check: if you don't have the knowledge, go get it first πŸŽ€


🫢 COMPATIBILITY 🫢

ACPI is only found and supported on i386/ia32 and amd64. That's the whole list, she's exclusive πŸ’…


πŸ‘€ SEE ALSO πŸ‘€

kenv(1), acpi_thermal(4), device.hints(5), loader.conf(5), acpiconf(8), acpidump(8), config(8), iasl(8)

Compaq Computer Corporation, Intel Corporation, Microsoft Corporation, Phoenix Technologies Ltd., and Toshiba Corporation, Advanced Configuration and Power Interface Specification, http://acpi.info/spec.htm, August 25, 2003.


πŸ‘‘ AUTHORS πŸ‘‘

The ACPI CA subsystem is developed and maintained by Intel Architecture Labs.

The following people made notable contributions to the ACPI subsystem in FreeBSD: Michael Smith, Takanori Watanabe <takawata@jp.FreeBSD.org>, Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>, Munehiro Matsuda, Nate Lawson, the ACPI-jp mailing list at ⟨acpi-jp@jp.FreeBSD.org⟩, and many other contributors. Legends, every single one 🌟

This manual page was written by Michael Smith <msmith@FreeBSD.org>.


πŸ’€ BUGS πŸ’€

Many BIOS versions have serious bugs that may cause system instability, break suspend/resume, or prevent devices from operating properly due to IRQ routing problems. Upgrade your BIOS to the latest version available from the vendor before deciding it is a problem with acpi. Not me blaming the BIOS but like… it's the BIOS 🫠


And that's the whole page bestie, we ate and left no crumbs ✨ This one came from the Debian folks, dated May 9, 2015 β€” vintage but still serving, mwah πŸ’–

πŸ“¦ where this page comes from