[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH v5 24/24] hw: i386: Refactor PCI host getter
From: |
Samuel Ortiz |
Subject: |
[Qemu-arm] [PATCH v5 24/24] hw: i386: Refactor PCI host getter |
Date: |
Mon, 5 Nov 2018 02:40:47 +0100 |
From: Yang Zhong <address@hidden>
Now that the ACPI builder methods are added, we can reach the ACPI
configuration pointer from the MachineState pointer. From there we can
get to the PCI host pointer and return it.
This makes the PCI host getter an ACPI, architecture agnostic function.
Signed-off-by: Yang Zhong <address@hidden>
---
hw/acpi/aml-build.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index 6112cc2149..b532817fb5 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -22,6 +22,8 @@
#include "qemu/osdep.h"
#include <glib/gprintf.h>
#include "hw/acpi/aml-build.h"
+#include "hw/acpi/builder.h"
+#include "hw/mem/memory-device.h"
#include "qemu/bswap.h"
#include "qemu/bitops.h"
#include "sysemu/numa.h"
@@ -1617,23 +1619,15 @@ 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;
+ MachineState *ms = MACHINE(qdev_get_machine());
+ AcpiBuilder *ab = ACPI_BUILDER(ms);
+ AcpiConfiguration *acpi_conf;
- 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);
- }
+ acpi_conf = acpi_builder_configuration(ab);
- return OBJECT(host);
+ return OBJECT(acpi_conf->pci_host);
}
--
2.19.1
- Re: [Qemu-arm] [PATCH v5 19/24] hw: acpi: Retrieve the PCI bus from AcpiPciHpState, (continued)
- Re: [Qemu-arm] [PATCH v5 19/24] hw: acpi: Retrieve the PCI bus from AcpiPciHpState, Igor Mammedov, 2018/11/16
- Re: [Qemu-arm] [PATCH v5 19/24] hw: acpi: Retrieve the PCI bus from AcpiPciHpState, Boeuf, Sebastien, 2018/11/16
- Re: [Qemu-arm] [PATCH v5 19/24] hw: acpi: Retrieve the PCI bus from AcpiPciHpState, Igor Mammedov, 2018/11/19
- Re: [Qemu-arm] [PATCH v5 19/24] hw: acpi: Retrieve the PCI bus from AcpiPciHpState, Boeuf, Sebastien, 2018/11/19
- Re: [Qemu-arm] [PATCH v5 19/24] hw: acpi: Retrieve the PCI bus from AcpiPciHpState, Igor Mammedov, 2018/11/20
[Qemu-arm] [PATCH v5 21/24] hw: i386: Implement the ACPI builder interface for PC, Samuel Ortiz, 2018/11/04
[Qemu-arm] [PATCH v5 20/24] hw: acpi: Define ACPI tables builder interface, Samuel Ortiz, 2018/11/04
[Qemu-arm] [PATCH v5 24/24] hw: i386: Refactor PCI host getter,
Samuel Ortiz <=
[Qemu-arm] [PATCH v5 23/24] hw: i386: Set ACPI configuration PCI host pointer, Samuel Ortiz, 2018/11/04
[Qemu-arm] [PATCH v5 22/24] hw: pci-host: piix: Return PCI host pointer instead of PCI bus, Samuel Ortiz, 2018/11/04
Re: [Qemu-arm] [Qemu-devel] [PATCH v5 00/24] ACPI reorganization for hardware-reduced API addition, Igor Mammedov, 2018/11/16