![]() |
|
|||
0001 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 0002 /******************************************************************************* 0003 * 0004 * Module Name: uterror - Various internal error/warning output functions 0005 * 0006 ******************************************************************************/ 0007 0008 #include <acpi/acpi.h> 0009 #include "accommon.h" 0010 #include "acnamesp.h" 0011 0012 #define _COMPONENT ACPI_UTILITIES 0013 ACPI_MODULE_NAME("uterror") 0014 0015 /* 0016 * This module contains internal error functions that may 0017 * be configured out. 0018 */ 0019 #if !defined (ACPI_NO_ERROR_MESSAGES) 0020 /******************************************************************************* 0021 * 0022 * FUNCTION: acpi_ut_predefined_warning 0023 * 0024 * PARAMETERS: module_name - Caller's module name (for error output) 0025 * line_number - Caller's line number (for error output) 0026 * pathname - Full pathname to the node 0027 * node_flags - From Namespace node for the method/object 0028 * format - Printf format string + additional args 0029 * 0030 * RETURN: None 0031 * 0032 * DESCRIPTION: Warnings for the predefined validation module. Messages are 0033 * only emitted the first time a problem with a particular 0034 * method/object is detected. This prevents a flood of error 0035 * messages for methods that are repeatedly evaluated. 0036 * 0037 ******************************************************************************/ 0038 void ACPI_INTERNAL_VAR_XFACE 0039 acpi_ut_predefined_warning(const char *module_name, 0040 u32 line_number, 0041 char *pathname, 0042 u16 node_flags, const char *format, ...) 0043 { 0044 va_list arg_list; 0045 0046 /* 0047 * Warning messages for this method/object will be disabled after the 0048 * first time a validation fails or an object is successfully repaired. 0049 */ 0050 if (node_flags & ANOBJ_EVALUATED) { 0051 return; 0052 } 0053 0054 acpi_os_printf(ACPI_MSG_WARNING "%s: ", pathname); 0055 0056 va_start(arg_list, format); 0057 acpi_os_vprintf(format, arg_list); 0058 ACPI_MSG_SUFFIX; 0059 va_end(arg_list); 0060 } 0061 0062 /******************************************************************************* 0063 * 0064 * FUNCTION: acpi_ut_predefined_info 0065 * 0066 * PARAMETERS: module_name - Caller's module name (for error output) 0067 * line_number - Caller's line number (for error output) 0068 * pathname - Full pathname to the node 0069 * node_flags - From Namespace node for the method/object 0070 * format - Printf format string + additional args 0071 * 0072 * RETURN: None 0073 * 0074 * DESCRIPTION: Info messages for the predefined validation module. Messages 0075 * are only emitted the first time a problem with a particular 0076 * method/object is detected. This prevents a flood of 0077 * messages for methods that are repeatedly evaluated. 0078 * 0079 ******************************************************************************/ 0080 0081 void ACPI_INTERNAL_VAR_XFACE 0082 acpi_ut_predefined_info(const char *module_name, 0083 u32 line_number, 0084 char *pathname, u16 node_flags, const char *format, ...) 0085 { 0086 va_list arg_list; 0087 0088 /* 0089 * Warning messages for this method/object will be disabled after the 0090 * first time a validation fails or an object is successfully repaired. 0091 */ 0092 if (node_flags & ANOBJ_EVALUATED) { 0093 return; 0094 } 0095 0096 acpi_os_printf(ACPI_MSG_INFO "%s: ", pathname); 0097 0098 va_start(arg_list, format); 0099 acpi_os_vprintf(format, arg_list); 0100 ACPI_MSG_SUFFIX; 0101 va_end(arg_list); 0102 } 0103 0104 /******************************************************************************* 0105 * 0106 * FUNCTION: acpi_ut_predefined_bios_error 0107 * 0108 * PARAMETERS: module_name - Caller's module name (for error output) 0109 * line_number - Caller's line number (for error output) 0110 * pathname - Full pathname to the node 0111 * node_flags - From Namespace node for the method/object 0112 * format - Printf format string + additional args 0113 * 0114 * RETURN: None 0115 * 0116 * DESCRIPTION: BIOS error message for predefined names. Messages 0117 * are only emitted the first time a problem with a particular 0118 * method/object is detected. This prevents a flood of 0119 * messages for methods that are repeatedly evaluated. 0120 * 0121 ******************************************************************************/ 0122 0123 void ACPI_INTERNAL_VAR_XFACE 0124 acpi_ut_predefined_bios_error(const char *module_name, 0125 u32 line_number, 0126 char *pathname, 0127 u16 node_flags, const char *format, ...) 0128 { 0129 va_list arg_list; 0130 0131 /* 0132 * Warning messages for this method/object will be disabled after the 0133 * first time a validation fails or an object is successfully repaired. 0134 */ 0135 if (node_flags & ANOBJ_EVALUATED) { 0136 return; 0137 } 0138 0139 acpi_os_printf(ACPI_MSG_BIOS_ERROR "%s: ", pathname); 0140 0141 va_start(arg_list, format); 0142 acpi_os_vprintf(format, arg_list); 0143 ACPI_MSG_SUFFIX; 0144 va_end(arg_list); 0145 } 0146 0147 /******************************************************************************* 0148 * 0149 * FUNCTION: acpi_ut_prefixed_namespace_error 0150 * 0151 * PARAMETERS: module_name - Caller's module name (for error output) 0152 * line_number - Caller's line number (for error output) 0153 * prefix_scope - Scope/Path that prefixes the internal path 0154 * internal_path - Name or path of the namespace node 0155 * lookup_status - Exception code from NS lookup 0156 * 0157 * RETURN: None 0158 * 0159 * DESCRIPTION: Print error message with the full pathname constructed this way: 0160 * 0161 * prefix_scope_node_full_path.externalized_internal_path 0162 * 0163 * NOTE: 10/2017: Treat the major ns_lookup errors as firmware errors 0164 * 0165 ******************************************************************************/ 0166 0167 void 0168 acpi_ut_prefixed_namespace_error(const char *module_name, 0169 u32 line_number, 0170 union acpi_generic_state *prefix_scope, 0171 const char *internal_path, 0172 acpi_status lookup_status) 0173 { 0174 char *full_path; 0175 const char *message; 0176 0177 /* 0178 * Main cases: 0179 * 1) Object creation, object must not already exist 0180 * 2) Object lookup, object must exist 0181 */ 0182 switch (lookup_status) { 0183 case AE_ALREADY_EXISTS: 0184 0185 acpi_os_printf(ACPI_MSG_BIOS_ERROR); 0186 message = "Failure creating named object"; 0187 break; 0188 0189 case AE_NOT_FOUND: 0190 0191 acpi_os_printf(ACPI_MSG_BIOS_ERROR); 0192 message = "Could not resolve symbol"; 0193 break; 0194 0195 default: 0196 0197 acpi_os_printf(ACPI_MSG_ERROR); 0198 message = "Failure resolving symbol"; 0199 break; 0200 } 0201 0202 /* Concatenate the prefix path and the internal path */ 0203 0204 full_path = 0205 acpi_ns_build_prefixed_pathname(prefix_scope, internal_path); 0206 0207 acpi_os_printf("%s [%s], %s", message, 0208 full_path ? full_path : "Could not get pathname", 0209 acpi_format_exception(lookup_status)); 0210 0211 if (full_path) { 0212 ACPI_FREE(full_path); 0213 } 0214 0215 ACPI_MSG_SUFFIX; 0216 } 0217 0218 #ifdef __OBSOLETE_FUNCTION 0219 /******************************************************************************* 0220 * 0221 * FUNCTION: acpi_ut_namespace_error 0222 * 0223 * PARAMETERS: module_name - Caller's module name (for error output) 0224 * line_number - Caller's line number (for error output) 0225 * internal_name - Name or path of the namespace node 0226 * lookup_status - Exception code from NS lookup 0227 * 0228 * RETURN: None 0229 * 0230 * DESCRIPTION: Print error message with the full pathname for the NS node. 0231 * 0232 ******************************************************************************/ 0233 0234 void 0235 acpi_ut_namespace_error(const char *module_name, 0236 u32 line_number, 0237 const char *internal_name, acpi_status lookup_status) 0238 { 0239 acpi_status status; 0240 u32 bad_name; 0241 char *name = NULL; 0242 0243 ACPI_MSG_REDIRECT_BEGIN; 0244 acpi_os_printf(ACPI_MSG_ERROR); 0245 0246 if (lookup_status == AE_BAD_CHARACTER) { 0247 0248 /* There is a non-ascii character in the name */ 0249 0250 ACPI_MOVE_32_TO_32(&bad_name, 0251 ACPI_CAST_PTR(u32, internal_name)); 0252 acpi_os_printf("[0x%.8X] (NON-ASCII)", bad_name); 0253 } else { 0254 /* Convert path to external format */ 0255 0256 status = 0257 acpi_ns_externalize_name(ACPI_UINT32_MAX, internal_name, 0258 NULL, &name); 0259 0260 /* Print target name */ 0261 0262 if (ACPI_SUCCESS(status)) { 0263 acpi_os_printf("[%s]", name); 0264 } else { 0265 acpi_os_printf("[COULD NOT EXTERNALIZE NAME]"); 0266 } 0267 0268 if (name) { 0269 ACPI_FREE(name); 0270 } 0271 } 0272 0273 acpi_os_printf(" Namespace lookup failure, %s", 0274 acpi_format_exception(lookup_status)); 0275 0276 ACPI_MSG_SUFFIX; 0277 ACPI_MSG_REDIRECT_END; 0278 } 0279 #endif 0280 0281 /******************************************************************************* 0282 * 0283 * FUNCTION: acpi_ut_method_error 0284 * 0285 * PARAMETERS: module_name - Caller's module name (for error output) 0286 * line_number - Caller's line number (for error output) 0287 * message - Error message to use on failure 0288 * prefix_node - Prefix relative to the path 0289 * path - Path to the node (optional) 0290 * method_status - Execution status 0291 * 0292 * RETURN: None 0293 * 0294 * DESCRIPTION: Print error message with the full pathname for the method. 0295 * 0296 ******************************************************************************/ 0297 0298 void 0299 acpi_ut_method_error(const char *module_name, 0300 u32 line_number, 0301 const char *message, 0302 struct acpi_namespace_node *prefix_node, 0303 const char *path, acpi_status method_status) 0304 { 0305 acpi_status status; 0306 struct acpi_namespace_node *node = prefix_node; 0307 0308 ACPI_MSG_REDIRECT_BEGIN; 0309 acpi_os_printf(ACPI_MSG_ERROR); 0310 0311 if (path) { 0312 status = acpi_ns_get_node(prefix_node, path, 0313 ACPI_NS_NO_UPSEARCH, &node); 0314 if (ACPI_FAILURE(status)) { 0315 acpi_os_printf("[Could not get node by pathname]"); 0316 } 0317 } 0318 0319 acpi_ns_print_node_pathname(node, message); 0320 acpi_os_printf(" due to previous error (%s)", 0321 acpi_format_exception(method_status)); 0322 0323 ACPI_MSG_SUFFIX; 0324 ACPI_MSG_REDIRECT_END; 0325 } 0326 0327 #endif /* ACPI_NO_ERROR_MESSAGES */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |