Apple smc fan control



  • Hi

    I have setup an older macmini (5,1) as a gateway using pfsense, one ethernet port using the onboard broadcom the other a thunderbolt to ethernet adapter.

    This setup is working really well apart from one issue, the os doesn't appear to have the kernal module for apple's smc fan control. e.g. the following yields no results.

    sysctl dev.asmc -a | grep -i asmc
    

    This does appear to be available in the pfsense freeBSD src -> https://github.com/pfsense/FreeBSD-src/tree/devel-12/sys/modules/asmc. However, this does not appear in the release build. Will I have to compile my own kernal/kernal module to use this functionality?

    Thanks in advance!



  • @hg_gts_350

    Hi,

    there is a guy on the forum who has a similar configuration
    it is conceivable that he can help @NollipfSense



  • No worries, I'll see if I can find anything out.

    Thanks!


  • Netgate Administrator

    Yeah, import the kernel module from an equivalent FreeBSD iso. kldload it to test initially.

    Steve



  • Ah, never thought of that; ill give that a go. Thanks!



  • @hg_gts_350 said in Apple smc fan control:

    Hi

    I have setup an older macmini (5,1) as a gateway using pfsense, one ethernet port using the onboard broadcom the other a thunderbolt to ethernet adapter.

    This setup is working really well apart from one issue, the os doesn't appear to have the kernal module for apple's smc fan control. e.g. the following yields no results.

    sysctl dev.asmc -a | grep -i asmc
    

    This does appear to be available in the pfsense freeBSD src -> https://github.com/pfsense/FreeBSD-src/tree/devel-12/sys/modules/asmc. However, this does not appear in the release build. Will I have to compile my own kernal/kernal module to use this functionality?

    Thanks in advance!

    I also ran the command and I got the same:
    [2.5.0-DEVELOPMENT][admin@NollipfSense.nollipfsense.lan]/root: sysctl dev.asmc -a | grep -i asmc
    sysctl: unknown oid 'dev.asmc'
    sysctl: unknown oid '-a'
    [2.5.0-DEVELOPMENT][admin@NollipfSense.nollipfsense.lan]/root:

    @stephenw10 said in Apple smc fan control:

    Yeah, import the kernel module from an equivalent FreeBSD iso. kldload it to test initially.

    Steve

    I am interested in this ... can you share more like a link to how to?



  • Noticed my grep was wrong above, (shotty cut and paste job), should be the following for reference.

    sysctl -a | grep -i asmc
    

    As @stephenw10 said, you should be able to download the iso and extract the asmc.ko module from the image.

    Then we can test it with :

    kldload asmc.ko
    

    The above grep should then return results, if it does we can make the change permanent by placing the file in the /boot/modules path. Possiblly add asmc_load="YES" to the /boot/loader.conf file if it doesn't get picked automatically on boot.

    The only problem will come when kernel updates are pushed, we'd have to do the same procedure for each release.

    (I'm only guessing with the above, I have more experience with arch/RHEL/debian based Linux distros rather than freebsd)



  • @hg_gts_350 Okay, understand what you're saying ...while researching, I found this:

    Code:

    grep ipmi /etc/rc.conf

    ipmi_load="YES"

    kldstat | grep ipmi

    4 1 0xffffffff81cc1000 113b0 ipmi.ko

    pkg info | grep ipmi

    ipmitool-1.8.17_1 CLI to manage IPMI systems

    ipmitool sensor | grep -i fan | cut -f1-4 -d'|'

    FAN MOD 1A RPM | 4440.000 | RPM | ok
    FAN MOD 2A RPM | 4560.000 | RPM | ok
    FAN MOD 3A RPM | 4440.000 | RPM | ok
    FAN MOD 4A RPM | 4440.000 | RPM | ok
    FAN MOD 5A RPM | 4560.000 | RPM | ok
    FAN MOD 6A RPM | 4440.000 | RPM | ok
    FAN MOD 1B RPM | 3000.000 | RPM | ok
    FAN MOD 2B RPM | 3120.000 | RPM | ok
    FAN MOD 3B RPM | 3120.000 | RPM | ok
    FAN MOD 4B RPM | 3000.000 | RPM | ok
    FAN MOD 5B RPM | 3120.000 | RPM | ok
    FAN MOD 6B RPM | 3000.000 | RPM | ok
    Fan Redundancy | 0x0 | discrete | 0x0180

    So, since I have the 2011 Mac Mini server, I was thinking I should have a motherboard or logic board management controller and checked whether I have the ipmi-tool ... I have the tool.

    [2.5.0-DEVELOPMENT][admin@NollipfSense.nollipfsense.lan]/root: sysctl -a | grep -i asmc
    [2.5.0-DEVELOPMENT][admin@NollipfSense.nollipfsense.lan]/root: pkg info | grep ipmi
    ipmitool-1.8.18_2 CLI to manage IPMI systems
    [2.5.0-DEVELOPMENT][admin@NollipfSense.nollipfsense.lan]/root: kldstat | grep ipmi
    [2.5.0-DEVELOPMENT][admin@NollipfSense.nollipfsense.lan]/root:

    But it looks like I am missing the ipmi.ko module.



  • @hg_gts_350 said in Apple smc fan control:

    The above grep should then return results, if it does we can make the change permanent by placing the file in the /boot/modules path. Possiblly add asmc_load="YES" to the /boot/loader.conf file if it doesn't get picked automatically on boot.
    The only problem will come when kernel updates are pushed, we'd have to do the same procedure for each release.

    Don't know whether the OP is still here; however, I have added the asmc.ko module, rebooted, and update with daily snapshot without any issue. The hardware management tool that comes with FreeBSD - IPMI ... somehow I could not get it to work with the asmc.ko module nor with the ipmi.ko modules. It seems that it was expecting the ipmi.ko modules to be in /usr/src/sys/modules/ ... Src is intentionally left empty which suggest one of the changes made to FreeBSD 12.1. So, I'll download the Apple smc fan controller and give that a try over the weekend.

    Screen Shot 2020-07-07 at 6.26.06 PM.png

    Screen Shot 2020-07-07 at 6.25.29 PM.png

    Screen Shot 2020-07-07 at 6.58.51 PM.png

    Screen Shot 2020-07-08 at 4.28.19 PM.png


  • Netgate Administrator

    With asmc loaded you should see some sysctls that relate to the settings available. sysctl dev.asmc

    Also check the boot log to see if it attached to anything. Or load it after boot with kldload and then check the system log.

    Also you should put custom loader variables in /boot/loader.conf.local otherwise they may all be overwritten.

    Steve



  • @stephenw10 said in Apple smc fan control:

    With asmc loaded you should see some sysctls that relate to the settings available. sysctl dev.asmc

    Also check the boot log to see if it attached to anything. Or load it after boot with kldload and then check the system log.

    Also you should put custom loader variables in /boot/loader.conf.local otherwise they may all be overwritten.

    Steve

    Well Steve, it seems that I didn't carry out your instructions carefully ... I had downloaded and extracted from FreeBSD 12.1 RELEASE instead of FreeBSD 12.1 stable. I gathered that from the following images below. I will redo later. I didn't fine the file /boot/loader.conf.local

    Screen Shot 2020-07-09 at 12.11.22 PM.png

    Screen Shot 2020-07-09 at 12.51.24 PM.png

    Screen Shot 2020-07-09 at 12.55.24 PM.png



  • Ok, I thought I'd let you guys know where I got to,

    I went downloaded free BSD 11.3, (@NollipfSense, that's the version of free BSD iso you need to download as the current stable version of pfsense uses that kernel, hence your error above). Extracted the asmc.ko file from the iso, and ran kldload.

    kldload asmc
    asmc0: model not recognized
    

    Unfortunately I found that my version of the Mac Mini is not supported by the kernel module, and I'd have to update the C header and class files (asmc.c and asmc.h) and build my own version of the 11.3 kernel just to get the kernal module to function. https://forums.freebsd.org/threads/asmc-on-macbook-pro-5-1.36722/

    Although it does seem according to this that the asmc module does support my mac mini here, https://wiki.freebsd.org/IntelMacMini but it is in a later version of the kernel, so I could back port the asmc.h and asmc.c changes, build the kernel and it should work. But this was kind of defeating the purpose of using pfsense for me, since I was trying to move away from arch Linux for the sake of stability.


  • Netgate Administrator

    @NollipfSense is running a 2.5 snapshot which is built on 12.1-stable. Though kernel modules for 12.1-rel usually work there.

    Maybe it's a much older snapshot built on 12.0-rel?

    Steve



  • My mistake, apologies



  • This might be useful to anyone looking to try and get the asmc module working, you can pretty much check what version of mac is supported here:

    https://svnweb.freebsd.org/base/stable/11/sys/dev/asmc/asmc.c?view=markup&pathrev=344889

    and

    https://svnweb.freebsd.org/base/stable/12/sys/dev/asmc/asmc.c?view=markup&pathrev=344888


  • Netgate Administrator

    Hmm, nothing that recent then. Driver needs some love upstream....


Log in to reply