All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPICA: Detect duplicate SSDT tables
@ 2017-02-27  9:34 Hans de Goede
  2017-02-28  5:19   ` [Devel] " Zheng, Lv
                   ` (2 more replies)
  0 siblings, 3 replies; 51+ messages in thread
From: Hans de Goede @ 2017-02-27  9:34 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown, Robert Moore, Lv Zheng
  Cc: Hans de Goede, linux-acpi, devel

Some machines have the exact (byte for byte) same SSDT tables multiple
times in the root_table_list. Detect this and silently skip the duplicates
rather then printing a scary looking set of errors.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/acpica/tbxfload.c | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index 82019c0..1971cd7 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -125,6 +125,44 @@ ACPI_EXPORT_SYMBOL_INIT(acpi_load_tables)
 
 /*******************************************************************************
  *
+ * FUNCTION:    acpi_tb_find_duplicate_ssdt
+ *
+ * PARAMETERS:  table         - validated acpi_table_desc of table to check
+ *              index         - index of table to find a duplicate of
+ *
+ * RETURN:      TRUE if a duplicate is found, FALSE if not
+ *
+ * DESCRIPTION: Private helper function for acpi_tb_load_namespace to
+ *              avoid trying to load duplicate ssdt tables
+ *
+ ******************************************************************************/
+static u8 acpi_tb_find_duplicate_ssdt(struct acpi_table_desc *table, u32 index)
+{
+	struct acpi_table_desc *dup;
+	u32 i;
+
+	for (i = 0; i < index; ++i) {
+		dup = &acpi_gbl_root_table_list.tables[i];
+
+		if (!acpi_gbl_root_table_list.tables[i].address ||
+		    (!ACPI_COMPARE_NAME(dup->signature.ascii, ACPI_SIG_SSDT)
+		     && !ACPI_COMPARE_NAME(dup->signature.ascii,
+					   ACPI_SIG_PSDT)
+		     && !ACPI_COMPARE_NAME(dup->signature.ascii,
+					   ACPI_SIG_OSDT))
+		    || ACPI_FAILURE(acpi_tb_validate_table(dup))
+		    || dup->length != table->length) {
+			continue;
+		}
+
+		if (memcmp(dup->pointer, table->pointer, table->length) == 0)
+			return TRUE;
+	}
+	return FALSE;
+}
+
+/*******************************************************************************
+ *
  * FUNCTION:    acpi_tb_load_namespace
  *
  * PARAMETERS:  None
@@ -212,7 +250,8 @@ acpi_status acpi_tb_load_namespace(void)
 					   ACPI_SIG_PSDT)
 		     && !ACPI_COMPARE_NAME(table->signature.ascii,
 					   ACPI_SIG_OSDT))
-		    || ACPI_FAILURE(acpi_tb_validate_table(table))) {
+		    || ACPI_FAILURE(acpi_tb_validate_table(table))
+		    || acpi_tb_find_duplicate_ssdt(table, i)) {
 			continue;
 		}
 
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 51+ messages in thread

end of thread, other threads:[~2017-05-19  9:49 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-27  9:34 [PATCH] ACPICA: Detect duplicate SSDT tables Hans de Goede
2017-02-28  5:19 ` Zheng, Lv
2017-02-28  5:19   ` [Devel] " Zheng, Lv
2017-02-28 14:31   ` Hans de Goede
2017-02-28 15:46     ` Moore, Robert
2017-02-28 15:46       ` [Devel] " Moore, Robert
2017-02-28 23:44       ` Hans de Goede
2017-03-01  0:11         ` Moore, Robert
2017-03-01  0:11           ` [Devel] " Moore, Robert
2017-03-01  3:21     ` Zheng, Lv
2017-03-01  3:21       ` [Devel] " Zheng, Lv
2017-03-01  9:19       ` Hans de Goede
2017-03-01 20:38         ` Moore, Robert
2017-03-01 20:38           ` [Devel] " Moore, Robert
2017-03-01 21:56           ` Rafael J. Wysocki
2017-03-02  1:59         ` Zheng, Lv
2017-03-02  1:59           ` [Devel] " Zheng, Lv
2017-03-02 15:24           ` Hans de Goede
2017-03-03  2:50             ` Zheng, Lv
2017-03-03  2:50               ` [Devel] " Zheng, Lv
2017-03-03 13:52               ` Hans de Goede
2017-03-13  6:01                 ` Zheng, Lv
2017-03-13  6:01                   ` [Devel] " Zheng, Lv
2017-05-16  7:13 ` [RFC PATCH v2 0/5] ACPICA: Tables: Add deferred verification support Lv Zheng
2017-05-16  7:13   ` [Devel] " Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 1/5] ACPICA: Tables: Cleanup table handler invokers Lv Zheng
2017-05-16  7:13     ` [Devel] " Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 2/5] ACPICA: Tables: Do not validate signature for dynamic table load Lv Zheng
2017-05-16  7:13     ` [Devel] " Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 3/5] ACPICA: Tables: Change table duplication check to be related to acpi_gbl_verify_table_checksum Lv Zheng
2017-05-16  7:13     ` [Devel] " Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 4/5] ACPICA: Tables: Combine checksum/duplication verification together Lv Zheng
2017-05-16  7:13     ` [Devel] " Lv Zheng
2017-05-16  7:13   ` [RFC PATCH v2 5/5] ACPICA: Tables: Add deferred table verification support Lv Zheng
2017-05-16  7:13     ` [Devel] " Lv Zheng
2017-05-18 14:01   ` [RFC PATCH v2 0/5] ACPICA: Tables: Add deferred " Hans de Goede
2017-05-19  7:59     ` Zheng, Lv
2017-05-19  7:59       ` [Devel] " Zheng, Lv
2017-05-19  9:49       ` Hans de Goede
2017-05-18  9:57 ` [RFC PATCH v3 " Lv Zheng
2017-05-18  9:57   ` [Devel] " Lv Zheng
2017-05-18  9:57   ` [RFC PATCH v3 1/5] ACPICA: Tables: Cleanup table handler invokers Lv Zheng
2017-05-18  9:57     ` [Devel] " Lv Zheng
2017-05-18  9:57   ` [RFC PATCH v3 2/5] ACPICA: Tables: Do not validate signature for dynamic table load Lv Zheng
2017-05-18  9:57     ` [Devel] " Lv Zheng
2017-05-18  9:57   ` [RFC PATCH v3 3/5] ACPICA: Tables: Change table duplication check to be related to acpi_gbl_verify_table_checksum Lv Zheng
2017-05-18  9:57     ` [Devel] " Lv Zheng
2017-05-18  9:57   ` [RFC PATCH v3 4/5] ACPICA: Tables: Combine checksum/duplication verification together Lv Zheng
2017-05-18  9:57     ` [Devel] " Lv Zheng
2017-05-18  9:57   ` [RFC PATCH v3 5/5] ACPICA: Tables: Add deferred table verification support Lv Zheng
2017-05-18  9:57     ` [Devel] " Lv Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.