diff --git a/xen/drivers/acpi/tables/tbxface.c b/xen/drivers/acpi/tables/tbxface.c index df6eeba..1602bb2 100644 --- a/xen/drivers/acpi/tables/tbxface.c +++ b/xen/drivers/acpi/tables/tbxface.c @@ -205,3 +205,51 @@ acpi_get_table(char *signature, return (AE_NOT_FOUND); } + +/****************************************************************************** + * + * FUNCTION: acpi_get_table_phys + * + * PARAMETERS: signature - ACPI signature of needed table + * instance - Which instance (for SSDTs) + * addr - Where the table's physical address is returned + * len - Where the length of table is returned + * + * RETURN: Status, pointer and length of table + * + * DESCRIPTION: Finds physical address and length of ACPI table + * + *****************************************************************************/ +acpi_status __init +acpi_get_table_phys(acpi_string signature, acpi_native_uint instance, + acpi_physical_address *addr, acpi_native_uint *len) +{ + acpi_native_uint i, j; + acpi_status status; + + if (!signature || !addr || !len) + return AE_BAD_PARAMETER; + + for (i = j = 0; i < acpi_gbl_root_table_list.count; i++) { + if (!ACPI_COMPARE_NAME( + &acpi_gbl_root_table_list.tables[i].signature, + signature)) + continue; + + if (++j < instance) + continue; + + status = + acpi_tb_verify_table(&acpi_gbl_root_table_list.tables[i]); + if (ACPI_SUCCESS(status)) { + *addr = acpi_gbl_root_table_list.tables[i].address; + *len = acpi_gbl_root_table_list.tables[i].length; + } + + acpi_gbl_root_table_list.tables[i].pointer = NULL; + + return status; + } + + return AE_NOT_FOUND; +} diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c index 3fbc5e6..73ad1d7 100644 --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c @@ -786,7 +786,18 @@ out: int __init acpi_dmar_init(void) { - acpi_get_table(ACPI_SIG_DMAR, 0, &dmar_table); + acpi_physical_address dmar_addr; + acpi_native_uint dmar_len; + + if ( ACPI_SUCCESS(acpi_get_table_phys(ACPI_SIG_DMAR, 0, + &dmar_addr, &dmar_len)) ) + { + map_pages_to_xen((unsigned long)__va(dmar_addr), PFN_DOWN(dmar_addr), + PFN_UP(dmar_addr + dmar_len) - PFN_DOWN(dmar_addr), + PAGE_HYPERVISOR); + dmar_table = __va(dmar_addr); + } + return parse_dmar_table(acpi_parse_dmar); } diff --git a/xen/include/acpi/acpixf.h b/xen/include/acpi/acpixf.h index cd2b4fb..7ae1f07 100644 --- a/xen/include/acpi/acpixf.h +++ b/xen/include/acpi/acpixf.h @@ -77,6 +77,9 @@ acpi_status acpi_get_table(acpi_string signature, acpi_native_uint instance, struct acpi_table_header **out_table); +acpi_status +acpi_get_table_phys(acpi_string signature, acpi_native_uint instance, + acpi_physical_address *addr, acpi_native_uint *len); /* * Namespace and name interfaces */