Commit b22ec3abcd for qemu.org
commit b22ec3abcd1f842729075190176ad0ba92813ef5
Author: Jamin Lin <jamin_lin@aspeedtech.com>
Date: Mon Oct 12 06:44:50 2026 +0000
hw/arm/aspeed_ast27x0: Use a table for unimplemented devices
Before this change, each unimplemented device needed its own field in
AspeedSoCState. This made the variable names confusing. For example,
AspeedSoCState has "udc" as an unimplemented device, but
Aspeed2600SoCState also has "udc" as the real UDC model.
Use the unimp_devs table in AspeedSoCClass to describe the
unimplemented devices, and use create_unimplemented_devices() to create
and map them. This makes the code easier to maintain and read. Convert
AST2700 to use them.
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-5-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c
index 6365dbd638..2ef29e31e9 100644
--- a/hw/arm/aspeed_ast27x0.c
+++ b/hw/arm/aspeed_ast27x0.c
@@ -24,10 +24,6 @@
#include "qobject/qlist.h"
#include "qemu/log.h"
-#define AST2700_SOC_IO_SIZE 0x00FE0000
-#define AST2700_SOC_IOMEM_SIZE 0x01000000
-#define AST2700_SOC_DPMCU_SIZE 0x00040000
-
static const hwaddr aspeed_soc_ast2700_memmap[] = {
[ASPEED_DEV_VBOOTROM] = 0x00000000,
[ASPEED_DEV_IOMEM] = 0x00020000,
@@ -263,6 +259,14 @@ static const struct gic_intc_irq_info ast2700_gic_intcmap[] = {
{201, 3, 1, ast2700_gic201_intcmap},
};
+static const UnimplementedDeviceConfig aspeed_soc_ast2700_unimp_devs[] = {
+ { "dpmcu", "aspeed.dpmcu", 0x11000000, 0x00040000, -1000 },
+ { "iomem", "aspeed.io", 0x00020000, 0x00FE0000, -1000 },
+ { "iomem0", "aspeed.iomem0", 0x12000000, 0x01000000, -1000 },
+ { "iomem1", "aspeed.iomem1", 0x14000000, 0x01000000, -1000 },
+ { }
+};
+
static qemu_irq aspeed_soc_ast2700_get_irq(AspeedSoCState *s, int dev)
{
Aspeed27x0SoCState *a = ASPEED27X0_SOC(s);
@@ -558,15 +562,6 @@ static void aspeed_soc_ast2700_init(Object *obj)
qdev_prop_set_uint32(DEVICE(&s->ioexp[i]), "silicon-rev",
sc->silicon_rev);
}
-
- object_initialize_child(obj, "dpmcu", &s->dpmcu,
- TYPE_UNIMPLEMENTED_DEVICE);
- object_initialize_child(obj, "iomem", &s->iomem,
- TYPE_UNIMPLEMENTED_DEVICE);
- object_initialize_child(obj, "iomem0", &s->iomem0,
- TYPE_UNIMPLEMENTED_DEVICE);
- object_initialize_child(obj, "iomem1", &s->iomem1,
- TYPE_UNIMPLEMENTED_DEVICE);
}
/*
@@ -1137,22 +1132,8 @@ static void aspeed_soc_ast2700_realize(DeviceState *dev, Error **errp)
}
}
- aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->dpmcu),
- "aspeed.dpmcu",
- sc->memmap[ASPEED_DEV_DPMCU],
- AST2700_SOC_DPMCU_SIZE);
- aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->iomem),
- "aspeed.io",
- sc->memmap[ASPEED_DEV_IOMEM],
- AST2700_SOC_IO_SIZE);
- aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->iomem0),
- "aspeed.iomem0",
- sc->memmap[ASPEED_DEV_IOMEM0],
- AST2700_SOC_IOMEM_SIZE);
- aspeed_mmio_map_unimplemented(s->memory, SYS_BUS_DEVICE(&s->iomem1),
- "aspeed.iomem1",
- sc->memmap[ASPEED_DEV_IOMEM1],
- AST2700_SOC_IOMEM_SIZE);
+ /* Unimplemented devices */
+ create_unimplemented_devices(OBJECT(s), s->memory, sc->unimp_devs);
}
static void aspeed_soc_ast2700a1_class_init(ObjectClass *oc, const void *data)
@@ -1183,6 +1164,7 @@ static void aspeed_soc_ast2700a1_class_init(ObjectClass *oc, const void *data)
sc->uarts_base = ASPEED_DEV_UART0;
sc->irqmap = aspeed_soc_ast2700a1_irqmap;
sc->memmap = aspeed_soc_ast2700_memmap;
+ sc->unimp_devs = aspeed_soc_ast2700_unimp_devs;
}
static void aspeed_soc_ast2700a2_class_init(ObjectClass *oc, const void *data)
@@ -1213,6 +1195,7 @@ static void aspeed_soc_ast2700a2_class_init(ObjectClass *oc, const void *data)
sc->uarts_base = ASPEED_DEV_UART0;
sc->irqmap = aspeed_soc_ast2700a1_irqmap;
sc->memmap = aspeed_soc_ast2700_memmap;
+ sc->unimp_devs = aspeed_soc_ast2700_unimp_devs;
}
static const TypeInfo aspeed_soc_ast27x0_types[] = {