summaryrefslogtreecommitdiff
path: root/parser/psargs.c
diff options
context:
space:
mode:
Diffstat (limited to 'parser/psargs.c')
-rw-r--r--parser/psargs.c62
1 files changed, 43 insertions, 19 deletions
diff --git a/parser/psargs.c b/parser/psargs.c
index c40b95910500..60d4a835b1b7 100644
--- a/parser/psargs.c
+++ b/parser/psargs.c
@@ -1,7 +1,6 @@
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
- * $Revision: 1.92 $
*
*****************************************************************************/
@@ -9,7 +8,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +116,7 @@
#define __PSARGS_C__
#include "acpi.h"
+#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acnamesp.h"
@@ -156,7 +156,7 @@ AcpiPsGetNextPackageLength (
{
UINT8 *Aml = ParserState->Aml;
UINT32 PackageLength = 0;
- ACPI_NATIVE_UINT ByteCount;
+ UINT32 ByteCount;
UINT8 ByteZeroMask = 0x3F; /* Default [0:5] */
@@ -168,7 +168,7 @@ AcpiPsGetNextPackageLength (
* used to encode the package length, either 0,1,2, or 3
*/
ByteCount = (Aml[0] >> 6);
- ParserState->Aml += (ByteCount + 1);
+ ParserState->Aml += ((ACPI_SIZE) ByteCount + 1);
/* Get bytes 3, 2, 1 as needed */
@@ -329,12 +329,12 @@ AcpiPsGetNextNamepath (
ACPI_PARSE_OBJECT *Arg,
BOOLEAN PossibleMethodCall)
{
+ ACPI_STATUS Status;
char *Path;
ACPI_PARSE_OBJECT *NameOp;
- ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *MethodDesc;
ACPI_NAMESPACE_NODE *Node;
- ACPI_GENERIC_STATE ScopeInfo;
+ UINT8 *Start = ParserState->Aml;
ACPI_FUNCTION_TRACE (PsGetNextNamepath);
@@ -351,23 +351,16 @@ AcpiPsGetNextNamepath (
return_ACPI_STATUS (AE_OK);
}
- /* Setup search scope info */
-
- ScopeInfo.Scope.Node = NULL;
- Node = ParserState->StartNode;
- if (Node)
- {
- ScopeInfo.Scope.Node = Node;
- }
-
/*
- * Lookup the name in the internal namespace. We don't want to add
- * anything new to the namespace here, however, so we use MODE_EXECUTE.
+ * Lookup the name in the internal namespace, starting with the current
+ * scope. We don't want to add anything new to the namespace here,
+ * however, so we use MODE_EXECUTE.
* Allow searching of the parent tree, but don't open a new scope -
* we just want to lookup the object (must be mode EXECUTE to perform
* the upsearch)
*/
- Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
/*
@@ -378,6 +371,18 @@ AcpiPsGetNextNamepath (
PossibleMethodCall &&
(Node->Type == ACPI_TYPE_METHOD))
{
+ if (WalkState->Opcode == AML_UNLOAD_OP)
+ {
+ /*
+ * AcpiPsGetNextNamestring has increased the AML pointer,
+ * so we need to restore the saved AML pointer for method call.
+ */
+ WalkState->ParserState.Aml = Start;
+ WalkState->ArgCount = 1;
+ AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP);
+ return_ACPI_STATUS (AE_OK);
+ }
+
/* This name is actually a control method invocation */
MethodDesc = AcpiNsGetAttachedObject (Node);
@@ -824,7 +829,26 @@ AcpiPsGetNextArg (
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 0);
+ /* To support SuperName arg of Unload */
+
+ if (WalkState->Opcode == AML_UNLOAD_OP)
+ {
+ Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 1);
+
+ /*
+ * If the SuperName arg of Unload is a method call,
+ * we have restored the AML pointer, just free this Arg
+ */
+ if (Arg->Common.AmlOpcode == AML_INT_METHODCALL_OP)
+ {
+ AcpiPsFreeOp (Arg);
+ Arg = NULL;
+ }
+ }
+ else
+ {
+ Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 0);
+ }
}
else
{