]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/i3c/aspeed: Add I3C bus get function
authorJamin Lin <jamin_lin@aspeedtech.com>
Wed, 25 Feb 2026 02:12:31 +0000 (02:12 +0000)
committerCédric Le Goater <clg@redhat.com>
Thu, 5 Mar 2026 17:47:46 +0000 (18:47 +0100)
To retrieve the I3C bus object normally, the order is Aspeed I3C -> DW
I3C[n] -> bus object, so make a nice wrapper for people to use.

Signed-off-by: Joe Komlodi <komlodi@google.com>
Reviewed-by: Jamin Lin <jamin_lin@aspeedtech.com>
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Tested-by: Jithu Joseph <jithu.joseph@oss.qualcomm.com>
Link: https://lore.kernel.org/qemu-devel/20260225021158.1586584-18-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
hw/i3c/aspeed_i3c.c
include/hw/i3c/aspeed_i3c.h

index 2700c5f4cdeb092f4e063cb2b95e42b968403718..bac8c55bb09199f55a1bd83a4d1ab352ce4ed684 100644 (file)
@@ -153,6 +153,15 @@ static const MemoryRegionOps aspeed_i3c_ops = {
     }
 };
 
+I3CBus *aspeed_i3c_get_bus(AspeedI3CState *s, uint8_t bus_num)
+{
+    if (bus_num < ARRAY_SIZE(s->devices)) {
+        return s->devices[bus_num].bus;
+    }
+    /* Developer error, fail fast. */
+    g_assert_not_reached();
+}
+
 static void aspeed_i3c_reset(DeviceState *dev)
 {
     AspeedI3CState *s = ASPEED_I3C(dev);
index b8827d31d75302871bed9174d2bbe650f0bf952d..42c9eedd859065cfdbe19e8502faab4dc5145a90 100644 (file)
@@ -31,4 +31,7 @@ struct AspeedI3CState {
     DWI3C devices[ASPEED_I3C_NR_DEVICES];
     uint8_t id;
 };
+
+I3CBus *aspeed_i3c_get_bus(AspeedI3CState *s, uint8_t bus_num);
+
 #endif /* ASPEED_I3C_H */