1 %{
   2 /******************************************************************************
   3  *
   4  * Module Name: aslcompiler.y - Bison/Yacc input file (ASL grammar and actions)
   5  *
   6  *****************************************************************************/
   7 
   8 /*
   9  * Copyright (C) 2000 - 2014, Intel Corp.
  10  * All rights reserved.
  11  *
  12  * Redistribution and use in source and binary forms, with or without
  13  * modification, are permitted provided that the following conditions
  14  * are met:
  15  * 1. Redistributions of source code must retain the above copyright
  16  *    notice, this list of conditions, and the following disclaimer,
  17  *    without modification.
  18  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  19  *    substantially similar to the "NO WARRANTY" disclaimer below
  20  *    ("Disclaimer") and any redistribution must be conditioned upon
  21  *    including a substantially similar Disclaimer requirement for further
  22  *    binary redistribution.
  23  * 3. Neither the names of the above-listed copyright holders nor the names
  24  *    of any contributors may be used to endorse or promote products derived
  25  *    from this software without specific prior written permission.
  26  *
  27  * Alternatively, this software may be distributed under the terms of the
  28  * GNU General Public License ("GPL") version 2 as published by the Free
  29  * Software Foundation.
  30  *
  31  * NO WARRANTY
  32  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  33  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  34  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  35  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  36  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  40  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  41  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  42  * POSSIBILITY OF SUCH DAMAGES.
  43  */
  44 
  45 #include "aslcompiler.h"
  46 #include <stdio.h>
  47 #include <stdlib.h>
  48 #include <string.h>
  49 #include "acpi.h"
  50 #include "accommon.h"
  51 
  52 #define _COMPONENT          ACPI_COMPILER
  53         ACPI_MODULE_NAME    ("aslparse")
  54 
  55 /*
  56  * Global Notes:
  57  *
  58  * October 2005: The following list terms have been optimized (from the
  59  * original ASL grammar in the ACPI specification) to force the immediate
  60  * reduction of each list item so that the parse stack use doesn't increase on
  61  * each list element and possibly overflow on very large lists (>4000 items).
  62  * This dramatically reduces use of the parse stack overall.
  63  *
  64  *      ArgList, TermList, Objectlist, ByteList, DWordList, PackageList,
  65  *      ResourceMacroList, and FieldUnitList
  66  */
  67 
  68 void *                      AslLocalAllocate (unsigned int Size);
  69 
  70 /* Bison/yacc configuration */
  71 
  72 #define static
  73 #undef alloca
  74 #define alloca              AslLocalAllocate
  75 #define yytname             AslCompilername
  76 
  77 #define YYINITDEPTH         600             /* State stack depth */
  78 #define YYDEBUG             1               /* Enable debug output */
  79 #define YYERROR_VERBOSE     1               /* Verbose error messages */
  80 
  81 /* Define YYMALLOC/YYFREE to prevent redefinition errors  */
  82 
  83 #define YYMALLOC            malloc
  84 #define YYFREE              free
  85 
  86 /*
  87  * The windows version of bison defines this incorrectly as "32768" (Not negative).
  88  * We use a custom (edited binary) version of bison that defines YYFLAG as YYFBAD
  89  * instead (#define YYFBAD 32768), so we can define it correctly here.
  90  *
  91  * The problem is that if YYFLAG is positive, the extended syntax error messages
  92  * are disabled.
  93  */
  94 #define YYFLAG              -32768
  95 
  96 %}
  97 
  98 /*
  99  * Declare the type of values in the grammar
 100  */
 101 %union {
 102     UINT64              i;
 103     char                *s;
 104     ACPI_PARSE_OBJECT   *n;
 105 }
 106 
 107 /*! [Begin] no source code translation */
 108 
 109 /*
 110  * These shift/reduce conflicts are expected. There should be zero
 111  * reduce/reduce conflicts.
 112  */
 113 %expect 86
 114 
 115 /******************************************************************************
 116  *
 117  * Token types: These are returned by the lexer
 118  *
 119  * NOTE: This list MUST match the AslKeywordMapping table found
 120  *       in aslmap.c EXACTLY!  Double check any changes!
 121  *
 122  *****************************************************************************/
 123 
 124 %token <i> PARSEOP_ACCESSAS
 125 %token <i> PARSEOP_ACCESSATTRIB_BLOCK
 126 %token <i> PARSEOP_ACCESSATTRIB_BLOCK_CALL
 127 %token <i> PARSEOP_ACCESSATTRIB_BYTE
 128 %token <i> PARSEOP_ACCESSATTRIB_MULTIBYTE
 129 %token <i> PARSEOP_ACCESSATTRIB_QUICK
 130 %token <i> PARSEOP_ACCESSATTRIB_RAW_BYTES
 131 %token <i> PARSEOP_ACCESSATTRIB_RAW_PROCESS
 132 %token <i> PARSEOP_ACCESSATTRIB_SND_RCV
 133 %token <i> PARSEOP_ACCESSATTRIB_WORD
 134 %token <i> PARSEOP_ACCESSATTRIB_WORD_CALL
 135 %token <i> PARSEOP_ACCESSTYPE_ANY
 136 %token <i> PARSEOP_ACCESSTYPE_BUF
 137 %token <i> PARSEOP_ACCESSTYPE_BYTE
 138 %token <i> PARSEOP_ACCESSTYPE_DWORD
 139 %token <i> PARSEOP_ACCESSTYPE_QWORD
 140 %token <i> PARSEOP_ACCESSTYPE_WORD
 141 %token <i> PARSEOP_ACQUIRE
 142 %token <i> PARSEOP_ADD
 143 %token <i> PARSEOP_ADDRESSINGMODE_7BIT
 144 %token <i> PARSEOP_ADDRESSINGMODE_10BIT
 145 %token <i> PARSEOP_ADDRESSTYPE_ACPI
 146 %token <i> PARSEOP_ADDRESSTYPE_MEMORY
 147 %token <i> PARSEOP_ADDRESSTYPE_NVS
 148 %token <i> PARSEOP_ADDRESSTYPE_RESERVED
 149 %token <i> PARSEOP_ALIAS
 150 %token <i> PARSEOP_AND
 151 %token <i> PARSEOP_ARG0
 152 %token <i> PARSEOP_ARG1
 153 %token <i> PARSEOP_ARG2
 154 %token <i> PARSEOP_ARG3
 155 %token <i> PARSEOP_ARG4
 156 %token <i> PARSEOP_ARG5
 157 %token <i> PARSEOP_ARG6
 158 %token <i> PARSEOP_BANKFIELD
 159 %token <i> PARSEOP_BITSPERBYTE_EIGHT
 160 %token <i> PARSEOP_BITSPERBYTE_FIVE
 161 %token <i> PARSEOP_BITSPERBYTE_NINE
 162 %token <i> PARSEOP_BITSPERBYTE_SEVEN
 163 %token <i> PARSEOP_BITSPERBYTE_SIX
 164 %token <i> PARSEOP_BREAK
 165 %token <i> PARSEOP_BREAKPOINT
 166 %token <i> PARSEOP_BUFFER
 167 %token <i> PARSEOP_BUSMASTERTYPE_MASTER
 168 %token <i> PARSEOP_BUSMASTERTYPE_NOTMASTER
 169 %token <i> PARSEOP_BYTECONST
 170 %token <i> PARSEOP_CASE
 171 %token <i> PARSEOP_CLOCKPHASE_FIRST
 172 %token <i> PARSEOP_CLOCKPHASE_SECOND
 173 %token <i> PARSEOP_CLOCKPOLARITY_HIGH
 174 %token <i> PARSEOP_CLOCKPOLARITY_LOW
 175 %token <i> PARSEOP_CONCATENATE
 176 %token <i> PARSEOP_CONCATENATERESTEMPLATE
 177 %token <i> PARSEOP_CONDREFOF
 178 %token <i> PARSEOP_CONNECTION
 179 %token <i> PARSEOP_CONTINUE
 180 %token <i> PARSEOP_COPYOBJECT
 181 %token <i> PARSEOP_CREATEBITFIELD
 182 %token <i> PARSEOP_CREATEBYTEFIELD
 183 %token <i> PARSEOP_CREATEDWORDFIELD
 184 %token <i> PARSEOP_CREATEFIELD
 185 %token <i> PARSEOP_CREATEQWORDFIELD
 186 %token <i> PARSEOP_CREATEWORDFIELD
 187 %token <i> PARSEOP_DATABUFFER
 188 %token <i> PARSEOP_DATATABLEREGION
 189 %token <i> PARSEOP_DEBUG
 190 %token <i> PARSEOP_DECODETYPE_POS
 191 %token <i> PARSEOP_DECODETYPE_SUB
 192 %token <i> PARSEOP_DECREMENT
 193 %token <i> PARSEOP_DEFAULT
 194 %token <i> PARSEOP_DEFAULT_ARG
 195 %token <i> PARSEOP_DEFINITIONBLOCK
 196 %token <i> PARSEOP_DEREFOF
 197 %token <i> PARSEOP_DEVICE
 198 %token <i> PARSEOP_DEVICEPOLARITY_HIGH
 199 %token <i> PARSEOP_DEVICEPOLARITY_LOW
 200 %token <i> PARSEOP_DIVIDE
 201 %token <i> PARSEOP_DMA
 202 %token <i> PARSEOP_DMATYPE_A
 203 %token <i> PARSEOP_DMATYPE_COMPATIBILITY
 204 %token <i> PARSEOP_DMATYPE_B
 205 %token <i> PARSEOP_DMATYPE_F
 206 %token <i> PARSEOP_DWORDCONST
 207 %token <i> PARSEOP_DWORDIO
 208 %token <i> PARSEOP_DWORDMEMORY
 209 %token <i> PARSEOP_DWORDSPACE
 210 %token <i> PARSEOP_EISAID
 211 %token <i> PARSEOP_ELSE
 212 %token <i> PARSEOP_ELSEIF
 213 %token <i> PARSEOP_ENDDEPENDENTFN
 214 %token <i> PARSEOP_ENDIAN_BIG
 215 %token <i> PARSEOP_ENDIAN_LITTLE
 216 %token <i> PARSEOP_ENDTAG
 217 %token <i> PARSEOP_ERRORNODE
 218 %token <i> PARSEOP_EVENT
 219 %token <i> PARSEOP_EXTENDEDIO
 220 %token <i> PARSEOP_EXTENDEDMEMORY
 221 %token <i> PARSEOP_EXTENDEDSPACE
 222 %token <i> PARSEOP_EXTERNAL
 223 %token <i> PARSEOP_FATAL
 224 %token <i> PARSEOP_FIELD
 225 %token <i> PARSEOP_FINDSETLEFTBIT
 226 %token <i> PARSEOP_FINDSETRIGHTBIT
 227 %token <i> PARSEOP_FIXEDDMA
 228 %token <i> PARSEOP_FIXEDIO
 229 %token <i> PARSEOP_FLOWCONTROL_HW
 230 %token <i> PARSEOP_FLOWCONTROL_NONE
 231 %token <i> PARSEOP_FLOWCONTROL_SW
 232 %token <i> PARSEOP_FROMBCD
 233 %token <i> PARSEOP_FUNCTION
 234 %token <i> PARSEOP_GPIO_INT
 235 %token <i> PARSEOP_GPIO_IO
 236 %token <i> PARSEOP_I2C_SERIALBUS
 237 %token <i> PARSEOP_IF
 238 %token <i> PARSEOP_INCLUDE
 239 %token <i> PARSEOP_INCLUDE_END
 240 %token <i> PARSEOP_INCREMENT
 241 %token <i> PARSEOP_INDEX
 242 %token <i> PARSEOP_INDEXFIELD
 243 %token <i> PARSEOP_INTEGER
 244 %token <i> PARSEOP_INTERRUPT
 245 %token <i> PARSEOP_INTLEVEL_ACTIVEBOTH
 246 %token <i> PARSEOP_INTLEVEL_ACTIVEHIGH
 247 %token <i> PARSEOP_INTLEVEL_ACTIVELOW
 248 %token <i> PARSEOP_INTTYPE_EDGE
 249 %token <i> PARSEOP_INTTYPE_LEVEL
 250 %token <i> PARSEOP_IO
 251 %token <i> PARSEOP_IODECODETYPE_10
 252 %token <i> PARSEOP_IODECODETYPE_16
 253 %token <i> PARSEOP_IORESTRICT_IN
 254 %token <i> PARSEOP_IORESTRICT_NONE
 255 %token <i> PARSEOP_IORESTRICT_OUT
 256 %token <i> PARSEOP_IORESTRICT_PRESERVE
 257 %token <i> PARSEOP_IRQ
 258 %token <i> PARSEOP_IRQNOFLAGS
 259 %token <i> PARSEOP_LAND
 260 %token <i> PARSEOP_LEQUAL
 261 %token <i> PARSEOP_LGREATER
 262 %token <i> PARSEOP_LGREATEREQUAL
 263 %token <i> PARSEOP_LLESS
 264 %token <i> PARSEOP_LLESSEQUAL
 265 %token <i> PARSEOP_LNOT
 266 %token <i> PARSEOP_LNOTEQUAL
 267 %token <i> PARSEOP_LOAD
 268 %token <i> PARSEOP_LOADTABLE
 269 %token <i> PARSEOP_LOCAL0
 270 %token <i> PARSEOP_LOCAL1
 271 %token <i> PARSEOP_LOCAL2
 272 %token <i> PARSEOP_LOCAL3
 273 %token <i> PARSEOP_LOCAL4
 274 %token <i> PARSEOP_LOCAL5
 275 %token <i> PARSEOP_LOCAL6
 276 %token <i> PARSEOP_LOCAL7
 277 %token <i> PARSEOP_LOCKRULE_LOCK
 278 %token <i> PARSEOP_LOCKRULE_NOLOCK
 279 %token <i> PARSEOP_LOR
 280 %token <i> PARSEOP_MATCH
 281 %token <i> PARSEOP_MATCHTYPE_MEQ
 282 %token <i> PARSEOP_MATCHTYPE_MGE
 283 %token <i> PARSEOP_MATCHTYPE_MGT
 284 %token <i> PARSEOP_MATCHTYPE_MLE
 285 %token <i> PARSEOP_MATCHTYPE_MLT
 286 %token <i> PARSEOP_MATCHTYPE_MTR
 287 %token <i> PARSEOP_MAXTYPE_FIXED
 288 %token <i> PARSEOP_MAXTYPE_NOTFIXED
 289 %token <i> PARSEOP_MEMORY24
 290 %token <i> PARSEOP_MEMORY32
 291 %token <i> PARSEOP_MEMORY32FIXED
 292 %token <i> PARSEOP_MEMTYPE_CACHEABLE
 293 %token <i> PARSEOP_MEMTYPE_NONCACHEABLE
 294 %token <i> PARSEOP_MEMTYPE_PREFETCHABLE
 295 %token <i> PARSEOP_MEMTYPE_WRITECOMBINING
 296 %token <i> PARSEOP_METHOD
 297 %token <i> PARSEOP_METHODCALL
 298 %token <i> PARSEOP_MID
 299 %token <i> PARSEOP_MINTYPE_FIXED
 300 %token <i> PARSEOP_MINTYPE_NOTFIXED
 301 %token <i> PARSEOP_MOD
 302 %token <i> PARSEOP_MULTIPLY
 303 %token <i> PARSEOP_MUTEX
 304 %token <i> PARSEOP_NAME
 305 %token <s> PARSEOP_NAMESEG
 306 %token <s> PARSEOP_NAMESTRING
 307 %token <i> PARSEOP_NAND
 308 %token <i> PARSEOP_NOOP
 309 %token <i> PARSEOP_NOR
 310 %token <i> PARSEOP_NOT
 311 %token <i> PARSEOP_NOTIFY
 312 %token <i> PARSEOP_OBJECTTYPE
 313 %token <i> PARSEOP_OBJECTTYPE_BFF
 314 %token <i> PARSEOP_OBJECTTYPE_BUF
 315 %token <i> PARSEOP_OBJECTTYPE_DDB
 316 %token <i> PARSEOP_OBJECTTYPE_DEV
 317 %token <i> PARSEOP_OBJECTTYPE_EVT
 318 %token <i> PARSEOP_OBJECTTYPE_FLD
 319 %token <i> PARSEOP_OBJECTTYPE_INT
 320 %token <i> PARSEOP_OBJECTTYPE_MTH
 321 %token <i> PARSEOP_OBJECTTYPE_MTX
 322 %token <i> PARSEOP_OBJECTTYPE_OPR
 323 %token <i> PARSEOP_OBJECTTYPE_PKG
 324 %token <i> PARSEOP_OBJECTTYPE_POW
 325 %token <i> PARSEOP_OBJECTTYPE_PRO
 326 %token <i> PARSEOP_OBJECTTYPE_STR
 327 %token <i> PARSEOP_OBJECTTYPE_THZ
 328 %token <i> PARSEOP_OBJECTTYPE_UNK
 329 %token <i> PARSEOP_OFFSET
 330 %token <i> PARSEOP_ONE
 331 %token <i> PARSEOP_ONES
 332 %token <i> PARSEOP_OPERATIONREGION
 333 %token <i> PARSEOP_OR
 334 %token <i> PARSEOP_PACKAGE
 335 %token <i> PARSEOP_PACKAGE_LENGTH
 336 %token <i> PARSEOP_PARITYTYPE_EVEN
 337 %token <i> PARSEOP_PARITYTYPE_MARK
 338 %token <i> PARSEOP_PARITYTYPE_NONE
 339 %token <i> PARSEOP_PARITYTYPE_ODD
 340 %token <i> PARSEOP_PARITYTYPE_SPACE
 341 %token <i> PARSEOP_PIN_NOPULL
 342 %token <i> PARSEOP_PIN_PULLDEFAULT
 343 %token <i> PARSEOP_PIN_PULLDOWN
 344 %token <i> PARSEOP_PIN_PULLUP
 345 %token <i> PARSEOP_POWERRESOURCE
 346 %token <i> PARSEOP_PROCESSOR
 347 %token <i> PARSEOP_QWORDCONST
 348 %token <i> PARSEOP_QWORDIO
 349 %token <i> PARSEOP_QWORDMEMORY
 350 %token <i> PARSEOP_QWORDSPACE
 351 %token <i> PARSEOP_RANGETYPE_ENTIRE
 352 %token <i> PARSEOP_RANGETYPE_ISAONLY
 353 %token <i> PARSEOP_RANGETYPE_NONISAONLY
 354 %token <i> PARSEOP_RAW_DATA
 355 %token <i> PARSEOP_READWRITETYPE_BOTH
 356 %token <i> PARSEOP_READWRITETYPE_READONLY
 357 %token <i> PARSEOP_REFOF
 358 %token <i> PARSEOP_REGIONSPACE_CMOS
 359 %token <i> PARSEOP_REGIONSPACE_EC
 360 %token <i> PARSEOP_REGIONSPACE_FFIXEDHW
 361 %token <i> PARSEOP_REGIONSPACE_GPIO
 362 %token <i> PARSEOP_REGIONSPACE_GSBUS
 363 %token <i> PARSEOP_REGIONSPACE_IO
 364 %token <i> PARSEOP_REGIONSPACE_IPMI
 365 %token <i> PARSEOP_REGIONSPACE_MEM
 366 %token <i> PARSEOP_REGIONSPACE_PCC
 367 %token <i> PARSEOP_REGIONSPACE_PCI
 368 %token <i> PARSEOP_REGIONSPACE_PCIBAR
 369 %token <i> PARSEOP_REGIONSPACE_SMBUS
 370 %token <i> PARSEOP_REGISTER
 371 %token <i> PARSEOP_RELEASE
 372 %token <i> PARSEOP_RESERVED_BYTES
 373 %token <i> PARSEOP_RESET
 374 %token <i> PARSEOP_RESOURCETEMPLATE
 375 %token <i> PARSEOP_RESOURCETYPE_CONSUMER
 376 %token <i> PARSEOP_RESOURCETYPE_PRODUCER
 377 %token <i> PARSEOP_RETURN
 378 %token <i> PARSEOP_REVISION
 379 %token <i> PARSEOP_SCOPE
 380 %token <i> PARSEOP_SERIALIZERULE_NOTSERIAL
 381 %token <i> PARSEOP_SERIALIZERULE_SERIAL
 382 %token <i> PARSEOP_SHARETYPE_EXCLUSIVE
 383 %token <i> PARSEOP_SHARETYPE_EXCLUSIVEWAKE
 384 %token <i> PARSEOP_SHARETYPE_SHARED
 385 %token <i> PARSEOP_SHARETYPE_SHAREDWAKE
 386 %token <i> PARSEOP_SHIFTLEFT
 387 %token <i> PARSEOP_SHIFTRIGHT
 388 %token <i> PARSEOP_SIGNAL
 389 %token <i> PARSEOP_SIZEOF
 390 %token <i> PARSEOP_SLAVEMODE_CONTROLLERINIT
 391 %token <i> PARSEOP_SLAVEMODE_DEVICEINIT
 392 %token <i> PARSEOP_SLEEP
 393 %token <i> PARSEOP_SPI_SERIALBUS
 394 %token <i> PARSEOP_STALL
 395 %token <i> PARSEOP_STARTDEPENDENTFN
 396 %token <i> PARSEOP_STARTDEPENDENTFN_NOPRI
 397 %token <i> PARSEOP_STOPBITS_ONE
 398 %token <i> PARSEOP_STOPBITS_ONEPLUSHALF
 399 %token <i> PARSEOP_STOPBITS_TWO
 400 %token <i> PARSEOP_STOPBITS_ZERO
 401 %token <i> PARSEOP_STORE
 402 %token <s> PARSEOP_STRING_LITERAL
 403 %token <i> PARSEOP_SUBTRACT
 404 %token <i> PARSEOP_SWITCH
 405 %token <i> PARSEOP_THERMALZONE
 406 %token <i> PARSEOP_TIMER
 407 %token <i> PARSEOP_TOBCD
 408 %token <i> PARSEOP_TOBUFFER
 409 %token <i> PARSEOP_TODECIMALSTRING
 410 %token <i> PARSEOP_TOHEXSTRING
 411 %token <i> PARSEOP_TOINTEGER
 412 %token <i> PARSEOP_TOSTRING
 413 %token <i> PARSEOP_TOUUID
 414 %token <i> PARSEOP_TRANSLATIONTYPE_DENSE
 415 %token <i> PARSEOP_TRANSLATIONTYPE_SPARSE
 416 %token <i> PARSEOP_TYPE_STATIC
 417 %token <i> PARSEOP_TYPE_TRANSLATION
 418 %token <i> PARSEOP_UART_SERIALBUS
 419 %token <i> PARSEOP_UNICODE
 420 %token <i> PARSEOP_UNLOAD
 421 %token <i> PARSEOP_UPDATERULE_ONES
 422 %token <i> PARSEOP_UPDATERULE_PRESERVE
 423 %token <i> PARSEOP_UPDATERULE_ZEROS
 424 %token <i> PARSEOP_VAR_PACKAGE
 425 %token <i> PARSEOP_VENDORLONG
 426 %token <i> PARSEOP_VENDORSHORT
 427 %token <i> PARSEOP_WAIT
 428 %token <i> PARSEOP_WHILE
 429 %token <i> PARSEOP_WIREMODE_FOUR
 430 %token <i> PARSEOP_WIREMODE_THREE
 431 %token <i> PARSEOP_WORDBUSNUMBER
 432 %token <i> PARSEOP_WORDCONST
 433 %token <i> PARSEOP_WORDIO
 434 %token <i> PARSEOP_WORDSPACE
 435 %token <i> PARSEOP_XFERSIZE_8
 436 %token <i> PARSEOP_XFERSIZE_16
 437 %token <i> PARSEOP_XFERSIZE_32
 438 %token <i> PARSEOP_XFERSIZE_64
 439 %token <i> PARSEOP_XFERSIZE_128
 440 %token <i> PARSEOP_XFERSIZE_256
 441 %token <i> PARSEOP_XFERTYPE_8
 442 %token <i> PARSEOP_XFERTYPE_8_16
 443 %token <i> PARSEOP_XFERTYPE_16
 444 %token <i> PARSEOP_XOR
 445 %token <i> PARSEOP_ZERO
 446 
 447 /*
 448  * Special functions. These should probably stay at the end of this
 449  * table.
 450  */
 451 %token <i> PARSEOP___DATE__
 452 %token <i> PARSEOP___FILE__
 453 %token <i> PARSEOP___LINE__
 454 %token <i> PARSEOP___PATH__
 455 
 456 
 457 /******************************************************************************
 458  *
 459  * Production names
 460  *
 461  *****************************************************************************/
 462 
 463 %type <n> ArgList
 464 %type <n> ASLCode
 465 %type <n> BufferData
 466 %type <n> BufferTermData
 467 %type <n> CompilerDirective
 468 %type <n> DataObject
 469 %type <n> DefinitionBlockTerm
 470 %type <n> IntegerData
 471 %type <n> NamedObject
 472 %type <n> NameSpaceModifier
 473 %type <n> Object
 474 %type <n> ObjectList
 475 %type <n> PackageData
 476 %type <n> ParameterTypePackage
 477 %type <n> ParameterTypePackageList
 478 %type <n> ParameterTypesPackage
 479 %type <n> ParameterTypesPackageList
 480 %type <n> RequiredTarget
 481 %type <n> SimpleTarget
 482 %type <n> StringData
 483 %type <n> Target
 484 %type <n> Term
 485 %type <n> TermArg
 486 %type <n> TermList
 487 %type <n> UserTerm
 488 
 489 /* Type4Opcode is obsolete */
 490 
 491 %type <n> Type1Opcode
 492 %type <n> Type2BufferOpcode
 493 %type <n> Type2BufferOrStringOpcode
 494 %type <n> Type2IntegerOpcode
 495 %type <n> Type2Opcode
 496 %type <n> Type2StringOpcode
 497 %type <n> Type3Opcode
 498 %type <n> Type5Opcode
 499 %type <n> Type6Opcode
 500 
 501 %type <n> AccessAsTerm
 502 %type <n> ExternalTerm
 503 %type <n> FieldUnit
 504 %type <n> FieldUnitEntry
 505 %type <n> FieldUnitList
 506 %type <n> IncludeTerm
 507 %type <n> OffsetTerm
 508 %type <n> OptionalAccessAttribTerm
 509 
 510 /* Named Objects */
 511 
 512 %type <n> BankFieldTerm
 513 %type <n> CreateBitFieldTerm
 514 %type <n> CreateByteFieldTerm
 515 %type <n> CreateDWordFieldTerm
 516 %type <n> CreateFieldTerm
 517 %type <n> CreateQWordFieldTerm
 518 %type <n> CreateWordFieldTerm
 519 %type <n> DataRegionTerm
 520 %type <n> DeviceTerm
 521 %type <n> EventTerm
 522 %type <n> FieldTerm
 523 %type <n> FunctionTerm
 524 %type <n> IndexFieldTerm
 525 %type <n> MethodTerm
 526 %type <n> MutexTerm
 527 %type <n> OpRegionTerm
 528 %type <n> OpRegionSpaceIdTerm
 529 %type <n> PowerResTerm
 530 %type <n> ProcessorTerm
 531 %type <n> ThermalZoneTerm
 532 
 533 /* Namespace modifiers */
 534 
 535 %type <n> AliasTerm
 536 %type <n> NameTerm
 537 %type <n> ScopeTerm
 538 
 539 /* Type 1 opcodes */
 540 
 541 %type <n> BreakPointTerm
 542 %type <n> BreakTerm
 543 %type <n> CaseDefaultTermList
 544 %type <n> CaseTerm
 545 %type <n> ContinueTerm
 546 %type <n> DefaultTerm
 547 %type <n> ElseTerm
 548 %type <n> FatalTerm
 549 %type <n> IfElseTerm
 550 %type <n> IfTerm
 551 %type <n> LoadTerm
 552 %type <n> NoOpTerm
 553 %type <n> NotifyTerm
 554 %type <n> ReleaseTerm
 555 %type <n> ResetTerm
 556 %type <n> ReturnTerm
 557 %type <n> SignalTerm
 558 %type <n> SleepTerm
 559 %type <n> StallTerm
 560 %type <n> SwitchTerm
 561 %type <n> UnloadTerm
 562 %type <n> WhileTerm
 563 /* %type <n> CaseTermList */
 564 
 565 /* Type 2 opcodes */
 566 
 567 %type <n> AcquireTerm
 568 %type <n> AddTerm
 569 %type <n> AndTerm
 570 %type <n> ConcatResTerm
 571 %type <n> ConcatTerm
 572 %type <n> CondRefOfTerm
 573 %type <n> CopyObjectTerm
 574 %type <n> DecTerm
 575 %type <n> DerefOfTerm
 576 %type <n> DivideTerm
 577 %type <n> FindSetLeftBitTerm
 578 %type <n> FindSetRightBitTerm
 579 %type <n> FromBCDTerm
 580 %type <n> IncTerm
 581 %type <n> IndexTerm
 582 %type <n> LAndTerm
 583 %type <n> LEqualTerm
 584 %type <n> LGreaterEqualTerm
 585 %type <n> LGreaterTerm
 586 %type <n> LLessEqualTerm
 587 %type <n> LLessTerm
 588 %type <n> LNotEqualTerm
 589 %type <n> LNotTerm
 590 %type <n> LoadTableTerm
 591 %type <n> LOrTerm
 592 %type <n> MatchTerm
 593 %type <n> MidTerm
 594 %type <n> ModTerm
 595 %type <n> MultiplyTerm
 596 %type <n> NAndTerm
 597 %type <n> NOrTerm
 598 %type <n> NotTerm
 599 %type <n> ObjectTypeTerm
 600 %type <n> OrTerm
 601 %type <n> RefOfTerm
 602 %type <n> ShiftLeftTerm
 603 %type <n> ShiftRightTerm
 604 %type <n> SizeOfTerm
 605 %type <n> StoreTerm
 606 %type <n> SubtractTerm
 607 %type <n> TimerTerm
 608 %type <n> ToBCDTerm
 609 %type <n> ToBufferTerm
 610 %type <n> ToDecimalStringTerm
 611 %type <n> ToHexStringTerm
 612 %type <n> ToIntegerTerm
 613 %type <n> ToStringTerm
 614 %type <n> WaitTerm
 615 %type <n> XOrTerm
 616 
 617 /* Keywords */
 618 
 619 %type <n> AccessAttribKeyword
 620 %type <n> AccessTypeKeyword
 621 %type <n> AddressingModeKeyword
 622 %type <n> AddressKeyword
 623 %type <n> AddressSpaceKeyword
 624 %type <n> BitsPerByteKeyword
 625 %type <n> ClockPhaseKeyword
 626 %type <n> ClockPolarityKeyword
 627 %type <n> DecodeKeyword
 628 %type <n> DevicePolarityKeyword
 629 %type <n> DMATypeKeyword
 630 %type <n> EndianKeyword
 631 %type <n> FlowControlKeyword
 632 %type <n> InterruptLevel
 633 %type <n> InterruptTypeKeyword
 634 %type <n> IODecodeKeyword
 635 %type <n> IoRestrictionKeyword
 636 %type <n> LockRuleKeyword
 637 %type <n> MatchOpKeyword
 638 %type <n> MaxKeyword
 639 %type <n> MemTypeKeyword
 640 %type <n> MinKeyword
 641 %type <n> ObjectTypeKeyword
 642 %type <n> OptionalBusMasterKeyword
 643 %type <n> OptionalReadWriteKeyword
 644 %type <n> ParityTypeKeyword
 645 %type <n> PinConfigByte
 646 %type <n> PinConfigKeyword
 647 %type <n> RangeTypeKeyword
 648 %type <n> RegionSpaceKeyword
 649 %type <n> ResourceTypeKeyword
 650 %type <n> SerializeRuleKeyword
 651 %type <n> ShareTypeKeyword
 652 %type <n> SlaveModeKeyword
 653 %type <n> StopBitsKeyword
 654 %type <n> TranslationKeyword
 655 %type <n> TypeKeyword
 656 %type <n> UpdateRuleKeyword
 657 %type <n> WireModeKeyword
 658 %type <n> XferSizeKeyword
 659 %type <n> XferTypeKeyword
 660 
 661 /* Types */
 662 
 663 %type <n> SuperName
 664 %type <n> ObjectTypeName
 665 %type <n> ArgTerm
 666 %type <n> LocalTerm
 667 %type <n> DebugTerm
 668 
 669 %type <n> Integer
 670 %type <n> ByteConst
 671 %type <n> WordConst
 672 %type <n> DWordConst
 673 %type <n> QWordConst
 674 %type <n> String
 675 
 676 %type <n> ConstTerm
 677 %type <n> ConstExprTerm
 678 %type <n> ByteConstExpr
 679 %type <n> WordConstExpr
 680 %type <n> DWordConstExpr
 681 %type <n> QWordConstExpr
 682 
 683 %type <n> DWordList
 684 %type <n> BufferTerm
 685 %type <n> ByteList
 686 
 687 %type <n> PackageElement
 688 %type <n> PackageList
 689 %type <n> PackageTerm
 690 %type <n> VarPackageLengthTerm
 691 
 692 /* Macros */
 693 
 694 %type <n> EISAIDTerm
 695 %type <n> ResourceMacroList
 696 %type <n> ResourceMacroTerm
 697 %type <n> ResourceTemplateTerm
 698 %type <n> ToUUIDTerm
 699 %type <n> UnicodeTerm
 700 
 701 /* Resource Descriptors */
 702 
 703 %type <n> ConnectionTerm
 704 %type <n> DataBufferTerm
 705 %type <n> DMATerm
 706 %type <n> DWordIOTerm
 707 %type <n> DWordMemoryTerm
 708 %type <n> DWordSpaceTerm
 709 %type <n> EndDependentFnTerm
 710 %type <n> ExtendedIOTerm
 711 %type <n> ExtendedMemoryTerm
 712 %type <n> ExtendedSpaceTerm
 713 %type <n> FixedDmaTerm
 714 %type <n> FixedIOTerm
 715 %type <n> GpioIntTerm
 716 %type <n> GpioIoTerm
 717 %type <n> I2cSerialBusTerm
 718 %type <n> InterruptTerm
 719 %type <n> IOTerm
 720 %type <n> IRQNoFlagsTerm
 721 %type <n> IRQTerm
 722 %type <n> Memory24Term
 723 %type <n> Memory32FixedTerm
 724 %type <n> Memory32Term
 725 %type <n> NameSeg
 726 %type <n> NameString
 727 %type <n> QWordIOTerm
 728 %type <n> QWordMemoryTerm
 729 %type <n> QWordSpaceTerm
 730 %type <n> RegisterTerm
 731 %type <n> SpiSerialBusTerm
 732 %type <n> StartDependentFnNoPriTerm
 733 %type <n> StartDependentFnTerm
 734 %type <n> UartSerialBusTerm
 735 %type <n> VendorLongTerm
 736 %type <n> VendorShortTerm
 737 %type <n> WordBusNumberTerm
 738 %type <n> WordIOTerm
 739 %type <n> WordSpaceTerm
 740 
 741 /* Local types that help construct the AML, not in ACPI spec */
 742 
 743 %type <n> AmlPackageLengthTerm
 744 %type <n> IncludeEndTerm
 745 %type <n> NameStringItem
 746 %type <n> TermArgItem
 747 
 748 %type <n> OptionalAccessSize
 749 %type <n> OptionalAddressingMode
 750 %type <n> OptionalAddressRange
 751 %type <n> OptionalBitsPerByte
 752 %type <n> OptionalBuffer_Last
 753 %type <n> OptionalByteConstExpr
 754 %type <n> OptionalCount
 755 %type <n> OptionalDecodeType
 756 %type <n> OptionalDevicePolarity
 757 %type <n> OptionalDWordConstExpr
 758 %type <n> OptionalEndian
 759 %type <n> OptionalFlowControl
 760 %type <n> OptionalIoRestriction
 761 %type <n> OptionalListString
 762 %type <n> OptionalMaxType
 763 %type <n> OptionalMemType
 764 %type <n> OptionalMinType
 765 %type <n> OptionalNameString
 766 %type <n> OptionalNameString_First
 767 %type <n> OptionalNameString_Last
 768 %type <n> OptionalObjectTypeKeyword
 769 %type <n> OptionalParameterTypePackage
 770 %type <n> OptionalParameterTypesPackage
 771 %type <n> OptionalParityType
 772 %type <n> OptionalQWordConstExpr
 773 %type <n> OptionalRangeType
 774 %type <n> OptionalReference
 775 %type <n> OptionalResourceType
 776 %type <n> OptionalResourceType_First
 777 %type <n> OptionalReturnArg
 778 %type <n> OptionalSerializeRuleKeyword
 779 %type <n> OptionalShareType
 780 %type <n> OptionalShareType_First
 781 %type <n> OptionalSlaveMode
 782 %type <n> OptionalStopBits
 783 %type <n> OptionalStringData
 784 %type <n> OptionalTermArg
 785 %type <n> OptionalTranslationType_Last
 786 %type <n> OptionalType
 787 %type <n> OptionalType_Last
 788 %type <n> OptionalWireMode
 789 %type <n> OptionalWordConst
 790 %type <n> OptionalWordConstExpr
 791 %type <n> OptionalXferSize
 792 
 793 %%
 794 /*******************************************************************************
 795  *
 796  * Production rules start here
 797  *
 798  ******************************************************************************/
 799 
 800 /*
 801  * ASL Names
 802  */
 803 
 804 
 805 /*
 806  * Root rule. Allow multiple #line directives before the definition block
 807  * to handle output from preprocessors
 808  */
 809 ASLCode
 810     : DefinitionBlockTerm
 811     | error                         {YYABORT; $$ = NULL;}
 812     ;
 813 
 814 /*
 815  * Blocks, Data, and Opcodes
 816  */
 817 
 818 /*
 819  * Note concerning support for "module-level code".
 820  *
 821  * ACPI 1.0 allowed Type1 and Type2 executable opcodes outside of control
 822  * methods (the so-called module-level code.) This support was explicitly
 823  * removed in ACPI 2.0, but this type of code continues to be created by
 824  * BIOS vendors. In order to support the disassembly and recompilation of
 825  * such code (and the porting of ASL code to iASL), iASL supports this
 826  * code in violation of the current ACPI specification.
 827  *
 828  * The grammar change to support module-level code is to revert the
 829  * {ObjectList} portion of the DefinitionBlockTerm in ACPI 2.0 to the
 830  * original use of {TermList} instead (see below.) This allows the use
 831  * of Type1 and Type2 opcodes at module level.
 832  */
 833 DefinitionBlockTerm
 834     : PARSEOP_DEFINITIONBLOCK '('   {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);}
 835         String ','
 836         String ','
 837         ByteConst ','
 838         String ','
 839         String ','
 840         DWordConst
 841         ')'                         {TrSetEndLineNumber ($<n>3);}
 842             '{' TermList '}'        {$$ = TrLinkChildren ($<n>3,7,$4,$6,$8,$10,$12,$14,$18);}
 843     ;
 844 
 845 /* ACPI 3.0 -- allow semicolons between terms */
 846 
 847 TermList
 848     :                               {$$ = NULL;}
 849     | TermList Term                 {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
 850     | TermList Term ';'             {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
 851     | TermList ';' Term             {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);}
 852     | TermList ';' Term ';'         {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);}
 853     ;
 854 
 855 Term
 856     : Object                        {}
 857     | Type1Opcode                   {}
 858     | Type2Opcode                   {}
 859     | Type2IntegerOpcode            {}
 860     | Type2StringOpcode             {}
 861     | Type2BufferOpcode             {}
 862     | Type2BufferOrStringOpcode     {}
 863     | error                         {$$ = AslDoError(); yyclearin;}
 864     ;
 865 
 866 CompilerDirective
 867     : IncludeTerm                   {}
 868     | ExternalTerm                  {}
 869     ;
 870 
 871 ObjectList
 872     :                               {$$ = NULL;}
 873     | ObjectList Object             {$$ = TrLinkPeerNode ($1,$2);}
 874     | error                         {$$ = AslDoError(); yyclearin;}
 875     ;
 876 
 877 Object
 878     : CompilerDirective             {}
 879     | NamedObject                   {}
 880     | NameSpaceModifier             {}
 881     ;
 882 
 883 DataObject
 884     : BufferData                    {}
 885     | PackageData                   {}
 886     | IntegerData                   {}
 887     | StringData                    {}
 888     ;
 889 
 890 BufferData
 891     : Type5Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
 892     | Type2BufferOrStringOpcode     {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
 893     | Type2BufferOpcode             {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
 894     | BufferTerm                    {}
 895     ;
 896 
 897 PackageData
 898     : PackageTerm                   {}
 899     ;
 900 
 901 IntegerData
 902     : Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
 903     | Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
 904     | Integer                       {}
 905     | ConstTerm                     {}
 906     ;
 907 
 908 StringData
 909     : Type2StringOpcode             {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);}
 910     | String                        {}
 911     ;
 912 
 913 NamedObject
 914     : BankFieldTerm                 {}
 915     | CreateBitFieldTerm            {}
 916     | CreateByteFieldTerm           {}
 917     | CreateDWordFieldTerm          {}
 918     | CreateFieldTerm               {}
 919     | CreateQWordFieldTerm          {}
 920     | CreateWordFieldTerm           {}
 921     | DataRegionTerm                {}
 922     | DeviceTerm                    {}
 923     | EventTerm                     {}
 924     | FieldTerm                     {}
 925     | FunctionTerm                  {}
 926     | IndexFieldTerm                {}
 927     | MethodTerm                    {}
 928     | MutexTerm                     {}
 929     | OpRegionTerm                  {}
 930     | PowerResTerm                  {}
 931     | ProcessorTerm                 {}
 932     | ThermalZoneTerm               {}
 933     ;
 934 
 935 NameSpaceModifier
 936     : AliasTerm                     {}
 937     | NameTerm                      {}
 938     | ScopeTerm                     {}
 939     ;
 940 
 941 UserTerm
 942     : NameString '('                {TrUpdateNode (PARSEOP_METHODCALL, $1);}
 943         ArgList ')'                 {$$ = TrLinkChildNode ($1,$4);}
 944     ;
 945 
 946 ArgList
 947     :                               {$$ = NULL;}
 948     | TermArg
 949     | ArgList ','                   /* Allows a trailing comma at list end */
 950     | ArgList ','
 951         TermArg                     {$$ = TrLinkPeerNode ($1,$3);}
 952     ;
 953 
 954 /*
 955 Removed from TermArg due to reduce/reduce conflicts
 956     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
 957     | Type2StringOpcode             {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
 958     | Type2BufferOpcode             {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
 959     | Type2BufferOrStringOpcode     {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
 960 
 961 */
 962 
 963 TermArg
 964     : Type2Opcode                   {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
 965     | DataObject                    {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
 966     | NameString                    {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
 967     | ArgTerm                       {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
 968     | LocalTerm                     {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
 969     ;
 970 
 971 Target
 972     :                               {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_TARGET | NODE_COMPILE_TIME_CONST);} /* Placeholder is a ZeroOp object */
 973     | ','                           {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_TARGET | NODE_COMPILE_TIME_CONST);} /* Placeholder is a ZeroOp object */
 974     | ',' SuperName                 {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);}
 975     ;
 976 
 977 RequiredTarget
 978     : ',' SuperName                 {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);}
 979     ;
 980 
 981 SimpleTarget
 982     : NameString                    {}
 983     | LocalTerm                     {}
 984     | ArgTerm                       {}
 985     ;
 986 
 987 /* Rules for specifying the type of one method argument or return value */
 988 
 989 ParameterTypePackage
 990     :                               {$$ = NULL;}
 991     | ObjectTypeKeyword             {$$ = $1;}
 992     | ParameterTypePackage ','
 993         ObjectTypeKeyword           {$$ = TrLinkPeerNodes (2,$1,$3);}
 994     ;
 995 
 996 ParameterTypePackageList
 997     :                               {$$ = NULL;}
 998     | ObjectTypeKeyword             {$$ = $1;}
 999     | '{' ParameterTypePackage '}'  {$$ = $2;}
1000     ;
1001 
1002 OptionalParameterTypePackage
1003     :                               {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
1004     | ',' ParameterTypePackageList  {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
1005     ;
1006 
1007 /* Rules for specifying the types for method arguments */
1008 
1009 ParameterTypesPackage
1010     : ParameterTypePackageList      {$$ = $1;}
1011     | ParameterTypesPackage ','
1012         ParameterTypePackageList    {$$ = TrLinkPeerNodes (2,$1,$3);}
1013     ;
1014 
1015 ParameterTypesPackageList
1016     :                               {$$ = NULL;}
1017     | ObjectTypeKeyword             {$$ = $1;}
1018     | '{' ParameterTypesPackage '}' {$$ = $2;}
1019     ;
1020 
1021 OptionalParameterTypesPackage
1022     :                               {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
1023     | ',' ParameterTypesPackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
1024     ;
1025 
1026 
1027 /* Opcode types */
1028 
1029 Type1Opcode
1030     : BreakTerm                     {}
1031     | BreakPointTerm                {}
1032     | ContinueTerm                  {}
1033     | FatalTerm                     {}
1034     | IfElseTerm                    {}
1035     | LoadTerm                      {}
1036     | NoOpTerm                      {}
1037     | NotifyTerm                    {}
1038     | ReleaseTerm                   {}
1039     | ResetTerm                     {}
1040     | ReturnTerm                    {}
1041     | SignalTerm                    {}
1042     | SleepTerm                     {}
1043     | StallTerm                     {}
1044     | SwitchTerm                    {}
1045     | UnloadTerm                    {}
1046     | WhileTerm                     {}
1047     ;
1048 
1049 Type2Opcode
1050     : AcquireTerm                   {}
1051     | CondRefOfTerm                 {}
1052     | CopyObjectTerm                {}
1053     | DerefOfTerm                   {}
1054     | ObjectTypeTerm                {}
1055     | RefOfTerm                     {}
1056     | SizeOfTerm                    {}
1057     | StoreTerm                     {}
1058     | TimerTerm                     {}
1059     | WaitTerm                      {}
1060     | UserTerm                      {}
1061     ;
1062 
1063 /*
1064  * Type 3/4/5 opcodes
1065  */
1066 
1067 Type2IntegerOpcode                  /* "Type3" opcodes */
1068     : AddTerm                       {}
1069     | AndTerm                       {}
1070     | DecTerm                       {}
1071     | DivideTerm                    {}
1072     | FindSetLeftBitTerm            {}
1073     | FindSetRightBitTerm           {}
1074     | FromBCDTerm                   {}
1075     | IncTerm                       {}
1076     | IndexTerm                     {}
1077     | LAndTerm                      {}
1078     | LEqualTerm                    {}
1079     | LGreaterTerm                  {}
1080     | LGreaterEqualTerm             {}
1081     | LLessTerm                     {}
1082     | LLessEqualTerm                {}
1083     | LNotTerm                      {}
1084     | LNotEqualTerm                 {}
1085     | LoadTableTerm                 {}
1086     | LOrTerm                       {}
1087     | MatchTerm                     {}
1088     | ModTerm                       {}
1089     | MultiplyTerm                  {}
1090     | NAndTerm                      {}
1091     | NOrTerm                       {}
1092     | NotTerm                       {}
1093     | OrTerm                        {}
1094     | ShiftLeftTerm                 {}
1095     | ShiftRightTerm                {}
1096     | SubtractTerm                  {}
1097     | ToBCDTerm                     {}
1098     | ToIntegerTerm                 {}
1099     | XOrTerm                       {}
1100     ;
1101 
1102 Type2StringOpcode                   /* "Type4" Opcodes */
1103     : ToDecimalStringTerm           {}
1104     | ToHexStringTerm               {}
1105     | ToStringTerm                  {}
1106     ;
1107 
1108 Type2BufferOpcode                   /* "Type5" Opcodes */
1109     : ToBufferTerm                  {}
1110     | ConcatResTerm                 {}
1111     ;
1112 
1113 Type2BufferOrStringOpcode
1114     : ConcatTerm                    {}
1115     | MidTerm                       {}
1116     ;
1117 
1118 /*
1119  * A type 3 opcode evaluates to an Integer and cannot have a destination operand
1120  */
1121 
1122 Type3Opcode
1123     : EISAIDTerm                    {}
1124     ;
1125 
1126 /* Obsolete
1127 Type4Opcode
1128     : ConcatTerm                    {}
1129     | ToDecimalStringTerm           {}
1130     | ToHexStringTerm               {}
1131     | MidTerm                       {}
1132     | ToStringTerm                  {}
1133     ;
1134 */
1135 
1136 
1137 Type5Opcode
1138     : ResourceTemplateTerm          {}
1139     | UnicodeTerm                   {}
1140     | ToUUIDTerm                    {}
1141     ;
1142 
1143 Type6Opcode
1144     : RefOfTerm                     {}
1145     | DerefOfTerm                   {}
1146     | IndexTerm                     {}
1147     | UserTerm                      {}
1148     ;
1149 
1150 IncludeTerm
1151     : PARSEOP_INCLUDE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_INCLUDE);}
1152         String  ')'                 {TrLinkChildren ($<n>3,1,$4);FlOpenIncludeFile ($4);}
1153         TermList
1154         IncludeEndTerm              {$$ = TrLinkPeerNodes (3,$<n>3,$7,$8);}
1155     ;
1156 
1157 IncludeEndTerm
1158     : PARSEOP_INCLUDE_END           {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END);}
1159     ;
1160 
1161 ExternalTerm
1162     : PARSEOP_EXTERNAL '('
1163         NameString
1164         OptionalObjectTypeKeyword
1165         OptionalParameterTypePackage
1166         OptionalParameterTypesPackage
1167         ')'                         {$$ = TrCreateNode (PARSEOP_EXTERNAL,4,$3,$4,$5,$6);}
1168     | PARSEOP_EXTERNAL '('
1169         error ')'                   {$$ = AslDoError(); yyclearin;}
1170     ;
1171 
1172 
1173 /******* Named Objects *******************************************************/
1174 
1175 
1176 BankFieldTerm
1177     : PARSEOP_BANKFIELD '('         {$<n>$ = TrCreateLeafNode (PARSEOP_BANKFIELD);}
1178         NameString
1179         NameStringItem
1180         TermArgItem
1181         ',' AccessTypeKeyword
1182         ',' LockRuleKeyword
1183         ',' UpdateRuleKeyword
1184         ')' '{'
1185             FieldUnitList '}'       {$$ = TrLinkChildren ($<n>3,7,$4,$5,$6,$8,$10,$12,$15);}
1186     | PARSEOP_BANKFIELD '('
1187         error ')' '{' error '}'     {$$ = AslDoError(); yyclearin;}
1188     ;
1189 
1190 FieldUnitList
1191     :                               {$$ = NULL;}
1192     | FieldUnit
1193     | FieldUnitList ','             /* Allows a trailing comma at list end */
1194     | FieldUnitList ','
1195         FieldUnit                   {$$ = TrLinkPeerNode ($1,$3);}
1196     ;
1197 
1198 FieldUnit
1199     : FieldUnitEntry                {}
1200     | OffsetTerm                    {}
1201     | AccessAsTerm                  {}
1202     | ConnectionTerm                {}
1203     ;
1204 
1205 FieldUnitEntry
1206     : ',' AmlPackageLengthTerm      {$$ = TrCreateNode (PARSEOP_RESERVED_BYTES,1,$2);}
1207     | NameSeg ','
1208         AmlPackageLengthTerm        {$$ = TrLinkChildNode ($1,$3);}
1209     ;
1210 
1211 OffsetTerm
1212     : PARSEOP_OFFSET '('
1213         AmlPackageLengthTerm
1214         ')'                         {$$ = TrCreateNode (PARSEOP_OFFSET,1,$3);}
1215     | PARSEOP_OFFSET '('
1216         error ')'                   {$$ = AslDoError(); yyclearin;}
1217     ;
1218 
1219 AccessAsTerm
1220     : PARSEOP_ACCESSAS '('
1221         AccessTypeKeyword
1222         OptionalAccessAttribTerm
1223         ')'                         {$$ = TrCreateNode (PARSEOP_ACCESSAS,2,$3,$4);}
1224     | PARSEOP_ACCESSAS '('
1225         error ')'                   {$$ = AslDoError(); yyclearin;}
1226     ;
1227 
1228 ConnectionTerm
1229     : PARSEOP_CONNECTION '('
1230         NameString
1231         ')'                         {$$ = TrCreateNode (PARSEOP_CONNECTION,1,$3);}
1232     | PARSEOP_CONNECTION '('        {$<n>$ = TrCreateLeafNode (PARSEOP_CONNECTION);}
1233         ResourceMacroTerm
1234         ')'                         {$$ = TrLinkChildren ($<n>3, 1,
1235                                             TrLinkChildren (TrCreateLeafNode (PARSEOP_RESOURCETEMPLATE), 3,
1236                                                 TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
1237                                                 TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
1238                                                 $4));}
1239     | PARSEOP_CONNECTION '('
1240         error ')'                   {$$ = AslDoError(); yyclearin;}
1241     ;
1242 
1243 CreateBitFieldTerm
1244     : PARSEOP_CREATEBITFIELD '('    {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);}
1245         TermArg
1246         TermArgItem
1247         NameStringItem
1248         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
1249     | PARSEOP_CREATEBITFIELD '('
1250         error ')'                   {$$ = AslDoError(); yyclearin;}
1251     ;
1252 
1253 CreateByteFieldTerm
1254     : PARSEOP_CREATEBYTEFIELD '('   {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);}
1255         TermArg
1256         TermArgItem
1257         NameStringItem
1258         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
1259     | PARSEOP_CREATEBYTEFIELD '('
1260         error ')'                   {$$ = AslDoError(); yyclearin;}
1261     ;
1262 
1263 CreateDWordFieldTerm
1264     : PARSEOP_CREATEDWORDFIELD '('  {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);}
1265         TermArg
1266         TermArgItem
1267         NameStringItem
1268         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
1269     | PARSEOP_CREATEDWORDFIELD '('
1270         error ')'                   {$$ = AslDoError(); yyclearin;}
1271     ;
1272 
1273 CreateFieldTerm
1274     : PARSEOP_CREATEFIELD '('       {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);}
1275         TermArg
1276         TermArgItem
1277         TermArgItem
1278         NameStringItem
1279         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,TrSetNodeFlags ($7, NODE_IS_NAME_DECLARATION));}
1280     | PARSEOP_CREATEFIELD '('
1281         error ')'                   {$$ = AslDoError(); yyclearin;}
1282     ;
1283 
1284 CreateQWordFieldTerm
1285     : PARSEOP_CREATEQWORDFIELD '('  {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);}
1286         TermArg
1287         TermArgItem
1288         NameStringItem
1289         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
1290     | PARSEOP_CREATEQWORDFIELD '('
1291         error ')'                   {$$ = AslDoError(); yyclearin;}
1292     ;
1293 
1294 CreateWordFieldTerm
1295     : PARSEOP_CREATEWORDFIELD '('   {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);}
1296         TermArg
1297         TermArgItem
1298         NameStringItem
1299         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,TrSetNodeFlags ($6, NODE_IS_NAME_DECLARATION));}
1300     | PARSEOP_CREATEWORDFIELD '('
1301         error ')'                   {$$ = AslDoError(); yyclearin;}
1302     ;
1303 
1304 DataRegionTerm
1305     : PARSEOP_DATATABLEREGION '('   {$<n>$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);}
1306         NameString
1307         TermArgItem
1308         TermArgItem
1309         TermArgItem
1310         ')'                         {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$6,$7);}
1311     | PARSEOP_DATATABLEREGION '('
1312         error ')'                   {$$ = AslDoError(); yyclearin;}
1313     ;
1314 
1315 DeviceTerm
1316     : PARSEOP_DEVICE '('            {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);}
1317         NameString
1318         ')' '{'
1319             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
1320     | PARSEOP_DEVICE '('
1321         error ')'                   {$$ = AslDoError(); yyclearin;}
1322     ;
1323 
1324 EventTerm
1325     : PARSEOP_EVENT '('             {$<n>$ = TrCreateLeafNode (PARSEOP_EVENT);}
1326         NameString
1327         ')'                         {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));}
1328     | PARSEOP_EVENT '('
1329         error ')'                   {$$ = AslDoError(); yyclearin;}
1330     ;
1331 
1332 FieldTerm
1333     : PARSEOP_FIELD '('             {$<n>$ = TrCreateLeafNode (PARSEOP_FIELD);}
1334         NameString
1335         ',' AccessTypeKeyword
1336         ',' LockRuleKeyword
1337         ',' UpdateRuleKeyword
1338         ')' '{'
1339             FieldUnitList '}'       {$$ = TrLinkChildren ($<n>3,5,$4,$6,$8,$10,$13);}
1340     | PARSEOP_FIELD '('
1341         error ')' '{' error '}'     {$$ = AslDoError(); yyclearin;}
1342     ;
1343 
1344 FunctionTerm
1345     : PARSEOP_FUNCTION '('          {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
1346         NameString
1347         OptionalParameterTypePackage
1348         OptionalParameterTypesPackage
1349         ')' '{'
1350             TermList '}'            {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),
1351                                         TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),
1352                                         TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL),
1353                                         TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),$5,$6,$9);}
1354     | PARSEOP_FUNCTION '('
1355         error ')'                   {$$ = AslDoError(); yyclearin;}
1356     ;
1357 
1358 IndexFieldTerm
1359     : PARSEOP_INDEXFIELD '('        {$<n>$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);}
1360         NameString
1361         NameStringItem
1362         ',' AccessTypeKeyword
1363         ',' LockRuleKeyword
1364         ',' UpdateRuleKeyword
1365         ')' '{'
1366             FieldUnitList '}'       {$$ = TrLinkChildren ($<n>3,6,$4,$5,$7,$9,$11,$14);}
1367     | PARSEOP_INDEXFIELD '('
1368         error ')' '{' error '}'     {$$ = AslDoError(); yyclearin;}
1369     ;
1370 
1371 MethodTerm
1372     : PARSEOP_METHOD  '('           {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);}
1373         NameString
1374         OptionalByteConstExpr       {UtCheckIntegerRange ($5, 0, 7);}
1375         OptionalSerializeRuleKeyword
1376         OptionalByteConstExpr
1377         OptionalParameterTypePackage
1378         OptionalParameterTypesPackage
1379         ')' '{'
1380             TermList '}'            {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$7,$8,$9,$10,$13);}
1381     | PARSEOP_METHOD '('
1382         error ')'                   {$$ = AslDoError(); yyclearin;}
1383     ;
1384 
1385 MutexTerm
1386     : PARSEOP_MUTEX '('             {$<n>$ = TrCreateLeafNode (PARSEOP_MUTEX);}
1387         NameString
1388         ',' ByteConstExpr
1389         ')'                         {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);}
1390     | PARSEOP_MUTEX '('
1391         error ')'                   {$$ = AslDoError(); yyclearin;}
1392     ;
1393 
1394 OpRegionTerm
1395     : PARSEOP_OPERATIONREGION '('   {$<n>$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);}
1396         NameString
1397         ',' OpRegionSpaceIdTerm
1398         TermArgItem
1399         TermArgItem
1400         ')'                         {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8);}
1401     | PARSEOP_OPERATIONREGION '('
1402         error ')'                   {$$ = AslDoError(); yyclearin;}
1403     ;
1404 
1405 OpRegionSpaceIdTerm
1406     : RegionSpaceKeyword            {}
1407     | ByteConst                     {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);}
1408     ;
1409 
1410 PowerResTerm
1411     : PARSEOP_POWERRESOURCE '('     {$<n>$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);}
1412         NameString
1413         ',' ByteConstExpr
1414         ',' WordConstExpr
1415         ')' '{'
1416             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$8,$11);}
1417     | PARSEOP_POWERRESOURCE '('
1418         error ')'                   {$$ = AslDoError(); yyclearin;}
1419     ;
1420 
1421 ProcessorTerm
1422     : PARSEOP_PROCESSOR '('         {$<n>$ = TrCreateLeafNode (PARSEOP_PROCESSOR);}
1423         NameString
1424         ',' ByteConstExpr
1425         OptionalDWordConstExpr
1426         OptionalByteConstExpr
1427         ')' '{'
1428             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,5,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8,$11);}
1429     | PARSEOP_PROCESSOR '('
1430         error ')'                   {$$ = AslDoError(); yyclearin;}
1431     ;
1432 
1433 ThermalZoneTerm
1434     : PARSEOP_THERMALZONE '('       {$<n>$ = TrCreateLeafNode (PARSEOP_THERMALZONE);}
1435         NameString
1436         ')' '{'
1437             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
1438     | PARSEOP_THERMALZONE '('
1439         error ')'                   {$$ = AslDoError(); yyclearin;}
1440     ;
1441 
1442 
1443 /******* Namespace modifiers *************************************************/
1444 
1445 
1446 AliasTerm
1447     : PARSEOP_ALIAS '('             {$<n>$ = TrCreateLeafNode (PARSEOP_ALIAS);}
1448         NameString
1449         NameStringItem
1450         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));}
1451     | PARSEOP_ALIAS '('
1452         error ')'                   {$$ = AslDoError(); yyclearin;}
1453     ;
1454 
1455 NameTerm
1456     : PARSEOP_NAME '('              {$<n>$ = TrCreateLeafNode (PARSEOP_NAME);}
1457         NameString
1458         ',' DataObject
1459         ')'                         {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);}
1460     | PARSEOP_NAME '('
1461         error ')'                   {$$ = AslDoError(); yyclearin;}
1462     ;
1463 
1464 ScopeTerm
1465     : PARSEOP_SCOPE '('             {$<n>$ = TrCreateLeafNode (PARSEOP_SCOPE);}
1466         NameString
1467         ')' '{'
1468             ObjectList '}'          {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);}
1469     | PARSEOP_SCOPE '('
1470         error ')'                   {$$ = AslDoError(); yyclearin;}
1471     ;
1472 
1473 
1474 /******* Type 1 opcodes *******************************************************/
1475 
1476 
1477 BreakTerm
1478     : PARSEOP_BREAK                 {$$ = TrCreateNode (PARSEOP_BREAK, 0);}
1479     ;
1480 
1481 BreakPointTerm
1482     : PARSEOP_BREAKPOINT            {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);}
1483     ;
1484 
1485 ContinueTerm
1486     : PARSEOP_CONTINUE              {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);}
1487     ;
1488 
1489 FatalTerm
1490     : PARSEOP_FATAL '('             {$<n>$ = TrCreateLeafNode (PARSEOP_FATAL);}
1491         ByteConstExpr
1492         ',' DWordConstExpr
1493         TermArgItem
1494         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);}
1495     | PARSEOP_FATAL '('
1496         error ')'                   {$$ = AslDoError(); yyclearin;}
1497     ;
1498 
1499 IfElseTerm
1500     : IfTerm ElseTerm               {$$ = TrLinkPeerNode ($1,$2);}
1501     ;
1502 
1503 IfTerm
1504     : PARSEOP_IF '('                {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
1505         TermArg
1506         ')' '{'
1507             TermList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
1508 
1509     | PARSEOP_IF '('
1510         error ')'                   {$$ = AslDoError(); yyclearin;}
1511     ;
1512 
1513 ElseTerm
1514     :                               {$$ = NULL;}
1515     | PARSEOP_ELSE '{'              {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
1516         TermList '}'                {$$ = TrLinkChildren ($<n>3,1,$4);}
1517 
1518     | PARSEOP_ELSE '{'
1519         error '}'                   {$$ = AslDoError(); yyclearin;}
1520 
1521     | PARSEOP_ELSE
1522         error                       {$$ = AslDoError(); yyclearin;}
1523 
1524     | PARSEOP_ELSEIF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);}
1525         TermArg                     {$<n>$ = TrCreateLeafNode (PARSEOP_IF);}
1526         ')' '{'
1527             TermList '}'            {TrLinkChildren ($<n>5,2,$4,$8);}
1528         ElseTerm                    {TrLinkPeerNode ($<n>5,$11);}
1529                                     {$$ = TrLinkChildren ($<n>3,1,$<n>5);}
1530 
1531     | PARSEOP_ELSEIF '('
1532         error ')'                   {$$ = AslDoError(); yyclearin;}
1533 
1534     | PARSEOP_ELSEIF
1535         error                       {$$ = AslDoError(); yyclearin;}
1536     ;
1537 
1538 LoadTerm
1539     : PARSEOP_LOAD '('              {$<n>$ = TrCreateLeafNode (PARSEOP_LOAD);}
1540         NameString
1541         RequiredTarget
1542         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1543     | PARSEOP_LOAD '('
1544         error ')'                   {$$ = AslDoError(); yyclearin;}
1545     ;
1546 
1547 NoOpTerm
1548     : PARSEOP_NOOP                  {$$ = TrCreateNode (PARSEOP_NOOP, 0);}
1549     ;
1550 
1551 NotifyTerm
1552     : PARSEOP_NOTIFY '('            {$<n>$ = TrCreateLeafNode (PARSEOP_NOTIFY);}
1553         SuperName
1554         TermArgItem
1555         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1556     | PARSEOP_NOTIFY '('
1557         error ')'                   {$$ = AslDoError(); yyclearin;}
1558     ;
1559 
1560 ReleaseTerm
1561     : PARSEOP_RELEASE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_RELEASE);}
1562         SuperName
1563         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1564     | PARSEOP_RELEASE '('
1565         error ')'                   {$$ = AslDoError(); yyclearin;}
1566     ;
1567 
1568 ResetTerm
1569     : PARSEOP_RESET '('             {$<n>$ = TrCreateLeafNode (PARSEOP_RESET);}
1570         SuperName
1571         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1572     | PARSEOP_RESET '('
1573         error ')'                   {$$ = AslDoError(); yyclearin;}
1574     ;
1575 
1576 ReturnTerm
1577     : PARSEOP_RETURN '('            {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);}
1578         OptionalReturnArg
1579         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1580     | PARSEOP_RETURN                {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));}
1581     | PARSEOP_RETURN '('
1582         error ')'                   {$$ = AslDoError(); yyclearin;}
1583     ;
1584 
1585 SignalTerm
1586     : PARSEOP_SIGNAL '('            {$<n>$ = TrCreateLeafNode (PARSEOP_SIGNAL);}
1587         SuperName
1588         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1589     | PARSEOP_SIGNAL '('
1590         error ')'                   {$$ = AslDoError(); yyclearin;}
1591     ;
1592 
1593 SleepTerm
1594     : PARSEOP_SLEEP '('             {$<n>$ = TrCreateLeafNode (PARSEOP_SLEEP);}
1595         TermArg
1596         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1597     | PARSEOP_SLEEP '('
1598         error ')'                   {$$ = AslDoError(); yyclearin;}
1599     ;
1600 
1601 StallTerm
1602     : PARSEOP_STALL '('             {$<n>$ = TrCreateLeafNode (PARSEOP_STALL);}
1603         TermArg
1604         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1605     | PARSEOP_STALL '('
1606         error ')'                   {$$ = AslDoError(); yyclearin;}
1607     ;
1608 
1609 SwitchTerm
1610     : PARSEOP_SWITCH '('            {$<n>$ = TrCreateLeafNode (PARSEOP_SWITCH);}
1611         TermArg
1612         ')' '{'
1613             CaseDefaultTermList '}'
1614                                     {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
1615     | PARSEOP_SWITCH '('
1616         error ')'                   {$$ = AslDoError(); yyclearin;}
1617     ;
1618 
1619 /*
1620  * Case-Default list; allow only one Default term and unlimited Case terms
1621  */
1622 
1623 CaseDefaultTermList
1624     :                               {$$ = NULL;}
1625     | CaseTerm  {}
1626     | DefaultTerm   {}
1627     | CaseDefaultTermList
1628         CaseTerm                    {$$ = TrLinkPeerNode ($1,$2);}
1629     | CaseDefaultTermList
1630         DefaultTerm                 {$$ = TrLinkPeerNode ($1,$2);}
1631 
1632 /* Original - attempts to force zero or one default term within the switch */
1633 
1634 /*
1635 CaseDefaultTermList
1636     :                               {$$ = NULL;}
1637     | CaseTermList
1638         DefaultTerm
1639         CaseTermList                {$$ = TrLinkPeerNode ($1,TrLinkPeerNode ($2, $3));}
1640     | CaseTermList
1641         CaseTerm                    {$$ = TrLinkPeerNode ($1,$2);}
1642     ;
1643 
1644 CaseTermList
1645     :                               {$$ = NULL;}
1646     | CaseTerm                      {}
1647     | CaseTermList
1648         CaseTerm                    {$$ = TrLinkPeerNode ($1,$2);}
1649     ;
1650 */
1651 
1652 CaseTerm
1653     : PARSEOP_CASE '('              {$<n>$ = TrCreateLeafNode (PARSEOP_CASE);}
1654         DataObject
1655         ')' '{'
1656             TermList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
1657     | PARSEOP_CASE '('
1658         error ')'                   {$$ = AslDoError(); yyclearin;}
1659     ;
1660 
1661 DefaultTerm
1662     : PARSEOP_DEFAULT '{'           {$<n>$ = TrCreateLeafNode (PARSEOP_DEFAULT);}
1663         TermList '}'                {$$ = TrLinkChildren ($<n>3,1,$4);}
1664     | PARSEOP_DEFAULT '{'
1665         error '}'                   {$$ = AslDoError(); yyclearin;}
1666     ;
1667 
1668 UnloadTerm
1669     : PARSEOP_UNLOAD '('            {$<n>$ = TrCreateLeafNode (PARSEOP_UNLOAD);}
1670         SuperName
1671         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1672     | PARSEOP_UNLOAD '('
1673         error ')'                   {$$ = AslDoError(); yyclearin;}
1674     ;
1675 
1676 WhileTerm
1677     : PARSEOP_WHILE '('             {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);}
1678         TermArg
1679         ')' '{' TermList '}'
1680                                     {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
1681     | PARSEOP_WHILE '('
1682         error ')'                   {$$ = AslDoError(); yyclearin;}
1683     ;
1684 
1685 
1686 /******* Type 2 opcodes *******************************************************/
1687 
1688 AcquireTerm
1689     : PARSEOP_ACQUIRE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_ACQUIRE);}
1690         SuperName
1691         ',' WordConstExpr
1692         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$6);}
1693     | PARSEOP_ACQUIRE '('
1694         error ')'                   {$$ = AslDoError(); yyclearin;}
1695     ;
1696 
1697 AddTerm
1698     : PARSEOP_ADD '('               {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
1699         TermArg
1700         TermArgItem
1701         Target
1702         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1703     | PARSEOP_ADD '('
1704         error ')'                   {$$ = AslDoError(); yyclearin;}
1705     ;
1706 
1707 AndTerm
1708     : PARSEOP_AND '('               {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
1709         TermArg
1710         TermArgItem
1711         Target
1712         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1713     | PARSEOP_AND '('
1714         error ')'                   {$$ = AslDoError(); yyclearin;}
1715     ;
1716 
1717 ConcatTerm
1718     : PARSEOP_CONCATENATE '('       {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATE);}
1719         TermArg
1720         TermArgItem
1721         Target
1722         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1723     | PARSEOP_CONCATENATE '('
1724         error ')'                   {$$ = AslDoError(); yyclearin;}
1725     ;
1726 
1727 ConcatResTerm
1728     : PARSEOP_CONCATENATERESTEMPLATE '('    {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATERESTEMPLATE);}
1729         TermArg
1730         TermArgItem
1731         Target
1732         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1733     | PARSEOP_CONCATENATERESTEMPLATE '('
1734         error ')'                   {$$ = AslDoError(); yyclearin;}
1735     ;
1736 
1737 CondRefOfTerm
1738     : PARSEOP_CONDREFOF '('         {$<n>$ = TrCreateLeafNode (PARSEOP_CONDREFOF);}
1739         SuperName
1740         Target
1741         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1742     | PARSEOP_CONDREFOF '('
1743         error ')'                   {$$ = AslDoError(); yyclearin;}
1744     ;
1745 
1746 CopyObjectTerm
1747     : PARSEOP_COPYOBJECT '('        {$<n>$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);}
1748         TermArg
1749         ',' SimpleTarget
1750         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));}
1751     | PARSEOP_COPYOBJECT '('
1752         error ')'                   {$$ = AslDoError(); yyclearin;}
1753     ;
1754 
1755 DecTerm
1756     : PARSEOP_DECREMENT '('         {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);}
1757         SuperName
1758         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1759     | PARSEOP_DECREMENT '('
1760         error ')'                   {$$ = AslDoError(); yyclearin;}
1761     ;
1762 
1763 DerefOfTerm
1764     : PARSEOP_DEREFOF '('           {$<n>$ = TrCreateLeafNode (PARSEOP_DEREFOF);}
1765         TermArg
1766         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1767     | PARSEOP_DEREFOF '('
1768         error ')'                   {$$ = AslDoError(); yyclearin;}
1769     ;
1770 
1771 DivideTerm
1772     : PARSEOP_DIVIDE '('            {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
1773         TermArg
1774         TermArgItem
1775         Target
1776         Target
1777         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);}
1778     | PARSEOP_DIVIDE '('
1779         error ')'                   {$$ = AslDoError(); yyclearin;}
1780     ;
1781 
1782 FindSetLeftBitTerm
1783     : PARSEOP_FINDSETLEFTBIT '('    {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);}
1784         TermArg
1785         Target
1786         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1787     | PARSEOP_FINDSETLEFTBIT '('
1788         error ')'                   {$$ = AslDoError(); yyclearin;}
1789     ;
1790 
1791 FindSetRightBitTerm
1792     : PARSEOP_FINDSETRIGHTBIT '('   {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);}
1793         TermArg
1794         Target
1795         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1796     | PARSEOP_FINDSETRIGHTBIT '('
1797         error ')'                   {$$ = AslDoError(); yyclearin;}
1798     ;
1799 
1800 FromBCDTerm
1801     : PARSEOP_FROMBCD '('           {$<n>$ = TrCreateLeafNode (PARSEOP_FROMBCD);}
1802         TermArg
1803         Target
1804         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1805     | PARSEOP_FROMBCD '('
1806         error ')'                   {$$ = AslDoError(); yyclearin;}
1807     ;
1808 
1809 IncTerm
1810     : PARSEOP_INCREMENT '('         {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);}
1811         SuperName
1812         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1813     | PARSEOP_INCREMENT '('
1814         error ')'                   {$$ = AslDoError(); yyclearin;}
1815     ;
1816 
1817 IndexTerm
1818     : PARSEOP_INDEX '('             {$<n>$ = TrCreateLeafNode (PARSEOP_INDEX);}
1819         TermArg
1820         TermArgItem
1821         Target
1822         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1823     | PARSEOP_INDEX '('
1824         error ')'                   {$$ = AslDoError(); yyclearin;}
1825     ;
1826 
1827 LAndTerm
1828     : PARSEOP_LAND '('              {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);}
1829         TermArg
1830         TermArgItem
1831         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1832     | PARSEOP_LAND '('
1833         error ')'                   {$$ = AslDoError(); yyclearin;}
1834     ;
1835 
1836 LEqualTerm
1837     : PARSEOP_LEQUAL '('            {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
1838         TermArg
1839         TermArgItem
1840         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1841     | PARSEOP_LEQUAL '('
1842         error ')'                   {$$ = AslDoError(); yyclearin;}
1843     ;
1844 
1845 LGreaterTerm
1846     : PARSEOP_LGREATER '('          {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
1847         TermArg
1848         TermArgItem
1849         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1850     | PARSEOP_LGREATER '('
1851         error ')'                   {$$ = AslDoError(); yyclearin;}
1852     ;
1853 
1854 LGreaterEqualTerm
1855     : PARSEOP_LGREATEREQUAL '('     {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
1856         TermArg
1857         TermArgItem
1858         ')'                         {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
1859     | PARSEOP_LGREATEREQUAL '('
1860         error ')'                   {$$ = AslDoError(); yyclearin;}
1861     ;
1862 
1863 LLessTerm
1864     : PARSEOP_LLESS '('             {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
1865         TermArg
1866         TermArgItem
1867         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1868     | PARSEOP_LLESS '('
1869         error ')'                   {$$ = AslDoError(); yyclearin;}
1870     ;
1871 
1872 LLessEqualTerm
1873     : PARSEOP_LLESSEQUAL '('        {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
1874         TermArg
1875         TermArgItem
1876         ')'                         {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
1877     | PARSEOP_LLESSEQUAL '('
1878         error ')'                   {$$ = AslDoError(); yyclearin;}
1879     ;
1880 
1881 LNotTerm
1882     : PARSEOP_LNOT '('              {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);}
1883         TermArg
1884         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1885     | PARSEOP_LNOT '('
1886         error ')'                   {$$ = AslDoError(); yyclearin;}
1887     ;
1888 
1889 LNotEqualTerm
1890     : PARSEOP_LNOTEQUAL '('         {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
1891         TermArg
1892         TermArgItem
1893         ')'                         {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));}
1894     | PARSEOP_LNOTEQUAL '('
1895         error ')'                   {$$ = AslDoError(); yyclearin;}
1896     ;
1897 
1898 LoadTableTerm
1899     : PARSEOP_LOADTABLE '('         {$<n>$ = TrCreateLeafNode (PARSEOP_LOADTABLE);}
1900         TermArg
1901         TermArgItem
1902         TermArgItem
1903         OptionalListString
1904         OptionalListString
1905         OptionalReference
1906         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$5,$6,$7,$8,$9);}
1907     | PARSEOP_LOADTABLE '('
1908         error ')'                   {$$ = AslDoError(); yyclearin;}
1909     ;
1910 
1911 LOrTerm
1912     : PARSEOP_LOR '('               {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);}
1913         TermArg
1914         TermArgItem
1915         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1916     | PARSEOP_LOR '('
1917         error ')'                   {$$ = AslDoError(); yyclearin;}
1918     ;
1919 
1920 MatchTerm
1921     : PARSEOP_MATCH '('             {$<n>$ = TrCreateLeafNode (PARSEOP_MATCH);}
1922         TermArg
1923         ',' MatchOpKeyword
1924         TermArgItem
1925         ',' MatchOpKeyword
1926         TermArgItem
1927         TermArgItem
1928         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$6,$7,$9,$10,$11);}
1929     | PARSEOP_MATCH '('
1930         error ')'                   {$$ = AslDoError(); yyclearin;}
1931     ;
1932 
1933 MidTerm
1934     : PARSEOP_MID '('               {$<n>$ = TrCreateLeafNode (PARSEOP_MID);}
1935         TermArg
1936         TermArgItem
1937         TermArgItem
1938         Target
1939         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);}
1940     | PARSEOP_MID '('
1941         error ')'                   {$$ = AslDoError(); yyclearin;}
1942     ;
1943 
1944 ModTerm
1945     : PARSEOP_MOD '('               {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
1946         TermArg
1947         TermArgItem
1948         Target
1949         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1950     | PARSEOP_MOD '('
1951         error ')'                   {$$ = AslDoError(); yyclearin;}
1952     ;
1953 
1954 MultiplyTerm
1955     : PARSEOP_MULTIPLY '('          {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
1956         TermArg
1957         TermArgItem
1958         Target
1959         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1960     | PARSEOP_MULTIPLY '('
1961         error ')'                   {$$ = AslDoError(); yyclearin;}
1962     ;
1963 
1964 NAndTerm
1965     : PARSEOP_NAND '('              {$<n>$ = TrCreateLeafNode (PARSEOP_NAND);}
1966         TermArg
1967         TermArgItem
1968         Target
1969         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1970     | PARSEOP_NAND '('
1971         error ')'                   {$$ = AslDoError(); yyclearin;}
1972     ;
1973 
1974 NOrTerm
1975     : PARSEOP_NOR '('               {$<n>$ = TrCreateLeafNode (PARSEOP_NOR);}
1976         TermArg
1977         TermArgItem
1978         Target
1979         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
1980     | PARSEOP_NOR '('
1981         error ')'                   {$$ = AslDoError(); yyclearin;}
1982     ;
1983 
1984 NotTerm
1985     : PARSEOP_NOT '('               {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);}
1986         TermArg
1987         Target
1988         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
1989     | PARSEOP_NOT '('
1990         error ')'                   {$$ = AslDoError(); yyclearin;}
1991     ;
1992 
1993 ObjectTypeTerm
1994     : PARSEOP_OBJECTTYPE '('        {$<n>$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);}
1995         ObjectTypeName
1996         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
1997     | PARSEOP_OBJECTTYPE '('
1998         error ')'                   {$$ = AslDoError(); yyclearin;}
1999     ;
2000 
2001 OrTerm
2002     : PARSEOP_OR '('                {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
2003         TermArg
2004         TermArgItem
2005         Target
2006         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
2007     | PARSEOP_OR '('
2008         error ')'                   {$$ = AslDoError(); yyclearin;}
2009     ;
2010 
2011 /*
2012  * In RefOf, the node isn't really a target, but we can't keep track of it after
2013  * we've taken a pointer to it. (hard to tell if a local becomes initialized this way.)
2014  */
2015 RefOfTerm
2016     : PARSEOP_REFOF '('             {$<n>$ = TrCreateLeafNode (PARSEOP_REFOF);}
2017         SuperName
2018         ')'                         {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_TARGET));}
2019     | PARSEOP_REFOF '('
2020         error ')'                   {$$ = AslDoError(); yyclearin;}
2021     ;
2022 
2023 ShiftLeftTerm
2024     : PARSEOP_SHIFTLEFT '('         {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
2025         TermArg
2026         TermArgItem
2027         Target
2028         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
2029     | PARSEOP_SHIFTLEFT '('
2030         error ')'                   {$$ = AslDoError(); yyclearin;}
2031     ;
2032 
2033 ShiftRightTerm
2034     : PARSEOP_SHIFTRIGHT '('        {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
2035         TermArg
2036         TermArgItem
2037         Target
2038         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
2039     | PARSEOP_SHIFTRIGHT '('
2040         error ')'                   {$$ = AslDoError(); yyclearin;}
2041     ;
2042 
2043 SizeOfTerm
2044     : PARSEOP_SIZEOF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_SIZEOF);}
2045         SuperName
2046         ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
2047     | PARSEOP_SIZEOF '('
2048         error ')'                   {$$ = AslDoError(); yyclearin;}
2049     ;
2050 
2051 StoreTerm
2052     : PARSEOP_STORE '('             {$<n>$ = TrCreateLeafNode (PARSEOP_STORE);}
2053         TermArg
2054         ',' SuperName
2055         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));}
2056     | PARSEOP_STORE '('
2057         error ')'                   {$$ = AslDoError(); yyclearin;}
2058     ;
2059 
2060 SubtractTerm
2061     : PARSEOP_SUBTRACT '('          {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
2062         TermArg
2063         TermArgItem
2064         Target
2065         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
2066     | PARSEOP_SUBTRACT '('
2067         error ')'                   {$$ = AslDoError(); yyclearin;}
2068     ;
2069 
2070 TimerTerm
2071     : PARSEOP_TIMER '('             {$<n>$ = TrCreateLeafNode (PARSEOP_TIMER);}
2072         ')'                         {$$ = TrLinkChildren ($<n>3,0);}
2073     | PARSEOP_TIMER                 {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_TIMER),0);}
2074     | PARSEOP_TIMER '('
2075         error ')'                   {$$ = AslDoError(); yyclearin;}
2076     ;
2077 
2078 ToBCDTerm
2079     : PARSEOP_TOBCD '('             {$<n>$ = TrCreateLeafNode (PARSEOP_TOBCD);}
2080         TermArg
2081         Target
2082         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
2083     | PARSEOP_TOBCD '('
2084         error ')'                   {$$ = AslDoError(); yyclearin;}
2085     ;
2086 
2087 ToBufferTerm
2088     : PARSEOP_TOBUFFER '('          {$<n>$ = TrCreateLeafNode (PARSEOP_TOBUFFER);}
2089         TermArg
2090         Target
2091         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
2092     | PARSEOP_TOBUFFER '('
2093         error ')'                   {$$ = AslDoError(); yyclearin;}
2094     ;
2095 
2096 ToDecimalStringTerm
2097     : PARSEOP_TODECIMALSTRING '('   {$<n>$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);}
2098         TermArg
2099         Target
2100         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
2101     | PARSEOP_TODECIMALSTRING '('
2102         error ')'                   {$$ = AslDoError(); yyclearin;}
2103     ;
2104 
2105 ToHexStringTerm
2106     : PARSEOP_TOHEXSTRING '('       {$<n>$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);}
2107         TermArg
2108         Target
2109         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
2110     | PARSEOP_TOHEXSTRING '('
2111         error ')'                   {$$ = AslDoError(); yyclearin;}
2112     ;
2113 
2114 ToIntegerTerm
2115     : PARSEOP_TOINTEGER '('         {$<n>$ = TrCreateLeafNode (PARSEOP_TOINTEGER);}
2116         TermArg
2117         Target
2118         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
2119     | PARSEOP_TOINTEGER '('
2120         error ')'                   {$$ = AslDoError(); yyclearin;}
2121     ;
2122 
2123 ToStringTerm
2124     : PARSEOP_TOSTRING '('          {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);}
2125         TermArg
2126         OptionalCount
2127         Target
2128         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
2129     | PARSEOP_TOSTRING '('
2130         error ')'                   {$$ = AslDoError(); yyclearin;}
2131     ;
2132 
2133 ToUUIDTerm
2134     : PARSEOP_TOUUID '('
2135         StringData ')'              {$$ = TrUpdateNode (PARSEOP_TOUUID, $3);}
2136     | PARSEOP_TOUUID '('
2137         error ')'                   {$$ = AslDoError(); yyclearin;}
2138     ;
2139 
2140 WaitTerm
2141     : PARSEOP_WAIT '('              {$<n>$ = TrCreateLeafNode (PARSEOP_WAIT);}
2142         SuperName
2143         TermArgItem
2144         ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
2145     | PARSEOP_WAIT '('
2146         error ')'                   {$$ = AslDoError(); yyclearin;}
2147     ;
2148 
2149 XOrTerm
2150     : PARSEOP_XOR '('               {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
2151         TermArg
2152         TermArgItem
2153         Target
2154         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);}
2155     | PARSEOP_XOR '('
2156         error ')'                   {$$ = AslDoError(); yyclearin;}
2157     ;
2158 
2159 
2160 /******* Keywords *************************************************************/
2161 
2162 
2163 AccessAttribKeyword
2164     : PARSEOP_ACCESSATTRIB_BLOCK            {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK);}
2165     | PARSEOP_ACCESSATTRIB_BLOCK_CALL       {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK_CALL);}
2166     | PARSEOP_ACCESSATTRIB_BYTE             {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BYTE);}
2167     | PARSEOP_ACCESSATTRIB_QUICK            {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_QUICK );}
2168     | PARSEOP_ACCESSATTRIB_SND_RCV          {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_SND_RCV);}
2169     | PARSEOP_ACCESSATTRIB_WORD             {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD);}
2170     | PARSEOP_ACCESSATTRIB_WORD_CALL        {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD_CALL);}
2171     | PARSEOP_ACCESSATTRIB_MULTIBYTE '('    {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_MULTIBYTE);}
2172         ByteConst
2173         ')'                                 {$$ = TrLinkChildren ($<n>3,1,$4);}
2174     | PARSEOP_ACCESSATTRIB_RAW_BYTES '('    {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_BYTES);}
2175         ByteConst
2176         ')'                                 {$$ = TrLinkChildren ($<n>3,1,$4);}
2177     | PARSEOP_ACCESSATTRIB_RAW_PROCESS '('  {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_PROCESS);}
2178         ByteConst
2179         ')'                                 {$$ = TrLinkChildren ($<n>3,1,$4);}
2180     ;
2181 
2182 AccessTypeKeyword
2183     : PARSEOP_ACCESSTYPE_ANY                {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_ANY);}
2184     | PARSEOP_ACCESSTYPE_BYTE               {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BYTE);}
2185     | PARSEOP_ACCESSTYPE_WORD               {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_WORD);}
2186     | PARSEOP_ACCESSTYPE_DWORD              {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_DWORD);}
2187     | PARSEOP_ACCESSTYPE_QWORD              {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_QWORD);}
2188     | PARSEOP_ACCESSTYPE_BUF                {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BUF);}
2189     ;
2190 
2191 AddressingModeKeyword
2192     : PARSEOP_ADDRESSINGMODE_7BIT           {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_7BIT);}
2193     | PARSEOP_ADDRESSINGMODE_10BIT          {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_10BIT);}
2194     ;
2195 
2196 AddressKeyword
2197     : PARSEOP_ADDRESSTYPE_MEMORY            {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_MEMORY);}
2198     | PARSEOP_ADDRESSTYPE_RESERVED          {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_RESERVED);}
2199     | PARSEOP_ADDRESSTYPE_NVS               {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_NVS);}
2200     | PARSEOP_ADDRESSTYPE_ACPI              {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_ACPI);}
2201     ;
2202 
2203 AddressSpaceKeyword
2204     : ByteConst                             {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);}
2205     | RegionSpaceKeyword                    {}
2206     ;
2207 
2208 BitsPerByteKeyword
2209     : PARSEOP_BITSPERBYTE_FIVE              {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_FIVE);}
2210     | PARSEOP_BITSPERBYTE_SIX               {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SIX);}
2211     | PARSEOP_BITSPERBYTE_SEVEN             {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SEVEN);}
2212     | PARSEOP_BITSPERBYTE_EIGHT             {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_EIGHT);}
2213     | PARSEOP_BITSPERBYTE_NINE              {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_NINE);}
2214     ;
2215 
2216 ClockPhaseKeyword
2217     : PARSEOP_CLOCKPHASE_FIRST              {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_FIRST);}
2218     | PARSEOP_CLOCKPHASE_SECOND             {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_SECOND);}
2219     ;
2220 
2221 ClockPolarityKeyword
2222     : PARSEOP_CLOCKPOLARITY_LOW             {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_LOW);}
2223     | PARSEOP_CLOCKPOLARITY_HIGH            {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_HIGH);}
2224     ;
2225 
2226 DecodeKeyword
2227     : PARSEOP_DECODETYPE_POS                {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_POS);}
2228     | PARSEOP_DECODETYPE_SUB                {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_SUB);}
2229     ;
2230 
2231 DevicePolarityKeyword
2232     : PARSEOP_DEVICEPOLARITY_LOW            {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_LOW);}
2233     | PARSEOP_DEVICEPOLARITY_HIGH           {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_HIGH);}
2234     ;
2235 
2236 DMATypeKeyword
2237     : PARSEOP_DMATYPE_A                     {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_A);}
2238     | PARSEOP_DMATYPE_COMPATIBILITY         {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_COMPATIBILITY);}
2239     | PARSEOP_DMATYPE_B                     {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_B);}
2240     | PARSEOP_DMATYPE_F                     {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);}
2241     ;
2242 
2243 EndianKeyword
2244     : PARSEOP_ENDIAN_LITTLE                 {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_LITTLE);}
2245     | PARSEOP_ENDIAN_BIG                    {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_BIG);}
2246     ;
2247 
2248 FlowControlKeyword
2249     : PARSEOP_FLOWCONTROL_HW                {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_HW);}
2250     | PARSEOP_FLOWCONTROL_NONE              {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_NONE);}
2251     | PARSEOP_FLOWCONTROL_SW                {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_SW);}
2252     ;
2253 
2254 InterruptLevel
2255     : PARSEOP_INTLEVEL_ACTIVEBOTH           {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEBOTH);}
2256     | PARSEOP_INTLEVEL_ACTIVEHIGH           {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);}
2257     | PARSEOP_INTLEVEL_ACTIVELOW            {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);}
2258     ;
2259 
2260 InterruptTypeKeyword
2261     : PARSEOP_INTTYPE_EDGE                  {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_EDGE);}
2262     | PARSEOP_INTTYPE_LEVEL                 {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_LEVEL);}
2263     ;
2264 
2265 IODecodeKeyword
2266     : PARSEOP_IODECODETYPE_16               {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);}
2267     | PARSEOP_IODECODETYPE_10               {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_10);}
2268     ;
2269 
2270 IoRestrictionKeyword
2271     : PARSEOP_IORESTRICT_IN                 {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_IN);}
2272     | PARSEOP_IORESTRICT_OUT                {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_OUT);}
2273     | PARSEOP_IORESTRICT_NONE               {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_NONE);}
2274     | PARSEOP_IORESTRICT_PRESERVE           {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_PRESERVE);}
2275     ;
2276 
2277 LockRuleKeyword
2278     : PARSEOP_LOCKRULE_LOCK                 {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_LOCK);}
2279     | PARSEOP_LOCKRULE_NOLOCK               {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_NOLOCK);}
2280     ;
2281 
2282 MatchOpKeyword
2283     : PARSEOP_MATCHTYPE_MTR                 {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MTR);}
2284     | PARSEOP_MATCHTYPE_MEQ                 {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ);}
2285     | PARSEOP_MATCHTYPE_MLE                 {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLE);}
2286     | PARSEOP_MATCHTYPE_MLT                 {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLT);}
2287     | PARSEOP_MATCHTYPE_MGE                 {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGE);}
2288     | PARSEOP_MATCHTYPE_MGT                 {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGT);}
2289     ;
2290 
2291 MaxKeyword
2292     : PARSEOP_MAXTYPE_FIXED                 {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_FIXED);}
2293     | PARSEOP_MAXTYPE_NOTFIXED              {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_NOTFIXED);}
2294     ;
2295 
2296 MemTypeKeyword
2297     : PARSEOP_MEMTYPE_CACHEABLE             {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_CACHEABLE);}
2298     | PARSEOP_MEMTYPE_WRITECOMBINING        {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_WRITECOMBINING);}
2299     | PARSEOP_MEMTYPE_PREFETCHABLE          {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_PREFETCHABLE);}
2300     | PARSEOP_MEMTYPE_NONCACHEABLE          {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);}
2301     ;
2302 
2303 MinKeyword
2304     : PARSEOP_MINTYPE_FIXED                 {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_FIXED);}
2305     | PARSEOP_MINTYPE_NOTFIXED              {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_NOTFIXED);}
2306     ;
2307 
2308 ObjectTypeKeyword
2309     : PARSEOP_OBJECTTYPE_UNK                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);}
2310     | PARSEOP_OBJECTTYPE_INT                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_INT);}
2311     | PARSEOP_OBJECTTYPE_STR                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_STR);}
2312     | PARSEOP_OBJECTTYPE_BUF                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BUF);}
2313     | PARSEOP_OBJECTTYPE_PKG                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PKG);}
2314     | PARSEOP_OBJECTTYPE_FLD                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_FLD);}
2315     | PARSEOP_OBJECTTYPE_DEV                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DEV);}
2316     | PARSEOP_OBJECTTYPE_EVT                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_EVT);}
2317     | PARSEOP_OBJECTTYPE_MTH                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTH);}
2318     | PARSEOP_OBJECTTYPE_MTX                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);}
2319     | PARSEOP_OBJECTTYPE_OPR                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);}
2320     | PARSEOP_OBJECTTYPE_POW                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);}
2321     | PARSEOP_OBJECTTYPE_PRO                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PRO);}
2322     | PARSEOP_OBJECTTYPE_THZ                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);}
2323     | PARSEOP_OBJECTTYPE_BFF                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);}
2324     | PARSEOP_OBJECTTYPE_DDB                {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);}
2325     ;
2326 
2327 ParityTypeKeyword
2328     : PARSEOP_PARITYTYPE_SPACE              {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_SPACE);}
2329     | PARSEOP_PARITYTYPE_MARK               {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_MARK);}
2330     | PARSEOP_PARITYTYPE_ODD                {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_ODD);}
2331     | PARSEOP_PARITYTYPE_EVEN               {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_EVEN);}
2332     | PARSEOP_PARITYTYPE_NONE               {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_NONE);}
2333     ;
2334 
2335 PinConfigByte
2336     : PinConfigKeyword                      {$$ = $1;}
2337     | ByteConstExpr                         {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);}
2338     ;
2339 
2340 PinConfigKeyword
2341     : PARSEOP_PIN_NOPULL                    {$$ = TrCreateLeafNode (PARSEOP_PIN_NOPULL);}
2342     | PARSEOP_PIN_PULLDOWN                  {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDOWN);}
2343     | PARSEOP_PIN_PULLUP                    {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLUP);}
2344     | PARSEOP_PIN_PULLDEFAULT               {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDEFAULT);}
2345     ;
2346 
2347 RangeTypeKeyword
2348     : PARSEOP_RANGETYPE_ISAONLY             {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ISAONLY);}
2349     | PARSEOP_RANGETYPE_NONISAONLY          {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_NONISAONLY);}
2350     | PARSEOP_RANGETYPE_ENTIRE              {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ENTIRE);}
2351     ;
2352 
2353 RegionSpaceKeyword
2354     : PARSEOP_REGIONSPACE_IO                {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IO);}
2355     | PARSEOP_REGIONSPACE_MEM               {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_MEM);}
2356     | PARSEOP_REGIONSPACE_PCI               {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCI);}
2357     | PARSEOP_REGIONSPACE_EC                {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_EC);}
2358     | PARSEOP_REGIONSPACE_SMBUS             {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);}
2359     | PARSEOP_REGIONSPACE_CMOS              {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);}
2360     | PARSEOP_REGIONSPACE_PCIBAR            {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);}
2361     | PARSEOP_REGIONSPACE_IPMI              {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);}
2362     | PARSEOP_REGIONSPACE_GPIO              {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GPIO);}
2363     | PARSEOP_REGIONSPACE_GSBUS             {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GSBUS);}
2364     | PARSEOP_REGIONSPACE_PCC               {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCC);}
2365     | PARSEOP_REGIONSPACE_FFIXEDHW          {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_FFIXEDHW);}
2366     ;
2367 
2368 ResourceTypeKeyword
2369     : PARSEOP_RESOURCETYPE_CONSUMER         {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);}
2370     | PARSEOP_RESOURCETYPE_PRODUCER         {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_PRODUCER);}
2371     ;
2372 
2373 SerializeRuleKeyword
2374     : PARSEOP_SERIALIZERULE_SERIAL          {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_SERIAL);}
2375     | PARSEOP_SERIALIZERULE_NOTSERIAL       {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL);}
2376     ;
2377 
2378 ShareTypeKeyword
2379     : PARSEOP_SHARETYPE_SHARED              {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHARED);}
2380     | PARSEOP_SHARETYPE_EXCLUSIVE           {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVE);}
2381     | PARSEOP_SHARETYPE_SHAREDWAKE          {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHAREDWAKE);}
2382     | PARSEOP_SHARETYPE_EXCLUSIVEWAKE       {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVEWAKE);}
2383    ;
2384 
2385 SlaveModeKeyword
2386     : PARSEOP_SLAVEMODE_CONTROLLERINIT      {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_CONTROLLERINIT);}
2387     | PARSEOP_SLAVEMODE_DEVICEINIT          {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_DEVICEINIT);}
2388     ;
2389 
2390 StopBitsKeyword
2391     : PARSEOP_STOPBITS_TWO                  {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_TWO);}
2392     | PARSEOP_STOPBITS_ONEPLUSHALF          {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONEPLUSHALF);}
2393     | PARSEOP_STOPBITS_ONE                  {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONE);}
2394     | PARSEOP_STOPBITS_ZERO                 {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ZERO);}
2395     ;
2396 
2397 TranslationKeyword
2398     : PARSEOP_TRANSLATIONTYPE_SPARSE        {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_SPARSE);}
2399     | PARSEOP_TRANSLATIONTYPE_DENSE         {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_DENSE);}
2400     ;
2401 
2402 TypeKeyword
2403     : PARSEOP_TYPE_TRANSLATION              {$$ = TrCreateLeafNode (PARSEOP_TYPE_TRANSLATION);}
2404     | PARSEOP_TYPE_STATIC                   {$$ = TrCreateLeafNode (PARSEOP_TYPE_STATIC);}
2405     ;
2406 
2407 UpdateRuleKeyword
2408     : PARSEOP_UPDATERULE_PRESERVE           {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_PRESERVE);}
2409     | PARSEOP_UPDATERULE_ONES               {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ONES);}
2410     | PARSEOP_UPDATERULE_ZEROS              {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ZEROS);}
2411     ;
2412 
2413 WireModeKeyword
2414     : PARSEOP_WIREMODE_FOUR                 {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_FOUR);}
2415     | PARSEOP_WIREMODE_THREE                {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_THREE);}
2416     ;
2417 
2418 XferSizeKeyword
2419     : PARSEOP_XFERSIZE_8                    {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_8,   0);}
2420     | PARSEOP_XFERSIZE_16                   {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_16,  1);}
2421     | PARSEOP_XFERSIZE_32                   {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32,  2);}
2422     | PARSEOP_XFERSIZE_64                   {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_64,  3);}
2423     | PARSEOP_XFERSIZE_128                  {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_128, 4);}
2424     | PARSEOP_XFERSIZE_256                  {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_256, 5);}
2425     ;
2426 
2427 XferTypeKeyword
2428     : PARSEOP_XFERTYPE_8                    {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8);}
2429     | PARSEOP_XFERTYPE_8_16                 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8_16);}
2430     | PARSEOP_XFERTYPE_16                   {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_16);}
2431     ;
2432 
2433 
2434 /******* Miscellaneous Types **************************************************/
2435 
2436 
2437 SuperName
2438     : NameString                    {}
2439     | ArgTerm                       {}
2440     | LocalTerm                     {}
2441     | DebugTerm                     {}
2442     | Type6Opcode                   {}
2443 
2444 /* For ObjectType: SuperName except for UserTerm (method invocation) */
2445 
2446 ObjectTypeName
2447     : NameString                    {}
2448     | ArgTerm                       {}
2449     | LocalTerm                     {}
2450     | DebugTerm                     {}
2451     | RefOfTerm                     {}
2452     | DerefOfTerm                   {}
2453     | IndexTerm                     {}
2454 
2455 /*    | UserTerm                      {} */  /* Caused reduce/reduce with Type6Opcode->UserTerm */
2456     ;
2457 
2458 ArgTerm
2459     : PARSEOP_ARG0                  {$$ = TrCreateLeafNode (PARSEOP_ARG0);}
2460     | PARSEOP_ARG1                  {$$ = TrCreateLeafNode (PARSEOP_ARG1);}
2461     | PARSEOP_ARG2                  {$$ = TrCreateLeafNode (PARSEOP_ARG2);}
2462     | PARSEOP_ARG3                  {$$ = TrCreateLeafNode (PARSEOP_ARG3);}
2463     | PARSEOP_ARG4                  {$$ = TrCreateLeafNode (PARSEOP_ARG4);}
2464     | PARSEOP_ARG5                  {$$ = TrCreateLeafNode (PARSEOP_ARG5);}
2465     | PARSEOP_ARG6                  {$$ = TrCreateLeafNode (PARSEOP_ARG6);}
2466     ;
2467 
2468 LocalTerm
2469     : PARSEOP_LOCAL0                {$$ = TrCreateLeafNode (PARSEOP_LOCAL0);}
2470     | PARSEOP_LOCAL1                {$$ = TrCreateLeafNode (PARSEOP_LOCAL1);}
2471     | PARSEOP_LOCAL2                {$$ = TrCreateLeafNode (PARSEOP_LOCAL2);}
2472     | PARSEOP_LOCAL3                {$$ = TrCreateLeafNode (PARSEOP_LOCAL3);}
2473     | PARSEOP_LOCAL4                {$$ = TrCreateLeafNode (PARSEOP_LOCAL4);}
2474     | PARSEOP_LOCAL5                {$$ = TrCreateLeafNode (PARSEOP_LOCAL5);}
2475     | PARSEOP_LOCAL6                {$$ = TrCreateLeafNode (PARSEOP_LOCAL6);}
2476     | PARSEOP_LOCAL7                {$$ = TrCreateLeafNode (PARSEOP_LOCAL7);}
2477     ;
2478 
2479 DebugTerm
2480     : PARSEOP_DEBUG                 {$$ = TrCreateLeafNode (PARSEOP_DEBUG);}
2481     ;
2482 
2483 
2484 ByteConst
2485     : Integer                       {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
2486     ;
2487 
2488 WordConst
2489     : Integer                       {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
2490     ;
2491 
2492 DWordConst
2493     : Integer                       {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
2494     ;
2495 
2496 QWordConst
2497     : Integer                       {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
2498     ;
2499 
2500 Integer
2501     : PARSEOP_INTEGER               {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, AslCompilerlval.i);}
2502     ;
2503 
2504 String
2505     : PARSEOP_STRING_LITERAL        {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, (ACPI_NATIVE_INT) AslCompilerlval.s);}
2506     ;
2507 
2508 ConstTerm
2509     : ConstExprTerm                 {}
2510     | PARSEOP_REVISION              {$$ = TrCreateLeafNode (PARSEOP_REVISION);}
2511     ;
2512 
2513 ConstExprTerm
2514     : PARSEOP_ZERO                  {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);}
2515     | PARSEOP_ONE                   {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);}
2516     | PARSEOP_ONES                  {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);}
2517     | PARSEOP___DATE__              {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);}
2518     | PARSEOP___FILE__              {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);}
2519     | PARSEOP___LINE__              {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);}
2520     | PARSEOP___PATH__              {$$ = TrCreateConstantLeafNode (PARSEOP___PATH__);}
2521     ;
2522 
2523 /*
2524  * The NODE_COMPILE_TIME_CONST flag in the following constant expressions
2525  * enables compile-time constant folding to reduce the Type3Opcodes/Type2IntegerOpcodes
2526  * to simple integers. It is an error if these types of expressions cannot be
2527  * reduced, since the AML grammar for ****ConstExpr requires a simple constant.
2528  * Note: The required byte length of the constant is passed through to the
2529  * constant folding code in the node AmlLength field.
2530  */
2531 ByteConstExpr
2532     : Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);}
2533     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);}
2534     | ConstExprTerm                 {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);}
2535     | ByteConst                     {}
2536     ;
2537 
2538 WordConstExpr
2539     : Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);}
2540     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);}
2541     | ConstExprTerm                 {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);}
2542     | WordConst                     {}
2543     ;
2544 
2545 DWordConstExpr
2546     : Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);}
2547     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);}
2548     | ConstExprTerm                 {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);}
2549     | DWordConst                    {}
2550     ;
2551 
2552 QWordConstExpr
2553     : Type3Opcode                   {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);}
2554     | Type2IntegerOpcode            {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);}
2555     | ConstExprTerm                 {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);}
2556     | QWordConst                    {}
2557     ;
2558 
2559 /* OptionalCount must appear before ByteList or an incorrect reduction will result */
2560 
2561 OptionalCount
2562     :                               {$$ = TrCreateLeafNode (PARSEOP_ONES);}       /* Placeholder is a OnesOp object */
2563     | ','                           {$$ = TrCreateLeafNode (PARSEOP_ONES);}       /* Placeholder is a OnesOp object */
2564     | ',' TermArg                   {$$ = $2;}
2565     ;
2566 
2567 BufferTerm
2568     : PARSEOP_BUFFER '('            {$<n>$ = TrCreateLeafNode (PARSEOP_BUFFER);}
2569         OptionalTermArg
2570         ')' '{'
2571             BufferTermData '}'      {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
2572     | PARSEOP_BUFFER '('
2573         error ')'                   {$$ = AslDoError(); yyclearin;}
2574     ;
2575 
2576 BufferTermData
2577     : ByteList                      {}
2578     | StringData                    {}
2579     ;
2580 
2581 ByteList
2582     :                               {$$ = NULL;}
2583     | ByteConstExpr
2584     | ByteList ','                  /* Allows a trailing comma at list end */
2585     | ByteList ','
2586         ByteConstExpr               {$$ = TrLinkPeerNode ($1,$3);}
2587     ;
2588 
2589 DataBufferTerm
2590     : PARSEOP_DATABUFFER  '('       {$<n>$ = TrCreateLeafNode (PARSEOP_DATABUFFER);}
2591         OptionalWordConst
2592         ')' '{'
2593             ByteList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
2594     | PARSEOP_DATABUFFER '('
2595         error ')'                   {$$ = AslDoError(); yyclearin;}
2596     ;
2597 
2598 DWordList
2599     :                               {$$ = NULL;}
2600     | DWordConstExpr
2601     | DWordList ','                 /* Allows a trailing comma at list end */
2602     | DWordList ','
2603         DWordConstExpr              {$$ = TrLinkPeerNode ($1,$3);}
2604     ;
2605 
2606 PackageTerm
2607     : PARSEOP_PACKAGE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);}
2608         VarPackageLengthTerm
2609         ')' '{'
2610             PackageList '}'         {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
2611     | PARSEOP_PACKAGE '('
2612         error ')'                   {$$ = AslDoError(); yyclearin;}
2613     ;
2614 
2615 PackageList
2616     :                               {$$ = NULL;}
2617     | PackageElement
2618     | PackageList ','               /* Allows a trailing comma at list end */
2619     | PackageList ','
2620         PackageElement              {$$ = TrLinkPeerNode ($1,$3);}
2621     ;
2622 
2623 PackageElement
2624     : DataObject                    {}
2625     | NameString                    {}
2626     ;
2627 
2628 VarPackageLengthTerm
2629     :                               {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
2630     | TermArg                       {$$ = $1;}
2631     ;
2632 
2633 
2634 /******* Macros ***********************************************/
2635 
2636 
2637 EISAIDTerm
2638     : PARSEOP_EISAID '('
2639         StringData ')'              {$$ = TrUpdateNode (PARSEOP_EISAID, $3);}
2640     | PARSEOP_EISAID '('
2641         error ')'                   {$$ = AslDoError(); yyclearin;}
2642     ;
2643 
2644 UnicodeTerm
2645     : PARSEOP_UNICODE '('           {$<n>$ = TrCreateLeafNode (PARSEOP_UNICODE);}
2646         StringData
2647         ')'                         {$$ = TrLinkChildren ($<n>3,2,0,$4);}
2648     | PARSEOP_UNICODE '('
2649         error ')'                   {$$ = AslDoError(); yyclearin;}
2650     ;
2651 
2652 
2653 /******* Resources and Memory ***********************************************/
2654 
2655 
2656 /*
2657  * Note: Create two default nodes to allow conversion to a Buffer AML opcode
2658  * Also, insert the EndTag at the end of the template.
2659  */
2660 ResourceTemplateTerm
2661     : PARSEOP_RESOURCETEMPLATE '(' ')'
2662         '{'
2663         ResourceMacroList '}'       {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,4,
2664                                           TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
2665                                           TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
2666                                           $5,
2667                                           TrCreateLeafNode (PARSEOP_ENDTAG));}
2668     ;
2669 
2670 ResourceMacroList
2671     :                               {$$ = NULL;}
2672     | ResourceMacroList
2673         ResourceMacroTerm           {$$ = TrLinkPeerNode ($1,$2);}
2674     ;
2675 
2676 ResourceMacroTerm
2677     : DMATerm                       {}
2678     | DWordIOTerm                   {}
2679     | DWordMemoryTerm               {}
2680     | DWordSpaceTerm                {}
2681     | EndDependentFnTerm            {}
2682     | ExtendedIOTerm                {}
2683     | ExtendedMemoryTerm            {}
2684     | ExtendedSpaceTerm             {}
2685     | FixedDmaTerm                  {}
2686     | FixedIOTerm                   {}
2687     | GpioIntTerm                   {}
2688     | GpioIoTerm                    {}
2689     | I2cSerialBusTerm              {}
2690     | InterruptTerm                 {}
2691     | IOTerm                        {}
2692     | IRQNoFlagsTerm                {}
2693     | IRQTerm                       {}
2694     | Memory24Term                  {}
2695     | Memory32FixedTerm             {}
2696     | Memory32Term                  {}
2697     | QWordIOTerm                   {}
2698     | QWordMemoryTerm               {}
2699     | QWordSpaceTerm                {}
2700     | RegisterTerm                  {}
2701     | SpiSerialBusTerm              {}
2702     | StartDependentFnNoPriTerm     {}
2703     | StartDependentFnTerm          {}
2704     | UartSerialBusTerm             {}
2705     | VendorLongTerm                {}
2706     | VendorShortTerm               {}
2707     | WordBusNumberTerm             {}
2708     | WordIOTerm                    {}
2709     | WordSpaceTerm                 {}
2710     ;
2711 
2712 DMATerm
2713     : PARSEOP_DMA '('               {$<n>$ = TrCreateLeafNode (PARSEOP_DMA);}
2714         DMATypeKeyword
2715         OptionalBusMasterKeyword
2716         ',' XferTypeKeyword
2717         OptionalNameString_Last
2718         ')' '{'
2719             ByteList '}'            {$$ = TrLinkChildren ($<n>3,5,$4,$5,$7,$8,$11);}
2720     | PARSEOP_DMA '('
2721         error ')'                   {$$ = AslDoError(); yyclearin;}
2722     ;
2723 
2724 DWordIOTerm
2725     : PARSEOP_DWORDIO '('           {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDIO);}
2726         OptionalResourceType_First
2727         OptionalMinType
2728         OptionalMaxType
2729         OptionalDecodeType
2730         OptionalRangeType
2731         ',' DWordConstExpr
2732         ',' DWordConstExpr
2733         ',' DWordConstExpr
2734         ',' DWordConstExpr
2735         ',' DWordConstExpr
2736         OptionalByteConstExpr
2737         OptionalStringData
2738         OptionalNameString
2739         OptionalType
2740         OptionalTranslationType_Last
2741         ')'                         {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);}
2742     | PARSEOP_DWORDIO '('
2743         error ')'                   {$$ = AslDoError(); yyclearin;}
2744     ;
2745 
2746 DWordMemoryTerm
2747     : PARSEOP_DWORDMEMORY '('       {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDMEMORY);}
2748         OptionalResourceType_First
2749         OptionalDecodeType
2750         OptionalMinType
2751         OptionalMaxType
2752         OptionalMemType
2753         ',' OptionalReadWriteKeyword
2754         ',' DWordConstExpr
2755         ',' DWordConstExpr
2756         ',' DWordConstExpr
2757         ',' DWordConstExpr
2758         ',' DWordConstExpr
2759         OptionalByteConstExpr
2760         OptionalStringData
2761         OptionalNameString
2762         OptionalAddressRange
2763         OptionalType_Last
2764         ')'                         {$$ = TrLinkChildren ($<n>3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);}
2765     | PARSEOP_DWORDMEMORY '('
2766         error ')'                   {$$ = AslDoError(); yyclearin;}
2767     ;
2768 
2769 DWordSpaceTerm
2770     : PARSEOP_DWORDSPACE '('        {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDSPACE);}
2771         ByteConstExpr               {UtCheckIntegerRange ($4, 0xC0, 0xFF);}
2772         OptionalResourceType
2773         OptionalDecodeType
2774         OptionalMinType
2775         OptionalMaxType
2776         ',' ByteConstExpr
2777         ',' DWordConstExpr
2778         ',' DWordConstExpr
2779         ',' DWordConstExpr
2780         ',' DWordConstExpr
2781         ',' DWordConstExpr
2782         OptionalByteConstExpr
2783         OptionalStringData
2784         OptionalNameString_Last
2785         ')'                         {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);}
2786     | PARSEOP_DWORDSPACE '('
2787         error ')'                   {$$ = AslDoError(); yyclearin;}
2788     ;
2789 
2790 
2791 EndDependentFnTerm
2792     : PARSEOP_ENDDEPENDENTFN '('
2793         ')'                         {$$ = TrCreateLeafNode (PARSEOP_ENDDEPENDENTFN);}
2794     | PARSEOP_ENDDEPENDENTFN '('
2795         error ')'                   {$$ = AslDoError(); yyclearin;}
2796     ;
2797 
2798 ExtendedIOTerm
2799     : PARSEOP_EXTENDEDIO '('        {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDIO);}
2800         OptionalResourceType_First
2801         OptionalMinType
2802         OptionalMaxType
2803         OptionalDecodeType
2804         OptionalRangeType
2805         ',' QWordConstExpr
2806         ',' QWordConstExpr
2807         ',' QWordConstExpr
2808         ',' QWordConstExpr
2809         ',' QWordConstExpr
2810         OptionalQWordConstExpr
2811         OptionalNameString
2812         OptionalType
2813         OptionalTranslationType_Last
2814         ')'                         {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22);}
2815     | PARSEOP_EXTENDEDIO '('
2816         error ')'                   {$$ = AslDoError(); yyclearin;}
2817     ;
2818 
2819 ExtendedMemoryTerm
2820     : PARSEOP_EXTENDEDMEMORY '('    {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDMEMORY);}
2821         OptionalResourceType_First
2822         OptionalDecodeType
2823         OptionalMinType
2824         OptionalMaxType
2825         OptionalMemType
2826         ',' OptionalReadWriteKeyword
2827         ',' QWordConstExpr
2828         ',' QWordConstExpr
2829         ',' QWordConstExpr
2830         ',' QWordConstExpr
2831         ',' QWordConstExpr
2832         OptionalQWordConstExpr
2833         OptionalNameString
2834         OptionalAddressRange
2835         OptionalType_Last
2836         ')'                         {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24);}
2837     | PARSEOP_EXTENDEDMEMORY '('
2838         error ')'                   {$$ = AslDoError(); yyclearin;}
2839     ;
2840 
2841 ExtendedSpaceTerm
2842     : PARSEOP_EXTENDEDSPACE '('     {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDSPACE);}
2843         ByteConstExpr               {UtCheckIntegerRange ($4, 0xC0, 0xFF);}
2844         OptionalResourceType
2845         OptionalDecodeType
2846         OptionalMinType
2847         OptionalMaxType
2848         ',' ByteConstExpr
2849         ',' QWordConstExpr
2850         ',' QWordConstExpr
2851         ',' QWordConstExpr
2852         ',' QWordConstExpr
2853         ',' QWordConstExpr
2854         OptionalQWordConstExpr
2855         OptionalNameString_Last
2856         ')'                         {$$ = TrLinkChildren ($<n>3,13,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23);}
2857     | PARSEOP_EXTENDEDSPACE '('
2858         error ')'                   {$$ = AslDoError(); yyclearin;}
2859     ;
2860 
2861 FixedDmaTerm
2862     : PARSEOP_FIXEDDMA '('          {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDDMA);}
2863         WordConstExpr               /* 04: DMA RequestLines */
2864         ',' WordConstExpr           /* 06: DMA Channels */
2865         OptionalXferSize            /* 07: DMA TransferSize */
2866         OptionalNameString          /* 08: DescriptorName */
2867         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$6,$7,$8);}
2868     | PARSEOP_FIXEDDMA '('
2869         error ')'                   {$$ = AslDoError(); yyclearin;}
2870     ;
2871 
2872 FixedIOTerm
2873     : PARSEOP_FIXEDIO '('           {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDIO);}
2874         WordConstExpr
2875         ',' ByteConstExpr
2876         OptionalNameString_Last
2877         ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);}
2878     | PARSEOP_FIXEDIO '('
2879         error ')'                   {$$ = AslDoError(); yyclearin;}
2880     ;
2881 
2882 GpioIntTerm
2883     : PARSEOP_GPIO_INT '('          {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_INT);}
2884         InterruptTypeKeyword        /* 04: InterruptType */
2885         ',' InterruptLevel          /* 06: InterruptLevel */
2886         OptionalShareType           /* 07: SharedType */
2887         ',' PinConfigByte           /* 09: PinConfig */
2888         OptionalWordConstExpr       /* 10: DebounceTimeout */
2889         ',' StringData              /* 12: ResourceSource */
2890         OptionalByteConstExpr       /* 13: ResourceSourceIndex */
2891         OptionalResourceType        /* 14: ResourceType */
2892         OptionalNameString          /* 15: DescriptorName */
2893         OptionalBuffer_Last         /* 16: VendorData */
2894         ')' '{'
2895             DWordConstExpr '}'      {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$9,$10,$12,$13,$14,$15,$16,$19);}
2896     | PARSEOP_GPIO_INT '('
2897         error ')'                   {$$ = AslDoError(); yyclearin;}
2898     ;
2899 
2900 GpioIoTerm
2901     : PARSEOP_GPIO_IO '('           {$<n>$ = TrCreateLeafNode (PARSEOP_GPIO_IO);}
2902         OptionalShareType_First     /* 04: SharedType */
2903         ',' PinConfigByte           /* 06: PinConfig */
2904         OptionalWordConstExpr       /* 07: DebounceTimeout */
2905         OptionalWordConstExpr       /* 08: DriveStrength */
2906         OptionalIoRestriction       /* 09: IoRestriction */
2907         ',' StringData              /* 11: ResourceSource */
2908         OptionalByteConstExpr       /* 12: ResourceSourceIndex */
2909         OptionalResourceType        /* 13: ResourceType */
2910         OptionalNameString          /* 14: DescriptorName */
2911         OptionalBuffer_Last         /* 15: VendorData */
2912         ')' '{'
2913             DWordList '}'           {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$8,$9,$11,$12,$13,$14,$15,$18);}
2914     | PARSEOP_GPIO_IO '('
2915         error ')'                   {$$ = AslDoError(); yyclearin;}
2916     ;
2917 
2918 I2cSerialBusTerm
2919     : PARSEOP_I2C_SERIALBUS '('     {$<n>$ = TrCreateLeafNode (PARSEOP_I2C_SERIALBUS);}
2920         WordConstExpr               /* 04: SlaveAddress */
2921         OptionalSlaveMode           /* 05: SlaveMode */
2922         ',' DWordConstExpr          /* 07: ConnectionSpeed */
2923         OptionalAddressingMode      /* 08: AddressingMode */
2924         ',' StringData              /* 10: ResourceSource */
2925         OptionalByteConstExpr       /* 11: ResourceSourceIndex */
2926         OptionalResourceType        /* 12: ResourceType */
2927         OptionalNameString          /* 13: DescriptorName */
2928         OptionalBuffer_Last         /* 14: VendorData */
2929         ')'                         {$$ = TrLinkChildren ($<n>3,9,$4,$5,$7,$8,$10,$11,$12,$13,$14);}
2930     | PARSEOP_I2C_SERIALBUS '('
2931         error ')'                   {$$ = AslDoError(); yyclearin;}
2932     ;
2933 
2934 InterruptTerm
2935     : PARSEOP_INTERRUPT '('         {$<n>$ = TrCreateLeafNode (PARSEOP_INTERRUPT);}
2936         OptionalResourceType_First
2937         ',' InterruptTypeKeyword
2938         ',' InterruptLevel
2939         OptionalShareType
2940         OptionalByteConstExpr
2941         OptionalStringData
2942         OptionalNameString_Last
2943         ')' '{'
2944             DWordList '}'           {$$ = TrLinkChildren ($<n>3,8,$4,$6,$8,$9,$10,$11,$12,$15);}
2945     | PARSEOP_INTERRUPT '('
2946         error ')'                   {$$ = AslDoError(); yyclearin;}
2947     ;
2948 
2949 IOTerm
2950     : PARSEOP_IO '('                {$<n>$ = TrCreateLeafNode (PARSEOP_IO);}
2951         IODecodeKeyword
2952         ',' WordConstExpr
2953         ',' WordConstExpr
2954         ',' ByteConstExpr
2955         ',' ByteConstExpr
2956         OptionalNameString_Last
2957         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);}
2958     | PARSEOP_IO '('
2959         error ')'                   {$$ = AslDoError(); yyclearin;}
2960     ;
2961 
2962 IRQNoFlagsTerm
2963     : PARSEOP_IRQNOFLAGS '('        {$<n>$ = TrCreateLeafNode (PARSEOP_IRQNOFLAGS);}
2964         OptionalNameString_First
2965         ')' '{'
2966             ByteList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
2967     | PARSEOP_IRQNOFLAGS '('
2968         error ')'                   {$$ = AslDoError(); yyclearin;}
2969     ;
2970 
2971 IRQTerm
2972     : PARSEOP_IRQ '('               {$<n>$ = TrCreateLeafNode (PARSEOP_IRQ);}
2973         InterruptTypeKeyword
2974         ',' InterruptLevel
2975         OptionalShareType
2976         OptionalNameString_Last
2977         ')' '{'
2978             ByteList '}'            {$$ = TrLinkChildren ($<n>3,5,$4,$6,$7,$8,$11);}
2979     | PARSEOP_IRQ '('
2980         error ')'                   {$$ = AslDoError(); yyclearin;}
2981     ;
2982 
2983 Memory24Term
2984     : PARSEOP_MEMORY24 '('          {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY24);}
2985         OptionalReadWriteKeyword
2986         ',' WordConstExpr
2987         ',' WordConstExpr
2988         ',' WordConstExpr
2989         ',' WordConstExpr
2990         OptionalNameString_Last
2991         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);}
2992     | PARSEOP_MEMORY24 '('
2993         error ')'                   {$$ = AslDoError(); yyclearin;}
2994     ;
2995 
2996 Memory32FixedTerm
2997     : PARSEOP_MEMORY32FIXED '('     {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY32FIXED);}
2998         OptionalReadWriteKeyword
2999         ',' DWordConstExpr
3000         ',' DWordConstExpr
3001         OptionalNameString_Last
3002         ')'                         {$$ = TrLinkChildren ($<n>3,4,$4,$6,$8,$9);}
3003     | PARSEOP_MEMORY32FIXED '('
3004         error ')'                   {$$ = AslDoError(); yyclearin;}
3005     ;
3006 
3007 Memory32Term
3008     : PARSEOP_MEMORY32 '('          {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY32);}
3009         OptionalReadWriteKeyword
3010         ',' DWordConstExpr
3011         ',' DWordConstExpr
3012         ',' DWordConstExpr
3013         ',' DWordConstExpr
3014         OptionalNameString_Last
3015         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);}
3016     | PARSEOP_MEMORY32 '('
3017         error ')'                   {$$ = AslDoError(); yyclearin;}
3018     ;
3019 
3020 QWordIOTerm
3021     : PARSEOP_QWORDIO '('           {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDIO);}
3022         OptionalResourceType_First
3023         OptionalMinType
3024         OptionalMaxType
3025         OptionalDecodeType
3026         OptionalRangeType
3027         ',' QWordConstExpr
3028         ',' QWordConstExpr
3029         ',' QWordConstExpr
3030         ',' QWordConstExpr
3031         ',' QWordConstExpr
3032         OptionalByteConstExpr
3033         OptionalStringData
3034         OptionalNameString
3035         OptionalType
3036         OptionalTranslationType_Last
3037         ')'                         {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);}
3038     | PARSEOP_QWORDIO '('
3039         error ')'                   {$$ = AslDoError(); yyclearin;}
3040     ;
3041 
3042 QWordMemoryTerm
3043     : PARSEOP_QWORDMEMORY '('       {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDMEMORY);}
3044         OptionalResourceType_First
3045         OptionalDecodeType
3046         OptionalMinType
3047         OptionalMaxType
3048         OptionalMemType
3049         ',' OptionalReadWriteKeyword
3050         ',' QWordConstExpr
3051         ',' QWordConstExpr
3052         ',' QWordConstExpr
3053         ',' QWordConstExpr
3054         ',' QWordConstExpr
3055         OptionalByteConstExpr
3056         OptionalStringData
3057         OptionalNameString
3058         OptionalAddressRange
3059         OptionalType_Last
3060         ')'                         {$$ = TrLinkChildren ($<n>3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);}
3061     | PARSEOP_QWORDMEMORY '('
3062         error ')'                   {$$ = AslDoError(); yyclearin;}
3063     ;
3064 
3065 QWordSpaceTerm
3066     : PARSEOP_QWORDSPACE '('        {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDSPACE);}
3067         ByteConstExpr               {UtCheckIntegerRange ($4, 0xC0, 0xFF);}
3068         OptionalResourceType
3069         OptionalDecodeType
3070         OptionalMinType
3071         OptionalMaxType
3072         ',' ByteConstExpr
3073         ',' QWordConstExpr
3074         ',' QWordConstExpr
3075         ',' QWordConstExpr
3076         ',' QWordConstExpr
3077         ',' QWordConstExpr
3078         OptionalByteConstExpr
3079         OptionalStringData
3080         OptionalNameString_Last
3081         ')'                         {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);}
3082     | PARSEOP_QWORDSPACE '('
3083         error ')'                   {$$ = AslDoError(); yyclearin;}
3084     ;
3085 
3086 RegisterTerm
3087     : PARSEOP_REGISTER '('          {$<n>$ = TrCreateLeafNode (PARSEOP_REGISTER);}
3088         AddressSpaceKeyword
3089         ',' ByteConstExpr
3090         ',' ByteConstExpr
3091         ',' QWordConstExpr
3092         OptionalAccessSize
3093         OptionalNameString_Last
3094         ')'                         {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$11,$12);}
3095     | PARSEOP_REGISTER '('
3096         error ')'                   {$$ = AslDoError(); yyclearin;}
3097     ;
3098 
3099 SpiSerialBusTerm
3100     : PARSEOP_SPI_SERIALBUS '('     {$<n>$ = TrCreateLeafNode (PARSEOP_SPI_SERIALBUS);}
3101         WordConstExpr               /* 04: DeviceSelection */
3102         OptionalDevicePolarity      /* 05: DevicePolarity */
3103         OptionalWireMode            /* 06: WireMode */
3104         ',' ByteConstExpr           /* 08: DataBitLength */
3105         OptionalSlaveMode           /* 09: SlaveMode */
3106         ',' DWordConstExpr          /* 11: ConnectionSpeed */
3107         ',' ClockPolarityKeyword    /* 13: ClockPolarity */
3108         ',' ClockPhaseKeyword       /* 15: ClockPhase */
3109         ',' StringData              /* 17: ResourceSource */
3110         OptionalByteConstExpr       /* 18: ResourceSourceIndex */
3111         OptionalResourceType        /* 19: ResourceType */
3112         OptionalNameString          /* 20: DescriptorName */
3113         OptionalBuffer_Last         /* 21: VendorData */
3114         ')'                         {$$ = TrLinkChildren ($<n>3,13,$4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20,$21);}
3115     | PARSEOP_SPI_SERIALBUS '('
3116         error ')'                   {$$ = AslDoError(); yyclearin;}
3117     ;
3118 
3119 StartDependentFnNoPriTerm
3120     : PARSEOP_STARTDEPENDENTFN_NOPRI '('    {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN_NOPRI);}
3121         ')' '{'
3122         ResourceMacroList '}'       {$$ = TrLinkChildren ($<n>3,1,$6);}
3123     | PARSEOP_STARTDEPENDENTFN_NOPRI '('
3124         error ')'                   {$$ = AslDoError(); yyclearin;}
3125     ;
3126 
3127 StartDependentFnTerm
3128     : PARSEOP_STARTDEPENDENTFN '('  {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN);}
3129         ByteConstExpr
3130         ',' ByteConstExpr
3131         ')' '{'
3132         ResourceMacroList '}'       {$$ = TrLinkChildren ($<n>3,3,$4,$6,$9);}
3133     | PARSEOP_STARTDEPENDENTFN '('
3134         error ')'                   {$$ = AslDoError(); yyclearin;}
3135     ;
3136 
3137 UartSerialBusTerm
3138     : PARSEOP_UART_SERIALBUS '('    {$<n>$ = TrCreateLeafNode (PARSEOP_UART_SERIALBUS);}
3139         DWordConstExpr              /* 04: ConnectionSpeed */
3140         OptionalBitsPerByte         /* 05: BitsPerByte */
3141         OptionalStopBits            /* 06: StopBits */
3142         ',' ByteConstExpr           /* 08: LinesInUse */
3143         OptionalEndian              /* 09: Endianess */
3144         OptionalParityType          /* 10: Parity */
3145         OptionalFlowControl         /* 11: FlowControl */
3146         ',' WordConstExpr           /* 13: Rx BufferSize */
3147         ',' WordConstExpr           /* 15: Tx BufferSize */
3148         ',' StringData              /* 17: ResourceSource */
3149         OptionalByteConstExpr       /* 18: ResourceSourceIndex */
3150         OptionalResourceType        /* 19: ResourceType */
3151         OptionalNameString          /* 20: DescriptorName */
3152         OptionalBuffer_Last         /* 21: VendorData */
3153         ')'                         {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20,$21);}
3154     | PARSEOP_UART_SERIALBUS '('
3155         error ')'                   {$$ = AslDoError(); yyclearin;}
3156     ;
3157 
3158 VendorLongTerm
3159     : PARSEOP_VENDORLONG '('        {$<n>$ = TrCreateLeafNode (PARSEOP_VENDORLONG);}
3160         OptionalNameString_First
3161         ')' '{'
3162             ByteList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
3163     | PARSEOP_VENDORLONG '('
3164         error ')'                   {$$ = AslDoError(); yyclearin;}
3165     ;
3166 
3167 VendorShortTerm
3168     : PARSEOP_VENDORSHORT '('       {$<n>$ = TrCreateLeafNode (PARSEOP_VENDORSHORT);}
3169         OptionalNameString_First
3170         ')' '{'
3171             ByteList '}'            {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
3172     | PARSEOP_VENDORSHORT '('
3173         error ')'                   {$$ = AslDoError(); yyclearin;}
3174     ;
3175 
3176 WordBusNumberTerm
3177     : PARSEOP_WORDBUSNUMBER '('     {$<n>$ = TrCreateLeafNode (PARSEOP_WORDBUSNUMBER);}
3178         OptionalResourceType_First
3179         OptionalMinType
3180         OptionalMaxType
3181         OptionalDecodeType
3182         ',' WordConstExpr
3183         ',' WordConstExpr
3184         ',' WordConstExpr
3185         ',' WordConstExpr
3186         ',' WordConstExpr
3187         OptionalByteConstExpr
3188         OptionalStringData
3189         OptionalNameString_Last
3190         ')'                         {$$ = TrLinkChildren ($<n>3,12,$4,$5,$6,$7,$9,$11,$13,$15,$17,$18,$19,$20);}
3191     | PARSEOP_WORDBUSNUMBER '('
3192         error ')'                   {$$ = AslDoError(); yyclearin;}
3193     ;
3194 
3195 WordIOTerm
3196     : PARSEOP_WORDIO '('            {$<n>$ = TrCreateLeafNode (PARSEOP_WORDIO);}
3197         OptionalResourceType_First
3198         OptionalMinType
3199         OptionalMaxType
3200         OptionalDecodeType
3201         OptionalRangeType
3202         ',' WordConstExpr
3203         ',' WordConstExpr
3204         ',' WordConstExpr
3205         ',' WordConstExpr
3206         ',' WordConstExpr
3207         OptionalByteConstExpr
3208         OptionalStringData
3209         OptionalNameString
3210         OptionalType
3211         OptionalTranslationType_Last
3212         ')'                         {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);}
3213     | PARSEOP_WORDIO '('
3214         error ')'                   {$$ = AslDoError(); yyclearin;}
3215     ;
3216 
3217 WordSpaceTerm
3218     : PARSEOP_WORDSPACE '('         {$<n>$ = TrCreateLeafNode (PARSEOP_WORDSPACE);}
3219         ByteConstExpr               {UtCheckIntegerRange ($4, 0xC0, 0xFF);}
3220         OptionalResourceType
3221         OptionalDecodeType
3222         OptionalMinType
3223         OptionalMaxType
3224         ',' ByteConstExpr
3225         ',' WordConstExpr
3226         ',' WordConstExpr
3227         ',' WordConstExpr
3228         ',' WordConstExpr
3229         ',' WordConstExpr
3230         OptionalByteConstExpr
3231         OptionalStringData
3232         OptionalNameString_Last
3233         ')'                         {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);}
3234     | PARSEOP_WORDSPACE '('
3235         error ')'                   {$$ = AslDoError(); yyclearin;}
3236     ;
3237 
3238 
3239 /******* Object References ***********************************************/
3240 
3241 /* Allow IO, DMA, IRQ Resource macro names to also be used as identifiers */
3242 
3243 NameString
3244     : NameSeg                       {}
3245     | PARSEOP_NAMESTRING            {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) AslCompilerlval.s);}
3246     | PARSEOP_IO                    {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");}
3247     | PARSEOP_DMA                   {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");}
3248     | PARSEOP_IRQ                   {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");}
3249     ;
3250 
3251 NameSeg
3252     : PARSEOP_NAMESEG               {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (ACPI_NATIVE_INT) AslCompilerlval.s);}
3253     ;
3254 
3255 
3256 /******* Helper rules ****************************************************/
3257 
3258 
3259 AmlPackageLengthTerm
3260     : Integer                       {$$ = TrUpdateNode (PARSEOP_PACKAGE_LENGTH,(ACPI_PARSE_OBJECT *) $1);}
3261     ;
3262 
3263 NameStringItem
3264     : ',' NameString                {$$ = $2;}
3265     | ',' error                     {$$ = AslDoError (); yyclearin;}
3266     ;
3267 
3268 TermArgItem
3269     : ',' TermArg                   {$$ = $2;}
3270     | ',' error                     {$$ = AslDoError (); yyclearin;}
3271     ;
3272 
3273 OptionalBusMasterKeyword
3274     : ','                                       {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);}
3275     | ',' PARSEOP_BUSMASTERTYPE_MASTER          {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);}
3276     | ',' PARSEOP_BUSMASTERTYPE_NOTMASTER       {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_NOTMASTER);}
3277     ;
3278 
3279 OptionalAccessAttribTerm
3280     :                               {$$ = NULL;}
3281     | ','                           {$$ = NULL;}
3282     | ',' ByteConstExpr             {$$ = $2;}
3283     | ',' AccessAttribKeyword       {$$ = $2;}
3284     ;
3285 
3286 OptionalAccessSize
3287     :                               {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);}
3288     | ','                           {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);}
3289     | ',' ByteConstExpr             {$$ = $2;}
3290     ;
3291 
3292 OptionalAddressingMode
3293     : ','                           {$$ = NULL;}
3294     | ',' AddressingModeKeyword     {$$ = $2;}
3295     ;
3296 
3297 OptionalAddressRange
3298     :                               {$$ = NULL;}
3299     | ','                           {$$ = NULL;}
3300     | ',' AddressKeyword            {$$ = $2;}
3301     ;
3302 
3303 OptionalBitsPerByte
3304     : ','                           {$$ = NULL;}
3305     | ',' BitsPerByteKeyword        {$$ = $2;}
3306     ;
3307 
3308 OptionalBuffer_Last
3309     :                               {$$ = NULL;}
3310     | ','                           {$$ = NULL;}
3311     | ',' DataBufferTerm            {$$ = $2;}
3312     ;
3313 
3314 OptionalByteConstExpr
3315     :                               {$$ = NULL;}
3316     | ','                           {$$ = NULL;}
3317     | ',' ByteConstExpr             {$$ = $2;}
3318     ;
3319 
3320 OptionalDecodeType
3321     : ','                           {$$ = NULL;}
3322     | ',' DecodeKeyword             {$$ = $2;}
3323     ;
3324 
3325 OptionalDevicePolarity
3326     : ','                           {$$ = NULL;}
3327     | ',' DevicePolarityKeyword     {$$ = $2;}
3328     ;
3329 
3330 OptionalDWordConstExpr
3331     :                               {$$ = NULL;}
3332     | ','                           {$$ = NULL;}
3333     | ',' DWordConstExpr            {$$ = $2;}
3334     ;
3335 
3336 OptionalEndian
3337     : ','                           {$$ = NULL;}
3338     | ',' EndianKeyword             {$$ = $2;}
3339     ;
3340 
3341 OptionalFlowControl
3342     : ','                           {$$ = NULL;}
3343     | ',' FlowControlKeyword        {$$ = $2;}
3344     ;
3345 
3346 OptionalIoRestriction
3347     : ','                           {$$ = NULL;}
3348     | ',' IoRestrictionKeyword      {$$ = $2;}
3349     ;
3350 
3351 OptionalListString
3352     :                               {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));}   /* Placeholder is a NULL string */
3353     | ','                           {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));}   /* Placeholder is a NULL string */
3354     | ',' TermArg                   {$$ = $2;}
3355     ;
3356 
3357 OptionalMaxType
3358     : ','                           {$$ = NULL;}
3359     | ',' MaxKeyword                {$$ = $2;}
3360     ;
3361 
3362 OptionalMemType
3363     : ','                           {$$ = NULL;}
3364     | ',' MemTypeKeyword            {$$ = $2;}
3365     ;
3366 
3367 OptionalMinType
3368     : ','                           {$$ = NULL;}
3369     | ',' MinKeyword                {$$ = $2;}
3370     ;
3371 
3372 OptionalNameString
3373     :                               {$$ = NULL;}
3374     | ','                           {$$ = NULL;}
3375     | ',' NameString                {$$ = $2;}
3376     ;
3377 
3378 OptionalNameString_Last
3379     :                               {$$ = NULL;}
3380     | ','                           {$$ = NULL;}
3381     | ',' NameString                {$$ = $2;}
3382     ;
3383 
3384 OptionalNameString_First
3385     :                               {$$ = TrCreateLeafNode (PARSEOP_ZERO);}
3386     | NameString                    {$$ = $1;}
3387     ;
3388 
3389 OptionalObjectTypeKeyword
3390     :                               {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);}
3391     | ',' ObjectTypeKeyword         {$$ = $2;}
3392     ;
3393 
3394 OptionalParityType
3395     : ','                           {$$ = NULL;}
3396     | ',' ParityTypeKeyword         {$$ = $2;}
3397     ;
3398 
3399 OptionalQWordConstExpr
3400     :                               {$$ = NULL;}
3401     | ','                           {$$ = NULL;}
3402     | ',' QWordConstExpr            {$$ = $2;}
3403     ;
3404 
3405 OptionalRangeType
3406     : ','                           {$$ = NULL;}
3407     | ',' RangeTypeKeyword          {$$ = $2;}
3408     ;
3409 
3410 OptionalReadWriteKeyword
3411     :                                   {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);}
3412     | PARSEOP_READWRITETYPE_BOTH        {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);}
3413     | PARSEOP_READWRITETYPE_READONLY    {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_READONLY);}
3414     ;
3415 
3416 OptionalReference
3417     :                               {$$ = TrCreateLeafNode (PARSEOP_ZERO);}       /* Placeholder is a ZeroOp object */
3418     | ','                           {$$ = TrCreateLeafNode (PARSEOP_ZERO);}       /* Placeholder is a ZeroOp object */
3419     | ',' TermArg                   {$$ = $2;}
3420     ;
3421 
3422 OptionalResourceType_First
3423     :                               {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);}
3424     | ResourceTypeKeyword           {$$ = $1;}
3425     ;
3426 
3427 OptionalResourceType
3428     :                               {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);}
3429     | ','                           {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);}
3430     | ',' ResourceTypeKeyword       {$$ = $2;}
3431     ;
3432 
3433 OptionalReturnArg
3434     :                               {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);}       /* Placeholder is a ZeroOp object */
3435     | TermArg                       {$$ = $1;}
3436     ;
3437 
3438 OptionalSerializeRuleKeyword
3439     :                               {$$ = NULL;}
3440     | ','                           {$$ = NULL;}
3441     | ',' SerializeRuleKeyword      {$$ = $2;}
3442     ;
3443 
3444 OptionalSlaveMode
3445     : ','                           {$$ = NULL;}
3446     | ',' SlaveModeKeyword          {$$ = $2;}
3447     ;
3448 
3449 OptionalShareType
3450     :                               {$$ = NULL;}
3451     | ','                           {$$ = NULL;}
3452     | ',' ShareTypeKeyword          {$$ = $2;}
3453     ;
3454 
3455 OptionalShareType_First
3456     :                               {$$ = NULL;}
3457     | ShareTypeKeyword              {$$ = $1;}
3458     ;
3459 
3460 OptionalStopBits
3461     : ','                           {$$ = NULL;}
3462     | ',' StopBitsKeyword           {$$ = $2;}
3463     ;
3464 
3465 OptionalStringData
3466     :                               {$$ = NULL;}
3467     | ','                           {$$ = NULL;}
3468     | ',' StringData                {$$ = $2;}
3469     ;
3470 
3471 OptionalTermArg
3472     :                               {$$ = NULL;}
3473     | TermArg                       {$$ = $1;}
3474     ;
3475 
3476 OptionalType
3477     :                               {$$ = NULL;}
3478     | ','                           {$$ = NULL;}
3479     | ',' TypeKeyword               {$$ = $2;}
3480     ;
3481 
3482 OptionalType_Last
3483     :                               {$$ = NULL;}
3484     | ','                           {$$ = NULL;}
3485     | ',' TypeKeyword               {$$ = $2;}
3486     ;
3487 
3488 OptionalTranslationType_Last
3489     :                               {$$ = NULL;}
3490     | ','                           {$$ = NULL;}
3491     | ',' TranslationKeyword        {$$ = $2;}
3492     ;
3493 
3494 OptionalWireMode
3495     : ','                           {$$ = NULL;}
3496     | ',' WireModeKeyword           {$$ = $2;}
3497     ;
3498 
3499 OptionalWordConst
3500     :                               {$$ = NULL;}
3501     | WordConst                     {$$ = $1;}
3502     ;
3503 
3504 OptionalWordConstExpr
3505     : ','                           {$$ = NULL;}
3506     | ',' WordConstExpr             {$$ = $2;}
3507     ;
3508 
3509 OptionalXferSize
3510     :                               {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);}
3511     | ','                           {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);}
3512     | ',' XferSizeKeyword           {$$ = $2;}
3513     ;
3514 
3515 %%
3516 /******************************************************************************
3517  *
3518  * Local support functions
3519  *
3520  *****************************************************************************/
3521 
3522 int
3523 AslCompilerwrap(void)
3524 {
3525   return (1);
3526 }
3527 
3528 /*! [End] no source code translation !*/
3529 
3530 void *
3531 AslLocalAllocate (unsigned int Size)
3532 {
3533     void                *Mem;
3534 
3535 
3536     DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %u\n\n", Size);
3537 
3538     Mem = ACPI_ALLOCATE_ZEROED (Size);
3539     if (!Mem)
3540     {
3541         AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
3542                         Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
3543                         Gbl_InputByteCount, Gbl_CurrentColumn,
3544                         Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
3545         exit (1);
3546     }
3547 
3548     return (Mem);
3549 }
3550 
3551 ACPI_PARSE_OBJECT *
3552 AslDoError (void)
3553 {
3554 
3555 
3556     return (TrCreateLeafNode (PARSEOP_ERRORNODE));
3557 
3558 }
3559 
3560 
3561 /*******************************************************************************
3562  *
3563  * FUNCTION:    UtGetOpName
3564  *
3565  * PARAMETERS:  ParseOpcode         - Parser keyword ID
3566  *
3567  * RETURN:      Pointer to the opcode name
3568  *
3569  * DESCRIPTION: Get the ascii name of the parse opcode
3570  *
3571  ******************************************************************************/
3572 
3573 char *
3574 UtGetOpName (
3575     UINT32                  ParseOpcode)
3576 {
3577 #ifdef ASL_YYTNAME_START
3578     /*
3579      * First entries (ASL_YYTNAME_START) in yytname are special reserved names.
3580      * Ignore first 8 characters of the name
3581      */
3582     return ((char *) yytname
3583         [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
3584 #else
3585     return ("[Unknown parser generator]");
3586 #endif
3587 }