Solved FreeBSD cannot get DIMM temperature sensor value

I am trying to get DIMM's temperature sensors values using ipmitool on FreeBSD 13.0-RELEASE. Results are:
Code:
[lanin@freebsd ~]$ ipmitool sdr list
CPU1 Temperature | 32 degrees C      | ok
CPU2 Temperature | 36 degrees C      | ok
DIMMA1_Temp      | no reading        | ns
DIMMB1_Temp      | 63 degrees C      | ok
DIMMC1_Temp      | no reading        | ns
DIMMD1_Temp      | no reading        | ns
DIMME1_Temp      | no reading        | ns
DIMMF1_Temp      | no reading        | ns
DIMMG1_Temp      | no reading        | ns
DIMMH1_Temp      | no reading        | ns
DIMMJ1_Temp      | 0 degrees C       | ok
DIMMK1_Temp      | no reading        | ns
DIMML1_Temp      | no reading        | ns
DIMMM1_Temp      | no reading        | ns
+VCCIO1          | 1.01 Volts        | ok
+VCORE1          | 1.78 Volts        | ok
+VCORE2          | 1.79 Volts        | ok
+VDDQ_ABC_CPU1   | 1.20 Volts        | ok
+VDDQ_DEF_CPU1   | 1.22 Volts        | ok
+VDDQ_GHJ_CPU2   | 1.20 Volts        | ok
+VDDQ_KLM_CPU2   | 1.22 Volts        | ok
+12V             | 12.10 Volts       | ok
+5V              | 4.99 Volts        | ok
+5VSB            | 4.93 Volts        | ok
+3.3V            | 3.26 Volts        | ok
+3.3VSB          | 3.22 Volts        | ok
VBAT             | 3.36 Volts        | ok
CPU_FAN1         | 700 RPM           | ok
CPU_FAN2         | 700 RPM           | ok
FRNT_FAN1        | 600 RPM           | ok
FRNT_FAN2        | 300 RPM           | cr
FRNT_FAN3        | 500 RPM           | ok
FRNT_FAN4        | disabled          | ns
FRNT_FAN5        | 600 RPM           | ok
REAR_FAN1        | 600 RPM           | ok
REAR_FAN2        | 600 RPM           | ok
PMBPower1        | no reading        | ns
CPU1_ECC1        | 0x00              | ok
CPU2_ECC1        | 0x00              | ok
CPU_CATERR       | 0x00              | ok
Memory_Train_ERR | 0x00              | ok
NM Capabilities  | Not Readable      | ns
Watchdog2        | 0x00              | ok

for exapmle, specifically:
Code:
[lanin@freebsd ~]$ ipmitool sensor get DIMMB1_Temp
Locating sensor record...
Sensor ID              : DIMMB1_Temp (0xc3)
 Entity ID             : 3.0
 Sensor Type (Threshold)  : Temperature
 Sensor Reading        : 63 (+/- 0) degrees C
 Status                : ok
 Lower Non-Recoverable : 47.000
 Lower Critical        : 50.000
 Lower Non-Critical    : 53.000
 Upper Non-Critical    : 72.000
 Upper Critical        : 75.000
 Upper Non-Recoverable : 79.000
 Positive Hysteresis   : 1.000
 Negative Hysteresis   : 1.000
 Assertion Events      :
 Assertions Enabled    : lnc- lcr- unc+ ucr+
 Deassertions Enabled  : lnc- lcr- unc+ ucr+

my system is:
Code:
[lanin@freebsd ~]$ uname -a
FreeBSD freebsd 13.0-RELEASE-p11 FreeBSD 13.0-RELEASE-p11 #0: Tue Apr  5 18:54:35 UTC 2022     root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64

modules loaded:
Code:
[lanin@freebsd ~]$ kldstat
Id Refs Address                Size Name
 1   91 0xffffffff80200000  1f11f90 kernel
 2    1 0xffffffff82113000    2a120 fusefs.ko
 3    1 0xffffffff8213e000   5748f0 vmm.ko
 4    1 0xffffffff826b3000     4110 nmdm.ko
 5    1 0xffffffff826b8000     fc48 if_bridge.ko
 6    2 0xffffffff826c8000     8178 bridgestp.ko
 7    1 0xffffffff826d1000    12a80 ipmi.ko
 8    3 0xffffffff826e4000     44f0 smbus.ko
 9    1 0xffffffff826e9000     4128 coretemp.ko
10    1 0xffffffff82ae6000     3378 acpi_wmi.ko
11    1 0xffffffff82aea000     3250 ichsmb.ko
12    1 0xffffffff82aee000     8d38 ioat.ko
13    1 0xffffffff82af7000   107310 nvidia-modeset.ko
14    1 0xffffffff82c00000  1faac70 nvidia.ko
15    2 0xffffffff84bab000    388f8 linux.ko
16    6 0xffffffff84be4000     db70 linux_common.ko
17    1 0xffffffff84bf2000     2340 uhid.ko
18    1 0xffffffff84bf5000     3380 usbhid.ko
19    1 0xffffffff84bf9000     31f8 hidbus.ko
20    1 0xffffffff84bfd000     3320 wmt.ko
21    1 0xffffffff84c01000     4350 ums.ko
22    1 0xffffffff84c06000    30ac8 linux64.ko
23    1 0xffffffff84c37000     2260 pty.ko
24    1 0xffffffff84c3a000     639c linprocfs.ko
25    1 0xffffffff84c41000     3284 linsysfs.ko
26    1 0xffffffff84c45000     3530 fdescfs.ko
27    1 0xffffffff84c49000     2a08 mac_ntpd.ko

