Skip to content

Commit 595ecb4

Browse files
committed
m1n1.adt: Fix the weird DAPF variant parsing
Looks like there is a flag bit for this... Signed-off-by: Hector Martin <[email protected]>
1 parent 7e3e9ac commit 595ecb4

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

proxyclient/m1n1/adt.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,20 @@
216216
"r0h" / Hex(Int8ul),
217217
"r0l" / Hex(Int8ul),
218218
"unk4" / Hex(Int8ul),
219-
# ???
220-
"pad" / If(this.r20 == 0x20, Hex(Int32ul)),
219+
)
220+
221+
DAPFT8110B = Struct(
222+
"start" / Hex(Int64ul),
223+
"end" / Hex(Int64ul),
224+
"r20" / Hex(Int32ul),
225+
"unk1" / Hex(Int32ul),
226+
"r4" / Hex(Int32ul),
227+
"unk2" / Array(5, Hex(Int32ul)),
228+
"unk3" / Hex(Int8ul),
229+
"r0h" / Hex(Int8ul),
230+
"r0l" / Hex(Int8ul),
231+
"unk4" / Hex(Int8ul),
232+
"pad" / Hex(Int32ul),
221233
)
222234

223235
DEV_PROPERTIES = {
@@ -317,11 +329,6 @@
317329
"apcie-*-tunables": GreedyRange(TunableLocal),
318330
}
319331
},
320-
"dart*": {
321-
"*": {
322-
"dapf-instance-*": GreedyRange(DAPFT8110),
323-
}
324-
},
325332
}
326333

327334
def parse_prop(node, path, node_name, name, v, is_template=False):
@@ -399,6 +406,16 @@ def parse_prop(node, path, node_name, name, v, is_template=False):
399406
st = Hex(Int64ul) if sc == 2 else Array(sc, Hex(Int32ul))
400407
t = SafeGreedyRange(Struct("bus_addr" / at, "parent_addr" / pat, "size" / st))
401408

409+
elif name.startswith("dapf-instance-"):
410+
try:
411+
flags = node.dart_options
412+
except AttributeError:
413+
return None, v
414+
if flags & 0x40:
415+
t = GreedyRange(DAPFT8110B)
416+
else:
417+
t = GreedyRange(DAPFT8110)
418+
402419
elif name == "interrupts":
403420
# parse "interrupts" as Array of Int32ul, wrong for nodes whose
404421
# "interrupt-parent" has "interrupt-cells" = 2

0 commit comments

Comments
 (0)