All of lore.kernel.org
 help / color / mirror / Atom feed
From: ben@skyportsystems.com
To: qemu-devel@nongnu.org
Cc: Ben Warren <ben@skyportsystems.com>
Subject: [Qemu-devel] [PATCH v2 2/6] ACPI: Add a function for building named qword entries
Date: Mon, 16 Jan 2017 11:20:54 -0800	[thread overview]
Message-ID: <555bb80fd172974474a90f832b76f63bb98c512b.1484594095.git.ben@skyportsystems.com> (raw)
In-Reply-To: <cover.1484593565.git.ben@skyportsystems.com>
In-Reply-To: <cover.1484594095.git.ben@skyportsystems.com>

From: Ben Warren <ben@skyportsystems.com>

Signed-off-by: Ben Warren <ben@skyportsystems.com>
---
 hw/acpi/aml-build.c         | 28 ++++++++++++++++++++++++++++
 include/hw/acpi/aml-build.h |  4 ++++
 2 files changed, 32 insertions(+)

diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
index b2a1e40..dc4edc2 100644
--- a/hw/acpi/aml-build.c
+++ b/hw/acpi/aml-build.c
@@ -285,6 +285,34 @@ build_append_named_dword(GArray *array, const char *name_format, ...)
     return offset;
 }
 
+/*
+ * Build NAME(XXXX, 0x00000000) where 0x00000000 is encoded as a qword,
+ * and return the offset to 0x00000000 for runtime patching.
+ *
+ * Warning: runtime patching is best avoided. Only use this as
+ * a replacement for DataTableRegion (for guests that don't
+ * support it).
+ */
+int
+build_append_named_qword(GArray *array, const char *name_format, ...)
+{
+    int offset;
+    va_list ap;
+
+    build_append_byte(array, 0x08); /* NameOp */
+    va_start(ap, name_format);
+    build_append_namestringv(array, name_format, ap);
+    va_end(ap);
+
+    build_append_byte(array, 0x0E); /* QWordPrefix */
+
+    offset = array->len;
+    build_append_int_noprefix(array, 0x00000000, 8);
+    assert(array->len == offset + 8);
+
+    return offset;
+}
+
 static GPtrArray *alloc_list;
 
 static Aml *aml_alloc(void)
diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
index 559326c..dbf63cf 100644
--- a/include/hw/acpi/aml-build.h
+++ b/include/hw/acpi/aml-build.h
@@ -385,6 +385,10 @@ int
 build_append_named_dword(GArray *array, const char *name_format, ...)
 GCC_FMT_ATTR(2, 3);
 
+int
+build_append_named_qword(GArray *array, const char *name_format, ...)
+GCC_FMT_ATTR(2, 3);
+
 void build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base,
                        uint64_t len, int node, MemoryAffinityFlags flags);
 
-- 
2.7.4

  parent reply	other threads:[~2017-01-16 19:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 19:20 [Qemu-devel] [PATCH v2 0/6] Add support for VM Generation ID ben
     [not found] ` <cover.1484594095.git.ben@skyportsystems.com>
2017-01-16 19:20   ` [Qemu-devel] [PATCH v2 1/6] docs: vm generation id device's description ben
2017-01-16 19:51     ` Eric Blake
2017-01-16 20:08       ` Ben Warren
2017-01-16 21:20         ` Eric Blake
2017-01-16 19:20   ` ben [this message]
2017-01-16 19:20   ` [Qemu-devel] [PATCH v2 3/6] ACPI: Add Virtual Machine Generation ID support ben
2017-01-17 13:00     ` Igor Mammedov
2017-01-17 13:18       ` Laszlo Ersek
2017-01-17 14:41       ` Michael S. Tsirkin
2017-01-17 16:37         ` Laszlo Ersek
2017-01-18  0:23       ` Ben Warren
2017-01-16 19:20   ` [Qemu-devel] [PATCH v2 4/6] qmp/hmp: add query-vm-generation-id and 'info vm-generation-id' commands ben
2017-01-16 19:20   ` [Qemu-devel] [PATCH v2 5/6] qmp/hmp: add set-vm-generation-id commands ben
2017-01-18  8:55     ` Igor Mammedov
2017-01-18 22:14       ` Ben Warren
2017-01-16 19:20   ` [Qemu-devel] [PATCH v2 6/6] PC: Support dynamic sysbus on pc_i440fx ben
2017-01-18  8:46     ` Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=555bb80fd172974474a90f832b76f63bb98c512b.1484594095.git.ben@skyportsystems.com \
    --to=ben@skyportsystems.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.