Commit 1241ac72c9 for qemu.org
commit 1241ac72c912a81c6c1076d764fa786d57786178
Author: Jamin Lin <jamin_lin@aspeedtech.com>
Date: Mon Oct 12 06:44:57 2026 +0000
hw/arm/aspeed_ast1700: Use a table for unimplemented devices
Before this change, the I3C unimplemented device of AST1700 needed its
own field in AspeedAST1700SoCState and was created and mapped with
open-coded calls.
Describe it in a table and use create_unimplemented_devices() to create
and map it in the AST1700 memory region. This makes the code easier to
maintain and read.
No functional change.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261012064445.2571633-11-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
diff --git a/hw/arm/aspeed_ast1700.c b/hw/arm/aspeed_ast1700.c
index 5af5da5b8a..e5d5bf4056 100644
--- a/hw/arm/aspeed_ast1700.c
+++ b/hw/arm/aspeed_ast1700.c
@@ -15,7 +15,6 @@
#define AST2700_SOC_LTPI_SIZE 0x01000000
#define AST1700_SOC_SRAM_SIZE 0x00040000
-#define AST1700_SOC_I3C_SIZE 0x00010000
enum {
ASPEED_AST1700_DEV_SPI0,
@@ -51,6 +50,11 @@ static const hwaddr aspeed_ast1700_io_memmap[] = {
[ASPEED_AST1700_DEV_SPI0_MEM] = 0x04000000,
};
+static const UnimplementedDeviceConfig aspeed_ast1700_unimp_devs[] = {
+ { "ioexp-i3c", "ioexp-i3c", 0x00C20000, 0x00010000, -1000 },
+ { }
+};
+
static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
{
AspeedAST1700SoCState *s = ASPEED_AST1700(dev);
@@ -181,14 +185,9 @@ static void aspeed_ast1700_realize(DeviceState *dev, Error **errp)
sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->wdt[i]), 0));
}
- /* I3C */
- qdev_prop_set_string(DEVICE(&s->i3c), "name", "ioexp-i3c");
- qdev_prop_set_uint64(DEVICE(&s->i3c), "size", AST1700_SOC_I3C_SIZE);
- sysbus_realize(SYS_BUS_DEVICE(&s->i3c), errp);
- memory_region_add_subregion_overlap(&s->iomem,
- aspeed_ast1700_io_memmap[ASPEED_AST1700_DEV_I3C],
- sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->i3c), 0),
- -1000);
+ /* Unimplemented devices */
+ create_unimplemented_devices(OBJECT(s), &s->iomem,
+ aspeed_ast1700_unimp_devs);
}
static void aspeed_ast1700_instance_init(Object *obj)
@@ -238,10 +237,6 @@ static void aspeed_ast1700_instance_init(Object *obj)
&s->wdt[i], "aspeed.wdt-ast2700");
}
- /* I3C */
- object_initialize_child(obj, "ioexp-i3c", &s->i3c,
- TYPE_UNIMPLEMENTED_DEVICE);
-
return;
}