162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci==================== 462306a36Sopenharmony_ciACPI CA Debug Output 562306a36Sopenharmony_ci==================== 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciThe ACPI CA can generate debug output. This document describes how to use this 862306a36Sopenharmony_cifacility. 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciCompile-time configuration 1162306a36Sopenharmony_ci========================== 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciThe ACPI CA debug output is globally enabled by CONFIG_ACPI_DEBUG. If this 1462306a36Sopenharmony_ciconfig option is not set, the debug messages are not even built into the kernel. 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ciBoot- and run-time configuration 1762306a36Sopenharmony_ci================================ 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciWhen CONFIG_ACPI_DEBUG=y, you can select the component and level of messages 2062306a36Sopenharmony_ciyou're interested in. At boot-time, use the acpi.debug_layer and 2162306a36Sopenharmony_ciacpi.debug_level kernel command line options. After boot, you can use the 2262306a36Sopenharmony_cidebug_layer and debug_level files in /sys/module/acpi/parameters/ to control 2362306a36Sopenharmony_cithe debug messages. 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_cidebug_layer (component) 2662306a36Sopenharmony_ci======================= 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ciThe "debug_layer" is a mask that selects components of interest, e.g., a 2962306a36Sopenharmony_cispecific part of the ACPI interpreter. To build the debug_layer bitmask, look 3062306a36Sopenharmony_cifor the "#define _COMPONENT" in an ACPI source file. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciYou can set the debug_layer mask at boot-time using the acpi.debug_layer 3362306a36Sopenharmony_cicommand line argument, and you can change it after boot by writing values 3462306a36Sopenharmony_cito /sys/module/acpi/parameters/debug_layer. 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ciThe possible components are defined in include/acpi/acoutput.h. 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ciReading /sys/module/acpi/parameters/debug_layer shows the supported mask values:: 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci ACPI_UTILITIES 0x00000001 4162306a36Sopenharmony_ci ACPI_HARDWARE 0x00000002 4262306a36Sopenharmony_ci ACPI_EVENTS 0x00000004 4362306a36Sopenharmony_ci ACPI_TABLES 0x00000008 4462306a36Sopenharmony_ci ACPI_NAMESPACE 0x00000010 4562306a36Sopenharmony_ci ACPI_PARSER 0x00000020 4662306a36Sopenharmony_ci ACPI_DISPATCHER 0x00000040 4762306a36Sopenharmony_ci ACPI_EXECUTER 0x00000080 4862306a36Sopenharmony_ci ACPI_RESOURCES 0x00000100 4962306a36Sopenharmony_ci ACPI_CA_DEBUGGER 0x00000200 5062306a36Sopenharmony_ci ACPI_OS_SERVICES 0x00000400 5162306a36Sopenharmony_ci ACPI_CA_DISASSEMBLER 0x00000800 5262306a36Sopenharmony_ci ACPI_COMPILER 0x00001000 5362306a36Sopenharmony_ci ACPI_TOOLS 0x00002000 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_cidebug_level 5662306a36Sopenharmony_ci=========== 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ciThe "debug_level" is a mask that selects different types of messages, e.g., 5962306a36Sopenharmony_cithose related to initialization, method execution, informational messages, etc. 6062306a36Sopenharmony_ciTo build debug_level, look at the level specified in an ACPI_DEBUG_PRINT() 6162306a36Sopenharmony_cistatement. 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ciThe ACPI interpreter uses several different levels, but the Linux 6462306a36Sopenharmony_ciACPI core and ACPI drivers generally only use ACPI_LV_INFO. 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ciYou can set the debug_level mask at boot-time using the acpi.debug_level 6762306a36Sopenharmony_cicommand line argument, and you can change it after boot by writing values 6862306a36Sopenharmony_cito /sys/module/acpi/parameters/debug_level. 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ciThe possible levels are defined in include/acpi/acoutput.h. Reading 7162306a36Sopenharmony_ci/sys/module/acpi/parameters/debug_level shows the supported mask values, 7262306a36Sopenharmony_cicurrently these:: 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci ACPI_LV_INIT 0x00000001 7562306a36Sopenharmony_ci ACPI_LV_DEBUG_OBJECT 0x00000002 7662306a36Sopenharmony_ci ACPI_LV_INFO 0x00000004 7762306a36Sopenharmony_ci ACPI_LV_INIT_NAMES 0x00000020 7862306a36Sopenharmony_ci ACPI_LV_PARSE 0x00000040 7962306a36Sopenharmony_ci ACPI_LV_LOAD 0x00000080 8062306a36Sopenharmony_ci ACPI_LV_DISPATCH 0x00000100 8162306a36Sopenharmony_ci ACPI_LV_EXEC 0x00000200 8262306a36Sopenharmony_ci ACPI_LV_NAMES 0x00000400 8362306a36Sopenharmony_ci ACPI_LV_OPREGION 0x00000800 8462306a36Sopenharmony_ci ACPI_LV_BFIELD 0x00001000 8562306a36Sopenharmony_ci ACPI_LV_TABLES 0x00002000 8662306a36Sopenharmony_ci ACPI_LV_VALUES 0x00004000 8762306a36Sopenharmony_ci ACPI_LV_OBJECTS 0x00008000 8862306a36Sopenharmony_ci ACPI_LV_RESOURCES 0x00010000 8962306a36Sopenharmony_ci ACPI_LV_USER_REQUESTS 0x00020000 9062306a36Sopenharmony_ci ACPI_LV_PACKAGE 0x00040000 9162306a36Sopenharmony_ci ACPI_LV_ALLOCATIONS 0x00100000 9262306a36Sopenharmony_ci ACPI_LV_FUNCTIONS 0x00200000 9362306a36Sopenharmony_ci ACPI_LV_OPTIMIZATIONS 0x00400000 9462306a36Sopenharmony_ci ACPI_LV_MUTEX 0x01000000 9562306a36Sopenharmony_ci ACPI_LV_THREADS 0x02000000 9662306a36Sopenharmony_ci ACPI_LV_IO 0x04000000 9762306a36Sopenharmony_ci ACPI_LV_INTERRUPTS 0x08000000 9862306a36Sopenharmony_ci ACPI_LV_AML_DISASSEMBLE 0x10000000 9962306a36Sopenharmony_ci ACPI_LV_VERBOSE_INFO 0x20000000 10062306a36Sopenharmony_ci ACPI_LV_FULL_TABLES 0x40000000 10162306a36Sopenharmony_ci ACPI_LV_EVENTS 0x80000000 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ciExamples 10462306a36Sopenharmony_ci======== 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ciFor example, drivers/acpi/acpica/evxfevnt.c contains this:: 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci #define _COMPONENT ACPI_EVENTS 10962306a36Sopenharmony_ci ... 11062306a36Sopenharmony_ci ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n")); 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ciTo turn on this message, set the ACPI_EVENTS bit in acpi.debug_layer 11362306a36Sopenharmony_ciand the ACPI_LV_INIT bit in acpi.debug_level. (The ACPI_DEBUG_PRINT 11462306a36Sopenharmony_cistatement uses ACPI_DB_INIT, which is a macro based on the ACPI_LV_INIT 11562306a36Sopenharmony_cidefinition.) 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ciEnable all AML "Debug" output (stores to the Debug object while interpreting 11862306a36Sopenharmony_ciAML) during boot:: 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci acpi.debug_layer=0xffffffff acpi.debug_level=0x2 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ciEnable all ACPI hardware-related messages:: 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci acpi.debug_layer=0x2 acpi.debug_level=0xffffffff 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ciEnable all ACPI_DB_INFO messages after boot:: 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci # echo 0x4 > /sys/module/acpi/parameters/debug_level 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ciShow all valid component values:: 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci # cat /sys/module/acpi/parameters/debug_layer 133