Bug 260781 - asmc(4): Add support for MacPro 6,1 (2013)
Summary: asmc(4): Add support for MacPro 6,1 (2013)
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.0-RELEASE
Hardware: amd64 Any
: --- Affects Many People
Assignee: Mark Johnston
URL:
Keywords: easy, feature, needs-qa
Depends on:
Blocks:
 
Reported: 2021-12-29 06:48 UTC by Adam S.
Modified: 2022-05-18 22:04 UTC (History)
3 users (show)

See Also:
koobs: maintainer-feedback? (markj)
koobs: maintainer-feedback? (adrian)
koobs: maintainer-feedback? (dab)
koobs: mfc-stable13?
koobs: mfc-stable12?


Attachments
macpro6,1 patch for asmc (1.54 KB, patch)
2021-12-29 06:48 UTC, Adam S.
no flags Details | Diff
Updated macpro6,1 patch for asmc (2.12 KB, patch)
2022-05-09 03:06 UTC, Adam S.
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam S. 2021-12-29 06:48:15 UTC
Created attachment 230522 [details]
macpro6,1 patch for asmc

Hello!

I have successfully installed FreeBSD 13 on my 2013 MacPro (the one that looks like a trashcan).

SMC support was missing out-of-the-box but I was able to add an entry with the relevant sensor data for this machine. I was already getting accurate CPU temperature readings from coretemp but now with this patch asmc can get/set the fan speed.

The only issue I had during the install was needing to set hw.pci.enable_pcie_hp="0" in order to boot. Without that, the machine would get stuck streaming "pcib8: power fault detected" endlessly to the console.

This MacPro has six Thunderbolt 2 ports and while disabling hot-plug isn't great, my Thunderbolt devices work as expected if I boot the machine with them already connected.

Everything else seems to be working great. No wifi, but that was expected because I saw the BCM4360 card isn't supported yet. Suspend/Resume mostly works but I don't care about it. Executing "acpiconf -s 3" puts the machine to sleep and pressing the power button brings it back. However, the machine is only reachable over SSH and the console/display stays off.

Hopefully this is useful, please let me know if you need anything else from me.
Thanks!
Comment 1 Adam S. 2021-12-29 18:00:12 UTC
Comment on attachment 230522 [details]
macpro6,1 patch for asmc

>diff -u original/asmc.c my-patch/asmc.c
>--- original/asmc.c	2021-12-28 23:43:20.905442244 -0600
>+++ my-patch/asmc.c	2021-12-29 00:10:38.424770226 -0600
>@@ -328,6 +328,15 @@
>     ASMC_MP5_TEMPS, ASMC_MP5_TEMPNAMES, ASMC_MP5_TEMPDESCS
>   },
>
>+	/* Idem for the MacPro 2013 (cylinder) */
>+	{
>+    "MacPro6,1", "Apple SMC MacPro (2013)",
>+    ASMC_SMS_FUNCS_DISABLED,
>+    ASMC_FAN_FUNCS,
>+    ASMC_LIGHT_FUNCS_DISABLED,
>+    ASMC_MP6_TEMPS, ASMC_MP6_TEMPNAMES, ASMC_MP6_TEMPDESCS
>+	},
>+
>   {
>     "MacBookAir1,1", "Apple SMC MacBook Air",
>     ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL,
>diff -u original/asmcvar.h my-patch/asmcvar.h
>--- original/asmcvar.h	2021-12-28 23:43:12.163365462 -0600
>+++ my-patch/asmcvar.h	2021-12-29 00:11:36.207227372 -0600
>@@ -581,6 +581,18 @@
>           "Te3F", "Te3S", "Te4F", "Te4S", "Te5F", \
>           "Te5S", "TeGG", "TeGP", "TeRG", "TeRP", \
>           "TeRV", "Tp0C", "Tp1C", "TpPS", "TpTG", }
>+
>+#define ASMC_MP6_TEMPS	{ "TA0P", "TA1P", "TC0P", "TG0D", "TG0P", \
>+	"TG1D", "TG1P", "TM0P", "TM1P", NULL }
>+
>+#define ASMC_MP6_TEMPNAMES	{ "ambient_air_1", "ambient_air_2", \
>+	"cpu_proximity", "gpu_diode_1", "gpu_proximity_1", "gpu_diode_2", \
>+	"gpu_proximity_2", "mem_proximity_1", "mem_proximity_2" }
>+
>+#define ASMC_MP6_TEMPDESCS	{ "Ambient Air 1", "Ambient Air 2", \
>+	"CPU Proximity", "GPU Diode 1", "GPU Proximity 1", "GPU Diode 2", \
>+	"GPU Proximity 2", "Memory Bank A", "Memory Bank B" }
>+
> #define	ASMC_MBA_TEMPS		{ "TB0T", NULL }
> #define	ASMC_MBA_TEMPNAMES	{ "enclosure" }
> #define	ASMC_MBA_TEMPDESCS	{ "Enclosure Bottom" }
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2022-04-27 03:42:53 UTC
^Triage: Request feedback / commit from the folks who have landed asmc support before. Please cancel flag if you don't have any available cycles.

With specific hardware model availability being unlikely, what's the best way to get these landed?
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-05-04 15:34:40 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=7d5fef1837ef4741244e6009dfe42835deab369b

