diff options
author | jkim <jkim@FreeBSD.org> | 2015-09-30 20:13:30 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2015-09-30 20:13:30 +0000 |
commit | 1687568433cf7d84ba91894cef9a1aa48bc13b88 (patch) | |
tree | 3c0096caacc85baaf08f60f84ad7b7aa0812a740 | |
parent | 7324ef3aef9faed4a6278eac7e7937701144aa2e (diff) | |
download | FreeBSD-src-1687568433cf7d84ba91894cef9a1aa48bc13b88.zip FreeBSD-src-1687568433cf7d84ba91894cef9a1aa48bc13b88.tar.gz |
Import ACPICA 20150930.
47 files changed, 3047 insertions, 2342 deletions
diff --git a/changes.txt b/changes.txt index 2782921..78a19ea 100644 --- a/changes.txt +++ b/changes.txt @@ -1,7 +1,97 @@ ---------------------------------------- -18 August 2015. Summary of changes for version 20150818: +30 September 2015. Summary of changes for version 20150930: -This release is available at https://acpica.org/downloads +1) ACPICA kernel-resident subsystem: + +Debugger: Implemented several changes and bug fixes to assist support for +the in-kernel version of the AML debugger. Lv Zheng. +- Fix the "predefined" command for in-kernel debugger. +- Do not enter debug command loop for the help and version commands. +- Disallow "execute" command during execution/single-step of a method. + +Interpreter: Updated runtime typechecking for all operators that have +target operands. The operand is resolved and validated that it is legal. +For example, the target cannot be a non-data object such as a Device, +Mutex, ThermalZone, etc., as per the ACPI specification. + +Debugger: Fixed the double-mutex user I/O handshake to work when local +deadlock detection is enabled. + +Debugger: limited display of method locals and arguments (LocalX and +ArgX) to only those that have actually been initialized. This prevents +lines of extraneous output. + +Updated the definition of the NFIT table to correct the bit polarity of +one flag: ACPI_NFIT_MEM_ARMED --> ACPI_NFIT_MEM_NOT_ARMED + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 101.7K Code, 27.9K Data, 129.6K Total + Debug Version: 199.3K Code, 81.4K Data, 280.7K Total + Previous Release: + Non-Debug Version: 101.3K Code, 27.7K Data, 129.0K Total + Debug Version: 198.6K Code, 80.9K Data, 279.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Improved the compile-time typechecking for operands of many of the +ASL operators: + +-- Added an option to disable compiler operand/operator typechecking (- +ot). + +-- For the following operators, the TermArg operands are now validated +when possible to be Integer data objects: BankField, OperationRegion, +DataTableRegion, Buffer, and Package. + +-- Store (Source, Target): Both the source and target operands are +resolved and checked that the operands are both legal. For example, +neither operand can be a non-data object such as a Device, Mutex, +ThermalZone, etc. Note, as per the ACPI specification, the CopyObject +operator can be used to store an object to any type of target object. + +-- Store (Source, Target): If the source is a Package object, the target +must be a Package object, LocalX, ArgX, or Debug. Likewise, if the target +is a Package, the source must also be a Package. + +-- Store (Source, Target): A warning is issued if the source and target +resolve to the identical named object. + +-- Store (Source, <method invocation>): An error is generated for the +target method invocation, as this construct is not supported by the AML +interpreter. + +-- For all ASL math and logic operators, the target operand must be a +data object (Integer, String, Buffer, LocalX, ArgX, or Debug). This +includes the function return value also. + +-- External declarations are also included in the typechecking where +possible. External objects defined using the UnknownObj keyword cannot be +typechecked, however. + +iASL and Disassembler: Added symbolic (ASL+) support for the ASL Index +operator: +- Legacy code: Index(PKG1, 3) +- New ASL+ code: PKG1[3] +This completes the ACPI 6.0 ASL+ support as it was the only operator not +supported. + +iASL: Fixed the file suffix for the preprocessor output file (.i). Two +spaces were inadvertently appended to the filename, causing file access +and deletion problems on some systems. + +ASL Test Suite (ASLTS): Updated the master makefile to generate all +possible compiler output files when building the test suite -- thus +exercising these features of the compiler. These files are automatically +deleted when the test suite exits. + +---------------------------------------- +18 August 2015. Summary of changes for version 20150818: 1) ACPICA kernel-resident subsystem: diff --git a/generate/unix/Makefile.config b/generate/unix/Makefile.config index 1e3f6e3..3137821 100644 --- a/generate/unix/Makefile.config +++ b/generate/unix/Makefile.config @@ -195,7 +195,6 @@ CWARNINGFLAGS += \ -Wmissing-field-initializers\ -Wnested-externs\ -Wold-style-definition\ - -Woverride-init\ -Wno-format-nonliteral\ -Wredundant-decls # @@ -207,10 +206,11 @@ ifneq ($(HOST), _FreeBSD) ifneq ($(HOST), _APPLE) CWARNINGFLAGS += \ - -Wlogical-op\ - -Wmissing-parameter-type\ - -Wold-style-declaration\ - -Wtype-limits + -Woverride-init\ + -Wlogical-op\ + -Wmissing-parameter-type\ + -Wold-style-declaration\ + -Wtype-limits endif endif diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile index 4d15aa9..14c894e 100644 --- a/generate/unix/iasl/Makefile +++ b/generate/unix/iasl/Makefile @@ -234,7 +234,9 @@ MISC = \ $(OBJDIR)/prparser.y.h ASL_PARSER = \ + $(ASL_COMPILER)/aslcstyle.y\ $(ASL_COMPILER)/aslparser.y\ + $(ASL_COMPILER)/aslresources.y\ $(ASL_COMPILER)/aslsupport.y\ $(ASL_COMPILER)/asltokens.y\ $(ASL_COMPILER)/asltypes.y\ diff --git a/source/common/adfile.c b/source/common/adfile.c index fc7c6b2..902521f 100644 --- a/source/common/adfile.c +++ b/source/common/adfile.c @@ -99,7 +99,7 @@ AdGenerateFilename ( } FilenameBuf[i] = 0; - strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX); + strcat (FilenameBuf, FILE_SUFFIX_BINARY_TABLE); return (FilenameBuf); } diff --git a/source/compiler/aslbtypes.c b/source/compiler/aslbtypes.c index 15c4ecd..4b6fd4f 100644 --- a/source/compiler/aslbtypes.c +++ b/source/compiler/aslbtypes.c @@ -100,9 +100,10 @@ AnMapArgTypeToBtype ( case ARGI_DDBHANDLE: /* * DDBHandleObject := SuperName - * ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload + * ACPI_BTYPE_REFERENCE_OBJECT: + * Index reference as parameter of Load/Unload */ - return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE); + return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE_OBJECT); /* Interchangeable types */ /* @@ -133,9 +134,24 @@ AnMapArgTypeToBtype ( case ARGI_REFERENCE: - return (ACPI_BTYPE_REFERENCE); + return (ACPI_BTYPE_NAMED_REFERENCE); /* Name or Namestring */ case ARGI_TARGETREF: + + /* + * Target operand for most math and logic operators. + * Package objects not allowed as target. + */ + return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DEBUG_OBJECT | + ACPI_BTYPE_REFERENCE_OBJECT); + + case ARGI_STORE_TARGET: + + /* Special target for Store(), includes packages */ + + return (ACPI_BTYPE_DATA | ACPI_BTYPE_DEBUG_OBJECT | + ACPI_BTYPE_REFERENCE_OBJECT); + case ARGI_FIXED_TARGET: case ARGI_SIMPLE_TARGET: @@ -149,28 +165,33 @@ AnMapArgTypeToBtype ( * Used only by SizeOf operator */ return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | - ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE); + ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE_OBJECT); case ARGI_COMPLEXOBJ: /* Buffer, String, or package */ - return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE); + return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | + ACPI_BTYPE_PACKAGE); case ARGI_REF_OR_STRING: - return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE); + /* Used by DeRefOf operator only */ + + return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE_OBJECT); case ARGI_REGION_OR_BUFFER: /* Used by Load() only. Allow buffers in addition to regions/fields */ - return (ACPI_BTYPE_REGION | ACPI_BTYPE_BUFFER | ACPI_BTYPE_FIELD_UNIT); + return (ACPI_BTYPE_REGION | ACPI_BTYPE_BUFFER | + ACPI_BTYPE_FIELD_UNIT); case ARGI_DATAREFOBJ: - return (ACPI_BTYPE_INTEGER |ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | - ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE); + /* Used by Store() only, as the source operand */ + + return (ACPI_BTYPE_DATA_REFERENCE | ACPI_BTYPE_REFERENCE_OBJECT); default: @@ -274,7 +295,7 @@ AnMapEtypeToBtype ( case ACPI_TYPE_LOCAL_RESOURCE: case ACPI_TYPE_LOCAL_RESOURCE_FIELD: - return (ACPI_BTYPE_REFERENCE); + return (ACPI_BTYPE_REFERENCE_OBJECT); default: @@ -401,12 +422,6 @@ AnGetBtype ( "could not map type"); } - /* - * Since it was a named reference, enable the - * reference bit also - */ - ThisNodeBtype |= ACPI_BTYPE_REFERENCE; - if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) { ReferencedNode = Node->Op; @@ -442,7 +457,6 @@ AnGetBtype ( return (ThisNodeBtype); } - /******************************************************************************* * * FUNCTION: AnMapObjTypeToBtype diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 9e5b53a..a45814e 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -302,8 +302,11 @@ CmDoCompile ( Event = UtBeginEvent ("Analyze AML operand types"); DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, - NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo); + if (Gbl_DoTypechecking) + { + TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, + NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo); + } UtEndEvent (Event); /* Semantic error checking part four - other miscellaneous checks */ diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index e0b2423..37e99ae 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -156,6 +156,9 @@ NamePathTail [.]{NameSeg} "^=" { count (3); return (PARSEOP_EXP_XOR_EQ); } "|=" { count (3); return (PARSEOP_EXP_OR_EQ); } +"[" { count (3); return(PARSEOP_EXP_INDEX_LEFT); } +"]" { count (0); return(PARSEOP_EXP_INDEX_RIGHT); } + /* * Begin standard ASL grammar diff --git a/source/compiler/aslcstyle.y b/source/compiler/aslcstyle.y new file mode 100644 index 0000000..70524fd --- /dev/null +++ b/source/compiler/aslcstyle.y @@ -0,0 +1,209 @@ +NoEcho(' +/****************************************************************************** + * + * Module Name: aslcstyle.y - Production rules for symbolic operators + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, 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. + */ + +') + +/******************************************************************************* + * + * 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) = += -= *= /= %= <<= >>= &= ^= |= + */ + +Expression + + /* Unary operators */ + + : PARSEOP_EXP_LOGICAL_NOT {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);} + TermArg {$$ = TrLinkChildren ($<n>2,1,$3);} + | PARSEOP_EXP_NOT {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);} + TermArg {$$ = TrLinkChildren ($<n>2,2,$3,TrCreateNullTarget ());} + + | SuperName PARSEOP_EXP_INCREMENT {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);} + {$$ = TrLinkChildren ($<n>3,1,$1);} + | SuperName PARSEOP_EXP_DECREMENT {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);} + {$$ = TrLinkChildren ($<n>3,1,$1);} + + /* Binary operators: math and logical */ + + | TermArg PARSEOP_EXP_ADD {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_DIVIDE {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);} + TermArg {$$ = TrLinkChildren ($<n>3,4,$1,$4,TrCreateNullTarget (), + TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_MODULO {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_MULTIPLY {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_SHIFT_LEFT {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_SHIFT_RIGHT {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_SUBTRACT {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} + + | TermArg PARSEOP_EXP_AND {$<n>$ = TrCreateLeafNode (PARSEOP_AND);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_OR {$<n>$ = TrCreateLeafNode (PARSEOP_OR);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} + | TermArg PARSEOP_EXP_XOR {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} + + | TermArg PARSEOP_EXP_GREATER {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);} + TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} + | TermArg PARSEOP_EXP_GREATER_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATEREQUAL);} + TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} + | TermArg PARSEOP_EXP_LESS {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);} + TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} + | TermArg PARSEOP_EXP_LESS_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LLESSEQUAL);} + TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} + + | TermArg PARSEOP_EXP_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);} + TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} + | TermArg PARSEOP_EXP_NOT_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LNOTEQUAL);} + TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} + + | TermArg PARSEOP_EXP_LOGICAL_AND {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);} + TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} + | TermArg PARSEOP_EXP_LOGICAL_OR {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);} + TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} + + /* Parentheses */ + + | '(' TermArg ')' { $$ = $2;} + + /* Index term -- "= BUF1[5]" on right-hand side of an equals (source) */ + + | SuperName PARSEOP_EXP_INDEX_LEFT TermArg PARSEOP_EXP_INDEX_RIGHT + {$$ = TrCreateLeafNode (PARSEOP_INDEX); + TrLinkChildren ($$,3,$1,$3,TrCreateNullTarget ());} + ; + + /* Index term -- "BUF1[5] = " on left-hand side of an equals (target) */ + +IndexExpTerm + + : SuperName PARSEOP_EXP_INDEX_LEFT TermArg PARSEOP_EXP_INDEX_RIGHT + {$$ = TrCreateLeafNode (PARSEOP_INDEX); + TrLinkChildren ($$,3,$1,$3,TrCreateNullTarget ());} + ; + +EqualsTerm + + /* All assignment-type operations */ + + : SuperName PARSEOP_EXP_EQUALS + TermArg {$$ = TrCreateAssignmentNode ($1, $3);} + + | TermArg PARSEOP_EXP_ADD_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_DIV_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);} + TermArg {$$ = TrLinkChildren ($<n>3,4,$1,$4,TrCreateNullTarget (), + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_MOD_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_MUL_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_SHL_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_SHR_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_SUB_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_AND_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_AND);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_OR_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_OR);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + + | TermArg PARSEOP_EXP_XOR_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);} + TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, + TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + ; diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index 9e42ddf..64ecff3 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -104,26 +104,6 @@ #define AML_DEFAULT_ARG_OP (UINT16) 0xDDDD -/* filename suffixes for output files */ - -#define FILE_SUFFIX_PREPROC_USER "i " -#define FILE_SUFFIX_PREPROCESSOR "pre" -#define FILE_SUFFIX_AML_CODE "aml" -#define FILE_SUFFIX_MAP "map" -#define FILE_SUFFIX_LISTING "lst" -#define FILE_SUFFIX_HEX_DUMP "hex" -#define FILE_SUFFIX_DEBUG "txt" -#define FILE_SUFFIX_SOURCE "src" -#define FILE_SUFFIX_NAMESPACE "nsp" -#define FILE_SUFFIX_ASM_SOURCE "asm" -#define FILE_SUFFIX_C_SOURCE "c" -#define FILE_SUFFIX_DISASSEMBLY "dsl" -#define FILE_SUFFIX_ASM_INCLUDE "inc" -#define FILE_SUFFIX_C_INCLUDE "h" -#define FILE_SUFFIX_ASL_CODE "asl" -#define FILE_SUFFIX_C_OFFSET "offset.h" - - /* Types for input files */ #define ASL_INPUT_TYPE_BINARY 0 diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index 0696b67..e78e58f 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -177,6 +177,8 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AllExceptionsDisabled, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PruneParseTree, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTypechecking, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_EnableReferenceTypechecking, FALSE); #define HEX_OUTPUT_NONE 0 diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 4550ea1..c0a3d3f 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -160,6 +160,7 @@ Usage ( ACPI_OPTION ("-of", "Disable constant folding"); ACPI_OPTION ("-oi", "Disable integer optimization to Zero/One/Ones"); ACPI_OPTION ("-on", "Disable named reference string optimization"); + ACPI_OPTION ("-ot", "Disable typechecking"); ACPI_OPTION ("-cr", "Disable Resource Descriptor error checking"); ACPI_OPTION ("-in", "Ignore NoOp operators"); ACPI_OPTION ("-r <revision>", "Override table header Revision (1-255)"); @@ -203,7 +204,7 @@ Usage ( ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); ACPI_OPTION ("-m <size>", "Set internal line buffer size (in Kbytes)"); ACPI_OPTION ("-n", "Parse only, no output generation"); - ACPI_OPTION ("-ot", "Display compile times and statistics"); + ACPI_OPTION ("-oc", "Display compile times and statistics"); ACPI_OPTION ("-x <level>", "Set debug level for trace output"); ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables"); } diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c index ade7173..5338204 100644 --- a/source/compiler/aslmap.c +++ b/source/compiler/aslmap.c @@ -123,6 +123,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = { /*! [Begin] no source code translation (keep the table structure) */ + /* AML Opcode Value Flags Btype */ /* ACCESSAS */ OP_TABLE_ENTRY (AML_INT_ACCESSFIELD_OP, 0, 0, 0), /* ACCESSATTRIB_BLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BLOCK, 0, 0), @@ -241,7 +242,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* INCLUDE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* INCLUDE_END */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* INCREMENT */ OP_TABLE_ENTRY (AML_INCREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* INDEX */ OP_TABLE_ENTRY (AML_INDEX_OP, 0, 0, ACPI_BTYPE_REFERENCE), +/* INDEX */ OP_TABLE_ENTRY (AML_INDEX_OP, 0, 0, ACPI_BTYPE_REFERENCE_OBJECT), /* INDEXFIELD */ OP_TABLE_ENTRY (AML_INDEX_FIELD_OP, 0, NODE_AML_PACKAGE, 0), /* INTEGER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, ACPI_BTYPE_INTEGER), /* INTERRUPT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), @@ -357,7 +358,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* RAW_DATA */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* READWRITETYPE_BOTH */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* READWRITETYPE_READONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE), +/* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE_OBJECT), /* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_CMOS, 0, 0), /* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_EC, 0, 0), /* REGIONSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_FIXED_HARDWARE, 0, 0), diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index 0be33e7..ef6ad8b 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -68,7 +68,7 @@ AslDoResponseFile ( #define ASL_TOKEN_SEPARATORS " \t\n" -#define ASL_SUPPORTED_OPTIONS "@:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z" +#define ASL_SUPPORTED_OPTIONS "@:a:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z" /******************************************************************************* @@ -184,6 +184,24 @@ AslDoOptions ( } break; + case 'a': /* Debug options */ + + switch (AcpiGbl_Optarg[0]) + { + case 'r': + + Gbl_EnableReferenceTypechecking = TRUE; + break; + + default: + + printf ("Unknown option: -a%s\n", AcpiGbl_Optarg); + return (-1); + } + + break; + + case 'b': /* Debug options */ switch (AcpiGbl_Optarg[0]) @@ -506,6 +524,13 @@ AslDoOptions ( Gbl_ReferenceOptimizationFlag = FALSE; break; + case 'c': + + /* Display compile time(s) */ + + Gbl_CompileTimesFlag = TRUE; + break; + case 'f': /* Disable folding on "normal" expressions */ @@ -529,9 +554,9 @@ AslDoOptions ( case 't': - /* Display compile time(s) */ + /* Disable heavy typechecking */ - Gbl_CompileTimesFlag = TRUE; + Gbl_DoTypechecking = FALSE; break; default: diff --git a/source/compiler/aslparser.y b/source/compiler/aslparser.y index cf09ddf..d80316c 100644 --- a/source/compiler/aslparser.y +++ b/source/compiler/aslparser.y @@ -122,6 +122,8 @@ m4_include(asltypes.y) /* Production rules */ m4_include(aslrules.y) +m4_include(aslcstyle.y) +m4_include(aslresources.y) %% /*! [End] no source code translation !*/ diff --git a/source/compiler/aslresources.y b/source/compiler/aslresources.y new file mode 100644 index 0000000..5e8ccde --- /dev/null +++ b/source/compiler/aslresources.y @@ -0,0 +1,1179 @@ +NoEcho(' +/****************************************************************************** + * + * Module Name: aslresources.y - Bison/Yacc production rules for resources + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2015, 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. + */ + +') + +/******************************************************************************* + * + * ASL Parameter Keyword Terms + * + ******************************************************************************/ + +AccessAttribKeyword + : PARSEOP_ACCESSATTRIB_BLOCK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK);} + | PARSEOP_ACCESSATTRIB_BLOCK_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK_CALL);} + | PARSEOP_ACCESSATTRIB_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BYTE);} + | PARSEOP_ACCESSATTRIB_QUICK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_QUICK );} + | PARSEOP_ACCESSATTRIB_SND_RCV {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_SND_RCV);} + | PARSEOP_ACCESSATTRIB_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD);} + | PARSEOP_ACCESSATTRIB_WORD_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD_CALL);} + | PARSEOP_ACCESSATTRIB_MULTIBYTE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_MULTIBYTE);} + ByteConst + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_ACCESSATTRIB_RAW_BYTES '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_BYTES);} + ByteConst + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_ACCESSATTRIB_RAW_PROCESS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_PROCESS);} + ByteConst + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + ; + +AccessTypeKeyword + : PARSEOP_ACCESSTYPE_ANY {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_ANY);} + | PARSEOP_ACCESSTYPE_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BYTE);} + | PARSEOP_ACCESSTYPE_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_WORD);} + | PARSEOP_ACCESSTYPE_DWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_DWORD);} + | PARSEOP_ACCESSTYPE_QWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_QWORD);} + | PARSEOP_ACCESSTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BUF);} + ; + +AddressingModeKeyword + : PARSEOP_ADDRESSINGMODE_7BIT {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_7BIT);} + | PARSEOP_ADDRESSINGMODE_10BIT {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_10BIT);} + ; + +AddressKeyword + : PARSEOP_ADDRESSTYPE_MEMORY {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_MEMORY);} + | PARSEOP_ADDRESSTYPE_RESERVED {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_RESERVED);} + | PARSEOP_ADDRESSTYPE_NVS {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_NVS);} + | PARSEOP_ADDRESSTYPE_ACPI {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_ACPI);} + ; + +AddressSpaceKeyword + : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);} + | RegionSpaceKeyword {} + ; + +BitsPerByteKeyword + : PARSEOP_BITSPERBYTE_FIVE {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_FIVE);} + | PARSEOP_BITSPERBYTE_SIX {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SIX);} + | PARSEOP_BITSPERBYTE_SEVEN {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SEVEN);} + | PARSEOP_BITSPERBYTE_EIGHT {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_EIGHT);} + | PARSEOP_BITSPERBYTE_NINE {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_NINE);} + ; + +ClockPhaseKeyword + : PARSEOP_CLOCKPHASE_FIRST {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_FIRST);} + | PARSEOP_CLOCKPHASE_SECOND {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_SECOND);} + ; + +ClockPolarityKeyword + : PARSEOP_CLOCKPOLARITY_LOW {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_LOW);} + | PARSEOP_CLOCKPOLARITY_HIGH {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_HIGH);} + ; + +DecodeKeyword + : PARSEOP_DECODETYPE_POS {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_POS);} + | PARSEOP_DECODETYPE_SUB {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_SUB);} + ; + +DevicePolarityKeyword + : PARSEOP_DEVICEPOLARITY_LOW {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_LOW);} + | PARSEOP_DEVICEPOLARITY_HIGH {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_HIGH);} + ; + +DMATypeKeyword + : PARSEOP_DMATYPE_A {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_A);} + | PARSEOP_DMATYPE_COMPATIBILITY {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_COMPATIBILITY);} + | PARSEOP_DMATYPE_B {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_B);} + | PARSEOP_DMATYPE_F {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);} + ; + +EndianKeyword + : PARSEOP_ENDIAN_LITTLE {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_LITTLE);} + | PARSEOP_ENDIAN_BIG {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_BIG);} + ; + +FlowControlKeyword + : PARSEOP_FLOWCONTROL_HW {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_HW);} + | PARSEOP_FLOWCONTROL_NONE {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_NONE);} + | PARSEOP_FLOWCONTROL_SW {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_SW);} + ; + +InterruptLevel + : PARSEOP_INTLEVEL_ACTIVEBOTH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEBOTH);} + | PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);} + | PARSEOP_INTLEVEL_ACTIVELOW {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);} + ; + +InterruptTypeKeyword + : PARSEOP_INTTYPE_EDGE {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_EDGE);} + | PARSEOP_INTTYPE_LEVEL {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_LEVEL);} + ; + +IODecodeKeyword + : PARSEOP_IODECODETYPE_16 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);} + | PARSEOP_IODECODETYPE_10 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_10);} + ; + +IoRestrictionKeyword + : PARSEOP_IORESTRICT_IN {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_IN);} + | PARSEOP_IORESTRICT_OUT {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_OUT);} + | PARSEOP_IORESTRICT_NONE {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_NONE);} + | PARSEOP_IORESTRICT_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_PRESERVE);} + ; + +LockRuleKeyword + : PARSEOP_LOCKRULE_LOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_LOCK);} + | PARSEOP_LOCKRULE_NOLOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_NOLOCK);} + ; + +MatchOpKeyword + : PARSEOP_MATCHTYPE_MTR {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MTR);} + | PARSEOP_MATCHTYPE_MEQ {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ);} + | PARSEOP_MATCHTYPE_MLE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLE);} + | PARSEOP_MATCHTYPE_MLT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLT);} + | PARSEOP_MATCHTYPE_MGE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGE);} + | PARSEOP_MATCHTYPE_MGT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGT);} + ; + +MaxKeyword + : PARSEOP_MAXTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_FIXED);} + | PARSEOP_MAXTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_NOTFIXED);} + ; + +MemTypeKeyword + : PARSEOP_MEMTYPE_CACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_CACHEABLE);} + | PARSEOP_MEMTYPE_WRITECOMBINING {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_WRITECOMBINING);} + | PARSEOP_MEMTYPE_PREFETCHABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_PREFETCHABLE);} + | PARSEOP_MEMTYPE_NONCACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);} + ; + +MinKeyword + : PARSEOP_MINTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_FIXED);} + | PARSEOP_MINTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_NOTFIXED);} + ; + +ObjectTypeKeyword + : PARSEOP_OBJECTTYPE_UNK {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} + | PARSEOP_OBJECTTYPE_INT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_INT);} + | PARSEOP_OBJECTTYPE_STR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_STR);} + | PARSEOP_OBJECTTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BUF);} + | PARSEOP_OBJECTTYPE_PKG {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PKG);} + | PARSEOP_OBJECTTYPE_FLD {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_FLD);} + | PARSEOP_OBJECTTYPE_DEV {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DEV);} + | PARSEOP_OBJECTTYPE_EVT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_EVT);} + | PARSEOP_OBJECTTYPE_MTH {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTH);} + | PARSEOP_OBJECTTYPE_MTX {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);} + | PARSEOP_OBJECTTYPE_OPR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);} + | PARSEOP_OBJECTTYPE_POW {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);} + | PARSEOP_OBJECTTYPE_PRO {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PRO);} + | PARSEOP_OBJECTTYPE_THZ {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);} + | PARSEOP_OBJECTTYPE_BFF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);} + | PARSEOP_OBJECTTYPE_DDB {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);} + ; + +ParityTypeKeyword + : PARSEOP_PARITYTYPE_SPACE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_SPACE);} + | PARSEOP_PARITYTYPE_MARK {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_MARK);} + | PARSEOP_PARITYTYPE_ODD {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_ODD);} + | PARSEOP_PARITYTYPE_EVEN {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_EVEN);} + | PARSEOP_PARITYTYPE_NONE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_NONE);} + ; + +PinConfigByte + : PinConfigKeyword {$$ = $1;} + | ByteConstExpr {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} + ; + +PinConfigKeyword + : PARSEOP_PIN_NOPULL {$$ = TrCreateLeafNode (PARSEOP_PIN_NOPULL);} + | PARSEOP_PIN_PULLDOWN {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDOWN);} + | PARSEOP_PIN_PULLUP {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLUP);} + | PARSEOP_PIN_PULLDEFAULT {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDEFAULT);} + ; + +PldKeyword + : PARSEOP_PLD_REVISION {$$ = TrCreateLeafNode (PARSEOP_PLD_REVISION);} + | PARSEOP_PLD_IGNORECOLOR {$$ = TrCreateLeafNode (PARSEOP_PLD_IGNORECOLOR);} + | PARSEOP_PLD_RED {$$ = TrCreateLeafNode (PARSEOP_PLD_RED);} + | PARSEOP_PLD_GREEN {$$ = TrCreateLeafNode (PARSEOP_PLD_GREEN);} + | PARSEOP_PLD_BLUE {$$ = TrCreateLeafNode (PARSEOP_PLD_BLUE);} + | PARSEOP_PLD_WIDTH {$$ = TrCreateLeafNode (PARSEOP_PLD_WIDTH);} + | PARSEOP_PLD_HEIGHT {$$ = TrCreateLeafNode (PARSEOP_PLD_HEIGHT);} + | PARSEOP_PLD_USERVISIBLE {$$ = TrCreateLeafNode (PARSEOP_PLD_USERVISIBLE);} + | PARSEOP_PLD_DOCK {$$ = TrCreateLeafNode (PARSEOP_PLD_DOCK);} + | PARSEOP_PLD_LID {$$ = TrCreateLeafNode (PARSEOP_PLD_LID);} + | PARSEOP_PLD_PANEL {$$ = TrCreateLeafNode (PARSEOP_PLD_PANEL);} + | PARSEOP_PLD_VERTICALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALPOSITION);} + | PARSEOP_PLD_HORIZONTALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALPOSITION);} + | PARSEOP_PLD_SHAPE {$$ = TrCreateLeafNode (PARSEOP_PLD_SHAPE);} + | PARSEOP_PLD_GROUPORIENTATION {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPORIENTATION);} + | PARSEOP_PLD_GROUPTOKEN {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPTOKEN);} + | PARSEOP_PLD_GROUPPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPPOSITION);} + | PARSEOP_PLD_BAY {$$ = TrCreateLeafNode (PARSEOP_PLD_BAY);} + | PARSEOP_PLD_EJECTABLE {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTABLE);} + | PARSEOP_PLD_EJECTREQUIRED {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTREQUIRED);} + | PARSEOP_PLD_CABINETNUMBER {$$ = TrCreateLeafNode (PARSEOP_PLD_CABINETNUMBER);} + | PARSEOP_PLD_CARDCAGENUMBER {$$ = TrCreateLeafNode (PARSEOP_PLD_CARDCAGENUMBER);} + | PARSEOP_PLD_REFERENCE {$$ = TrCreateLeafNode (PARSEOP_PLD_REFERENCE);} + | PARSEOP_PLD_ROTATION {$$ = TrCreateLeafNode (PARSEOP_PLD_ROTATION);} + | PARSEOP_PLD_ORDER {$$ = TrCreateLeafNode (PARSEOP_PLD_ORDER);} + | PARSEOP_PLD_RESERVED {$$ = TrCreateLeafNode (PARSEOP_PLD_RESERVED);} + | PARSEOP_PLD_VERTICALOFFSET {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALOFFSET);} + | PARSEOP_PLD_HORIZONTALOFFSET {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALOFFSET);} + ; + +RangeTypeKeyword + : PARSEOP_RANGETYPE_ISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ISAONLY);} + | PARSEOP_RANGETYPE_NONISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_NONISAONLY);} + | PARSEOP_RANGETYPE_ENTIRE {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ENTIRE);} + ; + +RegionSpaceKeyword + : PARSEOP_REGIONSPACE_IO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IO);} + | PARSEOP_REGIONSPACE_MEM {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_MEM);} + | PARSEOP_REGIONSPACE_PCI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCI);} + | PARSEOP_REGIONSPACE_EC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_EC);} + | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);} + | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);} + | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);} + | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);} + | PARSEOP_REGIONSPACE_GPIO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GPIO);} + | PARSEOP_REGIONSPACE_GSBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GSBUS);} + | PARSEOP_REGIONSPACE_PCC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCC);} + | PARSEOP_REGIONSPACE_FFIXEDHW {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_FFIXEDHW);} + ; + +ResourceTypeKeyword + : PARSEOP_RESOURCETYPE_CONSUMER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} + | PARSEOP_RESOURCETYPE_PRODUCER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_PRODUCER);} + ; + +SerializeRuleKeyword + : PARSEOP_SERIALIZERULE_SERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_SERIAL);} + | PARSEOP_SERIALIZERULE_NOTSERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL);} + ; + +ShareTypeKeyword + : PARSEOP_SHARETYPE_SHARED {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHARED);} + | PARSEOP_SHARETYPE_EXCLUSIVE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVE);} + | PARSEOP_SHARETYPE_SHAREDWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHAREDWAKE);} + | PARSEOP_SHARETYPE_EXCLUSIVEWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVEWAKE);} + ; + +SlaveModeKeyword + : PARSEOP_SLAVEMODE_CONTROLLERINIT {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_CONTROLLERINIT);} + | PARSEOP_SLAVEMODE_DEVICEINIT {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_DEVICEINIT);} + ; + +StopBitsKeyword + : PARSEOP_STOPBITS_TWO {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_TWO);} + | PARSEOP_STOPBITS_ONEPLUSHALF {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONEPLUSHALF);} + | PARSEOP_STOPBITS_ONE {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONE);} + | PARSEOP_STOPBITS_ZERO {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ZERO);} + ; + +TranslationKeyword + : PARSEOP_TRANSLATIONTYPE_SPARSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_SPARSE);} + | PARSEOP_TRANSLATIONTYPE_DENSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_DENSE);} + ; + +TypeKeyword + : PARSEOP_TYPE_TRANSLATION {$$ = TrCreateLeafNode (PARSEOP_TYPE_TRANSLATION);} + | PARSEOP_TYPE_STATIC {$$ = TrCreateLeafNode (PARSEOP_TYPE_STATIC);} + ; + +UpdateRuleKeyword + : PARSEOP_UPDATERULE_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_PRESERVE);} + | PARSEOP_UPDATERULE_ONES {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ONES);} + | PARSEOP_UPDATERULE_ZEROS {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ZEROS);} + ; + +WireModeKeyword + : PARSEOP_WIREMODE_FOUR {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_FOUR);} + | PARSEOP_WIREMODE_THREE {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_THREE);} + ; + +XferSizeKeyword + : PARSEOP_XFERSIZE_8 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_8, 0);} + | PARSEOP_XFERSIZE_16 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_16, 1);} + | PARSEOP_XFERSIZE_32 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} + | PARSEOP_XFERSIZE_64 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_64, 3);} + | PARSEOP_XFERSIZE_128 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_128, 4);} + | PARSEOP_XFERSIZE_256 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_256, 5);} + ; + +XferTypeKeyword + : PARSEOP_XFERTYPE_8 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8);} + | PARSEOP_XFERTYPE_8_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8_16);} + | PARSEOP_XFERTYPE_16 {$$ = TrCreateLeafNode (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 '(' ')' + '{' + ResourceMacroList '}' {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,4, + TrCreateLeafNode (PARSEOP_DEFAULT_ARG), + TrCreateLeafNode (PARSEOP_DEFAULT_ARG), + $5, + TrCreateLeafNode (PARSEOP_ENDTAG));} + ; + +ResourceMacroList + : {$$ = NULL;} + | ResourceMacroList + ResourceMacroTerm {$$ = TrLinkPeerNode ($1,$2);} + ; + +ResourceMacroTerm + : DMATerm {} + | DWordIOTerm {} + | DWordMemoryTerm {} + | DWordSpaceTerm {} + | EndDependentFnTerm {} + | ExtendedIOTerm {} + | ExtendedMemoryTerm {} + | ExtendedSpaceTerm {} + | FixedDmaTerm {} + | FixedIOTerm {} + | GpioIntTerm {} + | GpioIoTerm {} + | I2cSerialBusTerm {} + | InterruptTerm {} + | IOTerm {} + | IRQNoFlagsTerm {} + | IRQTerm {} + | Memory24Term {} + | Memory32FixedTerm {} + | Memory32Term {} + | QWordIOTerm {} + | QWordMemoryTerm {} + | QWordSpaceTerm {} + | RegisterTerm {} + | SpiSerialBusTerm {} + | StartDependentFnNoPriTerm {} + | StartDependentFnTerm {} + | UartSerialBusTerm {} + | VendorLongTerm {} + | VendorShortTerm {} + | WordBusNumberTerm {} + | WordIOTerm {} + | WordSpaceTerm {} + ; + +DMATerm + : PARSEOP_DMA '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DMA);} + DMATypeKeyword + OptionalBusMasterKeyword + ',' XferTypeKeyword + OptionalNameString_Last + ')' '{' + ByteList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$5,$7,$8,$11);} + | PARSEOP_DMA '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +DWordIOTerm + : PARSEOP_DWORDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDIO);} + OptionalResourceType_First + OptionalMinType + OptionalMaxType + OptionalDecodeType + OptionalRangeType + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString + OptionalType + OptionalTranslationType_Last + ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} + | PARSEOP_DWORDIO '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +DWordMemoryTerm + : PARSEOP_DWORDMEMORY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDMEMORY);} + OptionalResourceType_First + OptionalDecodeType + OptionalMinType + OptionalMaxType + OptionalMemType + ',' OptionalReadWriteKeyword + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString + OptionalAddressRange + OptionalType_Last + ')' {$$ = TrLinkChildren ($<n>3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} + | PARSEOP_DWORDMEMORY '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +DWordSpaceTerm + : PARSEOP_DWORDSPACE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDSPACE);} + ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} + OptionalResourceType + OptionalDecodeType + OptionalMinType + OptionalMaxType + ',' ByteConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString_Last + ')' {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} + | PARSEOP_DWORDSPACE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +EndDependentFnTerm + : PARSEOP_ENDDEPENDENTFN '(' + ')' {$$ = TrCreateLeafNode (PARSEOP_ENDDEPENDENTFN);} + | PARSEOP_ENDDEPENDENTFN '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ExtendedIOTerm + : PARSEOP_EXTENDEDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDIO);} + OptionalResourceType_First + OptionalMinType + OptionalMaxType + OptionalDecodeType + OptionalRangeType + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + OptionalQWordConstExpr + OptionalNameString + OptionalType + OptionalTranslationType_Last + ')' {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22);} + | PARSEOP_EXTENDEDIO '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ExtendedMemoryTerm + : PARSEOP_EXTENDEDMEMORY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDMEMORY);} + OptionalResourceType_First + OptionalDecodeType + OptionalMinType + OptionalMaxType + OptionalMemType + ',' OptionalReadWriteKeyword + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + OptionalQWordConstExpr + OptionalNameString + OptionalAddressRange + OptionalType_Last + ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24);} + | PARSEOP_EXTENDEDMEMORY '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ExtendedSpaceTerm + : PARSEOP_EXTENDEDSPACE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDSPACE);} + ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} + OptionalResourceType + OptionalDecodeType + OptionalMinType + OptionalMaxType + ',' ByteConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + OptionalQWordConstExpr + OptionalNameString_Last + ')' {$$ = TrLinkChildren ($<n>3,13,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23);} + | PARSEOP_EXTENDEDSPACE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +FixedDmaTerm + : PARSEOP_FIXEDDMA '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDDMA);} + WordConstExpr /* 04: DMA RequestLines */ + ',' WordConstExpr /* 06: DMA Channels */ + OptionalXferSize /* 07: DMA TransferSize */ + OptionalNameString /* 08: DescriptorName */ + ')' {$$ = TrLinkChildren ($<n>3,4,$4,$6,$7,$8);} + | PARSEOP_FIXEDDMA '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +FixedIOTerm + : PARSEOP_FIXEDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDIO);} + WordConstExpr + ',' ByteConstExpr + OptionalNameString_Last + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);} + | PARSEOP_FIXEDIO '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +GpioIntTerm + : PARSEOP_GPIO_INT '(' {$<n>$ = TrCreateLeafNode (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 */ + ')' '{' + DWordConstExpr '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$9,$10,$12,$13,$14,$15,$16,$19);} + | PARSEOP_GPIO_INT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +GpioIoTerm + : PARSEOP_GPIO_IO '(' {$<n>$ = TrCreateLeafNode (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 */ + ')' '{' + DWordList '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$8,$9,$11,$12,$13,$14,$15,$18);} + | PARSEOP_GPIO_IO '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +I2cSerialBusTerm + : PARSEOP_I2C_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (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 */ + ')' {$$ = TrLinkChildren ($<n>3,9,$4,$5,$7,$8,$10,$11,$12,$13,$14);} + | PARSEOP_I2C_SERIALBUS '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +InterruptTerm + : PARSEOP_INTERRUPT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INTERRUPT);} + OptionalResourceType_First + ',' InterruptTypeKeyword + ',' InterruptLevel + OptionalShareType + OptionalByteConstExpr + OptionalStringData + OptionalNameString_Last + ')' '{' + DWordList '}' {$$ = TrLinkChildren ($<n>3,8,$4,$6,$8,$9,$10,$11,$12,$15);} + | PARSEOP_INTERRUPT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +IOTerm + : PARSEOP_IO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IO);} + IODecodeKeyword + ',' WordConstExpr + ',' WordConstExpr + ',' ByteConstExpr + ',' ByteConstExpr + OptionalNameString_Last + ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);} + | PARSEOP_IO '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +IRQNoFlagsTerm + : PARSEOP_IRQNOFLAGS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IRQNOFLAGS);} + OptionalNameString_First + ')' '{' + ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_IRQNOFLAGS '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +IRQTerm + : PARSEOP_IRQ '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IRQ);} + InterruptTypeKeyword + ',' InterruptLevel + OptionalShareType + OptionalNameString_Last + ')' '{' + ByteList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$6,$7,$8,$11);} + | PARSEOP_IRQ '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +Memory24Term + : PARSEOP_MEMORY24 '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY24);} + OptionalReadWriteKeyword + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + OptionalNameString_Last + ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);} + | PARSEOP_MEMORY24 '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +Memory32FixedTerm + : PARSEOP_MEMORY32FIXED '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY32FIXED);} + OptionalReadWriteKeyword + ',' DWordConstExpr + ',' DWordConstExpr + OptionalNameString_Last + ')' {$$ = TrLinkChildren ($<n>3,4,$4,$6,$8,$9);} + | PARSEOP_MEMORY32FIXED '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +Memory32Term + : PARSEOP_MEMORY32 '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY32);} + OptionalReadWriteKeyword + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + ',' DWordConstExpr + OptionalNameString_Last + ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);} + | PARSEOP_MEMORY32 '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +QWordIOTerm + : PARSEOP_QWORDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDIO);} + OptionalResourceType_First + OptionalMinType + OptionalMaxType + OptionalDecodeType + OptionalRangeType + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString + OptionalType + OptionalTranslationType_Last + ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} + | PARSEOP_QWORDIO '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +QWordMemoryTerm + : PARSEOP_QWORDMEMORY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDMEMORY);} + OptionalResourceType_First + OptionalDecodeType + OptionalMinType + OptionalMaxType + OptionalMemType + ',' OptionalReadWriteKeyword + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString + OptionalAddressRange + OptionalType_Last + ')' {$$ = TrLinkChildren ($<n>3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} + | PARSEOP_QWORDMEMORY '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +QWordSpaceTerm + : PARSEOP_QWORDSPACE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDSPACE);} + ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} + OptionalResourceType + OptionalDecodeType + OptionalMinType + OptionalMaxType + ',' ByteConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + ',' QWordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString_Last + ')' {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} + | PARSEOP_QWORDSPACE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +RegisterTerm + : PARSEOP_REGISTER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_REGISTER);} + AddressSpaceKeyword + ',' ByteConstExpr + ',' ByteConstExpr + ',' QWordConstExpr + OptionalAccessSize + OptionalNameString_Last + ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$11,$12);} + | PARSEOP_REGISTER '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +SpiSerialBusTerm + : PARSEOP_SPI_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (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 */ + ')' {$$ = TrLinkChildren ($<n>3,13,$4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20,$21);} + | PARSEOP_SPI_SERIALBUS '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +StartDependentFnNoPriTerm + : PARSEOP_STARTDEPENDENTFN_NOPRI '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN_NOPRI);} + ')' '{' + ResourceMacroList '}' {$$ = TrLinkChildren ($<n>3,1,$6);} + | PARSEOP_STARTDEPENDENTFN_NOPRI '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +StartDependentFnTerm + : PARSEOP_STARTDEPENDENTFN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN);} + ByteConstExpr + ',' ByteConstExpr + ')' '{' + ResourceMacroList '}' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$9);} + | PARSEOP_STARTDEPENDENTFN '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +UartSerialBusTerm + : PARSEOP_UART_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UART_SERIALBUS);} + DWordConstExpr /* 04: ConnectionSpeed */ + OptionalBitsPerByte /* 05: BitsPerByte */ + OptionalStopBits /* 06: StopBits */ + ',' ByteConstExpr /* 08: LinesInUse */ + OptionalEndian /* 09: Endianess */ + 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 */ + ')' {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20,$21);} + | PARSEOP_UART_SERIALBUS '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +VendorLongTerm + : PARSEOP_VENDORLONG '(' {$<n>$ = TrCreateLeafNode (PARSEOP_VENDORLONG);} + OptionalNameString_First + ')' '{' + ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_VENDORLONG '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +VendorShortTerm + : PARSEOP_VENDORSHORT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_VENDORSHORT);} + OptionalNameString_First + ')' '{' + ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_VENDORSHORT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +WordBusNumberTerm + : PARSEOP_WORDBUSNUMBER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WORDBUSNUMBER);} + OptionalResourceType_First + OptionalMinType + OptionalMaxType + OptionalDecodeType + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString_Last + ')' {$$ = TrLinkChildren ($<n>3,12,$4,$5,$6,$7,$9,$11,$13,$15,$17,$18,$19,$20);} + | PARSEOP_WORDBUSNUMBER '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +WordIOTerm + : PARSEOP_WORDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WORDIO);} + OptionalResourceType_First + OptionalMinType + OptionalMaxType + OptionalDecodeType + OptionalRangeType + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString + OptionalType + OptionalTranslationType_Last + ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} + | PARSEOP_WORDIO '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +WordSpaceTerm + : PARSEOP_WORDSPACE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WORDSPACE);} + ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} + OptionalResourceType + OptionalDecodeType + OptionalMinType + OptionalMaxType + ',' ByteConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + ',' WordConstExpr + OptionalByteConstExpr + OptionalStringData + OptionalNameString_Last + ')' {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} + | PARSEOP_WORDSPACE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + + +/******* Object References ***********************************************/ + +/* Allow IO, DMA, IRQ Resource macro names to also be used as identifiers */ + +NameString + : NameSeg {} + | PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) AslCompilerlval.s);} + | PARSEOP_IO {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");} + | PARSEOP_DMA {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");} + | PARSEOP_IRQ {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");} + ; + +NameSeg + : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (ACPI_NATIVE_INT) AslCompilerlval.s);} + ; + + +/******************************************************************************* + * + * ASL Helper Terms + * + ******************************************************************************/ + +OptionalBusMasterKeyword + : ',' {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);} + | ',' PARSEOP_BUSMASTERTYPE_MASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);} + | ',' PARSEOP_BUSMASTERTYPE_NOTMASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_NOTMASTER);} + ; + +OptionalAccessAttribTerm + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' ByteConstExpr {$$ = $2;} + | ',' AccessAttribKeyword {$$ = $2;} + ; + +OptionalAccessSize + : {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);} + | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);} + | ',' ByteConstExpr {$$ = $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 + : {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ + | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ + | ',' TermArg {$$ = $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 + : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} + | NameString {$$ = $1;} + ; + +OptionalObjectTypeKeyword + : {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} + | ',' ObjectTypeKeyword {$$ = $2;} + ; + +OptionalParityType + : ',' {$$ = NULL;} + | ',' ParityTypeKeyword {$$ = $2;} + ; + +OptionalQWordConstExpr + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' QWordConstExpr {$$ = $2;} + ; + +OptionalRangeType + : ',' {$$ = NULL;} + | ',' RangeTypeKeyword {$$ = $2;} + ; + +OptionalReadWriteKeyword + : {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} + | PARSEOP_READWRITETYPE_BOTH {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} + | PARSEOP_READWRITETYPE_READONLY {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_READONLY);} + ; + +OptionalResourceType_First + : {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} + | ResourceTypeKeyword {$$ = $1;} + ; + +OptionalResourceType + : {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} + | ',' {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} + | ',' 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;} + ; + +OptionalTranslationType_Last + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' TranslationKeyword {$$ = $2;} + ; + +OptionalType + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' TypeKeyword {$$ = $2;} + ; + +OptionalType_Last + : {$$ = NULL;} + | ',' {$$ = NULL;} + | ',' TypeKeyword {$$ = $2;} + ; + +OptionalWireMode + : ',' {$$ = NULL;} + | ',' WireModeKeyword {$$ = $2;} + ; + +OptionalWordConstExpr + : ',' {$$ = NULL;} + | ',' WordConstExpr {$$ = $2;} + ; + +OptionalXferSize + : {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} + | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} + | ',' XferSizeKeyword {$$ = $2;} + ; diff --git a/source/compiler/aslrules.y b/source/compiler/aslrules.y index dbe0882..cac37c3 100644 --- a/source/compiler/aslrules.y +++ b/source/compiler/aslrules.y @@ -1,7 +1,7 @@ NoEcho(' /****************************************************************************** * - * Module Name: aslrules.y - Bison/Yacc production rules + * Module Name: aslrules.y - Main Bison/Yacc production rules * *****************************************************************************/ @@ -46,14 +46,12 @@ NoEcho(' /******************************************************************************* * - * Production rules start here + * ASL Root and Secondary Terms * ******************************************************************************/ /* - * ASL Names - * - * Root rule. Allow multiple #line directives before the definition block + * Root term. Allow multiple #line directives before the definition block * to handle output from preprocessors */ ASLCode @@ -62,10 +60,6 @@ ASLCode ; /* - * Blocks, Data, and Opcodes - */ - -/* * Note concerning support for "module-level code". * * ACPI 1.0 allowed Type1 and Type2 executable opcodes outside of control @@ -92,150 +86,167 @@ DefinitionBlockTerm '{' TermList '}' {$$ = TrLinkChildren ($<n>3,7,$4,$6,$8,$10,$12,$14,$18);} ; - /* - * 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) = += -= *= /= %= <<= >>= &= ^= |= - */ -Expression - - /* Unary operators */ - - : PARSEOP_EXP_LOGICAL_NOT {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);} - TermArg {$$ = TrLinkChildren ($<n>2,1,$3);} - | PARSEOP_EXP_NOT {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);} - TermArg {$$ = TrLinkChildren ($<n>2,2,$3,TrCreateNullTarget ());} - - | SuperName PARSEOP_EXP_INCREMENT {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);} - {$$ = TrLinkChildren ($<n>3,1,$1);} - | SuperName PARSEOP_EXP_DECREMENT {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);} - {$$ = TrLinkChildren ($<n>3,1,$1);} - - /* Binary operators: math and logical */ - - | TermArg PARSEOP_EXP_ADD {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_DIVIDE {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);} - TermArg {$$ = TrLinkChildren ($<n>3,4,$1,$4,TrCreateNullTarget (), - TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_MODULO {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_MULTIPLY {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_SHIFT_LEFT {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_SHIFT_RIGHT {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_SUBTRACT {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} - - | TermArg PARSEOP_EXP_AND {$<n>$ = TrCreateLeafNode (PARSEOP_AND);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_OR {$<n>$ = TrCreateLeafNode (PARSEOP_OR);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} - | TermArg PARSEOP_EXP_XOR {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());} - - | TermArg PARSEOP_EXP_GREATER {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);} - TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} - | TermArg PARSEOP_EXP_GREATER_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATEREQUAL);} - TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} - | TermArg PARSEOP_EXP_LESS {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);} - TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} - | TermArg PARSEOP_EXP_LESS_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LLESSEQUAL);} - TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} - - | TermArg PARSEOP_EXP_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);} - TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} - | TermArg PARSEOP_EXP_NOT_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LNOTEQUAL);} - TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} - - | TermArg PARSEOP_EXP_LOGICAL_AND {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);} - TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} - | TermArg PARSEOP_EXP_LOGICAL_OR {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);} - TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} - - /* Parentheses */ - - | '(' TermArg ')' { $$ = $2;} - ; - -EqualsTerm - - /* All assignment-type operations */ - - : SuperName PARSEOP_EXP_EQUALS - TermArg {$$ = TrCreateAssignmentNode ($1, $3);} - - | TermArg PARSEOP_EXP_ADD_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} - - | TermArg PARSEOP_EXP_DIV_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);} - TermArg {$$ = TrLinkChildren ($<n>3,4,$1,$4,TrCreateNullTarget (), - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} - - | TermArg PARSEOP_EXP_MOD_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} - - | TermArg PARSEOP_EXP_MUL_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} - - | TermArg PARSEOP_EXP_SHL_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} - - | TermArg PARSEOP_EXP_SHR_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} - - | TermArg PARSEOP_EXP_SUB_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} +SuperName + : NameString {} + | ArgTerm {} + | LocalTerm {} + | DebugTerm {} + | Type6Opcode {} + +Target + : {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */ + | ',' {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */ + | ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);} + ; + +TermArg + : Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + | DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + | NameString {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + | ArgTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + | LocalTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + ; + +/* + NOTE: Removed from TermArg due to reduce/reduce conflicts: + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + | Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + | Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + | Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} + +*/ + +MethodInvocationTerm + : NameString '(' {TrUpdateNode (PARSEOP_METHODCALL, $1);} + ArgList ')' {$$ = TrLinkChildNode ($1,$4);} + ; + +/* OptionalCount must appear before ByteList or an incorrect reduction will result */ + +OptionalCount + : {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */ + | ',' {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */ + | ',' TermArg {$$ = $2;} + ; + +VarPackageLengthTerm + : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} + | TermArg {$$ = $1;} + ; + + +/******* List Terms **************************************************/ + +ArgList + : {$$ = NULL;} + | TermArg + | ArgList ',' /* Allows a trailing comma at list end */ + | ArgList ',' + TermArg {$$ = TrLinkPeerNode ($1,$3);} + ; + +ByteList + : {$$ = NULL;} + | ByteConstExpr + | ByteList ',' /* Allows a trailing comma at list end */ + | ByteList ',' + ByteConstExpr {$$ = TrLinkPeerNode ($1,$3);} + ; + +DWordList + : {$$ = NULL;} + | DWordConstExpr + | DWordList ',' /* Allows a trailing comma at list end */ + | DWordList ',' + DWordConstExpr {$$ = TrLinkPeerNode ($1,$3);} + ; + +FieldUnitList + : {$$ = NULL;} + | FieldUnit + | FieldUnitList ',' /* Allows a trailing comma at list end */ + | FieldUnitList ',' + FieldUnit {$$ = TrLinkPeerNode ($1,$3);} + ; + +FieldUnit + : FieldUnitEntry {} + | OffsetTerm {} + | AccessAsTerm {} + | ConnectionTerm {} + ; + +FieldUnitEntry + : ',' AmlPackageLengthTerm {$$ = TrCreateNode (PARSEOP_RESERVED_BYTES,1,$2);} + | NameSeg ',' + AmlPackageLengthTerm {$$ = TrLinkChildNode ($1,$3);} + ; + +ObjectList + : {$$ = NULL;} + | ObjectList Object {$$ = TrLinkPeerNode ($1,$2);} + | error {$$ = AslDoError(); yyclearin;} + ; + +Object + : CompilerDirective {} + | NamedObject {} + | NameSpaceModifier {} + ; + +PackageList + : {$$ = NULL;} + | PackageElement + | PackageList ',' /* Allows a trailing comma at list end */ + | PackageList ',' + PackageElement {$$ = TrLinkPeerNode ($1,$3);} + ; + +PackageElement + : DataObject {} + | NameString {} + ; - | TermArg PARSEOP_EXP_AND_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_AND);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + /* Rules for specifying the type of one method argument or return value */ - | TermArg PARSEOP_EXP_OR_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_OR);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} +ParameterTypePackage + : {$$ = NULL;} + | ObjectTypeKeyword {$$ = $1;} + | ParameterTypePackage ',' + ObjectTypeKeyword {$$ = TrLinkPeerNodes (2,$1,$3);} + ; + +ParameterTypePackageList + : {$$ = NULL;} + | ObjectTypeKeyword {$$ = $1;} + | '{' ParameterTypePackage '}' {$$ = $2;} + ; - | TermArg PARSEOP_EXP_XOR_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);} - TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, - TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} +OptionalParameterTypePackage + : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} + | ',' ParameterTypePackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);} ; + /* Rules for specifying the types for method arguments */ -/* ACPI 3.0 -- allow semicolons between terms */ +ParameterTypesPackage + : ParameterTypePackageList {$$ = $1;} + | ParameterTypesPackage ',' + ParameterTypePackageList {$$ = TrLinkPeerNodes (2,$1,$3);} + ; + +ParameterTypesPackageList + : {$$ = NULL;} + | ObjectTypeKeyword {$$ = $1;} + | '{' ParameterTypesPackage '}' {$$ = $2;} + ; + +OptionalParameterTypesPackage + : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} + | ',' ParameterTypesPackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);} + ; + + /* ACPI 3.0 -- allow semicolons between terms */ TermList : {$$ = NULL;} @@ -256,22 +267,44 @@ Term | error {$$ = AslDoError(); yyclearin;} ; -CompilerDirective - : IncludeTerm {} - | ExternalTerm {} - ; +/* + * Case-Default list; allow only one Default term and unlimited Case terms + */ +CaseDefaultTermList + : {$$ = NULL;} + | CaseTerm {} + | DefaultTerm {} + | CaseDefaultTermList + CaseTerm {$$ = TrLinkPeerNode ($1,$2);} + | CaseDefaultTermList + DefaultTerm {$$ = TrLinkPeerNode ($1,$2);} -ObjectList +/* Original - attempts to force zero or one default term within the switch */ + +/* +CaseDefaultTermList : {$$ = NULL;} - | ObjectList Object {$$ = TrLinkPeerNode ($1,$2);} - | error {$$ = AslDoError(); yyclearin;} + | CaseTermList + DefaultTerm + CaseTermList {$$ = TrLinkPeerNode ($1,TrLinkPeerNode ($2, $3));} + | CaseTermList + CaseTerm {$$ = TrLinkPeerNode ($1,$2);} ; -Object - : CompilerDirective {} - | NamedObject {} - | NameSpaceModifier {} +CaseTermList + : {$$ = NULL;} + | CaseTerm {} + | CaseTermList + CaseTerm {$$ = TrLinkPeerNode ($1,$2);} ; +*/ + + +/******************************************************************************* + * + * ASL Data and Constant Terms + * + ******************************************************************************/ DataObject : BufferData {} @@ -303,6 +336,93 @@ StringData | String {} ; +ByteConst + : Integer {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} + ; + +WordConst + : Integer {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} + ; + +DWordConst + : Integer {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} + ; + +QWordConst + : Integer {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} + ; + +/* + * The NODE_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 {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);} + | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} + | ByteConst {} + ; + +WordConstExpr + : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);} + | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} + | WordConst {} + ; + +DWordConstExpr + : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);} + | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} + | DWordConst {} + ; + +QWordConstExpr + : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);} + | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);} + | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} + | QWordConst {} + ; + +ConstTerm + : ConstExprTerm {} + | PARSEOP_REVISION {$$ = TrCreateLeafNode (PARSEOP_REVISION);} + ; + +ConstExprTerm + : PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);} + | PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);} + | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);} + | PARSEOP___DATE__ {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);} + | PARSEOP___FILE__ {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);} + | PARSEOP___LINE__ {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);} + | PARSEOP___PATH__ {$$ = TrCreateConstantLeafNode (PARSEOP___PATH__);} + ; + +Integer + : PARSEOP_INTEGER {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, AslCompilerlval.i);} + ; + +String + : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, (ACPI_NATIVE_INT) AslCompilerlval.s);} + ; + + +/******************************************************************************* + * + * ASL Opcode Terms + * + ******************************************************************************/ + +CompilerDirective + : IncludeTerm {} + | ExternalTerm {} + ; + NamedObject : BankFieldTerm {} | CreateBitFieldTerm {} @@ -331,40 +451,18 @@ NameSpaceModifier | ScopeTerm {} ; -MethodInvocationTerm - : NameString '(' {TrUpdateNode (PARSEOP_METHODCALL, $1);} - ArgList ')' {$$ = TrLinkChildNode ($1,$4);} - ; - -ArgList - : {$$ = NULL;} - | TermArg - | ArgList ',' /* Allows a trailing comma at list end */ - | ArgList ',' - TermArg {$$ = TrLinkPeerNode ($1,$3);} - ; - -/* -Removed from TermArg due to reduce/reduce conflicts - | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - -*/ +/* For ObjectType: SuperName except for MethodInvocationTerm */ -TermArg - : Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | NameString {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | ArgTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - | LocalTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} - ; +ObjectTypeName + : NameString {} + | ArgTerm {} + | LocalTerm {} + | DebugTerm {} + | RefOfTerm {} + | DerefOfTerm {} + | IndexTerm {} -Target - : {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */ - | ',' {$$ = TrCreateNullTarget ();} /* Placeholder is a ZeroOp object */ - | ',' SuperName {$$ = TrSetNodeFlags ($2, NODE_IS_TARGET);} +/* | MethodInvocationTerm {} */ /* Caused reduce/reduce with Type6Opcode->MethodInvocationTerm */ ; RequiredTarget @@ -377,46 +475,6 @@ SimpleTarget | ArgTerm {} ; -/* Rules for specifying the type of one method argument or return value */ - -ParameterTypePackage - : {$$ = NULL;} - | ObjectTypeKeyword {$$ = $1;} - | ParameterTypePackage ',' - ObjectTypeKeyword {$$ = TrLinkPeerNodes (2,$1,$3);} - ; - -ParameterTypePackageList - : {$$ = NULL;} - | ObjectTypeKeyword {$$ = $1;} - | '{' ParameterTypePackage '}' {$$ = $2;} - ; - -OptionalParameterTypePackage - : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | ',' ParameterTypePackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);} - ; - -/* Rules for specifying the types for method arguments */ - -ParameterTypesPackage - : ParameterTypePackageList {$$ = $1;} - | ParameterTypesPackage ',' - ParameterTypePackageList {$$ = TrLinkPeerNodes (2,$1,$3);} - ; - -ParameterTypesPackageList - : {$$ = NULL;} - | ObjectTypeKeyword {$$ = $1;} - | '{' ParameterTypesPackage '}' {$$ = $2;} - ; - -OptionalParameterTypesPackage - : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | ',' ParameterTypesPackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);} - ; - - /* Opcode types */ Type1Opcode @@ -424,7 +482,7 @@ Type1Opcode | BreakPointTerm {} | ContinueTerm {} | FatalTerm {} - | IfElseTerm {} + | ElseIfTerm {} | LoadTerm {} | NoOpTerm {} | NotifyTerm {} @@ -457,7 +515,6 @@ Type2Opcode /* * Type 3/4/5 opcodes */ - Type2IntegerOpcode /* "Type3" opcodes */ : Expression {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST);} | AddTerm {} @@ -515,7 +572,6 @@ Type2BufferOrStringOpcode /* * A type 3 opcode evaluates to an Integer and cannot have a destination operand */ - Type3Opcode : EISAIDTerm {} ; @@ -530,7 +586,6 @@ Type4Opcode ; */ - Type5Opcode : ResourceTemplateTerm {} | UnicodeTerm {} @@ -542,34 +597,74 @@ Type6Opcode : RefOfTerm {} | DerefOfTerm {} | IndexTerm {} + | IndexExpTerm {} | MethodInvocationTerm {} ; -IncludeTerm - : PARSEOP_INCLUDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCLUDE);} - String ')' {TrLinkChildren ($<n>3,1,$4);FlOpenIncludeFile ($4);} - TermList - IncludeEndTerm {$$ = TrLinkPeerNodes (3,$<n>3,$7,$8);} + +/******************************************************************************* + * + * ASL Primary Terms + * + ******************************************************************************/ + +AccessAsTerm + : PARSEOP_ACCESSAS '(' + AccessTypeKeyword + OptionalAccessAttribTerm + ')' {$$ = TrCreateNode (PARSEOP_ACCESSAS,2,$3,$4);} + | PARSEOP_ACCESSAS '(' + error ')' {$$ = AslDoError(); yyclearin;} ; -IncludeEndTerm - : PARSEOP_INCLUDE_END {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END);} +AcquireTerm + : PARSEOP_ACQUIRE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACQUIRE);} + SuperName + ',' WordConstExpr + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$6);} + | PARSEOP_ACQUIRE '(' + error ')' {$$ = AslDoError(); yyclearin;} ; -ExternalTerm - : PARSEOP_EXTERNAL '(' - NameString - OptionalObjectTypeKeyword - OptionalParameterTypePackage - OptionalParameterTypesPackage - ')' {$$ = TrCreateNode (PARSEOP_EXTERNAL,4,$3,$4,$5,$6);} - | PARSEOP_EXTERNAL '(' +AddTerm + : PARSEOP_ADD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_ADD '(' error ')' {$$ = AslDoError(); yyclearin;} ; +AliasTerm + : PARSEOP_ALIAS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ALIAS);} + NameString + NameStringItem + ')' {$$ = TrLinkChildren ($<n>3,2,$4, + TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));} + | PARSEOP_ALIAS '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; -/******* Named Objects *******************************************************/ +AndTerm + : PARSEOP_AND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_AND);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_AND '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; +ArgTerm + : PARSEOP_ARG0 {$$ = TrCreateLeafNode (PARSEOP_ARG0);} + | PARSEOP_ARG1 {$$ = TrCreateLeafNode (PARSEOP_ARG1);} + | PARSEOP_ARG2 {$$ = TrCreateLeafNode (PARSEOP_ARG2);} + | PARSEOP_ARG3 {$$ = TrCreateLeafNode (PARSEOP_ARG3);} + | PARSEOP_ARG4 {$$ = TrCreateLeafNode (PARSEOP_ARG4);} + | PARSEOP_ARG5 {$$ = TrCreateLeafNode (PARSEOP_ARG5);} + | PARSEOP_ARG6 {$$ = TrCreateLeafNode (PARSEOP_ARG6);} + ; BankFieldTerm : PARSEOP_BANKFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BANKFIELD);} @@ -585,41 +680,54 @@ BankFieldTerm error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} ; -FieldUnitList - : {$$ = NULL;} - | FieldUnit - | FieldUnitList ',' /* Allows a trailing comma at list end */ - | FieldUnitList ',' - FieldUnit {$$ = TrLinkPeerNode ($1,$3);} +BreakTerm + : PARSEOP_BREAK {$$ = TrCreateNode (PARSEOP_BREAK, 0);} ; -FieldUnit - : FieldUnitEntry {} - | OffsetTerm {} - | AccessAsTerm {} - | ConnectionTerm {} +BreakPointTerm + : PARSEOP_BREAKPOINT {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);} ; -FieldUnitEntry - : ',' AmlPackageLengthTerm {$$ = TrCreateNode (PARSEOP_RESERVED_BYTES,1,$2);} - | NameSeg ',' - AmlPackageLengthTerm {$$ = TrLinkChildNode ($1,$3);} +BufferTerm + : PARSEOP_BUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BUFFER);} + OptionalTermArg + ')' '{' + BufferTermData '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_BUFFER '(' + error ')' {$$ = AslDoError(); yyclearin;} ; -OffsetTerm - : PARSEOP_OFFSET '(' - AmlPackageLengthTerm - ')' {$$ = TrCreateNode (PARSEOP_OFFSET,1,$3);} - | PARSEOP_OFFSET '(' +BufferTermData + : ByteList {} + | StringData {} + ; + +CaseTerm + : PARSEOP_CASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CASE);} + DataObject + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_CASE '(' error ')' {$$ = AslDoError(); yyclearin;} ; -AccessAsTerm - : PARSEOP_ACCESSAS '(' - AccessTypeKeyword - OptionalAccessAttribTerm - ')' {$$ = TrCreateNode (PARSEOP_ACCESSAS,2,$3,$4);} - | PARSEOP_ACCESSAS '(' +ConcatTerm + : PARSEOP_CONCATENATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATE);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_CONCATENATE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ConcatResTerm + : PARSEOP_CONCATENATERESTEMPLATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATERESTEMPLATE);} + TermArg + TermArgItem + Target + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} + | PARSEOP_CONCATENATERESTEMPLATE '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -638,6 +746,28 @@ ConnectionTerm error ')' {$$ = AslDoError(); yyclearin;} ; +CondRefOfTerm + : PARSEOP_CONDREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONDREFOF);} + SuperName + Target + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_CONDREFOF '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ContinueTerm + : PARSEOP_CONTINUE {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);} + ; + +CopyObjectTerm + : PARSEOP_COPYOBJECT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);} + TermArg + ',' SimpleTarget + ')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));} + | PARSEOP_COPYOBJECT '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + CreateBitFieldTerm : PARSEOP_CREATEBITFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);} TermArg @@ -710,204 +840,64 @@ DataRegionTerm error ')' {$$ = AslDoError(); yyclearin;} ; -DeviceTerm - : PARSEOP_DEVICE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);} - NameString - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} - | PARSEOP_DEVICE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -EventTerm - : PARSEOP_EVENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EVENT);} - NameString - ')' {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));} - | PARSEOP_EVENT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FieldTerm - : PARSEOP_FIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIELD);} - NameString - ',' AccessTypeKeyword - ',' LockRuleKeyword - ',' UpdateRuleKeyword - ')' '{' - FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$6,$8,$10,$13);} - | PARSEOP_FIELD '(' - error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} - ; - -FunctionTerm - : PARSEOP_FUNCTION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);} - NameString - OptionalParameterTypePackage - OptionalParameterTypesPackage - ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION), - TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0), - TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL), - TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),$5,$6,$9);} - | PARSEOP_FUNCTION '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IndexFieldTerm - : PARSEOP_INDEXFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);} - NameString - NameStringItem - ',' AccessTypeKeyword - ',' LockRuleKeyword - ',' UpdateRuleKeyword - ')' '{' - FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,6,$4,$5,$7,$9,$11,$14);} - | PARSEOP_INDEXFIELD '(' - error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} - ; - -MethodTerm - : PARSEOP_METHOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);} - NameString - OptionalByteConstExpr {UtCheckIntegerRange ($5, 0, 7);} - OptionalSerializeRuleKeyword - OptionalByteConstExpr - OptionalParameterTypePackage - OptionalParameterTypesPackage - ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$7,$8,$9,$10,$13);} - | PARSEOP_METHOD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -MutexTerm - : PARSEOP_MUTEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MUTEX);} - NameString - ',' ByteConstExpr - ')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} - | PARSEOP_MUTEX '(' - error ')' {$$ = AslDoError(); yyclearin;} +DebugTerm + : PARSEOP_DEBUG {$$ = TrCreateLeafNode (PARSEOP_DEBUG);} ; -OpRegionTerm - : PARSEOP_OPERATIONREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);} - NameString - ',' OpRegionSpaceIdTerm - TermArgItem - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8);} - | PARSEOP_OPERATIONREGION '(' +DecTerm + : PARSEOP_DECREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_DECREMENT '(' error ')' {$$ = AslDoError(); yyclearin;} ; -OpRegionSpaceIdTerm - : RegionSpaceKeyword {} - | ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} - ; - -PowerResTerm - : PARSEOP_POWERRESOURCE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);} - NameString - ',' ByteConstExpr - ',' WordConstExpr - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$8,$11);} - | PARSEOP_POWERRESOURCE '(' - error ')' {$$ = AslDoError(); yyclearin;} +DefaultTerm + : PARSEOP_DEFAULT '{' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFAULT);} + TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_DEFAULT '{' + error '}' {$$ = AslDoError(); yyclearin;} ; -ProcessorTerm - : PARSEOP_PROCESSOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PROCESSOR);} - NameString - ',' ByteConstExpr - OptionalDWordConstExpr - OptionalByteConstExpr - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($<n>3,5,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8,$11);} - | PARSEOP_PROCESSOR '(' +DerefOfTerm + : PARSEOP_DEREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEREFOF);} + TermArg + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_DEREFOF '(' error ')' {$$ = AslDoError(); yyclearin;} ; -ThermalZoneTerm - : PARSEOP_THERMALZONE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_THERMALZONE);} +DeviceTerm + : PARSEOP_DEVICE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);} NameString ')' '{' ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} - | PARSEOP_THERMALZONE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Namespace modifiers *************************************************/ - - -AliasTerm - : PARSEOP_ALIAS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ALIAS);} - NameString - NameStringItem - ')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));} - | PARSEOP_ALIAS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NameTerm - : PARSEOP_NAME '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAME);} - NameString - ',' DataObject - ')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} - | PARSEOP_NAME '(' + | PARSEOP_DEVICE '(' error ')' {$$ = AslDoError(); yyclearin;} ; -ScopeTerm - : PARSEOP_SCOPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SCOPE);} - NameString - ')' '{' - ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} - | PARSEOP_SCOPE '(' +DivideTerm + : PARSEOP_DIVIDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);} + TermArg + TermArgItem + Target + Target + ')' {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);} + | PARSEOP_DIVIDE '(' error ')' {$$ = AslDoError(); yyclearin;} ; - -/******* Type 1 opcodes *******************************************************/ - - -BreakTerm - : PARSEOP_BREAK {$$ = TrCreateNode (PARSEOP_BREAK, 0);} - ; - -BreakPointTerm - : PARSEOP_BREAKPOINT {$$ = TrCreateNode (PARSEOP_BREAKPOINT, 0);} - ; - -ContinueTerm - : PARSEOP_CONTINUE {$$ = TrCreateNode (PARSEOP_CONTINUE, 0);} - ; - -FatalTerm - : PARSEOP_FATAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FATAL);} - ByteConstExpr - ',' DWordConstExpr - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);} - | PARSEOP_FATAL '(' +EISAIDTerm + : PARSEOP_EISAID '(' + StringData ')' {$$ = TrUpdateNode (PARSEOP_EISAID, $3);} + | PARSEOP_EISAID '(' error ')' {$$ = AslDoError(); yyclearin;} ; -IfElseTerm +ElseIfTerm : IfTerm ElseTerm {$$ = TrLinkPeerNode ($1,$2);} ; -IfTerm - : PARSEOP_IF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IF);} - TermArg - ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - - | PARSEOP_IF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - ElseTerm : {$$ = NULL;} | PARSEOP_ELSE '{' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);} @@ -933,275 +923,117 @@ ElseTerm error {$$ = AslDoError(); yyclearin;} ; -LoadTerm - : PARSEOP_LOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOAD);} +EventTerm + : PARSEOP_EVENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EVENT);} NameString - RequiredTarget - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_LOAD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -NoOpTerm - : PARSEOP_NOOP {$$ = TrCreateNode (PARSEOP_NOOP, 0);} - ; - -NotifyTerm - : PARSEOP_NOTIFY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOTIFY);} - SuperName - TermArgItem - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_NOTIFY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ReleaseTerm - : PARSEOP_RELEASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RELEASE);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_RELEASE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ResetTerm - : PARSEOP_RESET '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RESET);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_RESET '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ReturnTerm - : PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);} - OptionalReturnArg - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));} - | PARSEOP_RETURN '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SignalTerm - : PARSEOP_SIGNAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIGNAL);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_SIGNAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SleepTerm - : PARSEOP_SLEEP '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SLEEP);} - TermArg - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_SLEEP '(' + ')' {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));} + | PARSEOP_EVENT '(' error ')' {$$ = AslDoError(); yyclearin;} ; -StallTerm - : PARSEOP_STALL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STALL);} - TermArg - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_STALL '(' +ExternalTerm + : PARSEOP_EXTERNAL '(' + NameString + OptionalObjectTypeKeyword + OptionalParameterTypePackage + OptionalParameterTypesPackage + ')' {$$ = TrCreateNode (PARSEOP_EXTERNAL,4,$3,$4,$5,$6);} + | PARSEOP_EXTERNAL '(' error ')' {$$ = AslDoError(); yyclearin;} ; -SwitchTerm - : PARSEOP_SWITCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SWITCH);} - TermArg - ')' '{' - CaseDefaultTermList '}' - {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_SWITCH '(' +FatalTerm + : PARSEOP_FATAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FATAL);} + ByteConstExpr + ',' DWordConstExpr + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);} + | PARSEOP_FATAL '(' error ')' {$$ = AslDoError(); yyclearin;} ; -/* - * Case-Default list; allow only one Default term and unlimited Case terms - */ - -CaseDefaultTermList - : {$$ = NULL;} - | CaseTerm {} - | DefaultTerm {} - | CaseDefaultTermList - CaseTerm {$$ = TrLinkPeerNode ($1,$2);} - | CaseDefaultTermList - DefaultTerm {$$ = TrLinkPeerNode ($1,$2);} - -/* Original - attempts to force zero or one default term within the switch */ - -/* -CaseDefaultTermList - : {$$ = NULL;} - | CaseTermList - DefaultTerm - CaseTermList {$$ = TrLinkPeerNode ($1,TrLinkPeerNode ($2, $3));} - | CaseTermList - CaseTerm {$$ = TrLinkPeerNode ($1,$2);} - ; - -CaseTermList - : {$$ = NULL;} - | CaseTerm {} - | CaseTermList - CaseTerm {$$ = TrLinkPeerNode ($1,$2);} - ; -*/ - -CaseTerm - : PARSEOP_CASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CASE);} - DataObject +FieldTerm + : PARSEOP_FIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIELD);} + NameString + ',' AccessTypeKeyword + ',' LockRuleKeyword + ',' UpdateRuleKeyword ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_CASE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DefaultTerm - : PARSEOP_DEFAULT '{' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFAULT);} - TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_DEFAULT '{' - error '}' {$$ = AslDoError(); yyclearin;} - ; - -UnloadTerm - : PARSEOP_UNLOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNLOAD);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_UNLOAD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WhileTerm - : PARSEOP_WHILE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);} - TermArg - ')' '{' TermList '}' - {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_WHILE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Type 2 opcodes *******************************************************/ - -AcquireTerm - : PARSEOP_ACQUIRE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACQUIRE);} - SuperName - ',' WordConstExpr - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$6);} - | PARSEOP_ACQUIRE '(' - error ')' {$$ = AslDoError(); yyclearin;} + FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$6,$8,$10,$13);} + | PARSEOP_FIELD '(' + error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} ; -AddTerm - : PARSEOP_ADD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} +FindSetLeftBitTerm + : PARSEOP_FINDSETLEFTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);} TermArg - TermArgItem Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_ADD '(' + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_FINDSETLEFTBIT '(' error ')' {$$ = AslDoError(); yyclearin;} ; -AndTerm - : PARSEOP_AND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_AND);} +FindSetRightBitTerm + : PARSEOP_FINDSETRIGHTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);} TermArg - TermArgItem Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_AND '(' + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_FINDSETRIGHTBIT '(' error ')' {$$ = AslDoError(); yyclearin;} ; -ConcatTerm - : PARSEOP_CONCATENATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATE);} - TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_CONCATENATE '(' +FprintfTerm + : PARSEOP_FPRINTF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FPRINTF);} + TermArg ',' + StringData + PrintfArgList + ')' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);} + | PARSEOP_FPRINTF '(' error ')' {$$ = AslDoError(); yyclearin;} ; -ConcatResTerm - : PARSEOP_CONCATENATERESTEMPLATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATERESTEMPLATE);} +FromBCDTerm + : PARSEOP_FROMBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FROMBCD);} TermArg - TermArgItem - Target - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$5,$6);} - | PARSEOP_CONCATENATERESTEMPLATE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CondRefOfTerm - : PARSEOP_CONDREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONDREFOF);} - SuperName Target ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_CONDREFOF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -CopyObjectTerm - : PARSEOP_COPYOBJECT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);} - TermArg - ',' SimpleTarget - ')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));} - | PARSEOP_COPYOBJECT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DecTerm - : PARSEOP_DECREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);} - SuperName - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_DECREMENT '(' + | PARSEOP_FROMBCD '(' error ')' {$$ = AslDoError(); yyclearin;} ; -DerefOfTerm - : PARSEOP_DEREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEREFOF);} - TermArg - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_DEREFOF '(' +FunctionTerm + : PARSEOP_FUNCTION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);} + NameString + OptionalParameterTypePackage + OptionalParameterTypesPackage + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION), + TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0), + TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL), + TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),$5,$6,$9);} + | PARSEOP_FUNCTION '(' error ')' {$$ = AslDoError(); yyclearin;} ; -DivideTerm - : PARSEOP_DIVIDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);} +IfTerm + : PARSEOP_IF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IF);} TermArg - TermArgItem - Target - Target - ')' {$$ = TrLinkChildren ($<n>3,4,$4,$5,$6,$7);} - | PARSEOP_DIVIDE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} -FindSetLeftBitTerm - : PARSEOP_FINDSETLEFTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);} - TermArg - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_FINDSETLEFTBIT '(' + | PARSEOP_IF '(' error ')' {$$ = AslDoError(); yyclearin;} ; -FindSetRightBitTerm - : PARSEOP_FINDSETRIGHTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);} - TermArg - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_FINDSETRIGHTBIT '(' - error ')' {$$ = AslDoError(); yyclearin;} +IncludeTerm + : PARSEOP_INCLUDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCLUDE);} + String ')' {TrLinkChildren ($<n>3,1,$4);FlOpenIncludeFile ($4);} + TermList + IncludeEndTerm {$$ = TrLinkPeerNodes (3,$<n>3,$7,$8);} ; -FromBCDTerm - : PARSEOP_FROMBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FROMBCD);} - TermArg - Target - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_FROMBCD '(' - error ')' {$$ = AslDoError(); yyclearin;} +IncludeEndTerm + : PARSEOP_INCLUDE_END {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END);} ; IncTerm @@ -1212,6 +1044,19 @@ IncTerm error ')' {$$ = AslDoError(); yyclearin;} ; +IndexFieldTerm + : PARSEOP_INDEXFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);} + NameString + NameStringItem + ',' AccessTypeKeyword + ',' LockRuleKeyword + ',' UpdateRuleKeyword + ')' '{' + FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,6,$4,$5,$7,$9,$11,$14);} + | PARSEOP_INDEXFIELD '(' + error ')' '{' error '}' {$$ = AslDoError(); yyclearin;} + ; + IndexTerm : PARSEOP_INDEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEX);} TermArg @@ -1240,6 +1085,15 @@ LEqualTerm error ')' {$$ = AslDoError(); yyclearin;} ; +LGreaterEqualTerm + : PARSEOP_LGREATEREQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);} + TermArg + TermArgItem + ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));} + | PARSEOP_LGREATEREQUAL '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + LGreaterTerm : PARSEOP_LGREATER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);} TermArg @@ -1249,12 +1103,12 @@ LGreaterTerm error ')' {$$ = AslDoError(); yyclearin;} ; -LGreaterEqualTerm - : PARSEOP_LGREATEREQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);} +LLessEqualTerm + : PARSEOP_LLESSEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);} TermArg TermArgItem ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));} - | PARSEOP_LGREATEREQUAL '(' + | PARSEOP_LLESSEQUAL '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -1267,12 +1121,12 @@ LLessTerm error ')' {$$ = AslDoError(); yyclearin;} ; -LLessEqualTerm - : PARSEOP_LLESSEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);} +LNotEqualTerm + : PARSEOP_LNOTEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);} TermArg TermArgItem ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));} - | PARSEOP_LLESSEQUAL '(' + | PARSEOP_LNOTEQUAL '(' error ')' {$$ = AslDoError(); yyclearin;} ; @@ -1284,15 +1138,6 @@ LNotTerm error ')' {$$ = AslDoError(); yyclearin;} ; -LNotEqualTerm - : PARSEOP_LNOTEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);} - TermArg - TermArgItem - ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));} - | PARSEOP_LNOTEQUAL '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - LoadTableTerm : PARSEOP_LOADTABLE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOADTABLE);} TermArg @@ -1306,6 +1151,26 @@ LoadTableTerm error ')' {$$ = AslDoError(); yyclearin;} ; +LoadTerm + : PARSEOP_LOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOAD);} + NameString + RequiredTarget + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_LOAD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +LocalTerm + : PARSEOP_LOCAL0 {$$ = TrCreateLeafNode (PARSEOP_LOCAL0);} + | PARSEOP_LOCAL1 {$$ = TrCreateLeafNode (PARSEOP_LOCAL1);} + | PARSEOP_LOCAL2 {$$ = TrCreateLeafNode (PARSEOP_LOCAL2);} + | PARSEOP_LOCAL3 {$$ = TrCreateLeafNode (PARSEOP_LOCAL3);} + | PARSEOP_LOCAL4 {$$ = TrCreateLeafNode (PARSEOP_LOCAL4);} + | PARSEOP_LOCAL5 {$$ = TrCreateLeafNode (PARSEOP_LOCAL5);} + | PARSEOP_LOCAL6 {$$ = TrCreateLeafNode (PARSEOP_LOCAL6);} + | PARSEOP_LOCAL7 {$$ = TrCreateLeafNode (PARSEOP_LOCAL7);} + ; + LOrTerm : PARSEOP_LOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);} TermArg @@ -1328,6 +1193,20 @@ MatchTerm error ')' {$$ = AslDoError(); yyclearin;} ; +MethodTerm + : PARSEOP_METHOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);} + NameString + OptionalByteConstExpr {UtCheckIntegerRange ($5, 0, 7);} + OptionalSerializeRuleKeyword + OptionalByteConstExpr + OptionalParameterTypePackage + OptionalParameterTypesPackage + ')' '{' + TermList '}' {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$5,$7,$8,$9,$10,$13);} + | PARSEOP_METHOD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + MidTerm : PARSEOP_MID '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MID);} TermArg @@ -1359,6 +1238,24 @@ MultiplyTerm error ')' {$$ = AslDoError(); yyclearin;} ; +MutexTerm + : PARSEOP_MUTEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MUTEX);} + NameString + ',' ByteConstExpr + ')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} + | PARSEOP_MUTEX '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +NameTerm + : PARSEOP_NAME '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAME);} + NameString + ',' DataObject + ')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} + | PARSEOP_NAME '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + NAndTerm : PARSEOP_NAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAND);} TermArg @@ -1369,6 +1266,10 @@ NAndTerm error ')' {$$ = AslDoError(); yyclearin;} ; +NoOpTerm + : PARSEOP_NOOP {$$ = TrCreateNode (PARSEOP_NOOP, 0);} + ; + NOrTerm : PARSEOP_NOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOR);} TermArg @@ -1379,6 +1280,15 @@ NOrTerm error ')' {$$ = AslDoError(); yyclearin;} ; +NotifyTerm + : PARSEOP_NOTIFY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOTIFY);} + SuperName + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_NOTIFY '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + NotTerm : PARSEOP_NOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);} TermArg @@ -1396,6 +1306,30 @@ ObjectTypeTerm error ')' {$$ = AslDoError(); yyclearin;} ; +OffsetTerm + : PARSEOP_OFFSET '(' + AmlPackageLengthTerm + ')' {$$ = TrCreateNode (PARSEOP_OFFSET,1,$3);} + | PARSEOP_OFFSET '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +OpRegionTerm + : PARSEOP_OPERATIONREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);} + NameString + ',' OpRegionSpaceIdTerm + TermArgItem + TermArgItem + ')' {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8);} + | PARSEOP_OPERATIONREGION '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +OpRegionSpaceIdTerm + : RegionSpaceKeyword {} + | ByteConst {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} + ; + OrTerm : PARSEOP_OR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OR);} TermArg @@ -1406,6 +1340,63 @@ OrTerm error ')' {$$ = AslDoError(); yyclearin;} ; +PackageTerm + : PARSEOP_PACKAGE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);} + VarPackageLengthTerm + ')' '{' + PackageList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_PACKAGE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +PowerResTerm + : PARSEOP_POWERRESOURCE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);} + NameString + ',' ByteConstExpr + ',' WordConstExpr + ')' '{' + ObjectList '}' {$$ = TrLinkChildren ($<n>3,4,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$8,$11);} + | PARSEOP_POWERRESOURCE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +PrintfTerm + : PARSEOP_PRINTF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PRINTF);} + StringData + PrintfArgList + ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} + | PARSEOP_PRINTF '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +PrintfArgList + : {$$ = NULL;} + | TermArg {$$ = $1;} + | PrintfArgList ',' + TermArg {$$ = TrLinkPeerNode ($1, $3);} + ; + +ProcessorTerm + : PARSEOP_PROCESSOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PROCESSOR);} + NameString + ',' ByteConstExpr + OptionalDWordConstExpr + OptionalByteConstExpr + ')' '{' + ObjectList '}' {$$ = TrLinkChildren ($<n>3,5,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6,$7,$8,$11);} + | PARSEOP_PROCESSOR '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +RawDataBufferTerm + : PARSEOP_DATABUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DATABUFFER);} + OptionalWordConst + ')' '{' + ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_DATABUFFER '(' + error ')' {$$ = 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.) @@ -1418,6 +1409,40 @@ RefOfTerm error ')' {$$ = AslDoError(); yyclearin;} ; +ReleaseTerm + : PARSEOP_RELEASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RELEASE);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_RELEASE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ResetTerm + : PARSEOP_RESET '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RESET);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_RESET '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ReturnTerm + : PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);} + OptionalReturnArg + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN));} + | PARSEOP_RETURN '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ScopeTerm + : PARSEOP_SCOPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SCOPE);} + NameString + ')' '{' + ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} + | PARSEOP_SCOPE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + ShiftLeftTerm : PARSEOP_SHIFTLEFT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} TermArg @@ -1438,6 +1463,14 @@ ShiftRightTerm error ')' {$$ = AslDoError(); yyclearin;} ; +SignalTerm + : PARSEOP_SIGNAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIGNAL);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_SIGNAL '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + SizeOfTerm : PARSEOP_SIZEOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIZEOF);} SuperName @@ -1446,6 +1479,22 @@ SizeOfTerm error ')' {$$ = AslDoError(); yyclearin;} ; +SleepTerm + : PARSEOP_SLEEP '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SLEEP);} + TermArg + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_SLEEP '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +StallTerm + : PARSEOP_STALL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STALL);} + TermArg + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_STALL '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + StoreTerm : PARSEOP_STORE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STORE);} TermArg @@ -1464,6 +1513,24 @@ SubtractTerm | PARSEOP_SUBTRACT '(' error ')' {$$ = AslDoError(); yyclearin;} ; +SwitchTerm + : PARSEOP_SWITCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SWITCH);} + TermArg + ')' '{' + CaseDefaultTermList '}' + {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_SWITCH '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +ThermalZoneTerm + : PARSEOP_THERMALZONE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_THERMALZONE);} + NameString + ')' '{' + ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} + | PARSEOP_THERMALZONE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; TimerTerm : PARSEOP_TIMER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TIMER);} @@ -1518,35 +1585,12 @@ ToIntegerTerm error ')' {$$ = AslDoError(); yyclearin;} ; -PldKeyword - : PARSEOP_PLD_REVISION {$$ = TrCreateLeafNode (PARSEOP_PLD_REVISION);} - | PARSEOP_PLD_IGNORECOLOR {$$ = TrCreateLeafNode (PARSEOP_PLD_IGNORECOLOR);} - | PARSEOP_PLD_RED {$$ = TrCreateLeafNode (PARSEOP_PLD_RED);} - | PARSEOP_PLD_GREEN {$$ = TrCreateLeafNode (PARSEOP_PLD_GREEN);} - | PARSEOP_PLD_BLUE {$$ = TrCreateLeafNode (PARSEOP_PLD_BLUE);} - | PARSEOP_PLD_WIDTH {$$ = TrCreateLeafNode (PARSEOP_PLD_WIDTH);} - | PARSEOP_PLD_HEIGHT {$$ = TrCreateLeafNode (PARSEOP_PLD_HEIGHT);} - | PARSEOP_PLD_USERVISIBLE {$$ = TrCreateLeafNode (PARSEOP_PLD_USERVISIBLE);} - | PARSEOP_PLD_DOCK {$$ = TrCreateLeafNode (PARSEOP_PLD_DOCK);} - | PARSEOP_PLD_LID {$$ = TrCreateLeafNode (PARSEOP_PLD_LID);} - | PARSEOP_PLD_PANEL {$$ = TrCreateLeafNode (PARSEOP_PLD_PANEL);} - | PARSEOP_PLD_VERTICALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALPOSITION);} - | PARSEOP_PLD_HORIZONTALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALPOSITION);} - | PARSEOP_PLD_SHAPE {$$ = TrCreateLeafNode (PARSEOP_PLD_SHAPE);} - | PARSEOP_PLD_GROUPORIENTATION {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPORIENTATION);} - | PARSEOP_PLD_GROUPTOKEN {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPTOKEN);} - | PARSEOP_PLD_GROUPPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPPOSITION);} - | PARSEOP_PLD_BAY {$$ = TrCreateLeafNode (PARSEOP_PLD_BAY);} - | PARSEOP_PLD_EJECTABLE {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTABLE);} - | PARSEOP_PLD_EJECTREQUIRED {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTREQUIRED);} - | PARSEOP_PLD_CABINETNUMBER {$$ = TrCreateLeafNode (PARSEOP_PLD_CABINETNUMBER);} - | PARSEOP_PLD_CARDCAGENUMBER {$$ = TrCreateLeafNode (PARSEOP_PLD_CARDCAGENUMBER);} - | PARSEOP_PLD_REFERENCE {$$ = TrCreateLeafNode (PARSEOP_PLD_REFERENCE);} - | PARSEOP_PLD_ROTATION {$$ = TrCreateLeafNode (PARSEOP_PLD_ROTATION);} - | PARSEOP_PLD_ORDER {$$ = TrCreateLeafNode (PARSEOP_PLD_ORDER);} - | PARSEOP_PLD_RESERVED {$$ = TrCreateLeafNode (PARSEOP_PLD_RESERVED);} - | PARSEOP_PLD_VERTICALOFFSET {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALOFFSET);} - | PARSEOP_PLD_HORIZONTALOFFSET {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALOFFSET);} +ToPLDTerm + : PARSEOP_TOPLD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOPLD);} + PldKeywordList + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_TOPLD '(' + error ')' {$$ = AslDoError(); yyclearin;} ; PldKeywordList @@ -1564,39 +1608,6 @@ PldKeywordList PARSEOP_EXP_EQUALS String {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));} ; -ToPLDTerm - : PARSEOP_TOPLD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOPLD);} - PldKeywordList - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_TOPLD '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -PrintfArgList - : {$$ = NULL;} - | TermArg {$$ = $1;} - | PrintfArgList ',' - TermArg {$$ = TrLinkPeerNode ($1, $3);} - ; - -PrintfTerm - : PARSEOP_PRINTF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PRINTF);} - StringData - PrintfArgList - ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} - | PARSEOP_PRINTF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FprintfTerm - : PARSEOP_FPRINTF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FPRINTF);} - TermArg ',' - StringData - PrintfArgList - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);} - | PARSEOP_FPRINTF '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; ToStringTerm : PARSEOP_TOSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);} @@ -1615,6 +1626,22 @@ ToUUIDTerm error ')' {$$ = AslDoError(); yyclearin;} ; +UnicodeTerm + : PARSEOP_UNICODE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNICODE);} + StringData + ')' {$$ = TrLinkChildren ($<n>3,2,0,$4);} + | PARSEOP_UNICODE '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + +UnloadTerm + : PARSEOP_UNLOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNLOAD);} + SuperName + ')' {$$ = TrLinkChildren ($<n>3,1,$4);} + | PARSEOP_UNLOAD '(' + error ')' {$$ = AslDoError(); yyclearin;} + ; + WaitTerm : PARSEOP_WAIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WAIT);} SuperName @@ -1634,1105 +1661,21 @@ XOrTerm error ')' {$$ = AslDoError(); yyclearin;} ; - -/******* Keywords *************************************************************/ - - -AccessAttribKeyword - : PARSEOP_ACCESSATTRIB_BLOCK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK);} - | PARSEOP_ACCESSATTRIB_BLOCK_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BLOCK_CALL);} - | PARSEOP_ACCESSATTRIB_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_BYTE);} - | PARSEOP_ACCESSATTRIB_QUICK {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_QUICK );} - | PARSEOP_ACCESSATTRIB_SND_RCV {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_SND_RCV);} - | PARSEOP_ACCESSATTRIB_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD);} - | PARSEOP_ACCESSATTRIB_WORD_CALL {$$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_WORD_CALL);} - | PARSEOP_ACCESSATTRIB_MULTIBYTE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_MULTIBYTE);} - ByteConst - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_ACCESSATTRIB_RAW_BYTES '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_BYTES);} - ByteConst - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - | PARSEOP_ACCESSATTRIB_RAW_PROCESS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACCESSATTRIB_RAW_PROCESS);} - ByteConst - ')' {$$ = TrLinkChildren ($<n>3,1,$4);} - ; - -AccessTypeKeyword - : PARSEOP_ACCESSTYPE_ANY {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_ANY);} - | PARSEOP_ACCESSTYPE_BYTE {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BYTE);} - | PARSEOP_ACCESSTYPE_WORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_WORD);} - | PARSEOP_ACCESSTYPE_DWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_DWORD);} - | PARSEOP_ACCESSTYPE_QWORD {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_QWORD);} - | PARSEOP_ACCESSTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_ACCESSTYPE_BUF);} - ; - -AddressingModeKeyword - : PARSEOP_ADDRESSINGMODE_7BIT {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_7BIT);} - | PARSEOP_ADDRESSINGMODE_10BIT {$$ = TrCreateLeafNode (PARSEOP_ADDRESSINGMODE_10BIT);} - ; - -AddressKeyword - : PARSEOP_ADDRESSTYPE_MEMORY {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_MEMORY);} - | PARSEOP_ADDRESSTYPE_RESERVED {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_RESERVED);} - | PARSEOP_ADDRESSTYPE_NVS {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_NVS);} - | PARSEOP_ADDRESSTYPE_ACPI {$$ = TrCreateLeafNode (PARSEOP_ADDRESSTYPE_ACPI);} - ; - -AddressSpaceKeyword - : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);} - | RegionSpaceKeyword {} - ; - -BitsPerByteKeyword - : PARSEOP_BITSPERBYTE_FIVE {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_FIVE);} - | PARSEOP_BITSPERBYTE_SIX {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SIX);} - | PARSEOP_BITSPERBYTE_SEVEN {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_SEVEN);} - | PARSEOP_BITSPERBYTE_EIGHT {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_EIGHT);} - | PARSEOP_BITSPERBYTE_NINE {$$ = TrCreateLeafNode (PARSEOP_BITSPERBYTE_NINE);} - ; - -ClockPhaseKeyword - : PARSEOP_CLOCKPHASE_FIRST {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_FIRST);} - | PARSEOP_CLOCKPHASE_SECOND {$$ = TrCreateLeafNode (PARSEOP_CLOCKPHASE_SECOND);} - ; - -ClockPolarityKeyword - : PARSEOP_CLOCKPOLARITY_LOW {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_LOW);} - | PARSEOP_CLOCKPOLARITY_HIGH {$$ = TrCreateLeafNode (PARSEOP_CLOCKPOLARITY_HIGH);} - ; - -DecodeKeyword - : PARSEOP_DECODETYPE_POS {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_POS);} - | PARSEOP_DECODETYPE_SUB {$$ = TrCreateLeafNode (PARSEOP_DECODETYPE_SUB);} - ; - -DevicePolarityKeyword - : PARSEOP_DEVICEPOLARITY_LOW {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_LOW);} - | PARSEOP_DEVICEPOLARITY_HIGH {$$ = TrCreateLeafNode (PARSEOP_DEVICEPOLARITY_HIGH);} - ; - -DMATypeKeyword - : PARSEOP_DMATYPE_A {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_A);} - | PARSEOP_DMATYPE_COMPATIBILITY {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_COMPATIBILITY);} - | PARSEOP_DMATYPE_B {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_B);} - | PARSEOP_DMATYPE_F {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);} - ; - -EndianKeyword - : PARSEOP_ENDIAN_LITTLE {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_LITTLE);} - | PARSEOP_ENDIAN_BIG {$$ = TrCreateLeafNode (PARSEOP_ENDIAN_BIG);} - ; - -FlowControlKeyword - : PARSEOP_FLOWCONTROL_HW {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_HW);} - | PARSEOP_FLOWCONTROL_NONE {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_NONE);} - | PARSEOP_FLOWCONTROL_SW {$$ = TrCreateLeafNode (PARSEOP_FLOWCONTROL_SW);} - ; - -InterruptLevel - : PARSEOP_INTLEVEL_ACTIVEBOTH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEBOTH);} - | PARSEOP_INTLEVEL_ACTIVEHIGH {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVEHIGH);} - | PARSEOP_INTLEVEL_ACTIVELOW {$$ = TrCreateLeafNode (PARSEOP_INTLEVEL_ACTIVELOW);} - ; - -InterruptTypeKeyword - : PARSEOP_INTTYPE_EDGE {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_EDGE);} - | PARSEOP_INTTYPE_LEVEL {$$ = TrCreateLeafNode (PARSEOP_INTTYPE_LEVEL);} - ; - -IODecodeKeyword - : PARSEOP_IODECODETYPE_16 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_16);} - | PARSEOP_IODECODETYPE_10 {$$ = TrCreateLeafNode (PARSEOP_IODECODETYPE_10);} - ; - -IoRestrictionKeyword - : PARSEOP_IORESTRICT_IN {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_IN);} - | PARSEOP_IORESTRICT_OUT {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_OUT);} - | PARSEOP_IORESTRICT_NONE {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_NONE);} - | PARSEOP_IORESTRICT_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_IORESTRICT_PRESERVE);} - ; - -LockRuleKeyword - : PARSEOP_LOCKRULE_LOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_LOCK);} - | PARSEOP_LOCKRULE_NOLOCK {$$ = TrCreateLeafNode (PARSEOP_LOCKRULE_NOLOCK);} - ; - -MatchOpKeyword - : PARSEOP_MATCHTYPE_MTR {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MTR);} - | PARSEOP_MATCHTYPE_MEQ {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ);} - | PARSEOP_MATCHTYPE_MLE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLE);} - | PARSEOP_MATCHTYPE_MLT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MLT);} - | PARSEOP_MATCHTYPE_MGE {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGE);} - | PARSEOP_MATCHTYPE_MGT {$$ = TrCreateLeafNode (PARSEOP_MATCHTYPE_MGT);} - ; - -MaxKeyword - : PARSEOP_MAXTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_FIXED);} - | PARSEOP_MAXTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MAXTYPE_NOTFIXED);} - ; - -MemTypeKeyword - : PARSEOP_MEMTYPE_CACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_CACHEABLE);} - | PARSEOP_MEMTYPE_WRITECOMBINING {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_WRITECOMBINING);} - | PARSEOP_MEMTYPE_PREFETCHABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_PREFETCHABLE);} - | PARSEOP_MEMTYPE_NONCACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);} - ; - -MinKeyword - : PARSEOP_MINTYPE_FIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_FIXED);} - | PARSEOP_MINTYPE_NOTFIXED {$$ = TrCreateLeafNode (PARSEOP_MINTYPE_NOTFIXED);} - ; - -ObjectTypeKeyword - : PARSEOP_OBJECTTYPE_UNK {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} - | PARSEOP_OBJECTTYPE_INT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_INT);} - | PARSEOP_OBJECTTYPE_STR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_STR);} - | PARSEOP_OBJECTTYPE_BUF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BUF);} - | PARSEOP_OBJECTTYPE_PKG {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PKG);} - | PARSEOP_OBJECTTYPE_FLD {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_FLD);} - | PARSEOP_OBJECTTYPE_DEV {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DEV);} - | PARSEOP_OBJECTTYPE_EVT {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_EVT);} - | PARSEOP_OBJECTTYPE_MTH {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTH);} - | PARSEOP_OBJECTTYPE_MTX {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);} - | PARSEOP_OBJECTTYPE_OPR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);} - | PARSEOP_OBJECTTYPE_POW {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);} - | PARSEOP_OBJECTTYPE_PRO {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PRO);} - | PARSEOP_OBJECTTYPE_THZ {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);} - | PARSEOP_OBJECTTYPE_BFF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);} - | PARSEOP_OBJECTTYPE_DDB {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);} - ; - -ParityTypeKeyword - : PARSEOP_PARITYTYPE_SPACE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_SPACE);} - | PARSEOP_PARITYTYPE_MARK {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_MARK);} - | PARSEOP_PARITYTYPE_ODD {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_ODD);} - | PARSEOP_PARITYTYPE_EVEN {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_EVEN);} - | PARSEOP_PARITYTYPE_NONE {$$ = TrCreateLeafNode (PARSEOP_PARITYTYPE_NONE);} - ; - -PinConfigByte - : PinConfigKeyword {$$ = $1;} - | ByteConstExpr {$$ = UtCheckIntegerRange ($1, 0x80, 0xFF);} - ; - -PinConfigKeyword - : PARSEOP_PIN_NOPULL {$$ = TrCreateLeafNode (PARSEOP_PIN_NOPULL);} - | PARSEOP_PIN_PULLDOWN {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDOWN);} - | PARSEOP_PIN_PULLUP {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLUP);} - | PARSEOP_PIN_PULLDEFAULT {$$ = TrCreateLeafNode (PARSEOP_PIN_PULLDEFAULT);} - ; - -RangeTypeKeyword - : PARSEOP_RANGETYPE_ISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ISAONLY);} - | PARSEOP_RANGETYPE_NONISAONLY {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_NONISAONLY);} - | PARSEOP_RANGETYPE_ENTIRE {$$ = TrCreateLeafNode (PARSEOP_RANGETYPE_ENTIRE);} - ; - -RegionSpaceKeyword - : PARSEOP_REGIONSPACE_IO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IO);} - | PARSEOP_REGIONSPACE_MEM {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_MEM);} - | PARSEOP_REGIONSPACE_PCI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCI);} - | PARSEOP_REGIONSPACE_EC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_EC);} - | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);} - | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);} - | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);} - | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);} - | PARSEOP_REGIONSPACE_GPIO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GPIO);} - | PARSEOP_REGIONSPACE_GSBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GSBUS);} - | PARSEOP_REGIONSPACE_PCC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCC);} - | PARSEOP_REGIONSPACE_FFIXEDHW {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_FFIXEDHW);} - ; - -ResourceTypeKeyword - : PARSEOP_RESOURCETYPE_CONSUMER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} - | PARSEOP_RESOURCETYPE_PRODUCER {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_PRODUCER);} - ; - -SerializeRuleKeyword - : PARSEOP_SERIALIZERULE_SERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_SERIAL);} - | PARSEOP_SERIALIZERULE_NOTSERIAL {$$ = TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL);} - ; - -ShareTypeKeyword - : PARSEOP_SHARETYPE_SHARED {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHARED);} - | PARSEOP_SHARETYPE_EXCLUSIVE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVE);} - | PARSEOP_SHARETYPE_SHAREDWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_SHAREDWAKE);} - | PARSEOP_SHARETYPE_EXCLUSIVEWAKE {$$ = TrCreateLeafNode (PARSEOP_SHARETYPE_EXCLUSIVEWAKE);} - ; - -SlaveModeKeyword - : PARSEOP_SLAVEMODE_CONTROLLERINIT {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_CONTROLLERINIT);} - | PARSEOP_SLAVEMODE_DEVICEINIT {$$ = TrCreateLeafNode (PARSEOP_SLAVEMODE_DEVICEINIT);} - ; - -StopBitsKeyword - : PARSEOP_STOPBITS_TWO {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_TWO);} - | PARSEOP_STOPBITS_ONEPLUSHALF {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONEPLUSHALF);} - | PARSEOP_STOPBITS_ONE {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ONE);} - | PARSEOP_STOPBITS_ZERO {$$ = TrCreateLeafNode (PARSEOP_STOPBITS_ZERO);} - ; - -TranslationKeyword - : PARSEOP_TRANSLATIONTYPE_SPARSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_SPARSE);} - | PARSEOP_TRANSLATIONTYPE_DENSE {$$ = TrCreateLeafNode (PARSEOP_TRANSLATIONTYPE_DENSE);} - ; - -TypeKeyword - : PARSEOP_TYPE_TRANSLATION {$$ = TrCreateLeafNode (PARSEOP_TYPE_TRANSLATION);} - | PARSEOP_TYPE_STATIC {$$ = TrCreateLeafNode (PARSEOP_TYPE_STATIC);} - ; - -UpdateRuleKeyword - : PARSEOP_UPDATERULE_PRESERVE {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_PRESERVE);} - | PARSEOP_UPDATERULE_ONES {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ONES);} - | PARSEOP_UPDATERULE_ZEROS {$$ = TrCreateLeafNode (PARSEOP_UPDATERULE_ZEROS);} - ; - -WireModeKeyword - : PARSEOP_WIREMODE_FOUR {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_FOUR);} - | PARSEOP_WIREMODE_THREE {$$ = TrCreateLeafNode (PARSEOP_WIREMODE_THREE);} - ; - -XferSizeKeyword - : PARSEOP_XFERSIZE_8 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_8, 0);} - | PARSEOP_XFERSIZE_16 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_16, 1);} - | PARSEOP_XFERSIZE_32 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} - | PARSEOP_XFERSIZE_64 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_64, 3);} - | PARSEOP_XFERSIZE_128 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_128, 4);} - | PARSEOP_XFERSIZE_256 {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_256, 5);} - ; - -XferTypeKeyword - : PARSEOP_XFERTYPE_8 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8);} - | PARSEOP_XFERTYPE_8_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8_16);} - | PARSEOP_XFERTYPE_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_16);} - ; - - -/******* Miscellaneous Types **************************************************/ - - -SuperName - : NameString {} - | ArgTerm {} - | LocalTerm {} - | DebugTerm {} - | Type6Opcode {} - -/* For ObjectType: SuperName except for MethodInvocationTerm */ - -ObjectTypeName - : NameString {} - | ArgTerm {} - | LocalTerm {} - | DebugTerm {} - | RefOfTerm {} - | DerefOfTerm {} - | IndexTerm {} - -/* | MethodInvocationTerm {} */ /* Caused reduce/reduce with Type6Opcode->MethodInvocationTerm */ - ; - -ArgTerm - : PARSEOP_ARG0 {$$ = TrCreateLeafNode (PARSEOP_ARG0);} - | PARSEOP_ARG1 {$$ = TrCreateLeafNode (PARSEOP_ARG1);} - | PARSEOP_ARG2 {$$ = TrCreateLeafNode (PARSEOP_ARG2);} - | PARSEOP_ARG3 {$$ = TrCreateLeafNode (PARSEOP_ARG3);} - | PARSEOP_ARG4 {$$ = TrCreateLeafNode (PARSEOP_ARG4);} - | PARSEOP_ARG5 {$$ = TrCreateLeafNode (PARSEOP_ARG5);} - | PARSEOP_ARG6 {$$ = TrCreateLeafNode (PARSEOP_ARG6);} - ; - -LocalTerm - : PARSEOP_LOCAL0 {$$ = TrCreateLeafNode (PARSEOP_LOCAL0);} - | PARSEOP_LOCAL1 {$$ = TrCreateLeafNode (PARSEOP_LOCAL1);} - | PARSEOP_LOCAL2 {$$ = TrCreateLeafNode (PARSEOP_LOCAL2);} - | PARSEOP_LOCAL3 {$$ = TrCreateLeafNode (PARSEOP_LOCAL3);} - | PARSEOP_LOCAL4 {$$ = TrCreateLeafNode (PARSEOP_LOCAL4);} - | PARSEOP_LOCAL5 {$$ = TrCreateLeafNode (PARSEOP_LOCAL5);} - | PARSEOP_LOCAL6 {$$ = TrCreateLeafNode (PARSEOP_LOCAL6);} - | PARSEOP_LOCAL7 {$$ = TrCreateLeafNode (PARSEOP_LOCAL7);} - ; - -DebugTerm - : PARSEOP_DEBUG {$$ = TrCreateLeafNode (PARSEOP_DEBUG);} - ; - - -ByteConst - : Integer {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} - ; - -WordConst - : Integer {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} - ; - -DWordConst - : Integer {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} - ; - -QWordConst - : Integer {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} - ; - -Integer - : PARSEOP_INTEGER {$$ = TrCreateValuedLeafNode (PARSEOP_INTEGER, AslCompilerlval.i);} - ; - -String - : PARSEOP_STRING_LITERAL {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, (ACPI_NATIVE_INT) AslCompilerlval.s);} - ; - -ConstTerm - : ConstExprTerm {} - | PARSEOP_REVISION {$$ = TrCreateLeafNode (PARSEOP_REVISION);} - ; - -ConstExprTerm - : PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);} - | PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);} - | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);} - | PARSEOP___DATE__ {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);} - | PARSEOP___FILE__ {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);} - | PARSEOP___LINE__ {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);} - | PARSEOP___PATH__ {$$ = TrCreateConstantLeafNode (PARSEOP___PATH__);} - ; - -/* - * The NODE_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 {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);} - | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 1);} - | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_BYTECONST, $1);} - | ByteConst {} - ; - -WordConstExpr - : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);} - | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 2);} - | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_WORDCONST, $1);} - | WordConst {} - ; - -DWordConstExpr - : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);} - | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 4);} - | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_DWORDCONST, $1);} - | DWordConst {} - ; - -QWordConstExpr - : Type3Opcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);} - | Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_COMPILE_TIME_CONST); TrSetNodeAmlLength ($1, 8);} - | ConstExprTerm {$$ = TrUpdateNode (PARSEOP_QWORDCONST, $1);} - | QWordConst {} - ; - -/* OptionalCount must appear before ByteList or an incorrect reduction will result */ - -OptionalCount - : {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */ - | ',' {$$ = TrCreateLeafNode (PARSEOP_ONES);} /* Placeholder is a OnesOp object */ - | ',' TermArg {$$ = $2;} - ; - -BufferTerm - : PARSEOP_BUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BUFFER);} - OptionalTermArg - ')' '{' - BufferTermData '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_BUFFER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -BufferTermData - : ByteList {} - | StringData {} - ; - -ByteList - : {$$ = NULL;} - | ByteConstExpr - | ByteList ',' /* Allows a trailing comma at list end */ - | ByteList ',' - ByteConstExpr {$$ = TrLinkPeerNode ($1,$3);} - ; - -DataBufferTerm - : PARSEOP_DATABUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DATABUFFER);} - OptionalWordConst - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_DATABUFFER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DWordList - : {$$ = NULL;} - | DWordConstExpr - | DWordList ',' /* Allows a trailing comma at list end */ - | DWordList ',' - DWordConstExpr {$$ = TrLinkPeerNode ($1,$3);} - ; - -PackageTerm - : PARSEOP_PACKAGE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);} - VarPackageLengthTerm - ')' '{' - PackageList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_PACKAGE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -PackageList - : {$$ = NULL;} - | PackageElement - | PackageList ',' /* Allows a trailing comma at list end */ - | PackageList ',' - PackageElement {$$ = TrLinkPeerNode ($1,$3);} - ; - -PackageElement - : DataObject {} - | NameString {} - ; - -VarPackageLengthTerm - : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);} - | TermArg {$$ = $1;} - ; - - -/******* Macros ***********************************************/ - - -EISAIDTerm - : PARSEOP_EISAID '(' - StringData ')' {$$ = TrUpdateNode (PARSEOP_EISAID, $3);} - | PARSEOP_EISAID '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -UnicodeTerm - : PARSEOP_UNICODE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNICODE);} - StringData - ')' {$$ = TrLinkChildren ($<n>3,2,0,$4);} - | PARSEOP_UNICODE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -/******* Resources and Memory ***********************************************/ - - -/* - * 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 '(' ')' - '{' - ResourceMacroList '}' {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,4, - TrCreateLeafNode (PARSEOP_DEFAULT_ARG), - TrCreateLeafNode (PARSEOP_DEFAULT_ARG), - $5, - TrCreateLeafNode (PARSEOP_ENDTAG));} - ; - -ResourceMacroList - : {$$ = NULL;} - | ResourceMacroList - ResourceMacroTerm {$$ = TrLinkPeerNode ($1,$2);} - ; - -ResourceMacroTerm - : DMATerm {} - | DWordIOTerm {} - | DWordMemoryTerm {} - | DWordSpaceTerm {} - | EndDependentFnTerm {} - | ExtendedIOTerm {} - | ExtendedMemoryTerm {} - | ExtendedSpaceTerm {} - | FixedDmaTerm {} - | FixedIOTerm {} - | GpioIntTerm {} - | GpioIoTerm {} - | I2cSerialBusTerm {} - | InterruptTerm {} - | IOTerm {} - | IRQNoFlagsTerm {} - | IRQTerm {} - | Memory24Term {} - | Memory32FixedTerm {} - | Memory32Term {} - | QWordIOTerm {} - | QWordMemoryTerm {} - | QWordSpaceTerm {} - | RegisterTerm {} - | SpiSerialBusTerm {} - | StartDependentFnNoPriTerm {} - | StartDependentFnTerm {} - | UartSerialBusTerm {} - | VendorLongTerm {} - | VendorShortTerm {} - | WordBusNumberTerm {} - | WordIOTerm {} - | WordSpaceTerm {} - ; - -DMATerm - : PARSEOP_DMA '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DMA);} - DMATypeKeyword - OptionalBusMasterKeyword - ',' XferTypeKeyword - OptionalNameString_Last - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$5,$7,$8,$11);} - | PARSEOP_DMA '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DWordIOTerm - : PARSEOP_DWORDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDIO);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - OptionalRangeType - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalType - OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} - | PARSEOP_DWORDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DWordMemoryTerm - : PARSEOP_DWORDMEMORY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDMEMORY);} - OptionalResourceType_First - OptionalDecodeType - OptionalMinType - OptionalMaxType - OptionalMemType - ',' OptionalReadWriteKeyword - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalAddressRange - OptionalType_Last - ')' {$$ = TrLinkChildren ($<n>3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} - | PARSEOP_DWORDMEMORY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -DWordSpaceTerm - : PARSEOP_DWORDSPACE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDSPACE);} - ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} - OptionalResourceType - OptionalDecodeType - OptionalMinType - OptionalMaxType - ',' ByteConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} - | PARSEOP_DWORDSPACE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - - -EndDependentFnTerm - : PARSEOP_ENDDEPENDENTFN '(' - ')' {$$ = TrCreateLeafNode (PARSEOP_ENDDEPENDENTFN);} - | PARSEOP_ENDDEPENDENTFN '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ExtendedIOTerm - : PARSEOP_EXTENDEDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDIO);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - OptionalRangeType - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalQWordConstExpr - OptionalNameString - OptionalType - OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22);} - | PARSEOP_EXTENDEDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ExtendedMemoryTerm - : PARSEOP_EXTENDEDMEMORY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDMEMORY);} - OptionalResourceType_First - OptionalDecodeType - OptionalMinType - OptionalMaxType - OptionalMemType - ',' OptionalReadWriteKeyword - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalQWordConstExpr - OptionalNameString - OptionalAddressRange - OptionalType_Last - ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24);} - | PARSEOP_EXTENDEDMEMORY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -ExtendedSpaceTerm - : PARSEOP_EXTENDEDSPACE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDSPACE);} - ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} - OptionalResourceType - OptionalDecodeType - OptionalMinType - OptionalMaxType - ',' ByteConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalQWordConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,13,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23);} - | PARSEOP_EXTENDEDSPACE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FixedDmaTerm - : PARSEOP_FIXEDDMA '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDDMA);} - WordConstExpr /* 04: DMA RequestLines */ - ',' WordConstExpr /* 06: DMA Channels */ - OptionalXferSize /* 07: DMA TransferSize */ - OptionalNameString /* 08: DescriptorName */ - ')' {$$ = TrLinkChildren ($<n>3,4,$4,$6,$7,$8);} - | PARSEOP_FIXEDDMA '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -FixedIOTerm - : PARSEOP_FIXEDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDIO);} - WordConstExpr - ',' ByteConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);} - | PARSEOP_FIXEDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -GpioIntTerm - : PARSEOP_GPIO_INT '(' {$<n>$ = TrCreateLeafNode (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 */ - ')' '{' - DWordConstExpr '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$9,$10,$12,$13,$14,$15,$16,$19);} - | PARSEOP_GPIO_INT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -GpioIoTerm - : PARSEOP_GPIO_IO '(' {$<n>$ = TrCreateLeafNode (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 */ - ')' '{' - DWordList '}' {$$ = TrLinkChildren ($<n>3,11,$4,$6,$7,$8,$9,$11,$12,$13,$14,$15,$18);} - | PARSEOP_GPIO_IO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -I2cSerialBusTerm - : PARSEOP_I2C_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (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 */ - ')' {$$ = TrLinkChildren ($<n>3,9,$4,$5,$7,$8,$10,$11,$12,$13,$14);} - | PARSEOP_I2C_SERIALBUS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -InterruptTerm - : PARSEOP_INTERRUPT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INTERRUPT);} - OptionalResourceType_First - ',' InterruptTypeKeyword - ',' InterruptLevel - OptionalShareType - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' '{' - DWordList '}' {$$ = TrLinkChildren ($<n>3,8,$4,$6,$8,$9,$10,$11,$12,$15);} - | PARSEOP_INTERRUPT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IOTerm - : PARSEOP_IO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IO);} - IODecodeKeyword - ',' WordConstExpr - ',' WordConstExpr - ',' ByteConstExpr - ',' ByteConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);} - | PARSEOP_IO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IRQNoFlagsTerm - : PARSEOP_IRQNOFLAGS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IRQNOFLAGS);} - OptionalNameString_First - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_IRQNOFLAGS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -IRQTerm - : PARSEOP_IRQ '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IRQ);} - InterruptTypeKeyword - ',' InterruptLevel - OptionalShareType - OptionalNameString_Last - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$6,$7,$8,$11);} - | PARSEOP_IRQ '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -Memory24Term - : PARSEOP_MEMORY24 '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY24);} - OptionalReadWriteKeyword - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);} - | PARSEOP_MEMORY24 '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -Memory32FixedTerm - : PARSEOP_MEMORY32FIXED '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY32FIXED);} - OptionalReadWriteKeyword - ',' DWordConstExpr - ',' DWordConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,4,$4,$6,$8,$9);} - | PARSEOP_MEMORY32FIXED '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -Memory32Term - : PARSEOP_MEMORY32 '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY32);} - OptionalReadWriteKeyword - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - ',' DWordConstExpr - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$12,$13);} - | PARSEOP_MEMORY32 '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -QWordIOTerm - : PARSEOP_QWORDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDIO);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - OptionalRangeType - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalType - OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} - | PARSEOP_QWORDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -QWordMemoryTerm - : PARSEOP_QWORDMEMORY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDMEMORY);} - OptionalResourceType_First - OptionalDecodeType - OptionalMinType - OptionalMaxType - OptionalMemType - ',' OptionalReadWriteKeyword - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalAddressRange - OptionalType_Last - ')' {$$ = TrLinkChildren ($<n>3,16,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$20,$21,$22,$23,$24,$25);} - | PARSEOP_QWORDMEMORY '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -QWordSpaceTerm - : PARSEOP_QWORDSPACE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDSPACE);} - ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} - OptionalResourceType - OptionalDecodeType - OptionalMinType - OptionalMaxType - ',' ByteConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - ',' QWordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} - | PARSEOP_QWORDSPACE '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -RegisterTerm - : PARSEOP_REGISTER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_REGISTER);} - AddressSpaceKeyword - ',' ByteConstExpr - ',' ByteConstExpr - ',' QWordConstExpr - OptionalAccessSize - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$11,$12);} - | PARSEOP_REGISTER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -SpiSerialBusTerm - : PARSEOP_SPI_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (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 */ - ')' {$$ = TrLinkChildren ($<n>3,13,$4,$5,$6,$8,$9,$11,$13,$15,$17,$18,$19,$20,$21);} - | PARSEOP_SPI_SERIALBUS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -StartDependentFnNoPriTerm - : PARSEOP_STARTDEPENDENTFN_NOPRI '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN_NOPRI);} - ')' '{' - ResourceMacroList '}' {$$ = TrLinkChildren ($<n>3,1,$6);} - | PARSEOP_STARTDEPENDENTFN_NOPRI '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -StartDependentFnTerm - : PARSEOP_STARTDEPENDENTFN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN);} - ByteConstExpr - ',' ByteConstExpr - ')' '{' - ResourceMacroList '}' {$$ = TrLinkChildren ($<n>3,3,$4,$6,$9);} - | PARSEOP_STARTDEPENDENTFN '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -UartSerialBusTerm - : PARSEOP_UART_SERIALBUS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UART_SERIALBUS);} - DWordConstExpr /* 04: ConnectionSpeed */ - OptionalBitsPerByte /* 05: BitsPerByte */ - OptionalStopBits /* 06: StopBits */ - ',' ByteConstExpr /* 08: LinesInUse */ - OptionalEndian /* 09: Endianess */ - 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 */ - ')' {$$ = TrLinkChildren ($<n>3,14,$4,$5,$6,$8,$9,$10,$11,$13,$15,$17,$18,$19,$20,$21);} - | PARSEOP_UART_SERIALBUS '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -VendorLongTerm - : PARSEOP_VENDORLONG '(' {$<n>$ = TrCreateLeafNode (PARSEOP_VENDORLONG);} - OptionalNameString_First - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_VENDORLONG '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -VendorShortTerm - : PARSEOP_VENDORSHORT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_VENDORSHORT);} - OptionalNameString_First - ')' '{' - ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} - | PARSEOP_VENDORSHORT '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WordBusNumberTerm - : PARSEOP_WORDBUSNUMBER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WORDBUSNUMBER);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,12,$4,$5,$6,$7,$9,$11,$13,$15,$17,$18,$19,$20);} - | PARSEOP_WORDBUSNUMBER '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WordIOTerm - : PARSEOP_WORDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WORDIO);} - OptionalResourceType_First - OptionalMinType - OptionalMaxType - OptionalDecodeType - OptionalRangeType - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString - OptionalType - OptionalTranslationType_Last - ')' {$$ = TrLinkChildren ($<n>3,15,$4,$5,$6,$7,$8,$10,$12,$14,$16,$18,$19,$20,$21,$22,$23);} - | PARSEOP_WORDIO '(' - error ')' {$$ = AslDoError(); yyclearin;} - ; - -WordSpaceTerm - : PARSEOP_WORDSPACE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WORDSPACE);} - ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} - OptionalResourceType - OptionalDecodeType - OptionalMinType - OptionalMaxType - ',' ByteConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - ',' WordConstExpr - OptionalByteConstExpr - OptionalStringData - OptionalNameString_Last - ')' {$$ = TrLinkChildren ($<n>3,14,$4,$6,$7,$8,$9,$11,$13,$15,$17,$19,$21,$22,$23,$24);} - | PARSEOP_WORDSPACE '(' +WhileTerm + : PARSEOP_WHILE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);} + TermArg + ')' '{' TermList '}' + {$$ = TrLinkChildren ($<n>3,2,$4,$7);} + | PARSEOP_WHILE '(' error ')' {$$ = AslDoError(); yyclearin;} ; -/******* Object References ***********************************************/ - -/* Allow IO, DMA, IRQ Resource macro names to also be used as identifiers */ - -NameString - : NameSeg {} - | PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) AslCompilerlval.s);} - | PARSEOP_IO {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");} - | PARSEOP_DMA {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");} - | PARSEOP_IRQ {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");} - ; - -NameSeg - : PARSEOP_NAMESEG {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESEG, (ACPI_NATIVE_INT) AslCompilerlval.s);} - ; - - -/******* Helper rules ****************************************************/ - +/******************************************************************************* + * + * ASL Helper Terms + * + ******************************************************************************/ AmlPackageLengthTerm : Integer {$$ = TrUpdateNode (PARSEOP_PACKAGE_LENGTH,(ACPI_PARSE_OBJECT *) $1);} @@ -2748,166 +1691,12 @@ TermArgItem | ',' error {$$ = AslDoError (); yyclearin;} ; -OptionalBusMasterKeyword - : ',' {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);} - | ',' PARSEOP_BUSMASTERTYPE_MASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);} - | ',' PARSEOP_BUSMASTERTYPE_NOTMASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_NOTMASTER);} - ; - -OptionalAccessAttribTerm - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' ByteConstExpr {$$ = $2;} - | ',' AccessAttribKeyword {$$ = $2;} - ; - -OptionalAccessSize - : {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);} - | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);} - | ',' ByteConstExpr {$$ = $2;} - ; - -OptionalAddressingMode - : ',' {$$ = NULL;} - | ',' AddressingModeKeyword {$$ = $2;} - ; - -OptionalAddressRange - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' AddressKeyword {$$ = $2;} - ; - -OptionalBitsPerByte - : ',' {$$ = NULL;} - | ',' BitsPerByteKeyword {$$ = $2;} - ; - -OptionalBuffer_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' DataBufferTerm {$$ = $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 - : {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ - | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, ACPI_TO_INTEGER (""));} /* Placeholder is a NULL string */ - | ',' TermArg {$$ = $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 - : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} - | NameString {$$ = $1;} - ; - -OptionalObjectTypeKeyword - : {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_UNK);} - | ',' ObjectTypeKeyword {$$ = $2;} - ; - -OptionalParityType - : ',' {$$ = NULL;} - | ',' ParityTypeKeyword {$$ = $2;} - ; - -OptionalQWordConstExpr - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' QWordConstExpr {$$ = $2;} - ; - -OptionalRangeType - : ',' {$$ = NULL;} - | ',' RangeTypeKeyword {$$ = $2;} - ; - -OptionalReadWriteKeyword - : {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} - | PARSEOP_READWRITETYPE_BOTH {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);} - | PARSEOP_READWRITETYPE_READONLY {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_READONLY);} - ; - OptionalReference : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ | ',' {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ | ',' TermArg {$$ = $2;} ; -OptionalResourceType_First - : {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} - | ResourceTypeKeyword {$$ = $1;} - ; - -OptionalResourceType - : {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} - | ',' {$$ = TrCreateLeafNode (PARSEOP_RESOURCETYPE_CONSUMER);} - | ',' ResourceTypeKeyword {$$ = $2;} - ; - OptionalReturnArg : {$$ = TrSetNodeFlags (TrCreateLeafNode (PARSEOP_ZERO), NODE_IS_NULL_RETURN);} /* Placeholder is a ZeroOp object */ | TermArg {$$ = $1;} @@ -2919,73 +1708,12 @@ OptionalSerializeRuleKeyword | ',' SerializeRuleKeyword {$$ = $2;} ; -OptionalSlaveMode - : ',' {$$ = NULL;} - | ',' SlaveModeKeyword {$$ = $2;} - ; - -OptionalShareType - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' ShareTypeKeyword {$$ = $2;} - ; - -OptionalShareType_First - : {$$ = NULL;} - | ShareTypeKeyword {$$ = $1;} - ; - -OptionalStopBits - : ',' {$$ = NULL;} - | ',' StopBitsKeyword {$$ = $2;} - ; - -OptionalStringData - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' StringData {$$ = $2;} - ; - OptionalTermArg : {$$ = NULL;} | TermArg {$$ = $1;} ; -OptionalType - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' TypeKeyword {$$ = $2;} - ; - -OptionalType_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' TypeKeyword {$$ = $2;} - ; - -OptionalTranslationType_Last - : {$$ = NULL;} - | ',' {$$ = NULL;} - | ',' TranslationKeyword {$$ = $2;} - ; - -OptionalWireMode - : ',' {$$ = NULL;} - | ',' WireModeKeyword {$$ = $2;} - ; - OptionalWordConst : {$$ = NULL;} | WordConst {$$ = $1;} ; - -OptionalWordConstExpr - : ',' {$$ = NULL;} - | ',' WordConstExpr {$$ = $2;} - ; - -OptionalXferSize - : {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} - | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_XFERSIZE_32, 2);} - | ',' XferSizeKeyword {$$ = $2;} - ; diff --git a/source/compiler/asltokens.y b/source/compiler/asltokens.y index 511fa9b..d52bb50 100644 --- a/source/compiler/asltokens.y +++ b/source/compiler/asltokens.y @@ -452,8 +452,14 @@ NoEcho(' %left <i> PARSEOP_EXP_INCREMENT PARSEOP_EXP_DECREMENT +/* Brackets for Index() support */ + +%left <i> PARSEOP_EXP_INDEX_LEFT +%right <i> PARSEOP_EXP_INDEX_RIGHT + %token <i> PARSEOP_PRINTF %token <i> PARSEOP_FPRINTF + /* Specific parentheses tokens are not used at this time */ /* PARSEOP_EXP_PAREN_OPEN */ /* PARSEOP_EXP_PAREN_CLOSE */ diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index c76720a..1738861 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -538,6 +538,7 @@ TrCreateAssignmentNode ( case PARSEOP_ADD: case PARSEOP_AND: case PARSEOP_DIVIDE: + case PARSEOP_INDEX: case PARSEOP_MOD: case PARSEOP_MULTIPLY: case PARSEOP_NOT: diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h index ce2f758..6205dbf 100644 --- a/source/compiler/asltypes.h +++ b/source/compiler/asltypes.h @@ -170,7 +170,7 @@ typedef enum ASL_FILE_C_SOURCE_OUTPUT, /* .c */ ASL_FILE_ASM_INCLUDE_OUTPUT,/* .inc */ ASL_FILE_C_INCLUDE_OUTPUT, /* .h */ - ASL_FILE_C_OFFSET_OUTPUT, /* offset.h */ + ASL_FILE_C_OFFSET_OUTPUT, /* .offset.h */ ASL_FILE_MAP_OUTPUT /* .map */ } ASL_FILE_TYPES; @@ -179,24 +179,23 @@ typedef enum #define ASL_MAX_FILE_TYPE 16 #define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1) -/* filename suffixes for output files */ +/* Name suffixes used to create filenames for output files */ -#define FILE_SUFFIX_PREPROC_USER "i " -#define FILE_SUFFIX_PREPROCESSOR "pre" +#define FILE_SUFFIX_ASL_CODE "asl" #define FILE_SUFFIX_AML_CODE "aml" -#define FILE_SUFFIX_MAP "map" +#define FILE_SUFFIX_SOURCE "src" +#define FILE_SUFFIX_PREPROCESSOR "pre" +#define FILE_SUFFIX_PREPROC_USER "i" #define FILE_SUFFIX_LISTING "lst" #define FILE_SUFFIX_HEX_DUMP "hex" -#define FILE_SUFFIX_DEBUG "txt" -#define FILE_SUFFIX_SOURCE "src" #define FILE_SUFFIX_NAMESPACE "nsp" +#define FILE_SUFFIX_DEBUG "txt" #define FILE_SUFFIX_ASM_SOURCE "asm" #define FILE_SUFFIX_C_SOURCE "c" -#define FILE_SUFFIX_DISASSEMBLY "dsl" #define FILE_SUFFIX_ASM_INCLUDE "inc" #define FILE_SUFFIX_C_INCLUDE "h" -#define FILE_SUFFIX_ASL_CODE "asl" #define FILE_SUFFIX_C_OFFSET "offset.h" +#define FILE_SUFFIX_MAP "map" /* Cache block structure for ParseOps and Strings */ diff --git a/source/compiler/asltypes.y b/source/compiler/asltypes.y index 650b856..2ed708f 100644 --- a/source/compiler/asltypes.y +++ b/source/compiler/asltypes.y @@ -136,7 +136,7 @@ NoEcho(' %type <n> DefaultTerm %type <n> ElseTerm %type <n> FatalTerm -%type <n> IfElseTerm +%type <n> ElseIfTerm %type <n> IfTerm %type <n> LoadTerm %type <n> NoOpTerm @@ -188,6 +188,7 @@ NoEcho(' %type <n> NotTerm %type <n> ObjectTypeTerm %type <n> OrTerm +%type <n> RawDataBufferTerm %type <n> RefOfTerm %type <n> ShiftLeftTerm %type <n> ShiftRightTerm @@ -297,7 +298,6 @@ NoEcho(' /* Resource Descriptors */ %type <n> ConnectionTerm -%type <n> DataBufferTerm %type <n> DMATerm %type <n> DWordIOTerm %type <n> DWordMemoryTerm @@ -391,3 +391,4 @@ NoEcho(' */ %type <n> Expression %type <n> EqualsTerm +%type <n> IndexExpTerm diff --git a/source/compiler/aslwalks.c b/source/compiler/aslwalks.c index bbc15c5..9485a0a 100644 --- a/source/compiler/aslwalks.c +++ b/source/compiler/aslwalks.c @@ -51,6 +51,13 @@ ACPI_MODULE_NAME ("aslwalks") +/* Local prototypes */ + +static void +AnAnalyzeStoreOperator ( + ACPI_PARSE_OBJECT *Op); + + /******************************************************************************* * * FUNCTION: AnMethodTypingWalkEnd @@ -73,7 +80,7 @@ AnMethodTypingWalkEnd ( UINT32 Level, void *Context) { - UINT32 ThisNodeBtype; + UINT32 ThisOpBtype; switch (Op->Asl.ParseOpcode) @@ -88,10 +95,10 @@ AnMethodTypingWalkEnd ( if ((Op->Asl.Child) && (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) { - ThisNodeBtype = AnGetBtype (Op->Asl.Child); + ThisOpBtype = AnGetBtype (Op->Asl.Child); if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_METHODCALL) && - (ThisNodeBtype == (ACPI_UINT32_MAX -1))) + (ThisOpBtype == (ACPI_UINT32_MAX -1))) { /* * The called method is untyped at this time (typically a @@ -107,7 +114,7 @@ AnMethodTypingWalkEnd ( ASL_WALK_VISIT_UPWARD, NULL, AnMethodTypingWalkEnd, NULL); - ThisNodeBtype = AnGetBtype (Op->Asl.Child); + ThisOpBtype = AnGetBtype (Op->Asl.Child); } } @@ -115,7 +122,7 @@ AnMethodTypingWalkEnd ( if (Op->Asl.ParentMethod) { - Op->Asl.ParentMethod->Asl.AcpiBtype |= ThisNodeBtype; + Op->Asl.ParentMethod->Asl.AcpiBtype |= ThisOpBtype; } } break; @@ -186,9 +193,9 @@ AnOperandTypecheckWalkEnd ( return (AE_OK); } - ArgOp = Op->Asl.Child; + ArgOp = Op->Asl.Child; + OpcodeClass = OpInfo->Class; RuntimeArgTypes = OpInfo->RuntimeArgs; - OpcodeClass = OpInfo->Class; #ifdef ASL_ERROR_NAMED_OBJECT_IN_WHILE /* @@ -247,6 +254,7 @@ AnOperandTypecheckWalkEnd ( { return (AE_OK); } + AnCheckMethodReturnValue (Op, OpInfo, ArgOp, RequiredBtypes, ThisNodeBtype); } @@ -271,6 +279,70 @@ AnOperandTypecheckWalkEnd ( return (AE_OK); } + /* + * Special handling for certain opcodes. + */ + switch (Op->Asl.AmlOpcode) + { + /* BankField has one TermArg */ + + case AML_BANK_FIELD_OP: + + OpcodeClass = AML_CLASS_EXECUTE; + ArgOp = ArgOp->Asl.Next; + ArgOp = ArgOp->Asl.Next; + break; + + /* Operation Region has 2 TermArgs */ + + case AML_REGION_OP: + + OpcodeClass = AML_CLASS_EXECUTE; + ArgOp = ArgOp->Asl.Next; + ArgOp = ArgOp->Asl.Next; + break; + + /* DataTableRegion has 3 TermArgs */ + + case AML_DATA_REGION_OP: + + OpcodeClass = AML_CLASS_EXECUTE; + ArgOp = ArgOp->Asl.Next; + break; + + /* Buffers/Packages have a length that is a TermArg */ + + case AML_BUFFER_OP: + case AML_PACKAGE_OP: + case AML_VAR_PACKAGE_OP: + + /* If length is a constant, we are done */ + + if ((ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER) || + (ArgOp->Asl.ParseOpcode == PARSEOP_RAW_DATA)) + { + return (AE_OK); + } + break; + + /* Store can write any object to the Debug object */ + + case AML_STORE_OP: + /* + * If this is a Store() to the Debug object, we don't need + * to perform any further validation -- because a Store of + * any object to Debug is permitted and supported. + */ + if (ArgOp->Asl.Next->Asl.AmlOpcode == AML_DEBUG_OP) + { + return (AE_OK); + } + break; + + default: + break; + } + switch (OpcodeClass) { case AML_CLASS_EXECUTE: @@ -278,15 +350,6 @@ AnOperandTypecheckWalkEnd ( case AML_CLASS_CONTROL: case AML_CLASS_RETURN_VALUE: - /* TBD: Change class or fix typechecking for these */ - - if ((Op->Asl.AmlOpcode == AML_BUFFER_OP) || - (Op->Asl.AmlOpcode == AML_PACKAGE_OP) || - (Op->Asl.AmlOpcode == AML_VAR_PACKAGE_OP)) - { - break; - } - /* Reverse the runtime argument list */ RuntimeArgTypes2 = 0; @@ -297,8 +360,12 @@ AnOperandTypecheckWalkEnd ( INCREMENT_ARG_LIST (RuntimeArgTypes); } + /* Typecheck each argument */ + while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes2))) { + /* Get the required type(s) for the argument */ + RequiredBtypes = AnMapArgTypeToBtype (ArgType); if (!ArgOp) @@ -308,6 +375,8 @@ AnOperandTypecheckWalkEnd ( AslAbort (); } + /* Get the actual type of the argument */ + ThisNodeBtype = AnGetBtype (ArgOp); if (ThisNodeBtype == ACPI_UINT32_MAX) { @@ -328,6 +397,10 @@ AnOperandTypecheckWalkEnd ( break; } + /* Fallthrough */ + + case ARGI_STORE_TARGET: + if (ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER) { /* @@ -339,25 +412,22 @@ AnOperandTypecheckWalkEnd ( if ((ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) || (ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE)) { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_FIELD, ArgOp, NULL); + AslError (ASL_ERROR, ASL_MSG_RESOURCE_FIELD, + ArgOp, NULL); } else { - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, NULL); + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, + ArgOp, NULL); } - break; } - - if ((ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) || - (ArgOp->Asl.ParseOpcode == PARSEOP_DEREFOF)) - { - break; - } - - ThisNodeBtype = RequiredBtypes; break; +#ifdef __FUTURE_IMPLEMENTATION +/* + * Possible future typechecking support + */ case ARGI_REFERENCE: /* References */ case ARGI_INTEGER_REF: case ARGI_OBJECT_REF: @@ -388,8 +458,8 @@ AnOperandTypecheckWalkEnd ( case PARSEOP_ARG5: case PARSEOP_ARG6: - /* Hard to analyze argument types, sow we won't */ - /* For now, just treat any arg as a typematch */ + /* Hard to analyze argument types, so we won't */ + /* for now. Just treat any arg as a typematch */ /* ThisNodeBtype = RequiredBtypes; */ break; @@ -400,10 +470,9 @@ AnOperandTypecheckWalkEnd ( default: break; - } break; - +#endif case ARGI_INTEGER: default: @@ -411,6 +480,8 @@ AnOperandTypecheckWalkEnd ( } + /* Check for a type mismatch (required versus actual) */ + CommonBtypes = ThisNodeBtype & RequiredBtypes; if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) @@ -438,9 +509,10 @@ AnOperandTypecheckWalkEnd ( AnFormatBtype (StringBuffer2, RequiredBtypes); sprintf (MsgBuffer, "[%s] found, %s operator requires [%s]", - StringBuffer, OpInfo->Name, StringBuffer2); + StringBuffer, OpInfo->Name, StringBuffer2); - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer); + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, + ArgOp, MsgBuffer); } NextArgument: @@ -477,14 +549,15 @@ AnOtherSemanticAnalysisWalkBegin ( UINT32 Level, void *Context) { - ACPI_PARSE_OBJECT *ArgNode; - ACPI_PARSE_OBJECT *PrevArgNode = NULL; + ACPI_PARSE_OBJECT *ArgOp; + ACPI_PARSE_OBJECT *PrevArgOp = NULL; const ACPI_OPCODE_INFO *OpInfo; ACPI_NAMESPACE_NODE *Node; OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); + /* * Determine if an execution class operator actually does something by * checking if it has a target and/or the function return value is used. @@ -497,30 +570,31 @@ AnOtherSemanticAnalysisWalkBegin ( if (OpInfo->Flags & AML_HAS_TARGET) { /* - * Find the target node, it is always the last child. If the traget + * Find the target node, it is always the last child. If the target * is not specified in the ASL, a default node of type Zero was * created by the parser. */ - ArgNode = Op->Asl.Child; - while (ArgNode->Asl.Next) + ArgOp = Op->Asl.Child; + while (ArgOp->Asl.Next) { - PrevArgNode = ArgNode; - ArgNode = ArgNode->Asl.Next; + PrevArgOp = ArgOp; + ArgOp = ArgOp->Asl.Next; } /* Divide() is the only weird case, it has two targets */ if (Op->Asl.AmlOpcode == AML_DIVIDE_OP) { - if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) && - (PrevArgNode) && - (PrevArgNode->Asl.ParseOpcode == PARSEOP_ZERO)) + if ((ArgOp->Asl.ParseOpcode == PARSEOP_ZERO) && + (PrevArgOp) && + (PrevArgOp->Asl.ParseOpcode == PARSEOP_ZERO)) { AslError (ASL_ERROR, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName); } } - else if (ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) + + else if (ArgOp->Asl.ParseOpcode == PARSEOP_ZERO) { AslError (ASL_ERROR, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName); @@ -555,6 +629,15 @@ AnOtherSemanticAnalysisWalkBegin ( */ switch (Op->Asl.ParseOpcode) { + case PARSEOP_STORE: + + if (Gbl_DoTypechecking) + { + AnAnalyzeStoreOperator (Op); + } + break; + + case PARSEOP_ACQUIRE: case PARSEOP_WAIT: /* @@ -566,16 +649,16 @@ AnOtherSemanticAnalysisWalkBegin ( /* First child is the namepath, 2nd child is timeout */ - ArgNode = Op->Asl.Child; - ArgNode = ArgNode->Asl.Next; + ArgOp = Op->Asl.Child; + ArgOp = ArgOp->Asl.Next; /* * Check for the WAIT_FOREVER case - defined by the ACPI spec to be * 0xFFFF or greater */ - if (((ArgNode->Asl.ParseOpcode == PARSEOP_WORDCONST) || - (ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER)) && - (ArgNode->Asl.Value.Integer >= (UINT64) ACPI_WAIT_FOREVER)) + if (((ArgOp->Asl.ParseOpcode == PARSEOP_WORDCONST) || + (ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER)) && + (ArgOp->Asl.Value.Integer >= (UINT64) ACPI_WAIT_FOREVER)) { break; } @@ -586,7 +669,7 @@ AnOtherSemanticAnalysisWalkBegin ( */ if (!AnIsResultUsed (Op)) { - AslError (ASL_WARNING, ASL_MSG_TIMEOUT, ArgNode, + AslError (ASL_WARNING, ASL_MSG_TIMEOUT, ArgOp, Op->Asl.ExternalName); } break; @@ -595,15 +678,15 @@ AnOtherSemanticAnalysisWalkBegin ( /* * Check for a zero Length (NumBits) operand. NumBits is the 3rd operand */ - ArgNode = Op->Asl.Child; - ArgNode = ArgNode->Asl.Next; - ArgNode = ArgNode->Asl.Next; + ArgOp = Op->Asl.Child; + ArgOp = ArgOp->Asl.Next; + ArgOp = ArgOp->Asl.Next; - if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) || - ((ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER) && - (ArgNode->Asl.Value.Integer == 0))) + if ((ArgOp->Asl.ParseOpcode == PARSEOP_ZERO) || + ((ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER) && + (ArgOp->Asl.Value.Integer == 0))) { - AslError (ASL_ERROR, ASL_MSG_NON_ZERO, ArgNode, NULL); + AslError (ASL_ERROR, ASL_MSG_NON_ZERO, ArgOp, NULL); } break; @@ -612,24 +695,24 @@ AnOtherSemanticAnalysisWalkBegin ( * Ensure that the referenced operation region has the correct SPACE_ID. * From the grammar/parser, we know the parent is a FIELD definition. */ - ArgNode = Op->Asl.Parent; /* Field definition */ - ArgNode = ArgNode->Asl.Child; /* First child is the OpRegion Name */ - Node = ArgNode->Asl.Node; /* OpRegion namespace node */ + ArgOp = Op->Asl.Parent; /* Field definition */ + ArgOp = ArgOp->Asl.Child; /* First child is the OpRegion Name */ + Node = ArgOp->Asl.Node; /* OpRegion namespace node */ if (!Node) { break; } - ArgNode = Node->Op; /* OpRegion definition */ - ArgNode = ArgNode->Asl.Child; /* First child is the OpRegion Name */ - ArgNode = ArgNode->Asl.Next; /* Next peer is the SPACE_ID (what we want) */ + ArgOp = Node->Op; /* OpRegion definition */ + ArgOp = ArgOp->Asl.Child; /* First child is the OpRegion Name */ + ArgOp = ArgOp->Asl.Next; /* Next peer is the SPACE_ID (what we want) */ /* * The Connection() operator is only valid for the following operation * region SpaceIds: GeneralPurposeIo and GenericSerialBus. */ - if ((ArgNode->Asl.Value.Integer != ACPI_ADR_SPACE_GPIO) && - (ArgNode->Asl.Value.Integer != ACPI_ADR_SPACE_GSBUS)) + if ((ArgOp->Asl.Value.Integer != ACPI_ADR_SPACE_GPIO) && + (ArgOp->Asl.Value.Integer != ACPI_ADR_SPACE_GSBUS)) { AslError (ASL_ERROR, ASL_MSG_CONNECTION_INVALID, Op, NULL); } @@ -640,46 +723,46 @@ AnOtherSemanticAnalysisWalkBegin ( * Ensure that fields for GeneralPurposeIo and GenericSerialBus * contain at least one Connection() operator */ - ArgNode = Op->Asl.Child; /* 1st child is the OpRegion Name */ - Node = ArgNode->Asl.Node; /* OpRegion namespace node */ + ArgOp = Op->Asl.Child; /* 1st child is the OpRegion Name */ + Node = ArgOp->Asl.Node; /* OpRegion namespace node */ if (!Node) { break; } - ArgNode = Node->Op; /* OpRegion definition */ - ArgNode = ArgNode->Asl.Child; /* First child is the OpRegion Name */ - ArgNode = ArgNode->Asl.Next; /* Next peer is the SPACE_ID (what we want) */ + ArgOp = Node->Op; /* OpRegion definition */ + ArgOp = ArgOp->Asl.Child; /* First child is the OpRegion Name */ + ArgOp = ArgOp->Asl.Next; /* Next peer is the SPACE_ID (what we want) */ /* We are only interested in GeneralPurposeIo and GenericSerialBus */ - if ((ArgNode->Asl.Value.Integer != ACPI_ADR_SPACE_GPIO) && - (ArgNode->Asl.Value.Integer != ACPI_ADR_SPACE_GSBUS)) + if ((ArgOp->Asl.Value.Integer != ACPI_ADR_SPACE_GPIO) && + (ArgOp->Asl.Value.Integer != ACPI_ADR_SPACE_GSBUS)) { break; } - ArgNode = Op->Asl.Child; /* 1st child is the OpRegion Name */ - ArgNode = ArgNode->Asl.Next; /* AccessType */ - ArgNode = ArgNode->Asl.Next; /* LockRule */ - ArgNode = ArgNode->Asl.Next; /* UpdateRule */ - ArgNode = ArgNode->Asl.Next; /* Start of FieldUnitList */ + ArgOp = Op->Asl.Child; /* 1st child is the OpRegion Name */ + ArgOp = ArgOp->Asl.Next; /* AccessType */ + ArgOp = ArgOp->Asl.Next; /* LockRule */ + ArgOp = ArgOp->Asl.Next; /* UpdateRule */ + ArgOp = ArgOp->Asl.Next; /* Start of FieldUnitList */ /* Walk the FieldUnitList */ - while (ArgNode) + while (ArgOp) { - if (ArgNode->Asl.ParseOpcode == PARSEOP_CONNECTION) + if (ArgOp->Asl.ParseOpcode == PARSEOP_CONNECTION) { break; } - else if (ArgNode->Asl.ParseOpcode == PARSEOP_NAMESEG) + else if (ArgOp->Asl.ParseOpcode == PARSEOP_NAMESEG) { - AslError (ASL_ERROR, ASL_MSG_CONNECTION_MISSING, ArgNode, NULL); + AslError (ASL_ERROR, ASL_MSG_CONNECTION_MISSING, ArgOp, NULL); break; } - ArgNode = ArgNode->Asl.Next; + ArgOp = ArgOp->Asl.Next; } break; @@ -690,3 +773,204 @@ AnOtherSemanticAnalysisWalkBegin ( return (AE_OK); } + + +/******************************************************************************* + * + * FUNCTION: AnAnalyzeStoreOperator + * + * PARAMETERS: Op - Store() operator + * + * RETURN: None + * + * DESCRIPTION: Analyze a store operator. Mostly for stores to/from package + * objects where there are more restrictions than other data + * types. + * + ******************************************************************************/ + +static void +AnAnalyzeStoreOperator ( + ACPI_PARSE_OBJECT *Op) +{ + ACPI_NAMESPACE_NODE *SourceNode; + ACPI_NAMESPACE_NODE *TargetNode; + ACPI_PARSE_OBJECT *SourceOperandOp; + ACPI_PARSE_OBJECT *TargetOperandOp; + UINT32 SourceOperandBtype; + UINT32 TargetOperandBtype; + + + /* Extract the two operands for STORE */ + + SourceOperandOp = Op->Asl.Child; + TargetOperandOp = SourceOperandOp->Asl.Next; + + /* + * Ignore these Source operand opcodes, they cannot be typechecked, + * the actual result is unknown here. + */ + switch (SourceOperandOp->Asl.ParseOpcode) + { + /* For these, type of the returned value is unknown at compile time */ + + case PARSEOP_DEREFOF: + case PARSEOP_METHODCALL: + case PARSEOP_STORE: + case PARSEOP_COPYOBJECT: + + return; + + case PARSEOP_INDEX: + case PARSEOP_REFOF: + + if (!Gbl_EnableReferenceTypechecking) + { + return; + } + + /* + * These opcodes always return an object reference, and thus + * the result can only be stored to a Local, Arg, or Debug. + */ + if (TargetOperandOp->Asl.AmlOpcode == AML_DEBUG_OP) + { + return; + } + + if ((TargetOperandOp->Asl.AmlOpcode < AML_LOCAL0) || + (TargetOperandOp->Asl.AmlOpcode > AML_ARG6)) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, TargetOperandOp, + "Source [Reference], Target must be [Local/Arg/Debug]"); + } + return; + + default: + break; + } + + /* + * Ignore these Target operand opcodes, they cannot be typechecked + */ + switch (TargetOperandOp->Asl.ParseOpcode) + { + case PARSEOP_DEBUG: + case PARSEOP_DEREFOF: + case PARSEOP_REFOF: + case PARSEOP_INDEX: + + return; + + case PARSEOP_METHODCALL: + /* + * A target is not allowed to be a method call. + * It is technically allowed to be a method call, but this only + * makes sense in one case: if the method returns a reference object, + * which will then allow the Store to complete successfully. + * However, this is not supported by the ACPICA interpreter, + * and not supported by the MS ASL compiler + * at this time. (09/2015) + */ + AslError (ASL_ERROR, ASL_MSG_UNSUPPORTED, + TargetOperandOp, "Method invocation cannot be a target"); + return; + + default: + break; + } + + /* + * Ignore typecheck for External() operands of type "UnknownObj", + * we don't know the actual type (source or target). + */ + SourceNode = SourceOperandOp->Asl.Node; + if (SourceNode && + (SourceNode->Flags & ANOBJ_IS_EXTERNAL) && + (SourceNode->Type == ACPI_TYPE_ANY)) + { + return; + } + + TargetNode = TargetOperandOp->Asl.Node; + if (TargetNode && + (TargetNode->Flags & ANOBJ_IS_EXTERNAL) && + (TargetNode->Type == ACPI_TYPE_ANY)) + { + return; + } + + /* + * A NULL node with a namepath AML opcode indicates non-existent + * name. Just return, the error message is generated elsewhere. + */ + if ((!SourceNode && (SourceOperandOp->Asl.AmlOpcode == AML_INT_NAMEPATH_OP)) || + (!TargetNode && (TargetOperandOp->Asl.AmlOpcode == AML_INT_NAMEPATH_OP))) + { + return; + } + + /* + * Simple check for source same as target via NS node. + * -- Could be expanded to locals and args. + */ + if (SourceNode && TargetNode) + { + if (SourceNode == TargetNode) + { + AslError (ASL_WARNING, ASL_MSG_DUPLICATE_ITEM, + TargetOperandOp, "Source is the same as Target"); + return; + } + } + + /* Ignore typecheck if either source or target is a local or arg */ + + if ((SourceOperandOp->Asl.AmlOpcode >= AML_LOCAL0) && + (SourceOperandOp->Asl.AmlOpcode <= AML_ARG6)) + { + return; /* Cannot type a local/arg at compile time */ + } + + if ((TargetOperandOp->Asl.AmlOpcode >= AML_LOCAL0) && + (TargetOperandOp->Asl.AmlOpcode <= AML_ARG6)) + { + return; /* Cannot type a local/arg at compile time */ + } + + /* + * Package objects are a special case because they cannot by implicitly + * converted to/from anything. Check for these two illegal cases: + * + * Store (non-package, package) + * Store (package, non-package) + */ + SourceOperandBtype = AnGetBtype (SourceOperandOp); + TargetOperandBtype = AnGetBtype (TargetOperandOp); + + /* Check source first for (package, non-package) case */ + + if (SourceOperandBtype & ACPI_BTYPE_PACKAGE) + { + /* If Source is PACKAGE-->Target must be PACKAGE */ + + if (!(TargetOperandBtype & ACPI_BTYPE_PACKAGE)) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, TargetOperandOp, + "Source is [Package], Target must be a package also"); + } + } + + /* Else check target for (non-package, package) case */ + + else if (TargetOperandBtype & ACPI_BTYPE_PACKAGE) + { + /* If Target is PACKAGE, Source must be PACKAGE */ + + if (!(SourceOperandBtype & ACPI_BTYPE_PACKAGE)) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, SourceOperandOp, + "Target is [Package], Source must be a package also"); + } + } +} diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index ebd02b7..af01ca2 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -419,8 +419,20 @@ AcpiDbExecute ( #ifdef ACPI_DEBUG_OUTPUT UINT32 PreviousAllocations; UINT32 Allocations; +#endif + + /* + * Allow one execution to be performed by debugger or single step + * execution will be dead locked by the interpreter mutexes. + */ + if (AcpiGbl_MethodExecuting) + { + AcpiOsPrintf ("Only one debugger execution is allowed.\n"); + return; + } +#ifdef ACPI_DEBUG_OUTPUT /* Memory allocation tracking */ PreviousAllocations = AcpiDbGetOutstandingAllocations (); diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index 981d7062..1b9a917 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -123,6 +123,7 @@ enum AcpiExDebuggerCommands CMD_OSI, CMD_OWNER, CMD_PATHS, + CMD_PREDEFINED, CMD_PREFIX, CMD_QUIT, CMD_REFERENCES, @@ -152,7 +153,6 @@ enum AcpiExDebuggerCommands CMD_TERMINATE, CMD_THREADS, - CMD_PREDEFINED, CMD_TEST, #endif }; @@ -201,6 +201,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = {"OSI", 0}, {"OWNER", 1}, {"PATHS", 0}, + {"PREDEFINED", 0}, {"PREFIX", 0}, {"QUIT", 0}, {"REFERENCES", 1}, @@ -230,7 +231,6 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = {"TERMINATE", 0}, {"THREADS", 3}, - {"PREDEFINED", 0}, {"TEST", 1}, #endif {NULL, 0} @@ -1229,7 +1229,8 @@ AcpiDbExecuteThread ( AcpiGbl_MethodExecuting = FALSE; AcpiGbl_StepToNextCall = FALSE; - MStatus = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); + MStatus = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady, + ACPI_WAIT_FOREVER); if (ACPI_FAILURE (MStatus)) { return; @@ -1237,11 +1238,7 @@ AcpiDbExecuteThread ( Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); - MStatus = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); - if (ACPI_FAILURE (MStatus)) - { - return; - } + AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete); } } @@ -1332,13 +1329,14 @@ AcpiDbUserCommands ( * Signal the debug thread that we have a command to execute, * and wait for the command to complete. */ - Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY); + AcpiOsReleaseMutex (AcpiGbl_DbCommandReady); if (ACPI_FAILURE (Status)) { return (Status); } - Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); + Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete, + ACPI_WAIT_FOREVER); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/source/components/debugger/dbobject.c b/source/components/debugger/dbobject.c index eef1b9e..019e811 100644 --- a/source/components/debugger/dbobject.c +++ b/source/components/debugger/dbobject.c @@ -445,6 +445,7 @@ AcpiDbDecodeLocals ( UINT32 i; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *Node; + BOOLEAN DisplayLocals = FALSE; ObjDesc = WalkState->MethodDesc; @@ -463,14 +464,39 @@ AcpiDbDecodeLocals ( return; } - AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", - AcpiUtGetNodeName (Node)); + /* Are any locals actually set? */ for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) { ObjDesc = WalkState->LocalVariables[i].Object; - AcpiOsPrintf (" Local%X: ", i); - AcpiDbDisplayInternalObject (ObjDesc, WalkState); + if (ObjDesc) + { + DisplayLocals = TRUE; + break; + } + } + + /* If any are set, only display the ones that are set */ + + if (DisplayLocals) + { + AcpiOsPrintf ("\nInitialized Local Variables for method [%4.4s]:\n", + AcpiUtGetNodeName (Node)); + + for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) + { + ObjDesc = WalkState->LocalVariables[i].Object; + if (ObjDesc) + { + AcpiOsPrintf (" Local%X: ", i); + AcpiDbDisplayInternalObject (ObjDesc, WalkState); + } + } + } + else + { + AcpiOsPrintf ("No Local Variables are initialized for method [%4.4s]\n", + AcpiUtGetNodeName (Node)); } } @@ -494,10 +520,11 @@ AcpiDbDecodeArguments ( UINT32 i; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *Node; + BOOLEAN DisplayArgs = FALSE; + Node = WalkState->MethodNode; ObjDesc = WalkState->MethodDesc; - Node = WalkState->MethodNode; if (!Node) { @@ -512,16 +539,40 @@ AcpiDbDecodeArguments ( return; } - AcpiOsPrintf ( - "Arguments for Method [%4.4s]: " - "(%X arguments defined, max concurrency = %X)\n", - AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount, - ObjDesc->Method.SyncLevel); + /* Are any arguments actually set? */ for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { ObjDesc = WalkState->Arguments[i].Object; - AcpiOsPrintf (" Arg%u: ", i); - AcpiDbDisplayInternalObject (ObjDesc, WalkState); + if (ObjDesc) + { + DisplayArgs = TRUE; + break; + } + } + + /* If any are set, only display the ones that are set */ + + if (DisplayArgs) + { + AcpiOsPrintf ( + "Initialized Arguments for Method [%4.4s]: " + "(%X arguments defined for method invocation)\n", + AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount); + + for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) + { + ObjDesc = WalkState->Arguments[i].Object; + if (ObjDesc) + { + AcpiOsPrintf (" Arg%u: ", i); + AcpiDbDisplayInternalObject (ObjDesc, WalkState); + } + } + } + else + { + AcpiOsPrintf ("No Arguments are initialized for method [%4.4s]\n", + AcpiUtGetNodeName (Node)); } } diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c index a6a5a62..9e7c31d 100644 --- a/source/components/debugger/dbxface.c +++ b/source/components/debugger/dbxface.c @@ -101,12 +101,10 @@ AcpiDbStartCommand ( { /* Handshake with the front-end that gets user command lines */ - Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); + AcpiOsReleaseMutex (AcpiGbl_DbCommandComplete); + + Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady, + ACPI_WAIT_FOREVER); if (ACPI_FAILURE (Status)) { return (Status); @@ -450,14 +448,16 @@ AcpiInitializeDebugger ( { /* These were created with one unit, grab it */ - Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); + Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandComplete, + ACPI_WAIT_FOREVER); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not get debugger mutex\n"); return_ACPI_STATUS (Status); } - Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); + Status = AcpiOsAcquireMutex (AcpiGbl_DbCommandReady, + ACPI_WAIT_FOREVER); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not get debugger mutex\n"); @@ -511,33 +511,3 @@ AcpiTerminateDebugger ( } ACPI_EXPORT_SYMBOL (AcpiTerminateDebugger) - - -#ifdef ACPI_OBSOLETE_FUNCTIONS -/******************************************************************************* - * - * FUNCTION: AcpiDbMethodEnd - * - * PARAMETERS: WalkState - Current walk - * - * RETURN: Status - * - * DESCRIPTION: Called at method termination - * - ******************************************************************************/ - -void -AcpiDbMethodEnd ( - ACPI_WALK_STATE *WalkState) -{ - - if (!AcpiGbl_CmSingleStep) - { - return; - } - - AcpiOsPrintf ("<Method Terminating>\n"); - - AcpiDbStartCommand (WalkState, NULL); -} -#endif diff --git a/source/components/disassembler/dmcstyle.c b/source/components/disassembler/dmcstyle.c index 04436a8..7616723 100644 --- a/source/components/disassembler/dmcstyle.c +++ b/source/components/disassembler/dmcstyle.c @@ -227,12 +227,27 @@ AcpiDmCheckForSymbolicOpcode ( Child2->Common.OperatorSymbol = OperatorSymbol; return (TRUE); -#ifdef INDEX_SUPPORT case AML_INDEX_OP: + /* + * Check for constant source operand. Note: although technically + * legal syntax, the iASL compiler does not support this with + * the symbolic operators for Index(). It doesn't make sense to + * use Index() with a constant anyway. + */ + if ((Child1->Common.AmlOpcode == AML_STRING_OP) || + (Child1->Common.AmlOpcode == AML_BUFFER_OP) || + (Child1->Common.AmlOpcode == AML_PACKAGE_OP) || + (Child1->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) + { + Op->Common.DisasmFlags |= ACPI_PARSEOP_CLOSING_PAREN; + return (FALSE); + } + + /* Index operator is [] */ + Child1->Common.OperatorSymbol = " ["; Child2->Common.OperatorSymbol = "]"; break; -#endif /* Unary operators */ @@ -442,7 +457,6 @@ AcpiDmCheckForSymbolicOpcode ( case AML_INCREMENT_OP: return (TRUE); -#ifdef INDEX_SUPPORT case AML_INDEX_OP: /* Target is optional, 3rd operand */ @@ -458,7 +472,6 @@ AcpiDmCheckForSymbolicOpcode ( } } return (TRUE); -#endif case AML_STORE_OP: /* @@ -578,12 +591,18 @@ AcpiDmCloseOperator ( } break; + case AML_INDEX_OP: + + /* This is case for unsupported Index() source constants */ + + if (Op->Common.DisasmFlags & ACPI_PARSEOP_CLOSING_PAREN) + { + AcpiOsPrintf (")"); + } + return; /* No need for parens for these */ -#ifdef INDEX_SUPPORT - case AML_INDEX_OP: -#endif case AML_DECREMENT_OP: case AML_INCREMENT_OP: case AML_LNOT_OP: diff --git a/source/components/executer/exconvrt.c b/source/components/executer/exconvrt.c index b8f032c..c964217 100644 --- a/source/components/executer/exconvrt.c +++ b/source/components/executer/exconvrt.c @@ -673,6 +673,7 @@ AcpiExConvertToTargetType ( break; case ARGI_TARGETREF: + case ARGI_STORE_TARGET: switch (DestinationType) { diff --git a/source/components/executer/exresolv.c b/source/components/executer/exresolv.c index 868c90d..79878c6 100644 --- a/source/components/executer/exresolv.c +++ b/source/components/executer/exresolv.c @@ -225,7 +225,6 @@ AcpiExResolveObjectToValue ( * (i.e., dereference the package index) * Delete the ref object, increment the returned object */ - AcpiUtRemoveReference (StackDesc); AcpiUtAddReference (ObjDesc); *StackPtr = ObjDesc; } diff --git a/source/components/executer/exresop.c b/source/components/executer/exresop.c index e2262de..d4c5289 100644 --- a/source/components/executer/exresop.c +++ b/source/components/executer/exresop.c @@ -320,6 +320,8 @@ AcpiExResolveOperands ( case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ + case ARGI_STORE_TARGET: + /* * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE * A Namespace Node is OK as-is diff --git a/source/components/executer/exstore.c b/source/components/executer/exstore.c index 6215ff3..1f2f912 100644 --- a/source/components/executer/exstore.c +++ b/source/components/executer/exstore.c @@ -147,7 +147,7 @@ AcpiExStore ( /* Destination is not a Reference object */ ACPI_ERROR ((AE_INFO, - "Target is not a Reference or Constant object - %s [%p]", + "Target is not a Reference or Constant object - [%s] %p", AcpiUtGetObjectTypeName (DestDesc), DestDesc)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -194,7 +194,7 @@ AcpiExStore ( * displayed and otherwise has no effect -- see ACPI Specification */ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "**** Write to Debug Object: Object %p %s ****:\n\n", + "**** Write to Debug Object: Object %p [%s] ****:\n\n", SourceDesc, AcpiUtGetObjectTypeName (SourceDesc))); ACPI_DEBUG_OBJECT (SourceDesc, 0, 0); @@ -356,7 +356,7 @@ AcpiExStoreObjectToIndex ( /* All other types are invalid */ ACPI_ERROR ((AE_INFO, - "Source must be Integer/Buffer/String type, not %s", + "Source must be type [Integer/Buffer/String], found [%s]", AcpiUtGetObjectTypeName (SourceDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -368,8 +368,8 @@ AcpiExStoreObjectToIndex ( default: ACPI_ERROR ((AE_INFO, - "Target is not a Package or BufferField")); - Status = AE_AML_OPERAND_TYPE; + "Target is not of type [Package/BufferField]")); + Status = AE_AML_TARGET_TYPE; break; } @@ -390,20 +390,20 @@ AcpiExStoreObjectToIndex ( * * DESCRIPTION: Store the object to the named object. * - * The Assignment of an object to a named object is handled here - * The value passed in will replace the current value (if any) - * with the input value. + * The assignment of an object to a named object is handled here. + * The value passed in will replace the current value (if any) + * with the input value. * - * When storing into an object the data is converted to the - * target object type then stored in the object. This means - * that the target object type (for an initialized target) will - * not be changed by a store operation. A CopyObject can change - * the target type, however. + * When storing into an object the data is converted to the + * target object type then stored in the object. This means + * that the target object type (for an initialized target) will + * not be changed by a store operation. A CopyObject can change + * the target type, however. * - * The ImplicitConversion flag is set to NO/FALSE only when - * storing to an ArgX -- as per the rules of the ACPI spec. + * The ImplicitConversion flag is set to NO/FALSE only when + * storing to an ArgX -- as per the rules of the ACPI spec. * - * Assumes parameters are already validated. + * Assumes parameters are already validated. * ******************************************************************************/ @@ -428,9 +428,74 @@ AcpiExStoreObjectToNode ( TargetType = AcpiNsGetType (Node); TargetDesc = AcpiNsGetAttachedObject (Node); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p (%s) to node %p (%s)\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p [%s] to node %p [%s]\n", SourceDesc, AcpiUtGetObjectTypeName (SourceDesc), - Node, AcpiUtGetTypeName (TargetType))); + Node, AcpiUtGetTypeName (TargetType))); + + /* Only limited target types possible for everything except CopyObject */ + + if (WalkState->Opcode != AML_COPY_OP) + { + /* + * Only CopyObject allows all object types to be overwritten. For + * TargetRef(s), there are restrictions on the object types that + * are allowed. + * + * Allowable operations/typing for Store: + * + * 1) Simple Store + * Integer --> Integer (Named/Local/Arg) + * String --> String (Named/Local/Arg) + * Buffer --> Buffer (Named/Local/Arg) + * Package --> Package (Named/Local/Arg) + * + * 2) Store with implicit conversion + * Integer --> String or Buffer (Named) + * String --> Integer or Buffer (Named) + * Buffer --> Integer or String (Named) + */ + switch (TargetType) + { + case ACPI_TYPE_PACKAGE: + /* + * Here, can only store a package to an existing package. + * Storing a package to a Local/Arg is OK, and handled + * elsewhere. + */ + if (WalkState->Opcode == AML_STORE_OP) + { + if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE) + { + ACPI_ERROR ((AE_INFO, + "Cannot assign type [%s] to [Package] " + "(source must be type Pkg)", + AcpiUtGetObjectTypeName (SourceDesc))); + + return_ACPI_STATUS (AE_AML_TARGET_TYPE); + } + break; + } + + /* Fallthrough */ + + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_EVENT: + case ACPI_TYPE_MUTEX: + case ACPI_TYPE_REGION: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_THERMAL: + + ACPI_ERROR ((AE_INFO, + "Target must be [Buffer/Integer/String/Reference], found [%s] (%4.4s)", + AcpiUtGetTypeName (Node->Type), Node->Name.Ascii)); + + return_ACPI_STATUS (AE_AML_TARGET_TYPE); + + default: + break; + } + } /* * Resolve the source object to an actual value @@ -446,13 +511,13 @@ AcpiExStoreObjectToNode ( switch (TargetType) { - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: /* * The simple data types all support implicit source operand * conversion before the store. */ + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_STRING: + case ACPI_TYPE_BUFFER: if ((WalkState->Opcode == AML_COPY_OP) || !ImplicitConversion) @@ -491,7 +556,7 @@ AcpiExStoreObjectToNode ( NewDesc->Common.Type); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Store %s into %s via Convert/Attach\n", + "Store type [%s] into [%s] via Convert/Attach\n", AcpiUtGetObjectTypeName (SourceDesc), AcpiUtGetObjectTypeName (NewDesc))); } @@ -513,15 +578,12 @@ AcpiExStoreObjectToNode ( default: /* - * No conversions for all other types. Directly store a copy of - * the source object. This is the ACPI spec-defined behavior for - * the CopyObject operator. + * CopyObject operator: No conversions for all other types. + * Instead, directly store a copy of the source object. * - * NOTE: For the Store operator, this is a departure from the - * ACPI spec, which states "If conversion is impossible, abort - * the running control method". Instead, this code implements - * "If conversion is impossible, treat the Store operation as - * a CopyObject". + * This is the ACPI spec-defined behavior for the CopyObject + * operator. (Note, for this default case, all normal + * Store/Target operations exited above with an error). */ Status = AcpiExStoreDirectToNode (SourceDesc, Node, WalkState); diff --git a/source/components/executer/exstoren.c b/source/components/executer/exstoren.c index c14b30d..f584438 100644 --- a/source/components/executer/exstoren.c +++ b/source/components/executer/exstoren.c @@ -129,9 +129,10 @@ AcpiExResolveObject ( /* Conversion successful but still not a valid type */ ACPI_ERROR ((AE_INFO, - "Cannot assign type %s to %s (must be type Int/Str/Buf)", + "Cannot assign type [%s] to [%s] (must be type Int/Str/Buf)", AcpiUtGetObjectTypeName (SourceDesc), AcpiUtGetTypeName (TargetType))); + Status = AE_AML_OPERAND_TYPE; } break; @@ -284,7 +285,7 @@ AcpiExStoreObjectToObject ( /* * All other types come here. */ - ACPI_WARNING ((AE_INFO, "Store into type %s not implemented", + ACPI_WARNING ((AE_INFO, "Store into type [%s] not implemented", AcpiUtGetObjectTypeName (DestDesc))); Status = AE_NOT_IMPLEMENTED; diff --git a/source/components/namespace/nspredef.c b/source/components/namespace/nspredef.c index 1b3b082..7221c88 100644 --- a/source/components/namespace/nspredef.c +++ b/source/components/namespace/nspredef.c @@ -249,7 +249,7 @@ AcpiNsCheckObjectType ( { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; ACPI_STATUS Status = AE_OK; - char TypeBuffer[48]; /* Room for 5 types */ + char TypeBuffer[96]; /* Room for 10 types */ /* A Namespace node should not get here, but make sure */ diff --git a/source/components/utilities/utdecode.c b/source/components/utilities/utdecode.c index 849a1bc..fc21e20 100644 --- a/source/components/utilities/utdecode.c +++ b/source/components/utilities/utdecode.c @@ -261,13 +261,29 @@ char * AcpiUtGetObjectTypeName ( ACPI_OPERAND_OBJECT *ObjDesc) { + ACPI_FUNCTION_TRACE (UtGetObjectTypeName); + if (!ObjDesc) { - return ("[NULL Object Descriptor]"); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); + return_PTR ("[NULL Object Descriptor]"); + } + + /* These descriptor types share a common area */ + + if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) && + (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_NAMED)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Invalid object descriptor type: 0x%2.2X [%s] (%p)\n", + ACPI_GET_DESCRIPTOR_TYPE (ObjDesc), + AcpiUtGetDescriptorName (ObjDesc), ObjDesc)); + + return_PTR ("Invalid object"); } - return (AcpiUtGetTypeName (ObjDesc->Common.Type)); + return_PTR (AcpiUtGetTypeName (ObjDesc->Common.Type)); } @@ -461,8 +477,6 @@ static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = "ACPI_MTX_Events", "ACPI_MTX_Caches", "ACPI_MTX_Memory", - "ACPI_MTX_CommandComplete", - "ACPI_MTX_CommandReady" }; char * diff --git a/source/components/utilities/utfileio.c b/source/components/utilities/utfileio.c index 0180efe..8c50354 100644 --- a/source/components/utilities/utfileio.c +++ b/source/components/utilities/utfileio.c @@ -45,6 +45,7 @@ #include "accommon.h" #include "actables.h" #include "acapps.h" +#include "errno.h" #ifdef ACPI_ASL_COMPILER #include "aslcompiler.h" @@ -330,6 +331,12 @@ AcpiUtReadTableFromFile ( if (!File) { perror ("Could not open input file"); + + if (errno == ENOENT) + { + return (AE_NOT_EXIST); + } + return (Status); } diff --git a/source/components/utilities/utmutex.c b/source/components/utilities/utmutex.c index 4fe866e..60b94c1 100644 --- a/source/components/utilities/utmutex.c +++ b/source/components/utilities/utmutex.c @@ -124,6 +124,24 @@ AcpiUtMutexInitialize ( /* Create the reader/writer lock for namespace access */ Status = AcpiUtCreateRwLock (&AcpiGbl_NamespaceRwLock); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + +#ifdef ACPI_DEBUGGER + + /* Debugger Support */ + + Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandReady); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiOsCreateMutex (&AcpiGbl_DbCommandComplete); +#endif + return_ACPI_STATUS (Status); } @@ -169,6 +187,12 @@ AcpiUtMutexTerminate ( /* Delete the reader/writer lock */ AcpiUtDeleteRwLock (&AcpiGbl_NamespaceRwLock); + +#ifdef ACPI_DEBUGGER + AcpiOsDeleteMutex (AcpiGbl_DbCommandReady); + AcpiOsDeleteMutex (AcpiGbl_DbCommandComplete); +#endif + return_VOID; } diff --git a/source/include/acapps.h b/source/include/acapps.h index 7c4880a..9ca8e73 100644 --- a/source/include/acapps.h +++ b/source/include/acapps.h @@ -94,7 +94,7 @@ #define FILE_SUFFIX_DISASSEMBLY "dsl" -#define ACPI_TABLE_FILE_SUFFIX ".dat" +#define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */ /* diff --git a/source/include/acexcep.h b/source/include/acexcep.h index 714e3b1..f021eaf 100644 --- a/source/include/acexcep.h +++ b/source/include/acexcep.h @@ -198,8 +198,9 @@ typedef struct acpi_exception_info #define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020) #define AE_AML_INFINITE_LOOP EXCEP_AML (0x0021) #define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022) +#define AE_AML_TARGET_TYPE EXCEP_AML (0x0023) -#define AE_CODE_AML_MAX 0x0022 +#define AE_CODE_AML_MAX 0x0023 /* @@ -324,7 +325,8 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Aml[] = EXCEP_TXT ("AE_AML_BAD_RESOURCE_LENGTH", "The length of a Resource Descriptor in the AML is incorrect"), EXCEP_TXT ("AE_AML_ILLEGAL_ADDRESS", "A memory, I/O, or PCI configuration address is invalid"), EXCEP_TXT ("AE_AML_INFINITE_LOOP", "An apparent infinite AML While loop, method was aborted"), - EXCEP_TXT ("AE_AML_UNINITIALIZED_NODE", "A namespace node is uninitialized or unresolved") + EXCEP_TXT ("AE_AML_UNINITIALIZED_NODE", "A namespace node is uninitialized or unresolved"), + EXCEP_TXT ("AE_AML_TARGET_TYPE", "A target operand of an incorrect type was encountered") }; static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Ctrl[] = diff --git a/source/include/acglobal.h b/source/include/acglobal.h index 08d60fd..a9e349f 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -361,6 +361,9 @@ ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCountMisc); ACPI_GLOBAL (UINT32, AcpiGbl_NumNodes); ACPI_GLOBAL (UINT32, AcpiGbl_NumObjects); +ACPI_GLOBAL (ACPI_MUTEX, AcpiGbl_DbCommandReady); +ACPI_GLOBAL (ACPI_MUTEX, AcpiGbl_DbCommandComplete); + #endif /* ACPI_DEBUGGER */ diff --git a/source/include/aclocal.h b/source/include/aclocal.h index ea3d219..15759e1 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -87,10 +87,8 @@ union acpi_parse_object; #define ACPI_MTX_EVENTS 3 /* Data for ACPI events */ #define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */ #define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */ -#define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */ -#define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */ -#define ACPI_MAX_MUTEX 7 +#define ACPI_MAX_MUTEX 5 #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 @@ -328,13 +326,17 @@ ACPI_STATUS (*ACPI_INTERNAL_METHOD) ( #define ACPI_BTYPE_BUFFER_FIELD 0x00002000 #define ACPI_BTYPE_DDB_HANDLE 0x00004000 #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 -#define ACPI_BTYPE_REFERENCE 0x00010000 +#define ACPI_BTYPE_REFERENCE_OBJECT 0x00010000 /* From Index(), RefOf(), etc (Type6Opcodes) */ #define ACPI_BTYPE_RESOURCE 0x00020000 +#define ACPI_BTYPE_NAMED_REFERENCE 0x00040000 /* Generic unresolved Name or Namepath */ #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) -#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) + + /* Used by Copy, DeRefOf, Store, Printf, Fprintf */ + +#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE_OBJECT | ACPI_BTYPE_DDB_HANDLE) #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF @@ -1017,7 +1019,7 @@ typedef struct acpi_parse_state #define ACPI_PARSEOP_PARAMLIST 0x02 #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 #define ACPI_PARSEOP_PREDEF_CHECKED 0x08 -#define ACPI_PARSEOP_SPECIAL 0x10 +#define ACPI_PARSEOP_CLOSING_PAREN 0x10 #define ACPI_PARSEOP_COMPOUND 0x20 #define ACPI_PARSEOP_ASSIGNMENT 0x40 diff --git a/source/include/acopcode.h b/source/include/acopcode.h index 9432d61..a2d8d3c 100644 --- a/source/include/acopcode.h +++ b/source/include/acopcode.h @@ -213,7 +213,7 @@ #define ARGI_ARG4 ARG_NONE #define ARGI_ARG5 ARG_NONE #define ARGI_ARG6 ARG_NONE -#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE +#define ARGI_BANK_FIELD_OP ARGI_LIST1 (ARGI_INTEGER) #define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) @@ -309,7 +309,7 @@ #define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER) #define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER) #define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE -#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF) +#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_STORE_TARGET) #define ARGI_STRING_OP ARGI_INVALID_OPCODE #define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 888d6b2..7997271 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 0x20150818 +#define ACPI_CA_VERSION 0x20150930 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/actbl1.h b/source/include/actbl1.h index 3a11553..67f1592 100644 --- a/source/include/actbl1.h +++ b/source/include/actbl1.h @@ -1184,7 +1184,7 @@ typedef struct acpi_nfit_memory_map #define ACPI_NFIT_MEM_SAVE_FAILED (1) /* 00: Last SAVE to Memory Device failed */ #define ACPI_NFIT_MEM_RESTORE_FAILED (1<<1) /* 01: Last RESTORE from Memory Device failed */ #define ACPI_NFIT_MEM_FLUSH_FAILED (1<<2) /* 02: Platform flush failed */ -#define ACPI_NFIT_MEM_ARMED (1<<3) /* 03: Memory Device observed to be not armed */ +#define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device is not armed */ #define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */ #define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */ diff --git a/source/include/amlcode.h b/source/include/amlcode.h index d56f6d9..b9b8ad5 100644 --- a/source/include/amlcode.h +++ b/source/include/amlcode.h @@ -280,14 +280,15 @@ #define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */ #define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */ #define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */ +#define ARGI_STORE_TARGET 0x12 /* Target for store is TARGETREF + package objects */ /* Multiple/complex types */ -#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/ -#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ -#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ -#define ARGI_REGION_OR_BUFFER 0x15 /* Used by LOAD op only */ -#define ARGI_DATAREFOBJ 0x16 +#define ARGI_DATAOBJECT 0x13 /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/ +#define ARGI_COMPLEXOBJ 0x14 /* Buffer, String, or package (Used by INDEX op only) */ +#define ARGI_REF_OR_STRING 0x15 /* Reference or String (Used by DEREFOF op only) */ +#define ARGI_REGION_OR_BUFFER 0x16 /* Used by LOAD op only */ +#define ARGI_DATAREFOBJ 0x17 /* Note: types above can expand to 0x1F maximum */ diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h index 6150f2b..051c3bb 100644 --- a/source/include/platform/acenv.h +++ b/source/include/platform/acenv.h @@ -297,6 +297,7 @@ #define ACPI_INTERNAL_VAR_XFACE #endif + /* * Debugger threading model * Use single threaded if the entire subsystem is contained in an application @@ -306,11 +307,11 @@ * multi-threaded if ACPI_APPLICATION is not set. */ #ifndef DEBUGGER_THREADING -#ifdef ACPI_APPLICATION -#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED +#if !defined (ACPI_APPLICATION) || defined (ACPI_EXEC_APP) +#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED #else -#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED +#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED #endif #endif /* !DEBUGGER_THREADING */ diff --git a/source/tools/acpidump/apfiles.c b/source/tools/acpidump/apfiles.c index 1b05984..4e866ef 100644 --- a/source/tools/acpidump/apfiles.c +++ b/source/tools/acpidump/apfiles.c @@ -173,7 +173,7 @@ ApWriteToBinaryFile ( strcat (Filename, InstanceStr); } - strcat (Filename, ACPI_TABLE_FILE_SUFFIX); + strcat (Filename, FILE_SUFFIX_BINARY_TABLE); if (Gbl_VerboseMode) { diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c index 895a27f..9fce63d 100644 --- a/source/tools/acpiexec/aehandlers.c +++ b/source/tools/acpiexec/aehandlers.c @@ -418,7 +418,7 @@ AeExceptionHandler ( if (NewAmlStatus != AmlStatus) { - AcpiOsPrintf ("[AcpiExec] Exception override, new status %s\n", + AcpiOsPrintf ("[AcpiExec] Exception override, new status %s\n\n", AcpiFormatException (NewAmlStatus)); } diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index 6e839e9..861cb49 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -336,7 +336,7 @@ AeDoOptions ( case '?': usage(); - return (0); + return (1); case 'i': @@ -344,7 +344,7 @@ AeDoOptions ( if (!Temp || (Temp > ACPI_UINT16_MAX)) { printf ("%s: Invalid max loops value\n", AcpiGbl_Optarg); - return (1); + return (-1); } AcpiGbl_MaxLoopIterations = (UINT16) Temp; @@ -387,7 +387,7 @@ AeDoOptions ( case '^': /* -v: (Version): signon already emitted, just exit */ (void) AcpiOsTerminate (); - exit (0); + return (1); case 'i': @@ -445,6 +445,7 @@ main ( ACPI_TABLE_HEADER *Table = NULL; UINT32 TableCount; AE_TABLE_DESC *TableDesc; + int ExitCode = 0; ACPI_DEBUG_INITIALIZE (); /* For debug version only */ @@ -488,8 +489,13 @@ main ( /* Get the command line options */ - if (AeDoOptions (argc, argv)) + ExitCode = AeDoOptions (argc, argv); + if (ExitCode) { + if (ExitCode > 0) + { + ExitCode = 0; + } goto ErrorExit; } @@ -660,7 +666,7 @@ EnterDebugger: ErrorExit: (void) AcpiOsTerminate (); - return (-1); + return (ExitCode); } |