mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-27 00:40:17 +00:00
m1n1.trace.asc: Add support for tracing DARTless ASCs
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
b50a489f41
commit
c947f6aec3
2 changed files with 16 additions and 4 deletions
|
@ -213,6 +213,8 @@ class DART(Reloadable):
|
||||||
if tcr.BYPASS_DART or not tcr.TRANSLATE_ENABLE:
|
if tcr.BYPASS_DART or not tcr.TRANSLATE_ENABLE:
|
||||||
raise Exception(f"Unknown DART mode {tcr}")
|
raise Exception(f"Unknown DART mode {tcr}")
|
||||||
|
|
||||||
|
start = start & 0xffffffff
|
||||||
|
|
||||||
start_page = align_down(start, self.PAGE_SIZE)
|
start_page = align_down(start, self.PAGE_SIZE)
|
||||||
start_off = start - start_page
|
start_off = start - start_page
|
||||||
end = start + size
|
end = start + size
|
||||||
|
|
|
@ -139,6 +139,18 @@ class BaseASCTracer(ADTDevTracer):
|
||||||
d = ">" if direction == DIR.TX else "<"
|
d = ">" if direction == DIR.TX else "<"
|
||||||
self.log(f"{d}ep:{r1.EP:02x} {r0.value:016x} ({r0.str_fields()})")
|
self.log(f"{d}ep:{r1.EP:02x} {r0.value:016x} ({r0.str_fields()})")
|
||||||
|
|
||||||
|
def ioread(self, dva, size):
|
||||||
|
if self.dart:
|
||||||
|
return self.dart.ioread(0, dva & 0xFFFFFFFF, size)
|
||||||
|
else:
|
||||||
|
return self.hv.iface.readmem(dva, size)
|
||||||
|
|
||||||
|
def iowrite(self, dva, data):
|
||||||
|
if self.dart:
|
||||||
|
return self.dart.iowrite(0, dva & 0xFFFFFFFF, data)
|
||||||
|
else:
|
||||||
|
return self.hv.iface.writemem(dva, data)
|
||||||
|
|
||||||
def start(self, dart=None):
|
def start(self, dart=None):
|
||||||
super().start()
|
super().start()
|
||||||
self.dart = dart
|
self.dart = dart
|
||||||
|
@ -226,15 +238,13 @@ class Syslog(EP):
|
||||||
|
|
||||||
@msg(1, DIR.TX, Syslog_GetBuf)
|
@msg(1, DIR.TX, Syslog_GetBuf)
|
||||||
def GetBuf_Ack(self, msg):
|
def GetBuf_Ack(self, msg):
|
||||||
self.state.syslog_buf = msg.DVA & 0xffffffff
|
self.state.syslog_buf = msg.DVA
|
||||||
|
|
||||||
@msg(5, DIR.RX, Syslog_Log)
|
@msg(5, DIR.RX, Syslog_Log)
|
||||||
def Log(self, msg):
|
def Log(self, msg):
|
||||||
if self.tracer.dart is None:
|
|
||||||
return False
|
|
||||||
buf = self.state.syslog_buf
|
buf = self.state.syslog_buf
|
||||||
stride = 0x20 + self.state.entrysize
|
stride = 0x20 + self.state.entrysize
|
||||||
log = self.tracer.dart.ioread(0, buf + msg.INDEX * stride, stride)
|
log = self.tracer.ioread(buf + msg.INDEX * stride, stride)
|
||||||
hdr, unk, context, logmsg = struct.unpack(f"<II24s{self.state.entrysize}s", log)
|
hdr, unk, context, logmsg = struct.unpack(f"<II24s{self.state.entrysize}s", log)
|
||||||
context = context.split(b"\x00")[0].decode("ascii")
|
context = context.split(b"\x00")[0].decode("ascii")
|
||||||
logmsg = logmsg.split(b"\x00")[0].decode("ascii").rstrip("\n")
|
logmsg = logmsg.split(b"\x00")[0].decode("ascii").rstrip("\n")
|
||||||
|
|
Loading…
Reference in a new issue