Skip to contentSkip to conversation

ACPICA: 20131115 Release

PATCH In review Lv Zheng 2 participants 8 messages Nov 21, 2013

Subsystems (2)
lore
Share & tools
lore

Lv Zheng

author
#0 lore raw

cover ACPICA: 20131115 Release

The 20131115 ACPICA kernel resident system updates is linuxized based on the pm/linux-next branch.

The patch set has passed a build/boot test on the following machines:
Dell Inspiron Mini 1010 (i386)
HP Compaq 8200 Elite SFF PC (x86-64)
With the following kernel configuration items enabled:
CONFIG_ACPI
CONFIG_SFI
CONFIG_ACPI_AC
CONFIG_ACPI_BATTERY
CONFIG_ACPI_BUTTON
CONFIG_ACPI_VIDEO
CONFIG_ACPI_FAN
CONFIG_ACPI_DOCK
CONFIG_ACPI_PROCESSOR
CONFIG_ACPI_PROCESSOR_AGGREGATOR
CONFIG_ACPI_IPMI
CONFIG_ACPI_THERMAL
CONFIG_ACPI_CONTAINER
CONFIG_ACPI_SBS
CONFIG_ACPI_NUMA
CONFIG_ACPI_HED
CONFIG_ACPI_APEI
CONFIG_ACPI_APEI_GHES
CONFIG_ACPI_APEI_EINJ
CONFIG_ACPI_APEI_ERST_DEBUG
CONFIG_X86_PM_TIMER
CONFIG_CPU_FREQ
CONFIG_I2C_SCMI
CONFIG_DMAR_TABLE
CONFIG_INTEL_IOMMU
CONFIG_IRQ_REMAP
CONFIG_BLK_DEV_IDEACPI
CONFIG_DRM_I915
CONFIG_DRM_RADEON
CONFIG_DRM_NOUVEAU
CONFIG_SENSORS_ACPI_POWER
CONFIG_SENSORS_ATK0110
CONFIG_INPUT_ATLAS_BTNS
CONFIG_TCG_TPM
All devices under CONFIG_X86_PLATFORM_DEVICES

Please review.

Bob Moore (3):
ACPICA: Debug output: Do not emit function nesting level for kernel
build.
ACPICA: Add support to delete all objects attached to the root
namespace node.
ACPICA: Update version to 20131115.

Lv Zheng (2):
ACPICA: Tests: Add CHECKSUM_ABORT protection for test utilities.
ACPICA: Resources: Fix loop termination for the get AML length
function.

Tomasz Nowicki (1):
ACPICA: Delete all attached data objects during namespace node
deletion.

 drivers/acpi/acpica/acresrc.h  |    6 +++---
 drivers/acpi/acpica/nsalloc.c  |   18 ++++++++++++++----
 drivers/acpi/acpica/nsutils.c  |   18 ++++++++++--------
 drivers/acpi/acpica/rscalc.c   |    9 +++++++--
 drivers/acpi/acpica/rscreate.c |   36 +++++++++++++++++-------------------
 drivers/acpi/acpica/rsutils.c  |    2 +-
 drivers/acpi/acpica/utdebug.c  |   31 ++++++++++++++++++++++++-------
 include/acpi/acconfig.h        |    2 ++
 include/acpi/acpixf.h          |    2 +-
 9 files changed, 79 insertions(+), 45 deletions(-)
Signature · 1 line
1.7.10
author
#1 lore raw

PATCH 1/6 ACPICA: Debug output: Do not emit function nesting level for kernel build.

From: Bob Moore <[email protected]>

The nesting level is really only useful during a single-thread execution. Therefore, only enable this output for the AcpiExec utility. Also, only emit the thread ID when executing under AcpiExec. (Context switches are still detected and a message is emitted.) ACPICA BZ 972.

---
 drivers/acpi/acpica/utdebug.c |   31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)
drivers/acpi/acpica/utdebug.c +24 -7
index 1a67b39..03ae8af 100644
@@ -185,6 +185,7 @@ acpi_debug_print(u32 requested_debug_level,
 		}
 
 		acpi_gbl_prev_thread_id = thread_id;
