From 1ad836e9a8e0b8c2e6a7feac32fcc7e15430561d Mon Sep 17 00:00:00 2001 From: Junjie Mao Date: Wed, 21 Jul 2021 14:17:32 +0800 Subject: [PATCH] board_inspector: fix scope opening in the AML parser According to section 19 of ACPI spec 6.4, the following clauses open name scopes (in addition to the Scope clauses). - Function - Device - Method - Power Resource - Thermal Zone The current AML parser only opens a scope when parsing DefMethod and DefDevice, however. This patch fixes the AML parsing by opening a scope on visiting a DefPowerRes or DefThermalZone clause. Note: Functions in ASL are equivalent to Methods at AML level. Tracked-On: #6298 Signed-off-by: Junjie Mao --- .../config_tools/board_inspector/acpiparser/aml/parser.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/misc/config_tools/board_inspector/acpiparser/aml/parser.py b/misc/config_tools/board_inspector/acpiparser/aml/parser.py index d122537c7..9ee5505b2 100644 --- a/misc/config_tools/board_inspector/acpiparser/aml/parser.py +++ b/misc/config_tools/board_inspector/acpiparser/aml/parser.py @@ -588,10 +588,18 @@ def DefOpRegion_hook_named(context, tree, name): def DefPowerRes_hook_named(context, tree, name): sym = NamedDecl(name, tree) context.register_symbol(sym) + context.change_scope(name) + +def DefPowerRes_hook_post(context, tree): + context.pop_scope() def DefThermalZone_hook_named(context, tree, name): sym = NamedDecl(name, tree) context.register_symbol(sym) + context.change_scope(name) + +def DefThermalZone_hook_post(context, tree): + context.pop_scope() ################################################################################ # Instantiate parsers