From patchwork Mon Dec 28 17:02:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 561355 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4454E140C14 for ; Tue, 29 Dec 2015 04:17:57 +1100 (AEDT) Received: from localhost ([::1]:45437 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDbQh-0003rM-1b for incoming@patchwork.ozlabs.org; Mon, 28 Dec 2015 12:17:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDbCo-0000lt-Dt for qemu-devel@nongnu.org; Mon, 28 Dec 2015 12:03:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDbCn-0008CL-EB for qemu-devel@nongnu.org; Mon, 28 Dec 2015 12:03:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDbCn-0008C7-7E for qemu-devel@nongnu.org; Mon, 28 Dec 2015 12:03:33 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id D6B09F5DE0 for ; Mon, 28 Dec 2015 17:03:32 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBSH2wJU021909 for ; Mon, 28 Dec 2015 12:03:32 -0500 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 28 Dec 2015 18:02:47 +0100 Message-Id: <1451322178-261185-40-git-send-email-imammedo@redhat.com> In-Reply-To: <1451321851-260744-1-git-send-email-imammedo@redhat.com> References: <1451321851-260744-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 40/51] pc: acpi: q35: move IQCR() into SSDT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Igor Mammedov --- hw/i386/acpi-build.c | 51 ++++++++++++++++++++++++++++++----------------- hw/i386/q35-acpi-dsdt.dsl | 9 --------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 9736da3..94f18ea 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1523,6 +1523,36 @@ static Aml *build_gsi_link_dev(const char *name, uint8_t uid, uint8_t gsi) return dev; } +/* _CRS method - get current settings */ +static Aml *build_iqcr_method(bool is_piix4) +{ + Aml *if_ctx; + uint32_t irqs; + Aml *method = aml_method("IQCR", 1, AML_SERIALIZED); + Aml *crs = aml_resource_template(); + + irqs = 0; + aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, + AML_ACTIVE_HIGH, AML_SHARED, &irqs, 1)); + aml_append(method, aml_name_decl("PRR0", crs)); + + aml_append(method, + aml_create_dword_field(aml_name("PRR0"), aml_int(5), "PRRI")); + + if (is_piix4) { + if_ctx = aml_if(aml_lless(aml_arg(0), aml_int(0x80))); + aml_append(if_ctx, aml_store(aml_arg(0), aml_name("PRRI"))); + aml_append(method, if_ctx); + } else { + aml_append(method, + aml_store(aml_and(aml_arg(0), aml_int(0xF), NULL), + aml_name("PRRI"))); + } + + aml_append(method, aml_return(aml_name("PRR0"))); + return method; +} + static void build_piix4_pci0_int(Aml *table) { Aml *dev; @@ -1554,24 +1584,7 @@ static void build_piix4_pci0_int(Aml *table) } aml_append(sb_scope, method); - /* _CRS method - get current settings */ - method = aml_method("IQCR", 1, AML_SERIALIZED); - { - crs = aml_resource_template(); - irqs = 0; - aml_append(crs, aml_interrupt(AML_CONSUMER, AML_LEVEL, - AML_ACTIVE_HIGH, AML_SHARED, &irqs, 1)); - aml_append(method, aml_name_decl("PRR0", crs)); - - aml_append(method, - aml_create_dword_field(aml_name("PRR0"), aml_int(5), "PRRI")); - - if_ctx = aml_if(aml_lless(aml_arg(0), aml_int(0x80))); - aml_append(if_ctx, aml_store(aml_arg(0), aml_name("PRRI"))); - aml_append(method, if_ctx); - aml_append(method, aml_return(aml_name("PRR0"))); - } - aml_append(sb_scope, method); + aml_append(sb_scope, build_iqcr_method(true)); aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQ0"))); aml_append(sb_scope, build_link_dev("LNKB", 1, aml_name("PRQ1"))); @@ -1617,6 +1630,8 @@ static void build_q35_pci0_int(Aml *table) { Aml *sb_scope = aml_scope("_SB"); + aml_append(sb_scope, build_iqcr_method(false)); + aml_append(sb_scope, build_link_dev("LNKA", 0, aml_name("PRQA"))); aml_append(sb_scope, build_link_dev("LNKB", 1, aml_name("PRQB"))); aml_append(sb_scope, build_link_dev("LNKC", 2, aml_name("PRQC"))); diff --git a/hw/i386/q35-acpi-dsdt.dsl b/hw/i386/q35-acpi-dsdt.dsl index 2da3515..85b0a2c 100644 --- a/hw/i386/q35-acpi-dsdt.dsl +++ b/hw/i386/q35-acpi-dsdt.dsl @@ -305,15 +305,6 @@ DefinitionBlock ( } Return (0x0B) } - Method(IQCR, 1, Serialized) { - // _CRS method - get current settings - Name(PRR0, ResourceTemplate() { - Interrupt(, Level, ActiveHigh, Shared) { 0 } - }) - CreateDWordField(PRR0, 0x05, PRRI) - Store(And(Arg0, 0x0F), PRRI) - Return (PRR0) - } External(LNKA, DeviceObj) External(LNKB, DeviceObj)