summary refs log tree commit diff stats
path: root/hw/acpi
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2015-12-28 18:02:25 +0100
committerMichael S. Tsirkin <mst@redhat.com>2016-01-09 23:20:17 +0200
commit40f981a02d082fba4efc2b6fcabd390648335fa8 (patch)
tree24970cfd3e11ce4c40eb96108173f9e3252fae69 /hw/acpi
parent1d608d13eb9819812034dd4e5ea615c571b4a57d (diff)
downloadfocaccia-qemu-40f981a02d082fba4efc2b6fcabd390648335fa8.tar.gz
focaccia-qemu-40f981a02d082fba4efc2b6fcabd390648335fa8.zip
pc: acpi: cpuhp: move CPST() method into 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>


Diffstat (limited to 'hw/acpi')
-rw-r--r--hw/acpi/cpu_hotplug_acpi_table.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c
index 69c37fad71..90c4043f4d 100644
--- a/hw/acpi/cpu_hotplug_acpi_table.c
+++ b/hw/acpi/cpu_hotplug_acpi_table.c
@@ -18,6 +18,8 @@
 void build_cpu_hotplug_aml(Aml *ctx)
 {
     Aml *method;
+    Aml *if_ctx;
+    Aml *else_ctx;
     Aml *sb_scope = aml_scope("_SB");
     uint8_t madt_tmpl[8] = {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0};
     Aml *cpu_id = aml_arg(0);
@@ -43,6 +45,26 @@ void build_cpu_hotplug_aml(Aml *ctx)
     aml_append(method, aml_return(madt));
     aml_append(sb_scope, method);
 
+    /*
+     * _STA method - return ON status of cpu
+     * cpu_id = Arg0 = Processor ID = Local APIC ID
+     * cpu_on = Local0 = CPON flag for this cpu
+     */
+    method = aml_method(CPU_STATUS_METHOD, 1, AML_NOTSERIALIZED);
+    aml_append(method,
+        aml_store(aml_derefof(aml_index(cpus_map, cpu_id)), cpu_on));
+    if_ctx = aml_if(cpu_on);
+    {
+        aml_append(if_ctx, aml_return(aml_int(0xF)));
+    }
+    aml_append(method, if_ctx);
+    else_ctx = aml_else();
+    {
+        aml_append(else_ctx, aml_return(aml_int(0x0)));
+    }
+    aml_append(method, else_ctx);
+    aml_append(sb_scope, method);
+
     method = aml_method(CPU_EJECT_METHOD, 2, AML_NOTSERIALIZED);
     aml_append(method, aml_sleep(200));
     aml_append(sb_scope, method);