Commit graph

866 commits

Author SHA1 Message Date
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
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
Martin Povišer
f7824561af afk: Add missing wptr wraparound
Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:57:12 +09:00
Martin Povišer
264e18169f afk: Fix ringbuf space checks in afk_epic_tx
Redo the checks to make sure we never cause rptr==wptr, because that
signifies an empty buffer, not a full one.

Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:57:12 +09:00
Martin Povišer
07ea5a92c3 afk: Fix edge case in ringbuf pointer assert
Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:57:12 +09:00
Martin Povišer
fd0ae3663a afk: Drop stray 'rptr' field
Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:57:12 +09:00
Martin Povišer
d29df8e69b sio: Use 'FDT' in prints consistently
Both 'DT:' and 'FDT:' are in use as prefices in prints that relate to
the non-Apple devicetree. Put in 'FDT:' everywhere for consistence.

Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Martin Povišer
8f8c3f903d kboot: Look up SIO by alias
Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Martin Povišer
1ba260c090 sio: Add missing exit on bad ADT data
Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Martin Povišer
94cf41e124 kboot: Postpone setting of /memory
Postpone the setting of the /memory node so that any allocations made
in course of the devicetree prep (e.g. the SIO reservations allocated
from the top of memory) are reflected in the usable memory span that's
set on the /memory node.

Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Martin Povišer
9f12d5b3ff sio: Move to 'copy rules'
Summarize the preparation of SIO firmware data in a table of 'copy
rules'.

Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Martin Povišer
8824bd2dbf sio: Allocate from top of memory
Place the firmware data we are preparing at the top of memory.

Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Martin Povišer
fa820a7164 display: Factor out top of memory allocation
Move it into utils.c before we reuse it for SIO data.

Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Martin Povišer
731f1c4761 kboot: Fix dt_device_set_reserved_mem error print
Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Martin Povišer
39f4919fc1 sio: Set up auxiliary SIO data in FDT
On kboot, parse the ADT for SIO firmware parameters, set up the expected
data structures for SIO consumption in reserved memory, and pass those
in properties of the SIO FDT node.

Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Martin Povišer
44f65b1875 kboot: Make filling in of memory-region-names optional
Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Martin Povišer
9ccef6b8bd kboot: Split dt_device_set_reserved_mem
Make dt_device_set_reserved_mem take in an explicit iova instead of
reading it off from a DART. Add a separate 'from_dart' variety of the
function for getting the iova from DART.

Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Martin Povišer
aa64faba4b kboot: Reserve SIO firmware
Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Martin Povišer
8be10f5fa9 kboot: Add dt_reserve_asc_firmware
The new function parses ADT's segment-ranges and builds up nodes in
/reserved-memory representing the appropriate physical and device
address spans. This is to describe the memory placement of ASC firmware.

Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-08-17 19:49:43 +09:00
Asahi Lina
925fe72b0b src/hv_vm: Fix some instruction emulations
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-08-17 19:46:07 +09:00
Asahi Lina
5a389fe87b kboot_gpu: Add another pwcalc difference for T602x
This doesn't make any sense... M2 Ultra should be 2x M2 Max, so there's
no reason for this constant to be different.

I get the feeling Apple messed this one up too...

