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