Merge ACPICA 20200214.

This commit is contained in:
Jung-uk Kim 2020-02-14 19:19:39 +00:00
parent 8bf5cb5c35
commit aa36cd6999
44 changed files with 1253 additions and 5349 deletions

View File

@ -1,3 +1,101 @@
----------------------------------------
14 February 2020. Summary of changes for version 20200214:
1) ACPICA kernel-resident subsystem:
Enable sleep button on ACPI legacy wake: Hibernation (S4) is triggered
in a guest when it receives a sleep trigger from the hypervisor. When the
guest resumes from this power state, it does not see the SleepEnabled
bit. In other words, the sleepHibernation (S4) is triggered in a guest
when it receives a sleep trigger from the hypervisor. When the guest
resumes from this power state, it does not see the SleepEnabled bit. In
other words, the sleep button is not enabled on waking from an S4 state.
This causes subsequent invocation of sleep state to fail since the
guest.button is not enabled on waking from an S4 state. This causes
subsequent invocation of sleep state to fail in the guest. Fix this
problem by enabling the sleep button in ACPI legacy wake. From Anchal
Agarwal <anchalag@amazon.com>.
Implemented a new external interface, AcpiAnyGpeStatusSet (). To be used
for checking the status bits of all enabled GPEs in one go. It is needed
to distinguish spurious SCIs from genuine ones when deciding whether or
not to wake up the system from suspend-to-idle.
Generic Makefiles: replace HOST name with ACPI_HOST: Some machines may be
using HOST in their environment to represent the host name for their
machines. Avoid this problem by renaming this variable from HOST to
ACPI_HOST.
MSVC 2017 project files: Enable multiprocessor generation to improve
build performance.
Added a macro to get the byte width of a Generic Address structure. New
ACPI_ACCESS_BYTE_WIDTH is in addition to the existing
ACPI_ACCESS_BIT_WIDTH. From Mika Westerberg.
2) iASL Compiler/Disassembler and ACPICA tools:
iASL: Implemented full support for the (optional, rarely used) ReturnType
and ParameterTypesList for the Method, Function, and External operators.
For Method declarations, the number of individual ParameterTypes must
match the declaration of the number of arguments (NumArgs). This also
Fixes a problem with the External operator where extra/extraneous bytes
were emitted in the AML code if the optional ReturnType/ParameterTypes
were specified for a MethodObj declaration.
New error message:
1) Method NumArgs count does not match length of ParameterTypes list
iASL: Implemented detection of type mismatches between External
declarations and named object declarations. Also, detect type mismatches
between multiple External declarations of the same Name.
New error messages:
1) Type mismatch between external declaration and actual object
declaration detected
2) Type mismatch between multiple external declarations detected
iASL: Implemented new error messages for External operators that specify
a ReturnType and/or ParameterTypesList for any object type other than
control methods (MethodObj).
New error messages:
1) Return type is only allowed for Externals declared as MethodObj
2) Parameter type is only allowed for Externals declared as MethodObj
iASL: Implemented two new remark/warning messages for ASL code that
creates named objects from within a control method. This is very
inefficient since the named object must be created and deleted each time
the method is executed.
New messages:
1) Creation of named objects within a method is highly inefficient, use
globals or method local variables instead (remark)
2) Static OperationRegion should be declared outside control method
(warning)
iASL: Improved illegal forward reference detection by adding support to
detect forward-reference method invocations.
iASL: Detect and issue an error message for NameStrings that contain too
many individual NameSegs (>255). This is an AML limitation that is
defined in the ACPI specification.
New message:
1) NameString contains too many NameSegs (>255)
acpidump: windows: use GetSystemFirmwareTable API for all tables except
SSDT. By using this API, acpidump is able to get all tables in the XSDT
iASL: Removed unused parser file and updated msvc2017 project files.
Removed the obsolete AslCompiler.y from the repository.
iASL: msvc2017: Fixed macros in the file dependency list to prevent
unnecessary rebuilds. Replace %(Directory) with %(RelativeDir).
Disassembler: Prevent spilling error messages to the output file. All
errors are directed to the console instead. These error messages
prevented re-compilation of the resulting disassembled ASL output file
(.DSL).
---------------------------------------- ----------------------------------------
10 January 2020. Summary of changes for version 20200110: 10 January 2020. Summary of changes for version 20200110:
@ -8845,8 +8943,8 @@ much larger code and data size.
Fix build error under Bison-2.4. Fix build error under Bison-2.4.
Dissasembler: Enhanced FADT support. Added decoding of the Boot Disassembler: Enhanced FADT support. Added decoding of the Boot
Architecture Architecture
flags. Now decode all flags, regardless of the FADT version. Flag output flags. Now decode all flags, regardless of the FADT version. Flag output
includes the FADT version which first defined each flag. includes the FADT version which first defined each flag.

View File

@ -12,4 +12,3 @@
..\..\source\components\resources\*.c ..\..\source\components\resources\*.c
..\..\source\components\tables\*.c ..\..\source\components\tables\*.c
..\..\source\components\utilities\*.c ..\..\source\components\utilities\*.c

View File

@ -13,4 +13,3 @@ echo 32-bit lint completed >> LintOut.txt
@echo off @echo off
echo --- echo ---
echo Output placed in LintOut.txt echo Output placed in LintOut.txt

View File

@ -11,4 +11,3 @@ std32.lnt - 32-bit options
std64.lnt - 64-bit options std64.lnt - 64-bit options
options.lnt - common options options.lnt - common options
others - windows/dos compiler option files others - windows/dos compiler option files

View File

@ -13,4 +13,3 @@ c:\acpi\generate\lint\co-msc40.lnt
options.lnt -mL -si2 -spN2 -spF4 -sl4 options.lnt -mL -si2 -spN2 -spF4 -sl4

View File

@ -15,4 +15,3 @@
co.lnt co.lnt
options.lnt options.lnt

View File

@ -26,15 +26,15 @@
# Notes: # Notes:
# gcc should be version 4 or greater, otherwise some of the options # gcc should be version 4 or greater, otherwise some of the options
# used will not be recognized. # used will not be recognized.
# Optional: Set HOST to an appropriate value (_LINUX, _FreeBSD, _APPLE, _CYGWIN, etc.) # Optional: Set ACPI_HOST to an appropriate value (_LINUX, _FreeBSD, _APPLE, _CYGWIN, etc.)
# See include/platform/acenv.h for supported values. # See include/platform/acenv.h for supported values.
# Note: HOST is not nearly as important for applications as it # Note: ACPI_HOST is not nearly as important for applications as it
# is for the kernel-resident version of ACPICA, and it may # is for the kernel-resident version of ACPICA, and it may
# not be necessary to change it. # not be necessary to change it.
# #
.SUFFIXES : .SUFFIXES :
PROGS = acpibin acpidump acpiexamples acpiexec acpihelp acpinames acpisrc acpixtract iasl PROGS = acpibin acpidump acpiexamples acpiexec acpihelp acpinames acpisrc acpixtract iasl
HOST ?= _CYGWIN ACPI_HOST ?= _CYGWIN
CC ?= gcc CC ?= gcc
# #
@ -52,26 +52,26 @@ UNAME_S := $(shell uname -s)
# Host detection and configuration # Host detection and configuration
# #
ifeq ($(UNAME_S), Darwin) # Mac OS X ifeq ($(UNAME_S), Darwin) # Mac OS X
HOST = _APPLE ACPI_HOST = _APPLE
endif endif
ifeq ($(UNAME_S), DragonFly) ifeq ($(UNAME_S), DragonFly)
HOST = _DragonFly ACPI_HOST = _DragonFly
endif endif
ifeq ($(UNAME_S), FreeBSD) ifeq ($(UNAME_S), FreeBSD)
HOST = _FreeBSD ACPI_HOST = _FreeBSD
endif endif
ifeq ($(UNAME_S), NetBSD) ifeq ($(UNAME_S), NetBSD)
HOST = _NetBSD ACPI_HOST = _NetBSD
endif endif
ifeq ($(UNAME_S), QNX) ifeq ($(UNAME_S), QNX)
HOST = _QNX ACPI_HOST = _QNX
endif endif
ifeq ($(HOST), _APPLE) ifeq ($(ACPI_HOST), _APPLE)
INSTALL = cp INSTALL = cp
INSTALLFLAGS ?= -f INSTALLFLAGS ?= -f
else else
@ -183,7 +183,7 @@ OPT_CFLAGS += -D_FORTIFY_SOURCE=2
endif endif
CFLAGS += \ CFLAGS += \
-D$(HOST)\ -D$(ACPI_HOST)\
-D_GNU_SOURCE\ -D_GNU_SOURCE\
-I$(ACPICA_INCLUDE) -I$(ACPICA_INCLUDE)
@ -191,7 +191,7 @@ CFLAGS += \
# QNX requires __EXT to enable most functions in its C library, analogous # QNX requires __EXT to enable most functions in its C library, analogous
# to _GNU_SOURCE. # to _GNU_SOURCE.
# #
ifeq ($(HOST), _QNX) ifeq ($(ACPI_HOST), _QNX)
CFLAGS+=-D__EXT CFLAGS+=-D__EXT
endif endif
@ -231,11 +231,11 @@ CWARNINGFLAGS += \
# #
# Per-host flags and exclusions # Per-host flags and exclusions
# #
ifneq ($(HOST), _FreeBSD) ifneq ($(ACPI_HOST), _FreeBSD)
CWARNINGFLAGS += \ CWARNINGFLAGS += \
-Wempty-body -Wempty-body
ifneq ($(HOST), _APPLE) ifneq ($(ACPI_HOST), _APPLE)
CWARNINGFLAGS += \ CWARNINGFLAGS += \
-Woverride-init\ -Woverride-init\
-Wlogical-op\ -Wlogical-op\

