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