diff -r 4b476378fc35 xen/drivers/acpi/tables/tbxface.c --- a/xen/drivers/acpi/tables/tbxface.c Mon Jan 21 17:03:10 2013 +0000 +++ b/xen/drivers/acpi/tables/tbxface.c Tue Jan 22 17:13:06 2013 +0000 @@ -205,3 +205,44 @@ return (AE_NOT_FOUND); } + +/******************************************************************************* + * + * FUNCTION: acpi_get_table_physical_location + * + * PARAMETERS: Signature - ACPI signature of needed table + * Instance - Which instance (for SSDTs) + * out_addr - Where the table's physical address is returned + * out_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_physical_location(char *signature, + acpi_native_uint instance, + acpi_physical_address *out_addr, u32 *out_len) +{ + acpi_native_uint i; + acpi_native_uint j; + + if (!signature || !out_addr || !out_len) { + return (AE_BAD_PARAMETER); + } + + for (i = 0, 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; + } + *out_addr = acpi_gbl_root_table_list.tables[i].address; + *out_len = acpi_gbl_root_table_list.tables[i].length; + return AE_OK; + } + + return AE_NOT_FOUND; +} diff -r 4b476378fc35 xen/drivers/passthrough/vtd/dmar.c --- a/xen/drivers/passthrough/vtd/dmar.c Mon Jan 21 17:03:10 2013 +0000 +++ b/xen/drivers/passthrough/vtd/dmar.c Tue Jan 22 17:13:06 2013 +0000 @@ -823,7 +823,17 @@ int __init acpi_dmar_init(void) { - acpi_get_table(ACPI_SIG_DMAR, 0, &dmar_table); + acpi_physical_address dmar_addr; + u32 dmar_len; + if ( !acpi_get_table_physical_location( + 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) - PFN_DOWN(dmar_addr) + 1, + PAGE_HYPERVISOR); + dmar_table = (struct acpi_table_header*) __va(dmar_addr); + } + return parse_dmar_table(acpi_parse_dmar); } diff -r 4b476378fc35 xen/include/acpi/acpixf.h --- a/xen/include/acpi/acpixf.h Mon Jan 21 17:03:10 2013 +0000 +++ b/xen/include/acpi/acpixf.h Tue Jan 22 17:13:06 2013 +0000 @@ -77,6 +77,10 @@ acpi_get_table(acpi_string signature, acpi_native_uint instance, struct acpi_table_header **out_table); +acpi_status +acpi_get_table_physical_location(char *signature, + acpi_native_uint instance, + acpi_physical_address *out_addr, u32 *out_len); /* * Namespace and name interfaces */