Import ACPICA 20180427.

This commit is contained in:
Jung-uk Kim 2018-04-27 21:30:01 +00:00
parent e44d3d8ceb
commit 5dc04bcfd5
26 changed files with 448 additions and 234 deletions

View File

@ -1,3 +1,46 @@
----------------------------------------
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 <colin.king@canonical.com>.
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:

View File

@ -454,3 +454,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);
}

View File

@ -1063,7 +1063,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

View File

@ -1187,6 +1187,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);

View File

@ -220,7 +220,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

View File

@ -150,6 +150,7 @@
*****************************************************************************/
#include "aslcompiler.h"
#include "acapps.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("ashex")
@ -265,6 +266,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
@ -276,17 +280,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)
{
@ -303,7 +319,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)
*/
@ -337,7 +353,8 @@ HxDoHexOutputC (
Offset += LineLength;
}
FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n");
FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n\n");
FlPrintFile (ASL_FILE_HEX_OUTPUT, "#endif\n");
}

View File

@ -153,9 +153,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")
@ -470,9 +471,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));
@ -548,6 +553,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)
{
@ -584,7 +652,6 @@ LdNamespace1Begin (
}
break;
case PARSEOP_EXTERNAL:
/*
* "External" simply enters a name and type into the namespace.
@ -766,7 +833,6 @@ LdNamespace1Begin (
Status = AE_OK;
goto FinishNode;
default:
ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);

View File

@ -342,8 +342,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",
@ -354,7 +354,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 */

View File

@ -357,6 +357,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 */

View File

@ -1061,7 +1061,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++)
@ -1078,6 +1078,7 @@ OpnDoDefinitionBlock (
Child = Child->Asl.Next;
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
/*
* We used the revision to set the integer width earlier
*/
@ -1086,6 +1087,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 */
@ -1094,6 +1101,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);

View File

@ -183,8 +183,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 */

View File

@ -236,6 +236,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

View File

@ -197,22 +197,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
/*******************************************************************************
*
@ -702,7 +686,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)
@ -760,6 +744,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) &&
@ -768,13 +772,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 */
@ -1205,178 +1202,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

View File

@ -372,8 +372,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 */

View File

@ -188,6 +188,10 @@ AcpiDbTestStringType (
ACPI_NAMESPACE_NODE *Node,
UINT32 ByteLength);
static ACPI_STATUS
AcpiDbTestPackageType (
ACPI_NAMESPACE_NODE *Node);
static ACPI_STATUS
AcpiDbReadFromObject (
ACPI_NAMESPACE_NODE *Node,
@ -456,6 +460,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:
@ -490,6 +499,7 @@ AcpiDbTestOneObject (
AcpiOsPrintf ("%14s: %4.4s",
AcpiUtGetTypeName (Node->Type), Node->Name.Ascii);
if (!ObjDesc)
{
AcpiOsPrintf (" Ignoring, no attached object\n");
@ -510,13 +520,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);
@ -546,6 +555,11 @@ AcpiDbTestOneObject (
Status = AcpiDbTestBufferType (Node, BitLength);
break;
case ACPI_TYPE_PACKAGE:
Status = AcpiDbTestPackageType (Node);
break;
default:
AcpiOsPrintf (" Ignoring, type not implemented (%2.2X)",
@ -553,6 +567,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:
@ -560,12 +582,14 @@ AcpiDbTestOneObject (
RegionObj = ObjDesc->Field.RegionObj;
AcpiOsPrintf (" (%s)",
AcpiUtGetRegionName (RegionObj->Region.SpaceId));
break;
default:
break;
}
Exit:
AcpiOsPrintf ("\n");
return (Status);
}
@ -624,7 +648,6 @@ AcpiDbTestIntegerType (
{
ValueToWrite = 0;
}
/* Write a new value */
WriteValue.Type = ACPI_TYPE_INTEGER;
@ -915,6 +938,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
@ -957,8 +1014,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",
@ -973,6 +1030,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,
@ -984,6 +1042,7 @@ AcpiDbReadFromObject (
AcpiUtGetTypeName (ExpectedType),
AcpiUtGetTypeName (RetValue->Type));
AcpiOsFree (ReturnObj.Pointer);
return (AE_TYPE);
}

View File

@ -269,8 +269,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,
@ -328,15 +327,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);

View File

@ -768,7 +768,7 @@ AcpiRsDumpByteList (
UINT16 Length,
UINT8 *Data)
{
UINT8 i;
UINT16 i;
for (i = 0; i < Length; i++)

View File

@ -236,7 +236,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".
*
******************************************************************************/

View File

@ -724,6 +724,7 @@ vsnprintf (
case 'X':
Type |= ACPI_FORMAT_UPPER;
/* FALLTHROUGH */
case 'x':

View File

@ -303,7 +303,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;
}

View File

@ -324,6 +324,10 @@ FlSplitInputPathname (
char **OutDirectoryPath,
char **OutFilename);
char *
FlGetFileBasename (
char *FilePathname);
char *
AdGenerateFilename (
char *Prefix,

View File

@ -191,11 +191,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__ */

View File

@ -154,7 +154,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20180313
#define ACPI_CA_VERSION 0x20180427
#include "acconfig.h"
#include "actypes.h"

View File

@ -189,6 +189,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;

View File

@ -199,9 +199,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 */

View File

@ -187,6 +187,7 @@ AeDoOptions (
/* Globals */
BOOLEAN AcpiGbl_UseLocalFaultHandler = TRUE;
UINT8 AcpiGbl_RegionFillValue = 0;
BOOLEAN AcpiGbl_IgnoreErrors = FALSE;
BOOLEAN AcpiGbl_AbortLoopOnTimeout = FALSE;
@ -248,6 +249,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");
@ -330,6 +332,11 @@ AeDoOptions (
AcpiGbl_IgnoreErrors = TRUE;
break;
case 'f':
AcpiGbl_UseLocalFaultHandler = FALSE;
break;
case 'i':
AcpiGbl_DbOpt_NoIniMethods = TRUE;
@ -600,7 +607,10 @@ main (
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
signal (SIGINT, AeSignalHandler);
signal (SIGSEGV, AeSignalHandler);
if (AcpiGbl_UseLocalFaultHandler)
{
signal (SIGSEGV, AeSignalHandler);
}
/* Init debug globals */