From patchwork Thu Aug 25 10:14:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Peng X-Patchwork-Id: 9299113 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 57E3E60757 for ; Thu, 25 Aug 2016 10:23:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47CCE2926B for ; Thu, 25 Aug 2016 10:23:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B8DC2926F; Thu, 25 Aug 2016 10:23:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D6E042926B for ; Thu, 25 Aug 2016 10:23:58 +0000 (UTC) Received: from localhost ([::1]:55435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcrpF-0003GP-S6 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 25 Aug 2016 06:23:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34526) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcroa-000350-Ob for qemu-devel@nongnu.org; Thu, 25 Aug 2016 06:23:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bcroY-0001YU-P6 for qemu-devel@nongnu.org; Thu, 25 Aug 2016 06:23:15 -0400 Received: from mga03.intel.com ([134.134.136.65]:15072) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bcroY-0001Ur-IO for qemu-devel@nongnu.org; Thu, 25 Aug 2016 06:23:14 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 25 Aug 2016 03:23:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,575,1464678000"; d="scan'208";a="160747033" Received: from vmm-docker1.bj.intel.com ([10.240.193.52]) by fmsmga004.fm.intel.com with ESMTP; 25 Aug 2016 03:23:13 -0700 From: Chao Peng To: qemu-devel@nongnu.org Date: Thu, 25 Aug 2016 06:14:58 -0400 Message-Id: <1472120105-29235-6-git-send-email-chao.p.peng@linux.intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1472120105-29235-1-git-send-email-chao.p.peng@linux.intel.com> References: <1472120105-29235-1-git-send-email-chao.p.peng@linux.intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.65 Subject: [Qemu-devel] [RFC PATCH v2 05/12] acpi: build static _PRT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Haozhong Zhang , Xiao Guangrong , Eduardo Habkost , "Michael S. Tsirkin" , Paolo Bonzini , gor Mammedov , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP ...to reduce the interpretation burden for guest ACPI component. Signed-off-by: Chao Peng --- hw/i386/acpi-build.c | 31 ++++++++++++++++++++++++++++++- hw/i386/pc.c | 1 + include/hw/i386/pc.h | 2 ++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index a26a4bb..60c0896 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1772,6 +1772,31 @@ static void build_q35_pci0_int(Aml *table) aml_append(table, sb_scope); } +static void build_static_q35_pci0_int(Aml *table) +{ + int i, j; + Aml *method, *res, *pkg; + Aml *sb_scope = aml_scope("_SB"); + Aml *pci0_scope = aml_scope("PCI0"); + + method = aml_method("_PRT", 0, AML_NOTSERIALIZED); + res = aml_package(128); + for (i = 0; i < 32; i++) { + for (j = 0; j < 4; j++) { + pkg = aml_package(4); + aml_append(pkg, aml_int((i << 16) | 0xffff)); + aml_append(pkg, aml_int(j)); + aml_append(pkg, aml_int(0)); + aml_append(pkg, aml_int(0x10 + j)); + aml_append(res, pkg); + } + } + + aml_append(method, aml_return(res)); + aml_append(pci0_scope, method); + aml_append(sb_scope, pci0_scope); +} + static void build_q35_isa_bridge(Aml *table) { Aml *dev; @@ -2007,7 +2032,11 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, build_hpet_aml(dsdt); build_q35_isa_bridge(dsdt); build_isa_devices_aml(dsdt); - build_q35_pci0_int(dsdt); + if (pcms->static_prt) { + build_static_q35_pci0_int(dsdt); + } else { + build_q35_pci0_int(dsdt); + } } if (pcmc->legacy_cpu_hotplug) { diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 1d62957..f479697 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2196,6 +2196,7 @@ static void pc_machine_initfn(Object *obj) PC_MACHINE_DEFINE_PROP_BOOL(pcms, PC_MACHINE_SATA, sata, true); PC_MACHINE_DEFINE_PROP_BOOL(pcms, PC_MACHINE_PIC, pic, true); PC_MACHINE_DEFINE_PROP_BOOL(pcms, PC_MACHINE_PIT, pit, true); + PC_MACHINE_DEFINE_PROP_BOOL(pcms, PC_MACHINE_STATIC_PRT, static_prt, false); } static void pc_machine_reset(void) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 1dc7954..55ab09a 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -81,6 +81,7 @@ struct PCMachineState { bool sata; bool pic; bool pit; + bool static_prt; }; #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" @@ -93,6 +94,7 @@ struct PCMachineState { #define PC_MACHINE_SATA "sata" #define PC_MACHINE_PIC "pic" #define PC_MACHINE_PIT "pit" +#define PC_MACHINE_STATIC_PRT "static-prt" /** * PCMachineClass: