qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: Igor Mammedov <imammedo@redhat.com>,
	Marcel Apfelbaum <marcel.a@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH 03/13] acpi: Eliminate acpi_get_i386_pci_host() function
Date: Wed,  2 Dec 2015 20:22:48 -0200	[thread overview]
Message-ID: <1449094978-22986-4-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1449094978-22986-1-git-send-email-ehabkost@redhat.com>

We can simply use PCMachineState::pci_host directly.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/i386/acpi-build.c | 38 +++++++-------------------------------
 1 file changed, 7 insertions(+), 31 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 20a7066..a595575 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -241,32 +241,9 @@ 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)
+static void acpi_get_pci_info(PcPciInfo *info, PCMachineState *pcms)
 {
-    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_info(PcPciInfo *info)
-{
-    Object *pci_host;
-
-
-    pci_host = acpi_get_i386_pci_host();
+    Object *pci_host = OBJECT(pcms->pci_host);
     g_assert(pci_host);
 
     info->w32.begin = object_property_get_int(pci_host,
@@ -1338,7 +1315,7 @@ build_ssdt(GArray *table_data, GArray *linker,
         aml_append(sb_scope, method);
 
         {
-            PCIBus *bus = PCI_HOST_BRIDGE(acpi_get_i386_pci_host())->bus;
+            PCIBus *bus = pcms->pci_host->bus;
 
             if (bus) {
                 Aml *scope = aml_scope("PCI0");
@@ -1643,12 +1620,11 @@ struct AcpiBuildState {
     MemoryRegion *linker_mr;
 } AcpiBuildState;
 
-static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
+static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg, PCMachineState *pcms)
 {
-    Object *pci_host;
+    Object *pci_host = OBJECT(pcms->pci_host);
     QObject *o;
 
-    pci_host = acpi_get_i386_pci_host();
     g_assert(pci_host);
 
     o = object_property_get_qobject(pci_host, PCIE_HOST_MCFG_BASE, NULL);
@@ -1694,7 +1670,7 @@ void acpi_build(PCMachineState *pcms, AcpiBuildTables *tables)
     acpi_get_pm_info(&pm);
     acpi_get_dsdt(&misc);
     acpi_get_misc_info(&misc);
-    acpi_get_pci_info(&pci);
+    acpi_get_pci_info(&pci, pcms);
 
     table_offsets = g_array_new(false, true /* clear */,
                                         sizeof(uint32_t));
@@ -1751,7 +1727,7 @@ void acpi_build(PCMachineState *pcms, AcpiBuildTables *tables)
         acpi_add_table(table_offsets, tables_blob);
         build_srat(tables_blob, tables->linker, pcms);
     }
-    if (acpi_get_mcfg(&mcfg)) {
+    if (acpi_get_mcfg(&mcfg, pcms)) {
         acpi_add_table(table_offsets, tables_blob);
         build_mcfg_q35(tables_blob, tables->linker, &mcfg);
     }
-- 
2.1.0

  parent reply	other threads:[~2015-12-03 14:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-02 22:22 [Qemu-devel] [PATCH 00/13] acpi: Make piix-specific and q35-specific code generic Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 01/13] pc: Add PCMachineState::pci_host field Eduardo Habkost
2015-12-03 15:35   ` Marcel Apfelbaum
2015-12-03 16:35     ` Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 02/13] acpi: Remove unnecessary check for NULL pci_host Eduardo Habkost
2015-12-02 22:22 ` Eduardo Habkost [this message]
2015-12-02 22:22 ` [Qemu-devel] [PATCH 04/13] acpi: Move DSDT info to PCMachineClass Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 05/13] acpi: Simplify s3/s4 property querying Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 06/13] acpi: Use &error_abort when getting PCI hotplug properties Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 07/13] acpi: Use QOM property to get CPU hotplug I/O base Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 08/13] acpi: Always try to init PCI " Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 09/13] acpi: Use PCMachineState::acpi_dev to get ACPI dev Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 10/13] acpi: Change acpi_pci_hotplug_enabled() argument to PCMachineState Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 11/13] acpi: Don't use find_i440fx() when setting bsel properties Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 12/13] intel_iommu.h: Missing sysbus.h include Eduardo Habkost
2015-12-02 22:22 ` [Qemu-devel] [PATCH 13/13] acpi: Don't include q35 and piix headers Eduardo Habkost
2015-12-03 15:19 ` [Qemu-devel] [PATCH 00/13] acpi: Make piix-specific and q35-specific code generic Igor Mammedov
2015-12-03 17:16   ` Eduardo Habkost
2015-12-04 13:24     ` Igor Mammedov
2015-12-04 14:08       ` Eduardo Habkost
2015-12-07 15:31         ` Marcel Apfelbaum

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=1449094978-22986-4-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=marcel.a@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).