xref: /illumos-gate/usr/src/cmd/acpi/iasl/aslcompiler.h (revision d8109ce4330e1b8ad6c29f9fccacec969066bb9d)
1 /******************************************************************************
2  *
3  * Module Name: aslcompiler.h - common include file for iASL
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
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.
20  *
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
27  *
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;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
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.
53  *
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.
65  *
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.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
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.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
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.
89  *
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.
98  *
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.
113  *
114  *****************************************************************************
115  *
116  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
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.
133  *
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.
145  *
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.
149  *
150  *****************************************************************************/
151 
152 #ifndef __ASLCOMPILER_H
153 #define __ASLCOMPILER_H
154 
155 #include "acpi.h"
156 #include "accommon.h"
157 #include "amlresrc.h"
158 #include "acdebug.h"
159 
160 /* Microsoft-specific */
161 
162 #if (defined WIN32 || defined WIN64)
163 
164 /* warn : used #pragma pack */
165 #pragma warning(disable:4103)
166 
167 /* warn : named type definition in parentheses */
168 #pragma warning(disable:4115)
169 #endif
170 
171 #include <stdio.h>
172 #include <stdlib.h>
173 #include <string.h>
174 #include <errno.h>
175 #include <ctype.h>
176 
177 /* Compiler headers */
178 
179 #include "asldefine.h"
180 #include "asltypes.h"
181 #include "aslmessages.h"
182 #include "aslglobal.h"
183 #include "preprocess.h"
184 #include "dtcompiler.h"
185 
186 
187 /*******************************************************************************
188  *
189  * Compiler prototypes
190  *
191  ******************************************************************************/
192 
193 /*
194  * Main ASL parser - generated from flex/bison, lex/yacc, etc.
195  */
196 ACPI_PARSE_OBJECT *
197 AslDoError (
198     void);
199 
200 int
201 AslCompilerlex(
202     void);
203 
204 void
205 AslResetCurrentLineBuffer (
206     void);
207 
208 void
209 AslInsertLineBuffer (
210     int                     SourceChar);
211 
212 int
213 AslPopInputFileStack (
214     void);
215 
216 void
217 AslPushInputFileStack (
218     FILE                    *InputFile,
219     char                    *Filename);
220 
221 void
222 AslParserCleanup (
223     void);
224 
225 
226 /*
227  * aslstartup - entered from main()
228  */
229 void
230 AslInitializeGlobals (
231     void);
232 
233 typedef
234 ACPI_STATUS (*ASL_PATHNAME_CALLBACK) (
235     char *);
236 
237 ACPI_STATUS
238 AslDoOneFile (
239     char                    *Filename);
240 
241 ACPI_STATUS
242 AslCheckForErrorExit (
243     void);
244 
245 
246 /*
247  * aslcompile - compile mainline
248  */
249 void
250 AslCompilerSignon (
251     UINT32                  FileId);
252 
253 void
254 AslCompilerFileHeader (
255     UINT32                  FileId);
256 
257 int
258 CmDoCompile (
259     void);
260 
261 void
262 CmDoOutputFiles (
263     void);
264 
265 void
266 CmCleanupAndExit (
267     void);
268 
269 
270 /*
271  * aslallocate - memory allocation
272  */
273 void *
274 UtLocalCalloc (
275     UINT32                  Size);
276 
277 void
278 UtExpandLineBuffers (
279     void);
280 
281 void
282 UtReallocLineBuffers (
283     char                    **Buffer,
284     UINT32                  OldSize,
285     UINT32                  NewSize);
286 
287 void
288 UtFreeLineBuffers (
289     void);
290 
291 
292 /*
293  * aslcache - local cache support
294  */
295 char *
296 UtLocalCacheCalloc (
297     UINT32                  Length);
298 
299 ACPI_PARSE_OBJECT *
300 UtParseOpCacheCalloc (
301     void);
302 
303 DT_SUBTABLE *
304 UtSubtableCacheCalloc (
305     void);
306 
307 DT_FIELD *
308 UtFieldCacheCalloc (
309     void);
310 
311 void
312 UtDeleteLocalCaches (
313     void);
314 
315 
316 /*
317  * aslascii - ascii support
318  */
319 ACPI_STATUS
320 FlIsFileAsciiSource (
321     char                    *Filename,
322     BOOLEAN                 DisplayErrors);
323 
324 
325 /*
326  * aslwalks - semantic analysis and parse tree walks
327  */
328 ACPI_STATUS
329 AnOtherSemanticAnalysisWalkBegin (
330     ACPI_PARSE_OBJECT       *Op,
331     UINT32                  Level,
332     void                    *Context);
333 
334 ACPI_STATUS
335 AnOtherSemanticAnalysisWalkEnd (
336     ACPI_PARSE_OBJECT       *Op,
337     UINT32                  Level,
338     void                    *Context);
339 
340 ACPI_STATUS
341 AnOperandTypecheckWalkEnd (
342     ACPI_PARSE_OBJECT       *Op,
343     UINT32                  Level,
344     void                    *Context);
345 
346 ACPI_STATUS
347 AnMethodTypingWalkEnd (
348     ACPI_PARSE_OBJECT       *Op,
349     UINT32                  Level,
350     void                    *Context);
351 
352 
353 /*
354  * aslmethod - Control method analysis walk
355  */
356 ACPI_STATUS
357 MtMethodAnalysisWalkBegin (
358     ACPI_PARSE_OBJECT       *Op,
359     UINT32                  Level,
360     void                    *Context);
361 
362 ACPI_STATUS
363 MtMethodAnalysisWalkEnd (
364     ACPI_PARSE_OBJECT       *Op,
365     UINT32                  Level,
366     void                    *Context);
367 
368 
369 /*
370  * aslbtypes - bitfield data types
371  */
372 UINT32
373 AnMapObjTypeToBtype (
374     ACPI_PARSE_OBJECT       *Op);
375 
376 UINT32
377 AnMapArgTypeToBtype (
378     UINT32                  ArgType);
379 
380 UINT32
381 AnGetBtype (
382     ACPI_PARSE_OBJECT       *Op);
383 
384 void
385 AnFormatBtype (
386     char                    *Buffer,
387     UINT32                  Btype);
388 
389 
390 /*
391  * aslanalyze - Support functions for parse tree walks
392  */
393 void
394 AnCheckId (
395     ACPI_PARSE_OBJECT       *Op,
396     ACPI_NAME               Type);
397 
398 /* Values for Type argument above */
399 
400 #define ASL_TYPE_HID        0
401 #define ASL_TYPE_CID        1
402 
403 BOOLEAN
404 AnIsInternalMethod (
405     ACPI_PARSE_OBJECT       *Op);
406 
407 UINT32
408 AnGetInternalMethodReturnType (
409     ACPI_PARSE_OBJECT       *Op);
410 
411 BOOLEAN
412 AnLastStatementIsReturn (
413     ACPI_PARSE_OBJECT       *Op);
414 
415 void
416 AnCheckMethodReturnValue (
417     ACPI_PARSE_OBJECT       *Op,
418     const ACPI_OPCODE_INFO  *OpInfo,
419     ACPI_PARSE_OBJECT       *ArgOp,
420     UINT32                  RequiredBtypes,
421     UINT32                  ThisNodeBtype);
422 
423 BOOLEAN
424 AnIsResultUsed (
425     ACPI_PARSE_OBJECT       *Op);
426 
427 void
428 ApCheckForGpeNameConflict (
429     ACPI_PARSE_OBJECT       *Op);
430 
431 void
432 ApCheckRegMethod (
433     ACPI_PARSE_OBJECT       *Op);
434 
435 BOOLEAN
436 ApFindNameInScope (
437     char                    *Name,
438     ACPI_PARSE_OBJECT       *Op);
439 
440 BOOLEAN
441 ApFindNameInDeviceTree (
442     char                    *Name,
443     ACPI_PARSE_OBJECT       *Op);
444 
445 /*
446  * aslerror - error handling/reporting
447  */
448 void
449 AslAbort (
450     void);
451 
452 void
453 AslDualParseOpError (
454     UINT8                   Level,
455     UINT16                  MainMessageId,
456     ACPI_PARSE_OBJECT       *MainOp,
457     char                    *MainMessage,
458     UINT16                  SecondMessageId,
459     ACPI_PARSE_OBJECT       *SecondOp,
460     char                    *SecondaryMessage);
461 
462 void
463 AslError (
464     UINT8                   Level,
465     UINT16                  MessageId,
466     ACPI_PARSE_OBJECT       *Op,
467     char                    *ExtraMessage);
468 
469 void
470 AslCheckExpectedExceptions (
471     void);
472 
473 ACPI_STATUS
474 AslExpectException (
475     char                    *MessageIdString);
476 
477 ACPI_STATUS
478 AslDisableException (
479     char                    *MessageIdString);
480 
481 BOOLEAN
482 AslIsExceptionIgnored (
483     UINT8                   Level,
484     UINT16                  MessageId);
485 
486 void
487 AslCoreSubsystemError (
488     ACPI_PARSE_OBJECT       *Op,
489     ACPI_STATUS             Status,
490     char                    *ExtraMessage,
491     BOOLEAN                 Abort);
492 
493 int
494 AslCompilererror(
495     const char              *s);
496 
497 void
498 AslCommonError (
499     UINT8                   Level,
500     UINT16                  MessageId,
501     UINT32                  CurrentLineNumber,
502     UINT32                  LogicalLineNumber,
503     UINT32                  LogicalByteOffset,
504     UINT32                  Column,
505     char                    *Filename,
506     char                    *ExtraMessage);
507 
508 void
509 AslCommonError2 (
510     UINT8                   Level,
511     UINT16                  MessageId,
512     UINT32                  LineNumber,
513     UINT32                  Column,
514     char                    *SourceLine,
515     char                    *Filename,
516     char                    *ExtraMessage);
517 
518 void
519 AePrintException (
520     UINT32                  FileId,
521     ASL_ERROR_MSG           *Enode,
522     char                    *Header);
523 
524 void
525 AePrintErrorLog (
526     UINT32                  FileId);
527 
528 void
529 AeClearErrorLog (
530     void);
531 
532 
533 /*
534  * asllisting - generate all "listing" type files
535  */
536 void
537 LsDoListings (
538     void);
539 
540 void
541 LsWriteNodeToAsmListing (
542     ACPI_PARSE_OBJECT       *Op);
543 
544 void
545 LsWriteNode (
546     ACPI_PARSE_OBJECT       *Op,
547     UINT32                  FileId);
548 
549 void
550 LsDumpParseTree (
551     void);
552 
553 
554 /*
555  * asllistsup - Listing file support utilities
556  */
557 void
558 LsDumpAscii (
559     UINT32                  FileId,
560     UINT32                  Count,
561     UINT8                   *Buffer);
562 
563 void
564 LsDumpAsciiInComment (
565     UINT32                  FileId,
566     UINT32                  Count,
567     UINT8                   *Buffer);
568 
569 void
570 LsCheckException (
571     UINT32                  LineNumber,
572     UINT32                  FileId);
573 
574 void
575 LsFlushListingBuffer (
576     UINT32                  FileId);
577 
578 void
579 LsWriteListingHexBytes (
580     UINT8                   *Buffer,
581     UINT32                  Length,
582     UINT32                  FileId);
583 
584 void
585 LsWriteSourceLines (
586     UINT32                  ToLineNumber,
587     UINT32                  ToLogicalLineNumber,
588     UINT32                  FileId);
589 
590 UINT32
591 LsWriteOneSourceLine (
592     UINT32                  FileId);
593 
594 void
595 LsPushNode (
596     char                    *Filename);
597 
598 ASL_LISTING_NODE *
599 LsPopNode (
600     void);
601 
602 
603 /*
604  * aslhex - generate all "hex" output files (C, ASM, ASL)
605  */
606 void
607 HxDoHexOutput (
608     void);
609 
610 
611 /*
612  * aslfold - constant folding
613  */
614 ACPI_STATUS
615 OpcAmlConstantWalk (
616     ACPI_PARSE_OBJECT       *Op,
617     UINT32                  Level,
618     void                    *Context);
619 
620 
621 /*
622  * aslmessages - exception strings
623  */
624 const char *
625 AeDecodeMessageId (
626     UINT16                  MessageId);
627 
628 const char *
629 AeDecodeExceptionLevel (
630     UINT8                   Level);
631 
632 UINT16
633 AeBuildFullExceptionCode (
634     UINT8                   Level,
635     UINT16                  MessageId);
636 
637 /*
638  * asloffset - generate C offset file for BIOS support
639  */
640 ACPI_STATUS
641 LsAmlOffsetWalk (
642     ACPI_PARSE_OBJECT       *Op,
643     UINT32                  Level,
644     void                    *Context);
645 
646 void
647 LsDoOffsetTableHeader (
648     UINT32                  FileId);
649 
650 void
651 LsDoOffsetTableFooter (
652     UINT32                  FileId);
653 
654 
655 /*
656  * aslopcodes - generate AML opcodes
657  */
658 ACPI_STATUS
659 OpcAmlOpcodeWalk (
660     ACPI_PARSE_OBJECT       *Op,
661     UINT32                  Level,
662     void                    *Context);
663 
664 ACPI_STATUS
665 OpcAmlOpcodeUpdateWalk (
666     ACPI_PARSE_OBJECT       *Op,
667     UINT32                  Level,
668     void                    *Context);
669 
670 void
671 OpcGenerateAmlOpcode (
672     ACPI_PARSE_OBJECT       *Op);
673 
674 UINT32
675 OpcSetOptimalIntegerSize (
676     ACPI_PARSE_OBJECT       *Op);
677 
678 void
679 OpcGetIntegerWidth (
680     ACPI_PARSE_OBJECT       *Op);
681 
682 
683 /*
684  * asloperands - generate AML operands for the AML opcodes
685  */
686 ACPI_PARSE_OBJECT  *
687 UtGetArg (
688     ACPI_PARSE_OBJECT       *Op,
689     UINT32                  Argn);
690 
691 void
692 OpnGenerateAmlOperands (
693     ACPI_PARSE_OBJECT       *Op);
694 
695 void
696 OpnDoPackage (
697     ACPI_PARSE_OBJECT       *Op);
698 
699 
700 /*
701  * aslopt - optmization
702  */
703 void
704 OptOptimizeNamePath (
705     ACPI_PARSE_OBJECT       *Op,
706     UINT32                  Flags,
707     ACPI_WALK_STATE         *WalkState,
708     char                    *AmlNameString,
709     ACPI_NAMESPACE_NODE     *TargetNode);
710 
711 
712 /*
713  * aslpld - ToPLD macro support
714  */
715 void
716 OpcDoPld (
717     ACPI_PARSE_OBJECT       *Op);
718 
719 
720 /*
721  * aslprintf - Printf/Fprintf macros
722  */
723 void
724 OpcDoPrintf (
725     ACPI_PARSE_OBJECT       *Op);
726 
727 void
728 OpcDoFprintf (
729     ACPI_PARSE_OBJECT       *Op);
730 
731 
732 /*
733  * aslprune - parse tree pruner
734  */
735 void
736 AslPruneParseTree (
737     UINT32                  PruneDepth,
738     UINT32                  Type);
739 
740 
741 /*
742  * aslcodegen - code generation
743  */
744 void
745 CgGenerateAmlOutput (
746     void);
747 
748 void
749 CgLocalWriteAmlData (
750     ACPI_PARSE_OBJECT       *Op,
751     void                    *Buffer,
752     UINT32                  Length);
753 
754 
755 /*
756  * aslfile
757  */
758 void
759 FlOpenFile (
760     UINT32                  FileId,
761     char                    *Filename,
762     char                    *Mode);
763 
764 
765 /*
766  * asllength - calculate/adjust AML package lengths
767  */
768 ACPI_STATUS
769 LnPackageLengthWalk (
770     ACPI_PARSE_OBJECT       *Op,
771     UINT32                  Level,
772     void                    *Context);
773 
774 ACPI_STATUS
775 LnInitLengthsWalk (
776     ACPI_PARSE_OBJECT       *Op,
777     UINT32                  Level,
778     void                    *Context);
779 
780 void
781 CgGenerateAmlLengths (
782     ACPI_PARSE_OBJECT       *Op);
783 
784 
785 /*
786  * aslmap - opcode mappings and reserved method names
787  */
788 ACPI_OBJECT_TYPE
789 AslMapNamedOpcodeToDataType (
790     UINT16                  Opcode);
791 
792 
793 /*
794  * aslpredef - ACPI predefined names support
795  */
796 BOOLEAN
797 ApCheckForPredefinedMethod (
798     ACPI_PARSE_OBJECT       *Op,
799     ASL_METHOD_INFO         *MethodInfo);
800 
801 void
802 ApCheckPredefinedReturnValue (
803     ACPI_PARSE_OBJECT       *Op,
804     ASL_METHOD_INFO         *MethodInfo);
805 
806 UINT32
807 ApCheckForPredefinedName (
808     ACPI_PARSE_OBJECT       *Op,
809     char                    *Name);
810 
811 void
812 ApCheckForPredefinedObject (
813     ACPI_PARSE_OBJECT       *Op,
814     char                    *Name);
815 
816 ACPI_STATUS
817 ApCheckObjectType (
818     const char              *PredefinedName,
819     ACPI_PARSE_OBJECT       *Op,
820     UINT32                  ExpectedBtypes,
821     UINT32                  PackageIndex);
822 
823 void
824 ApDisplayReservedNames (
825     void);
826 
827 
828 /*
829  * aslprepkg - ACPI predefined names support for packages
830  */
831 void
832 ApCheckPackage (
833     ACPI_PARSE_OBJECT           *ParentOp,
834     const ACPI_PREDEFINED_INFO  *Predefined);
835 
836 
837 /*
838  * asltransform - parse tree transformations
839  */
840 ACPI_STATUS
841 TrAmlTransformWalkBegin (
842     ACPI_PARSE_OBJECT       *Op,
843     UINT32                  Level,
844     void                    *Context);
845 
846 ACPI_STATUS
847 TrAmlTransformWalkEnd (
848     ACPI_PARSE_OBJECT       *Op,
849     UINT32                  Level,
850     void                    *Context);
851 
852 
853 /*
854  * aslexternal - External opcode support
855  */
856 ACPI_STATUS
857 ExAmlExternalWalkBegin (
858     ACPI_PARSE_OBJECT       *Op,
859     UINT32                  Level,
860     void                    *Context);
861 
862 ACPI_STATUS
863 ExAmlExternalWalkEnd (
864     ACPI_PARSE_OBJECT       *Op,
865     UINT32                  Level,
866     void                    *Context);
867 
868 void
869 ExDoExternal (
870     ACPI_PARSE_OBJECT       *Op);
871 
872 /* Values for "Visitation" parameter above */
873 
874 #define ASL_WALK_VISIT_DOWNWARD     0x01
875 #define ASL_WALK_VISIT_UPWARD       0x02
876 #define ASL_WALK_VISIT_TWICE        (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD)
877 
878 
879 /*
880  * aslparseop.c - Parse op create/allocate/cache
881  */
882 ACPI_PARSE_OBJECT *
883 TrCreateOp (
884     UINT32                  ParseOpcode,
885     UINT32                  NumChildren,
886     ...);
887 
888 ACPI_PARSE_OBJECT *
889 TrCreateLeafOp (
890     UINT32                  ParseOpcode);
891 
892 ACPI_PARSE_OBJECT *
893 TrCreateNullTargetOp (
894     void);
895 
896 ACPI_PARSE_OBJECT *
897 TrCreateAssignmentOp (
898     ACPI_PARSE_OBJECT       *Target,
899     ACPI_PARSE_OBJECT       *Source);
900 
901 ACPI_PARSE_OBJECT *
902 TrCreateTargetOp (
903     ACPI_PARSE_OBJECT       *OriginalOp,
904     ACPI_PARSE_OBJECT       *ParentOp);
905 
906 ACPI_PARSE_OBJECT *
907 TrCreateValuedLeafOp (
908     UINT32                  ParseOpcode,
909     UINT64                  Value);
910 
911 ACPI_PARSE_OBJECT *
912 TrCreateConstantLeafOp (
913     UINT32                  ParseOpcode);
914 
915 ACPI_PARSE_OBJECT *
916 TrAllocateOp (
917     UINT32                  ParseOpcode);
918 
919 void
920 TrPrintOpFlags (
921     UINT32                  Flags,
922     UINT32                  OutputLevel);
923 
924 
925 /*
926  * asltree.c - Parse tree management
927  */
928 void
929 TrSetOpParent (
930     ACPI_PARSE_OBJECT       *Op,
931     ACPI_PARSE_OBJECT       *ParentOp);
932 
933 ACPI_PARSE_OBJECT *
934 TrSetOpIntegerValue (
935     UINT32                  ParseOpcode,
936     ACPI_PARSE_OBJECT       *Op);
937 
938 void
939 TrSetOpEndLineNumber (
940     ACPI_PARSE_OBJECT       *Op);
941 
942 void
943 TrSetOpCurrentFilename (
944     ACPI_PARSE_OBJECT       *Op);
945 
946 void
947 TrSetOpIntegerWidth (
948     ACPI_PARSE_OBJECT       *TableSignature,
949     ACPI_PARSE_OBJECT       *Revision);
950 
951 ACPI_PARSE_OBJECT *
952 TrLinkOpChildren (
953     ACPI_PARSE_OBJECT       *Op,
954     UINT32                  NumChildren,
955     ...);
956 
957 ACPI_PARSE_OBJECT *
958 TrLinkPeerOp (
959     ACPI_PARSE_OBJECT       *Op1,
960     ACPI_PARSE_OBJECT       *Op2);
961 
962 ACPI_PARSE_OBJECT *
963 TrLinkChildOp (
964     ACPI_PARSE_OBJECT       *Op1,
965     ACPI_PARSE_OBJECT       *Op2);
966 
967 ACPI_PARSE_OBJECT *
968 TrSetOpFlags (
969     ACPI_PARSE_OBJECT       *Op,
970     UINT32                  Flags);
971 
972 ACPI_PARSE_OBJECT *
973 TrSetOpAmlLength (
974     ACPI_PARSE_OBJECT       *Op,
975     UINT32                  Length);
976 
977 ACPI_PARSE_OBJECT *
978 TrLinkPeerOps (
979     UINT32                  NumPeers,
980     ...);
981 
982 ACPI_STATUS
983 TrWalkParseTree (
984     ACPI_PARSE_OBJECT       *Op,
985     UINT32                  Visitation,
986     ASL_WALK_CALLBACK       DescendingCallback,
987     ASL_WALK_CALLBACK       AscendingCallback,
988     void                    *Context);
989 
990 
991 /*
992  * aslfiles - File I/O support
993  */
994 void
995 FlAddIncludeDirectory (
996     char                    *Dir);
997 
998 char *
999 FlMergePathnames (
1000     char                    *PrefixDir,
1001     char                    *FilePathname);
1002 
1003 void
1004 FlOpenIncludeFile (
1005     ACPI_PARSE_OBJECT       *Op);
1006 
1007 void
1008 FlFileError (
1009     UINT32                  FileId,
1010     UINT8                   ErrorId);
1011 
1012 UINT32
1013 FlGetFileSize (
1014     UINT32                  FileId);
1015 
1016 ACPI_STATUS
1017 FlReadFile (
1018     UINT32                  FileId,
1019     void                    *Buffer,
1020     UINT32                  Length);
1021 
1022 void
1023 FlWriteFile (
1024     UINT32                  FileId,
1025     void                    *Buffer,
1026     UINT32                  Length);
1027 
1028 void
1029 FlSeekFile (
1030     UINT32                  FileId,
1031     long                    Offset);
1032 
1033 void
1034 FlCloseFile (
1035     UINT32                  FileId);
1036 
1037 void
1038 FlPrintFile (
1039     UINT32                  FileId,
1040     char                    *Format,
1041     ...);
1042 
1043 void
1044 FlDeleteFile (
1045     UINT32                  FileId);
1046 
1047 void
1048 FlSetLineNumber (
1049     UINT32                  LineNumber);
1050 
1051 void
1052 FlSetFilename (
1053     char                    *Filename);
1054 
1055 ACPI_STATUS
1056 FlOpenInputFile (
1057     char                    *InputFilename);
1058 
1059 ACPI_STATUS
1060 FlOpenAmlOutputFile (
1061     char                    *InputFilename);
1062 
1063 ACPI_STATUS
1064 FlOpenMiscOutputFiles (
1065     char                    *InputFilename);
1066 
1067 /*
1068  * aslhwmap - hardware map summary
1069  */
1070 void
1071 MpEmitMappingInfo (
1072     void);
1073 
1074 
1075 /*
1076  * asload - load namespace in prep for cross reference
1077  */
1078 ACPI_STATUS
1079 LdLoadNamespace (
1080     ACPI_PARSE_OBJECT       *RootOp);
1081 
1082 
1083 /*
1084  * asllookup - namespace lookup functions
1085  */
1086 void
1087 LkFindUnreferencedObjects (
1088     void);
1089 
1090 /*
1091  * aslhelp - help screens
1092  */
1093 void
1094 Usage (
1095     void);
1096 
1097 void
1098 AslFilenameHelp (
1099     void);
1100 
1101 void
1102 AslDisassemblyHelp (
1103     void);
1104 
1105 
1106 /*
1107  * aslnamesp - namespace output file generation
1108  */
1109 ACPI_STATUS
1110 NsDisplayNamespace (
1111     void);
1112 
1113 void
1114 NsSetupNamespaceListing (
1115     void                    *Handle);
1116 
1117 /*
1118  * asloptions - command line processing
1119  */
1120 int
1121 AslCommandLine (
1122     int                     argc,
1123     char                    **argv);
1124 
1125 /*
1126  * aslxref - namespace cross reference
1127  */
1128 ACPI_STATUS
1129 XfCrossReferenceNamespace (
1130     void);
1131 
1132 
1133 /*
1134  * aslxrefout
1135  */
1136 void
1137 OtPrintHeaders (
1138     char                    *Message);
1139 
1140 void
1141 OtCreateXrefFile (
1142     void);
1143 
1144 void
1145 OtXrefWalkPart1 (
1146     ACPI_PARSE_OBJECT       *Op,
1147     UINT32                  Level,
1148     ASL_METHOD_INFO         *MethodInfo);
1149 
1150 
1151 /*
1152  * aslutils - common compiler utilites
1153  */
1154 void
1155 DbgPrint (
1156     UINT32                  Type,
1157     char                    *Format,
1158     ...);
1159 
1160 /* Type values for above */
1161 
1162 #define ASL_DEBUG_OUTPUT    0
1163 #define ASL_PARSE_OUTPUT    1
1164 #define ASL_TREE_OUTPUT     2
1165 
1166 UINT8
1167 UtIsBigEndianMachine (
1168     void);
1169 
1170 BOOLEAN
1171 UtQueryForOverwrite (
1172     char                    *Pathname);
1173 
1174 void
1175 UtDumpStringOp (
1176     ACPI_PARSE_OBJECT       *Op,
1177     UINT32                  Level);
1178 
1179 void
1180 UtDumpIntegerOp (
1181     ACPI_PARSE_OBJECT       *Op,
1182     UINT32                  Level,
1183     UINT32                  IntegerLength);
1184 
1185 void
1186 UtDumpBasicOp (
1187     ACPI_PARSE_OBJECT       *Op,
1188     UINT32                  Level);
1189 
1190 void *
1191 UtGetParentMethod (
1192     ACPI_NAMESPACE_NODE     *Node);
1193 
1194 BOOLEAN
1195 UtNodeIsDescendantOf (
1196     ACPI_NAMESPACE_NODE     *Node1,
1197     ACPI_NAMESPACE_NODE     *Node2);
1198 
1199 void
1200 UtDisplaySupportedTables (
1201     void);
1202 
1203 void
1204 UtDisplayConstantOpcodes (
1205     void);
1206 
1207 UINT8
1208 UtBeginEvent (
1209     char                    *Name);
1210 
1211 void
1212 UtEndEvent (
1213     UINT8                   Event);
1214 
1215 void
1216 UtDisplaySummary (
1217     UINT32                  FileId);
1218 
1219 void
1220 UtConvertByteToHex (
1221     UINT8                   RawByte,
1222     UINT8                   *Buffer);
1223 
1224 void
1225 UtConvertByteToAsmHex (
1226     UINT8                   RawByte,
1227     UINT8                   *Buffer);
1228 
1229 char *
1230 UtGetOpName (
1231     UINT32                  ParseOpcode);
1232 
1233 void
1234 UtSetParseOpName (
1235     ACPI_PARSE_OBJECT       *Op);
1236 
1237 ACPI_STATUS
1238 UtInternalizeName (
1239     char                    *ExternalName,
1240     char                    **ConvertedName);
1241 
1242 void
1243 UtAttachNamepathToOwner (
1244     ACPI_PARSE_OBJECT       *Op,
1245     ACPI_PARSE_OBJECT       *NameNode);
1246 
1247 ACPI_PARSE_OBJECT *
1248 UtCheckIntegerRange (
1249     ACPI_PARSE_OBJECT       *Op,
1250     UINT32                  LowValue,
1251     UINT32                  HighValue);
1252 
1253 UINT64
1254 UtDoConstant (
1255     char                    *String);
1256 
1257 
1258 /*
1259  * asluuid - UUID support
1260  */
1261 ACPI_STATUS
1262 AuValidateUuid (
1263     char                    *InString);
1264 
1265 ACPI_STATUS
1266 AuConvertUuidToString (
1267     char                    *UuIdBuffer,
1268     char                    *OutString);
1269 
1270 /*
1271  * aslresource - Resource template generation utilities
1272  */
1273 void
1274 RsSmallAddressCheck (
1275     UINT8                   Type,
1276     UINT32                  Minimum,
1277     UINT32                  Maximum,
1278     UINT32                  Length,
1279     UINT32                  Alignment,
1280     ACPI_PARSE_OBJECT       *MinOp,
1281     ACPI_PARSE_OBJECT       *MaxOp,
1282     ACPI_PARSE_OBJECT       *LengthOp,
1283     ACPI_PARSE_OBJECT       *AlignOp,
1284     ACPI_PARSE_OBJECT       *Op);
1285 
1286 void
1287 RsLargeAddressCheck (
1288     UINT64                  Minimum,
1289     UINT64                  Maximum,
1290     UINT64                  Length,
1291     UINT64                  Granularity,
1292     UINT8                   Flags,
1293     ACPI_PARSE_OBJECT       *MinOp,
1294     ACPI_PARSE_OBJECT       *MaxOp,
1295     ACPI_PARSE_OBJECT       *LengthOp,
1296     ACPI_PARSE_OBJECT       *GranOp,
1297     ACPI_PARSE_OBJECT       *Op);
1298 
1299 UINT16
1300 RsGetStringDataLength (
1301     ACPI_PARSE_OBJECT       *InitializerOp);
1302 
1303 ASL_RESOURCE_NODE *
1304 RsAllocateResourceNode (
1305     UINT32                  Size);
1306 
1307 void
1308 RsCreateResourceField (
1309     ACPI_PARSE_OBJECT       *Op,
1310     char                    *Name,
1311     UINT32                  ByteOffset,
1312     UINT32                  BitOffset,
1313     UINT32                  BitLength);
1314 
1315 void
1316 RsSetFlagBits (
1317     UINT8                   *Flags,
1318     ACPI_PARSE_OBJECT       *Op,
1319     UINT8                   Position,
1320     UINT8                   DefaultBit);
1321 
1322 void
1323 RsSetFlagBits16 (
1324     UINT16                  *Flags,
1325     ACPI_PARSE_OBJECT       *Op,
1326     UINT8                   Position,
1327     UINT8                   DefaultBit);
1328 
1329 ACPI_PARSE_OBJECT *
1330 RsCompleteNodeAndGetNext (
1331     ACPI_PARSE_OBJECT       *Op);
1332 
1333 void
1334 RsCheckListForDuplicates (
1335     ACPI_PARSE_OBJECT       *Op);
1336 
1337 ASL_RESOURCE_NODE *
1338 RsDoOneResourceDescriptor (
1339     ASL_RESOURCE_INFO       *Info,
1340     UINT8                   *State);
1341 
1342 /* Values for State above */
1343 
1344 #define ACPI_RSTATE_NORMAL              0
1345 #define ACPI_RSTATE_START_DEPENDENT     1
1346 #define ACPI_RSTATE_DEPENDENT_LIST      2
1347 
1348 UINT32
1349 RsLinkDescriptorChain (
1350     ASL_RESOURCE_NODE       **PreviousRnode,
1351     ASL_RESOURCE_NODE       *Rnode);
1352 
1353 void
1354 RsDoResourceTemplate (
1355     ACPI_PARSE_OBJECT       *Op);
1356 
1357 
1358 /*
1359  * aslrestype1 - Miscellaneous Small descriptors
1360  */
1361 ASL_RESOURCE_NODE *
1362 RsDoEndTagDescriptor (
1363     ASL_RESOURCE_INFO       *Info);
1364 
1365 ASL_RESOURCE_NODE *
1366 RsDoEndDependentDescriptor (
1367     ASL_RESOURCE_INFO       *Info);
1368 
1369 ASL_RESOURCE_NODE *
1370 RsDoMemory24Descriptor (
1371     ASL_RESOURCE_INFO       *Info);
1372 
1373 ASL_RESOURCE_NODE *
1374 RsDoMemory32Descriptor (
1375     ASL_RESOURCE_INFO       *Info);
1376 
1377 ASL_RESOURCE_NODE *
1378 RsDoMemory32FixedDescriptor (
1379     ASL_RESOURCE_INFO       *Info);
1380 
1381 ASL_RESOURCE_NODE *
1382 RsDoStartDependentDescriptor (
1383     ASL_RESOURCE_INFO       *Info);
1384 
1385 ASL_RESOURCE_NODE *
1386 RsDoStartDependentNoPriDescriptor (
1387     ASL_RESOURCE_INFO       *Info);
1388 
1389 ASL_RESOURCE_NODE *
1390 RsDoVendorSmallDescriptor (
1391     ASL_RESOURCE_INFO       *Info);
1392 
1393 
1394 /*
1395  * aslrestype1i - I/O-related Small descriptors
1396  */
1397 ASL_RESOURCE_NODE *
1398 RsDoDmaDescriptor (
1399     ASL_RESOURCE_INFO       *Info);
1400 
1401 ASL_RESOURCE_NODE *
1402 RsDoFixedDmaDescriptor (
1403     ASL_RESOURCE_INFO       *Info);
1404 
1405 ASL_RESOURCE_NODE *
1406 RsDoFixedIoDescriptor (
1407     ASL_RESOURCE_INFO       *Info);
1408 
1409 ASL_RESOURCE_NODE *
1410 RsDoIoDescriptor (
1411     ASL_RESOURCE_INFO       *Info);
1412 
1413 ASL_RESOURCE_NODE *
1414 RsDoIrqDescriptor (
1415     ASL_RESOURCE_INFO       *Info);
1416 
1417 ASL_RESOURCE_NODE *
1418 RsDoIrqNoFlagsDescriptor (
1419     ASL_RESOURCE_INFO       *Info);
1420 
1421 
1422 /*
1423  * aslrestype2 - Large resource descriptors
1424  */
1425 ASL_RESOURCE_NODE *
1426 RsDoInterruptDescriptor (
1427     ASL_RESOURCE_INFO       *Info);
1428 
1429 ASL_RESOURCE_NODE *
1430 RsDoVendorLargeDescriptor (
1431     ASL_RESOURCE_INFO       *Info);
1432 
1433 ASL_RESOURCE_NODE *
1434 RsDoGeneralRegisterDescriptor (
1435     ASL_RESOURCE_INFO       *Info);
1436 
1437 ASL_RESOURCE_NODE *
1438 RsDoGpioIntDescriptor (
1439     ASL_RESOURCE_INFO       *Info);
1440 
1441 ASL_RESOURCE_NODE *
1442 RsDoGpioIoDescriptor (
1443     ASL_RESOURCE_INFO       *Info);
1444 
1445 ASL_RESOURCE_NODE *
1446 RsDoI2cSerialBusDescriptor (
1447     ASL_RESOURCE_INFO       *Info);
1448 
1449 ASL_RESOURCE_NODE *
1450 RsDoSpiSerialBusDescriptor (
1451     ASL_RESOURCE_INFO       *Info);
1452 
1453 ASL_RESOURCE_NODE *
1454 RsDoUartSerialBusDescriptor (
1455     ASL_RESOURCE_INFO       *Info);
1456 
1457 ASL_RESOURCE_NODE *
1458 RsDoPinFunctionDescriptor (
1459     ASL_RESOURCE_INFO       *Info);
1460 
1461 ASL_RESOURCE_NODE *
1462 RsDoPinConfigDescriptor (
1463     ASL_RESOURCE_INFO       *Info);
1464 
1465 ASL_RESOURCE_NODE *
1466 RsDoPinGroupDescriptor (
1467     ASL_RESOURCE_INFO       *Info);
1468 
1469 ASL_RESOURCE_NODE *
1470 RsDoPinGroupFunctionDescriptor (
1471     ASL_RESOURCE_INFO       *Info);
1472 
1473 ASL_RESOURCE_NODE *
1474 RsDoPinGroupConfigDescriptor (
1475     ASL_RESOURCE_INFO       *Info);
1476 
1477 /*
1478  * aslrestype2d - DWord address descriptors
1479  */
1480 ASL_RESOURCE_NODE *
1481 RsDoDwordIoDescriptor (
1482     ASL_RESOURCE_INFO       *Info);
1483 
1484 ASL_RESOURCE_NODE *
1485 RsDoDwordMemoryDescriptor (
1486     ASL_RESOURCE_INFO       *Info);
1487 
1488 ASL_RESOURCE_NODE *
1489 RsDoDwordSpaceDescriptor (
1490     ASL_RESOURCE_INFO       *Info);
1491 
1492 
1493 /*
1494  * aslrestype2e - Extended address descriptors
1495  */
1496 ASL_RESOURCE_NODE *
1497 RsDoExtendedIoDescriptor (
1498     ASL_RESOURCE_INFO       *Info);
1499 
1500 ASL_RESOURCE_NODE *
1501 RsDoExtendedMemoryDescriptor (
1502     ASL_RESOURCE_INFO       *Info);
1503 
1504 ASL_RESOURCE_NODE *
1505 RsDoExtendedSpaceDescriptor (
1506     ASL_RESOURCE_INFO       *Info);
1507 
1508 
1509 /*
1510  * aslrestype2q - QWord address descriptors
1511  */
1512 ASL_RESOURCE_NODE *
1513 RsDoQwordIoDescriptor (
1514     ASL_RESOURCE_INFO       *Info);
1515 
1516 ASL_RESOURCE_NODE *
1517 RsDoQwordMemoryDescriptor (
1518     ASL_RESOURCE_INFO       *Info);
1519 
1520 ASL_RESOURCE_NODE *
1521 RsDoQwordSpaceDescriptor (
1522     ASL_RESOURCE_INFO       *Info);
1523 
1524 
1525 /*
1526  * aslrestype2w - Word address descriptors
1527  */
1528 ASL_RESOURCE_NODE *
1529 RsDoWordIoDescriptor (
1530     ASL_RESOURCE_INFO       *Info);
1531 
1532 ASL_RESOURCE_NODE *
1533 RsDoWordSpaceDescriptor (
1534     ASL_RESOURCE_INFO       *Info);
1535 
1536 ASL_RESOURCE_NODE *
1537 RsDoWordBusNumberDescriptor (
1538     ASL_RESOURCE_INFO       *Info);
1539 
1540 
1541 /*
1542  * Entry to data table compiler subsystem
1543  */
1544 ACPI_STATUS
1545 DtDoCompile(
1546     void);
1547 
1548 ACPI_STATUS
1549 DtCreateTemplates (
1550     char                    **argv);
1551 
1552 
1553 /*
1554  * ASL/ASL+ converter debug
1555  */
1556 void
1557 CvDbgPrint (
1558     char                    *Fmt,
1559     ...);
1560 
1561 
1562 #endif /*  __ASLCOMPILER_H */
1563