Commit graph

106 commits

Author SHA1 Message Date
Eileen Yoon
a4fb7af657 hv/trace_dcp: Fix afk/epic API breakage
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
7298f42ce7 hv/trace_aop: Handle afk/epic API breakage
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
16a6b41c98 m1n1/avd: Add initial AVD driver prototype/tracer
Not much to see here, most of the juice is over at:

    https://github.com/eiln/avd.git

The kernel driver (m1n1.fw.avd) only really pipes the instruction stream
into the respective hardware FIFOs and then hushes the interrupt lines.
Most of the work (bitstream syntax parsing and instruction generation)
is done in the avid repo above.

I'm hoping to keep this userland-kernel separation in the very imminent
actual driver.

experiments/avd.py: Decode on the command line. Read file for usage.
experiments/avd_e.py: Decode via emulated instruction stream.
experiments/avd_f.py: Decode via Cortex-M3 firmware (for debugging).
hv/trace_avd.py: Tracer. Read file for usage.
m1n1/fw/avd/__init__.py: Driver base class (power, tunables, etc).
m1n1/fw/avd/decoder.py: Codec-specific decode logic + mini media player.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-01-11 16:20:49 +09:00
Josh Soref
e52eaf4f43 Spelling fixes
Correct misspellings identified by the check-spelling action.

Signed-off-by: Josh Soref <jsoref@gmail.com>
2023-12-13 16:50:42 +09:00
Hector Martin
71125063e4 hv/trace_mtp.py: New experiment
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-12-03 19:36:22 +09:00
Janne Grunau
2b92f4b1c3 hv/dcp: Add OOB ASYNC call context
Only observed with dcp/dptx in linux after initialisation and reset in
m1n1. On the initial startup dcp sends two D576 (hotPlug_notify_gated)
presumendly due to state confusion due to  the multiple dptx
connections.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-11-27 13:33:08 +09:00
Hector Martin
e378605d70 hv/trace_wlan.py: Backplane tracing & more
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-10-05 14:11:59 +09:00
Eileen Yoon
51b6dd8701 isp: Initial commit
Add initial stream demo + patched tracer

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2023-10-05 14:02:49 +09:00
Janne Grunau
fb6e035950 hv/trace_dcp: Support commands with retcode only replies
Seen with the SetProperty command of DCP's system EP.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
ea5c9be657 hv/trace_dcp: simplify tracing of dcpext*
It's now enough to change the variable dcp_name to dcpext[0-7].
'dcpext' on t8103/t8112 is handled by "/aliases" in the ADT.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
c11632947b hv/trace_dcp: port dptxport commands to macos 13.5 fw
Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
161a96a06d hv/trace_dcp: extend tracing of ap_std_calls
Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
1b10a51a51 hv/trace_dcp.py: import firmware vesrions from the HV
Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
ea063b6534 hv/trace_dcp.py: more verbose logging of AFK/EPIC endpoints
Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
1d46073077 hv/trace_dcp: Use 'elif' instead of 'if'
Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
34b0204c27 proxy: hv: Add trace_dptx.py for tracing dptx-phy on j473/t8112
Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Martin Povišer
526f81f51e m1n1.hw.codecs: Add iMac codec
Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:50:09 +09:00
Asahi Lina
538693a05a hv/trace_agx{_defer}.py: Enable command dumps
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-07-11 01:49:13 +09:00
Asahi Lina
cc1284f264 hv/trace_agx_defer.py: Exclude context ID 1 (compositor)
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-03-06 15:15:17 +09:00
Janne Grunau
2b4ed4abbf hv/trace_cd3217: Add tracing for TI/Apple cd3217 USB type C controller
Interface (as used by macOS) is simple enough to skip register
definitions.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-01-28 10:49:04 +09:00
Janne Grunau
6f4c53279e hv/trace_dcp.py: Add support for for M2
Signed-off-by: Janne Grunau <j@jannau.net>
2023-01-28 10:48:46 +09:00
Janne Grunau
f8964ed0f9 m1n1.fw.asc: Increase DVA size to 36-bits
A single TTBR covers 36-bit address space with 16k pages. Necessary for
DCP on M2.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-01-28 10:48:46 +09:00
Janne Grunau
183991ca19 m1n1.hw.dart: Hide all DART variants behind common interface
Allows m1n1 experiments and tracers not to care about the DART variant.
Required to trace and experiment with DCP sanely on M1 and M2.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-01-28 10:48:46 +09:00
Janne Grunau
1fc26dbb1a hv/trace_dcp: Disable Disp0/DCP iboot EP tracing
Its usage in m1n1 it is incompatible with the generic EPICEp tracing.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-01-28 10:48:46 +09:00
Sasha Finkelstein
8c2ad9ada6 Add z2 touch panel tracing
Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
2022-12-24 20:45:19 +09:00
Asahi Lina
80266ff93e m1n1.constructutils: Unify version conditional syntax with Rust
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:10 +09:00
Asahi Lina
82a9bf3c26 hv/trace_agx_pwr.py: Cleanup
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:10 +09:00
Asahi Lina
6e99fde8f2 hv/trace_all_more.py: Trace more stuff
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:10 +09:00
Asahi Lina
10d772f743 hv/trace_agx_pwr.py: Messing with pstates
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:10 +09:00
Asahi Lina
5a73bd6476 hv/trace_agx_pwr.py: New HV experiment
This is intended to reverse-engineer the macOS driver's power scale
calculations.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:07 +09:00
Hector Martin
9e2eeeb911 hv/trace_pmgr.py: Get rid of pwrgate stuff
It's broken

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-12-04 13:10:59 +09:00
Martin Povišer
fc66046d76 experiments/aop.py: Extend AOP experiment, add tracer
The AOP uses an 'EPIC' protocol similar to the one other coprocessor
firmware is using but not in the exact same version. Add code for
tracing the AOP calls and extend the aop.py experiment with the client
side of it. Include description of audio calls and some other calls
related to sensor discovery.

