qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 03/11] hw/arm/virt-acpi-build: Generate RSDP tab


From: Shannon Zhao
Subject: [Qemu-devel] [RFC PATCH 03/11] hw/arm/virt-acpi-build: Generate RSDP table
Date: Sat, 24 Jan 2015 17:21:12 +0800

RSDP points to XSDT which in turn points to other tables.

Signed-off-by: Shannon Zhao <address@hidden>
---
 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);
+    /* 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;
 }
 
-- 
1.7.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]