Skip to content

Commit 0e47152

Browse files
hoshinolinamarcan
authored andcommitted
m1n1.trace.isp: Hexdump to HV log
Signed-off-by: Asahi Lina <[email protected]>
1 parent 204f6b8 commit 0e47152

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

proxyclient/m1n1/trace/isp.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,17 @@ def dump(self):
4848
class ISPIOCommand(ISPCommand):
4949
def __init__(self, chan, msg, direction):
5050
super().__init__(chan, msg, direction)
51-
self.contents = self.read_iova(self.iova, self.arg1)
51+
self.contents = self.read_iova(self.iova, max(self.arg1, 8))
5252

5353
def dump(self):
5454
if self.iova:
5555
opcode = struct.unpack("<Q", self.contents[:0x8])[0] >> 32
5656
self.log(f"[IO iova: {hex(self.iova)}, insize: {hex(self.arg1)}, outsize: {hex(self.arg2)} -> opcode: {hex(opcode)} {opcode2name(opcode)}]")
5757
self.log("IO struct: ")
5858
try:
59-
chexdump32(self.contents)
59+
chexdump32(self.contents, print_fn=self.log)
6060
except struct.error:
61-
print(chexdump(self.contents))
61+
chexdump(self.contents, print_fn=self.log)
6262

6363
class ISPT2HBufferCommand(ISPCommand):
6464
def __init__(self, chan, msg, direction):
@@ -70,7 +70,7 @@ def dump(self):
7070
super().dump()
7171
if self.contents:
7272
self.log("BUF_T2H struct:")
73-
chexdump32(self.contents)
73+
chexdump32(self.contents, print_fn=self.log)
7474

7575
class ISPH2TBufferCommand(ISPCommand):
7676
def __init__(self, chan, msg, direction):
@@ -82,7 +82,7 @@ def dump(self):
8282
super().dump()
8383
if self.contents:
8484
self.log("BUF_H2T struct:")
85-
chexdump32(self.contents)
85+
chexdump32(self.contents, print_fn=self.log)
8686

8787
class ISPT2HIOCommand(ISPCommand):
8888
def __init__(self, chan, msg, direction):
@@ -225,7 +225,7 @@ def w_ISP_GPIO_0(self, val):
225225
if (val.value >= 0xe00000) and (val.value <= 0x1100000): # dunno
226226
self.log("ISP bootargs at 0x%x:" % val.value)
227227
bootargs = self.dart.ioread(0, val.value, 0x200) # justt in case
228-
chexdump32(bootargs)
228+
chexdump32(bootargs, print_fn=self.log)
229229
x = ISPIPCBootArgs.parse(bootargs[:ISPIPCBootArgs.sizeof()])
230230
self.log(x)
231231

proxyclient/m1n1/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,17 @@ def ehexdump(s, st=0, abbreviate=True, indent="", print_fn=print):
189189
last = val
190190
skip = False
191191

192-
def chexdump32(s, st=0, abbreviate=True):
192+
def chexdump32(s, st=0, abbreviate=True, print_fn=print):
193193
last = None
194194
skip = False
195195
for i in range(0,len(s),32):
196196
val = s[i:i+32]
197197
if val == last and abbreviate:
198198
if not skip:
199-
print("%08x *" % (i + st))
199+
print_fn("%08x *" % (i + st))
200200
skip = True
201201
else:
202-
print("%08x %s" % (
202+
print_fn("%08x %s" % (
203203
i + st,
204204
hexdump32(val, ' ')))
205205
last = val

0 commit comments

Comments
 (0)