[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 12/24] hw/arm/virt-acpi-build: Generate RSDP tabl
From: |
Shannon Zhao |
Subject: |
[Qemu-devel] [PATCH v8 12/24] hw/arm/virt-acpi-build: Generate RSDP table |
Date: |
Thu, 21 May 2015 10:28:39 +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>
Reviewed-by: Alex Bennée <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 f46820a..9c836ef 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -151,6 +151,35 @@ static void acpi_dsdt_add_virtio(Aml *scope,
}
}
+/* 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;
+}
+
/* GTDT */
static void
build_gtdt(GArray *table_data, GArray *linker)
@@ -283,7 +312,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;
@@ -320,8 +349,12 @@ void virt_acpi_build(VirtGuestInfo *guest_info,
AcpiBuildTables *tables)
build_gtdt(tables_blob, tables->linker);
/* 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 v8 14/24] hw/acpi/aml-build: Make aml_buffer() definition consistent with the spec, (continued)
- [Qemu-devel] [PATCH v8 14/24] hw/acpi/aml-build: Make aml_buffer() definition consistent with the spec, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 15/24] hw/acpi/aml-build: Add ToUUID macro, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 16/24] hw/acpi/aml-build: Add aml_or() term, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 17/24] hw/acpi/aml-build: Add aml_lnot() term, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 07/24] hw/arm/virt-acpi-build: Generation of DSDT table for virt devices, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 05/24] hw/acpi/aml-build: Add aml_memory32_fixed() term, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 09/24] hw/arm/virt-acpi-build: Generate MADT table, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 08/24] hw/arm/virt-acpi-build: Generate FADT table and update ACPI headers, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 13/24] hw/arm/virt-acpi-build: Generate MCFG table, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 12/24] hw/arm/virt-acpi-build: Generate RSDP table,
Shannon Zhao <=
- [Qemu-devel] [PATCH v8 18/24] hw/acpi/aml-build: Add aml_else() term, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 21/24] hw/acpi/aml-build: Add Unicode macro, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 20/24] hw/acpi/aml-build: Add aml_dword_io() term, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 22/24] hw/arm/virt-acpi-build: Add PCIe controller in ACPI DSDT table, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 23/24] ACPI: split CONFIG_ACPI into 4 pieces, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 24/24] hw/arm/virt: Enable dynamic generation of ACPI v5.1 tables, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 11/24] hw/arm/virt-acpi-build: Generate RSDT table, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 06/24] hw/acpi/aml-build: Add aml_interrupt() term, Shannon Zhao, 2015/05/20
- [Qemu-devel] [PATCH v8 10/24] hw/arm/virt-acpi-build: Generate GTDT table, Shannon Zhao, 2015/05/20