Furthermore, in experiments/aop.py, do some AOP audio setup. Once that
is done we can start streaming samples from the internal microphones by
making what AOP considers power state adjustment calls. That is, we
adjust the power state of a 'hpai' device, first to a 'pw1 ' stage,
then to 'pwrd' stage.

So, to see microphone samples, enter the AOP experiment shell first:

  $ M1N1DEVICE=/dev/ttyACM0 experiments/aop.py

Within the shell, adjust the power state of 'hpai':

  >>> aop_set_audio_pstate('hpai', 'pw1 ')

At that point /arm-io/admac-aop-audio powers up. In parallel to the AOP
shell, we can start tools/admac_stream.py on the just powered-up ADMAC
instance:

  $ M1N1HEAP=0x10010000000 M1N1DEVICE=/dev/ttyACM1 tools/admac_stream.py \
        --node admac-aop-audio --channel 1 -v | xxd -g 4 -c 12 -e

Returning back to the AOP shell, we can then set 'hpai' to 'pwrd' state
to kick off the streaming:

  >>> aop_set_audio_pstate('hpai', 'pwrd')

By that point, we should see samples coming out on the ADMAC end. The
samples are 32-bit floats packed in groups of three in a frame, e.g.

00000000: ba7ac6a7 ba32d3c3 baa17ae2  ..z...2..z..
0000000c: 38ccea5f b99c1a37 ba0c4bb1  _..87....K..
00000018: 39d2354f 3964b5ff 39b209fb  O5.9..d9...9
00000024: b96a1d1f 39c8503f 3958fc4f  ..j.?P.9O.X9
00000030: b6b1f5ff 39c72b8f 39bbe017  .....+.9...9
0000003c: 3a912de5 36dd4f7f 37f1147f  .-.:.O.6...7

This has been tested and will to some degree be specific to 2021 Macbook
Pro (t6000). Differences on other models TBD (at the very least the
number of microphones can be presumed different).

Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-11-04 12:36:49 +09:00
Kellerman Rivero
404ab21fe4 hv/trace_isp.py: add ISP tracer
Image Signal Processor is a co-processor in charge of Facetime camera
in Apple laptops. This tracer is based on ISP found in M1 processor.

The ISP in M1 SoC exposes seven inter-process communication channels.
Using those channels Application Processor (AP) can perform a variety of
task in the ISP and viceversa. All channels seems to be bidirectional, with
unique exception of TERMINAL channel.

DART translation is used often to translate control structures passed
over IPC channels to IO virtual addresses.

How those channels are used is still unclear but tracer should allow us
to dive deep on high-level protocol to communicate with Facetime camera.
ISP exposes also some I2C peripheral and SPMI registers but I haven't
dive into their working or purpose.

Signed-off-by: Kellerman Rivero <krsloco@gmail.com>
2022-11-04 12:30:59 +09:00
Hector Martin
0fb9bf6c40 hv/trace_wlan.py: More WLAN tracer stuff
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-10-23 17:22:14 +09:00
Sven Peter
ded7e58e90 trace_dcp: Add dcpdptx-hdcp-auth-session tracer
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-09-28 01:21:23 +09:00
Sven Peter
c1e84bf79c trace_dcp: Add dcpav-controller-epic tracer
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-09-28 01:21:23 +09:00
Sven Peter
c8d606e270 trace_dcp: Add dcpdp-device-epic tracer
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-09-28 01:21:23 +09:00
Sven Peter
3e112460cd trace_dcp: Add dcpav-audio-interface-epic tracer
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-09-28 01:21:23 +09:00
Sven Peter
f072434647 trace_dcp: Add dcpdptx-port-epic tracer
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-09-28 01:21:23 +09:00
Sven Peter
da8a691023 trace_dcp: Rename EPIC endpoints
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-09-28 01:21:23 +09:00
Sven Peter
f5ed6f89b0 trace_dcp: Add SilentEp to shut individual tracers up
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-09-28 01:21:23 +09:00
Sven Peter
b5e16b2a67 trace_dcp: Add EPICServiceTracer
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-09-28 01:21:23 +09:00
Sven Peter
e1ad6e7e90 trace_dcp: Allow to switch to dcpext
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-09-28 01:21:23 +09:00
Asahi Lina
88603e153c hv/trace_agx_defer.py: Add another tracer variant
This one configures it to stop tracing after init, good for
self-contained tests

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-09-27 06:02:28 +09:00
Hector Martin
50f02bb58a hv/trace_wlan.py: Add WLAN tracer
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-09-19 19:24:15 +09:00
Hector Martin
ddb3497794 hv/trace_codecs.py: Disable time stealing
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-09-14 11:55:35 +09:00
Sven Peter
44781f2b72 proxyclient/trace_atc: Add dwc3 PIPEHANDLER regs
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-08-30 22:31:36 +09:00
Sven Peter
236e01808e proxyclient/trace_atc: Change default settings
Trace async because we don't care about DMA buffers yet and disable
dwc3 tracing by default since that's relatively boring.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-08-30 22:31:36 +09:00
Sven Peter
0aa91e5b98 proxyclient/trace_atc: Add more ATCPHY registers
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-08-30 22:31:36 +09:00
Sven Peter
443194a8cd proxyclient/trace_atc: Split register definitions from trace_atc.py
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-08-30 22:31:36 +09:00