diff mbox

[v2,10/17] libxl/arm: Construct ACPI FADT table

Message ID 1466651824-6964-11-git-send-email-zhaoshenglong@huawei.com (mailing list archive)
State New, archived
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 | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
diff mbox

Patch

diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 659dbfa..353d774 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -234,6 +234,28 @@  static int make_acpi_madt(libxl__gc *gc, struct xc_dom_image *dom, int nr_cpus,
     return 0;
 }
 
+static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom)
+{
+    struct acpi_table_fadt *fadt;
+    size_t size = sizeof(*fadt);
+
+    fadt = libxl__zalloc(gc, size);
+
+    /* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */
+    fadt->flags = ACPI_FADT_HW_REDUCED;
+    fadt->arm_boot_flags = (ACPI_FADT_PSCI_COMPLIANT) | ACPI_FADT_PSCI_USE_HVC;
+
+    /* ACPI v5.1 (fadt->revision.fadt->minor_revision) */
+    fadt->minor_revision = 0x1;
+
+    make_acpi_header(&fadt->header, "FACP", size, 5);
+
+    acpitables[FADT].table = fadt;
+    acpitables[FADT].size = size;
+    /* Align to 64bit. */
+    dom->acpitable_size += ROUNDUP(acpitables[FADT].size, 3);
+}
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
@@ -261,6 +283,8 @@  int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
     if (rc)
 	return rc;
 
+    make_acpi_fadt(gc, dom);
+
     return 0;
 }