Skip to content

Commit fb30b29

Browse files
acpibobrafaeljw
authored andcommitted
ACPICA: AML Parser: Add debug option to dump parse trees
Debug level 0x00800000 will dump the current parse tree just before it is deleted. Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Erik Schmauss <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 1387cdd commit fb30b29

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

drivers/acpi/acpica/pswalk.c

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,48 @@ ACPI_MODULE_NAME("pswalk")
2525
* DESCRIPTION: Delete a portion of or an entire parse tree.
2626
*
2727
******************************************************************************/
28+
#include "amlcode.h"
2829
void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
2930
{
3031
union acpi_parse_object *op = subtree_root;
3132
union acpi_parse_object *next = NULL;
3233
union acpi_parse_object *parent = NULL;
34+
u32 level = 0;
3335

3436
ACPI_FUNCTION_TRACE_PTR(ps_delete_parse_tree, subtree_root);
3537

38+
ACPI_DEBUG_PRINT((ACPI_DB_PARSE_TREES, " root %p\n", subtree_root));
39+
3640
/* Visit all nodes in the subtree */
3741

3842
while (op) {
39-
40-
/* Check if we are not ascending */
41-
4243
if (op != parent) {
4344

45+
/* This is the descending case */
46+
47+
if (ACPI_IS_DEBUG_ENABLED
48+
(ACPI_LV_PARSE_TREES, _COMPONENT)) {
49+
50+
/* This debug option will print the entire parse tree */
51+
52+
acpi_os_printf(" %*.s%s %p", (level * 4),
53+
" ",
54+
acpi_ps_get_opcode_name(op->
55+
common.
56+
aml_opcode),
57+
op);
58+
59+
if (op->named.aml_opcode == AML_INT_NAMEPATH_OP) {
60+
acpi_os_printf(" %4.4s",
61+
op->common.value.string);
62+
}
63+
if (op->named.aml_opcode == AML_STRING_OP) {
64+
acpi_os_printf(" %s",
65+
op->common.value.string);
66+
}
67+
acpi_os_printf("\n");
68+
}
69+
4470
/* Look for an argument or child of the current op */
4571

4672
next = acpi_ps_get_arg(op, 0);
@@ -49,6 +75,7 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
4975
/* Still going downward in tree (Op is not completed yet) */
5076

5177
op = next;
78+
level++;
5279
continue;
5380
}
5481
}
@@ -69,6 +96,7 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
6996
if (next) {
7097
op = next;
7198
} else {
99+
level--;
72100
op = parent;
73101
}
74102
}

include/acpi/acoutput.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@
8080
#define ACPI_LV_ALLOCATIONS 0x00100000
8181
#define ACPI_LV_FUNCTIONS 0x00200000
8282
#define ACPI_LV_OPTIMIZATIONS 0x00400000
83-
#define ACPI_LV_VERBOSITY2 0x00700000 | ACPI_LV_VERBOSITY1
83+
#define ACPI_LV_PARSE_TREES 0x00800000
84+
#define ACPI_LV_VERBOSITY2 0x00F00000 | ACPI_LV_VERBOSITY1
8485
#define ACPI_LV_ALL ACPI_LV_VERBOSITY2
8586

8687
/* Trace verbosity level 3 [Threading, I/O, and Interrupts] */
@@ -131,6 +132,7 @@
131132
#define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES)
132133
#define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS)
133134
#define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS)
135+
#define ACPI_DB_PARSE_TREES ACPI_DEBUG_LEVEL (ACPI_LV_PARSE_TREES)
134136
#define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES)
135137
#define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS)
136138
#define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS)

0 commit comments

Comments
 (0)