Date: Fri, 19 Apr 2013 05:49:54 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r249637 - in vendor-sys/acpica/dist: . generate/unix generate/unix/acpiexec source/compiler source/components/debugger source/components/events source/components/executer source/compone... Message-ID: <201304190549.r3J5nsIC070560@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Fri Apr 19 05:49:53 2013 New Revision: 249637 URL: http://svnweb.freebsd.org/changeset/base/249637 Log: Import ACPICA 20130418. Added: vendor-sys/acpica/dist/source/components/namespace/nsarguments.c (contents, props changed) Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/generate/unix/Makefile.config vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile vendor-sys/acpica/dist/source/compiler/aslpredef.c vendor-sys/acpica/dist/source/compiler/aslprepkg.c vendor-sys/acpica/dist/source/components/debugger/dbdisply.c vendor-sys/acpica/dist/source/components/debugger/dbexec.c vendor-sys/acpica/dist/source/components/debugger/dbmethod.c vendor-sys/acpica/dist/source/components/debugger/dbnames.c vendor-sys/acpica/dist/source/components/events/evgpe.c vendor-sys/acpica/dist/source/components/events/evregion.c vendor-sys/acpica/dist/source/components/executer/exconfig.c vendor-sys/acpica/dist/source/components/executer/exfldio.c vendor-sys/acpica/dist/source/components/hardware/hwxface.c vendor-sys/acpica/dist/source/components/namespace/nseval.c vendor-sys/acpica/dist/source/components/namespace/nsinit.c vendor-sys/acpica/dist/source/components/namespace/nspredef.c vendor-sys/acpica/dist/source/components/namespace/nsprepkg.c vendor-sys/acpica/dist/source/components/namespace/nsrepair.c vendor-sys/acpica/dist/source/components/namespace/nsrepair2.c vendor-sys/acpica/dist/source/components/namespace/nsxfeval.c vendor-sys/acpica/dist/source/components/parser/psxface.c vendor-sys/acpica/dist/source/components/resources/rsutils.c vendor-sys/acpica/dist/source/components/utilities/uteval.c vendor-sys/acpica/dist/source/components/utilities/utosi.c vendor-sys/acpica/dist/source/components/utilities/utpredef.c vendor-sys/acpica/dist/source/components/utilities/utxferror.c vendor-sys/acpica/dist/source/include/acconfig.h vendor-sys/acpica/dist/source/include/aclocal.h vendor-sys/acpica/dist/source/include/acmacros.h vendor-sys/acpica/dist/source/include/acnamesp.h vendor-sys/acpica/dist/source/include/acoutput.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/acpredef.h vendor-sys/acpica/dist/source/include/acstruct.h vendor-sys/acpica/dist/source/include/acutils.h vendor-sys/acpica/dist/source/os_specific/service_layers/oswinxf.c vendor-sys/acpica/dist/source/tools/acpiexec/aehandlers.c vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/changes.txt Fri Apr 19 05:49:53 2013 (r249637) @@ -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: Modified: vendor-sys/acpica/dist/generate/unix/Makefile.config ============================================================================== --- vendor-sys/acpica/dist/generate/unix/Makefile.config Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/generate/unix/Makefile.config Fri Apr 19 05:49:53 2013 (r249637) @@ -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 += \ Modified: vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile ============================================================================== --- vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile Fri Apr 19 05:49:53 2013 (r249637) @@ -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\ Modified: vendor-sys/acpica/dist/source/compiler/aslpredef.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslpredef.c Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/source/compiler/aslpredef.c Fri Apr 19 05:49:53 2013 (r249637) @@ -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"); Modified: vendor-sys/acpica/dist/source/compiler/aslprepkg.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslprepkg.c Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/source/compiler/aslprepkg.c Fri Apr 19 05:49:53 2013 (r249637) @@ -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 * Modified: vendor-sys/acpica/dist/source/components/debugger/dbdisply.c ============================================================================== --- vendor-sys/acpica/dist/source/components/debugger/dbdisply.c Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/source/components/debugger/dbdisply.c Fri Apr 19 05:49:53 2013 (r249637) @@ -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 */ Modified: vendor-sys/acpica/dist/source/components/debugger/dbexec.c ============================================================================== --- vendor-sys/acpica/dist/source/components/debugger/dbexec.c Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/source/components/debugger/dbexec.c Fri Apr 19 05:49:53 2013 (r249637) @@ -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); } Modified: vendor-sys/acpica/dist/source/components/debugger/dbmethod.c ============================================================================== --- vendor-sys/acpica/dist/source/components/debugger/dbmethod.c Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/source/components/debugger/dbmethod.c Fri Apr 19 05:49:53 2013 (r249637) @@ -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 */ + /* Setup default parameters (with proper types) */ + + ArgTypeList = Predefined->Info.ArgumentList; + ArgCount = METHOD_GET_ARG_COUNT (ArgTypeList); - for (i = 0; i < ObjInfo->ParamCount; i++) + /* + * 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); Modified: vendor-sys/acpica/dist/source/components/debugger/dbnames.c ============================================================================== --- vendor-sys/acpica/dist/source/components/debugger/dbnames.c Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/source/components/debugger/dbnames.c Fri Apr 19 05:49:53 2013 (r249637) @@ -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); } Modified: vendor-sys/acpica/dist/source/components/events/evgpe.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evgpe.c Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/source/components/events/evgpe.c Fri Apr 19 05:49:53 2013 (r249637) @@ -628,7 +628,6 @@ AcpiEvAsynchExecuteGpeMethod ( "while evaluating GPE method [%4.4s]", AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode))); } - break; default: Modified: vendor-sys/acpica/dist/source/components/events/evregion.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evregion.c Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/source/components/events/evregion.c Fri Apr 19 05:49:53 2013 (r249637) @@ -60,7 +60,7 @@ extern UINT8 AcpiGbl_DefaultAddre 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; Modified: vendor-sys/acpica/dist/source/components/executer/exconfig.c ============================================================================== --- vendor-sys/acpica/dist/source/components/executer/exconfig.c Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/source/components/executer/exconfig.c Fri Apr 19 05:49:53 2013 (r249637) @@ -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 */ Modified: vendor-sys/acpica/dist/source/components/executer/exfldio.c ============================================================================== --- vendor-sys/acpica/dist/source/components/executer/exfldio.c Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/source/components/executer/exfldio.c Fri Apr 19 05:49:53 2013 (r249637) @@ -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); } Modified: vendor-sys/acpica/dist/source/components/hardware/hwxface.c ============================================================================== --- vendor-sys/acpica/dist/source/components/hardware/hwxface.c Fri Apr 19 05:46:16 2013 (r249636) +++ vendor-sys/acpica/dist/source/components/hardware/hwxface.c Fri Apr 19 05:49:53 2013 (r249637) @@ -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); Added: vendor-sys/acpica/dist/source/components/namespace/nsarguments.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/acpica/dist/source/components/namespace/nsarguments.c Fri Apr 19 05:49:53 2013 (r249637) @@ -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.) + * + ******************************************************************************/ + *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304190549.r3J5nsIC070560>