Skip to content

Commit 5538d3e

Browse files
authored
Merge branch 'main' into add-win11-docs
Signed-off-by: kokomo123 <70863536+kokomo123@users.noreply.github.com>
2 parents 6efb86c + 50e5385 commit 5538d3e

File tree

25 files changed

+258
-58
lines changed

25 files changed

+258
-58
lines changed

docs/alt/policy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ unstable package stream) within 2 weeks of becoming available upstream.
7272
## Installation procedure
7373
Asahi Linux uses Das U-Boot's UEFI environment to chainload standard UEFI
7474
bootloaders, such as GRUB and systemd-boot. The Asahi Installer is capable
75-
of setting up a minial UEFI-only environment capable of booting UEFI
75+
of setting up a minimal UEFI-only environment capable of booting UEFI
7676
executables on removable media. This provides users an installation
7777
experience that is almost identical to a standard amd64-based workstation.
7878
Building Apple Silicon support into your distro's existing AArch64 bootable
@@ -170,7 +170,7 @@ installation tooling sufficiently foolproof on Apple Silicon devices, we _may_ r
170170
the need to support the image-based installation flow going forward.
171171

172172
## Disendorsement
173-
Through dilligent QA and attention to detail, Asahi Linux has
173+
Through diligent QA and attention to detail, Asahi Linux has
174174
become well-regarded as one of the best desktop Linux experiences available.
175175
This is a great source of pride for us, and we are determined to meet the high
176176
user expectations that come with such a reputation. We expect officially

