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

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>

authored by

Bob Moore and committed by
Rafael J. Wysocki
fb30b298 1387cdd8

+34 -4
+31 -3
drivers/acpi/acpica/pswalk.c
··· 25 25 * DESCRIPTION: Delete a portion of or an entire parse tree. 26 26 * 27 27 ******************************************************************************/ 28 + #include "amlcode.h" 28 29 void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) 29 30 { 30 31 union acpi_parse_object *op = subtree_root; 31 32 union acpi_parse_object *next = NULL; 32 33 union acpi_parse_object *parent = NULL; 34 + u32 level = 0; 33 35 34 36 ACPI_FUNCTION_TRACE_PTR(ps_delete_parse_tree, subtree_root); 37 + 38 + ACPI_DEBUG_PRINT((ACPI_DB_PARSE_TREES, " root %p\n", subtree_root)); 35 39 36 40 /* Visit all nodes in the subtree */ 37 41 38 42 while (op) { 39 - 40 - /* Check if we are not ascending */ 41 - 42 43 if (op != parent) { 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 + } 43 69 44 70 /* Look for an argument or child of the current op */ 45 71 ··· 75 49 /* Still going downward in tree (Op is not completed yet) */ 76 50 77 51 op = next; 52 + level++; 78 53 continue; 79 54 } 80 55 } ··· 96 69 if (next) { 97 70 op = next; 98 71 } else { 72 + level--; 99 73 op = parent; 100 74 } 101 75 }
+3 -1
include/acpi/acoutput.h
··· 80 80 #define ACPI_LV_ALLOCATIONS 0x00100000 81 81 #define ACPI_LV_FUNCTIONS 0x00200000 82 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 85 #define ACPI_LV_ALL ACPI_LV_VERBOSITY2 85 86 86 87 /* Trace verbosity level 3 [Threading, I/O, and Interrupts] */ ··· 132 131 #define ACPI_DB_TABLES ACPI_DEBUG_LEVEL (ACPI_LV_TABLES) 133 132 #define ACPI_DB_FUNCTIONS ACPI_DEBUG_LEVEL (ACPI_LV_FUNCTIONS) 134 133 #define ACPI_DB_OPTIMIZATIONS ACPI_DEBUG_LEVEL (ACPI_LV_OPTIMIZATIONS) 134 + #define ACPI_DB_PARSE_TREES ACPI_DEBUG_LEVEL (ACPI_LV_PARSE_TREES) 135 135 #define ACPI_DB_VALUES ACPI_DEBUG_LEVEL (ACPI_LV_VALUES) 136 136 #define ACPI_DB_OBJECTS ACPI_DEBUG_LEVEL (ACPI_LV_OBJECTS) 137 137 #define ACPI_DB_ALLOCATIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALLOCATIONS)