Skip to content

Add AppleT2Smc module: Apple T2 SMC over MMIO#71

Open
golirt1 wants to merge 2 commits into
namazso:mainfrom
golirt1:add-apple-t2-smc
Open

Add AppleT2Smc module: Apple T2 SMC over MMIO#71
golirt1 wants to merge 2 commits into
namazso:mainfrom
golirt1:add-apple-t2-smc

Conversation

@golirt1

@golirt1 golirt1 commented Jul 1, 2026

Copy link
Copy Markdown

Adds a module for the SMC on 2018–2020 Intel Macs with the Apple T2 chip.

On those machines the T2 intercepts the legacy SMC I/O-port protocol
(0x300/0x304), so the usual port handshake returns garbage under Windows. The T2
instead exposes the SMC through an MMIO window at physical 0xFE0B0000.

The module maps that window with io_space_map and performs the SMC
request/response handshake in kernel mode, exposing only SMC operations — it
never exposes raw physical memory access:

  • ioctl_smc_read — READ (0x10), GET_KEY_BY_INDEX (0x12), GET_KEY_TYPE (0x13)
  • ioctl_smc_write — WRITE (0x11)

Writes are restricted by an allowlist to fan-control keys only (F<n>Tg,
F<n>Md, FS! ), so the module can't be used to poke arbitrary SMC state —
only fan speed/mode, which is its purpose. main() probes FNum and refuses to
load (STATUS_NOT_SUPPORTED) if the SMC doesn't respond, so it won't touch this
physical range on non-Apple hardware.

Register offsets, access widths (control registers are 32-bit writes;
status/length/error are byte reads; the data buffer is byte-addressed), the
completion-status bit (0x20) and the exponential backoff mirror the Linux T2
applesmc driver (MCMrARM/mbp2018-etc, applesmc_t2_kmod.c). GET_KEY_TYPE's
special MMIO result layout (type@0, datalen@5, flags@6) is repacked into the
conventional [len, type, flags] form.

Compiles cleanly with the repo CI. I'd appreciate a review of the access widths
and the write allowlist in particular. Thanks!

golirt1 added 2 commits June 27, 2026 13:29
On 2018-2020 Intel Macs the T2 chip intercepts the legacy SMC I/O-port protocol, so the SMC is only reachable through an MMIO window at 0xFE0B0000. This module maps that window and performs the SMC read/get-key/write handshake in kernel mode, exposing only SMC operations (no raw physical memory access). Writes are restricted by an allowlist to fan-control keys (F<n>Tg, F<n>Md, FS!). Register offsets, access widths and protocol follow the Linux T2 applesmc driver.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant