xref: /illumos-gate/usr/src/cmd/acpi/iasl/aslrules.y (revision 35786f68)
1bc36eafdSMike Gerdts NoEcho('
2bc36eafdSMike Gerdts /******************************************************************************
3bc36eafdSMike Gerdts  *
4bc36eafdSMike Gerdts  * Module Name: aslrules.y - Main Bison/Yacc production rules
5*35786f68SRobert Mustacchi  *                         - Keep this file synched with the
6*35786f68SRobert Mustacchi  *                           CvParseOpBlockType function in cvcompiler.c
7bc36eafdSMike Gerdts  *
8bc36eafdSMike Gerdts  *****************************************************************************/
9bc36eafdSMike Gerdts 
10*35786f68SRobert Mustacchi /******************************************************************************
11*35786f68SRobert Mustacchi  *
12*35786f68SRobert Mustacchi  * 1. Copyright Notice
13*35786f68SRobert Mustacchi  *
14*35786f68SRobert Mustacchi  * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
15bc36eafdSMike Gerdts  * All rights reserved.
16bc36eafdSMike Gerdts  *
17*35786f68SRobert Mustacchi  * 2. License
18*35786f68SRobert Mustacchi  *
19*35786f68SRobert Mustacchi  * 2.1. This is your license from Intel Corp. under its intellectual property
20*35786f68SRobert Mustacchi  * rights. You may have additional license terms from the party that provided
21*35786f68SRobert Mustacchi  * you this software, covering your right to use that party's intellectual
22*35786f68SRobert Mustacchi  * property rights.
23*35786f68SRobert Mustacchi  *
24*35786f68SRobert Mustacchi  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
25*35786f68SRobert Mustacchi  * copy of the source code appearing in this file ("Covered Code") an
26*35786f68SRobert Mustacchi  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
27*35786f68SRobert Mustacchi  * base code distributed originally by Intel ("Original Intel Code") to copy,
28*35786f68SRobert Mustacchi  * make derivatives, distribute, use and display any portion of the Covered
29*35786f68SRobert Mustacchi  * Code in any form, with the right to sublicense such rights; and
30*35786f68SRobert Mustacchi  *
31*35786f68SRobert Mustacchi  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
32*35786f68SRobert Mustacchi  * license (with the right to sublicense), under only those claims of Intel
33*35786f68SRobert Mustacchi  * patents that are infringed by the Original Intel Code, to make, use, sell,
34*35786f68SRobert Mustacchi  * offer to sell, and import the Covered Code and derivative works thereof
35*35786f68SRobert Mustacchi  * solely to the minimum extent necessary to exercise the above copyright
36*35786f68SRobert Mustacchi  * license, and in no event shall the patent license extend to any additions
37*35786f68SRobert Mustacchi  * to or modifications of the Original Intel Code. No other license or right
38*35786f68SRobert Mustacchi  * is granted directly or by implication, estoppel or otherwise;
39*35786f68SRobert Mustacchi  *
40*35786f68SRobert Mustacchi  * The above copyright and patent license is granted only if the following
41*35786f68SRobert Mustacchi  * conditions are met:
42*35786f68SRobert Mustacchi  *
43*35786f68SRobert Mustacchi  * 3. Conditions
44*35786f68SRobert Mustacchi  *
45*35786f68SRobert Mustacchi  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
46*35786f68SRobert Mustacchi  * Redistribution of source code of any substantial portion of the Covered
47*35786f68SRobert Mustacchi  * Code or modification with rights to further distribute source must include
48*35786f68SRobert Mustacchi  * the above Copyright Notice, the above License, this list of Conditions,
49*35786f68SRobert Mustacchi  * and the following Disclaimer and Export Compliance provision. In addition,
50*35786f68SRobert Mustacchi  * Licensee must cause all Covered Code to which Licensee contributes to
51*35786f68SRobert Mustacchi  * contain a file documenting the changes Licensee made to create that Covered
52*35786f68SRobert Mustacchi  * Code and the date of any change. Licensee must include in that file the
53*35786f68SRobert Mustacchi  * documentation of any changes made by any predecessor Licensee. Licensee
54*35786f68SRobert Mustacchi  * must include a prominent statement that the modification is derived,
55*35786f68SRobert Mustacchi  * directly or indirectly, from Original Intel Code.
56*35786f68SRobert Mustacchi  *
57*35786f68SRobert Mustacchi  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
58*35786f68SRobert Mustacchi  * Redistribution of source code of any substantial portion of the Covered
59*35786f68SRobert Mustacchi  * Code or modification without rights to further distribute source must
60*35786f68SRobert Mustacchi  * include the following Disclaimer and Export Compliance provision in the
61*35786f68SRobert Mustacchi  * documentation and/or other materials provided with distribution. In
62*35786f68SRobert Mustacchi  * addition, Licensee may not authorize further sublicense of source of any
63*35786f68SRobert Mustacchi  * portion of the Covered Code, and must include terms to the effect that the
64*35786f68SRobert Mustacchi  * license from Licensee to its licensee is limited to the intellectual
65*35786f68SRobert Mustacchi  * property embodied in the software Licensee provides to its licensee, and
66*35786f68SRobert Mustacchi  * not to intellectual property embodied in modifications its licensee may
67*35786f68SRobert Mustacchi  * make.
68*35786f68SRobert Mustacchi  *
69*35786f68SRobert Mustacchi  * 3.3. Redistribution of Executable. Redistribution in executable form of any
70*35786f68SRobert Mustacchi  * substantial portion of the Covered Code or modification must reproduce the
71*35786f68SRobert Mustacchi  * above Copyright Notice, and the following Disclaimer and Export Compliance
72*35786f68SRobert Mustacchi  * provision in the documentation and/or other materials provided with the
73*35786f68SRobert Mustacchi  * distribution.
74*35786f68SRobert Mustacchi  *
75*35786f68SRobert Mustacchi  * 3.4. Intel retains all right, title, and interest in and to the Original
76*35786f68SRobert Mustacchi  * Intel Code.
77*35786f68SRobert Mustacchi  *
78*35786f68SRobert Mustacchi  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
79*35786f68SRobert Mustacchi  * Intel shall be used in advertising or otherwise to promote the sale, use or
80*35786f68SRobert Mustacchi  * other dealings in products derived from or relating to the Covered Code
81*35786f68SRobert Mustacchi  * without prior written authorization from Intel.
82*35786f68SRobert Mustacchi  *
83*35786f68SRobert Mustacchi  * 4. Disclaimer and Export Compliance
84*35786f68SRobert Mustacchi  *
85*35786f68SRobert Mustacchi  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
86*35786f68SRobert Mustacchi  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
87*35786f68SRobert Mustacchi  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
88*35786f68SRobert Mustacchi  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
89*35786f68SRobert Mustacchi  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
90*35786f68SRobert Mustacchi  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
91*35786f68SRobert Mustacchi  * PARTICULAR PURPOSE.
92*35786f68SRobert Mustacchi  *
93*35786f68SRobert Mustacchi  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
94*35786f68SRobert Mustacchi  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
95*35786f68SRobert Mustacchi  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
96*35786f68SRobert Mustacchi  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
97*35786f68SRobert Mustacchi  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
98*35786f68SRobert Mustacchi  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
99*35786f68SRobert Mustacchi  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
100*35786f68SRobert Mustacchi  * LIMITED REMEDY.
101*35786f68SRobert Mustacchi  *
102*35786f68SRobert Mustacchi  * 4.3. Licensee shall not export, either directly or indirectly, any of this
103*35786f68SRobert Mustacchi  * software or system incorporating such software without first obtaining any
104*35786f68SRobert Mustacchi  * required license or other approval from the U. S. Department of Commerce or
105*35786f68SRobert Mustacchi  * any other agency or department of the United States Government. In the
106*35786f68SRobert Mustacchi  * event Licensee exports any such software from the United States or
107*35786f68SRobert Mustacchi  * re-exports any such software from a foreign destination, Licensee shall
108*35786f68SRobert Mustacchi  * ensure that the distribution and export/re-export of the software is in
109*35786f68SRobert Mustacchi  * compliance with all laws, regulations, orders, or other restrictions of the
110*35786f68SRobert Mustacchi  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
111*35786f68SRobert Mustacchi  * any of its subsidiaries will export/re-export any technical data, process,
112*35786f68SRobert Mustacchi  * software, or service, directly or indirectly, to any country for which the
113*35786f68SRobert Mustacchi  * United States government or any agency thereof requires an export license,
114*35786f68SRobert Mustacchi  * other governmental approval, or letter of assurance, without first obtaining
115*35786f68SRobert Mustacchi  * such license, approval or letter.
116*35786f68SRobert Mustacchi  *
117*35786f68SRobert Mustacchi  *****************************************************************************
118*35786f68SRobert Mustacchi  *
119*35786f68SRobert Mustacchi  * Alternatively, you may choose to be licensed under the terms of the
120*35786f68SRobert Mustacchi  * following license:
121*35786f68SRobert Mustacchi  *
122bc36eafdSMike Gerdts  * Redistribution and use in source and binary forms, with or without
123bc36eafdSMike Gerdts  * modification, are permitted provided that the following conditions
124bc36eafdSMike Gerdts  * are met:
125bc36eafdSMike Gerdts  * 1. Redistributions of source code must retain the above copyright
126bc36eafdSMike Gerdts  *    notice, this list of conditions, and the following disclaimer,
127bc36eafdSMike Gerdts  *    without modification.
128bc36eafdSMike Gerdts  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
129bc36eafdSMike Gerdts  *    substantially similar to the "NO WARRANTY" disclaimer below
130bc36eafdSMike Gerdts  *    ("Disclaimer") and any redistribution must be conditioned upon
131bc36eafdSMike Gerdts  *    including a substantially similar Disclaimer requirement for further
132bc36eafdSMike Gerdts  *    binary redistribution.
133bc36eafdSMike Gerdts  * 3. Neither the names of the above-listed copyright holders nor the names
134bc36eafdSMike Gerdts  *    of any contributors may be used to endorse or promote products derived
135bc36eafdSMike Gerdts  *    from this software without specific prior written permission.
136bc36eafdSMike Gerdts  *
137bc36eafdSMike Gerdts  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
138bc36eafdSMike Gerdts  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
139*35786f68SRobert Mustacchi  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
140bc36eafdSMike Gerdts  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
141*35786f68SRobert Mustacchi  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
142*35786f68SRobert Mustacchi  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
143*35786f68SRobert Mustacchi  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
144*35786f68SRobert Mustacchi  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
145*35786f68SRobert Mustacchi  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
146*35786f68SRobert Mustacchi  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
147*35786f68SRobert Mustacchi  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
148*35786f68SRobert Mustacchi  *
149*35786f68SRobert Mustacchi  * Alternatively, you may choose to be licensed under the terms of the
150*35786f68SRobert Mustacchi  * GNU General Public License ("GPL") version 2 as published by the Free
151*35786f68SRobert Mustacchi  * Software Foundation.
152*35786f68SRobert Mustacchi  *
153*35786f68SRobert Mustacchi  *****************************************************************************/
154bc36eafdSMike Gerdts 
155bc36eafdSMike Gerdts ')
156bc36eafdSMike Gerdts 
157bc36eafdSMike Gerdts /*******************************************************************************
158bc36eafdSMike Gerdts  *
159bc36eafdSMike Gerdts  * ASL Root and Secondary Terms
160bc36eafdSMike Gerdts  *
161bc36eafdSMike Gerdts  ******************************************************************************/
162bc36eafdSMike Gerdts 
163bc36eafdSMike Gerdts /*
164bc36eafdSMike Gerdts  * Root term. Allow multiple #line directives before the definition block
165bc36eafdSMike Gerdts  * to handle output from preprocessors
166bc36eafdSMike Gerdts  */
167bc36eafdSMike Gerdts AslCode
168*35786f68SRobert Mustacchi     : DefinitionBlockList           {$<n>$ = TrLinkOpChildren (
169*35786f68SRobert Mustacchi                                         TrCreateLeafOp (PARSEOP_ASL_CODE),1, $1);}
170bc36eafdSMike Gerdts     | error                         {YYABORT; $$ = NULL;}
171bc36eafdSMike Gerdts     ;
172bc36eafdSMike Gerdts 
173bc36eafdSMike Gerdts 
174bc36eafdSMike Gerdts /*
175bc36eafdSMike Gerdts  * Note concerning support for "module-level code".
176bc36eafdSMike Gerdts  *
177bc36eafdSMike Gerdts  * ACPI 1.0 allowed Type1 and Type2 executable opcodes outside of control
178bc36eafdSMike Gerdts  * methods (the so-called module-level code.) This support was explicitly
179bc36eafdSMike Gerdts  * removed in ACPI 2.0, but this type of code continues to be created by
180bc36eafdSMike Gerdts  * BIOS vendors. In order to support the disassembly and recompilation of
181bc36eafdSMike Gerdts  * such code (and the porting of ASL code to iASL), iASL supports this
182bc36eafdSMike Gerdts  * code in violation of the current ACPI specification.
183bc36eafdSMike Gerdts  *
184bc36eafdSMike Gerdts  * The grammar change to support module-level code is to revert the
185bc36eafdSMike Gerdts  * {ObjectList} portion of the DefinitionBlockTerm in ACPI 2.0 to the
186bc36eafdSMike Gerdts  * original use of {TermList} instead (see below.) This allows the use
187bc36eafdSMike Gerdts  * of Type1 and Type2 opcodes at module level.
188bc36eafdSMike Gerdts  *
189bc36eafdSMike Gerdts  * 04/2016: The module-level code is now allowed in the following terms:
190bc36eafdSMike Gerdts  * DeviceTerm, PowerResTerm, ProcessorTerm, ScopeTerm, ThermalZoneTerm.
191bc36eafdSMike Gerdts  * The ObjectList term is obsolete and has been removed.
192bc36eafdSMike Gerdts  */
193bc36eafdSMike Gerdts DefinitionBlockTerm
194*35786f68SRobert Mustacchi     : PARSEOP_DEFINITION_BLOCK
195*35786f68SRobert Mustacchi         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_DEFINITION_BLOCK); COMMENT_CAPTURE_OFF;}
196bc36eafdSMike Gerdts         String ','
197bc36eafdSMike Gerdts         String ','
198bc36eafdSMike Gerdts         ByteConst ','
199bc36eafdSMike Gerdts         String ','
200bc36eafdSMike Gerdts         String ','
201bc36eafdSMike Gerdts         DWordConst
202*35786f68SRobert Mustacchi         PARSEOP_CLOSE_PAREN         {TrSetOpIntegerWidth ($6,$8);
203*35786f68SRobert Mustacchi                                         TrSetOpEndLineNumber ($<n>3); COMMENT_CAPTURE_ON;}
204*35786f68SRobert Mustacchi             '{' TermList '}'        {$$ = TrLinkOpChildren ($<n>3,7,
205*35786f68SRobert Mustacchi                                         $4,$6,$8,$10,$12,$14,$18);}
206bc36eafdSMike Gerdts     ;
207bc36eafdSMike Gerdts 
208bc36eafdSMike Gerdts DefinitionBlockList
209bc36eafdSMike Gerdts     : DefinitionBlockTerm
210bc36eafdSMike Gerdts     | DefinitionBlockTerm
211*35786f68SRobert Mustacchi         DefinitionBlockList         {$$ = TrLinkPeerOps (2, $1,$2);}
212*35786f68SRobert Mustacchi     ;
213*35786f68SRobert Mustacchi 
214*35786f68SRobert Mustacchi 
215*35786f68SRobert Mustacchi /******* Basic ASCII identifiers **************************************************/
216*35786f68SRobert Mustacchi 
217*35786f68SRobert Mustacchi /* Allow IO, DMA, IRQ Resource macro and FOR macro names to also be used as identifiers */
218*35786f68SRobert Mustacchi 
219*35786f68SRobert Mustacchi NameString
220*35786f68SRobert Mustacchi     : NameSeg                       {}
221*35786f68SRobert Mustacchi     | PARSEOP_NAMESTRING            {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) $1);}
222*35786f68SRobert Mustacchi     | PARSEOP_IO                    {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");}
223*35786f68SRobert Mustacchi     | PARSEOP_DMA                   {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");}
224*35786f68SRobert Mustacchi     | PARSEOP_IRQ                   {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");}
225*35786f68SRobert Mustacchi     | PARSEOP_FOR                   {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "FOR");}
226*35786f68SRobert Mustacchi     ;
227*35786f68SRobert Mustacchi /*
228*35786f68SRobert Mustacchi NameSeg
229*35786f68SRobert Mustacchi     : PARSEOP_NAMESEG               {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESEG, (ACPI_NATIVE_INT)
230*35786f68SRobert Mustacchi                                         TrNormalizeNameSeg ($1));}
231*35786f68SRobert Mustacchi     ;
232*35786f68SRobert Mustacchi */
233*35786f68SRobert Mustacchi 
234*35786f68SRobert Mustacchi NameSeg
235*35786f68SRobert Mustacchi     : PARSEOP_NAMESEG               {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESEG,
236*35786f68SRobert Mustacchi                                         (ACPI_NATIVE_INT) AslCompilerlval.s);}
237*35786f68SRobert Mustacchi     ;
238*35786f68SRobert Mustacchi 
239*35786f68SRobert Mustacchi 
240*35786f68SRobert Mustacchi /******* Fundamental argument/statement types ***********************************/
241*35786f68SRobert Mustacchi 
242*35786f68SRobert Mustacchi Term
243*35786f68SRobert Mustacchi     : Object                        {}
244*35786f68SRobert Mustacchi     | Type1Opcode                   {}
245*35786f68SRobert Mustacchi     | Type2Opcode                   {}
246*35786f68SRobert Mustacchi     | Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
247*35786f68SRobert Mustacchi     | Type2StringOpcode             {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
248*35786f68SRobert Mustacchi     | Type2BufferOpcode             {}
249*35786f68SRobert Mustacchi     | Type2BufferOrStringOpcode     {}
250*35786f68SRobert Mustacchi     | error                         {$$ = AslDoError(); yyclearin;}
251bc36eafdSMike Gerdts     ;
252bc36eafdSMike Gerdts 
253bc36eafdSMike Gerdts SuperName
254*35786f68SRobert Mustacchi     : SimpleName                    {}
255bc36eafdSMike Gerdts     | DebugTerm                     {}
256bc36eafdSMike Gerdts     | Type6Opcode                   {}
257*35786f68SRobert Mustacchi     ;
258bc36eafdSMike Gerdts 
259bc36eafdSMike Gerdts Target
260*35786f68SRobert Mustacchi     :                               {$$ = TrCreateNullTargetOp ();} /* Placeholder is a ZeroOp object */
261*35786f68SRobert Mustacchi     | ','                           {$$ = TrCreateNullTargetOp ();} /* Placeholder is a ZeroOp object */
262*35786f68SRobert Mustacchi     | ',' SuperName                 {$$ = TrSetOpFlags ($2, OP_IS_TARGET);}
263*35786f68SRobert Mustacchi     ;
264*35786f68SRobert Mustacchi 
265*35786f68SRobert Mustacchi RequiredTarget
266*35786f68SRobert Mustacchi     : ',' SuperName                 {$$ = TrSetOpFlags ($2, OP_IS_TARGET);}
267bc36eafdSMike Gerdts     ;
268bc36eafdSMike Gerdts 
269bc36eafdSMike Gerdts TermArg
270*35786f68SRobert Mustacchi     : SimpleName                    {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
271*35786f68SRobert Mustacchi     | Type2Opcode                   {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
272*35786f68SRobert Mustacchi     | DataObject                    {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
273*35786f68SRobert Mustacchi     | PARSEOP_OPEN_PAREN
274*35786f68SRobert Mustacchi         TermArg
275*35786f68SRobert Mustacchi         PARSEOP_CLOSE_PAREN         {$$ = TrSetOpFlags ($2, OP_IS_TERM_ARG);}
276bc36eafdSMike Gerdts     ;
277bc36eafdSMike Gerdts 
278bc36eafdSMike Gerdts /*
279bc36eafdSMike Gerdts  NOTE: Removed from TermArg due to reduce/reduce conflicts:
280*35786f68SRobert Mustacchi     | Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
281*35786f68SRobert Mustacchi     | Type2StringOpcode             {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
282*35786f68SRobert Mustacchi     | Type2BufferOpcode             {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
283*35786f68SRobert Mustacchi     | Type2BufferOrStringOpcode     {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
284bc36eafdSMike Gerdts 
285bc36eafdSMike Gerdts */
286bc36eafdSMike Gerdts 
287bc36eafdSMike Gerdts MethodInvocationTerm
288*35786f68SRobert Mustacchi     : NameString
289*35786f68SRobert Mustacchi         PARSEOP_OPEN_PAREN          {TrSetOpIntegerValue (PARSEOP_METHODCALL, $1); COMMENT_CAPTURE_OFF;}
290*35786f68SRobert Mustacchi         ArgList
291*35786f68SRobert Mustacchi         PARSEOP_CLOSE_PAREN         {$$ = TrLinkChildOp ($1,$4); COMMENT_CAPTURE_ON;}
292bc36eafdSMike Gerdts     ;
293bc36eafdSMike Gerdts 
294bc36eafdSMike Gerdts /* OptionalCount must appear before ByteList or an incorrect reduction will result */
295bc36eafdSMike Gerdts 
296bc36eafdSMike Gerdts OptionalCount
297*35786f68SRobert Mustacchi     :                               {$$ = TrCreateLeafOp (PARSEOP_ONES);}       /* Placeholder is a OnesOp object */
298*35786f68SRobert Mustacchi     | ','                           {$$ = TrCreateLeafOp (PARSEOP_ONES);}       /* Placeholder is a OnesOp object */
299bc36eafdSMike Gerdts     | ',' TermArg                   {$$ = $2;}
300bc36eafdSMike Gerdts     ;
301bc36eafdSMike Gerdts 
302*35786f68SRobert Mustacchi /*
303*35786f68SRobert Mustacchi  * Data count for buffers and packages (byte count for buffers,
304*35786f68SRobert Mustacchi  * element count for packages).
305*35786f68SRobert Mustacchi  */
306*35786f68SRobert Mustacchi OptionalDataCount
307*35786f68SRobert Mustacchi 
308*35786f68SRobert Mustacchi         /* Legacy ASL */
309*35786f68SRobert Mustacchi     :                               {$$ = NULL;}
310*35786f68SRobert Mustacchi     | PARSEOP_OPEN_PAREN
311*35786f68SRobert Mustacchi         TermArg
312*35786f68SRobert Mustacchi         PARSEOP_CLOSE_PAREN         {$$ = $2;}
313*35786f68SRobert Mustacchi     | PARSEOP_OPEN_PAREN
314*35786f68SRobert Mustacchi         PARSEOP_CLOSE_PAREN         {$$ = NULL;}
315*35786f68SRobert Mustacchi 
316*35786f68SRobert Mustacchi         /* C-style (ASL+) -- adds equals term */
317*35786f68SRobert Mustacchi 
318*35786f68SRobert Mustacchi     |  PARSEOP_EXP_EQUALS           {$$ = NULL;}
319*35786f68SRobert Mustacchi 
320*35786f68SRobert Mustacchi     | PARSEOP_OPEN_PAREN
321*35786f68SRobert Mustacchi         TermArg
322*35786f68SRobert Mustacchi         PARSEOP_CLOSE_PAREN
323*35786f68SRobert Mustacchi         PARSEOP_EXP_EQUALS          {$$ = $2;}
324*35786f68SRobert Mustacchi 
325*35786f68SRobert Mustacchi     | PARSEOP_OPEN_PAREN
326*35786f68SRobert Mustacchi         PARSEOP_CLOSE_PAREN
327*35786f68SRobert Mustacchi         String
328*35786f68SRobert Mustacchi         PARSEOP_EXP_EQUALS          {$$ = NULL;}
329bc36eafdSMike Gerdts     ;
330bc36eafdSMike Gerdts 
331bc36eafdSMike Gerdts 
332bc36eafdSMike Gerdts /******* List Terms **************************************************/
333bc36eafdSMike Gerdts 
334*35786f68SRobert Mustacchi     /* ACPI 3.0 -- allow semicolons between terms */
335*35786f68SRobert Mustacchi 
336*35786f68SRobert Mustacchi TermList
337*35786f68SRobert Mustacchi     :                               {$$ = NULL;}
338*35786f68SRobert Mustacchi     | TermList Term                 {$$ = TrLinkPeerOp (
339*35786f68SRobert Mustacchi                                         TrSetOpFlags ($1, OP_RESULT_NOT_USED),$2);}
340*35786f68SRobert Mustacchi     | TermList Term ';'             {$$ = TrLinkPeerOp (
341*35786f68SRobert Mustacchi                                         TrSetOpFlags ($1, OP_RESULT_NOT_USED),$2);}
342*35786f68SRobert Mustacchi     | TermList ';' Term             {$$ = TrLinkPeerOp (
343*35786f68SRobert Mustacchi                                         TrSetOpFlags ($1, OP_RESULT_NOT_USED),$3);}
344*35786f68SRobert Mustacchi     | TermList ';' Term ';'         {$$ = TrLinkPeerOp (
345*35786f68SRobert Mustacchi                                         TrSetOpFlags ($1, OP_RESULT_NOT_USED),$3);}
346*35786f68SRobert Mustacchi     ;
347*35786f68SRobert Mustacchi 
348bc36eafdSMike Gerdts ArgList
349bc36eafdSMike Gerdts     :                               {$$ = NULL;}
350bc36eafdSMike Gerdts     | TermArg
351bc36eafdSMike Gerdts     | ArgList ','                   /* Allows a trailing comma at list end */
352bc36eafdSMike Gerdts     | ArgList ','
353*35786f68SRobert Mustacchi         TermArg                     {$$ = TrLinkPeerOp ($1,$3);}
354bc36eafdSMike Gerdts     ;
355bc36eafdSMike Gerdts 
356bc36eafdSMike Gerdts ByteList
357bc36eafdSMike Gerdts     :                               {$$ = NULL;}
358bc36eafdSMike Gerdts     | ByteConstExpr
359bc36eafdSMike Gerdts     | ByteList ','                  /* Allows a trailing comma at list end */
360bc36eafdSMike Gerdts     | ByteList ','
361*35786f68SRobert Mustacchi         ByteConstExpr               {$$ = TrLinkPeerOp ($1,$3);}
362bc36eafdSMike Gerdts     ;
363bc36eafdSMike Gerdts 
364bc36eafdSMike Gerdts DWordList
365bc36eafdSMike Gerdts     :                               {$$ = NULL;}
366bc36eafdSMike Gerdts     | DWordConstExpr
367bc36eafdSMike Gerdts     | DWordList ','                 /* Allows a trailing comma at list end */
368bc36eafdSMike Gerdts     | DWordList ','
369*35786f68SRobert Mustacchi         DWordConstExpr              {$$ = TrLinkPeerOp ($1,$3);}
370bc36eafdSMike Gerdts     ;
371bc36eafdSMike Gerdts 
372bc36eafdSMike Gerdts FieldUnitList
373bc36eafdSMike Gerdts     :                               {$$ = NULL;}
374bc36eafdSMike Gerdts     | FieldUnit
375bc36eafdSMike Gerdts     | FieldUnitList ','             /* Allows a trailing comma at list end */
376bc36eafdSMike Gerdts     | FieldUnitList ','
377*35786f68SRobert Mustacchi         FieldUnit                   {$$ = TrLinkPeerOp ($1,$3);}
378bc36eafdSMike Gerdts     ;
379bc36eafdSMike Gerdts 
380bc36eafdSMike Gerdts FieldUnit
381bc36eafdSMike Gerdts     : FieldUnitEntry                {}
382bc36eafdSMike Gerdts     | OffsetTerm                    {}
383bc36eafdSMike Gerdts     | AccessAsTerm                  {}
384bc36eafdSMike Gerdts     | ConnectionTerm                {}
385bc36eafdSMike Gerdts     ;
386bc36eafdSMike Gerdts 
387bc36eafdSMike Gerdts FieldUnitEntry
388*35786f68SRobert Mustacchi     : ',' AmlPackageLengthTerm      {$$ = TrCreateOp (PARSEOP_RESERVED_BYTES,1,$2);}
389bc36eafdSMike Gerdts     | NameSeg ','
390*35786f68SRobert Mustacchi         AmlPackageLengthTerm        {$$ = TrLinkChildOp ($1,$3);}
391bc36eafdSMike Gerdts     ;
392bc36eafdSMike Gerdts 
393bc36eafdSMike Gerdts Object
394bc36eafdSMike Gerdts     : CompilerDirective             {}
395bc36eafdSMike Gerdts     | NamedObject                   {}
396bc36eafdSMike Gerdts     | NameSpaceModifier             {}
397*35786f68SRobert Mustacchi /*    | StructureTerm                 {} */
398bc36eafdSMike Gerdts     ;
399bc36eafdSMike Gerdts 
400bc36eafdSMike Gerdts PackageList
401bc36eafdSMike Gerdts     :                               {$$ = NULL;}
402bc36eafdSMike Gerdts     | PackageElement
403bc36eafdSMike Gerdts     | PackageList ','               /* Allows a trailing comma at list end */
404bc36eafdSMike Gerdts     | PackageList ','
405*35786f68SRobert Mustacchi         PackageElement              {$$ = TrLinkPeerOp ($1,$3);}
406bc36eafdSMike Gerdts     ;
407bc36eafdSMike Gerdts 
408bc36eafdSMike Gerdts PackageElement
409bc36eafdSMike Gerdts     : DataObject                    {}
410bc36eafdSMike Gerdts     | NameString                    {}
411bc36eafdSMike Gerdts     ;
412bc36eafdSMike Gerdts 
413bc36eafdSMike Gerdts     /* Rules for specifying the type of one method argument or return value */
414bc36eafdSMike Gerdts 
415bc36eafdSMike Gerdts ParameterTypePackage
416bc36eafdSMike Gerdts     :                               {$$ = NULL;}
417bc36eafdSMike Gerdts     | ObjectTypeKeyword             {$$ = $1;}
418bc36eafdSMike Gerdts     | ParameterTypePackage ','
419*35786f68SRobert Mustacchi         ObjectTypeKeyword           {$$ = TrLinkPeerOps (2,$1,$3);}
420bc36eafdSMike Gerdts     ;
421bc36eafdSMike Gerdts 
422bc36eafdSMike Gerdts ParameterTypePackageList
423bc36eafdSMike Gerdts     :                               {$$ = NULL;}
424bc36eafdSMike Gerdts     | ObjectTypeKeyword             {$$ = $1;}
425bc36eafdSMike Gerdts     | '{' ParameterTypePackage '}'  {$$ = $2;}
426bc36eafdSMike Gerdts     ;
427bc36eafdSMike Gerdts 
428bc36eafdSMike Gerdts OptionalParameterTypePackage
429*35786f68SRobert Mustacchi     :                               {$$ = TrCreateLeafOp (PARSEOP_DEFAULT_ARG);}
430*35786f68SRobert Mustacchi     | ',' ParameterTypePackageList  {$$ = TrLinkOpChildren (
431*35786f68SRobert Mustacchi                                         TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
432bc36eafdSMike Gerdts     ;
433bc36eafdSMike Gerdts 
434bc36eafdSMike Gerdts     /* Rules for specifying the types for method arguments */
435bc36eafdSMike Gerdts 
436bc36eafdSMike Gerdts ParameterTypesPackage
437bc36eafdSMike Gerdts     : ParameterTypePackageList      {$$ = $1;}
438bc36eafdSMike Gerdts     | ParameterTypesPackage ','
439*35786f68SRobert Mustacchi         ParameterTypePackageList    {$$ = TrLinkPeerOps (2,$1,$3);}
440bc36eafdSMike Gerdts     ;
441bc36eafdSMike Gerdts 
442bc36eafdSMike Gerdts ParameterTypesPackageList
443bc36eafdSMike Gerdts     :                               {$$ = NULL;}
444bc36eafdSMike Gerdts     | ObjectTypeKeyword             {$$ = $1;}
445bc36eafdSMike Gerdts     | '{' ParameterTypesPackage '}' {$$ = $2;}
446bc36eafdSMike Gerdts     ;
447bc36eafdSMike Gerdts 
448bc36eafdSMike Gerdts OptionalParameterTypesPackage
449*35786f68SRobert Mustacchi     :                               {$$ = TrCreateLeafOp (PARSEOP_DEFAULT_ARG);}
450*35786f68SRobert Mustacchi     | ',' ParameterTypesPackageList {$$ = TrLinkOpChildren (
451*35786f68SRobert Mustacchi                                         TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
452bc36eafdSMike Gerdts     ;
453bc36eafdSMike Gerdts 
454bc36eafdSMike Gerdts /*
455bc36eafdSMike Gerdts  * Case-Default list; allow only one Default term and unlimited Case terms
456bc36eafdSMike Gerdts  */
457bc36eafdSMike Gerdts CaseDefaultTermList
458bc36eafdSMike Gerdts     :                               {$$ = NULL;}
459*35786f68SRobert Mustacchi     | CaseTerm                      {}
460*35786f68SRobert Mustacchi     | DefaultTerm                   {}
461bc36eafdSMike Gerdts     | CaseDefaultTermList
462*35786f68SRobert Mustacchi         CaseTerm                    {$$ = TrLinkPeerOp ($1,$2);}
463bc36eafdSMike Gerdts     | CaseDefaultTermList
464*35786f68SRobert Mustacchi         DefaultTerm                 {$$ = TrLinkPeerOp ($1,$2);}
465bc36eafdSMike Gerdts 
466bc36eafdSMike Gerdts /* Original - attempts to force zero or one default term within the switch */
467bc36eafdSMike Gerdts 
468bc36eafdSMike Gerdts /*
469bc36eafdSMike Gerdts CaseDefaultTermList
470bc36eafdSMike Gerdts     :                               {$$ = NULL;}
471bc36eafdSMike Gerdts     | CaseTermList
472bc36eafdSMike Gerdts         DefaultTerm
473*35786f68SRobert Mustacchi         CaseTermList                {$$ = TrLinkPeerOp ($1,TrLinkPeerOp ($2, $3));}
474bc36eafdSMike Gerdts     | CaseTermList
475*35786f68SRobert Mustacchi         CaseTerm                    {$$ = TrLinkPeerOp ($1,$2);}
476bc36eafdSMike Gerdts     ;
477bc36eafdSMike Gerdts 
478bc36eafdSMike Gerdts CaseTermList
479bc36eafdSMike Gerdts     :                               {$$ = NULL;}
480bc36eafdSMike Gerdts     | CaseTerm                      {}
481bc36eafdSMike Gerdts     | CaseTermList
482*35786f68SRobert Mustacchi         CaseTerm                    {$$ = TrLinkPeerOp ($1,$2);}
483bc36eafdSMike Gerdts     ;
484bc36eafdSMike Gerdts */
485bc36eafdSMike Gerdts 
486bc36eafdSMike Gerdts 
487bc36eafdSMike Gerdts /*******************************************************************************
488bc36eafdSMike Gerdts  *
489bc36eafdSMike Gerdts  * ASL Data and Constant Terms
490bc36eafdSMike Gerdts  *
491bc36eafdSMike Gerdts  ******************************************************************************/
492bc36eafdSMike Gerdts 
493bc36eafdSMike Gerdts DataObject
494bc36eafdSMike Gerdts     : BufferData                    {}
495bc36eafdSMike Gerdts     | PackageData                   {}
496bc36eafdSMike Gerdts     | IntegerData                   {}
497bc36eafdSMike Gerdts     | StringData                    {}
498bc36eafdSMike Gerdts     ;
499bc36eafdSMike Gerdts 
500bc36eafdSMike Gerdts BufferData
501*35786f68SRobert Mustacchi     : Type5Opcode                   {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
502*35786f68SRobert Mustacchi     | Type2BufferOrStringOpcode     {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
503*35786f68SRobert Mustacchi     | Type2BufferOpcode             {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
504bc36eafdSMike Gerdts     | BufferTerm                    {}
505bc36eafdSMike Gerdts     ;
506bc36eafdSMike Gerdts 
507bc36eafdSMike Gerdts PackageData
508bc36eafdSMike Gerdts     : PackageTerm                   {}
509bc36eafdSMike Gerdts     ;
510bc36eafdSMike Gerdts 
511bc36eafdSMike Gerdts IntegerData
512*35786f68SRobert Mustacchi     : Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
513*35786f68SRobert Mustacchi     | Type3Opcode                   {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
514bc36eafdSMike Gerdts     | Integer                       {}
515bc36eafdSMike Gerdts     | ConstTerm                     {}
516bc36eafdSMike Gerdts     ;
517bc36eafdSMike Gerdts 
518bc36eafdSMike Gerdts StringData
519*35786f68SRobert Mustacchi     : Type2StringOpcode             {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
520bc36eafdSMike Gerdts     | String                        {}
521bc36eafdSMike Gerdts     ;
522bc36eafdSMike Gerdts 
523bc36eafdSMike Gerdts ByteConst
524*35786f68SRobert Mustacchi     : Integer                       {$$ = TrSetOpIntegerValue (PARSEOP_BYTECONST, $1);}
525bc36eafdSMike Gerdts     ;
526bc36eafdSMike Gerdts 
527bc36eafdSMike Gerdts WordConst
528*35786f68SRobert Mustacchi     : Integer                       {$$ = TrSetOpIntegerValue (PARSEOP_WORDCONST, $1);}
529bc36eafdSMike Gerdts     ;
530bc36eafdSMike Gerdts 
531bc36eafdSMike Gerdts DWordConst
532*35786f68SRobert Mustacchi     : Integer                       {$$ = TrSetOpIntegerValue (PARSEOP_DWORDCONST, $1);}
533bc36eafdSMike Gerdts     ;
534bc36eafdSMike Gerdts 
535bc36eafdSMike Gerdts QWordConst
536*35786f68SRobert Mustacchi     : Integer                       {$$ = TrSetOpIntegerValue (PARSEOP_QWORDCONST, $1);}
537bc36eafdSMike Gerdts     ;
538bc36eafdSMike Gerdts 
539bc36eafdSMike Gerdts /*
540*35786f68SRobert Mustacchi  * The OP_COMPILE_TIME_CONST flag in the following constant expressions
541bc36eafdSMike Gerdts  * enables compile-time constant folding to reduce the Type3Opcodes/Type2IntegerOpcodes
542bc36eafdSMike Gerdts  * to simple integers. It is an error if these types of expressions cannot be
543bc36eafdSMike Gerdts  * reduced, since the AML grammar for ****ConstExpr requires a simple constant.
544bc36eafdSMike Gerdts  * Note: The required byte length of the constant is passed through to the
545bc36eafdSMike Gerdts  * constant folding code in the node AmlLength field.
546bc36eafdSMike Gerdts  */
547bc36eafdSMike Gerdts ByteConstExpr
548*35786f68SRobert Mustacchi     : Type3Opcode                   {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
549*35786f68SRobert Mustacchi                                         TrSetOpAmlLength ($1, 1);}
550*35786f68SRobert Mustacchi     | Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
551*35786f68SRobert Mustacchi                                         TrSetOpAmlLength ($1, 1);}
552*35786f68SRobert Mustacchi     | ConstExprTerm                 {$$ = TrSetOpIntegerValue (PARSEOP_BYTECONST, $1);}
553bc36eafdSMike Gerdts     | ByteConst                     {}
554bc36eafdSMike Gerdts     ;
555bc36eafdSMike Gerdts 
556bc36eafdSMike Gerdts WordConstExpr
557*35786f68SRobert Mustacchi     : Type3Opcode                   {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
558*35786f68SRobert Mustacchi                                         TrSetOpAmlLength ($1, 2);}
559*35786f68SRobert Mustacchi     | Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
560*35786f68SRobert Mustacchi                                         TrSetOpAmlLength ($1, 2);}
561*35786f68SRobert Mustacchi     | ConstExprTerm                 {$$ = TrSetOpIntegerValue (PARSEOP_WORDCONST, $1);}
562bc36eafdSMike Gerdts     | WordConst                     {}
563bc36eafdSMike Gerdts     ;
564bc36eafdSMike Gerdts 
565bc36eafdSMike Gerdts DWordConstExpr
566*35786f68SRobert Mustacchi     : Type3Opcode                   {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
567*35786f68SRobert Mustacchi                                         TrSetOpAmlLength ($1, 4);}
568*35786f68SRobert Mustacchi     | Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
569*35786f68SRobert Mustacchi                                         TrSetOpAmlLength ($1, 4);}
570*35786f68SRobert Mustacchi     | ConstExprTerm                 {$$ = TrSetOpIntegerValue (PARSEOP_DWORDCONST, $1);}
571bc36eafdSMike Gerdts     | DWordConst                    {}
572bc36eafdSMike Gerdts     ;
573bc36eafdSMike Gerdts 
574bc36eafdSMike Gerdts QWordConstExpr
575*35786f68SRobert Mustacchi     : Type3Opcode                   {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
576*35786f68SRobert Mustacchi                                         TrSetOpAmlLength ($1, 8);}
577*35786f68SRobert Mustacchi     | Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
578*35786f68SRobert Mustacchi                                         TrSetOpAmlLength ($1, 8);}
579*35786f68SRobert Mustacchi     | ConstExprTerm                 {$$ = TrSetOpIntegerValue (PARSEOP_QWORDCONST, $1);}
580bc36eafdSMike Gerdts     | QWordConst                    {}
581bc36eafdSMike Gerdts     ;
582bc36eafdSMike Gerdts 
583bc36eafdSMike Gerdts ConstTerm
584bc36eafdSMike Gerdts     : ConstExprTerm                 {}
585*35786f68SRobert Mustacchi     | PARSEOP_REVISION              {$$ = TrCreateLeafOp (PARSEOP_REVISION);}
586bc36eafdSMike Gerdts     ;
587bc36eafdSMike Gerdts 
588bc36eafdSMike Gerdts ConstExprTerm
589*35786f68SRobert Mustacchi     : PARSEOP_ZERO                  {$$ = TrCreateValuedLeafOp (PARSEOP_ZERO, 0);}
590*35786f68SRobert Mustacchi     | PARSEOP_ONE                   {$$ = TrCreateValuedLeafOp (PARSEOP_ONE, 1);}
591*35786f68SRobert Mustacchi     | PARSEOP_ONES                  {$$ = TrCreateValuedLeafOp (PARSEOP_ONES, ACPI_UINT64_MAX);}
592*35786f68SRobert Mustacchi     | PARSEOP___DATE__              {$$ = TrCreateConstantLeafOp (PARSEOP___DATE__);}
593*35786f68SRobert Mustacchi     | PARSEOP___FILE__              {$$ = TrCreateConstantLeafOp (PARSEOP___FILE__);}
594*35786f68SRobert Mustacchi     | PARSEOP___LINE__              {$$ = TrCreateConstantLeafOp (PARSEOP___LINE__);}
595*35786f68SRobert Mustacchi     | PARSEOP___PATH__              {$$ = TrCreateConstantLeafOp (PARSEOP___PATH__);}
596*35786f68SRobert Mustacchi     | PARSEOP___METHOD__            {$$ = TrCreateConstantLeafOp (PARSEOP___METHOD__);}
597bc36eafdSMike Gerdts     ;
598bc36eafdSMike Gerdts 
599bc36eafdSMike Gerdts Integer
600*35786f68SRobert Mustacchi     : PARSEOP_INTEGER               {$$ = TrCreateValuedLeafOp (PARSEOP_INTEGER,
601*35786f68SRobert Mustacchi                                         AslCompilerlval.i);}
602bc36eafdSMike Gerdts     ;
603bc36eafdSMike Gerdts 
604bc36eafdSMike Gerdts String
605*35786f68SRobert Mustacchi     : PARSEOP_STRING_LITERAL        {$$ = TrCreateValuedLeafOp (PARSEOP_STRING_LITERAL,
606*35786f68SRobert Mustacchi                                         (ACPI_NATIVE_INT) AslCompilerlval.s);}
607bc36eafdSMike Gerdts     ;
608bc36eafdSMike Gerdts 
609bc36eafdSMike Gerdts 
610bc36eafdSMike Gerdts /*******************************************************************************
611bc36eafdSMike Gerdts  *
612bc36eafdSMike Gerdts  * ASL Opcode Terms
613bc36eafdSMike Gerdts  *
614bc36eafdSMike Gerdts  ******************************************************************************/
615bc36eafdSMike Gerdts 
616bc36eafdSMike Gerdts CompilerDirective
617bc36eafdSMike Gerdts     : IncludeTerm                   {}
618bc36eafdSMike Gerdts     | IncludeEndTerm                {}
619bc36eafdSMike Gerdts     | ExternalTerm                  {}
620bc36eafdSMike Gerdts     ;
621bc36eafdSMike Gerdts 
622bc36eafdSMike Gerdts NamedObject
623bc36eafdSMike Gerdts     : BankFieldTerm                 {}
624bc36eafdSMike Gerdts     | CreateBitFieldTerm            {}
625bc36eafdSMike Gerdts     | CreateByteFieldTerm           {}
626bc36eafdSMike Gerdts     | CreateDWordFieldTerm          {}
627bc36eafdSMike Gerdts     | CreateFieldTerm               {}
628bc36eafdSMike Gerdts     | CreateQWordFieldTerm          {}
629bc36eafdSMike Gerdts     | CreateWordFieldTerm           {}
630bc36eafdSMike Gerdts     | DataRegionTerm                {}
631bc36eafdSMike Gerdts     | DeviceTerm                    {}
632bc36eafdSMike Gerdts     | EventTerm                     {}
633bc36eafdSMike Gerdts     | FieldTerm                     {}
634bc36eafdSMike Gerdts     | FunctionTerm                  {}
635bc36eafdSMike Gerdts     | IndexFieldTerm                {}
636bc36eafdSMike Gerdts     | MethodTerm                    {}
637bc36eafdSMike Gerdts     | MutexTerm                     {}
638bc36eafdSMike Gerdts     | OpRegionTerm                  {}
639bc36eafdSMike Gerdts     | PowerResTerm                  {}
640bc36eafdSMike Gerdts     | ProcessorTerm                 {}
641bc36eafdSMike Gerdts     | ThermalZoneTerm               {}
642bc36eafdSMike Gerdts     ;
643bc36eafdSMike Gerdts 
644bc36eafdSMike Gerdts NameSpaceModifier
645bc36eafdSMike Gerdts     : AliasTerm                     {}
646bc36eafdSMike Gerdts     | NameTerm                      {}
647*35786f68SRobert Mustacchi /*    | NameTermAslPlus               {} */
648bc36eafdSMike Gerdts     | ScopeTerm                     {}
649bc36eafdSMike Gerdts     ;
650bc36eafdSMike Gerdts 
651*35786f68SRobert Mustacchi SimpleName
652bc36eafdSMike Gerdts     : NameString                    {}
653bc36eafdSMike Gerdts     | LocalTerm                     {}
654*35786f68SRobert Mustacchi     | ArgTerm                       {}
655*35786f68SRobert Mustacchi     ;
656*35786f68SRobert Mustacchi 
657*35786f68SRobert Mustacchi /* For ObjectType(), SuperName except for MethodInvocationTerm */
658*35786f68SRobert Mustacchi 
659*35786f68SRobert Mustacchi ObjectTypeSource
660*35786f68SRobert Mustacchi     : SimpleName                    {}
661bc36eafdSMike Gerdts     | DebugTerm                     {}
662bc36eafdSMike Gerdts     | RefOfTerm                     {}
663bc36eafdSMike Gerdts     | DerefOfTerm                   {}
664bc36eafdSMike Gerdts     | IndexTerm                     {}
665*35786f68SRobert Mustacchi     | IndexExpTerm                  {}
666bc36eafdSMike Gerdts     ;
667bc36eafdSMike Gerdts 
668*35786f68SRobert Mustacchi /* For DeRefOf(), SuperName except for DerefOf and Debug */
669*35786f68SRobert Mustacchi 
670*35786f68SRobert Mustacchi DerefOfSource
671*35786f68SRobert Mustacchi     : SimpleName                    {}
672*35786f68SRobert Mustacchi     | RefOfTerm                     {}
673*35786f68SRobert Mustacchi     | DerefOfTerm                   {}
674*35786f68SRobert Mustacchi     | IndexTerm                     {}
675*35786f68SRobert Mustacchi     | IndexExpTerm                  {}
676*35786f68SRobert Mustacchi     | StoreTerm                     {}
677*35786f68SRobert Mustacchi     | EqualsTerm                    {}
678*35786f68SRobert Mustacchi     | MethodInvocationTerm          {}
679bc36eafdSMike Gerdts     ;
680bc36eafdSMike Gerdts 
681*35786f68SRobert Mustacchi /* For RefOf(), SuperName except for RefOf and MethodInvocationTerm */
682*35786f68SRobert Mustacchi 
683*35786f68SRobert Mustacchi RefOfSource
684*35786f68SRobert Mustacchi     : SimpleName                    {}
685*35786f68SRobert Mustacchi     | DebugTerm                     {}
686*35786f68SRobert Mustacchi     | DerefOfTerm                   {}
687*35786f68SRobert Mustacchi     | IndexTerm                     {}
688*35786f68SRobert Mustacchi     | IndexExpTerm                  {}
689bc36eafdSMike Gerdts     ;
690bc36eafdSMike Gerdts 
691*35786f68SRobert Mustacchi /* For CondRefOf(), SuperName except for RefOf and MethodInvocationTerm */
692bc36eafdSMike Gerdts 
693*35786f68SRobert Mustacchi CondRefOfSource
694*35786f68SRobert Mustacchi     : SimpleName                    {}
695*35786f68SRobert Mustacchi     | DebugTerm                     {}
696*35786f68SRobert Mustacchi     | DerefOfTerm                   {}
697*35786f68SRobert Mustacchi     | IndexTerm                     {}
698*35786f68SRobert Mustacchi     | IndexExpTerm                  {}
699*35786f68SRobert Mustacchi     ;
700*35786f68SRobert Mustacchi 
701*35786f68SRobert Mustacchi /*
702*35786f68SRobert Mustacchi  * Opcode types, as defined in the ACPI specification
703*35786f68SRobert Mustacchi  */
704bc36eafdSMike Gerdts Type1Opcode
705bc36eafdSMike Gerdts     : BreakTerm                     {}
706bc36eafdSMike Gerdts     | BreakPointTerm                {}
707bc36eafdSMike Gerdts     | ContinueTerm                  {}
708bc36eafdSMike Gerdts     | FatalTerm                     {}
709bc36eafdSMike Gerdts     | ForTerm                       {}
710bc36eafdSMike Gerdts     | ElseIfTerm                    {}
711bc36eafdSMike Gerdts     | LoadTerm                      {}
712bc36eafdSMike Gerdts     | NoOpTerm                      {}
713bc36eafdSMike Gerdts     | NotifyTerm                    {}
714bc36eafdSMike Gerdts     | ReleaseTerm                   {}
715bc36eafdSMike Gerdts     | ResetTerm                     {}
716bc36eafdSMike Gerdts     | ReturnTerm                    {}
717bc36eafdSMike Gerdts     | SignalTerm                    {}
718bc36eafdSMike Gerdts     | SleepTerm                     {}
719bc36eafdSMike Gerdts     | StallTerm                     {}
720bc36eafdSMike Gerdts     | SwitchTerm                    {}
721bc36eafdSMike Gerdts     | UnloadTerm                    {}
722bc36eafdSMike Gerdts     | WhileTerm                     {}
723bc36eafdSMike Gerdts     ;
724bc36eafdSMike Gerdts 
725bc36eafdSMike Gerdts Type2Opcode
726bc36eafdSMike Gerdts     : AcquireTerm                   {}
727bc36eafdSMike Gerdts     | CondRefOfTerm                 {}
728bc36eafdSMike Gerdts     | CopyObjectTerm                {}
729bc36eafdSMike Gerdts     | DerefOfTerm                   {}
730bc36eafdSMike Gerdts     | ObjectTypeTerm                {}
731bc36eafdSMike Gerdts     | RefOfTerm                     {}
732bc36eafdSMike Gerdts     | SizeOfTerm                    {}
733bc36eafdSMike Gerdts     | StoreTerm                     {}
734bc36eafdSMike Gerdts     | EqualsTerm                    {}
735bc36eafdSMike Gerdts     | TimerTerm                     {}
736bc36eafdSMike Gerdts     | WaitTerm                      {}
737bc36eafdSMike Gerdts     | MethodInvocationTerm          {}
738bc36eafdSMike Gerdts     ;
739bc36eafdSMike Gerdts 
740bc36eafdSMike Gerdts /*
741bc36eafdSMike Gerdts  * Type 3/4/5 opcodes
742bc36eafdSMike Gerdts  */
743bc36eafdSMike Gerdts Type2IntegerOpcode                  /* "Type3" opcodes */
744*35786f68SRobert Mustacchi     : Expression                    {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
745bc36eafdSMike Gerdts     | AddTerm                       {}
746bc36eafdSMike Gerdts     | AndTerm                       {}
747bc36eafdSMike Gerdts     | DecTerm                       {}
748bc36eafdSMike Gerdts     | DivideTerm                    {}
749bc36eafdSMike Gerdts     | FindSetLeftBitTerm            {}
750bc36eafdSMike Gerdts     | FindSetRightBitTerm           {}
751bc36eafdSMike Gerdts     | FromBCDTerm                   {}
752bc36eafdSMike Gerdts     | IncTerm                       {}
753bc36eafdSMike Gerdts     | IndexTerm                     {}
754*35786f68SRobert Mustacchi /*    | StructureIndexTerm            {} */
755*35786f68SRobert Mustacchi /*    | StructurePointerTerm          {} */
756bc36eafdSMike Gerdts     | LAndTerm                      {}
757bc36eafdSMike Gerdts     | LEqualTerm                    {}
758bc36eafdSMike Gerdts     | LGreaterTerm                  {}
759bc36eafdSMike Gerdts     | LGreaterEqualTerm             {}
760bc36eafdSMike Gerdts     | LLessTerm                     {}
761bc36eafdSMike Gerdts     | LLessEqualTerm                {}
762bc36eafdSMike Gerdts     | LNotTerm                      {}
763bc36eafdSMike Gerdts     | LNotEqualTerm                 {}
764bc36eafdSMike Gerdts     | LoadTableTerm                 {}
765bc36eafdSMike Gerdts     | LOrTerm                       {}
766bc36eafdSMike Gerdts     | MatchTerm                     {}
767bc36eafdSMike Gerdts     | ModTerm                       {}
768bc36eafdSMike Gerdts     | MultiplyTerm                  {}
769bc36eafdSMike Gerdts     | NAndTerm                      {}
770bc36eafdSMike Gerdts     | NOrTerm                       {}
771bc36eafdSMike Gerdts     | NotTerm                       {}
772bc36eafdSMike Gerdts     | OrTerm                        {}
773bc36eafdSMike Gerdts     | ShiftLeftTerm                 {}
774bc36eafdSMike Gerdts     | ShiftRightTerm                {}
775bc36eafdSMike Gerdts     | SubtractTerm                  {}
776bc36eafdSMike Gerdts     | ToBCDTerm                     {}
777bc36eafdSMike Gerdts     | ToIntegerTerm                 {}
778bc36eafdSMike Gerdts     | XOrTerm                       {}
779bc36eafdSMike Gerdts     ;
780bc36eafdSMike Gerdts 
781bc36eafdSMike Gerdts Type2StringOpcode                   /* "Type4" Opcodes */
782bc36eafdSMike Gerdts     : ToDecimalStringTerm           {}
783bc36eafdSMike Gerdts     | ToHexStringTerm               {}
784bc36eafdSMike Gerdts     | ToStringTerm                  {}
785bc36eafdSMike Gerdts     ;
786bc36eafdSMike Gerdts 
787bc36eafdSMike Gerdts Type2BufferOpcode                   /* "Type5" Opcodes */
788bc36eafdSMike Gerdts     : ToBufferTerm                  {}
789bc36eafdSMike Gerdts     | ConcatResTerm                 {}
790bc36eafdSMike Gerdts     ;
791bc36eafdSMike Gerdts 
792bc36eafdSMike Gerdts Type2BufferOrStringOpcode
793*35786f68SRobert Mustacchi     : ConcatTerm                    {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
794bc36eafdSMike Gerdts     | PrintfTerm                    {}
795bc36eafdSMike Gerdts     | FprintfTerm                   {}
796bc36eafdSMike Gerdts     | MidTerm                       {}
797bc36eafdSMike Gerdts     ;
798bc36eafdSMike Gerdts 
799bc36eafdSMike Gerdts /*
800bc36eafdSMike Gerdts  * A type 3 opcode evaluates to an Integer and cannot have a destination operand
801bc36eafdSMike Gerdts  */
802bc36eafdSMike Gerdts Type3Opcode
803bc36eafdSMike Gerdts     : EISAIDTerm                    {}
804bc36eafdSMike Gerdts     ;
805bc36eafdSMike Gerdts 
806bc36eafdSMike Gerdts /* Obsolete
807bc36eafdSMike Gerdts Type4Opcode
808bc36eafdSMike Gerdts     : ConcatTerm                    {}
809bc36eafdSMike Gerdts     | ToDecimalStringTerm           {}
810bc36eafdSMike Gerdts     | ToHexStringTerm               {}
811bc36eafdSMike Gerdts     | MidTerm                       {}
812bc36eafdSMike Gerdts     | ToStringTerm                  {}
813bc36eafdSMike Gerdts     ;
814bc36eafdSMike Gerdts */
815bc36eafdSMike Gerdts 
816*35786f68SRobert Mustacchi /* Type 5 opcodes are a subset of Type2 opcodes, and return a constant */
817*35786f68SRobert Mustacchi 
818bc36eafdSMike Gerdts Type5Opcode
819bc36eafdSMike Gerdts     : ResourceTemplateTerm          {}
820bc36eafdSMike Gerdts     | UnicodeTerm                   {}
821bc36eafdSMike Gerdts     | ToPLDTerm                     {}
822bc36eafdSMike Gerdts     | ToUUIDTerm                    {}
823bc36eafdSMike Gerdts     ;
824bc36eafdSMike Gerdts 
825bc36eafdSMike Gerdts Type6Opcode
826bc36eafdSMike Gerdts     : RefOfTerm                     {}
827bc36eafdSMike Gerdts     | DerefOfTerm                   {}
828bc36eafdSMike Gerdts     | IndexTerm                     {}
829bc36eafdSMike Gerdts     | IndexExpTerm                  {}
830*35786f68SRobert Mustacchi /*    | StructureIndexTerm            {} */
831*35786f68SRobert Mustacchi /*    | StructurePointerTerm          {} */
832bc36eafdSMike Gerdts     | MethodInvocationTerm          {}
833bc36eafdSMike Gerdts     ;
834bc36eafdSMike Gerdts 
835bc36eafdSMike Gerdts 
836bc36eafdSMike Gerdts /*******************************************************************************
837bc36eafdSMike Gerdts  *
838bc36eafdSMike Gerdts  * ASL Helper Terms
839bc36eafdSMike Gerdts  *
840bc36eafdSMike Gerdts  ******************************************************************************/
841bc36eafdSMike Gerdts 
842bc36eafdSMike Gerdts AmlPackageLengthTerm
843*35786f68SRobert Mustacchi     : Integer                       {$$ = TrSetOpIntegerValue (PARSEOP_PACKAGE_LENGTH,
844*35786f68SRobert Mustacchi                                         (ACPI_PARSE_OBJECT *) $1);}
845bc36eafdSMike Gerdts     ;
846bc36eafdSMike Gerdts 
847bc36eafdSMike Gerdts NameStringItem
848bc36eafdSMike Gerdts     : ',' NameString                {$$ = $2;}
849bc36eafdSMike Gerdts     | ',' error                     {$$ = AslDoError (); yyclearin;}
850bc36eafdSMike Gerdts     ;
851bc36eafdSMike Gerdts 
852bc36eafdSMike Gerdts TermArgItem
853bc36eafdSMike Gerdts     : ',' TermArg                   {$$ = $2;}
854bc36eafdSMike Gerdts     | ',' error                     {$$ = AslDoError (); yyclearin;}
855bc36eafdSMike Gerdts     ;
856bc36eafdSMike Gerdts 
857bc36eafdSMike Gerdts OptionalReference
858*35786f68SRobert Mustacchi     :                               {$$ = TrCreateLeafOp (PARSEOP_ZERO);}       /* Placeholder is a ZeroOp object */
859*35786f68SRobert Mustacchi     | ','                           {$$ = TrCreateLeafOp (PARSEOP_ZERO);}       /* Placeholder is a ZeroOp object */
860bc36eafdSMike Gerdts     | ',' TermArg                   {$$ = $2;}
861bc36eafdSMike Gerdts     ;
862bc36eafdSMike Gerdts 
863bc36eafdSMike Gerdts OptionalReturnArg
864*35786f68SRobert Mustacchi     :                               {$$ = TrSetOpFlags (TrCreateLeafOp (PARSEOP_ZERO),
865*35786f68SRobert Mustacchi                                             OP_IS_NULL_RETURN);}       /* Placeholder is a ZeroOp object */
866bc36eafdSMike Gerdts     | TermArg                       {$$ = $1;}
867bc36eafdSMike Gerdts     ;
868bc36eafdSMike Gerdts 
869bc36eafdSMike Gerdts OptionalSerializeRuleKeyword
870bc36eafdSMike Gerdts     :                               {$$ = NULL;}
871bc36eafdSMike Gerdts     | ','                           {$$ = NULL;}
872bc36eafdSMike Gerdts     | ',' SerializeRuleKeyword      {$$ = $2;}
873bc36eafdSMike Gerdts     ;
874bc36eafdSMike Gerdts 
875bc36eafdSMike Gerdts OptionalTermArg
876*35786f68SRobert Mustacchi     :                               {$$ = TrCreateLeafOp (PARSEOP_DEFAULT_ARG);}
877bc36eafdSMike Gerdts     | TermArg                       {$$ = $1;}
878bc36eafdSMike Gerdts     ;
879bc36eafdSMike Gerdts 
880bc36eafdSMike Gerdts OptionalWordConst
881bc36eafdSMike Gerdts     :                               {$$ = NULL;}
882bc36eafdSMike Gerdts     | WordConst                     {$$ = $1;}
883bc36eafdSMike Gerdts     ;
884