*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp.
* All rights reserved.
*
* 2. License
*
* 2.1. This is your license from Intel Corp. under its intellectual property
- * rights. You may have additional license terms from the party that provided
+ * rights. You may have additional license terms from the party that provided
* you this software, covering your right to use that party's intellectual
* property rights.
*
* offer to sell, and import the Covered Code and derivative works thereof
* solely to the minimum extent necessary to exercise the above copyright
* license, and in no event shall the patent license extend to any additions
- * to or modifications of the Original Intel Code. No other license or right
+ * to or modifications of the Original Intel Code. No other license or right
* is granted directly or by implication, estoppel or otherwise;
*
* The above copyright and patent license is granted only if the following
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
- * and the following Disclaimer and Export Compliance provision. In addition,
+ * and the following Disclaimer and Export Compliance provision. In addition,
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
- * Code and the date of any change. Licensee must include in that file the
- * documentation of any changes made by any predecessor Licensee. Licensee
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
- * documentation and/or other materials provided with distribution. In
+ * documentation and/or other materials provided with distribution. In
* addition, Licensee may not authorize further sublicense of source of any
* portion of the Covered Code, and must include terms to the effect that the
* license from Licensee to its licensee is limited to the intellectual
* 4. Disclaimer and Export Compliance
*
* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
- * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
- * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
- * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
- * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
*
* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
- * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
* LIMITED REMEDY.
*
* 4.3. Licensee shall not export, either directly or indirectly, any of this
* software or system incorporating such software without first obtaining any
* required license or other approval from the U. S. Department of Commerce or
- * any other agency or department of the United States Government. In the
+ * any other agency or department of the United States Government. In the
* event Licensee exports any such software from the United States or
* re-exports any such software from a foreign destination, Licensee shall
* ensure that the distribution and export/re-export of the software is in
/* Local prototypes */
-static BOOLEAN
-AcpiNsValidPathSeparator (
- char Sep);
-
#ifdef ACPI_OBSOLETE_FUNCTIONS
ACPI_NAME
AcpiNsFindParentName (
}
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsValidRootPrefix
- *
- * PARAMETERS: Prefix - Character to be checked
- *
- * RETURN: TRUE if a valid prefix
- *
- * DESCRIPTION: Check if a character is a valid ACPI Root prefix
- *
- ******************************************************************************/
-
-BOOLEAN
-AcpiNsValidRootPrefix (
- char Prefix)
-{
-
- return ((BOOLEAN) (Prefix == '\\'));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsValidPathSeparator
- *
- * PARAMETERS: Sep - Character to be checked
- *
- * RETURN: TRUE if a valid path separator
- *
- * DESCRIPTION: Check if a character is a valid ACPI path separator
- *
- ******************************************************************************/
-
-static BOOLEAN
-AcpiNsValidPathSeparator (
- char Sep)
-{
-
- return ((BOOLEAN) (Sep == '.'));
-}
-
-
/*******************************************************************************
*
* FUNCTION: AcpiNsGetType
if (!Node)
{
ACPI_WARNING ((AE_INFO, "Null Node parameter"));
- return_UINT32 (ACPI_TYPE_ANY);
+ return_UINT8 (ACPI_TYPE_ANY);
}
- return_UINT32 ((ACPI_OBJECT_TYPE) Node->Type);
+ return_UINT8 (Node->Type);
}
return_UINT32 (ACPI_NS_NORMAL);
}
- return_UINT32 ((UINT32) AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL);
+ return_UINT32 (AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL);
}
*
* strlen() + 1 covers the first NameSeg, which has no path separator
*/
- if (AcpiNsValidRootPrefix (*NextExternalChar))
+ if (ACPI_IS_ROOT_PREFIX (*NextExternalChar))
{
Info->FullyQualified = TRUE;
NextExternalChar++;
/* Skip redundant RootPrefix, like \\_SB.PCI0.SBRG.EC0 */
- while (AcpiNsValidRootPrefix (*NextExternalChar))
+ while (ACPI_IS_ROOT_PREFIX (*NextExternalChar))
{
NextExternalChar++;
}
{
/* Handle Carat prefixes */
- while (*NextExternalChar == '^')
+ while (ACPI_IS_PARENT_PREFIX (*NextExternalChar))
{
Info->NumCarats++;
NextExternalChar++;
Info->NumSegments = 1;
for (i = 0; NextExternalChar[i]; i++)
{
- if (AcpiNsValidPathSeparator (NextExternalChar[i]))
+ if (ACPI_IS_PATH_SEPARATOR (NextExternalChar[i]))
{
Info->NumSegments++;
}
if (Info->FullyQualified)
{
- InternalName[0] = '\\';
+ InternalName[0] = AML_ROOT_PREFIX;
if (NumSegments <= 1)
{
{
for (i = 0; i < Info->NumCarats; i++)
{
- InternalName[i] = '^';
+ InternalName[i] = AML_PARENT_PREFIX;
}
}
{
for (i = 0; i < ACPI_NAME_SIZE; i++)
{
- if (AcpiNsValidPathSeparator (*ExternalName) ||
+ if (ACPI_IS_PATH_SEPARATOR (*ExternalName) ||
(*ExternalName == 0))
{
/* Pad the segment with underscore(s) if segment is short */
/* Now we must have a path separator, or the pathname is bad */
- if (!AcpiNsValidPathSeparator (*ExternalName) &&
+ if (!ACPI_IS_PATH_SEPARATOR (*ExternalName) &&
(*ExternalName != 0))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS (AE_BAD_PATHNAME);
}
/* Move on the next segment */
switch (InternalName[0])
{
- case '\\':
+ case AML_ROOT_PREFIX:
+
PrefixLength = 1;
break;
- case '^':
+ case AML_PARENT_PREFIX:
+
for (i = 0; i < InternalNameLength; i++)
{
- if (InternalName[i] == '^')
+ if (ACPI_IS_PARENT_PREFIX (InternalName[i]))
{
PrefixLength = i + 1;
}
break;
default:
+
break;
}
((NumSegments > 0) ? (NumSegments - 1) : 0) + 1;
/*
- * Check to see if we're still in bounds. If not, there's a problem
+ * Check to see if we're still in bounds. If not, there's a problem
* with InternalName (invalid format).
*/
if (RequiredLength > InternalNameLength)
(*ConvertedName)[j++] = '.';
}
- (*ConvertedName)[j++] = InternalName[NamesIndex++];
- (*ConvertedName)[j++] = InternalName[NamesIndex++];
- (*ConvertedName)[j++] = InternalName[NamesIndex++];
- (*ConvertedName)[j++] = InternalName[NamesIndex++];
+ /* Copy and validate the 4-char name segment */
+
+ ACPI_MOVE_NAME (&(*ConvertedName)[j], &InternalName[NamesIndex]);
+ AcpiUtRepairName (&(*ConvertedName)[j]);
+
+ j += ACPI_NAME_SIZE;
+ NamesIndex += ACPI_NAME_SIZE;
}
}
AcpiNsTerminate (
void)
{
- ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (NsTerminate);
/*
- * 1) Free the entire namespace -- all nodes and objects
- *
- * Delete all object descriptors attached to namepsace nodes
+ * Free the entire namespace -- all nodes and all objects
+ * attached to the nodes
*/
AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
- /* Detach any objects attached to the root */
+ /* Delete any objects attached to the root node */
- ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode);
- if (ObjDesc)
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
{
- AcpiNsDetachObject (AcpiGbl_RootNode);
+ return_VOID;
}
+ AcpiNsDeleteNode (AcpiGbl_RootNode);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
return_VOID;
}
AcpiNsOpensScope (
ACPI_OBJECT_TYPE Type)
{
- ACPI_FUNCTION_TRACE_STR (NsOpensScope, AcpiUtGetTypeName (Type));
+ ACPI_FUNCTION_ENTRY ();
- if (!AcpiUtValidObjectType (Type))
+ if (Type > ACPI_TYPE_LOCAL_MAX)
{
/* type code out of range */
ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type));
- return_UINT32 (ACPI_NS_NORMAL);
+ return (ACPI_NS_NORMAL);
}
- return_UINT32 (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE);
+ return (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE);
}
* \ (backslash) and ^ (carat) prefixes, and the
* . (period) to separate segments are supported.
* PrefixNode - Root of subtree to be searched, or NS_ALL for the
- * root of the name space. If Name is fully
+ * root of the name space. If Name is fully
* qualified (first INT8 is '\'), the passed value
* of Scope will not be accessed.
* Flags - Used to indicate whether to perform upsearch or
* ReturnNode - Where the Node is returned
*
* DESCRIPTION: Look up a name relative to a given scope and return the
- * corresponding Node. NOTE: Scope can be null.
+ * corresponding Node. NOTE: Scope can be null.
*
* MUTEX: Locks namespace
*
ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname));
+ /* Simplest case is a null pathname */
+
if (!Pathname)
{
*ReturnNode = PrefixNode;
return_ACPI_STATUS (AE_OK);
}
+ /* Quick check for a reference to the root */
+
+ if (ACPI_IS_ROOT_PREFIX (Pathname[0]) && (!Pathname[1]))
+ {
+ *ReturnNode = AcpiGbl_RootNode;
+ return_ACPI_STATUS (AE_OK);
+ }
+
/* Convert path to internal representation */
Status = AcpiNsInternalizeName (Pathname, &InternalPath);