Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a406dea8 authored by Bob Moore's avatar Bob Moore Committed by Rafael J. Wysocki
Browse files

ACPICA: Cleanup/simplify module-level code support



This prepares the code for eventual removal of the original
style of deferred execution of the MLC.

Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarErik Schmauss <erik.schmauss@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent b4c0de31
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -526,6 +526,9 @@ acpi_status acpi_ev_initialize_region(union acpi_operand_object *region_obj)
				 * Node's object was replaced by this Method object and we
				 * saved the handler in the method object.
				 *
				 * Note: Only used for the legacy MLC support. Will
				 * be removed in the future.
				 *
				 * See acpi_ns_exec_module_code
				 */
				if (!acpi_gbl_execute_tables_as_methods &&
+14 −0
Original line number Diff line number Diff line
@@ -310,6 +310,17 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info)
 * 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)
@@ -325,6 +336,9 @@ void acpi_ns_exec_module_code_list(void)

	next = acpi_gbl_module_code_list;
	if (!next) {
		ACPI_DEBUG_PRINT((ACPI_DB_INIT_NAMES,
				  "Legacy MLC block list is empty\n"));

		return_VOID;
	}

+9 −15
Original line number Diff line number Diff line
@@ -111,23 +111,17 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
			  "**** Completed Table Object Initialization\n"));

	/*
	 * Execute any module-level code that was detected during the table load
	 * phase. Although illegal since ACPI 2.0, there are many machines that
	 * contain this type of code. Each block of detected executable AML code
	 * 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 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.
	 *
	 * This case executes the module-level code for each table immediately
	 * after the table has been loaded. This provides compatibility with
	 * other ACPI implementations. Optionally, the execution can be deferred
	 * until later, see acpi_initialize_objects.
	 * 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.
	 */
	if (!acpi_gbl_execute_tables_as_methods
	    && !acpi_gbl_group_module_level_code) {
	acpi_ns_exec_module_code_list();
	}

	return_ACPI_STATUS(status);
}

+22 −2
Original line number Diff line number Diff line
@@ -27,8 +27,17 @@ ACPI_MODULE_NAME("nsparse")
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Load ACPI/AML table by executing the entire table as a
 *              term_list.
 * DESCRIPTION: Load ACPI/AML table by executing the entire table as a single
 *              large control method.
 *
 * NOTE: The point of this is to execute any module-level code in-place
 * as the table is parsed. Some AML code depends on this behavior.
 *
 * It is a run-time option at this time, but will eventually become
 * the default.
 *
 * Note: This causes the table to only have a single-pass parse.
 * However, this is compatible with other ACPI implementations.
 *
 ******************************************************************************/
acpi_status
@@ -233,6 +242,17 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node)
	ACPI_FUNCTION_TRACE(ns_parse_table);

	if (acpi_gbl_execute_tables_as_methods) {
		/*
		 * This case executes the AML table as one large control method.
		 * The point of this is to execute any module-level code in-place
		 * as the table is parsed. Some AML code depends on this behavior.
		 *
		 * It is a run-time option at this time, but will eventually become
		 * the default.
		 *
		 * Note: This causes the table to only have a single-pass parse.
		 * However, this is compatible with other ACPI implementations.
		 */
		ACPI_DEBUG_PRINT_RAW((ACPI_DB_PARSE,
				      "%s: **** Start table execution pass\n",
				      ACPI_GET_FUNCTION_NAME));
+21 −3
Original line number Diff line number Diff line
@@ -136,10 +136,18 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
				  walk_state->pass_number));

		/*
		 * Handle executable code at "module-level". This refers to
		 * executable opcodes that appear outside of any control method.
		 * 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.
		 */
		if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2) &&
		if (acpi_gbl_group_module_level_code &&
		    (walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2) &&
		    ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) {
			/*
			 * We want to skip If/Else/While constructs during Pass1 because we
@@ -306,6 +314,16 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state,
 *              object to the global list. Note, the mutex field of the method
 *              object is used to link multiple module-level code objects.
 *
 * NOTE: In this legacy option, 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 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.
 *
 ******************************************************************************/

static void
Loading