1 /*******************************************************************************
3 * Module Name: uterror - Various internal error/warning output functions
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2015, 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 #include <acpi/acpi.h>
48 #define _COMPONENT ACPI_UTILITIES
49 ACPI_MODULE_NAME("uterror")
52 * This module contains internal error functions that may
55 #if !defined (ACPI_NO_ERROR_MESSAGES)
56 /*******************************************************************************
58 * FUNCTION: acpi_ut_predefined_warning
60 * PARAMETERS: module_name - Caller's module name (for error output)
61 * line_number - Caller's line number (for error output)
62 * pathname - Full pathname to the node
63 * node_flags - From Namespace node for the method/object
64 * format - Printf format string + additional args
68 * DESCRIPTION: Warnings for the predefined validation module. Messages are
69 * only emitted the first time a problem with a particular
70 * method/object is detected. This prevents a flood of error
71 * messages for methods that are repeatedly evaluated.
73 ******************************************************************************/
74 void ACPI_INTERNAL_VAR_XFACE
75 acpi_ut_predefined_warning(const char *module_name
,
78 u8 node_flags
, const char *format
, ...)
83 * Warning messages for this method/object will be disabled after the
84 * first time a validation fails or an object is successfully repaired.
86 if (node_flags
& ANOBJ_EVALUATED
) {
90 acpi_os_printf(ACPI_MSG_WARNING
"%s: ", pathname
);
92 va_start(arg_list
, format
);
93 acpi_os_vprintf(format
, arg_list
);
98 /*******************************************************************************
100 * FUNCTION: acpi_ut_predefined_info
102 * PARAMETERS: module_name - Caller's module name (for error output)
103 * line_number - Caller's line number (for error output)
104 * pathname - Full pathname to the node
105 * node_flags - From Namespace node for the method/object
106 * format - Printf format string + additional args
110 * DESCRIPTION: Info messages for the predefined validation module. Messages
111 * are only emitted the first time a problem with a particular
112 * method/object is detected. This prevents a flood of
113 * messages for methods that are repeatedly evaluated.
115 ******************************************************************************/
117 void ACPI_INTERNAL_VAR_XFACE
118 acpi_ut_predefined_info(const char *module_name
,
120 char *pathname
, u8 node_flags
, const char *format
, ...)
125 * Warning messages for this method/object will be disabled after the
126 * first time a validation fails or an object is successfully repaired.
128 if (node_flags
& ANOBJ_EVALUATED
) {
132 acpi_os_printf(ACPI_MSG_INFO
"%s: ", pathname
);
134 va_start(arg_list
, format
);
135 acpi_os_vprintf(format
, arg_list
);
140 /*******************************************************************************
142 * FUNCTION: acpi_ut_predefined_bios_error
144 * PARAMETERS: module_name - Caller's module name (for error output)
145 * line_number - Caller's line number (for error output)
146 * pathname - Full pathname to the node
147 * node_flags - From Namespace node for the method/object
148 * format - Printf format string + additional args
152 * DESCRIPTION: BIOS error message for predefined names. Messages
153 * are only emitted the first time a problem with a particular
154 * method/object is detected. This prevents a flood of
155 * messages for methods that are repeatedly evaluated.
157 ******************************************************************************/
159 void ACPI_INTERNAL_VAR_XFACE
160 acpi_ut_predefined_bios_error(const char *module_name
,
163 u8 node_flags
, const char *format
, ...)
168 * Warning messages for this method/object will be disabled after the
169 * first time a validation fails or an object is successfully repaired.
171 if (node_flags
& ANOBJ_EVALUATED
) {
175 acpi_os_printf(ACPI_MSG_BIOS_ERROR
"%s: ", pathname
);
177 va_start(arg_list
, format
);
178 acpi_os_vprintf(format
, arg_list
);
183 /*******************************************************************************
185 * FUNCTION: acpi_ut_namespace_error
187 * PARAMETERS: module_name - Caller's module name (for error output)
188 * line_number - Caller's line number (for error output)
189 * internal_name - Name or path of the namespace node
190 * lookup_status - Exception code from NS lookup
194 * DESCRIPTION: Print error message with the full pathname for the NS node.
196 ******************************************************************************/
199 acpi_ut_namespace_error(const char *module_name
,
201 const char *internal_name
, acpi_status lookup_status
)
207 ACPI_MSG_REDIRECT_BEGIN
;
208 acpi_os_printf(ACPI_MSG_ERROR
);
210 if (lookup_status
== AE_BAD_CHARACTER
) {
212 /* There is a non-ascii character in the name */
214 ACPI_MOVE_32_TO_32(&bad_name
,
215 ACPI_CAST_PTR(u32
, internal_name
));
216 acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name
);
218 /* Convert path to external format */
220 status
= acpi_ns_externalize_name(ACPI_UINT32_MAX
,
221 internal_name
, NULL
, &name
);
223 /* Print target name */
225 if (ACPI_SUCCESS(status
)) {
226 acpi_os_printf("[%s]", name
);
228 acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
236 acpi_os_printf(" Namespace lookup failure, %s",
237 acpi_format_exception(lookup_status
));
240 ACPI_MSG_REDIRECT_END
;
243 /*******************************************************************************
245 * FUNCTION: acpi_ut_method_error
247 * PARAMETERS: module_name - Caller's module name (for error output)
248 * line_number - Caller's line number (for error output)
249 * message - Error message to use on failure
250 * prefix_node - Prefix relative to the path
251 * path - Path to the node (optional)
252 * method_status - Execution status
256 * DESCRIPTION: Print error message with the full pathname for the method.
258 ******************************************************************************/
261 acpi_ut_method_error(const char *module_name
,
264 struct acpi_namespace_node
*prefix_node
,
265 const char *path
, acpi_status method_status
)
268 struct acpi_namespace_node
*node
= prefix_node
;
270 ACPI_MSG_REDIRECT_BEGIN
;
271 acpi_os_printf(ACPI_MSG_ERROR
);
275 acpi_ns_get_node(prefix_node
, path
, ACPI_NS_NO_UPSEARCH
,
277 if (ACPI_FAILURE(status
)) {
278 acpi_os_printf("[Could not get node by pathname]");
282 acpi_ns_print_node_pathname(node
, message
);
283 acpi_os_printf(", %s", acpi_format_exception(method_status
));
286 ACPI_MSG_REDIRECT_END
;
289 #endif /* ACPI_NO_ERROR_MESSAGES */