@@ -33,6 +33,7 @@
#include "xg_private.h"
#include "xc_dom.h"
+#include "acpi_defs.h"
/* ------------------------------------------------------------------------ */
/* debugging */
@@ -1096,6 +1097,64 @@ int xc_dom_build_image(struct xc_dom_image *dom)
memcpy(devicetreemap, dom->devicetree_blob, dom->devicetree_size);
}
+ /* load ACPI tables */
+ if ( dom->acpitable_blob )
+ {
+ void *acpitablemap;
+ uint64_t start = dom->acpi_seg.vstart;
+ struct acpi_xsdt_descriptor *xsdt;
+ struct acpi_rsdp_descriptor *rsdp;
+ struct acpi_fadt_descriptor *fadt;
+
+ if ( xc_dom_alloc_segment(dom, &dom->acpi_seg, "acpitable",
+ start, dom->acpitable_size) != 0 )
+ goto err;
+
+ acpitablemap = xc_dom_seg_to_ptr(dom, &dom->acpi_seg);
+ if ( acpitablemap == NULL )
+ {
+ DOMPRINTF("%s: xc_dom_seg_to_ptr(dom, &dom->acpi_seg) => NULL",
+ __FUNCTION__);
+ goto err;
+ }
+
+ rsdp = (struct acpi_rsdp_descriptor *)acpitablemap;
+ memcpy(acpitablemap, dom->acpitable_blob->rsdp.table,
+ dom->acpitable_blob->rsdp.size);
+ start += dom->acpitable_blob->rsdp.size;
+ acpitablemap += dom->acpitable_blob->rsdp.size;
+
+ xsdt = (struct acpi_xsdt_descriptor *)acpitablemap;
+ memcpy(acpitablemap, dom->acpitable_blob->xsdt.table,
+ dom->acpitable_blob->xsdt.size);
+ rsdp->xsdt_physical_address = start;
+ start += dom->acpitable_blob->xsdt.size;
+ acpitablemap += dom->acpitable_blob->xsdt.size;
+
+ memcpy(acpitablemap, dom->acpitable_blob->madt.table,
+ dom->acpitable_blob->madt.size);
+ xsdt->entry[0] = start;
+ start += dom->acpitable_blob->madt.size;
+ acpitablemap += dom->acpitable_blob->madt.size;
+
+ memcpy(acpitablemap, dom->acpitable_blob->gtdt.table,
+ dom->acpitable_blob->gtdt.size);
+ xsdt->entry[1] = start;
+ start += dom->acpitable_blob->gtdt.size;
+ acpitablemap += dom->acpitable_blob->gtdt.size;
+
+ fadt = (struct acpi_fadt_descriptor *)acpitablemap;
+ memcpy(acpitablemap, dom->acpitable_blob->fadt.table,
+ dom->acpitable_blob->fadt.size);
+ xsdt->entry[2] = start;
+ start += dom->acpitable_blob->fadt.size;
+ acpitablemap += dom->acpitable_blob->fadt.size;
+
+ memcpy(acpitablemap, dom->acpitable_blob->dsdt.table,
+ dom->acpitable_blob->dsdt.size);
+ fadt->dsdt = start;
+ }
+
/* allocate other pages */
if ( !dom->arch_hooks->p2m_base_supported ||
dom->parms.p2m_base >= dom->parms.virt_base ||