ACPICA is an open-source project that provides an operating system (OS)-independent reference implementation. It also contains a list of utilities such as ASL compiler (iasl), acpiexec (an AML emulator). However, AML debugging on Linux in run-time wasn’t provided in ACPICA until Linux Kernel 4.13.
The aml-debugger.txt is the instruction for enabling AML run-time debugger. This document is available at Documentation/acpi/ in Linux kernel source code. In short, two things are required for AML run-time debugging
While compiling a custom-build kernel is nothing new to kernel developers, it is often inconvenient for system firmware / BIOS developers. Fortunately, Ubuntu 18.04 (x64) and later enable these config by default. One can simply execute acpidbg on Ubuntu 18.04 – even on Ubuntu Live from USB too!
Executing acpidbg on Ubuntu 18.04 (x64) is straight-forward
$ sudo ./acpidbg -
and “help” shows a list supported commands
- help General-Purpose Commands: ... ... Namespace Access Commands: ... ... Control Method Execution Commands: ... ...
acpidbg is particularly handy when one needs to evaluate any ACPI AML objects during run-time – especially ones that change under different conditions. This may be explained by some examples below:
Example 1 – To determine AC power status in run-time.
- find _PSR \_SB.PCI0.LPC.EC.AC._PSR Method 00000000c53d0a47 01 Args 0 Len 0023 Aml 00000000eab88cb2 - execute \_SB.PCI0.LPC.EC.AC._PSR Evaluating \_SB.PCI0.LPC.EC.AC._PSR Evaluation of \_SB.PCI0.LPC.EC.AC._PSR returned object 00000000c46fa555, external buffer length 18 [Integer] = 0000000000000000 - execute \_SB.PCI0.LPC.EC.AC._PSR Evaluating \_SB.PCI0.LPC.EC.AC._PSR Evaluation of \_SB.PCI0.LPC.EC.AC._PSR returned object 00000000c46fa555, external buffer length 18 [Integer] = 0000000000000001
acpidbg also works with complex objects such as packages.
Example 2 – To determine battery information and status
- find _BIF \_SB.PCI0.LPC.EC.BAT0._BIF Method 00000000817541c3 01 Args 0 Len 0040 Aml 000000009abb252e - execute \_SB.PCI0.LPC.EC.BAT0._BIF Evaluating \_SB.PCI0.LPC.EC.BAT0._BIF Evaluation of \_SB.PCI0.LPC.EC.BAT0._BIF returned object 00000000c46fa555, external buffer length 170 [Package] Contains 13 Elements: [Integer] = 0000000000000000 [Integer] = 000000000000ABE0 [Integer] = 0000000000009E34 [Integer] = 0000000000000001 [Integer] = 0000000000003B60 [Integer] = 00000000000007E9 [Integer] = 00000000000000C8 [Integer] = 0000000000000001 [Integer] = 0000000000000001 [String] Length 07 = "00HW027" [String] Length 05 = " 409" [String] Length 03 = "LiP" [String] Length 03 = "SMP" - find _BST \_SB.PCI0.LPC.EC.BAT0._BST Method 00000000ed98c5ba 01 Args 0 Len 001D Aml 00000000a48eaeb6 - execute \_SB.PCI0.LPC.EC.BAT0._BST Evaluating \_SB.PCI0.LPC.EC.BAT0._BST Evaluation of \_SB.PCI0.LPC.EC.BAT0._BST returned object 00000000c46fa555, external buffer length 78 [Package] Contains 4 Elements: [Integer] = 0000000000000001 [Integer] = 00000000000010C6 [Integer] = 00000000000088B8 [Integer] = 0000000000003FC9
acpidbg can decode bit fields and save time on counting bits. Try to run acpidbg to evaluate any _PLD objects and you will see what I mean :).
Learn how the Ubuntu desktop operating system powers millions of PCs and laptops around the world.
Using acpidbg on Ubuntu 18.04 x64 can be quite handy; however, the Linux kernel with ACPI_DEBUGGER is not always available, such as on Ubuntu for ARM. In such cases, acpica also provides a set of utilities, named acpica-tools, for ACPI…
“All my centurions develop using snaps.” Julius Caesar By and large, software development can be an enjoyable process. Until you hit the first error, that is. At that point, you want to get past the stumbling blocks as quickly as possible…
Ubuntu 14.04 LTS – As 14.04 reaches the end of its five-year LTS window in April 2019, Ubuntu 14.04 LTS ‘Trusty Tahr’ transitions to Extended Security Maintenance (ESM). ESM is a feature available through Ubuntu Advantage,…