Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1363848

[PATCH 29/30] ACPICA: Namespace: Reorder \_SB._INI to make sure it is evaluated before _REG evaluations

From Lv Zheng <lv.zheng@intel.com>
Newsgroups linux.kernel
Subject [PATCH 29/30] ACPICA: Namespace: Reorder \_SB._INI to make sure it is evaluated before _REG evaluations
Date 2016-03-24 02:50 +0100
Message-ID <rg2zp-3Dt-13@gated-at.bofh.it> (permalink)
References <rg2pH-3zI-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


ACPICA commit f005ee6b90d152c1f499efcca6b771a93903cb55

This patch splits \_SB._INI evaluation from device initialization code, so
that it can be performed before PCI_Config _REG evaluations. This is
required for the device enumeration process. Some named objects are
initialized in \_SB._INI and PCI_Config _REG evaluations may use
uninitialized named objects because of the order issue.

This must be fixed before fixing ECDT order issue. There are existing
tables allowing ECDT EC to be used for the entire device enumeration
process, but the enabling of ECDT EC is done in \_SB._INI. Thus \_SB._INI
must be the first control method evaluated in the device enumeration
process. Normally, the order should be automatically ensured by the device
enumeration process itself (for example, PCI_Config _REGs are evaluated by
the PCI bus driver when the driver is probed by the enumeration process),
but since the process is split on Linux (partially done in Linux, partially
done in ACPICA), we need to ensure this with special logics in order to be
regression safe. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/f005ee6b
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
---
 drivers/acpi/acpica/nsinit.c |   75 ++++++++++++++++++++++++++++++------------
 1 file changed, 54 insertions(+), 21 deletions(-)

diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index 2de8adb..36643a8 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -140,6 +140,7 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
 {
 	acpi_status status = AE_OK;
 	struct acpi_device_walk_info info;
+	acpi_handle handle;
 
 	ACPI_FUNCTION_TRACE(ns_initialize_devices);
 
@@ -190,6 +191,27 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
 		if (ACPI_SUCCESS(status)) {
 			info.num_INI++;
 		}
+
+		/*
+		 * Execute \_SB._INI.
+		 * There appears to be a strict order requirement for \_SB._INI,
+		 * which should be evaluated before any _REG evaluations.
+		 */
+		status = acpi_get_handle(NULL, "\\_SB", &handle);
+		if (ACPI_SUCCESS(status)) {
+			memset(info.evaluate_info, 0,
+			       sizeof(struct acpi_evaluate_info));
+			info.evaluate_info->prefix_node = handle;
+			info.evaluate_info->relative_pathname =
+			    METHOD_NAME__INI;
+			info.evaluate_info->parameters = NULL;
+			info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE;
+
+			status = acpi_ns_evaluate(info.evaluate_info);
+			if (ACPI_SUCCESS(status)) {
+				info.num_INI++;
+			}
+		}
 	}
 
 	/*
@@ -198,6 +220,12 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
 	 * Note: Any objects accessed by the _REG methods will be automatically
 	 * initialized, even if they contain executable AML (see the call to
 	 * acpi_ns_initialize_objects below).
+	 *
+	 * Note: According to the ACPI specification, we actually needn't execute
+	 * _REG for system_memory/system_io operation regions, but for PCI_Config
+	 * operation regions, it is required to evaluate _REG for those on a PCI
+	 * root bus that doesn't contain _BBN object. So this code is kept here
+	 * in order not to break things.
 	 */
 	if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -592,32 +620,37 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
 	 * Note: We know there is an _INI within this subtree, but it may not be
 	 * under this particular device, it may be lower in the branch.
 	 */
