1 /******************************************************************************
3 * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
4 * parents and siblings and Scope manipulation
6 *****************************************************************************/
9 * Copyright (C) 2000 - 2005, R. Byron Moore
10 * All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
46 #include <acpi/acpi.h>
47 #include <acpi/acnamesp.h>
48 #include <acpi/amlcode.h>
49 #include <acpi/actables.h>
51 #define _COMPONENT ACPI_NAMESPACE
52 ACPI_MODULE_NAME ("nsutils")
54 /* Local prototypes */
57 acpi_ns_valid_path_separator (
60 #ifdef ACPI_OBSOLETE_FUNCTIONS
62 acpi_ns_find_parent_name (
63 struct acpi_namespace_node *node_to_search);
67 /*******************************************************************************
69 * FUNCTION: acpi_ns_report_error
71 * PARAMETERS: module_name - Caller's module name (for error output)
72 * line_number - Caller's line number (for error output)
73 * component_id - Caller's component ID (for error output)
74 * internal_name - Name or path of the namespace node
75 * lookup_status - Exception code from NS lookup
79 * DESCRIPTION: Print warning message with full pathname
81 ******************************************************************************/
84 acpi_ns_report_error (
89 acpi_status lookup_status)
95 acpi_os_printf ("%8s-%04d: *** Error: Looking up ",
96 module_name, line_number);
98 if (lookup_status == AE_BAD_CHARACTER) {
99 /* There is a non-ascii character in the name */
101 acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n",
102 *(ACPI_CAST_PTR (u32, internal_name)));
105 /* Convert path to external format */
107 status = acpi_ns_externalize_name (ACPI_UINT32_MAX,
108 internal_name, NULL, &name);
110 /* Print target name */
112 if (ACPI_SUCCESS (status)) {
113 acpi_os_printf ("[%s]", name);
116 acpi_os_printf ("[COULD NOT EXTERNALIZE NAME]");
120 ACPI_MEM_FREE (name);
124 acpi_os_printf (" in namespace, %s\n",
125 acpi_format_exception (lookup_status));
129 /*******************************************************************************
131 * FUNCTION: acpi_ns_report_method_error
133 * PARAMETERS: module_name - Caller's module name (for error output)
134 * line_number - Caller's line number (for error output)
135 * component_id - Caller's component ID (for error output)
136 * Message - Error message to use on failure
137 * prefix_node - Prefix relative to the path
138 * Path - Path to the node
139 * method_status - Execution status
143 * DESCRIPTION: Print warning message with full pathname
145 ******************************************************************************/
148 acpi_ns_report_method_error (
153 struct acpi_namespace_node *prefix_node,
155 acpi_status method_status)
158 struct acpi_namespace_node *node = prefix_node;
162 status = acpi_ns_get_node_by_path (path, prefix_node,
163 ACPI_NS_NO_UPSEARCH, &node);
164 if (ACPI_FAILURE (status)) {
165 acpi_os_printf ("report_method_error: Could not get node\n");
170 acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number);
171 acpi_ns_print_node_pathname (node, message);
172 acpi_os_printf (", %s\n", acpi_format_exception (method_status));
176 /*******************************************************************************
178 * FUNCTION: acpi_ns_print_node_pathname
180 * PARAMETERS: Node - Object
181 * Message - Prefix message
183 * DESCRIPTION: Print an object's full namespace pathname
184 * Manages allocation/freeing of a pathname buffer
186 ******************************************************************************/
189 acpi_ns_print_node_pathname (
190 struct acpi_namespace_node *node,
193 struct acpi_buffer buffer;
198 acpi_os_printf ("[NULL NAME]");
202 /* Convert handle to full pathname and print it (with supplied message) */
204 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
206 status = acpi_ns_handle_to_pathname (node, &buffer);
207 if (ACPI_SUCCESS (status)) {
209 acpi_os_printf ("%s ", message);
212 acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node);
213 ACPI_MEM_FREE (buffer.pointer);
218 /*******************************************************************************
220 * FUNCTION: acpi_ns_valid_root_prefix
222 * PARAMETERS: Prefix - Character to be checked
224 * RETURN: TRUE if a valid prefix
226 * DESCRIPTION: Check if a character is a valid ACPI Root prefix
228 ******************************************************************************/
231 acpi_ns_valid_root_prefix (
235 return ((u8) (prefix == '\\'));
239 /*******************************************************************************
241 * FUNCTION: acpi_ns_valid_path_separator
243 * PARAMETERS: Sep - Character to be checked
245 * RETURN: TRUE if a valid path separator
247 * DESCRIPTION: Check if a character is a valid ACPI path separator
249 ******************************************************************************/
252 acpi_ns_valid_path_separator (
256 return ((u8) (sep == '.'));
260 /*******************************************************************************
262 * FUNCTION: acpi_ns_get_type
264 * PARAMETERS: Node - Parent Node to be examined
266 * RETURN: Type field from Node whose handle is passed
268 * DESCRIPTION: Return the type of a Namespace node
270 ******************************************************************************/
274 struct acpi_namespace_node *node)
276 ACPI_FUNCTION_TRACE ("ns_get_type");
280 ACPI_REPORT_WARNING (("ns_get_type: Null Node input pointer\n"));
281 return_VALUE (ACPI_TYPE_ANY);
284 return_VALUE ((acpi_object_type) node->type);
288 /*******************************************************************************
290 * FUNCTION: acpi_ns_local
292 * PARAMETERS: Type - A namespace object type
294 * RETURN: LOCAL if names must be found locally in objects of the
295 * passed type, 0 if enclosing scopes should be searched
297 * DESCRIPTION: Returns scope rule for the given object type.
299 ******************************************************************************/
303 acpi_object_type type)
305 ACPI_FUNCTION_TRACE ("ns_local");
308 if (!acpi_ut_valid_object_type (type)) {
309 /* Type code out of range */
311 ACPI_REPORT_WARNING (("ns_local: Invalid Object Type\n"));
312 return_VALUE (ACPI_NS_NORMAL);
315 return_VALUE ((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
319 /*******************************************************************************
321 * FUNCTION: acpi_ns_get_internal_name_length
323 * PARAMETERS: Info - Info struct initialized with the
324 * external name pointer.
328 * DESCRIPTION: Calculate the length of the internal (AML) namestring
329 * corresponding to the external (ASL) namestring.
331 ******************************************************************************/
334 acpi_ns_get_internal_name_length (
335 struct acpi_namestring_info *info)
337 char *next_external_char;
341 ACPI_FUNCTION_ENTRY ();
344 next_external_char = info->external_name;
345 info->num_carats = 0;
346 info->num_segments = 0;
347 info->fully_qualified = FALSE;
350 * For the internal name, the required length is 4 bytes per segment, plus
351 * 1 each for root_prefix, multi_name_prefix_op, segment count, trailing null
352 * (which is not really needed, but no there's harm in putting it there)
354 * strlen() + 1 covers the first name_seg, which has no path separator
356 if (acpi_ns_valid_root_prefix (next_external_char[0])) {
357 info->fully_qualified = TRUE;
358 next_external_char++;
362 * Handle Carat prefixes
364 while (*next_external_char == '^') {
366 next_external_char++;
371 * Determine the number of ACPI name "segments" by counting the number of
372 * path separators within the string. Start with one segment since the
373 * segment count is [(# separators) + 1], and zero separators is ok.
375 if (*next_external_char) {
376 info->num_segments = 1;
377 for (i = 0; next_external_char[i]; i++) {
378 if (acpi_ns_valid_path_separator (next_external_char[i])) {
379 info->num_segments++;
384 info->length = (ACPI_NAME_SIZE * info->num_segments) +
385 4 + info->num_carats;
387 info->next_external_char = next_external_char;
391 /*******************************************************************************
393 * FUNCTION: acpi_ns_build_internal_name
395 * PARAMETERS: Info - Info struct fully initialized
399 * DESCRIPTION: Construct the internal (AML) namestring
400 * corresponding to the external (ASL) namestring.
402 ******************************************************************************/
405 acpi_ns_build_internal_name (
406 struct acpi_namestring_info *info)
408 u32 num_segments = info->num_segments;
409 char *internal_name = info->internal_name;
410 char *external_name = info->next_external_char;
415 ACPI_FUNCTION_TRACE ("ns_build_internal_name");
418 /* Setup the correct prefixes, counts, and pointers */
420 if (info->fully_qualified) {
421 internal_name[0] = '\\';
423 if (num_segments <= 1) {
424 result = &internal_name[1];
426 else if (num_segments == 2) {
427 internal_name[1] = AML_DUAL_NAME_PREFIX;
428 result = &internal_name[2];
431 internal_name[1] = AML_MULTI_NAME_PREFIX_OP;
432 internal_name[2] = (char) num_segments;
433 result = &internal_name[3];
438 * Not fully qualified.
439 * Handle Carats first, then append the name segments
442 if (info->num_carats) {
443 for (i = 0; i < info->num_carats; i++) {
444 internal_name[i] = '^';
448 if (num_segments <= 1) {
449 result = &internal_name[i];
451 else if (num_segments == 2) {
452 internal_name[i] = AML_DUAL_NAME_PREFIX;
453 result = &internal_name[(acpi_native_uint) (i+1)];
456 internal_name[i] = AML_MULTI_NAME_PREFIX_OP;
457 internal_name[(acpi_native_uint) (i+1)] = (char) num_segments;
458 result = &internal_name[(acpi_native_uint) (i+2)];
462 /* Build the name (minus path separators) */
464 for (; num_segments; num_segments--) {
465 for (i = 0; i < ACPI_NAME_SIZE; i++) {
466 if (acpi_ns_valid_path_separator (*external_name) ||
467 (*external_name == 0)) {
468 /* Pad the segment with underscore(s) if segment is short */
473 /* Convert the character to uppercase and save it */
475 result[i] = (char) ACPI_TOUPPER ((int) *external_name);
480 /* Now we must have a path separator, or the pathname is bad */
482 if (!acpi_ns_valid_path_separator (*external_name) &&
483 (*external_name != 0)) {
484 return_ACPI_STATUS (AE_BAD_PARAMETER);
487 /* Move on the next segment */
490 result += ACPI_NAME_SIZE;
493 /* Terminate the string */
497 if (info->fully_qualified) {
498 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n",
499 internal_name, internal_name));
502 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
503 internal_name, internal_name));
506 return_ACPI_STATUS (AE_OK);
510 /*******************************************************************************
512 * FUNCTION: acpi_ns_internalize_name
514 * PARAMETERS: *external_name - External representation of name
515 * **Converted Name - Where to return the resulting
516 * internal represention of the name
520 * DESCRIPTION: Convert an external representation (e.g. "\_PR_.CPU0")
521 * to internal form (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
523 *******************************************************************************/
526 acpi_ns_internalize_name (
528 char **converted_name)
531 struct acpi_namestring_info info;
535 ACPI_FUNCTION_TRACE ("ns_internalize_name");
538 if ((!external_name) ||
539 (*external_name == 0) ||
541 return_ACPI_STATUS (AE_BAD_PARAMETER);
544 /* Get the length of the new internal name */
546 info.external_name = external_name;
547 acpi_ns_get_internal_name_length (&info);
549 /* We need a segment to store the internal name */
551 internal_name = ACPI_MEM_CALLOCATE (info.length);
552 if (!internal_name) {
553 return_ACPI_STATUS (AE_NO_MEMORY);
558 info.internal_name = internal_name;
559 status = acpi_ns_build_internal_name (&info);
560 if (ACPI_FAILURE (status)) {
561 ACPI_MEM_FREE (internal_name);
562 return_ACPI_STATUS (status);
565 *converted_name = internal_name;
566 return_ACPI_STATUS (AE_OK);
570 /*******************************************************************************
572 * FUNCTION: acpi_ns_externalize_name
574 * PARAMETERS: internal_name_length - Lenth of the internal name below
575 * internal_name - Internal representation of name
576 * converted_name_length - Where the length is returned
577 * converted_name - Where the resulting external name
582 * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
583 * to its external (printable) form (e.g. "\_PR_.CPU0")
585 ******************************************************************************/
588 acpi_ns_externalize_name (
589 u32 internal_name_length,
591 u32 *converted_name_length,
592 char **converted_name)
594 acpi_native_uint names_index = 0;
595 acpi_native_uint num_segments = 0;
596 acpi_native_uint required_length;
597 acpi_native_uint prefix_length = 0;
598 acpi_native_uint i = 0;
599 acpi_native_uint j = 0;
602 ACPI_FUNCTION_TRACE ("ns_externalize_name");
605 if (!internal_name_length ||
608 return_ACPI_STATUS (AE_BAD_PARAMETER);
612 * Check for a prefix (one '\' | one or more '^').
614 switch (internal_name[0]) {
620 for (i = 0; i < internal_name_length; i++) {
621 if (internal_name[i] == '^') {
622 prefix_length = i + 1;
629 if (i == internal_name_length) {
640 * Check for object names. Note that there could be 0-255 of these
643 if (prefix_length < internal_name_length) {
644 switch (internal_name[prefix_length]) {
645 case AML_MULTI_NAME_PREFIX_OP:
647 /* <count> 4-byte names */
649 names_index = prefix_length + 2;
650 num_segments = (acpi_native_uint) (u8)
651 internal_name[(acpi_native_uint) (prefix_length + 1)];
654 case AML_DUAL_NAME_PREFIX:
656 /* Two 4-byte names */
658 names_index = prefix_length + 1;
672 /* one 4-byte name */
674 names_index = prefix_length;
681 * Calculate the length of converted_name, which equals the length
682 * of the prefix, length of all object names, length of any required
683 * punctuation ('.') between object names, plus the NULL terminator.
685 required_length = prefix_length + (4 * num_segments) +
686 ((num_segments > 0) ? (num_segments - 1) : 0) + 1;
689 * Check to see if we're still in bounds. If not, there's a problem
690 * with internal_name (invalid format).
692 if (required_length > internal_name_length) {
693 ACPI_REPORT_ERROR (("ns_externalize_name: Invalid internal name\n"));
694 return_ACPI_STATUS (AE_BAD_PATHNAME);
698 * Build converted_name
700 *converted_name = ACPI_MEM_CALLOCATE (required_length);
701 if (!(*converted_name)) {
702 return_ACPI_STATUS (AE_NO_MEMORY);
707 for (i = 0; i < prefix_length; i++) {
708 (*converted_name)[j++] = internal_name[i];
711 if (num_segments > 0) {
712 for (i = 0; i < num_segments; i++) {
714 (*converted_name)[j++] = '.';
717 (*converted_name)[j++] = internal_name[names_index++];
718 (*converted_name)[j++] = internal_name[names_index++];
719 (*converted_name)[j++] = internal_name[names_index++];
720 (*converted_name)[j++] = internal_name[names_index++];
724 if (converted_name_length) {
725 *converted_name_length = (u32) required_length;
728 return_ACPI_STATUS (AE_OK);
732 /*******************************************************************************
734 * FUNCTION: acpi_ns_map_handle_to_node
736 * PARAMETERS: Handle - Handle to be converted to an Node
738 * RETURN: A Name table entry pointer
740 * DESCRIPTION: Convert a namespace handle to a real Node
742 * Note: Real integer handles would allow for more verification
743 * and keep all pointers within this subsystem - however this introduces
744 * more (and perhaps unnecessary) overhead.
746 ******************************************************************************/
748 struct acpi_namespace_node *
749 acpi_ns_map_handle_to_node (
753 ACPI_FUNCTION_ENTRY ();
757 * Simple implementation.
763 if (handle == ACPI_ROOT_OBJECT) {
764 return (acpi_gbl_root_node);
767 /* We can at least attempt to verify the handle */
769 if (ACPI_GET_DESCRIPTOR_TYPE (handle) != ACPI_DESC_TYPE_NAMED) {
773 return ((struct acpi_namespace_node *) handle);
777 /*******************************************************************************
779 * FUNCTION: acpi_ns_convert_entry_to_handle
781 * PARAMETERS: Node - Node to be converted to a Handle
783 * RETURN: A user handle
785 * DESCRIPTION: Convert a real Node to a namespace handle
787 ******************************************************************************/
790 acpi_ns_convert_entry_to_handle (
791 struct acpi_namespace_node *node)
796 * Simple implementation for now;
798 return ((acpi_handle) node);
801 /* Example future implementation ---------------------
808 if (Node == acpi_gbl_root_node)
810 return (ACPI_ROOT_OBJECT);
814 return ((acpi_handle) Node);
815 ------------------------------------------------------*/
819 /*******************************************************************************
821 * FUNCTION: acpi_ns_terminate
827 * DESCRIPTION: free memory allocated for namespace and ACPI table storage.
829 ******************************************************************************/
835 union acpi_operand_object *obj_desc;
838 ACPI_FUNCTION_TRACE ("ns_terminate");
842 * 1) Free the entire namespace -- all nodes and objects
844 * Delete all object descriptors attached to namepsace nodes
846 acpi_ns_delete_namespace_subtree (acpi_gbl_root_node);
848 /* Detach any objects attached to the root */
850 obj_desc = acpi_ns_get_attached_object (acpi_gbl_root_node);
852 acpi_ns_detach_object (acpi_gbl_root_node);
855 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
858 * 2) Now we can delete the ACPI tables
860 acpi_tb_delete_all_tables ();
861 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
867 /*******************************************************************************
869 * FUNCTION: acpi_ns_opens_scope
871 * PARAMETERS: Type - A valid namespace type
873 * RETURN: NEWSCOPE if the passed type "opens a name scope" according
874 * to the ACPI specification, else 0
876 ******************************************************************************/
879 acpi_ns_opens_scope (
880 acpi_object_type type)
882 ACPI_FUNCTION_TRACE_STR ("ns_opens_scope", acpi_ut_get_type_name (type));
885 if (!acpi_ut_valid_object_type (type)) {
886 /* type code out of range */
888 ACPI_REPORT_WARNING (("ns_opens_scope: Invalid Object Type %X\n", type));
889 return_VALUE (ACPI_NS_NORMAL);
892 return_VALUE (((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
896 /*******************************************************************************
898 * FUNCTION: acpi_ns_get_node_by_path
900 * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
901 * \ (backslash) and ^ (carat) prefixes, and the
902 * . (period) to separate segments are supported.
903 * start_node - Root of subtree to be searched, or NS_ALL for the
904 * root of the name space. If Name is fully
905 * qualified (first s8 is '\'), the passed value
906 * of Scope will not be accessed.
907 * Flags - Used to indicate whether to perform upsearch or
909 * return_node - Where the Node is returned
911 * DESCRIPTION: Look up a name relative to a given scope and return the
912 * corresponding Node. NOTE: Scope can be null.
914 * MUTEX: Locks namespace
916 ******************************************************************************/
919 acpi_ns_get_node_by_path (
921 struct acpi_namespace_node *start_node,
923 struct acpi_namespace_node **return_node)
925 union acpi_generic_state scope_info;
927 char *internal_path = NULL;
930 ACPI_FUNCTION_TRACE_PTR ("ns_get_node_by_path", pathname);
934 /* Convert path to internal representation */
936 status = acpi_ns_internalize_name (pathname, &internal_path);
937 if (ACPI_FAILURE (status)) {
938 return_ACPI_STATUS (status);
942 /* Must lock namespace during lookup */
944 status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
945 if (ACPI_FAILURE (status)) {
949 /* Setup lookup scope (search starting point) */
951 scope_info.scope.node = start_node;
953 /* Lookup the name in the namespace */
955 status = acpi_ns_lookup (&scope_info, internal_path,
956 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
957 (flags | ACPI_NS_DONT_OPEN_SCOPE),
959 if (ACPI_FAILURE (status)) {
960 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n",
961 internal_path, acpi_format_exception (status)));
964 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
968 ACPI_MEM_FREE (internal_path);
970 return_ACPI_STATUS (status);
974 /*******************************************************************************
976 * FUNCTION: acpi_ns_get_parent_node
978 * PARAMETERS: Node - Current table entry
980 * RETURN: Parent entry of the given entry
982 * DESCRIPTION: Obtain the parent entry for a given entry in the namespace.
984 ******************************************************************************/
986 struct acpi_namespace_node *
987 acpi_ns_get_parent_node (
988 struct acpi_namespace_node *node)
990 ACPI_FUNCTION_ENTRY ();
998 * Walk to the end of this peer list. The last entry is marked with a flag
999 * and the peer pointer is really a pointer back to the parent. This saves
1000 * putting a parent back pointer in each and every named object!
1002 while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
1006 return (node->peer);
1010 /*******************************************************************************
1012 * FUNCTION: acpi_ns_get_next_valid_node
1014 * PARAMETERS: Node - Current table entry
1016 * RETURN: Next valid Node in the linked node list. NULL if no more valid
1019 * DESCRIPTION: Find the next valid node within a name table.
1020 * Useful for implementing NULL-end-of-list loops.
1022 ******************************************************************************/
1024 struct acpi_namespace_node *
1025 acpi_ns_get_next_valid_node (
1026 struct acpi_namespace_node *node)
1029 /* If we are at the end of this peer list, return NULL */
1031 if (node->flags & ANOBJ_END_OF_PEER_LIST) {
1035 /* Otherwise just return the next peer */
1037 return (node->peer);
1041 #ifdef ACPI_OBSOLETE_FUNCTIONS
1042 /*******************************************************************************
1044 * FUNCTION: acpi_ns_find_parent_name
1046 * PARAMETERS: *child_node - Named Obj whose name is to be found
1048 * RETURN: The ACPI name
1050 * DESCRIPTION: Search for the given obj in its parent scope and return the
1051 * name segment, or "????" if the parent name can't be found
1052 * (which "should not happen").
1054 ******************************************************************************/
1057 acpi_ns_find_parent_name (
1058 struct acpi_namespace_node *child_node)
1060 struct acpi_namespace_node *parent_node;
1063 ACPI_FUNCTION_TRACE ("ns_find_parent_name");
1067 /* Valid entry. Get the parent Node */
1069 parent_node = acpi_ns_get_parent_node (child_node);
1071 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
1072 "Parent of %p [%4.4s] is %p [%4.4s]\n",
1073 child_node, acpi_ut_get_node_name (child_node),
1074 parent_node, acpi_ut_get_node_name (parent_node)));
1076 if (parent_node->name.integer) {
1077 return_VALUE ((acpi_name) parent_node->name.integer);
1081 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
1082 "Unable to find parent of %p (%4.4s)\n",
1083 child_node, acpi_ut_get_node_name (child_node)));
1086 return_VALUE (ACPI_UNKNOWN_NAME);