Commit graph

2256 commits

Author SHA1 Message Date
Sasha Finkelstein
62ff43f095 kboot: Pass through SEPFW and boot object manifests
Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
2024-11-11 22:46:25 +09:00
Nick Chan
87a1279b86 kboot: Fix get_notchless_fb() on notched Macs
Fixes: 5bb8f04bdf ("kboot: Add workarounds for ADT for A7-A11 SoCs.")
Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-11-11 22:08:51 +09:00
Janne Grunau
3854c7668a pmgr: Fix false positive u8 pmgr ID detection on modern SoCs
The id1 field used on oder SoCs is not constant 0 for all devices on
t8122. Instead just compare the id1 fields of the two first devices.
Fixes "pmgr: Failed to find parent #36 for IOA0\n" errors in
pmgr_init().

Fixes: fb59dc03ca ("pmgr: Fix struct for older SoCs")
Signed-off-by: Janne Grunau <j@jannau.net>
2024-11-03 23:15:09 +09:00
Hector Martin
b901c2706f rust: 1.82.0 compat
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-11-03 19:51:53 +09:00
a-ramses
d54b97881a apple_regs.json: add HID12 already used register
Signed-off-by: a-ramses <abdicheramzi@gmail.com>
2024-11-03 19:16:43 +09:00
Daniel Berlin
750f3307f0 m1n1.hv: Add M3 and M3 Max chip IDs
Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
Signed-off-by: Janne Grunau <j@jannau.net>
2024-11-03 19:16:43 +09:00
Janne Grunau
dd74f20bf5 proxy.hv: Determine boot CPU by cpu[N].state ADT property
Signed-off-by: Daniel Berlin <dberlin@dberlin.org>
Co-Developed-by: Daniel Berlin <dberlin@dberlin.org>
Signed-off-by: Janne Grunau <j@jannau.net>
2024-11-03 19:16:43 +09:00
Janne Grunau
eb8430ba7e tools/chainload: Determine boot CPU by cpu[N].state ADT property
Signed-off-by: Janne Grunau <j@jannau.net>
2024-11-03 19:16:43 +09:00
Janne Grunau
a603b86e6b smp: Handle boot CPU index != 0
Signed-off-by: Janne Grunau <j@jannau.net>
2024-11-03 19:16:43 +09:00
Janne Grunau
293e122845 startup: Determine boot CPU by cpu[N].state ADT property
Signed-off-by: Janne Grunau <j@jannau.net>
2024-11-03 19:03:57 +09:00
Nick Chan
4bde778779 usb: Skip USB init for now on A7-A11 SoCs.
We do not support the USB controller on A7-A11 SoCs yet, but still do not
try to init dwc3 on them.

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
fb59dc03ca pmgr: Fix struct for older SoCs
At some point Apple ran out of bits and have to widen the device field
to 16-bit. This adds support for the old 8-bit layout.

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
9ca6d1c16f exceptions: add el3_call()
Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
1fd17b8933 exceptions: fix el0_call() and el1_call() when running in EL1
Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
5b8cfd1e7c kboot: Reserve secondary CPU stacks
The secondary CPU may potentially use the stack after leaving WFE.

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
5bb8f04bdf kboot: Add workarounds for ADT for A7-A11 SoCs.
Account for the differences between the iOS ADT and macOS ADT, and also
some physical differences between Apple Silicon Macs and A7-A11 devoces,
reflected in the ADT.

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
d0889bda14 fb: Add A7-A11 device support
This includes:
- Do not treat iPhone 5 buffer as dummy on 5s
- Added support for 24-bit framebuffer
- When we have a vertical display, use whole fb as console

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
c28d6b7172 smp: Add A7-A9X cache errata workaround
Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
da3519de14 smp: Add support for deep sleep on A7-A9X
Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
dadc48ed10 smp: Write _vectors_start into boot CPU rvbar where possible
On A7-A11 we have a ROM exploit and we can keep CPU0 RVBAR unlocked.

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
3b7fd2ce5e smp: Add support for ADT from old FW
Old ADT does not have /cpus/cpu<n>/cpu-impl-reg, and the value is in
/arm-io/pmgr/reg[2*n+2].

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
cb0ceb4ee8 smp: Added A7-A11 start support
This includes:

