From nobody Sun May 19 09:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585901400; cv=none; d=zohomail.com; s=zohoarc; b=ZRrIkAvDw23PibotF3VZC5SAMh0T50N3XN4I47quq5Uq5es6nKRr0S8kfe7UPHJxMSmDi44qCvtuURzq9kY0SfUPVCDiIbsxVU6W4Jo5YvojkyVhE+nOtnr7ipXc9s8CoU2jFcbsIjl+NIHkiMyRuN0ZWDOAxA1Rn7Kab6veWUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585901400; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=CSzAcZu7s7k/1ZKI/Bbx93vZqsuGlf7y/K31ABysumc=; b=B6aWZoR9cD5ibGeNBDTytv0DAtjXthlJ43omUu6BQzFXc17EzfPad6KLbsbQuEm0l9WnfU6dHPWYyj++twlm6Ve5CLULAPam8uyiTG75s0mtUtquk/UTJL/oQoguP0R5mP9wOhFvSqls3RIqC0MTgvfqd47M/ZNOpmcSoOg4DxE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585901400276435.19575862922215; Fri, 3 Apr 2020 01:10:00 -0700 (PDT) Received: from localhost ([::1]:51772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHOp-0000lp-1I for importer@patchew.org; Fri, 03 Apr 2020 04:09:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42319) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHKK-0000zj-7C for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKHKI-0007lL-SV for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:20 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:35034 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKHKI-0007kY-N0 for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:18 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-hqlF-L_lOqeNq0U0-Xi_eA-1; Fri, 03 Apr 2020 04:05:13 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6837100551A; Fri, 3 Apr 2020 08:05:12 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 067241147DA; Fri, 3 Apr 2020 08:05:04 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E1AAB17502; Fri, 3 Apr 2020 10:05:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585901118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CSzAcZu7s7k/1ZKI/Bbx93vZqsuGlf7y/K31ABysumc=; b=PSTg12J3It/ExnR3TN3ZaYolFBy7sG+yWpilmk2kYbmmscY4NEDYoiKajq/HdEnMBs8Jad /x5UrPRe/UTd3dBl4vwvSonKYf1JUnvDfCuj2kRM5rLxSBdPLuH0z9ercfAcxfbJ5DUgni Tw4bmF9/mkzuqlawbEWIurxBhj+iX/g= X-MC-Unique: hqlF-L_lOqeNq0U0-Xi_eA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 01/12] move 'typedef Aml' to qemu/types.h Date: Fri, 3 Apr 2020 10:04:51 +0200 Message-Id: <20200403080502.8154-2-kraxel@redhat.com> In-Reply-To: <20200403080502.8154-1-kraxel@redhat.com> References: <20200403080502.8154-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov --- include/hw/acpi/aml-build.h | 1 - include/qemu/typedefs.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index de4a4065682c..1bfe5844e984 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -32,7 +32,6 @@ struct Aml { uint8_t op; AmlBlockFlags block_flags; }; -typedef struct Aml Aml; =20 typedef enum { AML_COMPATIBILITY =3D 0, diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 375770a80f06..ecf3cde26c3c 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -24,6 +24,7 @@ typedef struct AdapterInfo AdapterInfo; typedef struct AddressSpace AddressSpace; typedef struct AioContext AioContext; +typedef struct Aml Aml; typedef struct AnnounceTimer AnnounceTimer; typedef struct BdrvDirtyBitmap BdrvDirtyBitmap; typedef struct BdrvDirtyBitmapIter BdrvDirtyBitmapIter; --=20 2.18.2 From nobody Sun May 19 09:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585901280; cv=none; d=zohomail.com; s=zohoarc; b=WbbaLi2BxClRrwNSEy8Y8GhMTKbpGPNnu8KwquO/XyuKu2+lAiBvkfeM6oY2WmjCVFdRHAgLY9cB9p/6m2FvGhKsQEk7291KG8zTr3B709i21WtWAFIqtGssF0CNSN6DK4Cr7+PzM4YnqrxaGRLXtZ+hDPJKRA7RMHMs6oaWtyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585901280; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=UMB9JjIaLrSst3MocdOc+Svn33XmTr9puid36pPNV4Y=; b=IMu6MO/+b0m2dPIQCE/+Kv4FQ3KBTWc7L8ZPYr9GdPSGU/D91cICNVOTuE00B7rbkWSCfBdYSZcbLZEwFB3aB3JDjVTWvubUpm6NJjLKMkUY8wiPhG2lscRbNjvxkcdJr11+StkeWMDmR5jJ5Ie+Rhr4xA6AKq8kqpj7IXGmkQk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585901280713390.2822431687206; Fri, 3 Apr 2020 01:08:00 -0700 (PDT) Received: from localhost ([::1]:51744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHMt-0005xS-Ei for importer@patchew.org; Fri, 03 Apr 2020 04:07:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42270) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHKJ-0000yZ-C0 for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKHKH-0007jJ-ND for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:18 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:34103 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKHKH-0007hk-Hq for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:17 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-482-9IXIftfFPOqM_xhz1QpNiQ-1; Fri, 03 Apr 2020 04:05:13 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3EEBCDB63; Fri, 3 Apr 2020 08:05:12 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14B2A25276; Fri, 3 Apr 2020 08:05:04 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EBA6217506; Fri, 3 Apr 2020 10:05:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585901116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UMB9JjIaLrSst3MocdOc+Svn33XmTr9puid36pPNV4Y=; b=HQ0MjnkGkDkzlGKno/ve55wVETs+Z8gojsO082doIo14uqluDmp4bZoTqEeA6yJa21kJ2q VJ+3KZXNKqf+kmQ9Dx/zrxhioNFeznZ8jh+kdbaqAvsCKzKGyhj23RvMuIyR4G0D/ak/a7 AweHShsaWU7RW5fp8/aVV+vDkdJ7vwk= X-MC-Unique: 9IXIftfFPOqM_xhz1QpNiQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 02/12] acpi: add aml builder stubs Date: Fri, 3 Apr 2020 10:04:52 +0200 Message-Id: <20200403080502.8154-3-kraxel@redhat.com> In-Reply-To: <20200403080502.8154-1-kraxel@redhat.com> References: <20200403080502.8154-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Needed when moving aml builder code to devices. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov --- hw/acpi/aml-build-stub.c | 79 ++++++++++++++++++++++++++++++++++++++++ hw/acpi/Makefile.objs | 4 +- 2 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 hw/acpi/aml-build-stub.c diff --git a/hw/acpi/aml-build-stub.c b/hw/acpi/aml-build-stub.c new file mode 100644 index 000000000000..58b2e162277f --- /dev/null +++ b/hw/acpi/aml-build-stub.c @@ -0,0 +1,79 @@ +/* + * ACPI aml builder stubs for platforms that don't support ACPI. + * + * Copyright (c) 2006 Fabrice Bellard + * Copyright (c) 2016 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "qemu/osdep.h" +#include "hw/acpi/acpi.h" +#include "hw/acpi/aml-build.h" + +void aml_append(Aml *parent_ctx, Aml *child) +{ +} + +Aml *aml_resource_template(void) +{ + return NULL; +} + +Aml *aml_device(const char *name_format, ...) +{ + return NULL; +} + +Aml *aml_eisaid(const char *str) +{ + return NULL; +} + +Aml *aml_name_decl(const char *name, Aml *val) +{ + return NULL; +} + +Aml *aml_io(AmlIODecode dec, uint16_t min_base, uint16_t max_base, + uint8_t aln, uint8_t len) +{ + return NULL; +} + +Aml *aml_irq_no_flags(uint8_t irq) +{ + return NULL; +} + +Aml *aml_int(const uint64_t val) +{ + return NULL; +} + +Aml *aml_package(uint8_t num_elements) +{ + return NULL; +} + +Aml *aml_dma(AmlDmaType typ, AmlDmaBusMaster bm, AmlTransferSize sz, + uint8_t channel) +{ + return NULL; +} + +Aml *aml_buffer(int buffer_size, uint8_t *byte_list) +{ + return NULL; +} diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs index 777da07f4d70..cab9bcd457dc 100644 --- a/hw/acpi/Makefile.objs +++ b/hw/acpi/Makefile.objs @@ -20,6 +20,6 @@ common-obj-$(CONFIG_TPM) +=3D tpm.o common-obj-$(CONFIG_IPMI) +=3D ipmi.o common-obj-$(call lnot,$(CONFIG_IPMI)) +=3D ipmi-stub.o else -common-obj-y +=3D acpi-stub.o +common-obj-y +=3D acpi-stub.o aml-build-stub.o endif -common-obj-$(CONFIG_ALL) +=3D acpi-stub.o acpi-x86-stub.o ipmi-stub.o +common-obj-$(CONFIG_ALL) +=3D acpi-stub.o aml-build-stub.o acpi-x86-stub.o= ipmi-stub.o --=20 2.18.2 From nobody Sun May 19 09:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585901256; cv=none; d=zohomail.com; s=zohoarc; b=hZoolLvHNfAhukI1lgGCL/NDZJLVaVLaxRIFBFHXVX0V4pzW/TygmSwlch1KNZcQeT7YAG7mm/BXcSR2sgb9YYRLQtczPHjbJegB4L2SXUmMicewePIuJvNVb6KaNeUh0+arYrw5J7Bddb7qDTYGeDIydOMZXgpXTekHfykPyE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585901256; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=tDvYI9qnFYs+oXzmsMFgzI0u/pj5+Ditow3Dy4Jt+20=; b=Ai9nFsbVUaGkfX+LgxzEy3mIZG4qQYucEbLMEkZ5YDb2MmZ2p2WakajUUVVocNEYx2bK7jgI/bgxOtdLqmvCi5v9/LST5L6ofOswUGam+KFk3SKDG4Rdi+jQNNvdaSE3pSqSglY3r13iMHHZvNacaWmYZG7KM6z9wayZx6vjEmE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585901256826227.45005364997257; Fri, 3 Apr 2020 01:07:36 -0700 (PDT) Received: from localhost ([::1]:51734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHMV-0005Cy-FN for importer@patchew.org; Fri, 03 Apr 2020 04:07:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42269) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHKJ-0000yX-C4 for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKHKH-0007jZ-NR for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:18 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:23668 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKHKH-0007f0-J7 for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:17 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-293-5cZRIKHYNvuemUYwUN030w-1; Fri, 03 Apr 2020 04:05:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D98C1005509; Fri, 3 Apr 2020 08:05:12 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id F080060BF3; Fri, 3 Apr 2020 08:05:03 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 002561750A; Fri, 3 Apr 2020 10:05:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585901114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tDvYI9qnFYs+oXzmsMFgzI0u/pj5+Ditow3Dy4Jt+20=; b=H15/WJjG5r/9wIrtTryvNkka2Ogdmdp7PJ3UIAZe61tML/Aez6qNh9uXOqt0DvEVpfFisG 7G/MuAJ9Cd5BC+GA2FDH0wF5IUvBGcTZt8swQOJREUCPTScUBUFLWLlBfif6E5wI+pank3 U1wxksJDgwOL1nGYILnV4Z/wrXSk66Q= X-MC-Unique: 5cZRIKHYNvuemUYwUN030w-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 03/12] acpi: drop pointless _STA method Date: Fri, 3 Apr 2020 10:04:53 +0200 Message-Id: <20200403080502.8154-4-kraxel@redhat.com> In-Reply-To: <20200403080502.8154-1-kraxel@redhat.com> References: <20200403080502.8154-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When returning a constant there is no point in having a method in the first place, _STA can be a simple integer instead. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov --- hw/i386/acpi-build.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 9a19c14e661b..214b98671bf2 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1151,14 +1151,11 @@ static Aml *build_kbd_device_aml(void) { Aml *dev; Aml *crs; - Aml *method; =20 dev =3D aml_device("KBD"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0303"))); =20 - method =3D aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_return(aml_int(0x0f))); - aml_append(dev, method); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); =20 crs =3D aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01)); @@ -1173,14 +1170,11 @@ static Aml *build_mouse_device_aml(void) { Aml *dev; Aml *crs; - Aml *method; =20 dev =3D aml_device("MOU"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0F13"))); =20 - method =3D aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_return(aml_int(0x0f))); - aml_append(dev, method); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); =20 crs =3D aml_resource_template(); aml_append(crs, aml_irq_no_flags(12)); @@ -2238,9 +2232,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, TPM_CRB_ADDR_SIZE, AML_READ_WRI= TE)); aml_append(dev, aml_name_decl("_CRS", crs)); =20 - method =3D aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_return(aml_int(0x0f))); - aml_append(dev, method); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); =20 tpm_build_ppi_acpi(tpm, dev); =20 --=20 2.18.2 From nobody Sun May 19 09:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585901363; cv=none; d=zohomail.com; s=zohoarc; b=aH/ePb3yI6I4DTGZ7+Hf+kf0sdLK1CvQUWQ2UcZXxgcudYp7Yy+CY0yqeA4rFZKQ2a0vtBrkXrF2YxXDtFwhs/Z5lZsHD5k2WnZFMVA4jwJFVR0TSveNAzz+YiHxMu91xhrwPj8z0cdol3mdwxS9ZTSXS7nvhrh9+jqpJ04Etoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585901363; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=2QjhBYYmcMogZYECE0Fvi0cN1gFN64R1LE+YCNAjg7w=; b=TxKEmqSu9Jx/BUiktVUrNH92FTuhBARJDjB/1UCUv77fQ0LcFrhzEOTTUDv11woF3PdsG4VVyKiMTWwXCEREwwM88FLGrKsrRJmCAcO7RBiZRMbxrRmEJ32FhCtSHKmp2i4AMeTPbzq0t1EzWXNLs+hnwnOR4nKQm6RMDmU0Kl0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 158590136380456.18600319315931; Fri, 3 Apr 2020 01:09:23 -0700 (PDT) Received: from localhost ([::1]:51767 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHOE-00083a-HY for importer@patchew.org; Fri, 03 Apr 2020 04:09:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42298) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHKJ-0000zG-NA for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKHKI-0007k9-6V for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:19 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:58638 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKHKI-0007jD-2a for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:18 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-41-GD8RC2ESPc6hZtooUBVWSg-1; Fri, 03 Apr 2020 04:05:14 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CE0D5800D5C; Fri, 3 Apr 2020 08:05:12 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 177AC1147DB; Fri, 3 Apr 2020 08:05:04 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 091A71750C; Fri, 3 Apr 2020 10:05:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585901117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2QjhBYYmcMogZYECE0Fvi0cN1gFN64R1LE+YCNAjg7w=; b=De1y61Hq/4UCbJEpAJEFSoiqakn5RhEjrvRVBET7TkoCJ8ON8Mr0McXIMSrL0vAPqPR+ps KNGM2+ZIy6gPjsFdmTszCy30iEb95HJ8+LFTd2Z7VPen+NPWhFoKNjvg+R9Kn3nCWnjQNg ikXnUkrLF1QVjqqw1+psBZ7tF3vQO+c= X-MC-Unique: GD8RC2ESPc6hZtooUBVWSg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 04/12] acpi: serial: don't use _STA method Date: Fri, 3 Apr 2020 10:04:54 +0200 Message-Id: <20200403080502.8154-5-kraxel@redhat.com> In-Reply-To: <20200403080502.8154-1-kraxel@redhat.com> References: <20200403080502.8154-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The _STA method dates back to the days where we had a static DSDT. The device is listed in the DSDT table unconditionally and the _STA method checks a bit in the isa bridge pci config space to figure whenever a given is isa device is present or not, then evaluates to 0x0f (present) or 0x00 (absent). These days the DSDT is generated by qemu anyway, so if a device is not present we can simply drop it from the DSDT instead. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov --- hw/i386/acpi-build.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 214b98671bf2..08433a06039f 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1218,50 +1218,34 @@ static Aml *build_lpt_device_aml(void) return dev; } =20 -static Aml *build_com_device_aml(uint8_t uid) +static void build_com_device_aml(Aml *scope, uint8_t uid) { Aml *dev; Aml *crs; - Aml *method; - Aml *if_ctx; - Aml *else_ctx; - Aml *zero =3D aml_int(0); - Aml *is_present =3D aml_local(0); - const char *enabled_field =3D "CAEN"; uint8_t irq =3D 4; uint16_t io_port =3D 0x03F8; =20 assert(uid =3D=3D 1 || uid =3D=3D 2); if (uid =3D=3D 2) { - enabled_field =3D "CBEN"; irq =3D 3; io_port =3D 0x02F8; } + if (!memory_region_present(get_system_io(), io_port)) { + return; + } =20 dev =3D aml_device("COM%d", uid); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0501"))); aml_append(dev, aml_name_decl("_UID", aml_int(uid))); =20 - method =3D aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_store(aml_name("%s", enabled_field), is_present= )); - if_ctx =3D aml_if(aml_equal(is_present, zero)); - { - aml_append(if_ctx, aml_return(aml_int(0x00))); - } - aml_append(method, if_ctx); - else_ctx =3D aml_else(); - { - aml_append(else_ctx, aml_return(aml_int(0x0f))); - } - aml_append(method, else_ctx); - aml_append(dev, method); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); =20 crs =3D aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, io_port, io_port, 0x00, 0x08)); aml_append(crs, aml_irq_no_flags(irq)); aml_append(dev, aml_name_decl("_CRS", crs)); =20 - return dev; + aml_append(scope, dev); } =20 static void build_isa_devices_aml(Aml *table) @@ -1279,8 +1263,8 @@ static void build_isa_devices_aml(Aml *table) aml_append(scope, build_fdc_device_aml(fdc)); } aml_append(scope, build_lpt_device_aml()); - aml_append(scope, build_com_device_aml(1)); - aml_append(scope, build_com_device_aml(2)); + build_com_device_aml(scope, 1); + build_com_device_aml(scope, 2); =20 if (ambiguous) { error_report("Multiple ISA busses, unable to define IPMI ACPI data= "); --=20 2.18.2 From nobody Sun May 19 09:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585901608; cv=none; d=zohomail.com; s=zohoarc; b=jb9hZVzcWL7dI8MhSdMwAu0Ls1c55S3x8gmPqAcaeqfJvoetQTGfAeQW8MVyo8y7Eh/H9c/XgjolTvkY7aHJUOM/n9iesPM43VwwyuxitVuyQ5NPMm1SfLqtCv6+cuvC+6Dt5BuJ/Xc6wCePdNirrJ1F6sneE6nl+94QFzKBb8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585901608; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=36a0gM6zDWJYaqRgRbMVQsFx61c7nsv103n4Pt2mH6k=; b=Y0dexdcTVB4UumA1zrPPBMDnNHbKm6IAWMkChXoiYs57XUA5YP518+c/VGZJz79qQXpFH89uWPX7zsfYGsEFWPQaqhrFHEB/E8zEwtsrYD42Io8l4ZSqEsfPiIK4GHebJAm87AmD+qCbq0Gulascy5KIKPiZU4KsKMounoFr4ek= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585901608101611.3224924730242; Fri, 3 Apr 2020 01:13:28 -0700 (PDT) Received: from localhost ([::1]:51846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHS9-00079H-Tp for importer@patchew.org; Fri, 03 Apr 2020 04:13:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42488) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHKR-0001C7-BE for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKHKP-00084O-QW for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:27 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:27312 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKHKP-00082P-LS for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:25 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-351-8BWE0HSKNwe5Z3FEconiiA-1; Fri, 03 Apr 2020 04:05:23 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 571D9DB62; Fri, 3 Apr 2020 08:05:22 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C9561001B0B; Fri, 3 Apr 2020 08:05:13 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1201B17510; Fri, 3 Apr 2020 10:05:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585901125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=36a0gM6zDWJYaqRgRbMVQsFx61c7nsv103n4Pt2mH6k=; b=P5/u6Oet2c6/WV4MtIoNPDBmPFbd/qwvxwDnCjyavpJYRBjXRm0S3ycJcQ4h0E2Y3bdC2v BLU3rZpLasxoXz/j6OL0he+yuomOimyXr+/RfR3NCwhgoWdcYbTxxrxI2IrLi3eS/mQhCE Zjk2yF3QoEU/CtLStXoEkvNFcOaLWd0= X-MC-Unique: 8BWE0HSKNwe5Z3FEconiiA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 05/12] acpi: parallel: don't use _STA method Date: Fri, 3 Apr 2020 10:04:55 +0200 Message-Id: <20200403080502.8154-6-kraxel@redhat.com> In-Reply-To: <20200403080502.8154-1-kraxel@redhat.com> References: <20200403080502.8154-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The _STA method dates back to the days where we had a static DSDT. The device is listed in the DSDT table unconditionally and the _STA method checks a bit in the isa bridge pci config space to figure whenever a given is isa device is present or not, then evaluates to 0x0f (present) or 0x00 (absent). These days the DSDT is generated by qemu anyway, so if a device is not present we can simply drop it from the DSDT instead. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov --- hw/i386/acpi-build.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 08433a06039f..5d2b9b099684 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1183,39 +1183,26 @@ static Aml *build_mouse_device_aml(void) return dev; } =20 -static Aml *build_lpt_device_aml(void) +static void build_lpt_device_aml(Aml *scope) { Aml *dev; Aml *crs; - Aml *method; - Aml *if_ctx; - Aml *else_ctx; - Aml *zero =3D aml_int(0); - Aml *is_present =3D aml_local(0); + + if (!memory_region_present(get_system_io(), 0x0378)) { + return; + } =20 dev =3D aml_device("LPT"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0400"))); =20 - method =3D aml_method("_STA", 0, AML_NOTSERIALIZED); - aml_append(method, aml_store(aml_name("LPEN"), is_present)); - if_ctx =3D aml_if(aml_equal(is_present, zero)); - { - aml_append(if_ctx, aml_return(aml_int(0x00))); - } - aml_append(method, if_ctx); - else_ctx =3D aml_else(); - { - aml_append(else_ctx, aml_return(aml_int(0x0f))); - } - aml_append(method, else_ctx); - aml_append(dev, method); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); =20 crs =3D aml_resource_template(); aml_append(crs, aml_io(AML_DECODE16, 0x0378, 0x0378, 0x08, 0x08)); aml_append(crs, aml_irq_no_flags(7)); aml_append(dev, aml_name_decl("_CRS", crs)); =20 - return dev; + aml_append(scope, dev); } =20 static void build_com_device_aml(Aml *scope, uint8_t uid) @@ -1262,7 +1249,7 @@ static void build_isa_devices_aml(Aml *table) if (fdc) { aml_append(scope, build_fdc_device_aml(fdc)); } - aml_append(scope, build_lpt_device_aml()); + build_lpt_device_aml(scope); build_com_device_aml(scope, 1); build_com_device_aml(scope, 2); =20 --=20 2.18.2 From nobody Sun May 19 09:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585901468; cv=none; d=zohomail.com; s=zohoarc; b=IPlNujRqkwRcKC7uM0ZBrCfXy8ZfqfzQIxfA0O+R2SJLrWE8IlJpQjG0hCdjXLh6WoTai+MZM9SxBuyGGNbjEjsEMR1n5KGjzwq5079dWAaKshzTxRNJgWvKZ3Win2c9Q/1h4e8OSd/PZqBHojQE1zscoRZ9mY75gbPCSk3vSL0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585901468; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=4YbRkhcht6AfyVCgYgKokBY6y6+1gGLr7bQc2d2xUGA=; b=BQZAfkbmv0ZQneokUwIUSprBXsfJKzdPexo+5blty4ZptPdFSv2CHus/wuM/xwTEE9zYPMPYOkhmAak+I9EsPM82i3cgR3gP03MU/bq3ZNuWGpYn+7k3g2x88+NRa89iKxrPtQr2wEymuh7ueCt8+n4MbceXhgI9qxecqjARbgk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585901468724955.0416311388029; Fri, 3 Apr 2020 01:11:08 -0700 (PDT) Received: from localhost ([::1]:51810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHPv-0003CR-3Y for importer@patchew.org; Fri, 03 Apr 2020 04:11:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42365) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHKL-00011E-El for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKHKK-0007nn-3p for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:21 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:39708 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKHKJ-0007nR-Ve for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-61-TkiDnXzpNNWJ1Aeqji_rkw-1; Fri, 03 Apr 2020 04:05:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 82F67107ACCC; Fri, 3 Apr 2020 08:05:13 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1676860BF3; Fri, 3 Apr 2020 08:05:13 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1D9AC17511; Fri, 3 Apr 2020 10:05:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585901119; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4YbRkhcht6AfyVCgYgKokBY6y6+1gGLr7bQc2d2xUGA=; b=f6X4YiTVv4pk9+SQVzsBBdZbwX34pY32OLi8tjNXeUGc6WzPR8x+/vk8786fTAH1jvQbod OmHblkTyKL8XQYRvsiexMgnAmdknsqMndqCBJKqI3F4SloibmPI7+Npd145yWzm3pAYfum GV4Qd3xUkhXWvcuHMYFyzkoIy9IB1lI= X-MC-Unique: TkiDnXzpNNWJ1Aeqji_rkw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 06/12] acpi: add ISADeviceClass->build_aml() Date: Fri, 3 Apr 2020 10:04:56 +0200 Message-Id: <20200403080502.8154-7-kraxel@redhat.com> In-Reply-To: <20200403080502.8154-1-kraxel@redhat.com> References: <20200403080502.8154-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Also add isa_aml_build() function which walks all isa devices. This allows to move aml builder code to isa devices. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov --- include/hw/isa/isa.h | 2 ++ hw/i386/acpi-build.c | 1 + hw/isa/isa-bus.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+) diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index e9ac1f1205a4..1534f8826453 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -70,6 +70,7 @@ typedef struct IsaDmaClass { =20 typedef struct ISADeviceClass { DeviceClass parent_class; + void (*build_aml)(ISADevice *dev, Aml *scope); } ISADeviceClass; =20 struct ISABus { @@ -108,6 +109,7 @@ ISADevice *isa_try_create(ISABus *bus, const char *name= ); ISADevice *isa_create_simple(ISABus *bus, const char *name); =20 ISADevice *isa_vga_init(ISABus *bus); +void isa_build_aml(ISABus *bus, Aml *scope); =20 /** * isa_register_ioport: Install an I/O port region on the ISA bus. diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 5d2b9b099684..77fc9df74735 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1259,6 +1259,7 @@ static void build_isa_devices_aml(Aml *table) error_report("No ISA bus, unable to define IPMI ACPI data"); } else { build_acpi_ipmi_devices(scope, BUS(obj), "\\_SB.PCI0.ISA"); + isa_build_aml(ISA_BUS(obj), scope); } =20 aml_append(table, scope); diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 798dd9194e8f..1f2189f4d5db 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -207,6 +207,21 @@ ISADevice *isa_vga_init(ISABus *bus) } } =20 +void isa_build_aml(ISABus *bus, Aml *scope) +{ + BusChild *kid; + ISADevice *dev; + ISADeviceClass *dc; + + QTAILQ_FOREACH(kid, &bus->parent_obj.children, sibling) { + dev =3D ISA_DEVICE(kid->child); + dc =3D ISA_DEVICE_GET_CLASS(dev); + if (dc->build_aml) { + dc->build_aml(dev, scope); + } + } +} + static void isabus_dev_print(Monitor *mon, DeviceState *dev, int indent) { ISADevice *d =3D ISA_DEVICE(dev); --=20 2.18.2 From nobody Sun May 19 09:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585901420; cv=none; d=zohomail.com; s=zohoarc; b=Bv922H0bqWxyTK+89PWAwpD/cZsneIp2PkknDq4onNOYhh60PJwppUMEIDPmq46Lv0hAYXk9y4/w2y2NqasjlHM8T/ogRA6c/CkkvSVe7ng4SpAIf2ms1gSYRd5bh7rFEUPqzvZlnzxaFbB4s9uaWD3zkU0qtEleONiT8fUISkY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585901420; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=au+ftCWiyMVF3p9xesX8HOpqmz5SPvAmV5KTmzx8jA8=; b=HGCQp3gpyABRlrkBjVzusMLEcdAKUOQ8/vr3yeDFRA1VrKvs3I5kAq0g0Ziffy9LZ9MOP210h7Q0tB+opV37BUp4xtWlwuhePHJ70LRdmzwILS/+M0RKcM5sYolTWiPmyYUiiMKjKBbHGjDB2nIbkqRB+XKYPLmOCkSiiClxqFo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585901420703970.950527569538; Fri, 3 Apr 2020 01:10:20 -0700 (PDT) Received: from localhost ([::1]:51782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHP9-0001SU-FM for importer@patchew.org; Fri, 03 Apr 2020 04:10:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42508) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHKS-0001DT-2v for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKHKQ-00087H-Ko for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:27 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:52782 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKHKQ-00085Z-Fg for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:26 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-lmBeScouM6uBcLRQ3bfw_A-1; Fri, 03 Apr 2020 04:05:22 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7CB84107ACCA; Fri, 3 Apr 2020 08:05:21 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 569055C1DC; Fri, 3 Apr 2020 08:05:13 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2B80D17516; Fri, 3 Apr 2020 10:05:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585901126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=au+ftCWiyMVF3p9xesX8HOpqmz5SPvAmV5KTmzx8jA8=; b=OTIUlIs9wy3/Pze5uv54WEPMBE4tQiXZ4qWUxhjGN8TCzBNz7sKEeY7V5XL1Uji3hX67ca 3lUV4GV3e0urTI23QFvfndyQ9SViuPuXmMFxbUFHrHkfexdHFvG2Nvi8+JkQxA9K2sOES3 3K50U9zB+PnDoP6HowzKqVTe9TBOqTE= X-MC-Unique: lmBeScouM6uBcLRQ3bfw_A-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 07/12] acpi: move aml builder code for rtc device Date: Fri, 3 Apr 2020 10:04:57 +0200 Message-Id: <20200403080502.8154-8-kraxel@redhat.com> In-Reply-To: <20200403080502.8154-1-kraxel@redhat.com> References: <20200403080502.8154-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann --- hw/i386/acpi-build.c | 17 ----------------- hw/rtc/mc146818rtc.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 77fc9df74735..a5bc7764e611 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1131,22 +1131,6 @@ static Aml *build_fdc_device_aml(ISADevice *fdc) return dev; } =20 -static Aml *build_rtc_device_aml(void) -{ - Aml *dev; - Aml *crs; - - dev =3D aml_device("RTC"); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0B00"))); - crs =3D aml_resource_template(); - aml_append(crs, aml_io(AML_DECODE16, 0x0070, 0x0070, 0x10, 0x02)); - aml_append(crs, aml_irq_no_flags(8)); - aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06)); - aml_append(dev, aml_name_decl("_CRS", crs)); - - return dev; -} - static Aml *build_kbd_device_aml(void) { Aml *dev; @@ -1243,7 +1227,6 @@ static void build_isa_devices_aml(Aml *table) Aml *scope =3D aml_scope("_SB.PCI0.ISA"); Object *obj =3D object_resolve_path_type("", TYPE_ISA_BUS, &ambiguous); =20 - aml_append(scope, build_rtc_device_aml()); aml_append(scope, build_kbd_device_aml()); aml_append(scope, build_mouse_device_aml()); if (fdc) { diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c index dc4269cc55cb..814263c01a90 100644 --- a/hw/rtc/mc146818rtc.c +++ b/hw/rtc/mc146818rtc.c @@ -27,6 +27,7 @@ #include "qemu/cutils.h" #include "qemu/module.h" #include "qemu/bcd.h" +#include "hw/acpi/aml-build.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "qemu/timer.h" @@ -1008,13 +1009,32 @@ static void rtc_resetdev(DeviceState *d) } } =20 +static void rtc_build_aml(ISADevice *isadev, Aml *scope) +{ + Aml *dev; + Aml *crs; + + crs =3D aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, 0x0070, 0x0070, 0x10, 0x02)); + aml_append(crs, aml_irq_no_flags(8)); + aml_append(crs, aml_io(AML_DECODE16, 0x0072, 0x0072, 0x02, 0x06)); + + dev =3D aml_device("RTC"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0B00"))); + aml_append(dev, aml_name_decl("_CRS", crs)); + + aml_append(scope, dev); +} + static void rtc_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + ISADeviceClass *isa =3D ISA_DEVICE_CLASS(klass); =20 dc->realize =3D rtc_realizefn; dc->reset =3D rtc_resetdev; dc->vmsd =3D &vmstate_rtc; + isa->build_aml =3D rtc_build_aml; device_class_set_props(dc, mc146818rtc_properties); } =20 --=20 2.18.2 From nobody Sun May 19 09:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585901303; cv=none; d=zohomail.com; s=zohoarc; b=k9gIgYpSNNY6bbOkCA1cq2bFUbk5jfhNLeLnlHQHAL8VGga/tOOUkje6NXiqJa5qN/SaV46+WNammpLfCLBT+d14dwBcySJpFdSm2fRyhs+2j4wLkoAzwNT1ualALMoqRpMQhQPOYcNllIuiv+mxgk0j3kbMCgnK7J6TxSOf9Ps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585901303; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=PwR1qMIBjIcDZdiTa5Rr4gGe3uQy/EM8NiTlQ6geYmo=; b=jg2Y5EiFgJZn5ziETTJm5L6RVbWpiSZ4Xz7gahTNw/bgO03Va63PbGUVy4n47jhxTFuOQNEkb8XfpOz/Goxj5ryCVWz9vmYSdNXxJwAyjdEn2Z6R/NLRm8q0nuXOuA9TbOOOoCLIL34XGMFfcp8/CgUfeiOWVa3pPb+hakscF0M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585901303807325.28807325640946; Fri, 3 Apr 2020 01:08:23 -0700 (PDT) Received: from localhost ([::1]:51748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHNG-0006gl-IN for importer@patchew.org; Fri, 03 Apr 2020 04:08:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42442) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHKQ-00019d-5z for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKHKO-0007z8-KA for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:25 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:27579 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKHKO-0007xG-Eh for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:24 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-323-ZNMPMIdTMVi0TodkNZxd1A-1; Fri, 03 Apr 2020 04:05:22 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 38FC7107ACC7; Fri, 3 Apr 2020 08:05:21 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5163D5C1D6; Fri, 3 Apr 2020 08:05:13 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 362E717517; Fri, 3 Apr 2020 10:05:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585901124; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PwR1qMIBjIcDZdiTa5Rr4gGe3uQy/EM8NiTlQ6geYmo=; b=B5noisZ6rAoZaILSjz2lf2PHVOH9ffNBeqtW16uQEF/Hz8//hi9TAFF0inHUI263QvGDMC fujo2Y1sAemTeI0/hE9/BqpOvR8JFCZspahM7U+Go21PvF/jvpjWhLNz48laIqIjkmiXpo 9TTyM8D3+ZVi6j1PfLAexkeQCszWe08= X-MC-Unique: ZNMPMIdTMVi0TodkNZxd1A-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 08/12] acpi: move aml builder code for serial device Date: Fri, 3 Apr 2020 10:04:58 +0200 Message-Id: <20200403080502.8154-9-kraxel@redhat.com> In-Reply-To: <20200403080502.8154-1-kraxel@redhat.com> References: <20200403080502.8154-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The code uses the isa_serial_io array to figure what the device uid is. Side effect is that acpi antries are not limited to port 1+2 any more, we'll also get entries for ports 3+4. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov --- hw/char/serial-isa.c | 32 ++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 32 -------------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index f9b6eed7833d..f7c19a398ced 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -27,6 +27,7 @@ #include "qapi/error.h" #include "qemu/module.h" #include "sysemu/sysemu.h" +#include "hw/acpi/aml-build.h" #include "hw/char/serial.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" @@ -81,6 +82,35 @@ static void serial_isa_realizefn(DeviceState *dev, Error= **errp) isa_register_ioport(isadev, &s->io, isa->iobase); } =20 +static void serial_isa_build_aml(ISADevice *isadev, Aml *scope) +{ + ISASerialState *isa =3D ISA_SERIAL(isadev); + int i, uid =3D 0; + Aml *dev; + Aml *crs; + + for (i =3D 0; i < ARRAY_SIZE(isa_serial_io); i++) { + if (isa->iobase =3D=3D isa_serial_io[i]) { + uid =3D i + 1; + } + } + if (!uid) { + return; + } + + crs =3D aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, isa->iobase, isa->iobase, 0x00, 0= x08)); + aml_append(crs, aml_irq_no_flags(isa->isairq)); + + dev =3D aml_device("COM%d", uid); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0501"))); + aml_append(dev, aml_name_decl("_UID", aml_int(uid))); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); + aml_append(dev, aml_name_decl("_CRS", crs)); + + aml_append(scope, dev); +} + static const VMStateDescription vmstate_isa_serial =3D { .name =3D "serial", .version_id =3D 3, @@ -103,9 +133,11 @@ static Property serial_isa_properties[] =3D { static void serial_isa_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + ISADeviceClass *isa =3D ISA_DEVICE_CLASS(klass); =20 dc->realize =3D serial_isa_realizefn; dc->vmsd =3D &vmstate_isa_serial; + isa->build_aml =3D serial_isa_build_aml; device_class_set_props(dc, serial_isa_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index a5bc7764e611..81805bf85f8d 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1189,36 +1189,6 @@ static void build_lpt_device_aml(Aml *scope) aml_append(scope, dev); } =20 -static void build_com_device_aml(Aml *scope, uint8_t uid) -{ - Aml *dev; - Aml *crs; - uint8_t irq =3D 4; - uint16_t io_port =3D 0x03F8; - - assert(uid =3D=3D 1 || uid =3D=3D 2); - if (uid =3D=3D 2) { - irq =3D 3; - io_port =3D 0x02F8; - } - if (!memory_region_present(get_system_io(), io_port)) { - return; - } - - dev =3D aml_device("COM%d", uid); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0501"))); - aml_append(dev, aml_name_decl("_UID", aml_int(uid))); - - aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); - - crs =3D aml_resource_template(); - aml_append(crs, aml_io(AML_DECODE16, io_port, io_port, 0x00, 0x08)); - aml_append(crs, aml_irq_no_flags(irq)); - aml_append(dev, aml_name_decl("_CRS", crs)); - - aml_append(scope, dev); -} - static void build_isa_devices_aml(Aml *table) { ISADevice *fdc =3D pc_find_fdc0(); @@ -1233,8 +1203,6 @@ static void build_isa_devices_aml(Aml *table) aml_append(scope, build_fdc_device_aml(fdc)); } build_lpt_device_aml(scope); - build_com_device_aml(scope, 1); - build_com_device_aml(scope, 2); =20 if (ambiguous) { error_report("Multiple ISA busses, unable to define IPMI ACPI data= "); --=20 2.18.2 From nobody Sun May 19 09:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585901537; cv=none; d=zohomail.com; s=zohoarc; b=Dr87+4L+1ZoFSMf8sfXa6tXIsf9uEbeUQ4w+kVNiOvYaT51AWvLdJ2nnbkqRzoQPWILhAp4/4M9ox5PqzHJYS4/Aau5wfM2pIb7P2OEY3yTiVRcxBc/b/vyTIRGI922P5UGhcvGrZjAHPyHdXkzDJsxBaX7+3budW1mkSOPWxX4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585901537; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=r99+xr/K8ZWPvia6jlsOxj2nEFdhjeSpcRRYkO8Mf1M=; b=Q9JZaA5NSbuwm15ugKFIqmro621toIz1vKcpXhVd1gSBpaHuK8lmgwJrb4yEkg6yl0MSeQEr01rtbtZKXVZl0mwCbc1MDPlYzQlPpG+E2CqtTSeJ6d6S10BtBWTa5DyhlV49wW6lX8Qd/sKZAl/yP6Sc9yoPd0/6bOmSQr0emXc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585901537575298.3631332198646; Fri, 3 Apr 2020 01:12:17 -0700 (PDT) Received: from localhost ([::1]:51826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHR2-00054x-6E for importer@patchew.org; Fri, 03 Apr 2020 04:12:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42511) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHKS-0001Di-9b for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKHKQ-00087n-PT for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:28 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46976 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKHKQ-000869-JS for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:26 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-6-qxln6bU5MgqrHgF0c3O-EA-1; Fri, 03 Apr 2020 04:05:22 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4CA558017CE; Fri, 3 Apr 2020 08:05:21 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFD5F5C28F; Fri, 3 Apr 2020 08:05:13 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4071017518; Fri, 3 Apr 2020 10:05:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585901126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=r99+xr/K8ZWPvia6jlsOxj2nEFdhjeSpcRRYkO8Mf1M=; b=D07jhywI8if4J/kOoA7ZCcXU5EbrOTO/q/SIXjd9WbVM2boCXhlWzksp71yKFT0BJxUQz0 NcZ7jftXXP8mUKt8XYgDzQSpxlzxePq9Ai6q3CKg/RtJ1JUNL8LZJnz6nNjeEJZsGt3Ad0 8LdqkfWERu1IPJ9dXsUkNQB/RPPh0eU= X-MC-Unique: qxln6bU5MgqrHgF0c3O-EA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 09/12] acpi: move aml builder code for parallel device Date: Fri, 3 Apr 2020 10:04:59 +0200 Message-Id: <20200403080502.8154-10-kraxel@redhat.com> In-Reply-To: <20200403080502.8154-1-kraxel@redhat.com> References: <20200403080502.8154-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann --- hw/char/parallel.c | 25 +++++++++++++++++++++++++ hw/i386/acpi-build.c | 23 ----------------------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/hw/char/parallel.c b/hw/char/parallel.c index 8dd67d13759b..2bff1f17fda7 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -28,6 +28,7 @@ #include "qemu/module.h" #include "chardev/char-parallel.h" #include "chardev/char-fe.h" +#include "hw/acpi/aml-build.h" #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" @@ -568,6 +569,28 @@ static void parallel_isa_realizefn(DeviceState *dev, E= rror **errp) s, "parallel"); } =20 +static void parallel_isa_build_aml(ISADevice *isadev, Aml *scope) +{ + ISAParallelState *isa =3D ISA_PARALLEL(isadev); + Aml *dev; + Aml *crs; + + if (isa->iobase !=3D 0x0378) { + return; + } + + crs =3D aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, 0x0378, 0x0378, 0x08, 0x08)); + aml_append(crs, aml_irq_no_flags(7)); + + dev =3D aml_device("LPT"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0400"))); + aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); + aml_append(dev, aml_name_decl("_CRS", crs)); + + aml_append(scope, dev); +} + /* Memory mapped interface */ static uint64_t parallel_mm_readfn(void *opaque, hwaddr addr, unsigned siz= e) { @@ -624,9 +647,11 @@ static Property parallel_isa_properties[] =3D { static void parallel_isa_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + ISADeviceClass *isa =3D ISA_DEVICE_CLASS(klass); =20 dc->realize =3D parallel_isa_realizefn; dc->vmsd =3D &vmstate_parallel_isa; + isa->build_aml =3D parallel_isa_build_aml; device_class_set_props(dc, parallel_isa_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 81805bf85f8d..0539620ddff5 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1167,28 +1167,6 @@ static Aml *build_mouse_device_aml(void) return dev; } =20 -static void build_lpt_device_aml(Aml *scope) -{ - Aml *dev; - Aml *crs; - - if (!memory_region_present(get_system_io(), 0x0378)) { - return; - } - - dev =3D aml_device("LPT"); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0400"))); - - aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); - - crs =3D aml_resource_template(); - aml_append(crs, aml_io(AML_DECODE16, 0x0378, 0x0378, 0x08, 0x08)); - aml_append(crs, aml_irq_no_flags(7)); - aml_append(dev, aml_name_decl("_CRS", crs)); - - aml_append(scope, dev); -} - static void build_isa_devices_aml(Aml *table) { ISADevice *fdc =3D pc_find_fdc0(); @@ -1202,7 +1180,6 @@ static void build_isa_devices_aml(Aml *table) if (fdc) { aml_append(scope, build_fdc_device_aml(fdc)); } - build_lpt_device_aml(scope); =20 if (ambiguous) { error_report("Multiple ISA busses, unable to define IPMI ACPI data= "); --=20 2.18.2 From nobody Sun May 19 09:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585901701; cv=none; d=zohomail.com; s=zohoarc; b=LqpzD6JCYwUTiIXHJYspZXGoEvuVQf1uNz59ocVQJY7U3vEyLBKTsboV8ZMFvb228EGJguTQ6aCPWUI2SHAT2bKq0KcYrO7ZVkrXwm5bYAyddy4eeqWtuiQpnA4sciUZztxCo6LcIKhWZeQOlR2JK3uwXN6QGYBoLU25hKcdtnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585901701; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=GkzGWNEAAwQqNeR3QTDBBeP0R1nXVnjTzKSxJNL7k7s=; b=YHjhjsG75IqkAAX331HgK8ssDd6Lk5vTmshqgWlChPk+OeNbl6v53KioLVvtJsTLj/DEB2uh5Hk1JvAxTlkWHsjHUlLO/Q2rdrP+6TY9fNXRVaALL0kiOHjShJIakMTlKaNu84yFUmAX4XHtUro6PBShnI1K6kZRYRwT1fE9fNg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585901701970103.23731752125809; Fri, 3 Apr 2020 01:15:01 -0700 (PDT) Received: from localhost ([::1]:51872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHTg-00013R-MD for importer@patchew.org; Fri, 03 Apr 2020 04:15:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42543) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHKT-0001Fo-EU for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKHKR-00089T-AD for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:29 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:41653 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKHKR-00087w-59 for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:27 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-265-Mt-gAv8ONg2xXPgtZ5QqpQ-1; Fri, 03 Apr 2020 04:05:23 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E50E818A5522; Fri, 3 Apr 2020 08:05:21 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id B560A5D9CA; Fri, 3 Apr 2020 08:05:13 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 4E1D017522; Fri, 3 Apr 2020 10:05:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585901126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GkzGWNEAAwQqNeR3QTDBBeP0R1nXVnjTzKSxJNL7k7s=; b=i6DmSnt2mku9oHW2w55x5YmhhT52DXPMmATNwlfItPMr3zDEUl6YUq8FergA6wERd0lhgm iTqdOMyGMIVrtIq9TIcRyg74OViNF7FGhl1by24qOdweWiweojWV0UBwXG8/1t1tU8toMi xzLA50Jr/YElfHTUu7Az0wLP5oIs7PQ= X-MC-Unique: Mt-gAv8ONg2xXPgtZ5QqpQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 10/12] acpi: move aml builder code for floppy device Date: Fri, 3 Apr 2020 10:05:00 +0200 Message-Id: <20200403080502.8154-11-kraxel@redhat.com> In-Reply-To: <20200403080502.8154-1-kraxel@redhat.com> References: <20200403080502.8154-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann --- hw/block/fdc.c | 83 ++++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 83 -------------------------------------------- stubs/cmos.c | 7 ++++ stubs/Makefile.objs | 1 + 4 files changed, 91 insertions(+), 83 deletions(-) create mode 100644 stubs/cmos.c diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 22e954e0dc2d..ebfc1d5ac400 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -32,6 +32,8 @@ #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/timer.h" +#include "hw/i386/pc.h" +#include "hw/acpi/aml-build.h" #include "hw/irq.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" @@ -2789,6 +2791,85 @@ void isa_fdc_get_drive_max_chs(FloppyDriveType type, (*maxc)--; } =20 +static Aml *build_fdinfo_aml(int idx, FloppyDriveType type) +{ + Aml *dev, *fdi; + uint8_t maxc, maxh, maxs; + + isa_fdc_get_drive_max_chs(type, &maxc, &maxh, &maxs); + + dev =3D aml_device("FLP%c", 'A' + idx); + + aml_append(dev, aml_name_decl("_ADR", aml_int(idx))); + + fdi =3D aml_package(16); + aml_append(fdi, aml_int(idx)); /* Drive Number */ + aml_append(fdi, + aml_int(cmos_get_fd_drive_type(type))); /* Device Type */ + /* + * the values below are the limits of the drive, and are thus independ= ent + * of the inserted media + */ + aml_append(fdi, aml_int(maxc)); /* Maximum Cylinder Number */ + aml_append(fdi, aml_int(maxs)); /* Maximum Sector Number */ + aml_append(fdi, aml_int(maxh)); /* Maximum Head Number */ + /* + * SeaBIOS returns the below values for int 0x13 func 0x08 regardless = of + * the drive type, so shall we + */ + aml_append(fdi, aml_int(0xAF)); /* disk_specify_1 */ + aml_append(fdi, aml_int(0x02)); /* disk_specify_2 */ + aml_append(fdi, aml_int(0x25)); /* disk_motor_wait */ + aml_append(fdi, aml_int(0x02)); /* disk_sector_siz */ + aml_append(fdi, aml_int(0x12)); /* disk_eot */ + aml_append(fdi, aml_int(0x1B)); /* disk_rw_gap */ + aml_append(fdi, aml_int(0xFF)); /* disk_dtl */ + aml_append(fdi, aml_int(0x6C)); /* disk_formt_gap */ + aml_append(fdi, aml_int(0xF6)); /* disk_fill */ + aml_append(fdi, aml_int(0x0F)); /* disk_head_sttl */ + aml_append(fdi, aml_int(0x08)); /* disk_motor_strt */ + + aml_append(dev, aml_name_decl("_FDI", fdi)); + return dev; +} + +static void fdc_isa_build_aml(ISADevice *isadev, Aml *scope) +{ + Aml *dev; + Aml *crs; + int i; + +#define ACPI_FDE_MAX_FD 4 + uint32_t fde_buf[5] =3D { + 0, 0, 0, 0, /* presence of floppy drives #0 - #3 */ + cpu_to_le32(2) /* tape presence (2 =3D=3D never present) */ + }; + + crs =3D aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, 0x03F2, 0x03F2, 0x00, 0x04)); + aml_append(crs, aml_io(AML_DECODE16, 0x03F7, 0x03F7, 0x00, 0x01)); + aml_append(crs, aml_irq_no_flags(6)); + aml_append(crs, + aml_dma(AML_COMPATIBILITY, AML_NOTBUSMASTER, AML_TRANSFER8, 2)); + + dev =3D aml_device("FDC0"); + aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0700"))); + aml_append(dev, aml_name_decl("_CRS", crs)); + + for (i =3D 0; i < MIN(MAX_FD, ACPI_FDE_MAX_FD); i++) { + FloppyDriveType type =3D isa_fdc_get_drive_type(isadev, i); + + if (type < FLOPPY_DRIVE_TYPE_NONE) { + fde_buf[i] =3D cpu_to_le32(1); /* drive present */ + aml_append(dev, build_fdinfo_aml(i, type)); + } + } + aml_append(dev, aml_name_decl("_FDE", + aml_buffer(sizeof(fde_buf), (uint8_t *)fde_buf))); + + aml_append(scope, dev); +} + static const VMStateDescription vmstate_isa_fdc =3D{ .name =3D "fdc", .version_id =3D 2, @@ -2822,11 +2903,13 @@ static Property isa_fdc_properties[] =3D { static void isabus_fdc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + ISADeviceClass *isa =3D ISA_DEVICE_CLASS(klass); =20 dc->realize =3D isabus_fdc_realize; dc->fw_name =3D "fdc"; dc->reset =3D fdctrl_external_reset_isa; dc->vmsd =3D &vmstate_isa_fdc; + isa->build_aml =3D fdc_isa_build_aml; device_class_set_props(dc, isa_fdc_properties); set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); } diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 0539620ddff5..be29422ede14 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1052,85 +1052,6 @@ static void build_hpet_aml(Aml *table) aml_append(table, scope); } =20 -static Aml *build_fdinfo_aml(int idx, FloppyDriveType type) -{ - Aml *dev, *fdi; - uint8_t maxc, maxh, maxs; - - isa_fdc_get_drive_max_chs(type, &maxc, &maxh, &maxs); - - dev =3D aml_device("FLP%c", 'A' + idx); - - aml_append(dev, aml_name_decl("_ADR", aml_int(idx))); - - fdi =3D aml_package(16); - aml_append(fdi, aml_int(idx)); /* Drive Number */ - aml_append(fdi, - aml_int(cmos_get_fd_drive_type(type))); /* Device Type */ - /* - * the values below are the limits of the drive, and are thus independ= ent - * of the inserted media - */ - aml_append(fdi, aml_int(maxc)); /* Maximum Cylinder Number */ - aml_append(fdi, aml_int(maxs)); /* Maximum Sector Number */ - aml_append(fdi, aml_int(maxh)); /* Maximum Head Number */ - /* - * SeaBIOS returns the below values for int 0x13 func 0x08 regardless = of - * the drive type, so shall we - */ - aml_append(fdi, aml_int(0xAF)); /* disk_specify_1 */ - aml_append(fdi, aml_int(0x02)); /* disk_specify_2 */ - aml_append(fdi, aml_int(0x25)); /* disk_motor_wait */ - aml_append(fdi, aml_int(0x02)); /* disk_sector_siz */ - aml_append(fdi, aml_int(0x12)); /* disk_eot */ - aml_append(fdi, aml_int(0x1B)); /* disk_rw_gap */ - aml_append(fdi, aml_int(0xFF)); /* disk_dtl */ - aml_append(fdi, aml_int(0x6C)); /* disk_formt_gap */ - aml_append(fdi, aml_int(0xF6)); /* disk_fill */ - aml_append(fdi, aml_int(0x0F)); /* disk_head_sttl */ - aml_append(fdi, aml_int(0x08)); /* disk_motor_strt */ - - aml_append(dev, aml_name_decl("_FDI", fdi)); - return dev; -} - -static Aml *build_fdc_device_aml(ISADevice *fdc) -{ - int i; - Aml *dev; - Aml *crs; - -#define ACPI_FDE_MAX_FD 4 - uint32_t fde_buf[5] =3D { - 0, 0, 0, 0, /* presence of floppy drives #0 - #3 */ - cpu_to_le32(2) /* tape presence (2 =3D=3D never present) */ - }; - - dev =3D aml_device("FDC0"); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0700"))); - - crs =3D aml_resource_template(); - aml_append(crs, aml_io(AML_DECODE16, 0x03F2, 0x03F2, 0x00, 0x04)); - aml_append(crs, aml_io(AML_DECODE16, 0x03F7, 0x03F7, 0x00, 0x01)); - aml_append(crs, aml_irq_no_flags(6)); - aml_append(crs, - aml_dma(AML_COMPATIBILITY, AML_NOTBUSMASTER, AML_TRANSFER8, 2)); - aml_append(dev, aml_name_decl("_CRS", crs)); - - for (i =3D 0; i < MIN(MAX_FD, ACPI_FDE_MAX_FD); i++) { - FloppyDriveType type =3D isa_fdc_get_drive_type(fdc, i); - - if (type < FLOPPY_DRIVE_TYPE_NONE) { - fde_buf[i] =3D cpu_to_le32(1); /* drive present */ - aml_append(dev, build_fdinfo_aml(i, type)); - } - } - aml_append(dev, aml_name_decl("_FDE", - aml_buffer(sizeof(fde_buf), (uint8_t *)fde_buf))); - - return dev; -} - static Aml *build_kbd_device_aml(void) { Aml *dev; @@ -1169,7 +1090,6 @@ static Aml *build_mouse_device_aml(void) =20 static void build_isa_devices_aml(Aml *table) { - ISADevice *fdc =3D pc_find_fdc0(); bool ambiguous; =20 Aml *scope =3D aml_scope("_SB.PCI0.ISA"); @@ -1177,9 +1097,6 @@ static void build_isa_devices_aml(Aml *table) =20 aml_append(scope, build_kbd_device_aml()); aml_append(scope, build_mouse_device_aml()); - if (fdc) { - aml_append(scope, build_fdc_device_aml(fdc)); - } =20 if (ambiguous) { error_report("Multiple ISA busses, unable to define IPMI ACPI data= "); diff --git a/stubs/cmos.c b/stubs/cmos.c new file mode 100644 index 000000000000..416cbe4055ff --- /dev/null +++ b/stubs/cmos.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "hw/i386/pc.h" + +int cmos_get_fd_drive_type(FloppyDriveType fd0) +{ + return 0; +} diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 45be5dc0ed78..3cbe472d1c6c 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -3,6 +3,7 @@ stub-obj-y +=3D bdrv-next-monitor-owned.o stub-obj-y +=3D blk-commit-all.o stub-obj-y +=3D blockdev-close-all-bdrv-states.o stub-obj-y +=3D clock-warp.o +stub-obj-y +=3D cmos.o stub-obj-y +=3D cpu-get-clock.o stub-obj-y +=3D cpu-get-icount.o stub-obj-y +=3D dump.o --=20 2.18.2 From nobody Sun May 19 09:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585901223; cv=none; d=zohomail.com; s=zohoarc; b=gcSIsT7jAYrQbuGGCB9kuiy+RshOtj1q4Jt/07kW1zofaoPOLJ76p5H8UwsAfuCsDgZ3BC57NkvYzJFdeqq+tWJA5dFARdJohpKVtMeq8EDd3GqLSG6XbhQpQmBKK1jauQYI0a9oDoMrMkkPyvZNGgFK+x06FbDsqH1D/W1BY9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585901223; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=YYYVZioYq/XtW7IaUW5Cq6bZ16dvm03KWG/uPyy1x6I=; b=fCGSYdmHvGEdZ2SFSgZ1YlIw3pDHOq1kB1b+QfD3yMWCbAHRi5H5SCHTcXQaeuR8gCdxFz4IYPmGYLi8LQrmS0w3ajvI3wjS9KLob2zoqpcpmb69zZ3Fso8g/aW4aZ1mkbdJktTQTeD8pkhIs4dh3y+o9av/V4vOXy4SNsa4Nc8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15859012235031010.3785801052472; Fri, 3 Apr 2020 01:07:03 -0700 (PDT) Received: from localhost ([::1]:51726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHLy-0003vc-5v for importer@patchew.org; Fri, 03 Apr 2020 04:07:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42464) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHKQ-0001B9-R5 for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKHKP-00082M-Cm for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:26 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:38089 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKHKP-00080H-6V for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:25 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-464-Dhwa9zksN-eAUN_7RY8NgQ-1; Fri, 03 Apr 2020 04:05:22 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C88A38017F3; Fri, 3 Apr 2020 08:05:21 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD3EA5DA75; Fri, 3 Apr 2020 08:05:13 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 5870D17523; Fri, 3 Apr 2020 10:05:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585901124; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YYYVZioYq/XtW7IaUW5Cq6bZ16dvm03KWG/uPyy1x6I=; b=VsdiYbROBnWsygT9l03ZCbxMb6Fh3ZDUs7VXjJyx6LjFhG52qGoXRcs3ao1r5Nx8QFYJv4 9zFXmajfGlze81GtDg4ENWIGxudUX7UGqhMHxpZiHKgAh2PBgc6vewVhFYRxEWd+cVGDjP a1qteUV1FSKkkEwGIFxdqlLrc6TMQA4= X-MC-Unique: Dhwa9zksN-eAUN_7RY8NgQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 11/12] acpi: move aml builder code for i8042 (kbd+mouse) device Date: Fri, 3 Apr 2020 10:05:01 +0200 Message-Id: <20200403080502.8154-12-kraxel@redhat.com> In-Reply-To: <20200403080502.8154-1-kraxel@redhat.com> References: <20200403080502.8154-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Gerd Hoffmann --- hw/i386/acpi-build.c | 39 --------------------------------------- hw/input/pckbd.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 39 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index be29422ede14..23817d9005cc 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1052,42 +1052,6 @@ static void build_hpet_aml(Aml *table) aml_append(table, scope); } =20 -static Aml *build_kbd_device_aml(void) -{ - Aml *dev; - Aml *crs; - - dev =3D aml_device("KBD"); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0303"))); - - aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); - - crs =3D aml_resource_template(); - aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01)); - aml_append(crs, aml_io(AML_DECODE16, 0x0064, 0x0064, 0x01, 0x01)); - aml_append(crs, aml_irq_no_flags(1)); - aml_append(dev, aml_name_decl("_CRS", crs)); - - return dev; -} - -static Aml *build_mouse_device_aml(void) -{ - Aml *dev; - Aml *crs; - - dev =3D aml_device("MOU"); - aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0F13"))); - - aml_append(dev, aml_name_decl("_STA", aml_int(0xf))); - - crs =3D aml_resource_template(); - aml_append(crs, aml_irq_no_flags(12)); - aml_append(dev, aml_name_decl("_CRS", crs)); - - return dev; -} - static void build_isa_devices_aml(Aml *table) { bool ambiguous; @@ -1095,9 +1059,6 @@ static void build_isa_devices_aml(Aml *table) Aml *scope =3D aml_scope("_SB.PCI0.ISA"); Object *obj =3D object_resolve_path_type("", TYPE_ISA_BUS, &ambiguous); =20 - aml_append(scope, build_kbd_device_aml()); - aml_append(scope, build_mouse_device_aml()); - if (ambiguous) { error_report("Multiple ISA busses, unable to define IPMI ACPI data= "); } else if (!obj) { diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 60a41303203a..29d633ca9478 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -26,6 +26,7 @@ #include "qemu/log.h" #include "hw/isa/isa.h" #include "migration/vmstate.h" +#include "hw/acpi/aml-build.h" #include "hw/input/ps2.h" #include "hw/irq.h" #include "hw/input/i8042.h" @@ -561,12 +562,42 @@ static void i8042_realizefn(DeviceState *dev, Error *= *errp) qemu_register_reset(kbd_reset, s); } =20 +static void i8042_build_aml(ISADevice *isadev, Aml *scope) +{ + Aml *kbd; + Aml *mou; + Aml *crs; + + crs =3D aml_resource_template(); + aml_append(crs, aml_io(AML_DECODE16, 0x0060, 0x0060, 0x01, 0x01)); + aml_append(crs, aml_io(AML_DECODE16, 0x0064, 0x0064, 0x01, 0x01)); + aml_append(crs, aml_irq_no_flags(1)); + + kbd =3D aml_device("KBD"); + aml_append(kbd, aml_name_decl("_HID", aml_eisaid("PNP0303"))); + aml_append(kbd, aml_name_decl("_STA", aml_int(0xf))); + aml_append(kbd, aml_name_decl("_CRS", crs)); + + crs =3D aml_resource_template(); + aml_append(crs, aml_irq_no_flags(12)); + + mou =3D aml_device("MOU"); + aml_append(mou, aml_name_decl("_HID", aml_eisaid("PNP0F13"))); + aml_append(mou, aml_name_decl("_STA", aml_int(0xf))); + aml_append(mou, aml_name_decl("_CRS", crs)); + + aml_append(scope, kbd); + aml_append(scope, mou); +} + static void i8042_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + ISADeviceClass *isa =3D ISA_DEVICE_CLASS(klass); =20 dc->realize =3D i8042_realizefn; dc->vmsd =3D &vmstate_kbd_isa; + isa->build_aml =3D i8042_build_aml; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } =20 --=20 2.18.2 From nobody Sun May 19 09:42:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585901211; cv=none; d=zohomail.com; s=zohoarc; b=Q+CDzZVKt5ssukz5b2WuXGCIdMeywdLpGt4jsc4SFJqMwvTxo33yP0k0+Q2YPswxcovAyEyQdW78SwYn8xUXwI5GMsXgl6BR3N4Dytm1Fkb2RFY/bYyZZs9gFiWBB8gjHupIoT3jzRNGu0/YcOBPROCcte5NqJaPPcmlPQKZzOg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585901211; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fyGr9EDP8Lt47BNdtDV45HB9ePlMiacy+4RxxiFGp9U=; b=j6/TJRfB/wz4wwfP+joceGWW12RI11NwNh/JsE3VtYdlO3oQT60dUTk5jIGnDGkx9kY74LvjijJMoyoWFgo+asncr4CPBwuiORScrs63rE0iOHKWbU+sbfRuq1tvutdVq74R8VBiLjhZWVg2AILMFyDSbVsUq2q0qLZWQtXTHbE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585901211120903.9125904674966; Fri, 3 Apr 2020 01:06:51 -0700 (PDT) Received: from localhost ([::1]:51718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHLl-0003Rb-Qo for importer@patchew.org; Fri, 03 Apr 2020 04:06:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42372) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKHKM-00012L-31 for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKHKK-0007oi-LM for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:21 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:32188 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jKHKK-0007nr-Eq for qemu-devel@nongnu.org; Fri, 03 Apr 2020 04:05:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-302-rxfCmH3lOduVPwIVp0sFNg-1; Fri, 03 Apr 2020 04:05:15 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7A8951005516; Fri, 3 Apr 2020 08:05:14 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9F671147CE; Fri, 3 Apr 2020 08:05:13 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6465C17524; Fri, 3 Apr 2020 10:05:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585901120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fyGr9EDP8Lt47BNdtDV45HB9ePlMiacy+4RxxiFGp9U=; b=X/LLfocTbOx5/QNOzhUGPBEZwCBYQw3z5eLGXyj7qz3stJgs08D/NzxC6EkrldMvJBsoa0 +aK1FNR1cpZMXzmcxCrKPYf1pC5V41FZ+XBhQ5R2fgJ45fYUImEjkVsEvY8UdgCIL0mEDJ wbobkhzaTJXFbNg4QJr43aw+3QCVAhE= X-MC-Unique: rxfCmH3lOduVPwIVp0sFNg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 12/12] acpi: factor out fw_cfg_add_acpi_dsdt() Date: Fri, 3 Apr 2020 10:05:02 +0200 Message-Id: <20200403080502.8154-13-kraxel@redhat.com> In-Reply-To: <20200403080502.8154-1-kraxel@redhat.com> References: <20200403080502.8154-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Paolo Bonzini , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Igor Mammedov , John Snow , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Add helper function to add fw_cfg device, also move code to hw/i386/fw_cfg.c. Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/fw_cfg.h | 1 + hw/i386/acpi-build.c | 24 +----------------------- hw/i386/fw_cfg.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/hw/i386/fw_cfg.h b/hw/i386/fw_cfg.h index 9e742787792b..275f15c1c5e8 100644 --- a/hw/i386/fw_cfg.h +++ b/hw/i386/fw_cfg.h @@ -25,5 +25,6 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms, uint16_t apic_id_limit); void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg); void fw_cfg_build_feature_control(MachineState *ms, FWCfgState *fw_cfg); +void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg); =20 #endif diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 23817d9005cc..55ece91655cf 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1874,30 +1874,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, =20 /* 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 =3D object_property_get_bool(OBJECT(x86ms->fw_cfg), - "dma_enabled", NULL) ? - ROUND_UP(FW_CFG_CTL_SIZE, 4) + sizeof(dma_addr_t= ) : - FW_CFG_CTL_SIZE; - scope =3D aml_scope("\\_SB.PCI0"); - dev =3D 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 =3D 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); + fw_cfg_add_acpi_dsdt(scope, x86ms->fw_cfg); aml_append(dsdt, scope); } =20 diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index da60ada59462..c55abfb01abb 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -15,6 +15,7 @@ #include "qemu/osdep.h" #include "sysemu/numa.h" #include "hw/acpi/acpi.h" +#include "hw/acpi/aml-build.h" #include "hw/firmware/smbios.h" #include "hw/i386/fw_cfg.h" #include "hw/timer/hpet.h" @@ -179,3 +180,30 @@ void fw_cfg_build_feature_control(MachineState *ms, FW= CfgState *fw_cfg) *val =3D cpu_to_le64(feature_control_bits | FEATURE_CONTROL_LOCKED); fw_cfg_add_file(fw_cfg, "etc/msr_feature_control", val, sizeof(*val)); } + +void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg) +{ + /* + * 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 + */ + Object *obj =3D OBJECT(fw_cfg); + uint8_t io_size =3D object_property_get_bool(obj, "dma_enabled", NULL)= ? + ROUND_UP(FW_CFG_CTL_SIZE, 4) + sizeof(dma_addr_t) : + FW_CFG_CTL_SIZE; + Aml *dev =3D aml_device("FWCF"); + Aml *crs =3D aml_resource_template(); + + 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))); + + 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); +} --=20 2.18.2