Page MenuHomeFreeBSD

D61487.1794630576.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D61487.1794630576.diff

diff --git a/share/man/man4/asmc.4 b/share/man/man4/asmc.4
--- a/share/man/man4/asmc.4
+++ b/share/man/man4/asmc.4
@@ -4,7 +4,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
-.Dd September 6, 2026
+.Dd November 10, 2026
.Dt ASMC 4
.Os
.Sh NAME
@@ -47,7 +47,13 @@
.Va dev.asmc.temp
sysctl MIB.
.Pp
-All values are in degrees celsius.
+The sensors are reported in deciKelvin, the convention every other
+temperature source in the kernel follows, so
+.Xr sysctl 8
+displays them in degrees Celsius:
+.Bd -literal -offset indent
+dev.asmc.0.temp.TC0P: 42.1C
+.Ed
.Sh SYSTEM FANS
The
.Va dev.asmc.fan.%d
diff --git a/sys/dev/asmc/asmc_sysctl.c b/sys/dev/asmc/asmc_sysctl.c
--- a/sys/dev/asmc/asmc_sysctl.c
+++ b/sys/dev/asmc/asmc_sysctl.c
@@ -30,6 +30,8 @@
#include <dev/asmc/asmcmmio.h>
#include <dev/asmc/asmc_sysctl.h>
+#define ASMC_ZERO_C_TO_DK 2731 /* deciKelvin at 0 degrees C */
+
/*
* Shutdown/sleep cause codes (MSSD/MSSP values).
*
@@ -331,7 +333,7 @@
SYSCTL_CHILDREN(sc->sc_temp_tree),
OID_AUTO, sc->sc_temp_sensors[i],
CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, i,
- asmc_temp_sysctl, "I",
+ asmc_temp_sysctl, "IK",
asmc_temp_desc(sc->sc_temp_sensors[i]));
}
}
@@ -845,34 +847,25 @@
/*
* Temperature functions.
*/
-static int
-asmc_temp_getvalue(device_t dev, const char *key)
-{
- uint8_t buf[2];
-
- /*
- * Check for invalid temperatures.
- */
- if (asmc_key_read(dev, key, buf, sizeof(buf)) != 0)
- return (-1);
-
- return (buf[0]);
-}
-
static int
asmc_temp_sysctl(SYSCTL_HANDLER_ARGS)
{
device_t dev = (device_t)arg1;
struct asmc_softc *sc = device_get_softc(dev);
- int error, val;
+ int error, millic, deci;
if (arg2 < 0 || arg2 >= sc->sc_temp_count)
return (EINVAL);
- val = asmc_temp_getvalue(dev, sc->sc_temp_sensors[arg2]);
- error = sysctl_handle_int(oidp, &val, 0, req);
+ error = asmc_sensor_read(dev, sc->sc_temp_sensors[arg2], &millic);
+ if (error != 0)
+ return (error);
- return (error);
+ /* 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;
+
+ return (sysctl_handle_int(oidp, &deci, 0, req));
}
static int

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 14, 4:29 AM (8 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41711005
Default Alt Text
D61487.1794630576.diff (2 KB)

Event Timeline