1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 /*******************************************************************************
4 * Module Name: uterror - Various internal error/warning output functions
6 ******************************************************************************/
12 #define _COMPONENT ACPI_UTILITIES
13 ACPI_MODULE_NAME("uterror")
16 * This module contains internal error functions that may
19 #if !defined (ACPI_NO_ERROR_MESSAGES)
20 /*******************************************************************************
22 * FUNCTION: acpi_ut_predefined_warning
24 * PARAMETERS: module_name - Caller's module name (for error output)
25 * line_number - Caller's line number (for error output)
26 * pathname - Full pathname to the node
27 * node_flags - From Namespace node for the method/object
28 * format - Printf format string + additional args
32 * DESCRIPTION: Warnings for the predefined validation module. Messages are
33 * only emitted the first time a problem with a particular
34 * method/object is detected. This prevents a flood of error
35 * messages for methods that are repeatedly evaluated.
37 ******************************************************************************/
38 void ACPI_INTERNAL_VAR_XFACE
39 acpi_ut_predefined_warning(const char *module_name
,
42 u16 node_flags
, const char *format
, ...)
47 * Warning messages for this method/object will be disabled after the
48 * first time a validation fails or an object is successfully repaired.
50 if (node_flags
& ANOBJ_EVALUATED
) {
54 acpi_os_printf(ACPI_MSG_WARNING
"%s: ", pathname
);
56 va_start(arg_list
, format
);
57 acpi_os_vprintf(format
, arg_list
);
62 /*******************************************************************************
64 * FUNCTION: acpi_ut_predefined_info
66 * PARAMETERS: module_name - Caller's module name (for error output)
67 * line_number - Caller's line number (for error output)
68 * pathname - Full pathname to the node
69 * node_flags - From Namespace node for the method/object
70 * format - Printf format string + additional args
74 * DESCRIPTION: Info messages for the predefined validation module. Messages
75 * are only emitted the first time a problem with a particular
76 * method/object is detected. This prevents a flood of
77 * messages for methods that are repeatedly evaluated.
79 ******************************************************************************/
81 void ACPI_INTERNAL_VAR_XFACE
82 acpi_ut_predefined_info(const char *module_name
,
84 char *pathname
, u16 node_flags
, const char *format
, ...)
89 * Warning messages for this method/object will be disabled after the
90 * first time a validation fails or an object is successfully repaired.
92 if (node_flags
& ANOBJ_EVALUATED
) {
96 acpi_os_printf(ACPI_MSG_INFO
"%s: ", pathname
);
98 va_start(arg_list
, format
);
99 acpi_os_vprintf(format
, arg_list
);
104 /*******************************************************************************
106 * FUNCTION: acpi_ut_predefined_bios_error
108 * PARAMETERS: module_name - Caller's module name (for error output)
109 * line_number - Caller's line number (for error output)
110 * pathname - Full pathname to the node
111 * node_flags - From Namespace node for the method/object
112 * format - Printf format string + additional args
116 * DESCRIPTION: BIOS error message for predefined names. Messages
117 * are only emitted the first time a problem with a particular
118 * method/object is detected. This prevents a flood of
119 * messages for methods that are repeatedly evaluated.
121 ******************************************************************************/
123 void ACPI_INTERNAL_VAR_XFACE
124 acpi_ut_predefined_bios_error(const char *module_name
,
127 u16 node_flags
, const char *format
, ...)
132 * Warning messages for this method/object will be disabled after the
133 * first time a validation fails or an object is successfully repaired.
135 if (node_flags
& ANOBJ_EVALUATED
) {
139 acpi_os_printf(ACPI_MSG_BIOS_ERROR
"%s: ", pathname
);
141 va_start(arg_list
, format
);
142 acpi_os_vprintf(format
, arg_list
);
147 /*******************************************************************************
149 * FUNCTION: acpi_ut_prefixed_namespace_error
151 * PARAMETERS: module_name - Caller's module name (for error output)
152 * line_number - Caller's line number (for error output)
153 * prefix_scope - Scope/Path that prefixes the internal path
154 * internal_path - Name or path of the namespace node
155 * lookup_status - Exception code from NS lookup
159 * DESCRIPTION: Print error message with the full pathname constructed this way:
161 * prefix_scope_node_full_path.externalized_internal_path
163 * NOTE: 10/2017: Treat the major ns_lookup errors as firmware errors
165 ******************************************************************************/
168 acpi_ut_prefixed_namespace_error(const char *module_name
,
170 union acpi_generic_state
*prefix_scope
,
171 const char *internal_path
,
172 acpi_status lookup_status
)
179 * 1) Object creation, object must not already exist
180 * 2) Object lookup, object must exist
182 switch (lookup_status
) {
183 case AE_ALREADY_EXISTS
:
185 acpi_os_printf(ACPI_MSG_BIOS_ERROR
);
186 message
= "Failure creating named object";
191 acpi_os_printf(ACPI_MSG_BIOS_ERROR
);
192 message
= "Could not resolve symbol";
197 acpi_os_printf(ACPI_MSG_ERROR
);
198 message
= "Failure resolving symbol";
202 /* Concatenate the prefix path and the internal path */
205 acpi_ns_build_prefixed_pathname(prefix_scope
, internal_path
);
207 acpi_os_printf("%s [%s], %s", message
,
208 full_path
? full_path
: "Could not get pathname",
209 acpi_format_exception(lookup_status
));
212 ACPI_FREE(full_path
);
218 #ifdef __OBSOLETE_FUNCTION
219 /*******************************************************************************
221 * FUNCTION: acpi_ut_namespace_error
223 * PARAMETERS: module_name - Caller's module name (for error output)
224 * line_number - Caller's line number (for error output)
225 * internal_name - Name or path of the namespace node
226 * lookup_status - Exception code from NS lookup
230 * DESCRIPTION: Print error message with the full pathname for the NS node.
232 ******************************************************************************/
235 acpi_ut_namespace_error(const char *module_name
,
237 const char *internal_name
, acpi_status lookup_status
)
243 ACPI_MSG_REDIRECT_BEGIN
;
244 acpi_os_printf(ACPI_MSG_ERROR
);
246 if (lookup_status
== AE_BAD_CHARACTER
) {
248 /* There is a non-ascii character in the name */
250 ACPI_MOVE_32_TO_32(&bad_name
,
251 ACPI_CAST_PTR(u32
, internal_name
));
252 acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name
);
254 /* Convert path to external format */
257 acpi_ns_externalize_name(ACPI_UINT32_MAX
, internal_name
,
260 /* Print target name */
262 if (ACPI_SUCCESS(status
)) {
263 acpi_os_printf("[%s]", name
);
265 acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
273 acpi_os_printf(" Namespace lookup failure, %s",
274 acpi_format_exception(lookup_status
));
277 ACPI_MSG_REDIRECT_END
;
281 /*******************************************************************************
283 * FUNCTION: acpi_ut_method_error
285 * PARAMETERS: module_name - Caller's module name (for error output)
286 * line_number - Caller's line number (for error output)
287 * message - Error message to use on failure
288 * prefix_node - Prefix relative to the path
289 * path - Path to the node (optional)
290 * method_status - Execution status
294 * DESCRIPTION: Print error message with the full pathname for the method.
296 ******************************************************************************/
299 acpi_ut_method_error(const char *module_name
,
302 struct acpi_namespace_node
*prefix_node
,
303 const char *path
, acpi_status method_status
)
306 struct acpi_namespace_node
*node
= prefix_node
;
308 ACPI_MSG_REDIRECT_BEGIN
;
309 acpi_os_printf(ACPI_MSG_ERROR
);
312 status
= acpi_ns_get_node(prefix_node
, path
,
313 ACPI_NS_NO_UPSEARCH
, &node
);
314 if (ACPI_FAILURE(status
)) {
315 acpi_os_printf("[Could not get node by pathname]");
319 acpi_ns_print_node_pathname(node
, message
);
320 acpi_os_printf(" due to previous error (%s)",
321 acpi_format_exception(method_status
));
324 ACPI_MSG_REDIRECT_END
;
327 #endif /* ACPI_NO_ERROR_MESSAGES */