Skip to content

Commit 1288658

Browse files
committed
bluetooth: dump pipe 0 messages, seemingly correctly
Signed-off-by: R <[email protected]>
1 parent 69fd28c commit 1288658

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

proxyclient/hv/trace_bt.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,41 @@ def hook(name, iova, sz):
241241
hook('mcr', context.mcr, 0x800) # no idea size
242242
hook('mtr', context.mtr, 0x800) # i _think_ this is correct
243243

244+
self._ctx = context
245+
self._last_ring_idx = {}
246+
244247
except Exception as e:
245248
print(e)
246249

250+
def w_DOORBELL_05(self, val):
251+
val = int(val)
252+
if val & 0x20 != 0x20:
253+
print(f"UNKNOWN write to doorbell {val:X}")
254+
else:
255+
pipe = (val >> 8) & 0xFF
256+
ring_idx = (val >> 16) & 0xFFFF
257+
print(f"doorbell rung for pipe {pipe} @ {ring_idx}")
258+
259+
if pipe not in self._last_ring_idx:
260+
self._last_ring_idx[pipe] = 0
261+
262+
try:
263+
if pipe == 0:
264+
for i in range(self._last_ring_idx[pipe], ring_idx):
265+
tr_data_addr = self._ctx.mtr + 0x10 * i
266+
print(f"TR idx {i} @ iova {tr_data_addr:016X}")
267+
tr_data = self.dart_tracer.dart.ioread(STREAM, tr_data_addr, 0x10)
268+
chexdump(tr_data)
269+
270+
_, buf_addr, _ = struct.unpack("<IQI", tr_data)
271+
print(f"buf iova {buf_addr:016X}")
272+
data = self.dart_tracer.dart.ioread(STREAM, buf_addr, 0x34)
273+
chexdump(data)
274+
except Exception as e:
275+
print(e)
276+
277+
self._last_ring_idx[pipe] = ring_idx
278+
247279

248280
BTTracer = BTTracer._reloadcls()
249281

0 commit comments

Comments
 (0)