docs/fw/adt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ copy the im4p file from the below directory. See [Devices](../hw/devices/device-
5454

5555
`/System/Volumes/Preboot/[UUID]/restore/Firmware/all_flash/DeviceTree.{model}.im4p`
5656

57-
If the dir doesn't exist try disabling csrutil in recovery mode, going to settings and enabling terminal to acces all files, or start from `Volumes/Macintosh HD/` because it may be symlinked. If it's still not accessible, try good ol `sudo find . -type f -name '*.im4p'`.
57+
If the dir doesn't exist try disabling csrutil in recovery mode, going to settings and enabling terminal to access all files, or start from `Volumes/Macintosh HD/` because it may be symlinked. If it's still not accessible, try good ol `sudo find . -type f -name '*.im4p'`.
5858

5959
then use img4tool to extract the im4p file into a .bin file e.g.
6060
```

docs/fw/boot.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Apple Silicon devices seem to follow a boot flow very similar to modern iOS devi
88

99
# Stage 0 (SecureROM)
1010

11-
This stage is located in the boot [ROM](../project/glossary.md#r). Among others, it verifies, loads and executes normal stage 1 from [NOR](../project/glossary.md#n). If this fails, it falls back to [DFU](../project/glossary.md#d) and wait for an [iBSS](../project/glossary.md#i) loader to be sent, before continuing with the [DFU](../project/glossary.md#d) flow at stage 1.
11+
This stage is located in the boot [ROM](../project/glossary.md#r). Among others, it verifies, loads and executes normal stage 1 from [NOR](../project/glossary.md#n). If this fails, it falls back to [DFU](../project/glossary.md#d) and waits for an [iBSS](../project/glossary.md#i) loader to be sent, before continuing with the [DFU](../project/glossary.md#d) flow at stage 1.
1212

1313
# Normal flow
1414

@@ -20,26 +20,29 @@ This stage is the primary early loader, located in the on-board [NOR](../project
2020
* Get the local policy hash:
2121
- First try the local proposed hash ([SEP](../project/glossary.md#s) command 11);
2222
- If that is not available, get the local blessed hash ([SEP](../project/glossary.md#s) command 14)
23-
* Read the local boot policy, located on the iSCPreboot partition at `/<volume-group-uuid>/LocalPolicy/<policy-hash>.img4`. This boot policy has the following specific metadata keys:
23+
* Read the local boot policy, located on the iSCPreboot partition at `/<volume-group-uuid>/LocalPolicy/<policy-hash>.img4`. This boot policy has the following specific metadata keys ([4CCs](../project/glossary.md#4)):
2424
- `vuid`: UUID: Volume group UUID - same as above
2525
- `kuid`: UUID: KEK group UUID
2626
- `lpnh`: SHA384: Local policy nonce hash
2727
- `rpnh`: SHA384: Remote policy nonce hash
28+
- `ronh`: SHA384: Recovery OS policy nonce hash
2829
- `nsih`: SHA384: Next-stage IMG4 hash
2930
- `coih`: SHA384: fuOS (custom kernelcache) IMG4 hash
3031
- `auxp`: SHA384: Auxiliary user-authorized kernel extensions hash
3132
- `auxi`: SHA384: Auxiliary kernel cache IMG4 hash
3233
- `auxr`: SHA384: Auxiliary kernel extension recept hash
3334
- `prot`: SHA384: Paired Recovery manifest hash
35+
- `hrlp`: bool: Recovery OS local policy is Secure Enclave–signed
3436
- `lobo`: bool: Local boot policy
37+
- `love`: bool: Local OS version
3538
- `smb0`: bool: Reduced security enabled
3639
- `smb1`: bool: Permissive security enabled
3740
- `smb2`: bool: Third-party kernel extensions enabled
3841
- `smb3`: bool: Manual mobile device management (MDM) enrollment
3942
- `smb4`: bool?: MDM device enrollment program disabled
4043
- `sip0`: u16: SIP customized
41-
- `sip1`: bool: Signed system volume (`csrutil authenticated-boot`) disabled
42-
- `sip2`: bool: CTRR ([configurable text region read-only](https://keith.github.io/xcode-man-pages/bputil.1.html)) disabled
44+
- `sip1`: bool: Signed system volume (`csrutil authenticated-root`) disabled
45+
- `sip2`: bool: CTRR ([Configurable Text Read-only Region](https://keith.github.io/xcode-man-pages/bputil.1.html)) disabled
4346
- `sip3`: bool: `boot-args` filtering disabled
4447

4548
And optionally the following linked manifests, each located at `/<volume-group-uuid>/LocalPolicy/<policy-hash>.<id>.im4m`

docs/fw/macho-boot-protocol.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@ When running m1n1 initially, the relevant memory looks like this:
121121
+==========================+ <-- boot_args->top_of_kdata + boot_args->mem_size
122122
```
123123

124-
m1n1's heapblock area (used as a backend for malloc, and for loading payloads) starts at `boot_args.top_of_kdata` and has no bound at this time. When using proxyclient, ProxyUtils will set up a Python heap base 128MiB above whatever the current heapblock top is, which means m1n1 can use up to 128MiB of additional memory before it runs into Python-side structures. Note that fresh executions of the Python side will re-initialize their heap starting at whatever the current m1n1 end is, so e.g. m1n1-side memory leaks on each Python excecution are not an immediate problem until you run out of total RAM.
124+
m1n1's heapblock area (used as a backend for malloc, and for loading payloads) starts at `boot_args.top_of_kdata` and has no bound at this time. When using proxyclient, ProxyUtils will set up a Python heap base 128MiB above whatever the current heapblock top is, which means m1n1 can use up to 128MiB of additional memory before it runs into Python-side structures. Note that fresh executions of the Python side will re-initialize their heap starting at whatever the current m1n1 end is, so e.g. m1n1-side memory leaks on each Python execution are not an immediate problem until you run out of total RAM.
125125

126126
When chainloading another Mach-O payload, the next stage overwrites m1n1 in-place. The chainload.py Mach-O loading code skips the padding end of the m1n1 payload section (except 4 zero bytes as a marker), so SEP firmware and BootArgs follow directly in what would've otherwise been the m1n1 payload area, saving RAM. Relocating the SEP firmware is optional; if it is not enabled, it remains where it is, and top_of_kdata is kept untouched. Unless m1n1 grows by more than the size of its payload region, this should be safe.

docs/hw/peripherals/ace3.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: ACE3
3+
---
4+
5+
ACE3 is the new USB-C / USB-PD controller in M3 products. It has a sn201202x compatible value in the ADT.
6+
7+
## SPMI registers
8+
9+
Unlike its predecessors, the ACE3 is accessed via SPMI rather than I2C. However the underlying interface hasn't changed, a thin transport layer allows accessing what were previously I2C registers (which we'll refer to as "logical registers") through the SPMI registers.
10+
11+
- **0x00 (logical register address) [RW]:** writing `0x80 | logical_register_address` to this SPMI register triggers a logical register selection process. Once finished, the SPMI registers below are updated, the MSB in this register is cleared and an interrupt is asserted (see "Interrupts").
12+
13+
Note 1: The "register 0 write" SPMI command can also be used (the 7-bit value is completed with MSB=1 and will therefore trigger a logical register selection). In fact selections triggered using this command appear to have stricter semantics and seem to be needed in some cases, see "Dual-slave operation" below.
14+
Note 2: Writes with MSB=0 will update the register's value, but won't trigger a selection.
15+
16+
- **0x1F (logical register size) [RO]:** when a logical register is selected, its size in bytes is written here by the hardware.
17+
18+
- **0x20..0x5F (logical register data) [RW]:** when a logical register is selected, its data is read, zero-padded and written here by the hardware. Writes anywhere in this area cause the area's contents to be written (truncated as appropriate) to the last selected logical register.
19+
20+
Note 1: There doesn't seem to be a way to monitor the completion of a logical register write, but it seems to block further selections.
21+
Note 2: There doesn't seem to be a way to hold off the logical register write until later, so only logical registers of size ≤ 16 can be written atomically.
22+
23+
Other observations:
24+
25+
- Only the first 0x60 addresses are mapped, but address bits 7 and higher seem to be ignored, causing the block to be aliased every 0x80 bytes. Many consecutive SPMI registers can be accessed at once using extended (or extended long) commands.
26+
27+
- The device also supports the sleep and wakeup SPMI commands, and it's sleeping at boot. When sleeping, writes to SPMI registers are ACKed but ignored. It takes some time for the device to wake up after receiving the command (see also "Interrupts"). Even while in sleeping state, the ACE3 can respond to events (such as plugging a cable) and send the appropriate interrupts.
28+
29+
## Interrupts
30+
31+
Interrupts are no longer delivered through a GPIO pin; instead they are delivered through the SPMI controller, which thus also acts as an interrupt controller. I don't know how this works at the bus level, maybe delivery happens via a master write command? See the SPMI controller documentation for more info on how to receive these "SPMI interrupts".
32+
33+
The ADT lists 3 odd interrupts for each ACE3; we call the smaller of those `BASE`.
34+
35+
- [`BASE + 0`] **Logical interrupts** (marked as type 0 in the ADT): Asserted when an unacked (logical register 0x14) and unmasked (logical register 0x16) interrupt becomes pending. This serves the same purpose as the previous GPIO pin, however SPMI interrupts have edge/MSI semantics: each (unmasked) interrupt causes `BASE + 0` to be asserted once (even if there were other unacked+unmasked interrupts already) and not asserted again until ACKed.
36+
37+
- [`BASE + 2`] **Selection complete?** (doesn't appear in the ADT): Asserted each time a logical register selection completes.
38+
39+
- [`BASE + 4`] (doesn't appear in the ADT): Never observed in the wild.
40+
41+
- [`BASE + 6`] **Sleep complete?** (marked as type 2 in the ADT): Asserted when an SPMI sleep command is sent to the slave, even if the slave was already in that state. Possibly to indicate when the operation completes?
42+
43+
- [`BASE + 8`] **Wakeup complete?** (marked as type 3 in the ADT): Asserted when an SPMI wakeup command is sent to the slave, even if the slave was already in that state. Possibly to indicate when the operation completes? But the registers become writable much much earlier than receipt of the interrupt, so it may be something else.
44+
45+
The reason for this spacing of 2 in between (possible) interrupts is to support the dual-slave operation outlined below.
46+
47+
## Dual-slave operation
48+
49+
Each ACE3 seems to have two SPMI slaves at the bus: one listening at the address listed in the ADT (even), presumably for use by the AP, and another listening at the address immediately after (odd), presumably for use by *something else* (the SMC, perhaps). This seems to allow the ACE3 to be accessed by two masters without fighting over the state of the interface (SPMI registers, interrupts, etc). In particular:
50+
51+
- Each slave holds its own selection, even though they operate over the same logical registers. Each slave also seems to have some sort of cache for selections, which appears to be invalidated when the "register 0 write" command is used. By contrary, using a normal write to trigger a selection uses the cache and may return stale data: for example, logical registers may appear out of sync among the two slaves, and command execution (which involves writing a command to logical register 8) may appear to not finish, since subsequent reads of register 8 return the cached command rather than the result of the execution. Logical register writes are always committed immediately on writes to the 0x20..0x5F area, regardless how the selection was made.
52+
53+
- Each slave holds its own interrupt state: the "AP slave" uses register 0x14 for pending interrupts, register 0x16 for unmasked interrupts and register 0x18 to ACK interrupts. The other slave uses the same registers but shifted by +1 (0x15 for pending, 0x17 for unmasked, 0x19 for ACK). Drivers should be careful not to touch these (along with any other state owned by the secondary slave).
54+
55+
- Each slave holds its own sleeping state, but the ACE3 is only put to sleep if both slaves are in sleeping state. In this state, both slaves ignore writes to SPMI registers (but still ACK the commands). If at least one of the slaves is woken up, this doesn't happen (neither slave ignores writes). Whatever is using the secondary slave makes sure to only wake up the slave temporarily, perform the commands it needs to, and put it to sleep again. The "AP slave" is sleeping at boot.
56+
57+
- While the "AP slave" uses the SPMI interrupts documented above, the other slave uses the same interrupts but shifted by -1 (*not* +1). So for example selecting a register in the secondary slave causes a `BASE + 1` interrupt, the triggering of one of the interrupts in register 0x17 causes a `BASE - 1` interrupt, sending a sleep command to the secondary slave causes a `BASE + 5` interrupt and so on.
58+
59+
The secondary slave triggers abundant interrupts when e.g. plugging in a cable, making it clear something else is actually operating it. The fact that these interrupts make it to our SPMI controller hints at the interrupt delivery mechanism not being a "master write" command, since that's addressed to a single master and presumably the other user isn't using our SPMI controller but a separate SPMI master.

docs/hw/soc/ace3.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

docs/hw/soc/agx.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Data structures: see [cmdqueue.py](https://github.com/AsahiLinux/m1n1/blob/main/
109109

110110
### Micro Sequences
111111

112-
The ASC firmware contains a command sequencer that can run fairly complext "scripts" as part of work commands, but it is usually used in a fairly basic manner. These sequences are packed buffers of commands that are executed as part of a work item. The typical sequence is:
112+
The ASC firmware contains a command sequencer that can run fairly complex "scripts" as part of work commands, but it is usually used in a fairly basic manner. These sequences are packed buffers of commands that are executed as part of a work item. The typical sequence is:
113113

114114
* Start (3D/TA/CP)
115115
* Write Timestamp
@@ -163,7 +163,7 @@ The TA work usually looks like this:
163163

164164
#### Initialize Heap Manager
165165

166-
Needed the first time or when the heap size changes. Tells the GPU that the CPU re-initialized the management struture.
166+
Needed the first time or when the heap size changes. Tells the GPU that the CPU re-initialized the management structure.
167167

168168
There is an unknown context-related ID involved. This might be a heap manager ID? The (new) TA stamp value is also passed.
169169

docs/hw/soc/apcie.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ The following set of tunables operate on config space of the per-port PCIe bridg
6868

6969
### pcie-rc-tunables
7070
On the 2020 M1 mini, this set of register writes modifies some bits on standardized capability structures as well as some other registers.
71+
7172
| register | capability | effect |
7273
|----------|------------|--------|
7374
| 0x194 | L1 PM Substates | clear Port Common_Mode_Restore_Time |

docs/hw/soc/asc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ title: ASC
1919
0 - CPU_IDLE
2020
2121
0x400
22-
10 - set when the CPU is started (probaby by firmware)
22+
10 - set when the CPU is started (probably by firmware)
2323
2424
0x80c - IRQ_CONFIG
2525
0 - IRQ_CONTROLLER_ENABLE

docs/platform/feature-support/m1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ These are features/hardware blocks that are present on all devices with the give
3737
| cpufreq | 6.2 | 6.2 |
3838
| cpuidle | linux-asahi ([notes](#cpuidle-situation)) | ([notes](#cpuidle-situation)) |
3939
| Suspend/sleep | linux-asahi | linux-asahi |
40-
| Video Encoder | WIP | WIP |
40+
| Video Encoder | TBA | TBA |
4141
| ProRes Codec | - | TBA |
4242
| AICv2 | - | 5.18 |
4343
| DART | 5.15 | 6.1 |

0 commit comments

Comments
 (0)