Home | History | Annotate | Line # | Download | only in compiler
aslerror.c revision 1.1.1.3.2.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.2.1    yamt  * 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.2.1    yamt /*******************************************************************************
     58  1.1.1.3.2.1    yamt  *
     59  1.1.1.3.2.1    yamt  * FUNCTION:    AeClearErrorLog
     60  1.1.1.3.2.1    yamt  *
     61  1.1.1.3.2.1    yamt  * PARAMETERS:  None
     62  1.1.1.3.2.1    yamt  *
     63  1.1.1.3.2.1    yamt  * RETURN:      None
     64  1.1.1.3.2.1    yamt  *
     65  1.1.1.3.2.1    yamt  * DESCRIPTION: Empty the error list
     66  1.1.1.3.2.1    yamt  *
     67  1.1.1.3.2.1    yamt  ******************************************************************************/
     68  1.1.1.3.2.1    yamt 
     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.2.1    yamt  * 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.2.1    yamt     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.2.1    yamt     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.2.1    yamt         case ASL_WARNING:
    204  1.1.1.3.2.1    yamt         case ASL_WARNING2:
    205  1.1.1.3.2.1    yamt         case ASL_WARNING3:
    206  1.1.1.3.2.1    yamt 
    207  1.1.1.3.2.1    yamt             if (!Gbl_DisplayWarnings)
    208  1.1.1.3.2.1    yamt             {
    209  1.1.1.3.2.1    yamt                 return;
    210  1.1.1.3.2.1    yamt             }
    211  1.1.1.3.2.1    yamt             break;
    212  1.1.1.3.2.1    yamt 
    213          1.1  jruoho         case ASL_REMARK:
    214  1.1.1.3.2.1    yamt 
    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.2.1    yamt 
    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.2.1    yamt 
    231          1.1  jruoho             break;
    232          1.1  jruoho         }
    233          1.1  jruoho     }
    234          1.1  jruoho 
    235  1.1.1.3.2.1    yamt     /* 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.2.1    yamt     if (!Enode->SourceLine)
    240      1.1.1.2  jruoho     {
    241  1.1.1.3.2.1    yamt         /* Use the merged header/source file if present, otherwise use input file */
    242      1.1.1.2  jruoho 
    243  1.1.1.3.2.1    yamt         SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
    244  1.1.1.3.2.1    yamt         if (!SourceFile)
    245  1.1.1.3.2.1    yamt         {
    246  1.1.1.3.2.1    yamt             SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle;
    247  1.1.1.3.2.1    yamt         }
    248      1.1.1.2  jruoho 
    249  1.1.1.3.2.1    yamt         if (SourceFile)
    250      1.1.1.2  jruoho         {
    251  1.1.1.3.2.1    yamt             /* Determine if the error occurred at source file EOF */
    252  1.1.1.3.2.1    yamt 
    253  1.1.1.3.2.1    yamt             fseek (SourceFile, 0, SEEK_END);
    254  1.1.1.3.2.1    yamt             FileSize = ftell (SourceFile);
    255  1.1.1.3.2.1    yamt 
    256  1.1.1.3.2.1    yamt             if ((long) Enode->LogicalByteOffset >= FileSize)
    257  1.1.1.3.2.1    yamt             {
    258  1.1.1.3.2.1    yamt                 PrematureEOF = TRUE;
    259  1.1.1.3.2.1    yamt             }
    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.2.1    yamt             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.2.1    yamt                 if (Enode->SourceLine)
    279          1.1  jruoho                 {
    280  1.1.1.3.2.1    yamt                     fprintf (OutputFile, " %6u: %s",
    281  1.1.1.3.2.1    yamt                         Enode->LineNumber, Enode->SourceLine);
    282  1.1.1.3.2.1    yamt                 }
    283  1.1.1.3.2.1    yamt                 else
    284  1.1.1.3.2.1    yamt                 {
    285  1.1.1.3.2.1    yamt                     fprintf (OutputFile, " %6u: ", Enode->LineNumber);
    286  1.1.1.3.2.1    yamt 
    287      1.1.1.2  jruoho                     /*
    288  1.1.1.3.2.1    yamt                      * If not at EOF, get the corresponding source code line and
    289  1.1.1.3.2.1    yamt                      * display it. Don't attempt this if we have a premature EOF
    290  1.1.1.3.2.1    yamt                      * condition.
    291      1.1.1.2  jruoho                      */
    292  1.1.1.3.2.1    yamt                     if (!PrematureEOF)
    293          1.1  jruoho                     {
    294  1.1.1.3.2.1    yamt                         /*
    295  1.1.1.3.2.1    yamt                          * Seek to the offset in the combined source file, read
    296  1.1.1.3.2.1    yamt                          * the source line, and write it to the output.
    297  1.1.1.3.2.1    yamt                          */
    298  1.1.1.3.2.1    yamt                         Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset,
    299  1.1.1.3.2.1    yamt                                     (int) SEEK_SET);
    300  1.1.1.3.2.1    yamt                         if (Actual)
    301      1.1.1.2  jruoho                         {
    302      1.1.1.2  jruoho                             fprintf (OutputFile,
    303  1.1.1.3.2.1    yamt                                 "[*** 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.2.1    yamt                         else
    307      1.1.1.2  jruoho                         {
    308      1.1.1.2  jruoho                             RActual = fread (&SourceByte, 1, 1, SourceFile);
    309  1.1.1.3.2.1    yamt                             if (RActual != 1)
    310  1.1.1.3.2.1    yamt                             {
    311  1.1.1.3.2.1    yamt                                 fprintf (OutputFile,
    312  1.1.1.3.2.1    yamt                                     "[*** iASL: Read error on source code temp file %s ***]",
    313  1.1.1.3.2.1    yamt                                     Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
    314  1.1.1.3.2.1    yamt                             }
    315  1.1.1.3.2.1    yamt                             else
    316  1.1.1.3.2.1    yamt                             {
    317  1.1.1.3.2.1    yamt                                 /* Read/write the source line, up to the maximum line length */
    318  1.1.1.3.2.1    yamt 
    319  1.1.1.3.2.1    yamt                                 while (RActual && SourceByte && (SourceByte != '\n'))
    320  1.1.1.3.2.1    yamt                                 {
    321  1.1.1.3.2.1    yamt                                     if (Total < 256)
    322  1.1.1.3.2.1    yamt                                     {
    323  1.1.1.3.2.1    yamt                                         /* After the max line length, we will just read the line, no write */
    324  1.1.1.3.2.1    yamt 
    325  1.1.1.3.2.1    yamt                                         if (fwrite (&SourceByte, 1, 1, OutputFile) != 1)
    326  1.1.1.3.2.1    yamt                                         {
    327  1.1.1.3.2.1    yamt                                             printf ("[*** iASL: Write error on output file ***]\n");
    328  1.1.1.3.2.1    yamt                                             return;
    329  1.1.1.3.2.1    yamt                                         }
    330  1.1.1.3.2.1    yamt                                     }
    331  1.1.1.3.2.1    yamt                                     else if (Total == 256)
    332  1.1.1.3.2.1    yamt                                     {
    333  1.1.1.3.2.1    yamt                                         fprintf (OutputFile,
    334  1.1.1.3.2.1    yamt                                             "\n[*** iASL: Very long input line, message below refers to column %u ***]",
    335  1.1.1.3.2.1    yamt                                             Enode->Column);
    336  1.1.1.3.2.1    yamt                                     }
    337  1.1.1.3.2.1    yamt 
    338  1.1.1.3.2.1    yamt                                     RActual = fread (&SourceByte, 1, 1, SourceFile);
    339  1.1.1.3.2.1    yamt                                     if (RActual != 1)
    340  1.1.1.3.2.1    yamt                                     {
    341  1.1.1.3.2.1    yamt                                         fprintf (OutputFile,
    342  1.1.1.3.2.1    yamt                                             "[*** iASL: Read error on source code temp file %s ***]",
    343  1.1.1.3.2.1    yamt                                             Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
    344  1.1.1.3.2.1    yamt                                         return;
    345  1.1.1.3.2.1    yamt                                     }
    346  1.1.1.3.2.1    yamt                                     Total++;
    347  1.1.1.3.2.1    yamt                                 }
    348  1.1.1.3.2.1    yamt                             }
    349      1.1.1.2  jruoho                         }
    350          1.1  jruoho                     }
    351      1.1.1.2  jruoho 
    352  1.1.1.3.2.1    yamt                     fprintf (OutputFile, "\n");
    353  1.1.1.3.2.1    yamt                 }
    354          1.1  jruoho             }
    355          1.1  jruoho         }
    356          1.1  jruoho         else
    357          1.1  jruoho         {
    358  1.1.1.3.2.1    yamt             /*
    359  1.1.1.3.2.1    yamt              * Less verbose version of the error message, enabled via the
    360  1.1.1.3.2.1    yamt              * -vi switch. The format is compatible with MS Visual Studio.
    361  1.1.1.3.2.1    yamt              */
    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.2.1    yamt                 fprintf (OutputFile, "(%u) : ",
    367  1.1.1.3.2.1    yamt                     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.2.1    yamt         if (Gbl_VerboseErrors)
    383  1.1.1.3.2.1    yamt         {
    384  1.1.1.3.2.1    yamt             fprintf (OutputFile, "%s %4.4d -",
    385  1.1.1.3.2.1    yamt                         AslErrorLevel[Enode->Level],
    386  1.1.1.3.2.1    yamt                         Enode->MessageId + ((Enode->Level+1) * 1000));
    387  1.1.1.3.2.1    yamt         }
    388  1.1.1.3.2.1    yamt         else /* IDE case */
    389  1.1.1.3.2.1    yamt         {
    390  1.1.1.3.2.1    yamt             fprintf (OutputFile, "%s %4.4d:",
    391  1.1.1.3.2.1    yamt                         AslErrorLevelIde[Enode->Level],
    392  1.1.1.3.2.1    yamt                         Enode->MessageId + ((Enode->Level+1) * 1000));
    393  1.1.1.3.2.1    yamt         }
    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.2.1    yamt             /* Main message: try to use string from AslMessages first */
    401  1.1.1.3.2.1    yamt 
    402  1.1.1.3.2.1    yamt             if (!MainMessage)
    403  1.1.1.3.2.1    yamt             {
    404  1.1.1.3.2.1    yamt                 MainMessage = "";
    405  1.1.1.3.2.1    yamt             }
    406  1.1.1.3.2.1    yamt 
    407          1.1  jruoho             MsgLength = strlen (MainMessage);
    408          1.1  jruoho             if (MsgLength == 0)
    409          1.1  jruoho             {
    410  1.1.1.3.2.1    yamt                 /* Use the secondary/extra message as main message */
    411  1.1.1.3.2.1    yamt 
    412          1.1  jruoho                 MainMessage = Enode->Message;
    413  1.1.1.3.2.1    yamt                 if (!MainMessage)
    414  1.1.1.3.2.1    yamt                 {
    415  1.1.1.3.2.1    yamt                     MainMessage = "";
    416  1.1.1.3.2.1    yamt                 }
    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.2.1    yamt                 if (Total >= 256)
    425          1.1  jruoho                 {
    426  1.1.1.3.2.1    yamt                     fprintf (OutputFile, "    %s",
    427  1.1.1.3.2.1    yamt                         MainMessage);
    428          1.1  jruoho                 }
    429          1.1  jruoho                 else
    430          1.1  jruoho                 {
    431  1.1.1.3.2.1    yamt                     SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2;
    432  1.1.1.3.2.1    yamt                     ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1;
    433  1.1.1.3.2.1    yamt 
    434  1.1.1.3.2.1    yamt                     if ((MsgLength + ErrorColumn) < (SourceColumn - 1))
    435  1.1.1.3.2.1    yamt                     {
    436  1.1.1.3.2.1    yamt                         fprintf (OutputFile, "%*s%s",
    437  1.1.1.3.2.1    yamt                             (int) ((SourceColumn - 1) - ErrorColumn),
    438  1.1.1.3.2.1    yamt                             MainMessage, " ^ ");
    439  1.1.1.3.2.1    yamt                     }
    440  1.1.1.3.2.1    yamt                     else
    441  1.1.1.3.2.1    yamt                     {
    442  1.1.1.3.2.1    yamt                         fprintf (OutputFile, "%*s %s",
    443  1.1.1.3.2.1    yamt                             (int) ((SourceColumn - ErrorColumn) + 1), "^",
    444  1.1.1.3.2.1    yamt                             MainMessage);
    445  1.1.1.3.2.1    yamt                     }
    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.2.1    yamt  * FUNCTION:    AslCommonError2
    511  1.1.1.3.2.1    yamt  *
    512  1.1.1.3.2.1    yamt  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
    513  1.1.1.3.2.1    yamt  *              MessageId           - Index into global message buffer
    514  1.1.1.3.2.1    yamt  *              LineNumber          - Actual file line number
    515  1.1.1.3.2.1    yamt  *              Column              - Column in current line
    516  1.1.1.3.2.1    yamt  *              SourceLine          - Actual source code line
    517  1.1.1.3.2.1    yamt  *              Filename            - source filename
    518  1.1.1.3.2.1    yamt  *              ExtraMessage        - additional error message
    519  1.1.1.3.2.1    yamt  *
    520  1.1.1.3.2.1    yamt  * RETURN:      None
    521  1.1.1.3.2.1    yamt  *
    522  1.1.1.3.2.1    yamt  * DESCRIPTION: Create a new error node and add it to the error log
    523  1.1.1.3.2.1    yamt  *
    524  1.1.1.3.2.1    yamt  ******************************************************************************/
    525  1.1.1.3.2.1    yamt 
    526  1.1.1.3.2.1    yamt void
    527  1.1.1.3.2.1    yamt AslCommonError2 (
    528  1.1.1.3.2.1    yamt     UINT8                   Level,
    529  1.1.1.3.2.1    yamt     UINT8                   MessageId,
    530  1.1.1.3.2.1    yamt     UINT32                  LineNumber,
    531  1.1.1.3.2.1    yamt     UINT32                  Column,
    532  1.1.1.3.2.1    yamt     char                    *SourceLine,
    533  1.1.1.3.2.1    yamt     char                    *Filename,
    534  1.1.1.3.2.1    yamt     char                    *ExtraMessage)
    535  1.1.1.3.2.1    yamt {
    536  1.1.1.3.2.1    yamt     char                    *MessageBuffer = NULL;
    537  1.1.1.3.2.1    yamt     char                    *LineBuffer;
    538  1.1.1.3.2.1    yamt     ASL_ERROR_MSG           *Enode;
    539  1.1.1.3.2.1    yamt 
    540  1.1.1.3.2.1    yamt 
    541  1.1.1.3.2.1    yamt     Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG));
    542  1.1.1.3.2.1    yamt 
    543  1.1.1.3.2.1    yamt     if (ExtraMessage)
    544  1.1.1.3.2.1    yamt     {
    545  1.1.1.3.2.1    yamt         /* Allocate a buffer for the message and a new error node */
    546  1.1.1.3.2.1    yamt 
    547  1.1.1.3.2.1    yamt         MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1);
    548  1.1.1.3.2.1    yamt 
    549  1.1.1.3.2.1    yamt         /* Keep a copy of the extra message */
    550  1.1.1.3.2.1    yamt 
    551  1.1.1.3.2.1    yamt         ACPI_STRCPY (MessageBuffer, ExtraMessage);
    552  1.1.1.3.2.1    yamt     }
    553  1.1.1.3.2.1    yamt 
    554  1.1.1.3.2.1    yamt     LineBuffer = UtLocalCalloc (strlen (SourceLine) + 1);
    555  1.1.1.3.2.1    yamt     ACPI_STRCPY (LineBuffer, SourceLine);
    556  1.1.1.3.2.1    yamt 
    557  1.1.1.3.2.1    yamt     /* Initialize the error node */
    558  1.1.1.3.2.1    yamt 
    559  1.1.1.3.2.1    yamt     if (Filename)
    560  1.1.1.3.2.1    yamt     {
    561  1.1.1.3.2.1    yamt         Enode->Filename       = Filename;
    562  1.1.1.3.2.1    yamt         Enode->FilenameLength = strlen (Filename);
    563  1.1.1.3.2.1    yamt         if (Enode->FilenameLength < 6)
    564  1.1.1.3.2.1    yamt         {
    565  1.1.1.3.2.1    yamt             Enode->FilenameLength = 6;
    566  1.1.1.3.2.1    yamt         }
    567  1.1.1.3.2.1    yamt     }
    568  1.1.1.3.2.1    yamt 
    569  1.1.1.3.2.1    yamt     Enode->MessageId            = MessageId;
    570  1.1.1.3.2.1    yamt     Enode->Level                = Level;
    571  1.1.1.3.2.1    yamt     Enode->LineNumber           = LineNumber;
    572  1.1.1.3.2.1    yamt     Enode->LogicalLineNumber    = LineNumber;
    573  1.1.1.3.2.1    yamt     Enode->LogicalByteOffset    = 0;
    574  1.1.1.3.2.1    yamt     Enode->Column               = Column;
    575  1.1.1.3.2.1    yamt     Enode->Message              = MessageBuffer;
    576  1.1.1.3.2.1    yamt     Enode->SourceLine           = LineBuffer;
    577  1.1.1.3.2.1    yamt 
    578  1.1.1.3.2.1    yamt     /* Add the new node to the error node list */
    579  1.1.1.3.2.1    yamt 
    580  1.1.1.3.2.1    yamt     AeAddToErrorLog (Enode);
    581  1.1.1.3.2.1    yamt 
    582  1.1.1.3.2.1    yamt     if (Gbl_DebugFlag)
    583  1.1.1.3.2.1    yamt     {
    584  1.1.1.3.2.1    yamt         /* stderr is a file, send error to it immediately */
    585  1.1.1.3.2.1    yamt 
    586  1.1.1.3.2.1    yamt         AePrintException (ASL_FILE_STDERR, Enode, NULL);
    587  1.1.1.3.2.1    yamt     }
    588  1.1.1.3.2.1    yamt 
    589  1.1.1.3.2.1    yamt     Gbl_ExceptionCount[Level]++;
    590  1.1.1.3.2.1    yamt }
    591  1.1.1.3.2.1    yamt 
    592  1.1.1.3.2.1    yamt 
    593  1.1.1.3.2.1    yamt /*******************************************************************************
    594  1.1.1.3.2.1    yamt  *
    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.2.1    yamt         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.2.1    yamt     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.2.1    yamt  * FUNCTION:    AslDisableException
    690  1.1.1.3.2.1    yamt  *
    691  1.1.1.3.2.1    yamt  * PARAMETERS:  MessageIdString     - ID to be disabled
    692  1.1.1.3.2.1    yamt  *
    693  1.1.1.3.2.1    yamt  * RETURN:      Status
    694  1.1.1.3.2.1    yamt  *
    695  1.1.1.3.2.1    yamt  * DESCRIPTION: Enter a message ID into the global disabled messages table
    696  1.1.1.3.2.1    yamt  *
    697  1.1.1.3.2.1    yamt  ******************************************************************************/
    698  1.1.1.3.2.1    yamt 
    699  1.1.1.3.2.1    yamt ACPI_STATUS
    700  1.1.1.3.2.1    yamt AslDisableException (
    701  1.1.1.3.2.1    yamt     char                    *MessageIdString)
    702  1.1.1.3.2.1    yamt {
    703  1.1.1.3.2.1    yamt     UINT32                  MessageId;
    704  1.1.1.3.2.1    yamt 
    705  1.1.1.3.2.1    yamt 
    706  1.1.1.3.2.1    yamt     /* Convert argument to an integer and validate it */
    707  1.1.1.3.2.1    yamt 
    708  1.1.1.3.2.1    yamt     MessageId = (UINT32) strtoul (MessageIdString, NULL, 0);
    709  1.1.1.3.2.1    yamt 
    710  1.1.1.3.2.1    yamt     if ((MessageId < 2000) || (MessageId > 5999))
    711  1.1.1.3.2.1    yamt     {
    712  1.1.1.3.2.1    yamt         printf ("\"%s\" is not a valid warning/remark ID\n",
    713  1.1.1.3.2.1    yamt             MessageIdString);
    714  1.1.1.3.2.1    yamt         return (AE_BAD_PARAMETER);
    715  1.1.1.3.2.1    yamt     }
    716  1.1.1.3.2.1    yamt 
    717  1.1.1.3.2.1    yamt     /* Insert value into the global disabled message array */
    718  1.1.1.3.2.1    yamt 
    719  1.1.1.3.2.1    yamt     if (Gbl_DisabledMessagesIndex >= ASL_MAX_DISABLED_MESSAGES)
    720  1.1.1.3.2.1    yamt     {
    721  1.1.1.3.2.1    yamt         printf ("Too many messages have been disabled (max %u)\n",
    722  1.1.1.3.2.1    yamt             ASL_MAX_DISABLED_MESSAGES);
    723  1.1.1.3.2.1    yamt         return (AE_LIMIT);
    724  1.1.1.3.2.1    yamt     }
    725  1.1.1.3.2.1    yamt 
    726  1.1.1.3.2.1    yamt     Gbl_DisabledMessages[Gbl_DisabledMessagesIndex] = MessageId;
    727  1.1.1.3.2.1    yamt     Gbl_DisabledMessagesIndex++;
    728  1.1.1.3.2.1    yamt     return (AE_OK);
    729  1.1.1.3.2.1    yamt }
    730  1.1.1.3.2.1    yamt 
    731  1.1.1.3.2.1    yamt 
    732  1.1.1.3.2.1    yamt /*******************************************************************************
    733  1.1.1.3.2.1    yamt  *
    734  1.1.1.3.2.1    yamt  * FUNCTION:    AslIsExceptionDisabled
    735  1.1.1.3.2.1    yamt  *
    736  1.1.1.3.2.1    yamt  * PARAMETERS:  Level               - Seriousness (Warning/error, etc.)
    737  1.1.1.3.2.1    yamt  *              MessageId           - Index into global message buffer
    738  1.1.1.3.2.1    yamt  *
    739  1.1.1.3.2.1    yamt  * RETURN:      TRUE if exception/message should be ignored
    740  1.1.1.3.2.1    yamt  *
    741  1.1.1.3.2.1    yamt  * DESCRIPTION: Check if the user has specified options such that this
    742  1.1.1.3.2.1    yamt  *              exception should be ignored
    743  1.1.1.3.2.1    yamt  *
    744  1.1.1.3.2.1    yamt  ******************************************************************************/
    745  1.1.1.3.2.1    yamt 
    746  1.1.1.3.2.1    yamt BOOLEAN
    747  1.1.1.3.2.1    yamt AslIsExceptionDisabled (
    748  1.1.1.3.2.1    yamt     UINT8                   Level,
    749  1.1.1.3.2.1    yamt     UINT8                   MessageId)
    750  1.1.1.3.2.1    yamt {
    751  1.1.1.3.2.1    yamt     UINT32                  EncodedMessageId;
    752  1.1.1.3.2.1    yamt     UINT32                  i;
    753  1.1.1.3.2.1    yamt 
    754  1.1.1.3.2.1    yamt 
    755  1.1.1.3.2.1    yamt     switch (Level)
    756  1.1.1.3.2.1    yamt     {
    757  1.1.1.3.2.1    yamt     case ASL_WARNING2:
    758  1.1.1.3.2.1    yamt     case ASL_WARNING3:
    759  1.1.1.3.2.1    yamt 
    760  1.1.1.3.2.1    yamt         /* Check for global disable via -w1/-w2/-w3 options */
    761  1.1.1.3.2.1    yamt 
    762  1.1.1.3.2.1    yamt         if (Level > Gbl_WarningLevel)
    763  1.1.1.3.2.1    yamt         {
    764  1.1.1.3.2.1    yamt             return (TRUE);
    765  1.1.1.3.2.1    yamt         }
    766  1.1.1.3.2.1    yamt         /* Fall through */
    767  1.1.1.3.2.1    yamt 
    768  1.1.1.3.2.1    yamt     case ASL_WARNING:
    769  1.1.1.3.2.1    yamt     case ASL_REMARK:
    770  1.1.1.3.2.1    yamt         /*
    771  1.1.1.3.2.1    yamt          * Ignore this warning/remark if it has been disabled by
    772  1.1.1.3.2.1    yamt          * the user (-vw option)
    773  1.1.1.3.2.1    yamt          */
    774  1.1.1.3.2.1    yamt         EncodedMessageId = MessageId + ((Level + 1) * 1000);
    775  1.1.1.3.2.1    yamt         for (i = 0; i < Gbl_DisabledMessagesIndex; i++)
    776  1.1.1.3.2.1    yamt         {
    777  1.1.1.3.2.1    yamt             /* Simple implementation via fixed array */
    778  1.1.1.3.2.1    yamt 
    779  1.1.1.3.2.1    yamt             if (EncodedMessageId == Gbl_DisabledMessages[i])
    780  1.1.1.3.2.1    yamt             {
    781  1.1.1.3.2.1    yamt                 return (TRUE);
    782  1.1.1.3.2.1    yamt             }
    783  1.1.1.3.2.1    yamt         }
    784  1.1.1.3.2.1    yamt         break;
    785  1.1.1.3.2.1    yamt 
    786  1.1.1.3.2.1    yamt     default:
    787  1.1.1.3.2.1    yamt         break;
    788  1.1.1.3.2.1    yamt     }
    789  1.1.1.3.2.1    yamt 
    790  1.1.1.3.2.1    yamt     return (FALSE);
    791  1.1.1.3.2.1    yamt }
    792  1.1.1.3.2.1    yamt 
    793  1.1.1.3.2.1    yamt 
    794  1.1.1.3.2.1    yamt /*******************************************************************************
    795  1.1.1.3.2.1    yamt  *
    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.2.1    yamt     /* Check if user wants to ignore this exception */
    819          1.1  jruoho 
    820  1.1.1.3.2.1    yamt     if (AslIsExceptionDisabled (Level, MessageId))
    821  1.1.1.3.2.1    yamt     {
    822  1.1.1.3.2.1    yamt         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.2.1    yamt             Op->Asl.LogicalLineNumber,
    829  1.1.1.3.2.1    yamt             Op->Asl.LogicalByteOffset,
    830  1.1.1.3.2.1    yamt             Op->Asl.Column,
    831  1.1.1.3.2.1    yamt             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.2.1    yamt             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.2.1    yamt     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.2.1    yamt     return (0);
    913          1.1  jruoho }
    914