[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 11/20] hw/arm/virt-acpi-build: Generate RSDP tabl
From: |
Shannon Zhao |
Subject: |
[Qemu-devel] [PATCH v4 11/20] hw/arm/virt-acpi-build: Generate RSDP table |
Date: |
Fri, 3 Apr 2015 18:03:43 +0800 |
From: Shannon Zhao <address@hidden>
RSDP points to RSDT which in turn points to other tables.
Signed-off-by: Shannon Zhao <address@hidden>
Signed-off-by: Shannon Zhao <address@hidden>
---
hw/arm/virt-acpi-build.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 85e84b1..dd5538b 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -176,6 +176,35 @@ static void acpi_dsdt_add_virtio(Aml *scope, const hwaddr
*mmio_addrs,
}
}
+/* RSDP */
+static GArray *
+build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt)
+{
+ 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 RSDT */
+ rsdp->rsdt_physical_address = cpu_to_le32(rsdt);
+ /* Address to be filled by Guest linker */
+ bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE,
+ ACPI_BUILD_TABLE_FILE,
+ rsdp_table, &rsdp->rsdt_physical_address,
+ sizeof rsdp->rsdt_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;
+}
+
/* RSDT */
static void
build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets)
@@ -336,7 +365,7 @@ static
void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables)
{
GArray *table_offsets;
- unsigned dsdt;
+ unsigned dsdt, rsdt;
VirtAcpiCpuInfo cpuinfo;
GArray *tables_blob = tables->table_data;
@@ -373,8 +402,12 @@ void virt_acpi_build(VirtGuestInfo *guest_info,
AcpiBuildTables *tables)
build_gtdt(tables_blob, tables->linker, guest_info);
/* RSDT is pointed to by RSDP */
+ rsdt = tables_blob->len;
build_rsdt(tables_blob, tables->linker, table_offsets);
+ /* RSDP is in FSEG memory, so allocate it separately */
+ build_rsdp(tables->rsdp, tables->linker, rsdt);
+
/* Cleanup memory that's no longer used. */
g_array_free(table_offsets, true);
}
--
2.0.4
- [Qemu-devel] [PATCH v4 13/20] hw/acpi/aml-build: Add ToUUID macro, (continued)
- [Qemu-devel] [PATCH v4 02/20] hw/i386/acpi-build: move generic acpi building helpers into dedictated file, Shannon Zhao, 2015/04/03
- [Qemu-devel] [PATCH v4 09/20] hw/arm/virt-acpi-build: Generate GTDT table, Shannon Zhao, 2015/04/03
- [Qemu-devel] [PATCH v4 01/20] hw/i386: Move ACPI header definitions in an arch-independent location, Shannon Zhao, 2015/04/03
- [Qemu-devel] [PATCH v4 11/20] hw/arm/virt-acpi-build: Generate RSDP table,
Shannon Zhao <=
- [Qemu-devel] [PATCH v4 19/20] hw/arm/virt-acpi-build: Add PCIe controller in ACPI DSDT table, Shannon Zhao, 2015/04/03
- Re: [Qemu-devel] [PATCH v4 19/20] hw/arm/virt-acpi-build: Add PCIe controller in ACPI DSDT table, Alex Bennée, 2015/04/13
- Re: [Qemu-devel] [PATCH v4 19/20] hw/arm/virt-acpi-build: Add PCIe controller in ACPI DSDT table, Shannon Zhao, 2015/04/13
- Re: [Qemu-devel] [PATCH v4 19/20] hw/arm/virt-acpi-build: Add PCIe controller in ACPI DSDT table, Peter Maydell, 2015/04/14
- Re: [Qemu-devel] [PATCH v4 19/20] hw/arm/virt-acpi-build: Add PCIe controller in ACPI DSDT table, Shannon Zhao, 2015/04/14
- Re: [Qemu-devel] [PATCH v4 19/20] hw/arm/virt-acpi-build: Add PCIe controller in ACPI DSDT table, Michael S. Tsirkin, 2015/04/14
- Re: [Qemu-devel] [PATCH v4 19/20] hw/arm/virt-acpi-build: Add PCIe controller in ACPI DSDT table, Shannon Zhao, 2015/04/14
[Qemu-devel] [PATCH v4 18/20] hw/acpi/aml-build: Add aml_dword_io() term, Shannon Zhao, 2015/04/03