git: 177f8b3294ef - main - ipmi: do not omit lun in BMC addresses

From: Philip Paeps <philip_at_FreeBSD.org>
Date: Mon, 04 Jul 2022 06:35:16 UTC
The branch main has been updated by philip:

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

commit 177f8b3294ef5717060c287fe1206c52ba3ecc53
Author:     Yuri <yuri@aetern.org>
AuthorDate: 2022-07-04 06:29:52 +0000
Commit:     Philip Paeps <philip@FreeBSD.org>
CommitDate: 2022-07-04 06:30:39 +0000

    ipmi: do not omit lun in BMC addresses
    
    Some systems put sensors on non-0 lun, so we should not omit it.  This
    was the only difference with the Linux driver, where DIMM sensors could
    be queried, but not on FreeBSD.
    
    See this report[1] on the FreeBSD forums:
    https://forums.freebsd.org/threads/freebsd-cannot-get-dimm-temperature-sensor-value.85166/
    
    Reviewed by:    philip
    Tested by:      Andrey Lanin[1]
    MFC after:      1 week
    Differential Revision: https://reviews.freebsd.org/D35612
---
 sys/dev/ipmi/ipmi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c
index 775734d3e1aa..7afafa492b6f 100644
--- a/sys/dev/ipmi/ipmi.c
+++ b/sys/dev/ipmi/ipmi.c
@@ -309,9 +309,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) {