aslrules.y revision 1.1.1.7 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.5 christos : DefinitionBlockList {$<n>$ = TrLinkChildren (
61 1.1.1.5 christos TrCreateLeafNode (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.7 christos PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (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.7 christos PARSEOP_CLOSE_PAREN {TrSetEndLineNumber ($<n>3); COMMENT_CAPTURE_ON;}
95 1.1.1.5 christos '{' TermList '}' {$$ = TrLinkChildren ($<n>3,7,
96 1.1.1.5 christos $4,$6,$8,$10,$12,$14,$18);}
97 1.1 christos ;
98 1.1 christos
99 1.1.1.3 christos DefinitionBlockList
100 1.1.1.3 christos : DefinitionBlockTerm
101 1.1.1.3 christos | DefinitionBlockTerm
102 1.1.1.3 christos DefinitionBlockList {$$ = TrLinkPeerNodes (2, $1,$2);}
103 1.1.1.2 christos ;
104 1.1.1.2 christos
105 1.1.1.6 christos
106 1.1.1.6 christos /******* Basic ASCII identifiers **************************************************/
107 1.1.1.6 christos
108 1.1.1.5 christos /* Allow IO, DMA, IRQ Resource macro and FOR macro names to also be used as identifiers */
109 1.1.1.5 christos
110 1.1.1.5 christos NameString
111 1.1.1.5 christos : NameSeg {}
112 1.1.1.5 christos | PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) $1);}
113 1.1.1.5 christos | PARSEOP_IO {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");}
114 1.1.1.5 christos | PARSEOP_DMA {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");}
115 1.1.1.5 christos | PARSEOP_IRQ {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");}
116 1.1.1.5 christos | PARSEOP_FOR {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "FOR");}
117 1.1.1.5 christos ;
118 1.1.1.5 christos /*
119 1.1.1.5 christos NameSeg
120 1.1.1.5 christos : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (ACPI_NATIVE_INT)
121 1.1.1.6 christos TrNormalizeNameSeg ($1));}
122 1.1.1.5 christos ;
123 1.1.1.5 christos */
124 1.1.1.5 christos
125 1.1.1.5 christos NameSeg
126 1.1.1.5 christos : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
127 1.1.1.6 christos (ACPI_NATIVE_INT) AslCompilerlval.s);}
128 1.1.1.5 christos ;
129 1.1.1.5 christos
130 1.1.1.5 christos
131 1.1.1.6 christos /******* Fundamental argument/statement types ***********************************/
132 1.1.1.6 christos
133 1.1.1.6 christos Term
134 1.1.1.6 christos : Object {}
135 1.1.1.6 christos | Type1Opcode {}
136 1.1.1.6 christos | Type2Opcode {}
137 1.1.1.6 christos | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
138 1.1.1.6 christos | Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
139 1.1.1.6 christos | Type2BufferOpcode {}
140 1.1.1.6 christos | Type2BufferOrStringOpcode {}
141 1.1.1.6 christos | error {$$ = AslDoError(); yyclearin;}
142 1.1.1.6 christos ;
143 1.1.1.6 christos
144 1.1.1.3 christos SuperName
145 1.1.1.6 christos : SimpleName {}
146 1.1.1.3 christos | DebugTerm {}
147 1.1.1.3 christos | Type6Opcode {}
148 1.1.1.5 christos ;
149 1.1.1.2 christos
150 1.1.1.3 christos Target
151 1.1.1.3 christos : {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */
152 1.1.1.3 christos | ',' {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */
153 1.1.1.3 christos | ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);}
154 1.1 christos ;
155 1.1 christos
156 1.1.1.6 christos RequiredTarget
157 1.1.1.6 christos : ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);}
158 1.1.1.6 christos ;
159 1.1.1.6 christos
160 1.1.1.3 christos TermArg
161 1.1.1.6 christos : SimpleName {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
162 1.1.1.6 christos | Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
163 1.1.1.3 christos | DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
164 1.1.1.6 christos /*
165 1.1.1.6 christos | PARSEOP_OPEN_PAREN
166 1.1.1.6 christos TermArg
167 1.1.1.6 christos PARSEOP_CLOSE_PAREN {}
168 1.1.1.6 christos */
169 1.1 christos ;
170 1.1 christos
171 1.1.1.3 christos /*
172 1.1.1.3 christos NOTE: Removed from TermArg due to reduce/reduce conflicts:
173 1.1.1.3 christos | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
174 1.1.1.3 christos | Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
175 1.1.1.3 christos | Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
176 1.1.1.3 christos | Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
177 1.1 christos
178 1.1.1.3 christos */
179 1.1 christos
180 1.1.1.3 christos MethodInvocationTerm
181 1.1.1.6 christos : NameString
182 1.1.1.7 christos PARSEOP_OPEN_PAREN {TrUpdateNode (PARSEOP_METHODCALL, $1); COMMENT_CAPTURE_OFF;}
183 1.1.1.6 christos ArgList
184 1.1.1.7 christos PARSEOP_CLOSE_PAREN {$$ = TrLinkChildNode ($1,$4); COMMENT_CAPTURE_ON;}
185 1.1 christos ;
186 1.1 christos
187 1.1.1.3 christos /* OptionalCount must appear before ByteList or an incorrect reduction will result */
188 1.1 christos
189 1.1.1.3 christos OptionalCount
190 1.1.1.3 christos : {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */
191 1.1.1.3 christos | ',' {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */
192 1.1.1.3 christos | ',' TermArg {$$ = $2;}
193 1.1 christos ;
194 1.1 christos
195 1.1.1.5 christos /*
196 1.1.1.5 christos * Data count for buffers and packages (byte count for buffers,
197 1.1.1.5 christos * element count for packages).
198 1.1.1.5 christos */
199 1.1.1.5 christos OptionalDataCount
200 1.1.1.5 christos
201 1.1.1.5 christos /* Legacy ASL */
202 1.1.1.5 christos : {$$ = NULL;}
203 1.1.1.6 christos | PARSEOP_OPEN_PAREN
204 1.1.1.6 christos TermArg
205 1.1.1.6 christos PARSEOP_CLOSE_PAREN {$$ = $2;}
206 1.1.1.6 christos | PARSEOP_OPEN_PAREN
207 1.1.1.6 christos PARSEOP_CLOSE_PAREN {$$ = NULL;}
208 1.1.1.5 christos
209 1.1.1.5 christos /* C-style (ASL+) -- adds equals term */
210 1.1.1.5 christos
211 1.1.1.5 christos | PARSEOP_EXP_EQUALS {$$ = NULL;}
212 1.1.1.5 christos
213 1.1.1.6 christos | PARSEOP_OPEN_PAREN
214 1.1.1.6 christos TermArg
215 1.1.1.6 christos PARSEOP_CLOSE_PAREN
216 1.1.1.5 christos PARSEOP_EXP_EQUALS {$$ = $2;}
217 1.1.1.5 christos
218 1.1.1.6 christos | PARSEOP_OPEN_PAREN
219 1.1.1.6 christos PARSEOP_CLOSE_PAREN
220 1.1.1.6 christos String
221 1.1.1.5 christos PARSEOP_EXP_EQUALS {$$ = NULL;}
222 1.1 christos ;
223 1.1 christos
224 1.1 christos
225 1.1.1.3 christos /******* List Terms **************************************************/
226 1.1 christos
227 1.1.1.6 christos /* ACPI 3.0 -- allow semicolons between terms */
228 1.1.1.6 christos
229 1.1.1.6 christos TermList
230 1.1.1.6 christos : {$$ = NULL;}
231 1.1.1.6 christos | TermList Term {$$ = TrLinkPeerNode (
232 1.1.1.6 christos TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
233 1.1.1.6 christos | TermList Term ';' {$$ = TrLinkPeerNode (
234 1.1.1.6 christos TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
235 1.1.1.6 christos | TermList ';' Term {$$ = TrLinkPeerNode (
236 1.1.1.6 christos TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);}
237 1.1.1.6 christos | TermList ';' Term ';' {$$ = TrLinkPeerNode (
238 1.1.1.6 christos TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);}
239 1.1.1.6 christos ;
240 1.1.1.6 christos
241 1.1.1.3 christos ArgList
242 1.1.1.3 christos : {$$ = NULL;}
243 1.1.1.3 christos | TermArg
244 1.1.1.3 christos | ArgList ',' /* Allows a trailing comma at list end */
245 1.1.1.3 christos | ArgList ','
246 1.1.1.3 christos TermArg {$$ = TrLinkPeerNode ($1,$3);}
247 1.1 christos ;
248 1.1 christos
249 1.1.1.3 christos ByteList
250 1.1.1.3 christos : {$$ = NULL;}
251 1.1.1.3 christos | ByteConstExpr
252 1.1.1.3 christos | ByteList ',' /* Allows a trailing comma at list end */
253 1.1.1.3 christos | ByteList ','
254 1.1.1.3 christos ByteConstExpr {$$ = TrLinkPeerNode ($1,$3);}
255 1.1 christos ;
256 1.1 christos
257 1.1.1.3 christos DWordList
258 1.1.1.3 christos : {$$ = NULL;}
259 1.1.1.3 christos | DWordConstExpr
260 1.1.1.3 christos | DWordList ',' /* Allows a trailing comma at list end */
261 1.1.1.3 christos | DWordList ','
262 1.1.1.3 christos DWordConstExpr {$$ = TrLinkPeerNode ($1,$3);}
263 1.1 christos ;
264 1.1 christos
265 1.1.1.3 christos FieldUnitList
266 1.1 christos : {$$ = NULL;}
267 1.1.1.3 christos | FieldUnit
268 1.1.1.3 christos | FieldUnitList ',' /* Allows a trailing comma at list end */
269 1.1.1.3 christos | FieldUnitList ','
270 1.1.1.3 christos FieldUnit {$$ = TrLinkPeerNode ($1,$3);}
271 1.1 christos ;
272 1.1 christos
273 1.1.1.3 christos FieldUnit
274 1.1.1.3 christos : FieldUnitEntry {}
275 1.1.1.3 christos | OffsetTerm {}
276 1.1.1.3 christos | AccessAsTerm {}
277 1.1.1.3 christos | ConnectionTerm {}
278 1.1.1.3 christos ;
279 1.1 christos
280 1.1.1.3 christos FieldUnitEntry
281 1.1.1.3 christos : ',' AmlPackageLengthTerm {$$ = TrCreateNode (PARSEOP_RESERVED_BYTES,1,$2);}
282 1.1.1.3 christos | NameSeg ','
283 1.1.1.3 christos AmlPackageLengthTerm {$$ = TrLinkChildNode ($1,$3);}
284 1.1.1.3 christos ;
285 1.1 christos
286 1.1.1.3 christos Object
287 1.1.1.3 christos : CompilerDirective {}
288 1.1.1.3 christos | NamedObject {}
289 1.1.1.3 christos | NameSpaceModifier {}
290 1.1.1.5 christos // | StructureTerm {}
291 1.1 christos ;
292 1.1 christos
293 1.1.1.3 christos PackageList
294 1.1.1.3 christos : {$$ = NULL;}
295 1.1.1.3 christos | PackageElement
296 1.1.1.3 christos | PackageList ',' /* Allows a trailing comma at list end */
297 1.1.1.3 christos | PackageList ','
298 1.1.1.3 christos PackageElement {$$ = TrLinkPeerNode ($1,$3);}
299 1.1 christos ;
300 1.1 christos
301 1.1.1.3 christos PackageElement
302 1.1.1.3 christos : DataObject {}
303 1.1.1.3 christos | NameString {}
304 1.1 christos ;
305 1.1 christos
306 1.1.1.3 christos /* Rules for specifying the type of one method argument or return value */
307 1.1 christos
308 1.1 christos ParameterTypePackage
309 1.1 christos : {$$ = NULL;}
310 1.1 christos | ObjectTypeKeyword {$$ = $1;}
311 1.1 christos | ParameterTypePackage ','
312 1.1 christos ObjectTypeKeyword {$$ = TrLinkPeerNodes (2,$1,$3);}
313 1.1 christos ;
314 1.1 christos
315 1.1 christos ParameterTypePackageList
316 1.1 christos : {$$ = NULL;}
317 1.1 christos | ObjectTypeKeyword {$$ = $1;}
318 1.1 christos | '{' ParameterTypePackage '}' {$$ = $2;}
319 1.1 christos ;
320 1.1 christos
321 1.1 christos OptionalParameterTypePackage
322 1.1 christos : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
323 1.1.1.5 christos | ',' ParameterTypePackageList {$$ = TrLinkChildren (
324 1.1.1.5 christos TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
325 1.1 christos ;
326 1.1 christos
327 1.1.1.3 christos /* Rules for specifying the types for method arguments */
328 1.1 christos
329 1.1 christos ParameterTypesPackage
330 1.1 christos : ParameterTypePackageList {$$ = $1;}
331 1.1 christos | ParameterTypesPackage ','
332 1.1 christos ParameterTypePackageList {$$ = TrLinkPeerNodes (2,$1,$3);}
333 1.1 christos ;
334 1.1 christos
335 1.1 christos ParameterTypesPackageList
336 1.1 christos : {$$ = NULL;}
337 1.1 christos | ObjectTypeKeyword {$$ = $1;}
338 1.1 christos | '{' ParameterTypesPackage '}' {$$ = $2;}
339 1.1 christos ;
340 1.1 christos
341 1.1 christos OptionalParameterTypesPackage
342 1.1 christos : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
343 1.1.1.5 christos | ',' ParameterTypesPackageList {$$ = TrLinkChildren (
344 1.1.1.5 christos TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
345 1.1 christos ;
346 1.1 christos
347 1.1 christos /*
348 1.1.1.3 christos * Case-Default list; allow only one Default term and unlimited Case terms
349 1.1 christos */
350 1.1.1.3 christos CaseDefaultTermList
351 1.1.1.3 christos : {$$ = NULL;}
352 1.1.1.6 christos | CaseTerm {}
353 1.1.1.6 christos | DefaultTerm {}
354 1.1.1.3 christos | CaseDefaultTermList
355 1.1.1.3 christos CaseTerm {$$ = TrLinkPeerNode ($1,$2);}
356 1.1.1.3 christos | CaseDefaultTermList
357 1.1.1.3 christos DefaultTerm {$$ = TrLinkPeerNode ($1,$2);}
358 1.1 christos
359 1.1.1.3 christos /* Original - attempts to force zero or one default term within the switch */
360 1.1.1.3 christos
361 1.1.1.3 christos /*
362 1.1.1.3 christos CaseDefaultTermList
363 1.1.1.3 christos : {$$ = NULL;}
364 1.1.1.3 christos | CaseTermList
365 1.1.1.3 christos DefaultTerm
366 1.1.1.3 christos CaseTermList {$$ = TrLinkPeerNode ($1,TrLinkPeerNode ($2, $3));}
367 1.1.1.3 christos | CaseTermList
368 1.1.1.3 christos CaseTerm {$$ = TrLinkPeerNode ($1,$2);}
369 1.1.1.3 christos ;
370 1.1.1.3 christos
371 1.1.1.3 christos CaseTermList
372 1.1.1.3 christos : {$$ = NULL;}
373 1.1.1.3 christos | CaseTerm {}
374 1.1.1.3 christos | CaseTermList
375 1.1.1.3 christos CaseTerm {$$ = TrLinkPeerNode ($1,$2);}
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 *
382 1.1.1.3 christos * ASL Data and Constant Terms
383 1.1.1.3 christos *
384 1.1.1.3 christos ******************************************************************************/
385 1.1.1.3 christos
386 1.1.1.3 christos DataObject
387 1.1.1.3 christos : BufferData {}
388 1.1.1.3 christos | PackageData {}
389 1.1.1.3 christos | IntegerData {}
390 1.1.1.3 christos | StringData {}
391 1.1.1.3 christos ;
392 1.1.1.3 christos
393 1.1.1.3 christos BufferData
394 1.1.1.3 christos : Type5Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
395 1.1.1.3 christos | Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
396 1.1.1.3 christos | Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
397 1.1.1.3 christos | BufferTerm {}
398 1.1.1.3 christos ;
399 1.1.1.3 christos
400 1.1.1.3 christos PackageData
401 1.1.1.3 christos : PackageTerm {}
402 1.1.1.3 christos ;
403 1.1.1.3 christos
404 1.1.1.3 christos IntegerData
405 1.1.1.3 christos : Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
406 1.1.1.3 christos | Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
407 1.1.1.3 christos | Integer {}
408 1.1.1.3 christos | ConstTerm {}
409 1.1.1.3 christos ;
410 1.1.1.3 christos
411 1.1.1.3 christos StringData
412 1.1.1.3 christos : Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
413 1.1.1.3 christos | String {}
414 1.1.1.3 christos ;
415 1.1.1.3 christos
416 1.1.1.3 christos ByteConst
417 1.1.1.3 christos : Integer {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
418 1.1.1.3 christos ;
419 1.1.1.3 christos
420 1.1.1.3 christos WordConst
421 1.1.1.3 christos : Integer {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
422 1.1.1.3 christos ;
423 1.1.1.3 christos
424 1.1.1.3 christos DWordConst
425 1.1.1.3 christos : Integer {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
426 1.1.1.3 christos ;
427 1.1.1.3 christos
428 1.1.1.3 christos QWordConst
429 1.1.1.3 christos : Integer {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
430 1.1.1.3 christos ;
431 1.1.1.3 christos
432 1.1.1.3 christos /*
433 1.1.1.3 christos * The NODE_COMPILE_TIME_CONST flag in the following constant expressions
434 1.1.1.3 christos * enables compile-time constant folding to reduce the Type3Opcodes/Type2IntegerOpcodes
435 1.1.1.3 christos * to simple integers. It is an error if these types of expressions cannot be
436 1.1.1.3 christos * reduced, since the AML grammar for ****ConstExpr requires a simple constant.
437 1.1.1.3 christos * Note: The required byte length of the constant is passed through to the
438 1.1.1.3 christos * constant folding code in the node AmlLength field.
439 1.1.1.3 christos */
440 1.1.1.3 christos ByteConstExpr
441 1.1.1.5 christos : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
442 1.1.1.5 christos TrSetNodeAmlLength ($1, 1);}
443 1.1.1.5 christos | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
444 1.1.1.5 christos TrSetNodeAmlLength ($1, 1);}
445 1.1.1.3 christos | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
446 1.1.1.3 christos | ByteConst {}
447 1.1.1.3 christos ;
448 1.1.1.3 christos
449 1.1.1.3 christos WordConstExpr
450 1.1.1.5 christos : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
451 1.1.1.5 christos TrSetNodeAmlLength ($1, 2);}
452 1.1.1.5 christos | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
453 1.1.1.5 christos TrSetNodeAmlLength ($1, 2);}
454 1.1.1.3 christos | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
455 1.1.1.3 christos | WordConst {}
456 1.1.1.3 christos ;
457 1.1.1.3 christos
458 1.1.1.3 christos DWordConstExpr
459 1.1.1.5 christos : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
460 1.1.1.5 christos TrSetNodeAmlLength ($1, 4);}
461 1.1.1.5 christos | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
462 1.1.1.5 christos TrSetNodeAmlLength ($1, 4);}
463 1.1.1.3 christos | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
464 1.1.1.3 christos | DWordConst {}
465 1.1.1.3 christos ;
466 1.1.1.3 christos
467 1.1.1.3 christos QWordConstExpr
468 1.1.1.5 christos : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
469 1.1.1.5 christos TrSetNodeAmlLength ($1, 8);}
470 1.1.1.5 christos | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
471 1.1.1.5 christos TrSetNodeAmlLength ($1, 8);}
472 1.1.1.3 christos | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
473 1.1.1.3 christos | QWordConst {}
474 1.1.1.3 christos ;
475 1.1.1.3 christos
476 1.1.1.3 christos ConstTerm
477 1.1.1.3 christos : ConstExprTerm {}
478 1.1.1.3 christos | PARSEOP_REVISION {$$ = TrCreateLeafNode (PARSEOP_REVISION);}
479 1.1.1.3 christos ;
480 1.1.1.3 christos
481 1.1.1.3 christos ConstExprTerm
482 1.1.1.3 christos : PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);}
483 1.1.1.3 christos | PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);}
484 1.1.1.3 christos | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);}
485 1.1.1.3 christos | PARSEOP___DATE__ {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);}
486 1.1.1.3 christos | PARSEOP___FILE__ {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);}
487 1.1.1.3 christos | PARSEOP___LINE__ {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);}
488 1.1.1.3 christos | PARSEOP___PATH__ {$$ = TrCreateConstantLeafNode (PARSEOP___PATH__);}
489 1.1.1.3 christos ;
490 1.1.1.3 christos
491 1.1.1.3 christos Integer
492 1.1.1.5 christos : PARSEOP_INTEGER {$$ = TrCreateValuedLeafNode (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.5 christos : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafNode (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.5 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.3 christos : Expression {$$ = TrSetNodeFlags ($1, NODE_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.5 christos // | StructureIndexTerm {}
647 1.1.1.5 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.2 christos : ConcatTerm {$$ = TrSetNodeFlags ($1, NODE_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.5 christos // | StructureIndexTerm {}
723 1.1.1.5 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.5 christos : Integer {$$ = TrUpdateNode (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 christos : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */
751 1.1 christos | ',' {$$ = TrCreateLeafNode (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.5 christos : {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO),
757 1.1.1.5 christos NODE_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.4 christos : {$$ = TrCreateLeafNode (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