Bug 203431

Summary: [asmc] [patch] Add support for 2006 MacPro1,1 to the device driver for the Apple System Management Console (SMC)
Product: Base System Reporter: jjr
Component: kernAssignee: David Bright <dab>
Status: Closed FIXED    
Severity: Affects Some People CC: dab, holin, jjr
Priority: --- Keywords: patch
Version: 10.2-RELEASEFlags: dab: mfc-stable12+
dab: mfc-stable11+
dab: mfc-stable10-
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Modified /usr/src/sys/dev/asmc/asmc.c and /usr/src/sys/dev/asmc/asmcvar.h with support for MacPro 1,1 2006 model.
none
Add support for macpro1,1 SMC (and improve it for macpro1,2) in asmc driver none

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 holin 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 holin 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 holin 2017-03-14 08:01:46 UTC
(In reply to holindho from comment #1)
Typoed: %s/macpro1,2/macpro2,1/gc
Comment 4 commit-hook freebsd_committer freebsd_triage 2018-12-19 16:46:01 UTC
A commit references this bug:

Author: dab
Date: Wed Dec 19 16:45:38 UTC 2018
New revision: 342218
URL: https://svnweb.freebsd.org/changeset/base/342218

Log:
  asmc: Add support for MacPro1,1

  PR:		203431
  Submitted by:	jjr@alisa.org & holindho@saunalahti.fi
  Reported by:	jjr@alisa.org
  MFC after:	1 week

Changes:
  head/sys/dev/asmc/asmc.c
  head/sys/dev/asmc/asmcvar.h
Comment 5 commit-hook freebsd_committer freebsd_triage 2019-01-04 02:50:39 UTC
A commit references this bug:

Author: dab
Date: Fri Jan  4 02:50:18 UTC 2019
New revision: 342755
URL: https://svnweb.freebsd.org/changeset/base/342755

Log:
  MFC r342218:

  asmc: Add support for MacPro1,1

  PR:		203431
  Submitted by:	jjr@alisa.org & holindho@saunalahti.fi
  Reported by:	jjr@alisa.org

Changes:
_U  stable/11/
  stable/11/sys/dev/asmc/asmc.c
  stable/11/sys/dev/asmc/asmcvar.h
Comment 6 commit-hook freebsd_committer freebsd_triage 2019-01-04 02:51:43 UTC
A commit references this bug:

Author: dab
Date: Fri Jan  4 02:50:56 UTC 2019
New revision: 342756
URL: https://svnweb.freebsd.org/changeset/base/342756

Log:
  MFC r342218:

  asmc: Add support for MacPro1,1

  PR:		203431
  Submitted by:	jjr@alisa.org & holindho@saunalahti.fi
  Reported by:	jjr@alisa.org

Changes:
_U  stable/12/
  stable/12/sys/dev/asmc/asmc.c
  stable/12/sys/dev/asmc/asmcvar.h