diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2013-04-19 05:49:53 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2013-04-19 05:49:53 +0000 |
commit | a95efc1a1522251892a7baebcb0569741ad7c6ca (patch) | |
tree | 123ed5e9ad0bad1d892c0637e33953142b50843f | |
parent | 9b7735bafd2eb5079bc7f216ba350dbf8f268683 (diff) |
Notes
40 files changed, 1301 insertions, 682 deletions
diff --git a/changes.txt b/changes.txt index dd8b8067f191..04bd6e95fce4 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,91 @@ ---------------------------------------- +18 April 2013. Summary of changes for version 20130418: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Fixed a possible buffer overrun during some rare but specific field unit +read operations. This overrun can only happen if the DSDT version is 1 -- +meaning that all AML integers are 32 bits -- and the field length is +between 33 and 55 bits long. During the read, an internal buffer object is +created for the field unit because the field is larger than an integer (32 +bits). However, in this case, the buffer will be incorrectly written +beyond the end because the buffer length is less than the internal minimum +of 64 bits (8 bytes) long. The buffer will be either 5, 6, or 7 bytes +long, but a full 8 bytes will be written. + +Updated the Embedded Controller "orphan" _REG method support. This refers +to _REG methods under the EC device that have no corresponding operation +region. This is allowed by the ACPI specification. This update removes a +dependency on the existence an ECDT table. It will execute an orphan _REG +method as long as the operation region handler for the EC is installed at +the EC device node and not the namespace root. Rui Zhang (original +update), Bob Moore (update/integrate). + +Implemented run-time argument typechecking for all predefined ACPI names +(_STA, _BIF, etc.) This change performs object typechecking on all +incoming arguments for all predefined names executed via +AcpiEvaluateObject. This ensures that ACPI-related device drivers are +passing correct object types as well as the correct number of arguments +(therefore identifying any issues immediately). Also, the ASL/namespace +definition of the predefined name is checked against the ACPI +specification for the proper argument count. Adds one new file, +nsarguments.c + +Changed an exception code for the ASL UnLoad() operator. Changed the +exception code for the case where the input DdbHandle is invalid, from +AE_BAD_PARAMETER to the more appropriate AE_AML_OPERAND_TYPE. + +Unix/Linux makefiles: Removed the use of the -O2 optimization flag in the +global makefile. The use of this flag causes compiler errors on earlier +versions of GCC, so it has been removed for compatibility. + +Miscellaneous cleanup: +1) Removed some unused/obsolete macros +2) Fixed a possible memory leak in the _OSI support +3) Removed an unused variable in the predefined name support +4) Windows OSL: remove obsolete reference to a memory list field + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 95.2K Code, 26.4K Data, 121.6K Total + Debug Version: 183.0K Code, 76.0K Data, 259.0K Total + Previous Release: + Non-Debug Version: 95.6K Code, 26.8K Data, 122.4K Total + Debug Version: 183.5K Code, 76.6K Data, 260.1K Total + + +2) iASL Compiler/Disassembler and Tools: + +AcpiExec: Added installation of a handler for the SystemCMOS address +space. This prevents control method abort if a method accesses this space. + +AcpiExec: Added support for multiple EC devices, and now install EC +operation region handler(s) at the actual EC device instead of the +namespace root. This reflects the typical behavior of host operating +systems. + +AcpiExec: Updated to ensure that all operation region handlers are +installed before the _REG methods are executed. This prevents a _REG +method from aborting if it accesses an address space has no handler. +AcpiExec installs a handler for every possible address space. + +Debugger: Enhanced the "handlers" command to display non-root handlers. +This change enhances the handlers command to display handlers associated +with individual devices throughout the namespace, in addition to the +currently supported display of handlers associated with the root namespace +node. + +ASL Test Suite: Several test suite errors have been identified and +resolved, reducing the total error count during execution. Chao Guan. + +---------------------------------------- 28 March 2013. Summary of changes for version 20130328: 1) ACPICA kernel-resident subsystem: diff --git a/generate/unix/Makefile.config b/generate/unix/Makefile.config index 65242e0a9832..f5f046e5c326 100644 --- a/generate/unix/Makefile.config +++ b/generate/unix/Makefile.config @@ -27,9 +27,6 @@ # $(BITS) must be set to either 32 or 64 # gcc should be version 4 or greater, otherwise some of the options # used will not be recognized. -# Global optimization flags (such as -O2, -Os) may cause issues on -# some compilers. -# The _GNU_SOURCE symbol is required for many hosts. # .SUFFIXES : PROGS = acpibin acpiexec acpihelp acpinames acpisrc acpixtract iasl @@ -106,9 +103,13 @@ ACPICA_HEADERS = \ # # Common compiler flags # +# Flags/option notes: +# Global optimization flags (such as -O2, -Os) are not used, +# since they cause issues on some compilers (such as gcc 4.4) +# The _GNU_SOURCE symbol is required for many hosts. +# OPT_CFLAGS ?= \ -D_FORTIFY_SOURCE=2\ - -O2\ $(CWARNINGFLAGS) CFLAGS += \ diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile index c6bd9109379e..4fdb3537008d 100644 --- a/generate/unix/acpiexec/Makefile +++ b/generate/unix/acpiexec/Makefile @@ -131,6 +131,7 @@ OBJECTS = \ $(OBJDIR)/hwxfsleep.o\ $(OBJDIR)/nsaccess.o\ $(OBJDIR)/nsalloc.o\ + $(OBJDIR)/nsarguments.o\ $(OBJDIR)/nsconvert.o\ $(OBJDIR)/nsdump.o\ $(OBJDIR)/nsdumpdv.o\ diff --git a/source/compiler/aslpredef.c b/source/compiler/aslpredef.c index 4330c1907696..3895681eca1c 100644 --- a/source/compiler/aslpredef.c +++ b/source/compiler/aslpredef.c @@ -124,29 +124,30 @@ ApCheckForPredefinedMethod ( default: /* - * Matched a predefined method name + * Matched a predefined method name - validate the ASL-defined + * argument count against the ACPI specification. * - * Validate the ASL-defined argument count. Allow two different legal - * arg counts. + * Some methods are allowed to have a "minimum" number of args + * (_SCP) because their definition in ACPI has changed over time. */ Gbl_ReservedMethods++; ThisName = &AcpiGbl_PredefinedMethods[Index]; - RequiredArgCount = ThisName->Info.ArgumentList & METHOD_ARG_MASK; + RequiredArgCount = METHOD_GET_ARG_COUNT (ThisName->Info.ArgumentList); if (MethodInfo->NumArguments != RequiredArgCount) { sprintf (MsgBuffer, "%4.4s requires %u", ThisName->Info.Name, RequiredArgCount); - if ((MethodInfo->NumArguments > RequiredArgCount) && - !(ThisName->Info.ArgumentList & ARG_COUNT_IS_MINIMUM)) + if (MethodInfo->NumArguments < RequiredArgCount) { - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, + AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, MsgBuffer); } - else + else if ((MethodInfo->NumArguments > RequiredArgCount) && + !(ThisName->Info.ArgumentList & ARG_COUNT_IS_MINIMUM)) { - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, + AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer); } } @@ -388,7 +389,7 @@ ApCheckForPredefinedObject ( * it must be implemented as a control method */ ThisName = &AcpiGbl_PredefinedMethods[Index]; - if ((ThisName->Info.ArgumentList & METHOD_ARG_MASK) > 0) + if (METHOD_GET_ARG_COUNT (ThisName->Info.ArgumentList) > 0) { AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, "with arguments"); diff --git a/source/compiler/aslprepkg.c b/source/compiler/aslprepkg.c index da34947fb0be..d32b1f24bd07 100644 --- a/source/compiler/aslprepkg.c +++ b/source/compiler/aslprepkg.c @@ -54,12 +54,12 @@ static void ApCheckPackageElements ( - const char *PredefinedName, - ACPI_PARSE_OBJECT *Op, - UINT8 Type1, - UINT32 Count1, - UINT8 Type2, - UINT32 Count2); + const char *PredefinedName, + ACPI_PARSE_OBJECT *Op, + UINT8 Type1, + UINT32 Count1, + UINT8 Type2, + UINT32 Count2); static void ApCheckPackageList ( @@ -93,8 +93,9 @@ ApPackageTooLarge ( * * FUNCTION: ApCheckPackage * - * PARAMETERS: ParentOp - Parser op for the package - * Predefined - Pointer to package-specific info for method + * PARAMETERS: ParentOp - Parser op for the package + * Predefined - Pointer to package-specific info for + * the method * * RETURN: None * @@ -193,8 +194,8 @@ ApCheckPackage ( case ACPI_PTYPE1_VAR: /* - * The package count is variable, there are no sub-packages, and all - * elements must be of the same type + * The package count is variable, there are no sub-packages, + * and all elements must be of the same type */ for (i = 0; i < Count; i++) { @@ -206,9 +207,9 @@ ApCheckPackage ( case ACPI_PTYPE1_OPTION: /* - * The package count is variable, there are no sub-packages. There are - * a fixed number of required elements, and a variable number of - * optional elements. + * The package count is variable, there are no sub-packages. + * There are a fixed number of required elements, and a variable + * number of optional elements. * * Check if package is at least as large as the minimum required */ @@ -268,8 +269,8 @@ ApCheckPackage ( if (ACPI_SUCCESS (Status)) { /* - * Count cannot be larger than the parent package length, but allow it - * to be smaller. The >= accounts for the Integer above. + * Count cannot be larger than the parent package length, but + * allow it to be smaller. The >= accounts for the Integer above. */ ExpectedCount = (UINT32) Op->Asl.Value.Integer; if (ExpectedCount >= Count) @@ -320,12 +321,12 @@ PackageTooSmall: * * FUNCTION: ApCheckPackageElements * - * PARAMETERS: PredefinedName - Pointer to validation data structure - * Op - Parser op for the package - * Type1 - Object type for first group - * Count1 - Count for first group - * Type2 - Object type for second group - * Count2 - Count for second group + * PARAMETERS: PredefinedName - Name of the predefined object + * Op - Parser op for the package + * Type1 - Object type for first group + * Count1 - Count for first group + * Type2 - Object type for second group + * Count2 - Count for second group * * RETURN: None * diff --git a/source/components/debugger/dbdisply.c b/source/components/debugger/dbdisply.c index d75d505b1154..9fc9cf5cdcd0 100644 --- a/source/components/debugger/dbdisply.c +++ b/source/components/debugger/dbdisply.c @@ -68,6 +68,12 @@ static void * AcpiDbGetPointer ( void *Target); +static ACPI_STATUS +AcpiDbDisplayNonRootHandlers ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); /* * System handler information. @@ -76,6 +82,7 @@ AcpiDbGetPointer ( #define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : " #define ACPI_HANDLER_NAME_STRING "%30s : " #define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n" +#define ACPI_HANDLER_PRESENT_STRING2 "%-9s (%p)" #define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n" /* All predefined Address Space IDs */ @@ -984,7 +991,7 @@ AcpiDbDisplayHandlers ( /* Operation region handlers */ - AcpiOsPrintf ("\nOperation Region Handlers:\n"); + AcpiOsPrintf ("\nOperation Region Handlers at the namespace root:\n"); ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); if (ObjDesc) @@ -1076,6 +1083,77 @@ AcpiDbDisplayHandlers ( AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } } + + + /* Other handlers that are installed throughout the namespace */ + + AcpiOsPrintf ("\nOperation Region Handlers for specific devices:\n"); + + (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, AcpiDbDisplayNonRootHandlers, + NULL, NULL, NULL); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbDisplayNonRootHandlers + * + * PARAMETERS: ACPI_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Display information about all handlers installed for a + * device object. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbDisplayNonRootHandlers ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) +{ + ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *HandlerObj; + char *Pathname; + + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + return (AE_OK); + } + + Pathname = AcpiNsGetExternalPathname (Node); + if (!Pathname) + { + return (AE_OK); + } + + /* Display all handlers associated with this device */ + + HandlerObj = ObjDesc->Device.Handler; + while (HandlerObj) + { + AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, + AcpiUtGetRegionName ((UINT8) HandlerObj->AddressSpace.SpaceId), + HandlerObj->AddressSpace.SpaceId); + + AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING2, + (HandlerObj->AddressSpace.HandlerFlags & + ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", + HandlerObj->AddressSpace.Handler); + + AcpiOsPrintf (" Device Name: %s (%p)\n", Pathname, Node); + + HandlerObj = HandlerObj->AddressSpace.Next; + } + + ACPI_FREE (Pathname); + return (AE_OK); } #endif /* ACPI_DEBUGGER */ diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index e0edb5db44ca..3b5f6512ed1a 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -151,8 +151,7 @@ AcpiDbExecuteMethod ( { ACPI_STATUS Status; ACPI_OBJECT_LIST ParamObjects; - ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; - ACPI_DEVICE_INFO *ObjInfo; + ACPI_OBJECT Params[ACPI_DEBUGGER_MAX_ARGS + 1]; UINT32 i; @@ -164,78 +163,30 @@ AcpiDbExecuteMethod ( AcpiOsPrintf ("Warning: debug output is not enabled!\n"); } - /* Get the object info for number of method parameters */ - - Status = AcpiGetObjectInfo (Info->Method, &ObjInfo); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - + ParamObjects.Count = 0; ParamObjects.Pointer = NULL; - ParamObjects.Count = 0; - if (ObjInfo->Type == ACPI_TYPE_METHOD) - { - /* Are there arguments to the method? */ - - i = 0; - if (Info->Args && Info->Args[0]) - { - /* Get arguments passed on the command line */ + /* Pass through any command-line arguments */ - for (; Info->Args[i] && - (i < ACPI_METHOD_NUM_ARGS) && - (i < ObjInfo->ParamCount); - i++) - { - /* Convert input string (token) to an actual ACPI_OBJECT */ - - Status = AcpiDbConvertToObject (Info->Types[i], - Info->Args[i], &Params[i]); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While parsing method arguments")); - goto Cleanup; - } - } - } - - /* Create additional "default" parameters as needed */ + if (Info->Args && Info->Args[0]) + { + /* Get arguments passed on the command line */ - if (i < ObjInfo->ParamCount) + for (i = 0; (Info->Args[i] && *(Info->Args[i])); i++) { - AcpiOsPrintf ("Adding %u arguments containing default values\n", - ObjInfo->ParamCount - i); + /* Convert input string (token) to an actual ACPI_OBJECT */ - for (; i < ObjInfo->ParamCount; i++) + Status = AcpiDbConvertToObject (Info->Types[i], + Info->Args[i], &Params[i]); + if (ACPI_FAILURE (Status)) { - switch (i) - { - case 0: - - Params[0].Type = ACPI_TYPE_INTEGER; - Params[0].Integer.Value = 0x01020304; - break; - - case 1: - - Params[1].Type = ACPI_TYPE_STRING; - Params[1].String.Length = 12; - Params[1].String.Pointer = "AML Debugger"; - break; - - default: - - Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = i * (UINT64) 0x1000; - break; - } + ACPI_EXCEPTION ((AE_INFO, Status, + "While parsing method arguments")); + goto Cleanup; } } - ParamObjects.Count = ObjInfo->ParamCount; + ParamObjects.Count = i; ParamObjects.Pointer = Params; } @@ -247,8 +198,8 @@ AcpiDbExecuteMethod ( /* Do the actual method execution */ AcpiGbl_MethodExecuting = TRUE; - Status = AcpiEvaluateObject (NULL, - Info->Pathname, &ParamObjects, ReturnObj); + Status = AcpiEvaluateObject (NULL, Info->Pathname, + &ParamObjects, ReturnObj); AcpiGbl_CmSingleStep = FALSE; AcpiGbl_MethodExecuting = FALSE; @@ -267,9 +218,7 @@ AcpiDbExecuteMethod ( } Cleanup: - AcpiDbDeleteObjects (ObjInfo->ParamCount, Params); - ACPI_FREE (ObjInfo); - + AcpiDbDeleteObjects (ParamObjects.Count, Params); return_ACPI_STATUS (Status); } diff --git a/source/components/debugger/dbmethod.c b/source/components/debugger/dbmethod.c index 90c0aad3ea6b..6b25f62db450 100644 --- a/source/components/debugger/dbmethod.c +++ b/source/components/debugger/dbmethod.c @@ -49,6 +49,7 @@ #include "acdebug.h" #include "acdisasm.h" #include "acparser.h" +#include "acpredef.h" #ifdef ACPI_DEBUGGER @@ -433,17 +434,23 @@ AcpiDbWalkForExecute ( void *Context, void **ReturnValue) { - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; - ACPI_BUFFER ReturnObj; - ACPI_STATUS Status; - char *Pathname; - UINT32 i; - ACPI_DEVICE_INFO *ObjInfo; - ACPI_OBJECT_LIST ParamObjects; - ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; - const ACPI_PREDEFINED_INFO *Predefined; - + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context; + char *Pathname; + const ACPI_PREDEFINED_INFO *Predefined; + ACPI_DEVICE_INFO *ObjInfo; + ACPI_OBJECT_LIST ParamObjects; + ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; + ACPI_OBJECT *ThisParam; + ACPI_BUFFER ReturnObj; + ACPI_STATUS Status; + UINT16 ArgTypeList; + UINT8 ArgCount; + UINT8 ArgType; + UINT32 i; + + + /* The name must be a predefined ACPI name */ Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); if (!Predefined) @@ -470,21 +477,59 @@ AcpiDbWalkForExecute ( return (Status); } + ParamObjects.Count = 0; ParamObjects.Pointer = NULL; - ParamObjects.Count = 0; if (ObjInfo->Type == ACPI_TYPE_METHOD) { - /* Setup default parameters */ - - for (i = 0; i < ObjInfo->ParamCount; i++) + /* Setup default parameters (with proper types) */ + + ArgTypeList = Predefined->Info.ArgumentList; + ArgCount = METHOD_GET_ARG_COUNT (ArgTypeList); + + /* + * Setup the ACPI-required number of arguments, regardless of what + * the actual method defines. If there is a difference, then the + * method is wrong and a warning will be issued during execution. + */ + ThisParam = Params; + for (i = 0; i < ArgCount; i++) { - Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = 1; + ArgType = METHOD_GET_NEXT_TYPE (ArgTypeList); + ThisParam->Type = ArgType; + + switch (ArgType) + { + case ACPI_TYPE_INTEGER: + ThisParam->Integer.Value = 1; + break; + + case ACPI_TYPE_STRING: + ThisParam->String.Pointer = "This is the default argument string"; + ThisParam->String.Length = ACPI_STRLEN (ThisParam->String.Pointer); + break; + + case ACPI_TYPE_BUFFER: + ThisParam->Buffer.Pointer = (UINT8 *) Params; /* just a garbage buffer */ + ThisParam->Buffer.Length = 48; + break; + + case ACPI_TYPE_PACKAGE: + ThisParam->Package.Elements = NULL; + ThisParam->Package.Count = 0; + break; + + default: + AcpiOsPrintf ("%s: Unsupported argument type: %u\n", + Pathname, ArgType); + break; + } + + ThisParam++; } - ParamObjects.Pointer = Params; - ParamObjects.Count = ObjInfo->ParamCount; + ParamObjects.Count = ArgCount; + ParamObjects.Pointer = Params; } ACPI_FREE (ObjInfo); diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c index 68a92d5929b1..bbe68967a0a0 100644 --- a/source/components/debugger/dbnames.c +++ b/source/components/debugger/dbnames.c @@ -435,6 +435,7 @@ AcpiDbWalkForPredefinedNames ( const ACPI_PREDEFINED_INFO *Predefined; const ACPI_PREDEFINED_INFO *Package = NULL; char *Pathname; + char StringBuffer[48]; Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); @@ -456,23 +457,28 @@ AcpiDbWalkForPredefinedNames ( Package = Predefined + 1; } - AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname, - (Predefined->Info.ArgumentList & METHOD_ARG_MASK), + AcpiUtGetExpectedReturnTypes (StringBuffer, Predefined->Info.ExpectedBtypes); + AcpiOsPrintf ("%-32s Arguments %X, Return Types: %s", Pathname, + METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList), + StringBuffer); + if (Package) { - AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X", + AcpiOsPrintf (" (PkgType %2.2X, ObjType %2.2X, Count %2.2X)", Package->RetInfo.Type, Package->RetInfo.ObjectType1, Package->RetInfo.Count1); } AcpiOsPrintf("\n"); - AcpiNsCheckParameterCount (Pathname, Node, ACPI_UINT32_MAX, Predefined); + /* Check that the declared argument count matches the ACPI spec */ + + AcpiNsCheckAcpiCompliance (Pathname, Node, Predefined); + ACPI_FREE (Pathname); (*Count)++; - return (AE_OK); } diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c index b6388a371dc8..47c8c75b1ab6 100644 --- a/source/components/events/evgpe.c +++ b/source/components/events/evgpe.c @@ -628,7 +628,6 @@ AcpiEvAsynchExecuteGpeMethod ( "while evaluating GPE method [%4.4s]", AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode))); } - break; default: diff --git a/source/components/events/evregion.c b/source/components/events/evregion.c index f4e905969be7..8e11b2944732 100644 --- a/source/components/events/evregion.c +++ b/source/components/events/evregion.c @@ -60,7 +60,7 @@ extern UINT8 AcpiGbl_DefaultAddressSpaces[]; static void AcpiEvOrphanEcRegMethod ( - void); + ACPI_NAMESPACE_NODE *EcDeviceNode); static ACPI_STATUS AcpiEvRegRun ( @@ -564,7 +564,7 @@ AcpiEvExecuteRegMethod ( } Info->PrefixNode = RegionObj2->Extra.Method_REG; - Info->Pathname = NULL; + Info->RelativePathname = NULL; Info->Parameters = Args; Info->Flags = ACPI_IGNORE_RETURN_VALUE; @@ -650,7 +650,7 @@ AcpiEvExecuteRegMethods ( if (SpaceId == ACPI_ADR_SPACE_EC) { - AcpiEvOrphanEcRegMethod (); + AcpiEvOrphanEcRegMethod (Node); } return_ACPI_STATUS (Status); @@ -728,7 +728,7 @@ AcpiEvRegRun ( * * FUNCTION: AcpiEvOrphanEcRegMethod * - * PARAMETERS: None + * PARAMETERS: EcDeviceNode - Namespace node for an EC device * * RETURN: None * @@ -740,41 +740,30 @@ AcpiEvRegRun ( * detected by providing a _REG method object underneath the * Embedded Controller device." * - * To quickly access the EC device, we use the EC_ID that appears - * within the ECDT. Otherwise, we would need to perform a time- - * consuming namespace walk, executing _HID methods to find the - * EC device. + * To quickly access the EC device, we use the EcDeviceNode used + * during EC handler installation. Otherwise, we would need to + * perform a time consuming namespace walk, executing _HID + * methods to find the EC device. + * + * MUTEX: Assumes the namespace is locked * ******************************************************************************/ static void AcpiEvOrphanEcRegMethod ( - void) + ACPI_NAMESPACE_NODE *EcDeviceNode) { - ACPI_TABLE_ECDT *Table; + ACPI_HANDLE RegMethod; + ACPI_NAMESPACE_NODE *NextNode; ACPI_STATUS Status; ACPI_OBJECT_LIST Args; ACPI_OBJECT Objects[2]; - ACPI_NAMESPACE_NODE *EcDeviceNode; - ACPI_NAMESPACE_NODE *RegMethod; - ACPI_NAMESPACE_NODE *NextNode; ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod); - /* Get the ECDT (if present in system) */ - - Status = AcpiGetTable (ACPI_SIG_ECDT, 0, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Table)); - if (ACPI_FAILURE (Status)) - { - return_VOID; - } - - /* We need a valid EC_ID string */ - - if (!(*Table->Id)) + if (!EcDeviceNode) { return_VOID; } @@ -783,23 +772,12 @@ AcpiEvOrphanEcRegMethod ( (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - /* Get a handle to the EC device referenced in the ECDT */ - - Status = AcpiGetHandle (NULL, - ACPI_CAST_PTR (char, Table->Id), - ACPI_CAST_PTR (ACPI_HANDLE, &EcDeviceNode)); - if (ACPI_FAILURE (Status)) - { - goto Exit; - } - /* Get a handle to a _REG method immediately under the EC device */ - Status = AcpiGetHandle (EcDeviceNode, - METHOD_NAME__REG, ACPI_CAST_PTR (ACPI_HANDLE, &RegMethod)); + Status = AcpiGetHandle (EcDeviceNode, METHOD_NAME__REG, &RegMethod); if (ACPI_FAILURE (Status)) { - goto Exit; + goto Exit; /* There is no _REG method present */ } /* @@ -807,7 +785,7 @@ AcpiEvOrphanEcRegMethod ( * this scope with the Embedded Controller space ID. Otherwise, it * will already have been executed. Note, this allows for Regions * with other space IDs to be present; but the code below will then - * execute the _REG method with the EC space ID argument. + * execute the _REG method with the EmbeddedControl SpaceID argument. */ NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL); while (NextNode) @@ -816,12 +794,13 @@ AcpiEvOrphanEcRegMethod ( (NextNode->Object) && (NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC)) { - goto Exit; /* Do not execute _REG */ + goto Exit; /* Do not execute the _REG */ } + NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode); } - /* Evaluate the _REG(EC,Connect) method */ + /* Evaluate the _REG(EmbeddedControl,Connect) method */ Args.Count = 2; Args.Pointer = Objects; diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c index 4f1962b791d8..7d72a5f884aa 100644 --- a/source/components/executer/exconfig.c +++ b/source/components/executer/exconfig.c @@ -643,7 +643,7 @@ AcpiExUnloadTable ( (DdbHandle->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) || (!(DdbHandle->Common.Flags & AOPOBJ_DATA_VALID))) { - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } /* Get the table index from the DdbHandle */ diff --git a/source/components/executer/exfldio.c b/source/components/executer/exfldio.c index 24636ab3e0fc..85da123903da 100644 --- a/source/components/executer/exfldio.c +++ b/source/components/executer/exfldio.c @@ -766,7 +766,18 @@ AcpiExExtractFromField ( if ((ObjDesc->CommonField.StartFieldBitOffset == 0) && (ObjDesc->CommonField.BitLength == AccessBitWidth)) { - Status = AcpiExFieldDatumIo (ObjDesc, 0, Buffer, ACPI_READ); + if (BufferLength >= sizeof (UINT64)) + { + Status = AcpiExFieldDatumIo (ObjDesc, 0, Buffer, ACPI_READ); + } + else + { + /* Use RawDatum (UINT64) to handle buffers < 64 bits */ + + Status = AcpiExFieldDatumIo (ObjDesc, 0, &RawDatum, ACPI_READ); + ACPI_MEMCPY (Buffer, &RawDatum, BufferLength); + } + return_ACPI_STATUS (Status); } diff --git a/source/components/hardware/hwxface.c b/source/components/hardware/hwxface.c index 9d02640f0583..6f26c793939a 100644 --- a/source/components/hardware/hwxface.c +++ b/source/components/hardware/hwxface.c @@ -556,7 +556,8 @@ AcpiGetSleepTypeData ( * Evaluate the \_Sx namespace object containing the register values * for this state */ - Info->Pathname = ACPI_CAST_PTR (char, AcpiGbl_SleepStateNames[SleepState]); + Info->RelativePathname = ACPI_CAST_PTR ( + char, AcpiGbl_SleepStateNames[SleepState]); Status = AcpiNsEvaluate (Info); if (ACPI_FAILURE (Status)) { @@ -568,7 +569,7 @@ AcpiGetSleepTypeData ( if (!Info->ReturnObject) { ACPI_ERROR ((AE_INFO, "No Sleep State object returned from [%s]", - Info->Pathname)); + Info->RelativePathname)); Status = AE_AML_NO_RETURN_VALUE; goto Cleanup; } @@ -630,7 +631,7 @@ Cleanup: if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, - "While evaluating Sleep State [%s]", Info->Pathname)); + "While evaluating Sleep State [%s]", Info->RelativePathname)); } ACPI_FREE (Info); diff --git a/source/components/namespace/nsarguments.c b/source/components/namespace/nsarguments.c new file mode 100644 index 000000000000..912813cf9c04 --- /dev/null +++ b/source/components/namespace/nsarguments.c @@ -0,0 +1,303 @@ +/****************************************************************************** + * + * Module Name: nsarguments - Validation of args for ACPI predefined methods + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2013, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acpredef.h" + + +#define _COMPONENT ACPI_NAMESPACE + ACPI_MODULE_NAME ("nsarguments") + + +/******************************************************************************* + * + * FUNCTION: AcpiNsCheckArgumentTypes + * + * PARAMETERS: Info - Method execution information block + * + * RETURN: None + * + * DESCRIPTION: Check the incoming argument count and all argument types + * against the argument type list for a predefined name. + * + ******************************************************************************/ + +void +AcpiNsCheckArgumentTypes ( + ACPI_EVALUATE_INFO *Info) +{ + UINT16 ArgTypeList; + UINT8 ArgCount; + UINT8 ArgType; + UINT8 UserArgType; + UINT32 i; + + + /* If not a predefined name, cannot typecheck args */ + + if (!Info->Predefined) + { + return; + } + + ArgTypeList = Info->Predefined->Info.ArgumentList; + ArgCount = METHOD_GET_ARG_COUNT (ArgTypeList); + + /* Typecheck all arguments */ + + for (i = 0; ((i < ArgCount) && (i < Info->ParamCount)); i++) + { + ArgType = METHOD_GET_NEXT_TYPE (ArgTypeList); + UserArgType = Info->Parameters[i]->Common.Type; + + if (UserArgType != ArgType) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS, + "Argument #%u type mismatch - " + "Found [%s], ACPI requires [%s]", (i + 1), + AcpiUtGetTypeName (UserArgType), + AcpiUtGetTypeName (ArgType))); + } + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsCheckAcpiCompliance + * + * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * Node - Namespace node for the method/object + * Predefined - Pointer to entry in predefined name table + * + * RETURN: None + * + * DESCRIPTION: Check that the declared parameter count (in ASL/AML) for a + * predefined name is what is expected (matches what is defined in + * the ACPI specification for this predefined name.) + * + ******************************************************************************/ + +void +AcpiNsCheckAcpiCompliance ( + char *Pathname, + ACPI_NAMESPACE_NODE *Node, + const ACPI_PREDEFINED_INFO *Predefined) +{ + UINT32 AmlParamCount; + UINT32 RequiredParamCount; + + + if (!Predefined) + { + return; + } + + /* Get the ACPI-required arg count from the predefined info table */ + + RequiredParamCount = METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); + + /* + * If this object is not a control method, we can check if the ACPI + * spec requires that it be a method. + */ + if (Node->Type != ACPI_TYPE_METHOD) + { + if (RequiredParamCount > 0) + { + /* Object requires args, must be implemented as a method */ + + ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Object (%s) must be a control method with %u arguments", + AcpiUtGetTypeName (Node->Type), RequiredParamCount)); + } + else if (!RequiredParamCount && !Predefined->Info.ExpectedBtypes) + { + /* Object requires no args and no return value, must be a method */ + + ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Object (%s) must be a control method " + "with no arguments and no return value", + AcpiUtGetTypeName (Node->Type))); + } + + return; + } + + /* + * This is a control method. + * Check that the ASL/AML-defined parameter count for this method + * matches the ACPI-required parameter count + * + * Some methods are allowed to have a "minimum" number of args (_SCP) + * because their definition in ACPI has changed over time. + * + * Note: These are BIOS errors in the declaration of the object + */ + AmlParamCount = Node->Object->Method.ParamCount; + + if (AmlParamCount < RequiredParamCount) + { + ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Insufficient arguments - " + "ASL declared %u, ACPI requires %u", + AmlParamCount, RequiredParamCount)); + } + else if ((AmlParamCount > RequiredParamCount) && + !(Predefined->Info.ArgumentList & ARG_COUNT_IS_MINIMUM)) + { + ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Excess arguments - " + "ASL declared %u, ACPI requires %u", + AmlParamCount, RequiredParamCount)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsCheckArgumentCount + * + * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * Node - Namespace node for the method/object + * UserParamCount - Number of args passed in by the caller + * Predefined - Pointer to entry in predefined name table + * + * RETURN: None + * + * DESCRIPTION: Check that incoming argument count matches the declared + * parameter count (in the ASL/AML) for an object. + * + ******************************************************************************/ + +void +AcpiNsCheckArgumentCount ( + char *Pathname, + ACPI_NAMESPACE_NODE *Node, + UINT32 UserParamCount, + const ACPI_PREDEFINED_INFO *Predefined) +{ + UINT32 AmlParamCount; + UINT32 RequiredParamCount; + + + if (!Predefined) + { + /* + * Not a predefined name. Check the incoming user argument count + * against the count that is specified in the method/object. + */ + if (Node->Type != ACPI_TYPE_METHOD) + { + if (UserParamCount) + { + ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "%u arguments were passed to a non-method ACPI object (%s)", + UserParamCount, AcpiUtGetTypeName (Node->Type))); + } + + return; + } + + /* + * This is a control method. Check the parameter count. + * We can only check the incoming argument count against the + * argument count declared for the method in the ASL/AML. + * + * Emit a message if too few or too many arguments have been passed + * by the caller. + * + * Note: Too many arguments will not cause the method to + * fail. However, the method will fail if there are too few + * arguments and the method attempts to use one of the missing ones. + */ + AmlParamCount = Node->Object->Method.ParamCount; + + if (UserParamCount < AmlParamCount) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Insufficient arguments - " + "Caller passed %u, method requires %u", + UserParamCount, AmlParamCount)); + } + else if (UserParamCount > AmlParamCount) + { + ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Excess arguments - " + "Caller passed %u, method requires %u", + UserParamCount, AmlParamCount)); + } + + return; + } + + /* + * This is a predefined name. Validate the user-supplied parameter + * count against the ACPI specification. We don't validate against + * the method itself because what is important here is that the + * caller is in conformance with the spec. (The arg count for the + * method was checked against the ACPI spec earlier.) + * + * Some methods are allowed to have a "minimum" number of args (_SCP) + * because their definition in ACPI has changed over time. + */ + RequiredParamCount = METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList); + + if (UserParamCount < RequiredParamCount) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Insufficient arguments - " + "Caller passed %u, ACPI requires %u", + UserParamCount, RequiredParamCount)); + } + else if ((UserParamCount > RequiredParamCount) && + !(Predefined->Info.ArgumentList & ARG_COUNT_IS_MINIMUM)) + { + ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Excess arguments - " + "Caller passed %u, ACPI requires %u", + UserParamCount, RequiredParamCount)); + } +} diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index 1de341ce9024..c92e6e7ec9ee 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -67,7 +67,7 @@ AcpiNsExecModuleCode ( * * PARAMETERS: Info - Evaluation info block, contains: * PrefixNode - Prefix or Method/Object Node to execute - * Pathname - Name of method to execute, If NULL, the + * RelativePath - Name of method to execute, If NULL, the * Node is the object to execute * Parameters - List of parameters to pass to the method, * terminated by NULL. Params itself may be @@ -93,7 +93,6 @@ AcpiNsEvaluate ( ACPI_EVALUATE_INFO *Info) { ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; ACPI_FUNCTION_TRACE (NsEvaluate); @@ -104,23 +103,18 @@ AcpiNsEvaluate ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* Initialize the return value to an invalid object */ - - Info->ReturnObject = NULL; - Info->ParamCount = 0; - - if (!Info->ResolvedNode) + if (!Info->Node) { /* - * Get the actual namespace node for the target object if we need to. - * Handles these cases: + * Get the actual namespace node for the target object if we + * need to. Handles these cases: * - * 1) Null node, Pathname (absolute path) - * 2) Node, Pathname (path relative to Node) - * 3) Node, Null Pathname + * 1) Null node, valid pathname from root (absolute path) + * 2) Node and valid pathname (path relative to Node) + * 3) Node, Null pathname */ - Status = AcpiNsGetNode (Info->PrefixNode, Info->Pathname, - ACPI_NS_NO_UPSEARCH, &Info->ResolvedNode); + Status = AcpiNsGetNode (Info->PrefixNode, Info->RelativePathname, + ACPI_NS_NO_UPSEARCH, &Info->Node); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -128,60 +122,122 @@ AcpiNsEvaluate ( } /* - * For a method alias, we must grab the actual method node so that proper - * scoping context will be established before execution. + * For a method alias, we must grab the actual method node so that + * proper scoping context will be established before execution. */ - if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_LOCAL_METHOD_ALIAS) + if (AcpiNsGetType (Info->Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) + { + Info->Node = ACPI_CAST_PTR ( + ACPI_NAMESPACE_NODE, Info->Node->Object); + } + + /* Complete the info block initialization */ + + Info->ReturnObject = NULL; + Info->NodeFlags = Info->Node->Flags; + Info->ObjDesc = AcpiNsGetAttachedObject (Info->Node); + + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", + Info->RelativePathname, Info->Node, + AcpiNsGetAttachedObject (Info->Node))); + + /* Get info if we have a predefined name (_HID, etc.) */ + + Info->Predefined = AcpiUtMatchPredefinedMethod (Info->Node->Name.Ascii); + + /* Get the full pathname to the object, for use in warning messages */ + + Info->FullPathname = AcpiNsGetExternalPathname (Info->Node); + if (!Info->FullPathname) { - Info->ResolvedNode = - ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Info->ResolvedNode->Object); + return_ACPI_STATUS (AE_NO_MEMORY); } - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", Info->Pathname, - Info->ResolvedNode, AcpiNsGetAttachedObject (Info->ResolvedNode))); + /* Count the number of arguments being passed in */ - Node = Info->ResolvedNode; + Info->ParamCount = 0; + if (Info->Parameters) + { + while (Info->Parameters[Info->ParamCount]) + { + Info->ParamCount++; + } + + /* Warn on impossible argument count */ + + if (Info->ParamCount > ACPI_METHOD_NUM_ARGS) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS, + "Excess arguments (%u) - using only %u", + Info->ParamCount, ACPI_METHOD_NUM_ARGS)); + + Info->ParamCount = ACPI_METHOD_NUM_ARGS; + } + } /* - * Two major cases here: + * For predefined names: Check that the declared argument count + * matches the ACPI spec -- otherwise this is a BIOS error. + */ + AcpiNsCheckAcpiCompliance (Info->FullPathname, Info->Node, + Info->Predefined); + + /* + * For all names: Check that the incoming argument count for + * this method/object matches the actual ASL/AML definition. + */ + AcpiNsCheckArgumentCount (Info->FullPathname, Info->Node, + Info->ParamCount, Info->Predefined); + + /* For predefined names: Typecheck all incoming arguments */ + + AcpiNsCheckArgumentTypes (Info); + + /* + * Three major evaluation cases: * - * 1) The object is a control method -- execute it - * 2) The object is not a method -- just return it's current value + * 1) Object types that cannot be evaluated by definition + * 2) The object is a control method -- execute it + * 3) The object is not a method -- just return it's current value */ - if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_METHOD) + switch (AcpiNsGetType (Info->Node)) { + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_EVENT: + case ACPI_TYPE_MUTEX: + case ACPI_TYPE_REGION: + case ACPI_TYPE_THERMAL: + case ACPI_TYPE_LOCAL_SCOPE: /* - * 1) Object is a control method - execute it + * 1) Disallow evaluation of certain object types. For these, + * object evaluation is undefined and not supported. */ + ACPI_ERROR ((AE_INFO, + "%s: Evaluation of object type [%s] is not supported", + Info->FullPathname, + AcpiUtGetTypeName (Info->Node->Type))); - /* Verify that there is a method object associated with this node */ + Status = AE_TYPE; + goto Cleanup; - Info->ObjDesc = AcpiNsGetAttachedObject (Info->ResolvedNode); - if (!Info->ObjDesc) - { - ACPI_ERROR ((AE_INFO, "Control method has no attached sub-object")); - return_ACPI_STATUS (AE_NULL_OBJECT); - } + case ACPI_TYPE_METHOD: + /* + * 2) Object is a control method - execute it + */ - /* Count the number of arguments being passed to the method */ + /* Verify that there is a method object associated with this node */ - if (Info->Parameters) + if (!Info->ObjDesc) { - while (Info->Parameters[Info->ParamCount]) - { - if (Info->ParamCount > ACPI_METHOD_MAX_ARG) - { - return_ACPI_STATUS (AE_LIMIT); - } - Info->ParamCount++; - } + ACPI_ERROR ((AE_INFO, "%s: Method has no attached sub-object", + Info->FullPathname)); + Status = AE_NULL_OBJECT; + goto Cleanup; } - ACPI_DUMP_PATHNAME (Info->ResolvedNode, "ACPI: Execute Method", - ACPI_LV_INFO, _COMPONENT); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Method at AML address %p Length %X\n", + "**** Execute method [%s] at AML address %p length %X\n", + Info->FullPathname, Info->ObjDesc->Method.AmlStart + 1, Info->ObjDesc->Method.AmlLength - 1)); @@ -196,80 +252,58 @@ AcpiNsEvaluate ( AcpiExEnterInterpreter (); Status = AcpiPsExecuteMethod (Info); AcpiExExitInterpreter (); - } - else - { + break; + + default: /* - * 2) Object is not a method, return its current value - * - * Disallow certain object types. For these, "evaluation" is undefined. + * 3) All other non-method objects -- get the current object value */ - switch (Info->ResolvedNode->Type) - { - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_EVENT: - case ACPI_TYPE_MUTEX: - case ACPI_TYPE_REGION: - case ACPI_TYPE_THERMAL: - case ACPI_TYPE_LOCAL_SCOPE: - - ACPI_ERROR ((AE_INFO, - "[%4.4s] Evaluation of object type [%s] is not supported", - Info->ResolvedNode->Name.Ascii, - AcpiUtGetTypeName (Info->ResolvedNode->Type))); - - return_ACPI_STATUS (AE_TYPE); - - default: - break; - } /* - * Objects require additional resolution steps (e.g., the Node may be - * a field that must be read, etc.) -- we can't just grab the object - * out of the node. + * Some objects require additional resolution steps (e.g., the Node + * may be a field that must be read, etc.) -- we can't just grab + * the object out of the node. * * Use ResolveNodeToValue() to get the associated value. * * NOTE: we can get away with passing in NULL for a walk state because - * ResolvedNode is guaranteed to not be a reference to either a method + * the Node is guaranteed to not be a reference to either a method * local or a method argument (because this interface is never called * from a running method.) * * Even though we do not directly invoke the interpreter for object - * resolution, we must lock it because we could access an opregion. - * The opregion access code assumes that the interpreter is locked. + * resolution, we must lock it because we could access an OpRegion. + * The OpRegion access code assumes that the interpreter is locked. */ AcpiExEnterInterpreter (); - /* Function has a strange interface */ + /* TBD: ResolveNodeToValue has a strange interface, fix */ + + Info->ReturnObject = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Info->Node); - Status = AcpiExResolveNodeToValue (&Info->ResolvedNode, NULL); + Status = AcpiExResolveNodeToValue (ACPI_CAST_INDIRECT_PTR ( + ACPI_NAMESPACE_NODE, &Info->ReturnObject), NULL); AcpiExExitInterpreter (); - /* - * If AcpiExResolveNodeToValue() succeeded, the return value was placed - * in ResolvedNode. - */ - if (ACPI_SUCCESS (Status)) + if (ACPI_FAILURE (Status)) { - Status = AE_CTRL_RETURN_VALUE; - Info->ReturnObject = - ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Info->ResolvedNode); - - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n", - Info->ReturnObject, - AcpiUtGetObjectTypeName (Info->ReturnObject))); + goto Cleanup; } + + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returned object %p [%s]\n", + Info->ReturnObject, + AcpiUtGetObjectTypeName (Info->ReturnObject))); + + Status = AE_CTRL_RETURN_VALUE; /* Always has a "return value" */ + break; } /* - * Check input argument count against the ASL-defined count for a method. - * Also check predefined names: argument count and return value against - * the ACPI specification. Some incorrect return value types are repaired. + * For predefined names, check the return value against the ACPI + * specification. Some incorrect return value types are repaired. */ - (void) AcpiNsCheckPredefinedNames (Node, Info->ParamCount, - Status, &Info->ReturnObject); + (void) AcpiNsCheckReturnValue (Info->Node, Info, Info->ParamCount, + Status, &Info->ReturnObject); /* Check if there is a return value that must be dealt with */ @@ -289,12 +323,16 @@ AcpiNsEvaluate ( } ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "*** Completed evaluation of object %s ***\n", Info->Pathname)); + "*** Completed evaluation of object %s ***\n", + Info->RelativePathname)); +Cleanup: /* * Namespace was unlocked by the handling AcpiNs* function, so we - * just return + * just free the pathname and return */ + ACPI_FREE (Info->FullPathname); + Info->FullPathname = NULL; return_ACPI_STATUS (Status); } diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index 2fcee18bca8c..ee5dcdf2c7f9 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -198,7 +198,7 @@ AcpiNsInitializeDevices ( * part of the ACPI specification. */ Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode; - Info.EvaluateInfo->Pathname = METHOD_NAME__INI; + Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI; Info.EvaluateInfo->Parameters = NULL; Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE; @@ -610,7 +610,7 @@ AcpiNsInitOneDevice ( ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI)); Info->PrefixNode = DeviceNode; - Info->Pathname = METHOD_NAME__INI; + Info->RelativePathname = METHOD_NAME__INI; Info->Parameters = NULL; Info->Flags = ACPI_IGNORE_RETURN_VALUE; @@ -625,7 +625,7 @@ AcpiNsInitOneDevice ( { /* Ignore error and move on to next device */ - char *ScopeName = AcpiNsGetExternalPathname (Info->ResolvedNode); + char *ScopeName = AcpiNsGetExternalPathname (Info->Node); ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution", ScopeName)); diff --git a/source/components/namespace/nspredef.c b/source/components/namespace/nspredef.c index a9250e36207c..aff90d8f8a77 100644 --- a/source/components/namespace/nspredef.c +++ b/source/components/namespace/nspredef.c @@ -63,12 +63,12 @@ * There are several areas that are validated: * * 1) The number of input arguments as defined by the method/object in the - * ASL is validated against the ACPI specification. + * ASL is validated against the ACPI specification. * 2) The type of the return object (if any) is validated against the ACPI - * specification. + * specification. * 3) For returned package objects, the count of package elements is - * validated, as well as the type of each package element. Nested - * packages are supported. + * validated, as well as the type of each package element. Nested + * packages are supported. * * For any problems found, a warning message is issued. * @@ -79,7 +79,7 @@ static ACPI_STATUS AcpiNsCheckReference ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT *ReturnObject); static UINT32 @@ -89,9 +89,10 @@ AcpiNsGetBitmappedType ( /******************************************************************************* * - * FUNCTION: AcpiNsCheckPredefinedNames + * FUNCTION: AcpiNsCheckReturnValue * * PARAMETERS: Node - Namespace node for the method/object + * Info - Method execution information block * UserParamCount - Number of parameters actually passed * ReturnStatus - Status from the object evaluation * ReturnObjectPtr - Pointer to the object returned from the @@ -99,56 +100,38 @@ AcpiNsGetBitmappedType ( * * RETURN: Status * - * DESCRIPTION: Check an ACPI name for a match in the predefined name list. + * DESCRIPTION: Check the value returned from a predefined name. * ******************************************************************************/ ACPI_STATUS -AcpiNsCheckPredefinedNames ( +AcpiNsCheckReturnValue ( ACPI_NAMESPACE_NODE *Node, + ACPI_EVALUATE_INFO *Info, UINT32 UserParamCount, ACPI_STATUS ReturnStatus, ACPI_OPERAND_OBJECT **ReturnObjectPtr) { - ACPI_STATUS Status = AE_OK; + ACPI_STATUS Status; const ACPI_PREDEFINED_INFO *Predefined; - char *Pathname; - ACPI_PREDEFINED_DATA *Data; - - - /* Match the name for this method/object against the predefined list */ - - Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii); - /* Get the full pathname to the object, for use in warning messages */ - - Pathname = AcpiNsGetExternalPathname (Node); - if (!Pathname) - { - return (AE_OK); /* Could not get pathname, ignore */ - } - - /* - * Check that the parameter count for this method matches the ASL - * definition. For predefined names, ensure that both the caller and - * the method itself are in accordance with the ACPI specification. - */ - AcpiNsCheckParameterCount (Pathname, Node, UserParamCount, Predefined); /* If not a predefined name, we cannot validate the return object */ + Predefined = Info->Predefined; if (!Predefined) { - goto Cleanup; + return (AE_OK); } /* * If the method failed or did not actually return an object, we cannot * validate the return object */ - if ((ReturnStatus != AE_OK) && (ReturnStatus != AE_CTRL_RETURN_VALUE)) + if ((ReturnStatus != AE_OK) && + (ReturnStatus != AE_CTRL_RETURN_VALUE)) { - goto Cleanup; + return (AE_OK); } /* @@ -168,27 +151,15 @@ AcpiNsCheckPredefinedNames ( (!Predefined->Info.ExpectedBtypes) || (Predefined->Info.ExpectedBtypes == ACPI_RTYPE_ALL)) { - goto Cleanup; - } - - /* Create the parameter data block for object validation */ - - Data = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PREDEFINED_DATA)); - if (!Data) - { - goto Cleanup; + return (AE_OK); } - Data->Predefined = Predefined; - Data->Node = Node; - Data->NodeFlags = Node->Flags; - Data->Pathname = Pathname; /* * Check that the type of the main return object is what is expected * for this predefined name */ - Status = AcpiNsCheckObjectType (Data, ReturnObjectPtr, - Predefined->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT); + Status = AcpiNsCheckObjectType (Info, ReturnObjectPtr, + Predefined->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT); if (ACPI_FAILURE (Status)) { goto Exit; @@ -200,8 +171,8 @@ AcpiNsCheckPredefinedNames ( */ if ((*ReturnObjectPtr)->Common.Type == ACPI_TYPE_PACKAGE) { - Data->ParentPackage = *ReturnObjectPtr; - Status = AcpiNsCheckPackage (Data, ReturnObjectPtr); + Info->ParentPackage = *ReturnObjectPtr; + Status = AcpiNsCheckPackage (Info, ReturnObjectPtr); if (ACPI_FAILURE (Status)) { goto Exit; @@ -216,7 +187,7 @@ AcpiNsCheckPredefinedNames ( * performed on a per-name basis, i.e., the code is specific to * particular predefined names. */ - Status = AcpiNsComplexRepairs (Data, Node, Status, ReturnObjectPtr); + Status = AcpiNsComplexRepairs (Info, Node, Status, ReturnObjectPtr); Exit: /* @@ -224,119 +195,21 @@ Exit: * or more objects, mark the parent node to suppress further warning * messages during the next evaluation of the same method/object. */ - if (ACPI_FAILURE (Status) || (Data->Flags & ACPI_OBJECT_REPAIRED)) + if (ACPI_FAILURE (Status) || + (Info->ReturnFlags & ACPI_OBJECT_REPAIRED)) { Node->Flags |= ANOBJ_EVALUATED; } - ACPI_FREE (Data); -Cleanup: - ACPI_FREE (Pathname); return (Status); } /******************************************************************************* * - * FUNCTION: AcpiNsCheckParameterCount - * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) - * Node - Namespace node for the method/object - * UserParamCount - Number of args passed in by the caller - * Predefined - Pointer to entry in predefined name table - * - * RETURN: None - * - * DESCRIPTION: Check that the declared (in ASL/AML) parameter count for a - * predefined name is what is expected (i.e., what is defined in - * the ACPI specification for this predefined name.) - * - ******************************************************************************/ - -void -AcpiNsCheckParameterCount ( - char *Pathname, - ACPI_NAMESPACE_NODE *Node, - UINT32 UserParamCount, - const ACPI_PREDEFINED_INFO *Predefined) -{ - UINT32 ParamCount; - UINT32 RequiredParamsCurrent; - UINT32 RequiredParamsOld; - - - /* Methods have 0-7 parameters. All other types have zero. */ - - ParamCount = 0; - if (Node->Type == ACPI_TYPE_METHOD) - { - ParamCount = Node->Object->Method.ParamCount; - } - - if (!Predefined) - { - /* - * Check the parameter count for non-predefined methods/objects. - * - * Warning if too few or too many arguments have been passed by the - * caller. An incorrect number of arguments may not cause the method - * to fail. However, the method will fail if there are too few - * arguments and the method attempts to use one of the missing ones. - */ - if (UserParamCount < ParamCount) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "Insufficient arguments - needs %u, found %u", - ParamCount, UserParamCount)); - } - else if (UserParamCount > ParamCount) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "Excess arguments - needs %u, found %u", - ParamCount, UserParamCount)); - } - return; - } - - /* - * Validate the user-supplied parameter count. - * Allow two different legal argument counts (_SCP, etc.) - */ - RequiredParamsCurrent = Predefined->Info.ArgumentList & METHOD_ARG_MASK; - RequiredParamsOld = Predefined->Info.ArgumentList >> METHOD_ARG_BIT_WIDTH; - - if (UserParamCount != ACPI_UINT32_MAX) - { - if ((UserParamCount != RequiredParamsCurrent) && - (UserParamCount != RequiredParamsOld)) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, - "Parameter count mismatch - " - "caller passed %u, ACPI requires %u", - UserParamCount, RequiredParamsCurrent)); - } - } - - /* - * Check that the ASL-defined parameter count is what is expected for - * this predefined name (parameter count as defined by the ACPI - * specification) - */ - if ((ParamCount != RequiredParamsCurrent) && - (ParamCount != RequiredParamsOld)) - { - ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, Node->Flags, - "Parameter count mismatch - ASL declared %u, ACPI requires %u", - ParamCount, RequiredParamsCurrent)); - } -} - - -/******************************************************************************* - * * FUNCTION: AcpiNsCheckObjectType * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * ExpectedBtypes - Bitmap of expected return type(s) @@ -353,7 +226,7 @@ AcpiNsCheckParameterCount ( ACPI_STATUS AcpiNsCheckObjectType ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex) @@ -368,7 +241,7 @@ AcpiNsCheckObjectType ( if (ReturnObject && ACPI_GET_DESCRIPTOR_TYPE (ReturnObject) == ACPI_DESC_TYPE_NAMED) { - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Invalid return type - Found a Namespace node [%4.4s] type %s", ReturnObject->Node.Name.Ascii, AcpiUtGetTypeName (ReturnObject->Node.Type))); @@ -383,8 +256,8 @@ AcpiNsCheckObjectType ( * from all of the predefined names (including elements of returned * packages) */ - Data->ReturnBtype = AcpiNsGetBitmappedType (ReturnObject); - if (Data->ReturnBtype == ACPI_RTYPE_ANY) + Info->ReturnBtype = AcpiNsGetBitmappedType (ReturnObject); + if (Info->ReturnBtype == ACPI_RTYPE_ANY) { /* Not one of the supported objects, must be incorrect */ goto TypeErrorExit; @@ -392,17 +265,20 @@ AcpiNsCheckObjectType ( /* For reference objects, check that the reference type is correct */ - if ((Data->ReturnBtype & ExpectedBtypes) == ACPI_RTYPE_REFERENCE) + if ((Info->ReturnBtype & ExpectedBtypes) == ACPI_RTYPE_REFERENCE) { - Status = AcpiNsCheckReference (Data, ReturnObject); + Status = AcpiNsCheckReference (Info, ReturnObject); return (Status); } /* Attempt simple repair of the returned object if necessary */ - Status = AcpiNsSimpleRepair (Data, ExpectedBtypes, - PackageIndex, ReturnObjectPtr); - return (Status); + Status = AcpiNsSimpleRepair (Info, ExpectedBtypes, + PackageIndex, ReturnObjectPtr); + if (ACPI_SUCCESS (Status)) + { + return (AE_OK); /* Successful repair */ + } TypeErrorExit: @@ -413,13 +289,13 @@ TypeErrorExit: if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT) { - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Return type mismatch - found %s, expected %s", AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer)); } else { - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Return Package type mismatch at index %u - " "found %s, expected %s", PackageIndex, AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer)); @@ -433,7 +309,7 @@ TypeErrorExit: * * FUNCTION: AcpiNsCheckReference * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * ReturnObject - Object returned from the evaluation of a * method or object * @@ -447,7 +323,7 @@ TypeErrorExit: static ACPI_STATUS AcpiNsCheckReference ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT *ReturnObject) { @@ -461,7 +337,7 @@ AcpiNsCheckReference ( return (AE_OK); } - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Return type mismatch - unexpected reference object type [%s] %2.2X", AcpiUtGetReferenceName (ReturnObject), ReturnObject->Reference.Class)); diff --git a/source/components/namespace/nsprepkg.c b/source/components/namespace/nsprepkg.c index d18205c83fd7..5177c3dd6c06 100644 --- a/source/components/namespace/nsprepkg.c +++ b/source/components/namespace/nsprepkg.c @@ -55,14 +55,14 @@ static ACPI_STATUS AcpiNsCheckPackageList ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, const ACPI_PREDEFINED_INFO *Package, ACPI_OPERAND_OBJECT **Elements, UINT32 Count); static ACPI_STATUS AcpiNsCheckPackageElements ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **Elements, UINT8 Type1, UINT32 Count1, @@ -75,7 +75,7 @@ AcpiNsCheckPackageElements ( * * FUNCTION: AcpiNsCheckPackage * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * @@ -88,7 +88,7 @@ AcpiNsCheckPackageElements ( ACPI_STATUS AcpiNsCheckPackage ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr) { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; @@ -105,17 +105,18 @@ AcpiNsCheckPackage ( /* The package info for this name is in the next table entry */ - Package = Data->Predefined + 1; + Package = Info->Predefined + 1; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s Validating return Package of Type %X, Count %X\n", - Data->Pathname, Package->RetInfo.Type, ReturnObject->Package.Count)); + Info->FullPathname, Package->RetInfo.Type, + ReturnObject->Package.Count)); /* * For variable-length Packages, we can safely remove all embedded * and trailing NULL package elements */ - AcpiNsRemoveNullElements (Data, Package->RetInfo.Type, ReturnObject); + AcpiNsRemoveNullElements (Info, Package->RetInfo.Type, ReturnObject); /* Extract package count and elements array */ @@ -133,7 +134,7 @@ AcpiNsCheckPackage ( return (AE_OK); } - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Return Package has no elements (empty)")); return (AE_AML_OPERAND_VALUE); @@ -165,12 +166,12 @@ AcpiNsCheckPackage ( ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Return Package is larger than needed - " "found %u, expected %u\n", - Data->Pathname, Count, ExpectedCount)); + Info->FullPathname, Count, ExpectedCount)); } /* Validate all elements of the returned package */ - Status = AcpiNsCheckPackageElements (Data, Elements, + Status = AcpiNsCheckPackageElements (Info, Elements, Package->RetInfo.ObjectType1, Package->RetInfo.Count1, Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0); break; @@ -184,7 +185,7 @@ AcpiNsCheckPackage ( */ for (i = 0; i < Count; i++) { - Status = AcpiNsCheckObjectType (Data, Elements, + Status = AcpiNsCheckObjectType (Info, Elements, Package->RetInfo.ObjectType1, i); if (ACPI_FAILURE (Status)) { @@ -218,7 +219,7 @@ AcpiNsCheckPackage ( { /* These are the required package elements (0, 1, or 2) */ - Status = AcpiNsCheckObjectType (Data, Elements, + Status = AcpiNsCheckObjectType (Info, Elements, Package->RetInfo3.ObjectType[i], i); if (ACPI_FAILURE (Status)) { @@ -229,7 +230,7 @@ AcpiNsCheckPackage ( { /* These are the optional package elements */ - Status = AcpiNsCheckObjectType (Data, Elements, + Status = AcpiNsCheckObjectType (Info, Elements, Package->RetInfo3.TailObjectType, i); if (ACPI_FAILURE (Status)) { @@ -245,7 +246,7 @@ AcpiNsCheckPackage ( /* First element is the (Integer) revision */ - Status = AcpiNsCheckObjectType (Data, Elements, + Status = AcpiNsCheckObjectType (Info, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { @@ -257,7 +258,7 @@ AcpiNsCheckPackage ( /* Examine the sub-packages */ - Status = AcpiNsCheckPackageList (Data, Package, Elements, Count); + Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); break; @@ -265,7 +266,7 @@ AcpiNsCheckPackage ( /* First element is the (Integer) count of sub-packages to follow */ - Status = AcpiNsCheckObjectType (Data, Elements, + Status = AcpiNsCheckObjectType (Info, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { @@ -287,7 +288,7 @@ AcpiNsCheckPackage ( /* Examine the sub-packages */ - Status = AcpiNsCheckPackageList (Data, Package, Elements, Count); + Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); break; @@ -311,7 +312,7 @@ AcpiNsCheckPackage ( { /* Create the new outer package and populate it */ - Status = AcpiNsWrapWithPackage (Data, ReturnObject, ReturnObjectPtr); + Status = AcpiNsWrapWithPackage (Info, ReturnObject, ReturnObjectPtr); if (ACPI_FAILURE (Status)) { return (Status); @@ -326,7 +327,7 @@ AcpiNsCheckPackage ( /* Examine the sub-packages */ - Status = AcpiNsCheckPackageList (Data, Package, Elements, Count); + Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); break; @@ -334,7 +335,7 @@ AcpiNsCheckPackage ( /* Should not get here if predefined info table is correct */ - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Invalid internal return type in table entry: %X", Package->RetInfo.Type)); @@ -348,7 +349,7 @@ PackageTooSmall: /* Error exit for the case with an incorrect package count */ - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Return Package is too small - found %u elements, expected %u", Count, ExpectedCount)); @@ -360,7 +361,7 @@ PackageTooSmall: * * FUNCTION: AcpiNsCheckPackageList * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * Package - Pointer to package-specific info for method * Elements - Element list of parent package. All elements * of this list should be of type Package. @@ -374,7 +375,7 @@ PackageTooSmall: static ACPI_STATUS AcpiNsCheckPackageList ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, const ACPI_PREDEFINED_INFO *Package, ACPI_OPERAND_OBJECT **Elements, UINT32 Count) @@ -398,11 +399,11 @@ AcpiNsCheckPackageList ( { SubPackage = *Elements; SubElements = SubPackage->Package.Elements; - Data->ParentPackage = SubPackage; + Info->ParentPackage = SubPackage; /* Each sub-object must be of type Package */ - Status = AcpiNsCheckObjectType (Data, &SubPackage, + Status = AcpiNsCheckObjectType (Info, &SubPackage, ACPI_RTYPE_PACKAGE, i); if (ACPI_FAILURE (Status)) { @@ -411,7 +412,7 @@ AcpiNsCheckPackageList ( /* Examine the different types of expected sub-packages */ - Data->ParentPackage = SubPackage; + Info->ParentPackage = SubPackage; switch (Package->RetInfo.Type) { case ACPI_PTYPE2: @@ -426,7 +427,7 @@ AcpiNsCheckPackageList ( goto PackageTooSmall; } - Status = AcpiNsCheckPackageElements (Data, SubElements, + Status = AcpiNsCheckPackageElements (Info, SubElements, Package->RetInfo.ObjectType1, Package->RetInfo.Count1, Package->RetInfo.ObjectType2, @@ -449,7 +450,7 @@ AcpiNsCheckPackageList ( goto PackageTooSmall; } - Status = AcpiNsCheckPackageElements (Data, SubElements, + Status = AcpiNsCheckPackageElements (Info, SubElements, Package->RetInfo.ObjectType1, Package->RetInfo.Count1, Package->RetInfo.ObjectType2, @@ -475,7 +476,7 @@ AcpiNsCheckPackageList ( for (j = 0; j < ExpectedCount; j++) { - Status = AcpiNsCheckObjectType (Data, &SubElements[j], + Status = AcpiNsCheckObjectType (Info, &SubElements[j], Package->RetInfo2.ObjectType[j], j); if (ACPI_FAILURE (Status)) { @@ -497,7 +498,7 @@ AcpiNsCheckPackageList ( /* Check the type of each sub-package element */ - Status = AcpiNsCheckPackageElements (Data, SubElements, + Status = AcpiNsCheckPackageElements (Info, SubElements, Package->RetInfo.ObjectType1, SubPackage->Package.Count, 0, 0, 0); if (ACPI_FAILURE (Status)) @@ -513,7 +514,7 @@ AcpiNsCheckPackageList ( * First element is the (Integer) count of elements, including * the count field (the ACPI name is NumElements) */ - Status = AcpiNsCheckObjectType (Data, SubElements, + Status = AcpiNsCheckObjectType (Info, SubElements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { @@ -548,7 +549,7 @@ AcpiNsCheckPackageList ( /* Check the type of each sub-package element */ - Status = AcpiNsCheckPackageElements (Data, (SubElements + 1), + Status = AcpiNsCheckPackageElements (Info, (SubElements + 1), Package->RetInfo.ObjectType1, (ExpectedCount - 1), 0, 0, 1); if (ACPI_FAILURE (Status)) @@ -573,7 +574,7 @@ PackageTooSmall: /* The sub-package count was smaller than required */ - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Return Sub-Package[%u] is too small - found %u elements, expected %u", i, SubPackage->Package.Count, ExpectedCount)); @@ -585,7 +586,7 @@ PackageTooSmall: * * FUNCTION: AcpiNsCheckPackageElements * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * Elements - Pointer to the package elements array * Type1 - Object type for first group * Count1 - Count for first group @@ -602,7 +603,7 @@ PackageTooSmall: static ACPI_STATUS AcpiNsCheckPackageElements ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **Elements, UINT8 Type1, UINT32 Count1, @@ -622,7 +623,7 @@ AcpiNsCheckPackageElements ( */ for (i = 0; i < Count1; i++) { - Status = AcpiNsCheckObjectType (Data, ThisElement, + Status = AcpiNsCheckObjectType (Info, ThisElement, Type1, i + StartIndex); if (ACPI_FAILURE (Status)) { @@ -633,7 +634,7 @@ AcpiNsCheckPackageElements ( for (i = 0; i < Count2; i++) { - Status = AcpiNsCheckObjectType (Data, ThisElement, + Status = AcpiNsCheckObjectType (Info, ThisElement, Type2, (i + Count1 + StartIndex)); if (ACPI_FAILURE (Status)) { diff --git a/source/components/namespace/nsrepair.c b/source/components/namespace/nsrepair.c index e06502811d33..893ebe50fd0f 100644 --- a/source/components/namespace/nsrepair.c +++ b/source/components/namespace/nsrepair.c @@ -131,7 +131,7 @@ static const ACPI_SIMPLE_REPAIR_INFO AcpiObjectRepairInfo[] = * * FUNCTION: AcpiNsSimpleRepair * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * ExpectedBtypes - Object types expected * PackageIndex - Index of object within parent package (if * applicable - ACPI_NOT_PACKAGE_ELEMENT @@ -148,7 +148,7 @@ static const ACPI_SIMPLE_REPAIR_INFO AcpiObjectRepairInfo[] = ACPI_STATUS AcpiNsSimpleRepair ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, UINT32 ExpectedBtypes, UINT32 PackageIndex, ACPI_OPERAND_OBJECT **ReturnObjectPtr) @@ -166,13 +166,13 @@ AcpiNsSimpleRepair ( * Special repairs for certain names that are in the repair table. * Check if this name is in the list of repairable names. */ - Predefined = AcpiNsMatchSimpleRepair (Data->Node, - Data->ReturnBtype, PackageIndex); + Predefined = AcpiNsMatchSimpleRepair (Info->Node, + Info->ReturnBtype, PackageIndex); if (Predefined) { if (!ReturnObject) { - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS, "Missing expected return value")); } @@ -195,7 +195,7 @@ AcpiNsSimpleRepair ( * Do not perform simple object repair unless the return type is not * expected. */ - if (Data->ReturnBtype & ExpectedBtypes) + if (Info->ReturnBtype & ExpectedBtypes) { return (AE_OK); } @@ -218,7 +218,7 @@ AcpiNsSimpleRepair ( { if (ExpectedBtypes && (!(ExpectedBtypes & ACPI_RTYPE_NONE))) { - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS, "Missing expected return value")); return (AE_AML_NO_RETURN_VALUE); @@ -259,7 +259,7 @@ AcpiNsSimpleRepair ( * object. Note: after the wrapping, the package will be validated * for correct contents (expected object type or types). */ - Status = AcpiNsWrapWithPackage (Data, ReturnObject, &NewObject); + Status = AcpiNsWrapWithPackage (Info, ReturnObject, &NewObject); if (ACPI_SUCCESS (Status)) { /* @@ -267,7 +267,7 @@ AcpiNsSimpleRepair ( * incremented for being inserted into the new package. */ *ReturnObjectPtr = NewObject; /* New Package object */ - Data->Flags |= ACPI_OBJECT_REPAIRED; + Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; return (AE_OK); } } @@ -292,7 +292,7 @@ ObjectRepaired: * package object as part of the repair, we don't need to * change the reference count. */ - if (!(Data->Flags & ACPI_OBJECT_WRAPPED)) + if (!(Info->ReturnFlags & ACPI_OBJECT_WRAPPED)) { NewObject->Common.ReferenceCount = ReturnObject->Common.ReferenceCount; @@ -305,14 +305,14 @@ ObjectRepaired: ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Converted %s to expected %s at Package index %u\n", - Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject), + Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject), AcpiUtGetObjectTypeName (NewObject), PackageIndex)); } else { ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Converted %s to expected %s\n", - Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject), + Info->FullPathname, AcpiUtGetObjectTypeName (ReturnObject), AcpiUtGetObjectTypeName (NewObject))); } @@ -320,7 +320,7 @@ ObjectRepaired: AcpiUtRemoveReference (ReturnObject); *ReturnObjectPtr = NewObject; - Data->Flags |= ACPI_OBJECT_REPAIRED; + Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; return (AE_OK); } @@ -378,7 +378,7 @@ AcpiNsMatchSimpleRepair ( * * FUNCTION: AcpiNsRepairNullElement * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * ExpectedBtypes - Object types expected * PackageIndex - Index of object within parent package (if * applicable - ACPI_NOT_PACKAGE_ELEMENT @@ -394,7 +394,7 @@ AcpiNsMatchSimpleRepair ( ACPI_STATUS AcpiNsRepairNullElement ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, UINT32 ExpectedBtypes, UINT32 PackageIndex, ACPI_OPERAND_OBJECT **ReturnObjectPtr) @@ -451,14 +451,14 @@ AcpiNsRepairNullElement ( /* Set the reference count according to the parent Package object */ - NewObject->Common.ReferenceCount = Data->ParentPackage->Common.ReferenceCount; + NewObject->Common.ReferenceCount = Info->ParentPackage->Common.ReferenceCount; ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Converted NULL package element to expected %s at index %u\n", - Data->Pathname, AcpiUtGetObjectTypeName (NewObject), PackageIndex)); + Info->FullPathname, AcpiUtGetObjectTypeName (NewObject), PackageIndex)); *ReturnObjectPtr = NewObject; - Data->Flags |= ACPI_OBJECT_REPAIRED; + Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; return (AE_OK); } @@ -467,7 +467,7 @@ AcpiNsRepairNullElement ( * * FUNCTION: AcpiNsRemoveNullElements * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * PackageType - An AcpiReturnPackageTypes value * ObjDesc - A Package object * @@ -481,7 +481,7 @@ AcpiNsRepairNullElement ( void AcpiNsRemoveNullElements ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, UINT8 PackageType, ACPI_OPERAND_OBJECT *ObjDesc) { @@ -546,7 +546,7 @@ AcpiNsRemoveNullElements ( { ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Found and removed %u NULL elements\n", - Data->Pathname, (Count - NewCount))); + Info->FullPathname, (Count - NewCount))); /* NULL terminate list and update the package count */ @@ -560,7 +560,7 @@ AcpiNsRemoveNullElements ( * * FUNCTION: AcpiNsWrapWithPackage * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * OriginalObject - Pointer to the object to repair. * ObjDescPtr - The new package object is returned here * @@ -582,7 +582,7 @@ AcpiNsRemoveNullElements ( ACPI_STATUS AcpiNsWrapWithPackage ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ObjDescPtr) { @@ -606,11 +606,11 @@ AcpiNsWrapWithPackage ( ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Wrapped %s with expected Package object\n", - Data->Pathname, AcpiUtGetObjectTypeName (OriginalObject))); + Info->FullPathname, AcpiUtGetObjectTypeName (OriginalObject))); /* Return the new object in the object pointer */ *ObjDescPtr = PkgObjDesc; - Data->Flags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED; + Info->ReturnFlags |= ACPI_OBJECT_REPAIRED | ACPI_OBJECT_WRAPPED; return (AE_OK); } diff --git a/source/components/namespace/nsrepair2.c b/source/components/namespace/nsrepair2.c index b81c0dd0d52e..63fb36dd279a 100644 --- a/source/components/namespace/nsrepair2.c +++ b/source/components/namespace/nsrepair2.c @@ -58,7 +58,7 @@ */ typedef ACPI_STATUS (*ACPI_REPAIR_FUNCTION) ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr); typedef struct acpi_repair_info @@ -77,37 +77,37 @@ AcpiNsMatchComplexRepair ( static ACPI_STATUS AcpiNsRepair_ALR ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr); static ACPI_STATUS AcpiNsRepair_CID ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr); static ACPI_STATUS AcpiNsRepair_FDE ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr); static ACPI_STATUS AcpiNsRepair_HID ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr); static ACPI_STATUS AcpiNsRepair_PSS ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr); static ACPI_STATUS AcpiNsRepair_TSS ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr); static ACPI_STATUS AcpiNsCheckSortedList ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT *ReturnObject, UINT32 ExpectedCount, UINT32 SortIndex, @@ -170,7 +170,7 @@ static const ACPI_REPAIR_INFO AcpiNsRepairableNames[] = * * FUNCTION: AcpiNsComplexRepairs * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * Node - Namespace node for the method/object * ValidateStatus - Original status of earlier validation * ReturnObjectPtr - Pointer to the object returned from the @@ -186,7 +186,7 @@ static const ACPI_REPAIR_INFO AcpiNsRepairableNames[] = ACPI_STATUS AcpiNsComplexRepairs ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_NAMESPACE_NODE *Node, ACPI_STATUS ValidateStatus, ACPI_OPERAND_OBJECT **ReturnObjectPtr) @@ -203,7 +203,7 @@ AcpiNsComplexRepairs ( return (ValidateStatus); } - Status = Predefined->RepairFunction (Data, ReturnObjectPtr); + Status = Predefined->RepairFunction (Info, ReturnObjectPtr); return (Status); } @@ -247,7 +247,7 @@ AcpiNsMatchComplexRepair ( * * FUNCTION: AcpiNsRepair_ALR * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * @@ -260,14 +260,14 @@ AcpiNsMatchComplexRepair ( static ACPI_STATUS AcpiNsRepair_ALR ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr) { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; ACPI_STATUS Status; - Status = AcpiNsCheckSortedList (Data, ReturnObject, 2, 1, + Status = AcpiNsCheckSortedList (Info, ReturnObject, 2, 1, ACPI_SORT_ASCENDING, "AmbientIlluminance"); return (Status); @@ -278,7 +278,7 @@ AcpiNsRepair_ALR ( * * FUNCTION: AcpiNsRepair_FDE * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * @@ -293,7 +293,7 @@ AcpiNsRepair_ALR ( static ACPI_STATUS AcpiNsRepair_FDE ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr) { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; @@ -321,7 +321,7 @@ AcpiNsRepair_FDE ( if (ReturnObject->Buffer.Length != ACPI_FDE_BYTE_BUFFER_SIZE) { - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Incorrect return buffer length %u, expected %u", ReturnObject->Buffer.Length, ACPI_FDE_DWORD_BUFFER_SIZE)); @@ -350,7 +350,7 @@ AcpiNsRepair_FDE ( ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s Expanded Byte Buffer to expected DWord Buffer\n", - Data->Pathname)); + Info->FullPathname)); break; default: @@ -362,7 +362,7 @@ AcpiNsRepair_FDE ( AcpiUtRemoveReference (ReturnObject); *ReturnObjectPtr = BufferObject; - Data->Flags |= ACPI_OBJECT_REPAIRED; + Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; return (AE_OK); } @@ -371,7 +371,7 @@ AcpiNsRepair_FDE ( * * FUNCTION: AcpiNsRepair_CID * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * @@ -385,7 +385,7 @@ AcpiNsRepair_FDE ( static ACPI_STATUS AcpiNsRepair_CID ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr) { ACPI_STATUS Status; @@ -400,7 +400,7 @@ AcpiNsRepair_CID ( if (ReturnObject->Common.Type == ACPI_TYPE_STRING) { - Status = AcpiNsRepair_HID (Data, ReturnObjectPtr); + Status = AcpiNsRepair_HID (Info, ReturnObjectPtr); return (Status); } @@ -419,7 +419,7 @@ AcpiNsRepair_CID ( OriginalElement = *ElementPtr; OriginalRefCount = OriginalElement->Common.ReferenceCount; - Status = AcpiNsRepair_HID (Data, ElementPtr); + Status = AcpiNsRepair_HID (Info, ElementPtr); if (ACPI_FAILURE (Status)) { return (Status); @@ -448,7 +448,7 @@ AcpiNsRepair_CID ( * * FUNCTION: AcpiNsRepair_HID * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * @@ -461,7 +461,7 @@ AcpiNsRepair_CID ( static ACPI_STATUS AcpiNsRepair_HID ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr) { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; @@ -482,12 +482,12 @@ AcpiNsRepair_HID ( if (ReturnObject->String.Length == 0) { - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Invalid zero-length _HID or _CID string")); /* Return AE_OK anyway, let driver handle it */ - Data->Flags |= ACPI_OBJECT_REPAIRED; + Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; return (AE_OK); } @@ -512,7 +512,7 @@ AcpiNsRepair_HID ( NewString->String.Length--; ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, - "%s: Removed invalid leading asterisk\n", Data->Pathname)); + "%s: Removed invalid leading asterisk\n", Info->FullPathname)); } /* @@ -538,7 +538,7 @@ AcpiNsRepair_HID ( * * FUNCTION: AcpiNsRepair_TSS * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * @@ -551,7 +551,7 @@ AcpiNsRepair_HID ( static ACPI_STATUS AcpiNsRepair_TSS ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr) { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; @@ -567,13 +567,14 @@ AcpiNsRepair_TSS ( * In this case, it is best to just return the _TSS package as-is. * (May, 2011) */ - Status = AcpiNsGetNode (Data->Node, "^_PSS", ACPI_NS_NO_UPSEARCH, &Node); + Status = AcpiNsGetNode (Info->Node, "^_PSS", + ACPI_NS_NO_UPSEARCH, &Node); if (ACPI_SUCCESS (Status)) { return (AE_OK); } - Status = AcpiNsCheckSortedList (Data, ReturnObject, 5, 1, + Status = AcpiNsCheckSortedList (Info, ReturnObject, 5, 1, ACPI_SORT_DESCENDING, "PowerDissipation"); return (Status); @@ -584,7 +585,7 @@ AcpiNsRepair_TSS ( * * FUNCTION: AcpiNsRepair_PSS * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * @@ -599,7 +600,7 @@ AcpiNsRepair_TSS ( static ACPI_STATUS AcpiNsRepair_PSS ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr) { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; @@ -618,7 +619,7 @@ AcpiNsRepair_PSS ( * incorrectly sorted, sort it. We sort by CpuFrequency, since this * should be proportional to the power. */ - Status =AcpiNsCheckSortedList (Data, ReturnObject, 6, 0, + Status =AcpiNsCheckSortedList (Info, ReturnObject, 6, 0, ACPI_SORT_DESCENDING, "CpuFrequency"); if (ACPI_FAILURE (Status)) { @@ -640,7 +641,7 @@ AcpiNsRepair_PSS ( if ((UINT32) ObjDesc->Integer.Value > PreviousValue) { - ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "SubPackage[%u,%u] - suspicious power dissipation values", i-1, i)); } @@ -657,7 +658,7 @@ AcpiNsRepair_PSS ( * * FUNCTION: AcpiNsCheckSortedList * - * PARAMETERS: Data - Pointer to validation data structure + * PARAMETERS: Info - Method execution information block * ReturnObject - Pointer to the top-level returned object * ExpectedCount - Minimum length of each sub-package * SortIndex - Sub-package entry to sort on @@ -674,7 +675,7 @@ AcpiNsRepair_PSS ( static ACPI_STATUS AcpiNsCheckSortedList ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT *ReturnObject, UINT32 ExpectedCount, UINT32 SortIndex, @@ -755,11 +756,11 @@ AcpiNsCheckSortedList ( AcpiNsSortList (ReturnObject->Package.Elements, OuterElementCount, SortIndex, SortDirection); - Data->Flags |= ACPI_OBJECT_REPAIRED; + Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Repaired unsorted list - now sorted by %s\n", - Data->Pathname, SortKeyName)); + Info->FullPathname, SortKeyName)); return (AE_OK); } diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index 6f13d6697e09..57cc0387797c 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -205,8 +205,6 @@ AcpiEvaluateObject ( return_ACPI_STATUS (AE_NO_MEMORY); } - Info->Pathname = Pathname; - /* Convert and validate the device handle */ Info->PrefixNode = AcpiNsValidateHandle (Handle); @@ -217,17 +215,69 @@ AcpiEvaluateObject ( } /* - * If there are parameters to be passed to a control method, the external - * objects must all be converted to internal objects + * Get the actual namespace node for the target object. + * Handles these cases: + * + * 1) Null node, valid pathname from root (absolute path) + * 2) Node and valid pathname (path relative to Node) + * 3) Node, Null pathname + */ + if ((Pathname) && + (ACPI_IS_ROOT_PREFIX (Pathname[0]))) + { + /* The path is fully qualified, just evaluate by name */ + + Info->PrefixNode = NULL; + } + else if (!Handle) + { + /* + * A handle is optional iff a fully qualified pathname is specified. + * Since we've already handled fully qualified names above, this is + * an error. + */ + if (!Pathname) + { + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Both Handle and Pathname are NULL")); + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Null Handle with relative pathname [%s]", Pathname)); + } + + Status = AE_BAD_PARAMETER; + goto Cleanup; + } + + Info->RelativePathname = Pathname; + + /* + * Convert all external objects passed as arguments to the + * internal version(s). */ if (ExternalParams && ExternalParams->Count) { + Info->ParamCount = (UINT16) ExternalParams->Count; + + /* Warn on impossible argument count */ + + if (Info->ParamCount > ACPI_METHOD_NUM_ARGS) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Excess arguments (%u) - using only %u", + Info->ParamCount, ACPI_METHOD_NUM_ARGS)); + + Info->ParamCount = ACPI_METHOD_NUM_ARGS; + } + /* * Allocate a new parameter block for the internal objects * Add 1 to count to allow for null terminated internal list */ Info->Parameters = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) ExternalParams->Count + 1) * sizeof (void *)); + ((ACPI_SIZE) Info->ParamCount + 1) * sizeof (void *)); if (!Info->Parameters) { Status = AE_NO_MEMORY; @@ -236,58 +286,109 @@ AcpiEvaluateObject ( /* Convert each external object in the list to an internal object */ - for (i = 0; i < ExternalParams->Count; i++) + for (i = 0; i < Info->ParamCount; i++) { Status = AcpiUtCopyEobjectToIobject ( - &ExternalParams->Pointer[i], &Info->Parameters[i]); + &ExternalParams->Pointer[i], &Info->Parameters[i]); if (ACPI_FAILURE (Status)) { goto Cleanup; } } - Info->Parameters[ExternalParams->Count] = NULL; + + Info->Parameters[Info->ParamCount] = NULL; } + +#if 0 + /* - * Three major cases: - * 1) Fully qualified pathname - * 2) No handle, not fully qualified pathname (error) - * 3) Valid handle + * Begin incoming argument count analysis. Check for too few args + * and too many args. */ - if ((Pathname) && - (ACPI_IS_ROOT_PREFIX (Pathname[0]))) - { - /* The path is fully qualified, just evaluate by name */ - Info->PrefixNode = NULL; - Status = AcpiNsEvaluate (Info); - } - else if (!Handle) + switch (AcpiNsGetType (Info->Node)) { + case ACPI_TYPE_METHOD: + + /* Check incoming argument count against the method definition */ + + if (Info->ObjDesc->Method.ParamCount > Info->ParamCount) + { + ACPI_ERROR ((AE_INFO, + "Insufficient arguments (%u) - %u are required", + Info->ParamCount, + Info->ObjDesc->Method.ParamCount)); + + Status = AE_MISSING_ARGUMENTS; + goto Cleanup; + } + + else if (Info->ObjDesc->Method.ParamCount < Info->ParamCount) + { + ACPI_WARNING ((AE_INFO, + "Excess arguments (%u) - only %u are required", + Info->ParamCount, + Info->ObjDesc->Method.ParamCount)); + + /* Just pass the required number of arguments */ + + Info->ParamCount = Info->ObjDesc->Method.ParamCount; + } + /* - * A handle is optional iff a fully qualified pathname is specified. - * Since we've already handled fully qualified names above, this is - * an error + * Any incoming external objects to be passed as arguments to the + * method must be converted to internal objects */ - if (!Pathname) + if (Info->ParamCount) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Both Handle and Pathname are NULL")); + /* + * Allocate a new parameter block for the internal objects + * Add 1 to count to allow for null terminated internal list + */ + Info->Parameters = ACPI_ALLOCATE_ZEROED ( + ((ACPI_SIZE) Info->ParamCount + 1) * sizeof (void *)); + if (!Info->Parameters) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Convert each external object in the list to an internal object */ + + for (i = 0; i < Info->ParamCount; i++) + { + Status = AcpiUtCopyEobjectToIobject ( + &ExternalParams->Pointer[i], &Info->Parameters[i]); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + } + + Info->Parameters[Info->ParamCount] = NULL; } - else + break; + + default: + + /* Warn if arguments passed to an object that is not a method */ + + if (Info->ParamCount) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Null Handle with relative pathname [%s]", Pathname)); + ACPI_WARNING ((AE_INFO, + "%u arguments were passed to a non-method ACPI object", + Info->ParamCount)); } - - Status = AE_BAD_PARAMETER; + break; } - else - { - /* We have a namespace a node and a possible relative path */ - Status = AcpiNsEvaluate (Info); - } +#endif + + + /* Now we can evaluate the object */ + + Status = AcpiNsEvaluate (Info); /* * If we are expecting a return value, and all went well above, diff --git a/source/components/parser/psxface.c b/source/components/parser/psxface.c index eb0fc7ef5e27..3f991570b868 100644 --- a/source/components/parser/psxface.c +++ b/source/components/parser/psxface.c @@ -150,7 +150,7 @@ AcpiPsStartTrace ( } if ((!AcpiGbl_TraceMethodName) || - (AcpiGbl_TraceMethodName != Info->ResolvedNode->Name.Integer)) + (AcpiGbl_TraceMethodName != Info->Node->Name.Integer)) { goto Exit; } @@ -205,7 +205,7 @@ AcpiPsStopTrace ( } if ((!AcpiGbl_TraceMethodName) || - (AcpiGbl_TraceMethodName != Info->ResolvedNode->Name.Integer)) + (AcpiGbl_TraceMethodName != Info->Node->Name.Integer)) { goto Exit; } @@ -268,14 +268,14 @@ AcpiPsExecuteMethod ( /* Validate the Info and method Node */ - if (!Info || !Info->ResolvedNode) + if (!Info || !Info->Node) { return_ACPI_STATUS (AE_NULL_ENTRY); } /* Init for new method, wait on concurrency semaphore */ - Status = AcpiDsBeginMethodExecution (Info->ResolvedNode, Info->ObjDesc, NULL); + Status = AcpiDsBeginMethodExecution (Info->Node, Info->ObjDesc, NULL); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -295,7 +295,7 @@ AcpiPsExecuteMethod ( */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n", - Info->ResolvedNode->Name.Ascii, Info->ResolvedNode, Info->ObjDesc)); + Info->Node->Name.Ascii, Info->Node, Info->ObjDesc)); /* Create and init a Root Node */ @@ -317,7 +317,7 @@ AcpiPsExecuteMethod ( goto Cleanup; } - Status = AcpiDsInitAmlWalk (WalkState, Op, Info->ResolvedNode, + Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node, Info->ObjDesc->Method.AmlStart, Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber); if (ACPI_FAILURE (Status)) diff --git a/source/components/resources/rsutils.c b/source/components/resources/rsutils.c index bba3a1f1f5ce..fd54dabf5e11 100644 --- a/source/components/resources/rsutils.c +++ b/source/components/resources/rsutils.c @@ -810,7 +810,7 @@ AcpiRsSetSrsMethodData ( } Info->PrefixNode = Node; - Info->Pathname = METHOD_NAME__SRS; + Info->RelativePathname = METHOD_NAME__SRS; Info->Parameters = Args; Info->Flags = ACPI_IGNORE_RETURN_VALUE; diff --git a/source/components/utilities/uteval.c b/source/components/utilities/uteval.c index 7fb7ba6f3d64..82f2b79f64a1 100644 --- a/source/components/utilities/uteval.c +++ b/source/components/utilities/uteval.c @@ -95,7 +95,7 @@ AcpiUtEvaluateObject ( } Info->PrefixNode = PrefixNode; - Info->Pathname = Path; + Info->RelativePathname = Path; /* Evaluate the object/method */ diff --git a/source/components/utilities/utosi.c b/source/components/utilities/utosi.c index b783662db910..21fe51b5faec 100644 --- a/source/components/utilities/utosi.c +++ b/source/components/utilities/utosi.c @@ -392,7 +392,7 @@ AcpiUtOsiImplementation ( Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); if (ACPI_FAILURE (Status)) { - AcpiUtDeleteObjectDesc (ReturnDesc); + AcpiUtRemoveReference (ReturnDesc); return_ACPI_STATUS (Status); } diff --git a/source/components/utilities/utpredef.c b/source/components/utilities/utpredef.c index 4d85497e6779..114abdba3d78 100644 --- a/source/components/utilities/utpredef.c +++ b/source/components/utilities/utpredef.c @@ -166,6 +166,12 @@ AcpiUtGetExpectedReturnTypes ( UINT32 j; + if (!ExpectedBtypes) + { + ACPI_STRCPY (Buffer, "NONE"); + return; + } + j = 1; Buffer[0] = 0; ThisRtype = ACPI_RTYPE_INTEGER; @@ -373,9 +379,7 @@ AcpiUtGetArgumentTypes ( /* First field in the types list is the count of args to follow */ - ArgCount = (ArgumentTypes & METHOD_ARG_MASK); - ArgumentTypes >>= METHOD_ARG_BIT_WIDTH; - + ArgCount = METHOD_GET_ARG_COUNT (ArgumentTypes); if (ArgCount > METHOD_PREDEF_ARGS_MAX) { printf ("**** Invalid argument count (%u) " @@ -387,7 +391,8 @@ AcpiUtGetArgumentTypes ( for (i = 0; i < ArgCount; i++) { - ThisArgumentType = (ArgumentTypes & METHOD_ARG_MASK); + ThisArgumentType = METHOD_GET_NEXT_TYPE (ArgumentTypes); + if (!ThisArgumentType || (ThisArgumentType > METHOD_MAX_ARG_TYPE)) { printf ("**** Invalid argument type (%u) " @@ -396,10 +401,6 @@ AcpiUtGetArgumentTypes ( } strcat (Buffer, UtExternalTypeNames[ThisArgumentType] + SubIndex); - - /* Shift to next argument type field */ - - ArgumentTypes >>= METHOD_ARG_BIT_WIDTH; SubIndex = 0; } diff --git a/source/components/utilities/utxferror.c b/source/components/utilities/utxferror.c index 7a7afdb1f8b0..8454f8b73c2c 100644 --- a/source/components/utilities/utxferror.c +++ b/source/components/utilities/utxferror.c @@ -87,8 +87,8 @@ extern FILE *AcpiGbl_OutputFile; #define ACPI_MSG_WARNING "ACPI Warning: " #define ACPI_MSG_INFO "ACPI: " -#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Bug: Error: " -#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Bug: Warning: " +#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): " +#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): " /* * Common message suffix @@ -379,7 +379,7 @@ AcpiUtPredefinedWarning ( return; } - AcpiOsPrintf (ACPI_MSG_WARNING "For %s: ", Pathname); + AcpiOsPrintf (ACPI_MSG_WARNING "%s: ", Pathname); va_start (ArgList, Format); AcpiOsVprintf (Format, ArgList); @@ -428,7 +428,56 @@ AcpiUtPredefinedInfo ( return; } - AcpiOsPrintf (ACPI_MSG_INFO "For %s: ", Pathname); + AcpiOsPrintf (ACPI_MSG_INFO "%s: ", Pathname); + + va_start (ArgList, Format); + AcpiOsVprintf (Format, ArgList); + ACPI_MSG_SUFFIX; + va_end (ArgList); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtPredefinedBiosError + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * Pathname - Full pathname to the node + * NodeFlags - From Namespace node for the method/object + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: BIOS error message for predefined names. Messages + * are only emitted the first time a problem with a particular + * method/object is detected. This prevents a flood of + * messages for methods that are repeatedly evaluated. + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiUtPredefinedBiosError ( + const char *ModuleName, + UINT32 LineNumber, + char *Pathname, + UINT8 NodeFlags, + const char *Format, + ...) +{ + va_list ArgList; + + + /* + * Warning messages for this method/object will be disabled after the + * first time a validation fails or an object is successfully repaired. + */ + if (NodeFlags & ANOBJ_EVALUATED) + { + return; + } + + AcpiOsPrintf (ACPI_MSG_BIOS_ERROR "%s: ", Pathname); va_start (ArgList, Format); AcpiOsVprintf (Format, ArgList); diff --git a/source/include/acconfig.h b/source/include/acconfig.h index 452ab287f555..6a267fecf413 100644 --- a/source/include/acconfig.h +++ b/source/include/acconfig.h @@ -223,7 +223,7 @@ * *****************************************************************************/ -#define ACPI_DEBUGGER_MAX_ARGS ACPI_METHOD_NUM_ARGS + 2 /* Max command line arguments */ +#define ACPI_DEBUGGER_MAX_ARGS ACPI_METHOD_NUM_ARGS + 4 /* Max command line arguments */ #define ACPI_DB_LINE_BUFFER_SIZE 512 #define ACPI_DEBUGGER_COMMAND_PROMPT '-' diff --git a/source/include/aclocal.h b/source/include/aclocal.h index f9fefb5df796..47e743738f49 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -414,26 +414,6 @@ typedef union acpi_predefined_info #pragma pack() -/* Data block used during object validation */ - -typedef struct acpi_predefined_data -{ - char *Pathname; - const ACPI_PREDEFINED_INFO *Predefined; - union acpi_operand_object *ParentPackage; - ACPI_NAMESPACE_NODE *Node; - UINT32 Flags; - UINT32 ReturnBtype; - UINT8 NodeFlags; - -} ACPI_PREDEFINED_DATA; - -/* Defines for Flags field above */ - -#define ACPI_OBJECT_REPAIRED 1 -#define ACPI_OBJECT_WRAPPED 2 - - /* Return object auto-repair info */ typedef ACPI_STATUS (*ACPI_OBJECT_CONVERTER) ( diff --git a/source/include/acmacros.h b/source/include/acmacros.h index a56dcd7d7350..28bd2afea2db 100644 --- a/source/include/acmacros.h +++ b/source/include/acmacros.h @@ -377,10 +377,11 @@ * the plist contains a set of parens to allow variable-length lists. * These macros are used for both the debug and non-debug versions of the code. */ -#define ACPI_ERROR_NAMESPACE(s, e) AcpiUtNamespaceError (AE_INFO, s, e); -#define ACPI_ERROR_METHOD(s, n, p, e) AcpiUtMethodError (AE_INFO, s, n, p, e); -#define ACPI_WARN_PREDEFINED(plist) AcpiUtPredefinedWarning plist -#define ACPI_INFO_PREDEFINED(plist) AcpiUtPredefinedInfo plist +#define ACPI_ERROR_NAMESPACE(s, e) AcpiUtNamespaceError (AE_INFO, s, e); +#define ACPI_ERROR_METHOD(s, n, p, e) AcpiUtMethodError (AE_INFO, s, n, p, e); +#define ACPI_WARN_PREDEFINED(plist) AcpiUtPredefinedWarning plist +#define ACPI_INFO_PREDEFINED(plist) AcpiUtPredefinedInfo plist +#define ACPI_BIOS_ERROR_PREDEFINED(plist) AcpiUtPredefinedBiosError plist #else @@ -390,6 +391,7 @@ #define ACPI_ERROR_METHOD(s, n, p, e) #define ACPI_WARN_PREDEFINED(plist) #define ACPI_INFO_PREDEFINED(plist) +#define ACPI_BIOS_ERROR_PREDEFINED(plist) #endif /* ACPI_NO_ERROR_MESSAGES */ diff --git a/source/include/acnamesp.h b/source/include/acnamesp.h index 07b0fe95315f..1118184ed383 100644 --- a/source/include/acnamesp.h +++ b/source/include/acnamesp.h @@ -286,25 +286,40 @@ AcpiNsExecModuleCodeList ( /* - * nspredef - Support for predefined/reserved names + * nsarguments - Argument count/type checking for predefined/reserved names */ -ACPI_STATUS -AcpiNsCheckPredefinedNames ( - ACPI_NAMESPACE_NODE *Node, - UINT32 UserParamCount, - ACPI_STATUS ReturnStatus, - ACPI_OPERAND_OBJECT **ReturnObject); - void -AcpiNsCheckParameterCount ( +AcpiNsCheckArgumentCount ( char *Pathname, ACPI_NAMESPACE_NODE *Node, UINT32 UserParamCount, const ACPI_PREDEFINED_INFO *Info); +void +AcpiNsCheckAcpiCompliance ( + char *Pathname, + ACPI_NAMESPACE_NODE *Node, + const ACPI_PREDEFINED_INFO *Predefined); + +void +AcpiNsCheckArgumentTypes ( + ACPI_EVALUATE_INFO *Info); + + +/* + * nspredef - Return value checking for predefined/reserved names + */ +ACPI_STATUS +AcpiNsCheckReturnValue ( + ACPI_NAMESPACE_NODE *Node, + ACPI_EVALUATE_INFO *Info, + UINT32 UserParamCount, + ACPI_STATUS ReturnStatus, + ACPI_OPERAND_OBJECT **ReturnObject); + ACPI_STATUS AcpiNsCheckObjectType ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex); @@ -315,7 +330,7 @@ AcpiNsCheckObjectType ( */ ACPI_STATUS AcpiNsCheckPackage ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT **ReturnObjectPtr); @@ -403,27 +418,27 @@ AcpiNsGetAttachedData ( */ ACPI_STATUS AcpiNsSimpleRepair ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, UINT32 ExpectedBtypes, UINT32 PackageIndex, ACPI_OPERAND_OBJECT **ReturnObjectPtr); ACPI_STATUS AcpiNsWrapWithPackage ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ObjDescPtr); ACPI_STATUS AcpiNsRepairNullElement ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, UINT32 ExpectedBtypes, UINT32 PackageIndex, ACPI_OPERAND_OBJECT **ReturnObjectPtr); void AcpiNsRemoveNullElements ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, UINT8 PackageType, ACPI_OPERAND_OBJECT *ObjDesc); @@ -434,7 +449,7 @@ AcpiNsRemoveNullElements ( */ ACPI_STATUS AcpiNsComplexRepairs ( - ACPI_PREDEFINED_DATA *Data, + ACPI_EVALUATE_INFO *Info, ACPI_NAMESPACE_NODE *Node, ACPI_STATUS ValidateStatus, ACPI_OPERAND_OBJECT **ReturnObjectPtr); diff --git a/source/include/acoutput.h b/source/include/acoutput.h index 371ce7fc8fbf..e7b1248b0142 100644 --- a/source/include/acoutput.h +++ b/source/include/acoutput.h @@ -435,27 +435,21 @@ * This is the non-debug case -- make everything go away, * leaving no executable debug code! */ -#define ACPI_FUNCTION_NAME(a) #define ACPI_DEBUG_PRINT(pl) #define ACPI_DEBUG_PRINT_RAW(pl) #define ACPI_DEBUG_EXEC(a) #define ACPI_DEBUG_ONLY_MEMBERS(a) +#define ACPI_FUNCTION_NAME(a) #define ACPI_FUNCTION_TRACE(a) #define ACPI_FUNCTION_TRACE_PTR(a, b) #define ACPI_FUNCTION_TRACE_U32(a, b) #define ACPI_FUNCTION_TRACE_STR(a, b) -#define ACPI_FUNCTION_EXIT -#define ACPI_FUNCTION_STATUS_EXIT(s) -#define ACPI_FUNCTION_VALUE_EXIT(s) #define ACPI_FUNCTION_ENTRY() #define ACPI_DUMP_STACK_ENTRY(a) #define ACPI_DUMP_OPERANDS(a, b, c) #define ACPI_DUMP_ENTRY(a, b) -#define ACPI_DUMP_TABLES(a, b) #define ACPI_DUMP_PATHNAME(a, b, c, d) #define ACPI_DUMP_BUFFER(a, b) -#define ACPI_DEBUG_PRINT(pl) -#define ACPI_DEBUG_PRINT_RAW(pl) #define ACPI_IS_DEBUG_ENABLED(Level, Component) 0 /* Return macros must have a return statement at the minimum */ diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 405eb360ec9e..88b1ce007441 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -47,7 +47,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20130328 +#define ACPI_CA_VERSION 0x20130418 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/acpredef.h b/source/include/acpredef.h index 7a652b51fac3..46f3d695ef1c 100644 --- a/source/include/acpredef.h +++ b/source/include/acpredef.h @@ -131,8 +131,8 @@ enum AcpiReturnPackageTypes #define ARG_COUNT_IS_MINIMUM 0x8000 #define METHOD_MAX_ARG_TYPE ACPI_TYPE_PACKAGE -#define METHOD_GET_COUNT(ArgList) (ArgList & METHOD_ARG_MASK) -#define METHOD_GET_NEXT_ARG(ArgList) (ArgList >> METHOD_ARG_BIT_WIDTH) +#define METHOD_GET_ARG_COUNT(ArgList) ((ArgList) & METHOD_ARG_MASK) +#define METHOD_GET_NEXT_TYPE(ArgList) (((ArgList) >>= METHOD_ARG_BIT_WIDTH) & METHOD_ARG_MASK) /* Macros used to build the predefined info table */ diff --git a/source/include/acstruct.h b/source/include/acstruct.h index 8923d81dd852..a6ba5eac4433 100644 --- a/source/include/acstruct.h +++ b/source/include/acstruct.h @@ -195,27 +195,43 @@ typedef union acpi_aml_operands /* - * Structure used to pass object evaluation parameters. + * Structure used to pass object evaluation information and parameters. * Purpose is to reduce CPU stack use. */ typedef struct acpi_evaluate_info { - ACPI_NAMESPACE_NODE *PrefixNode; - char *Pathname; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT **Parameters; - ACPI_NAMESPACE_NODE *ResolvedNode; - ACPI_OPERAND_OBJECT *ReturnObject; - UINT8 ParamCount; - UINT8 PassNumber; - UINT8 ReturnObjectType; - UINT8 Flags; + /* The first 3 elements are passed by the caller to AcpiNsEvaluate */ + + ACPI_NAMESPACE_NODE *PrefixNode; /* Input: starting node */ + char *RelativePathname; /* Input: path relative to PrefixNode */ + ACPI_OPERAND_OBJECT **Parameters; /* Input: argument list */ + + ACPI_NAMESPACE_NODE *Node; /* Resolved node (PrefixNode:RelativePathname) */ + ACPI_OPERAND_OBJECT *ObjDesc; /* Object attached to the resolved node */ + char *FullPathname; /* Full pathname of the resolved node */ + + const ACPI_PREDEFINED_INFO *Predefined; /* Used if Node is a predefined name */ + ACPI_OPERAND_OBJECT *ReturnObject; /* Object returned from the evaluation */ + union acpi_operand_object *ParentPackage; /* Used if return object is a Package */ + + UINT32 ReturnFlags; /* Used for return value analysis */ + UINT32 ReturnBtype; /* Bitmapped type of the returned object */ + UINT16 ParamCount; /* Count of the input argument list */ + UINT8 PassNumber; /* Parser pass number */ + UINT8 ReturnObjectType; /* Object type of the returned object */ + UINT8 NodeFlags; /* Same as Node->Flags */ + UINT8 Flags; /* General flags */ } ACPI_EVALUATE_INFO; /* Values for Flags above */ -#define ACPI_IGNORE_RETURN_VALUE 1 +#define ACPI_IGNORE_RETURN_VALUE 1 + +/* Defines for ReturnFlags field above */ + +#define ACPI_OBJECT_REPAIRED 1 +#define ACPI_OBJECT_WRAPPED 2 /* Info used by AcpiNsInitializeDevices */ diff --git a/source/include/acutils.h b/source/include/acutils.h index 52fb04981700..b4ea7e53a127 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -1020,6 +1020,15 @@ AcpiUtPredefinedInfo ( const char *Format, ...); +void ACPI_INTERNAL_VAR_XFACE +AcpiUtPredefinedBiosError ( + const char *ModuleName, + UINT32 LineNumber, + char *Pathname, + UINT8 NodeFlags, + const char *Format, + ...); + void AcpiUtNamespaceError ( const char *ModuleName, diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c index b389fbe5122f..8a769cbd0db0 100644 --- a/source/os_specific/service_layers/oswinxf.c +++ b/source/os_specific/service_layers/oswinxf.c @@ -1405,7 +1405,6 @@ AcpiOsCreateCache ( } memset (NewCache, 0, sizeof (ACPI_MEMORY_LIST)); - NewCache->LinkOffset = 8; NewCache->ListName = CacheName; NewCache->ObjectSize = ObjectSize; NewCache->MaxDepth = MaxDepth; diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c index 166bd7fa7ed5..077c52c586c4 100644 --- a/source/tools/acpiexec/aehandlers.c +++ b/source/tools/acpiexec/aehandlers.c @@ -103,6 +103,17 @@ AeInterfaceHandler ( ACPI_STRING InterfaceName, UINT32 Supported); +static ACPI_STATUS +AeInstallOneEcHandler ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + +static ACPI_STATUS +AeInstallEcHandlers ( + void); + #if (!ACPI_REDUCED_HARDWARE) static UINT32 AeEventHandler ( @@ -116,17 +127,17 @@ static char *TableEvents[] = }; #endif /* !ACPI_REDUCED_HARDWARE */ + static UINT32 SigintCount = 0; static AE_DEBUG_REGIONS AeRegions; BOOLEAN AcpiGbl_DisplayRegionAccess = FALSE; - /* * We will override some of the default region handlers, especially the * SystemMemory handler, which must be implemented locally. Do not override * the PCI_Config handler since we would like to exercise the default handler * code. These handlers are installed "early" - before any _REG methods - * are executed - since they are special in the sense that tha ACPI spec + * are executed - since they are special in the sense that the ACPI spec * declares that they must "always be available". Cannot override the * DataTable region handler either -- needed for test execution. */ @@ -138,27 +149,27 @@ static ACPI_ADR_SPACE_TYPE DefaultSpaceIdList[] = /* * We will install handlers for some of the various address space IDs. - * Test one user-defined address space (used by aslts.) + * Test one user-defined address space (used by aslts). */ #define ACPI_ADR_SPACE_USER_DEFINED1 0x80 #define ACPI_ADR_SPACE_USER_DEFINED2 0xE4 static ACPI_ADR_SPACE_TYPE SpaceIdList[] = { - ACPI_ADR_SPACE_EC, ACPI_ADR_SPACE_SMBUS, - ACPI_ADR_SPACE_GSBUS, - ACPI_ADR_SPACE_GPIO, + ACPI_ADR_SPACE_CMOS, ACPI_ADR_SPACE_PCI_BAR_TARGET, ACPI_ADR_SPACE_IPMI, + ACPI_ADR_SPACE_GPIO, + ACPI_ADR_SPACE_GSBUS, ACPI_ADR_SPACE_FIXED_HARDWARE, ACPI_ADR_SPACE_USER_DEFINED1, ACPI_ADR_SPACE_USER_DEFINED2 }; - static ACPI_CONNECTION_INFO AeMyContext; + /****************************************************************************** * * FUNCTION: AeCtrlCHandler @@ -652,6 +663,55 @@ AeRegionInit ( } +/******************************************************************************* + * + * FUNCTION: AeInstallEcHandlers, AeInstallOneEcHandler + * + * PARAMETERS: ACPI_WALK_NAMESPACE callback + * + * RETURN: Status + * + * DESCRIPTION: Walk entire namespace, install a handler for every EC + * device found. + * + ******************************************************************************/ + +static ACPI_STATUS +AeInstallOneEcHandler ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue) +{ + ACPI_STATUS Status; + + + /* Install the handler for this EC device */ + + Status = AcpiInstallAddressSpaceHandler (ObjHandle, ACPI_ADR_SPACE_EC, + AeRegionHandler, AeRegionInit, &AeMyContext); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not install an OpRegion handler for EC device (%p)", + ObjHandle)); + } + + return (Status); +} + +static ACPI_STATUS +AeInstallEcHandlers ( + void) +{ + + /* Find all Embedded Controller devices */ + + AcpiGetDevices ("PNP0C09", AeInstallOneEcHandler, NULL, NULL); + return (AE_OK); +} + + /****************************************************************************** * * FUNCTION: AeInstallLateHandlers @@ -689,8 +749,15 @@ AeInstallLateHandlers ( AeMyContext.AccessLength = 0xA5; /* + * We will install a handler for each EC device, directly under the EC + * device definition. This is unlike the other handlers which we install + * at the root node. + */ + AeInstallEcHandlers (); + + /* * Install handlers for some of the "device driver" address spaces - * such as EC, SMBus, etc. + * such as SMBus, etc. */ for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++) { diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index 92b4ea671b14..20afe30ba284 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -338,6 +338,11 @@ main ( #ifdef _DEBUG _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); +/* + * Debugging memory corruption issues with windows: + * Add #include <crtdbg.h> to accommon.h + * Add _ASSERTE(_CrtCheckMemory()); where needed to test memory integrity + */ #endif printf (ACPI_COMMON_SIGNON ("AML Execution/Debug Utility")); @@ -495,6 +500,14 @@ main ( goto EnterDebugger; } + /* + * Install handlers for "device driver" space IDs (EC,SMBus, etc.) + * and fixed event handlers + */ + AeInstallLateHandlers (); + + /* Finish the ACPICA initialization */ + Status = AcpiInitializeObjects (InitFlags); if (ACPI_FAILURE (Status)) { @@ -503,11 +516,6 @@ main ( goto EnterDebugger; } - /* - * Install handlers for "device driver" space IDs (EC,SMBus, etc.) - * and fixed event handlers - */ - AeInstallLateHandlers (); AeMiscellaneousTests (); } |