]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/acpi/aml-build: Add Unicode macro
authorShannon Zhao <shannon.zhao@linaro.org>
Fri, 29 May 2015 10:28:59 +0000 (11:28 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 29 May 2015 10:28:59 +0000 (11:28 +0100)
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1432522520-8068-22-git-send-email-zhaoshenglong@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/acpi/aml-build.c
include/hw/acpi/aml-build.h

index bd919817fcff2055f52e60bdec6454e480be0835..323b7bc179faccc3e6458ff6777febe99247a79a 100644 (file)
@@ -1069,6 +1069,23 @@ Aml *aml_touuid(const char *uuid)
     return var;
 }
 
+/*
+ * ACPI 2.0b: 16.2.3.6.4.3  Unicode Macro (Convert Ascii String To Unicode)
+ */
+Aml *aml_unicode(const char *str)
+{
+    int i = 0;
+    Aml *var = aml_bundle(0x11 /* BufferOp */, AML_BUFFER);
+
+    do {
+        build_append_byte(var->buf, str[i]);
+        build_append_byte(var->buf, 0);
+        i++;
+    } while (i <= strlen(str));
+
+    return var;
+}
+
 void
 build_header(GArray *linker, GArray *table_data,
              AcpiTableHeader *h, const char *sig, int len, uint8_t rev)
index b81c838c32fe9a3445a7e8b1e3f732fc9a194fda..9773bfd06b29fa97bd9f5af1201472e9a58b6b4f 100644 (file)
@@ -267,6 +267,7 @@ Aml *aml_field(const char *name, AmlAccessType type, AmlUpdateRule rule);
 Aml *aml_create_dword_field(Aml *srcbuf, Aml *index, const char *name);
 Aml *aml_varpackage(uint32_t num_elements);
 Aml *aml_touuid(const char *uuid);
+Aml *aml_unicode(const char *str);
 
 void
 build_header(GArray *linker, GArray *table_data,