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

Re: [Xen-devel] [PATCH RESEND 06/14] libxl/arm: Construct ACPI FADT table



Hello Shannon,

It just occurred to me that the way to build the ACPI tables, I am not speaking about the value, is very similar to what QEMU does.

Perhaps, we should copy the copyright from QEMU in libxl_arm.c. In this case, moving the ACPI code in a separate file would be the best.

On 31/05/16 06:02, Shannon Zhao wrote:
From: Shannon Zhao <shannon.zhao@xxxxxxxxxx>

Signed-off-by: Shannon Zhao <shannon.zhao@xxxxxxxxxx>
---
  tools/libxl/libxl_arm.c | 23 +++++++++++++++++++++++
  1 file changed, 23 insertions(+)

diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
index 0fb4f69..c3b8fb4 100644
--- a/tools/libxl/libxl_arm.c
+++ b/tools/libxl/libxl_arm.c
@@ -922,6 +922,28 @@ static void make_acpi_gtdt(libxl__gc *gc, struct 
xc_dom_image *dom)
      dom->acpitable_size += dom->acpitable_blob->gtdt.size;
  }

+static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom)
+{
+    struct acpi_fadt_descriptor *fadt;
+
+    fadt = libxl__zalloc(gc, sizeof(*fadt));
+
+    /* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */
+    fadt->flags = 1 << ACPI_FADT_F_HW_REDUCED_ACPI;
+    fadt->arm_boot_flags = (1 << ACPI_FADT_ARM_USE_PSCI_G_0_2) |
+                           (1 << ACPI_FADT_ARM_PSCI_USE_HVC);
+
+    /* ACPI v5.1 (fadt->revision.fadt->minor_revision) */
+    fadt->minor_revision = 0x1;
+
+    make_acpi_header(&fadt->header, "FACP", sizeof(*fadt), 5);
+
+    dom->acpitable_blob->fadt.table = (void *)fadt;

pointless cast.

+    /* Align to 64bit. */

I am not sure what the comment is for.

+    dom->acpitable_blob->fadt.size = sizeof(*fadt);
+    dom->acpitable_size += dom->acpitable_blob->fadt.size;
+}
+
  static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                          libxl__domain_build_state *state,
                          struct xc_dom_image *dom)
@@ -943,6 +965,7 @@ static int prepare_acpi(libxl__gc *gc, 
libxl_domain_build_info *info,
      dom->acpitable_size = 0;

      make_acpi_gtdt(gc, dom);
+    make_acpi_fadt(gc, dom);

      return 0;
  }


Regards,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.