Skip to contentSkip to conversation

ACPICA 20121220 Release

PATCH In review Lv Zheng 2 participants 33 messages Dec 31, 2012 – Jan 11, 2013

Subsystems (2)
lore
Share & tools
lore

Lv Zheng

author
#0 lore raw

cover ACPICA 20121220 Release

The 20121220 ACPICA linuxized patches are based on the pm/acpica branch with 20121114 ACPICA linuxized patches applied.

QA process result:
1. Basic build/boot test passed:
Debian testing on DELL Inspiron Mini (Intel ATOM z530)
2. Coding style issues have been decreased:
4132 Lines -> 4114 Lines
3. Current source code differences between Linux and ACPICA with some unpublished patches is:
59.3 Kbytes, 1641 Lines
4. Reviewed in release engineering, result is attached as follows:
ACPICA has released 56 patches in 20121220, 27 patches of them have modified the source codes used in Linux.

   20121220 | ACPICA | Reviewed | ACPICA only  | Human intervention
   01       | 01     | o        | x            | x
   02       | 05     | o        | x            | x
   03       | 06     | o        | x(hwtimer.c) | x
   04       | 07     | o        | x            | x
   05       | 08     | o        | x            | x
   06       | 18     | o        | x            | o (slow hardware)
   07(TPM2) | 20     | o        | x            | x
   08       | 21     | o        | x            | x
   09       | 23     | x        | x            | x
   10       | 24     | o        | x            | x
   11       | 25     | o        | x            | o (return_UINTx)
   12       | 26     | o        | x            | o (debug enabling)
   13       | 27     | o        | o(rsdump.c)  | x
   14       | 28     | o        | x            | x
   15(CSRT) | 30     | o        | x            | x
   16(TPM2) | 31     | o        | x            | x
   17       | 32     | o        | x            | x
   18       | 34     | o        | x            | x
   19       | 35     | o        | x            | x
   20       | 36     | o        | x            | x
   21       | 37     | o        | x            | x
   22       | 38     | o        | x            | x
   23       | 39     | o        | x            | x
   24       | 41     | o        | x            | x
   25       | 43     | o        | x            | x
   26       | 46     | x        | x            | x
   27       | 56     | o        | x            | x

This information may also be useful for the reviewers.
Note: Though not-reviewed patches are checked by divergences check
script, the purposes are still get examined by human eyes. No divergences on affected source files will be taken as good patch.
Note: ACPICA-only patches should not do any funtional changes to
Linux.
Note: Human intervention is required for some patches due to the
coding style differences. Such intervention is not recorded in the table above, only actual code insertions/deletions are recorded.

Please review.

Aaron Lu (2):
ACPICA: Resource manager: Add support for ACPI 5 wake bit in IRQ
descriptor.
ACPICA: Resources: Support for ACPI 5 wake bit in ExtendedInterrupt
descriptor.

Bob Moore (23):
ACPICA: Resources: New interface, AcpiWalkResourceBuffer.
ACPICA: Change exception code for LoadTable operator.
ACPICA: Eliminate some small unnecessary pathname functions.
ACPICA: Add root node optimization to internal get namespace node
function.
ACPICA: Lint changes, no functional change.
ACPICA: Add time macros for various timer/time manipulation.
ACPICA: Add header file support for the ACPI 5 TPM2 ACPI table.
ACPICA: DEBUG_PRINT macros: Update to improve performance.
ACPICA: FUNCTION_TRACE macros: Check if debug is enabled up-front.
ACPICA: Eliminate superfluous return_UINT8 and return_UINT32 macros.
ACPICA: Update ACPI_IS_DEBUG_ENABLED macro.
ACPICA: Deploy new ACPI_IS_DEBUG_ENABLED macro in debug output code.
ACPICA: Merge all debug output macros into a single file, acoutput.
ACPICA: iASL: Finish support for CSRT table.
ACPICA: iASL: Finish support for the TPM2 table.
ACPICA: Update for non-configured ACPI_IS_DEBUG_ENABLED macro.
ACPICA: Namespace: Eliminate dot...dot output during initialization.
ACPICA: Update ACPICA initialization messages.
ACPICA: Interpreter: Add warning if 64-bit constant appears in 32-bit
table.
ACPICA: Resources: Split interrupt share/wake bits into two fields.
ACPICA: Interpreter: Fix Store() when implicit conversion is not
possible.
ACPICA: Source restructuring: split large files into 8 new files.
ACPICA: Update version to 20121220.

Rafael J. Wysocki (1):
ACPICA: Resource Manager: Add a pointer cast for a namespace node.

Tim Gardner (1):
ACPICA: Fix possible memory leak in dispatcher error path.

 drivers/acpi/acpica/Makefile     |    8 +-
 drivers/acpi/acpica/acdebug.h    |   17 +
 drivers/acpi/acpica/acevents.h   |   21 +-
 drivers/acpi/acpica/acinterp.h   |    2 +-
 drivers/acpi/acpica/acmacros.h   |  137 +------
 drivers/acpi/acpica/acnamesp.h   |   14 +-
 drivers/acpi/acpica/acparser.h   |   25 +-
 drivers/acpi/acpica/acresrc.h    |    6 +-
 drivers/acpi/acpica/acutils.h    |   50 ++-
 drivers/acpi/acpica/dsmethod.c   |    1 +
 drivers/acpi/acpica/dsobject.c   |   14 +-
 drivers/acpi/acpica/dsutils.c    |   10 +-
 drivers/acpi/acpica/dswexec.c    |    4 +-
 drivers/acpi/acpica/evgpe.c      |    6 +-
 drivers/acpi/acpica/evgpeblk.c   |   22 +-
 drivers/acpi/acpica/evgpeinit.c  |    3 +
 drivers/acpi/acpica/evhandler.c  |  529 ++++++++++++++++++++++++
 drivers/acpi/acpica/evregion.c   |  582 +++------------------------
 drivers/acpi/acpica/evsci.c      |    4 +-
 drivers/acpi/acpica/exconfig.c   |    7 +-
 drivers/acpi/acpica/exconvrt.c   |    2 +-
 drivers/acpi/acpica/exdump.c     |   19 +-
 drivers/acpi/acpica/exprep.c     |    4 +-
 drivers/acpi/acpica/exstore.c    |   29 +-
 drivers/acpi/acpica/exstoren.c   |    2 +-
 drivers/acpi/acpica/exutils.c    |   22 +-
 drivers/acpi/acpica/hwacpi.c     |    8 +-
 drivers/acpi/acpica/hwsleep.c    |    2 +-
 drivers/acpi/acpica/hwtimer.c    |    7 +-
 drivers/acpi/acpica/hwxfsleep.c  |    2 +-
 drivers/acpi/acpica/nsdump.c     |    8 +-
 drivers/acpi/acpica/nsinit.c     |   21 +-
 drivers/acpi/acpica/nspredef.c   |  581 +-------------------------
 drivers/acpi/acpica/nsprepkg.c   |  621 ++++++++++++++++++++++++++++
 drivers/acpi/acpica/nsutils.c    |   77 ++--
 drivers/acpi/acpica/nsxfeval.c   |    2 +-
 drivers/acpi/acpica/nsxfname.c   |    2 +-
 drivers/acpi/acpica/psargs.c     |    7 +-
 drivers/acpi/acpica/psloop.c     |  621 ----------------------------
 drivers/acpi/acpica/psobject.c   |  647 +++++++++++++++++++++++++++++
 drivers/acpi/acpica/psopcode.c   |  172 --------
 drivers/acpi/acpica/psopinfo.c   |  223 ++++++++++
 drivers/acpi/acpica/psutils.c    |    8 -
 drivers/acpi/acpica/rsdump.c     |  419 +------------------
 drivers/acpi/acpica/rsdumpinfo.c |  454 +++++++++++++++++++++
 drivers/acpi/acpica/rsirq.c      |   32 +-
 drivers/acpi/acpica/rsserial.c   |    8 +-
 drivers/acpi/acpica/rsutils.c    |    4 +-
 drivers/acpi/acpica/rsxface.c    |  101 +++--
 drivers/acpi/acpica/tbxfload.c   |    2 +-
 drivers/acpi/acpica/utaddress.c  |    4 +-
 drivers/acpi/acpica/utdebug.c    |  118 ++++--
 drivers/acpi/acpica/utdelete.c   |    2 +-
 drivers/acpi/acpica/utmisc.c     |  828 ++++----------------------------------
 drivers/acpi/acpica/utownerid.c  |  218 ++++++++++
 drivers/acpi/acpica/utstring.c   |  574 ++++++++++++++++++++++++++
 include/acpi/acconfig.h          |    1 +
 include/acpi/acoutput.h          |  150 ++++++-
 include/acpi/acpixf.h            |    7 +-
 include/acpi/acrestyp.h          |   10 +-
 include/acpi/actbl2.h            |   23 +-
 include/acpi/actbl3.h            |   32 +-
 include/acpi/actypes.h           |   21 +-
 63 files changed, 4068 insertions(+), 3489 deletions(-)
 create mode 100644 drivers/acpi/acpica/evhandler.c
 create mode 100644 drivers/acpi/acpica/nsprepkg.c
 create mode 100644 drivers/acpi/acpica/psobject.c
 create mode 100644 drivers/acpi/acpica/psopinfo.c
 create mode 100644 drivers/acpi/acpica/rsdumpinfo.c
 create mode 100644 drivers/acpi/acpica/utownerid.c
 create mode 100644 drivers/acpi/acpica/utstring.c
Signature · 1 line
1.7.10
author
#1 lore raw

PATCH 1/27 ACPICA: Resources: New interface, AcpiWalkResourceBuffer.

From: Bob Moore <[email protected]>

Implements a new interface for walking resource lists that it at a lower level than the existing AcpiWalkResources. (Method is not executed.)

---
 drivers/acpi/acpica/rsxface.c |  101 ++++++++++++++++++++++++++++-------------
 include/acpi/acpixf.h         |    5 ++
 include/acpi/actypes.h        |    4 ++
 3 files changed, 79 insertions(+), 31 deletions(-)
drivers/acpi/acpica/rsxface.c +70 -31
index 3a5ace7..a4086aab 100644
@@ -423,7 +423,7 @@ ACPI_EXPORT_SYMBOL(acpi_resource_to_address64)
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Walk a resource template for the specified evice to find a
+ * DESCRIPTION: Walk a resource template for the specified device to find a
  *              vendor-defined resource that matches the supplied UUID and
  *              UUID subtype. Returns a struct acpi_resource of type Vendor.
  *
@@ -522,57 +522,42 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_walk_resources
+ * FUNCTION:    acpi_walk_resource_buffer
  *
- * PARAMETERS:  device_handle   - Handle to the device object for the
- *                                device we are querying
- *              name            - Method name of the resources we want.
- *                                (METHOD_NAME__CRS, METHOD_NAME__PRS, or
- *                                METHOD_NAME__AEI)
+ * PARAMETERS:  buffer          - Formatted buffer returned by one of the
+ *                                various Get*Resource functions
  *              user_function   - Called for each resource
  *              context         - Passed to user_function
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Retrieves the current or possible resource list for the
- *              specified device. The user_function is called once for
- *              each resource in the list.
+ * DESCRIPTION: Walks the input resource template. The user_function is called
+ *              once for each resource in the list.
  *
  ******************************************************************************/
+
 acpi_status
-acpi_walk_resources(acpi_handle device_handle,
-		    char *name,
-		    acpi_walk_resource_callback user_function, void *context)
+acpi_walk_resource_buffer(struct acpi_buffer * buffer,
+			  acpi_walk_resource_callback user_function,
+			  void *context)
 {
-	acpi_status status;
-	struct acpi_buffer buffer;
+	acpi_status status = AE_OK;
 	struct acpi_resource *resource;
 	struct acpi_resource *resource_end;
 
-	ACPI_FUNCTION_TRACE(acpi_walk_resources);
+	ACPI_FUNCTION_TRACE(acpi_walk_resource_buffer);
 
 	/* Parameter validation */
 
-	if (!device_handle || !user_function || !name ||
-	    (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) &&
-	     !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS) &&
-	     !ACPI_COMPARE_NAME(name, METHOD_NAME__AEI))) {
+	if (!buffer || !buffer->pointer || !user_function) {
 		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	/* Get the _CRS/_PRS/_AEI resource list */
-
-	buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
-	status = acpi_rs_get_method_data(device_handle, name, &buffer);
-	if (ACPI_FAILURE(status)) {
-		return_ACPI_STATUS(status);
-	}
-
-	/* Buffer now contains the resource list */
+	/* Buffer contains the resource list and length */
 
-	resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer);
+	resource = ACPI_CAST_PTR(struct acpi_resource, buffer->pointer);
 	resource_end =
-	    ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length);
+	    ACPI_ADD_PTR(struct acpi_resource, buffer->pointer, buffer->length);
 
 	/* Walk the resource list until the end_tag is found (or buffer end) */
 
@@ -609,6 +594,60 @@ acpi_walk_resources(acpi_handle device_handle,
 		resource = ACPI_NEXT_RESOURCE(resource);
 	}
 
+	return_ACPI_STATUS(status);
+}
+
+ACPI_EXPORT_SYMBOL(acpi_walk_resource_buffer)
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_walk_resources
+ *
+ * PARAMETERS:  device_handle   - Handle to the device object for the
+ *                                device we are querying
+ *              name            - Method name of the resources we want.
+ *                                (METHOD_NAME__CRS, METHOD_NAME__PRS, or
+ *                                METHOD_NAME__AEI)
+ *              user_function   - Called for each resource
+ *              context         - Passed to user_function
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Retrieves the current or possible resource list for the
+ *              specified device. The user_function is called once for
+ *              each resource in the list.
+ *
+ ******************************************************************************/
+acpi_status
+acpi_walk_resources(acpi_handle device_handle,
+		    char *name,
+		    acpi_walk_resource_callback user_function, void *context)
+{
+	acpi_status status;
+	struct acpi_buffer buffer;
+
+	ACPI_FUNCTION_TRACE(acpi_walk_resources);
+
+	/* Parameter validation */
+
+	if (!device_handle || !user_function || !name ||
+	    (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) &&
+	     !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS) &&
+	     !ACPI_COMPARE_NAME(name, METHOD_NAME__AEI))) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	/* Get the _CRS/_PRS/_AEI resource list */
+
+	buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
+	status = acpi_rs_get_method_data(device_handle, name, &buffer);
+	if (ACPI_FAILURE(status)) {
+		return_ACPI_STATUS(status);
+	}
+
+	/* Walk the resource list and cleanup */
+
+	status = acpi_walk_resource_buffer(&buffer, user_function, context);
 	ACPI_FREE(buffer.pointer);
 	return_ACPI_STATUS(status);
 }
include/acpi/acpixf.h +5 -0
index 3c9c783..afacb5a 100644
@@ -444,6 +444,11 @@ acpi_get_event_resources(acpi_handle device_handle,
 			 struct acpi_buffer *ret_buffer);
 
 acpi_status
+acpi_walk_resource_buffer(struct acpi_buffer *buffer,
+			  acpi_walk_resource_callback user_function,
+			  void *context);
+
+acpi_status
 acpi_walk_resources(acpi_handle device,
 		    char *name,
 		    acpi_walk_resource_callback user_function, void *context);
include/acpi/actypes.h +4 -0
index 6882227..3de70ed 100644
@@ -881,6 +881,10 @@ struct acpi_buffer {
 	void *pointer;		/* pointer to buffer */
 };
 
+/* Free a buffer created in an struct acpi_buffer via ACPI_ALLOCATE_LOCAL_BUFFER */
+
+#define ACPI_FREE_BUFFER(b)         ACPI_FREE(b.pointer)
+
 /*
  * name_type for acpi_get_name
  */
Signature · 1 line
1.7.10
author
#2 lore raw

PATCH 2/27 ACPICA: Change exception code for LoadTable operator.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

For the case where one of the input strings is too long, change the returned exception code from AE_BAD_PARAMETER to AE_AML_STRING_LIMIT.

---
 drivers/acpi/acpica/exconfig.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/acpi/acpica/exconfig.c +4 -3
index d0cc2a4..f214dbf 100644
@@ -48,6 +48,7 @@
 #include "actables.h"
 #include "acdispat.h"
 #include "acevents.h"
+#include "amlcode.h"
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exconfig")
@@ -166,7 +167,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
 	if ((operand[0]->string.length > ACPI_NAME_SIZE) ||
 	    (operand[1]->string.length > ACPI_OEM_ID_SIZE) ||
 	    (operand[2]->string.length > ACPI_OEM_TABLE_ID_SIZE)) {
-		return_ACPI_STATUS(AE_BAD_PARAMETER);
+		return_ACPI_STATUS(AE_AML_STRING_LIMIT);
 	}
 
 	/* Find the ACPI table in the RSDT/XSDT */
