qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Richard Henderson <rth@twiddle.net>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PULL 33/59] pc: acpi: move PIIX4 isa-bridge and pm devices into SSDT
Date: Fri, 8 Jan 2016 16:20:11 +0200	[thread overview]
Message-ID: <1452262668-31244-34-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1452262668-31244-1-git-send-email-mst@redhat.com>

From: Igor Mammedov <imammedo@redhat.com>

and also move PRQx fields declaration as it can't be
split out into separate patch since fields use
PCI0.ISA.P40C operation region and OperationRegion
must be declared in the same table as a Field that
uses it. If this condition is not statisfied Windows
will BSOD ans IASL (make check) will error out as well.

For the same reason pm is moved together with isa-bridge
as the later refernces P13C OperationRegion from pm device.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/acpi/aml-build.h |  1 +
 hw/i386/acpi-build.c        | 77 +++++++++++++++++++++++++++++++++++++++++++--
 hw/i386/acpi-dsdt.dsl       | 52 +++---------------------------
 3 files changed, 81 insertions(+), 49 deletions(-)

diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 83c0102..6d6f705 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -82,6 +82,7 @@ typedef enum {
 typedef enum {
     AML_SYSTEM_MEMORY = 0X00,
     AML_SYSTEM_IO = 0X01,
+    AML_PCI_CONFIG = 0X02,
 } AmlRegionSpace;
 
 typedef enum {
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index b0c82b6..0190dd9 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -109,6 +109,7 @@ typedef struct AcpiPmInfo {
 } AcpiPmInfo;
 
 typedef struct AcpiMiscInfo {
+    bool is_piix4;
     bool has_hpet;
     TPMVersion tpm_version;
     const unsigned char *dsdt_code;
@@ -131,10 +132,12 @@ static void acpi_get_dsdt(AcpiMiscInfo *info)
     assert(!!piix != !!lpc);
 
     if (piix) {
+        info->is_piix4 = true;
         info->dsdt_code = AcpiDsdtAmlCode;
         info->dsdt_size = sizeof AcpiDsdtAmlCode;
     }
     if (lpc) {
+        info->is_piix4 = false;
         info->dsdt_code = Q35AcpiDsdtAmlCode;
         info->dsdt_size = sizeof Q35AcpiDsdtAmlCode;
     }
@@ -1426,6 +1429,68 @@ static void build_dbg_aml(Aml *table)
     aml_append(table, scope);
 }
 
+static void build_piix4_pci0_int(Aml *table)
+{
+    Aml *field;
+    Aml *sb_scope = aml_scope("_SB");
+
+    field = aml_field("PCI0.ISA.P40C", AML_BYTE_ACC, AML_NOLOCK, AML_PRESERVE);
+    aml_append(field, aml_named_field("PRQ0", 8));
+    aml_append(field, aml_named_field("PRQ1", 8));
+    aml_append(field, aml_named_field("PRQ2", 8));
+    aml_append(field, aml_named_field("PRQ3", 8));
+    aml_append(sb_scope, field);
+
+    aml_append(table, sb_scope);
+}
+
+static void build_piix4_pm(Aml *table)
+{
+    Aml *dev;
+    Aml *scope;
+
+    scope =  aml_scope("_SB.PCI0");
+    dev = aml_device("PX13");
+    aml_append(dev, aml_name_decl("_ADR", aml_int(0x00010003)));
+
+    aml_append(dev, aml_operation_region("P13C", AML_PCI_CONFIG,
+                                         0x00, 0xff));
+    aml_append(scope, dev);
+    aml_append(table, scope);
+}
+
+static void build_piix4_isa_bridge(Aml *table)
+{
+    Aml *dev;
+    Aml *scope;
+    Aml *field;
+
+    scope =  aml_scope("_SB.PCI0");
+    dev = aml_device("ISA");
+    aml_append(dev, aml_name_decl("_ADR", aml_int(0x00010000)));
+
+    /* PIIX PCI to ISA irq remapping */
+    aml_append(dev, aml_operation_region("P40C", AML_PCI_CONFIG,
+                                         0x60, 0x04));
+    /* enable bits */
+    field = aml_field("^PX13.P13C", AML_ANY_ACC, AML_NOLOCK, AML_PRESERVE);
+    /* Offset(0x5f),, 7, */
+    aml_append(field, aml_reserved_field(0x2f8));
+    aml_append(field, aml_reserved_field(7));
+    aml_append(field, aml_named_field("LPEN", 1));
+    /* Offset(0x67),, 3, */
+    aml_append(field, aml_reserved_field(0x38));
+    aml_append(field, aml_reserved_field(3));
+    aml_append(field, aml_named_field("CAEN", 1));
+    aml_append(field, aml_reserved_field(3));
+    aml_append(field, aml_named_field("CBEN", 1));
+    aml_append(dev, field);
+    aml_append(dev, aml_name_decl("FDEN", aml_int(1)));
+
+    aml_append(scope, dev);
+    aml_append(table, scope);
+}
+
 static void
 build_ssdt(GArray *table_data, GArray *linker,
            AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
@@ -1447,8 +1512,16 @@ build_ssdt(GArray *table_data, GArray *linker,
     acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
 
     build_dbg_aml(ssdt);
-    build_hpet_aml(ssdt);
-    build_isa_devices_aml(ssdt);
+    if (misc->is_piix4) {
+        build_hpet_aml(ssdt);
+        build_piix4_pm(ssdt);
+        build_piix4_isa_bridge(ssdt);
+        build_isa_devices_aml(ssdt);
+        build_piix4_pci0_int(ssdt);
+    } else {
+        build_hpet_aml(ssdt);
+        build_isa_devices_aml(ssdt);
+    }
     build_cpu_hotplug_aml(ssdt);
     build_memory_hotplug_aml(ssdt, nr_mem, pm->mem_hp_io_base,
                              pm->mem_hp_io_len);
diff --git a/hw/i386/acpi-dsdt.dsl b/hw/i386/acpi-dsdt.dsl
index 6048cc7..11e2e61 100644
--- a/hw/i386/acpi-dsdt.dsl
+++ b/hw/i386/acpi-dsdt.dsl
@@ -40,47 +40,6 @@ DefinitionBlock (
     }
 
 /****************************************************************
- * PIIX4 PM
- ****************************************************************/
-
-    Scope(\_SB.PCI0) {
-        Device(PX13) {
-            Name(_ADR, 0x00010003)
-            OperationRegion(P13C, PCI_Config, 0x00, 0xff)
-        }
-    }
-
-
-/****************************************************************
- * PIIX3 ISA bridge
- ****************************************************************/
-
-    Scope(\_SB.PCI0) {
-
-        External(ISA, DeviceObj)
-
-        Device(ISA) {
-            Name(_ADR, 0x00010000)
-
-            /* PIIX PCI to ISA irq remapping */
-            OperationRegion(P40C, PCI_Config, 0x60, 0x04)
-
-            /* enable bits */
-            Field(\_SB.PCI0.PX13.P13C, AnyAcc, NoLock, Preserve) {
-                Offset(0x5f),
-                , 7,
-                LPEN, 1,         // LPT
-                Offset(0x67),
-                , 3,
-                CAEN, 1,         // COM1
-                , 3,
-                CBEN, 1,         // COM2
-            }
-            Name(FDEN, 1)
-        }
-    }
-
-/****************************************************************
  * PCI hotplug
  ****************************************************************/
 
@@ -168,12 +127,11 @@ DefinitionBlock (
             }
         }
 
-        Field(PCI0.ISA.P40C, ByteAcc, NoLock, Preserve) {
-            PRQ0,   8,
-            PRQ1,   8,
-            PRQ2,   8,
-            PRQ3,   8
-        }
+
+        External(PRQ0, FieldUnitObj)
+        External(PRQ1, FieldUnitObj)
+        External(PRQ2, FieldUnitObj)
+        External(PRQ3, FieldUnitObj)
 
         Method(IQST, 1, NotSerialized) {
             // _STA method - get status
-- 
MST

  parent reply	other threads:[~2016-01-08 14:20 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 15:08 [Qemu-devel] [PULL 00/59] acpi dsdt rework, misc fixes Michael S. Tsirkin
2016-01-08 14:18 ` [Qemu-devel] [PULL 04/59] tests: acpi: print ASL diff in verbose mode Michael S. Tsirkin
2016-01-08 14:18 ` [Qemu-devel] [PULL 05/59] pc: acpi: memhp: prepare context in SSDT for moving memhp DSDT code Michael S. Tsirkin
2016-01-08 14:18 ` [Qemu-devel] [PULL 06/59] pc: acpi: memhp: move MHPD._STA method into SSDT Michael S. Tsirkin
2016-01-08 14:18 ` [Qemu-devel] [PULL 07/59] pc: acpi: memhp: move MHPD.MLCK mutex " Michael S. Tsirkin
2016-01-08 14:18 ` [Qemu-devel] [PULL 08/59] pc: acpi: memhp: move MHPD.MSCN method " Michael S. Tsirkin
2016-01-08 14:18 ` [Qemu-devel] [PULL 09/59] pc: acpi: memhp: move MHPD.MRST " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 10/59] pc: acpi: memhp: move MHPD.MPXM " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 11/59] pc: acpi: memhp: move MHPD.MOST " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 12/59] pc: acpi: memhp: move MHPD.MEJ0 " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 13/59] pc: acpi: memhp: move MHPD.MCRS " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 14/59] pc: acpi: memhp: move MHPD Device " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 15/59] pc: acpi: factor out memhp code from build_ssdt() into separate function Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 16/59] pc: acpi: memhp: move \_GPE._E03 into SSDT Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 17/59] pc: acpi: memhp: drop not needed stringify(MEMORY_foo) usage Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 18/59] pc: acpi: drop unused CPU_STATUS_LEN from DSDT Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 19/59] pc: acpi: cpuhp: move CPEJ() method to SSDT Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 20/59] pc: acpi: cpuhp: move CPMA() method into SSDT Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 21/59] pc: acpi: cpuhp: move CPST() " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 22/59] pc: acpi: cpuhp: move PRSC() " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 23/59] pc: acpi: cpuhp: move \_GPE._E02() " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 24/59] pc: acpi: factor out cpu hotplug code from build_ssdt() into separate function Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 25/59] pc: acpi: move HPET from DSDT to SSDT Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 26/59] pc: acpi: move DBUG() " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 27/59] pc: acpi: move RTC device " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 28/59] pc: acpi: move KBD " Michael S. Tsirkin
2016-01-08 14:19 ` [Qemu-devel] [PULL 29/59] pc: acpi: move MOU " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 30/59] pc: acpi: move FDC0 " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 31/59] pc: acpi: move LPT " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 32/59] pc: acpi: move COM devices " Michael S. Tsirkin
2016-01-08 14:20 ` Michael S. Tsirkin [this message]
2016-01-08 14:20 ` [Qemu-devel] [PULL 34/59] pc: acpi: move remaining GPE handlers into SSDT Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 35/59] pc: acpi: pci: move link devices " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 36/59] pc: acpi: piix4: move IQCR() " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 37/59] pc: acpi: piix4: move IQST() " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 38/59] pc: acpi: piix4: move PCI0._PRT() " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 39/59] pc: acpi: piix4: move remaining PCI hotplug bits " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 40/59] pc: acpi: piix4: acpi move PCI0 device to SSDT Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 41/59] pc: acpi: q35: move GSI links " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 42/59] pc: acpi: q35: move link devices " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 43/59] pc: acpi: q35: move IQCR() into SSDT Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 44/59] pc: acpi: q35: move IQST() " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 45/59] pc: acpi: q35: move ISA bridge " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 46/59] pc: acpi: q35: move _PRT() " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 47/59] pc: acpi: q35: move PRTA routing table " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 48/59] pc: acpi: q35: move PRTP " Michael S. Tsirkin
2016-01-08 14:20 ` [Qemu-devel] [PULL 49/59] pc: acpi: q35: move _PIC() method " Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 50/59] pc: acpi: q35: move PCI0._OSC() " Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 51/59] pc: acpi: q35: move PCI0 device definition " Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 52/59] pc: acpi: q35: PCST, PCSB opregions and PCIB field " Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 53/59] pc: acpi: switch to AML API composed DSDT Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 54/59] pc: acpi: remove unused ASL templates and related blobs/utils Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 55/59] i386/pc: expose identifying the floppy controller Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 56/59] Add VMSTATE_STRUCT_VARRAY_KNOWN Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 57/59] migration/virtio: Remove simple .get/.put use Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 58/59] ivshmem: Store file descriptor for vhost-user negotiation Michael S. Tsirkin
2016-01-08 14:21 ` [Qemu-devel] [PULL 59/59] virtio: fix error message for number of queues Michael S. Tsirkin
2016-01-08 15:08 ` [Qemu-devel] [PULL 01/59] nvdimm: fix header pointer in nvdimm_build_nfit() Michael S. Tsirkin
2016-01-08 15:08 ` [Qemu-devel] [PULL 02/59] igd-passthrough: fix use of host_pci_config_read Michael S. Tsirkin
2016-01-08 15:08 ` [Qemu-devel] [PULL 03/59] hw/i386: fill in the CENTURY field of the FADT (FACP) ACPI table Michael S. Tsirkin
2016-01-08 16:21 ` [Qemu-devel] [PULL 00/59] acpi dsdt rework, misc fixes Peter Maydell
2016-01-08 17:34   ` [Qemu-devel] [PATCH] pc: acpi: fix build fail on w32 Igor Mammedov
2016-01-09 21:18     ` Michael S. Tsirkin

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=1452262668-31244-34-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).