RSDP points to XSDT which in turn points to other tables. Signed-off-by: Shannon Zhao <zhaoshengl...@huawei.com> --- hw/arm/virt-acpi-build.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 2a2b2ab..c838285 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -176,6 +176,34 @@ static void acpi_dsdt_add_virtio(AcpiAml *scope, const hwaddr *mmio_addrs, } } +/* RSDP */ +static GArray * +build_rsdp(GArray *rsdp_table, GArray *linker, uint64_t xsdt) +{ + AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp); + + bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16, + true /* fseg memory */); + + memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature)); + memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id)); + rsdp->length = cpu_to_le32(sizeof(*rsdp)); + rsdp->revision = 0x02; + + /* Point to XSDT */ + rsdp->xsdt_physical_address = cpu_to_le64(xsdt); + /* Address to be filled by Guest linker */ + bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE, + ACPI_BUILD_TABLE_FILE, + rsdp_table, &rsdp->xsdt_physical_address, + sizeof rsdp->xsdt_physical_address); + rsdp->checksum = 0; + /* Checksum to be filled by Guest linker */ + bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE, + rsdp, rsdp, sizeof *rsdp, &rsdp->checksum); + + return rsdp_table; +} /* XSDT */ static void @@ -376,6 +404,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) xsdt = tables->table_data.buf->len; build_xsdt(tables->table_data.buf, tables->linker, table_offsets); + /* RSDP is in FSEG memory, so allocate it separately */ + build_rsdp(tables->rsdp, tables->linker, xsdt); + /* Cleanup memory that's no longer used. */ g_array_free(table_offsets, true); } -- 1.7.1