- EL3 handling
- "Slow" IPI support
- New start offsets

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
32ca84c769 memory: Add support for 4K translation
Add support for 4K page sizes, supported by A7-A8X.

Co-developed-by: fenfenS <104295404+fenfenS@users.noreply.github.com>
Signed-off-by: fenfenS <104295404+fenfenS@users.noreply.github.com>
Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
f4ca3a19fd Add support for different boot-args revisions.
Boot-args version 1 (iOS 12), and version 3 (iOS 18, macOS 15).

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
869d2ae35c Skip over features unsupported in A7-A11 SoCs.
This includes
- GXF
- SPRR
- PAN (A7-A9)
- Atomics (A7-A10)
- FIPI (A7-A10)
- DCP

SPRR on T8030 seems to be quite different from M1 (at least according to
qemu-t8030), so keep it disabled for those CPU parts.

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
accb393510 Add support for handling EL3.
A7-A9X has an EL3. Handle it (without SMP support).

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
5dfb07f3da chickens: Add A7-A11 chickens
Cyclone and Typhoon are similar enough to share a file.

Hurricane and Zephyr are the physical cores on A10 backing the
Hurricane-Zephyr logical core.

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
5560190b36 utils: Add more functions to detect CPU features
These functions will be used to skip over parts not supported by A7-A11 SoCs.

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Nick Chan
226ec5298d soc: Added UART bases for A7-A11, T2 SoCs.
Add UART bases for A7-A11, T2 SoCs.

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
2024-10-31 01:32:39 +09:00
Ayrton Munoz
e98f3a3525 proxyclient: Modify FreeBSD loader to use standard U-Boot bootefi cmd
The FreeBSD script added in #185 required patching u-boot since it specified the
loader base/size in a non-standard way. This changes the way arguments are
passed to the bootefi command so it works with the asahi u-boot fork which I've
been using. I also changed the case where the loader isn't specified to have
u-boot boot from the nvme since I have that driver functional enough to have it
mount the root fs now.

Signed-off-by: Ayrton Munoz <a.munoz3327@gmail.com>
2024-10-31 01:26:49 +09:00
a-ramses
b78a3a20d6 assigning already existing flag with name for HID3
Signed-off-by: a-ramses <abdicheramzi@gmail.com>
2024-10-31 01:26:30 +09:00
Eileen Yoon
d649c8803f aop: Add lpai + voicetrigger test (doesn't work)
I'm getting garbage from the low-power audio input (lpai) mic which
exists solely for voicetrigger. The garbage specifically is `61 7b`
repeated. Obviously no voicetrigger report because there's nothing
useful in lpai output. I'm suspecting its an mca/clock issue (maybe even
SEP/permissions) because there's nothing suspicious from the aop RX/TX
IPC side.