+		acpi_gbl_nesting_level = 0;
 	}
 
 	/*
@@ -193,13 +194,21 @@ acpi_debug_print(u32 requested_debug_level,
 	 */
 	acpi_os_printf("%9s-%04ld ", module_name, line_number);
 
+#ifdef ACPI_EXEC_APP
+	/*
+	 * For acpi_exec only, emit the thread ID and nesting level.
+	 * Note: nesting level is really only useful during a single-thread
+	 * execution. Otherwise, multiple threads will keep resetting the
+	 * level.
+	 */
 	if (ACPI_LV_THREADS & acpi_dbg_level) {
 		acpi_os_printf("[%u] ", (u32)thread_id);
 	}
 
-	acpi_os_printf("[%02ld] %-22.22s: ",
-		       acpi_gbl_nesting_level,
-		       acpi_ut_trim_function_name(function_name));
+	acpi_os_printf("[%02ld] ", acpi_gbl_nesting_level);
+#endif
+
+	acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name));
 
 	va_start(args, format);
 	acpi_os_vprintf(format, args);
@@ -420,7 +429,9 @@ acpi_ut_exit(u32 line_number,
 				 component_id, "%s\n", acpi_gbl_fn_exit_str);
 	}
 
-	acpi_gbl_nesting_level--;
+	if (acpi_gbl_nesting_level) {
+		acpi_gbl_nesting_level--;
+	}
 }
 
 ACPI_EXPORT_SYMBOL(acpi_ut_exit)
@@ -467,7 +478,9 @@ acpi_ut_status_exit(u32 line_number,
 		}
 	}
 
-	acpi_gbl_nesting_level--;
+	if (acpi_gbl_nesting_level) {
+		acpi_gbl_nesting_level--;
+	}
 }
 
 ACPI_EXPORT_SYMBOL(acpi_ut_status_exit)
@@ -504,7 +517,9 @@ acpi_ut_value_exit(u32 line_number,
 				 ACPI_FORMAT_UINT64(value));
 	}
 
-	acpi_gbl_nesting_level--;
+	if (acpi_gbl_nesting_level) {
+		acpi_gbl_nesting_level--;
+	}
 }
 
 ACPI_EXPORT_SYMBOL(acpi_ut_value_exit)
@@ -540,7 +555,9 @@ acpi_ut_ptr_exit(u32 line_number,
 				 ptr);
 	}
 
-	acpi_gbl_nesting_level--;
+	if (acpi_gbl_nesting_level) {
+		acpi_gbl_nesting_level--;
+	}
 }
 
 #endif
Signature · 1 line
1.7.10
author
#2 lore raw

PATCH 2/6 ACPICA: Tests: Add CHECKSUM_ABORT protection for test utilities.

In reply to Lv Zheng

This patch adds protection around ACPI_CHECKSUM_ABORT so that ACPI user space test utilities can re-define it for their own purposes (currently used by ASLTS build environment).
This patch doesn't affect Linux kernel behavior. Lv Zheng.

---
 include/acpi/acconfig.h |    2 ++
 1 file changed, 2 insertions(+)
include/acpi/acconfig.h +2 -0
index d98c670..3ea214c 100644
@@ -83,7 +83,9 @@
  * Should the subsystem abort the loading of an ACPI table if the
  * table checksum is incorrect?
  */
+#ifndef ACPI_CHECKSUM_ABORT
 #define ACPI_CHECKSUM_ABORT             FALSE
