diff options
Diffstat (limited to 'drivers/acpi/namespace/nsinit.c')
-rw-r--r-- | drivers/acpi/namespace/nsinit.c | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index bf1d8dbc0b86..1c9ca6e05314 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -154,7 +154,16 @@ acpi_status acpi_ns_initialize_devices(void) | |||
154 | ACPI_UINT32_MAX, FALSE, | 154 | ACPI_UINT32_MAX, FALSE, |
155 | acpi_ns_find_ini_methods, &info, NULL); | 155 | acpi_ns_find_ini_methods, &info, NULL); |
156 | if (ACPI_FAILURE(status)) { | 156 | if (ACPI_FAILURE(status)) { |
157 | ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); | 157 | goto error_exit; |
158 | } | ||
159 | |||
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; | ||
158 | } | 167 | } |
159 | 168 | ||
160 | /* Walk namespace to execute all _INIs on present devices */ | 169 | /* Walk namespace to execute all _INIs on present devices */ |
@@ -162,8 +171,10 @@ acpi_status acpi_ns_initialize_devices(void) | |||
162 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, | 171 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
163 | ACPI_UINT32_MAX, FALSE, | 172 | ACPI_UINT32_MAX, FALSE, |
164 | acpi_ns_init_one_device, &info, NULL); | 173 | acpi_ns_init_one_device, &info, NULL); |
174 | |||
175 | ACPI_FREE(info.evaluate_info); | ||
165 | if (ACPI_FAILURE(status)) { | 176 | if (ACPI_FAILURE(status)) { |
166 | ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); | 177 | goto error_exit; |
167 | } | 178 | } |
168 | 179 | ||
169 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 180 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
@@ -171,6 +182,10 @@ acpi_status acpi_ns_initialize_devices(void) | |||
171 | info.num_INI, info.num_STA, info.device_count)); | 182 | info.num_INI, info.num_STA, info.device_count)); |
172 | 183 | ||
173 | 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); | ||
174 | } | 189 | } |
175 | 190 | ||
176 | /******************************************************************************* | 191 | /******************************************************************************* |
@@ -398,9 +413,9 @@ static acpi_status | |||
398 | acpi_ns_init_one_device(acpi_handle obj_handle, | 413 | acpi_ns_init_one_device(acpi_handle obj_handle, |
399 | u32 nesting_level, void *context, void **return_value) | 414 | u32 nesting_level, void *context, void **return_value) |
400 | { | 415 | { |
401 | struct acpi_device_walk_info *info = | 416 | struct acpi_device_walk_info *walk_info = |
402 | ACPI_CAST_PTR(struct acpi_device_walk_info, context); | 417 | ACPI_CAST_PTR(struct acpi_device_walk_info, context); |
403 | struct acpi_parameter_info pinfo; | 418 | struct acpi_evaluate_info *info = walk_info->evaluate_info; |
404 | u32 flags; | 419 | u32 flags; |
405 | acpi_status status; | 420 | acpi_status status; |
406 | struct acpi_namespace_node *device_node; | 421 | struct acpi_namespace_node *device_node; |
@@ -460,7 +475,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
460 | * other words, the device is present, ..., and functioning)" | 475 | * other words, the device is present, ..., and functioning)" |
461 | */ | 476 | */ |
462 | if (flags != ACPI_UINT32_MAX) { | 477 | if (flags != ACPI_UINT32_MAX) { |
463 | info->num_STA++; | 478 | walk_info->num_STA++; |
464 | } | 479 | } |
465 | 480 | ||
466 | /* | 481 | /* |
@@ -516,20 +531,16 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
516 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 531 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
517 | (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI)); | 532 | (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI)); |
518 | 533 | ||
519 | pinfo.node = device_node; | 534 | info->prefix_node = device_node; |
520 | pinfo.parameters = NULL; | 535 | info->pathname = METHOD_NAME__INI; |
521 | pinfo.parameter_type = ACPI_PARAM_ARGS; | 536 | info->parameters = NULL; |
537 | info->parameter_type = ACPI_PARAM_ARGS; | ||
538 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
522 | 539 | ||
523 | status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo); | 540 | status = acpi_ns_evaluate(info); |
524 | if (ACPI_SUCCESS(status)) { | 541 | if (ACPI_SUCCESS(status)) { |
542 | walk_info->num_INI++; | ||
525 | 543 | ||
526 | /* Delete any return object (especially if implicit_return is enabled) */ | ||
527 | |||
528 | if (pinfo.return_object) { | ||
529 | acpi_ut_remove_reference(pinfo.return_object); | ||
530 | } | ||
531 | |||
532 | info->num_INI++; | ||
533 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && | 544 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && |
534 | (!(acpi_dbg_level & ACPI_LV_INFO))) { | 545 | (!(acpi_dbg_level & ACPI_LV_INFO))) { |
535 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | 546 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); |
@@ -540,20 +551,24 @@ acpi_ns_init_one_device(acpi_handle obj_handle, | |||
540 | 551 | ||
541 | /* Ignore error and move on to next device */ | 552 | /* Ignore error and move on to next device */ |
542 | 553 | ||
543 | char *scope_name = acpi_ns_get_external_pathname(pinfo.node); | 554 | char *scope_name = |
555 | acpi_ns_get_external_pathname(info->resolved_node); | ||
544 | 556 | ||
545 | ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", | 557 | ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", |
546 | scope_name)); | 558 | scope_name)); |
547 | ACPI_FREE(scope_name); | 559 | ACPI_FREE(scope_name); |
560 | status = AE_OK; | ||
548 | } | 561 | } |
549 | #endif | 562 | #endif |
550 | 563 | ||
551 | /* If an external initialization handler is present, call it */ | 564 | /* |
552 | 565 | * The _INI method has been run if present; call the Global Initialization | |
566 | * Handler for this device. | ||
567 | */ | ||
553 | if (acpi_gbl_init_handler) { | 568 | if (acpi_gbl_init_handler) { |
554 | status = | 569 | status = |
555 | acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); | 570 | acpi_gbl_init_handler(device_node, ACPI_INIT_DEVICE_INI); |
556 | } | 571 | } |
557 | 572 | ||
558 | return_ACPI_STATUS(AE_OK); | 573 | return_ACPI_STATUS(status); |
559 | } | 574 | } |