[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 09/23] hw: acpi: Export the PCI host and holes ge
From: |
Samuel Ortiz |
Subject: |
[Qemu-devel] [PATCH v4 09/23] hw: acpi: Export the PCI host and holes getters |
Date: |
Thu, 1 Nov 2018 11:22:49 +0100 |
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 <address@hidden>
---
hw/acpi/aml-build.c | 43 +++++++++++++++++++++++++++++++++
hw/i386/acpi-build.c | 47 ++-----------------------------------
include/hw/acpi/aml-build.h | 2 ++
3 files changed, 47 insertions(+), 45 deletions(-)
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 52ac39acdb..9a341cde30 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -1601,6 +1601,49 @@ void acpi_build_tables_cleanup(AcpiBuildTables *tables,
bool mfre)
g_array_free(tables->vmgenid, mfre);
}
+/*
+ * Because of the PXB hosts we cannot simply query TYPE_PCI_HOST_BRIDGE.
+ */
+Object *acpi_get_pci_host(void)
+{
+ PCIHostState *host;
+
+ host = OBJECT_CHECK(PCIHostState,
+ object_resolve_path("/machine/i440fx", NULL),
+ TYPE_PCI_HOST_BRIDGE);
+ if (!host) {
+ host = 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 = acpi_get_pci_host();
+ g_assert(pci_host);
+
+ range_set_bounds1(hole,
+ object_property_get_uint(pci_host,
+ PCI_HOST_PROP_PCI_HOLE_START,
+ 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_START,
+ NULL),
+ object_property_get_uint(pci_host,
+ PCI_HOST_PROP_PCI_HOLE64_END,
+ NULL));
+}
+
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 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 = applesmc_port();
}
-/*
- * 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 = OBJECT_CHECK(PCIHostState,
- object_resolve_path("/machine/i440fx", NULL),
- TYPE_PCI_HOST_BRIDGE);
- if (!host) {
- host = 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 = acpi_get_i386_pci_host();
- g_assert(pci_host);
-
- range_set_bounds1(hole,
- object_property_get_uint(pci_host,
- PCI_HOST_PROP_PCI_HOLE_START,
- 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_START,
- NULL),
- object_property_get_uint(pci_host,
- PCI_HOST_PROP_PCI_HOLE64_END,
- 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 = NULL;
- pci_host = acpi_get_i386_pci_host();
+ pci_host = acpi_get_pci_host();
if (pci_host) {
bus = PCI_HOST_BRIDGE(pci_host)->bus;
}
@@ -2008,7 +1965,7 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
Object *pci_host;
QObject *o;
- pci_host = acpi_get_i386_pci_host();
+ pci_host = acpi_get_pci_host();
g_assert(pci_host);
o = object_property_get_qobject(pci_host, PCIE_HOST_MCFG_BASE, NULL);
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);
--
2.19.1
- [Qemu-devel] [PATCH v4 01/23] hw: i386: Decouple the ACPI build from the PC machine type, (continued)
- [Qemu-devel] [PATCH v4 01/23] hw: i386: Decouple the ACPI build from the PC machine type, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 04/23] hw: acpi: Implement XSDT support for RSDP, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 05/23] hw: arm: Switch to the AML build RSDP building routine, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 11/23] hw: acpi: Export the MCFG getter, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 08/23] hw: i386: Move PCI host definitions to pci_host.h, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 12/23] hw: acpi: Do not create hotplug method when handler is not defined, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 13/23] hw: i386: Make the hotpluggable memory size property more generic, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 09/23] hw: acpi: Export the PCI host and holes getters,
Samuel Ortiz <=
- [Qemu-devel] [PATCH v4 10/23] hw: acpi: Export and generalize the PCI host AML API, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 07/23] hw: acpi: Factorize _OSC AML across architectures, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 14/23] hw: i386: Export the i386 ACPI SRAT build method, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 15/23] hw: acpi: Fix memory hotplug AML generation error, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 06/23] hw: acpi: Generalize AML build routines, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 16/23] hw: acpi: Export the PCI hotplug API, Samuel Ortiz, 2018/11/01
- [Qemu-devel] [PATCH v4 17/23] hw: i386: Export the MADT build method, Samuel Ortiz, 2018/11/01