+#endif
 
 /*
  * Generate a version of ACPICA that only supports "reduced hardware"
Signature · 1 line
1.7.10
author
#3 lore raw

PATCH 3/6 ACPICA: Resources: Fix loop termination for the get AML length function.

In reply to Lv Zheng

The loop terminates on a NULL resource pointer, which can never happen since the loop simply increments a valid resource pointer. This fix changes the loop to terminate on an end-of-buffer condition.

Problem can be seen by callers to AcpiSetCurrentResources with an invalid or corrupted resource descriptor; or a resource descriptor without an END_TAG descriptor.

(refined by Bob Moore)

---
 drivers/acpi/acpica/acresrc.h  |    6 +++---
 drivers/acpi/acpica/rscalc.c   |    9 +++++++--
 drivers/acpi/acpica/rscreate.c |   36 +++++++++++++++++-------------------
 drivers/acpi/acpica/rsutils.c  |    2 +-
 4 files changed, 28 insertions(+), 25 deletions(-)
drivers/acpi/acpica/acresrc.h +3 -3
index f691d0e..ff97430 100644
@@ -184,7 +184,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
 			     struct acpi_buffer *output_buffer);
 
 acpi_status
-acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
+acpi_rs_create_aml_resources(struct acpi_buffer *resource_list,
 			     struct acpi_buffer *output_buffer);
 
 acpi_status
@@ -227,8 +227,8 @@ acpi_rs_get_list_length(u8 * aml_buffer,
 			u32 aml_buffer_length, acpi_size * size_needed);
 
 acpi_status
-acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer,
-		       acpi_size * size_needed);
+acpi_rs_get_aml_length(struct acpi_resource *resource_list,
+		       acpi_size resource_list_size, acpi_size * size_needed);
 
 acpi_status
 acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
drivers/acpi/acpica/rscalc.c +7 -2
index b62a0f4..b60c9cf 100644
@@ -174,6 +174,7 @@ acpi_rs_stream_option_length(u32 resource_length,
  * FUNCTION:    acpi_rs_get_aml_length
  *
  * PARAMETERS:  resource            - Pointer to the resource linked list
+ *              resource_list_size  - Size of the resource linked list
  *              size_needed         - Where the required size is returned
  *
  * RETURN:      Status
@@ -185,16 +186,20 @@ acpi_rs_stream_option_length(u32 resource_length,
  ******************************************************************************/
 
 acpi_status
-acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed)
+acpi_rs_get_aml_length(struct acpi_resource *resource,
+		       acpi_size resource_list_size, acpi_size * size_needed)
 {
 	acpi_size aml_size_needed = 0;
+	struct acpi_resource *resource_end;
 	acpi_rs_length total_size;
 
 	ACPI_FUNCTION_TRACE(rs_get_aml_length);
 
 	/* Traverse entire list of internal resource descriptors */
 
-	while (resource) {
+	resource_end =
+	    ACPI_ADD_PTR(struct acpi_resource, resource, resource_list_size);
+	while (resource < resource_end) {
 
 		/* Validate the descriptor type */
 
drivers/acpi/acpica/rscreate.c +17 -19
index 65f3e1c..3a2ace9 100644
@@ -418,22 +418,21 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
  *
  * FUNCTION:    acpi_rs_create_aml_resources
  *
- * PARAMETERS:  linked_list_buffer      - Pointer to the resource linked list
- *              output_buffer           - Pointer to the user's buffer
+ * PARAMETERS:  resource_list           - Pointer to the resource list buffer
+ *              output_buffer           - Where the AML buffer is returned
  *
  * RETURN:      Status  AE_OK if okay, else a valid acpi_status code.
  *              If the output_buffer is too small, the error will be
  *              AE_BUFFER_OVERFLOW and output_buffer->Length will point
  *              to the size buffer needed.
  *
- * DESCRIPTION: Takes the linked list of device resources and
- *              creates a bytestream to be used as input for the
- *              _SRS control method.
+ * DESCRIPTION: Converts a list of device resources to an AML bytestream
+ *              to be used as input for the _SRS control method.
  *
  ******************************************************************************/
 
 acpi_status
-acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
+acpi_rs_create_aml_resources(struct acpi_buffer *resource_list,
 			     struct acpi_buffer *output_buffer)
 {
 	acpi_status status;
@@ -441,16 +440,16 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
 
 	ACPI_FUNCTION_TRACE(rs_create_aml_resources);
 
-	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "LinkedListBuffer = %p\n",
-			  linked_list_buffer));
+	/* Params already validated, no need to re-validate here */
 
-	/*
-	 * Params already validated, so we don't re-validate here
-	 *
-	 * Pass the linked_list_buffer into a module that calculates
-	 * the buffer size needed for the byte stream.
-	 */
-	status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed);
+	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ResourceList Buffer = %p\n",
+			  resource_list->pointer));
+
+	/* Get the buffer size needed for the AML byte stream */
+
+	status = acpi_rs_get_aml_length(resource_list->pointer,
+					resource_list->length,
+					&aml_size_needed);
 
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n",
 			  (u32)aml_size_needed, acpi_format_exception(status)));
