From nobody Mon Feb 9 08:58:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531181033419794.1505260783864; Mon, 9 Jul 2018 17:03:53 -0700 (PDT) Received: from localhost ([::1]:44964 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcg8F-0002Jx-A1 for importer@patchew.org; Mon, 09 Jul 2018 20:03:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcg62-00018F-Nd for qemu-devel@nongnu.org; Mon, 09 Jul 2018 20:01:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcg61-0001o9-Ab for qemu-devel@nongnu.org; Mon, 09 Jul 2018 20:01:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36408 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcg61-0001o5-5Q for qemu-devel@nongnu.org; Mon, 09 Jul 2018 20:01:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA3CB400138A for ; Tue, 10 Jul 2018 00:01:32 +0000 (UTC) Received: from redhat.com (ovpn-120-239.rdu2.redhat.com [10.10.120.239]) by smtp.corp.redhat.com (Postfix) with SMTP id 6CBAD16873; Tue, 10 Jul 2018 00:01:32 +0000 (UTC) Date: Tue, 10 Jul 2018 03:01:32 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <20180710000024.542612-4-mst@redhat.com> References: <20180710000024.542612-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180710000024.542612-1-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 10 Jul 2018 00:01:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 10 Jul 2018 00:01:32 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH hack dontapply v2 3/7] acpi: aml_load/aml_unload X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, ehabkost@redhat.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Dynamic loading/unloading of tables. Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/aml-build.h | 2 ++ hw/acpi/aml-build.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 7cf2cf64bf..f764f71e25 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -381,6 +381,8 @@ Aml *aml_derefof(Aml *arg); Aml *aml_sizeof(Aml *arg); Aml *aml_concatenate(Aml *source1, Aml *source2, Aml *target); Aml *aml_object_type(Aml *object); +Aml *aml_load(const char *name, Aml *ddbhandle); +Aml *aml_unload(Aml *ddbhandle); =20 void build_append_int_noprefix(GArray *table, uint64_t value, int size); void diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 7165f19585..ce691c1618 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1552,6 +1552,27 @@ Aml *aml_object_type(Aml *object) return var; } =20 +/* ACPI 2.0: 17.2.4.3 Type 1 Opcodes Encoding: DefLoad */ +Aml *aml_load(const char *name, Aml *ddbhandle) +{ + Aml *var =3D aml_alloc(); + build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */ + build_append_byte(var->buf, 0x20); /* LoadOp */ + aml_append(var, aml_name("%s", name)); + aml_append(var, ddbhandle); + return var; +} + +/* ACPI 2.0: 17.2.4.3 Type 1 Opcodes Encoding: DefUnload */ +Aml *aml_unload(Aml *ddbhandle) +{ + Aml *var =3D aml_alloc(); + build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */ + build_append_byte(var->buf, 0x2A); /* UnloadOp */ + aml_append(var, ddbhandle); + return var; +} + void build_header(BIOSLinker *linker, GArray *table_data, AcpiTableHeader *h, const char *sig, int len, uint8_t rev, --=20 MST