From 39bd0bb15f4849c24b1fe6a235f245479b8aac22 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 19 Feb 2021 14:46:00 +0000 Subject: [PATCH] hw/arm/armsse: Move sysinfo register block into data-driven framework MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the sysinfo register block into the data-driven framework. While we are moving the code for configuring this device around, regularize on using &error_abortw when setting the integer properties: they are all simple DEFINE_PROP_UINT32 properties so the setting can never fail. Signed-off-by: Peter Maydell Tested-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-id: 20210219144617.4782-28-peter.maydell@linaro.org --- hw/arm/armsse.c | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index 3270362d59..91f30b1fdc 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -157,6 +157,14 @@ static const ARMSSEDeviceInfo sse200_devices[] = { .ppc = NO_PPC, .irq = NMI_1, }, + { + .name = "armsse-sysinfo", + .type = TYPE_IOTKIT_SYSINFO, + .index = 0, + .addr = 0x40020000, + .ppc = NO_PPC, + .irq = NO_IRQ, + }, { .name = NULL, } @@ -407,6 +415,10 @@ static void armsse_init(Object *obj) object_initialize_child(obj, devinfo->name, &s->cmsdk_watchdog[devinfo->index], TYPE_CMSDK_APB_WATCHDOG); + } else if (!strcmp(devinfo->type, TYPE_IOTKIT_SYSINFO)) { + assert(devinfo->index == 0); + object_initialize_child(obj, devinfo->name, &s->sysinfo, + TYPE_IOTKIT_SYSINFO); } else { g_assert_not_reached(); } @@ -437,8 +449,6 @@ static void armsse_init(Object *obj) object_initialize_child(obj, "armsse-sysctl", &s->sysctl, TYPE_IOTKIT_SYSCTL); - object_initialize_child(obj, "armsse-sysinfo", &s->sysinfo, - TYPE_IOTKIT_SYSINFO); if (info->has_mhus) { object_initialize_child(obj, "mhu0", &s->mhu[0], TYPE_ARMSSE_MHU); object_initialize_child(obj, "mhu1", &s->mhu[1], TYPE_ARMSSE_MHU); @@ -889,6 +899,22 @@ static void armsse_realize(DeviceState *dev, Error **errp) return; } mr = sysbus_mmio_get_region(sbd, 0); + } else if (!strcmp(devinfo->type, TYPE_IOTKIT_SYSINFO)) { + sbd = SYS_BUS_DEVICE(&s->sysinfo); + + object_property_set_int(OBJECT(&s->sysinfo), "SYS_VERSION", + info->sys_version, &error_abort); + object_property_set_int(OBJECT(&s->sysinfo), "SYS_CONFIG", + armsse_sys_config_value(s, info), + &error_abort); + object_property_set_int(OBJECT(&s->sysinfo), "sse-version", + info->sse_version, &error_abort); + object_property_set_int(OBJECT(&s->sysinfo), "IIDR", + info->iidr, &error_abort); + if (!sysbus_realize(sbd, errp)) { + return; + } + mr = sysbus_mmio_get_region(sbd, 0); } else { g_assert_not_reached(); } @@ -1106,23 +1132,6 @@ static void armsse_realize(DeviceState *dev, Error **errp) memory_region_add_subregion(&s->container, devinfo->addr, mr); } - if (!object_property_set_int(OBJECT(&s->sysinfo), "SYS_VERSION", - info->sys_version, errp)) { - return; - } - if (!object_property_set_int(OBJECT(&s->sysinfo), "SYS_CONFIG", - armsse_sys_config_value(s, info), errp)) { - return; - } - object_property_set_int(OBJECT(&s->sysinfo), "sse-version", - info->sse_version, &error_abort); - object_property_set_int(OBJECT(&s->sysinfo), "IIDR", - info->iidr, &error_abort); - if (!sysbus_realize(SYS_BUS_DEVICE(&s->sysinfo), errp)) { - return; - } - /* System information registers */ - sysbus_mmio_map(SYS_BUS_DEVICE(&s->sysinfo), 0, 0x40020000); /* System control registers */ object_property_set_int(OBJECT(&s->sysctl), "sse-version", info->sse_version, &error_abort);