1 /*******************************************************************************
3 * Module Name: utxferror - Various error/warning output functions
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2013, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
44 #define __UTXFERROR_C__
51 #define _COMPONENT ACPI_UTILITIES
52 ACPI_MODULE_NAME ("utxferror")
55 * This module is used for the in-kernel ACPICA as well as the ACPICA
58 * For the iASL compiler case, the output is redirected to stderr so that
59 * any of the various ACPI errors and warnings do not appear in the output
60 * files, for either the compiler or disassembler portions of the tool.
62 #ifdef ACPI_ASL_COMPILER
65 extern FILE *AcpiGbl_OutputFile;
67 #define ACPI_MSG_REDIRECT_BEGIN \
68 FILE *OutputFile = AcpiGbl_OutputFile; \
69 AcpiOsRedirectOutput (stderr);
71 #define ACPI_MSG_REDIRECT_END \
72 AcpiOsRedirectOutput (OutputFile);
76 * non-iASL case - no redirection, nothing to do
78 #define ACPI_MSG_REDIRECT_BEGIN
79 #define ACPI_MSG_REDIRECT_END
83 * Common message prefixes
85 #define ACPI_MSG_ERROR "ACPI Error: "
86 #define ACPI_MSG_EXCEPTION "ACPI Exception: "
87 #define ACPI_MSG_WARNING "ACPI Warning: "
88 #define ACPI_MSG_INFO "ACPI: "
90 #define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): "
91 #define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): "
94 * Common message suffix
96 #define ACPI_MSG_SUFFIX \
97 AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber)
100 /*******************************************************************************
102 * FUNCTION: AcpiError
104 * PARAMETERS: ModuleName - Caller's module name (for error output)
105 * LineNumber - Caller's line number (for error output)
106 * Format - Printf format string + additional args
110 * DESCRIPTION: Print "ACPI Error" message with module/line/version info
112 ******************************************************************************/
114 void ACPI_INTERNAL_VAR_XFACE
116 const char *ModuleName,
124 ACPI_MSG_REDIRECT_BEGIN;
125 AcpiOsPrintf (ACPI_MSG_ERROR);
127 va_start (ArgList, Format);
128 AcpiOsVprintf (Format, ArgList);
132 ACPI_MSG_REDIRECT_END;
135 ACPI_EXPORT_SYMBOL (AcpiError)
138 /*******************************************************************************
140 * FUNCTION: AcpiException
142 * PARAMETERS: ModuleName - Caller's module name (for error output)
143 * LineNumber - Caller's line number (for error output)
144 * Status - Status to be formatted
145 * Format - Printf format string + additional args
149 * DESCRIPTION: Print "ACPI Exception" message with module/line/version info
150 * and decoded ACPI_STATUS.
152 ******************************************************************************/
154 void ACPI_INTERNAL_VAR_XFACE
156 const char *ModuleName,
165 ACPI_MSG_REDIRECT_BEGIN;
166 AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status));
168 va_start (ArgList, Format);
169 AcpiOsVprintf (Format, ArgList);
173 ACPI_MSG_REDIRECT_END;
176 ACPI_EXPORT_SYMBOL (AcpiException)
179 /*******************************************************************************
181 * FUNCTION: AcpiWarning
183 * PARAMETERS: ModuleName - Caller's module name (for error output)
184 * LineNumber - Caller's line number (for error output)
185 * Format - Printf format string + additional args
189 * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
191 ******************************************************************************/
193 void ACPI_INTERNAL_VAR_XFACE
195 const char *ModuleName,
203 ACPI_MSG_REDIRECT_BEGIN;
204 AcpiOsPrintf (ACPI_MSG_WARNING);
206 va_start (ArgList, Format);
207 AcpiOsVprintf (Format, ArgList);
211 ACPI_MSG_REDIRECT_END;
214 ACPI_EXPORT_SYMBOL (AcpiWarning)
217 /*******************************************************************************
221 * PARAMETERS: ModuleName - Caller's module name (for error output)
222 * LineNumber - Caller's line number (for error output)
223 * Format - Printf format string + additional args
227 * DESCRIPTION: Print generic "ACPI:" information message. There is no
228 * module/line/version info in order to keep the message simple.
230 * TBD: ModuleName and LineNumber args are not needed, should be removed.
232 ******************************************************************************/
234 void ACPI_INTERNAL_VAR_XFACE
236 const char *ModuleName,
244 ACPI_MSG_REDIRECT_BEGIN;
245 AcpiOsPrintf (ACPI_MSG_INFO);
247 va_start (ArgList, Format);
248 AcpiOsVprintf (Format, ArgList);
252 ACPI_MSG_REDIRECT_END;
255 ACPI_EXPORT_SYMBOL (AcpiInfo)
258 /*******************************************************************************
260 * FUNCTION: AcpiBiosError
262 * PARAMETERS: ModuleName - Caller's module name (for error output)
263 * LineNumber - Caller's line number (for error output)
264 * Format - Printf format string + additional args
268 * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
271 ******************************************************************************/
273 void ACPI_INTERNAL_VAR_XFACE
275 const char *ModuleName,
283 ACPI_MSG_REDIRECT_BEGIN;
284 AcpiOsPrintf (ACPI_MSG_BIOS_ERROR);
286 va_start (ArgList, Format);
287 AcpiOsVprintf (Format, ArgList);
291 ACPI_MSG_REDIRECT_END;
294 ACPI_EXPORT_SYMBOL (AcpiBiosError)
297 /*******************************************************************************
299 * FUNCTION: AcpiBiosWarning
301 * PARAMETERS: ModuleName - Caller's module name (for error output)
302 * LineNumber - Caller's line number (for error output)
303 * Format - Printf format string + additional args
307 * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
310 ******************************************************************************/
312 void ACPI_INTERNAL_VAR_XFACE
314 const char *ModuleName,
322 ACPI_MSG_REDIRECT_BEGIN;
323 AcpiOsPrintf (ACPI_MSG_BIOS_WARNING);
325 va_start (ArgList, Format);
326 AcpiOsVprintf (Format, ArgList);
330 ACPI_MSG_REDIRECT_END;
333 ACPI_EXPORT_SYMBOL (AcpiBiosWarning)
337 * The remainder of this module contains internal error functions that may
340 #if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP)
342 /*******************************************************************************
344 * FUNCTION: AcpiUtPredefinedWarning
346 * PARAMETERS: ModuleName - Caller's module name (for error output)
347 * LineNumber - Caller's line number (for error output)
348 * Pathname - Full pathname to the node
349 * NodeFlags - From Namespace node for the method/object
350 * Format - Printf format string + additional args
354 * DESCRIPTION: Warnings for the predefined validation module. Messages are
355 * only emitted the first time a problem with a particular
356 * method/object is detected. This prevents a flood of error
357 * messages for methods that are repeatedly evaluated.
359 ******************************************************************************/
361 void ACPI_INTERNAL_VAR_XFACE
362 AcpiUtPredefinedWarning (
363 const char *ModuleName,
374 * Warning messages for this method/object will be disabled after the
375 * first time a validation fails or an object is successfully repaired.
377 if (NodeFlags & ANOBJ_EVALUATED)
382 AcpiOsPrintf (ACPI_MSG_WARNING "%s: ", Pathname);
384 va_start (ArgList, Format);
385 AcpiOsVprintf (Format, ArgList);
391 /*******************************************************************************
393 * FUNCTION: AcpiUtPredefinedInfo
395 * PARAMETERS: ModuleName - Caller's module name (for error output)
396 * LineNumber - Caller's line number (for error output)
397 * Pathname - Full pathname to the node
398 * NodeFlags - From Namespace node for the method/object
399 * Format - Printf format string + additional args
403 * DESCRIPTION: Info messages for the predefined validation module. Messages
404 * are only emitted the first time a problem with a particular
405 * method/object is detected. This prevents a flood of
406 * messages for methods that are repeatedly evaluated.
408 ******************************************************************************/
410 void ACPI_INTERNAL_VAR_XFACE
411 AcpiUtPredefinedInfo (
412 const char *ModuleName,
423 * Warning messages for this method/object will be disabled after the
424 * first time a validation fails or an object is successfully repaired.
426 if (NodeFlags & ANOBJ_EVALUATED)
431 AcpiOsPrintf (ACPI_MSG_INFO "%s: ", Pathname);
433 va_start (ArgList, Format);
434 AcpiOsVprintf (Format, ArgList);
440 /*******************************************************************************
442 * FUNCTION: AcpiUtPredefinedBiosError
444 * PARAMETERS: ModuleName - Caller's module name (for error output)
445 * LineNumber - Caller's line number (for error output)
446 * Pathname - Full pathname to the node
447 * NodeFlags - From Namespace node for the method/object
448 * Format - Printf format string + additional args
452 * DESCRIPTION: BIOS error message for predefined names. Messages
453 * are only emitted the first time a problem with a particular
454 * method/object is detected. This prevents a flood of
455 * messages for methods that are repeatedly evaluated.
457 ******************************************************************************/
459 void ACPI_INTERNAL_VAR_XFACE
460 AcpiUtPredefinedBiosError (
461 const char *ModuleName,
472 * Warning messages for this method/object will be disabled after the
473 * first time a validation fails or an object is successfully repaired.
475 if (NodeFlags & ANOBJ_EVALUATED)
480 AcpiOsPrintf (ACPI_MSG_BIOS_ERROR "%s: ", Pathname);
482 va_start (ArgList, Format);
483 AcpiOsVprintf (Format, ArgList);
489 /*******************************************************************************
491 * FUNCTION: AcpiUtNamespaceError
493 * PARAMETERS: ModuleName - Caller's module name (for error output)
494 * LineNumber - Caller's line number (for error output)
495 * InternalName - Name or path of the namespace node
496 * LookupStatus - Exception code from NS lookup
500 * DESCRIPTION: Print error message with the full pathname for the NS node.
502 ******************************************************************************/
505 AcpiUtNamespaceError (
506 const char *ModuleName,
508 const char *InternalName,
509 ACPI_STATUS LookupStatus)
516 ACPI_MSG_REDIRECT_BEGIN;
517 AcpiOsPrintf (ACPI_MSG_ERROR);
519 if (LookupStatus == AE_BAD_CHARACTER)
521 /* There is a non-ascii character in the name */
523 ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName));
524 AcpiOsPrintf ("[0x%.8X] (NON-ASCII)", BadName);
528 /* Convert path to external format */
530 Status = AcpiNsExternalizeName (ACPI_UINT32_MAX,
531 InternalName, NULL, &Name);
533 /* Print target name */
535 if (ACPI_SUCCESS (Status))
537 AcpiOsPrintf ("[%s]", Name);
541 AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]");
550 AcpiOsPrintf (" Namespace lookup failure, %s",
551 AcpiFormatException (LookupStatus));
554 ACPI_MSG_REDIRECT_END;
558 /*******************************************************************************
560 * FUNCTION: AcpiUtMethodError
562 * PARAMETERS: ModuleName - Caller's module name (for error output)
563 * LineNumber - Caller's line number (for error output)
564 * Message - Error message to use on failure
565 * PrefixNode - Prefix relative to the path
566 * Path - Path to the node (optional)
567 * MethodStatus - Execution status
571 * DESCRIPTION: Print error message with the full pathname for the method.
573 ******************************************************************************/
577 const char *ModuleName,
580 ACPI_NAMESPACE_NODE *PrefixNode,
582 ACPI_STATUS MethodStatus)
585 ACPI_NAMESPACE_NODE *Node = PrefixNode;
588 ACPI_MSG_REDIRECT_BEGIN;
589 AcpiOsPrintf (ACPI_MSG_ERROR);
593 Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH,
595 if (ACPI_FAILURE (Status))
597 AcpiOsPrintf ("[Could not get node by pathname]");
601 AcpiNsPrintNodePathname (Node, Message);
602 AcpiOsPrintf (", %s", AcpiFormatException (MethodStatus));
605 ACPI_MSG_REDIRECT_END;
608 #endif /* ACPI_NO_ERROR_MESSAGES */