Skip to contentSkip to conversation

ACPI patches for 2.6.28-rc0

PATCH New Len Brown 2 participants 124 messages Oct 23, 2008 Page 2 of 2

Subsystems (14)
Documentation x86 ACPI PCI +10 more subsystems
lore
Share & tools
lore
author reviewer
#106 lore raw

PATCH 106/122 ACPICA: Cleanup for internal Reference Object

In reply to Len Brown

From: Bob Moore <[email protected]>

Fix some sloppiness in the Reference object. No longer use AML opcodes to differentiate the types, introduce new reference Class. Cleanup the debug output code.

---
 drivers/acpi/dispatcher/dsmthdat.c |   83 ++++++++++++++++++-----------------
 drivers/acpi/dispatcher/dsobject.c |   56 +++++++++++++++---------
 drivers/acpi/dispatcher/dsopcode.c |    2 +-
 drivers/acpi/dispatcher/dswexec.c  |    8 ++--
 drivers/acpi/executer/exconfig.c   |    3 +-
 drivers/acpi/executer/exdump.c     |   74 +++++++++++++++-----------------
 drivers/acpi/executer/exmisc.c     |   14 +++---
 drivers/acpi/executer/exoparg1.c   |   26 ++++++------
 drivers/acpi/executer/exoparg2.c   |    4 +-
 drivers/acpi/executer/exresnte.c   |   16 +++----
 drivers/acpi/executer/exresolv.c   |   60 ++++++++++++-------------
 drivers/acpi/executer/exresop.c    |   50 +++++++++------------
 drivers/acpi/executer/exstore.c    |   57 +++++++++++++------------
 drivers/acpi/executer/exstoren.c   |    3 +-
 drivers/acpi/namespace/nsdump.c    |    5 +--
 drivers/acpi/namespace/nsxfeval.c  |    7 +--
 drivers/acpi/resources/rscalc.c    |    5 +-
 drivers/acpi/resources/rscreate.c  |   10 ++---
 drivers/acpi/utilities/utcopy.c    |   29 +++++++------
 drivers/acpi/utilities/utdelete.c  |    5 +-
 drivers/acpi/utilities/utglobal.c  |   35 +++++++++------
 drivers/acpi/utilities/utobject.c  |    9 ++--
 include/acpi/acdebug.h             |    4 ++
 include/acpi/acdispat.h            |    6 +-
 include/acpi/acobject.h            |   31 ++++++++++---
 25 files changed, 310 insertions(+), 292 deletions(-)
drivers/acpi/dispatcher/dsmthdat.c +43 -40
index 13c43ea..d03f81b 100644
@@ -43,7 +43,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acdispat.h>
-#include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acinterp.h>
 
@@ -52,11 +51,11 @@ ACPI_MODULE_NAME("dsmthdat")
 
 /* Local prototypes */
 static void
