On 24/08/2026 13:59, Daniel P. Berrangé wrote:

On Fri, Aug 21, 2026 at 12:14:23PM +0100, Mark Cave-Ayland wrote:
ACPI_PM_PROP_TCO_ENABLED, ACPI_PM_PROP_ACPI_PCIHP_BRIDGE and x-keep-pci-slot-hpc
properties can be converted to use object_class_property_add_bool_ptr(). Remove
the now unused ich9_pm_add_properties() function.

Signed-off-by: Mark Cave-Ayland <[email protected]>
Reviewed-by: Marc-André Lureau <[email protected]>
---
  include/hw/acpi/ich9.h |   3 +-
  hw/acpi/ich9.c         | 111 ++++++++++++++++-------------------------
  hw/isa/lpc_ich9.c      |   3 +-
  3 files changed, 44 insertions(+), 73 deletions(-)

Reviewed-by: Daniel P. Berrangé <[email protected]>

but...


@@ -436,6 +368,47 @@ void ich9_pm_add_class_properties(ObjectClass *oc)
                                                  ACPI_PM_PROP_GPE0_BLK_LEN,
                                                  &gpe0_len,
                                                  OBJ_PROP_FLAG_READ);
...it'd read nicer with

   #define REG_FIELD(n) \
     (pm_offset + offsetof(ICH9LPCPMRegs, n))

I don't feel strongly about it either way, but I'll try implementing it using a PM_REG_FIELD() macro as suggested above (I'm worried that REG_FIELD() is a generic enough name that it may end up clashing with something internally).
+    object_class_property_add_uint32_ptr(oc, ACPI_PM_PROP_PM_IO_BASE,
+                                         pm_offset +
+                                         offsetof(ICH9LPCPMRegs,
+                                                  pm_io_base),
+                                         OBJ_PROP_FLAG_READ);


....

     object_class_property_add_uint32_ptr(oc, ACPI_PM_PROP_PM_IO_BASE,
                                          REG_FIELD(pm_io_base),
                                          OBJ_PROP_FLAG_READ);

...

+    object_class_property_add_link(oc, "bus",
+                                   TYPE_PCI_BUS,
+                                   pm_offset +
+                                   offsetof(ICH9LPCPMRegs,
+                                            acpi_pci_hotplug.root),
+                                   object_property_allow_set_link,
+                                   OBJ_PROP_LINK_STRONG);
+    object_class_property_add(oc, ACPI_PM_PROP_GPE0_BLK, "uint32",
+                              ich9_pm_get_gpe0_blk,
+                              NULL, NULL, NULL);
+    object_class_property_add_uint8_ptr(oc, ACPI_PM_PROP_S3_DISABLED,
+                                        pm_offset +
+                                        offsetof(ICH9LPCPMRegs, disable_s3),
+                                        OBJ_PROP_FLAG_READWRITE);
+    object_class_property_add_uint8_ptr(oc, ACPI_PM_PROP_S4_DISABLED,
+                                        pm_offset +
+                                        offsetof(ICH9LPCPMRegs, disable_s4),
+                                        OBJ_PROP_FLAG_READWRITE);
+    object_class_property_add_uint8_ptr(oc, ACPI_PM_PROP_S4_VAL,
+                                        pm_offset +
+                                        offsetof(ICH9LPCPMRegs, s4_val),
+                                        OBJ_PROP_FLAG_READWRITE);
+    object_class_property_add_bool_ptr(oc, ACPI_PM_PROP_TCO_ENABLED,
+                                       pm_offset +
+                                       offsetof(ICH9LPCPMRegs, enable_tco),
+                                       OBJ_PROP_FLAG_READWRITE);
+    object_class_property_add_bool_ptr(oc, ACPI_PM_PROP_ACPI_PCIHP_BRIDGE,
+                               pm_offset +
+                               offsetof(ICH9LPCPMRegs,
+                                   acpi_pci_hotplug.use_acpi_hotplug_bridge),
+                               OBJ_PROP_FLAG_READWRITE);
+    object_class_property_add_bool_ptr(oc, "x-keep-pci-slot-hpc",
+                                       pm_offset +
+                                       offsetof(ICH9LPCPMRegs,
+                                                keep_pci_slot_hpc),
+                                       OBJ_PROP_FLAG_READWRITE);

...

   #undef REG_FIELD

  }
void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index d3f1358887..b55b5136a3 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -689,7 +689,6 @@ static void ich9_lpc_initfn(Object *obj)
                               IOAPIC_NUM_PINS);
ich9_pm_reset_properties(&lpc->pm);
-    ich9_pm_add_properties(obj, &lpc->pm);
  }
static void ich9_lpc_realize(PCIDevice *d, Error **errp)
@@ -920,7 +919,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, const 
void *data)
                                                 &acpi_disable_cmd,
                                                 OBJ_PROP_FLAG_READ);
- ich9_pm_add_class_properties(klass);
+    ich9_pm_add_class_properties(klass, offsetof(ICH9LPCState, pm));
  }
static const TypeInfo ich9_lpc_info = {
--
2.43.0

ATB,

Mark.


Reply via email to