uterror.c revision 1.1.1.1.4.2 1 1.1.1.1.4.2 rmind /*******************************************************************************
2 1.1.1.1.4.2 rmind *
3 1.1.1.1.4.2 rmind * Module Name: uterror - Various internal error/warning output functions
4 1.1.1.1.4.2 rmind *
5 1.1.1.1.4.2 rmind ******************************************************************************/
6 1.1.1.1.4.2 rmind
7 1.1.1.1.4.2 rmind /*
8 1.1.1.1.4.2 rmind * Copyright (C) 2000 - 2013, Intel Corp.
9 1.1.1.1.4.2 rmind * All rights reserved.
10 1.1.1.1.4.2 rmind *
11 1.1.1.1.4.2 rmind * Redistribution and use in source and binary forms, with or without
12 1.1.1.1.4.2 rmind * modification, are permitted provided that the following conditions
13 1.1.1.1.4.2 rmind * are met:
14 1.1.1.1.4.2 rmind * 1. Redistributions of source code must retain the above copyright
15 1.1.1.1.4.2 rmind * notice, this list of conditions, and the following disclaimer,
16 1.1.1.1.4.2 rmind * without modification.
17 1.1.1.1.4.2 rmind * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.1.4.2 rmind * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.1.4.2 rmind * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.1.4.2 rmind * including a substantially similar Disclaimer requirement for further
21 1.1.1.1.4.2 rmind * binary redistribution.
22 1.1.1.1.4.2 rmind * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.1.4.2 rmind * of any contributors may be used to endorse or promote products derived
24 1.1.1.1.4.2 rmind * from this software without specific prior written permission.
25 1.1.1.1.4.2 rmind *
26 1.1.1.1.4.2 rmind * Alternatively, this software may be distributed under the terms of the
27 1.1.1.1.4.2 rmind * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.1.4.2 rmind * Software Foundation.
29 1.1.1.1.4.2 rmind *
30 1.1.1.1.4.2 rmind * NO WARRANTY
31 1.1.1.1.4.2 rmind * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.1.4.2 rmind * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.1.4.2 rmind * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.1.4.2 rmind * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.1.4.2 rmind * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.1.4.2 rmind * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.1.4.2 rmind * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.1.4.2 rmind * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.1.4.2 rmind * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.1.4.2 rmind * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.1.4.2 rmind * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.1.4.2 rmind */
43 1.1.1.1.4.2 rmind
44 1.1.1.1.4.2 rmind #define __UTERROR_C__
45 1.1.1.1.4.2 rmind
46 1.1.1.1.4.2 rmind #include "acpi.h"
47 1.1.1.1.4.2 rmind #include "accommon.h"
48 1.1.1.1.4.2 rmind #include "acnamesp.h"
49 1.1.1.1.4.2 rmind
50 1.1.1.1.4.2 rmind
51 1.1.1.1.4.2 rmind #define _COMPONENT ACPI_UTILITIES
52 1.1.1.1.4.2 rmind ACPI_MODULE_NAME ("uterror")
53 1.1.1.1.4.2 rmind
54 1.1.1.1.4.2 rmind
55 1.1.1.1.4.2 rmind /*
56 1.1.1.1.4.2 rmind * This module contains internal error functions that may
57 1.1.1.1.4.2 rmind * be configured out.
58 1.1.1.1.4.2 rmind */
59 1.1.1.1.4.2 rmind #if !defined (ACPI_NO_ERROR_MESSAGES)
60 1.1.1.1.4.2 rmind
61 1.1.1.1.4.2 rmind /*******************************************************************************
62 1.1.1.1.4.2 rmind *
63 1.1.1.1.4.2 rmind * FUNCTION: AcpiUtPredefinedWarning
64 1.1.1.1.4.2 rmind *
65 1.1.1.1.4.2 rmind * PARAMETERS: ModuleName - Caller's module name (for error output)
66 1.1.1.1.4.2 rmind * LineNumber - Caller's line number (for error output)
67 1.1.1.1.4.2 rmind * Pathname - Full pathname to the node
68 1.1.1.1.4.2 rmind * NodeFlags - From Namespace node for the method/object
69 1.1.1.1.4.2 rmind * Format - Printf format string + additional args
70 1.1.1.1.4.2 rmind *
71 1.1.1.1.4.2 rmind * RETURN: None
72 1.1.1.1.4.2 rmind *
73 1.1.1.1.4.2 rmind * DESCRIPTION: Warnings for the predefined validation module. Messages are
74 1.1.1.1.4.2 rmind * only emitted the first time a problem with a particular
75 1.1.1.1.4.2 rmind * method/object is detected. This prevents a flood of error
76 1.1.1.1.4.2 rmind * messages for methods that are repeatedly evaluated.
77 1.1.1.1.4.2 rmind *
78 1.1.1.1.4.2 rmind ******************************************************************************/
79 1.1.1.1.4.2 rmind
80 1.1.1.1.4.2 rmind void ACPI_INTERNAL_VAR_XFACE
81 1.1.1.1.4.2 rmind AcpiUtPredefinedWarning (
82 1.1.1.1.4.2 rmind const char *ModuleName,
83 1.1.1.1.4.2 rmind UINT32 LineNumber,
84 1.1.1.1.4.2 rmind char *Pathname,
85 1.1.1.1.4.2 rmind UINT8 NodeFlags,
86 1.1.1.1.4.2 rmind const char *Format,
87 1.1.1.1.4.2 rmind ...)
88 1.1.1.1.4.2 rmind {
89 1.1.1.1.4.2 rmind va_list ArgList;
90 1.1.1.1.4.2 rmind
91 1.1.1.1.4.2 rmind
92 1.1.1.1.4.2 rmind /*
93 1.1.1.1.4.2 rmind * Warning messages for this method/object will be disabled after the
94 1.1.1.1.4.2 rmind * first time a validation fails or an object is successfully repaired.
95 1.1.1.1.4.2 rmind */
96 1.1.1.1.4.2 rmind if (NodeFlags & ANOBJ_EVALUATED)
97 1.1.1.1.4.2 rmind {
98 1.1.1.1.4.2 rmind return;
99 1.1.1.1.4.2 rmind }
100 1.1.1.1.4.2 rmind
101 1.1.1.1.4.2 rmind AcpiOsPrintf (ACPI_MSG_WARNING "%s: ", Pathname);
102 1.1.1.1.4.2 rmind
103 1.1.1.1.4.2 rmind va_start (ArgList, Format);
104 1.1.1.1.4.2 rmind AcpiOsVprintf (Format, ArgList);
105 1.1.1.1.4.2 rmind ACPI_MSG_SUFFIX;
106 1.1.1.1.4.2 rmind va_end (ArgList);
107 1.1.1.1.4.2 rmind }
108 1.1.1.1.4.2 rmind
109 1.1.1.1.4.2 rmind
110 1.1.1.1.4.2 rmind /*******************************************************************************
111 1.1.1.1.4.2 rmind *
112 1.1.1.1.4.2 rmind * FUNCTION: AcpiUtPredefinedInfo
113 1.1.1.1.4.2 rmind *
114 1.1.1.1.4.2 rmind * PARAMETERS: ModuleName - Caller's module name (for error output)
115 1.1.1.1.4.2 rmind * LineNumber - Caller's line number (for error output)
116 1.1.1.1.4.2 rmind * Pathname - Full pathname to the node
117 1.1.1.1.4.2 rmind * NodeFlags - From Namespace node for the method/object
118 1.1.1.1.4.2 rmind * Format - Printf format string + additional args
119 1.1.1.1.4.2 rmind *
120 1.1.1.1.4.2 rmind * RETURN: None
121 1.1.1.1.4.2 rmind *
122 1.1.1.1.4.2 rmind * DESCRIPTION: Info messages for the predefined validation module. Messages
123 1.1.1.1.4.2 rmind * are only emitted the first time a problem with a particular
124 1.1.1.1.4.2 rmind * method/object is detected. This prevents a flood of
125 1.1.1.1.4.2 rmind * messages for methods that are repeatedly evaluated.
126 1.1.1.1.4.2 rmind *
127 1.1.1.1.4.2 rmind ******************************************************************************/
128 1.1.1.1.4.2 rmind
129 1.1.1.1.4.2 rmind void ACPI_INTERNAL_VAR_XFACE
130 1.1.1.1.4.2 rmind AcpiUtPredefinedInfo (
131 1.1.1.1.4.2 rmind const char *ModuleName,
132 1.1.1.1.4.2 rmind UINT32 LineNumber,
133 1.1.1.1.4.2 rmind char *Pathname,
134 1.1.1.1.4.2 rmind UINT8 NodeFlags,
135 1.1.1.1.4.2 rmind const char *Format,
136 1.1.1.1.4.2 rmind ...)
137 1.1.1.1.4.2 rmind {
138 1.1.1.1.4.2 rmind va_list ArgList;
139 1.1.1.1.4.2 rmind
140 1.1.1.1.4.2 rmind
141 1.1.1.1.4.2 rmind /*
142 1.1.1.1.4.2 rmind * Warning messages for this method/object will be disabled after the
143 1.1.1.1.4.2 rmind * first time a validation fails or an object is successfully repaired.
144 1.1.1.1.4.2 rmind */
145 1.1.1.1.4.2 rmind if (NodeFlags & ANOBJ_EVALUATED)
146 1.1.1.1.4.2 rmind {
147 1.1.1.1.4.2 rmind return;
148 1.1.1.1.4.2 rmind }
149 1.1.1.1.4.2 rmind
150 1.1.1.1.4.2 rmind AcpiOsPrintf (ACPI_MSG_INFO "%s: ", Pathname);
151 1.1.1.1.4.2 rmind
152 1.1.1.1.4.2 rmind va_start (ArgList, Format);
153 1.1.1.1.4.2 rmind AcpiOsVprintf (Format, ArgList);
154 1.1.1.1.4.2 rmind ACPI_MSG_SUFFIX;
155 1.1.1.1.4.2 rmind va_end (ArgList);
156 1.1.1.1.4.2 rmind }
157 1.1.1.1.4.2 rmind
158 1.1.1.1.4.2 rmind
159 1.1.1.1.4.2 rmind /*******************************************************************************
160 1.1.1.1.4.2 rmind *
161 1.1.1.1.4.2 rmind * FUNCTION: AcpiUtPredefinedBiosError
162 1.1.1.1.4.2 rmind *
163 1.1.1.1.4.2 rmind * PARAMETERS: ModuleName - Caller's module name (for error output)
164 1.1.1.1.4.2 rmind * LineNumber - Caller's line number (for error output)
165 1.1.1.1.4.2 rmind * Pathname - Full pathname to the node
166 1.1.1.1.4.2 rmind * NodeFlags - From Namespace node for the method/object
167 1.1.1.1.4.2 rmind * Format - Printf format string + additional args
168 1.1.1.1.4.2 rmind *
169 1.1.1.1.4.2 rmind * RETURN: None
170 1.1.1.1.4.2 rmind *
171 1.1.1.1.4.2 rmind * DESCRIPTION: BIOS error message for predefined names. Messages
172 1.1.1.1.4.2 rmind * are only emitted the first time a problem with a particular
173 1.1.1.1.4.2 rmind * method/object is detected. This prevents a flood of
174 1.1.1.1.4.2 rmind * messages for methods that are repeatedly evaluated.
175 1.1.1.1.4.2 rmind *
176 1.1.1.1.4.2 rmind ******************************************************************************/
177 1.1.1.1.4.2 rmind
178 1.1.1.1.4.2 rmind void ACPI_INTERNAL_VAR_XFACE
179 1.1.1.1.4.2 rmind AcpiUtPredefinedBiosError (
180 1.1.1.1.4.2 rmind const char *ModuleName,
181 1.1.1.1.4.2 rmind UINT32 LineNumber,
182 1.1.1.1.4.2 rmind char *Pathname,
183 1.1.1.1.4.2 rmind UINT8 NodeFlags,
184 1.1.1.1.4.2 rmind const char *Format,
185 1.1.1.1.4.2 rmind ...)
186 1.1.1.1.4.2 rmind {
187 1.1.1.1.4.2 rmind va_list ArgList;
188 1.1.1.1.4.2 rmind
189 1.1.1.1.4.2 rmind
190 1.1.1.1.4.2 rmind /*
191 1.1.1.1.4.2 rmind * Warning messages for this method/object will be disabled after the
192 1.1.1.1.4.2 rmind * first time a validation fails or an object is successfully repaired.
193 1.1.1.1.4.2 rmind */
194 1.1.1.1.4.2 rmind if (NodeFlags & ANOBJ_EVALUATED)
195 1.1.1.1.4.2 rmind {
196 1.1.1.1.4.2 rmind return;
197 1.1.1.1.4.2 rmind }
198 1.1.1.1.4.2 rmind
199 1.1.1.1.4.2 rmind AcpiOsPrintf (ACPI_MSG_BIOS_ERROR "%s: ", Pathname);
200 1.1.1.1.4.2 rmind
201 1.1.1.1.4.2 rmind va_start (ArgList, Format);
202 1.1.1.1.4.2 rmind AcpiOsVprintf (Format, ArgList);
203 1.1.1.1.4.2 rmind ACPI_MSG_SUFFIX;
204 1.1.1.1.4.2 rmind va_end (ArgList);
205 1.1.1.1.4.2 rmind }
206 1.1.1.1.4.2 rmind
207 1.1.1.1.4.2 rmind
208 1.1.1.1.4.2 rmind /*******************************************************************************
209 1.1.1.1.4.2 rmind *
210 1.1.1.1.4.2 rmind * FUNCTION: AcpiUtNamespaceError
211 1.1.1.1.4.2 rmind *
212 1.1.1.1.4.2 rmind * PARAMETERS: ModuleName - Caller's module name (for error output)
213 1.1.1.1.4.2 rmind * LineNumber - Caller's line number (for error output)
214 1.1.1.1.4.2 rmind * InternalName - Name or path of the namespace node
215 1.1.1.1.4.2 rmind * LookupStatus - Exception code from NS lookup
216 1.1.1.1.4.2 rmind *
217 1.1.1.1.4.2 rmind * RETURN: None
218 1.1.1.1.4.2 rmind *
219 1.1.1.1.4.2 rmind * DESCRIPTION: Print error message with the full pathname for the NS node.
220 1.1.1.1.4.2 rmind *
221 1.1.1.1.4.2 rmind ******************************************************************************/
222 1.1.1.1.4.2 rmind
223 1.1.1.1.4.2 rmind void
224 1.1.1.1.4.2 rmind AcpiUtNamespaceError (
225 1.1.1.1.4.2 rmind const char *ModuleName,
226 1.1.1.1.4.2 rmind UINT32 LineNumber,
227 1.1.1.1.4.2 rmind const char *InternalName,
228 1.1.1.1.4.2 rmind ACPI_STATUS LookupStatus)
229 1.1.1.1.4.2 rmind {
230 1.1.1.1.4.2 rmind ACPI_STATUS Status;
231 1.1.1.1.4.2 rmind UINT32 BadName;
232 1.1.1.1.4.2 rmind char *Name = NULL;
233 1.1.1.1.4.2 rmind
234 1.1.1.1.4.2 rmind
235 1.1.1.1.4.2 rmind ACPI_MSG_REDIRECT_BEGIN;
236 1.1.1.1.4.2 rmind AcpiOsPrintf (ACPI_MSG_ERROR);
237 1.1.1.1.4.2 rmind
238 1.1.1.1.4.2 rmind if (LookupStatus == AE_BAD_CHARACTER)
239 1.1.1.1.4.2 rmind {
240 1.1.1.1.4.2 rmind /* There is a non-ascii character in the name */
241 1.1.1.1.4.2 rmind
242 1.1.1.1.4.2 rmind ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName));
243 1.1.1.1.4.2 rmind AcpiOsPrintf ("[0x%.8X] (NON-ASCII)", BadName);
244 1.1.1.1.4.2 rmind }
245 1.1.1.1.4.2 rmind else
246 1.1.1.1.4.2 rmind {
247 1.1.1.1.4.2 rmind /* Convert path to external format */
248 1.1.1.1.4.2 rmind
249 1.1.1.1.4.2 rmind Status = AcpiNsExternalizeName (ACPI_UINT32_MAX,
250 1.1.1.1.4.2 rmind InternalName, NULL, &Name);
251 1.1.1.1.4.2 rmind
252 1.1.1.1.4.2 rmind /* Print target name */
253 1.1.1.1.4.2 rmind
254 1.1.1.1.4.2 rmind if (ACPI_SUCCESS (Status))
255 1.1.1.1.4.2 rmind {
256 1.1.1.1.4.2 rmind AcpiOsPrintf ("[%s]", Name);
257 1.1.1.1.4.2 rmind }
258 1.1.1.1.4.2 rmind else
259 1.1.1.1.4.2 rmind {
260 1.1.1.1.4.2 rmind AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]");
261 1.1.1.1.4.2 rmind }
262 1.1.1.1.4.2 rmind
263 1.1.1.1.4.2 rmind if (Name)
264 1.1.1.1.4.2 rmind {
265 1.1.1.1.4.2 rmind ACPI_FREE (Name);
266 1.1.1.1.4.2 rmind }
267 1.1.1.1.4.2 rmind }
268 1.1.1.1.4.2 rmind
269 1.1.1.1.4.2 rmind AcpiOsPrintf (" Namespace lookup failure, %s",
270 1.1.1.1.4.2 rmind AcpiFormatException (LookupStatus));
271 1.1.1.1.4.2 rmind
272 1.1.1.1.4.2 rmind ACPI_MSG_SUFFIX;
273 1.1.1.1.4.2 rmind ACPI_MSG_REDIRECT_END;
274 1.1.1.1.4.2 rmind }
275 1.1.1.1.4.2 rmind
276 1.1.1.1.4.2 rmind
277 1.1.1.1.4.2 rmind /*******************************************************************************
278 1.1.1.1.4.2 rmind *
279 1.1.1.1.4.2 rmind * FUNCTION: AcpiUtMethodError
280 1.1.1.1.4.2 rmind *
281 1.1.1.1.4.2 rmind * PARAMETERS: ModuleName - Caller's module name (for error output)
282 1.1.1.1.4.2 rmind * LineNumber - Caller's line number (for error output)
283 1.1.1.1.4.2 rmind * Message - Error message to use on failure
284 1.1.1.1.4.2 rmind * PrefixNode - Prefix relative to the path
285 1.1.1.1.4.2 rmind * Path - Path to the node (optional)
286 1.1.1.1.4.2 rmind * MethodStatus - Execution status
287 1.1.1.1.4.2 rmind *
288 1.1.1.1.4.2 rmind * RETURN: None
289 1.1.1.1.4.2 rmind *
290 1.1.1.1.4.2 rmind * DESCRIPTION: Print error message with the full pathname for the method.
291 1.1.1.1.4.2 rmind *
292 1.1.1.1.4.2 rmind ******************************************************************************/
293 1.1.1.1.4.2 rmind
294 1.1.1.1.4.2 rmind void
295 1.1.1.1.4.2 rmind AcpiUtMethodError (
296 1.1.1.1.4.2 rmind const char *ModuleName,
297 1.1.1.1.4.2 rmind UINT32 LineNumber,
298 1.1.1.1.4.2 rmind const char *Message,
299 1.1.1.1.4.2 rmind ACPI_NAMESPACE_NODE *PrefixNode,
300 1.1.1.1.4.2 rmind const char *Path,
301 1.1.1.1.4.2 rmind ACPI_STATUS MethodStatus)
302 1.1.1.1.4.2 rmind {
303 1.1.1.1.4.2 rmind ACPI_STATUS Status;
304 1.1.1.1.4.2 rmind ACPI_NAMESPACE_NODE *Node = PrefixNode;
305 1.1.1.1.4.2 rmind
306 1.1.1.1.4.2 rmind
307 1.1.1.1.4.2 rmind ACPI_MSG_REDIRECT_BEGIN;
308 1.1.1.1.4.2 rmind AcpiOsPrintf (ACPI_MSG_ERROR);
309 1.1.1.1.4.2 rmind
310 1.1.1.1.4.2 rmind if (Path)
311 1.1.1.1.4.2 rmind {
312 1.1.1.1.4.2 rmind Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH,
313 1.1.1.1.4.2 rmind &Node);
314 1.1.1.1.4.2 rmind if (ACPI_FAILURE (Status))
315 1.1.1.1.4.2 rmind {
316 1.1.1.1.4.2 rmind AcpiOsPrintf ("[Could not get node by pathname]");
317 1.1.1.1.4.2 rmind }
318 1.1.1.1.4.2 rmind }
319 1.1.1.1.4.2 rmind
320 1.1.1.1.4.2 rmind AcpiNsPrintNodePathname (Node, Message);
321 1.1.1.1.4.2 rmind AcpiOsPrintf (", %s", AcpiFormatException (MethodStatus));
322 1.1.1.1.4.2 rmind
323 1.1.1.1.4.2 rmind ACPI_MSG_SUFFIX;
324 1.1.1.1.4.2 rmind ACPI_MSG_REDIRECT_END;
325 1.1.1.1.4.2 rmind }
326 1.1.1.1.4.2 rmind
327 1.1.1.1.4.2 rmind #endif /* ACPI_NO_ERROR_MESSAGES */
328