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