1 /*******************************************************************************
3 * Module Name: uterror - Various internal error/warning output functions
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2017, 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.
49 #define _COMPONENT ACPI_UTILITIES
50 ACPI_MODULE_NAME ("uterror")
54 * This module contains internal error functions that may
57 #if !defined (ACPI_NO_ERROR_MESSAGES)
59 /*******************************************************************************
61 * FUNCTION: AcpiUtPredefinedWarning
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
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.
76 ******************************************************************************/
78 void ACPI_INTERNAL_VAR_XFACE
79 AcpiUtPredefinedWarning (
80 const char *ModuleName
,
91 * Warning messages for this method/object will be disabled after the
92 * first time a validation fails or an object is successfully repaired.
94 if (NodeFlags
& ANOBJ_EVALUATED
)
99 AcpiOsPrintf (ACPI_MSG_WARNING
"%s: ", Pathname
);
101 va_start (ArgList
, Format
);
102 AcpiOsVprintf (Format
, ArgList
);
108 /*******************************************************************************
110 * FUNCTION: AcpiUtPredefinedInfo
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
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.
125 ******************************************************************************/
127 void ACPI_INTERNAL_VAR_XFACE
128 AcpiUtPredefinedInfo (
129 const char *ModuleName
,
140 * Warning messages for this method/object will be disabled after the
141 * first time a validation fails or an object is successfully repaired.
143 if (NodeFlags
& ANOBJ_EVALUATED
)
148 AcpiOsPrintf (ACPI_MSG_INFO
"%s: ", Pathname
);
150 va_start (ArgList
, Format
);
151 AcpiOsVprintf (Format
, ArgList
);
157 /*******************************************************************************
159 * FUNCTION: AcpiUtPredefinedBiosError
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
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.
174 ******************************************************************************/
176 void ACPI_INTERNAL_VAR_XFACE
177 AcpiUtPredefinedBiosError (
178 const char *ModuleName
,
189 * Warning messages for this method/object will be disabled after the
190 * first time a validation fails or an object is successfully repaired.
192 if (NodeFlags
& ANOBJ_EVALUATED
)
197 AcpiOsPrintf (ACPI_MSG_BIOS_ERROR
"%s: ", Pathname
);
199 va_start (ArgList
, Format
);
200 AcpiOsVprintf (Format
, ArgList
);
206 /*******************************************************************************
208 * FUNCTION: AcpiUtPrefixedNamespaceError
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
218 * DESCRIPTION: Print error message with the full pathname constructed this way:
220 * PrefixScopeNodeFullPath.ExternalizedInternalPath
222 * NOTE: 10/2017: Treat the major NsLookup errors as firmware errors
224 ******************************************************************************/
227 AcpiUtPrefixedNamespaceError (
228 const char *ModuleName
,
230 ACPI_GENERIC_STATE
*PrefixScope
,
231 const char *InternalPath
,
232 ACPI_STATUS LookupStatus
)
240 * 1) Object creation, object must not already exist
241 * 2) Object lookup, object must exist
243 switch (LookupStatus
)
245 case AE_ALREADY_EXISTS
:
247 AcpiOsPrintf (ACPI_MSG_BIOS_ERROR
);
248 Message
= "Failure creating";
253 AcpiOsPrintf (ACPI_MSG_BIOS_ERROR
);
254 Message
= "Failure looking up";
259 AcpiOsPrintf (ACPI_MSG_ERROR
);
260 Message
= "Failure looking up";
264 /* Concatenate the prefix path and the internal path */
266 FullPath
= AcpiNsBuildPrefixedPathname (PrefixScope
, InternalPath
);
268 AcpiOsPrintf ("%s [%s], %s", Message
,
269 FullPath
? FullPath
: "Could not get pathname",
270 AcpiFormatException (LookupStatus
));
274 ACPI_FREE (FullPath
);
281 #ifdef __OBSOLETE_FUNCTION
282 /*******************************************************************************
284 * FUNCTION: AcpiUtNamespaceError
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
293 * DESCRIPTION: Print error message with the full pathname for the NS node.
295 ******************************************************************************/
298 AcpiUtNamespaceError (
299 const char *ModuleName
,
301 const char *InternalName
,
302 ACPI_STATUS LookupStatus
)
309 ACPI_MSG_REDIRECT_BEGIN
;
310 AcpiOsPrintf (ACPI_MSG_ERROR
);
312 if (LookupStatus
== AE_BAD_CHARACTER
)
314 /* There is a non-ascii character in the name */
316 ACPI_MOVE_32_TO_32 (&BadName
, ACPI_CAST_PTR (UINT32
, InternalName
));
317 AcpiOsPrintf ("[0x%.8X] (NON-ASCII)", BadName
);
321 /* Convert path to external format */
323 Status
= AcpiNsExternalizeName (
324 ACPI_UINT32_MAX
, InternalName
, NULL
, &Name
);
326 /* Print target name */
328 if (ACPI_SUCCESS (Status
))
330 AcpiOsPrintf ("[%s]", Name
);
334 AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]");
343 AcpiOsPrintf (" Namespace lookup failure, %s",
344 AcpiFormatException (LookupStatus
));
347 ACPI_MSG_REDIRECT_END
;
351 /*******************************************************************************
353 * FUNCTION: AcpiUtMethodError
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
364 * DESCRIPTION: Print error message with the full pathname for the method.
366 ******************************************************************************/
370 const char *ModuleName
,
373 ACPI_NAMESPACE_NODE
*PrefixNode
,
375 ACPI_STATUS MethodStatus
)
378 ACPI_NAMESPACE_NODE
*Node
= PrefixNode
;
381 ACPI_MSG_REDIRECT_BEGIN
;
382 AcpiOsPrintf (ACPI_MSG_ERROR
);
386 Status
= AcpiNsGetNode (PrefixNode
, Path
,
387 ACPI_NS_NO_UPSEARCH
, &Node
);
388 if (ACPI_FAILURE (Status
))
390 AcpiOsPrintf ("[Could not get node by pathname]");
394 AcpiNsPrintNodePathname (Node
, Message
);
395 AcpiOsPrintf (", %s", AcpiFormatException (MethodStatus
));
398 ACPI_MSG_REDIRECT_END
;
401 #endif /* ACPI_NO_ERROR_MESSAGES */