@@ -1359,6 +1359,45 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo)
#ifdef CONFIG_ACPI
#define XEN_HYPERVISOR_ID 0x000058656E564D4D /* "XenVMM" */
+static int acpi_create_stao(struct domain *d, struct membank tbl_add[])
+{
+ struct acpi_table_header *table = NULL;
+ struct acpi_table_stao *stao = NULL;
+ u64 table_size = sizeof(struct acpi_table_stao);
+ acpi_status status;
+ u8 *base_ptr;
+ u8 checksum;
+
+ status = acpi_get_table(ACPI_SIG_MADT, 0, &table);
+
+ if ( ACPI_FAILURE(status) )
+ {
+ const char *msg = acpi_format_exception(status);
+
+ printk("Failed to get MADT table, %s\n", msg);
+ return -EINVAL;
+ }
+
+ base_ptr = d->arch.efi_acpi_table
+ + acpi_get_table_offset(tbl_add, TBL_STAO);
+ /* Copy header of one table, here use MADT */
+ ACPI_MEMCPY(base_ptr, table, sizeof(struct acpi_table_header));
+ stao = (struct acpi_table_stao *)base_ptr;
+
+ ACPI_MEMCPY(stao->header.signature, ACPI_SIG_STAO, 4);
+ stao->header.revision = 1;
+ stao->header.length = table_size;
+ stao->ignore_uart = 1;
+ checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, stao), table_size);
+ stao->header.checksum = stao->header.checksum - checksum;
+
+ tbl_add[TBL_STAO].start = d->arch.efi_acpi_gpa
+ + acpi_get_table_offset(tbl_add, TBL_STAO);
+ tbl_add[TBL_STAO].size = table_size;
+
+ return 0;
+}
+
static int acpi_create_madt(struct domain *d, struct membank tbl_add[])
{
struct acpi_table_header *table = NULL;
@@ -1561,6 +1600,10 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo)
if ( rc != 0 )
return rc;
+ rc = acpi_create_stao(d, tbl_add);
+ if ( rc != 0 )
+ return rc;
+
return 0;
}
#else