git: 58d836473fb6 - main - asmc: do not report absent sensors as a temperature
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 15 Nov 2026 21:21:57 UTC
The branch main has been updated by seuros:
URL: https://cgit.FreeBSD.org/src/commit/?id=58d836473fb65ece9f78ce5f577b44855a98c982
commit 58d836473fb65ece9f78ce5f577b44855a98c982
Author: Abdelkader Boudih <seuros@FreeBSD.org>
AuthorDate: 2026-11-15 21:12:56 +0000
Commit: Abdelkader Boudih <seuros@FreeBSD.org>
CommitDate: 2026-11-15 21:12:56 +0000
asmc: do not report absent sensors as a temperature
A key can exist for a sensor the model was never built with; the SMC
answers those with a fixed sentinel instead of an error. Return ENXIO
for the sentinel instead of publishing it as a reading.
MFC after: 3 days
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D61489
---
sys/dev/asmc/asmc_sysctl.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sys/dev/asmc/asmc_sysctl.c b/sys/dev/asmc/asmc_sysctl.c
index 232f9b6cb965..ff562eb76894 100644
--- a/sys/dev/asmc/asmc_sysctl.c
+++ b/sys/dev/asmc/asmc_sysctl.c
@@ -32,6 +32,9 @@
#define ASMC_ZERO_C_TO_DK 2731 /* deciKelvin at 0 degrees C */
+/* sp78 0x8100: SMC sentinel for an unpopulated sensor, milli-degrees C. */
+#define ASMC_TEMP_ABSENT (-127000)
+
/*
* Shutdown/sleep cause codes (MSSD/MSSP values).
*
@@ -862,6 +865,9 @@ asmc_temp_sysctl(SYSCTL_HANDLER_ARGS)
if (error != 0)
return (error);
+ if (millic == ASMC_TEMP_ABSENT)
+ return (ENXIO);
+
/* Round to the tenth of a degree that "IK" prints, then offset. */
deci = millic >= 0 ? (millic + 50) / 100 : (millic - 50) / 100;
deci += ASMC_ZERO_C_TO_DK;