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