From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKlz4-0003C2-06 for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:54:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKlyz-0000HD-T1 for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:54:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42297) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKlyz-0000H4-Lo for qemu-devel@nongnu.org; Mon, 09 Feb 2015 05:54:25 -0500 From: Igor Mammedov Date: Mon, 9 Feb 2015 10:53:25 +0000 Message-Id: <1423479254-15342-4-git-send-email-imammedo@redhat.com> In-Reply-To: <1423479254-15342-1-git-send-email-imammedo@redhat.com> References: <1423479254-15342-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH v3 03/52] pc: acpi: make top level ACPI tables blob Aml* List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: drjones@redhat.com, marcel.a@redhat.com, claudio.fontana@huawei.com, mst@redhat.com, zhaoshenglong@huawei.com it will permit to add a separate tables into blob like other AML constructs using aml_append() routine and hide from user need to invoke linker manually for tables, handling it automatically inside of aml_append() helper. Later when all tables are converted to use AML API, it would be possible to generate RSDT automatically and drop manual table offsets tracking for RSDT. Signed-off-by: Igor Mammedov --- hw/i386/acpi-build.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 8020899..788962e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1238,7 +1238,7 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) typedef struct AcpiBuildTables { - GArray *table_data; + Aml *table_data; GArray *rsdp; GArray *tcpalog; GArray *linker; @@ -1247,17 +1247,17 @@ struct AcpiBuildTables { static inline void acpi_build_tables_init(AcpiBuildTables *tables) { tables->rsdp = g_array_new(false, true /* clear */, 1); - tables->table_data = g_array_new(false, true /* clear */, 1); tables->tcpalog = g_array_new(false, true /* clear */, 1); tables->linker = bios_linker_loader_init(); + tables->table_data = init_aml_allocator(tables->linker); } static inline void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre) { void *linker_data = bios_linker_loader_cleanup(tables->linker); + free_aml_allocator(); g_free(linker_data); g_array_free(tables->rsdp, mfre); - g_array_free(tables->table_data, true); g_array_free(tables->tcpalog, mfre); } @@ -1317,7 +1317,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) PcPciInfo pci; uint8_t *u; size_t aml_len = 0; - GArray *tables_blob = tables->table_data; + GArray *tables_blob = tables->table_data->buf; acpi_get_cpu_info(&cpu); acpi_get_pm_info(&pm); @@ -1469,14 +1469,14 @@ static void acpi_build_update(void *build_opaque, uint32_t offset) acpi_build(build_state->guest_info, &tables); - assert(acpi_data_len(tables.table_data) == build_state->table_size); + assert(acpi_data_len(tables.table_data->buf) == build_state->table_size); /* Make sure RAM size is correct - in case it got changed by migration */ qemu_ram_resize(build_state->table_ram, build_state->table_size, &error_abort); - memcpy(qemu_get_ram_ptr(build_state->table_ram), tables.table_data->data, - build_state->table_size); + memcpy(qemu_get_ram_ptr(build_state->table_ram), + tables.table_data->buf->data, build_state->table_size); cpu_physical_memory_set_dirty_range_nocode(build_state->table_ram, build_state->table_size); @@ -1537,11 +1537,12 @@ void acpi_setup(PcGuestInfo *guest_info) acpi_build(build_state->guest_info, &tables); /* Now expose it all to Guest */ - build_state->table_ram = acpi_add_rom_blob(build_state, tables.table_data, + build_state->table_ram = acpi_add_rom_blob(build_state, + tables.table_data->buf, ACPI_BUILD_TABLE_FILE, ACPI_BUILD_TABLE_MAX_SIZE); assert(build_state->table_ram != RAM_ADDR_MAX); - build_state->table_size = acpi_data_len(tables.table_data); + build_state->table_size = acpi_data_len(tables.table_data->buf); acpi_add_rom_blob(NULL, tables.linker, "etc/table-loader", 0); -- 1.8.3.1