[PATCH v4 09/16] hw/acpi/ich9.c: convert ACPI_PM_PROP_GPE0_BLK_LEN to a static class property
Mark Cave-Ayland <[email protected]>
| Newsgroups | org.nongnu.qemu-arm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
The ACPI_PM_PROP_GPE0_BLK_LEN property is assigned to a static variable and so can be converted to a static class property. Introduce ich9_pm_add_class_properties() to hold the ACPI_PM_PROP_GPE0_BLK_LEN property and soon all other class props after they have been converted from object props. Signed-off-by: Mark Cave-Ayland <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Marc-André Lureau <[email protected]> --- include/hw/acpi/ich9.h | 1 + hw/acpi/ich9.c | 14 ++++++++++---- hw/isa/lpc_ich9.c | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h index 30990fcef5..3fb993bb9e 100644 --- a/include/hw/acpi/ich9.h +++ b/include/hw/acpi/ich9.h @@ -84,6 +84,7 @@ extern const VMStateDescription vmstate_ich9_pm; void ich9_pm_reset_properties(ICH9LPCPMRegs *pm); void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm); +void ich9_pm_add_class_properties(ObjectClass *oc); void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp); diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index ac3f452dc3..774b34195f 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -402,8 +402,6 @@ void ich9_pm_reset_properties(ICH9LPCPMRegs *pm) void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) { - static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN; - object_property_add_uint32_ptr(obj, ACPI_PM_PROP_PM_IO_BASE, &pm->pm_io_base, OBJ_PROP_FLAG_READ); object_property_add_link(obj, "bus", TYPE_PCI_BUS, @@ -413,8 +411,6 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) object_property_add(obj, ACPI_PM_PROP_GPE0_BLK, "uint32", ich9_pm_get_gpe0_blk, NULL, NULL, NULL); - object_property_add_uint32_ptr(obj, ACPI_PM_PROP_GPE0_BLK_LEN, - &gpe0_len, OBJ_PROP_FLAG_READ); object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S3_DISABLED, &pm->disable_s3, OBJ_PROP_FLAG_READWRITE); object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S4_DISABLED, @@ -432,6 +428,16 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) ich9_pm_set_keep_pci_slot_hpc); } +void ich9_pm_add_class_properties(ObjectClass *oc) +{ + static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN; + + object_class_static_property_add_uint32_ptr(oc, + ACPI_PM_PROP_GPE0_BLK_LEN, + &gpe0_len, + OBJ_PROP_FLAG_READ); +} + void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 07c9509cf4..d3f1358887 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -919,6 +919,8 @@ static void ich9_lpc_class_init(ObjectClass *klass, const void *data) ACPI_PM_PROP_ACPI_DISABLE_CMD, &acpi_disable_cmd, OBJ_PROP_FLAG_READ); + + ich9_pm_add_class_properties(klass); } static const TypeInfo ich9_lpc_info = { -- 2.43.0