Refactor the AST10x0 common initialization to accept a socname
parameter.
The AST1030 model can be reused by AST1060 since they share most of the
same controllers. This approach allows AST1060 to leverage the existing
AST1030 initialization flow while keeping separate SoC-specific init
functions for components that differ.
This prepares the framework for AST1060 support, allowing it to reuse
AST1030 device models and initialization flow without code duplication.
No functional changes.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
hw/arm/aspeed_ast10x0.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
index 5bbe16af24..1521000af0 100644
--- a/hw/arm/aspeed_ast10x0.c
+++ b/hw/arm/aspeed_ast10x0.c
@@ -107,19 +107,14 @@ static qemu_irq aspeed_soc_ast1030_get_irq(AspeedSoCState *s, int dev)
return qdev_get_gpio_in(DEVICE(&a->armv7m), sc->irqmap[dev]);
}
-static void aspeed_soc_ast10x0_init(Object *obj)
+static void aspeed_soc_ast10x0_init(Object *obj, const char *socname)
{
Aspeed10x0SoCState *a = ASPEED10X0_SOC(obj);
AspeedSoCState *s = ASPEED_SOC(obj);
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
- char socname[8];
char typename[64];
int i;
- if (sscanf(object_get_typename(obj), "%7s", socname) != 1) {
- g_assert_not_reached();
- }
-
object_initialize_child(obj, "armv7m", &a->armv7m, TYPE_ARMV7M);
s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL, 0);
@@ -185,7 +180,7 @@ static void aspeed_soc_ast1030_init(Object *obj)
{
AspeedSoCState *s = ASPEED_SOC(obj);
- aspeed_soc_ast10x0_init(obj);
+ aspeed_soc_ast10x0_init(obj, "ast1030");
object_initialize_child(obj, "lpc", &s->lpc, TYPE_ASPEED_LPC);
object_initialize_child(obj, "peci", &s->peci, TYPE_ASPEED_PECI);
}
--
2.43.0