@@ -213,8 +214,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
 	/* parameter_path (optional parameter) */
 
 	if (operand[4]->string.length > 0) {
-		if ((operand[4]->string.pointer[0] != '\\') &&
-		    (operand[4]->string.pointer[0] != '^')) {
+		if ((operand[4]->string.pointer[0] != AML_ROOT_PREFIX) &&
+		    (operand[4]->string.pointer[0] != AML_PARENT_PREFIX)) {
 			/*
 			 * Path is not absolute, so it will be relative to the node
 			 * referenced by the root_path_string (or the NS root if omitted)
Signature · 1 line
1.7.10
author
#3 lore raw

PATCH 3/27 ACPICA: Eliminate some small unnecessary pathname functions.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Removed several small pathname functions to increase efficiency. Essentially, they replace a function call with a single compare.

---
 drivers/acpi/acpica/acmacros.h |    6 ++++
 drivers/acpi/acpica/acnamesp.h |    2 --
 drivers/acpi/acpica/acparser.h |    2 --
 drivers/acpi/acpica/nsutils.c  |   60 ++++++++--------------------------------
 drivers/acpi/acpica/nsxfeval.c |    2 +-
 drivers/acpi/acpica/nsxfname.c |    2 +-
 drivers/acpi/acpica/psargs.c   |    5 ++--
 drivers/acpi/acpica/psutils.c  |    8 ------
 8 files changed, 22 insertions(+), 65 deletions(-)
drivers/acpi/acpica/acmacros.h +6 -0
index 3ba11d2..edfcbc8 100644
@@ -311,6 +311,12 @@
 #define ACPI_EXTRACT_3BIT_FLAG(field, position)     (ACPI_GET_3BIT_FLAG ((field) >> position))
 #define ACPI_EXTRACT_4BIT_FLAG(field, position)     (ACPI_GET_4BIT_FLAG ((field) >> position))
 
+/* ACPI Pathname helpers */
+
+#define ACPI_IS_ROOT_PREFIX(c)      ((c) == (u8) 0x5C)	/* Backslash */
+#define ACPI_IS_PARENT_PREFIX(c)    ((c) == (u8) 0x5E)	/* Carat */
+#define ACPI_IS_PATH_SEPARATOR(c)   ((c) == (u8) 0x2E)	/* Period (dot) */
+
 /*
  * An object of type struct acpi_namespace_node can appear in some contexts
  * where a pointer to an object of type union acpi_operand_object can also
drivers/acpi/acpica/acnamesp.h +0 -2
index 9b19d4b..b826d9c 100644
@@ -333,8 +333,6 @@ acpi_ns_install_node(struct acpi_walk_state *walk_state,
 /*
  * nsutils - Utility functions
  */
-u8 acpi_ns_valid_root_prefix(char prefix);
-
 acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
 
 u32 acpi_ns_local(acpi_object_type type);
drivers/acpi/acpica/acparser.h +0 -2
index eefcf47..24a5905 100644
@@ -211,8 +211,6 @@ void acpi_ps_free_op(union acpi_parse_object *op);
 
 u8 acpi_ps_is_leading_char(u32 c);
 
-u8 acpi_ps_is_prefix_char(u32 c);
-
 #ifdef	ACPI_FUTURE_USAGE
 u32 acpi_ps_get_name(union acpi_parse_object *op);
 #endif				/* ACPI_FUTURE_USAGE */
drivers/acpi/acpica/nsutils.c +11 -49

128 lines not on this page · raw message

drivers/acpi/acpica/nsxfeval.c +1 -1
index ef29925..1070eee 100644
@@ -236,7 +236,7 @@ acpi_evaluate_object(acpi_handle handle,
 	 * 2) No handle, not fully qualified pathname (error)
 	 * 3) Valid handle
 	 */
-	if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) {
+	if ((pathname) && (ACPI_IS_ROOT_PREFIX(pathname[0]))) {
 
 		/* The path is fully qualified, just evaluate by name */
 
drivers/acpi/acpica/nsxfname.c +1 -1
index a8deae8..1664fad 100644
@@ -107,7 +107,7 @@ acpi_get_handle(acpi_handle parent,
 	 *
 	 * Error for <null Parent + relative path>
 	 */
-	if (acpi_ns_valid_root_prefix(pathname[0])) {
+	if (ACPI_IS_ROOT_PREFIX(pathname[0])) {
 
 		/* Pathname is fully qualified (starts with '\') */
 
drivers/acpi/acpica/psargs.c +3 -2
index cb79e2d..9f31893 100644
@@ -162,7 +162,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
 
 	/* Point past any namestring prefix characters (backslash or carat) */
 
-	while (acpi_ps_is_prefix_char(*end)) {
+	while (ACPI_IS_ROOT_PREFIX(*end) || ACPI_IS_PARENT_PREFIX(*end)) {
 		end++;
 	}
 
@@ -798,7 +798,8 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
 		subop = acpi_ps_peek_opcode(parser_state);
 		if (subop == 0 ||
 		    acpi_ps_is_leading_char(subop) ||
-		    acpi_ps_is_prefix_char(subop)) {
+		    ACPI_IS_ROOT_PREFIX(subop) ||
+		    ACPI_IS_PARENT_PREFIX(subop)) {
 
 			/* null_name or name_string */
 
drivers/acpi/acpica/psutils.c +0 -8
index afefb3a1..2bbf670 100644
@@ -202,14 +202,6 @@ u8 acpi_ps_is_leading_char(u32 c)
 }
 
 /*
- * Is "c" a namestring prefix character?
- */
-u8 acpi_ps_is_prefix_char(u32 c)
-{
-	return ((u8)(c == '\\' || c == '^'));
-}
-
-/*
  * Get op's name (4-byte name segment) or 0 if unnamed
  */
 #ifdef ACPI_FUTURE_USAGE
Signature · 1 line
1.7.10
author
#4 lore raw

PATCH 4/27 ACPICA: Add root node optimization to internal get namespace node function.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Detect a request for the root node (a lone backslash) up front before invoking a full namespace lookup.

---
 drivers/acpi/acpica/nsutils.c |    9 +++++++++
 1 file changed, 9 insertions(+)
drivers/acpi/acpica/nsutils.c +9 -0
index d2dfe61..596d4cc 100644
@@ -671,6 +671,8 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
 
 	ACPI_FUNCTION_TRACE_PTR(ns_get_node, ACPI_CAST_PTR(char, pathname));
 
+	/* Simplest case is a null pathname */
+
 	if (!pathname) {
 		*return_node = prefix_node;
 		if (!prefix_node) {
@@ -679,6 +681,13 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
 		return_ACPI_STATUS(AE_OK);
 	}
 
+	/* Quick check for a reference to the root */
+
+	if (ACPI_IS_ROOT_PREFIX(pathname[0]) && (!pathname[1])) {
+		*return_node = acpi_gbl_root_node;
+		return_ACPI_STATUS(AE_OK);
+	}
+
 	/* Convert path to internal representation */
 
 	status = acpi_ns_internalize_name(pathname, &internal_path);
Signature · 1 line
1.7.10
author
#5 lore raw

PATCH 5/27 ACPICA: Lint changes, no functional change.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Some changes from lint.

---
 drivers/acpi/acpica/psloop.c   |    9 +++++----
 drivers/acpi/acpica/utdelete.c |    2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/acpi/acpica/psloop.c +5 -4
index 5607805..a6f8592 100644
@@ -142,7 +142,8 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
 				    (u32)(walk_state->aml_offset +
 					  sizeof(struct acpi_table_header))));
 
-			ACPI_DUMP_BUFFER(walk_state->parser_state.aml - 16, 48);
+			ACPI_DUMP_BUFFER((walk_state->parser_state.aml - 16),
+					 48);
 
 #ifdef ACPI_ASL_COMPILER
 			/*
@@ -159,9 +160,9 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)
 
 			acpi_ut_dump_buffer(((u8 *)walk_state->parser_state.
 					     aml - 16), 48, DB_BYTE_DISPLAY,
-					    walk_state->aml_offset +
-					    sizeof(struct acpi_table_header) -
-					    16);
+					    (walk_state->aml_offset +
+					     sizeof(struct acpi_table_header) -
+					     16));
 			acpi_os_printf(" */\n");
 #endif
 		}
drivers/acpi/acpica/utdelete.c +1 -1
index 53e6af8..c8bf44f 100644
@@ -340,7 +340,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list)
 {
 	union acpi_operand_object **internal_obj;
 
-	ACPI_FUNCTION_NAME(ut_delete_internal_object_list);
+	ACPI_FUNCTION_ENTRY();
 
 	/* Walk the null-terminated internal list */
 
Signature · 1 line
1.7.10
author
#6 lore raw

PATCH 6/27 ACPICA: Add time macros for various timer/time manipulation.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Constants for time manipulation, including constants for the 100 nanosecond timers. Chao Guan, Bob Moore, Lv Zheng.

---
 drivers/acpi/acpica/hwsleep.c   |    2 +-
 drivers/acpi/acpica/hwtimer.c   |    7 ++++---
 drivers/acpi/acpica/hwxfsleep.c |    2 +-
 include/acpi/actypes.h          |   17 ++++++++++++++++-
 4 files changed, 22 insertions(+), 6 deletions(-)
drivers/acpi/acpica/hwsleep.c +1 -1
index 691a5fb..675a8f8 100644
@@ -177,7 +177,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
 		 * to still read the right value. Ideally, this block would go
 		 * away entirely.
 		 */
-		acpi_os_stall(10000000);
+		acpi_os_stall(10 * ACPI_USEC_PER_SEC);
 
 		status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL,
 						sleep_enable_reg_info->
drivers/acpi/acpica/hwtimer.c +4 -3
index bfdce22..4e741d8 100644
@@ -176,10 +176,11 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
 	/*
 	 * Compute Duration (Requires a 64-bit multiply and divide):
 	 *
-	 * time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY;
+	 * time_elapsed (microseconds) =
+	 *  (delta_ticks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY;
 	 */
-	status = acpi_ut_short_divide(((u64) delta_ticks) * 1000000,
-				      PM_TIMER_FREQUENCY, &quotient, NULL);
+	status = acpi_ut_short_divide(((u64)delta_ticks) * ACPI_USEC_PER_SEC,
+				      ACPI_PM_TIMER_FREQUENCY, &quotient, NULL);
 
 	*time_elapsed = (u32) quotient;
 	return_ACPI_STATUS(status);
drivers/acpi/acpica/hwxfsleep.c +1 -1
index 6fcee00..ca4df0f 100644
@@ -207,7 +207,7 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
 				    (u32)acpi_gbl_FADT.s4_bios_request, 8);
 
 	do {
-		acpi_os_stall(1000);
+		acpi_os_stall(ACPI_USEC_PER_MSEC);
 		status =
 		    acpi_read_bit_register(ACPI_BITREG_WAKE_STATUS, &in_value);
 		if (ACPI_FAILURE(status)) {
include/acpi/actypes.h +16 -1
index 3de70ed..796a63e 100644
@@ -341,7 +341,7 @@ typedef u32 acpi_physical_address;
 
 /* PM Timer ticks per second (HZ) */
 
-#define PM_TIMER_FREQUENCY              3579545
+#define ACPI_PM_TIMER_FREQUENCY         3579545
 
 /*******************************************************************************
  *
@@ -373,6 +373,21 @@ typedef u32 acpi_name;		/* 4-byte ACPI name */
 typedef char *acpi_string;	/* Null terminated ASCII string */
 typedef void *acpi_handle;	/* Actually a ptr to a NS Node */
 
+/* Time constants for timer calculations */
+
+#define ACPI_MSEC_PER_SEC               1000L
+
+#define ACPI_USEC_PER_MSEC              1000L
+#define ACPI_USEC_PER_SEC               1000000L
+
+#define ACPI_100NSEC_PER_USEC           10L
+#define ACPI_100NSEC_PER_MSEC           10000L
+#define ACPI_100NSEC_PER_SEC            10000000L
+
+#define ACPI_NSEC_PER_USEC              1000L
+#define ACPI_NSEC_PER_MSEC              1000000L
+#define ACPI_NSEC_PER_SEC               1000000000L
+
 /* Owner IDs are used to track namespace nodes for selective deletion */
 
 typedef u8 acpi_owner_id;
Signature · 1 line
1.7.10
author
#7 lore raw

PATCH 7/27 ACPICA: Add header file support for the ACPI 5 TPM2 ACPI table.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Reserved in ACPI 5.0 specification, but defined in a November 2011 Microsoft document.

---
 include/acpi/actbl3.h |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
include/acpi/actbl3.h +31 -0
index 6585141..a067d7d 100644
@@ -68,6 +68,7 @@
 #define ACPI_SIG_PCCT           "PCCT"	/* Platform Communications Channel Table */
 #define ACPI_SIG_PMTT           "PMTT"	/* Platform Memory Topology Table */
 #define ACPI_SIG_RASF           "RASF"	/* RAS Feature table */
+#define ACPI_SIG_TPM2           "TPM2"	/* Trusted Platform Module 2.0 H/W interface table */
 
 #define ACPI_SIG_S3PT           "S3PT"	/* S3 Performance (sub)Table */
 #define ACPI_SIG_PCCS           "PCC"	/* PCC Shared Memory Region */
@@ -550,6 +551,36 @@ enum acpi_rasf_status {
 #define ACPI_RASF_ERROR                 (1<<2)
 #define ACPI_RASF_STATUS                (0x1F<<3)
 
+/*******************************************************************************
+ *
+ * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
+ *        Version 3
+ *
+ * Conforms to "TPM 2.0 Hardware Interface Table (TPM2)" 29 November 2011
+ *
+ ******************************************************************************/
+
+struct acpi_table_tpm2 {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u32 flags;
+	u64 control_address;
+	u32 start_method;
+};
+
+/* Control area structure (not part of table, pointed to by control_address) */
+
+struct acpi_tpm2_control {
+	u32 reserved;
+	u32 error;
+	u32 cancel;
+	u32 start;
+	u64 interrupt_control;
+	u32 command_size;
+	u64 command_address;
+	u32 response_size;
+	u64 response_address;
+};
+
 /* Reset to default packing */
 
 #pragma pack()
Signature · 1 line
1.7.10
author
#8 lore raw

PATCH 8/27 ACPICA: Resource Manager: Add a pointer cast for a namespace node.

In reply to Lv Zheng

From: "Rafael J. Wysocki" <[email protected]>

Add a missing cast for a namespace node pointer passed in from an external interface. Reported Rafael Wysocki.

---
 drivers/acpi/acpica/rsutils.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/acpica/rsutils.c +3 -1
index 5adae5a..41b8103 100644
@@ -677,7 +677,9 @@ acpi_rs_get_method_data(acpi_handle handle,
 	/* Execute the method, no parameters */
 
 	status =
-	    acpi_ut_evaluate_object(handle, path, ACPI_BTYPE_BUFFER, &obj_desc);
+	    acpi_ut_evaluate_object(ACPI_CAST_PTR
+				    (struct acpi_namespace_node, handle), path,
+				    ACPI_BTYPE_BUFFER, &obj_desc);
 	if (ACPI_FAILURE(status)) {
 		return_ACPI_STATUS(status);
 	}
Signature · 1 line
1.7.10
author
#9 lore raw

PATCH 9/27 ACPICA: DEBUG_PRINT macros: Update to improve performance.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Move check for "debug enable" to before the actual call to the debug print routine. Improves time of ASLTS by about 15%. Also, remove "safe" exit macros since no complex expressions are ever used in the return statements.

---
 drivers/acpi/acpica/acmacros.h |  132 ++++++++++++++++++++--------------------
 include/acpi/acoutput.h        |   32 +++++++++-
 2 files changed, 96 insertions(+), 68 deletions(-)
drivers/acpi/acpica/acmacros.h +67 -65
index edfcbc8..cd96135 100644
@@ -392,29 +392,51 @@
  * Debug macros that are conditionally compiled
  */
 #ifdef ACPI_DEBUG_OUTPUT
+
 /*
  * Function entry tracing
+ *
+ * The name of the function is emitted as a local variable that is
+ * intended to be used by both the entry trace and the exit trace.
  */
-#define ACPI_FUNCTION_TRACE(a)          ACPI_FUNCTION_NAME(a) \
-			  acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
-#define ACPI_FUNCTION_TRACE_PTR(a, b)   ACPI_FUNCTION_NAME(a) \
-					   acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS, (void *)b)
-#define ACPI_FUNCTION_TRACE_U32(a, b)   ACPI_FUNCTION_NAME(a) \
-							 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS, (u32)b)
-#define ACPI_FUNCTION_TRACE_STR(a, b)   ACPI_FUNCTION_NAME(a) \
-									  acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS, (char *)b)
 
-#define ACPI_FUNCTION_ENTRY()           acpi_ut_track_stack_ptr()
+/* Helper macro */
+
+#define ACPI_TRACE_ENTRY(name, function, cast, param) \
+	ACPI_FUNCTION_NAME (name) \
+	function (ACPI_DEBUG_PARAMETERS, cast (param))
+
+/* The actual entry trace macros */
+
+#define ACPI_FUNCTION_TRACE(name) \
+	ACPI_FUNCTION_NAME(name) \
+	acpi_ut_trace (ACPI_DEBUG_PARAMETERS)
+
+#define ACPI_FUNCTION_TRACE_PTR(name, pointer) \
+	ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, (void *), pointer)
+
+#define ACPI_FUNCTION_TRACE_U32(name, value) \
+	ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, (u32), value)
+
+#define ACPI_FUNCTION_TRACE_STR(name, string) \
+	ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, (char *), string)
+
+#define ACPI_FUNCTION_ENTRY() \
+	acpi_ut_track_stack_ptr()
 
 /*
- * Function exit tracing.
- * WARNING: These macros include a return statement. This is usually considered
- * bad form, but having a separate exit macro is very ugly and difficult to maintain.
- * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
- * so that "_AcpiFunctionName" is defined.
+ * Function exit tracing
+ *
+ * These macros include a return statement. This is usually considered
+ * bad form, but having a separate exit macro before the actual return
+ * is very ugly and difficult to maintain.
+ *
+ * One of the FUNCTION_TRACE macros above must be used in conjunction
+ * with these macros so that "_AcpiFunctionName" is defined.
  *
- * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining
- * about these constructs.
+ * Note: the DO_WHILE0 macro is used to prevent some compilers from
+ * complaining about these constructs. On other compilers the do...while
+ * adds some extra code, so this feature is optional.
  */
 #ifdef ACPI_USE_DO_WHILE_0
 #define ACPI_DO_WHILE0(a)               do a while(0)
@@ -422,55 +444,35 @@
 #define ACPI_DO_WHILE0(a)               a
 #endif
 
-#define return_VOID                     ACPI_DO_WHILE0 ({ \
-											acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \
-											return;})
-/*
- * There are two versions of most of the return macros. The default version is
- * safer, since it avoids side-effects by guaranteeing that the argument will
- * not be evaluated twice.
- *
- * A less-safe version of the macros is provided for optional use if the
- * compiler uses excessive CPU stack (for example, this may happen in the
- * debug case if code optimzation is disabled.)
- */
-#ifndef ACPI_SIMPLE_RETURN_MACROS
-
-#define return_ACPI_STATUS(s)           ACPI_DO_WHILE0 ({ \
-											register acpi_status _s = (s); \
-											acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \
-											return (_s); })
-#define return_PTR(s)                   ACPI_DO_WHILE0 ({ \
-											register void *_s = (void *) (s); \
-											acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \
-											return (_s); })
-#define return_VALUE(s)                 ACPI_DO_WHILE0 ({ \
-											register u64 _s = (s); \
-											acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \
-											return (_s); })
-#define return_UINT8(s)                 ACPI_DO_WHILE0 ({ \
-											register u8 _s = (u8) (s); \
-											acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \
-											return (_s); })
-#define return_UINT32(s)                ACPI_DO_WHILE0 ({ \
-											register u32 _s = (u32) (s); \
-											acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \
-											return (_s); })
-#else				/* Use original less-safe macros */
-
-#define return_ACPI_STATUS(s)           ACPI_DO_WHILE0 ({ \
-											acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \
-											return((s)); })
-#define return_PTR(s)                   ACPI_DO_WHILE0 ({ \
-											acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \
-											return((s)); })
-#define return_VALUE(s)                 ACPI_DO_WHILE0 ({ \
-											acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) (s)); \
-											return((s)); })
-#define return_UINT8(s)                 return_VALUE(s)
-#define return_UINT32(s)                return_VALUE(s)
-
-#endif				/* ACPI_SIMPLE_RETURN_MACROS */
+/* Exit trace helper macro */
+
+#define ACPI_TRACE_EXIT(function, cast, param) \
+	ACPI_DO_WHILE0 ({ \
+		function (ACPI_DEBUG_PARAMETERS, cast (param)); \
+		return ((param)); \
+	})
+
+/* The actual exit macros */
+
+#define return_VOID \
+	ACPI_DO_WHILE0 ({ \
+		acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \
+		return; \
+	})
+
+#define return_ACPI_STATUS(status) \
+	ACPI_TRACE_EXIT (acpi_ut_status_exit, (acpi_status), status)
+
+#define return_PTR(pointer) \
+	ACPI_TRACE_EXIT (acpi_ut_ptr_exit, (u8 *), pointer)
+
+#define return_VALUE(value) \
+	ACPI_TRACE_EXIT (acpi_ut_value_exit, (u64), value)
+
+/* These exit macros are superfluous and should be removed entirely */
+
+#define return_UINT8        return_VALUE
+#define return_UINT32       return_VALUE
 
 /* Conditional execution */
 