@@ -467,10 +466,9 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
 
 	/* Do the conversion */
 
-	status =
-	    acpi_rs_convert_resources_to_aml(linked_list_buffer,
-					     aml_size_needed,
-					     output_buffer->pointer);
+	status = acpi_rs_convert_resources_to_aml(resource_list->pointer,
+						  aml_size_needed,
+						  output_buffer->pointer);
 	if (ACPI_FAILURE(status)) {
 		return_ACPI_STATUS(status);
 	}
drivers/acpi/acpica/rsutils.c +1 -1
index aef303d..14a7982 100644
@@ -753,7 +753,7 @@ acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
 	 * Convert the linked list into a byte stream
 	 */
 	buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
-	status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer);
+	status = acpi_rs_create_aml_resources(in_buffer, &buffer);
 	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
Signature · 1 line
1.7.10
author
#4 lore raw

PATCH 4/6 ACPICA: Delete all attached data objects during namespace node deletion.

In reply to Lv Zheng

From: Tomasz Nowicki <[email protected]>

This fix updates namespace node deletion to delete the entire list of attached objects (attached via AcpiAttachObject) instead of just one of the attached items. ACPICA BZ 1024.
Tomasz Nowicki ([email protected]).

---
 drivers/acpi/acpica/nsalloc.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/acpi/acpica/nsalloc.c +8 -4
index 2437373..bc3f598 100644
@@ -106,6 +106,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name)
 void acpi_ns_delete_node(struct acpi_namespace_node *node)
 {
 	union acpi_operand_object *obj_desc;
+	union acpi_operand_object *next_desc;
 
 	ACPI_FUNCTION_NAME(ns_delete_node);
 
@@ -114,12 +115,13 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
 	acpi_ns_detach_object(node);
 
 	/*
-	 * Delete an attached data object if present (an object that was created
-	 * and attached via acpi_attach_data). Note: After any normal object is
-	 * detached above, the only possible remaining object is a data object.
+	 * Delete an attached data object list if present (objects that were
+	 * attached via acpi_attach_data). Note: After any normal object is
+	 * detached above, the only possible remaining object(s) are data
+	 * objects, in a linked list.
 	 */
 	obj_desc = node->object;
-	if (obj_desc && (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) {
+	while (obj_desc && (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) {
 
 		/* Invoke the attached data deletion handler if present */
 
@@ -127,7 +129,9 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
 			obj_desc->data.handler(node, obj_desc->data.pointer);
 		}
 
+		next_desc = obj_desc->common.next_object;
 		acpi_ut_remove_reference(obj_desc);
+		obj_desc = next_desc;
 	}
 
 	/* Now we can delete the node */
Signature · 1 line
1.7.10
author
#5 lore raw

PATCH 5/6 ACPICA: Add support to delete all objects attached to the root namespace node.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

This fix deletes any and all objects that have been attached to the root node (via AcpiAttachData). Reported by Tomasz Nowicki. ACPICA BZ 1026.

---
 drivers/acpi/acpica/nsalloc.c |    6 ++++++
 drivers/acpi/acpica/nsutils.c |   18 ++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)
drivers/acpi/acpica/nsalloc.c +6 -0
index bc3f598..fd1ff54 100644
@@ -134,6 +134,12 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node)
 		obj_desc = next_desc;
 	}
 
+	/* Special case for the statically allocated root node */
+
+	if (node == acpi_gbl_root_node) {
+		return;
+	}
+
 	/* Now we can delete the node */
 
 	(void)acpi_os_release_object(acpi_gbl_namespace_cache, node);
drivers/acpi/acpica/nsutils.c +10 -8
index cc2fea9..4a0665b 100644
@@ -593,24 +593,26 @@ struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle)
 
 void acpi_ns_terminate(void)
 {
-	union acpi_operand_object *obj_desc;
+	acpi_status status;
 
 	ACPI_FUNCTION_TRACE(ns_terminate);
 
 	/*
-	 * 1) Free the entire namespace -- all nodes and objects
-	 *
-	 * Delete all object descriptors attached to namepsace nodes
+	 * Free the entire namespace -- all nodes and all objects
+	 * attached to the nodes
 	 */
 	acpi_ns_delete_namespace_subtree(acpi_gbl_root_node);
 
-	/* Detach any objects attached to the root */
+	/* Delete any objects attached to the root node */
 
-	obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node);
-	if (obj_desc) {
-		acpi_ns_detach_object(acpi_gbl_root_node);
+	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
+	if (ACPI_FAILURE(status)) {
+		return_VOID;
 	}
 
+	acpi_ns_delete_node(acpi_gbl_root_node);
+	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
+
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n"));
 	return_VOID;
 }
