diff options
author | Igor Mammedov <imammedo@redhat.com> | 2015-02-18 19:14:37 +0000 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-02-26 13:04:15 +0100 |
commit | d5e5830f56452d857f9c26c06a886f09056482c1 (patch) | |
tree | cd4e5e1814220ae4cd184c4434f0f8b0e71956d9 /hw/acpi | |
parent | b8a5d6894d94c8f7e815c64adff78b0d28a98ca6 (diff) | |
download | qemu-d5e5830f56452d857f9c26c06a886f09056482c1.zip qemu-d5e5830f56452d857f9c26c06a886f09056482c1.tar.gz qemu-d5e5830f56452d857f9c26c06a886f09056482c1.tar.bz2 |
acpi: add aml_string() term
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/acpi')
-rw-r--r-- | hw/acpi/aml-build.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index fabd0ad..57a65dd 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -597,6 +597,31 @@ Aml *aml_field(const char *name, AmlFieldFlags flags) return var; } +/* ACPI 1.0b: 16.2.3 Data Objects Encoding: String */ +Aml *aml_string(const char *name_format, ...) +{ + Aml *var = aml_opcode(0x0D /* StringPrefix */); + va_list ap, va_len; + char *s; + int len; + + va_start(ap, name_format); + va_copy(va_len, ap); + len = vsnprintf(NULL, 0, name_format, va_len); + va_end(va_len); + len += 1; + s = g_new0(typeof(*s), len); + + len = vsnprintf(s, len, name_format, ap); + va_end(ap); + + g_array_append_vals(var->buf, s, len); + build_append_byte(var->buf, 0x0); /* NullChar */ + g_free(s); + + return var; +} + /* ACPI 1.0b: 16.2.6.2 Local Objects Encoding */ Aml *aml_local(int num) { |