```
[audio.audio] Report REPORT/0xee #0
[audio.audio] unknown report: 0xee
00000000  c5 96 20 01 00 00 00 00  9c f5 10 00 00 00 00 00  |.. .............|
00000010  b8 07 00 00 20 30 6e 69  01 00 00 00 43 02 00 00  |.... 0ni....C...|
00000020  00 00 00 00 c5 96 20 01  00 00 00 00 00 00 00 00  |...... .........|
00000030  a4 07 00 00 9a 07 00 00  61 7b 61 7b 61 7b 61 7b  |........a{a{a{a{|
00000040  61 7b 61 7b 61 7b 61 7b  61 7b 61 7b 61 7b 61 7b  |a{a{a{a{a{a{a{a{|
00000050  *
000007b0  61 7b 61 7b 61 7b 61 7b                           |a{a{a{a{        |
```

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
5c5d3966f3 afk.epic: Expose ep function to call send_cmd()
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
48a92026cd aop: Support Ambient Light Sensor (ALS) endpoint
```
[syslog] * [ALSCT720.cpp:967]updateDynamicIntegrationParameters allAbove=0, anyBelow=1, threshold hit=0, lev
> 02:0x50000000000005 (TYPE=0x5, INDEX=0x5)
< 24:0x85000000000000
[als.als] Report REPORT/0xc4 #0
[als.als] Container:
    unk0 = 0xEC
    sequence = 4
    timestamp = 0x0000000019352268
    red = 11
    green = 18
    blue = 11
    clear = 40
    lux = 7.277451038360596
    unk_zero = 0
    status = 3
    gain = 256
    unk3 = 68
    unk4 = 35
    unk5 = 17874
    integration_time = 378080
< 02:0x50000000000006
[syslog] * [ALSCT720.cpp:454]handleInterrupt: result: 0 (status=0x3)
> 02:0x50000000000006 (TYPE=0x5, INDEX=0x6)
```

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
2b62c08619 aop: Stream high-power mic samples to ADMAC
Output audio format still unknown, not sure if it's garbage (see lpai
commit) or some weird packed float encoding I'm not figuring out.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
0ebc339761 aop.ipc: Use print as default logger
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
33c4591ff3 aop.ipc: Rename & fill in more property keys
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
9202652908 aop.ipc: Fill in more known audio config fields
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
a4fb7af657 hv/trace_dcp: Fix afk/epic API breakage
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
7298f42ce7 hv/trace_aop: Handle afk/epic API breakage
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
eebff23b5a afk.rbep: s/BLOCK_SIZE/BLOCK_STEP/
Otherwise the previous commit is way too confusing.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
476c31e973 afk.rbep: Bootstrap ringbuf block size at runtime
Make the ringbuffer class robust to various block sizes to generalize to
both DCP and AOP.

The first three blocks of the ringbuffer is reserved for exchanging size,
rptr, wptr:

```
           bufsize      unk
00000000  00007e80 00070006 00000000 00000000 00000000 00000000 00000000 00000000
00000020  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000040  *   rptr
00000080  00000600 00000000 00000000 00000000 00000000 00000000 00000000 00000000
000000a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
000000c0  *   wptr
00000100  00000680 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000120  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000140  *
```

Each block is spread out by some block_size multiple of 0x40 (step). The
0th block holds the size of the ringbuffer contents, the 1st block holds
the rptr, and the 2nd block holds the wptr. The actual contents of the
ringbuffer starts after the first three blocks, which will be
collectively called the "header".

However, this block_size isn't constant. DCP seems to consistently use
0x40, but AOP can use both 0x40/0x80. Since we're not given the block_size,
so wemust bootstrap it. Recall we are given the total size of the
rinbuffer in the mailbox message. Since we're always given the size of
the ringbuffer `bufsize` at offset +block_size * 0 (or simply 0), and we
can find the header size by subtracting `bufsize` from the total size.
Since we also know that the header is always 3 blocks wide, we can
divide the header size by 3 to obtain the block_size.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
e76fc526e9 afk.epic: Support sending v2 EPIC subheader
Default to version=4 as to not break DCP

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
71c59d9894 afk.epic: Create API to register report handlers
Because AOP gets a lot of reports ;)

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
e430874a2a afk.epic: Support sending direct notify messages
Much simpler than the command messages. We just write directly into the
TX ringbuffer.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
5f59c5460c afk.epic: Handle EPIC replies by subtype
DCP only gets two reply types: a u32 retcode or a command reply. It
previously checked for retcode by checking length(data) == 4 and
assuming command otherwise. AOP can get other reply types (e.g. STRING
after probing device). It actually sends us the reply subtype in the
EPICSubHeader, so use that information and handle replies accordingly.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
6426bdf6a5 afk.epic: Enum for EPICSubtype & service init v2
Consistently use an enum for EPICSubtype (used later) and support the v2
EPICService intializer protocol used by AOP.

Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
bf5a3a6e98 m1n1.fw.afk: Add more hello handlers used by aop
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
eb3710edb1 experiments/dcp: Make dcp*.py scripts run again
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00
Eileen Yoon
8fd1e4bef4 m1n1.adt: Parse aop audio pdm ratios
Signed-off-by: Eileen Yoon <eyn@gmx.com>
2024-10-31 01:24:36 +09:00