mirror of
https://github.com/acpica/acpica/
synced 2025-02-14 12:34:50 +03:00
Support to allow unresolved references within Package objects (optional)
This commit is contained in:
parent
6988588492
commit
20d8380796
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: dsobject - Dispatcher object management routines
|
||||
* $Revision: 1.124 $
|
||||
* $Revision: 1.125 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -126,6 +126,8 @@
|
||||
#define _COMPONENT ACPI_DISPATCHER
|
||||
ACPI_MODULE_NAME ("dsobject")
|
||||
|
||||
/* Local prototypes */
|
||||
|
||||
static ACPI_STATUS
|
||||
AcpiDsBuildInternalObject (
|
||||
ACPI_WALK_STATE *WalkState,
|
||||
@ -166,28 +168,52 @@ AcpiDsBuildInternalObject (
|
||||
if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
|
||||
{
|
||||
/*
|
||||
* This is an named object reference. If this name was
|
||||
* This is a named object reference. If this name was
|
||||
* previously looked up in the namespace, it was stored in this op.
|
||||
* Otherwise, go ahead and look it up now
|
||||
*/
|
||||
if (!Op->Common.Node)
|
||||
{
|
||||
Status = AcpiNsLookup (WalkState->ScopeInfo,
|
||||
Op->Common.Value.String,
|
||||
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
||||
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
|
||||
NULL,
|
||||
(ACPI_NAMESPACE_NODE **) &(Op->Common.Node));
|
||||
|
||||
Op->Common.Value.String,
|
||||
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
||||
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
|
||||
ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &(Op->Common.Node)));
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
ACPI_REPORT_NSERROR (Op->Common.Value.String, Status);
|
||||
/* Check if we are resolving a named reference within a package */
|
||||
|
||||
if ((Status == AE_NOT_FOUND) && (AcpiGbl_EnableInterpreterSlack) &&
|
||||
|
||||
((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
|
||||
(Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)))
|
||||
{
|
||||
/*
|
||||
* We didn't find the target and we are populating elements
|
||||
* of a package - ignore if slack enabled. Some ASL code
|
||||
* contains dangling invalid references in packages and
|
||||
* expects that no exception will be issued. Leave the
|
||||
* element as a null element. It cannot be used, but it
|
||||
* can be overwritten by subsequent ASL code - this is
|
||||
* typically the case.
|
||||
*/
|
||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
||||
"Ignoring unresolved reference in package [%4.4s]\n",
|
||||
WalkState->ScopeInfo->Scope.Node->Name.Ascii));
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
ACPI_REPORT_NSERROR (Op->Common.Value.String, Status);
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Create and init the internal ACPI object */
|
||||
/* Create and init a new internal ACPI object */
|
||||
|
||||
ObjDesc = AcpiUtCreateInternalObject (
|
||||
(AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType);
|
||||
@ -241,15 +267,13 @@ AcpiDsBuildInternalBufferObj (
|
||||
ACPI_FUNCTION_TRACE ("DsBuildInternalBufferObj");
|
||||
|
||||
|
||||
/*
|
||||
* If we are evaluating a Named buffer object "Name (xxxx, Buffer)".
|
||||
* The buffer object already exists (from the NS node), otherwise it must
|
||||
* be created.
|
||||
*/
|
||||
ObjDesc = *ObjDescPtr;
|
||||
if (ObjDesc)
|
||||
{
|
||||
/*
|
||||
* We are evaluating a Named buffer object "Name (xxxx, Buffer)".
|
||||
* The buffer object already exists (from the NS node)
|
||||
*/
|
||||
}
|
||||
else
|
||||
if (!ObjDesc)
|
||||
{
|
||||
/* Create a new buffer object */
|
||||
|
||||
@ -356,7 +380,7 @@ AcpiDsBuildInternalPackageObj (
|
||||
ACPI_OPERAND_OBJECT *ObjDesc = NULL;
|
||||
UINT32 PackageListLength;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
UINT32 i;
|
||||
ACPI_NATIVE_UINT i;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE ("DsBuildInternalPackageObj");
|
||||
@ -365,21 +389,18 @@ AcpiDsBuildInternalPackageObj (
|
||||
/* Find the parent of a possibly nested package */
|
||||
|
||||
Parent = Op->Common.Parent;
|
||||
while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
|
||||
while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
|
||||
(Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
|
||||
{
|
||||
Parent = Parent->Common.Parent;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are evaluating a Named package object "Name (xxxx, Package)",
|
||||
* the package object already exists, otherwise it must be created.
|
||||
*/
|
||||
ObjDesc = *ObjDescPtr;
|
||||
if (ObjDesc)
|
||||
{
|
||||
/*
|
||||
* We are evaluating a Named package object "Name (xxxx, Package)".
|
||||
* Get the existing package object from the NS node
|
||||
*/
|
||||
}
|
||||
else
|
||||
if (!ObjDesc)
|
||||
{
|
||||
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE);
|
||||
*ObjDescPtr = ObjDesc;
|
||||
@ -395,12 +416,10 @@ AcpiDsBuildInternalPackageObj (
|
||||
|
||||
/* Count the number of items in the package list */
|
||||
|
||||
PackageListLength = 0;
|
||||
Arg = Op->Common.Value.Arg;
|
||||
Arg = Arg->Common.Next;
|
||||
while (Arg)
|
||||
for (PackageListLength = 0; Arg; PackageListLength++)
|
||||
{
|
||||
PackageListLength++;
|
||||
Arg = Arg->Common.Next;
|
||||
}
|
||||
|
||||
@ -419,7 +438,7 @@ AcpiDsBuildInternalPackageObj (
|
||||
* that the list is always null terminated.
|
||||
*/
|
||||
ObjDesc->Package.Elements = ACPI_MEM_CALLOCATE (
|
||||
((ACPI_SIZE) ObjDesc->Package.Count + 1) * sizeof (void *));
|
||||
((ACPI_SIZE) ObjDesc->Package.Count + 1) * sizeof (void *));
|
||||
|
||||
if (!ObjDesc->Package.Elements)
|
||||
{
|
||||
@ -428,12 +447,11 @@ AcpiDsBuildInternalPackageObj (
|
||||
}
|
||||
|
||||
/*
|
||||
* Now init the elements of the package
|
||||
* Initialize all elements of the package
|
||||
*/
|
||||
i = 0;
|
||||
Arg = Op->Common.Value.Arg;
|
||||
Arg = Arg->Common.Next;
|
||||
while (Arg)
|
||||
for (i = 0; Arg; i++)
|
||||
{
|
||||
if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
|
||||
{
|
||||
@ -447,8 +465,6 @@ AcpiDsBuildInternalPackageObj (
|
||||
Status = AcpiDsBuildInternalObject (WalkState, Arg,
|
||||
&ObjDesc->Package.Elements[i]);
|
||||
}
|
||||
|
||||
i++;
|
||||
Arg = Arg->Common.Next;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: psargs - Parse AML opcode arguments
|
||||
* $Revision: 1.83 $
|
||||
* $Revision: 1.84 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -421,14 +421,16 @@ AcpiPsGetNextNamepath (
|
||||
{
|
||||
/*
|
||||
* 1) Any error other than NOT_FOUND is always severe
|
||||
* 2) NOT_FOUND is only important if we are executing a method.
|
||||
* 2) NOT_FOUND is only important if we are executing a method:
|
||||
* 3) If executing a CondRefOf opcode, NOT_FOUND is ok.
|
||||
* 4) If resolving a reference in a package, allow NOT_FOUND.
|
||||
*/
|
||||
if ((((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
|
||||
(Status == AE_NOT_FOUND) &&
|
||||
(WalkState->Op->Common.AmlOpcode != AML_COND_REF_OF_OP)) ||
|
||||
|
||||
(Status != AE_NOT_FOUND))
|
||||
if ((Status != AE_NOT_FOUND) ||
|
||||
|
||||
((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
|
||||
(WalkState->Op->Common.AmlOpcode != AML_COND_REF_OF_OP) &&
|
||||
(Arg->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
|
||||
(Arg->Common.Parent->Common.AmlOpcode != AML_VAR_PACKAGE_OP))
|
||||
{
|
||||
ACPI_REPORT_NSERROR (Path, Status);
|
||||
|
||||
@ -438,9 +440,11 @@ AcpiPsGetNextNamepath (
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We got a NOT_FOUND during table load or we encountered
|
||||
* a CondRefOf(x) where the target does not exist.
|
||||
* Either case is ok
|
||||
* We got a NOT_FOUND during table load or we are executing a
|
||||
* method and we encountered a CondRefOf(x) where the target
|
||||
* does not exist, or a package element was unresolved.
|
||||
*
|
||||
* All of these cases are ok at this point.
|
||||
*/
|
||||
Status = AE_OK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user