2 /******************************************************************************
4 * Module Name: aslcompiler.h - common include file for iASL
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
13 * All rights reserved.
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
38 * The above copyright and patent license is granted only if the following
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
73 * 3.4. Intel retains all right, title, and interest in and to the Original
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
81 * 4. Disclaimer and Export Compliance
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************/
118 #ifndef __ASLCOMPILER_H
119 #define __ASLCOMPILER_H
122 /* Microsoft-specific */
124 #if (defined WIN32 || defined WIN64)
126 /* warn : used #pragma pack */
127 #pragma warning(disable:4103)
129 /* warn : named type definition in parentheses */
130 #pragma warning(disable:4115)
142 #include "accommon.h"
143 #include "amlresrc.h"
146 /* Compiler headers */
148 #include "asldefine.h"
149 #include "asltypes.h"
150 #include "aslglobal.h"
153 /*******************************************************************************
155 * Compiler prototypes
157 ******************************************************************************/
160 * parser - generated from flex/bison, lex/yacc, etc.
175 ResetCurrentLineBuffer (
183 AslPopInputFileStack (
187 AslPushInputFileStack (
192 * aslstartup - called from main
203 * aslcompile - compile mainline
210 AslCompilerFileHeader (
227 * aslanalyze - semantic analysis
230 AnOtherSemanticAnalysisWalkBegin (
231 ACPI_PARSE_OBJECT *Op,
236 AnOtherSemanticAnalysisWalkEnd (
237 ACPI_PARSE_OBJECT *Op,
242 AnOperandTypecheckWalkBegin (
243 ACPI_PARSE_OBJECT *Op,
248 AnOperandTypecheckWalkEnd (
249 ACPI_PARSE_OBJECT *Op,
254 AnMethodAnalysisWalkBegin (
255 ACPI_PARSE_OBJECT *Op,
260 AnMethodAnalysisWalkEnd (
261 ACPI_PARSE_OBJECT *Op,
266 AnMethodTypingWalkBegin (
267 ACPI_PARSE_OBJECT *Op,
272 AnMethodTypingWalkEnd (
273 ACPI_PARSE_OBJECT *Op,
279 * aslerror - error handling/reporting
285 ACPI_PARSE_OBJECT *Op,
289 AslCoreSubsystemError (
290 ACPI_PARSE_OBJECT *Op,
303 UINT32 CurrentLineNumber,
304 UINT32 LogicalLineNumber,
305 UINT32 LogicalByteOffset,
313 ASL_ERROR_MSG *Enode,
324 ACPI_PHYSICAL_ADDRESS
325 AeLocalGetRootPointer (
330 * asllisting - generate all "listing" type files
337 LsWriteNodeToAsmListing (
338 ACPI_PARSE_OBJECT *Op);
342 ACPI_PARSE_OBJECT *Op,
354 * aslfold - constant folding
358 ACPI_PARSE_OBJECT *Op,
364 * aslopcodes - generate AML opcodes
368 ACPI_PARSE_OBJECT *Op,
373 OpcAmlOpcodeUpdateWalk (
374 ACPI_PARSE_OBJECT *Op,
379 OpcGenerateAmlOpcode (
380 ACPI_PARSE_OBJECT *Op);
383 OpcSetOptimalIntegerSize (
384 ACPI_PARSE_OBJECT *Op);
388 ACPI_PARSE_OBJECT *Op);
392 * asloperands - generate AML operands for the AML opcodes
396 ACPI_PARSE_OBJECT *Op,
400 OpnGenerateAmlOperands (
401 ACPI_PARSE_OBJECT *Op);
405 ACPI_PARSE_OBJECT *Op);
409 * aslopt - optmization
412 OptOptimizeNamePath (
413 ACPI_PARSE_OBJECT *Op,
415 ACPI_WALK_STATE *WalkState,
417 ACPI_NAMESPACE_NODE *TargetNode);
421 * aslcodegen - code generation
424 CgGenerateAmlOutput (
429 * asllength - calculate/adjust AML package lengths
432 LnPackageLengthWalk (
433 ACPI_PARSE_OBJECT *Op,
439 ACPI_PARSE_OBJECT *Op,
444 CgGenerateAmlLengths (
445 ACPI_PARSE_OBJECT *Op);
449 * aslmap - opcode mappings and reserved method names
452 AslMapNamedOpcodeToDataType (
456 MpDisplayReservedNames (
461 * asltransform - parse tree transformations
465 ACPI_PARSE_OBJECT *Op,
471 * asltree - parse tree support
475 ACPI_PARSE_OBJECT *Op,
477 ASL_WALK_CALLBACK DescendingCallback,
478 ASL_WALK_CALLBACK AscendingCallback,
481 /* Values for "Visitation" parameter above */
483 #define ASL_WALK_VISIT_DOWNWARD 0x01
484 #define ASL_WALK_VISIT_UPWARD 0x02
485 #define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD)
494 ACPI_PARSE_OBJECT *Op);
499 ACPI_PARSE_OBJECT *Op);
512 TrCreateValuedLeafNode (
518 ACPI_PARSE_OBJECT *Op,
524 ACPI_PARSE_OBJECT *Op);
532 ACPI_PARSE_OBJECT *Op1,
533 ACPI_PARSE_OBJECT *Op2);
537 ACPI_PARSE_OBJECT *Op1,
538 ACPI_PARSE_OBJECT *Op2);
542 ACPI_PARSE_OBJECT *Op,
552 * aslfiles - File I/O support
559 FlAddIncludeDirectory (
564 ACPI_PARSE_OBJECT *Op);
600 ACPI_PARSE_OBJECT *Op);
604 char *InputFilename);
607 FlOpenAmlOutputFile (
608 char *InputFilename);
611 FlOpenMiscOutputFiles (
612 char *InputFilename);
616 * asload - load namespace in prep for cross reference
620 ACPI_PARSE_OBJECT *RootOp);
624 * asllookup - namespace cross reference
627 LkCrossReferenceNamespace (
631 LkFindUnreferencedObjects (
640 * aslutils - common compiler utilites
648 /* Type values for above */
650 #define ASL_DEBUG_OUTPUT 0
651 #define ASL_PARSE_OUTPUT 1
652 #define ASL_TREE_OUTPUT 2
655 UtDisplayConstantOpcodes (
671 UtPrintFormattedName (
689 UtConvertByteToAsmHex (
699 ACPI_PARSE_OBJECT *Op);
708 char **ConvertedName);
711 UtAttachNamepathToOwner (
712 ACPI_PARSE_OBJECT *Op,
713 ACPI_PARSE_OBJECT *NameNode);
716 UtCheckIntegerRange (
717 ACPI_PARSE_OBJECT *Op,
727 * aslresource - Resource template generation utilities
730 RsAllocateResourceNode (
735 ACPI_PARSE_OBJECT *Op,
742 ACPI_PARSE_OBJECT *Op,
749 ACPI_PARSE_OBJECT *Op,
754 RsCompleteNodeAndGetNext (
755 ACPI_PARSE_OBJECT *Op);
758 RsCheckListForDuplicates (
759 ACPI_PARSE_OBJECT *Op);
762 RsDoOneResourceDescriptor (
763 ACPI_PARSE_OBJECT *DescriptorTypeOp,
764 UINT32 CurrentByteOffset,
767 /* Values for State above */
769 #define ACPI_RSTATE_NORMAL 0
770 #define ACPI_RSTATE_START_DEPENDENT 1
771 #define ACPI_RSTATE_DEPENDENT_LIST 2
774 RsLinkDescriptorChain (
775 ASL_RESOURCE_NODE **PreviousRnode,
776 ASL_RESOURCE_NODE *Rnode);
779 RsDoResourceTemplate (
780 ACPI_PARSE_OBJECT *Op);
784 * aslrestype1 - generate Small descriptors
787 RsDoEndTagDescriptor (
788 ACPI_PARSE_OBJECT *Op,
789 UINT32 CurrentByteOffset);
793 ACPI_PARSE_OBJECT *Op,
794 UINT32 CurrentByteOffset);
797 RsDoEndDependentDescriptor (
798 ACPI_PARSE_OBJECT *Op,
799 UINT32 CurrentByteOffset);
802 RsDoFixedIoDescriptor (
803 ACPI_PARSE_OBJECT *Op,
804 UINT32 CurrentByteOffset);
808 ACPI_PARSE_OBJECT *Op,
809 UINT32 CurrentByteOffset);
813 ACPI_PARSE_OBJECT *Op,
814 UINT32 CurrentByteOffset);
817 RsDoIrqNoFlagsDescriptor (
818 ACPI_PARSE_OBJECT *Op,
819 UINT32 CurrentByteOffset);
822 RsDoMemory24Descriptor (
823 ACPI_PARSE_OBJECT *Op,
824 UINT32 CurrentByteOffset);
827 RsDoMemory32Descriptor (
828 ACPI_PARSE_OBJECT *Op,
829 UINT32 CurrentByteOffset);
832 RsDoMemory32FixedDescriptor (
833 ACPI_PARSE_OBJECT *Op,
834 UINT32 CurrentByteOffset);
837 RsDoStartDependentDescriptor (
838 ACPI_PARSE_OBJECT *Op,
839 UINT32 CurrentByteOffset);
842 RsDoStartDependentNoPriDescriptor (
843 ACPI_PARSE_OBJECT *Op,
844 UINT32 CurrentByteOffset);
847 RsDoVendorSmallDescriptor (
848 ACPI_PARSE_OBJECT *Op,
849 UINT32 CurrentByteOffset);
853 * aslrestype2 - generate Large descriptors
856 RsDoInterruptDescriptor (
857 ACPI_PARSE_OBJECT *Op,
858 UINT32 CurrentByteOffset);
861 RsDoDwordIoDescriptor (
862 ACPI_PARSE_OBJECT *Op,
863 UINT32 CurrentByteOffset);
866 RsDoDwordMemoryDescriptor (
867 ACPI_PARSE_OBJECT *Op,
868 UINT32 CurrentByteOffset);
871 RsDoDwordSpaceDescriptor (
872 ACPI_PARSE_OBJECT *Op,
873 UINT32 CurrentByteOffset);
876 RsDoExtendedIoDescriptor (
877 ACPI_PARSE_OBJECT *Op,
878 UINT32 CurrentByteOffset);
881 RsDoExtendedMemoryDescriptor (
882 ACPI_PARSE_OBJECT *Op,
883 UINT32 CurrentByteOffset);
886 RsDoExtendedSpaceDescriptor (
887 ACPI_PARSE_OBJECT *Op,
888 UINT32 CurrentByteOffset);
891 RsDoQwordIoDescriptor (
892 ACPI_PARSE_OBJECT *Op,
893 UINT32 CurrentByteOffset);
896 RsDoQwordMemoryDescriptor (
897 ACPI_PARSE_OBJECT *Op,
898 UINT32 CurrentByteOffset);
901 RsDoQwordSpaceDescriptor (
902 ACPI_PARSE_OBJECT *Op,
903 UINT32 CurrentByteOffset);
906 RsDoWordIoDescriptor (
907 ACPI_PARSE_OBJECT *Op,
908 UINT32 CurrentByteOffset);
911 RsDoWordSpaceDescriptor (
912 ACPI_PARSE_OBJECT *Op,
913 UINT32 CurrentByteOffset);
916 RsDoWordBusNumberDescriptor (
917 ACPI_PARSE_OBJECT *Op,
918 UINT32 CurrentByteOffset);
921 RsDoVendorLargeDescriptor (
922 ACPI_PARSE_OBJECT *Op,
923 UINT32 CurrentByteOffset);
926 RsDoGeneralRegisterDescriptor (
927 ACPI_PARSE_OBJECT *Op,
928 UINT32 CurrentByteOffset);
930 #endif /* __ASLCOMPILER_H */