Linux Audio

Check our new training course

Loading...
v3.1
  1/*******************************************************************************
  2 *
  3 * Module Name: utxferror - Various error/warning output functions
  4 *
  5 ******************************************************************************/
  6
  7/*
  8 * Copyright (C) 2000 - 2011, 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
 49ACPI_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>
 61extern 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 ******************************************************************************/
102void ACPI_INTERNAL_VAR_XFACE
103acpi_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
118ACPI_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 ******************************************************************************/
135void ACPI_INTERNAL_VAR_XFACE
136acpi_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
153ACPI_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 ******************************************************************************/
168void ACPI_INTERNAL_VAR_XFACE
169acpi_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
184ACPI_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 ******************************************************************************/
202void ACPI_INTERNAL_VAR_XFACE
203acpi_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
218ACPI_EXPORT_SYMBOL(acpi_info)
219
220/*
221 * The remainder of this module contains internal error functions that may
222 * be configured out.
223 */
224#if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP)
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 ******************************************************************************/
243void ACPI_INTERNAL_VAR_XFACE
244acpi_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
286void ACPI_INTERNAL_VAR_XFACE
287acpi_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
324void
325acpi_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
386void
387acpi_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 */
v3.5.6
  1/*******************************************************************************
  2 *
  3 * Module Name: utxferror - Various error/warning output functions
  4 *
  5 ******************************************************************************/
  6
  7/*
  8 * Copyright (C) 2000 - 2012, 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 <linux/export.h>
 45#include <acpi/acpi.h>
 46#include "accommon.h"
 47#include "acnamesp.h"
 48
 49#define _COMPONENT          ACPI_UTILITIES
 50ACPI_MODULE_NAME("utxferror")
 51
 52/*
 53 * This module is used for the in-kernel ACPICA as well as the ACPICA
 54 * tools/applications.
 55 *
 56 * For the i_aSL 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>
 62extern 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-i_aSL 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 */
 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/*
 86 * Common message suffix
 87 */
 88#define ACPI_MSG_SUFFIX \
 89	acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number)
 90/*******************************************************************************
 91 *
 92 * FUNCTION:    acpi_error
 93 *
 94 * PARAMETERS:  module_name         - Caller's module name (for error output)
 95 *              line_number         - Caller's line number (for error output)
 96 *              Format              - Printf format string + additional args
 97 *
 98 * RETURN:      None
 99 *
100 * DESCRIPTION: Print "ACPI Error" message with module/line/version info
101 *
102 ******************************************************************************/
103void ACPI_INTERNAL_VAR_XFACE
104acpi_error(const char *module_name, u32 line_number, const char *format, ...)
105{
106	va_list arg_list;
107
108	ACPI_MSG_REDIRECT_BEGIN;
109	acpi_os_printf(ACPI_MSG_ERROR);
110
111	va_start(arg_list, format);
112	acpi_os_vprintf(format, arg_list);
113	ACPI_MSG_SUFFIX;
114	va_end(arg_list);
115
116	ACPI_MSG_REDIRECT_END;
117}
118
119ACPI_EXPORT_SYMBOL(acpi_error)
120
121/*******************************************************************************
122 *
123 * FUNCTION:    acpi_exception
124 *
125 * PARAMETERS:  module_name         - Caller's module name (for error output)
126 *              line_number         - Caller's line number (for error output)
127 *              Status              - Status to be formatted
128 *              Format              - Printf format string + additional args
129 *
130 * RETURN:      None
131 *
132 * DESCRIPTION: Print "ACPI Exception" message with module/line/version info
133 *              and decoded acpi_status.
134 *
135 ******************************************************************************/
136void ACPI_INTERNAL_VAR_XFACE
137acpi_exception(const char *module_name,
138	       u32 line_number, acpi_status status, const char *format, ...)
139{
140	va_list arg_list;
141
142	ACPI_MSG_REDIRECT_BEGIN;
143	acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ",
144		       acpi_format_exception(status));
145
146	va_start(arg_list, format);
147	acpi_os_vprintf(format, arg_list);
148	ACPI_MSG_SUFFIX;
149	va_end(arg_list);
150
151	ACPI_MSG_REDIRECT_END;
152}
153
154ACPI_EXPORT_SYMBOL(acpi_exception)
155
156/*******************************************************************************
157 *
158 * FUNCTION:    acpi_warning
159 *
160 * PARAMETERS:  module_name         - Caller's module name (for error output)
161 *              line_number         - Caller's line number (for error output)
162 *              Format              - Printf format string + additional args
163 *
164 * RETURN:      None
165 *
166 * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
167 *
168 ******************************************************************************/
169void ACPI_INTERNAL_VAR_XFACE
170acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
171{
172	va_list arg_list;
173
174	ACPI_MSG_REDIRECT_BEGIN;
175	acpi_os_printf(ACPI_MSG_WARNING);
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	ACPI_MSG_REDIRECT_END;
183}
184
185ACPI_EXPORT_SYMBOL(acpi_warning)
186
187/*******************************************************************************
188 *
189 * FUNCTION:    acpi_info
190 *
191 * PARAMETERS:  module_name         - Caller's module name (for error output)
192 *              line_number         - Caller's line number (for error output)
193 *              Format              - Printf format string + additional args
194 *
195 * RETURN:      None
196 *
197 * DESCRIPTION: Print generic "ACPI:" information message. There is no
198 *              module/line/version info in order to keep the message simple.
199 *
200 * TBD: module_name and line_number args are not needed, should be removed.
201 *
202 ******************************************************************************/
203void ACPI_INTERNAL_VAR_XFACE
204acpi_info(const char *module_name, u32 line_number, const char *format, ...)
205{
206	va_list arg_list;
207
208	ACPI_MSG_REDIRECT_BEGIN;
209	acpi_os_printf(ACPI_MSG_INFO);
210
211	va_start(arg_list, format);
212	acpi_os_vprintf(format, arg_list);
213	acpi_os_printf("\n");
214	va_end(arg_list);
215
216	ACPI_MSG_REDIRECT_END;
217}
218
219ACPI_EXPORT_SYMBOL(acpi_info)
220
221/*
222 * The remainder of this module contains internal error functions that may
223 * be configured out.
224 */
225#if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP)
226/*******************************************************************************
227 *
228 * FUNCTION:    acpi_ut_predefined_warning
229 *
230 * PARAMETERS:  module_name     - Caller's module name (for error output)
231 *              line_number     - Caller's line number (for error output)
232 *              Pathname        - Full pathname to the node
233 *              node_flags      - From Namespace node for the method/object
234 *              Format          - Printf format string + additional args
235 *
236 * RETURN:      None
237 *
238 * DESCRIPTION: Warnings for the predefined validation module. Messages are
239 *              only emitted the first time a problem with a particular
240 *              method/object is detected. This prevents a flood of error
241 *              messages for methods that are repeatedly evaluated.
242 *
243 ******************************************************************************/
244void ACPI_INTERNAL_VAR_XFACE
245acpi_ut_predefined_warning(const char *module_name,
246			   u32 line_number,
247			   char *pathname,
248			   u8 node_flags, const char *format, ...)
249{
250	va_list arg_list;
251
252	/*
253	 * Warning messages for this method/object will be disabled after the
254	 * first time a validation fails or an object is successfully repaired.
255	 */
256	if (node_flags & ANOBJ_EVALUATED) {
257		return;
258	}
259
260	acpi_os_printf(ACPI_MSG_WARNING "For %s: ", pathname);
261
262	va_start(arg_list, format);
263	acpi_os_vprintf(format, arg_list);
264	ACPI_MSG_SUFFIX;
265	va_end(arg_list);
266}
267
268/*******************************************************************************
269 *
270 * FUNCTION:    acpi_ut_predefined_info
271 *
272 * PARAMETERS:  module_name     - Caller's module name (for error output)
273 *              line_number     - Caller's line number (for error output)
274 *              Pathname        - Full pathname to the node
275 *              node_flags      - From Namespace node for the method/object
276 *              Format          - Printf format string + additional args
277 *
278 * RETURN:      None
279 *
280 * DESCRIPTION: Info messages for the predefined validation module. Messages
281 *              are only emitted the first time a problem with a particular
282 *              method/object is detected. This prevents a flood of
283 *              messages for methods that are repeatedly evaluated.
284 *
285 ******************************************************************************/
286
287void ACPI_INTERNAL_VAR_XFACE
288acpi_ut_predefined_info(const char *module_name,
289			u32 line_number,
290			char *pathname, u8 node_flags, const char *format, ...)
291{
292	va_list arg_list;
293
294	/*
295	 * Warning messages for this method/object will be disabled after the
296	 * first time a validation fails or an object is successfully repaired.
297	 */
298	if (node_flags & ANOBJ_EVALUATED) {
299		return;
300	}
301
302	acpi_os_printf(ACPI_MSG_INFO "For %s: ", pathname);
303
304	va_start(arg_list, format);
305	acpi_os_vprintf(format, arg_list);
306	ACPI_MSG_SUFFIX;
307	va_end(arg_list);
308}
309
310/*******************************************************************************
311 *
312 * FUNCTION:    acpi_ut_namespace_error
313 *
314 * PARAMETERS:  module_name         - Caller's module name (for error output)
315 *              line_number         - Caller's line number (for error output)
316 *              internal_name       - Name or path of the namespace node
317 *              lookup_status       - Exception code from NS lookup
318 *
319 * RETURN:      None
320 *
321 * DESCRIPTION: Print error message with the full pathname for the NS node.
322 *
323 ******************************************************************************/
324
325void
326acpi_ut_namespace_error(const char *module_name,
327			u32 line_number,
328			const char *internal_name, acpi_status lookup_status)
329{
330	acpi_status status;
331	u32 bad_name;
332	char *name = NULL;
333
334	ACPI_MSG_REDIRECT_BEGIN;
335	acpi_os_printf(ACPI_MSG_ERROR);
336
337	if (lookup_status == AE_BAD_CHARACTER) {
338
339		/* There is a non-ascii character in the name */
340
341		ACPI_MOVE_32_TO_32(&bad_name,
342				   ACPI_CAST_PTR(u32, internal_name));
343		acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name);
344	} else {
345		/* Convert path to external format */
346
347		status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
348						  internal_name, NULL, &name);
349
350		/* Print target name */
351
352		if (ACPI_SUCCESS(status)) {
353			acpi_os_printf("[%s]", name);
354		} else {
355			acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
356		}
357
358		if (name) {
359			ACPI_FREE(name);
360		}
361	}
362
363	acpi_os_printf(" Namespace lookup failure, %s",
364		       acpi_format_exception(lookup_status));
365
366	ACPI_MSG_SUFFIX;
367	ACPI_MSG_REDIRECT_END;
368}
369
370/*******************************************************************************
371 *
372 * FUNCTION:    acpi_ut_method_error
373 *
374 * PARAMETERS:  module_name         - Caller's module name (for error output)
375 *              line_number         - Caller's line number (for error output)
376 *              Message             - Error message to use on failure
377 *              prefix_node         - Prefix relative to the path
378 *              Path                - Path to the node (optional)
379 *              method_status       - Execution status
380 *
381 * RETURN:      None
382 *
383 * DESCRIPTION: Print error message with the full pathname for the method.
384 *
385 ******************************************************************************/
386
387void
388acpi_ut_method_error(const char *module_name,
389		     u32 line_number,
390		     const char *message,
391		     struct acpi_namespace_node *prefix_node,
392		     const char *path, acpi_status method_status)
393{
394	acpi_status status;
395	struct acpi_namespace_node *node = prefix_node;
396
397	ACPI_MSG_REDIRECT_BEGIN;
398	acpi_os_printf(ACPI_MSG_ERROR);
399
400	if (path) {
401		status =
402		    acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH,
403				     &node);
404		if (ACPI_FAILURE(status)) {
405			acpi_os_printf("[Could not get node by pathname]");
406		}
407	}
408
409	acpi_ns_print_node_pathname(node, message);
410	acpi_os_printf(", %s", acpi_format_exception(method_status));
411
412	ACPI_MSG_SUFFIX;
413	ACPI_MSG_REDIRECT_END;
414}
415
416#endif				/* ACPI_NO_ERROR_MESSAGES */