summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2015-07-23 00:52:59 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-07-23 17:09:07 -0400
commitab6c573320768c36ac629be3db79ad62445aae64 (patch)
treecea5858d6b22f188fba8f18a5be3bc4169df1ae0
parenta616dc2fe50270f1fa5050fb9cd88a08531a3f25 (diff)
ACPICA: Executer: Add interpreter tracing mode for method tracing facility
ACPICA commit 07fffd02607685b655ed92ee15c160e6a810b60b The acpi_debug_trace() is the mechanism known as ACPI method tracing that is used by Linux as ACPICA debugging message reducer. This facility can be controlled through Linux ACPI subsystem - /sys/module/acpi/parameters. This facility requires CONFIG_ACPI_DEBUG to be enabled to see ACPICA trace logs in the kernel dmesg output. This patch enhances acpi_debug_trace() to make it not only a message reducer, but a real tracer to trace AML interpreter execution. Note that in addition to the AML tracer enabling, this patch also updates the facility with the following enhancements: 1. Allow a full path to be specified by the acpi_debug_trace() API. 2. Allow any method rather than just the entrance of acpi_evaluate_object() to be traced. 3. All interpreter ACPI_LV_TRACE_POINT messages are collected for ACPI_EXECUTER layer. The Makefile of drivers/acpi/acpica is also updated to include exdebug.o and the duplicated stubs are removed after that. Note that since this patch has enhanced the method tracing facility, Linux need also be updated after applying this patch. Lv Zheng. Link: https://github.com/acpica/acpica/commit/07fffd02 Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/acdebug.h2
-rw-r--r--drivers/acpi/acpica/acglobal.h2
-rw-r--r--drivers/acpi/acpica/acinterp.h18
-rw-r--r--drivers/acpi/acpica/dsdebug.c25
-rw-r--r--drivers/acpi/acpica/dsmethod.c32
-rw-r--r--drivers/acpi/acpica/exdebug.c271
-rw-r--r--drivers/acpi/acpica/psloop.c16
-rw-r--r--drivers/acpi/acpica/psparse.c4
-rw-r--r--drivers/acpi/acpica/psxface.c121
-rw-r--r--drivers/acpi/acpica/utinit.c2
-rw-r--r--include/acpi/acoutput.h13
-rw-r--r--include/acpi/acpixf.h6
12 files changed, 327 insertions, 185 deletions
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 43685dd36c77..88482f75e941 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -102,6 +102,8 @@ void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg);
102 102
103acpi_status acpi_db_sleep(char *object_arg); 103acpi_status acpi_db_sleep(char *object_arg);
104 104
105void acpi_db_trace(char *enable_arg, char *method_arg, char *once_arg);
106
105void acpi_db_display_locks(void); 107void acpi_db_display_locks(void);
106 108
107void acpi_db_display_resources(char *object_arg); 109void acpi_db_display_resources(char *object_arg);
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 53f96a370762..5342300719ee 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -290,8 +290,6 @@ ACPI_GLOBAL(u32, acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]);
290 290
291ACPI_GLOBAL(u32, acpi_gbl_original_dbg_level); 291ACPI_GLOBAL(u32, acpi_gbl_original_dbg_level);
292ACPI_GLOBAL(u32, acpi_gbl_original_dbg_layer); 292ACPI_GLOBAL(u32, acpi_gbl_original_dbg_layer);
293ACPI_GLOBAL(u32, acpi_gbl_trace_dbg_level);
294ACPI_GLOBAL(u32, acpi_gbl_trace_dbg_layer);
295 293
296/***************************************************************************** 294/*****************************************************************************
297 * 295 *
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index 7ac98000b46b..a3c6e2ab93bb 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -131,6 +131,24 @@ void
131acpi_ex_do_debug_object(union acpi_operand_object *source_desc, 131acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
132 u32 level, u32 index); 132 u32 level, u32 index);
133 133
134void
135acpi_ex_start_trace_method(struct acpi_namespace_node *method_node,
136 union acpi_operand_object *obj_desc,
137 struct acpi_walk_state *walk_state);
138
139void
140acpi_ex_stop_trace_method(struct acpi_namespace_node *method_node,
141 union acpi_operand_object *obj_desc,
142 struct acpi_walk_state *walk_state);
143
144void
145acpi_ex_start_trace_opcode(union acpi_parse_object *op,
146 struct acpi_walk_state *walk_state);
147
148void
149acpi_ex_stop_trace_opcode(union acpi_parse_object *op,
150 struct acpi_walk_state *walk_state);
151
134/* 152/*
135 * exfield - ACPI AML (p-code) execution - field manipulation 153 * exfield - ACPI AML (p-code) execution - field manipulation
136 */ 154 */
diff --git a/drivers/acpi/acpica/dsdebug.c b/drivers/acpi/acpica/dsdebug.c
index 7df9b50e17a7..a651d30133d0 100644
--- a/drivers/acpi/acpica/dsdebug.c
+++ b/drivers/acpi/acpica/dsdebug.c
@@ -48,6 +48,7 @@
48#ifdef ACPI_DISASSEMBLER 48#ifdef ACPI_DISASSEMBLER
49#include "acdisasm.h" 49#include "acdisasm.h"
50#endif 50#endif
51#include "acinterp.h"
51 52
52#define _COMPONENT ACPI_DISPATCHER 53#define _COMPONENT ACPI_DISPATCHER
53ACPI_MODULE_NAME("dsdebug") 54ACPI_MODULE_NAME("dsdebug")
@@ -128,7 +129,6 @@ acpi_ds_dump_method_stack(acpi_status status,
128 struct acpi_walk_state *next_walk_state; 129 struct acpi_walk_state *next_walk_state;
129 struct acpi_namespace_node *previous_method = NULL; 130 struct acpi_namespace_node *previous_method = NULL;
130 union acpi_operand_object *method_desc; 131 union acpi_operand_object *method_desc;
131 char *pathname = NULL;
132 132
133 ACPI_FUNCTION_TRACE(ds_dump_method_stack); 133 ACPI_FUNCTION_TRACE(ds_dump_method_stack);
134 134
@@ -173,25 +173,10 @@ acpi_ds_dump_method_stack(acpi_status status,
173 173
174 while (next_walk_state) { 174 while (next_walk_state) {
175 method_desc = next_walk_state->method_desc; 175 method_desc = next_walk_state->method_desc;
176 if (method_desc && method_desc->method.node) { 176 if (method_desc) {
177 pathname = acpi_ns_get_normalized_pathname((struct 177 acpi_ex_stop_trace_method((struct acpi_namespace_node *)
178 acpi_namespace_node 178 method_desc->method.node,
179 *) 179 method_desc, walk_state);
180 method_desc->
181 method.node,
182 TRUE);
183 }
184 if (pathname) {
185 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
186 "End method [0x%p:%s] execution.\n",
187 method_desc->method.aml_start,
188 pathname));
189 ACPI_FREE(pathname);
190 pathname = NULL;
191 } else {
192 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
193 "End method [0x%p] execution.\n",
194 method_desc->method.aml_start));
195 } 180 }
196 181
197 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 182 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c
index 0fa6f19aab3a..ea2bdde1227e 100644
--- a/drivers/acpi/acpica/dsmethod.c
+++ b/drivers/acpi/acpica/dsmethod.c
@@ -327,7 +327,6 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
327 struct acpi_walk_state *walk_state) 327 struct acpi_walk_state *walk_state)
328{ 328{
329 acpi_status status = AE_OK; 329 acpi_status status = AE_OK;
330 char *pathname = NULL;
331 330
332 ACPI_FUNCTION_TRACE_PTR(ds_begin_method_execution, method_node); 331 ACPI_FUNCTION_TRACE_PTR(ds_begin_method_execution, method_node);
333 332
@@ -335,17 +334,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
335 return_ACPI_STATUS(AE_NULL_ENTRY); 334 return_ACPI_STATUS(AE_NULL_ENTRY);
336 } 335 }
337 336
338 pathname = acpi_ns_get_normalized_pathname(method_node, TRUE); 337 acpi_ex_start_trace_method(method_node, obj_desc, walk_state);
339 if (pathname) {
340 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
341 "Begin method [0x%p:%s] execution.\n",
342 obj_desc->method.aml_start, pathname));
343 ACPI_FREE(pathname);
344 } else {
345 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
346 "Begin method [0x%p] execution.\n",
347 obj_desc->method.aml_start));
348 }
349 338
350 /* Prevent wraparound of thread count */ 339 /* Prevent wraparound of thread count */
351 340
@@ -708,7 +697,6 @@ void
708acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, 697acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
709 struct acpi_walk_state *walk_state) 698 struct acpi_walk_state *walk_state)
710{ 699{
711 char *pathname = NULL;
712 700
713 ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state); 701 ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state);
714 702
@@ -846,22 +834,8 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
846 } 834 }
847 } 835 }
848 836
849 if (method_desc->method.node) { 837 acpi_ex_stop_trace_method((struct acpi_namespace_node *)method_desc->
850 pathname = acpi_ns_get_normalized_pathname((struct 838 method.node, method_desc, walk_state);
851 acpi_namespace_node
852 *)method_desc->
853 method.node, TRUE);
854 }
855 if (pathname) {
856 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
857 "End method [0x%p:%s] execution.\n",
858 method_desc->method.aml_start, pathname));
859 ACPI_FREE(pathname);
860 } else {
861 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
862 "End method [0x%p] execution.\n",
863 method_desc->method.aml_start));
864 }
865 839
866 return_VOID; 840 return_VOID;
867} 841}
diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c
index 815442bbd051..00ba9fc85f47 100644
--- a/drivers/acpi/acpica/exdebug.c
+++ b/drivers/acpi/acpica/exdebug.c
@@ -43,11 +43,15 @@
43 43
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include "accommon.h" 45#include "accommon.h"
46#include "acnamesp.h"
46#include "acinterp.h" 47#include "acinterp.h"
48#include "acparser.h"
47 49
48#define _COMPONENT ACPI_EXECUTER 50#define _COMPONENT ACPI_EXECUTER
49ACPI_MODULE_NAME("exdebug") 51ACPI_MODULE_NAME("exdebug")
50 52
53static union acpi_operand_object *acpi_gbl_trace_method_object = NULL;
54
51#ifndef ACPI_NO_ERROR_MESSAGES 55#ifndef ACPI_NO_ERROR_MESSAGES
52/******************************************************************************* 56/*******************************************************************************
53 * 57 *
@@ -70,6 +74,7 @@ ACPI_MODULE_NAME("exdebug")
70 * enabled if necessary. 74 * enabled if necessary.
71 * 75 *
72 ******************************************************************************/ 76 ******************************************************************************/
77
73void 78void
74acpi_ex_do_debug_object(union acpi_operand_object *source_desc, 79acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
75 u32 level, u32 index) 80 u32 level, u32 index)
@@ -308,3 +313,269 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
308 return_VOID; 313 return_VOID;
309} 314}
310#endif 315#endif
316
317/*******************************************************************************
318 *
319 * FUNCTION: acpi_ex_interpreter_trace_enabled
320 *
321 * PARAMETERS: name - Whether method name should be matched,
322 * this should be checked before starting
323 * the tracer
324 *
325 * RETURN: TRUE if interpreter trace is enabled.
326 *
327 * DESCRIPTION: Check whether interpreter trace is enabled
328 *
329 ******************************************************************************/
330
331static u8 acpi_ex_interpreter_trace_enabled(char *name)
332{
333
334 /* Check if tracing is enabled */
335
336 if (!(acpi_gbl_trace_flags & ACPI_TRACE_ENABLED)) {
337 return (FALSE);
338 }
339
340 /*
341 * Check if tracing is filtered:
342 *
343 * 1. If the tracer is started, acpi_gbl_trace_method_object should have
344 * been filled by the trace starter
345 * 2. If the tracer is not started, acpi_gbl_trace_method_name should be
346 * matched if it is specified
347 * 3. If the tracer is oneshot style, acpi_gbl_trace_method_name should
348 * not be cleared by the trace stopper during the first match
349 */
350 if (acpi_gbl_trace_method_object) {
351 return (TRUE);
352 }
353 if (name &&
354 (acpi_gbl_trace_method_name &&
355 strcmp(acpi_gbl_trace_method_name, name))) {
356 return (FALSE);
357 }
358 if ((acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT) &&
359 !acpi_gbl_trace_method_name) {
360 return (FALSE);
361 }
362
363 return (TRUE);
364}
365
366/*******************************************************************************
367 *
368 * FUNCTION: acpi_ex_start_trace_method
369 *
370 * PARAMETERS: method_node - Node of the method
371 * obj_desc - The method object
372 * walk_state - current state, NULL if not yet executing
373 * a method.
374 *
375 * RETURN: None
376 *
377 * DESCRIPTION: Start control method execution trace
378 *
379 ******************************************************************************/
380
381void
382acpi_ex_start_trace_method(struct acpi_namespace_node *method_node,
383 union acpi_operand_object *obj_desc,
384 struct acpi_walk_state *walk_state)
385{
386 acpi_status status;
387 char *pathname = NULL;
388 u8 enabled = FALSE;
389
390 ACPI_FUNCTION_NAME(ex_start_trace_method);
391
392 if (method_node) {
393 pathname = acpi_ns_get_normalized_pathname(method_node, TRUE);
394 }
395
396 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
397 if (ACPI_FAILURE(status)) {
398 goto exit;
399 }
400
401 enabled = acpi_ex_interpreter_trace_enabled(pathname);
402 if (enabled && !acpi_gbl_trace_method_object) {
403 acpi_gbl_trace_method_object = obj_desc;
404 acpi_gbl_original_dbg_level = acpi_dbg_level;
405 acpi_gbl_original_dbg_layer = acpi_dbg_layer;
406 acpi_dbg_level = ACPI_TRACE_LEVEL_ALL;
407 acpi_dbg_layer = ACPI_TRACE_LAYER_ALL;
408
409 if (acpi_gbl_trace_dbg_level) {
410 acpi_dbg_level = acpi_gbl_trace_dbg_level;
411 }
412 if (acpi_gbl_trace_dbg_layer) {
413 acpi_dbg_layer = acpi_gbl_trace_dbg_layer;
414 }
415 }
416 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
417
418exit:
419 if (enabled) {
420 if (pathname) {
421 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
422 "Begin method [0x%p:%s] execution.\n",
423 obj_desc->method.aml_start,
424 pathname));
425 } else {
426 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
427 "Begin method [0x%p] execution.\n",
428 obj_desc->method.aml_start));
429 }
430 }
431 if (pathname) {
432 ACPI_FREE(pathname);
433 }
434}
435
436/*******************************************************************************
437 *
438 * FUNCTION: acpi_ex_stop_trace_method
439 *
440 * PARAMETERS: method_node - Node of the method
441 * obj_desc - The method object
442 * walk_state - current state, NULL if not yet executing
443 * a method.
444 *
445 * RETURN: None
446 *
447 * DESCRIPTION: Stop control method execution trace
448 *
449 ******************************************************************************/
450
451void
452acpi_ex_stop_trace_method(struct acpi_namespace_node *method_node,
453 union acpi_operand_object *obj_desc,
454 struct acpi_walk_state *walk_state)
455{
456 acpi_status status;
457 char *pathname = NULL;
458 u8 enabled;
459
460 ACPI_FUNCTION_NAME(ex_stop_trace_method);
461
462 if (method_node) {
463 pathname = acpi_ns_get_normalized_pathname(method_node, TRUE);
464 }
465
466 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
467 if (ACPI_FAILURE(status)) {
468 goto exit_path;
469 }
470
471 enabled = acpi_ex_interpreter_trace_enabled(NULL);
472
473 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
474
475 if (enabled) {
476 if (pathname) {
477 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
478 "End method [0x%p:%s] execution.\n",
479 obj_desc->method.aml_start,
480 pathname));
481 } else {
482 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
483 "End method [0x%p] execution.\n",
484 obj_desc->method.aml_start));
485 }
486 }
487
488 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
489 if (ACPI_FAILURE(status)) {
490 goto exit_path;
491 }
492
493 /* Check whether the tracer should be stopped */
494
495 if (acpi_gbl_trace_method_object == obj_desc) {
496
497 /* Disable further tracing if type is one-shot */
498
499 if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT) {
500 acpi_gbl_trace_method_name = NULL;
501 }
502
503 acpi_dbg_level = acpi_gbl_original_dbg_level;
504 acpi_dbg_layer = acpi_gbl_original_dbg_layer;
505 acpi_gbl_trace_method_object = NULL;
506 }
507
508 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
509
510exit_path:
511 if (pathname) {
512 ACPI_FREE(pathname);
513 }
514}
515
516/*******************************************************************************
517 *
518 * FUNCTION: acpi_ex_start_trace_opcode
519 *
520 * PARAMETERS: op - The parser opcode object
521 * walk_state - current state, NULL if not yet executing
522 * a method.
523 *
524 * RETURN: None
525 *
526 * DESCRIPTION: Start opcode execution trace
527 *
528 ******************************************************************************/
529
530void
531acpi_ex_start_trace_opcode(union acpi_parse_object *op,
532 struct acpi_walk_state *walk_state)
533{
534
535 ACPI_FUNCTION_NAME(ex_start_trace_opcode);
536
537 if (acpi_ex_interpreter_trace_enabled(NULL)) {
538 if (walk_state->op_info) {
539 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
540 "Begin opcode: %s[0x%p] Class=0x%02x, Type=0x%02x, Flags=0x%04x.\n",
541 op->common.aml_op_name,
542 op->common.aml,
543 walk_state->op_info->class,
544 walk_state->op_info->type,
545 walk_state->op_info->flags));
546 } else {
547 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
548 "Begin opcode: %s[0x%p].\n",
549 op->common.aml_op_name,
550 op->common.aml));
551 }
552 }
553}
554
555/*******************************************************************************
556 *
557 * FUNCTION: acpi_ex_stop_trace_opcode
558 *
559 * PARAMETERS: op - The parser opcode object
560 * walk_state - current state, NULL if not yet executing
561 * a method.
562 *
563 * RETURN: None
564 *
565 * DESCRIPTION: Stop opcode execution trace
566 *
567 ******************************************************************************/
568
569void
570acpi_ex_stop_trace_opcode(union acpi_parse_object *op,
571 struct acpi_walk_state *walk_state)
572{
573
574 ACPI_FUNCTION_NAME(ex_stop_trace_opcode);
575
576 if (acpi_ex_interpreter_trace_enabled(NULL)) {
577 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
578 "End opcode: %s[0x%p].\n",
579 op->common.aml_op_name, op->common.aml));
580 }
581}
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c
index 80339ba56cad..a7de52ee1538 100644
--- a/drivers/acpi/acpica/psloop.c
+++ b/drivers/acpi/acpica/psloop.c
@@ -51,6 +51,7 @@
51 51
52#include <acpi/acpi.h> 52#include <acpi/acpi.h>
53#include "accommon.h" 53#include "accommon.h"
54#include "acinterp.h"
54#include "acparser.h" 55#include "acparser.h"
55#include "acdispat.h" 56#include "acdispat.h"
56#include "amlcode.h" 57#include "amlcode.h"
@@ -498,20 +499,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
498 op->common.aml)); 499 op->common.aml));
499 } 500 }
500 501
501 if (walk_state->op_info) { 502 acpi_ex_start_trace_opcode(op, walk_state);
502 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
503 "Begin opcode: %s[0x%p] Class=0x%02x, Type=0x%02x, Flags=0x%04x.\n",
504 op->common.aml_op_name,
505 op->common.aml,
506 walk_state->op_info->class,
507 walk_state->op_info->type,
508 walk_state->op_info->flags));
509 } else {
510 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT,
511 "Begin opcode: %s[0x%p].\n",
512 op->common.aml_op_name,
513 op->common.aml));
514 }
515 } 503 }
516 504
517 /* 505 /*
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c
index 97ea0e5360f1..98001d7f6f80 100644
--- a/drivers/acpi/acpica/psparse.c
+++ b/drivers/acpi/acpica/psparse.c
@@ -147,9 +147,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
147 return_ACPI_STATUS(AE_OK); /* OK for now */ 147 return_ACPI_STATUS(AE_OK); /* OK for now */
148 } 148 }
149 149
150 ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, 150 acpi_ex_stop_trace_opcode(op, walk_state);
151 "End opcode: %s[0x%p].\n",
152 op->common.aml_op_name, op->common.aml));
153 151
154 /* Delete this op and the subtree below it if asked to */ 152 /* Delete this op and the subtree below it if asked to */
155 153
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c
index 1f3f46d44312..4254805dd319 100644
--- a/drivers/acpi/acpica/psxface.c
+++ b/drivers/acpi/acpica/psxface.c
@@ -47,15 +47,12 @@
47#include "acdispat.h" 47#include "acdispat.h"
48#include "acinterp.h" 48#include "acinterp.h"
49#include "actables.h" 49#include "actables.h"
50#include "acnamesp.h"
50 51
51#define _COMPONENT ACPI_PARSER 52#define _COMPONENT ACPI_PARSER
52ACPI_MODULE_NAME("psxface") 53ACPI_MODULE_NAME("psxface")
53 54
54/* Local Prototypes */ 55/* Local Prototypes */
55static void acpi_ps_start_trace(struct acpi_evaluate_info *info);
56
57static void acpi_ps_stop_trace(struct acpi_evaluate_info *info);
58
59static void 56static void
60acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action); 57acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action);
61 58
@@ -76,7 +73,7 @@ acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action);
76 ******************************************************************************/ 73 ******************************************************************************/
77 74
78acpi_status 75acpi_status
79acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags) 76acpi_debug_trace(const char *name, u32 debug_level, u32 debug_layer, u32 flags)
80{ 77{
81 acpi_status status; 78 acpi_status status;
82 79
@@ -85,108 +82,14 @@ acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags)
85 return (status); 82 return (status);
86 } 83 }
87 84
88 /* TBDs: Validate name, allow full path or just nameseg */ 85 acpi_gbl_trace_method_name = name;
89
90 acpi_gbl_trace_method_name = *ACPI_CAST_PTR(u32, name);
91 acpi_gbl_trace_flags = flags; 86 acpi_gbl_trace_flags = flags;
92 87 acpi_gbl_trace_dbg_level = debug_level;
93 if (debug_level) { 88 acpi_gbl_trace_dbg_layer = debug_layer;
94 acpi_gbl_trace_dbg_level = debug_level; 89 status = AE_OK;
95 }
96 if (debug_layer) {
97 acpi_gbl_trace_dbg_layer = debug_layer;
98 }
99 90
100 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); 91 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
101 return (AE_OK); 92 return (status);
102}
103
104/*******************************************************************************
105 *
106 * FUNCTION: acpi_ps_start_trace
107 *
108 * PARAMETERS: info - Method info struct
109 *
110 * RETURN: None
111 *
112 * DESCRIPTION: Start control method execution trace
113 *
114 ******************************************************************************/
115
116static void acpi_ps_start_trace(struct acpi_evaluate_info *info)
117{
118 acpi_status status;
119
120 ACPI_FUNCTION_ENTRY();
121
122 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
123 if (ACPI_FAILURE(status)) {
124 return;
125 }
126
127 if ((!acpi_gbl_trace_method_name) ||
128 (acpi_gbl_trace_method_name != info->node->name.integer)) {
129 goto exit;
130 }
131
132 acpi_gbl_original_dbg_level = acpi_dbg_level;
133 acpi_gbl_original_dbg_layer = acpi_dbg_layer;
134
135 acpi_dbg_level = 0x00FFFFFF;
136 acpi_dbg_layer = ACPI_UINT32_MAX;
137
138 if (acpi_gbl_trace_dbg_level) {
139 acpi_dbg_level = acpi_gbl_trace_dbg_level;
140 }
141 if (acpi_gbl_trace_dbg_layer) {
142 acpi_dbg_layer = acpi_gbl_trace_dbg_layer;
143 }
144
145exit:
146 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
147}
148
149/*******************************************************************************
150 *
151 * FUNCTION: acpi_ps_stop_trace
152 *
153 * PARAMETERS: info - Method info struct
154 *
155 * RETURN: None
156 *
157 * DESCRIPTION: Stop control method execution trace
158 *
159 ******************************************************************************/
160
161static void acpi_ps_stop_trace(struct acpi_evaluate_info *info)
162{
163 acpi_status status;
164
165 ACPI_FUNCTION_ENTRY();
166
167 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
168 if (ACPI_FAILURE(status)) {
169 return;
170 }
171
172 if ((!acpi_gbl_trace_method_name) ||
173 (acpi_gbl_trace_method_name != info->node->name.integer)) {
174 goto exit;
175 }
176
177 /* Disable further tracing if type is one-shot */
178
179 if (acpi_gbl_trace_flags & 1) {
180 acpi_gbl_trace_method_name = 0;
181 acpi_gbl_trace_dbg_level = 0;
182 acpi_gbl_trace_dbg_layer = 0;
183 }
184
185 acpi_dbg_level = acpi_gbl_original_dbg_level;
186 acpi_dbg_layer = acpi_gbl_original_dbg_layer;
187
188exit:
189 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
190} 93}
191 94
192/******************************************************************************* 95/*******************************************************************************
@@ -212,7 +115,7 @@ exit:
212 * 115 *
213 ******************************************************************************/ 116 ******************************************************************************/
214 117
215acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) 118acpi_status acpi_ps_execute_method(struct acpi_evaluate_info * info)
216{ 119{
217 acpi_status status; 120 acpi_status status;
218 union acpi_parse_object *op; 121 union acpi_parse_object *op;
@@ -243,10 +146,6 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
243 */ 146 */
244 acpi_ps_update_parameter_list(info, REF_INCREMENT); 147 acpi_ps_update_parameter_list(info, REF_INCREMENT);
245 148
246 /* Begin tracing if requested */
247
248 acpi_ps_start_trace(info);
249
250 /* 149 /*
251 * Execute the method. Performs parse simultaneously 150 * Execute the method. Performs parse simultaneously
252 */ 151 */
@@ -326,10 +225,6 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
326cleanup: 225cleanup:
327 acpi_ps_delete_parse_tree(op); 226 acpi_ps_delete_parse_tree(op);
328 227
329 /* End optional tracing */
330
331 acpi_ps_stop_trace(info);
332
333 /* Take away the extra reference that we gave the parameters above */ 228 /* Take away the extra reference that we gave the parameters above */
334 229
335 acpi_ps_update_parameter_list(info, REF_DECREMENT); 230 acpi_ps_update_parameter_list(info, REF_DECREMENT);
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c
index e402e07b4846..7f897c63aa5b 100644
--- a/drivers/acpi/acpica/utinit.c
+++ b/drivers/acpi/acpica/utinit.c
@@ -204,8 +204,6 @@ acpi_status acpi_ut_init_globals(void)
204 acpi_gbl_acpi_hardware_present = TRUE; 204 acpi_gbl_acpi_hardware_present = TRUE;
205 acpi_gbl_last_owner_id_index = 0; 205 acpi_gbl_last_owner_id_index = 0;
206 acpi_gbl_next_owner_id_offset = 0; 206 acpi_gbl_next_owner_id_offset = 0;
207 acpi_gbl_trace_dbg_level = 0;
208 acpi_gbl_trace_dbg_layer = 0;
209 acpi_gbl_debugger_configuration = DEBUGGER_THREADING; 207 acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
210 acpi_gbl_osi_mutex = NULL; 208 acpi_gbl_osi_mutex = NULL;
211 acpi_gbl_reg_methods_executed = FALSE; 209 acpi_gbl_reg_methods_executed = FALSE;
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 8f89df9c7295..37f46d49a74a 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -184,6 +184,19 @@
184#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) 184#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR)
185#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) 185#define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL)
186 186
187/*
188 * Global trace flags
189 */
190#define ACPI_TRACE_ENABLED ((u32) 2)
191#define ACPI_TRACE_ONESHOT ((u32) 1)
192
193/* Defaults for trace debugging level/layer */
194
195#define ACPI_TRACE_LEVEL_ALL ACPI_LV_ALL
196#define ACPI_TRACE_LAYER_ALL 0x000001FF
197#define ACPI_TRACE_LEVEL_DEFAULT ACPI_LV_TRACE_POINT
198#define ACPI_TRACE_LAYER_DEFAULT ACPI_EXECUTER
199
187#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) 200#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
188/* 201/*
189 * The module name is used primarily for error and debug messages. 202 * The module name is used primarily for error and debug messages.
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index e8ec18a4a634..9c362cf14264 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -251,7 +251,9 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE);
251 * traced each time it is executed. 251 * traced each time it is executed.
252 */ 252 */
253ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_flags, 0); 253ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_flags, 0);
254ACPI_INIT_GLOBAL(acpi_name, acpi_gbl_trace_method_name, 0); 254ACPI_INIT_GLOBAL(const char *, acpi_gbl_trace_method_name, NULL);
255ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_dbg_level, ACPI_TRACE_LEVEL_DEFAULT);
256ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_dbg_layer, ACPI_TRACE_LAYER_DEFAULT);
255 257
256/* 258/*
257 * Runtime configuration of debug output control masks. We want the debug 259 * Runtime configuration of debug output control masks. We want the debug
@@ -504,7 +506,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
504 acpi_object_handler handler, 506 acpi_object_handler handler,
505 void **data)) 507 void **data))
506ACPI_EXTERNAL_RETURN_STATUS(acpi_status 508ACPI_EXTERNAL_RETURN_STATUS(acpi_status
507 acpi_debug_trace(char *name, u32 debug_level, 509 acpi_debug_trace(const char *name, u32 debug_level,
508 u32 debug_layer, u32 flags)) 510 u32 debug_layer, u32 flags))
509 511
510/* 512/*