summaryrefslogtreecommitdiff
path: root/Documentation/firmware-guide/acpi/debug.rst
blob: 1a152dd1d7654ae8139caf69875291e06bc820f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
.. SPDX-License-Identifier: GPL-2.0

=================
ACPI Debug Output
=================

The ACPI CA, the Linux ACPI core, and some ACPI drivers can generate debug
output.  This document describes how to use this facility.

Compile-time configuration
==========================

ACPI debug output is globally enabled by CONFIG_ACPI_DEBUG.  If this config
option is turned off, the debug messages are not even built into the
kernel.

Boot- and run-time configuration
================================

When CONFIG_ACPI_DEBUG=y, you can select the component and level of messages
you're interested in.  At boot-time, use the acpi.debug_layer and
acpi.debug_level kernel command line options.  After boot, you can use the
debug_layer and debug_level files in /sys/module/acpi/parameters/ to control
the debug messages.

debug_layer (component)
=======================

The "debug_layer" is a mask that selects components of interest, e.g., a
specific driver or part of the ACPI interpreter.  To build the debug_layer
bitmask, look for the "#define _COMPONENT" in an ACPI source file.

You can set the debug_layer mask at boot-time using the acpi.debug_layer
command line argument, and you can change it after boot by writing values
to /sys/module/acpi/parameters/debug_layer.

The possible components are defined in include/acpi/acoutput.h and
include/acpi/acpi_drivers.h.  Reading /sys/module/acpi/parameters/debug_layer
shows the supported mask values, currently these::

    ACPI_UTILITIES                  0x00000001
    ACPI_HARDWARE                   0x00000002
    ACPI_EVENTS                     0x00000004
    ACPI_TABLES                     0x00000008
    ACPI_NAMESPACE                  0x00000010
    ACPI_PARSER                     0x00000020
    ACPI_DISPATCHER                 0x00000040
    ACPI_EXECUTER                   0x00000080
    ACPI_RESOURCES                  0x00000100
    ACPI_CA_DEBUGGER                0x00000200
    ACPI_OS_SERVICES                0x00000400
    ACPI_CA_DISASSEMBLER            0x00000800
    ACPI_COMPILER                   0x00001000
    ACPI_TOOLS                      0x00002000
    ACPI_BUS_COMPONENT              0x00010000
    ACPI_AC_COMPONENT               0x00020000
    ACPI_BATTERY_COMPONENT          0x00040000
    ACPI_BUTTON_COMPONENT           0x00080000
    ACPI_SBS_COMPONENT              0x00100000
    ACPI_FAN_COMPONENT              0x00200000
    ACPI_PCI_COMPONENT              0x00400000
    ACPI_POWER_COMPONENT            0x00800000
    ACPI_CONTAINER_COMPONENT        0x01000000
    ACPI_SYSTEM_COMPONENT           0x02000000
    ACPI_THERMAL_COMPONENT          0x04000000
    ACPI_MEMORY_DEVICE_COMPONENT    0x08000000
    ACPI_VIDEO_COMPONENT            0x10000000
    ACPI_PROCESSOR_COMPONENT        0x20000000

debug_level
===========

The "debug_level" is a mask that selects different types of messages, e.g.,
those related to initialization, method execution, informational messages, etc.
To build debug_level, look at the level specified in an ACPI_DEBUG_PRINT()
statement.

The ACPI interpreter uses several different levels, but the Linux
ACPI core and ACPI drivers generally only use ACPI_LV_INFO.

You can set the debug_level mask at boot-time using the acpi.debug_level
command line argument, and you can change it after boot by writing values
to /sys/module/acpi/parameters/debug_level.

The possible levels are defined in include/acpi/acoutput.h.  Reading
/sys/module/acpi/parameters/debug_level shows the supported mask values,
currently these::

    ACPI_LV_INIT                    0x00000001
    ACPI_LV_DEBUG_OBJECT            0x00000002
    ACPI_LV_INFO                    0x00000004
    ACPI_LV_INIT_NAMES              0x00000020
    ACPI_LV_PARSE                   0x00000040
    ACPI_LV_LOAD                    0x00000080
    ACPI_LV_DISPATCH                0x00000100
    ACPI_LV_EXEC                    0x00000200
    ACPI_LV_NAMES                   0x00000400
    ACPI_LV_OPREGION                0x00000800
    ACPI_LV_BFIELD                  0x00001000
    ACPI_LV_TABLES                  0x00002000
    ACPI_LV_VALUES                  0x00004000
    ACPI_LV_OBJECTS                 0x00008000
    ACPI_LV_RESOURCES               0x00010000
    ACPI_LV_USER_REQUESTS           0x00020000
    ACPI_LV_PACKAGE                 0x00040000
    ACPI_LV_ALLOCATIONS             0x00100000
    ACPI_LV_FUNCTIONS               0x00200000
    ACPI_LV_OPTIMIZATIONS           0x00400000
    ACPI_LV_MUTEX                   0x01000000
    ACPI_LV_THREADS                 0x02000000
    ACPI_LV_IO                      0x04000000
    ACPI_LV_INTERRUPTS              0x08000000
    ACPI_LV_AML_DISASSEMBLE         0x10000000
    ACPI_LV_VERBOSE_INFO            0x20000000
    ACPI_LV_FULL_TABLES             0x40000000
    ACPI_LV_EVENTS                  0x80000000

Examples
========

For example, drivers/acpi/bus.c contains this::

    #define _COMPONENT              ACPI_BUS_COMPONENT
    ...
    ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n"));

To turn on this message, set the ACPI_BUS_COMPONENT bit in acpi.debug_layer
and the ACPI_LV_INFO bit in acpi.debug_level.  (The ACPI_DEBUG_PRINT
statement uses ACPI_DB_INFO, which is macro based on the ACPI_LV_INFO
definition.)

Enable all AML "Debug" output (stores to the Debug object while interpreting
AML) during boot::

    acpi.debug_layer=0xffffffff acpi.debug_level=0x2

Enable PCI and PCI interrupt routing debug messages::

    acpi.debug_layer=0x400000 acpi.debug_level=0x4

Enable all ACPI hardware-related messages::

    acpi.debug_layer=0x2 acpi.debug_level=0xffffffff

Enable all ACPI_DB_INFO messages after boot::

    # echo 0x4 > /sys/module/acpi/parameters/debug_level

Show all valid component values::

    # cat /sys/module/acpi/parameters/debug_layer