Also clean up some other constants.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-08-17 19:46:07 +09:00
Asahi Lina
db49377e5a kboot_gpu: Fixes for >1 die t602x
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-08-17 19:46:07 +09:00
Hector Martin
8e3016e323 pcie: T602X APCIE-GE support
Maybe maybe?

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-08-07 21:05:25 +09:00
Hector Martin
721107aa0a kboot_gpu: Fixes for T6022
This is still blind. Lina send help.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-08-07 19:27:47 +09:00
Hector Martin
bb0e9ace57 display: Make M2+ desktop disable hack more generic
This should work on the Mac Pro.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-08-07 19:27:47 +09:00
Hector Martin
9b73944684 Initial t6022 support
GPU stuff is a wild guess.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-08-07 19:27:47 +09:00
Asahi Lina
28708461fc kboot_gpu: Fix core count for T8112
Oops...

Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-08-02 21:10:41 +09:00
Asahi Lina
e322312c94 kboot_gpu: Do not try to set cs/afr pstates on <G14X
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-08-02 15:11:32 +09:00
Asahi Lina
86d75d4dba kboot: Add 13.5 firmware compats
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-07-20 11:54:11 +09:00
Asahi Lina
f58e213529 kboot_gpu: Power calc fixes for t6020
Looks like this is different from t6021, and now I wonder if we need to
recheck t6000...

Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-07-20 11:54:11 +09:00
Asahi Lina
dfecc20114 firmware: Add 13.5b4 and 13.5 versions
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-07-19 13:12:24 +09:00
Asahi Lina
b7389c59be kboot_gpu: Add T602x to the support list
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-06-27 18:35:01 +09:00
Asahi Lina
b35f0d7cf2 kboot_gpu: Initial T602x support
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-06-27 18:35:00 +09:00
Asahi Lina
af85202b58 math: Add powf()
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-06-27 18:35:00 +09:00
Hector Martin
88df8a6335 cpufreq: Initialize a bunch more stuff
At least some of this fixes hangs when overheating on j413. We still
don't know exactly what most of this is, but let's try to get closet to
the init that macOS does.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-06-04 20:10:39 +09:00
Hector Martin
5cd985b4db cpufreq: Redefine the dvmr flag as pcluster
We're going to use this later.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-06-04 17:03:58 +09:00
Hector Martin
7ce414224c pmgr: Add a helper to test for pmgr features in the ADT
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-06-04 17:02:48 +09:00
Hector Martin
1f154402a4 cpufreq: Drop the DVMR stuff
This is enabled by iBoot in all versions we support.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-06-04 17:02:44 +09:00
Hector Martin
a0d2ed20be payload: Do cpufreq init before smp_start_secondaries()
This also requires exporting this to the proxy so linux.py can use it.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-06-04 15:56:42 +09:00
Hector Martin
4124485265 hv: Make breadcrumbs per-CPU and introduce panic handler
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-06-03 12:47:39 +09:00
Hector Martin
2c531aa7ae hv_exc: Remove PMC0 CNT enable shadowing from fast sysreg path
This is outside the hv_exc_entry/hv_exc_exit bracketing now, so modify
the register directly. We only stop the PMCs when we go into the
slowpath.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-05-22 00:27:08 +09:00
Janne Grunau
076217a802 display: Skip init on j473/474s while it's not supported
Signed-off-by: Janne Grunau <j@jannau.net>
2023-05-16 18:23:44 +09:00
Hector Martin
48db941199 cpu_regs.h: Typo fix
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-05-05 19:20:48 +09:00
Hector Martin
50c808df2c pmgr: Power up parents before children
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-05-05 12:39:26 +09:00
Hector Martin
59e0032ba4 cpu_regs,apple_regs.json: More registers
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-05-05 04:46:11 +09:00
Hector Martin
895488aebb chickens: Change IRQ mode from 0 to 2
0 seems to misbehave when IRQs fire in EL1. 2 works as intended.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-05-05 00:32:42 +09:00
Hector Martin
abe4bb04c5 exception: Improve IRQ/FIQ log messages
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-05-05 00:31:05 +09:00
Hector Martin
ebd4613f61 proxy: Add smp_call[_sync]_el1 variants
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-05-05 00:31:05 +09:00
Janne Grunau
254a2acf18 dcp_iboot: Support macOS 13.3 DCP firmware
The macOS 13.3 DCP firmware extended swap_set_layer_cmd in an
incompatible way. Let dcp_ib_swap_set_layer() send the matching struct
based on the firmware version.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-04-27 04:11:18 +09:00
Janne Grunau
01ea1ae8df afk: Accept message type TYPE_REPLY in start_interface
The macOS 13.3 DCP firmware uses TYPE_REPLY instead of TYPE_NOTIFY for
the disp0-service interface init message.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-04-27 04:11:18 +09:00
Janne Grunau
cd8e9d6676 payload: Add a custom header with a payload size field for initramfs'
This add supports for concatenated (compressed) cpio archives and relies
on the kernel to decompress the initramfs.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-04-27 04:09:49 +09:00
Hector Martin
54f44be7d6 hv_exc: Add hv_add_time() function & proxy thunk
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-26 00:51:51 +09:00
Hector Martin
9602fb1859 hv_exc: Add a fast path for sysregs that can be handled without locking
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-25 20:08:59 +09:00
Hector Martin
b8b76f34f4 cpufreq: Correct fixup for M2 devices
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 04:44:58 +09:00
Hector Martin
bd63b119ec startup: Direct primary CPU RVBAR entry to m1n1 main
This definitely isn't going to work yet, but it's better than ending up
in the secondary loop if it ever works.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 03:21:58 +09:00
Hector Martin
06b732e788 smp: Add smp_stop_secondaries()
Doesn't work properly yet since we can't restart them...

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 03:21:58 +09:00
Hector Martin
3288548faa utils: Add cpu_sleep() function
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 03:21:58 +09:00
Hector Martin
121d20cddf cpu_regs: Make fields usable from assembler
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 02:37:02 +09:00
Hector Martin
4638632657 hv: Implement emulated guest CPU shutdown
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-19 01:21:33 +09:00
Hector Martin
cae2059c06 hv: Add a rendezvous timeout and panic on failure
Prints the CPUs that failed rendezvous, which should help debug what
caused them to go away.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 23:50:11 +09:00
Hector Martin
587da648a3 hv_exc: Be a bit more paranoid handling IPIs
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 23:38:40 +09:00
Hector Martin
b0c3f6d7ae hv: Implement ECV on M2 and later chips
This lets us eliminate HV timer ticks on secondary CPUs, which should
significantly improve the scalability of this whole thing.

