Skip to content

fan: implement bounded global-mask fpe2 capability family #46

Closed

Description

@mksolutionsuniversal

Purpose

Track the second Apple SMC fan-control mechanism by runtime capability fingerprint, not by T1/T2 generation labels or an exact-model runtime whitelist.

The product goal is generation-neutral fan control on supported Apple Intel Macs: detect the live SMC schema, fan count and hardware-defined limits, then select only a previously verified bounded writer.

Physical read-only evidence

PerFanModeFloat32 control

MacBookPro16,1 physically produced:

  • FNum = 2,
  • F{i}Mx/Ac/Tg: flt / 4 bytes,
  • F{i}Md: present / ui8 ,
  • FS! : absent,
  • classifier: PerFanModeFloat32,
  • zero SMC writes,
  • profiler PASS.

GlobalMaskFpe2 control

MacBookPro12,1 physically produced:

  • FNum = 1,
  • F0Mn: fpe2, len 2, attrs 0xC0, raw 144C,
  • F0Mx: fpe2, len 2, attrs 0xC0, raw 60DC,
  • F0Ac: fpe2, len 2, attrs 0x90, raw 2404,
  • F0Tg: fpe2, len 2, attrs 0xD0, raw 248C,
  • F0Md: absent,
  • FS! : ui16, len 2, attrs 0xC0, raw 0000,
  • classifier: GlobalMaskFpe2,
  • zero SMC writes,
  • profiler PASS.

The physical F0Mx = 0x60DC = 24796 matches the previously observed 6199 RPM maximum at raw / 4, confirming the known big-endian fpe2 scale for this family without guessing.

PR #50, the generic read-only SMC fan profiler, has been merged to main as d0c5c4644c24c6f703dcf3d541c15ac0f35f6377.

A T1-era physical machine is temporarily unavailable. T1 validation is deferred and is not a blocker for implementing the capability-driven architecture; no T1-specific compatibility claim should be made until physically tested.

Product runtime contract

  • Apple + Intel is the platform gate.
  • FNum is authoritative for dynamic topology.
  • FNum = 0 is a valid passive/fanless topology: CPU profile remains available, zero fan writes, clear fan-not-applicable status.
  • Exact model/year/T1/T2 labels are not the fan-writer selector.
  • A recognized live capability fingerprint selects its bounded writer.
  • Unknown/mixed fingerprints remain read-only and issue zero fan writes.
  • Maximum Safe RPM is always fresh live per-fan F{i}Mx.
  • Tester diagnostics should expose enough sanitized capability metadata to triage a new fingerprint.

GlobalMaskFpe2 implementation requirements

  1. Add a family-aware capability model/classifier without regressing PerFanModeFloat32.
  2. Add safe fpe2 decoding based on the physically confirmed big-endian unsigned value divided by 4.
  3. Treat the global FS! mask as the mode authority for this family; do not invent per-fan Md keys.
  4. Derive the manual mask dynamically from discovered fan count only within a proven representable/safe bound. Known semantics: 00 00 Auto, 00 01 fan 0 manual, 00 02 fan 1 manual, 00 03 both manual.
  5. Write Maximum Safe targets only from fresh live F{i}Mx; prefer exact source raw fpe2 bytes when the target schema matches, avoiding unnecessary conversion/rounding.
  6. Verify every hardware transition by fresh readback.
  7. Apple Auto rollback/recovery is a global FS! = 00 00 transition followed by readback verification.
  8. Ownership/recovery persistence must identify the capability family and remain compatible with existing PerFan ownership schemas.
  9. A current model mismatch may still block recovery of a persisted ownership marker because that marker belongs to a specific physical machine; this is ownership safety, not a compatibility whitelist.
  10. No arbitrary SMC write surface, RPM slider, minimum-RPM write or guessed key/value.

Safety boundary

  • No physical SMC write from CI/unit tests.
  • No production write enablement for unknown fingerprints.
  • No hard-coded fan count.
  • No hard-coded maximum RPM values.
  • No T1/T2-generation switch as runtime permission gate.
  • Do not guess missing key metadata, mask layout beyond the proven bound, byte order, or write timing.