DIMMs specification:
Code:
[lanin@freebsd ~]$ sudo dmidecode -t memory
...
# dmidecode 3.3
# SMBIOS entry point at 0x6f4e5000
Found SMBIOS entry point in EFI, reading table from /dev/mem.
SMBIOS 3.2 present.

Handle 0x0039, DMI type 16, 23 bytes
Physical Memory Array
    Location: System Board Or Motherboard
    Use: System Memory
    Error Correction Type: Single-bit ECC
    Maximum Capacity: 1536 GB
    Error Information Handle: Not Provided
    Number Of Devices: 12

Handle 0x003A, DMI type 17, 40 bytes
Memory Device
    Array Handle: 0x0039
    Error Information Handle: Not Provided
    Total Width: 72 bits
    Data Width: 64 bits
    Size: 16 GB
    Form Factor: DIMM
    Set: None
    Locator: DIMM_A1
    Bank Locator: NODE 1
    Type: DDR4
    Type Detail: Synchronous
    Speed: 2400 MT/s
    Manufacturer: Samsung
    Serial Number: 1894FFEF
    Asset Tag: DIMM_A1_AssetTag
    Part Number: M393A2K40BB1-CRC
    Rank: 1
    Configured Memory Speed: 2400 MT/s
    Minimum Voltage: 1.2 V
    Maximum Voltage: 1.2 V
    Configured Voltage: 1.2 V
...

soft installed:
Code:
[lanin@freebsd ~]$ pkg info ipmitool
ipmitool-1.8.18_3
Name           : ipmitool
Version        : 1.8.18_3
Installed on   : Wed May 11 22:15:22 2022 MSK
Origin         : sysutils/ipmitool
Architecture   : FreeBSD:13:amd64
Prefix         : /usr/local
Categories     : sysutils
Licenses       : BSD3CLAUSE
Maintainer     : zi@FreeBSD.org
WWW            : https://sourceforge.net/projects/ipmitool/
Comment        : CLI to manage IPMI systems
Options        :
    DOCS           : on
    FREEIPMI       : off
Shared Libs required:
    libreadline.so.8
Annotations    :
    FreeBSD_version: 1300139
    cpe            : cpe:2.3:a:sun:ipmitool:1.8.18:::::freebsd13:x64:3
    repo_type      : binary
    repository     : FreeBSD
Flat size      : 1.30MiB
...
[lanin@freebsd ~]$ pkg info freeipmi
freeipmi-1.6.9
Name           : freeipmi
Version        : 1.6.9
Installed on   : Thu May 12 18:23:32 2022 MSK
Origin         : sysutils/freeipmi
Architecture   : FreeBSD:13:amd64
Prefix         : /usr/local
Categories     : sysutils
Licenses       : GPLv3
Maintainer     : sunpoet@FreeBSD.org
WWW            : https://www.gnu.org/software/freeipmi/
Comment        : Library and tools to support IPMI-capable hardware
Options        :
    DEBUG          : off
    DOCS           : on
    IOPERM         : off
    IPV6           : on
Shared Libs required:
    libargp.so.0
    libgcrypt.so.20
Shared Libs provided:
    libipmidetect.so.0
    libipmimonitoring.so.6
    libfreeipmi.so.17
    libipmiconsole.so.2
Annotations    :
    FreeBSD_version: 1300139
    repo_type      : binary
    repository     : FreeBSD
Flat size      : 20.0MiB
...
[lanin@freebsd ~]$ pkg info openipmi
openipmi-2.0.29
Name           : openipmi
Version        : 2.0.29
Installed on   : Thu May 12 18:24:32 2022 MSK
Origin         : sysutils/openipmi
Architecture   : FreeBSD:13:amd64
Prefix         : /usr/local
Categories     : sysutils
Licenses       : GPLv2
Maintainer     : egypcio@FreeBSD.org
WWW            : http://openipmi.sourceforge.net/
Comment        : Complex IPMI management software
Options        :
    GDBM           : off
    GLIB20         : off
    PERL           : off
    PYTHON         : off
    SNMP           : off
    SSL            : off
    TCL            : off
    TKINTER        : off
Shared Libs required:
    libpopt.so.0
    libreadline.so.8
Shared Libs provided:
    libOpenIPMIpthread.so.0
    libIPMIlanserv.so.0
    libOpenIPMIcmdlang.so.0
    libOpenIPMIui.so.1
    libOpenIPMI.so.0
    libOpenIPMIposix.so.0
    libOpenIPMIutils.so.0
Annotations    :
    FreeBSD_version: 1300139
    repo_type      : binary
    repository     : FreeBSD
Flat size      : 5.31MiB


