From: Samuel Ortiz <sameo@linux.intel.com>
To: qemu-devel@nongnu.org
Cc: Yang Zhong <yang.zhong@intel.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
Eduardo Habkost <ehabkost@redhat.com>
Subject: [Qemu-devel] [PATCH v3 10/19] hw: acpi: Export the MCFG getter
Date: Mon, 29 Oct 2018 18:01:50 +0100 [thread overview]
Message-ID: <20181029170159.3801-11-sameo@linux.intel.com> (raw)
In-Reply-To: <20181029170159.3801-1-sameo@linux.intel.com>
From: Yang Zhong <yang.zhong@intel.com>
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 <yang.zhong@intel.com>
---
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"
#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));
}
+bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
+{
+ Object *pci_host;
+ QObject *o;
+
+ pci_host = acpi_get_pci_host();
+ g_assert(pci_host);
+
+ o = object_property_get_qobject(pci_host, PCIE_HOST_MCFG_BASE, NULL);
+ if (!o) {
+ return false;
+ }
+ mcfg->mcfg_base = qnum_get_uint(qobject_to(QNum, o));
+ qobject_unref(o);
+
+ o = object_property_get_qobject(pci_host, PCIE_HOST_MCFG_SIZE, NULL);
+ assert(o);
+ mcfg->mcfg_size = qnum_get_uint(qobject_to(QNum, o));
+ qobject_unref(o);
+ return true;
+}
+
static void crs_range_insert(GPtrArray *ranges, uint64_t base, uint64_t limit)
{
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 *linker)
"IVRS", table_data->len - iommu_start, 1, NULL, NULL);
}
-static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
-{
- Object *pci_host;
- QObject *o;
-
- pci_host = acpi_get_pci_host();
- g_assert(pci_host);
-
- o = object_property_get_qobject(pci_host, PCIE_HOST_MCFG_BASE, NULL);
- if (!o) {
- return false;
- }
- mcfg->mcfg_base = qnum_get_uint(qobject_to(QNum, o));
- qobject_unref(o);
-
- o = object_property_get_qobject(pci_host, PCIE_HOST_MCFG_SIZE, NULL);
- assert(o);
- mcfg->mcfg_size = 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);
--
2.17.2
next prev parent reply other threads:[~2018-10-29 17:03 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-29 17:01 [Qemu-devel] [PATCH v3 00/19] ACPI reorganization for hardware-reduced support Samuel Ortiz
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 01/19] hw: i386: Decouple the ACPI build from the PC machine type Samuel Ortiz
2018-10-29 19:50 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 02/19] hw: acpi: Export ACPI build alignment API Samuel Ortiz
2018-10-29 19:01 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 03/19] hw: acpi: Export the RSDP build API Samuel Ortiz
2018-10-29 18:58 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 04/19] hw: acpi: Implement XSDT support for RSDP Samuel Ortiz
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 05/19] hw: arm: Switch to the AML build RSDP building routine Samuel Ortiz
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 06/19] hw: acpi: Generalize AML build routines Samuel Ortiz
2018-10-29 19:09 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 07/19] hw: acpi: Factorize _OSC AML across architectures Samuel Ortiz
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 08/19] hw: i386: Refactor PCI host getter Samuel Ortiz
2018-10-29 19:18 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 09/19] hw: acpi: Export and generalize the PCI host AML API Samuel Ortiz
2018-10-29 19:23 ` Philippe Mathieu-Daudé
2018-10-29 19:29 ` Philippe Mathieu-Daudé
2018-10-30 14:57 ` Samuel Ortiz
2018-10-30 18:04 ` Philippe Mathieu-Daudé
2018-10-31 10:46 ` Samuel Ortiz
2018-10-29 17:01 ` Samuel Ortiz [this message]
2018-10-29 19:31 ` [Qemu-devel] [PATCH v3 10/19] hw: acpi: Export the MCFG getter Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 11/19] hw: acpi: Do not create hotplug method when handler is not defined Samuel Ortiz
2018-10-29 19:33 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 12/19] hw: i386: Make the hotpluggable memory size property more generic Samuel Ortiz
2018-10-29 19:38 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 13/19] hw: acpi: Export the SRAT AML build API Samuel Ortiz
2018-10-29 19:40 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 14/19] hw: acpi: Fix memory hotplug AML generation error Samuel Ortiz
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 15/19] hw: acpi: Export the PCI hotplug API Samuel Ortiz
2018-10-29 19:46 ` Philippe Mathieu-Daudé
2018-10-29 23:34 ` Boeuf, Sebastien
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 16/19] hw: acpi: Retrieve the PCI bus from AcpiPciHpState Samuel Ortiz
2018-10-29 21:02 ` Philippe Mathieu-Daudé
2018-10-29 23:35 ` Boeuf, Sebastien
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 17/19] hw: acpi: Define ACPI tables builder interface Samuel Ortiz
2018-10-29 21:06 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 18/19] hw: i386: Export the MADT build method Samuel Ortiz
2018-10-29 21:18 ` Philippe Mathieu-Daudé
2018-10-29 17:01 ` [Qemu-devel] [PATCH v3 19/19] hw: i386: Implement the ACPI builder interface for PC Samuel Ortiz
2018-10-29 17:28 ` Paolo Bonzini
2018-10-30 14:13 ` Samuel Ortiz
2018-10-30 16:03 ` Paolo Bonzini
2018-10-31 1:02 ` Samuel Ortiz
2018-10-29 21:23 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181029170159.3801-11-sameo@linux.intel.com \
--to=sameo@linux.intel.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=yang.zhong@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).