git: b2dbfc7b7701 - main - acpi_iicbus: shift the ACPI slave address into the form iicbus(4) stores

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Fri, 27 Nov 2026 14:20:17 UTC
The branch main has been updated by wulf:

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

commit b2dbfc7b770174dca50cf0aa3102c8145857ddb7
Author:     Yarshure <yarshure@gmail.com>
AuthorDate: 2026-11-27 14:19:55 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2026-11-27 14:19:55 +0000

    acpi_iicbus: shift the ACPI slave address into the form iicbus(4) stores
    
    An I2cSerialBus resource carries the 7-bit slave address, but iicbus(4)
    stores and passes around the 8-bit form -- ofw_iicbus(4) shifts a device-tree
    "reg" value for the same reason, and the AML address space handler in this
    file already shifts before issuing a transfer.  Without the shift every
    device enumerated from ACPI is addressed at half its address, and a driver
    that probes by reading a register sees no ack.
    
    Reviewed by:    wulf
    Differential Revision:  https://reviews.freebsd.org/D60062
---
 sys/dev/iicbus/acpi_iicbus.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/dev/iicbus/acpi_iicbus.c b/sys/dev/iicbus/acpi_iicbus.c
index 5bee1fccd56c..9a0524fe6919 100644
--- a/sys/dev/iicbus/acpi_iicbus.c
+++ b/sys/dev/iicbus/acpi_iicbus.c
@@ -519,7 +519,13 @@ acpi_iicbus_enumerate_child(ACPI_HANDLE handle, UINT32 level,
 		return (AE_OK);
 	}
 
-	iicbus_set_addr(child, sb.SlaveAddress);
+	/*
+	 * ACPI reports the 7-bit slave address; iicbus(4) stores and passes
+	 * around the 8-bit form, as ofw_iicbus(4) does when it shifts a
+	 * device-tree "reg" value.  The AML space handler above already
+	 * shifts for the same reason.
+	 */
+	iicbus_set_addr(child, sb.SlaveAddress << 1);
 	acpi_set_handle(child, handle);
 	(void)acpi_iicbus_parse_resources(handle, child);