Commit graph

97 commits

Author SHA1 Message Date
Daniel Berlin
c45da55256 More support for M3 chips
The UART base has moved from the M2 chips.
Everest settings introduce some changes to unknown registers
The MCC data has changed as well.

There is a drive-by change where I discovered what some of the unknown
HID18 bits are and documented them.

Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
2023-12-03 17:37:20 +09:00
Janne Grunau
30485ead25 build: Increase stack usage warning to 2048
Same value as the arm64 kernel build uses.
Avoids following warning:

 | src/tinf/tinflate.c: In function ‘tinf_uncompress’:
 | src/tinf/tinflate.c:559:5: warning: stack usage is 1712 bytes [-Wstack-usage=]
 |   559 | int tinf_uncompress(void *dest, unsigned int *destLen,

Signed-off-by: Janne Grunau <j@jannau.net>
2023-11-27 13:33:08 +09:00
Eileen Yoon
f4d6d2069a isp: ISP init module
Co-authored-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2023-10-05 14:21:13 +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
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
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
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
Asahi Lina
af85202b58 math: Add powf()
Signed-off-by: Asahi Lina <lina@asahilina.net>
2023-06-27 18:35:00 +09:00
Hector Martin
9e9693eb6c rust: Switch to RUSTC_BOOTSTRAP=1 backdoor instead of nightly
Nightly is messing around with alloc_error_handler and they can't seem
to make up their mind about it, breaking our CI. Just switch to stable
rust with the usual backdoor to enable unstable features (same as the
kernel does).

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-25 23:58:05 +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
c19303dc87 firmware: New module to detect firmware version
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-12-04 16:06:27 +09:00
Hector Martin
7782944808 Makefile: Fix CC FP log message alignment
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-12-04 15:07:16 +09:00
Hector Martin
4c2c4085f1 Makefile: Add multiple methods of determining the version number
This fixes m1n1 stage2 version numbers (for .tar.gz downloads) as long
as the directory name is left intact, and also supports packagers
passing their own version number if needed.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-12-04 14:59:47 +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
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
d27ca705c1 devicetree: Add dt utils for "ranges" based address translation
Signed-off-by: Janne Grunau <j@jannau.net>
2022-10-23 17:21:26 +09:00
Asahi Lina
fe0d3e8e34 tunables_static: New module to set up static tunables
This is for things that xnu hard-codes. This first one for AGX is
required to make coprocessor TLB coherency work properly...

Signed-off-by: Asahi Lina <lina@asahilina.net>
2022-09-27 06:04:41 +09:00
Hector Martin
29a85d6857 Makefile, asm.py: Work on native arm64 by default
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-08-29 17:03:01 +09:00
Hector Martin
4555cc5148 dapf: Initialize DAPFs from the ADT
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-07-03 23:27:50 +09:00
Hector Martin
22adc922f7 chickens: Add T8112 chickens
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-06-28 01:41:23 +09:00
Hector Martin
b16a19715a chickens: Split off core sequences into separate files
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-06-28 01:41:23 +09:00
Martin Povišer
72c6170ee8 m1n1.loadobjs: Support loading of inline C snippets
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-05-30 23:26:31 +09:00
Thomas Watson
753f48e929 keep binary versions of boot logo in repo
Signed-off-by: Thomas Watson <twatson52@icloud.com>
2022-05-30 22:54:33 +09:00
Sven Peter
4e5a949382 sep: add simple SEP TRNG API
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-03-19 02:33:54 +09:00
Hector Martin
b64a6b9321 Makefile: git-describe using --tags
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-17 16:22:13 +09:00
Hector Martin
ca04d8c9f4 Makefile: Generate build_cfg.h without echo -ne
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-09 22:15:09 +09:00
Hector Martin
24b1fd9b22 Makefile: Add mkdir build where it was missing
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-09 22:01:42 +09:00
Hector Martin
cfbaac1eac dts: Remove
We're building these from the U-Boot tree, this is long obsolete. Just nuke it.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-09 22:01:42 +09:00
Hector Martin
4575b35479 rust: Initial Rust-based EFI FAT32 chainloader
This code is gated behind the CHAINLOADING define. To build a
release-style m1n1 with chainloading for use with the installer
or kmutil, use:

make CHAINLOADING=1 RELEASE=1

To tell m1n1 to chainload another binary, use this var payload:

chainload=<ESP partition UUID>;<file path>

e.g.

chainload=a17b7e46-e950-bb4f-bc82-8ab1047a058e;m1n1/m1n1.bin

Closes: #154
Co-authored-by: Finn Behrens <me@kloenk.dev>
Co-authored-by: Joey Gouly <joey.gouly@arm.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-09 22:01:42 +09:00
Hector Martin
e386e17550 chainload: Add new m1n1-side chainloader (raw images only)
This basically duplicates the chainload.py logic, minus the mach-o
handling.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-09 20:55:34 +09:00
Hector Martin
a2944fa123 clk: Initialize MCA clock muxes
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-08 00:02:06 +09:00
Hector Martin
5aaedef975 main: Add RELEASE mode features
- Hide console by default unless booting in verbose mode.
- In verbose mode, enable USB early and poll for connection before
  launching payloads.
- Show console on fallback to proxy.

Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-22 00:30:54 +09:00
Hector Martin
1c2a2db1dd display: Add logic to initialize the Mac Mini HDMI display
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +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
Hector Martin
3f9bd38b6f afk: Add AFK/EPIC subsystem
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Sven Peter
2307e756d3 nvme: Add stub ANS NVMe driver
Right now it only initializes the co-processor and makes sure
the firmware has booted successfully.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-16 18:53:29 +09:00
Sven Peter
734f8cc1b4 rtkit: Add RTKit library
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-16 18:53:29 +09:00
Sven Peter
c0cc000ce3 iova: Add a simple IOVA allocator
Not well tested because I realized too late that NVMe doesn't
actually need any DART support...

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-16 18:53:29 +09:00
Sven Peter
2b792ffc34 sart: Add SART support
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-16 18:53:29 +09:00
Sven Peter
65816f1bd8 asc: Add ASC mailbox driver
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-16 18:53:29 +09:00
Hector Martin
0d4fb00ceb Makefile: Add a m1n1.bin target that builds a raw binary
This is to be used for the non-macho boot support in 12.1+ kmutil.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-17 21:46:55 +09:00
Hector Martin
4b80041d6d mcc: New module to initialize the MCC memory controller.
This turns on the system level cache. The carveout unmapping also moves
here, and now it handles T8103/T6000 properly.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-16 21:09:48 +09:00
Hector Martin
eb3af7daaf Makefile: do not use -Wp to pass Makefile dep generation args
This doesn't seem to work properly with clang...

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-08 13:53:04 +09:00
Hector Martin
1e6c856f5f Makefile: Make it build out-of-the-box on macOS
This requires a few dependencies installed with Homebrew.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-08 13:52:59 +09:00
Hector Martin
ef83f62d0e cpufreq: New module to initialize CPU p-states
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 17:34:40 +09:00
Hector Martin
e08457aaa9 Makefile, m1n1.ld: Build with debug info
This allows addr2line to work. The Mach-O output should be unchanged.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 17:13:03 +09:00