diff mbox

[Xen-devel,v2,05/17] libxl/arm: Construct ACPI RSDP table

Message ID 1466651824-6964-6-git-send-email-zhaoshenglong@huawei.com
State New
Headers show

Commit Message

Shannon Zhao June 23, 2016, 3:16 a.m. UTC
From: Shannon Zhao <shannon.zhao@linaro.org>

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libxl/libxl_arm_acpi.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff mbox

Patch

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 60c31f9..5f332fa 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -53,6 +53,24 @@  struct acpitable {
 
 static struct acpitable acpitables[NUMS];
 
+static void make_acpi_rsdp(libxl__gc *gc, struct xc_dom_image *dom)
+{
+    struct acpi_table_rsdp *rsdp;
+    size_t size = sizeof(*rsdp);
+
+    rsdp = libxl__zalloc(gc, size);
+    memcpy(rsdp->signature, "RSD PTR ", sizeof(rsdp->signature));
+    memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id));
+    rsdp->length = size;
+    rsdp->revision = 0x02;
+    rsdp->checksum = 0;
+
+    acpitables[RSDP].table = rsdp;
+    acpitables[RSDP].size = size;
+    /* Align to 64 bit. */
+    dom->acpitable_size += ROUNDUP(acpitables[RSDP].size, 3);
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
@@ -73,6 +91,8 @@  int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
     dom->acpitable_blob = NULL;
     dom->acpitable_size = 0;
 
+    make_acpi_rsdp(gc, dom);
+
     return 0;
 }