From patchwork Mon Jun 5 08:41:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 9765865 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A7FEC60364 for ; Mon, 5 Jun 2017 08:42:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9665427E5A for ; Mon, 5 Jun 2017 08:42:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AC6D27F8C; Mon, 5 Jun 2017 08:42:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B06727E5A for ; Mon, 5 Jun 2017 08:42:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751630AbdFEImP (ORCPT ); Mon, 5 Jun 2017 04:42:15 -0400 Received: from mga05.intel.com ([192.55.52.43]:63486 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751491AbdFEImP (ORCPT ); Mon, 5 Jun 2017 04:42:15 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP; 05 Jun 2017 01:42:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,300,1493708400"; d="scan'208";a="976839642" Received: from lvzheng-moblsp3.sh.intel.com ([10.239.159.181]) by orsmga003.jf.intel.com with ESMTP; 05 Jun 2017 01:41:56 -0700 From: Lv Zheng To: "Rafael J . Wysocki" , "Rafael J . Wysocki" , Len Brown Cc: Lv Zheng , Lv Zheng , linux-acpi@vger.kernel.org, Erik Schmauss , Bob Moore Subject: [PATCH 47/53] ACPICA: Disassembler: allow conflicting external declarations to be emitted. Date: Mon, 5 Jun 2017 16:41:55 +0800 Message-Id: <0aa2a648787cdaddcabc1532f1ae2ba54de50cb9.1496650343.git.lv.zheng@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Erik Schmauss 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 Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- drivers/acpi/acpica/aclocal.h | 1 + drivers/acpi/acpica/nsaccess.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 2a8394fe..8ddd3b2 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h @@ -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; diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c index fb265b57..e5f4fa4 100644 --- a/drivers/acpi/acpica/nsaccess.c +++ b/drivers/acpi/acpica/nsaccess.c @@ -47,6 +47,10 @@ #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 *)¤t_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);