ACPICA 20050408 from Bob Moore

Fixed three cases in the interpreter where an "index"
argument to an ASL function was still (internally) 32
bits instead of the required 64 bits.  This was the Index
argument to the Index, Mid, and Match operators.

The "strupr" function is now permanently local
(acpi_ut_strupr), since this is not a POSIX-defined
function and not present in most kernel-level C
libraries. References to the C library strupr function
have been removed from the headers.

Completed the deployment of static
functions/prototypes. All prototypes with the static
attribute have been moved from the headers to the owning
C file.

ACPICA 20050329 from Bob Moore

An error is now generated if an attempt is made to create
a Buffer Field of length zero (A CreateField with a length
operand of zero.)

The interpreter now issues a warning whenever executable
code at the module level is detected during ACPI table
load. This will give some idea of the prevalence of this
type of code.

Implemented support for references to named objects (other
than control methods) within package objects.

Enhanced package object output for the debug
object. Package objects are now completely dumped, showing
all elements.

Enhanced miscellaneous object output for the debug
object. Any object can now be written to the debug object
(for example, a device object can be written, and the type
of the object will be displayed.)

The "static" qualifier has been added to all local
functions across the core subsystem.

The number of "long" lines (> 80 chars) within the source
has been significantly reduced, by about 1/3.

Cleaned up all header files to ensure that all CA/iASL
functions are prototyped (even static functions) and the
formatting is consistent.

Two new header files have been added, acopcode.h and
acnames.h.

Removed several obsolete functions that were no longer
used.

Signed-off-by: Len Brown <len.brown@intel.com>
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c
index 75da76c..c53b82e 100644
--- a/drivers/acpi/namespace/nsutils.c
+++ b/drivers/acpi/namespace/nsutils.c
@@ -51,6 +51,18 @@
 #define _COMPONENT          ACPI_NAMESPACE
 	 ACPI_MODULE_NAME    ("nsutils")
 
+/* Local prototypes */
+
+static u8
+acpi_ns_valid_path_separator (
+	char                            sep);
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+acpi_name
+acpi_ns_find_parent_name (
+	struct acpi_namespace_node      *node_to_search);
+#endif
+
 
 /*******************************************************************************
  *
@@ -59,7 +71,8 @@
  * PARAMETERS:  module_name         - Caller's module name (for error output)
  *              line_number         - Caller's line number (for error output)
  *              component_id        - Caller's component ID (for error output)
- *              Message             - Error message to use on failure
+ *              internal_name       - Name or path of the namespace node
+ *              lookup_status       - Exception code from NS lookup
  *
  * RETURN:      None
  *
@@ -121,6 +134,9 @@
  *              line_number         - Caller's line number (for error output)
  *              component_id        - Caller's component ID (for error output)
  *              Message             - Error message to use on failure
+ *              prefix_node         - Prefix relative to the path
+ *              Path                - Path to the node
+ *              method_status       - Execution status
  *
  * RETURN:      None
  *
@@ -161,8 +177,8 @@
  *
  * FUNCTION:    acpi_ns_print_node_pathname
  *
- * PARAMETERS:  Node                - Object
- *              Msg                 - Prefix message
+ * PARAMETERS:  Node            - Object
+ *              Message         - Prefix message
  *
  * DESCRIPTION: Print an object's full namespace pathname
  *              Manages allocation/freeing of a pathname buffer
@@ -172,7 +188,7 @@
 void
 acpi_ns_print_node_pathname (
 	struct acpi_namespace_node      *node,
-	char                            *msg)
+	char                            *message)
 {
 	struct acpi_buffer              buffer;
 	acpi_status                     status;
@@ -189,8 +205,8 @@
 
 	status = acpi_ns_handle_to_pathname (node, &buffer);
 	if (ACPI_SUCCESS (status)) {
-		if (msg) {
-			acpi_os_printf ("%s ", msg);
+		if (message) {
+			acpi_os_printf ("%s ", message);
 		}
 
 		acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node);
@@ -224,7 +240,7 @@
  *
  * FUNCTION:    acpi_ns_valid_path_separator
  *
- * PARAMETERS:  Sep              - Character to be checked
+ * PARAMETERS:  Sep         - Character to be checked
  *
  * RETURN:      TRUE if a valid path separator
  *
@@ -232,7 +248,7 @@
  *
  ******************************************************************************/
 
