git: 78e9708c98aa - stable/14 - asmc: output the SMC firmware revision on attach
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 25 Apr 2026 16:26:56 UTC
The branch stable/14 has been updated by ngie:
URL: https://cgit.FreeBSD.org/src/commit/?id=78e9708c98aa7b1362cdb909f3530592c97ee904
commit 78e9708c98aa7b1362cdb909f3530592c97ee904
Author: Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-03-01 18:54:56 +0000
Commit: Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-04-25 16:25:43 +0000
asmc: output the SMC firmware revision on attach
The SMC firmware revision can prove helpful when determining why the
behavior of a given controller varies from the maintainers' expected
behavior.
This should be a sysctl (eventually), but for now dumping out the
information via `device_printf(..)` suffices, given that only one
asmc(4) compatible device can exist in an Apple platform at any
given point in time. This will become a sysctl in the future after
additional improvements are incorporated from OpenBSD and NetBSD.
MFC after: 1 week
Obtained from: https://github.com/openbsd/src/ (sys/dev/acpi/asmc.c @ 142d064)
Differential Revision: https://reviews.freebsd.org/D55577
(cherry picked from commit e81e724358e43dcf951e244a9df9df3eaa983fe9)
---
sys/dev/asmc/asmc.c | 11 +++++++++--
sys/dev/asmc/asmcvar.h | 3 +++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c
index 079689e2ec2b..066b9c80de23 100644
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -51,6 +51,7 @@
#include <sys/rman.h>
#include <machine/resource.h>
+#include <netinet/in.h>
#include <contrib/dev/acpica/include/acpi.h>
@@ -937,11 +938,17 @@ asmc_init(device_t dev)
{
struct asmc_softc *sc = device_get_softc(dev);
struct sysctl_ctx_list *sysctlctx;
+ uint8_t buf[6];
int i, error = 1;
- uint8_t buf[4];
sysctlctx = device_get_sysctl_ctx(dev);
+ error = asmc_key_read(dev, ASMC_KEY_REV, buf, 6);
+ if (error != 0)
+ goto out_err;
+ device_printf(dev, "SMC revision: %x.%x%x%x\n", buf[0], buf[1], buf[2],
+ ntohs(*(uint16_t *)buf + 4));
+
if (sc->sc_model->smc_sms_x == NULL)
goto nosms;
@@ -1040,10 +1047,10 @@ nosms:
sc->sc_nkeys = 0;
}
+out_err:
#ifdef ASMC_DEBUG
asmc_dumpall(dev);
#endif
-
return (error);
}
diff --git a/sys/dev/asmc/asmcvar.h b/sys/dev/asmc/asmcvar.h
index 602f363594b9..d216fd1416e4 100644
--- a/sys/dev/asmc/asmcvar.h
+++ b/sys/dev/asmc/asmcvar.h
@@ -78,6 +78,9 @@ struct asmc_softc {
/* Number of keys */
#define ASMC_NKEYS "#KEY" /* RO; 4 bytes */
+/* Query the ASMC revision */
+#define ASMC_KEY_REV "REV " /* RO: 6 bytes */
+
/*
* Fan control via SMC.
*/