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