diff options
author | Bob Moore <robert.moore@intel.com> | 2017-11-17 18:42:22 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-11-26 19:20:32 -0500 |
commit | 16ccf829201cef23edaa5524f3f91e05861c4455 (patch) | |
tree | 9a9cae66c2fbf74e0c3f6060d2cb8f95f181de5a | |
parent | 4b9b1de798b668c02942792e2b3be8587c04c030 (diff) |
ACPICA: Enhance error messages from namespace create/lookup operations
ACPICA commit b09c8d7bdc8c5a3db0a8d38bfd6182c023885e12
1) Emit the full pathname (scope+name) instead of just the name
2) For AE_ALREADY_EXISTS and AE_NOT_FOUND, use the "firmware error"
string to point to the true problem.
Link: https://github.com/acpica/acpica/commit/b09c8d7b
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/acpica/acmacros.h | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/acnamesp.h | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/acutils.h | 12 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsfield.c | 28 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsobject.c | 4 | ||||
-rw-r--r-- | drivers/acpi/acpica/dsutils.c | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/dswload.c | 6 | ||||
-rw-r--r-- | drivers/acpi/acpica/dswload2.c | 13 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsconvert.c | 3 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsnames.c | 146 | ||||
-rw-r--r-- | drivers/acpi/acpica/psargs.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/uterror.c | 73 |
12 files changed, 270 insertions, 25 deletions
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index c7f0c96cc00f..128a3d71b598 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -455,7 +455,7 @@ | |||
455 | * the plist contains a set of parens to allow variable-length lists. | 455 | * the plist contains a set of parens to allow variable-length lists. |
456 | * These macros are used for both the debug and non-debug versions of the code. | 456 | * These macros are used for both the debug and non-debug versions of the code. |
457 | */ | 457 | */ |
458 | #define ACPI_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e); | 458 | #define ACPI_ERROR_NAMESPACE(s, p, e) acpi_ut_prefixed_namespace_error (AE_INFO, s, p, e); |
459 | #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e); | 459 | #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e); |
460 | #define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist | 460 | #define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist |
461 | #define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist | 461 | #define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist |
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 54a0c51b3e37..2fb1bb78d85c 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
@@ -289,6 +289,9 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, | |||
289 | char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node, | 289 | char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node, |
290 | u8 no_trailing); | 290 | u8 no_trailing); |
291 | 291 | ||
292 | char *acpi_ns_build_prefixed_pathname(union acpi_generic_state *prefix_scope, | ||
293 | const char *internal_path); | ||
294 | |||
292 | char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); | 295 | char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); |
293 | 296 | ||
294 | acpi_status | 297 | acpi_status |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index bb97a18158ec..d38187ee11c8 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
@@ -126,10 +126,10 @@ extern const char *acpi_gbl_ptyp_decode[]; | |||
126 | #endif | 126 | #endif |
127 | 127 | ||
128 | #ifndef ACPI_MSG_BIOS_ERROR | 128 | #ifndef ACPI_MSG_BIOS_ERROR |
129 | #define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): " | 129 | #define ACPI_MSG_BIOS_ERROR "Firmware Error (ACPI): " |
130 | #endif | 130 | #endif |
131 | #ifndef ACPI_MSG_BIOS_WARNING | 131 | #ifndef ACPI_MSG_BIOS_WARNING |
132 | #define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): " | 132 | #define ACPI_MSG_BIOS_WARNING "Firmware Warning (ACPI): " |
133 | #endif | 133 | #endif |
134 | 134 | ||
135 | /* | 135 | /* |
@@ -734,9 +734,11 @@ acpi_ut_predefined_bios_error(const char *module_name, | |||
734 | u8 node_flags, const char *format, ...); | 734 | u8 node_flags, const char *format, ...); |
735 | 735 | ||
736 | void | 736 | void |
737 | acpi_ut_namespace_error(const char *module_name, | 737 | acpi_ut_prefixed_namespace_error(const char *module_name, |
738 | u32 line_number, | 738 | u32 line_number, |
739 | const char *internal_name, acpi_status lookup_status); | 739 | union acpi_generic_state *prefix_scope, |
740 | const char *internal_name, | ||
741 | acpi_status lookup_status); | ||
740 | 742 | ||
741 | void | 743 | void |
742 | acpi_ut_method_error(const char *module_name, | 744 | acpi_ut_method_error(const char *module_name, |
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index 7bcf5f5ea029..0cab34a593d5 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c | |||
@@ -209,7 +209,8 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, | |||
209 | ACPI_IMODE_LOAD_PASS1, flags, | 209 | ACPI_IMODE_LOAD_PASS1, flags, |
210 | walk_state, &node); | 210 | walk_state, &node); |
211 | if (ACPI_FAILURE(status)) { | 211 | if (ACPI_FAILURE(status)) { |
212 | ACPI_ERROR_NAMESPACE(arg->common.value.string, status); | 212 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
213 | arg->common.value.string, status); | ||
213 | return_ACPI_STATUS(status); | 214 | return_ACPI_STATUS(status); |
214 | } | 215 | } |
215 | } | 216 | } |
@@ -383,7 +384,9 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
383 | walk_state, | 384 | walk_state, |
384 | &info->connection_node); | 385 | &info->connection_node); |
385 | if (ACPI_FAILURE(status)) { | 386 | if (ACPI_FAILURE(status)) { |
386 | ACPI_ERROR_NAMESPACE(child->common. | 387 | ACPI_ERROR_NAMESPACE(walk_state-> |
388 | scope_info, | ||
389 | child->common. | ||
387 | value.name, | 390 | value.name, |
388 | status); | 391 | status); |
389 | return_ACPI_STATUS(status); | 392 | return_ACPI_STATUS(status); |
@@ -402,7 +405,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
402 | ACPI_NS_DONT_OPEN_SCOPE, | 405 | ACPI_NS_DONT_OPEN_SCOPE, |
403 | walk_state, &info->field_node); | 406 | walk_state, &info->field_node); |
404 | if (ACPI_FAILURE(status)) { | 407 | if (ACPI_FAILURE(status)) { |
405 | ACPI_ERROR_NAMESPACE((char *)&arg->named.name, | 408 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
409 | (char *)&arg->named.name, | ||
406 | status); | 410 | status); |
407 | return_ACPI_STATUS(status); | 411 | return_ACPI_STATUS(status); |
408 | } else { | 412 | } else { |
@@ -498,7 +502,8 @@ acpi_ds_create_field(union acpi_parse_object *op, | |||
498 | ®ion_node); | 502 | ®ion_node); |
499 | #endif | 503 | #endif |
500 | if (ACPI_FAILURE(status)) { | 504 | if (ACPI_FAILURE(status)) { |
501 | ACPI_ERROR_NAMESPACE(arg->common.value.name, status); | 505 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
506 | arg->common.value.name, status); | ||
502 | return_ACPI_STATUS(status); | 507 | return_ACPI_STATUS(status); |
503 | } | 508 | } |
504 | } | 509 | } |
@@ -618,7 +623,8 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
618 | ACPI_IMODE_LOAD_PASS1, flags, | 623 | ACPI_IMODE_LOAD_PASS1, flags, |
619 | walk_state, &node); | 624 | walk_state, &node); |
620 | if (ACPI_FAILURE(status)) { | 625 | if (ACPI_FAILURE(status)) { |
621 | ACPI_ERROR_NAMESPACE((char *)&arg->named.name, | 626 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
627 | (char *)&arg->named.name, | ||
622 | status); | 628 | status); |
623 | if (status != AE_ALREADY_EXISTS) { | 629 | if (status != AE_ALREADY_EXISTS) { |
624 | return_ACPI_STATUS(status); | 630 | return_ACPI_STATUS(status); |
@@ -681,7 +687,8 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, | |||
681 | ®ion_node); | 687 | ®ion_node); |
682 | #endif | 688 | #endif |
683 | if (ACPI_FAILURE(status)) { | 689 | if (ACPI_FAILURE(status)) { |
684 | ACPI_ERROR_NAMESPACE(arg->common.value.name, status); | 690 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
691 | arg->common.value.name, status); | ||
685 | return_ACPI_STATUS(status); | 692 | return_ACPI_STATUS(status); |
686 | } | 693 | } |
687 | } | 694 | } |
@@ -695,7 +702,8 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, | |||
695 | ACPI_NS_SEARCH_PARENT, walk_state, | 702 | ACPI_NS_SEARCH_PARENT, walk_state, |
696 | &info.register_node); | 703 | &info.register_node); |
697 | if (ACPI_FAILURE(status)) { | 704 | if (ACPI_FAILURE(status)) { |
698 | ACPI_ERROR_NAMESPACE(arg->common.value.string, status); | 705 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
706 | arg->common.value.string, status); | ||
699 | return_ACPI_STATUS(status); | 707 | return_ACPI_STATUS(status); |
700 | } | 708 | } |
701 | 709 | ||
@@ -765,7 +773,8 @@ acpi_ds_create_index_field(union acpi_parse_object *op, | |||
765 | ACPI_NS_SEARCH_PARENT, walk_state, | 773 | ACPI_NS_SEARCH_PARENT, walk_state, |
766 | &info.register_node); | 774 | &info.register_node); |
767 | if (ACPI_FAILURE(status)) { | 775 | if (ACPI_FAILURE(status)) { |
768 | ACPI_ERROR_NAMESPACE(arg->common.value.string, status); | 776 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
777 | arg->common.value.string, status); | ||
769 | return_ACPI_STATUS(status); | 778 | return_ACPI_STATUS(status); |
770 | } | 779 | } |
771 | 780 | ||
@@ -778,7 +787,8 @@ acpi_ds_create_index_field(union acpi_parse_object *op, | |||
778 | ACPI_NS_SEARCH_PARENT, walk_state, | 787 | ACPI_NS_SEARCH_PARENT, walk_state, |
779 | &info.data_register_node); | 788 | &info.data_register_node); |
780 | if (ACPI_FAILURE(status)) { | 789 | if (ACPI_FAILURE(status)) { |
781 | ACPI_ERROR_NAMESPACE(arg->common.value.string, status); | 790 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
791 | arg->common.value.string, status); | ||
782 | return_ACPI_STATUS(status); | 792 | return_ACPI_STATUS(status); |
783 | } | 793 | } |
784 | 794 | ||
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c index 82448551781b..b21fe084ffc8 100644 --- a/drivers/acpi/acpica/dsobject.c +++ b/drivers/acpi/acpica/dsobject.c | |||
@@ -112,7 +112,9 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
112 | acpi_namespace_node, | 112 | acpi_namespace_node, |
113 | &(op->common.node))); | 113 | &(op->common.node))); |
114 | if (ACPI_FAILURE(status)) { | 114 | if (ACPI_FAILURE(status)) { |
115 | ACPI_ERROR_NAMESPACE(op->common.value. | 115 | ACPI_ERROR_NAMESPACE(walk_state-> |
116 | scope_info, | ||
117 | op->common.value. | ||
116 | string, status); | 118 | string, status); |
117 | return_ACPI_STATUS(status); | 119 | return_ACPI_STATUS(status); |
118 | } | 120 | } |
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index 0dabd9b95684..4c5faf629a83 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c | |||
@@ -583,7 +583,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
583 | } | 583 | } |
584 | 584 | ||
585 | if (ACPI_FAILURE(status)) { | 585 | if (ACPI_FAILURE(status)) { |
586 | ACPI_ERROR_NAMESPACE(name_string, status); | 586 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
587 | name_string, status); | ||
587 | } | 588 | } |
588 | } | 589 | } |
589 | 590 | ||
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index eaa859a89702..5771e4e4a99a 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c | |||
@@ -207,7 +207,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state, | |||
207 | } | 207 | } |
208 | #endif | 208 | #endif |
209 | if (ACPI_FAILURE(status)) { | 209 | if (ACPI_FAILURE(status)) { |
210 | ACPI_ERROR_NAMESPACE(path, status); | 210 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, path, |
211 | status); | ||
211 | return_ACPI_STATUS(status); | 212 | return_ACPI_STATUS(status); |
212 | } | 213 | } |
213 | 214 | ||
@@ -375,7 +376,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state, | |||
375 | } | 376 | } |
376 | 377 | ||
377 | if (ACPI_FAILURE(status)) { | 378 | if (ACPI_FAILURE(status)) { |
378 | ACPI_ERROR_NAMESPACE(path, status); | 379 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
380 | path, status); | ||
379 | return_ACPI_STATUS(status); | 381 | return_ACPI_STATUS(status); |
380 | } | 382 | } |
381 | } | 383 | } |
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c index aad83ef5a4ec..b3d0aaec8203 100644 --- a/drivers/acpi/acpica/dswload2.c +++ b/drivers/acpi/acpica/dswload2.c | |||
@@ -184,11 +184,14 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
184 | if (status == AE_NOT_FOUND) { | 184 | if (status == AE_NOT_FOUND) { |
185 | status = AE_OK; | 185 | status = AE_OK; |
186 | } else { | 186 | } else { |
187 | ACPI_ERROR_NAMESPACE(buffer_ptr, | 187 | ACPI_ERROR_NAMESPACE(walk_state-> |
188 | scope_info, | ||
189 | buffer_ptr, | ||
188 | status); | 190 | status); |
189 | } | 191 | } |
190 | #else | 192 | #else |
191 | ACPI_ERROR_NAMESPACE(buffer_ptr, status); | 193 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
194 | buffer_ptr, status); | ||
192 | #endif | 195 | #endif |
193 | return_ACPI_STATUS(status); | 196 | return_ACPI_STATUS(status); |
194 | } | 197 | } |
@@ -343,7 +346,8 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
343 | } | 346 | } |
344 | 347 | ||
345 | if (ACPI_FAILURE(status)) { | 348 | if (ACPI_FAILURE(status)) { |
346 | ACPI_ERROR_NAMESPACE(buffer_ptr, status); | 349 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
350 | buffer_ptr, status); | ||
347 | return_ACPI_STATUS(status); | 351 | return_ACPI_STATUS(status); |
348 | } | 352 | } |
349 | 353 | ||
@@ -719,7 +723,8 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
719 | */ | 723 | */ |
720 | op->common.node = new_node; | 724 | op->common.node = new_node; |
721 | } else { | 725 | } else { |
722 | ACPI_ERROR_NAMESPACE(arg->common.value.string, status); | 726 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, |
727 | arg->common.value.string, status); | ||
723 | } | 728 | } |
724 | break; | 729 | break; |
725 | 730 | ||
diff --git a/drivers/acpi/acpica/nsconvert.c b/drivers/acpi/acpica/nsconvert.c index 539d775bbc92..d55dcc82f434 100644 --- a/drivers/acpi/acpica/nsconvert.c +++ b/drivers/acpi/acpica/nsconvert.c | |||
@@ -495,7 +495,8 @@ acpi_ns_convert_to_reference(struct acpi_namespace_node *scope, | |||
495 | 495 | ||
496 | /* Check if we are resolving a named reference within a package */ | 496 | /* Check if we are resolving a named reference within a package */ |
497 | 497 | ||
498 | ACPI_ERROR_NAMESPACE(original_object->string.pointer, status); | 498 | ACPI_ERROR_NAMESPACE(&scope_info, |
499 | original_object->string.pointer, status); | ||
499 | goto error_exit; | 500 | goto error_exit; |
500 | } | 501 | } |
501 | 502 | ||
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c index a410760a0308..4203d4589b6d 100644 --- a/drivers/acpi/acpica/nsnames.c +++ b/drivers/acpi/acpica/nsnames.c | |||
@@ -49,6 +49,9 @@ | |||
49 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME("nsnames") | 50 | ACPI_MODULE_NAME("nsnames") |
51 | 51 | ||
52 | /* Local Prototypes */ | ||
53 | static void acpi_ns_normalize_pathname(char *original_path); | ||
54 | |||
52 | /******************************************************************************* | 55 | /******************************************************************************* |
53 | * | 56 | * |
54 | * FUNCTION: acpi_ns_get_external_pathname | 57 | * FUNCTION: acpi_ns_get_external_pathname |
@@ -63,6 +66,7 @@ ACPI_MODULE_NAME("nsnames") | |||
63 | * for error and debug statements. | 66 | * for error and debug statements. |
64 | * | 67 | * |
65 | ******************************************************************************/ | 68 | ******************************************************************************/ |
69 | |||
66 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | 70 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) |
67 | { | 71 | { |
68 | char *name_buffer; | 72 | char *name_buffer; |
@@ -352,3 +356,145 @@ char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node, | |||
352 | 356 | ||
353 | return_PTR(name_buffer); | 357 | return_PTR(name_buffer); |
354 | } | 358 | } |
359 | |||
360 | /******************************************************************************* | ||
361 | * | ||
362 | * FUNCTION: acpi_ns_build_prefixed_pathname | ||
363 | * | ||
364 | * PARAMETERS: prefix_scope - Scope/Path that prefixes the internal path | ||
365 | * internal_path - Name or path of the namespace node | ||
366 | * | ||
367 | * RETURN: None | ||
368 | * | ||
369 | * DESCRIPTION: Construct a fully qualified pathname from a concatenation of: | ||
370 | * 1) Path associated with the prefix_scope namespace node | ||
371 | * 2) External path representation of the Internal path | ||
372 | * | ||
373 | ******************************************************************************/ | ||
374 | |||
375 | char *acpi_ns_build_prefixed_pathname(union acpi_generic_state *prefix_scope, | ||
376 | const char *internal_path) | ||
377 | { | ||
378 | acpi_status status; | ||
379 | char *full_path = NULL; | ||
380 | char *external_path; | ||
381 | char *prefix_path = NULL; | ||
382 | u32 prefix_path_length = 0; | ||
383 | |||
384 | /* If there is a prefix, get the pathname to it */ | ||
385 | |||
386 | if (prefix_scope && prefix_scope->scope.node) { | ||
387 | prefix_path = | ||
388 | acpi_ns_get_normalized_pathname(prefix_scope->scope.node, | ||
389 | TRUE); | ||
390 | if (prefix_path) { | ||
391 | prefix_path_length = strlen(prefix_path); | ||
392 | } | ||
393 | } | ||
394 | |||
395 | status = acpi_ns_externalize_name(ACPI_UINT32_MAX, internal_path, | ||
396 | NULL, &external_path); | ||
397 | if (ACPI_FAILURE(status)) { | ||
398 | goto cleanup; | ||
399 | } | ||
400 | |||
401 | /* Merge the prefix path and the path. 2 is for one dot and trailing null */ | ||
402 | |||
403 | full_path = | ||
404 | ACPI_ALLOCATE_ZEROED(prefix_path_length + strlen(external_path) + | ||
405 | 2); | ||
406 | if (!full_path) { | ||
407 | goto cleanup; | ||
408 | } | ||
409 | |||
410 | /* Don't merge if the External path is already fully qualified */ | ||
411 | |||
412 | if (prefix_path && (*external_path != '\\') && (*external_path != '^')) { | ||
413 | strcat(full_path, prefix_path); | ||
414 | if (prefix_path[1]) { | ||
415 | strcat(full_path, "."); | ||
416 | } | ||
417 | } | ||
418 | |||
419 | acpi_ns_normalize_pathname(external_path); | ||
420 | strcat(full_path, external_path); | ||
421 | |||
422 | cleanup: | ||
423 | if (prefix_path) { | ||
424 | ACPI_FREE(prefix_path); | ||
425 | } | ||
426 | |||
427 | return (full_path); | ||
428 | } | ||
429 | |||
430 | /******************************************************************************* | ||
431 | * | ||
432 | * FUNCTION: acpi_ns_normalize_pathname | ||
433 | * | ||
434 | * PARAMETERS: original_path - Path to be normalized, in External format | ||
435 | * | ||
436 | * RETURN: The original path is processed in-place | ||
437 | * | ||
438 | * DESCRIPTION: Remove trailing underscores from each element of a path. | ||
439 | * | ||
440 | * For example: \A___.B___.C___ becomes \A.B.C | ||
441 | * | ||
442 | ******************************************************************************/ | ||
443 | |||
444 | static void acpi_ns_normalize_pathname(char *original_path) | ||
445 | { | ||
446 | char *input_path = original_path; | ||
447 | char *new_path_buffer; | ||
448 | char *new_path; | ||
449 | u32 i; | ||
450 | |||
451 | /* Allocate a temp buffer in which to construct the new path */ | ||
452 | |||
453 | new_path_buffer = ACPI_ALLOCATE_ZEROED(strlen(input_path) + 1); | ||
454 | new_path = new_path_buffer; | ||
455 | if (!new_path_buffer) { | ||
456 | return; | ||
457 | } | ||
458 | |||
459 | /* Special characters may appear at the beginning of the path */ | ||
460 | |||
461 | if (*input_path == '\\') { | ||
462 | *new_path = *input_path; | ||
463 | new_path++; | ||
464 | input_path++; | ||
465 | } | ||
466 | |||
467 | while (*input_path == '^') { | ||
468 | *new_path = *input_path; | ||
469 | new_path++; | ||
470 | input_path++; | ||
471 | } | ||
472 | |||
473 | /* Remainder of the path */ | ||
474 | |||
475 | while (*input_path) { | ||
476 | |||
477 | /* Do one nameseg at a time */ | ||
478 | |||
479 | for (i = 0; (i < ACPI_NAME_SIZE) && *input_path; i++) { | ||
480 | if ((i == 0) || (*input_path != '_')) { /* First char is allowed to be underscore */ | ||
481 | *new_path = *input_path; | ||
482 | new_path++; | ||
483 | } | ||
484 | |||
485 | input_path++; | ||
486 | } | ||
487 | |||
488 | /* Dot means that there are more namesegs to come */ | ||
489 | |||
490 | if (*input_path == '.') { | ||
491 | *new_path = *input_path; | ||
492 | new_path++; | ||
493 | input_path++; | ||
494 | } | ||
495 | } | ||
496 | |||
497 | *new_path = 0; | ||
498 | strcpy(original_path, new_path_buffer); | ||
499 | ACPI_FREE(new_path_buffer); | ||
500 | } | ||
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c index eb9dfaca555f..171e2faa7c50 100644 --- a/drivers/acpi/acpica/psargs.c +++ b/drivers/acpi/acpica/psargs.c | |||
@@ -361,7 +361,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
361 | /* Final exception check (may have been changed from code above) */ | 361 | /* Final exception check (may have been changed from code above) */ |
362 | 362 | ||
363 | if (ACPI_FAILURE(status)) { | 363 | if (ACPI_FAILURE(status)) { |
364 | ACPI_ERROR_NAMESPACE(path, status); | 364 | ACPI_ERROR_NAMESPACE(walk_state->scope_info, path, status); |
365 | 365 | ||
366 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == | 366 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == |
367 | ACPI_PARSE_EXECUTE) { | 367 | ACPI_PARSE_EXECUTE) { |
diff --git a/drivers/acpi/acpica/uterror.c b/drivers/acpi/acpica/uterror.c index e3368186e1c1..42388dcb5ccc 100644 --- a/drivers/acpi/acpica/uterror.c +++ b/drivers/acpi/acpica/uterror.c | |||
@@ -182,6 +182,78 @@ acpi_ut_predefined_bios_error(const char *module_name, | |||
182 | 182 | ||
183 | /******************************************************************************* | 183 | /******************************************************************************* |
184 | * | 184 | * |
185 | * FUNCTION: acpi_ut_prefixed_namespace_error | ||
186 | * | ||
187 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
188 | * line_number - Caller's line number (for error output) | ||
189 | * prefix_scope - Scope/Path that prefixes the internal path | ||
190 | * internal_path - Name or path of the namespace node | ||
191 | * lookup_status - Exception code from NS lookup | ||
192 | * | ||
193 | * RETURN: None | ||
194 | * | ||
195 | * DESCRIPTION: Print error message with the full pathname constructed this way: | ||
196 | * | ||
197 | * prefix_scope_node_full_path.externalized_internal_path | ||
198 | * | ||
199 | * NOTE: 10/2017: Treat the major ns_lookup errors as firmware errors | ||
200 | * | ||
201 | ******************************************************************************/ | ||
202 | |||
203 | void | ||
204 | acpi_ut_prefixed_namespace_error(const char *module_name, | ||
205 | u32 line_number, | ||
206 | union acpi_generic_state *prefix_scope, | ||
207 | const char *internal_path, | ||
208 | acpi_status lookup_status) | ||
209 | { | ||
210 | char *full_path; | ||
211 | const char *message; | ||
212 | |||
213 | /* | ||
214 | * Main cases: | ||
215 | * 1) Object creation, object must not already exist | ||
216 | * 2) Object lookup, object must exist | ||
217 | */ | ||
218 | switch (lookup_status) { | ||
219 | case AE_ALREADY_EXISTS: | ||
220 | |||
221 | acpi_os_printf(ACPI_MSG_BIOS_ERROR); | ||
222 | message = "Failure creating"; | ||
223 | break; | ||
224 | |||
225 | case AE_NOT_FOUND: | ||
226 | |||
227 | acpi_os_printf(ACPI_MSG_BIOS_ERROR); | ||
228 | message = "Failure looking up"; | ||
229 | break; | ||
230 | |||
231 | default: | ||
232 | |||
233 | acpi_os_printf(ACPI_MSG_ERROR); | ||
234 | message = "Failure looking up"; | ||
235 | break; | ||
236 | } | ||
237 | |||
238 | /* Concatenate the prefix path and the internal path */ | ||
239 | |||
240 | full_path = | ||
241 | acpi_ns_build_prefixed_pathname(prefix_scope, internal_path); | ||
242 | |||
243 | acpi_os_printf("%s [%s], %s", message, | ||
244 | full_path ? full_path : "Could not get pathname", | ||
245 | acpi_format_exception(lookup_status)); | ||
246 | |||
247 | if (full_path) { | ||
248 | ACPI_FREE(full_path); | ||
249 | } | ||
250 | |||
251 | ACPI_MSG_SUFFIX; | ||
252 | } | ||
253 | |||
254 | #ifdef __OBSOLETE_FUNCTION | ||
255 | /******************************************************************************* | ||
256 | * | ||
185 | * FUNCTION: acpi_ut_namespace_error | 257 | * FUNCTION: acpi_ut_namespace_error |
186 | * | 258 | * |
187 | * PARAMETERS: module_name - Caller's module name (for error output) | 259 | * PARAMETERS: module_name - Caller's module name (for error output) |
@@ -240,6 +312,7 @@ acpi_ut_namespace_error(const char *module_name, | |||
240 | ACPI_MSG_SUFFIX; | 312 | ACPI_MSG_SUFFIX; |
241 | ACPI_MSG_REDIRECT_END; | 313 | ACPI_MSG_REDIRECT_END; |
242 | } | 314 | } |
315 | #endif | ||
243 | 316 | ||
244 | /******************************************************************************* | 317 | /******************************************************************************* |
245 | * | 318 | * |