diff mbox

[15/27] acpi: piix4: add memory-hotplug-io-base property to piix4_pm

Message ID 1385001528-12003-16-git-send-email-imammedo@redhat.com
State New
Headers show

Commit Message

Igor Mammedov Nov. 21, 2013, 2:38 a.m. UTC
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/piix4.c        |   14 +++++++++++++-
 include/hw/acpi/acpi.h |    2 ++
 2 files changed, 15 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index e0d9270..a835981 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -18,6 +18,7 @@ 
  * Contributions after 2012-01-13 are licensed under the terms of the
  * GNU GPL, version 2 or (at your option) any later version.
  */
+#include "qapi/visitor.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
 #include "hw/isa/apm.h"
@@ -757,6 +758,14 @@  int piix4_mem_hotplug(DeviceState *hotplug_dev, DeviceState *dev,
 static int piix4_device_hotplug(DeviceState *qdev, DeviceState *dev,
                                 HotplugState state);
 
+static void piix4_get_mem_io_base(Object *obj, Visitor *v, void *opaque,
+                                  const char *name, Error **errp)
+{
+    PIIX4PMState *s = PIIX4_PM(obj);
+
+    visit_type_uint16(v, &s->gpe_mem.port, name, errp);
+}
+
 static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
                                            PCIBus *bus, PIIX4PMState *s)
 {
@@ -789,8 +798,11 @@  static void piix4_acpi_system_hot_add_init(MemoryRegion *parent,
     s->cpu_added_notifier.notify = piix4_cpu_added_req;
     qemu_register_cpu_added_notifier(&s->cpu_added_notifier);
 
+    s->gpe_mem.port = ACPI_MEMORY_HOTPLUG_BASE;
+    object_property_add(OBJECT(s), ACPI_MEMORY_HOTPLUG_IO_BASE_PROP, "int",
+                        piix4_get_mem_io_base, NULL, NULL, NULL, NULL);
     acpi_memory_hotplug_init(OBJECT(s), &s->io_mem, &s->gpe_mem);
-    memory_region_add_subregion(parent, ACPI_MEMORY_HOTPLUG_BASE, &s->io_mem);
+    memory_region_add_subregion(parent, s->gpe_mem.port, &s->io_mem);
 }
 
 static void enable_device(PIIX4PMState *s, int slot)
diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h
index e5717df..95c608f 100644
--- a/include/hw/acpi/acpi.h
+++ b/include/hw/acpi/acpi.h
@@ -170,6 +170,7 @@  void acpi_update_sci(ACPIREGS *acpi_regs, qemu_irq irq, uint32_t gpe0_sts_mask);
 
 #define ACPI_MEMORY_HOTPLUG_IO_LEN 24
 #define ACPI_MEMORY_HOTPLUG_BASE 0x0a00
+#define ACPI_MEMORY_HOTPLUG_IO_BASE_PROP "memory-hotplug-io-base"
 
 #define ACPI_MEMORY_HOTPLUG_STATUS 8
 
@@ -182,6 +183,7 @@  typedef struct MemStatus {
 } MemStatus;
 
 typedef struct MemHotplugState {
+    uint16_t port;
     uint32_t selector;
     uint32_t dev_count;
     MemStatus *devs;