qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 02/13] make toplevel ACPI tables blob a pointer


From: Igor Mammedov
Subject: [Qemu-devel] [PATCH 02/13] make toplevel ACPI tables blob a pointer
Date: Wed, 28 Jan 2015 10:03:26 +0000

in following patch toplevel blob would be switched to
QOM AML_OBJECT model vs manually constructed now.

Signed-off-by: Igor Mammedov <address@hidden>
---
 hw/i386/acpi-build.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index c7f492e..f24f92b 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1270,7 +1270,7 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned 
rsdt)
 
 typedef
 struct AcpiBuildTables {
-    AcpiAml table_data;
+    AcpiAml* table_data;
     GArray *rsdp;
     GArray *tcpalog;
     GArray *linker;
@@ -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.buf = g_array_new(false, true /* clear */, 1);
+    tables->table_data->buf = g_array_new(false, true /* clear */, 1);
     tables->tcpalog = g_array_new(false, true /* clear */, 1);
     tables->linker = bios_linker_loader_init();
-    tables->table_data.linker = tables->linker;
+    tables->table_data->linker = tables->linker;
 }
 
 static inline void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool 
mfre)
@@ -1290,7 +1290,7 @@ static inline void 
acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre)
     void *linker_data = bios_linker_loader_cleanup(tables->linker);
     g_free(linker_data);
     g_array_free(tables->rsdp, mfre);
-    g_array_free(tables->table_data.buf, true);
+    g_array_free(tables->table_data->buf, true);
     g_array_free(tables->tcpalog, mfre);
 }
 
@@ -1461,23 +1461,23 @@ void acpi_build(PcGuestInfo *guest_info, 
AcpiBuildTables *tables)
             guest_info->legacy_acpi_table_size +
             ACPI_BUILD_LEGACY_CPU_AML_SIZE * max_cpus;
         int legacy_table_size =
-            ROUND_UP(tables->table_data.buf->len - aml_len + legacy_aml_len,
+            ROUND_UP(tables->table_data->buf->len - aml_len + legacy_aml_len,
                      ACPI_BUILD_ALIGN_SIZE);
-        if (tables->table_data.buf->len > legacy_table_size) {
+        if (tables->table_data->buf->len > legacy_table_size) {
             /* Should happen only with PCI bridges and -M pc-i440fx-2.0.  */
             error_report("Warning: migration may not work.");
         }
-        g_array_set_size(tables->table_data.buf, legacy_table_size);
+        g_array_set_size(tables->table_data->buf, legacy_table_size);
     } else {
         /* Make sure we have a buffer in case we need to resize the tables. */
-        if (tables->table_data.buf->len > ACPI_BUILD_TABLE_SIZE / 2) {
+        if (tables->table_data->buf->len > ACPI_BUILD_TABLE_SIZE / 2) {
             /* As of QEMU 2.1, this fires with 160 VCPUs and 255 memory slots. 
 */
             error_report("Warning: ACPI tables are larger than 64k.");
             error_report("Warning: migration may not work.");
             error_report("Warning: please remove CPUs, NUMA nodes, "
                          "memory slots or PCI bridges.");
         }
-        acpi_align_size(tables->table_data.buf, ACPI_BUILD_TABLE_SIZE);
+        acpi_align_size(tables->table_data->buf, ACPI_BUILD_TABLE_SIZE);
     }
 
     acpi_align_size(tables->linker, ACPI_BUILD_ALIGN_SIZE);
@@ -1501,14 +1501,14 @@ static void acpi_build_update(void *build_opaque, 
uint32_t offset)
 
     acpi_build(build_state->guest_info, &tables);
 
-    assert(acpi_data_len(tables.table_data.buf) == build_state->table_size);
+    assert(acpi_data_len(tables.table_data->buf) == build_state->table_size);
 
     /* Make sure RAM size is correct - in case it got changed by migration */
     qemu_ram_resize(build_state->table_ram, build_state->table_size,
                     &error_abort);
 
     memcpy(qemu_get_ram_ptr(build_state->table_ram),
-           tables.table_data.buf->data, build_state->table_size);
+           tables.table_data->buf->data, build_state->table_size);
 
     cpu_physical_memory_set_dirty_range_nocode(build_state->table_ram,
                                                build_state->table_size);
@@ -1570,11 +1570,11 @@ void acpi_setup(PcGuestInfo *guest_info)
 
     /* Now expose it all to Guest */
     build_state->table_ram = acpi_add_rom_blob(build_state,
-                                               tables.table_data.buf,
+                                               tables.table_data->buf,
                                                ACPI_BUILD_TABLE_FILE,
                                                ACPI_BUILD_TABLE_MAX_SIZE);
     assert(build_state->table_ram != RAM_ADDR_MAX);
-    build_state->table_size = acpi_data_len(tables.table_data.buf);
+    build_state->table_size = acpi_data_len(tables.table_data->buf);
 
     acpi_add_rom_blob(NULL, tables.linker, "etc/table-loader", 0);
 
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]