(We leave them at 1Hz just in case, since that much won't hurt)

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 23:37:18 +09:00
Hector Martin
a75afff83b hv_exc: Pass through dangerous CYC_OVRD writes to Python
This makes it easier to experiment with the sleep/WFI stuff.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 23:36:55 +09:00
Hector Martin
bdf54ba7e1 usb_dwc3: Populate serial number with the actual serial number
This will be useful for CI and similar use cases, to distinguish
different machines. Also fix spurious NUL-termination of the descriptor
strings while I'm here.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 22:07:21 +09:00
Hector Martin
cf7da86eba cpufreq: Fix m1n1 stage 1 bugs
Old stage1 did cpufreq init and didn't do it right. Undo the damage in
stage2.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
9b944c5f56 payload: Pass m1n1 stage 1 version when chainloading
This might come in handy in the future.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
5a4e30a98d hv: Restore CYC_OVRD WFI mode and handle FIQ disable
Put the WFI mode back how macOS expects it on boot, since it won't set
it itself. Then, also trap attempts by macOS to disable FIQs. This
happens in the sleep/core off path. It is not sufficient to make all
that work properly, but it's a start.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
8cf0df0553 utils_asm: Save/restore CYC_OVRD register
This keeps the previous WFI setting instead of unconditionally flipping
to 3 then back to 2.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
b067f26971 cpu_regs.h: Add ACC_OVRD register
Not used yet, but might be in the future.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
cbd9b7b9e1 main, kboot: Move tunables/cpufreq/clk from main to kboot
I already screwed something up in cpufreq, and it makes it difficult to
understand what happened if it happens in stage1 before the proxy runs,
and difficult to undo in stage2.

Let's move all this stuff to kboot, since it isn't necessary until then
(and this will also avoid doing unnecessary init for macOS under the
HV). If we need it in proxy scripts, we can add proxy commands for this
later.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 21:55:12 +09:00
Hector Martin
145d39092f cpufreq: Fix a dumb bug and drop the DESIRED2 field
I don't think that field ever did anything and Apple don't set it on
newer macOS/SoCs. Also expand DESIRED1 to T602x width.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 20:45:10 +09:00
Hector Martin
b2a479f1bf chickens: Enable NEX power gating on P-cores
It seems we missed this config all along.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-18 20:45:10 +09:00
Asahi Lina
8f6e13b170 firmware: Add 13.3
This has the same iBoot version as 13.3.1, so firmwares probably did not
change.

Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-04-18 20:45:10 +09:00
Janne Grunau
1ae27426b3 kboot: Transfer touchbar calibration for t8112-j493
Signed-off-by: Janne Grunau <j@jannau.net>
2023-04-17 20:39:19 +09:00
Hector Martin
46043704da rtkit: Drop oslog support
Nobody can figure out where this code came from and it's broken for
devices where OSLog is actually implemented these days... let's drop it
and see if anything complains.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-16 21:23:46 +09:00
Mark Kettenis
91ff36b277 kboot: Make missing iommu mappings non-fatal
Fixes: 21dc622735 ("kboot: Transfer display related memory carveouts to device tree")

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2023-04-15 13:22:14 +09:00
Hector Martin
06b88f14d2 dart: Detect locked t8110 DARTs
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-12 00:40:06 +09:00
Janne Grunau
2b2dd9ae89 kboot: Add DCP reserved mem support for t602x
Signed-off-by: Janne Grunau <j@jannau.net>
2023-04-12 00:40:06 +09:00
Hector Martin
83513c36a3 nvme: Add nvme_ensure_shutdown()
We're not using it in the end because we fixed this in Linux, but I went
through the trouble of writing the function so we might as well leave it
lying around.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-12 00:40:06 +09:00
Hector Martin
c2c0ac04aa pcie: Add initial t602x support
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-12 00:40:06 +09:00
Hector Martin
046620d4d5 pmgr: Add pmgr_adt_power_{en,dis}able_index()
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-10 01:06:05 +09:00
Hector Martin
41aac76fff Bring T6020 support up to parity with T6021
Missing smp/cpufreq/soc stuff.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-09 21:05:50 +09:00
Hector Martin
dabad98d6e smp: Bump MAX_CPUS to 24
Needed for (presumed) M2 Ultra.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-09 20:37:56 +09:00
Hector Martin
481f662271 hv_vm: Fix CTRR hugepage issue
This is the hypervisor counterpart to da9ceddeac.

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-09 19:46:13 +09:00
Mario Hros
2f96635420 mcc: Reuse existing T6000 impl for T6020
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 19:46:13 +09:00
Mario Hros
049bc64e36 smp: Add T6021 CPU start offset
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 19:46:13 +09:00
Mario Hros
da03138eec cpufreq: Add T6021 clusters
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 19:46:13 +09:00
Mario Hros
e71ad13474 chickens: Add preliminary T6020 support
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 19:46:12 +09:00
Mario Hros
afb68db34c chickens: Force nonspec for rev 0x0 of Avalanche
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 19:46:12 +09:00
Mario Hros
2e040a6729 chickens: Add T6021 chickens
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 17:56:01 +09:00
Mario Hros
d033044a80 soc: Add T6021 defines
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 17:56:01 +09:00
Mario Hros
34f49a56fc nvme: assume die 0 if clock-gates not set
Signed-off-by: Mario Hros <git@reversity.org>
2023-04-09 17:56:01 +09:00
Asahi Lina
fa3dcd3e77 payload: Add tso=1 m1n1 option to enable TSO
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-03-28 19:06:20 +09:00
Asahi Lina
0a05a0171e proxy: Add smp_is_alive() thunk
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-03-28 19:06:20 +09:00
Eileen Yoon
4a679b12bd tunables_static: improve sequence iter
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2023-03-28 17:19:45 +09:00
Eileen Yoon
2abf3af38e tunables_static: add t8103 ane tunables
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2023-03-28 17:19:45 +09:00
Eileen Yoon
cf09e4ff56 tunables_static: abstraction to reuse entries
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2023-03-28 17:19:45 +09:00
Hector Martin
a633b90634 kboot: Remove leftover IPD lookup dead code
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-03-19 20:30:01 +09:00
Hector Martin
a024101b75 kboot: Pass keyboard layout ID & country code in HID device
Signed-off-by: Hector Martin <marcan@marcan.st>
2023-03-19 18:14:44 +09:00
Janne Grunau
c6c426581b pcie: Add link speed override for SD card reader
The SD card reader on Macbook Pro 14"/16" and Mac Studio uses yet
another property to override the port's "maximum-link-speed" property.
Add parsing for "expected-link-speed" and always look in the port's
first child for these properties.
Increases the link speed to PCIe 2.0 which is required for the full
bandwidth of SDXC UHS-II.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-03-12 00:32:10 +09:00
Asahi Lina
5d5fa70efa firmware: Add 13.1/13.2 to version list
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-03-06 15:15:17 +09:00
Janne Grunau
583f290b2b Add a space between '//' and '#' to satisfy clang-format 15
Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:51:08 +09:00
Janne Grunau
c8c0bd5dc5 display: Check if FB IOVA is available on dart-disp0
Fixes a copy and paste error in 1b5dee2496 checking dart-dcp twice.

Fixes: 1b5dee2496 ("display: Map the framebuffer if it is not mapped")
Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
4e7398e3a8 display: Start scanning for fb IOVA at vm-base
Required for M2 devices as the M2 Mac mini.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +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
7e33a578d8 rtkit: Extend IOVA to 36-bit
Required for DCP on M2.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
f68a842ab7 rtkit: Apply "asc-dram-mask" consistently
Required for DCP on M2 which requires 36-bit IOVA space.

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
8af2489d84 dart: Increase IO address space to 36-bit
This address space a single TTBR can hold with a 16k page size. Required
for DCP on M2.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
93abc760b2 dart: Add checks to dart_translate_internal()
Previous assumptions are not longer true with dart8110 on M2.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-02-02 09:50:33 +09:00
Janne Grunau
c3c29bbd92 dart: Allow SIDs != 0 in dart_setup_pt_region()
Required for dart-dcp on M2 and M2 Pro/Max.

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
Sasha Finkelstein
d110da1e75 copy the touchscreen calibration
Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
2023-01-28 21:58:44 +09:00
Sven Peter
90d0cd6b89 kboot: Copy ACIO tunables and DROM data
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2023-01-28 10:56:03 +09:00
Mark Kettenis
951afdd033 kboot: Add new U-Boot driver model 'phase-tags'
U-Boot is moving to a new set of tags to indicate devices that
should be bound/probed in early bootstrap phases.  Add 'bootph-all'
tags from the new bindings such that probing the serial port
early on in U-Boot continues to work and doesn't hang the system.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2023-01-22 23:54:00 +09:00
Janne Grunau
a56e3fbc78 kboot: dcp: Add "memory-region-names" properties
Signed-off-by: Janne Grunau <j@jannau.net>
2023-01-22 23:47:40 +09:00
Janne Grunau
fe38315f1c kboot: reserve framebuffer from "/vram"
Fixes dcp if m1n1 reallocated the framebuffer due to large boot display
resolution. In that case we update "/vram" but leave the carveout
unmodified.

Use "framebuffer" as compatible string as proposed in
https://lore.kernel.org/dri-devel/20221117184039.2291937-4-thierry.reding@gmail.com/

Signed-off-by: Janne Grunau <j@jannau.net>
2023-01-22 23:47:40 +09:00
Janne Grunau
d73f53d9a0 kboot: dcp: Use "apple,asc-mem" as compatible strings for reserved memory
This is in preparation for the next commit to use "framebuffer" as
compatible string for the boot framebuffer. This is in line with a
proposed change for boot framebuffer handling on Nvidia Tegra SoCs.
It will allow removing simpledrm via
drm_aperture_remove_conflicting_framebuffers().

Signed-off-by: Janne Grunau <j@jannau.net>
2023-01-22 23:47:40 +09:00
Janne Grunau
9ca6016a4e kboot: dcp: Use "apple,asc-mem" as compatible strings for reserved memory
This is in preparation for the next commit to use "framebuffer" as
compatible string for the boot framebuffer. This is in line with a
proposed change for boot framebuffer handling on Nvidia Tegra SoCs.
It will allow removing simpledrm via
drm_aperture_remove_conflicting_framebuffers().

Signed-off-by: Janne Grunau <j@jannau.net>
2023-01-22 23:47:40 +09:00
Janne Grunau
4ed1a9c862 kboot: move dt_carveout_reserved_regions() after refactoring
Signed-off-by: Janne Grunau <j@jannau.net>
2023-01-22 23:47:40 +09:00
Janne Grunau
2667b10054 kboot: refactor dt_carveout_reserved_regions()
The main part of function will be used to add a reserved memory region
for the framebuffer from "/vram" instead of the carveout.

Signed-off-by: Janne Grunau <j@jannau.net>
2023-01-22 23:47:40 +09:00
Asahi Lina
3d28ac4d6f tools/chainload.py: Properly sleep DCP when chainloading macOS
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-01-20 18:18:13 +09:00
Martin Povišer
7db691737e kboot: Transfer virtio nodes from ADT to FDT
Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-01-13 17:25:25 +09:00
Martin Povišer
6661ab14d0 hv: Add 9P virtio peripheral
Add some minimal implementation of virtio peripherals. At the level
of on-target hypervisor code we implement the MMIO layout and
maintain virtqueues. Once a buffer is available, we break into the
host proxyclient to deal with it.

Specific device-classes of the virtio spec ought to be implemented in
the proxyclient. Here the one device implemented is 9P transport,
exporting the m1n1 source directory.

Signed-off-by: Martin Povišer <povik@cutebit.org>
2023-01-13 17:25:25 +09:00
Hector Martin
fb36e30236 firmware: Add support for 12.3.1 firmware.
This includes mapping it to 12.3.0 for compat in both DCP and GPU.

Added for machines with replaced logic boards that trigger the 12.3
bootloop issue.

Also fix the 12.5/12.6 version arrays which were wrong.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-12-08 23:04:01 +09:00
Janne Grunau
426604926d kboot/dcpext: Fix mapping of dcp_txt on t8112 / M2
dcp_txt is mapped on dart-dcp and dart-dcpext so check if its reserved
memory node already exist before adding it.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-12-04 22:04:40 +09:00
Janne Grunau
159c553c6a kboot: Call dt_set_dcp_firmware() from dt_carveout_reserved_regions()
This avoids having duplicate calls for dcpext* on each mayor SoC
variant. Fixes setting firmware versions for dcpext on t8103 and t8112.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-12-04 22:04:40 +09:00
Hector Martin
2abf2b1693 kboot: Forward DCP firmware versions into the DT
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-12-04 16:06:27 +09:00
Hector Martin
e1b2c45f34 kboot_gpu: Set firmware versions from ADT
The kernel side doesn't check this yet, we'll let Lina take care of
that.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-12-04 16:06:27 +09:00
Hector Martin
c8d95baca0 kboot: Forward iBoot, firmware and m1n1 versions into the DT
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-12-04 16:06:27 +09:00
Hector Martin
c19303dc87 firmware: New module to detect firmware version
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-12-04 16:06:27 +09:00
Asahi Lina
db93de58b8 kboot_gpu: Add proper max-power and leakage calculations for t8112
This uses a similar algorithm to t600x, but with different constants and
exponents. The current limit also engages here, so add it, and add the
t600x one too (even though it is never hit).

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:10 +09:00
Asahi Lina
d20d89b704 tunables_static: Add t8112 GPU tunables
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:10 +09:00
Asahi Lina
f9862415b1 tunables_static: Add t600x GPU tunables
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:10 +09:00
Asahi Lina
e6ffbb018b kboot_gpu: Add proper max-power and leakage calculations for t600x/t8103
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:10 +09:00
Asahi Lina
057151cb21 math: Add expf() implementation from musl
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:10 +09:00
Asahi Lina
444c3c854b kboot_gpu: Dummy t8112 power calculation
This is wrong but it will do for now

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:10 +09:00
Asahi Lina
3278d75453 kboot_gpu: Add preliminary T600x support
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:17:10 +09:00
Asahi Lina
4a6a4c0376 kboot: Add initial GPU property forwarding
Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-12-04 13:15:55 +09:00
Janne Grunau
0aafd74b69 kboot: Transfer display memory carveouts for M2
Signed-off-by: Janne Grunau <j@jannau.net>
2022-11-29 01:33:30 +09:00
Janne Grunau
a954eb47f9 dart: Support locking dart-t8110
Signed-off-by: Janne Grunau <j@jannau.net>
2022-11-29 01:33:30 +09:00
Janne Grunau
ba1dfab4d2 kboot: Enable dart-disp0 as part of the display setup
Devicetrees with dart-disp0 will have it disabled to avoid breaking
scanout off the boot framebuffer when booting via m1n1 version which
does not lock dart-disp0.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-11-15 17:52:16 +09:00
Janne Grunau
0bb521c2c3 kboot: Save notch height in dcp node
DCP will use this information to provide "notch-less" display modes.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-10-26 01:22:00 +09:00
Janne Grunau
53e6254497 kboot: Skip over missing dcp aliases
Prevents failing on non-existant carveout regions from the M1 Ultra on
M1 Pro/Max.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-10-26 01:22:00 +09:00
Hector Martin
aa0a3e6fcf kboot: Don't fail if there are fewer than 6 DCPEXTs on t600x
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-10-25 00:23:42 +09:00
Janne Grunau
ca68e1a9d2 kboot: Transfer dcpext* iommu mappings to device tree
Only dcpext* has memory mapped iboot.

Signed-off-by: Janne Grunau <j@jannau.net>
2022-10-23 17:21:26 +09:00
Janne Grunau
21dc622735 kboot: Transfer display related memory carveouts to device tree
DCP and disp0 need their bootloader iommu mappings maintained until
an OS driver can take over. DCP's mappings have to be kept
indefinitively since it's unknown if or how it can be restarted.

Bindings based on
https://lore.kernel.org/asahi/20220923123557.866972-1-thierry.reding@gmail.com

Signed-off-by: Janne Grunau <j@jannau.net>
2022-10-23 17:21:26 +09:00