But on Debian the same soft works fine (I do not advertise Linux, do not blame me - I am trying to find a solution):
Code:
lanin@debian2:~$ sudo ipmitool sdr list
CPU1 Temperature | 28 degrees C      | ok
CPU2 Temperature | 31 degrees C      | ok
DIMMA1_Temp      | 35 degrees C      | ok
DIMMB1_Temp      | 35 degrees C      | ok
DIMMC1_Temp      | 35 degrees C      | ok
DIMMD1_Temp      | 33 degrees C      | ok
DIMME1_Temp      | 33 degrees C      | ok
DIMMF1_Temp      | 32 degrees C      | ok
DIMMG1_Temp      | 34 degrees C      | ok
DIMMH1_Temp      | 34 degrees C      | ok
DIMMJ1_Temp      | 34 degrees C      | ok
DIMMK1_Temp      | 35 degrees C      | ok
DIMML1_Temp      | 35 degrees C      | ok
DIMMM1_Temp      | 34 degrees C      | ok
+VCCIO1          | 0.99 Volts        | ok
+VCORE1          | 1.78 Volts        | ok
+VCORE2          | 1.79 Volts        | ok
+VDDQ_ABC_CPU1   | 1.22 Volts        | ok
+VDDQ_DEF_CPU1   | 1.20 Volts        | ok
+VDDQ_GHJ_CPU2   | 1.20 Volts        | ok
+VDDQ_KLM_CPU2   | 1.22 Volts        | ok
+12V             | 12.10 Volts       | ok
+5V              | 4.99 Volts        | ok
+5VSB            | 4.93 Volts        | ok
+3.3V            | 3.26 Volts        | ok
+3.3VSB          | 3.22 Volts        | ok
VBAT             | 3.36 Volts        | ok
CPU_FAN1         | 700 RPM           | ok
CPU_FAN2         | 700 RPM           | ok
FRNT_FAN1        | 600 RPM           | ok
FRNT_FAN2        | 300 RPM           | cr
FRNT_FAN3        | 500 RPM           | ok
FRNT_FAN4        | disabled          | ns
FRNT_FAN5        | 600 RPM           | ok
REAR_FAN1        | 600 RPM           | ok
REAR_FAN2        | 600 RPM           | ok
PMBPower1        | no reading        | ns
CPU1_ECC1        | 0x00              | ok
CPU2_ECC1        | 0x00              | ok
CPU_CATERR       | 0x00              | ok
Memory_Train_ERR | 0x00              | ok
NM Capabilities  | 0x00              | ok
Watchdog2        | 0x00              | ok

And this result is the same as when I use remotely access to my host's BMC from my notebook's web console.

The question is : how can I get true values of DIMM temperature sensors locally (not remotely) on FreeBSD host.
 
Hi, dsdqmhsx !

my chassis:
Code:
[lanin@freebsd ~]$ sudo dmidecode -t chassis
# dmidecode 3.3
# SMBIOS entry point at 0x6f4e6000
Found SMBIOS entry point in EFI, reading table from /dev/mem.
SMBIOS 3.2 present.

Handle 0x0003, DMI type 3, 22 bytes
Chassis Information
    Manufacturer: To Be Filled By O.E.M.
    Type: Desktop
    Lock: Not Present
    Version: To Be Filled By O.E.M.
    Serial Number: To Be Filled By O.E.M.
    Asset Tag: To Be Filled By O.E.M.
    Boot-up State: Safe
    Power Supply State: Safe
    Thermal State: Safe
    Security Status: None
    OEM Information: 0x00000000
    Height: Unspecified
    Number Of Power Cords: 1
    Contained Elements: 0
    SKU Number: To Be Filled By O.E.M.

applying patch:
Code:
lanin@freebsd:/home/lanin/src# patch -ruN -d a < D35605.diff
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c
|--- a/sys/dev/ipmi/ipmi.c
|+++ b/sys/dev/ipmi/ipmi.c
--------------------------
Patching file sys/dev/ipmi/ipmi.c using Plan A...
Hunk #1 succeeded at 76.
Hunk #2 succeeded at 239.
Hunk #3 succeeded at 275.
Hunk #4 succeeded at 340.
Hunk #5 succeeded at 420.
Hunk #6 succeeded at 526.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git a/sys/dev/ipmi/ipmivars.h b/sys/dev/ipmi/ipmivars.h
|--- a/sys/dev/ipmi/ipmivars.h
|+++ b/sys/dev/ipmi/ipmivars.h
--------------------------
Patching file sys/dev/ipmi/ipmivars.h using Plan A...
Hunk #1 succeeded at 54.
Hunk #2 succeeded at 233.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff --git a/sys/sys/ipmi.h b/sys/sys/ipmi.h
|--- a/sys/sys/ipmi.h
|+++ b/sys/sys/ipmi.h
--------------------------
Patching file sys/sys/ipmi.h using Plan A...
Hunk #1 succeeded at 33.
Hmm...  Ignoring the trailing garbage.
done

