m1n1.fw.agx: Initial 13.2 structure changes

Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
Asahi Lina 2023-01-20 16:30:50 +09:00
parent e22d2fe049
commit 1400b50157
3 changed files with 44 additions and 14 deletions

View file

@ -8,6 +8,11 @@ from .cmdqueue import *
__all__ = ["channelNames", "channelRings", "DeviceControlMsg", "EventMsg", "StatsMsg"]
if Ver.check("G >= G14 && V >= V13_2"):
RunCmdQueueSize = 0x40
else:
RunCmdQueueSize = 0x30
class RunCmdQueueMsg(ConstructClass):
subcon = Struct (
"queue_type" / Default(Int32ul, 0),
@ -17,6 +22,7 @@ class RunCmdQueueMsg(ConstructClass):
"event_number" / Default(Int32ul, 0),
"new_queue" / Default(Int32ul, 0),
"data" / HexDump(Default(Bytes(0x18), bytes(0x18))),
Ver("G >= G14 && V >= V13_2", ZPadding(0x10)),
)
TYPES = {
@ -45,7 +51,8 @@ class DC_DestroyContext(ConstructClass):
"unk_14" / Hex(Int32ul),
"unk_18" / Hex(Int32ul),
"context_addr" / Hex(Int64ul),
"rest" / HexDump(Default(Bytes(0xc), bytes(0xc)))
"rest" / HexDump(Default(Bytes(0xc), bytes(0xc))),
Ver("G >= G14 && V >= V13_2", ZPadding(0x10)),
)
class DC_Write32(ConstructClass):
@ -57,7 +64,8 @@ class DC_Write32(ConstructClass):
"unk_14" / Int32ul,
"unk_18" / Int32ul,
"unk_1c" / Int32ul,
"rest" / HexDump(Default(Bytes(0x10), bytes(0x10)))
"rest" / HexDump(Default(Bytes(0x10), bytes(0x10))),
Ver("G >= G14 && V >= V13_2", ZPadding(0x10)),
)
class DC_Write32B(ConstructClass):
@ -69,13 +77,15 @@ class DC_Write32B(ConstructClass):
"unk_14" / Int32ul,
"unk_18" / Int32ul,
"unk_1c" / Int32ul,
"rest" / HexDump(Default(Bytes(0x10), bytes(0x10)))
"rest" / HexDump(Default(Bytes(0x10), bytes(0x10))),
Ver("G >= G14 && V >= V13_2", ZPadding(0x10)),
)
class DC_Init(ConstructClass):
subcon = Struct (
"msg_type" / Const(0x19, Int32ul),
"data" / HexDump(Default(Bytes(0x2c), bytes(0x2c)))
"data" / HexDump(Default(Bytes(0x2c), bytes(0x2c))),
Ver("G >= G14 && V >= V13_2", ZPadding(0x10)),
)
class DC_09(ConstructClass):
@ -84,13 +94,15 @@ class DC_09(ConstructClass):
"unk_4" / Int64ul,
"unkptr_c" / Int64ul,
"unk_14" / Int64ul,
"data" / HexDump(Default(Bytes(0x14), bytes(0x14)))
"data" / HexDump(Default(Bytes(0x14), bytes(0x14))),
Ver("G >= G14 && V >= V13_2", ZPadding(0x10)),
)
class DC_Any(ConstructClass):
subcon = Struct (
"msg_type" / Int32ul,
"data" / HexDump(Default(Bytes(0x2c), bytes(0x2c)))
"data" / HexDump(Default(Bytes(0x2c), bytes(0x2c))),
Ver("G >= G14 && V >= V13_2", ZPadding(0x10)),
)
class DC_1e(ConstructClass):
@ -98,22 +110,30 @@ class DC_1e(ConstructClass):
"msg_type" / Const(0x1e, Int32ul),
"unk_4" / Int64ul,
"unk_c" / Int64ul,
"data" / HexDump(Default(Bytes(0x1c), bytes(0x1c)))
"data" / HexDump(Default(Bytes(0x1c), bytes(0x1c))),
Ver("G >= G14 && V >= V13_2", ZPadding(0x10)),
)
class DC_UpdateIdleTS(ConstructClass):
subcon = Struct (
"msg_type" / Const(0x23, Int32ul),
"data" / HexDump(Default(Bytes(0x2c), bytes(0x2c))),
Ver("G >= G14 && V >= V13_2", ZPadding(0x10)),
)
class UnknownMsg(ConstructClass):
subcon = Struct (
"msg_type" / Hex(Int32ul),
"data" / HexDump(Bytes(0x2c)),
Ver("G >= G14 && V >= V13_2", ZPadding(0x10)),
)
DeviceControlMsg = FixedSized(0x30, Select(
if Ver.check("G >= G14 && V >= V13_2"):
DeviceControlSize = 0x40
else:
DeviceControlSize = 0x30
DeviceControlMsg = FixedSized(DeviceControlSize, Select(
DC_DestroyContext,
DC_Init,
DC_UpdateIdleTS,
@ -399,8 +419,8 @@ channelNames = [
CHANNEL_COUNT = len(channelNames) - 1
channelRings = (
[[(RunCmdQueueMsg, 0x30, 0x100)]] * 12 + [
[(DeviceControlMsg, 0x30, 0x100)],
[[(RunCmdQueueMsg, RunCmdQueueSize, 0x100)]] * 12 + [
[(DeviceControlMsg, DeviceControlSize, 0x100)],
[(EventMsg, 0x38, 0x100)],
[
(FWLogMsg, 0xd8, 0x100), # unk 0

View file

@ -466,9 +466,11 @@ class CommandQueueInfo(ConstructClass):
"unk_94" / Int32ul,
"pending" / Int32ul,
"unk_9c" / Int32ul,
Ver("V >= V13_2", "unk_a0_0" / Int32ul),
"gpu_context_addr" / Hex(Int64ul), # GPU managed context, shared between 3D and TA. Passed to DC_DestroyContext
"gpu_context" / ROPointer(this.gpu_context_addr, GPUContextData),
"unk_a8" / Int64ul
"unk_a8" / Int64ul,
Ver("V >= V13_2", "unk_b0" / Int32ul),
# End of struct
)
@ -490,8 +492,10 @@ class CommandQueueInfo(ConstructClass):
self.unk_94 = 0
self.pending = 0
self.unk_9c = 0
self.unk_a0_0 = 0
self.set_prio(0)
self.unk_a8 = 0
self.unk_b0 = 0
def set_prio(self, p):
if p == 0:

View file

@ -621,6 +621,7 @@ class AGXHWDataA(ConstructClass):
"t81xx_data" / AGXHWDataT81xx,
"unk_dd0" / HexDump(Bytes(0x40)),
Ver("V >= V13_2", "unk_e10_pad" / HexDump(Bytes(0x10))),
Ver("V >= V13_0B4", "unk_e10_0" / AGXHWDataA130Extra),
"unk_e10" / HexDump(Bytes(0xc)),
"fast_die0_sensor_mask64_2" / Int64ul,
@ -944,6 +945,7 @@ class AGXHWDataA(ConstructClass):
self.unk_dd0 = bytes(0x40)
self.unk_e10_pad = bytes(0x10)
self.unk_e10_0 = AGXHWDataA130Extra(self.max_pstate_scaled)
self.unk_e10 = bytes(0xc)
self.fast_die0_sensor_mask64_2 = chip_info.gpu_fast_die0_sensor_mask64
@ -1646,7 +1648,9 @@ class RCPowerZone(ConstructClass):
class InitData_RegionC(ConstructClass):
subcon = Struct(
"ktrace_enable" / Int32ul,
"unk_4" / HexDump(Bytes(0x24)),
"unk_4" / HexDump(Bytes(0x20)),
Ver("V >= V13_2", "unk_24_0" / Int32ul),
"unk_24" / Int32ul,
Ver("V >= V13_0B4", "unk_28_0" / Int32ul),
"unk_28" / Int32ul,
Ver("V >= V13_0B4", "unk_2c_0" / Int32ul),
@ -1666,7 +1670,7 @@ class InitData_RegionC(ConstructClass):
"unk_80" / HexDump(Bytes(0xf80)),
"unk_1000" / HexDump(Bytes(0x7000)),
"unk_8000" / HexDump(Bytes(0x900)),
Ver("V >= V13_0B4", "unk_8900_0" / Int32ul),
Ver("V >= V13_0B4 && V < V13_2", "unk_8900_0" / Int32ul),
"unk_8900" / Int32ul,
"unk_atomic" / Int32ul,
"max_power" / Int32ul,
@ -1756,7 +1760,9 @@ class InitData_RegionC(ConstructClass):
avg_power_filter_tc_periods = sgx.gpu_avg_power_filter_tc_ms // period_ms
self.ktrace_enable = 0# 0xffffffff
self.unk_4 = bytes(0x24)
self.unk_4 = bytes(0x20)
self.unk_24_0 = 3000
self.unk_24 = 0
self.unk_28_0 = 1 # debug
self.unk_28 = 1
self.unk_2c_0 = 0