# asmc on MacBook Pro 5.1



## AbuDun (Jan 3, 2013)

Hi community,

*T*oday I installed FreeBSD 9.1 successfully on a MacBook Pro 5.1 (from 2009). Installation itself was easy, no errors or problems. 

But in the post installation phase I encountered a problem with asmc. I tried to load asmc into the kernel, but that did not work:


```
kldload asmc
asmc0: model not recognized
```

The asmc manpage states, that 


> Support for the latest models was never tested and is most likely not fully working.


I don't know when this was written (has a lot of references to FreeBSD 8.x), but today (with FreeBSD 9.1) I would not count my MacBook as one of the latest models. Also the wiki article sounded like someone got it working.

Since I am relatively new to FreeBSD and didn't come in contact with kernelmodules in Linux until now, so I'm not sure what this means to me. 

Am I simply to missing something? Can I configure something somehow? Is there a way to use another or newer version of asmc? Or is it just simply not working (bad luck) if it does not work right after installation?

Thank you very much.

Kind regards,
Sascha


----------



## zeissoctopus (Jan 11, 2013)

Learn and hack the kernel source in /usr/src/sys/dev/asmc/asmc.c , add support of Macbook 5.1 by yourself and report the result to original author Rui Paulo <rpaulo@FreeBSD.org> or freebsd-hacker mailing list

My Macbook 3,1 is also unsupported by 9.1-RELEASE out of the box.


```
kldload asmc
asmc0: model- not recognized
```

I make a dirty patch for /usr/src/sys/dev/asmc/asmc.c and /usr/src/sys/dev/asmc/asmcvar.h as following

```
--- /usr/src/sys/dev/asmc/asmcvar.h.original    2013-01-11 09:36:53.000000000 +0000
+++ /usr/src/sys/dev/asmc/asmcvar.h     2013-01-11 10:21:02.000000000 +0000
@@ -141,10 +141,22 @@
 #define ASMC_MB_TEMPDESCS      { "Enclosure Bottomside", \
                                  "Northbridge Point 1", \
                                  "Northbridge Point 2", "Heatsink 1", \
                                  "Heatsink 2", "Memory Bank A", }
 
+#define ASMC_MB31_TEMPS         { "TB0T", "TN0P", "Th0H", "Th1H", \
+                                  "TM0P", NULL }
+
+#define ASMC_MB31_TEMPNAMES     { "enclosure", "northbridge1", \
+                                  "heatsink1", "heatsink2",    \
+                                  "memory", }
+
+#define ASMC_MB31_TEMPDESCS     { "Enclosure Bottomside", \
+                                  "Northbridge Point 1",  \
+                                  "Heatsink 1", "Heatsink2", \
+                                  "Memory Bank A", }
+
 #define ASMC_MBP_TEMPS         { "TB0T", "Th0H", "Th1H", "Tm0P", \
                                  "TG0H", "TG0P", "TG0T", NULL }
 
 #define ASMC_MBP_TEMPNAMES     { "enclosure", "heatsink1", \
                                  "heatsink2", "memory", "graphics", \


--- /usr/src/sys/dev/asmc/asmc.c.original       2013-01-11 05:26:22.000000000 +0000
+++ /usr/src/sys/dev/asmc/asmc.c        2013-01-11 09:51:01.000000000 +0000
@@ -153,10 +153,16 @@
          "MacBook2,1", "Apple SMC MacBook Core 2 Duo",
          ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL,
          ASMC_MB_TEMPS, ASMC_MB_TEMPNAMES, ASMC_MB_TEMPDESCS
        },
 
+        {
+          "MacBook3,1", "Apple SMC MacBook Core 2 Duo",
+          ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL,
+          ASMC_MB31_TEMPS, ASMC_MB31_TEMPNAMES, ASMC_MB31_TEMPDESCS
+        },
+
        { 
          "MacBookPro1,1", "Apple SMC MacBook Pro Core Duo (15-inch)",
          ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS,
          ASMC_MBP_TEMPS, ASMC_MBP_TEMPNAMES, ASMC_MBP_TEMPDESCS
        },
```

After recompiling and installing new kernel, asmc(4) works on my Macbook3,1

```
sysctl -a | grep asmc
dev.asmc.0.%desc: Apple SMC MacBook Core 2 Duo
dev.asmc.0.%driver: asmc
dev.asmc.0.%location: handle=\_SB_.PCI0.LPCB.SMC_
dev.asmc.0.%pnpinfo: _HID=APP0001 _UID=0
dev.asmc.0.%parent: acpi0
dev.asmc.0.fan.0.speed: 1797
dev.asmc.0.fan.0.safespeed: 0
dev.asmc.0.fan.0.minspeed: 1800
dev.asmc.0.fan.0.maxspeed: 6200
dev.asmc.0.fan.0.targetspeed: 1800
dev.asmc.0.temp.enclosure: 30
dev.asmc.0.temp.northbridge1: 52
dev.asmc.0.temp.heatsink1: 56
dev.asmc.0.temp.heatsink2: 55
dev.asmc.0.temp.memory: 51
dev.asmc.0.sms.x: -25
dev.asmc.0.sms.y: 47
dev.asmc.0.sms.z: 267
```


----------



## trev (Jun 22, 2013)

*Late 2009 Mac Mini - FreeBSD 9.1-STABLE (Jan 25, 2013)*


```
diff asmc.c /root/source/
202c202
<         "Macmini3,1", "Apple SMC Mac Mini",
---
>         "Macmini1,1", "Apple SMC Mac Mini",

diff asmcvar.h /root/source/
178c178
< #define ASMC_MM_TEMPS         { "TC0D", "TC0P", NULL }
---
> #define ASMC_MM_TEMPS         { "TN0P", "TN1P", NULL }
```

Now loading asmc.ko produces:


```
dev.asmc.0.%desc: Apple SMC Mac Mini
dev.asmc.0.%driver: asmc
dev.asmc.0.%location: handle=\_SB_.PCI0.LPCB.SMC_
dev.asmc.0.%pnpinfo: _HID=APP0001 _UID=0
dev.asmc.0.%parent: acpi0
dev.asmc.0.fan.0.speed: 1628
dev.asmc.0.fan.0.safespeed: 0
dev.asmc.0.fan.0.minspeed: 1500
dev.asmc.0.fan.0.maxspeed: 5500
dev.asmc.0.fan.0.targetspeed: 1638
dev.asmc.0.temp.northbridge1: 59
dev.asmc.0.temp.northbridge2: 56
```


----------

