[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 06/52] pc: acpi-build: use aml_def_block() for de
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH v3 06/52] pc: acpi-build: use aml_def_block() for declaring SSDT table |
Date: |
Mon, 9 Feb 2015 10:53:28 +0000 |
it replaces prebuilt SSDT table header template copying/patching
with AML API
Signed-off-by: Igor Mammedov <address@hidden>
---
hw/i386/acpi-build.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 553c86b..fcefa07 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -816,15 +816,15 @@ static void patch_pci_windows(PcPciInfo *pci, uint8_t
*start, unsigned size)
}
static void
-build_ssdt(GArray *table_data, GArray *linker,
+build_ssdt(Aml *table_data,
AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
PcPciInfo *pci, PcGuestInfo *guest_info)
{
MachineState *machine = MACHINE(qdev_get_machine());
uint32_t nr_mem = machine->ram_slots;
unsigned acpi_cpus = guest_info->apic_id_limit;
- int ssdt_start = table_data->len;
uint8_t *ssdt_ptr;
+ Aml *ssdt;
int i;
/* The current AML generator can cover the APIC ID range [0..255],
@@ -832,9 +832,17 @@ build_ssdt(GArray *table_data, GArray *linker,
QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256);
g_assert(acpi_cpus <= ACPI_CPU_HOTPLUG_ID_LIMIT);
- /* Copy header and patch values in the S3_ / S4_ / S5_ packages */
- ssdt_ptr = acpi_data_push(table_data, sizeof(ssdp_misc_aml));
- memcpy(ssdt_ptr, ssdp_misc_aml, sizeof(ssdp_misc_aml));
+ /* Init SSDT Definition Block */
+ ssdt = aml_def_block("SSDT", 1, ACPI_BUILD_APPNAME6,
+ ACPI_BUILD_APPNAME4, 1,
+ ACPI_BUILD_APPNAME4_HEX, 1);
+
+ /* Copy misc variables and patch values in the S3_ / S4_ / S5_ packages */
+ acpi_data_push(ssdt->buf, sizeof(ssdp_misc_aml) - sizeof(AcpiTableHeader));
+ ssdt_ptr = (uint8_t *)ssdt->buf->data;
+ memcpy(ssdt_ptr + sizeof(AcpiTableHeader),
+ ssdp_misc_aml + sizeof(AcpiTableHeader),
+ sizeof(ssdp_misc_aml) - sizeof(AcpiTableHeader));
if (pm->s3_disabled) {
ssdt_ptr[acpi_s3_name[0]] = 'X';
}
@@ -944,13 +952,11 @@ build_ssdt(GArray *table_data, GArray *linker,
}
}
build_package(sb_scope, op);
- build_append_array(table_data, sb_scope);
+ build_append_array(ssdt->buf, sb_scope);
build_free_array(sb_scope);
}
- build_header(linker, table_data,
- (void *)(table_data->data + ssdt_start),
- "SSDT", table_data->len - ssdt_start, 1);
+ aml_append(table_data, ssdt);
}
static void
@@ -1352,7 +1358,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables
*tables)
ssdt = tables_blob->len;
acpi_add_table(table_offsets, tables_blob);
- build_ssdt(tables_blob, tables->linker, &cpu, &pm, &misc, &pci,
+ build_ssdt(tables->table_data, &cpu, &pm, &misc, &pci,
guest_info);
aml_len += tables_blob->len - ssdt;
--
1.8.3.1
[Qemu-devel] [PATCH v3 07/52] acpi: add aml_scope() term, Igor Mammedov, 2015/02/09
[Qemu-devel] [PATCH v3 05/52] acpi: add aml_def_block() term, Igor Mammedov, 2015/02/09