From patchwork Wed Jul 3 20:15:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schmauss, Erik" X-Patchwork-Id: 11030261 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-2.web.codeaurora.org (Postfix) with ESMTP id AA50614DB for ; Wed, 3 Jul 2019 20:26:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C6351FE84 for ; Wed, 3 Jul 2019 20:26:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9115028A15; Wed, 3 Jul 2019 20:26:38 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 15C3828617 for ; Wed, 3 Jul 2019 20:26:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbfGCU0g (ORCPT ); Wed, 3 Jul 2019 16:26:36 -0400 Received: from mga11.intel.com ([192.55.52.93]:5192 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726581AbfGCU0g (ORCPT ); Wed, 3 Jul 2019 16:26:36 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2019 13:26:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,448,1557212400"; d="scan'208";a="158088363" Received: from bartok.jf.intel.com ([10.54.75.137]) by orsmga008.jf.intel.com with ESMTP; 03 Jul 2019 13:26:34 -0700 From: Erik Schmauss To: rjw@rjwysocki.net, linux-acpi@vger.kernel.org Cc: Bob Moore , Erik Schmauss Subject: [PATCH 1/5] ACPICA: Namespace: simplify creation of the initial/default namespace Date: Wed, 3 Jul 2019 13:15:36 -0700 Message-Id: <20190703201540.26054-2-erik.schmauss@intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190703201540.26054-1-erik.schmauss@intel.com> References: <20190703201540.26054-1-erik.schmauss@intel.com> 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: Bob Moore ACPICA commit 76658f55d8cc498a763bdb92f8e0d934822a129c For the objects that are created by default (_GPE, _SB_, etc) there is no need to use the heavyweight ns_lookup function. Instead, simply create each object and link it in as the namespace is built. Link: https://github.com/acpica/acpica/commit/76658f55 Signed-off-by: Bob Moore Signed-off-by: Erik Schmauss --- drivers/acpi/acpica/nsaccess.c | 54 +++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c index 7b855603f81a..2566e2d4c780 100644 --- a/drivers/acpi/acpica/nsaccess.c +++ b/drivers/acpi/acpica/nsaccess.c @@ -36,6 +36,7 @@ acpi_status acpi_ns_root_initialize(void) acpi_status status; const struct acpi_predefined_names *init_val = NULL; struct acpi_namespace_node *new_node; + struct acpi_namespace_node *prev_node = NULL; union acpi_operand_object *obj_desc; acpi_string val = NULL; @@ -61,12 +62,28 @@ acpi_status acpi_ns_root_initialize(void) */ acpi_gbl_root_node = &acpi_gbl_root_node_struct; - /* Enter the pre-defined names in the name table */ + /* Enter the predefined names in the name table */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Entering predefined entries into namespace\n")); + /* + * Create the initial (default) namespace. + * This namespace looks like something similar to this: + * + * ACPI Namespace (from Namespace Root): + * 0 _GPE Scope 00203160 00 + * 0 _PR_ Scope 002031D0 00 + * 0 _SB_ Device 00203240 00 Notify Object: 0020ADD8 + * 0 _SI_ Scope 002032B0 00 + * 0 _TZ_ Device 00203320 00 + * 0 _REV Integer 00203390 00 = 0000000000000002 + * 0 _OS_ String 00203488 00 Len 14 "Microsoft Windows NT" + * 0 _GL_ Mutex 00203580 00 Object 002035F0 + * 0 _OSI Method 00203678 00 Args 1 Len 0000 Aml 00000000 + */ for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { + status = AE_OK; /* _OSI is optional for now, will be permanent later */ @@ -75,17 +92,32 @@ acpi_status acpi_ns_root_initialize(void) continue; } - status = - acpi_ns_lookup(NULL, ACPI_CAST_PTR(char, init_val->name), - init_val->type, ACPI_IMODE_LOAD_PASS2, - ACPI_NS_NO_UPSEARCH, NULL, &new_node); - if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, - "Could not create predefined name %s", - init_val->name)); - continue; + /* + * Create, init, and link the new predefined name + * Note: No need to use acpi_ns_lookup here because all the + * predefined names are at the root level. It is much easier to + * just create and link the new node(s) here. + */ + new_node = + ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_namespace_node)); + if (!new_node) { + status = AE_NO_MEMORY; + goto unlock_and_exit; } + ACPI_COPY_NAMESEG(new_node->name.ascii, init_val->name); + new_node->descriptor_type = ACPI_DESC_TYPE_NAMED; + new_node->type = init_val->type; + + if (!prev_node) { + acpi_gbl_root_node_struct.child = new_node; + } else { + prev_node->peer = new_node; + } + + new_node->parent = &acpi_gbl_root_node_struct; + prev_node = new_node; + /* * Name entered successfully. If entry in pre_defined_names[] specifies * an initial value, create the initial value. @@ -131,7 +163,7 @@ acpi_status acpi_ns_root_initialize(void) new_node->value = obj_desc->method.param_count; #else - /* Mark this as a very SPECIAL method */ + /* Mark this as a very SPECIAL method (_OSI) */ obj_desc->method.info_flags = ACPI_METHOD_INTERNAL_ONLY; From patchwork Wed Jul 3 20:15:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schmauss, Erik" X-Patchwork-Id: 11030263 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-2.web.codeaurora.org (Postfix) with ESMTP id E12D318E8 for ; Wed, 3 Jul 2019 20:26:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1A7428617 for ; Wed, 3 Jul 2019 20:26:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C636F28628; Wed, 3 Jul 2019 20:26:38 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 D3B5B28717 for ; Wed, 3 Jul 2019 20:26:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726821AbfGCU0h (ORCPT ); Wed, 3 Jul 2019 16:26:37 -0400 Received: from mga11.intel.com ([192.55.52.93]:5192 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726550AbfGCU0g (ORCPT ); Wed, 3 Jul 2019 16:26:36 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2019 13:26:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,448,1557212400"; d="scan'208";a="158088366" Received: from bartok.jf.intel.com ([10.54.75.137]) by orsmga008.jf.intel.com with ESMTP; 03 Jul 2019 13:26:34 -0700 From: Erik Schmauss To: rjw@rjwysocki.net, linux-acpi@vger.kernel.org Cc: Erik Schmauss , Bob Moore Subject: [PATCH 2/5] ACPICA: remove legacy module-level code due to deprecation Date: Wed, 3 Jul 2019 13:15:37 -0700 Message-Id: <20190703201540.26054-3-erik.schmauss@intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190703201540.26054-1-erik.schmauss@intel.com> References: <20190703201540.26054-1-erik.schmauss@intel.com> 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 ACPICA commit 1ca34b1a7b960ef321eae5dcddfff77707c88aef There have been several places that has been calling functions regarding module level code blocks. This change removes all old vestiges in the codebase. This is dead code. Link: https://github.com/acpica/acpica/commit/1ca34b1a Signed-off-by: Erik Schmauss Signed-off-by: Bob Moore --- drivers/acpi/acpica/acglobal.h | 1 - drivers/acpi/acpica/acnamesp.h | 2 - drivers/acpi/acpica/nseval.c | 190 --------------------------------- drivers/acpi/acpica/nsload.c | 12 --- drivers/acpi/acpica/nsutils.c | 12 --- drivers/acpi/acpica/tbdata.c | 13 --- drivers/acpi/acpica/utinit.c | 1 - drivers/acpi/acpica/utxfinit.c | 13 --- 8 files changed, 244 deletions(-) diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index d056a1845613..fd3beea93421 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h @@ -178,7 +178,6 @@ ACPI_GLOBAL(u8, acpi_gbl_verbose_leak_dump); ACPI_GLOBAL(struct acpi_namespace_node, acpi_gbl_root_node_struct); ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_root_node); ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_fadt_gpe_device); -ACPI_GLOBAL(union acpi_operand_object *, acpi_gbl_module_code_list); extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES]; extern const struct acpi_predefined_names diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 39812fc4386a..7da1864798a0 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h @@ -207,8 +207,6 @@ acpi_ns_dump_object_paths(acpi_object_type type, */ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info); -void acpi_ns_exec_module_code_list(void); - /* * nsarguments - Argument count/type checking for predefined/reserved names */ diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c index 6390b7951ebf..63748ac699f7 100644 --- a/drivers/acpi/acpica/nseval.c +++ b/drivers/acpi/acpica/nseval.c @@ -14,11 +14,6 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME("nseval") -/* Local prototypes */ -static void -acpi_ns_exec_module_code(union acpi_operand_object *method_obj, - struct acpi_evaluate_info *info); - /******************************************************************************* * * FUNCTION: acpi_ns_evaluate @@ -44,7 +39,6 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj, * MUTEX: Locks interpreter * ******************************************************************************/ - acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) { acpi_status status; @@ -310,187 +304,3 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) info->full_pathname = NULL; return_ACPI_STATUS(status); } - -/******************************************************************************* - * - * FUNCTION: acpi_ns_exec_module_code_list - * - * PARAMETERS: None - * - * RETURN: None. Exceptions during method execution are ignored, since - * we cannot abort a table load. - * - * DESCRIPTION: Execute all elements of the global module-level code list. - * Each element is executed as a single control method. - * - * NOTE: With this option enabled, each block of detected executable AML - * code that is outside of any control method is wrapped with a temporary - * control method object and placed on a global list. The methods on this - * list are executed below. - * - * This function executes the module-level code for all tables only after - * all of the tables have been loaded. It is a legacy option and is - * not compatible with other ACPI implementations. See acpi_ns_load_table. - * - * This function will be removed when the legacy option is removed. - * - ******************************************************************************/ - -void acpi_ns_exec_module_code_list(void) -{ - union acpi_operand_object *prev; - union acpi_operand_object *next; - struct acpi_evaluate_info *info; - u32 method_count = 0; - - ACPI_FUNCTION_TRACE(ns_exec_module_code_list); - - /* Exit now if the list is empty */ - - next = acpi_gbl_module_code_list; - if (!next) { - ACPI_DEBUG_PRINT((ACPI_DB_INIT_NAMES, - "Legacy MLC block list is empty\n")); - - return_VOID; - } - - /* Allocate the evaluation information block */ - - info = ACPI_ALLOCATE(sizeof(struct acpi_evaluate_info)); - if (!info) { - return_VOID; - } - - /* Walk the list, executing each "method" */ - - while (next) { - prev = next; - next = next->method.mutex; - - /* Clear the link field and execute the method */ - - prev->method.mutex = NULL; - acpi_ns_exec_module_code(prev, info); - method_count++; - - /* Delete the (temporary) method object */ - - acpi_ut_remove_reference(prev); - } - - ACPI_INFO(("Executed %u blocks of module-level executable AML code", - method_count)); - - ACPI_FREE(info); - acpi_gbl_module_code_list = NULL; - return_VOID; -} - -/******************************************************************************* - * - * FUNCTION: acpi_ns_exec_module_code - * - * PARAMETERS: method_obj - Object container for the module-level code - * info - Info block for method evaluation - * - * RETURN: None. Exceptions during method execution are ignored, since - * we cannot abort a table load. - * - * DESCRIPTION: Execute a control method containing a block of module-level - * executable AML code. The control method is temporarily - * installed to the root node, then evaluated. - * - ******************************************************************************/ - -static void -acpi_ns_exec_module_code(union acpi_operand_object *method_obj, - struct acpi_evaluate_info *info) -{ - union acpi_operand_object *parent_obj; - struct acpi_namespace_node *parent_node; - acpi_object_type type; - acpi_status status; - - ACPI_FUNCTION_TRACE(ns_exec_module_code); - - /* - * Get the parent node. We cheat by using the next_object field - * of the method object descriptor. - */ - parent_node = - ACPI_CAST_PTR(struct acpi_namespace_node, - method_obj->method.next_object); - type = acpi_ns_get_type(parent_node); - - /* - * Get the region handler and save it in the method object. We may need - * this if an operation region declaration causes a _REG method to be run. - * - * We can't do this in acpi_ps_link_module_code because - * acpi_gbl_root_node->Object is NULL at PASS1. - */ - if ((type == ACPI_TYPE_DEVICE) && parent_node->object) { - method_obj->method.dispatch.handler = - parent_node->object->device.handler; - } - - /* Must clear next_object (acpi_ns_attach_object needs the field) */ - - method_obj->method.next_object = NULL; - - /* Initialize the evaluation information block */ - - memset(info, 0, sizeof(struct acpi_evaluate_info)); - info->prefix_node = parent_node; - - /* - * Get the currently attached parent object. Add a reference, - * because the ref count will be decreased when the method object - * is installed to the parent node. - */ - parent_obj = acpi_ns_get_attached_object(parent_node); - if (parent_obj) { - acpi_ut_add_reference(parent_obj); - } - - /* Install the method (module-level code) in the parent node */ - - status = - acpi_ns_attach_object(parent_node, method_obj, ACPI_TYPE_METHOD); - if (ACPI_FAILURE(status)) { - goto exit; - } - - /* Execute the parent node as a control method */ - - status = acpi_ns_evaluate(info); - - ACPI_DEBUG_PRINT((ACPI_DB_INIT_NAMES, - "Executed module-level code at %p\n", - method_obj->method.aml_start)); - - /* Delete a possible implicit return value (in slack mode) */ - - if (info->return_object) { - acpi_ut_remove_reference(info->return_object); - } - - /* Detach the temporary method object */ - - acpi_ns_detach_object(parent_node); - - /* Restore the original parent object */ - - if (parent_obj) { - status = acpi_ns_attach_object(parent_node, parent_obj, type); - } else { - parent_node->type = (u8)type; - } - -exit: - if (parent_obj) { - acpi_ut_remove_reference(parent_obj); - } - return_VOID; -} diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c index 35fff5c75da1..d7c4d6e8e21e 100644 --- a/drivers/acpi/acpica/nsload.c +++ b/drivers/acpi/acpica/nsload.c @@ -109,18 +109,6 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node) ACPI_DEBUG_PRINT((ACPI_DB_INFO, "**** Completed Table Object Initialization\n")); - /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. - */ - acpi_ns_exec_module_code_list(); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index 6bc90d46db5c..b8d007c84d32 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c @@ -560,21 +560,9 @@ struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle) void acpi_ns_terminate(void) { acpi_status status; - union acpi_operand_object *prev; - union acpi_operand_object *next; ACPI_FUNCTION_TRACE(ns_terminate); - /* Delete any module-level code blocks */ - - next = acpi_gbl_module_code_list; - while (next) { - prev = next; - next = next->method.mutex; - prev->method.mutex = NULL; /* Clear the Mutex (cheated) field */ - acpi_ut_remove_reference(prev); - } - /* * Free the entire namespace -- all nodes and all objects * attached to the nodes diff --git a/drivers/acpi/acpica/tbdata.c b/drivers/acpi/acpica/tbdata.c index 933f81316ad2..91a4b984f224 100644 --- a/drivers/acpi/acpica/tbdata.c +++ b/drivers/acpi/acpica/tbdata.c @@ -933,19 +933,6 @@ acpi_tb_load_table(u32 table_index, struct acpi_namespace_node *parent_node) status = acpi_ns_load_table(table_index, parent_node); - /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. - */ - acpi_ns_exec_module_code_list(); - /* * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is * responsible for discovering any new wake GPEs by running _PRW methods diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c index bc124591320e..6f33e7c72327 100644 --- a/drivers/acpi/acpica/utinit.c +++ b/drivers/acpi/acpica/utinit.c @@ -180,7 +180,6 @@ acpi_status acpi_ut_init_globals(void) /* Namespace */ - acpi_gbl_module_code_list = NULL; acpi_gbl_root_node = NULL; acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c index 9f3b1e3a09de..077b1af03283 100644 --- a/drivers/acpi/acpica/utxfinit.c +++ b/drivers/acpi/acpica/utxfinit.c @@ -211,19 +211,6 @@ acpi_status ACPI_INIT_FUNCTION acpi_initialize_objects(u32 flags) ACPI_FUNCTION_TRACE(acpi_initialize_objects); - /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. - */ - acpi_ns_exec_module_code_list(); - /* * Initialize the objects that remain uninitialized. This * runs the executable AML that may be part of the From patchwork Wed Jul 3 20:15:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schmauss, Erik" X-Patchwork-Id: 11030269 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-2.web.codeaurora.org (Postfix) with ESMTP id 2CC701902 for ; Wed, 3 Jul 2019 20:26:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B1FE28617 for ; Wed, 3 Jul 2019 20:26:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F0C328717; Wed, 3 Jul 2019 20:26:39 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 1489C28632 for ; Wed, 3 Jul 2019 20:26:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbfGCU0h (ORCPT ); Wed, 3 Jul 2019 16:26:37 -0400 Received: from mga11.intel.com ([192.55.52.93]:5192 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726581AbfGCU0h (ORCPT ); Wed, 3 Jul 2019 16:26:37 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2019 13:26:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,448,1557212400"; d="scan'208";a="158088369" Received: from bartok.jf.intel.com ([10.54.75.137]) by orsmga008.jf.intel.com with ESMTP; 03 Jul 2019 13:26:34 -0700 From: Erik Schmauss To: rjw@rjwysocki.net, linux-acpi@vger.kernel.org Cc: Bob Moore , Erik Schmauss Subject: [PATCH 3/5] ACPICA: Update for object initialization sequence Date: Wed, 3 Jul 2019 13:15:38 -0700 Message-Id: <20190703201540.26054-4-erik.schmauss@intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190703201540.26054-1-erik.schmauss@intel.com> References: <20190703201540.26054-1-erik.schmauss@intel.com> 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: Bob Moore ACPICA commit 106c72a97f5ca972f29956e5e9a0429b8c4a2723 1) Do not allow the objects to be initialized twice 2) Only package objects require a deferred initialization 3) Cleanup initialization output Link: https://github.com/acpica/acpica/commit/106c72a9 Signed-off-by: Bob Moore Signed-off-by: Erik Schmauss --- drivers/acpi/acpica/dsinit.c | 2 +- drivers/acpi/acpica/nsinit.c | 49 +++++++++++++--------------------- drivers/acpi/acpica/utxfinit.c | 11 ++++++-- 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c index 4ebd23700bbc..a1ffed29903b 100644 --- a/drivers/acpi/acpica/dsinit.c +++ b/drivers/acpi/acpica/dsinit.c @@ -202,7 +202,7 @@ acpi_ds_initialize_objects(u32 table_index, if (ACPI_COMPARE_NAMESEG(table->signature, ACPI_SIG_DSDT)) { ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, - "\nInitializing Namespace objects:\n")); + "\nACPI table initialization:\n")); } /* Summary of objects initialized */ diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c index 53e5d00d3a5e..61e9dfc9fe8c 100644 --- a/drivers/acpi/acpica/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c @@ -55,14 +55,19 @@ acpi_status acpi_ns_initialize_objects(void) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****\n")); ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, - "Completing Region/Field/Buffer/Package initialization:\n")); + "Final data object initialization: ")); - /* Set all init info to zero */ + /* Clear the info block */ memset(&info, 0, sizeof(struct acpi_init_walk_info)); /* Walk entire namespace from the supplied root */ + /* + * TBD: will become ACPI_TYPE_PACKAGE as this type object + * is now the only one that supports deferred initialization + * (forward references). + */ status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, acpi_ns_init_one_object, NULL, &info, NULL); @@ -71,13 +76,8 @@ acpi_status acpi_ns_initialize_objects(void) } ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, - " Initialized %u/%u Regions %u/%u Fields %u/%u " - "Buffers %u/%u Packages (%u nodes)\n", - info.op_region_init, info.op_region_count, - info.field_init, info.field_count, - info.buffer_init, info.buffer_count, - info.package_init, info.package_count, - info.object_count)); + "Namespace contains %u (0x%X) objects\n", + info.object_count, info.object_count)); ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "%u Control Methods found\n%u Op Regions found\n", @@ -382,34 +382,18 @@ acpi_ns_init_one_object(acpi_handle obj_handle, acpi_ex_enter_interpreter(); /* - * Each of these types can contain executable AML code within the - * declaration. + * Only initialization of Package objects can be deferred, in order + * to support forward references. */ switch (type) { - case ACPI_TYPE_REGION: - - info->op_region_init++; - status = acpi_ds_get_region_arguments(obj_desc); - break; - - case ACPI_TYPE_BUFFER_FIELD: - - info->field_init++; - status = acpi_ds_get_buffer_field_arguments(obj_desc); - break; - case ACPI_TYPE_LOCAL_BANK_FIELD: + /* TBD: bank_fields do not require deferred init, remove this code */ + info->field_init++; status = acpi_ds_get_bank_field_arguments(obj_desc); break; - case ACPI_TYPE_BUFFER: - - info->buffer_init++; - status = acpi_ds_get_buffer_arguments(obj_desc); - break; - case ACPI_TYPE_PACKAGE: /* Complete the initialization/resolution of the package object */ @@ -421,8 +405,13 @@ acpi_ns_init_one_object(acpi_handle obj_handle, default: - /* No other types can get here */ + /* No other types should get here */ + status = AE_TYPE; + ACPI_EXCEPTION((AE_INFO, status, + "Opcode is not deferred [%4.4s] (%s)", + acpi_ut_get_node_name(node), + acpi_ut_get_type_name(type))); break; } diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c index 077b1af03283..cf769e94fe0f 100644 --- a/drivers/acpi/acpica/utxfinit.c +++ b/drivers/acpi/acpica/utxfinit.c @@ -211,11 +211,17 @@ acpi_status ACPI_INIT_FUNCTION acpi_initialize_objects(u32 flags) ACPI_FUNCTION_TRACE(acpi_initialize_objects); +#ifdef ACPI_OBSOLETE_BEHAVIOR + /* + * 05/2019: Removed, initialization now happens at both object + * creation and table load time + */ + /* * Initialize the objects that remain uninitialized. This * runs the executable AML that may be part of the - * declaration of these objects: - * operation_regions, buffer_fields, Buffers, and Packages. + * declaration of these objects: operation_regions, buffer_fields, + * bank_fields, Buffers, and Packages. */ if (!(flags & ACPI_NO_OBJECT_INIT)) { status = acpi_ns_initialize_objects(); @@ -223,6 +229,7 @@ acpi_status ACPI_INIT_FUNCTION acpi_initialize_objects(u32 flags) return_ACPI_STATUS(status); } } +#endif /* * Initialize all device/region objects in the namespace. This runs From patchwork Wed Jul 3 20:15:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schmauss, Erik" X-Patchwork-Id: 11030267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1935A1921 for ; Wed, 3 Jul 2019 20:26:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0872A1FE84 for ; Wed, 3 Jul 2019 20:26:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED54D28A1F; Wed, 3 Jul 2019 20:26:38 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 5840428A1F for ; Wed, 3 Jul 2019 20:26:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726833AbfGCU0h (ORCPT ); Wed, 3 Jul 2019 16:26:37 -0400 Received: from mga11.intel.com ([192.55.52.93]:5194 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726739AbfGCU0h (ORCPT ); Wed, 3 Jul 2019 16:26:37 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2019 13:26:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,448,1557212400"; d="scan'208";a="158088372" Received: from bartok.jf.intel.com ([10.54.75.137]) by orsmga008.jf.intel.com with ESMTP; 03 Jul 2019 13:26:34 -0700 From: Erik Schmauss To: rjw@rjwysocki.net, linux-acpi@vger.kernel.org Cc: Erik Schmauss , Bob Moore Subject: [PATCH 4/5] ACPICA: Update table load object initialization Date: Wed, 3 Jul 2019 13:15:39 -0700 Message-Id: <20190703201540.26054-5-erik.schmauss@intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190703201540.26054-1-erik.schmauss@intel.com> References: <20190703201540.26054-1-erik.schmauss@intel.com> 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 ACPICA commit c7ef9f3526765bed8930825dda1eed1a274b9668 Use the common internal "initialize objects" interface Affects: Load() load_table() acpi_load_table Link: https://github.com/acpica/acpica/commit/c7ef9f35 Signed-off-by: Bob Moore Signed-off-by: Erik Schmauss --- drivers/acpi/acpica/exconfig.c | 16 ++++++---------- drivers/acpi/acpica/tbxfload.c | 10 +++------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index 587aeeeb5070..58c04d706723 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c @@ -174,12 +174,9 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, return_ACPI_STATUS(status); } - /* Complete the initialization/resolution of package objects */ + /* Complete the initialization/resolution of new objects */ - status = acpi_ns_walk_namespace(ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, 0, - acpi_ns_init_one_package, NULL, NULL, - NULL); + acpi_ns_initialize_objects(); /* Parameter Data (optional) */ @@ -437,12 +434,11 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, return_ACPI_STATUS(status); } - /* Complete the initialization/resolution of package objects */ + /* Complete the initialization/resolution of new objects */ - status = acpi_ns_walk_namespace(ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, 0, - acpi_ns_init_one_package, NULL, NULL, - NULL); + acpi_ex_exit_interpreter(); + acpi_ns_initialize_objects(); + acpi_ex_enter_interpreter(); /* Store the ddb_handle into the Target operand */ diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c index ef8f8a9f3c9c..86f1693f6d29 100644 --- a/drivers/acpi/acpica/tbxfload.c +++ b/drivers/acpi/acpica/tbxfload.c @@ -297,15 +297,11 @@ acpi_status acpi_load_table(struct acpi_table_header *table) status = acpi_tb_install_and_load_table(ACPI_PTR_TO_PHYSADDR(table), ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &table_index); - if (ACPI_SUCCESS(status)) { - /* Complete the initialization/resolution of package objects */ - status = acpi_ns_walk_namespace(ACPI_TYPE_PACKAGE, - ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, 0, - acpi_ns_init_one_package, - NULL, NULL, NULL); + /* Complete the initialization/resolution of new objects */ + + acpi_ns_initialize_objects(); } return_ACPI_STATUS(status); From patchwork Wed Jul 3 20:15:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schmauss, Erik" X-Patchwork-Id: 11030265 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-2.web.codeaurora.org (Postfix) with ESMTP id F0C3C13B1 for ; Wed, 3 Jul 2019 20:26:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E300528628 for ; Wed, 3 Jul 2019 20:26:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D73AF1FE84; Wed, 3 Jul 2019 20:26:38 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 3507528A22 for ; Wed, 3 Jul 2019 20:26:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726581AbfGCU0h (ORCPT ); Wed, 3 Jul 2019 16:26:37 -0400 Received: from mga11.intel.com ([192.55.52.93]:5194 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726550AbfGCU0h (ORCPT ); Wed, 3 Jul 2019 16:26:37 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2019 13:26:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,448,1557212400"; d="scan'208";a="158088374" Received: from bartok.jf.intel.com ([10.54.75.137]) by orsmga008.jf.intel.com with ESMTP; 03 Jul 2019 13:26:34 -0700 From: Erik Schmauss To: rjw@rjwysocki.net, linux-acpi@vger.kernel.org Cc: Bob Moore , Erik Schmauss Subject: [PATCH 5/5] ACPICA: Update version to 20190703 Date: Wed, 3 Jul 2019 13:15:40 -0700 Message-Id: <20190703201540.26054-6-erik.schmauss@intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190703201540.26054-1-erik.schmauss@intel.com> References: <20190703201540.26054-1-erik.schmauss@intel.com> 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: Bob Moore ACPICA commit 450ffd8b9c100db561ecf23063620cb107d68c30 Version 20190703. Link: https://github.com/acpica/acpica/commit/450ffd8b Signed-off-by: Bob Moore Signed-off-by: Erik Schmauss --- include/acpi/acpixf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 4a8a05401fb5..3845c8fcc94e 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -12,7 +12,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20190509 +#define ACPI_CA_VERSION 0x20190703 #include #include