From nobody Thu Nov 6 14:32:32 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 1541382296349141.71253968160113; Sun, 4 Nov 2018 17:44:56 -0800 (PST) Received: from localhost ([::1]:60856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJTwl-0001Jg-2U for importer@patchew.org; Sun, 04 Nov 2018 20:44:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gJTuf-0007Lp-Ab for qemu-devel@nongnu.org; Sun, 04 Nov 2018 20:42:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gJTua-0002kY-Ci for qemu-devel@nongnu.org; Sun, 04 Nov 2018 20:42:45 -0500 Received: from mga04.intel.com ([192.55.52.120]:9699) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gJTuW-0002YD-9u; Sun, 04 Nov 2018 20:42:37 -0500 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Nov 2018 17:42:30 -0800 Received: from emurphy1-mobl1.ger.corp.intel.com (HELO localhost.localdomain) ([10.252.26.250]) by fmsmga005.fm.intel.com with ESMTP; 04 Nov 2018 17:42:25 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,466,1534834800"; d="scan'208";a="277074352" From: Samuel Ortiz To: qemu-devel@nongnu.org Date: Mon, 5 Nov 2018 02:40:33 +0100 Message-Id: <20181105014047.26447-11-sameo@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181105014047.26447-1-sameo@linux.intel.com> References: <20181105014047.26447-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.120 Subject: [Qemu-devel] [PATCH v5 10/24] hw: acpi: Export the PCI host and holes getters 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: Peter Maydell , Stefano Stabellini , Eduardo Habkost , "Michael S. Tsirkin" , Shannon Zhao , Igor Mammedov , qemu-arm@nongnu.org, Paolo Bonzini , Anthony Perard , xen-devel@lists.xenproject.org, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This is going to be needed by the hardware reduced implementation, so let's export it. Once the ACPI builder methods and getters will be implemented, the acpi_get_pci_host() implementation will become hardware agnostic. Signed-off-by: Samuel Ortiz --- include/hw/acpi/aml-build.h | 2 ++ hw/acpi/aml-build.c | 43 +++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 47 ++----------------------------------- 3 files changed, 47 insertions(+), 45 deletions(-) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index c27c0935ae..fde2785b9a 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -400,6 +400,8 @@ build_header(BIOSLinker *linker, GArray *table_data, const char *oem_id, const char *oem_table_id); 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); /* Align AML blob size to a multiple of 'align' */ void acpi_align_size(GArray *blob, unsigned align); void acpi_add_table(GArray *table_offsets, GArray *table_data); diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 2b9a636e75..b8e32f15f7 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1601,6 +1601,49 @@ void acpi_build_tables_cleanup(AcpiBuildTables *tabl= es, bool mfre) g_array_free(tables->vmgenid, mfre); } =20 +/* + * Because of the PXB hosts we cannot simply query TYPE_PCI_HOST_BRIDGE. + */ +Object *acpi_get_pci_host(void) +{ + PCIHostState *host; + + host =3D OBJECT_CHECK(PCIHostState, + object_resolve_path("/machine/i440fx", NULL), + TYPE_PCI_HOST_BRIDGE); + if (!host) { + host =3D OBJECT_CHECK(PCIHostState, + object_resolve_path("/machine/q35", NULL), + TYPE_PCI_HOST_BRIDGE); + } + + return OBJECT(host); +} + + +void acpi_get_pci_holes(Range *hole, Range *hole64) +{ + Object *pci_host; + + pci_host =3D acpi_get_pci_host(); + g_assert(pci_host); + + range_set_bounds1(hole, + object_property_get_uint(pci_host, + PCI_HOST_PROP_PCI_HOLE_STAR= T, + NULL), + object_property_get_uint(pci_host, + PCI_HOST_PROP_PCI_HOLE_END, + NULL)); + range_set_bounds1(hole64, + object_property_get_uint(pci_host, + PCI_HOST_PROP_PCI_HOLE64_ST= ART, + NULL), + object_property_get_uint(pci_host, + PCI_HOST_PROP_PCI_HOLE64_EN= D, + NULL)); +} + 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 bd147a6bd2..a5f5f83500 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -232,49 +232,6 @@ static void acpi_get_misc_info(AcpiMiscInfo *info) info->applesmc_io_base =3D applesmc_port(); } =20 -/* - * Because of the PXB hosts we cannot simply query TYPE_PCI_HOST_BRIDGE. - * On i386 arch we only have two pci hosts, so we can look only for them. - */ -static Object *acpi_get_i386_pci_host(void) -{ - PCIHostState *host; - - host =3D OBJECT_CHECK(PCIHostState, - object_resolve_path("/machine/i440fx", NULL), - TYPE_PCI_HOST_BRIDGE); - if (!host) { - host =3D OBJECT_CHECK(PCIHostState, - object_resolve_path("/machine/q35", NULL), - TYPE_PCI_HOST_BRIDGE); - } - - return OBJECT(host); -} - -static void acpi_get_pci_holes(Range *hole, Range *hole64) -{ - Object *pci_host; - - pci_host =3D acpi_get_i386_pci_host(); - g_assert(pci_host); - - range_set_bounds1(hole, - object_property_get_uint(pci_host, - PCI_HOST_PROP_PCI_HOLE_STAR= T, - NULL), - object_property_get_uint(pci_host, - PCI_HOST_PROP_PCI_HOLE_END, - NULL)); - range_set_bounds1(hole64, - object_property_get_uint(pci_host, - PCI_HOST_PROP_PCI_HOLE64_ST= ART, - NULL), - object_property_get_uint(pci_host, - PCI_HOST_PROP_PCI_HOLE64_EN= D, - NULL)); -} - /* FACS */ static void build_facs(GArray *table_data, BIOSLinker *linker) @@ -1634,7 +1591,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, Object *pci_host; PCIBus *bus =3D NULL; =20 - pci_host =3D acpi_get_i386_pci_host(); + pci_host =3D acpi_get_pci_host(); if (pci_host) { bus =3D PCI_HOST_BRIDGE(pci_host)->bus; } @@ -2008,7 +1965,7 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) Object *pci_host; QObject *o; =20 - pci_host =3D acpi_get_i386_pci_host(); + pci_host =3D acpi_get_pci_host(); g_assert(pci_host); =20 o =3D object_property_get_qobject(pci_host, PCIE_HOST_MCFG_BASE, NULL); --=20 2.19.1