include/acpi/acoutput.h +29 -3
index 38e1be0..be014bf 100644
@@ -263,16 +263,42 @@
  * Common parameters used for debug output functions:
  * line number, function name, module(file) name, component ID
  */
-#define ACPI_DEBUG_PARAMETERS           __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
+#define ACPI_DEBUG_PARAMETERS \
+	__LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
 
 /*
  * Master debug print macros
  * Print message if and only if:
  *    1) Debug print for the current component is enabled
  *    2) Debug error level or trace level for the print statement is enabled
+ *
+ * November 2012: Moved the runtime check for whether to actually emit the
+ * debug message outside of the print function itself. This improves overall
+ * performance at a relatively small code cost. Implementation involves the
+ * use of variadic macros supported by C99.
  */
-#define ACPI_DEBUG_PRINT(plist)         acpi_debug_print plist
-#define ACPI_DEBUG_PRINT_RAW(plist)     acpi_debug_print_raw plist
+
+/* DEBUG_PRINT functions */
+
+#define ACPI_DEBUG_PRINT(plist)         ACPI_ACTUAL_DEBUG plist
+#define ACPI_DEBUG_PRINT_RAW(plist)     ACPI_ACTUAL_DEBUG_RAW plist
+
+/* Helper macros for DEBUG_PRINT */
+
+#define ACPI_IS_DEBUG_ENABLED(level, component) \
+	(level & acpi_dbg_level) && (component & acpi_dbg_layer)
+
+#define ACPI_DEBUG(function, level, line, filename, modulename, component, ...) \
+	if (ACPI_IS_DEBUG_ENABLED (level, component)) \
+	{ \
+		function (level, line, filename, modulename, component, __VA_ARGS__); \
+	}
+
+#define ACPI_ACTUAL_DEBUG(level, line, filename, modulename, component, ...) \
+	ACPI_DEBUG (acpi_debug_print, level, line, filename, modulename, component, __VA_ARGS__)
+
+#define ACPI_ACTUAL_DEBUG_RAW(level, line, filename, modulename, component, ...) \
+	ACPI_DEBUG (acpi_debug_print_raw, level, line, filename, modulename, component, __VA_ARGS__)
 
 #else
 /*
Signature · 1 line
1.7.10
#10 lore raw

Re: [PATCH 09/27] ACPICA: DEBUG_PRINT macros: Update to improve performance.

Quoted 6 lines · Lv Zheng

From: Bob Moore <[email protected]>

Move check for "debug enable" to before the actual call to the debug print routine. Improves time of ASLTS by about 15%. Also, remove "safe" exit macros since no complex expressions are ever used in the return statements.

Can you please fix the build breakage introduced by this patch in processor_driver.c?

Rafael

Quoted 215 lines
---
 drivers/acpi/acpica/acmacros.h |  132 ++++++++++++++++++++--------------------
 include/acpi/acoutput.h        |   32 +++++++++-
 2 files changed, 96 insertions(+), 68 deletions(-)
drivers/acpi/acpica/acmacros.h +67 -65
index edfcbc8..cd96135 100644
@@ -392,29 +392,51 @@
  * Debug macros that are conditionally compiled
  */
 #ifdef ACPI_DEBUG_OUTPUT
+
 /*
  * Function entry tracing
+ *
+ * The name of the function is emitted as a local variable that is
+ * intended to be used by both the entry trace and the exit trace.
  */
-#define ACPI_FUNCTION_TRACE(a)          ACPI_FUNCTION_NAME(a) \
-			  acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
-#define ACPI_FUNCTION_TRACE_PTR(a, b)   ACPI_FUNCTION_NAME(a) \
-					   acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS, (void *)b)
-#define ACPI_FUNCTION_TRACE_U32(a, b)   ACPI_FUNCTION_NAME(a) \
-							 acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS, (u32)b)
-#define ACPI_FUNCTION_TRACE_STR(a, b)   ACPI_FUNCTION_NAME(a) \
-									  acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS, (char *)b)
 
-#define ACPI_FUNCTION_ENTRY()           acpi_ut_track_stack_ptr()
+/* Helper macro */
+
+#define ACPI_TRACE_ENTRY(name, function, cast, param) \
+	ACPI_FUNCTION_NAME (name) \
+	function (ACPI_DEBUG_PARAMETERS, cast (param))
+
+/* The actual entry trace macros */
+
+#define ACPI_FUNCTION_TRACE(name) \
+	ACPI_FUNCTION_NAME(name) \
+	acpi_ut_trace (ACPI_DEBUG_PARAMETERS)
+
+#define ACPI_FUNCTION_TRACE_PTR(name, pointer) \
+	ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, (void *), pointer)
+
+#define ACPI_FUNCTION_TRACE_U32(name, value) \
+	ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, (u32), value)
+
+#define ACPI_FUNCTION_TRACE_STR(name, string) \
+	ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, (char *), string)
+
+#define ACPI_FUNCTION_ENTRY() \
+	acpi_ut_track_stack_ptr()
 
 /*
- * Function exit tracing.
- * WARNING: These macros include a return statement. This is usually considered
- * bad form, but having a separate exit macro is very ugly and difficult to maintain.
- * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
- * so that "_AcpiFunctionName" is defined.
+ * Function exit tracing
+ *
+ * These macros include a return statement. This is usually considered
+ * bad form, but having a separate exit macro before the actual return
+ * is very ugly and difficult to maintain.
+ *
+ * One of the FUNCTION_TRACE macros above must be used in conjunction
+ * with these macros so that "_AcpiFunctionName" is defined.
  *
- * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining
- * about these constructs.
+ * Note: the DO_WHILE0 macro is used to prevent some compilers from
+ * complaining about these constructs. On other compilers the do...while
+ * adds some extra code, so this feature is optional.
  */
 #ifdef ACPI_USE_DO_WHILE_0
 #define ACPI_DO_WHILE0(a)               do a while(0)
@@ -422,55 +444,35 @@
 #define ACPI_DO_WHILE0(a)               a
 #endif
 
-#define return_VOID                     ACPI_DO_WHILE0 ({ \
-											acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \
-											return;})
-/*
- * There are two versions of most of the return macros. The default version is
- * safer, since it avoids side-effects by guaranteeing that the argument will
- * not be evaluated twice.
- *
- * A less-safe version of the macros is provided for optional use if the
- * compiler uses excessive CPU stack (for example, this may happen in the
- * debug case if code optimzation is disabled.)
- */
-#ifndef ACPI_SIMPLE_RETURN_MACROS
-
-#define return_ACPI_STATUS(s)           ACPI_DO_WHILE0 ({ \
-											register acpi_status _s = (s); \
-											acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \
-											return (_s); })
-#define return_PTR(s)                   ACPI_DO_WHILE0 ({ \
-											register void *_s = (void *) (s); \
-											acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \
-											return (_s); })
-#define return_VALUE(s)                 ACPI_DO_WHILE0 ({ \
-											register u64 _s = (s); \
-											acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \
-											return (_s); })
-#define return_UINT8(s)                 ACPI_DO_WHILE0 ({ \
-											register u8 _s = (u8) (s); \
-											acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \
-											return (_s); })
-#define return_UINT32(s)                ACPI_DO_WHILE0 ({ \
-											register u32 _s = (u32) (s); \
-											acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \
-											return (_s); })
-#else				/* Use original less-safe macros */
-
-#define return_ACPI_STATUS(s)           ACPI_DO_WHILE0 ({ \
-											acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \
-											return((s)); })
-#define return_PTR(s)                   ACPI_DO_WHILE0 ({ \
-											acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \
-											return((s)); })
-#define return_VALUE(s)                 ACPI_DO_WHILE0 ({ \
-											acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) (s)); \
-											return((s)); })
-#define return_UINT8(s)                 return_VALUE(s)
-#define return_UINT32(s)                return_VALUE(s)
-
-#endif				/* ACPI_SIMPLE_RETURN_MACROS */
+/* Exit trace helper macro */
+
+#define ACPI_TRACE_EXIT(function, cast, param) \
+	ACPI_DO_WHILE0 ({ \
+		function (ACPI_DEBUG_PARAMETERS, cast (param)); \
+		return ((param)); \
+	})
+
+/* The actual exit macros */
+
+#define return_VOID \
+	ACPI_DO_WHILE0 ({ \
+		acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \
+		return; \
+	})
+
+#define return_ACPI_STATUS(status) \
+	ACPI_TRACE_EXIT (acpi_ut_status_exit, (acpi_status), status)
+
+#define return_PTR(pointer) \
+	ACPI_TRACE_EXIT (acpi_ut_ptr_exit, (u8 *), pointer)
+
+#define return_VALUE(value) \
+	ACPI_TRACE_EXIT (acpi_ut_value_exit, (u64), value)
+
+/* These exit macros are superfluous and should be removed entirely */
+
+#define return_UINT8        return_VALUE
+#define return_UINT32       return_VALUE
 
 /* Conditional execution */
 
include/acpi/acoutput.h +29 -3
index 38e1be0..be014bf 100644
@@ -263,16 +263,42 @@
  * Common parameters used for debug output functions:
  * line number, function name, module(file) name, component ID
  */
-#define ACPI_DEBUG_PARAMETERS           __LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
+#define ACPI_DEBUG_PARAMETERS \
+	__LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
 
 /*
  * Master debug print macros
  * Print message if and only if:
  *    1) Debug print for the current component is enabled
  *    2) Debug error level or trace level for the print statement is enabled
+ *
+ * November 2012: Moved the runtime check for whether to actually emit the
+ * debug message outside of the print function itself. This improves overall
+ * performance at a relatively small code cost. Implementation involves the
+ * use of variadic macros supported by C99.
  */
-#define ACPI_DEBUG_PRINT(plist)         acpi_debug_print plist
-#define ACPI_DEBUG_PRINT_RAW(plist)     acpi_debug_print_raw plist
+
+/* DEBUG_PRINT functions */
+
+#define ACPI_DEBUG_PRINT(plist)         ACPI_ACTUAL_DEBUG plist
+#define ACPI_DEBUG_PRINT_RAW(plist)     ACPI_ACTUAL_DEBUG_RAW plist
+
+/* Helper macros for DEBUG_PRINT */
+
+#define ACPI_IS_DEBUG_ENABLED(level, component) \
+	(level & acpi_dbg_level) && (component & acpi_dbg_layer)
+
+#define ACPI_DEBUG(function, level, line, filename, modulename, component, ...) \
+	if (ACPI_IS_DEBUG_ENABLED (level, component)) \
+	{ \
+		function (level, line, filename, modulename, component, __VA_ARGS__); \
+	}
+
+#define ACPI_ACTUAL_DEBUG(level, line, filename, modulename, component, ...) \
+	ACPI_DEBUG (acpi_debug_print, level, line, filename, modulename, component, __VA_ARGS__)
+
+#define ACPI_ACTUAL_DEBUG_RAW(level, line, filename, modulename, component, ...) \
+	ACPI_DEBUG (acpi_debug_print_raw, level, line, filename, modulename, component, __VA_ARGS__)
 
 #else
 /*
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
author
#11 lore raw

RE: [PATCH 09/27] ACPICA: DEBUG_PRINT macros: Update to improve performance.

OK.
I'll fix this today.
Thanks for the report.

Best regards
-Lv

Quoted 281 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Saturday, January 05, 2013 7:52 AM
To: Zheng, Lv
Cc: Brown, Len; [email protected]; Moore, Robert
Subject: Re: [PATCH 09/27] ACPICA: DEBUG_PRINT macros: Update to improve performance.

Quoted 6 lines · Lv Zheng

From: Bob Moore <[email protected]>

Move check for "debug enable" to before the actual call to the debug print routine. Improves time of ASLTS by about 15%. Also, remove "safe" exit macros since no complex expressions are ever used in the return statements.

Can you please fix the build breakage introduced by this patch in processor_driver.c?

Rafael

Quoted 4 lines
---
 drivers/acpi/acpica/acmacros.h |  132

++++++++++++++++++++--------------------

Quoted 12 lines
 include/acpi/acoutput.h        |   32 +++++++++-
 2 files changed, 96 insertions(+), 68 deletions(-)
(quoted diff) +0 -0

b/drivers/acpi/acpica/acmacros.h index edfcbc8..cd96135 100644

drivers/acpi/acpica/acmacros.h +1 -0
@@ -392,29 +392,51 @@
  * Debug macros that are conditionally compiled
  */
 #ifdef ACPI_DEBUG_OUTPUT
