[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/26] hw: acpi: Export the MCFG getter
From: |
Samuel Ortiz |
Subject: |
[Qemu-devel] [PATCH 09/26] hw: acpi: Export the MCFG getter |
Date: |
Mon, 22 Oct 2018 20:36:39 +0200 |
From: Yang Zhong <address@hidden>
The ACPI MCFG getter is not x86 specific and could be called from
anywhere within generic ACPI API, so let's export it.
Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Igor Mammedov <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Richard Henderson <address@hidden>
Cc: Eduardo Habkost <address@hidden>
Cc: Marcel Apfelbaum <address@hidden>
Signed-off-by: Yang Zhong <address@hidden>
---
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 3e0511bd46..0d21c854a6 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 6647fa8791..befe260251 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
- Re: [Qemu-devel] [PATCH 01/26] hw: i386: Decouple the ACPI build from the PC machine type, (continued)
- [Qemu-devel] [PATCH 03/26] hw: acpi: Export the RSDP build API, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 04/26] hw: arm: Switch to the AML build RSDP building routine, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 06/26] hw: acpi: Factorize _OSC AML across architectures, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 05/26] hw: acpi: Generalize AML build routines, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 07/26] hw: i386: Refactor PCI host getter, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 11/26] hw: i386: Make the hotpluggable memory size property more generic, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 13/26] hw: acpi: Fix memory hotplug AML generation error, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 10/26] hw: acpi: Do not create hotplug method when handler is not defined, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 12/26] hw: acpi: Export the SRAT AML build API, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 09/26] hw: acpi: Export the MCFG getter,
Samuel Ortiz <=
- [Qemu-devel] [PATCH 08/26] hw: acpi: Export and generalize the PCI host AML API, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 14/26] hw: acpi: Export the PCI hotplug API, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 15/26] hw: acpi: Retrieve the PCI bus from AcpiPciHpState, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 16/26] hw: fw-build: Add firmware build methods and state, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 17/26] hw: i386: Convert PC machine type to firmware build methods, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 19/26] hw: acpi: reduced: Add MCFG support, Samuel Ortiz, 2018/10/22
- [Qemu-devel] [PATCH 18/26] hw: acpi: Initial hardware-reduced support, Samuel Ortiz, 2018/10/22