aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/asmc/asmcvar.h
Commit message (Collapse)AuthorAgeFilesLines
* asmc: add sleep indicator LED control via sysctlAbdelkader Boudih2026-09-061-2/+13
| | | | | | | | | | | Add dev.asmc.0.sil sysctl to control the SIL LED via SMC keys MSLD (duty/brightness) and MSLS (state latch, must be set before re-enabling). MFC After: 1 week Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D58865
* asmc: add system state and board identity sysctlsAbdelkader Boudih2026-07-011-0/+86
| | | | | | | | | | | | Add dev.asmc.0.system subtree with read-only sysctls for SMC diagnostic and identity keys: shutdown_cause (MSSD), sleep_cause (MSSP), thermal_status (MSAL), time_of_day (CLKT), power_state (MSPS), board_id (RPlt), and chip_gen (RGEN). Each sysctl is registered only if the key exists on the hardware. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D57853
* asmc: try PIO before MMIO to avoid false T2 detectionAbdelkader Boudih2026-07-011-1/+1
| | | | | | | | | | | Add hw.asmc.system-state and hw.asmc.board-id read-only sysctls to expose the T2 system state register and Mac board identifier via SMC. Try PIO access before MMIO during probe to prevent false T2 detection on Macs that happen to have something mapped at the T2 BAR address. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D57844
* asmc: add MMIO backend for T2 MacsAbdelkader Boudih2026-06-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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) MFC after: 2 weeks Reviewed by: ngie, adrian Differential Revision: https://reviews.freebsd.org/D57086
* asmc: rename wol sysctl to auto_poweronAbdelkader Boudih2026-05-041-1/+3
| | | | | | | | | | | Older SMC firmware exposed AUPO as a Wake-on-LAN control. On updated firmware, the key controls automatic power-on when AC power is restored after a power loss; WoL is handled by the GBE controller instead. Rename the sysctl to reflect the current semantics. No compatibility alias is provided as the sysctl has not appeared in any release. Reviewed by: ziaee, adrian Differential Revision: https://reviews.freebsd.org/D56747
* asmc: replace hardcoded model table with universal probingAbdelkader Boudih2026-04-301-944/+17
| | | | | | | | | | | | | | | | | | | | | Probe SMC keys at attach time to detect hardware capabilities, supporting all Intel Apple machines without per-model entries. Sensors are discovered by scanning sorted SMC key ranges for known prefixes and types. Capabilities such as SMS, fan safe speed, and ambient light are detected by key presence. A global key description table provides human-readable names for well-known temperature sensors. Tested on: - MacBook Pro (Early 2007, Mid 2014, Mid 2015) - MacBook Air (Early 2015, Mid 2017) - iMac (Mid 2011, Late 2013) - Mac mini (Mid 2011) Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D56405
* asmc: add automatic voltage/current/power/ambient sensor detectionAbdelkader Boudih2026-04-171-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apple SMCs contain numerous undocumented voltage, current, power, and ambient light sensors. This change adds automatic detection and registration of these sensors as sysctls. New sysctl trees: dev.asmc.0.voltage.* - Voltage sensors (millivolts) dev.asmc.0.current.* - Current sensors (milliamps) dev.asmc.0.power.* - Power sensors (milliwatts) dev.asmc.0.ambient.* - Ambient light sensors Implementation: - Scans all SMC keys at attach time via asmc_key_dump_by_index() - Identifies sensors by key prefix patterns: - Voltage: VC*, VD*, VG*, VP*, VI* - Current: I{C,D,G,M,N,O,H,P,B,A,L}* - Power: P{C,D,N,S,T,H,F,Z,z}* - Light: ALV*, ALS* - Dynamically creates sysctls for detected sensors - Supports 8 fixed-point SMC data types: - sp78, sp87, sp4b, sp5a, sp69, sp96, sp2d, ui16 - Auto-converts all values to milli-units (mV, mA, mW) On Mac Mini 5,1, detects: - 7 voltage sensors - 18 current sensors - 27 power sensors - 2 ambient light sensors Enables power consumption monitoring, voltage rail debugging, and ambient light detection without hardcoding model-specific sensor lists. Tested on: - Mac Mini 5,1 (2011) running FreeBSD 15.0-RELEASE - 54 sensors auto-detected and exposed via sysctl - All sensor types verified with multimeter readings - Fixed-point conversions validated against known values - Memory management tested (malloc/free on detach) Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D55807
* asmc: correctly label ASMC_KEY_FANMINSPEED as read-writeMarcus Gartner2026-04-161-1/+1
| | | | | Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/2137
* asmc: add support for MacBookPro13,1Marcus Gartner2026-04-161-0/+18
| | | | | | | | | | | | | | | This commit adds support for the MacBookPro13,1 (late 2016, 13-inch). The SMC keys were collected from https://logi.wiki/index.php/SMC_Sensor_Codes. Two temperature keys are omitted because they fail to be read: TI0P (IO Proximity) and Ta0P (Ambient Air). Note that the with this model the `dev.asmc.0.fan.0.minspeed` setting only applies when the fans have been activated by the system. In my testing, the fans did not spin up until CPU temperatures hit about 80C. At lower temperatures, the fans will happily ignore the minimum speed and remain at 0 rpm. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/2137
* asmc: add raw SMC key read/write interfaceAbdelkader Boudih2026-04-151-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a debugging interface to read and write arbitrary Apple SMC keys by name through sysctl, enabling hardware exploration and control of undocumented features. The interface provides four sysctls under dev.asmc.0.raw.*: - key - Set the 4-character SMC key name (e.g., "AUPO") - value - Read/write key value as a hex string - len - Auto-detected key value length (can be overridden) - type - Read-only 4-character type string (e.g., "ui8", "flt") Implementation includes a new asmc_key_getinfo() function using SMC command 0x13 to query key metadata. The interface automatically detects key lengths and types, uses hex string encoding for arbitrary binary values, and is safe for concurrent access via CTLFLAG_NEEDGIANT. This interface was essential for discovering that the AUPO key enables Wake-on-LAN from S5 state, and for mapping all 297 SMC keys on Mac Mini 5,1. Reviewed by: ngie, adrian, markj Differential Revision: https://reviews.freebsd.org/D54441
* asmc(4): Add support for backlight(9) interfaceVladimir Kondratyev2026-03-291-0/+2
| | | | MFC after: 1 month
* Add ASMC support for Macbook Pro 8,3tslight2026-03-071-0/+33
| | | | | | Signed-off-by: tslight <tslight@pm.com> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1992
* asmc: output the SMC firmware revision on attachEnji Cooper2026-03-011-0/+3
| | | | | | | | | | | | | | | | The SMC firmware revision can prove helpful when determining why the behavior of a given controller varies from the maintainers' expected behavior. This should be a sysctl (eventually), but for now dumping out the information via `device_printf(..)` suffices, given that only one asmc(4) compatible device can exist in an Apple platform at any given point in time. This will become a sysctl in the future after additional improvements are incorporated from OpenBSD and NetBSD. MFC after: 1 week Obtained from: https://github.com/openbsd/src/ (sys/dev/acpi/asmc.c @ 142d064) Differential Revision: https://reviews.freebsd.org/D55577
* asmc: add Wake-on-LAN control via sysctlAbdelkader Boudih2026-02-251-0/+5
| | | | | | | | | | | | | | | | | Apple Mac systems support Wake-on-LAN from powered-off state (S5/G2) via the AUPO SMC key. This change adds a convenience sysctl, `dev.asmc.0.wol`. This can be disabled if set to 0 and enabled if set to 1. The AUPO key is volatile and resets to 0x00 on every boot, so WoL must be manually enabled before each shutdown to work from powered-off state. Users need to run: `sysctl dev.asmc.0.wol=1` before shutting down the system. The sysctl is best set to persist in `/etc/sysctl.conf`. MFC after: 1 week Reviewed By: markj, ngie Differential Revision: https://reviews.freebsd.org/D54439
* asmc: Add MacPro3,1 temperature sensor supportAbdelkader Boudih2026-02-151-0/+69
| | | | | | | Test and verified with Sonicblue7 Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D54952
* asmc: Add support for MacBookPro11,5Abdelkader Boudih2026-01-141-0/+35
| | | | | | | | | | | Add support for the MacBookPro11,5 (Mid 2015, 15-inch with AMD Radeon R9 M370X GPU) to the Apple SMC driver. Debug testing revealed this model lacks several SMC keys present on MacBookPro11,4 (IBLC, ICMC, IC2C), that model-specific sensor definitions. Differential Revision: https://reviews.freebsd.org/D54665 Reviewed by: adrian
* asmc: improve asmc_dumpall to read actual SMC key countAbdelkader Boudih2026-01-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | The asmc_dumpall debug function previously used a hardcoded loop limit of 0x100 (256) keys with a "XXX magic number" comment. This change improves asmc_dumpall to: * Read the actual number of keys from the ASMC_NKEYS SMC key * Print the key count being dumped for better debugging output * Loop only up to the actual key count (e.g., 297 on Mac Mini 5,1) This provides more accurate debug output and removes the magic number. Tested on Mac Mini 5,1 (FreeBSD 16.0-CURRENT): * Rebuild kernel with DEBUG enabled in asmc driver * Boot with new kernel * Verify dmesg shows "asmc_dumpall: dumping 297 keys" (or actual count) * Verify all 297 keys are dumped Differential Revision: https://reviews.freebsd.org/D54436 Reviewed by: markj, adrian
* asmc: Add support for macmini 6,1 and 6,2 (late 2012) modelsHrant Dadivanyan2025-04-251-0/+62
| | | | | | | This adds the ASMC support for the macmini 6,1 and 6,2. PR: kern/268141 Differential Revision: https://reviews.freebsd.org/D49929
* asmc: Add support for MacbookPro11,4Joshua Rogers2024-08-261-0/+34
| | | | | | | Signed-off-by: Joshua Rogers <Joshua@Joshua.Hu> MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/1366
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* asmc: Add MacbookAir6,2Adrian Chadd2023-01-211-0/+25
| | | | | | | | | | Add in the zones for my MacbookAir6,2, a 2013 Macbook Air. Tested - said Macbook Air 2013. Thermal Zones and keyboard backlight control works fine. Differential Revision: https://reviews.freebsd.org/D38073 Approved by: jrtc27
* asmc: Add support for MacBook5,5Michael Gmelin2023-01-061-3/+28
| | | | | | | | | | | This is a slightly refined version of a patch[0] by FreeBSD Forums user "tmcclean". [0]https://forums.freebsd.org/threads/success-installing-freebsd-13-0-on-macbook-pro-5-5.80458/ Reviewed by: adrian, emaste, imp Differential Revision: https://reviews.freebsd.org/D37900 MFC after: 1 month
* asmc: Add support for MacBookPro6,2ed crowe2022-07-251-0/+32
| | | | | | | | | | Modify asmc_sms_printintr() to be silent when the ambient light sensor interrupt fires on this model, since the messages can otherwise fill up the dmesg. PR: 265005 Reviewed by: markj MFC after: 2 weeks
* asmc: Update Mac Pro 6 sensor definitionsAdam S2022-05-091-10/+10
| | | | | | | | | - Make descriptions a bit more human-friendly. - Don't attempt to probe fan safe speeds, this model does not provide one. PR: 260781 MFC after: 2 weeks
* asmc: Add support for Macmini 5,1 (2011) and 5,3 and 7,1 (2014) modelsTrev2022-05-041-0/+31
| | | | | PR: 262456 MFC after: 2 weeks
* asmc: StyleMark Johnston2022-05-041-1/+1
| | | | MFC after: 2 weeks
* asmc: Add support for MacBook Pro 9,1 (mid 2012)Daniel W. Delâtre2022-05-041-3/+33
| | | | | PR: 261981 MFC after: 2 weeks
* asmc: Make the model table const and local to asmc.cMark Johnston2022-05-041-1/+1
| | | | | | No functional change intended. MFC after: 2 weeks
* asmc: Add support for MacPro 6,1 (2013)Adam S2022-05-041-0/+16
| | | | | PR: 260781 MFC after: 2 weeks
* asmc: Add support for MacBook Air 4,1 and 4,2 (2011)Mark Johnston2022-05-041-0/+24
| | | | | | | PR: 218574 Submitted by: NapoleonWils0n <t43InvisibleMan@gmail.com> Submitted by: John Hay <john@sanren.ac.za> MFC after: 2 weeks
* asmc: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-6/+1
| | | | Notes: svn path=/head/; revision=365114
* asmc(4): Add support for MacBook7,1.Mark Johnston2020-08-171-0/+15
| | | | | | | | | PR: 248693 Submitted by: gcx61@interia.pl MFC after: 1 week Notes: svn path=/head/; revision=364300
* asmc: Add support for Mac mini 2,1David Bright2019-02-251-0/+18
| | | | | | | | | | PR: 235798 Submitted by: Trev <fbsdbugs4@sentry.org> Reported by: Trev <fbsdbugs4@sentry.org> MFC after: 1 week Notes: svn path=/head/; revision=344553
* asmc: Add support for Mac mini 4,1 (Mid-2010)David Bright2019-01-061-0/+21
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=342822
* asmc: Patch to add MacBook Pro 9,2 supportDavid Bright2019-01-041-0/+21
| | | | | | | | | | PR: 211513 Submitted by: William Theesfeld Jr <wtheesfeld@mailbox.org> Reported by: William Theesfeld Jr <wtheesfeld@mailbox.org> MFC after: 1 week Notes: svn path=/head/; revision=342770
* asmc: Add support for MacPro1,1David Bright2018-12-191-3/+66
| | | | | | | | | | PR: 203431 Submitted by: jjr@alisa.org & holindho@saunalahti.fi Reported by: jjr@alisa.org MFC after: 1 week Notes: svn path=/head/; revision=342218
* asmc: Add support for mid-2011 Macmini 5,2David Bright2018-12-171-0/+35
| | | | | | | | | | PR: 225911 Submitted by: trev <fbsdbugs4@sentry.org> Reported by: trev <fbsdbugs4@sentry.org> MFC after: 1 week Notes: svn path=/head/; revision=342171
* asmc: Add Support for Macbook Pro 8,1David Bright2018-12-121-3/+21
| | | | | | | | | | PR: 217505 Submitted by: John O. Brickley <obryan.brickley@gmail.com>, updated by Maciej Pasternacki <maciej@pasternacki.net> Reported by: John O. Brickley <obryan.brickley@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=341988
* asmc: Add Support for MacBookAir 7,1 and 7,2David Bright2018-12-111-0/+24
| | | | | | | | | | | PR: 226172 Submitted by: James Wright <james.wright@jigsawdezign.com> Reported by: James Wright <james.wright@jigsawdezign.com> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D18396 Notes: svn path=/head/; revision=341820
* asmc: update temperature sensor name/descriptionEd Maste2018-03-081-2/+2
| | | | | | | | | PR: 225911 Submitted by: Trev <fbsdbugs4 at sentry.org> MFC after: 1 week Notes: svn path=/head/; revision=330667
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* [asmc] Add support for MacBook Pro 11,2Adrian Chadd2017-02-171-16/+44
| | | | | | | | | | | | | | | This patch will add support for MacBookPro 11.2. For the macros, the MBP11_* macros (for the existing MacBookPro11.3) did not match so they have been renamed to MBP113_* and a new MBP112_* has been added (modified copy of MBP11_*). Some trailing whitespaces may have been removed automatically. PR: kern/214836 Obtained from: Johannes Lundberg <johannes@brilliantservice.co.jp Notes: svn path=/head/; revision=313880
* [asmc] Add support for MacBookPro5,1Adrian Chadd2016-05-031-0/+28
| | | | | | | | | Tested by: Johannes Lundberg <johannes@brilliantservice.co.jp> PR: kern/209179 Submitted by: Thomas Brierley <tomxor@gmail.com> Notes: svn path=/head/; revision=298990
* [asmc] add support for more models and restore keyboard backlight after resume.Adrian Chadd2016-05-021-1/+34
| | | | | | | | | | | | | | | | | | | This patch adds support for restoring backlight after resume and adds models Macbook3,1 MacbookAir5,1 MacbookAir5,2 It also incorporates fixes for bug #175260, bug #203610 and bug #203512 so those can be closed if this patch is applied. PR: kern/209156 PR: kern/175260 PR: kern/203610 PR: kern/203512 Submitted by: Johannes Lundberg <johannes@brilliantservice.co.jp> Notes: svn path=/head/; revision=298937
* Improvements to asmc(4):Rui Paulo2014-09-221-5/+113
| | | | | | | | | | | | | | | | 1. changed the code so that 2**16 keys are supported 2. changed the number of possible fans in a system from 2 to 6 3. added write support for some fan sysctls 4. added a new sysctl which shows the ID of the fan 5. added four more apple models with their temperature keys 6. changed the maxnumber of temperature keys from 36 to 80 7. replaced several fixed buf sizes to sizeof buf Obtained from: Denis Ahrens denis at h3q.com MFC after: 4 weeks Notes: svn path=/head/; revision=271975
* Add support to asmc(4) for Macmini 3,1.Gavin Atkinson2014-07-051-0/+19
| | | | | | | | | | PR: 190195 Submitted by: fbsdbugs2 sentry.org MFC after: 1 week Relnotes: yes Notes: svn path=/head/; revision=268303
* Make the sudden motion sensor work on older models and add a bit ofRui Paulo2009-09-141-0/+1
| | | | | | | | | | debugging. Submitted by: Christoph Langguth <christoph at rosenkeller.org> MFC after: 1 week Notes: svn path=/head/; revision=197190
* Add support for MacBook4,1.Rui Paulo2009-06-261-0/+19
| | | | | | | | | Submitted by: Christoph Langguth <christoph at rosenkeller.org> MFC after: 2 weeks Approved by: re (kib) Notes: svn path=/head/; revision=195046
* Add support for MacBook Air. (not tested)Rui Paulo2008-09-071-2/+6
| | | | | | | Obtained from: mactel-linux Notes: svn path=/head/; revision=182850