From f97cb5676fea70d8e26f69381d0e033cfafd45ca Mon Sep 17 00:00:00 2001 From: Al Stone Date: Oct 24 2019 01:23:11 +0000 Subject: Update upstream source from tag 'upstream/20190704' Update to upstream version '20190704' with Debian dir c9a196d68f2185195428e2a1ff2553c5ddb01b2a --- diff --git a/changes.txt b/changes.txt index 6d77249..0020457 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,53 @@ ---------------------------------------- +03 July 2019. Summary of changes for version 20190703: + + +1) ACPICA kernel-resident subsystem: + +Remove legacy module-level support code. There were still some remnants +of the legacy module-level code executions. Since we no longer support +this option, this is essentially dead code and has been removed from the +ACPICA source. + +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root +scope. If these named objects are declared outside the root scope, they +will not be invoked by any host Operating System. + +Clear status of GPEs on first direct enable. ACPI GPEs (other than the EC +one) can be enabled in two situations. First, the GPEs with existing _Lxx +and _Exx methods are enabled implicitly by ACPICA during system +initialization. Second, the GPEs without these methods (like GPEs listed +by _PRW objects for wakeup devices) need to be enabled directly by the +code that is going to use them (e.g. ACPI power management or device +drivers). + +In the former case, if the status of a given GPE is set to start with, +its handler method (either _Lxx or _Exx) needs to be invoked to take care +of the events (possibly) signaled before the GPE was enabled. In the +latter case, however, the first caller of AcpiEnableGpe() for a given GPE +should not be expected to care about any events that might be signaled +through it earlier. In that case, it is better to clear the status of +the GPE before enabling it, to prevent stale events from triggering +unwanted actions (like spurious system resume, for example). + +For this reason, modify AcpiEvAddGpeReference() to take an additional +boolean argument indicating whether or not the GPE status needs to be +cleared when its reference counter changes from zero to one and make +AcpiEnableGpe() pass TRUE to it through that new argument. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +The tool generation process has been migrated to MSVC 2017, and all +project files have been upgraded. The new project files appear in the +directory \acpica\generate\msvc2017. This change effectively deprecates +the older project files in \acpica\generate\msvc9. + +iASL: ensure that _WAK, _PTS, _TTS, and _Sx are declared only at the root +scope. If these named objects are declared outside the root scope, they +will not be invoked by any host Operating System + +---------------------------------------- 09 May 2019. Summary of changes for version 20190509: diff --git a/source/compiler/aslcompiler.y b/source/compiler/aslcompiler.y new file mode 100755 index 0000000..210a054 --- /dev/null +++ b/source/compiler/aslcompiler.y @@ -0,0 +1,4813 @@ +%{ +/****************************************************************************** + * + * Module Name: aslparser.y - Master Bison/Yacc input file for iASL + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2019, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "aslcompiler.h" +#include "acpi.h" +#include "accommon.h" + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslparse") + +/* + * Global Notes: + * + * October 2005: The following list terms have been optimized (from the + * original ASL grammar in the ACPI specification) to force the immediate + * reduction of each list item so that the parse stack use doesn't increase on + * each list element and possibly overflow on very large lists (>4000 items). + * This dramatically reduces use of the parse stack overall. + * + * ArgList, TermList, ByteList, DWordList, PackageList, + * ResourceMacroList, and FieldUnitList + */ + +void * +AslLocalAllocate ( + unsigned int Size); + + +/* Bison/yacc configuration */ + +#define static +#undef malloc +#define malloc AslLocalAllocate +#undef alloca +#define alloca AslLocalAllocate +#define yytname AslCompilername + +#define YYINITDEPTH 600 /* State stack depth */ +#define YYDEBUG 1 /* Enable debug output */ +#define YYERROR_VERBOSE 1 /* Verbose error messages */ +#define YYFLAG -32768 + +/* Define YYMALLOC/YYFREE to prevent redefinition errors */ + +#define YYMALLOC AslLocalAllocate +#define YYFREE ACPI_FREE +%} + +/* + * Declare the type of values in the grammar + */ +%union { + UINT64 i; + char *s; + ACPI_PARSE_OBJECT *n; +} + +/* + * These shift/reduce conflicts are expected. There should be zero + * reduce/reduce conflicts. + */ +%expect 124 + +/*! [Begin] no source code translation */ + +/* + * The M4 macro processor is used to bring in the parser items, + * in order to keep this master file smaller, and to break up + * the various parser items. + */ + + +/* Token types */ + + + +/****************************************************************************** + * + * Token types: These are returned by the lexer + * + * NOTE: This list MUST match the AslKeywordMapping table found + * in aslmap.c EXACTLY! Double check any changes! + * + *****************************************************************************/ + +/* + * Most tokens are defined to return , which is a UINT64. + * + * These tokens return , a pointer to the associated lexed string: + * + * PARSEOP_NAMESEG + * PARSEOP_NAMESTRING + * PARSEOP_STRING_LITERAL + * PARSEOP_STRUCTURE_NAMESTRING + */ +%token PARSEOP_ACCESSAS +%token PARSEOP_ACCESSATTRIB_BLOCK +%token PARSEOP_ACCESSATTRIB_BLOCK_CALL +%token PARSEOP_ACCESSATTRIB_BYTE +%token PARSEOP_ACCESSATTRIB_BYTES +%token PARSEOP_ACCESSATTRIB_QUICK +%token PARSEOP_ACCESSATTRIB_RAW_BYTES +%token PARSEOP_ACCESSATTRIB_RAW_PROCESS +%token PARSEOP_ACCESSATTRIB_SND_RCV +%token PARSEOP_ACCESSATTRIB_WORD +%token PARSEOP_ACCESSATTRIB_WORD_CALL +%token PARSEOP_ACCESSTYPE_ANY +%token PARSEOP_ACCESSTYPE_BUF +%token PARSEOP_ACCESSTYPE_BYTE +%token PARSEOP_ACCESSTYPE_DWORD +%token PARSEOP_ACCESSTYPE_QWORD +%token PARSEOP_ACCESSTYPE_WORD +%token PARSEOP_ACQUIRE +%token PARSEOP_ADD +%token PARSEOP_ADDRESSINGMODE_7BIT +%token PARSEOP_ADDRESSINGMODE_10BIT +%token PARSEOP_ADDRESSTYPE_ACPI +%token PARSEOP_ADDRESSTYPE_MEMORY +%token PARSEOP_ADDRESSTYPE_NVS +%token PARSEOP_ADDRESSTYPE_RESERVED +%token PARSEOP_ALIAS +%token PARSEOP_AND +%token PARSEOP_ARG0 +%token PARSEOP_ARG1 +%token PARSEOP_ARG2 +%token PARSEOP_ARG3 +%token PARSEOP_ARG4 +%token PARSEOP_ARG5 +%token PARSEOP_ARG6 +%token PARSEOP_BANKFIELD +%token PARSEOP_BITSPERBYTE_EIGHT +%token PARSEOP_BITSPERBYTE_FIVE +%token PARSEOP_BITSPERBYTE_NINE +%token PARSEOP_BITSPERBYTE_SEVEN +%token PARSEOP_BITSPERBYTE_SIX +%token PARSEOP_BREAK +%token PARSEOP_BREAKPOINT +%token PARSEOP_BUFFER +%token PARSEOP_BUSMASTERTYPE_MASTER +%token PARSEOP_BUSMASTERTYPE_NOTMASTER +%token PARSEOP_BYTECONST +%token PARSEOP_CASE +%token PARSEOP_CLOCKPHASE_FIRST +%token PARSEOP_CLOCKPHASE_SECOND +%token PARSEOP_CLOCKPOLARITY_HIGH +%token PARSEOP_CLOCKPOLARITY_LOW +%token PARSEOP_CONCATENATE +%token PARSEOP_CONCATENATERESTEMPLATE +%token PARSEOP_CONDREFOF +%token PARSEOP_CONNECTION +%token PARSEOP_CONTINUE +%token PARSEOP_COPYOBJECT +%token PARSEOP_CREATEBITFIELD +%token PARSEOP_CREATEBYTEFIELD +%token PARSEOP_CREATEDWORDFIELD +%token PARSEOP_CREATEFIELD +%token PARSEOP_CREATEQWORDFIELD +%token PARSEOP_CREATEWORDFIELD +%token PARSEOP_DATABUFFER +%token PARSEOP_DATATABLEREGION +%token PARSEOP_DEBUG +%token PARSEOP_DECODETYPE_POS +%token PARSEOP_DECODETYPE_SUB +%token PARSEOP_DECREMENT +%token PARSEOP_DEFAULT +%token PARSEOP_DEFAULT_ARG +%token PARSEOP_DEFINITION_BLOCK +%token PARSEOP_DEREFOF +%token PARSEOP_DEVICE +%token PARSEOP_DEVICEPOLARITY_HIGH +%token PARSEOP_DEVICEPOLARITY_LOW +%token PARSEOP_DIVIDE +%token PARSEOP_DMA +%token PARSEOP_DMATYPE_A +%token PARSEOP_DMATYPE_COMPATIBILITY +%token PARSEOP_DMATYPE_B +%token PARSEOP_DMATYPE_F +%token PARSEOP_DWORDCONST +%token PARSEOP_DWORDIO +%token PARSEOP_DWORDMEMORY +%token PARSEOP_DWORDSPACE +%token PARSEOP_EISAID +%token PARSEOP_ELSE +%token PARSEOP_ELSEIF +%token PARSEOP_ENDDEPENDENTFN +%token PARSEOP_ENDIAN_BIG +%token PARSEOP_ENDIAN_LITTLE +%token PARSEOP_ENDTAG +%token PARSEOP_ERRORNODE +%token PARSEOP_EVENT +%token PARSEOP_EXTENDEDIO +%token PARSEOP_EXTENDEDMEMORY +%token PARSEOP_EXTENDEDSPACE +%token PARSEOP_EXTERNAL +%token PARSEOP_FATAL +%token PARSEOP_FIELD +%token PARSEOP_FINDSETLEFTBIT +%token PARSEOP_FINDSETRIGHTBIT +%token PARSEOP_FIXEDDMA +%token PARSEOP_FIXEDIO +%token PARSEOP_FLOWCONTROL_HW +%token PARSEOP_FLOWCONTROL_NONE +%token PARSEOP_FLOWCONTROL_SW +%token PARSEOP_FROMBCD +%token PARSEOP_FUNCTION +%token PARSEOP_GPIO_INT +%token PARSEOP_GPIO_IO +%token PARSEOP_I2C_SERIALBUS +%token PARSEOP_I2C_SERIALBUS_V2 +%token PARSEOP_IF +%token PARSEOP_INCLUDE +%token PARSEOP_INCLUDE_END +%token PARSEOP_INCREMENT +%token PARSEOP_INDEX +%token PARSEOP_INDEXFIELD +%token PARSEOP_INTEGER +%token PARSEOP_INTERRUPT +%token PARSEOP_INTLEVEL_ACTIVEBOTH +%token PARSEOP_INTLEVEL_ACTIVEHIGH +%token PARSEOP_INTLEVEL_ACTIVELOW +%token PARSEOP_INTTYPE_EDGE +%token PARSEOP_INTTYPE_LEVEL +%token PARSEOP_IO +%token PARSEOP_IODECODETYPE_10 +%token PARSEOP_IODECODETYPE_16 +%token PARSEOP_IORESTRICT_IN +%token PARSEOP_IORESTRICT_NONE +%token PARSEOP_IORESTRICT_OUT +%token PARSEOP_IORESTRICT_PRESERVE +%token PARSEOP_IRQ +%token PARSEOP_IRQNOFLAGS +%token PARSEOP_LAND +%token PARSEOP_LEQUAL +%token PARSEOP_LGREATER +%token PARSEOP_LGREATEREQUAL +%token PARSEOP_LLESS +%token PARSEOP_LLESSEQUAL +%token PARSEOP_LNOT +%token PARSEOP_LNOTEQUAL +%token PARSEOP_LOAD +%token PARSEOP_LOADTABLE +%token PARSEOP_LOCAL0 +%token PARSEOP_LOCAL1 +%token PARSEOP_LOCAL2 +%token PARSEOP_LOCAL3 +%token PARSEOP_LOCAL4 +%token PARSEOP_LOCAL5 +%token PARSEOP_LOCAL6 +%token PARSEOP_LOCAL7 +%token PARSEOP_LOCKRULE_LOCK +%token PARSEOP_LOCKRULE_NOLOCK +%token PARSEOP_LOR +%token PARSEOP_MATCH +%token PARSEOP_MATCHTYPE_MEQ +%token PARSEOP_MATCHTYPE_MGE +%token PARSEOP_MATCHTYPE_MGT +%token PARSEOP_MATCHTYPE_MLE +%token PARSEOP_MATCHTYPE_MLT +%token PARSEOP_MATCHTYPE_MTR +%token PARSEOP_MAXTYPE_FIXED +%token PARSEOP_MAXTYPE_NOTFIXED +%token PARSEOP_MEMORY24 +%token PARSEOP_MEMORY32 +%token PARSEOP_MEMORY32FIXED +%token PARSEOP_MEMTYPE_CACHEABLE +%token PARSEOP_MEMTYPE_NONCACHEABLE +%token PARSEOP_MEMTYPE_PREFETCHABLE +%token PARSEOP_MEMTYPE_WRITECOMBINING +%token PARSEOP_METHOD +%token PARSEOP_METHODCALL +%token PARSEOP_MID +%token PARSEOP_MINTYPE_FIXED +%token PARSEOP_MINTYPE_NOTFIXED +%token PARSEOP_MOD +%token PARSEOP_MULTIPLY +%token PARSEOP_MUTEX +%token PARSEOP_NAME +%token PARSEOP_NAMESEG +%token PARSEOP_NAMESTRING +%token PARSEOP_NAND +%token PARSEOP_NOOP +%token PARSEOP_NOR +%token PARSEOP_NOT +%token PARSEOP_NOTIFY +%token PARSEOP_OBJECTTYPE +%token PARSEOP_OBJECTTYPE_BFF +%token PARSEOP_OBJECTTYPE_BUF +%token PARSEOP_OBJECTTYPE_DDB +%token PARSEOP_OBJECTTYPE_DEV +%token PARSEOP_OBJECTTYPE_EVT +%token PARSEOP_OBJECTTYPE_FLD +%token PARSEOP_OBJECTTYPE_INT +%token PARSEOP_OBJECTTYPE_MTH +%token PARSEOP_OBJECTTYPE_MTX +%token PARSEOP_OBJECTTYPE_OPR +%token PARSEOP_OBJECTTYPE_PKG +%token PARSEOP_OBJECTTYPE_POW +%token PARSEOP_OBJECTTYPE_PRO +%token PARSEOP_OBJECTTYPE_STR +%token PARSEOP_OBJECTTYPE_THZ +%token PARSEOP_OBJECTTYPE_UNK +%token PARSEOP_OFFSET +%token PARSEOP_ONE +%token PARSEOP_ONES +%token PARSEOP_OPERATIONREGION +%token PARSEOP_OR +%token PARSEOP_PACKAGE +%token PARSEOP_PACKAGE_LENGTH +%token PARSEOP_PARITYTYPE_EVEN +%token PARSEOP_PARITYTYPE_MARK +%token PARSEOP_PARITYTYPE_NONE +%token PARSEOP_PARITYTYPE_ODD +%token PARSEOP_PARITYTYPE_SPACE +%token PARSEOP_PINCONFIG +%token PARSEOP_PINFUNCTION +%token PARSEOP_PINGROUP +%token PARSEOP_PINGROUPCONFIG +%token PARSEOP_PINGROUPFUNCTION +%token PARSEOP_PIN_NOPULL +%token PARSEOP_PIN_PULLDEFAULT +%token PARSEOP_PIN_PULLDOWN +%token PARSEOP_PIN_PULLUP +%token PARSEOP_POWERRESOURCE +%token PARSEOP_PROCESSOR +%token PARSEOP_QWORDCONST +%token PARSEOP_QWORDIO +%token PARSEOP_QWORDMEMORY +%token PARSEOP_QWORDSPACE +%token PARSEOP_RANGETYPE_ENTIRE +%token PARSEOP_RANGETYPE_ISAONLY +%token PARSEOP_RANGETYPE_NONISAONLY +%token PARSEOP_RAW_DATA +%token PARSEOP_READWRITETYPE_BOTH +%token PARSEOP_READWRITETYPE_READONLY +%token PARSEOP_REFOF +%token PARSEOP_REGIONSPACE_CMOS +%token PARSEOP_REGIONSPACE_EC +%token PARSEOP_REGIONSPACE_FFIXEDHW +%token PARSEOP_REGIONSPACE_GPIO +%token PARSEOP_REGIONSPACE_GSBUS +%token PARSEOP_REGIONSPACE_IO +%token PARSEOP_REGIONSPACE_IPMI +%token PARSEOP_REGIONSPACE_MEM +%token PARSEOP_REGIONSPACE_PCC +%token PARSEOP_REGIONSPACE_PCI +%token PARSEOP_REGIONSPACE_PCIBAR +%token PARSEOP_REGIONSPACE_SMBUS +%token PARSEOP_REGISTER +%token PARSEOP_RELEASE +%token PARSEOP_RESERVED_BYTES +%token PARSEOP_RESET +%token PARSEOP_RESOURCETEMPLATE +%token PARSEOP_RESOURCETYPE_CONSUMER +%token PARSEOP_RESOURCETYPE_PRODUCER +%token PARSEOP_RETURN +%token PARSEOP_REVISION +%token PARSEOP_SCOPE +%token PARSEOP_SERIALIZERULE_NOTSERIAL +%token PARSEOP_SERIALIZERULE_SERIAL +%token PARSEOP_SHARETYPE_EXCLUSIVE +%token PARSEOP_SHARETYPE_EXCLUSIVEWAKE +%token PARSEOP_SHARETYPE_SHARED +%token PARSEOP_SHARETYPE_SHAREDWAKE +%token PARSEOP_SHIFTLEFT +%token PARSEOP_SHIFTRIGHT +%token PARSEOP_SIGNAL +%token PARSEOP_SIZEOF +%token PARSEOP_SLAVEMODE_CONTROLLERINIT +%token PARSEOP_SLAVEMODE_DEVICEINIT +%token PARSEOP_SLEEP +%token PARSEOP_SPI_SERIALBUS +%token PARSEOP_SPI_SERIALBUS_V2 +%token PARSEOP_STALL +%token PARSEOP_STARTDEPENDENTFN +%token PARSEOP_STARTDEPENDENTFN_NOPRI +%token PARSEOP_STOPBITS_ONE +%token PARSEOP_STOPBITS_ONEPLUSHALF +%token PARSEOP_STOPBITS_TWO +%token PARSEOP_STOPBITS_ZERO +%token PARSEOP_STORE +%token PARSEOP_STRING_LITERAL +%token PARSEOP_SUBTRACT +%token PARSEOP_SWITCH +%token PARSEOP_THERMALZONE +%token PARSEOP_TIMER +%token PARSEOP_TOBCD +%token PARSEOP_TOBUFFER +%token PARSEOP_TODECIMALSTRING +%token PARSEOP_TOHEXSTRING +%token PARSEOP_TOINTEGER +%token PARSEOP_TOSTRING +%token PARSEOP_TOUUID +%token PARSEOP_TRANSLATIONTYPE_DENSE +%token PARSEOP_TRANSLATIONTYPE_SPARSE +%token PARSEOP_TYPE_STATIC +%token PARSEOP_TYPE_TRANSLATION +%token PARSEOP_UART_SERIALBUS +%token PARSEOP_UART_SERIALBUS_V2 +%token PARSEOP_UNICODE +%token PARSEOP_UNLOAD +%token PARSEOP_UPDATERULE_ONES +%token PARSEOP_UPDATERULE_PRESERVE +%token PARSEOP_UPDATERULE_ZEROS +%token PARSEOP_VAR_PACKAGE +%token PARSEOP_VENDORLONG +%token PARSEOP_VENDORSHORT +%token PARSEOP_WAIT +%token PARSEOP_WHILE +%token PARSEOP_WIREMODE_FOUR +%token PARSEOP_WIREMODE_THREE +%token PARSEOP_WORDBUSNUMBER +%token PARSEOP_WORDCONST +%token PARSEOP_WORDIO +%token PARSEOP_WORDSPACE +%token PARSEOP_XFERSIZE_8 +%token PARSEOP_XFERSIZE_16 +%token PARSEOP_XFERSIZE_32 +%token PARSEOP_XFERSIZE_64 +%token PARSEOP_XFERSIZE_128 +%token PARSEOP_XFERSIZE_256 +%token PARSEOP_XFERTYPE_8 +%token PARSEOP_XFERTYPE_8_16 +%token PARSEOP_XFERTYPE_16 +%token PARSEOP_XOR +%token PARSEOP_ZERO + +/* ToPld macro */ + +%token PARSEOP_TOPLD +%token PARSEOP_PLD_REVISION +%token PARSEOP_PLD_IGNORECOLOR +%token PARSEOP_PLD_RED +%token PARSEOP_PLD_GREEN +%token PARSEOP_PLD_BLUE +%token PARSEOP_PLD_WIDTH +%token PARSEOP_PLD_HEIGHT +%token PARSEOP_PLD_USERVISIBLE +%token PARSEOP_PLD_DOCK +%token PARSEOP_PLD_LID +%token PARSEOP_PLD_PANEL +%token PARSEOP_PLD_VERTICALPOSITION +%token PARSEOP_PLD_HORIZONTALPOSITION +%token PARSEOP_PLD_SHAPE +%token PARSEOP_PLD_GROUPORIENTATION +%token PARSEOP_PLD_GROUPTOKEN +%token PARSEOP_PLD_GROUPPOSITION +%token PARSEOP_PLD_BAY +%token PARSEOP_PLD_EJECTABLE +%token PARSEOP_PLD_EJECTREQUIRED +%token PARSEOP_PLD_CABINETNUMBER +%token PARSEOP_PLD_CARDCAGENUMBER +%token PARSEOP_PLD_REFERENCE +%token PARSEOP_PLD_ROTATION +%token PARSEOP_PLD_ORDER +%token PARSEOP_PLD_RESERVED +%token PARSEOP_PLD_VERTICALOFFSET +%token PARSEOP_PLD_HORIZONTALOFFSET + +/* + * C-style expression parser. These must appear after all of the + * standard ASL operators and keywords. + * + * Note: The order of these tokens implements the precedence rules + * (low precedence to high). See aslrules.y for an exhaustive list. + */ +%right PARSEOP_EXP_EQUALS + PARSEOP_EXP_ADD_EQ + PARSEOP_EXP_SUB_EQ + PARSEOP_EXP_MUL_EQ + PARSEOP_EXP_DIV_EQ + PARSEOP_EXP_MOD_EQ + PARSEOP_EXP_SHL_EQ + PARSEOP_EXP_SHR_EQ + PARSEOP_EXP_AND_EQ + PARSEOP_EXP_XOR_EQ + PARSEOP_EXP_OR_EQ + +%left PARSEOP_EXP_LOGICAL_OR +%left PARSEOP_EXP_LOGICAL_AND +%left PARSEOP_EXP_OR +%left PARSEOP_EXP_XOR +%left PARSEOP_EXP_AND +%left PARSEOP_EXP_EQUAL + PARSEOP_EXP_NOT_EQUAL +%left PARSEOP_EXP_GREATER + PARSEOP_EXP_LESS + PARSEOP_EXP_GREATER_EQUAL + PARSEOP_EXP_LESS_EQUAL +%left PARSEOP_EXP_SHIFT_RIGHT + PARSEOP_EXP_SHIFT_LEFT +%left PARSEOP_EXP_ADD + PARSEOP_EXP_SUBTRACT +%left PARSEOP_EXP_MULTIPLY + PARSEOP_EXP_DIVIDE + PARSEOP_EXP_MODULO + +%right PARSEOP_EXP_NOT + PARSEOP_EXP_LOGICAL_NOT + +%left PARSEOP_EXP_INCREMENT + PARSEOP_EXP_DECREMENT + +%left PARSEOP_OPEN_PAREN + PARSEOP_CLOSE_PAREN + +/* Brackets for Index() support */ + +%left PARSEOP_EXP_INDEX_LEFT +%right PARSEOP_EXP_INDEX_RIGHT + +/* Macros */ + +%token PARSEOP_PRINTF +%token PARSEOP_FPRINTF +%token PARSEOP_FOR + +/* Structures */ + +%token PARSEOP_STRUCTURE +%token PARSEOP_STRUCTURE_NAMESTRING +%token PARSEOP_STRUCTURE_TAG +%token PARSEOP_STRUCTURE_ELEMENT +%token PARSEOP_STRUCTURE_INSTANCE +%token PARSEOP_STRUCTURE_REFERENCE +%token PARSEOP_STRUCTURE_POINTER + +/* Top level */ + +%token PARSEOP_ASL_CODE + + +/******************************************************************************* + * + * Tokens below are not in the aslmap.c file + * + ******************************************************************************/ + + +/* Tokens below this are not in the aslmap.c file */ + +/* Specific parentheses tokens are not used at this time */ + /* PARSEOP_EXP_PAREN_OPEN */ + /* PARSEOP_EXP_PAREN_CLOSE */ + +/* ASL+ variable creation */ + +%token PARSEOP_INTEGER_TYPE +%token PARSEOP_STRING_TYPE +%token PARSEOP_BUFFER_TYPE +%token PARSEOP_PACKAGE_TYPE +%token PARSEOP_REFERENCE_TYPE + + +/* + * Special functions. These should probably stay at the end of this + * table. + */ +%token PARSEOP___DATE__ +%token PARSEOP___FILE__ +%token PARSEOP___LINE__ +%token PARSEOP___PATH__ +%token PARSEOP___METHOD__ + + +/* Production types/names */ + + + +/****************************************************************************** + * + * Production names + * + *****************************************************************************/ + +%type ArgList +%type AslCode +%type BufferData +%type BufferTermData +%type CompilerDirective +%type DataObject +%type DefinitionBlockTerm +%type DefinitionBlockList +%type IntegerData +%type NamedObject +%type NameSpaceModifier +%type Object +%type PackageData +%type ParameterTypePackage +%type ParameterTypePackageList +%type ParameterTypesPackage +%type ParameterTypesPackageList +%type RequiredTarget +%type SimpleName +%type StringData +%type Target +%type Term +%type TermArg +%type TermList +%type MethodInvocationTerm + +/* Type4Opcode is obsolete */ + +%type Type1Opcode +%type Type2BufferOpcode +%type Type2BufferOrStringOpcode +%type Type2IntegerOpcode +%type Type2Opcode +%type Type2StringOpcode +%type Type3Opcode +%type Type5Opcode +%type Type6Opcode + +%type AccessAsTerm +%type ExternalTerm +%type FieldUnit +%type FieldUnitEntry +%type FieldUnitList +%type IncludeTerm +%type OffsetTerm +%type OptionalAccessAttribTerm + +/* Named Objects */ + +%type BankFieldTerm +%type CreateBitFieldTerm +%type CreateByteFieldTerm +%type CreateDWordFieldTerm +%type CreateFieldTerm +%type CreateQWordFieldTerm +%type CreateWordFieldTerm +%type DataRegionTerm +%type DeviceTerm +%type EventTerm +%type FieldTerm +%type FunctionTerm +%type IndexFieldTerm +%type MethodTerm +%type MutexTerm +%type OpRegionTerm +%type OpRegionSpaceIdTerm +%type PowerResTerm +%type ProcessorTerm +%type ThermalZoneTerm + +/* Namespace modifiers */ + +%type AliasTerm +%type NameTerm +%type ScopeTerm + +/* Type 1 opcodes */ + +%type BreakPointTerm +%type BreakTerm +%type CaseDefaultTermList +%type CaseTerm +%type ContinueTerm +%type DefaultTerm +%type ElseTerm +%type FatalTerm +%type ElseIfTerm +%type IfTerm +%type LoadTerm +%type NoOpTerm +%type NotifyTerm +%type ReleaseTerm +%type ResetTerm +%type ReturnTerm +%type SignalTerm +%type SleepTerm +%type StallTerm +%type SwitchTerm +%type UnloadTerm +%type WhileTerm +/* %type CaseTermList */ + +/* Type 2 opcodes */ + +%type AcquireTerm +%type AddTerm +%type AndTerm +%type ConcatResTerm +%type ConcatTerm +%type CondRefOfTerm +%type CopyObjectTerm +%type DecTerm +%type DerefOfTerm +%type DivideTerm +%type FindSetLeftBitTerm +%type FindSetRightBitTerm +%type FromBCDTerm +%type IncTerm +%type IndexTerm +%type LAndTerm +%type LEqualTerm +%type LGreaterEqualTerm +%type LGreaterTerm +%type LLessEqualTerm +%type LLessTerm +%type LNotEqualTerm +%type LNotTerm +%type LoadTableTerm +%type LOrTerm +%type MatchTerm +%type MidTerm +%type ModTerm +%type MultiplyTerm +%type NAndTerm +%type NOrTerm +%type NotTerm +%type ObjectTypeTerm +%type OrTerm +%type RawDataBufferTerm +%type RefOfTerm +%type ShiftLeftTerm +%type ShiftRightTerm +%type SizeOfTerm +%type StoreTerm +%type SubtractTerm +%type TimerTerm +%type ToBCDTerm +%type ToBufferTerm +%type ToDecimalStringTerm +%type ToHexStringTerm +%type ToIntegerTerm +%type ToStringTerm +%type WaitTerm +%type XOrTerm + +/* Keywords */ + +%type AccessAttribKeyword +%type AccessTypeKeyword +%type AddressingModeKeyword +%type AddressKeyword +%type AddressSpaceKeyword +%type BitsPerByteKeyword +%type ClockPhaseKeyword +%type ClockPolarityKeyword +%type DecodeKeyword +%type DevicePolarityKeyword +%type DMATypeKeyword +%type EndianKeyword +%type FlowControlKeyword +%type InterruptLevel +%type InterruptTypeKeyword +%type IODecodeKeyword +%type IoRestrictionKeyword +%type LockRuleKeyword +%type MatchOpKeyword +%type MaxKeyword +%type MemTypeKeyword +%type MinKeyword +%type ObjectTypeKeyword +%type OptionalBusMasterKeyword +%type OptionalReadWriteKeyword +%type ParityTypeKeyword +%type PinConfigByte +%type PinConfigKeyword +%type RangeTypeKeyword +%type RegionSpaceKeyword +%type ResourceTypeKeyword +%type SerializeRuleKeyword +%type ShareTypeKeyword +%type SlaveModeKeyword +%type StopBitsKeyword +%type TranslationKeyword +%type TypeKeyword +%type UpdateRuleKeyword +%type WireModeKeyword +%type XferSizeKeyword +%type XferTypeKeyword + +/* Types */ + +%type SuperName +%type ObjectTypeSource +%type DerefOfSource +%type RefOfSource +%type CondRefOfSource +%type ArgTerm +%type LocalTerm +%type DebugTerm + +%type Integer +%type ByteConst +%type WordConst +%type DWordConst +%type QWordConst +%type String + +%type ConstTerm +%type ConstExprTerm +%type ByteConstExpr +%type WordConstExpr +%type DWordConstExpr +%type QWordConstExpr + +%type DWordList +%type BufferTerm +%type ByteList + +%type PackageElement +%type PackageList +%type PackageTerm + +/* Macros */ + +%type EISAIDTerm +%type ResourceMacroList +%type ResourceMacroTerm +%type ResourceTemplateTerm +%type PldKeyword +%type PldKeywordList +%type ToPLDTerm +%type ToUUIDTerm +%type UnicodeTerm +%type PrintfArgList +%type PrintfTerm +%type FprintfTerm +%type ForTerm + +/* Resource Descriptors */ + +%type ConnectionTerm +%type DMATerm +%type DWordIOTerm +%type DWordMemoryTerm +%type DWordSpaceTerm +%type EndDependentFnTerm +%type ExtendedIOTerm +%type ExtendedMemoryTerm +%type ExtendedSpaceTerm +%type FixedDmaTerm +%type FixedIOTerm +%type GpioIntTerm +%type GpioIoTerm +%type I2cSerialBusTerm +%type I2cSerialBusTermV2 +%type InterruptTerm +%type IOTerm +%type IRQNoFlagsTerm +%type IRQTerm +%type Memory24Term +%type Memory32FixedTerm +%type Memory32Term +%type NameSeg +%type NameString +%type PinConfigTerm +%type PinFunctionTerm +%type PinGroupTerm +%type PinGroupConfigTerm +%type PinGroupFunctionTerm +%type QWordIOTerm +%type QWordMemoryTerm +%type QWordSpaceTerm +%type RegisterTerm +%type SpiSerialBusTerm +%type SpiSerialBusTermV2 +%type StartDependentFnNoPriTerm +%type StartDependentFnTerm +%type UartSerialBusTerm +%type UartSerialBusTermV2 +%type VendorLongTerm +%type VendorShortTerm +%type WordBusNumberTerm +%type WordIOTerm +%type WordSpaceTerm + +/* Local types that help construct the AML, not in ACPI spec */ + +%type AmlPackageLengthTerm +%type IncludeEndTerm +%type NameStringItem +%type TermArgItem + +%type OptionalAccessSize +%type OptionalAccessTypeKeyword +%type OptionalAddressingMode +%type OptionalAddressRange +%type OptionalBitsPerByte +%type OptionalBuffer_Last +%type OptionalByteConstExpr +%type OptionalCount +%type OptionalDataCount +%type OptionalDecodeType +%type OptionalDevicePolarity +%type OptionalDWordConstExpr +%type OptionalEndian +%type OptionalFlowControl +%type OptionalIoRestriction +%type OptionalListString +%type OptionalLockRuleKeyword +%type OptionalMaxType +%type OptionalMemType +%type OptionalMinType +%type OptionalNameString +%type OptionalNameString_First +%type OptionalNameString_Last +%type OptionalObjectTypeKeyword +%type OptionalParameterTypePackage +%type OptionalParameterTypesPackage +%type OptionalParentheses +%type OptionalParityType +%type OptionalPredicate +%type OptionalQWordConstExpr +%type OptionalRangeType +%type OptionalReference +%type OptionalResourceType +%type OptionalResourceType_First +%type OptionalProducerResourceType +%type OptionalReturnArg +%type OptionalSerializeRuleKeyword +%type OptionalShareType +%type OptionalShareType_First +%type OptionalSlaveMode +%type OptionalStopBits +%type OptionalStringData +%type OptionalSyncLevel +%type OptionalTermArg +%type OptionalTranslationType_Last +%type OptionalType +%type OptionalType_Last +%type OptionalUpdateRuleKeyword +%type OptionalWireMode +%type OptionalWordConst +%type OptionalWordConstExpr +%type OptionalXferSize + +/* + * ASL+ (C-style) parser + */ + +/* Expressions and symbolic operators */ + +%type Expression +%type EqualsTerm +%type IndexExpTerm + +/* ASL+ Named object declaration support */ +/* +%type NameTermAslPlus + +%type BufferBegin +%type BufferEnd +%type PackageBegin +%type PackageEnd +%type OptionalLength +*/ +/* ASL+ Structure declarations */ +/* +%type StructureTerm +%type StructureTermBegin +%type StructureType +%type StructureTag +%type StructureElementList +%type StructureElement +%type StructureElementType +%type OptionalStructureElementType +%type StructureId +*/ +/* Structure instantiantion */ +/* +%type StructureInstanceTerm +%type StructureTagReference +%type StructureInstanceEnd +*/ +/* Pseudo-instantiantion for method Args/Locals */ +/* +%type MethodStructureTerm +%type LocalStructureName +*/ +/* Direct structure references via the Index operator */ +/* +%type StructureReference +%type StructureIndexTerm +%type StructurePointerTerm +%type StructurePointerReference +%type OptionalDefinePointer +*/ + +%% + +/* Production rules */ + + + +/******************************************************************************* + * + * ASL Root and Secondary Terms + * + ******************************************************************************/ + +/* + * Root term. Allow multiple #line directives before the definition block + * to handle output from preprocessors + */ +AslCode + : DefinitionBlockList {$$ = TrLinkOpChildren ( + TrCreateLeafOp (PARSEOP_ASL_CODE),1, $1);} + | error {YYABORT; $$ = NULL;} + ; + + +/* + * Note concerning support for "module-level code". + * + * ACPI 1.0 allowed Type1 and Type2 executable opcodes outside of control + * methods (the so-called module-level code.) This support was explicitly + * removed in ACPI 2.0, but this type of code continues to be created by + * BIOS vendors. In order to support the disassembly and recompilation of + * such code (and the porting of ASL code to iASL), iASL supports this + * code in violation of the current ACPI specification. + * + * The grammar change to support module-level code is to revert the + * {ObjectList} portion of the DefinitionBlockTerm in ACPI 2.0 to the + * original use of {TermList} instead (see below.) This allows the use + * of Type1 and Type2 opcodes at module level. + * + * 04/2016: The module-level code is now allowed in the following terms: + * DeviceTerm, PowerResTerm, ProcessorTerm, ScopeTerm, ThermalZoneTerm. + * The ObjectList term is obsolete and has been removed. + */ +DefinitionBlockTerm + : PARSEOP_DEFINITION_BLOCK + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_DEFINITION_BLOCK); COMMENT_CAPTURE_OFF;} + String ',' + String ',' + ByteConst ',' + String ',' + String ',' + DWordConst + PARSEOP_CLOSE_PAREN {TrSetOpIntegerWidth ($6,$8); + TrSetOpEndLineNumber ($3); COMMENT_CAPTURE_ON;} + '{' TermList '}' {$$ = TrLinkOpChildren ($3,7, + $4,$6,$8,$10,$12,$14,$18);} + ; + +DefinitionBlockList + : DefinitionBlockTerm + | DefinitionBlockTerm + DefinitionBlockList {$$ = TrLinkPeerOps (2, $1,$2);} + ; + + +/******* Basic ASCII identifiers **************************************************/ + +/* Allow IO, DMA, IRQ Resource macro and FOR macro names to also be used as identifiers */ + +NameString + : NameSeg {} + | PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) $1);} + | PARSEOP_IO {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");} + | PARSEOP_DMA {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");} + | PARSEOP_IRQ {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");} + | PARSEOP_FOR {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "FOR");} + ; +/* +NameSeg + : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESEG, (ACPI_NATIVE_INT) + TrNormalizeNameSeg ($1));} + ; +*/ + +NameSeg + : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafOp (PARSEOP_NAMESEG, + (ACPI_NATIVE_INT) AslCompilerlval.s);} + ; + + +/******* Fundamental argument/statement types ***********************************/ + +Term + : Object {} + | Type1Opcode {} + | Type2Opcode {} + | Type2IntegerOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);} + | Type2StringOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);} + | Type2BufferOpcode {} + | Type2BufferOrStringOpcode {} + | error {$$ = AslDoError(); yyclearin;} + ; + +SuperName + : SimpleName {} + | DebugTerm {} + | Type6Opcode {} + ; + +Target + : {$$ = TrCreateNullTargetOp ();} /* Placeholder is a ZeroOp object */ + | ',' {$$ = TrCreateNullTargetOp ();} /* Placeholder is a ZeroOp object */ + | ',' SuperName {$$ = TrSetOpFlags ($2, OP_IS_TARGET);} + ; + +RequiredTarget + : ',' SuperName {$$ = TrSetOpFlags ($2, OP_IS_TARGET);} + ; + +TermArg + : SimpleName {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);} + | Type2Opcode {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);} + | DataObject {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);} + | PARSEOP_OPEN_PAREN + TermArg + PARSEOP_CLOSE_PAREN {$$ = TrSetOpFlags ($2, OP_IS_TERM_ARG);} + ; + +/* + NOTE: Removed from TermArg due to reduce/reduce conflicts: + | Type2IntegerOpcode {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);} + | Type2StringOpcode {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);} + | Type2BufferOpcode {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);} + | Type2BufferOrStringOpcode {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);} + +*/ + +MethodInvocationTerm + : NameString + PARSEOP_OPEN_PAREN {TrSetOpIntegerValue (PARSEOP_METHODCALL, $1); COMMENT_CAPTURE_OFF;} + ArgList + PARSEOP_CLOSE_PAREN {$$ = TrLinkChildOp ($1,$4); COMMENT_CAPTURE_ON;} + ; + +/* OptionalCount must appear before ByteList or an incorrect reduction will result */ + +OptionalCount + : {$$ = TrCreateLeafOp (PARSEOP_ONES);} /* Placeholder is a OnesOp object */ + | ',' {$$ = TrCreateLeafOp (PARSEOP_ONES);} /* Placeholder is a OnesOp object */ + | ',' TermArg {$$ = $2;} + ; + +/* + * Data count for buffers and packages (byte count for buffers, + * element count for packages). + */ +OptionalDataCount + + /* Legacy ASL */ + : {$$ = NULL;} + | PARSEOP_OPEN_PAREN + TermArg + PARSEOP_CLOSE_PAREN {$$ = $2;} + | PARSEOP_OPEN_PAREN + PARSEOP_CLOSE_PAREN {$$ = NULL;} + + /* C-style (ASL+) -- adds equals term */ + + | PARSEOP_EXP_EQUALS {$$ = NULL;} + + | PARSEOP_OPEN_PAREN + TermArg + PARSEOP_CLOSE_PAREN + PARSEOP_EXP_EQUALS {$$ = $2;} + + | PARSEOP_OPEN_PAREN + PARSEOP_CLOSE_PAREN + String + PARSEOP_EXP_EQUALS {$$ = NULL;} + ; + + +/******* List Terms **************************************************/ + + /* ACPI 3.0 -- allow semicolons between terms */ + +TermList + : {$$ = NULL;} + | TermList Term {$$ = TrLinkPeerOp ( + TrSetOpFlags ($1, OP_RESULT_NOT_USED),$2);} + | TermList Term ';' {$$ = TrLinkPeerOp ( + TrSetOpFlags ($1, OP_RESULT_NOT_USED),$2);} + | TermList ';' Term {$$ = TrLinkPeerOp ( + TrSetOpFlags ($1, OP_RESULT_NOT_USED),$3);} + | TermList ';' Term ';' {$$ = TrLinkPeerOp ( + TrSetOpFlags ($1, OP_RESULT_NOT_USED),$3);} + ; + +ArgList + : {$$ = NULL;} + | TermArg + | ArgList ',' /* Allows a trailing comma at list end */ + | ArgList ',' + TermArg {$$ = TrLinkPeerOp ($1,$3);} + ; + +ByteList + : {$$ = NULL;} + | ByteConstExpr + | ByteList ',' /* Allows a trailing comma at list end */ + | ByteList ',' + ByteConstExpr {$$ = TrLinkPeerOp ($1,$3);} + ; + +DWordList + : {$$ = NULL;} + | DWordConstExpr + | DWordList ',' /* Allows a trailing comma at list end */ + | DWordList ',' + DWordConstExpr {$$ = TrLinkPeerOp ($1,$3);} + ; + +FieldUnitList + : {$$ = NULL;} + | FieldUnit + | FieldUnitList ',' /* Allows a trailing comma at list end */ + | FieldUnitList ',' + FieldUnit {$$ = TrLinkPeerOp ($1,$3);} + ; + +FieldUnit + : FieldUnitEntry {} + | OffsetTerm {} + | AccessAsTerm {} + | ConnectionTerm {} + ; + +FieldUnitEntry + : ',' AmlPackageLengthTerm {$$ = TrCreateOp (PARSEOP_RESERVED_BYTES,1,$2);} + | NameSeg ',' + AmlPackageLengthTerm {$$ = TrLinkChildOp ($1,$3);} + ; + +Object + : CompilerDirective {} + | NamedObject {} + | NameSpaceModifier {} +/* | StructureTerm {} */ + ; + +PackageList + : {$$ = NULL;} + | PackageElement + | PackageList ',' /* Allows a trailing comma at list end */ + | PackageList ',' + PackageElement {$$ = TrLinkPeerOp ($1,$3);} + ; + +PackageElement + : DataObject {} + | NameString {} + ; + + /* Rules for specifying the type of one method argument or return value */ + +ParameterTypePackage + : {$$ = NULL;} + | ObjectTypeKeyword {$$ = $1;} + | ParameterTypePackage ',' + ObjectTypeKeyword {$$ = TrLinkPeerOps (2,$1,$3);} + ; + +ParameterTypePackageList + : {$$ = NULL;} + | ObjectTypeKeyword {$$ = $1;} + | '{' ParameterTypePackage '}' {$$ = $2;} + ; + +OptionalParameterTypePackage + : {$$ = TrCreateLeafOp (PARSEOP_DEFAULT_ARG);} + | ',' ParameterTypePackageList {$$ = TrLinkOpChildren ( + TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);} + ; + + /* Rules for specifying the types for method arguments */ + +ParameterTypesPackage + : ParameterTypePackageList {$$ = $1;} + | ParameterTypesPackage ',' + ParameterTypePackageList {$$ = TrLinkPeerOps (2,$1,$3);} + ; + +ParameterTypesPackageList + : {$$ = NULL;} + | ObjectTypeKeyword {$$ = $1;} + | '{' ParameterTypesPackage '}' {$$ = $2;} + ; + +OptionalParameterTypesPackage + : {$$ = TrCreateLeafOp (PARSEOP_DEFAULT_ARG);} + | ',' ParameterTypesPackageList {$$ = TrLinkOpChildren ( + TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);} + ; + +/* + * Case-Default list; allow only one Default term and unlimited Case terms + */ +CaseDefaultTermList + : {$$ = NULL;} + | CaseTerm {} + | DefaultTerm {} + | CaseDefaultTermList + CaseTerm {$$ = TrLinkPeerOp ($1,$2);} + | CaseDefaultTermList + DefaultTerm {$$ = TrLinkPeerOp ($1,$2);} + +/* Original - attempts to force zero or one default term within the switch */ + +/* +CaseDefaultTermList + : {$$ = NULL;} + | CaseTermList + DefaultTerm + CaseTermList {$$ = TrLinkPeerOp ($1,TrLinkPeerOp ($2, $3));} + | CaseTermList + CaseTerm {$$ = TrLinkPeerOp ($1,$2);} + ; + +CaseTermList + : {$$ = NULL;} + | CaseTerm {} + | CaseTermList + CaseTerm {$$ = TrLinkPeerOp ($1,$2);} + ; +*/ + + +/******************************************************************************* + * + * ASL Data and Constant Terms + * + ******************************************************************************/ + +DataObject + : BufferData {} + | PackageData {} + | IntegerData {} + | StringData {} + ; + +BufferData + : Type5Opcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);} + | Type2BufferOrStringOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);} + | Type2BufferOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);} + | BufferTerm {} + ; + +PackageData + : PackageTerm {} + ; + +IntegerData + : Type2IntegerOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);} + | Type3Opcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);} + | Integer {} + | ConstTerm {} + ; + +StringData + : Type2StringOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);} + | String {} + ; + +ByteConst + : Integer {$$ = TrSetOpIntegerValue (PARSEOP_BYTECONST, $1);} + ; + +WordConst + : Integer {$$ = TrSetOpIntegerValue (PARSEOP_WORDCONST, $1);} + ; + +DWordConst + : Integer {$$ = TrSetOpIntegerValue (PARSEOP_DWORDCONST, $1);} + ; + +QWordConst + : Integer {$$ = TrSetOpIntegerValue (PARSEOP_QWORDCONST, $1);} + ; + +/* + * The OP_COMPILE_TIME_CONST flag in the following constant expressions + * enables compile-time constant folding to reduce the Type3Opcodes/Type2IntegerOpcodes + * to simple integers. It is an error if these types of expressions cannot be + * reduced, since the AML grammar for ****ConstExpr requires a simple constant. + * Note: The required byte length of the constant is passed through to the + * constant folding code in the node AmlLength field. + */ +ByteConstExpr + : Type3Opcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST); + TrSetOpAmlLength ($1, 1);} + | Type2IntegerOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST); + TrSetOpAmlLength ($1, 1);} + | ConstExprTerm {$$ = TrSetOpIntegerValue (PARSEOP_BYTECONST, $1);} + | ByteConst {} + ; + +WordConstExpr + : Type3Opcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST); + TrSetOpAmlLength ($1, 2);} + | Type2IntegerOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST); + TrSetOpAmlLength ($1, 2);} + | ConstExprTerm {$$ = TrSetOpIntegerValue (PARSEOP_WORDCONST, $1);} + | WordConst {} + ; + +DWordConstExpr + : Type3Opcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST); + TrSetOpAmlLength ($1, 4);} + | Type2IntegerOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST); + TrSetOpAmlLength ($1, 4);} + | ConstExprTerm {$$ = TrSetOpIntegerValue (PARSEOP_DWORDCONST, $1);} + | DWordConst {} + ; + +QWordConstExpr + : Type3Opcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST); + TrSetOpAmlLength ($1, 8);} + | Type2IntegerOpcode {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST); + TrSetOpAmlLength ($1, 8);} + | ConstExprTerm {$$ = TrSetOpIntegerValue (PARSEOP_QWORDCONST, $1);} + | QWordConst {} + ; + +ConstTerm + : ConstExprTerm {} + | PARSEOP_REVISION {$$ = TrCreateLeafOp (PARSEOP_REVISION);} + ; + +ConstExprTerm + : PARSEOP_ZERO {$$ = TrCreateValuedLeafOp (PARSEOP_ZERO, 0);} + | PARSEOP_ONE {$$ = TrCreateValuedLeafOp (PARSEOP_ONE, 1);} + | PARSEOP_ONES {$$ = TrCreateValuedLeafOp (PARSEOP_ONES, ACPI_UINT64_MAX);} + | PARSEOP___DATE__ {$$ = TrCreateConstantLeafOp (PARSEOP___DATE__);} + | PARSEOP___FILE__ {$$ = TrCreateConstantLeafOp (PARSEOP___FILE__);} + | PARSEOP___LINE__ {$$ = TrCreateConstantLeafOp (PARSEOP___LINE__);} + | PARSEOP___PATH__ {$$ = TrCreateConstantLeafOp (PARSEOP___PATH__);} + | PARSEOP___METHOD__ {$$ = TrCreateConstantLeafOp (PARSEOP___METHOD__);} + ; + +Integer + : PARSEOP_INTEGER {$$ = TrCreateValuedLeafOp (PARSEOP_INTEGER, + AslCompilerlval.i);} + ; + +String + : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafOp (PARSEOP_STRING_LITERAL, + (ACPI_NATIVE_INT) AslCompilerlval.s);} + ; + + +/******************************************************************************* + * + * ASL Opcode Terms + * + ******************************************************************************/ + +CompilerDirective + : IncludeTerm {} + | IncludeEndTerm {} + | ExternalTerm {} + ; + +NamedObject + : BankFieldTerm {} + | CreateBitFieldTerm {} + | CreateByteFieldTerm {} + | CreateDWordFieldTerm {} + | CreateFieldTerm {} + | CreateQWordFieldTerm {} + | CreateWordFieldTerm {} + | DataRegionTerm {} + | DeviceTerm {} + | EventTerm {} + | FieldTerm {} + | FunctionTerm {} + | IndexFieldTerm {} + | MethodTerm {} + | MutexTerm {} + | OpRegionTerm {} + | PowerResTerm {} + | ProcessorTerm {} + | ThermalZoneTerm {} + ; + +NameSpaceModifier + : AliasTerm {} + | NameTerm {} +/* | NameTermAslPlus {} */ + | ScopeTerm {} + ; + +SimpleName + : NameString {} + | LocalTerm {} + | ArgTerm {} + ; + +/* For ObjectType(), SuperName except for MethodInvocationTerm */ + +ObjectTypeSource + : SimpleName {} + | DebugTerm {} + | RefOfTerm {} + | DerefOfTerm {} + | IndexTerm {} + | IndexExpTerm {} + ; + +/* For DeRefOf(), SuperName except for DerefOf and Debug */ + +DerefOfSource + : SimpleName {} + | RefOfTerm {} + | DerefOfTerm {} + | IndexTerm {} + | IndexExpTerm {} + | StoreTerm {} + | EqualsTerm {} + | MethodInvocationTerm {} + ; + +/* For RefOf(), SuperName except for RefOf and MethodInvocationTerm */ + +RefOfSource + : SimpleName {} + | DebugTerm {} + | DerefOfTerm {} + | IndexTerm {} + | IndexExpTerm {} + ; + +/* For CondRefOf(), SuperName except for RefOf and MethodInvocationTerm */ + +CondRefOfSource + : SimpleName {} + | DebugTerm {} + | DerefOfTerm {} + | IndexTerm {} + | IndexExpTerm {} + ; + +/* + * Opcode types, as defined in the ACPI specification + */ +Type1Opcode + : BreakTerm {} + | BreakPointTerm {} + | ContinueTerm {} + | FatalTerm {} + | ForTerm {} + | ElseIfTerm {} + | LoadTerm {} + | NoOpTerm {} + | NotifyTerm {} + | ReleaseTerm {} + | ResetTerm {} + | ReturnTerm {} + | SignalTerm {} + | SleepTerm {} + | StallTerm {} + | SwitchTerm {} + | UnloadTerm {} + | WhileTerm {} + ; + +Type2Opcode + : AcquireTerm {} + | CondRefOfTerm {} + | CopyObjectTerm {} + | DerefOfTerm {} + | ObjectTypeTerm {} + | RefOfTerm {} + | SizeOfTerm {} + | StoreTerm {} + | EqualsTerm {} + | TimerTerm {} + | WaitTerm {} + | MethodInvocationTerm {} + ; + +/* + * Type 3/4/5 opcodes + */ +Type2IntegerOpcode /* "Type3" opcodes */ + : Expression {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);} + | AddTerm {} + | AndTerm {} + | DecTerm {} + | DivideTerm {} + | FindSetLeftBitTerm {} + | FindSetRightBitTerm {} + | FromBCDTerm {} + | IncTerm {} + | IndexTerm {} +/* | StructureIndexTerm {} */ +/* | StructurePointerTerm {} */ + | LAndTerm {} + | LEqualTerm {} + | LGreaterTerm {} + | LGreaterEqualTerm {} + | LLessTerm {} + | LLessEqualTerm {} + | LNotTerm {} + | LNotEqualTerm {} + | LoadTableTerm {} + | LOrTerm {} + | MatchTerm {} + | ModTerm {} + | MultiplyTerm {} + | NAndTerm {} + | NOrTerm {} + | NotTerm {} + | OrTerm {} + | ShiftLeftTerm {} + | ShiftRightTerm {} + | SubtractTerm {} + | ToBCDTerm {} + | ToIntegerTerm {} + | XOrTerm {} + ; + +Type2StringOpcode /* "Type4" Opcodes */ + : ToDecimalStringTerm {} + | ToHexStringTerm {} + | ToStringTerm {} + ; + +Type2BufferOpcode /* "Type5" Opcodes */ + : ToBufferTerm {} + | ConcatResTerm {} + ; + +Type2BufferOrStringOpcode + : ConcatTerm {$$ = TrSetOpFlags ($1, OP_COMPILE_TIME_CONST);} + | PrintfTerm {} + | FprintfTerm {} + | MidTerm {} + ; + +/* + * A type 3 opcode evaluates to an Integer and cannot have a destination operand + */ +Type3Opcode + : EISAIDTerm {} + ; + +/* Obsolete +Type4Opcode + : ConcatTerm {} + | ToDecimalStringTerm {} + | ToHexStringTerm {} + | MidTerm {} + | ToStringTerm {} + ; +*/ + +/* Type 5 opcodes are a subset of Type2 opcodes, and return a constant */ + +Type5Opcode + : ResourceTemplateTerm {} + | UnicodeTerm {} + | ToPLDTerm {} + | ToUUIDTerm {} + ; + +Type6Opcode + : RefOfTerm {} + | DerefOfTerm {} + | IndexTerm {} + | IndexExpTerm {} +/* | StructureIndexTerm {} */ +/* | StructurePointerTerm {} */ + | MethodInvocationTerm {} + ; + + +/******************************************************************************* + * + * ASL Helper Terms + * + ******************************************************************************/ + +AmlPackageLengthTerm + : Integer {$$ = TrSetOpIntegerValue (PARSEOP_PACKAGE_LENGTH, + (ACPI_PARSE_OBJECT *) $1);} + ; + +NameStringItem + : ',' NameString {$$ = $2;} + | ',' error {$$ = AslDoError (); yyclearin;} + ; + +TermArgItem + : ',' TermArg {$$ = $2;} + | ',' error {$$ = AslDoError (); yyclearin;} + ; + +OptionalReference + : {$$ = TrCreateLeafOp (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ + | ',' {$$ = TrCreateLeafOp (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ + | ',' TermArg {$$ = $2;} + ; + +OptionalReturnArg + : {$$ = TrSetOpFlags (TrCreateLeafOp (PARSEOP_ZERO), + OP_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */ + | TermArg {$$ = $1;} + ; + +OptionalSerializeRuleKeyword + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' SerializeRuleKeyword {$$ = $2;} + ; + +OptionalTermArg + : {$$ = TrCreateLeafOp (PARSEOP_DEFAULT_ARG);} + | TermArg {$$ = $1;} + ; + +OptionalWordConst + : {$$ = NULL;} + | WordConst {$$ = $1;} + ; + + + + +/******************************************************************************* + * + * ASL Primary Terms + * + ******************************************************************************/ + +AccessAsTerm + : PARSEOP_ACCESSAS + PARSEOP_OPEN_PAREN + AccessTypeKeyword + OptionalAccessAttribTerm + PARSEOP_CLOSE_PAREN {$$ = TrCreateOp (PARSEOP_ACCESSAS,2,$3,$4);} + | PARSEOP_ACCESSAS + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +AcquireTerm + : PARSEOP_ACQUIRE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp(PARSEOP_ACQUIRE);} + SuperName + ',' WordConstExpr + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$6);} + | PARSEOP_ACQUIRE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +AddTerm + : PARSEOP_ADD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_ADD);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_ADD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +AliasTerm + : PARSEOP_ALIAS + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_ALIAS);} + NameString + NameStringItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4, + TrSetOpFlags ($5, OP_IS_NAME_DECLARATION));} + | PARSEOP_ALIAS + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +AndTerm + : PARSEOP_AND + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_AND);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_AND + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ArgTerm + : PARSEOP_ARG0 {$$ = TrCreateLeafOp (PARSEOP_ARG0);} + | PARSEOP_ARG1 {$$ = TrCreateLeafOp (PARSEOP_ARG1);} + | PARSEOP_ARG2 {$$ = TrCreateLeafOp (PARSEOP_ARG2);} + | PARSEOP_ARG3 {$$ = TrCreateLeafOp (PARSEOP_ARG3);} + | PARSEOP_ARG4 {$$ = TrCreateLeafOp (PARSEOP_ARG4);} + | PARSEOP_ARG5 {$$ = TrCreateLeafOp (PARSEOP_ARG5);} + | PARSEOP_ARG6 {$$ = TrCreateLeafOp (PARSEOP_ARG6);} + ; + +BankFieldTerm + : PARSEOP_BANKFIELD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_BANKFIELD);} + NameString + NameStringItem + TermArgItem + OptionalAccessTypeKeyword + OptionalLockRuleKeyword + OptionalUpdateRuleKeyword + PARSEOP_CLOSE_PAREN '{' + FieldUnitList '}' {$$ = TrLinkOpChildren ($3,7, + $4,$5,$6,$7,$8,$9,$12);} + | PARSEOP_BANKFIELD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN + '{' error '}' {$$ = AslDoError(); yyclearin;} + ; + +BreakTerm + : PARSEOP_BREAK {$$ = TrCreateOp (PARSEOP_BREAK, 0);} + ; + +BreakPointTerm + : PARSEOP_BREAKPOINT {$$ = TrCreateOp (PARSEOP_BREAKPOINT, 0);} + ; + +BufferTerm + : PARSEOP_BUFFER {$$ = TrCreateLeafOp (PARSEOP_BUFFER); COMMENT_CAPTURE_OFF; } + OptionalDataCount + '{' BufferTermData '}' {$$ = TrLinkOpChildren ($2,2,$3,$5); COMMENT_CAPTURE_ON;} + ; + +BufferTermData + : ByteList {} + | StringData {} + ; + +CaseTerm + : PARSEOP_CASE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_CASE);} + DataObject + PARSEOP_CLOSE_PAREN '{' + TermList '}' {$$ = TrLinkOpChildren ($3,2,$4,$7);} + | PARSEOP_CASE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ConcatTerm + : PARSEOP_CONCATENATE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_CONCATENATE);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_CONCATENATE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ConcatResTerm + : PARSEOP_CONCATENATERESTEMPLATE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp ( + PARSEOP_CONCATENATERESTEMPLATE);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_CONCATENATERESTEMPLATE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +CondRefOfTerm + : PARSEOP_CONDREFOF + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_CONDREFOF);} + CondRefOfSource + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_CONDREFOF + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ConnectionTerm + : PARSEOP_CONNECTION + PARSEOP_OPEN_PAREN + NameString + PARSEOP_CLOSE_PAREN {$$ = TrCreateOp (PARSEOP_CONNECTION,1,$3);} + | PARSEOP_CONNECTION + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_CONNECTION);} + ResourceMacroTerm + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3, 1, + TrLinkOpChildren ( + TrCreateLeafOp (PARSEOP_RESOURCETEMPLATE), 3, + TrCreateLeafOp (PARSEOP_DEFAULT_ARG), + TrCreateLeafOp (PARSEOP_DEFAULT_ARG), + $4));} + | PARSEOP_CONNECTION + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ContinueTerm + : PARSEOP_CONTINUE {$$ = TrCreateOp (PARSEOP_CONTINUE, 0);} + ; + +CopyObjectTerm + : PARSEOP_COPYOBJECT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_COPYOBJECT);} + TermArg + ',' SimpleName + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4, + TrSetOpFlags ($6, OP_IS_TARGET));} + | PARSEOP_COPYOBJECT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +CreateBitFieldTerm + : PARSEOP_CREATEBITFIELD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_CREATEBITFIELD);} + TermArg + TermArgItem + NameStringItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5, + TrSetOpFlags ($6, OP_IS_NAME_DECLARATION));} + | PARSEOP_CREATEBITFIELD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +CreateByteFieldTerm + : PARSEOP_CREATEBYTEFIELD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_CREATEBYTEFIELD);} + TermArg + TermArgItem + NameStringItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5, + TrSetOpFlags ($6, OP_IS_NAME_DECLARATION));} + | PARSEOP_CREATEBYTEFIELD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +CreateDWordFieldTerm + : PARSEOP_CREATEDWORDFIELD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_CREATEDWORDFIELD);} + TermArg + TermArgItem + NameStringItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5, + TrSetOpFlags ($6, OP_IS_NAME_DECLARATION));} + | PARSEOP_CREATEDWORDFIELD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +CreateFieldTerm + : PARSEOP_CREATEFIELD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_CREATEFIELD);} + TermArg + TermArgItem + TermArgItem + NameStringItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,4,$4,$5,$6, + TrSetOpFlags ($7, OP_IS_NAME_DECLARATION));} + | PARSEOP_CREATEFIELD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +CreateQWordFieldTerm + : PARSEOP_CREATEQWORDFIELD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_CREATEQWORDFIELD);} + TermArg + TermArgItem + NameStringItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5, + TrSetOpFlags ($6, OP_IS_NAME_DECLARATION));} + | PARSEOP_CREATEQWORDFIELD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +CreateWordFieldTerm + : PARSEOP_CREATEWORDFIELD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_CREATEWORDFIELD);} + TermArg + TermArgItem + NameStringItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5, + TrSetOpFlags ($6, OP_IS_NAME_DECLARATION));} + | PARSEOP_CREATEWORDFIELD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +DataRegionTerm + : PARSEOP_DATATABLEREGION + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_DATATABLEREGION);} + NameString + TermArgItem + TermArgItem + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,4, + TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),$5,$6,$7);} + | PARSEOP_DATATABLEREGION + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +DebugTerm + : PARSEOP_DEBUG {$$ = TrCreateLeafOp (PARSEOP_DEBUG);} + ; + +DecTerm + : PARSEOP_DECREMENT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_DECREMENT);} + SuperName + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_DECREMENT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +DefaultTerm + : PARSEOP_DEFAULT '{' {$$ = TrCreateLeafOp (PARSEOP_DEFAULT);} + TermList '}' {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_DEFAULT '{' + error '}' {$$ = AslDoError(); yyclearin;} + ; + +DerefOfTerm + : PARSEOP_DEREFOF + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_DEREFOF);} + DerefOfSource + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_DEREFOF + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +DeviceTerm + : PARSEOP_DEVICE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_DEVICE);} + NameString + PARSEOP_CLOSE_PAREN '{' + TermList '}' {$$ = TrLinkOpChildren ($3,2, + TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),$7);} + | PARSEOP_DEVICE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +DivideTerm + : PARSEOP_DIVIDE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_DIVIDE);} + TermArg + TermArgItem + Target + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,4,$4,$5,$6,$7);} + | PARSEOP_DIVIDE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +EISAIDTerm + : PARSEOP_EISAID + PARSEOP_OPEN_PAREN + StringData + PARSEOP_CLOSE_PAREN {$$ = TrSetOpIntegerValue (PARSEOP_EISAID, $3);} + | PARSEOP_EISAID + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ElseIfTerm + : IfTerm ElseTerm {$$ = TrLinkPeerOp ($1,$2);} + ; + +ElseTerm + : {$$ = NULL;} + | PARSEOP_ELSE '{' + TermList {$$ = TrCreateLeafOp (PARSEOP_ELSE);} + '}' {$$ = TrLinkOpChildren ($4,1,$3);} + + | PARSEOP_ELSE '{' + error '}' {$$ = AslDoError(); yyclearin;} + + | PARSEOP_ELSE + error {$$ = AslDoError(); yyclearin;} + + | PARSEOP_ELSEIF + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_ELSE);} + TermArg {$$ = TrCreateLeafOp (PARSEOP_IF);} + PARSEOP_CLOSE_PAREN '{' + TermList '}' {TrLinkOpChildren ($5,2,$4,$8);} + ElseTerm {TrLinkPeerOp ($5,$11);} + {$$ = TrLinkOpChildren ($3,1,$5);} + + | PARSEOP_ELSEIF + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + + | PARSEOP_ELSEIF + error {$$ = AslDoError(); yyclearin;} + ; + +EventTerm + : PARSEOP_EVENT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_EVENT);} + NameString + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1, + TrSetOpFlags ($4, OP_IS_NAME_DECLARATION));} + | PARSEOP_EVENT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ExternalTerm + : PARSEOP_EXTERNAL + PARSEOP_OPEN_PAREN + NameString + OptionalObjectTypeKeyword + OptionalParameterTypePackage + OptionalParameterTypesPackage + PARSEOP_CLOSE_PAREN {$$ = TrCreateOp (PARSEOP_EXTERNAL,4,$3,$4,$5,$6);} + | PARSEOP_EXTERNAL + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +FatalTerm + : PARSEOP_FATAL + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_FATAL);} + ByteConstExpr + ',' DWordConstExpr + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$6,$7);} + | PARSEOP_FATAL + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +FieldTerm + : PARSEOP_FIELD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_FIELD);} + NameString + OptionalAccessTypeKeyword + OptionalLockRuleKeyword + OptionalUpdateRuleKeyword + PARSEOP_CLOSE_PAREN '{' + FieldUnitList '}' {$$ = TrLinkOpChildren ($3,5,$4,$5,$6,$7,$10);} + | PARSEOP_FIELD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN + '{' error '}' {$$ = AslDoError(); yyclearin;} + ; + +FindSetLeftBitTerm + : PARSEOP_FINDSETLEFTBIT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_FINDSETLEFTBIT);} + TermArg + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_FINDSETLEFTBIT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +FindSetRightBitTerm + : PARSEOP_FINDSETRIGHTBIT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_FINDSETRIGHTBIT);} + TermArg + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_FINDSETRIGHTBIT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + + /* Convert a For() loop to a While() loop */ +ForTerm + : PARSEOP_FOR + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_WHILE);} + OptionalTermArg ',' {} + OptionalPredicate ',' + OptionalTermArg {$$ = TrLinkPeerOp ($4,$3); + TrSetOpParent ($9,$3);} /* New parent is WHILE */ + PARSEOP_CLOSE_PAREN + '{' TermList '}' {$$ = TrLinkOpChildren ($3,2,$7,$13);} + {$$ = TrLinkPeerOp ($13,$9); + $$ = $10;} + ; + +OptionalPredicate + : {$$ = TrCreateValuedLeafOp (PARSEOP_INTEGER, 1);} + | TermArg {$$ = $1;} + ; + +FprintfTerm + : PARSEOP_FPRINTF + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_FPRINTF);} + TermArg ',' + StringData + PrintfArgList + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$6,$7);} + | PARSEOP_FPRINTF + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +FromBCDTerm + : PARSEOP_FROMBCD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_FROMBCD);} + TermArg + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_FROMBCD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +FunctionTerm + : PARSEOP_FUNCTION + PARSEOP_OPEN_PAREN {COMMENT_CAPTURE_OFF; $$ = TrCreateLeafOp (PARSEOP_METHOD); } + NameString + OptionalParameterTypePackage + OptionalParameterTypesPackage + PARSEOP_CLOSE_PAREN '{' {COMMENT_CAPTURE_ON; } + TermList '}' {$$ = TrLinkOpChildren ($3,7, + TrSetOpFlags ($4, OP_IS_NAME_DECLARATION), + TrCreateValuedLeafOp (PARSEOP_BYTECONST, 0), + TrCreateLeafOp (PARSEOP_SERIALIZERULE_NOTSERIAL), + TrCreateValuedLeafOp (PARSEOP_BYTECONST, 0),$5,$6,$10);} + | PARSEOP_FUNCTION + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +IfTerm + : PARSEOP_IF + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_IF);} + TermArg + PARSEOP_CLOSE_PAREN '{' + TermList '}' {$$ = TrLinkOpChildren ($3,2,$4,$7);} + + | PARSEOP_IF + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +IncludeTerm + : PARSEOP_INCLUDE + PARSEOP_OPEN_PAREN + String + PARSEOP_CLOSE_PAREN {$$ = TrSetOpIntegerValue (PARSEOP_INCLUDE, $3); + FlOpenIncludeFile ($3);} + ; + +IncludeEndTerm + : PARSEOP_INCLUDE_END {$$ = TrCreateLeafOp (PARSEOP_INCLUDE_END); + TrSetOpCurrentFilename ($$);} + ; + +IncTerm + : PARSEOP_INCREMENT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_INCREMENT);} + SuperName + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_INCREMENT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +IndexFieldTerm + : PARSEOP_INDEXFIELD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_INDEXFIELD);} + NameString + NameStringItem + OptionalAccessTypeKeyword + OptionalLockRuleKeyword + OptionalUpdateRuleKeyword + PARSEOP_CLOSE_PAREN '{' + FieldUnitList '}' {$$ = TrLinkOpChildren ($3,6,$4,$5,$6,$7,$8,$11);} + | PARSEOP_INDEXFIELD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN + '{' error '}' {$$ = AslDoError(); yyclearin;} + ; + +IndexTerm + : PARSEOP_INDEX + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_INDEX);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_INDEX + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +LAndTerm + : PARSEOP_LAND + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_LAND);} + TermArg + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_LAND + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +LEqualTerm + : PARSEOP_LEQUAL + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_LEQUAL);} + TermArg + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_LEQUAL + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +LGreaterEqualTerm + : PARSEOP_LGREATEREQUAL + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_LLESS);} + TermArg + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrCreateOp (PARSEOP_LNOT, 1, + TrLinkOpChildren ($3,2,$4,$5));} + | PARSEOP_LGREATEREQUAL + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +LGreaterTerm + : PARSEOP_LGREATER + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_LGREATER);} + TermArg + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_LGREATER + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +LLessEqualTerm + : PARSEOP_LLESSEQUAL + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_LGREATER);} + TermArg + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrCreateOp (PARSEOP_LNOT, 1, + TrLinkOpChildren ($3,2,$4,$5));} + | PARSEOP_LLESSEQUAL + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +LLessTerm + : PARSEOP_LLESS + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_LLESS);} + TermArg + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_LLESS + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +LNotEqualTerm + : PARSEOP_LNOTEQUAL + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_LEQUAL);} + TermArg + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrCreateOp (PARSEOP_LNOT, 1, + TrLinkOpChildren ($3,2,$4,$5));} + | PARSEOP_LNOTEQUAL + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +LNotTerm + : PARSEOP_LNOT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_LNOT);} + TermArg + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_LNOT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +LoadTableTerm + : PARSEOP_LOADTABLE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_LOADTABLE);} + TermArg + TermArgItem + TermArgItem + OptionalListString + OptionalListString + OptionalReference + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,6,$4,$5,$6,$7,$8,$9);} + | PARSEOP_LOADTABLE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +LoadTerm + : PARSEOP_LOAD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_LOAD);} + NameString + RequiredTarget + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_LOAD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +LocalTerm + : PARSEOP_LOCAL0 {$$ = TrCreateLeafOp (PARSEOP_LOCAL0);} + | PARSEOP_LOCAL1 {$$ = TrCreateLeafOp (PARSEOP_LOCAL1);} + | PARSEOP_LOCAL2 {$$ = TrCreateLeafOp (PARSEOP_LOCAL2);} + | PARSEOP_LOCAL3 {$$ = TrCreateLeafOp (PARSEOP_LOCAL3);} + | PARSEOP_LOCAL4 {$$ = TrCreateLeafOp (PARSEOP_LOCAL4);} + | PARSEOP_LOCAL5 {$$ = TrCreateLeafOp (PARSEOP_LOCAL5);} + | PARSEOP_LOCAL6 {$$ = TrCreateLeafOp (PARSEOP_LOCAL6);} + | PARSEOP_LOCAL7 {$$ = TrCreateLeafOp (PARSEOP_LOCAL7);} + ; + +LOrTerm + : PARSEOP_LOR + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_LOR);} + TermArg + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_LOR + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +MatchTerm + : PARSEOP_MATCH + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_MATCH);} + TermArg + ',' MatchOpKeyword + TermArgItem + ',' MatchOpKeyword + TermArgItem + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,6,$4,$6,$7,$9,$10,$11);} + | PARSEOP_MATCH + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +MethodTerm + : PARSEOP_METHOD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_METHOD); COMMENT_CAPTURE_OFF;} + NameString + OptionalByteConstExpr {UtCheckIntegerRange ($5, 0, 7);} + OptionalSerializeRuleKeyword + OptionalByteConstExpr + OptionalParameterTypePackage + OptionalParameterTypesPackage + PARSEOP_CLOSE_PAREN '{' {COMMENT_CAPTURE_ON;} + TermList '}' {$$ = TrLinkOpChildren ($3,7, + TrSetOpFlags ($4, OP_IS_NAME_DECLARATION), + $5,$7,$8,$9,$10,$14);} + | PARSEOP_METHOD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +MidTerm + : PARSEOP_MID + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_MID);} + TermArg + TermArgItem + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,4,$4,$5,$6,$7);} + | PARSEOP_MID + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ModTerm + : PARSEOP_MOD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_MOD);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_MOD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +MultiplyTerm + : PARSEOP_MULTIPLY + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_MULTIPLY);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_MULTIPLY + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +MutexTerm + : PARSEOP_MUTEX + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_MUTEX);} + NameString + OptionalSyncLevel + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2, + TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),$5);} + | PARSEOP_MUTEX + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +NameTerm + : PARSEOP_NAME + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_NAME);} + NameString + ',' DataObject + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2, + TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),$6);} + | PARSEOP_NAME + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +NAndTerm + : PARSEOP_NAND + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_NAND);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_NAND + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +NoOpTerm + : PARSEOP_NOOP {$$ = TrCreateOp (PARSEOP_NOOP, 0);} + ; + +NOrTerm + : PARSEOP_NOR + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_NOR);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_NOR + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +NotifyTerm + : PARSEOP_NOTIFY + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_NOTIFY);} + SuperName + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_NOTIFY + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +NotTerm + : PARSEOP_NOT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_NOT);} + TermArg + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_NOT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ObjectTypeTerm + : PARSEOP_OBJECTTYPE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE);} + ObjectTypeSource + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_OBJECTTYPE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +OffsetTerm + : PARSEOP_OFFSET + PARSEOP_OPEN_PAREN + AmlPackageLengthTerm + PARSEOP_CLOSE_PAREN {$$ = TrCreateOp (PARSEOP_OFFSET,1,$3);} + | PARSEOP_OFFSET + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +OpRegionTerm + : PARSEOP_OPERATIONREGION + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_OPERATIONREGION);} + NameString + ',' OpRegionSpaceIdTerm + TermArgItem + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,4, + TrSetOpFlags ($4, OP_IS_NAME_DECLARATION), + $6,$7,$8);} + | PARSEOP_OPERATIONREGION + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +OpRegionSpaceIdTerm + : RegionSpaceKeyword {} + | ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} + ; + +OrTerm + : PARSEOP_OR + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_OR);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_OR + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PackageTerm + : PARSEOP_PACKAGE {$$ = TrCreateLeafOp (PARSEOP_VAR_PACKAGE);} + OptionalDataCount + '{' PackageList '}' {$$ = TrLinkOpChildren ($2,2,$3,$5);} + +PowerResTerm + : PARSEOP_POWERRESOURCE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_POWERRESOURCE);} + NameString + ',' ByteConstExpr + ',' WordConstExpr + PARSEOP_CLOSE_PAREN '{' + TermList '}' {$$ = TrLinkOpChildren ($3,4, + TrSetOpFlags ($4, OP_IS_NAME_DECLARATION), + $6,$8,$11);} + | PARSEOP_POWERRESOURCE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PrintfTerm + : PARSEOP_PRINTF + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_PRINTF);} + StringData + PrintfArgList + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_PRINTF + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PrintfArgList + : {$$ = NULL;} + | TermArg {$$ = $1;} + | PrintfArgList ',' + TermArg {$$ = TrLinkPeerOp ($1, $3);} + ; + +ProcessorTerm + : PARSEOP_PROCESSOR + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_PROCESSOR);} + NameString + ',' ByteConstExpr + OptionalDWordConstExpr + OptionalByteConstExpr + PARSEOP_CLOSE_PAREN '{' + TermList '}' {$$ = TrLinkOpChildren ($3,5, + TrSetOpFlags ($4, OP_IS_NAME_DECLARATION), + $6,$7,$8,$11);} + | PARSEOP_PROCESSOR + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +RawDataBufferTerm + : PARSEOP_DATABUFFER + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_DATABUFFER);} + OptionalWordConst + PARSEOP_CLOSE_PAREN '{' + ByteList '}' {$$ = TrLinkOpChildren ($3,2,$4,$7);} + | PARSEOP_DATABUFFER + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +/* + * In RefOf, the node isn't really a target, but we can't keep track of it after + * we've taken a pointer to it. (hard to tell if a local becomes initialized this way.) + */ +RefOfTerm + : PARSEOP_REFOF + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_REFOF);} + RefOfSource + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1, + TrSetOpFlags ($4, OP_IS_TARGET));} + | PARSEOP_REFOF + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ReleaseTerm + : PARSEOP_RELEASE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_RELEASE);} + SuperName + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_RELEASE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ResetTerm + : PARSEOP_RESET + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_RESET);} + SuperName + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_RESET + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ReturnTerm + : PARSEOP_RETURN + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_RETURN);} + OptionalReturnArg + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_RETURN {$$ = TrLinkOpChildren ( + TrCreateLeafOp (PARSEOP_RETURN),1, + TrSetOpFlags (TrCreateLeafOp (PARSEOP_ZERO), + OP_IS_NULL_RETURN));} + | PARSEOP_RETURN + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ScopeTerm + : PARSEOP_SCOPE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_SCOPE);} + NameString + PARSEOP_CLOSE_PAREN '{' + TermList '}' {$$ = TrLinkOpChildren ($3,2, + TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),$7);} + | PARSEOP_SCOPE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ShiftLeftTerm + : PARSEOP_SHIFTLEFT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_SHIFTLEFT);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_SHIFTLEFT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ShiftRightTerm + : PARSEOP_SHIFTRIGHT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_SHIFTRIGHT);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_SHIFTRIGHT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +SignalTerm + : PARSEOP_SIGNAL + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_SIGNAL);} + SuperName + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_SIGNAL + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +SizeOfTerm + : PARSEOP_SIZEOF + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_SIZEOF);} + SuperName + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_SIZEOF + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +SleepTerm + : PARSEOP_SLEEP + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_SLEEP);} + TermArg + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_SLEEP + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +StallTerm + : PARSEOP_STALL + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_STALL);} + TermArg + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_STALL + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +StoreTerm + : PARSEOP_STORE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_STORE);} + TermArg + ',' SuperName + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4, + TrSetOpFlags ($6, OP_IS_TARGET));} + | PARSEOP_STORE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +SubtractTerm + : PARSEOP_SUBTRACT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_SUBTRACT);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_SUBTRACT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +SwitchTerm + : PARSEOP_SWITCH + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_SWITCH);} + TermArg + PARSEOP_CLOSE_PAREN '{' + CaseDefaultTermList '}' {$$ = TrLinkOpChildren ($3,2,$4,$7);} + | PARSEOP_SWITCH + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ThermalZoneTerm + : PARSEOP_THERMALZONE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_THERMALZONE);} + NameString + PARSEOP_CLOSE_PAREN '{' + TermList '}' {$$ = TrLinkOpChildren ($3,2, + TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),$7);} + | PARSEOP_THERMALZONE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +TimerTerm + : PARSEOP_TIMER + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_TIMER);} + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,0);} + | PARSEOP_TIMER {$$ = TrLinkOpChildren ( + TrCreateLeafOp (PARSEOP_TIMER),0);} + | PARSEOP_TIMER + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ToBCDTerm + : PARSEOP_TOBCD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_TOBCD);} + TermArg + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_TOBCD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ToBufferTerm + : PARSEOP_TOBUFFER + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_TOBUFFER);} + TermArg + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_TOBUFFER + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ToDecimalStringTerm + : PARSEOP_TODECIMALSTRING + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_TODECIMALSTRING);} + TermArg + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_TODECIMALSTRING + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ToHexStringTerm + : PARSEOP_TOHEXSTRING + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_TOHEXSTRING);} + TermArg + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_TOHEXSTRING + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ToIntegerTerm + : PARSEOP_TOINTEGER + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_TOINTEGER);} + TermArg + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_TOINTEGER + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ToPLDTerm + : PARSEOP_TOPLD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_TOPLD);} + PldKeywordList + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_TOPLD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PldKeywordList + : {$$ = NULL;} + | PldKeyword + PARSEOP_EXP_EQUALS Integer {$$ = TrLinkOpChildren ($1,1,$3);} + | PldKeyword + PARSEOP_EXP_EQUALS String {$$ = TrLinkOpChildren ($1,1,$3);} + | PldKeywordList ',' /* Allows a trailing comma at list end */ + | PldKeywordList ',' + PldKeyword + PARSEOP_EXP_EQUALS Integer {$$ = TrLinkPeerOp ($1,TrLinkOpChildren ($3,1,$5));} + | PldKeywordList ',' + PldKeyword + PARSEOP_EXP_EQUALS String {$$ = TrLinkPeerOp ($1,TrLinkOpChildren ($3,1,$5));} + ; + + +ToStringTerm + : PARSEOP_TOSTRING + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_TOSTRING);} + TermArg + OptionalCount + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_TOSTRING + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ToUUIDTerm + : PARSEOP_TOUUID + PARSEOP_OPEN_PAREN + StringData + PARSEOP_CLOSE_PAREN {$$ = TrSetOpIntegerValue (PARSEOP_TOUUID, $3);} + | PARSEOP_TOUUID + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +UnicodeTerm + : PARSEOP_UNICODE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_UNICODE);} + StringData + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,0,$4);} + | PARSEOP_UNICODE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +UnloadTerm + : PARSEOP_UNLOAD + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_UNLOAD);} + SuperName + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_UNLOAD + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +WaitTerm + : PARSEOP_WAIT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_WAIT);} + SuperName + TermArgItem + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} + | PARSEOP_WAIT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +XOrTerm + : PARSEOP_XOR + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_XOR);} + TermArg + TermArgItem + Target + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$5,$6);} + | PARSEOP_XOR + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +WhileTerm + : PARSEOP_WHILE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_WHILE);} + TermArg + PARSEOP_CLOSE_PAREN + '{' TermList '}' {$$ = TrLinkOpChildren ($3,2,$4,$7);} + | PARSEOP_WHILE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + + + +/******************************************************************************* + * + * Production rules for the symbolic (c-style) operators + * + ******************************************************************************/ + +/* + * ASL Extensions: C-style math/logical operators and expressions. + * The implementation transforms these operators into the standard + * AML opcodes and syntax. + * + * Supported operators and precedence rules (high-to-low) + * + * NOTE: The operator precedence and associativity rules are + * implemented by the tokens in asltokens.y + * + * (left-to-right): + * 1) ( ) expr++ expr-- + * + * (right-to-left): + * 2) ! ~ + * + * (left-to-right): + * 3) * / % + * 4) + - + * 5) >> << + * 6) < > <= >= + * 7) == != + * 8) & + * 9) ^ + * 10) | + * 11) && + * 12) || + * + * (right-to-left): + * 13) = += -= *= /= %= <<= >>= &= ^= |= + */ + + +/******************************************************************************* + * + * Basic operations for math and logical expressions. + * + ******************************************************************************/ + +Expression + + /* Unary operators */ + + : PARSEOP_EXP_LOGICAL_NOT {$$ = TrCreateLeafOp (PARSEOP_LNOT);} + TermArg {$$ = TrLinkOpChildren ($2,1,$3);} + | PARSEOP_EXP_NOT {$$ = TrCreateLeafOp (PARSEOP_NOT);} + TermArg {$$ = TrLinkOpChildren ($2,2,$3,TrCreateNullTargetOp ());} + + | SuperName PARSEOP_EXP_INCREMENT {$$ = TrCreateLeafOp (PARSEOP_INCREMENT);} + {$$ = TrLinkOpChildren ($3,1,$1);} + | SuperName PARSEOP_EXP_DECREMENT {$$ = TrCreateLeafOp (PARSEOP_DECREMENT);} + {$$ = TrLinkOpChildren ($3,1,$1);} + + /* Binary operators: math and logical */ + + | TermArg PARSEOP_EXP_ADD {$$ = TrCreateLeafOp (PARSEOP_ADD);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_DIVIDE {$$ = TrCreateLeafOp (PARSEOP_DIVIDE);} + TermArg {$$ = TrLinkOpChildren ($3,4,$1,$4,TrCreateNullTargetOp (), + TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_MODULO {$$ = TrCreateLeafOp (PARSEOP_MOD);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_MULTIPLY {$$ = TrCreateLeafOp (PARSEOP_MULTIPLY);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_SHIFT_LEFT {$$ = TrCreateLeafOp (PARSEOP_SHIFTLEFT);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_SHIFT_RIGHT {$$ = TrCreateLeafOp (PARSEOP_SHIFTRIGHT);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_SUBTRACT {$$ = TrCreateLeafOp (PARSEOP_SUBTRACT);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + + | TermArg PARSEOP_EXP_AND {$$ = TrCreateLeafOp (PARSEOP_AND);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_OR {$$ = TrCreateLeafOp (PARSEOP_OR);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + | TermArg PARSEOP_EXP_XOR {$$ = TrCreateLeafOp (PARSEOP_XOR);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4,TrCreateNullTargetOp ());} + + | TermArg PARSEOP_EXP_GREATER {$$ = TrCreateLeafOp (PARSEOP_LGREATER);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_GREATER_EQUAL {$$ = TrCreateLeafOp (PARSEOP_LGREATEREQUAL);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LESS {$$ = TrCreateLeafOp (PARSEOP_LLESS);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LESS_EQUAL {$$ = TrCreateLeafOp (PARSEOP_LLESSEQUAL);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + + | TermArg PARSEOP_EXP_EQUAL {$$ = TrCreateLeafOp (PARSEOP_LEQUAL);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_NOT_EQUAL {$$ = TrCreateLeafOp (PARSEOP_LNOTEQUAL);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + + | TermArg PARSEOP_EXP_LOGICAL_AND {$$ = TrCreateLeafOp (PARSEOP_LAND);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + | TermArg PARSEOP_EXP_LOGICAL_OR {$$ = TrCreateLeafOp (PARSEOP_LOR);} + TermArg {$$ = TrLinkOpChildren ($3,2,$1,$4);} + + /* Parentheses */ + + | PARSEOP_OPEN_PAREN + Expression + PARSEOP_CLOSE_PAREN {$$ = $2;} + + /* Index term -- "= BUF1[5]" on right-hand side of an equals (source) */ + + | IndexExpTerm + ; + + /* + * Index term -- "BUF1[5] = " or " = BUF1[5] on either the left side + * of an equals (target) or the right side (source) + * Currently used in these terms: + * Expression + * ObjectTypeSource + * DerefOfSource + * Type6Opcode + */ +IndexExpTerm + + : SuperName + PARSEOP_EXP_INDEX_LEFT + TermArg + PARSEOP_EXP_INDEX_RIGHT {$$ = TrCreateLeafOp (PARSEOP_INDEX); + TrLinkOpChildren ($$,3,$1,$3,TrCreateNullTargetOp ());} + ; + + +/******************************************************************************* + * + * All assignment-type operations -- math and logical. Includes simple + * assignment and compound assignments. + * + ******************************************************************************/ + +EqualsTerm + + /* Allow parens anywhere */ + + : PARSEOP_OPEN_PAREN + EqualsTerm + PARSEOP_CLOSE_PAREN {$$ = $2;} + + /* Simple Store() operation */ + + | SuperName + PARSEOP_EXP_EQUALS + TermArg {$$ = TrCreateAssignmentOp ($1, $3);} + + /* Chained equals: (a=RefOf)=b, a=b=c=d etc. */ + + | PARSEOP_OPEN_PAREN + EqualsTerm + PARSEOP_CLOSE_PAREN + PARSEOP_EXP_EQUALS + TermArg {$$ = TrCreateAssignmentOp ($2, $5);} + + /* Compound assignments -- Add (operand, operand, target) */ + + | TermArg PARSEOP_EXP_ADD_EQ {$$ = TrCreateLeafOp (PARSEOP_ADD);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} + + | TermArg PARSEOP_EXP_DIV_EQ {$$ = TrCreateLeafOp (PARSEOP_DIVIDE);} + TermArg {$$ = TrLinkOpChildren ($3,4,$1,$4,TrCreateNullTargetOp (), + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} + + | TermArg PARSEOP_EXP_MOD_EQ {$$ = TrCreateLeafOp (PARSEOP_MOD);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} + + | TermArg PARSEOP_EXP_MUL_EQ {$$ = TrCreateLeafOp (PARSEOP_MULTIPLY);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} + + | TermArg PARSEOP_EXP_SHL_EQ {$$ = TrCreateLeafOp (PARSEOP_SHIFTLEFT);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} + + | TermArg PARSEOP_EXP_SHR_EQ {$$ = TrCreateLeafOp (PARSEOP_SHIFTRIGHT);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} + + | TermArg PARSEOP_EXP_SUB_EQ {$$ = TrCreateLeafOp (PARSEOP_SUBTRACT);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} + + | TermArg PARSEOP_EXP_AND_EQ {$$ = TrCreateLeafOp (PARSEOP_AND);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} + + | TermArg PARSEOP_EXP_OR_EQ {$$ = TrCreateLeafOp (PARSEOP_OR);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} + + | TermArg PARSEOP_EXP_XOR_EQ {$$ = TrCreateLeafOp (PARSEOP_XOR);} + TermArg {$$ = TrLinkOpChildren ($3,3,$1,$4, + TrSetOpFlags (TrCreateTargetOp ($1, NULL), OP_IS_TARGET));} + ; + + + +/******************************************************************************* + * + * ASL Parameter Keyword Terms + * + ******************************************************************************/ + +AccessAttribKeyword + : PARSEOP_ACCESSATTRIB_BLOCK {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_BLOCK);} + | PARSEOP_ACCESSATTRIB_BLOCK_CALL {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_BLOCK_CALL);} + | PARSEOP_ACCESSATTRIB_BYTE {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_BYTE);} + | PARSEOP_ACCESSATTRIB_QUICK {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_QUICK );} + | PARSEOP_ACCESSATTRIB_SND_RCV {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_SND_RCV);} + | PARSEOP_ACCESSATTRIB_WORD {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_WORD);} + | PARSEOP_ACCESSATTRIB_WORD_CALL {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_WORD_CALL);} + | PARSEOP_ACCESSATTRIB_BYTES + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_BYTES);} + ByteConst + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_ACCESSATTRIB_RAW_BYTES + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_RAW_BYTES);} + ByteConst + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + | PARSEOP_ACCESSATTRIB_RAW_PROCESS + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_ACCESSATTRIB_RAW_PROCESS);} + ByteConst + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,1,$4);} + ; + +AccessTypeKeyword + : PARSEOP_ACCESSTYPE_ANY {$$ = TrCreateLeafOp (PARSEOP_ACCESSTYPE_ANY);} + | PARSEOP_ACCESSTYPE_BYTE {$$ = TrCreateLeafOp (PARSEOP_ACCESSTYPE_BYTE);} + | PARSEOP_ACCESSTYPE_WORD {$$ = TrCreateLeafOp (PARSEOP_ACCESSTYPE_WORD);} + | PARSEOP_ACCESSTYPE_DWORD {$$ = TrCreateLeafOp (PARSEOP_ACCESSTYPE_DWORD);} + | PARSEOP_ACCESSTYPE_QWORD {$$ = TrCreateLeafOp (PARSEOP_ACCESSTYPE_QWORD);} + | PARSEOP_ACCESSTYPE_BUF {$$ = TrCreateLeafOp (PARSEOP_ACCESSTYPE_BUF);} + ; + +AddressingModeKeyword + : PARSEOP_ADDRESSINGMODE_7BIT {$$ = TrCreateLeafOp (PARSEOP_ADDRESSINGMODE_7BIT);} + | PARSEOP_ADDRESSINGMODE_10BIT {$$ = TrCreateLeafOp (PARSEOP_ADDRESSINGMODE_10BIT);} + ; + +AddressKeyword + : PARSEOP_ADDRESSTYPE_MEMORY {$$ = TrCreateLeafOp (PARSEOP_ADDRESSTYPE_MEMORY);} + | PARSEOP_ADDRESSTYPE_RESERVED {$$ = TrCreateLeafOp (PARSEOP_ADDRESSTYPE_RESERVED);} + | PARSEOP_ADDRESSTYPE_NVS {$$ = TrCreateLeafOp (PARSEOP_ADDRESSTYPE_NVS);} + | PARSEOP_ADDRESSTYPE_ACPI {$$ = TrCreateLeafOp (PARSEOP_ADDRESSTYPE_ACPI);} + ; + +AddressSpaceKeyword + : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);} + | RegionSpaceKeyword {} + ; + +BitsPerByteKeyword + : PARSEOP_BITSPERBYTE_FIVE {$$ = TrCreateLeafOp (PARSEOP_BITSPERBYTE_FIVE);} + | PARSEOP_BITSPERBYTE_SIX {$$ = TrCreateLeafOp (PARSEOP_BITSPERBYTE_SIX);} + | PARSEOP_BITSPERBYTE_SEVEN {$$ = TrCreateLeafOp (PARSEOP_BITSPERBYTE_SEVEN);} + | PARSEOP_BITSPERBYTE_EIGHT {$$ = TrCreateLeafOp (PARSEOP_BITSPERBYTE_EIGHT);} + | PARSEOP_BITSPERBYTE_NINE {$$ = TrCreateLeafOp (PARSEOP_BITSPERBYTE_NINE);} + ; + +ClockPhaseKeyword + : PARSEOP_CLOCKPHASE_FIRST {$$ = TrCreateLeafOp (PARSEOP_CLOCKPHASE_FIRST);} + | PARSEOP_CLOCKPHASE_SECOND {$$ = TrCreateLeafOp (PARSEOP_CLOCKPHASE_SECOND);} + ; + +ClockPolarityKeyword + : PARSEOP_CLOCKPOLARITY_LOW {$$ = TrCreateLeafOp (PARSEOP_CLOCKPOLARITY_LOW);} + | PARSEOP_CLOCKPOLARITY_HIGH {$$ = TrCreateLeafOp (PARSEOP_CLOCKPOLARITY_HIGH);} + ; + +DecodeKeyword + : PARSEOP_DECODETYPE_POS {$$ = TrCreateLeafOp (PARSEOP_DECODETYPE_POS);} + | PARSEOP_DECODETYPE_SUB {$$ = TrCreateLeafOp (PARSEOP_DECODETYPE_SUB);} + ; + +DevicePolarityKeyword + : PARSEOP_DEVICEPOLARITY_LOW {$$ = TrCreateLeafOp (PARSEOP_DEVICEPOLARITY_LOW);} + | PARSEOP_DEVICEPOLARITY_HIGH {$$ = TrCreateLeafOp (PARSEOP_DEVICEPOLARITY_HIGH);} + ; + +DMATypeKeyword + : PARSEOP_DMATYPE_A {$$ = TrCreateLeafOp (PARSEOP_DMATYPE_A);} + | PARSEOP_DMATYPE_COMPATIBILITY {$$ = TrCreateLeafOp (PARSEOP_DMATYPE_COMPATIBILITY);} + | PARSEOP_DMATYPE_B {$$ = TrCreateLeafOp (PARSEOP_DMATYPE_B);} + | PARSEOP_DMATYPE_F {$$ = TrCreateLeafOp (PARSEOP_DMATYPE_F);} + ; + +EndianKeyword + : PARSEOP_ENDIAN_LITTLE {$$ = TrCreateLeafOp (PARSEOP_ENDIAN_LITTLE);} + | PARSEOP_ENDIAN_BIG {$$ = TrCreateLeafOp (PARSEOP_ENDIAN_BIG);} + ; + +FlowControlKeyword + : PARSEOP_FLOWCONTROL_HW {$$ = TrCreateLeafOp (PARSEOP_FLOWCONTROL_HW);} + | PARSEOP_FLOWCONTROL_NONE {$$ = TrCreateLeafOp (PARSEOP_FLOWCONTROL_NONE);} + | PARSEOP_FLOWCONTROL_SW {$$ = TrCreateLeafOp (PARSEOP_FLOWCONTROL_SW);} + ; + +InterruptLevel + : PARSEOP_INTLEVEL_ACTIVEBOTH {$$ = TrCreateLeafOp (PARSEOP_INTLEVEL_ACTIVEBOTH);} + | PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafOp (PARSEOP_INTLEVEL_ACTIVEHIGH);} + | PARSEOP_INTLEVEL_ACTIVELOW {$$ = TrCreateLeafOp (PARSEOP_INTLEVEL_ACTIVELOW);} + ; + +InterruptTypeKeyword + : PARSEOP_INTTYPE_EDGE {$$ = TrCreateLeafOp (PARSEOP_INTTYPE_EDGE);} + | PARSEOP_INTTYPE_LEVEL {$$ = TrCreateLeafOp (PARSEOP_INTTYPE_LEVEL);} + ; + +IODecodeKeyword + : PARSEOP_IODECODETYPE_16 {$$ = TrCreateLeafOp (PARSEOP_IODECODETYPE_16);} + | PARSEOP_IODECODETYPE_10 {$$ = TrCreateLeafOp (PARSEOP_IODECODETYPE_10);} + ; + +IoRestrictionKeyword + : PARSEOP_IORESTRICT_IN {$$ = TrCreateLeafOp (PARSEOP_IORESTRICT_IN);} + | PARSEOP_IORESTRICT_OUT {$$ = TrCreateLeafOp (PARSEOP_IORESTRICT_OUT);} + | PARSEOP_IORESTRICT_NONE {$$ = TrCreateLeafOp (PARSEOP_IORESTRICT_NONE);} + | PARSEOP_IORESTRICT_PRESERVE {$$ = TrCreateLeafOp (PARSEOP_IORESTRICT_PRESERVE);} + ; + +LockRuleKeyword + : PARSEOP_LOCKRULE_LOCK {$$ = TrCreateLeafOp (PARSEOP_LOCKRULE_LOCK);} + | PARSEOP_LOCKRULE_NOLOCK {$$ = TrCreateLeafOp (PARSEOP_LOCKRULE_NOLOCK);} + ; + +MatchOpKeyword + : PARSEOP_MATCHTYPE_MTR {$$ = TrCreateLeafOp (PARSEOP_MATCHTYPE_MTR);} + | PARSEOP_MATCHTYPE_MEQ {$$ = TrCreateLeafOp (PARSEOP_MATCHTYPE_MEQ);} + | PARSEOP_MATCHTYPE_MLE {$$ = TrCreateLeafOp (PARSEOP_MATCHTYPE_MLE);} + | PARSEOP_MATCHTYPE_MLT {$$ = TrCreateLeafOp (PARSEOP_MATCHTYPE_MLT);} + | PARSEOP_MATCHTYPE_MGE {$$ = TrCreateLeafOp (PARSEOP_MATCHTYPE_MGE);} + | PARSEOP_MATCHTYPE_MGT {$$ = TrCreateLeafOp (PARSEOP_MATCHTYPE_MGT);} + ; + +MaxKeyword + : PARSEOP_MAXTYPE_FIXED {$$ = TrCreateLeafOp (PARSEOP_MAXTYPE_FIXED);} + | PARSEOP_MAXTYPE_NOTFIXED {$$ = TrCreateLeafOp (PARSEOP_MAXTYPE_NOTFIXED);} + ; + +MemTypeKeyword + : PARSEOP_MEMTYPE_CACHEABLE {$$ = TrCreateLeafOp (PARSEOP_MEMTYPE_CACHEABLE);} + | PARSEOP_MEMTYPE_WRITECOMBINING {$$ = TrCreateLeafOp (PARSEOP_MEMTYPE_WRITECOMBINING);} + | PARSEOP_MEMTYPE_PREFETCHABLE {$$ = TrCreateLeafOp (PARSEOP_MEMTYPE_PREFETCHABLE);} + | PARSEOP_MEMTYPE_NONCACHEABLE {$$ = TrCreateLeafOp (PARSEOP_MEMTYPE_NONCACHEABLE);} + ; + +MinKeyword + : PARSEOP_MINTYPE_FIXED {$$ = TrCreateLeafOp (PARSEOP_MINTYPE_FIXED);} + | PARSEOP_MINTYPE_NOTFIXED {$$ = TrCreateLeafOp (PARSEOP_MINTYPE_NOTFIXED);} + ; + +ObjectTypeKeyword + : PARSEOP_OBJECTTYPE_UNK {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_UNK);} + | PARSEOP_OBJECTTYPE_INT {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_INT);} + | PARSEOP_OBJECTTYPE_STR {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_STR);} + | PARSEOP_OBJECTTYPE_BUF {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_BUF);} + | PARSEOP_OBJECTTYPE_PKG {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_PKG);} + | PARSEOP_OBJECTTYPE_FLD {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_FLD);} + | PARSEOP_OBJECTTYPE_DEV {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_DEV);} + | PARSEOP_OBJECTTYPE_EVT {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_EVT);} + | PARSEOP_OBJECTTYPE_MTH {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_MTH);} + | PARSEOP_OBJECTTYPE_MTX {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_MTX);} + | PARSEOP_OBJECTTYPE_OPR {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_OPR);} + | PARSEOP_OBJECTTYPE_POW {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_POW);} + | PARSEOP_OBJECTTYPE_PRO {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_PRO);} + | PARSEOP_OBJECTTYPE_THZ {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_THZ);} + | PARSEOP_OBJECTTYPE_BFF {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_BFF);} + | PARSEOP_OBJECTTYPE_DDB {$$ = TrCreateLeafOp (PARSEOP_OBJECTTYPE_DDB);} + ; + +ParityTypeKeyword + : PARSEOP_PARITYTYPE_SPACE {$$ = TrCreateLeafOp (PARSEOP_PARITYTYPE_SPACE);} + | PARSEOP_PARITYTYPE_MARK {$$ = TrCreateLeafOp (PARSEOP_PARITYTYPE_MARK);} + | PARSEOP_PARITYTYPE_ODD {$$ = TrCreateLeafOp (PARSEOP_PARITYTYPE_ODD);} + | PARSEOP_PARITYTYPE_EVEN {$$ = TrCreateLeafOp (PARSEOP_PARITYTYPE_EVEN);} + | PARSEOP_PARITYTYPE_NONE {$$ = TrCreateLeafOp (PARSEOP_PARITYTYPE_NONE);} + ; + +PinConfigByte + : PinConfigKeyword {$$ = $1;} + | ByteConstExpr {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} + ; + +PinConfigKeyword + : PARSEOP_PIN_NOPULL {$$ = TrCreateLeafOp (PARSEOP_PIN_NOPULL);} + | PARSEOP_PIN_PULLDOWN {$$ = TrCreateLeafOp (PARSEOP_PIN_PULLDOWN);} + | PARSEOP_PIN_PULLUP {$$ = TrCreateLeafOp (PARSEOP_PIN_PULLUP);} + | PARSEOP_PIN_PULLDEFAULT {$$ = TrCreateLeafOp (PARSEOP_PIN_PULLDEFAULT);} + ; + +PldKeyword + : PARSEOP_PLD_REVISION {$$ = TrCreateLeafOp (PARSEOP_PLD_REVISION);} + | PARSEOP_PLD_IGNORECOLOR {$$ = TrCreateLeafOp (PARSEOP_PLD_IGNORECOLOR);} + | PARSEOP_PLD_RED {$$ = TrCreateLeafOp (PARSEOP_PLD_RED);} + | PARSEOP_PLD_GREEN {$$ = TrCreateLeafOp (PARSEOP_PLD_GREEN);} + | PARSEOP_PLD_BLUE {$$ = TrCreateLeafOp (PARSEOP_PLD_BLUE);} + | PARSEOP_PLD_WIDTH {$$ = TrCreateLeafOp (PARSEOP_PLD_WIDTH);} + | PARSEOP_PLD_HEIGHT {$$ = TrCreateLeafOp (PARSEOP_PLD_HEIGHT);} + | PARSEOP_PLD_USERVISIBLE {$$ = TrCreateLeafOp (PARSEOP_PLD_USERVISIBLE);} + | PARSEOP_PLD_DOCK {$$ = TrCreateLeafOp (PARSEOP_PLD_DOCK);} + | PARSEOP_PLD_LID {$$ = TrCreateLeafOp (PARSEOP_PLD_LID);} + | PARSEOP_PLD_PANEL {$$ = TrCreateLeafOp (PARSEOP_PLD_PANEL);} + | PARSEOP_PLD_VERTICALPOSITION {$$ = TrCreateLeafOp (PARSEOP_PLD_VERTICALPOSITION);} + | PARSEOP_PLD_HORIZONTALPOSITION {$$ = TrCreateLeafOp (PARSEOP_PLD_HORIZONTALPOSITION);} + | PARSEOP_PLD_SHAPE {$$ = TrCreateLeafOp (PARSEOP_PLD_SHAPE);} + | PARSEOP_PLD_GROUPORIENTATION {$$ = TrCreateLeafOp (PARSEOP_PLD_GROUPORIENTATION);} + | PARSEOP_PLD_GROUPTOKEN {$$ = TrCreateLeafOp (PARSEOP_PLD_GROUPTOKEN);} + | PARSEOP_PLD_GROUPPOSITION {$$ = TrCreateLeafOp (PARSEOP_PLD_GROUPPOSITION);} + | PARSEOP_PLD_BAY {$$ = TrCreateLeafOp (PARSEOP_PLD_BAY);} + | PARSEOP_PLD_EJECTABLE {$$ = TrCreateLeafOp (PARSEOP_PLD_EJECTABLE);} + | PARSEOP_PLD_EJECTREQUIRED {$$ = TrCreateLeafOp (PARSEOP_PLD_EJECTREQUIRED);} + | PARSEOP_PLD_CABINETNUMBER {$$ = TrCreateLeafOp (PARSEOP_PLD_CABINETNUMBER);} + | PARSEOP_PLD_CARDCAGENUMBER {$$ = TrCreateLeafOp (PARSEOP_PLD_CARDCAGENUMBER);} + | PARSEOP_PLD_REFERENCE {$$ = TrCreateLeafOp (PARSEOP_PLD_REFERENCE);} + | PARSEOP_PLD_ROTATION {$$ = TrCreateLeafOp (PARSEOP_PLD_ROTATION);} + | PARSEOP_PLD_ORDER {$$ = TrCreateLeafOp (PARSEOP_PLD_ORDER);} + | PARSEOP_PLD_RESERVED {$$ = TrCreateLeafOp (PARSEOP_PLD_RESERVED);} + | PARSEOP_PLD_VERTICALOFFSET {$$ = TrCreateLeafOp (PARSEOP_PLD_VERTICALOFFSET);} + | PARSEOP_PLD_HORIZONTALOFFSET {$$ = TrCreateLeafOp (PARSEOP_PLD_HORIZONTALOFFSET);} + ; + +RangeTypeKeyword + : PARSEOP_RANGETYPE_ISAONLY {$$ = TrCreateLeafOp (PARSEOP_RANGETYPE_ISAONLY);} + | PARSEOP_RANGETYPE_NONISAONLY {$$ = TrCreateLeafOp (PARSEOP_RANGETYPE_NONISAONLY);} + | PARSEOP_RANGETYPE_ENTIRE {$$ = TrCreateLeafOp (PARSEOP_RANGETYPE_ENTIRE);} + ; + +RegionSpaceKeyword + : PARSEOP_REGIONSPACE_IO {$$ = TrCreateLeafOp (PARSEOP_REGIONSPACE_IO);} + | PARSEOP_REGIONSPACE_MEM {$$ = TrCreateLeafOp (PARSEOP_REGIONSPACE_MEM);} + | PARSEOP_REGIONSPACE_PCI {$$ = TrCreateLeafOp (PARSEOP_REGIONSPACE_PCI);} + | PARSEOP_REGIONSPACE_EC {$$ = TrCreateLeafOp (PARSEOP_REGIONSPACE_EC);} + | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafOp (PARSEOP_REGIONSPACE_SMBUS);} + | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafOp (PARSEOP_REGIONSPACE_CMOS);} + | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafOp (PARSEOP_REGIONSPACE_PCIBAR);} + | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafOp (PARSEOP_REGIONSPACE_IPMI);} + | PARSEOP_REGIONSPACE_GPIO {$$ = TrCreateLeafOp (PARSEOP_REGIONSPACE_GPIO);} + | PARSEOP_REGIONSPACE_GSBUS {$$ = TrCreateLeafOp (PARSEOP_REGIONSPACE_GSBUS);} + | PARSEOP_REGIONSPACE_PCC {$$ = TrCreateLeafOp (PARSEOP_REGIONSPACE_PCC);} + | PARSEOP_REGIONSPACE_FFIXEDHW {$$ = TrCreateLeafOp (PARSEOP_REGIONSPACE_FFIXEDHW);} + ; + +ResourceTypeKeyword + : PARSEOP_RESOURCETYPE_CONSUMER {$$ = TrCreateLeafOp (PARSEOP_RESOURCETYPE_CONSUMER);} + | PARSEOP_RESOURCETYPE_PRODUCER {$$ = TrCreateLeafOp (PARSEOP_RESOURCETYPE_PRODUCER);} + ; + +SerializeRuleKeyword + : PARSEOP_SERIALIZERULE_SERIAL {$$ = TrCreateLeafOp (PARSEOP_SERIALIZERULE_SERIAL);} + | PARSEOP_SERIALIZERULE_NOTSERIAL {$$ = TrCreateLeafOp (PARSEOP_SERIALIZERULE_NOTSERIAL);} + ; + +ShareTypeKeyword + : PARSEOP_SHARETYPE_SHARED {$$ = TrCreateLeafOp (PARSEOP_SHARETYPE_SHARED);} + | PARSEOP_SHARETYPE_EXCLUSIVE {$$ = TrCreateLeafOp (PARSEOP_SHARETYPE_EXCLUSIVE);} + | PARSEOP_SHARETYPE_SHAREDWAKE {$$ = TrCreateLeafOp (PARSEOP_SHARETYPE_SHAREDWAKE);} + | PARSEOP_SHARETYPE_EXCLUSIVEWAKE {$$ = TrCreateLeafOp (PARSEOP_SHARETYPE_EXCLUSIVEWAKE);} + ; + +SlaveModeKeyword + : PARSEOP_SLAVEMODE_CONTROLLERINIT {$$ = TrCreateLeafOp (PARSEOP_SLAVEMODE_CONTROLLERINIT);} + | PARSEOP_SLAVEMODE_DEVICEINIT {$$ = TrCreateLeafOp (PARSEOP_SLAVEMODE_DEVICEINIT);} + ; + +StopBitsKeyword + : PARSEOP_STOPBITS_TWO {$$ = TrCreateLeafOp (PARSEOP_STOPBITS_TWO);} + | PARSEOP_STOPBITS_ONEPLUSHALF {$$ = TrCreateLeafOp (PARSEOP_STOPBITS_ONEPLUSHALF);} + | PARSEOP_STOPBITS_ONE {$$ = TrCreateLeafOp (PARSEOP_STOPBITS_ONE);} + | PARSEOP_STOPBITS_ZERO {$$ = TrCreateLeafOp (PARSEOP_STOPBITS_ZERO);} + ; + +TranslationKeyword + : PARSEOP_TRANSLATIONTYPE_SPARSE {$$ = TrCreateLeafOp (PARSEOP_TRANSLATIONTYPE_SPARSE);} + | PARSEOP_TRANSLATIONTYPE_DENSE {$$ = TrCreateLeafOp (PARSEOP_TRANSLATIONTYPE_DENSE);} + ; + +TypeKeyword + : PARSEOP_TYPE_TRANSLATION {$$ = TrCreateLeafOp (PARSEOP_TYPE_TRANSLATION);} + | PARSEOP_TYPE_STATIC {$$ = TrCreateLeafOp (PARSEOP_TYPE_STATIC);} + ; + +UpdateRuleKeyword + : PARSEOP_UPDATERULE_PRESERVE {$$ = TrCreateLeafOp (PARSEOP_UPDATERULE_PRESERVE);} + | PARSEOP_UPDATERULE_ONES {$$ = TrCreateLeafOp (PARSEOP_UPDATERULE_ONES);} + | PARSEOP_UPDATERULE_ZEROS {$$ = TrCreateLeafOp (PARSEOP_UPDATERULE_ZEROS);} + ; + +WireModeKeyword + : PARSEOP_WIREMODE_FOUR {$$ = TrCreateLeafOp (PARSEOP_WIREMODE_FOUR);} + | PARSEOP_WIREMODE_THREE {$$ = TrCreateLeafOp (PARSEOP_WIREMODE_THREE);} + ; + +XferSizeKeyword + : PARSEOP_XFERSIZE_8 {$$ = TrCreateValuedLeafOp (PARSEOP_XFERSIZE_8, 0);} + | PARSEOP_XFERSIZE_16 {$$ = TrCreateValuedLeafOp (PARSEOP_XFERSIZE_16, 1);} + | PARSEOP_XFERSIZE_32 {$$ = TrCreateValuedLeafOp (PARSEOP_XFERSIZE_32, 2);} + | PARSEOP_XFERSIZE_64 {$$ = TrCreateValuedLeafOp (PARSEOP_XFERSIZE_64, 3);} + | PARSEOP_XFERSIZE_128 {$$ = TrCreateValuedLeafOp (PARSEOP_XFERSIZE_128, 4);} + | PARSEOP_XFERSIZE_256 {$$ = TrCreateValuedLeafOp (PARSEOP_XFERSIZE_256, 5);} + ; + +XferTypeKeyword + : PARSEOP_XFERTYPE_8 {$$ = TrCreateLeafOp (PARSEOP_XFERTYPE_8);} + | PARSEOP_XFERTYPE_8_16 {$$ = TrCreateLeafOp (PARSEOP_XFERTYPE_8_16);} + | PARSEOP_XFERTYPE_16 {$$ = TrCreateLeafOp (PARSEOP_XFERTYPE_16);} + ; + + + + +/******************************************************************************* + * + * ASL Resource Template Terms + * + ******************************************************************************/ + +/* + * Note: Create two default nodes to allow conversion to a Buffer AML opcode + * Also, insert the EndTag at the end of the template. + */ +ResourceTemplateTerm + : PARSEOP_RESOURCETEMPLATE {COMMENT_CAPTURE_OFF;} + OptionalParentheses + '{' + ResourceMacroList '}' {$$ = TrCreateOp (PARSEOP_RESOURCETEMPLATE,4, + TrCreateLeafOp (PARSEOP_DEFAULT_ARG), + TrCreateLeafOp (PARSEOP_DEFAULT_ARG), + $5, + TrCreateLeafOp (PARSEOP_ENDTAG)); + COMMENT_CAPTURE_ON;} + ; + +OptionalParentheses + : {$$ = NULL;} + | PARSEOP_OPEN_PAREN + PARSEOP_CLOSE_PAREN {$$ = NULL;} + ; + +ResourceMacroList + : {$$ = NULL;} + | ResourceMacroList + ResourceMacroTerm {$$ = TrLinkPeerOp ($1,$2);} + ; + +ResourceMacroTerm + : DMATerm {} + | DWordIOTerm {} + | DWordMemoryTerm {} + | DWordSpaceTerm {} + | EndDependentFnTerm {} + | ExtendedIOTerm {} + | ExtendedMemoryTerm {} + | ExtendedSpaceTerm {} + | FixedDmaTerm {} + | FixedIOTerm {} + | GpioIntTerm {} + | GpioIoTerm {} + | I2cSerialBusTerm {} + | I2cSerialBusTermV2 {} + | InterruptTerm {} + | IOTerm {} + | IRQNoFlagsTerm {} + | IRQTerm {} + | Memory24Term {} + | Memory32FixedTerm {} + | Memory32Term {} + | PinConfigTerm {} + | PinFunctionTerm {} + | PinGroupTerm {} + | PinGroupConfigTerm {} + | PinGroupFunctionTerm {} + | QWordIOTerm {} + | QWordMemoryTerm {} + | QWordSpaceTerm {} + | RegisterTerm {} + | SpiSerialBusTerm {} + | SpiSerialBusTermV2 {} + | StartDependentFnNoPriTerm {} + | StartDependentFnTerm {} + | UartSerialBusTerm {} + | UartSerialBusTermV2 {} + | VendorLongTerm {} + | VendorShortTerm {} + | WordBusNumberTerm {} + | WordIOTerm {} + | WordSpaceTerm {} + ; + +DMATerm + : PARSEOP_DMA + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_DMA);} + DMATypeKeyword + OptionalBusMasterKeyword + ',' XferTypeKeyword + OptionalNameString_Last + PARSEOP_CLOSE_PAREN '{' + ByteList '}' {$$ = TrLinkOpChildren ($3,5,$4,$5,$7,$8,$11);} + | PARSEOP_DMA + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +DWordIOTerm + : PARSEOP_DWORDIO + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_DWORDIO);} + OptionalResourceType_First + OptionalMinType + OptionalMaxType + OptionalDecodeType + OptionalRangeType + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString + OptionalType + OptionalTranslationType_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,15, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} + | PARSEOP_DWORDIO + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +DWordMemoryTerm + : PARSEOP_DWORDMEMORY + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_DWORDMEMORY);} + OptionalResourceType_First + OptionalDecodeType + OptionalMinType + OptionalMaxType + OptionalMemType + ',' OptionalReadWriteKeyword + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString + OptionalAddressRange + OptionalType_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,16, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} + | PARSEOP_DWORDMEMORY + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +DWordSpaceTerm + : PARSEOP_DWORDSPACE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_DWORDSPACE);} + ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} + OptionalResourceType + OptionalDecodeType + OptionalMinType + OptionalMaxType + ',' ByteConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,14, + $4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} + | PARSEOP_DWORDSPACE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +EndDependentFnTerm + : PARSEOP_ENDDEPENDENTFN + PARSEOP_OPEN_PAREN + PARSEOP_CLOSE_PAREN {$$ = TrCreateLeafOp (PARSEOP_ENDDEPENDENTFN);} + | PARSEOP_ENDDEPENDENTFN + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ExtendedIOTerm + : PARSEOP_EXTENDEDIO + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_EXTENDEDIO);} + OptionalResourceType_First + OptionalMinType + OptionalMaxType + OptionalDecodeType + OptionalRangeType + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + OptionalQWordConstExpr + OptionalNameString + OptionalType + OptionalTranslationType_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,14, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22);} + | PARSEOP_EXTENDEDIO + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ExtendedMemoryTerm + : PARSEOP_EXTENDEDMEMORY + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_EXTENDEDMEMORY);} + OptionalResourceType_First + OptionalDecodeType + OptionalMinType + OptionalMaxType + OptionalMemType + ',' OptionalReadWriteKeyword + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + OptionalQWordConstExpr + OptionalNameString + OptionalAddressRange + OptionalType_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,15, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24);} + | PARSEOP_EXTENDEDMEMORY + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +ExtendedSpaceTerm + : PARSEOP_EXTENDEDSPACE PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_EXTENDEDSPACE);} + ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} + OptionalResourceType + OptionalDecodeType + OptionalMinType + OptionalMaxType + ',' ByteConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + OptionalQWordConstExpr + OptionalNameString_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,13, + $4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23);} + | PARSEOP_EXTENDEDSPACE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +FixedDmaTerm + : PARSEOP_FIXEDDMA + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_FIXEDDMA);} + WordConstExpr /* 04: DMA RequestLines */ + ',' WordConstExpr /* 06: DMA Channels */ + OptionalXferSize /* 07: DMA TransferSize */ + OptionalNameString /* 08: DescriptorName */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,4,$4,$6,$7,$8);} + | PARSEOP_FIXEDDMA + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +FixedIOTerm + : PARSEOP_FIXEDIO + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_FIXEDIO);} + WordConstExpr + ',' ByteConstExpr + OptionalNameString_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$6,$7);} + | PARSEOP_FIXEDIO + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +GpioIntTerm + : PARSEOP_GPIO_INT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_GPIO_INT);} + InterruptTypeKeyword /* 04: InterruptType */ + ',' InterruptLevel /* 06: InterruptLevel */ + OptionalShareType /* 07: SharedType */ + ',' PinConfigByte /* 09: PinConfig */ + OptionalWordConstExpr /* 10: DebounceTimeout */ + ',' StringData /* 12: ResourceSource */ + OptionalByteConstExpr /* 13: ResourceSourceIndex */ + OptionalResourceType /* 14: ResourceType */ + OptionalNameString /* 15: DescriptorName */ + OptionalBuffer_Last /* 16: VendorData */ + PARSEOP_CLOSE_PAREN '{' + DWordConstExpr '}' {$$ = TrLinkOpChildren ($3,11, + $4,$6,$7,$9,$10,$12,$13,$14,$15,$16,$19);} + | PARSEOP_GPIO_INT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +GpioIoTerm + : PARSEOP_GPIO_IO + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_GPIO_IO);} + OptionalShareType_First /* 04: SharedType */ + ',' PinConfigByte /* 06: PinConfig */ + OptionalWordConstExpr /* 07: DebounceTimeout */ + OptionalWordConstExpr /* 08: DriveStrength */ + OptionalIoRestriction /* 09: IoRestriction */ + ',' StringData /* 11: ResourceSource */ + OptionalByteConstExpr /* 12: ResourceSourceIndex */ + OptionalResourceType /* 13: ResourceType */ + OptionalNameString /* 14: DescriptorName */ + OptionalBuffer_Last /* 15: VendorData */ + PARSEOP_CLOSE_PAREN '{' + DWordList '}' {$$ = TrLinkOpChildren ($3,11, + $4,$6,$7,$8,$9,$11,$12,$13,$14,$15,$18);} + | PARSEOP_GPIO_IO + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +I2cSerialBusTerm + : PARSEOP_I2C_SERIALBUS + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_I2C_SERIALBUS);} + WordConstExpr /* 04: SlaveAddress */ + OptionalSlaveMode /* 05: SlaveMode */ + ',' DWordConstExpr /* 07: ConnectionSpeed */ + OptionalAddressingMode /* 08: AddressingMode */ + ',' StringData /* 10: ResourceSource */ + OptionalByteConstExpr /* 11: ResourceSourceIndex */ + OptionalResourceType /* 12: ResourceType */ + OptionalNameString /* 13: DescriptorName */ + OptionalBuffer_Last /* 14: VendorData */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,10, + $4,$5,$7,$8,$10,$11,$12,$13, + TrCreateLeafOp (PARSEOP_DEFAULT_ARG),$14);} + | PARSEOP_I2C_SERIALBUS + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +I2cSerialBusTermV2 + : PARSEOP_I2C_SERIALBUS_V2 + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_I2C_SERIALBUS_V2);} + WordConstExpr /* 04: SlaveAddress */ + OptionalSlaveMode /* 05: SlaveMode */ + ',' DWordConstExpr /* 07: ConnectionSpeed */ + OptionalAddressingMode /* 08: AddressingMode */ + ',' StringData /* 10: ResourceSource */ + OptionalByteConstExpr /* 11: ResourceSourceIndex */ + OptionalResourceType /* 12: ResourceType */ + OptionalNameString /* 13: DescriptorName */ + OptionalShareType /* 14: Share */ + OptionalBuffer_Last /* 15: VendorData */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,10, + $4,$5,$7,$8,$10,$11,$12,$13,$14,$15);} + | PARSEOP_I2C_SERIALBUS_V2 + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +InterruptTerm + : PARSEOP_INTERRUPT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_INTERRUPT);} + OptionalResourceType_First + ',' InterruptTypeKeyword + ',' InterruptLevel + OptionalShareType + OptionalByteConstExpr + OptionalStringData + OptionalNameString_Last + PARSEOP_CLOSE_PAREN '{' + DWordList '}' {$$ = TrLinkOpChildren ($3,8, + $4,$6,$8,$9,$10,$11,$12,$15);} + | PARSEOP_INTERRUPT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +IOTerm + : PARSEOP_IO + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_IO);} + IODecodeKeyword + ',' WordConstExpr + ',' WordConstExpr + ',' ByteConstExpr + ',' ByteConstExpr + OptionalNameString_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,6,$4,$6,$8,$10,$12,$13);} + | PARSEOP_IO + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +IRQNoFlagsTerm + : PARSEOP_IRQNOFLAGS + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_IRQNOFLAGS);} + OptionalNameString_First + PARSEOP_CLOSE_PAREN '{' + ByteList '}' {$$ = TrLinkOpChildren ($3,2,$4,$7);} + | PARSEOP_IRQNOFLAGS + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +IRQTerm + : PARSEOP_IRQ + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_IRQ);} + InterruptTypeKeyword + ',' InterruptLevel + OptionalShareType + OptionalNameString_Last + PARSEOP_CLOSE_PAREN '{' + ByteList '}' {$$ = TrLinkOpChildren ($3,5,$4,$6,$7,$8,$11);} + | PARSEOP_IRQ + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +Memory24Term + : PARSEOP_MEMORY24 + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_MEMORY24);} + OptionalReadWriteKeyword + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + OptionalNameString_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,6,$4,$6,$8,$10,$12,$13);} + | PARSEOP_MEMORY24 + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +Memory32FixedTerm + : PARSEOP_MEMORY32FIXED + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_MEMORY32FIXED);} + OptionalReadWriteKeyword + ',' DWordConstExpr + ',' DWordConstExpr + OptionalNameString_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,4,$4,$6,$8,$9);} + | PARSEOP_MEMORY32FIXED + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +Memory32Term + : PARSEOP_MEMORY32 + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_MEMORY32);} + OptionalReadWriteKeyword + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + OptionalNameString_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,6,$4,$6,$8,$10,$12,$13);} + | PARSEOP_MEMORY32 + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinConfigTerm + : PARSEOP_PINCONFIG + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_PINCONFIG);} + OptionalShareType_First /* 04: SharedType */ + ',' ByteConstExpr /* 06: PinConfigType */ + ',' DWordConstExpr /* 08: PinConfigValue */ + ',' StringData /* 10: ResourceSource */ + OptionalByteConstExpr /* 11: ResourceSourceIndex */ + OptionalResourceType /* 12: ResourceType */ + OptionalNameString /* 13: DescriptorName */ + OptionalBuffer_Last /* 14: VendorData */ + PARSEOP_CLOSE_PAREN '{' + DWordList '}' {$$ = TrLinkOpChildren ($3,9, + $4,$6,$8,$10,$11,$12,$13,$14,$17);} + | PARSEOP_PINCONFIG + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinFunctionTerm + : PARSEOP_PINFUNCTION + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_PINFUNCTION);} + OptionalShareType_First /* 04: SharedType */ + ',' PinConfigByte /* 06: PinConfig */ + ',' WordConstExpr /* 08: FunctionNumber */ + ',' StringData /* 10: ResourceSource */ + OptionalByteConstExpr /* 11: ResourceSourceIndex */ + OptionalResourceType /* 12: ResourceType */ + OptionalNameString /* 13: DescriptorName */ + OptionalBuffer_Last /* 14: VendorData */ + PARSEOP_CLOSE_PAREN '{' + DWordList '}' {$$ = TrLinkOpChildren ($3,9, + $4,$6,$8,$10,$11,$12,$13,$14,$17);} + | PARSEOP_PINFUNCTION + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinGroupTerm + : PARSEOP_PINGROUP + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_PINGROUP);} + StringData /* 04: ResourceLabel */ + OptionalProducerResourceType /* 05: ResourceType */ + OptionalNameString /* 06: DescriptorName */ + OptionalBuffer_Last /* 07: VendorData */ + PARSEOP_CLOSE_PAREN '{' + DWordList '}' {$$ = TrLinkOpChildren ($3,5,$4,$5,$6,$7,$10);} + | PARSEOP_PINGROUP + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinGroupConfigTerm + : PARSEOP_PINGROUPCONFIG + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_PINGROUPCONFIG);} + OptionalShareType_First /* 04: SharedType */ + ',' ByteConstExpr /* 06: PinConfigType */ + ',' DWordConstExpr /* 08: PinConfigValue */ + ',' StringData /* 10: ResourceSource */ + OptionalByteConstExpr /* 11: ResourceSourceIndex */ + ',' StringData /* 13: ResourceSourceLabel */ + OptionalResourceType /* 14: ResourceType */ + OptionalNameString /* 15: DescriptorName */ + OptionalBuffer_Last /* 16: VendorData */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,9, + $4,$6,$8,$10,$11,$13,$14,$15,$16);} + | PARSEOP_PINGROUPCONFIG + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinGroupFunctionTerm + : PARSEOP_PINGROUPFUNCTION + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_PINGROUPFUNCTION);} + OptionalShareType_First /* 04: SharedType */ + ',' WordConstExpr /* 06: FunctionNumber */ + ',' StringData /* 08: ResourceSource */ + OptionalByteConstExpr /* 09: ResourceSourceIndex */ + ',' StringData /* 11: ResourceSourceLabel */ + OptionalResourceType /* 12: ResourceType */ + OptionalNameString /* 13: DescriptorName */ + OptionalBuffer_Last /* 14: VendorData */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,8, + $4,$6,$8,$9,$11,$12,$13,$14);} + | PARSEOP_PINGROUPFUNCTION + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +QWordIOTerm + : PARSEOP_QWORDIO + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_QWORDIO);} + OptionalResourceType_First + OptionalMinType + OptionalMaxType + OptionalDecodeType + OptionalRangeType + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString + OptionalType + OptionalTranslationType_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,15, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} + | PARSEOP_QWORDIO + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +QWordMemoryTerm + : PARSEOP_QWORDMEMORY + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_QWORDMEMORY);} + OptionalResourceType_First + OptionalDecodeType + OptionalMinType + OptionalMaxType + OptionalMemType + ',' OptionalReadWriteKeyword + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString + OptionalAddressRange + OptionalType_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,16, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} + | PARSEOP_QWORDMEMORY + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +QWordSpaceTerm + : PARSEOP_QWORDSPACE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_QWORDSPACE);} + ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} + OptionalResourceType + OptionalDecodeType + OptionalMinType + OptionalMaxType + ',' ByteConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,14, + $4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} + | PARSEOP_QWORDSPACE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +RegisterTerm + : PARSEOP_REGISTER + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_REGISTER);} + AddressSpaceKeyword + ',' ByteConstExpr + ',' ByteConstExpr + ',' QWordConstExpr + OptionalAccessSize + OptionalNameString_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,6,$4,$6,$8,$10,$11,$12);} + | PARSEOP_REGISTER + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +SpiSerialBusTerm + : PARSEOP_SPI_SERIALBUS + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_SPI_SERIALBUS);} + WordConstExpr /* 04: DeviceSelection */ + OptionalDevicePolarity /* 05: DevicePolarity */ + OptionalWireMode /* 06: WireMode */ + ',' ByteConstExpr /* 08: DataBitLength */ + OptionalSlaveMode /* 09: SlaveMode */ + ',' DWordConstExpr /* 11: ConnectionSpeed */ + ',' ClockPolarityKeyword /* 13: ClockPolarity */ + ',' ClockPhaseKeyword /* 15: ClockPhase */ + ',' StringData /* 17: ResourceSource */ + OptionalByteConstExpr /* 18: ResourceSourceIndex */ + OptionalResourceType /* 19: ResourceType */ + OptionalNameString /* 20: DescriptorName */ + OptionalBuffer_Last /* 21: VendorData */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,14, + $4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20, + TrCreateLeafOp (PARSEOP_DEFAULT_ARG),$21);} + | PARSEOP_SPI_SERIALBUS + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +SpiSerialBusTermV2 + : PARSEOP_SPI_SERIALBUS_V2 + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_SPI_SERIALBUS_V2);} + WordConstExpr /* 04: DeviceSelection */ + OptionalDevicePolarity /* 05: DevicePolarity */ + OptionalWireMode /* 06: WireMode */ + ',' ByteConstExpr /* 08: DataBitLength */ + OptionalSlaveMode /* 09: SlaveMode */ + ',' DWordConstExpr /* 11: ConnectionSpeed */ + ',' ClockPolarityKeyword /* 13: ClockPolarity */ + ',' ClockPhaseKeyword /* 15: ClockPhase */ + ',' StringData /* 17: ResourceSource */ + OptionalByteConstExpr /* 18: ResourceSourceIndex */ + OptionalResourceType /* 19: ResourceType */ + OptionalNameString /* 20: DescriptorName */ + OptionalShareType /* 21: Share */ + OptionalBuffer_Last /* 22: VendorData */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,14, + $4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20,$21,$22);} + | PARSEOP_SPI_SERIALBUS_V2 + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +StartDependentFnNoPriTerm + : PARSEOP_STARTDEPENDENTFN_NOPRI + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_STARTDEPENDENTFN_NOPRI);} + PARSEOP_CLOSE_PAREN '{' + ResourceMacroList '}' {$$ = TrLinkOpChildren ($3,1,$6);} + | PARSEOP_STARTDEPENDENTFN_NOPRI + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +StartDependentFnTerm + : PARSEOP_STARTDEPENDENTFN + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_STARTDEPENDENTFN);} + ByteConstExpr + ',' ByteConstExpr + PARSEOP_CLOSE_PAREN '{' + ResourceMacroList '}' {$$ = TrLinkOpChildren ($3,3,$4,$6,$9);} + | PARSEOP_STARTDEPENDENTFN + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +UartSerialBusTerm + : PARSEOP_UART_SERIALBUS + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_UART_SERIALBUS);} + DWordConstExpr /* 04: ConnectionSpeed */ + OptionalBitsPerByte /* 05: BitsPerByte */ + OptionalStopBits /* 06: StopBits */ + ',' ByteConstExpr /* 08: LinesInUse */ + OptionalEndian /* 09: Endianness */ + OptionalParityType /* 10: Parity */ + OptionalFlowControl /* 11: FlowControl */ + ',' WordConstExpr /* 13: Rx BufferSize */ + ',' WordConstExpr /* 15: Tx BufferSize */ + ',' StringData /* 17: ResourceSource */ + OptionalByteConstExpr /* 18: ResourceSourceIndex */ + OptionalResourceType /* 19: ResourceType */ + OptionalNameString /* 20: DescriptorName */ + OptionalBuffer_Last /* 21: VendorData */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,15, + $4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20, + TrCreateLeafOp (PARSEOP_DEFAULT_ARG),$21);} + | PARSEOP_UART_SERIALBUS + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +UartSerialBusTermV2 + : PARSEOP_UART_SERIALBUS_V2 + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_UART_SERIALBUS_V2);} + DWordConstExpr /* 04: ConnectionSpeed */ + OptionalBitsPerByte /* 05: BitsPerByte */ + OptionalStopBits /* 06: StopBits */ + ',' ByteConstExpr /* 08: LinesInUse */ + OptionalEndian /* 09: Endianness */ + OptionalParityType /* 10: Parity */ + OptionalFlowControl /* 11: FlowControl */ + ',' WordConstExpr /* 13: Rx BufferSize */ + ',' WordConstExpr /* 15: Tx BufferSize */ + ',' StringData /* 17: ResourceSource */ + OptionalByteConstExpr /* 18: ResourceSourceIndex */ + OptionalResourceType /* 19: ResourceType */ + OptionalNameString /* 20: DescriptorName */ + OptionalShareType /* 21: Share */ + OptionalBuffer_Last /* 22: VendorData */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,15, + $4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20,$21,$22);} + | PARSEOP_UART_SERIALBUS_V2 + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +VendorLongTerm + : PARSEOP_VENDORLONG + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_VENDORLONG);} + OptionalNameString_First + PARSEOP_CLOSE_PAREN '{' + ByteList '}' {$$ = TrLinkOpChildren ($3,2,$4,$7);} + | PARSEOP_VENDORLONG + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +VendorShortTerm + : PARSEOP_VENDORSHORT + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_VENDORSHORT);} + OptionalNameString_First + PARSEOP_CLOSE_PAREN '{' + ByteList '}' {$$ = TrLinkOpChildren ($3,2,$4,$7);} + | PARSEOP_VENDORSHORT + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +WordBusNumberTerm + : PARSEOP_WORDBUSNUMBER + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_WORDBUSNUMBER);} + OptionalResourceType_First + OptionalMinType + OptionalMaxType + OptionalDecodeType + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,12, + $4,$5,$6,$7,$9,$11,$13,$15,$17,$18,$19,$20);} + | PARSEOP_WORDBUSNUMBER + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +WordIOTerm + : PARSEOP_WORDIO + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_WORDIO);} + OptionalResourceType_First + OptionalMinType + OptionalMaxType + OptionalDecodeType + OptionalRangeType + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString + OptionalType + OptionalTranslationType_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,15, + $4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} + | PARSEOP_WORDIO + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +WordSpaceTerm + : PARSEOP_WORDSPACE + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_WORDSPACE);} + ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} + OptionalResourceType + OptionalDecodeType + OptionalMinType + OptionalMaxType + ',' ByteConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString_Last + PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,14, + $4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} + | PARSEOP_WORDSPACE + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + + + + +/******************************************************************************* + * + * ASL Helper Terms + * + ******************************************************************************/ + +OptionalBusMasterKeyword + : ',' {$$ = TrCreateLeafOp ( + PARSEOP_BUSMASTERTYPE_MASTER);} + | ',' PARSEOP_BUSMASTERTYPE_MASTER {$$ = TrCreateLeafOp ( + PARSEOP_BUSMASTERTYPE_MASTER);} + | ',' PARSEOP_BUSMASTERTYPE_NOTMASTER {$$ = TrCreateLeafOp ( + PARSEOP_BUSMASTERTYPE_NOTMASTER);} + ; + +OptionalAccessAttribTerm + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' ByteConstExpr {$$ = $2;} + | ',' AccessAttribKeyword {$$ = $2;} + ; + +OptionalAccessSize + : {$$ = TrCreateValuedLeafOp ( + PARSEOP_BYTECONST, 0);} + | ',' {$$ = TrCreateValuedLeafOp ( + PARSEOP_BYTECONST, 0);} + | ',' ByteConstExpr {$$ = $2;} + ; + +OptionalAccessTypeKeyword /* Default: AnyAcc */ + : {$$ = TrCreateLeafOp ( + PARSEOP_ACCESSTYPE_ANY);} + | ',' {$$ = TrCreateLeafOp ( + PARSEOP_ACCESSTYPE_ANY);} + | ',' AccessTypeKeyword {$$ = $2;} + ; + +OptionalAddressingMode + : ',' {$$ = NULL;} + | ',' AddressingModeKeyword {$$ = $2;} + ; + +OptionalAddressRange + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' AddressKeyword {$$ = $2;} + ; + +OptionalBitsPerByte + : ',' {$$ = NULL;} + | ',' BitsPerByteKeyword {$$ = $2;} + ; + +OptionalBuffer_Last + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' RawDataBufferTerm {$$ = $2;} + ; + +OptionalByteConstExpr + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' ByteConstExpr {$$ = $2;} + ; + +OptionalDecodeType + : ',' {$$ = NULL;} + | ',' DecodeKeyword {$$ = $2;} + ; + +OptionalDevicePolarity + : ',' {$$ = NULL;} + | ',' DevicePolarityKeyword {$$ = $2;} + ; + +OptionalDWordConstExpr + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' DWordConstExpr {$$ = $2;} + ; + +OptionalEndian + : ',' {$$ = NULL;} + | ',' EndianKeyword {$$ = $2;} + ; + +OptionalFlowControl + : ',' {$$ = NULL;} + | ',' FlowControlKeyword {$$ = $2;} + ; + +OptionalIoRestriction + : ',' {$$ = NULL;} + | ',' IoRestrictionKeyword {$$ = $2;} + ; + +OptionalListString + : {$$ = TrCreateValuedLeafOp ( + PARSEOP_STRING_LITERAL, + ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ + | ',' {$$ = TrCreateValuedLeafOp ( + PARSEOP_STRING_LITERAL, + ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ + | ',' TermArg {$$ = $2;} + ; + +OptionalLockRuleKeyword /* Default: NoLock */ + : {$$ = TrCreateLeafOp ( + PARSEOP_LOCKRULE_NOLOCK);} + | ',' {$$ = TrCreateLeafOp ( + PARSEOP_LOCKRULE_NOLOCK);} + | ',' LockRuleKeyword {$$ = $2;} + ; + +OptionalMaxType + : ',' {$$ = NULL;} + | ',' MaxKeyword {$$ = $2;} + ; + +OptionalMemType + : ',' {$$ = NULL;} + | ',' MemTypeKeyword {$$ = $2;} + ; + +OptionalMinType + : ',' {$$ = NULL;} + | ',' MinKeyword {$$ = $2;} + ; + +OptionalNameString + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' NameString {$$ = $2;} + ; + +OptionalNameString_Last + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' NameString {$$ = $2;} + ; + +OptionalNameString_First + : {$$ = TrCreateLeafOp ( + PARSEOP_ZERO);} + | NameString {$$ = $1;} + ; + +OptionalObjectTypeKeyword + : {$$ = TrCreateLeafOp ( + PARSEOP_OBJECTTYPE_UNK);} + | ',' ObjectTypeKeyword {$$ = $2;} + ; + +OptionalParityType + : ',' {$$ = NULL;} + | ',' ParityTypeKeyword {$$ = $2;} + ; + +OptionalQWordConstExpr + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' QWordConstExpr {$$ = $2;} + ; + +OptionalRangeType + : ',' {$$ = NULL;} + | ',' RangeTypeKeyword {$$ = $2;} + ; + +OptionalReadWriteKeyword + : {$$ = TrCreateLeafOp ( + PARSEOP_READWRITETYPE_BOTH);} + | PARSEOP_READWRITETYPE_BOTH {$$ = TrCreateLeafOp ( + PARSEOP_READWRITETYPE_BOTH);} + | PARSEOP_READWRITETYPE_READONLY {$$ = TrCreateLeafOp ( + PARSEOP_READWRITETYPE_READONLY);} + ; + +OptionalResourceType_First + : {$$ = TrCreateLeafOp ( + PARSEOP_RESOURCETYPE_CONSUMER);} + | ResourceTypeKeyword {$$ = $1;} + ; + +OptionalResourceType + : {$$ = TrCreateLeafOp ( + PARSEOP_RESOURCETYPE_CONSUMER);} + | ',' {$$ = TrCreateLeafOp ( + PARSEOP_RESOURCETYPE_CONSUMER);} + | ',' ResourceTypeKeyword {$$ = $2;} + ; + +/* Same as above except default is producer */ +OptionalProducerResourceType + : {$$ = TrCreateLeafOp ( + PARSEOP_RESOURCETYPE_PRODUCER);} + | ',' {$$ = TrCreateLeafOp ( + PARSEOP_RESOURCETYPE_PRODUCER);} + | ',' ResourceTypeKeyword {$$ = $2;} + ; + +OptionalSlaveMode + : ',' {$$ = NULL;} + | ',' SlaveModeKeyword {$$ = $2;} + ; + +OptionalShareType + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' ShareTypeKeyword {$$ = $2;} + ; + +OptionalShareType_First + : {$$ = NULL;} + | ShareTypeKeyword {$$ = $1;} + ; + +OptionalStopBits + : ',' {$$ = NULL;} + | ',' StopBitsKeyword {$$ = $2;} + ; + +OptionalStringData + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' StringData {$$ = $2;} + ; + +OptionalSyncLevel /* Default: 0 */ + : {$$ = TrCreateValuedLeafOp ( + PARSEOP_BYTECONST, 0);} + | ',' {$$ = TrCreateValuedLeafOp ( + PARSEOP_BYTECONST, 0);} + | ',' ByteConstExpr {$$ = $2;} + ; + +OptionalTranslationType_Last + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' TranslationKeyword {$$ = $2;} + ; + +OptionalType + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' TypeKeyword {$$ = $2;} + ; + +OptionalType_Last + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' TypeKeyword {$$ = $2;} + ; + +OptionalUpdateRuleKeyword /* Default: Preserve */ + : {$$ = TrCreateLeafOp ( + PARSEOP_UPDATERULE_PRESERVE);} + | ',' {$$ = TrCreateLeafOp ( + PARSEOP_UPDATERULE_PRESERVE);} + | ',' UpdateRuleKeyword {$$ = $2;} + ; + +OptionalWireMode + : ',' {$$ = NULL;} + | ',' WireModeKeyword {$$ = $2;} + ; + +OptionalWordConstExpr + : ',' {$$ = NULL;} + | ',' WordConstExpr {$$ = $2;} + ; + +OptionalXferSize + : {$$ = TrCreateValuedLeafOp ( + PARSEOP_XFERSIZE_32, 2);} + | ',' {$$ = TrCreateValuedLeafOp ( + PARSEOP_XFERSIZE_32, 2);} + | ',' XferSizeKeyword {$$ = $2;} + ; + +%% + +/*! [End] no source code translation !*/ + +/* Local support functions in C */ + + + +/****************************************************************************** + * + * Local support functions + * + *****************************************************************************/ + +/*! [Begin] no source code translation */ +int +AslCompilerwrap(void) +{ + return (1); +} +/*! [End] no source code translation !*/ + + +void * +AslLocalAllocate ( + unsigned int Size) +{ + void *Mem; + + + DbgPrint (ASL_PARSE_OUTPUT, + "\nAslLocalAllocate: Expanding Stack to %u\n\n", Size); + + Mem = ACPI_ALLOCATE_ZEROED (Size); + if (!Mem) + { + AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, + AslGbl_CurrentLineNumber, AslGbl_LogicalLineNumber, + AslGbl_InputByteCount, AslGbl_CurrentColumn, + AslGbl_Files[ASL_FILE_INPUT].Filename, NULL); + exit (1); + } + + return (Mem); +} + +ACPI_PARSE_OBJECT * +AslDoError ( + void) +{ + + return (TrCreateLeafOp (PARSEOP_ERRORNODE)); +} + + +/******************************************************************************* + * + * FUNCTION: UtGetOpName + * + * PARAMETERS: ParseOpcode - Parser keyword ID + * + * RETURN: Pointer to the opcode name + * + * DESCRIPTION: Get the ascii name of the parse opcode + * + ******************************************************************************/ + +char * +UtGetOpName ( + UINT32 ParseOpcode) +{ +#ifdef ASL_YYTNAME_START + /* + * First entries (ASL_YYTNAME_START) in yytname are special reserved names. + * Ignore first 8 characters of the name + */ + return ((char *) yytname + [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8); +#else + return ("[Unknown parser generator]"); +#endif +} + diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index 7de5787..9eff6d2 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -190,4 +190,20 @@ #define COMMENT_CAPTURE_ON AslGbl_CommentState.CaptureComments = TRUE; #define COMMENT_CAPTURE_OFF AslGbl_CommentState.CaptureComments = FALSE; +/* + * Special name segments - these must only be declared at the root scope + */ +#define NAMESEG__PTS "_PTS" +#define NAMESEG__WAK "_WAK" +#define NAMESEG__S0 "_S0_" +#define NAMESEG__S1 "_S1_" +#define NAMESEG__S2 "_S2_" +#define NAMESEG__S3 "_S3_" +#define NAMESEG__S4 "_S4_" +#define NAMESEG__S5 "_S5_" +#define NAMESEG__TTS "_TTS" + +#define MAX_SPECIAL_NAMES 9 + + #endif /* ASLDEFINE.H */ diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index ce9d8c3..019082a 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -115,13 +115,28 @@ const char *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS] = "OP_NOT_FOUND_DURING_LOAD" }; +const char *AslGbl_SpecialNamedObjects [MAX_SPECIAL_NAMES] = +{ + NAMESEG__PTS, + NAMESEG__WAK, + NAMESEG__S0, + NAMESEG__S1, + NAMESEG__S2, + NAMESEG__S3, + NAMESEG__S4, + NAMESEG__S5, + NAMESEG__TTS +}; + #else extern ASL_FILE_DESC AslGbl_FileDescs [ASL_NUM_FILES]; extern UINT32 AslGbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; extern const char *AslGbl_OpFlagNames[ACPI_NUM_OP_FLAGS]; +extern const char *AslGbl_SpecialNamedObjects[MAX_SPECIAL_NAMES]; #endif + /* * Parser and other externals */ diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index 0f96756..9eb3f7a 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -56,6 +56,7 @@ static ACPI_STATUS LdLoadFieldElements ( + UINT32 AmlType, ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState); @@ -82,6 +83,10 @@ LdCommonNamespaceEnd ( UINT32 Level, void *Context); +static void +LdCheckSpecialNames ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op); /******************************************************************************* * @@ -139,7 +144,8 @@ LdLoadNamespace ( * * FUNCTION: LdLoadFieldElements * - * PARAMETERS: Op - Parent node (Field) + * PARAMETERS: AmlType - Type to search + * Op - Parent node (Field) * WalkState - Current walk state * * RETURN: Status @@ -151,6 +157,7 @@ LdLoadNamespace ( static ACPI_STATUS LdLoadFieldElements ( + UINT32 AmlType, ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState) { @@ -166,7 +173,7 @@ LdLoadFieldElements ( { Status = AcpiNsLookup (WalkState->ScopeInfo, SourceRegion->Asl.Value.String, - ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, + AmlType, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); if (Status == AE_NOT_FOUND) { @@ -399,11 +406,15 @@ LdNamespace1Begin ( */ switch (Op->Asl.AmlOpcode) { - case AML_BANK_FIELD_OP: case AML_INDEX_FIELD_OP: + + Status = LdLoadFieldElements (ACPI_TYPE_LOCAL_REGION_FIELD, Op, WalkState); + return (Status); + + case AML_BANK_FIELD_OP: case AML_FIELD_OP: - Status = LdLoadFieldElements (Op, WalkState); + Status = LdLoadFieldElements (ACPI_TYPE_REGION, Op, WalkState); return (Status); case AML_INT_CONNECTION_OP: @@ -858,6 +869,10 @@ LdNamespace1Begin ( } } + /* Check special names like _WAK and _PTS */ + + LdCheckSpecialNames (Node, Op); + if (ForceNewScope) { Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); @@ -898,6 +913,42 @@ FinishNode: /******************************************************************************* * + * FUNCTION: LdCheckSpecialNames + * + * PARAMETERS: Node - Node that represents the named object + * Op - Named object declaring this named object + * + * RETURN: None + * + * DESCRIPTION: Check if certain named objects are declared in the incorrect + * scope. Special named objects are listed in + * AslGbl_SpecialNamedObjects and can only be declared at the root + * scope. + * + ******************************************************************************/ + +static void +LdCheckSpecialNames ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op) +{ + UINT32 i; + + + for (i = 0; i < MAX_SPECIAL_NAMES; i++) + { + if (ACPI_COMPARE_NAMESEG(Node->Name.Ascii, AslGbl_SpecialNamedObjects[i]) && + Node->Parent != AcpiGbl_RootNode) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName); + return; + } + } +} + + +/******************************************************************************* + * * FUNCTION: LdNamespace2Begin * * PARAMETERS: ASL_WALK_CALLBACK diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c index 0bafea2..9c45f49 100644 --- a/source/compiler/aslmessages.c +++ b/source/compiler/aslmessages.c @@ -257,7 +257,8 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_REGION_LENGTH */ "Operation Region declared with zero length", /* ASL_MSG_TEMPORARY_OBJECT */ "Object is created temporarily in another method and cannot be accessed", /* ASL_MSG_UNDEFINED_EXTERNAL */ "Named object was declared external but the actual definition does not exist", -/* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer" +/* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer", +/* ASL_MSG_INVALID_SPECIAL_NAME */ "declaration of this named object outside root scope is illegal" }; /* Table compiler */ diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h index 2f5a2cf..79d0c2c 100644 --- a/source/compiler/aslmessages.h +++ b/source/compiler/aslmessages.h @@ -260,6 +260,7 @@ typedef enum ASL_MSG_TEMPORARY_OBJECT, ASL_MSG_UNDEFINED_EXTERNAL, ASL_MSG_BUFFER_FIELD_OVERFLOW, + ASL_MSG_INVALID_SPECIAL_NAME, /* These messages are used by the Data Table compiler only */ diff --git a/source/compiler/aslstubs.c b/source/compiler/aslstubs.c index 5b0694e..0fc8d87 100644 --- a/source/compiler/aslstubs.c +++ b/source/compiler/aslstubs.c @@ -58,12 +58,6 @@ * Things like Events, Global Lock, etc. are not used * by the compiler, so they are stubbed out here. */ -void -AcpiNsExecModuleCodeList ( - void) -{ -} - ACPI_STATUS AcpiNsInitializeObjects ( void) diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l index aff251e..830e541 100644 --- a/source/compiler/aslsupport.l +++ b/source/compiler/aslsupport.l @@ -112,7 +112,7 @@ AslDoLineDirective ( while ((c = input()) != '\n' && c != EOF) { - *AslGbl_LineBufPtr = c; + *AslGbl_LineBufPtr = (char) c; AslGbl_LineBufPtr++; } *AslGbl_LineBufPtr = 0; @@ -390,7 +390,7 @@ AslInsertLineBuffer ( if (AcpiGbl_CaptureComments) { - CvProcessCommentState (SourceChar); + CvProcessCommentState ((char) SourceChar); } } } @@ -493,7 +493,7 @@ loop: AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } c1 = c; @@ -521,7 +521,7 @@ loop: AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } @@ -612,7 +612,7 @@ AslDoCommentType2 ( AslInsertLineBuffer (c); if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { - *StringBuffer = c; + *StringBuffer = (char) c; ++StringBuffer; } } @@ -770,7 +770,7 @@ DoCharacter: if (ACPI_IS_OCTAL_DIGIT (StringChar)) { State = ASL_OCTAL_CONSTANT; - ConvertBuffer[0] = StringChar; + ConvertBuffer[0] = (char) StringChar; i = 1; continue; } @@ -826,7 +826,7 @@ DoCharacter: /* Append another digit of the constant */ - ConvertBuffer[i] = StringChar; + ConvertBuffer[i] = (char) StringChar; i++; continue; @@ -870,7 +870,7 @@ DoCharacter: /* Append another digit of the constant */ - ConvertBuffer[i] = StringChar; + ConvertBuffer[i] = (char) StringChar; i++; continue; @@ -881,7 +881,7 @@ DoCharacter: /* Save the finished character */ - *StringBuffer = StringChar; + *StringBuffer = (char) StringChar; StringBuffer++; if (StringBuffer >= EndBuffer) { diff --git a/source/components/dispatcher/dsinit.c b/source/components/dispatcher/dsinit.c index 8db132d..6e3d844 100644 --- a/source/components/dispatcher/dsinit.c +++ b/source/components/dispatcher/dsinit.c @@ -254,7 +254,7 @@ AcpiDsInitializeObjects ( if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT)) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nInitializing Namespace objects:\n")); + "\nACPI table initialization:\n")); } /* Summary of objects initialized */ diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c index 7527a00..4f282e2 100644 --- a/source/components/events/evgpe.c +++ b/source/components/events/evgpe.c @@ -208,6 +208,7 @@ AcpiEvMaskGpe ( * FUNCTION: AcpiEvAddGpeReference * * PARAMETERS: GpeEventInfo - Add a reference to this GPE + * ClearOnEnable - Clear GPE status before enabling it * * RETURN: Status * @@ -218,7 +219,8 @@ AcpiEvMaskGpe ( ACPI_STATUS AcpiEvAddGpeReference ( - ACPI_GPE_EVENT_INFO *GpeEventInfo) + ACPI_GPE_EVENT_INFO *GpeEventInfo, + BOOLEAN ClearOnEnable) { ACPI_STATUS Status = AE_OK; @@ -236,6 +238,11 @@ AcpiEvAddGpeReference ( { /* Enable on first reference */ + if (ClearOnEnable) + { + (void) AcpiHwClearGpe (GpeEventInfo); + } + Status = AcpiEvUpdateGpeEnableMask (GpeEventInfo); if (ACPI_SUCCESS (Status)) { diff --git a/source/components/events/evgpeblk.c b/source/components/events/evgpeblk.c index 131eec8..b523bbf 100644 --- a/source/components/events/evgpeblk.c +++ b/source/components/events/evgpeblk.c @@ -529,7 +529,7 @@ AcpiEvInitializeGpeBlock ( continue; } - Status = AcpiEvAddGpeReference (GpeEventInfo); + Status = AcpiEvAddGpeReference (GpeEventInfo, FALSE); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, diff --git a/source/components/events/evxface.c b/source/components/events/evxface.c index d6f1d2f..bbbeedd 100644 --- a/source/components/events/evxface.c +++ b/source/components/events/evxface.c @@ -1148,7 +1148,7 @@ AcpiRemoveGpeHandler ( ACPI_GPE_DISPATCH_NOTIFY)) && Handler->OriginallyEnabled) { - (void) AcpiEvAddGpeReference (GpeEventInfo); + (void) AcpiEvAddGpeReference (GpeEventInfo, FALSE); if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo)) { /* Poll edge triggered GPEs to handle existing events */ diff --git a/source/components/events/evxfgpe.c b/source/components/events/evxfgpe.c index 161f3c7..f56aa1d 100644 --- a/source/components/events/evxfgpe.c +++ b/source/components/events/evxfgpe.c @@ -159,7 +159,7 @@ AcpiEnableGpe ( if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != ACPI_GPE_DISPATCH_NONE) { - Status = AcpiEvAddGpeReference (GpeEventInfo); + Status = AcpiEvAddGpeReference (GpeEventInfo, TRUE); if (ACPI_SUCCESS (Status) && ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo)) { diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c index 5347acf..7e2b0db 100644 --- a/source/components/executer/exconfig.c +++ b/source/components/executer/exconfig.c @@ -233,10 +233,9 @@ AcpiExLoadTableOp ( return_ACPI_STATUS (Status); } - /* Complete the initialization/resolution of package objects */ + /* Complete the initialization/resolution of new objects */ - Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL); + AcpiNsInitializeObjects (); /* Parameter Data (optional) */ @@ -511,10 +510,11 @@ AcpiExLoadOp ( return_ACPI_STATUS (Status); } - /* Complete the initialization/resolution of package objects */ + /* Complete the initialization/resolution of new objects */ - Status = AcpiNsWalkNamespace (ACPI_TYPE_PACKAGE, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, 0, AcpiNsInitOnePackage, NULL, NULL, NULL); + AcpiExExitInterpreter (); + AcpiNsInitializeObjects (); + AcpiExEnterInterpreter (); /* Store the DdbHandle into the Target operand */ diff --git a/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c index 949e2e1..c0c8290 100644 --- a/source/components/namespace/nsaccess.c +++ b/source/components/namespace/nsaccess.c @@ -76,6 +76,7 @@ AcpiNsRootInitialize ( ACPI_STATUS Status; const ACPI_PREDEFINED_NAMES *InitVal = NULL; ACPI_NAMESPACE_NODE *NewNode; + ACPI_NAMESPACE_NODE *PrevNode = NULL; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STRING Val = NULL; @@ -105,13 +106,30 @@ AcpiNsRootInitialize ( */ AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct; - /* Enter the pre-defined names in the name table */ + /* Enter the predefined names in the name table */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Entering predefined entries into namespace\n")); + /* + * Create the initial (default) namespace. + * This namespace looks like something similar to this: + * + * ACPI Namespace (from Namespace Root): + * 0 _GPE Scope 00203160 00 + * 0 _PR_ Scope 002031D0 00 + * 0 _SB_ Device 00203240 00 Notify Object: 0020ADD8 + * 0 _SI_ Scope 002032B0 00 + * 0 _TZ_ Device 00203320 00 + * 0 _REV Integer 00203390 00 = 0000000000000002 + * 0 _OS_ String 00203488 00 Len 14 "Microsoft Windows NT" + * 0 _GL_ Mutex 00203580 00 Object 002035F0 + * 0 _OSI Method 00203678 00 Args 1 Len 0000 Aml 00000000 + */ for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++) { + Status = AE_OK; + /* _OSI is optional for now, will be permanent later */ if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod) @@ -119,17 +137,35 @@ AcpiNsRootInitialize ( continue; } - Status = AcpiNsLookup (NULL, ACPI_CAST_PTR (char, InitVal->Name), - InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, - NULL, &NewNode); - if (ACPI_FAILURE (Status)) + /* + * Create, init, and link the new predefined name + * Note: No need to use AcpiNsLookup here because all the + * predefined names are at the root level. It is much easier to + * just create and link the new node(s) here. + */ + NewNode = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_NAMESPACE_NODE)); + if (!NewNode) { - ACPI_EXCEPTION ((AE_INFO, Status, - "Could not create predefined name %s", - InitVal->Name)); - continue; + Status = AE_NO_MEMORY; + goto UnlockAndExit; } + ACPI_COPY_NAMESEG (NewNode->Name.Ascii, InitVal->Name); + NewNode->DescriptorType = ACPI_DESC_TYPE_NAMED; + NewNode->Type = InitVal->Type; + + if (!PrevNode) + { + AcpiGbl_RootNodeStruct.Child = NewNode; + } + else + { + PrevNode->Peer = NewNode; + } + + NewNode->Parent = &AcpiGbl_RootNodeStruct; + PrevNode = NewNode; + /* * Name entered successfully. If entry in PreDefinedNames[] specifies * an initial value, create the initial value. @@ -178,7 +214,7 @@ AcpiNsRootInitialize ( NewNode->Value = ObjDesc->Method.ParamCount; #else - /* Mark this as a very SPECIAL method */ + /* Mark this as a very SPECIAL method (_OSI) */ ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY; ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation; @@ -251,7 +287,6 @@ AcpiNsRootInitialize ( } } - UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index c8f7341..02bbadd 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -51,13 +51,6 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nseval") -/* Local prototypes */ - -static void -AcpiNsExecModuleCode ( - ACPI_OPERAND_OBJECT *MethodObj, - ACPI_EVALUATE_INFO *Info); - /******************************************************************************* * @@ -356,206 +349,3 @@ Cleanup: Info->FullPathname = NULL; return_ACPI_STATUS (Status); } - - -/******************************************************************************* - * - * FUNCTION: AcpiNsExecModuleCodeList - * - * PARAMETERS: None - * - * RETURN: None. Exceptions during method execution are ignored, since - * we cannot abort a table load. - * - * DESCRIPTION: Execute all elements of the global module-level code list. - * Each element is executed as a single control method. - * - * NOTE: With this option enabled, each block of detected executable AML - * code that is outside of any control method is wrapped with a temporary - * control method object and placed on a global list. The methods on this - * list are executed below. - * - * This function executes the module-level code for all tables only after - * all of the tables have been loaded. It is a legacy option and is - * not compatible with other ACPI implementations. See AcpiNsLoadTable. - * - * This function will be removed when the legacy option is removed. - * - ******************************************************************************/ - -void -AcpiNsExecModuleCodeList ( - void) -{ - ACPI_OPERAND_OBJECT *Prev; - ACPI_OPERAND_OBJECT *Next; - ACPI_EVALUATE_INFO *Info; - UINT32 MethodCount = 0; - - - ACPI_FUNCTION_TRACE (NsExecModuleCodeList); - - - /* Exit now if the list is empty */ - - Next = AcpiGbl_ModuleCodeList; - if (!Next) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES, - "Legacy MLC block list is empty\n")); - - return_VOID; - } - - /* Allocate the evaluation information block */ - - Info = ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - return_VOID; - } - - /* Walk the list, executing each "method" */ - - while (Next) - { - Prev = Next; - Next = Next->Method.Mutex; - - /* Clear the link field and execute the method */ - - Prev->Method.Mutex = NULL; - AcpiNsExecModuleCode (Prev, Info); - MethodCount++; - - /* Delete the (temporary) method object */ - - AcpiUtRemoveReference (Prev); - } - - ACPI_INFO (( - "Executed %u blocks of module-level executable AML code", - MethodCount)); - - ACPI_FREE (Info); - AcpiGbl_ModuleCodeList = NULL; - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiNsExecModuleCode - * - * PARAMETERS: MethodObj - Object container for the module-level code - * Info - Info block for method evaluation - * - * RETURN: None. Exceptions during method execution are ignored, since - * we cannot abort a table load. - * - * DESCRIPTION: Execute a control method containing a block of module-level - * executable AML code. The control method is temporarily - * installed to the root node, then evaluated. - * - ******************************************************************************/ - -static void -AcpiNsExecModuleCode ( - ACPI_OPERAND_OBJECT *MethodObj, - ACPI_EVALUATE_INFO *Info) -{ - ACPI_OPERAND_OBJECT *ParentObj; - ACPI_NAMESPACE_NODE *ParentNode; - ACPI_OBJECT_TYPE Type; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (NsExecModuleCode); - - - /* - * Get the parent node. We cheat by using the NextObject field - * of the method object descriptor. - */ - ParentNode = ACPI_CAST_PTR ( - ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject); - Type = AcpiNsGetType (ParentNode); - - /* - * Get the region handler and save it in the method object. We may need - * this if an operation region declaration causes a _REG method to be run. - * - * We can't do this in AcpiPsLinkModuleCode because - * AcpiGbl_RootNode->Object is NULL at PASS1. - */ - if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object) - { - MethodObj->Method.Dispatch.Handler = - ParentNode->Object->Device.Handler; - } - - /* Must clear NextObject (AcpiNsAttachObject needs the field) */ - - MethodObj->Method.NextObject = NULL; - - /* Initialize the evaluation information block */ - - memset (Info, 0, sizeof (ACPI_EVALUATE_INFO)); - Info->PrefixNode = ParentNode; - - /* - * Get the currently attached parent object. Add a reference, - * because the ref count will be decreased when the method object - * is installed to the parent node. - */ - ParentObj = AcpiNsGetAttachedObject (ParentNode); - if (ParentObj) - { - AcpiUtAddReference (ParentObj); - } - - /* Install the method (module-level code) in the parent node */ - - Status = AcpiNsAttachObject (ParentNode, MethodObj, ACPI_TYPE_METHOD); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - - /* Execute the parent node as a control method */ - - Status = AcpiNsEvaluate (Info); - - ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES, - "Executed module-level code at %p\n", - MethodObj->Method.AmlStart)); - - /* Delete a possible implicit return value (in slack mode) */ - - if (Info->ReturnObject) - { - AcpiUtRemoveReference (Info->ReturnObject); - } - - /* Detach the temporary method object */ - - AcpiNsDetachObject (ParentNode); - - /* Restore the original parent object */ - - if (ParentObj) - { - Status = AcpiNsAttachObject (ParentNode, ParentObj, Type); - } - else - { - ParentNode->Type = (UINT8) Type; - } - -Exit: - if (ParentObj) - { - AcpiUtRemoveReference (ParentObj); - } - return_VOID; -} diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index 5866479..195d8c5 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -104,29 +104,30 @@ AcpiNsInitializeObjects ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****\n")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Completing Region/Field/Buffer/Package initialization:\n")); + "Final data object initialization: ")); - /* Set all init info to zero */ + /* Clear the info block */ memset (&Info, 0, sizeof (ACPI_INIT_WALK_INFO)); /* Walk entire namespace from the supplied root */ + /* + * TBD: will become ACPI_TYPE_PACKAGE as this type object + * is now the only one that supports deferred initialization + * (forward references). + */ Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, - &Info, NULL); + ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - " Initialized %u/%u Regions %u/%u Fields %u/%u " - "Buffers %u/%u Packages (%u nodes)\n", - Info.OpRegionInit, Info.OpRegionCount, - Info.FieldInit, Info.FieldCount, - Info.BufferInit, Info.BufferCount, - Info.PackageInit, Info.PackageCount, Info.ObjectCount)); + "Namespace contains %u (0x%X) objects\n", + Info.ObjectCount, + Info.ObjectCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "%u Control Methods found\n%u Op Regions found\n", @@ -453,35 +454,19 @@ AcpiNsInitOneObject ( AcpiExEnterInterpreter (); /* - * Each of these types can contain executable AML code within the - * declaration. + * Only initialization of Package objects can be deferred, in order + * to support forward references. */ switch (Type) { - case ACPI_TYPE_REGION: - - Info->OpRegionInit++; - Status = AcpiDsGetRegionArguments (ObjDesc); - break; - - case ACPI_TYPE_BUFFER_FIELD: - - Info->FieldInit++; - Status = AcpiDsGetBufferFieldArguments (ObjDesc); - break; - case ACPI_TYPE_LOCAL_BANK_FIELD: + /* TBD: BankFields do not require deferred init, remove this code */ + Info->FieldInit++; Status = AcpiDsGetBankFieldArguments (ObjDesc); break; - case ACPI_TYPE_BUFFER: - - Info->BufferInit++; - Status = AcpiDsGetBufferArguments (ObjDesc); - break; - case ACPI_TYPE_PACKAGE: /* Complete the initialization/resolution of the package object */ @@ -492,8 +477,12 @@ AcpiNsInitOneObject ( default: - /* No other types can get here */ + /* No other types should get here */ + Status = AE_TYPE; + ACPI_EXCEPTION ((AE_INFO, Status, + "Opcode is not deferred [%4.4s] (%s)", + AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type))); break; } diff --git a/source/components/namespace/nsload.c b/source/components/namespace/nsload.c index 07f5b6b..dc1bb9a 100644 --- a/source/components/namespace/nsload.c +++ b/source/components/namespace/nsload.c @@ -160,18 +160,6 @@ Unlock: ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Completed Table Object Initialization\n")); - /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. - */ - AcpiNsExecModuleCodeList (); return_ACPI_STATUS (Status); } diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index 2584dca..6873ecd 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -694,24 +694,11 @@ AcpiNsTerminate ( void) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *Prev; - ACPI_OPERAND_OBJECT *Next; ACPI_FUNCTION_TRACE (NsTerminate); - /* Delete any module-level code blocks */ - - Next = AcpiGbl_ModuleCodeList; - while (Next) - { - Prev = Next; - Next = Next->Method.Mutex; - Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */ - AcpiUtRemoveReference (Prev); - } - /* * Free the entire namespace -- all nodes and all objects * attached to the nodes diff --git a/source/components/tables/tbdata.c b/source/components/tables/tbdata.c index 63d3137..977eee8 100644 --- a/source/components/tables/tbdata.c +++ b/source/components/tables/tbdata.c @@ -1083,19 +1083,6 @@ AcpiTbLoadTable ( Status = AcpiNsLoadTable (TableIndex, ParentNode); /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. - */ - AcpiNsExecModuleCodeList (); - - /* * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is * responsible for discovering any new wake GPEs by running _PRW methods * that may have been loaded by this table. diff --git a/source/components/tables/tbxfload.c b/source/components/tables/tbxfload.c index 723924a..4db4f52 100644 --- a/source/components/tables/tbxfload.c +++ b/source/components/tables/tbxfload.c @@ -371,6 +371,13 @@ AcpiLoadTable ( ACPI_INFO (("Host-directed Dynamic ACPI Table Load:")); Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table), ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex); + if (ACPI_SUCCESS (Status)) + { + /* Complete the initialization/resolution of new objects */ + + AcpiNsInitializeObjects (); + } + return_ACPI_STATUS (Status); } diff --git a/source/components/utilities/utinit.c b/source/components/utilities/utinit.c index 5b2fc1c..4dfb8e5 100644 --- a/source/components/utilities/utinit.c +++ b/source/components/utilities/utinit.c @@ -234,7 +234,6 @@ AcpiUtInitGlobals ( /* Namespace */ - AcpiGbl_ModuleCodeList = NULL; AcpiGbl_RootNode = NULL; AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c index 40b06e4..97c9525 100644 --- a/source/components/utilities/utxfinit.c +++ b/source/components/utilities/utxfinit.c @@ -273,24 +273,17 @@ AcpiInitializeObjects ( ACPI_FUNCTION_TRACE (AcpiInitializeObjects); +#ifdef ACPI_OBSOLETE_BEHAVIOR /* - * This case handles the legacy option that groups all module-level - * code blocks together and defers execution until all of the tables - * are loaded. Execute all of these blocks at this time. - * Execute any module-level code that was detected during the table - * load phase. - * - * Note: this option is deprecated and will be eliminated in the - * future. Use of this option can cause problems with AML code that - * depends upon in-order immediate execution of module-level code. + * 05/2019: Removed, initialization now happens at both object + * creation and table load time */ - AcpiNsExecModuleCodeList (); /* * Initialize the objects that remain uninitialized. This * runs the executable AML that may be part of the - * declaration of these objects: - * OperationRegions, BufferFields, Buffers, and Packages. + * declaration of these objects: OperationRegions, BufferFields, + * BankFields, Buffers, and Packages. */ if (!(Flags & ACPI_NO_OBJECT_INIT)) { @@ -300,6 +293,7 @@ AcpiInitializeObjects ( return_ACPI_STATUS (Status); } } +#endif /* * Initialize all device/region objects in the namespace. This runs diff --git a/source/include/acevents.h b/source/include/acevents.h index c2f6140..8db2bd4 100644 --- a/source/include/acevents.h +++ b/source/include/acevents.h @@ -137,7 +137,8 @@ AcpiEvMaskGpe ( ACPI_STATUS AcpiEvAddGpeReference ( - ACPI_GPE_EVENT_INFO *GpeEventInfo); + ACPI_GPE_EVENT_INFO *GpeEventInfo, + BOOLEAN ClearOnEnable); ACPI_STATUS AcpiEvRemoveGpeReference ( diff --git a/source/include/acglobal.h b/source/include/acglobal.h index 689191b..e6e4473 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -215,7 +215,6 @@ ACPI_GLOBAL (BOOLEAN, AcpiGbl_VerboseLeakDump); ACPI_GLOBAL (ACPI_NAMESPACE_NODE, AcpiGbl_RootNodeStruct); ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_RootNode); ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_FadtGpeDevice); -ACPI_GLOBAL (ACPI_OPERAND_OBJECT *, AcpiGbl_ModuleCodeList); extern const UINT8 AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES]; extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES]; diff --git a/source/include/acnamesp.h b/source/include/acnamesp.h index e2e1e48..d06cc8d 100644 --- a/source/include/acnamesp.h +++ b/source/include/acnamesp.h @@ -311,10 +311,6 @@ ACPI_STATUS AcpiNsEvaluate ( ACPI_EVALUATE_INFO *Info); -void -AcpiNsExecModuleCodeList ( - void); - /* * nsarguments - Argument count/type checking for predefined/reserved names diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 729bebb..9322858 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -46,7 +46,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20190509 +#define ACPI_CA_VERSION 0x20190703 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/platform/acmsvc.h b/source/include/platform/acmsvc.h index ae27968..7c5e057 100644 --- a/source/include/platform/acmsvc.h +++ b/source/include/platform/acmsvc.h @@ -148,6 +148,10 @@ #endif #endif +/* warn C4001: use of slash-slash comments */ +/* NOTE: MSVC 2015 headers use these extensively */ +#pragma warning(disable:4001) + /* warn C4100: unreferenced formal parameter */ #pragma warning(disable:4100) @@ -160,10 +164,21 @@ /* warn C4131: uses old-style declarator (iASL compiler only) */ #pragma warning(disable:4131) +/* warn C4131: uses old-style declarator (iASL compiler only) */ +#pragma warning(disable:4459) + #if _MSC_VER > 1200 /* Versions above VC++ 6 */ #pragma warning( disable : 4295 ) /* needed for acpredef.h array */ #endif +/* + * MSVC 2015+ + */ + + /* warn C4459: xxxx (identifier) hides global declaration */ +#pragma warning(disable:4459) + + /* Debug support. */ diff --git a/source/include/platform/acwin.h b/source/include/platform/acwin.h index 0c4344e..b834347 100644 --- a/source/include/platform/acwin.h +++ b/source/include/platform/acwin.h @@ -44,9 +44,33 @@ #ifndef __ACWIN_H__ #define __ACWIN_H__ +#include + #define ACPI_USE_STANDARD_HEADERS #define ACPI_USE_SYSTEM_CLIBRARY + /* Note: do not include any C library headers here */ + + /* + * Note: MSVC project files should define ACPI_DEBUGGER and ACPI_DISASSEMBLER + * as appropriate to enable editor functions like "Find all references". + * The editor isn't smart enough to dig through the include files to find + * out if these are actually defined. + */ + + /* Eliminate warnings for "old" (non-secure) versions of clib functions */ + +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS +#endif + +/* Eliminate warnings for POSIX clib function names (open, write, etc.) */ + +#ifndef _CRT_NONSTDC_NO_DEPRECATE +#define _CRT_NONSTDC_NO_DEPRECATE +#endif + + #define ACPI_MACHINE_WIDTH 32 #define ACPI_USE_NATIVE_DIVIDE #define ACPI_USE_NATIVE_MATH64 @@ -75,7 +99,9 @@ typedef COMPILER_DEPENDENT_UINT64 u64; #define stat _stat #define fstat _fstat #define mkdir _mkdir -#define snprintf _snprintf +#define fileno _fileno +#define isatty _isatty + #if _MSC_VER <= 1200 /* Versions below VC++ 6 */ #define vsnprintf _vsnprintf #endif @@ -87,6 +113,9 @@ typedef COMPILER_DEPENDENT_UINT64 u64; #define S_IREAD _S_IREAD #define S_IWRITE _S_IWRITE #define S_IFDIR _S_IFDIR +#if _MSC_VER < 1900 +#define snprintf _snprintf +#endif /* diff --git a/source/include/platform/acwin64.h b/source/include/platform/acwin64.h index 5dda0a5..33450d8 100644 --- a/source/include/platform/acwin64.h +++ b/source/include/platform/acwin64.h @@ -47,6 +47,28 @@ #define ACPI_USE_STANDARD_HEADERS #define ACPI_USE_SYSTEM_CLIBRARY + /* Note: do not include any C library headers here */ + + /* + * Note: MSVC project files should define ACPI_DEBUGGER and ACPI_DISASSEMBLER + * as appropriate to enable editor functions like "Find all references". + * The editor isn't smart enough to dig through the include files to find + * out if these are actually defined. + */ + + /* Eliminate warnings for "old" (non-secure) versions of clib functions */ + +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS +#endif + +/* Eliminate warnings for POSIX clib function names (open, write, etc.) */ + +#ifndef _CRT_NONSTDC_NO_DEPRECATE +#define _CRT_NONSTDC_NO_DEPRECATE +#endif + + #define ACPI_MACHINE_WIDTH 64 /* diff --git a/source/tools/acpiexec/aetests.c b/source/tools/acpiexec/aetests.c index 4cb3280..28d91fc 100644 --- a/source/tools/acpiexec/aetests.c +++ b/source/tools/acpiexec/aetests.c @@ -521,7 +521,7 @@ AeLateTest ( *****************************************************************************/ static void -AeGlobalAddressRangeCheck( +AeGlobalAddressRangeCheck ( void) { ACPI_STATUS Status; @@ -530,18 +530,18 @@ AeGlobalAddressRangeCheck( UINT32 i; - ReturnBuffer.Length = ACPI_ALLOCATE_BUFFER; - AcpiUtInitializeBuffer (&ReturnBuffer, ACPI_ALLOCATE_BUFFER); - for (i = 0; i < ACPI_ADDRESS_RANGE_MAX; i++) { Current = AcpiGbl_AddressRangeList[i]; while (Current) { + ReturnBuffer.Length = ACPI_ALLOCATE_BUFFER; + Status = AcpiGetName (Current->RegionNode, ACPI_SINGLE_NAME, &ReturnBuffer); ACPI_CHECK_OK (AcpiGetname, Status); + AcpiOsFree (ReturnBuffer.Pointer); Current = Current->Next; } } diff --git a/source/tools/acpinames/anstubs.c b/source/tools/acpinames/anstubs.c index fa70b94..c140025 100644 --- a/source/tools/acpinames/anstubs.c +++ b/source/tools/acpinames/anstubs.c @@ -194,13 +194,6 @@ AcpiNsEvaluate ( } void -AcpiNsExecModuleCodeList ( - void) -{ - return; -} - -void AcpiExDoDebugObject ( ACPI_OPERAND_OBJECT *SourceDesc, UINT32 Level, diff --git a/source/tools/acpixtract/axmain.c b/source/tools/acpixtract/axmain.c index 92c2739..cc378e2 100644 --- a/source/tools/acpixtract/axmain.c +++ b/source/tools/acpixtract/axmain.c @@ -88,7 +88,7 @@ DisplayUsage ( * ******************************************************************************/ -int +int ACPI_SYSTEM_XFACE main ( int argc, char *argv[])