svn commit: r249663 - in head: sys/conf sys/contrib/dev/acpica sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/events sys/contrib/dev/ac...
Jung-uk Kim
jkim at FreeBSD.org
Fri Apr 19 23:49:38 UTC 2013
Author: jkim
Date: Fri Apr 19 23:49:34 2013
New Revision: 249663
URL: http://svnweb.freebsd.org/changeset/base/249663
Log:
Merge ACPICA 20130418.
Added:
head/sys/contrib/dev/acpica/components/namespace/nsarguments.c
- copied, changed from r249661, vendor-sys/acpica/dist/source/components/namespace/nsarguments.c
Modified:
head/sys/conf/files
head/sys/contrib/dev/acpica/changes.txt (contents, props changed)
head/sys/contrib/dev/acpica/compiler/aslpredef.c
head/sys/contrib/dev/acpica/compiler/aslprepkg.c
head/sys/contrib/dev/acpica/components/debugger/dbdisply.c
head/sys/contrib/dev/acpica/components/debugger/dbexec.c
head/sys/contrib/dev/acpica/components/debugger/dbmethod.c
head/sys/contrib/dev/acpica/components/debugger/dbnames.c
head/sys/contrib/dev/acpica/components/events/evgpe.c
head/sys/contrib/dev/acpica/components/events/evregion.c
head/sys/contrib/dev/acpica/components/executer/exconfig.c
head/sys/contrib/dev/acpica/components/executer/exfldio.c
head/sys/contrib/dev/acpica/components/hardware/hwxface.c
head/sys/contrib/dev/acpica/components/namespace/nseval.c
head/sys/contrib/dev/acpica/components/namespace/nsinit.c
head/sys/contrib/dev/acpica/components/namespace/nspredef.c
head/sys/contrib/dev/acpica/components/namespace/nsprepkg.c
head/sys/contrib/dev/acpica/components/namespace/nsrepair.c
head/sys/contrib/dev/acpica/components/namespace/nsrepair2.c
head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c
head/sys/contrib/dev/acpica/components/parser/psxface.c
head/sys/contrib/dev/acpica/components/resources/rsutils.c
head/sys/contrib/dev/acpica/components/utilities/uteval.c
head/sys/contrib/dev/acpica/components/utilities/utosi.c
head/sys/contrib/dev/acpica/components/utilities/utpredef.c
head/sys/contrib/dev/acpica/components/utilities/utxferror.c
head/sys/contrib/dev/acpica/include/acconfig.h
head/sys/contrib/dev/acpica/include/aclocal.h
head/sys/contrib/dev/acpica/include/acmacros.h
head/sys/contrib/dev/acpica/include/acnamesp.h
head/sys/contrib/dev/acpica/include/acoutput.h
head/sys/contrib/dev/acpica/include/acpixf.h
head/sys/contrib/dev/acpica/include/acpredef.h
head/sys/contrib/dev/acpica/include/acstruct.h
head/sys/contrib/dev/acpica/include/acutils.h
head/sys/modules/acpi/acpi/Makefile
head/usr.sbin/acpi/acpidb/Makefile
Directory Properties:
head/sys/contrib/dev/acpica/ (props changed)
head/sys/contrib/dev/acpica/compiler/ (props changed)
head/sys/contrib/dev/acpica/components/debugger/ (props changed)
head/sys/contrib/dev/acpica/components/events/ (props changed)
head/sys/contrib/dev/acpica/components/executer/ (props changed)
head/sys/contrib/dev/acpica/components/hardware/ (props changed)
head/sys/contrib/dev/acpica/components/namespace/ (props changed)
head/sys/contrib/dev/acpica/components/parser/ (props changed)
head/sys/contrib/dev/acpica/components/resources/ (props changed)
head/sys/contrib/dev/acpica/components/utilities/ (props changed)
head/sys/contrib/dev/acpica/include/ (props changed)
head/sys/contrib/dev/acpica/os_specific/ (props changed)
Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/conf/files Fri Apr 19 23:49:34 2013 (r249663)
@@ -374,6 +374,7 @@ contrib/dev/acpica/components/hardware/h
contrib/dev/acpica/components/hardware/hwxfsleep.c optional acpi
contrib/dev/acpica/components/namespace/nsaccess.c optional acpi
contrib/dev/acpica/components/namespace/nsalloc.c optional acpi
+contrib/dev/acpica/components/namespace/nsarguments.c optional acpi
contrib/dev/acpica/components/namespace/nsconvert.c optional acpi
contrib/dev/acpica/components/namespace/nsdump.c optional acpi
contrib/dev/acpica/components/namespace/nseval.c optional acpi
Modified: head/sys/contrib/dev/acpica/changes.txt
==============================================================================
--- head/sys/contrib/dev/acpica/changes.txt Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/changes.txt Fri Apr 19 23:49:34 2013 (r249663)
@@ -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: head/sys/contrib/dev/acpica/compiler/aslpredef.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslpredef.c Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/compiler/aslpredef.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -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: head/sys/contrib/dev/acpica/compiler/aslprepkg.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslprepkg.c Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/compiler/aslprepkg.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -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: head/sys/contrib/dev/acpica/components/debugger/dbdisply.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbdisply.c Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/components/debugger/dbdisply.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -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: head/sys/contrib/dev/acpica/components/debugger/dbexec.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbexec.c Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/components/debugger/dbexec.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -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: head/sys/contrib/dev/acpica/components/debugger/dbmethod.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbmethod.c Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/components/debugger/dbmethod.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -49,6 +49,7 @@
#include <contrib/dev/acpica/include/acdebug.h>
#include <contrib/dev/acpica/include/acdisasm.h>
#include <contrib/dev/acpica/include/acparser.h>
+#include <contrib/dev/acpica/include/acpredef.h>
#ifdef ACPI_DEBUGGER
@@ -437,17 +438,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)
@@ -474,21 +481,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: head/sys/contrib/dev/acpica/components/debugger/dbnames.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/debugger/dbnames.c Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/components/debugger/dbnames.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -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: head/sys/contrib/dev/acpica/components/events/evgpe.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/events/evgpe.c Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/components/events/evgpe.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -628,7 +628,6 @@ AcpiEvAsynchExecuteGpeMethod (
"while evaluating GPE method [%4.4s]",
AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode)));
}
-
break;
default:
Modified: head/sys/contrib/dev/acpica/components/events/evregion.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/events/evregion.c Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/components/events/evregion.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -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: head/sys/contrib/dev/acpica/components/executer/exconfig.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/executer/exconfig.c Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/components/executer/exconfig.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -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: head/sys/contrib/dev/acpica/components/executer/exfldio.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/executer/exfldio.c Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/components/executer/exfldio.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -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: head/sys/contrib/dev/acpica/components/hardware/hwxface.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/hardware/hwxface.c Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/components/hardware/hwxface.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -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);
Copied and modified: head/sys/contrib/dev/acpica/components/namespace/nsarguments.c (from r249661, vendor-sys/acpica/dist/source/components/namespace/nsarguments.c)
==============================================================================
--- vendor-sys/acpica/dist/source/components/namespace/nsarguments.c Fri Apr 19 21:09:27 2013 (r249661, copy source)
+++ head/sys/contrib/dev/acpica/components/namespace/nsarguments.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -41,10 +41,10 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#include "acpi.h"
-#include "accommon.h"
-#include "acnamesp.h"
-#include "acpredef.h"
+#include <contrib/dev/acpica/include/acpi.h>
+#include <contrib/dev/acpica/include/accommon.h>
+#include <contrib/dev/acpica/include/acnamesp.h>
+#include <contrib/dev/acpica/include/acpredef.h>
#define _COMPONENT ACPI_NAMESPACE
Modified: head/sys/contrib/dev/acpica/components/namespace/nseval.c
==============================================================================
--- head/sys/contrib/dev/acpica/components/namespace/nseval.c Fri Apr 19 21:49:11 2013 (r249662)
+++ head/sys/contrib/dev/acpica/components/namespace/nseval.c Fri Apr 19 23:49:34 2013 (r249663)
@@ -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 */
+
+ 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;
+ }
+ }
+
+ /*
+ * 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 */
- Node = Info->ResolvedNode;
+ AcpiNsCheckArgumentTypes (Info);
/*
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-head
mailing list