From nobody Sun Feb 8 11:45:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.intel.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1545044914820635.7100724603072; Mon, 17 Dec 2018 03:08:34 -0800 (PST) Received: from localhost ([::1]:45945 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYqlF-0001K7-7l for importer@patchew.org; Mon, 17 Dec 2018 06:08:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYqcO-00038B-3x for qemu-devel@nongnu.org; Mon, 17 Dec 2018 05:59:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYqSw-0003WK-Ec for qemu-devel@nongnu.org; Mon, 17 Dec 2018 05:49:40 -0500 Received: from mga06.intel.com ([134.134.136.31]:26425) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gYqSw-0003JM-1G; Mon, 17 Dec 2018 05:49:38 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Dec 2018 02:49:37 -0800 Received: from apeskov-mobl.ccr.corp.intel.com (HELO localhost.localdomain) ([10.252.26.185]) by fmsmga001.fm.intel.com with ESMTP; 17 Dec 2018 02:49:33 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,365,1539673200"; d="scan'208";a="130583681" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 17 Dec 2018 11:48:36 +0100 Message-Id: <20181217104838.18957-7-sameo@linux.intel.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181217104838.18957-1-sameo@linux.intel.com> References: <20181217104838.18957-1-sameo@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.31 Subject: [Qemu-devel] [PATCH v4 6/8] hw: arm: Support both legacy and current RSDP build X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Eduardo Habkost , Ben Warren , "Michael S. Tsirkin" , Shannon Zhao , qemu-arm@nongnu.org, Paolo Bonzini , Igor Mammedov , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We add the ability to build legacy or current RSDP tables, based on the AcpiRsdpData revision field passed to build_rsdp(). Although arm/virt only uses RSDP v2, adding that capability to build_rsdp will allow us to share the RSDP build code between ARM and x86. Signed-off-by: Samuel Ortiz Reviewed-by: Igor Mammedov Reviewed-by: Andrew Jones --- hw/arm/virt-acpi-build.c | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 4a6b53fbfc..05f6654371 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -372,6 +372,20 @@ build_rsdp(GArray *tbl, BIOSLinker *linker, AcpiRsdpDa= ta *rsdp_data) { int tbl_off =3D tbl->len; /* Table offset in the RSDP file */ =20 + switch (rsdp_data->revision) { + case 0: + /* With ACPI 1.0, we must have an RSDT pointer */ + g_assert(rsdp_data->rsdt_tbl_offset); + break; + case 2: + /* With ACPI 2.0+, we must have an XSDT pointer */ + g_assert(rsdp_data->xsdt_tbl_offset); + break; + default: + /* Only revisions 0 (ACPI 1.0) and 2 (ACPI 2.0+) are valid for RSD= P */ + g_assert_not_reached(); + } + bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, tbl, 16, true /* fseg memory */); =20 @@ -380,10 +394,29 @@ build_rsdp(GArray *tbl, BIOSLinker *linker, AcpiRsdpD= ata *rsdp_data) g_array_append_vals(tbl, rsdp_data->oem_id, 6); /* OEMID */ build_append_int_noprefix(tbl, rsdp_data->revision, 1); /* Revision */ build_append_int_noprefix(tbl, 0, 4); /* RsdtAddress */ + if (rsdp_data->rsdt_tbl_offset) { + /* RSDT address to be filled by guest linker */ + bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE, + tbl_off + 16, 4, + ACPI_BUILD_TABLE_FILE, + *rsdp_data->rsdt_tbl_offset); + } + + /* Checksum to be filled by guest linker */ + bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, + tbl_off, 20, /* ACPI rev 1.0 RSDP size= */ + 8); + + if (rsdp_data->revision =3D=3D 0) { + /* ACPI 1.0 RSDP, we're done */ + return; + } + build_append_int_noprefix(tbl, 36, 4); /* Length */ =20 /* XSDT address to be filled by guest linker */ build_append_int_noprefix(tbl, 0, 8); /* XsdtAddress */ + /* We already validated our xsdt pointer */ bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE, tbl_off + 24, 8, ACPI_BUILD_TABLE_FILE, @@ -392,11 +425,6 @@ build_rsdp(GArray *tbl, BIOSLinker *linker, AcpiRsdpDa= ta *rsdp_data) build_append_int_noprefix(tbl, 0, 1); /* Extended Checksum */ build_append_int_noprefix(tbl, 0, 3); /* Reserved */ =20 - /* Checksum to be filled by guest linker */ - bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, - tbl_off, 20, /* ACPI rev 1.0 RSDP size= */ - 8); - /* Extended checksum to be filled by Guest linker */ bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, tbl_off, 36, /* ACPI rev 2.0 RSDP size= */ --=20 2.19.2