Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Apple smc fan control

    Scheduled Pinned Locked Moved Hardware
    29 Posts 7 Posters 3.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      hg_gts_350
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        @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

        1 Reply Last reply Reply Quote 0
        • H
          hg_gts_350
          last edited by

          My mistake, apologies

          1 Reply Last reply Reply Quote 0
          • H
            hg_gts_350
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by stephenw10

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

              1 Reply Last reply Reply Quote 0
              • M
                m_g_s_g
                last edited by

                Sorry to nectropost. But I searched for "Mac Mini smc fan control" and this thread came up as one of the first ones.

                This is just to document that I was able to compile and load an asmc.ko module for a Mac Mini 6,1.

                This specific Mac Mini version is theoretically not supported, but just copying and adding to asmc.c the config for the last supported model (5,2) did the trick.

                So I added this to /usr/src/sys/dev/asmc/asmc.c:

                	/* Line ~304 : Patch for Macmini 6,1 */
                	{ 
                	  "Macmini6,1", "Apple SMC Mac Mini 6,1 (Late 2012)",
                	  NULL, NULL, NULL,
                	  ASMC_FAN_FUNCS2,
                	  NULL, NULL, NULL,
                	  ASMC_MM52_TEMPS, ASMC_MM52_TEMPNAMES, ASMC_MM52_TEMPDESCS
                	},
                
                	/* Patch for Macmini 6,2 */
                	{ 
                	  "Macmini6,2", "Apple SMC Mac Mini 6,2 (Late 2012)",
                	  NULL, NULL, NULL,
                	  ASMC_FAN_FUNCS2,
                	  NULL, NULL, NULL,
                	  ASMC_MM52_TEMPS, ASMC_MM52_TEMPNAMES, ASMC_MM52_TEMPDESCS
                	}, 
                

                NOTE that even if pfSense 2.5.2 is supposed to use a STABLE FreeBSD version, I was able to compile it with this source tree:

                $ fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/11.2-RELEASE/src.txz
                $ freebsd $ tar -C / -xvf ./src.txz
                

                DISCLAIMER: Some temperature/fan sensors are reported to fail with messages shown in dmesg (expected, probably they don't exist in a Mac Mini 6,2). Only try to modify the existing ones as reported with:

                $ kldload asmc.ko
                $ sysctl -a | grep -i asmc
                
                F 1 Reply Last reply Reply Quote 1
                • NollipfSenseN
                  NollipfSense
                  last edited by

                  Thanks to @bmeeks I finally saw the light in that I realized that Apple hardware, such as the Mac Mini, are made specifically for Apple's operation system. So, I have moved away from the platform in terms of my pfSense implementation and is now sporting a Lenovo Thinkcentre M93p SFF 120GB SSD 32GB RAM. Thank you Bill, I was stubborn as hell.

                  pfSense+ 23.09 Lenovo Thinkcentre M93P SFF Quadcore i7 dual Raid-ZFS 128GB-SSD 32GB-RAM PCI-Intel i350-t4 NIC, -Intel QAT 8950.
                  pfSense+ 23.09 VM-Proxmox, Dell Precision Xeon-W2155 Nvme 500GB-ZFS 128GB-RAM PCIe-Intel i350-t4, Intel QAT-8950, P-cloud.

                  1 Reply Last reply Reply Quote 0
                  • F
                    firemanwall @m_g_s_g
                    last edited by

                    @m_g_s_g - To add to your nectropost, I'm sill searching for a way to regain fan control on my Mac mini 5,1 after updating from 2.4 >> 2.5. This thread is really the only source of relevant info I've been able to find.

                    At 2.4, I was able to simply download a VMDK of the corresponding FreeBSD version, extract the asmc.ko file and transfer it to my mini, but I'm struggling with this process in 2.5. I've tried following the same process I used before at 2.4, in this case using 12.2 RELEASE and 12.2 STABLE, but both fail.

                    Any chance you could help point me in the right direction to regain fan speed control on my 5,1 mini running 2.5? I'm not overly familiar with compiling, other than basic WLED and Tasmota projects which had easy-to-follow guides. If that is my only option, I too may have to repurpose one of my m93p's that's just collecting dust; I'm not a fan of running 70 degree idle temps where I was previously in the 40-50 range at 2.4 with manual fan control.

                    Thanks!

                    NollipfSenseN 1 Reply Last reply Reply Quote 0
                    • NollipfSenseN
                      NollipfSense @firemanwall
                      last edited by

                      @firemanwall said in Apple smc fan control:

                      If that is my only option, I too may have to repurpose one of my m93p's that's just collecting dust; I'm not a fan of running 70 degree idle temps where I was previously in the 40-50 range at 2.4 with manual fan control

                      That's why I gave up... couldn't stand seeing my mini heats up.

                      pfSense+ 23.09 Lenovo Thinkcentre M93P SFF Quadcore i7 dual Raid-ZFS 128GB-SSD 32GB-RAM PCI-Intel i350-t4 NIC, -Intel QAT 8950.
                      pfSense+ 23.09 VM-Proxmox, Dell Precision Xeon-W2155 Nvme 500GB-ZFS 128GB-RAM PCIe-Intel i350-t4, Intel QAT-8950, P-cloud.

                      1 Reply Last reply Reply Quote 0
                      • rmonsterR
                        rmonster
                        last edited by rmonster

                        Hi Guys,

                        I've joined to forum just to respond to this thread.

                        I've gotten everything to work on my older 2011 Mac Mini by doing the following:

                        1. Download and install the latest stable DVD ISO freebsd 12,2 and installing onto a VM
                        2. Edit the source file /usr/src/sys/dev/asmc/asmc.c as m_g_s_g mentioned
                        3. Used his code but added Macini5,1 and 5,2 as well, everything else the same.
                        4. Compiled the new asmc module by going to the source directory /usr/src/sys/modules/asmc and running make
                        5. Found where the complier placed the module by running find / -name asmc.ko. Note there are two of them, one already in boot and the other is the one you want with the current date and time, you can check with ls -l
                        6. Copied the module to my pFsense Mac Mini
                        7. Loaded the module to test with kldload ./asmc.ko
                        8. Then ran sysctl -a | grep -I asmc which resulted in sensor data dumped (yippie!)
                        9. Tested changing the fan speed by running: sysctl dev.asmc.0.fan.0.minspeed=3000
                        10. Verified that the fan speed had increased and cpu temperature dropped
                        11. Wrote dev.asmc.0.fan.0.minspeed=3000 to /etc/sysctl.conf for boot changes

                        CPU Temps dropped from high 60s to low to mid 50s.

                        I'll probably run this Mac Mini until it dies as a pFsense box now.

                        Hopefully this helps some of you make use of your older hardware.
                        P.S. I had an old thunderbolt to ethernet which I used as my second interface.

                        The box is pretty snapping and works great for gigabit internet and wifi with no slow downs.

                        Thanks to everyone that posted in this thread and helped me to get it working.

                        stephenw10S 1 Reply Last reply Reply Quote 1
                        • F
                          firemanwall
                          last edited by firemanwall

                          @rmonster said in Apple smc fan control:

                          Used his code but added Macini5,1 and 5,2 as well, everything else the same

                          THANK YOU! I feel so close, yet I can't get past the goal line on my 5,1.

                          Can you take a look at my process and see if anything stands out as incorrect?

                          The iso I started with is "FreeBSD-12.2-STABLE-amd64-20210930-r370694-disc1.iso" downloaded from https://download.freebsd.org/ftp/snapshots/ISO-IMAGES/12.2/

                          I created a VM in ESXi, installed from the above iso, then setup root ssh access and installed nano to simplify the edits (not a big VI fan).

                          Using nano, my specific edit to asmc.c is:

                              /* The Mac Mini 5,1 has no SMS */
                              {
                                "Macmini5,1", "Apple SMC Mac Mini 5,1",
                                NULL, NULL, NULL,
                                ASMC_FAN_FUNCS2,
                                NULL, NULL, NULL,
                                ASMC_MM52_TEMPS, ASMC_MM52_TEMPNAMES, ASMC_MM52_TEMPDESCS
                              },
                          

                          I placed this between the Mac Mini 4,1 and 5,2 section of the code then saved the changes.

                          I also reviewed asmcvar.h, but didn't see anything to change as I "reused" the MM52 code for my 5,1 as shown above. I see you didn't note any changes there either.

                          I then moved to the source directory, ran make and don't see any obvious errors:
                          (I don't fully grasp this output to be honest)

                          root@freebsd:/usr/src/sys/modules/asmc # make
                          cc  -O2 -pipe -fno-common  -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc   -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common  -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include   -MD  -MF.depend.asmc.o -MTasmc.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error=tautological-compare -Wno-error=empty-body -Wno-error=parentheses-equality -Wno-error=unused-function -Wno-error=pointer-sign -Wno-error=shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length  -mno-aes -mno-avx  -std=iso9899:1999 -c /usr/src/sys/dev/asmc/asmc.c -o asmc.o
                          ld -m elf_x86_64_fbsd -d -warn-common --build-id=sha1 -r -d -o asmc.ko asmc.o
                          :> export_syms
                          awk -f /usr/src/sys/conf/kmod_syms.awk asmc.ko  export_syms | xargs -J% objcopy % asmc.ko
                          objcopy --strip-debug asmc.ko
                          

                          I then found the new asmc.ko in /usr/obj/usr/src/amd64.amd64/sys/modules/asmc

                          From my pfSense mini, I then SCP'd the asmc.ko file directly into /boot/kernel

                          Holding my breath, I tried to kldload asmc.ko, yet get the same error as before:

                          kldload: an error occurred while loading module asmc.ko. Please check dmesg(8) for more details.
                          

                          dmesg gives me the painfulyl familiar error:

                          KLD asmc.ko: depends on kernel - not available or version mismatch
                          linker_load_file: /boot/kernel/asmc.ko - unsupported file type
                          

                          Where did I go wrong?

                          First thought was a version mismatch, but according to unmane -a, my pfSense install is:
                          12.2-STABLE FreeBSD 12.2-STABLE fd0f54f44b5c(RELENG_2_5_0) pfSense amd64

                          and the VM install I made the module with is:
                          FreeBSD freebsd 12.2-STABLE FreeBSD 12.2-STABLE r370694 GENERIC amd64

                          Am I using the wrong iso to start with? Am I overlooking something obvious?

                          I really can't thank you enough for taking time to follow up and share your positive results!

                          F 1 Reply Last reply Reply Quote 0
                          • F
                            firemanwall @firemanwall
                            last edited by firemanwall

                            @rmonster

                            Too late to edit the above post, but I was in fact using the wrong iso to start with. Your awesome instructions worked perfectly when I started with the correct image.

                            The iso you want is "https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.2/FreeBSD-12.2-RELEASE-amd64-dvd1.iso" from https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.2/FreeBSD-12.2-RELEASE-amd64-dvd1.iso

                            YOU ROCK!

                            Before:
                            mini5-1_before.png

                            After:
                            mini5-1_after.png

                            rmonsterR NollipfSenseN 2 Replies Last reply Reply Quote 0
                            • rmonsterR
                              rmonster @firemanwall
                              last edited by rmonster

                              @firemanwall glad you got though man. Feels really good to put these old devices back to meaningful work 🙂

                              Forgot to mention to move the ko to the /boot/modules folder as well.

                              F 1 Reply Last reply Reply Quote 1
                              • stephenw10S
                                stephenw10 Netgate Administrator @rmonster
                                last edited by

                                @rmonster said in Apple smc fan control:

                                Wrote dev.asmc.0.fan.0.minspeed=3000 to /etc/sysctl.conf for boot changes

                                You should just add that to Sys > Adv > System Tunables in the gui. The standard file will be overwritten by pfSense.

                                Steve

                                rmonsterR 1 Reply Last reply Reply Quote 1
                                • rmonsterR
                                  rmonster @stephenw10
                                  last edited by

                                  @stephenw10 Awesome! thanks, will use that.

                                  1 Reply Last reply Reply Quote 1
                                  • F
                                    firemanwall @rmonster
                                    last edited by

                                    @rmonster said in Apple smc fan control:

                                    @firemanwall glad you got though man. Feels really good to put these old devices back to meaningful work 🙂

                                    Literally couldn't have done it without your help. Kudos!

                                    Forgot to mention to move the ko to the /boot/modules folder as well.

                                    Done - thanks again!

                                    @stephenw10 said in Apple smc fan control:

                                    @rmonster said in Apple smc fan control:

                                    Wrote dev.asmc.0.fan.0.minspeed=3000 to /etc/sysctl.conf for boot changes

                                    You should just add that to Sys > Adv > System Tunables in the gui. The standard file will be overwritten by pfSense.

                                    Steve

                                    Great tip, thanks!

                                    1 Reply Last reply Reply Quote 0
                                    • NollipfSenseN
                                      NollipfSense @firemanwall
                                      last edited by

                                      @firemanwall Congrats, 53.0C seems its working.

                                      pfSense+ 23.09 Lenovo Thinkcentre M93P SFF Quadcore i7 dual Raid-ZFS 128GB-SSD 32GB-RAM PCI-Intel i350-t4 NIC, -Intel QAT 8950.
                                      pfSense+ 23.09 VM-Proxmox, Dell Precision Xeon-W2155 Nvme 500GB-ZFS 128GB-RAM PCIe-Intel i350-t4, Intel QAT-8950, P-cloud.

                                      F 1 Reply Last reply Reply Quote 0
                                      • F
                                        firemanwall @NollipfSense
                                        last edited by

                                        Congrats, 53.0C seems its working.

                                        @nollipfsense Indeed it is - happy to give my mini 5,1 a break from constant 60-70 degree temps!

                                        The question now is what to do with the stack of SFF M93p's I have laying around...

                                        Thanks again to the whole community for the support!

                                        1 Reply Last reply Reply Quote 0
                                        • S serengeti referenced this topic on
                                        • S serengeti referenced this topic on
                                        • First post
                                          Last post
                                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.