Since the objects referenced by acpi_pcihp_init() do not inherit from a common class, add ACPI_PCIHP_IO_BASE_PROP and ACPI_PCIHP_IO_BASE_PROP class properties to each referenced object and remove the object properties manually added in acpi_pcihp_init().
Signed-off-by: Mark Cave-Ayland <[email protected]> --- hw/acpi/generic_event_device.c | 10 ++++++++++ hw/acpi/ich9.c | 8 ++++++++ hw/acpi/pcihp.c | 5 ----- hw/acpi/piix4.c | 9 +++++++++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index 9e9416d406..67c9e9b3e8 100644 --- a/hw/acpi/generic_event_device.c +++ b/hw/acpi/generic_event_device.c @@ -11,6 +11,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/visitor.h" #include "hw/acpi/acpi.h" #include "hw/acpi/pcihp.h" #include "hw/acpi/cpu.h" @@ -608,6 +609,15 @@ static void acpi_ged_class_init(ObjectClass *class, const void *data) adevc->ospm_status = acpi_ged_ospm_status; adevc->send_event = acpi_ged_send_event; + + object_class_property_add_uint16_ptr(class, ACPI_PCIHP_IO_BASE_PROP, + offsetof(AcpiGedState, + pcihp_state.io_base), + OBJ_PROP_FLAG_READ); + object_class_property_add_uint16_ptr(class, ACPI_PCIHP_IO_LEN_PROP, + offsetof(AcpiGedState, + pcihp_state.io_len), + OBJ_PROP_FLAG_READ); } static const TypeInfo acpi_ged_info = { diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index cf36dfc3d8..0b295cbe5b 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -438,6 +438,14 @@ void ich9_pm_add_class_properties(ObjectClass *oc) object_class_property_add_bool(oc, "x-keep-pci-slot-hpc", ich9_pm_get_keep_pci_slot_hpc, ich9_pm_set_keep_pci_slot_hpc); + object_class_property_add_uint16_ptr(oc, ACPI_PCIHP_IO_BASE_PROP, + offsetof(ICH9LPCState, + pm.acpi_pci_hotplug.io_base), + OBJ_PROP_FLAG_READ); + object_class_property_add_uint16_ptr(oc, ACPI_PCIHP_IO_LEN_PROP, + offsetof(ICH9LPCState, + pm.acpi_pci_hotplug.io_len), + OBJ_PROP_FLAG_READ); } void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 87162ff2c0..a91f523c93 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -502,11 +502,6 @@ void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, memory_region_init_io(&s->io, owner, &acpi_pcihp_io_ops, s, "acpi-pci-hotplug", s->io_len); memory_region_add_subregion(io, s->io_base, &s->io); - - object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_BASE_PROP, &s->io_base, - OBJ_PROP_FLAG_READ); - object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_LEN_PROP, &s->io_len, - OBJ_PROP_FLAG_READ); } void build_append_pci_dsm_func0_common(Aml *ctx, Aml *retvar) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 9b7f50c7af..1d209ac96d 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -607,6 +607,15 @@ static void piix4_pm_class_init(ObjectClass *klass, const void *data) hc->is_hotpluggable_bus = piix4_is_hotpluggable_bus; adevc->ospm_status = piix4_ospm_status; adevc->send_event = piix4_send_gpe; + + object_class_property_add_uint16_ptr(klass, ACPI_PCIHP_IO_BASE_PROP, + offsetof(PIIX4PMState, + acpi_pci_hotplug.io_base), + OBJ_PROP_FLAG_READ); + object_class_property_add_uint16_ptr(klass, ACPI_PCIHP_IO_LEN_PROP, + offsetof(PIIX4PMState, + acpi_pci_hotplug.io_len), + OBJ_PROP_FLAG_READ); } static const TypeInfo piix4_pm_info = { -- 2.43.0
