summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/nsutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/nsutils.c')
-rw-r--r--sys/contrib/dev/acpica/nsutils.c188
1 files changed, 105 insertions, 83 deletions
diff --git a/sys/contrib/dev/acpica/nsutils.c b/sys/contrib/dev/acpica/nsutils.c
index 21b73a7..184e885 100644
--- a/sys/contrib/dev/acpica/nsutils.c
+++ b/sys/contrib/dev/acpica/nsutils.c
@@ -2,7 +2,7 @@
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
- * $Revision: 136 $
+ * $Revision: 1.141 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,6 +125,18 @@
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsutils")
+/* Local prototypes */
+
+static BOOLEAN
+AcpiNsValidPathSeparator (
+ char Sep);
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+ACPI_NAME
+AcpiNsFindParentName (
+ ACPI_NAMESPACE_NODE *NodeToSearch);
+#endif
+
/*******************************************************************************
*
@@ -133,7 +145,8 @@
* PARAMETERS: ModuleName - Caller's module name (for error output)
* LineNumber - Caller's line number (for error output)
* ComponentId - Caller's component ID (for error output)
- * Message - Error message to use on failure
+ * InternalName - Name or path of the namespace node
+ * LookupStatus - Exception code from NS lookup
*
* RETURN: None
*
@@ -200,6 +213,9 @@ AcpiNsReportError (
* LineNumber - Caller's line number (for error output)
* ComponentId - Caller's component ID (for error output)
* Message - Error message to use on failure
+ * PrefixNode - Prefix relative to the path
+ * Path - Path to the node
+ * MethodStatus - Execution status
*
* RETURN: None
*
@@ -242,8 +258,8 @@ AcpiNsReportMethodError (
*
* FUNCTION: AcpiNsPrintNodePathname
*
- * 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
@@ -253,7 +269,7 @@ AcpiNsReportMethodError (
void
AcpiNsPrintNodePathname (
ACPI_NAMESPACE_NODE *Node,
- char *Msg)
+ char *Message)
{
ACPI_BUFFER Buffer;
ACPI_STATUS Status;
@@ -272,9 +288,9 @@ AcpiNsPrintNodePathname (
Status = AcpiNsHandleToPathname (Node, &Buffer);
if (ACPI_SUCCESS (Status))
{
- if (Msg)
+ if (Message)
{
- AcpiOsPrintf ("%s ", Msg);
+ AcpiOsPrintf ("%s ", Message);
}
AcpiOsPrintf ("[%s] (Node %p)", (char *) Buffer.Pointer, Node);
@@ -308,7 +324,7 @@ AcpiNsValidRootPrefix (
*
* FUNCTION: AcpiNsValidPathSeparator
*
- * PARAMETERS: Sep - Character to be checked
+ * PARAMETERS: Sep - Character to be checked
*
* RETURN: TRUE if a valid path separator
*
@@ -316,7 +332,7 @@ AcpiNsValidRootPrefix (
*
******************************************************************************/
-BOOLEAN
+static BOOLEAN
AcpiNsValidPathSeparator (
char Sep)
{
@@ -329,10 +345,12 @@ AcpiNsValidPathSeparator (
*
* FUNCTION: AcpiNsGetType
*
- * 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
@@ -345,10 +363,10 @@ AcpiNsGetType (
if (!Node)
{
ACPI_REPORT_WARNING (("NsGetType: Null Node input pointer\n"));
- return_VALUE (ACPI_TYPE_ANY);
+ return_UINT32 (ACPI_TYPE_ANY);
}
- return_VALUE ((ACPI_OBJECT_TYPE) Node->Type);
+ return_UINT32 ((ACPI_OBJECT_TYPE) Node->Type);
}
@@ -356,11 +374,13 @@ AcpiNsGetType (
*
* FUNCTION: AcpiNsLocal
*
- * 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.
+ *
******************************************************************************/
UINT32
@@ -375,10 +395,10 @@ AcpiNsLocal (
/* Type code out of range */
ACPI_REPORT_WARNING (("NsLocal: Invalid Object Type\n"));
- return_VALUE (ACPI_NS_NORMAL);
+ return_UINT32 (ACPI_NS_NORMAL);
}
- return_VALUE ((UINT32) AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL);
+ return_UINT32 ((UINT32) AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL);
}
@@ -389,7 +409,7 @@ AcpiNsLocal (
* 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.
@@ -663,14 +683,16 @@ AcpiNsInternalizeName (
*
* FUNCTION: AcpiNsExternalizeName
*
- * PARAMETERS: *InternalName - Internal representation of name
- * **ConvertedName - Where to return the resulting
- * external representation of name
+ * PARAMETERS: InternalNameLength - Lenth of the internal name below
+ * InternalName - Internal representation of name
+ * ConvertedNameLength - Where the length is returned
+ * ConvertedName - 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")
*
******************************************************************************/
@@ -844,8 +866,9 @@ AcpiNsExternalizeName (
*
* 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.
*
******************************************************************************/
@@ -905,7 +928,7 @@ AcpiNsConvertEntryToHandle (
return ((ACPI_HANDLE) Node);
-/* ---------------------------------------------------
+/* Example future implementation ---------------------
if (!Node)
{
@@ -931,12 +954,13 @@ AcpiNsConvertEntryToHandle (
*
* RETURN: none
*
- * DESCRIPTION: free memory allocated for table storage.
+ * DESCRIPTION: free memory allocated for namespace and ACPI table storage.
*
******************************************************************************/
void
-AcpiNsTerminate (void)
+AcpiNsTerminate (
+ void)
{
ACPI_OPERAND_OBJECT *ObjDesc;
@@ -994,10 +1018,10 @@ AcpiNsOpensScope (
/* type code out of range */
ACPI_REPORT_WARNING (("NsOpensScope: Invalid Object Type %X\n", Type));
- return_VALUE (ACPI_NS_NORMAL);
+ return_UINT32 (ACPI_NS_NORMAL);
}
- return_VALUE (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE);
+ return_UINT32 (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE);
}
@@ -1076,7 +1100,6 @@ AcpiNsGetNodeByPath (
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
Cleanup:
- /* Cleanup */
if (InternalPath)
{
ACPI_MEM_FREE (InternalPath);
@@ -1087,57 +1110,6 @@ Cleanup:
/*******************************************************************************
*
- * FUNCTION: AcpiNsFindParentName
- *
- * PARAMETERS: *ChildNode - Named Obj whose name is to be found
- *
- * RETURN: The ACPI name
- *
- * DESCRIPTION: Search for the given obj in its parent scope and return the
- * name segment, or "????" if the parent name can't be found
- * (which "should not happen").
- *
- ******************************************************************************/
-
-ACPI_NAME
-AcpiNsFindParentName (
- ACPI_NAMESPACE_NODE *ChildNode)
-{
- ACPI_NAMESPACE_NODE *ParentNode;
-
-
- ACPI_FUNCTION_TRACE ("NsFindParentName");
-
-
- if (ChildNode)
- {
- /* Valid entry. Get the parent Node */
-
- ParentNode = AcpiNsGetParentNode (ChildNode);
- if (ParentNode)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Parent of %p [%4.4s] is %p [%4.4s]\n",
- ChildNode, AcpiUtGetNodeName (ChildNode),
- ParentNode, AcpiUtGetNodeName (ParentNode)));
-
- if (ParentNode->Name.Integer)
- {
- return_VALUE ((ACPI_NAME) ParentNode->Name.Integer);
- }
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Unable to find parent of %p (%4.4s)\n",
- ChildNode, AcpiUtGetNodeName (ChildNode)));
- }
-
- return_VALUE (ACPI_UNKNOWN_NAME);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiNsGetParentNode
*
* PARAMETERS: Node - Current table entry
@@ -1148,7 +1120,6 @@ AcpiNsFindParentName (
*
******************************************************************************/
-
ACPI_NAMESPACE_NODE *
AcpiNsGetParentNode (
ACPI_NAMESPACE_NODE *Node)
@@ -1171,7 +1142,6 @@ AcpiNsGetParentNode (
Node = Node->Peer;
}
-
return (Node->Peer);
}
@@ -1190,7 +1160,6 @@ AcpiNsGetParentNode (
*
******************************************************************************/
-
ACPI_NAMESPACE_NODE *
AcpiNsGetNextValidNode (
ACPI_NAMESPACE_NODE *Node)
@@ -1209,3 +1178,56 @@ AcpiNsGetNextValidNode (
}
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsFindParentName
+ *
+ * PARAMETERS: *ChildNode - Named Obj whose name is to be found
+ *
+ * RETURN: The ACPI name
+ *
+ * DESCRIPTION: Search for the given obj in its parent scope and return the
+ * name segment, or "????" if the parent name can't be found
+ * (which "should not happen").
+ *
+ ******************************************************************************/
+
+ACPI_NAME
+AcpiNsFindParentName (
+ ACPI_NAMESPACE_NODE *ChildNode)
+{
+ ACPI_NAMESPACE_NODE *ParentNode;
+
+
+ ACPI_FUNCTION_TRACE ("NsFindParentName");
+
+
+ if (ChildNode)
+ {
+ /* Valid entry. Get the parent Node */
+
+ ParentNode = AcpiNsGetParentNode (ChildNode);
+ if (ParentNode)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Parent of %p [%4.4s] is %p [%4.4s]\n",
+ ChildNode, AcpiUtGetNodeName (ChildNode),
+ ParentNode, AcpiUtGetNodeName (ParentNode)));
+
+ if (ParentNode->Name.Integer)
+ {
+ return_VALUE ((ACPI_NAME) ParentNode->Name.Integer);
+ }
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Unable to find parent of %p (%4.4s)\n",
+ ChildNode, AcpiUtGetNodeName (ChildNode)));
+ }
+
+ return_VALUE (ACPI_UNKNOWN_NAME);
+}
+#endif
+
+
OpenPOWER on IntegriCloud