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