Skip to content

Instantly share code, notes, and snippets.

View marcan's full-sized avatar

Hector Martin marcan

View GitHub Profile
marcan /
Created September 10, 2023 11:35
Apple TSO

ARM defines ACTLR_EL[321] as implementation defined.

Apple adds an IMPDEF ACTLR_EL12 as s3_6_c15_c14_6 and effectively implements VHE semantics. This does not seem to violate the architecture, since the register contents are IMPDEF anyway so nothing says they can't alias ACTLR_EL1 and ACTLR_EL2 together in EL2.

ACTLR_EL1 is trapped by HCR_EL2.TACR. It is also trapped by HACR_EL2<0> (which has all the controls for fine-grained Apple IMPDEF stuff).

In addition, AIDR_EL1 contains feature bits for Apple IMPDEF functionality. It is identical in EL1 and EL2 and is trapped by HCR_EL2.TID1 and HACR_EL2<4>.


View dcp_surfaces.txt
0x000 1 isTiled
0x001 1 isTearingAllowed
0x002 1 isPremultiplied
0x003 4 planeCount
0x007 4 planeCount2
0x00b 4 pixelFormat
0x00f 4 YCbCrMatrix
0x013 1 transferFunctionIndex
13 == SDR
16 == HDR


Tested with 10-bit mode on KDE on an M1 Pro.

  • 12:
    • 10-bit mode: 0..1023
    • 8-bit mode: 0..255
    • Likely native primaries
      • Actually seems to be P3?
import tweepy, json, time, sys
auth = tweepy.OAuth1UserHandler(
<api keys here>
api = tweepy.API(auth)
d = json.loads(open(sys.argv[1]).read().split("=", 1)[1])
marcan /
Last active October 24, 2022 12:25
Asahi Linux patch stats
set -e
for i in $(git for-each-ref --format="%(refname:short)" refs/$ROOT/bits/); do
if git rev-parse --verify "$ROOT/bases/$name" &>/dev/null; then
marcan /
Last active August 21, 2022 11:17
Using systemd-boot with asahi

This is all preliminary and for experimentation only. You're on your own.

Make sure you're on asahi-dev and have your packages updated.

umount /boot/efi
mv /boot /boot.old
sed -i 's,/boot/efi,/boot,g' /etc/fstab
systemctl daemon-reload
mount /boot
marcan / CRCH35U31CIS_FP
Last active July 31, 2022 14:54
CRCH35U31CIS_FP HDD cage logs

Topology: VL822 hub + 4x ASM235CM (?) USB Gen2 - SATA bridges.

Tested with 4x WDC WD80EAZZ-00BKLB0 on an AMD X399 chipset.

~200MB/s from a single drive (this is about what the drive can do).

On a Gen1 port, I get ~400MB/s across all 4 drives. On a Gen2 port, ~800MB/s, give or take.

Power buttons power cycle the individual ASMedia controllers.

View furitool.js
var katescript = {
"author": "Hector Martin <>",
"license": "BSD",
"revision": 1,
"kate-version": "5.1",
"functions": ["furiTool"],
"actions": [
{ "function": "furiTool",
"name": "Insert Furigana",
"category": "Quick Coding",
marcan / apple-wifi-fw-manifest.txt
Created December 26, 2021 13:22
Firmware manifest for firmware extracted from macOS 12.0.1
View apple-wifi-fw-manifest.txt
FILE brcm/,hawaii-YSBC-m-2.3.txt SHA256 de541e00d270f9281aae26e69b725726377a0a723ae6a2ad6f5fd5695ecf2bd9
FILE brcm/,hawaii-YSBC-m-2.5.txt SHA256 3534748e3002b261d9a762e6193151d6d6a96afe3a15e828740af609b5be250e
FILE brcm/,hawaii-YSBC-u-4.1.txt SHA256 58b46c15ff838c090ad368f7efd8c05b9987f512bed1593eae691fa115fe3d30
FILE brcm/,hawaii-YSBC-u-4.3.txt SHA256 45f9bc9979e3a56161a536a0bd93794ab7c145aef979669703f6a82f913923ae
FILE brcm/,hawaii.bin SHA256 da0c4591cbbd9a3c2b5b442eb8411d127a0f12272e334e30e57e9555ddd62606
FILE brcm/,hawaii.clm_blob SHA256 a0c2064e73343e0ce163899fd830a93675882ed7b6aad1685dfd522fae47b33c
FILE brcm/,hawaii.txcap_blob SHA256 017fafaf3d046aff93dda1108e3e5f15901e8d9175bf9e429827d4d45acffc3c
FILE brcm/,ekans-HRPN-m-5.1.txt SHA256 5fcf696134db0a446e9226680f6134ba97179fbc8e1c4d5d8a2c19794815bc72
View brcmfmac-do-not-release-d11-resets.patch
commit 71f7c79c7af817477e553103c9eb03926e12ada4
Author: Hector Martin <>
Date: Mon Dec 20 20:00:57 2021 +0900
brcmfmac: chip: Only disable D11 cores; handle an arbitrary number
At least on BCM4387, the D11 cores are held in reset on cold startup and
firmware expects to release reset itself. Just assert reset here and let
firmware deassert it. Premature deassertion causes weird
nondeterministic AXI errors on firmware startup.