Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: add control method tracing support

Add debug tracing support during certain AML method execution.

Four more module parameters are created under /sys/module/acpi/parameters/:
trace_method_name: the AML method name that user wants to trace

trace_debug_layer: the temporary debug_layer used when tracing the method.
Using 0xffffffff by default if it is 0.

trace_debug_level: the temporary debug_level used when tracing the method.
Using 0x00ffffff by default if it is 0.

trace_state: The status of the tracing feature.
"enabled" means this feature is enabled
and the AML method is traced every time it's executed.
"1" means this feature is enabled and the AML method
will only be traced during the next execution.
"disabled" means this feature is disabled.
Users can enable/disable this debug tracing feature by
"echo string > /sys/module/acpi/parameters/trace_state".
"string" should be one of "enable", "disable" and "1".

http://bugzilla.kernel.org/show_bug.cgi?id=6629

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>

authored by

Zhang Rui and committed by
Len Brown
4169c45f 2ffbb837

+57
+57
drivers/acpi/debug.c
··· 130 130 module_param_call(debug_layer, param_set_uint, param_get_debug_layer, &acpi_dbg_layer, 0644); 131 131 module_param_call(debug_level, param_set_uint, param_get_debug_level, &acpi_dbg_level, 0644); 132 132 133 + static char trace_method_name[6]; 134 + module_param_string(trace_method_name, trace_method_name, 6, 0644); 135 + static unsigned int trace_debug_layer; 136 + module_param(trace_debug_layer, uint, 0644); 137 + static unsigned int trace_debug_level; 138 + module_param(trace_debug_level, uint, 0644); 139 + 140 + static int param_set_trace_state(const char *val, struct kernel_param *kp) 141 + { 142 + int result = 0; 143 + 144 + if (!strncmp(val, "enable", strlen("enable") - 1)) { 145 + result = acpi_debug_trace(trace_method_name, trace_debug_level, 146 + trace_debug_layer, 0); 147 + if (result) 148 + result = -EBUSY; 149 + goto exit; 150 + } 151 + 152 + if (!strncmp(val, "disable", strlen("disable") - 1)) { 153 + int name = 0; 154 + result = acpi_debug_trace((char *)&name, trace_debug_level, 155 + trace_debug_layer, 0); 156 + if (result) 157 + result = -EBUSY; 158 + goto exit; 159 + } 160 + 161 + if (!strncmp(val, "1", 1)) { 162 + result = acpi_debug_trace(trace_method_name, trace_debug_level, 163 + trace_debug_layer, 1); 164 + if (result) 165 + result = -EBUSY; 166 + goto exit; 167 + } 168 + 169 + result = -EINVAL; 170 + exit: 171 + return result; 172 + } 173 + 174 + static int param_get_trace_state(char *buffer, struct kernel_param *kp) 175 + { 176 + if (!acpi_gbl_trace_method_name) 177 + return sprintf(buffer, "disable"); 178 + else { 179 + if (acpi_gbl_trace_flags & 1) 180 + return sprintf(buffer, "1"); 181 + else 182 + return sprintf(buffer, "enable"); 183 + } 184 + return 0; 185 + } 186 + 187 + module_param_call(trace_state, param_set_trace_state, param_get_trace_state, 188 + NULL, 0644); 189 + 133 190 /* -------------------------------------------------------------------------- 134 191 FS Interface (/proc) 135 192 -------------------------------------------------------------------------- */