diff mbox

[09/13] acpi: add aml_blob() helper

Message ID 1422439417-5031-10-git-send-email-imammedo@redhat.com
State New
Headers show

Commit Message

Igor Mammedov Jan. 28, 2015, 10:03 a.m. UTC
it will help to add external (user provided) tables
into ACPI tables blob.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/acpi/acpi-build-utils.c         | 8 ++++++++
 include/hw/acpi/acpi-build-utils.h | 2 ++
 2 files changed, 10 insertions(+)
diff mbox

Patch

diff --git a/hw/acpi/acpi-build-utils.c b/hw/acpi/acpi-build-utils.c
index bffad1e..41341a4 100644
--- a/hw/acpi/acpi-build-utils.c
+++ b/hw/acpi/acpi-build-utils.c
@@ -926,6 +926,14 @@  AcpiAml *acpi_def_block(const char *signature, uint8_t revision,
     return var;
 }
 
+AcpiAml *aml_blob(const unsigned char *data, int size)
+{
+    AcpiAml *var = AML_OBJECT(object_new(TYPE_AML_OBJECT));
+
+    g_array_append_vals(var->buf, data, size);
+    return var;
+}
+
 static void aml_object_initfn(Object *obj) {
     AcpiAml *aml = AML_OBJECT(obj);
 
diff --git a/include/hw/acpi/acpi-build-utils.h b/include/hw/acpi/acpi-build-utils.h
index b2d023e..f36e23a 100644
--- a/include/hw/acpi/acpi-build-utils.h
+++ b/include/hw/acpi/acpi-build-utils.h
@@ -194,6 +194,8 @@  AcpiAml *acpi_field(const char *name, acpiFieldFlags flags);
 AcpiAml *acpi_varpackage(uint32_t num_elements);
 
 /* other helpers */
+AcpiAml *aml_blob(const unsigned char *data, int size);
+
 GArray *build_alloc_array(void);
 void build_free_array(GArray *array);
 void build_prepend_byte(GArray *array, uint8_t val);