diff options
Diffstat (limited to 'drivers/acpi/namespace')
-rw-r--r-- | drivers/acpi/namespace/nsaccess.c | 46 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsalloc.c | 118 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsdump.c | 15 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsdumpdv.c | 6 | ||||
-rw-r--r-- | drivers/acpi/namespace/nseval.c | 484 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsinit.c | 298 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsload.c | 27 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsnames.c | 14 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsobject.c | 15 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsparse.c | 6 | ||||
-rw-r--r-- | drivers/acpi/namespace/nssearch.c | 148 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsutils.c | 104 | ||||
-rw-r--r-- | drivers/acpi/namespace/nswalk.c | 6 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsxfeval.c | 203 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsxfname.c | 22 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsxfobj.c | 11 |
16 files changed, 691 insertions, 832 deletions
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 1149bc18fb35..48fadade52e2 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c | |||
@@ -70,7 +70,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
70 | union acpi_operand_object *obj_desc; | 70 | union acpi_operand_object *obj_desc; |
71 | acpi_string val = NULL; | 71 | acpi_string val = NULL; |
72 | 72 | ||
73 | ACPI_FUNCTION_TRACE("ns_root_initialize"); | 73 | ACPI_FUNCTION_TRACE(ns_root_initialize); |
74 | 74 | ||
75 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 75 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
76 | if (ACPI_FAILURE(status)) { | 76 | if (ACPI_FAILURE(status)) { |
@@ -98,6 +98,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
98 | "Entering predefined entries into namespace\n")); | 98 | "Entering predefined entries into namespace\n")); |
99 | 99 | ||
100 | for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { | 100 | for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { |
101 | |||
101 | /* _OSI is optional for now, will be permanent later */ | 102 | /* _OSI is optional for now, will be permanent later */ |
102 | 103 | ||
103 | if (!ACPI_STRCMP(init_val->name, "_OSI") | 104 | if (!ACPI_STRCMP(init_val->name, "_OSI") |
@@ -156,7 +157,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
156 | 157 | ||
157 | #if defined (ACPI_ASL_COMPILER) | 158 | #if defined (ACPI_ASL_COMPILER) |
158 | 159 | ||
159 | /* save the parameter count for the i_aSL compiler */ | 160 | /* Save the parameter count for the i_aSL compiler */ |
160 | 161 | ||
161 | new_node->value = obj_desc->method.param_count; | 162 | new_node->value = obj_desc->method.param_count; |
162 | #else | 163 | #else |
@@ -258,10 +259,8 @@ acpi_status acpi_ns_root_initialize(void) | |||
258 | /* Save a handle to "_GPE", it is always present */ | 259 | /* Save a handle to "_GPE", it is always present */ |
259 | 260 | ||
260 | if (ACPI_SUCCESS(status)) { | 261 | if (ACPI_SUCCESS(status)) { |
261 | status = | 262 | status = acpi_ns_get_node(NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH, |
262 | acpi_ns_get_node_by_path("\\_GPE", NULL, | 263 | &acpi_gbl_fadt_gpe_device); |
263 | ACPI_NS_NO_UPSEARCH, | ||
264 | &acpi_gbl_fadt_gpe_device); | ||
265 | } | 264 | } |
266 | 265 | ||
267 | return_ACPI_STATUS(status); | 266 | return_ACPI_STATUS(status); |
@@ -310,17 +309,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
310 | acpi_object_type type_to_check_for; | 309 | acpi_object_type type_to_check_for; |
311 | acpi_object_type this_search_type; | 310 | acpi_object_type this_search_type; |
312 | u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; | 311 | u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; |
313 | u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | | 312 | u32 local_flags; |
314 | ACPI_NS_SEARCH_PARENT); | ||
315 | 313 | ||
316 | ACPI_FUNCTION_TRACE("ns_lookup"); | 314 | ACPI_FUNCTION_TRACE(ns_lookup); |
317 | 315 | ||
318 | if (!return_node) { | 316 | if (!return_node) { |
319 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 317 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
320 | } | 318 | } |
321 | 319 | ||
322 | acpi_gbl_ns_lookup_count++; | 320 | local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT); |
323 | *return_node = ACPI_ENTRY_NOT_FOUND; | 321 | *return_node = ACPI_ENTRY_NOT_FOUND; |
322 | acpi_gbl_ns_lookup_count++; | ||
324 | 323 | ||
325 | if (!acpi_gbl_root_node) { | 324 | if (!acpi_gbl_root_node) { |
326 | return_ACPI_STATUS(AE_NO_NAMESPACE); | 325 | return_ACPI_STATUS(AE_NO_NAMESPACE); |
@@ -346,14 +345,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
346 | return_ACPI_STATUS(AE_AML_INTERNAL); | 345 | return_ACPI_STATUS(AE_AML_INTERNAL); |
347 | } | 346 | } |
348 | 347 | ||
349 | /* | 348 | if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) { |
350 | * This node might not be a actual "scope" node (such as a | 349 | /* |
351 | * Device/Method, etc.) It could be a Package or other object node. | 350 | * This node might not be a actual "scope" node (such as a |
352 | * Backup up the tree to find the containing scope node. | 351 | * Device/Method, etc.) It could be a Package or other object node. |
353 | */ | 352 | * Backup up the tree to find the containing scope node. |
354 | while (!acpi_ns_opens_scope(prefix_node->type) && | 353 | */ |
355 | prefix_node->type != ACPI_TYPE_ANY) { | 354 | while (!acpi_ns_opens_scope(prefix_node->type) && |
356 | prefix_node = acpi_ns_get_parent_node(prefix_node); | 355 | prefix_node->type != ACPI_TYPE_ANY) { |
356 | prefix_node = | ||
357 | acpi_ns_get_parent_node(prefix_node); | ||
358 | } | ||
357 | } | 359 | } |
358 | } | 360 | } |
359 | 361 | ||
@@ -365,6 +367,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
365 | * Begin examination of the actual pathname | 367 | * Begin examination of the actual pathname |
366 | */ | 368 | */ |
367 | if (!pathname) { | 369 | if (!pathname) { |
370 | |||
368 | /* A Null name_path is allowed and refers to the root */ | 371 | /* A Null name_path is allowed and refers to the root */ |
369 | 372 | ||
370 | num_segments = 0; | 373 | num_segments = 0; |
@@ -389,6 +392,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
389 | * to the current scope). | 392 | * to the current scope). |
390 | */ | 393 | */ |
391 | if (*path == (u8) AML_ROOT_PREFIX) { | 394 | if (*path == (u8) AML_ROOT_PREFIX) { |
395 | |||
392 | /* Pathname is fully qualified, start from the root */ | 396 | /* Pathname is fully qualified, start from the root */ |
393 | 397 | ||
394 | this_node = acpi_gbl_root_node; | 398 | this_node = acpi_gbl_root_node; |
@@ -416,6 +420,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
416 | this_node = prefix_node; | 420 | this_node = prefix_node; |
417 | num_carats = 0; | 421 | num_carats = 0; |
418 | while (*path == (u8) AML_PARENT_PREFIX) { | 422 | while (*path == (u8) AML_PARENT_PREFIX) { |
423 | |||
419 | /* Name is fully qualified, no search rules apply */ | 424 | /* Name is fully qualified, no search rules apply */ |
420 | 425 | ||
421 | search_parent_flag = ACPI_NS_NO_UPSEARCH; | 426 | search_parent_flag = ACPI_NS_NO_UPSEARCH; |
@@ -430,6 +435,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
430 | num_carats++; | 435 | num_carats++; |
431 | this_node = acpi_ns_get_parent_node(this_node); | 436 | this_node = acpi_ns_get_parent_node(this_node); |
432 | if (!this_node) { | 437 | if (!this_node) { |
438 | |||
433 | /* Current scope has no parent scope */ | 439 | /* Current scope has no parent scope */ |
434 | 440 | ||
435 | ACPI_ERROR((AE_INFO, | 441 | ACPI_ERROR((AE_INFO, |
@@ -569,6 +575,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
569 | &this_node); | 575 | &this_node); |
570 | if (ACPI_FAILURE(status)) { | 576 | if (ACPI_FAILURE(status)) { |
571 | if (status == AE_NOT_FOUND) { | 577 | if (status == AE_NOT_FOUND) { |
578 | |||
572 | /* Name not found in ACPI namespace */ | 579 | /* Name not found in ACPI namespace */ |
573 | 580 | ||
574 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 581 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
@@ -602,10 +609,11 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
602 | (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && | 609 | (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && |
603 | (this_node->type != ACPI_TYPE_ANY) && | 610 | (this_node->type != ACPI_TYPE_ANY) && |
604 | (this_node->type != type_to_check_for)) { | 611 | (this_node->type != type_to_check_for)) { |
612 | |||
605 | /* Complain about a type mismatch */ | 613 | /* Complain about a type mismatch */ |
606 | 614 | ||
607 | ACPI_WARNING((AE_INFO, | 615 | ACPI_WARNING((AE_INFO, |
608 | "ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)", | 616 | "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", |
609 | ACPI_CAST_PTR(char, &simple_name), | 617 | ACPI_CAST_PTR(char, &simple_name), |
610 | acpi_ut_get_type_name(this_node->type), | 618 | acpi_ut_get_type_name(this_node->type), |
611 | acpi_ut_get_type_name | 619 | acpi_ut_get_type_name |
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index 9b871f38b61b..dc3f0739a46b 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c | |||
@@ -47,9 +47,6 @@ | |||
47 | #define _COMPONENT ACPI_NAMESPACE | 47 | #define _COMPONENT ACPI_NAMESPACE |
48 | ACPI_MODULE_NAME("nsalloc") | 48 | ACPI_MODULE_NAME("nsalloc") |
49 | 49 | ||
50 | /* Local prototypes */ | ||
51 | static void acpi_ns_remove_reference(struct acpi_namespace_node *node); | ||
52 | |||
53 | /******************************************************************************* | 50 | /******************************************************************************* |
54 | * | 51 | * |
55 | * FUNCTION: acpi_ns_create_node | 52 | * FUNCTION: acpi_ns_create_node |
@@ -61,14 +58,13 @@ static void acpi_ns_remove_reference(struct acpi_namespace_node *node); | |||
61 | * DESCRIPTION: Create a namespace node | 58 | * DESCRIPTION: Create a namespace node |
62 | * | 59 | * |
63 | ******************************************************************************/ | 60 | ******************************************************************************/ |
64 | |||
65 | struct acpi_namespace_node *acpi_ns_create_node(u32 name) | 61 | struct acpi_namespace_node *acpi_ns_create_node(u32 name) |
66 | { | 62 | { |
67 | struct acpi_namespace_node *node; | 63 | struct acpi_namespace_node *node; |
68 | 64 | ||
69 | ACPI_FUNCTION_TRACE("ns_create_node"); | 65 | ACPI_FUNCTION_TRACE(ns_create_node); |
70 | 66 | ||
71 | node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node)); | 67 | node = acpi_os_acquire_object(acpi_gbl_namespace_cache); |
72 | if (!node) { | 68 | if (!node) { |
73 | return_PTR(NULL); | 69 | return_PTR(NULL); |
74 | } | 70 | } |
@@ -76,9 +72,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name) | |||
76 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++); | 72 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++); |
77 | 73 | ||
78 | node->name.integer = name; | 74 | node->name.integer = name; |
79 | node->reference_count = 1; | ||
80 | ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED); | 75 | ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED); |
81 | |||
82 | return_PTR(node); | 76 | return_PTR(node); |
83 | } | 77 | } |
84 | 78 | ||
@@ -100,7 +94,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
100 | struct acpi_namespace_node *prev_node; | 94 | struct acpi_namespace_node *prev_node; |
101 | struct acpi_namespace_node *next_node; | 95 | struct acpi_namespace_node *next_node; |
102 | 96 | ||
103 | ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node); | 97 | ACPI_FUNCTION_TRACE_PTR(ns_delete_node, node); |
104 | 98 | ||
105 | parent_node = acpi_ns_get_parent_node(node); | 99 | parent_node = acpi_ns_get_parent_node(node); |
106 | 100 | ||
@@ -115,6 +109,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
115 | } | 109 | } |
116 | 110 | ||
117 | if (prev_node) { | 111 | if (prev_node) { |
112 | |||
118 | /* Node is not first child, unlink it */ | 113 | /* Node is not first child, unlink it */ |
119 | 114 | ||
120 | prev_node->peer = next_node->peer; | 115 | prev_node->peer = next_node->peer; |
@@ -125,6 +120,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
125 | /* Node is first child (has no previous peer) */ | 120 | /* Node is first child (has no previous peer) */ |
126 | 121 | ||
127 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { | 122 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { |
123 | |||
128 | /* No peers at all */ | 124 | /* No peers at all */ |
129 | 125 | ||
130 | parent_node->child = NULL; | 126 | parent_node->child = NULL; |
@@ -137,10 +133,10 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
137 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); | 133 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); |
138 | 134 | ||
139 | /* | 135 | /* |
140 | * Detach an object if there is one then delete the node | 136 | * Detach an object if there is one, then delete the node |
141 | */ | 137 | */ |
142 | acpi_ns_detach_object(node); | 138 | acpi_ns_detach_object(node); |
143 | ACPI_MEM_FREE(node); | 139 | (void)acpi_os_release_object(acpi_gbl_namespace_cache, node); |
144 | return_VOID; | 140 | return_VOID; |
145 | } | 141 | } |
146 | 142 | ||
@@ -171,7 +167,7 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp | |||
171 | acpi_owner_id owner_id = 0; | 167 | acpi_owner_id owner_id = 0; |
172 | struct acpi_namespace_node *child_node; | 168 | struct acpi_namespace_node *child_node; |
173 | 169 | ||
174 | ACPI_FUNCTION_TRACE("ns_install_node"); | 170 | ACPI_FUNCTION_TRACE(ns_install_node); |
175 | 171 | ||
176 | /* | 172 | /* |
177 | * Get the owner ID from the Walk state | 173 | * Get the owner ID from the Walk state |
@@ -216,14 +212,6 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp | |||
216 | acpi_ut_get_type_name(parent_node->type), | 212 | acpi_ut_get_type_name(parent_node->type), |
217 | parent_node)); | 213 | parent_node)); |
218 | 214 | ||
219 | /* | ||
220 | * Increment the reference count(s) of all parents up to | ||
221 | * the root! | ||
222 | */ | ||
223 | while ((node = acpi_ns_get_parent_node(node)) != NULL) { | ||
224 | node->reference_count++; | ||
225 | } | ||
226 | |||
227 | return_VOID; | 215 | return_VOID; |
228 | } | 216 | } |
229 | 217 | ||
@@ -244,10 +232,9 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
244 | { | 232 | { |
245 | struct acpi_namespace_node *child_node; | 233 | struct acpi_namespace_node *child_node; |
246 | struct acpi_namespace_node *next_node; | 234 | struct acpi_namespace_node *next_node; |
247 | struct acpi_namespace_node *node; | ||
248 | u8 flags; | 235 | u8 flags; |
249 | 236 | ||
250 | ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node); | 237 | ACPI_FUNCTION_TRACE_PTR(ns_delete_children, parent_node); |
251 | 238 | ||
252 | if (!parent_node) { | 239 | if (!parent_node) { |
253 | return_VOID; | 240 | return_VOID; |
@@ -264,6 +251,7 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
264 | * Deallocate all children at this level | 251 | * Deallocate all children at this level |
265 | */ | 252 | */ |
266 | do { | 253 | do { |
254 | |||
267 | /* Get the things we need */ | 255 | /* Get the things we need */ |
268 | 256 | ||
269 | next_node = child_node->peer; | 257 | next_node = child_node->peer; |
@@ -289,26 +277,10 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
289 | */ | 277 | */ |
290 | acpi_ns_detach_object(child_node); | 278 | acpi_ns_detach_object(child_node); |
291 | 279 | ||
292 | /* | ||
293 | * Decrement the reference count(s) of all parents up to | ||
294 | * the root! (counts were incremented when the node was created) | ||
295 | */ | ||
296 | node = child_node; | ||
297 | while ((node = acpi_ns_get_parent_node(node)) != NULL) { | ||
298 | node->reference_count--; | ||
299 | } | ||
300 | |||
301 | /* There should be only one reference remaining on this node */ | ||
302 | |||
303 | if (child_node->reference_count != 1) { | ||
304 | ACPI_WARNING((AE_INFO, | ||
305 | "Existing references (%d) on node being deleted (%p)", | ||
306 | child_node->reference_count, child_node)); | ||
307 | } | ||
308 | |||
309 | /* Now we can delete the node */ | 280 | /* Now we can delete the node */ |
310 | 281 | ||
311 | ACPI_MEM_FREE(child_node); | 282 | (void)acpi_os_release_object(acpi_gbl_namespace_cache, |
283 | child_node); | ||
312 | 284 | ||
313 | /* And move on to the next child in the list */ | 285 | /* And move on to the next child in the list */ |
314 | 286 | ||
@@ -341,7 +313,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
341 | struct acpi_namespace_node *child_node = NULL; | 313 | struct acpi_namespace_node *child_node = NULL; |
342 | u32 level = 1; | 314 | u32 level = 1; |
343 | 315 | ||
344 | ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree"); | 316 | ACPI_FUNCTION_TRACE(ns_delete_namespace_subtree); |
345 | 317 | ||
346 | if (!parent_node) { | 318 | if (!parent_node) { |
347 | return_VOID; | 319 | return_VOID; |
@@ -352,11 +324,14 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
352 | * to where we started. | 324 | * to where we started. |
353 | */ | 325 | */ |
354 | while (level > 0) { | 326 | while (level > 0) { |
327 | |||
355 | /* Get the next node in this scope (NULL if none) */ | 328 | /* Get the next node in this scope (NULL if none) */ |
356 | 329 | ||
357 | child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, | 330 | child_node = |
358 | child_node); | 331 | acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, |
332 | child_node); | ||
359 | if (child_node) { | 333 | if (child_node) { |
334 | |||
360 | /* Found a child node - detach any attached object */ | 335 | /* Found a child node - detach any attached object */ |
361 | 336 | ||
362 | acpi_ns_detach_object(child_node); | 337 | acpi_ns_detach_object(child_node); |
@@ -401,55 +376,6 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
401 | 376 | ||
402 | /******************************************************************************* | 377 | /******************************************************************************* |
403 | * | 378 | * |
404 | * FUNCTION: acpi_ns_remove_reference | ||
405 | * | ||
406 | * PARAMETERS: Node - Named node whose reference count is to be | ||
407 | * decremented | ||
408 | * | ||
409 | * RETURN: None. | ||
410 | * | ||
411 | * DESCRIPTION: Remove a Node reference. Decrements the reference count | ||
412 | * of all parent Nodes up to the root. Any node along | ||
413 | * the way that reaches zero references is freed. | ||
414 | * | ||
415 | ******************************************************************************/ | ||
416 | |||
417 | static void acpi_ns_remove_reference(struct acpi_namespace_node *node) | ||
418 | { | ||
419 | struct acpi_namespace_node *parent_node; | ||
420 | struct acpi_namespace_node *this_node; | ||
421 | |||
422 | ACPI_FUNCTION_ENTRY(); | ||
423 | |||
424 | /* | ||
425 | * Decrement the reference count(s) of this node and all | ||
426 | * nodes up to the root, Delete anything with zero remaining references. | ||
427 | */ | ||
428 | this_node = node; | ||
429 | while (this_node) { | ||
430 | /* Prepare to move up to parent */ | ||
431 | |||
432 | parent_node = acpi_ns_get_parent_node(this_node); | ||
433 | |||
434 | /* Decrement the reference count on this node */ | ||
435 | |||
436 | this_node->reference_count--; | ||
437 | |||
438 | /* Delete the node if no more references */ | ||
439 | |||
440 | if (!this_node->reference_count) { | ||
441 | /* Delete all children and delete the node */ | ||
442 | |||
443 | acpi_ns_delete_children(this_node); | ||
444 | acpi_ns_delete_node(this_node); | ||
445 | } | ||
446 | |||
447 | this_node = parent_node; | ||
448 | } | ||
449 | } | ||
450 | |||
451 | /******************************************************************************* | ||
452 | * | ||
453 | * FUNCTION: acpi_ns_delete_namespace_by_owner | 379 | * FUNCTION: acpi_ns_delete_namespace_by_owner |
454 | * | 380 | * |
455 | * PARAMETERS: owner_id - All nodes with this owner will be deleted | 381 | * PARAMETERS: owner_id - All nodes with this owner will be deleted |
@@ -469,15 +395,15 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
469 | u32 level; | 395 | u32 level; |
470 | struct acpi_namespace_node *parent_node; | 396 | struct acpi_namespace_node *parent_node; |
471 | 397 | ||
472 | ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id); | 398 | ACPI_FUNCTION_TRACE_U32(ns_delete_namespace_by_owner, owner_id); |
473 | 399 | ||
474 | if (owner_id == 0) { | 400 | if (owner_id == 0) { |
475 | return_VOID; | 401 | return_VOID; |
476 | } | 402 | } |
477 | 403 | ||
404 | deletion_node = NULL; | ||
478 | parent_node = acpi_gbl_root_node; | 405 | parent_node = acpi_gbl_root_node; |
479 | child_node = NULL; | 406 | child_node = NULL; |
480 | deletion_node = NULL; | ||
481 | level = 1; | 407 | level = 1; |
482 | 408 | ||
483 | /* | 409 | /* |
@@ -494,12 +420,14 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
494 | child_node); | 420 | child_node); |
495 | 421 | ||
496 | if (deletion_node) { | 422 | if (deletion_node) { |
497 | acpi_ns_remove_reference(deletion_node); | 423 | acpi_ns_delete_children(deletion_node); |
424 | acpi_ns_delete_node(deletion_node); | ||
498 | deletion_node = NULL; | 425 | deletion_node = NULL; |
499 | } | 426 | } |
500 | 427 | ||
501 | if (child_node) { | 428 | if (child_node) { |
502 | if (child_node->owner_id == owner_id) { | 429 | if (child_node->owner_id == owner_id) { |
430 | |||
503 | /* Found a matching child node - detach any attached object */ | 431 | /* Found a matching child node - detach any attached object */ |
504 | 432 | ||
505 | acpi_ns_detach_object(child_node); | 433 | acpi_ns_detach_object(child_node); |
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index a2807317a84b..d72df66aa965 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c | |||
@@ -75,7 +75,7 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname) | |||
75 | { | 75 | { |
76 | acpi_native_uint i; | 76 | acpi_native_uint i; |
77 | 77 | ||
78 | ACPI_FUNCTION_NAME("ns_print_pathname"); | 78 | ACPI_FUNCTION_NAME(ns_print_pathname); |
79 | 79 | ||
80 | if (!(acpi_dbg_level & ACPI_LV_NAMES) | 80 | if (!(acpi_dbg_level & ACPI_LV_NAMES) |
81 | || !(acpi_dbg_layer & ACPI_NAMESPACE)) { | 81 | || !(acpi_dbg_layer & ACPI_NAMESPACE)) { |
@@ -123,7 +123,7 @@ void | |||
123 | acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) | 123 | acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) |
124 | { | 124 | { |
125 | 125 | ||
126 | ACPI_FUNCTION_TRACE("ns_dump_pathname"); | 126 | ACPI_FUNCTION_TRACE(ns_dump_pathname); |
127 | 127 | ||
128 | /* Do this only if the requested debug level and component are enabled */ | 128 | /* Do this only if the requested debug level and component are enabled */ |
129 | 129 | ||
@@ -167,7 +167,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
167 | u32 dbg_level; | 167 | u32 dbg_level; |
168 | u32 i; | 168 | u32 i; |
169 | 169 | ||
170 | ACPI_FUNCTION_NAME("ns_dump_one_object"); | 170 | ACPI_FUNCTION_NAME(ns_dump_one_object); |
171 | 171 | ||
172 | /* Is output enabled? */ | 172 | /* Is output enabled? */ |
173 | 173 | ||
@@ -191,6 +191,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
191 | } | 191 | } |
192 | 192 | ||
193 | if (!(info->display_type & ACPI_DISPLAY_SHORT)) { | 193 | if (!(info->display_type & ACPI_DISPLAY_SHORT)) { |
194 | |||
194 | /* Indent the object according to the level */ | 195 | /* Indent the object according to the level */ |
195 | 196 | ||
196 | acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); | 197 | acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); |
@@ -203,6 +204,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
203 | } | 204 | } |
204 | 205 | ||
205 | if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { | 206 | if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { |
207 | this_node->name.integer = | ||
208 | acpi_ut_repair_name(this_node->name.integer); | ||
209 | |||
206 | ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X", | 210 | ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X", |
207 | this_node->name.integer)); | 211 | this_node->name.integer)); |
208 | } | 212 | } |
@@ -226,6 +230,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
226 | case ACPI_DISPLAY_SUMMARY: | 230 | case ACPI_DISPLAY_SUMMARY: |
227 | 231 | ||
228 | if (!obj_desc) { | 232 | if (!obj_desc) { |
233 | |||
229 | /* No attached object, we are done */ | 234 | /* No attached object, we are done */ |
230 | 235 | ||
231 | acpi_os_printf("\n"); | 236 | acpi_os_printf("\n"); |
@@ -419,6 +424,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
419 | 424 | ||
420 | acpi_os_printf("O:%p", obj_desc); | 425 | acpi_os_printf("O:%p", obj_desc); |
421 | if (!obj_desc) { | 426 | if (!obj_desc) { |
427 | |||
422 | /* No attached object, we are done */ | 428 | /* No attached object, we are done */ |
423 | 429 | ||
424 | acpi_os_printf("\n"); | 430 | acpi_os_printf("\n"); |
@@ -669,7 +675,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) | |||
669 | { | 675 | { |
670 | acpi_handle search_handle = search_base; | 676 | acpi_handle search_handle = search_base; |
671 | 677 | ||
672 | ACPI_FUNCTION_TRACE("ns_dump_tables"); | 678 | ACPI_FUNCTION_TRACE(ns_dump_tables); |
673 | 679 | ||
674 | if (!acpi_gbl_root_node) { | 680 | if (!acpi_gbl_root_node) { |
675 | /* | 681 | /* |
@@ -682,6 +688,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) | |||
682 | } | 688 | } |
683 | 689 | ||
684 | if (ACPI_NS_ALL == search_base) { | 690 | if (ACPI_NS_ALL == search_base) { |
691 | |||
685 | /* Entire namespace */ | 692 | /* Entire namespace */ |
686 | 693 | ||
687 | search_handle = acpi_gbl_root_node; | 694 | search_handle = acpi_gbl_root_node; |
diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c index aff899a935e3..c6bf5d30fca3 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/namespace/nsdumpdv.c | |||
@@ -74,7 +74,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, | |||
74 | acpi_status status; | 74 | acpi_status status; |
75 | u32 i; | 75 | u32 i; |
76 | 76 | ||
77 | ACPI_FUNCTION_NAME("ns_dump_one_device"); | 77 | ACPI_FUNCTION_NAME(ns_dump_one_device); |
78 | 78 | ||
79 | status = | 79 | status = |
80 | acpi_ns_dump_one_object(obj_handle, level, context, return_value); | 80 | acpi_ns_dump_one_object(obj_handle, level, context, return_value); |
@@ -92,7 +92,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, | |||
92 | info->hardware_id.value, | 92 | info->hardware_id.value, |
93 | ACPI_FORMAT_UINT64(info->address), | 93 | ACPI_FORMAT_UINT64(info->address), |
94 | info->current_status)); | 94 | info->current_status)); |
95 | ACPI_MEM_FREE(info); | 95 | ACPI_FREE(info); |
96 | } | 96 | } |
97 | 97 | ||
98 | return (status); | 98 | return (status); |
@@ -115,7 +115,7 @@ void acpi_ns_dump_root_devices(void) | |||
115 | acpi_handle sys_bus_handle; | 115 | acpi_handle sys_bus_handle; |
116 | acpi_status status; | 116 | acpi_status status; |
117 | 117 | ||
118 | ACPI_FUNCTION_NAME("ns_dump_root_devices"); | 118 | ACPI_FUNCTION_NAME(ns_dump_root_devices); |
119 | 119 | ||
120 | /* Only dump the table if tracing is enabled */ | 120 | /* Only dump the table if tracing is enabled */ |
121 | 121 | ||
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 19d7b94d40c3..4b0a4a8c9843 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | * | 2 | * |
3 | * Module Name: nseval - Object evaluation interfaces -- includes control | 3 | * Module Name: nseval - Object evaluation, includes control method execution |
4 | * method lookup and execution. | ||
5 | * | 4 | * |
6 | ******************************************************************************/ | 5 | ******************************************************************************/ |
7 | 6 | ||
@@ -50,196 +49,14 @@ | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME("nseval") | 50 | ACPI_MODULE_NAME("nseval") |
52 | 51 | ||
53 | /* Local prototypes */ | ||
54 | static acpi_status | ||
55 | acpi_ns_execute_control_method(struct acpi_parameter_info *info); | ||
56 | |||
57 | static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info); | ||
58 | |||
59 | /******************************************************************************* | ||
60 | * | ||
61 | * FUNCTION: acpi_ns_evaluate_relative | ||
62 | * | ||
63 | * PARAMETERS: Pathname - Name of method to execute, If NULL, the | ||
64 | * handle is the object to execute | ||
65 | * Info - Method info block, contains: | ||
66 | * return_object - Where to put method's return value (if | ||
67 | * any). If NULL, no value is returned. | ||
68 | * Params - List of parameters to pass to the method, | ||
69 | * terminated by NULL. Params itself may be | ||
70 | * NULL if no parameters are being passed. | ||
71 | * | ||
72 | * RETURN: Status | ||
73 | * | ||
74 | * DESCRIPTION: Evaluate the object or find and execute the requested method | ||
75 | * | ||
76 | * MUTEX: Locks Namespace | ||
77 | * | ||
78 | ******************************************************************************/ | ||
79 | |||
80 | acpi_status | ||
81 | acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info) | ||
82 | { | ||
83 | acpi_status status; | ||
84 | struct acpi_namespace_node *node = NULL; | ||
85 | union acpi_generic_state *scope_info; | ||
86 | char *internal_path = NULL; | ||
87 | |||
88 | ACPI_FUNCTION_TRACE("ns_evaluate_relative"); | ||
89 | |||
90 | /* | ||
91 | * Must have a valid object handle | ||
92 | */ | ||
93 | if (!info || !info->node) { | ||
94 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
95 | } | ||
96 | |||
97 | /* Build an internal name string for the method */ | ||
98 | |||
99 | status = acpi_ns_internalize_name(pathname, &internal_path); | ||
100 | if (ACPI_FAILURE(status)) { | ||
101 | return_ACPI_STATUS(status); | ||
102 | } | ||
103 | |||
104 | scope_info = acpi_ut_create_generic_state(); | ||
105 | if (!scope_info) { | ||
106 | goto cleanup1; | ||
107 | } | ||
108 | |||
109 | /* Get the prefix handle and Node */ | ||
110 | |||
111 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
112 | if (ACPI_FAILURE(status)) { | ||
113 | goto cleanup; | ||
114 | } | ||
115 | |||
116 | info->node = acpi_ns_map_handle_to_node(info->node); | ||
117 | if (!info->node) { | ||
118 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
119 | status = AE_BAD_PARAMETER; | ||
120 | goto cleanup; | ||
121 | } | ||
122 | |||
123 | /* Lookup the name in the namespace */ | ||
124 | |||
125 | scope_info->scope.node = info->node; | ||
126 | status = acpi_ns_lookup(scope_info, internal_path, ACPI_TYPE_ANY, | ||
127 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, | ||
128 | &node); | ||
129 | |||
130 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
131 | |||
132 | if (ACPI_FAILURE(status)) { | ||
133 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object [%s] not found [%s]\n", | ||
134 | pathname, acpi_format_exception(status))); | ||
135 | goto cleanup; | ||
136 | } | ||
137 | |||
138 | /* | ||
139 | * Now that we have a handle to the object, we can attempt to evaluate it. | ||
140 | */ | ||
141 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", | ||
142 | pathname, node, acpi_ns_get_attached_object(node))); | ||
143 | |||
144 | info->node = node; | ||
145 | status = acpi_ns_evaluate_by_handle(info); | ||
146 | |||
147 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
148 | "*** Completed eval of object %s ***\n", pathname)); | ||
149 | |||
150 | cleanup: | ||
151 | acpi_ut_delete_generic_state(scope_info); | ||
152 | |||
153 | cleanup1: | ||
154 | ACPI_MEM_FREE(internal_path); | ||
155 | return_ACPI_STATUS(status); | ||
156 | } | ||
157 | |||
158 | /******************************************************************************* | 52 | /******************************************************************************* |
159 | * | 53 | * |
160 | * FUNCTION: acpi_ns_evaluate_by_name | 54 | * FUNCTION: acpi_ns_evaluate |
161 | * | 55 | * |
162 | * PARAMETERS: Pathname - Fully qualified pathname to the object | 56 | * PARAMETERS: Info - Evaluation info block, contains: |
163 | * Info - Method info block, contains: | 57 | * prefix_node - Prefix or Method/Object Node to execute |
164 | * return_object - Where to put method's return value (if | 58 | * Pathname - Name of method to execute, If NULL, the |
165 | * any). If NULL, no value is returned. | 59 | * Node is the object to execute |
166 | * Params - List of parameters to pass to the method, | ||
167 | * terminated by NULL. Params itself may be | ||
168 | * NULL if no parameters are being passed. | ||
169 | * | ||
170 | * RETURN: Status | ||
171 | * | ||
172 | * DESCRIPTION: Evaluate the object or rind and execute the requested method | ||
173 | * passing the given parameters | ||
174 | * | ||
175 | * MUTEX: Locks Namespace | ||
176 | * | ||
177 | ******************************************************************************/ | ||
178 | |||
179 | acpi_status | ||
180 | acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info) | ||
181 | { | ||
182 | acpi_status status; | ||
183 | char *internal_path = NULL; | ||
184 | |||
185 | ACPI_FUNCTION_TRACE("ns_evaluate_by_name"); | ||
186 | |||
187 | /* Build an internal name string for the method */ | ||
188 | |||
189 | status = acpi_ns_internalize_name(pathname, &internal_path); | ||
190 | if (ACPI_FAILURE(status)) { | ||
191 | return_ACPI_STATUS(status); | ||
192 | } | ||
193 | |||
194 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
195 | if (ACPI_FAILURE(status)) { | ||
196 | goto cleanup; | ||
197 | } | ||
198 | |||
199 | /* Lookup the name in the namespace */ | ||
200 | |||
201 | status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY, | ||
202 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, | ||
203 | &info->node); | ||
204 | |||
205 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
206 | |||
207 | if (ACPI_FAILURE(status)) { | ||
208 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
209 | "Object at [%s] was not found, status=%.4X\n", | ||
210 | pathname, status)); | ||
211 | goto cleanup; | ||
212 | } | ||
213 | |||
214 | /* | ||
215 | * Now that we have a handle to the object, we can attempt to evaluate it. | ||
216 | */ | ||
217 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", | ||
218 | pathname, info->node, | ||
219 | acpi_ns_get_attached_object(info->node))); | ||
220 | |||
221 | status = acpi_ns_evaluate_by_handle(info); | ||
222 | |||
223 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
224 | "*** Completed eval of object %s ***\n", pathname)); | ||
225 | |||
226 | cleanup: | ||
227 | |||
228 | /* Cleanup */ | ||
229 | |||
230 | if (internal_path) { | ||
231 | ACPI_MEM_FREE(internal_path); | ||
232 | } | ||
233 | |||
234 | return_ACPI_STATUS(status); | ||
235 | } | ||
236 | |||
237 | /******************************************************************************* | ||
238 | * | ||
239 | * FUNCTION: acpi_ns_evaluate_by_handle | ||
240 | * | ||
241 | * PARAMETERS: Info - Method info block, contains: | ||
242 | * Node - Method/Object Node to execute | ||
243 | * Parameters - List of parameters to pass to the method, | 60 | * Parameters - List of parameters to pass to the method, |
244 | * terminated by NULL. Params itself may be | 61 | * terminated by NULL. Params itself may be |
245 | * NULL if no parameters are being passed. | 62 | * NULL if no parameters are being passed. |
@@ -248,29 +65,21 @@ acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info) | |||
248 | * parameter_type - Type of Parameter list | 65 | * parameter_type - Type of Parameter list |
249 | * return_object - Where to put method's return value (if | 66 | * return_object - Where to put method's return value (if |
250 | * any). If NULL, no value is returned. | 67 | * any). If NULL, no value is returned. |
68 | * Flags - ACPI_IGNORE_RETURN_VALUE to delete return | ||
251 | * | 69 | * |
252 | * RETURN: Status | 70 | * RETURN: Status |
253 | * | 71 | * |
254 | * DESCRIPTION: Evaluate object or execute the requested method passing the | 72 | * DESCRIPTION: Execute a control method or return the current value of an |
255 | * given parameters | 73 | * ACPI namespace object. |
256 | * | 74 | * |
257 | * MUTEX: Locks Namespace | 75 | * MUTEX: Locks interpreter |
258 | * | 76 | * |
259 | ******************************************************************************/ | 77 | ******************************************************************************/ |
260 | 78 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) | |
261 | acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info) | ||
262 | { | 79 | { |
263 | acpi_status status; | 80 | acpi_status status; |
264 | 81 | ||
265 | ACPI_FUNCTION_TRACE("ns_evaluate_by_handle"); | 82 | ACPI_FUNCTION_TRACE(ns_evaluate); |
266 | |||
267 | /* Check if namespace has been initialized */ | ||
268 | |||
269 | if (!acpi_gbl_root_node) { | ||
270 | return_ACPI_STATUS(AE_NO_NAMESPACE); | ||
271 | } | ||
272 | |||
273 | /* Parameter Validation */ | ||
274 | 83 | ||
275 | if (!info) { | 84 | if (!info) { |
276 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 85 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -280,202 +89,120 @@ acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info) | |||
280 | 89 | ||
281 | info->return_object = NULL; | 90 | info->return_object = NULL; |
282 | 91 | ||
283 | /* Get the prefix handle and Node */ | 92 | /* |
284 | 93 | * Get the actual namespace node for the target object. Handles these cases: | |
285 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 94 | * |
95 | * 1) Null node, Pathname (absolute path) | ||
96 | * 2) Node, Pathname (path relative to Node) | ||
97 | * 3) Node, Null Pathname | ||
98 | */ | ||
99 | status = acpi_ns_get_node(info->prefix_node, info->pathname, | ||
100 | ACPI_NS_NO_UPSEARCH, &info->resolved_node); | ||
286 | if (ACPI_FAILURE(status)) { | 101 | if (ACPI_FAILURE(status)) { |
287 | return_ACPI_STATUS(status); | 102 | return_ACPI_STATUS(status); |
288 | } | 103 | } |
289 | 104 | ||
290 | info->node = acpi_ns_map_handle_to_node(info->node); | ||
291 | if (!info->node) { | ||
292 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
293 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
294 | } | ||
295 | |||
296 | /* | 105 | /* |
297 | * For a method alias, we must grab the actual method node so that proper | 106 | * For a method alias, we must grab the actual method node so that proper |
298 | * scoping context will be established before execution. | 107 | * scoping context will be established before execution. |
299 | */ | 108 | */ |
300 | if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { | 109 | if (acpi_ns_get_type(info->resolved_node) == |
301 | info->node = | 110 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { |
111 | info->resolved_node = | ||
302 | ACPI_CAST_PTR(struct acpi_namespace_node, | 112 | ACPI_CAST_PTR(struct acpi_namespace_node, |
303 | info->node->object); | 113 | info->resolved_node->object); |
304 | } | 114 | } |
305 | 115 | ||
116 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", info->pathname, | ||
117 | info->resolved_node, | ||
118 | acpi_ns_get_attached_object(info->resolved_node))); | ||
119 | |||
306 | /* | 120 | /* |
307 | * Two major cases here: | 121 | * Two major cases here: |
308 | * 1) The object is an actual control method -- execute it. | ||
309 | * 2) The object is not a method -- just return it's current value | ||
310 | * | 122 | * |
311 | * In both cases, the namespace is unlocked by the acpi_ns* procedure | 123 | * 1) The object is a control method -- execute it |
124 | * 2) The object is not a method -- just return it's current value | ||
312 | */ | 125 | */ |
313 | if (acpi_ns_get_type(info->node) == ACPI_TYPE_METHOD) { | 126 | if (acpi_ns_get_type(info->resolved_node) == ACPI_TYPE_METHOD) { |
314 | /* | ||
315 | * Case 1) We have an actual control method to execute | ||
316 | */ | ||
317 | status = acpi_ns_execute_control_method(info); | ||
318 | } else { | ||
319 | /* | 127 | /* |
320 | * Case 2) Object is NOT a method, just return its current value | 128 | * 1) Object is a control method - execute it |
321 | */ | 129 | */ |
322 | status = acpi_ns_get_object_value(info); | ||
323 | } | ||
324 | |||
325 | /* | ||
326 | * Check if there is a return value on the stack that must be dealt with | ||
327 | */ | ||
328 | if (status == AE_CTRL_RETURN_VALUE) { | ||
329 | /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ | ||
330 | |||
331 | status = AE_OK; | ||
332 | } | ||
333 | |||
334 | /* | ||
335 | * Namespace was unlocked by the handling acpi_ns* function, so we | ||
336 | * just return | ||
337 | */ | ||
338 | return_ACPI_STATUS(status); | ||
339 | } | ||
340 | |||
341 | /******************************************************************************* | ||
342 | * | ||
343 | * FUNCTION: acpi_ns_execute_control_method | ||
344 | * | ||
345 | * PARAMETERS: Info - Method info block, contains: | ||
346 | * Node - Method Node to execute | ||
347 | * obj_desc - Method object | ||
348 | * Parameters - List of parameters to pass to the method, | ||
349 | * terminated by NULL. Params itself may be | ||
350 | * NULL if no parameters are being passed. | ||
351 | * return_object - Where to put method's return value (if | ||
352 | * any). If NULL, no value is returned. | ||
353 | * parameter_type - Type of Parameter list | ||
354 | * return_object - Where to put method's return value (if | ||
355 | * any). If NULL, no value is returned. | ||
356 | * | ||
357 | * RETURN: Status | ||
358 | * | ||
359 | * DESCRIPTION: Execute the requested method passing the given parameters | ||
360 | * | ||
361 | * MUTEX: Assumes namespace is locked | ||
362 | * | ||
363 | ******************************************************************************/ | ||
364 | |||
365 | static acpi_status | ||
366 | acpi_ns_execute_control_method(struct acpi_parameter_info *info) | ||
367 | { | ||
368 | acpi_status status; | ||
369 | |||
370 | ACPI_FUNCTION_TRACE("ns_execute_control_method"); | ||
371 | |||
372 | /* Verify that there is a method associated with this object */ | ||
373 | |||
374 | info->obj_desc = acpi_ns_get_attached_object(info->node); | ||
375 | if (!info->obj_desc) { | ||
376 | ACPI_ERROR((AE_INFO, "No attached method object")); | ||
377 | 130 | ||
378 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 131 | /* Verify that there is a method object associated with this node */ |
379 | return_ACPI_STATUS(AE_NULL_OBJECT); | ||
380 | } | ||
381 | |||
382 | ACPI_DUMP_PATHNAME(info->node, "Execute Method:", | ||
383 | ACPI_LV_INFO, _COMPONENT); | ||
384 | |||
385 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", | ||
386 | info->obj_desc->method.aml_start + 1, | ||
387 | info->obj_desc->method.aml_length - 1)); | ||
388 | |||
389 | /* | ||
390 | * Unlock the namespace before execution. This allows namespace access | ||
391 | * via the external Acpi* interfaces while a method is being executed. | ||
392 | * However, any namespace deletion must acquire both the namespace and | ||
393 | * interpreter locks to ensure that no thread is using the portion of the | ||
394 | * namespace that is being deleted. | ||
395 | */ | ||
396 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
397 | if (ACPI_FAILURE(status)) { | ||
398 | return_ACPI_STATUS(status); | ||
399 | } | ||
400 | 132 | ||
401 | /* | 133 | info->obj_desc = |
402 | * Execute the method via the interpreter. The interpreter is locked | 134 | acpi_ns_get_attached_object(info->resolved_node); |
403 | * here before calling into the AML parser | 135 | if (!info->obj_desc) { |
404 | */ | 136 | ACPI_ERROR((AE_INFO, |
405 | status = acpi_ex_enter_interpreter(); | 137 | "Control method has no attached sub-object")); |
406 | if (ACPI_FAILURE(status)) { | 138 | return_ACPI_STATUS(AE_NULL_OBJECT); |
407 | return_ACPI_STATUS(status); | 139 | } |
408 | } | ||
409 | 140 | ||
410 | status = acpi_ps_execute_method(info); | 141 | ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:", |
411 | acpi_ex_exit_interpreter(); | 142 | ACPI_LV_INFO, _COMPONENT); |
412 | 143 | ||
413 | return_ACPI_STATUS(status); | 144 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
414 | } | 145 | "Method at AML address %p Length %X\n", |
146 | info->obj_desc->method.aml_start + 1, | ||
147 | info->obj_desc->method.aml_length - 1)); | ||
415 | 148 | ||
416 | /******************************************************************************* | 149 | /* |
417 | * | 150 | * Any namespace deletion must acquire both the namespace and |
418 | * FUNCTION: acpi_ns_get_object_value | 151 | * interpreter locks to ensure that no thread is using the portion of |
419 | * | 152 | * the namespace that is being deleted. |
420 | * PARAMETERS: Info - Method info block, contains: | 153 | * |
421 | * Node - Object's NS node | 154 | * Execute the method via the interpreter. The interpreter is locked |
422 | * return_object - Where to put object value (if | 155 | * here before calling into the AML parser |
423 | * any). If NULL, no value is returned. | 156 | */ |
424 | * | 157 | status = acpi_ex_enter_interpreter(); |
425 | * RETURN: Status | 158 | if (ACPI_FAILURE(status)) { |
426 | * | 159 | return_ACPI_STATUS(status); |
427 | * DESCRIPTION: Return the current value of the object | 160 | } |
428 | * | ||
429 | * MUTEX: Assumes namespace is locked, leaves namespace unlocked | ||
430 | * | ||
431 | ******************************************************************************/ | ||
432 | 161 | ||
433 | static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info) | 162 | status = acpi_ps_execute_method(info); |
434 | { | 163 | acpi_ex_exit_interpreter(); |
435 | acpi_status status = AE_OK; | 164 | } else { |
436 | struct acpi_namespace_node *resolved_node = info->node; | 165 | /* |
166 | * 2) Object is not a method, return its current value | ||
167 | */ | ||
437 | 168 | ||
438 | ACPI_FUNCTION_TRACE("ns_get_object_value"); | 169 | /* |
170 | * Objects require additional resolution steps (e.g., the Node may be | ||
171 | * a field that must be read, etc.) -- we can't just grab the object | ||
172 | * out of the node. | ||
173 | * | ||
174 | * Use resolve_node_to_value() to get the associated value. | ||
175 | * | ||
176 | * NOTE: we can get away with passing in NULL for a walk state because | ||
177 | * resolved_node is guaranteed to not be a reference to either a method | ||
178 | * local or a method argument (because this interface is never called | ||
179 | * from a running method.) | ||
180 | * | ||
181 | * Even though we do not directly invoke the interpreter for object | ||
182 | * resolution, we must lock it because we could access an opregion. | ||
183 | * The opregion access code assumes that the interpreter is locked. | ||
184 | */ | ||
185 | status = acpi_ex_enter_interpreter(); | ||
186 | if (ACPI_FAILURE(status)) { | ||
187 | return_ACPI_STATUS(status); | ||
188 | } | ||
439 | 189 | ||
440 | /* | 190 | /* Function has a strange interface */ |
441 | * Objects require additional resolution steps (e.g., the Node may be a | ||
442 | * field that must be read, etc.) -- we can't just grab the object out of | ||
443 | * the node. | ||
444 | */ | ||
445 | 191 | ||
446 | /* | 192 | status = |
447 | * Use resolve_node_to_value() to get the associated value. This call always | 193 | acpi_ex_resolve_node_to_value(&info->resolved_node, NULL); |
448 | * deletes obj_desc (allocated above). | 194 | acpi_ex_exit_interpreter(); |
449 | * | ||
450 | * NOTE: we can get away with passing in NULL for a walk state because | ||
451 | * obj_desc is guaranteed to not be a reference to either a method local or | ||
452 | * a method argument (because this interface can only be called from the | ||
453 | * acpi_evaluate external interface, never called from a running method.) | ||
454 | * | ||
455 | * Even though we do not directly invoke the interpreter for this, we must | ||
456 | * enter it because we could access an opregion. The opregion access code | ||
457 | * assumes that the interpreter is locked. | ||
458 | * | ||
459 | * We must release the namespace lock before entering the intepreter. | ||
460 | */ | ||
461 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
462 | if (ACPI_FAILURE(status)) { | ||
463 | return_ACPI_STATUS(status); | ||
464 | } | ||
465 | 195 | ||
466 | status = acpi_ex_enter_interpreter(); | ||
467 | if (ACPI_SUCCESS(status)) { | ||
468 | status = acpi_ex_resolve_node_to_value(&resolved_node, NULL); | ||
469 | /* | 196 | /* |
470 | * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed | 197 | * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed |
471 | * in resolved_node. | 198 | * in resolved_node. |
472 | */ | 199 | */ |
473 | acpi_ex_exit_interpreter(); | ||
474 | |||
475 | if (ACPI_SUCCESS(status)) { | 200 | if (ACPI_SUCCESS(status)) { |
476 | status = AE_CTRL_RETURN_VALUE; | 201 | status = AE_CTRL_RETURN_VALUE; |
477 | info->return_object = ACPI_CAST_PTR | 202 | info->return_object = |
478 | (union acpi_operand_object, resolved_node); | 203 | ACPI_CAST_PTR(union acpi_operand_object, |
204 | info->resolved_node); | ||
205 | |||
479 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 206 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
480 | "Returning object %p [%s]\n", | 207 | "Returning object %p [%s]\n", |
481 | info->return_object, | 208 | info->return_object, |
@@ -484,7 +211,30 @@ static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info) | |||
484 | } | 211 | } |
485 | } | 212 | } |
486 | 213 | ||
487 | /* Namespace is unlocked */ | 214 | /* |
215 | * Check if there is a return value that must be dealt with | ||
216 | */ | ||
217 | if (status == AE_CTRL_RETURN_VALUE) { | ||
218 | |||
219 | /* If caller does not want the return value, delete it */ | ||
488 | 220 | ||
221 | if (info->flags & ACPI_IGNORE_RETURN_VALUE) { | ||
222 | acpi_ut_remove_reference(info->return_object); | ||
223 | info->return_object = NULL; | ||
224 | } | ||
225 | |||
226 | /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ | ||
227 | |||
228 | status = AE_OK; | ||
229 | } | ||
230 | |||
231 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
232 | "*** Completed evaluation of object %s ***\n", | ||
233 | info->pathname)); | ||
234 | |||
235 | /* | ||
236 | * Namespace was unlocked by the handling acpi_ns* function, so we | ||
237 | * just return | ||
238 | */ | ||
489 | return_ACPI_STATUS(status); | 239 | return_ACPI_STATUS(status); |
490 | } | 240 | } |
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 9f929e479fd8..aec8488c0019 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -58,6 +58,10 @@ static acpi_status | |||
58 | acpi_ns_init_one_device(acpi_handle obj_handle, | 58 | acpi_ns_init_one_device(acpi_handle obj_handle, |
59 | u32 nesting_level, void *context, void **return_value); | 59 | u32 nesting_level, void *context, void **return_value); |
60 | 60 | ||
61 | static acpi_status | ||
62 | acpi_ns_find_ini_methods(acpi_handle obj_handle, | ||
63 | u32 nesting_level, void *context, void **return_value); | ||
64 | |||
61 | /******************************************************************************* | 65 | /******************************************************************************* |
62 | * | 66 | * |
63 | * FUNCTION: acpi_ns_initialize_objects | 67 | * FUNCTION: acpi_ns_initialize_objects |
@@ -76,7 +80,7 @@ acpi_status acpi_ns_initialize_objects(void) | |||
76 | acpi_status status; | 80 | acpi_status status; |
77 | struct acpi_init_walk_info info; | 81 | struct acpi_init_walk_info info; |
78 | 82 | ||
79 | ACPI_FUNCTION_TRACE("ns_initialize_objects"); | 83 | ACPI_FUNCTION_TRACE(ns_initialize_objects); |
80 | 84 | ||
81 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 85 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
82 | "**** Starting initialization of namespace objects ****\n")); | 86 | "**** Starting initialization of namespace objects ****\n")); |
@@ -93,7 +97,7 @@ acpi_status acpi_ns_initialize_objects(void) | |||
93 | ACPI_UINT32_MAX, acpi_ns_init_one_object, | 97 | ACPI_UINT32_MAX, acpi_ns_init_one_object, |
94 | &info, NULL); | 98 | &info, NULL); |
95 | if (ACPI_FAILURE(status)) { | 99 | if (ACPI_FAILURE(status)) { |
96 | ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); | 100 | ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); |
97 | } | 101 | } |
98 | 102 | ||
99 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 103 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
@@ -133,7 +137,7 @@ acpi_status acpi_ns_initialize_devices(void) | |||
133 | acpi_status status; | 137 | acpi_status status; |
134 | struct acpi_device_walk_info info; | 138 | struct acpi_device_walk_info info; |
135 | 139 | ||
136 | ACPI_FUNCTION_TRACE("ns_initialize_devices"); | 140 | ACPI_FUNCTION_TRACE(ns_initialize_devices); |
137 | 141 | ||
138 | /* Init counters */ | 142 | /* Init counters */ |
139 | 143 | ||
@@ -142,30 +146,46 @@ acpi_status acpi_ns_initialize_devices(void) | |||
142 | info.num_INI = 0; | 146 | info.num_INI = 0; |
143 | 147 | ||
144 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 148 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
145 | "Executing all Device _STA and_INI methods:")); | 149 | "Initializing Device/Processor/Thermal objects by executing _INI methods:")); |
150 | |||
151 | /* Tree analysis: find all subtrees that contain _INI methods */ | ||
146 | 152 | ||
147 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 153 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
154 | ACPI_UINT32_MAX, FALSE, | ||
155 | acpi_ns_find_ini_methods, &info, NULL); | ||
148 | if (ACPI_FAILURE(status)) { | 156 | if (ACPI_FAILURE(status)) { |
149 | return_ACPI_STATUS(status); | 157 | goto error_exit; |
150 | } | 158 | } |
151 | 159 | ||
152 | /* Walk namespace for all objects */ | 160 | /* Allocate the evaluation information block */ |
161 | |||
162 | info.evaluate_info = | ||
163 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
164 | if (!info.evaluate_info) { | ||
165 | status = AE_NO_MEMORY; | ||
166 | goto error_exit; | ||
167 | } | ||
168 | |||
169 | /* Walk namespace to execute all _INIs on present devices */ | ||
153 | 170 | ||
154 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, | 171 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
155 | ACPI_UINT32_MAX, TRUE, | 172 | ACPI_UINT32_MAX, FALSE, |
156 | acpi_ns_init_one_device, &info, NULL); | 173 | acpi_ns_init_one_device, &info, NULL); |
157 | 174 | ||
158 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 175 | ACPI_FREE(info.evaluate_info); |
159 | |||
160 | if (ACPI_FAILURE(status)) { | 176 | if (ACPI_FAILURE(status)) { |
161 | ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); | 177 | goto error_exit; |
162 | } | 178 | } |
163 | 179 | ||
164 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 180 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
165 | "\n%hd Devices found - executed %hd _STA, %hd _INI methods\n", | 181 | "\nExecuted %hd _INI methods requiring %hd _STA executions (examined %hd objects)\n", |
166 | info.device_count, info.num_STA, info.num_INI)); | 182 | info.num_INI, info.num_STA, info.device_count)); |
167 | 183 | ||
168 | return_ACPI_STATUS(status); | 184 | return_ACPI_STATUS(status); |
185 | |||
186 | error_exit: | ||
187 | ACPI_EXCEPTION((AE_INFO, status, "During device initialization")); | ||
188 | return_ACPI_STATUS(status); | ||
169 | } | 189 | } |
170 | 190 | ||
171 | /******************************************************************************* | 191 | /******************************************************************************* |
@@ -200,7 +220,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
200 | (struct acpi_namespace_node *)obj_handle; | 220 | (struct acpi_namespace_node *)obj_handle; |
201 | union acpi_operand_object *obj_desc; | 221 | union acpi_operand_object *obj_desc; |
202 | 222 | ||
203 | ACPI_FUNCTION_NAME("ns_init_one_object"); | 223 | ACPI_FUNCTION_NAME(ns_init_one_object); |
204 | 224 | ||
205 | info->object_count++; | 225 | info->object_count++; |
206 | 226 | ||
@@ -311,6 +331,72 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
311 | 331 | ||
312 | /******************************************************************************* | 332 | /******************************************************************************* |
313 | * | 333 | * |
334 | * FUNCTION: acpi_ns_find_ini_methods | ||
335 | * | ||
336 | * PARAMETERS: acpi_walk_callback | ||
337 | * | ||
338 | * RETURN: acpi_status | ||
339 | * | ||
340 | * DESCRIPTION: Called during namespace walk. Finds objects named _INI under | ||
341 | * device/processor/thermal objects, and marks the entire subtree | ||
342 | * with a SUBTREE_HAS_INI flag. This flag is used during the | ||
343 | * subsequent device initialization walk to avoid entire subtrees | ||
344 | * that do not contain an _INI. | ||
345 | * | ||
346 | ******************************************************************************/ | ||
347 | |||
348 | static acpi_status | ||
349 | acpi_ns_find_ini_methods(acpi_handle obj_handle, | ||
350 | u32 nesting_level, void *context, void **return_value) | ||
351 | { | ||
352 | struct acpi_device_walk_info *info = | ||
353 | ACPI_CAST_PTR(struct acpi_device_walk_info, context); | ||
354 | struct acpi_namespace_node *node; | ||
355 | struct acpi_namespace_node *parent_node; | ||
356 | |||
357 | /* Keep count of device/processor/thermal objects */ | ||
358 | |||
359 | node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); | ||
360 | if ((node->type == ACPI_TYPE_DEVICE) || | ||
361 | (node->type == ACPI_TYPE_PROCESSOR) || | ||
362 | (node->type == ACPI_TYPE_THERMAL)) { | ||
363 | info->device_count++; | ||
364 | return (AE_OK); | ||
365 | } | ||
366 | |||
367 | /* We are only looking for methods named _INI */ | ||
368 | |||
369 | if (!ACPI_COMPARE_NAME(node->name.ascii, METHOD_NAME__INI)) { | ||
370 | return (AE_OK); | ||
371 | } | ||
372 | |||
373 | /* | ||
374 | * The only _INI methods that we care about are those that are | ||
375 | * present under Device, Processor, and Thermal objects. | ||
376 | */ | ||
377 | parent_node = acpi_ns_get_parent_node(node); | ||
378 | switch (parent_node->type) { | ||
379 | case ACPI_TYPE_DEVICE: | ||
380 | case ACPI_TYPE_PROCESSOR: | ||
381 | case ACPI_TYPE_THERMAL: | ||
382 | |||
383 | /* Mark parent and bubble up the INI present flag to the root */ | ||
384 | |||
385 | while (parent_node) { | ||
386 | parent_node->flags |= ANOBJ_SUBTREE_HAS_INI; | ||
387 | parent_node = acpi_ns_get_parent_node(parent_node); | ||
388 | } | ||
389 | break; | ||
390 | |||
391 | default: | ||
392 | break; | ||
393 | } | ||
394 | |||
395 | return (AE_OK); | ||
396 | } | ||
397 | |||
398 | /******************************************************************************* | ||
399 | * | ||
314 | * FUNCTION: acpi_ns_init_one_device | 400 | * FUNCTION: acpi_ns_init_one_device |
315 | * | 401 | * |
316 | * PARAMETERS: acpi_walk_callback | 402 | * PARAMETERS: acpi_walk_callback |
@@ -327,119 +413,165 @@ static acpi_status | |||
327 | acpi_ns_init_one_device(acpi_handle obj_handle, | 413 | acpi_ns_init_one_device(acpi_handle obj_handle, |
328 | u32 nesting_level, void *context, void **return_value) | 414 | u32 nesting_level, void *context, void **return_value) |
329 | { | 415 | { |
330 | struct acpi_device_walk_info *info = | 416 | struct acpi_device_walk_info *walk_info = |
331 | (struct acpi_device_walk_info *)context; | 417 | ACPI_CAST_PTR(struct acpi_device_walk_info, context); |
332 | struct acpi_parameter_info pinfo; | 418 | struct acpi_evaluate_info *info = walk_info->evaluate_info; |
333 | u32 flags; | 419 | u32 flags; |
334 | acpi_status status; | 420 | acpi_status status; |
335 | struct acpi_namespace_node *ini_node; | ||
336 | struct acpi_namespace_node *device_node; | 421 | struct acpi_namespace_node *device_node; |
337 | 422 | ||
338 | ACPI_FUNCTION_TRACE("ns_init_one_device"); | 423 | ACPI_FUNCTION_TRACE(ns_init_one_device); |
339 | 424 | ||
340 | device_node = acpi_ns_map_handle_to_node(obj_handle); | 425 | /* We are interested in Devices, Processors and thermal_zones only */ |
341 | if (!device_node) { | ||
342 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
343 | } | ||
344 | 426 | ||
345 | /* | 427 | device_node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); |
346 | * We will run _STA/_INI on Devices, Processors and thermal_zones only | ||
347 | */ | ||
348 | if ((device_node->type != ACPI_TYPE_DEVICE) && | 428 | if ((device_node->type != ACPI_TYPE_DEVICE) && |
349 | (device_node->type != ACPI_TYPE_PROCESSOR) && | 429 | (device_node->type != ACPI_TYPE_PROCESSOR) && |
350 | (device_node->type != ACPI_TYPE_THERMAL)) { | 430 | (device_node->type != ACPI_TYPE_THERMAL)) { |
351 | return_ACPI_STATUS(AE_OK); | 431 | return_ACPI_STATUS(AE_OK); |
352 | } | 432 | } |
353 | 433 | ||
354 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && | ||
355 | (!(acpi_dbg_level & ACPI_LV_INFO))) { | ||
356 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | ||
357 | } | ||
358 | |||
359 | info->device_count++; | ||
360 | |||
361 | /* | 434 | /* |
362 | * Check if the _INI method exists for this device - | 435 | * Because of an earlier namespace analysis, all subtrees that contain an |
363 | * if _INI does not exist, there is no need to run _STA | 436 | * _INI method are tagged. |
364 | * No _INI means device requires no initialization | 437 | * |
438 | * If this device subtree does not contain any _INI methods, we | ||
439 | * can exit now and stop traversing this entire subtree. | ||
365 | */ | 440 | */ |
366 | status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), | 441 | if (!(device_node->flags & ANOBJ_SUBTREE_HAS_INI)) { |
367 | device_node, ACPI_TYPE_METHOD, &ini_node); | 442 | return_ACPI_STATUS(AE_CTRL_DEPTH); |
368 | if (ACPI_FAILURE(status)) { | ||
369 | /* No _INI method found - move on to next device */ | ||
370 | |||
371 | return_ACPI_STATUS(AE_OK); | ||
372 | } | 443 | } |
373 | 444 | ||
374 | /* | 445 | /* |
375 | * Run _STA to determine if we can run _INI on the device - | 446 | * Run _STA to determine if this device is present and functioning. We |
376 | * the device must be present before _INI can be run. | 447 | * must know this information for two important reasons (from ACPI spec): |
377 | * However, _STA is not required - assume device present if no _STA | 448 | * |
449 | * 1) We can only run _INI if the device is present. | ||
450 | * 2) We must abort the device tree walk on this subtree if the device is | ||
451 | * not present and is not functional (we will not examine the children) | ||
452 | * | ||
453 | * The _STA method is not required to be present under the device, we | ||
454 | * assume the device is present if _STA does not exist. | ||
378 | */ | 455 | */ |
379 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 456 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
380 | device_node, | 457 | (ACPI_TYPE_METHOD, device_node, METHOD_NAME__STA)); |
381 | METHOD_NAME__STA)); | ||
382 | |||
383 | pinfo.node = device_node; | ||
384 | pinfo.parameters = NULL; | ||
385 | pinfo.parameter_type = ACPI_PARAM_ARGS; | ||
386 | 458 | ||
387 | status = acpi_ut_execute_STA(pinfo.node, &flags); | 459 | status = acpi_ut_execute_STA(device_node, &flags); |
388 | if (ACPI_FAILURE(status)) { | 460 | if (ACPI_FAILURE(status)) { |
461 | |||
389 | /* Ignore error and move on to next device */ | 462 | /* Ignore error and move on to next device */ |
390 | 463 | ||
391 | return_ACPI_STATUS(AE_OK); | 464 | return_ACPI_STATUS(AE_OK); |
392 | } | 465 | } |
393 | 466 | ||
467 | /* | ||
468 | * Flags == -1 means that _STA was not found. In this case, we assume that | ||
469 | * the device is both present and functional. | ||
470 | * | ||
471 | * From the ACPI spec, description of _STA: | ||
472 | * | ||
473 | * "If a device object (including the processor object) does not have an | ||
474 | * _STA object, then OSPM assumes that all of the above bits are set (in | ||
475 | * other words, the device is present, ..., and functioning)" | ||
476 | */ | ||
394 | if (flags != ACPI_UINT32_MAX) { | 477 | if (flags != ACPI_UINT32_MAX) { |
395 | info->num_STA++; | 478 | walk_info->num_STA++; |
396 | } | 479 | } |
397 | 480 | ||
481 | /* | ||
482 | * Examine the PRESENT and FUNCTIONING status bits | ||
483 | * | ||
484 | * Note: ACPI spec does not seem to specify behavior for the present but | ||
485 | * not functioning case, so we assume functioning if present. | ||
486 | */ | ||
398 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { | 487 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
399 | /* Don't look at children of a not present device */ | ||
400 | 488 | ||
401 | return_ACPI_STATUS(AE_CTRL_DEPTH); | 489 | /* Device is not present, we must examine the Functioning bit */ |
490 | |||
491 | if (flags & ACPI_STA_DEVICE_FUNCTIONING) { | ||
492 | /* | ||
493 | * Device is not present but is "functioning". In this case, | ||
494 | * we will not run _INI, but we continue to examine the children | ||
495 | * of this device. | ||
496 | * | ||
497 | * From the ACPI spec, description of _STA: (Note - no mention | ||
498 | * of whether to run _INI or not on the device in question) | ||
499 | * | ||
500 | * "_STA may return bit 0 clear (not present) with bit 3 set | ||
501 | * (device is functional). This case is used to indicate a valid | ||
502 | * device for which no device driver should be loaded (for example, | ||
503 | * a bridge device.) Children of this device may be present and | ||
504 | * valid. OSPM should continue enumeration below a device whose | ||
505 | * _STA returns this bit combination" | ||
506 | */ | ||
507 | return_ACPI_STATUS(AE_OK); | ||
508 | } else { | ||
509 | /* | ||
510 | * Device is not present and is not functioning. We must abort the | ||
511 | * walk of this subtree immediately -- don't look at the children | ||
512 | * of such a device. | ||
513 | * | ||
514 | * From the ACPI spec, description of _INI: | ||
515 | * | ||
516 | * "If the _STA method indicates that the device is not present, | ||
517 | * OSPM will not run the _INI and will not examine the children | ||
518 | * of the device for _INI methods" | ||
519 | */ | ||
520 | return_ACPI_STATUS(AE_CTRL_DEPTH); | ||
521 | } | ||
402 | } | 522 | } |
403 | 523 | ||
404 | /* | 524 | /* |
405 | * The device is present and _INI exists. Run the _INI method. | 525 | * The device is present or is assumed present if no _STA exists. |
406 | * (We already have the _INI node from above) | 526 | * Run the _INI if it exists (not required to exist) |
527 | * | ||
528 | * Note: We know there is an _INI within this subtree, but it may not be | ||
529 | * under this particular device, it may be lower in the branch. | ||
407 | */ | 530 | */ |
408 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 531 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
409 | pinfo.node, | 532 | (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI)); |
410 | METHOD_NAME__INI)); | 533 | |
534 | info->prefix_node = device_node; | ||
535 | info->pathname = METHOD_NAME__INI; | ||
536 | info->parameters = NULL; | ||
537 | info->parameter_type = ACPI_PARAM_ARGS; | ||
538 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
539 | |||
540 | status = acpi_ns_evaluate(info); | ||
541 | if (ACPI_SUCCESS(status)) { | ||
542 | walk_info->num_INI++; | ||
543 | |||
544 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && | ||
545 | (!(acpi_dbg_level & ACPI_LV_INFO))) { | ||
546 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | ||
547 | } | ||
548 | } | ||
549 | #ifdef ACPI_DEBUG_OUTPUT | ||
550 | else if (status != AE_NOT_FOUND) { | ||
411 | 551 | ||
412 | pinfo.node = ini_node; | ||
413 | status = acpi_ns_evaluate_by_handle(&pinfo); | ||
414 | if (ACPI_FAILURE(status)) { | ||
415 | /* Ignore error and move on to next device */ | 552 | /* Ignore error and move on to next device */ |
416 | 553 | ||
417 | #ifdef ACPI_DEBUG_OUTPUT | 554 | char *scope_name = |
418 | char *scope_name = acpi_ns_get_external_pathname(ini_node); | 555 | acpi_ns_get_external_pathname(info->resolved_node); |
419 | |||
420 | ACPI_WARNING((AE_INFO, "%s._INI failed: %s", | ||
421 | scope_name, acpi_format_exception(status))); | ||
422 | 556 | ||
423 | ACPI_MEM_FREE(scope_name); | 557 | ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", |
558 | scope_name)); | ||
559 | ACPI_FREE(scope_name); | ||
560 | } | ||
424 | #endif | 561 | #endif |
425 | } else { | ||
426 | /* Delete any return object (especially if implicit_return is enabled) */ | ||
427 | 562 | ||
428 | if (pinfo.return_object) { | 563 | /* Ignore errors from above */ |
429 | acpi_ut_remove_reference(pinfo.return_object); | ||
430 | } | ||
431 | 564 | ||
432 | /* Count of successful INIs */ | 565 | status = AE_OK; |
433 | |||
434 | info->num_INI++; | ||
435 | } | ||
436 | 566 | ||
567 | /* | ||
568 | * The _INI method has been run if present; call the Global Initialization | ||
569 | * Handler for this device. | ||
570 | */ | ||
437 | if (acpi_gbl_init_handler) { | 571 | if (acpi_gbl_init_handler) { |
438 | /* External initialization handler is present, call it */ | ||
439 | |||
440 | status = | 572 | status = |
441 | acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); | 573 | acpi_gbl_init_handler(device_node, ACPI_INIT_DEVICE_INI); |
442 | } | 574 | } |
443 | 575 | ||
444 | return_ACPI_STATUS(AE_OK); | 576 | return_ACPI_STATUS(status); |
445 | } | 577 | } |
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 4e0b0524c188..fe75d888e183 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c | |||
@@ -77,13 +77,14 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, | |||
77 | { | 77 | { |
78 | acpi_status status; | 78 | acpi_status status; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ns_load_table"); | 80 | ACPI_FUNCTION_TRACE(ns_load_table); |
81 | 81 | ||
82 | /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ | 82 | /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ |
83 | 83 | ||
84 | if (! | 84 | if (! |
85 | (acpi_gbl_table_data[table_desc->type]. | 85 | (acpi_gbl_table_data[table_desc->type]. |
86 | flags & ACPI_TABLE_EXECUTABLE)) { | 86 | flags & ACPI_TABLE_EXECUTABLE)) { |
87 | |||
87 | /* Just ignore this table */ | 88 | /* Just ignore this table */ |
88 | 89 | ||
89 | return_ACPI_STATUS(AE_OK); | 90 | return_ACPI_STATUS(AE_OK); |
@@ -168,7 +169,7 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | |||
168 | acpi_status status; | 169 | acpi_status status; |
169 | struct acpi_table_desc *table_desc; | 170 | struct acpi_table_desc *table_desc; |
170 | 171 | ||
171 | ACPI_FUNCTION_TRACE("ns_load_table_by_type"); | 172 | ACPI_FUNCTION_TRACE(ns_load_table_by_type); |
172 | 173 | ||
173 | status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | 174 | status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
174 | if (ACPI_FAILURE(status)) { | 175 | if (ACPI_FAILURE(status)) { |
@@ -180,11 +181,11 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | |||
180 | * DSDT (one), SSDT/PSDT (multiple) | 181 | * DSDT (one), SSDT/PSDT (multiple) |
181 | */ | 182 | */ |
182 | switch (table_type) { | 183 | switch (table_type) { |
183 | case ACPI_TABLE_DSDT: | 184 | case ACPI_TABLE_ID_DSDT: |
184 | 185 | ||
185 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n")); | 186 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n")); |
186 | 187 | ||
187 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next; | 188 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_DSDT].next; |
188 | 189 | ||
189 | /* If table already loaded into namespace, just return */ | 190 | /* If table already loaded into namespace, just return */ |
190 | 191 | ||
@@ -200,8 +201,8 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | |||
200 | } | 201 | } |
201 | break; | 202 | break; |
202 | 203 | ||
203 | case ACPI_TABLE_SSDT: | 204 | case ACPI_TABLE_ID_SSDT: |
204 | case ACPI_TABLE_PSDT: | 205 | case ACPI_TABLE_ID_PSDT: |
205 | 206 | ||
206 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 207 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
207 | "Namespace load: %d SSDT or PSDTs\n", | 208 | "Namespace load: %d SSDT or PSDTs\n", |
@@ -258,7 +259,7 @@ acpi_status acpi_ns_load_namespace(void) | |||
258 | { | 259 | { |
259 | acpi_status status; | 260 | acpi_status status; |
260 | 261 | ||
261 | ACPI_FUNCTION_TRACE("acpi_load_name_space"); | 262 | ACPI_FUNCTION_TRACE(acpi_load_name_space); |
262 | 263 | ||
263 | /* There must be at least a DSDT installed */ | 264 | /* There must be at least a DSDT installed */ |
264 | 265 | ||
@@ -271,15 +272,15 @@ acpi_status acpi_ns_load_namespace(void) | |||
271 | * Load the namespace. The DSDT is required, | 272 | * Load the namespace. The DSDT is required, |
272 | * but the SSDT and PSDT tables are optional. | 273 | * but the SSDT and PSDT tables are optional. |
273 | */ | 274 | */ |
274 | status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT); | 275 | status = acpi_ns_load_table_by_type(ACPI_TABLE_ID_DSDT); |
275 | if (ACPI_FAILURE(status)) { | 276 | if (ACPI_FAILURE(status)) { |
276 | return_ACPI_STATUS(status); | 277 | return_ACPI_STATUS(status); |
277 | } | 278 | } |
278 | 279 | ||
279 | /* Ignore exceptions from these */ | 280 | /* Ignore exceptions from these */ |
280 | 281 | ||
281 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT); | 282 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_SSDT); |
282 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT); | 283 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_PSDT); |
283 | 284 | ||
284 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 285 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
285 | "ACPI Namespace successfully loaded at root %p\n", | 286 | "ACPI Namespace successfully loaded at root %p\n", |
@@ -314,7 +315,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | |||
314 | acpi_handle dummy; | 315 | acpi_handle dummy; |
315 | u32 level; | 316 | u32 level; |
316 | 317 | ||
317 | ACPI_FUNCTION_TRACE("ns_delete_subtree"); | 318 | ACPI_FUNCTION_TRACE(ns_delete_subtree); |
318 | 319 | ||
319 | parent_handle = start_handle; | 320 | parent_handle = start_handle; |
320 | child_handle = NULL; | 321 | child_handle = NULL; |
@@ -325,6 +326,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | |||
325 | * to where we started. | 326 | * to where we started. |
326 | */ | 327 | */ |
327 | while (level > 0) { | 328 | while (level > 0) { |
329 | |||
328 | /* Attempt to get the next object in this scope */ | 330 | /* Attempt to get the next object in this scope */ |
329 | 331 | ||
330 | status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, | 332 | status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, |
@@ -335,6 +337,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | |||
335 | /* Did we get a new object? */ | 337 | /* Did we get a new object? */ |
336 | 338 | ||
337 | if (ACPI_SUCCESS(status)) { | 339 | if (ACPI_SUCCESS(status)) { |
340 | |||
338 | /* Check if this object has any children */ | 341 | /* Check if this object has any children */ |
339 | 342 | ||
340 | if (ACPI_SUCCESS | 343 | if (ACPI_SUCCESS |
@@ -392,7 +395,7 @@ acpi_status acpi_ns_unload_namespace(acpi_handle handle) | |||
392 | { | 395 | { |
393 | acpi_status status; | 396 | acpi_status status; |
394 | 397 | ||
395 | ACPI_FUNCTION_TRACE("ns_unload_name_space"); | 398 | ACPI_FUNCTION_TRACE(ns_unload_name_space); |
396 | 399 | ||
397 | /* Parameter validation */ | 400 | /* Parameter validation */ |
398 | 401 | ||
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index 639f653b4b6b..97b8332c9746 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c | |||
@@ -48,11 +48,6 @@ | |||
48 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
49 | ACPI_MODULE_NAME("nsnames") | 49 | ACPI_MODULE_NAME("nsnames") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
52 | static void | ||
53 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | ||
54 | acpi_size size, char *name_buffer); | ||
55 | |||
56 | /******************************************************************************* | 51 | /******************************************************************************* |
57 | * | 52 | * |
58 | * FUNCTION: acpi_ns_build_external_path | 53 | * FUNCTION: acpi_ns_build_external_path |
@@ -67,8 +62,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
67 | * DESCRIPTION: Generate a full pathaname | 62 | * DESCRIPTION: Generate a full pathaname |
68 | * | 63 | * |
69 | ******************************************************************************/ | 64 | ******************************************************************************/ |
70 | 65 | void | |
71 | static void | ||
72 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | 66 | acpi_ns_build_external_path(struct acpi_namespace_node *node, |
73 | acpi_size size, char *name_buffer) | 67 | acpi_size size, char *name_buffer) |
74 | { | 68 | { |
@@ -138,7 +132,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
138 | char *name_buffer; | 132 | char *name_buffer; |
139 | acpi_size size; | 133 | acpi_size size; |
140 | 134 | ||
141 | ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node); | 135 | ACPI_FUNCTION_TRACE_PTR(ns_get_external_pathname, node); |
142 | 136 | ||
143 | /* Calculate required buffer size based on depth below root */ | 137 | /* Calculate required buffer size based on depth below root */ |
144 | 138 | ||
@@ -146,7 +140,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
146 | 140 | ||
147 | /* Allocate a buffer to be returned to caller */ | 141 | /* Allocate a buffer to be returned to caller */ |
148 | 142 | ||
149 | name_buffer = ACPI_MEM_CALLOCATE(size); | 143 | name_buffer = ACPI_ALLOCATE_ZEROED(size); |
150 | if (!name_buffer) { | 144 | if (!name_buffer) { |
151 | ACPI_ERROR((AE_INFO, "Allocation failure")); | 145 | ACPI_ERROR((AE_INFO, "Allocation failure")); |
152 | return_PTR(NULL); | 146 | return_PTR(NULL); |
@@ -219,7 +213,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, | |||
219 | struct acpi_namespace_node *node; | 213 | struct acpi_namespace_node *node; |
220 | acpi_size required_size; | 214 | acpi_size required_size; |
221 | 215 | ||
222 | ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle); | 216 | ACPI_FUNCTION_TRACE_PTR(ns_handle_to_pathname, target_handle); |
223 | 217 | ||
224 | node = acpi_ns_map_handle_to_node(target_handle); | 218 | node = acpi_ns_map_handle_to_node(target_handle); |
225 | if (!node) { | 219 | if (!node) { |
diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index 10ae6292bca4..aabe8794b908 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c | |||
@@ -76,19 +76,21 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, | |||
76 | union acpi_operand_object *last_obj_desc; | 76 | union acpi_operand_object *last_obj_desc; |
77 | acpi_object_type object_type = ACPI_TYPE_ANY; | 77 | acpi_object_type object_type = ACPI_TYPE_ANY; |
78 | 78 | ||
79 | ACPI_FUNCTION_TRACE("ns_attach_object"); | 79 | ACPI_FUNCTION_TRACE(ns_attach_object); |
80 | 80 | ||
81 | /* | 81 | /* |
82 | * Parameter validation | 82 | * Parameter validation |
83 | */ | 83 | */ |
84 | if (!node) { | 84 | if (!node) { |
85 | |||
85 | /* Invalid handle */ | 86 | /* Invalid handle */ |
86 | 87 | ||
87 | ACPI_ERROR((AE_INFO, "Null named_obj handle")); | 88 | ACPI_ERROR((AE_INFO, "Null NamedObj handle")); |
88 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 89 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
89 | } | 90 | } |
90 | 91 | ||
91 | if (!object && (ACPI_TYPE_ANY != type)) { | 92 | if (!object && (ACPI_TYPE_ANY != type)) { |
93 | |||
92 | /* Null object */ | 94 | /* Null object */ |
93 | 95 | ||
94 | ACPI_ERROR((AE_INFO, | 96 | ACPI_ERROR((AE_INFO, |
@@ -97,6 +99,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, | |||
97 | } | 99 | } |
98 | 100 | ||
99 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { | 101 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { |
102 | |||
100 | /* Not a name handle */ | 103 | /* Not a name handle */ |
101 | 104 | ||
102 | ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", | 105 | ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", |
@@ -108,7 +111,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, | |||
108 | 111 | ||
109 | if (node->object == object) { | 112 | if (node->object == object) { |
110 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 113 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
111 | "Obj %p already installed in name_obj %p\n", | 114 | "Obj %p already installed in NameObj %p\n", |
112 | object, node)); | 115 | object, node)); |
113 | 116 | ||
114 | return_ACPI_STATUS(AE_OK); | 117 | return_ACPI_STATUS(AE_OK); |
@@ -201,7 +204,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) | |||
201 | { | 204 | { |
202 | union acpi_operand_object *obj_desc; | 205 | union acpi_operand_object *obj_desc; |
203 | 206 | ||
204 | ACPI_FUNCTION_TRACE("ns_detach_object"); | 207 | ACPI_FUNCTION_TRACE(ns_detach_object); |
205 | 208 | ||
206 | obj_desc = node->object; | 209 | obj_desc = node->object; |
207 | 210 | ||
@@ -252,7 +255,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct | |||
252 | acpi_namespace_node | 255 | acpi_namespace_node |
253 | *node) | 256 | *node) |
254 | { | 257 | { |
255 | ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node); | 258 | ACPI_FUNCTION_TRACE_PTR(ns_get_attached_object, node); |
256 | 259 | ||
257 | if (!node) { | 260 | if (!node) { |
258 | ACPI_WARNING((AE_INFO, "Null Node ptr")); | 261 | ACPI_WARNING((AE_INFO, "Null Node ptr")); |
@@ -287,7 +290,7 @@ union acpi_operand_object *acpi_ns_get_secondary_object(union | |||
287 | acpi_operand_object | 290 | acpi_operand_object |
288 | *obj_desc) | 291 | *obj_desc) |
289 | { | 292 | { |
290 | ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc); | 293 | ACPI_FUNCTION_TRACE_PTR(ns_get_secondary_object, obj_desc); |
291 | 294 | ||
292 | if ((!obj_desc) || | 295 | if ((!obj_desc) || |
293 | (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) || | 296 | (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) || |
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 232be4303653..155505a4ef69 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c | |||
@@ -62,13 +62,13 @@ ACPI_MODULE_NAME("nsparse") | |||
62 | * | 62 | * |
63 | ******************************************************************************/ | 63 | ******************************************************************************/ |
64 | acpi_status | 64 | acpi_status |
65 | acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc) | 65 | acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc) |
66 | { | 66 | { |
67 | union acpi_parse_object *parse_root; | 67 | union acpi_parse_object *parse_root; |
68 | acpi_status status; | 68 | acpi_status status; |
69 | struct acpi_walk_state *walk_state; | 69 | struct acpi_walk_state *walk_state; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ns_one_complete_parse"); | 71 | ACPI_FUNCTION_TRACE(ns_one_complete_parse); |
72 | 72 | ||
73 | /* Create and init a Root Node */ | 73 | /* Create and init a Root Node */ |
74 | 74 | ||
@@ -124,7 +124,7 @@ acpi_ns_parse_table(struct acpi_table_desc *table_desc, | |||
124 | { | 124 | { |
125 | acpi_status status; | 125 | acpi_status status; |
126 | 126 | ||
127 | ACPI_FUNCTION_TRACE("ns_parse_table"); | 127 | ACPI_FUNCTION_TRACE(ns_parse_table); |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * AML Parse, pass 1 | 130 | * AML Parse, pass 1 |
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index d64b78952f24..500e2bbcfaf7 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c | |||
@@ -56,16 +56,16 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
56 | 56 | ||
57 | /******************************************************************************* | 57 | /******************************************************************************* |
58 | * | 58 | * |
59 | * FUNCTION: acpi_ns_search_node | 59 | * FUNCTION: acpi_ns_search_one_scope |
60 | * | 60 | * |
61 | * PARAMETERS: target_name - Ascii ACPI name to search for | 61 | * PARAMETERS: target_name - Ascii ACPI name to search for |
62 | * Node - Starting node where search will begin | 62 | * parent_node - Starting node where search will begin |
63 | * Type - Object type to match | 63 | * Type - Object type to match |
64 | * return_node - Where the matched Named obj is returned | 64 | * return_node - Where the matched Named obj is returned |
65 | * | 65 | * |
66 | * RETURN: Status | 66 | * RETURN: Status |
67 | * | 67 | * |
68 | * DESCRIPTION: Search a single level of the namespace. Performs a | 68 | * DESCRIPTION: Search a single level of the namespace. Performs a |
69 | * simple search of the specified level, and does not add | 69 | * simple search of the specified level, and does not add |
70 | * entries or search parents. | 70 | * entries or search parents. |
71 | * | 71 | * |
@@ -75,35 +75,40 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
75 | * | 75 | * |
76 | * All namespace searching is linear in this implementation, but | 76 | * All namespace searching is linear in this implementation, but |
77 | * could be easily modified to support any improved search | 77 | * could be easily modified to support any improved search |
78 | * algorithm. However, the linear search was chosen for simplicity | 78 | * algorithm. However, the linear search was chosen for simplicity |
79 | * and because the trees are small and the other interpreter | 79 | * and because the trees are small and the other interpreter |
80 | * execution overhead is relatively high. | 80 | * execution overhead is relatively high. |
81 | * | 81 | * |
82 | * Note: CPU execution analysis has shown that the AML interpreter spends | ||
83 | * a very small percentage of its time searching the namespace. Therefore, | ||
84 | * the linear search seems to be sufficient, as there would seem to be | ||
85 | * little value in improving the search. | ||
86 | * | ||
82 | ******************************************************************************/ | 87 | ******************************************************************************/ |
83 | 88 | ||
84 | acpi_status | 89 | acpi_status |
85 | acpi_ns_search_node(u32 target_name, | 90 | acpi_ns_search_one_scope(u32 target_name, |
86 | struct acpi_namespace_node *node, | 91 | struct acpi_namespace_node *parent_node, |
87 | acpi_object_type type, | 92 | acpi_object_type type, |
88 | struct acpi_namespace_node **return_node) | 93 | struct acpi_namespace_node **return_node) |
89 | { | 94 | { |
90 | struct acpi_namespace_node *next_node; | 95 | struct acpi_namespace_node *node; |
91 | 96 | ||
92 | ACPI_FUNCTION_TRACE("ns_search_node"); | 97 | ACPI_FUNCTION_TRACE(ns_search_one_scope); |
93 | 98 | ||
94 | #ifdef ACPI_DEBUG_OUTPUT | 99 | #ifdef ACPI_DEBUG_OUTPUT |
95 | if (ACPI_LV_NAMES & acpi_dbg_level) { | 100 | if (ACPI_LV_NAMES & acpi_dbg_level) { |
96 | char *scope_name; | 101 | char *scope_name; |
97 | 102 | ||
98 | scope_name = acpi_ns_get_external_pathname(node); | 103 | scope_name = acpi_ns_get_external_pathname(parent_node); |
99 | if (scope_name) { | 104 | if (scope_name) { |
100 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 105 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
101 | "Searching %s (%p) For [%4.4s] (%s)\n", | 106 | "Searching %s (%p) For [%4.4s] (%s)\n", |
102 | scope_name, node, ACPI_CAST_PTR(char, | 107 | scope_name, parent_node, |
103 | &target_name), | 108 | ACPI_CAST_PTR(char, &target_name), |
104 | acpi_ut_get_type_name(type))); | 109 | acpi_ut_get_type_name(type))); |
105 | 110 | ||
106 | ACPI_MEM_FREE(scope_name); | 111 | ACPI_FREE(scope_name); |
107 | } | 112 | } |
108 | } | 113 | } |
109 | #endif | 114 | #endif |
@@ -112,32 +117,33 @@ acpi_ns_search_node(u32 target_name, | |||
112 | * Search for name at this namespace level, which is to say that we | 117 | * Search for name at this namespace level, which is to say that we |
113 | * must search for the name among the children of this object | 118 | * must search for the name among the children of this object |
114 | */ | 119 | */ |
115 | next_node = node->child; | 120 | node = parent_node->child; |
116 | while (next_node) { | 121 | while (node) { |
122 | |||
117 | /* Check for match against the name */ | 123 | /* Check for match against the name */ |
118 | 124 | ||
119 | if (next_node->name.integer == target_name) { | 125 | if (node->name.integer == target_name) { |
126 | |||
120 | /* Resolve a control method alias if any */ | 127 | /* Resolve a control method alias if any */ |
121 | 128 | ||
122 | if (acpi_ns_get_type(next_node) == | 129 | if (acpi_ns_get_type(node) == |
123 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { | 130 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { |
124 | next_node = | 131 | node = |
125 | ACPI_CAST_PTR(struct acpi_namespace_node, | 132 | ACPI_CAST_PTR(struct acpi_namespace_node, |
126 | next_node->object); | 133 | node->object); |
127 | } | 134 | } |
128 | 135 | ||
129 | /* | 136 | /* Found matching entry */ |
130 | * Found matching entry. | 137 | |
131 | */ | ||
132 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 138 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
133 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", | 139 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", |
134 | ACPI_CAST_PTR(char, &target_name), | 140 | ACPI_CAST_PTR(char, &target_name), |
135 | acpi_ut_get_type_name(next_node-> | 141 | acpi_ut_get_type_name(node->type), |
136 | type), | 142 | node, |
137 | next_node, | 143 | acpi_ut_get_node_name(parent_node), |
138 | acpi_ut_get_node_name(node), node)); | 144 | parent_node)); |
139 | 145 | ||
140 | *return_node = next_node; | 146 | *return_node = node; |
141 | return_ACPI_STATUS(AE_OK); | 147 | return_ACPI_STATUS(AE_OK); |
142 | } | 148 | } |
143 | 149 | ||
@@ -145,7 +151,8 @@ acpi_ns_search_node(u32 target_name, | |||
145 | * The last entry in the list points back to the parent, | 151 | * The last entry in the list points back to the parent, |
146 | * so a flag is used to indicate the end-of-list | 152 | * so a flag is used to indicate the end-of-list |
147 | */ | 153 | */ |
148 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { | 154 | if (node->flags & ANOBJ_END_OF_PEER_LIST) { |
155 | |||
149 | /* Searched entire list, we are done */ | 156 | /* Searched entire list, we are done */ |
150 | 157 | ||
151 | break; | 158 | break; |
@@ -153,7 +160,7 @@ acpi_ns_search_node(u32 target_name, | |||
153 | 160 | ||
154 | /* Didn't match name, move on to the next peer object */ | 161 | /* Didn't match name, move on to the next peer object */ |
155 | 162 | ||
156 | next_node = next_node->peer; | 163 | node = node->peer; |
157 | } | 164 | } |
158 | 165 | ||
159 | /* Searched entire namespace level, not found */ | 166 | /* Searched entire namespace level, not found */ |
@@ -162,7 +169,8 @@ acpi_ns_search_node(u32 target_name, | |||
162 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", | 169 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", |
163 | ACPI_CAST_PTR(char, &target_name), | 170 | ACPI_CAST_PTR(char, &target_name), |
164 | acpi_ut_get_type_name(type), | 171 | acpi_ut_get_type_name(type), |
165 | acpi_ut_get_node_name(node), node, node->child)); | 172 | acpi_ut_get_node_name(parent_node), parent_node, |
173 | parent_node->child)); | ||
166 | 174 | ||
167 | return_ACPI_STATUS(AE_NOT_FOUND); | 175 | return_ACPI_STATUS(AE_NOT_FOUND); |
168 | } | 176 | } |
@@ -179,14 +187,14 @@ acpi_ns_search_node(u32 target_name, | |||
179 | * RETURN: Status | 187 | * RETURN: Status |
180 | * | 188 | * |
181 | * DESCRIPTION: Called when a name has not been found in the current namespace | 189 | * DESCRIPTION: Called when a name has not been found in the current namespace |
182 | * level. Before adding it or giving up, ACPI scope rules require | 190 | * level. Before adding it or giving up, ACPI scope rules require |
183 | * searching enclosing scopes in cases identified by acpi_ns_local(). | 191 | * searching enclosing scopes in cases identified by acpi_ns_local(). |
184 | * | 192 | * |
185 | * "A name is located by finding the matching name in the current | 193 | * "A name is located by finding the matching name in the current |
186 | * name space, and then in the parent name space. If the parent | 194 | * name space, and then in the parent name space. If the parent |
187 | * name space does not contain the name, the search continues | 195 | * name space does not contain the name, the search continues |
188 | * recursively until either the name is found or the name space | 196 | * recursively until either the name is found or the name space |
189 | * does not have a parent (the root of the name space). This | 197 | * does not have a parent (the root of the name space). This |
190 | * indicates that the name is not found" (From ACPI Specification, | 198 | * indicates that the name is not found" (From ACPI Specification, |
191 | * section 5.3) | 199 | * section 5.3) |
192 | * | 200 | * |
@@ -201,7 +209,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
201 | acpi_status status; | 209 | acpi_status status; |
202 | struct acpi_namespace_node *parent_node; | 210 | struct acpi_namespace_node *parent_node; |
203 | 211 | ||
204 | ACPI_FUNCTION_TRACE("ns_search_parent_tree"); | 212 | ACPI_FUNCTION_TRACE(ns_search_parent_tree); |
205 | 213 | ||
206 | parent_node = acpi_ns_get_parent_node(node); | 214 | parent_node = acpi_ns_get_parent_node(node); |
207 | 215 | ||
@@ -235,20 +243,19 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
235 | */ | 243 | */ |
236 | while (parent_node) { | 244 | while (parent_node) { |
237 | /* | 245 | /* |
238 | * Search parent scope. Use TYPE_ANY because we don't care about the | 246 | * Search parent scope. Use TYPE_ANY because we don't care about the |
239 | * object type at this point, we only care about the existence of | 247 | * object type at this point, we only care about the existence of |
240 | * the actual name we are searching for. Typechecking comes later. | 248 | * the actual name we are searching for. Typechecking comes later. |
241 | */ | 249 | */ |
242 | status = acpi_ns_search_node(target_name, parent_node, | 250 | status = |
251 | acpi_ns_search_one_scope(target_name, parent_node, | ||
243 | ACPI_TYPE_ANY, return_node); | 252 | ACPI_TYPE_ANY, return_node); |
244 | if (ACPI_SUCCESS(status)) { | 253 | if (ACPI_SUCCESS(status)) { |
245 | return_ACPI_STATUS(status); | 254 | return_ACPI_STATUS(status); |
246 | } | 255 | } |
247 | 256 | ||
248 | /* | 257 | /* Not found here, go up another level (until we reach the root) */ |
249 | * Not found here, go up another level | 258 | |
250 | * (until we reach the root) | ||
251 | */ | ||
252 | parent_node = acpi_ns_get_parent_node(parent_node); | 259 | parent_node = acpi_ns_get_parent_node(parent_node); |
253 | } | 260 | } |
254 | 261 | ||
@@ -273,7 +280,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
273 | * RETURN: Status | 280 | * RETURN: Status |
274 | * | 281 | * |
275 | * DESCRIPTION: Search for a name segment in a single namespace level, | 282 | * DESCRIPTION: Search for a name segment in a single namespace level, |
276 | * optionally adding it if it is not found. If the passed | 283 | * optionally adding it if it is not found. If the passed |
277 | * Type is not Any and the type previously stored in the | 284 | * Type is not Any and the type previously stored in the |
278 | * entry was Any (i.e. unknown), update the stored type. | 285 | * entry was Any (i.e. unknown), update the stored type. |
279 | * | 286 | * |
@@ -293,29 +300,46 @@ acpi_ns_search_and_enter(u32 target_name, | |||
293 | acpi_status status; | 300 | acpi_status status; |
294 | struct acpi_namespace_node *new_node; | 301 | struct acpi_namespace_node *new_node; |
295 | 302 | ||
296 | ACPI_FUNCTION_TRACE("ns_search_and_enter"); | 303 | ACPI_FUNCTION_TRACE(ns_search_and_enter); |
297 | 304 | ||
298 | /* Parameter validation */ | 305 | /* Parameter validation */ |
299 | 306 | ||
300 | if (!node || !target_name || !return_node) { | 307 | if (!node || !target_name || !return_node) { |
301 | ACPI_ERROR((AE_INFO, | 308 | ACPI_ERROR((AE_INFO, |
302 | "Null param: Node %p Name %X return_node %p", | 309 | "Null parameter: Node %p Name %X ReturnNode %p", |
303 | node, target_name, return_node)); | 310 | node, target_name, return_node)); |
304 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 311 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
305 | } | 312 | } |
306 | 313 | ||
307 | /* Name must consist of printable characters */ | 314 | /* |
308 | 315 | * Name must consist of valid ACPI characters. We will repair the name if | |
316 | * necessary because we don't want to abort because of this, but we want | ||
317 | * all namespace names to be printable. A warning message is appropriate. | ||
318 | * | ||
319 | * This issue came up because there are in fact machines that exhibit | ||
320 | * this problem, and we want to be able to enable ACPI support for them, | ||
321 | * even though there are a few bad names. | ||
322 | */ | ||
309 | if (!acpi_ut_valid_acpi_name(target_name)) { | 323 | if (!acpi_ut_valid_acpi_name(target_name)) { |
310 | ACPI_ERROR((AE_INFO, "Bad character in ACPI Name: %X", | 324 | target_name = acpi_ut_repair_name(target_name); |
311 | target_name)); | 325 | |
312 | return_ACPI_STATUS(AE_BAD_CHARACTER); | 326 | /* Report warning only if in strict mode or debug mode */ |
327 | |||
328 | if (!acpi_gbl_enable_interpreter_slack) { | ||
329 | ACPI_WARNING((AE_INFO, | ||
330 | "Found bad character(s) in name, repaired: [%4.4s]\n", | ||
331 | ACPI_CAST_PTR(char, &target_name))); | ||
332 | } else { | ||
333 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | ||
334 | "Found bad character(s) in name, repaired: [%4.4s]\n", | ||
335 | ACPI_CAST_PTR(char, &target_name))); | ||
336 | } | ||
313 | } | 337 | } |
314 | 338 | ||
315 | /* Try to find the name in the namespace level specified by the caller */ | 339 | /* Try to find the name in the namespace level specified by the caller */ |
316 | 340 | ||
317 | *return_node = ACPI_ENTRY_NOT_FOUND; | 341 | *return_node = ACPI_ENTRY_NOT_FOUND; |
318 | status = acpi_ns_search_node(target_name, node, type, return_node); | 342 | status = acpi_ns_search_one_scope(target_name, node, type, return_node); |
319 | if (status != AE_NOT_FOUND) { | 343 | if (status != AE_NOT_FOUND) { |
320 | /* | 344 | /* |
321 | * If we found it AND the request specifies that a find is an error, | 345 | * If we found it AND the request specifies that a find is an error, |
@@ -325,18 +349,16 @@ acpi_ns_search_and_enter(u32 target_name, | |||
325 | status = AE_ALREADY_EXISTS; | 349 | status = AE_ALREADY_EXISTS; |
326 | } | 350 | } |
327 | 351 | ||
328 | /* | 352 | /* Either found it or there was an error: finished either way */ |
329 | * Either found it or there was an error | 353 | |
330 | * -- finished either way | ||
331 | */ | ||
332 | return_ACPI_STATUS(status); | 354 | return_ACPI_STATUS(status); |
333 | } | 355 | } |
334 | 356 | ||
335 | /* | 357 | /* |
336 | * The name was not found. If we are NOT performing the first pass | 358 | * The name was not found. If we are NOT performing the first pass |
337 | * (name entry) of loading the namespace, search the parent tree (all the | 359 | * (name entry) of loading the namespace, search the parent tree (all the |
338 | * way to the root if necessary.) We don't want to perform the parent | 360 | * way to the root if necessary.) We don't want to perform the parent |
339 | * search when the namespace is actually being loaded. We want to perform | 361 | * search when the namespace is actually being loaded. We want to perform |
340 | * the search when namespace references are being resolved (load pass 2) | 362 | * the search when namespace references are being resolved (load pass 2) |
341 | * and during the execution phase. | 363 | * and during the execution phase. |
342 | */ | 364 | */ |
@@ -354,9 +376,8 @@ acpi_ns_search_and_enter(u32 target_name, | |||
354 | } | 376 | } |
355 | } | 377 | } |
356 | 378 | ||
357 | /* | 379 | /* In execute mode, just search, never add names. Exit now */ |
358 | * In execute mode, just search, never add names. Exit now. | 380 | |
359 | */ | ||
360 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { | 381 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { |
361 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 382 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
362 | "%4.4s Not found in %p [Not adding]\n", | 383 | "%4.4s Not found in %p [Not adding]\n", |
@@ -371,11 +392,18 @@ acpi_ns_search_and_enter(u32 target_name, | |||
371 | if (!new_node) { | 392 | if (!new_node) { |
372 | return_ACPI_STATUS(AE_NO_MEMORY); | 393 | return_ACPI_STATUS(AE_NO_MEMORY); |
373 | } | 394 | } |
395 | #ifdef ACPI_ASL_COMPILER | ||
396 | /* | ||
397 | * Node is an object defined by an External() statement | ||
398 | */ | ||
399 | if (flags & ACPI_NS_EXTERNAL) { | ||
400 | new_node->flags |= ANOBJ_IS_EXTERNAL; | ||
401 | } | ||
402 | #endif | ||
374 | 403 | ||
375 | /* Install the new object into the parent's list of children */ | 404 | /* Install the new object into the parent's list of children */ |
376 | 405 | ||
377 | acpi_ns_install_node(walk_state, node, new_node, type); | 406 | acpi_ns_install_node(walk_state, node, new_node, type); |
378 | *return_node = new_node; | 407 | *return_node = new_node; |
379 | |||
380 | return_ACPI_STATUS(AE_OK); | 408 | return_ACPI_STATUS(AE_OK); |
381 | } | 409 | } |
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 3e7cad549a38..aa4e799d9a8c 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c | |||
@@ -78,15 +78,17 @@ acpi_ns_report_error(char *module_name, | |||
78 | char *internal_name, acpi_status lookup_status) | 78 | char *internal_name, acpi_status lookup_status) |
79 | { | 79 | { |
80 | acpi_status status; | 80 | acpi_status status; |
81 | u32 bad_name; | ||
81 | char *name = NULL; | 82 | char *name = NULL; |
82 | 83 | ||
83 | acpi_ut_report_error(module_name, line_number); | 84 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); |
84 | 85 | ||
85 | if (lookup_status == AE_BAD_CHARACTER) { | 86 | if (lookup_status == AE_BAD_CHARACTER) { |
87 | |||
86 | /* There is a non-ascii character in the name */ | 88 | /* There is a non-ascii character in the name */ |
87 | 89 | ||
88 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", | 90 | ACPI_MOVE_32_TO_32(&bad_name, internal_name); |
89 | *(ACPI_CAST_PTR(u32, internal_name))); | 91 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); |
90 | } else { | 92 | } else { |
91 | /* Convert path to external format */ | 93 | /* Convert path to external format */ |
92 | 94 | ||
@@ -102,7 +104,7 @@ acpi_ns_report_error(char *module_name, | |||
102 | } | 104 | } |
103 | 105 | ||
104 | if (name) { | 106 | if (name) { |
105 | ACPI_MEM_FREE(name); | 107 | ACPI_FREE(name); |
106 | } | 108 | } |
107 | } | 109 | } |
108 | 110 | ||
@@ -137,11 +139,12 @@ acpi_ns_report_method_error(char *module_name, | |||
137 | acpi_status status; | 139 | acpi_status status; |
138 | struct acpi_namespace_node *node = prefix_node; | 140 | struct acpi_namespace_node *node = prefix_node; |
139 | 141 | ||
140 | acpi_ut_report_error(module_name, line_number); | 142 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); |
141 | 143 | ||
142 | if (path) { | 144 | if (path) { |
143 | status = acpi_ns_get_node_by_path(path, prefix_node, | 145 | status = |
144 | ACPI_NS_NO_UPSEARCH, &node); | 146 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, |
147 | &node); | ||
145 | if (ACPI_FAILURE(status)) { | 148 | if (ACPI_FAILURE(status)) { |
146 | acpi_os_printf("[Could not get node by pathname]"); | 149 | acpi_os_printf("[Could not get node by pathname]"); |
147 | } | 150 | } |
@@ -185,7 +188,7 @@ acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message) | |||
185 | } | 188 | } |
186 | 189 | ||
187 | acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node); | 190 | acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node); |
188 | ACPI_MEM_FREE(buffer.pointer); | 191 | ACPI_FREE(buffer.pointer); |
189 | } | 192 | } |
190 | } | 193 | } |
191 | 194 | ||
@@ -239,7 +242,7 @@ static u8 acpi_ns_valid_path_separator(char sep) | |||
239 | 242 | ||
240 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) | 243 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) |
241 | { | 244 | { |
242 | ACPI_FUNCTION_TRACE("ns_get_type"); | 245 | ACPI_FUNCTION_TRACE(ns_get_type); |
243 | 246 | ||
244 | if (!node) { | 247 | if (!node) { |
245 | ACPI_WARNING((AE_INFO, "Null Node parameter")); | 248 | ACPI_WARNING((AE_INFO, "Null Node parameter")); |
@@ -264,9 +267,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) | |||
264 | 267 | ||
265 | u32 acpi_ns_local(acpi_object_type type) | 268 | u32 acpi_ns_local(acpi_object_type type) |
266 | { | 269 | { |
267 | ACPI_FUNCTION_TRACE("ns_local"); | 270 | ACPI_FUNCTION_TRACE(ns_local); |
268 | 271 | ||
269 | if (!acpi_ut_valid_object_type(type)) { | 272 | if (!acpi_ut_valid_object_type(type)) { |
273 | |||
270 | /* Type code out of range */ | 274 | /* Type code out of range */ |
271 | 275 | ||
272 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); | 276 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); |
@@ -363,7 +367,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
363 | char *result = NULL; | 367 | char *result = NULL; |
364 | acpi_native_uint i; | 368 | acpi_native_uint i; |
365 | 369 | ||
366 | ACPI_FUNCTION_TRACE("ns_build_internal_name"); | 370 | ACPI_FUNCTION_TRACE(ns_build_internal_name); |
367 | 371 | ||
368 | /* Setup the correct prefixes, counts, and pointers */ | 372 | /* Setup the correct prefixes, counts, and pointers */ |
369 | 373 | ||
@@ -411,6 +415,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
411 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | 415 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
412 | if (acpi_ns_valid_path_separator(*external_name) || | 416 | if (acpi_ns_valid_path_separator(*external_name) || |
413 | (*external_name == 0)) { | 417 | (*external_name == 0)) { |
418 | |||
414 | /* Pad the segment with underscore(s) if segment is short */ | 419 | /* Pad the segment with underscore(s) if segment is short */ |
415 | 420 | ||
416 | result[i] = '_'; | 421 | result[i] = '_'; |
@@ -473,7 +478,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
473 | struct acpi_namestring_info info; | 478 | struct acpi_namestring_info info; |
474 | acpi_status status; | 479 | acpi_status status; |
475 | 480 | ||
476 | ACPI_FUNCTION_TRACE("ns_internalize_name"); | 481 | ACPI_FUNCTION_TRACE(ns_internalize_name); |
477 | 482 | ||
478 | if ((!external_name) || (*external_name == 0) || (!converted_name)) { | 483 | if ((!external_name) || (*external_name == 0) || (!converted_name)) { |
479 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 484 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -486,7 +491,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
486 | 491 | ||
487 | /* We need a segment to store the internal name */ | 492 | /* We need a segment to store the internal name */ |
488 | 493 | ||
489 | internal_name = ACPI_MEM_CALLOCATE(info.length); | 494 | internal_name = ACPI_ALLOCATE_ZEROED(info.length); |
490 | if (!internal_name) { | 495 | if (!internal_name) { |
491 | return_ACPI_STATUS(AE_NO_MEMORY); | 496 | return_ACPI_STATUS(AE_NO_MEMORY); |
492 | } | 497 | } |
@@ -496,7 +501,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
496 | info.internal_name = internal_name; | 501 | info.internal_name = internal_name; |
497 | status = acpi_ns_build_internal_name(&info); | 502 | status = acpi_ns_build_internal_name(&info); |
498 | if (ACPI_FAILURE(status)) { | 503 | if (ACPI_FAILURE(status)) { |
499 | ACPI_MEM_FREE(internal_name); | 504 | ACPI_FREE(internal_name); |
500 | return_ACPI_STATUS(status); | 505 | return_ACPI_STATUS(status); |
501 | } | 506 | } |
502 | 507 | ||
@@ -533,7 +538,7 @@ acpi_ns_externalize_name(u32 internal_name_length, | |||
533 | acpi_native_uint i = 0; | 538 | acpi_native_uint i = 0; |
534 | acpi_native_uint j = 0; | 539 | acpi_native_uint j = 0; |
535 | 540 | ||
536 | ACPI_FUNCTION_TRACE("ns_externalize_name"); | 541 | ACPI_FUNCTION_TRACE(ns_externalize_name); |
537 | 542 | ||
538 | if (!internal_name_length || !internal_name || !converted_name) { | 543 | if (!internal_name_length || !internal_name || !converted_name) { |
539 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 544 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -628,7 +633,7 @@ acpi_ns_externalize_name(u32 internal_name_length, | |||
628 | /* | 633 | /* |
629 | * Build converted_name | 634 | * Build converted_name |
630 | */ | 635 | */ |
631 | *converted_name = ACPI_MEM_CALLOCATE(required_length); | 636 | *converted_name = ACPI_ALLOCATE_ZEROED(required_length); |
632 | if (!(*converted_name)) { | 637 | if (!(*converted_name)) { |
633 | return_ACPI_STATUS(AE_NO_MEMORY); | 638 | return_ACPI_STATUS(AE_NO_MEMORY); |
634 | } | 639 | } |
@@ -681,13 +686,9 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) | |||
681 | ACPI_FUNCTION_ENTRY(); | 686 | ACPI_FUNCTION_ENTRY(); |
682 | 687 | ||
683 | /* | 688 | /* |
684 | * Simple implementation. | 689 | * Simple implementation |
685 | */ | 690 | */ |
686 | if (!handle) { | 691 | if ((!handle) || (handle == ACPI_ROOT_OBJECT)) { |
687 | return (NULL); | ||
688 | } | ||
689 | |||
690 | if (handle == ACPI_ROOT_OBJECT) { | ||
691 | return (acpi_gbl_root_node); | 692 | return (acpi_gbl_root_node); |
692 | } | 693 | } |
693 | 694 | ||
@@ -697,7 +698,7 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) | |||
697 | return (NULL); | 698 | return (NULL); |
698 | } | 699 | } |
699 | 700 | ||
700 | return ((struct acpi_namespace_node *)handle); | 701 | return (ACPI_CAST_PTR(struct acpi_namespace_node, handle)); |
701 | } | 702 | } |
702 | 703 | ||
703 | /******************************************************************************* | 704 | /******************************************************************************* |
@@ -752,7 +753,7 @@ void acpi_ns_terminate(void) | |||
752 | { | 753 | { |
753 | union acpi_operand_object *obj_desc; | 754 | union acpi_operand_object *obj_desc; |
754 | 755 | ||
755 | ACPI_FUNCTION_TRACE("ns_terminate"); | 756 | ACPI_FUNCTION_TRACE(ns_terminate); |
756 | 757 | ||
757 | /* | 758 | /* |
758 | * 1) Free the entire namespace -- all nodes and objects | 759 | * 1) Free the entire namespace -- all nodes and objects |
@@ -792,9 +793,10 @@ void acpi_ns_terminate(void) | |||
792 | 793 | ||
793 | u32 acpi_ns_opens_scope(acpi_object_type type) | 794 | u32 acpi_ns_opens_scope(acpi_object_type type) |
794 | { | 795 | { |
795 | ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type)); | 796 | ACPI_FUNCTION_TRACE_STR(ns_opens_scope, acpi_ut_get_type_name(type)); |
796 | 797 | ||
797 | if (!acpi_ut_valid_object_type(type)) { | 798 | if (!acpi_ut_valid_object_type(type)) { |
799 | |||
798 | /* type code out of range */ | 800 | /* type code out of range */ |
799 | 801 | ||
800 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); | 802 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); |
@@ -806,12 +808,12 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
806 | 808 | ||
807 | /******************************************************************************* | 809 | /******************************************************************************* |
808 | * | 810 | * |
809 | * FUNCTION: acpi_ns_get_node_by_path | 811 | * FUNCTION: acpi_ns_get_node |
810 | * | 812 | * |
811 | * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The | 813 | * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The |
812 | * \ (backslash) and ^ (carat) prefixes, and the | 814 | * \ (backslash) and ^ (carat) prefixes, and the |
813 | * . (period) to separate segments are supported. | 815 | * . (period) to separate segments are supported. |
814 | * start_node - Root of subtree to be searched, or NS_ALL for the | 816 | * prefix_node - Root of subtree to be searched, or NS_ALL for the |
815 | * root of the name space. If Name is fully | 817 | * root of the name space. If Name is fully |
816 | * qualified (first s8 is '\'), the passed value | 818 | * qualified (first s8 is '\'), the passed value |
817 | * of Scope will not be accessed. | 819 | * of Scope will not be accessed. |
@@ -827,23 +829,29 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
827 | ******************************************************************************/ | 829 | ******************************************************************************/ |
828 | 830 | ||
829 | acpi_status | 831 | acpi_status |
830 | acpi_ns_get_node_by_path(char *pathname, | 832 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, |
831 | struct acpi_namespace_node *start_node, | 833 | char *pathname, |
832 | u32 flags, struct acpi_namespace_node **return_node) | 834 | u32 flags, struct acpi_namespace_node **return_node) |
833 | { | 835 | { |
834 | union acpi_generic_state scope_info; | 836 | union acpi_generic_state scope_info; |
835 | acpi_status status; | 837 | acpi_status status; |
836 | char *internal_path = NULL; | 838 | char *internal_path; |
837 | |||
838 | ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname); | ||
839 | 839 | ||
840 | if (pathname) { | 840 | ACPI_FUNCTION_TRACE_PTR(ns_get_node, pathname); |
841 | /* Convert path to internal representation */ | ||
842 | 841 | ||
843 | status = acpi_ns_internalize_name(pathname, &internal_path); | 842 | if (!pathname) { |
844 | if (ACPI_FAILURE(status)) { | 843 | *return_node = prefix_node; |
845 | return_ACPI_STATUS(status); | 844 | if (!prefix_node) { |
845 | *return_node = acpi_gbl_root_node; | ||
846 | } | 846 | } |
847 | return_ACPI_STATUS(AE_OK); | ||
848 | } | ||
849 | |||
850 | /* Convert path to internal representation */ | ||
851 | |||
852 | status = acpi_ns_internalize_name(pathname, &internal_path); | ||
853 | if (ACPI_FAILURE(status)) { | ||
854 | return_ACPI_STATUS(status); | ||
847 | } | 855 | } |
848 | 856 | ||
849 | /* Must lock namespace during lookup */ | 857 | /* Must lock namespace during lookup */ |
@@ -855,26 +863,23 @@ acpi_ns_get_node_by_path(char *pathname, | |||
855 | 863 | ||
856 | /* Setup lookup scope (search starting point) */ | 864 | /* Setup lookup scope (search starting point) */ |
857 | 865 | ||
858 | scope_info.scope.node = start_node; | 866 | scope_info.scope.node = prefix_node; |
859 | 867 | ||
860 | /* Lookup the name in the namespace */ | 868 | /* Lookup the name in the namespace */ |
861 | 869 | ||
862 | status = acpi_ns_lookup(&scope_info, internal_path, | 870 | status = acpi_ns_lookup(&scope_info, internal_path, ACPI_TYPE_ANY, |
863 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 871 | ACPI_IMODE_EXECUTE, |
864 | (flags | ACPI_NS_DONT_OPEN_SCOPE), | 872 | (flags | ACPI_NS_DONT_OPEN_SCOPE), NULL, |
865 | NULL, return_node); | 873 | return_node); |
866 | if (ACPI_FAILURE(status)) { | 874 | if (ACPI_FAILURE(status)) { |
867 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", | 875 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", |
868 | internal_path, | 876 | pathname, acpi_format_exception(status))); |
869 | acpi_format_exception(status))); | ||
870 | } | 877 | } |
871 | 878 | ||
872 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 879 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
873 | 880 | ||
874 | cleanup: | 881 | cleanup: |
875 | if (internal_path) { | 882 | ACPI_FREE(internal_path); |
876 | ACPI_MEM_FREE(internal_path); | ||
877 | } | ||
878 | return_ACPI_STATUS(status); | 883 | return_ACPI_STATUS(status); |
879 | } | 884 | } |
880 | 885 | ||
@@ -960,9 +965,10 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node) | |||
960 | { | 965 | { |
961 | struct acpi_namespace_node *parent_node; | 966 | struct acpi_namespace_node *parent_node; |
962 | 967 | ||
963 | ACPI_FUNCTION_TRACE("ns_find_parent_name"); | 968 | ACPI_FUNCTION_TRACE(ns_find_parent_name); |
964 | 969 | ||
965 | if (child_node) { | 970 | if (child_node) { |
971 | |||
966 | /* Valid entry. Get the parent Node */ | 972 | /* Valid entry. Get the parent Node */ |
967 | 973 | ||
968 | parent_node = acpi_ns_get_parent_node(child_node); | 974 | parent_node = acpi_ns_get_parent_node(child_node); |
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index fcab1e784b81..c8f6bef16ed0 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c | |||
@@ -76,6 +76,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |||
76 | ACPI_FUNCTION_ENTRY(); | 76 | ACPI_FUNCTION_ENTRY(); |
77 | 77 | ||
78 | if (!child_node) { | 78 | if (!child_node) { |
79 | |||
79 | /* It's really the parent's _scope_ that we want */ | 80 | /* It's really the parent's _scope_ that we want */ |
80 | 81 | ||
81 | if (parent_node->child) { | 82 | if (parent_node->child) { |
@@ -92,6 +93,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |||
92 | /* If any type is OK, we are done */ | 93 | /* If any type is OK, we are done */ |
93 | 94 | ||
94 | if (type == ACPI_TYPE_ANY) { | 95 | if (type == ACPI_TYPE_ANY) { |
96 | |||
95 | /* next_node is NULL if we are at the end-of-list */ | 97 | /* next_node is NULL if we are at the end-of-list */ |
96 | 98 | ||
97 | return (next_node); | 99 | return (next_node); |
@@ -100,6 +102,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |||
100 | /* Must search for the node -- but within this scope only */ | 102 | /* Must search for the node -- but within this scope only */ |
101 | 103 | ||
102 | while (next_node) { | 104 | while (next_node) { |
105 | |||
103 | /* If type matches, we are done */ | 106 | /* If type matches, we are done */ |
104 | 107 | ||
105 | if (next_node->type == type) { | 108 | if (next_node->type == type) { |
@@ -161,7 +164,7 @@ acpi_ns_walk_namespace(acpi_object_type type, | |||
161 | acpi_object_type child_type; | 164 | acpi_object_type child_type; |
162 | u32 level; | 165 | u32 level; |
163 | 166 | ||
164 | ACPI_FUNCTION_TRACE("ns_walk_namespace"); | 167 | ACPI_FUNCTION_TRACE(ns_walk_namespace); |
165 | 168 | ||
166 | /* Special case for the namespace Root Node */ | 169 | /* Special case for the namespace Root Node */ |
167 | 170 | ||
@@ -182,6 +185,7 @@ acpi_ns_walk_namespace(acpi_object_type type, | |||
182 | * bubbled up to (and passed) the original parent handle (start_entry) | 185 | * bubbled up to (and passed) the original parent handle (start_entry) |
183 | */ | 186 | */ |
184 | while (level > 0) { | 187 | while (level > 0) { |
188 | |||
185 | /* Get the next node in this scope. Null if not found */ | 189 | /* Get the next node in this scope. Null if not found */ |
186 | 190 | ||
187 | status = AE_OK; | 191 | status = AE_OK; |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index a95f636dc35d..6d9bd45af30a 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
@@ -51,6 +49,7 @@ | |||
51 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME("nsxfeval") | 50 | ACPI_MODULE_NAME("nsxfeval") |
53 | 51 | ||
52 | #ifdef ACPI_FUTURE_USAGE | ||
54 | /******************************************************************************* | 53 | /******************************************************************************* |
55 | * | 54 | * |
56 | * FUNCTION: acpi_evaluate_object_typed | 55 | * FUNCTION: acpi_evaluate_object_typed |
@@ -71,18 +70,17 @@ ACPI_MODULE_NAME("nsxfeval") | |||
71 | * be valid (non-null) | 70 | * be valid (non-null) |
72 | * | 71 | * |
73 | ******************************************************************************/ | 72 | ******************************************************************************/ |
74 | #ifdef ACPI_FUTURE_USAGE | ||
75 | acpi_status | 73 | acpi_status |
76 | acpi_evaluate_object_typed(acpi_handle handle, | 74 | acpi_evaluate_object_typed(acpi_handle handle, |
77 | acpi_string pathname, | 75 | acpi_string pathname, |
78 | struct acpi_object_list *external_params, | 76 | struct acpi_object_list * external_params, |
79 | struct acpi_buffer *return_buffer, | 77 | struct acpi_buffer * return_buffer, |
80 | acpi_object_type return_type) | 78 | acpi_object_type return_type) |
81 | { | 79 | { |
82 | acpi_status status; | 80 | acpi_status status; |
83 | u8 must_free = FALSE; | 81 | u8 must_free = FALSE; |
84 | 82 | ||
85 | ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed"); | 83 | ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed); |
86 | 84 | ||
87 | /* Return buffer must be valid */ | 85 | /* Return buffer must be valid */ |
88 | 86 | ||
@@ -110,6 +108,7 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
110 | } | 108 | } |
111 | 109 | ||
112 | if (return_buffer->length == 0) { | 110 | if (return_buffer->length == 0) { |
111 | |||
113 | /* Error because caller specifically asked for a return value */ | 112 | /* Error because caller specifically asked for a return value */ |
114 | 113 | ||
115 | ACPI_ERROR((AE_INFO, "No return value")); | 114 | ACPI_ERROR((AE_INFO, "No return value")); |
@@ -131,6 +130,7 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
131 | acpi_ut_get_type_name(return_type))); | 130 | acpi_ut_get_type_name(return_type))); |
132 | 131 | ||
133 | if (must_free) { | 132 | if (must_free) { |
133 | |||
134 | /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ | 134 | /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ |
135 | 135 | ||
136 | acpi_os_free(return_buffer->pointer); | 136 | acpi_os_free(return_buffer->pointer); |
@@ -140,6 +140,8 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
140 | return_buffer->length = 0; | 140 | return_buffer->length = 0; |
141 | return_ACPI_STATUS(AE_TYPE); | 141 | return_ACPI_STATUS(AE_TYPE); |
142 | } | 142 | } |
143 | |||
144 | ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed) | ||
143 | #endif /* ACPI_FUTURE_USAGE */ | 145 | #endif /* ACPI_FUTURE_USAGE */ |
144 | 146 | ||
145 | /******************************************************************************* | 147 | /******************************************************************************* |
@@ -161,7 +163,6 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
161 | * be valid (non-null) | 163 | * be valid (non-null) |
162 | * | 164 | * |
163 | ******************************************************************************/ | 165 | ******************************************************************************/ |
164 | |||
165 | acpi_status | 166 | acpi_status |
166 | acpi_evaluate_object(acpi_handle handle, | 167 | acpi_evaluate_object(acpi_handle handle, |
167 | acpi_string pathname, | 168 | acpi_string pathname, |
@@ -170,51 +171,61 @@ acpi_evaluate_object(acpi_handle handle, | |||
170 | { | 171 | { |
171 | acpi_status status; | 172 | acpi_status status; |
172 | acpi_status status2; | 173 | acpi_status status2; |
173 | struct acpi_parameter_info info; | 174 | struct acpi_evaluate_info *info; |
174 | acpi_size buffer_space_needed; | 175 | acpi_size buffer_space_needed; |
175 | u32 i; | 176 | u32 i; |
176 | 177 | ||
177 | ACPI_FUNCTION_TRACE("acpi_evaluate_object"); | 178 | ACPI_FUNCTION_TRACE(acpi_evaluate_object); |
178 | 179 | ||
179 | info.node = handle; | 180 | /* Allocate and initialize the evaluation information block */ |
180 | info.parameters = NULL; | 181 | |
181 | info.return_object = NULL; | 182 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); |
182 | info.parameter_type = ACPI_PARAM_ARGS; | 183 | if (!info) { |
184 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
185 | } | ||
186 | |||
187 | info->pathname = pathname; | ||
188 | info->parameter_type = ACPI_PARAM_ARGS; | ||
189 | |||
190 | /* Convert and validate the device handle */ | ||
191 | |||
192 | info->prefix_node = acpi_ns_map_handle_to_node(handle); | ||
193 | if (!info->prefix_node) { | ||
194 | status = AE_BAD_PARAMETER; | ||
195 | goto cleanup; | ||
196 | } | ||
183 | 197 | ||
184 | /* | 198 | /* |
185 | * If there are parameters to be passed to the object | 199 | * If there are parameters to be passed to a control method, the external |
186 | * (which must be a control method), the external objects | 200 | * objects must all be converted to internal objects |
187 | * must be converted to internal objects | ||
188 | */ | 201 | */ |
189 | if (external_params && external_params->count) { | 202 | if (external_params && external_params->count) { |
190 | /* | 203 | /* |
191 | * Allocate a new parameter block for the internal objects | 204 | * Allocate a new parameter block for the internal objects |
192 | * Add 1 to count to allow for null terminated internal list | 205 | * Add 1 to count to allow for null terminated internal list |
193 | */ | 206 | */ |
194 | info.parameters = ACPI_MEM_CALLOCATE(((acpi_size) | 207 | info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) |
195 | external_params->count + | 208 | external_params-> |
196 | 1) * sizeof(void *)); | 209 | count + |
197 | if (!info.parameters) { | 210 | 1) * sizeof(void *)); |
198 | return_ACPI_STATUS(AE_NO_MEMORY); | 211 | if (!info->parameters) { |
212 | status = AE_NO_MEMORY; | ||
213 | goto cleanup; | ||
199 | } | 214 | } |
200 | 215 | ||
201 | /* | 216 | /* Convert each external object in the list to an internal object */ |
202 | * Convert each external object in the list to an | 217 | |
203 | * internal object | ||
204 | */ | ||
205 | for (i = 0; i < external_params->count; i++) { | 218 | for (i = 0; i < external_params->count; i++) { |
206 | status = | 219 | status = |
207 | acpi_ut_copy_eobject_to_iobject(&external_params-> | 220 | acpi_ut_copy_eobject_to_iobject(&external_params-> |
208 | pointer[i], | 221 | pointer[i], |
209 | &info. | 222 | &info-> |
210 | parameters[i]); | 223 | parameters[i]); |
211 | if (ACPI_FAILURE(status)) { | 224 | if (ACPI_FAILURE(status)) { |
212 | acpi_ut_delete_internal_object_list(info. | 225 | goto cleanup; |
213 | parameters); | ||
214 | return_ACPI_STATUS(status); | ||
215 | } | 226 | } |
216 | } | 227 | } |
217 | info.parameters[external_params->count] = NULL; | 228 | info->parameters[external_params->count] = NULL; |
218 | } | 229 | } |
219 | 230 | ||
220 | /* | 231 | /* |
@@ -224,43 +235,31 @@ acpi_evaluate_object(acpi_handle handle, | |||
224 | * 3) Valid handle | 235 | * 3) Valid handle |
225 | */ | 236 | */ |
226 | if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { | 237 | if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { |
227 | /* | 238 | |
228 | * The path is fully qualified, just evaluate by name | 239 | /* The path is fully qualified, just evaluate by name */ |
229 | */ | 240 | |
230 | status = acpi_ns_evaluate_by_name(pathname, &info); | 241 | info->prefix_node = NULL; |
242 | status = acpi_ns_evaluate(info); | ||
231 | } else if (!handle) { | 243 | } else if (!handle) { |
232 | /* | 244 | /* |
233 | * A handle is optional iff a fully qualified pathname | 245 | * A handle is optional iff a fully qualified pathname is specified. |
234 | * is specified. Since we've already handled fully | 246 | * Since we've already handled fully qualified names above, this is |
235 | * qualified names above, this is an error | 247 | * an error |
236 | */ | 248 | */ |
237 | if (!pathname) { | 249 | if (!pathname) { |
238 | ACPI_ERROR((AE_INFO, | 250 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
239 | "Both Handle and Pathname are NULL")); | 251 | "Both Handle and Pathname are NULL")); |
240 | } else { | 252 | } else { |
241 | ACPI_ERROR((AE_INFO, | 253 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
242 | "Handle is NULL and Pathname is relative")); | 254 | "Null Handle with relative pathname [%s]", |
255 | pathname)); | ||
243 | } | 256 | } |
244 | 257 | ||
245 | status = AE_BAD_PARAMETER; | 258 | status = AE_BAD_PARAMETER; |
246 | } else { | 259 | } else { |
247 | /* | 260 | /* We have a namespace a node and a possible relative path */ |
248 | * We get here if we have a handle -- and if we have a | 261 | |
249 | * pathname it is relative. The handle will be validated | 262 | status = acpi_ns_evaluate(info); |
250 | * in the lower procedures | ||
251 | */ | ||
252 | if (!pathname) { | ||
253 | /* | ||
254 | * The null pathname case means the handle is for | ||
255 | * the actual object to be evaluated | ||
256 | */ | ||
257 | status = acpi_ns_evaluate_by_handle(&info); | ||
258 | } else { | ||
259 | /* | ||
260 | * Both a Handle and a relative Pathname | ||
261 | */ | ||
262 | status = acpi_ns_evaluate_relative(pathname, &info); | ||
263 | } | ||
264 | } | 263 | } |
265 | 264 | ||
266 | /* | 265 | /* |
@@ -268,10 +267,10 @@ acpi_evaluate_object(acpi_handle handle, | |||
268 | * copy the return value to an external object. | 267 | * copy the return value to an external object. |
269 | */ | 268 | */ |
270 | if (return_buffer) { | 269 | if (return_buffer) { |
271 | if (!info.return_object) { | 270 | if (!info->return_object) { |
272 | return_buffer->length = 0; | 271 | return_buffer->length = 0; |
273 | } else { | 272 | } else { |
274 | if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) == | 273 | if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) == |
275 | ACPI_DESC_TYPE_NAMED) { | 274 | ACPI_DESC_TYPE_NAMED) { |
276 | /* | 275 | /* |
277 | * If we received a NS Node as a return object, this means that | 276 | * If we received a NS Node as a return object, this means that |
@@ -282,19 +281,19 @@ acpi_evaluate_object(acpi_handle handle, | |||
282 | * support for various types at a later date if necessary. | 281 | * support for various types at a later date if necessary. |
283 | */ | 282 | */ |
284 | status = AE_TYPE; | 283 | status = AE_TYPE; |
285 | info.return_object = NULL; /* No need to delete a NS Node */ | 284 | info->return_object = NULL; /* No need to delete a NS Node */ |
286 | return_buffer->length = 0; | 285 | return_buffer->length = 0; |
287 | } | 286 | } |
288 | 287 | ||
289 | if (ACPI_SUCCESS(status)) { | 288 | if (ACPI_SUCCESS(status)) { |
290 | /* | 289 | |
291 | * Find out how large a buffer is needed | 290 | /* Get the size of the returned object */ |
292 | * to contain the returned object | 291 | |
293 | */ | ||
294 | status = | 292 | status = |
295 | acpi_ut_get_object_size(info.return_object, | 293 | acpi_ut_get_object_size(info->return_object, |
296 | &buffer_space_needed); | 294 | &buffer_space_needed); |
297 | if (ACPI_SUCCESS(status)) { | 295 | if (ACPI_SUCCESS(status)) { |
296 | |||
298 | /* Validate/Allocate/Clear caller buffer */ | 297 | /* Validate/Allocate/Clear caller buffer */ |
299 | 298 | ||
300 | status = | 299 | status = |
@@ -303,7 +302,8 @@ acpi_evaluate_object(acpi_handle handle, | |||
303 | buffer_space_needed); | 302 | buffer_space_needed); |
304 | if (ACPI_FAILURE(status)) { | 303 | if (ACPI_FAILURE(status)) { |
305 | /* | 304 | /* |
306 | * Caller's buffer is too small or a new one can't be allocated | 305 | * Caller's buffer is too small or a new one can't |
306 | * be allocated | ||
307 | */ | 307 | */ |
308 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 308 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
309 | "Needed buffer size %X, %s\n", | 309 | "Needed buffer size %X, %s\n", |
@@ -312,12 +312,11 @@ acpi_evaluate_object(acpi_handle handle, | |||
312 | acpi_format_exception | 312 | acpi_format_exception |
313 | (status))); | 313 | (status))); |
314 | } else { | 314 | } else { |
315 | /* | 315 | /* We have enough space for the object, build it */ |
316 | * We have enough space for the object, build it | 316 | |
317 | */ | ||
318 | status = | 317 | status = |
319 | acpi_ut_copy_iobject_to_eobject | 318 | acpi_ut_copy_iobject_to_eobject |
320 | (info.return_object, | 319 | (info->return_object, |
321 | return_buffer); | 320 | return_buffer); |
322 | } | 321 | } |
323 | } | 322 | } |
@@ -325,35 +324,37 @@ acpi_evaluate_object(acpi_handle handle, | |||
325 | } | 324 | } |
326 | } | 325 | } |
327 | 326 | ||
328 | if (info.return_object) { | 327 | if (info->return_object) { |
329 | /* | 328 | /* |
330 | * Delete the internal return object. NOTE: Interpreter | 329 | * Delete the internal return object. NOTE: Interpreter must be |
331 | * must be locked to avoid race condition. | 330 | * locked to avoid race condition. |
332 | */ | 331 | */ |
333 | status2 = acpi_ex_enter_interpreter(); | 332 | status2 = acpi_ex_enter_interpreter(); |
334 | if (ACPI_SUCCESS(status2)) { | 333 | if (ACPI_SUCCESS(status2)) { |
335 | /* | 334 | |
336 | * Delete the internal return object. (Or at least | 335 | /* Remove one reference on the return object (should delete it) */ |
337 | * decrement the reference count by one) | 336 | |
338 | */ | 337 | acpi_ut_remove_reference(info->return_object); |
339 | acpi_ut_remove_reference(info.return_object); | ||
340 | acpi_ex_exit_interpreter(); | 338 | acpi_ex_exit_interpreter(); |
341 | } | 339 | } |
342 | } | 340 | } |
343 | 341 | ||
344 | /* | 342 | cleanup: |
345 | * Free the input parameter list (if we created one), | 343 | |
346 | */ | 344 | /* Free the input parameter list (if we created one) */ |
347 | if (info.parameters) { | 345 | |
346 | if (info->parameters) { | ||
347 | |||
348 | /* Free the allocated parameter block */ | 348 | /* Free the allocated parameter block */ |
349 | 349 | ||
350 | acpi_ut_delete_internal_object_list(info.parameters); | 350 | acpi_ut_delete_internal_object_list(info->parameters); |
351 | } | 351 | } |
352 | 352 | ||
353 | ACPI_FREE(info); | ||
353 | return_ACPI_STATUS(status); | 354 | return_ACPI_STATUS(status); |
354 | } | 355 | } |
355 | 356 | ||
356 | EXPORT_SYMBOL(acpi_evaluate_object); | 357 | ACPI_EXPORT_SYMBOL(acpi_evaluate_object) |
357 | 358 | ||
358 | /******************************************************************************* | 359 | /******************************************************************************* |
359 | * | 360 | * |
@@ -384,7 +385,6 @@ EXPORT_SYMBOL(acpi_evaluate_object); | |||
384 | * function, etc. | 385 | * function, etc. |
385 | * | 386 | * |
386 | ******************************************************************************/ | 387 | ******************************************************************************/ |
387 | |||
388 | acpi_status | 388 | acpi_status |
389 | acpi_walk_namespace(acpi_object_type type, | 389 | acpi_walk_namespace(acpi_object_type type, |
390 | acpi_handle start_object, | 390 | acpi_handle start_object, |
@@ -394,7 +394,7 @@ acpi_walk_namespace(acpi_object_type type, | |||
394 | { | 394 | { |
395 | acpi_status status; | 395 | acpi_status status; |
396 | 396 | ||
397 | ACPI_FUNCTION_TRACE("acpi_walk_namespace"); | 397 | ACPI_FUNCTION_TRACE(acpi_walk_namespace); |
398 | 398 | ||
399 | /* Parameter validation */ | 399 | /* Parameter validation */ |
400 | 400 | ||
@@ -421,7 +421,7 @@ acpi_walk_namespace(acpi_object_type type, | |||
421 | return_ACPI_STATUS(status); | 421 | return_ACPI_STATUS(status); |
422 | } | 422 | } |
423 | 423 | ||
424 | EXPORT_SYMBOL(acpi_walk_namespace); | 424 | ACPI_EXPORT_SYMBOL(acpi_walk_namespace) |
425 | 425 | ||
426 | /******************************************************************************* | 426 | /******************************************************************************* |
427 | * | 427 | * |
@@ -436,7 +436,6 @@ EXPORT_SYMBOL(acpi_walk_namespace); | |||
436 | * on that. | 436 | * on that. |
437 | * | 437 | * |
438 | ******************************************************************************/ | 438 | ******************************************************************************/ |
439 | |||
440 | static acpi_status | 439 | static acpi_status |
441 | acpi_ns_get_device_callback(acpi_handle obj_handle, | 440 | acpi_ns_get_device_callback(acpi_handle obj_handle, |
442 | u32 nesting_level, | 441 | u32 nesting_level, |
@@ -473,6 +472,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
473 | } | 472 | } |
474 | 473 | ||
475 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { | 474 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
475 | |||
476 | /* Don't examine children of the device if not present */ | 476 | /* Don't examine children of the device if not present */ |
477 | 477 | ||
478 | return (AE_CTRL_DEPTH); | 478 | return (AE_CTRL_DEPTH); |
@@ -489,6 +489,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
489 | } | 489 | } |
490 | 490 | ||
491 | if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { | 491 | if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { |
492 | |||
492 | /* Get the list of Compatible IDs */ | 493 | /* Get the list of Compatible IDs */ |
493 | 494 | ||
494 | status = acpi_ut_execute_CID(node, &cid); | 495 | status = acpi_ut_execute_CID(node, &cid); |
@@ -505,11 +506,11 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
505 | sizeof(struct | 506 | sizeof(struct |
506 | acpi_compatible_id)) != | 507 | acpi_compatible_id)) != |
507 | 0) { | 508 | 0) { |
508 | ACPI_MEM_FREE(cid); | 509 | ACPI_FREE(cid); |
509 | return (AE_OK); | 510 | return (AE_OK); |
510 | } | 511 | } |
511 | } | 512 | } |
512 | ACPI_MEM_FREE(cid); | 513 | ACPI_FREE(cid); |
513 | } | 514 | } |
514 | } | 515 | } |
515 | 516 | ||
@@ -551,7 +552,7 @@ acpi_get_devices(char *HID, | |||
551 | acpi_status status; | 552 | acpi_status status; |
552 | struct acpi_get_devices_info info; | 553 | struct acpi_get_devices_info info; |
553 | 554 | ||
554 | ACPI_FUNCTION_TRACE("acpi_get_devices"); | 555 | ACPI_FUNCTION_TRACE(acpi_get_devices); |
555 | 556 | ||
556 | /* Parameter validation */ | 557 | /* Parameter validation */ |
557 | 558 | ||
@@ -563,9 +564,9 @@ acpi_get_devices(char *HID, | |||
563 | * We're going to call their callback from OUR callback, so we need | 564 | * We're going to call their callback from OUR callback, so we need |
564 | * to know what it is, and their context parameter. | 565 | * to know what it is, and their context parameter. |
565 | */ | 566 | */ |
567 | info.hid = HID; | ||
566 | info.context = context; | 568 | info.context = context; |
567 | info.user_function = user_function; | 569 | info.user_function = user_function; |
568 | info.hid = HID; | ||
569 | 570 | ||
570 | /* | 571 | /* |
571 | * Lock the namespace around the walk. | 572 | * Lock the namespace around the walk. |
@@ -578,9 +579,8 @@ acpi_get_devices(char *HID, | |||
578 | return_ACPI_STATUS(status); | 579 | return_ACPI_STATUS(status); |
579 | } | 580 | } |
580 | 581 | ||
581 | status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, | 582 | status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
582 | ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, | 583 | ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, |
583 | ACPI_NS_WALK_UNLOCK, | ||
584 | acpi_ns_get_device_callback, &info, | 584 | acpi_ns_get_device_callback, &info, |
585 | return_value); | 585 | return_value); |
586 | 586 | ||
@@ -588,7 +588,7 @@ acpi_get_devices(char *HID, | |||
588 | return_ACPI_STATUS(status); | 588 | return_ACPI_STATUS(status); |
589 | } | 589 | } |
590 | 590 | ||
591 | EXPORT_SYMBOL(acpi_get_devices); | 591 | ACPI_EXPORT_SYMBOL(acpi_get_devices) |
592 | 592 | ||
593 | /******************************************************************************* | 593 | /******************************************************************************* |
594 | * | 594 | * |
@@ -603,7 +603,6 @@ EXPORT_SYMBOL(acpi_get_devices); | |||
603 | * DESCRIPTION: Attach arbitrary data and handler to a namespace node. | 603 | * DESCRIPTION: Attach arbitrary data and handler to a namespace node. |
604 | * | 604 | * |
605 | ******************************************************************************/ | 605 | ******************************************************************************/ |
606 | |||
607 | acpi_status | 606 | acpi_status |
608 | acpi_attach_data(acpi_handle obj_handle, | 607 | acpi_attach_data(acpi_handle obj_handle, |
609 | acpi_object_handler handler, void *data) | 608 | acpi_object_handler handler, void *data) |
@@ -637,6 +636,8 @@ acpi_attach_data(acpi_handle obj_handle, | |||
637 | return (status); | 636 | return (status); |
638 | } | 637 | } |
639 | 638 | ||
639 | ACPI_EXPORT_SYMBOL(acpi_attach_data) | ||
640 | |||
640 | /******************************************************************************* | 641 | /******************************************************************************* |
641 | * | 642 | * |
642 | * FUNCTION: acpi_detach_data | 643 | * FUNCTION: acpi_detach_data |
@@ -649,7 +650,6 @@ acpi_attach_data(acpi_handle obj_handle, | |||
649 | * DESCRIPTION: Remove data that was previously attached to a node. | 650 | * DESCRIPTION: Remove data that was previously attached to a node. |
650 | * | 651 | * |
651 | ******************************************************************************/ | 652 | ******************************************************************************/ |
652 | |||
653 | acpi_status | 653 | acpi_status |
654 | acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) | 654 | acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) |
655 | { | 655 | { |
@@ -682,6 +682,8 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) | |||
682 | return (status); | 682 | return (status); |
683 | } | 683 | } |
684 | 684 | ||
685 | ACPI_EXPORT_SYMBOL(acpi_detach_data) | ||
686 | |||
685 | /******************************************************************************* | 687 | /******************************************************************************* |
686 | * | 688 | * |
687 | * FUNCTION: acpi_get_data | 689 | * FUNCTION: acpi_get_data |
@@ -695,7 +697,6 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) | |||
695 | * DESCRIPTION: Retrieve data that was previously attached to a namespace node. | 697 | * DESCRIPTION: Retrieve data that was previously attached to a namespace node. |
696 | * | 698 | * |
697 | ******************************************************************************/ | 699 | ******************************************************************************/ |
698 | |||
699 | acpi_status | 700 | acpi_status |
700 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) | 701 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) |
701 | { | 702 | { |
@@ -727,3 +728,5 @@ acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) | |||
727 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 728 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
728 | return (status); | 729 | return (status); |
729 | } | 730 | } |
731 | |||
732 | ACPI_EXPORT_SYMBOL(acpi_get_data) | ||
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index 8cd8675a47c0..978213a6c19f 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | 47 | ||
@@ -114,9 +112,8 @@ acpi_get_handle(acpi_handle parent, | |||
114 | /* | 112 | /* |
115 | * Find the Node and convert to a handle | 113 | * Find the Node and convert to a handle |
116 | */ | 114 | */ |
117 | status = | 115 | status = acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, |
118 | acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH, | 116 | &node); |
119 | &node); | ||
120 | 117 | ||
121 | *ret_handle = NULL; | 118 | *ret_handle = NULL; |
122 | if (ACPI_SUCCESS(status)) { | 119 | if (ACPI_SUCCESS(status)) { |
@@ -126,7 +123,7 @@ acpi_get_handle(acpi_handle parent, | |||
126 | return (status); | 123 | return (status); |
127 | } | 124 | } |
128 | 125 | ||
129 | EXPORT_SYMBOL(acpi_get_handle); | 126 | ACPI_EXPORT_SYMBOL(acpi_get_handle) |
130 | 127 | ||
131 | /****************************************************************************** | 128 | /****************************************************************************** |
132 | * | 129 | * |
@@ -143,7 +140,6 @@ EXPORT_SYMBOL(acpi_get_handle); | |||
143 | * complementary functions. | 140 | * complementary functions. |
144 | * | 141 | * |
145 | ******************************************************************************/ | 142 | ******************************************************************************/ |
146 | |||
147 | acpi_status | 143 | acpi_status |
148 | acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | 144 | acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) |
149 | { | 145 | { |
@@ -162,6 +158,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | |||
162 | } | 158 | } |
163 | 159 | ||
164 | if (name_type == ACPI_FULL_PATHNAME) { | 160 | if (name_type == ACPI_FULL_PATHNAME) { |
161 | |||
165 | /* Get the full pathname (From the namespace root) */ | 162 | /* Get the full pathname (From the namespace root) */ |
166 | 163 | ||
167 | status = acpi_ns_handle_to_pathname(handle, buffer); | 164 | status = acpi_ns_handle_to_pathname(handle, buffer); |
@@ -203,7 +200,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | |||
203 | return (status); | 200 | return (status); |
204 | } | 201 | } |
205 | 202 | ||
206 | EXPORT_SYMBOL(acpi_get_name); | 203 | ACPI_EXPORT_SYMBOL(acpi_get_name) |
207 | 204 | ||
208 | /****************************************************************************** | 205 | /****************************************************************************** |
209 | * | 206 | * |
@@ -219,7 +216,6 @@ EXPORT_SYMBOL(acpi_get_name); | |||
219 | * control methods (Such as in the case of a device.) | 216 | * control methods (Such as in the case of a device.) |
220 | * | 217 | * |
221 | ******************************************************************************/ | 218 | ******************************************************************************/ |
222 | |||
223 | acpi_status | 219 | acpi_status |
224 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | 220 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) |
225 | { | 221 | { |
@@ -241,7 +237,7 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
241 | return (status); | 237 | return (status); |
242 | } | 238 | } |
243 | 239 | ||
244 | info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info)); | 240 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info)); |
245 | if (!info) { | 241 | if (!info) { |
246 | return (AE_NO_MEMORY); | 242 | return (AE_NO_MEMORY); |
247 | } | 243 | } |
@@ -345,11 +341,11 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
345 | } | 341 | } |
346 | 342 | ||
347 | cleanup: | 343 | cleanup: |
348 | ACPI_MEM_FREE(info); | 344 | ACPI_FREE(info); |
349 | if (cid_list) { | 345 | if (cid_list) { |
350 | ACPI_MEM_FREE(cid_list); | 346 | ACPI_FREE(cid_list); |
351 | } | 347 | } |
352 | return (status); | 348 | return (status); |
353 | } | 349 | } |
354 | 350 | ||
355 | EXPORT_SYMBOL(acpi_get_object_info); | 351 | ACPI_EXPORT_SYMBOL(acpi_get_object_info) |
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index a0332595677a..a163e1d3708d 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | 47 | ||
@@ -101,7 +99,7 @@ acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type) | |||
101 | return (status); | 99 | return (status); |
102 | } | 100 | } |
103 | 101 | ||
104 | EXPORT_SYMBOL(acpi_get_type); | 102 | ACPI_EXPORT_SYMBOL(acpi_get_type) |
105 | 103 | ||
106 | /******************************************************************************* | 104 | /******************************************************************************* |
107 | * | 105 | * |
@@ -116,7 +114,6 @@ EXPORT_SYMBOL(acpi_get_type); | |||
116 | * Handle. | 114 | * Handle. |
117 | * | 115 | * |
118 | ******************************************************************************/ | 116 | ******************************************************************************/ |
119 | |||
120 | acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) | 117 | acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) |
121 | { | 118 | { |
122 | struct acpi_namespace_node *node; | 119 | struct acpi_namespace_node *node; |
@@ -162,7 +159,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) | |||
162 | return (status); | 159 | return (status); |
163 | } | 160 | } |
164 | 161 | ||
165 | EXPORT_SYMBOL(acpi_get_parent); | 162 | ACPI_EXPORT_SYMBOL(acpi_get_parent) |
166 | 163 | ||
167 | /******************************************************************************* | 164 | /******************************************************************************* |
168 | * | 165 | * |
@@ -181,7 +178,6 @@ EXPORT_SYMBOL(acpi_get_parent); | |||
181 | * Scope is returned. | 178 | * Scope is returned. |
182 | * | 179 | * |
183 | ******************************************************************************/ | 180 | ******************************************************************************/ |
184 | |||
185 | acpi_status | 181 | acpi_status |
186 | acpi_get_next_object(acpi_object_type type, | 182 | acpi_get_next_object(acpi_object_type type, |
187 | acpi_handle parent, | 183 | acpi_handle parent, |
@@ -206,6 +202,7 @@ acpi_get_next_object(acpi_object_type type, | |||
206 | /* If null handle, use the parent */ | 202 | /* If null handle, use the parent */ |
207 | 203 | ||
208 | if (!child) { | 204 | if (!child) { |
205 | |||
209 | /* Start search at the beginning of the specified scope */ | 206 | /* Start search at the beginning of the specified scope */ |
210 | 207 | ||
211 | parent_node = acpi_ns_map_handle_to_node(parent); | 208 | parent_node = acpi_ns_map_handle_to_node(parent); |
@@ -242,4 +239,4 @@ acpi_get_next_object(acpi_object_type type, | |||
242 | return (status); | 239 | return (status); |
243 | } | 240 | } |
244 | 241 | ||
245 | EXPORT_SYMBOL(acpi_get_next_object); | 242 | ACPI_EXPORT_SYMBOL(acpi_get_next_object) |