-u8
+static u8
 acpi_ns_valid_path_separator (
 	char                            sep)
 {
@@ -245,10 +261,12 @@
  *
  * FUNCTION:    acpi_ns_get_type
  *
- * PARAMETERS:  Handle              - Parent Node to be examined
+ * PARAMETERS:  Node        - Parent Node to be examined
  *
  * RETURN:      Type field from Node whose handle is passed
  *
+ * DESCRIPTION: Return the type of a Namespace node
+ *
  ******************************************************************************/
 
 acpi_object_type
@@ -271,11 +289,13 @@
  *
  * FUNCTION:    acpi_ns_local
  *
- * PARAMETERS:  Type            - A namespace object type
+ * PARAMETERS:  Type        - A namespace object type
  *
  * RETURN:      LOCAL if names must be found locally in objects of the
  *              passed type, 0 if enclosing scopes should be searched
  *
+ * DESCRIPTION: Returns scope rule for the given object type.
+ *
  ******************************************************************************/
 
 u32
@@ -303,7 +323,7 @@
  * PARAMETERS:  Info            - Info struct initialized with the
  *                                external name pointer.
  *
- * RETURN:      Status
+ * RETURN:      None
  *
  * DESCRIPTION: Calculate the length of the internal (AML) namestring
  *              corresponding to the external (ASL) namestring.
@@ -551,14 +571,16 @@
  *
  * FUNCTION:    acpi_ns_externalize_name
  *
- * PARAMETERS:  *internal_name         - Internal representation of name
- *              **converted_name       - Where to return the resulting
- *                                       external representation of name
+ * PARAMETERS:  internal_name_length - Lenth of the internal name below
+ *              internal_name       - Internal representation of name
+ *              converted_name_length - Where the length is returned
+ *              converted_name      - Where the resulting external name
+ *                                    is returned
  *
  * RETURN:      Status
  *
  * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
- *              to its external form (e.g. "\_PR_.CPU0")
+ *              to its external (printable) form (e.g. "\_PR_.CPU0")
  *
  ******************************************************************************/
 
@@ -717,8 +739,9 @@
  *
  * DESCRIPTION: Convert a namespace handle to a real Node
  *
- * Note: Real integer handles allow for more verification
- *       and keep all pointers within this subsystem.
+ * Note: Real integer handles would allow for more verification
+ *       and keep all pointers within this subsystem - however this introduces
+ *       more (and perhaps unnecessary) overhead.
  *
  ******************************************************************************/
 
@@ -775,7 +798,7 @@
 	return ((acpi_handle) node);
 
 
-/* ---------------------------------------------------
+/* Example future implementation ---------------------
 
 	if (!Node)
 	{
@@ -801,12 +824,13 @@
  *
  * RETURN:      none
  *
- * DESCRIPTION: free memory allocated for table storage.
+ * DESCRIPTION: free memory allocated for namespace and ACPI table storage.
  *
  ******************************************************************************/
 
 void
-acpi_ns_terminate (void)
+acpi_ns_terminate (
+	void)
 {
 	union acpi_operand_object       *obj_desc;
 
@@ -940,7 +964,6 @@
 	(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
 
 cleanup:
-	/* Cleanup */
 	if (internal_path) {
 		ACPI_MEM_FREE (internal_path);
 	}
@@ -950,6 +973,74 @@
 
 /*******************************************************************************
  *
+ * FUNCTION:    acpi_ns_get_parent_node
+ *
+ * PARAMETERS:  Node       - Current table entry
+ *
+ * RETURN:      Parent entry of the given entry
+ *
+ * DESCRIPTION: Obtain the parent entry for a given entry in the namespace.
+ *
+ ******************************************************************************/
+
+struct acpi_namespace_node *
+acpi_ns_get_parent_node (
+	struct acpi_namespace_node      *node)
+{
+	ACPI_FUNCTION_ENTRY ();
+
+
+	if (!node) {
+		return (NULL);
+	}
+
+	/*
+	 * Walk to the end of this peer list. The last entry is marked with a flag
+	 * and the peer pointer is really a pointer back to the parent. This saves
+	 * putting a parent back pointer in each and every named object!
+	 */
+	while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
+		node = node->peer;
+	}
+
+	return (node->peer);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ns_get_next_valid_node
+ *
+ * PARAMETERS:  Node       - Current table entry
+ *
+ * RETURN:      Next valid Node in the linked node list. NULL if no more valid
+ *              nodes.
+ *
+ * DESCRIPTION: Find the next valid node within a name table.
+ *              Useful for implementing NULL-end-of-list loops.
+ *
+ ******************************************************************************/
+
+struct acpi_namespace_node *
+acpi_ns_get_next_valid_node (
+	struct acpi_namespace_node      *node)
+{
+
+	/* If we are at the end of this peer list, return NULL */
+
+	if (node->flags & ANOBJ_END_OF_PEER_LIST) {
+		return NULL;
+	}
+
+	/* Otherwise just return the next peer */
+
+	return (node->peer);
+}
+
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/*******************************************************************************
+ *
  * FUNCTION:    acpi_ns_find_parent_name
  *
  * PARAMETERS:  *child_node            - Named Obj whose name is to be found
@@ -961,7 +1052,7 @@
  *              (which "should not happen").
  *
  ******************************************************************************/
-#ifdef ACPI_FUTURE_USAGE
+
 acpi_name
 acpi_ns_find_parent_name (
 	struct acpi_namespace_node      *child_node)
@@ -997,73 +1088,3 @@
 #endif
 
 
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ns_get_parent_node
- *
- * PARAMETERS:  Node       - Current table entry
- *
- * RETURN:      Parent entry of the given entry
- *
- * DESCRIPTION: Obtain the parent entry for a given entry in the namespace.
- *
- ******************************************************************************/
-
-
-struct acpi_namespace_node *
-acpi_ns_get_parent_node (
-	struct acpi_namespace_node      *node)
-{
-	ACPI_FUNCTION_ENTRY ();
-
-
-	if (!node) {
-		return (NULL);
-	}
-
-	/*
-	 * Walk to the end of this peer list. The last entry is marked with a flag
-	 * and the peer pointer is really a pointer back to the parent. This saves
-	 * putting a parent back pointer in each and every named object!
-	 */
-	while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
-		node = node->peer;
-	}
-
-
-	return (node->peer);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ns_get_next_valid_node
- *
- * PARAMETERS:  Node       - Current table entry
- *
- * RETURN:      Next valid Node in the linked node list. NULL if no more valid
- *              nodes.
- *
- * DESCRIPTION: Find the next valid node within a name table.
- *              Useful for implementing NULL-end-of-list loops.
- *
- ******************************************************************************/
-
-
-struct acpi_namespace_node *
-acpi_ns_get_next_valid_node (
-	struct acpi_namespace_node      *node)
-{
-
-	/* If we are at the end of this peer list, return NULL */
-
-	if (node->flags & ANOBJ_END_OF_PEER_LIST) {
-		return NULL;
-	}
-
-	/* Otherwise just return the next peer */
-
-	return (node->peer);
-}
-
-