@samitouri / QOSamiQemu / commits / 39c77172cf

hw/acpi/ich9.c: convert ACPI_PM_PROP_GPE0_BLK_LEN to a static class property

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 <mark.caveayland@nutanix.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20260825134320.1039012-10-mark.caveayland@nutanix.com>

Mark Cave-Ayland committed Aug 25, 2026 at 14:41 UTC 39c77172cf62f1269bdd860ca25ced5cd24ec754
3 files changed +13 -4
hw/acpi/ich9.c
+10 -4
@@ -402,8 +402,6 @@ void ich9_pm_reset_properties(ICH9LPCPMRegs *pm)
402
403 void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
404 {
405 - static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
406 -
405 object_property_add_uint32_ptr(obj, ACPI_PM_PROP_PM_IO_BASE,
406 &pm->pm_io_base, OBJ_PROP_FLAG_READ);
407 object_property_add_link(obj, "bus", TYPE_PCI_BUS,
@@ -413,8 +411,6 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
411 object_property_add(obj, ACPI_PM_PROP_GPE0_BLK, "uint32",
412 ich9_pm_get_gpe0_blk,
413 NULL, NULL, NULL);
416 - object_property_add_uint32_ptr(obj, ACPI_PM_PROP_GPE0_BLK_LEN,
417 - &gpe0_len, OBJ_PROP_FLAG_READ);
414 object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S3_DISABLED,
415 &pm->disable_s3, OBJ_PROP_FLAG_READWRITE);
416 object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S4_DISABLED,
@@ -432,6 +428,16 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
428 ich9_pm_set_keep_pci_slot_hpc);
429 }
430
431 +void ich9_pm_add_class_properties(ObjectClass *oc)
432 +{
433 + static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
434 +
435 + object_class_static_property_add_uint32_ptr(oc,
436 + ACPI_PM_PROP_GPE0_BLK_LEN,
437 + &gpe0_len,
438 + OBJ_PROP_FLAG_READ);
439 +}
440 +
441 void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
442 Error **errp)
443 {
hw/isa/lpc_ich9.c
+2
@@ -919,6 +919,8 @@ static void ich9_lpc_class_init(ObjectClass *klass, const void *data)
919 ACPI_PM_PROP_ACPI_DISABLE_CMD,
920 &acpi_disable_cmd,
921 OBJ_PROP_FLAG_READ);
922 +
923 + ich9_pm_add_class_properties(klass);
924 }
925
926 static const TypeInfo ich9_lpc_info = {
include/hw/acpi/ich9.h
+1
@@ -84,6 +84,7 @@ extern const VMStateDescription vmstate_ich9_pm;
84 void ich9_pm_reset_properties(ICH9LPCPMRegs *pm);
85
86 void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm);
87 +void ich9_pm_add_class_properties(ObjectClass *oc);
88
89 void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
90 Error **errp);