From nobody Thu Nov 6 18:09:08 2025 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543249978237372.21246710211847; Mon, 26 Nov 2018 08:32:58 -0800 (PST) Received: from localhost ([::1]:37523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJoZ-0001sa-Vp for importer@patchew.org; Mon, 26 Nov 2018 11:32:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJmR-0000m0-GH for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:30:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRJmM-0004Pe-Ma for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:30:39 -0500 Received: from mga14.intel.com ([192.55.52.115]:1713) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRJmK-0004Hm-Rc; Mon, 26 Nov 2018 11:30:34 -0500 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 08:30:24 -0800 Received: from sunandos-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.251.82.176]) by fmsmga008.fm.intel.com with ESMTP; 26 Nov 2018 08:30:19 -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,283,1539673200"; d="scan'208";a="90949793" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 17:29:34 +0100 Message-Id: <20181126162942.21258-2-sameo@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181126162942.21258-1-sameo@linux.intel.com> References: <20181126162942.21258-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: 192.55.52.115 Subject: [Qemu-devel] [PATCH 1/8] hw: acpi: The RSDP build API can return void 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" For both x86 and ARM architectures, the internal RSDP build API can return void as the current return value is unused. Signed-off-by: Samuel Ortiz Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Tested-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/virt-acpi-build.c | 4 +--- hw/i386/acpi-build.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 5785fb697c..fcaa350892 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -367,7 +367,7 @@ static void acpi_dsdt_add_power_button(Aml *scope) } =20 /* RSDP */ -static GArray * +static void build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsigned xsdt_tbl_offse= t) { AcpiRsdpDescriptor *rsdp =3D acpi_data_push(rsdp_table, sizeof *rsdp); @@ -392,8 +392,6 @@ build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsi= gned xsdt_tbl_offset) bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, (char *)rsdp - rsdp_table->data, sizeof *rsdp, (char *)&rsdp->checksum - rsdp_table->data); - - return rsdp_table; } =20 static void diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 236a20eaa8..35f17d0d91 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2547,7 +2547,7 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linke= r) "IVRS", table_data->len - iommu_start, 1, NULL, NULL); } =20 -static GArray * +static void build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsigned rsdt_tbl_offse= t) { AcpiRsdpDescriptor *rsdp =3D acpi_data_push(rsdp_table, sizeof *rsdp); @@ -2569,8 +2569,6 @@ build_rsdp(GArray *rsdp_table, BIOSLinker *linker, un= signed rsdt_tbl_offset) bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, (char *)rsdp - rsdp_table->data, sizeof *rsdp, (char *)&rsdp->checksum - rsdp_table->data); - - return rsdp_table; } =20 typedef --=20 2.19.1 From nobody Thu Nov 6 18:09:08 2025 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 1543249970604767.7831745464251; Mon, 26 Nov 2018 08:32:50 -0800 (PST) Received: from localhost ([::1]:37522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJoW-0001oU-Uo for importer@patchew.org; Mon, 26 Nov 2018 11:32:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJmQ-0000lz-W7 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:30:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRJmM-0004PS-M8 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:30:38 -0500 Received: from mga17.intel.com ([192.55.52.151]:48977) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRJmK-0004Ix-Q1; Mon, 26 Nov 2018 11:30:34 -0500 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 08:30:30 -0800 Received: from sunandos-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.251.82.176]) by fmsmga008.fm.intel.com with ESMTP; 26 Nov 2018 08:30:24 -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,283,1539673200"; d="scan'208";a="90950584" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 17:29:35 +0100 Message-Id: <20181126162942.21258-3-sameo@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181126162942.21258-1-sameo@linux.intel.com> References: <20181126162942.21258-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: 192.55.52.151 Subject: [Qemu-devel] [PATCH 2/8] hw: arm: acpi: Fix incorrect checksums in RSDP 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" , Ard Biesheuvel , 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" From: Igor Mammedov When RSDP table was introduced (d4bec5d87), we calculated only legacy checksum, and that was incorrect as it - specified rev=3D2 and forgot about extended checksum. - legacy checksum calculated on full table instead of the 1st 20 bytes Fix it by adding extended checksum calculation and using correct size for legacy checksum. While at it use explicit constants to specify sub/full tables sizes instead of relying on AcpiRsdpDescriptor size and fields offsets. The follow up commits will convert this table to build_append_int_noprefix(= ) API, will use constants anyway and remove unused AcpiRsdpDescriptor structure. Based on "[PATCH v5 05/24] hw: acpi: Implement XSDT support for RSDP" by Samuel Ortiz, who did it right in his impl. Fixes: d4bec5d87 (hw/arm/virt-acpi-build: Generate RSDP table) Signed-off-by: Igor Mammedov CC: Ard Biesheuvel CC: Shannon Zhao Reviewed-by: Samuel Ortiz --- hw/arm/virt-acpi-build.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index fcaa350892..0835900052 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -390,8 +390,13 @@ build_rsdp(GArray *rsdp_table, BIOSLinker *linker, uns= igned xsdt_tbl_offset) =20 /* Checksum to be filled by Guest linker */ bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, - (char *)rsdp - rsdp_table->data, sizeof *rsdp, + (char *)rsdp - rsdp_table->data, 20 /* ACPI rev 1.0 RSDP size */, (char *)&rsdp->checksum - rsdp_table->data); + + /* Extended checksum to be filled by Guest linker */ + bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, + (char *)rsdp - rsdp_table->data, 36 /* ACPI rev 2.0 RSDP size */, + (char *)&rsdp->extended_checksum - rsdp_table->data); } =20 static void --=20 2.19.1 From nobody Thu Nov 6 18:09:08 2025 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 1543250175151169.94588314175542; Mon, 26 Nov 2018 08:36:15 -0800 (PST) Received: from localhost ([::1]:37545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJrq-0005Hx-2e for importer@patchew.org; Mon, 26 Nov 2018 11:36:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37739) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJmW-0000oo-7q for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:30:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRJmR-0004WD-Dy for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:30:44 -0500 Received: from mga05.intel.com ([192.55.52.43]:31503) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRJmR-0004SW-6I; Mon, 26 Nov 2018 11:30:39 -0500 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 08:30:38 -0800 Received: from sunandos-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.251.82.176]) by fmsmga008.fm.intel.com with ESMTP; 26 Nov 2018 08:30:31 -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,283,1539673200"; d="scan'208";a="90951867" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 17:29:36 +0100 Message-Id: <20181126162942.21258-4-sameo@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181126162942.21258-1-sameo@linux.intel.com> References: <20181126162942.21258-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: 192.55.52.43 Subject: [Qemu-devel] [PATCH 3/8] hw: i386: Use correct RSDT length for checksum 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" From: Igor Mammedov AcpiRsdpDescriptor describes revision 2 RSDP table so using sizeof(*rsdp) for checksum calculation isn't correct since we are adding extra 16 bytes. But acpi_data_push() zeroes out table, so just by luck we are summing up exta zeros which still yelds correct checksum. Fix it up by explicitly stating table size instead of using pointer arithmetics on stucture. PS: Extra 16 bytes are still wasted, but droping them will break migration for machines older than 2.3 due to size mismatch, for 2.3 and older it's not an issue since they are using resizable memory regions (a1666142d) for ACPI blobs. So keep wasting memory to avoid breaking old machines. Fixes: 72c194f7e (i386: ACPI table generation code from seabios) Signed-off-by: Igor Mammedov Reviewed-by: Samuel Ortiz --- hw/i386/acpi-build.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 35f17d0d91..fb877648ac 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2550,6 +2550,11 @@ build_amd_iommu(GArray *table_data, BIOSLinker *link= er) static void build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsigned rsdt_tbl_offse= t) { + /* AcpiRsdpDescriptor describes revision 2 RSDP table and as result we + * allocate extra 16 bytes for pc/q35 RSDP rev1 as well. Keep extra 16= bytes + * wasted to make sure we won't breake migration for machine types old= er + * than 2.3 due to size mismatch. + */ AcpiRsdpDescriptor *rsdp =3D acpi_data_push(rsdp_table, sizeof *rsdp); unsigned rsdt_pa_size =3D sizeof(rsdp->rsdt_physical_address); unsigned rsdt_pa_offset =3D @@ -2567,7 +2572,7 @@ build_rsdp(GArray *rsdp_table, BIOSLinker *linker, un= signed rsdt_tbl_offset) =20 /* Checksum to be filled by Guest linker */ bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, - (char *)rsdp - rsdp_table->data, sizeof *rsdp, + (char *)rsdp - rsdp_table->data, 20 /* ACPI rev 1.0 RSDP size */, (char *)&rsdp->checksum - rsdp_table->data); } =20 --=20 2.19.1 From nobody Thu Nov 6 18:09:08 2025 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543250030630267.71080776696556; Mon, 26 Nov 2018 08:33:50 -0800 (PST) Received: from localhost ([::1]:37525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJpL-0002vw-HG for importer@patchew.org; Mon, 26 Nov 2018 11:33:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJmc-0000uS-4H for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:30:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRJmX-0004YY-Ay for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:30:50 -0500 Received: from mga11.intel.com ([192.55.52.93]:54537) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRJmX-0004YC-1v; Mon, 26 Nov 2018 11:30:45 -0500 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 08:30:44 -0800 Received: from sunandos-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.251.82.176]) by fmsmga008.fm.intel.com with ESMTP; 26 Nov 2018 08:30:38 -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,283,1539673200"; d="scan'208";a="90953223" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 17:29:37 +0100 Message-Id: <20181126162942.21258-5-sameo@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181126162942.21258-1-sameo@linux.intel.com> References: <20181126162942.21258-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: 192.55.52.93 Subject: [Qemu-devel] [PATCH 4/8] hw: arm: Carry RSDP specific data through AcpiRsdpData 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" That will allow us to generalize the ARM build_rsdp() routine to support both legacy RSDP (The current i386 implementation) and extended RSDP (The ARM implementation). Signed-off-by: Samuel Ortiz Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/acpi/acpi-defs.h | 11 +++++++++++ hw/arm/virt-acpi-build.c | 27 ++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index af8e023968..e7fd24c6c5 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -53,6 +53,17 @@ struct AcpiRsdpDescriptor { /* Root System Descri= ptor Pointer */ } QEMU_PACKED; typedef struct AcpiRsdpDescriptor AcpiRsdpDescriptor; =20 +typedef struct AcpiRsdpData { + uint8_t oem_id[6]; /* OEM identification */ + uint8_t revision; /* Must be 0 for 1.0, 2 for 2.0 */ + + unsigned *rsdt_tbl_offset; + unsigned *xsdt_tbl_offset; +} AcpiRsdpData; + +#define ACPI_RSDP_REV_1 0 +#define ACPI_RSDP_REV_2 2 + /* Table structure from Linux kernel (the ACPI tables are under the BSD license) */ =20 diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 0835900052..2dad465ecf 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -368,7 +368,7 @@ static void acpi_dsdt_add_power_button(Aml *scope) =20 /* RSDP */ static void -build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsigned xsdt_tbl_offse= t) +build_rsdp(GArray *rsdp_table, BIOSLinker *linker, AcpiRsdpData *rsdp_data) { AcpiRsdpDescriptor *rsdp =3D acpi_data_push(rsdp_table, sizeof *rsdp); unsigned xsdt_pa_size =3D sizeof(rsdp->xsdt_physical_address); @@ -379,14 +379,14 @@ build_rsdp(GArray *rsdp_table, BIOSLinker *linker, un= signed xsdt_tbl_offset) true /* fseg memory */); =20 memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); - memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id)); + memcpy(rsdp->oem_id, rsdp_data->oem_id, sizeof(rsdp->oem_id)); rsdp->length =3D cpu_to_le32(sizeof(*rsdp)); - rsdp->revision =3D 0x02; + rsdp->revision =3D rsdp_data->revision; =20 /* Address to be filled by Guest linker */ bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE, xsdt_pa_offset, xsdt_pa_size, - ACPI_BUILD_TABLE_FILE, xsdt_tbl_offset); + ACPI_BUILD_TABLE_FILE, *rsdp_data->xsdt_tbl_offset); =20 /* Checksum to be filled by Guest linker */ bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, @@ -399,6 +399,20 @@ build_rsdp(GArray *rsdp_table, BIOSLinker *linker, uns= igned xsdt_tbl_offset) (char *)&rsdp->extended_checksum - rsdp_table->data); } =20 +static void +init_rsdp_data(AcpiRsdpData *data, const char *oem_id, uint8_t revision, + unsigned *rsdt_offset, unsigned *xsdt_offset) +{ + /* Caller must provide an OEM ID */ + g_assert(oem_id); + g_assert(strlen(oem_id) >=3D 6); + + memcpy(data->oem_id, oem_id, 6); + data->revision =3D revision; + data->rsdt_tbl_offset =3D rsdt_offset; + data->xsdt_tbl_offset =3D xsdt_offset; +} + static void build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) { @@ -810,6 +824,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTa= bles *tables) GArray *table_offsets; unsigned dsdt, xsdt; GArray *tables_blob =3D tables->table_data; + AcpiRsdpData rsdp; =20 table_offsets =3D g_array_new(false, true /* clear */, sizeof(uint32_t)); @@ -857,7 +872,9 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTa= bles *tables) build_xsdt(tables_blob, tables->linker, table_offsets, NULL, NULL); =20 /* RSDP is in FSEG memory, so allocate it separately */ - build_rsdp(tables->rsdp, tables->linker, xsdt); + init_rsdp_data(&rsdp, ACPI_BUILD_APPNAME6, ACPI_RSDP_REV_2, + NULL, &xsdt); + build_rsdp(tables->rsdp, tables->linker, &rsdp); =20 /* Cleanup memory that's no longer used. */ g_array_free(table_offsets, true); --=20 2.19.1 From nobody Thu Nov 6 18:09:08 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) 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 1543250349318347.2823685537977; Mon, 26 Nov 2018 08:39:09 -0800 (PST) Received: from localhost ([::1]:37567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJud-0007mU-Ox for importer@patchew.org; Mon, 26 Nov 2018 11:39:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJmc-0000ub-7l for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:30:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRJma-0004Zw-Ff for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:30:50 -0500 Received: from mga11.intel.com ([192.55.52.93]:54537) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRJma-0004YC-7w; Mon, 26 Nov 2018 11:30:48 -0500 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 08:30:47 -0800 Received: from sunandos-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.251.82.176]) by fmsmga008.fm.intel.com with ESMTP; 26 Nov 2018 08:30:44 -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,283,1539673200"; d="scan'208";a="90954243" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 17:29:38 +0100 Message-Id: <20181126162942.21258-6-sameo@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181126162942.21258-1-sameo@linux.intel.com> References: <20181126162942.21258-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: 192.55.52.93 Subject: [Qemu-devel] [PATCH 5/8] hw: arm: Convert the RSDP build to the buid_append_foo() API 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" build_rsdp() is now closely following the ACPI spec instead of filling a mapped and packed C structure. With this change we will eventually be able to get rid of the AcpiRsdpDescriptor structure as we're just appending values to the RSDP file directly and not mapping this structure in memory any more. Signed-off-by: Samuel Ortiz --- include/hw/acpi/acpi-defs.h | 22 ++++++++++++++ hw/arm/virt-acpi-build.c | 60 ++++++++++++++++++++++++------------- 2 files changed, 61 insertions(+), 21 deletions(-) diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index e7fd24c6c5..9b2f6b8043 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -61,9 +61,31 @@ typedef struct AcpiRsdpData { unsigned *xsdt_tbl_offset; } AcpiRsdpData; =20 +/* RSDP signature */ +#define ACPI_RSDP_SIGNATURE "RSD PTR " + +/* RSDP Revisions */ #define ACPI_RSDP_REV_1 0 #define ACPI_RSDP_REV_2 2 =20 +/* RSDP lengths */ +#define ACPI_RSDP_REV_1_LEN 20 +#define ACPI_RSDP_REV_2_LEN 36 +#define ACPI_RSDP_SIG_LEN 8 +#define ACPI_RSDP_OEMID_LEN 6 +#define ACPI_RSDP_REVISION_LEN 1 +#define ACPI_RSDP_LEN_LEN 4 +#define ACPI_RSDP_CHECKSUM_LEN 1 +#define ACPI_RSDP_RESERVED_LEN 3 + +/* RSDP offsets */ +#define ACPI_RSDP_CHECKSUM_OFFSET 8 +#define ACPI_RSDP_REVISION_OFFSET 15 +#define ACPI_RSDP_RSDT_OFFSET 16 +#define ACPI_RSDP_XSDT_OFFSET 24 +#define ACPI_RSDP_EXT_CHECKSUM_OFFSET 32 + + /* Table structure from Linux kernel (the ACPI tables are under the BSD license) */ =20 diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 2dad465ecf..d47978a55e 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -368,35 +368,53 @@ static void acpi_dsdt_add_power_button(Aml *scope) =20 /* RSDP */ static void -build_rsdp(GArray *rsdp_table, BIOSLinker *linker, AcpiRsdpData *rsdp_data) +build_rsdp(GArray *tbl, BIOSLinker *linker, AcpiRsdpData *rsdp_data) { - AcpiRsdpDescriptor *rsdp =3D acpi_data_push(rsdp_table, sizeof *rsdp); - unsigned xsdt_pa_size =3D sizeof(rsdp->xsdt_physical_address); - unsigned xsdt_pa_offset =3D - (char *)&rsdp->xsdt_physical_address - rsdp_table->data; - - bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, rsdp_table, 16, + bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, tbl, 16, true /* fseg memory */); =20 - memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); - memcpy(rsdp->oem_id, rsdp_data->oem_id, sizeof(rsdp->oem_id)); - rsdp->length =3D cpu_to_le32(sizeof(*rsdp)); - rsdp->revision =3D rsdp_data->revision; + /* RSDP signature */ + g_array_append_vals(tbl, ACPI_RSDP_SIGNATURE, ACPI_RSDP_SIG_LEN); + + /* Space for the checksum */ + build_append_int_noprefix(tbl, 0, ACPI_RSDP_CHECKSUM_LEN); + + /* OEM ID */ + g_array_append_vals(tbl, rsdp_data->oem_id, ACPI_RSDP_OEMID_LEN); + + /* Revision */ + build_append_int_noprefix(tbl, rsdp_data->revision, + ACPI_RSDP_REVISION_LEN); =20 - /* Address to be filled by Guest linker */ + /* Space for the RSDT address (32 bit) */ + build_append_int_noprefix(tbl, 0, 4); + + /* Length */ + build_append_int_noprefix(tbl, ACPI_RSDP_REV_2_LEN, ACPI_RSDP_LEN_LEN); + + /* XSDT address to be filled by guest linker */ + build_append_int_noprefix(tbl, 0, 8); /* XSDT address (64 bit) */ bios_linker_loader_add_pointer(linker, - ACPI_BUILD_RSDP_FILE, xsdt_pa_offset, xsdt_pa_size, - ACPI_BUILD_TABLE_FILE, *rsdp_data->xsdt_tbl_offset); + ACPI_BUILD_RSDP_FILE, + ACPI_RSDP_XSDT_OFFSET, 8, + ACPI_BUILD_TABLE_FILE, + *rsdp_data->xsdt_tbl_offset); + + /* Space for the extended checksum */ + build_append_int_noprefix(tbl, 0, ACPI_RSDP_CHECKSUM_LEN); + + /* Space for the reserved bytes */ + build_append_int_noprefix(tbl, 0, ACPI_RSDP_RESERVED_LEN); =20 - /* Checksum to be filled by Guest linker */ - bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, - (char *)rsdp - rsdp_table->data, 20 /* ACPI rev 1.0 RSDP size */, - (char *)&rsdp->checksum - rsdp_table->data); + /* Checksum to be filled by guest linker */ + bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, 0, + ACPI_RSDP_REV_1_LEN, + ACPI_RSDP_CHECKSUM_OFFSET); =20 /* Extended checksum to be filled by Guest linker */ - bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, - (char *)rsdp - rsdp_table->data, 36 /* ACPI rev 2.0 RSDP size */, - (char *)&rsdp->extended_checksum - rsdp_table->data); + bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, 0, + ACPI_RSDP_REV_2_LEN, + ACPI_RSDP_EXT_CHECKSUM_OFFSET); } =20 static void --=20 2.19.1 From nobody Thu Nov 6 18:09:08 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) 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 1543250471898101.7166454998096; Mon, 26 Nov 2018 08:41:11 -0800 (PST) Received: from localhost ([::1]:37581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJwc-0001NE-OE for importer@patchew.org; Mon, 26 Nov 2018 11:41:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJmk-000128-ED for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:31:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRJme-0004bO-P2 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:30:58 -0500 Received: from mga11.intel.com ([192.55.52.93]:54537) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRJme-0004YC-GC; Mon, 26 Nov 2018 11:30:52 -0500 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 08:30:52 -0800 Received: from sunandos-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.251.82.176]) by fmsmga008.fm.intel.com with ESMTP; 26 Nov 2018 08:30:48 -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,283,1539673200"; d="scan'208";a="90954788" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 17:29:39 +0100 Message-Id: <20181126162942.21258-7-sameo@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181126162942.21258-1-sameo@linux.intel.com> References: <20181126162942.21258-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: 192.55.52.93 Subject: [Qemu-devel] [PATCH 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 --- hw/arm/virt-acpi-build.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index d47978a55e..10f8388b63 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -389,6 +389,27 @@ build_rsdp(GArray *tbl, BIOSLinker *linker, AcpiRsdpDa= ta *rsdp_data) /* Space for the RSDT address (32 bit) */ build_append_int_noprefix(tbl, 0, 4); =20 + if (rsdp_data->rsdt_tbl_offset) { + /* RSDT address to be filled by guest linker */ + bios_linker_loader_add_pointer(linker, + ACPI_BUILD_RSDP_FILE, 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, 0, + ACPI_RSDP_REV_1_LEN, + ACPI_RSDP_CHECKSUM_OFFSET); + + if (rsdp_data->revision =3D=3D ACPI_RSDP_REV_1) { + /* Legacy RSDP, we're done */ + return; + } + + /* The RSDP revision is 2 and later, we must have an XSDT pointer */ + g_assert(rsdp_data->xsdt_tbl_offset !=3D NULL); + /* Length */ build_append_int_noprefix(tbl, ACPI_RSDP_REV_2_LEN, ACPI_RSDP_LEN_LEN); =20 @@ -406,11 +427,6 @@ build_rsdp(GArray *tbl, BIOSLinker *linker, AcpiRsdpDa= ta *rsdp_data) /* Space for the reserved bytes */ build_append_int_noprefix(tbl, 0, ACPI_RSDP_RESERVED_LEN); =20 - /* Checksum to be filled by guest linker */ - bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, 0, - ACPI_RSDP_REV_1_LEN, - ACPI_RSDP_CHECKSUM_OFFSET); - /* Extended checksum to be filled by Guest linker */ bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, 0, ACPI_RSDP_REV_2_LEN, --=20 2.19.1 From nobody Thu Nov 6 18:09:08 2025 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 154325021373886.01760696277859; Mon, 26 Nov 2018 08:36:53 -0800 (PST) Received: from localhost ([::1]:37546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJsS-0005k6-K5 for importer@patchew.org; Mon, 26 Nov 2018 11:36:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJmm-00014E-SC for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:31:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRJmj-0004cn-6f for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:31:00 -0500 Received: from mga11.intel.com ([192.55.52.93]:54537) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRJmi-0004YC-SS; Mon, 26 Nov 2018 11:30:57 -0500 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 08:30:56 -0800 Received: from sunandos-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.251.82.176]) by fmsmga008.fm.intel.com with ESMTP; 26 Nov 2018 08:30:52 -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,283,1539673200"; d="scan'208";a="90955517" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 17:29:40 +0100 Message-Id: <20181126162942.21258-8-sameo@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181126162942.21258-1-sameo@linux.intel.com> References: <20181126162942.21258-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: 192.55.52.93 Subject: [Qemu-devel] [PATCH 7/8] hw: acpi: Export and share the ARM 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" Now that build_rsdp() supports building both legacy and current RSDP tables, we can move it to a generic folder (hw/acpi) and have the i386 ACPI code reuse it in order to reduce code duplication. Signed-off-by: Samuel Ortiz Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/acpi/aml-build.h | 5 +++ hw/acpi/aml-build.c | 81 +++++++++++++++++++++++++++++++++++++ hw/arm/virt-acpi-build.c | 81 ------------------------------------- hw/i386/acpi-build.c | 34 ++-------------- 4 files changed, 90 insertions(+), 111 deletions(-) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 6c36903c0a..1bbe496e32 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -388,6 +388,11 @@ void acpi_add_table(GArray *table_offsets, GArray *tab= le_data); void acpi_build_tables_init(AcpiBuildTables *tables); void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre); void +build_rsdp(GArray *tbl, BIOSLinker *linker, AcpiRsdpData *rsdp_data); +void +init_rsdp_data(AcpiRsdpData *data, const char *oem_id, uint8_t revision, + unsigned *rsdt_offset, unsigned *xsdt_offset); +void build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets, const char *oem_id, const char *oem_table_id); void diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 1e43cd736d..d4e15980f1 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1589,6 +1589,87 @@ void acpi_build_tables_cleanup(AcpiBuildTables *tabl= es, bool mfre) g_array_free(tables->vmgenid, mfre); } =20 +/* RSDP */ +void +build_rsdp(GArray *tbl, BIOSLinker *linker, AcpiRsdpData *rsdp_data) +{ + bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, tbl, 16, + true /* fseg memory */); + + /* RSDP signature */ + g_array_append_vals(tbl, ACPI_RSDP_SIGNATURE, ACPI_RSDP_SIG_LEN); + + /* Space for the checksum */ + build_append_int_noprefix(tbl, 0, ACPI_RSDP_CHECKSUM_LEN); + + /* OEM ID */ + g_array_append_vals(tbl, rsdp_data->oem_id, ACPI_RSDP_OEMID_LEN); + + /* Revision */ + build_append_int_noprefix(tbl, rsdp_data->revision, + ACPI_RSDP_REVISION_LEN); + + /* Space for the RSDT address (32 bit) */ + build_append_int_noprefix(tbl, 0, 4); + + if (rsdp_data->rsdt_tbl_offset) { + /* RSDT address to be filled by guest linker */ + bios_linker_loader_add_pointer(linker, + ACPI_BUILD_RSDP_FILE, 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, 0, + ACPI_RSDP_REV_1_LEN, + ACPI_RSDP_CHECKSUM_OFFSET); + + if (rsdp_data->revision =3D=3D ACPI_RSDP_REV_1) { + /* Legacy RSDP, we're done */ + return; + } + + /* The RSDP revision is 2 and later, we must have an XSDT pointer */ + g_assert(rsdp_data->xsdt_tbl_offset !=3D NULL); + + /* Length */ + build_append_int_noprefix(tbl, ACPI_RSDP_REV_2_LEN, ACPI_RSDP_LEN_LEN); + + /* XSDT address to be filled by guest linker */ + build_append_int_noprefix(tbl, 0, 8); /* XSDT address (64 bit) */ + bios_linker_loader_add_pointer(linker, + ACPI_BUILD_RSDP_FILE, + ACPI_RSDP_XSDT_OFFSET, 8, + ACPI_BUILD_TABLE_FILE, + *rsdp_data->xsdt_tbl_offset); + + /* Space for the extended checksum */ + build_append_int_noprefix(tbl, 0, ACPI_RSDP_CHECKSUM_LEN); + + /* Space for the reserved bytes */ + build_append_int_noprefix(tbl, 0, ACPI_RSDP_RESERVED_LEN); + + /* Extended checksum to be filled by Guest linker */ + bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, 0, + ACPI_RSDP_REV_2_LEN, + ACPI_RSDP_EXT_CHECKSUM_OFFSET); +} + +void +init_rsdp_data(AcpiRsdpData *data, const char *oem_id, uint8_t revision, + unsigned *rsdt_offset, unsigned *xsdt_offset) +{ + /* Caller must provide an OEM ID */ + g_assert(oem_id); + g_assert(strlen(oem_id) >=3D 6); + + memcpy(data->oem_id, oem_id, 6); + data->revision =3D revision; + data->rsdt_tbl_offset =3D rsdt_offset; + data->xsdt_tbl_offset =3D xsdt_offset; +} + /* Build rsdt table */ void build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets, diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 10f8388b63..3fe86fd33e 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -366,87 +366,6 @@ static void acpi_dsdt_add_power_button(Aml *scope) aml_append(scope, dev); } =20 -/* RSDP */ -static void -build_rsdp(GArray *tbl, BIOSLinker *linker, AcpiRsdpData *rsdp_data) -{ - bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, tbl, 16, - true /* fseg memory */); - - /* RSDP signature */ - g_array_append_vals(tbl, ACPI_RSDP_SIGNATURE, ACPI_RSDP_SIG_LEN); - - /* Space for the checksum */ - build_append_int_noprefix(tbl, 0, ACPI_RSDP_CHECKSUM_LEN); - - /* OEM ID */ - g_array_append_vals(tbl, rsdp_data->oem_id, ACPI_RSDP_OEMID_LEN); - - /* Revision */ - build_append_int_noprefix(tbl, rsdp_data->revision, - ACPI_RSDP_REVISION_LEN); - - /* Space for the RSDT address (32 bit) */ - build_append_int_noprefix(tbl, 0, 4); - - if (rsdp_data->rsdt_tbl_offset) { - /* RSDT address to be filled by guest linker */ - bios_linker_loader_add_pointer(linker, - ACPI_BUILD_RSDP_FILE, 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, 0, - ACPI_RSDP_REV_1_LEN, - ACPI_RSDP_CHECKSUM_OFFSET); - - if (rsdp_data->revision =3D=3D ACPI_RSDP_REV_1) { - /* Legacy RSDP, we're done */ - return; - } - - /* The RSDP revision is 2 and later, we must have an XSDT pointer */ - g_assert(rsdp_data->xsdt_tbl_offset !=3D NULL); - - /* Length */ - build_append_int_noprefix(tbl, ACPI_RSDP_REV_2_LEN, ACPI_RSDP_LEN_LEN); - - /* XSDT address to be filled by guest linker */ - build_append_int_noprefix(tbl, 0, 8); /* XSDT address (64 bit) */ - bios_linker_loader_add_pointer(linker, - ACPI_BUILD_RSDP_FILE, - ACPI_RSDP_XSDT_OFFSET, 8, - ACPI_BUILD_TABLE_FILE, - *rsdp_data->xsdt_tbl_offset); - - /* Space for the extended checksum */ - build_append_int_noprefix(tbl, 0, ACPI_RSDP_CHECKSUM_LEN); - - /* Space for the reserved bytes */ - build_append_int_noprefix(tbl, 0, ACPI_RSDP_RESERVED_LEN); - - /* Extended checksum to be filled by Guest linker */ - bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, 0, - ACPI_RSDP_REV_2_LEN, - ACPI_RSDP_EXT_CHECKSUM_OFFSET); -} - -static void -init_rsdp_data(AcpiRsdpData *data, const char *oem_id, uint8_t revision, - unsigned *rsdt_offset, unsigned *xsdt_offset) -{ - /* Caller must provide an OEM ID */ - g_assert(oem_id); - g_assert(strlen(oem_id) >=3D 6); - - memcpy(data->oem_id, oem_id, 6); - data->revision =3D revision; - data->rsdt_tbl_offset =3D rsdt_offset; - data->xsdt_tbl_offset =3D xsdt_offset; -} - static void build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) { diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index fb877648ac..f7ab112599 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2547,35 +2547,6 @@ build_amd_iommu(GArray *table_data, BIOSLinker *link= er) "IVRS", table_data->len - iommu_start, 1, NULL, NULL); } =20 -static void -build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsigned rsdt_tbl_offse= t) -{ - /* AcpiRsdpDescriptor describes revision 2 RSDP table and as result we - * allocate extra 16 bytes for pc/q35 RSDP rev1 as well. Keep extra 16= bytes - * wasted to make sure we won't breake migration for machine types old= er - * than 2.3 due to size mismatch. - */ - AcpiRsdpDescriptor *rsdp =3D acpi_data_push(rsdp_table, sizeof *rsdp); - unsigned rsdt_pa_size =3D sizeof(rsdp->rsdt_physical_address); - unsigned rsdt_pa_offset =3D - (char *)&rsdp->rsdt_physical_address - rsdp_table->data; - - bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, rsdp_table, 16, - true /* fseg memory */); - - memcpy(&rsdp->signature, "RSD PTR ", 8); - memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, 6); - /* Address to be filled by Guest linker */ - bios_linker_loader_add_pointer(linker, - ACPI_BUILD_RSDP_FILE, rsdt_pa_offset, rsdt_pa_size, - ACPI_BUILD_TABLE_FILE, rsdt_tbl_offset); - - /* Checksum to be filled by Guest linker */ - bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, - (char *)rsdp - rsdp_table->data, 20 /* ACPI rev 1.0 RSDP size */, - (char *)&rsdp->checksum - rsdp_table->data); -} - typedef struct AcpiBuildState { /* Copy of table in RAM (for patching). */ @@ -2625,6 +2596,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) GArray *tables_blob =3D tables->table_data; AcpiSlicOem slic_oem =3D { .id =3D NULL, .table_id =3D NULL }; Object *vmgenid_dev; + AcpiRsdpData rsdp; =20 acpi_get_pm_info(&pm); acpi_get_misc_info(&misc); @@ -2732,7 +2704,9 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) slic_oem.id, slic_oem.table_id); =20 /* RSDP is in FSEG memory, so allocate it separately */ - build_rsdp(tables->rsdp, tables->linker, rsdt); + init_rsdp_data(&rsdp, ACPI_BUILD_APPNAME6, ACPI_RSDP_REV_1, + &rsdt, NULL); + build_rsdp(tables->rsdp, tables->linker, &rsdp); =20 /* We'll expose it all to Guest so we want to reduce * chance of size changes. --=20 2.19.1 From nobody Thu Nov 6 18:09:08 2025 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 1543250246143469.8423048866573; Mon, 26 Nov 2018 08:37:26 -0800 (PST) Received: from localhost ([::1]:37547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJsy-000676-T0 for importer@patchew.org; Mon, 26 Nov 2018 11:37:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRJmu-00019l-30 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:31:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRJmn-0004fe-Uj for qemu-devel@nongnu.org; Mon, 26 Nov 2018 11:31:08 -0500 Received: from mga11.intel.com ([192.55.52.93]:54537) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gRJmn-0004YC-Kn; Mon, 26 Nov 2018 11:31:01 -0500 Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 08:31:01 -0800 Received: from sunandos-mobl2.ger.corp.intel.com (HELO localhost.localdomain) ([10.251.82.176]) by fmsmga008.fm.intel.com with ESMTP; 26 Nov 2018 08:30:56 -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,283,1539673200"; d="scan'208";a="90956310" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 17:29:41 +0100 Message-Id: <20181126162942.21258-9-sameo@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181126162942.21258-1-sameo@linux.intel.com> References: <20181126162942.21258-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: 192.55.52.93 Subject: [Qemu-devel] [PATCH 8/8] hw: acpi: Remove AcpiRsdpDescriptor and fix tests 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 switched to the build_append_*() API for all RSDP callers, and this patch converts all existing tests depending on this structure. It is no longer needed and we can thus remove it. Signed-off-by: Samuel Ortiz --- include/hw/acpi/acpi-defs.h | 13 ---------- tests/acpi-utils.h | 5 +++- tests/acpi-utils.c | 48 ++++++++++++++++++++++++++++++------- tests/bios-tables-test.c | 27 ++++++++++++++------- tests/vmgenid-test.c | 8 ++++--- 5 files changed, 67 insertions(+), 34 deletions(-) diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index 9b2f6b8043..abef1d57ae 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -40,19 +40,6 @@ enum { ACPI_FADT_F_LOW_POWER_S0_IDLE_CAPABLE, }; =20 -struct AcpiRsdpDescriptor { /* Root System Descriptor Pointer */ - uint64_t signature; /* ACPI signature, contains "RSD PTR = " */ - uint8_t checksum; /* To make sum of struct =3D=3D 0 */ - uint8_t oem_id [6]; /* OEM identification */ - uint8_t revision; /* Must be 0 for 1.0, 2 for 2.0 */ - uint32_t rsdt_physical_address; /* 32-bit physical address of RSDT */ - uint32_t length; /* XSDT Length in bytes including hdr= */ - uint64_t xsdt_physical_address; /* 64-bit physical address of XSDT */ - uint8_t extended_checksum; /* Checksum of entire table */ - uint8_t reserved [3]; /* Reserved field must be 0 */ -} QEMU_PACKED; -typedef struct AcpiRsdpDescriptor AcpiRsdpDescriptor; - typedef struct AcpiRsdpData { uint8_t oem_id[6]; /* OEM identification */ uint8_t revision; /* Must be 0 for 1.0, 2 for 2.0 */ diff --git a/tests/acpi-utils.h b/tests/acpi-utils.h index ac52abd0dd..fb1a67a21f 100644 --- a/tests/acpi-utils.h +++ b/tests/acpi-utils.h @@ -82,6 +82,9 @@ typedef struct { =20 uint8_t acpi_calc_checksum(const uint8_t *data, int len); uint32_t acpi_find_rsdp_address(void); -void acpi_parse_rsdp_table(uint32_t addr, AcpiRsdpDescriptor *rsdp_table); +uint32_t acpi_find_rsdt_address(uint8_t *rsdp_table); +uint64_t acpi_find_xsdt_address(uint8_t *rsdp_table); +void acpi_parse_rsdp_table(uint32_t addr, uint8_t *rsdp_table, + uint8_t revision); =20 #endif /* TEST_ACPI_UTILS_H */ diff --git a/tests/acpi-utils.c b/tests/acpi-utils.c index 41dc1ea9b4..c8fe2d1342 100644 --- a/tests/acpi-utils.c +++ b/tests/acpi-utils.c @@ -52,14 +52,44 @@ uint32_t acpi_find_rsdp_address(void) return off; } =20 -void acpi_parse_rsdp_table(uint32_t addr, AcpiRsdpDescriptor *rsdp_table) +uint32_t acpi_find_rsdt_address(uint8_t *rsdp_table) { - ACPI_READ_FIELD(rsdp_table->signature, addr); - ACPI_ASSERT_CMP64(rsdp_table->signature, "RSD PTR "); - - ACPI_READ_FIELD(rsdp_table->checksum, addr); - ACPI_READ_ARRAY(rsdp_table->oem_id, addr); - ACPI_READ_FIELD(rsdp_table->revision, addr); - ACPI_READ_FIELD(rsdp_table->rsdt_physical_address, addr); - ACPI_READ_FIELD(rsdp_table->length, addr); + uint32_t rsdt_physical_address =3D *((uint32_t *)(rsdp_table + + ACPI_RSDP_RSDT_OFFSET)= ); + uint8_t revision =3D rsdp_table[ACPI_RSDP_REVISION_OFFSET]; + + if (revision !=3D ACPI_RSDP_REV_1) { + return 0; + } + + return le32_to_cpu(rsdt_physical_address); +} + +uint64_t acpi_find_xsdt_address(uint8_t *rsdp_table) +{ + uint64_t xsdt_physical_address =3D *((uint64_t *)(rsdp_table + + ACPI_RSDP_XSDT_OFFSET)= ); + uint8_t revision =3D rsdp_table[ACPI_RSDP_REVISION_OFFSET]; + + if (revision !=3D ACPI_RSDP_REV_2) { + return 0; + } + + return le64_to_cpu(xsdt_physical_address); +} + +void acpi_parse_rsdp_table(uint32_t addr, uint8_t *rsdp_table, uint8_t rev= ision) +{ + switch (revision) { + case ACPI_RSDP_REV_1: + memread(addr, rsdp_table, ACPI_RSDP_REV_1_LEN); + break; + case ACPI_RSDP_REV_2: + memread(addr, rsdp_table, ACPI_RSDP_REV_2_LEN); + break; + default: + g_assert_not_reached(); + } + + ACPI_ASSERT_CMP64(*((uint64_t *)(rsdp_table)), ACPI_RSDP_SIGNATURE); } diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index d661d9be62..8cde404bda 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -27,7 +27,8 @@ typedef struct { const char *machine; const char *variant; uint32_t rsdp_addr; - AcpiRsdpDescriptor rsdp_table; + uint8_t rsdp_table[ACPI_RSDP_REV_2_LEN]; + uint32_t rsdt_physical_address; AcpiRsdtDescriptorRev1 rsdt_table; uint32_t dsdt_addr; uint32_t facs_addr; @@ -83,21 +84,31 @@ static void test_acpi_rsdp_address(test_data *data) data->rsdp_addr =3D off; } =20 -static void test_acpi_rsdp_table(test_data *data) +static void test_acpi_rsdp_table(test_data *data, uint8_t revision) { - AcpiRsdpDescriptor *rsdp_table =3D &data->rsdp_table; + uint8_t *rsdp_table =3D data->rsdp_table; uint32_t addr =3D data->rsdp_addr; =20 - acpi_parse_rsdp_table(addr, rsdp_table); + acpi_parse_rsdp_table(addr, rsdp_table, revision); =20 - /* rsdp checksum is not for the whole table, but for the first 20 byte= s */ - g_assert(!acpi_calc_checksum((uint8_t *)rsdp_table, 20)); + switch (revision) { + case ACPI_RSDP_REV_1: + /* With rev 1, checksum is only for the first 20 bytes */ + g_assert(!acpi_calc_checksum(rsdp_table, ACPI_RSDP_REV_1_LEN)); + break; + case ACPI_RSDP_REV_2: + /* With revision 2, we have 2 checksums */ + g_assert(!acpi_calc_checksum(rsdp_table, ACPI_RSDP_REV_1_LEN)); + g_assert(!acpi_calc_checksum(rsdp_table, ACPI_RSDP_REV_2_LEN)); + default: + g_assert_not_reached(); + } } =20 static void test_acpi_rsdt_table(test_data *data) { AcpiRsdtDescriptorRev1 *rsdt_table =3D &data->rsdt_table; - uint32_t addr =3D le32_to_cpu(data->rsdp_table.rsdt_physical_address); + uint32_t addr =3D acpi_find_rsdt_address(data->rsdp_table); uint32_t *tables; int tables_nr; uint8_t checksum; @@ -626,7 +637,7 @@ static void test_acpi_one(const char *params, test_data= *data) =20 data->tables =3D g_array_new(false, true, sizeof(AcpiSdtTable)); test_acpi_rsdp_address(data); - test_acpi_rsdp_table(data); + test_acpi_rsdp_table(data, ACPI_RSDP_REV_1); test_acpi_rsdt_table(data); fadt_fetch_facs_and_dsdt_ptrs(data); test_acpi_facs_table(data); diff --git a/tests/vmgenid-test.c b/tests/vmgenid-test.c index 0a6fb55f2e..db5b084c18 100644 --- a/tests/vmgenid-test.c +++ b/tests/vmgenid-test.c @@ -35,7 +35,7 @@ static uint32_t acpi_find_vgia(void) { uint32_t rsdp_offset; uint32_t guid_offset =3D 0; - AcpiRsdpDescriptor rsdp_table; + uint8_t rsdp_table[ACPI_RSDP_REV_2_LEN]; uint32_t rsdt, rsdt_table_length; AcpiRsdtDescriptorRev1 rsdt_table; size_t tables_nr; @@ -52,9 +52,11 @@ static uint32_t acpi_find_vgia(void) =20 g_assert_cmphex(rsdp_offset, <, RSDP_ADDR_INVALID); =20 - acpi_parse_rsdp_table(rsdp_offset, &rsdp_table); + acpi_parse_rsdp_table(rsdp_offset, rsdp_table, ACPI_RSDP_REV_1); + + rsdt =3D acpi_find_rsdt_address(rsdp_table); + g_assert(rsdt); =20 - rsdt =3D le32_to_cpu(rsdp_table.rsdt_physical_address); /* read the header */ ACPI_READ_TABLE_HEADER(&rsdt_table, rsdt); ACPI_ASSERT_CMP(rsdt_table.signature, "RSDT"); --=20 2.19.1