From patchwork Mon Jun 8 18:14:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 481973 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B49971401DE for ; Tue, 9 Jun 2015 04:15:15 +1000 (AEST) Received: from localhost ([::1]:59599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z21Zp-0006jc-Rw for incoming@patchwork.ozlabs.org; Mon, 08 Jun 2015 14:15:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z21ZG-0005vH-Vw for qemu-devel@nongnu.org; Mon, 08 Jun 2015 14:14:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z21ZE-0000D8-EQ for qemu-devel@nongnu.org; Mon, 08 Jun 2015 14:14:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z21ZE-0000Cz-7J for qemu-devel@nongnu.org; Mon, 08 Jun 2015 14:14:36 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id C23ABB7A86; Mon, 8 Jun 2015 18:14:35 +0000 (UTC) Received: from redhat.com (ovpn-116-96.ams2.redhat.com [10.36.116.96]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id t58IEW21022442; Mon, 8 Jun 2015 14:14:32 -0400 Date: Mon, 8 Jun 2015 20:14:31 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1433787255-4372-2-git-send-email-mst@redhat.com> References: <1433787255-4372-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1433787255-4372-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Eduardo Habkost , ghammer@redhat.com, shannon.zhao@linaro.org, imammedo@redhat.com, pbonzini@redhat.com, lersek@redhat.com, Richard Henderson Subject: [Qemu-devel] [PATCH v2 1/4] acpi: add API for 64 bit offsets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Collecting these is useful for implementing the XSDT. Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/aml-build.h | 3 ++- hw/acpi/aml-build.c | 13 ++++++++++--- hw/arm/virt-acpi-build.c | 8 ++++---- hw/i386/acpi-build.c | 20 ++++++++++---------- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index e3afa13..edc1dfa 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -281,7 +281,8 @@ build_header(GArray *linker, GArray *table_data, AcpiTableHeader *h, const char *sig, int len, uint8_t rev); void *acpi_data_push(GArray *table_data, unsigned size); unsigned acpi_data_len(GArray *table); -void acpi_add_table(GArray *table_offsets, GArray *table_data); +void acpi_add_table(GArray *table_offsets32, GArray *table_offsets64, + GArray *table_data); void acpi_build_tables_init(AcpiBuildTables *tables); void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre); void diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 0d4b324..4c930b6 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1169,10 +1169,17 @@ unsigned acpi_data_len(GArray *table) return table->len; } -void acpi_add_table(GArray *table_offsets, GArray *table_data) +void acpi_add_table(GArray *table_offsets32, GArray *table_offsets64, + GArray *table_data) { - uint32_t offset = cpu_to_le32(table_data->len); - g_array_append_val(table_offsets, offset); + uint32_t offset32 = cpu_to_le32(table_data->len); + uint64_t offset64 = cpu_to_le64(table_data->len); + if (table_offsets32) { + g_array_append_val(table_offsets32, offset32); + } + if (table_offsets64) { + g_array_append_val(table_offsets64, offset64); + } } void acpi_build_tables_init(AcpiBuildTables *tables) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index a9373cc..42c8dd9 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -515,16 +515,16 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) build_dsdt(tables_blob, tables->linker, guest_info); /* FADT MADT GTDT pointed to by RSDT */ - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); build_fadt(tables_blob, tables->linker, dsdt); - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); build_madt(tables_blob, tables->linker, guest_info, &cpuinfo); - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); build_gtdt(tables_blob, tables->linker); - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); build_mcfg(tables_blob, tables->linker, guest_info); /* RSDT is pointed to by RSDP */ diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index db32fd1..e5b0b7a 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1706,27 +1706,27 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) aml_len += tables_blob->len - dsdt; /* ACPI tables pointed to by RSDT */ - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); build_fadt(tables_blob, tables->linker, &pm, facs, dsdt); ssdt = tables_blob->len; - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); build_ssdt(tables_blob, tables->linker, &cpu, &pm, &misc, &pci, guest_info); aml_len += tables_blob->len - ssdt; - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); build_madt(tables_blob, tables->linker, &cpu, guest_info); if (misc.has_hpet) { - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); build_hpet(tables_blob, tables->linker); } if (misc.tpm_version != TPM_VERSION_UNSPEC) { - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); build_tpm_tcpa(tables_blob, tables->linker, tables->tcpalog); - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); switch (misc.tpm_version) { case TPM_VERSION_1_2: build_tpm_ssdt(tables_blob, tables->linker); @@ -1739,15 +1739,15 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) } } if (guest_info->numa_nodes) { - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); build_srat(tables_blob, tables->linker, guest_info); } if (acpi_get_mcfg(&mcfg)) { - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); build_mcfg_q35(tables_blob, tables->linker, &mcfg); } if (acpi_has_iommu()) { - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); build_dmar_q35(tables_blob, tables->linker); } @@ -1755,7 +1755,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables) for (u = acpi_table_first(); u; u = acpi_table_next(u)) { unsigned len = acpi_table_len(u); - acpi_add_table(table_offsets, tables_blob); + acpi_add_table(table_offsets, NULL, tables_blob); g_array_append_vals(tables_blob, u, len); }