From 0b46440b329e3a7810a14fa601e2789550df817d Mon Sep 17 00:00:00 2001 From: Junjie Mao Date: Fri, 23 Jul 2021 16:20:34 +0800 Subject: [PATCH] board_inspector: strip an end tag when concat resource templates Resource template buffers always end with an end tag. Concatenation of two resource buffers thus requires that the end tag of the first buffer is stripped. This patch adds this logic to the interpretation of DefConcatRes AML nodes. Tracked-On: #6287 Signed-off-by: Junjie Mao --- .../board_inspector/acpiparser/aml/interpreter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/misc/config_tools/board_inspector/acpiparser/aml/interpreter.py b/misc/config_tools/board_inspector/acpiparser/aml/interpreter.py index 5b1a9665b..3f69dabb0 100644 --- a/misc/config_tools/board_inspector/acpiparser/aml/interpreter.py +++ b/misc/config_tools/board_inspector/acpiparser/aml/interpreter.py @@ -432,7 +432,11 @@ class ConcreteInterpreter(Interpreter): def DefConcatRes(self, tree): data = bytearray() source1 = self.interpret(tree.children[0]) - data.extend(source1.to_buffer().get()) + buf = source1.to_buffer().get() + if len(buf) >= 2 and buf[-2] == 0x79: + data.extend(buf[:-2]) + else: + data.extend(buf) source2 = self.interpret(tree.children[1]) data.extend(source2.to_buffer().get()) result = Buffer(data)