-acpi_ds_method_data_delete_value(u16 opcode,
+acpi_ds_method_data_delete_value(u8 type,
 				 u32 index, struct acpi_walk_state *walk_state);
 
 static acpi_status
-acpi_ds_method_data_set_value(u16 opcode,
+acpi_ds_method_data_set_value(u8 type,
 			      u32 index,
 			      union acpi_operand_object *object,
 			      struct acpi_walk_state *walk_state);
@@ -216,7 +215,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
 		 * Store the argument in the method/walk descriptor.
 		 * Do not copy the arg in order to implement call by reference
 		 */
-		status = acpi_ds_method_data_set_value(AML_ARG_OP, index,
+		status = acpi_ds_method_data_set_value(ACPI_REFCLASS_ARG, index,
 						       params[index],
 						       walk_state);
 		if (ACPI_FAILURE(status)) {
@@ -234,7 +233,8 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
  *
  * FUNCTION:    acpi_ds_method_data_get_node
  *
- * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
+ * PARAMETERS:  Type                - Either ACPI_REFCLASS_LOCAL or
+ *                                    ACPI_REFCLASS_ARG
  *              Index               - Which Local or Arg whose type to get
  *              walk_state          - Current walk state object
  *              Node                - Where the node is returned.
@@ -246,7 +246,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
  ******************************************************************************/
 
 acpi_status
-acpi_ds_method_data_get_node(u16 opcode,
+acpi_ds_method_data_get_node(u8 type,
 			     u32 index,
 			     struct acpi_walk_state *walk_state,
 			     struct acpi_namespace_node **node)
@@ -256,8 +256,8 @@ acpi_ds_method_data_get_node(u16 opcode,
 	/*
 	 * Method Locals and Arguments are supported
 	 */
-	switch (opcode) {
-	case AML_LOCAL_OP:
+	switch (type) {
+	case ACPI_REFCLASS_LOCAL:
 
 		if (index > ACPI_METHOD_MAX_LOCAL) {
 			ACPI_ERROR((AE_INFO,
@@ -271,7 +271,7 @@ acpi_ds_method_data_get_node(u16 opcode,
 		*node = &walk_state->local_variables[index];
 		break;
 
-	case AML_ARG_OP:
+	case ACPI_REFCLASS_ARG:
 
 		if (index > ACPI_METHOD_MAX_ARG) {
 			ACPI_ERROR((AE_INFO,
@@ -286,8 +286,8 @@ acpi_ds_method_data_get_node(u16 opcode,
 		break;
 
 	default:
-		ACPI_ERROR((AE_INFO, "Opcode %d is invalid", opcode));
-		return_ACPI_STATUS(AE_AML_BAD_OPCODE);
+		ACPI_ERROR((AE_INFO, "Type %d is invalid", type));
+		return_ACPI_STATUS(AE_TYPE);
 	}
 
 	return_ACPI_STATUS(AE_OK);
@@ -297,7 +297,8 @@ acpi_ds_method_data_get_node(u16 opcode,
  *
  * FUNCTION:    acpi_ds_method_data_set_value
  *
- * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
+ * PARAMETERS:  Type                - Either ACPI_REFCLASS_LOCAL or
+ *                                    ACPI_REFCLASS_ARG
  *              Index               - Which Local or Arg to get
  *              Object              - Object to be inserted into the stack entry
  *              walk_state          - Current walk state object
@@ -310,7 +311,7 @@ acpi_ds_method_data_get_node(u16 opcode,
  ******************************************************************************/
 
 static acpi_status
-acpi_ds_method_data_set_value(u16 opcode,
+acpi_ds_method_data_set_value(u8 type,
 			      u32 index,
 			      union acpi_operand_object *object,
 			      struct acpi_walk_state *walk_state)
@@ -321,13 +322,13 @@ acpi_ds_method_data_set_value(u16 opcode,
 	ACPI_FUNCTION_TRACE(ds_method_data_set_value);
 
 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-			  "NewObj %p Opcode %X, Refs=%d [%s]\n", object,
-			  opcode, object->common.reference_count,
+			  "NewObj %p Type %2.2X, Refs=%d [%s]\n", object,
+			  type, object->common.reference_count,
 			  acpi_ut_get_type_name(object->common.type)));
 
 	/* Get the namespace node for the arg/local */
 
-	status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+	status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
 	if (ACPI_FAILURE(status)) {
 		return_ACPI_STATUS(status);
 	}
@@ -350,7 +351,8 @@ acpi_ds_method_data_set_value(u16 opcode,
  *
  * FUNCTION:    acpi_ds_method_data_get_value
  *
- * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
+ * PARAMETERS:  Type                - Either ACPI_REFCLASS_LOCAL or
+ *                                    ACPI_REFCLASS_ARG
  *              Index               - Which local_var or argument to get
  *              walk_state          - Current walk state object
  *              dest_desc           - Where Arg or Local value is returned
@@ -363,7 +365,7 @@ acpi_ds_method_data_set_value(u16 opcode,
  ******************************************************************************/
 
 acpi_status
-acpi_ds_method_data_get_value(u16 opcode,
+acpi_ds_method_data_get_value(u8 type,
 			      u32 index,
 			      struct acpi_walk_state *walk_state,
 			      union acpi_operand_object **dest_desc)
@@ -383,7 +385,7 @@ acpi_ds_method_data_get_value(u16 opcode,
 
 	/* Get the namespace node for the arg/local */
 
-	status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+	status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
 	if (ACPI_FAILURE(status)) {
 		return_ACPI_STATUS(status);
 	}
@@ -419,8 +421,8 @@ acpi_ds_method_data_get_value(u16 opcode,
 		/* Otherwise, return the error */
 
 		else
-			switch (opcode) {
-			case AML_ARG_OP:
+			switch (type) {
+			case ACPI_REFCLASS_ARG:
 
 				ACPI_ERROR((AE_INFO,
 					    "Uninitialized Arg[%d] at node %p",
@@ -428,7 +430,7 @@ acpi_ds_method_data_get_value(u16 opcode,
 
 				return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
 
-			case AML_LOCAL_OP:
+			case ACPI_REFCLASS_LOCAL:
 
 				ACPI_ERROR((AE_INFO,
 					    "Uninitialized Local[%d] at node %p",
@@ -437,9 +439,10 @@ acpi_ds_method_data_get_value(u16 opcode,
 				return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
 
 			default:
+
 				ACPI_ERROR((AE_INFO,
 					    "Not a Arg/Local opcode: %X",
-					    opcode));
+					    type));
 				return_ACPI_STATUS(AE_AML_INTERNAL);
 			}
 	}
@@ -458,7 +461,8 @@ acpi_ds_method_data_get_value(u16 opcode,
  *
  * FUNCTION:    acpi_ds_method_data_delete_value
  *
- * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
+ * PARAMETERS:  Type                - Either ACPI_REFCLASS_LOCAL or
+ *                                    ACPI_REFCLASS_ARG
  *              Index               - Which local_var or argument to delete
  *              walk_state          - Current walk state object
  *
@@ -470,7 +474,7 @@ acpi_ds_method_data_get_value(u16 opcode,
  ******************************************************************************/
 
 static void
-acpi_ds_method_data_delete_value(u16 opcode,
+acpi_ds_method_data_delete_value(u8 type,
 				 u32 index, struct acpi_walk_state *walk_state)
 {
 	acpi_status status;
@@ -481,7 +485,7 @@ acpi_ds_method_data_delete_value(u16 opcode,
 
 	/* Get the namespace node for the arg/local */
 
-	status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+	status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
 	if (ACPI_FAILURE(status)) {
 		return_VOID;
 	}
@@ -514,7 +518,8 @@ acpi_ds_method_data_delete_value(u16 opcode,
  *
  * FUNCTION:    acpi_ds_store_object_to_local
  *
- * PARAMETERS:  Opcode              - Either AML_LOCAL_OP or AML_ARG_OP
+ * PARAMETERS:  Type                - Either ACPI_REFCLASS_LOCAL or
+ *                                    ACPI_REFCLASS_ARG
  *              Index               - Which Local or Arg to set
  *              obj_desc            - Value to be stored
  *              walk_state          - Current walk state
@@ -528,7 +533,7 @@ acpi_ds_method_data_delete_value(u16 opcode,
  ******************************************************************************/
 
 acpi_status
-acpi_ds_store_object_to_local(u16 opcode,
+acpi_ds_store_object_to_local(u8 type,
 			      u32 index,
 			      union acpi_operand_object *obj_desc,
 			      struct acpi_walk_state *walk_state)
@@ -539,8 +544,8 @@ acpi_ds_store_object_to_local(u16 opcode,
 	union acpi_operand_object *new_obj_desc;
 
 	ACPI_FUNCTION_TRACE(ds_store_object_to_local);
-	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
-			  opcode, index, obj_desc));
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n",
+			  type, index, obj_desc));
 
 	/* Parameter validation */
 
@@ -550,7 +555,7 @@ acpi_ds_store_object_to_local(u16 opcode,
 
 	/* Get the namespace node for the arg/local */
 
-	status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
+	status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
 	if (ACPI_FAILURE(status)) {
 		return_ACPI_STATUS(status);
 	}
@@ -602,7 +607,7 @@ acpi_ds_store_object_to_local(u16 opcode,
 		 *
 		 * Weird, but true.
 		 */
-		if (opcode == AML_ARG_OP) {
+		if (type == ACPI_REFCLASS_ARG) {
 			/*
 			 * If we have a valid reference object that came from ref_of(),
 			 * do the indirect store
@@ -611,8 +616,8 @@ acpi_ds_store_object_to_local(u16 opcode,
 			     ACPI_DESC_TYPE_OPERAND)
 			    && (current_obj_desc->common.type ==
 				ACPI_TYPE_LOCAL_REFERENCE)
-			    && (current_obj_desc->reference.opcode ==
-				AML_REF_OF_OP)) {
+			    && (current_obj_desc->reference.class ==
+				ACPI_REFCLASS_REFOF)) {
 				ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
 						  "Arg (%p) is an ObjRef(Node), storing in node %p\n",
 						  new_obj_desc,
@@ -640,11 +645,9 @@ acpi_ds_store_object_to_local(u16 opcode,
 			}
 		}
 
-		/*
-		 * Delete the existing object
-		 * before storing the new one
-		 */
-		acpi_ds_method_data_delete_value(opcode, index, walk_state);
+		/* Delete the existing object before storing the new one */
+
+		acpi_ds_method_data_delete_value(type, index, walk_state);
 	}
 
 	/*
@@ -653,7 +656,7 @@ acpi_ds_store_object_to_local(u16 opcode,
 	 * (increments the object reference count by one)
 	 */
 	status =
-	    acpi_ds_method_data_set_value(opcode, index, new_obj_desc,
+	    acpi_ds_method_data_set_value(type, index, new_obj_desc,
 					  walk_state);
 
 	/* Remove local reference if we copied the object above */
drivers/acpi/dispatcher/dsobject.c +34 -22

88 lines not on this page · raw message

drivers/acpi/dispatcher/dsopcode.c +1 -1
index 6a81c44..69fae59 100644
@@ -1330,7 +1330,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
 			     (walk_state->results->results.obj_desc[0]) ==
 			     ACPI_TYPE_LOCAL_REFERENCE)
 			    && ((walk_state->results->results.obj_desc[0])->
-				reference.opcode != AML_INDEX_OP)) {
+				reference.class != ACPI_REFCLASS_INDEX)) {
 				status =
 				    acpi_ex_resolve_to_value(&walk_state->
 							     results->results.
drivers/acpi/dispatcher/dswexec.c +4 -4
index b5072fa..5b24191 100644
@@ -429,10 +429,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
 			     ACPI_TYPE_LOCAL_REFERENCE)
 			    && (walk_state->operands[1]->common.type ==
 				ACPI_TYPE_LOCAL_REFERENCE)
-			    && (walk_state->operands[0]->reference.opcode ==
-				walk_state->operands[1]->reference.opcode)
-			    && (walk_state->operands[0]->reference.offset ==
-				walk_state->operands[1]->reference.offset)) {
+			    && (walk_state->operands[0]->reference.class ==
+				walk_state->operands[1]->reference.class)
+			    && (walk_state->operands[0]->reference.value ==
+				walk_state->operands[1]->reference.value)) {
 				status = AE_OK;
 			} else {
 				ACPI_EXCEPTION((AE_INFO, status,
drivers/acpi/executer/exconfig.c +1 -2
index 5f2b1eb..74da6fa 100644
@@ -43,7 +43,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 #include <acpi/actables.h>
 #include <acpi/acdispat.h>
@@ -91,7 +90,7 @@ acpi_ex_add_table(u32 table_index,
 
 	/* Init the table handle */
 
-	obj_desc->reference.opcode = AML_LOAD_OP;
+	obj_desc->reference.class = ACPI_REFCLASS_TABLE;
 	*ddb_handle = obj_desc;
 
 	/* Install the new table into the local data structures */
drivers/acpi/executer/exdump.c +34 -40

155 lines not on this page · raw message

drivers/acpi/executer/exmisc.c +7 -7
index 731414a..efb1913 100644
@@ -86,10 +86,10 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
 		/*
 		 * Must be a reference to a Local or Arg
 		 */
-		switch (obj_desc->reference.opcode) {
-		case AML_LOCAL_OP:
-		case AML_ARG_OP:
-		case AML_DEBUG_OP:
+		switch (obj_desc->reference.class) {
+		case ACPI_REFCLASS_LOCAL:
+		case ACPI_REFCLASS_ARG:
+		case ACPI_REFCLASS_DEBUG:
 
 			/* The referenced object is the pseudo-node for the local/arg */
 
@@ -98,8 +98,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
 
 		default:
 
-			ACPI_ERROR((AE_INFO, "Unknown Reference opcode %X",
-				    obj_desc->reference.opcode));
+			ACPI_ERROR((AE_INFO, "Unknown Reference Class %2.2X",
+				    obj_desc->reference.class));
 			return_ACPI_STATUS(AE_AML_INTERNAL);
 		}
 		break;
@@ -127,7 +127,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
 		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
-	reference_obj->reference.opcode = AML_REF_OF_OP;
+	reference_obj->reference.class = ACPI_REFCLASS_REFOF;
 	reference_obj->reference.object = referenced_obj;
 	*return_desc = reference_obj;
 
drivers/acpi/executer/exoparg1.c +13 -13
index 7c3bea5..f622f9e 100644
@@ -825,16 +825,16 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 				 *
 				 * Must resolve/dereference the local/arg reference first
 				 */
-				switch (operand[0]->reference.opcode) {
-				case AML_LOCAL_OP:
-				case AML_ARG_OP:
+				switch (operand[0]->reference.class) {
+				case ACPI_REFCLASS_LOCAL:
+				case ACPI_REFCLASS_ARG:
 
 					/* Set Operand[0] to the value of the local/arg */
 
 					status =
 					    acpi_ds_method_data_get_value
-					    (operand[0]->reference.opcode,
-					     operand[0]->reference.offset,
+					    (operand[0]->reference.class,
+					     operand[0]->reference.value,
 					     walk_state, &temp_desc);
 					if (ACPI_FAILURE(status)) {
 						goto cleanup;
@@ -848,7 +848,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 					operand[0] = temp_desc;
 					break;
 
-				case AML_REF_OF_OP:
+				case ACPI_REFCLASS_REFOF:
 
 					/* Get the object to which the reference refers */
 
@@ -928,8 +928,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 			 * This must be a reference object produced by either the
 			 * Index() or ref_of() operator
 			 */
-			switch (operand[0]->reference.opcode) {
-			case AML_INDEX_OP:
+			switch (operand[0]->reference.class) {
+			case ACPI_REFCLASS_INDEX:
 
 				/*
 				 * The target type for the Index operator must be
@@ -965,7 +965,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 					return_desc->integer.value =
 					    temp_desc->buffer.
 					    pointer[operand[0]->reference.
-						    offset];
+						    value];
 					break;
 
 				case ACPI_TYPE_PACKAGE:
@@ -985,7 +985,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 				default:
 
 					ACPI_ERROR((AE_INFO,
-						    "Unknown Index TargetType %X in obj %p",
+						    "Unknown Index TargetType %X in reference object %p",
 						    operand[0]->reference.
 						    target_type, operand[0]));
 					status = AE_AML_OPERAND_TYPE;
@@ -993,7 +993,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 				}
 				break;
 
-			case AML_REF_OF_OP:
+			case ACPI_REFCLASS_REFOF:
 
 				return_desc = operand[0]->reference.object;
 
@@ -1013,9 +1013,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 
 			default:
 				ACPI_ERROR((AE_INFO,
-					    "Unknown opcode in reference(%p) - %X",
+					    "Unknown class in reference(%p) - %2.2X",
 					    operand[0],
-					    operand[0]->reference.opcode));
+					    operand[0]->reference.class));
 
 				status = AE_TYPE;
 				goto cleanup;
drivers/acpi/executer/exoparg2.c +2 -2
index 8e8bbb6..368def5 100644
@@ -391,8 +391,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
 		/* Initialize the Index reference object */
 
 		index = operand[1]->integer.value;
-		return_desc->reference.offset = (u32) index;
-		return_desc->reference.opcode = AML_INDEX_OP;
+		return_desc->reference.value = (u32) index;
+		return_desc->reference.class = ACPI_REFCLASS_INDEX;
 
 		/*
 		 * At this point, the Source operand is a String, Buffer, or Package.
drivers/acpi/executer/exresnte.c +6 -10
index 5596f42..423ad36 100644
@@ -46,8 +46,6 @@
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
-#include <acpi/acparser.h>
-#include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exresnte")
@@ -238,10 +236,10 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
 
 	case ACPI_TYPE_LOCAL_REFERENCE:
 
-		switch (source_desc->reference.opcode) {
-		case AML_LOAD_OP:	/* This is a ddb_handle */
-		case AML_REF_OF_OP:
-		case AML_INDEX_OP:
+		switch (source_desc->reference.class) {
+		case ACPI_REFCLASS_TABLE:	/* This is a ddb_handle */
+		case ACPI_REFCLASS_REFOF:
+		case ACPI_REFCLASS_INDEX:
 
 			/* Return an additional reference to the object */
 
@@ -253,10 +251,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
 			/* No named references are allowed here */
 
 			ACPI_ERROR((AE_INFO,
-				    "Unsupported Reference opcode %X (%s)",
-				    source_desc->reference.opcode,
-				    acpi_ps_get_opcode_name(source_desc->
-							    reference.opcode)));
+				    "Unsupported Reference type %X",
+				    source_desc->reference.class));
 
 			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
drivers/acpi/executer/exresolv.c +29 -31

166 lines not on this page · raw message

drivers/acpi/executer/exresop.c +22 -28

78 lines not on this page · raw message

drivers/acpi/executer/exstore.c +30 -27

122 lines not on this page · raw message

drivers/acpi/executer/exstoren.c +2 -1
index a6d2168..eef61a0 100644
@@ -121,7 +121,8 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
 		    (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) &&
 		    !((ACPI_GET_OBJECT_TYPE(source_desc) ==
 		       ACPI_TYPE_LOCAL_REFERENCE)
-		      && (source_desc->reference.opcode == AML_LOAD_OP))) {
+		      && (source_desc->reference.class ==
+			  ACPI_REFCLASS_TABLE))) {
 
 			/* Conversion successful but still not a valid type */
 
drivers/acpi/namespace/nsdump.c +1 -4
index 0ab2200..cc0ae39 100644
@@ -43,7 +43,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
-#include <acpi/acparser.h>
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsdump")
@@ -334,9 +333,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
 		case ACPI_TYPE_LOCAL_REFERENCE:
 
 			acpi_os_printf("[%s]\n",
-				       acpi_ps_get_opcode_name(obj_desc->
-							       reference.
-							       opcode));
+				       acpi_ut_get_reference_name(obj_desc));
 			break;
 
 		case ACPI_TYPE_BUFFER_FIELD:
drivers/acpi/namespace/nsxfeval.c +3 -4
index f3cc376..a085cc3 100644
@@ -45,7 +45,6 @@
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acinterp.h>
-#include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsxfeval")
@@ -399,13 +398,13 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
 	 * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to
 	 * an union acpi_object.
 	 */
-	switch (info->return_object->reference.opcode) {
-	case AML_INDEX_OP:
+	switch (info->return_object->reference.class) {
+	case ACPI_REFCLASS_INDEX:
 
 		obj_desc = *(info->return_object->reference.where);
 		break;
 
-	case AML_REF_OF_OP:
+	case ACPI_REFCLASS_REFOF:
 
 		node = info->return_object->reference.object;
 		if (node) {
drivers/acpi/resources/rscalc.c +2 -3
index d9063ea..8eaaecf 100644
@@ -43,7 +43,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
-#include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_RESOURCES
@@ -560,8 +559,8 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
 			      ACPI_GET_OBJECT_TYPE(*sub_object_list)) ||
 			     ((ACPI_TYPE_LOCAL_REFERENCE ==
 			       ACPI_GET_OBJECT_TYPE(*sub_object_list)) &&
-			      ((*sub_object_list)->reference.opcode ==
-			       AML_INT_NAMEPATH_OP)))) {
+			      ((*sub_object_list)->reference.class ==
+			       ACPI_REFCLASS_NAME)))) {
 				name_found = TRUE;
 			} else {
 				/* Look at the next element */
drivers/acpi/resources/rscreate.c +4 -6
index 7804a8c..c0bbfa2 100644
@@ -43,7 +43,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acresrc.h>
-#include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_RESOURCES
@@ -310,13 +309,12 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
 			switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
 			case ACPI_TYPE_LOCAL_REFERENCE:
 
-				if (obj_desc->reference.opcode !=
-				    AML_INT_NAMEPATH_OP) {
+				if (obj_desc->reference.class !=
+				    ACPI_REFCLASS_NAME) {
 					ACPI_ERROR((AE_INFO,
-						    "(PRT[%X].Source) Need name, found reference op %X",
+						    "(PRT[%X].Source) Need name, found Reference Class %X",
 						    index,
-						    obj_desc->reference.
-						    opcode));
+						    obj_desc->reference.class));
 					return_ACPI_STATUS(AE_BAD_DATA);
 				}
 
drivers/acpi/utilities/utcopy.c +16 -13
index 53499ac..5b2f7c2 100644
@@ -42,7 +42,6 @@
  */
 
 #include <acpi/acpi.h>
-#include <acpi/amlcode.h>
 #include <acpi/acnamesp.h>
 
 
@@ -176,20 +175,24 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
 
 		/* This is an object reference. */
 
-		switch (internal_object->reference.opcode) {
-		case AML_INT_NAMEPATH_OP:
-
-			/* For namepath, return the object handle ("reference") */
-
-		default:
-
-			/* We are referring to the namespace node */
+		switch (internal_object->reference.class) {
+		case ACPI_REFCLASS_NAME:
 
+			/*
+			 * For namepath, return the object handle ("reference")
+			 * We are referring to the namespace node
+			 */
 			external_object->reference.handle =
 			    internal_object->reference.node;
 			external_object->reference.actual_type =
 			    acpi_ns_get_type(internal_object->reference.node);
 			break;
+
+		default:
+
+			/* All other reference types are unsupported */
+
+			return_ACPI_STATUS(AE_TYPE);
 		}
 		break;
 
@@ -533,7 +536,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
 
 		/* TBD: should validate incoming handle */
 
-		internal_object->reference.opcode = AML_INT_NAMEPATH_OP;
+		internal_object->reference.class = ACPI_REFCLASS_NAME;
 		internal_object->reference.node =
 		    external_object->reference.handle;
 		break;
@@ -743,11 +746,11 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
 		 * We copied the reference object, so we now must add a reference
 		 * to the object pointed to by the reference
 		 *
-		 * DDBHandle reference (from Load/load_table is a special reference,
-		 * it's Reference.Object is the table index, so does not need to
+		 * DDBHandle reference (from Load/load_table) is a special reference,
+		 * it does not have a Reference.Object, so does not need to
 		 * increase the reference count
 		 */
-		if (source_desc->reference.opcode == AML_LOAD_OP) {
+		if (source_desc->reference.class == ACPI_REFCLASS_TABLE) {
 			break;
 		}
 
drivers/acpi/utilities/utdelete.c +2 -3
index 42609d3..5c21975 100644
@@ -45,7 +45,6 @@
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
 #include <acpi/acevents.h>
-#include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_UTILITIES
 ACPI_MODULE_NAME("utdelete")
@@ -548,8 +547,8 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
 			 * reference must track changes to the ref count of the index or
 			 * target object.
 			 */
-			if ((object->reference.opcode == AML_INDEX_OP) ||
-			    (object->reference.opcode == AML_INT_NAMEPATH_OP)) {
+			if ((object->reference.class == ACPI_REFCLASS_INDEX) ||
+			    (object->reference.class == ACPI_REFCLASS_NAME)) {
 				next_object = object->reference.object;
 			}
 			break;
drivers/acpi/utilities/utglobal.c +20 -15
index bcace57..0b1e493 100644
@@ -45,7 +45,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
-#include <acpi/amlcode.h>
 
 ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
 #define _COMPONENT          ACPI_UTILITIES
@@ -590,25 +589,31 @@ char *acpi_ut_get_descriptor_name(void *object)
 
 /* Printable names of reference object sub-types */
 
+static const char *acpi_gbl_ref_class_names[] = {
+	/* 00 */ "Local",
+	/* 01 */ "Argument",
+	/* 02 */ "RefOf",
+	/* 03 */ "Index",
+	/* 04 */ "DdbHandle",
+	/* 05 */ "Named Object",
+	/* 06 */ "Debug"
+};
+
 const char *acpi_ut_get_reference_name(union acpi_operand_object *object)
 {
+	if (!object)
+		return "NULL Object";
 
-	switch (object->reference.opcode) {
-	case AML_INT_NAMEPATH_OP:
-		return "Name";
+	if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND)
+		return "Not an Operand object";
 
-	case AML_LOAD_OP:
-		return "DDB-Handle";
+	if (object->common.type != ACPI_TYPE_LOCAL_REFERENCE)
+		return "Not a Reference object";
 
-	case AML_REF_OF_OP:
-		return "RefOf";
+	if (object->reference.class > ACPI_REFCLASS_MAX)
+		return "Unknown Reference class";
 
-	case AML_INDEX_OP:
-		return "Index";
-
-	default:
-		return "Unknown";
-	}
+	return acpi_gbl_ref_class_names[object->reference.class];
 }
 
 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
@@ -812,4 +817,4 @@ acpi_status acpi_ut_init_globals(void)
 }
 
 ACPI_EXPORT_SYMBOL(acpi_dbg_level)
-    ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
+ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
drivers/acpi/utilities/utobject.c +4 -5
index 924d05a..c354e7a 100644
@@ -43,7 +43,6 @@
 
 #include <acpi/acpi.h>
 #include <acpi/acnamesp.h>
-#include <acpi/amlcode.h>
 
 #define _COMPONENT          ACPI_UTILITIES
 ACPI_MODULE_NAME("utobject")
@@ -478,8 +477,8 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
 
 	case ACPI_TYPE_LOCAL_REFERENCE:
 
-		switch (internal_object->reference.opcode) {
-		case AML_INT_NAMEPATH_OP:
+		switch (internal_object->reference.class) {
+		case ACPI_REFCLASS_NAME:
 
 			/*
 			 * Get the actual length of the full pathname to this object.
@@ -504,9 +503,9 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
 			 */
 			ACPI_ERROR((AE_INFO,
 				    "Cannot convert to external object - "
-				    "unsupported Reference type [%s] %X in object %p",
+				    "unsupported Reference Class [%s] %X in object %p",
 				    acpi_ut_get_reference_name(internal_object),
-				    internal_object->reference.opcode,
+				    internal_object->reference.class,
 				    internal_object));
 			status = AE_TYPE;
 			break;
include/acpi/acdebug.h +4 -0
index c5a1b50..a4fb001 100644
@@ -123,6 +123,10 @@ void acpi_db_check_integrity(void);
 
 void acpi_db_generate_gpe(char *gpe_arg, char *block_arg);
 
+void acpi_db_check_predefined_names(void);
+
+void acpi_db_batch_execute(void);
+
 /*
  * dbdisply - debug display commands
  */
include/acpi/acdispat.h +3 -3
index 21a73a1..6291904 100644
@@ -157,7 +157,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number);
  * dsmthdat - method data (locals/args)
  */
 acpi_status
-acpi_ds_store_object_to_local(u16 opcode,
+acpi_ds_store_object_to_local(u8 type,
 			      u32 index,
 			      union acpi_operand_object *src_desc,
 			      struct acpi_walk_state *walk_state);
@@ -173,7 +173,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state);
 u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc);
 
 acpi_status
-acpi_ds_method_data_get_value(u16 opcode,
+acpi_ds_method_data_get_value(u8 type,
 			      u32 index,
 			      struct acpi_walk_state *walk_state,
 			      union acpi_operand_object **dest_desc);
@@ -184,7 +184,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
 			      struct acpi_walk_state *walk_state);
 
 acpi_status
-acpi_ds_method_data_get_node(u16 opcode,
+acpi_ds_method_data_get_node(u8 type,
 			     u32 index,
 			     struct acpi_walk_state *walk_state,
 			     struct acpi_namespace_node **node);
include/acpi/acobject.h +23 -8
index 7a8a652..eb6f038 100644
@@ -308,19 +308,34 @@ struct acpi_object_addr_handler {
  *****************************************************************************/
 
 /*
- * The Reference object type is used for these opcodes:
- * Arg[0-6], Local[0-7], index_op, name_op, zero_op, one_op, ones_op, debug_op
+ * The Reference object is used for these opcodes:
+ * Arg[0-6], Local[0-7], index_op, name_op, ref_of_op, load_op, load_table_op, debug_op
+ * The Reference.Class differentiates these types.
  */
 struct acpi_object_reference {
-	ACPI_OBJECT_COMMON_HEADER u8 target_type;	/* Used for index_op */
-	u16 opcode;
+	ACPI_OBJECT_COMMON_HEADER u8 class;	/* Reference Class */
+	u8 target_type;		/* Used for Index Op */
+	u8 reserved;
 	void *object;		/* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
-	struct acpi_namespace_node *node;
-	union acpi_operand_object **where;
-	u32 offset;		/* Used for arg_op, local_op, and index_op */
-	u32 value;		/* Used for ddb_handle */
+	struct acpi_namespace_node *node;	/* ref_of or Namepath */
+	union acpi_operand_object **where;	/* Target of Index */
+	u32 value;		/* Used for Local/Arg/Index/ddb_handle */
 };
 
+/* Values for Reference.Class above */
+
+typedef enum {
+	ACPI_REFCLASS_LOCAL = 0,	/* Method local */
+	ACPI_REFCLASS_ARG = 1,	/* Method argument */
+	ACPI_REFCLASS_REFOF = 2,	/* Result of ref_of() TBD: Split to Ref/Node and Ref/operand_obj? */
+	ACPI_REFCLASS_INDEX = 3,	/* Result of Index() */
+	ACPI_REFCLASS_TABLE = 4,	/* ddb_handle - Load(), load_table() */
+	ACPI_REFCLASS_NAME = 5,	/* Reference to a named object */
+	ACPI_REFCLASS_DEBUG = 6,	/* Debug object */
+
+	ACPI_REFCLASS_MAX = 6
+} ACPI_REFERENCE_CLASSES;
+
 /*
  * Extra object is used as additional storage for types that
  * have AML code in their declarations (term_args) that must be
Signature · 1 line
1.5.5.1
author reviewer
#107 lore raw

PATCH 107/122 ACPICA: Fix possible memory leak in acpi_ns_get_external_pathname

In reply to Len Brown

From: Bob Moore <[email protected]>

Fixes a memory leak in the error exit path.

---
 drivers/acpi/namespace/nsnames.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/acpi/namespace/nsnames.c +3 -2
index bd57738..9c587bd 100644
@@ -142,7 +142,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
 
 	size = acpi_ns_get_pathname_length(node);
 	if (!size) {
-		return (NULL);
+		return_PTR(NULL);
 	}
 
 	/* Allocate a buffer to be returned to caller */
@@ -157,7 +157,8 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
 
 	status = acpi_ns_build_external_path(node, size, name_buffer);
 	if (ACPI_FAILURE(status)) {
-		return (NULL);
+		ACPI_FREE(name_buffer);
+		return_PTR(NULL);
 	}
 
 	return_PTR(name_buffer);
Signature · 1 line
1.5.5.1
author reviewer
#108 lore raw

PATCH 108/122 ACPICA: Update version to 20080829

In reply to Len Brown

From: Bob Moore <[email protected]>

Update version to 20080829.

---
 include/acpi/acconfig.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acconfig.h +1 -1
index 4da88b1..2b737e5 100644
@@ -63,7 +63,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION 		0x20080729
+#define ACPI_CA_VERSION                 0x20080829
 
 /*
  * OS name, used for the _OS object.  The _OS object is essentially obsolete,
Signature · 1 line
1.5.5.1
author reviewer
#109 lore raw

PATCH 109/122 ACPICA: Remove unused ACPI register bit definition

In reply to Len Brown

From: Lin Ming <[email protected]>

Removed the ACPI_BITREG_WAKE_ENABLE definition and entry in the global register table. This bit does not exist and is unused.

http://www.acpica.org/bugzilla/show_bug.cgi?id=442

---
 drivers/acpi/utilities/utglobal.c |    1 -
 include/acpi/actypes.h            |   34 +++++++++++++++++++++++-----------
 2 files changed, 23 insertions(+), 12 deletions(-)
drivers/acpi/utilities/utglobal.c +0 -1
index 0b1e493..670551b 100644
@@ -281,7 +281,6 @@ struct acpi_bit_register_info acpi_gbl_bit_register_info[ACPI_NUM_BITREG] = {
 	/* ACPI_BITREG_RT_CLOCK_ENABLE      */ {ACPI_REGISTER_PM1_ENABLE,
 						ACPI_BITPOSITION_RT_CLOCK_ENABLE,
 						ACPI_BITMASK_RT_CLOCK_ENABLE},
-	/* ACPI_BITREG_WAKE_ENABLE          */ {ACPI_REGISTER_PM1_ENABLE, 0, 0},
 	/* ACPI_BITREG_PCIEXP_WAKE_DISABLE  */ {ACPI_REGISTER_PM1_ENABLE,
 						ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE,
 						ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
include/acpi/actypes.h +23 -11
index 6bd08e8..e8936ab 100644
@@ -607,8 +607,15 @@ typedef u8 acpi_adr_space_type;
 
 /*
  * bit_register IDs
- * These are bitfields defined within the full ACPI registers
+ *
+ * These values are intended to be used by the hardware interfaces
+ * and are mapped to individual bitfields defined within the ACPI
+ * registers. See the acpi_gbl_bit_register_info global table in utglobal.c
+ * for this mapping.
  */
+
+/* PM1 Status register */
+
 #define ACPI_BITREG_TIMER_STATUS                0x00
 #define ACPI_BITREG_BUS_MASTER_STATUS           0x01
 #define ACPI_BITREG_GLOBAL_LOCK_STATUS          0x02
@@ -618,24 +625,29 @@ typedef u8 acpi_adr_space_type;
 #define ACPI_BITREG_WAKE_STATUS                 0x06
 #define ACPI_BITREG_PCIEXP_WAKE_STATUS          0x07
 
+/* PM1 Enable register */
+
 #define ACPI_BITREG_TIMER_ENABLE                0x08
 #define ACPI_BITREG_GLOBAL_LOCK_ENABLE          0x09
 #define ACPI_BITREG_POWER_BUTTON_ENABLE         0x0A
 #define ACPI_BITREG_SLEEP_BUTTON_ENABLE         0x0B
 #define ACPI_BITREG_RT_CLOCK_ENABLE             0x0C
-#define ACPI_BITREG_WAKE_ENABLE                 0x0D
-#define ACPI_BITREG_PCIEXP_WAKE_DISABLE         0x0E
+#define ACPI_BITREG_PCIEXP_WAKE_DISABLE         0x0D
+
+/* PM1 Control register */
+
+#define ACPI_BITREG_SCI_ENABLE                  0x0E
+#define ACPI_BITREG_BUS_MASTER_RLD              0x0F
+#define ACPI_BITREG_GLOBAL_LOCK_RELEASE         0x10
+#define ACPI_BITREG_SLEEP_TYPE_A                0x11
+#define ACPI_BITREG_SLEEP_TYPE_B                0x12
+#define ACPI_BITREG_SLEEP_ENABLE                0x13
 
-#define ACPI_BITREG_SCI_ENABLE                  0x0F
-#define ACPI_BITREG_BUS_MASTER_RLD              0x10
-#define ACPI_BITREG_GLOBAL_LOCK_RELEASE         0x11
-#define ACPI_BITREG_SLEEP_TYPE_A                0x12
-#define ACPI_BITREG_SLEEP_TYPE_B                0x13
-#define ACPI_BITREG_SLEEP_ENABLE                0x14
+/* PM2 Control register */
 
-#define ACPI_BITREG_ARB_DISABLE                 0x15
+#define ACPI_BITREG_ARB_DISABLE                 0x14
 
-#define ACPI_BITREG_MAX                         0x15
+#define ACPI_BITREG_MAX                         0x14
 #define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
 
 /*
Signature · 1 line
1.5.5.1
author reviewer
#110 lore raw

PATCH 110/122 ACPICA: Fix fault after mem allocation failure in AML parser

In reply to Len Brown

From: Lin Ming <[email protected]>

Fixes a crash if a memory allocation fails during the Op completion routine acpi_ps_complete_this_op().

http://www.acpica.org/bugzilla/show_bug.cgi?id=492

---
 drivers/acpi/parser/psparse.c |   28 +++++++++++-----------------
 1 files changed, 11 insertions(+), 17 deletions(-)
drivers/acpi/parser/psparse.c +11 -17
index 15e1702..52caaf6 100644
@@ -137,6 +137,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
 	union acpi_parse_object *next;
 	const struct acpi_opcode_info *parent_info;
 	union acpi_parse_object *replacement_op = NULL;
+	acpi_status status = AE_OK;
 
 	ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op);
 
@@ -186,7 +187,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
 			replacement_op =
 			    acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
 			if (!replacement_op) {
-				goto allocate_error;
+				status = AE_NO_MEMORY;
 			}
 			break;
 
@@ -211,7 +212,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
 				replacement_op =
 				    acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
 				if (!replacement_op) {
-					goto allocate_error;
+					status = AE_NO_MEMORY;
 				}
 			} else
 			    if ((op->common.parent->common.aml_opcode ==
@@ -226,13 +227,13 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
 					    acpi_ps_alloc_op(op->common.
 							     aml_opcode);
 					if (!replacement_op) {
-						goto allocate_error;
+						status = AE_NO_MEMORY;
+					} else {
+						replacement_op->named.data =
+						    op->named.data;
+						replacement_op->named.length =
+						    op->named.length;
 					}
-
-					replacement_op->named.data =
-					    op->named.data;
-					replacement_op->named.length =
-					    op->named.length;
 				}
 			}
 			break;
@@ -242,7 +243,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
 			replacement_op =
 			    acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
 			if (!replacement_op) {
-				goto allocate_error;
+				status = AE_NO_MEMORY;
 			}
 		}
 
@@ -302,14 +303,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
 	/* Now we can actually delete the subtree rooted at Op */
 
 	acpi_ps_delete_parse_tree(op);
-	return_ACPI_STATUS(AE_OK);
-
-      allocate_error:
-
-	/* Always delete the subtree, even on error */
-
-	acpi_ps_delete_parse_tree(op);
-	return_ACPI_STATUS(AE_NO_MEMORY);
+	return_ACPI_STATUS(status);
 }
 
 /*******************************************************************************
Signature · 1 line
1.5.5.1
author reviewer
#111 lore raw

PATCH 111/122 ACPICA: Fix possible memory leak, error exit path

In reply to Len Brown

From: Lin Ming <[email protected]>

Fixed two possible memory leaks in the error exit paths of acpi_ut_update_objerct_reference() and acpi_ut_walk_package_tree()
These functions are similar in that they use a stack of state objects in order to eliminate recursion. The stack must be fully deallocated if an error occurs.

http://www.acpica.org/bugzilla/show_bug.cgi?id=383

---
 drivers/acpi/utilities/utdelete.c |    7 +++++++
 drivers/acpi/utilities/utmisc.c   |    9 +++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
drivers/acpi/utilities/utdelete.c +7 -0
index 5c21975..d197c6b 100644
@@ -585,6 +585,13 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
 	ACPI_EXCEPTION((AE_INFO, status,
 			"Could not update object reference count"));
 
+	/* Free any stacked Update State objects */
+
+	while (state_list) {
+		state = acpi_ut_pop_generic_state(&state_list);
+		acpi_ut_delete_generic_state(state);
+	}
+
 	return_ACPI_STATUS(status);
 }
 
drivers/acpi/utilities/utmisc.c +9 -0
index f34be67..9089a15 100644
@@ -995,6 +995,15 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object,
 							 state->pkg.
 							 this_target_obj, 0);
 			if (!state) {
+
+				/* Free any stacked Update State objects */
+
+				while (state_list) {
+					state =
+					    acpi_ut_pop_generic_state
+					    (&state_list);
+					acpi_ut_delete_generic_state(state);
+				}
 				return_ACPI_STATUS(AE_NO_MEMORY);
 			}
 		}
Signature · 1 line
1.5.5.1
author reviewer
#112 lore raw

PATCH 112/122 ACPICA: Optimize buffer allocation procedure

In reply to Len Brown

From: Bob Moore <[email protected]>

Eliminate duplicate code.

---
 drivers/acpi/utilities/utalloc.c |   53 ++++++++++++++++++++------------------
 1 files changed, 28 insertions(+), 25 deletions(-)
drivers/acpi/utilities/utalloc.c +28 -25
index 7dcb67e..241c535 100644
@@ -232,7 +232,7 @@ acpi_status acpi_ut_validate_buffer(struct acpi_buffer * buffer)
  * RETURN:      Status
  *
  * DESCRIPTION: Validate that the buffer is of the required length or
- *              allocate a new buffer.  Returned buffer is always zeroed.
+ *              allocate a new buffer. Returned buffer is always zeroed.
  *
  ******************************************************************************/
 
@@ -240,7 +240,7 @@ acpi_status
 acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
 			  acpi_size required_length)
 {
-	acpi_status status = AE_OK;
+	acpi_size input_buffer_length;
 
 	/* Parameter validation */
 
@@ -248,55 +248,58 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
 		return (AE_BAD_PARAMETER);
 	}
 
-	switch (buffer->length) {
+	/*
+	 * Buffer->Length is used as both an input and output parameter. Get the
+	 * input actual length and set the output required buffer length.
+	 */
+	input_buffer_length = buffer->length;
+	buffer->length = required_length;
+
+	/*
+	 * The input buffer length contains the actual buffer length, or the type
+	 * of buffer to be allocated by this routine.
+	 */
+	switch (input_buffer_length) {
 	case ACPI_NO_BUFFER:
 
-		/* Set the exception and returned the required length */
+		/* Return the exception (and the required buffer length) */
 
-		status = AE_BUFFER_OVERFLOW;
-		break;
+		return (AE_BUFFER_OVERFLOW);
 
 	case ACPI_ALLOCATE_BUFFER:
 
 		/* Allocate a new buffer */
 
 		buffer->pointer = acpi_os_allocate(required_length);
-		if (!buffer->pointer) {
-			return (AE_NO_MEMORY);
-		}
-
-		/* Clear the buffer */
-
-		ACPI_MEMSET(buffer->pointer, 0, required_length);
 		break;
 
 	case ACPI_ALLOCATE_LOCAL_BUFFER:
 
 		/* Allocate a new buffer with local interface to allow tracking */
 
-		buffer->pointer = ACPI_ALLOCATE_ZEROED(required_length);
-		if (!buffer->pointer) {
-			return (AE_NO_MEMORY);
-		}
+		buffer->pointer = ACPI_ALLOCATE(required_length);
 		break;
 
 	default:
 
 		/* Existing buffer: Validate the size of the buffer */
 
-		if (buffer->length < required_length) {
-			status = AE_BUFFER_OVERFLOW;
-			break;
+		if (input_buffer_length < required_length) {
+			return (AE_BUFFER_OVERFLOW);
 		}
+		break;
+	}
 
-		/* Clear the buffer */
+	/* Validate allocation from above or input buffer pointer */
 
-		ACPI_MEMSET(buffer->pointer, 0, required_length);
-		break;
+	if (!buffer->pointer) {
+		return (AE_NO_MEMORY);
 	}
 
-	buffer->length = required_length;
-	return (status);
+	/* Have a valid buffer, clear it */
+
+	ACPI_MEMSET(buffer->pointer, 0, required_length);
+	return (AE_OK);
 }
 
 #ifdef NOT_USED_BY_LINUX
Signature · 1 line
1.5.5.1
author reviewer
#113 lore raw

PATCH 113/122 ACPICA: Fixed a couple memory leaks associated with "implicit return"

In reply to Len Brown

From: Lin Ming <[email protected]>

Fixed a couple memory leaks associated with "implicit return" objects when the AML Interpreter slack mode is enabled.

http://www.acpica.org/bugzilla/show_bug.cgi?id=349

---
 drivers/acpi/dispatcher/dsmethod.c |    3 +++
 drivers/acpi/parser/psparse.c      |    4 +++-
 2 files changed, 6 insertions(+), 1 deletions(-)
drivers/acpi/dispatcher/dsmethod.c +3 -0
index 4613b9c..279a5a6 100644
@@ -103,6 +103,9 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
 						    NULL);
 		acpi_ex_enter_interpreter();
 	}
+
+	acpi_ds_clear_implicit_return(walk_state);
+
 #ifdef ACPI_DISASSEMBLER
 	if (ACPI_FAILURE(status)) {
 
drivers/acpi/parser/psparse.c +3 -1
index 52caaf6..68e932f 100644
@@ -635,10 +635,12 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
 					    ACPI_WALK_METHOD_RESTART;
 				}
 			} else {
-				/* On error, delete any return object */
+				/* On error, delete any return object or implicit return */
 
 				acpi_ut_remove_reference(previous_walk_state->
 							 return_desc);
+				acpi_ds_clear_implicit_return
+				    (previous_walk_state);
 			}
 		}
 
Signature · 1 line
1.5.5.1
author reviewer
#114 lore raw

PATCH 114/122 ACPICA: Fix for implicit return compatibility

In reply to Len Brown

From: Lin Ming <[email protected]>

Predicate can be used for an implicit return value. This change improves the implicit return mechanism to be more compatible with the MS interpreter.

http://www.acpica.org/bugzilla/show_bug.cgi?id=349

Below AML code from http://bugzilla.kernel.org/show_bug.cgi?id=10686

	Store(0x07D6, OSYS)
	Method (_CRT, 0, Serialized)
	{
	    If (LLess (OSYS, 0x07D6))
	    {
		If (LEqual (\_SB.TJ85, Zero))
		{
		    Return (Add (0x0AAC, Multiply (TPC, 0x0A)))
		}
		Else
		{
		    Return (Add (0x0AAC, Multiply (TP85, 0x0A)))
		}
	    }
	}

Previously _CRT returns 0x07D6, now it returns 0 (predicate value of LLess)

---
 drivers/acpi/dispatcher/dswexec.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/acpi/dispatcher/dswexec.c +4 -0
index 5b24191..396fe12 100644
@@ -166,6 +166,10 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
 		status = AE_CTRL_FALSE;
 	}
 
+	/* Predicate can be used for an implicit return value */
+
+	(void)acpi_ds_do_implicit_return(local_obj_desc, walk_state, TRUE);
+
       cleanup:
 
 	ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
Signature · 1 line
1.5.5.1
author reviewer
#115 lore raw

PATCH 115/122 ACPICA: New: Validation for predefined ACPI methods/objects

In reply to Len Brown

From: Bob Moore <[email protected]>

Validates predefined ACPI objects that appear in the namespace, at the time they are evaluated. The argument count and the type of the returned object are validated. The purpose of this validation is to detect problems with the BIOS-exposed predefined ACPI objects before the results are returned to the ACPI-related drivers.

---
 drivers/acpi/namespace/Makefile   |    2 +-
 drivers/acpi/namespace/nseval.c   |   35 ++-
 drivers/acpi/namespace/nsnames.c  |    2 -
 drivers/acpi/namespace/nspredef.c |  900 +++++++++++++++++++++++++++++++++++++
 include/acpi/acdebug.h            |    4 +
 include/acpi/aclocal.h            |   77 ++++
 include/acpi/acnamesp.h           |   16 +
 include/acpi/acpredef.h           |  371 +++++++++++++++
 8 files changed, 1401 insertions(+), 6 deletions(-)
 create mode 100644 drivers/acpi/namespace/nspredef.c
 create mode 100644 include/acpi/acpredef.h
drivers/acpi/namespace/Makefile +1 -1
index 3f63d36..371a2da 100644
@@ -5,7 +5,7 @@
 obj-y := nsaccess.o  nsload.o    nssearch.o  nsxfeval.o \
 	 nsalloc.o   nseval.o    nsnames.o   nsutils.o   nsxfname.o \
 	 nsdump.o    nsinit.o    nsobject.o  nswalk.o    nsxfobj.o  \
-	 nsparse.o
+	 nsparse.o   nspredef.o
 
 obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o
 
drivers/acpi/namespace/nseval.c +32 -3
index 42dae12..4cdf03a 100644
@@ -78,6 +78,7 @@ ACPI_MODULE_NAME("nseval")
 acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
 {
 	acpi_status status;
+	struct acpi_namespace_node *node;
 
 	ACPI_FUNCTION_TRACE(ns_evaluate);
 
@@ -117,6 +118,8 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
 			  info->resolved_node,
 			  acpi_ns_get_attached_object(info->resolved_node)));
 
+	node = info->resolved_node;
+
 	/*
 	 * Two major cases here:
 	 *
@@ -261,9 +264,35 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
 		}
 	}
 
-	/*
-	 * Check if there is a return value that must be dealt with
-	 */
+	/* Validation of return values for ACPI-predefined methods and objects */
+
+	if ((status == AE_OK) || (status == AE_CTRL_RETURN_VALUE)) {
+		/*
+		 * If this is the first evaluation, check the return value. This
+		 * ensures that any warnings will only be emitted during the very
+		 * first evaluation of the object.
+		 */
+		if (!(node->flags & ANOBJ_EVALUATED)) {
+			/*
+			 * Check for a predefined ACPI name. If found, validate the
+			 * returned object.
+			 *
+			 * Note: Ignore return status for now, emit warnings if there are
+			 * problems with the returned object. May change later to abort
+			 * the method on invalid return object.
+			 */
+			(void)acpi_ns_check_predefined_names(node,
+							     info->
+							     return_object);
+		}
+
+		/* Mark the node as having been evaluated */
+
+		node->flags |= ANOBJ_EVALUATED;
+	}
+
+	/* Check if there is a return value that must be dealt with */
+
 	if (status == AE_CTRL_RETURN_VALUE) {
 
 		/* If caller does not want the return value, delete it */
drivers/acpi/namespace/nsnames.c +0 -2
index 9c587bd..42a39a7 100644
@@ -115,7 +115,6 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node,
 	return (AE_OK);
 }
 
-#ifdef ACPI_DEBUG_OUTPUT
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ns_get_external_pathname
@@ -163,7 +162,6 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
 
 	return_PTR(name_buffer);
 }
-#endif
 
 /*******************************************************************************
  *
drivers/acpi/namespace/nspredef.c new file +900 -0

900 lines not on this page · raw message

include/acpi/acdebug.h +4 -0
index a4fb001..62c59df 100644
@@ -154,6 +154,10 @@ void
 acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
 				struct acpi_walk_state *walk_state);
 
+void acpi_db_check_predefined_names(void);
+
+void acpi_db_batch_execute(void);
+
 /*
  * dbexec - debugger control method execution
  */
include/acpi/aclocal.h +77 -0

89 lines not on this page · raw message

include/acpi/acnamesp.h +16 -0
index c340085..db4e6f6 100644
@@ -178,6 +178,22 @@ acpi_ns_dump_objects(acpi_object_type type,
 acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
 
 /*
+ * nspredef - Support for predefined/reserved names
+ */
+acpi_status
+acpi_ns_check_predefined_names(struct acpi_namespace_node *node,
+			       union acpi_operand_object *return_object);
+
+const union acpi_predefined_info *acpi_ns_check_for_predefined_name(struct
+								    acpi_namespace_node
+								    *node);
+
+void
+acpi_ns_check_parameter_count(char *pathname,
+			      struct acpi_namespace_node *node,
+			      const union acpi_predefined_info *info);
+
+/*
  * nsnames - Name and Scope manipulation
  */
 u32 acpi_ns_opens_scope(acpi_object_type type);
include/acpi/acpredef.h new file +371 -0

371 lines not on this page · raw message

Signature · 1 line
1.5.5.1
author reviewer
#116 lore raw

PATCH 116/122 ACPICA: Add support for zero-length buffer-to-string conversions

In reply to Len Brown

From: Bob Moore <[email protected]>

Allow zero length strings during interpreter buffer-to-string conversions. For example, during the ToDecimalString and ToHexString operaters, as well as implicit conversions. Fiodor Suietov. ACPICA BZ 585.

http://www.acpica.org/bugzilla/show_bug.cgi?id=585

---
 drivers/acpi/executer/exconvrt.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
drivers/acpi/executer/exconvrt.c +9 -2
index 890378e..1d1f35a 100644
@@ -512,9 +512,14 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
 		/*
 		 * Create a new string object and string buffer
 		 * (-1 because of extra separator included in string_length from above)
+		 * Allow creation of zero-length strings from zero-length buffers.
 		 */
+		if (string_length) {
+			string_length--;
+		}
+
 		return_desc = acpi_ut_create_string_object((acpi_size)
-							   (string_length - 1));
+							   string_length);
 		if (!return_desc) {
 			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
@@ -537,7 +542,9 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
 		 * Null terminate the string
 		 * (overwrites final comma/space from above)
 		 */
-		new_buf--;
+		if (obj_desc->buffer.length) {
+			new_buf--;
+		}
 		*new_buf = 0;
 		break;
 
Signature · 1 line
1.5.5.1
author reviewer
#117 lore raw

PATCH 117/122 ACPICA: Update version to 20080926

In reply to Len Brown

From: Bob Moore <[email protected]>

Update version to 20080926.

---
 include/acpi/acconfig.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/acconfig.h +1 -1
index 2b737e5..29feee2 100644
@@ -63,7 +63,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20080829
+#define ACPI_CA_VERSION                 0x20080926
 
 /*
  * OS name, used for the _OS object.  The _OS object is essentially obsolete,
Signature · 1 line
1.5.5.1
author reviewer
#118 lore raw

PATCH 118/122 panasonic-laptop: fix build

In reply to Len Brown

From: Len Brown <[email protected]>

sync with acpi_driver_data(device)
and acpi_evaluate_integer(..., long long)
changes that happened since this driver
was checked in.

---
 drivers/misc/panasonic-laptop.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/misc/panasonic-laptop.c +3 -3
index 9aecda5..a2cb598 100644
@@ -252,7 +252,7 @@ static int acpi_pcc_write_sset(struct pcc_acpi *pcc, int func, int val)
 
 static inline int acpi_pcc_get_sqty(struct acpi_device *device)
 {
-	unsigned long s;
+	unsigned long long s;
 	acpi_status status;
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_get_sqty");
@@ -500,7 +500,7 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 	struct input_dev *hotk_input_dev = pcc->input_dev;
 	int rc;
 	int key_code, hkey_num;
-	unsigned long result;
+	unsigned long long result;
 
 	ACPI_FUNCTION_TRACE("acpi_pcc_generate_keyinput");
 
@@ -645,7 +645,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
 	pcc->device = device;
 	pcc->handle = device->handle;
 	pcc->num_sifr = num_sifr;
-	acpi_driver_data(device) = pcc;
+	device->driver_data = pcc;
 	strcpy(acpi_device_name(device), ACPI_PCC_DEVICE_NAME);
 	strcpy(acpi_device_class(device), ACPI_PCC_CLASS);
 
Signature · 1 line
1.5.5.1
author reviewer
#119 lore raw

PATCH 119/122 intel_menlo: fix build warning

In reply to Len Brown

From: Len Brown <[email protected]>

drivers/misc/intel_menlow.c:107: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘long long unsigned int’

---
 drivers/misc/intel_menlow.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/misc/intel_menlow.c +1 -1
index a782743..e00a275 100644
@@ -104,7 +104,7 @@ static int memory_get_cur_bandwidth(struct thermal_cooling_device *cdev,
 	if (ACPI_FAILURE(status))
 		return -EFAULT;
 
-	return sprintf(buf, "%ld\n", value);
+	return sprintf(buf, "%llu\n", value);
 }
 
 static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev,
Signature · 6 lines
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author reviewer
#120 lore raw

PATCH 120/122 ACPI suspend: fix build warning when CONFIG_ACPI_SLEEP=n

In reply to Len Brown

From: Len Brown <[email protected]>

drivers/acpi/sleep/main.c:27: warning: ‘acpi_target_sleep_state’ defined but not used

---
 drivers/acpi/sleep/main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/sleep/main.c +1 -1
index 7603788..26571ba 100644
@@ -24,7 +24,6 @@
 #include "sleep.h"
 
 u8 sleep_states[ACPI_S_STATE_COUNT];
-static u32 acpi_target_sleep_state = ACPI_STATE_S0;
 
 static void acpi_sleep_tts_switch(u32 acpi_state)
 {
@@ -78,6 +77,7 @@ static int acpi_sleep_prepare(u32 acpi_state)
 }
 
 #ifdef CONFIG_ACPI_SLEEP
+static u32 acpi_target_sleep_state = ACPI_STATE_S0;
 /*
  * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the
  * user to request that behavior by using the 'acpi_old_suspend_ordering'
Signature · 6 lines
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#121 lore raw

PATCH 1/1 ACPI suspend: Fox compilation for ACPI_SLEEP unset and XEN_SAVE_RESTORE set

Quoted 3 lines · Len Brown

From: Len Brown <[email protected]>

drivers/acpi/sleep/main.c:27: warning: ‘acpi_target_sleep_state’ defined but not used

Er, wrong.

This breaks compilation for ACPI_SLEEP=n and XEN_SAVE_RESTORE=y.

The patch below fixes the breakage.

Quoted 18 lines
---
 drivers/acpi/sleep/main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/sleep/main.c +0 -1
index 7603788..26571ba 100644
@@ -24,7 +24,6 @@
 #include "sleep.h"
 
 u8 sleep_states[ACPI_S_STATE_COUNT];
-static u32 acpi_target_sleep_state = ACPI_STATE_S0;
 
 static void acpi_sleep_tts_switch(u32 acpi_state)
 {

drivers/acpi/sleep/main.c static int acpi_sleep_prepare(u32 acpi_state) · line 83

Quoted 7 lines
drivers/acpi/sleep/main.c +1 -0
@@ -78,6 +77,7 @@ static int acpi_sleep_prepare(u32 acpi_state)
 }
 
 #ifdef CONFIG_ACPI_SLEEP
+static u32 acpi_target_sleep_state = ACPI_STATE_S0;
 /*
  * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the
  * user to request that behavior by using the 'acpi_old_suspend_ordering'

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

ACPI suspend: Fox compilation for ACPI_SLEEP unset and XEN_SAVE_RESTORE set

---
 drivers/acpi/sleep/main.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/sleep/main.c +2 -0
Index: linux-2.6/drivers/acpi/sleep/main.c
===================================================================
@@ -163,6 +163,8 @@ static void acpi_pm_end(void)
 	acpi_target_sleep_state = ACPI_STATE_S0;
 	acpi_sleep_tts_switch(acpi_target_sleep_state);
 }
+#else /* !CONFIG_ACPI_SLEEP */
+#define acpi_target_sleep_state	ACPI_STATE_S0
 #endif /* CONFIG_ACPI_SLEEP */
 
 #ifdef CONFIG_SUSPEND

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author reviewer
#122 lore raw

PATCH 121/122 ACPI: hack around sysfs warning with link order

In reply to Len Brown

From: Zhao Yakui <[email protected]>

There exists the following warning message will appear after the
following commit is merged.

Quoted 4 lines

commit f2e969acd6d5981e6b1272810002558650d0736e
Author: Zhao Yakui <[email protected]>
Date: Mon Aug 11 14:57:50 2008 +0800
ACPI: Add "acpi.power_nocheck=1" to disable power state check in

power transition:

Quoted 3 lines
WARNING: at linux-2.6/fs/sysfs/dir.c:463  sysfs_add_one+0x33/0x39()

sysfs: duplicate filename 'acpi' can not be created kobject_add_internal failed for acpi with -EEXIST, don't try to register

things with the same name in the same directory

In the above commit the "acpi.power_nocheck" module parameter is defined
in drivers/acpi/power.c file. As several module parameters using the same ACPI prefix are defined in the different files(for example: power_nocheck is defined in drivers/acpi/power.c,debug_layer/debug_level are defined in drivers/acpi/debug.c) and there exists another module between them, the warning message will be printed when using the current generic param code. (In the function of param_sysfs_init).

In fact when ACPI is selected, the drivers/acpi/power will also be compiled
as built-in kernel.So this issue can be fixed by the following approach.
workaround it by adjusting the module link order in drivers/acpi/Makefile.
In such case the module parameter using the same prefix(ACPI) are put together in the param data section.

Of course the better solution is to fix it in generic param code related
with sysfs.

---
 drivers/acpi/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/Makefile +1 -1
index ad4bfd5..d91c027 100644
@@ -48,10 +48,10 @@ obj-$(CONFIG_ACPI_DOCK)		+= dock.o
 obj-$(CONFIG_ACPI_VIDEO)	+= video.o
 obj-y				+= pci_root.o pci_link.o pci_irq.o pci_bind.o
 obj-$(CONFIG_ACPI_PCI_SLOT)	+= pci_slot.o
-obj-$(CONFIG_ACPI_POWER)	+= power.o
 obj-$(CONFIG_ACPI_PROCESSOR)	+= processor.o
 obj-$(CONFIG_ACPI_CONTAINER)	+= container.o
 obj-$(CONFIG_ACPI_THERMAL)	+= thermal.o
+obj-$(CONFIG_ACPI_POWER)	+= power.o
 obj-$(CONFIG_ACPI_SYSTEM)	+= system.o event.o
 obj-$(CONFIG_ACPI_DEBUG)	+= debug.o
 obj-$(CONFIG_ACPI_NUMA)		+= numa.o
Signature · 1 line
1.5.5.1
author reviewer
#123 lore raw

PATCH 122/122 ACPI: fix ia64 build warning

In reply to Len Brown

From: Len Brown <[email protected]>

arch/ia64/sn/kernel/io_acpi_init.c:361: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 3 has type ‘long long unsigned int’

---
 arch/ia64/sn/kernel/io_acpi_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/ia64/sn/kernel/io_acpi_init.c +1 -1
index a15baac..bc610a6 100644
@@ -357,7 +357,7 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info,
         if (ACPI_SUCCESS(status)) {
 		if (segment != pci_domain_nr(dev)) {
 			printk(KERN_ERR
-			       "%s: Segment number mismatch, 0x%lx vs 0x%x for: ",
+			       "%s: Segment number mismatch, 0x%llx vs 0x%x for: ",
 			       __func__, segment, pci_domain_nr(dev));
 			acpi_ns_print_node_pathname(rootbus_handle, NULL);
 			printk("\n");
Signature · 6 lines
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html