summaryrefslogtreecommitdiff
path: root/source/components
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2013-04-12 14:31:19 -0700
committerRobert Moore <Robert.Moore@intel.com>2013-04-12 14:31:19 -0700
commit9b46d42b758dd101c0333c3fed7974ab7d1e5028 (patch)
treef5437520a9971fa0096bce964d5c6ad03f9b7b82 /source/components
parentf9c8728fda573246eaa2cdb40004febcaf4b37c5 (diff)
Add argument typechecking for all predefined ACPI names.
Fully implements typechecking on all incoming arguments for all predefined names. This ensures that ACPI-related drivers are passing the correct number of arguments, each of the correct object type. Argument counts are checked for the incoming arguments as well as for the actual ASL definition of the ACPI name itself (it must match the ACPI specification).
Diffstat (limited to 'source/components')
-rw-r--r--source/components/debugger/dbexec.c87
-rw-r--r--source/components/debugger/dbmethod.c77
-rw-r--r--source/components/debugger/dbnames.c16
-rw-r--r--source/components/events/evgpe.c1
-rw-r--r--source/components/events/evregion.c2
-rw-r--r--source/components/hardware/hwxface.c7
-rw-r--r--source/components/namespace/nsarguments.c375
-rw-r--r--source/components/namespace/nseval.c240
-rw-r--r--source/components/namespace/nsinit.c6
-rw-r--r--source/components/namespace/nspredef.c207
-rw-r--r--source/components/namespace/nsprepkg.c75
-rw-r--r--source/components/namespace/nsrepair.c50
-rw-r--r--source/components/namespace/nsrepair2.c81
-rw-r--r--source/components/namespace/nsxfeval.c173
-rw-r--r--source/components/parser/psxface.c12
-rw-r--r--source/components/resources/rsutils.c2
-rw-r--r--source/components/utilities/uteval.c2
-rw-r--r--source/components/utilities/utpredef.c17
18 files changed, 911 insertions, 519 deletions
diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c
index 58aa8ecd9..74afcfa2e 100644
--- a/source/components/debugger/dbexec.c
+++ b/source/components/debugger/dbexec.c
@@ -223,8 +223,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;
@@ -236,78 +235,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;
}
@@ -319,8 +270,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;
@@ -339,9 +290,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 2a85f7b14..b80075fd9 100644
--- a/source/components/debugger/dbmethod.c
+++ b/source/components/debugger/dbmethod.c
@@ -121,6 +121,7 @@
#include "acdebug.h"
#include "acdisasm.h"
#include "acparser.h"
+#include "acpredef.h"
#ifdef ACPI_DEBUGGER
@@ -505,17 +506,22 @@ 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_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)
@@ -542,21 +548,56 @@ 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.
+ */
+ for (i = 0; i < ArgCount; i++)
{
- Params[i].Type = ACPI_TYPE_INTEGER;
- Params[i].Integer.Value = 1;
+ ArgType = METHOD_GET_NEXT_TYPE (ArgTypeList);
+ Params[i].Type = ArgType;
+
+ switch (ArgType)
+ {
+ case ACPI_TYPE_INTEGER:
+ Params[i].Integer.Value = 1;
+ break;
+
+ case ACPI_TYPE_STRING:
+ Params[i].String.Pointer = "This is the default argument string";
+ Params[i].String.Length = strlen (Params[i].String.Pointer);
+ break;
+
+ case ACPI_TYPE_BUFFER:
+ Params[i].Buffer.Pointer = (UINT8 *) Params; /* just a garbage buffer */
+ Params[i].Buffer.Length = 48;
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+ Params[i].Package.Elements = NULL;
+ Params[i].Package.Count = 0;
+ break;
+
+ default:
+ AcpiOsPrintf ("%s: Unsupported argument type: %u\n",
+ Pathname, ArgType);
+ break;
+ }
}
- 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 bf1a1afba..a72ccf676 100644
--- a/source/components/debugger/dbnames.c
+++ b/source/components/debugger/dbnames.c
@@ -507,6 +507,7 @@ AcpiDbWalkForPredefinedNames (
const ACPI_PREDEFINED_INFO *Predefined;
const ACPI_PREDEFINED_INFO *Package = NULL;
char *Pathname;
+ char StringBuffer[48];
Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii);
@@ -528,23 +529,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 4a4629358..2869e445b 100644
--- a/source/components/events/evgpe.c
+++ b/source/components/events/evgpe.c
@@ -700,7 +700,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 3598b06aa..41023a30a 100644
--- a/source/components/events/evregion.c
+++ b/source/components/events/evregion.c
@@ -636,7 +636,7 @@ AcpiEvExecuteRegMethod (
}
Info->PrefixNode = RegionObj2->Extra.Method_REG;
- Info->Pathname = NULL;
+ Info->RelativePathname = NULL;
Info->Parameters = Args;
Info->Flags = ACPI_IGNORE_RETURN_VALUE;
diff --git a/source/components/hardware/hwxface.c b/source/components/hardware/hwxface.c
index a9b650a73..74aed554b 100644
--- a/source/components/hardware/hwxface.c
+++ b/source/components/hardware/hwxface.c
@@ -628,7 +628,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))
{
@@ -640,7 +641,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;
}
@@ -702,7 +703,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 000000000..df9de343d
--- /dev/null
+++ b/source/components/namespace/nsarguments.c
@@ -0,0 +1,375 @@
+/******************************************************************************
+ *
+ * Module Name: nsarguments - Validation of args for ACPI predefined methods
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#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 6f383cb70..7ae62b524 100644
--- a/source/components/namespace/nseval.c
+++ b/source/components/namespace/nseval.c
@@ -140,7 +140,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
@@ -166,7 +166,6 @@ AcpiNsEvaluate (
ACPI_EVALUATE_INFO *Info)
{
ACPI_STATUS Status;
- ACPI_NAMESPACE_NODE *Node;
ACPI_FUNCTION_TRACE (NsEvaluate);
@@ -177,23 +176,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);
@@ -201,60 +195,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));
@@ -269,80 +325,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 */
@@ -362,12 +396,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 1570ea07e..e6b9d4319 100644
--- a/source/components/namespace/nsinit.c
+++ b/source/components/namespace/nsinit.c
@@ -270,7 +270,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;
@@ -682,7 +682,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;
@@ -697,7 +697,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 e44e2ce9a..60c891a38 100644
--- a/source/components/namespace/nspredef.c
+++ b/source/components/namespace/nspredef.c
@@ -135,12 +135,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.
*
@@ -151,7 +151,7 @@
static ACPI_STATUS
AcpiNsCheckReference (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT *ReturnObject);
static UINT32
@@ -161,9 +161,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
@@ -171,56 +172,41 @@ 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);
+ Predefined = Info->Predefined;
+ Pathname = Info->FullPathname;
/* If not a predefined name, we cannot validate the return object */
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);
}
/*
@@ -240,27 +226,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;
@@ -272,8 +246,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;
@@ -288,7 +262,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:
/*
@@ -296,119 +270,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)
@@ -425,7 +301,7 @@ AcpiNsCheckParameterCount (
ACPI_STATUS
AcpiNsCheckObjectType (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr,
UINT32 ExpectedBtypes,
UINT32 PackageIndex)
@@ -440,7 +316,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)));
@@ -455,8 +331,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;
@@ -464,17 +340,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:
@@ -485,13 +364,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));
@@ -505,7 +384,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
*
@@ -519,7 +398,7 @@ TypeErrorExit:
static ACPI_STATUS
AcpiNsCheckReference (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT *ReturnObject)
{
@@ -533,7 +412,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 d8aff8f3a..d766e3aad 100644
--- a/source/components/namespace/nsprepkg.c
+++ b/source/components/namespace/nsprepkg.c
@@ -127,14 +127,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,
@@ -147,7 +147,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
*
@@ -160,7 +160,7 @@ AcpiNsCheckPackageElements (
ACPI_STATUS
AcpiNsCheckPackage (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr;
@@ -177,17 +177,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 */
@@ -205,7 +206,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);
@@ -237,12 +238,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;
@@ -256,7 +257,7 @@ AcpiNsCheckPackage (
*/
for (i = 0; i < Count; i++)
{
- Status = AcpiNsCheckObjectType (Data, Elements,
+ Status = AcpiNsCheckObjectType (Info, Elements,
Package->RetInfo.ObjectType1, i);
if (ACPI_FAILURE (Status))
{
@@ -290,7 +291,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))
{
@@ -301,7 +302,7 @@ AcpiNsCheckPackage (
{
/* These are the optional package elements */
- Status = AcpiNsCheckObjectType (Data, Elements,
+ Status = AcpiNsCheckObjectType (Info, Elements,
Package->RetInfo3.TailObjectType, i);
if (ACPI_FAILURE (Status))
{
@@ -317,7 +318,7 @@ AcpiNsCheckPackage (
/* First element is the (Integer) revision */
- Status = AcpiNsCheckObjectType (Data, Elements,
+ Status = AcpiNsCheckObjectType (Info, Elements,
ACPI_RTYPE_INTEGER, 0);
if (ACPI_FAILURE (Status))
{
@@ -329,7 +330,7 @@ AcpiNsCheckPackage (
/* Examine the sub-packages */
- Status = AcpiNsCheckPackageList (Data, Package, Elements, Count);
+ Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
break;
@@ -337,7 +338,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))
{
@@ -359,7 +360,7 @@ AcpiNsCheckPackage (
/* Examine the sub-packages */
- Status = AcpiNsCheckPackageList (Data, Package, Elements, Count);
+ Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
break;
@@ -383,7 +384,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);
@@ -398,7 +399,7 @@ AcpiNsCheckPackage (
/* Examine the sub-packages */
- Status = AcpiNsCheckPackageList (Data, Package, Elements, Count);
+ Status = AcpiNsCheckPackageList (Info, Package, Elements, Count);
break;
@@ -406,7 +407,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));
@@ -420,7 +421,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));
@@ -432,7 +433,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.
@@ -446,7 +447,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)
@@ -470,11 +471,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))
{
@@ -483,7 +484,7 @@ AcpiNsCheckPackageList (
/* Examine the different types of expected sub-packages */
- Data->ParentPackage = SubPackage;
+ Info->ParentPackage = SubPackage;
switch (Package->RetInfo.Type)
{
case ACPI_PTYPE2:
@@ -498,7 +499,7 @@ AcpiNsCheckPackageList (
goto PackageTooSmall;
}
- Status = AcpiNsCheckPackageElements (Data, SubElements,
+ Status = AcpiNsCheckPackageElements (Info, SubElements,
Package->RetInfo.ObjectType1,
Package->RetInfo.Count1,
Package->RetInfo.ObjectType2,
@@ -521,7 +522,7 @@ AcpiNsCheckPackageList (
goto PackageTooSmall;
}
- Status = AcpiNsCheckPackageElements (Data, SubElements,
+ Status = AcpiNsCheckPackageElements (Info, SubElements,
Package->RetInfo.ObjectType1,
Package->RetInfo.Count1,
Package->RetInfo.ObjectType2,
@@ -547,7 +548,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))
{
@@ -569,7 +570,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))
@@ -585,7 +586,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))
{
@@ -620,7 +621,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))
@@ -645,7 +646,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));
@@ -657,7 +658,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
@@ -674,7 +675,7 @@ PackageTooSmall:
static ACPI_STATUS
AcpiNsCheckPackageElements (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **Elements,
UINT8 Type1,
UINT32 Count1,
@@ -694,7 +695,7 @@ AcpiNsCheckPackageElements (
*/
for (i = 0; i < Count1; i++)
{
- Status = AcpiNsCheckObjectType (Data, ThisElement,
+ Status = AcpiNsCheckObjectType (Info, ThisElement,
Type1, i + StartIndex);
if (ACPI_FAILURE (Status))
{
@@ -705,7 +706,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 a4b0cbea1..ecdfcdc38 100644
--- a/source/components/namespace/nsrepair.c
+++ b/source/components/namespace/nsrepair.c
@@ -203,7 +203,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
@@ -220,7 +220,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)
@@ -238,13 +238,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"));
}
@@ -267,7 +267,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);
}
@@ -290,7 +290,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);
@@ -331,7 +331,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))
{
/*
@@ -339,7 +339,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);
}
}
@@ -364,7 +364,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;
@@ -377,14 +377,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)));
}
@@ -392,7 +392,7 @@ ObjectRepaired:
AcpiUtRemoveReference (ReturnObject);
*ReturnObjectPtr = NewObject;
- Data->Flags |= ACPI_OBJECT_REPAIRED;
+ Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
return (AE_OK);
}
@@ -450,7 +450,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
@@ -466,7 +466,7 @@ AcpiNsMatchSimpleRepair (
ACPI_STATUS
AcpiNsRepairNullElement (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
UINT32 ExpectedBtypes,
UINT32 PackageIndex,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
@@ -523,14 +523,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);
}
@@ -539,7 +539,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
*
@@ -553,7 +553,7 @@ AcpiNsRepairNullElement (
void
AcpiNsRemoveNullElements (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
UINT8 PackageType,
ACPI_OPERAND_OBJECT *ObjDesc)
{
@@ -618,7 +618,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 */
@@ -632,7 +632,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
*
@@ -654,7 +654,7 @@ AcpiNsRemoveNullElements (
ACPI_STATUS
AcpiNsWrapWithPackage (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT *OriginalObject,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
@@ -678,11 +678,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 c2d708ddb..b9cf82d0f 100644
--- a/source/components/namespace/nsrepair2.c
+++ b/source/components/namespace/nsrepair2.c
@@ -130,7 +130,7 @@
*/
typedef
ACPI_STATUS (*ACPI_REPAIR_FUNCTION) (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr);
typedef struct acpi_repair_info
@@ -149,37 +149,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,
@@ -242,7 +242,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
@@ -258,7 +258,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)
@@ -275,7 +275,7 @@ AcpiNsComplexRepairs (
return (ValidateStatus);
}
- Status = Predefined->RepairFunction (Data, ReturnObjectPtr);
+ Status = Predefined->RepairFunction (Info, ReturnObjectPtr);
return (Status);
}
@@ -319,7 +319,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
*
@@ -332,14 +332,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);
@@ -350,7 +350,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
*
@@ -365,7 +365,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;
@@ -393,7 +393,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));
@@ -422,7 +422,7 @@ AcpiNsRepair_FDE (
ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
"%s Expanded Byte Buffer to expected DWord Buffer\n",
- Data->Pathname));
+ Info->FullPathname));
break;
default:
@@ -434,7 +434,7 @@ AcpiNsRepair_FDE (
AcpiUtRemoveReference (ReturnObject);
*ReturnObjectPtr = BufferObject;
- Data->Flags |= ACPI_OBJECT_REPAIRED;
+ Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;
return (AE_OK);
}
@@ -443,7 +443,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
*
@@ -457,7 +457,7 @@ AcpiNsRepair_FDE (
static ACPI_STATUS
AcpiNsRepair_CID (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT **ReturnObjectPtr)
{
ACPI_STATUS Status;
@@ -472,7 +472,7 @@ AcpiNsRepair_CID (
if (ReturnObject->Common.Type == ACPI_TYPE_STRING)
{
- Status = AcpiNsRepair_HID (Data, ReturnObjectPtr);
+ Status = AcpiNsRepair_HID (Info, ReturnObjectPtr);
return (Status);
}
@@ -491,7 +491,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);
@@ -520,7 +520,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
*
@@ -533,7 +533,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;
@@ -554,12 +554,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);
}
@@ -584,7 +584,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));
}
/*
@@ -610,7 +610,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
*
@@ -623,7 +623,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;
@@ -639,13 +639,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);
@@ -656,7 +657,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
*
@@ -671,7 +672,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;
@@ -690,7 +691,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))
{
@@ -712,7 +713,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));
}
@@ -729,7 +730,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
@@ -746,7 +747,7 @@ AcpiNsRepair_PSS (
static ACPI_STATUS
AcpiNsCheckSortedList (
- ACPI_PREDEFINED_DATA *Data,
+ ACPI_EVALUATE_INFO *Info,
ACPI_OPERAND_OBJECT *ReturnObject,
UINT32 ExpectedCount,
UINT32 SortIndex,
@@ -827,11 +828,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 83f5c1b56..88ec82b2a 100644
--- a/source/components/namespace/nsxfeval.c
+++ b/source/components/namespace/nsxfeval.c
@@ -277,8 +277,6 @@ AcpiEvaluateObject (
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Info->Pathname = Pathname;
-
/* Convert and validate the device handle */
Info->PrefixNode = AcpiNsValidateHandle (Handle);
@@ -289,17 +287,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;
@@ -308,58 +358,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 b1889191b..1e58b8190 100644
--- a/source/components/parser/psxface.c
+++ b/source/components/parser/psxface.c
@@ -222,7 +222,7 @@ AcpiPsStartTrace (
}
if ((!AcpiGbl_TraceMethodName) ||
- (AcpiGbl_TraceMethodName != Info->ResolvedNode->Name.Integer))
+ (AcpiGbl_TraceMethodName != Info->Node->Name.Integer))
{
goto Exit;
}
@@ -277,7 +277,7 @@ AcpiPsStopTrace (
}
if ((!AcpiGbl_TraceMethodName) ||
- (AcpiGbl_TraceMethodName != Info->ResolvedNode->Name.Integer))
+ (AcpiGbl_TraceMethodName != Info->Node->Name.Integer))
{
goto Exit;
}
@@ -340,14 +340,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);
@@ -367,7 +367,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 */
@@ -389,7 +389,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 642f32be1..110d19782 100644
--- a/source/components/resources/rsutils.c
+++ b/source/components/resources/rsutils.c
@@ -882,7 +882,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 8ab34cdc8..cc2318e0c 100644
--- a/source/components/utilities/uteval.c
+++ b/source/components/utilities/uteval.c
@@ -167,7 +167,7 @@ AcpiUtEvaluateObject (
}
Info->PrefixNode = PrefixNode;
- Info->Pathname = Path;
+ Info->RelativePathname = Path;
/* Evaluate the object/method */
diff --git a/source/components/utilities/utpredef.c b/source/components/utilities/utpredef.c
index 229ec3c6d..d02acdd96 100644
--- a/source/components/utilities/utpredef.c
+++ b/source/components/utilities/utpredef.c
@@ -238,6 +238,12 @@ AcpiUtGetExpectedReturnTypes (
UINT32 j;
+ if (!ExpectedBtypes)
+ {
+ ACPI_STRCPY (Buffer, "NONE");
+ return;
+ }
+
j = 1;
Buffer[0] = 0;
ThisRtype = ACPI_RTYPE_INTEGER;
@@ -445,9 +451,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) "
@@ -459,7 +463,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) "
@@ -468,10 +473,6 @@ AcpiUtGetArgumentTypes (
}
strcat (Buffer, UtExternalTypeNames[ThisArgumentType] + SubIndex);
-
- /* Shift to next argument type field */
-
- ArgumentTypes >>= METHOD_ARG_BIT_WIDTH;
SubIndex = 0;
}