+

drivers/acpi/acpica/acmacros.h line 401

Quoted 10 lines
drivers/acpi/acpica/acmacros.h +3 -4
 /*
  * Function entry tracing
+ *
+ * The name of the function is emitted as a local variable that is
+ * intended to be used by both the entry trace and the exit trace.
  */
-#define ACPI_FUNCTION_TRACE(a)          ACPI_FUNCTION_NAME(a) \
-			  acpi_ut_trace(ACPI_DEBUG_PARAMETERS)
-#define ACPI_FUNCTION_TRACE_PTR(a, b)   ACPI_FUNCTION_NAME(a) \
-					   acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,

(void *)b)

drivers/acpi/acpica/acmacros.h line 403

Quoted 2 lines
drivers/acpi/acpica/acmacros.h +0 -2
-#define ACPI_FUNCTION_TRACE_U32(a, b)   ACPI_FUNCTION_NAME(a) \
-

acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS, (u32)b)

drivers/acpi/acpica/acmacros.h line 405

Quoted 2 lines
drivers/acpi/acpica/acmacros.h +0 -2
-#define ACPI_FUNCTION_TRACE_STR(a, b)   ACPI_FUNCTION_NAME(a) \
-

acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS, (char *)b)

Quoted 29 lines
drivers/acpi/acpica/acmacros.h +23 -3
-#define ACPI_FUNCTION_ENTRY()           acpi_ut_track_stack_ptr()
+/* Helper macro */
+
+#define ACPI_TRACE_ENTRY(name, function, cast, param) \
+	ACPI_FUNCTION_NAME (name) \
+	function (ACPI_DEBUG_PARAMETERS, cast (param))
+
+/* The actual entry trace macros */
+
+#define ACPI_FUNCTION_TRACE(name) \
+	ACPI_FUNCTION_NAME(name) \
+	acpi_ut_trace (ACPI_DEBUG_PARAMETERS)
+
+#define ACPI_FUNCTION_TRACE_PTR(name, pointer) \
+	ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, (void *), pointer)
+
+#define ACPI_FUNCTION_TRACE_U32(name, value) \
+	ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, (u32), value)
+
+#define ACPI_FUNCTION_TRACE_STR(name, string) \
+	ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, (char *), string)
+
+#define ACPI_FUNCTION_ENTRY() \
+	acpi_ut_track_stack_ptr()
 
 /*
- * Function exit tracing.
- * WARNING: These macros include a return statement. This is usually
Quoted 2 lines

considered
- * bad form, but having a separate exit macro is very ugly and difficult to

maintain.

Quoted 25 lines

- * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
- * so that "_AcpiFunctionName" is defined.
+ * Function exit tracing
+ *
+ * These macros include a return statement. This is usually
+ considered
+ * bad form, but having a separate exit macro before the actual
+ return
+ * is very ugly and difficult to maintain.
+ *
+ * One of the FUNCTION_TRACE macros above must be used in conjunction
+ * with these macros so that "_AcpiFunctionName" is defined. *
- * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining
- * about these constructs.
+ * Note: the DO_WHILE0 macro is used to prevent some compilers from
+ * complaining about these constructs. On other compilers the
+ do...while
+ * adds some extra code, so this feature is optional.
*/
#ifdef ACPI_USE_DO_WHILE_0
#define ACPI_DO_WHILE0(a) do a while(0)

drivers/acpi/acpica/acmacros.h line 426

Quoted 5 lines
drivers/acpi/acpica/acmacros.h +0 -2
@@ -422,55 +444,35 @@
 #define ACPI_DO_WHILE0(a)               a
 #endif
 
-#define return_VOID                     ACPI_DO_WHILE0 ({ \
-											acpi_ut_exit

(ACPI_DEBUG_PARAMETERS); \

Quoted 14 lines
drivers/acpi/acpica/acmacros.h +0 -3
-											return;})
-/*
- * There are two versions of most of the return macros. The default

version is
- * safer, since it avoids side-effects by guaranteeing that the argument will
- * not be evaluated twice.
- *
- * A less-safe version of the macros is provided for optional use if the
- * compiler uses excessive CPU stack (for example, this may happen in the
- * debug case if code optimzation is disabled.)
- */

drivers/acpi/acpica/acmacros.h

Quoted 4 lines
drivers/acpi/acpica/acmacros.h +0 -4
-#ifndef ACPI_SIMPLE_RETURN_MACROS
-
-#define return_ACPI_STATUS(s)           ACPI_DO_WHILE0 ({ \
-											register acpi_status _s =

(s); \

drivers/acpi/acpica/acmacros.h

Quoted 1 line
drivers/acpi/acpica/acmacros.h +0 -1
-											acpi_ut_status_exit

(ACPI_DEBUG_PARAMETERS, _s); \

drivers/acpi/acpica/acmacros.h

Quoted 3 lines
drivers/acpi/acpica/acmacros.h +0 -3
-											return (_s); })
-#define return_PTR(s)                   ACPI_DO_WHILE0 ({ \
-											register void *_s = (void

*) (s); \

drivers/acpi/acpica/acmacros.h

Quoted 1 line
drivers/acpi/acpica/acmacros.h +0 -1
-											acpi_ut_ptr_exit

(ACPI_DEBUG_PARAMETERS, (u8 *) _s); \

drivers/acpi/acpica/acmacros.h

Quoted 4 lines
drivers/acpi/acpica/acmacros.h +0 -4
-											return (_s); })
-#define return_VALUE(s)                 ACPI_DO_WHILE0 ({ \
-											register u64 _s = (s); \
-											acpi_ut_value_exit

(ACPI_DEBUG_PARAMETERS, _s); \

drivers/acpi/acpica/acmacros.h

Quoted 3 lines
drivers/acpi/acpica/acmacros.h +0 -3
-											return (_s); })
-#define return_UINT8(s)                 ACPI_DO_WHILE0 ({ \
-											register u8 _s = (u8) (s);

\

drivers/acpi/acpica/acmacros.h

Quoted 1 line
drivers/acpi/acpica/acmacros.h +0 -1
-											acpi_ut_value_exit

(ACPI_DEBUG_PARAMETERS, (u64) _s); \

drivers/acpi/acpica/acmacros.h

Quoted 3 lines
drivers/acpi/acpica/acmacros.h +0 -3
-											return (_s); })
-#define return_UINT32(s)                ACPI_DO_WHILE0 ({ \
-											register u32 _s = (u32)

(s); \

drivers/acpi/acpica/acmacros.h

Quoted 1 line
drivers/acpi/acpica/acmacros.h +0 -1
-											acpi_ut_value_exit

(ACPI_DEBUG_PARAMETERS, (u64) _s); \

drivers/acpi/acpica/acmacros.h

Quoted 5 lines
drivers/acpi/acpica/acmacros.h +0 -5
-											return (_s); })
-#else				/* Use original less-safe macros */
-
-#define return_ACPI_STATUS(s)           ACPI_DO_WHILE0 ({ \
-											acpi_ut_status_exit

(ACPI_DEBUG_PARAMETERS, (s)); \

drivers/acpi/acpica/acmacros.h

Quoted 3 lines
drivers/acpi/acpica/acmacros.h +0 -3
-											return((s)); })
-#define return_PTR(s)                   ACPI_DO_WHILE0 ({ \
-											acpi_ut_ptr_exit

(ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \

drivers/acpi/acpica/acmacros.h

Quoted 3 lines
drivers/acpi/acpica/acmacros.h +0 -3
-											return((s)); })
-#define return_VALUE(s)                 ACPI_DO_WHILE0 ({ \
-											acpi_ut_value_exit

(ACPI_DEBUG_PARAMETERS, (u64) (s)); \

Quoted 43 lines
drivers/acpi/acpica/acmacros.h +30 -5
-											return((s)); })
-#define return_UINT8(s)                 return_VALUE(s)
-#define return_UINT32(s)                return_VALUE(s)
-
-#endif				/* ACPI_SIMPLE_RETURN_MACROS */
+/* Exit trace helper macro */
+
+#define ACPI_TRACE_EXIT(function, cast, param) \
+	ACPI_DO_WHILE0 ({ \
+		function (ACPI_DEBUG_PARAMETERS, cast (param)); \
+		return ((param)); \
+	})
+
+/* The actual exit macros */
+
+#define return_VOID \
+	ACPI_DO_WHILE0 ({ \
+		acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \
+		return; \
+	})
+
+#define return_ACPI_STATUS(status) \
+	ACPI_TRACE_EXIT (acpi_ut_status_exit, (acpi_status), status)
+
+#define return_PTR(pointer) \
+	ACPI_TRACE_EXIT (acpi_ut_ptr_exit, (u8 *), pointer)
+
+#define return_VALUE(value) \
+	ACPI_TRACE_EXIT (acpi_ut_value_exit, (u64), value)
+
+/* These exit macros are superfluous and should be removed entirely
+*/
+
+#define return_UINT8        return_VALUE
+#define return_UINT32       return_VALUE
 
 /* Conditional execution */
include/acpi/acoutput.h index renamed from include/acpi/acoutput.h +0 -0

38e1be0..be014bf 100644

include/acpi/acoutput.h line 266

Quoted 4 lines
include/acpi/acoutput.h +0 -1
@@ -263,16 +263,42 @@
  * Common parameters used for debug output functions:
  * line number, function name, module(file) name, component ID
  */
-#define ACPI_DEBUG_PARAMETERS           __LINE__,

ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT

include/acpi/acoutput.h line 267

Quoted 2 lines
include/acpi/acoutput.h +2 -0
+#define ACPI_DEBUG_PARAMETERS \
+	__LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name,

_COMPONENT

Quoted 12 lines
include/acpi/acoutput.h +6 -0
 /*
  * Master debug print macros
  * Print message if and only if:
  *    1) Debug print for the current component is enabled
  *    2) Debug error level or trace level for the print statement is enabled
+ *
+ * November 2012: Moved the runtime check for whether to actually
+ emit the
+ * debug message outside of the print function itself. This improves
+ overall
+ * performance at a relatively small code cost. Implementation

include/acpi/acoutput.h

Quoted 10 lines
include/acpi/acoutput.h +7 -2
+ involves the
+ * use of variadic macros supported by C99.
  */
-#define ACPI_DEBUG_PRINT(plist)         acpi_debug_print plist
-#define ACPI_DEBUG_PRINT_RAW(plist)     acpi_debug_print_raw plist
+
+/* DEBUG_PRINT functions */
+
+#define ACPI_DEBUG_PRINT(plist)         ACPI_ACTUAL_DEBUG plist
+#define ACPI_DEBUG_PRINT_RAW(plist)     ACPI_ACTUAL_DEBUG_RAW

plist

include/acpi/acoutput.h

Quoted 7 lines
include/acpi/acoutput.h +7 -0
+
+/* Helper macros for DEBUG_PRINT */
+
+#define ACPI_IS_DEBUG_ENABLED(level, component) \
+	(level & acpi_dbg_level) && (component & acpi_dbg_layer)
+
+#define ACPI_DEBUG(function, level, line, filename, modulename,

component, ...) \

include/acpi/acoutput.h

Quoted 3 lines
include/acpi/acoutput.h +3 -0
+	if (ACPI_IS_DEBUG_ENABLED (level, component)) \
+	{ \
+		function (level, line, filename, modulename, component,

__VA_ARGS__); \

include/acpi/acoutput.h

Quoted 3 lines
include/acpi/acoutput.h +3 -0
+	}
+
+#define ACPI_ACTUAL_DEBUG(level, line, filename, modulename,

component, ...) \

include/acpi/acoutput.h line 303

Quoted 4 lines
include/acpi/acoutput.h +4 -0
+	ACPI_DEBUG (acpi_debug_print, level, line, filename, modulename,
+component, __VA_ARGS__)
+
+#define ACPI_ACTUAL_DEBUG_RAW(level, line, filename, modulename,

component, ...) \

include/acpi/acoutput.h

Quoted 6 lines
include/acpi/acoutput.h +2 -0
+	ACPI_DEBUG (acpi_debug_print_raw, level, line, filename, modulename,
+component, __VA_ARGS__)
 
 #else
 /*

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

author
#12 lore raw

PATCH 10/27 ACPICA: FUNCTION_TRACE macros: Check if debug is enabled up-front.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

In the functions that implement the macros, check if debug is enabled up-front before the call to the lower debug print function. This provides a small performance improvement.

---
 drivers/acpi/acpica/utdebug.c |  118 +++++++++++++++++++++++++++--------------
 1 file changed, 78 insertions(+), 40 deletions(-)
drivers/acpi/acpica/utdebug.c +78 -40
index 5d95166..47857c4 100644
@@ -166,11 +166,9 @@ acpi_debug_print(u32 requested_debug_level,
 	acpi_thread_id thread_id;
 	va_list args;
 
-	/*
-	 * Stay silent if the debug level or component ID is disabled
-	 */
-	if (!(requested_debug_level & acpi_dbg_level) ||
-	    !(component_id & acpi_dbg_layer)) {
+	/* Check if debug output enabled */
+
+	if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) {
 		return;
 	}
 
@@ -236,8 +234,9 @@ acpi_debug_print_raw(u32 requested_debug_level,
 {
 	va_list args;
 
-	if (!(requested_debug_level & acpi_dbg_level) ||
-	    !(component_id & acpi_dbg_layer)) {
+	/* Check if debug output enabled */
+
+	if (!ACPI_IS_DEBUG_ENABLED(requested_debug_level, component_id)) {
 		return;
 	}
 
@@ -272,9 +271,13 @@ acpi_ut_trace(u32 line_number,
 	acpi_gbl_nesting_level++;
 	acpi_ut_track_stack_ptr();
 
-	acpi_debug_print(ACPI_LV_FUNCTIONS,
-			 line_number, function_name, module_name, component_id,
-			 "%s\n", acpi_gbl_fn_entry_str);
+	/* Check if enabled up-front for performance */
+
+	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
+		acpi_debug_print(ACPI_LV_FUNCTIONS,
+				 line_number, function_name, module_name,
+				 component_id, "%s\n", acpi_gbl_fn_entry_str);
+	}
 }
 
 ACPI_EXPORT_SYMBOL(acpi_ut_trace)
@@ -304,9 +307,14 @@ acpi_ut_trace_ptr(u32 line_number,
 	acpi_gbl_nesting_level++;
 	acpi_ut_track_stack_ptr();
 
-	acpi_debug_print(ACPI_LV_FUNCTIONS,
-			 line_number, function_name, module_name, component_id,
-			 "%s %p\n", acpi_gbl_fn_entry_str, pointer);
+	/* Check if enabled up-front for performance */
+
+	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
+		acpi_debug_print(ACPI_LV_FUNCTIONS,
+				 line_number, function_name, module_name,
+				 component_id, "%s %p\n", acpi_gbl_fn_entry_str,
+				 pointer);
+	}
 }
 
 /*******************************************************************************
@@ -335,9 +343,14 @@ acpi_ut_trace_str(u32 line_number,
 	acpi_gbl_nesting_level++;
 	acpi_ut_track_stack_ptr();
 
-	acpi_debug_print(ACPI_LV_FUNCTIONS,
-			 line_number, function_name, module_name, component_id,
-			 "%s %s\n", acpi_gbl_fn_entry_str, string);
+	/* Check if enabled up-front for performance */
+
+	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
+		acpi_debug_print(ACPI_LV_FUNCTIONS,
+				 line_number, function_name, module_name,
+				 component_id, "%s %s\n", acpi_gbl_fn_entry_str,
+				 string);
+	}
 }
 
 /*******************************************************************************
@@ -366,9 +379,14 @@ acpi_ut_trace_u32(u32 line_number,
 	acpi_gbl_nesting_level++;
 	acpi_ut_track_stack_ptr();
 
-	acpi_debug_print(ACPI_LV_FUNCTIONS,
-			 line_number, function_name, module_name, component_id,
-			 "%s %08X\n", acpi_gbl_fn_entry_str, integer);
+	/* Check if enabled up-front for performance */
+
+	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
+		acpi_debug_print(ACPI_LV_FUNCTIONS,
+				 line_number, function_name, module_name,
+				 component_id, "%s %08X\n",
+				 acpi_gbl_fn_entry_str, integer);
+	}
 }
 
 /*******************************************************************************
@@ -393,9 +411,13 @@ acpi_ut_exit(u32 line_number,
 	     const char *module_name, u32 component_id)
 {
 
-	acpi_debug_print(ACPI_LV_FUNCTIONS,
-			 line_number, function_name, module_name, component_id,
-			 "%s\n", acpi_gbl_fn_exit_str);
+	/* Check if enabled up-front for performance */
+
+	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
+		acpi_debug_print(ACPI_LV_FUNCTIONS,
+				 line_number, function_name, module_name,
+				 component_id, "%s\n", acpi_gbl_fn_exit_str);
+	}
 
 	acpi_gbl_nesting_level--;
 }