Activity

  1. changed the title [-]research: define safe T1 and classic Intel fan-control family[/-] [+]research: define safe global-mask fpe2 fan-control family[/+] on Sep 6, 2026
  2. mksolutionsuniversal commented on Sep 6, 2026

    @mksolutionsuniversal
    OwnerAuthor

    Physical GlobalMaskFpe2 evidence: MacBookPro12,1 — PASS

    The generic read-only profiler from draft PR #50 was run on physical MacBookPro12,1 hardware and classified the machine as GlobalMaskFpe2 from live SMC metadata, with zero writes.

    Observed fingerprint:

    • AppleSMC protocol: Mmio
    • FNum = 1
    • F0Mn/Mx/Ac/Tg: fpe2, len 2
    • F0Md: unavailable
    • FS! : present, len 2, type ui16, raw 00 00
    • candidate: GlobalMaskFpe2

    Live F0Mx raw bytes were 60 DC. Interpreted big-endian, 0x60DC = 24796; using the historical MFC maximum for this exact machine (6199 RPM) gives 24796 / 4 = 6199. This resolves the fpe2 encoding for this family as big-endian fixed-point with two fractional bits (raw / 4) from physical evidence rather than assumption.

    This supports mechanism/capability-based routing (GlobalMaskFpe2) rather than T1/T2 generation or exact-model runtime gates. No production writer has been enabled yet; Adrian's physical machine remains the final planned read-only checkpoint before bounded writer work.

  3. changed the title [-]research: define safe global-mask fpe2 fan-control family[/-] [+]fan: implement bounded global-mask fpe2 capability family[/+] on Sep 6, 2026
  4. mksolutionsuniversal commented on Sep 6, 2026

    @mksolutionsuniversal
    OwnerAuthor

    Architecture contract merged via PR #51 as eea7c53c5f96dc3fa87b28ebc83cfee287767d22 after CI #168 passed. main now documents capability-driven routing, FNum=0 passive/fanless semantics, model-validation vs runtime-compatibility separation, and family-neutral UI wording. No hardware-write sequence was broadened by PR #51. Next implementation target is the bounded GlobalMaskFpe2 family plus family-aware probe/preflight/recovery/diagnostics, preserving the existing PerFanModeFloat32 path.

  5. mksolutionsuniversal commented on Sep 8, 2026

    @mksolutionsuniversal
    OwnerAuthor

    Physical write qualification update — one-fan GlobalMaskFpe2 PASS

    On 2026-09-08, the bounded one-fan GlobalMaskFpe2 mechanism completed its first BCPC-owned physical write/readback/Apple Auto round trip on MacBookPro12,1.

    Fresh pre-write fingerprint:

    • Protocol = Mmio (1)
    • FNum = 1
    • Family = GlobalMaskFpe2
    • hardware safety gate satisfied
    • FS! = ui16 / len2 / attrs 0xC0 / raw 0000
    • F0Md = ConfirmedAbsent
    • F0Mx = fpe2 / len2 / attrs 0xC0 / raw 60DC / 6199 RPM
    • no capability warnings/failures

    Exact physical transaction:

    WRITE #1: FS!  0001
    READBACK: FS! raw=0001
    
    READBACK: F0Mx raw=60DC
    WRITE #2: F0Tg 60DC
    READBACK: F0Tg raw=60DC
    
    WRITE #3: FS!  0000
    READBACK: FS! raw=0000
    Emergency/final Apple Auto readback: VERIFIED 0000
    

    Final probe remained GlobalMaskFpe2, FS! was exactly 0000, the hardware safety gate remained satisfied, and the qualifier reported:

    SMC writes issued: 3
    Total SMC write attempts: 3
    PHYSICAL QUALIFICATION: PASS
    Qualifier exit code: 0
    

    The wrapper restored the AppleSMC service to its original Stopped state after PASS.

    Repository validation record: docs/0.5.0-rc.2-GLOBALMASK-FPE2-HARDWARE-VALIDATION.md on PR #52.

    Qualification boundary remains explicit: this PASS covers the observed one-fan mechanism only. Two-fan FS! = 0003, generic T1 support, and native BootCampSmc physical writes remain unqualified by this test.

  6. mksolutionsuniversal commented on Sep 8, 2026

    @mksolutionsuniversal
    OwnerAuthor

    GlobalMaskFpe2 implementation checkpoint — completed

    PR #52 has been squash-merged to main as:

    3389f716c961e31bfb4996bc400214777b158878 — fan: add global-mask fpe2 capability family (#52)

    Completed scope:

    • capability-driven GlobalMaskFpe2 classification,
    • strict Available / ConfirmedAbsent / ReadFailed observation model,
    • bounded exact-raw fpe2 Maximum Safe RPM writer,
    • FS! mode authority with verified readback,
    • family-aware ownership and schema-v4 crash journal,
    • deterministic partial-transaction restart recovery,
    • unknown-transport read-only diagnostics with write gate closed,
    • downgrade-safe legacy PerFan persistence behavior,
    • one-fan physical GlobalMaskFpe2 write/readback/Apple Auto qualification on MacBookPro12,1.

    Physical one-fan transaction PASS:

    FS! 0000 -> 0001
    F0Mx 60DC -> F0Tg 60DC
    FS! 0001 -> 0000
    final Apple Auto verified
    

    Qualification boundary intentionally retained:

    • two-fan GlobalMaskFpe2 / FS! = 0003 is implemented only within the bounded proven software contract but has not received a BCPC-owned physical write qualification,
    • no generic T1 claim,
    • no model-based runtime writer permission,
    • native BootCampSmc write qualification remains a separate research track.

    CI #176 passed on the final PR head before merge: Gate 5D-B, restore, build, tests, and release packaging all SUCCESS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions