Fixed compatibility of output.
[AROS.git] / arch / all-pc / acpica / source / components / utilities / uterror.c
blob73e25685413f6f9e075444438d58f06882c10d00
1 /*******************************************************************************
3 * Module Name: uterror - Various internal error/warning output functions
5 ******************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
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.
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.
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.
44 #define __UTERROR_C__
46 #include "acpi.h"
47 #include "accommon.h"
48 #include "acnamesp.h"
51 #define _COMPONENT ACPI_UTILITIES
52 ACPI_MODULE_NAME ("uterror")
56 * This module contains internal error functions that may
57 * be configured out.
59 #if !defined (ACPI_NO_ERROR_MESSAGES)
61 /*******************************************************************************
63 * FUNCTION: AcpiUtPredefinedWarning
65 * PARAMETERS: ModuleName - Caller's module name (for error output)
66 * LineNumber - Caller's line number (for error output)
67 * Pathname - Full pathname to the node
68 * NodeFlags - From Namespace node for the method/object
69 * Format - Printf format string + additional args
71 * RETURN: None
73 * DESCRIPTION: Warnings for the predefined validation module. Messages are
74 * only emitted the first time a problem with a particular
75 * method/object is detected. This prevents a flood of error
76 * messages for methods that are repeatedly evaluated.
78 ******************************************************************************/
80 void ACPI_INTERNAL_VAR_XFACE
81 AcpiUtPredefinedWarning (
82 const char *ModuleName,
83 UINT32 LineNumber,
84 char *Pathname,
85 UINT8 NodeFlags,
86 const char *Format,
87 ...)
89 va_list ArgList;
93 * Warning messages for this method/object will be disabled after the
94 * first time a validation fails or an object is successfully repaired.
96 if (NodeFlags & ANOBJ_EVALUATED)
98 return;
101 AcpiOsPrintf (ACPI_MSG_WARNING "%s: ", Pathname);
103 va_start (ArgList, Format);
104 AcpiOsVprintf (Format, ArgList);
105 ACPI_MSG_SUFFIX;
106 va_end (ArgList);
110 /*******************************************************************************
112 * FUNCTION: AcpiUtPredefinedInfo
114 * PARAMETERS: ModuleName - Caller's module name (for error output)
115 * LineNumber - Caller's line number (for error output)
116 * Pathname - Full pathname to the node
117 * NodeFlags - From Namespace node for the method/object
118 * Format - Printf format string + additional args
120 * RETURN: None
122 * DESCRIPTION: Info messages for the predefined validation module. Messages
123 * are only emitted the first time a problem with a particular
124 * method/object is detected. This prevents a flood of
125 * messages for methods that are repeatedly evaluated.
127 ******************************************************************************/
129 void ACPI_INTERNAL_VAR_XFACE
130 AcpiUtPredefinedInfo (
131 const char *ModuleName,
132 UINT32 LineNumber,
133 char *Pathname,
134 UINT8 NodeFlags,
135 const char *Format,
136 ...)
138 va_list ArgList;
142 * Warning messages for this method/object will be disabled after the
143 * first time a validation fails or an object is successfully repaired.
145 if (NodeFlags & ANOBJ_EVALUATED)
147 return;
150 AcpiOsPrintf (ACPI_MSG_INFO "%s: ", Pathname);
152 va_start (ArgList, Format);
153 AcpiOsVprintf (Format, ArgList);
154 ACPI_MSG_SUFFIX;
155 va_end (ArgList);
159 /*******************************************************************************
161 * FUNCTION: AcpiUtPredefinedBiosError
163 * PARAMETERS: ModuleName - Caller's module name (for error output)
164 * LineNumber - Caller's line number (for error output)
165 * Pathname - Full pathname to the node
166 * NodeFlags - From Namespace node for the method/object
167 * Format - Printf format string + additional args
169 * RETURN: None
171 * DESCRIPTION: BIOS error message for predefined names. Messages
172 * are only emitted the first time a problem with a particular
173 * method/object is detected. This prevents a flood of
174 * messages for methods that are repeatedly evaluated.
176 ******************************************************************************/
178 void ACPI_INTERNAL_VAR_XFACE
179 AcpiUtPredefinedBiosError (
180 const char *ModuleName,
181 UINT32 LineNumber,
182 char *Pathname,
183 UINT8 NodeFlags,
184 const char *Format,
185 ...)
187 va_list ArgList;
191 * Warning messages for this method/object will be disabled after the
192 * first time a validation fails or an object is successfully repaired.
194 if (NodeFlags & ANOBJ_EVALUATED)
196 return;
199 AcpiOsPrintf (ACPI_MSG_BIOS_ERROR "%s: ", Pathname);
201 va_start (ArgList, Format);
202 AcpiOsVprintf (Format, ArgList);
203 ACPI_MSG_SUFFIX;
204 va_end (ArgList);
208 /*******************************************************************************
210 * FUNCTION: AcpiUtNamespaceError
212 * PARAMETERS: ModuleName - Caller's module name (for error output)
213 * LineNumber - Caller's line number (for error output)
214 * InternalName - Name or path of the namespace node
215 * LookupStatus - Exception code from NS lookup
217 * RETURN: None
219 * DESCRIPTION: Print error message with the full pathname for the NS node.
221 ******************************************************************************/
223 void
224 AcpiUtNamespaceError (
225 const char *ModuleName,
226 UINT32 LineNumber,
227 const char *InternalName,
228 ACPI_STATUS LookupStatus)
230 ACPI_STATUS Status;
231 UINT32 BadName;
232 char *Name = NULL;
235 ACPI_MSG_REDIRECT_BEGIN;
236 AcpiOsPrintf (ACPI_MSG_ERROR);
238 if (LookupStatus == AE_BAD_CHARACTER)
240 /* There is a non-ascii character in the name */
242 ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName));
243 AcpiOsPrintf ("[0x%.8X] (NON-ASCII)", BadName);
245 else
247 /* Convert path to external format */
249 Status = AcpiNsExternalizeName (ACPI_UINT32_MAX,
250 InternalName, NULL, &Name);
252 /* Print target name */
254 if (ACPI_SUCCESS (Status))
256 AcpiOsPrintf ("[%s]", Name);
258 else
260 AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]");
263 if (Name)
265 ACPI_FREE (Name);
269 AcpiOsPrintf (" Namespace lookup failure, %s",
270 AcpiFormatException (LookupStatus));
272 ACPI_MSG_SUFFIX;
273 ACPI_MSG_REDIRECT_END;
277 /*******************************************************************************
279 * FUNCTION: AcpiUtMethodError
281 * PARAMETERS: ModuleName - Caller's module name (for error output)
282 * LineNumber - Caller's line number (for error output)
283 * Message - Error message to use on failure
284 * PrefixNode - Prefix relative to the path
285 * Path - Path to the node (optional)
286 * MethodStatus - Execution status
288 * RETURN: None
290 * DESCRIPTION: Print error message with the full pathname for the method.
292 ******************************************************************************/
294 void
295 AcpiUtMethodError (
296 const char *ModuleName,
297 UINT32 LineNumber,
298 const char *Message,
299 ACPI_NAMESPACE_NODE *PrefixNode,
300 const char *Path,
301 ACPI_STATUS MethodStatus)
303 ACPI_STATUS Status;
304 ACPI_NAMESPACE_NODE *Node = PrefixNode;
307 ACPI_MSG_REDIRECT_BEGIN;
308 AcpiOsPrintf (ACPI_MSG_ERROR);
310 if (Path)
312 Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH,
313 &Node);
314 if (ACPI_FAILURE (Status))
316 AcpiOsPrintf ("[Could not get node by pathname]");
320 AcpiNsPrintNodePathname (Node, Message);
321 AcpiOsPrintf (", %s", AcpiFormatException (MethodStatus));
323 ACPI_MSG_SUFFIX;
324 ACPI_MSG_REDIRECT_END;
327 #endif /* ACPI_NO_ERROR_MESSAGES */