@@ -425,17 +447,23 @@ acpi_ut_status_exit(u32 line_number,
 		    u32 component_id, acpi_status status)
 {
 
-	if (ACPI_SUCCESS(status)) {
-		acpi_debug_print(ACPI_LV_FUNCTIONS,
-				 line_number, function_name, module_name,
-				 component_id, "%s %s\n", acpi_gbl_fn_exit_str,
-				 acpi_format_exception(status));
-	} else {
-		acpi_debug_print(ACPI_LV_FUNCTIONS,
-				 line_number, function_name, module_name,
-				 component_id, "%s ****Exception****: %s\n",
-				 acpi_gbl_fn_exit_str,
-				 acpi_format_exception(status));
+	/* Check if enabled up-front for performance */
+
+	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
+		if (ACPI_SUCCESS(status)) {
+			acpi_debug_print(ACPI_LV_FUNCTIONS,
+					 line_number, function_name,
+					 module_name, component_id, "%s %s\n",
+					 acpi_gbl_fn_exit_str,
+					 acpi_format_exception(status));
+		} else {
+			acpi_debug_print(ACPI_LV_FUNCTIONS,
+					 line_number, function_name,
+					 module_name, component_id,
+					 "%s ****Exception****: %s\n",
+					 acpi_gbl_fn_exit_str,
+					 acpi_format_exception(status));
+		}
 	}
 
 	acpi_gbl_nesting_level--;
@@ -465,10 +493,15 @@ acpi_ut_value_exit(u32 line_number,
 		   const char *module_name, u32 component_id, u64 value)
 {
 
-	acpi_debug_print(ACPI_LV_FUNCTIONS,
-			 line_number, function_name, module_name, component_id,
-			 "%s %8.8X%8.8X\n", acpi_gbl_fn_exit_str,
-			 ACPI_FORMAT_UINT64(value));
+	/* Check if enabled up-front for performance */
+
+	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
+		acpi_debug_print(ACPI_LV_FUNCTIONS,
+				 line_number, function_name, module_name,
+				 component_id, "%s %8.8X%8.8X\n",
+				 acpi_gbl_fn_exit_str,
+				 ACPI_FORMAT_UINT64(value));
+	}
 
 	acpi_gbl_nesting_level--;
 }
@@ -497,9 +530,14 @@ acpi_ut_ptr_exit(u32 line_number,
 		 const char *module_name, u32 component_id, u8 *ptr)
 {
 
-	acpi_debug_print(ACPI_LV_FUNCTIONS,
-			 line_number, function_name, module_name, component_id,
-			 "%s %p\n", acpi_gbl_fn_exit_str, ptr);
+	/* Check if enabled up-front for performance */
+
+	if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
+		acpi_debug_print(ACPI_LV_FUNCTIONS,
+				 line_number, function_name, module_name,
+				 component_id, "%s %p\n", acpi_gbl_fn_exit_str,
+				 ptr);
+	}
 
 	acpi_gbl_nesting_level--;
 }
Signature · 1 line
1.7.10
author
#13 lore raw

PATCH 11/27 ACPICA: Eliminate superfluous return_UINT8 and return_UINT32 macros.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

These macros were implemented the same as return_VALUE and thus they were not needed.

---
 drivers/acpi/acpica/acmacros.h  |    7 -------
 drivers/acpi/acpica/dsutils.c   |   10 +++++-----
 drivers/acpi/acpica/evgpe.c     |    6 +++---
 drivers/acpi/acpica/evsci.c     |    4 ++--
 drivers/acpi/acpica/exprep.c    |    4 ++--
 drivers/acpi/acpica/exutils.c   |    4 ++--
 drivers/acpi/acpica/hwacpi.c    |    8 ++++----
 drivers/acpi/acpica/nsutils.c   |    8 ++++----
 drivers/acpi/acpica/psargs.c    |    2 +-
 drivers/acpi/acpica/utaddress.c |    4 ++--
 10 files changed, 25 insertions(+), 32 deletions(-)
drivers/acpi/acpica/acmacros.h +0 -7
index cd96135..81f3cf7 100644
@@ -469,11 +469,6 @@
 #define return_VALUE(value) \
 	ACPI_TRACE_EXIT (acpi_ut_value_exit, (u64), value)
 
-/* These exit macros are superfluous and should be removed entirely */
-
-#define return_UINT8        return_VALUE
-#define return_UINT32       return_VALUE
-
 /* Conditional execution */
 
 #define ACPI_DEBUG_EXEC(a)              a
@@ -515,8 +510,6 @@
 #define return_VOID                     return
 #define return_ACPI_STATUS(s)           return(s)
 #define return_VALUE(s)                 return(s)
-#define return_UINT8(s)                 return(s)
-#define return_UINT32(s)                return(s)
 #define return_PTR(s)                   return(s)
 
 #endif				/* ACPI_DEBUG_OUTPUT */
drivers/acpi/acpica/dsutils.c +5 -5
index afeb99f..466f5f2 100644
@@ -178,7 +178,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
 
 	if (!op) {
 		ACPI_ERROR((AE_INFO, "Null Op"));
-		return_UINT8(TRUE);
+		return_VALUE(TRUE);
 	}
 
 	/*
@@ -210,7 +210,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
 				  "At Method level, result of [%s] not used\n",
 				  acpi_ps_get_opcode_name(op->common.
 							  aml_opcode)));
-		return_UINT8(FALSE);
+		return_VALUE(FALSE);
 	}
 
 	/* Get info on the parent. The root_op is AML_SCOPE */
@@ -219,7 +219,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
 	    acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode);
 	if (parent_info->class == AML_CLASS_UNKNOWN) {
 		ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op));
-		return_UINT8(FALSE);
+		return_VALUE(FALSE);
 	}
 
 	/*
@@ -307,7 +307,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
 			  acpi_ps_get_opcode_name(op->common.parent->common.
 						  aml_opcode), op));
 
-	return_UINT8(TRUE);
+	return_VALUE(TRUE);
 
       result_not_used:
 	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@@ -316,7 +316,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
 			  acpi_ps_get_opcode_name(op->common.parent->common.
 						  aml_opcode), op));
 
-	return_UINT8(FALSE);
+	return_VALUE(FALSE);
 }
 
 /*******************************************************************************
drivers/acpi/acpica/evgpe.c +3 -3
index 4cbb600..052d4c8 100644
@@ -707,7 +707,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
 		if (ACPI_FAILURE(status)) {
 			ACPI_EXCEPTION((AE_INFO, status,
 					"Unable to clear GPE%02X", gpe_number));
-			return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
+			return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
 		}
 	}
 
@@ -724,7 +724,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
 	if (ACPI_FAILURE(status)) {
 		ACPI_EXCEPTION((AE_INFO, status,
 				"Unable to disable GPE%02X", gpe_number));
-		return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
+		return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
 	}
 
 	/*
@@ -784,7 +784,7 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
 		break;
 	}
 
-	return_UINT32(ACPI_INTERRUPT_HANDLED);
+	return_VALUE(ACPI_INTERRUPT_HANDLED);
 }
 
 #endif				/* !ACPI_REDUCED_HARDWARE */
drivers/acpi/acpica/evsci.c +2 -2
index f9661e2..6c90f15 100644
@@ -89,7 +89,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
 	 */
 	interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
 
-	return_UINT32(interrupt_handled);
+	return_VALUE(interrupt_handled);
 }
 
 /*******************************************************************************
@@ -120,7 +120,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
 
 	interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
 
-	return_UINT32(interrupt_handled);
+	return_VALUE(interrupt_handled);
 }
 
 /******************************************************************************
drivers/acpi/acpica/exprep.c +2 -2
index ba9db4d..60ee5e9 100644
@@ -276,7 +276,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
 		/* Invalid field access type */
 
 		ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access));
-		return_UINT32(0);
+		return_VALUE(0);
 	}
 
 	if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
@@ -289,7 +289,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
 	}
 
 	*return_byte_alignment = byte_alignment;
-	return_UINT32(bit_length);
+	return_VALUE(bit_length);
 }
 
 /*******************************************************************************
drivers/acpi/acpica/exutils.c +2 -2
index 264d22d..02ddc4c 100644
@@ -336,7 +336,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
 	/* u64 is unsigned, so we don't worry about a '-' prefix */
 
 	if (value == 0) {
-		return_UINT32(1);
+		return_VALUE(1);
 	}
 
 	current_value = value;
@@ -350,7 +350,7 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
 		num_digits++;
 	}
 
-	return_UINT32(num_digits);
+	return_VALUE(num_digits);
 }
 
 /*******************************************************************************
drivers/acpi/acpica/hwacpi.c +4 -4
index effa2b0..2613e29 100644
@@ -151,18 +151,18 @@ u32 acpi_hw_get_mode(void)
 	 * system does not support mode transition.
 	 */
 	if (!acpi_gbl_FADT.smi_command) {
-		return_UINT32(ACPI_SYS_MODE_ACPI);
+		return_VALUE(ACPI_SYS_MODE_ACPI);
 	}
 
 	status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value);
 	if (ACPI_FAILURE(status)) {
-		return_UINT32(ACPI_SYS_MODE_LEGACY);
+		return_VALUE(ACPI_SYS_MODE_LEGACY);
 	}
 
 	if (value) {
-		return_UINT32(ACPI_SYS_MODE_ACPI);
+		return_VALUE(ACPI_SYS_MODE_ACPI);
 	} else {
-		return_UINT32(ACPI_SYS_MODE_LEGACY);
+		return_VALUE(ACPI_SYS_MODE_LEGACY);
 	}
 }
 
drivers/acpi/acpica/nsutils.c +4 -4
index 596d4cc..a771c8c 100644
@@ -112,10 +112,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
 
 	if (!node) {
 		ACPI_WARNING((AE_INFO, "Null Node parameter"));
-		return_UINT32(ACPI_TYPE_ANY);
+		return_VALUE(ACPI_TYPE_ANY);
 	}
 
-	return_UINT32((acpi_object_type) node->type);
+	return_VALUE(node->type);
 }
 
 /*******************************************************************************
@@ -140,10 +140,10 @@ u32 acpi_ns_local(acpi_object_type type)
 		/* Type code out of range  */
 
 		ACPI_WARNING((AE_INFO, "Invalid Object Type 0x%X", type));
-		return_UINT32(ACPI_NS_NORMAL);
+		return_VALUE(ACPI_NS_NORMAL);
 	}
 
-	return_UINT32((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
+	return_VALUE(acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
 }
 
 /*******************************************************************************
drivers/acpi/acpica/psargs.c +1 -1
index 9f31893..9256513 100644
@@ -108,7 +108,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
 	/* Byte 0 is a special case, either bits [0:3] or [0:5] are used */
 
 	package_length |= (aml[0] & byte_zero_mask);
-	return_UINT32(package_length);
+	return_VALUE(package_length);
 }
 
 /*******************************************************************************
drivers/acpi/acpica/utaddress.c +2 -2
index 6488030..b86ef85 100644
@@ -214,7 +214,7 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id,
 
 	if ((space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&
 	    (space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {
-		return_UINT32(0);
+		return_VALUE(0);
 	}
 
 	range_info = acpi_gbl_address_range_list[space_id];
@@ -256,7 +256,7 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id,
 		range_info = range_info->next;
 	}
 
-	return_UINT32(overlap_count);
+	return_VALUE(overlap_count);
 }
 
 /*******************************************************************************
Signature · 1 line
1.7.10
author
#14 lore raw

PATCH 12/27 ACPICA: Update ACPI_IS_DEBUG_ENABLED macro.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Add extra parens to allow use of !ACPI_IS_DEBUG_ENABLED.

---
 include/acpi/acoutput.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acoutput.h +1 -1
index be014bf..5ef4e57 100644
@@ -286,7 +286,7 @@
 /* Helper macros for DEBUG_PRINT */
 
 #define ACPI_IS_DEBUG_ENABLED(level, component) \
-	(level & acpi_dbg_level) && (component & acpi_dbg_layer)
+	((level & acpi_dbg_level) && (component & acpi_dbg_layer))
 
 #define ACPI_DEBUG(function, level, line, filename, modulename, component, ...) \
 	if (ACPI_IS_DEBUG_ENABLED (level, component)) \
Signature · 1 line
1.7.10
author
#15 lore raw

PATCH 13/27 ACPICA: Deploy new ACPI_IS_DEBUG_ENABLED macro in debug output code.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Simplifies check for debug output enables.

---
 drivers/acpi/acpica/exdump.c |   19 ++++++++++---------
 drivers/acpi/acpica/nsdump.c |    7 ++++---
 drivers/acpi/acpica/rsdump.c |   10 ++++++----
 3 files changed, 20 insertions(+), 16 deletions(-)
drivers/acpi/acpica/exdump.c +10 -9
index 858b43a..8698bff 100644
@@ -464,9 +464,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
 
 	ACPI_FUNCTION_NAME(ex_dump_operand)
 
-	    if (!
-		((ACPI_LV_EXEC & acpi_dbg_level)
-		  && (_COMPONENT & acpi_dbg_layer))) {
+	    /* Check if debug output enabled */
+	    if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_EXEC, _COMPONENT)) {
 		return;
 	}
 
@@ -811,9 +810,10 @@ void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags)
 	ACPI_FUNCTION_ENTRY();
 
 	if (!flags) {
-		if (!
-		    ((ACPI_LV_OBJECTS & acpi_dbg_level)
-		      && (_COMPONENT & acpi_dbg_layer))) {
+
+		/* Check if debug output enabled */
+
+		if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_OBJECTS, _COMPONENT)) {
 			return;
 		}
 	}
@@ -999,9 +999,10 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
 	}
 
 	if (!flags) {
-		if (!
-		    ((ACPI_LV_OBJECTS & acpi_dbg_level)
-		      && (_COMPONENT & acpi_dbg_layer))) {
+
+		/* Check if debug output enabled */
+
+		if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_OBJECTS, _COMPONENT)) {
 			return_VOID;
 		}
 	}
drivers/acpi/acpica/nsdump.c +4 -3
index 8e6f0037..3e04879 100644
@@ -77,8 +77,9 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
 
 	ACPI_FUNCTION_NAME(ns_print_pathname);
 
-	if (!(acpi_dbg_level & ACPI_LV_NAMES)
-	    || !(acpi_dbg_layer & ACPI_NAMESPACE)) {
+	/* Check if debug output enabled */
+
+	if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_NAMES, ACPI_NAMESPACE)) {
 		return;
 	}
 
@@ -127,7 +128,7 @@ acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
 
 	/* Do this only if the requested debug level and component are enabled */
 
-	if (!(acpi_dbg_level & level) || !(acpi_dbg_layer & component)) {
+	if (!ACPI_IS_DEBUG_ENABLED(level, component)) {
 		return_VOID;
 	}
 
drivers/acpi/acpica/rsdump.c +6 -4
index 0b7381f..203b4ae 100644
@@ -766,8 +766,9 @@ void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
 
 	ACPI_FUNCTION_ENTRY();
 
-	if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
-	    || !(_COMPONENT & acpi_dbg_layer)) {
+	/* Check if debug output enabled */
+
+	if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) {
 		return;
 	}
 
@@ -828,8 +829,9 @@ void acpi_rs_dump_irq_list(u8 * route_table)
 
 	ACPI_FUNCTION_ENTRY();
 
-	if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
-	    || !(_COMPONENT & acpi_dbg_layer)) {
+	/* Check if debug output enabled */
+
+	if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) {
 		return;
 	}
 
Signature · 1 line
1.7.10
author
#16 lore raw

PATCH 14/27 ACPICA: Merge all debug output macros into a single file, acoutput.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Moved the debug trace macros from acmacros.h into acoutput.h where they belong.

---
 drivers/acpi/acpica/acmacros.h |  126 ----------------------------------------
 include/acpi/acoutput.h        |  115 ++++++++++++++++++++++++++++++++++++
 2 files changed, 115 insertions(+), 126 deletions(-)
drivers/acpi/acpica/acmacros.h +0 -126
index 81f3cf7..2db0f10 100644
@@ -388,132 +388,6 @@
 
 #endif				/* ACPI_NO_ERROR_MESSAGES */
 
