[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 50/59] pc: acpi: q35: move PCI0._OSC() method into SS
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 50/59] pc: acpi: q35: move PCI0._OSC() method into SSDT |
Date: |
Fri, 8 Jan 2016 16:21:02 +0200 |
From: Igor Mammedov <address@hidden>
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/i386/acpi-build.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++
hw/i386/q35-acpi-dsdt.dsl | 57 -----------------------------------------------
2 files changed, 56 insertions(+), 57 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 55ea84d..29abb99 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1896,6 +1896,54 @@ static void build_piix4_pci_hotplug(Aml *table)
aml_append(table, scope);
}
+static Aml *build_q35_osc_method(void)
+{
+ Aml *if_ctx;
+ Aml *if_ctx2;
+ Aml *else_ctx;
+ Aml *method;
+ Aml *a_cwd1 = aml_name("CDW1");
+ Aml *a_ctrl = aml_name("CTRL");
+
+ method = aml_method("_OSC", 4, AML_NOTSERIALIZED);
+ aml_append(method, aml_create_dword_field(aml_arg(3), aml_int(0), "CDW1"));
+
+ if_ctx = aml_if(aml_equal(
+ aml_arg(0), aml_touuid("33DB4D5B-1FF7-401C-9657-7441C03DD766")));
+ aml_append(if_ctx, aml_create_dword_field(aml_arg(3), aml_int(4), "CDW2"));
+ aml_append(if_ctx, aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));
+
+ aml_append(if_ctx, aml_store(aml_name("CDW2"), aml_name("SUPP")));
+ aml_append(if_ctx, aml_store(aml_name("CDW3"), a_ctrl));
+
+ /*
+ * Always allow native PME, AER (no dependencies)
+ * Never allow SHPC (no SHPC controller in this system)
+ */
+ aml_append(if_ctx, aml_and(a_ctrl, aml_int(0x1D), a_ctrl));
+
+ if_ctx2 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(1))));
+ /* Unknown revision */
+ aml_append(if_ctx2, aml_or(a_cwd1, aml_int(0x08), a_cwd1));
+ aml_append(if_ctx, if_ctx2);
+
+ if_ctx2 = aml_if(aml_lnot(aml_equal(aml_name("CDW3"), a_ctrl)));
+ /* Capabilities bits were masked */
+ aml_append(if_ctx2, aml_or(a_cwd1, aml_int(0x10), a_cwd1));
+ aml_append(if_ctx, if_ctx2);
+
+ /* Update DWORD3 in the buffer */
+ aml_append(if_ctx, aml_store(a_ctrl, aml_name("CDW3")));
+ aml_append(method, if_ctx);
+
+ else_ctx = aml_else();
+ /* Unrecognized UUID */
+ aml_append(else_ctx, aml_or(a_cwd1, aml_int(4), a_cwd1));
+ aml_append(method, else_ctx);
+
+ aml_append(method, aml_return(aml_arg(3)));
+ return method;
+}
static void
build_ssdt(GArray *table_data, GArray *linker,
@@ -1934,6 +1982,14 @@ build_ssdt(GArray *table_data, GArray *linker,
build_piix4_pci_hotplug(ssdt);
build_piix4_pci0_int(ssdt);
} else {
+ sb_scope = aml_scope("_SB");
+ scope = aml_scope("PCI0");
+ aml_append(scope, aml_name_decl("SUPP", aml_int(0)));
+ aml_append(scope, aml_name_decl("CTRL", aml_int(0)));
+ aml_append(scope, build_q35_osc_method());
+ aml_append(sb_scope, scope);
+ aml_append(ssdt, sb_scope);
+
build_hpet_aml(ssdt);
build_q35_isa_bridge(ssdt);
build_isa_devices_aml(ssdt);
diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl
index 7c7aef7..b53663c 100644
--- a/hw/i386/q35-acpi-dsdt.dsl
+++ b/hw/i386/q35-acpi-dsdt.dsl
@@ -53,63 +53,6 @@ DefinitionBlock (
Name(_CID, EisaId("PNP0A03"))
Name(_ADR, 0x00)
Name(_UID, 1)
-
- External(ISA, DeviceObj)
-
- // _OSC: based on sample of ACPI3.0b spec
- Name(SUPP, 0) // PCI _OSC Support Field value
- Name(CTRL, 0) // PCI _OSC Control Field value
- Method(_OSC, 4) {
- // Create DWORD-addressable fields from the Capabilities Buffer
- CreateDWordField(Arg3, 0, CDW1)
-
- // Check for proper UUID
- If (LEqual(Arg0,
ToUUID("33DB4D5B-1FF7-401C-9657-7441C03DD766"))) {
- // Create DWORD-addressable fields from the Capabilities
Buffer
- CreateDWordField(Arg3, 4, CDW2)
- CreateDWordField(Arg3, 8, CDW3)
-
- // Save Capabilities DWORD2 & 3
- Store(CDW2, SUPP)
- Store(CDW3, CTRL)
-
- // Always allow native PME, AER (no dependencies)
- // Never allow SHPC (no SHPC controller in this system)
- And(CTRL, 0x1D, CTRL)
-
-#if 0 // For now, nothing to do
- If (Not(And(CDW1, 1))) { // Query flag clear?
- // Disable GPEs for features granted native control.
- If (And(CTRL, 0x01)) { // Hot plug control granted?
- Store(0, HPCE) // clear the hot plug SCI enable bit
- Store(1, HPCS) // clear the hot plug SCI status bit
- }
- If (And(CTRL, 0x04)) { // PME control granted?
- Store(0, PMCE) // clear the PME SCI enable bit
- Store(1, PMCS) // clear the PME SCI status bit
- }
- If (And(CTRL, 0x10)) { // OS restoring PCI Express cap
structure?
- // Set status to not restore PCI Express cap
structure
- // upon resume from S3
- Store(1, S3CR)
- }
- }
-#endif
- If (LNotEqual(Arg1, One)) {
- // Unknown revision
- Or(CDW1, 0x08, CDW1)
- }
- If (LNotEqual(CDW3, CTRL)) {
- // Capabilities bits were masked
- Or(CDW1, 0x10, CDW1)
- }
- // Update DWORD3 in the buffer
- Store(CTRL, CDW3)
- } Else {
- Or(CDW1, 4, CDW1) // Unrecognized UUID
- }
- Return (Arg3)
- }
}
}
}
--
MST
- [Qemu-devel] [PULL 40/59] pc: acpi: piix4: acpi move PCI0 device to SSDT, (continued)
- [Qemu-devel] [PULL 40/59] pc: acpi: piix4: acpi move PCI0 device to SSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 41/59] pc: acpi: q35: move GSI links to SSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 42/59] pc: acpi: q35: move link devices to SSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 43/59] pc: acpi: q35: move IQCR() into SSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 44/59] pc: acpi: q35: move IQST() into SSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 45/59] pc: acpi: q35: move ISA bridge into SSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 47/59] pc: acpi: q35: move PRTA routing table into SSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 46/59] pc: acpi: q35: move _PRT() into SSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 49/59] pc: acpi: q35: move _PIC() method into SSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 48/59] pc: acpi: q35: move PRTP routing table into SSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 50/59] pc: acpi: q35: move PCI0._OSC() method into SSDT,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 52/59] pc: acpi: q35: PCST, PCSB opregions and PCIB field into SSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 51/59] pc: acpi: q35: move PCI0 device definition into SSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 53/59] pc: acpi: switch to AML API composed DSDT, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 56/59] Add VMSTATE_STRUCT_VARRAY_KNOWN, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 55/59] i386/pc: expose identifying the floppy controller, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 57/59] migration/virtio: Remove simple .get/.put use, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 58/59] ivshmem: Store file descriptor for vhost-user negotiation, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 59/59] virtio: fix error message for number of queues, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 54/59] pc: acpi: remove unused ASL templates and related blobs/utils, Michael S. Tsirkin, 2016/01/08
- [Qemu-devel] [PULL 01/59] nvdimm: fix header pointer in nvdimm_build_nfit(), Michael S. Tsirkin, 2016/01/08