diff options
author | Bob Moore <robert.moore@intel.com> | 2018-06-01 15:06:41 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-06-06 02:53:42 -0400 |
commit | fb30b2981d674f2326feb942f462c2cf8213ac14 (patch) | |
tree | bb7d59915f7baafcff7c7d2f233a7185f593452d | |
parent | 1387cdd8cddac6f7b3964e9d76d28b909fd85c29 (diff) |
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 <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/acpica/pswalk.c | 34 | ||||
-rw-r--r-- | include/acpi/acoutput.h | 4 |
2 files changed, 34 insertions, 4 deletions
diff --git a/drivers/acpi/acpica/pswalk.c b/drivers/acpi/acpica/pswalk.c index e0a442b8648b..bd6af8c87d48 100644 --- a/drivers/acpi/acpica/pswalk.c +++ b/drivers/acpi/acpica/pswalk.c | |||
@@ -25,22 +25,48 @@ ACPI_MODULE_NAME("pswalk") | |||
25 | * DESCRIPTION: Delete a portion of or an entire parse tree. | 25 | * DESCRIPTION: Delete a portion of or an entire parse tree. |
26 | * | 26 | * |
27 | ******************************************************************************/ | 27 | ******************************************************************************/ |
28 | #include "amlcode.h" | ||
28 | void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) | 29 | void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) |
29 | { | 30 | { |
30 | union acpi_parse_object *op = subtree_root; | 31 | union acpi_parse_object *op = subtree_root; |
31 | union acpi_parse_object *next = NULL; | 32 | union acpi_parse_object *next = NULL; |
32 | union acpi_parse_object *parent = NULL; | 33 | union acpi_parse_object *parent = NULL; |
34 | u32 level = 0; | ||
33 | 35 | ||
34 | ACPI_FUNCTION_TRACE_PTR(ps_delete_parse_tree, subtree_root); | 36 | ACPI_FUNCTION_TRACE_PTR(ps_delete_parse_tree, subtree_root); |
35 | 37 | ||
38 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE_TREES, " root %p\n", subtree_root)); | ||
39 | |||
36 | /* Visit all nodes in the subtree */ | 40 | /* Visit all nodes in the subtree */ |
37 | 41 | ||
38 | while (op) { | 42 | while (op) { |
39 | |||
40 | /* Check if we are not ascending */ | ||
41 | |||
42 | if (op != parent) { | 43 | if (op != parent) { |
43 | 44 | ||
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 | |||
44 | /* Look for an argument or child of the current op */ | 70 | /* Look for an argument or child of the current op */ |
45 | 71 | ||
46 | next = acpi_ps_get_arg(op, 0); | 72 | next = acpi_ps_get_arg(op, 0); |
@@ -49,6 +75,7 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) | |||
49 | /* Still going downward in tree (Op is not completed yet) */ | 75 | /* Still going downward in tree (Op is not completed yet) */ |
50 | 76 | ||
51 | op = next; | 77 | op = next; |
78 | level++; | ||
52 | continue; | 79 | continue; |
53 | } | 80 | } |
54 | } | 81 | } |
@@ -69,6 +96,7 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) | |||
69 | if (next) { | 96 | if (next) { |
70 | op = next; | 97 | op = next; |
71 | } else { | 98 | } else { |
99 | level--; | ||
72 | op = parent; | 100 | op = parent; |
73 | } | 101 | } |
74 | } | 102 | } |
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 0a6c5bd92256..3a26aa7ead23 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h | |||
@@ -80,7 +80,8 @@ | |||
80 | #define ACPI_LV_ALLOCATIONS 0x00100000 | 80 | #define ACPI_LV_ALLOCATIONS 0x00100000 |
81 | #define ACPI_LV_FUNCTIONS 0x00200000 | 81 | #define ACPI_LV_FUNCTIONS 0x00200000 |
82 | #define ACPI_LV_OPTIMIZATIONS 0x00400000 | 82 | #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 | ||
84 | #define ACPI_LV_ALL ACPI_LV_VERBOSITY2 | 85 | #define ACPI_LV_ALL ACPI_LV_VERBOSITY2 |
85 | 86 | ||
86 | /* Trace verbosity level 3 [Threading, I/O, and Interrupts] */ | 87 | /* Trace verbosity level 3 [Threading, I/O, and Interrupts] */ |
@@ -131,6 +132,7 @@ | |||
131 | #define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES) | 132 | #define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES) |
132 | #define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS) | 133 | #define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS) |
133 | #define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS) | 134 | #define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS) |
135 | #define ACPI_DB_PARSE_TREES ACPI_DEBUG_LEVEL (ACPI_LV_PARSE_TREES) | ||
134 | #define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES) | 136 | #define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES) |
135 | #define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS) | 137 | #define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS) |
136 | #define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS) | 138 | #define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS) |