-/*
- * Debug macros that are conditionally compiled
- */
-#ifdef ACPI_DEBUG_OUTPUT
-
-/*
- * Function entry tracing
- *
- * The name of the function is emitted as a local variable that is
- * intended to be used by both the entry trace and the exit trace.
- */
-
-/* Helper macro */
-
-#define ACPI_TRACE_ENTRY(name, function, cast, param) \
-	ACPI_FUNCTION_NAME (name) \
-	function (ACPI_DEBUG_PARAMETERS, cast (param))
-
-/* The actual entry trace macros */
-
-#define ACPI_FUNCTION_TRACE(name) \
-	ACPI_FUNCTION_NAME(name) \
-	acpi_ut_trace (ACPI_DEBUG_PARAMETERS)
-
-#define ACPI_FUNCTION_TRACE_PTR(name, pointer) \
-	ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, (void *), pointer)
-
-#define ACPI_FUNCTION_TRACE_U32(name, value) \
-	ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, (u32), value)
-
-#define ACPI_FUNCTION_TRACE_STR(name, string) \
-	ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, (char *), string)
-
-#define ACPI_FUNCTION_ENTRY() \
-	acpi_ut_track_stack_ptr()
-
-/*
- * Function exit tracing
- *
- * These macros include a return statement. This is usually considered
- * bad form, but having a separate exit macro before the actual return
- * is very ugly and difficult to maintain.
- *
- * One of the FUNCTION_TRACE macros above must be used in conjunction
- * with these macros so that "_AcpiFunctionName" is defined.
- *
- * Note: the DO_WHILE0 macro is used to prevent some compilers from
- * complaining about these constructs. On other compilers the do...while
- * adds some extra code, so this feature is optional.
- */
-#ifdef ACPI_USE_DO_WHILE_0
-#define ACPI_DO_WHILE0(a)               do a while(0)
-#else
-#define ACPI_DO_WHILE0(a)               a
-#endif
-
-/* Exit trace helper macro */
-
-#define ACPI_TRACE_EXIT(function, cast, param) \
-	ACPI_DO_WHILE0 ({ \
-		function (ACPI_DEBUG_PARAMETERS, cast (param)); \
-		return ((param)); \
-	})
-
-/* The actual exit macros */
-
-#define return_VOID \
-	ACPI_DO_WHILE0 ({ \
-		acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \
-		return; \
-	})
-
-#define return_ACPI_STATUS(status) \
-	ACPI_TRACE_EXIT (acpi_ut_status_exit, (acpi_status), status)
-
-#define return_PTR(pointer) \
-	ACPI_TRACE_EXIT (acpi_ut_ptr_exit, (u8 *), pointer)
-
-#define return_VALUE(value) \
-	ACPI_TRACE_EXIT (acpi_ut_value_exit, (u64), value)
-
-/* Conditional execution */
-
-#define ACPI_DEBUG_EXEC(a)              a
-#define ACPI_DEBUG_ONLY_MEMBERS(a)      a;
-#define _VERBOSE_STRUCTURES
-
-/* Various object display routines for debug */
-
-#define ACPI_DUMP_STACK_ENTRY(a)        acpi_ex_dump_operand((a), 0)
-#define ACPI_DUMP_OPERANDS(a, b ,c)     acpi_ex_dump_operands(a, b, c)
-#define ACPI_DUMP_ENTRY(a, b)           acpi_ns_dump_entry (a, b)
-#define ACPI_DUMP_PATHNAME(a, b, c, d)  acpi_ns_dump_pathname(a, b, c, d)
-#define ACPI_DUMP_BUFFER(a, b)          acpi_ut_debug_dump_buffer((u8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT)
-
-#else
-/*
- * This is the non-debug case -- make everything go away,
- * leaving no executable debug code!
- */
-#define ACPI_DEBUG_EXEC(a)
-#define ACPI_DEBUG_ONLY_MEMBERS(a)
-#define ACPI_FUNCTION_TRACE(a)
-#define ACPI_FUNCTION_TRACE_PTR(a, b)
-#define ACPI_FUNCTION_TRACE_U32(a, b)
-#define ACPI_FUNCTION_TRACE_STR(a, b)
-#define ACPI_FUNCTION_EXIT
-#define ACPI_FUNCTION_STATUS_EXIT(s)
-#define ACPI_FUNCTION_VALUE_EXIT(s)
-#define ACPI_FUNCTION_ENTRY()
-#define ACPI_DUMP_STACK_ENTRY(a)
-#define ACPI_DUMP_OPERANDS(a, b, c)
-#define ACPI_DUMP_ENTRY(a, b)
-#define ACPI_DUMP_TABLES(a, b)
-#define ACPI_DUMP_PATHNAME(a, b, c, d)
-#define ACPI_DUMP_BUFFER(a, b)
-#define ACPI_DEBUG_PRINT(pl)
-#define ACPI_DEBUG_PRINT_RAW(pl)
-
-#define return_VOID                     return
-#define return_ACPI_STATUS(s)           return(s)
-#define return_VALUE(s)                 return(s)
-#define return_PTR(s)                   return(s)
-
-#endif				/* ACPI_DEBUG_OUTPUT */
-
 #if (!ACPI_REDUCED_HARDWARE)
 #define ACPI_HW_OPTIONAL_FUNCTION(addr)     addr
 #else
include/acpi/acoutput.h +115 -0

128 lines not on this page · raw message

Signature · 1 line
1.7.10
author
#17 lore raw

PATCH 15/27 ACPICA: iASL: Finish support for CSRT table.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Add intel-specific shared info subtable. Add data table compiler and template support.

---
 include/acpi/actbl2.h |   23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
include/acpi/actbl2.h +21 -2
index 1b2b356..ef9dae1 100644
@@ -261,9 +261,28 @@ struct acpi_csrt_group {
 	u16 subdevice_id;
 	u16 revision;
 	u16 reserved;
-	u32 info_length;
+	u32 shared_info_length;
 
-	/* Shared data (length = info_length) immediately follows */
+	/* Shared data immediately follows (Length = shared_info_length) */
+};
+
+/* Shared Info subtable */
+
+struct acpi_csrt_shared_info {
+	u16 major_version;
+	u16 minor_version;
+	u32 mmio_base_low;
+	u32 mmio_base_high;
+	u32 gsi_interrupt;
+	u8 interrupt_polarity;
+	u8 interrupt_mode;
+	u8 num_channels;
+	u8 dma_address_width;
+	u16 base_request_line;
+	u16 num_handshake_signals;
+	u32 max_block_size;
+
+	/* Resource descriptors immediately follow (Length = Group length - shared_info_length) */
 };
 
 /* Resource Descriptor subtable */
Signature · 1 line
1.7.10
author
#18 lore raw

PATCH 16/27 ACPICA: iASL: Finish support for the TPM2 table.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Add disassembler, table compiler, and template support.

---
 include/acpi/actbl3.h |    1 -
 1 file changed, 1 deletion(-)
include/acpi/actbl3.h +0 -1
index a067d7d..c4aae22 100644
@@ -75,7 +75,6 @@
 
 /* Reserved table signatures */
 
-#define ACPI_SIG_CSRT           "CSRT"	/* Core System Resources Table */
 #define ACPI_SIG_MATR           "MATR"	/* Memory Address Translation Table */
 #define ACPI_SIG_MSDM           "MSDM"	/* Microsoft Data Management Table */
 #define ACPI_SIG_WPBT           "WPBT"	/* Windows Platform Binary Table */
Signature · 1 line
1.7.10
author
#19 lore raw

PATCH 17/27 ACPICA: Update for non-configured ACPI_IS_DEBUG_ENABLED macro.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Also add acoutput.h to the nsdump.c file.

---
 drivers/acpi/acpica/nsdump.c |    1 +
 include/acpi/acoutput.h      |    9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/acpi/acpica/nsdump.c +1 -0
index 3e04879..37b0e68 100644
@@ -44,6 +44,7 @@
 #include <acpi/acpi.h>
 #include "accommon.h"
 #include "acnamesp.h"
+#include <acpi/acoutput.h>
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsdump")
include/acpi/acoutput.h +6 -3
index c13b351..23db272 100644
@@ -266,6 +266,11 @@
 #define ACPI_DEBUG_PARAMETERS \
 	__LINE__, ACPI_GET_FUNCTION_NAME, _acpi_module_name, _COMPONENT
 
+/* Check if debug output is currently dynamically enabled */
+
+#define ACPI_IS_DEBUG_ENABLED(level, component) \
+	((level & acpi_dbg_level) && (component & acpi_dbg_layer))
+
 /*
  * Master debug print macros
  * Print message if and only if:
@@ -285,9 +290,6 @@
 
 /* Helper macros for DEBUG_PRINT */
 
-#define ACPI_IS_DEBUG_ENABLED(level, component) \
-	((level & acpi_dbg_level) && (component & acpi_dbg_layer))
-
 #define ACPI_DEBUG(function, level, line, filename, modulename, component, ...) \
 	if (ACPI_IS_DEBUG_ENABLED (level, component)) \
 	{ \
@@ -416,6 +418,7 @@
 #define ACPI_DUMP_BUFFER(a, b)
 #define ACPI_DEBUG_PRINT(pl)
 #define ACPI_DEBUG_PRINT_RAW(pl)
+#define ACPI_IS_DEBUG_ENABLED(level, component) 0
 
 /* Return macros must have a return statement at the minimum */
 
Signature · 1 line
1.7.10
author
#20 lore raw

PATCH 18/27 ACPICA: Fix possible memory leak in dispatcher error path.

In reply to Lv Zheng

From: Tim Gardner <[email protected]>

On error, delete mutex object created during method mutex creation. Reported by [email protected].

---
 drivers/acpi/acpica/dsmethod.c |    1 +
 1 file changed, 1 insertion(+)
drivers/acpi/acpica/dsmethod.c +1 -0
index 54c968a..4e5873a 100644
@@ -151,6 +151,7 @@ acpi_ds_create_method_mutex(union acpi_operand_object *method_desc)
 
 	status = acpi_os_create_mutex(&mutex_desc->mutex.os_mutex);
 	if (ACPI_FAILURE(status)) {
+		acpi_ut_delete_object_desc(mutex_desc);
 		return_ACPI_STATUS(status);
 	}
 
Signature · 1 line
1.7.10
author
#21 lore raw

PATCH 19/27 ACPICA: Resource manager: Add support for ACPI 5 wake bit in IRQ descriptor.

In reply to Lv Zheng

From: Aaron Lu <[email protected]>

Add support to both get and set the extended share flags for the IRQ() resource descriptor. Reported by Aaron Lu.

---
 drivers/acpi/acpica/rsirq.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/acpi/acpica/rsirq.c +4 -4
index a718eca..14cb76e 100644
@@ -80,7 +80,7 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = {
 
 	{ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3},
 
-	/* Get flags: Triggering[0], Polarity[3], Sharing[4] */
+	/* Get flags: Triggering[0], Polarity[3], sharing_and_wake[4:5] */
 
 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering),
 	 AML_OFFSET(irq.flags),
@@ -90,7 +90,7 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = {
 	 AML_OFFSET(irq.flags),
 	 3},
 
-	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
+	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
 	 AML_OFFSET(irq.flags),
 	 4}
 };
@@ -114,7 +114,7 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = {
 	 AML_OFFSET(irq.irq_mask),
 	 ACPI_RS_OFFSET(data.irq.interrupt_count)},
 
-	/* Set the flags byte */
+	/* Set flags: Triggering[0], Polarity[3], sharing_and_wake[4:5] */
 
 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering),
 	 AML_OFFSET(irq.flags),
@@ -124,7 +124,7 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = {
 	 AML_OFFSET(irq.flags),
 	 3},
 
-	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
+	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
 	 AML_OFFSET(irq.flags),
 	 4},
 
Signature · 1 line
1.7.10
author
#22 lore raw

PATCH 20/27 ACPICA: Namespace: Eliminate dot...dot output during initialization.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

This feature no longer serves any good purpose and also confuses any error messages during ACPICA initialization.

---
 drivers/acpi/acpica/nsinit.c |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
drivers/acpi/acpica/nsinit.c +4 -17
index 94c1500..59cd5b4 100644
@@ -86,7 +86,7 @@ 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:"));
+			      "Completing Region/Field/Buffer/Package initialization:\n"));
 
 	/* Set all init info to zero */
 
@@ -102,7 +102,7 @@ acpi_status acpi_ns_initialize_objects(void)
 	}
 
 	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
-			      "\nInitialized %u/%u Regions %u/%u Fields %u/%u "
+			      "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,
@@ -149,7 +149,7 @@ acpi_status acpi_ns_initialize_devices(void)
 
 	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
 			      "Initializing Device/Processor/Thermal objects "
-			      "by executing _INI methods:"));
+			      "and executing _INI methods:\n"));
 
 	/* Tree analysis: find all subtrees that contain _INI methods */
 
@@ -207,7 +207,7 @@ acpi_status acpi_ns_initialize_devices(void)
 	}
 
 	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
-			      "\nExecuted %u _INI methods requiring %u _STA executions "
+			      "Executed %u _INI methods requiring %u _STA executions "
 			      "(examined %u objects)\n",
 			      info.num_INI, info.num_STA, info.device_count));
 
@@ -349,14 +349,6 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
 	}
 
 	/*
-	 * Print a dot for each object unless we are going to print the entire
-	 * pathname
-	 */
-	if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
-		ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
-	}
-
-	/*
 	 * We ignore errors from above, and always return OK, since we don't want
 	 * to abort the walk on any single error.
 	 */
@@ -575,11 +567,6 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
 
 	if (ACPI_SUCCESS(status)) {
 		walk_info->num_INI++;
-
-		if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) &&
-		    (!(acpi_dbg_level & ACPI_LV_INFO))) {
-			ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
-		}
 	}
 #ifdef ACPI_DEBUG_OUTPUT
 	else if (status != AE_NOT_FOUND) {
Signature · 1 line
1.7.10
author
#23 lore raw

PATCH 21/27 ACPICA: Update ACPICA initialization messages.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Clarify messages, indent if appropriate. Change a couple appropriate messages to ACPI_INFO so they will appear even if debug output is disabled.

---
 drivers/acpi/acpica/evgpeblk.c  |   22 ++++++++++++----------
 drivers/acpi/acpica/evgpeinit.c |    3 +++
 drivers/acpi/acpica/nsinit.c    |    6 +++---
 drivers/acpi/acpica/tbxfload.c  |    2 +-
 4 files changed, 19 insertions(+), 14 deletions(-)
drivers/acpi/acpica/evgpeblk.c +12 -10
index 1571a61..78db9f5 100644
@@ -405,13 +405,13 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
 		(*return_gpe_block) = gpe_block;
 	}
 
-	ACPI_DEBUG_PRINT((ACPI_DB_INIT,
-			  "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
-			  (u32) gpe_block->block_base_number,
-			  (u32) (gpe_block->block_base_number +
-				(gpe_block->gpe_count - 1)),
-			  gpe_device->name.ascii, gpe_block->register_count,
-			  interrupt_number));
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+			      "    Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X\n",
+			      (u32)gpe_block->block_base_number,
+			      (u32)(gpe_block->block_base_number +
+				    (gpe_block->gpe_count - 1)),
+			      gpe_device->name.ascii, gpe_block->register_count,
+			      interrupt_number));
 
 	/* Update global count of currently available GPEs */
 
@@ -496,9 +496,11 @@ acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
 	}
 
 	if (gpe_enabled_count) {
-		ACPI_DEBUG_PRINT((ACPI_DB_INIT,
-				  "Enabled %u GPEs in this block\n",
-				  gpe_enabled_count));
+		ACPI_INFO((AE_INFO,
+			   "Enabled %u GPEs in block %02X to %02X",
+			   gpe_enabled_count, (u32)gpe_block->block_base_number,
+			   (u32)(gpe_block->block_base_number +
+				 (gpe_block->gpe_count - 1))));
 	}
 
 	gpe_block->initialized = TRUE;
drivers/acpi/acpica/evgpeinit.c +3 -0
index da0add8..8ac86b0 100644
@@ -86,6 +86,9 @@ acpi_status acpi_ev_gpe_initialize(void)
 
 	ACPI_FUNCTION_TRACE(ev_gpe_initialize);
 
+	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
+			      "Initializing General Purpose Events (GPEs):\n"));
+
 	status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
 	if (ACPI_FAILURE(status)) {
 		return_ACPI_STATUS(status);
drivers/acpi/acpica/nsinit.c +3 -3
index 59cd5b4..0f8de6e 100644
@@ -102,7 +102,7 @@ acpi_status acpi_ns_initialize_objects(void)
 	}
 
 	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
-			      "Initialized %u/%u Regions %u/%u Fields %u/%u "
+			      "    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,
@@ -149,7 +149,7 @@ acpi_status acpi_ns_initialize_devices(void)
 
 	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
 			      "Initializing Device/Processor/Thermal objects "
-			      "and executing _INI methods:\n"));
+			      "and executing _INI/_STA methods:\n"));
 
 	/* Tree analysis: find all subtrees that contain _INI methods */
 
@@ -207,7 +207,7 @@ acpi_status acpi_ns_initialize_devices(void)
 	}
 
 	ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
-			      "Executed %u _INI methods requiring %u _STA executions "
+			      "    Executed %u _INI methods requiring %u _STA executions "
 			      "(examined %u objects)\n",
 			      info.num_INI, info.num_STA, info.device_count));
 
