[PATCH 2/2] lib: fwts_acpi_tables: Force fixup on XSDT and RSDT when loading from .dat files
Colin King
colin.king at canonical.com
Thu Jul 19 05:49:08 UTC 2012
From: Colin Ian King <colin.king at canonical.com>
When loading raw ACPI tables from .dat files we have no idea where the original
.dat tables were in memory, so this means that loading in the XSDT and RSDT is
problematic because these contain references to the original tables in memory
but we have no clue how these match up with the raw data. Since fwts has to
fake the addresses of the loaded ACPI tables these don't match those in the
loaded XSDT and RSDT which leads to the ACPICA core getting confused. The
best strategy is to therefore not load the XSDT and RSDT and rely on the fwts
table fix up stage to notice we haven't loaded the XSDT and RSDT and let this
create these tables based on the tables we have loaded from the raw .dat data,
leading us to having sane XSDT and RSDT that correctly reference the
loaded ACPI tables even if they are at faked addresses.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/lib/src/fwts_acpi_tables.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
index 4db5844..f388cdd 100644
--- a/src/lib/src/fwts_acpi_tables.c
+++ b/src/lib/src/fwts_acpi_tables.c
@@ -503,9 +503,24 @@ static int fwts_acpi_load_tables_from_file(fwts_framework *fw)
name[4] = '\0';
}
- fwts_acpi_add_table(name, table,
- (uint64_t)fwts_fake_physical_addr(length), length,
- FWTS_ACPI_TABLE_FROM_FILE);
+ if (!strncmp(name, "XSDT", 4) || !strncmp(name, "RSDT", 4)) {
+ /*
+ * For XSDT and RSDT we don't bother loading at this point.
+ * These tables point to the other tables, however, we can't
+ * figure out which table each pointer references because
+ * we are loading in raw table data and we don't know where
+ * these were located in the original machine. So the best
+ * way forward is to ignore these tables and instead leave
+ * the fix up stage fwts_acpi_load_tables_fixup() to magically
+ * create faked XSDT and RSDT entries based on the tables
+ * we've loaded from file.
+ */
+ fwts_low_free(table);
+ } else {
+ fwts_acpi_add_table(name, table,
+ (uint64_t)fwts_fake_physical_addr(length), length,
+ FWTS_ACPI_TABLE_FROM_FILE);
+ }
}
close(fd);
} else
--
1.7.10.4
More information about the fwts-devel
mailing list