aslrules.y revision 1.1.1.6 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.6 christos * Copyright (C) 2000 - 2017, 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.6 christos : PARSEOP_DEFINITION_BLOCK
85 1.1.1.6 christos PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITION_BLOCK);}
86 1.1 christos String ','
87 1.1 christos String ','
88 1.1 christos ByteConst ','
89 1.1 christos String ','
90 1.1 christos String ','
91 1.1 christos DWordConst
92 1.1.1.6 christos PARSEOP_CLOSE_PAREN {TrSetEndLineNumber ($<n>3);}
93 1.1.1.5 christos '{' TermList '}' {$$ = TrLinkChildren ($<n>3,7,
94 1.1.1.5 christos $4,$6,$8,$10,$12,$14,$18);}
95 1.1 christos ;
96 1.1 christos
97 1.1.1.3 christos DefinitionBlockList
98 1.1.1.3 christos : DefinitionBlockTerm
99 1.1.1.3 christos | DefinitionBlockTerm
100 1.1.1.3 christos DefinitionBlockList {$$ = TrLinkPeerNodes (2, $1,$2);}
101 1.1.1.2 christos ;
102 1.1.1.2 christos
103 1.1.1.6 christos
104 1.1.1.6 christos /******* Basic ASCII identifiers **************************************************/
105 1.1.1.6 christos
106 1.1.1.5 christos /* Allow IO, DMA, IRQ Resource macro and FOR macro names to also be used as identifiers */
107 1.1.1.5 christos
108 1.1.1.5 christos NameString
109 1.1.1.5 christos : NameSeg {}
110 1.1.1.5 christos | PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) $1);}
111 1.1.1.5 christos | PARSEOP_IO {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");}
112 1.1.1.5 christos | PARSEOP_DMA {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");}
113 1.1.1.5 christos | PARSEOP_IRQ {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");}
114 1.1.1.5 christos | PARSEOP_FOR {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "FOR");}
115 1.1.1.5 christos ;
116 1.1.1.5 christos /*
117 1.1.1.5 christos NameSeg
118 1.1.1.5 christos : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (ACPI_NATIVE_INT)
119 1.1.1.6 christos TrNormalizeNameSeg ($1));}
120 1.1.1.5 christos ;
121 1.1.1.5 christos */
122 1.1.1.5 christos
123 1.1.1.5 christos NameSeg
124 1.1.1.5 christos : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
125 1.1.1.6 christos (ACPI_NATIVE_INT) AslCompilerlval.s);}
126 1.1.1.5 christos ;
127 1.1.1.5 christos
128 1.1.1.5 christos
129 1.1.1.6 christos /******* Fundamental argument/statement types ***********************************/
130 1.1.1.6 christos
131 1.1.1.6 christos Term
132 1.1.1.6 christos : Object {}
133 1.1.1.6 christos | Type1Opcode {}
134 1.1.1.6 christos | Type2Opcode {}
135 1.1.1.6 christos | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
136 1.1.1.6 christos | Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
137 1.1.1.6 christos | Type2BufferOpcode {}
138 1.1.1.6 christos | Type2BufferOrStringOpcode {}
139 1.1.1.6 christos | error {$$ = AslDoError(); yyclearin;}
140 1.1.1.6 christos ;
141 1.1.1.6 christos
142 1.1.1.3 christos SuperName
143 1.1.1.6 christos : SimpleName {}
144 1.1.1.3 christos | DebugTerm {}
145 1.1.1.3 christos | Type6Opcode {}
146 1.1.1.5 christos ;
147 1.1.1.2 christos
148 1.1.1.3 christos Target
149 1.1.1.3 christos : {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */
150 1.1.1.3 christos | ',' {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */
151 1.1.1.3 christos | ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);}
152 1.1 christos ;
153 1.1 christos
154 1.1.1.6 christos RequiredTarget
155 1.1.1.6 christos : ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);}
156 1.1.1.6 christos ;
157 1.1.1.6 christos
158 1.1.1.3 christos TermArg
159 1.1.1.6 christos : SimpleName {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
160 1.1.1.6 christos | Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
161 1.1.1.3 christos | DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
162 1.1.1.6 christos /*
163 1.1.1.6 christos | PARSEOP_OPEN_PAREN
164 1.1.1.6 christos TermArg
165 1.1.1.6 christos PARSEOP_CLOSE_PAREN {}
166 1.1.1.6 christos */
167 1.1 christos ;
168 1.1 christos
169 1.1.1.3 christos /*
170 1.1.1.3 christos NOTE: Removed from TermArg due to reduce/reduce conflicts:
171 1.1.1.3 christos | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
172 1.1.1.3 christos | Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
173 1.1.1.3 christos | Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
174 1.1.1.3 christos | Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
175 1.1 christos
176 1.1.1.3 christos */
177 1.1 christos
178 1.1.1.3 christos MethodInvocationTerm
179 1.1.1.6 christos : NameString
180 1.1.1.6 christos PARSEOP_OPEN_PAREN {TrUpdateNode (PARSEOP_METHODCALL, $1);}
181 1.1.1.6 christos ArgList
182 1.1.1.6 christos PARSEOP_CLOSE_PAREN {$$ = TrLinkChildNode ($1,$4);}
183 1.1 christos ;
184 1.1 christos
185 1.1.1.3 christos /* OptionalCount must appear before ByteList or an incorrect reduction will result */
186 1.1 christos
187 1.1.1.3 christos OptionalCount
188 1.1.1.3 christos : {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */
189 1.1.1.3 christos | ',' {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */
190 1.1.1.3 christos | ',' TermArg {$$ = $2;}
191 1.1 christos ;
192 1.1 christos
193 1.1.1.5 christos /*
194 1.1.1.5 christos * Data count for buffers and packages (byte count for buffers,
195 1.1.1.5 christos * element count for packages).
196 1.1.1.5 christos */
197 1.1.1.5 christos OptionalDataCount
198 1.1.1.5 christos
199 1.1.1.5 christos /* Legacy ASL */
200 1.1.1.5 christos : {$$ = NULL;}
201 1.1.1.6 christos | PARSEOP_OPEN_PAREN
202 1.1.1.6 christos TermArg
203 1.1.1.6 christos PARSEOP_CLOSE_PAREN {$$ = $2;}
204 1.1.1.6 christos | PARSEOP_OPEN_PAREN
205 1.1.1.6 christos PARSEOP_CLOSE_PAREN {$$ = NULL;}
206 1.1.1.5 christos
207 1.1.1.5 christos /* C-style (ASL+) -- adds equals term */
208 1.1.1.5 christos
209 1.1.1.5 christos | PARSEOP_EXP_EQUALS {$$ = NULL;}
210 1.1.1.5 christos
211 1.1.1.6 christos | PARSEOP_OPEN_PAREN
212 1.1.1.6 christos TermArg
213 1.1.1.6 christos PARSEOP_CLOSE_PAREN
214 1.1.1.5 christos PARSEOP_EXP_EQUALS {$$ = $2;}
215 1.1.1.5 christos
216 1.1.1.6 christos | PARSEOP_OPEN_PAREN
217 1.1.1.6 christos PARSEOP_CLOSE_PAREN
218 1.1.1.6 christos String
219 1.1.1.5 christos PARSEOP_EXP_EQUALS {$$ = NULL;}
220 1.1 christos ;
221 1.1 christos
222 1.1 christos
223 1.1.1.3 christos /******* List Terms **************************************************/
224 1.1 christos
225 1.1.1.6 christos /* ACPI 3.0 -- allow semicolons between terms */
226 1.1.1.6 christos
227 1.1.1.6 christos TermList
228 1.1.1.6 christos : {$$ = NULL;}
229 1.1.1.6 christos | TermList Term {$$ = TrLinkPeerNode (
230 1.1.1.6 christos TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
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),$3);}
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 ;
238 1.1.1.6 christos
239 1.1.1.3 christos ArgList
240 1.1.1.3 christos : {$$ = NULL;}
241 1.1.1.3 christos | TermArg
242 1.1.1.3 christos | ArgList ',' /* Allows a trailing comma at list end */
243 1.1.1.3 christos | ArgList ','
244 1.1.1.3 christos TermArg {$$ = TrLinkPeerNode ($1,$3);}
245 1.1 christos ;
246 1.1 christos
247 1.1.1.3 christos ByteList
248 1.1.1.3 christos : {$$ = NULL;}
249 1.1.1.3 christos | ByteConstExpr
250 1.1.1.3 christos | ByteList ',' /* Allows a trailing comma at list end */
251 1.1.1.3 christos | ByteList ','
252 1.1.1.3 christos ByteConstExpr {$$ = TrLinkPeerNode ($1,$3);}
253 1.1 christos ;
254 1.1 christos
255 1.1.1.3 christos DWordList
256 1.1.1.3 christos : {$$ = NULL;}
257 1.1.1.3 christos | DWordConstExpr
258 1.1.1.3 christos | DWordList ',' /* Allows a trailing comma at list end */
259 1.1.1.3 christos | DWordList ','
260 1.1.1.3 christos DWordConstExpr {$$ = TrLinkPeerNode ($1,$3);}
261 1.1 christos ;
262 1.1 christos
263 1.1.1.3 christos FieldUnitList
264 1.1 christos : {$$ = NULL;}
265 1.1.1.3 christos | FieldUnit
266 1.1.1.3 christos | FieldUnitList ',' /* Allows a trailing comma at list end */
267 1.1.1.3 christos | FieldUnitList ','
268 1.1.1.3 christos FieldUnit {$$ = TrLinkPeerNode ($1,$3);}
269 1.1 christos ;
270 1.1 christos
271 1.1.1.3 christos FieldUnit
272 1.1.1.3 christos : FieldUnitEntry {}
273 1.1.1.3 christos | OffsetTerm {}
274 1.1.1.3 christos | AccessAsTerm {}
275 1.1.1.3 christos | ConnectionTerm {}
276 1.1.1.3 christos ;
277 1.1 christos
278 1.1.1.3 christos FieldUnitEntry
279 1.1.1.3 christos : ',' AmlPackageLengthTerm {$$ = TrCreateNode (PARSEOP_RESERVED_BYTES,1,$2);}
280 1.1.1.3 christos | NameSeg ','
281 1.1.1.3 christos AmlPackageLengthTerm {$$ = TrLinkChildNode ($1,$3);}
282 1.1.1.3 christos ;
283 1.1 christos
284 1.1.1.3 christos Object
285 1.1.1.3 christos : CompilerDirective {}
286 1.1.1.3 christos | NamedObject {}
287 1.1.1.3 christos | NameSpaceModifier {}
288 1.1.1.5 christos // | StructureTerm {}
289 1.1 christos ;
290 1.1 christos
291 1.1.1.3 christos PackageList
292 1.1.1.3 christos : {$$ = NULL;}
293 1.1.1.3 christos | PackageElement
294 1.1.1.3 christos | PackageList ',' /* Allows a trailing comma at list end */
295 1.1.1.3 christos | PackageList ','
296 1.1.1.3 christos PackageElement {$$ = TrLinkPeerNode ($1,$3);}
297 1.1 christos ;
298 1.1 christos
299 1.1.1.3 christos PackageElement
300 1.1.1.3 christos : DataObject {}
301 1.1.1.3 christos | NameString {}
302 1.1 christos ;
303 1.1 christos
304 1.1.1.3 christos /* Rules for specifying the type of one method argument or return value */
305 1.1 christos
306 1.1 christos ParameterTypePackage
307 1.1 christos : {$$ = NULL;}
308 1.1 christos | ObjectTypeKeyword {$$ = $1;}
309 1.1 christos | ParameterTypePackage ','
310 1.1 christos ObjectTypeKeyword {$$ = TrLinkPeerNodes (2,$1,$3);}
311 1.1 christos ;
312 1.1 christos
313 1.1 christos ParameterTypePackageList
314 1.1 christos : {$$ = NULL;}
315 1.1 christos | ObjectTypeKeyword {$$ = $1;}
316 1.1 christos | '{' ParameterTypePackage '}' {$$ = $2;}
317 1.1 christos ;
318 1.1 christos
319 1.1 christos OptionalParameterTypePackage
320 1.1 christos : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
321 1.1.1.5 christos | ',' ParameterTypePackageList {$$ = TrLinkChildren (
322 1.1.1.5 christos TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
323 1.1 christos ;
324 1.1 christos
325 1.1.1.3 christos /* Rules for specifying the types for method arguments */
326 1.1 christos
327 1.1 christos ParameterTypesPackage
328 1.1 christos : ParameterTypePackageList {$$ = $1;}
329 1.1 christos | ParameterTypesPackage ','
330 1.1 christos ParameterTypePackageList {$$ = TrLinkPeerNodes (2,$1,$3);}
331 1.1 christos ;
332 1.1 christos
333 1.1 christos ParameterTypesPackageList
334 1.1 christos : {$$ = NULL;}
335 1.1 christos | ObjectTypeKeyword {$$ = $1;}
336 1.1 christos | '{' ParameterTypesPackage '}' {$$ = $2;}
337 1.1 christos ;
338 1.1 christos
339 1.1 christos OptionalParameterTypesPackage
340 1.1 christos : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
341 1.1.1.5 christos | ',' ParameterTypesPackageList {$$ = TrLinkChildren (
342 1.1.1.5 christos TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
343 1.1 christos ;
344 1.1 christos
345 1.1 christos /*
346 1.1.1.3 christos * Case-Default list; allow only one Default term and unlimited Case terms
347 1.1 christos */
348 1.1.1.3 christos CaseDefaultTermList
349 1.1.1.3 christos : {$$ = NULL;}
350 1.1.1.6 christos | CaseTerm {}
351 1.1.1.6 christos | DefaultTerm {}
352 1.1.1.3 christos | CaseDefaultTermList
353 1.1.1.3 christos CaseTerm {$$ = TrLinkPeerNode ($1,$2);}
354 1.1.1.3 christos | CaseDefaultTermList
355 1.1.1.3 christos DefaultTerm {$$ = TrLinkPeerNode ($1,$2);}
356 1.1 christos
357 1.1.1.3 christos /* Original - attempts to force zero or one default term within the switch */
358 1.1.1.3 christos
359 1.1.1.3 christos /*
360 1.1.1.3 christos CaseDefaultTermList
361 1.1.1.3 christos : {$$ = NULL;}
362 1.1.1.3 christos | CaseTermList
363 1.1.1.3 christos DefaultTerm
364 1.1.1.3 christos CaseTermList {$$ = TrLinkPeerNode ($1,TrLinkPeerNode ($2, $3));}
365 1.1.1.3 christos | CaseTermList
366 1.1.1.3 christos CaseTerm {$$ = TrLinkPeerNode ($1,$2);}
367 1.1.1.3 christos ;
368 1.1.1.3 christos
369 1.1.1.3 christos CaseTermList
370 1.1.1.3 christos : {$$ = NULL;}
371 1.1.1.3 christos | CaseTerm {}
372 1.1.1.3 christos | CaseTermList
373 1.1.1.3 christos CaseTerm {$$ = TrLinkPeerNode ($1,$2);}
374 1.1.1.3 christos ;
375 1.1.1.3 christos */
376 1.1.1.3 christos
377 1.1.1.3 christos
378 1.1.1.3 christos /*******************************************************************************
379 1.1.1.3 christos *
380 1.1.1.3 christos * ASL Data and Constant Terms
381 1.1.1.3 christos *
382 1.1.1.3 christos ******************************************************************************/
383 1.1.1.3 christos
384 1.1.1.3 christos DataObject
385 1.1.1.3 christos : BufferData {}
386 1.1.1.3 christos | PackageData {}
387 1.1.1.3 christos | IntegerData {}
388 1.1.1.3 christos | StringData {}
389 1.1.1.3 christos ;
390 1.1.1.3 christos
391 1.1.1.3 christos BufferData
392 1.1.1.3 christos : Type5Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
393 1.1.1.3 christos | Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
394 1.1.1.3 christos | Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
395 1.1.1.3 christos | BufferTerm {}
396 1.1.1.3 christos ;
397 1.1.1.3 christos
398 1.1.1.3 christos PackageData
399 1.1.1.3 christos : PackageTerm {}
400 1.1.1.3 christos ;
401 1.1.1.3 christos
402 1.1.1.3 christos IntegerData
403 1.1.1.3 christos : Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
404 1.1.1.3 christos | Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
405 1.1.1.3 christos | Integer {}
406 1.1.1.3 christos | ConstTerm {}
407 1.1.1.3 christos ;
408 1.1.1.3 christos
409 1.1.1.3 christos StringData
410 1.1.1.3 christos : Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
411 1.1.1.3 christos | String {}
412 1.1.1.3 christos ;
413 1.1.1.3 christos
414 1.1.1.3 christos ByteConst
415 1.1.1.3 christos : Integer {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
416 1.1.1.3 christos ;
417 1.1.1.3 christos
418 1.1.1.3 christos WordConst
419 1.1.1.3 christos : Integer {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
420 1.1.1.3 christos ;
421 1.1.1.3 christos
422 1.1.1.3 christos DWordConst
423 1.1.1.3 christos : Integer {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
424 1.1.1.3 christos ;
425 1.1.1.3 christos
426 1.1.1.3 christos QWordConst
427 1.1.1.3 christos : Integer {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
428 1.1.1.3 christos ;
429 1.1.1.3 christos
430 1.1.1.3 christos /*
431 1.1.1.3 christos * The NODE_COMPILE_TIME_CONST flag in the following constant expressions
432 1.1.1.3 christos * enables compile-time constant folding to reduce the Type3Opcodes/Type2IntegerOpcodes
433 1.1.1.3 christos * to simple integers. It is an error if these types of expressions cannot be
434 1.1.1.3 christos * reduced, since the AML grammar for ****ConstExpr requires a simple constant.
435 1.1.1.3 christos * Note: The required byte length of the constant is passed through to the
436 1.1.1.3 christos * constant folding code in the node AmlLength field.
437 1.1.1.3 christos */
438 1.1.1.3 christos ByteConstExpr
439 1.1.1.5 christos : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
440 1.1.1.5 christos TrSetNodeAmlLength ($1, 1);}
441 1.1.1.5 christos | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
442 1.1.1.5 christos TrSetNodeAmlLength ($1, 1);}
443 1.1.1.3 christos | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
444 1.1.1.3 christos | ByteConst {}
445 1.1.1.3 christos ;
446 1.1.1.3 christos
447 1.1.1.3 christos WordConstExpr
448 1.1.1.5 christos : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
449 1.1.1.5 christos TrSetNodeAmlLength ($1, 2);}
450 1.1.1.5 christos | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
451 1.1.1.5 christos TrSetNodeAmlLength ($1, 2);}
452 1.1.1.3 christos | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
453 1.1.1.3 christos | WordConst {}
454 1.1.1.3 christos ;
455 1.1.1.3 christos
456 1.1.1.3 christos DWordConstExpr
457 1.1.1.5 christos : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
458 1.1.1.5 christos TrSetNodeAmlLength ($1, 4);}
459 1.1.1.5 christos | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
460 1.1.1.5 christos TrSetNodeAmlLength ($1, 4);}
461 1.1.1.3 christos | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
462 1.1.1.3 christos | DWordConst {}
463 1.1.1.3 christos ;
464 1.1.1.3 christos
465 1.1.1.3 christos QWordConstExpr
466 1.1.1.5 christos : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
467 1.1.1.5 christos TrSetNodeAmlLength ($1, 8);}
468 1.1.1.5 christos | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);
469 1.1.1.5 christos TrSetNodeAmlLength ($1, 8);}
470 1.1.1.3 christos | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
471 1.1.1.3 christos | QWordConst {}
472 1.1.1.3 christos ;
473 1.1.1.3 christos
474 1.1.1.3 christos ConstTerm
475 1.1.1.3 christos : ConstExprTerm {}
476 1.1.1.3 christos | PARSEOP_REVISION {$$ = TrCreateLeafNode (PARSEOP_REVISION);}
477 1.1.1.3 christos ;
478 1.1.1.3 christos
479 1.1.1.3 christos ConstExprTerm
480 1.1.1.3 christos : PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);}
481 1.1.1.3 christos | PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);}
482 1.1.1.3 christos | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);}
483 1.1.1.3 christos | PARSEOP___DATE__ {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);}
484 1.1.1.3 christos | PARSEOP___FILE__ {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);}
485 1.1.1.3 christos | PARSEOP___LINE__ {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);}
486 1.1.1.3 christos | PARSEOP___PATH__ {$$ = TrCreateConstantLeafNode (PARSEOP___PATH__);}
487 1.1.1.3 christos ;
488 1.1.1.3 christos
489 1.1.1.3 christos Integer
490 1.1.1.5 christos : PARSEOP_INTEGER {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER,
491 1.1.1.5 christos AslCompilerlval.i);}
492 1.1.1.3 christos ;
493 1.1.1.3 christos
494 1.1.1.3 christos String
495 1.1.1.5 christos : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL,
496 1.1.1.5 christos (ACPI_NATIVE_INT) AslCompilerlval.s);}
497 1.1.1.3 christos ;
498 1.1.1.3 christos
499 1.1.1.3 christos
500 1.1.1.3 christos /*******************************************************************************
501 1.1.1.3 christos *
502 1.1.1.3 christos * ASL Opcode Terms
503 1.1.1.3 christos *
504 1.1.1.3 christos ******************************************************************************/
505 1.1.1.3 christos
506 1.1.1.3 christos CompilerDirective
507 1.1.1.3 christos : IncludeTerm {}
508 1.1.1.3 christos | IncludeEndTerm {}
509 1.1.1.3 christos | ExternalTerm {}
510 1.1.1.3 christos ;
511 1.1.1.3 christos
512 1.1.1.3 christos NamedObject
513 1.1.1.3 christos : BankFieldTerm {}
514 1.1.1.3 christos | CreateBitFieldTerm {}
515 1.1.1.3 christos | CreateByteFieldTerm {}
516 1.1.1.3 christos | CreateDWordFieldTerm {}
517 1.1.1.3 christos | CreateFieldTerm {}
518 1.1.1.3 christos | CreateQWordFieldTerm {}
519 1.1.1.3 christos | CreateWordFieldTerm {}
520 1.1.1.3 christos | DataRegionTerm {}
521 1.1.1.3 christos | DeviceTerm {}
522 1.1.1.3 christos | EventTerm {}
523 1.1.1.3 christos | FieldTerm {}
524 1.1.1.3 christos | FunctionTerm {}
525 1.1.1.3 christos | IndexFieldTerm {}
526 1.1.1.3 christos | MethodTerm {}
527 1.1.1.3 christos | MutexTerm {}
528 1.1.1.3 christos | OpRegionTerm {}
529 1.1.1.3 christos | PowerResTerm {}
530 1.1.1.3 christos | ProcessorTerm {}
531 1.1.1.3 christos | ThermalZoneTerm {}
532 1.1.1.3 christos ;
533 1.1.1.3 christos
534 1.1.1.3 christos NameSpaceModifier
535 1.1.1.3 christos : AliasTerm {}
536 1.1.1.3 christos | NameTerm {}
537 1.1.1.5 christos // | NameTermAslPlus {}
538 1.1.1.3 christos | ScopeTerm {}
539 1.1.1.3 christos ;
540 1.1.1.3 christos
541 1.1.1.6 christos SimpleName
542 1.1.1.3 christos : NameString {}
543 1.1.1.3 christos | LocalTerm {}
544 1.1.1.6 christos | ArgTerm {}
545 1.1.1.6 christos ;
546 1.1.1.6 christos
547 1.1.1.6 christos /* For ObjectType(), SuperName except for MethodInvocationTerm */
548 1.1.1.6 christos
549 1.1.1.6 christos ObjectTypeSource
550 1.1.1.6 christos : SimpleName {}
551 1.1.1.3 christos | DebugTerm {}
552 1.1.1.3 christos | RefOfTerm {}
553 1.1.1.3 christos | DerefOfTerm {}
554 1.1.1.3 christos | IndexTerm {}
555 1.1.1.5 christos | IndexExpTerm {}
556 1.1.1.3 christos ;
557 1.1.1.3 christos
558 1.1.1.6 christos /* For DeRefOf(), SuperName except for DerefOf and Debug */
559 1.1.1.6 christos
560 1.1.1.6 christos DerefOfSource
561 1.1.1.6 christos : SimpleName {}
562 1.1.1.6 christos | RefOfTerm {}
563 1.1.1.6 christos | DerefOfTerm {}
564 1.1.1.6 christos | IndexTerm {}
565 1.1.1.6 christos | IndexExpTerm {}
566 1.1.1.6 christos | StoreTerm {}
567 1.1.1.6 christos | EqualsTerm {}
568 1.1.1.6 christos | MethodInvocationTerm {}
569 1.1.1.3 christos ;
570 1.1.1.3 christos
571 1.1.1.6 christos /* For RefOf(), SuperName except for RefOf and MethodInvocationTerm */
572 1.1.1.6 christos
573 1.1.1.6 christos RefOfSource
574 1.1.1.6 christos : SimpleName {}
575 1.1.1.6 christos | DebugTerm {}
576 1.1.1.6 christos | DerefOfTerm {}
577 1.1.1.6 christos | IndexTerm {}
578 1.1.1.6 christos | IndexExpTerm {}
579 1.1.1.3 christos ;
580 1.1.1.3 christos
581 1.1.1.6 christos /* For CondRefOf(), SuperName except for RefOf and MethodInvocationTerm */
582 1.1.1.6 christos
583 1.1.1.6 christos CondRefOfSource
584 1.1.1.6 christos : SimpleName {}
585 1.1.1.6 christos | DebugTerm {}
586 1.1.1.6 christos | DerefOfTerm {}
587 1.1.1.6 christos | IndexTerm {}
588 1.1.1.6 christos | IndexExpTerm {}
589 1.1.1.6 christos ;
590 1.1.1.3 christos
591 1.1.1.6 christos /*
592 1.1.1.6 christos * Opcode types, as defined in the ACPI specification
593 1.1.1.6 christos */
594 1.1.1.3 christos Type1Opcode
595 1.1.1.3 christos : BreakTerm {}
596 1.1.1.3 christos | BreakPointTerm {}
597 1.1.1.3 christos | ContinueTerm {}
598 1.1.1.3 christos | FatalTerm {}
599 1.1.1.4 christos | ForTerm {}
600 1.1.1.3 christos | ElseIfTerm {}
601 1.1.1.3 christos | LoadTerm {}
602 1.1.1.3 christos | NoOpTerm {}
603 1.1.1.3 christos | NotifyTerm {}
604 1.1.1.3 christos | ReleaseTerm {}
605 1.1.1.3 christos | ResetTerm {}
606 1.1.1.3 christos | ReturnTerm {}
607 1.1.1.3 christos | SignalTerm {}
608 1.1.1.3 christos | SleepTerm {}
609 1.1.1.3 christos | StallTerm {}
610 1.1.1.3 christos | SwitchTerm {}
611 1.1.1.3 christos | UnloadTerm {}
612 1.1.1.3 christos | WhileTerm {}
613 1.1.1.3 christos ;
614 1.1.1.3 christos
615 1.1.1.3 christos Type2Opcode
616 1.1.1.3 christos : AcquireTerm {}
617 1.1.1.3 christos | CondRefOfTerm {}
618 1.1.1.3 christos | CopyObjectTerm {}
619 1.1.1.3 christos | DerefOfTerm {}
620 1.1.1.3 christos | ObjectTypeTerm {}
621 1.1.1.3 christos | RefOfTerm {}
622 1.1.1.3 christos | SizeOfTerm {}
623 1.1.1.3 christos | StoreTerm {}
624 1.1.1.3 christos | EqualsTerm {}
625 1.1.1.3 christos | TimerTerm {}
626 1.1.1.3 christos | WaitTerm {}
627 1.1.1.3 christos | MethodInvocationTerm {}
628 1.1.1.3 christos ;
629 1.1.1.3 christos
630 1.1.1.3 christos /*
631 1.1.1.3 christos * Type 3/4/5 opcodes
632 1.1.1.3 christos */
633 1.1.1.3 christos Type2IntegerOpcode /* "Type3" opcodes */
634 1.1.1.3 christos : Expression {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
635 1.1.1.3 christos | AddTerm {}
636 1.1.1.3 christos | AndTerm {}
637 1.1 christos | DecTerm {}
638 1.1 christos | DivideTerm {}
639 1.1 christos | FindSetLeftBitTerm {}
640 1.1 christos | FindSetRightBitTerm {}
641 1.1 christos | FromBCDTerm {}
642 1.1 christos | IncTerm {}
643 1.1 christos | IndexTerm {}
644 1.1.1.5 christos // | StructureIndexTerm {}
645 1.1.1.5 christos // | StructurePointerTerm {}
646 1.1 christos | LAndTerm {}
647 1.1 christos | LEqualTerm {}
648 1.1 christos | LGreaterTerm {}
649 1.1 christos | LGreaterEqualTerm {}
650 1.1 christos | LLessTerm {}
651 1.1 christos | LLessEqualTerm {}
652 1.1 christos | LNotTerm {}
653 1.1 christos | LNotEqualTerm {}
654 1.1 christos | LoadTableTerm {}
655 1.1 christos | LOrTerm {}
656 1.1 christos | MatchTerm {}
657 1.1 christos | ModTerm {}
658 1.1 christos | MultiplyTerm {}
659 1.1 christos | NAndTerm {}
660 1.1 christos | NOrTerm {}
661 1.1 christos | NotTerm {}
662 1.1 christos | OrTerm {}
663 1.1 christos | ShiftLeftTerm {}
664 1.1 christos | ShiftRightTerm {}
665 1.1 christos | SubtractTerm {}
666 1.1 christos | ToBCDTerm {}
667 1.1 christos | ToIntegerTerm {}
668 1.1 christos | XOrTerm {}
669 1.1 christos ;
670 1.1 christos
671 1.1 christos Type2StringOpcode /* "Type4" Opcodes */
672 1.1 christos : ToDecimalStringTerm {}
673 1.1 christos | ToHexStringTerm {}
674 1.1 christos | ToStringTerm {}
675 1.1 christos ;
676 1.1 christos
677 1.1 christos Type2BufferOpcode /* "Type5" Opcodes */
678 1.1 christos : ToBufferTerm {}
679 1.1 christos | ConcatResTerm {}
680 1.1 christos ;
681 1.1 christos
682 1.1 christos Type2BufferOrStringOpcode
683 1.1.1.2 christos : ConcatTerm {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
684 1.1.1.2 christos | PrintfTerm {}
685 1.1.1.2 christos | FprintfTerm {}
686 1.1 christos | MidTerm {}
687 1.1 christos ;
688 1.1 christos
689 1.1 christos /*
690 1.1 christos * A type 3 opcode evaluates to an Integer and cannot have a destination operand
691 1.1 christos */
692 1.1 christos Type3Opcode
693 1.1 christos : EISAIDTerm {}
694 1.1 christos ;
695 1.1 christos
696 1.1 christos /* Obsolete
697 1.1 christos Type4Opcode
698 1.1 christos : ConcatTerm {}
699 1.1 christos | ToDecimalStringTerm {}
700 1.1 christos | ToHexStringTerm {}
701 1.1 christos | MidTerm {}
702 1.1 christos | ToStringTerm {}
703 1.1 christos ;
704 1.1 christos */
705 1.1 christos
706 1.1.1.5 christos /* Type 5 opcodes are a subset of Type2 opcodes, and return a constant */
707 1.1.1.5 christos
708 1.1 christos Type5Opcode
709 1.1 christos : ResourceTemplateTerm {}
710 1.1 christos | UnicodeTerm {}
711 1.1.1.2 christos | ToPLDTerm {}
712 1.1 christos | ToUUIDTerm {}
713 1.1 christos ;
714 1.1 christos
715 1.1 christos Type6Opcode
716 1.1 christos : RefOfTerm {}
717 1.1 christos | DerefOfTerm {}
718 1.1 christos | IndexTerm {}
719 1.1.1.3 christos | IndexExpTerm {}
720 1.1.1.5 christos // | StructureIndexTerm {}
721 1.1.1.5 christos // | StructurePointerTerm {}
722 1.1.1.2 christos | MethodInvocationTerm {}
723 1.1 christos ;
724 1.1 christos
725 1.1 christos
726 1.1.1.3 christos /*******************************************************************************
727 1.1.1.3 christos *
728 1.1.1.3 christos * ASL Helper Terms
729 1.1.1.3 christos *
730 1.1.1.3 christos ******************************************************************************/
731 1.1 christos
732 1.1 christos AmlPackageLengthTerm
733 1.1.1.5 christos : Integer {$$ = TrUpdateNode (PARSEOP_PACKAGE_LENGTH,
734 1.1.1.5 christos (ACPI_PARSE_OBJECT *) $1);}
735 1.1 christos ;
736 1.1 christos
737 1.1 christos NameStringItem
738 1.1 christos : ',' NameString {$$ = $2;}
739 1.1 christos | ',' error {$$ = AslDoError (); yyclearin;}
740 1.1 christos ;
741 1.1 christos
742 1.1 christos TermArgItem
743 1.1 christos : ',' TermArg {$$ = $2;}
744 1.1 christos | ',' error {$$ = AslDoError (); yyclearin;}
745 1.1 christos ;
746 1.1 christos
747 1.1 christos OptionalReference
748 1.1 christos : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */
749 1.1 christos | ',' {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */
750 1.1 christos | ',' TermArg {$$ = $2;}
751 1.1 christos ;
752 1.1 christos
753 1.1 christos OptionalReturnArg
754 1.1.1.5 christos : {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO),
755 1.1.1.5 christos NODE_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */
756 1.1 christos | TermArg {$$ = $1;}
757 1.1 christos ;
758 1.1 christos
759 1.1 christos OptionalSerializeRuleKeyword
760 1.1 christos : {$$ = NULL;}
761 1.1 christos | ',' {$$ = NULL;}
762 1.1 christos | ',' SerializeRuleKeyword {$$ = $2;}
763 1.1 christos ;
764 1.1 christos
765 1.1 christos OptionalTermArg
766 1.1.1.4 christos : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
767 1.1.1.4 christos | TermArg {$$ = $1;}
768 1.1.1.4 christos ;
769 1.1.1.4 christos
770 1.1 christos OptionalWordConst
771 1.1 christos : {$$ = NULL;}
772 1.1 christos | WordConst {$$ = $1;}
773 1.1 christos ;
774