^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) .. include:: <isonum.txt>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) The AML Debugger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) :Copyright: |copy| 2016, Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) :Author: Lv Zheng <lv.zheng@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) This document describes the usage of the AML debugger embedded in the Linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 1. Build the debugger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) =====================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) The following kernel configuration items are required to enable the AML
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) debugger interface from the Linux kernel::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) CONFIG_ACPI_DEBUGGER=y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) CONFIG_ACPI_DEBUGGER_USER=m
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) The userspace utilities can be built from the kernel source tree using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) the following commands::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) $ cd tools
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) $ make acpi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) The resultant userspace tool binary is then located at::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) tools/power/acpi/acpidbg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) It can be installed to system directories by running "make install" (as a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) sufficiently privileged user).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 2. Start the userspace debugger interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) =========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) After booting the kernel with the debugger built-in, the debugger can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) started by using the following commands::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) # mount -t debugfs none /sys/kernel/debug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) # modprobe acpi_dbg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) # tools/power/acpi/acpidbg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) That spawns the interactive AML debugger environment where you can execute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) debugger commands.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) The commands are documented in the "ACPICA Overview and Programmer Reference"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) that can be downloaded from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) https://acpica.org/documentation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) The detailed debugger commands reference is located in Chapter 12 "ACPICA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) Debugger Reference". The "help" command can be used for a quick reference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 3. Stop the userspace debugger interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) ========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) The interactive debugger interface can be closed by pressing Ctrl+C or using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) the "quit" or "exit" commands. When finished, unload the module with::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) # rmmod acpi_dbg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) The module unloading may fail if there is an acpidbg instance running.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 4. Run the debugger in a script
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) ===============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) It may be useful to run the AML debugger in a test script. "acpidbg" supports
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) this in a special "batch" mode. For example, the following command outputs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) the entire ACPI namespace::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) # acpidbg -b "namespace"