Hector Martin
3248c91aef
display: Allow forcing re-config via payload (WIP)
...
Doesn't actually let you specify a mode yet.
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-27 16:46:53 +09:00
Hector Martin
780c0644d4
display: Fix HPD detection bug
...
Turns out it's just an 8-bit bool, not 32 bits, and when cast to int
the top bits can cause it to be interpreted as an error randomly...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-27 16:46:23 +09:00
Hector Martin
8af401ade1
display: Also prefer <4K modes in the vertical dimension
...
Apparently 2:1 scaled modes like 1920x2160 are a thing?
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-27 16:08:39 +09:00
Sven Peter
0a1a9348c3
kboot: try SEPROM for the random seeds first
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-03-19 02:33:54 +09:00
Sven Peter
4c62ef47ad
kboot: split off dt_set_rng_seed
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-03-19 02:33:54 +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
bad5aebc7d
kboot: Forward kblang code to asahi,kblang-code
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-18 06:56:57 +09:00
Hector Martin
d4635f60e2
chainload: Properly reserve memory for everything up to bootargs
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-16 01:56:57 +09:00
Hector Martin
3331d9e1e1
kboot: Properly prune cpu-map and IRQ affinities for missing CPUs
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-14 21:09:20 +09:00
Hector Martin
d580963043
smp: Guard CPU indexes > MAX_CPUS
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-14 21:08:07 +09:00
Hector Martin
29adf670b5
payload: Fix /chosen arg setting
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-11 22:12:22 +09:00
Hector Martin
d161de0037
nvme: Stop CPU properly on shutdown
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-10 04:01:15 +09:00
Hector Martin
82ec1695ba
payload: Fix broken chosen var handling
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-10 00:30:31 +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
0a8a593cdc
payload: Support passing arbitrary /chosen arguments
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-09 20:55:34 +09:00
Hector Martin
78c8c4d7d6
payload: Skip hypothetical m1n1 signatures
...
Tentative header format: 'm1n1_sig' followed by u32 total size (inclusive).
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-09 20:55:34 +09:00
Hector Martin
6a1a9bfc3c
utils: Expand vector_args from 4 to 5 arguments
...
This also expands the usual call/next stage functions to match.
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-09 20:55:34 +09:00
Hector Martin
963b74765c
adt: Add adt_setprop()
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-09 20:55:34 +09:00
Hector Martin
123d1df1a7
kboot: Replace kboot_set_bootargs with kboot_set_chosen
...
This allows setting arbitrary /chosen string props
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-09 20:55:34 +09:00
Hector Martin
adb1cb943e
proxy: Export smp_set_wfe_mode
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-08 00:02:06 +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
616fedaf62
nvme: Shut down the controller cleanly
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-07 23:59:25 +09:00
Hector Martin
bb7c7dd0ce
proxy: Pass through nvme retvals properly
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-07 23:59:25 +09:00
Hector Martin
191cb157fb
rtkit: Better error handling
...
Now failures during init/shutdown won't cause a hang.
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-03-07 23:59:25 +09:00
Hector Martin
287a963bcc
kboot: Hide the notch
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-22 01:04:55 +09:00
Hector Martin
5531b9ae32
display: statify local functions
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-22 00:54:17 +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
a9088e2278
fb: Add the ability to defer FB console activation
...
This differs from removing the IODEV usage in that console contents
are still buffered.
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-21 16:06:14 +09:00
Hector Martin
d1dcf16c66
display: Update boot args in place for HV guests
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-21 16:03:23 +09:00
Hector Martin
50a9593034
mcc: Add mcc_hv_unmap_carveouts() and proxy op
...
This is necessary to stop the guest from speculating into carveouts.
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-21 15:30:21 +09:00
Martin Povišer
7bab3d0fc3
exception: Fix silent mode
...
Do not forget to clear the L2C_ERR flags in silent mode also. This is
necessary for proper recovery.
Signed-off-by: Martin Povišer <povik@protonmail.com>
2022-02-14 11:47:04 +09:00
Hector Martin
6f525fc0f1
smp: Skip missing CPUs and continue
...
This will probably fix missing CPUs on low-binned machines
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-08 13:35:49 +09:00
Janne Grunau
1903dbd17e
kboot: reload dt offset after dt_set_uboot_dm_preloc
...
Fixes adding "u-boot,dm-pre-reloc" to all required power-management
nodes on t600x.
Signed-off-by: Janne Grunau <j@jannau.net>
2022-02-07 01:02:21 +09:00
Hector Martin
7697e992b0
fb: Fix init message pointer
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-06 15:41:30 +09:00
Hector Martin
e1a7deb2d5
i2c: Increase low-level timeouts to 50ms.
...
Hopefully this will cover all corner cases of the Ace2s being slow.
Issue: #101
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-06 15:36:22 +09:00
Sven Peter
cad8df30ce
nvme: delete IO SQ/CQ when shutting down
...
This should not be required but it looks like the 12.1 ANS2 firmware
complains when NVME_CC.EN is cleared before the IO queues have been
deleted.
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-02-02 22:57:54 +09:00
Sven Peter
768be5bd58
sart: fix sart3_set_entry
...
writel_relaxed(val, addr) inside Linux but write32(addr, val) inside
m1n1 confused my muscle memory.
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-02-02 22:57:54 +09:00
Sven Peter
2ee920d229
sart: fix for 12.1
...
Looks like Apple decided to change the compatible to sart,coastguard and rely
on the sart-version ADT property to differentiate between M1 and M1 Pro/Max
instead. sart-version is already present in the 11.x ADT so let's just
always decide based on that.
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-02-02 22:57:54 +09:00
Hector Martin
fbc15bd77c
payload: Consider an IMG4 blob as the end of payloads
...
When loading m1n1.bin, SEPFW follows m1n1 and thus will show up at
the payload offset if there are no payloads.
Fixes : #158
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-02-01 15:52:08 +09:00
Sven Peter
ccf4b20a1d
proxy: add nvme_{read,flush}
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
5f17b4743e
nvme: bring up controller and implement nvme_read
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
54ff538df9
asc: use timeout_*
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
2bbf994089
utils: add timeout_{calculate,expired}
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
21fec139bf
utils: add write64_lo_hi
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Sven Peter
bbea5167d5
rtkit: fix RTKIT_SYSLOG
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-26 15:38:40 +09:00
Mark Kettenis
30d6c6374d
kboot: Add u-boot,dm-pre-reloc properties
...
These properties are needed such that U-Boot can enable the
serial port in its early pre-relocation phase.
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2022-01-26 15:37:47 +09:00
Sven Peter
2bd7bf4020
afk: use version 3 for epic_sub_hdr
...
This drops the tx/rxcookie and accepts TYPE_NOTIFY in addition to
TYPE_REPLY for command replies to make the DCP code also work on 11.x.
It'll still complain about an unexpected message during init but work.
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-19 03:24:20 +09:00
Hector Martin
f20a0fbcd5
rtkit: Do not ack prealloc'd buffers
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-19 03:23:42 +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
Sven Peter
00404e9bc3
afk: propagate failures in afk_epic_rx correctly
...
If the co-processor crashes afk_epic_poll will always fail which results
in afk_epic_rx getting stuck in an infinite loop calling afk_epic_poll
again and again.
This happens with e.g. old/incompatible DCP firmware.
Make sure the m1n1 proxy still works in those cases by propagating the
error correctly.
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-18 11:33:57 +09:00
Janne Grunau
b2cb605832
display: Retry dcp_ib_get_hpd() for up to 2 seconds
...
After boot DCP will need some time to detect connected displays.
Signed-off-by: Janne Grunau <j@jannau.net>
2022-01-17 23:12:49 +09:00
Vincent Duvert
6736368275
rtkit.c: Add config.h include
...
Needed for the RTKIT_SYSLOG optional define.
Signed-off-by: Vincent Duvert <vincent@duvert.net>
2022-01-17 23:11:27 +09:00
Hector Martin
b9a7827900
main: Drop copyright year from copyright statement
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 14:41:44 +09:00
Hector Martin
f1033a97b2
afk: Fix error return for bad queue entry
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 14:33:27 +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
Hector Martin
ae1d7c4348
rtkit: Fix bug with version selection
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
476710410c
rtkit: Change initial power state to 0x220
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
ca77566441
rtkit: Make rtkit_recv() return an int
...
This allows distinguishing between error and no message conditions.
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
15bce29775
rtkit: Add basic crashlog support
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
9b5cb569e4
rtkit: Buffer handling refactor
...
This adds support for using preallocated buffers & more
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
8f3118d99f
rtkit: Add syslog support
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
94bc563433
rtkit: Add dummy OSLog support
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
7fc207eb35
iova: Add range arguments to iovad_init()
...
This allows restricting the IOVA range so as to not overlap with
prealloc'd ranges.
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
847036b2ce
iodev: Bump console buffer to 8K
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
18ceb3b3ff
asc: Use 0x8000 offset for mbox regs
...
Not sure where 0x4000 came from?
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
a4c5b64655
asc: Add asc_get_iop_node()
...
The IOP child node in the ADT contains properties that the RTKit driver
needs to handle it properly.
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
42c4334675
dart: Add dart_translate() & dart_search()
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
18408d37b1
dart: Handle locked DARTs & preserving page tables
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:42:00 +09:00
Hector Martin
2127de59c1
utils: Add is_heap()
...
This lets us mix iBoot-allocated and heap-allocated pointers and
distinguish them at cleanup time.
Signed-off-by: Hector Martin <marcan@marcan.st>
2022-01-17 04:10:24 +09:00
Sven Peter
0b9829e227
proxyclient: add nvme_{init,shutdown}
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-16 18:53:29 +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
1521978a6c
pmgr: add pmgr_reset
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2022-01-16 18:53:29 +09:00
Sven Peter
1254b4bee6
pmgr: s/clock/power/
...
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
Zzzec
bad788e67e
hv_vm: fix an alignment problem in hv_map
...
Signed-off-by: Zzzec <1223544545@qq.com>
2022-01-03 18:23:39 +09:00
Hector Martin
3e4db747eb
kboot: Forward WiFi cal blob from ADT to DT
...
This calibration blob is stored in the WiFi chipset SROM on other
platforms, but Apple decided to move it to sysconfig instead...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-28 20:01:40 +09:00
Mark Kettenis
36954d51fd
kboot: Provide antenna SKU in device tree
...
Read the antenna SKU from the ADT and store it in a
"apple,antenna-sku" property on the relevant node in the FDT.
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2021-12-25 19:40:10 +09:00
Hector Martin
1a77571557
chickens: Disable SMC traps from EL1 to EL2
...
This behavior isn't really compliant with the architecture, so turn it
off.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-21 19:45:04 +09:00
Hector Martin
92aca22119
heapblock: Remove payload_end logic for heap start
...
This no longer applies ever since we started doing in-place chainloads.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-17 22:26:54 +09:00
Hector Martin
688c6b1494
memory: Dynamically allocate top-level page tables
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-17 21:46:55 +09:00
Hector Martin
07c7cc09f3
hv_vm: Dynamically allocate top-level page tables
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-17 21:46:55 +09:00
Hector Martin
bedcc905a3
gxf, smp: Allocate stacks dynamically
...
This significantly shrinks our .bss section
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-17 21:46:55 +09:00
Hector Martin
486ff9ecee
aic: t6000: Initialize external IRQ routing
...
This is used for coprocessors. Do it here so Linux doesn't have to deal
with it.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-08 01:14:44 +09:00
Hector Martin
abee2ecebc
pcie: Set link speed capabilities from ADT
...
This sets both the target and the max link speed of the root ports
to the maximum specified in the ADT.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-07 14:03:26 +09:00
Hector Martin
c9dc4401c0
pcie: Enable port speed controls
...
This makes PCIe train at >Gen1 by default
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-02 13:55:25 +09:00
Hector Martin
26b55d4b26
pcie: Wait for port PHY to be idle after init before configuring
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-02 13:42:19 +09:00
Hector Martin
9949689a74
pcie: Document APCIE_PHYIF_CTRL
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-12-02 13:41:56 +09:00
Martin Povišer
a40840f13c
proxy: Expose usb_iodev_vuart_setup
...
Expose the usb_iodev_vuart_setup function in uartproxy. This opens
the secondary ACM pipe to new uses outside the hypervisor. E.g. it can
be set up as another stream for sending proxy requests.
Sample usage from proxyclient:
p.usb_iodev_vuart_setup(p.iodev_whoami())
p.iodev_set_usage(IODEV.USB_VUART, USAGE.UARTPROXY)
# the second virtual serial now also serves proxy
Signed-off-by: Martin Povišer <povik@protonmail.com>
2021-11-26 15:31:21 +09:00
Hector Martin
95ef45fd11
usb: Squelch DART error for missing USB devices
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-24 17:17:54 +09:00
Hector Martin
de6979fc7b
Revert "usb: Add usb_idx_from_address() to find a dev by its MMIO addr"
...
This is no longer needed, so put things back the way they were.
This reverts commit e689ceb263
.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-23 23:36:14 +09:00
Hector Martin
be7ff3a062
kboot: Generalize device disable logic, disable i2c & usb devs
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-23 23:36:14 +09:00
Hector Martin
01e84ecef6
pcie: Document reg ranges better
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 16:43:22 +09:00
Hector Martin
555965e98a
pcie: Calculate the number of reg entries per port
...
Turns out this isn't hardware-specific, but rather a change Apple made
retroactively in 12.0 RC. Doesn't look like there's a saner way than
this...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 16:24:37 +09:00
Hector Martin
4027c34c7a
proxy: Add proxy ops for pcie_init/shutdown
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-22 16:04:35 +09:00
Hector Martin
23c3617cf2
payload: Complain loudly about devicetree platform mismatches.
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-20 02:26:24 +09:00
Hector Martin
f4e11a78c6
i2c: Add explicit delay to the i2c_xfer_read timeout loop
...
We now set the timeout at 10ms without any bytes received.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-18 22:29:51 +09:00
Hector Martin
850a669436
tps6598x: Add a delay in the command poll loop
...
It seems that if we poll too fast, we DoS the poor thing...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-18 22:15:38 +09:00
Hector Martin
cc1fa67ff2
i2c: Use Repeat-Start condition for SMBus reads
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-18 22:15:13 +09:00
Hector Martin
26f636dbbb
fb: Use 128-bitwise copies to speed up FB updates
...
This makes it almost as fast as it was before the switch to an
uncached framebuffer, as far as I can tell.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-17 19:23:44 +09:00
Hector Martin
3b0d53d7b8
mcc: Guard against MCC count > max
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-17 10:14:15 +09:00
Hector Martin
0df392d0d3
mcc: Fix mcc_num_channels prop on t8103
...
Bad copy and paste...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-17 01:45:49 +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
ecc80f4b32
kboot: Fix warning/bug introduced by ecb6c82e
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-16 21:09:12 +09:00
Hector Martin
b9ec73b019
smp: Leave the default boot stack for CPU#0 set in case it resets
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-16 17:26:52 +09:00
Hector Martin
33d09cc7c0
hv_exc: Filter out CYC_OVRD_DISABLE_WFI_RET
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-16 17:26:39 +09:00
Hector Martin
0f9c0f5dd3
startup: Add a UART print to the RVBAR entry path
...
This might make it easier to debug CPU sleep modes
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-16 17:18:52 +09:00
Hector Martin
ecb6c82e75
kboot: Delete CPU nodes instead of disabling them
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-15 22:48:28 +09:00
Hector Martin
7690fd730c
iodev: Bypass locks on all funcs if no MMU
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-15 22:47:45 +09:00
Hector Martin
257f6443a6
kboot: Fix potential bug handling missing/disabled CPUs
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-15 14:52:10 +09:00
Jean-Francois Bortolotti
0131d16c0a
Fix aic1 reg size
...
Signed-off-by: Jean-Francois Bortolotti <jeff@borto.fr>
2021-11-14 11:14:50 +09:00
Janne Grunau
46c945ac95
usb: use dynamic paths for usb related ADT nodes
...
Adds support for the 3rd USB-C port on 2021 Macbook Pros.
Currently up to 8 USB-C ports are supported which should be sufficient
for expected future devices.
Tested on Macbook Pro 14" and Mac Mini.
Signed-off-by: Janne Grunau <j@jannau.net>
2021-11-12 23:48:32 +09:00
Janne Grunau
b6ec7abc2b
utils: replace sprintf with snprintf
...
Converts all current users.
Signed-off-by: Janne Grunau <j@jannau.net>
2021-11-12 23:48:32 +09:00
Janne Grunau
5064b93b2f
usb: dynamically allocate and register usb iodevs
...
Preparation for devices with more than 2 USB-C ports.
Signed-off-by: Janne Grunau <j@jannau.net>
2021-11-12 23:48:32 +09:00
Janne Grunau
c40ef51084
usb_dwc3: robustness in usb_dwc3_write()
...
Signed-off-by: Janne Grunau <j@jannau.net>
2021-11-12 23:48:32 +09:00
Janne Grunau
91ff1ceb65
iodev: avoid direct access to iodev device array
...
Preparation for dynamically alloced iodevs.
Signed-off-by: Janne Grunau <j@jannau.net>
2021-11-12 23:48:32 +09:00
Janne Grunau
2724d69f4c
iodev: usb: replace secondary usb iodevs with single vuart iodev
...
Signed-off-by: Janne Grunau <j@jannau.net>
2021-11-12 23:48:32 +09:00
Hector Martin
b50a489f41
chickens: Update Firestorm chickens & complete t600x
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-11 01:20:03 +09:00
Hector Martin
efca793572
pcie: Only print the port init msg for existing ports
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-11 01:20:03 +09:00
Hector Martin
510dd53175
pcie: Add t6000 support
...
This one seems to need one extra magic poke
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-10 20:43:51 +09:00
Hector Martin
a83d0908e5
pcie: Add t6000 fuse bit map and fix fuse bit application
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-10 20:43:51 +09:00
Hector Martin
94a73a404c
kboot: Disable USB dwc3 devices that are missing in the ADT
...
This passes through the hypervisor USB device disable to Linux, so we no
longer need to hack device trees.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-10 20:43:51 +09:00
Hector Martin
e689ceb263
usb: Add usb_idx_from_address() to find a dev by its MMIO addr
...
This will be used to match up ADT and FDT USB devices, to pass through
enable status.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-10 20:43:51 +09:00
Hector Martin
7e01af5144
kboot: Use _inplace setprop for the CPU release addr
...
This needs to happen in-place for the iterator to not be invalidated.
Explicitly request that and fail if it does not work.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-10 20:43:51 +09:00
Hector Martin
e763ce3f56
hv: Set SMP mode to WFE
...
This fixes early IRQs getting stuck in idle secondaries and breaking the
guest.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-08 19:57:02 +09:00
Hector Martin
84acf60c24
Fix warnings when building/linking with clang/llvm
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-08 13:53:04 +09:00
Hector Martin
4e4335a6ea
chickens: Enable IRQs on t600x
...
This seems to be safe to do on M1 too.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 04:03:41 +09:00
Hector Martin
0c093521de
pcie: Basic t600x support
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:55:48 +09:00
Hector Martin
f5af1caee5
hv_exc: Forward more sysregs
...
We don't normally trap these, but for experiments using TIDCP they are
useful to avoid.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:55:09 +09:00
Hector Martin
a383ef0b5a
iodev: Protect iodevs with spinlocks
...
This makes SMP IRQ reports less flaky
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:53:39 +09:00
Hector Martin
0005b6533b
hv_exc: Add more sysreg passthroughs for t600x spam
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:52:43 +09:00
Hector Martin
77074b9098
hv_aic: Support AICv2
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:52:42 +09:00
Hector Martin
8fa422c0d3
fb: Map the framebuffer uncached, and use a shadow FB for speed
...
Turns out AMCC on t600x throws errors when DISP0 real-time memory
requests hit the CPU cache, and then macOS panics.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:52:30 +09:00
Hector Martin
dc3806252b
aic: Basic AICv2 support
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-04 03:52:30 +09:00
Hector Martin
f824f60f5c
utils: Unbork udelay()
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-02 12:36:07 +09:00
Hector Martin
6765bc3ff6
hv_vm: Support >36-bit PAs
...
This needs an extra L1 translation level, but only on SoCs with support
for >36-bit PAs. On M1, we bypass it and keep starting at L2.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-02 02:35:26 +09:00
Hector Martin
d7983c7173
arm_cpu_regs.h: Add SYS_ID_AA64MMFR0_EL1
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-02 02:23:07 +09:00
Hector Martin
e99138710a
smp: Handle IRQ enable reg properly (maybe)
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 21:00:56 +09:00
Hector Martin
87613dc208
smp: Support more clusters/CPUs properly
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 21:00:56 +09:00
Hector Martin
9b6e5fbc52
cpufreq: Add preliminary T6000 support
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 21:00:56 +09:00
Hector Martin
d7bd21d51c
usb: Use new DART code to autoselect compatible mode
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 21:00:56 +09:00
Hector Martin
1edb18ac44
pmgr: Do not try to fix up virtual devs
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 21:00:56 +09:00
Hector Martin
84902062c9
dart: T6000 support
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 21:00:56 +09:00
Hector Martin
68aec75918
memory: Larger PA support & dynamically map MMIO
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 21:00:56 +09:00
Hector Martin
326ba6fb33
utils: Fix BIT() signedness
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 19:00:34 +09:00
Hector Martin
425daaedbd
utils: Use CPU timer instead of AIC timer
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 19:00:34 +09:00
Hector Martin
95dd7b90a4
chickens: Add preliminary T6000 support
...
P-core chickens need checking.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 19:00:34 +09:00
Hector Martin
ed21a80bc3
chickens: Refactor and update M1 bits
...
This adds some missing fixes for M1/T8103 and reworks the code to split
off common parts, and also handle per-revision bits.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 13:41:12 +09:00
Hector Martin
7ff48f6201
memory: Make the RAM base dynamic
...
For now we compute this as phys_base aligned down to a 4GiB boundary.
Hopefully that works for future SoCs too.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 13:39:40 +09:00
Hector Martin
38fc7a0780
Configure early debug features by SoC type
...
To build a version with early UART support, set it in config.h
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-11-01 13:36:42 +09:00
Vincent Duvert
b15be6bcd7
Remove hardcoded UART/WDT addresses
...
The M1 Pro/Max Macs use a different base address for the UART and the
WDT than earlier models.
Remove hardcoded base addresses constants and replace them with loads
from the ADT.
- The base address of the WDT is already retrieved in wdt_disable; also
use this address when triggering a reboot.
- Retrieve the base address of uart0 in uart_init. If the operation
fails, the error will be signaled on the early uart (if not disabled).
- The early debug UART can’t use the ADT (or shouldn’t) so it is now
disabled by default. To enable it, add
-DEARLY_UART -DEARLY_UART_BASE=0xuart_address
to the CFLAGS.
Signed-off-by: Vincent Duvert <vincent@duvert.net>
2021-11-01 11:27:29 +09:00
Hector Martin
39d1d9a904
payload: Only load DTs that are compatible with this device
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 18:26:27 +09:00
Hector Martin
120ac16493
payload: Support setting boot-args as a payload.
...
Just use "boot-args=foo bar baz\n" as a payload
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 18:18:01 +09:00
Hector Martin
097c2f752a
payload: Make vars static
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 18:17:42 +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
4fa0200053
main: Export chip_id as a global
...
Some things need to be chip-specific, as the ADT isn't generic enough.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 17:33:49 +09:00
Hector Martin
6d9bc7fa8f
pmgr: Unify defs with Linux, clean up device relationships.
...
This enables parent devices that are required by active child devices,
because iBoot leaves behind some broken dependencies.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 16:52:59 +09:00
Hector Martin
5787eb2d64
hv_exc: Fix global IPIs
...
Reported-by: Joey Gouly <joey.gouly@arm.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-18 13:26:28 +09:00
Hector Martin
72788291e6
memory: Map all RAM to the top, minus carveouts
...
This unbreaks dcp.py and other things that need to access reserved
regions. This way we don't have to start doing manual MMU maps, but
we're still safe from SErrors caused by hitting TZ carveouts.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-16 01:00:33 +09:00
Hector Martin
1444c93a24
proxy: Add P_MMU_INIT_SECONDARY
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-15 23:44:12 +09:00
Hector Martin
da024ffbd8
memory: Only map available RAM
...
We saw some crazy speculation running in the HV breaking things by
reading from invalid RAM, so let's actually map only what's available.
For now we do map all lowmem as we haven't seen SErrors there yet, but
we stop at the high boundary.
Fixes : #97
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-15 23:44:12 +09:00
Danny Lin
37e8f425bf
smp: Fix smp_call macros with fewer than 4 arguments
...
The full 4-argument version of smp_call is smp_call4; smp_call doesn't
exist.
Signed-off-by: Danny Lin <danny@kdrag0n.dev>
2021-10-11 12:42:31 +09:00
Hector Martin
e1515b4376
i2c: Make error paths wait for bus in i2c_smbus_read
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-10 23:49:51 +09:00
Hector Martin
64cb9892b1
tps6598x: Correctly clear all IRQ flags
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-10 23:18:04 +09:00
Hector Martin
675f11dc59
tps6598x: Get rid of TPS_WRITE_DELAY
...
This was a poor workaround for the broken i2c code.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-10 23:16:26 +09:00
Hector Martin
d20a79435c
i2c: Fix waiting for read transactions
...
We weren't waiting until the STOP after reads, causing borkage.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-10 23:15:32 +09:00
Hector Martin
11ba4a0aac
hv: format fix
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-03 00:30:42 +09:00
Hector Martin
b9f1eb29e9
kboot: Only try to parse actual CPUs in /cpus
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-10-03 00:28:08 +09:00
Hector Martin
2736f0dd07
hv: Transfer ACTLR_EL1 (not just EL2) to secondaries
...
Also capture config at cpu0 guest entry time, to make sure we don't
carry over guest changes to EL1 regs after that.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-24 10:57:27 +09:00
Hector Martin
5eed8f674d
hv_vm: Fix guest SError handling
...
This was broken, but somewhat masked by another bug in hv_vm.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 22:17:52 +09:00
Hector Martin
56c3d93787
hv_exc: Enable SErrors in the hypervisor
...
This finally works properly now
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 21:18:13 +09:00
Hector Martin
78cf104b1f
hv_vm: Guard emulated read/writes to catch SErrors/aborts
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 21:18:13 +09:00
Hector Martin
4f92a77efd
exception: Allow guarding SError exceptions
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 21:18:13 +09:00
Hector Martin
25bc815821
hv: Store exception info regs on entry, and use it
...
This is the second part of allowing nested exceptions
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 21:18:13 +09:00
Hector Martin
607464f8b0
proxy/uartproxy/hv_asm: Add syncs to flush SErrors
...
This makes sure any pending memory ops that might trigger an
asynchronous SError do so here, and not later. This fixes SErrors
breaking proxy ops.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 20:31:52 +09:00
Hector Martin
d44d0a4f16
Revert "hv_asm: Unmask SErrors inside the HV"
...
This reverts commit bb7c8ad3c5
.
This is broken.
2021-09-21 20:30:07 +09:00
Hector Martin
bce239b36f
exception: Make space in the stack for full exception context
...
This is step 1 of the rework to make reentrant exceptions work
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 20:29:19 +09:00
Hector Martin
a16731e8b3
hv_exc: Avoid delivering spurious HV-triggered IPIs to the guest
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 17:13:03 +09:00
Hector Martin
098d394a5c
exception: Handle Fast IPIs
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 13:33:23 +09:00
Hector Martin
0e3770ca47
hv, m1n1.hv: Add cpu() command to switch CPU contexts
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 13:18:06 +09:00
Hector Martin
977cbdf4f8
hv_exc: New time accounting around Python callbacks
...
This does an explicit hypervisor rendezvous. It's not great because it
introduces spurious guest IPIs, but xnu doesn't seem to care...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 13:17:00 +09:00
Hector Martin
64dab94821
hv_aic: Use aic.h instead of just declaring aic_base
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 00:42:19 +09:00
Hector Martin
945b75a0f8
hv_aic: Fix regression introduced by 4b4ae3ab
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-21 00:40:04 +09:00
Hector Martin
ffacef41ee
iodev, exception: Remove gratuitous UART usage
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-19 22:33:20 +09:00
Hector Martin
edb32c48a2
smp: Allow switching back to wfe for the smp spinloop
...
This is what Linux expects, so we'd better do it in kboot.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-19 02:17:04 +09:00
Hector Martin
c3ba77ce16
hv_exc: Handle SYS_IMP_APL_CYC_OVRD in the fast path
...
m1n1 now uses this for SMP, and due to wfi FIQ leakage from the HV
timer this gets spammed thousands of times per second. Handle it in
the HV directly.
Fixes : #107
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-18 22:33:28 +09:00
Hector Martin
2d952752db
proxy: Add smp_wait() to the proxy
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-17 15:25:34 +09:00
Hector Martin
b1bc4023dc
smp: Use wfi and put idle CPUs in deep sleep
...
This allows a single active P-Core to boost to 3.2GHz.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-17 00:15:52 +09:00
Hector Martin
10880ca1a6
hv_vm: Unbork >32bit mmiotrace
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-16 03:01:10 +09:00
Hector Martin
09a44e5a92
hv_exc: Disable stolen time accounting
...
This doesn't work with SMP.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:32:57 +09:00
Hector Martin
509481d5d5
hv: Add SMP support
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:32:57 +09:00
Hector Martin
184a516367
hv_exc: Make IPI/IRQ/timer/PMC emulation storage per-CPU
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:26:14 +09:00
Hector Martin
56b54a6641
hv_vm/hv_exc: Add cpu_id to exception & mmiotrace structs
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
a13a23d5fa
iodev: Add a spinlock and allow console for secondaries
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
cd59d39686
memory.h: Add mmu_active() function
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
c690eb1c9d
utils: Make spinlocks reentrant
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
787c46e8c7
hv_exc: Add a Big Hypervisor Lock
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
d53b40da48
memory: Add mmu_init_secondary() to init MMU for secondaries
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
52f432f0f6
memory: Add guard pages at the end of stacks
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
2f8beb02b4
cpu_regs.h: Add more registers needed for HV config
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
8752d5fbba
gxf: Per-CPU gxf stack
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
368b48a365
hv_wdt: Make HV WDT CPU configurable and WDT optional
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
6c186f8468
hv_asm: Move SP saving to a variable, per-CPU
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:24:37 +09:00
Hector Martin
c317b73b8c
utils: Add a basic spinlock implementation
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:19:37 +09:00
Hector Martin
bb7c8ad3c5
hv_asm: Unmask SErrors inside the HV
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:19:37 +09:00
Hector Martin
90b10ef9f7
smp: Add smp_id() and use TPIDR_EL[12] to keep the SMP ID
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 23:19:37 +09:00
Hector Martin
571a19c9a3
smp: Align secondary_stacks & export to header
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 22:00:29 +09:00
Hector Martin
4acc3d7c7f
hv_vm: Mask off operand size for store emulation
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-09-15 17:42:03 +09:00
Mark Kettenis
4e88360eb1
main: Fix compiler error
...
Older versions of GCC throw a "initializer element is not contstant"
error. Fix this.
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2021-09-03 10:59:46 +09:00
Hector Martin
fa50bb6474
fb: Do not restore logo when using kboot
...
Also don't clear the whole screen, only the console section so the logo
is glitchless.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-31 14:10:52 +09:00
Mark Kettenis
77b0cdb7c9
pcie: Only initialize ports that are actually present
...
The macbook pro and macbook air only have a single PCIe port
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2021-08-31 02:07:24 +09:00
Hector Martin
56799d34e8
usb_dwc3: Properly handle CDC status separately per pipe
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-30 23:53:05 +09:00
Pip Cet
b7ad368158
uart: avoid relying on UTRSTAT_RXD == 1
...
Signed-off-by: Pip Cet <pipcet@gmail.com>
2021-08-24 22:11:19 +09:00
Pip Cet
6a92a3e71a
iodev, usb_dwc3: cosmetic fixes
...
Signed-off-by: Pip Cet <pipcet@gmail.com>
2021-08-24 22:11:19 +09:00
Pip Cet
9a5707889a
hv_vuart: Avoid reporting bytes in the RX buffer when it's empty.
...
Signed-off-by: Pip Cet <pipcet@gmail.com>
2021-08-24 21:07:43 +09:00
Hector Martin
19b16f77d8
startup: Split density field from depth print
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-24 21:00:50 +09:00
Hector Martin
017f050fff
hv_vuart: Implement RX & enough to support Linux
...
This works to get to a serial shell on Linux, and to use m1n1-as-LV1
proxyclient with M1N1DEVICE=/dev/m1n1-sec
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-23 17:02:28 +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
18eb02fa92
uart: Add more UART reg defines and use them
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-23 17:00:53 +09:00
Hector Martin
31bf2b5ac9
iodev: Make iodev_can_read() return the queued byte count
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-23 17:00:14 +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
Hector Martin
68c1f1c1a6
Revert "kboot: move SEPFW to initrd before booting"
...
We've decided this needs to go via reserved-ranges, not in the
initramfs.
This reverts commit 6afe9ebaf9
.
2021-08-23 15:27:20 +09:00
Hector Martin
f8110dd409
hv_exc: Handle M1RACLES mitigation here due to 12.0 spam
...
macOS 12.0 added a silly ineffective "mitigation" that clears the
register on every context switch. This doesn't actually mitigate
anything, but it does make this sysreg trap performance-critical,
so we have to move its handling into the C side.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-14 16:30:18 +09:00
Hector Martin
a18033e569
main: Add a searchable tag to find the m1n1 version
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-08-12 16:13:33 +09:00
Alyssa Rosenzweig
a52330809b
startup: Prettyify video depth dump
...
Use the right unit. for rgb10x2, this prints "30bpp" instead of "0x1E".
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
2021-08-03 13:48:28 +09:00
Sven Peter
856a9dbd1b
usb: don't initialize more than once
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-10 16:29:05 +09:00
Sven Peter
5d2315a865
uartproxy: flush iodev before shutting down
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-10 16:29:05 +09:00
Sven Peter
e0d889fac1
hv: add proper single stepping support
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-09 15:52:40 +09:00
Sven Peter
6afe9ebaf9
kboot: move SEPFW to initrd before booting
...
Bootstrapping SEPOS requires to setup a scratch buffer and
will have to be handled by the final OS. We pass along
the firmware image by appending it to the initramfs.
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-07-09 15:40:11 +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
Hector Martin
95aeb7bb83
hv: Use hv_write_hcr() for initial configuration
...
This might make things work if GXF is already enabled, maybe.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-22 01:15:00 +09:00
Janne Grunau
98076ef693
usb: disable tps6598x interrupts
...
Restore the interrupt masks on chainload or HV guest start. The
interrupt mask is not restored on the USB-C port used by the hypervisor.
This prevents an interrupt storm in the guest when the other USB-C port
is exposed to the guest. Both tps6598x share unfortunately an interrupt
line.
Signed-off-by: Janne Grunau <j@jannau.net>
2021-06-18 14:26:54 +09:00
Hector Martin
7e5054548a
hv_vm: Rename SPTE_SYNC_TRACE to SPTE_TRACE_UNBUF
...
It's not really synchronous, it just flushes USB buffering.
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-15 16:10:06 +09:00
Hector Martin
a664bd5d55
hv_vm: Minor fixes to pagetable code
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-15 15:47:44 +09:00
Hector Martin
7ff613665b
hv_asm.S: Add comments to the vectors
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-15 15:47:24 +09:00
Hector Martin
5751fa0019
hv_vm: Remove broken hv_max_proxy_hook
...
Signed-off-by: Hector Martin <marcan@marcan.st>
2021-06-15 15:47:07 +09:00
Mark Kettenis
d33d7ba89d
kboot: Provide MAC addresses in device tree
...
Read the MAC addresses from the ADT and store them in
"local-mac-address" properties on the relevant nodes in the FDT.
This relies on appropriate aliases in the provided FDT, which
matches how U-Boot provides MAC addresses on embedded targets.
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2021-06-15 15:27:18 +09:00
Sven Peter
9e061c2b50
usb_dwc3: shutdown the DART as well when shutting down usb
...
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-06-10 15:41:33 +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
3e807d6686
dart: shutdown to bypass mode
...
This allows payloads to use DMA for anything that's not PCIe
even without a DART driver. It also restores the DART registers
the state the were left by iBoot.
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-06-10 00:00:37 +09:00
Janne Grunau
4b5c016368
hv: disable PMU counters inside the hypervisor
...
Signed-off-by: Janne Grunau <j@jannau.net>
2021-06-09 19:47:20 +09:00
Janne Grunau
d61bf13cb0
hv: shadow perf monitor IRQ mode and state
...
The development Mac OS kernel panics if the PMCR0 sysreg is in an
unexpected state. To avoid that the hypervisor needs to shadow the
interrupt mode and interrupt active flag after it mask the PM FIQ.
Mac OS reads and writes frequently from PMCR0 and PMC 0/1 so handling
in m1n1 is preferred over Python.
Signed-off-by: Janne Grunau <j@jannau.net>
2021-06-09 19:47:20 +09:00
Sven Peter
9529ec2b4f
usb: add hpm_init and split usb_init and usb_iodev_init
...
This allows to bringup the USB PHY and the HPM for the
payload without having to initialize the CDC ACM driver
at the same time.
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2021-06-09 19:45:38 +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