commit 7d5fef1837ef4741244e6009dfe42835deab369b
Author:     Adam S <adam@anschwa.com>
AuthorDate: 2022-05-04 14:42:39 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-05-04 15:31:01 +0000

    asmc: Add support for MacPro 6,1 (2013)

    PR:             260781
    MFC after:      2 weeks

 sys/dev/asmc/asmc.c    |  9 +++++++++
 sys/dev/asmc/asmcvar.h | 16 ++++++++++++++++
 2 files changed, 25 insertions(+)
Comment 4 Adam S. 2022-05-04 16:35:53 UTC
Hi thanks for all the work on moving this forward!

I feel a bit dumb because I didn't bring this up earlier but I made some "human friendly" improvements to the ASMC_MP6_TEMPNAMES and ASMC_MP6_TEMPDESCS in my "comment" above. 

Functionally, everything was working on my machine with the patch submitted as-is but since I didn't know how to update my patches I tried to comment on them with my changes.

I understand if it's too late to fix the commit in main now, but I wanted to bring this up in case there was still time to fix it. If this is something I can do please let me know!

Thanks,
-Adam

This is the section that I would like to update from what was in my submitted patch. It more closely matches what the existing entries provide:
>+#define ASMC_MP6_TEMPNAMES	{ "ambient_air_1", "ambient_air_2", \
>+	"cpu_proximity", "gpu_diode_1", "gpu_proximity_1", "gpu_diode_2", \
>+	"gpu_proximity_2", "mem_proximity_1", "mem_proximity_2" }
>+
>+#define ASMC_MP6_TEMPDESCS	{ "Ambient Air 1", "Ambient Air 2", \
>+	"CPU Proximity", "GPU Diode 1", "GPU Proximity 1", "GPU Diode 2", \
>+	"GPU Proximity 2", "Memory Bank A", "Memory Bank B" }
Comment 5 Mark Johnston freebsd_committer freebsd_triage 2022-05-04 16:39:28 UTC
(In reply to Adam S. from comment #4)
No problem.  Sorry I missed the changes in the follow up.  Would you be willing to provide an updated patch against FreeBSD's main branch?
Comment 6 Adam S. 2022-05-04 16:48:14 UTC
(In reply to Mark Johnston from comment #5)
Yes absolutely! I might not be able to get to it until next week but should I upload the new patch as an attachment here? Thanks!
Comment 7 Mark Johnston freebsd_committer freebsd_triage 2022-05-04 16:53:18 UTC
(In reply to Adam S. from comment #6)
Yep, please and thank you.
Comment 8 Adam S. 2022-05-09 03:06:48 UTC
Created attachment 233817 [details]
Updated macpro6,1 patch for asmc

Here is my updated patch. Please feel free to make any adjustments if needed, I hope the formatting is okay.

Thanks!
Comment 9 Adam S. 2022-05-09 03:14:55 UTC
(In reply to Adam S. from comment #8)
This updated patch also includes a bugfix for a warning a didn't notice before:
> asmc0: asmc_key_read for key F0Sf failed 10 times, giving up

To address this, I am using the "ASMC_FAN_FUNCS2" option that was introduced here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203610
Comment 10 commit-hook freebsd_committer freebsd_triage 2022-05-09 13:03:42 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=dc484aed0a014de0fdf33d972c36413da6903a2e

commit dc484aed0a014de0fdf33d972c36413da6903a2e
Author:     Adam S <adam@anschwa.com>
AuthorDate: 2022-05-09 12:44:09 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-05-09 12:56:39 +0000

    asmc: Update Mac Pro 6 sensor definitions

    - Make descriptions a bit more human-friendly.
    - Don't attempt to probe fan safe speeds, this model does not provide
      one.

    PR:             260781
    MFC after:      2 weeks

 sys/dev/asmc/asmc.c    |  6 +++---
 sys/dev/asmc/asmcvar.h | 22 +++++++++++-----------
 2 files changed, 14 insertions(+), 14 deletions(-)
Comment 11 commit-hook freebsd_committer freebsd_triage 2022-05-18 21:27:37 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1610a56a5636869ffa8c161094d8ec5f5afae38c

commit 1610a56a5636869ffa8c161094d8ec5f5afae38c
Author:     Adam S <adam@anschwa.com>
AuthorDate: 2022-05-04 14:42:39 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-05-18 21:15:47 +0000

    asmc: Add support for MacPro 6,1 (2013)

    PR:             260781

    (cherry picked from commit 7d5fef1837ef4741244e6009dfe42835deab369b)

 sys/dev/asmc/asmc.c    |  9 +++++++++
 sys/dev/asmc/asmcvar.h | 16 ++++++++++++++++
 2 files changed, 25 insertions(+)
Comment 12 commit-hook freebsd_committer freebsd_triage 2022-05-18 21:27:38 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=d7417aa55e73a4c3019901095371e34cc00b99f7

commit d7417aa55e73a4c3019901095371e34cc00b99f7
Author:     Adam S <adam@anschwa.com>
AuthorDate: 2022-05-09 12:44:09 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-05-18 21:16:01 +0000

    asmc: Update Mac Pro 6 sensor definitions

    - Make descriptions a bit more human-friendly.
    - Don't attempt to probe fan safe speeds, this model does not provide
      one.

    PR:             260781

    (cherry picked from commit dc484aed0a014de0fdf33d972c36413da6903a2e)

 sys/dev/asmc/asmc.c    |  6 +++---
 sys/dev/asmc/asmcvar.h | 22 +++++++++++-----------
 2 files changed, 14 insertions(+), 14 deletions(-)
Comment 13 Mark Johnston freebsd_committer freebsd_triage 2022-05-18 22:04:15 UTC
Thanks for the patches.