1
0
mirror of https://github.com/acpica/acpica/ synced 2025-01-25 10:52:02 +03:00

Module-level code: enable _REG execution in same scope.

This change enables the execution of _REG methods that appear in the
same scope as the module-level code, in resonse to an operation region
declaration within the module-level code.
This commit is contained in:
Robert Moore 2009-12-10 12:48:24 -08:00
parent f0c2fd9c36
commit a3dcd06fa0
6 changed files with 36 additions and 4 deletions
source
components
include

View File

@ -519,7 +519,7 @@ AcpiDsCallControlMethod (
if (ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY)
{
Status = ObjDesc->Method.Implementation (NextWalkState);
Status = ObjDesc->Method.Extra.Implementation (NextWalkState);
if (Status == AE_OK)
{
Status = AE_CTRL_TERMINATE;

View File

@ -716,6 +716,20 @@ AcpiEvInitializeRegion (
HandlerObj = ObjDesc->ThermalZone.Handler;
break;
case ACPI_TYPE_METHOD:
/*
* If we are executing module level code, the original
* Node's object was replaced by this Method object and we
* saved the handler in the method object.
*
* See AcpiNsExecModuleCode
*/
if (ObjDesc->Method.Flags & AOPOBJ_MODULE_LEVEL)
{
HandlerObj = ObjDesc->Method.Extra.Handler;
}
break;
default:
/* Ignore other objects */
break;

View File

@ -251,7 +251,7 @@ AcpiNsRootInitialize (
/* Mark this as a very SPECIAL method */
ObjDesc->Method.MethodFlags = AML_METHOD_INTERNAL_ONLY;
ObjDesc->Method.Implementation = AcpiUtOsiImplementation;
ObjDesc->Method.Extra.Implementation = AcpiUtOsiImplementation;
#endif
break;

View File

@ -477,6 +477,19 @@ AcpiNsExecModuleCode (
MethodObj->Method.NextObject);
Type = AcpiNsGetType (ParentNode);
/*
* Get the region handler and save it in the method object. We may need
* this if an operation region declaration causes a _REG method to be run.
*
* We can't do this in AcpiPsLinkModuleCode because
* AcpiGbl_RootNode->Object is NULL at PASS1.
*/
if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object)
{
MethodObj->Method.Extra.Handler =
ParentNode->Object->Device.Handler;
}
/* Must clear NextObject (AcpiNsAttachObject needs the field) */
MethodObj->Method.NextObject = NULL;

View File

@ -403,7 +403,7 @@ AcpiPsExecuteMethod (
if (Info->ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY)
{
Status = Info->ObjDesc->Method.Implementation (WalkState);
Status = Info->ObjDesc->Method.Extra.Implementation (WalkState);
Info->ReturnObject = WalkState->ReturnDesc;
/* Cleanup states */

View File

@ -288,7 +288,12 @@ typedef struct acpi_object_method
UINT8 SyncLevel;
union acpi_operand_object *Mutex;
UINT8 *AmlStart;
ACPI_INTERNAL_METHOD Implementation;
union
{
ACPI_INTERNAL_METHOD Implementation;
union acpi_operand_object *Handler;
} Extra;
UINT32 AmlLength;
UINT8 ThreadCount;
ACPI_OWNER_ID OwnerId;