qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aleksandr Bezzubikov <zuban32s@gmail.com>
To: qemu-devel@nongnu.org
Cc: marcel@redhat.com, mst@redhat.com, imammedo@redhat.com,
	pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com,
	Aleksandr Bezzubikov <zuban32s@gmail.com>
Subject: [Qemu-devel] [PATCH RFC 2/6] hw/acpi: simplify dsdt building code
Date: Fri, 30 Jun 2017 00:55:58 +0300	[thread overview]
Message-ID: <1498773362-18675-3-git-send-email-zuban32s@gmail.com> (raw)
In-Reply-To: <1498773362-18675-1-git-send-email-zuban32s@gmail.com>

Signed-off-by: Aleksandr Bezzubikov <zuban32s@gmail.com>
---
 hw/i386/acpi-build.c | 59 +++++++++++++++++++++++-----------------------------
 1 file changed, 26 insertions(+), 33 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 6fce967..b0dcd34 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1886,7 +1886,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
     PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(machine);
     uint32_t nr_mem = machine->ram_slots;
     int root_bus_limit = 0xFF;
-    PCIBus *bus = NULL;
+    PCIBus *root_bus = NULL;
     int i;
 
     dsdt = init_aml_allocator();
@@ -1927,6 +1927,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
         build_q35_pci0_int(dsdt);
     }
 
+    root_bus = PC_MACHINE(machine)->bus;
+    assert(root_bus);
+
     if (pcmc->legacy_cpu_hotplug) {
         build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base);
     } else {
@@ -1961,8 +1964,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
     aml_append(dsdt, scope);
 
     crs_range_set_init(&crs_range_set);
-    bus = PC_MACHINE(machine)->bus;
-    if (bus) {
+    {
+        PCIBus *bus = root_bus;
         QLIST_FOREACH(bus, &bus->child, sibling) {
             uint8_t bus_num = pci_bus_num(bus);
             uint8_t numa_node = pci_bus_numa_node(bus);
@@ -2206,38 +2209,28 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
 
     sb_scope = aml_scope("\\_SB");
     {
-        Object *pci_host;
-        PCIBus *bus = NULL;
-
-        pci_host = acpi_get_i386_pci_host();
-        if (pci_host) {
-            bus = PCI_HOST_BRIDGE(pci_host)->bus;
+        Aml *scope = aml_scope("PCI0");
+        /* Scan all PCI buses. Generate tables to support hotplug. */
+        build_append_pci_bus_devices(scope, root_bus, pm->pcihp_bridge_en);
+
+        if (misc->tpm_version != TPM_VERSION_UNSPEC) {
+            dev = aml_device("ISA.TPM");
+            aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
+            aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
+            crs = aml_resource_template();
+            aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
+                       TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
+            /*
+                FIXME: TPM_TIS_IRQ=5 conflicts with PNP0C0F irqs,
+                Rewrite to take IRQ from TPM device model and
+                fix default IRQ value there to use some unused IRQ
+             */
+            /* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */
+            aml_append(dev, aml_name_decl("_CRS", crs));
+            aml_append(scope, dev);
         }
 
-        if (bus) {
-            Aml *scope = aml_scope("PCI0");
-            /* Scan all PCI buses. Generate tables to support hotplug. */
-            build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
-
-            if (misc->tpm_version != TPM_VERSION_UNSPEC) {
-                dev = aml_device("ISA.TPM");
-                aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
-                aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
-                crs = aml_resource_template();
-                aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
-                           TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
-                /*
-                    FIXME: TPM_TIS_IRQ=5 conflicts with PNP0C0F irqs,
-                    Rewrite to take IRQ from TPM device model and
-                    fix default IRQ value there to use some unused IRQ
-                 */
-                /* aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ)); */
-                aml_append(dev, aml_name_decl("_CRS", crs));
-                aml_append(scope, dev);
-            }
-
-            aml_append(sb_scope, scope);
-        }
+        aml_append(sb_scope, scope);
     }
     aml_append(dsdt, sb_scope);
 
-- 
2.7.4

  parent reply	other threads:[~2017-06-29 21:56 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 21:55 [Qemu-devel] [PATCH RFC 0/6] q35: add acpi pci hotplug support Aleksandr Bezzubikov
2017-06-29 21:55 ` [Qemu-devel] [PATCH RFC 1/6] hw/acpi: remove dead acpi code Aleksandr Bezzubikov
2017-06-29 23:27   ` Michael S. Tsirkin
2017-07-03 11:52     ` Igor Mammedov
2017-06-29 21:55 ` Aleksandr Bezzubikov [this message]
2017-06-29 21:55 ` [Qemu-devel] [PATCH RFC 3/6] hw/acpi: fix pcihp io initialization Aleksandr Bezzubikov
2017-06-29 23:22   ` Michael S. Tsirkin
2017-06-29 21:56 ` [Qemu-devel] [PATCH RFC 4/6] hw/acpi: prepare pci hotplug IO for ich9 Aleksandr Bezzubikov
2017-06-29 23:28   ` Michael S. Tsirkin
2017-06-29 21:56 ` [Qemu-devel] [PATCH RFC 5/6] hw/acpi: extend acpi pci hotplug support for pci express Aleksandr Bezzubikov
2017-06-29 23:30   ` Michael S. Tsirkin
2017-06-29 21:56 ` [Qemu-devel] [PATCH RFC 6/6] hw/ich9: enable acpi pci hotplug Aleksandr Bezzubikov
2017-06-29 23:31   ` Michael S. Tsirkin
2017-06-29 23:17 ` [Qemu-devel] [PATCH RFC 0/6] q35: add acpi pci hotplug support Michael S. Tsirkin
2017-06-30  7:25   ` Marcel Apfelbaum
2017-06-30 19:19     ` Michael S. Tsirkin
2017-07-03 12:27     ` Igor Mammedov
2017-07-03 13:58       ` Alexander Bezzubikov
2017-07-03 14:41         ` Alexander Bezzubikov
2017-07-03 16:37           ` Michael S. Tsirkin
2017-07-03 16:34       ` Michael S. Tsirkin
2017-07-03 18:26         ` Marcel Apfelbaum
2017-07-03 18:29           ` Michael S. Tsirkin
2017-07-03 22:06             ` Alexander Bezzubikov
2017-07-04  1:00               ` Alexander Bezzubikov
2017-07-04 12:18                 ` Marcel Apfelbaum
2017-07-04 13:12         ` Igor Mammedov

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=1498773362-18675-3-git-send-email-zuban32s@gmail.com \
    --to=zuban32s@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).