aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/namespace/nsutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/namespace/nsutils.c')
-rw-r--r--drivers/acpi/namespace/nsutils.c167
1 files changed, 94 insertions, 73 deletions
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c
index 75da76cc0b19..c53b82e94ce3 100644
--- a/drivers/acpi/namespace/nsutils.c
+++ b/drivers/acpi/namespace/nsutils.c
@@ -51,6 +51,18 @@
51#define _COMPONENT ACPI_NAMESPACE 51#define _COMPONENT ACPI_NAMESPACE
52 ACPI_MODULE_NAME ("nsutils") 52 ACPI_MODULE_NAME ("nsutils")
53 53
54/* Local prototypes */
55
56static u8
57acpi_ns_valid_path_separator (
58 char sep);
59
60#ifdef ACPI_OBSOLETE_FUNCTIONS
61acpi_name
62acpi_ns_find_parent_name (
63 struct acpi_namespace_node *node_to_search);
64#endif
65
54 66
55/******************************************************************************* 67/*******************************************************************************
56 * 68 *
@@ -59,7 +71,8 @@
59 * PARAMETERS: module_name - Caller's module name (for error output) 71 * PARAMETERS: module_name - Caller's module name (for error output)
60 * line_number - Caller's line number (for error output) 72 * line_number - Caller's line number (for error output)
61 * component_id - Caller's component ID (for error output) 73 * component_id - Caller's component ID (for error output)
62 * Message - Error message to use on failure 74 * internal_name - Name or path of the namespace node
75 * lookup_status - Exception code from NS lookup
63 * 76 *
64 * RETURN: None 77 * RETURN: None
65 * 78 *
@@ -121,6 +134,9 @@ acpi_ns_report_error (
121 * line_number - Caller's line number (for error output) 134 * line_number - Caller's line number (for error output)
122 * component_id - Caller's component ID (for error output) 135 * component_id - Caller's component ID (for error output)
123 * Message - Error message to use on failure 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
124 * 140 *
125 * RETURN: None 141 * RETURN: None
126 * 142 *
@@ -161,8 +177,8 @@ acpi_ns_report_method_error (
161 * 177 *
162 * FUNCTION: acpi_ns_print_node_pathname 178 * FUNCTION: acpi_ns_print_node_pathname
163 * 179 *
164 * PARAMETERS: Node - Object 180 * PARAMETERS: Node - Object
165 * Msg - Prefix message 181 * Message - Prefix message
166 * 182 *
167 * DESCRIPTION: Print an object's full namespace pathname 183 * DESCRIPTION: Print an object's full namespace pathname
168 * Manages allocation/freeing of a pathname buffer 184 * Manages allocation/freeing of a pathname buffer
@@ -172,7 +188,7 @@ acpi_ns_report_method_error (
172void 188void
173acpi_ns_print_node_pathname ( 189acpi_ns_print_node_pathname (
174 struct acpi_namespace_node *node, 190 struct acpi_namespace_node *node,
175 char *msg) 191 char *message)
176{ 192{
177 struct acpi_buffer buffer; 193 struct acpi_buffer buffer;
178 acpi_status status; 194 acpi_status status;
@@ -189,8 +205,8 @@ acpi_ns_print_node_pathname (
189 205
190 status = acpi_ns_handle_to_pathname (node, &buffer); 206 status = acpi_ns_handle_to_pathname (node, &buffer);
191 if (ACPI_SUCCESS (status)) { 207 if (ACPI_SUCCESS (status)) {
192 if (msg) { 208 if (message) {
193 acpi_os_printf ("%s ", msg); 209 acpi_os_printf ("%s ", message);
194 } 210 }
195 211
196 acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node); 212 acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node);
@@ -224,7 +240,7 @@ acpi_ns_valid_root_prefix (
224 * 240 *
225 * FUNCTION: acpi_ns_valid_path_separator 241 * FUNCTION: acpi_ns_valid_path_separator
226 * 242 *
227 * PARAMETERS: Sep - Character to be checked 243 * PARAMETERS: Sep - Character to be checked
228 * 244 *
229 * RETURN: TRUE if a valid path separator 245 * RETURN: TRUE if a valid path separator
230 * 246 *
@@ -232,7 +248,7 @@ acpi_ns_valid_root_prefix (
232 * 248 *
233 ******************************************************************************/ 249 ******************************************************************************/
234 250
235u8 251static u8
236acpi_ns_valid_path_separator ( 252acpi_ns_valid_path_separator (
237 char sep) 253 char sep)
238{ 254{
@@ -245,10 +261,12 @@ acpi_ns_valid_path_separator (
245 * 261 *
246 * FUNCTION: acpi_ns_get_type 262 * FUNCTION: acpi_ns_get_type
247 * 263 *
248 * PARAMETERS: Handle - Parent Node to be examined 264 * PARAMETERS: Node - Parent Node to be examined
249 * 265 *
250 * RETURN: Type field from Node whose handle is passed 266 * RETURN: Type field from Node whose handle is passed
251 * 267 *
268 * DESCRIPTION: Return the type of a Namespace node
269 *
252 ******************************************************************************/ 270 ******************************************************************************/
253 271
254acpi_object_type 272acpi_object_type
@@ -271,11 +289,13 @@ acpi_ns_get_type (
271 * 289 *
272 * FUNCTION: acpi_ns_local 290 * FUNCTION: acpi_ns_local
273 * 291 *
274 * PARAMETERS: Type - A namespace object type 292 * PARAMETERS: Type - A namespace object type
275 * 293 *
276 * RETURN: LOCAL if names must be found locally in objects of the 294 * RETURN: LOCAL if names must be found locally in objects of the
277 * passed type, 0 if enclosing scopes should be searched 295 * passed type, 0 if enclosing scopes should be searched
278 * 296 *
297 * DESCRIPTION: Returns scope rule for the given object type.
298 *
279 ******************************************************************************/ 299 ******************************************************************************/
280 300
281u32 301u32
@@ -303,7 +323,7 @@ acpi_ns_local (
303 * PARAMETERS: Info - Info struct initialized with the 323 * PARAMETERS: Info - Info struct initialized with the
304 * external name pointer. 324 * external name pointer.
305 * 325 *
306 * RETURN: Status 326 * RETURN: None
307 * 327 *
308 * DESCRIPTION: Calculate the length of the internal (AML) namestring 328 * DESCRIPTION: Calculate the length of the internal (AML) namestring
309 * corresponding to the external (ASL) namestring. 329 * corresponding to the external (ASL) namestring.
@@ -551,14 +571,16 @@ acpi_ns_internalize_name (
551 * 571 *
552 * FUNCTION: acpi_ns_externalize_name 572 * FUNCTION: acpi_ns_externalize_name
553 * 573 *
554 * PARAMETERS: *internal_name - Internal representation of name 574 * PARAMETERS: internal_name_length - Lenth of the internal name below
555 * **converted_name - Where to return the resulting 575 * internal_name - Internal representation of name
556 * external representation of name 576 * converted_name_length - Where the length is returned
577 * converted_name - Where the resulting external name
578 * is returned
557 * 579 *
558 * RETURN: Status 580 * RETURN: Status
559 * 581 *
560 * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) 582 * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
561 * to its external form (e.g. "\_PR_.CPU0") 583 * to its external (printable) form (e.g. "\_PR_.CPU0")
562 * 584 *
563 ******************************************************************************/ 585 ******************************************************************************/
564 586
@@ -717,8 +739,9 @@ acpi_ns_externalize_name (
717 * 739 *
718 * DESCRIPTION: Convert a namespace handle to a real Node 740 * DESCRIPTION: Convert a namespace handle to a real Node
719 * 741 *
720 * Note: Real integer handles allow for more verification 742 * Note: Real integer handles would allow for more verification
721 * and keep all pointers within this subsystem. 743 * and keep all pointers within this subsystem - however this introduces
744 * more (and perhaps unnecessary) overhead.
722 * 745 *
723 ******************************************************************************/ 746 ******************************************************************************/
724 747
@@ -775,7 +798,7 @@ acpi_ns_convert_entry_to_handle (
775 return ((acpi_handle) node); 798 return ((acpi_handle) node);
776 799
777 800
778/* --------------------------------------------------- 801/* Example future implementation ---------------------
779 802
780 if (!Node) 803 if (!Node)
781 { 804 {
@@ -801,12 +824,13 @@ acpi_ns_convert_entry_to_handle (
801 * 824 *
802 * RETURN: none 825 * RETURN: none
803 * 826 *
804 * DESCRIPTION: free memory allocated for table storage. 827 * DESCRIPTION: free memory allocated for namespace and ACPI table storage.
805 * 828 *
806 ******************************************************************************/ 829 ******************************************************************************/
807 830
808void 831void
809acpi_ns_terminate (void) 832acpi_ns_terminate (
833 void)
810{ 834{
811 union acpi_operand_object *obj_desc; 835 union acpi_operand_object *obj_desc;
812 836
@@ -940,7 +964,6 @@ acpi_ns_get_node_by_path (
940 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 964 (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
941 965
942cleanup: 966cleanup:
943 /* Cleanup */
944 if (internal_path) { 967 if (internal_path) {
945 ACPI_MEM_FREE (internal_path); 968 ACPI_MEM_FREE (internal_path);
946 } 969 }
@@ -950,55 +973,6 @@ cleanup:
950 973
951/******************************************************************************* 974/*******************************************************************************
952 * 975 *
953 * FUNCTION: acpi_ns_find_parent_name
954 *
955 * PARAMETERS: *child_node - Named Obj whose name is to be found
956 *
957 * RETURN: The ACPI name
958 *
959 * DESCRIPTION: Search for the given obj in its parent scope and return the
960 * name segment, or "????" if the parent name can't be found
961 * (which "should not happen").
962 *
963 ******************************************************************************/
964#ifdef ACPI_FUTURE_USAGE
965acpi_name
966acpi_ns_find_parent_name (
967 struct acpi_namespace_node *child_node)
968{
969 struct acpi_namespace_node *parent_node;
970
971
972 ACPI_FUNCTION_TRACE ("ns_find_parent_name");
973
974
975 if (child_node) {
976 /* Valid entry. Get the parent Node */
977
978 parent_node = acpi_ns_get_parent_node (child_node);
979 if (parent_node) {
980 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
981 "Parent of %p [%4.4s] is %p [%4.4s]\n",
982 child_node, acpi_ut_get_node_name (child_node),
983 parent_node, acpi_ut_get_node_name (parent_node)));
984
985 if (parent_node->name.integer) {
986 return_VALUE ((acpi_name) parent_node->name.integer);
987 }
988 }
989
990 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
991 "Unable to find parent of %p (%4.4s)\n",
992 child_node, acpi_ut_get_node_name (child_node)));
993 }
994
995 return_VALUE (ACPI_UNKNOWN_NAME);
996}
997#endif
998
999
1000/*******************************************************************************
1001 *
1002 * FUNCTION: acpi_ns_get_parent_node 976 * FUNCTION: acpi_ns_get_parent_node
1003 * 977 *
1004 * PARAMETERS: Node - Current table entry 978 * PARAMETERS: Node - Current table entry
@@ -1009,7 +983,6 @@ acpi_ns_find_parent_name (
1009 * 983 *
1010 ******************************************************************************/ 984 ******************************************************************************/
1011 985
1012
1013struct acpi_namespace_node * 986struct acpi_namespace_node *
1014acpi_ns_get_parent_node ( 987acpi_ns_get_parent_node (
1015 struct acpi_namespace_node *node) 988 struct acpi_namespace_node *node)
@@ -1030,7 +1003,6 @@ acpi_ns_get_parent_node (
1030 node = node->peer; 1003 node = node->peer;
1031 } 1004 }
1032 1005
1033
1034 return (node->peer); 1006 return (node->peer);
1035} 1007}
1036 1008
@@ -1049,7 +1021,6 @@ acpi_ns_get_parent_node (
1049 * 1021 *
1050 ******************************************************************************/ 1022 ******************************************************************************/
1051 1023
1052
1053struct acpi_namespace_node * 1024struct acpi_namespace_node *
1054acpi_ns_get_next_valid_node ( 1025acpi_ns_get_next_valid_node (
1055 struct acpi_namespace_node *node) 1026 struct acpi_namespace_node *node)
@@ -1067,3 +1038,53 @@ acpi_ns_get_next_valid_node (
1067} 1038}
1068 1039
1069 1040
1041#ifdef ACPI_OBSOLETE_FUNCTIONS
1042/*******************************************************************************
1043 *
1044 * FUNCTION: acpi_ns_find_parent_name
1045 *
1046 * PARAMETERS: *child_node - Named Obj whose name is to be found
1047 *
1048 * RETURN: The ACPI name
1049 *
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").
1053 *
1054 ******************************************************************************/
1055
1056acpi_name
1057acpi_ns_find_parent_name (
1058 struct acpi_namespace_node *child_node)
1059{
1060 struct acpi_namespace_node *parent_node;
1061
1062
1063 ACPI_FUNCTION_TRACE ("ns_find_parent_name");
1064
1065
1066 if (child_node) {
1067 /* Valid entry. Get the parent Node */
1068
1069 parent_node = acpi_ns_get_parent_node (child_node);
1070 if (parent_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)));
1075
1076 if (parent_node->name.integer) {
1077 return_VALUE ((acpi_name) parent_node->name.integer);
1078 }
1079 }
1080
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)));
1084 }
1085
1086 return_VALUE (ACPI_UNKNOWN_NAME);
1087}
1088#endif
1089
1090