summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2015-12-28 18:02:23 +0100
committerMichael S. Tsirkin <mst@redhat.com>2016-01-09 23:20:17 +0200
commitfbd7a6b8e2f68970370665187893a3c80c69d555 (patch)
tree939373d07b27df9a4111060d36251ae67404ddda
parent1295e21a17083a2babfcf12511c1b2ebfdcc978d (diff)
downloadqemu-fbd7a6b8e2f68970370665187893a3c80c69d555.tar.gz
qemu-fbd7a6b8e2f68970370665187893a3c80c69d555.tar.bz2
qemu-fbd7a6b8e2f68970370665187893a3c80c69d555.zip
pc: acpi: cpuhp: move CPEJ() method to SSDT
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/acpi/Makefile.objs2
-rw-r--r--hw/acpi/cpu_hotplug_acpi_table.c28
-rw-r--r--hw/i386/acpi-build.c3
-rw-r--r--hw/i386/acpi-dsdt-cpu-hotplug.dsl4
-rw-r--r--include/hw/acpi/cpu_hotplug.h5
5 files changed, 36 insertions, 6 deletions
diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
index 052be627cc..f3ade9a28e 100644
--- a/hw/acpi/Makefile.objs
+++ b/hw/acpi/Makefile.objs
@@ -1,6 +1,6 @@
common-obj-$(CONFIG_ACPI_X86) += core.o piix4.o pcihp.o
common-obj-$(CONFIG_ACPI_X86_ICH) += ich9.o tco.o
-common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu_hotplug.o
+common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu_hotplug.o cpu_hotplug_acpi_table.o
common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o memory_hotplug_acpi_table.o
common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o
common-obj-$(CONFIG_ACPI) += acpi_interface.o
diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c
new file mode 100644
index 0000000000..422e57b5b3
--- /dev/null
+++ b/hw/acpi/cpu_hotplug_acpi_table.c
@@ -0,0 +1,28 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "hw/acpi/cpu_hotplug.h"
+
+void build_cpu_hotplug_aml(Aml *ctx)
+{
+ Aml *method;
+ Aml *sb_scope = aml_scope("_SB");
+
+ method = aml_method(CPU_EJECT_METHOD, 2, AML_NOTSERIALIZED);
+ aml_append(method, aml_sleep(200));
+ aml_append(sb_scope, method);
+
+ aml_append(ctx, sb_scope);
+}
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 42e60c1d3a..53b29163a2 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1080,6 +1080,7 @@ build_ssdt(GArray *table_data, GArray *linker,
/* Reserve space for header */
acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
+ build_cpu_hotplug_aml(ssdt);
build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
pm->mem_hp_io_len);
@@ -1326,7 +1327,7 @@ build_ssdt(GArray *table_data, GArray *linker,
method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
aml_append(method,
- aml_return(aml_call2("CPEJ", aml_int(i), aml_arg(0)))
+ aml_return(aml_call2(CPU_EJECT_METHOD, aml_int(i), aml_arg(0)))
);
aml_append(dev, method);
diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
index 53e1389183..18331be220 100644
--- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
@@ -48,10 +48,6 @@ Scope(\_SB) {
Return (0x0)
}
}
- Method(CPEJ, 2, NotSerialized) {
- // _EJ0 method - eject callback
- Sleep(200)
- }
Method(PRSC, 0) {
// Local5 = active cpu bitmap
diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
index f6d358def1..87504beccd 100644
--- a/include/hw/acpi/cpu_hotplug.h
+++ b/include/hw/acpi/cpu_hotplug.h
@@ -14,6 +14,7 @@
#include "hw/acpi/acpi.h"
#include "hw/acpi/pc-hotplug.h"
+#include "hw/acpi/aml-build.h"
typedef struct AcpiCpuHotplug {
MemoryRegion io;
@@ -25,4 +26,8 @@ void acpi_cpu_plug_cb(ACPIREGS *ar, qemu_irq irq,
void acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
AcpiCpuHotplug *gpe_cpu, uint16_t base);
+
+#define CPU_EJECT_METHOD "CPEJ"
+
+void build_cpu_hotplug_aml(Aml *ctx);
#endif