Sync ACPICA with Intel's version 20180508 (from previously 20170831).
[dragonfly.git] / sys / contrib / dev / acpica / source / compiler / asllisting.c
blob9c35ff33880f782a875776cae322bfc659e7c10c
1 /******************************************************************************
3 * Module Name: asllisting - Listing file generation
5 *****************************************************************************/
7 /******************************************************************************
9 * 1. Copyright Notice
11 * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
12 * All rights reserved.
14 * 2. License
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
19 * property rights.
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
40 * 3. Conditions
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
64 * make.
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
70 * distribution.
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 * PARTICULAR PURPOSE.
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 * LIMITED REMEDY.
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
117 * following license:
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
121 * are met:
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
150 *****************************************************************************/
152 #include "aslcompiler.h"
153 #include "aslcompiler.y.h"
154 #include "amlcode.h"
155 #include "acparser.h"
156 #include "acnamesp.h"
159 #define _COMPONENT ACPI_COMPILER
160 ACPI_MODULE_NAME ("asllisting")
163 /* Local prototypes */
165 static void
166 LsGenerateListing (
167 UINT32 FileId);
169 static ACPI_STATUS
170 LsAmlListingWalk (
171 ACPI_PARSE_OBJECT *Op,
172 UINT32 Level,
173 void *Context);
175 static ACPI_STATUS
176 LsTreeWriteWalk (
177 ACPI_PARSE_OBJECT *Op,
178 UINT32 Level,
179 void *Context);
181 static void
182 LsWriteNodeToListing (
183 ACPI_PARSE_OBJECT *Op,
184 UINT32 FileId);
186 static void
187 LsFinishSourceListing (
188 UINT32 FileId);
191 /*******************************************************************************
193 * FUNCTION: LsDoListings
195 * PARAMETERS: None. Examines the various output file global flags.
197 * RETURN: None
199 * DESCRIPTION: Generate all requested listing files.
201 ******************************************************************************/
203 void
204 LsDoListings (
205 void)
208 if (Gbl_C_OutputFlag)
210 LsGenerateListing (ASL_FILE_C_SOURCE_OUTPUT);
213 if (Gbl_ListingFlag)
215 LsGenerateListing (ASL_FILE_LISTING_OUTPUT);
218 if (Gbl_AsmOutputFlag)
220 LsGenerateListing (ASL_FILE_ASM_SOURCE_OUTPUT);
223 if (Gbl_C_IncludeOutputFlag)
225 LsGenerateListing (ASL_FILE_C_INCLUDE_OUTPUT);
228 if (Gbl_AsmIncludeOutputFlag)
230 LsGenerateListing (ASL_FILE_ASM_INCLUDE_OUTPUT);
233 if (Gbl_C_OffsetTableFlag)
235 LsGenerateListing (ASL_FILE_C_OFFSET_OUTPUT);
240 /*******************************************************************************
242 * FUNCTION: LsGenerateListing
244 * PARAMETERS: FileId - ID of listing file
246 * RETURN: None
248 * DESCRIPTION: Generate a listing file. This can be one of the several types
249 * of "listings" supported.
251 ******************************************************************************/
253 static void
254 LsGenerateListing (
255 UINT32 FileId)
258 /* Start at the beginning of both the source and AML files */
260 FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0);
261 FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
262 Gbl_SourceLine = 0;
263 Gbl_CurrentHexColumn = 0;
264 LsPushNode (Gbl_Files[ASL_FILE_INPUT].Filename);
266 if (FileId == ASL_FILE_C_OFFSET_OUTPUT)
268 Gbl_CurrentAmlOffset = 0;
270 /* Offset table file has a special header and footer */
272 LsDoOffsetTableHeader (FileId);
274 TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
275 LsAmlOffsetWalk, NULL, (void *) ACPI_TO_POINTER (FileId));
276 LsDoOffsetTableFooter (FileId);
277 return;
280 /* Process all parse nodes */
282 TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
283 LsAmlListingWalk, NULL, (void *) ACPI_TO_POINTER (FileId));
285 /* Final processing */
287 LsFinishSourceListing (FileId);
291 /*******************************************************************************
293 * FUNCTION: LsAmlListingWalk
295 * PARAMETERS: ASL_WALK_CALLBACK
297 * RETURN: Status
299 * DESCRIPTION: Process one node during a listing file generation.
301 ******************************************************************************/
303 static ACPI_STATUS
304 LsAmlListingWalk (
305 ACPI_PARSE_OBJECT *Op,
306 UINT32 Level,
307 void *Context)
309 UINT8 FileByte;
310 UINT32 i;
311 UINT32 FileId = (UINT32) ACPI_TO_INTEGER (Context);
314 LsWriteNodeToListing (Op, FileId);
316 if (Op->Asl.CompileFlags & OP_IS_RESOURCE_DATA)
318 /* Buffer is a resource template, don't dump the data all at once */
320 return (AE_OK);
323 if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) ||
324 (FileId == ASL_FILE_C_INCLUDE_OUTPUT))
326 return (AE_OK);
329 /* Write the hex bytes to the listing file(s) (if requested) */
331 for (i = 0; i < Op->Asl.FinalAmlLength; i++)
333 if (ACPI_FAILURE (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1)))
335 FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
336 AslAbort ();
339 LsWriteListingHexBytes (&FileByte, 1, FileId);
342 return (AE_OK);
346 /*******************************************************************************
348 * FUNCTION: LsDumpParseTree, LsTreeWriteWalk
350 * PARAMETERS: None
352 * RETURN: None
354 * DESCRIPTION: Dump entire parse tree, for compiler debug only
356 ******************************************************************************/
358 void
359 LsDumpParseTree (
360 void)
363 if (!Gbl_DebugFlag)
365 return;
368 DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n");
369 DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER1);
371 TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
372 LsTreeWriteWalk, NULL, NULL);
374 DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER1);
378 static ACPI_STATUS
379 LsTreeWriteWalk (
380 ACPI_PARSE_OBJECT *Op,
381 UINT32 Level,
382 void *Context)
385 /* Dump ParseOp name and possible value */
387 switch (Op->Asl.ParseOpcode)
389 case PARSEOP_NAMESEG:
390 case PARSEOP_NAMESTRING:
391 case PARSEOP_METHODCALL:
392 case PARSEOP_STRING_LITERAL:
394 UtDumpStringOp (Op, Level);
395 break;
397 case PARSEOP_BYTECONST:
399 UtDumpIntegerOp (Op, Level, 2);
400 break;
402 case PARSEOP_WORDCONST:
403 case PARSEOP_PACKAGE_LENGTH:
405 UtDumpIntegerOp (Op, Level, 4);
406 break;
408 case PARSEOP_DWORDCONST:
409 case PARSEOP_EISAID:
411 UtDumpIntegerOp (Op, Level, 8);
412 break;
414 case PARSEOP_QWORDCONST:
415 case PARSEOP_INTEGER:
416 case PARSEOP_ONE:
417 case PARSEOP_ZERO:
418 case PARSEOP_ONES:
420 UtDumpIntegerOp (Op, Level, 16);
421 break;
423 case PARSEOP_INCLUDE:
425 DbgPrint (ASL_TREE_OUTPUT,
426 "Open: %s\n", Op->Asl.Value.String);
427 return (AE_OK);
429 case PARSEOP_INCLUDE_END:
431 DbgPrint (ASL_TREE_OUTPUT,
432 "Close: %s\n", Op->Asl.Filename);
433 return (AE_OK);
435 default:
437 UtDumpBasicOp (Op, Level);
438 break;
441 /* Dump the remaining data */
443 DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_DEBUG1,
444 Op->Asl.ParseOpcode, Op->Asl.CompileFlags,
445 Op->Asl.LineNumber, Op->Asl.EndLine,
446 Op->Asl.LogicalLineNumber, Op->Asl.EndLogicalLine);
448 TrPrintOpFlags (Op->Asl.CompileFlags, ASL_TREE_OUTPUT);
449 DbgPrint (ASL_TREE_OUTPUT, "\n");
450 return (AE_OK);
454 /*******************************************************************************
456 * FUNCTION: LsWriteNodeToListing
458 * PARAMETERS: Op - Parse node to write to the listing file.
459 * FileId - ID of current listing file
461 * RETURN: None.
463 * DESCRIPTION: Write "a node" to the listing file. This means to
464 * 1) Write out all of the source text associated with the node
465 * 2) Write out all of the AML bytes associated with the node
466 * 3) Write any compiler exceptions associated with the node
468 ******************************************************************************/
470 static void
471 LsWriteNodeToListing (
472 ACPI_PARSE_OBJECT *Op,
473 UINT32 FileId)
475 const ACPI_OPCODE_INFO *OpInfo;
476 UINT32 OpClass;
477 char *Pathname;
478 UINT32 Length;
479 UINT32 i;
482 OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
483 OpClass = OpInfo->Class;
485 /* TBD: clean this up with a single flag that says:
486 * I start a named output block
488 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
490 switch (Op->Asl.ParseOpcode)
492 case PARSEOP_DEFINITION_BLOCK:
493 case PARSEOP_METHODCALL:
494 case PARSEOP_INCLUDE:
495 case PARSEOP_INCLUDE_END:
496 case PARSEOP_DEFAULT_ARG:
498 break;
500 default:
502 switch (OpClass)
504 case AML_CLASS_NAMED_OBJECT:
506 switch (Op->Asl.AmlOpcode)
508 case AML_SCOPE_OP:
509 case AML_ALIAS_OP:
511 break;
513 default:
515 if (Op->Asl.ExternalName)
517 LsFlushListingBuffer (FileId);
518 FlPrintFile (FileId, " };\n");
520 break;
522 break;
524 default:
526 /* Don't care about other objects */
528 break;
530 break;
534 /* These cases do not have a corresponding AML opcode */
536 switch (Op->Asl.ParseOpcode)
538 case PARSEOP_DEFINITION_BLOCK:
540 /* Always start a definition block at AML offset zero */
542 Gbl_CurrentAmlOffset = 0;
543 LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId);
545 /* Use the table Signature and TableId to build a unique name */
547 switch (FileId)
549 case ASL_FILE_ASM_SOURCE_OUTPUT:
551 FlPrintFile (FileId,
552 "%s_%s_Header \\\n",
553 Gbl_TableSignature, Gbl_TableId);
554 break;
556 case ASL_FILE_C_SOURCE_OUTPUT:
558 FlPrintFile (FileId,
559 " unsigned char %s_%s_Header [] =\n {\n",
560 Gbl_TableSignature, Gbl_TableId);
561 break;
563 case ASL_FILE_ASM_INCLUDE_OUTPUT:
565 FlPrintFile (FileId,
566 "extrn %s_%s_Header : byte\n",
567 Gbl_TableSignature, Gbl_TableId);
568 break;
570 case ASL_FILE_C_INCLUDE_OUTPUT:
572 FlPrintFile (FileId,
573 "extern unsigned char %s_%s_Header [];\n",
574 Gbl_TableSignature, Gbl_TableId);
575 break;
577 default:
578 break;
581 return;
584 case PARSEOP_METHODCALL:
586 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
587 FileId);
588 return;
591 case PARSEOP_INCLUDE:
593 /* Flush everything up to and including the include source line */
595 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
596 FileId);
598 /* Create a new listing node and push it */
600 LsPushNode (Op->Asl.Value.String);
601 return;
604 case PARSEOP_INCLUDE_END:
606 /* Flush out the rest of the include file */
608 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
609 FileId);
611 /* Pop off this listing node and go back to the parent file */
613 (void) LsPopNode ();
614 return;
617 case PARSEOP_DEFAULT_ARG:
619 if (Op->Asl.CompileFlags & OP_IS_RESOURCE_DESC)
621 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.EndLogicalLine,
622 FileId);
624 return;
627 default:
629 /* All other opcodes have an AML opcode */
631 break;
635 * Otherwise, we look at the AML opcode because we can
636 * switch on the opcode type, getting an entire class
637 * at once
639 switch (OpClass)
641 case AML_CLASS_ARGUMENT: /* argument type only */
642 case AML_CLASS_INTERNAL:
644 break;
646 case AML_CLASS_NAMED_OBJECT:
648 switch (Op->Asl.AmlOpcode)
650 case AML_FIELD_OP:
651 case AML_INDEX_FIELD_OP:
652 case AML_BANK_FIELD_OP:
654 * For fields, we want to dump all the AML after the
655 * entire definition
657 LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine,
658 FileId);
659 break;
661 case AML_NAME_OP:
663 if (Op->Asl.CompileFlags & OP_IS_RESOURCE_DESC)
665 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
666 FileId);
668 else
671 * For fields, we want to dump all the AML after the
672 * entire definition
674 LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine,
675 FileId);
677 break;
679 default:
681 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
682 FileId);
683 break;
686 switch (Op->Asl.AmlOpcode)
688 case AML_SCOPE_OP:
689 case AML_ALIAS_OP:
691 /* These opcodes do not declare a new object, ignore them */
693 break;
695 default:
697 /* All other named object opcodes come here */
699 switch (FileId)
701 case ASL_FILE_ASM_SOURCE_OUTPUT:
702 case ASL_FILE_C_SOURCE_OUTPUT:
703 case ASL_FILE_ASM_INCLUDE_OUTPUT:
704 case ASL_FILE_C_INCLUDE_OUTPUT:
706 * For named objects, we will create a valid symbol so that the
707 * AML code can be referenced from C or ASM
709 if (Op->Asl.ExternalName)
711 /* Get the full pathname associated with this node */
713 Pathname = AcpiNsGetExternalPathname (Op->Asl.Node);
714 Length = strlen (Pathname);
715 if (Length >= 4)
717 /* Convert all dots in the path to underscores */
719 for (i = 0; i < Length; i++)
721 if (Pathname[i] == '.')
723 Pathname[i] = '_';
727 /* Create the appropriate symbol in the output file */
729 switch (FileId)
731 case ASL_FILE_ASM_SOURCE_OUTPUT:
733 FlPrintFile (FileId,
734 "%s_%s_%s \\\n",
735 Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
736 break;
738 case ASL_FILE_C_SOURCE_OUTPUT:
740 FlPrintFile (FileId,
741 " unsigned char %s_%s_%s [] =\n {\n",
742 Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
743 break;
745 case ASL_FILE_ASM_INCLUDE_OUTPUT:
747 FlPrintFile (FileId,
748 "extrn %s_%s_%s : byte\n",
749 Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
750 break;
752 case ASL_FILE_C_INCLUDE_OUTPUT:
754 FlPrintFile (FileId,
755 "extern unsigned char %s_%s_%s [];\n",
756 Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
757 break;
759 default:
760 break;
764 ACPI_FREE (Pathname);
766 break;
768 default:
770 /* Nothing to do for listing file */
772 break;
775 break;
777 case AML_CLASS_EXECUTE:
778 case AML_CLASS_CREATE:
779 default:
781 if ((Op->Asl.ParseOpcode == PARSEOP_BUFFER) &&
782 (Op->Asl.CompileFlags & OP_IS_RESOURCE_DESC))
784 return;
787 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
788 FileId);
789 break;
791 case AML_CLASS_UNKNOWN:
793 break;
798 /*******************************************************************************
800 * FUNCTION: LsFinishSourceListing
802 * PARAMETERS: FileId - ID of current listing file.
804 * RETURN: None
806 * DESCRIPTION: Cleanup routine for the listing file. Flush the hex AML
807 * listing buffer, and flush out any remaining lines in the
808 * source input file.
810 ******************************************************************************/
812 static void
813 LsFinishSourceListing (
814 UINT32 FileId)
817 if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) ||
818 (FileId == ASL_FILE_C_INCLUDE_OUTPUT))
820 return;
823 LsFlushListingBuffer (FileId);
824 Gbl_CurrentAmlOffset = 0;
826 /* Flush any remaining text in the source file */
828 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
830 FlPrintFile (FileId, " /*\n");
833 while (LsWriteOneSourceLine (FileId))
834 { ; }
836 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
838 FlPrintFile (FileId, "\n */\n };\n");
841 FlPrintFile (FileId, "\n");
843 if (FileId == ASL_FILE_LISTING_OUTPUT)
845 /* Print a summary of the compile exceptions */
847 FlPrintFile (FileId, "\n\nSummary of errors and warnings\n\n");
848 AePrintErrorLog (FileId);
849 FlPrintFile (FileId, "\n");
850 UtDisplaySummary (FileId);
851 FlPrintFile (FileId, "\n");