From nobody Thu Nov 6 12:10:24 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 1540833467115622.3195134184552; Mon, 29 Oct 2018 10:17:47 -0700 (PDT) Received: from localhost ([::1]:47296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHBAb-0006w0-Vt for importer@patchew.org; Mon, 29 Oct 2018 13:17:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHAxA-0002CJ-CG for qemu-devel@nongnu.org; Mon, 29 Oct 2018 13:03:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHAx6-0004l6-KT for qemu-devel@nongnu.org; Mon, 29 Oct 2018 13:03:48 -0400 Received: from mga06.intel.com ([134.134.136.31]:16083) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gHAx6-0004bA-6a for qemu-devel@nongnu.org; Mon, 29 Oct 2018 13:03:44 -0400 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Oct 2018 10:03:25 -0700 Received: from mjadwisz-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.252.7.64]) by fmsmga006.fm.intel.com with ESMTP; 29 Oct 2018 10:03:22 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,441,1534834800"; d="scan'208";a="276598967" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 29 Oct 2018 18:01:50 +0100 Message-Id: <20181029170159.3801-11-sameo@linux.intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181029170159.3801-1-sameo@linux.intel.com> References: <20181029170159.3801-1-sameo@linux.intel.com> 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 v3 10/19] hw: acpi: Export the MCFG getter 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: Yang Zhong , Eduardo Habkost , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Yang Zhong The ACPI MCFG getter is not x86 specific and could be called from anywhere within generic ACPI API, so let's export it. Signed-off-by: Yang Zhong --- hw/acpi/aml-build.c | 24 ++++++++++++++++++++++++ hw/i386/acpi-build.c | 22 ---------------------- include/hw/acpi/aml-build.h | 1 + 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index aa72b5459c..2110e18799 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -32,6 +32,8 @@ #include "hw/i386/pc.h" #include "sysemu/tpm.h" #include "hw/acpi/tpm.h" +#include "qom/qom-qobject.h" +#include "qapi/qmp/qnum.h" =20 #define PCI_HOST_BRIDGE_CONFIG_ADDR 0xcf8 #define PCI_HOST_BRIDGE_IO_0_MIN_ADDR 0x0000 @@ -1665,6 +1667,28 @@ void acpi_get_pci_holes(Range *hole, Range *hole64) NULL)); } =20 +bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) +{ + Object *pci_host; + QObject *o; + + pci_host =3D acpi_get_pci_host(); + g_assert(pci_host); + + o =3D object_property_get_qobject(pci_host, PCIE_HOST_MCFG_BASE, NULL); + if (!o) { + return false; + } + mcfg->mcfg_base =3D qnum_get_uint(qobject_to(QNum, o)); + qobject_unref(o); + + o =3D object_property_get_qobject(pci_host, PCIE_HOST_MCFG_SIZE, NULL); + assert(o); + mcfg->mcfg_size =3D qnum_get_uint(qobject_to(QNum, o)); + qobject_unref(o); + return true; +} + static void crs_range_insert(GPtrArray *ranges, uint64_t base, uint64_t li= mit) { CrsRangeEntry *entry; diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 12a8d8210a..414a6c4c4e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1857,28 +1857,6 @@ build_amd_iommu(GArray *table_data, BIOSLinker *link= er) "IVRS", table_data->len - iommu_start, 1, NULL, NULL); } =20 -static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) -{ - Object *pci_host; - QObject *o; - - pci_host =3D acpi_get_pci_host(); - g_assert(pci_host); - - o =3D object_property_get_qobject(pci_host, PCIE_HOST_MCFG_BASE, NULL); - if (!o) { - return false; - } - mcfg->mcfg_base =3D qnum_get_uint(qobject_to(QNum, o)); - qobject_unref(o); - - o =3D object_property_get_qobject(pci_host, PCIE_HOST_MCFG_SIZE, NULL); - assert(o); - mcfg->mcfg_size =3D qnum_get_uint(qobject_to(QNum, o)); - qobject_unref(o); - return true; -} - static void acpi_build(AcpiBuildTables *tables, MachineState *machine, AcpiConfiguration *conf) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index cdd290dd70..1fabf58df2 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -409,6 +409,7 @@ void *acpi_data_push(GArray *table_data, unsigned size); unsigned acpi_data_len(GArray *table); Object *acpi_get_pci_host(void); void acpi_get_pci_holes(Range *hole, Range *hole64); +bool acpi_get_mcfg(AcpiMcfgInfo *mcfg); void acpi_align_size(GArray *blob, unsigned align); void acpi_add_table(GArray *table_offsets, GArray *table_data); void acpi_build_tables_init(AcpiBuildTables *tables); --=20 2.17.2