ACPICA: Disassembler: allow conflicting external declarations to be emitted.
authorErik Schmauss <erik.schmauss@intel.com>
Mon, 5 Jun 2017 08:41:55 +0000 (16:41 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 27 Jun 2017 20:25:25 +0000 (22:25 +0200)
ACPICA commit 0ed9f2e2ccc112439eaa355b5952a05d6fdb7814

An external declaration is a conflicting declaration when a name has
been declared as an external and a named object within the same file.

Link: https://github.com/acpica/acpica/commit/0ed9f2e2
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/aclocal.h
drivers/acpi/acpica/nsaccess.c

index 2a8394fe199e9f163abb2ef87e1c68e88b141f41..8ddd3b20e0c69a5a71ad0ca0c7ff5809fd29cc20 100644 (file)
@@ -1181,6 +1181,7 @@ struct acpi_external_list {
 #define ACPI_EXT_INTERNAL_PATH_ALLOCATED    0x04       /* Deallocate internal path on completion */
 #define ACPI_EXT_EXTERNAL_EMITTED           0x08       /* External() statement has been emitted */
 #define ACPI_EXT_ORIGIN_FROM_OPCODE         0x10       /* External came from a External() opcode */
+#define ACPI_EXT_CONFLICTING_DECLARATION    0x20       /* External has a conflicting declaration within AML */
 
 struct acpi_external_file {
        char *path;
index fb265b5737de7b70409261139f50ec454cba6e15..e5f4fa496572859ec507a859242be913c36884d1 100644 (file)
 #include "acnamesp.h"
 #include "acdispat.h"
 
+#ifdef ACPI_ASL_COMPILER
+#include "acdisasm.h"
+#endif
+
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsaccess")
 
@@ -580,6 +584,29 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
                                                  (char *)&current_node->name,
                                                  current_node));
                        }
+#ifdef ACPI_ASL_COMPILER
+                       /*
+                        * If this ACPI name already exists within the namespace as an
+                        * external declaration, then mark the external as a conflicting
+                        * declaration and proceed to process the current node as if it did
+                        * not exist in the namespace. If this node is not processed as
+                        * normal, then it could cause improper namespace resolution
+                        * by failing to open a new scope.
+                        */
+                       if (acpi_gbl_disasm_flag &&
+                           (status == AE_ALREADY_EXISTS) &&
+                           ((this_node->flags & ANOBJ_IS_EXTERNAL) ||
+                            (walk_state
+                             && walk_state->opcode == AML_EXTERNAL_OP))) {
+                               this_node->flags &= ~ANOBJ_IS_EXTERNAL;
+                               this_node->type = (u8)this_search_type;
+                               if (walk_state->opcode != AML_EXTERNAL_OP) {
+                                       acpi_dm_mark_external_conflict
+                                           (this_node);
+                               }
+                               break;
+                       }
+#endif
 
                        *return_node = this_node;
                        return_ACPI_STATUS(status);