lanin@freebsd:/home/lanin/src/a/sys/dev/ipmi# diff ipmi.c.orig ipmi.c
79,84d78
< #ifdef IPMB
< static int ipmi_ipmb_checksum(u_char, int);
< static int ipmi_ipmb_send_message(device_t, u_char, u_char, u_char,
< u_char, u_char, int)
< #endif
<
248c242
< #ifdef IPMB
---
> #if 0
250,290d243
< ipmi_ipmb_checksum(u_char *data, int len)
< {
< u_char sum = 0;
<
< for (; len; len--) {
< sum += *data++;
< }
< return (-sum);
< }
<
< /* XXX: Needs work */
< static int
< ipmi_ipmb_send_message(device_t dev, u_char channel, u_char netfn,
< u_char command, u_char seq, u_char *data, int data_len)
< {
< struct ipmi_softc *sc = device_get_softc(dev);
< struct ipmi_request *req;
< u_char slave_addr = 0x52;
< int error;
<
< IPMI_ALLOC_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0),
< IPMI_SEND_MSG, data_len + 8, 0);
< req->ir_request[0] = channel;
< req->ir_request[1] = slave_addr;
< req->ir_request[2] = IPMI_ADDR(netfn, 0);
< req->ir_request[3] = ipmi_ipmb_checksum(&req->ir_request[1], 2);
< req->ir_request[4] = sc->ipmi_address;
< req->ir_request[5] = IPMI_ADDR(seq, sc->ipmi_lun);
< req->ir_request[6] = command;
<
< bcopy(data, &req->ir_request[7], data_len);
< temp[data_len + 7] = ipmi_ipmb_checksum(&req->ir_request[4],
< data_len + 3);
<
< ipmi_submit_driver_request(sc, req);
< error = req->ir_error;
<
< return (error);
< }
<
< static int
324a278,287
> static u_char
> ipmi_ipmb_checksum(u_char *data, int len)
> {
> u_char sum = 0;
>
> for (; len; len--)
> sum += *data++;
> return (-sum);
> }
>
380,382d342
< /*
< * XXX: Need to add proper handling of this.
< */
387,394c347,363
< IPMI_LOCK(sc);
< /* clear out old stuff in queue of stuff done */
< /* XXX: This seems odd. */
< while ((kreq = TAILQ_FIRST(&dev->ipmi_completed_requests))) {
< TAILQ_REMOVE(&dev->ipmi_completed_requests, kreq,
< ir_link);
< dev->ipmi_requests--;
< ipmi_free_request(kreq);
---
> if (addr.addr_type == IPMI_SYSTEM_INTERFACE_ADDR_TYPE) {
> kreq = ipmi_alloc_request(dev, req->msgid,
> IPMI_ADDR(req->msg.netfn, 0), req->msg.cmd,
> req->msg.data_len, IPMI_MAX_RX);
> error = copyin(req->msg.data, kreq->ir_request,
> req->msg.data_len);
> if (error) {
> ipmi_free_request(kreq);
> return (error);
> }
> IPMI_LOCK(sc);
> dev->ipmi_requests++;
> error = sc->ipmi_enqueue_request(sc, kreq);
> IPMI_UNLOCK(sc);
> if (error)
> return (error);
> break;
396d364
< IPMI_UNLOCK(sc);
398,405c366,385
< kreq = ipmi_alloc_request(dev, req->msgid,
< IPMI_ADDR(req->msg.netfn, 0), req->msg.cmd,
< req->msg.data_len, IPMI_MAX_RX);
< error = copyin(req->msg.data, kreq->ir_request,
< req->msg.data_len);
< if (error) {
< ipmi_free_request(kreq);
< return (error);
---
> /* Special processing for IPMB commands */
> struct ipmi_ipmb_addr *iaddr = (struct ipmi_ipmb_addr *)&addr;
>
> IPMI_ALLOC_DRIVER_REQUEST(kreq, IPMI_ADDR(IPMI_APP_REQUEST, 0),
> IPMI_SEND_MSG, req->msg.data_len + 8, IPMI_MAX_RX);
> /* Construct the SEND MSG header */
> kreq->ir_request[0] = iaddr->channel;
> kreq->ir_request[1] = iaddr->slave_addr;
> kreq->ir_request[2] = IPMI_ADDR(req->msg.netfn, iaddr->lun);
> kreq->ir_request[3] =
> ipmi_ipmb_checksum(&kreq->ir_request[1], 2);
> kreq->ir_request[4] = dev->ipmi_address;
> kreq->ir_request[5] = IPMI_ADDR(0, dev->ipmi_lun);
> kreq->ir_request[6] = req->msg.cmd;
> /* Copy the message data */
> if (req->msg.data_len > 0) {
> error = copyin(req->msg.data, &kreq->ir_request[7],
> req->msg.data_len);
> if (error != 0)
> return (error);
406a387,399
> kreq->ir_request[req->msg.data_len + 7] =
> ipmi_ipmb_checksum(&kreq->ir_request[4],
> req->msg.data_len + 3);
> error = ipmi_submit_driver_request(sc, kreq, MAX_TIMEOUT);
> if (error != 0)
> return (error);
>
> kreq = ipmi_alloc_request(dev, req->msgid,
> IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_GET_MSG,
> 0, IPMI_MAX_RX);
> kreq->ir_ipmb = true;
> kreq->ir_ipmb_addr = IPMI_ADDR(req->msg.netfn, 0);
> kreq->ir_ipmb_command = req->msg.cmd;
411c404
< if (error)
---
> if (error != 0)
430,437c423
< addr.channel = IPMI_BMC_CHANNEL;
< /* XXX */
< recv->recv_type = IPMI_RESPONSE_RECV_TYPE;
< recv->msgid = kreq->ir_msgid;
< recv->msg.netfn = IPMI_REPLY_ADDR(kreq->ir_addr) >> 2;
< recv->msg.cmd = kreq->ir_command;
< error = kreq->ir_error;
< if (error) {
---
> if (kreq->ir_error != 0) {
443c429
< return (error);
---
> return (kreq->ir_error);
445c431,450
< len = kreq->ir_replylen + 1;
---
>
> recv->recv_type = IPMI_RESPONSE_RECV_TYPE;
> recv->msgid = kreq->ir_msgid;
> if (kreq->ir_ipmb) {
> addr.channel = IPMI_IPMB_CHANNEL;
> recv->msg.netfn =
> IPMI_REPLY_ADDR(kreq->ir_ipmb_addr) >> 2;
> recv->msg.cmd = kreq->ir_ipmb_command;
> /* Get the compcode of response */
> kreq->ir_compcode = kreq->ir_reply[6];
> /* Move the reply head past response header */
> kreq->ir_reply += 7;
> len = kreq->ir_replylen - 7;
> } else {
> addr.channel = IPMI_BMC_CHANNEL;
> recv->msg.netfn = IPMI_REPLY_ADDR(kreq->ir_addr) >> 2;
> recv->msg.cmd = kreq->ir_command;
> len = kreq->ir_replylen + 1;
> }
>
449c454
< || cmd == IPMICTL_RECEIVE_MSG_32
---
> || cmd == IPMICTL_RECEIVE_MSG_32
524c529
< static __inline void
---
> __inline void

lanin@freebsd:/home/lanin/src/a/sys/dev# diff ipmivars.h.orig ipmivars.h
56a57,59
> bool ir_ipmb;
> uint8_t ir_ipmb_addr;
> uint8_t ir_ipmb_command;
232a236,237
> void ipmi_init_request(struct ipmi_request *, struct ipmi_device *, long,
> uint8_t, uint8_t, size_t, size_t);

lanin@freebsd:/home/lanin/src/a/sys/sys# diff ipmi.h.orig ipmi.h
36c36
< #define IPMI_BMC_SLAVE_ADDR 0x20 /* Linux Default slave address */
---
>
37a38
> #define IPMI_IPMB_CHANNEL 0x00
38a40
> #define IPMI_BMC_SLAVE_ADDR 0x20 /* Linux Default slave address */

lanin@freebsd:/usr/src/sys/modules/ipmi# make
[Creating objdir /usr/obj/usr/src/amd64.amd64/sys/modules/ipmi...]
...
awk -f /usr/src/sys/conf/kmod_syms.awk ipmi.ko export_syms | xargs -J% objcopy % ipmi.ko
objcopy --strip-debug ipmi.ko
===> ipmi_linux (all)
[Creating objdir /usr/obj/usr/src/amd64.amd64/sys/modules/ipmi/ipmi_linux...]
...
objcopy --strip-debug ipmi_linux.ko

current state:
Code:
root@freebsd:/home/lanin # kldstat
Id Refs Address                Size Name
 1  101 0xffffffff80200000  1f30590 kernel
 2    1 0xffffffff82132000    262c0 fusefs.ko
 3    1 0xffffffff82159000   57a950 vmm.ko
 4    1 0xffffffff826d4000     3978 nmdm.ko
 5    1 0xffffffff826d8000     e518 if_bridge.ko
 6    2 0xffffffff826e7000     78c0 bridgestp.ko
 7    1 0xffffffff826ef000    11968 ipmi.ko
 8    3 0xffffffff82701000     3cb0 smbus.ko
 9    1 0xffffffff82705000     3728 coretemp.ko
10    1 0xffffffff82ce6000   107310 nvidia-modeset.ko
11    1 0xffffffff82e00000  1faac70 nvidia.ko
12    2 0xffffffff84dab000    38070 linux.ko
13    6 0xffffffff82dee000    10ab0 linux_common.ko
14    1 0xffffffff84de4000     3378 acpi_wmi.ko
15    1 0xffffffff84de8000     3250 ichsmb.ko
16    1 0xffffffff84dec000     8d38 ioat.ko
17    1 0xffffffff84df5000     2110 pchtherm.ko
18    1 0xffffffff84df8000     2340 uhid.ko
19    1 0xffffffff84dfb000     3380 usbhid.ko
20    1 0xffffffff84dff000     31f8 hidbus.ko
21    1 0xffffffff84e03000     3320 wmt.ko
22    1 0xffffffff84e07000     23c0 ulpt.ko
23    1 0xffffffff84e0a000     4350 ums.ko
24    1 0xffffffff84e0f000    32208 linux64.ko
25    1 0xffffffff84e42000     2260 pty.ko
26    1 0xffffffff84e45000     3530 fdescfs.ko
27    1 0xffffffff84e49000     639c linprocfs.ko
28    1 0xffffffff84e50000     3284 linsysfs.ko
29    1 0xffffffff84e54000     2a08 mac_ntpd.ko

unloading:
Code:
root@freebsd:/home/lanin # kldunload ipmi.ko
root@freebsd:/home/lanin #

loading new modules
Code:
root@freebsd:/home/lanin # cp /usr/obj/usr/src/amd64.amd64/sys/modules/ipmi/ipmi.ko /boot/kernel
root@freebsd:/home/lanin # cp /usr/obj/usr/src/amd64.amd64/sys/modules/ipmi/ipmi_linux/ipmi_linux.ko /boot/kernel

root@freebsd:/home/lanin # cd /boot/kernel
root@freebsd:/boot/kernel # kldload ./ipmi.ko
root@freebsd:/boot/kernel # kldload ./ipmi_linux.ko

lanin@freebsd:/home/lanin# kldstat
Id Refs Address                Size Name
 1  103 0xffffffff80200000  1f30590 kernel
 2    1 0xffffffff82132000    262c0 fusefs.ko
 3    1 0xffffffff82159000   57a950 vmm.ko
 4    1 0xffffffff826d4000     3978 nmdm.ko
 5    1 0xffffffff826d8000     e518 if_bridge.ko
 6    2 0xffffffff826e7000     78c0 bridgestp.ko
 8    3 0xffffffff82701000     3cb0 smbus.ko
 9    1 0xffffffff82705000     3728 coretemp.ko
10    1 0xffffffff82ce6000   107310 nvidia-modeset.ko
11    1 0xffffffff82e00000  1faac70 nvidia.ko
12    3 0xffffffff84dab000    38070 linux.ko
13    6 0xffffffff82dee000    10ab0 linux_common.ko
14    1 0xffffffff84de4000     3378 acpi_wmi.ko
15    1 0xffffffff84de8000     3250 ichsmb.ko
16    1 0xffffffff84dec000     8d38 ioat.ko
17    1 0xffffffff84df5000     2110 pchtherm.ko
18    1 0xffffffff84df8000     2340 uhid.ko
19    1 0xffffffff84dfb000     3380 usbhid.ko
20    1 0xffffffff84dff000     31f8 hidbus.ko
21    1 0xffffffff84e03000     3320 wmt.ko
22    1 0xffffffff84e07000     23c0 ulpt.ko
23    1 0xffffffff84e0a000     4350 ums.ko
24    1 0xffffffff84e0f000    32208 linux64.ko
25    1 0xffffffff84e42000     2260 pty.ko
26    1 0xffffffff84e45000     3530 fdescfs.ko
27    1 0xffffffff84e49000     639c linprocfs.ko
28    1 0xffffffff84e50000     3284 linsysfs.ko
29    1 0xffffffff84e54000     2a08 mac_ntpd.ko
30    1 0xffffffff84e57000     7b38 ipmi.ko
31    1 0xffffffff84e5f000     2108 ipmi_linux.ko

try to get DIMM temperature sensors values:
Code:
[lanin@freebsd ~]$ ipmitool sdr list
CPU1 Temperature | 40 degrees C      | ok
CPU2 Temperature | 44 degrees C      | ok
DIMMA1_Temp      | no reading        | ns
DIMMB1_Temp      | 63 degrees C      | ok
DIMMC1_Temp      | no reading        | ns
DIMMD1_Temp      | no reading        | ns
DIMME1_Temp      | no reading        | ns
DIMMF1_Temp      | no reading        | ns
DIMMG1_Temp      | no reading        | ns
DIMMH1_Temp      | no reading        | ns
DIMMJ1_Temp      | 0 degrees C       | ok
DIMMK1_Temp      | no reading        | ns
DIMML1_Temp      | no reading        | ns
DIMMM1_Temp      | no reading        | ns
+VCCIO1          | 1.01 Volts        | ok
+VCORE1          | 1.78 Volts        | ok
+VCORE2          | 1.79 Volts        | ok
+VDDQ_ABC_CPU1   | 1.20 Volts        | ok
+VDDQ_DEF_CPU1   | 1.22 Volts        | ok
+VDDQ_GHJ_CPU2   | 1.20 Volts        | ok
+VDDQ_KLM_CPU2   | 1.22 Volts        | ok
+12V             | 12.10 Volts       | ok
+5V              | 4.99 Volts        | ok
+5VSB            | 4.93 Volts        | ok
+3.3V            | 3.26 Volts        | ok
+3.3VSB          | 3.22 Volts        | ok
VBAT             | 3.36 Volts        | ok
CPU_FAN1         | 700 RPM           | ok
CPU_FAN2         | 700 RPM           | ok
FRNT_FAN1        | 600 RPM           | ok
FRNT_FAN2        | 300 RPM           | cr
FRNT_FAN3        | 500 RPM           | ok
FRNT_FAN4        | disabled          | ns
FRNT_FAN5        | 600 RPM           | ok
REAR_FAN1        | 600 RPM           | ok
REAR_FAN2        | 600 RPM           | ok
PMBPower1        | no reading        | ns
CPU1_ECC1        | 0x00              | ok
CPU2_ECC1        | 0x00              | ok
CPU_CATERR       | 0x00              | ok
Memory_Train_ERR | 0x00              | ok
NM Capabilities  | 0x00              | ok
Watchdog2        | 0x00              | ok

No success

Thank you anyway

EDIT:
Since the question was asked my system has been upgraded:
Code:
[lanin@freebsd ~]$ uname -aiKmpb
FreeBSD freebsd 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64 amd64 GENERIC 1301000 5b12d97f9629e35915bb91fb9145e851f0b437fe
 
Just to make sure, you applied the patch in /home/lanin/src/a/, but are building in /usr/src/ and copying the kernel modules from /usr/obj/usr/src/, is it symlinked to /usr/src/?
 
Just to make sure, you applied the patch in /home/lanin/src/a/, but are building in /usr/src/ and copying the kernel modules from /usr/obj/usr/src/, is it symlinked to /usr/src/?

Looks like you have the correct code built after all, there is one sensor ("NM Capabilities", no idea what it is) that is accessible via IPMB and "fixed" by the patch. The DIMM sensor problem is really something else as they are accessible via system interface. It could help comparing the verbose ipmitool output with Linux.
 
Just to make sure, you applied the patch in /home/lanin/src/a/, but are building in /usr/src/ and copying the kernel modules from /usr/obj/usr/src/, is it symlinked to /usr/src/?
Yes.
1) I applied patch in /home/lanin/src/a/
2) then copied patched ipmi.c and ipmivars.h to /usr/src/sys/dev/ipmi/
3) and patched ipmi.h to /usr/src/sys/sys/
4) then cd to /usr/src/sys/modules/ipmi and run: make

Edit:
/usr/obj/usr/src/, is not symlinked to /usr/src/
/usr/obj/usr/src/ was created by make (it outputs its results there)

Code:
lanin@freebsd:/usr/obj/usr/src/amd64.amd64/sys/modules/ipmi# ls -lR -D %F .
total 312
-rw-r--r--  1 root  wheel   3550 2022-06-27 .depend.ipmi_acpi.o
-rw-r--r--  1 root  wheel   2392 2022-06-27 .depend.ipmi_isa.o
-rw-r--r--  1 root  wheel   2273 2022-06-27 .depend.ipmi_kcs.o
-rw-r--r--  1 root  wheel   2304 2022-06-27 .depend.ipmi_pci.o
-rw-r--r--  1 root  wheel   2473 2022-06-27 .depend.ipmi_smbios.o
-rw-r--r--  1 root  wheel   2343 2022-06-27 .depend.ipmi_smbus.o
-rw-r--r--  1 root  wheel   2301 2022-06-27 .depend.ipmi_smic.o
-rw-r--r--  1 root  wheel   2202 2022-06-27 .depend.ipmi_ssif.o
-rw-r--r--  1 root  wheel   2355 2022-06-27 .depend.ipmi.o
-rw-r--r--  1 root  wheel   5754 2022-06-27 acpi_if.h
-rw-r--r--  1 root  wheel  46388 2022-06-27 bus_if.h
-rw-r--r--  1 root  wheel  12234 2022-06-27 device_if.h
-rw-r--r--  1 root  wheel      0 2022-06-27 export_syms
-rw-r--r--  1 root  wheel   7632 2022-06-27 ipmi_acpi.o
-rw-r--r--  1 root  wheel   8288 2022-06-27 ipmi_isa.o
-rw-r--r--  1 root  wheel   8248 2022-06-27 ipmi_kcs.o
drwxrwxr-x  2 root  wheel    512 2022-06-27 ipmi_linux
-rw-r--r--  1 root  wheel  10128 2022-06-27 ipmi_pci.o
-rw-r--r--  1 root  wheel   5448 2022-06-27 ipmi_smbios.o
-rw-r--r--  1 root  wheel   6064 2022-06-27 ipmi_smbus.o
-rw-r--r--  1 root  wheel   7192 2022-06-27 ipmi_smic.o
-rw-r--r--  1 root  wheel   7160 2022-06-27 ipmi_ssif.o
-rw-r--r--  1 root  wheel  69624 2022-06-27 ipmi.ko
-rw-r--r--  1 root  wheel  24064 2022-06-27 ipmi.o
-rw-r--r--  1 root  wheel   2077 2022-06-27 isa_if.h
lrwxr-xr-x  1 root  wheel     26 2022-06-27 machine -> /usr/src/sys/amd64/include
-rw-r--r--  1 root  wheel      0 2022-06-27 opt_acpi.h
-rw-r--r--  1 root  wheel     45 2022-06-27 opt_global.h
-rw-r--r--  1 root  wheel  18632 2022-06-27 pci_if.h
-rw-r--r--  1 root  wheel   6344 2022-06-27 smbus_if.h
lrwxr-xr-x  1 root  wheel     24 2022-06-27 x86 -> /usr/src/sys/x86/include

./ipmi_linux:
total 32
-rw-r--r--  1 root  wheel   3060 2022-06-27 .depend.ipmi_linux.o
-rw-r--r--  1 root  wheel      0 2022-06-27 export_syms
-rw-r--r--  1 root  wheel  12664 2022-06-27 ipmi_linux.ko
-rw-r--r--  1 root  wheel   4112 2022-06-27 ipmi_linux.o
lrwxr-xr-x  1 root  wheel     26 2022-06-27 machine -> /usr/src/sys/amd64/include
-rw-r--r--  1 root  wheel     45 2022-06-27 opt_global.h
lrwxr-xr-x  1 root  wheel     24 2022-06-27 x86 -> /usr/src/sys/x86/include
 
Code:
root@debian2:/home/lanin# uname -a
Linux debian2 5.10.0-15-amd64 #1 SMP Debian 5.10.120-1 (2022-06-09) x86_64 GNU/Linux
root@debian2:/home/lanin#
root@debian2:/home/lanin# ipmitool -V
ipmitool version 1.8.18

output of ipmitool -vvvvvv sdr list 2>&1 on linux:
 

Attachments

  • impitool_on_linux.txt
    129.7 KB · Views: 12
If that helps somehow, here are DIMMs I use:
dimm.jpg
 
I am confused as we seem to do exactly the same requests as ipmitool in linux; let's try the following patch (as a wild guess), we seem to omit the lun for some reason while linux ipmi driver does not. Please apply it on top of the original patch:
Code:
diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c
index 94ac0ff6dee..26ce7122803 100644
--- a/sys/dev/ipmi/ipmi.c
+++ b/sys/dev/ipmi/ipmi.c
@@ -345,9 +345,12 @@ ipmi_ioctl(struct cdev *cdev, u_long cmd, caddr_t data,
                        return (error);

                if (addr.addr_type == IPMI_SYSTEM_INTERFACE_ADDR_TYPE) {
+                       struct ipmi_system_interface_addr *saddr =
+                           (struct ipmi_system_interface_addr *)&addr;
+
                        kreq = ipmi_alloc_request(dev, req->msgid,
-                           IPMI_ADDR(req->msg.netfn, 0), req->msg.cmd,
-                           req->msg.data_len, IPMI_MAX_RX);
+                           IPMI_ADDR(req->msg.netfn, saddr->lun & 0x3),
+                           req->msg.cmd, req->msg.data_len, IPMI_MAX_RX);
                        error = copyin(req->msg.data, kreq->ir_request,
                            req->msg.data_len);
                        if (error) {
 
It works! Thank you !

Code:
lanin@freebsd:/home/lanin# ipmitool sdr list
CPU1 Temperature | 41 degrees C      | ok
CPU2 Temperature | 45 degrees C      | ok
DIMMA1_Temp      | 50 degrees C      | ok
DIMMB1_Temp      | 51 degrees C      | ok
DIMMC1_Temp      | 51 degrees C      | ok
DIMMD1_Temp      | 49 degrees C      | ok
DIMME1_Temp      | 49 degrees C      | ok
DIMMF1_Temp      | 47 degrees C      | ok
DIMMG1_Temp      | 49 degrees C      | ok
DIMMH1_Temp      | 49 degrees C      | ok
DIMMJ1_Temp      | 49 degrees C      | ok
DIMMK1_Temp      | 50 degrees C      | ok
DIMML1_Temp      | 50 degrees C      | ok
DIMMM1_Temp      | 51 degrees C      | ok
+VCCIO1          | 1.01 Volts        | ok
+VCORE1          | 1.78 Volts        | ok
+VCORE2          | 1.79 Volts        | ok
+VDDQ_ABC_CPU1   | 1.20 Volts        | ok
+VDDQ_DEF_CPU1   | 1.22 Volts        | ok
+VDDQ_GHJ_CPU2   | 1.20 Volts        | ok
+VDDQ_KLM_CPU2   | 1.22 Volts        | ok
+12V             | 12.10 Volts       | ok
+5V              | 4.99 Volts        | ok
+5VSB            | 4.93 Volts        | ok
+3.3V            | 3.26 Volts        | ok
+3.3VSB          | 3.22 Volts        | ok
VBAT             | 3.36 Volts        | ok
CPU_FAN1         | 700 RPM           | ok
CPU_FAN2         | 700 RPM           | ok
FRNT_FAN1        | 600 RPM           | ok
FRNT_FAN2        | 300 RPM           | cr
FRNT_FAN3        | 500 RPM           | ok
FRNT_FAN4        | disabled          | ns
FRNT_FAN5        | 600 RPM           | ok
REAR_FAN1        | 600 RPM           | ok
REAR_FAN2        | 600 RPM           | ok
PMBPower1        | no reading        | ns
CPU1_ECC1        | 0x00              | ok
CPU2_ECC1        | 0x00              | ok
CPU_CATERR       | 0x00              | ok
Memory_Train_ERR | 0x00              | ok
NM Capabilities  | Not Readable      | ns
Watchdog2        | 0x00              | ok

but 'NM Capabilities' is not readable again. But that doesn't bother me at all
I have no idea what is it too . :)
 
but 'NM Capabilities' is not readable again. But that doesn't bother me at all
I have no idea what is it too . :)
No, it works! - All works now!

Code:
[lanin@freebsd ~]$ sudo ipmitool sdr list
Пароль: 
CPU1 Temperature | 41 degrees C      | ok
CPU2 Temperature | 45 degrees C      | ok
DIMMA1_Temp      | 50 degrees C      | ok
DIMMB1_Temp      | 51 degrees C      | ok
DIMMC1_Temp      | 51 degrees C      | ok
DIMMD1_Temp      | 49 degrees C      | ok
DIMME1_Temp      | 49 degrees C      | ok
DIMMF1_Temp      | 47 degrees C      | ok
DIMMG1_Temp      | 50 degrees C      | ok
DIMMH1_Temp      | 50 degrees C      | ok
DIMMJ1_Temp      | 49 degrees C      | ok
DIMMK1_Temp      | 51 degrees C      | ok
DIMML1_Temp      | 51 degrees C      | ok
DIMMM1_Temp      | 51 degrees C      | ok
+VCCIO1          | 1.01 Volts        | ok
+VCORE1          | 1.78 Volts        | ok
+VCORE2          | 1.79 Volts        | ok
+VDDQ_ABC_CPU1   | 1.20 Volts        | ok
+VDDQ_DEF_CPU1   | 1.22 Volts        | ok
+VDDQ_GHJ_CPU2   | 1.20 Volts        | ok
+VDDQ_KLM_CPU2   | 1.22 Volts        | ok
+12V             | 12.10 Volts       | ok
+5V              | 4.99 Volts        | ok
+5VSB            | 4.93 Volts        | ok
+3.3V            | 3.26 Volts        | ok
+3.3VSB          | 3.22 Volts        | ok
VBAT             | 3.36 Volts        | ok
CPU_FAN1         | 700 RPM           | ok
CPU_FAN2         | 700 RPM           | ok
FRNT_FAN1        | 600 RPM           | ok
FRNT_FAN2        | 300 RPM           | cr
FRNT_FAN3        | 500 RPM           | ok
FRNT_FAN4        | disabled          | ns
FRNT_FAN5        | 600 RPM           | ok
REAR_FAN1        | 600 RPM           | ok
REAR_FAN2        | 600 RPM           | ok
PMBPower1        | no reading        | ns
CPU1_ECC1        | 0x00              | ok
CPU2_ECC1        | 0x00              | ok
CPU_CATERR       | 0x00              | ok
Memory_Train_ERR | 0x00              | ok
NM Capabilities  | 0x00              | ok
Watchdog2        | 0x00              | ok
[lanin@freebsd ~]$
 
Top