qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 07/13] acpi: Use QOM property to get CPU hotplug I/O


From: Eduardo Habkost
Subject: [Qemu-devel] [PATCH 07/13] acpi: Use QOM property to get CPU hotplug I/O base
Date: Wed, 2 Dec 2015 20:22:52 -0200

Instead of hardcoding the ich9 and piix I/O bases, use a QOM
property, the same way we already do for PCI hotplug I/O base.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 hw/acpi/cpu_hotplug.c         | 3 +++
 hw/acpi/ich9.c                | 2 ++
 hw/acpi/piix4.c               | 2 ++
 hw/i386/acpi-build.c          | 5 ++---
 include/hw/acpi/cpu_hotplug.h | 1 +
 include/hw/acpi/pc-hotplug.h  | 4 ++--
 6 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
index f5b9972..6d4d7c1 100644
--- a/hw/acpi/cpu_hotplug.c
+++ b/hw/acpi/cpu_hotplug.c
@@ -73,4 +73,7 @@ void acpi_cpu_hotplug_init(MemoryRegion *parent, Object 
*owner,
     memory_region_init_io(&gpe_cpu->io, owner, &AcpiCpuHotplug_ops,
                           gpe_cpu, "acpi-cpu-hotplug", ACPI_GPE_PROC_LEN);
     memory_region_add_subregion(parent, base, &gpe_cpu->io);
+    gpe_cpu->base = base;
+    object_property_add_uint16_ptr(owner, ACPI_CPUHP_IO_BASE_PROP,
+                                   &gpe_cpu->base, &error_abort);
 }
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 1c7fcfa..aa30c3e 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -46,6 +46,8 @@ do { printf("%s "fmt, __func__, ## __VA_ARGS__); } while (0)
 #define ICH9_DEBUG(fmt, ...)    do { } while (0)
 #endif
 
+#define ICH9_CPU_HOTPLUG_IO_BASE 0x0CD8
+
 static void ich9_pm_update_sci_fn(ACPIREGS *regs)
 {
     ICH9LPCPMRegs *pm = container_of(regs, ICH9LPCPMRegs, acpi_regs);
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 2cd2fee..e4393fd 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -46,6 +46,8 @@
 # define PIIX4_DPRINTF(format, ...)     do { } while (0)
 #endif
 
+#define PIIX4_CPU_HOTPLUG_IO_BASE 0xaf00
+
 #define GPE_BASE 0xafe0
 #define GPE_LEN 4
 
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 4f42e28..6774ced 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -147,12 +147,10 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)
     Object *lpc = ich9_lpc_find();
     Object *obj = NULL;
 
-    pm->cpu_hp_io_base = 0;
     pm->pcihp_io_base = 0;
     pm->pcihp_io_len = 0;
     if (piix) {
         obj = piix;
-        pm->cpu_hp_io_base = PIIX4_CPU_HOTPLUG_IO_BASE;
         pm->pcihp_io_base =
             object_property_get_int(obj, ACPI_PCIHP_IO_BASE_PROP,
                                     &error_abort);
@@ -162,10 +160,11 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)
     }
     if (lpc) {
         obj = lpc;
-        pm->cpu_hp_io_base = ICH9_CPU_HOTPLUG_IO_BASE;
     }
     assert(obj);
 
+    pm->cpu_hp_io_base =
+        object_property_get_int(obj, ACPI_CPUHP_IO_BASE_PROP, &error_abort);
     pm->cpu_hp_io_len = ACPI_GPE_PROC_LEN;
     pm->mem_hp_io_base = ACPI_MEMORY_HOTPLUG_BASE;
     pm->mem_hp_io_len = ACPI_MEMORY_HOTPLUG_IO_LEN;
diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
index f6d358d..0e1dd99 100644
--- a/include/hw/acpi/cpu_hotplug.h
+++ b/include/hw/acpi/cpu_hotplug.h
@@ -16,6 +16,7 @@
 #include "hw/acpi/pc-hotplug.h"
 
 typedef struct AcpiCpuHotplug {
+    uint16_t base;
     MemoryRegion io;
     uint8_t sts[ACPI_GPE_PROC_LEN];
 } AcpiCpuHotplug;
diff --git a/include/hw/acpi/pc-hotplug.h b/include/hw/acpi/pc-hotplug.h
index 77b1569..f4b006c 100644
--- a/include/hw/acpi/pc-hotplug.h
+++ b/include/hw/acpi/pc-hotplug.h
@@ -25,8 +25,8 @@
 /* 256 CPU IDs, 8 bits per entry: */
 #define ACPI_GPE_PROC_LEN 32
 
-#define ICH9_CPU_HOTPLUG_IO_BASE 0x0CD8
-#define PIIX4_CPU_HOTPLUG_IO_BASE 0xaf00
+#define ACPI_CPUHP_IO_BASE_PROP "acpi-cpuhp-io-base"
+
 #define CPU_HOTPLUG_RESOURCE_DEVICE PRES
 
 #define ACPI_MEMORY_HOTPLUG_IO_LEN 24
-- 
2.1.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]