Home | History | Annotate | Line # | Download | only in compiler
aslerror.c revision 1.1.1.3.16.1
      1           1.1  jruoho /******************************************************************************
      2           1.1  jruoho  *
      3           1.1  jruoho  * Module Name: aslerror - Error handling and statistics
      4           1.1  jruoho  *
      5           1.1  jruoho  *****************************************************************************/
      6           1.1  jruoho 
      7       1.1.1.2  jruoho /*
      8  1.1.1.3.16.1   rmind  * Copyright (C) 2000 - 2013, Intel Corp.
      9           1.1  jruoho  * All rights reserved.
     10           1.1  jruoho  *
     11       1.1.1.2  jruoho  * Redistribution and use in source and binary forms, with or without
     12       1.1.1.2  jruoho  * modification, are permitted provided that the following conditions
     13       1.1.1.2  jruoho  * are met:
     14       1.1.1.2  jruoho  * 1. Redistributions of source code must retain the above copyright
     15       1.1.1.2  jruoho  *    notice, this list of conditions, and the following disclaimer,
     16       1.1.1.2  jruoho  *    without modification.
     17       1.1.1.2  jruoho  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18       1.1.1.2  jruoho  *    substantially similar to the "NO WARRANTY" disclaimer below
     19       1.1.1.2  jruoho  *    ("Disclaimer") and any redistribution must be conditioned upon
     20       1.1.1.2  jruoho  *    including a substantially similar Disclaimer requirement for further
     21       1.1.1.2  jruoho  *    binary redistribution.
     22       1.1.1.2  jruoho  * 3. Neither the names of the above-listed copyright holders nor the names
     23       1.1.1.2  jruoho  *    of any contributors may be used to endorse or promote products derived
     24       1.1.1.2  jruoho  *    from this software without specific prior written permission.
     25       1.1.1.2  jruoho  *
     26       1.1.1.2  jruoho  * Alternatively, this software may be distributed under the terms of the
     27       1.1.1.2  jruoho  * GNU General Public License ("GPL") version 2 as published by the Free
     28       1.1.1.2  jruoho  * Software Foundation.
     29       1.1.1.2  jruoho  *
     30       1.1.1.2  jruoho  * NO WARRANTY
     31       1.1.1.2  jruoho  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32       1.1.1.2  jruoho  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33       1.1.1.2  jruoho  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34       1.1.1.2  jruoho  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35       1.1.1.2  jruoho  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36       1.1.1.2  jruoho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37       1.1.1.2  jruoho  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38       1.1.1.2  jruoho  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39       1.1.1.2  jruoho  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40       1.1.1.2  jruoho  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41       1.1.1.2  jruoho  * POSSIBILITY OF SUCH DAMAGES.
     42       1.1.1.2  jruoho  */
     43           1.1  jruoho 
     44           1.1  jruoho #define ASL_EXCEPTIONS
     45           1.1  jruoho #include "aslcompiler.h"
     46           1.1  jruoho 
     47           1.1  jruoho #define _COMPONENT          ACPI_COMPILER
     48           1.1  jruoho         ACPI_MODULE_NAME    ("aslerror")
     49           1.1  jruoho 
     50           1.1  jruoho /* Local prototypes */
     51           1.1  jruoho 
     52           1.1  jruoho static void
     53           1.1  jruoho AeAddToErrorLog (
     54           1.1  jruoho     ASL_ERROR_MSG           *Enode);
     55           1.1  jruoho 
     56           1.1  jruoho 
     57  1.1.1.3.16.1   rmind /*******************************************************************************
     58  1.1.1.3.16.1   rmind  *
     59  1.1.1.3.16.1   rmind  * FUNCTION:    AeClearErrorLog
     60  1.1.1.3.16.1   rmind  *
     61  1.1.1.3.16.1   rmind  * PARAMETERS:  None
     62  1.1.1.3.16.1   rmind  *
     63  1.1.1.3.16.1   rmind  * RETURN:      None
     64  1.1.1.3.16.1   rmind  *
     65  1.1.1.3.16.1   rmind  * DESCRIPTION: Empty the error list
     66  1.1.1.3.16.1   rmind  *
     67  1.1.1.3.16.1   rmind  ******************************************************************************/
     68  1.1.1.3.16.1   rmind 
     69           1.1  jruoho void
     70           1.1  jruoho AeClearErrorLog (
     71           1.1  jruoho     void)
     72           1.1  jruoho {
     73           1.1  jruoho     ASL_ERROR_MSG           *Enode = Gbl_ErrorLog;
     74           1.1  jruoho     ASL_ERROR_MSG           *Next;
     75           1.1  jruoho 
     76           1.1  jruoho     /* Walk the error node list */
     77           1.1  jruoho 
     78           1.1  jruoho     while (Enode)
     79           1.1  jruoho     {
     80           1.1  jruoho         Next = Enode->Next;
     81           1.1  jruoho         ACPI_FREE (Enode);
     82           1.1  jruoho         Enode = Next;
     83           1.1  jruoho     }
     84           1.1  jruoho 
     85           1.1  jruoho     Gbl_ErrorLog = NULL;
     86           1.1  jruoho }
     87           1.1  jruoho 
     88           1.1  jruoho 
     89           1.1  jruoho /*******************************************************************************
     90           1.1  jruoho  *
     91           1.1  jruoho  * FUNCTION:    AeAddToErrorLog
     92           1.1  jruoho  *
     93           1.1  jruoho  * PARAMETERS:  Enode       - An error node to add to the log
     94           1.1  jruoho  *
     95           1.1  jruoho  * RETURN:      None
     96           1.1  jruoho  *
     97  1.1.1.3.16.1   rmind  * DESCRIPTION: Add a new error node to the error log. The error log is
     98           1.1  jruoho  *              ordered by the "logical" line number (cumulative line number
     99           1.1  jruoho  *              including all include files.)
    100           1.1  jruoho  *
    101           1.1  jruoho  ******************************************************************************/
    102           1.1  jruoho 
    103           1.1  jruoho static void
    104           1.1  jruoho AeAddToErrorLog (
    105           1.1  jruoho     ASL_ERROR_MSG           *Enode)
    106           1.1  jruoho {
    107           1.1  jruoho     ASL_ERROR_MSG           *Next;
    108           1.1  jruoho     ASL_ERROR_MSG           *Prev;
    109           1.1  jruoho 
    110           1.1  jruoho 
    111           1.1  jruoho     /* If Gbl_ErrorLog is null, this is the first error node */
    112           1.1  jruoho 
    113           1.1  jruoho     if (!Gbl_ErrorLog)
    114           1.1  jruoho     {
    115           1.1  jruoho         Gbl_ErrorLog = Enode;
    116           1.1  jruoho         return;
    117           1.1  jruoho     }
    118           1.1  jruoho 
    119           1.1  jruoho     /*
    120           1.1  jruoho      * Walk error list until we find a line number greater than ours.
    121           1.1  jruoho      * List is sorted according to line number.
    122           1.1  jruoho      */
    123           1.1  jruoho     Prev = NULL;
    124           1.1  jruoho     Next = Gbl_ErrorLog;
    125           1.1  jruoho 
    126           1.1  jruoho     while ((Next) &&
    127           1.1  jruoho            (Next->LogicalLineNumber <= Enode->LogicalLineNumber))
    128           1.1  jruoho     {
    129           1.1  jruoho         Prev = Next;
    130           1.1  jruoho         Next = Next->Next;
    131           1.1  jruoho     }
    132           1.1  jruoho 
    133           1.1  jruoho     /* Found our place in the list */
    134           1.1  jruoho 
    135           1.1  jruoho     Enode->Next = Next;
    136           1.1  jruoho 
    137           1.1  jruoho     if (Prev)
    138           1.1  jruoho     {
    139           1.1  jruoho         Prev->Next = Enode;
    140           1.1  jruoho     }
    141           1.1  jruoho     else
    142           1.1  jruoho     {
    143           1.1  jruoho         Gbl_ErrorLog = Enode;
    144           1.1  jruoho     }
    145           1.1  jruoho }
    146           1.1  jruoho 
    147           1.1  jruoho 
    148           1.1  jruoho /*******************************************************************************
    149           1.1  jruoho  *
    150           1.1  jruoho  * FUNCTION:    AePrintException
    151           1.1  jruoho  *
    152           1.1  jruoho  * PARAMETERS:  FileId          - ID of output file
    153           1.1  jruoho  *              Enode           - Error node to print
    154           1.1  jruoho  *              Header          - Additional text before each message
    155           1.1  jruoho  *
    156           1.1  jruoho  * RETURN:      None
    157           1.1  jruoho  *
    158           1.1  jruoho  * DESCRIPTION: Print the contents of an error node.
    159           1.1  jruoho  *
    160           1.1  jruoho  * NOTE:        We don't use the FlxxxFile I/O functions here because on error
    161           1.1  jruoho  *              they abort the compiler and call this function!  Since we
    162           1.1  jruoho  *              are reporting errors here, we ignore most output errors and
    163           1.1  jruoho  *              just try to get out as much as we can.
    164           1.1  jruoho  *
    165           1.1  jruoho  ******************************************************************************/
    166           1.1  jruoho 
    167           1.1  jruoho void
    168           1.1  jruoho AePrintException (
    169           1.1  jruoho     UINT32                  FileId,
    170           1.1  jruoho     ASL_ERROR_MSG           *Enode,
    171           1.1  jruoho     char                    *Header)
    172           1.1  jruoho {
    173           1.1  jruoho     UINT8                   SourceByte;
    174           1.1  jruoho     int                     Actual;
    175           1.1  jruoho     size_t                  RActual;
    176           1.1  jruoho     UINT32                  MsgLength;
    177           1.1  jruoho     char                    *MainMessage;
    178           1.1  jruoho     char                    *ExtraMessage;
    179           1.1  jruoho     UINT32                  SourceColumn;
    180           1.1  jruoho     UINT32                  ErrorColumn;
    181           1.1  jruoho     FILE                    *OutputFile;
    182  1.1.1.3.16.1   rmind     FILE                    *SourceFile = NULL;
    183       1.1.1.2  jruoho     long                    FileSize;
    184       1.1.1.2  jruoho     BOOLEAN                 PrematureEOF = FALSE;
    185  1.1.1.3.16.1   rmind     UINT32                  Total = 0;
    186           1.1  jruoho 
    187           1.1  jruoho 
    188           1.1  jruoho     if (Gbl_NoErrors)
    189           1.1  jruoho     {
    190           1.1  jruoho         return;
    191           1.1  jruoho     }
    192           1.1  jruoho 
    193           1.1  jruoho     /*
    194           1.1  jruoho      * Only listing files have a header, and remarks/optimizations
    195           1.1  jruoho      * are always output
    196           1.1  jruoho      */
    197           1.1  jruoho     if (!Header)
    198           1.1  jruoho     {
    199           1.1  jruoho         /* Ignore remarks if requested */
    200           1.1  jruoho 
    201           1.1  jruoho         switch (Enode->Level)
    202           1.1  jruoho         {
    203  1.1.1.3.16.1   rmind         case ASL_WARNING:
    204  1.1.1.3.16.1   rmind         case ASL_WARNING2:
    205  1.1.1.3.16.1   rmind         case ASL_WARNING3:
    206  1.1.1.3.16.1   rmind 
    207  1.1.1.3.16.1   rmind             if (!Gbl_DisplayWarnings)
    208  1.1.1.3.16.1   rmind             {
    209  1.1.1.3.16.1   rmind                 return;
    210  1.1.1.3.16.1   rmind             }
    211  1.1.1.3.16.1   rmind             break;
    212  1.1.1.3.16.1   rmind 
    213           1.1  jruoho         case ASL_REMARK:
    214  1.1.1.3.16.1   rmind 
    215           1.1  jruoho             if (!Gbl_DisplayRemarks)
    216           1.1  jruoho             {
    217           1.1  jruoho                 return;
    218           1.1  jruoho             }
    219           1.1  jruoho             break;
    220           1.1  jruoho 
    221           1.1  jruoho         case ASL_OPTIMIZATION:
    222  1.1.1.3.16.1   rmind 
    223           1.1  jruoho             if (!Gbl_DisplayOptimizations)
    224           1.1  jruoho             {
    225           1.1  jruoho                 return;
    226           1.1  jruoho             }
    227           1.1  jruoho             break;
    228           1.1  jruoho 
    229           1.1  jruoho         default:
    230  1.1.1.3.16.1   rmind 
    231           1.1  jruoho             break;
    232           1.1  jruoho         }
    233           1.1  jruoho     }
    234           1.1  jruoho 
    235  1.1.1.3.16.1   rmind     /* Get the various required file handles */
    236           1.1  jruoho 
    237           1.1  jruoho     OutputFile = Gbl_Files[FileId].Handle;
    238       1.1.1.2  jruoho 
    239  1.1.1.3.16.1   rmind     if (!Enode->SourceLine)
    240       1.1.1.2  jruoho     {
    241  1.1.1.3.16.1   rmind         /* Use the merged header/source file if present, otherwise use input file */
    242       1.1.1.2  jruoho 
    243  1.1.1.3.16.1   rmind         SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
    244  1.1.1.3.16.1   rmind         if (!SourceFile)
    245  1.1.1.3.16.1   rmind         {
    246  1.1.1.3.16.1   rmind             SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle;
    247  1.1.1.3.16.1   rmind         }
    248       1.1.1.2  jruoho 
    249  1.1.1.3.16.1   rmind         if (SourceFile)
    250       1.1.1.2  jruoho         {
    251  1.1.1.3.16.1   rmind             /* Determine if the error occurred at source file EOF */
    252  1.1.1.3.16.1   rmind 
    253  1.1.1.3.16.1   rmind             fseek (SourceFile, 0, SEEK_END);
    254  1.1.1.3.16.1   rmind             FileSize = ftell (SourceFile);
    255  1.1.1.3.16.1   rmind 
    256  1.1.1.3.16.1   rmind             if ((long) Enode->LogicalByteOffset >= FileSize)
    257  1.1.1.3.16.1   rmind             {
    258  1.1.1.3.16.1   rmind                 PrematureEOF = TRUE;
    259  1.1.1.3.16.1   rmind             }
    260       1.1.1.2  jruoho         }
    261       1.1.1.2  jruoho     }
    262           1.1  jruoho 
    263           1.1  jruoho     if (Header)
    264           1.1  jruoho     {
    265           1.1  jruoho         fprintf (OutputFile, "%s", Header);
    266           1.1  jruoho     }
    267           1.1  jruoho 
    268           1.1  jruoho     /* Print filename and line number if present and valid */
    269           1.1  jruoho 
    270           1.1  jruoho     if (Enode->Filename)
    271           1.1  jruoho     {
    272           1.1  jruoho         if (Gbl_VerboseErrors)
    273           1.1  jruoho         {
    274  1.1.1.3.16.1   rmind             fprintf (OutputFile, "%-8s", Enode->Filename);
    275           1.1  jruoho 
    276           1.1  jruoho             if (Enode->LineNumber)
    277           1.1  jruoho             {
    278  1.1.1.3.16.1   rmind                 if (Enode->SourceLine)
    279           1.1  jruoho                 {
    280  1.1.1.3.16.1   rmind                     fprintf (OutputFile, " %6u: %s",
    281  1.1.1.3.16.1   rmind                         Enode->LineNumber, Enode->SourceLine);
    282  1.1.1.3.16.1   rmind                 }
    283  1.1.1.3.16.1   rmind                 else
    284  1.1.1.3.16.1   rmind                 {
    285  1.1.1.3.16.1   rmind                     fprintf (OutputFile, " %6u: ", Enode->LineNumber);
    286  1.1.1.3.16.1   rmind 
    287       1.1.1.2  jruoho                     /*
    288  1.1.1.3.16.1   rmind                      * If not at EOF, get the corresponding source code line and
    289  1.1.1.3.16.1   rmind                      * display it. Don't attempt this if we have a premature EOF
    290  1.1.1.3.16.1   rmind                      * condition.
    291       1.1.1.2  jruoho                      */
    292  1.1.1.3.16.1   rmind                     if (!PrematureEOF)
    293           1.1  jruoho                     {
    294  1.1.1.3.16.1   rmind                         /*
    295  1.1.1.3.16.1   rmind                          * Seek to the offset in the combined source file, read
    296  1.1.1.3.16.1   rmind                          * the source line, and write it to the output.
    297  1.1.1.3.16.1   rmind                          */
    298  1.1.1.3.16.1   rmind                         Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset,
    299  1.1.1.3.16.1   rmind                                     (int) SEEK_SET);
    300  1.1.1.3.16.1   rmind                         if (Actual)
    301       1.1.1.2  jruoho                         {
    302       1.1.1.2  jruoho                             fprintf (OutputFile,
    303  1.1.1.3.16.1   rmind                                 "[*** iASL: Seek error on source code temp file %s ***]",
    304       1.1.1.2  jruoho                                 Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
    305       1.1.1.2  jruoho                         }
    306  1.1.1.3.16.1   rmind                         else
    307       1.1.1.2  jruoho                         {
    308       1.1.1.2  jruoho                             RActual = fread (&SourceByte, 1, 1, SourceFile);
    309  1.1.1.3.16.1   rmind                             if (RActual != 1)
    310  1.1.1.3.16.1   rmind                             {
    311  1.1.1.3.16.1   rmind                                 fprintf (OutputFile,
    312  1.1.1.3.16.1   rmind                                     "[*** iASL: Read error on source code temp file %s ***]",
    313  1.1.1.3.16.1   rmind                                     Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
    314  1.1.1.3.16.1   rmind                             }
    315  1.1.1.3.16.1   rmind                             else
    316  1.1.1.3.16.1   rmind                             {
    317  1.1.1.3.16.1   rmind                                 /* Read/write the source line, up to the maximum line length */
    318  1.1.1.3.16.1   rmind 
    319  1.1.1.3.16.1   rmind                                 while (RActual && SourceByte && (SourceByte != '\n'))
    320  1.1.1.3.16.1   rmind                                 {
    321  1.1.1.3.16.1   rmind                                     if (Total < 256)
    322  1.1.1.3.16.1   rmind                                     {
    323  1.1.1.3.16.1   rmind                                         /* After the max line length, we will just read the line, no write */
    324  1.1.1.3.16.1   rmind 
    325  1.1.1.3.16.1   rmind                                         if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
    326  1.1.1.3.16.1   rmind                                         {
    327  1.1.1.3.16.1   rmind                                             printf ("[*** iASL: Write error on output file ***]\n");
    328  1.1.1.3.16.1   rmind                                             return;
    329  1.1.1.3.16.1   rmind                                         }
    330  1.1.1.3.16.1   rmind                                     }
    331  1.1.1.3.16.1   rmind                                     else if (Total == 256)
    332  1.1.1.3.16.1   rmind                                     {
    333  1.1.1.3.16.1   rmind                                         fprintf (OutputFile,
    334  1.1.1.3.16.1   rmind                                             "\n[*** iASL: Very long input line, message below refers to column %u ***]",
    335  1.1.1.3.16.1   rmind                                             Enode->Column);
    336  1.1.1.3.16.1   rmind                                     }
    337  1.1.1.3.16.1   rmind 
    338  1.1.1.3.16.1   rmind                                     RActual = fread (&SourceByte, 1, 1, SourceFile);
    339  1.1.1.3.16.1   rmind                                     if (RActual != 1)
    340  1.1.1.3.16.1   rmind                                     {
    341  1.1.1.3.16.1   rmind                                         fprintf (OutputFile,
    342  1.1.1.3.16.1   rmind                                             "[*** iASL: Read error on source code temp file %s ***]",
    343  1.1.1.3.16.1   rmind                                             Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
    344  1.1.1.3.16.1   rmind                                         return;
    345  1.1.1.3.16.1   rmind                                     }
    346  1.1.1.3.16.1   rmind                                     Total++;
    347  1.1.1.3.16.1   rmind                                 }
    348  1.1.1.3.16.1   rmind                             }
    349       1.1.1.2  jruoho                         }
    350           1.1  jruoho                     }
    351       1.1.1.2  jruoho 
    352  1.1.1.3.16.1   rmind                     fprintf (OutputFile, "\n");
    353  1.1.1.3.16.1   rmind                 }
    354           1.1  jruoho             }
    355           1.1  jruoho         }
    356           1.1  jruoho         else
    357           1.1  jruoho         {
    358  1.1.1.3.16.1   rmind             /*
    359  1.1.1.3.16.1   rmind              * Less verbose version of the error message, enabled via the
    360  1.1.1.3.16.1   rmind              * -vi switch. The format is compatible with MS Visual Studio.
    361  1.1.1.3.16.1   rmind              */
    362           1.1  jruoho             fprintf (OutputFile, "%s", Enode->Filename);
    363           1.1  jruoho 
    364           1.1  jruoho             if (Enode->LineNumber)
    365           1.1  jruoho             {
    366  1.1.1.3.16.1   rmind                 fprintf (OutputFile, "(%u) : ",
    367  1.1.1.3.16.1   rmind                     Enode->LineNumber);
    368           1.1  jruoho             }
    369           1.1  jruoho         }
    370           1.1  jruoho     }
    371           1.1  jruoho 
    372           1.1  jruoho     /* NULL message ID, just print the raw message */
    373           1.1  jruoho 
    374           1.1  jruoho     if (Enode->MessageId == 0)
    375           1.1  jruoho     {
    376           1.1  jruoho         fprintf (OutputFile, "%s\n", Enode->Message);
    377           1.1  jruoho     }
    378           1.1  jruoho     else
    379           1.1  jruoho     {
    380           1.1  jruoho         /* Decode the message ID */
    381           1.1  jruoho 
    382  1.1.1.3.16.1   rmind         if (Gbl_VerboseErrors)
    383  1.1.1.3.16.1   rmind         {
    384  1.1.1.3.16.1   rmind             fprintf (OutputFile, "%s %4.4d -",
    385  1.1.1.3.16.1   rmind                         AslErrorLevel[Enode->Level],
    386  1.1.1.3.16.1   rmind                         Enode->MessageId + ((Enode->Level+1) * 1000));
    387  1.1.1.3.16.1   rmind         }
    388  1.1.1.3.16.1   rmind         else /* IDE case */
    389  1.1.1.3.16.1   rmind         {
    390  1.1.1.3.16.1   rmind             fprintf (OutputFile, "%s %4.4d:",
    391  1.1.1.3.16.1   rmind                         AslErrorLevelIde[Enode->Level],
    392  1.1.1.3.16.1   rmind                         Enode->MessageId + ((Enode->Level+1) * 1000));
    393  1.1.1.3.16.1   rmind         }
    394           1.1  jruoho 
    395           1.1  jruoho         MainMessage = AslMessages[Enode->MessageId];
    396           1.1  jruoho         ExtraMessage = Enode->Message;
    397           1.1  jruoho 
    398           1.1  jruoho         if (Enode->LineNumber)
    399           1.1  jruoho         {
    400  1.1.1.3.16.1   rmind             /* Main message: try to use string from AslMessages first */
    401  1.1.1.3.16.1   rmind 
    402  1.1.1.3.16.1   rmind             if (!MainMessage)
    403  1.1.1.3.16.1   rmind             {
    404  1.1.1.3.16.1   rmind                 MainMessage = "";
    405  1.1.1.3.16.1   rmind             }
    406  1.1.1.3.16.1   rmind 
    407           1.1  jruoho             MsgLength = strlen (MainMessage);
    408           1.1  jruoho             if (MsgLength == 0)
    409           1.1  jruoho             {
    410  1.1.1.3.16.1   rmind                 /* Use the secondary/extra message as main message */
    411  1.1.1.3.16.1   rmind 
    412           1.1  jruoho                 MainMessage = Enode->Message;
    413  1.1.1.3.16.1   rmind                 if (!MainMessage)
    414  1.1.1.3.16.1   rmind                 {
    415  1.1.1.3.16.1   rmind                     MainMessage = "";
    416  1.1.1.3.16.1   rmind                 }
    417           1.1  jruoho 
    418           1.1  jruoho                 MsgLength = strlen (MainMessage);
    419           1.1  jruoho                 ExtraMessage = NULL;
    420           1.1  jruoho             }
    421           1.1  jruoho 
    422       1.1.1.2  jruoho             if (Gbl_VerboseErrors && !PrematureEOF)
    423           1.1  jruoho             {
    424  1.1.1.3.16.1   rmind                 if (Total >= 256)
    425           1.1  jruoho                 {
    426  1.1.1.3.16.1   rmind                     fprintf (OutputFile, "    %s",
    427  1.1.1.3.16.1   rmind                         MainMessage);
    428           1.1  jruoho                 }
    429           1.1  jruoho                 else
    430           1.1  jruoho                 {
    431  1.1.1.3.16.1   rmind                     SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2;
    432  1.1.1.3.16.1   rmind                     ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1;
    433  1.1.1.3.16.1   rmind 
    434  1.1.1.3.16.1   rmind                     if ((MsgLength + ErrorColumn) < (SourceColumn - 1))
    435  1.1.1.3.16.1   rmind                     {
    436  1.1.1.3.16.1   rmind                         fprintf (OutputFile, "%*s%s",
    437  1.1.1.3.16.1   rmind                             (int) ((SourceColumn - 1) - ErrorColumn),
    438  1.1.1.3.16.1   rmind                             MainMessage, " ^ ");
    439  1.1.1.3.16.1   rmind                     }
    440  1.1.1.3.16.1   rmind                     else
    441  1.1.1.3.16.1   rmind                     {
    442  1.1.1.3.16.1   rmind                         fprintf (OutputFile, "%*s %s",
    443  1.1.1.3.16.1   rmind                             (int) ((SourceColumn - ErrorColumn) + 1), "^",
    444  1.1.1.3.16.1   rmind                             MainMessage);
    445  1.1.1.3.16.1   rmind                     }
    446           1.1  jruoho                 }
    447           1.1  jruoho             }
    448           1.1  jruoho             else
    449           1.1  jruoho             {
    450           1.1  jruoho                 fprintf (OutputFile, " %s", MainMessage);
    451           1.1  jruoho             }
    452           1.1  jruoho 
    453           1.1  jruoho             /* Print the extra info message if present */
    454           1.1  jruoho 
    455           1.1  jruoho             if (ExtraMessage)
    456           1.1  jruoho             {
    457           1.1  jruoho                 fprintf (OutputFile, " (%s)", ExtraMessage);
    458           1.1  jruoho             }
    459           1.1  jruoho 
    460       1.1.1.2  jruoho             if (PrematureEOF)
    461       1.1.1.2  jruoho             {
    462       1.1.1.2  jruoho                 fprintf (OutputFile, " and premature End-Of-File");
    463       1.1.1.2  jruoho             }
    464       1.1.1.2  jruoho 
    465           1.1  jruoho             fprintf (OutputFile, "\n");
    466           1.1  jruoho             if (Gbl_VerboseErrors)
    467           1.1  jruoho             {
    468           1.1  jruoho                 fprintf (OutputFile, "\n");
    469           1.1  jruoho             }
    470           1.1  jruoho         }
    471           1.1  jruoho         else
    472           1.1  jruoho         {
    473           1.1  jruoho             fprintf (OutputFile, " %s %s\n\n", MainMessage, ExtraMessage);
    474           1.1  jruoho         }
    475           1.1  jruoho     }
    476           1.1  jruoho }
    477           1.1  jruoho 
    478           1.1  jruoho 
    479           1.1  jruoho /*******************************************************************************
    480           1.1  jruoho  *
    481           1.1  jruoho  * FUNCTION:    AePrintErrorLog
    482           1.1  jruoho  *
    483           1.1  jruoho  * PARAMETERS:  FileId           - Where to output the error log
    484           1.1  jruoho  *
    485           1.1  jruoho  * RETURN:      None
    486           1.1  jruoho  *
    487           1.1  jruoho  * DESCRIPTION: Print the entire contents of the error log
    488           1.1  jruoho  *
    489           1.1  jruoho  ******************************************************************************/
    490           1.1  jruoho 
    491           1.1  jruoho void
    492           1.1  jruoho AePrintErrorLog (
    493           1.1  jruoho     UINT32                  FileId)
    494           1.1  jruoho {
    495           1.1  jruoho     ASL_ERROR_MSG           *Enode = Gbl_ErrorLog;
    496           1.1  jruoho 
    497           1.1  jruoho 
    498           1.1  jruoho     /* Walk the error node list */
    499           1.1  jruoho 
    500           1.1  jruoho     while (Enode)
    501           1.1  jruoho     {
    502           1.1  jruoho         AePrintException (FileId, Enode, NULL);
    503           1.1  jruoho         Enode = Enode->Next;
    504           1.1  jruoho     }
    505           1.1  jruoho }
    506           1.1  jruoho 
    507           1.1  jruoho 
    508           1.1  jruoho /*******************************************************************************
    509           1.1  jruoho  *
    510  1.1.1.3.16.1   rmind  * FUNCTION:    AslCommonError2
    511  1.1.1.3.16.1   rmind  *
    512  1.1.1.3.16.1   rmind  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
    513  1.1.1.3.16.1   rmind  *              MessageId           - Index into global message buffer
    514  1.1.1.3.16.1   rmind  *              LineNumber          - Actual file line number
    515  1.1.1.3.16.1   rmind  *              Column              - Column in current line
    516  1.1.1.3.16.1   rmind  *              SourceLine          - Actual source code line
    517  1.1.1.3.16.1   rmind  *              Filename            - source filename
    518  1.1.1.3.16.1   rmind  *              ExtraMessage        - additional error message
    519  1.1.1.3.16.1   rmind  *
    520  1.1.1.3.16.1   rmind  * RETURN:      None
    521  1.1.1.3.16.1   rmind  *
    522  1.1.1.3.16.1   rmind  * DESCRIPTION: Create a new error node and add it to the error log
    523  1.1.1.3.16.1   rmind  *
    524  1.1.1.3.16.1   rmind  ******************************************************************************/
    525  1.1.1.3.16.1   rmind 
    526  1.1.1.3.16.1   rmind void
    527  1.1.1.3.16.1   rmind AslCommonError2 (
    528  1.1.1.3.16.1   rmind     UINT8                   Level,
    529  1.1.1.3.16.1   rmind     UINT8                   MessageId,
    530  1.1.1.3.16.1   rmind     UINT32                  LineNumber,
    531  1.1.1.3.16.1   rmind     UINT32                  Column,
    532  1.1.1.3.16.1   rmind     char                    *SourceLine,
    533  1.1.1.3.16.1   rmind     char                    *Filename,
    534  1.1.1.3.16.1   rmind     char                    *ExtraMessage)
    535  1.1.1.3.16.1   rmind {
    536  1.1.1.3.16.1   rmind     char                    *MessageBuffer = NULL;
    537  1.1.1.3.16.1   rmind     char                    *LineBuffer;
    538  1.1.1.3.16.1   rmind     ASL_ERROR_MSG           *Enode;
    539  1.1.1.3.16.1   rmind 
    540  1.1.1.3.16.1   rmind 
    541  1.1.1.3.16.1   rmind     Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
    542  1.1.1.3.16.1   rmind 
    543  1.1.1.3.16.1   rmind     if (ExtraMessage)
    544  1.1.1.3.16.1   rmind     {
    545  1.1.1.3.16.1   rmind         /* Allocate a buffer for the message and a new error node */
    546  1.1.1.3.16.1   rmind 
    547  1.1.1.3.16.1   rmind         MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1);
    548  1.1.1.3.16.1   rmind 
    549  1.1.1.3.16.1   rmind         /* Keep a copy of the extra message */
    550  1.1.1.3.16.1   rmind 
    551  1.1.1.3.16.1   rmind         ACPI_STRCPY (MessageBuffer, ExtraMessage);
    552  1.1.1.3.16.1   rmind     }
    553  1.1.1.3.16.1   rmind 
    554  1.1.1.3.16.1   rmind     LineBuffer = UtLocalCalloc (strlen (SourceLine) + 1);
    555  1.1.1.3.16.1   rmind     ACPI_STRCPY (LineBuffer, SourceLine);
    556  1.1.1.3.16.1   rmind 
    557  1.1.1.3.16.1   rmind     /* Initialize the error node */
    558  1.1.1.3.16.1   rmind 
    559  1.1.1.3.16.1   rmind     if (Filename)
    560  1.1.1.3.16.1   rmind     {
    561  1.1.1.3.16.1   rmind         Enode->Filename       = Filename;
    562  1.1.1.3.16.1   rmind         Enode->FilenameLength = strlen (Filename);
    563  1.1.1.3.16.1   rmind         if (Enode->FilenameLength < 6)
    564  1.1.1.3.16.1   rmind         {
    565  1.1.1.3.16.1   rmind             Enode->FilenameLength = 6;
    566  1.1.1.3.16.1   rmind         }
    567  1.1.1.3.16.1   rmind     }
    568  1.1.1.3.16.1   rmind 
    569  1.1.1.3.16.1   rmind     Enode->MessageId            = MessageId;
    570  1.1.1.3.16.1   rmind     Enode->Level                = Level;
    571  1.1.1.3.16.1   rmind     Enode->LineNumber           = LineNumber;
    572  1.1.1.3.16.1   rmind     Enode->LogicalLineNumber    = LineNumber;
    573  1.1.1.3.16.1   rmind     Enode->LogicalByteOffset    = 0;
    574  1.1.1.3.16.1   rmind     Enode->Column               = Column;
    575  1.1.1.3.16.1   rmind     Enode->Message              = MessageBuffer;
    576  1.1.1.3.16.1   rmind     Enode->SourceLine           = LineBuffer;
    577  1.1.1.3.16.1   rmind 
    578  1.1.1.3.16.1   rmind     /* Add the new node to the error node list */
    579  1.1.1.3.16.1   rmind 
    580  1.1.1.3.16.1   rmind     AeAddToErrorLog (Enode);
    581  1.1.1.3.16.1   rmind 
    582  1.1.1.3.16.1   rmind     if (Gbl_DebugFlag)
    583  1.1.1.3.16.1   rmind     {
    584  1.1.1.3.16.1   rmind         /* stderr is a file, send error to it immediately */
    585  1.1.1.3.16.1   rmind 
    586  1.1.1.3.16.1   rmind         AePrintException (ASL_FILE_STDERR, Enode, NULL);
    587  1.1.1.3.16.1   rmind     }
    588  1.1.1.3.16.1   rmind 
    589  1.1.1.3.16.1   rmind     Gbl_ExceptionCount[Level]++;
    590  1.1.1.3.16.1   rmind }
    591  1.1.1.3.16.1   rmind 
    592  1.1.1.3.16.1   rmind 
    593  1.1.1.3.16.1   rmind /*******************************************************************************
    594  1.1.1.3.16.1   rmind  *
    595           1.1  jruoho  * FUNCTION:    AslCommonError
    596           1.1  jruoho  *
    597           1.1  jruoho  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
    598           1.1  jruoho  *              MessageId           - Index into global message buffer
    599           1.1  jruoho  *              CurrentLineNumber   - Actual file line number
    600           1.1  jruoho  *              LogicalLineNumber   - Cumulative line number
    601           1.1  jruoho  *              LogicalByteOffset   - Byte offset in source file
    602           1.1  jruoho  *              Column              - Column in current line
    603           1.1  jruoho  *              Filename            - source filename
    604           1.1  jruoho  *              ExtraMessage        - additional error message
    605           1.1  jruoho  *
    606           1.1  jruoho  * RETURN:      None
    607           1.1  jruoho  *
    608           1.1  jruoho  * DESCRIPTION: Create a new error node and add it to the error log
    609           1.1  jruoho  *
    610           1.1  jruoho  ******************************************************************************/
    611           1.1  jruoho 
    612           1.1  jruoho void
    613           1.1  jruoho AslCommonError (
    614           1.1  jruoho     UINT8                   Level,
    615           1.1  jruoho     UINT8                   MessageId,
    616           1.1  jruoho     UINT32                  CurrentLineNumber,
    617           1.1  jruoho     UINT32                  LogicalLineNumber,
    618           1.1  jruoho     UINT32                  LogicalByteOffset,
    619           1.1  jruoho     UINT32                  Column,
    620           1.1  jruoho     char                    *Filename,
    621           1.1  jruoho     char                    *ExtraMessage)
    622           1.1  jruoho {
    623           1.1  jruoho     char                    *MessageBuffer = NULL;
    624           1.1  jruoho     ASL_ERROR_MSG           *Enode;
    625           1.1  jruoho 
    626           1.1  jruoho 
    627           1.1  jruoho     Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
    628           1.1  jruoho 
    629           1.1  jruoho     if (ExtraMessage)
    630           1.1  jruoho     {
    631           1.1  jruoho         /* Allocate a buffer for the message and a new error node */
    632           1.1  jruoho 
    633  1.1.1.3.16.1   rmind         MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1);
    634           1.1  jruoho 
    635           1.1  jruoho         /* Keep a copy of the extra message */
    636           1.1  jruoho 
    637           1.1  jruoho         ACPI_STRCPY (MessageBuffer, ExtraMessage);
    638           1.1  jruoho     }
    639           1.1  jruoho 
    640           1.1  jruoho     /* Initialize the error node */
    641           1.1  jruoho 
    642           1.1  jruoho     if (Filename)
    643           1.1  jruoho     {
    644           1.1  jruoho         Enode->Filename       = Filename;
    645           1.1  jruoho         Enode->FilenameLength = strlen (Filename);
    646           1.1  jruoho         if (Enode->FilenameLength < 6)
    647           1.1  jruoho         {
    648           1.1  jruoho             Enode->FilenameLength = 6;
    649           1.1  jruoho         }
    650           1.1  jruoho     }
    651           1.1  jruoho 
    652           1.1  jruoho     Enode->MessageId            = MessageId;
    653           1.1  jruoho     Enode->Level                = Level;
    654           1.1  jruoho     Enode->LineNumber           = CurrentLineNumber;
    655           1.1  jruoho     Enode->LogicalLineNumber    = LogicalLineNumber;
    656           1.1  jruoho     Enode->LogicalByteOffset    = LogicalByteOffset;
    657           1.1  jruoho     Enode->Column               = Column;
    658           1.1  jruoho     Enode->Message              = MessageBuffer;
    659  1.1.1.3.16.1   rmind     Enode->SourceLine           = NULL;
    660           1.1  jruoho 
    661           1.1  jruoho     /* Add the new node to the error node list */
    662           1.1  jruoho 
    663           1.1  jruoho     AeAddToErrorLog (Enode);
    664           1.1  jruoho 
    665           1.1  jruoho     if (Gbl_DebugFlag)
    666           1.1  jruoho     {
    667           1.1  jruoho         /* stderr is a file, send error to it immediately */
    668           1.1  jruoho 
    669           1.1  jruoho         AePrintException (ASL_FILE_STDERR, Enode, NULL);
    670           1.1  jruoho     }
    671           1.1  jruoho 
    672           1.1  jruoho     Gbl_ExceptionCount[Level]++;
    673           1.1  jruoho     if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
    674           1.1  jruoho     {
    675           1.1  jruoho         printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT);
    676           1.1  jruoho 
    677           1.1  jruoho         Gbl_SourceLine = 0;
    678           1.1  jruoho         Gbl_NextError = Gbl_ErrorLog;
    679           1.1  jruoho         CmCleanupAndExit ();
    680           1.1  jruoho         exit(1);
    681           1.1  jruoho     }
    682           1.1  jruoho 
    683           1.1  jruoho     return;
    684           1.1  jruoho }
    685           1.1  jruoho 
    686           1.1  jruoho 
    687           1.1  jruoho /*******************************************************************************
    688           1.1  jruoho  *
    689  1.1.1.3.16.1   rmind  * FUNCTION:    AslDisableException
    690  1.1.1.3.16.1   rmind  *
    691  1.1.1.3.16.1   rmind  * PARAMETERS:  MessageIdString     - ID to be disabled
    692  1.1.1.3.16.1   rmind  *
    693  1.1.1.3.16.1   rmind  * RETURN:      Status
    694  1.1.1.3.16.1   rmind  *
    695  1.1.1.3.16.1   rmind  * DESCRIPTION: Enter a message ID into the global disabled messages table
    696  1.1.1.3.16.1   rmind  *
    697  1.1.1.3.16.1   rmind  ******************************************************************************/
    698  1.1.1.3.16.1   rmind 
    699  1.1.1.3.16.1   rmind ACPI_STATUS
    700  1.1.1.3.16.1   rmind AslDisableException (
    701  1.1.1.3.16.1   rmind     char                    *MessageIdString)
    702  1.1.1.3.16.1   rmind {
    703  1.1.1.3.16.1   rmind     UINT32                  MessageId;
    704  1.1.1.3.16.1   rmind 
    705  1.1.1.3.16.1   rmind 
    706  1.1.1.3.16.1   rmind     /* Convert argument to an integer and validate it */
    707  1.1.1.3.16.1   rmind 
    708  1.1.1.3.16.1   rmind     MessageId = (UINT32) strtoul (MessageIdString, NULL, 0);
    709  1.1.1.3.16.1   rmind 
    710  1.1.1.3.16.1   rmind     if ((MessageId < 2000) || (MessageId > 5999))
    711  1.1.1.3.16.1   rmind     {
    712  1.1.1.3.16.1   rmind         printf ("\"%s\" is not a valid warning/remark ID\n",
    713  1.1.1.3.16.1   rmind             MessageIdString);
    714  1.1.1.3.16.1   rmind         return (AE_BAD_PARAMETER);
    715  1.1.1.3.16.1   rmind     }
    716  1.1.1.3.16.1   rmind 
    717  1.1.1.3.16.1   rmind     /* Insert value into the global disabled message array */
    718  1.1.1.3.16.1   rmind 
    719  1.1.1.3.16.1   rmind     if (Gbl_DisabledMessagesIndex >= ASL_MAX_DISABLED_MESSAGES)
    720  1.1.1.3.16.1   rmind     {
    721  1.1.1.3.16.1   rmind         printf ("Too many messages have been disabled (max %u)\n",
    722  1.1.1.3.16.1   rmind             ASL_MAX_DISABLED_MESSAGES);
    723  1.1.1.3.16.1   rmind         return (AE_LIMIT);
    724  1.1.1.3.16.1   rmind     }
    725  1.1.1.3.16.1   rmind 
    726  1.1.1.3.16.1   rmind     Gbl_DisabledMessages[Gbl_DisabledMessagesIndex] = MessageId;
    727  1.1.1.3.16.1   rmind     Gbl_DisabledMessagesIndex++;
    728  1.1.1.3.16.1   rmind     return (AE_OK);
    729  1.1.1.3.16.1   rmind }
    730  1.1.1.3.16.1   rmind 
    731  1.1.1.3.16.1   rmind 
    732  1.1.1.3.16.1   rmind /*******************************************************************************
    733  1.1.1.3.16.1   rmind  *
    734  1.1.1.3.16.1   rmind  * FUNCTION:    AslIsExceptionDisabled
    735  1.1.1.3.16.1   rmind  *
    736  1.1.1.3.16.1   rmind  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
    737  1.1.1.3.16.1   rmind  *              MessageId           - Index into global message buffer
    738  1.1.1.3.16.1   rmind  *
    739  1.1.1.3.16.1   rmind  * RETURN:      TRUE if exception/message should be ignored
    740  1.1.1.3.16.1   rmind  *
    741  1.1.1.3.16.1   rmind  * DESCRIPTION: Check if the user has specified options such that this
    742  1.1.1.3.16.1   rmind  *              exception should be ignored
    743  1.1.1.3.16.1   rmind  *
    744  1.1.1.3.16.1   rmind  ******************************************************************************/
    745  1.1.1.3.16.1   rmind 
    746  1.1.1.3.16.1   rmind BOOLEAN
    747  1.1.1.3.16.1   rmind AslIsExceptionDisabled (
    748  1.1.1.3.16.1   rmind     UINT8                   Level,
    749  1.1.1.3.16.1   rmind     UINT8                   MessageId)
    750  1.1.1.3.16.1   rmind {
    751  1.1.1.3.16.1   rmind     UINT32                  EncodedMessageId;
    752  1.1.1.3.16.1   rmind     UINT32                  i;
    753  1.1.1.3.16.1   rmind 
    754  1.1.1.3.16.1   rmind 
    755  1.1.1.3.16.1   rmind     switch (Level)
    756  1.1.1.3.16.1   rmind     {
    757  1.1.1.3.16.1   rmind     case ASL_WARNING2:
    758  1.1.1.3.16.1   rmind     case ASL_WARNING3:
    759  1.1.1.3.16.1   rmind 
    760  1.1.1.3.16.1   rmind         /* Check for global disable via -w1/-w2/-w3 options */
    761  1.1.1.3.16.1   rmind 
    762  1.1.1.3.16.1   rmind         if (Level > Gbl_WarningLevel)
    763  1.1.1.3.16.1   rmind         {
    764  1.1.1.3.16.1   rmind             return (TRUE);
    765  1.1.1.3.16.1   rmind         }
    766  1.1.1.3.16.1   rmind         /* Fall through */
    767  1.1.1.3.16.1   rmind 
    768  1.1.1.3.16.1   rmind     case ASL_WARNING:
    769  1.1.1.3.16.1   rmind     case ASL_REMARK:
    770  1.1.1.3.16.1   rmind         /*
    771  1.1.1.3.16.1   rmind          * Ignore this warning/remark if it has been disabled by
    772  1.1.1.3.16.1   rmind          * the user (-vw option)
    773  1.1.1.3.16.1   rmind          */
    774  1.1.1.3.16.1   rmind         EncodedMessageId = MessageId + ((Level + 1) * 1000);
    775  1.1.1.3.16.1   rmind         for (i = 0; i < Gbl_DisabledMessagesIndex; i++)
    776  1.1.1.3.16.1   rmind         {
    777  1.1.1.3.16.1   rmind             /* Simple implementation via fixed array */
    778  1.1.1.3.16.1   rmind 
    779  1.1.1.3.16.1   rmind             if (EncodedMessageId == Gbl_DisabledMessages[i])
    780  1.1.1.3.16.1   rmind             {
    781  1.1.1.3.16.1   rmind                 return (TRUE);
    782  1.1.1.3.16.1   rmind             }
    783  1.1.1.3.16.1   rmind         }
    784  1.1.1.3.16.1   rmind         break;
    785  1.1.1.3.16.1   rmind 
    786  1.1.1.3.16.1   rmind     default:
    787  1.1.1.3.16.1   rmind         break;
    788  1.1.1.3.16.1   rmind     }
    789  1.1.1.3.16.1   rmind 
    790  1.1.1.3.16.1   rmind     return (FALSE);
    791  1.1.1.3.16.1   rmind }
    792  1.1.1.3.16.1   rmind 
    793  1.1.1.3.16.1   rmind 
    794  1.1.1.3.16.1   rmind /*******************************************************************************
    795  1.1.1.3.16.1   rmind  *
    796           1.1  jruoho  * FUNCTION:    AslError
    797           1.1  jruoho  *
    798           1.1  jruoho  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
    799           1.1  jruoho  *              MessageId           - Index into global message buffer
    800           1.1  jruoho  *              Op                  - Parse node where error happened
    801           1.1  jruoho  *              ExtraMessage        - additional error message
    802           1.1  jruoho  *
    803           1.1  jruoho  * RETURN:      None
    804           1.1  jruoho  *
    805           1.1  jruoho  * DESCRIPTION: Main error reporting routine for the ASL compiler (all code
    806           1.1  jruoho  *              except the parser.)
    807           1.1  jruoho  *
    808           1.1  jruoho  ******************************************************************************/
    809           1.1  jruoho 
    810           1.1  jruoho void
    811           1.1  jruoho AslError (
    812           1.1  jruoho     UINT8                   Level,
    813           1.1  jruoho     UINT8                   MessageId,
    814           1.1  jruoho     ACPI_PARSE_OBJECT       *Op,
    815           1.1  jruoho     char                    *ExtraMessage)
    816           1.1  jruoho {
    817           1.1  jruoho 
    818  1.1.1.3.16.1   rmind     /* Check if user wants to ignore this exception */
    819           1.1  jruoho 
    820  1.1.1.3.16.1   rmind     if (AslIsExceptionDisabled (Level, MessageId))
    821  1.1.1.3.16.1   rmind     {
    822  1.1.1.3.16.1   rmind         return;
    823           1.1  jruoho     }
    824           1.1  jruoho 
    825           1.1  jruoho     if (Op)
    826           1.1  jruoho     {
    827           1.1  jruoho         AslCommonError (Level, MessageId, Op->Asl.LineNumber,
    828  1.1.1.3.16.1   rmind             Op->Asl.LogicalLineNumber,
    829  1.1.1.3.16.1   rmind             Op->Asl.LogicalByteOffset,
    830  1.1.1.3.16.1   rmind             Op->Asl.Column,
    831  1.1.1.3.16.1   rmind             Op->Asl.Filename, ExtraMessage);
    832           1.1  jruoho     }
    833           1.1  jruoho     else
    834           1.1  jruoho     {
    835           1.1  jruoho         AslCommonError (Level, MessageId, 0,
    836  1.1.1.3.16.1   rmind             0, 0, 0, NULL, ExtraMessage);
    837           1.1  jruoho     }
    838           1.1  jruoho }
    839           1.1  jruoho 
    840           1.1  jruoho 
    841           1.1  jruoho /*******************************************************************************
    842           1.1  jruoho  *
    843           1.1  jruoho  * FUNCTION:    AslCoreSubsystemError
    844           1.1  jruoho  *
    845           1.1  jruoho  * PARAMETERS:  Op                  - Parse node where error happened
    846           1.1  jruoho  *              Status              - The ACPI CA Exception
    847           1.1  jruoho  *              ExtraMessage        - additional error message
    848           1.1  jruoho  *              Abort               - TRUE -> Abort compilation
    849           1.1  jruoho  *
    850           1.1  jruoho  * RETURN:      None
    851           1.1  jruoho  *
    852           1.1  jruoho  * DESCRIPTION: Error reporting routine for exceptions returned by the ACPI
    853           1.1  jruoho  *              CA core subsystem.
    854           1.1  jruoho  *
    855           1.1  jruoho  ******************************************************************************/
    856           1.1  jruoho 
    857           1.1  jruoho void
    858           1.1  jruoho AslCoreSubsystemError (
    859           1.1  jruoho     ACPI_PARSE_OBJECT       *Op,
    860           1.1  jruoho     ACPI_STATUS             Status,
    861           1.1  jruoho     char                    *ExtraMessage,
    862           1.1  jruoho     BOOLEAN                 Abort)
    863           1.1  jruoho {
    864           1.1  jruoho 
    865  1.1.1.3.16.1   rmind     snprintf (MsgBuffer, sizeof(MsgBuffer), "%s %s", AcpiFormatException (Status), ExtraMessage);
    866           1.1  jruoho 
    867           1.1  jruoho     if (Op)
    868           1.1  jruoho     {
    869           1.1  jruoho         AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Op->Asl.LineNumber,
    870           1.1  jruoho                         Op->Asl.LogicalLineNumber,
    871           1.1  jruoho                         Op->Asl.LogicalByteOffset,
    872           1.1  jruoho                         Op->Asl.Column,
    873           1.1  jruoho                         Op->Asl.Filename, MsgBuffer);
    874           1.1  jruoho     }
    875           1.1  jruoho     else
    876           1.1  jruoho     {
    877           1.1  jruoho         AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, 0,
    878           1.1  jruoho                         0, 0, 0, NULL, MsgBuffer);
    879           1.1  jruoho     }
    880           1.1  jruoho 
    881           1.1  jruoho     if (Abort)
    882           1.1  jruoho     {
    883           1.1  jruoho         AslAbort ();
    884           1.1  jruoho     }
    885           1.1  jruoho }
    886           1.1  jruoho 
    887           1.1  jruoho 
    888           1.1  jruoho /*******************************************************************************
    889           1.1  jruoho  *
    890           1.1  jruoho  * FUNCTION:    AslCompilererror
    891           1.1  jruoho  *
    892           1.1  jruoho  * PARAMETERS:  CompilerMessage         - Error message from the parser
    893           1.1  jruoho  *
    894           1.1  jruoho  * RETURN:      Status (0 for now)
    895           1.1  jruoho  *
    896           1.1  jruoho  * DESCRIPTION: Report an error situation discovered in a production
    897           1.1  jruoho  *              NOTE: don't change the name of this function, it is called
    898           1.1  jruoho  *              from the auto-generated parser.
    899           1.1  jruoho  *
    900           1.1  jruoho  ******************************************************************************/
    901           1.1  jruoho 
    902           1.1  jruoho int
    903           1.1  jruoho AslCompilererror (
    904       1.1.1.3  jruoho     const char              *CompilerMessage)
    905           1.1  jruoho {
    906           1.1  jruoho 
    907           1.1  jruoho     AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber,
    908       1.1.1.3  jruoho         Gbl_LogicalLineNumber, Gbl_CurrentLineOffset,
    909       1.1.1.3  jruoho         Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename,
    910       1.1.1.3  jruoho         ACPI_CAST_PTR (char, CompilerMessage));
    911           1.1  jruoho 
    912  1.1.1.3.16.1   rmind     return (0);
    913           1.1  jruoho }
    914