drivers/acpi/acpica/tbxfload.c +1 -1
index a5e1e4e..7feaafd 100644
@@ -192,7 +192,7 @@ static acpi_status acpi_tb_load_namespace(void)
 		(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
 	}
 
-	ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
+	ACPI_INFO((AE_INFO, "All ACPI Tables successfully acquired"));
 
       unlock_and_exit:
 	(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
Signature · 1 line
1.7.10
author
#24 lore raw

PATCH 22/27 ACPICA: Interpreter: Add warning if 64-bit constant appears in 32-bit table.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Some ASL compilers allow 64-bit constants within a 32-bit table (DSDT version == 1). When encountered, emit a warning that the constant will be truncated to 32 bits. This is potentially a serious problem in the ACPI table(s).

---
 drivers/acpi/acpica/acinterp.h |    2 +-
 drivers/acpi/acpica/dsobject.c |   14 ++++++++++++--
 drivers/acpi/acpica/dswexec.c  |    4 ++--
 drivers/acpi/acpica/exconvrt.c |    2 +-
 drivers/acpi/acpica/exstoren.c |    2 +-
 drivers/acpi/acpica/exutils.c  |   18 +++++++++++-------
 6 files changed, 28 insertions(+), 14 deletions(-)
drivers/acpi/acpica/acinterp.h +1 -1
index eb30863..16469b0 100644
@@ -458,7 +458,7 @@ void acpi_ex_reacquire_interpreter(void);
 
 void acpi_ex_relinquish_interpreter(void);
 
-void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
+u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
 
 void acpi_ex_acquire_global_lock(u32 rule);
 
drivers/acpi/acpica/dsobject.c +12 -2
index 13844a1..82050bc 100644
@@ -703,7 +703,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
 				/* Truncate value if we are executing from a 32-bit ACPI table */
 
 #ifndef ACPI_NO_METHOD_EXECUTION
-				acpi_ex_truncate_for32bit_table(obj_desc);
+				(void)acpi_ex_truncate_for32bit_table(obj_desc);
 #endif
 				break;
 
@@ -725,8 +725,18 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
 		case AML_TYPE_LITERAL:
 
 			obj_desc->integer.value = op->common.value.integer;
+
 #ifndef ACPI_NO_METHOD_EXECUTION
-			acpi_ex_truncate_for32bit_table(obj_desc);
+			if (acpi_ex_truncate_for32bit_table(obj_desc)) {
+
+				/* Warn if we found a 64-bit constant in a 32-bit table */
+
+				ACPI_WARNING((AE_INFO,
+					      "Truncated 64-bit constant found in 32-bit table: %8.8X%8.8X => %8.8X",
+					      ACPI_FORMAT_UINT64(op->common.
+								 value.integer),
+					      (u32)obj_desc->integer.value));
+			}
 #endif
 			break;
 
drivers/acpi/acpica/dswexec.c +2 -2
index 5859393..9e0d210 100644
@@ -149,7 +149,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
 
 	/* Truncate the predicate to 32-bits if necessary */
 
-	acpi_ex_truncate_for32bit_table(local_obj_desc);
+	(void)acpi_ex_truncate_for32bit_table(local_obj_desc);
 
 	/*
 	 * Save the result of the predicate evaluation on
@@ -706,7 +706,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
 	 * ACPI 2.0 support for 64-bit integers: Truncate numeric
 	 * result value if we are executing from a 32-bit ACPI table
 	 */
-	acpi_ex_truncate_for32bit_table(walk_state->result_obj);
+	(void)acpi_ex_truncate_for32bit_table(walk_state->result_obj);
 
 	/*
 	 * Check if we just completed the evaluation of a
drivers/acpi/acpica/exconvrt.c +1 -1
index 4492a4e..d6a7b6f 100644
@@ -176,7 +176,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
 
 	/* Save the Result */
 
-	acpi_ex_truncate_for32bit_table(return_desc);
+	(void)acpi_ex_truncate_for32bit_table(return_desc);
 	*result_desc = return_desc;
 	return_ACPI_STATUS(AE_OK);
 }
drivers/acpi/acpica/exstoren.c +1 -1
index 87153bb..85a74b7 100644
@@ -253,7 +253,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
 
 		/* Truncate value if we are executing from a 32-bit ACPI table */
 
-		acpi_ex_truncate_for32bit_table(dest_desc);
+		(void)acpi_ex_truncate_for32bit_table(dest_desc);
 		break;
 
 	case ACPI_TYPE_STRING:
drivers/acpi/acpica/exutils.c +11 -7
index 02ddc4c..e624958 100644
@@ -202,35 +202,39 @@ void acpi_ex_relinquish_interpreter(void)
  *
  * PARAMETERS:  obj_desc        - Object to be truncated
  *
- * RETURN:      none
+ * RETURN:      TRUE if a truncation was performed, FALSE otherwise.
  *
  * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is
  *              32-bit, as determined by the revision of the DSDT.
  *
  ******************************************************************************/
 
-void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)
+u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)
 {
 
 	ACPI_FUNCTION_ENTRY();
 
 	/*
 	 * Object must be a valid number and we must be executing
-	 * a control method. NS node could be there for AML_INT_NAMEPATH_OP.
+	 * a control method. Object could be NS node for AML_INT_NAMEPATH_OP.
 	 */
 	if ((!obj_desc) ||
 	    (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) ||
 	    (obj_desc->common.type != ACPI_TYPE_INTEGER)) {
-		return;
+		return (FALSE);
 	}
 
-	if (acpi_gbl_integer_byte_width == 4) {
+	if ((acpi_gbl_integer_byte_width == 4) &&
+	    (obj_desc->integer.value > (u64)ACPI_UINT32_MAX)) {
 		/*
-		 * We are running a method that exists in a 32-bit ACPI table.
+		 * We are executing in a 32-bit ACPI table.
 		 * Truncate the value to 32 bits by zeroing out the upper 32-bit field
 		 */
-		obj_desc->integer.value &= (u64) ACPI_UINT32_MAX;
+		obj_desc->integer.value &= (u64)ACPI_UINT32_MAX;
+		return (TRUE);
 	}
+
+	return (FALSE);
 }
 
 /*******************************************************************************
Signature · 1 line
1.7.10
author
#25 lore raw

PATCH 23/27 ACPICA: Resources: Support for ACPI 5 wake bit in ExtendedInterrupt descriptor.

In reply to Lv Zheng

From: Aaron Lu <[email protected]>

Add support to both get and set the extended share flags for the Interrupt() resource descriptor. Reported by Aaron Lu.

---
 drivers/acpi/acpica/rsirq.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/acpi/acpica/rsirq.c +5 -5
index 14cb76e..f3733ee 100644
@@ -190,8 +190,10 @@ struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = {
 	 sizeof(struct aml_resource_extended_irq),
 	 0},
 
-	/* Flag bits */
-
+	/*
+	 * Flags: Producer/Consumer[0], Triggering[1], Polarity[2],
+	 *        sharing_and_wake[3:4]
+	 */
 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer),
 	 AML_OFFSET(extended_irq.flags),
 	 0},
@@ -204,7 +206,7 @@ struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = {
 	 AML_OFFSET(extended_irq.flags),
 	 2},
 
-	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.sharable),
+	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.extended_irq.sharable),
 	 AML_OFFSET(extended_irq.flags),
 	 3},
 
@@ -283,7 +285,6 @@ struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[4] = {
 	 * request_lines
 	 * Channels
 	 */
-
 	{ACPI_RSC_MOVE16, ACPI_RS_OFFSET(data.fixed_dma.request_lines),
 	 AML_OFFSET(fixed_dma.request_lines),
 	 2},
@@ -291,5 +292,4 @@ struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[4] = {
 	{ACPI_RSC_MOVE8, ACPI_RS_OFFSET(data.fixed_dma.width),
 	 AML_OFFSET(fixed_dma.width),
 	 1},
-
 };
Signature · 1 line
1.7.10
author
#26 lore raw

PATCH 24/27 ACPICA: Resources: Split interrupt share/wake bits into two fields.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

These two bits are merged at the external interface level for the IRQ, Interrupt, and GpioInt resource descriptors. However, these bits are logically independent and there is no need to keep them merged internally. Therefore, this change splits the bits into "sharable" and "wake capable" fields within the resource manager. This simplifies drive code that needs to examine these bits. Aaron Lu, Bob Moore.

---
 drivers/acpi/acpica/rsirq.c    |   32 ++++++++++++++++++++++----------
 drivers/acpi/acpica/rsserial.c |    8 ++++++--
 include/acpi/acrestyp.h        |   10 ++++++++--
 3 files changed, 36 insertions(+), 14 deletions(-)
drivers/acpi/acpica/rsirq.c +22 -10
index f3733ee..9c1d74a 100644
@@ -53,7 +53,7 @@ ACPI_MODULE_NAME("rsirq")
  * acpi_rs_get_irq
  *
  ******************************************************************************/
-struct acpi_rsconvert_info acpi_rs_get_irq[8] = {
+struct acpi_rsconvert_info acpi_rs_get_irq[9] = {
 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ,
 	 ACPI_RS_SIZE(struct acpi_resource_irq),
 	 ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)},
@@ -80,7 +80,7 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = {
 
 	{ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3},
 
-	/* Get flags: Triggering[0], Polarity[3], sharing_and_wake[4:5] */
+	/* Get flags: Triggering[0], Polarity[3], Sharing[4], Wake[5] */
 
 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering),
 	 AML_OFFSET(irq.flags),
@@ -90,9 +90,13 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = {
 	 AML_OFFSET(irq.flags),
 	 3},
 
-	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
+	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
 	 AML_OFFSET(irq.flags),
-	 4}
+	 4},
+
+	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.wake_capable),
+	 AML_OFFSET(irq.flags),
+	 5}
 };
 
 /*******************************************************************************
@@ -101,7 +105,7 @@ struct acpi_rsconvert_info acpi_rs_get_irq[8] = {
  *
  ******************************************************************************/
 
-struct acpi_rsconvert_info acpi_rs_set_irq[13] = {
+struct acpi_rsconvert_info acpi_rs_set_irq[14] = {
 	/* Start with a default descriptor of length 3 */
 
 	{ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ,
@@ -114,7 +118,7 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = {
 	 AML_OFFSET(irq.irq_mask),
 	 ACPI_RS_OFFSET(data.irq.interrupt_count)},
 
-	/* Set flags: Triggering[0], Polarity[3], sharing_and_wake[4:5] */
+	/* Set flags: Triggering[0], Polarity[3], Sharing[4], Wake[5] */
 
 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering),
 	 AML_OFFSET(irq.flags),
@@ -124,10 +128,14 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = {
 	 AML_OFFSET(irq.flags),
 	 3},
 
-	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
+	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
 	 AML_OFFSET(irq.flags),
 	 4},
 
+	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.wake_capable),
+	 AML_OFFSET(irq.flags),
+	 5},
+
 	/*
 	 * All done if the output descriptor length is required to be 3
 	 * (i.e., optimization to 2 bytes cannot be attempted)
@@ -181,7 +189,7 @@ struct acpi_rsconvert_info acpi_rs_set_irq[13] = {
  *
  ******************************************************************************/
 
-struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = {
+struct acpi_rsconvert_info acpi_rs_convert_ext_irq[10] = {
 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ,
 	 ACPI_RS_SIZE(struct acpi_resource_extended_irq),
 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_irq)},
@@ -192,7 +200,7 @@ struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = {
 
 	/*
 	 * Flags: Producer/Consumer[0], Triggering[1], Polarity[2],
-	 *        sharing_and_wake[3:4]
+	 *        Sharing[3], Wake[4]
 	 */
 	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer),
 	 AML_OFFSET(extended_irq.flags),
@@ -206,10 +214,14 @@ struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = {
 	 AML_OFFSET(extended_irq.flags),
 	 2},
 
-	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.extended_irq.sharable),
+	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.sharable),
 	 AML_OFFSET(extended_irq.flags),
 	 3},
 
+	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.wake_capable),
+	 AML_OFFSET(extended_irq.flags),
+	 4},
+
 	/* IRQ Table length (Byte4) */
 
 	{ACPI_RSC_COUNT, ACPI_RS_OFFSET(data.extended_irq.interrupt_count),
drivers/acpi/acpica/rsserial.c +6 -2
index 9aa5e68..197bab0 100644
@@ -53,7 +53,7 @@ ACPI_MODULE_NAME("rsserial")
  * acpi_rs_convert_gpio
  *
  ******************************************************************************/
-struct acpi_rsconvert_info acpi_rs_convert_gpio[17] = {
+struct acpi_rsconvert_info acpi_rs_convert_gpio[18] = {
 	{ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GPIO,
 	 ACPI_RS_SIZE(struct acpi_resource_gpio),
 	 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_gpio)},
@@ -75,10 +75,14 @@ struct acpi_rsconvert_info acpi_rs_convert_gpio[17] = {
 	 AML_OFFSET(gpio.flags),
 	 0},
 
-	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.sharable),
+	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.sharable),
 	 AML_OFFSET(gpio.int_flags),
 	 3},
 
+	{ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.gpio.wake_capable),
+	 AML_OFFSET(gpio.int_flags),
+	 4},
+
 	{ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.gpio.io_restriction),
 	 AML_OFFSET(gpio.int_flags),
 	 0},
include/acpi/acrestyp.h +8 -2
index 17f2d05..b58c3cb 100644
@@ -102,8 +102,11 @@ typedef u32 acpi_rsdesc_size;	/* Max Resource Descriptor size is (Length+3) = (6
 
 #define ACPI_EXCLUSIVE                  (u8) 0x00
 #define ACPI_SHARED                     (u8) 0x01
-#define ACPI_EXCLUSIVE_AND_WAKE         (u8) 0x02
-#define ACPI_SHARED_AND_WAKE            (u8) 0x03
+
+/* Wake */
+
+#define ACPI_NOT_WAKE_CAPABLE           (u8) 0x00
+#define ACPI_WAKE_CAPABLE               (u8) 0x01
 
 /*
  * DMA Attributes
@@ -171,6 +174,7 @@ struct acpi_resource_irq {
 	u8 triggering;
 	u8 polarity;
 	u8 sharable;
+	u8 wake_capable;
 	u8 interrupt_count;
 	u8 interrupts[1];
 };
@@ -346,6 +350,7 @@ struct acpi_resource_extended_irq {
 	u8 triggering;
 	u8 polarity;
 	u8 sharable;
+	u8 wake_capable;
 	u8 interrupt_count;
 	struct acpi_resource_source resource_source;
 	u32 interrupts[1];
@@ -365,6 +370,7 @@ struct acpi_resource_gpio {
 	u8 producer_consumer;	/* For values, see Producer/Consumer above */
 	u8 pin_config;
 	u8 sharable;		/* For values, see Interrupt Attributes above */
+	u8 wake_capable;	/* For values, see Interrupt Attributes above */
 	u8 io_restriction;
 	u8 triggering;		/* For values, see Interrupt Attributes above */
 	u8 polarity;		/* For values, see Interrupt Attributes above */
Signature · 1 line
1.7.10
author
#27 lore raw

PATCH 25/27 ACPICA: Interpreter: Fix Store() when implicit conversion is not possible.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

For the cases such as a store of a string to an existing package object, implement the store as a CopyObject().
This is a small departure from the ACPI specification which states that the control method should be aborted in this case. However, ASLTS suite depends on this behavior.

---
 drivers/acpi/acpica/exstore.c |   29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/acpi/acpica/exstore.c +24 -5
index 90431f1..4ff37e8 100644
@@ -487,14 +487,33 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
 	default:
 
 		ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-				  "Storing %s (%p) directly into node (%p) with no implicit conversion\n",
+				  "Storing [%s] (%p) directly into node [%s] (%p)"
+				  " with no implicit conversion\n",
 				  acpi_ut_get_object_type_name(source_desc),
-				  source_desc, node));
+				  source_desc,
+				  acpi_ut_get_object_type_name(target_desc),
+				  node));
 
-		/* No conversions for all other types. Just attach the source object */
+		/*
+		 * No conversions for all other types. Directly store a copy of
+		 * the source object. NOTE: This is a departure from the ACPI
+		 * spec, which states "If conversion is impossible, abort the
+		 * running control method".
+		 *
+		 * This code implements "If conversion is impossible, treat the
+		 * Store operation as a CopyObject".
+		 */
+		status =
+		    acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc,
+						    walk_state);
+		if (ACPI_FAILURE(status)) {
+			return_ACPI_STATUS(status);
+		}
 
-		status = acpi_ns_attach_object(node, source_desc,
-					       source_desc->common.type);
+		status =
+		    acpi_ns_attach_object(node, new_desc,
+					  new_desc->common.type);
+		acpi_ut_remove_reference(new_desc);
 		break;
 	}
 
Signature · 1 line
1.7.10
author
#28 lore raw

PATCH 27/27 ACPICA: Update version to 20121220.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