View File

@ -54,19 +54,19 @@ OBJECTS = \
# #
# Per-host interfaces # Per-host interfaces
# #
ifeq ($(HOST), _DragonFly) ifeq ($(ACPI_HOST), _DragonFly)
HOST_FAMILY = BSD HOST_FAMILY = BSD
endif endif
ifeq ($(HOST), _FreeBSD) ifeq ($(ACPI_HOST), _FreeBSD)
HOST_FAMILY = BSD HOST_FAMILY = BSD
endif endif
ifeq ($(HOST), _NetBSD) ifeq ($(ACPI_HOST), _NetBSD)
HOST_FAMILY = BSD HOST_FAMILY = BSD
endif endif
ifeq ($(HOST), _QNX) ifeq ($(ACPI_HOST), _QNX)
HOST_FAMILY = BSD HOST_FAMILY = BSD
endif endif

View File

@ -255,12 +255,12 @@ CFLAGS += \
-DACPI_CHECKSUM_ABORT=TRUE -DACPI_CHECKSUM_ABORT=TRUE
endif endif
ifneq ($(HOST),_QNX) ifneq ($(ACPI_HOST),_QNX)
LDFLAGS += -lpthread LDFLAGS += -lpthread
endif endif
ifneq ($(HOST),_APPLE) ifneq ($(ACPI_HOST),_APPLE)
ifneq ($(HOST),_QNX) ifneq ($(ACPI_HOST),_QNX)
LDFLAGS += -lrt LDFLAGS += -lrt
endif endif
endif endif

View File

@ -156,6 +156,7 @@
#include "acnamesp.h" #include "acnamesp.h"
#include "acparser.h" #include "acparser.h"
#include "acapps.h" #include "acapps.h"
#include "acconvert.h"
#define _COMPONENT ACPI_TOOLS #define _COMPONENT ACPI_TOOLS
@ -379,8 +380,6 @@ AdAmlDisassemble (
Status = AE_ERROR; Status = AE_ERROR;
goto Cleanup; goto Cleanup;
} }
AcpiOsRedirectOutput (File);
} }
*OutFilename = DisasmFilename; *OutFilename = DisasmFilename;
@ -467,6 +466,11 @@ AdDisassembleOneTable (
if (!AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table)) if (!AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table))
{ {
if (File)
{
AcpiOsRedirectOutput (File);
}
AdDisassemblerHeader (Filename, ACPI_IS_DATA_TABLE); AdDisassemblerHeader (Filename, ACPI_IS_DATA_TABLE);
/* This is a "Data Table" (non-AML table) */ /* This is a "Data Table" (non-AML table) */
@ -489,6 +493,10 @@ AdDisassembleOneTable (
return (AE_OK); return (AE_OK);
} }
/* Initialize the converter output file */
ASL_CV_INIT_FILETREE(Table, File);
/* /*
* This is an AML table (DSDT or SSDT). * This is an AML table (DSDT or SSDT).
* Always parse the tables, only option is what to display * Always parse the tables, only option is what to display
@ -501,6 +509,13 @@ AdDisassembleOneTable (
return (Status); return (Status);
} }
/* Redirect output for code generation and debugging output */
if (File)
{
AcpiOsRedirectOutput (File);
}
/* Debug output, namespace and parse tree */ /* Debug output, namespace and parse tree */
if (AslCompilerdebug && File) if (AslCompilerdebug && File)

View File

@ -506,7 +506,6 @@ AdParseTable (
AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)); AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
ASL_CV_INIT_FILETREE(Table, AmlStart, AmlLength);
AcpiUtSetIntegerWidth (Table->Revision); AcpiUtSetIntegerWidth (Table->Revision);

View File

@ -151,6 +151,7 @@
#include "aslcompiler.h" #include "aslcompiler.h"
#include "aslcompiler.y.h" #include "aslcompiler.y.h"
#include "acnamesp.h"
#include <string.h> #include <string.h>
@ -421,6 +422,7 @@ AnCheckMethodReturnValue (
{ {
ACPI_PARSE_OBJECT *OwningOp; ACPI_PARSE_OBJECT *OwningOp;
ACPI_NAMESPACE_NODE *Node; ACPI_NAMESPACE_NODE *Node;
char *ExternalPath;
Node = ArgOp->Asl.Node; Node = ArgOp->Asl.Node;
@ -435,18 +437,19 @@ AnCheckMethodReturnValue (
/* Examine the parent op of this method */ /* Examine the parent op of this method */
OwningOp = Node->Op; OwningOp = Node->Op;
ExternalPath = AcpiNsGetNormalizedPathname (Node, TRUE);
if (OwningOp->Asl.CompileFlags & OP_METHOD_NO_RETVAL) if (OwningOp->Asl.CompileFlags & OP_METHOD_NO_RETVAL)
{ {
/* Method NEVER returns a value */ /* 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) else if (OwningOp->Asl.CompileFlags & OP_METHOD_SOME_NO_RETVAL)
{ {
/* Method SOMETIMES returns a value, SOMETIMES not */ /* Method SOMETIMES returns a value, SOMETIMES not */
AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, Op, ExternalPath);
Op, Op->Asl.ExternalName);
} }
else if (!(ThisNodeBtype & RequiredBtypes)) else if (!(ThisNodeBtype & RequiredBtypes))
{ {
@ -470,6 +473,11 @@ AnCheckMethodReturnValue (
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, AslGbl_MsgBuffer); AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, AslGbl_MsgBuffer);
} }
} }
if (ExternalPath)
{
ACPI_FREE (ExternalPath);
}
} }

View File

