Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenutxferror.c
Go to the documentation of this file.
00001 /******************************************************************************* 00002 * 00003 * Module Name: utxferror - Various error/warning output functions 00004 * 00005 ******************************************************************************/ 00006 00007 /****************************************************************************** 00008 * 00009 * 1. Copyright Notice 00010 * 00011 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. 00012 * All rights reserved. 00013 * 00014 * 2. License 00015 * 00016 * 2.1. This is your license from Intel Corp. under its intellectual property 00017 * rights. You may have additional license terms from the party that provided 00018 * you this software, covering your right to use that party's intellectual 00019 * property rights. 00020 * 00021 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 00022 * copy of the source code appearing in this file ("Covered Code") an 00023 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 00024 * base code distributed originally by Intel ("Original Intel Code") to copy, 00025 * make derivatives, distribute, use and display any portion of the Covered 00026 * Code in any form, with the right to sublicense such rights; and 00027 * 00028 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 00029 * license (with the right to sublicense), under only those claims of Intel 00030 * patents that are infringed by the Original Intel Code, to make, use, sell, 00031 * offer to sell, and import the Covered Code and derivative works thereof 00032 * solely to the minimum extent necessary to exercise the above copyright 00033 * license, and in no event shall the patent license extend to any additions 00034 * to or modifications of the Original Intel Code. No other license or right 00035 * is granted directly or by implication, estoppel or otherwise; 00036 * 00037 * The above copyright and patent license is granted only if the following 00038 * conditions are met: 00039 * 00040 * 3. Conditions 00041 * 00042 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 00043 * Redistribution of source code of any substantial portion of the Covered 00044 * Code or modification with rights to further distribute source must include 00045 * the above Copyright Notice, the above License, this list of Conditions, 00046 * and the following Disclaimer and Export Compliance provision. In addition, 00047 * Licensee must cause all Covered Code to which Licensee contributes to 00048 * contain a file documenting the changes Licensee made to create that Covered 00049 * Code and the date of any change. Licensee must include in that file the 00050 * documentation of any changes made by any predecessor Licensee. Licensee 00051 * must include a prominent statement that the modification is derived, 00052 * directly or indirectly, from Original Intel Code. 00053 * 00054 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 00055 * Redistribution of source code of any substantial portion of the Covered 00056 * Code or modification without rights to further distribute source must 00057 * include the following Disclaimer and Export Compliance provision in the 00058 * documentation and/or other materials provided with distribution. In 00059 * addition, Licensee may not authorize further sublicense of source of any 00060 * portion of the Covered Code, and must include terms to the effect that the 00061 * license from Licensee to its licensee is limited to the intellectual 00062 * property embodied in the software Licensee provides to its licensee, and 00063 * not to intellectual property embodied in modifications its licensee may 00064 * make. 00065 * 00066 * 3.3. Redistribution of Executable. Redistribution in executable form of any 00067 * substantial portion of the Covered Code or modification must reproduce the 00068 * above Copyright Notice, and the following Disclaimer and Export Compliance 00069 * provision in the documentation and/or other materials provided with the 00070 * distribution. 00071 * 00072 * 3.4. Intel retains all right, title, and interest in and to the Original 00073 * Intel Code. 00074 * 00075 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 00076 * Intel shall be used in advertising or otherwise to promote the sale, use or 00077 * other dealings in products derived from or relating to the Covered Code 00078 * without prior written authorization from Intel. 00079 * 00080 * 4. Disclaimer and Export Compliance 00081 * 00082 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 00083 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 00084 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 00085 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 00086 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 00087 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 00088 * PARTICULAR PURPOSE. 00089 * 00090 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 00091 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 00092 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 00093 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 00094 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 00095 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 00096 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 00097 * LIMITED REMEDY. 00098 * 00099 * 4.3. Licensee shall not export, either directly or indirectly, any of this 00100 * software or system incorporating such software without first obtaining any 00101 * required license or other approval from the U. S. Department of Commerce or 00102 * any other agency or department of the United States Government. In the 00103 * event Licensee exports any such software from the United States or 00104 * re-exports any such software from a foreign destination, Licensee shall 00105 * ensure that the distribution and export/re-export of the software is in 00106 * compliance with all laws, regulations, orders, or other restrictions of the 00107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 00108 * any of its subsidiaries will export/re-export any technical data, process, 00109 * software, or service, directly or indirectly, to any country for which the 00110 * United States government or any agency thereof requires an export license, 00111 * other governmental approval, or letter of assurance, without first obtaining 00112 * such license, approval or letter. 00113 * 00114 *****************************************************************************/ 00115 00116 #define __UTXFERROR_C__ 00117 00118 #include "acpi.h" 00119 #include "accommon.h" 00120 #include "acnamesp.h" 00121 00122 00123 #define _COMPONENT ACPI_UTILITIES 00124 ACPI_MODULE_NAME ("utxferror") 00125 00126 /* 00127 * This module is used for the in-kernel ACPICA as well as the ACPICA 00128 * tools/applications. 00129 * 00130 * For the iASL compiler case, the output is redirected to stderr so that 00131 * any of the various ACPI errors and warnings do not appear in the output 00132 * files, for either the compiler or disassembler portions of the tool. 00133 */ 00134 #ifdef ACPI_ASL_COMPILER 00135 #include <stdio.h> 00136 00137 extern FILE *AcpiGbl_OutputFile; 00138 00139 #define ACPI_MSG_REDIRECT_BEGIN \ 00140 FILE *OutputFile = AcpiGbl_OutputFile; \ 00141 AcpiOsRedirectOutput (stderr); 00142 00143 #define ACPI_MSG_REDIRECT_END \ 00144 AcpiOsRedirectOutput (OutputFile); 00145 00146 #else 00147 /* 00148 * non-iASL case - no redirection, nothing to do 00149 */ 00150 #define ACPI_MSG_REDIRECT_BEGIN 00151 #define ACPI_MSG_REDIRECT_END 00152 #endif 00153 00154 /* 00155 * Common message prefixes 00156 */ 00157 #define ACPI_MSG_ERROR "ACPI Error: " 00158 #define ACPI_MSG_EXCEPTION "ACPI Exception: " 00159 #define ACPI_MSG_WARNING "ACPI Warning: " 00160 #define ACPI_MSG_INFO "ACPI: " 00161 00162 /* 00163 * Common message suffix 00164 */ 00165 #define ACPI_MSG_SUFFIX \ 00166 AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber) 00167 00168 00169 /******************************************************************************* 00170 * 00171 * FUNCTION: AcpiError 00172 * 00173 * PARAMETERS: ModuleName - Caller's module name (for error output) 00174 * LineNumber - Caller's line number (for error output) 00175 * Format - Printf format string + additional args 00176 * 00177 * RETURN: None 00178 * 00179 * DESCRIPTION: Print "ACPI Error" message with module/line/version info 00180 * 00181 ******************************************************************************/ 00182 00183 void ACPI_INTERNAL_VAR_XFACE 00184 AcpiError ( 00185 const char *ModuleName, 00186 UINT32 LineNumber, 00187 const char *Format, 00188 ...) 00189 { 00190 va_list ArgList; 00191 00192 00193 ACPI_MSG_REDIRECT_BEGIN; 00194 AcpiOsPrintf (ACPI_MSG_ERROR); 00195 00196 va_start (ArgList, Format); 00197 AcpiOsVprintf (Format, ArgList); 00198 ACPI_MSG_SUFFIX; 00199 va_end (ArgList); 00200 00201 ACPI_MSG_REDIRECT_END; 00202 } 00203 00204 ACPI_EXPORT_SYMBOL (AcpiError) 00205 00206 00207 /******************************************************************************* 00208 * 00209 * FUNCTION: AcpiException 00210 * 00211 * PARAMETERS: ModuleName - Caller's module name (for error output) 00212 * LineNumber - Caller's line number (for error output) 00213 * Status - Status to be formatted 00214 * Format - Printf format string + additional args 00215 * 00216 * RETURN: None 00217 * 00218 * DESCRIPTION: Print "ACPI Exception" message with module/line/version info 00219 * and decoded ACPI_STATUS. 00220 * 00221 ******************************************************************************/ 00222 00223 void ACPI_INTERNAL_VAR_XFACE 00224 AcpiException ( 00225 const char *ModuleName, 00226 UINT32 LineNumber, 00227 ACPI_STATUS Status, 00228 const char *Format, 00229 ...) 00230 { 00231 va_list ArgList; 00232 00233 00234 ACPI_MSG_REDIRECT_BEGIN; 00235 AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status)); 00236 00237 va_start (ArgList, Format); 00238 AcpiOsVprintf (Format, ArgList); 00239 ACPI_MSG_SUFFIX; 00240 va_end (ArgList); 00241 00242 ACPI_MSG_REDIRECT_END; 00243 } 00244 00245 ACPI_EXPORT_SYMBOL (AcpiException) 00246 00247 00248 /******************************************************************************* 00249 * 00250 * FUNCTION: AcpiWarning 00251 * 00252 * PARAMETERS: ModuleName - Caller's module name (for error output) 00253 * LineNumber - Caller's line number (for error output) 00254 * Format - Printf format string + additional args 00255 * 00256 * RETURN: None 00257 * 00258 * DESCRIPTION: Print "ACPI Warning" message with module/line/version info 00259 * 00260 ******************************************************************************/ 00261 00262 void ACPI_INTERNAL_VAR_XFACE 00263 AcpiWarning ( 00264 const char *ModuleName, 00265 UINT32 LineNumber, 00266 const char *Format, 00267 ...) 00268 { 00269 va_list ArgList; 00270 00271 00272 ACPI_MSG_REDIRECT_BEGIN; 00273 AcpiOsPrintf (ACPI_MSG_WARNING); 00274 00275 va_start (ArgList, Format); 00276 AcpiOsVprintf (Format, ArgList); 00277 ACPI_MSG_SUFFIX; 00278 va_end (ArgList); 00279 00280 ACPI_MSG_REDIRECT_END; 00281 } 00282 00283 ACPI_EXPORT_SYMBOL (AcpiWarning) 00284 00285 00286 /******************************************************************************* 00287 * 00288 * FUNCTION: AcpiInfo 00289 * 00290 * PARAMETERS: ModuleName - Caller's module name (for error output) 00291 * LineNumber - Caller's line number (for error output) 00292 * Format - Printf format string + additional args 00293 * 00294 * RETURN: None 00295 * 00296 * DESCRIPTION: Print generic "ACPI:" information message. There is no 00297 * module/line/version info in order to keep the message simple. 00298 * 00299 * TBD: ModuleName and LineNumber args are not needed, should be removed. 00300 * 00301 ******************************************************************************/ 00302 00303 void ACPI_INTERNAL_VAR_XFACE 00304 AcpiInfo ( 00305 const char *ModuleName, 00306 UINT32 LineNumber, 00307 const char *Format, 00308 ...) 00309 { 00310 va_list ArgList; 00311 00312 00313 ACPI_MSG_REDIRECT_BEGIN; 00314 AcpiOsPrintf (ACPI_MSG_INFO); 00315 00316 va_start (ArgList, Format); 00317 AcpiOsVprintf (Format, ArgList); 00318 AcpiOsPrintf ("\n"); 00319 va_end (ArgList); 00320 00321 ACPI_MSG_REDIRECT_END; 00322 } 00323 00324 ACPI_EXPORT_SYMBOL (AcpiInfo) 00325 00326 00327 /* 00328 * The remainder of this module contains internal error functions that may 00329 * be configured out. 00330 */ 00331 #if !defined (ACPI_NO_ERROR_MESSAGES) && !defined (ACPI_BIN_APP) 00332 00333 /******************************************************************************* 00334 * 00335 * FUNCTION: AcpiUtPredefinedWarning 00336 * 00337 * PARAMETERS: ModuleName - Caller's module name (for error output) 00338 * LineNumber - Caller's line number (for error output) 00339 * Pathname - Full pathname to the node 00340 * NodeFlags - From Namespace node for the method/object 00341 * Format - Printf format string + additional args 00342 * 00343 * RETURN: None 00344 * 00345 * DESCRIPTION: Warnings for the predefined validation module. Messages are 00346 * only emitted the first time a problem with a particular 00347 * method/object is detected. This prevents a flood of error 00348 * messages for methods that are repeatedly evaluated. 00349 * 00350 ******************************************************************************/ 00351 00352 void ACPI_INTERNAL_VAR_XFACE 00353 AcpiUtPredefinedWarning ( 00354 const char *ModuleName, 00355 UINT32 LineNumber, 00356 char *Pathname, 00357 UINT8 NodeFlags, 00358 const char *Format, 00359 ...) 00360 { 00361 va_list ArgList; 00362 00363 00364 /* 00365 * Warning messages for this method/object will be disabled after the 00366 * first time a validation fails or an object is successfully repaired. 00367 */ 00368 if (NodeFlags & ANOBJ_EVALUATED) 00369 { 00370 return; 00371 } 00372 00373 AcpiOsPrintf (ACPI_MSG_WARNING "For %s: ", Pathname); 00374 00375 va_start (ArgList, Format); 00376 AcpiOsVprintf (Format, ArgList); 00377 ACPI_MSG_SUFFIX; 00378 va_end (ArgList); 00379 } 00380 00381 00382 /******************************************************************************* 00383 * 00384 * FUNCTION: AcpiUtPredefinedInfo 00385 * 00386 * PARAMETERS: ModuleName - Caller's module name (for error output) 00387 * LineNumber - Caller's line number (for error output) 00388 * Pathname - Full pathname to the node 00389 * NodeFlags - From Namespace node for the method/object 00390 * Format - Printf format string + additional args 00391 * 00392 * RETURN: None 00393 * 00394 * DESCRIPTION: Info messages for the predefined validation module. Messages 00395 * are only emitted the first time a problem with a particular 00396 * method/object is detected. This prevents a flood of 00397 * messages for methods that are repeatedly evaluated. 00398 * 00399 ******************************************************************************/ 00400 00401 void ACPI_INTERNAL_VAR_XFACE 00402 AcpiUtPredefinedInfo ( 00403 const char *ModuleName, 00404 UINT32 LineNumber, 00405 char *Pathname, 00406 UINT8 NodeFlags, 00407 const char *Format, 00408 ...) 00409 { 00410 va_list ArgList; 00411 00412 00413 /* 00414 * Warning messages for this method/object will be disabled after the 00415 * first time a validation fails or an object is successfully repaired. 00416 */ 00417 if (NodeFlags & ANOBJ_EVALUATED) 00418 { 00419 return; 00420 } 00421 00422 AcpiOsPrintf (ACPI_MSG_INFO "For %s: ", Pathname); 00423 00424 va_start (ArgList, Format); 00425 AcpiOsVprintf (Format, ArgList); 00426 ACPI_MSG_SUFFIX; 00427 va_end (ArgList); 00428 } 00429 00430 00431 /******************************************************************************* 00432 * 00433 * FUNCTION: AcpiUtNamespaceError 00434 * 00435 * PARAMETERS: ModuleName - Caller's module name (for error output) 00436 * LineNumber - Caller's line number (for error output) 00437 * InternalName - Name or path of the namespace node 00438 * LookupStatus - Exception code from NS lookup 00439 * 00440 * RETURN: None 00441 * 00442 * DESCRIPTION: Print error message with the full pathname for the NS node. 00443 * 00444 ******************************************************************************/ 00445 00446 void 00447 AcpiUtNamespaceError ( 00448 const char *ModuleName, 00449 UINT32 LineNumber, 00450 const char *InternalName, 00451 ACPI_STATUS LookupStatus) 00452 { 00453 ACPI_STATUS Status; 00454 UINT32 BadName; 00455 char *Name = NULL; 00456 00457 00458 ACPI_MSG_REDIRECT_BEGIN; 00459 AcpiOsPrintf (ACPI_MSG_ERROR); 00460 00461 if (LookupStatus == AE_BAD_CHARACTER) 00462 { 00463 /* There is a non-ascii character in the name */ 00464 00465 ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName)); 00466 AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)", BadName); 00467 } 00468 else 00469 { 00470 /* Convert path to external format */ 00471 00472 Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, 00473 InternalName, NULL, &Name); 00474 00475 /* Print target name */ 00476 00477 if (ACPI_SUCCESS (Status)) 00478 { 00479 AcpiOsPrintf ("[%s]", Name); 00480 } 00481 else 00482 { 00483 AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]"); 00484 } 00485 00486 if (Name) 00487 { 00488 ACPI_FREE (Name); 00489 } 00490 } 00491 00492 AcpiOsPrintf (" Namespace lookup failure, %s", 00493 AcpiFormatException (LookupStatus)); 00494 00495 ACPI_MSG_SUFFIX; 00496 ACPI_MSG_REDIRECT_END; 00497 } 00498 00499 00500 /******************************************************************************* 00501 * 00502 * FUNCTION: AcpiUtMethodError 00503 * 00504 * PARAMETERS: ModuleName - Caller's module name (for error output) 00505 * LineNumber - Caller's line number (for error output) 00506 * Message - Error message to use on failure 00507 * PrefixNode - Prefix relative to the path 00508 * Path - Path to the node (optional) 00509 * MethodStatus - Execution status 00510 * 00511 * RETURN: None 00512 * 00513 * DESCRIPTION: Print error message with the full pathname for the method. 00514 * 00515 ******************************************************************************/ 00516 00517 void 00518 AcpiUtMethodError ( 00519 const char *ModuleName, 00520 UINT32 LineNumber, 00521 const char *Message, 00522 ACPI_NAMESPACE_NODE *PrefixNode, 00523 const char *Path, 00524 ACPI_STATUS MethodStatus) 00525 { 00526 ACPI_STATUS Status; 00527 ACPI_NAMESPACE_NODE *Node = PrefixNode; 00528 00529 00530 ACPI_MSG_REDIRECT_BEGIN; 00531 AcpiOsPrintf (ACPI_MSG_ERROR); 00532 00533 if (Path) 00534 { 00535 Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH, 00536 &Node); 00537 if (ACPI_FAILURE (Status)) 00538 { 00539 AcpiOsPrintf ("[Could not get node by pathname]"); 00540 } 00541 } 00542 00543 AcpiNsPrintNodePathname (Node, Message); 00544 AcpiOsPrintf (", %s", AcpiFormatException (MethodStatus)); 00545 00546 ACPI_MSG_SUFFIX; 00547 ACPI_MSG_REDIRECT_END; 00548 } 00549 00550 #endif /* ACPI_NO_ERROR_MESSAGES */ Generated on Sun May 27 2012 04:27:24 for ReactOS by
1.7.6.1
|