aslerror.c revision 167802
1118611Snjl 2118611Snjl/****************************************************************************** 3118611Snjl * 4118611Snjl * Module Name: aslerror - Error handling and statistics 5167802Sjkim * $Revision: 1.92 $ 6118611Snjl * 7118611Snjl *****************************************************************************/ 8118611Snjl 9118611Snjl/****************************************************************************** 10118611Snjl * 11118611Snjl * 1. Copyright Notice 12118611Snjl * 13167802Sjkim * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. 14118611Snjl * All rights reserved. 15118611Snjl * 16118611Snjl * 2. License 17118611Snjl * 18118611Snjl * 2.1. This is your license from Intel Corp. under its intellectual property 19118611Snjl * rights. You may have additional license terms from the party that provided 20118611Snjl * you this software, covering your right to use that party's intellectual 21118611Snjl * property rights. 22118611Snjl * 23118611Snjl * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 24118611Snjl * copy of the source code appearing in this file ("Covered Code") an 25118611Snjl * irrevocable, perpetual, worldwide license under Intel's copyrights in the 26118611Snjl * base code distributed originally by Intel ("Original Intel Code") to copy, 27118611Snjl * make derivatives, distribute, use and display any portion of the Covered 28118611Snjl * Code in any form, with the right to sublicense such rights; and 29118611Snjl * 30118611Snjl * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 31118611Snjl * license (with the right to sublicense), under only those claims of Intel 32118611Snjl * patents that are infringed by the Original Intel Code, to make, use, sell, 33118611Snjl * offer to sell, and import the Covered Code and derivative works thereof 34118611Snjl * solely to the minimum extent necessary to exercise the above copyright 35118611Snjl * license, and in no event shall the patent license extend to any additions 36118611Snjl * to or modifications of the Original Intel Code. No other license or right 37118611Snjl * is granted directly or by implication, estoppel or otherwise; 38118611Snjl * 39118611Snjl * The above copyright and patent license is granted only if the following 40118611Snjl * conditions are met: 41118611Snjl * 42118611Snjl * 3. Conditions 43118611Snjl * 44118611Snjl * 3.1. Redistribution of Source with Rights to Further Distribute Source. 45118611Snjl * Redistribution of source code of any substantial portion of the Covered 46118611Snjl * Code or modification with rights to further distribute source must include 47118611Snjl * the above Copyright Notice, the above License, this list of Conditions, 48118611Snjl * and the following Disclaimer and Export Compliance provision. In addition, 49118611Snjl * Licensee must cause all Covered Code to which Licensee contributes to 50118611Snjl * contain a file documenting the changes Licensee made to create that Covered 51118611Snjl * Code and the date of any change. Licensee must include in that file the 52118611Snjl * documentation of any changes made by any predecessor Licensee. Licensee 53118611Snjl * must include a prominent statement that the modification is derived, 54118611Snjl * directly or indirectly, from Original Intel Code. 55118611Snjl * 56118611Snjl * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 57118611Snjl * Redistribution of source code of any substantial portion of the Covered 58118611Snjl * Code or modification without rights to further distribute source must 59118611Snjl * include the following Disclaimer and Export Compliance provision in the 60118611Snjl * documentation and/or other materials provided with distribution. In 61118611Snjl * addition, Licensee may not authorize further sublicense of source of any 62118611Snjl * portion of the Covered Code, and must include terms to the effect that the 63118611Snjl * license from Licensee to its licensee is limited to the intellectual 64118611Snjl * property embodied in the software Licensee provides to its licensee, and 65118611Snjl * not to intellectual property embodied in modifications its licensee may 66118611Snjl * make. 67118611Snjl * 68118611Snjl * 3.3. Redistribution of Executable. Redistribution in executable form of any 69118611Snjl * substantial portion of the Covered Code or modification must reproduce the 70118611Snjl * above Copyright Notice, and the following Disclaimer and Export Compliance 71118611Snjl * provision in the documentation and/or other materials provided with the 72118611Snjl * distribution. 73118611Snjl * 74118611Snjl * 3.4. Intel retains all right, title, and interest in and to the Original 75118611Snjl * Intel Code. 76118611Snjl * 77118611Snjl * 3.5. Neither the name Intel nor any other trademark owned or controlled by 78118611Snjl * Intel shall be used in advertising or otherwise to promote the sale, use or 79118611Snjl * other dealings in products derived from or relating to the Covered Code 80118611Snjl * without prior written authorization from Intel. 81118611Snjl * 82118611Snjl * 4. Disclaimer and Export Compliance 83118611Snjl * 84118611Snjl * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 85118611Snjl * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 86118611Snjl * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 87118611Snjl * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 88118611Snjl * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 89118611Snjl * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 90118611Snjl * PARTICULAR PURPOSE. 91118611Snjl * 92118611Snjl * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 93118611Snjl * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 94118611Snjl * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 95118611Snjl * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 96118611Snjl * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 97118611Snjl * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 98118611Snjl * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 99118611Snjl * LIMITED REMEDY. 100118611Snjl * 101118611Snjl * 4.3. Licensee shall not export, either directly or indirectly, any of this 102118611Snjl * software or system incorporating such software without first obtaining any 103118611Snjl * required license or other approval from the U. S. Department of Commerce or 104118611Snjl * any other agency or department of the United States Government. In the 105118611Snjl * event Licensee exports any such software from the United States or 106118611Snjl * re-exports any such software from a foreign destination, Licensee shall 107118611Snjl * ensure that the distribution and export/re-export of the software is in 108118611Snjl * compliance with all laws, regulations, orders, or other restrictions of the 109118611Snjl * U.S. Export Administration Regulations. Licensee agrees that neither it nor 110118611Snjl * any of its subsidiaries will export/re-export any technical data, process, 111118611Snjl * software, or service, directly or indirectly, to any country for which the 112118611Snjl * United States government or any agency thereof requires an export license, 113118611Snjl * other governmental approval, or letter of assurance, without first obtaining 114118611Snjl * such license, approval or letter. 115118611Snjl * 116118611Snjl *****************************************************************************/ 117118611Snjl 118118611Snjl#define ASL_EXCEPTIONS 119151937Sjkim#include <contrib/dev/acpica/compiler/aslcompiler.h> 120118611Snjl 121118611Snjl#define _COMPONENT ACPI_COMPILER 122118611Snjl ACPI_MODULE_NAME ("aslerror") 123118611Snjl 124151937Sjkim/* Local prototypes */ 125118611Snjl 126151937Sjkimstatic void 127151937SjkimAeAddToErrorLog ( 128151937Sjkim ASL_ERROR_MSG *Enode); 129151937Sjkim 130151937Sjkim 131118611Snjl/******************************************************************************* 132118611Snjl * 133118611Snjl * FUNCTION: AeAddToErrorLog 134118611Snjl * 135118611Snjl * PARAMETERS: Enode - An error node to add to the log 136118611Snjl * 137118611Snjl * RETURN: None 138118611Snjl * 139118611Snjl * DESCRIPTION: Add a new error node to the error log. The error log is 140118611Snjl * ordered by the "logical" line number (cumulative line number 141118611Snjl * including all include files.) 142118611Snjl * 143118611Snjl ******************************************************************************/ 144118611Snjl 145151937Sjkimstatic void 146118611SnjlAeAddToErrorLog ( 147118611Snjl ASL_ERROR_MSG *Enode) 148118611Snjl{ 149118611Snjl ASL_ERROR_MSG *Next; 150118611Snjl ASL_ERROR_MSG *Prev; 151118611Snjl 152118611Snjl 153118611Snjl if (!Gbl_ErrorLog) 154118611Snjl { 155118611Snjl Gbl_ErrorLog = Enode; 156118611Snjl return; 157118611Snjl } 158118611Snjl 159118611Snjl /* List is sorted according to line number */ 160118611Snjl 161118611Snjl if (!Gbl_ErrorLog) 162118611Snjl { 163118611Snjl Gbl_ErrorLog = Enode; 164118611Snjl return; 165118611Snjl } 166118611Snjl 167118611Snjl /* Walk error list until we find a line number greater than ours */ 168118611Snjl 169118611Snjl Prev = NULL; 170118611Snjl Next = Gbl_ErrorLog; 171118611Snjl 172118611Snjl while ((Next) && 173118611Snjl (Next->LogicalLineNumber <= Enode->LogicalLineNumber)) 174118611Snjl { 175118611Snjl Prev = Next; 176118611Snjl Next = Next->Next; 177118611Snjl } 178118611Snjl 179118611Snjl /* Found our place in the list */ 180118611Snjl 181118611Snjl Enode->Next = Next; 182118611Snjl 183118611Snjl if (Prev) 184118611Snjl { 185118611Snjl Prev->Next = Enode; 186118611Snjl } 187118611Snjl else 188118611Snjl { 189118611Snjl Gbl_ErrorLog = Enode; 190118611Snjl } 191118611Snjl} 192118611Snjl 193118611Snjl 194118611Snjl/******************************************************************************* 195118611Snjl * 196118611Snjl * FUNCTION: AePrintException 197118611Snjl * 198151937Sjkim * PARAMETERS: FileId - ID of output file 199118611Snjl * Enode - Error node to print 200118611Snjl * Header - Additional text before each message 201118611Snjl * 202118611Snjl * RETURN: None 203118611Snjl * 204118611Snjl * DESCRIPTION: Print the contents of an error node. 205118611Snjl * 206118611Snjl * NOTE: We don't use the FlxxxFile I/O functions here because on error 207118611Snjl * they abort the compiler and call this function! Since we 208118611Snjl * are reporting errors here, we ignore most output errors and 209118611Snjl * just try to get out as much as we can. 210118611Snjl * 211118611Snjl ******************************************************************************/ 212118611Snjl 213118611Snjlvoid 214118611SnjlAePrintException ( 215118611Snjl UINT32 FileId, 216118611Snjl ASL_ERROR_MSG *Enode, 217118611Snjl char *Header) 218118611Snjl{ 219118611Snjl UINT8 SourceByte; 220151937Sjkim int Actual; 221151937Sjkim size_t RActual; 222118611Snjl UINT32 MsgLength; 223118611Snjl char *MainMessage; 224118611Snjl char *ExtraMessage; 225118611Snjl UINT32 SourceColumn; 226118611Snjl UINT32 ErrorColumn; 227118611Snjl FILE *OutputFile; 228118611Snjl FILE *SourceFile; 229118611Snjl 230118611Snjl 231151937Sjkim /* 232151937Sjkim * Only listing files have a header, and remarks/optimizations 233151937Sjkim * are always output 234151937Sjkim */ 235118611Snjl if (!Header) 236118611Snjl { 237118611Snjl /* Ignore remarks if requested */ 238118611Snjl 239118611Snjl switch (Enode->Level) 240118611Snjl { 241118611Snjl case ASL_REMARK: 242118611Snjl if (!Gbl_DisplayRemarks) 243118611Snjl { 244118611Snjl return; 245118611Snjl } 246118611Snjl break; 247118611Snjl 248118611Snjl case ASL_OPTIMIZATION: 249118611Snjl if (!Gbl_DisplayOptimizations) 250118611Snjl { 251118611Snjl return; 252118611Snjl } 253118611Snjl break; 254118611Snjl 255118611Snjl default: 256118611Snjl break; 257118611Snjl } 258118611Snjl } 259118611Snjl 260118611Snjl /* Get the file handles */ 261118611Snjl 262118611Snjl OutputFile = Gbl_Files[FileId].Handle; 263118611Snjl SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; 264118611Snjl 265118611Snjl if (Header) 266118611Snjl { 267118611Snjl fprintf (OutputFile, "%s", Header); 268118611Snjl } 269118611Snjl 270118611Snjl /* Print filename and line number if present and valid */ 271118611Snjl 272118611Snjl if (Enode->Filename) 273118611Snjl { 274118611Snjl if (Gbl_VerboseErrors) 275118611Snjl { 276118611Snjl fprintf (OutputFile, "%6s", Enode->Filename); 277118611Snjl 278118611Snjl if (Enode->LineNumber) 279118611Snjl { 280118611Snjl fprintf (OutputFile, "%6u: ", Enode->LineNumber); 281118611Snjl 282118611Snjl /* 283118611Snjl * Seek to the offset in the combined source file, read the source 284118611Snjl * line, and write it to the output. 285118611Snjl */ 286151937Sjkim Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, 287151937Sjkim (int) SEEK_SET); 288118611Snjl if (Actual) 289118611Snjl { 290151937Sjkim fprintf (OutputFile, 291151937Sjkim "[*** iASL: Seek error on source code temp file ***]"); 292118611Snjl } 293118611Snjl else 294118611Snjl { 295151937Sjkim RActual = fread (&SourceByte, 1, 1, SourceFile); 296151937Sjkim if (!RActual) 297118611Snjl { 298151937Sjkim fprintf (OutputFile, 299151937Sjkim "[*** iASL: Read error on source code temp file ***]"); 300118611Snjl } 301118611Snjl 302151937Sjkim else while (RActual && SourceByte && (SourceByte != '\n')) 303118611Snjl { 304118611Snjl fwrite (&SourceByte, 1, 1, OutputFile); 305151937Sjkim RActual = fread (&SourceByte, 1, 1, SourceFile); 306118611Snjl } 307118611Snjl } 308118611Snjl fprintf (OutputFile, "\n"); 309118611Snjl } 310118611Snjl } 311118611Snjl else 312118611Snjl { 313118611Snjl fprintf (OutputFile, "%s", Enode->Filename); 314118611Snjl 315118611Snjl if (Enode->LineNumber) 316118611Snjl { 317118611Snjl fprintf (OutputFile, "(%u) : ", Enode->LineNumber); 318118611Snjl } 319118611Snjl } 320118611Snjl } 321118611Snjl 322118611Snjl /* NULL message ID, just print the raw message */ 323118611Snjl 324118611Snjl if (Enode->MessageId == 0) 325118611Snjl { 326118611Snjl fprintf (OutputFile, "%s\n", Enode->Message); 327118611Snjl } 328118611Snjl else 329118611Snjl { 330118611Snjl /* Decode the message ID */ 331118611Snjl 332118611Snjl fprintf (OutputFile, "%s %4.4d -", 333118611Snjl AslErrorLevel[Enode->Level], 334118611Snjl Enode->MessageId + ((Enode->Level+1) * 1000)); 335118611Snjl 336118611Snjl MainMessage = AslMessages[Enode->MessageId]; 337118611Snjl ExtraMessage = Enode->Message; 338118611Snjl 339118611Snjl if (Enode->LineNumber) 340118611Snjl { 341118611Snjl MsgLength = strlen (MainMessage); 342118611Snjl if (MsgLength == 0) 343118611Snjl { 344118611Snjl MainMessage = Enode->Message; 345118611Snjl 346118611Snjl MsgLength = strlen (MainMessage); 347118611Snjl ExtraMessage = NULL; 348118611Snjl } 349118611Snjl 350118611Snjl if (Gbl_VerboseErrors) 351118611Snjl { 352118611Snjl SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2; 353118611Snjl ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1; 354118611Snjl 355118611Snjl if ((MsgLength + ErrorColumn) < (SourceColumn - 1)) 356118611Snjl { 357118611Snjl fprintf (OutputFile, "%*s%s", 358118611Snjl (int) ((SourceColumn - 1) - ErrorColumn), 359118611Snjl MainMessage, " ^ "); 360118611Snjl } 361118611Snjl else 362118611Snjl { 363118611Snjl fprintf (OutputFile, "%*s %s", 364118611Snjl (int) ((SourceColumn - ErrorColumn) + 1), "^", 365118611Snjl MainMessage); 366118611Snjl } 367118611Snjl } 368118611Snjl else 369118611Snjl { 370118611Snjl fprintf (OutputFile, " %s", MainMessage); 371118611Snjl } 372118611Snjl 373118611Snjl /* Print the extra info message if present */ 374118611Snjl 375118611Snjl if (ExtraMessage) 376118611Snjl { 377118611Snjl fprintf (OutputFile, " (%s)", ExtraMessage); 378118611Snjl } 379118611Snjl 380118611Snjl fprintf (OutputFile, "\n"); 381118611Snjl if (Gbl_VerboseErrors) 382118611Snjl { 383118611Snjl fprintf (OutputFile, "\n"); 384118611Snjl } 385118611Snjl } 386118611Snjl else 387118611Snjl { 388151937Sjkim fprintf (OutputFile, " %s %s\n\n", MainMessage, ExtraMessage); 389118611Snjl } 390118611Snjl } 391118611Snjl} 392118611Snjl 393118611Snjl 394118611Snjl/******************************************************************************* 395118611Snjl * 396118611Snjl * FUNCTION: AePrintErrorLog 397118611Snjl * 398118611Snjl * PARAMETERS: FileId - Where to output the error log 399118611Snjl * 400118611Snjl * RETURN: None 401118611Snjl * 402118611Snjl * DESCRIPTION: Print the entire contents of the error log 403118611Snjl * 404118611Snjl ******************************************************************************/ 405118611Snjl 406118611Snjlvoid 407118611SnjlAePrintErrorLog ( 408118611Snjl UINT32 FileId) 409118611Snjl{ 410118611Snjl ASL_ERROR_MSG *Enode = Gbl_ErrorLog; 411118611Snjl 412118611Snjl 413118611Snjl /* Walk the error node list */ 414118611Snjl 415118611Snjl while (Enode) 416118611Snjl { 417118611Snjl AePrintException (FileId, Enode, NULL); 418118611Snjl Enode = Enode->Next; 419118611Snjl } 420118611Snjl} 421118611Snjl 422118611Snjl 423118611Snjl/******************************************************************************* 424118611Snjl * 425118611Snjl * FUNCTION: AslCommonError 426118611Snjl * 427118611Snjl * PARAMETERS: Level - Seriousness (Warning/error, etc.) 428118611Snjl * MessageId - Index into global message buffer 429118611Snjl * CurrentLineNumber - Actual file line number 430118611Snjl * LogicalLineNumber - Cumulative line number 431118611Snjl * LogicalByteOffset - Byte offset in source file 432118611Snjl * Column - Column in current line 433118611Snjl * Filename - source filename 434118611Snjl * ExtraMessage - additional error message 435118611Snjl * 436151937Sjkim * RETURN: None 437118611Snjl * 438118611Snjl * DESCRIPTION: Create a new error node and add it to the error log 439118611Snjl * 440118611Snjl ******************************************************************************/ 441118611Snjl 442118611Snjlvoid 443118611SnjlAslCommonError ( 444118611Snjl UINT8 Level, 445118611Snjl UINT8 MessageId, 446118611Snjl UINT32 CurrentLineNumber, 447118611Snjl UINT32 LogicalLineNumber, 448118611Snjl UINT32 LogicalByteOffset, 449118611Snjl UINT32 Column, 450118611Snjl char *Filename, 451118611Snjl char *ExtraMessage) 452118611Snjl{ 453118611Snjl UINT32 MessageSize; 454118611Snjl char *MessageBuffer = NULL; 455118611Snjl ASL_ERROR_MSG *Enode; 456118611Snjl 457118611Snjl 458118611Snjl Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); 459118611Snjl 460118611Snjl if (ExtraMessage) 461118611Snjl { 462118611Snjl /* Allocate a buffer for the message and a new error node */ 463118611Snjl 464118611Snjl MessageSize = strlen (ExtraMessage) + 1; 465118611Snjl MessageBuffer = UtLocalCalloc (MessageSize); 466118611Snjl 467118611Snjl /* Keep a copy of the extra message */ 468118611Snjl 469118611Snjl ACPI_STRCPY (MessageBuffer, ExtraMessage); 470118611Snjl } 471118611Snjl 472118611Snjl /* Initialize the error node */ 473118611Snjl 474118611Snjl if (Filename) 475118611Snjl { 476118611Snjl Enode->Filename = Filename; 477118611Snjl Enode->FilenameLength = strlen (Filename); 478118611Snjl if (Enode->FilenameLength < 6) 479118611Snjl { 480118611Snjl Enode->FilenameLength = 6; 481118611Snjl } 482118611Snjl } 483118611Snjl 484118611Snjl Enode->MessageId = MessageId; 485118611Snjl Enode->Level = Level; 486118611Snjl Enode->LineNumber = CurrentLineNumber; 487118611Snjl Enode->LogicalLineNumber = LogicalLineNumber; 488118611Snjl Enode->LogicalByteOffset = LogicalByteOffset; 489118611Snjl Enode->Column = Column; 490118611Snjl Enode->Message = MessageBuffer; 491118611Snjl 492118611Snjl /* Add the new node to the error node list */ 493118611Snjl 494118611Snjl AeAddToErrorLog (Enode); 495118611Snjl 496118611Snjl if (Gbl_DebugFlag) 497118611Snjl { 498118611Snjl /* stderr is a file, send error to it immediately */ 499118611Snjl 500118611Snjl AePrintException (ASL_FILE_STDERR, Enode, NULL); 501118611Snjl } 502118611Snjl 503118611Snjl Gbl_ExceptionCount[Level]++; 504118611Snjl if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) 505118611Snjl { 506167802Sjkim printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT); 507118611Snjl 508118611Snjl Gbl_SourceLine = 0; 509118611Snjl Gbl_NextError = Gbl_ErrorLog; 510118611Snjl CmDoOutputFiles (); 511118611Snjl CmCleanupAndExit (); 512118611Snjl } 513118611Snjl 514118611Snjl return; 515118611Snjl} 516118611Snjl 517118611Snjl 518118611Snjl/******************************************************************************* 519118611Snjl * 520118611Snjl * FUNCTION: AslError 521118611Snjl * 522118611Snjl * PARAMETERS: Level - Seriousness (Warning/error, etc.) 523118611Snjl * MessageId - Index into global message buffer 524118611Snjl * Op - Parse node where error happened 525118611Snjl * ExtraMessage - additional error message 526118611Snjl * 527118611Snjl * RETURN: None 528118611Snjl * 529118611Snjl * DESCRIPTION: Main error reporting routine for the ASL compiler (all code 530118611Snjl * except the parser.) 531118611Snjl * 532118611Snjl ******************************************************************************/ 533118611Snjl 534118611Snjlvoid 535118611SnjlAslError ( 536118611Snjl UINT8 Level, 537118611Snjl UINT8 MessageId, 538118611Snjl ACPI_PARSE_OBJECT *Op, 539118611Snjl char *ExtraMessage) 540118611Snjl{ 541118611Snjl 542167802Sjkim switch (Level) 543167802Sjkim { 544167802Sjkim case ASL_WARNING2: 545167802Sjkim case ASL_WARNING3: 546167802Sjkim if (Gbl_WarningLevel < Level) 547167802Sjkim { 548167802Sjkim return; 549167802Sjkim } 550167802Sjkim break; 551167802Sjkim 552167802Sjkim default: 553167802Sjkim break; 554167802Sjkim } 555167802Sjkim 556167802Sjkim 557118611Snjl if (Op) 558118611Snjl { 559118611Snjl AslCommonError (Level, MessageId, Op->Asl.LineNumber, 560118611Snjl Op->Asl.LogicalLineNumber, 561118611Snjl Op->Asl.LogicalByteOffset, 562118611Snjl Op->Asl.Column, 563118611Snjl Op->Asl.Filename, ExtraMessage); 564118611Snjl } 565118611Snjl else 566118611Snjl { 567118611Snjl AslCommonError (Level, MessageId, 0, 568118611Snjl 0, 0, 0, NULL, ExtraMessage); 569118611Snjl } 570118611Snjl} 571118611Snjl 572118611Snjl 573118611Snjl/******************************************************************************* 574118611Snjl * 575118611Snjl * FUNCTION: AslCoreSubsystemError 576118611Snjl * 577118611Snjl * PARAMETERS: Op - Parse node where error happened 578118611Snjl * Status - The ACPI CA Exception 579118611Snjl * ExtraMessage - additional error message 580118611Snjl * Abort - TRUE -> Abort compilation 581118611Snjl * 582118611Snjl * RETURN: None 583118611Snjl * 584118611Snjl * DESCRIPTION: Error reporting routine for exceptions returned by the ACPI 585118611Snjl * CA core subsystem. 586118611Snjl * 587118611Snjl ******************************************************************************/ 588118611Snjl 589118611Snjlvoid 590118611SnjlAslCoreSubsystemError ( 591118611Snjl ACPI_PARSE_OBJECT *Op, 592118611Snjl ACPI_STATUS Status, 593118611Snjl char *ExtraMessage, 594118611Snjl BOOLEAN Abort) 595118611Snjl{ 596118611Snjl 597118611Snjl sprintf (MsgBuffer, "%s %s", AcpiFormatException (Status), ExtraMessage); 598118611Snjl 599118611Snjl if (Op) 600118611Snjl { 601118611Snjl AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Op->Asl.LineNumber, 602118611Snjl Op->Asl.LogicalLineNumber, 603118611Snjl Op->Asl.LogicalByteOffset, 604118611Snjl Op->Asl.Column, 605118611Snjl Op->Asl.Filename, MsgBuffer); 606118611Snjl } 607118611Snjl else 608118611Snjl { 609118611Snjl AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, 0, 610118611Snjl 0, 0, 0, NULL, MsgBuffer); 611118611Snjl } 612118611Snjl 613118611Snjl if (Abort) 614118611Snjl { 615118611Snjl AslAbort (); 616118611Snjl } 617118611Snjl} 618118611Snjl 619118611Snjl 620118611Snjl/******************************************************************************* 621118611Snjl * 622118611Snjl * FUNCTION: AslCompilererror 623118611Snjl * 624118611Snjl * PARAMETERS: CompilerMessage - Error message from the parser 625118611Snjl * 626151937Sjkim * RETURN: Status (0 for now) 627118611Snjl * 628118611Snjl * DESCRIPTION: Report an error situation discovered in a production 629151937Sjkim * NOTE: don't change the name of this function, it is called 630151937Sjkim * from the auto-generated parser. 631118611Snjl * 632118611Snjl ******************************************************************************/ 633118611Snjl 634118611Snjlint 635118611SnjlAslCompilererror ( 636118611Snjl char *CompilerMessage) 637118611Snjl{ 638118611Snjl 639118611Snjl AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber, 640118611Snjl Gbl_LogicalLineNumber, Gbl_CurrentLineOffset, 641118611Snjl Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename, 642118611Snjl CompilerMessage); 643118611Snjl 644118611Snjl return 0; 645118611Snjl} 646118611Snjl 647118611Snjl 648