acpi: convert linker from GArray to BIOSLinker structure

Patch just changes type of of linker variables to
a structure, there aren't any functional changes.

Converting linker to a structure will allow to extend
it functionality in follow up patch adding sanity blob
checks.

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>
This commit is contained in:
Igor Mammedov 2016-05-19 15:19:25 +02:00 committed by Michael S. Tsirkin
parent 0058c08238
commit 0e9b9edae7
8 changed files with 70 additions and 58 deletions

View file

@ -354,7 +354,7 @@ static void acpi_dsdt_add_power_button(Aml *scope)
/* RSDP */
static GArray *
build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt)
build_rsdp(GArray *rsdp_table, BIOSLinker *linker, unsigned rsdt)
{
AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp);
@ -383,7 +383,7 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt)
}
static void
build_spcr(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
build_spcr(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
{
AcpiSerialPortConsoleRedirection *spcr;
const MemMapEntry *uart_memmap = &guest_info->memmap[VIRT_UART];
@ -416,7 +416,7 @@ build_spcr(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
}
static void
build_srat(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
build_srat(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
{
AcpiSystemResourceAffinityTable *srat;
AcpiSratProcessorGiccAffinity *core;
@ -456,13 +456,12 @@ build_srat(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
mem_base += numa_info[i].node_mem;
}
build_header(linker, table_data,
(void *)(table_data->data + srat_start), "SRAT",
build_header(linker, table_data, (void *)srat, "SRAT",
table_data->len - srat_start, 3, NULL, NULL);
}
static void
build_mcfg(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
build_mcfg(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
{
AcpiTableMcfg *mcfg;
const MemMapEntry *memmap = guest_info->memmap;
@ -482,7 +481,7 @@ build_mcfg(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
/* GTDT */
static void
build_gtdt(GArray *table_data, GArray *linker)
build_gtdt(GArray *table_data, BIOSLinker *linker)
{
int gtdt_start = table_data->len;
AcpiGenericTimerTable *gtdt;
@ -508,7 +507,7 @@ build_gtdt(GArray *table_data, GArray *linker)
/* MADT */
static void
build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
build_madt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
{
int madt_start = table_data->len;
const MemMapEntry *memmap = guest_info->memmap;
@ -567,7 +566,7 @@ build_madt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
/* FADT */
static void
build_fadt(GArray *table_data, GArray *linker, unsigned dsdt)
build_fadt(GArray *table_data, BIOSLinker *linker, unsigned dsdt)
{
AcpiFadtDescriptorRev5_1 *fadt = acpi_data_push(table_data, sizeof(*fadt));
@ -592,7 +591,7 @@ build_fadt(GArray *table_data, GArray *linker, unsigned dsdt)
/* DSDT */
static void
build_dsdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
build_dsdt(GArray *table_data, BIOSLinker *linker, VirtGuestInfo *guest_info)
{
Aml *scope, *dsdt;
const MemMapEntry *memmap = guest_info->memmap;
@ -731,7 +730,7 @@ static void virt_acpi_build_update(void *build_opaque)
acpi_ram_update(build_state->table_mr, tables.table_data);
acpi_ram_update(build_state->rsdp_mr, tables.rsdp);
acpi_ram_update(build_state->linker_mr, tables.linker);
acpi_ram_update(build_state->linker_mr, tables.linker->cmd_blob);
acpi_build_tables_cleanup(&tables, true);
@ -789,7 +788,8 @@ void virt_acpi_setup(VirtGuestInfo *guest_info)
assert(build_state->table_mr != NULL);
build_state->linker_mr =
acpi_add_rom_blob(build_state, tables.linker, "etc/table-loader", 0);
acpi_add_rom_blob(build_state, tables.linker->cmd_blob,
"etc/table-loader", 0);
fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
tables.tcpalog->data, acpi_data_len(tables.tcpalog));