@@ -320,9 +320,10 @@ void aml_append(AcpiAml *parent_ctx, AcpiAml *child)
uint8_t *start = (uint8_t *)parent_ctx->buf->data +
parent_ctx->buf->len;
uint32_t le32_len = cpu_to_le32(child->buf->len);
+ AcpiAmlTablesBlob *tables_blob = AML_TABLES_BLOB(parent_ctx);
/* create linker entry for the DefinitionBlock */
- bios_linker_loader_add_checksum(parent_ctx->linker,
+ bios_linker_loader_add_checksum(tables_blob->linker,
ACPI_BUILD_TABLE_FILE,
parent_ctx->buf->data,
start, child->buf->len, start + 9 /* checksum offset */);
@@ -948,9 +949,18 @@ static const TypeInfo aml_object_type_info = {
.class_size = sizeof(AcpiAmlClass),
};
+static const TypeInfo aml_tables_blob_type_info = {
+ .name = TYPE_AML_TABLES_BLOB,
+ .parent = TYPE_AML_OBJECT,
+ .instance_size = sizeof(AcpiAmlTablesBlob),
+ .abstract = false,
+ .class_size = sizeof(AcpiAmlTablesBlobClass),
+};
+
static void aml_register_types(void)
{
type_register_static(&aml_object_type_info);
+ type_register_static(&aml_tables_blob_type_info);
}
type_init(aml_register_types)
@@ -1279,10 +1279,10 @@ struct AcpiBuildTables {
static inline void acpi_build_tables_init(AcpiBuildTables *tables)
{
tables->rsdp = g_array_new(false, true /* clear */, 1);
- tables->table_data = AML_OBJECT(object_new(TYPE_AML_OBJECT));
tables->tcpalog = g_array_new(false, true /* clear */, 1);
tables->linker = bios_linker_loader_init();
- tables->table_data->linker = tables->linker;
+ tables->table_data = AML_OBJECT(object_new(TYPE_AML_TABLES_BLOB));
+ AML_TABLES_BLOB(tables->table_data)->linker = tables->linker;
}
static inline void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre)
@@ -30,13 +30,28 @@ typedef struct AcpiAml {
GArray *buf;
uint8_t op;
AcpiBlockFlags block_flags;
- GArray *linker;
} AcpiAml;
typedef struct AcpiAmlClass {
ObjectClass parent_class;
} AcpiAmlClass;
+#define TYPE_AML_TABLES_BLOB "aml-tables-blob"
+#define AML_TABLES_BLOB(obj) OBJECT_CHECK(AcpiAmlTablesBlob, (obj), TYPE_AML_TABLES_BLOB)
+#define AML_TABLES_BLOB_CLASS(klass) \
+ OBJECT_CLASS_CHECK(AcpiAmlTablesBlobClass, (klass), TYPE_AML_TABLES_BLOB)
+#define AML_TABLES_BLOB_GET_CLASS \
+ OBJECT_GET_CLASS(AcpiAmlTablesBlobClass, (obj), TYPE_AML_TABLES_BLOB)
+
+typedef struct AcpiAmlTablesBlob {
+ AcpiAml parent_obj;
+ GArray *linker;
+} AcpiAmlTablesBlob;
+
+typedef struct AcpiAmlTablesBlobClass {
+ AcpiAmlClass parent_class;
+} AcpiAmlTablesBlobClass;
+
typedef enum {
acpi_decode10 = 0,
acpi_decode16 = 1,
it will help to generalize and reuse blob intitalization/ destruction code. Signed-off-by: Igor Mammedov <imammedo@redhat.com> --- hw/acpi/acpi-build-utils.c | 12 +++++++++++- hw/i386/acpi-build.c | 4 ++-- include/hw/acpi/acpi-build-utils.h | 17 ++++++++++++++++- 3 files changed, 29 insertions(+), 4 deletions(-)