@ -647,7 +647,7 @@ void
AslCompilerFileHeader ( AslCompilerFileHeader (
UINT32 FileId) UINT32 FileId)
{ {
struct tm *NewTime; char *NewTime;
time_t Aclock; time_t Aclock;
char *Prefix = ""; char *Prefix = "";
@ -691,13 +691,17 @@ AslCompilerFileHeader (
/* Compilation header with timestamp */ /* Compilation header with timestamp */
(void) time (&Aclock); Aclock = time (NULL);
NewTime = localtime (&Aclock); NewTime = ctime (&Aclock);
FlPrintFile (FileId, FlPrintFile (FileId,
"%sCompilation of \"%s\" - %s%s\n", "%sCompilation of \"%s\" -",
Prefix, AslGbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime), Prefix, AslGbl_Files[ASL_FILE_INPUT].Filename);
Prefix);
if (NewTime)
{
FlPrintFile (FileId, " %s%s\n", NewTime, Prefix);
}
switch (FileId) switch (FileId)
{ {

View File

@ -373,6 +373,15 @@ MtMethodAnalysisWalkEnd (
UINT32 Level, UINT32 Level,
void *Context); void *Context);
UINT32
MtProcessTypeOp (
ACPI_PARSE_OBJECT *TypeOp);
UINT8
MtProcessParameterTypeList (
ACPI_PARSE_OBJECT *ParamTypeOp,
UINT32 *TypeList);
/* /*
* aslbtypes - bitfield data types * aslbtypes - bitfield data types
@ -1233,10 +1242,14 @@ UtDumpBasicOp (
ACPI_PARSE_OBJECT *Op, ACPI_PARSE_OBJECT *Op,
UINT32 Level); UINT32 Level);
void * ACPI_NAMESPACE_NODE *
UtGetParentMethod ( UtGetParentMethodNode (
ACPI_NAMESPACE_NODE *Node); ACPI_NAMESPACE_NODE *Node);
ACPI_PARSE_OBJECT *
UtGetParentMethodOp (
ACPI_PARSE_OBJECT *Op);
BOOLEAN BOOLEAN
UtNodeIsDescendantOf ( UtNodeIsDescendantOf (
ACPI_NAMESPACE_NODE *Node1, ACPI_NAMESPACE_NODE *Node1,

File diff suppressed because it is too large Load Diff

View File

@ -192,12 +192,54 @@ ExDoExternal (
ACPI_PARSE_OBJECT *Prev; ACPI_PARSE_OBJECT *Prev;
ACPI_PARSE_OBJECT *Next; ACPI_PARSE_OBJECT *Next;
ACPI_PARSE_OBJECT *ArgCountOp; 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 = Op->Asl.Child->Asl.Next->Asl.Next;
ArgCountOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; ArgCountOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST; ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST;
ArgCountOp->Asl.Value.Integer = 0; ArgCountOp->Asl.Value.Integer = ParamCount;
UtSetParseOpName (ArgCountOp); UtSetParseOpName (ArgCountOp);
/* Create new list node of arbitrary type */ /* Create new list node of arbitrary type */

View File

@ -196,6 +196,15 @@ LdCheckSpecialNames (
ACPI_NAMESPACE_NODE *Node, ACPI_NAMESPACE_NODE *Node,
ACPI_PARSE_OBJECT *Op); 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 * FUNCTION: LdLoadNamespace
@ -575,7 +584,8 @@ LdNamespace1Begin (
/* Check for a possible illegal forward reference */ /* Check for a possible illegal forward reference */
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || 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. * Op->Asl.Namepath will be NULL for these opcodes.
@ -591,7 +601,8 @@ LdNamespace1Begin (
* We only want references to named objects: * We only want references to named objects:
* Store (2, WXYZ) -> Attempt to resolve the name * 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); return (AE_OK);
} }
@ -899,56 +910,24 @@ LdNamespace1Begin (
Node->Type = (UINT8) ObjectType; Node->Type = (UINT8) ObjectType;
Status = AE_OK; Status = AE_OK;
} }
else if ((Node->Flags & ANOBJ_IS_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 = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
Status = AE_OK;
}
else if (!(Node->Flags & ANOBJ_IS_EXTERNAL) &&
(Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL))
{ {
/* Status = LdAnalyzeExternals (Node, Op, ActualObjectType,
* Allow externals in same scope as the definition of the ObjectType, WalkState);
* actual object. Similar to C. Allows multiple definition if (ACPI_FAILURE (Status))
* 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; if (Status == AE_ERROR)
Status = AE_OK; {
} /*
else * The use of AE_ERROR here indicates that there was a
{ * compiler error emitted in LdAnalyzeExternals which
sprintf (AslGbl_MsgBuffer, "%s [%s]", Op->Asl.ExternalName, * means that the caller should proceed to the next Op
AcpiUtGetTypeName (Node->Type)); * for analysis of subsequent parse objects.
AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, AslGbl_MsgBuffer); */
return_ACPI_STATUS (AE_OK); Status = AE_OK;
}
return_ACPI_STATUS (Status);
} }
} }
else else
@ -1013,15 +992,17 @@ FinishNode:
* Set the actual data type if appropriate (EXTERNAL term only) * Set the actual data type if appropriate (EXTERNAL term only)
* As of 11/19/2019, ASL External() does not support parameter * As of 11/19/2019, ASL External() does not support parameter
* counts. When an External method is loaded, the parameter count is * counts. When an External method is loaded, the parameter count is
* unknown setting Node->Value to ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS * recorded in the external's arg count parameter. The parameter count may
* indicates that the parameter count for this method is unknown. * or may not be known in the declaration. If the value of this node turns
* This information is used in ASL cross reference to help determine the * out to be ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS, it indicates that
* parameter count through method calls. * 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) if (ActualObjectType != ACPI_TYPE_ANY)
{ {
Node->Type = (UINT8) ActualObjectType; 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) 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 * FUNCTION: LdCheckSpecialNames

View File

@ -320,7 +320,7 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator", /* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator",
/* ASL_MSG_SEEK */ "Could not seek file", /* ASL_MSG_SEEK */ "Could not seek file",
/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized", /* 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_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_SOME_NO_RETVAL */ "Called method may not always return a value",
/* ASL_MSG_STRING_LENGTH */ "String literal too long", /* 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_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_LEGACY_PROCESSOR_OP */ "Legacy Processor() keyword detected. Use Device() keyword instead.",
/* ASL_MSG_NAMESTRING_LENGTH */ "NameString contains too many NameSegs (>255)", /* 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 */ /* Table compiler */

View File

@ -373,6 +373,16 @@ typedef enum
ASL_MSG_LEGACY_PROCESSOR_OP, ASL_MSG_LEGACY_PROCESSOR_OP,
ASL_MSG_NAMESTRING_LENGTH, ASL_MSG_NAMESTRING_LENGTH,
ASL_MSG_CASE_FOUND_HERE, 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 */ /* These messages are used by the Data Table compiler only */

View File

@ -151,6 +151,7 @@
#include "aslcompiler.h" #include "aslcompiler.h"
#include "aslcompiler.y.h" #include "aslcompiler.y.h"
#include "acnamesp.h"
#include "acparser.h" #include "acparser.h"
#include "amlcode.h" #include "amlcode.h"
@ -166,6 +167,10 @@ MtCheckNamedObjectInMethod (
ACPI_PARSE_OBJECT *Op, ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo); ASL_METHOD_INFO *MethodInfo);
static void
MtCheckStaticOperationRegionInMethod (
ACPI_PARSE_OBJECT *Op);
/******************************************************************************* /*******************************************************************************
* *
@ -197,7 +202,6 @@ MtMethodAnalysisWalkBegin (
char ArgName[] = "Arg0"; char ArgName[] = "Arg0";
ACPI_PARSE_OBJECT *ArgNode; ACPI_PARSE_OBJECT *ArgNode;
ACPI_PARSE_OBJECT *NextType; ACPI_PARSE_OBJECT *NextType;
ACPI_PARSE_OBJECT *NextParamType;
UINT8 ActualArgs = 0; UINT8 ActualArgs = 0;
BOOLEAN HidExists; BOOLEAN HidExists;
BOOLEAN AdrExists; BOOLEAN AdrExists;
@ -282,50 +286,35 @@ MtMethodAnalysisWalkBegin (
Next = Next->Asl.Next; Next = Next->Asl.Next;
NextType = Next->Asl.Child; NextType = Next->Asl.Child;
while (NextType)
{
/* Get and map each of the ReturnTypes */
MethodInfo->ValidReturnTypes |= AnMapObjTypeToBtype (NextType); MethodInfo->ValidReturnTypes = MtProcessTypeOp (NextType);
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
NextType = NextType->Asl.Next;
}
/* Get the ParameterType node */ /* Get the ParameterType node */
Next = Next->Asl.Next; Next = Next->Asl.Next;
NextType = Next->Asl.Child; NextType = Next->Asl.Child;
while (NextType) if (!NextType)
{ {
if (NextType->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) /*
{ * The optional parameter types list was omitted at the source
NextParamType = NextType->Asl.Child; * level. Use the Argument count parameter instead.
while (NextParamType) */
{ ActualArgs = MethodInfo->NumArguments;
MethodInfo->ValidArgTypes[ActualArgs] |= }
AnMapObjTypeToBtype (NextParamType); else
{
NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; ActualArgs = MtProcessParameterTypeList (NextType,
NextParamType = NextParamType->Asl.Next; MethodInfo->ValidArgTypes);
}
}
else
{
MethodInfo->ValidArgTypes[ActualArgs] =
AnMapObjTypeToBtype (NextType);
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
ActualArgs++;
}
NextType = NextType->Asl.Next;
} }
if ((MethodInfo->NumArguments) && if ((MethodInfo->NumArguments) &&
(MethodInfo->NumArguments != ActualArgs)) (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() */ /* Allow numarguments == 0 for Function() */
@ -576,6 +565,8 @@ MtMethodAnalysisWalkBegin (
AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, AslError (ASL_ERROR, ASL_MSG_RESERVED_USE,
Op, Op->Asl.ExternalName); Op, Op->Asl.ExternalName);
} }
MtCheckStaticOperationRegionInMethod (Op);
break; break;
case PARSEOP_NAME: 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 * FUNCTION: MtCheckNamedObjectInMethod
@ -649,6 +705,7 @@ MtCheckNamedObjectInMethod (
ASL_METHOD_INFO *MethodInfo) ASL_METHOD_INFO *MethodInfo)
{ {
const ACPI_OPCODE_INFO *OpInfo; const ACPI_OPCODE_INFO *OpInfo;
char *ExternalPath;
/* We don't care about actual method declarations or scopes */ /* 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. * 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. * should be serialized.
* *
* Reason: If a thread blocks within the method for any reason, and * Reason: If a thread blocks within the method for any reason, and
* another thread enters the method, the method will fail because * another thread enters the method, the method will fail because
* an attempt will be made to create the same object twice. * 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; MethodInfo->CreatesNamedObjects = TRUE;
if (!MethodInfo->ShouldBeSerialized) if (!MethodInfo->ShouldBeSerialized)
{ {
AslError (ASL_REMARK, ASL_MSG_SERIALIZED_REQUIRED, MethodInfo->Op, AslError (ASL_REMARK, ASL_MSG_SERIALIZED_REQUIRED, MethodInfo->Op,
"due to creation of named objects within"); ExternalPath);
/* Emit message only ONCE per method */ /* Emit message only ONCE per method */
MethodInfo->ShouldBeSerialized = TRUE; 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 * FUNCTION: MtMethodAnalysisWalkEnd
@ -714,6 +841,7 @@ MtMethodAnalysisWalkEnd (
{ {
ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context; ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context;
ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack; ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack;
char *ExternalPath;
switch (Op->Asl.ParseOpcode) switch (Op->Asl.ParseOpcode)
@ -766,8 +894,15 @@ MtMethodAnalysisWalkEnd (
if (MethodInfo->NumReturnNoValue && if (MethodInfo->NumReturnNoValue &&
MethodInfo->NumReturnWithValue) MethodInfo->NumReturnWithValue)
{ {
ExternalPath = AcpiNsGetNormalizedPathname (Op->Asl.Node, TRUE);
AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op, AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op,
Op->Asl.ExternalName); ExternalPath);
if (ExternalPath)
{
ACPI_FREE (ExternalPath);
}
} }
/* /*

View File

@ -743,13 +743,18 @@ TrCreateConstantLeafOp (
/* Get a copy of the current time */ /* Get a copy of the current time */
Op->Asl.Value.String = "";
CurrentTime = time (NULL); CurrentTime = time (NULL);
StaticTimeString = ctime (&CurrentTime);
TimeString = UtLocalCalloc (strlen (StaticTimeString) + 1);
strcpy (TimeString, StaticTimeString);
TimeString[strlen(TimeString) -1] = 0; /* Remove trailing newline */ StaticTimeString = ctime (&CurrentTime);
Op->Asl.Value.String = TimeString; if (StaticTimeString)
{
TimeString = UtLocalCalloc (strlen (StaticTimeString) + 1);
strcpy (TimeString, StaticTimeString);
TimeString[strlen(TimeString) -1] = 0; /* Remove trailing newline */
Op->Asl.Value.String = TimeString;
}
break; break;
default: /* This would be an internal error */ default: /* This would be an internal error */

View File

@ -663,7 +663,7 @@ FunctionTerm
PARSEOP_CLOSE_PAREN '{' {COMMENT_CAPTURE_ON; } PARSEOP_CLOSE_PAREN '{' {COMMENT_CAPTURE_ON; }
TermList '}' {$$ = TrLinkOpChildren ($<n>3,7, TermList '}' {$$ = TrLinkOpChildren ($<n>3,7,
TrSetOpFlags ($4, OP_IS_NAME_DECLARATION), TrSetOpFlags ($4, OP_IS_NAME_DECLARATION),
TrCreateValuedLeafOp (PARSEOP_BYTECONST, 0), TrCreateLeafOp (PARSEOP_DEFAULT_ARG),
TrCreateLeafOp (PARSEOP_SERIALIZERULE_NOTSERIAL), TrCreateLeafOp (PARSEOP_SERIALIZERULE_NOTSERIAL),
TrCreateValuedLeafOp (PARSEOP_BYTECONST, 0),$5,$6,$10);} TrCreateValuedLeafOp (PARSEOP_BYTECONST, 0),$5,$6,$10);}
| PARSEOP_FUNCTION | PARSEOP_FUNCTION

View File

@ -421,14 +421,16 @@ ParameterTypePackage
ParameterTypePackageList ParameterTypePackageList
: {$$ = NULL;} : {$$ = NULL;}
| ObjectTypeKeyword {$$ = $1;} | ObjectTypeKeyword {$$ = TrLinkOpChildren (
| '{' ParameterTypePackage '}' {$$ = $2;} TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$1);}
| '{' ParameterTypePackage '}' {$$ = TrLinkOpChildren (
TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
; ;
OptionalParameterTypePackage OptionalParameterTypePackage
: {$$ = TrCreateLeafOp (PARSEOP_DEFAULT_ARG);} : {$$ = NULL;}
| ',' ParameterTypePackageList {$$ = TrLinkOpChildren ( | ',' ParameterTypePackageList {$$ = $2;}
TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
; ;
/* Rules for specifying the types for method arguments */ /* Rules for specifying the types for method arguments */
@ -441,14 +443,15 @@ ParameterTypesPackage
ParameterTypesPackageList ParameterTypesPackageList
: {$$ = NULL;} : {$$ = NULL;}
| ObjectTypeKeyword {$$ = $1;} | ObjectTypeKeyword {$$ = TrLinkOpChildren (
| '{' ParameterTypesPackage '}' {$$ = $2;} TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$1);}
| '{' ParameterTypesPackage '}' {$$ = TrLinkOpChildren (
TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
; ;
OptionalParameterTypesPackage OptionalParameterTypesPackage
: {$$ = TrCreateLeafOp (PARSEOP_DEFAULT_ARG);} : {$$ = NULL;}
| ',' ParameterTypesPackageList {$$ = TrLinkOpChildren ( | ',' ParameterTypesPackageList {$$ = $2;}
TrCreateLeafOp (PARSEOP_DEFAULT_ARG),1,$2);}
; ;
/* /*

View File

@ -205,6 +205,10 @@ TrCheckForBufferMatch (
ACPI_PARSE_OBJECT *Next1, ACPI_PARSE_OBJECT *Next1,
ACPI_PARSE_OBJECT *Next2); ACPI_PARSE_OBJECT *Next2);
static void
TrDoMethod (
ACPI_PARSE_OBJECT *Op);
/******************************************************************************* /*******************************************************************************
* *
@ -463,11 +467,8 @@ TrTransformSubtree (
break; break;
case PARSEOP_METHOD: case PARSEOP_METHOD:
/*
* TBD: Zero the tempname (_T_x) count. Probably shouldn't be a global, TrDoMethod (Op);
* however
*/
AslGbl_TempCount = 0;
break; break;
case PARSEOP_EXTERNAL: case PARSEOP_EXTERNAL:
@ -1240,3 +1241,76 @@ TrCheckForBufferMatch (
return (TRUE); 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;
}
}

View File

@ -298,7 +298,7 @@ UtNodeIsDescendantOf (
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: UtGetParentMethod * FUNCTION: UtGetParentMethodNode
* *
* PARAMETERS: Node - Namespace node for any object * PARAMETERS: Node - Namespace node for any object
* *
@ -309,8 +309,8 @@ UtNodeIsDescendantOf (
* *
******************************************************************************/ ******************************************************************************/
void * ACPI_NAMESPACE_NODE *
UtGetParentMethod ( UtGetParentMethodNode (
ACPI_NAMESPACE_NODE *Node) ACPI_NAMESPACE_NODE *Node)
{ {
ACPI_NAMESPACE_NODE *ParentNode; 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 * FUNCTION: UtDisplaySupportedTables

View File

@ -180,10 +180,6 @@ XfValidateCrossReference (
const ACPI_OPCODE_INFO *OpInfo, const ACPI_OPCODE_INFO *OpInfo,
ACPI_NAMESPACE_NODE *Node); ACPI_NAMESPACE_NODE *Node);
static ACPI_PARSE_OBJECT *
XfGetParentMethod (
ACPI_PARSE_OBJECT *Op);
static BOOLEAN static BOOLEAN
XfObjectExists ( XfObjectExists (
char *Name); 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 * FUNCTION: XfNamespaceLocateBegin
@ -539,7 +500,7 @@ XfNamespaceLocateBegin (
{ {
/* Find parent method Op */ /* Find parent method Op */
NextOp = XfGetParentMethod (Op); NextOp = UtGetParentMethodOp (Op);
if (!NextOp) if (!NextOp)
{ {
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
@ -576,7 +537,7 @@ XfNamespaceLocateBegin (
{ {
/* Find parent method Op */ /* Find parent method Op */
NextOp = XfGetParentMethod (Op); NextOp = UtGetParentMethodOp (Op);
if (!NextOp) if (!NextOp)
{ {
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
@ -814,10 +775,10 @@ XfNamespaceLocateBegin (
* same method or outside of any method, this is a forward reference * same method or outside of any method, this is a forward reference
* and should be reported as a compiler error. * and should be reported as a compiler error.
*/ */
DeclarationParentMethod = UtGetParentMethod (Node); DeclarationParentMethod = UtGetParentMethodNode (Node);
ReferenceParentMethod = XfGetParentMethod (Op); 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) if (!ReferenceParentMethod && !DeclarationParentMethod)
{ {
@ -1337,8 +1298,8 @@ XfNamespaceLocateEnd (
* execution of A) * execution of A)
* *
* NOTES: * NOTES:
* A null pointer returned by either XfGetParentMethod or * A null pointer returned by either UtGetParentMethodOp or
* UtGetParentMethod indicates that the parameter object is not * UtGetParentMethodNode indicates that the parameter object is not
* within a control method. * within a control method.
* *
* Five cases are handled: Case(Op, Node) * Five cases are handled: Case(Op, Node)
@ -1371,8 +1332,8 @@ XfValidateCrossReference (
* 1) Search upwards in parse tree for owner of the referencing object * 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 * 2) Search upwards in namespace to find the owner of the referenced object
*/ */
ReferencingMethodOp = XfGetParentMethod (Op); ReferencingMethodOp = UtGetParentMethodOp (Op);
ReferencedMethodNode = UtGetParentMethod (Node); ReferencedMethodNode = UtGetParentMethodNode (Node);
if (!ReferencingMethodOp && !ReferencedMethodNode) if (!ReferencingMethodOp && !ReferencedMethodNode)
{ {

View File

@ -230,8 +230,7 @@ CvIsFilename (
* FUNCTION: CvInitFileTree * FUNCTION: CvInitFileTree
* *
* PARAMETERS: Table - input table * PARAMETERS: Table - input table
* AmlStart - Address of the starting point of the AML. * RootFile - Output file that defines the DefinitionBlock
* AmlLength - Length of the AML file.
* *
* RETURN: None * RETURN: None
* *
@ -243,8 +242,7 @@ CvIsFilename (
void void
CvInitFileTree ( CvInitFileTree (
ACPI_TABLE_HEADER *Table, ACPI_TABLE_HEADER *Table,
UINT8 *AmlStart, FILE *RootFile)
UINT32 AmlLength)
{ {
UINT8 *TreeAml; UINT8 *TreeAml;
UINT8 *FileEnd; UINT8 *FileEnd;
@ -252,6 +250,8 @@ CvInitFileTree (
char *PreviousFilename = NULL; char *PreviousFilename = NULL;
char *ParentFilename = NULL; char *ParentFilename = NULL;
char *ChildFilename = NULL; char *ChildFilename = NULL;
UINT8 *AmlStart;
UINT32 AmlLength;
if (!AcpiGbl_CaptureComments) if (!AcpiGbl_CaptureComments)
@ -259,9 +259,13 @@ CvInitFileTree (
return; return;
} }
AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
CvDbgPrint ("AmlLength: %x\n", AmlLength); CvDbgPrint ("AmlLength: %x\n", AmlLength);
CvDbgPrint ("AmlStart: %p\n", AmlStart); CvDbgPrint ("AmlStart: %p\n", AmlStart);
CvDbgPrint ("AmlEnd?: %p\n", AmlStart+AmlLength); CvDbgPrint ("AmlEnd: %p\n", AmlStart+AmlLength);
AcpiGbl_FileTreeRoot = AcpiOsAcquireObject (AcpiGbl_FileCache); AcpiGbl_FileTreeRoot = AcpiOsAcquireObject (AcpiGbl_FileCache);
@ -273,7 +277,7 @@ CvInitFileTree (
/* Set the root file to the current open file */ /* 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 * Set this to true because we don't need to output

View File

@ -299,7 +299,7 @@ AcpiEvFixedEventInitialize (
/* /*
* Initialize the structure that keeps track of fixed event handlers and * 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++) for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
{ {

View File

@ -1065,6 +1065,44 @@ AcpiEnableAllWakeupGpes (
ACPI_EXPORT_SYMBOL (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 * FUNCTION: AcpiInstallGpeBlock

View File

@ -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 * FUNCTION: AcpiHwDisableAllGpes
@ -715,4 +767,31 @@ AcpiHwEnableAllWakeupGpes (
return_ACPI_STATUS (Status); 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 */ #endif /* !ACPI_REDUCED_HARDWARE */

View File

@ -464,6 +464,16 @@ AcpiHwLegacyWake (
AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId, AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId,
ACPI_CLEAR_STATUS); 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); AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WORKING);
return_ACPI_STATUS (Status); return_ACPI_STATUS (Status);
} }

View File

@ -336,7 +336,7 @@ AcpiNsHandleToPathname (
/* Build the path in the caller buffer */ /* Build the path in the caller buffer */
(void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer, (void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer,
RequiredSize, NoTrailing); (UINT32) RequiredSize, NoTrailing);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n",
(char *) Buffer->Pointer, (UINT32) RequiredSize)); (char *) Buffer->Pointer, (UINT32) RequiredSize));
@ -509,7 +509,7 @@ AcpiNsGetNormalizedPathname (
/* Build the path in the allocated buffer */ /* 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_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, "%s: Path \"%s\"\n",
ACPI_GET_FUNCTION_NAME, NameBuffer)); ACPI_GET_FUNCTION_NAME, NameBuffer));
@ -542,7 +542,7 @@ AcpiNsBuildPrefixedPathname (
char *FullPath = NULL; char *FullPath = NULL;
char *ExternalPath = NULL; char *ExternalPath = NULL;
char *PrefixPath = NULL; char *PrefixPath = NULL;
UINT32 PrefixPathLength = 0; ACPI_SIZE PrefixPathLength = 0;
/* If there is a prefix, get the pathname to it */ /* If there is a prefix, get the pathname to it */

View File

@ -714,7 +714,7 @@ AcpiInstallMethod (
MethodFlags = *ParserState.Aml++; MethodFlags = *ParserState.Aml++;
AmlStart = 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 * Allocate resources up-front. We don't want to have to delete a new

View File

@ -368,14 +368,14 @@ ACPI_EXPORT_SYMBOL_INIT (AcpiReallocateRootTable)
* *
* PARAMETERS: Signature - ACPI signature of needed table * PARAMETERS: Signature - ACPI signature of needed table
* Instance - Which instance (for SSDTs) * 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. * DESCRIPTION: Finds and returns an ACPI table header. Caller provides the
* * memory where a copy of the header is to be returned
* NOTE: Caller is responsible in unmapping the header with * (fixed length).
* AcpiOsUnmapMemory
* *
******************************************************************************/ ******************************************************************************/

View File

@ -192,7 +192,7 @@ AcpiUtGetElementLength (
* *
* NOTE: We always allocate the worst-case object descriptor because * NOTE: We always allocate the worst-case object descriptor because
* these objects are cached, and we want them to be * 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 * the most memory efficient, but the efficiency of the object
* cache should more than make up for this! * cache should more than make up for this!
* *

View File

@ -237,8 +237,7 @@ CgWriteAmlComment (
void void
CvInitFileTree ( CvInitFileTree (
ACPI_TABLE_HEADER *Table, ACPI_TABLE_HEADER *Table,
UINT8 *AmlStart, FILE *RootFile);
UINT32 AmlLength);
void void
CvClearOpComments ( CvClearOpComments (

View File

@ -315,6 +315,10 @@ ACPI_STATUS
AcpiHwEnableAllWakeupGpes ( AcpiHwEnableAllWakeupGpes (
void); void);
UINT8
AcpiHwCheckAllGpes (
void);
ACPI_STATUS ACPI_STATUS
AcpiHwEnableRuntimeGpeBlock ( AcpiHwEnableRuntimeGpeBlock (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo, ACPI_GPE_XRUPT_INFO *GpeXruptInfo,

View File

@ -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(a,b,c,d) CvPrintOneCommentType (a,b,c,d);
#define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) CvPrintOneCommentList (a,b); #define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) CvPrintOneCommentList (a,b);
#define ASL_CV_FILE_HAS_SWITCHED(a) CvFileHasSwitched(a) #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 #else
@ -640,7 +640,7 @@
#define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d) #define ASL_CV_PRINT_ONE_COMMENT(a,b,c,d)
#define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b) #define ASL_CV_PRINT_ONE_COMMENT_LIST(a,b)
#define ASL_CV_FILE_HAS_SWITCHED(a) 0 #define ASL_CV_FILE_HAS_SWITCHED(a) 0
#define ASL_CV_INIT_FILETREE(a,b,c) #define ASL_CV_INIT_FILETREE(a,b)
#endif #endif

View File

@ -154,7 +154,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */ /* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20200110 #define ACPI_CA_VERSION 0x20200214
#include "acconfig.h" #include "acconfig.h"
#include "actypes.h" #include "actypes.h"
@ -1109,6 +1109,10 @@ ACPI_STATUS
AcpiEnableAllWakeupGpes ( AcpiEnableAllWakeupGpes (
void)) void))
ACPI_HW_DEPENDENT_RETURN_UINT32 (
UINT32 AcpiAnyGpeStatusSet (
void))
ACPI_HW_DEPENDENT_RETURN_STATUS ( ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS ACPI_STATUS
AcpiGetGpeDevice ( AcpiGetGpeDevice (

View File

@ -1149,7 +1149,7 @@ enum AcpiErstInstructions
enum AcpiErstCommandStatus enum AcpiErstCommandStatus
{ {
ACPI_ERST_SUCESS = 0, ACPI_ERST_SUCCESS = 0,
ACPI_ERST_NO_SPACE = 1, ACPI_ERST_NO_SPACE = 1,
ACPI_ERST_NOT_AVAILABLE = 2, ACPI_ERST_NOT_AVAILABLE = 2,
ACPI_ERST_FAILURE = 3, ACPI_ERST_FAILURE = 3,

View File

@ -683,11 +683,12 @@ typedef UINT64 ACPI_INTEGER;
strnlen (a, ACPI_NAMESEG_SIZE) == ACPI_NAMESEG_SIZE) strnlen (a, ACPI_NAMESEG_SIZE) == ACPI_NAMESEG_SIZE)
/* /*
* Algorithm to obtain access bit width. * Algorithm to obtain access bit or byte width.
* Can be used with AccessWidth of ACPI_GENERIC_ADDRESS and AccessSize of * Can be used with AccessSize field of ACPI_GENERIC_ADDRESS and
* ACPI_RESOURCE_GENERIC_REGISTER. * 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))
/******************************************************************************* /*******************************************************************************

View File

@ -179,20 +179,17 @@ static char KeyBuffer[LOCAL_BUFFER_SIZE];
static char ErrorBuffer[LOCAL_BUFFER_SIZE]; static char ErrorBuffer[LOCAL_BUFFER_SIZE];
/* /*
* Tables supported in the Windows registry. Zero or more SSDTs are assumed to * List of table signatures reported by EnumSystemFirmwareTables ()
* follow these tables.
*/ */
static char *SupportedTables[] = UINT32 *Gbl_AvailableTableSignatures;
{ UINT32 Gbl_TableCount = 0;
"DSDT", UINT32 Gbl_SsdtInstance = 0;
"RSDT",
"FACS",
"FACP"
};
/* Number of table names for the table above. */ BOOLEAN Gbl_TableListInitialized = FALSE;
#define ACPI_OS_NUM_TABLE_ENTRIES 4 static ACPI_STATUS
OslTableInitialize (
void);
/****************************************************************************** /******************************************************************************
@ -264,7 +261,8 @@ AcpiOsGetTableByAddress (
* DESCRIPTION: Get an ACPI table via an index value (0 through n). Returns * DESCRIPTION: Get an ACPI table via an index value (0 through n). Returns
* AE_LIMIT when an invalid index is reached. Index is not * AE_LIMIT when an invalid index is reached. Index is not
* necessarily an index into the RSDT/XSDT. * necessarily an index into the RSDT/XSDT.
* Table is obtained from the Windows registry. * SSDT tables are obtained from the Windows registry. All other
* tables are obtained through GetSystemFirmwareTable ().
* *
* NOTE: Cannot get the physical address from the windows registry; * NOTE: Cannot get the physical address from the windows registry;
* zero is returned instead. * zero is returned instead.
@ -280,35 +278,327 @@ AcpiOsGetTableByIndex (
{ {
ACPI_STATUS Status; ACPI_STATUS Status;
char *Signature; char *Signature;
UINT32 CurrentInstance;
if (Index < ACPI_OS_NUM_TABLE_ENTRIES) /* Enumerate all ACPI table signatures on first invocation of this function */
Status = OslTableInitialize ();
if (ACPI_FAILURE (Status))
{ {
Signature = SupportedTables[Index]; return (Status);
Index = 0; }
/* Validate Index */
if (Index < Gbl_TableCount)
{
Signature = malloc (ACPI_NAMESEG_SIZE + 1);
if (!Signature)
{
return (AE_NO_MEMORY);
}
Signature = memmove (Signature, &Gbl_AvailableTableSignatures[Index], ACPI_NAMESEG_SIZE);
} }
else else
{ {
Signature = ACPI_SIG_SSDT; return (AE_LIMIT);
Index -= ACPI_OS_NUM_TABLE_ENTRIES;
} }
Status = AcpiOsGetTableByName (Signature, Index, Table, Address); if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT))
{
CurrentInstance = Gbl_SsdtInstance;
Gbl_SsdtInstance++;
}
else
{
CurrentInstance = 0;
}
Status = AcpiOsGetTableByName (Signature, CurrentInstance, Table, Address);
if (ACPI_SUCCESS (Status)) if (ACPI_SUCCESS (Status))
{ {
*Instance = Index; *Instance = CurrentInstance;
} }
else if (Status == AE_NOT_FOUND && else if (Status == AE_NOT_FOUND &&
ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT)) ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT))
{ {
/* Treat SSDTs that are not found as invalid index. */ /* Treat SSDTs that are not found as invalid index. */
Status = (AE_LIMIT); Status = AE_LIMIT;
} }
free (Signature);
return (Status); return (Status);
} }
/******************************************************************************
*
* FUNCTION: OslTableInitialize
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Initialize ACPI table data. Enumerate all ACPI table signatures
* and save them to a global list.
*
*****************************************************************************/
static ACPI_STATUS
OslTableInitialize (
void)
{
UINT32 ResultSize;
UINT32 DataSize;
if (Gbl_TableListInitialized)
{
return (AE_OK);
}
/*
* ACPI table signatures are always 4 characters. Therefore, the data size
* buffer should be a multiple of 4
*/
DataSize = EnumSystemFirmwareTables ('ACPI', NULL, 0);
if (DataSize % ACPI_NAMESEG_SIZE)
{
return (AE_ERROR);
}
/*
* EnumSystemFirmwareTables () does not report the DSDT or XSDT. Work around this
* by adding these entries manually.
*/
Gbl_TableCount = 2 + DataSize / ACPI_NAMESEG_SIZE;
Gbl_AvailableTableSignatures = malloc (Gbl_TableCount * ACPI_NAMESEG_SIZE);
if (!Gbl_AvailableTableSignatures)
{
return (AE_NO_MEMORY);
}
ResultSize = EnumSystemFirmwareTables ('ACPI', Gbl_AvailableTableSignatures, DataSize);
if (ResultSize > DataSize)
{
return (AE_ERROR);
}
/* Insert the DSDT and XSDT tables signatures */
Gbl_AvailableTableSignatures [Gbl_TableCount - 1] = 'TDSD';
Gbl_AvailableTableSignatures [Gbl_TableCount - 2] = 'TDSX';
Gbl_TableListInitialized = TRUE;
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: WindowsGetTableFromRegistry
*
* PARAMETERS: Signature - ACPI Signature for desired table. Must be
* a null terminated 4-character string.
* Instance - For SSDTs (0...n). Use 0 otherwise.
* Table - Where a pointer to the table is returned
* Address - Where the table physical address is returned
*
* RETURN: Status; Table buffer and physical address returned if AE_OK.
* AE_LIMIT: Instance is beyond valid limit
* AE_NOT_FOUND: A table with the signature was not found
*
* DESCRIPTION: Get an ACPI table via a table signature (4 ASCII characters).
* Returns AE_LIMIT when an invalid instance is reached.
* Table is obtained from the Windows registry.
*
* NOTE: Assumes the input signature is uppercase.
* Cannot get the physical address from the windows registry;
* zero is returned instead.
*
*****************************************************************************/
static ACPI_STATUS
WindowsGetTableFromRegistry (
char *Signature,
UINT32 Instance,
ACPI_TABLE_HEADER **Table,
ACPI_PHYSICAL_ADDRESS *Address)
{
HKEY Handle = NULL;
LONG WinStatus;
ULONG Type;
ULONG NameSize;
ULONG DataSize;
HKEY SubKey;
ULONG i;
ACPI_TABLE_HEADER *ReturnTable;
ACPI_STATUS Status = AE_OK;
/* Get a handle to the table key */
while (1)
{
strcpy(KeyBuffer, "HARDWARE\\ACPI\\");
if (AcpiUtSafeStrcat(KeyBuffer, sizeof(KeyBuffer), Signature))
{
return (AE_BUFFER_OVERFLOW);
}
/*
* Windows stores SSDT at SSDT, SSD1, ..., SSD9, SSDA, ..., SSDS, SSDT,
* SSDU, ..., SSDY. If the first (0th) and the 29th tables have the same
* OEM ID, Table ID and Revision, then the 29th entry will overwrite the
* first entry... Let's hope that we do not have that many entries.
*/
if (Instance > 0 && ACPI_COMPARE_NAMESEG(Signature, ACPI_SIG_SSDT))
{
if (Instance < 10)
{
KeyBuffer[strlen(KeyBuffer) - 1] = '0' + (char)Instance;
}
else if (Instance < 29)
{
KeyBuffer[strlen(KeyBuffer) - 1] = 'A' + (char)(Instance - 10);
}
else
{
return (AE_LIMIT);
}
}
WinStatus = RegOpenKeyEx(HKEY_LOCAL_MACHINE, KeyBuffer,
0L, KEY_READ, &Handle);
if (WinStatus != ERROR_SUCCESS)
{
/*
* Somewhere along the way, MS changed the registry entry for
* the FADT from
* HARDWARE/ACPI/FACP to
* HARDWARE/ACPI/FADT.
*
* This code allows for both.
*/
if (ACPI_COMPARE_NAMESEG(Signature, "FACP"))
{
Signature = "FADT";
}
else if (ACPI_COMPARE_NAMESEG(Signature, "XSDT"))
{
Signature = "RSDT";
}
else if (ACPI_COMPARE_NAMESEG(Signature, ACPI_SIG_SSDT))
{
/*
* SSDT may not be present on older Windows versions, but it is
* also possible that the index is not found.
*/
return (AE_NOT_FOUND);
}
else
{
fprintf(stderr,
"Could not find %s in registry at %s: %s (WinStatus=0x%X)\n",
Signature, KeyBuffer, WindowsFormatException(WinStatus), WinStatus);
return (AE_NOT_FOUND);
}
}
else
{
break;
}
}
/* Actual data for the table is down a couple levels */
for (i = 0; ;)
{
WinStatus = RegEnumKey(Handle, i, KeyBuffer, sizeof(KeyBuffer));
i++;
if (WinStatus == ERROR_NO_MORE_ITEMS)
{
break;
}
WinStatus = RegOpenKey(Handle, KeyBuffer, &SubKey);
if (WinStatus != ERROR_SUCCESS)
{
fprintf(stderr, "Could not open %s entry: %s\n",
Signature, WindowsFormatException(WinStatus));
Status = AE_ERROR;
goto Cleanup;
}
RegCloseKey(Handle);
Handle = SubKey;
i = 0;
}
/* Find the (binary) table entry */
for (i = 0; ; i++)
{
NameSize = sizeof(KeyBuffer);
WinStatus = RegEnumValue(Handle, i, KeyBuffer, &NameSize, NULL,
&Type, NULL, 0);
if (WinStatus != ERROR_SUCCESS)
{
fprintf(stderr, "Could not get %s registry entry: %s\n",
Signature, WindowsFormatException(WinStatus));
Status = AE_ERROR;
goto Cleanup;
}
if (Type == REG_BINARY)
{
break;
}
}
/* Get the size of the table */
WinStatus = RegQueryValueEx(Handle, KeyBuffer, NULL, NULL,
NULL, &DataSize);
if (WinStatus != ERROR_SUCCESS)
{
fprintf(stderr, "Could not read the %s table size: %s\n",
Signature, WindowsFormatException(WinStatus));
Status = AE_ERROR;
goto Cleanup;
}
/* Allocate a new buffer for the table */
ReturnTable = malloc(DataSize);
if (!ReturnTable)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/* Get the actual table from the registry */
WinStatus = RegQueryValueEx(Handle, KeyBuffer, NULL, NULL,
(UCHAR *)ReturnTable, &DataSize);
if (WinStatus != ERROR_SUCCESS)
{
fprintf(stderr, "Could not read %s data: %s\n",
Signature, WindowsFormatException(WinStatus));
free(ReturnTable);
Status = AE_ERROR;
goto Cleanup;
}
*Table = ReturnTable;
*Address = 0;
Cleanup:
RegCloseKey(Handle);
return (Status);
}
/****************************************************************************** /******************************************************************************
* *
@ -335,189 +625,60 @@ AcpiOsGetTableByIndex (
*****************************************************************************/ *****************************************************************************/
ACPI_STATUS ACPI_STATUS
AcpiOsGetTableByName ( AcpiOsGetTableByName(
char *Signature, char *Signature,
UINT32 Instance, UINT32 Instance,
ACPI_TABLE_HEADER **Table, ACPI_TABLE_HEADER **Table,
ACPI_PHYSICAL_ADDRESS *Address) ACPI_PHYSICAL_ADDRESS *Address)
{ {
HKEY Handle = NULL; LONG Result;
LONG WinStatus; ACPI_STATUS Status = AE_OK;
ULONG Type; UINT32 DataSize;
ULONG NameSize; ACPI_TABLE_HEADER *ReturnTable;
ULONG DataSize; UINT32 UIntSignature = 0;
HKEY SubKey;
ULONG i;
ACPI_TABLE_HEADER *ReturnTable;
ACPI_STATUS Status = AE_OK;
/* Multiple instances are only supported for SSDT tables. */ /* Multiple instances are only supported for SSDT tables. */
if (Instance > 0 && !ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT)) if (Instance > 0 && !ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT))
{ {
return (AE_LIMIT); return (AE_LIMIT);
} }
/* Get a handle to the table key */ if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT))
{
Status = WindowsGetTableFromRegistry ("SSDT", Instance, Table, Address);
return (Status);
}
while (1) /* GetSystemFirmwareTable requires the table signature to be UINT32 */
{
strcpy (KeyBuffer, "HARDWARE\\ACPI\\");
if (AcpiUtSafeStrcat (KeyBuffer, sizeof (KeyBuffer), Signature))
{
return (AE_BUFFER_OVERFLOW);
}
/* UIntSignature = *ACPI_CAST_PTR (UINT32, Signature);
* Windows stores SSDT at SSDT, SSD1, ..., SSD9, SSDA, ..., SSDS, SSDT, DataSize = GetSystemFirmwareTable('ACPI', UIntSignature, NULL, 0);
* SSDU, ..., SSDY. If the first (0th) and the 29th tables have the same if (!DataSize)
* OEM ID, Table ID and Revision, then the 29th entry will overwrite the {
* first entry... Let's hope that we do not have that many entries. fprintf(stderr, "The table signature %s does not exist.", Signature);
*/ return (AE_ERROR);
if (Instance > 0 && ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT)) }
{
if (Instance < 10)
{
KeyBuffer[strlen (KeyBuffer) - 1] = '0' + (char) Instance;
}
else if (Instance < 29)
{
KeyBuffer[strlen (KeyBuffer) - 1] = 'A' + (char) (Instance - 10);
}
else
{
return (AE_LIMIT);
}
}
WinStatus = RegOpenKeyEx (HKEY_LOCAL_MACHINE, KeyBuffer, ReturnTable = malloc(DataSize);
0L, KEY_READ, &Handle); if (!ReturnTable)
{
return (AE_NO_MEMORY);
}
if (WinStatus != ERROR_SUCCESS) Result = GetSystemFirmwareTable('ACPI', UIntSignature, ReturnTable, DataSize);
{ if (Result > (LONG) DataSize)
/* {
* Somewhere along the way, MS changed the registry entry for /* Clean up */
* the FADT from
* HARDWARE/ACPI/FACP to
* HARDWARE/ACPI/FADT.
*
* This code allows for both.
*/
if (ACPI_COMPARE_NAMESEG (Signature, "FACP"))
{
Signature = "FADT";
}
else if (ACPI_COMPARE_NAMESEG (Signature, "XSDT"))
{
Signature = "RSDT";
}
else if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT))
{
/* SSDT may not be present on older Windows versions, but it is
* also possible that the index is not found. */
return (AE_NOT_FOUND);
}
else
{
fprintf (stderr,
"Could not find %s in registry at %s: %s (WinStatus=0x%X)\n",
Signature, KeyBuffer, WindowsFormatException (WinStatus), WinStatus);
return (AE_NOT_FOUND);
}
}
else
{
break;
}
}
/* Actual data for the table is down a couple levels */ fprintf (stderr, "Could not read %s data\n", Signature);
free (ReturnTable);
for (i = 0; ;) return (AE_ERROR);
{ }
WinStatus = RegEnumKey (Handle, i, KeyBuffer, sizeof (KeyBuffer));
i++;
if (WinStatus == ERROR_NO_MORE_ITEMS)
{
break;
}
WinStatus = RegOpenKey (Handle, KeyBuffer, &SubKey);
if (WinStatus != ERROR_SUCCESS)
{
fprintf (stderr, "Could not open %s entry: %s\n",
Signature, WindowsFormatException (WinStatus));
Status = AE_ERROR;
goto Cleanup;
}
RegCloseKey (Handle);
Handle = SubKey;
i = 0;
}
/* Find the (binary) table entry */
for (i = 0; ; i++)
{
NameSize = sizeof (KeyBuffer);
WinStatus = RegEnumValue (Handle, i, KeyBuffer, &NameSize, NULL,
&Type, NULL, 0);
if (WinStatus != ERROR_SUCCESS)
{
fprintf (stderr, "Could not get %s registry entry: %s\n",
Signature, WindowsFormatException (WinStatus));
Status = AE_ERROR;
goto Cleanup;
}
if (Type == REG_BINARY)
{
break;
}
}
/* Get the size of the table */
WinStatus = RegQueryValueEx (Handle, KeyBuffer, NULL, NULL,
NULL, &DataSize);
if (WinStatus != ERROR_SUCCESS)
{
fprintf (stderr, "Could not read the %s table size: %s\n",
Signature, WindowsFormatException (WinStatus));
Status = AE_ERROR;
goto Cleanup;
}
/* Allocate a new buffer for the table */
ReturnTable = malloc (DataSize);
if (!ReturnTable)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
/* Get the actual table from the registry */
WinStatus = RegQueryValueEx (Handle, KeyBuffer, NULL, NULL,
(UCHAR *) ReturnTable, &DataSize);
if (WinStatus != ERROR_SUCCESS)
{
fprintf (stderr, "Could not read %s data: %s\n",
Signature, WindowsFormatException (WinStatus));
free (ReturnTable);
Status = AE_ERROR;
goto Cleanup;
}
*Table = ReturnTable; *Table = ReturnTable;
*Address = 0; return (Status);
Cleanup:
RegCloseKey (Handle);
return (Status);
} }

View File

@ -5692,7 +5692,7 @@ DefinitionBlock (
{ Return (0x41) } // Local1 indicates Local0 is not a Number { Return (0x41) } // Local1 indicates Local0 is not a Number
If (LEqual (Local0, 0)) // Number is type 1 If (LEqual (Local0, 0)) // Number is type 1
{ Return (0x42) } // non-existant signal was acquired { Return (0x42) } // non-existent signal was acquired
Store ("Acquire signal timeout PASS", Debug) Store ("Acquire signal timeout PASS", Debug)
@ -5713,7 +5713,7 @@ DefinitionBlock (
{ Return (0x51) } // Local1 indicates Local0 is not a Number { Return (0x51) } // Local1 indicates Local0 is not a Number
If (LEqual (Local0, 0)) // Number is type 1 If (LEqual (Local0, 0)) // Number is type 1
{ Return (0x52) } // non-existant signal was acquired { Return (0x52) } // non-existent signal was acquired
Store ("Reset signal PASS", Debug) Store ("Reset signal PASS", Debug)
@ -5727,7 +5727,7 @@ DefinitionBlock (
{ Return (0x61) } // Local1 indicates Local0 is not a Number { Return (0x61) } // Local1 indicates Local0 is not a Number
If (LEqual (Local0, 0)) // Number is type 1 If (LEqual (Local0, 0)) // Number is type 1
{ Return (0x62) } // non-existant signal was acquired { Return (0x62) } // non-existent signal was acquired
Store ("Zero Lvalue PASS", Debug) Store ("Zero Lvalue PASS", Debug)
@ -5741,7 +5741,7 @@ DefinitionBlock (
{ Return (0x71) } // Local1 indicates Local0 is not a Number { Return (0x71) } // Local1 indicates Local0 is not a Number
If (LEqual (Local0, 0)) // Number is type 1 If (LEqual (Local0, 0)) // Number is type 1
{ Return (0x72) } // non-existant signal was acquired { Return (0x72) } // non-existent signal was acquired
Store ("One Lvalue PASS", Debug) Store ("One Lvalue PASS", Debug)
@ -5782,7 +5782,7 @@ DefinitionBlock (
{ Return (0x84) } // Local1 indicates Local0 is not a Number { Return (0x84) } // Local1 indicates Local0 is not a Number
If (LEqual (Local0, 0)) // Number is type 1 If (LEqual (Local0, 0)) // Number is type 1
{ Return (0x85) } // non-existant signal was acquired { Return (0x85) } // non-existent signal was acquired
Store ("Acquire Lvalue signal timeout PASS", Debug) Store ("Acquire Lvalue signal timeout PASS", Debug)

View File

@ -47,4 +47,3 @@ for f in $files ; do
diff -pu -I" \*" $sig.asl $sig.dsl >> diff.log diff -pu -I" \*" $sig.asl $sig.dsl >> diff.log
fi fi
done done