[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 03/52] pc: acpi: make top level ACPI tables blob
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH v3 03/52] pc: acpi: make top level ACPI tables blob Aml* |
Date: |
Mon, 9 Feb 2015 10:53:25 +0000 |
it will permit to add a separate tables into blob like other
AML constructs using aml_append() routine and hide from user
need to invoke linker manually for tables, handling it
automatically inside of aml_append() helper.
Later when all tables are converted to use AML API, it would
be possible to generate RSDT automatically and drop manual
table offsets tracking for RSDT.
Signed-off-by: Igor Mammedov <address@hidden>
---
hw/i386/acpi-build.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 8020899..788962e 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1238,7 +1238,7 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned
rsdt)
typedef
struct AcpiBuildTables {
- GArray *table_data;
+ Aml *table_data;
GArray *rsdp;
GArray *tcpalog;
GArray *linker;
@@ -1247,17 +1247,17 @@ struct AcpiBuildTables {
static inline void acpi_build_tables_init(AcpiBuildTables *tables)
{
tables->rsdp = g_array_new(false, true /* clear */, 1);
- tables->table_data = 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 = init_aml_allocator(tables->linker);
}
static inline void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool
mfre)
{
void *linker_data = bios_linker_loader_cleanup(tables->linker);
+ free_aml_allocator();
g_free(linker_data);
g_array_free(tables->rsdp, mfre);
- g_array_free(tables->table_data, true);
g_array_free(tables->tcpalog, mfre);
}
@@ -1317,7 +1317,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables
*tables)
PcPciInfo pci;
uint8_t *u;
size_t aml_len = 0;
- GArray *tables_blob = tables->table_data;
+ GArray *tables_blob = tables->table_data->buf;
acpi_get_cpu_info(&cpu);
acpi_get_pm_info(&pm);
@@ -1469,14 +1469,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) == 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->data,
- build_state->table_size);
+ memcpy(qemu_get_ram_ptr(build_state->table_ram),
+ tables.table_data->buf->data, build_state->table_size);
cpu_physical_memory_set_dirty_range_nocode(build_state->table_ram,
build_state->table_size);
@@ -1537,11 +1537,12 @@ void acpi_setup(PcGuestInfo *guest_info)
acpi_build(build_state->guest_info, &tables);
/* Now expose it all to Guest */
- build_state->table_ram = acpi_add_rom_blob(build_state, tables.table_data,
+ build_state->table_ram = acpi_add_rom_blob(build_state,
+ 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);
+ 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