From 81e696abbbc97a49ba8e728e123ff20998f8c498 Mon Sep 17 00:00:00 2001 From: Al Stone Date: May 14 2018 20:36:26 +0000 Subject: New upstream version 20180427 --- diff --git a/changes.txt b/changes.txt index 855f361..906b336 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,47 @@ ---------------------------------------- +27 April 2018. Summary of changes for version 20180427: + + +1) ACPICA kernel-resident subsystem: + +Debugger: Added support for Package objects in the "Test Objects" +command. This command walks the entire namespace and evaluates all named +data objects (Integers, Strings, Buffers, and now Packages). + +Improved error messages for the namespace root node. Originally, the root +was referred to by the confusing string "\___". This has been replaced by +"Namespace Root" for clarification. + +Fixed a potential infinite loop in the AcpiRsDumpByteList function. Colin +Ian King . + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented support to detect and flag illegal forward references. +For compatibility with other ACPI implementations, these references are +now illegal at the root level of the DSDT or SSDTs. Forward references +have always been illegal within control methods. This change should not +affect existing ASL/AML code because of the fact that these references +have always been illegal in the other ACPI implementation. + +iASL: Added error messages for the case where a table OEM ID and OEM +TABLE ID strings are longer than the ACPI-defined length. Previously, +these strings were simply silently truncated. + +iASL: Enhanced the -tc option (which creates an AML hex file in C, +suitable for import into a firmware project): + 1) Create a unique name for the table, to simplify use of multiple +SSDTs. + 2) Add a protection #ifdef in the file, similar to a .h header file. +With assistance from Sami Mujawar, sami.mujawar@arm.com and Evan Lloyd, +evan.lloyd@arm.com + +AcpiExec: Added a new option, -df, to disable the local fault handler. +This is useful during debugging, where it may be desired to drop into a +debugger on a fault. + +---------------------------------------- 13 March 2018. Summary of changes for version 20180313: diff --git a/source/common/adfile.c b/source/common/adfile.c index 6257b5b..0687cae 100644 --- a/source/common/adfile.c +++ b/source/common/adfile.c @@ -346,3 +346,59 @@ FlSplitInputPathname ( return (AE_OK); } + + +/******************************************************************************* + * + * FUNCTION: FlGetFileBasename + * + * PARAMETERS: FilePathname - File path to be split + * + * RETURN: The extracted base name of the file, in upper case + * + * DESCRIPTION: Extract the file base name (the file name with no extension) + * from the input pathname. + * + * Note: Any backslashes in the pathname should be previously + * converted to forward slashes before calling this function. + * + ******************************************************************************/ + +char * +FlGetFileBasename ( + char *FilePathname) +{ + char *FileBasename; + char *Substring; + + + /* Backup to last slash or colon */ + + Substring = strrchr (FilePathname, '/'); + if (!Substring) + { + Substring = strrchr (FilePathname, ':'); + } + + /* Extract the full filename (base + extension) */ + + if (Substring) + { + FileBasename = FlStrdup (Substring + 1); + } + else + { + FileBasename = FlStrdup (FilePathname); + } + + /* Remove the filename extension if present */ + + Substring = strchr (FileBasename, '.'); + if (Substring) + { + *Substring = 0; + } + + AcpiUtStrupr (FileBasename); + return (FileBasename); +} diff --git a/source/common/dmtbinfo2.c b/source/common/dmtbinfo2.c index 0e5d345..e59ff25 100644 --- a/source/common/dmtbinfo2.c +++ b/source/common/dmtbinfo2.c @@ -955,7 +955,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNfit7[] = {ACPI_DMT_UINT24, ACPI_NFIT7_OFFSET (Reserved[0]), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_NFIT7_OFFSET (Capabilities), "Capabilities (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Cache Flush to NVDIMM", 0}, - {ACPI_DMT_FLAG1, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Memory Flush to MVDIMM", 0}, + {ACPI_DMT_FLAG1, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Memory Flush to NVDIMM", 0}, {ACPI_DMT_FLAG2, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Memory Mirroring", 0}, {ACPI_DMT_UINT32, ACPI_NFIT7_OFFSET (Reserved2), "Reserved", 0}, ACPI_DMT_TERMINATOR diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 274b53d..39b322f 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -1079,6 +1079,15 @@ UtDumpBasicOp ( ACPI_PARSE_OBJECT *Op, UINT32 Level); +void * +UtGetParentMethod ( + ACPI_NAMESPACE_NODE *Node); + +BOOLEAN +UtNodeIsDescendantOf ( + ACPI_NAMESPACE_NODE *Node1, + ACPI_NAMESPACE_NODE *Node2); + void UtDisplaySupportedTables ( void); diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index 84d8007..e991f28 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -112,7 +112,8 @@ const char *Gbl_OpFlagNames[ACPI_NUM_OP_FLAGS] = "OP_COMPILER_EMITTED", "OP_IS_DUPLICATE", "OP_IS_RESOURCE_DATA", - "OP_IS_NULL_RETURN" + "OP_IS_NULL_RETURN", + "OP_NOT_FOUND_DURING_LOAD" }; #else diff --git a/source/compiler/aslhex.c b/source/compiler/aslhex.c index 16902fa..ed74058 100644 --- a/source/compiler/aslhex.c +++ b/source/compiler/aslhex.c @@ -42,6 +42,7 @@ */ #include "aslcompiler.h" +#include "acapps.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("ashex") @@ -157,6 +158,9 @@ HxReadAmlOutputFile ( * output file, but formatted into hex/ascii bytes suitable for * inclusion into a C source file. * + * Note: the base name of the hex output file is prepended to + * all symbols as they are output to the file. + * ******************************************************************************/ static void @@ -168,17 +172,29 @@ HxDoHexOutputC ( UINT32 Offset = 0; UINT32 AmlFileSize; UINT32 i; + char *FileBasename; + + /* Obtain the file basename (filename with no extension) */ + + FileBasename = FlGetFileBasename (Gbl_Files [ASL_FILE_HEX_OUTPUT].Filename); /* Get AML size, seek back to start */ AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); FlSeekFile (ASL_FILE_AML_OUTPUT, 0); + /* Finish the file header and emit the non-data symbols */ + FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n"); FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n", AmlFileSize); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n"); + + FlPrintFile (ASL_FILE_HEX_OUTPUT, "#ifndef __%s_HEX__\n", FileBasename); + FlPrintFile (ASL_FILE_HEX_OUTPUT, "#define __%s_HEX__\n\n", FileBasename); + + AcpiUtStrlwr (FileBasename); + FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char %s_aml_code[] =\n{\n", FileBasename); while (Offset < AmlFileSize) { @@ -195,7 +211,7 @@ HxDoHexOutputC ( for (i = 0; i < LineLength; i++) { /* - * Print each hex byte. + * Output each hex byte in the form: "0xnn," * Add a comma until the very last byte of the AML file * (Some C compilers complain about a trailing comma) */ @@ -229,7 +245,8 @@ HxDoHexOutputC ( Offset += LineLength; } - FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n"); + FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n\n"); + FlPrintFile (ASL_FILE_HEX_OUTPUT, "#endif\n"); } diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index 181524c..ae8e6e2 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -45,9 +45,10 @@ #include "amlcode.h" #include "acdispat.h" #include "acnamesp.h" - +#include "acparser.h" #include "aslcompiler.y.h" + #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslload") @@ -362,9 +363,13 @@ LdNamespace1Begin ( UINT32 i; BOOLEAN ForceNewScope = FALSE; ACPI_OWNER_ID OwnerId = 0; + const ACPI_OPCODE_INFO *OpInfo; + ACPI_PARSE_OBJECT *ParentOp; ACPI_FUNCTION_NAME (LdNamespace1Begin); + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n", Op, Op->Asl.ParseOpName)); @@ -440,6 +445,69 @@ LdNamespace1Begin ( return (AE_OK); } + /* Check for a possible illegal forward reference */ + + if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || + (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) + { + /* + * Op->Asl.Namepath will be NULL for these opcodes. + * These opcodes are guaranteed to have a parent. + * Examine the parent opcode. + */ + Status = AE_OK; + ParentOp = Op->Asl.Parent; + OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Asl.AmlOpcode); + + /* + * Exclude all operators that actually declare a new name: + * Name (ABCD, 1) -> Ignore (AML_CLASS_NAMED_OBJECT) + * We only want references to named objects: + * Store (2, WXYZ) -> Attempt to resolve the name + */ + if (OpInfo->Class == AML_CLASS_NAMED_OBJECT) + { + return (AE_OK); + } + + /* + * Check if the referenced object exists at this point during + * the load: + * 1) If it exists, then this cannot be a forward reference. + * 2) If it does not exist, it could be a forward reference or + * it truly does not exist (and no external declaration). + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, + Op->Asl.Value.Name, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &Node); + if (Status == AE_NOT_FOUND) + { + /* + * This is either a foward reference or the object truly + * does not exist. The two cases can only be differentiated + * during the cross-reference stage later. Mark the Op/Name + * as not-found for now to indicate the need for further + * processing. + * + * Special case: Allow forward references from elements of + * Package objects. This provides compatibility with other + * ACPI implementations. To correctly implement this, the + * ACPICA table load defers package resolution until the entire + * namespace has been loaded. + */ + if ((ParentOp->Asl.ParseOpcode != PARSEOP_PACKAGE) && + (ParentOp->Asl.ParseOpcode != PARSEOP_VAR_PACKAGE)) + { + Op->Asl.CompileFlags |= OP_NOT_FOUND_DURING_LOAD; + } + + return (AE_OK); + } + + return (Status); + } + Path = Op->Asl.Namepath; if (!Path) { @@ -476,7 +544,6 @@ LdNamespace1Begin ( } break; - case PARSEOP_EXTERNAL: /* * "External" simply enters a name and type into the namespace. @@ -658,7 +725,6 @@ LdNamespace1Begin ( Status = AE_OK; goto FinishNode; - default: ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c index 3783526..b89dd24 100644 --- a/source/compiler/aslmessages.c +++ b/source/compiler/aslmessages.c @@ -234,8 +234,8 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_RANGE */ "Constant out of range", /* ASL_MSG_BUFFER_ALLOCATION */ "Could not allocate line buffer", /* ASL_MSG_MISSING_DEPENDENCY */ "Missing dependency", -/* ASL_MSG_ILLEGAL_FORWARD_REF */ "Illegal forward reference within a method", -/* ASL_MSG_ILLEGAL_METHOD_REF */ "Illegal reference across two methods", +/* ASL_MSG_ILLEGAL_FORWARD_REF */ "Illegal forward reference", +/* ASL_MSG_ILLEGAL_METHOD_REF */ "Object is declared in a different method", /* ASL_MSG_LOCAL_NOT_USED */ "Method Local is set but never used", /* ASL_MSG_ARG_AS_LOCAL_NOT_USED */ "Method Argument (as a local) is set but never used", /* ASL_MSG_ARG_NOT_USED */ "Method Argument is never used", @@ -246,7 +246,9 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_FOUND_HERE */ "Original name creation/declaration below: ", /* ASL_MSG_ILLEGAL_RECURSION */ "Illegal recursive call to method that creates named objects", /* ASL_MSG_EXTERN_COLLISION */ "A name cannot be defined and declared external in the same table", -/* ASL_MSG_FOUND_HERE_EXTERN*/ "Remove one of the declarations indicated above or below:" +/* ASL_MSG_FOUND_HERE_EXTERN */ "Remove one of the declarations indicated above or below:", +/* ASL_MSG_OEM_TABLE_ID */ "Invalid OEM Table ID", +/* ASL_MSG_OEM_ID */ "Invalid OEM ID" }; /* Table compiler */ diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h index 21e7bea..08310f8 100644 --- a/source/compiler/aslmessages.h +++ b/source/compiler/aslmessages.h @@ -249,6 +249,8 @@ typedef enum ASL_MSG_ILLEGAL_RECURSION, ASL_MSG_EXTERN_COLLISION, ASL_MSG_EXTERN_FOUND_HERE, + ASL_MSG_OEM_TABLE_ID, + ASL_MSG_OEM_ID, /* These messages are used by the Data Table compiler only */ diff --git a/source/compiler/asloperands.c b/source/compiler/asloperands.c index 6839eba..8df2d40 100644 --- a/source/compiler/asloperands.c +++ b/source/compiler/asloperands.c @@ -953,7 +953,7 @@ OpnDoDefinitionBlock ( if (strlen (Gbl_TableSignature) != ACPI_NAME_SIZE) { AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, - "Length is not exactly 4"); + "Length must be exactly 4 characters"); } for (i = 0; i < ACPI_NAME_SIZE; i++) @@ -970,6 +970,7 @@ OpnDoDefinitionBlock ( Child = Child->Asl.Next; Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + /* * We used the revision to set the integer width earlier */ @@ -978,6 +979,12 @@ OpnDoDefinitionBlock ( Child = Child->Asl.Next; Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + if (Child->Asl.Value.String && + strlen (Child->Asl.Value.String) > ACPI_OEM_ID_SIZE) + { + AslError (ASL_ERROR, ASL_MSG_OEM_ID, Child, + "Length cannot exceed 6 characters"); + } /* OEM TableID */ @@ -986,6 +993,12 @@ OpnDoDefinitionBlock ( if (Child->Asl.Value.String) { Length = strlen (Child->Asl.Value.String); + if (Length > ACPI_OEM_TABLE_ID_SIZE) + { + AslError (ASL_ERROR, ASL_MSG_OEM_TABLE_ID, Child, + "Length cannot exceed 8 characters"); + } + Gbl_TableId = UtLocalCacheCalloc (Length + 1); strcpy (Gbl_TableId, Child->Asl.Value.String); diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h index 083fbef..1d86453 100644 --- a/source/compiler/asltypes.h +++ b/source/compiler/asltypes.h @@ -75,8 +75,9 @@ #define OP_IS_DUPLICATE 0x00040000 #define OP_IS_RESOURCE_DATA 0x00080000 #define OP_IS_NULL_RETURN 0x00100000 +#define OP_NOT_FOUND_DURING_LOAD 0x00200000 -#define ACPI_NUM_OP_FLAGS 0x21 +#define ACPI_NUM_OP_FLAGS 0x22 /* Keeps information about individual control methods */ diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index bf6e470..3698415 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -130,6 +130,97 @@ UtQueryForOverwrite ( /******************************************************************************* * + * FUNCTION: UtNodeIsDescendantOf + * + * PARAMETERS: Node1 - Child node + * Node2 - Possible parent node + * + * RETURN: Boolean + * + * DESCRIPTION: Returns TRUE if Node1 is a descendant of Node2. Otherwise, + * return FALSE. Note, we assume a NULL Node2 element to be the + * topmost (root) scope. All nodes are descendants of the root. + * Note: Nodes at the same level (siblings) are not considered + * descendants. + * + ******************************************************************************/ + +BOOLEAN +UtNodeIsDescendantOf ( + ACPI_NAMESPACE_NODE *Node1, + ACPI_NAMESPACE_NODE *Node2) +{ + + if (Node1 == Node2) + { + return (FALSE); + } + + if (!Node2) + { + return (TRUE); /* All nodes descend from the root */ + } + + /* Walk upward until the root is reached or parent is found */ + + while (Node1) + { + if (Node1 == Node2) + { + return (TRUE); + } + + Node1 = Node1->Parent; + } + + return (FALSE); +} + + +/******************************************************************************* + * + * FUNCTION: UtGetParentMethod + * + * PARAMETERS: Node - Namespace node for any object + * + * RETURN: Namespace node for the parent method + * NULL - object is not within a method + * + * DESCRIPTION: Find the parent (owning) method node for a namespace object + * + ******************************************************************************/ + +void * +UtGetParentMethod ( + ACPI_NAMESPACE_NODE *Node) +{ + ACPI_NAMESPACE_NODE *ParentNode; + + + if (!Node) + { + return (NULL); + } + + /* Walk upward until a method is found, or the root is reached */ + + ParentNode = Node->Parent; + while (ParentNode) + { + if (ParentNode->Type == ACPI_TYPE_METHOD) + { + return (ParentNode); + } + + ParentNode = ParentNode->Parent; + } + + return (NULL); /* Object is not within a control method */ +} + + +/******************************************************************************* + * * FUNCTION: UtDisplaySupportedTables * * PARAMETERS: None diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c index 1d6d6d6..a3feb97 100644 --- a/source/compiler/aslxref.c +++ b/source/compiler/aslxref.c @@ -89,22 +89,6 @@ XfCheckFieldRange ( UINT32 FieldBitLength, UINT32 AccessBitWidth); -#ifdef __UNDER_DEVELOPMENT -static ACPI_PARSE_OBJECT * -XfGetParentMethod ( - ACPI_PARSE_OBJECT *Op); - -static void -XfCheckIllegalReference ( - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *Node); - -static BOOLEAN -XfIsObjectParental ( - ACPI_PARSE_OBJECT *MethodOp1, - ACPI_PARSE_OBJECT *MethodOp2); -#endif - /******************************************************************************* * @@ -594,7 +578,7 @@ XfNamespaceLocateBegin ( Gbl_NsLookupCount++; Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node)); + ACPI_IMODE_EXECUTE, Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) @@ -652,6 +636,26 @@ XfNamespaceLocateBegin ( return_ACPI_STATUS (Status); } + /* Object was found above, check for an illegal forward reference */ + + if (Op->Asl.CompileFlags & OP_NOT_FOUND_DURING_LOAD) + { + /* + * During the load phase, this Op was flagged as a possible + * illegal forward reference + * + * Note: Allow "forward references" from within a method to an + * object that is not within any method (module-level code) + */ + if (!WalkState->ScopeInfo || (UtGetParentMethod (Node) && + !UtNodeIsDescendantOf (WalkState->ScopeInfo->Scope.Node, + UtGetParentMethod (Node)))) + { + AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op, + Op->Asl.ExternalName); + } + } + /* Check for a reference vs. name declaration */ if (!(OpInfo->Flags & AML_NAMED) && @@ -660,13 +664,6 @@ XfNamespaceLocateBegin ( /* This node has been referenced, mark it for reference check */ Node->Flags |= ANOBJ_IS_REFERENCED; - -#ifdef __UNDER_DEVELOPMENT - - /* Check for an illegal reference */ - - XfCheckIllegalReference (Op, Node); -#endif } /* Attempt to optimize the NamePath */ @@ -1097,178 +1094,3 @@ XfNamespaceLocateEnd ( return_ACPI_STATUS (AE_OK); } - - -#ifdef __UNDER_DEVELOPMENT -/******************************************************************************* - * - * FUNCTION: XfIsObjectParental - * - * PARAMETERS: ChildOp - Op to be checked - * PossibleParentOp - Determine if this op is in the family - * - * RETURN: TRUE if ChildOp is a descendent of PossibleParentOp - * - * DESCRIPTION: Determine if an Op is a descendent of another Op. Used to - * detect if a method is declared within another method. - * - ******************************************************************************/ - -static BOOLEAN -XfIsObjectParental ( - ACPI_PARSE_OBJECT *ChildOp, - ACPI_PARSE_OBJECT *PossibleParentOp) -{ - ACPI_PARSE_OBJECT *ParentOp; - - - /* Search upwards through the tree for possible parent */ - - ParentOp = ChildOp; - while (ParentOp) - { - if (ParentOp == PossibleParentOp) - { - return (TRUE); - } - - ParentOp = ParentOp->Asl.Parent; - } - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: XfGetParentMethod - * - * PARAMETERS: Op - Op to be checked - * - * RETURN: Op for parent method. NULL if object is not within a method. - * - * DESCRIPTION: Determine if an object is within a control method. Used to - * implement special rules for named references from within a - * control method. - * - * NOTE: It would be better to have the parser set a flag in the Op if possible. - * - ******************************************************************************/ - -static ACPI_PARSE_OBJECT * -XfGetParentMethod ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *ParentOp; - - - if (!Op) - { - return (NULL); - } - - if (Op->Asl.ParseOpcode == PARSEOP_METHOD) - { - return (NULL); - } - - /* Walk upwards through the parse tree, up to the root if necessary */ - - ParentOp = Op; - while (ParentOp) - { - if (ParentOp->Asl.ParseOpcode == PARSEOP_METHOD) - { - return (ParentOp); - } - - ParentOp = ParentOp->Asl.Parent; - } - - /* Object is not within a method */ - - return (NULL); -} - - -/******************************************************************************* - * - * FUNCTION: XfCheckIllegalReference - * - * PARAMETERS: Op - Op referring to the target - * TargetNode - Target of the reference - * - * RETURN: None. Emits error message for an illegal reference - * - * DESCRIPTION: Determine if a named reference is legal. A "named" reference - * is something like: Store(ABCD, ...), where ABCD is an AML - * Nameseg or Namepath. - * - * NOTE: Caller must ensure that the name Op is in fact a reference, and not - * an actual name declaration (creation of a named object). - * - ******************************************************************************/ - -static void -XfCheckIllegalReference ( - ACPI_PARSE_OBJECT *Op, - ACPI_NAMESPACE_NODE *TargetNode) -{ - ACPI_PARSE_OBJECT *MethodOp1; - ACPI_PARSE_OBJECT *MethodOp2; - ACPI_PARSE_OBJECT *TargetOp; - - - /* - * Check for an illegal reference to a named object: - * - * 1) References from one control method to another, non-parent - * method are not allowed, they will fail at runtime. - * - * 2) Forward references within a control method are not allowed. - * AML interpreters use a one-pass parse of control methods - * so these forward references will fail at runtime. - */ - TargetOp = TargetNode->Op; - - MethodOp1 = XfGetParentMethod (Op); - MethodOp2 = XfGetParentMethod (TargetOp); - - /* Are both objects within control method(s)? */ - - if (!MethodOp1 || !MethodOp2) - { - return; - } - - /* Objects not in the same method? */ - - if (MethodOp1 != MethodOp2) - { - /* - * 1) Cross-method named reference - * - * This is OK if and only if the target reference is within in a - * method that is a parent of current method - */ - if (!XfIsObjectParental (MethodOp1, MethodOp2)) - { - AslError (ASL_ERROR, ASL_MSG_ILLEGAL_METHOD_REF, Op, - Op->Asl.ExternalName); - } - } - - /* - * 2) Both reference and target are in the same method. Check if this is - * an (illegal) forward reference by examining the exact source code - * location of each (the referenced object and the object declaration). - * This is a bit nasty, yet effective. - */ - else if (Op->Asl.LogicalByteOffset < TargetOp->Asl.LogicalByteOffset) - { - AslError (ASL_ERROR, ASL_MSG_ILLEGAL_FORWARD_REF, Op, - Op->Asl.ExternalName); - } - -} -#endif diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c index ca8cf12..7749f45 100644 --- a/source/components/debugger/dbnames.c +++ b/source/components/debugger/dbnames.c @@ -264,8 +264,17 @@ AcpiDbDumpNamespace ( } AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n", - ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry); + + if (((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Parent) + { + AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n", + ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry); + } + else + { + AcpiOsPrintf ("ACPI Namespace (from %s):\n", + ACPI_NAMESPACE_ROOT); + } /* Display the subtree */ diff --git a/source/components/debugger/dbtest.c b/source/components/debugger/dbtest.c index bf54cfd..5faf526 100644 --- a/source/components/debugger/dbtest.c +++ b/source/components/debugger/dbtest.c @@ -81,6 +81,10 @@ AcpiDbTestStringType ( UINT32 ByteLength); static ACPI_STATUS +AcpiDbTestPackageType ( + ACPI_NAMESPACE_NODE *Node); + +static ACPI_STATUS AcpiDbReadFromObject ( ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE ExpectedType, @@ -348,6 +352,11 @@ AcpiDbTestOneObject ( BitLength = ByteLength * 8; break; + case ACPI_TYPE_PACKAGE: + + LocalType = ACPI_TYPE_PACKAGE; + break; + case ACPI_TYPE_FIELD_UNIT: case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD: @@ -382,6 +391,7 @@ AcpiDbTestOneObject ( AcpiOsPrintf ("%14s: %4.4s", AcpiUtGetTypeName (Node->Type), Node->Name.Ascii); + if (!ObjDesc) { AcpiOsPrintf (" Ignoring, no attached object\n"); @@ -402,13 +412,12 @@ AcpiDbTestOneObject ( case ACPI_ADR_SPACE_SYSTEM_MEMORY: case ACPI_ADR_SPACE_SYSTEM_IO: case ACPI_ADR_SPACE_PCI_CONFIG: - case ACPI_ADR_SPACE_EC: break; default: - AcpiOsPrintf (" %s space is not supported [%4.4s]\n", + AcpiOsPrintf (" %s space is not supported in this command [%4.4s]\n", AcpiUtGetRegionName (RegionObj->Region.SpaceId), RegionObj->Region.Node->Name.Ascii); return (AE_OK); @@ -438,6 +447,11 @@ AcpiDbTestOneObject ( Status = AcpiDbTestBufferType (Node, BitLength); break; + case ACPI_TYPE_PACKAGE: + + Status = AcpiDbTestPackageType (Node); + break; + default: AcpiOsPrintf (" Ignoring, type not implemented (%2.2X)", @@ -445,6 +459,14 @@ AcpiDbTestOneObject ( break; } + /* Exit on error, but don't abort the namespace walk */ + + if (ACPI_FAILURE (Status)) + { + Status = AE_OK; + goto Exit; + } + switch (Node->Type) { case ACPI_TYPE_LOCAL_REGION_FIELD: @@ -452,12 +474,14 @@ AcpiDbTestOneObject ( RegionObj = ObjDesc->Field.RegionObj; AcpiOsPrintf (" (%s)", AcpiUtGetRegionName (RegionObj->Region.SpaceId)); + break; default: break; } +Exit: AcpiOsPrintf ("\n"); return (Status); } @@ -516,7 +540,6 @@ AcpiDbTestIntegerType ( { ValueToWrite = 0; } - /* Write a new value */ WriteValue.Type = ACPI_TYPE_INTEGER; @@ -809,6 +832,40 @@ Exit: /******************************************************************************* * + * FUNCTION: AcpiDbTestPackageType + * + * PARAMETERS: Node - Parent NS node for the object + * + * RETURN: Status + * + * DESCRIPTION: Test read for a Package object. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbTestPackageType ( + ACPI_NAMESPACE_NODE *Node) +{ + ACPI_OBJECT *Temp1 = NULL; + ACPI_STATUS Status; + + + /* Read the original value */ + + Status = AcpiDbReadFromObject (Node, ACPI_TYPE_PACKAGE, &Temp1); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + AcpiOsPrintf (" %8.8X Elements", Temp1->Package.Count); + AcpiOsFree (Temp1); + return (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbReadFromObject * * PARAMETERS: Node - Parent NS node for the object @@ -849,8 +906,8 @@ AcpiDbReadFromObject ( AcpiGbl_MethodExecuting = TRUE; Status = AcpiEvaluateObject (ReadHandle, NULL, &ParamObjects, &ReturnObj); - AcpiGbl_MethodExecuting = FALSE; + AcpiGbl_MethodExecuting = FALSE; if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not read from object, %s", @@ -865,6 +922,7 @@ AcpiDbReadFromObject ( case ACPI_TYPE_INTEGER: case ACPI_TYPE_BUFFER: case ACPI_TYPE_STRING: + case ACPI_TYPE_PACKAGE: /* * Did we receive the type we wanted? Most important for the * Integer/Buffer case (when a field is larger than an Integer, @@ -876,6 +934,7 @@ AcpiDbReadFromObject ( AcpiUtGetTypeName (ExpectedType), AcpiUtGetTypeName (RetValue->Type)); + AcpiOsFree (ReturnObj.Pointer); return (AE_TYPE); } diff --git a/source/components/dispatcher/dswscope.c b/source/components/dispatcher/dswscope.c index 0d9df41..d94242e 100644 --- a/source/components/dispatcher/dswscope.c +++ b/source/components/dispatcher/dswscope.c @@ -161,8 +161,7 @@ AcpiDsScopeStackPush ( } else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[\\___] (%s)", "ROOT")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, ACPI_NAMESPACE_ROOT)); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, @@ -220,15 +219,13 @@ AcpiDsScopeStackPop ( NewScopeInfo = WalkState->ScopeInfo; if (NewScopeInfo) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[%4.4s] (%s)\n", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "[%4.4s] (%s)\n", AcpiUtGetNodeName (NewScopeInfo->Scope.Node), AcpiUtGetTypeName (NewScopeInfo->Common.Value))); } else { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, - "[\\___] (ROOT)\n")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "%s\n", ACPI_NAMESPACE_ROOT)); } AcpiUtDeleteGenericState (ScopeInfo); diff --git a/source/components/resources/rsdump.c b/source/components/resources/rsdump.c index 1bb2dc0..a7d2af7 100644 --- a/source/components/resources/rsdump.c +++ b/source/components/resources/rsdump.c @@ -660,7 +660,7 @@ AcpiRsDumpByteList ( UINT16 Length, UINT8 *Data) { - UINT8 i; + UINT16 i; for (i = 0; i < Length; i++) diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c index 279b0a5..6d465b8 100644 --- a/source/components/tables/tbinstal.c +++ b/source/components/tables/tbinstal.c @@ -128,7 +128,7 @@ AcpiTbInstallTableWithOverride ( * DESCRIPTION: This function is called to verify and install an ACPI table. * When this function is called by "Load" or "LoadTable" opcodes, * or by AcpiLoadTable() API, the "Reload" parameter is set. - * After sucessfully returning from this function, table is + * After successfully returning from this function, table is * "INSTALLED" but not "VALIDATED". * ******************************************************************************/ diff --git a/source/components/utilities/utprint.c b/source/components/utilities/utprint.c index d411d0b..70f418b 100644 --- a/source/components/utilities/utprint.c +++ b/source/components/utilities/utprint.c @@ -616,6 +616,7 @@ vsnprintf ( case 'X': Type |= ACPI_FORMAT_UPPER; + /* FALLTHROUGH */ case 'x': diff --git a/source/components/utilities/utstring.c b/source/components/utilities/utstring.c index 63155ce..9e601d9 100644 --- a/source/components/utilities/utstring.c +++ b/source/components/utilities/utstring.c @@ -195,7 +195,7 @@ AcpiUtRepairName ( * Special case for the root node. This can happen if we get an * error during the execution of module-level code. */ - if (ACPI_COMPARE_NAME (Name, "\\___")) + if (ACPI_COMPARE_NAME (Name, ACPI_ROOT_PATHNAME)) { return; } diff --git a/source/include/acapps.h b/source/include/acapps.h index 654ff55..0192ea7 100644 --- a/source/include/acapps.h +++ b/source/include/acapps.h @@ -217,6 +217,10 @@ FlSplitInputPathname ( char **OutFilename); char * +FlGetFileBasename ( + char *FilePathname); + +char * AdGenerateFilename ( char *Prefix, char *TableId); diff --git a/source/include/acnames.h b/source/include/acnames.h index 663c6b1..8ca7fc8 100644 --- a/source/include/acnames.h +++ b/source/include/acnames.h @@ -83,11 +83,14 @@ /* Definitions of the predefined namespace names */ #define ACPI_UNKNOWN_NAME (UINT32) 0x3F3F3F3F /* Unknown name is "????" */ -#define ACPI_ROOT_NAME (UINT32) 0x5F5F5F5C /* Root name is "\___" */ - #define ACPI_PREFIX_MIXED (UINT32) 0x69706341 /* "Acpi" */ #define ACPI_PREFIX_LOWER (UINT32) 0x69706361 /* "acpi" */ +/* Root name stuff */ + +#define ACPI_ROOT_NAME (UINT32) 0x5F5F5F5C /* Root name is "\___" */ +#define ACPI_ROOT_PATHNAME "\\___" +#define ACPI_NAMESPACE_ROOT "Namespace Root" #define ACPI_NS_ROOT_PATH "\\" #endif /* __ACNAMES_H__ */ diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 04f7942..967e3d8 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 0x20180313 +#define ACPI_CA_VERSION 0x20180427 #include "acconfig.h" #include "actypes.h" diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h index a143cda..fdae0f9 100644 --- a/source/tools/acpiexec/aecommon.h +++ b/source/tools/acpiexec/aecommon.h @@ -81,6 +81,7 @@ typedef struct ae_debug_regions } AE_DEBUG_REGIONS; +extern BOOLEAN AcpiGbl_UseLocalFaultHandler; extern BOOLEAN AcpiGbl_IgnoreErrors; extern BOOLEAN AcpiGbl_AbortLoopOnTimeout; extern UINT8 AcpiGbl_RegionFillValue; diff --git a/source/tools/acpiexec/aeexception.c b/source/tools/acpiexec/aeexception.c index 961582f..e64990d 100644 --- a/source/tools/acpiexec/aeexception.c +++ b/source/tools/acpiexec/aeexception.c @@ -91,9 +91,16 @@ AeExceptionHandler ( if (Name) { - AcpiOsPrintf (AE_PREFIX - "Evaluating Method or Node: [%4.4s]\n", - (char *) &Name); + if (ACPI_COMPARE_NAME (&Name, ACPI_ROOT_PATHNAME)) + { + AcpiOsPrintf (AE_PREFIX + "Evaluating executable code at [%s]\n", ACPI_NAMESPACE_ROOT); + } + else + { + AcpiOsPrintf (AE_PREFIX + "Evaluating Method or Node: [%4.4s]\n", (char *) &Name); + } } /* Be terse about loop timeouts */ diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index 02dc4eb..51609ed 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -79,6 +79,7 @@ AeDoOptions ( /* Globals */ +BOOLEAN AcpiGbl_UseLocalFaultHandler = TRUE; UINT8 AcpiGbl_RegionFillValue = 0; BOOLEAN AcpiGbl_IgnoreErrors = FALSE; BOOLEAN AcpiGbl_AbortLoopOnTimeout = FALSE; @@ -140,6 +141,7 @@ usage ( printf ("\n"); ACPI_OPTION ("-da", "Disable method abort on error"); + ACPI_OPTION ("-df", "Disable Local fault handler"); ACPI_OPTION ("-di", "Disable execution of STA/INI methods during init"); ACPI_OPTION ("-do", "Disable Operation Region address simulation"); ACPI_OPTION ("-dp", "Disable TermList parsing for scope objects"); @@ -222,6 +224,11 @@ AeDoOptions ( AcpiGbl_IgnoreErrors = TRUE; break; + case 'f': + + AcpiGbl_UseLocalFaultHandler = FALSE; + break; + case 'i': AcpiGbl_DbOpt_NoIniMethods = TRUE; @@ -492,7 +499,10 @@ main ( ACPI_DEBUG_INITIALIZE (); /* For debug version only */ signal (SIGINT, AeSignalHandler); - signal (SIGSEGV, AeSignalHandler); + if (AcpiGbl_UseLocalFaultHandler) + { + signal (SIGSEGV, AeSignalHandler); + } /* Init debug globals */ diff --git a/tests/aslts/src/runtime/collections/Identity2MS/abbu/Makefile b/tests/aslts/src/runtime/collections/Identity2MS/abbu/Makefile index f864cf4..fd57143 100644 --- a/tests/aslts/src/runtime/collections/Identity2MS/abbu/Makefile +++ b/tests/aslts/src/runtime/collections/Identity2MS/abbu/Makefile @@ -4,6 +4,8 @@ ASLMODADD= MAIN_ASLTS AMLMOD= extra extra_aslts COLL= ../.. -ADD_ASLFLAGS=-vx 6152 +ADD_ASLFLAGS=-vx 6142 #illegal forward reference +ADD_ASLFLAGS+=-vx 6152 #recursive method call + TOP= $(COLL)/../../.. include $(COLL)/Makefile.install diff --git a/tests/aslts/src/runtime/collections/bdemo/ACPICA/bdemo/Makefile b/tests/aslts/src/runtime/collections/bdemo/ACPICA/bdemo/Makefile index b7689db..5bc5138 100644 --- a/tests/aslts/src/runtime/collections/bdemo/ACPICA/bdemo/Makefile +++ b/tests/aslts/src/runtime/collections/bdemo/ACPICA/bdemo/Makefile @@ -3,6 +3,8 @@ AMLMOD= bdemo COLL= ../../.. -ADD_ASLFLAGS=-vx 6152 +ADD_ASLFLAGS=-vx 6142 #illegal forward reference +ADD_ASLFLAGS+=-vx 6152 #recursive method call + TOP= $(COLL)/../../.. include $(COLL)/Makefile.install diff --git a/tests/misc/grammar.aml b/tests/misc/grammar.aml index eabe4e6..d6c96ef 100755 Binary files a/tests/misc/grammar.aml and b/tests/misc/grammar.aml differ diff --git a/tests/misc/grammar.dsl b/tests/misc/grammar.dsl index 024f161..eeedbc2 100755 --- a/tests/misc/grammar.dsl +++ b/tests/misc/grammar.dsl @@ -1,25 +1,25 @@ /* * Intel ACPI Component Architecture - * AML/ASL+ Disassembler version 20171215 (32-bit version) - * Copyright (c) 2000 - 2017 Intel Corporation + * AML/ASL+ Disassembler version 20180313 (32-bit version) + * Copyright (c) 2000 - 2018 Intel Corporation * * Disassembling to symbolic ASL+ operators * - * Disassembly of grammar.xxx, Thu Jan 04 09:03:38 2018 + * Disassembly of grammar.xxx, Thu Mar 22 09:44:49 2018 * * Original Table Header: * Signature "DSDT" * Length 0x0002192B (137515) * Revision 0x01 **** 32-bit table (V1), no 64-bit math support - * Checksum 0x1D **** Incorrect checksum, should be 0x4E + * Checksum 0x2C **** Incorrect checksum, should be 0x5D * OEM ID "Intel" * OEM Table ID "GRMTEST" * OEM Revision 0x20090511 (537462033) * Compiler ID "INTL" - * Compiler Version 0x20171215 (538382869) + * Compiler Version 0x20180313 (538444563) */ /* - * Some or all of this work - Copyright (c) 2006 - 2017, Intel Corp. + * Some or all of this work - Copyright (c) 2006 - 2018, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification,