aslrules.y revision 1.1.1.13 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.13 christos * Copyright (C) 2000 - 2021, 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.1.13 christos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 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.1.11 christos | ObjectTypeKeyword {$$ = TrLinkOpChildren (
317 1.1.1.11 christos TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$1);}
318 1.1.1.11 christos | '{' ParameterTypePackage '}' {$$ = TrLinkOpChildren (
319 1.1.1.11 christos TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
320 1.1 christos ;
321 1.1 christos
322 1.1.1.11 christos
323 1.1 christos OptionalParameterTypePackage
324 1.1.1.11 christos : {$$ = NULL;}
325 1.1.1.11 christos | ',' ParameterTypePackageList {$$ = $2;}
326 1.1 christos ;
327 1.1 christos
328 1.1.1.3 christos /* Rules for specifying the types for method arguments */
329 1.1 christos
330 1.1 christos ParameterTypesPackage
331 1.1 christos : ParameterTypePackageList {$$ = $1;}
332 1.1 christos | ParameterTypesPackage ','
333 1.1.1.8 christos ParameterTypePackageList {$$ = TrLinkPeerOps (2,$1,$3);}
334 1.1 christos ;
335 1.1 christos
336 1.1 christos ParameterTypesPackageList
337 1.1 christos : {$$ = NULL;}
338 1.1.1.11 christos | ObjectTypeKeyword {$$ = TrLinkOpChildren (
339 1.1.1.11 christos TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$1);}
340 1.1.1.11 christos | '{' ParameterTypesPackage '}' {$$ = TrLinkOpChildren (
341 1.1.1.11 christos TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
342 1.1 christos ;
343 1.1 christos
344 1.1 christos OptionalParameterTypesPackage
345 1.1.1.11 christos : {$$ = NULL;}
346 1.1.1.11 christos | ',' ParameterTypesPackageList {$$ = $2;}
347 1.1 christos ;
348 1.1 christos
349 1.1 christos /*
350 1.1.1.3 christos * Case-Default list; allow only one Default term and unlimited Case terms
351 1.1 christos */
352 1.1.1.3 christos CaseDefaultTermList
353 1.1.1.3 christos : {$$ = NULL;}
354 1.1.1.6 christos | CaseTerm {}
355 1.1.1.6 christos | DefaultTerm {}
356 1.1.1.3 christos | CaseDefaultTermList
357 1.1.1.8 christos CaseTerm {$$ = TrLinkPeerOp ($1,$2);}
358 1.1.1.3 christos | CaseDefaultTermList
359 1.1.1.8 christos DefaultTerm {$$ = TrLinkPeerOp ($1,$2);}
360 1.1 christos
361 1.1.1.3 christos /* Original - attempts to force zero or one default term within the switch */
362 1.1.1.3 christos
363 1.1.1.3 christos /*
364 1.1.1.3 christos CaseDefaultTermList
365 1.1.1.3 christos : {$$ = NULL;}
366 1.1.1.3 christos | CaseTermList
367 1.1.1.3 christos DefaultTerm
368 1.1.1.8 christos CaseTermList {$$ = TrLinkPeerOp ($1,TrLinkPeerOp ($2, $3));}
369 1.1.1.3 christos | CaseTermList
370 1.1.1.8 christos CaseTerm {$$ = TrLinkPeerOp ($1,$2);}
371 1.1.1.3 christos ;
372 1.1.1.3 christos
373 1.1.1.3 christos CaseTermList
374 1.1.1.3 christos : {$$ = NULL;}
375 1.1.1.3 christos | CaseTerm {}
376 1.1.1.3 christos | CaseTermList
377 1.1.1.8 christos CaseTerm {$$ = TrLinkPeerOp ($1,$2);}
378 1.1.1.3 christos ;
379 1.1.1.3 christos */
380 1.1.1.3 christos
381 1.1.1.3 christos
382 1.1.1.3 christos /*******************************************************************************
383 1.1.1.3 christos *
384 1.1.1.3 christos * ASL Data and Constant Terms
385 1.1.1.3 christos *
386 1.1.1.3 christos ******************************************************************************/
387 1.1.1.3 christos
388 1.1.1.3 christos DataObject
389 1.1.1.3 christos : BufferData {}
390 1.1.1.3 christos | PackageData {}
391 1.1.1.3 christos | IntegerData {}
392 1.1.1.3 christos | StringData {}
393 1.1.1.3 christos ;
394 1.1.1.3 christos
395 1.1.1.3 christos BufferData
396 1.1.1.8 christos : Type5Opcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
397 1.1.1.8 christos | Type2BufferOrStringOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
398 1.1.1.8 christos | Type2BufferOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
399 1.1.1.3 christos | BufferTerm {}
400 1.1.1.3 christos ;
401 1.1.1.3 christos
402 1.1.1.3 christos PackageData
403 1.1.1.3 christos : PackageTerm {}
404 1.1.1.3 christos ;
405 1.1.1.3 christos
406 1.1.1.3 christos IntegerData
407 1.1.1.8 christos : Type2IntegerOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
408 1.1.1.8 christos | Type3Opcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
409 1.1.1.3 christos | Integer {}
410 1.1.1.3 christos | ConstTerm {}
411 1.1.1.3 christos ;
412 1.1.1.3 christos
413 1.1.1.3 christos StringData
414 1.1.1.8 christos : Type2StringOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
415 1.1.1.3 christos | String {}
416 1.1.1.3 christos ;
417 1.1.1.3 christos
418 1.1.1.12 christos StringLiteral
419 1.1.1.12 christos : String {}
420 1.1.1.12 christos ;
421 1.1.1.12 christos
422 1.1.1.3 christos ByteConst
423 1.1.1.8 christos : Integer {$$ = TrSetOpIntegerValue (PARSEOP_BYTECONST, $1);}
424 1.1.1.3 christos ;
425 1.1.1.3 christos
426 1.1.1.3 christos WordConst
427 1.1.1.8 christos : Integer {$$ = TrSetOpIntegerValue (PARSEOP_WORDCONST, $1);}
428 1.1.1.3 christos ;
429 1.1.1.3 christos
430 1.1.1.3 christos DWordConst
431 1.1.1.8 christos : Integer {$$ = TrSetOpIntegerValue (PARSEOP_DWORDCONST, $1);}
432 1.1.1.3 christos ;
433 1.1.1.3 christos
434 1.1.1.3 christos QWordConst
435 1.1.1.8 christos : Integer {$$ = TrSetOpIntegerValue (PARSEOP_QWORDCONST, $1);}
436 1.1.1.3 christos ;
437 1.1.1.3 christos
438 1.1.1.3 christos /*
439 1.1.1.8 christos * The OP_COMPILE_TIME_CONST flag in the following constant expressions
440 1.1.1.3 christos * enables compile-time constant folding to reduce the Type3Opcodes/Type2IntegerOpcodes
441 1.1.1.3 christos * to simple integers. It is an error if these types of expressions cannot be
442 1.1.1.3 christos * reduced, since the AML grammar for ****ConstExpr requires a simple constant.
443 1.1.1.3 christos * Note: The required byte length of the constant is passed through to the
444 1.1.1.3 christos * constant folding code in the node AmlLength field.
445 1.1.1.3 christos */
446 1.1.1.3 christos ByteConstExpr
447 1.1.1.8 christos : Type3Opcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
448 1.1.1.8 christos TrSetOpAmlLength ($1, 1);}
449 1.1.1.8 christos | Type2IntegerOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
450 1.1.1.8 christos TrSetOpAmlLength ($1, 1);}
451 1.1.1.8 christos | ConstExprTerm {$$ = TrSetOpIntegerValue (PARSEOP_BYTECONST, $1);}
452 1.1.1.3 christos | ByteConst {}
453 1.1.1.3 christos ;
454 1.1.1.3 christos
455 1.1.1.3 christos WordConstExpr
456 1.1.1.8 christos : Type3Opcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
457 1.1.1.8 christos TrSetOpAmlLength ($1, 2);}
458 1.1.1.8 christos | Type2IntegerOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
459 1.1.1.8 christos TrSetOpAmlLength ($1, 2);}
460 1.1.1.8 christos | ConstExprTerm {$$ = TrSetOpIntegerValue (PARSEOP_WORDCONST, $1);}
461 1.1.1.3 christos | WordConst {}
462 1.1.1.3 christos ;
463 1.1.1.3 christos
464 1.1.1.3 christos DWordConstExpr
465 1.1.1.8 christos : Type3Opcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
466 1.1.1.8 christos TrSetOpAmlLength ($1, 4);}
467 1.1.1.8 christos | Type2IntegerOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
468 1.1.1.8 christos TrSetOpAmlLength ($1, 4);}
469 1.1.1.8 christos | ConstExprTerm {$$ = TrSetOpIntegerValue (PARSEOP_DWORDCONST, $1);}
470 1.1.1.3 christos | DWordConst {}
471 1.1.1.3 christos ;
472 1.1.1.3 christos
473 1.1.1.3 christos QWordConstExpr
474 1.1.1.8 christos : Type3Opcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
475 1.1.1.8 christos TrSetOpAmlLength ($1, 8);}
476 1.1.1.8 christos | Type2IntegerOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);
477 1.1.1.8 christos TrSetOpAmlLength ($1, 8);}
478 1.1.1.8 christos | ConstExprTerm {$$ = TrSetOpIntegerValue (PARSEOP_QWORDCONST, $1);}
479 1.1.1.3 christos | QWordConst {}
480 1.1.1.3 christos ;
481 1.1.1.3 christos
482 1.1.1.3 christos ConstTerm
483 1.1.1.3 christos : ConstExprTerm {}
484 1.1.1.8 christos | PARSEOP_REVISION {$$ = TrCreateLeafOp (PARSEOP_REVISION);}
485 1.1.1.3 christos ;
486 1.1.1.3 christos
487 1.1.1.3 christos ConstExprTerm
488 1.1.1.8 christos : PARSEOP_ZERO {$$ = TrCreateValuedLeafOp (PARSEOP_ZERO, 0);}
489 1.1.1.8 christos | PARSEOP_ONE {$$ = TrCreateValuedLeafOp (PARSEOP_ONE, 1);}
490 1.1.1.8 christos | PARSEOP_ONES {$$ = TrCreateValuedLeafOp (PARSEOP_ONES, ACPI_UINT64_MAX);}
491 1.1.1.8 christos | PARSEOP___DATE__ {$$ = TrCreateConstantLeafOp (PARSEOP___DATE__);}
492 1.1.1.8 christos | PARSEOP___FILE__ {$$ = TrCreateConstantLeafOp (PARSEOP___FILE__);}
493 1.1.1.8 christos | PARSEOP___LINE__ {$$ = TrCreateConstantLeafOp (PARSEOP___LINE__);}
494 1.1.1.8 christos | PARSEOP___PATH__ {$$ = TrCreateConstantLeafOp (PARSEOP___PATH__);}
495 1.1.1.8 christos | PARSEOP___METHOD__ {$$ = TrCreateConstantLeafOp (PARSEOP___METHOD__);}
496 1.1.1.3 christos ;
497 1.1.1.3 christos
498 1.1.1.3 christos Integer
499 1.1.1.8 christos : PARSEOP_INTEGER {$$ = TrCreateValuedLeafOp (PARSEOP_INTEGER,
500 1.1.1.5 christos AslCompilerlval.i);}
501 1.1.1.3 christos ;
502 1.1.1.3 christos
503 1.1.1.3 christos String
504 1.1.1.8 christos : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafOp (PARSEOP_STRING_LITERAL,
505 1.1.1.5 christos (ACPI_NATIVE_INT) AslCompilerlval.s);}
506 1.1.1.3 christos ;
507 1.1.1.3 christos
508 1.1.1.3 christos
509 1.1.1.3 christos /*******************************************************************************
510 1.1.1.3 christos *
511 1.1.1.3 christos * ASL Opcode Terms
512 1.1.1.3 christos *
513 1.1.1.3 christos ******************************************************************************/
514 1.1.1.3 christos
515 1.1.1.3 christos CompilerDirective
516 1.1.1.3 christos : IncludeTerm {}
517 1.1.1.3 christos | IncludeEndTerm {}
518 1.1.1.3 christos | ExternalTerm {}
519 1.1.1.3 christos ;
520 1.1.1.3 christos
521 1.1.1.3 christos NamedObject
522 1.1.1.3 christos : BankFieldTerm {}
523 1.1.1.3 christos | CreateBitFieldTerm {}
524 1.1.1.3 christos | CreateByteFieldTerm {}
525 1.1.1.3 christos | CreateDWordFieldTerm {}
526 1.1.1.3 christos | CreateFieldTerm {}
527 1.1.1.3 christos | CreateQWordFieldTerm {}
528 1.1.1.3 christos | CreateWordFieldTerm {}
529 1.1.1.3 christos | DataRegionTerm {}
530 1.1.1.3 christos | DeviceTerm {}
531 1.1.1.3 christos | EventTerm {}
532 1.1.1.3 christos | FieldTerm {}
533 1.1.1.3 christos | FunctionTerm {}
534 1.1.1.3 christos | IndexFieldTerm {}
535 1.1.1.3 christos | MethodTerm {}
536 1.1.1.3 christos | MutexTerm {}
537 1.1.1.3 christos | OpRegionTerm {}
538 1.1.1.3 christos | PowerResTerm {}
539 1.1.1.3 christos | ProcessorTerm {}
540 1.1.1.3 christos | ThermalZoneTerm {}
541 1.1.1.3 christos ;
542 1.1.1.3 christos
543 1.1.1.3 christos NameSpaceModifier
544 1.1.1.3 christos : AliasTerm {}
545 1.1.1.3 christos | NameTerm {}
546 1.1.1.8 christos /* | NameTermAslPlus {} */
547 1.1.1.3 christos | ScopeTerm {}
548 1.1.1.3 christos ;
549 1.1.1.3 christos
550 1.1.1.6 christos SimpleName
551 1.1.1.3 christos : NameString {}
552 1.1.1.3 christos | LocalTerm {}
553 1.1.1.6 christos | ArgTerm {}
554 1.1.1.6 christos ;
555 1.1.1.6 christos
556 1.1.1.6 christos /* For ObjectType(), SuperName except for MethodInvocationTerm */
557 1.1.1.6 christos
558 1.1.1.6 christos ObjectTypeSource
559 1.1.1.6 christos : SimpleName {}
560 1.1.1.3 christos | DebugTerm {}
561 1.1.1.3 christos | RefOfTerm {}
562 1.1.1.3 christos | DerefOfTerm {}
563 1.1.1.3 christos | IndexTerm {}
564 1.1.1.5 christos | IndexExpTerm {}
565 1.1.1.3 christos ;
566 1.1.1.3 christos
567 1.1.1.6 christos /* For DeRefOf(), SuperName except for DerefOf and Debug */
568 1.1.1.6 christos
569 1.1.1.6 christos DerefOfSource
570 1.1.1.6 christos : SimpleName {}
571 1.1.1.6 christos | RefOfTerm {}
572 1.1.1.6 christos | DerefOfTerm {}
573 1.1.1.6 christos | IndexTerm {}
574 1.1.1.6 christos | IndexExpTerm {}
575 1.1.1.6 christos | StoreTerm {}
576 1.1.1.6 christos | EqualsTerm {}
577 1.1.1.6 christos | MethodInvocationTerm {}
578 1.1.1.3 christos ;
579 1.1.1.3 christos
580 1.1.1.6 christos /* For RefOf(), SuperName except for RefOf and MethodInvocationTerm */
581 1.1.1.6 christos
582 1.1.1.6 christos RefOfSource
583 1.1.1.6 christos : SimpleName {}
584 1.1.1.6 christos | DebugTerm {}
585 1.1.1.6 christos | DerefOfTerm {}
586 1.1.1.6 christos | IndexTerm {}
587 1.1.1.6 christos | IndexExpTerm {}
588 1.1.1.3 christos ;
589 1.1.1.3 christos
590 1.1.1.6 christos /* For CondRefOf(), SuperName except for RefOf and MethodInvocationTerm */
591 1.1.1.6 christos
592 1.1.1.6 christos CondRefOfSource
593 1.1.1.6 christos : SimpleName {}
594 1.1.1.6 christos | DebugTerm {}
595 1.1.1.6 christos | DerefOfTerm {}
596 1.1.1.6 christos | IndexTerm {}
597 1.1.1.6 christos | IndexExpTerm {}
598 1.1.1.6 christos ;
599 1.1.1.3 christos
600 1.1.1.6 christos /*
601 1.1.1.6 christos * Opcode types, as defined in the ACPI specification
602 1.1.1.6 christos */
603 1.1.1.3 christos Type1Opcode
604 1.1.1.3 christos : BreakTerm {}
605 1.1.1.3 christos | BreakPointTerm {}
606 1.1.1.3 christos | ContinueTerm {}
607 1.1.1.3 christos | FatalTerm {}
608 1.1.1.4 christos | ForTerm {}
609 1.1.1.3 christos | ElseIfTerm {}
610 1.1.1.3 christos | LoadTerm {}
611 1.1.1.3 christos | NoOpTerm {}
612 1.1.1.3 christos | NotifyTerm {}
613 1.1.1.3 christos | ReleaseTerm {}
614 1.1.1.3 christos | ResetTerm {}
615 1.1.1.3 christos | ReturnTerm {}
616 1.1.1.3 christos | SignalTerm {}
617 1.1.1.3 christos | SleepTerm {}
618 1.1.1.3 christos | StallTerm {}
619 1.1.1.3 christos | SwitchTerm {}
620 1.1.1.3 christos | UnloadTerm {}
621 1.1.1.3 christos | WhileTerm {}
622 1.1.1.3 christos ;
623 1.1.1.3 christos
624 1.1.1.3 christos Type2Opcode
625 1.1.1.3 christos : AcquireTerm {}
626 1.1.1.3 christos | CondRefOfTerm {}
627 1.1.1.3 christos | CopyObjectTerm {}
628 1.1.1.3 christos | DerefOfTerm {}
629 1.1.1.3 christos | ObjectTypeTerm {}
630 1.1.1.3 christos | RefOfTerm {}
631 1.1.1.3 christos | SizeOfTerm {}
632 1.1.1.3 christos | StoreTerm {}
633 1.1.1.3 christos | EqualsTerm {}
634 1.1.1.3 christos | TimerTerm {}
635 1.1.1.3 christos | WaitTerm {}
636 1.1.1.3 christos | MethodInvocationTerm {}
637 1.1.1.3 christos ;
638 1.1.1.3 christos
639 1.1.1.3 christos /*
640 1.1.1.3 christos * Type 3/4/5 opcodes
641 1.1.1.3 christos */
642 1.1.1.3 christos Type2IntegerOpcode /* "Type3" opcodes */
643 1.1.1.8 christos : Expression {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
644 1.1.1.3 christos | AddTerm {}
645 1.1.1.3 christos | AndTerm {}
646 1.1 christos | DecTerm {}
647 1.1 christos | DivideTerm {}
648 1.1 christos | FindSetLeftBitTerm {}
649 1.1 christos | FindSetRightBitTerm {}
650 1.1 christos | FromBCDTerm {}
651 1.1 christos | IncTerm {}
652 1.1 christos | IndexTerm {}
653 1.1.1.8 christos /* | StructureIndexTerm {} */
654 1.1.1.8 christos /* | StructurePointerTerm {} */
655 1.1 christos | LAndTerm {}
656 1.1 christos | LEqualTerm {}
657 1.1 christos | LGreaterTerm {}
658 1.1 christos | LGreaterEqualTerm {}
659 1.1 christos | LLessTerm {}
660 1.1 christos | LLessEqualTerm {}
661 1.1 christos | LNotTerm {}
662 1.1 christos | LNotEqualTerm {}
663 1.1 christos | LoadTableTerm {}
664 1.1 christos | LOrTerm {}
665 1.1 christos | MatchTerm {}
666 1.1 christos | ModTerm {}
667 1.1 christos | MultiplyTerm {}
668 1.1 christos | NAndTerm {}
669 1.1 christos | NOrTerm {}
670 1.1 christos | NotTerm {}
671 1.1 christos | OrTerm {}
672 1.1 christos | ShiftLeftTerm {}
673 1.1 christos | ShiftRightTerm {}
674 1.1 christos | SubtractTerm {}
675 1.1 christos | ToBCDTerm {}
676 1.1 christos | ToIntegerTerm {}
677 1.1 christos | XOrTerm {}
678 1.1 christos ;
679 1.1 christos
680 1.1 christos Type2StringOpcode /* "Type4" Opcodes */
681 1.1 christos : ToDecimalStringTerm {}
682 1.1 christos | ToHexStringTerm {}
683 1.1 christos | ToStringTerm {}
684 1.1 christos ;
685 1.1 christos
686 1.1 christos Type2BufferOpcode /* "Type5" Opcodes */
687 1.1 christos : ToBufferTerm {}
688 1.1 christos | ConcatResTerm {}
689 1.1 christos ;
690 1.1 christos
691 1.1 christos Type2BufferOrStringOpcode
692 1.1.1.8 christos : ConcatTerm {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);}
693 1.1.1.2 christos | PrintfTerm {}
694 1.1.1.2 christos | FprintfTerm {}
695 1.1 christos | MidTerm {}
696 1.1 christos ;
697 1.1 christos
698 1.1 christos /*
699 1.1 christos * A type 3 opcode evaluates to an Integer and cannot have a destination operand
700 1.1 christos */
701 1.1 christos Type3Opcode
702 1.1 christos : EISAIDTerm {}
703 1.1 christos ;
704 1.1 christos
705 1.1 christos /* Obsolete
706 1.1 christos Type4Opcode
707 1.1 christos : ConcatTerm {}
708 1.1 christos | ToDecimalStringTerm {}
709 1.1 christos | ToHexStringTerm {}
710 1.1 christos | MidTerm {}
711 1.1 christos | ToStringTerm {}
712 1.1 christos ;
713 1.1 christos */
714 1.1 christos
715 1.1.1.5 christos /* Type 5 opcodes are a subset of Type2 opcodes, and return a constant */
716 1.1.1.5 christos
717 1.1 christos Type5Opcode
718 1.1 christos : ResourceTemplateTerm {}
719 1.1 christos | UnicodeTerm {}
720 1.1.1.2 christos | ToPLDTerm {}
721 1.1 christos | ToUUIDTerm {}
722 1.1 christos ;
723 1.1 christos
724 1.1 christos Type6Opcode
725 1.1 christos : RefOfTerm {}
726 1.1 christos | DerefOfTerm {}
727 1.1 christos | IndexTerm {}
728 1.1.1.3 christos | IndexExpTerm {}
729 1.1.1.8 christos /* | StructureIndexTerm {} */
730 1.1.1.8 christos /* | StructurePointerTerm {} */
731 1.1.1.2 christos | MethodInvocationTerm {}
732 1.1 christos ;
733 1.1 christos
734 1.1 christos
735 1.1.1.3 christos /*******************************************************************************
736 1.1.1.3 christos *
737 1.1.1.3 christos * ASL Helper Terms
738 1.1.1.3 christos *
739 1.1.1.3 christos ******************************************************************************/
740 1.1 christos
741 1.1 christos AmlPackageLengthTerm
742 1.1.1.8 christos : Integer {$$ = TrSetOpIntegerValue (PARSEOP_PACKAGE_LENGTH,
743 1.1.1.5 christos (ACPI_PARSE_OBJECT *) $1);}
744 1.1 christos ;
745 1.1 christos
746 1.1 christos NameStringItem
747 1.1 christos : ',' NameString {$$ = $2;}
748 1.1 christos | ',' error {$$ = AslDoError (); yyclearin;}
749 1.1 christos ;
750 1.1 christos
751 1.1 christos TermArgItem
752 1.1 christos : ',' TermArg {$$ = $2;}
753 1.1 christos | ',' error {$$ = AslDoError (); yyclearin;}
754 1.1 christos ;
755 1.1 christos
756 1.1 christos OptionalReference
757 1.1.1.8 christos : {$$ = TrCreateLeafOp (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */
758 1.1.1.8 christos | ',' {$$ = TrCreateLeafOp (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */
759 1.1 christos | ',' TermArg {$$ = $2;}
760 1.1 christos ;
761 1.1 christos
762 1.1 christos OptionalReturnArg
763 1.1.1.8 christos : {$$ = TrSetOpFlags (TrCreateLeafOp (PARSEOP_ZERO),
764 1.1.1.8 christos OP_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */
765 1.1 christos | TermArg {$$ = $1;}
766 1.1 christos ;
767 1.1 christos
768 1.1 christos OptionalSerializeRuleKeyword
769 1.1 christos : {$$ = NULL;}
770 1.1 christos | ',' {$$ = NULL;}
771 1.1 christos | ',' SerializeRuleKeyword {$$ = $2;}
772 1.1 christos ;
773 1.1 christos
774 1.1 christos OptionalTermArg
775 1.1.1.8 christos : {$$ = TrCreateLeafOp (PARSEOP_DEFAULT_ARG);}
776 1.1.1.4 christos | TermArg {$$ = $1;}
777 1.1.1.4 christos ;
778 1.1.1.4 christos
779 1.1 christos OptionalWordConst
780 1.1 christos : {$$ = NULL;}
781 1.1 christos | WordConst {$$ = $1;}
782 1.1 christos ;
783