18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci.. include:: <isonum.txt>
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci================
58c2ecf20Sopenharmony_ciThe AML Debugger
68c2ecf20Sopenharmony_ci================
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci:Copyright: |copy| 2016, Intel Corporation
98c2ecf20Sopenharmony_ci:Author: Lv Zheng <lv.zheng@intel.com>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciThis document describes the usage of the AML debugger embedded in the Linux
138c2ecf20Sopenharmony_cikernel.
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci1. Build the debugger
168c2ecf20Sopenharmony_ci=====================
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciThe following kernel configuration items are required to enable the AML
198c2ecf20Sopenharmony_cidebugger interface from the Linux kernel::
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci   CONFIG_ACPI_DEBUGGER=y
228c2ecf20Sopenharmony_ci   CONFIG_ACPI_DEBUGGER_USER=m
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ciThe userspace utilities can be built from the kernel source tree using
258c2ecf20Sopenharmony_cithe following commands::
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci   $ cd tools
288c2ecf20Sopenharmony_ci   $ make acpi
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciThe resultant userspace tool binary is then located at::
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci   tools/power/acpi/acpidbg
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciIt can be installed to system directories by running "make install" (as a
358c2ecf20Sopenharmony_cisufficiently privileged user).
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci2. Start the userspace debugger interface
388c2ecf20Sopenharmony_ci=========================================
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ciAfter booting the kernel with the debugger built-in, the debugger can be
418c2ecf20Sopenharmony_cistarted by using the following commands::
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci   # mount -t debugfs none /sys/kernel/debug
448c2ecf20Sopenharmony_ci   # modprobe acpi_dbg
458c2ecf20Sopenharmony_ci   # tools/power/acpi/acpidbg
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciThat spawns the interactive AML debugger environment where you can execute
488c2ecf20Sopenharmony_cidebugger commands.
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciThe commands are documented in the "ACPICA Overview and Programmer Reference"
518c2ecf20Sopenharmony_cithat can be downloaded from
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_cihttps://acpica.org/documentation
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ciThe detailed debugger commands reference is located in Chapter 12 "ACPICA
568c2ecf20Sopenharmony_ciDebugger Reference".  The "help" command can be used for a quick reference.
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci3. Stop the userspace debugger interface
598c2ecf20Sopenharmony_ci========================================
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciThe interactive debugger interface can be closed by pressing Ctrl+C or using
628c2ecf20Sopenharmony_cithe "quit" or "exit" commands.  When finished, unload the module with::
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci   # rmmod acpi_dbg
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ciThe module unloading may fail if there is an acpidbg instance running.
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci4. Run the debugger in a script
698c2ecf20Sopenharmony_ci===============================
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ciIt may be useful to run the AML debugger in a test script. "acpidbg" supports
728c2ecf20Sopenharmony_cithis in a special "batch" mode.  For example, the following command outputs
738c2ecf20Sopenharmony_cithe entire ACPI namespace::
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci   # acpidbg -b "namespace"
76