On Sat, 24 Jan 2015 17:21:12 +0800 Shannon Zhao <zhaoshengl...@huawei.com> wrote:
> 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 | 22 ++++++++++++++++++++++ > 1 files changed, 22 insertions(+), 0 deletions(-) > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 4eed0a3..9c3971a 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -86,6 +86,28 @@ static inline void acpi_add_table(GArray *table_offsets, > GArray *table_data) > 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_VIRT_QEMU_STR_6, 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); RSDP should be created after XSDT so XSDT pointer would be correct, perhaps it's wrong patch ordering > + /* 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; > } >