Signature · 1 line
1.7.10
author
#6 lore raw

PATCH 6/6 ACPICA: Update version to 20131115.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Version 20131115.

---
 include/acpi/acpixf.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpixf.h +1 -1
index d8f9457..4278aba9 100644
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20130927
+#define ACPI_CA_VERSION                 0x20131115
 
 #include <acpi/acconfig.h>
 #include <acpi/actypes.h>
Signature · 1 line
1.7.10
#7 lore raw
In reply to Lv Zheng
Quoted 61 lines · Lv Zheng

The 20131115 ACPICA kernel resident system updates is linuxized based on the pm/linux-next branch.

The patch set has passed a build/boot test on the following machines:
Dell Inspiron Mini 1010 (i386)
HP Compaq 8200 Elite SFF PC (x86-64)
With the following kernel configuration items enabled:
CONFIG_ACPI
CONFIG_SFI
CONFIG_ACPI_AC
CONFIG_ACPI_BATTERY
CONFIG_ACPI_BUTTON
CONFIG_ACPI_VIDEO
CONFIG_ACPI_FAN
CONFIG_ACPI_DOCK
CONFIG_ACPI_PROCESSOR
CONFIG_ACPI_PROCESSOR_AGGREGATOR
CONFIG_ACPI_IPMI
CONFIG_ACPI_THERMAL
CONFIG_ACPI_CONTAINER
CONFIG_ACPI_SBS
CONFIG_ACPI_NUMA
CONFIG_ACPI_HED
CONFIG_ACPI_APEI
CONFIG_ACPI_APEI_GHES
CONFIG_ACPI_APEI_EINJ
CONFIG_ACPI_APEI_ERST_DEBUG
CONFIG_X86_PM_TIMER
CONFIG_CPU_FREQ
CONFIG_I2C_SCMI
CONFIG_DMAR_TABLE
CONFIG_INTEL_IOMMU
CONFIG_IRQ_REMAP
CONFIG_BLK_DEV_IDEACPI
CONFIG_DRM_I915
CONFIG_DRM_RADEON
CONFIG_DRM_NOUVEAU
CONFIG_SENSORS_ACPI_POWER
CONFIG_SENSORS_ATK0110
CONFIG_INPUT_ATLAS_BTNS
CONFIG_TCG_TPM
All devices under CONFIG_X86_PLATFORM_DEVICES

Please review.

Bob Moore (3):
ACPICA: Debug output: Do not emit function nesting level for kernel
build.
ACPICA: Add support to delete all objects attached to the root
namespace node.
ACPICA: Update version to 20131115.

Lv Zheng (2):
ACPICA: Tests: Add CHECKSUM_ABORT protection for test utilities.
ACPICA: Resources: Fix loop termination for the get AML length
function.

Tomasz Nowicki (1):
ACPICA: Delete all attached data objects during namespace node
deletion.

Quoted 10 lines
 drivers/acpi/acpica/acresrc.h  |    6 +++---
 drivers/acpi/acpica/nsalloc.c  |   18 ++++++++++++++----
 drivers/acpi/acpica/nsutils.c  |   18 ++++++++++--------
 drivers/acpi/acpica/rscalc.c   |    9 +++++++--
 drivers/acpi/acpica/rscreate.c |   36 +++++++++++++++++-------------------
 drivers/acpi/acpica/rsutils.c  |    2 +-
 drivers/acpi/acpica/utdebug.c  |   31 ++++++++++++++++++++++++-------
 include/acpi/acconfig.h        |    2 ++
 include/acpi/acpixf.h          |    2 +-
 9 files changed, 79 insertions(+), 45 deletions(-)

Since these are mostly fixes, I've queued up this series for the next ACPI pull request for 3.13 (next week most likely).

I've fixed up the two changelogs that used unconverted function names.

Thanks!

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.