Import ACPICA 20150930.

This commit is contained in:
Jung-uk Kim 2015-09-30 20:13:30 +00:00
parent c25a97c7b4
commit 1e24cf365b
47 changed files with 3063 additions and 2358 deletions

View File

@ -1,8 +1,98 @@
----------------------------------------
30 September 2015. Summary of changes for version 20150930:
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:
This release is available at https://acpica.org/downloads
1) ACPICA kernel-resident subsystem:
Fix a regression for AcpiGetTableByIndex interface causing it to fail. Lv

View File

@ -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

View File

@ -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\

View File

@ -99,7 +99,7 @@ AdGenerateFilename (
}
FilenameBuf[i] = 0;
strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX);
strcat (FilenameBuf, FILE_SUFFIX_BINARY_TABLE);
return (FilenameBuf);
}

View File

@ -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

View File

@ -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 */

View File

@ -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

209
source/compiler/aslcstyle.y Normal file
View File

@ -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));}
;

View File

@ -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

View File

@ -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

View File

@ -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");
}

View File

@ -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),

View File

@ -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:

View File

@ -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 !*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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 */

View File

@ -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:

View File

@ -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 */

View File

@ -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

View File

@ -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");
}
}
}

View File

@ -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 ();

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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

View File

@ -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:

View File

@ -673,6 +673,7 @@ AcpiExConvertToTargetType (
break;
case ARGI_TARGETREF:
case ARGI_STORE_TARGET:
switch (DestinationType)
{

View File

@ -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;
}

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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 */

View File

@ -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]");
}
return (AcpiUtGetTypeName (ObjDesc->Common.Type));
/* 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_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 *

View File

@ -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);
}

View File

@ -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;
}

View File

@ -94,7 +94,7 @@
#define FILE_SUFFIX_DISASSEMBLY "dsl"
#define ACPI_TABLE_FILE_SUFFIX ".dat"
#define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */
/*

View File

@ -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[] =

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -173,7 +173,7 @@ ApWriteToBinaryFile (
strcat (Filename, InstanceStr);
}
strcat (Filename, ACPI_TABLE_FILE_SUFFIX);
strcat (Filename, FILE_SUFFIX_BINARY_TABLE);
if (Gbl_VerboseMode)
{

View File

@ -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));
}

View File

@ -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);
}