[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 17/51] pc: acpi: cpuhp: move CPMA() method into S
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH v2 17/51] pc: acpi: cpuhp: move CPMA() method into SSDT |
Date: |
Mon, 28 Dec 2015 18:02:24 +0100 |
Signed-off-by: Igor Mammedov <address@hidden>
---
hw/acpi/cpu_hotplug_acpi_table.c | 23 +++++++++++++++++++++++
hw/i386/acpi-build.c | 5 +++--
hw/i386/acpi-dsdt-cpu-hotplug.dsl | 13 -------------
include/hw/acpi/cpu_hotplug.h | 2 ++
4 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/hw/acpi/cpu_hotplug_acpi_table.c b/hw/acpi/cpu_hotplug_acpi_table.c
index 422e57b..69c37fa 100644
--- a/hw/acpi/cpu_hotplug_acpi_table.c
+++ b/hw/acpi/cpu_hotplug_acpi_table.c
@@ -19,6 +19,29 @@ void build_cpu_hotplug_aml(Aml *ctx)
{
Aml *method;
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);
+ Aml *cpu_on = aml_local(0);
+ Aml *madt = aml_local(1);
+ Aml *cpus_map = aml_name(CPU_ON_BITMAP);
+
+ /*
+ * _MAT method - creates an madt apic buffer
+ * cpu_id = Arg0 = Processor ID = Local APIC ID
+ * cpu_on = Local0 = CPON flag for this cpu
+ * madt = Local1 = Buffer (in madt apic form) to return
+ */
+ method = aml_method(CPU_MAT_METHOD, 1, AML_NOTSERIALIZED);
+ aml_append(method,
+ aml_store(aml_derefof(aml_index(cpus_map, cpu_id)), cpu_on));
+ aml_append(method,
+ aml_store(aml_buffer(sizeof(madt_tmpl), madt_tmpl), madt));
+ /* Update the processor id, lapic id, and enable/disable status */
+ aml_append(method, aml_store(cpu_id, aml_index(madt, aml_int(2))));
+ aml_append(method, aml_store(cpu_id, aml_index(madt, aml_int(3))));
+ aml_append(method, aml_store(cpu_on, aml_index(madt, aml_int(4))));
+ aml_append(method, aml_return(madt));
+ aml_append(sb_scope, method);
method = aml_method(CPU_EJECT_METHOD, 2, AML_NOTSERIALIZED);
aml_append(method, aml_sleep(200));
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index a4343de..683687a 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1316,7 +1316,8 @@ build_ssdt(GArray *table_data, GArray *linker,
dev = aml_processor(i, 0, 0, "CP%.02X", i);
method = aml_method("_MAT", 0, AML_NOTSERIALIZED);
- aml_append(method, aml_return(aml_call1("CPMA", aml_int(i))));
+ aml_append(method,
+ aml_return(aml_call1(CPU_MAT_METHOD, aml_int(i))));
aml_append(dev, method);
method = aml_method("_STA", 0, AML_NOTSERIALIZED);
@@ -1360,7 +1361,7 @@ build_ssdt(GArray *table_data, GArray *linker,
uint8_t b = test_bit(i, cpu->found_cpus) ? 0x01 : 0x00;
aml_append(pkg, aml_int(b));
}
- aml_append(sb_scope, aml_name_decl("CPON", pkg));
+ aml_append(sb_scope, aml_name_decl(CPU_ON_BITMAP, pkg));
build_memory_devices(sb_scope, nr_mem, pm->mem_hp_io_base,
pm->mem_hp_io_len);
diff --git a/hw/i386/acpi-dsdt-cpu-hotplug.dsl
b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
index 18331be..9739191 100644
--- a/hw/i386/acpi-dsdt-cpu-hotplug.dsl
+++ b/hw/i386/acpi-dsdt-cpu-hotplug.dsl
@@ -24,19 +24,6 @@ Scope(\_SB) {
External(PRS, FieldUnitObj)
/* Methods called by run-time generated SSDT Processor objects */
- Method(CPMA, 1, NotSerialized) {
- // _MAT method - create an madt apic buffer
- // Arg0 = Processor ID = Local APIC ID
- // Local0 = CPON flag for this cpu
- Store(DerefOf(Index(CPON, Arg0)), Local0)
- // Local1 = Buffer (in madt apic form) to return
- Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
- // Update the processor id, lapic id, and enable/disable status
- Store(Arg0, Index(Local1, 2))
- Store(Arg0, Index(Local1, 3))
- Store(Local0, Index(Local1, 4))
- Return (Local1)
- }
Method(CPST, 1, NotSerialized) {
// _STA method - return ON status of cpu
// Arg0 = Processor ID = Local APIC ID
diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h
index 87504be..40b9316 100644
--- a/include/hw/acpi/cpu_hotplug.h
+++ b/include/hw/acpi/cpu_hotplug.h
@@ -28,6 +28,8 @@ void acpi_cpu_hotplug_init(MemoryRegion *parent, Object
*owner,
AcpiCpuHotplug *gpe_cpu, uint16_t base);
#define CPU_EJECT_METHOD "CPEJ"
+#define CPU_MAT_METHOD "CPMA"
+#define CPU_ON_BITMAP "CPON"
void build_cpu_hotplug_aml(Aml *ctx);
#endif
--
1.8.3.1
- [Qemu-devel] [PATCH v2 04/51] pc: acpi: memhp: move MHPD.MLCK mutex into SSDT, (continued)
- [Qemu-devel] [PATCH v2 04/51] pc: acpi: memhp: move MHPD.MLCK mutex into SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 01/51] tests: acpi: print ASL diff in verbose mode, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 02/51] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 05/51] pc: acpi: memhp: move MHPD.MSCN method into SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 06/51] pc: acpi: memhp: move MHPD.MRST method into SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 08/51] pc: acpi: memhp: move MHPD.MOST method into SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 07/51] pc: acpi: memhp: move MHPD.MPXM method into SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 10/51] pc: acpi: memhp: move MHPD.MCRS method into SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 11/51] pc: acpi: memhp: move MHPD Device into SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 15/51] pc: acpi: drop unused CPU_STATUS_LEN from DSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 17/51] pc: acpi: cpuhp: move CPMA() method into SSDT,
Igor Mammedov <=
- [Qemu-devel] [PATCH v2 14/51] pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 18/51] pc: acpi: cpuhp: move CPST() method into SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 09/51] pc: acpi: memhp: move MHPD.MEJ0 method into SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 13/51] pc: acpi: memhp: move \_GPE._E03 into SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 16/51] pc: acpi: cpuhp: move CPEJ() method to SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 12/51] pc: acpi: factor out memhp code from build_ssdt() into separate function, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 21/51] pc: acpi: factor out cpu hotplug code from build_ssdt() into separate function, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 23/51] pc: acpi: move DBUG() from DSDT to SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 22/51] pc: acpi: move HPET from DSDT to SSDT, Igor Mammedov, 2015/12/28
- [Qemu-devel] [PATCH v2 25/51] pc: acpi: move KBD device from DSDT to SSDT, Igor Mammedov, 2015/12/28