Bug 203431 - [asmc] [patch] Add support for 2006 MacPro1,1 to the device driver for the Apple System Management Console (SMC)
Summary: [asmc] [patch] Add support for 2006 MacPro1,1 to the device driver for the Ap...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 10.2-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: David Bright
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-09-29 02:25 UTC by jjr
Modified: 2018-12-12 14:32 UTC (History)
3 users (show)

See Also:


Attachments
Modified /usr/src/sys/dev/asmc/asmc.c and /usr/src/sys/dev/asmc/asmcvar.h with support for MacPro 1,1 2006 model. (10.11 KB, application/zip)
2015-09-29 02:25 UTC, jjr
no flags Details
Add support for macpro1,1 SMC (and improve it for macpro1,2) in asmc driver (4.19 KB, patch)
2017-03-14 07:57 UTC, holindho
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jjr 2015-09-29 02:25:28 UTC
Created attachment 161513 [details]
Modified /usr/src/sys/dev/asmc/asmc.c and /usr/src/sys/dev/asmc/asmcvar.h with support for MacPro 1,1 2006 model.

I've installed FreeBSD 10.2-RELEASE on an Apple Intel MacPro1,1 2006 model and found that this model was not supported by the 'asmc' device driver for the Apple System Management Console (SMC).

When I loaded the asmc kernel module using kldload, the following message is logged in /var/log/messages:

Sep 28 18:06:40 macpro kernel: asmc0: model not recognized

and sysctl -a|grep asmc shows errors only.

I've looked at the source code under /usr/src/sys/dev/asmc and made some changes to add support for the older MacPro1,1 2006 model see the attached zip file that contains my changes.  

in asmcvar.h, I added the following macro definitions:

#define ASMC_MP1_TEMPS          { "TA0P", "TCAH", "TCBH", "TC0C", "TC0P", \
                                  "TC1C", "TC2C", "TC3C", "THTG", "TH0P", \
                                  "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", \
                                  "TMBS", "TM0P", "TM0S", "TM1P", "TM1S", \
                                  "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", \
                                  "TM9P", "TM9S", "TN0H", "TS0C", NULL }
 
#define ASMC_MP1_TEMPNAMES      { "TA0P", "TCAH", "TCBH", "TC0C", "TC0P", \
                                  "TC1C", "TC2C", "TC3C", "THTG", "TH0P", \
                                  "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", \
                                  "TMBS", "TM0P", "TM0S", "TM1P", "TM1S", \
                                  "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", \
                                  "TM9P", "TM9S", "TN0H", "TS0C", }

#define ASMC_MP1_TEMPDESCS      { "TA0P", "TCAH", "TCBH", "TC0C", "TC0P", \
                                  "TC1C", "TC2C", "TC3C", "THTG", "TH0P", \
                                  "TH1P", "TH2P", "TH3P", "TMAP", "TMAS", \
                                  "TMBS", "TM0P", "TM0S", "TM1P", "TM1S", \
                                  "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", \
                                  "TM9P", "TM9S", "TN0H", "TS0C", }

In asmc.c, I added the following model defintion to the asmc_models array:

/* Idem for the MacPro 1,1 2006 */
        {
          "MacPro1,1", "Apple SMC Mac Pro (4-core)",
          NULL, NULL, NULL,
          ASMC_FAN_FUNCS,
          NULL, NULL, NULL,
          ASMC_MP1_TEMPS, ASMC_MP1_TEMPNAMES, ASMC_MP1_TEMPDESCS
        },


Now when I load the kernel module with kldload, the following message is logged in /var/log/messages:

Sep 28 19:37:15 macpro kernel: asmc0: <Apple SMC Mac Pro (4-core)> port 0x300-0x31f irq 6 on acpi0

and sysctl -a |grep asmc shows:

