1 /******************************************************************************
3 * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
4 * parents and siblings and Scope manipulation
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
13 * All rights reserved.
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
38 * The above copyright and patent license is granted only if the following
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
73 * 3.4. Intel retains all right, title, and interest in and to the Original
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
81 * 4. Disclaimer and Export Compliance
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************/
117 #define __NSUTILS_C__
120 #include "accommon.h"
121 #include "acnamesp.h"
124 #define _COMPONENT ACPI_NAMESPACE
125 ACPI_MODULE_NAME ("nsutils")
127 /* Local prototypes */
130 AcpiNsValidPathSeparator (
133 #ifdef ACPI_OBSOLETE_FUNCTIONS
135 AcpiNsFindParentName (
136 ACPI_NAMESPACE_NODE
*NodeToSearch
);
140 /*******************************************************************************
142 * FUNCTION: AcpiNsReportError
144 * PARAMETERS: ModuleName - Caller's module name (for error output)
145 * LineNumber - Caller's line number (for error output)
146 * InternalName - Name or path of the namespace node
147 * LookupStatus - Exception code from NS lookup
151 * DESCRIPTION: Print warning message with full pathname
153 ******************************************************************************/
157 const char *ModuleName
,
159 const char *InternalName
,
160 ACPI_STATUS LookupStatus
)
167 AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName
, LineNumber
);
169 if (LookupStatus
== AE_BAD_CHARACTER
)
171 /* There is a non-ascii character in the name */
173 ACPI_MOVE_32_TO_32 (&BadName
, ACPI_CAST_PTR (UINT32
, InternalName
));
174 AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)", BadName
);
178 /* Convert path to external format */
180 Status
= AcpiNsExternalizeName (ACPI_UINT32_MAX
,
181 InternalName
, NULL
, &Name
);
183 /* Print target name */
185 if (ACPI_SUCCESS (Status
))
187 AcpiOsPrintf ("[%s]", Name
);
191 AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]");
200 AcpiOsPrintf (" Namespace lookup failure, %s\n",
201 AcpiFormatException (LookupStatus
));
205 /*******************************************************************************
207 * FUNCTION: AcpiNsReportMethodError
209 * PARAMETERS: ModuleName - Caller's module name (for error output)
210 * LineNumber - Caller's line number (for error output)
211 * Message - Error message to use on failure
212 * PrefixNode - Prefix relative to the path
213 * Path - Path to the node (optional)
214 * MethodStatus - Execution status
218 * DESCRIPTION: Print warning message with full pathname
220 ******************************************************************************/
223 AcpiNsReportMethodError (
224 const char *ModuleName
,
227 ACPI_NAMESPACE_NODE
*PrefixNode
,
229 ACPI_STATUS MethodStatus
)
232 ACPI_NAMESPACE_NODE
*Node
= PrefixNode
;
235 AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName
, LineNumber
);
239 Status
= AcpiNsGetNode (PrefixNode
, Path
, ACPI_NS_NO_UPSEARCH
,
241 if (ACPI_FAILURE (Status
))
243 AcpiOsPrintf ("[Could not get node by pathname]");
247 AcpiNsPrintNodePathname (Node
, Message
);
248 AcpiOsPrintf (", %s\n", AcpiFormatException (MethodStatus
));
252 /*******************************************************************************
254 * FUNCTION: AcpiNsPrintNodePathname
256 * PARAMETERS: Node - Object
257 * Message - Prefix message
259 * DESCRIPTION: Print an object's full namespace pathname
260 * Manages allocation/freeing of a pathname buffer
262 ******************************************************************************/
265 AcpiNsPrintNodePathname (
266 ACPI_NAMESPACE_NODE
*Node
,
275 AcpiOsPrintf ("[NULL NAME]");
279 /* Convert handle to full pathname and print it (with supplied message) */
281 Buffer
.Length
= ACPI_ALLOCATE_LOCAL_BUFFER
;
283 Status
= AcpiNsHandleToPathname (Node
, &Buffer
);
284 if (ACPI_SUCCESS (Status
))
288 AcpiOsPrintf ("%s ", Message
);
291 AcpiOsPrintf ("[%s] (Node %p)", (char *) Buffer
.Pointer
, Node
);
292 ACPI_FREE (Buffer
.Pointer
);
297 /*******************************************************************************
299 * FUNCTION: AcpiNsValidRootPrefix
301 * PARAMETERS: Prefix - Character to be checked
303 * RETURN: TRUE if a valid prefix
305 * DESCRIPTION: Check if a character is a valid ACPI Root prefix
307 ******************************************************************************/
310 AcpiNsValidRootPrefix (
314 return ((BOOLEAN
) (Prefix
== '\\'));
318 /*******************************************************************************
320 * FUNCTION: AcpiNsValidPathSeparator
322 * PARAMETERS: Sep - Character to be checked
324 * RETURN: TRUE if a valid path separator
326 * DESCRIPTION: Check if a character is a valid ACPI path separator
328 ******************************************************************************/
331 AcpiNsValidPathSeparator (
335 return ((BOOLEAN
) (Sep
== '.'));
339 /*******************************************************************************
341 * FUNCTION: AcpiNsGetType
343 * PARAMETERS: Node - Parent Node to be examined
345 * RETURN: Type field from Node whose handle is passed
347 * DESCRIPTION: Return the type of a Namespace node
349 ******************************************************************************/
353 ACPI_NAMESPACE_NODE
*Node
)
355 ACPI_FUNCTION_TRACE (NsGetType
);
360 ACPI_WARNING ((AE_INFO
, "Null Node parameter"));
361 return_UINT32 (ACPI_TYPE_ANY
);
364 return_UINT32 ((ACPI_OBJECT_TYPE
) Node
->Type
);
368 /*******************************************************************************
370 * FUNCTION: AcpiNsLocal
372 * PARAMETERS: Type - A namespace object type
374 * RETURN: LOCAL if names must be found locally in objects of the
375 * passed type, 0 if enclosing scopes should be searched
377 * DESCRIPTION: Returns scope rule for the given object type.
379 ******************************************************************************/
383 ACPI_OBJECT_TYPE Type
)
385 ACPI_FUNCTION_TRACE (NsLocal
);
388 if (!AcpiUtValidObjectType (Type
))
390 /* Type code out of range */
392 ACPI_WARNING ((AE_INFO
, "Invalid Object Type 0x%X", Type
));
393 return_UINT32 (ACPI_NS_NORMAL
);
396 return_UINT32 ((UINT32
) AcpiGbl_NsProperties
[Type
] & ACPI_NS_LOCAL
);
400 /*******************************************************************************
402 * FUNCTION: AcpiNsGetInternalNameLength
404 * PARAMETERS: Info - Info struct initialized with the
405 * external name pointer.
409 * DESCRIPTION: Calculate the length of the internal (AML) namestring
410 * corresponding to the external (ASL) namestring.
412 ******************************************************************************/
415 AcpiNsGetInternalNameLength (
416 ACPI_NAMESTRING_INFO
*Info
)
418 const char *NextExternalChar
;
422 ACPI_FUNCTION_ENTRY ();
425 NextExternalChar
= Info
->ExternalName
;
427 Info
->NumSegments
= 0;
428 Info
->FullyQualified
= FALSE
;
431 * For the internal name, the required length is 4 bytes per segment, plus
432 * 1 each for RootPrefix, MultiNamePrefixOp, segment count, trailing null
433 * (which is not really needed, but no there's harm in putting it there)
435 * strlen() + 1 covers the first NameSeg, which has no path separator
437 if (AcpiNsValidRootPrefix (*NextExternalChar
))
439 Info
->FullyQualified
= TRUE
;
442 /* Skip redundant RootPrefix, like \\_SB.PCI0.SBRG.EC0 */
444 while (AcpiNsValidRootPrefix (*NextExternalChar
))
451 /* Handle Carat prefixes */
453 while (*NextExternalChar
== '^')
461 * Determine the number of ACPI name "segments" by counting the number of
462 * path separators within the string. Start with one segment since the
463 * segment count is [(# separators) + 1], and zero separators is ok.
465 if (*NextExternalChar
)
467 Info
->NumSegments
= 1;
468 for (i
= 0; NextExternalChar
[i
]; i
++)
470 if (AcpiNsValidPathSeparator (NextExternalChar
[i
]))
477 Info
->Length
= (ACPI_NAME_SIZE
* Info
->NumSegments
) +
480 Info
->NextExternalChar
= NextExternalChar
;
484 /*******************************************************************************
486 * FUNCTION: AcpiNsBuildInternalName
488 * PARAMETERS: Info - Info struct fully initialized
492 * DESCRIPTION: Construct the internal (AML) namestring
493 * corresponding to the external (ASL) namestring.
495 ******************************************************************************/
498 AcpiNsBuildInternalName (
499 ACPI_NAMESTRING_INFO
*Info
)
501 UINT32 NumSegments
= Info
->NumSegments
;
502 char *InternalName
= Info
->InternalName
;
503 const char *ExternalName
= Info
->NextExternalChar
;
508 ACPI_FUNCTION_TRACE (NsBuildInternalName
);
511 /* Setup the correct prefixes, counts, and pointers */
513 if (Info
->FullyQualified
)
515 InternalName
[0] = '\\';
517 if (NumSegments
<= 1)
519 Result
= &InternalName
[1];
521 else if (NumSegments
== 2)
523 InternalName
[1] = AML_DUAL_NAME_PREFIX
;
524 Result
= &InternalName
[2];
528 InternalName
[1] = AML_MULTI_NAME_PREFIX_OP
;
529 InternalName
[2] = (char) NumSegments
;
530 Result
= &InternalName
[3];
536 * Not fully qualified.
537 * Handle Carats first, then append the name segments
542 for (i
= 0; i
< Info
->NumCarats
; i
++)
544 InternalName
[i
] = '^';
548 if (NumSegments
<= 1)
550 Result
= &InternalName
[i
];
552 else if (NumSegments
== 2)
554 InternalName
[i
] = AML_DUAL_NAME_PREFIX
;
555 Result
= &InternalName
[(ACPI_SIZE
) i
+1];
559 InternalName
[i
] = AML_MULTI_NAME_PREFIX_OP
;
560 InternalName
[(ACPI_SIZE
) i
+1] = (char) NumSegments
;
561 Result
= &InternalName
[(ACPI_SIZE
) i
+2];
565 /* Build the name (minus path separators) */
567 for (; NumSegments
; NumSegments
--)
569 for (i
= 0; i
< ACPI_NAME_SIZE
; i
++)
571 if (AcpiNsValidPathSeparator (*ExternalName
) ||
572 (*ExternalName
== 0))
574 /* Pad the segment with underscore(s) if segment is short */
580 /* Convert the character to uppercase and save it */
582 Result
[i
] = (char) ACPI_TOUPPER ((int) *ExternalName
);
587 /* Now we must have a path separator, or the pathname is bad */
589 if (!AcpiNsValidPathSeparator (*ExternalName
) &&
590 (*ExternalName
!= 0))
592 return_ACPI_STATUS (AE_BAD_PARAMETER
);
595 /* Move on the next segment */
598 Result
+= ACPI_NAME_SIZE
;
601 /* Terminate the string */
605 if (Info
->FullyQualified
)
607 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC
, "Returning [%p] (abs) \"\\%s\"\n",
608 InternalName
, InternalName
));
612 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC
, "Returning [%p] (rel) \"%s\"\n",
613 InternalName
, InternalName
));
616 return_ACPI_STATUS (AE_OK
);
620 /*******************************************************************************
622 * FUNCTION: AcpiNsInternalizeName
624 * PARAMETERS: *ExternalName - External representation of name
625 * **Converted Name - Where to return the resulting
626 * internal represention of the name
630 * DESCRIPTION: Convert an external representation (e.g. "\_PR_.CPU0")
631 * to internal form (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
633 *******************************************************************************/
636 AcpiNsInternalizeName (
637 const char *ExternalName
,
638 char **ConvertedName
)
641 ACPI_NAMESTRING_INFO Info
;
645 ACPI_FUNCTION_TRACE (NsInternalizeName
);
648 if ((!ExternalName
) ||
649 (*ExternalName
== 0) ||
652 return_ACPI_STATUS (AE_BAD_PARAMETER
);
655 /* Get the length of the new internal name */
657 Info
.ExternalName
= ExternalName
;
658 AcpiNsGetInternalNameLength (&Info
);
660 /* We need a segment to store the internal name */
662 InternalName
= ACPI_ALLOCATE_ZEROED (Info
.Length
);
665 return_ACPI_STATUS (AE_NO_MEMORY
);
670 Info
.InternalName
= InternalName
;
671 Status
= AcpiNsBuildInternalName (&Info
);
672 if (ACPI_FAILURE (Status
))
674 ACPI_FREE (InternalName
);
675 return_ACPI_STATUS (Status
);
678 *ConvertedName
= InternalName
;
679 return_ACPI_STATUS (AE_OK
);
683 /*******************************************************************************
685 * FUNCTION: AcpiNsExternalizeName
687 * PARAMETERS: InternalNameLength - Lenth of the internal name below
688 * InternalName - Internal representation of name
689 * ConvertedNameLength - Where the length is returned
690 * ConvertedName - Where the resulting external name
695 * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
696 * to its external (printable) form (e.g. "\_PR_.CPU0")
698 ******************************************************************************/
701 AcpiNsExternalizeName (
702 UINT32 InternalNameLength
,
703 const char *InternalName
,
704 UINT32
*ConvertedNameLength
,
705 char **ConvertedName
)
707 UINT32 NamesIndex
= 0;
708 UINT32 NumSegments
= 0;
709 UINT32 RequiredLength
;
710 UINT32 PrefixLength
= 0;
715 ACPI_FUNCTION_TRACE (NsExternalizeName
);
718 if (!InternalNameLength
||
722 return_ACPI_STATUS (AE_BAD_PARAMETER
);
725 /* Check for a prefix (one '\' | one or more '^') */
727 switch (InternalName
[0])
734 for (i
= 0; i
< InternalNameLength
; i
++)
736 if (InternalName
[i
] == '^')
738 PrefixLength
= i
+ 1;
746 if (i
== InternalNameLength
)
758 * Check for object names. Note that there could be 0-255 of these
761 if (PrefixLength
< InternalNameLength
)
763 switch (InternalName
[PrefixLength
])
765 case AML_MULTI_NAME_PREFIX_OP
:
767 /* <count> 4-byte names */
769 NamesIndex
= PrefixLength
+ 2;
770 NumSegments
= (UINT8
)
771 InternalName
[(ACPI_SIZE
) PrefixLength
+ 1];
774 case AML_DUAL_NAME_PREFIX
:
776 /* Two 4-byte names */
778 NamesIndex
= PrefixLength
+ 1;
792 /* one 4-byte name */
794 NamesIndex
= PrefixLength
;
801 * Calculate the length of ConvertedName, which equals the length
802 * of the prefix, length of all object names, length of any required
803 * punctuation ('.') between object names, plus the NULL terminator.
805 RequiredLength
= PrefixLength
+ (4 * NumSegments
) +
806 ((NumSegments
> 0) ? (NumSegments
- 1) : 0) + 1;
809 * Check to see if we're still in bounds. If not, there's a problem
810 * with InternalName (invalid format).
812 if (RequiredLength
> InternalNameLength
)
814 ACPI_ERROR ((AE_INFO
, "Invalid internal name"));
815 return_ACPI_STATUS (AE_BAD_PATHNAME
);
818 /* Build the ConvertedName */
820 *ConvertedName
= ACPI_ALLOCATE_ZEROED (RequiredLength
);
821 if (!(*ConvertedName
))
823 return_ACPI_STATUS (AE_NO_MEMORY
);
828 for (i
= 0; i
< PrefixLength
; i
++)
830 (*ConvertedName
)[j
++] = InternalName
[i
];
835 for (i
= 0; i
< NumSegments
; i
++)
839 (*ConvertedName
)[j
++] = '.';
842 (*ConvertedName
)[j
++] = InternalName
[NamesIndex
++];
843 (*ConvertedName
)[j
++] = InternalName
[NamesIndex
++];
844 (*ConvertedName
)[j
++] = InternalName
[NamesIndex
++];
845 (*ConvertedName
)[j
++] = InternalName
[NamesIndex
++];
849 if (ConvertedNameLength
)
851 *ConvertedNameLength
= (UINT32
) RequiredLength
;
854 return_ACPI_STATUS (AE_OK
);
858 /*******************************************************************************
860 * FUNCTION: AcpiNsValidateHandle
862 * PARAMETERS: Handle - Handle to be validated and typecast to a
865 * RETURN: A pointer to a namespace node
867 * DESCRIPTION: Convert a namespace handle to a namespace node. Handles special
868 * cases for the root node.
870 * NOTE: Real integer handles would allow for more verification
871 * and keep all pointers within this subsystem - however this introduces
872 * more overhead and has not been necessary to this point. Drivers
873 * holding handles are typically notified before a node becomes invalid
874 * due to a table unload.
876 ******************************************************************************/
878 ACPI_NAMESPACE_NODE
*
879 AcpiNsValidateHandle (
883 ACPI_FUNCTION_ENTRY ();
886 /* Parameter validation */
888 if ((!Handle
) || (Handle
== ACPI_ROOT_OBJECT
))
890 return (AcpiGbl_RootNode
);
893 /* We can at least attempt to verify the handle */
895 if (ACPI_GET_DESCRIPTOR_TYPE (Handle
) != ACPI_DESC_TYPE_NAMED
)
900 return (ACPI_CAST_PTR (ACPI_NAMESPACE_NODE
, Handle
));
904 /*******************************************************************************
906 * FUNCTION: AcpiNsTerminate
912 * DESCRIPTION: free memory allocated for namespace and ACPI table storage.
914 ******************************************************************************/
920 ACPI_OPERAND_OBJECT
*ObjDesc
;
923 ACPI_FUNCTION_TRACE (NsTerminate
);
927 * 1) Free the entire namespace -- all nodes and objects
929 * Delete all object descriptors attached to namepsace nodes
931 AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode
);
933 /* Detach any objects attached to the root */
935 ObjDesc
= AcpiNsGetAttachedObject (AcpiGbl_RootNode
);
938 AcpiNsDetachObject (AcpiGbl_RootNode
);
941 ACPI_DEBUG_PRINT ((ACPI_DB_INFO
, "Namespace freed\n"));
946 /*******************************************************************************
948 * FUNCTION: AcpiNsOpensScope
950 * PARAMETERS: Type - A valid namespace type
952 * RETURN: NEWSCOPE if the passed type "opens a name scope" according
953 * to the ACPI specification, else 0
955 ******************************************************************************/
959 ACPI_OBJECT_TYPE Type
)
961 ACPI_FUNCTION_TRACE_STR (NsOpensScope
, AcpiUtGetTypeName (Type
));
964 if (!AcpiUtValidObjectType (Type
))
966 /* type code out of range */
968 ACPI_WARNING ((AE_INFO
, "Invalid Object Type 0x%X", Type
));
969 return_UINT32 (ACPI_NS_NORMAL
);
972 return_UINT32 (((UINT32
) AcpiGbl_NsProperties
[Type
]) & ACPI_NS_NEWSCOPE
);
976 /*******************************************************************************
978 * FUNCTION: AcpiNsGetNode
980 * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
981 * \ (backslash) and ^ (carat) prefixes, and the
982 * . (period) to separate segments are supported.
983 * PrefixNode - Root of subtree to be searched, or NS_ALL for the
984 * root of the name space. If Name is fully
985 * qualified (first INT8 is '\'), the passed value
986 * of Scope will not be accessed.
987 * Flags - Used to indicate whether to perform upsearch or
989 * ReturnNode - Where the Node is returned
991 * DESCRIPTION: Look up a name relative to a given scope and return the
992 * corresponding Node. NOTE: Scope can be null.
994 * MUTEX: Locks namespace
996 ******************************************************************************/
1000 ACPI_NAMESPACE_NODE
*PrefixNode
,
1001 const char *Pathname
,
1003 ACPI_NAMESPACE_NODE
**ReturnNode
)
1005 ACPI_GENERIC_STATE ScopeInfo
;
1010 ACPI_FUNCTION_TRACE_PTR (NsGetNode
, ACPI_CAST_PTR (char, Pathname
));
1015 *ReturnNode
= PrefixNode
;
1018 *ReturnNode
= AcpiGbl_RootNode
;
1020 return_ACPI_STATUS (AE_OK
);
1023 /* Convert path to internal representation */
1025 Status
= AcpiNsInternalizeName (Pathname
, &InternalPath
);
1026 if (ACPI_FAILURE (Status
))
1028 return_ACPI_STATUS (Status
);
1031 /* Must lock namespace during lookup */
1033 Status
= AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE
);
1034 if (ACPI_FAILURE (Status
))
1039 /* Setup lookup scope (search starting point) */
1041 ScopeInfo
.Scope
.Node
= PrefixNode
;
1043 /* Lookup the name in the namespace */
1045 Status
= AcpiNsLookup (&ScopeInfo
, InternalPath
, ACPI_TYPE_ANY
,
1046 ACPI_IMODE_EXECUTE
, (Flags
| ACPI_NS_DONT_OPEN_SCOPE
),
1048 if (ACPI_FAILURE (Status
))
1050 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC
, "%s, %s\n",
1051 Pathname
, AcpiFormatException (Status
)));
1054 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE
);
1057 ACPI_FREE (InternalPath
);
1058 return_ACPI_STATUS (Status
);