[PATCH] acpi: lib: fwts_acpi_tables: force fixup when loading tables from /sys/firmware

Colin King colin.king at canonical.com
Tue Jun 9 15:01:13 UTC 2015


From: Colin Ian King <colin.king at canonical.com>

We need to force fixup when loading ACPI tables from /sys/firmware/acpi/tables
because tables such as the root pointer are not normally provided and the
ACPI execution engine requires this.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_acpi_tables.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
index cca1135..9ee3193 100644
--- a/src/lib/src/fwts_acpi_tables.c
+++ b/src/lib/src/fwts_acpi_tables.c
@@ -1041,17 +1041,22 @@ static int fwts_acpi_load_tables_from_sysfs(fwts_framework *fw)
 int fwts_acpi_load_tables(fwts_framework *fw)
 {
 	int ret = FWTS_ERROR;
+	bool require_fixup = false;
 
-	if (fw->acpi_table_path != NULL)
+	if (fw->acpi_table_path != NULL) {
 		ret = fwts_acpi_load_tables_from_file(fw);
-	else if (fw->acpi_table_acpidump_file != NULL)
+		require_fixup = true;
+	} else if (fw->acpi_table_acpidump_file != NULL) {
 		ret = fwts_acpi_load_tables_from_acpidump(fw);
-	else if (fwts_check_root_euid(fw, true) == FWTS_OK) {
+		require_fixup = true;
+	} else if (fwts_check_root_euid(fw, true) == FWTS_OK) {
 		ret = fwts_acpi_load_tables_from_firmware(fw);
 
 		/* Load from memory failed (e.g. no /dev/mem), so try sysfs */
-		if (ret != FWTS_OK)
+		if (ret != FWTS_OK) {
 			ret = fwts_acpi_load_tables_from_sysfs(fw);
+			require_fixup = true;
+		}
 	} else
 		ret = FWTS_ERROR_NO_PRIV;
 
@@ -1059,7 +1064,7 @@ int fwts_acpi_load_tables(fwts_framework *fw)
 		acpi_tables_loaded = ACPI_TABLES_LOADED_OK;
 
 		/* Loading from file may require table address fixups */
-		if ((fw->acpi_table_path != NULL) || (fw->acpi_table_acpidump_file != NULL))
+		if (require_fixup)
 			fwts_acpi_load_tables_fixup(fw);
 	} else {
 		acpi_tables_loaded = ACPI_TABLES_LOADED_FAILED;
-- 
2.1.4




More information about the fwts-devel mailing list