diff options
author | Bob Moore <robert.moore@intel.com> | 2013-06-07 20:58:00 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-15 18:54:08 -0400 |
commit | b6872ff9a4785a790f9647ee2076e7e616a3bb0e (patch) | |
tree | 4ba10a72ce48dcacf437aaae1627ce6548206dc3 /drivers | |
parent | 88ec28603c09ccba0346c15eef64ff0b4327c9ee (diff) |
ACPICA: Split internal error msg routines to a separate file
Improves configurability of ACPICA.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Acked-by: Len Brown <len.brown@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/acpica/Makefile | 1 | ||||
-rw-r--r-- | drivers/acpi/acpica/acutils.h | 42 | ||||
-rw-r--r-- | drivers/acpi/acpica/uterror.c | 289 | ||||
-rw-r--r-- | drivers/acpi/acpica/uteval.c | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/utxferror.c | 277 |
5 files changed, 333 insertions, 278 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 474901ec01c2..987bf41ec903 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -152,6 +152,7 @@ acpi-y += \ | |||
152 | utdebug.o \ | 152 | utdebug.o \ |
153 | utdecode.o \ | 153 | utdecode.o \ |
154 | utdelete.o \ | 154 | utdelete.o \ |
155 | uterror.o \ | ||
155 | uteval.o \ | 156 | uteval.o \ |
156 | utglobal.o \ | 157 | utglobal.o \ |
157 | utids.o \ | 158 | utids.o \ |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index 19e5cf72ab6a..d552036935d4 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
@@ -87,6 +87,48 @@ extern const char *acpi_gbl_fc_decode[]; | |||
87 | extern const char *acpi_gbl_pt_decode[]; | 87 | extern const char *acpi_gbl_pt_decode[]; |
88 | #endif | 88 | #endif |
89 | 89 | ||
90 | /* | ||
91 | * For the iASL compiler case, the output is redirected to stderr so that | ||
92 | * any of the various ACPI errors and warnings do not appear in the output | ||
93 | * files, for either the compiler or disassembler portions of the tool. | ||
94 | */ | ||
95 | #ifdef ACPI_ASL_COMPILER | ||
96 | |||
97 | #include <stdio.h> | ||
98 | extern FILE *acpi_gbl_output_file; | ||
99 | |||
100 | #define ACPI_MSG_REDIRECT_BEGIN \ | ||
101 | FILE *output_file = acpi_gbl_output_file; \ | ||
102 | acpi_os_redirect_output (stderr); | ||
103 | |||
104 | #define ACPI_MSG_REDIRECT_END \ | ||
105 | acpi_os_redirect_output (output_file); | ||
106 | |||
107 | #else | ||
108 | /* | ||
109 | * non-iASL case - no redirection, nothing to do | ||
110 | */ | ||
111 | #define ACPI_MSG_REDIRECT_BEGIN | ||
112 | #define ACPI_MSG_REDIRECT_END | ||
113 | #endif | ||
114 | |||
115 | /* | ||
116 | * Common error message prefixes | ||
117 | */ | ||
118 | #define ACPI_MSG_ERROR "ACPI Error: " | ||
119 | #define ACPI_MSG_EXCEPTION "ACPI Exception: " | ||
120 | #define ACPI_MSG_WARNING "ACPI Warning: " | ||
121 | #define ACPI_MSG_INFO "ACPI: " | ||
122 | |||
123 | #define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): " | ||
124 | #define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): " | ||
125 | |||
126 | /* | ||
127 | * Common message suffix | ||
128 | */ | ||
129 | #define ACPI_MSG_SUFFIX \ | ||
130 | acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) | ||
131 | |||
90 | /* Types for Resource descriptor entries */ | 132 | /* Types for Resource descriptor entries */ |
91 | 133 | ||
92 | #define ACPI_INVALID_RESOURCE 0 | 134 | #define ACPI_INVALID_RESOURCE 0 |
diff --git a/drivers/acpi/acpica/uterror.c b/drivers/acpi/acpica/uterror.c new file mode 100644 index 000000000000..154fdcaa5830 --- /dev/null +++ b/drivers/acpi/acpica/uterror.c | |||
@@ -0,0 +1,289 @@ | |||
1 | /******************************************************************************* | ||
2 | * | ||
3 | * Module Name: uterror - Various internal error/warning output functions | ||
4 | * | ||
5 | ******************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2013, 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("uterror") | ||
50 | |||
51 | /* | ||
52 | * This module contains internal error functions that may | ||
53 | * be configured out. | ||
54 | */ | ||
55 | #if !defined (ACPI_NO_ERROR_MESSAGES) | ||
56 | /******************************************************************************* | ||
57 | * | ||
58 | * FUNCTION: acpi_ut_predefined_warning | ||
59 | * | ||
60 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
61 | * line_number - Caller's line number (for error output) | ||
62 | * pathname - Full pathname to the node | ||
63 | * node_flags - From Namespace node for the method/object | ||
64 | * format - Printf format string + additional args | ||
65 | * | ||
66 | * RETURN: None | ||
67 | * | ||
68 | * DESCRIPTION: Warnings for the predefined validation module. Messages are | ||
69 | * only emitted the first time a problem with a particular | ||
70 | * method/object is detected. This prevents a flood of error | ||
71 | * messages for methods that are repeatedly evaluated. | ||
72 | * | ||
73 | ******************************************************************************/ | ||
74 | void ACPI_INTERNAL_VAR_XFACE | ||
75 | acpi_ut_predefined_warning(const char *module_name, | ||
76 | u32 line_number, | ||
77 | char *pathname, | ||
78 | u8 node_flags, const char *format, ...) | ||
79 | { | ||
80 | va_list arg_list; | ||
81 | |||
82 | /* | ||
83 | * Warning messages for this method/object will be disabled after the | ||
84 | * first time a validation fails or an object is successfully repaired. | ||
85 | */ | ||
86 | if (node_flags & ANOBJ_EVALUATED) { | ||
87 | return; | ||
88 | } | ||
89 | |||
90 | acpi_os_printf(ACPI_MSG_WARNING "%s: ", pathname); | ||
91 | |||
92 | va_start(arg_list, format); | ||
93 | acpi_os_vprintf(format, arg_list); | ||
94 | ACPI_MSG_SUFFIX; | ||
95 | va_end(arg_list); | ||
96 | } | ||
97 | |||
98 | /******************************************************************************* | ||
99 | * | ||
100 | * FUNCTION: acpi_ut_predefined_info | ||
101 | * | ||
102 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
103 | * line_number - Caller's line number (for error output) | ||
104 | * pathname - Full pathname to the node | ||
105 | * node_flags - From Namespace node for the method/object | ||
106 | * format - Printf format string + additional args | ||
107 | * | ||
108 | * RETURN: None | ||
109 | * | ||
110 | * DESCRIPTION: Info messages for the predefined validation module. Messages | ||
111 | * are only emitted the first time a problem with a particular | ||
112 | * method/object is detected. This prevents a flood of | ||
113 | * messages for methods that are repeatedly evaluated. | ||
114 | * | ||
115 | ******************************************************************************/ | ||
116 | |||
117 | void ACPI_INTERNAL_VAR_XFACE | ||
118 | acpi_ut_predefined_info(const char *module_name, | ||
119 | u32 line_number, | ||
120 | char *pathname, u8 node_flags, const char *format, ...) | ||
121 | { | ||
122 | va_list arg_list; | ||
123 | |||
124 | /* | ||
125 | * Warning messages for this method/object will be disabled after the | ||
126 | * first time a validation fails or an object is successfully repaired. | ||
127 | */ | ||
128 | if (node_flags & ANOBJ_EVALUATED) { | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | acpi_os_printf(ACPI_MSG_INFO "%s: ", pathname); | ||
133 | |||
134 | va_start(arg_list, format); | ||
135 | acpi_os_vprintf(format, arg_list); | ||
136 | ACPI_MSG_SUFFIX; | ||
137 | va_end(arg_list); | ||
138 | } | ||
139 | |||
140 | /******************************************************************************* | ||
141 | * | ||
142 | * FUNCTION: acpi_ut_predefined_bios_error | ||
143 | * | ||
144 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
145 | * line_number - Caller's line number (for error output) | ||
146 | * pathname - Full pathname to the node | ||
147 | * node_flags - From Namespace node for the method/object | ||
148 | * format - Printf format string + additional args | ||
149 | * | ||
150 | * RETURN: None | ||
151 | * | ||
152 | * DESCRIPTION: BIOS error message for predefined names. Messages | ||
153 | * are only emitted the first time a problem with a particular | ||
154 | * method/object is detected. This prevents a flood of | ||
155 | * messages for methods that are repeatedly evaluated. | ||
156 | * | ||
157 | ******************************************************************************/ | ||
158 | |||
159 | void ACPI_INTERNAL_VAR_XFACE | ||
160 | acpi_ut_predefined_bios_error(const char *module_name, | ||
161 | u32 line_number, | ||
162 | char *pathname, | ||
163 | u8 node_flags, const char *format, ...) | ||
164 | { | ||
165 | va_list arg_list; | ||
166 | |||
167 | /* | ||
168 | * Warning messages for this method/object will be disabled after the | ||
169 | * first time a validation fails or an object is successfully repaired. | ||
170 | */ | ||
171 | if (node_flags & ANOBJ_EVALUATED) { | ||
172 | return; | ||
173 | } | ||
174 | |||
175 | acpi_os_printf(ACPI_MSG_BIOS_ERROR "%s: ", pathname); | ||
176 | |||
177 | va_start(arg_list, format); | ||
178 | acpi_os_vprintf(format, arg_list); | ||
179 | ACPI_MSG_SUFFIX; | ||
180 | va_end(arg_list); | ||
181 | } | ||
182 | |||
183 | /******************************************************************************* | ||
184 | * | ||
185 | * FUNCTION: acpi_ut_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 | * internal_name - Name or path of the namespace node | ||
190 | * lookup_status - Exception code from NS lookup | ||
191 | * | ||
192 | * RETURN: None | ||
193 | * | ||
194 | * DESCRIPTION: Print error message with the full pathname for the NS node. | ||
195 | * | ||
196 | ******************************************************************************/ | ||
197 | |||
198 | void | ||
199 | acpi_ut_namespace_error(const char *module_name, | ||
200 | u32 line_number, | ||
201 | const char *internal_name, acpi_status lookup_status) | ||
202 | { | ||
203 | acpi_status status; | ||
204 | u32 bad_name; | ||
205 | char *name = NULL; | ||
206 | |||
207 | ACPI_MSG_REDIRECT_BEGIN; | ||
208 | acpi_os_printf(ACPI_MSG_ERROR); | ||
209 | |||
210 | if (lookup_status == AE_BAD_CHARACTER) { | ||
211 | |||
212 | /* There is a non-ascii character in the name */ | ||
213 | |||
214 | ACPI_MOVE_32_TO_32(&bad_name, | ||
215 | ACPI_CAST_PTR(u32, internal_name)); | ||
216 | acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name); | ||
217 | } else { | ||
218 | /* Convert path to external format */ | ||
219 | |||
220 | status = acpi_ns_externalize_name(ACPI_UINT32_MAX, | ||
221 | internal_name, NULL, &name); | ||
222 | |||
223 | /* Print target name */ | ||
224 | |||
225 | if (ACPI_SUCCESS(status)) { | ||
226 | acpi_os_printf("[%s]", name); | ||
227 | } else { | ||
228 | acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); | ||
229 | } | ||
230 | |||
231 | if (name) { | ||
232 | ACPI_FREE(name); | ||
233 | } | ||
234 | } | ||
235 | |||
236 | acpi_os_printf(" Namespace lookup failure, %s", | ||
237 | acpi_format_exception(lookup_status)); | ||
238 | |||
239 | ACPI_MSG_SUFFIX; | ||
240 | ACPI_MSG_REDIRECT_END; | ||
241 | } | ||
242 | |||
243 | /******************************************************************************* | ||
244 | * | ||
245 | * FUNCTION: acpi_ut_method_error | ||
246 | * | ||
247 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
248 | * line_number - Caller's line number (for error output) | ||
249 | * message - Error message to use on failure | ||
250 | * prefix_node - Prefix relative to the path | ||
251 | * path - Path to the node (optional) | ||
252 | * method_status - Execution status | ||
253 | * | ||
254 | * RETURN: None | ||
255 | * | ||
256 | * DESCRIPTION: Print error message with the full pathname for the method. | ||
257 | * | ||
258 | ******************************************************************************/ | ||
259 | |||
260 | void | ||
261 | acpi_ut_method_error(const char *module_name, | ||
262 | u32 line_number, | ||
263 | const char *message, | ||
264 | struct acpi_namespace_node *prefix_node, | ||
265 | const char *path, acpi_status method_status) | ||
266 | { | ||
267 | acpi_status status; | ||
268 | struct acpi_namespace_node *node = prefix_node; | ||
269 | |||
270 | ACPI_MSG_REDIRECT_BEGIN; | ||
271 | acpi_os_printf(ACPI_MSG_ERROR); | ||
272 | |||
273 | if (path) { | ||
274 | status = | ||
275 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, | ||
276 | &node); | ||
277 | if (ACPI_FAILURE(status)) { | ||
278 | acpi_os_printf("[Could not get node by pathname]"); | ||
279 | } | ||
280 | } | ||
281 | |||
282 | acpi_ns_print_node_pathname(node, message); | ||
283 | acpi_os_printf(", %s", acpi_format_exception(method_status)); | ||
284 | |||
285 | ACPI_MSG_SUFFIX; | ||
286 | ACPI_MSG_REDIRECT_END; | ||
287 | } | ||
288 | |||
289 | #endif /* ACPI_NO_ERROR_MESSAGES */ | ||
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c index 1673dddc9cd5..9d6802911c01 100644 --- a/drivers/acpi/acpica/uteval.c +++ b/drivers/acpi/acpica/uteval.c | |||
@@ -68,7 +68,7 @@ ACPI_MODULE_NAME("uteval") | |||
68 | ******************************************************************************/ | 68 | ******************************************************************************/ |
69 | 69 | ||
70 | acpi_status | 70 | acpi_status |
71 | acpi_ut_evaluate_object(struct acpi_namespace_node * prefix_node, | 71 | acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, |
72 | char *path, | 72 | char *path, |
73 | u32 expected_return_btypes, | 73 | u32 expected_return_btypes, |
74 | union acpi_operand_object **return_desc) | 74 | union acpi_operand_object **return_desc) |
diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c index 61a2c1704ccf..e966a2e47b76 100644 --- a/drivers/acpi/acpica/utxferror.c +++ b/drivers/acpi/acpica/utxferror.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/export.h> | 44 | #include <linux/export.h> |
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include "accommon.h" | 46 | #include "accommon.h" |
47 | #include "acnamesp.h" | ||
48 | 47 | ||
49 | #define _COMPONENT ACPI_UTILITIES | 48 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME("utxferror") | 49 | ACPI_MODULE_NAME("utxferror") |
@@ -52,43 +51,7 @@ ACPI_MODULE_NAME("utxferror") | |||
52 | /* | 51 | /* |
53 | * This module is used for the in-kernel ACPICA as well as the ACPICA | 52 | * This module is used for the in-kernel ACPICA as well as the ACPICA |
54 | * tools/applications. | 53 | * tools/applications. |
55 | * | ||
56 | * For the iASL compiler case, the output is redirected to stderr so that | ||
57 | * any of the various ACPI errors and warnings do not appear in the output | ||
58 | * files, for either the compiler or disassembler portions of the tool. | ||
59 | */ | ||
60 | #ifdef ACPI_ASL_COMPILER | ||
61 | #include <stdio.h> | ||
62 | extern FILE *acpi_gbl_output_file; | ||
63 | |||
64 | #define ACPI_MSG_REDIRECT_BEGIN \ | ||
65 | FILE *output_file = acpi_gbl_output_file; \ | ||
66 | acpi_os_redirect_output (stderr); | ||
67 | |||
68 | #define ACPI_MSG_REDIRECT_END \ | ||
69 | acpi_os_redirect_output (output_file); | ||
70 | |||
71 | #else | ||
72 | /* | ||
73 | * non-iASL case - no redirection, nothing to do | ||
74 | */ | ||
75 | #define ACPI_MSG_REDIRECT_BEGIN | ||
76 | #define ACPI_MSG_REDIRECT_END | ||
77 | #endif | ||
78 | /* | ||
79 | * Common message prefixes | ||
80 | */ | 54 | */ |
81 | #define ACPI_MSG_ERROR "ACPI Error: " | ||
82 | #define ACPI_MSG_EXCEPTION "ACPI Exception: " | ||
83 | #define ACPI_MSG_WARNING "ACPI Warning: " | ||
84 | #define ACPI_MSG_INFO "ACPI: " | ||
85 | #define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): " | ||
86 | #define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): " | ||
87 | /* | ||
88 | * Common message suffix | ||
89 | */ | ||
90 | #define ACPI_MSG_SUFFIX \ | ||
91 | acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number) | ||
92 | /******************************************************************************* | 55 | /******************************************************************************* |
93 | * | 56 | * |
94 | * FUNCTION: acpi_error | 57 | * FUNCTION: acpi_error |
@@ -285,243 +248,3 @@ acpi_bios_warning(const char *module_name, | |||
285 | } | 248 | } |
286 | 249 | ||
287 | ACPI_EXPORT_SYMBOL(acpi_bios_warning) | 250 | ACPI_EXPORT_SYMBOL(acpi_bios_warning) |
288 | |||
289 | /* | ||
290 | * The remainder of this module contains internal error functions that may | ||
291 | * be configured out. | ||
292 | */ | ||
293 | #if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP) | ||
294 | /******************************************************************************* | ||
295 | * | ||
296 | * FUNCTION: acpi_ut_predefined_warning | ||
297 | * | ||
298 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
299 | * line_number - Caller's line number (for error output) | ||
300 | * pathname - Full pathname to the node | ||
301 | * node_flags - From Namespace node for the method/object | ||
302 | * format - Printf format string + additional args | ||
303 | * | ||
304 | * RETURN: None | ||
305 | * | ||
306 | * DESCRIPTION: Warnings for the predefined validation module. Messages are | ||
307 | * only emitted the first time a problem with a particular | ||
308 | * method/object is detected. This prevents a flood of error | ||
309 | * messages for methods that are repeatedly evaluated. | ||
310 | * | ||
311 | ******************************************************************************/ | ||
312 | void ACPI_INTERNAL_VAR_XFACE | ||
313 | acpi_ut_predefined_warning(const char *module_name, | ||
314 | u32 line_number, | ||
315 | char *pathname, | ||
316 | u8 node_flags, const char *format, ...) | ||
317 | { | ||
318 | va_list arg_list; | ||
319 | |||
320 | /* | ||
321 | * Warning messages for this method/object will be disabled after the | ||
322 | * first time a validation fails or an object is successfully repaired. | ||
323 | */ | ||
324 | if (node_flags & ANOBJ_EVALUATED) { | ||
325 | return; | ||
326 | } | ||
327 | |||
328 | acpi_os_printf(ACPI_MSG_WARNING "%s: ", pathname); | ||
329 | |||
330 | va_start(arg_list, format); | ||
331 | acpi_os_vprintf(format, arg_list); | ||
332 | ACPI_MSG_SUFFIX; | ||
333 | va_end(arg_list); | ||
334 | } | ||
335 | |||
336 | /******************************************************************************* | ||
337 | * | ||
338 | * FUNCTION: acpi_ut_predefined_info | ||
339 | * | ||
340 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
341 | * line_number - Caller's line number (for error output) | ||
342 | * pathname - Full pathname to the node | ||
343 | * node_flags - From Namespace node for the method/object | ||
344 | * format - Printf format string + additional args | ||
345 | * | ||
346 | * RETURN: None | ||
347 | * | ||
348 | * DESCRIPTION: Info messages for the predefined validation module. Messages | ||
349 | * are only emitted the first time a problem with a particular | ||
350 | * method/object is detected. This prevents a flood of | ||
351 | * messages for methods that are repeatedly evaluated. | ||
352 | * | ||
353 | ******************************************************************************/ | ||
354 | |||
355 | void ACPI_INTERNAL_VAR_XFACE | ||
356 | acpi_ut_predefined_info(const char *module_name, | ||
357 | u32 line_number, | ||
358 | char *pathname, u8 node_flags, const char *format, ...) | ||
359 | { | ||
360 | va_list arg_list; | ||
361 | |||
362 | /* | ||
363 | * Warning messages for this method/object will be disabled after the | ||
364 | * first time a validation fails or an object is successfully repaired. | ||
365 | */ | ||
366 | if (node_flags & ANOBJ_EVALUATED) { | ||
367 | return; | ||
368 | } | ||
369 | |||
370 | acpi_os_printf(ACPI_MSG_INFO "%s: ", pathname); | ||
371 | |||
372 | va_start(arg_list, format); | ||
373 | acpi_os_vprintf(format, arg_list); | ||
374 | ACPI_MSG_SUFFIX; | ||
375 | va_end(arg_list); | ||
376 | } | ||
377 | |||
378 | /******************************************************************************* | ||
379 | * | ||
380 | * FUNCTION: acpi_ut_predefined_bios_error | ||
381 | * | ||
382 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
383 | * line_number - Caller's line number (for error output) | ||
384 | * pathname - Full pathname to the node | ||
385 | * node_flags - From Namespace node for the method/object | ||
386 | * format - Printf format string + additional args | ||
387 | * | ||
388 | * RETURN: None | ||
389 | * | ||
390 | * DESCRIPTION: BIOS error message for predefined names. Messages | ||
391 | * are only emitted the first time a problem with a particular | ||
392 | * method/object is detected. This prevents a flood of | ||
393 | * messages for methods that are repeatedly evaluated. | ||
394 | * | ||
395 | ******************************************************************************/ | ||
396 | |||
397 | void ACPI_INTERNAL_VAR_XFACE | ||
398 | acpi_ut_predefined_bios_error(const char *module_name, | ||
399 | u32 line_number, | ||
400 | char *pathname, | ||
401 | u8 node_flags, const char *format, ...) | ||
402 | { | ||
403 | va_list arg_list; | ||
404 | |||
405 | /* | ||
406 | * Warning messages for this method/object will be disabled after the | ||
407 | * first time a validation fails or an object is successfully repaired. | ||
408 | */ | ||
409 | if (node_flags & ANOBJ_EVALUATED) { | ||
410 | return; | ||
411 | } | ||
412 | |||
413 | acpi_os_printf(ACPI_MSG_BIOS_ERROR "%s: ", pathname); | ||
414 | |||
415 | va_start(arg_list, format); | ||
416 | acpi_os_vprintf(format, arg_list); | ||
417 | ACPI_MSG_SUFFIX; | ||
418 | va_end(arg_list); | ||
419 | } | ||
420 | |||
421 | /******************************************************************************* | ||
422 | * | ||
423 | * FUNCTION: acpi_ut_namespace_error | ||
424 | * | ||
425 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
426 | * line_number - Caller's line number (for error output) | ||
427 | * internal_name - Name or path of the namespace node | ||
428 | * lookup_status - Exception code from NS lookup | ||
429 | * | ||
430 | * RETURN: None | ||
431 | * | ||
432 | * DESCRIPTION: Print error message with the full pathname for the NS node. | ||
433 | * | ||
434 | ******************************************************************************/ | ||
435 | |||
436 | void | ||
437 | acpi_ut_namespace_error(const char *module_name, | ||
438 | u32 line_number, | ||
439 | const char *internal_name, acpi_status lookup_status) | ||
440 | { | ||
441 | acpi_status status; | ||
442 | u32 bad_name; | ||
443 | char *name = NULL; | ||
444 | |||
445 | ACPI_MSG_REDIRECT_BEGIN; | ||
446 | acpi_os_printf(ACPI_MSG_ERROR); | ||
447 | |||
448 | if (lookup_status == AE_BAD_CHARACTER) { | ||
449 | |||
450 | /* There is a non-ascii character in the name */ | ||
451 | |||
452 | ACPI_MOVE_32_TO_32(&bad_name, | ||
453 | ACPI_CAST_PTR(u32, internal_name)); | ||
454 | acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name); | ||
455 | } else { | ||
456 | /* Convert path to external format */ | ||
457 | |||
458 | status = acpi_ns_externalize_name(ACPI_UINT32_MAX, | ||
459 | internal_name, NULL, &name); | ||
460 | |||
461 | /* Print target name */ | ||
462 | |||
463 | if (ACPI_SUCCESS(status)) { | ||
464 | acpi_os_printf("[%s]", name); | ||
465 | } else { | ||
466 | acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); | ||
467 | } | ||
468 | |||
469 | if (name) { | ||
470 | ACPI_FREE(name); | ||
471 | } | ||
472 | } | ||
473 | |||
474 | acpi_os_printf(" Namespace lookup failure, %s", | ||
475 | acpi_format_exception(lookup_status)); | ||
476 | |||
477 | ACPI_MSG_SUFFIX; | ||
478 | ACPI_MSG_REDIRECT_END; | ||
479 | } | ||
480 | |||
481 | /******************************************************************************* | ||
482 | * | ||
483 | * FUNCTION: acpi_ut_method_error | ||
484 | * | ||
485 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
486 | * line_number - Caller's line number (for error output) | ||
487 | * message - Error message to use on failure | ||
488 | * prefix_node - Prefix relative to the path | ||
489 | * path - Path to the node (optional) | ||
490 | * method_status - Execution status | ||
491 | * | ||
492 | * RETURN: None | ||
493 | * | ||
494 | * DESCRIPTION: Print error message with the full pathname for the method. | ||
495 | * | ||
496 | ******************************************************************************/ | ||
497 | |||
498 | void | ||
499 | acpi_ut_method_error(const char *module_name, | ||
500 | u32 line_number, | ||
501 | const char *message, | ||
502 | struct acpi_namespace_node *prefix_node, | ||
503 | const char *path, acpi_status method_status) | ||
504 | { | ||
505 | acpi_status status; | ||
506 | struct acpi_namespace_node *node = prefix_node; | ||
507 | |||
508 | ACPI_MSG_REDIRECT_BEGIN; | ||
509 | acpi_os_printf(ACPI_MSG_ERROR); | ||
510 | |||
511 | if (path) { | ||
512 | status = | ||
513 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, | ||
514 | &node); | ||
515 | if (ACPI_FAILURE(status)) { | ||
516 | acpi_os_printf("[Could not get node by pathname]"); | ||
517 | } | ||
518 | } | ||
519 | |||
520 | acpi_ns_print_node_pathname(node, message); | ||
521 | acpi_os_printf(", %s", acpi_format_exception(method_status)); | ||
522 | |||
523 | ACPI_MSG_SUFFIX; | ||
524 | ACPI_MSG_REDIRECT_END; | ||
525 | } | ||
526 | |||
527 | #endif /* ACPI_NO_ERROR_MESSAGES */ | ||