1.. SPDX-License-Identifier: GPL-2.0
2
3=================
4ACPI Debug Output
5=================
6
7The ACPI CA, the Linux ACPI core, and some ACPI drivers can generate debug
8output.  This document describes how to use this facility.
9
10Compile-time configuration
11==========================
12
13ACPI debug output is globally enabled by CONFIG_ACPI_DEBUG.  If this config
14option is turned off, the debug messages are not even built into the
15kernel.
16
17Boot- and run-time configuration
18================================
19
20When CONFIG_ACPI_DEBUG=y, you can select the component and level of messages
21you're interested in.  At boot-time, use the acpi.debug_layer and
22acpi.debug_level kernel command line options.  After boot, you can use the
23debug_layer and debug_level files in /sys/module/acpi/parameters/ to control
24the debug messages.
25
26debug_layer (component)
27=======================
28
29The "debug_layer" is a mask that selects components of interest, e.g., a
30specific driver or part of the ACPI interpreter.  To build the debug_layer
31bitmask, look for the "#define _COMPONENT" in an ACPI source file.
32
33You can set the debug_layer mask at boot-time using the acpi.debug_layer
34command line argument, and you can change it after boot by writing values
35to /sys/module/acpi/parameters/debug_layer.
36
37The possible components are defined in include/acpi/acoutput.h and
38include/acpi/acpi_drivers.h.  Reading /sys/module/acpi/parameters/debug_layer
39shows the supported mask values, currently these::
40
41    ACPI_UTILITIES                  0x00000001
42    ACPI_HARDWARE                   0x00000002
43    ACPI_EVENTS                     0x00000004
44    ACPI_TABLES                     0x00000008
45    ACPI_NAMESPACE                  0x00000010
46    ACPI_PARSER                     0x00000020
47    ACPI_DISPATCHER                 0x00000040
48    ACPI_EXECUTER                   0x00000080
49    ACPI_RESOURCES                  0x00000100
50    ACPI_CA_DEBUGGER                0x00000200
51    ACPI_OS_SERVICES                0x00000400
52    ACPI_CA_DISASSEMBLER            0x00000800
53    ACPI_COMPILER                   0x00001000
54    ACPI_TOOLS                      0x00002000
55    ACPI_SBS_COMPONENT              0x00100000
56    ACPI_FAN_COMPONENT              0x00200000
57    ACPI_PCI_COMPONENT              0x00400000
58    ACPI_CONTAINER_COMPONENT        0x01000000
59    ACPI_SYSTEM_COMPONENT           0x02000000
60    ACPI_MEMORY_DEVICE_COMPONENT    0x08000000
61    ACPI_PROCESSOR_COMPONENT        0x20000000
62
63debug_level
64===========
65
66The "debug_level" is a mask that selects different types of messages, e.g.,
67those related to initialization, method execution, informational messages, etc.
68To build debug_level, look at the level specified in an ACPI_DEBUG_PRINT()
69statement.
70
71The ACPI interpreter uses several different levels, but the Linux
72ACPI core and ACPI drivers generally only use ACPI_LV_INFO.
73
74You can set the debug_level mask at boot-time using the acpi.debug_level
75command line argument, and you can change it after boot by writing values
76to /sys/module/acpi/parameters/debug_level.
77
78The possible levels are defined in include/acpi/acoutput.h.  Reading
79/sys/module/acpi/parameters/debug_level shows the supported mask values,
80currently these::
81
82    ACPI_LV_INIT                    0x00000001
83    ACPI_LV_DEBUG_OBJECT            0x00000002
84    ACPI_LV_INFO                    0x00000004
85    ACPI_LV_INIT_NAMES              0x00000020
86    ACPI_LV_PARSE                   0x00000040
87    ACPI_LV_LOAD                    0x00000080
88    ACPI_LV_DISPATCH                0x00000100
89    ACPI_LV_EXEC                    0x00000200
90    ACPI_LV_NAMES                   0x00000400
91    ACPI_LV_OPREGION                0x00000800
92    ACPI_LV_BFIELD                  0x00001000
93    ACPI_LV_TABLES                  0x00002000
94    ACPI_LV_VALUES                  0x00004000
95    ACPI_LV_OBJECTS                 0x00008000
96    ACPI_LV_RESOURCES               0x00010000
97    ACPI_LV_USER_REQUESTS           0x00020000
98    ACPI_LV_PACKAGE                 0x00040000
99    ACPI_LV_ALLOCATIONS             0x00100000
100    ACPI_LV_FUNCTIONS               0x00200000
101    ACPI_LV_OPTIMIZATIONS           0x00400000
102    ACPI_LV_MUTEX                   0x01000000
103    ACPI_LV_THREADS                 0x02000000
104    ACPI_LV_IO                      0x04000000
105    ACPI_LV_INTERRUPTS              0x08000000
106    ACPI_LV_AML_DISASSEMBLE         0x10000000
107    ACPI_LV_VERBOSE_INFO            0x20000000
108    ACPI_LV_FULL_TABLES             0x40000000
109    ACPI_LV_EVENTS                  0x80000000
110
111Examples
112========
113
114For example, drivers/acpi/acpica/evxfevnt.c contains this::
115
116    #define _COMPONENT          ACPI_EVENTS
117    ...
118    ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n"));
119
120To turn on this message, set the ACPI_EVENTS bit in acpi.debug_layer
121and the ACPI_LV_INIT bit in acpi.debug_level.  (The ACPI_DEBUG_PRINT
122statement uses ACPI_DB_INIT, which is a macro based on the ACPI_LV_INIT
123definition.)
124
125Enable all AML "Debug" output (stores to the Debug object while interpreting
126AML) during boot::
127
128    acpi.debug_layer=0xffffffff acpi.debug_level=0x2
129
130Enable PCI and PCI interrupt routing debug messages::
131
132    acpi.debug_layer=0x400000 acpi.debug_level=0x4
133
134Enable all ACPI hardware-related messages::
135
136    acpi.debug_layer=0x2 acpi.debug_level=0xffffffff
137
138Enable all ACPI_DB_INFO messages after boot::
139
140    # echo 0x4 > /sys/module/acpi/parameters/debug_level
141
142Show all valid component values::
143
144    # cat /sys/module/acpi/parameters/debug_layer
145