Deleted Added
sdiff udiff text old ( 245582 ) new ( 249112 )
full compact
1/******************************************************************************
2 *
3 * Module Name: asllisting - Listing file generation
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2013, Intel Corp.

--- 27 unchanged lines hidden (view full) ---

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#include "aslcompiler.y.h"
46#include <contrib/dev/acpica/include/amlcode.h>
47#include <contrib/dev/acpica/include/acparser.h>
48#include <contrib/dev/acpica/include/acnamesp.h>
49
50
51#define _COMPONENT ACPI_COMPILER
52 ACPI_MODULE_NAME ("asllisting")
53
54
55/* Local prototypes */
56
57static void
58LsGenerateListing (
59 UINT32 FileId);
60
61static ACPI_STATUS
62LsAmlListingWalk (
63 ACPI_PARSE_OBJECT *Op,
64 UINT32 Level,
65 void *Context);
66
67static ACPI_STATUS
68LsTreeWriteWalk (
69 ACPI_PARSE_OBJECT *Op,
70 UINT32 Level,
71 void *Context);
72
73static void
74LsWriteNodeToListing (
75 ACPI_PARSE_OBJECT *Op,
76 UINT32 FileId);
77
78static void
79LsFinishSourceListing (
80 UINT32 FileId);
81
82
83/*******************************************************************************
84 *
85 * FUNCTION: LsDoListings
86 *
87 * PARAMETERS: None. Examines the various output file global flags.
88 *
89 * RETURN: None
90 *
91 * DESCRIPTION: Generate all requested listing files.
92 *
93 ******************************************************************************/
94
95void

--- 20 unchanged lines hidden (view full) ---

116 {
117 LsGenerateListing (ASL_FILE_C_INCLUDE_OUTPUT);
118 }
119
120 if (Gbl_AsmIncludeOutputFlag)
121 {
122 LsGenerateListing (ASL_FILE_ASM_INCLUDE_OUTPUT);
123 }
124
125 if (Gbl_C_OffsetTableFlag)
126 {
127 LsGenerateListing (ASL_FILE_C_OFFSET_OUTPUT);
128 }
129}
130
131
132/*******************************************************************************
133 *
134 * FUNCTION: LsGenerateListing
135 *
136 * PARAMETERS: FileId - ID of listing file
137 *
138 * RETURN: None
139 *
140 * DESCRIPTION: Generate a listing file. This can be one of the several types
141 * of "listings" supported.
142 *
143 ******************************************************************************/
144
145static void
146LsGenerateListing (
147 UINT32 FileId)
148{
149
150 /* Start at the beginning of both the source and AML files */
151
152 FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0);
153 FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
154 Gbl_SourceLine = 0;
155 Gbl_CurrentHexColumn = 0;
156 LsPushNode (Gbl_Files[ASL_FILE_INPUT].Filename);
157
158 if (FileId == ASL_FILE_C_OFFSET_OUTPUT)
159 {
160 /* Offset table file has a special header and footer */
161
162 LsDoOffsetTableHeader (FileId);
163
164 TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlOffsetWalk,
165 NULL, (void *) ACPI_TO_POINTER (FileId));
166 LsDoOffsetTableFooter (FileId);
167 return;
168 }
169
170 /* Process all parse nodes */
171
172 TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk,
173 NULL, (void *) ACPI_TO_POINTER (FileId));
174
175 /* Final processing */
176
177 LsFinishSourceListing (FileId);
178}
179
180
181/*******************************************************************************
182 *
183 * FUNCTION: LsAmlListingWalk
184 *
185 * PARAMETERS: ASL_WALK_CALLBACK

--- 37 unchanged lines hidden (view full) ---

223 }
224
225 return (AE_OK);
226}
227
228
229/*******************************************************************************
230 *
231 * FUNCTION: LsDumpParseTree, LsTreeWriteWalk
232 *
233 * PARAMETERS: None
234 *
235 * RETURN: None
236 *
237 * DESCRIPTION: Dump entire parse tree, for compiler debug only
238 *
239 ******************************************************************************/
240
241void
242LsDumpParseTree (
243 void)
244{
245
246 if (!Gbl_DebugFlag)
247 {
248 return;
249 }
250
251 DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n");
252 TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
253 LsTreeWriteWalk, NULL, NULL);
254}
255
256
257static ACPI_STATUS
258LsTreeWriteWalk (
259 ACPI_PARSE_OBJECT *Op,
260 UINT32 Level,
261 void *Context)
262{
263
264 /* Debug output */
265
266 DbgPrint (ASL_TREE_OUTPUT,
267 "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level);
268 UtPrintFormattedName (Op->Asl.ParseOpcode, Level);
269
270 DbgPrint (ASL_TREE_OUTPUT, "\n");
271 return (AE_OK);
272}
273
274
275/*******************************************************************************
276 *
277 * FUNCTION: LsWriteNodeToListing
278 *
279 * PARAMETERS: Op - Parse node to write to the listing file.
280 * FileId - ID of current listing file
281 *
282 * RETURN: None.
283 *
284 * DESCRIPTION: Write "a node" to the listing file. This means to
285 * 1) Write out all of the source text associated with the node
286 * 2) Write out all of the AML bytes associated with the node
287 * 3) Write any compiler exceptions associated with the node

--- 289 unchanged lines hidden (view full) ---

577 LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
578 FileId);
579 break;
580
581 case AML_CLASS_UNKNOWN:
582 break;
583 }
584}
585
586
587/*******************************************************************************
588 *
589 * FUNCTION: LsFinishSourceListing
590 *
591 * PARAMETERS: FileId - ID of current listing file.
592 *
593 * RETURN: None
594 *
595 * DESCRIPTION: Cleanup routine for the listing file. Flush the hex AML
596 * listing buffer, and flush out any remaining lines in the
597 * source input file.
598 *
599 ******************************************************************************/
600
601static void
602LsFinishSourceListing (
603 UINT32 FileId)
604{
605
606 if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) ||
607 (FileId == ASL_FILE_C_INCLUDE_OUTPUT))
608 {
609 return;
610 }
611
612 LsFlushListingBuffer (FileId);
613 Gbl_CurrentAmlOffset = 0;
614
615 /* Flush any remaining text in the source file */
616
617 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
618 {
619 FlPrintFile (FileId, " /*\n");
620 }
621
622 while (LsWriteOneSourceLine (FileId))
623 { ; }
624
625 if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
626 {
627 FlPrintFile (FileId, "\n */\n };\n");
628 }
629
630 FlPrintFile (FileId, "\n");
631
632 if (FileId == ASL_FILE_LISTING_OUTPUT)
633 {
634 /* Print a summary of the compile exceptions */
635
636 FlPrintFile (FileId, "\n\nSummary of errors and warnings\n\n");
637 AePrintErrorLog (FileId);
638 FlPrintFile (FileId, "\n");
639 UtDisplaySummary (FileId);
640 FlPrintFile (FileId, "\n");
641 }
642}