diff options
author | Bob Moore <robert.moore@intel.com> | 2005-12-16 17:05:00 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-12-28 02:54:59 -0500 |
commit | defba1d8f233c0d5cf3e1ea6aeb898eca7231860 (patch) | |
tree | cd8b1b84da8d8a52ad0d44107daaeeee0a0b65f4 /drivers/acpi/namespace | |
parent | cb654695f6b912cef7cb3271665b6ee0d416124c (diff) |
[ACPI] ACPICA 20051216
Implemented optional support to allow unresolved names
within ASL Package objects. A null object is inserted in
the package when a named reference cannot be located in
the current namespace. Enabled via the interpreter slack
flag which Linux has enabled by default (acpi=strict
to disable slack). This should eliminate AE_NOT_FOUND
exceptions seen on machines that contain such code.
Implemented an optimization to the initialization
sequence that can improve boot time. During ACPI device
initialization, the _STA method is now run if and only
if the _INI method exists. The _STA method is used to
determine if the device is present; An _INI can only be
run if _STA returns present, but it is a waste of time to
run the _STA method if the _INI does not exist. (Prototype
and assistance from Dong Wei)
Implemented use of the C99 uintptr_t for the pointer
casting macros if it is available in the current
compiler. Otherwise, the default (void *) cast is used
as before.
Fixed some possible memory leaks found within the
execution path of the Break, Continue, If, and CreateField
operators. (Valery Podrezov)
Fixed a problem introduced in the 20051202 release where
an exception is generated during method execution if a
control method attempts to declare another method.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/namespace')
-rw-r--r-- | drivers/acpi/namespace/nsinit.c | 85 | ||||
-rw-r--r-- | drivers/acpi/namespace/nssearch.c | 17 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsxfeval.c | 4 |
3 files changed, 59 insertions, 47 deletions
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 0a08d2f04a06..efa3f4233736 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -336,23 +336,22 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
336 | struct acpi_parameter_info pinfo; | 336 | struct acpi_parameter_info pinfo; |
337 | u32 flags; | 337 | u32 flags; |
338 | acpi_status status; | 338 | acpi_status status; |
339 | struct acpi_namespace_node *ini_node; | ||
340 | struct acpi_namespace_node *device_node; | ||
339 | 341 | ||
340 | ACPI_FUNCTION_TRACE("ns_init_one_device"); | 342 | ACPI_FUNCTION_TRACE("ns_init_one_device"); |
341 | 343 | ||
342 | pinfo.parameters = NULL; | 344 | device_node = acpi_ns_map_handle_to_node(obj_handle); |
343 | pinfo.parameter_type = ACPI_PARAM_ARGS; | 345 | if (!device_node) { |
344 | |||
345 | pinfo.node = acpi_ns_map_handle_to_node(obj_handle); | ||
346 | if (!pinfo.node) { | ||
347 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 346 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
348 | } | 347 | } |
349 | 348 | ||
350 | /* | 349 | /* |
351 | * We will run _STA/_INI on Devices, Processors and thermal_zones only | 350 | * We will run _STA/_INI on Devices, Processors and thermal_zones only |
352 | */ | 351 | */ |
353 | if ((pinfo.node->type != ACPI_TYPE_DEVICE) && | 352 | if ((device_node->type != ACPI_TYPE_DEVICE) && |
354 | (pinfo.node->type != ACPI_TYPE_PROCESSOR) && | 353 | (device_node->type != ACPI_TYPE_PROCESSOR) && |
355 | (pinfo.node->type != ACPI_TYPE_THERMAL)) { | 354 | (device_node->type != ACPI_TYPE_THERMAL)) { |
356 | return_ACPI_STATUS(AE_OK); | 355 | return_ACPI_STATUS(AE_OK); |
357 | } | 356 | } |
358 | 357 | ||
@@ -364,57 +363,69 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
364 | info->device_count++; | 363 | info->device_count++; |
365 | 364 | ||
366 | /* | 365 | /* |
367 | * Run _STA to determine if we can run _INI on the device. | 366 | * Check if the _INI method exists for this device - |
367 | * if _INI does not exist, there is no need to run _STA | ||
368 | * No _INI means device requires no initialization | ||
369 | */ | ||
370 | status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), | ||
371 | device_node, ACPI_TYPE_METHOD, &ini_node); | ||
372 | if (ACPI_FAILURE(status)) { | ||
373 | /* No _INI method found - move on to next device */ | ||
374 | |||
375 | return_ACPI_STATUS(AE_OK); | ||
376 | } | ||
377 | |||
378 | /* | ||
379 | * Run _STA to determine if we can run _INI on the device - | ||
380 | * the device must be present before _INI can be run. | ||
381 | * However, _STA is not required - assume device present if no _STA | ||
368 | */ | 382 | */ |
369 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 383 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, |
370 | pinfo.node, | 384 | device_node, |
371 | METHOD_NAME__STA)); | 385 | METHOD_NAME__STA)); |
372 | status = acpi_ut_execute_STA(pinfo.node, &flags); | ||
373 | 386 | ||
387 | pinfo.node = device_node; | ||
388 | pinfo.parameters = NULL; | ||
389 | pinfo.parameter_type = ACPI_PARAM_ARGS; | ||
390 | |||
391 | status = acpi_ut_execute_STA(pinfo.node, &flags); | ||
374 | if (ACPI_FAILURE(status)) { | 392 | if (ACPI_FAILURE(status)) { |
375 | if (pinfo.node->type == ACPI_TYPE_DEVICE) { | 393 | /* Ignore error and move on to next device */ |
376 | /* Ignore error and move on to next device */ | ||
377 | 394 | ||
378 | return_ACPI_STATUS(AE_OK); | 395 | return_ACPI_STATUS(AE_OK); |
379 | } | 396 | } |
380 | 397 | ||
381 | /* _STA is not required for Processor or thermal_zone objects */ | 398 | if (flags != ACPI_UINT32_MAX) { |
382 | } else { | ||
383 | info->num_STA++; | 399 | info->num_STA++; |
400 | } | ||
384 | 401 | ||
385 | if (!(flags & 0x01)) { | 402 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
386 | /* Don't look at children of a not present device */ | 403 | /* Don't look at children of a not present device */ |
387 | 404 | ||
388 | return_ACPI_STATUS(AE_CTRL_DEPTH); | 405 | return_ACPI_STATUS(AE_CTRL_DEPTH); |
389 | } | ||
390 | } | 406 | } |
391 | 407 | ||
392 | /* | 408 | /* |
393 | * The device is present. Run _INI. | 409 | * The device is present and _INI exists. Run the _INI method. |
410 | * (We already have the _INI node from above) | ||
394 | */ | 411 | */ |
395 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 412 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, |
396 | pinfo.node, | 413 | pinfo.node, |
397 | METHOD_NAME__INI)); | 414 | METHOD_NAME__INI)); |
398 | status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo); | ||
399 | if (ACPI_FAILURE(status)) { | ||
400 | /* No _INI (AE_NOT_FOUND) means device requires no initialization */ | ||
401 | 415 | ||
402 | if (status != AE_NOT_FOUND) { | 416 | pinfo.node = ini_node; |
403 | /* Ignore error and move on to next device */ | 417 | status = acpi_ns_evaluate_by_handle(&pinfo); |
418 | if (ACPI_FAILURE(status)) { | ||
419 | /* Ignore error and move on to next device */ | ||
404 | 420 | ||
405 | #ifdef ACPI_DEBUG_OUTPUT | 421 | #ifdef ACPI_DEBUG_OUTPUT |
406 | char *scope_name = | 422 | char *scope_name = acpi_ns_get_external_pathname(ini_node); |
407 | acpi_ns_get_external_pathname(pinfo.node); | ||
408 | 423 | ||
409 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", | 424 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", |
410 | scope_name, | 425 | scope_name, acpi_format_exception(status))); |
411 | acpi_format_exception(status))); | ||
412 | 426 | ||
413 | ACPI_MEM_FREE(scope_name); | 427 | ACPI_MEM_FREE(scope_name); |
414 | #endif | 428 | #endif |
415 | } | ||
416 | |||
417 | status = AE_OK; | ||
418 | } else { | 429 | } else { |
419 | /* Delete any return object (especially if implicit_return is enabled) */ | 430 | /* Delete any return object (especially if implicit_return is enabled) */ |
420 | 431 | ||
@@ -434,5 +445,5 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
434 | acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); | 445 | acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); |
435 | } | 446 | } |
436 | 447 | ||
437 | return_ACPI_STATUS(status); | 448 | return_ACPI_STATUS(AE_OK); |
438 | } | 449 | } |
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index 50a3ca5470ed..c1b1943d4670 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c | |||
@@ -99,8 +99,8 @@ acpi_ns_search_node(u32 target_name, | |||
99 | if (scope_name) { | 99 | if (scope_name) { |
100 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 100 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
101 | "Searching %s (%p) For [%4.4s] (%s)\n", | 101 | "Searching %s (%p) For [%4.4s] (%s)\n", |
102 | scope_name, node, | 102 | scope_name, node, ACPI_CAST_PTR(char, |
103 | (char *)&target_name, | 103 | &target_name), |
104 | acpi_ut_get_type_name(type))); | 104 | acpi_ut_get_type_name(type))); |
105 | 105 | ||
106 | ACPI_MEM_FREE(scope_name); | 106 | ACPI_MEM_FREE(scope_name); |
@@ -131,7 +131,7 @@ acpi_ns_search_node(u32 target_name, | |||
131 | */ | 131 | */ |
132 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 132 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
133 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", | 133 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", |
134 | (char *)&target_name, | 134 | ACPI_CAST_PTR(char, &target_name), |
135 | acpi_ut_get_type_name(next_node-> | 135 | acpi_ut_get_type_name(next_node-> |
136 | type), | 136 | type), |
137 | next_node, | 137 | next_node, |
@@ -160,7 +160,8 @@ acpi_ns_search_node(u32 target_name, | |||
160 | 160 | ||
161 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 161 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
162 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", | 162 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", |
163 | (char *)&target_name, acpi_ut_get_type_name(type), | 163 | ACPI_CAST_PTR(char, &target_name), |
164 | acpi_ut_get_type_name(type), | ||
164 | acpi_ut_get_node_name(node), node, node->child)); | 165 | acpi_ut_get_node_name(node), node, node->child)); |
165 | 166 | ||
166 | return_ACPI_STATUS(AE_NOT_FOUND); | 167 | return_ACPI_STATUS(AE_NOT_FOUND); |
@@ -210,14 +211,14 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
210 | */ | 211 | */ |
211 | if (!parent_node) { | 212 | if (!parent_node) { |
212 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n", | 213 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n", |
213 | (char *)&target_name)); | 214 | ACPI_CAST_PTR(char, &target_name))); |
214 | return_ACPI_STATUS(AE_NOT_FOUND); | 215 | return_ACPI_STATUS(AE_NOT_FOUND); |
215 | } | 216 | } |
216 | 217 | ||
217 | if (acpi_ns_local(type)) { | 218 | if (acpi_ns_local(type)) { |
218 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 219 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
219 | "[%4.4s] type [%s] must be local to this scope (no parent search)\n", | 220 | "[%4.4s] type [%s] must be local to this scope (no parent search)\n", |
220 | (char *)&target_name, | 221 | ACPI_CAST_PTR(char, &target_name), |
221 | acpi_ut_get_type_name(type))); | 222 | acpi_ut_get_type_name(type))); |
222 | return_ACPI_STATUS(AE_NOT_FOUND); | 223 | return_ACPI_STATUS(AE_NOT_FOUND); |
223 | } | 224 | } |
@@ -227,7 +228,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
227 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 228 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
228 | "Searching parent [%4.4s] for [%4.4s]\n", | 229 | "Searching parent [%4.4s] for [%4.4s]\n", |
229 | acpi_ut_get_node_name(parent_node), | 230 | acpi_ut_get_node_name(parent_node), |
230 | (char *)&target_name)); | 231 | ACPI_CAST_PTR(char, &target_name))); |
231 | 232 | ||
232 | /* | 233 | /* |
233 | * Search parents until target is found or we have backed up to the root | 234 | * Search parents until target is found or we have backed up to the root |
@@ -360,7 +361,7 @@ acpi_ns_search_and_enter(u32 target_name, | |||
360 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { | 361 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { |
361 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 362 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
362 | "%4.4s Not found in %p [Not adding]\n", | 363 | "%4.4s Not found in %p [Not adding]\n", |
363 | (char *)&target_name, node)); | 364 | ACPI_CAST_PTR(char, &target_name), node)); |
364 | 365 | ||
365 | return_ACPI_STATUS(AE_NOT_FOUND); | 366 | return_ACPI_STATUS(AE_NOT_FOUND); |
366 | } | 367 | } |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 8167af1fa57b..75b137a6a3c9 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -473,8 +473,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
473 | return (AE_CTRL_DEPTH); | 473 | return (AE_CTRL_DEPTH); |
474 | } | 474 | } |
475 | 475 | ||
476 | if (!(flags & 0x01)) { | 476 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
477 | /* Don't return at the device or children of the device if not there */ | 477 | /* Don't examine children of the device if not present */ |
478 | 478 | ||
479 | return (AE_CTRL_DEPTH); | 479 | return (AE_CTRL_DEPTH); |
480 | } | 480 | } |