From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQGR1-0004FK-IJ for qemu-devel@nongnu.org; Fri, 14 Aug 2015 10:58:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZQGR0-0005TJ-8w for qemu-devel@nongnu.org; Fri, 14 Aug 2015 10:58:19 -0400 Received: from mga02.intel.com ([134.134.136.20]:37893) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZQGQz-0005QN-VN for qemu-devel@nongnu.org; Fri, 14 Aug 2015 10:58:18 -0400 From: Xiao Guangrong Date: Fri, 14 Aug 2015 22:51:58 +0800 Message-Id: <1439563931-12352-6-git-send-email-guangrong.xiao@linux.intel.com> In-Reply-To: <1439563931-12352-1-git-send-email-guangrong.xiao@linux.intel.com> References: <1439563931-12352-1-git-send-email-guangrong.xiao@linux.intel.com> Subject: [Qemu-devel] [PATCH v2 05/18] acpi: add aml_create_field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: pbonzini@redhat.com, imammedo@redhat.com Cc: Xiao Guangrong , ehabkost@redhat.com, kvm@vger.kernel.org, mst@redhat.com, gleb@kernel.org, mtosatti@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, rth@twiddle.net Implement CreateField term which are used by NVDIMM _DSM method in later patch Signed-off-by: Xiao Guangrong --- hw/acpi/aml-build.c | 14 ++++++++++++++ include/hw/acpi/aml-build.h | 1 + 2 files changed, 15 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index a526eed..debdad2 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1151,6 +1151,20 @@ Aml *aml_sizeof(Aml *arg) return var; } +/* ACPI 6.0: 20.2.5.2 Named Objects Encoding: DefCreateField */ +Aml *aml_create_field(Aml *srcbuf, Aml *index, Aml *len, const char *name) +{ + Aml *var = aml_alloc(); + + build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */ + build_append_byte(var->buf, 0x13); /* CreateFieldOp */ + aml_append(var, srcbuf); + aml_append(var, index); + aml_append(var, len); + build_append_namestring(var->buf, "%s", name); + return var; +} + void build_header(GArray *linker, GArray *table_data, AcpiTableHeader *h, const char *sig, int len, uint8_t rev) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 6b591ab..d4dbd44 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -277,6 +277,7 @@ Aml *aml_touuid(const char *uuid); Aml *aml_unicode(const char *str); Aml *aml_derefof(Aml *arg); Aml *aml_sizeof(Aml *arg); +Aml *aml_create_field(Aml *srcbuf, Aml *index, Aml *len, const char *name); void build_header(GArray *linker, GArray *table_data, -- 2.4.3