sysctl -a|grep asmc
dev.asmc.0.temp.TS0C: 39
dev.asmc.0.temp.TN0H: 86
dev.asmc.0.temp.TM9S: 129
dev.asmc.0.temp.TM9P: 50
dev.asmc.0.temp.TM8S: 129
dev.asmc.0.temp.TM8P: 44
dev.asmc.0.temp.TM3S: 129
dev.asmc.0.temp.TM2S: 129
dev.asmc.0.temp.TM2P: 50
dev.asmc.0.temp.TM1S: 80
dev.asmc.0.temp.TM1P: 56
dev.asmc.0.temp.TM0S: 75
dev.asmc.0.temp.TM0P: 48
dev.asmc.0.temp.TMBS: 129
dev.asmc.0.temp.TMAS: 129
dev.asmc.0.temp.TMAP: 47
dev.asmc.0.temp.TH3P: 34
dev.asmc.0.temp.TH2P: 31
dev.asmc.0.temp.TH1P: 30
dev.asmc.0.temp.TH0P: 31
dev.asmc.0.temp.THTG: 45
dev.asmc.0.temp.TC3C: 0
dev.asmc.0.temp.TC2C: 42
dev.asmc.0.temp.TC1C: 0
dev.asmc.0.temp.TC0P: 40
dev.asmc.0.temp.TC0C: 41
dev.asmc.0.temp.TCBH: 36
dev.asmc.0.temp.TCAH: 35
dev.asmc.0.temp.TA0P: 25
dev.asmc.0.fan.3.targetspeed: 620
dev.asmc.0.fan.3.maxspeed: 2800
dev.asmc.0.fan.3.minspeed: 620
dev.asmc.0.fan.3.safespeed: 1200
dev.asmc.0.fan.3.speed: 620
dev.asmc.0.fan.3.id: PS   
dev.asmc.0.fan.2.targetspeed: 642
dev.asmc.0.fan.2.maxspeed: 2900
dev.asmc.0.fan.2.minspeed: 500
dev.asmc.0.fan.2.safespeed: 1200
dev.asmc.0.fan.2.speed: 643
dev.asmc.0.fan.2.id: EXHAUST 
dev.asmc.0.fan.1.targetspeed: 500
dev.asmc.0.fan.1.maxspeed: 2900
dev.asmc.0.fan.1.minspeed: 500
dev.asmc.0.fan.1.safespeed: 1200
dev.asmc.0.fan.1.speed: 499
dev.asmc.0.fan.1.id: IO 
dev.asmc.0.fan.0.targetspeed: 542
dev.asmc.0.fan.0.maxspeed: 2900
dev.asmc.0.fan.0.minspeed: 500
dev.asmc.0.fan.0.safespeed: 1200
dev.asmc.0.fan.0.speed: 544
dev.asmc.0.fan.0.id: CPU_MEM 
dev.asmc.0.%parent: acpi0
dev.asmc.0.%pnpinfo: _HID=APP0001 _UID=0
dev.asmc.0.%location: handle=\_SB_.PCI0.LPCB.SMC_
dev.asmc.0.%driver: asmc
dev.asmc.0.%desc: Apple SMC Mac Pro (4-core)
dev.asmc.%parent:
Comment 1 holindho 2017-03-14 07:57:22 UTC
Created attachment 180805 [details]
Add support for macpro1,1 SMC (and improve it for macpro1,2) in asmc driver

Adds support for the SMC chip in the macpro1,1 models and improves the support for the macpro1,2 models. There is no official documentation about the SMC sensors, but I tried to cross check with many OS X open source projects that read the SMC. The MacPro1,1 and 1,2 machines have the same hardware and I suppose the same sensor layout, too. A 1,2 owner could check whether this patch gives sensible results, though.
Comment 2 holindho 2017-03-14 07:59:31 UTC
I've tested my patch on 10.3 and stable/11 and it probably applies to 12, too.
Comment 3 holindho 2017-03-14 08:01:46 UTC
(In reply to holindho from comment #1)
Typoed: %s/macpro1,2/macpro2,1/gc