Commit graph

61 commits

Author SHA1 Message Date
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
Hector Martin
56e279fe64 Makefile: Add -Wstack-usage=1024
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 21:58:14 +09:00
Hector Martin
395c072a75 Makefile: Keep build_tag up to date
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-31 23:18:49 +09:00
Hector Martin
4b4ae3ab90 aic: Add trivial AIC scaffolding, move regs to aic_regs.h
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-23 17:01:33 +09:00
Hector Martin
3bdf036161 Revert "cpio: add functions to create cpio images"
This reverts commit cd4b563a31.
2021-08-23 15:27:37 +09:00
Sven Peter
cd4b563a31 cpio: add functions to create cpio images
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-09 15:40:11 +09:00
Janne Grunau
88275b5cb5 hv: add AIC interrupt tracing
Implemented by MMIO tracing of AIC's event register. Proposed by pipcet.

Signed-off-by: Janne Grunau <j@jannau.net>
2021-06-10 15:41:02 +09:00
Sven Peter
d2b619957c tps6598x: add support for the USB PD chip
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-06-09 19:45:38 +09:00
Sven Peter
103100bb42 i2c: add i2c support
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-06-09 19:45:38 +09:00
Hector Martin
bfe8c94c47 hv_wdt: Add hypervisor watchdog on secondary core
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-27 21:28:43 +09:00
Mark Kettenis
9604907b2d pcie: minimal initialization
Minimal initialization of the PCIe hardware such that the tunable
can be applied such that they don't have to be passed along in
the devicetree.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2021-05-16 02:43:44 +09:00
Sven Peter
1c604a77c5 gxf: add support for guarded exception levels
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-05-11 15:48:40 +09:00
Hector Martin
0ae3455d51 hv_vuart: World's stupidest virtual UART implementation
Work in progress...

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-05 04:03:44 +09:00
Hector Martin
4d64c33ca6 hv: Implement basic exception handling
Allows Python to handle hypervisor exceptions, and implements exception
info display and basic debug commands.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 19:36:23 +09:00
Hector Martin
23304719cd hv: Move VM code to hv_vm.c
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-04 15:38:17 +09:00
Hector Martin
1ae60ad715 hv: Beginnings of a hypervisor
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-05-01 19:21:33 +09:00
Hector Martin
cc4a5d312d iodev: Add new framework for I/O and console devices
This replaces the earlier earlycon with a single shared console buffer
for all output devices.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-15 23:18:57 +09:00
Sven Peter
add04246e7 usb: add clock/power/phy bringup
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-04-15 18:39:33 +09:00
Sven Peter
59ba266b11 usb: add DWC3 CDC ACM code
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-04-15 18:39:33 +09:00
Sven Peter
ea362ea8f9 ringbuffer: add a simple ringbuffer data structure
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-04-15 18:39:33 +09:00
Sven Peter
05e7306bf9 fb console: add Source Code Pro font
This font is licensed under the OFL-1.1 License and copyright:

Copyright 2010-2019 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'.
All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-04-14 18:11:37 +09:00
Hector Martin
af7ad9c064 Makefile: break up OBJECTS into lines for easier merging
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-04-14 18:11:37 +09:00
Sven Peter
8efff1b0ab dart: add code to setup the DART iommu
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-04-14 17:40:07 +09:00
Sven Peter
b31e1265ff pmgr: add functions to enable/disable clocks
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-04-11 05:26:29 +09:00
Sven Peter
d73276b0bc tunables: add initial version.
There are at least two types in the ADT related to USB,
but there's a decent chance that there are even more
required for other devices:

 * A simple tunable that applies to a whole device node
   and all its MMIO ranges specified in the "reg" property.
   This one seems to just be mask32.

 * A slightly more complex tunable that applies to a single
   MMIO range specified in the "reg" property. So far I've
   only seen 32 bit masks but the format looks like it should
   also support 8,16 and 64 bit masks.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-04-08 20:32:12 +09:00
Sven Peter
1134a4a649 ci: add clang-format check to the CI
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-04-08 20:30:41 +09:00
Hector Martin
cecf51f245 dts: Update with current kernel devicetree, improve build
Now uses the same devicetree source as the kernel, verbatim, with the
required subset of kernel dt includes.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-03-15 02:26:31 +09:00
Hector Martin
efa4452a47 Fix libc header dependencies
Turns out we had a bunch of silly dependencies on libc headers that are
not included with freestanding compilers. Fix all this and change the
CFLAGS to exclude libc headers and only include the built-in compiler
path.

Add our own versions of assert.h, errno.h, limits.h, and move malloc.h
and string.h together into a new path used as -isystem, so these headers
can be included using #include <>.

Remove a bunch of other dependencies in third-party code.

Add a strnlen function.

Disable building the libfdt overlay code for now, as it needs a strtoul
implementation. We can throw that in if/when we decide to use overlays.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-03-08 01:31:14 +09:00
Hector Martin
5dbc82a9ee payload: add support for booting in-line payloads
Usage:

$ cat m1n1.macho Image.gz apple-j274.dtb initramfs.gz \
    > m1n1-payload.macho

That's it.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Hector Martin
5fbb25942d Makefile: disable -Wmultichar
minlzma uses multi-character constants

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-02-06 16:44:10 +09:00
Hector Martin
2d5fb878f8 Makefile: build for armv8.2-a
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 22:00:00 +09:00
Hector Martin
74307af0df kboot: add proper kernel boot & DT manipulation code
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 01:37:09 +09:00
Hector Martin
d280157289 libfdt: actually add libfdt
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-30 01:37:09 +09:00
Hector Martin
986c6730e9 Add heapblock and dlmalloc for managing memory
heapblock is a simple `sbrk` style implementation, also useful as an
"endless" decompression buffer. dlmalloc is used on top as a malloc
implementation.

This also changes how the Python side manages its heap. We still use a
python-side malloc implementation (since this is faster), and we put the
Python heap at the m1n1 heap + 128MB, without allocating it.
Hopefully this should never step on anything m1n1 neads, and avoids
having to manage freeing across Python script calls.

Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-29 16:25:15 +09:00
Hector Martin
db902ce01f wdt: move WDT disable code to wdt.c & use ADT regs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-28 23:48:35 +09:00
Sven Peter
2f84b33ba8 MMU: add cache operations by set/way
this embeds a slightly modified file taken from
arm-trusted-firmware.

Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-01-28 23:20:15 +09:00
Hector Martin
d762391a68 Add code to spin up secondary CPUs
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-01-28 16:06:12 +09:00