Page MenuHomeFreeBSD

asmc: add MMIO backend for T2 Macs
Needs ReviewPublic

Authored by guest-seuros on Tue, May 19, 10:13 AM.
Tags
None
Referenced Files
F157610422: D57086.diff
Sat, May 23, 9:31 AM
F157554916: D57086.diff
Fri, May 22, 6:50 PM
F157552914: D57086.id178079.diff
Fri, May 22, 6:19 PM
Unknown Object (File)
Thu, May 21, 11:45 AM
Unknown Object (File)
Thu, May 21, 10:11 AM
Subscribers

Details

Reviewers
adrian
ngie
Summary

T2 Macs (2018+) expose the SMC via memory-mapped registers instead of
I/O ports. Add asmcmmio.c/asmcmmio.h implementing the MMIO transport:
key read/write, getinfo, getbyindex, and a poll-based wait with
exponential backoff.

The driver probes for MMIO at attach time by checking the LDKN firmware
version key; if MMIO is available it is used, otherwise the standard
I/O port backend is used.

T2 fan speeds use IEEE 754 floats instead of fpe2 fixed-point.
Per-fan manual mode uses F%dMd keys instead of the FS! bitmask.
Battery charge limit is exposed via dev.asmc.N.battery_charge_limit.

Tested on:

MacBookPro16,2 (A2251, iBridge2,10)
MacBookPro15,4 (A2159, iBridge2,8)
MacBookAir8,2  (A1932, iBridge2,5)
Mac mini 8,1   (A1993, iBridge2,7)
iMac20,2       (A2115, iBridge2,16)
iMacPro1,1     (A1862, iBridge1,1)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 73216
Build 70099: arc lint + arc unit