]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/contrib/dev/acpica/compiler/aslcompiler.h
MFC: r323076, r324502, r325670, r326866
[FreeBSD/FreeBSD.git] / sys / contrib / dev / acpica / compiler / aslcompiler.h
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 - 2017, 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 <contrib/dev/acpica/include/acpi.h>
156 #include <contrib/dev/acpica/include/accommon.h>
157 #include <contrib/dev/acpica/include/amlresrc.h>
158 #include <contrib/dev/acpica/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 <contrib/dev/acpica/compiler/asldefine.h>
180 #include <contrib/dev/acpica/compiler/asltypes.h>
181 #include <contrib/dev/acpica/compiler/aslmessages.h>
182 #include <contrib/dev/acpica/compiler/aslglobal.h>
183 #include <contrib/dev/acpica/compiler/preprocess.h>
184 #include <contrib/dev/acpica/compiler/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 UtDisplaySupportedTables (
1192     void);
1193
1194 void
1195 UtDisplayConstantOpcodes (
1196     void);
1197
1198 UINT8
1199 UtBeginEvent (
1200     char                    *Name);
1201
1202 void
1203 UtEndEvent (
1204     UINT8                   Event);
1205
1206 void
1207 UtDisplaySummary (
1208     UINT32                  FileId);
1209
1210 void
1211 UtConvertByteToHex (
1212     UINT8                   RawByte,
1213     UINT8                   *Buffer);
1214
1215 void
1216 UtConvertByteToAsmHex (
1217     UINT8                   RawByte,
1218     UINT8                   *Buffer);
1219
1220 char *
1221 UtGetOpName (
1222     UINT32                  ParseOpcode);
1223
1224 void
1225 UtSetParseOpName (
1226     ACPI_PARSE_OBJECT       *Op);
1227
1228 ACPI_STATUS
1229 UtInternalizeName (
1230     char                    *ExternalName,
1231     char                    **ConvertedName);
1232
1233 void
1234 UtAttachNamepathToOwner (
1235     ACPI_PARSE_OBJECT       *Op,
1236     ACPI_PARSE_OBJECT       *NameNode);
1237
1238 ACPI_PARSE_OBJECT *
1239 UtCheckIntegerRange (
1240     ACPI_PARSE_OBJECT       *Op,
1241     UINT32                  LowValue,
1242     UINT32                  HighValue);
1243
1244 UINT64
1245 UtDoConstant (
1246     char                    *String);
1247
1248
1249 /*
1250  * asluuid - UUID support
1251  */
1252 ACPI_STATUS
1253 AuValidateUuid (
1254     char                    *InString);
1255
1256 ACPI_STATUS
1257 AuConvertUuidToString (
1258     char                    *UuIdBuffer,
1259     char                    *OutString);
1260
1261 /*
1262  * aslresource - Resource template generation utilities
1263  */
1264 void
1265 RsSmallAddressCheck (
1266     UINT8                   Type,
1267     UINT32                  Minimum,
1268     UINT32                  Maximum,
1269     UINT32                  Length,
1270     UINT32                  Alignment,
1271     ACPI_PARSE_OBJECT       *MinOp,
1272     ACPI_PARSE_OBJECT       *MaxOp,
1273     ACPI_PARSE_OBJECT       *LengthOp,
1274     ACPI_PARSE_OBJECT       *AlignOp,
1275     ACPI_PARSE_OBJECT       *Op);
1276
1277 void
1278 RsLargeAddressCheck (
1279     UINT64                  Minimum,
1280     UINT64                  Maximum,
1281     UINT64                  Length,
1282     UINT64                  Granularity,
1283     UINT8                   Flags,
1284     ACPI_PARSE_OBJECT       *MinOp,
1285     ACPI_PARSE_OBJECT       *MaxOp,
1286     ACPI_PARSE_OBJECT       *LengthOp,
1287     ACPI_PARSE_OBJECT       *GranOp,
1288     ACPI_PARSE_OBJECT       *Op);
1289
1290 UINT16
1291 RsGetStringDataLength (
1292     ACPI_PARSE_OBJECT       *InitializerOp);
1293
1294 ASL_RESOURCE_NODE *
1295 RsAllocateResourceNode (
1296     UINT32                  Size);
1297
1298 void
1299 RsCreateResourceField (
1300     ACPI_PARSE_OBJECT       *Op,
1301     char                    *Name,
1302     UINT32                  ByteOffset,
1303     UINT32                  BitOffset,
1304     UINT32                  BitLength);
1305
1306 void
1307 RsSetFlagBits (
1308     UINT8                   *Flags,
1309     ACPI_PARSE_OBJECT       *Op,
1310     UINT8                   Position,
1311     UINT8                   DefaultBit);
1312
1313 void
1314 RsSetFlagBits16 (
1315     UINT16                  *Flags,
1316     ACPI_PARSE_OBJECT       *Op,
1317     UINT8                   Position,
1318     UINT8                   DefaultBit);
1319
1320 ACPI_PARSE_OBJECT *
1321 RsCompleteNodeAndGetNext (
1322     ACPI_PARSE_OBJECT       *Op);
1323
1324 void
1325 RsCheckListForDuplicates (
1326     ACPI_PARSE_OBJECT       *Op);
1327
1328 ASL_RESOURCE_NODE *
1329 RsDoOneResourceDescriptor (
1330     ASL_RESOURCE_INFO       *Info,
1331     UINT8                   *State);
1332
1333 /* Values for State above */
1334
1335 #define ACPI_RSTATE_NORMAL              0
1336 #define ACPI_RSTATE_START_DEPENDENT     1
1337 #define ACPI_RSTATE_DEPENDENT_LIST      2
1338
1339 UINT32
1340 RsLinkDescriptorChain (
1341     ASL_RESOURCE_NODE       **PreviousRnode,
1342     ASL_RESOURCE_NODE       *Rnode);
1343
1344 void
1345 RsDoResourceTemplate (
1346     ACPI_PARSE_OBJECT       *Op);
1347
1348
1349 /*
1350  * aslrestype1 - Miscellaneous Small descriptors
1351  */
1352 ASL_RESOURCE_NODE *
1353 RsDoEndTagDescriptor (
1354     ASL_RESOURCE_INFO       *Info);
1355
1356 ASL_RESOURCE_NODE *
1357 RsDoEndDependentDescriptor (
1358     ASL_RESOURCE_INFO       *Info);
1359
1360 ASL_RESOURCE_NODE *
1361 RsDoMemory24Descriptor (
1362     ASL_RESOURCE_INFO       *Info);
1363
1364 ASL_RESOURCE_NODE *
1365 RsDoMemory32Descriptor (
1366     ASL_RESOURCE_INFO       *Info);
1367
1368 ASL_RESOURCE_NODE *
1369 RsDoMemory32FixedDescriptor (
1370     ASL_RESOURCE_INFO       *Info);
1371
1372 ASL_RESOURCE_NODE *
1373 RsDoStartDependentDescriptor (
1374     ASL_RESOURCE_INFO       *Info);
1375
1376 ASL_RESOURCE_NODE *
1377 RsDoStartDependentNoPriDescriptor (
1378     ASL_RESOURCE_INFO       *Info);
1379
1380 ASL_RESOURCE_NODE *
1381 RsDoVendorSmallDescriptor (
1382     ASL_RESOURCE_INFO       *Info);
1383
1384
1385 /*
1386  * aslrestype1i - I/O-related Small descriptors
1387  */
1388 ASL_RESOURCE_NODE *
1389 RsDoDmaDescriptor (
1390     ASL_RESOURCE_INFO       *Info);
1391
1392 ASL_RESOURCE_NODE *
1393 RsDoFixedDmaDescriptor (
1394     ASL_RESOURCE_INFO       *Info);
1395
1396 ASL_RESOURCE_NODE *
1397 RsDoFixedIoDescriptor (
1398     ASL_RESOURCE_INFO       *Info);
1399
1400 ASL_RESOURCE_NODE *
1401 RsDoIoDescriptor (
1402     ASL_RESOURCE_INFO       *Info);
1403
1404 ASL_RESOURCE_NODE *
1405 RsDoIrqDescriptor (
1406     ASL_RESOURCE_INFO       *Info);
1407
1408 ASL_RESOURCE_NODE *
1409 RsDoIrqNoFlagsDescriptor (
1410     ASL_RESOURCE_INFO       *Info);
1411
1412
1413 /*
1414  * aslrestype2 - Large resource descriptors
1415  */
1416 ASL_RESOURCE_NODE *
1417 RsDoInterruptDescriptor (
1418     ASL_RESOURCE_INFO       *Info);
1419
1420 ASL_RESOURCE_NODE *
1421 RsDoVendorLargeDescriptor (
1422     ASL_RESOURCE_INFO       *Info);
1423
1424 ASL_RESOURCE_NODE *
1425 RsDoGeneralRegisterDescriptor (
1426     ASL_RESOURCE_INFO       *Info);
1427
1428 ASL_RESOURCE_NODE *
1429 RsDoGpioIntDescriptor (
1430     ASL_RESOURCE_INFO       *Info);
1431
1432 ASL_RESOURCE_NODE *
1433 RsDoGpioIoDescriptor (
1434     ASL_RESOURCE_INFO       *Info);
1435
1436 ASL_RESOURCE_NODE *
1437 RsDoI2cSerialBusDescriptor (
1438     ASL_RESOURCE_INFO       *Info);
1439
1440 ASL_RESOURCE_NODE *
1441 RsDoSpiSerialBusDescriptor (
1442     ASL_RESOURCE_INFO       *Info);
1443
1444 ASL_RESOURCE_NODE *
1445 RsDoUartSerialBusDescriptor (
1446     ASL_RESOURCE_INFO       *Info);
1447
1448 ASL_RESOURCE_NODE *
1449 RsDoPinFunctionDescriptor (
1450     ASL_RESOURCE_INFO       *Info);
1451
1452 ASL_RESOURCE_NODE *
1453 RsDoPinConfigDescriptor (
1454     ASL_RESOURCE_INFO       *Info);
1455
1456 ASL_RESOURCE_NODE *
1457 RsDoPinGroupDescriptor (
1458     ASL_RESOURCE_INFO       *Info);
1459
1460 ASL_RESOURCE_NODE *
1461 RsDoPinGroupFunctionDescriptor (
1462     ASL_RESOURCE_INFO       *Info);
1463
1464 ASL_RESOURCE_NODE *
1465 RsDoPinGroupConfigDescriptor (
1466     ASL_RESOURCE_INFO       *Info);
1467
1468 /*
1469  * aslrestype2d - DWord address descriptors
1470  */
1471 ASL_RESOURCE_NODE *
1472 RsDoDwordIoDescriptor (
1473     ASL_RESOURCE_INFO       *Info);
1474
1475 ASL_RESOURCE_NODE *
1476 RsDoDwordMemoryDescriptor (
1477     ASL_RESOURCE_INFO       *Info);
1478
1479 ASL_RESOURCE_NODE *
1480 RsDoDwordSpaceDescriptor (
1481     ASL_RESOURCE_INFO       *Info);
1482
1483
1484 /*
1485  * aslrestype2e - Extended address descriptors
1486  */
1487 ASL_RESOURCE_NODE *
1488 RsDoExtendedIoDescriptor (
1489     ASL_RESOURCE_INFO       *Info);
1490
1491 ASL_RESOURCE_NODE *
1492 RsDoExtendedMemoryDescriptor (
1493     ASL_RESOURCE_INFO       *Info);
1494
1495 ASL_RESOURCE_NODE *
1496 RsDoExtendedSpaceDescriptor (
1497     ASL_RESOURCE_INFO       *Info);
1498
1499
1500 /*
1501  * aslrestype2q - QWord address descriptors
1502  */
1503 ASL_RESOURCE_NODE *
1504 RsDoQwordIoDescriptor (
1505     ASL_RESOURCE_INFO       *Info);
1506
1507 ASL_RESOURCE_NODE *
1508 RsDoQwordMemoryDescriptor (
1509     ASL_RESOURCE_INFO       *Info);
1510
1511 ASL_RESOURCE_NODE *
1512 RsDoQwordSpaceDescriptor (
1513     ASL_RESOURCE_INFO       *Info);
1514
1515
1516 /*
1517  * aslrestype2w - Word address descriptors
1518  */
1519 ASL_RESOURCE_NODE *
1520 RsDoWordIoDescriptor (
1521     ASL_RESOURCE_INFO       *Info);
1522
1523 ASL_RESOURCE_NODE *
1524 RsDoWordSpaceDescriptor (
1525     ASL_RESOURCE_INFO       *Info);
1526
1527 ASL_RESOURCE_NODE *
1528 RsDoWordBusNumberDescriptor (
1529     ASL_RESOURCE_INFO       *Info);
1530
1531
1532 /*
1533  * Entry to data table compiler subsystem
1534  */
1535 ACPI_STATUS
1536 DtDoCompile(
1537     void);
1538
1539 ACPI_STATUS
1540 DtCreateTemplates (
1541     char                    **argv);
1542
1543
1544 /*
1545  * ASL/ASL+ converter debug
1546  */
1547 void
1548 CvDbgPrint (
1549     char                    *Fmt,
1550     ...);
1551
1552
1553 #endif /*  __ASLCOMPILER_H */