[PATCH 1/2] ACPICA: Update to version 20200214
Colin King
colin.king at canonical.com
Mon Feb 24 00:13:50 UTC 2020
From: Colin Ian King <colin.king at canonical.com>
Changes in this release of ACPICA are detailed at the following
link on the ACPICA developer mailing list:
https://lists.acpica.org/hyperkitty/list/devel@acpica.org/thread/Z5YA7FWAFECPLPNLRNKI6P4THAR5YSCU
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/acpica/source/common/adisasm.c | 19 +-
src/acpica/source/common/dmtables.c | 1 -
src/acpica/source/compiler/aslanalyze.c | 14 +-
src/acpica/source/compiler/aslcompile.c | 16 +-
src/acpica/source/compiler/aslcompiler.h | 17 +-
src/acpica/source/compiler/aslexternal.c | 44 +++-
src/acpica/source/compiler/aslload.c | 226 ++++++++++++++----
src/acpica/source/compiler/aslmessages.c | 13 +-
src/acpica/source/compiler/aslmessages.h | 10 +
src/acpica/source/compiler/aslmethod.c | 205 +++++++++++++---
src/acpica/source/compiler/aslparseop.c | 13 +-
src/acpica/source/compiler/aslprimaries.y | 2 +-
src/acpica/source/compiler/aslrules.y | 23 +-
src/acpica/source/compiler/asltransform.c | 84 ++++++-
src/acpica/source/compiler/aslutils.c | 41 +++-
src/acpica/source/compiler/aslxref.c | 57 +----
src/acpica/source/compiler/cvparser.c | 16 +-
src/acpica/source/components/events/evevent.c | 2 +-
src/acpica/source/components/events/evxfgpe.c | 38 +++
src/acpica/source/components/hardware/hwgpe.c | 79 ++++++
.../source/components/hardware/hwsleep.c | 10 +
.../source/components/namespace/nsnames.c | 6 +-
.../source/components/namespace/nsxfname.c | 2 +-
src/acpica/source/components/tables/tbxface.c | 12 +-
.../source/components/utilities/utobject.c | 2 +-
src/acpica/source/include/acconvert.h | 3 +-
src/acpica/source/include/achware.h | 4 +
src/acpica/source/include/acmacros.h | 4 +-
src/acpica/source/include/acpixf.h | 6 +-
src/acpica/source/include/actbl1.h | 2 +-
src/acpica/source/include/actypes.h | 7 +-
31 files changed, 775 insertions(+), 203 deletions(-)
diff --git a/src/acpica/source/common/adisasm.c b/src/acpica/source/common/adisasm.c
index 60bd5fda..015765ff 100644
--- a/src/acpica/source/common/adisasm.c
+++ b/src/acpica/source/common/adisasm.c
@@ -156,6 +156,7 @@
#include "acnamesp.h"
#include "acparser.h"
#include "acapps.h"
+#include "acconvert.h"
#define _COMPONENT ACPI_TOOLS
@@ -379,8 +380,6 @@ AdAmlDisassemble (
Status = AE_ERROR;
goto Cleanup;
}
-
- AcpiOsRedirectOutput (File);
}
*OutFilename = DisasmFilename;
@@ -467,6 +466,11 @@ AdDisassembleOneTable (
if (!AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table))
{
+ if (File)
+ {
+ AcpiOsRedirectOutput (File);
+ }
+
AdDisassemblerHeader (Filename, ACPI_IS_DATA_TABLE);
/* This is a "Data Table" (non-AML table) */
@@ -489,6 +493,10 @@ AdDisassembleOneTable (
return (AE_OK);
}
+ /* Initialize the converter output file */
+
+ ASL_CV_INIT_FILETREE(Table, File);
+
/*
* This is an AML table (DSDT or SSDT).
* Always parse the tables, only option is what to display
@@ -501,6 +509,13 @@ AdDisassembleOneTable (
return (Status);
}
+ /* Redirect output for code generation and debugging output */
+
+ if (File)
+ {
+ AcpiOsRedirectOutput (File);
+ }
+
/* Debug output, namespace and parse tree */
if (AslCompilerdebug && File)
diff --git a/src/acpica/source/common/dmtables.c b/src/acpica/source/common/dmtables.c
index 3bc9c07a..ee18d26c 100644
--- a/src/acpica/source/common/dmtables.c
+++ b/src/acpica/source/common/dmtables.c
@@ -506,7 +506,6 @@ AdParseTable (
AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
- ASL_CV_INIT_FILETREE(Table, AmlStart, AmlLength);
AcpiUtSetIntegerWidth (Table->Revision);
diff --git a/src/acpica/source/compiler/aslanalyze.c b/src/acpica/source/compiler/aslanalyze.c
index 9139f4e9..63feba2b 100644
--- a/src/acpica/source/compiler/aslanalyze.c
+++ b/src/acpica/source/compiler/aslanalyze.c
@@ -151,6 +151,7 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
+#include "acnamesp.h"
#include <string.h>
@@ -421,6 +422,7 @@ AnCheckMethodReturnValue (
{
ACPI_PARSE_OBJECT *OwningOp;
ACPI_NAMESPACE_NODE *Node;
+ char *ExternalPath;
Node = ArgOp->Asl.Node;
@@ -435,18 +437,19 @@ AnCheckMethodReturnValue (
/* Examine the parent op of this method */
OwningOp = Node->Op;
+ ExternalPath = AcpiNsGetNormalizedPathname (Node, TRUE);
+
if (OwningOp->Asl.CompileFlags & OP_METHOD_NO_RETVAL)
{
/* Method NEVER returns a value */
- AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, Op, Op->Asl.ExternalName);
+ AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, Op, ExternalPath);
}
else if (OwningOp->Asl.CompileFlags & OP_METHOD_SOME_NO_RETVAL)
{
/* Method SOMETIMES returns a value, SOMETIMES not */
- AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL,
- Op, Op->Asl.ExternalName);
+ AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, Op, ExternalPath);
}
else if (!(ThisNodeBtype & RequiredBtypes))
{
@@ -470,6 +473,11 @@ AnCheckMethodReturnValue (
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, AslGbl_MsgBuffer);
}
}
+
+ if (ExternalPath)
+ {
+ ACPI_FREE (ExternalPath);
+ }
}
diff --git a/src/acpica/source/compiler/aslcompile.c b/src/acpica/source/compiler/aslcompile.c
index 0f145560..9481b6bb 100644
--- a/src/acpica/source/compiler/aslcompile.c
+++ b/src/acpica/source/compiler/aslcompile.c
@@ -647,7 +647,7 @@ void
AslCompilerFileHeader (
UINT32 FileId)
{
- struct tm *NewTime;
+ char *NewTime;
time_t Aclock;
char *Prefix = "";
@@ -691,13 +691,17 @@ AslCompilerFileHeader (
/* Compilation header with timestamp */
- (void) time (&Aclock);
- NewTime = localtime (&Aclock);
+ Aclock = time (NULL);
+ NewTime = ctime (&Aclock);
FlPrintFile (FileId,
- "%sCompilation of \"%s\" - %s%s\n",
- Prefix, AslGbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime),
- Prefix);
+ "%sCompilation of \"%s\" -",
+ Prefix, AslGbl_Files[ASL_FILE_INPUT].Filename);
+
+ if (NewTime)
+ {
+ FlPrintFile (FileId, " %s%s\n", NewTime, Prefix);
+ }
switch (FileId)
{
diff --git a/src/acpica/source/compiler/aslcompiler.h b/src/acpica/source/compiler/aslcompiler.h
index e82a91e4..9bebc380 100644
--- a/src/acpica/source/compiler/aslcompiler.h
+++ b/src/acpica/source/compiler/aslcompiler.h
@@ -373,6 +373,15 @@ MtMethodAnalysisWalkEnd (
UINT32 Level,
void *Context);
+UINT32
+MtProcessTypeOp (
+ ACPI_PARSE_OBJECT *TypeOp);
+
+UINT8
+MtProcessParameterTypeList (
+ ACPI_PARSE_OBJECT *ParamTypeOp,
+ UINT32 *TypeList);
+
/*
* aslbtypes - bitfield data types
@@ -1233,10 +1242,14 @@ UtDumpBasicOp (
ACPI_PARSE_OBJECT *Op,
UINT32 Level);
-void *
-UtGetParentMethod (
+ACPI_NAMESPACE_NODE *
+UtGetParentMethodNode (
ACPI_NAMESPACE_NODE *Node);
+ACPI_PARSE_OBJECT *
+UtGetParentMethodOp (
+ ACPI_PARSE_OBJECT *Op);
+
BOOLEAN
UtNodeIsDescendantOf (
ACPI_NAMESPACE_NODE *Node1,
diff --git a/src/acpica/source/compiler/aslexternal.c b/src/acpica/source/compiler/aslexternal.c
index 37f07e87..315247be 100644
--- a/src/acpica/source/compiler/aslexternal.c
+++ b/src/acpica/source/compiler/aslexternal.c
@@ -192,12 +192,54 @@ ExDoExternal (
ACPI_PARSE_OBJECT *Prev;
ACPI_PARSE_OBJECT *Next;
ACPI_PARSE_OBJECT *ArgCountOp;
+ ACPI_PARSE_OBJECT *TypeOp;
+ ACPI_PARSE_OBJECT *ExternTypeOp = Op->Asl.Child->Asl.Next;
+ UINT32 ExternType;
+ UINT8 ParamCount = ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS;
+ UINT32 ParamTypes[ACPI_METHOD_NUM_ARGS];
+ ExternType = AnMapObjTypeToBtype (ExternTypeOp);
+
+ /*
+ * The parser allows optional parameter return types regardless of the
+ * type. Check object type keyword emit error if optional parameter/return
+ * types exist.
+ *
+ * Check the parameter return type
+ */
+ TypeOp = ExternTypeOp->Asl.Next;
+ if (TypeOp->Asl.Child)
+ {
+ /* Ignore the return type for now. */
+
+ (void) MtProcessTypeOp (TypeOp->Asl.Child);
+ if (ExternType != ACPI_BTYPE_METHOD)
+ {
+ sprintf (AslGbl_MsgBuffer, "Found type [%s]", AcpiUtGetTypeName(ExternType));
+ AslError (ASL_ERROR, ASL_MSG_EXTERN_INVALID_RET_TYPE, TypeOp,
+ AslGbl_MsgBuffer);
+ }
+ }
+
+ /* Check the parameter types */
+
+ TypeOp = TypeOp->Asl.Next;
+ if (TypeOp->Asl.Child)
+ {
+ ParamCount = MtProcessParameterTypeList (TypeOp->Asl.Child, ParamTypes);
+ if (ExternType != ACPI_BTYPE_METHOD)
+ {
+ sprintf (AslGbl_MsgBuffer, "Found type [%s]", AcpiUtGetTypeName(ExternType));
+ AslError (ASL_ERROR, ASL_MSG_EXTERN_INVALID_PARAM_TYPE, TypeOp,
+ AslGbl_MsgBuffer);
+ }
+ }
+
ArgCountOp = Op->Asl.Child->Asl.Next->Asl.Next;
ArgCountOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST;
- ArgCountOp->Asl.Value.Integer = 0;
+ ArgCountOp->Asl.Value.Integer = ParamCount;
UtSetParseOpName (ArgCountOp);
/* Create new list node of arbitrary type */
diff --git a/src/acpica/source/compiler/aslload.c b/src/acpica/source/compiler/aslload.c
index d9728206..0d26c641 100644
--- a/src/acpica/source/compiler/aslload.c
+++ b/src/acpica/source/compiler/aslload.c
@@ -196,6 +196,15 @@ LdCheckSpecialNames (
ACPI_NAMESPACE_NODE *Node,
ACPI_PARSE_OBJECT *Op);
+static ACPI_STATUS
+LdAnalyzeExternals (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_OBJECT_TYPE ExternalOpType,
+ ACPI_OBJECT_TYPE ObjectType,
+ ACPI_WALK_STATE *WalkState);
+
+
/*******************************************************************************
*
* FUNCTION: LdLoadNamespace
@@ -575,7 +584,8 @@ LdNamespace1Begin (
/* Check for a possible illegal forward reference */
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
- (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
+ (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
+ (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
{
/*
* Op->Asl.Namepath will be NULL for these opcodes.
@@ -591,7 +601,8 @@ LdNamespace1Begin (
* We only want references to named objects:
* Store (2, WXYZ) -> Attempt to resolve the name
*/
- if (OpInfo->Class == AML_CLASS_NAMED_OBJECT)
+ if ((Op->Asl.ParseOpcode != PARSEOP_METHODCALL) &&
+ (OpInfo->Class == AML_CLASS_NAMED_OBJECT))
{
return (AE_OK);
}
@@ -899,56 +910,24 @@ LdNamespace1Begin (
Node->Type = (UINT8) ObjectType;
Status = AE_OK;
}
- else if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
- (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL))
+ else if ((Node->Flags & ANOBJ_IS_EXTERNAL) ||
+ (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL))
{
- /*
- * Allow one create on an object or segment that was
- * previously declared External
- */
- Node->Flags &= ~ANOBJ_IS_EXTERNAL;
- Node->Type = (UINT8) ObjectType;
-
- /* Just retyped a node, probably will need to open a scope */
-
- if (AcpiNsOpensScope (ObjectType))
+ Status = LdAnalyzeExternals (Node, Op, ActualObjectType,
+ ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
{
- Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
- if (ACPI_FAILURE (Status))
+ if (Status == AE_ERROR)
{
- return_ACPI_STATUS (Status);
+ /*
+ * The use of AE_ERROR here indicates that there was a
+ * compiler error emitted in LdAnalyzeExternals which
+ * means that the caller should proceed to the next Op
+ * for analysis of subsequent parse objects.
+ */
+ Status = AE_OK;
}
- }
-
- Status = AE_OK;
- }
- else if (!(Node->Flags & ANOBJ_IS_EXTERNAL) &&
- (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL))
- {
- /*
- * Allow externals in same scope as the definition of the
- * actual object. Similar to C. Allows multiple definition
- * blocks that refer to each other in the same file.
- */
- Status = AE_OK;
- }
- else if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
- (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) &&
- (ObjectType == ACPI_TYPE_ANY))
- {
- /* Allow update of externals of unknown type. */
-
- if (AcpiNsOpensScope (ActualObjectType))
- {
- Node->Type = (UINT8) ActualObjectType;
- Status = AE_OK;
- }
- else
- {
- sprintf (AslGbl_MsgBuffer, "%s [%s]", Op->Asl.ExternalName,
- AcpiUtGetTypeName (Node->Type));
- AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, AslGbl_MsgBuffer);
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (Status);
}
}
else
@@ -1013,15 +992,17 @@ FinishNode:
* 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
- * unknown setting Node->Value to ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS
- * indicates that the parameter count for this method is unknown.
- * This information is used in ASL cross reference to help determine the
- * parameter count through method calls.
+ * 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 = ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS;
+ Node->Value = (UINT32)
+ Op->Asl.Child->Asl.Next->Asl.Next->Asl.Value.Integer;
}
if (Op->Asl.ParseOpcode == PARSEOP_METHOD)
@@ -1037,6 +1018,145 @@ FinishNode:
}
+/*******************************************************************************
+ *
+ * FUNCTION: LdAnalyzeExternals
+ *
+ * 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
+ *
+ * DESCRIPTION: Node and Op represents an identically named object declaration
+ * that is either declared by the ASL external keyword or declared
+ * by operators that declare named objects (i.e. Name, Device,
+ * OperationRegion, and etc.). This function ensures that the
+ * declarations do not contradict each other.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+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;
+ ACPI_OBJECT_TYPE ActualExternalOpType;
+ ACPI_OBJECT_TYPE ActualOpType;
+ ACPI_PARSE_OBJECT *ExternalOp;
+ ACPI_PARSE_OBJECT *ActualOp;
+
+
+ /*
+ * The declaration represented by Node and Op must have the same type.
+ * The type of the external Op is represented by ExternalOpType. However,
+ * the type of the pre-existing declaration depends on whether if Op
+ * is an external declaration or an actual declaration.
+ */
+ if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)
+ {
+ ActualExternalOpType = ExternalOpType;
+ ActualOpType = Node->Type;
+ }
+ else
+ {
+ ActualExternalOpType = Node->Type;
+ ActualOpType = ObjectType;
+ }
+
+ if ((ActualOpType != ACPI_TYPE_ANY) &&
+ (ActualExternalOpType != ACPI_TYPE_ANY) &&
+ (ActualExternalOpType != ActualOpType))
+ {
+ if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL &&
+ Node->Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)
+ {
+ AslDualParseOpError (ASL_ERROR,
+ ASL_MSG_DUPLICATE_EXTERN_MISMATCH, Op, NULL,
+ ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE, Node->Op, NULL);
+ }
+ else
+ {
+ if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL &&
+ Node->Op->Asl.ParseOpcode != PARSEOP_EXTERNAL)
+ {
+ ExternalOp = Op;
+ ActualOp = Node->Op;
+ }
+ else
+ {
+ ExternalOp = Node->Op;
+ ActualOp = Op;
+ }
+ AslDualParseOpError (ASL_ERROR,
+ ASL_MSG_DECLARATION_TYPE_MISMATCH, ExternalOp, NULL,
+ ASL_MSG_TYPE_MISMATCH_FOUND_HERE, ActualOp, NULL);
+ }
+ }
+
+ if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
+ (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL))
+ {
+ /*
+ * Allow one create on an object or segment that was
+ * previously declared External
+ */
+ Node->Flags &= ~ANOBJ_IS_EXTERNAL;
+ Node->Type = (UINT8) ObjectType;
+
+ /* Just retyped a node, probably will need to open a scope */
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
+ Status = AE_OK;
+ }
+ else if (!(Node->Flags & ANOBJ_IS_EXTERNAL) &&
+ (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL))
+ {
+ /*
+ * Allow externals in same scope as the definition of the
+ * actual object. Similar to C. Allows multiple definition
+ * blocks that refer to each other in the same file.
+ */
+ Status = AE_OK;
+ }
+ else if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
+ (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) &&
+ (ObjectType == ACPI_TYPE_ANY))
+ {
+ /* Allow update of externals of unknown type. */
+
+ if (AcpiNsOpensScope (ExternalOpType))
+ {
+ Node->Type = (UINT8) ExternalOpType;
+ Status = AE_OK;
+ }
+ else
+ {
+ sprintf (AslGbl_MsgBuffer, "%s [%s]", Op->Asl.ExternalName,
+ AcpiUtGetTypeName (Node->Type));
+ AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, AslGbl_MsgBuffer);
+ Status = AE_ERROR;
+ }
+ }
+
+ return (Status);
+}
+
+
/*******************************************************************************
*
* FUNCTION: LdCheckSpecialNames
diff --git a/src/acpica/source/compiler/aslmessages.c b/src/acpica/source/compiler/aslmessages.c
index 418df32c..81280b28 100644
--- a/src/acpica/source/compiler/aslmessages.c
+++ b/src/acpica/source/compiler/aslmessages.c
@@ -320,7 +320,7 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator",
/* ASL_MSG_SEEK */ "Could not seek file",
/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized",
-/* ASL_MSG_SERIALIZED_REQUIRED */ "Control Method should be made Serialized",
+/* ASL_MSG_SERIALIZED_REQUIRED */ "Control Method should be made Serialized due to creation of named objects within",
/* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)",
/* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value",
/* ASL_MSG_STRING_LENGTH */ "String literal too long",
@@ -370,7 +370,16 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_INVALID_PROCESSOR_UID */ "_UID inside processor declaration must be an integer",
/* ASL_MSG_LEGACY_PROCESSOR_OP */ "Legacy Processor() keyword detected. Use Device() keyword instead.",
/* ASL_MSG_NAMESTRING_LENGTH */ "NameString contains too many NameSegs (>255)",
-/* ASL_MSG_CASE_FOUND_HERE */ "Original Case value below:"
+/* ASL_MSG_CASE_FOUND_HERE */ "Original Case value below:",
+/* ASL_MSG_EXTERN_INVALID_RET_TYPE */ "Return type is only allowed for Externals declared as MethodObj",
+/* ASL_MSG_EXTERN_INVALID_PARAM_TYPE */ "Parameter type is only allowed for Externals declared as MethodObj",
+/* ASL_MSG_NAMED_OBJECT_CREATION */ "Creation of named objects within a method is highly inefficient, use globals or method local variables instead",
+/* ASL_MSG_ARG_COUNT_MISMATCH */ "Method NumArgs count does not match length of ParameterTypes list",
+/* ASL_MSG_STATIC_OPREGION_IN_METHOD */ "Static OperationRegion should be declared outside control method",
+/* ASL_MSG_DECLARATION_TYPE_MISMATCH */ "Type mismatch between external declaration and actual object declaration detected",
+/* 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:",
};
/* Table compiler */
diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h
index fb3513ab..6d5ffd4d 100644
--- a/src/acpica/source/compiler/aslmessages.h
+++ b/src/acpica/source/compiler/aslmessages.h
@@ -373,6 +373,16 @@ typedef enum
ASL_MSG_LEGACY_PROCESSOR_OP,
ASL_MSG_NAMESTRING_LENGTH,
ASL_MSG_CASE_FOUND_HERE,
+ ASL_MSG_EXTERN_INVALID_RET_TYPE,
+ ASL_MSG_EXTERN_INVALID_PARAM_TYPE,
+ ASL_MSG_NAMED_OBJECT_CREATION,
+ ASL_MSG_ARG_COUNT_MISMATCH,
+ ASL_MSG_STATIC_OPREGION_IN_METHOD,
+ ASL_MSG_DECLARATION_TYPE_MISMATCH,
+ ASL_MSG_TYPE_MISMATCH_FOUND_HERE,
+ ASL_MSG_DUPLICATE_EXTERN_MISMATCH,
+ ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE,
+
/* These messages are used by the Data Table compiler only */
diff --git a/src/acpica/source/compiler/aslmethod.c b/src/acpica/source/compiler/aslmethod.c
index b7b7ec42..d56f4817 100644
--- a/src/acpica/source/compiler/aslmethod.c
+++ b/src/acpica/source/compiler/aslmethod.c
@@ -151,6 +151,7 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
+#include "acnamesp.h"
#include "acparser.h"
#include "amlcode.h"
@@ -166,6 +167,10 @@ MtCheckNamedObjectInMethod (
ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo);
+static void
+MtCheckStaticOperationRegionInMethod (
+ ACPI_PARSE_OBJECT *Op);
+
/*******************************************************************************
*
@@ -197,7 +202,6 @@ MtMethodAnalysisWalkBegin (
char ArgName[] = "Arg0";
ACPI_PARSE_OBJECT *ArgNode;
ACPI_PARSE_OBJECT *NextType;
- ACPI_PARSE_OBJECT *NextParamType;
UINT8 ActualArgs = 0;
BOOLEAN HidExists;
BOOLEAN AdrExists;
@@ -282,50 +286,35 @@ MtMethodAnalysisWalkBegin (
Next = Next->Asl.Next;
NextType = Next->Asl.Child;
- while (NextType)
- {
- /* Get and map each of the ReturnTypes */
- MethodInfo->ValidReturnTypes |= AnMapObjTypeToBtype (NextType);
- NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
- NextType = NextType->Asl.Next;
- }
+ MethodInfo->ValidReturnTypes = MtProcessTypeOp (NextType);
/* Get the ParameterType node */
Next = Next->Asl.Next;
NextType = Next->Asl.Child;
- while (NextType)
+ if (!NextType)
{
- if (NextType->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
- {
- NextParamType = NextType->Asl.Child;
- while (NextParamType)
- {
- MethodInfo->ValidArgTypes[ActualArgs] |=
- AnMapObjTypeToBtype (NextParamType);
-
- NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
- NextParamType = NextParamType->Asl.Next;
- }
- }
- else
- {
- MethodInfo->ValidArgTypes[ActualArgs] =
- AnMapObjTypeToBtype (NextType);
-
- NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
- ActualArgs++;
- }
-
- NextType = NextType->Asl.Next;
+ /*
+ * The optional parameter types list was omitted at the source
+ * level. Use the Argument count parameter instead.
+ */
+ ActualArgs = MethodInfo->NumArguments;
+ }
+ else
+ {
+ ActualArgs = MtProcessParameterTypeList (NextType,
+ MethodInfo->ValidArgTypes);
}
if ((MethodInfo->NumArguments) &&
(MethodInfo->NumArguments != ActualArgs))
{
- /* error: Param list did not match number of args */
+ sprintf (AslGbl_MsgBuffer,
+ "Length = %u", ActualArgs);
+ AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_MISMATCH,
+ Op->Asl.Child->Asl.Next, AslGbl_MsgBuffer);
}
/* Allow numarguments == 0 for Function() */
@@ -576,6 +565,8 @@ MtMethodAnalysisWalkBegin (
AslError (ASL_ERROR, ASL_MSG_RESERVED_USE,
Op, Op->Asl.ExternalName);
}
+
+ MtCheckStaticOperationRegionInMethod (Op);
break;
case PARSEOP_NAME:
@@ -628,6 +619,71 @@ MtMethodAnalysisWalkBegin (
}
+/*******************************************************************************
+ *
+ * FUNCTION: MtProcessTypeOp
+ *
+ * PARAMETERS: Op - Op representing a btype
+ *
+ * RETURN: Btype represented by Op
+ *
+ * DESCRIPTION: Process a parse object that represents single parameter type or
+ * a return type in method, function, and external declarations.
+ *
+ ******************************************************************************/
+
+UINT32
+MtProcessTypeOp (
+ ACPI_PARSE_OBJECT *TypeOp)
+{
+ UINT32 Btype = ACPI_BTYPE_ANY;
+
+
+ while (TypeOp)
+ {
+ Btype |= AnMapObjTypeToBtype (TypeOp);
+ TypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ TypeOp = TypeOp->Asl.Next;
+ }
+
+ return (Btype);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: MtProcessParameterTypeList
+ *
+ * PARAMETERS: Op - Op representing a btype
+ *
+ * RETURN: Btype represented by Op
+ *
+ * DESCRIPTION: Process a parse object that represents a parameter type list in
+ * method, function, and external declarations.
+ *
+ ******************************************************************************/
+
+UINT8
+MtProcessParameterTypeList (
+ ACPI_PARSE_OBJECT *ParamTypeOp,
+ UINT32 *TypeList)
+{
+ UINT8 ParameterCount = 0;
+
+
+ while (ParamTypeOp)
+ {
+ TypeList[ParameterCount] =
+ MtProcessTypeOp (ParamTypeOp->Asl.Child);
+
+ ParameterCount++;
+ ParamTypeOp = ParamTypeOp->Asl.Next;
+ }
+
+ return (ParameterCount);
+}
+
+
/*******************************************************************************
*
* FUNCTION: MtCheckNamedObjectInMethod
@@ -649,6 +705,7 @@ MtCheckNamedObjectInMethod (
ASL_METHOD_INFO *MethodInfo)
{
const ACPI_OPCODE_INFO *OpInfo;
+ char *ExternalPath;
/* We don't care about actual method declarations or scopes */
@@ -672,27 +729,97 @@ MtCheckNamedObjectInMethod (
/*
* 1) Mark the method as a method that creates named objects.
*
- * 2) If the method is non-serialized, emit a remark that the method
+ * 2) Issue a remark indicating the inefficiency of creating named
+ * objects within a method (Except for compiler-emitted temporary
+ * variables).
+ *
+ * 3) If the method is non-serialized, emit a remark that the method
* should be serialized.
*
* Reason: If a thread blocks within the method for any reason, and
* another thread enters the method, the method will fail because
* an attempt will be made to create the same object twice.
*/
+ ExternalPath = AcpiNsGetNormalizedPathname (MethodInfo->Op->Asl.Node, TRUE);
+
+ /* No error for compiler temp variables (name starts with "_T_") */
+
+ if ((Op->Asl.NameSeg[0] != '_') &&
+ (Op->Asl.NameSeg[1] != 'T') &&
+ (Op->Asl.NameSeg[2] != '_'))
+ {
+ AslError (ASL_REMARK, ASL_MSG_NAMED_OBJECT_CREATION, Op,
+ ExternalPath);
+ }
+
MethodInfo->CreatesNamedObjects = TRUE;
if (!MethodInfo->ShouldBeSerialized)
{
AslError (ASL_REMARK, ASL_MSG_SERIALIZED_REQUIRED, MethodInfo->Op,
- "due to creation of named objects within");
+ ExternalPath);
/* Emit message only ONCE per method */
MethodInfo->ShouldBeSerialized = TRUE;
}
+
+ if (ExternalPath)
+ {
+ ACPI_FREE (ExternalPath);
+ }
}
}
+/*******************************************************************************
+ *
+ * FUNCTION: MtCheckStaticOperationRegionInMethod
+ *
+ * PARAMETERS: Op - Current parser op
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Warns if an Operation Region with static address or length
+ * is declared inside a control method
+ *
+ ******************************************************************************/
+
+static void
+MtCheckStaticOperationRegionInMethod(
+ ACPI_PARSE_OBJECT* Op)
+{
+ ACPI_PARSE_OBJECT* AddressOp;
+ ACPI_PARSE_OBJECT* LengthOp;
+
+
+ if (Op->Asl.ParseOpcode != PARSEOP_OPERATIONREGION)
+ {
+ return;
+ }
+
+ /*
+ * OperationRegion should have 4 arguments defined. At this point, we
+ * assume that the parse tree is well-formed.
+ */
+ AddressOp = Op->Asl.Child->Asl.Next->Asl.Next;
+ LengthOp = Op->Asl.Child->Asl.Next->Asl.Next->Asl.Next;
+
+ if (UtGetParentMethodOp (Op) &&
+ AddressOp->Asl.ParseOpcode == PARSEOP_INTEGER &&
+ LengthOp->Asl.ParseOpcode == PARSEOP_INTEGER)
+ {
+ /*
+ * At this point, a static operation region declared inside of a
+ * control method has been found. Throw a warning because this is
+ * highly inefficient.
+ */
+ AslError(ASL_WARNING, ASL_MSG_STATIC_OPREGION_IN_METHOD, Op, NULL);
+ }
+
+ return;
+}
+
+
/*******************************************************************************
*
* FUNCTION: MtMethodAnalysisWalkEnd
@@ -714,6 +841,7 @@ MtMethodAnalysisWalkEnd (
{
ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context;
ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack;
+ char *ExternalPath;
switch (Op->Asl.ParseOpcode)
@@ -766,8 +894,15 @@ MtMethodAnalysisWalkEnd (
if (MethodInfo->NumReturnNoValue &&
MethodInfo->NumReturnWithValue)
{
+ ExternalPath = AcpiNsGetNormalizedPathname (Op->Asl.Node, TRUE);
+
AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op,
- Op->Asl.ExternalName);
+ ExternalPath);
+
+ if (ExternalPath)
+ {
+ ACPI_FREE (ExternalPath);
+ }
}
/*
diff --git a/src/acpica/source/compiler/aslparseop.c b/src/acpica/source/compiler/aslparseop.c
index b58d4e66..46875413 100644
--- a/src/acpica/source/compiler/aslparseop.c
+++ b/src/acpica/source/compiler/aslparseop.c
@@ -743,13 +743,18 @@ TrCreateConstantLeafOp (
/* Get a copy of the current time */
+ Op->Asl.Value.String = "";
CurrentTime = time (NULL);
+
StaticTimeString = ctime (&CurrentTime);
- TimeString = UtLocalCalloc (strlen (StaticTimeString) + 1);
- strcpy (TimeString, StaticTimeString);
+ if (StaticTimeString)
+ {
+ TimeString = UtLocalCalloc (strlen (StaticTimeString) + 1);
+ strcpy (TimeString, StaticTimeString);
- TimeString[strlen(TimeString) -1] = 0; /* Remove trailing newline */
- Op->Asl.Value.String = TimeString;
+ TimeString[strlen(TimeString) -1] = 0; /* Remove trailing newline */
+ Op->Asl.Value.String = TimeString;
+ }
break;
default: /* This would be an internal error */
diff --git a/src/acpica/source/compiler/aslprimaries.y b/src/acpica/source/compiler/aslprimaries.y
index 7bbf4155..1fb9e501 100644
--- a/src/acpica/source/compiler/aslprimaries.y
+++ b/src/acpica/source/compiler/aslprimaries.y
@@ -663,7 +663,7 @@ FunctionTerm
PARSEOP_CLOSE_PAREN '{' {COMMENT_CAPTURE_ON; }
TermList '}' {$$ = TrLinkOpChildren ($<n>3,7,
TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),
- TrCreateValuedLeafOp (PARSEOP_BYTECONST, 0),
+ TrCreateLeafOp (PARSEOP_DEFAULT_ARG),
TrCreateLeafOp (PARSEOP_SERIALIZERULE_NOTSERIAL),
TrCreateValuedLeafOp (PARSEOP_BYTECONST, 0),$5,$6,$10);}
| PARSEOP_FUNCTION
diff --git a/src/acpica/source/compiler/aslrules.y b/src/acpica/source/compiler/aslrules.y
index 9035e8bb..f998527b 100644
--- a/src/acpica/source/compiler/aslrules.y
+++ b/src/acpica/source/compiler/aslrules.y
@@ -421,14 +421,16 @@ ParameterTypePackage
ParameterTypePackageList
: {$$ = NULL;}
- | ObjectTypeKeyword {$$ = $1;}
- | '{' ParameterTypePackage '}' {$$ = $2;}
+ | ObjectTypeKeyword {$$ = TrLinkOpChildren (
+ TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$1);}
+ | '{' ParameterTypePackage '}' {$$ = TrLinkOpChildren (
+ TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
;
+
OptionalParameterTypePackage
- : {$$ = TrCreateLeafOp (PARSEOP_DEFAULT_ARG);}
- | ',' ParameterTypePackageList {$$ = TrLinkOpChildren (
- TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
+ : {$$ = NULL;}
+ | ',' ParameterTypePackageList {$$ = $2;}
;
/* Rules for specifying the types for method arguments */
@@ -441,14 +443,15 @@ ParameterTypesPackage
ParameterTypesPackageList
: {$$ = NULL;}
- | ObjectTypeKeyword {$$ = $1;}
- | '{' ParameterTypesPackage '}' {$$ = $2;}
+ | ObjectTypeKeyword {$$ = TrLinkOpChildren (
+ TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$1);}
+ | '{' ParameterTypesPackage '}' {$$ = TrLinkOpChildren (
+ TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
;
OptionalParameterTypesPackage
- : {$$ = TrCreateLeafOp (PARSEOP_DEFAULT_ARG);}
- | ',' ParameterTypesPackageList {$$ = TrLinkOpChildren (
- TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
+ : {$$ = NULL;}
+ | ',' ParameterTypesPackageList {$$ = $2;}
;
/*
diff --git a/src/acpica/source/compiler/asltransform.c b/src/acpica/source/compiler/asltransform.c
index dcb60f7a..67adf82e 100644
--- a/src/acpica/source/compiler/asltransform.c
+++ b/src/acpica/source/compiler/asltransform.c
@@ -205,6 +205,10 @@ TrCheckForBufferMatch (
ACPI_PARSE_OBJECT *Next1,
ACPI_PARSE_OBJECT *Next2);
+static void
+TrDoMethod (
+ ACPI_PARSE_OBJECT *Op);
+
/*******************************************************************************
*
@@ -463,11 +467,8 @@ TrTransformSubtree (
break;
case PARSEOP_METHOD:
- /*
- * TBD: Zero the tempname (_T_x) count. Probably shouldn't be a global,
- * however
- */
- AslGbl_TempCount = 0;
+
+ TrDoMethod (Op);
break;
case PARSEOP_EXTERNAL:
@@ -1240,3 +1241,76 @@ TrCheckForBufferMatch (
return (TRUE);
}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: TrDoMethod
+ *
+ * PARAMETERS: Op - Parse node for SWITCH
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Determine that parameter count of an ASL method node by
+ * translating the parameter count parse node from
+ * PARSEOP_DEFAULT_ARG to PARSEOP_BYTECONST.
+ *
+ ******************************************************************************/
+
+static void
+TrDoMethod (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *ArgCountOp;
+ UINT8 ArgCount;
+ ACPI_PARSE_OBJECT *ParameterOp;
+
+
+ /*
+ * TBD: Zero the tempname (_T_x) count. Probably shouldn't be a global,
+ * however
+ */
+ AslGbl_TempCount = 0;
+
+ ArgCountOp = Op->Asl.Child->Asl.Next;
+ if (ArgCountOp->Asl.ParseOpcode == PARSEOP_BYTECONST)
+ {
+ /*
+ * Parameter count for this method has already been recorded in the
+ * method declaration.
+ */
+ return;
+ }
+
+ /*
+ * Parameter count has been omitted in the method declaration.
+ * Count the amount of arguments here.
+ */
+ ParameterOp = ArgCountOp->Asl.Next->Asl.Next->Asl.Next->Asl.Next;
+ if (ParameterOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ ArgCount = 0;
+ ParameterOp = ParameterOp->Asl.Child;
+
+ while (ParameterOp)
+ {
+ ParameterOp = ParameterOp->Asl.Next;
+ ArgCount++;
+ }
+
+ ArgCountOp->Asl.Value.Integer = ArgCount;
+ ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST;
+ }
+ else
+ {
+ /*
+ * Method parameters can be counted by analyzing the Parameter type
+ * list. If the Parameter list contains more than 1 parameter, it
+ * is nested under PARSEOP_DEFAULT_ARG. When there is only 1
+ * parameter, the parse tree contains a single node representing
+ * that type.
+ */
+ ArgCountOp->Asl.Value.Integer = 1;
+ ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST;
+ }
+}
diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c
index 4233318f..42ef2c0b 100644
--- a/src/acpica/source/compiler/aslutils.c
+++ b/src/acpica/source/compiler/aslutils.c
@@ -298,7 +298,7 @@ UtNodeIsDescendantOf (
/*******************************************************************************
*
- * FUNCTION: UtGetParentMethod
+ * FUNCTION: UtGetParentMethodNode
*
* PARAMETERS: Node - Namespace node for any object
*
@@ -309,8 +309,8 @@ UtNodeIsDescendantOf (
*
******************************************************************************/
-void *
-UtGetParentMethod (
+ACPI_NAMESPACE_NODE *
+UtGetParentMethodNode (
ACPI_NAMESPACE_NODE *Node)
{
ACPI_NAMESPACE_NODE *ParentNode;
@@ -338,6 +338,41 @@ UtGetParentMethod (
}
+/*******************************************************************************
+ *
+ * FUNCTION: UtGetParentMethodOp
+ *
+ * PARAMETERS: Op - Parse Op to be checked
+ *
+ * RETURN: Control method Op if found. NULL otherwise
+ *
+ * DESCRIPTION: Find the control method parent of a parse op. Returns NULL if
+ * the input Op is not within a control method.
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+UtGetParentMethodOp (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *NextOp;
+
+
+ NextOp = Op->Asl.Parent;
+ while (NextOp)
+ {
+ if (NextOp->Asl.AmlOpcode == AML_METHOD_OP)
+ {
+ return (NextOp);
+ }
+
+ NextOp = NextOp->Asl.Parent;
+ }
+
+ return (NULL); /* No parent method found */
+}
+
+
/*******************************************************************************
*
* FUNCTION: UtDisplaySupportedTables
diff --git a/src/acpica/source/compiler/aslxref.c b/src/acpica/source/compiler/aslxref.c
index 2649373f..38356aa2 100644
--- a/src/acpica/source/compiler/aslxref.c
+++ b/src/acpica/source/compiler/aslxref.c
@@ -180,10 +180,6 @@ XfValidateCrossReference (
const ACPI_OPCODE_INFO *OpInfo,
ACPI_NAMESPACE_NODE *Node);
-static ACPI_PARSE_OBJECT *
-XfGetParentMethod (
- ACPI_PARSE_OBJECT *Op);
-
static BOOLEAN
XfObjectExists (
char *Name);
@@ -380,41 +376,6 @@ XfCheckFieldRange (
}
-/*******************************************************************************
- *
- * FUNCTION: XfGetParentMethod
- *
- * PARAMETERS: Op - Parse Op to be checked
- *
- * RETURN: Control method Op if found. NULL otherwise
- *
- * DESCRIPTION: Find the control method parent of a parse op. Returns NULL if
- * the input Op is not within a control method.
- *
- ******************************************************************************/
-
-static ACPI_PARSE_OBJECT *
-XfGetParentMethod (
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_PARSE_OBJECT *NextOp;
-
-
- NextOp = Op->Asl.Parent;
- while (NextOp)
- {
- if (NextOp->Asl.AmlOpcode == AML_METHOD_OP)
- {
- return (NextOp);
- }
-
- NextOp = NextOp->Asl.Parent;
- }
-
- return (NULL); /* No parent method found */
-}
-
-
/*******************************************************************************
*
* FUNCTION: XfNamespaceLocateBegin
@@ -539,7 +500,7 @@ XfNamespaceLocateBegin (
{
/* Find parent method Op */
- NextOp = XfGetParentMethod (Op);
+ NextOp = UtGetParentMethodOp (Op);
if (!NextOp)
{
return_ACPI_STATUS (AE_OK);
@@ -576,7 +537,7 @@ XfNamespaceLocateBegin (
{
/* Find parent method Op */
- NextOp = XfGetParentMethod (Op);
+ NextOp = UtGetParentMethodOp (Op);
if (!NextOp)
{
return_ACPI_STATUS (AE_OK);
@@ -814,10 +775,10 @@ XfNamespaceLocateBegin (
* same method or outside of any method, this is a forward reference
* and should be reported as a compiler error.
*/
- DeclarationParentMethod = UtGetParentMethod (Node);
- ReferenceParentMethod = XfGetParentMethod (Op);
+ DeclarationParentMethod = UtGetParentMethodNode (Node);
+ ReferenceParentMethod = UtGetParentMethodOp (Op);
- /* case 1: declaration and refrence are both outside of method */
+ /* case 1: declaration and reference are both outside of method */
if (!ReferenceParentMethod && !DeclarationParentMethod)
{
@@ -1337,8 +1298,8 @@ XfNamespaceLocateEnd (
* execution of A)
*
* NOTES:
- * A null pointer returned by either XfGetParentMethod or
- * UtGetParentMethod indicates that the parameter object is not
+ * A null pointer returned by either UtGetParentMethodOp or
+ * UtGetParentMethodNode indicates that the parameter object is not
* within a control method.
*
* Five cases are handled: Case(Op, Node)
@@ -1371,8 +1332,8 @@ XfValidateCrossReference (
* 1) Search upwards in parse tree for owner of the referencing object
* 2) Search upwards in namespace to find the owner of the referenced object
*/
- ReferencingMethodOp = XfGetParentMethod (Op);
- ReferencedMethodNode = UtGetParentMethod (Node);
+ ReferencingMethodOp = UtGetParentMethodOp (Op);
+ ReferencedMethodNode = UtGetParentMethodNode (Node);
if (!ReferencingMethodOp && !ReferencedMethodNode)
{
diff --git a/src/acpica/source/compiler/cvparser.c b/src/acpica/source/compiler/cvparser.c
index 0e0a5b80..370b8036 100644
--- a/src/acpica/source/compiler/cvparser.c
+++ b/src/acpica/source/compiler/cvparser.c
@@ -230,8 +230,7 @@ CvIsFilename (
* FUNCTION: CvInitFileTree
*
* PARAMETERS: Table - input table
- * AmlStart - Address of the starting point of the AML.
- * AmlLength - Length of the AML file.
+ * RootFile - Output file that defines the DefinitionBlock
*
* RETURN: None
*
@@ -243,8 +242,7 @@ CvIsFilename (
void
CvInitFileTree (
ACPI_TABLE_HEADER *Table,
- UINT8 *AmlStart,
- UINT32 AmlLength)
+ FILE *RootFile)
{
UINT8 *TreeAml;
UINT8 *FileEnd;
@@ -252,6 +250,8 @@ CvInitFileTree (
char *PreviousFilename = NULL;
char *ParentFilename = NULL;
char *ChildFilename = NULL;
+ UINT8 *AmlStart;
+ UINT32 AmlLength;
if (!AcpiGbl_CaptureComments)
@@ -259,9 +259,13 @@ CvInitFileTree (
return;
}
+
+ AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+ AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
+
CvDbgPrint ("AmlLength: %x\n", AmlLength);
CvDbgPrint ("AmlStart: %p\n", AmlStart);
- CvDbgPrint ("AmlEnd?: %p\n", AmlStart+AmlLength);
+ CvDbgPrint ("AmlEnd: %p\n", AmlStart+AmlLength);
AcpiGbl_FileTreeRoot = AcpiOsAcquireObject (AcpiGbl_FileCache);
@@ -273,7 +277,7 @@ CvInitFileTree (
/* Set the root file to the current open file */
- AcpiGbl_FileTreeRoot->File = AcpiGbl_OutputFile;
+ AcpiGbl_FileTreeRoot->File = RootFile;
/*
* Set this to true because we don't need to output
diff --git a/src/acpica/source/components/events/evevent.c b/src/acpica/source/components/events/evevent.c
index 800dd962..0afc7473 100644
--- a/src/acpica/source/components/events/evevent.c
+++ b/src/acpica/source/components/events/evevent.c
@@ -299,7 +299,7 @@ AcpiEvFixedEventInitialize (
/*
* Initialize the structure that keeps track of fixed event handlers and
- * enable the fixed events.
+ * disable all of the fixed events.
*/
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
{
diff --git a/src/acpica/source/components/events/evxfgpe.c b/src/acpica/source/components/events/evxfgpe.c
index 131021f1..d652c29f 100644
--- a/src/acpica/source/components/events/evxfgpe.c
+++ b/src/acpica/source/components/events/evxfgpe.c
@@ -1065,6 +1065,44 @@ AcpiEnableAllWakeupGpes (
ACPI_EXPORT_SYMBOL (AcpiEnableAllWakeupGpes)
+/******************************************************************************
+ *
+ * FUNCTION: AcpiAnyGpeStatusSet
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Whether or not the status bit is set for any GPE
+ *
+ * DESCRIPTION: Check the status bits of all enabled GPEs and return TRUE if any
+ * of them is set or FALSE otherwise.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiAnyGpeStatusSet (
+ void)
+{
+ ACPI_STATUS Status;
+ UINT8 Ret;
+
+
+ ACPI_FUNCTION_TRACE (AcpiAnyGpeStatusSet);
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return (FALSE);
+ }
+
+ Ret = AcpiHwCheckAllGpes ();
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+
+ return (Ret);
+}
+
+ACPI_EXPORT_SYMBOL(AcpiAnyGpeStatusSet)
+
+
/*******************************************************************************
*
* FUNCTION: AcpiInstallGpeBlock
diff --git a/src/acpica/source/components/hardware/hwgpe.c b/src/acpica/source/components/hardware/hwgpe.c
index f0b32bd6..e8ad8926 100644
--- a/src/acpica/source/components/hardware/hwgpe.c
+++ b/src/acpica/source/components/hardware/hwgpe.c
@@ -635,6 +635,58 @@ AcpiHwEnableWakeupGpeBlock (
}
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwGetGpeBlockStatus
+ *
+ * PARAMETERS: GpeXruptInfo - GPE Interrupt info
+ * GpeBlock - Gpe Block info
+ *
+ * RETURN: Success
+ *
+ * DESCRIPTION: Produce a combined GPE status bits mask for the given block.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiHwGetGpeBlockStatus(
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock,
+ void *RetPtr)
+{
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ UINT64 InEnable;
+ UINT64 InStatus;
+ ACPI_STATUS Status;
+ UINT8 *Ret = RetPtr;
+ UINT32 i;
+
+
+ /* Examine each GPE Register within the block */
+
+ for (i = 0; i < GpeBlock->RegisterCount; i++)
+ {
+ GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
+
+ Status = AcpiHwRead (&InEnable, &GpeRegisterInfo->EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ continue;
+ }
+
+ Status = AcpiHwRead (&InStatus, &GpeRegisterInfo->StatusAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ continue;
+ }
+
+ *Ret |= InEnable & InStatus;
+ }
+
+ return (AE_OK);
+}
+
+
/******************************************************************************
*
* FUNCTION: AcpiHwDisableAllGpes
@@ -715,4 +767,31 @@ AcpiHwEnableAllWakeupGpes (
return_ACPI_STATUS (Status);
}
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwCheckAllGpes
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Combined status of all GPEs
+ *
+ * DESCRIPTION: Check all enabled GPEs in all GPE blocks and return TRUE if the
+ * status bit is set for at least one of them of FALSE otherwise.
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiHwCheckAllGpes (
+ void)
+{
+ UINT8 Ret = 0;
+
+
+ ACPI_FUNCTION_TRACE (AcpiHwCheckAllGpes);
+
+ (void) AcpiEvWalkGpeList (AcpiHwGetGpeBlockStatus, &Ret);
+ return (Ret != 0);
+}
+
#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/src/acpica/source/components/hardware/hwsleep.c b/src/acpica/source/components/hardware/hwsleep.c
index 3ad4ae23..016f62be 100644
--- a/src/acpica/source/components/hardware/hwsleep.c
+++ b/src/acpica/source/components/hardware/hwsleep.c
@@ -464,6 +464,16 @@ AcpiHwLegacyWake (
AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId,
ACPI_CLEAR_STATUS);
+ /* Enable sleep button */
+
+ (void) AcpiWriteBitRegister (
+ AcpiGbl_FixedEventInfo[ACPI_EVENT_SLEEP_BUTTON].EnableRegisterId,
+ ACPI_ENABLE_EVENT);
+
+ (void) AcpiWriteBitRegister (
+ AcpiGbl_FixedEventInfo[ACPI_EVENT_SLEEP_BUTTON].StatusRegisterId,
+ ACPI_CLEAR_STATUS);
+
AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WORKING);
return_ACPI_STATUS (Status);
}
diff --git a/src/acpica/source/components/namespace/nsnames.c b/src/acpica/source/components/namespace/nsnames.c
index eebdd1a2..a9509195 100644
--- a/src/acpica/source/components/namespace/nsnames.c
+++ b/src/acpica/source/components/namespace/nsnames.c
@@ -336,7 +336,7 @@ AcpiNsHandleToPathname (
/* Build the path in the caller buffer */
(void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer,
- RequiredSize, NoTrailing);
+ (UINT32) RequiredSize, NoTrailing);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n",
(char *) Buffer->Pointer, (UINT32) RequiredSize));
@@ -509,7 +509,7 @@ AcpiNsGetNormalizedPathname (
/* Build the path in the allocated buffer */
- (void) AcpiNsBuildNormalizedPath (Node, NameBuffer, Size, NoTrailing);
+ (void) AcpiNsBuildNormalizedPath (Node, NameBuffer, (UINT32) Size, NoTrailing);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "%s: Path \"%s\"\n",
ACPI_GET_FUNCTION_NAME, NameBuffer));
@@ -542,7 +542,7 @@ AcpiNsBuildPrefixedPathname (
char *FullPath = NULL;
char *ExternalPath = NULL;
char *PrefixPath = NULL;
- UINT32 PrefixPathLength = 0;
+ ACPI_SIZE PrefixPathLength = 0;
/* If there is a prefix, get the pathname to it */
diff --git a/src/acpica/source/components/namespace/nsxfname.c b/src/acpica/source/components/namespace/nsxfname.c
index 5b3d5a9b..53a2f4bf 100644
--- a/src/acpica/source/components/namespace/nsxfname.c
+++ b/src/acpica/source/components/namespace/nsxfname.c
@@ -714,7 +714,7 @@ AcpiInstallMethod (
MethodFlags = *ParserState.Aml++;
AmlStart = ParserState.Aml;
- AmlLength = ACPI_PTR_DIFF (ParserState.PkgEnd, AmlStart);
+ AmlLength = (UINT32) ACPI_PTR_DIFF (ParserState.PkgEnd, AmlStart);
/*
* Allocate resources up-front. We don't want to have to delete a new
diff --git a/src/acpica/source/components/tables/tbxface.c b/src/acpica/source/components/tables/tbxface.c
index 3c17ee00..682cb5a8 100644
--- a/src/acpica/source/components/tables/tbxface.c
+++ b/src/acpica/source/components/tables/tbxface.c
@@ -368,14 +368,14 @@ ACPI_EXPORT_SYMBOL_INIT (AcpiReallocateRootTable)
*
* PARAMETERS: Signature - ACPI signature of needed table
* Instance - Which instance (for SSDTs)
- * OutTableHeader - The pointer to the table header to fill
+ * OutTableHeader - The pointer to the where the table header
+ * is returned
*
- * RETURN: Status and pointer to mapped table header
+ * RETURN: Status and a copy of the table header
*
- * DESCRIPTION: Finds an ACPI table header.
- *
- * NOTE: Caller is responsible in unmapping the header with
- * AcpiOsUnmapMemory
+ * DESCRIPTION: Finds and returns an ACPI table header. Caller provides the
+ * memory where a copy of the header is to be returned
+ * (fixed length).
*
******************************************************************************/
diff --git a/src/acpica/source/components/utilities/utobject.c b/src/acpica/source/components/utilities/utobject.c
index e4b93058..71244e51 100644
--- a/src/acpica/source/components/utilities/utobject.c
+++ b/src/acpica/source/components/utilities/utobject.c
@@ -192,7 +192,7 @@ AcpiUtGetElementLength (
*
* NOTE: We always allocate the worst-case object descriptor because
* these objects are cached, and we want them to be
- * one-size-satisifies-any-request. This in itself may not be
+ * one-size-satisfies-any-request. This in itself may not be
* the most memory efficient, but the efficiency of the object
* cache should more than make up for this!
*
diff --git a/src/acpica/source/include/acconvert.h b/src/acpica/source/include/acconvert.h
index 2894b729..0962a164 100644
--- a/src/acpica/source/include/acconvert.h
+++ b/src/acpica/source/include/acconvert.h
@@ -237,8 +237,7 @@ CgWriteAmlComment (
void
CvInitFileTree (
ACPI_TABLE_HEADER *Table,
- UINT8 *AmlStart,
- UINT32 AmlLength);
+ FILE *RootFile);
void
CvClearOpComments (
diff --git a/src/acpica/source/include/achware.h b/src/acpica/source/include/achware.h
index 646cef85..9ff14d95 100644
--- a/src/acpica/source/include/achware.h
+++ b/src/acpica/source/include/achware.h
@@ -315,6 +315,10 @@ ACPI_STATUS
AcpiHwEnableAllWakeupGpes (
void);
+UINT8
+AcpiHwCheckAllGpes (
+ void);
+
ACPI_STATUS
AcpiHwEnableRuntimeGpeBlock (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
diff --git a/src/acpica/source/include/acmacros.h b/src/acpica/source/include/acmacros.h
index 340875e8..71cd18e2 100644
--- a/src/acpica/source/include/acmacros.h
+++ b/src/acpica/source/include/acmacros.h
@@ -625,7 +625,7 @@
#define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d) CvPrintOneCommentType (a,b,c,d);
#define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) CvPrintOneCommentList (a,b);
#define ASL_CV_FILE_HAS_SWITCHED(a) CvFileHasSwitched(a)
-#define ASL_CV_INIT_FILETREE(a,b,c) CvInitFileTree(a,b,c);
+#define ASL_CV_INIT_FILETREE(a,b) CvInitFileTree(a,b);
#else
@@ -640,7 +640,7 @@
#define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d)
#define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b)
#define ASL_CV_FILE_HAS_SWITCHED(a) 0
-#define ASL_CV_INIT_FILETREE(a,b,c)
+#define ASL_CV_INIT_FILETREE(a,b)
#endif
diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
index 10e5e79a..a39d180e 100644
--- a/src/acpica/source/include/acpixf.h
+++ b/src/acpica/source/include/acpixf.h
@@ -154,7 +154,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20200110
+#define ACPI_CA_VERSION 0x20200214
#include "acconfig.h"
#include "actypes.h"
@@ -1109,6 +1109,10 @@ ACPI_STATUS
AcpiEnableAllWakeupGpes (
void))
+ACPI_HW_DEPENDENT_RETURN_UINT32 (
+ UINT32 AcpiAnyGpeStatusSet (
+ void))
+
ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
AcpiGetGpeDevice (
diff --git a/src/acpica/source/include/actbl1.h b/src/acpica/source/include/actbl1.h
index 6cb327a1..1f0d5c2f 100644
--- a/src/acpica/source/include/actbl1.h
+++ b/src/acpica/source/include/actbl1.h
@@ -1149,7 +1149,7 @@ enum AcpiErstInstructions
enum AcpiErstCommandStatus
{
- ACPI_ERST_SUCESS = 0,
+ ACPI_ERST_SUCCESS = 0,
ACPI_ERST_NO_SPACE = 1,
ACPI_ERST_NOT_AVAILABLE = 2,
ACPI_ERST_FAILURE = 3,
diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h
index 532d1fa8..c7d2c9aa 100644
--- a/src/acpica/source/include/actypes.h
+++ b/src/acpica/source/include/actypes.h
@@ -683,11 +683,12 @@ typedef UINT64 ACPI_INTEGER;
strnlen (a, ACPI_NAMESEG_SIZE) == ACPI_NAMESEG_SIZE)
/*
- * Algorithm to obtain access bit width.
- * Can be used with AccessWidth of ACPI_GENERIC_ADDRESS and AccessSize of
+ * Algorithm to obtain access bit or byte width.
+ * Can be used with AccessSize field of ACPI_GENERIC_ADDRESS and
* ACPI_RESOURCE_GENERIC_REGISTER.
*/
-#define ACPI_ACCESS_BIT_WIDTH(size) (1 << ((size) + 2))
+#define ACPI_ACCESS_BIT_WIDTH(AccessSize) (1 << ((AccessSize) + 2))
+#define ACPI_ACCESS_BYTE_WIDTH(AccessSize) (1 << ((AccessSize) - 1))
/*******************************************************************************
--
2.25.0
More information about the fwts-devel
mailing list