Commit graph

2227 commits

Author SHA1 Message Date
Janne Grunau
31ee1499f8 display: Support the HDMI output on M2* desktop systems
On M2* desktop systems the HDMI output is not managed by dcp/dcp0. This
allows more flexibility, for example dcp on the M2 Mac mini can be
routed to the USB-C/ThunderBolt ports.
For m1n1 this adds quite ab bit of complexity. In addition to the DCP
iboot endpoint/protocol two additional endpoints have to be started.
Only the dptx-port endpoint has a meaningful AP <=> DCP communication.
In addition we start the system endpoint to optionally enable more
verbose syslog messages (if RTKIT_SYSLOG is defined).
In addition the dptx-phy or lpdptx-phy has to be programmed. Those two
phy look mostly identical. MacOS seems to use a static DP configuration
(4 lanes, HBR3*) regardless of the connected display.
The added SMC gpio support is used to power the MCDP29xx DP to HDMI
converter on.
Config  is unfortunately a mess since Apple can't name the device tree
nodes consistently. On M2 Ultra devices only the four dcpext*/dispext*
on each die are used. M2 Ultra support is untested.

* link rate might differ on t602x based devices for 8k60 support

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
517c8e5f5b smc: Add minimal smc client
Only supported operation is smc_write_u32() for turning the dp2hdmi
converter on M2 desktop systems on.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
b65c7d1edc rtkit: Support usage with SRAM
Will be used by SMC.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
41e4e25eed dcp/system: Add system endpoint
This on is boring but allows turning additional logging on.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
f46da8bbbb dcp/dpav: Add DPAV endpoint
Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
b44a862756 dcp/dptx: Add dptx-port endpoint
Based on the linux kernel implementation with updates for the macOS 13.5
based DCP firmware.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
2b58bfd24b dcp: Do not use an anonymous struct for dcp_dev_t typedef
This allows forward declarations in other headers.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
73b78abe3b afk: epic channel/interface numbers do not reset
They exceed 256 with repeated chainloading of m1n1.bin on j473. Do not
hold a service for every possible channel but keep a fixed array of 8
services identified by the channel number.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
14826241a9 afk: Add EPIC std services IOp -> AP calls
Used on dptx-port endpoint.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
7473a0779e afk: use increasing EPIC sequence numbers
Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
29b6e668f9 afk: Introduce EPIC services
To be used on the dptx-port endpoint.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
a4c4b8cd99 afk: Fix a NULL pointer dereference in adfk_epic_send()
Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
76fbc77ad2 afk: Prepare afk/epic for handling of multiple endpoints
This needs to ensure that the data processing does not block on
message retrieval from the mailbox. Command processing must not block
and have to ensure that afk_epic_command() receives the reply to its
command.
DCP's dptx-port endpoint (endpoint 0x2a) can send notifies at any time
which needs to be processed in the right context.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
84c0aa10bb afk: Sync structs/names with proxyclient's python definitions
Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
64ab7258a8 dcp: dptx-phy: make dptx_phy_set_link_rate() SoC independent
Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
00c1feca47 dcp: dptx-phy: rewrite dptx_phy_activate() for dptx/lpdptx-phy
Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
fc64fcc682 dcp: Add (lp)dptx-phy support for M2* desktops
Phy "implementation" is simplified a replay of a macos trace with on
t8112 with a 1920x1080 display.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
02cedf3f45 dcp/parser: Add parser from linux DCP required for parsing dcp AFK/EPIC
Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
4cb3dceb0a dart: limit vm-base to 36-bit io address space
Required for t602x dcp*.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
b9975760d7 rtkit: Add rtkit_can_recv()
Required non-blocking handling of multiple AFK endpoints for the same
mailbox.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
b72407ed23 display: Use dcp iboot SetSurface instead of SwapLayer
iboot uses this and it's simpler. m1n1 doesn't need to swap surfaces
for tear free display.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:33:35 +09:00
Janne Grunau
fecfa130e9 kboot: Parse "anvram" partition start and size from ADT
"nvram" size depends on the iboot version. Monterey (12.3) and earlier
used 128k nvram partition but Ventura since at least 13.2 increased the
size to 1M. Parse the values from the ADT and fill and enable the node
in the device tree.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:32:40 +09:00
Janne Grunau
0cf2302f35 adt: Use the current node's #address-cells to translate "ranges"
Fixes adt_get_reg() for the nvram partition.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-05 12:32:40 +09:00
Kevin Ji
650441daa5 makelogo.sh: Add #!/bin/bash
Signed-off-by: Kevin Ji <1146876+kevinji@users.noreply.github.com>
2023-09-20 22:35:01 +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
Janne Grunau
303d08382c experiments/dcp: add system ep
Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
4965a954e2 m1n1.fw.dcp.ipc: Add D129 - allocate_bandwidth
Used on M2 Ultra with OS DCP firmware 13.5.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
8e5788123f m1n1.fw.dcp.ipc: Clearly mark unknown Calls/Callbacks
Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
a823c311ab m1n1.fw.dcp.ipc: Add support for the macOS 13.3 firmware
Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
c159c5bbfd m1n1/fw/dcp/parse_log: Parse firmware version from log
Incomplete, needs to reload fw.dcp.ipc.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
635e046d56 m1n1.fw.dcp: Parse AVPropChunks in parse_log
Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
faec98b10c m1n1.constructutils: Add 13.5 firmware symbol
Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:33:45 +09:00
Janne Grunau
7e5d12d33e kboot: disable touchbar on missing calibration data
There is at least on Macbook Pro (M1, 13-inch) with missing
"multi-touch-calibration" in the ADT. Disabling the device as error
handling instead of refusing to boot the kernel.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-09-20 22:32:56 +09:00
Mark Kettenis
ea64e7bda4 m1n1.asm: make it work again on OpenBSD
Using llvm from ports.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2023-09-07 19:19:38 +09:00
Hector Martin
24a3a0d962 kboot: Move MCC cache enable to kboot
Following the general "do more in stage2/kboot, do less in stage1/proxy"
rule. In case something goes wrong here we want to be able to fix it in
stage2.

Thanks to the stupid bug, the past year+ of stage1 installs has had this
codepath disabled, so that works well with this change.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-09-05 23:33:19 +09:00
Hector Martin
655299382d mcc: Initialize cache_disable for t60xx
Shouldn't matter since this should be zero-initialized anyway, but
clearer.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-09-04 03:51:31 +09:00
Hector Martin
99e659ae01 mcc: Add missing cache disable reg (?) for t8112
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-09-04 03:24:03 +09:00
Hector Martin
0ec145974a mcc: Fix for t602x
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-09-04 02:43:25 +09:00
Hector Martin
1d2b8f91f6 mcc: Actually enable the caches.
That was dumb.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-09-04 01:08:23 +09:00
Hector Martin
00099452cb kboot: Fix missing newlines
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-08-24 20:20:56 +09:00
Hector Martin
6d0979e71e m1n1.adt: Decode apcie tunables
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-08-21 23:16:08 +09:00
Hector Martin
8ca5d671ad sio: Fix error paths
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-08-21 14:00:33 +09:00
Martin Povišer
6a61c001d2 clk: Set up LEAP/PDM clocks
Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-21 00:17:27 +09:00