2 /******************************************************************************
4 * Module Name: aslcompiler.h - common include file for iASL
7 *****************************************************************************/
9 /******************************************************************************
13 * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
14 * All rights reserved.
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24 * copy of the source code appearing in this file ("Covered Code") an
25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26 * base code distributed originally by Intel ("Original Intel Code") to copy,
27 * make derivatives, distribute, use and display any portion of the Covered
28 * Code in any form, with the right to sublicense such rights; and
30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31 * license (with the right to sublicense), under only those claims of Intel
32 * patents that are infringed by the Original Intel Code, to make, use, sell,
33 * offer to sell, and import the Covered Code and derivative works thereof
34 * solely to the minimum extent necessary to exercise the above copyright
35 * license, and in no event shall the patent license extend to any additions
36 * to or modifications of the Original Intel Code. No other license or right
37 * is granted directly or by implication, estoppel or otherwise;
39 * The above copyright and patent license is granted only if the following
44 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45 * Redistribution of source code of any substantial portion of the Covered
46 * Code or modification with rights to further distribute source must include
47 * the above Copyright Notice, the above License, this list of Conditions,
48 * and the following Disclaimer and Export Compliance provision. In addition,
49 * Licensee must cause all Covered Code to which Licensee contributes to
50 * contain a file documenting the changes Licensee made to create that Covered
51 * Code and the date of any change. Licensee must include in that file the
52 * documentation of any changes made by any predecessor Licensee. Licensee
53 * must include a prominent statement that the modification is derived,
54 * directly or indirectly, from Original Intel Code.
56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57 * Redistribution of source code of any substantial portion of the Covered
58 * Code or modification without rights to further distribute source must
59 * include the following Disclaimer and Export Compliance provision in the
60 * documentation and/or other materials provided with distribution. In
61 * addition, Licensee may not authorize further sublicense of source of any
62 * portion of the Covered Code, and must include terms to the effect that the
63 * license from Licensee to its licensee is limited to the intellectual
64 * property embodied in the software Licensee provides to its licensee, and
65 * not to intellectual property embodied in modifications its licensee may
68 * 3.3. Redistribution of Executable. Redistribution in executable form of any
69 * substantial portion of the Covered Code or modification must reproduce the
70 * above Copyright Notice, and the following Disclaimer and Export Compliance
71 * provision in the documentation and/or other materials provided with the
74 * 3.4. Intel retains all right, title, and interest in and to the Original
77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78 * Intel shall be used in advertising or otherwise to promote the sale, use or
79 * other dealings in products derived from or relating to the Covered Code
80 * without prior written authorization from Intel.
82 * 4. Disclaimer and Export Compliance
84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
87 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
101 * 4.3. Licensee shall not export, either directly or indirectly, any of this
102 * software or system incorporating such software without first obtaining any
103 * required license or other approval from the U. S. Department of Commerce or
104 * any other agency or department of the United States Government. In the
105 * event Licensee exports any such software from the United States or
106 * re-exports any such software from a foreign destination, Licensee shall
107 * ensure that the distribution and export/re-export of the software is in
108 * compliance with all laws, regulations, orders, or other restrictions of the
109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110 * any of its subsidiaries will export/re-export any technical data, process,
111 * software, or service, directly or indirectly, to any country for which the
112 * United States government or any agency thereof requires an export license,
113 * other governmental approval, or letter of assurance, without first obtaining
114 * such license, approval or letter.
116 *****************************************************************************/
119 #ifndef __ASLCOMPILER_H
120 #define __ASLCOMPILER_H
123 /* Microsoft-specific */
125 #if (defined WIN32 || defined WIN64)
127 /* warn : used #pragma pack */
128 #pragma warning(disable:4103)
130 /* warn : named type definition in parentheses */
131 #pragma warning(disable:4115)
142 #include <contrib/dev/acpica/acpi.h>
143 #include <contrib/dev/acpica/amlresrc.h>
144 #include <contrib/dev/acpica/acdebug.h>
146 /* Compiler headers */
148 #include <contrib/dev/acpica/compiler/asldefine.h>
149 #include <contrib/dev/acpica/compiler/asltypes.h>
150 #include <contrib/dev/acpica/compiler/aslglobal.h>
153 /*******************************************************************************
155 * Compiler prototypes
157 ******************************************************************************/
160 * parser - generated from flex/bison, lex/yacc, etc.
175 ResetCurrentLineBuffer (
183 AslPopInputFileStack (
187 AslPushInputFileStack (
193 * aslcompile - compile mainline
200 AslCompilerFileHeader (
217 * aslanalyze - semantic analysis
220 AnOtherSemanticAnalysisWalkBegin (
221 ACPI_PARSE_OBJECT *Op,
226 AnOtherSemanticAnalysisWalkEnd (
227 ACPI_PARSE_OBJECT *Op,
232 AnOperandTypecheckWalkBegin (
233 ACPI_PARSE_OBJECT *Op,
238 AnOperandTypecheckWalkEnd (
239 ACPI_PARSE_OBJECT *Op,
244 AnMethodAnalysisWalkBegin (
245 ACPI_PARSE_OBJECT *Op,
250 AnMethodAnalysisWalkEnd (
251 ACPI_PARSE_OBJECT *Op,
256 AnMethodTypingWalkBegin (
257 ACPI_PARSE_OBJECT *Op,
262 AnMethodTypingWalkEnd (
263 ACPI_PARSE_OBJECT *Op,
269 * aslerror - error handling/reporting
275 ACPI_PARSE_OBJECT *Op,
279 AslCoreSubsystemError (
280 ACPI_PARSE_OBJECT *Op,
293 UINT32 CurrentLineNumber,
294 UINT32 LogicalLineNumber,
295 UINT32 LogicalByteOffset,
303 ASL_ERROR_MSG *Enode,
310 ACPI_PHYSICAL_ADDRESS
311 AeLocalGetRootPointer (
316 * asllisting - generate all "listing" type files
323 LsWriteNodeToAsmListing (
324 ACPI_PARSE_OBJECT *Op);
328 ACPI_PARSE_OBJECT *Op,
340 * aslfold - constant folding
344 ACPI_PARSE_OBJECT *Op,
350 * aslopcodes - generate AML opcodes
354 ACPI_PARSE_OBJECT *Op,
359 OpcAmlOpcodeUpdateWalk (
360 ACPI_PARSE_OBJECT *Op,
365 OpcGenerateAmlOpcode (
366 ACPI_PARSE_OBJECT *Op);
369 OpcSetOptimalIntegerSize (
370 ACPI_PARSE_OBJECT *Op);
374 ACPI_PARSE_OBJECT *Op);
378 * asloperands - generate AML operands for the AML opcodes
382 ACPI_PARSE_OBJECT *Op,
386 OpnGenerateAmlOperands (
387 ACPI_PARSE_OBJECT *Op);
391 ACPI_PARSE_OBJECT *Op);
395 * aslopt - optmization
398 OptOptimizeNamePath (
399 ACPI_PARSE_OBJECT *Op,
401 ACPI_WALK_STATE *WalkState,
403 ACPI_NAMESPACE_NODE *TargetNode);
407 * aslcodegen - code generation
410 CgGenerateAmlOutput (
415 * asllength - calculate/adjust AML package lengths
418 LnPackageLengthWalk (
419 ACPI_PARSE_OBJECT *Op,
425 ACPI_PARSE_OBJECT *Op,
430 CgGenerateAmlLengths (
431 ACPI_PARSE_OBJECT *Op);
435 * aslmap - opcode mappings and reserved method names
438 AslMapNamedOpcodeToDataType (
442 MpDisplayReservedNames (
447 * asltransform - parse tree transformations
451 ACPI_PARSE_OBJECT *Op,
457 * asltree - parse tree support
461 ACPI_PARSE_OBJECT *Op,
463 ASL_WALK_CALLBACK DescendingCallback,
464 ASL_WALK_CALLBACK AscendingCallback,
467 /* Values for "Visitation" parameter above */
469 #define ASL_WALK_VISIT_DOWNWARD 0x01
470 #define ASL_WALK_VISIT_UPWARD 0x02
471 #define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD)
480 ACPI_PARSE_OBJECT *Op);
485 ACPI_PARSE_OBJECT *Op);
498 TrCreateValuedLeafNode (
504 ACPI_PARSE_OBJECT *Op,
510 ACPI_PARSE_OBJECT *Op);
518 ACPI_PARSE_OBJECT *Op1,
519 ACPI_PARSE_OBJECT *Op2);
523 ACPI_PARSE_OBJECT *Op1,
524 ACPI_PARSE_OBJECT *Op2);
528 ACPI_PARSE_OBJECT *Op,
538 * aslfiles - File I/O support
546 ACPI_PARSE_OBJECT *Op);
582 ACPI_PARSE_OBJECT *Op);
586 char *InputFilename);
589 FlOpenAmlOutputFile (
590 char *InputFilename);
593 FlOpenMiscOutputFiles (
594 char *InputFilename);
598 * asload - load namespace in prep for cross reference
602 ACPI_PARSE_OBJECT *RootOp);
606 * asllookup - namespace cross reference
609 LkCrossReferenceNamespace (
613 LkFindUnreferencedObjects (
622 * aslutils - common compiler utilites
630 /* Type values for above */
632 #define ASL_DEBUG_OUTPUT 0
633 #define ASL_PARSE_OUTPUT 1
634 #define ASL_TREE_OUTPUT 2
637 UtDisplayConstantOpcodes (
653 UtPrintFormattedName (
671 UtConvertByteToAsmHex (
681 ACPI_PARSE_OBJECT *Op);
690 char **ConvertedName);
693 UtAttachNamepathToOwner (
694 ACPI_PARSE_OBJECT *Op,
695 ACPI_PARSE_OBJECT *NameNode);
698 UtCheckIntegerRange (
699 ACPI_PARSE_OBJECT *Op,
709 * aslresource - Resource template generation utilities
712 RsAllocateResourceNode (
717 ACPI_PARSE_OBJECT *Op,
724 ACPI_PARSE_OBJECT *Op,
731 ACPI_PARSE_OBJECT *Op,
736 RsCompleteNodeAndGetNext (
737 ACPI_PARSE_OBJECT *Op);
740 RsCheckListForDuplicates (
741 ACPI_PARSE_OBJECT *Op);
744 RsDoOneResourceDescriptor (
745 ACPI_PARSE_OBJECT *DescriptorTypeOp,
746 UINT32 CurrentByteOffset,
749 /* Values for State above */
751 #define ACPI_RSTATE_NORMAL 0
752 #define ACPI_RSTATE_START_DEPENDENT 1
753 #define ACPI_RSTATE_DEPENDENT_LIST 2
756 RsLinkDescriptorChain (
757 ASL_RESOURCE_NODE **PreviousRnode,
758 ASL_RESOURCE_NODE *Rnode);
761 RsDoResourceTemplate (
762 ACPI_PARSE_OBJECT *Op);
766 * aslrestype1 - generate Small descriptors
769 RsDoEndTagDescriptor (
770 ACPI_PARSE_OBJECT *Op,
771 UINT32 CurrentByteOffset);
775 ACPI_PARSE_OBJECT *Op,
776 UINT32 CurrentByteOffset);
779 RsDoEndDependentDescriptor (
780 ACPI_PARSE_OBJECT *Op,
781 UINT32 CurrentByteOffset);
784 RsDoFixedIoDescriptor (
785 ACPI_PARSE_OBJECT *Op,
786 UINT32 CurrentByteOffset);
790 ACPI_PARSE_OBJECT *Op,
791 UINT32 CurrentByteOffset);
795 ACPI_PARSE_OBJECT *Op,
796 UINT32 CurrentByteOffset);
799 RsDoIrqNoFlagsDescriptor (
800 ACPI_PARSE_OBJECT *Op,
801 UINT32 CurrentByteOffset);
804 RsDoMemory24Descriptor (
805 ACPI_PARSE_OBJECT *Op,
806 UINT32 CurrentByteOffset);
809 RsDoMemory32Descriptor (
810 ACPI_PARSE_OBJECT *Op,
811 UINT32 CurrentByteOffset);
814 RsDoMemory32FixedDescriptor (
815 ACPI_PARSE_OBJECT *Op,
816 UINT32 CurrentByteOffset);
819 RsDoStartDependentDescriptor (
820 ACPI_PARSE_OBJECT *Op,
821 UINT32 CurrentByteOffset);
824 RsDoStartDependentNoPriDescriptor (
825 ACPI_PARSE_OBJECT *Op,
826 UINT32 CurrentByteOffset);
829 RsDoVendorSmallDescriptor (
830 ACPI_PARSE_OBJECT *Op,
831 UINT32 CurrentByteOffset);
835 * aslrestype2 - generate Large descriptors
838 RsDoInterruptDescriptor (
839 ACPI_PARSE_OBJECT *Op,
840 UINT32 CurrentByteOffset);
843 RsDoDwordIoDescriptor (
844 ACPI_PARSE_OBJECT *Op,
845 UINT32 CurrentByteOffset);
848 RsDoDwordMemoryDescriptor (
849 ACPI_PARSE_OBJECT *Op,
850 UINT32 CurrentByteOffset);
853 RsDoDwordSpaceDescriptor (
854 ACPI_PARSE_OBJECT *Op,
855 UINT32 CurrentByteOffset);
858 RsDoExtendedIoDescriptor (
859 ACPI_PARSE_OBJECT *Op,
860 UINT32 CurrentByteOffset);
863 RsDoExtendedMemoryDescriptor (
864 ACPI_PARSE_OBJECT *Op,
865 UINT32 CurrentByteOffset);
868 RsDoExtendedSpaceDescriptor (
869 ACPI_PARSE_OBJECT *Op,
870 UINT32 CurrentByteOffset);
873 RsDoQwordIoDescriptor (
874 ACPI_PARSE_OBJECT *Op,
875 UINT32 CurrentByteOffset);
878 RsDoQwordMemoryDescriptor (
879 ACPI_PARSE_OBJECT *Op,
880 UINT32 CurrentByteOffset);
883 RsDoQwordSpaceDescriptor (
884 ACPI_PARSE_OBJECT *Op,
885 UINT32 CurrentByteOffset);
888 RsDoWordIoDescriptor (
889 ACPI_PARSE_OBJECT *Op,
890 UINT32 CurrentByteOffset);
893 RsDoWordSpaceDescriptor (
894 ACPI_PARSE_OBJECT *Op,
895 UINT32 CurrentByteOffset);
898 RsDoWordBusNumberDescriptor (
899 ACPI_PARSE_OBJECT *Op,
900 UINT32 CurrentByteOffset);
903 RsDoVendorLargeDescriptor (
904 ACPI_PARSE_OBJECT *Op,
905 UINT32 CurrentByteOffset);
908 RsDoGeneralRegisterDescriptor (
909 ACPI_PARSE_OBJECT *Op,
910 UINT32 CurrentByteOffset);
912 #endif /* __ASLCOMPILER_H */