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