ReactOS 0.4.15-dev-7887-g64a59a1
uterror.c
Go to the documentation of this file.
1/*******************************************************************************
2 *
3 * Module Name: uterror - Various internal error/warning output functions
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2022, 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 MERCHANTABILITY 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.h"
45#include "accommon.h"
46#include "acnamesp.h"
47
48
49#define _COMPONENT ACPI_UTILITIES
50 ACPI_MODULE_NAME ("uterror")
51
52
53/*
54 * This module contains internal error functions that may
55 * be configured out.
56 */
57#if !defined (ACPI_NO_ERROR_MESSAGES)
58
59/*******************************************************************************
60 *
61 * FUNCTION: AcpiUtPredefinedWarning
62 *
63 * PARAMETERS: ModuleName - Caller's module name (for error output)
64 * LineNumber - Caller's line number (for error output)
65 * Pathname - Full pathname to the node
66 * NodeFlags - From Namespace node for the method/object
67 * Format - Printf format string + additional args
68 *
69 * RETURN: None
70 *
71 * DESCRIPTION: Warnings for the predefined validation module. Messages are
72 * only emitted the first time a problem with a particular
73 * method/object is detected. This prevents a flood of error
74 * messages for methods that are repeatedly evaluated.
75 *
76 ******************************************************************************/
77
80 const char *ModuleName,
82 char *Pathname,
83 UINT16 NodeFlags,
84 const char *Format,
85 ...)
86{
87 va_list ArgList;
88
89
90 /*
91 * Warning messages for this method/object will be disabled after the
92 * first time a validation fails or an object is successfully repaired.
93 */
94 if (NodeFlags & ANOBJ_EVALUATED)
95 {
96 return;
97 }
98
100
101 va_start (ArgList, Format);
102 AcpiOsVprintf (Format, ArgList);
104 va_end (ArgList);
105}
106
107
108/*******************************************************************************
109 *
110 * FUNCTION: AcpiUtPredefinedInfo
111 *
112 * PARAMETERS: ModuleName - Caller's module name (for error output)
113 * LineNumber - Caller's line number (for error output)
114 * Pathname - Full pathname to the node
115 * NodeFlags - From Namespace node for the method/object
116 * Format - Printf format string + additional args
117 *
118 * RETURN: None
119 *
120 * DESCRIPTION: Info messages for the predefined validation module. Messages
121 * are only emitted the first time a problem with a particular
122 * method/object is detected. This prevents a flood of
123 * messages for methods that are repeatedly evaluated.
124 *
125 ******************************************************************************/
126
129 const char *ModuleName,
131 char *Pathname,
132 UINT16 NodeFlags,
133 const char *Format,
134 ...)
135{
136 va_list ArgList;
137
138
139 /*
140 * Warning messages for this method/object will be disabled after the
141 * first time a validation fails or an object is successfully repaired.
142 */
143 if (NodeFlags & ANOBJ_EVALUATED)
144 {
145 return;
146 }
147
149
150 va_start (ArgList, Format);
151 AcpiOsVprintf (Format, ArgList);
153 va_end (ArgList);
154}
155
156
157/*******************************************************************************
158 *
159 * FUNCTION: AcpiUtPredefinedBiosError
160 *
161 * PARAMETERS: ModuleName - Caller's module name (for error output)
162 * LineNumber - Caller's line number (for error output)
163 * Pathname - Full pathname to the node
164 * NodeFlags - From Namespace node for the method/object
165 * Format - Printf format string + additional args
166 *
167 * RETURN: None
168 *
169 * DESCRIPTION: BIOS error message for predefined names. Messages
170 * are only emitted the first time a problem with a particular
171 * method/object is detected. This prevents a flood of
172 * messages for methods that are repeatedly evaluated.
173 *
174 ******************************************************************************/
175
178 const char *ModuleName,
180 char *Pathname,
181 UINT16 NodeFlags,
182 const char *Format,
183 ...)
184{
185 va_list ArgList;
186
187
188 /*
189 * Warning messages for this method/object will be disabled after the
190 * first time a validation fails or an object is successfully repaired.
191 */
192 if (NodeFlags & ANOBJ_EVALUATED)
193 {
194 return;
195 }
196
198
199 va_start (ArgList, Format);
200 AcpiOsVprintf (Format, ArgList);
202 va_end (ArgList);
203}
204
205
206/*******************************************************************************
207 *
208 * FUNCTION: AcpiUtPrefixedNamespaceError
209 *
210 * PARAMETERS: ModuleName - Caller's module name (for error output)
211 * LineNumber - Caller's line number (for error output)
212 * PrefixScope - Scope/Path that prefixes the internal path
213 * InternalPath - Name or path of the namespace node
214 * LookupStatus - Exception code from NS lookup
215 *
216 * RETURN: None
217 *
218 * DESCRIPTION: Print error message with the full pathname constructed this way:
219 *
220 * PrefixScopeNodeFullPath.ExternalizedInternalPath
221 *
222 * NOTE: 10/2017: Treat the major NsLookup errors as firmware errors
223 *
224 ******************************************************************************/
225
226void
228 const char *ModuleName,
230 ACPI_GENERIC_STATE *PrefixScope,
231 const char *InternalPath,
232 ACPI_STATUS LookupStatus)
233{
234 char *FullPath;
235 const char *Message;
236
237
238 /*
239 * Main cases:
240 * 1) Object creation, object must not already exist
241 * 2) Object lookup, object must exist
242 */
243 switch (LookupStatus)
244 {
246
248 Message = "Failure creating named object";
249 break;
250
251 case AE_NOT_FOUND:
252
254 Message = "Could not resolve symbol";
255 break;
256
257 default:
258
260 Message = "Failure resolving symbol";
261 break;
262 }
263
264 /* Concatenate the prefix path and the internal path */
265
266 FullPath = AcpiNsBuildPrefixedPathname (PrefixScope, InternalPath);
267
268 AcpiOsPrintf ("%s [%s], %s", Message,
269 FullPath ? FullPath : "Could not get pathname",
270 AcpiFormatException (LookupStatus));
271
272 if (FullPath)
273 {
274 ACPI_FREE (FullPath);
275 }
276
278}
279
280
281#ifdef __OBSOLETE_FUNCTION
282/*******************************************************************************
283 *
284 * FUNCTION: AcpiUtNamespaceError
285 *
286 * PARAMETERS: ModuleName - Caller's module name (for error output)
287 * LineNumber - Caller's line number (for error output)
288 * InternalName - Name or path of the namespace node
289 * LookupStatus - Exception code from NS lookup
290 *
291 * RETURN: None
292 *
293 * DESCRIPTION: Print error message with the full pathname for the NS node.
294 *
295 ******************************************************************************/
296
297void
298AcpiUtNamespaceError (
299 const char *ModuleName,
301 const char *InternalName,
302 ACPI_STATUS LookupStatus)
303{
305 UINT32 BadName;
306 char *Name = NULL;
307
308
311
312 if (LookupStatus == AE_BAD_CHARACTER)
313 {
314 /* There is a non-ascii character in the name */
315
316 ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName));
317 AcpiOsPrintf ("[0x%.8X] (NON-ASCII)", BadName);
318 }
319 else
320 {
321 /* Convert path to external format */
322
324 ACPI_UINT32_MAX, InternalName, NULL, &Name);
325
326 /* Print target name */
327
328 if (ACPI_SUCCESS (Status))
329 {
330 AcpiOsPrintf ("[%s]", Name);
331 }
332 else
333 {
334 AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]");
335 }
336
337 if (Name)
338 {
339 ACPI_FREE (Name);
340 }
341 }
342
343 AcpiOsPrintf (" Namespace lookup failure, %s",
344 AcpiFormatException (LookupStatus));
345
348}
349#endif
350
351/*******************************************************************************
352 *
353 * FUNCTION: AcpiUtMethodError
354 *
355 * PARAMETERS: ModuleName - Caller's module name (for error output)
356 * LineNumber - Caller's line number (for error output)
357 * Message - Error message to use on failure
358 * PrefixNode - Prefix relative to the path
359 * Path - Path to the node (optional)
360 * MethodStatus - Execution status
361 *
362 * RETURN: None
363 *
364 * DESCRIPTION: Print error message with the full pathname for the method.
365 *
366 ******************************************************************************/
367
368void
370 const char *ModuleName,
372 const char *Message,
373 ACPI_NAMESPACE_NODE *PrefixNode,
374 const char *Path,
375 ACPI_STATUS MethodStatus)
376{
378 ACPI_NAMESPACE_NODE *Node = PrefixNode;
379
380
383
384 if (Path)
385 {
386 Status = AcpiNsGetNode (PrefixNode, Path,
388 if (ACPI_FAILURE (Status))
389 {
390 AcpiOsPrintf ("[Could not get node by pathname]");
391 }
392 }
393
395 AcpiOsPrintf (" due to previous error (%s)",
396 AcpiFormatException (MethodStatus));
397
400}
401
402#endif /* ACPI_NO_ERROR_MESSAGES */
unsigned short UINT16
unsigned int UINT32
PRTL_UNICODE_STRING_BUFFER Path
#define ACPI_INTERNAL_VAR_XFACE
Definition: acenv.h:338
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_ALREADY_EXISTS
Definition: acexcep.h:115
#define AE_NOT_FOUND
Definition: acexcep.h:113
#define AE_BAD_CHARACTER
Definition: acexcep.h:152
#define ACPI_SUCCESS(a)
Definition: acexcep.h:94
#define ANOBJ_EVALUATED
Definition: aclocal.h:220
#define ACPI_MOVE_32_TO_32(d, s)
Definition: acmacros.h:148
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
char * AcpiNsBuildPrefixedPathname(ACPI_GENERIC_STATE *PrefixScope, const char *InternalPath)
Definition: nsnames.c:423
ACPI_STATUS AcpiNsGetNode(ACPI_NAMESPACE_NODE *PrefixNode, const char *ExternalPathname, UINT32 Flags, ACPI_NAMESPACE_NODE **OutNode)
Definition: nsutils.c:863
#define ACPI_NS_NO_UPSEARCH
Definition: acnamesp.h:62
ACPI_STATUS AcpiNsExternalizeName(UINT32 InternalNameLength, const char *InternalName, UINT32 *ConvertedNameLength, char **ConvertedName)
Definition: nsutils.c:470
void AcpiNsPrintNodePathname(ACPI_NAMESPACE_NODE *Node, const char *Msg)
Definition: nsutils.c:75
#define ACPI_MODULE_NAME(Name)
Definition: acoutput.h:216
void AcpiOsVprintf(const char *Format, va_list Args)
Definition: osl.c:865
void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf(const char *Format,...)
Definition: osl.c:851
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1220
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1280
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING Pathname
Definition: acpixf.h:704
#define ACPI_FREE(a)
Definition: actypes.h:386
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_CAST_PTR(t, p)
Definition: actypes.h:544
#define ACPI_UINT32_MAX
Definition: actypes.h:66
#define ACPI_MSG_BIOS_ERROR
Definition: acutils.h:131
#define ACPI_MSG_ERROR
Definition: acutils.h:121
#define ACPI_MSG_REDIRECT_BEGIN
Definition: acutils.h:113
#define ACPI_MSG_SUFFIX
Definition: acutils.h:140
#define ACPI_MSG_WARNING
Definition: acutils.h:124
#define ACPI_MSG_INFO
Definition: acutils.h:127
#define ACPI_MSG_REDIRECT_END
Definition: acutils.h:114
@ InternalPath
Definition: bl.h:284
#define NULL
Definition: types.h:112
static const WCHAR Message[]
Definition: register.c:74
Status
Definition: gdiplustypes.h:25
Definition: dlist.c:348
void ACPI_INTERNAL_VAR_XFACE AcpiUtPredefinedWarning(const char *ModuleName, UINT32 LineNumber, char *Pathname, UINT16 NodeFlags, const char *Format,...)
Definition: uterror.c:79
void ACPI_INTERNAL_VAR_XFACE AcpiUtPredefinedBiosError(const char *ModuleName, UINT32 LineNumber, char *Pathname, UINT16 NodeFlags, const char *Format,...)
Definition: uterror.c:177
void ACPI_INTERNAL_VAR_XFACE AcpiUtPredefinedInfo(const char *ModuleName, UINT32 LineNumber, char *Pathname, UINT16 NodeFlags, const char *Format,...)
Definition: uterror.c:128
void AcpiUtPrefixedNamespaceError(const char *ModuleName, UINT32 LineNumber, ACPI_GENERIC_STATE *PrefixScope, const char *InternalPath, ACPI_STATUS LookupStatus)
Definition: uterror.c:227
void AcpiUtMethodError(const char *ModuleName, UINT32 LineNumber, const char *Message, ACPI_NAMESPACE_NODE *PrefixNode, const char *Path, ACPI_STATUS MethodStatus)
Definition: uterror.c:369
const char * AcpiFormatException(ACPI_STATUS Status)
Definition: utexcep.c:70