1 /******************************************************************************
3 * Module Name: asllisting - Listing file generation
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2012, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
45 #include "aslcompiler.h"
46 #include "aslcompiler.y.h"
51 #define _COMPONENT ACPI_COMPILER
52 ACPI_MODULE_NAME ("aslisting")
54 /* Local prototypes */
64 ACPI_PARSE_OBJECT *Op,
76 static ASL_LISTING_NODE *
86 LsFlushListingBuffer (
90 LsWriteListingHexBytes (
96 LsWriteOneSourceLine (
100 LsFinishSourceListing (
106 UINT32 ToLogicalLineNumber,
110 LsWriteNodeToListing (
111 ACPI_PARSE_OBJECT *Op,
116 ACPI_PARSE_OBJECT *Op,
121 /*******************************************************************************
123 * FUNCTION: LsDoListings
129 * DESCRIPTION: Generate all requested listing files.
131 ******************************************************************************/
138 if (Gbl_C_OutputFlag)
140 LsGenerateListing (ASL_FILE_C_SOURCE_OUTPUT);
145 LsGenerateListing (ASL_FILE_LISTING_OUTPUT);
148 if (Gbl_AsmOutputFlag)
150 LsGenerateListing (ASL_FILE_ASM_SOURCE_OUTPUT);
153 if (Gbl_C_IncludeOutputFlag)
155 LsGenerateListing (ASL_FILE_C_INCLUDE_OUTPUT);
158 if (Gbl_AsmIncludeOutputFlag)
160 LsGenerateListing (ASL_FILE_ASM_INCLUDE_OUTPUT);
165 /*******************************************************************************
167 * FUNCTION: LsTreeWriteWalk
169 * PARAMETERS: ASL_WALK_CALLBACK
174 * DESCRIPTION: Dump entire parse tree, for compiler debug only
176 ******************************************************************************/
180 ACPI_PARSE_OBJECT *Op,
187 DbgPrint (ASL_TREE_OUTPUT,
188 "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level);
189 UtPrintFormattedName (Op->Asl.ParseOpcode, Level);
192 DbgPrint (ASL_TREE_OUTPUT, "\n");
207 DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n");
208 TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
209 LsTreeWriteWalk, NULL, NULL);
213 /*******************************************************************************
215 * FUNCTION: LsDumpAscii
217 * PARAMETERS: FileId - ID of current listing file
218 * Count - Number of bytes to convert
219 * Buffer - Buffer of bytes to convert
223 * DESCRIPTION: Convert hex bytes to ascii
225 ******************************************************************************/
237 FlPrintFile (FileId, " \"");
238 for (i = 0; i < Count; i++)
241 if (isprint (BufChar))
243 FlPrintFile (FileId, "%c", BufChar);
247 /* Not a printable character, just put out a dot */
249 FlPrintFile (FileId, ".");
252 FlPrintFile (FileId, "\"");
256 /*******************************************************************************
258 * FUNCTION: LsDumpAsciiInComment
260 * PARAMETERS: FileId - ID of current listing file
261 * Count - Number of bytes to convert
262 * Buffer - Buffer of bytes to convert
266 * DESCRIPTION: Convert hex bytes to ascii
268 ******************************************************************************/
271 LsDumpAsciiInComment (
281 FlPrintFile (FileId, " \"");
282 for (i = 0; i < Count; i++)
287 if (isprint (BufChar))
289 /* Handle embedded C comment sequences */
291 if (((LastChar == '*') && (BufChar == '/')) ||
292 ((LastChar == '/') && (BufChar == '*')))
294 /* Insert a space to break the sequence */
296 FlPrintFile (FileId, ".", BufChar);
299 FlPrintFile (FileId, "%c", BufChar);
303 /* Not a printable character, just put out a dot */
305 FlPrintFile (FileId, ".");
308 FlPrintFile (FileId, "\"");
312 /*******************************************************************************
314 * FUNCTION: LsAmlListingWalk
316 * PARAMETERS: ASL_WALK_CALLBACK
320 * DESCRIPTION: Process one node during a listing file generation.
322 ******************************************************************************/
326 ACPI_PARSE_OBJECT *Op,
332 UINT32 FileId = (UINT32) ACPI_TO_INTEGER (Context);
335 LsWriteNodeToListing (Op, FileId);
337 if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DATA)
339 /* Buffer is a resource template, don't dump the data all at once */
344 /* Write the hex bytes to the listing file(s) (if requested) */
346 for (i = 0; i < Op->Asl.FinalAmlLength; i++)
348 if (ACPI_FAILURE (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1)))
350 FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
353 LsWriteListingHexBytes (&FileByte, 1, FileId);
360 /*******************************************************************************
362 * FUNCTION: LsGenerateListing
364 * PARAMETERS: FileId - ID of listing file
368 * DESCRIPTION: Generate a listing file. This can be one of the several types
369 * of "listings" supported.
371 ******************************************************************************/
378 /* Start at the beginning of both the source and AML files */
380 FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0);
381 FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
383 Gbl_CurrentHexColumn = 0;
384 LsPushNode (Gbl_Files[ASL_FILE_INPUT].Filename);
386 /* Process all parse nodes */
388 TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk,
389 NULL, (void *) ACPI_TO_POINTER (FileId));
391 /* Final processing */
393 LsFinishSourceListing (FileId);
397 /*******************************************************************************
399 * FUNCTION: LsPushNode
401 * PARAMETERS: Filename - Pointer to the include filename
405 * DESCRIPTION: Push a listing node on the listing/include file stack. This
406 * stack enables tracking of include files (infinitely nested)
407 * and resumption of the listing of the parent file when the
408 * include file is finished.
410 ******************************************************************************/
416 ASL_LISTING_NODE *Lnode;
419 /* Create a new node */
421 Lnode = UtLocalCalloc (sizeof (ASL_LISTING_NODE));
425 Lnode->Filename = Filename;
426 Lnode->LineNumber = 0;
430 Lnode->Next = Gbl_ListingNode;
431 Gbl_ListingNode = Lnode;
435 /*******************************************************************************
437 * FUNCTION: LsPopNode
441 * RETURN: List head after current head is popped off
443 * DESCRIPTION: Pop the current head of the list, free it, and return the
444 * next node on the stack (the new current node).
446 ******************************************************************************/
448 static ASL_LISTING_NODE *
452 ASL_LISTING_NODE *Lnode;
455 /* Just grab the node at the head of the list */
457 Lnode = Gbl_ListingNode;
461 AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL,
462 "Could not pop empty listing stack");
463 return (Gbl_ListingNode);
466 Gbl_ListingNode = Lnode->Next;
469 /* New "Current" node is the new head */
471 return (Gbl_ListingNode);
475 /*******************************************************************************
477 * FUNCTION: LsCheckException
479 * PARAMETERS: LineNumber - Current logical (cumulative) line #
480 * FileId - ID of output listing file
484 * DESCRIPTION: Check if there is an exception for this line, and if there is,
485 * put it in the listing immediately. Handles multiple errors
486 * per line. Gbl_NextError points to the next error in the
487 * sorted (by line #) list of compile errors/warnings.
489 ******************************************************************************/
497 if ((!Gbl_NextError) ||
498 (LineNumber < Gbl_NextError->LogicalLineNumber ))
503 /* Handle multiple errors per line */
505 if (FileId == ASL_FILE_LISTING_OUTPUT)
507 while (Gbl_NextError &&
508 (LineNumber >= Gbl_NextError->LogicalLineNumber))
510 AePrintException (FileId, Gbl_NextError, "\n[****iasl****]\n");
512 Gbl_NextError = Gbl_NextError->Next;
515 FlPrintFile (FileId, "\n");
520 /*******************************************************************************
522 * FUNCTION: LsFlushListingBuffer
524 * PARAMETERS: FileId - ID of the listing file
528 * DESCRIPTION: Flush out the current contents of the 16-byte hex AML code
529 * buffer. Usually called at the termination of a single line
530 * of source code or when the buffer is full.
532 ******************************************************************************/
535 LsFlushListingBuffer (
541 if (Gbl_CurrentHexColumn == 0)
546 /* Write the hex bytes */
550 case ASL_FILE_LISTING_OUTPUT:
552 for (i = 0; i < Gbl_CurrentHexColumn; i++)
554 FlPrintFile (FileId, "%2.2X ", Gbl_AmlBuffer[i]);
557 for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 3); i++)
559 FlWriteFile (FileId, ".", 1);
562 /* Write the ASCII character associated with each of the bytes */
564 LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer);
568 case ASL_FILE_ASM_SOURCE_OUTPUT:
570 for (i = 0; i < Gbl_CurrentHexColumn; i++)
574 FlPrintFile (FileId, ",");
576 FlPrintFile (FileId, "0%2.2Xh", Gbl_AmlBuffer[i]);
579 for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++)
581 FlWriteFile (FileId, " ", 1);
584 FlPrintFile (FileId, " ;%8.8X",
585 Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE);
587 /* Write the ASCII character associated with each of the bytes */
589 LsDumpAscii (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer);
593 case ASL_FILE_C_SOURCE_OUTPUT:
595 for (i = 0; i < Gbl_CurrentHexColumn; i++)
597 FlPrintFile (FileId, "0x%2.2X,", Gbl_AmlBuffer[i]);
600 for (i = 0; i < ((HEX_LISTING_LINE_SIZE - Gbl_CurrentHexColumn) * 5); i++)
602 FlWriteFile (FileId, " ", 1);
605 FlPrintFile (FileId, " /* %8.8X",
606 Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE);
608 /* Write the ASCII character associated with each of the bytes */
610 LsDumpAsciiInComment (FileId, Gbl_CurrentHexColumn, Gbl_AmlBuffer);
611 FlPrintFile (FileId, " */");
615 /* No other types supported */
619 FlPrintFile (FileId, "\n");
621 Gbl_CurrentHexColumn = 0;
622 Gbl_HexBytesWereWritten = TRUE;
626 /*******************************************************************************
628 * FUNCTION: LsWriteListingHexBytes
630 * PARAMETERS: Buffer - AML code buffer
631 * Length - Number of AML bytes to write
632 * FileId - ID of current listing file.
636 * DESCRIPTION: Write the contents of the AML buffer to the listing file via
637 * the listing buffer. The listing buffer is flushed every 16
640 ******************************************************************************/
643 LsWriteListingHexBytes (
651 /* Transfer all requested bytes */
653 for (i = 0; i < Length; i++)
655 /* Print line header when buffer is empty */
657 if (Gbl_CurrentHexColumn == 0)
659 if (Gbl_HasIncludeFiles)
661 FlPrintFile (FileId, "%*s", 10, " ");
666 case ASL_FILE_LISTING_OUTPUT:
668 FlPrintFile (FileId, "%8.8X....", Gbl_CurrentAmlOffset);
671 case ASL_FILE_ASM_SOURCE_OUTPUT:
673 FlPrintFile (FileId, " db ");
676 case ASL_FILE_C_SOURCE_OUTPUT:
678 FlPrintFile (FileId, " ");
682 /* No other types supported */
687 /* Transfer AML byte and update counts */
689 Gbl_AmlBuffer[Gbl_CurrentHexColumn] = Buffer[i];
691 Gbl_CurrentHexColumn++;
692 Gbl_CurrentAmlOffset++;
694 /* Flush buffer when it is full */
696 if (Gbl_CurrentHexColumn >= HEX_LISTING_LINE_SIZE)
698 LsFlushListingBuffer (FileId);
704 /*******************************************************************************
706 * FUNCTION: LsWriteOneSourceLine
708 * PARAMETERS: FileID - ID of current listing file
710 * RETURN: FALSE on EOF (input source file), TRUE otherwise
712 * DESCRIPTION: Read one line from the input source file and echo it to the
713 * listing file, prefixed with the line number, and if the source
714 * file contains include files, prefixed with the current filename
716 ******************************************************************************/
719 LsWriteOneSourceLine (
726 Gbl_ListingNode->LineNumber++;
728 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
730 FlPrintFile (FileId, " *");
732 if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT)
734 FlPrintFile (FileId, "; ");
737 if (Gbl_HasIncludeFiles)
740 * This file contains "include" statements, print the current
741 * filename and line number within the current file
743 FlPrintFile (FileId, "%12s %5d....",
744 Gbl_ListingNode->Filename, Gbl_ListingNode->LineNumber);
748 /* No include files, just print the line number */
750 FlPrintFile (FileId, "%8d....", Gbl_SourceLine);
753 /* Read one line (up to a newline or EOF) */
755 while (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) == AE_OK)
757 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
765 FlWriteFile (FileId, &FileByte, 1);
766 if (FileByte == '\n')
769 * Check if an error occurred on this source line during the compile.
770 * If so, we print the error message after the source line.
772 LsCheckException (Gbl_SourceLine, FileId);
777 /* EOF on the input file was reached */
783 /*******************************************************************************
785 * FUNCTION: LsFinishSourceListing
787 * PARAMETERS: FileId - ID of current listing file.
791 * DESCRIPTION: Cleanup routine for the listing file. Flush the hex AML
792 * listing buffer, and flush out any remaining lines in the
795 ******************************************************************************/
798 LsFinishSourceListing (
802 if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) ||
803 (FileId == ASL_FILE_C_INCLUDE_OUTPUT))
808 LsFlushListingBuffer (FileId);
809 Gbl_CurrentAmlOffset = 0;
811 /* Flush any remaining text in the source file */
813 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
815 FlPrintFile (FileId, " /*\n");
818 while (LsWriteOneSourceLine (FileId))
821 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
823 FlPrintFile (FileId, "\n */\n };\n");
826 FlPrintFile (FileId, "\n");
828 if (FileId == ASL_FILE_LISTING_OUTPUT)
830 /* Print a summary of the compile exceptions */
832 FlPrintFile (FileId, "\n\nSummary of errors and warnings\n\n");
833 AePrintErrorLog (FileId);
834 FlPrintFile (FileId, "\n");
835 UtDisplaySummary (FileId);
836 FlPrintFile (FileId, "\n");
841 /*******************************************************************************
843 * FUNCTION: LsWriteSourceLines
845 * PARAMETERS: ToLineNumber -
846 * ToLogicalLineNumber - Write up to this source line number
847 * FileId - ID of current listing file
851 * DESCRIPTION: Read then write source lines to the listing file until we have
852 * reached the specified logical (cumulative) line number. This
853 * automatically echos out comment blocks and other non-AML
854 * generating text until we get to the actual AML-generating line
855 * of ASL code specified by the logical line number.
857 ******************************************************************************/
862 UINT32 ToLogicalLineNumber,
866 if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) ||
867 (FileId == ASL_FILE_C_INCLUDE_OUTPUT))
872 Gbl_CurrentLine = ToLogicalLineNumber;
874 /* Flush any hex bytes remaining from the last opcode */
876 LsFlushListingBuffer (FileId);
878 /* Read lines and write them as long as we are not caught up */
880 if (Gbl_SourceLine < Gbl_CurrentLine)
883 * If we just completed writing some AML hex bytes, output a linefeed
884 * to add some whitespace for readability.
886 if (Gbl_HexBytesWereWritten)
888 FlPrintFile (FileId, "\n");
889 Gbl_HexBytesWereWritten = FALSE;
892 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
894 FlPrintFile (FileId, " /*\n");
897 /* Write one line at a time until we have reached the target line # */
899 while ((Gbl_SourceLine < Gbl_CurrentLine) &&
900 LsWriteOneSourceLine (FileId))
903 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
905 FlPrintFile (FileId, " */");
907 FlPrintFile (FileId, "\n");
912 /*******************************************************************************
914 * FUNCTION: LsWriteNodeToListing
916 * PARAMETERS: Op - Parse node to write to the listing file.
917 * FileId - ID of current listing file
921 * DESCRIPTION: Write "a node" to the listing file. This means to
922 * 1) Write out all of the source text associated with the node
923 * 2) Write out all of the AML bytes associated with the node
924 * 3) Write any compiler exceptions associated with the node
926 ******************************************************************************/
929 LsWriteNodeToListing (
930 ACPI_PARSE_OBJECT *Op,
933 const ACPI_OPCODE_INFO *OpInfo;
940 OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
941 OpClass = OpInfo->Class;
943 /* TBD: clean this up with a single flag that says:
944 * I start a named output block
946 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
948 switch (Op->Asl.ParseOpcode)
950 case PARSEOP_DEFINITIONBLOCK:
951 case PARSEOP_METHODCALL:
952 case PARSEOP_INCLUDE:
953 case PARSEOP_INCLUDE_END:
954 case PARSEOP_DEFAULT_ARG:
961 case AML_CLASS_NAMED_OBJECT:
962 switch (Op->Asl.AmlOpcode)
969 if (Op->Asl.ExternalName)
971 LsFlushListingBuffer (FileId);
972 FlPrintFile (FileId, " };\n");
979 /* Don't care about other objects */
986 /* These cases do not have a corresponding AML opcode */
988 switch (Op->Asl.ParseOpcode)
990 case PARSEOP_DEFINITIONBLOCK:
992 LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId);
994 /* Use the table Signature and TableId to build a unique name */
996 if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT)
1000 Gbl_TableSignature, Gbl_TableId);
1002 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
1004 FlPrintFile (FileId,
1005 " unsigned char %s_%s_Header [] =\n {\n",
1006 Gbl_TableSignature, Gbl_TableId);
1008 if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT)
1010 FlPrintFile (FileId,
1011 "extrn %s_%s_Header : byte\n",
1012 Gbl_TableSignature, Gbl_TableId);
1014 if (FileId == ASL_FILE_C_INCLUDE_OUTPUT)
1016 FlPrintFile (FileId,
1017 "extern unsigned char %s_%s_Header [];\n",
1018 Gbl_TableSignature, Gbl_TableId);
1023 case PARSEOP_METHODCALL:
1025 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
1030 case PARSEOP_INCLUDE:
1032 /* Flush everything up to and including the include source line */
1034 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
1037 /* Create a new listing node and push it */
1039 LsPushNode (Op->Asl.Child->Asl.Value.String);
1043 case PARSEOP_INCLUDE_END:
1045 /* Flush out the rest of the include file */
1047 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
1050 /* Pop off this listing node and go back to the parent file */
1052 (void) LsPopNode ();
1056 case PARSEOP_DEFAULT_ARG:
1058 if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
1060 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.EndLogicalLine,
1067 /* All other opcodes have an AML opcode */
1072 * Otherwise, we look at the AML opcode because we can
1073 * switch on the opcode type, getting an entire class
1078 case AML_CLASS_ARGUMENT: /* argument type only */
1079 case AML_CLASS_INTERNAL:
1084 case AML_CLASS_NAMED_OBJECT:
1086 switch (Op->Asl.AmlOpcode)
1089 case AML_INDEX_FIELD_OP:
1090 case AML_BANK_FIELD_OP:
1093 * For fields, we want to dump all the AML after the
1096 LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine,
1102 if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
1104 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
1110 * For fields, we want to dump all the AML after the
1113 LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine,
1119 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
1124 switch (Op->Asl.AmlOpcode)
1129 /* These opcodes do not declare a new object, ignore them */
1135 /* All other named object opcodes come here */
1139 case ASL_FILE_ASM_SOURCE_OUTPUT:
1140 case ASL_FILE_C_SOURCE_OUTPUT:
1141 case ASL_FILE_ASM_INCLUDE_OUTPUT:
1142 case ASL_FILE_C_INCLUDE_OUTPUT:
1145 * For named objects, we will create a valid symbol so that the
1146 * AML code can be referenced from C or ASM
1148 if (Op->Asl.ExternalName)
1150 /* Get the full pathname associated with this node */
1152 Pathname = AcpiNsGetExternalPathname (Op->Asl.Node);
1153 Length = strlen (Pathname);
1156 /* Convert all dots in the path to underscores */
1158 for (i = 0; i < Length; i++)
1160 if (Pathname[i] == '.')
1166 /* Create the appropriate symbol in the output file */
1168 if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT)
1170 FlPrintFile (FileId,
1172 Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
1174 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
1176 FlPrintFile (FileId,
1177 " unsigned char %s_%s_%s [] =\n {\n",
1178 Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
1180 if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT)
1182 FlPrintFile (FileId,
1183 "extrn %s_%s_%s : byte\n",
1184 Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
1186 if (FileId == ASL_FILE_C_INCLUDE_OUTPUT)
1188 FlPrintFile (FileId,
1189 "extern unsigned char %s_%s_%s [];\n",
1190 Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
1193 ACPI_FREE (Pathname);
1198 /* Nothing to do for listing file */
1204 case AML_CLASS_EXECUTE:
1205 case AML_CLASS_CREATE:
1208 if ((Op->Asl.ParseOpcode == PARSEOP_BUFFER) &&
1209 (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC))
1214 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
1218 case AML_CLASS_UNKNOWN: