diff options
author | Bob Moore <robert.moore@intel.com> | 2010-09-15 02:09:14 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-10-01 01:47:56 -0400 |
commit | cc84e262b71bab53c3b2be2e71209c85b88b4b4d (patch) | |
tree | 9dba63aa6b328992e0dbaa36c74078715257a0c2 /drivers/acpi/acpica | |
parent | 31b3d4c3b3c599a2329c3e66ffab7a045b169c85 (diff) |
ACPICA: iASL/Disassembler: Write ACPI errors to stderr instead of output file
This keeps the output files clean of random error messages that
may originate from within the namespace/interpreter code.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r-- | drivers/acpi/acpica/Makefile | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/acmacros.h | 4 | ||||
-rw-r--r-- | drivers/acpi/acpica/acnamesp.h | 12 | ||||
-rw-r--r-- | drivers/acpi/acpica/acutils.h | 39 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsutils.c | 98 | ||||
-rw-r--r-- | drivers/acpi/acpica/utmisc.c | 162 | ||||
-rw-r--r-- | drivers/acpi/acpica/utxferror.c | 415 |
7 files changed, 445 insertions, 287 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 4fdcfdb1618b..a7e1d1aa4107 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -45,4 +45,4 @@ acpi-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o | |||
45 | acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ | 45 | acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ |
46 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ | 46 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ |
47 | utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o \ | 47 | utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o \ |
48 | utosi.o | 48 | utosi.o utxferror.o |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index 9894929a2abb..8d5c9e0a495f 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -338,8 +338,8 @@ | |||
338 | * the plist contains a set of parens to allow variable-length lists. | 338 | * the plist contains a set of parens to allow variable-length lists. |
339 | * These macros are used for both the debug and non-debug versions of the code. | 339 | * These macros are used for both the debug and non-debug versions of the code. |
340 | */ | 340 | */ |
341 | #define ACPI_ERROR_NAMESPACE(s, e) acpi_ns_report_error (AE_INFO, s, e); | 341 | #define ACPI_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e); |
342 | #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ns_report_method_error (AE_INFO, s, n, p, e); | 342 | #define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e); |
343 | #define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist | 343 | #define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist |
344 | #define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist | 344 | #define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist |
345 | 345 | ||
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 9f60ff002203..d44d3bc5b847 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
@@ -339,18 +339,6 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node); | |||
339 | u32 acpi_ns_local(acpi_object_type type); | 339 | u32 acpi_ns_local(acpi_object_type type); |
340 | 340 | ||
341 | void | 341 | void |
342 | acpi_ns_report_error(const char *module_name, | ||
343 | u32 line_number, | ||
344 | const char *internal_name, acpi_status lookup_status); | ||
345 | |||
346 | void | ||
347 | acpi_ns_report_method_error(const char *module_name, | ||
348 | u32 line_number, | ||
349 | const char *message, | ||
350 | struct acpi_namespace_node *node, | ||
351 | const char *path, acpi_status lookup_status); | ||
352 | |||
353 | void | ||
354 | acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg); | 342 | acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg); |
355 | 343 | ||
356 | acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info); | 344 | acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info); |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index 78e01211c7a1..72e4183c1937 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
@@ -486,17 +486,6 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position); | |||
486 | 486 | ||
487 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer); | 487 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer); |
488 | 488 | ||
489 | void ACPI_INTERNAL_VAR_XFACE | ||
490 | acpi_ut_predefined_warning(const char *module_name, | ||
491 | u32 line_number, | ||
492 | char *pathname, | ||
493 | u8 node_flags, const char *format, ...); | ||
494 | |||
495 | void ACPI_INTERNAL_VAR_XFACE | ||
496 | acpi_ut_predefined_info(const char *module_name, | ||
497 | u32 line_number, | ||
498 | char *pathname, u8 node_flags, const char *format, ...); | ||
499 | |||
500 | /* Values for Base above (16=Hex, 10=Decimal) */ | 489 | /* Values for Base above (16=Hex, 10=Decimal) */ |
501 | 490 | ||
502 | #define ACPI_ANY_BASE 0 | 491 | #define ACPI_ANY_BASE 0 |
@@ -587,6 +576,32 @@ acpi_status | |||
587 | acpi_ut_create_list(char *list_name, | 576 | acpi_ut_create_list(char *list_name, |
588 | u16 object_size, struct acpi_memory_list **return_cache); | 577 | u16 object_size, struct acpi_memory_list **return_cache); |
589 | 578 | ||
590 | #endif | 579 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ |
580 | |||
581 | /* | ||
582 | * utxferror - various error/warning output functions | ||
583 | */ | ||
584 | void ACPI_INTERNAL_VAR_XFACE | ||
585 | acpi_ut_predefined_warning(const char *module_name, | ||
586 | u32 line_number, | ||
587 | char *pathname, | ||
588 | u8 node_flags, const char *format, ...); | ||
589 | |||
590 | void ACPI_INTERNAL_VAR_XFACE | ||
591 | acpi_ut_predefined_info(const char *module_name, | ||
592 | u32 line_number, | ||
593 | char *pathname, u8 node_flags, const char *format, ...); | ||
594 | |||
595 | void | ||
596 | acpi_ut_namespace_error(const char *module_name, | ||
597 | u32 line_number, | ||
598 | const char *internal_name, acpi_status lookup_status); | ||
599 | |||
600 | void | ||
601 | acpi_ut_method_error(const char *module_name, | ||
602 | u32 line_number, | ||
603 | const char *message, | ||
604 | struct acpi_namespace_node *node, | ||
605 | const char *path, acpi_status lookup_status); | ||
591 | 606 | ||
592 | #endif /* _ACUTILS_H */ | 607 | #endif /* _ACUTILS_H */ |
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index e1add3491b04..a7d6ad9c111b 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c | |||
@@ -60,104 +60,6 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search); | |||
60 | 60 | ||
61 | /******************************************************************************* | 61 | /******************************************************************************* |
62 | * | 62 | * |
63 | * FUNCTION: acpi_ns_report_error | ||
64 | * | ||
65 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
66 | * line_number - Caller's line number (for error output) | ||
67 | * internal_name - Name or path of the namespace node | ||
68 | * lookup_status - Exception code from NS lookup | ||
69 | * | ||
70 | * RETURN: None | ||
71 | * | ||
72 | * DESCRIPTION: Print warning message with full pathname | ||
73 | * | ||
74 | ******************************************************************************/ | ||
75 | |||
76 | void | ||
77 | acpi_ns_report_error(const char *module_name, | ||
78 | u32 line_number, | ||
79 | const char *internal_name, acpi_status lookup_status) | ||
80 | { | ||
81 | acpi_status status; | ||
82 | u32 bad_name; | ||
83 | char *name = NULL; | ||
84 | |||
85 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); | ||
86 | |||
87 | if (lookup_status == AE_BAD_CHARACTER) { | ||
88 | |||
89 | /* There is a non-ascii character in the name */ | ||
90 | |||
91 | ACPI_MOVE_32_TO_32(&bad_name, | ||
92 | ACPI_CAST_PTR(u32, internal_name)); | ||
93 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); | ||
94 | } else { | ||
95 | /* Convert path to external format */ | ||
96 | |||
97 | status = acpi_ns_externalize_name(ACPI_UINT32_MAX, | ||
98 | internal_name, NULL, &name); | ||
99 | |||
100 | /* Print target name */ | ||
101 | |||
102 | if (ACPI_SUCCESS(status)) { | ||
103 | acpi_os_printf("[%s]", name); | ||
104 | } else { | ||
105 | acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); | ||
106 | } | ||
107 | |||
108 | if (name) { | ||
109 | ACPI_FREE(name); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | acpi_os_printf(" Namespace lookup failure, %s\n", | ||
114 | acpi_format_exception(lookup_status)); | ||
115 | } | ||
116 | |||
117 | /******************************************************************************* | ||
118 | * | ||
119 | * FUNCTION: acpi_ns_report_method_error | ||
120 | * | ||
121 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
122 | * line_number - Caller's line number (for error output) | ||
123 | * Message - Error message to use on failure | ||
124 | * prefix_node - Prefix relative to the path | ||
125 | * Path - Path to the node (optional) | ||
126 | * method_status - Execution status | ||
127 | * | ||
128 | * RETURN: None | ||
129 | * | ||
130 | * DESCRIPTION: Print warning message with full pathname | ||
131 | * | ||
132 | ******************************************************************************/ | ||
133 | |||
134 | void | ||
135 | acpi_ns_report_method_error(const char *module_name, | ||
136 | u32 line_number, | ||
137 | const char *message, | ||
138 | struct acpi_namespace_node *prefix_node, | ||
139 | const char *path, acpi_status method_status) | ||
140 | { | ||
141 | acpi_status status; | ||
142 | struct acpi_namespace_node *node = prefix_node; | ||
143 | |||
144 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); | ||
145 | |||
146 | if (path) { | ||
147 | status = | ||
148 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, | ||
149 | &node); | ||
150 | if (ACPI_FAILURE(status)) { | ||
151 | acpi_os_printf("[Could not get node by pathname]"); | ||
152 | } | ||
153 | } | ||
154 | |||
155 | acpi_ns_print_node_pathname(node, message); | ||
156 | acpi_os_printf(", %s\n", acpi_format_exception(method_status)); | ||
157 | } | ||
158 | |||
159 | /******************************************************************************* | ||
160 | * | ||
161 | * FUNCTION: acpi_ns_print_node_pathname | 63 | * FUNCTION: acpi_ns_print_node_pathname |
162 | * | 64 | * |
163 | * PARAMETERS: Node - Object | 65 | * PARAMETERS: Node - Object |
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index e8d0724ee403..c7d0e05ef5a4 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c | |||
@@ -50,11 +50,6 @@ | |||
50 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
51 | ACPI_MODULE_NAME("utmisc") | 51 | ACPI_MODULE_NAME("utmisc") |
52 | 52 | ||
53 | /* | ||
54 | * Common suffix for messages | ||
55 | */ | ||
56 | #define ACPI_COMMON_MSG_SUFFIX \ | ||
57 | acpi_os_printf(" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) | ||
58 | /******************************************************************************* | 53 | /******************************************************************************* |
59 | * | 54 | * |
60 | * FUNCTION: acpi_ut_validate_exception | 55 | * FUNCTION: acpi_ut_validate_exception |
@@ -1044,160 +1039,3 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
1044 | 1039 | ||
1045 | return_ACPI_STATUS(AE_AML_INTERNAL); | 1040 | return_ACPI_STATUS(AE_AML_INTERNAL); |
1046 | } | 1041 | } |
1047 | |||
1048 | /******************************************************************************* | ||
1049 | * | ||
1050 | * FUNCTION: acpi_error, acpi_exception, acpi_warning, acpi_info | ||
1051 | * | ||
1052 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
1053 | * line_number - Caller's line number (for error output) | ||
1054 | * Format - Printf format string + additional args | ||
1055 | * | ||
1056 | * RETURN: None | ||
1057 | * | ||
1058 | * DESCRIPTION: Print message with module/line/version info | ||
1059 | * | ||
1060 | ******************************************************************************/ | ||
1061 | |||
1062 | void ACPI_INTERNAL_VAR_XFACE | ||
1063 | acpi_error(const char *module_name, u32 line_number, const char *format, ...) | ||
1064 | { | ||
1065 | va_list args; | ||
1066 | |||
1067 | acpi_os_printf("ACPI Error: "); | ||
1068 | |||
1069 | va_start(args, format); | ||
1070 | acpi_os_vprintf(format, args); | ||
1071 | ACPI_COMMON_MSG_SUFFIX; | ||
1072 | va_end(args); | ||
1073 | } | ||
1074 | |||
1075 | void ACPI_INTERNAL_VAR_XFACE | ||
1076 | acpi_exception(const char *module_name, | ||
1077 | u32 line_number, acpi_status status, const char *format, ...) | ||
1078 | { | ||
1079 | va_list args; | ||
1080 | |||
1081 | acpi_os_printf("ACPI Exception: %s, ", acpi_format_exception(status)); | ||
1082 | |||
1083 | va_start(args, format); | ||
1084 | acpi_os_vprintf(format, args); | ||
1085 | ACPI_COMMON_MSG_SUFFIX; | ||
1086 | va_end(args); | ||
1087 | } | ||
1088 | |||
1089 | void ACPI_INTERNAL_VAR_XFACE | ||
1090 | acpi_warning(const char *module_name, u32 line_number, const char *format, ...) | ||
1091 | { | ||
1092 | va_list args; | ||
1093 | |||
1094 | acpi_os_printf("ACPI Warning: "); | ||
1095 | |||
1096 | va_start(args, format); | ||
1097 | acpi_os_vprintf(format, args); | ||
1098 | ACPI_COMMON_MSG_SUFFIX; | ||
1099 | va_end(args); | ||
1100 | } | ||
1101 | |||
1102 | void ACPI_INTERNAL_VAR_XFACE | ||
1103 | acpi_info(const char *module_name, u32 line_number, const char *format, ...) | ||
1104 | { | ||
1105 | va_list args; | ||
1106 | |||
1107 | acpi_os_printf("ACPI: "); | ||
1108 | |||
1109 | va_start(args, format); | ||
1110 | acpi_os_vprintf(format, args); | ||
1111 | acpi_os_printf("\n"); | ||
1112 | va_end(args); | ||
1113 | } | ||
1114 | |||
1115 | ACPI_EXPORT_SYMBOL(acpi_error) | ||
1116 | ACPI_EXPORT_SYMBOL(acpi_exception) | ||
1117 | ACPI_EXPORT_SYMBOL(acpi_warning) | ||
1118 | ACPI_EXPORT_SYMBOL(acpi_info) | ||
1119 | |||
1120 | /******************************************************************************* | ||
1121 | * | ||
1122 | * FUNCTION: acpi_ut_predefined_warning | ||
1123 | * | ||
1124 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
1125 | * line_number - Caller's line number (for error output) | ||
1126 | * Pathname - Full pathname to the node | ||
1127 | * node_flags - From Namespace node for the method/object | ||
1128 | * Format - Printf format string + additional args | ||
1129 | * | ||
1130 | * RETURN: None | ||
1131 | * | ||
1132 | * DESCRIPTION: Warnings for the predefined validation module. Messages are | ||
1133 | * only emitted the first time a problem with a particular | ||
1134 | * method/object is detected. This prevents a flood of error | ||
1135 | * messages for methods that are repeatedly evaluated. | ||
1136 | * | ||
1137 | ******************************************************************************/ | ||
1138 | |||
1139 | void ACPI_INTERNAL_VAR_XFACE | ||
1140 | acpi_ut_predefined_warning(const char *module_name, | ||
1141 | u32 line_number, | ||
1142 | char *pathname, | ||
1143 | u8 node_flags, const char *format, ...) | ||
1144 | { | ||
1145 | va_list args; | ||
1146 | |||
1147 | /* | ||
1148 | * Warning messages for this method/object will be disabled after the | ||
1149 | * first time a validation fails or an object is successfully repaired. | ||
1150 | */ | ||
1151 | if (node_flags & ANOBJ_EVALUATED) { | ||
1152 | return; | ||
1153 | } | ||
1154 | |||
1155 | acpi_os_printf("ACPI Warning for %s: ", pathname); | ||
1156 | |||
1157 | va_start(args, format); | ||
1158 | acpi_os_vprintf(format, args); | ||
1159 | ACPI_COMMON_MSG_SUFFIX; | ||
1160 | va_end(args); | ||
1161 | } | ||
1162 | |||
1163 | /******************************************************************************* | ||
1164 | * | ||
1165 | * FUNCTION: acpi_ut_predefined_info | ||
1166 | * | ||
1167 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
1168 | * line_number - Caller's line number (for error output) | ||
1169 | * Pathname - Full pathname to the node | ||
1170 | * node_flags - From Namespace node for the method/object | ||
1171 | * Format - Printf format string + additional args | ||
1172 | * | ||
1173 | * RETURN: None | ||
1174 | * | ||
1175 | * DESCRIPTION: Info messages for the predefined validation module. Messages | ||
1176 | * are only emitted the first time a problem with a particular | ||
1177 | * method/object is detected. This prevents a flood of | ||
1178 | * messages for methods that are repeatedly evaluated. | ||
1179 | * | ||
1180 | ******************************************************************************/ | ||
1181 | |||
1182 | void ACPI_INTERNAL_VAR_XFACE | ||
1183 | acpi_ut_predefined_info(const char *module_name, | ||
1184 | u32 line_number, | ||
1185 | char *pathname, u8 node_flags, const char *format, ...) | ||
1186 | { | ||
1187 | va_list args; | ||
1188 | |||
1189 | /* | ||
1190 | * Warning messages for this method/object will be disabled after the | ||
1191 | * first time a validation fails or an object is successfully repaired. | ||
1192 | */ | ||
1193 | if (node_flags & ANOBJ_EVALUATED) { | ||
1194 | return; | ||
1195 | } | ||
1196 | |||
1197 | acpi_os_printf("ACPI Info for %s: ", pathname); | ||
1198 | |||
1199 | va_start(args, format); | ||
1200 | acpi_os_vprintf(format, args); | ||
1201 | ACPI_COMMON_MSG_SUFFIX; | ||
1202 | va_end(args); | ||
1203 | } | ||
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c new file mode 100644 index 000000000000..bf679c4885fd --- /dev/null +++ b/drivers/acpi/acpica/utxferror.c | |||
@@ -0,0 +1,415 @@ | |||
1 | /******************************************************************************* | ||
2 | * | ||
3 | * Module Name: utxferror - Various error/warning output functions | ||
4 | * | ||
5 | ******************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2010, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acnamesp.h" | ||
47 | |||
48 | #define _COMPONENT ACPI_UTILITIES | ||
49 | ACPI_MODULE_NAME("utxferror") | ||
50 | |||
51 | /* | ||
52 | * This module is used for the in-kernel ACPICA as well as the ACPICA | ||
53 | * tools/applications. | ||
54 | * | ||
55 | * For the i_aSL compiler case, the output is redirected to stderr so that | ||
56 | * any of the various ACPI errors and warnings do not appear in the output | ||
57 | * files, for either the compiler or disassembler portions of the tool. | ||
58 | */ | ||
59 | #ifdef ACPI_ASL_COMPILER | ||
60 | #include <stdio.h> | ||
61 | extern FILE *acpi_gbl_output_file; | ||
62 | |||
63 | #define ACPI_MSG_REDIRECT_BEGIN \ | ||
64 | FILE *output_file = acpi_gbl_output_file; \ | ||
65 | acpi_os_redirect_output (stderr); | ||
66 | |||
67 | #define ACPI_MSG_REDIRECT_END \ | ||
68 | acpi_os_redirect_output (output_file); | ||
69 | |||
70 | #else | ||
71 | /* | ||
72 | * non-i_aSL case - no redirection, nothing to do | ||
73 | */ | ||
74 | #define ACPI_MSG_REDIRECT_BEGIN | ||
75 | #define ACPI_MSG_REDIRECT_END | ||
76 | #endif | ||
77 | /* | ||
78 | * Common message prefixes | ||
79 | */ | ||
80 | #define ACPI_MSG_ERROR "ACPI Error: " | ||
81 | #define ACPI_MSG_EXCEPTION "ACPI Exception: " | ||
82 | #define ACPI_MSG_WARNING "ACPI Warning: " | ||
83 | #define ACPI_MSG_INFO "ACPI: " | ||
84 | /* | ||
85 | * Common message suffix | ||
86 | */ | ||
87 | #define ACPI_MSG_SUFFIX \ | ||
88 | acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) | ||
89 | /******************************************************************************* | ||
90 | * | ||
91 | * FUNCTION: acpi_error | ||
92 | * | ||
93 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
94 | * line_number - Caller's line number (for error output) | ||
95 | * Format - Printf format string + additional args | ||
96 | * | ||
97 | * RETURN: None | ||
98 | * | ||
99 | * DESCRIPTION: Print "ACPI Error" message with module/line/version info | ||
100 | * | ||
101 | ******************************************************************************/ | ||
102 | void ACPI_INTERNAL_VAR_XFACE | ||
103 | acpi_error(const char *module_name, u32 line_number, const char *format, ...) | ||
104 | { | ||
105 | va_list arg_list; | ||
106 | |||
107 | ACPI_MSG_REDIRECT_BEGIN; | ||
108 | acpi_os_printf(ACPI_MSG_ERROR); | ||
109 | |||
110 | va_start(arg_list, format); | ||
111 | acpi_os_vprintf(format, arg_list); | ||
112 | ACPI_MSG_SUFFIX; | ||
113 | va_end(arg_list); | ||
114 | |||
115 | ACPI_MSG_REDIRECT_END; | ||
116 | } | ||
117 | |||
118 | ACPI_EXPORT_SYMBOL(acpi_error) | ||
119 | |||
120 | /******************************************************************************* | ||
121 | * | ||
122 | * FUNCTION: acpi_exception | ||
123 | * | ||
124 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
125 | * line_number - Caller's line number (for error output) | ||
126 | * Status - Status to be formatted | ||
127 | * Format - Printf format string + additional args | ||
128 | * | ||
129 | * RETURN: None | ||
130 | * | ||
131 | * DESCRIPTION: Print "ACPI Exception" message with module/line/version info | ||
132 | * and decoded acpi_status. | ||
133 | * | ||
134 | ******************************************************************************/ | ||
135 | void ACPI_INTERNAL_VAR_XFACE | ||
136 | acpi_exception(const char *module_name, | ||
137 | u32 line_number, acpi_status status, const char *format, ...) | ||
138 | { | ||
139 | va_list arg_list; | ||
140 | |||
141 | ACPI_MSG_REDIRECT_BEGIN; | ||
142 | acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", | ||
143 | acpi_format_exception(status)); | ||
144 | |||
145 | va_start(arg_list, format); | ||
146 | acpi_os_vprintf(format, arg_list); | ||
147 | ACPI_MSG_SUFFIX; | ||
148 | va_end(arg_list); | ||
149 | |||
150 | ACPI_MSG_REDIRECT_END; | ||
151 | } | ||
152 | |||
153 | ACPI_EXPORT_SYMBOL(acpi_exception) | ||
154 | |||
155 | /******************************************************************************* | ||
156 | * | ||
157 | * FUNCTION: acpi_warning | ||
158 | * | ||
159 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
160 | * line_number - Caller's line number (for error output) | ||
161 | * Format - Printf format string + additional args | ||
162 | * | ||
163 | * RETURN: None | ||
164 | * | ||
165 | * DESCRIPTION: Print "ACPI Warning" message with module/line/version info | ||
166 | * | ||
167 | ******************************************************************************/ | ||
168 | void ACPI_INTERNAL_VAR_XFACE | ||
169 | acpi_warning(const char *module_name, u32 line_number, const char *format, ...) | ||
170 | { | ||
171 | va_list arg_list; | ||
172 | |||
173 | ACPI_MSG_REDIRECT_BEGIN; | ||
174 | acpi_os_printf(ACPI_MSG_WARNING); | ||
175 | |||
176 | va_start(arg_list, format); | ||
177 | acpi_os_vprintf(format, arg_list); | ||
178 | ACPI_MSG_SUFFIX; | ||
179 | va_end(arg_list); | ||
180 | |||
181 | ACPI_MSG_REDIRECT_END; | ||
182 | } | ||
183 | |||
184 | ACPI_EXPORT_SYMBOL(acpi_warning) | ||
185 | |||
186 | /******************************************************************************* | ||
187 | * | ||
188 | * FUNCTION: acpi_info | ||
189 | * | ||
190 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
191 | * line_number - Caller's line number (for error output) | ||
192 | * Format - Printf format string + additional args | ||
193 | * | ||
194 | * RETURN: None | ||
195 | * | ||
196 | * DESCRIPTION: Print generic "ACPI:" information message. There is no | ||
197 | * module/line/version info in order to keep the message simple. | ||
198 | * | ||
199 | * TBD: module_name and line_number args are not needed, should be removed. | ||
200 | * | ||
201 | ******************************************************************************/ | ||
202 | void ACPI_INTERNAL_VAR_XFACE | ||
203 | acpi_info(const char *module_name, u32 line_number, const char *format, ...) | ||
204 | { | ||
205 | va_list arg_list; | ||
206 | |||
207 | ACPI_MSG_REDIRECT_BEGIN; | ||
208 | acpi_os_printf(ACPI_MSG_INFO); | ||
209 | |||
210 | va_start(arg_list, format); | ||
211 | acpi_os_vprintf(format, arg_list); | ||
212 | acpi_os_printf("\n"); | ||
213 | va_end(arg_list); | ||
214 | |||
215 | ACPI_MSG_REDIRECT_END; | ||
216 | } | ||
217 | |||
218 | ACPI_EXPORT_SYMBOL(acpi_info) | ||
219 | |||
220 | /* | ||
221 | * The remainder of this module contains internal error functions that may | ||
222 | * be configured out. | ||
223 | */ | ||
224 | #ifndef ACPI_NO_ERROR_MESSAGES | ||
225 | /******************************************************************************* | ||
226 | * | ||
227 | * FUNCTION: acpi_ut_predefined_warning | ||
228 | * | ||
229 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
230 | * line_number - Caller's line number (for error output) | ||
231 | * Pathname - Full pathname to the node | ||
232 | * node_flags - From Namespace node for the method/object | ||
233 | * Format - Printf format string + additional args | ||
234 | * | ||
235 | * RETURN: None | ||
236 | * | ||
237 | * DESCRIPTION: Warnings for the predefined validation module. Messages are | ||
238 | * only emitted the first time a problem with a particular | ||
239 | * method/object is detected. This prevents a flood of error | ||
240 | * messages for methods that are repeatedly evaluated. | ||
241 | * | ||
242 | ******************************************************************************/ | ||
243 | void ACPI_INTERNAL_VAR_XFACE | ||
244 | acpi_ut_predefined_warning(const char *module_name, | ||
245 | u32 line_number, | ||
246 | char *pathname, | ||
247 | u8 node_flags, const char *format, ...) | ||
248 | { | ||
249 | va_list arg_list; | ||
250 | |||
251 | /* | ||
252 | * Warning messages for this method/object will be disabled after the | ||
253 | * first time a validation fails or an object is successfully repaired. | ||
254 | */ | ||
255 | if (node_flags & ANOBJ_EVALUATED) { | ||
256 | return; | ||
257 | } | ||
258 | |||
259 | acpi_os_printf(ACPI_MSG_WARNING "For %s: ", pathname); | ||
260 | |||
261 | va_start(arg_list, format); | ||
262 | acpi_os_vprintf(format, arg_list); | ||
263 | ACPI_MSG_SUFFIX; | ||
264 | va_end(arg_list); | ||
265 | } | ||
266 | |||
267 | /******************************************************************************* | ||
268 | * | ||
269 | * FUNCTION: acpi_ut_predefined_info | ||
270 | * | ||
271 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
272 | * line_number - Caller's line number (for error output) | ||
273 | * Pathname - Full pathname to the node | ||
274 | * node_flags - From Namespace node for the method/object | ||
275 | * Format - Printf format string + additional args | ||
276 | * | ||
277 | * RETURN: None | ||
278 | * | ||
279 | * DESCRIPTION: Info messages for the predefined validation module. Messages | ||
280 | * are only emitted the first time a problem with a particular | ||
281 | * method/object is detected. This prevents a flood of | ||
282 | * messages for methods that are repeatedly evaluated. | ||
283 | * | ||
284 | ******************************************************************************/ | ||
285 | |||
286 | void ACPI_INTERNAL_VAR_XFACE | ||
287 | acpi_ut_predefined_info(const char *module_name, | ||
288 | u32 line_number, | ||
289 | char *pathname, u8 node_flags, const char *format, ...) | ||
290 | { | ||
291 | va_list arg_list; | ||
292 | |||
293 | /* | ||
294 | * Warning messages for this method/object will be disabled after the | ||
295 | * first time a validation fails or an object is successfully repaired. | ||
296 | */ | ||
297 | if (node_flags & ANOBJ_EVALUATED) { | ||
298 | return; | ||
299 | } | ||
300 | |||
301 | acpi_os_printf(ACPI_MSG_INFO "For %s: ", pathname); | ||
302 | |||
303 | va_start(arg_list, format); | ||
304 | acpi_os_vprintf(format, arg_list); | ||
305 | ACPI_MSG_SUFFIX; | ||
306 | va_end(arg_list); | ||
307 | } | ||
308 | |||
309 | /******************************************************************************* | ||
310 | * | ||
311 | * FUNCTION: acpi_ut_namespace_error | ||
312 | * | ||
313 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
314 | * line_number - Caller's line number (for error output) | ||
315 | * internal_name - Name or path of the namespace node | ||
316 | * lookup_status - Exception code from NS lookup | ||
317 | * | ||
318 | * RETURN: None | ||
319 | * | ||
320 | * DESCRIPTION: Print error message with the full pathname for the NS node. | ||
321 | * | ||
322 | ******************************************************************************/ | ||
323 | |||
324 | void | ||
325 | acpi_ut_namespace_error(const char *module_name, | ||
326 | u32 line_number, | ||
327 | const char *internal_name, acpi_status lookup_status) | ||
328 | { | ||
329 | acpi_status status; | ||
330 | u32 bad_name; | ||
331 | char *name = NULL; | ||
332 | |||
333 | ACPI_MSG_REDIRECT_BEGIN; | ||
334 | acpi_os_printf(ACPI_MSG_ERROR); | ||
335 | |||
336 | if (lookup_status == AE_BAD_CHARACTER) { | ||
337 | |||
338 | /* There is a non-ascii character in the name */ | ||
339 | |||
340 | ACPI_MOVE_32_TO_32(&bad_name, | ||
341 | ACPI_CAST_PTR(u32, internal_name)); | ||
342 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); | ||
343 | } else { | ||
344 | /* Convert path to external format */ | ||
345 | |||
346 | status = acpi_ns_externalize_name(ACPI_UINT32_MAX, | ||
347 | internal_name, NULL, &name); | ||
348 | |||
349 | /* Print target name */ | ||
350 | |||
351 | if (ACPI_SUCCESS(status)) { | ||
352 | acpi_os_printf("[%s]", name); | ||
353 | } else { | ||
354 | acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); | ||
355 | } | ||
356 | |||
357 | if (name) { | ||
358 | ACPI_FREE(name); | ||
359 | } | ||
360 | } | ||
361 | |||
362 | acpi_os_printf(" Namespace lookup failure, %s", | ||
363 | acpi_format_exception(lookup_status)); | ||
364 | |||
365 | ACPI_MSG_SUFFIX; | ||
366 | ACPI_MSG_REDIRECT_END; | ||
367 | } | ||
368 | |||
369 | /******************************************************************************* | ||
370 | * | ||
371 | * FUNCTION: acpi_ut_method_error | ||
372 | * | ||
373 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
374 | * line_number - Caller's line number (for error output) | ||
375 | * Message - Error message to use on failure | ||
376 | * prefix_node - Prefix relative to the path | ||
377 | * Path - Path to the node (optional) | ||
378 | * method_status - Execution status | ||
379 | * | ||
380 | * RETURN: None | ||
381 | * | ||
382 | * DESCRIPTION: Print error message with the full pathname for the method. | ||
383 | * | ||
384 | ******************************************************************************/ | ||
385 | |||
386 | void | ||
387 | acpi_ut_method_error(const char *module_name, | ||
388 | u32 line_number, | ||
389 | const char *message, | ||
390 | struct acpi_namespace_node *prefix_node, | ||
391 | const char *path, acpi_status method_status) | ||
392 | { | ||
393 | acpi_status status; | ||
394 | struct acpi_namespace_node *node = prefix_node; | ||
395 | |||
396 | ACPI_MSG_REDIRECT_BEGIN; | ||
397 | acpi_os_printf(ACPI_MSG_ERROR); | ||
398 | |||
399 | if (path) { | ||
400 | status = | ||
401 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, | ||
402 | &node); | ||
403 | if (ACPI_FAILURE(status)) { | ||
404 | acpi_os_printf("[Could not get node by pathname]"); | ||
405 | } | ||
406 | } | ||
407 | |||
408 | acpi_ns_print_node_pathname(node, message); | ||
409 | acpi_os_printf(", %s", acpi_format_exception(method_status)); | ||
410 | |||
411 | ACPI_MSG_SUFFIX; | ||
412 | ACPI_MSG_REDIRECT_END; | ||
413 | } | ||
414 | |||
415 | #endif /* ACPI_NO_ERROR_MESSAGES */ | ||