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