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 <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao 2021-07-23 16:20:34 +08:00 committed by wenlingz
parent 774b60ac2d
commit 0b46440b32
1 changed files with 5 additions and 1 deletions

View File

@ -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)