Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse some SIO/DMA-related data in ADT #354

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions proxyclient/m1n1/adt.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,47 @@
"pad" / Array(3, Hex(Int8ul)),
)

SIODMAShimData = Struct(
"name" / FourCC,
"base" / Hex(Int64ul),
"length" / Hex(Int64ul),
"unk1" / Hex(Int32ul),
"unk2" / Hex(Int32ul),
"unk3" / Hex(Int32ul),
"stride" / Hex(Int32ul),
)

SIOMapRange = Struct(
"unk1" / FourCC,
"addr" / Hex(Int64ul),
"len" / Hex(Int64ul),
)

SIODeviceType = Struct(
"id" / FourCC,
"count" / Int32ul,
"unk2" / Hex(Int32ul),
)

ASCSegmentRange = Struct(
"pa" / Hex(Int64ul),
"unk" / Hex(Int64ul),
"iova" / Hex(Int64ul),
"size" / Hex(Int32ul),
"flags" / Hex(Int32ul),
)

DMAChannelsData = Struct(
"channo" / Hex(Int32ul),
"datashape" / Hex(Int32ul),
"timeout" / Hex(Int32ul),
"limit" / Hex(Int32ul),
"threshold" / Hex(Int32ul),
"unk1" / Hex(Int32ul),
"unk2" / Hex(Int32ul),
"unk3" / Hex(Int32ul),
)

DEV_PROPERTIES = {
"pmgr": {
"*": {
Expand Down Expand Up @@ -343,6 +384,13 @@
"apcie-*-tunables": GreedyRange(TunableLocal),
}
},
"sio": {
"*": {
"map-range": SIOMapRange,
"device-type": SafeGreedyRange(SIODeviceType),
"dmashim": SafeGreedyRange(SIODMAShimData),
}
},
}

def parse_prop(node, path, node_name, name, v, is_template=False):
Expand Down Expand Up @@ -440,6 +488,12 @@ def parse_prop(node, path, node_name, name, v, is_template=False):
# parsing this correctly would require a second pass
t = Array(len(v) // 4, Int32ul)

elif name == "dma-channels":
t = SafeGreedyRange(DMAChannelsData)

elif name == "segment-ranges":
t = SafeGreedyRange(ASCSegmentRange)

if t is not None:
v = Sequence(t, Terminated).parse(v)[0]
return t, v
Expand Down
Loading