18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci================= 48c2ecf20Sopenharmony_ciACPI Debug Output 58c2ecf20Sopenharmony_ci================= 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ciThe ACPI CA, the Linux ACPI core, and some ACPI drivers can generate debug 88c2ecf20Sopenharmony_cioutput. This document describes how to use this facility. 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciCompile-time configuration 118c2ecf20Sopenharmony_ci========================== 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciACPI debug output is globally enabled by CONFIG_ACPI_DEBUG. If this config 148c2ecf20Sopenharmony_cioption is turned off, the debug messages are not even built into the 158c2ecf20Sopenharmony_cikernel. 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ciBoot- and run-time configuration 188c2ecf20Sopenharmony_ci================================ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ciWhen CONFIG_ACPI_DEBUG=y, you can select the component and level of messages 218c2ecf20Sopenharmony_ciyou're interested in. At boot-time, use the acpi.debug_layer and 228c2ecf20Sopenharmony_ciacpi.debug_level kernel command line options. After boot, you can use the 238c2ecf20Sopenharmony_cidebug_layer and debug_level files in /sys/module/acpi/parameters/ to control 248c2ecf20Sopenharmony_cithe debug messages. 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cidebug_layer (component) 278c2ecf20Sopenharmony_ci======================= 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciThe "debug_layer" is a mask that selects components of interest, e.g., a 308c2ecf20Sopenharmony_cispecific driver or part of the ACPI interpreter. To build the debug_layer 318c2ecf20Sopenharmony_cibitmask, look for the "#define _COMPONENT" in an ACPI source file. 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciYou can set the debug_layer mask at boot-time using the acpi.debug_layer 348c2ecf20Sopenharmony_cicommand line argument, and you can change it after boot by writing values 358c2ecf20Sopenharmony_cito /sys/module/acpi/parameters/debug_layer. 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ciThe possible components are defined in include/acpi/acoutput.h and 388c2ecf20Sopenharmony_ciinclude/acpi/acpi_drivers.h. Reading /sys/module/acpi/parameters/debug_layer 398c2ecf20Sopenharmony_cishows the supported mask values, currently these:: 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci ACPI_UTILITIES 0x00000001 428c2ecf20Sopenharmony_ci ACPI_HARDWARE 0x00000002 438c2ecf20Sopenharmony_ci ACPI_EVENTS 0x00000004 448c2ecf20Sopenharmony_ci ACPI_TABLES 0x00000008 458c2ecf20Sopenharmony_ci ACPI_NAMESPACE 0x00000010 468c2ecf20Sopenharmony_ci ACPI_PARSER 0x00000020 478c2ecf20Sopenharmony_ci ACPI_DISPATCHER 0x00000040 488c2ecf20Sopenharmony_ci ACPI_EXECUTER 0x00000080 498c2ecf20Sopenharmony_ci ACPI_RESOURCES 0x00000100 508c2ecf20Sopenharmony_ci ACPI_CA_DEBUGGER 0x00000200 518c2ecf20Sopenharmony_ci ACPI_OS_SERVICES 0x00000400 528c2ecf20Sopenharmony_ci ACPI_CA_DISASSEMBLER 0x00000800 538c2ecf20Sopenharmony_ci ACPI_COMPILER 0x00001000 548c2ecf20Sopenharmony_ci ACPI_TOOLS 0x00002000 558c2ecf20Sopenharmony_ci ACPI_BUS_COMPONENT 0x00010000 568c2ecf20Sopenharmony_ci ACPI_AC_COMPONENT 0x00020000 578c2ecf20Sopenharmony_ci ACPI_BATTERY_COMPONENT 0x00040000 588c2ecf20Sopenharmony_ci ACPI_BUTTON_COMPONENT 0x00080000 598c2ecf20Sopenharmony_ci ACPI_SBS_COMPONENT 0x00100000 608c2ecf20Sopenharmony_ci ACPI_FAN_COMPONENT 0x00200000 618c2ecf20Sopenharmony_ci ACPI_PCI_COMPONENT 0x00400000 628c2ecf20Sopenharmony_ci ACPI_POWER_COMPONENT 0x00800000 638c2ecf20Sopenharmony_ci ACPI_CONTAINER_COMPONENT 0x01000000 648c2ecf20Sopenharmony_ci ACPI_SYSTEM_COMPONENT 0x02000000 658c2ecf20Sopenharmony_ci ACPI_THERMAL_COMPONENT 0x04000000 668c2ecf20Sopenharmony_ci ACPI_MEMORY_DEVICE_COMPONENT 0x08000000 678c2ecf20Sopenharmony_ci ACPI_VIDEO_COMPONENT 0x10000000 688c2ecf20Sopenharmony_ci ACPI_PROCESSOR_COMPONENT 0x20000000 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_cidebug_level 718c2ecf20Sopenharmony_ci=========== 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ciThe "debug_level" is a mask that selects different types of messages, e.g., 748c2ecf20Sopenharmony_cithose related to initialization, method execution, informational messages, etc. 758c2ecf20Sopenharmony_ciTo build debug_level, look at the level specified in an ACPI_DEBUG_PRINT() 768c2ecf20Sopenharmony_cistatement. 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ciThe ACPI interpreter uses several different levels, but the Linux 798c2ecf20Sopenharmony_ciACPI core and ACPI drivers generally only use ACPI_LV_INFO. 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ciYou can set the debug_level mask at boot-time using the acpi.debug_level 828c2ecf20Sopenharmony_cicommand line argument, and you can change it after boot by writing values 838c2ecf20Sopenharmony_cito /sys/module/acpi/parameters/debug_level. 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ciThe possible levels are defined in include/acpi/acoutput.h. Reading 868c2ecf20Sopenharmony_ci/sys/module/acpi/parameters/debug_level shows the supported mask values, 878c2ecf20Sopenharmony_cicurrently these:: 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci ACPI_LV_INIT 0x00000001 908c2ecf20Sopenharmony_ci ACPI_LV_DEBUG_OBJECT 0x00000002 918c2ecf20Sopenharmony_ci ACPI_LV_INFO 0x00000004 928c2ecf20Sopenharmony_ci ACPI_LV_INIT_NAMES 0x00000020 938c2ecf20Sopenharmony_ci ACPI_LV_PARSE 0x00000040 948c2ecf20Sopenharmony_ci ACPI_LV_LOAD 0x00000080 958c2ecf20Sopenharmony_ci ACPI_LV_DISPATCH 0x00000100 968c2ecf20Sopenharmony_ci ACPI_LV_EXEC 0x00000200 978c2ecf20Sopenharmony_ci ACPI_LV_NAMES 0x00000400 988c2ecf20Sopenharmony_ci ACPI_LV_OPREGION 0x00000800 998c2ecf20Sopenharmony_ci ACPI_LV_BFIELD 0x00001000 1008c2ecf20Sopenharmony_ci ACPI_LV_TABLES 0x00002000 1018c2ecf20Sopenharmony_ci ACPI_LV_VALUES 0x00004000 1028c2ecf20Sopenharmony_ci ACPI_LV_OBJECTS 0x00008000 1038c2ecf20Sopenharmony_ci ACPI_LV_RESOURCES 0x00010000 1048c2ecf20Sopenharmony_ci ACPI_LV_USER_REQUESTS 0x00020000 1058c2ecf20Sopenharmony_ci ACPI_LV_PACKAGE 0x00040000 1068c2ecf20Sopenharmony_ci ACPI_LV_ALLOCATIONS 0x00100000 1078c2ecf20Sopenharmony_ci ACPI_LV_FUNCTIONS 0x00200000 1088c2ecf20Sopenharmony_ci ACPI_LV_OPTIMIZATIONS 0x00400000 1098c2ecf20Sopenharmony_ci ACPI_LV_MUTEX 0x01000000 1108c2ecf20Sopenharmony_ci ACPI_LV_THREADS 0x02000000 1118c2ecf20Sopenharmony_ci ACPI_LV_IO 0x04000000 1128c2ecf20Sopenharmony_ci ACPI_LV_INTERRUPTS 0x08000000 1138c2ecf20Sopenharmony_ci ACPI_LV_AML_DISASSEMBLE 0x10000000 1148c2ecf20Sopenharmony_ci ACPI_LV_VERBOSE_INFO 0x20000000 1158c2ecf20Sopenharmony_ci ACPI_LV_FULL_TABLES 0x40000000 1168c2ecf20Sopenharmony_ci ACPI_LV_EVENTS 0x80000000 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ciExamples 1198c2ecf20Sopenharmony_ci======== 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ciFor example, drivers/acpi/bus.c contains this:: 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci #define _COMPONENT ACPI_BUS_COMPONENT 1248c2ecf20Sopenharmony_ci ... 1258c2ecf20Sopenharmony_ci ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n")); 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ciTo turn on this message, set the ACPI_BUS_COMPONENT bit in acpi.debug_layer 1288c2ecf20Sopenharmony_ciand the ACPI_LV_INFO bit in acpi.debug_level. (The ACPI_DEBUG_PRINT 1298c2ecf20Sopenharmony_cistatement uses ACPI_DB_INFO, which is macro based on the ACPI_LV_INFO 1308c2ecf20Sopenharmony_cidefinition.) 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ciEnable all AML "Debug" output (stores to the Debug object while interpreting 1338c2ecf20Sopenharmony_ciAML) during boot:: 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci acpi.debug_layer=0xffffffff acpi.debug_level=0x2 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ciEnable PCI and PCI interrupt routing debug messages:: 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci acpi.debug_layer=0x400000 acpi.debug_level=0x4 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ciEnable all ACPI hardware-related messages:: 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci acpi.debug_layer=0x2 acpi.debug_level=0xffffffff 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ciEnable all ACPI_DB_INFO messages after boot:: 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci # echo 0x4 > /sys/module/acpi/parameters/debug_level 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ciShow all valid component values:: 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci # cat /sys/module/acpi/parameters/debug_layer 152