Version 20121220.

---
 include/acpi/acpixf.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpixf.h +1 -1
index afacb5a..b86364d 100644
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20121114
+#define ACPI_CA_VERSION                 0x20121220
 
 #include <acpi/acconfig.h>
 #include <acpi/actypes.h>
Signature · 1 line
1.7.10
author
#29 lore raw

cover ACPICA: Missing patches for 20121220 release.

In reply to Lv Zheng

This patch set is based on the ACPICA 20121220 release currently can be found in the linux-next branch of linux-pm tree.
This patch set has stayed in the acpica-201212 branch of the ACPICA release test tree for one days.
The source code differences between Linux and ACPICA can be summarized as follows:
1. 1963 Lines (70.0 Kbytes) before applying the patch set;
2. 1796 Lines (64.8 Kbytes) after applying the patch set.

Please review.

Bob Moore (1):
ACPICA: Source restructuring: split large files into 8 new files.

Lv Zheng (2):
ACPICA: Cleanup table handler naming conflicts.
ACPICA: Add new statistics interface.

 drivers/acpi/acpica/Makefile     |    8 +-
 drivers/acpi/acpica/acdebug.h    |   17 +
 drivers/acpi/acpica/acevents.h   |   21 +-
 drivers/acpi/acpica/acglobal.h   |    4 +-
 drivers/acpi/acpica/acnamesp.h   |   12 +
 drivers/acpi/acpica/acparser.h   |   23 +-
 drivers/acpi/acpica/acresrc.h    |    6 +-
 drivers/acpi/acpica/acutils.h    |   50 ++-
 drivers/acpi/acpica/dsmethod.c   |    1 +
 drivers/acpi/acpica/evhandler.c  |  529 ++++++++++++++++++++++++
 drivers/acpi/acpica/evregion.c   |  582 +++------------------------
 drivers/acpi/acpica/evsci.c      |    1 +
 drivers/acpi/acpica/nspredef.c   |  581 +-------------------------
 drivers/acpi/acpica/nsprepkg.c   |  621 ++++++++++++++++++++++++++++
 drivers/acpi/acpica/psloop.c     |  622 ----------------------------
 drivers/acpi/acpica/psobject.c   |  647 +++++++++++++++++++++++++++++
 drivers/acpi/acpica/psopcode.c   |  172 --------
 drivers/acpi/acpica/psopinfo.c   |  223 ++++++++++
 drivers/acpi/acpica/rsdump.c     |  409 +------------------
 drivers/acpi/acpica/rsdumpinfo.c |  454 +++++++++++++++++++++
 drivers/acpi/acpica/tbxface.c    |    4 +-
 drivers/acpi/acpica/utglobal.c   |   11 +
 drivers/acpi/acpica/utmisc.c     |  828 ++++----------------------------------
 drivers/acpi/acpica/utownerid.c  |  218 ++++++++++
 drivers/acpi/acpica/utstring.c   |  574 ++++++++++++++++++++++++++
 drivers/acpi/acpica/utxface.c    |   38 ++
 drivers/acpi/numa.c              |    2 +-
 drivers/acpi/tables.c            |    6 +-
 include/acpi/acconfig.h          |    1 +
 include/acpi/acpixf.h            |    6 +-
 include/acpi/actypes.h           |   12 +-
 include/linux/acpi.h             |   15 +-
 32 files changed, 3580 insertions(+), 3118 deletions(-)
 create mode 100644 drivers/acpi/acpica/evhandler.c
 create mode 100644 drivers/acpi/acpica/nsprepkg.c
 create mode 100644 drivers/acpi/acpica/psobject.c
 create mode 100644 drivers/acpi/acpica/psopinfo.c
 create mode 100644 drivers/acpi/acpica/rsdumpinfo.c
 create mode 100644 drivers/acpi/acpica/utownerid.c
 create mode 100644 drivers/acpi/acpica/utstring.c
Signature · 1 line
1.7.10
author
#30 lore raw

PATCH 2/3 ACPICA: Cleanup table handler naming conflicts.

This is a cosmetic patch only. Comparison of the resulting binary showed only line number differences.

This patch does not affect the generation of the Linux binary. This patch decreases 44 lines of 20121114 divergence.diff.

There are naming conflicts between Linux and ACPICA on table handlers. This patch cleans up this conflicts to reduce the source code diff between Linux and ACPICA.

---
Binary comparision result:
None
---
Divergences fixing result:
Before applying: 1963 Lines, 70.0 Kbytes
After applying: 1919 Lines, 68.3 Kbytes

---
 drivers/acpi/acpica/acglobal.h |    2 +-
 drivers/acpi/acpica/tbxface.c  |    4 ++--
 drivers/acpi/numa.c            |    2 +-
 drivers/acpi/tables.c          |    6 +++---
 include/acpi/acpixf.h          |    4 ++--
 include/acpi/actypes.h         |    2 +-
 include/linux/acpi.h           |   15 ++++++++++-----
 7 files changed, 20 insertions(+), 15 deletions(-)
drivers/acpi/acpica/acglobal.h +1 -1
index 864806e..585d364 100644
@@ -252,7 +252,7 @@ ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache;
 ACPI_EXTERN struct acpi_global_notify_handler acpi_gbl_global_notify[2];
 ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;
 ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;
-ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler;
+ACPI_EXTERN acpi_table_handler acpi_gbl_table_handler;
 ACPI_EXTERN void *acpi_gbl_table_handler_context;
 ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;
 ACPI_EXTERN acpi_interface_handler acpi_gbl_interface_handler;
drivers/acpi/acpica/tbxface.c +2 -2
index d102fe7..2115f22 100644
@@ -436,7 +436,7 @@ ACPI_EXPORT_SYMBOL(acpi_get_table_by_index)
  *
  ******************************************************************************/
 acpi_status
-acpi_install_table_handler(acpi_tbl_handler handler, void *context)
+acpi_install_table_handler(acpi_table_handler handler, void *context)
 {
 	acpi_status status;
 
@@ -482,7 +482,7 @@ ACPI_EXPORT_SYMBOL(acpi_install_table_handler)
  * DESCRIPTION: Remove table event handler
  *
  ******************************************************************************/
-acpi_status acpi_remove_table_handler(acpi_tbl_handler handler)
+acpi_status acpi_remove_table_handler(acpi_table_handler handler)
 {
 	acpi_status status;
 
drivers/acpi/numa.c +1 -1
index cb31298..5ddbc65 100644
@@ -273,7 +273,7 @@ static int __init acpi_parse_srat(struct acpi_table_header *table)
 
 static int __init
 acpi_table_parse_srat(enum acpi_srat_type id,
-		      acpi_table_entry_handler handler, unsigned int max_entries)
+		      acpi_tbl_entry_handler handler, unsigned int max_entries)
 {
 	return acpi_table_parse_entries(ACPI_SIG_SRAT,
 					    sizeof(struct acpi_table_srat), id,
drivers/acpi/tables.c +3 -3
index 2572d97..d67a1fe 100644
@@ -204,7 +204,7 @@ int __init
 acpi_table_parse_entries(char *id,
 			     unsigned long table_size,
 			     int entry_id,
-			     acpi_table_entry_handler handler,
+			     acpi_tbl_entry_handler handler,
 			     unsigned int max_entries)
 {
 	struct acpi_table_header *table_header = NULL;
@@ -269,7 +269,7 @@ err:
 
 int __init
 acpi_table_parse_madt(enum acpi_madt_type id,
-		      acpi_table_entry_handler handler, unsigned int max_entries)
+		      acpi_tbl_entry_handler handler, unsigned int max_entries)
 {
 	return acpi_table_parse_entries(ACPI_SIG_MADT,
 					    sizeof(struct acpi_table_madt), id,
@@ -285,7 +285,7 @@ acpi_table_parse_madt(enum acpi_madt_type id,
  * Scan the ACPI System Descriptor Table (STD) for a table matching @id,
  * run @handler on it.  Return 0 if table found, return on if not.
  */
-int __init acpi_table_parse(char *id, acpi_table_handler handler)
+int __init acpi_table_parse(char *id, acpi_tbl_table_handler handler)
 {
 	struct acpi_table_header *table = NULL;
 	acpi_size tbl_size;
include/acpi/acpixf.h +2 -2
index b86364d..d8b2ea6 100644
@@ -197,9 +197,9 @@ acpi_status
 acpi_get_table_by_index(u32 table_index, struct acpi_table_header **out_table);
 
 acpi_status
-acpi_install_table_handler(acpi_tbl_handler handler, void *context);
+acpi_install_table_handler(acpi_table_handler handler, void *context);
 
-acpi_status acpi_remove_table_handler(acpi_tbl_handler handler);
+acpi_status acpi_remove_table_handler(acpi_table_handler handler);
 
 /*
  * Namespace and name interfaces
include/acpi/actypes.h +1 -1
index cd89810..3d4e09c 100644
@@ -984,7 +984,7 @@ acpi_status(*acpi_exception_handler) (acpi_status aml_status,
 /* Table Event handler (Load, load_table, etc.) and types */
 
 typedef
-acpi_status(*acpi_tbl_handler) (u32 event, void *table, void *context);
+acpi_status(*acpi_table_handler) (u32 event, void *table, void *context);
 
 #define ACPI_TABLE_LOAD             0x0
 #define ACPI_TABLE_UNLOAD           0x1
include/linux/acpi.h +10 -5
index 8c1d6f2..1e33ea0 100644
@@ -74,9 +74,10 @@ enum acpi_address_range_id {
 
 /* Table Handlers */
 
-typedef int (*acpi_table_handler) (struct acpi_table_header *table);
+typedef int (*acpi_tbl_table_handler)(struct acpi_table_header *table);
 
-typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
+typedef int (*acpi_tbl_entry_handler)(struct acpi_subtable_header *header,
+				      const unsigned long end);
 
 #ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
 void acpi_initrd_override(void *data, size_t size);
@@ -95,10 +96,14 @@ int acpi_mps_check (void);
 int acpi_numa_init (void);
 
 int acpi_table_init (void);
-int acpi_table_parse (char *id, acpi_table_handler handler);
+int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
 int __init acpi_table_parse_entries(char *id, unsigned long table_size,
-	int entry_id, acpi_table_entry_handler handler, unsigned int max_entries);
-int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries);
+				    int entry_id,
+				    acpi_tbl_entry_handler handler,
+				    unsigned int max_entries);
+int acpi_table_parse_madt(enum acpi_madt_type id,
+			  acpi_tbl_entry_handler handler,
+			  unsigned int max_entries);
 int acpi_parse_mcfg (struct acpi_table_header *header);
 void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
 
Signature · 1 line
1.7.10
author
#31 lore raw

PATCH 3/3 ACPICA: Add new statistics interface.

In reply to Lv Zheng

This patch decreases 123 lines of 20121114 divergence.diff.

This patch ports new counters and statistics interface to Linux as such enhancement has already been implemented in ACPICA. This patch can also reduce the source code differences between Linux and ACPICA.

---
Divergences fixing result:
Before applying: 1919 Lines, 68.3 Kbytes
After applying: 1796 Lines, 64.3 Kbytes

---
 drivers/acpi/acpica/acglobal.h |    2 ++
 drivers/acpi/acpica/dsmethod.c |    1 +
 drivers/acpi/acpica/evsci.c    |    1 +
 drivers/acpi/acpica/utglobal.c |   11 +++++++++++
 drivers/acpi/acpica/utxface.c  |   38 ++++++++++++++++++++++++++++++++++++++
 include/acpi/acpixf.h          |    2 ++
 include/acpi/actypes.h         |   10 ++++++++++
 7 files changed, 65 insertions(+)
drivers/acpi/acpica/acglobal.h +2 -0
index 585d364..e7ebb0b 100644
@@ -393,7 +393,9 @@ extern u32 acpi_gbl_nesting_level;
 
 /* Event counters */
 
+ACPI_EXTERN u32 acpi_method_count;
 ACPI_EXTERN u32 acpi_gpe_count;
+ACPI_EXTERN u32 acpi_sci_count;
 ACPI_EXTERN u32 acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS];
 
 /* Support for dynamic control method tracing mechanism */
drivers/acpi/acpica/dsmethod.c +1 -0
index 4e5873a..7fed60c 100644
@@ -292,6 +292,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
 	 * reentered one more time (even if it is the same thread)
 	 */
 	obj_desc->method.thread_count++;
+	acpi_method_count++;
 	return_ACPI_STATUS(status);
 
       cleanup:
drivers/acpi/acpica/evsci.c +1 -0
index 6c90f15..2f93ac5 100644
@@ -89,6 +89,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
 	 */
 	interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
 
+	acpi_sci_count++;
 	return_VALUE(interrupt_handled);
 }
 
drivers/acpi/acpica/utglobal.c +11 -0
index 7b4dd21..82caa42 100644
@@ -289,6 +289,16 @@ acpi_status acpi_ut_init_globals(void)
 
 	acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;
 
+	/* Event counters */
+
+	acpi_method_count = 0;
+	acpi_sci_count = 0;
+	acpi_gpe_count = 0;
+
+	for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
+		acpi_fixed_event_count[i] = 0;
+	}
+
 #if (!ACPI_REDUCED_HARDWARE)
 
 	/* GPE support */
@@ -378,4 +388,5 @@ acpi_status acpi_ut_init_globals(void)
 ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
 ACPI_EXPORT_SYMBOL(acpi_dbg_level)
 ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
+    ACPI_EXPORT_SYMBOL(acpi_gpe_count)
 ACPI_EXPORT_SYMBOL(acpi_current_gpe_count)
drivers/acpi/acpica/utxface.c +38 -0
index cb85a7b..f1f0bb5 100644
@@ -207,6 +207,44 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer)
 
 ACPI_EXPORT_SYMBOL(acpi_get_system_info)
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_get_statistics
+ *
+ * PARAMETERS:  stats           - Where the statistics are returned
+ *
+ * RETURN:      status          - the status of the call
+ *
+ * DESCRIPTION: Get the contents of the various system counters
+ *
+ ******************************************************************************/
+acpi_status acpi_get_statistics(struct acpi_statistics *stats)
+{
+	ACPI_FUNCTION_TRACE(acpi_get_statistics);
+
+	/* Parameter validation */
+
+	if (!stats) {
+		return_ACPI_STATUS(AE_BAD_PARAMETER);
+	}
+
+	/* Various interrupt-based event counters */
+
+	stats->sci_count = acpi_sci_count;
+	stats->gpe_count = acpi_gpe_count;
+
+	ACPI_MEMCPY(stats->fixed_event_count, acpi_fixed_event_count,
+		    sizeof(acpi_fixed_event_count));
+
+	/* Other counters */
+
+	stats->method_count = acpi_method_count;
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+ACPI_EXPORT_SYMBOL(acpi_get_statistics)
+
 /*****************************************************************************
  *
  * FUNCTION:    acpi_install_initialization_handler
include/acpi/acpixf.h +2 -0
index d8b2ea6..110bc23 100644
@@ -137,6 +137,8 @@ acpi_status acpi_subsystem_status(void);
 acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
 #endif
 
+acpi_status acpi_get_statistics(struct acpi_statistics *stats);
+
 const char *acpi_format_exception(acpi_status exception);
 
 acpi_status acpi_purge_cached_objects(void);
include/acpi/actypes.h +10 -0
index 3d4e09c..46e6624 100644
@@ -933,6 +933,16 @@ struct acpi_system_info {
 	u32 debug_layer;
 };
 
+/*
+ * System statistics returned by acpi_get_statistics()
+ */
+struct acpi_statistics {
+	u32 sci_count;
+	u32 gpe_count;
+	u32 fixed_event_count[ACPI_NUM_FIXED_EVENTS];
+	u32 method_count;
+};
+
 /* Table Event Types */
 
 #define ACPI_TABLE_EVENT_LOAD           0x0
Signature · 1 line
1.7.10
#32 lore raw

Re: [PATCH 0/3] ACPICA: Missing patches for 20121220 release.

In reply to Lv Zheng
Quoted 9 lines · Lv Zheng

This patch set is based on the ACPICA 20121220 release currently can be found in the linux-next branch of linux-pm tree.
This patch set has stayed in the acpica-201212 branch of the ACPICA release test tree for one days.
The source code differences between Linux and ACPICA can be summarized as follows:
1. 1963 Lines (70.0 Kbytes) before applying the patch set;
2. 1796 Lines (64.8 Kbytes) after applying the patch set.

Quoted 8 lines

Please review.

Bob Moore (1):
ACPICA: Source restructuring: split large files into 8 new files.

Lv Zheng (2):
ACPICA: Cleanup table handler naming conflicts.
ACPICA: Add new statistics interface.

OK, applied.

I took [1/3] directly from my mailbox, because it looks like vger didn't allow it to go to the list.

Please check the ACPICA material in the linux-next branch of my tree and if there's anything more you'd like to go into v3.9, please let me know.

Thanks,
Rafael

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