-	ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
-			(ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI));
-
-	memset(info, 0, sizeof(struct acpi_evaluate_info));
-	info->prefix_node = device_node;
-	info->relative_pathname = METHOD_NAME__INI;
-	info->parameters = NULL;
-	info->flags = ACPI_IGNORE_RETURN_VALUE;
-
-	status = acpi_ns_evaluate(info);
-	if (ACPI_SUCCESS(status)) {
-		walk_info->num_INI++;
-	}
+	if (!ACPI_COMPARE_NAME(device_node->name.ascii, "_SB_") ||
+	    device_node->parent != acpi_gbl_root_node) {
+		ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
+				(ACPI_TYPE_METHOD, device_node,
+				 METHOD_NAME__INI));
+
+		memset(info, 0, sizeof(struct acpi_evaluate_info));
+		info->prefix_node = device_node;
+		info->relative_pathname = METHOD_NAME__INI;
+		info->parameters = NULL;
+		info->flags = ACPI_IGNORE_RETURN_VALUE;
+
+		status = acpi_ns_evaluate(info);
+		if (ACPI_SUCCESS(status)) {
+			walk_info->num_INI++;
+		}
 #ifdef ACPI_DEBUG_OUTPUT
-	else if (status != AE_NOT_FOUND) {
+		else if (status != AE_NOT_FOUND) {
 
-		/* Ignore error and move on to next device */
+			/* Ignore error and move on to next device */
 
-		char *scope_name =
-		    acpi_ns_get_normalized_pathname(device_node, TRUE);
+			char *scope_name =
+			    acpi_ns_get_normalized_pathname(device_node, TRUE);
 
-		ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution",
-				scope_name));
-		ACPI_FREE(scope_name);
-	}
+			ACPI_EXCEPTION((AE_INFO, status,
+					"during %s._INI execution",
+					scope_name));
+			ACPI_FREE(scope_name);
+		}
 #endif
+	}
 
 	/* Ignore errors from above */
 
-- 
1.7.10

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/30] ACPICA: 20160318 Release Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:40 +0100
  [PATCH 28/30] ACPICA: Events: Fix an issue that _REG association can happen before namespace is initialized Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 24/30] ACPICA: Hardware: Add access_width/bit_offset support in acpi_hw_read() Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
    RE: [PATCH 24/30] ACPICA: Hardware: Add access_width/bit_offset  support in acpi_hw_read() "Zheng, Lv" <lv.zheng@intel.com> - 2016-03-29 10:20 +0200
  [PATCH 21/30] ACPICA: Utilities: Add ACPI_IS_POWER_OF_TWO() Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 26/30] ACPICA: Interpreter: Fix wrong conditions for acpi_ev_install_region_handlers() invocation Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 17/30] ACPICA: Add support for QNX 6.6 platform Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 14/30] ACPICA: iASL: Cleanup/optimization for ToPLD macro support Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 29/30] ACPICA: Namespace: Reorder \_SB._INI to make sure it is evaluated before _REG evaluations Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 30/30] ACPICA: Update version to 20160318 Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 16/30] ACPICA: Headers: Update generation of the ACPICA library Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 20/30] ACPICA: iASL/Disassembler: Improve handling of unresolved methods Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 19/30] ACPICA: All: const keyword changes across the ACPICA source Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 25/30] ACPICA: Hardware: Add access_width/bit_offset support for acpi_hw_write() Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 18/30] ACPICA: Utilities: Update for strtoul64 merger Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 13/30] ACPICA: Interpreter: Update some function headers, no functional change Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 22/30] Utilities: Fix missing parentheses in ACPI_GET_BITS()/ACPI_SET_BITS() Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 23/30] ACPICA: Hardware: Enhance acpi_hw_validate_register() with access_width/bit_offset awareness Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 15/30] ACPICA: Cleanup some invocation indentations, no functional change Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 12/30] ACPICA: Intepreter: Add object extensions to Concatenate operand Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 27/30] ACPICA: Tables: Fix wrong MLC condition for dynamic table loading Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  [PATCH 06/30] ACPICA: IORT: Add in support for the SMMUv3 subtable Lv Zheng <lv.zheng@intel.com> - 2016-03-24 02:50 +0100
  Re: [PATCH 00/30] ACPICA: 20160318 Release "Rafael J. Wysocki" <rafael@kernel.org> - 2016-03-24 14:10 +0100
    RE: [PATCH 00/30] ACPICA: 20160318 Release "Zheng, Lv" <lv.zheng@intel.com> - 2016-03-28 05:10 +0200

csiph-web