From patchwork Tue Mar 8 11:18:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 8532101 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A3FE8C0553 for ; Tue, 8 Mar 2016 11:22:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 08A03200ED for ; Tue, 8 Mar 2016 11:22:29 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 45BAB200E7 for ; Tue, 8 Mar 2016 11:22:28 +0000 (UTC) Received: from localhost ([::1]:33826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adFid-0004gD-M1 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 08 Mar 2016 06:22:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adFfS-00005g-Gh for qemu-devel@nongnu.org; Tue, 08 Mar 2016 06:19:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adFfP-0001Ax-B2 for qemu-devel@nongnu.org; Tue, 08 Mar 2016 06:19:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60808) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adFfP-0001Am-4d for qemu-devel@nongnu.org; Tue, 08 Mar 2016 06:19:07 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id CFF948DFFA; Tue, 8 Mar 2016 11:19:06 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-59.ams2.redhat.com [10.36.116.59]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u28BJ5tI002874; Tue, 8 Mar 2016 06:19:06 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id A3A8782757; Tue, 8 Mar 2016 12:19:04 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 8 Mar 2016 12:18:58 +0100 Message-Id: <1457435941-17578-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1457435941-17578-1-git-send-email-kraxel@redhat.com> References: <1457435941-17578-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Eduardo Habkost , "Michael S. Tsirkin" , "Gabriel L. Somlo" , Gerd Hoffmann , Paolo Bonzini , Igor Mammedov , Richard Henderson Subject: [Qemu-devel] [PULL 3/6] acpi: pc: add fw_cfg device node to dsdt 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Gabriel L. Somlo" Add a fw_cfg device node to the ACPI DSDT. While the guest-side firmware can't utilize this information (since it has to access the hard-coded fw_cfg device to extract ACPI tables to begin with), having fw_cfg listed in ACPI will help the guest kernel keep a more accurate inventory of in-use IO port regions. Signed-off-by: Gabriel Somlo Reviewed-by: Laszlo Ersek Reviewed-by: Marc MarĂ­ Reviewed-by: Michael S. Tsirkin Message-id: 1455906029-25565-4-git-send-email-somlo@cmu.edu Signed-off-by: Gerd Hoffmann --- hw/i386/acpi-build.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 52c9470..b888008 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2190,6 +2190,35 @@ build_dsdt(GArray *table_data, GArray *linker, aml_append(scope, aml_name_decl("_S5", pkg)); aml_append(dsdt, scope); + /* create fw_cfg node, unconditionally */ + { + /* when using port i/o, the 8-bit data register *always* overlaps + * with half of the 16-bit control register. Hence, the total size + * of the i/o region used is FW_CFG_CTL_SIZE; when using DMA, the + * DMA control register is located at FW_CFG_DMA_IO_BASE + 4 */ + uint8_t io_size = object_property_get_bool(OBJECT(pcms->fw_cfg), + "dma_enabled", NULL) ? + ROUND_UP(FW_CFG_CTL_SIZE, 4) + sizeof(dma_addr_t) : + FW_CFG_CTL_SIZE; + + scope = aml_scope("\\_SB.PCI0"); + dev = aml_device("FWCF"); + + aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002"))); + + /* device present, functioning, decoding, not shown in UI */ + aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); + + crs = aml_resource_template(); + aml_append(crs, + aml_io(AML_DECODE16, FW_CFG_IO_BASE, FW_CFG_IO_BASE, 0x01, io_size) + ); + aml_append(dev, aml_name_decl("_CRS", crs)); + + aml_append(scope, dev); + aml_append(dsdt, scope); + } + if (misc->applesmc_io_base) { scope = aml_scope("\\_SB.PCI0.ISA"); dev = aml_device("SMC");