Commit graph

20 commits

Author SHA1 Message Date
Janne Grunau
421dfa4252 dcp: Fix firmware mapping check on t8103/t600x
t8103 and t600x use "asc-dram-mask" in iop-dcp-nub to mask bits out of
DMA addresses. This needs to be used in the firmware mappings
check/remap since the segments have maskable bits sets.

Fixes: 8332e24 ("dcp: Undo carnage from bad stage1 DART code")
Signed-off-by: Janne Grunau <j@jannau.net>
2024-05-18 14:51:24 +09:00
Hector Martin
8332e2454c dcp: Undo carnage from bad stage1 DART code
A bug in our DART code was wiping and aliasing page tables. Go through
the segment ranges for DCP and redo any missing mappings. If we redid
any mappings, then PMGR reset DCP so it can recover from having faulted
on the previous boot.

Signed-off-by: Hector Martin <marcan@marcan.st>
2024-05-17 01:57:34 +09:00
Janne Grunau
5006e083c7 display: Use dcpext0 for HDMI out on t8112/t6020/t6021
dcpext0 behaves like dcp on M1* devices and can sleep after display
init. This has the advantage of not breaking macOS when starting with an
initialized display.
dcpext* are according to Apple's tech specs slightly more powerful than
dcp. They are advertised as 6K at 60Hz while dcp seems to be limited to
5K at 60Hz.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-11-27 13:33:08 +09:00
Janne Grunau
5245fc6a58 dcp: Pass the die number for dptx' connectTo method
Apperently just informative as display init on M2 Ultra in m1n1 worked
as expected despite passing '0' as die number.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-11-27 13:33:08 +09:00
Janne Grunau
8c99a189e0 dptx: Add the number of dptxport services
Avoids waiting 500 ms for the second dptxport service on t6020 and
possibly t6021.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-11-14 18:57:15 +09:00
Janne Grunau
1ea734296a dcp: Fix shutdown sequence on dptx errors
Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-13 16:33:09 +09:00
Janne Grunau
50ac69eaa5 dcp: Wait 25ms after enabling dcp/dptx-phy power-domains
Fixes display initialization from stage 1 m1n1. 20ms looked reliable on
j473 but let's add 25% safety margin. Someone with more motivation (and
HW serial) to do repeated `kmutil configure-boot ...` can try to
minimize this and test on t602x.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-10-07 21:56:19 +09:00
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
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
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
bff8aa647c dcp: Offset temporary IOVA space from vm-base
Required on M2 devices.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
6466f8dec8 dcp: Parse dart SID for DCP
Required for M2 which for which the dice showed "5".

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
72cdec0e31 dart: Use "vm-base" as start when installing L2 tables
Additional L2 tables for dart-dcp/disp0 need to be from carveout memory
so they can kept after m1n1 exist. iboot has "pt-region-X" and "l2-tt-X"
in the ADT. For DCP on M2 we have to start installing them at "vm-base"
which is 0x8_0000_0000.
This probably causes problems on M2 Pro which uses 1 << 40 as vm-base
for dart-dcp0.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Hector Martin
714420a694 display: Put DCP to sleep if display is external
This stops DCP from killing our modeset if the connection cycles.

Also force a (potential) configure cycle if the display is external;
this makes sure updated stage2s will have a chance at fixing issues of
old stage1s. Modesetting is fast when it's the same mode as before.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-06-01 01:54:11 +09:00
Hector Martin
7023e247bb rtkit: Align naming with Linux version
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-06-01 00:57:17 +09:00
Janne Grunau
7f4347ebe8 display: Reallocate framebuffer if required for wanted display mode
If an explicitly specified display mode exceeds the allocated
framebuffer allocate a new one from the top of RAM.

Note: macOS panics immediately with a realloced framebuffer.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-05-30 23:01:01 +09:00
Janne Grunau
d08793a456 dcp: Free iovad_dcp including dart L2 tables on shutdown
Signed-off-by: Janne Grunau <j@jannau.net>
2022-05-30 23:01:01 +09:00
Janne Grunau
9356e60803 dcp: Limit dcp iovad to 256M
Does not make a difference but avoids effort on shutdown.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-05-30 23:01:01 +09:00
Sven Peter
2c28e13d25 rtkit: add rtkit_{hibernate,sleep} and use them for DCP and ANS2
s/IDLE/HIBERNATE/ to keep in sync with the Linux driver and then
hibernate DCP but send ANS2 to sleep to allow reusing both.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-18 11:35:45 +09:00
Hector Martin
eaadc43fbb dcp: Add DCP and iBoot protocol support
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00