From 0348a72d5a1ebc0c39a73672e313292b4399bca0 Mon Sep 17 00:00:00 2001 From: Al Stone Date: May 31 2020 21:48:19 +0000 Subject: Merge branch 'master' into debian --- diff --git a/changes.txt b/changes.txt index 27a2ee3..ec64db2 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,61 @@ ---------------------------------------- + + +30 April 2020. Summary of changes for version 20200430: + + +1) ACPICA kernel-resident subsystem: + +Cleaned up the coding style of a couple of global variables +(AcpiGbl_NextCmdNum and AcpiProtocolLengths) caught by static analyzers. +AcpiProtocolLengths was made static, and the definition of +AcpiGbl_NextCmdNum was moved to acglobal.h. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL DataTable Compiler: Fixed a segfault on errors that aren't directly +associated with a field. + +Disassembler: has been made more resilient so that it will continue to +parse AML even if the AML generates ACPI namespace errors. This enables +iASL to disassemble some AML that may have been compiled using older +versions of iASL that no longer compile with newer versions of iASL. + +iASL: Fixed the required parameters for _NIH and _NIG. Previously, there +was a mixup where _NIG required one parameter and _NIH required zero +parameters. This change swaps these parameter requirements. Now it is +required that _NIH must be called with one parameter and _NIG requires +zero parameters. + +iASL: Allow use of undefined externals as long as they are protected by +an if (CondRefOf (...)) block when compiling multiple definition blocks. + +iASL: Fixed the type override behavior of named objects that are declared +as External. External declarations will no longer override the type of +the actual definition if it already exists. + +AcpiNames: Added setargv.obj to the MSVC 2017 link sequence to enable +command line wildcard support on Windows. Note: the AcpiNames utility is +essentially redundant with the AcpiExec utility (using the "namespace" +command) and is therefore deprecated. It will be removed in future +releases of ACPICA. + +Disassembler: ignore AE_ALREADY_EXISTS status when parsing create* +operators. The disassembler is intended to emit existing ASL code as-is. +Therefore, error messages emitted during disassembly should be ignored or +handled in a way such that the disassembler can continue to parse the +AML. This change ignores AE_ALREADY_EXISTS errors during the deferred Op +parsing for create operators in order to complete parsing ASL termlists. + +iASL DataTable Compiler: IVRS table: fix potentially uninitialized +variable warning. Some compilers catch potential uninitialized variables. +This is done by examining branches of if/else statements. This change +replaces an "else if" with an "else" to fix the uninitialized variable +warning. + + +---------------------------------------- 26 March 2020. Summary of changes for version 20200326: @@ -674,7 +731,7 @@ temporary. iASL: Emit error for creation of a zero-length operation region. Such a region is rather pointless. If encountered, a runtime error is also -implemented in the interpeter. +implemented in the interpreter. Debugger: Fix a possible fault with the "test objects" command. diff --git a/source/common/acgetline.c b/source/common/acgetline.c index 6088b89..1400bd1 100644 --- a/source/common/acgetline.c +++ b/source/common/acgetline.c @@ -81,8 +81,6 @@ AcpiAcClearLine ( #define _ASCII_LEFT_ARROW 'D' #define _ASCII_NEWLINE '\n' -extern UINT32 AcpiGbl_NextCmdNum; - /* Erase a single character on the input command line */ #define ACPI_CLEAR_CHAR() \ diff --git a/source/common/dmtbdump2.c b/source/common/dmtbdump2.c index d870973..b03440d 100644 --- a/source/common/dmtbdump2.c +++ b/source/common/dmtbdump2.c @@ -420,8 +420,10 @@ AcpiDmDumpIvrs ( DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable, sizeof (ACPI_IVRS_HARDWARE1)); } - else if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2) + else { + /* ACPI_IVRS_TYPE_HARDWARE2 subtable type */ + EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE2); DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable, sizeof (ACPI_IVRS_HARDWARE2)); diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index 745f164..c221f12 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -711,7 +711,7 @@ NamePathTail [.]{NameSeg} } /* - * The eror code is contained inside the + * The error code is contained inside the * {ErrorCode} pattern. Extract it and log it * as the expected error code. */ diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index 216563d..6edab30 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: dswload - Dispatcher namespace load callbacks + * Module Name: aslload - compiler namespace load callbacks * *****************************************************************************/ @@ -93,7 +93,6 @@ LdAnalyzeExternals ( ACPI_NAMESPACE_NODE *Node, ACPI_PARSE_OBJECT *Op, ACPI_OBJECT_TYPE ExternalOpType, - ACPI_OBJECT_TYPE ObjectType, ACPI_WALK_STATE *WalkState); @@ -407,7 +406,6 @@ LdNamespace1Begin ( ACPI_PARSE_OBJECT *MethodOp; ACPI_STATUS Status; ACPI_OBJECT_TYPE ObjectType; - ACPI_OBJECT_TYPE ActualObjectType = ACPI_TYPE_ANY; char *Path; UINT32 Flags = ACPI_NS_NO_UPSEARCH; ACPI_PARSE_OBJECT *Arg; @@ -581,8 +579,7 @@ LdNamespace1Begin ( * * first child is name, next child is ObjectType */ - ActualObjectType = (UINT8) Op->Asl.Child->Asl.Next->Asl.Value.Integer; - ObjectType = ACPI_TYPE_ANY; + ObjectType = (UINT8) Op->Asl.Child->Asl.Next->Asl.Value.Integer; /* * We will mark every new node along the path as "External". This @@ -601,7 +598,7 @@ LdNamespace1Begin ( * Store (\_SB_.PCI0.ABCD, Local0) * } */ - Flags |= ACPI_NS_EXTERNAL; + Flags |= ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE; break; case PARSEOP_DEFAULT_ARG: @@ -805,8 +802,7 @@ LdNamespace1Begin ( else if ((Node->Flags & ANOBJ_IS_EXTERNAL) || (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) { - Status = LdAnalyzeExternals (Node, Op, ActualObjectType, - ObjectType, WalkState); + Status = LdAnalyzeExternals (Node, Op, ObjectType, WalkState); if (ACPI_FAILURE (Status)) { if (Status == AE_ERROR) @@ -821,6 +817,19 @@ LdNamespace1Begin ( } return_ACPI_STATUS (Status); } + + if (!(Node->Flags & ANOBJ_IS_EXTERNAL) && + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) + { + /* + * If we get to here, it means that an actual definition of + * the object declared external exists. Meaning that Op + * loading this this Op should have no change to the ACPI + * namespace. By going to FinishNode, we skip the + * assignment of Node->Op = Op. + */ + goto FinishNode; + } } else { @@ -872,30 +881,15 @@ LdNamespace1Begin ( } } -FinishNode: - /* - * Point the parse node to the new namespace node, and point - * the Node back to the original Parse node - */ - Op->Asl.Node = Node; + /* Point the Node back to the original Parse node */ + Node->Op = Op; - /* - * Set the actual data type if appropriate (EXTERNAL term only) - * As of 11/19/2019, ASL External() does not support parameter - * counts. When an External method is loaded, the parameter count is - * recorded in the external's arg count parameter. The parameter count may - * or may not be known in the declaration. If the value of this node turns - * out to be ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS, it indicates that - * we do not know the parameter count and that we must look at the usage of - * the External method call to get this information. - */ - if (ActualObjectType != ACPI_TYPE_ANY) - { - Node->Type = (UINT8) ActualObjectType; - Node->Value = (UINT32) - Op->Asl.Child->Asl.Next->Asl.Next->Asl.Value.Integer; - } +FinishNode: + + /* Point the parse node to the new namespace node */ + + Op->Asl.Node = Node; if (Op->Asl.ParseOpcode == PARSEOP_METHOD) { @@ -905,6 +899,13 @@ FinishNode: */ Node->Value = (UINT32) Op->Asl.Extra; } + else if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL && + Node->Type == ACPI_TYPE_METHOD && + (Node->Flags & ANOBJ_IS_EXTERNAL)) + { + Node->Value = + (UINT32) Op->Asl.Child->Asl.Next->Asl.Next->Asl.Value.Integer; + } return_ACPI_STATUS (Status); } @@ -912,7 +913,7 @@ FinishNode: /******************************************************************************* * - * FUNCTION: LdAnalyzeExternals + * FUNCTION: LdMatchExternType * * PARAMETERS: Type1 * Type2 @@ -929,7 +930,7 @@ FinishNode: ******************************************************************************/ static BOOLEAN -LdTypesMatchExternType ( +LdMatchExternType ( ACPI_OBJECT_TYPE Type1, ACPI_OBJECT_TYPE Type2) { @@ -985,7 +986,6 @@ LdTypesMatchExternType ( * PARAMETERS: Node - Node that represents the named object * Op - Named object declaring this named object * ExternalOpType - Type of ExternalOp - * ObjectType - Type of Declared object * WalkState - Current WalkState * * RETURN: Status @@ -1003,7 +1003,6 @@ LdAnalyzeExternals ( ACPI_NAMESPACE_NODE *Node, ACPI_PARSE_OBJECT *Op, ACPI_OBJECT_TYPE ExternalOpType, - ACPI_OBJECT_TYPE ObjectType, ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status = AE_OK; @@ -1027,12 +1026,12 @@ LdAnalyzeExternals ( else { ActualExternalOpType = Node->Type; - ActualOpType = ObjectType; + ActualOpType = ExternalOpType; } if ((ActualOpType != ACPI_TYPE_ANY) && (ActualExternalOpType != ACPI_TYPE_ANY) && - !LdTypesMatchExternType (ActualExternalOpType, ActualOpType)) + !LdMatchExternType (ActualExternalOpType, ActualOpType)) { if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL && Node->Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) @@ -1060,6 +1059,8 @@ LdAnalyzeExternals ( } } + /* Set the object type of the external */ + if ((Node->Flags & ANOBJ_IS_EXTERNAL) && (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL)) { @@ -1068,13 +1069,13 @@ LdAnalyzeExternals ( * previously declared External */ Node->Flags &= ~ANOBJ_IS_EXTERNAL; - Node->Type = (UINT8) ObjectType; + Node->Type = (UINT8) ExternalOpType; /* Just retyped a node, probably will need to open a scope */ - if (AcpiNsOpensScope (ObjectType)) + if (AcpiNsOpensScope (ExternalOpType)) { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); + Status = AcpiDsScopeStackPush (Node, ExternalOpType, WalkState); if (ACPI_FAILURE (Status)) { return (Status); @@ -1095,7 +1096,7 @@ LdAnalyzeExternals ( } else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) && - (ObjectType == ACPI_TYPE_ANY)) + (ExternalOpType == ACPI_TYPE_ANY)) { /* Allow update of externals of unknown type. */ diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c index 66a4f0c..ce31143 100644 --- a/source/compiler/aslmessages.c +++ b/source/compiler/aslmessages.c @@ -272,6 +272,7 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_TYPE_MISMATCH_FOUND_HERE */ "Actual object declaration:", /* ASL_MSG_DUPLICATE_EXTERN_MISMATCH */ "Type mismatch between multiple external declarations detected", /* ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE */"Duplicate external declaration:", +/* ASL_MSG_CONDREF_NEEDS_EXTERNAL_DECL */"CondRefOf parameter requires External() declaration", }; /* Table compiler */ diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h index c16d6d4..2a3c29c 100644 --- a/source/compiler/aslmessages.h +++ b/source/compiler/aslmessages.h @@ -274,6 +274,7 @@ typedef enum ASL_MSG_TYPE_MISMATCH_FOUND_HERE, ASL_MSG_DUPLICATE_EXTERN_MISMATCH, ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE, + ASL_MSG_CONDREF_NEEDS_EXTERNAL_DECL, /* These messages are used by the Data Table compiler only */ diff --git a/source/compiler/aslpredef.c b/source/compiler/aslpredef.c index 15bdfe6..7b9748a 100644 --- a/source/compiler/aslpredef.c +++ b/source/compiler/aslpredef.c @@ -566,7 +566,7 @@ ApCheckForSpecialName ( /* * Was not actually emitted by the compiler. This is a special case, * however. If the ASL code being compiled was the result of a - * dissasembly, it may possibly contain valid compiler-emitted names + * disassembly, it may possibly contain valid compiler-emitted names * of the form "_T_x". We don't want to issue an error or even a * warning and force the user to manually change the names. So, we * will issue a remark instead. diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c index bfa7c60..b8f3d75 100644 --- a/source/compiler/aslxref.c +++ b/source/compiler/aslxref.c @@ -91,6 +91,16 @@ XfCheckFieldRange ( UINT32 FieldBitLength, UINT32 AccessBitWidth); +static BOOLEAN +XfFindCondRefOfName ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op); + +static BOOLEAN +XfRefIsGuardedByIfCondRefOf ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op); + /******************************************************************************* * @@ -474,17 +484,6 @@ XfNamespaceLocateBegin ( } /* - * One special case: CondRefOf operator - we don't care if the name exists - * or not at this point, just ignore it, the point of the operator is to - * determine if the name exists at runtime. - */ - if ((Op->Asl.Parent) && - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) - { - return_ACPI_STATUS (AE_OK); - } - - /* * We must enable the "search-to-root" for single NameSegs, but * we have to be very careful about opening up scopes */ @@ -492,7 +491,8 @@ XfNamespaceLocateBegin ( if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) || - (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) || + (Op->Asl.ParseOpcode == PARSEOP_CONDREFOF)) { /* * These are name references, do not push the scope stack @@ -557,7 +557,22 @@ XfNamespaceLocateBegin ( * We didn't find the name reference by path -- we can qualify this * a little better before we print an error message */ - if (strlen (Path) == ACPI_NAMESEG_SIZE) + + if ((Op->Asl.Parent) && + (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) + { + /* + * One special case: CondRefOf operator - if the name doesn't + * exist at this point, it means that there's no actual or + * external declaration. If the name is not found, just ignore + * it, the point of the operator is to determine if the name + * exists at runtime. We wanted to see if this named object + * exists to facilitate analysis to allow protected usage of + * undeclared externals. + */ + return_ACPI_STATUS (AE_OK); + } + else if (strlen (Path) == ACPI_NAMESEG_SIZE) { /* A simple, one-segment ACPI name */ @@ -1082,6 +1097,7 @@ XfNamespaceLocateBegin ( /* * 5) Check for external resolution + * * By this point, everything should be loaded in the namespace. If a * namespace lookup results in a namespace node that is an external, it * means that this named object was not defined in the input ASL. This @@ -1089,11 +1105,38 @@ XfNamespaceLocateBegin ( * use the external keyword to suppress compiler errors about undefined * objects. Note: this only applies when compiling multiple definition * blocks. + * + * Do not check for external resolution in the following cases: + * + * case 1) External (ABCD) + * + * This declares ABCD as an external so there is no requirement for + * ABCD to be loaded in the namespace when analyzing the actual + * External() statement. + * + * case 2) CondRefOf (ABCD) + * + * This operator will query the ACPI namespace on the existence of + * ABCD. If ABCD does not exist, this operator will return a 0 + * without incurring AML runtime errors. Therefore, ABCD is allowed + * to not exist when analyzing the CondRefOf operator. + * + * case 3) External (ABCD) + * if (CondRefOf (ABCD)) + * { + * Store (0, ABCD) + * } + * + * In this case, ABCD is accessed only if it exists due to the if + * statement so there is no need to flag the ABCD nested in the + * store operator. */ if (AslGbl_ParseTreeRoot->Asl.Child && AslGbl_ParseTreeRoot->Asl.Child->Asl.Next && - (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL && - Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL) && - (Node->Flags & ANOBJ_IS_EXTERNAL)) + (Node->Flags & ANOBJ_IS_EXTERNAL) && + Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL && + Op->Asl.ParseOpcode != PARSEOP_EXTERNAL && + Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_CONDREFOF && + !XfRefIsGuardedByIfCondRefOf (Node, Op)) { AslError (ASL_ERROR, ASL_MSG_UNDEFINED_EXTERNAL, Op, NULL); } @@ -1113,6 +1156,96 @@ XfNamespaceLocateBegin ( /******************************************************************************* * + * FUNCTION: XfRefIsGuardedByIfCondRefOf + * + * PARAMETERS: Node - Named object reference node + * Op - Named object reference parse node + * + * RETURN: BOOLEAN + * + * DESCRIPTION: returns true if Op checked inside if (CondRefOf (...)) + * refers to Node. + * + ******************************************************************************/ + +static BOOLEAN +XfRefIsGuardedByIfCondRefOf ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *Parent = Op->Asl.Parent; + + + while (Parent) + { + if (Parent->Asl.ParseOpcode == PARSEOP_IF && + XfFindCondRefOfName (Node, Parent->Asl.Child)) + { + return (TRUE); + } + + Parent = Parent->Asl.Parent; + } + + return (FALSE); +} + + +/******************************************************************************* + * + * FUNCTION: XfRefIsGuardedByIfCondRefOf + * + * PARAMETERS: Node - Named object reference node + * Op - Named object reference parse node + * + * RETURN: BOOLEAN + * + * DESCRIPTION: returns true if Op checked inside if (CondRefOf (...)) + * refers to Node. + * + ******************************************************************************/ + +static BOOLEAN +XfFindCondRefOfName ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op) +{ + BOOLEAN CondRefOfFound = FALSE; + + + if (!Op) + { + return (FALSE); + } + + switch (Op->Asl.ParseOpcode) + { + case PARSEOP_CONDREFOF: + + return (Op->Asl.Child->Common.Node == Node); + break; + + case PARSEOP_LAND: + + CondRefOfFound = XfFindCondRefOfName (Node, Op->Asl.Child); + if (CondRefOfFound) + { + return (TRUE); + } + + return (XfFindCondRefOfName (Node, Op->Asl.Child->Asl.Next)); + break; + + default: + + return (FALSE); + break; + } +} + + +/******************************************************************************* + * * FUNCTION: XfNamespaceLocateEnd * * PARAMETERS: ASL_WALK_CALLBACK diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c index e5be2c4..d89fc82 100644 --- a/source/compiler/dtutils.c +++ b/source/compiler/dtutils.c @@ -78,11 +78,20 @@ DtError ( DT_FIELD *FieldObject, char *ExtraMessage) { + UINT32 Line = 0; + + + /* Field object could be NULL */ + + if (FieldObject) + { + Line = FieldObject->Line; + } /* Check if user wants to ignore this exception */ if (AslIsExceptionIgnored (AslGbl_Files[ASL_FILE_INPUT].Filename, - FieldObject->Line, Level, MessageId)) + Line, Level, MessageId)) { return; } diff --git a/source/components/debugger/dbhistry.c b/source/components/debugger/dbhistry.c index c936401..483d9aa 100644 --- a/source/components/debugger/dbhistry.c +++ b/source/components/debugger/dbhistry.c @@ -67,7 +67,6 @@ static HISTORY_INFO AcpiGbl_HistoryBuffer[HISTORY_SIZE]; static UINT16 AcpiGbl_LoHistory = 0; static UINT16 AcpiGbl_NumHistory = 0; static UINT16 AcpiGbl_NextHistoryIndex = 0; -UINT32 AcpiGbl_NextCmdNum = 1; /******************************************************************************* diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c index af659e2..f20254f 100644 --- a/source/components/disassembler/dmbuffer.c +++ b/source/components/disassembler/dmbuffer.c @@ -292,6 +292,10 @@ AcpiDmIsUuidBuffer ( /* Buffer size is the buffer argument */ SizeOp = Op->Common.Value.Arg; + if (!SizeOp) + { + return (FALSE); + } /* Next, the initializer byte list to examine */ @@ -412,6 +416,10 @@ AcpiDmIsUnicodeBuffer ( /* Buffer size is the buffer argument */ SizeOp = Op->Common.Value.Arg; + if (!SizeOp) + { + return (FALSE); + } /* Next, the initializer byte list to examine */ @@ -488,6 +496,10 @@ AcpiDmIsStringBuffer ( /* Buffer size is the buffer argument */ SizeOp = Op->Common.Value.Arg; + if (!SizeOp) + { + return (FALSE); + } /* Next, the initializer byte list to examine */ @@ -567,13 +579,18 @@ AcpiDmIsPldBuffer ( UINT64 InitializerSize; + if (!Op) + { + return (FALSE); + } + /* * Get the BufferSize argument - Buffer(BufferSize) * If the buffer was generated by the ToPld macro, it must * be a BYTE constant. */ SizeOp = Op->Common.Value.Arg; - if (SizeOp->Common.AmlOpcode != AML_BYTE_OP) + if (!SizeOp || SizeOp->Common.AmlOpcode != AML_BYTE_OP) { return (FALSE); } diff --git a/source/components/dispatcher/dsfield.c b/source/components/dispatcher/dsfield.c index b2a29c9..e2a08bb 100644 --- a/source/components/dispatcher/dsfield.c +++ b/source/components/dispatcher/dsfield.c @@ -233,7 +233,12 @@ AcpiDsCreateBufferField ( Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); - if (ACPI_FAILURE (Status)) + if ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) && + Status == AE_ALREADY_EXISTS) + { + Status = AE_OK; + } + else if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Arg->Common.Value.String, Status); @@ -574,12 +579,21 @@ AcpiDsCreateField ( Info.RegionNode = RegionNode; Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); - if (Info.RegionNode->Object->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM && - !(RegionNode->Object->Field.InternalPccBuffer - = ACPI_ALLOCATE_ZEROED(Info.RegionNode->Object->Region.Length))) + if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS (Status); } + + if (Info.RegionNode->Object->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM) + { + RegionNode->Object->Field.InternalPccBuffer = + ACPI_ALLOCATE_ZEROED(Info.RegionNode->Object->Region.Length); + if (!RegionNode->Object->Field.InternalPccBuffer) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + } + return_ACPI_STATUS (Status); } diff --git a/source/components/executer/exfield.c b/source/components/executer/exfield.c index e206456..3f7c560 100644 --- a/source/components/executer/exfield.c +++ b/source/components/executer/exfield.c @@ -59,7 +59,7 @@ #define ACPI_INVALID_PROTOCOL_ID 0x80 #define ACPI_MAX_PROTOCOL_ID 0x0F -const UINT8 AcpiProtocolLengths[] = +static const UINT8 AcpiProtocolLengths[] = { ACPI_INVALID_PROTOCOL_ID, /* 0 - reserved */ ACPI_INVALID_PROTOCOL_ID, /* 1 - reserved */ diff --git a/source/include/acglobal.h b/source/include/acglobal.h index 37a95b1..806fa43 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -328,6 +328,7 @@ ACPI_GLOBAL (ACPI_EXTERNAL_FILE *, AcpiGbl_ExternalFileList); #ifdef ACPI_DEBUGGER ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_AbortMethod, FALSE); ACPI_INIT_GLOBAL (ACPI_THREAD_ID, AcpiGbl_DbThreadId, ACPI_INVALID_THREAD_ID); +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NextCmdNum, 1); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoIniMethods); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoRegionSupport); diff --git a/source/include/acpixf.h b/source/include/acpixf.h index d350384..c371ccd 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 0x20200326 +#define ACPI_CA_VERSION 0x20200430 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/acpredef.h b/source/include/acpredef.h index d6dd679..2b6173d 100644 --- a/source/include/acpredef.h +++ b/source/include/acpredef.h @@ -661,10 +661,10 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = {{"_NIC", METHOD_0ARGS, /* ACPI 6.3 */ METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - {{"_NIG", METHOD_1ARGS (ACPI_TYPE_BUFFER), /* ACPI 6.3 */ + {{"_NIG", METHOD_0ARGS, /* ACPI 6.3 */ METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - {{"_NIH", METHOD_0ARGS, /* ACPI 6.3 */ + {{"_NIH", METHOD_1ARGS (ACPI_TYPE_BUFFER), /* ACPI 6.3 */ METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, {{"_NTT", METHOD_0ARGS, diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index 0ec9ffb..cbd8eb2 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -525,6 +525,7 @@ main ( ACPI_CHECK_OK (AcpiInitializeSubsystem, Status); if (ACPI_FAILURE (Status)) { + ExitCode = -1; goto ErrorExit; } @@ -538,6 +539,7 @@ main ( ACPI_CHECK_OK (AcpiInitializeDebugger, Status); if (ACPI_FAILURE (Status)) { + ExitCode = -1; goto ErrorExit; } @@ -599,6 +601,7 @@ main ( Status = AeBuildLocalTables (ListHead); if (ACPI_FAILURE (Status)) { + ExitCode = -1; goto ErrorExit; } @@ -635,8 +638,9 @@ main ( Status = AeLoadTables (); if (ACPI_FAILURE (Status)) { - ExitCode = -1; - goto ErrorExit; + printf ("**** Could not load ACPI tables, %s\n", + AcpiFormatException (Status)); + goto EnterDebugger; } /* @@ -649,13 +653,6 @@ main ( goto EnterDebugger; } - if (ACPI_FAILURE (Status)) - { - printf ("**** Could not load ACPI tables, %s\n", - AcpiFormatException (Status)); - goto EnterDebugger; - } - /* Setup initialization flags for ACPICA */ InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE); diff --git a/tests/aslts/src/runtime/collections/Identity2MS/abbu/MsFail/msfail.asl b/tests/aslts/src/runtime/collections/Identity2MS/abbu/MsFail/msfail.asl index b258928..f0a67d7 100644 --- a/tests/aslts/src/runtime/collections/Identity2MS/abbu/MsFail/msfail.asl +++ b/tests/aslts/src/runtime/collections/Identity2MS/abbu/MsFail/msfail.asl @@ -204,7 +204,7 @@ Method(mf04,, Serialized) Store(0x00001001, arg6) - // Doesnt work: + // Doesn't work: // Return (Add(arg6, 5)) // Return (0) } diff --git a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel10.asl b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel10.asl index 0c9ade1..437a6e6 100644 --- a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel10.asl +++ b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel10.asl @@ -272,7 +272,7 @@ Method(mf8c,, Serialized) } /* - * 5 - Check DerefOf() - but String doesnt refer NameSpace object + * 5 - Check DerefOf() - but String doesn't refer NameSpace object */ Method(mf8d) { @@ -432,7 +432,7 @@ Method(mf90,, Serialized) } /* - * 9 - Check DerefOf() - but String doesnt refer NameSpace object + * 9 - Check DerefOf() - but String doesn't refer NameSpace object */ Method(mf91) { diff --git a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel20.asl b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel20.asl index 7eb0135..f5460fa 100644 --- a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel20.asl +++ b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel20.asl @@ -275,7 +275,7 @@ Method(mf8c,, Serialized) } /* - * 5 - Check DerefOf() - but String doesnt refer NameSpace object + * 5 - Check DerefOf() - but String doesn't refer NameSpace object */ Method(mf8d) { @@ -435,7 +435,7 @@ Method(mf90,, Serialized) } /* - * 9 - Check DerefOf() - but String doesnt refer NameSpace object + * 9 - Check DerefOf() - but String doesn't refer NameSpace object */ Method(mf91) { diff --git a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel21_DeclDown.asl b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel21_DeclDown.asl index 7fe2f03..286a028 100644 --- a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel21_DeclDown.asl +++ b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel21_DeclDown.asl @@ -206,7 +206,7 @@ Method(mf8c) } /* - * 5 - Check DerefOf() - but String doesnt refer NameSpace object + * 5 - Check DerefOf() - but String doesn't refer NameSpace object */ Method(mf8d) { @@ -337,7 +337,7 @@ Method(mf90) } /* - * 9 - Check DerefOf() - but String doesnt refer NameSpace object + * 9 - Check DerefOf() - but String doesn't refer NameSpace object */ Method(mf91) { diff --git a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel21_DeclUp.asl b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel21_DeclUp.asl index b0b72ff..af2f5fc 100644 --- a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel21_DeclUp.asl +++ b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0012/DataLevel21_DeclUp.asl @@ -334,7 +334,7 @@ Method(mf8c) } /* - * 5 - Check DerefOf() - but String doesnt refer NameSpace object + * 5 - Check DerefOf() - but String doesn't refer NameSpace object */ Method(mf8d) { @@ -465,7 +465,7 @@ Method(mf90) } /* - * 9 - Check DerefOf() - but String doesnt refer NameSpace object + * 9 - Check DerefOf() - but String doesn't refer NameSpace object */ Method(mf91) { diff --git a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0024_ASL/DECL.asl b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0024_ASL/DECL.asl index 9477c07..d0c3f64 100644 --- a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0024_ASL/DECL.asl +++ b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0024_ASL/DECL.asl @@ -31,7 +31,7 @@ * * SUMMARY: The EISAID doesn't provides input control of "uppercase letter" part (UUU) of EisaIdString * - * Error/Warning expected but doesnt occur + * Error/Warning expected but doesn't occur */ Method(mdb9) diff --git a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0031_ASL_RUNTIME/DECL.asl b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0031_ASL_RUNTIME/DECL.asl index a793b17..17b5e85 100644 --- a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0031_ASL_RUNTIME/DECL.asl +++ b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0031_ASL_RUNTIME/DECL.asl @@ -30,7 +30,7 @@ * * SUMMARY: The ASL Compiler doesn't try to detect and reject attempts to use object before its declaration is evaluated * - * ASL-compiler doesnt result in Error + * ASL-compiler doesn't result in Error * * ATTENTION: * diff --git a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0154/DECL.asl b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0154/DECL.asl index bb098b7..ae805a5 100644 --- a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0154/DECL.asl +++ b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0154/DECL.asl @@ -30,7 +30,7 @@ * * SUMMARY: Exception occurs on attempt to rewrite Device type object passed by ArgX to Method * - * Check that exception doesnt occur + * Check that exception doesn't occur */ Method (MF43, 1, NotSerialized) { diff --git a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0160/DECL.asl b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0160/DECL.asl index 61ef6d0..dc37dd2 100644 --- a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0160/DECL.asl +++ b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0160/DECL.asl @@ -30,7 +30,7 @@ * * SUMMARY: Attempt to declare Field inside the If scope causes exception * - * Check that exception doesnt occur + * Check that exception doesn't occur */ Method (MF48, 0, Serialized) { diff --git a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0167/DECL.asl b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0167/DECL.asl index a76dcec..cbfa88b 100644 --- a/tests/aslts/src/runtime/collections/bdemo/ACPICA/0167/DECL.asl +++ b/tests/aslts/src/runtime/collections/bdemo/ACPICA/0167/DECL.asl @@ -30,7 +30,7 @@ * * SUMMARY: Manipulation test PASS but started reporting suspicious diagnostic * - * Check that messages doesnt occur... + * Check that messages doesn't occur... * but since it was due to the incorrect size of Package * generated in that case we do this test as runtime test * (but not ACTION_REQUIRED type). diff --git a/tests/aslts/src/runtime/collections/exceptions/exc/exc.asl b/tests/aslts/src/runtime/collections/exceptions/exc/exc.asl index 49408d5..06f9e97 100644 --- a/tests/aslts/src/runtime/collections/exceptions/exc/exc.asl +++ b/tests/aslts/src/runtime/collections/exceptions/exc/exc.asl @@ -1074,7 +1074,7 @@ CH03 (__METHOD__, Z058, __LINE__, 0x00, 0x00) /* - Discuss: now the ObjectType doesnt cause exception! + Discuss: now the ObjectType doesn't cause exception! Is it correct? Understand and discuss it. Store(ObjectType(i000), Local0) CH04(ts, 0, 46, z058, __LINE__, 0, 0) // AE_AML_NO_OPERAND diff --git a/tests/aslts/src/runtime/collections/functional/control/switch5.asl b/tests/aslts/src/runtime/collections/functional/control/switch5.asl index de6c46e..275fcce 100644 --- a/tests/aslts/src/runtime/collections/functional/control/switch5.asl +++ b/tests/aslts/src/runtime/collections/functional/control/switch5.asl @@ -33,7 +33,7 @@ */ /* -SEE: why exception doesnt occur for uninitialized elements there?????? +SEE: why exception doesn't occur for uninitialized elements there?????? SEE: use all the specific cases specified in DOCUMENT 1. SEE: add the tests for "Specification of Match should explicitly say that no exceptions occur while this "cruising through the package"" diff --git a/tests/aslts/src/runtime/collections/functional/reference/ref50.asl b/tests/aslts/src/runtime/collections/functional/reference/ref50.asl index 2b19c02..05396e4 100644 --- a/tests/aslts/src/runtime/collections/functional/reference/ref50.asl +++ b/tests/aslts/src/runtime/collections/functional/reference/ref50.asl @@ -328,8 +328,8 @@ /* ACTUALLY: */ /* */ /* ArgX-String - writes to the original String */ - /* ArgX-Buffer - doesnt */ - /* ArgX-Package - doesnt */ + /* ArgX-Buffer - doesn't */ + /* ArgX-Package - doesn't */ Method (M233, 0, NotSerialized) { TS00 ("m233") diff --git a/tests/aslts/src/runtime/collections/functional/reference/ref70.asl b/tests/aslts/src/runtime/collections/functional/reference/ref70.asl index 12964f9..272745b 100644 --- a/tests/aslts/src/runtime/collections/functional/reference/ref70.asl +++ b/tests/aslts/src/runtime/collections/functional/reference/ref70.asl @@ -32,7 +32,7 @@ */ /* SEE: FILE BUG: hangs without printing error - SEE: FILE BUG: CondRefOf doesnt cause exception but only under some conditions + SEE: FILE BUG: CondRefOf doesn't cause an exception but only under some conditions */ Name (Z081, 0x51) /* Run operator and expect ANY exception(s) */ @@ -558,7 +558,7 @@ Method (M1A9, 0, Serialized) { - /* FILE BUG: CondRefOf doesnt cause exception but only under some conditions, */ + /* FILE BUG: CondRefOf doesn't cause an exception but only under some conditions, */ /* namely for rn00 == 2. */ Name (RN00, 0x02) /* Simplest modes, for debugging */ Name (RN01, 0x01) /* Crash */ diff --git a/tests/aslts/src/runtime/collections/mt/mutex/common.asl b/tests/aslts/src/runtime/collections/mt/mutex/common.asl index db79bf5..a40e3dc 100644 --- a/tests/aslts/src/runtime/collections/mt/mutex/common.asl +++ b/tests/aslts/src/runtime/collections/mt/mutex/common.asl @@ -251,8 +251,8 @@ Name (ER07, 0x80) /* Too big Index of current thread */ Name (ER08, 0x0100) /* Invalid counter of mutex owning */ Name (ER09, 0x0200) /* Acquire returned zero but FAIL expected */ - Name (ER10, 0x0400) /* Serialized method doesnt provide exclusive call */ - Name (ER11, 0x0800) /* Serialized method doesnt provide exclusive call */ + Name (ER10, 0x0400) /* Serialized method doesn't provide exclusive call */ + Name (ER11, 0x0800) /* Serialized method doesn't provide exclusive call */ Name (ER12, 0x1000) /* Non-serialized method thr-1 didn't get into method */ Name (ER13, 0x2000) /* Non-serialized method thr-N didn't get into method */ /* Opcodes of warnings reported by slave threads */ diff --git a/tests/misc/grammar.aml b/tests/misc/grammar.aml index c1ffa8d..0975767 100755 Binary files a/tests/misc/grammar.aml and b/tests/misc/grammar.aml differ