xref: /freebsd/sys/contrib/dev/acpica/compiler/aslrules.y (revision 722b16673c40aedf280895f2f2f676bb494518d7)
1313a0c13SJung-uk Kim NoEcho('
2313a0c13SJung-uk Kim /******************************************************************************
3313a0c13SJung-uk Kim  *
4f8146b88SJung-uk Kim  * Module Name: aslrules.y - Main Bison/Yacc production rules
50d84335fSJung-uk Kim  *                         - Keep this file synched with the
60d84335fSJung-uk Kim  *                           CvParseOpBlockType function in cvcompiler.c
7313a0c13SJung-uk Kim  *
8313a0c13SJung-uk Kim  *****************************************************************************/
9313a0c13SJung-uk Kim 
100d84335fSJung-uk Kim /******************************************************************************
110d84335fSJung-uk Kim  *
120d84335fSJung-uk Kim  * 1. Copyright Notice
130d84335fSJung-uk Kim  *
14*722b1667SJung-uk Kim  * Some or all of this work - Copyright (c) 1999 - 2023, Intel Corp.
15313a0c13SJung-uk Kim  * All rights reserved.
16313a0c13SJung-uk Kim  *
170d84335fSJung-uk Kim  * 2. License
180d84335fSJung-uk Kim  *
190d84335fSJung-uk Kim  * 2.1. This is your license from Intel Corp. under its intellectual property
200d84335fSJung-uk Kim  * rights. You may have additional license terms from the party that provided
210d84335fSJung-uk Kim  * you this software, covering your right to use that party's intellectual
220d84335fSJung-uk Kim  * property rights.
230d84335fSJung-uk Kim  *
240d84335fSJung-uk Kim  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
250d84335fSJung-uk Kim  * copy of the source code appearing in this file ("Covered Code") an
260d84335fSJung-uk Kim  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
270d84335fSJung-uk Kim  * base code distributed originally by Intel ("Original Intel Code") to copy,
280d84335fSJung-uk Kim  * make derivatives, distribute, use and display any portion of the Covered
290d84335fSJung-uk Kim  * Code in any form, with the right to sublicense such rights; and
300d84335fSJung-uk Kim  *
310d84335fSJung-uk Kim  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
320d84335fSJung-uk Kim  * license (with the right to sublicense), under only those claims of Intel
330d84335fSJung-uk Kim  * patents that are infringed by the Original Intel Code, to make, use, sell,
340d84335fSJung-uk Kim  * offer to sell, and import the Covered Code and derivative works thereof
350d84335fSJung-uk Kim  * solely to the minimum extent necessary to exercise the above copyright
360d84335fSJung-uk Kim  * license, and in no event shall the patent license extend to any additions
370d84335fSJung-uk Kim  * to or modifications of the Original Intel Code. No other license or right
380d84335fSJung-uk Kim  * is granted directly or by implication, estoppel or otherwise;
390d84335fSJung-uk Kim  *
400d84335fSJung-uk Kim  * The above copyright and patent license is granted only if the following
410d84335fSJung-uk Kim  * conditions are met:
420d84335fSJung-uk Kim  *
430d84335fSJung-uk Kim  * 3. Conditions
440d84335fSJung-uk Kim  *
450d84335fSJung-uk Kim  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
460d84335fSJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
470d84335fSJung-uk Kim  * Code or modification with rights to further distribute source must include
480d84335fSJung-uk Kim  * the above Copyright Notice, the above License, this list of Conditions,
490d84335fSJung-uk Kim  * and the following Disclaimer and Export Compliance provision. In addition,
500d84335fSJung-uk Kim  * Licensee must cause all Covered Code to which Licensee contributes to
510d84335fSJung-uk Kim  * contain a file documenting the changes Licensee made to create that Covered
520d84335fSJung-uk Kim  * Code and the date of any change. Licensee must include in that file the
530d84335fSJung-uk Kim  * documentation of any changes made by any predecessor Licensee. Licensee
540d84335fSJung-uk Kim  * must include a prominent statement that the modification is derived,
550d84335fSJung-uk Kim  * directly or indirectly, from Original Intel Code.
560d84335fSJung-uk Kim  *
570d84335fSJung-uk Kim  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
580d84335fSJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
590d84335fSJung-uk Kim  * Code or modification without rights to further distribute source must
600d84335fSJung-uk Kim  * include the following Disclaimer and Export Compliance provision in the
610d84335fSJung-uk Kim  * documentation and/or other materials provided with distribution. In
620d84335fSJung-uk Kim  * addition, Licensee may not authorize further sublicense of source of any
630d84335fSJung-uk Kim  * portion of the Covered Code, and must include terms to the effect that the
640d84335fSJung-uk Kim  * license from Licensee to its licensee is limited to the intellectual
650d84335fSJung-uk Kim  * property embodied in the software Licensee provides to its licensee, and
660d84335fSJung-uk Kim  * not to intellectual property embodied in modifications its licensee may
670d84335fSJung-uk Kim  * make.
680d84335fSJung-uk Kim  *
690d84335fSJung-uk Kim  * 3.3. Redistribution of Executable. Redistribution in executable form of any
700d84335fSJung-uk Kim  * substantial portion of the Covered Code or modification must reproduce the
710d84335fSJung-uk Kim  * above Copyright Notice, and the following Disclaimer and Export Compliance
720d84335fSJung-uk Kim  * provision in the documentation and/or other materials provided with the
730d84335fSJung-uk Kim  * distribution.
740d84335fSJung-uk Kim  *
750d84335fSJung-uk Kim  * 3.4. Intel retains all right, title, and interest in and to the Original
760d84335fSJung-uk Kim  * Intel Code.
770d84335fSJung-uk Kim  *
780d84335fSJung-uk Kim  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
790d84335fSJung-uk Kim  * Intel shall be used in advertising or otherwise to promote the sale, use or
800d84335fSJung-uk Kim  * other dealings in products derived from or relating to the Covered Code
810d84335fSJung-uk Kim  * without prior written authorization from Intel.
820d84335fSJung-uk Kim  *
830d84335fSJung-uk Kim  * 4. Disclaimer and Export Compliance
840d84335fSJung-uk Kim  *
850d84335fSJung-uk Kim  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
860d84335fSJung-uk Kim  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
870d84335fSJung-uk Kim  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
880d84335fSJung-uk Kim  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
890d84335fSJung-uk Kim  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
900d84335fSJung-uk Kim  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
910d84335fSJung-uk Kim  * PARTICULAR PURPOSE.
920d84335fSJung-uk Kim  *
930d84335fSJung-uk Kim  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
940d84335fSJung-uk Kim  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
950d84335fSJung-uk Kim  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
960d84335fSJung-uk Kim  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
970d84335fSJung-uk Kim  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
980d84335fSJung-uk Kim  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
990d84335fSJung-uk Kim  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
1000d84335fSJung-uk Kim  * LIMITED REMEDY.
1010d84335fSJung-uk Kim  *
1020d84335fSJung-uk Kim  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1030d84335fSJung-uk Kim  * software or system incorporating such software without first obtaining any
1040d84335fSJung-uk Kim  * required license or other approval from the U. S. Department of Commerce or
1050d84335fSJung-uk Kim  * any other agency or department of the United States Government. In the
1060d84335fSJung-uk Kim  * event Licensee exports any such software from the United States or
1070d84335fSJung-uk Kim  * re-exports any such software from a foreign destination, Licensee shall
1080d84335fSJung-uk Kim  * ensure that the distribution and export/re-export of the software is in
1090d84335fSJung-uk Kim  * compliance with all laws, regulations, orders, or other restrictions of the
1100d84335fSJung-uk Kim  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1110d84335fSJung-uk Kim  * any of its subsidiaries will export/re-export any technical data, process,
1120d84335fSJung-uk Kim  * software, or service, directly or indirectly, to any country for which the
1130d84335fSJung-uk Kim  * United States government or any agency thereof requires an export license,
1140d84335fSJung-uk Kim  * other governmental approval, or letter of assurance, without first obtaining
1150d84335fSJung-uk Kim  * such license, approval or letter.
1160d84335fSJung-uk Kim  *
1170d84335fSJung-uk Kim  *****************************************************************************
1180d84335fSJung-uk Kim  *
1190d84335fSJung-uk Kim  * Alternatively, you may choose to be licensed under the terms of the
1200d84335fSJung-uk Kim  * following license:
1210d84335fSJung-uk Kim  *
122313a0c13SJung-uk Kim  * Redistribution and use in source and binary forms, with or without
123313a0c13SJung-uk Kim  * modification, are permitted provided that the following conditions
124313a0c13SJung-uk Kim  * are met:
125313a0c13SJung-uk Kim  * 1. Redistributions of source code must retain the above copyright
126313a0c13SJung-uk Kim  *    notice, this list of conditions, and the following disclaimer,
127313a0c13SJung-uk Kim  *    without modification.
128313a0c13SJung-uk Kim  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
129313a0c13SJung-uk Kim  *    substantially similar to the "NO WARRANTY" disclaimer below
130313a0c13SJung-uk Kim  *    ("Disclaimer") and any redistribution must be conditioned upon
131313a0c13SJung-uk Kim  *    including a substantially similar Disclaimer requirement for further
132313a0c13SJung-uk Kim  *    binary redistribution.
133313a0c13SJung-uk Kim  * 3. Neither the names of the above-listed copyright holders nor the names
134313a0c13SJung-uk Kim  *    of any contributors may be used to endorse or promote products derived
135313a0c13SJung-uk Kim  *    from this software without specific prior written permission.
136313a0c13SJung-uk Kim  *
1370d84335fSJung-uk Kim  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1380d84335fSJung-uk Kim  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1390d84335fSJung-uk Kim  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1400d84335fSJung-uk Kim  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1410d84335fSJung-uk Kim  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1420d84335fSJung-uk Kim  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1430d84335fSJung-uk Kim  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1440d84335fSJung-uk Kim  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1450d84335fSJung-uk Kim  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1460d84335fSJung-uk Kim  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1470d84335fSJung-uk Kim  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1480d84335fSJung-uk Kim  *
1490d84335fSJung-uk Kim  * Alternatively, you may choose to be licensed under the terms of the
150313a0c13SJung-uk Kim  * GNU General Public License ("GPL") version 2 as published by the Free
151313a0c13SJung-uk Kim  * Software Foundation.
152313a0c13SJung-uk Kim  *
1530d84335fSJung-uk Kim  *****************************************************************************/
154313a0c13SJung-uk Kim 
155313a0c13SJung-uk Kim ')
156313a0c13SJung-uk Kim 
157313a0c13SJung-uk Kim /*******************************************************************************
158313a0c13SJung-uk Kim  *
159f8146b88SJung-uk Kim  * ASL Root and Secondary Terms
160313a0c13SJung-uk Kim  *
161313a0c13SJung-uk Kim  ******************************************************************************/
162313a0c13SJung-uk Kim 
163313a0c13SJung-uk Kim /*
164f8146b88SJung-uk Kim  * Root term. Allow multiple #line directives before the definition block
165313a0c13SJung-uk Kim  * to handle output from preprocessors
166313a0c13SJung-uk Kim  */
167f8146b88SJung-uk Kim AslCode
1685f9b24faSJung-uk Kim     : DefinitionBlockList           {$<n>$ = TrLinkOpChildren (
1695f9b24faSJung-uk Kim                                         TrCreateLeafOp (PARSEOP_ASL_CODE),1, $1);}
170313a0c13SJung-uk Kim     | error                         {YYABORT; $$ = NULL;}
171313a0c13SJung-uk Kim     ;
172313a0c13SJung-uk Kim 
173313a0c13SJung-uk Kim 
174313a0c13SJung-uk Kim /*
175313a0c13SJung-uk Kim  * Note concerning support for "module-level code".
176313a0c13SJung-uk Kim  *
177313a0c13SJung-uk Kim  * ACPI 1.0 allowed Type1 and Type2 executable opcodes outside of control
178313a0c13SJung-uk Kim  * methods (the so-called module-level code.) This support was explicitly
179313a0c13SJung-uk Kim  * removed in ACPI 2.0, but this type of code continues to be created by
180313a0c13SJung-uk Kim  * BIOS vendors. In order to support the disassembly and recompilation of
181313a0c13SJung-uk Kim  * such code (and the porting of ASL code to iASL), iASL supports this
182313a0c13SJung-uk Kim  * code in violation of the current ACPI specification.
183313a0c13SJung-uk Kim  *
184313a0c13SJung-uk Kim  * The grammar change to support module-level code is to revert the
185313a0c13SJung-uk Kim  * {ObjectList} portion of the DefinitionBlockTerm in ACPI 2.0 to the
186313a0c13SJung-uk Kim  * original use of {TermList} instead (see below.) This allows the use
187313a0c13SJung-uk Kim  * of Type1 and Type2 opcodes at module level.
188f8146b88SJung-uk Kim  *
189f8146b88SJung-uk Kim  * 04/2016: The module-level code is now allowed in the following terms:
190f8146b88SJung-uk Kim  * DeviceTerm, PowerResTerm, ProcessorTerm, ScopeTerm, ThermalZoneTerm.
191f8146b88SJung-uk Kim  * The ObjectList term is obsolete and has been removed.
192313a0c13SJung-uk Kim  */
193313a0c13SJung-uk Kim DefinitionBlockTerm
1941cc50d6bSJung-uk Kim     : PARSEOP_DEFINITION_BLOCK
1955f9b24faSJung-uk Kim         PARSEOP_OPEN_PAREN          {$<n>$ = TrCreateLeafOp (PARSEOP_DEFINITION_BLOCK); COMMENT_CAPTURE_OFF;}
196313a0c13SJung-uk Kim         String ','
197313a0c13SJung-uk Kim         String ','
198313a0c13SJung-uk Kim         ByteConst ','
199313a0c13SJung-uk Kim         String ','
200313a0c13SJung-uk Kim         String ','
201313a0c13SJung-uk Kim         DWordConst
2022f6a1a81SJung-uk Kim         PARSEOP_CLOSE_PAREN         {TrSetOpIntegerWidth ($6,$8);
2032f6a1a81SJung-uk Kim                                         TrSetOpEndLineNumber ($<n>3); COMMENT_CAPTURE_ON;}
2045f9b24faSJung-uk Kim             '{' TermList '}'        {$$ = TrLinkOpChildren ($<n>3,7,
205493deb39SJung-uk Kim                                         $4,$6,$8,$10,$12,$14,$18);}
206313a0c13SJung-uk Kim     ;
207313a0c13SJung-uk Kim 
208f8146b88SJung-uk Kim DefinitionBlockList
209f8146b88SJung-uk Kim     : DefinitionBlockTerm
210f8146b88SJung-uk Kim     | DefinitionBlockTerm
2115f9b24faSJung-uk Kim         DefinitionBlockList         {$$ = TrLinkPeerOps (2, $1,$2);}
2121c0e1b6dSJung-uk Kim     ;
2131c0e1b6dSJung-uk Kim 
2141cc50d6bSJung-uk Kim 
2151cc50d6bSJung-uk Kim /******* Basic ASCII identifiers **************************************************/
2161cc50d6bSJung-uk Kim 
217493deb39SJung-uk Kim /* Allow IO, DMA, IRQ Resource macro and FOR macro names to also be used as identifiers */
218493deb39SJung-uk Kim 
219493deb39SJung-uk Kim NameString
220493deb39SJung-uk Kim     : NameSeg                       {}
2215f9b24faSJung-uk Kim     | PARSEOP_NAMESTRING            {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) $1);}
2225f9b24faSJung-uk Kim     | PARSEOP_IO                    {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");}
2235f9b24faSJung-uk Kim     | PARSEOP_DMA                   {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");}
2245f9b24faSJung-uk Kim     | PARSEOP_IRQ                   {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");}
2255f9b24faSJung-uk Kim     | PARSEOP_FOR                   {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "FOR");}
226493deb39SJung-uk Kim     ;
227493deb39SJung-uk Kim /*
228493deb39SJung-uk Kim NameSeg
2295f9b24faSJung-uk Kim     : PARSEOP_NAMESEG               {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESEG, (ACPI_NATIVE_INT)
230493deb39SJung-uk Kim                                         TrNormalizeNameSeg ($1));}
231493deb39SJung-uk Kim     ;
232493deb39SJung-uk Kim */
233493deb39SJung-uk Kim 
234493deb39SJung-uk Kim NameSeg
2355f9b24faSJung-uk Kim     : PARSEOP_NAMESEG               {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESEG,
236493deb39SJung-uk Kim                                         (ACPI_NATIVE_INT) AslCompilerlval.s);}
237493deb39SJung-uk Kim     ;
238493deb39SJung-uk Kim 
239493deb39SJung-uk Kim 
2401cc50d6bSJung-uk Kim /******* Fundamental argument/statement types ***********************************/
2411cc50d6bSJung-uk Kim 
2421cc50d6bSJung-uk Kim Term
2431cc50d6bSJung-uk Kim     : Object                        {}
2441cc50d6bSJung-uk Kim     | Type1Opcode                   {}
2451cc50d6bSJung-uk Kim     | Type2Opcode                   {}
2465f9b24faSJung-uk Kim     | Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
2475f9b24faSJung-uk Kim     | Type2StringOpcode             {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
2481cc50d6bSJung-uk Kim     | Type2BufferOpcode             {}
2491cc50d6bSJung-uk Kim     | Type2BufferOrStringOpcode     {}
2501cc50d6bSJung-uk Kim     | error                         {$$ = AslDoError(); yyclearin;}
2511cc50d6bSJung-uk Kim     ;
2521cc50d6bSJung-uk Kim 
253f8146b88SJung-uk Kim SuperName
2541cc50d6bSJung-uk Kim     : SimpleName                    {}
255f8146b88SJung-uk Kim     | DebugTerm                     {}
256f8146b88SJung-uk Kim     | Type6Opcode                   {}
257493deb39SJung-uk Kim     ;
2581c0e1b6dSJung-uk Kim 
259f8146b88SJung-uk Kim Target
2605f9b24faSJung-uk Kim     :                               {$$ = TrCreateNullTargetOp ();} /* Placeholder is a ZeroOp object */
2615f9b24faSJung-uk Kim     | ','                           {$$ = TrCreateNullTargetOp ();} /* Placeholder is a ZeroOp object */
2625f9b24faSJung-uk Kim     | ',' SuperName                 {$$ = TrSetOpFlags ($2, OP_IS_TARGET);}
2631c0e1b6dSJung-uk Kim     ;
264ab71bbb7SJung-uk Kim /*
2651cc50d6bSJung-uk Kim RequiredTarget
2665f9b24faSJung-uk Kim     : ',' SuperName                 {$$ = TrSetOpFlags ($2, OP_IS_TARGET);}
2671cc50d6bSJung-uk Kim     ;
268ab71bbb7SJung-uk Kim */
269313a0c13SJung-uk Kim TermArg
2705f9b24faSJung-uk Kim     : SimpleName                    {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
2715f9b24faSJung-uk Kim     | Type2Opcode                   {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
2725f9b24faSJung-uk Kim     | DataObject                    {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
2731cc50d6bSJung-uk Kim     | PARSEOP_OPEN_PAREN
2741cc50d6bSJung-uk Kim         TermArg
2755f9b24faSJung-uk Kim         PARSEOP_CLOSE_PAREN         {$$ = TrSetOpFlags ($2, OP_IS_TERM_ARG);}
276313a0c13SJung-uk Kim     ;
277313a0c13SJung-uk Kim 
278f8146b88SJung-uk Kim /*
279f8146b88SJung-uk Kim  NOTE: Removed from TermArg due to reduce/reduce conflicts:
2805f9b24faSJung-uk Kim     | Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
2815f9b24faSJung-uk Kim     | Type2StringOpcode             {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
2825f9b24faSJung-uk Kim     | Type2BufferOpcode             {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
2835f9b24faSJung-uk Kim     | Type2BufferOrStringOpcode     {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
284f8146b88SJung-uk Kim 
285f8146b88SJung-uk Kim */
286f8146b88SJung-uk Kim 
287f8146b88SJung-uk Kim MethodInvocationTerm
2881cc50d6bSJung-uk Kim     : NameString
2895f9b24faSJung-uk Kim         PARSEOP_OPEN_PAREN          {TrSetOpIntegerValue (PARSEOP_METHODCALL, $1); COMMENT_CAPTURE_OFF;}
2901cc50d6bSJung-uk Kim         ArgList
2915f9b24faSJung-uk Kim         PARSEOP_CLOSE_PAREN         {$$ = TrLinkChildOp ($1,$4); COMMENT_CAPTURE_ON;}
292313a0c13SJung-uk Kim     ;
293313a0c13SJung-uk Kim 
294f8146b88SJung-uk Kim /* OptionalCount must appear before ByteList or an incorrect reduction will result */
295f8146b88SJung-uk Kim 
296f8146b88SJung-uk Kim OptionalCount
2975f9b24faSJung-uk Kim     :                               {$$ = TrCreateLeafOp (PARSEOP_ONES);}       /* Placeholder is a OnesOp object */
2985f9b24faSJung-uk Kim     | ','                           {$$ = TrCreateLeafOp (PARSEOP_ONES);}       /* Placeholder is a OnesOp object */
299f8146b88SJung-uk Kim     | ',' TermArg                   {$$ = $2;}
300313a0c13SJung-uk Kim     ;
301313a0c13SJung-uk Kim 
302493deb39SJung-uk Kim /*
303493deb39SJung-uk Kim  * Data count for buffers and packages (byte count for buffers,
304493deb39SJung-uk Kim  * element count for packages).
305493deb39SJung-uk Kim  */
306493deb39SJung-uk Kim OptionalDataCount
307493deb39SJung-uk Kim 
308493deb39SJung-uk Kim         /* Legacy ASL */
309493deb39SJung-uk Kim     :                               {$$ = NULL;}
3101cc50d6bSJung-uk Kim     | PARSEOP_OPEN_PAREN
3111cc50d6bSJung-uk Kim         TermArg
3121cc50d6bSJung-uk Kim         PARSEOP_CLOSE_PAREN         {$$ = $2;}
3131cc50d6bSJung-uk Kim     | PARSEOP_OPEN_PAREN
3141cc50d6bSJung-uk Kim         PARSEOP_CLOSE_PAREN         {$$ = NULL;}
315493deb39SJung-uk Kim 
316493deb39SJung-uk Kim         /* C-style (ASL+) -- adds equals term */
317493deb39SJung-uk Kim 
318493deb39SJung-uk Kim     |  PARSEOP_EXP_EQUALS           {$$ = NULL;}
319493deb39SJung-uk Kim 
3201cc50d6bSJung-uk Kim     | PARSEOP_OPEN_PAREN
3211cc50d6bSJung-uk Kim         TermArg
3221cc50d6bSJung-uk Kim         PARSEOP_CLOSE_PAREN
323493deb39SJung-uk Kim         PARSEOP_EXP_EQUALS          {$$ = $2;}
324493deb39SJung-uk Kim 
3251cc50d6bSJung-uk Kim     | PARSEOP_OPEN_PAREN
3261cc50d6bSJung-uk Kim         PARSEOP_CLOSE_PAREN
3271cc50d6bSJung-uk Kim         String
328493deb39SJung-uk Kim         PARSEOP_EXP_EQUALS          {$$ = NULL;}
329f8146b88SJung-uk Kim     ;
330f8146b88SJung-uk Kim 
331f8146b88SJung-uk Kim 
332f8146b88SJung-uk Kim /******* List Terms **************************************************/
333f8146b88SJung-uk Kim 
3341cc50d6bSJung-uk Kim     /* ACPI 3.0 -- allow semicolons between terms */
3351cc50d6bSJung-uk Kim 
3361cc50d6bSJung-uk Kim TermList
3371cc50d6bSJung-uk Kim     :                               {$$ = NULL;}
3385f9b24faSJung-uk Kim     | TermList Term                 {$$ = TrLinkPeerOp (
3395f9b24faSJung-uk Kim                                         TrSetOpFlags ($1, OP_RESULT_NOT_USED),$2);}
3405f9b24faSJung-uk Kim     | TermList Term ';'             {$$ = TrLinkPeerOp (
3415f9b24faSJung-uk Kim                                         TrSetOpFlags ($1, OP_RESULT_NOT_USED),$2);}
3425f9b24faSJung-uk Kim     | TermList ';' Term             {$$ = TrLinkPeerOp (
3435f9b24faSJung-uk Kim                                         TrSetOpFlags ($1, OP_RESULT_NOT_USED),$3);}
3445f9b24faSJung-uk Kim     | TermList ';' Term ';'         {$$ = TrLinkPeerOp (
3455f9b24faSJung-uk Kim                                         TrSetOpFlags ($1, OP_RESULT_NOT_USED),$3);}
3461cc50d6bSJung-uk Kim     ;
3471cc50d6bSJung-uk Kim 
348f8146b88SJung-uk Kim ArgList
349f8146b88SJung-uk Kim     :                               {$$ = NULL;}
350f8146b88SJung-uk Kim     | TermArg
351f8146b88SJung-uk Kim     | ArgList ','                   /* Allows a trailing comma at list end */
352f8146b88SJung-uk Kim     | ArgList ','
3535f9b24faSJung-uk Kim         TermArg                     {$$ = TrLinkPeerOp ($1,$3);}
354f8146b88SJung-uk Kim     ;
355f8146b88SJung-uk Kim 
356f8146b88SJung-uk Kim ByteList
357f8146b88SJung-uk Kim     :                               {$$ = NULL;}
358f8146b88SJung-uk Kim     | ByteConstExpr
359f8146b88SJung-uk Kim     | ByteList ','                  /* Allows a trailing comma at list end */
360f8146b88SJung-uk Kim     | ByteList ','
3615f9b24faSJung-uk Kim         ByteConstExpr               {$$ = TrLinkPeerOp ($1,$3);}
362f8146b88SJung-uk Kim     ;
363f8146b88SJung-uk Kim 
364f8146b88SJung-uk Kim DWordList
365f8146b88SJung-uk Kim     :                               {$$ = NULL;}
366f8146b88SJung-uk Kim     | DWordConstExpr
367f8146b88SJung-uk Kim     | DWordList ','                 /* Allows a trailing comma at list end */
368f8146b88SJung-uk Kim     | DWordList ','
3695f9b24faSJung-uk Kim         DWordConstExpr              {$$ = TrLinkPeerOp ($1,$3);}
370f8146b88SJung-uk Kim     ;
371f8146b88SJung-uk Kim 
372f8146b88SJung-uk Kim FieldUnitList
373f8146b88SJung-uk Kim     :                               {$$ = NULL;}
374f8146b88SJung-uk Kim     | FieldUnit
375f8146b88SJung-uk Kim     | FieldUnitList ','             /* Allows a trailing comma at list end */
376f8146b88SJung-uk Kim     | FieldUnitList ','
3775f9b24faSJung-uk Kim         FieldUnit                   {$$ = TrLinkPeerOp ($1,$3);}
378f8146b88SJung-uk Kim     ;
379f8146b88SJung-uk Kim 
380f8146b88SJung-uk Kim FieldUnit
381f8146b88SJung-uk Kim     : FieldUnitEntry                {}
382f8146b88SJung-uk Kim     | OffsetTerm                    {}
383f8146b88SJung-uk Kim     | AccessAsTerm                  {}
384f8146b88SJung-uk Kim     | ConnectionTerm                {}
385f8146b88SJung-uk Kim     ;
386f8146b88SJung-uk Kim 
387f8146b88SJung-uk Kim FieldUnitEntry
3885f9b24faSJung-uk Kim     : ',' AmlPackageLengthTerm      {$$ = TrCreateOp (PARSEOP_RESERVED_BYTES,1,$2);}
389f8146b88SJung-uk Kim     | NameSeg ','
3905f9b24faSJung-uk Kim         AmlPackageLengthTerm        {$$ = TrLinkChildOp ($1,$3);}
391f8146b88SJung-uk Kim     ;
392f8146b88SJung-uk Kim 
393f8146b88SJung-uk Kim Object
394f8146b88SJung-uk Kim     : CompilerDirective             {}
395f8146b88SJung-uk Kim     | NamedObject                   {}
396f8146b88SJung-uk Kim     | NameSpaceModifier             {}
397af051161SJung-uk Kim /*    | StructureTerm                 {} */
398f8146b88SJung-uk Kim     ;
399f8146b88SJung-uk Kim 
400f8146b88SJung-uk Kim PackageList
401f8146b88SJung-uk Kim     :                               {$$ = NULL;}
402f8146b88SJung-uk Kim     | PackageElement
403f8146b88SJung-uk Kim     | PackageList ','               /* Allows a trailing comma at list end */
404f8146b88SJung-uk Kim     | PackageList ','
4055f9b24faSJung-uk Kim         PackageElement              {$$ = TrLinkPeerOp ($1,$3);}
406f8146b88SJung-uk Kim     ;
407f8146b88SJung-uk Kim 
408f8146b88SJung-uk Kim PackageElement
409f8146b88SJung-uk Kim     : DataObject                    {}
410f8146b88SJung-uk Kim     | NameString                    {}
411313a0c13SJung-uk Kim     ;
412313a0c13SJung-uk Kim 
413313a0c13SJung-uk Kim     /* Rules for specifying the type of one method argument or return value */
414313a0c13SJung-uk Kim 
415313a0c13SJung-uk Kim ParameterTypePackage
416313a0c13SJung-uk Kim     :                               {$$ = NULL;}
417313a0c13SJung-uk Kim     | ObjectTypeKeyword             {$$ = $1;}
418313a0c13SJung-uk Kim     | ParameterTypePackage ','
4195f9b24faSJung-uk Kim         ObjectTypeKeyword           {$$ = TrLinkPeerOps (2,$1,$3);}
420313a0c13SJung-uk Kim     ;
421313a0c13SJung-uk Kim 
422313a0c13SJung-uk Kim ParameterTypePackageList
423313a0c13SJung-uk Kim     :                               {$$ = NULL;}
424ec0234b4SJung-uk Kim     | ObjectTypeKeyword             {$$ = TrLinkOpChildren (
425ec0234b4SJung-uk Kim                                         TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$1);}
426ec0234b4SJung-uk Kim     | '{' ParameterTypePackage '}'  {$$ = TrLinkOpChildren (
427ec0234b4SJung-uk Kim                                         TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
428313a0c13SJung-uk Kim     ;
429313a0c13SJung-uk Kim 
430ec0234b4SJung-uk Kim 
431313a0c13SJung-uk Kim OptionalParameterTypePackage
432ec0234b4SJung-uk Kim     :                               {$$ = NULL;}
433ec0234b4SJung-uk Kim     | ',' ParameterTypePackageList  {$$ = $2;}
434313a0c13SJung-uk Kim     ;
435313a0c13SJung-uk Kim 
436313a0c13SJung-uk Kim     /* Rules for specifying the types for method arguments */
437313a0c13SJung-uk Kim 
438313a0c13SJung-uk Kim ParameterTypesPackage
439313a0c13SJung-uk Kim     : ParameterTypePackageList      {$$ = $1;}
440313a0c13SJung-uk Kim     | ParameterTypesPackage ','
4415f9b24faSJung-uk Kim         ParameterTypePackageList    {$$ = TrLinkPeerOps (2,$1,$3);}
442313a0c13SJung-uk Kim     ;
443313a0c13SJung-uk Kim 
444313a0c13SJung-uk Kim ParameterTypesPackageList
445313a0c13SJung-uk Kim     :                               {$$ = NULL;}
446ec0234b4SJung-uk Kim     | ObjectTypeKeyword             {$$ = TrLinkOpChildren (
447ec0234b4SJung-uk Kim                                         TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$1);}
448ec0234b4SJung-uk Kim     | '{' ParameterTypesPackage '}' {$$ = TrLinkOpChildren (
449ec0234b4SJung-uk Kim                                         TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
450313a0c13SJung-uk Kim     ;
451313a0c13SJung-uk Kim 
452313a0c13SJung-uk Kim OptionalParameterTypesPackage
453ec0234b4SJung-uk Kim     :                               {$$ = NULL;}
454ec0234b4SJung-uk Kim     | ',' ParameterTypesPackageList {$$ = $2;}
455313a0c13SJung-uk Kim     ;
456313a0c13SJung-uk Kim 
457f8146b88SJung-uk Kim /*
458f8146b88SJung-uk Kim  * Case-Default list; allow only one Default term and unlimited Case terms
459f8146b88SJung-uk Kim  */
460f8146b88SJung-uk Kim CaseDefaultTermList
461f8146b88SJung-uk Kim     :                               {$$ = NULL;}
462f8146b88SJung-uk Kim     | CaseTerm                      {}
463f8146b88SJung-uk Kim     | DefaultTerm                   {}
464f8146b88SJung-uk Kim     | CaseDefaultTermList
4655f9b24faSJung-uk Kim         CaseTerm                    {$$ = TrLinkPeerOp ($1,$2);}
466f8146b88SJung-uk Kim     | CaseDefaultTermList
4675f9b24faSJung-uk Kim         DefaultTerm                 {$$ = TrLinkPeerOp ($1,$2);}
468f8146b88SJung-uk Kim 
469f8146b88SJung-uk Kim /* Original - attempts to force zero or one default term within the switch */
470f8146b88SJung-uk Kim 
471f8146b88SJung-uk Kim /*
472f8146b88SJung-uk Kim CaseDefaultTermList
473f8146b88SJung-uk Kim     :                               {$$ = NULL;}
474f8146b88SJung-uk Kim     | CaseTermList
475f8146b88SJung-uk Kim         DefaultTerm
4765f9b24faSJung-uk Kim         CaseTermList                {$$ = TrLinkPeerOp ($1,TrLinkPeerOp ($2, $3));}
477f8146b88SJung-uk Kim     | CaseTermList
4785f9b24faSJung-uk Kim         CaseTerm                    {$$ = TrLinkPeerOp ($1,$2);}
479f8146b88SJung-uk Kim     ;
480f8146b88SJung-uk Kim 
481f8146b88SJung-uk Kim CaseTermList
482f8146b88SJung-uk Kim     :                               {$$ = NULL;}
483f8146b88SJung-uk Kim     | CaseTerm                      {}
484f8146b88SJung-uk Kim     | CaseTermList
4855f9b24faSJung-uk Kim         CaseTerm                    {$$ = TrLinkPeerOp ($1,$2);}
486f8146b88SJung-uk Kim     ;
487f8146b88SJung-uk Kim */
488f8146b88SJung-uk Kim 
489f8146b88SJung-uk Kim 
490f8146b88SJung-uk Kim /*******************************************************************************
491f8146b88SJung-uk Kim  *
492f8146b88SJung-uk Kim  * ASL Data and Constant Terms
493f8146b88SJung-uk Kim  *
494f8146b88SJung-uk Kim  ******************************************************************************/
495f8146b88SJung-uk Kim 
496f8146b88SJung-uk Kim DataObject
497f8146b88SJung-uk Kim     : BufferData                    {}
498f8146b88SJung-uk Kim     | PackageData                   {}
499f8146b88SJung-uk Kim     | IntegerData                   {}
500f8146b88SJung-uk Kim     | StringData                    {}
501f8146b88SJung-uk Kim     ;
502f8146b88SJung-uk Kim 
503f8146b88SJung-uk Kim BufferData
5045f9b24faSJung-uk Kim     : Type5Opcode                   {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
5055f9b24faSJung-uk Kim     | Type2BufferOrStringOpcode     {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
5065f9b24faSJung-uk Kim     | Type2BufferOpcode             {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
507f8146b88SJung-uk Kim     | BufferTerm                    {}
508f8146b88SJung-uk Kim     ;
509f8146b88SJung-uk Kim 
510f8146b88SJung-uk Kim PackageData
511f8146b88SJung-uk Kim     : PackageTerm                   {}
512f8146b88SJung-uk Kim     ;
513f8146b88SJung-uk Kim 
514f8146b88SJung-uk Kim IntegerData
5155f9b24faSJung-uk Kim     : Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
5165f9b24faSJung-uk Kim     | Type3Opcode                   {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
517f8146b88SJung-uk Kim     | Integer                       {}
518f8146b88SJung-uk Kim     | ConstTerm                     {}
519f8146b88SJung-uk Kim     ;
520f8146b88SJung-uk Kim 
521f8146b88SJung-uk Kim StringData
5225f9b24faSJung-uk Kim     : Type2StringOpcode             {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
523f8146b88SJung-uk Kim     | String                        {}
524f8146b88SJung-uk Kim     ;
525f8146b88SJung-uk Kim 
526fbde3477SJung-uk Kim StringLiteral
527fbde3477SJung-uk Kim     : String                        {}
528fbde3477SJung-uk Kim     ;
529fbde3477SJung-uk Kim 
530f8146b88SJung-uk Kim ByteConst
5315f9b24faSJung-uk Kim     : Integer                       {$$ = TrSetOpIntegerValue (PARSEOP_BYTECONST, $1);}
532f8146b88SJung-uk Kim     ;
533f8146b88SJung-uk Kim 
534f8146b88SJung-uk Kim WordConst
5355f9b24faSJung-uk Kim     : Integer                       {$$ = TrSetOpIntegerValue (PARSEOP_WORDCONST, $1);}
536f8146b88SJung-uk Kim     ;
537f8146b88SJung-uk Kim 
538f8146b88SJung-uk Kim DWordConst
5395f9b24faSJung-uk Kim     : Integer                       {$$ = TrSetOpIntegerValue (PARSEOP_DWORDCONST, $1);}
540f8146b88SJung-uk Kim     ;
541f8146b88SJung-uk Kim 
542f8146b88SJung-uk Kim QWordConst
5435f9b24faSJung-uk Kim     : Integer                       {$$ = TrSetOpIntegerValue (PARSEOP_QWORDCONST, $1);}
544f8146b88SJung-uk Kim     ;
545f8146b88SJung-uk Kim 
546f8146b88SJung-uk Kim /*
5475f9b24faSJung-uk Kim  * The OP_COMPILE_TIME_CONST flag in the following constant expressions
548f8146b88SJung-uk Kim  * enables compile-time constant folding to reduce the Type3Opcodes/Type2IntegerOpcodes
549f8146b88SJung-uk Kim  * to simple integers. It is an error if these types of expressions cannot be
550f8146b88SJung-uk Kim  * reduced, since the AML grammar for ****ConstExpr requires a simple constant.
551f8146b88SJung-uk Kim  * Note: The required byte length of the constant is passed through to the
552f8146b88SJung-uk Kim  * constant folding code in the node AmlLength field.
553f8146b88SJung-uk Kim  */
554f8146b88SJung-uk Kim ByteConstExpr
5555f9b24faSJung-uk Kim     : Type3Opcode                   {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
5565f9b24faSJung-uk Kim                                         TrSetOpAmlLength ($1, 1);}
5575f9b24faSJung-uk Kim     | Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
5585f9b24faSJung-uk Kim                                         TrSetOpAmlLength ($1, 1);}
5595f9b24faSJung-uk Kim     | ConstExprTerm                 {$$ = TrSetOpIntegerValue (PARSEOP_BYTECONST, $1);}
560f8146b88SJung-uk Kim     | ByteConst                     {}
561f8146b88SJung-uk Kim     ;
562f8146b88SJung-uk Kim 
563f8146b88SJung-uk Kim WordConstExpr
5645f9b24faSJung-uk Kim     : Type3Opcode                   {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
5655f9b24faSJung-uk Kim                                         TrSetOpAmlLength ($1, 2);}
5665f9b24faSJung-uk Kim     | Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
5675f9b24faSJung-uk Kim                                         TrSetOpAmlLength ($1, 2);}
5685f9b24faSJung-uk Kim     | ConstExprTerm                 {$$ = TrSetOpIntegerValue (PARSEOP_WORDCONST, $1);}
569f8146b88SJung-uk Kim     | WordConst                     {}
570f8146b88SJung-uk Kim     ;
571f8146b88SJung-uk Kim 
572f8146b88SJung-uk Kim DWordConstExpr
5735f9b24faSJung-uk Kim     : Type3Opcode                   {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
5745f9b24faSJung-uk Kim                                         TrSetOpAmlLength ($1, 4);}
5755f9b24faSJung-uk Kim     | Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
5765f9b24faSJung-uk Kim                                         TrSetOpAmlLength ($1, 4);}
5775f9b24faSJung-uk Kim     | ConstExprTerm                 {$$ = TrSetOpIntegerValue (PARSEOP_DWORDCONST, $1);}
578f8146b88SJung-uk Kim     | DWordConst                    {}
579f8146b88SJung-uk Kim     ;
580f8146b88SJung-uk Kim 
581f8146b88SJung-uk Kim QWordConstExpr
5825f9b24faSJung-uk Kim     : Type3Opcode                   {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
5835f9b24faSJung-uk Kim                                         TrSetOpAmlLength ($1, 8);}
5845f9b24faSJung-uk Kim     | Type2IntegerOpcode            {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
5855f9b24faSJung-uk Kim                                         TrSetOpAmlLength ($1, 8);}
5865f9b24faSJung-uk Kim     | ConstExprTerm                 {$$ = TrSetOpIntegerValue (PARSEOP_QWORDCONST, $1);}
587f8146b88SJung-uk Kim     | QWordConst                    {}
588f8146b88SJung-uk Kim     ;
589f8146b88SJung-uk Kim 
590f8146b88SJung-uk Kim ConstTerm
591f8146b88SJung-uk Kim     : ConstExprTerm                 {}
5925f9b24faSJung-uk Kim     | PARSEOP_REVISION              {$$ = TrCreateLeafOp (PARSEOP_REVISION);}
593f8146b88SJung-uk Kim     ;
594f8146b88SJung-uk Kim 
595f8146b88SJung-uk Kim ConstExprTerm
5965f9b24faSJung-uk Kim     : PARSEOP_ZERO                  {$$ = TrCreateValuedLeafOp (PARSEOP_ZERO, 0);}
5975f9b24faSJung-uk Kim     | PARSEOP_ONE                   {$$ = TrCreateValuedLeafOp (PARSEOP_ONE, 1);}
5985f9b24faSJung-uk Kim     | PARSEOP_ONES                  {$$ = TrCreateValuedLeafOp (PARSEOP_ONES, ACPI_UINT64_MAX);}
5995f9b24faSJung-uk Kim     | PARSEOP___DATE__              {$$ = TrCreateConstantLeafOp (PARSEOP___DATE__);}
6005f9b24faSJung-uk Kim     | PARSEOP___FILE__              {$$ = TrCreateConstantLeafOp (PARSEOP___FILE__);}
6015f9b24faSJung-uk Kim     | PARSEOP___LINE__              {$$ = TrCreateConstantLeafOp (PARSEOP___LINE__);}
6025f9b24faSJung-uk Kim     | PARSEOP___PATH__              {$$ = TrCreateConstantLeafOp (PARSEOP___PATH__);}
6035f9b24faSJung-uk Kim     | PARSEOP___METHOD__            {$$ = TrCreateConstantLeafOp (PARSEOP___METHOD__);}
604f8146b88SJung-uk Kim     ;
605f8146b88SJung-uk Kim 
606f8146b88SJung-uk Kim Integer
6075f9b24faSJung-uk Kim     : PARSEOP_INTEGER               {$$ = TrCreateValuedLeafOp (PARSEOP_INTEGER,
608493deb39SJung-uk Kim                                         AslCompilerlval.i);}
609f8146b88SJung-uk Kim     ;
610f8146b88SJung-uk Kim 
611f8146b88SJung-uk Kim String
6125f9b24faSJung-uk Kim     : PARSEOP_STRING_LITERAL        {$$ = TrCreateValuedLeafOp (PARSEOP_STRING_LITERAL,
613493deb39SJung-uk Kim                                         (ACPI_NATIVE_INT) AslCompilerlval.s);}
614f8146b88SJung-uk Kim     ;
615f8146b88SJung-uk Kim 
616f8146b88SJung-uk Kim 
617f8146b88SJung-uk Kim /*******************************************************************************
618f8146b88SJung-uk Kim  *
619f8146b88SJung-uk Kim  * ASL Opcode Terms
620f8146b88SJung-uk Kim  *
621f8146b88SJung-uk Kim  ******************************************************************************/
622f8146b88SJung-uk Kim 
623f8146b88SJung-uk Kim CompilerDirective
624f8146b88SJung-uk Kim     : IncludeTerm                   {}
625f8146b88SJung-uk Kim     | IncludeEndTerm                {}
626f8146b88SJung-uk Kim     | ExternalTerm                  {}
627f8146b88SJung-uk Kim     ;
628f8146b88SJung-uk Kim 
629f8146b88SJung-uk Kim NamedObject
630f8146b88SJung-uk Kim     : BankFieldTerm                 {}
631f8146b88SJung-uk Kim     | CreateBitFieldTerm            {}
632f8146b88SJung-uk Kim     | CreateByteFieldTerm           {}
633f8146b88SJung-uk Kim     | CreateDWordFieldTerm          {}
634f8146b88SJung-uk Kim     | CreateFieldTerm               {}
635f8146b88SJung-uk Kim     | CreateQWordFieldTerm          {}
636f8146b88SJung-uk Kim     | CreateWordFieldTerm           {}
637f8146b88SJung-uk Kim     | DataRegionTerm                {}
638f8146b88SJung-uk Kim     | DeviceTerm                    {}
639f8146b88SJung-uk Kim     | EventTerm                     {}
640f8146b88SJung-uk Kim     | FieldTerm                     {}
641f8146b88SJung-uk Kim     | FunctionTerm                  {}
642f8146b88SJung-uk Kim     | IndexFieldTerm                {}
643f8146b88SJung-uk Kim     | MethodTerm                    {}
644f8146b88SJung-uk Kim     | MutexTerm                     {}
645f8146b88SJung-uk Kim     | OpRegionTerm                  {}
646f8146b88SJung-uk Kim     | PowerResTerm                  {}
647f8146b88SJung-uk Kim     | ProcessorTerm                 {}
648f8146b88SJung-uk Kim     | ThermalZoneTerm               {}
649f8146b88SJung-uk Kim     ;
650f8146b88SJung-uk Kim 
651f8146b88SJung-uk Kim NameSpaceModifier
652f8146b88SJung-uk Kim     : AliasTerm                     {}
653f8146b88SJung-uk Kim     | NameTerm                      {}
654af051161SJung-uk Kim /*    | NameTermAslPlus               {} */
655f8146b88SJung-uk Kim     | ScopeTerm                     {}
656f8146b88SJung-uk Kim     ;
657f8146b88SJung-uk Kim 
6581cc50d6bSJung-uk Kim SimpleName
659f8146b88SJung-uk Kim     : NameString                    {}
660f8146b88SJung-uk Kim     | LocalTerm                     {}
6611cc50d6bSJung-uk Kim     | ArgTerm                       {}
6621cc50d6bSJung-uk Kim     ;
6631cc50d6bSJung-uk Kim 
6641cc50d6bSJung-uk Kim /* For ObjectType(), SuperName except for MethodInvocationTerm */
6651cc50d6bSJung-uk Kim 
6661cc50d6bSJung-uk Kim ObjectTypeSource
6671cc50d6bSJung-uk Kim     : SimpleName                    {}
668f8146b88SJung-uk Kim     | DebugTerm                     {}
669f8146b88SJung-uk Kim     | RefOfTerm                     {}
670f8146b88SJung-uk Kim     | DerefOfTerm                   {}
671f8146b88SJung-uk Kim     | IndexTerm                     {}
672493deb39SJung-uk Kim     | IndexExpTerm                  {}
673f8146b88SJung-uk Kim     ;
674f8146b88SJung-uk Kim 
6751cc50d6bSJung-uk Kim /* For DeRefOf(), SuperName except for DerefOf and Debug */
6761cc50d6bSJung-uk Kim 
6771cc50d6bSJung-uk Kim DerefOfSource
6781cc50d6bSJung-uk Kim     : SimpleName                    {}
6791cc50d6bSJung-uk Kim     | RefOfTerm                     {}
6801cc50d6bSJung-uk Kim     | DerefOfTerm                   {}
6811cc50d6bSJung-uk Kim     | IndexTerm                     {}
6821cc50d6bSJung-uk Kim     | IndexExpTerm                  {}
6831cc50d6bSJung-uk Kim     | StoreTerm                     {}
6841cc50d6bSJung-uk Kim     | EqualsTerm                    {}
6851cc50d6bSJung-uk Kim     | MethodInvocationTerm          {}
686f8146b88SJung-uk Kim     ;
687f8146b88SJung-uk Kim 
6881cc50d6bSJung-uk Kim /* For RefOf(), SuperName except for RefOf and MethodInvocationTerm */
6891cc50d6bSJung-uk Kim 
6901cc50d6bSJung-uk Kim RefOfSource
6911cc50d6bSJung-uk Kim     : SimpleName                    {}
6921cc50d6bSJung-uk Kim     | DebugTerm                     {}
6931cc50d6bSJung-uk Kim     | DerefOfTerm                   {}
6941cc50d6bSJung-uk Kim     | IndexTerm                     {}
6951cc50d6bSJung-uk Kim     | IndexExpTerm                  {}
696f8146b88SJung-uk Kim     ;
697313a0c13SJung-uk Kim 
6981cc50d6bSJung-uk Kim /* For CondRefOf(), SuperName except for RefOf and MethodInvocationTerm */
699313a0c13SJung-uk Kim 
7001cc50d6bSJung-uk Kim CondRefOfSource
7011cc50d6bSJung-uk Kim     : SimpleName                    {}
7021cc50d6bSJung-uk Kim     | DebugTerm                     {}
7031cc50d6bSJung-uk Kim     | DerefOfTerm                   {}
7041cc50d6bSJung-uk Kim     | IndexTerm                     {}
7051cc50d6bSJung-uk Kim     | IndexExpTerm                  {}
7061cc50d6bSJung-uk Kim     ;
7071cc50d6bSJung-uk Kim 
7081cc50d6bSJung-uk Kim /*
7091cc50d6bSJung-uk Kim  * Opcode types, as defined in the ACPI specification
7101cc50d6bSJung-uk Kim  */
711313a0c13SJung-uk Kim Type1Opcode
712313a0c13SJung-uk Kim     : BreakTerm                     {}
713313a0c13SJung-uk Kim     | BreakPointTerm                {}
714313a0c13SJung-uk Kim     | ContinueTerm                  {}
715313a0c13SJung-uk Kim     | FatalTerm                     {}
716f8146b88SJung-uk Kim     | ForTerm                       {}
717f8146b88SJung-uk Kim     | ElseIfTerm                    {}
718313a0c13SJung-uk Kim     | NoOpTerm                      {}
719313a0c13SJung-uk Kim     | NotifyTerm                    {}
720313a0c13SJung-uk Kim     | ReleaseTerm                   {}
721313a0c13SJung-uk Kim     | ResetTerm                     {}
722313a0c13SJung-uk Kim     | ReturnTerm                    {}
723313a0c13SJung-uk Kim     | SignalTerm                    {}
724313a0c13SJung-uk Kim     | SleepTerm                     {}
725313a0c13SJung-uk Kim     | StallTerm                     {}
726313a0c13SJung-uk Kim     | SwitchTerm                    {}
727313a0c13SJung-uk Kim     | UnloadTerm                    {}
728313a0c13SJung-uk Kim     | WhileTerm                     {}
729313a0c13SJung-uk Kim     ;
730313a0c13SJung-uk Kim 
731313a0c13SJung-uk Kim Type2Opcode
732313a0c13SJung-uk Kim     : AcquireTerm                   {}
733313a0c13SJung-uk Kim     | CondRefOfTerm                 {}
734313a0c13SJung-uk Kim     | CopyObjectTerm                {}
735313a0c13SJung-uk Kim     | DerefOfTerm                   {}
736ab71bbb7SJung-uk Kim     | LoadTerm                      {} /* Moved from Type1 -- now returns an integer (ACPI 6.4) */
737313a0c13SJung-uk Kim     | ObjectTypeTerm                {}
738313a0c13SJung-uk Kim     | RefOfTerm                     {}
739313a0c13SJung-uk Kim     | SizeOfTerm                    {}
740313a0c13SJung-uk Kim     | StoreTerm                     {}
7411c0e1b6dSJung-uk Kim     | EqualsTerm                    {}
742313a0c13SJung-uk Kim     | TimerTerm                     {}
743313a0c13SJung-uk Kim     | WaitTerm                      {}
7447cf3e94aSJung-uk Kim     | MethodInvocationTerm          {}
745313a0c13SJung-uk Kim     ;
746313a0c13SJung-uk Kim 
747313a0c13SJung-uk Kim /*
748313a0c13SJung-uk Kim  * Type 3/4/5 opcodes
749313a0c13SJung-uk Kim  */
750313a0c13SJung-uk Kim Type2IntegerOpcode                  /* "Type3" opcodes */
7515f9b24faSJung-uk Kim     : Expression                    {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
7527cf3e94aSJung-uk Kim     | AddTerm                       {}
753313a0c13SJung-uk Kim     | AndTerm                       {}
754313a0c13SJung-uk Kim     | DecTerm                       {}
755313a0c13SJung-uk Kim     | DivideTerm                    {}
756313a0c13SJung-uk Kim     | FindSetLeftBitTerm            {}
757313a0c13SJung-uk Kim     | FindSetRightBitTerm           {}
758313a0c13SJung-uk Kim     | FromBCDTerm                   {}
759313a0c13SJung-uk Kim     | IncTerm                       {}
760313a0c13SJung-uk Kim     | IndexTerm                     {}
761af051161SJung-uk Kim /*    | StructureIndexTerm            {} */
762af051161SJung-uk Kim /*    | StructurePointerTerm          {} */
763313a0c13SJung-uk Kim     | LAndTerm                      {}
764313a0c13SJung-uk Kim     | LEqualTerm                    {}
765313a0c13SJung-uk Kim     | LGreaterTerm                  {}
766313a0c13SJung-uk Kim     | LGreaterEqualTerm             {}
767313a0c13SJung-uk Kim     | LLessTerm                     {}
768313a0c13SJung-uk Kim     | LLessEqualTerm                {}
769313a0c13SJung-uk Kim     | LNotTerm                      {}
770313a0c13SJung-uk Kim     | LNotEqualTerm                 {}
771313a0c13SJung-uk Kim     | LoadTableTerm                 {}
772313a0c13SJung-uk Kim     | LOrTerm                       {}
773313a0c13SJung-uk Kim     | MatchTerm                     {}
774313a0c13SJung-uk Kim     | ModTerm                       {}
775313a0c13SJung-uk Kim     | MultiplyTerm                  {}
776313a0c13SJung-uk Kim     | NAndTerm                      {}
777313a0c13SJung-uk Kim     | NOrTerm                       {}
778313a0c13SJung-uk Kim     | NotTerm                       {}
779313a0c13SJung-uk Kim     | OrTerm                        {}
780313a0c13SJung-uk Kim     | ShiftLeftTerm                 {}
781313a0c13SJung-uk Kim     | ShiftRightTerm                {}
782313a0c13SJung-uk Kim     | SubtractTerm                  {}
783313a0c13SJung-uk Kim     | ToBCDTerm                     {}
784313a0c13SJung-uk Kim     | ToIntegerTerm                 {}
785313a0c13SJung-uk Kim     | XOrTerm                       {}
786313a0c13SJung-uk Kim     ;
787313a0c13SJung-uk Kim 
788313a0c13SJung-uk Kim Type2StringOpcode                   /* "Type4" Opcodes */
789313a0c13SJung-uk Kim     : ToDecimalStringTerm           {}
790313a0c13SJung-uk Kim     | ToHexStringTerm               {}
791313a0c13SJung-uk Kim     | ToStringTerm                  {}
792313a0c13SJung-uk Kim     ;
793313a0c13SJung-uk Kim 
794313a0c13SJung-uk Kim Type2BufferOpcode                   /* "Type5" Opcodes */
795313a0c13SJung-uk Kim     : ToBufferTerm                  {}
796313a0c13SJung-uk Kim     | ConcatResTerm                 {}
797313a0c13SJung-uk Kim     ;
798313a0c13SJung-uk Kim 
799313a0c13SJung-uk Kim Type2BufferOrStringOpcode
8005f9b24faSJung-uk Kim     : ConcatTerm                    {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
8011c0e1b6dSJung-uk Kim     | PrintfTerm                    {}
8021c0e1b6dSJung-uk Kim     | FprintfTerm                   {}
803313a0c13SJung-uk Kim     | MidTerm                       {}
804313a0c13SJung-uk Kim     ;
805313a0c13SJung-uk Kim 
806313a0c13SJung-uk Kim /*
807313a0c13SJung-uk Kim  * A type 3 opcode evaluates to an Integer and cannot have a destination operand
808313a0c13SJung-uk Kim  */
809313a0c13SJung-uk Kim Type3Opcode
810313a0c13SJung-uk Kim     : EISAIDTerm                    {}
811313a0c13SJung-uk Kim     ;
812313a0c13SJung-uk Kim 
813313a0c13SJung-uk Kim /* Obsolete
814313a0c13SJung-uk Kim Type4Opcode
815313a0c13SJung-uk Kim     : ConcatTerm                    {}
816313a0c13SJung-uk Kim     | ToDecimalStringTerm           {}
817313a0c13SJung-uk Kim     | ToHexStringTerm               {}
818313a0c13SJung-uk Kim     | MidTerm                       {}
819313a0c13SJung-uk Kim     | ToStringTerm                  {}
820313a0c13SJung-uk Kim     ;
821313a0c13SJung-uk Kim */
822313a0c13SJung-uk Kim 
823493deb39SJung-uk Kim /* Type 5 opcodes are a subset of Type2 opcodes, and return a constant */
824493deb39SJung-uk Kim 
825313a0c13SJung-uk Kim Type5Opcode
826313a0c13SJung-uk Kim     : ResourceTemplateTerm          {}
827313a0c13SJung-uk Kim     | UnicodeTerm                   {}
8281c0e1b6dSJung-uk Kim     | ToPLDTerm                     {}
829313a0c13SJung-uk Kim     | ToUUIDTerm                    {}
830313a0c13SJung-uk Kim     ;
831313a0c13SJung-uk Kim 
832313a0c13SJung-uk Kim Type6Opcode
833313a0c13SJung-uk Kim     : RefOfTerm                     {}
834313a0c13SJung-uk Kim     | DerefOfTerm                   {}
835313a0c13SJung-uk Kim     | IndexTerm                     {}
836f8146b88SJung-uk Kim     | IndexExpTerm                  {}
837af051161SJung-uk Kim /*    | StructureIndexTerm            {} */
838af051161SJung-uk Kim /*    | StructurePointerTerm          {} */
8397cf3e94aSJung-uk Kim     | MethodInvocationTerm          {}
840313a0c13SJung-uk Kim     ;
841313a0c13SJung-uk Kim 
842313a0c13SJung-uk Kim 
843f8146b88SJung-uk Kim /*******************************************************************************
844f8146b88SJung-uk Kim  *
845f8146b88SJung-uk Kim  * ASL Helper Terms
846f8146b88SJung-uk Kim  *
847f8146b88SJung-uk Kim  ******************************************************************************/
848313a0c13SJung-uk Kim 
849313a0c13SJung-uk Kim AmlPackageLengthTerm
8505f9b24faSJung-uk Kim     : Integer                       {$$ = TrSetOpIntegerValue (PARSEOP_PACKAGE_LENGTH,
851493deb39SJung-uk Kim                                         (ACPI_PARSE_OBJECT *) $1);}
852313a0c13SJung-uk Kim     ;
853313a0c13SJung-uk Kim 
854313a0c13SJung-uk Kim NameStringItem
855313a0c13SJung-uk Kim     : ',' NameString                {$$ = $2;}
856313a0c13SJung-uk Kim     | ',' error                     {$$ = AslDoError (); yyclearin;}
857313a0c13SJung-uk Kim     ;
858313a0c13SJung-uk Kim 
859313a0c13SJung-uk Kim TermArgItem
860313a0c13SJung-uk Kim     : ',' TermArg                   {$$ = $2;}
861313a0c13SJung-uk Kim     | ',' error                     {$$ = AslDoError (); yyclearin;}
862313a0c13SJung-uk Kim     ;
863313a0c13SJung-uk Kim 
864313a0c13SJung-uk Kim OptionalReference
8655f9b24faSJung-uk Kim     :                               {$$ = TrCreateLeafOp (PARSEOP_ZERO);}       /* Placeholder is a ZeroOp object */
8665f9b24faSJung-uk Kim     | ','                           {$$ = TrCreateLeafOp (PARSEOP_ZERO);}       /* Placeholder is a ZeroOp object */
867313a0c13SJung-uk Kim     | ',' TermArg                   {$$ = $2;}
868313a0c13SJung-uk Kim     ;
869313a0c13SJung-uk Kim 
870313a0c13SJung-uk Kim OptionalReturnArg
8715f9b24faSJung-uk Kim     :                               {$$ = TrSetOpFlags (TrCreateLeafOp (PARSEOP_ZERO),
8725f9b24faSJung-uk Kim                                             OP_IS_NULL_RETURN);}       /* Placeholder is a ZeroOp object */
873313a0c13SJung-uk Kim     | TermArg                       {$$ = $1;}
874313a0c13SJung-uk Kim     ;
875313a0c13SJung-uk Kim 
876313a0c13SJung-uk Kim OptionalSerializeRuleKeyword
877313a0c13SJung-uk Kim     :                               {$$ = NULL;}
878313a0c13SJung-uk Kim     | ','                           {$$ = NULL;}
879313a0c13SJung-uk Kim     | ',' SerializeRuleKeyword      {$$ = $2;}
880313a0c13SJung-uk Kim     ;
881313a0c13SJung-uk Kim 
882313a0c13SJung-uk Kim OptionalTermArg
8835f9b24faSJung-uk Kim     :                               {$$ = TrCreateLeafOp (PARSEOP_DEFAULT_ARG);}
884313a0c13SJung-uk Kim     | TermArg                       {$$ = $1;}
885313a0c13SJung-uk Kim     ;
886313a0c13SJung-uk Kim 
887313a0c13SJung-uk Kim OptionalWordConst
888313a0c13SJung-uk Kim     :                               {$$ = NULL;}
889313a0c13SJung-uk Kim     | WordConst                     {$$ = $1;}
890313a0c13SJung-uk Kim     ;
891